@deftai/directive 0.109.1 → 0.111.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/dispatch.d.ts +1 -1
- package/dist/dispatch.js +38 -5
- package/dist/session-start.js +3 -0
- package/dist/triage-classify.d.ts +2 -2
- package/dist/triage-classify.js +4 -43
- package/dist/triage-strip-withdrawn.d.ts +21 -0
- package/dist/triage-strip-withdrawn.js +102 -0
- package/dist/verify-forward-coverage.js +4 -3
- 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
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-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";
|
|
@@ -85,6 +86,7 @@ export const CLI_MODULE_VERBS = [
|
|
|
85
86
|
"triage-bootstrap",
|
|
86
87
|
"triage-bulk",
|
|
87
88
|
"triage-classify",
|
|
89
|
+
"triage-strip-withdrawn",
|
|
88
90
|
"triage-evaluate",
|
|
89
91
|
"triage-help",
|
|
90
92
|
"triage-queue",
|
|
@@ -137,6 +139,7 @@ export const CLI_MODULE_VERBS = [
|
|
|
137
139
|
"verify-plan-sequence",
|
|
138
140
|
"verify-stubs",
|
|
139
141
|
"verify-xbrief-drift",
|
|
142
|
+
"verify-spec-prd-fresh",
|
|
140
143
|
"rule-ownership-lint",
|
|
141
144
|
"verify-story-ready",
|
|
142
145
|
"verify-review-monitor",
|
|
@@ -349,6 +352,7 @@ export const VERB_ALIASES = {
|
|
|
349
352
|
"verify:bridge-drift": "verify-bridge-drift",
|
|
350
353
|
"verify:scm-boundary": "verify-scm-boundary",
|
|
351
354
|
"verify:xbrief-drift": "verify-xbrief-drift",
|
|
355
|
+
"verify:spec-prd-fresh": "verify-spec-prd-fresh",
|
|
352
356
|
"verify:capacity": "verify-capacity",
|
|
353
357
|
"verify:session-ritual": "verify-session-ritual",
|
|
354
358
|
"verify:plan-sequence": "verify-plan-sequence",
|
|
@@ -431,6 +435,7 @@ const SUBDIR_CLI_STEMS = {
|
|
|
431
435
|
"verify-openclaw-tier1": "verify-source-cli/verify-openclaw-tier1",
|
|
432
436
|
"verify-scm-boundary": "verify-source-cli/verify-scm-boundary",
|
|
433
437
|
"verify-xbrief-drift": "verify-source-cli/verify-xbrief-drift",
|
|
438
|
+
"verify-spec-prd-fresh": "verify-source-cli/verify-spec-prd-fresh",
|
|
434
439
|
"verify-go-freeze": "gates-cli/verify-go-freeze",
|
|
435
440
|
"verify-bridge-drift": "gates-cli/verify-bridge-drift",
|
|
436
441
|
"validate-links": "content-validate-cli/validate-links",
|
|
@@ -555,12 +560,20 @@ function parseCodeStructureArgs(argv) {
|
|
|
555
560
|
const paths = [];
|
|
556
561
|
let json = false;
|
|
557
562
|
let strict = false;
|
|
563
|
+
let enforce = false;
|
|
558
564
|
for (let i = 0; i < argv.length; i += 1) {
|
|
559
565
|
const arg = argv[i];
|
|
560
566
|
if (arg === "--project-root") {
|
|
561
567
|
const v = argv[i + 1];
|
|
562
568
|
if (v === undefined)
|
|
563
|
-
return {
|
|
569
|
+
return {
|
|
570
|
+
projectRoot,
|
|
571
|
+
paths,
|
|
572
|
+
json,
|
|
573
|
+
strict,
|
|
574
|
+
enforce,
|
|
575
|
+
error: "missing --project-root value",
|
|
576
|
+
};
|
|
564
577
|
projectRoot = v;
|
|
565
578
|
i += 1;
|
|
566
579
|
}
|
|
@@ -570,7 +583,7 @@ function parseCodeStructureArgs(argv) {
|
|
|
570
583
|
else if (arg === "--path") {
|
|
571
584
|
const v = argv[i + 1];
|
|
572
585
|
if (v === undefined)
|
|
573
|
-
return { projectRoot, paths, json, strict, error: "missing --path value" };
|
|
586
|
+
return { projectRoot, paths, json, strict, enforce, error: "missing --path value" };
|
|
574
587
|
paths.push(v);
|
|
575
588
|
i += 1;
|
|
576
589
|
}
|
|
@@ -583,11 +596,24 @@ function parseCodeStructureArgs(argv) {
|
|
|
583
596
|
else if (arg === "--strict") {
|
|
584
597
|
strict = true;
|
|
585
598
|
}
|
|
599
|
+
else if (arg === "--enforce") {
|
|
600
|
+
enforce = true;
|
|
601
|
+
}
|
|
602
|
+
else if (arg !== undefined && !arg.startsWith("-")) {
|
|
603
|
+
paths.push(arg);
|
|
604
|
+
}
|
|
586
605
|
else {
|
|
587
|
-
return {
|
|
606
|
+
return {
|
|
607
|
+
projectRoot,
|
|
608
|
+
paths,
|
|
609
|
+
json,
|
|
610
|
+
strict,
|
|
611
|
+
enforce,
|
|
612
|
+
error: `unrecognized argument: ${arg}`,
|
|
613
|
+
};
|
|
588
614
|
}
|
|
589
615
|
}
|
|
590
|
-
return { projectRoot, paths, json, strict };
|
|
616
|
+
return { projectRoot, paths, json, strict, enforce };
|
|
591
617
|
}
|
|
592
618
|
// ===========================================================================
|
|
593
619
|
// Native pack-migrate handlers (#2022 Phase 1).
|
|
@@ -2473,6 +2499,7 @@ async function loadCoreModuleHandler(verb, io) {
|
|
|
2473
2499
|
paths: parsed.paths.length > 0 ? parsed.paths : undefined,
|
|
2474
2500
|
json: parsed.json,
|
|
2475
2501
|
strict: parsed.strict,
|
|
2502
|
+
enforce: parsed.enforce,
|
|
2476
2503
|
});
|
|
2477
2504
|
if (result.stdout)
|
|
2478
2505
|
io.writeOut(result.stdout);
|
|
@@ -2818,7 +2845,6 @@ export async function dispatch(argv, io = defaultIo()) {
|
|
|
2818
2845
|
return 1;
|
|
2819
2846
|
}
|
|
2820
2847
|
try {
|
|
2821
|
-
const handler = await loadHandler(canonical, io);
|
|
2822
2848
|
const triageSubcommand = verb !== undefined ? TRIAGE_ACTION_ALIAS_SUBCOMMANDS[verb] : undefined;
|
|
2823
2849
|
const policySubcommand = verb !== undefined ? POLICY_ACTION_ALIAS_SUBCOMMANDS[verb] : undefined;
|
|
2824
2850
|
const authzSubcommand = verb !== undefined ? AUTHZ_ACTION_ALIAS_SUBCOMMANDS[verb] : undefined;
|
|
@@ -2848,6 +2874,13 @@ export async function dispatch(argv, io = defaultIo()) {
|
|
|
2848
2874
|
: vbriefValidateSubcommand !== undefined
|
|
2849
2875
|
? [vbriefValidateSubcommand, ...rest]
|
|
2850
2876
|
: rest;
|
|
2877
|
+
const helpRc = interceptHelp(canonical.replaceAll("-", "_"), handlerArgv, {
|
|
2878
|
+
write: io.writeOut,
|
|
2879
|
+
});
|
|
2880
|
+
if (helpRc !== null) {
|
|
2881
|
+
return helpRc;
|
|
2882
|
+
}
|
|
2883
|
+
const handler = await loadHandler(canonical, io);
|
|
2851
2884
|
return await invokeHandler(handler, handlerArgv);
|
|
2852
2885
|
}
|
|
2853
2886
|
catch (err) {
|
package/dist/session-start.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
2
|
+
import type { ResolveAuthenticatedLogin } from "@deftai/directive-core/dist/triage/author-filter.js";
|
|
3
3
|
import type { LabelClient } from "@deftai/directive-core/dist/vbrief-reconcile/types.js";
|
|
4
4
|
export interface ParsedArgs {
|
|
5
5
|
projectRoot: string;
|
|
@@ -41,5 +41,5 @@ export interface RunOptions {
|
|
|
41
41
|
readonly resolveAuthenticatedLogin?: ResolveAuthenticatedLogin;
|
|
42
42
|
}
|
|
43
43
|
/** Run the CLI and return the process exit code. */
|
|
44
|
-
export declare function run(argv: string[],
|
|
44
|
+
export declare function run(argv: string[], _options?: RunOptions): number;
|
|
45
45
|
//# sourceMappingURL=triage-classify.d.ts.map
|
package/dist/triage-classify.js
CHANGED
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
import { statSync } from "node:fs";
|
|
3
3
|
import { resolve } from "node:path";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
|
-
import {
|
|
6
|
-
import { labelMirrorOutcomeToJson, listProject, mirrorDiscoveryStateExists, mirrorLabels, recordMirrorDiscoveryAcked, recordMirrorDiscoverySuccessfulDryRun, renderLabelMirrorReport, validateProject, } from "@deftai/directive-core/dist/triage/classify/index.js";
|
|
5
|
+
import { CLASSIFY_MIRROR_WITHDRAWN_EXIT_CODE, CLASSIFY_MIRROR_WITHDRAWN_MESSAGE, listProject, mirrorDiscoveryStateExists, recordMirrorDiscoveryAcked, validateProject, } from "@deftai/directive-core/dist/triage/classify/index.js";
|
|
7
6
|
function parseNonNegInt(raw, flag) {
|
|
8
7
|
const n = Number.parseInt(raw, 10);
|
|
9
8
|
if (!Number.isFinite(n) || String(n) !== raw.trim() || n < 0) {
|
|
@@ -223,7 +222,7 @@ export function parseArgs(argv) {
|
|
|
223
222
|
return parsed;
|
|
224
223
|
}
|
|
225
224
|
/** Run the CLI and return the process exit code. */
|
|
226
|
-
export function run(argv,
|
|
225
|
+
export function run(argv, _options = {}) {
|
|
227
226
|
const args = parseArgs(argv);
|
|
228
227
|
if (args.error !== undefined) {
|
|
229
228
|
process.stderr.write(`ERR: ${args.error}\n`);
|
|
@@ -275,46 +274,8 @@ export function run(argv, options = {}) {
|
|
|
275
274
|
}
|
|
276
275
|
}
|
|
277
276
|
if (args.doMirror) {
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
// never silent no-op that would plan/apply the full open cache (#3129 Greptile P1).
|
|
281
|
-
if (args.author !== null) {
|
|
282
|
-
const resolved = resolveAuthorFilter(args.author, options.resolveAuthenticatedLogin);
|
|
283
|
-
if (resolved.error !== undefined || resolved.filter === undefined) {
|
|
284
|
-
process.stderr.write(`ERR: ${resolved.error ?? "argument --author: expected a non-empty login (or @me)"}\n`);
|
|
285
|
-
return 2;
|
|
286
|
-
}
|
|
287
|
-
authorFilter = resolved.filter;
|
|
288
|
-
}
|
|
289
|
-
const mirrorOpts = {
|
|
290
|
-
dryRun: !args.apply,
|
|
291
|
-
repo: args.repo,
|
|
292
|
-
allowCrossRepo: args.allowCrossRepo,
|
|
293
|
-
includeClosed: args.includeClosed,
|
|
294
|
-
reEnrich: args.reEnrich,
|
|
295
|
-
...(authorFilter !== null && authorFilter !== undefined ? { authorFilter } : {}),
|
|
296
|
-
...(args.batchSize !== null ? { batchSize: args.batchSize } : {}),
|
|
297
|
-
...(args.delayMs !== null ? { delayMs: args.delayMs } : {}),
|
|
298
|
-
...(args.sampleLimit !== null ? { sampleLimit: args.sampleLimit } : {}),
|
|
299
|
-
...(options.labelClient !== undefined ? { client: options.labelClient } : {}),
|
|
300
|
-
};
|
|
301
|
-
const [code, outcome] = mirrorLabels(projectRoot, mirrorOpts);
|
|
302
|
-
if (args.json) {
|
|
303
|
-
process.stdout.write(`${JSON.stringify(labelMirrorOutcomeToJson(outcome), null, 2)}\n`);
|
|
304
|
-
}
|
|
305
|
-
else {
|
|
306
|
-
process.stdout.write(renderLabelMirrorReport(outcome));
|
|
307
|
-
}
|
|
308
|
-
// #3124: first successful --mirror dry-run hides the operator discovery tip.
|
|
309
|
-
if (code === 0 && outcome.dry_run) {
|
|
310
|
-
try {
|
|
311
|
-
recordMirrorDiscoverySuccessfulDryRun(projectRoot);
|
|
312
|
-
}
|
|
313
|
-
catch {
|
|
314
|
-
// Advisory tip state — never change the classify exit code.
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
return code;
|
|
277
|
+
process.stderr.write(`${CLASSIFY_MIRROR_WITHDRAWN_MESSAGE}\n`);
|
|
278
|
+
return CLASSIFY_MIRROR_WITHDRAWN_EXIT_CODE;
|
|
318
279
|
}
|
|
319
280
|
// Default / --list: print effective rules
|
|
320
281
|
process.stdout.write(listProject(projectRoot));
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { type ListWithdrawnChipIssues } from "@deftai/directive-core/dist/triage/classify/withdraw.js";
|
|
3
|
+
import type { LabelClient } from "@deftai/directive-core/dist/vbrief-reconcile/types.js";
|
|
4
|
+
export interface StripParsedArgs {
|
|
5
|
+
projectRoot: string;
|
|
6
|
+
apply: boolean;
|
|
7
|
+
json: boolean;
|
|
8
|
+
emitDigest: boolean;
|
|
9
|
+
repo: string | null;
|
|
10
|
+
error?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function parseStripArgs(argv: string[]): StripParsedArgs;
|
|
13
|
+
export interface StripRunOptions {
|
|
14
|
+
readonly labelClient?: LabelClient;
|
|
15
|
+
readonly resolveDefaultRepo?: () => string | null;
|
|
16
|
+
readonly listIssues?: ListWithdrawnChipIssues;
|
|
17
|
+
}
|
|
18
|
+
export declare function runStripWithdrawn(argv: string[], options?: StripRunOptions): number;
|
|
19
|
+
/** Dispatch handler name (`CLI_MODULE_VERBS` looks for `run`). */
|
|
20
|
+
export declare const run: typeof runStripWithdrawn;
|
|
21
|
+
//# sourceMappingURL=triage-strip-withdrawn.d.ts.map
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
3
|
+
import { resolveRepoFromGitOrigin } from "@deftai/directive-core/dist/scm/design-critique-chip.js";
|
|
4
|
+
import { classifyIssue, resolveClassifyRules, resolveHoldMarkers, } from "@deftai/directive-core/dist/triage/classify/index.js";
|
|
5
|
+
import { CLASSIFY_MIRROR_WITHDRAWN_MESSAGE, stripWithdrawnChips, } from "@deftai/directive-core/dist/triage/classify/withdraw.js";
|
|
6
|
+
export function parseStripArgs(argv) {
|
|
7
|
+
const parsed = {
|
|
8
|
+
projectRoot: ".",
|
|
9
|
+
apply: false,
|
|
10
|
+
json: false,
|
|
11
|
+
emitDigest: false,
|
|
12
|
+
repo: null,
|
|
13
|
+
};
|
|
14
|
+
for (let i = 0; i < argv.length; i += 1) {
|
|
15
|
+
const arg = argv[i];
|
|
16
|
+
if (arg === "--apply") {
|
|
17
|
+
parsed.apply = true;
|
|
18
|
+
}
|
|
19
|
+
else if (arg === "--json") {
|
|
20
|
+
parsed.json = true;
|
|
21
|
+
}
|
|
22
|
+
else if (arg === "--emit-digest") {
|
|
23
|
+
parsed.emitDigest = true;
|
|
24
|
+
}
|
|
25
|
+
else if (arg === "--repo") {
|
|
26
|
+
const value = argv[i + 1];
|
|
27
|
+
if (value === undefined) {
|
|
28
|
+
return { ...parsed, error: "argument --repo: expected one argument" };
|
|
29
|
+
}
|
|
30
|
+
parsed.repo = value;
|
|
31
|
+
i += 1;
|
|
32
|
+
}
|
|
33
|
+
else if (arg?.startsWith("--repo=")) {
|
|
34
|
+
parsed.repo = arg.slice("--repo=".length);
|
|
35
|
+
}
|
|
36
|
+
else if (arg === "--project-root") {
|
|
37
|
+
const value = argv[i + 1];
|
|
38
|
+
if (value === undefined) {
|
|
39
|
+
return { ...parsed, error: "argument --project-root: expected one argument" };
|
|
40
|
+
}
|
|
41
|
+
parsed.projectRoot = value;
|
|
42
|
+
i += 1;
|
|
43
|
+
}
|
|
44
|
+
else if (arg?.startsWith("--project-root=")) {
|
|
45
|
+
parsed.projectRoot = arg.slice("--project-root=".length);
|
|
46
|
+
}
|
|
47
|
+
else if (arg === "--help" || arg === "-h") {
|
|
48
|
+
return parsed;
|
|
49
|
+
}
|
|
50
|
+
else if (arg === "--") {
|
|
51
|
+
}
|
|
52
|
+
else if (arg?.startsWith("-")) {
|
|
53
|
+
return { ...parsed, error: `unrecognized arguments: ${arg}` };
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return parsed;
|
|
57
|
+
}
|
|
58
|
+
export function runStripWithdrawn(argv, options = {}) {
|
|
59
|
+
const args = parseStripArgs(argv);
|
|
60
|
+
if (args.error !== undefined) {
|
|
61
|
+
process.stderr.write(`ERR: ${args.error}\n`);
|
|
62
|
+
return 2;
|
|
63
|
+
}
|
|
64
|
+
const repo = args.repo ?? (options.resolveDefaultRepo ?? resolveRepoFromGitOrigin)();
|
|
65
|
+
if (repo === null || repo.length === 0) {
|
|
66
|
+
process.stderr.write("ERR: missing --repo OWNER/NAME (could not resolve from git origin)\n");
|
|
67
|
+
return 2;
|
|
68
|
+
}
|
|
69
|
+
const rules = resolveClassifyRules({ projectRoot: args.projectRoot });
|
|
70
|
+
const holdMarkers = resolveHoldMarkers({ projectRoot: args.projectRoot });
|
|
71
|
+
const [code, outcome] = stripWithdrawnChips({
|
|
72
|
+
repo,
|
|
73
|
+
dryRun: !args.apply,
|
|
74
|
+
emitDigest: args.emitDigest,
|
|
75
|
+
classify: args.emitDigest
|
|
76
|
+
? (issue, opts) => classifyIssue(issue, {
|
|
77
|
+
rules: opts?.rules ?? rules,
|
|
78
|
+
holdMarkers: opts?.holdMarkers ?? holdMarkers,
|
|
79
|
+
})
|
|
80
|
+
: undefined,
|
|
81
|
+
rules,
|
|
82
|
+
holdMarkers,
|
|
83
|
+
...(options.labelClient !== undefined ? { client: options.labelClient } : {}),
|
|
84
|
+
...(options.listIssues !== undefined ? { listIssues: options.listIssues } : {}),
|
|
85
|
+
});
|
|
86
|
+
if (args.json) {
|
|
87
|
+
process.stdout.write(`${JSON.stringify(outcome, null, 2)}\n`);
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
process.stdout.write(`strip-withdrawn-chips repo=${outcome.repo} dry-run=${outcome.dry_run} ` +
|
|
91
|
+
`scanned=${outcome.scanned} planned=${outcome.planned} applied=${outcome.applied} ` +
|
|
92
|
+
`unchanged=${outcome.unchanged} errors=${outcome.errors}\n`);
|
|
93
|
+
process.stdout.write(`${CLASSIFY_MIRROR_WITHDRAWN_MESSAGE}\n`);
|
|
94
|
+
}
|
|
95
|
+
return code;
|
|
96
|
+
}
|
|
97
|
+
/** Dispatch handler name (`CLI_MODULE_VERBS` looks for `run`). */
|
|
98
|
+
export const run = runStripWithdrawn;
|
|
99
|
+
if (process.argv[1] !== undefined && fileURLToPath(import.meta.url) === process.argv[1]) {
|
|
100
|
+
process.exit(runStripWithdrawn(process.argv.slice(2)));
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=triage-strip-withdrawn.js.map
|
|
@@ -5,9 +5,10 @@ import { evaluateForwardCoverage } from "@deftai/directive-core";
|
|
|
5
5
|
const HELP_TEXT = "Usage: verify-forward-coverage [--project-root <path>] [--staged|--head] [--allow-list <path>]\n" +
|
|
6
6
|
" [--coverage-dir <path>] [--coverage-report <path>]\n" +
|
|
7
7
|
" [--enforce] [--quiet]\n" +
|
|
8
|
-
" Fail-closed new-source-file existence (#1310) plus warn-first diff coverage of\n" +
|
|
9
|
-
" added/modified branches (#3514).
|
|
10
|
-
"
|
|
8
|
+
" Fail-closed new-source-file existence (#1310 / #4009) plus warn-first diff coverage of\n" +
|
|
9
|
+
" added/modified branches (#3514). Existence correspondence is path-relative and\n" +
|
|
10
|
+
" uses the test-boundary policy (#3145); pre-existing tests count. The 90% per-diff\n" +
|
|
11
|
+
" threshold is not the 75 global floor. Missing coverage reports skip the diff half.\n" +
|
|
11
12
|
" --enforce: fail closed when uncovered changed branches are below 90%.\n";
|
|
12
13
|
function takeValue(argv, i, flag) {
|
|
13
14
|
const value = argv[i + 1];
|
|
@@ -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.111.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.111.0",
|
|
38
|
+
"@deftai/directive-content": "^0.111.0"
|
|
39
39
|
},
|
|
40
40
|
"scripts": {
|
|
41
41
|
"build": "tsc -b"
|