/** * program.ts — 组装 commander 命令树 (与 CLI 入口解耦, P7 2026-07-24) * * cli.ts 从这里拿 buildProgram() 后 parseAsync; * scripts/gen-command-reference.ts 也从这里拿, 遍历命令树生成 ssw-loop 模板参考 * (模板从 --help 生成, 永不漂移 — DESIGN §6)。 * 关键: 本文件只组装、不 parse, import 无副作用。 */ import { Command } from 'commander' 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 { buildDatasourceCommand } from './commands/datasource/index.ts' import { buildReportCommand } from './commands/report/index.ts' import { buildPortalCommand } from './commands/portal/index.ts' import { buildBigscreenCommand } from './commands/bigscreen/index.ts' import { buildAppCommand } from './commands/app/index.ts' import { buildPrintCommand } from './commands/print/index.ts' import { buildRoleCommand } from './commands/role/index.ts' import { buildUserCommand } from './commands/user/index.ts' import { buildOrgCommand } from './commands/org/index.ts' import { buildMsgCommand } from './commands/msg/index.ts' import { buildScheduleCommand } from './commands/schedule/index.ts' import { buildMonitorCommand } from './commands/monitor/index.ts' import { buildLogCommand } from './commands/log/index.ts' import { buildIntegrationCommand } from './commands/integration/index.ts' import { buildStorageCommand } from './commands/storage/index.ts' import { buildTestCommand } from './commands/test/index.ts' import { buildSelfCheckCommand } from './commands/_selfcheck.ts' import { buildDriftCheckCommand } from './commands/_drift_check.ts' import { buildCoverageCommand } from './commands/_coverage.ts' import { buildKbCommand } from './commands/kb/index.ts' import { buildGateCommand } from './commands/gate/index.ts' // v0.23+ (webapi hardening, Task 9): K 关卡 CLI 接入 export const VERSION = '0.1.0' /** 组装完整 commander 命令树 (不 parse) */ export function buildProgram(): Command { const program = new Command() .name('dacli') .description('dacli (TS 版) — AI 驱动的 JNPF CLI. ') .version(VERSION) .showHelpAfterError(true) program.addCommand(buildFormCommand()) program.addCommand(buildDmCommand()) program.addCommand(buildDictCommand()) program.addCommand(buildMenuCommand()) program.addCommand(buildDiCommand()) program.addCommand(buildWorkflowCommand()) program.addCommand(buildDocCommand()) program.addCommand(buildApisCommand()) program.addCommand(buildDatasourceCommand()) program.addCommand(buildReportCommand()) program.addCommand(buildPortalCommand()) program.addCommand(buildBigscreenCommand()) program.addCommand(buildAppCommand()) program.addCommand(buildPrintCommand()) program.addCommand(buildRoleCommand()) program.addCommand(buildUserCommand()) program.addCommand(buildOrgCommand()) program.addCommand(buildMsgCommand()) program.addCommand(buildScheduleCommand()) program.addCommand(buildMonitorCommand()) program.addCommand(buildLogCommand()) program.addCommand(buildIntegrationCommand()) program.addCommand(buildStorageCommand()) program.addCommand(buildTestCommand()) program.addCommand(buildSelfCheckCommand()) program.addCommand(buildDriftCheckCommand()) program.addCommand(buildCoverageCommand()) program.addCommand(buildKbCommand()) program.addCommand(buildGateCommand()) // v0.23+ (webapi hardening, Task 9): K 关卡 CLI return program }