6a99f84025
- cli-dispatch.ts: 775 → 149 lines (top-level routing only)
- cli-usage.ts: usage formatting (formatCliUsage, formatUsageCommandLines)
- cli-command-types.ts: shared types (DispatchFn, CommandEntry, CommandGroup)
- cli-registry.ts: getCommandRegistry() assembling all group tables
- cli-usage-context.ts: decouple usage from registry (avoids circular deps)
- commands/{workflow,thread,cas,init}/dispatch.ts: group-specific dispatch
functions + subcommand tables
- 242 tests pass, CLI output identical, biome clean
Refs #96
15 lines
477 B
TypeScript
15 lines
477 B
TypeScript
import type { CommandGroup } from "./cli-command-types.js";
|
|
|
|
let commandGroupsForUsage: ReadonlyArray<CommandGroup> | null = null;
|
|
|
|
export function setCommandGroupsForUsage(groups: ReadonlyArray<CommandGroup>): void {
|
|
commandGroupsForUsage = groups;
|
|
}
|
|
|
|
export function getCommandGroupsForUsage(): ReadonlyArray<CommandGroup> {
|
|
if (commandGroupsForUsage === null) {
|
|
throw new Error("BUG: command groups for usage not initialized");
|
|
}
|
|
return commandGroupsForUsage;
|
|
}
|