@deftai/directive 0.73.1 → 0.74.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -150,9 +150,21 @@ export declare function resolveCanonicalVerb(verb: string): string | null;
150
150
  /** Sorted list of all registered verb names (canonical + aliases). */
151
151
  export declare function registeredVerbs(): readonly string[];
152
152
  /**
153
- * Print dispatcher help. Leads with the three-command model (init / update /
154
- * doctor) + first-run guidance so a no-arg `directive` orients a newcomer before
155
- * the exhaustive verb list, which stays available below for power users (#2273).
153
+ * Deduplicated command names for `directive commands`, preferring colon-style
154
+ * task verbs over dash-style canonical stems when both exist (#2172).
155
+ */
156
+ export declare function preferredCommandNames(): readonly string[];
157
+ /** Major.minor label for the curated help title (#2172). */
158
+ export declare function helpVersionLabel(): string;
159
+ /**
160
+ * Print the exhaustive registered-command list for `directive commands` (#2172).
161
+ * Lists deduplicated preferred names (colon-style when available).
162
+ */
163
+ export declare function printCommandsList(io?: DispatchIo): void;
164
+ /**
165
+ * Print curated top-level help: title/version, usage, common options, grouped
166
+ * common commands, and a pointer to `directive commands` for the full list
167
+ * (#2172). Preserves the init/update/doctor first-run guidance from #2273.
156
168
  */
157
169
  export declare function printHelp(io?: DispatchIo): void;
158
170
  /** Dispatch argv to a registered verb; returns the handler exit code. */
package/dist/dispatch.js CHANGED
@@ -2357,32 +2357,126 @@ export function registeredVerbs() {
2357
2357
  ]);
2358
2358
  return [...names].sort();
2359
2359
  }
2360
+ /** Top-level UX commands routed before the flat dispatcher (#1670). */
2361
+ const TOP_LEVEL_COMMAND_NAMES = [
2362
+ "init",
2363
+ "update",
2364
+ "migrate",
2365
+ "bootstrap",
2366
+ "doctor",
2367
+ "check",
2368
+ ];
2369
+ /** Scope lifecycle verbs exposed as scope:<verb> in help (#2172). */
2370
+ const SCOPE_COMMAND_NAMES = [
2371
+ "scope:promote",
2372
+ "scope:activate",
2373
+ "scope:complete",
2374
+ "scope:demote",
2375
+ "scope:undo",
2376
+ ];
2377
+ /**
2378
+ * Deduplicated command names for `directive commands`, preferring colon-style
2379
+ * task verbs over dash-style canonical stems when both exist (#2172).
2380
+ */
2381
+ export function preferredCommandNames() {
2382
+ const aliasKeys = Object.keys(VERB_ALIASES);
2383
+ const aliasedCanonicals = new Set(Object.values(VERB_ALIASES));
2384
+ const unaliasedCanonicals = [...CLI_MODULE_VERBS, ...CORE_MODULE_VERBS].filter((verb) => !aliasedCanonicals.has(verb));
2385
+ return [
2386
+ ...new Set([
2387
+ ...TOP_LEVEL_COMMAND_NAMES,
2388
+ ...SCOPE_COMMAND_NAMES,
2389
+ ...aliasKeys,
2390
+ ...unaliasedCanonicals,
2391
+ ]),
2392
+ ].sort();
2393
+ }
2394
+ /** Major.minor label for the curated help title (#2172). */
2395
+ export function helpVersionLabel() {
2396
+ const version = engineInfo().version;
2397
+ const match = /^(\d+\.\d+)/.exec(version);
2398
+ return match ? `v${match[1]}` : `v${version}`;
2399
+ }
2400
+ const CURATED_HELP_GROUPS = [
2401
+ {
2402
+ title: "Getting started",
2403
+ commands: [
2404
+ { name: "init", summary: "Set up Directive in the current project (first-time setup)" },
2405
+ { name: "update", summary: "Refresh an existing install and self-heal the engine" },
2406
+ { name: "doctor", summary: "Diagnose the install and print the one next step" },
2407
+ ],
2408
+ },
2409
+ {
2410
+ title: "Session & ritual",
2411
+ commands: [{ name: "session:start", summary: "Record session-start ritual state" }],
2412
+ },
2413
+ {
2414
+ title: "Quality & gates",
2415
+ commands: [{ name: "check", summary: "Run install and lifecycle quality gates" }],
2416
+ },
2417
+ {
2418
+ title: "Work queue & triage",
2419
+ commands: [
2420
+ { name: "triage:welcome", summary: "Session orientation and triage one-liner" },
2421
+ { name: "triage:queue", summary: "Ranked work queue for what to do next" },
2422
+ ],
2423
+ },
2424
+ {
2425
+ title: "Scope lifecycle",
2426
+ commands: [{ name: "scope:promote", summary: "Promote a scope xBRIEF to pending" }],
2427
+ },
2428
+ {
2429
+ title: "Project artifacts",
2430
+ commands: [
2431
+ { name: "project:render", summary: "Render PROJECT-DEFINITION projection" },
2432
+ { name: "spec:render", summary: "Render specification projection" },
2433
+ ],
2434
+ },
2435
+ ];
2436
+ function formatHelpCommand(command) {
2437
+ const padding = " ".repeat(Math.max(1, 22 - command.name.length));
2438
+ return ` ${command.name}${padding}${command.summary}\n`;
2439
+ }
2440
+ /**
2441
+ * Print the exhaustive registered-command list for `directive commands` (#2172).
2442
+ * Lists deduplicated preferred names (colon-style when available).
2443
+ */
2444
+ export function printCommandsList(io = defaultIo()) {
2445
+ io.writeOut("Registered commands:\n");
2446
+ for (const name of preferredCommandNames()) {
2447
+ io.writeOut(` ${name}\n`);
2448
+ }
2449
+ }
2360
2450
  /**
2361
- * Print dispatcher help. Leads with the three-command model (init / update /
2362
- * doctor) + first-run guidance so a no-arg `directive` orients a newcomer before
2363
- * the exhaustive verb list, which stays available below for power users (#2273).
2451
+ * Print curated top-level help: title/version, usage, common options, grouped
2452
+ * common commands, and a pointer to `directive commands` for the full list
2453
+ * (#2172). Preserves the init/update/doctor first-run guidance from #2273.
2364
2454
  */
2365
2455
  export function printHelp(io = defaultIo()) {
2366
- io.writeOut("directive -- the Deft Directive CLI\n" +
2367
- "\n" +
2368
- "Start here (most projects only need these three):\n" +
2369
- " directive init Set up Directive in the current project (first-time setup)\n" +
2370
- " directive update Refresh an existing install and self-heal the engine\n" +
2371
- " directive doctor Diagnose the install and print the one next step\n" +
2372
- "\n" +
2456
+ io.writeOut(`Directive ${helpVersionLabel()}\n`);
2457
+ io.writeOut("AI development framework CLI for project lifecycle, scope, and quality gates.\n\n");
2458
+ io.writeOut("Usage:\n");
2459
+ io.writeOut(" directive <command> [options]\n");
2460
+ io.writeOut(" directive help\n");
2461
+ io.writeOut(" directive commands List every registered command\n\n");
2462
+ io.writeOut("Options:\n");
2463
+ io.writeOut(" -h, --help Show this help\n");
2464
+ io.writeOut(" -V, --version Print version information\n\n");
2465
+ for (const group of CURATED_HELP_GROUPS) {
2466
+ io.writeOut(`${group.title}:\n`);
2467
+ for (const command of group.commands) {
2468
+ io.writeOut(formatHelpCommand(command));
2469
+ }
2470
+ io.writeOut("\n");
2471
+ }
2472
+ io.writeOut("Commands use colon style (e.g. triage:queue); dash-style aliases remain supported.\n" +
2473
+ "Run `directive commands` for the full registered-command list.\n\n" +
2373
2474
  "First run? From the project root:\n" +
2374
2475
  " 1. npm i -g @deftai/directive (Node >= 20)\n" +
2375
2476
  " (pnpm: pnpm add -g @deftai/directive -- ensure PNPM_HOME is on PATH, run `pnpm setup` if needed)\n" +
2376
2477
  " 2. directive init\n" +
2377
2478
  " 3. directive doctor\n" +
2378
- "New clone where `directive` will not run? Read the Cold-start bootstrap block at the top of README.md.\n" +
2379
- "\n" +
2380
- "Usage: directive <verb> [args...]\n" +
2381
- "\n" +
2382
- "Registered verbs:\n");
2383
- for (const name of registeredVerbs()) {
2384
- io.writeOut(` ${name}\n`);
2385
- }
2479
+ "New clone where `directive` will not run? Read the Cold-start bootstrap block at the top of README.md.\n");
2386
2480
  }
2387
2481
  async function invokeHandler(handler, argv) {
2388
2482
  const code = await handler(argv);
@@ -2404,6 +2498,10 @@ export async function dispatch(argv, io = defaultIo()) {
2404
2498
  return 0;
2405
2499
  }
2406
2500
  const [verb, ...rest] = argv;
2501
+ if (verb === "commands") {
2502
+ printCommandsList(io);
2503
+ return 0;
2504
+ }
2407
2505
  const canonical = resolveCanonicalVerb(verb ?? "");
2408
2506
  if (canonical === null) {
2409
2507
  io.writeErr(`directive: unknown verb '${verb}'\n`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deftai/directive",
3
- "version": "0.73.1",
3
+ "version": "0.74.0",
4
4
  "description": "Directive CLI — npm install path for the Deft Directive framework.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -31,8 +31,8 @@
31
31
  "provenance": true
32
32
  },
33
33
  "dependencies": {
34
- "@deftai/directive-core": "^0.73.1",
35
- "@deftai/directive-content": "^0.73.1"
34
+ "@deftai/directive-core": "^0.74.0",
35
+ "@deftai/directive-content": "^0.74.0"
36
36
  },
37
37
  "scripts": {
38
38
  "build": "tsc -b"