@deftai/directive 0.111.0 → 0.113.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.js +1 -0
- package/dist/scope-record-approved-scope.d.ts +2 -0
- package/dist/scope-record-approved-scope.js +26 -8
- 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/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.js
CHANGED
|
@@ -2793,6 +2793,7 @@ export function printHelp(io = defaultIo()) {
|
|
|
2793
2793
|
" (pnpm: pnpm add -g @deftai/directive -- ensure PNPM_HOME is on PATH, run `pnpm setup` if needed)\n" +
|
|
2794
2794
|
" 2. directive init\n" +
|
|
2795
2795
|
" 3. directive doctor\n" +
|
|
2796
|
+
" 4. directive toolchain:check --consumer\n" +
|
|
2796
2797
|
"New clone where `directive` will not run? Read the Cold-start bootstrap block at the top of README.md.\n");
|
|
2797
2798
|
}
|
|
2798
2799
|
async function invokeHandler(handler, argv) {
|
|
@@ -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;
|
|
@@ -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;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deftai/directive",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.113.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.113.0",
|
|
38
|
+
"@deftai/directive-content": "^0.113.0"
|
|
39
39
|
},
|
|
40
40
|
"scripts": {
|
|
41
41
|
"build": "tsc -b"
|