mirror of
https://github.com/langgenius/dify.git
synced 2026-05-20 16:57:01 +08:00
Replaces the hand-written src/commands/tree.ts with a build-time-generated
artifact derived from src/commands/**/index.ts. tree.ts becomes a one-line
re-export of tree.generated.ts. Determinism: lexicographic sort, LF pinned
via .gitattributes, atomic write (tmp + rename), CI-gated by `pnpm tree:check`.
Codegen script (cli/scripts/generate-command-tree.ts) walks the commands
tree, derives canonical PascalCase identifiers (with reserved-word + hyphen
handling), and emits a static ESM module with sorted default imports and a
nested literal of shape CommandTree. Shared exclusion predicate
(isExcludedCommandPath) consumed by both codegen and coverage.test.ts so
underscore-prefixed segments stay non-commands.
Wired pre* lifecycle hooks (prebuild/predev/pretest) and ci composite
gating `tree:check` first. Pack now emits .js outputs (fixedExtension:false)
to drop .mjs; bin/run.js stays on .js. Vitest test.include extended to
cover scripts/.
Framework additions bundled in:
- static hidden = true omits command from printTopLevelHelp listing
(still resolves and runs when invoked)
- static deprecated = '...' prints "deprecated: <msg>" to stderr before
constructing the command
Verified: pnpm ci green (tree:check ok, tsc clean, lint clean, 702 tests
pass, build complete). Smoke: node bin/run.js version + auth login --help,
add-a-command flow, loose-file error case all behave as expected.
77 lines
1.9 KiB
JSON
77 lines
1.9 KiB
JSON
{
|
|
"name": "@langgenius/difyctl",
|
|
"type": "module",
|
|
"version": "0.1.0-rc.1",
|
|
"description": "Dify command-line interface",
|
|
"difyctl": {
|
|
"channel": "rc",
|
|
"compat": {
|
|
"minDify": "1.6.0",
|
|
"maxDify": "1.7.0"
|
|
}
|
|
},
|
|
"license": "Apache-2.0",
|
|
"exports": {
|
|
".": {
|
|
"types": "./dist/index.d.ts",
|
|
"import": "./dist/index.js"
|
|
}
|
|
},
|
|
"bin": {
|
|
"difyctl": "./bin/run.js"
|
|
},
|
|
"files": [
|
|
"README.md",
|
|
"bin",
|
|
"dist"
|
|
],
|
|
"engines": {
|
|
"node": "^22.22.1"
|
|
},
|
|
"scripts": {
|
|
"build": "vp pack",
|
|
"dev": "tsx bin/dev.js",
|
|
"test": "vp test",
|
|
"test:coverage": "vp test --coverage",
|
|
"lint": "eslint",
|
|
"lint:fix": "eslint --fix",
|
|
"type-check": "tsc",
|
|
"tree:gen": "tsx scripts/generate-command-tree.ts",
|
|
"tree:check": "tsx scripts/generate-command-tree.ts --check",
|
|
"prebuild": "pnpm tree:gen",
|
|
"predev": "pnpm tree:gen",
|
|
"pretest": "pnpm tree:gen",
|
|
"ci": "pnpm tree:check && pnpm type-check && pnpm lint && pnpm test:coverage && pnpm build",
|
|
"clean": "rm -rf dist node_modules/.cache",
|
|
"version:info": "tsx scripts/print-buildinfo.ts",
|
|
"docker:build-dev": "scripts/docker-build-dev.sh",
|
|
"sync-models": "scripts/sync-models.sh"
|
|
},
|
|
"dependencies": {
|
|
"@napi-rs/keyring": "catalog:",
|
|
"cli-table3": "catalog:",
|
|
"eventsource-parser": "catalog:",
|
|
"js-yaml": "catalog:",
|
|
"ky": "catalog:",
|
|
"open": "catalog:",
|
|
"ora": "catalog:",
|
|
"picocolors": "catalog:",
|
|
"std-semver": "catalog:",
|
|
"zod": "catalog:"
|
|
},
|
|
"devDependencies": {
|
|
"@dify/tsconfig": "workspace:*",
|
|
"@hono/node-server": "catalog:",
|
|
"@types/js-yaml": "catalog:",
|
|
"@types/node": "catalog:",
|
|
"@vitest/coverage-v8": "catalog:",
|
|
"eslint": "catalog:",
|
|
"hono": "catalog:",
|
|
"tsx": "catalog:",
|
|
"typescript": "catalog:",
|
|
"vite": "catalog:",
|
|
"vite-plus": "catalog:",
|
|
"vitest": "catalog:"
|
|
}
|
|
}
|