Files
dacli/src/program.ts
T
ssw bfd9e43e6a fix(gates): T9 — AppContext 字段映射修正, K gate 子命令接入, designResources 落地校验
1. buildContextSummary 字段名映射修复 (实 AppContext schema):
   - full.currentSystemId → summary.systemId (不是 full.systemId)
   - full.currentUser → summary.user (不是 full.user)
   - tokenStatus union: 'valid' | 'expired' | 'unknown' (不是 'ok')
   - resourceCounts 从 releasedForms/unreleasedForms/modifiedAfterPublishForms/workflowList/menus/existingTables 派生
2. wire dacli gate k 子命令 (CLI 最小接入, 走 checkKCheckpoint)
3. _checkpoint_k.ts 实际使用 designResources: phase=summary 校验
   summaryResources ⊇ designResources (design→delivery 一致性)
4. 加 4 新单测: 真实 AppContext literal / currentUser undefined / designed but not delivered / 全交付
2026-07-28 20:38:13 +08:00

82 lines
3.8 KiB
TypeScript

/**
* 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
}