init: TS 版 dacli v0.7 baseline (8 父命令/26+ 子命令, 0.4MB, .claude/skills/dacli-ts)
参考 boot/ 仓库结构初始化, 同步到 gitea:3000/ssw/dacli (private). 包括: - src/ 8 父命令 (form/menu/dm/dict/di/apis/doc/workflow + login/status) + core (client/crypto/help/log/types/config) - src/schema/ FieldBuilder (从 JNPF web 源码提取, 避免 53 个手写 builder) - tests/ vitest 单元 + playwright E2E (含 workSystem/developSystem baseline regression) - scripts/ extract-all.mjs (从 jnpf-web 源码生成 schema) + seed-tds-baseline.ts - doc/ architecture/plan/api/extractors/baseline/RESUME/help-system + v0.6/v0.7 changelog - .claude/skills/dacli-ts/ Claude 集成 skill (SKILL.md + 5 references + 7 examples + 3 baseline) - CLAUDE.md (项目说明) + README.md + prompt.md (开发任务说明书) - 配置文件: package.json/lock, tsconfig, vitest.config, playwright.config
This commit is contained in:
commit
c98ad4f425
93 files changed
+12718
No files matched your search
+64
@@ -0,0 +1,64 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* cli.ts — dacli TS 版入口
|
||||
*
|
||||
* 调用: `npx tsx src/cli.ts <command>` 或 `node --import tsx src/cli.ts <command>`
|
||||
*
|
||||
* 设计: 嵌套子命令 (form/menu/dm/dict/workflow/doc/apis 父命令 + 子命令)
|
||||
* AI 友好: 每个命令支持 --ai-help / --example / --source
|
||||
*/
|
||||
import { Command } from 'commander'
|
||||
import { buildLoginCommand } from './commands/login.ts'
|
||||
import { buildStatusCommand } from './commands/status.ts'
|
||||
import { buildSwitchAppCommand } from './commands/switch-app.ts'
|
||||
import { buildFormCommand } from './commands/form/index.ts'
|
||||
import { buildDmCommand } from './commands/dm/index.ts'
|
||||
import { buildDictCommand } from './commands/dict/index.ts'
|
||||
import { buildMenuCommand } from './commands/menu/index.ts'
|
||||
import { buildDiCommand } from './commands/di/index.ts'
|
||||
import { buildWorkflowCommand } from './commands/workflow/index.ts'
|
||||
import { buildDocCommand } from './commands/doc/index.ts'
|
||||
import { buildApisCommand } from './commands/apis/index.ts'
|
||||
import { maybeInterceptAiHelp } from './core/help.ts'
|
||||
import { log } from './core/log.ts'
|
||||
import { DacliError } from './core/types.ts'
|
||||
|
||||
const VERSION = '0.1.0'
|
||||
|
||||
const program = new Command()
|
||||
.name('dacli')
|
||||
.description('dacli (TS 版) — AI 驱动的 JNPF CLI. 0 差错 baseline 复刻.')
|
||||
.version(VERSION)
|
||||
.showHelpAfterError(true)
|
||||
|
||||
// ----- 顶层命令 -----
|
||||
program.addCommand(buildLoginCommand())
|
||||
program.addCommand(buildStatusCommand())
|
||||
program.addCommand(buildSwitchAppCommand())
|
||||
|
||||
// ----- 嵌套父命令 -----
|
||||
program.addCommand(buildFormCommand())
|
||||
program.addCommand(buildDmCommand())
|
||||
program.addCommand(buildDictCommand())
|
||||
program.addCommand(buildMenuCommand())
|
||||
program.addCommand(buildDiCommand())
|
||||
program.addCommand(buildWorkflowCommand())
|
||||
program.addCommand(buildDocCommand())
|
||||
program.addCommand(buildApisCommand())
|
||||
|
||||
// ----- main -----
|
||||
// AI flag 拦截 (在 parse 之前, 避免 requiredOption 校验失败)
|
||||
if (maybeInterceptAiHelp(program)) {
|
||||
// 已 exit
|
||||
}
|
||||
|
||||
program.parseAsync(process.argv).catch((err: unknown) => {
|
||||
if (err instanceof DacliError) {
|
||||
log.error(`${err.message}`)
|
||||
if (err.raw && process.env.DACLI_DEBUG === '1') log.dim(err.raw)
|
||||
process.exit(1)
|
||||
}
|
||||
log.error(`${(err as Error).message}`)
|
||||
if (process.env.DACLI_DEBUG === '1') console.error(err)
|
||||
process.exit(1)
|
||||
})
|
||||
Reference in new issue
Block a user