@deftai/directive 0.110.0 → 0.112.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.
- package/dist/cli-router/route-argv.js +3 -0
- package/dist/dispatch.d.ts +1 -1
- package/dist/dispatch.js +38 -5
- package/dist/scope-record-approved-scope.d.ts +2 -0
- package/dist/scope-record-approved-scope.js +26 -8
- package/dist/session-start.js +3 -0
- package/dist/vbrief-preflight.d.ts +1 -1
- package/dist/vbrief-preflight.js +20 -2
- package/dist/verify-plan-sequence.d.ts +11 -0
- package/dist/verify-plan-sequence.js +24 -8
- package/dist/verify-source-cli/verify-spec-prd-fresh.d.ts +3 -0
- package/dist/verify-source-cli/verify-spec-prd-fresh.js +15 -0
- package/package.json +3 -3
|
@@ -200,6 +200,9 @@ function routeNamespaceVerb(ns, verb, rest) {
|
|
|
200
200
|
if (ns === "scm" && verb === "issue:design-critique-chip") {
|
|
201
201
|
return { kind: "dispatch", argv: ["scm", "issue", "design-critique-chip", ...rest] };
|
|
202
202
|
}
|
|
203
|
+
if (ns === "scm" && verb === "issue:work-claim") {
|
|
204
|
+
return { kind: "dispatch", argv: ["scm", "issue", "work-claim", ...rest] };
|
|
205
|
+
}
|
|
203
206
|
if (ns === "issue" && verb === "ingest") {
|
|
204
207
|
return { kind: "dispatch", argv: ["issue-ingest", ...rest] };
|
|
205
208
|
}
|
package/dist/dispatch.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export interface DispatchIo {
|
|
|
10
10
|
writeErr: (text: string) => void;
|
|
11
11
|
}
|
|
12
12
|
/** CLI modules in packages/cli/src (excluding parity harnesses and bin/index). */
|
|
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", "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", "preflight-cache", "preflight-gh", "probe-session", "release", "release-e2e", "release-publish", "release-rollback", "scope-lifecycle", "scope-record-approved-scope", "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", "verify-branch", "verify-encoding", "verify-forward-coverage", "verify-test-boundary", "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", "rule-ownership-lint", "verify-story-ready", "verify-review-monitor", "verify-l4-owner", "verify-subagent-alive", "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-agents-md-advisory", "verify-eval-health-relocation", "verify-eval-triggers-relocation", "eval-health", "eval-run", "eval-report", "eval-triggers"];
|
|
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", "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", "preflight-cache", "preflight-gh", "probe-session", "release", "release-e2e", "release-publish", "release-rollback", "scope-lifecycle", "scope-record-approved-scope", "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", "verify-branch", "verify-encoding", "verify-forward-coverage", "verify-test-boundary", "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", "rule-ownership-lint", "verify-story-ready", "verify-review-monitor", "verify-l4-owner", "verify-subagent-alive", "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-agents-md-advisory", "verify-eval-health-relocation", "verify-eval-triggers-relocation", "eval-health", "eval-run", "eval-report", "eval-triggers"];
|
|
14
14
|
/** Core-only CLI entrypoints without a packages/cli wrapper. */
|
|
15
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-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", "roadmap-render", "rule-map", "spec-render", "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"];
|
|
16
16
|
/** Colon aliases for triage-actions (mirrors cli-router SUBCOMMAND_ROUTES). */
|
package/dist/dispatch.js
CHANGED
|
@@ -8,6 +8,7 @@ import { existsSync, mkdirSync, mkdtempSync, readdirSync, readFileSync, readSync
|
|
|
8
8
|
import { homedir, tmpdir } from "node:os";
|
|
9
9
|
import { basename, dirname, isAbsolute, join, relative, resolve } from "node:path";
|
|
10
10
|
import { engineInfo, userConfig } from "@deftai/directive-core";
|
|
11
|
+
import { interceptHelp } from "@deftai/directive-core/dist/triage/help/index.js";
|
|
11
12
|
import { parseInitArgv, runInitDepositCli } from "@deftai/directive-core/init-deposit";
|
|
12
13
|
import { appendAuditLog, disclosureLine, migrateLegacyPolicyKey, PLAN_POLICY_KEY, POLICY_AUDIT_NOOP_STDOUT, policyColonInvocation, policySetInvocation, projectDefinitionPath, resolvePolicy, resolveWipCap, setPolicy, stampChangedToken, } from "@deftai/directive-core/policy";
|
|
13
14
|
import { defaultWhich } from "@deftai/directive-core/scm";
|
|
@@ -138,6 +139,7 @@ export const CLI_MODULE_VERBS = [
|
|
|
138
139
|
"verify-plan-sequence",
|
|
139
140
|
"verify-stubs",
|
|
140
141
|
"verify-xbrief-drift",
|
|
142
|
+
"verify-spec-prd-fresh",
|
|
141
143
|
"rule-ownership-lint",
|
|
142
144
|
"verify-story-ready",
|
|
143
145
|
"verify-review-monitor",
|
|
@@ -350,6 +352,7 @@ export const VERB_ALIASES = {
|
|
|
350
352
|
"verify:bridge-drift": "verify-bridge-drift",
|
|
351
353
|
"verify:scm-boundary": "verify-scm-boundary",
|
|
352
354
|
"verify:xbrief-drift": "verify-xbrief-drift",
|
|
355
|
+
"verify:spec-prd-fresh": "verify-spec-prd-fresh",
|
|
353
356
|
"verify:capacity": "verify-capacity",
|
|
354
357
|
"verify:session-ritual": "verify-session-ritual",
|
|
355
358
|
"verify:plan-sequence": "verify-plan-sequence",
|
|
@@ -432,6 +435,7 @@ const SUBDIR_CLI_STEMS = {
|
|
|
432
435
|
"verify-openclaw-tier1": "verify-source-cli/verify-openclaw-tier1",
|
|
433
436
|
"verify-scm-boundary": "verify-source-cli/verify-scm-boundary",
|
|
434
437
|
"verify-xbrief-drift": "verify-source-cli/verify-xbrief-drift",
|
|
438
|
+
"verify-spec-prd-fresh": "verify-source-cli/verify-spec-prd-fresh",
|
|
435
439
|
"verify-go-freeze": "gates-cli/verify-go-freeze",
|
|
436
440
|
"verify-bridge-drift": "gates-cli/verify-bridge-drift",
|
|
437
441
|
"validate-links": "content-validate-cli/validate-links",
|
|
@@ -556,12 +560,20 @@ function parseCodeStructureArgs(argv) {
|
|
|
556
560
|
const paths = [];
|
|
557
561
|
let json = false;
|
|
558
562
|
let strict = false;
|
|
563
|
+
let enforce = false;
|
|
559
564
|
for (let i = 0; i < argv.length; i += 1) {
|
|
560
565
|
const arg = argv[i];
|
|
561
566
|
if (arg === "--project-root") {
|
|
562
567
|
const v = argv[i + 1];
|
|
563
568
|
if (v === undefined)
|
|
564
|
-
return {
|
|
569
|
+
return {
|
|
570
|
+
projectRoot,
|
|
571
|
+
paths,
|
|
572
|
+
json,
|
|
573
|
+
strict,
|
|
574
|
+
enforce,
|
|
575
|
+
error: "missing --project-root value",
|
|
576
|
+
};
|
|
565
577
|
projectRoot = v;
|
|
566
578
|
i += 1;
|
|
567
579
|
}
|
|
@@ -571,7 +583,7 @@ function parseCodeStructureArgs(argv) {
|
|
|
571
583
|
else if (arg === "--path") {
|
|
572
584
|
const v = argv[i + 1];
|
|
573
585
|
if (v === undefined)
|
|
574
|
-
return { projectRoot, paths, json, strict, error: "missing --path value" };
|
|
586
|
+
return { projectRoot, paths, json, strict, enforce, error: "missing --path value" };
|
|
575
587
|
paths.push(v);
|
|
576
588
|
i += 1;
|
|
577
589
|
}
|
|
@@ -584,11 +596,24 @@ function parseCodeStructureArgs(argv) {
|
|
|
584
596
|
else if (arg === "--strict") {
|
|
585
597
|
strict = true;
|
|
586
598
|
}
|
|
599
|
+
else if (arg === "--enforce") {
|
|
600
|
+
enforce = true;
|
|
601
|
+
}
|
|
602
|
+
else if (arg !== undefined && !arg.startsWith("-")) {
|
|
603
|
+
paths.push(arg);
|
|
604
|
+
}
|
|
587
605
|
else {
|
|
588
|
-
return {
|
|
606
|
+
return {
|
|
607
|
+
projectRoot,
|
|
608
|
+
paths,
|
|
609
|
+
json,
|
|
610
|
+
strict,
|
|
611
|
+
enforce,
|
|
612
|
+
error: `unrecognized argument: ${arg}`,
|
|
613
|
+
};
|
|
589
614
|
}
|
|
590
615
|
}
|
|
591
|
-
return { projectRoot, paths, json, strict };
|
|
616
|
+
return { projectRoot, paths, json, strict, enforce };
|
|
592
617
|
}
|
|
593
618
|
// ===========================================================================
|
|
594
619
|
// Native pack-migrate handlers (#2022 Phase 1).
|
|
@@ -2474,6 +2499,7 @@ async function loadCoreModuleHandler(verb, io) {
|
|
|
2474
2499
|
paths: parsed.paths.length > 0 ? parsed.paths : undefined,
|
|
2475
2500
|
json: parsed.json,
|
|
2476
2501
|
strict: parsed.strict,
|
|
2502
|
+
enforce: parsed.enforce,
|
|
2477
2503
|
});
|
|
2478
2504
|
if (result.stdout)
|
|
2479
2505
|
io.writeOut(result.stdout);
|
|
@@ -2767,6 +2793,7 @@ export function printHelp(io = defaultIo()) {
|
|
|
2767
2793
|
" (pnpm: pnpm add -g @deftai/directive -- ensure PNPM_HOME is on PATH, run `pnpm setup` if needed)\n" +
|
|
2768
2794
|
" 2. directive init\n" +
|
|
2769
2795
|
" 3. directive doctor\n" +
|
|
2796
|
+
" 4. directive toolchain:check --consumer\n" +
|
|
2770
2797
|
"New clone where `directive` will not run? Read the Cold-start bootstrap block at the top of README.md.\n");
|
|
2771
2798
|
}
|
|
2772
2799
|
async function invokeHandler(handler, argv) {
|
|
@@ -2819,7 +2846,6 @@ export async function dispatch(argv, io = defaultIo()) {
|
|
|
2819
2846
|
return 1;
|
|
2820
2847
|
}
|
|
2821
2848
|
try {
|
|
2822
|
-
const handler = await loadHandler(canonical, io);
|
|
2823
2849
|
const triageSubcommand = verb !== undefined ? TRIAGE_ACTION_ALIAS_SUBCOMMANDS[verb] : undefined;
|
|
2824
2850
|
const policySubcommand = verb !== undefined ? POLICY_ACTION_ALIAS_SUBCOMMANDS[verb] : undefined;
|
|
2825
2851
|
const authzSubcommand = verb !== undefined ? AUTHZ_ACTION_ALIAS_SUBCOMMANDS[verb] : undefined;
|
|
@@ -2849,6 +2875,13 @@ export async function dispatch(argv, io = defaultIo()) {
|
|
|
2849
2875
|
: vbriefValidateSubcommand !== undefined
|
|
2850
2876
|
? [vbriefValidateSubcommand, ...rest]
|
|
2851
2877
|
: rest;
|
|
2878
|
+
const helpRc = interceptHelp(canonical.replaceAll("-", "_"), handlerArgv, {
|
|
2879
|
+
write: io.writeOut,
|
|
2880
|
+
});
|
|
2881
|
+
if (helpRc !== null) {
|
|
2882
|
+
return helpRc;
|
|
2883
|
+
}
|
|
2884
|
+
const handler = await loadHandler(canonical, io);
|
|
2852
2885
|
return await invokeHandler(handler, handlerArgv);
|
|
2853
2886
|
}
|
|
2854
2887
|
catch (err) {
|
|
@@ -14,6 +14,8 @@ export interface ParsedArgs {
|
|
|
14
14
|
confirm: boolean;
|
|
15
15
|
/** Optional owner/name seed for preimage approvedRepos (#3385 R5). */
|
|
16
16
|
repo: string;
|
|
17
|
+
/** Typed `--help` / `-h` (#4203); run() prints usage on stdout and exits 0. */
|
|
18
|
+
help?: boolean;
|
|
17
19
|
error?: string;
|
|
18
20
|
}
|
|
19
21
|
/**
|
|
@@ -103,8 +103,11 @@ export function parseArgs(argv) {
|
|
|
103
103
|
const positionals = [];
|
|
104
104
|
for (let i = 0; i < argv.length; i += 1) {
|
|
105
105
|
const arg = argv[i];
|
|
106
|
+
if (arg === "--") {
|
|
107
|
+
continue;
|
|
108
|
+
}
|
|
106
109
|
if (arg === "--help" || arg === "-h") {
|
|
107
|
-
return { ...parsed,
|
|
110
|
+
return { ...parsed, help: true };
|
|
108
111
|
}
|
|
109
112
|
if (arg === "--quiet") {
|
|
110
113
|
parsed.quiet = true;
|
|
@@ -114,7 +117,7 @@ export function parseArgs(argv) {
|
|
|
114
117
|
}
|
|
115
118
|
else if (arg === "--project-root") {
|
|
116
119
|
const value = argv[i + 1];
|
|
117
|
-
if (value === undefined) {
|
|
120
|
+
if (value === undefined || value === "--") {
|
|
118
121
|
return { ...parsed, error: "argument --project-root: expected one argument" };
|
|
119
122
|
}
|
|
120
123
|
parsed.projectRoot = value;
|
|
@@ -125,29 +128,37 @@ export function parseArgs(argv) {
|
|
|
125
128
|
}
|
|
126
129
|
else if (arg === "--actor") {
|
|
127
130
|
const value = argv[i + 1];
|
|
128
|
-
if (value === undefined) {
|
|
131
|
+
if (value === undefined || value === "--") {
|
|
129
132
|
return { ...parsed, error: "argument --actor: expected one argument" };
|
|
130
133
|
}
|
|
131
134
|
parsed.actor = value;
|
|
132
135
|
i += 1;
|
|
133
136
|
}
|
|
134
137
|
else if (arg?.startsWith("--actor=")) {
|
|
135
|
-
|
|
138
|
+
const value = arg.slice("--actor=".length);
|
|
139
|
+
if (value.length === 0 || value === "--") {
|
|
140
|
+
return { ...parsed, error: "argument --actor: expected one argument" };
|
|
141
|
+
}
|
|
142
|
+
parsed.actor = value;
|
|
136
143
|
}
|
|
137
144
|
else if (arg === "--kind") {
|
|
138
145
|
const value = argv[i + 1];
|
|
139
|
-
if (value === undefined) {
|
|
146
|
+
if (value === undefined || value === "--") {
|
|
140
147
|
return { ...parsed, error: "argument --kind: expected one argument" };
|
|
141
148
|
}
|
|
142
149
|
parsed.kind = value;
|
|
143
150
|
i += 1;
|
|
144
151
|
}
|
|
145
152
|
else if (arg?.startsWith("--kind=")) {
|
|
146
|
-
|
|
153
|
+
const value = arg.slice("--kind=".length);
|
|
154
|
+
if (value.length === 0 || value === "--") {
|
|
155
|
+
return { ...parsed, error: "argument --kind: expected one argument" };
|
|
156
|
+
}
|
|
157
|
+
parsed.kind = value;
|
|
147
158
|
}
|
|
148
159
|
else if (arg === "--xbrief-rel-path") {
|
|
149
160
|
const value = argv[i + 1];
|
|
150
|
-
if (value === undefined) {
|
|
161
|
+
if (value === undefined || value === "--") {
|
|
151
162
|
return { ...parsed, error: "argument --xbrief-rel-path: expected one argument" };
|
|
152
163
|
}
|
|
153
164
|
parsed.xbriefRelPath = value;
|
|
@@ -158,7 +169,7 @@ export function parseArgs(argv) {
|
|
|
158
169
|
}
|
|
159
170
|
else if (arg === "--repo") {
|
|
160
171
|
const value = argv[i + 1];
|
|
161
|
-
if (value === undefined) {
|
|
172
|
+
if (value === undefined || value === "--") {
|
|
162
173
|
return { ...parsed, error: "argument --repo: expected one argument" };
|
|
163
174
|
}
|
|
164
175
|
parsed.repo = value;
|
|
@@ -174,6 +185,9 @@ export function parseArgs(argv) {
|
|
|
174
185
|
positionals.push(arg);
|
|
175
186
|
}
|
|
176
187
|
}
|
|
188
|
+
if (parsed.help) {
|
|
189
|
+
return parsed;
|
|
190
|
+
}
|
|
177
191
|
if (positionals.length === 0) {
|
|
178
192
|
return { ...parsed, error: `missing xBRIEF path\n${usage()}` };
|
|
179
193
|
}
|
|
@@ -191,6 +205,10 @@ export function parseArgs(argv) {
|
|
|
191
205
|
}
|
|
192
206
|
export function run(argv, seams = {}) {
|
|
193
207
|
const args = parseArgs(argv);
|
|
208
|
+
if (args.help) {
|
|
209
|
+
process.stdout.write(`${usage()}\n`);
|
|
210
|
+
return 0;
|
|
211
|
+
}
|
|
194
212
|
if (args.error !== undefined) {
|
|
195
213
|
process.stderr.write(`scope_record_approved_scope: ${args.error}\n`);
|
|
196
214
|
return 2;
|
package/dist/session-start.js
CHANGED
|
@@ -8,6 +8,6 @@ interface ParsedArgs {
|
|
|
8
8
|
/** Parse vbrief-preflight / xbrief:preflight CLI args (#810 / #2449). */
|
|
9
9
|
export declare function parseArgs(argv: string[]): ParsedArgs;
|
|
10
10
|
/** Run the gate and return the process exit code (parse errors -> 2). */
|
|
11
|
-
export declare function run(argv: string[]): number;
|
|
11
|
+
export declare function run(argv: string[], scan?: (briefPath: string) => readonly string[]): number;
|
|
12
12
|
export {};
|
|
13
13
|
//# sourceMappingURL=vbrief-preflight.d.ts.map
|
package/dist/vbrief-preflight.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { fileURLToPath } from "node:url";
|
|
3
3
|
import { emitJson, evaluate, PREFLIGHT_USAGE_HINT } from "@deftai/directive-core/preflight";
|
|
4
|
+
import { scanWorkClaimForBriefPath } from "@deftai/directive-core/scm";
|
|
4
5
|
const HELP_TEXT = `usage: xbrief:preflight [--vbrief-path PATH | PATH] [--json] [--help]
|
|
5
6
|
|
|
6
7
|
Implementation-intent gate (#810): exits 0 only when the xBRIEF is in
|
|
@@ -88,7 +89,7 @@ export function parseArgs(argv) {
|
|
|
88
89
|
return parsed;
|
|
89
90
|
}
|
|
90
91
|
/** Run the gate and return the process exit code (parse errors -> 2). */
|
|
91
|
-
export function run(argv) {
|
|
92
|
+
export function run(argv, scan = scanWorkClaimForBriefPath) {
|
|
92
93
|
const args = parseArgs(argv);
|
|
93
94
|
if (args.help) {
|
|
94
95
|
process.stdout.write(HELP_TEXT);
|
|
@@ -100,14 +101,31 @@ export function run(argv) {
|
|
|
100
101
|
}
|
|
101
102
|
const vbriefPath = args.vbriefPath;
|
|
102
103
|
const result = evaluate(vbriefPath);
|
|
104
|
+
let scanLines = [];
|
|
105
|
+
try {
|
|
106
|
+
scanLines = [...scan(vbriefPath)];
|
|
107
|
+
}
|
|
108
|
+
catch (err) {
|
|
109
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
110
|
+
scanLines = [
|
|
111
|
+
`[deft work-claim] warning: scan failed (${message}). Warn is success; this is not a GitHub lock.`,
|
|
112
|
+
];
|
|
113
|
+
}
|
|
103
114
|
if (args.emitJson) {
|
|
104
|
-
|
|
115
|
+
const message = scanLines.length > 0 ? `${result.message}\n${scanLines.join("\n")}` : result.message;
|
|
116
|
+
process.stdout.write(`${emitJson(vbriefPath, result.exitCode, message)}\n`);
|
|
105
117
|
}
|
|
106
118
|
else if (result.exitCode === 0) {
|
|
107
119
|
process.stdout.write(`${result.message}\n`);
|
|
120
|
+
for (const line of scanLines) {
|
|
121
|
+
process.stdout.write(`${line}\n`);
|
|
122
|
+
}
|
|
108
123
|
}
|
|
109
124
|
else {
|
|
110
125
|
process.stderr.write(`${result.message}\n`);
|
|
126
|
+
for (const line of scanLines) {
|
|
127
|
+
process.stderr.write(`${line}\n`);
|
|
128
|
+
}
|
|
111
129
|
}
|
|
112
130
|
return result.exitCode;
|
|
113
131
|
}
|
|
@@ -1,3 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { type PlanTargetKind } from "@deftai/directive-core/plan-sequence";
|
|
3
|
+
export interface Parsed {
|
|
4
|
+
projectRoot: string;
|
|
5
|
+
targetKind: PlanTargetKind | null;
|
|
6
|
+
target: string | null;
|
|
7
|
+
emitJson: boolean;
|
|
8
|
+
/** Typed `--help` / `-h` (#4203); main() prints usage on stdout and exits 0. */
|
|
9
|
+
help?: boolean;
|
|
10
|
+
error?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function parseArgs(argv: string[]): Parsed;
|
|
2
13
|
export declare function main(argv?: string[]): number;
|
|
3
14
|
//# sourceMappingURL=verify-plan-sequence.d.ts.map
|
|
@@ -14,7 +14,8 @@ const KINDS = [
|
|
|
14
14
|
"checklist",
|
|
15
15
|
"review",
|
|
16
16
|
];
|
|
17
|
-
|
|
17
|
+
const USAGE = "usage: verify:plan-sequence -- --target-kind <kind> --target <id-or-title>";
|
|
18
|
+
export function parseArgs(argv) {
|
|
18
19
|
const parsed = {
|
|
19
20
|
projectRoot: ".",
|
|
20
21
|
targetKind: null,
|
|
@@ -23,15 +24,19 @@ function parseArgs(argv) {
|
|
|
23
24
|
};
|
|
24
25
|
for (let i = 0; i < argv.length; i += 1) {
|
|
25
26
|
const arg = argv[i];
|
|
26
|
-
if (arg === undefined)
|
|
27
|
+
if (arg === undefined || arg === "--")
|
|
27
28
|
continue;
|
|
29
|
+
if (arg === "--help" || arg === "-h") {
|
|
30
|
+
return { ...parsed, help: true };
|
|
31
|
+
}
|
|
28
32
|
if (arg === "--json") {
|
|
29
33
|
parsed.emitJson = true;
|
|
30
34
|
}
|
|
31
35
|
else if (arg === "--project-root") {
|
|
32
36
|
const value = argv[++i];
|
|
33
|
-
if (value === undefined)
|
|
37
|
+
if (value === undefined || value === "--") {
|
|
34
38
|
return { ...parsed, error: "--project-root requires a value" };
|
|
39
|
+
}
|
|
35
40
|
parsed.projectRoot = value;
|
|
36
41
|
}
|
|
37
42
|
else if (arg.startsWith("--project-root=")) {
|
|
@@ -39,41 +44,52 @@ function parseArgs(argv) {
|
|
|
39
44
|
}
|
|
40
45
|
else if (arg === "--target-kind") {
|
|
41
46
|
const value = argv[++i];
|
|
42
|
-
if (value === undefined || !KINDS.includes(value)) {
|
|
47
|
+
if (value === undefined || value === "--" || !KINDS.includes(value)) {
|
|
43
48
|
return { ...parsed, error: `--target-kind must be one of ${KINDS.join("|")}` };
|
|
44
49
|
}
|
|
45
50
|
parsed.targetKind = value;
|
|
46
51
|
}
|
|
47
52
|
else if (arg.startsWith("--target-kind=")) {
|
|
48
53
|
const value = arg.slice("--target-kind=".length);
|
|
49
|
-
if (!KINDS.includes(value)) {
|
|
54
|
+
if (value === "--" || !KINDS.includes(value)) {
|
|
50
55
|
return { ...parsed, error: `--target-kind must be one of ${KINDS.join("|")}` };
|
|
51
56
|
}
|
|
52
57
|
parsed.targetKind = value;
|
|
53
58
|
}
|
|
54
59
|
else if (arg === "--target") {
|
|
55
60
|
const value = argv[++i];
|
|
56
|
-
if (value === undefined)
|
|
61
|
+
if (value === undefined || value === "--") {
|
|
57
62
|
return { ...parsed, error: "--target requires a value" };
|
|
63
|
+
}
|
|
58
64
|
parsed.target = value;
|
|
59
65
|
}
|
|
60
66
|
else if (arg.startsWith("--target=")) {
|
|
61
|
-
|
|
67
|
+
const value = arg.slice("--target=".length);
|
|
68
|
+
if (value.length === 0 || value === "--") {
|
|
69
|
+
return { ...parsed, error: "--target requires a value" };
|
|
70
|
+
}
|
|
71
|
+
parsed.target = value;
|
|
62
72
|
}
|
|
63
73
|
else if (arg.startsWith("-")) {
|
|
64
74
|
return { ...parsed, error: `unknown flag: ${arg}` };
|
|
65
75
|
}
|
|
66
76
|
}
|
|
77
|
+
if (parsed.help)
|
|
78
|
+
return parsed;
|
|
67
79
|
if (parsed.targetKind === null || parsed.target === null) {
|
|
68
80
|
return {
|
|
69
81
|
...parsed,
|
|
70
|
-
error:
|
|
82
|
+
error: USAGE,
|
|
71
83
|
};
|
|
72
84
|
}
|
|
73
85
|
return parsed;
|
|
74
86
|
}
|
|
75
87
|
export function main(argv = process.argv.slice(2)) {
|
|
76
88
|
const parsed = parseArgs(argv);
|
|
89
|
+
if (parsed.help) {
|
|
90
|
+
process.stdout.write(`${USAGE}\n`);
|
|
91
|
+
return 0;
|
|
92
|
+
}
|
|
77
93
|
if (parsed.error || parsed.targetKind === null || parsed.target === null) {
|
|
78
94
|
process.stderr.write(`${parsed.error ?? "usage error"}\n`);
|
|
79
95
|
return 2;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
3
|
+
import { runSpecPrdFreshCli } from "@deftai/directive-core/verify-source";
|
|
4
|
+
export function run(argv) {
|
|
5
|
+
const result = runSpecPrdFreshCli(argv);
|
|
6
|
+
if (result.stdout.length > 0)
|
|
7
|
+
process.stdout.write(result.stdout);
|
|
8
|
+
if (result.stderr.length > 0)
|
|
9
|
+
process.stderr.write(result.stderr);
|
|
10
|
+
return result.exitCode;
|
|
11
|
+
}
|
|
12
|
+
if (process.argv[1] !== undefined && fileURLToPath(import.meta.url) === process.argv[1]) {
|
|
13
|
+
process.exit(run(process.argv.slice(2)));
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=verify-spec-prd-fresh.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deftai/directive",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.112.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/",
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"provenance": true
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@deftai/directive-core": "^0.
|
|
38
|
-
"@deftai/directive-content": "^0.
|
|
37
|
+
"@deftai/directive-core": "^0.112.0",
|
|
38
|
+
"@deftai/directive-content": "^0.112.0"
|
|
39
39
|
},
|
|
40
40
|
"scripts": {
|
|
41
41
|
"build": "tsc -b"
|