@deftai/directive 0.119.12 → 0.120.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/authz.js +41 -7
- package/dist/changelog-check.js +14 -6
- package/dist/check.js +5 -0
- package/dist/dispatch.d.ts +2 -2
- package/dist/dispatch.js +21 -0
- package/dist/init-cli/update.js +7 -0
- package/dist/ownership-doctor.d.ts +10 -0
- package/dist/ownership-doctor.js +96 -0
- package/dist/ownership-fix.d.ts +10 -0
- package/dist/ownership-fix.js +93 -0
- package/dist/pre-pr-run.d.ts +39 -0
- package/dist/pre-pr-run.js +514 -0
- package/dist/vbrief-preflight.js +6 -0
- package/dist/verify-completed-tracked.d.ts +4 -1
- package/dist/verify-completed-tracked.js +60 -9
- package/dist/verify-consumer-header-placeholder.d.ts +12 -0
- package/dist/verify-consumer-header-placeholder.js +73 -0
- package/dist/verify-ownership.d.ts +10 -0
- package/dist/verify-ownership.js +90 -0
- package/dist/verify-persisted-planning-narratives.d.ts +12 -0
- package/dist/verify-persisted-planning-narratives.js +82 -0
- package/dist/verify-review-monitor.js +40 -11
- package/dist/wsl-ownership-guard.d.ts +2 -0
- package/dist/wsl-ownership-guard.js +15 -0
- package/package.json +3 -3
package/dist/authz.js
CHANGED
|
@@ -27,6 +27,7 @@ import { existsSync } from "node:fs";
|
|
|
27
27
|
import { isAbsolute, resolve } from "node:path";
|
|
28
28
|
import { onePrUnit } from "@deftai/directive-core";
|
|
29
29
|
import { AFK_TEMPLATE_NAMES, AUTHZ_OPERATIONS, CLOSED_VERB_TEMPLATE_NAMES, FINISH_LOOP_TEMPLATE_NAME, formatDecomposeStructuralMintCommand, isAfkTemplateName, isClosedVerbTemplateName, isFinishLoopTemplateName, mintAfkTemplateGrant, mintDecomposeStructuralApplyGrant, mintHumanOriginGrant, revokeGrant, showAuthzSnapshot, startUatLease, suspendUatLease, toProjectRelativePosix, } from "@deftai/directive-core/authz";
|
|
30
|
+
import { uatCampaignEndSeal } from "@deftai/directive-core/authz/campaign-end-seal";
|
|
30
31
|
import { refuseMintWhileUatActive, refuseNonInteractiveMint, resolveHumanPresenceMintSeams, } from "./human-presence-mint.js";
|
|
31
32
|
export { AUTHZ_AGENT_SHELL_ENV_MARKERS, AUTHZ_INTERACTIVE_CONFIRM_PHRASE, } from "./human-presence-mint.js";
|
|
32
33
|
function parseOps(raw) {
|
|
@@ -328,13 +329,18 @@ export function main(argv = process.argv.slice(2), seams = {}) {
|
|
|
328
329
|
const blocked = gateConfirm();
|
|
329
330
|
if (blocked !== null)
|
|
330
331
|
return blocked;
|
|
331
|
-
|
|
332
|
+
// Result narrowing; pinActive mint wiring stays parked (class 4).
|
|
333
|
+
const started = startUatLease({
|
|
332
334
|
projectRoot: args.projectRoot,
|
|
333
335
|
campaignId: args.campaign,
|
|
334
336
|
actor: args.actor,
|
|
335
337
|
note: args.note,
|
|
336
338
|
});
|
|
337
|
-
|
|
339
|
+
if (!started.ok) {
|
|
340
|
+
process.stderr.write(`authz:uat-start: ${started.reason}\n`);
|
|
341
|
+
return 2;
|
|
342
|
+
}
|
|
343
|
+
process.stdout.write(`✓ UAT lease ACTIVE campaign=${started.lease.campaignId} (human-origin operator-cli)\n`);
|
|
338
344
|
process.stdout.write(" Product edit/push/PR/merge denied until a named fix cohort grant is minted.\n");
|
|
339
345
|
process.stdout.write(" Tests, evidence capture, and issue filing remain allowed.\n");
|
|
340
346
|
return 0;
|
|
@@ -343,10 +349,18 @@ export function main(argv = process.argv.slice(2), seams = {}) {
|
|
|
343
349
|
const blocked = gateConfirm();
|
|
344
350
|
if (blocked !== null)
|
|
345
351
|
return blocked;
|
|
346
|
-
|
|
352
|
+
// Sealed campaign-end only after CLI human-presence gateConfirm (#4233).
|
|
353
|
+
// pinActive mint wiring stays parked (class 4 follow-up).
|
|
354
|
+
const suspended = suspendUatLease({
|
|
347
355
|
projectRoot: args.projectRoot,
|
|
348
356
|
actor: args.actor,
|
|
357
|
+
campaignEndSeal: uatCampaignEndSeal(),
|
|
349
358
|
});
|
|
359
|
+
if (!suspended.ok) {
|
|
360
|
+
process.stderr.write(`authz:uat-suspend: ${suspended.reason}\n`);
|
|
361
|
+
return 2;
|
|
362
|
+
}
|
|
363
|
+
const state = suspended.state;
|
|
350
364
|
if (state.uat === null) {
|
|
351
365
|
process.stdout.write("UAT lease was already inactive.\n");
|
|
352
366
|
}
|
|
@@ -400,7 +414,7 @@ export function main(argv = process.argv.slice(2), seams = {}) {
|
|
|
400
414
|
const blocked = gateConfirm();
|
|
401
415
|
if (blocked !== null)
|
|
402
416
|
return blocked;
|
|
403
|
-
const
|
|
417
|
+
const minted = mintDecomposeStructuralApplyGrant({
|
|
404
418
|
projectRoot: root,
|
|
405
419
|
parentPath: parentAbs,
|
|
406
420
|
draftPath: draftAbs,
|
|
@@ -409,6 +423,11 @@ export function main(argv = process.argv.slice(2), seams = {}) {
|
|
|
409
423
|
expiresAt: args.expiresAt,
|
|
410
424
|
singleUse: args.singleUse,
|
|
411
425
|
});
|
|
426
|
+
if (!minted.ok) {
|
|
427
|
+
process.stderr.write(`authz:grant: ${minted.reason}\n`);
|
|
428
|
+
return 2;
|
|
429
|
+
}
|
|
430
|
+
const grant = minted.grant;
|
|
412
431
|
// mintDecomposeStructuralApplyGrant always sets contentDigest + worktree.
|
|
413
432
|
const digest = grant.scope.contentDigest || "";
|
|
414
433
|
process.stdout.write(`✓ human-origin structural grant minted id=${grant.id} origin=${grant.origin.kind}\n`);
|
|
@@ -474,7 +493,7 @@ export function main(argv = process.argv.slice(2), seams = {}) {
|
|
|
474
493
|
const blocked = gateConfirm();
|
|
475
494
|
if (blocked !== null)
|
|
476
495
|
return blocked;
|
|
477
|
-
const
|
|
496
|
+
const minted = mintAfkTemplateGrant({
|
|
478
497
|
projectRoot: args.projectRoot,
|
|
479
498
|
template: args.template,
|
|
480
499
|
target: args.target,
|
|
@@ -489,6 +508,11 @@ export function main(argv = process.argv.slice(2), seams = {}) {
|
|
|
489
508
|
issueIds: args.issueIds,
|
|
490
509
|
cohortId: args.cohort,
|
|
491
510
|
});
|
|
511
|
+
if (!minted.ok) {
|
|
512
|
+
process.stderr.write(`authz:grant: ${minted.reason}\n`);
|
|
513
|
+
return 2;
|
|
514
|
+
}
|
|
515
|
+
const grant = minted.grant;
|
|
492
516
|
process.stdout.write(`✓ human-origin grant minted id=${grant.id} origin=${grant.origin.kind} ` +
|
|
493
517
|
`template=${args.template}\n`);
|
|
494
518
|
if (isFinishLoopTemplateName(args.template)) {
|
|
@@ -511,7 +535,7 @@ export function main(argv = process.argv.slice(2), seams = {}) {
|
|
|
511
535
|
if (blocked !== null)
|
|
512
536
|
return blocked;
|
|
513
537
|
}
|
|
514
|
-
const
|
|
538
|
+
const minted = mintHumanOriginGrant({
|
|
515
539
|
projectRoot: args.projectRoot,
|
|
516
540
|
actor: args.actor,
|
|
517
541
|
operations: args.operations,
|
|
@@ -525,6 +549,11 @@ export function main(argv = process.argv.slice(2), seams = {}) {
|
|
|
525
549
|
expiresAt: args.expiresAt,
|
|
526
550
|
singleUse: args.singleUse,
|
|
527
551
|
});
|
|
552
|
+
if (!minted.ok) {
|
|
553
|
+
process.stderr.write(`authz:grant: ${minted.reason}\n`);
|
|
554
|
+
return 2;
|
|
555
|
+
}
|
|
556
|
+
const grant = minted.grant;
|
|
528
557
|
process.stdout.write(`✓ human-origin grant minted id=${grant.id} origin=${grant.origin.kind}\n`);
|
|
529
558
|
process.stdout.write(` ops=[${grant.scope.operations.join(",")}] cohort=${grant.scope.cohortId ?? "-"}\n`);
|
|
530
559
|
if (grant.scope.surfaces.length > 0) {
|
|
@@ -542,10 +571,15 @@ export function main(argv = process.argv.slice(2), seams = {}) {
|
|
|
542
571
|
if (blocked !== null)
|
|
543
572
|
return blocked;
|
|
544
573
|
}
|
|
545
|
-
const
|
|
574
|
+
const revokedResult = revokeGrant({
|
|
546
575
|
projectRoot: args.projectRoot,
|
|
547
576
|
grantId: args.grantId,
|
|
548
577
|
});
|
|
578
|
+
if (!revokedResult.ok) {
|
|
579
|
+
process.stderr.write(`authz:revoke: ${revokedResult.reason}\n`);
|
|
580
|
+
return 2;
|
|
581
|
+
}
|
|
582
|
+
const revoked = revokedResult.grant;
|
|
549
583
|
if (revoked === null) {
|
|
550
584
|
process.stderr.write(`authz: grant not found: ${args.grantId}\n`);
|
|
551
585
|
return 1;
|
package/dist/changelog-check.js
CHANGED
|
@@ -2,14 +2,19 @@
|
|
|
2
2
|
import { resolve } from "node:path";
|
|
3
3
|
import { fileURLToPath } from "node:url";
|
|
4
4
|
import { runChangelogCheck } from "@deftai/directive-core/task-surface";
|
|
5
|
-
function
|
|
5
|
+
function parseChangelogCheckArgs(argv) {
|
|
6
6
|
let projectRoot = ".";
|
|
7
|
+
let againstMergeBase = false;
|
|
7
8
|
for (let i = 0; i < argv.length; i += 1) {
|
|
8
9
|
const arg = argv[i] ?? "";
|
|
9
10
|
if (arg === "--project-root") {
|
|
10
11
|
const value = argv[i + 1];
|
|
11
12
|
if (value === undefined) {
|
|
12
|
-
return {
|
|
13
|
+
return {
|
|
14
|
+
projectRoot,
|
|
15
|
+
againstMergeBase,
|
|
16
|
+
error: "argument --project-root: expected one argument",
|
|
17
|
+
};
|
|
13
18
|
}
|
|
14
19
|
projectRoot = value;
|
|
15
20
|
i += 1;
|
|
@@ -17,14 +22,17 @@ function parseProjectRoot(argv) {
|
|
|
17
22
|
else if (arg.startsWith("--project-root=")) {
|
|
18
23
|
projectRoot = arg.slice("--project-root=".length);
|
|
19
24
|
}
|
|
25
|
+
else if (arg === "--against-merge-base") {
|
|
26
|
+
againstMergeBase = true;
|
|
27
|
+
}
|
|
20
28
|
else {
|
|
21
|
-
return { projectRoot, error: `unrecognized argument: ${arg}` };
|
|
29
|
+
return { projectRoot, againstMergeBase, error: `unrecognized argument: ${arg}` };
|
|
22
30
|
}
|
|
23
31
|
}
|
|
24
|
-
return { projectRoot };
|
|
32
|
+
return { projectRoot, againstMergeBase };
|
|
25
33
|
}
|
|
26
34
|
export function run(argv) {
|
|
27
|
-
const args =
|
|
35
|
+
const args = parseChangelogCheckArgs(argv);
|
|
28
36
|
if (args.error !== undefined) {
|
|
29
37
|
process.stderr.write(`changelog-check: ${args.error}\n`);
|
|
30
38
|
return 2;
|
|
@@ -36,7 +44,7 @@ export function run(argv) {
|
|
|
36
44
|
writeErr: (text) => {
|
|
37
45
|
process.stderr.write(text);
|
|
38
46
|
},
|
|
39
|
-
});
|
|
47
|
+
}, { againstMergeBase: args.againstMergeBase });
|
|
40
48
|
}
|
|
41
49
|
if (process.argv[1] !== undefined && fileURLToPath(import.meta.url) === process.argv[1]) {
|
|
42
50
|
process.exit(run(process.argv.slice(2)));
|
package/dist/check.js
CHANGED
|
@@ -13,6 +13,7 @@ import { join, resolve } from "node:path";
|
|
|
13
13
|
import { fileURLToPath } from "node:url";
|
|
14
14
|
import { dispatchTaskCheck } from "@deftai/directive-core/check";
|
|
15
15
|
import { DEFT_REPO_POSITIVE_MARKERS } from "@deftai/directive-core/doctor";
|
|
16
|
+
import { refuseIfWslOwnershipBlocked } from "./wsl-ownership-guard.js";
|
|
16
17
|
function isFrameworkSourceCheckoutAt(projectRoot) {
|
|
17
18
|
try {
|
|
18
19
|
if (!statSync(join(projectRoot, "main.md")).isFile()) {
|
|
@@ -135,6 +136,10 @@ export function run(argv) {
|
|
|
135
136
|
process.stderr.write(FRAMEWORK_ROOT_MISS);
|
|
136
137
|
return 2;
|
|
137
138
|
}
|
|
139
|
+
// #1617: live WSL ownership gate before first protected check write/orchestration.
|
|
140
|
+
const blocked = refuseIfWslOwnershipBlocked(args.projectRoot);
|
|
141
|
+
if (blocked !== null)
|
|
142
|
+
return blocked;
|
|
138
143
|
return dispatchTaskCheck(args.frameworkRoot, args.projectRoot, { noCache: args.noCache });
|
|
139
144
|
}
|
|
140
145
|
/* v8 ignore start -- entry guard */
|
package/dist/dispatch.d.ts
CHANGED
|
@@ -10,9 +10,9 @@ 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", "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", "rule-ownership-lint", "verify-story-ready", "verify-review-monitor", "verify-l4-owner", "verify-subagent-alive", "verify-subagent-steer", "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", "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"];
|
|
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", "rule-ownership-lint", "verify-story-ready", "verify-review-monitor", "verify-l4-owner", "verify-subagent-alive", "verify-subagent-steer", "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-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"];
|
|
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-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"];
|
|
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). */
|
package/dist/dispatch.js
CHANGED
|
@@ -38,6 +38,9 @@ export const CLI_MODULE_VERBS = [
|
|
|
38
38
|
"codebase-projection-registry",
|
|
39
39
|
"codebase-provider",
|
|
40
40
|
"doctor",
|
|
41
|
+
"ownership-doctor",
|
|
42
|
+
"ownership-fix",
|
|
43
|
+
"verify-ownership",
|
|
41
44
|
"install-upgrade",
|
|
42
45
|
"install-uninstall",
|
|
43
46
|
"migrate-preflight",
|
|
@@ -61,6 +64,7 @@ export const CLI_MODULE_VERBS = [
|
|
|
61
64
|
"pr-watch",
|
|
62
65
|
"pr-finish-loop",
|
|
63
66
|
"directive-finish-loop",
|
|
67
|
+
"pre-pr-run",
|
|
64
68
|
"preflight-cache",
|
|
65
69
|
"preflight-gh",
|
|
66
70
|
"probe-session",
|
|
@@ -165,7 +169,9 @@ export const CLI_MODULE_VERBS = [
|
|
|
165
169
|
"verify-literal-ac",
|
|
166
170
|
"verify-ac",
|
|
167
171
|
"verify-agents-md-budget",
|
|
172
|
+
"verify-consumer-header-placeholder",
|
|
168
173
|
"verify-agents-md-advisory",
|
|
174
|
+
"verify-persisted-planning-narratives",
|
|
169
175
|
"verify-eval-health-relocation",
|
|
170
176
|
"verify-eval-triggers-relocation",
|
|
171
177
|
"verify-evaluator-surface",
|
|
@@ -231,6 +237,7 @@ export const CORE_MODULE_VERBS = [
|
|
|
231
237
|
"decision-write",
|
|
232
238
|
"decision-list",
|
|
233
239
|
"docs-impact",
|
|
240
|
+
"migrate-clause-ids",
|
|
234
241
|
];
|
|
235
242
|
/** Colon aliases for triage-actions (mirrors cli-router SUBCOMMAND_ROUTES). */
|
|
236
243
|
export const TRIAGE_ACTION_ALIAS_SUBCOMMANDS = {
|
|
@@ -304,6 +311,7 @@ export const FRESHNESS_ALIAS_SUBCOMMANDS = {
|
|
|
304
311
|
const FRESHNESS_COLON_ALIASES = Object.fromEntries(Object.keys(FRESHNESS_ALIAS_SUBCOMMANDS).map((alias) => [alias, "freshness-report"]));
|
|
305
312
|
/** Task-style aliases (framework_commands / Taskfile names). */
|
|
306
313
|
export const VERB_ALIASES = {
|
|
314
|
+
"pre-pr:run": "pre-pr-run",
|
|
307
315
|
"hook:dispatch": "hook-dispatch",
|
|
308
316
|
"verify:encoding": "verify-encoding",
|
|
309
317
|
"verify:forward-coverage": "verify-forward-coverage",
|
|
@@ -330,7 +338,9 @@ export const VERB_ALIASES = {
|
|
|
330
338
|
"verify:ac": "verify-ac",
|
|
331
339
|
"verify:acceptance": "verify-ac",
|
|
332
340
|
"verify:agents-md-budget": "verify-agents-md-budget",
|
|
341
|
+
"verify:consumer-header-placeholder": "verify-consumer-header-placeholder",
|
|
333
342
|
"verify:agents-md-advisory": "verify-agents-md-advisory",
|
|
343
|
+
"verify:persisted-planning-narratives": "verify-persisted-planning-narratives",
|
|
334
344
|
"verify:eval-health-relocation": "verify-eval-health-relocation",
|
|
335
345
|
"verify:eval-triggers-relocation": "verify-eval-triggers-relocation",
|
|
336
346
|
"verify:evaluator-surface": "verify-evaluator-surface",
|
|
@@ -410,6 +420,7 @@ export const VERB_ALIASES = {
|
|
|
410
420
|
"migrate:preflight": "migrate-preflight",
|
|
411
421
|
"migrate:xbrief": "migrate-xbrief",
|
|
412
422
|
"migrate:category-b": "migrate-category-b",
|
|
423
|
+
"migrate:clause-ids": "migrate-clause-ids",
|
|
413
424
|
"framework:check-updates": "framework-check-updates",
|
|
414
425
|
"umbrella:current-shape": "umbrella-current-shape",
|
|
415
426
|
"issue:sync-from-xbrief": "issue-sync-from-xbrief",
|
|
@@ -437,6 +448,12 @@ export const VERB_ALIASES = {
|
|
|
437
448
|
"pr:finish-loop": "pr-finish-loop",
|
|
438
449
|
"directive:finish-loop": "directive-finish-loop",
|
|
439
450
|
doctor: "doctor",
|
|
451
|
+
"ownership:doctor": "ownership-doctor",
|
|
452
|
+
"ownership:fix": "ownership-fix",
|
|
453
|
+
"verify:ownership": "verify-ownership",
|
|
454
|
+
"deft:ownership:doctor": "ownership-doctor",
|
|
455
|
+
"deft:ownership:fix": "ownership-fix",
|
|
456
|
+
"deft:verify:ownership": "verify-ownership",
|
|
440
457
|
"eval:health": "eval-health",
|
|
441
458
|
"feedback:file": "feedback-file",
|
|
442
459
|
"value:show": "value-readback",
|
|
@@ -2619,6 +2636,10 @@ async function loadCoreModuleHandler(verb, io) {
|
|
|
2619
2636
|
const { docsImpactMain } = await import("@deftai/directive-core/dist/docs/docs-impact.js");
|
|
2620
2637
|
return (argv) => docsImpactMain(argv);
|
|
2621
2638
|
}
|
|
2639
|
+
case "migrate-clause-ids": {
|
|
2640
|
+
const { mainEntry } = await import("@deftai/directive-core/dist/xbrief-migrate/clause-ids.js");
|
|
2641
|
+
return (argv) => mainEntry(argv);
|
|
2642
|
+
}
|
|
2622
2643
|
default:
|
|
2623
2644
|
throw new Error(`unknown core verb: ${verb}`);
|
|
2624
2645
|
}
|
package/dist/init-cli/update.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { parseUpdateArgv, runRefreshDepositCli, UnknownUpdateFlagError, } from "@deftai/directive-core/init-deposit";
|
|
2
|
+
import { refuseIfWslOwnershipBlocked } from "../wsl-ownership-guard.js";
|
|
2
3
|
import { CANONICAL_UPDATE_ARGV, UPDATE_DRY_RUN_FLAGS } from "./constants.js";
|
|
3
4
|
import { argvWantsHelp, printUpdateHelp } from "./help.js";
|
|
4
5
|
/** True when the user argv asked for a classify-only dry-run (`--dry-run`/`--plan`). */
|
|
@@ -13,6 +14,12 @@ export function runUpdate(argv, io) {
|
|
|
13
14
|
}
|
|
14
15
|
try {
|
|
15
16
|
const args = parseUpdateArgv(CANONICAL_UPDATE_ARGV, argv);
|
|
17
|
+
// #1617: live ownership gate before deposit mutation (dry-run exempt).
|
|
18
|
+
if (!isUpdateDryRun(argv)) {
|
|
19
|
+
const blocked = refuseIfWslOwnershipBlocked(args.projectDir, io.writeErr);
|
|
20
|
+
if (blocked !== null)
|
|
21
|
+
return Promise.resolve(blocked);
|
|
22
|
+
}
|
|
16
23
|
return runRefreshDepositCli({
|
|
17
24
|
...args,
|
|
18
25
|
dryRun: isUpdateDryRun(argv),
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
export interface OwnershipDoctorArgs {
|
|
3
|
+
projectRoot: string;
|
|
4
|
+
json: boolean;
|
|
5
|
+
owner: string | null;
|
|
6
|
+
error?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function parseArgs(argv: readonly string[]): OwnershipDoctorArgs;
|
|
9
|
+
export declare function run(argv: readonly string[]): number;
|
|
10
|
+
//# sourceMappingURL=ownership-doctor.d.ts.map
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* ownership:doctor / ownership-doctor (#1617)
|
|
4
|
+
* Diagnose WSL root-runtime vs filesystem project-owner mismatch.
|
|
5
|
+
* Reachable under mismatch (not blocked by the protected-mutation guard).
|
|
6
|
+
*/
|
|
7
|
+
import { resolve } from "node:path";
|
|
8
|
+
import { evaluateWslOwnershipGuard, OWNERSHIP_FACTS_CLASSIFIER, ownershipGuardToDict, } from "@deftai/directive-core/platform";
|
|
9
|
+
import { isDirectEntrypoint } from "./entrypoint.js";
|
|
10
|
+
export function parseArgs(argv) {
|
|
11
|
+
const parsed = {
|
|
12
|
+
projectRoot: ".",
|
|
13
|
+
json: false,
|
|
14
|
+
owner: null,
|
|
15
|
+
};
|
|
16
|
+
for (let i = 0; i < argv.length; i += 1) {
|
|
17
|
+
const arg = argv[i];
|
|
18
|
+
if (arg === "--") {
|
|
19
|
+
}
|
|
20
|
+
else if (arg === "--json") {
|
|
21
|
+
parsed.json = true;
|
|
22
|
+
}
|
|
23
|
+
else if (arg === "--project-root") {
|
|
24
|
+
const value = argv[i + 1];
|
|
25
|
+
if (value === undefined) {
|
|
26
|
+
return { ...parsed, error: "argument --project-root: expected one argument" };
|
|
27
|
+
}
|
|
28
|
+
parsed.projectRoot = value;
|
|
29
|
+
i += 1;
|
|
30
|
+
}
|
|
31
|
+
else if (arg?.startsWith("--project-root=")) {
|
|
32
|
+
parsed.projectRoot = arg.slice("--project-root=".length);
|
|
33
|
+
}
|
|
34
|
+
else if (arg === "--owner") {
|
|
35
|
+
const value = argv[i + 1];
|
|
36
|
+
if (value === undefined) {
|
|
37
|
+
return { ...parsed, error: "argument --owner: expected uid:gid" };
|
|
38
|
+
}
|
|
39
|
+
parsed.owner = value;
|
|
40
|
+
i += 1;
|
|
41
|
+
}
|
|
42
|
+
else if (arg?.startsWith("--owner=")) {
|
|
43
|
+
parsed.owner = arg.slice("--owner=".length);
|
|
44
|
+
}
|
|
45
|
+
else if (arg === "--help" || arg === "-h") {
|
|
46
|
+
return { ...parsed, error: "__help__" };
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
return { ...parsed, error: `unrecognized argument: ${arg}` };
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return parsed;
|
|
53
|
+
}
|
|
54
|
+
const HELP = "usage: deft ownership:doctor [--project-root PATH] [--owner uid:gid] [--json]\n" +
|
|
55
|
+
"Diagnose WSL agent-as-root vs filesystem project-owner mismatch (#1617).\n" +
|
|
56
|
+
`Classifier: ${OWNERSHIP_FACTS_CLASSIFIER}\n` +
|
|
57
|
+
"Vocabulary: filesystem project-owner (this command) ≠ occupancy/session owner ≠ issue-emit recovery owner.\n" +
|
|
58
|
+
"Recovery: deft ownership:fix -- --project-root . [--owner uid:gid]\n";
|
|
59
|
+
export function run(argv) {
|
|
60
|
+
const args = parseArgs(argv);
|
|
61
|
+
if (args.error === "__help__") {
|
|
62
|
+
process.stdout.write(HELP);
|
|
63
|
+
return 0;
|
|
64
|
+
}
|
|
65
|
+
if (args.error !== undefined) {
|
|
66
|
+
process.stderr.write(`ownership:doctor: ${args.error}\n`);
|
|
67
|
+
return 2;
|
|
68
|
+
}
|
|
69
|
+
const projectRoot = resolve(args.projectRoot);
|
|
70
|
+
const verdict = evaluateWslOwnershipGuard({
|
|
71
|
+
projectRoot,
|
|
72
|
+
explicitOwner: args.owner,
|
|
73
|
+
});
|
|
74
|
+
if (args.json) {
|
|
75
|
+
process.stdout.write(`${JSON.stringify(ownershipGuardToDict(verdict), null, 2)}\n`);
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
for (const line of verdict.messages) {
|
|
79
|
+
process.stdout.write(`${line}\n`);
|
|
80
|
+
}
|
|
81
|
+
if (verdict.intendedOwner.uid !== null) {
|
|
82
|
+
process.stdout.write(`filesystem project-owner: ${verdict.intendedOwner.uid}:${verdict.intendedOwner.gid}` +
|
|
83
|
+
`${verdict.intendedOwner.account ? ` (${verdict.intendedOwner.account})` : ""}` +
|
|
84
|
+
` via ${verdict.intendedOwner.source}\n`);
|
|
85
|
+
}
|
|
86
|
+
process.stdout.write(`status=${verdict.status} wsl=${verdict.wsl} mount=${verdict.mount.capability} ` +
|
|
87
|
+
`block_protected_mutation=${verdict.blockProtectedMutation}\n`);
|
|
88
|
+
}
|
|
89
|
+
if (verdict.status === "fail")
|
|
90
|
+
return 1;
|
|
91
|
+
return 0;
|
|
92
|
+
}
|
|
93
|
+
if (isDirectEntrypoint(import.meta.url)) {
|
|
94
|
+
process.exit(run(process.argv.slice(2)));
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=ownership-doctor.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
export interface OwnershipFixArgs {
|
|
3
|
+
projectRoot: string;
|
|
4
|
+
owner: string | null;
|
|
5
|
+
json: boolean;
|
|
6
|
+
error?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function parseArgs(argv: readonly string[]): OwnershipFixArgs;
|
|
9
|
+
export declare function run(argv: readonly string[]): number;
|
|
10
|
+
//# sourceMappingURL=ownership-fix.d.ts.map
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* ownership:fix / ownership-fix (#1617)
|
|
4
|
+
* Scoped repair of root-owned objects under approved roots only.
|
|
5
|
+
* Reachable under mismatch; env-sourced owner alone does not authorize chown.
|
|
6
|
+
*/
|
|
7
|
+
import { resolve } from "node:path";
|
|
8
|
+
import { DEFT_PROJECT_OWNER, fixScopedOwnership, OWNERSHIP_FACTS_CLASSIFIER, } from "@deftai/directive-core/platform";
|
|
9
|
+
import { isDirectEntrypoint } from "./entrypoint.js";
|
|
10
|
+
export function parseArgs(argv) {
|
|
11
|
+
const parsed = {
|
|
12
|
+
projectRoot: ".",
|
|
13
|
+
owner: null,
|
|
14
|
+
json: false,
|
|
15
|
+
};
|
|
16
|
+
for (let i = 0; i < argv.length; i += 1) {
|
|
17
|
+
const arg = argv[i];
|
|
18
|
+
if (arg === "--") {
|
|
19
|
+
}
|
|
20
|
+
else if (arg === "--json") {
|
|
21
|
+
parsed.json = true;
|
|
22
|
+
}
|
|
23
|
+
else if (arg === "--project-root") {
|
|
24
|
+
const value = argv[i + 1];
|
|
25
|
+
if (value === undefined) {
|
|
26
|
+
return { ...parsed, error: "argument --project-root: expected one argument" };
|
|
27
|
+
}
|
|
28
|
+
parsed.projectRoot = value;
|
|
29
|
+
i += 1;
|
|
30
|
+
}
|
|
31
|
+
else if (arg?.startsWith("--project-root=")) {
|
|
32
|
+
parsed.projectRoot = arg.slice("--project-root=".length);
|
|
33
|
+
}
|
|
34
|
+
else if (arg === "--owner") {
|
|
35
|
+
const value = argv[i + 1];
|
|
36
|
+
if (value === undefined) {
|
|
37
|
+
return { ...parsed, error: "argument --owner: expected uid:gid" };
|
|
38
|
+
}
|
|
39
|
+
parsed.owner = value;
|
|
40
|
+
i += 1;
|
|
41
|
+
}
|
|
42
|
+
else if (arg?.startsWith("--owner=")) {
|
|
43
|
+
parsed.owner = arg.slice("--owner=".length);
|
|
44
|
+
}
|
|
45
|
+
else if (arg === "--help" || arg === "-h") {
|
|
46
|
+
return { ...parsed, error: "__help__" };
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
return { ...parsed, error: `unrecognized argument: ${arg}` };
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return parsed;
|
|
53
|
+
}
|
|
54
|
+
const HELP = "usage: deft ownership:fix [--project-root PATH] [--owner uid:gid] [--json]\n" +
|
|
55
|
+
"Repair root-owned objects under approved project roots only (#1617).\n" +
|
|
56
|
+
"No blanket HOME chown. No symlink follow outside approved roots.\n" +
|
|
57
|
+
`Pass --owner uid:gid or ${DEFT_PROJECT_OWNER}=uid:gid when inference is ambiguous.\n` +
|
|
58
|
+
`Classifier: ${OWNERSHIP_FACTS_CLASSIFIER}\n`;
|
|
59
|
+
export function run(argv) {
|
|
60
|
+
const args = parseArgs(argv);
|
|
61
|
+
if (args.error === "__help__") {
|
|
62
|
+
process.stdout.write(HELP);
|
|
63
|
+
return 0;
|
|
64
|
+
}
|
|
65
|
+
if (args.error !== undefined) {
|
|
66
|
+
process.stderr.write(`ownership:fix: ${args.error}\n`);
|
|
67
|
+
return 2;
|
|
68
|
+
}
|
|
69
|
+
const projectRoot = resolve(args.projectRoot);
|
|
70
|
+
const result = fixScopedOwnership({
|
|
71
|
+
projectRoot,
|
|
72
|
+
explicitOwner: args.owner,
|
|
73
|
+
});
|
|
74
|
+
if (args.json) {
|
|
75
|
+
process.stdout.write(`${JSON.stringify({
|
|
76
|
+
repaired: result.repaired,
|
|
77
|
+
skipped_protected: result.skippedProtected,
|
|
78
|
+
failed: result.failed,
|
|
79
|
+
messages: result.messages,
|
|
80
|
+
ok: result.ok,
|
|
81
|
+
}, null, 2)}\n`);
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
for (const line of result.messages) {
|
|
85
|
+
process.stdout.write(`${line}\n`);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return result.exitCode;
|
|
89
|
+
}
|
|
90
|
+
if (isDirectEntrypoint(import.meta.url)) {
|
|
91
|
+
process.exit(run(process.argv.slice(2)));
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=ownership-fix.js.map
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
interface ParsedArgs {
|
|
3
|
+
repo: string;
|
|
4
|
+
baseSha: string;
|
|
5
|
+
headSha: string;
|
|
6
|
+
treeHash: string;
|
|
7
|
+
prBodyHash: string;
|
|
8
|
+
prNodeId: string | null;
|
|
9
|
+
approvedRevision: string;
|
|
10
|
+
scope: string[];
|
|
11
|
+
acceptance: string;
|
|
12
|
+
generation: number;
|
|
13
|
+
skillVersion: string;
|
|
14
|
+
policyVersion: string;
|
|
15
|
+
runId: string | null;
|
|
16
|
+
complete: boolean;
|
|
17
|
+
observeCommand: boolean;
|
|
18
|
+
observeSemantic: boolean;
|
|
19
|
+
phase: string | null;
|
|
20
|
+
command: string;
|
|
21
|
+
exitCode: number | null;
|
|
22
|
+
inputHash: string | null;
|
|
23
|
+
skipReason: string | null;
|
|
24
|
+
suppliedContentsHash: string;
|
|
25
|
+
controllerObservedHash: string;
|
|
26
|
+
criteriaDigest: string | null;
|
|
27
|
+
reviewedFiles: string[];
|
|
28
|
+
reviewerReportRef: string | null;
|
|
29
|
+
markComplete: boolean;
|
|
30
|
+
skillOpen: boolean;
|
|
31
|
+
evaluate: boolean;
|
|
32
|
+
json: boolean;
|
|
33
|
+
help: boolean;
|
|
34
|
+
error?: string;
|
|
35
|
+
}
|
|
36
|
+
export declare function parseArgs(argv: string[]): ParsedArgs;
|
|
37
|
+
export declare function run(argv: string[]): number;
|
|
38
|
+
export {};
|
|
39
|
+
//# sourceMappingURL=pre-pr-run.d.ts.map
|