@deftai/directive 0.124.0 → 0.125.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.
@@ -16,6 +16,14 @@ export declare const PR_VERB_MAP: Readonly<Record<string, string>>;
16
16
  export declare const VERIFY_VERB_MAP: Readonly<Record<string, string>>;
17
17
  /** Namespace handlers that require a subcommand token after the handler stem. */
18
18
  export declare const SUBCOMMAND_ROUTES: Readonly<Record<string, readonly [string, string]>>;
19
+ /** Eight scm:body:* dual-invoke names (#5521); keep in sync with SUBCOMMAND_ROUTES above. */
20
+ export declare const SCM_BODY_COLON_VERBS: readonly ["scm:body:issue:create", "scm:body:issue:edit", "scm:body:issue:fetch", "scm:body:issue:lint", "scm:body:comment:create", "scm:body:comment:edit", "scm:body:pr:edit", "scm:body:pr:lint"];
21
+ /**
22
+ * Colon forms handled by explicit `routeNamespaceVerb` branches (not SUBCOMMAND_ROUTES /
23
+ * PR_VERB_MAP / VERIFY_VERB_MAP / SCOPE_LIFECYCLE_VERBS). Scraped by rule-to-verb parity
24
+ * so valid citations like `deft framework:doctor` pass (#5521).
25
+ */
26
+ export declare const ROUTER_BRANCH_COLON_VERBS: readonly ["framework:doctor", "agents:refresh", "scope:demote", "scope:decompose", "scope:undo", "scope:record-approved-scope", "scope:record-observable-scope", "scope:record-intent-constraint", "scm:issue:design-critique-chip", "scm:issue:design-critique-stale-ready", "scm:issue:work-claim", "issue:ingest", "issue:emit", "issue:sync-from-xbrief"];
19
27
  export type RouteKind = "dispatch" | "stub";
20
28
  export interface RoutedArgv {
21
29
  kind: RouteKind;
@@ -118,11 +118,52 @@ export const SUBCOMMAND_ROUTES = {
118
118
  "github-body:comment-edit": ["github-body", "comment-edit"],
119
119
  "github-body:pr-edit": ["github-body", "pr-edit"],
120
120
  "github-body:pr-lint": ["github-body", "pr-lint"],
121
+ // #5521: pinned AGENTS scm:body:* colon aliases → github-body engine (argv inserts subcommand)
122
+ "scm:body:issue:create": ["github-body", "issue-create"],
123
+ "scm:body:issue:edit": ["github-body", "issue-edit"],
124
+ "scm:body:issue:fetch": ["github-body", "issue-fetch"],
125
+ "scm:body:issue:lint": ["github-body", "issue-lint"],
126
+ "scm:body:comment:create": ["github-body", "comment-create"],
127
+ "scm:body:comment:edit": ["github-body", "comment-edit"],
128
+ "scm:body:pr:edit": ["github-body", "pr-edit"],
129
+ "scm:body:pr:lint": ["github-body", "pr-lint"],
121
130
  "plan-sequence:set": ["plan-sequence", "set"],
122
131
  "plan-sequence:current": ["plan-sequence", "current"],
123
132
  "plan-sequence:clear": ["plan-sequence", "clear"],
124
133
  "plan-sequence:advance": ["plan-sequence", "advance"],
125
134
  };
135
+ /** Eight scm:body:* dual-invoke names (#5521); keep in sync with SUBCOMMAND_ROUTES above. */
136
+ export const SCM_BODY_COLON_VERBS = [
137
+ "scm:body:issue:create",
138
+ "scm:body:issue:edit",
139
+ "scm:body:issue:fetch",
140
+ "scm:body:issue:lint",
141
+ "scm:body:comment:create",
142
+ "scm:body:comment:edit",
143
+ "scm:body:pr:edit",
144
+ "scm:body:pr:lint",
145
+ ];
146
+ /**
147
+ * Colon forms handled by explicit `routeNamespaceVerb` branches (not SUBCOMMAND_ROUTES /
148
+ * PR_VERB_MAP / VERIFY_VERB_MAP / SCOPE_LIFECYCLE_VERBS). Scraped by rule-to-verb parity
149
+ * so valid citations like `deft framework:doctor` pass (#5521).
150
+ */
151
+ export const ROUTER_BRANCH_COLON_VERBS = [
152
+ "framework:doctor",
153
+ "agents:refresh",
154
+ "scope:demote",
155
+ "scope:decompose",
156
+ "scope:undo",
157
+ "scope:record-approved-scope",
158
+ "scope:record-observable-scope",
159
+ "scope:record-intent-constraint",
160
+ "scm:issue:design-critique-chip",
161
+ "scm:issue:design-critique-stale-ready",
162
+ "scm:issue:work-claim",
163
+ "issue:ingest",
164
+ "issue:emit",
165
+ "issue:sync-from-xbrief",
166
+ ];
126
167
  function isMetaVerb(token) {
127
168
  return token === "--help" || token === "-h" || token === "--version" || token === "-V";
128
169
  }
@@ -12,7 +12,7 @@ export interface DispatchIo {
12
12
  /** CLI modules in packages/cli/src (excluding parity harnesses and bin/index). */
13
13
  export declare const CLI_MODULE_VERBS: readonly ["agents-refresh", "cache", "check", "capacity-backfill", "capacity-show", "codebase-default-extractor", "codebase-map", "codebase-map-fresh", "codebase-projection-registry", "codebase-provider", "doctor", "ownership-doctor", "ownership-fix", "verify-ownership", "install-upgrade", "install-uninstall", "migrate-preflight", "migrate-xbrief", "migrate-category-b", "framework-check-updates", "hook-dispatch", "umbrella-current-shape", "changelog-check", "change-init", "commit-lint", "coverage-hotspots", "policy", "authz", "escalation-cli", "pr-closing-keywords", "pr-merge-readiness", "pr-monitor", "pr-protected-issues", "pr-wait-mergeable", "pr-watch", "pr-finish-loop", "directive-finish-loop", "pre-pr-run", "preflight-cache", "preflight-gh", "probe-session", "release", "release-e2e", "release-publish", "release-rollback", "release-wait-npm", "scope-lifecycle", "scope-record-approved-scope", "scope-record-observable-scope", "scope-record-intent-constraint", "scm-sync-default", "lifecycle-event", "lifecycle-stats", "session-start", "session-ready", "occupancy-steal", "occupancy-release", "occupancy-heartbeat", "occupancy-grant", "plan-sequence", "slice", "subagent-monitor", "toolchain-check", "triage-actions", "triage-bootstrap", "triage-bulk", "triage-classify", "triage-strip-withdrawn", "triage-evaluate", "triage-help", "triage-queue", "triage-reconcile", "triage-refresh", "triage-scope", "triage-scope-drift", "triage-smoketest", "triage-subscribe", "triage-summary", "triage-welcome", "ts-check-lane", "vbrief-activate", "vbrief-build", "vbrief-preflight", "vbrief-reconcile", "vbrief-validate", "vbrief-validation", "xbrief-create", "xbrief-verify", "xbrief-adopt-stored-plan-id", "verify-branch", "verify-encoding", "verify-forward-coverage", "verify-test-boundary", "verify-class-checks", "verify-presentation-coverage", "verify-scope-provenance", "verify-consumer-check-contract", "verify-hooks-installed", "verify-investigation", "verify-judgment-gates", "verify-no-task-runtime", "validate-links", "validate-strategy-output", "verify-biome-config", "verify-bridge-drift", "verify-capacity", "verify-contained-writes", "verify-telemetry-coverage", "verify-content-manifest", "verify-deposit-closure", "verify-consumer-hard-stops", "verify-closing-keywords", "verify-skill-external-fetch-gate", "verify-semantic-single-source", "verify-contract-drift", "verify-cursor-tier1", "verify-openclaw-tier1", "verify-go-freeze", "verify-scm-boundary", "verify-session-ritual", "verify-plan-sequence", "verify-stubs", "verify-xbrief-drift", "verify-spec-prd-fresh", "verify-spec-drift", "rule-ownership-lint", "verify-story-ready", "verify-review-monitor", "verify-cohort-review-monitors", "verify-l4-owner", "verify-subagent-alive", "verify-subagent-steer", "subagent-pre-cancel", "subagent-steer-write", "design-critique-spend-resolve", "review-monitor-register", "review-monitor-release", "verify-tools", "verify-wip-cap", "verify-orphan-active", "verify-pr-closeout-attestable", "verify-lifecycle-visible", "verify-completed-tracked", "verify-completed-write-guard", "verify-literal-ac", "verify-ac", "verify-agents-md-budget", "verify-consumer-header-placeholder", "verify-agents-md-advisory", "verify-persisted-planning-narratives", "verify-eval-health-relocation", "verify-eval-triggers-relocation", "verify-evaluator-surface", "verify-observable-scope", "verify-operator-scope-limit", "verify-presentation-ceiling", "verify-intent-constraint", "verify-durable-effect-acquisition", "verify-consumer-test-lane", "eval-health", "eval-run", "eval-report", "eval-triggers"];
14
14
  /** Core-only CLI entrypoints without a packages/cli wrapper. */
15
- export declare const CORE_MODULE_VERBS: readonly ["scm", "scm-readiness", "github-auth-modes", "github-body", "issue-emit", "issue-ingest", "issue-sync-from-xbrief", "reconcile-issues", "swarm-launch", "swarm-complete-cohort", "swarm-finalize-cohort", "swarm-finalize-owed", "swarm-pre-dispatch", "swarm-readiness", "swarm-routing-verify", "swarm-routing-set", "swarm-verify-review-clean", "swarm-worktrees", "framework-commands", "pack-render", "packs-slice", "prd-render", "export-spec", "project-render", "project-write-narratives", "roadmap-render", "rule-map", "spec-render", "spec-reconstruct", "spec-validate", "code-structure-validate", "pack-migrate-skills", "pack-migrate-rules", "pack-migrate-strategies", "pack-migrate-patterns", "pack-migrate-swarm-spec", "policy-set", "setup-ghx", "scope-undo", "scope-demote", "scope-decompose", "changelog-resolve-unreleased", "architecture-preflight-sor", "feedback-file", "value-readback", "product-signal", "freshness-report", "decision-write", "decision-list", "docs-impact", "migrate-clause-ids", "migrate-confidence"];
15
+ export declare const CORE_MODULE_VERBS: readonly ["scm", "scm-readiness", "github-auth-modes", "github-body", "issue-emit", "issue-ingest", "issue-sync-from-xbrief", "reconcile-issues", "swarm-launch", "swarm-complete-cohort", "swarm-finalize-cohort", "swarm-finalize-owed", "swarm-pre-dispatch", "swarm-readiness", "swarm-routing-verify", "swarm-routing-set", "swarm-verify-review-clean", "swarm-worktrees", "framework-commands", "pack-render", "packs-slice", "prd-render", "export-spec", "project-render", "project-write-narratives", "roadmap-render", "rule-map", "spec-render", "spec-reconstruct", "spec-validate", "code-structure-validate", "pack-migrate-skills", "pack-migrate-rules", "pack-migrate-strategies", "pack-migrate-patterns", "pack-migrate-swarm-spec", "policy-set", "setup-ghx", "scope-undo", "scope-demote", "scope-decompose", "changelog-resolve-unreleased", "architecture-preflight-sor", "feedback-file", "value-readback", "product-signal", "freshness-report", "decision-write", "decision-list", "docs-impact", "migrate-clause-ids", "migrate-confidence", "rule-to-verb-parity"];
16
16
  /** Colon aliases for triage-actions (mirrors cli-router SUBCOMMAND_ROUTES). */
17
17
  export declare const TRIAGE_ACTION_ALIAS_SUBCOMMANDS: Readonly<Record<string, string>>;
18
18
  /** Colon aliases for policy subcommands (mirrors cli-router SUBCOMMAND_ROUTES). */
@@ -177,12 +177,13 @@ export declare function printCommandsList(io?: DispatchIo): void;
177
177
  * (#2172). Preserves the init/update/doctor first-run guidance from #2273.
178
178
  */
179
179
  export declare function printHelp(io?: DispatchIo): void;
180
+ export type UnknownColonHintContext = "framework" | "include-only" | "no-taskfile" | "unknown";
180
181
  /**
181
- * Unknown-colon-verb remediation (#3439 / #2652).
182
- * Agent-facing spelling is `deft <verb>` (works on consumer CLI and source).
183
- * Bare `task <verb>` is not consumer-runnable on include-only Taskfiles.
182
+ * Unknown-colon-verb remediation (#3439 / #2652 / #5521).
183
+ * Never re-suggest the failing `deft <verb>` spelling. Prefer Taskfile
184
+ * dual-invoke forms when known; demote hyphen stems; no `task --list` shell-out.
184
185
  */
185
- export declare function unknownColonVerbHint(verb: string): string;
186
+ export declare function unknownColonVerbHint(verb: string, context?: UnknownColonHintContext): string;
186
187
  /** Dispatch argv to a registered verb; returns the handler exit code. */
187
188
  export declare function dispatch(argv: string[], io?: DispatchIo): Promise<number>;
188
189
  /** Test seam: reset lazy handler cache between cases. */
package/dist/dispatch.js CHANGED
@@ -245,6 +245,7 @@ export const CORE_MODULE_VERBS = [
245
245
  "docs-impact",
246
246
  "migrate-clause-ids",
247
247
  "migrate-confidence",
248
+ "rule-to-verb-parity",
248
249
  ];
249
250
  /** Colon aliases for triage-actions (mirrors cli-router SUBCOMMAND_ROUTES). */
250
251
  export const TRIAGE_ACTION_ALIAS_SUBCOMMANDS = {
@@ -391,6 +392,7 @@ export const VERB_ALIASES = {
391
392
  "validate:links": "validate-links",
392
393
  "verify:rule-ownership": "rule-ownership-lint",
393
394
  "rule:ownership-lint": "rule-ownership-lint",
395
+ "verify:rule-to-verb-parity": "rule-to-verb-parity",
394
396
  "verify:biome-config": "verify-biome-config",
395
397
  "verify:contained-writes": "verify-contained-writes",
396
398
  "verify:telemetry-coverage": "verify-telemetry-coverage",
@@ -2469,6 +2471,10 @@ async function loadCoreModuleHandler(verb, io) {
2469
2471
  const { mainEntry } = await import("@deftai/directive-core/dist/intake/github-body-cli.js");
2470
2472
  return mainEntry;
2471
2473
  }
2474
+ case "rule-to-verb-parity": {
2475
+ const { mainEntry } = await import("@deftai/directive-core/dist/check/rule-to-verb-parity.js");
2476
+ return mainEntry;
2477
+ }
2472
2478
  case "issue-emit": {
2473
2479
  const { mainEntry } = await import("@deftai/directive-core/dist/intake/issue-emit-cli.js");
2474
2480
  return mainEntry;
@@ -2729,6 +2735,21 @@ const SCOPE_COMMAND_NAMES = [
2729
2735
  "scope:record-observable-scope",
2730
2736
  "scope:record-intent-constraint",
2731
2737
  ];
2738
+ /**
2739
+ * Static dual-invoke set for scm:body:* (#5521). Mirror of
2740
+ * packages/cli/src/cli-router/route-argv.ts SCM_BODY_COLON_VERBS — kept here
2741
+ * so dispatch does not import route-argv (route-argv already imports dispatch).
2742
+ */
2743
+ const SCM_BODY_DUAL_INVOKE_VERBS = new Set([
2744
+ "scm:body:issue:create",
2745
+ "scm:body:issue:edit",
2746
+ "scm:body:issue:fetch",
2747
+ "scm:body:issue:lint",
2748
+ "scm:body:comment:create",
2749
+ "scm:body:comment:edit",
2750
+ "scm:body:pr:edit",
2751
+ "scm:body:pr:lint",
2752
+ ]);
2732
2753
  /**
2733
2754
  * Deduplicated command names for `directive commands`, preferring colon-style
2734
2755
  * task verbs over dash-style canonical stems when both exist (#2172).
@@ -2742,6 +2763,7 @@ export function preferredCommandNames() {
2742
2763
  ...TOP_LEVEL_COMMAND_NAMES,
2743
2764
  ...SCOPE_COMMAND_NAMES,
2744
2765
  ...aliasKeys,
2766
+ ...SCM_BODY_DUAL_INVOKE_VERBS,
2745
2767
  ...unaliasedCanonicals,
2746
2768
  ]),
2747
2769
  ].sort();
@@ -2910,20 +2932,54 @@ async function invokeHandler(handler, argv) {
2910
2932
  }
2911
2933
  const PLAN_SEQUENCE_VERBS = "set|current|clear|advance";
2912
2934
  /**
2913
- * Unknown-colon-verb remediation (#3439 / #2652).
2914
- * Agent-facing spelling is `deft <verb>` (works on consumer CLI and source).
2915
- * Bare `task <verb>` is not consumer-runnable on include-only Taskfiles.
2935
+ * Unknown-colon-verb remediation (#3439 / #2652 / #5521).
2936
+ * Never re-suggest the failing `deft <verb>` spelling. Prefer Taskfile
2937
+ * dual-invoke forms when known; demote hyphen stems; no `task --list` shell-out.
2916
2938
  */
2917
- export function unknownColonVerbHint(verb) {
2939
+ export function unknownColonVerbHint(verb, context = "unknown") {
2918
2940
  if (verb.startsWith("plan-sequence:") && !(verb in PLAN_SEQUENCE_ALIAS_SUBCOMMANDS)) {
2919
2941
  return (`hint: plan-sequence verbs are ${PLAN_SEQUENCE_VERBS} ` +
2920
2942
  `(e.g. \`deft plan-sequence:current\`). '${verb}' is not a verb. ` +
2921
2943
  `Do not run bare \`task ${verb}\` -- consumer include-only Taskfiles cannot resolve it.\n`);
2922
2944
  }
2923
2945
  const hyphen = verb.replaceAll(":", "-");
2924
- return (`hint: try \`deft ${verb}\` (CLI) or \`task deft:${verb}\` (consumer Taskfile). ` +
2925
- `Bare \`task ${verb}\` does not exist on include-only deposits. ` +
2926
- `Hyphen stem: ${hyphen}.\n`);
2946
+ const hyphenNote = `Hyphen stem \`${hyphen}\` is not primary recovery.`;
2947
+ const listing = "List registered CLI verbs with `deft commands`.";
2948
+ if (SCM_BODY_DUAL_INVOKE_VERBS.has(verb)) {
2949
+ if (context === "include-only") {
2950
+ return (`hint: try \`task deft:${verb}\` (consumer include Taskfile). ` +
2951
+ `Bare \`task ${verb}\` is framework-only. ${hyphenNote} ${listing}\n`);
2952
+ }
2953
+ if (context === "no-taskfile") {
2954
+ return (`hint: Taskfile recovery is unavailable here. ` +
2955
+ `On a framework checkout with go-task: \`task ${verb}\`; ` +
2956
+ `on an include-only deposit: \`task deft:${verb}\`. ${hyphenNote} ${listing}\n`);
2957
+ }
2958
+ if (context === "framework") {
2959
+ return (`hint: try \`task ${verb}\` (framework Taskfile) or \`task deft:${verb}\` (consumer include). ` +
2960
+ `${hyphenNote} ${listing}\n`);
2961
+ }
2962
+ return (`hint: if go-task is available, try \`task ${verb}\` (framework) or ` +
2963
+ `\`task deft:${verb}\` (consumer include) — Taskfile recovery is conditional. ` +
2964
+ `${hyphenNote} ${listing}\n`);
2965
+ }
2966
+ if (context === "include-only") {
2967
+ return (`hint: do not retry the same \`deft ${verb}\` spelling. ` +
2968
+ `If a Taskfile task exists, try \`task deft:${verb}\` (include-only). ` +
2969
+ `${hyphenNote} ${listing}\n`);
2970
+ }
2971
+ if (context === "no-taskfile") {
2972
+ return (`hint: do not retry the same \`deft ${verb}\` spelling. ` +
2973
+ `Taskfile recovery is unavailable here. ${hyphenNote} ${listing}\n`);
2974
+ }
2975
+ if (context === "framework") {
2976
+ return (`hint: do not retry the same \`deft ${verb}\` spelling. ` +
2977
+ `If a Taskfile task exists, try \`task ${verb}\` (framework) or \`task deft:${verb}\` (include). ` +
2978
+ `${hyphenNote} ${listing}\n`);
2979
+ }
2980
+ return (`hint: do not retry the same \`deft ${verb}\` spelling. ` +
2981
+ `If a Taskfile task exists, try \`task ${verb}\` (framework) or \`task deft:${verb}\` (include) — ` +
2982
+ `Taskfile recovery is conditional. ${hyphenNote} ${listing}\n`);
2927
2983
  }
2928
2984
  function versionBanner() {
2929
2985
  return `${identityBanner()}\n`;
@@ -7,6 +7,8 @@ interface ParsedArgs {
7
7
  quiet?: boolean;
8
8
  error?: string;
9
9
  }
10
+ /** Typed-only deliveryBranch union for CLI-seeded DEFAULT_BRANCHES (#5520). */
11
+ export declare function enrichBranchesWithTypedDelivery(projectRoot: string | undefined, branches: ReadonlySet<string>): Set<string>;
10
12
  export declare function parseArgs(argv: string[]): ParsedArgs;
11
13
  export declare function run(argv: string[]): number | Promise<number>;
12
14
  export {};
@@ -13,7 +13,19 @@
13
13
  */
14
14
  import { createInterface } from "node:readline";
15
15
  import { fileURLToPath } from "node:url";
16
+ import { resolveDeliveryBranch } from "@deftai/directive-core/policy";
16
17
  import { DEFAULT_BRANCHES, evaluateCommand, evaluatePrePush, parsePrePushStdin, runSelfTest, } from "@deftai/directive-core/preflight";
18
+ /** Typed-only deliveryBranch union for CLI-seeded DEFAULT_BRANCHES (#5520). */
19
+ export function enrichBranchesWithTypedDelivery(projectRoot, branches) {
20
+ const next = new Set(branches);
21
+ if (projectRoot === undefined || projectRoot.length === 0)
22
+ return next;
23
+ const delivery = resolveDeliveryBranch(projectRoot);
24
+ if (delivery.source === "typed" && delivery.error === null && delivery.branch.trim().length > 0) {
25
+ next.add(delivery.branch);
26
+ }
27
+ return next;
28
+ }
17
29
  export function parseArgs(argv) {
18
30
  const parsed = { defaultBranches: new Set(DEFAULT_BRANCHES) };
19
31
  for (let i = 0; i < argv.length; i++) {
@@ -66,7 +78,8 @@ export function run(argv) {
66
78
  return 2;
67
79
  }
68
80
  const quiet = args.quiet ?? false;
69
- const branches = args.defaultBranches ?? new Set(DEFAULT_BRANCHES);
81
+ // CLI seeds DEFAULT_BRANCHES; union typed delivery when --project-root is set (#5520).
82
+ const branches = enrichBranchesWithTypedDelivery(args.projectRoot, args.defaultBranches ?? new Set(DEFAULT_BRANCHES));
70
83
  if (args.mode === "self-test") {
71
84
  const [code, msg] = runSelfTest();
72
85
  if (code === 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deftai/directive",
3
- "version": "0.124.0",
3
+ "version": "0.125.0",
4
4
  "description": "Directive CLI — npm install path for the Deft Directive framework.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://deftai.github.io/directive/",
@@ -35,8 +35,8 @@
35
35
  "provenance": true
36
36
  },
37
37
  "dependencies": {
38
- "@deftai/directive-core": "^0.124.0",
39
- "@deftai/directive-content": "^0.124.0"
38
+ "@deftai/directive-core": "^0.125.0",
39
+ "@deftai/directive-content": "^0.125.0"
40
40
  },
41
41
  "scripts": {
42
42
  "build": "tsc -b",