@deftai/directive 0.125.0 → 0.125.1

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 CHANGED
@@ -11,6 +11,8 @@
11
11
  * deft authz:grant -- --template release-publish --target 0.30.0 [--confirm]
12
12
  * deft authz:grant -- --template finish-loop [--confirm]
13
13
  * deft authz:grant -- --template spec-drift-override --target <baseline> --plan-ref <scopeId> --story-ids <ids> [--confirm]
14
+ * deft authz:grant -- --template gate-override --target <refuseCode> --plan-ref <attemptId> \\
15
+ * --base-sha <sha> --head-sha <sha> --tree-hash <hash> [--confirm]
14
16
  * deft authz:grant -- --parent <parent.xbrief.json> --draft <draft.json> [--repo owner/name] [--confirm]
15
17
  * deft authz:revoke -- <grant-id> [--confirm]
16
18
  *
@@ -27,7 +29,7 @@
27
29
  import { existsSync } from "node:fs";
28
30
  import { isAbsolute, resolve } from "node:path";
29
31
  import { onePrUnit } from "@deftai/directive-core";
30
- 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";
32
+ import { AFK_TEMPLATE_NAMES, AUTHZ_OPERATIONS, CLOSED_VERB_TEMPLATE_NAMES, FINISH_LOOP_TEMPLATE_NAME, formatDecomposeStructuralMintCommand, GATE_OVERRIDE_TEMPLATE_NAME, isAfkTemplateName, isClosedVerbTemplateName, isFinishLoopTemplateName, isGateOverrideTemplateName, mintAfkTemplateGrant, mintDecomposeStructuralApplyGrant, mintGateOverrideTemplateGrant, mintHumanOriginGrant, revokeGrant, showAuthzSnapshot, startUatLease, suspendUatLease, toProjectRelativePosix, } from "@deftai/directive-core/authz";
31
33
  import { uatCampaignEndSeal } from "@deftai/directive-core/authz/campaign-end-seal";
32
34
  import { isSpecDriftOverrideTemplateName, mintSpecDriftOverrideTemplateGrant, SPEC_DRIFT_OVERRIDE_TEMPLATE_NAME, } from "@deftai/directive-core/policy";
33
35
  import { refuseMintWhileUatActive, refuseNonInteractiveMint, resolveHumanPresenceMintSeams, } from "./human-presence-mint.js";
@@ -68,6 +70,11 @@ function parseArgv(argv) {
68
70
  target: null,
69
71
  parent: null,
70
72
  draft: null,
73
+ baseSha: null,
74
+ headSha: null,
75
+ treeHash: null,
76
+ worktree: null,
77
+ evaluatorId: null,
71
78
  format: "text",
72
79
  confirm: false,
73
80
  };
@@ -196,6 +203,26 @@ function parseArgv(argv) {
196
203
  base.draft = args[++i] ?? null;
197
204
  continue;
198
205
  }
206
+ if (a === "--base-sha" || a === "--baseSha") {
207
+ base.baseSha = args[++i] ?? null;
208
+ continue;
209
+ }
210
+ if (a === "--head-sha" || a === "--headSha") {
211
+ base.headSha = args[++i] ?? null;
212
+ continue;
213
+ }
214
+ if (a === "--tree-hash" || a === "--treeHash") {
215
+ base.treeHash = args[++i] ?? null;
216
+ continue;
217
+ }
218
+ if (a === "--worktree") {
219
+ base.worktree = args[++i] ?? null;
220
+ continue;
221
+ }
222
+ if (a === "--evaluator-id" || a === "--evaluatorId") {
223
+ base.evaluatorId = args[++i] ?? null;
224
+ continue;
225
+ }
199
226
  if (a === "--confirm") {
200
227
  base.confirm = true;
201
228
  continue;
@@ -255,6 +282,11 @@ function helpText() {
255
282
  ` Finish-loop (#871): ${FINISH_LOOP_TEMPLATE_NAME} — edit/push/pr/merge (no release ops)`,
256
283
  " Templates call mintHumanOriginGrant only — no second session-auth mint engine.",
257
284
  " Env bypass for a single shell: DEFT_ALLOW_RELEASE_PUBLISH=1 / DEFT_ALLOW_FINISH_LOOP=1.",
285
+ "",
286
+ `Gate-override (#5542): ${GATE_OVERRIDE_TEMPLATE_NAME}`,
287
+ " deft authz:grant -- --template gate-override --target <refuseCode> --plan-ref <attemptId> \\",
288
+ " --base-sha <sha> --head-sha <sha> --tree-hash <hash> [--worktree <id>] [--evaluator-id <id>] [--confirm]",
289
+ " operator-cli human-presence only; waived ≠ passed; no independent push/merge.",
258
290
  ].join("\n");
259
291
  }
260
292
  export function main(argv = process.argv.slice(2), seams = {}) {
@@ -481,6 +513,59 @@ export function main(argv = process.argv.slice(2), seams = {}) {
481
513
  process.stdout.write(` origins=${claim.origins.map((o) => `${o.repo}#${o.issueId}`).join(",")}\n`);
482
514
  return 0;
483
515
  }
516
+ // Gate-override hatch (#5542 Prefer-A Bound): coverage-applicability refuse waiver.
517
+ if (args.template !== null && isGateOverrideTemplateName(args.template)) {
518
+ if (args.target === null || args.target.trim().length === 0) {
519
+ process.stderr.write("authz:grant --template gate-override requires --target <refuseCode>\n");
520
+ return 2;
521
+ }
522
+ if (args.planRef === null || args.planRef.trim().length === 0) {
523
+ process.stderr.write("authz:grant --template gate-override requires --plan-ref <attemptId>\n");
524
+ return 2;
525
+ }
526
+ if (args.baseSha === null ||
527
+ args.baseSha.trim().length === 0 ||
528
+ args.headSha === null ||
529
+ args.headSha.trim().length === 0 ||
530
+ args.treeHash === null ||
531
+ args.treeHash.trim().length === 0) {
532
+ process.stderr.write("authz:grant --template gate-override requires --base-sha --head-sha --tree-hash\n");
533
+ return 2;
534
+ }
535
+ const blockedGate = gateConfirm();
536
+ if (blockedGate !== null)
537
+ return blockedGate;
538
+ const mintedGate = mintGateOverrideTemplateGrant({
539
+ projectRoot: args.projectRoot,
540
+ target: args.target,
541
+ planRef: args.planRef,
542
+ baseSha: args.baseSha,
543
+ headSha: args.headSha,
544
+ treeHash: args.treeHash,
545
+ actor: args.actor,
546
+ expiresAt: args.expiresAt,
547
+ // gate-override template is always single-use (#5542 Greptile P2).
548
+ singleUse: true,
549
+ repo: args.repo,
550
+ branch: args.branch,
551
+ worktree: args.worktree,
552
+ evaluatorId: args.evaluatorId,
553
+ failedGateEvidence: args.note,
554
+ });
555
+ if (!mintedGate.ok) {
556
+ process.stderr.write(`authz:grant: ${mintedGate.reason}\n`);
557
+ return 2;
558
+ }
559
+ const gateGrant = mintedGate.grant;
560
+ process.stdout.write(`✓ human-origin grant minted id=${gateGrant.id} origin=${gateGrant.origin.kind} ` +
561
+ `template=${GATE_OVERRIDE_TEMPLATE_NAME}\n`);
562
+ process.stdout.write(` ops=[${gateGrant.scope.operations.join(",")}] attempt=${gateGrant.scope.planRef} ` +
563
+ `surfaces=${gateGrant.scope.surfaces.join(", ")}\n`);
564
+ process.stdout.write(" Hatch: waives coverage-applicability refuse for bound attempt/tree only; " +
565
+ "waived ≠ passed; reviewObligation=pre-merge-human-review-required.\n");
566
+ process.stdout.write(" Authorization SoT: Wave 1 grant store (.deft/authz/grants) — not session-auth / chat.\n");
567
+ return 0;
568
+ }
484
569
  // Spec-drift override hatch (#5350): policy module, not authz/** (class 4).
485
570
  if (args.template !== null && isSpecDriftOverrideTemplateName(args.template)) {
486
571
  if (args.target === null || args.target.trim().length === 0) {
@@ -525,7 +610,7 @@ export function main(argv = process.argv.slice(2), seams = {}) {
525
610
  // AFK template path (#1095 / #871): presets only — still mintHumanOriginGrant.
526
611
  if (args.template !== null && args.template.trim().length > 0) {
527
612
  if (!isAfkTemplateName(args.template)) {
528
- process.stderr.write(`authz:grant unknown --template '${args.template}'; expected one of: ${AFK_TEMPLATE_NAMES.join(", ")}, ${SPEC_DRIFT_OVERRIDE_TEMPLATE_NAME}\n`);
613
+ process.stderr.write(`authz:grant unknown --template '${args.template}'; expected one of: ${AFK_TEMPLATE_NAMES.join(", ")}, ${SPEC_DRIFT_OVERRIDE_TEMPLATE_NAME}, ${GATE_OVERRIDE_TEMPLATE_NAME}\n`);
529
614
  return 2;
530
615
  }
531
616
  if (isClosedVerbTemplateName(args.template) &&
@@ -569,7 +654,7 @@ export function main(argv = process.argv.slice(2), seams = {}) {
569
654
  return 0;
570
655
  }
571
656
  if (args.operations.length === 0) {
572
- process.stderr.write("authz:grant requires --operations <edit,push,...>, --template <finish-loop|release-*|spec-drift-override>, " +
657
+ process.stderr.write("authz:grant requires --operations <edit,push,...>, --template <finish-loop|release-*|spec-drift-override|gate-override>, " +
573
658
  "or --parent + --draft (structural scope:decompose apply)\n");
574
659
  return 2;
575
660
  }
@@ -12,7 +12,7 @@ export interface DispatchIo {
12
12
  /** CLI modules in packages/cli/src (excluding parity harnesses and bin/index). */
13
13
  export declare const CLI_MODULE_VERBS: readonly ["agents-refresh", "cache", "check", "capacity-backfill", "capacity-show", "codebase-default-extractor", "codebase-map", "codebase-map-fresh", "codebase-projection-registry", "codebase-provider", "doctor", "ownership-doctor", "ownership-fix", "verify-ownership", "install-upgrade", "install-uninstall", "migrate-preflight", "migrate-xbrief", "migrate-category-b", "framework-check-updates", "hook-dispatch", "umbrella-current-shape", "changelog-check", "change-init", "commit-lint", "coverage-hotspots", "policy", "authz", "escalation-cli", "pr-closing-keywords", "pr-merge-readiness", "pr-monitor", "pr-protected-issues", "pr-wait-mergeable", "pr-watch", "pr-finish-loop", "directive-finish-loop", "pre-pr-run", "preflight-cache", "preflight-gh", "probe-session", "release", "release-e2e", "release-publish", "release-rollback", "release-wait-npm", "scope-lifecycle", "scope-record-approved-scope", "scope-record-observable-scope", "scope-record-intent-constraint", "scm-sync-default", "lifecycle-event", "lifecycle-stats", "session-start", "session-ready", "occupancy-steal", "occupancy-release", "occupancy-heartbeat", "occupancy-grant", "plan-sequence", "slice", "subagent-monitor", "toolchain-check", "triage-actions", "triage-bootstrap", "triage-bulk", "triage-classify", "triage-strip-withdrawn", "triage-evaluate", "triage-help", "triage-queue", "triage-reconcile", "triage-refresh", "triage-scope", "triage-scope-drift", "triage-smoketest", "triage-subscribe", "triage-summary", "triage-welcome", "ts-check-lane", "vbrief-activate", "vbrief-build", "vbrief-preflight", "vbrief-reconcile", "vbrief-validate", "vbrief-validation", "xbrief-create", "xbrief-verify", "xbrief-adopt-stored-plan-id", "verify-branch", "verify-encoding", "verify-forward-coverage", "verify-test-boundary", "verify-class-checks", "verify-presentation-coverage", "verify-scope-provenance", "verify-consumer-check-contract", "verify-hooks-installed", "verify-investigation", "verify-judgment-gates", "verify-no-task-runtime", "validate-links", "validate-strategy-output", "verify-biome-config", "verify-bridge-drift", "verify-capacity", "verify-contained-writes", "verify-telemetry-coverage", "verify-content-manifest", "verify-deposit-closure", "verify-consumer-hard-stops", "verify-closing-keywords", "verify-skill-external-fetch-gate", "verify-semantic-single-source", "verify-contract-drift", "verify-cursor-tier1", "verify-openclaw-tier1", "verify-go-freeze", "verify-scm-boundary", "verify-session-ritual", "verify-plan-sequence", "verify-stubs", "verify-xbrief-drift", "verify-spec-prd-fresh", "verify-spec-drift", "rule-ownership-lint", "verify-story-ready", "verify-review-monitor", "verify-cohort-review-monitors", "verify-l4-owner", "verify-subagent-alive", "verify-subagent-steer", "subagent-pre-cancel", "subagent-steer-write", "design-critique-spend-resolve", "review-monitor-register", "review-monitor-release", "verify-tools", "verify-wip-cap", "verify-orphan-active", "verify-pr-closeout-attestable", "verify-lifecycle-visible", "verify-completed-tracked", "verify-completed-write-guard", "verify-literal-ac", "verify-ac", "verify-agents-md-budget", "verify-consumer-header-placeholder", "verify-agents-md-advisory", "verify-persisted-planning-narratives", "verify-eval-health-relocation", "verify-eval-triggers-relocation", "verify-evaluator-surface", "verify-observable-scope", "verify-operator-scope-limit", "verify-presentation-ceiling", "verify-intent-constraint", "verify-durable-effect-acquisition", "verify-consumer-test-lane", "eval-health", "eval-run", "eval-report", "eval-triggers"];
14
14
  /** Core-only CLI entrypoints without a packages/cli wrapper. */
15
- export declare const CORE_MODULE_VERBS: readonly ["scm", "scm-readiness", "github-auth-modes", "github-body", "issue-emit", "issue-ingest", "issue-sync-from-xbrief", "reconcile-issues", "swarm-launch", "swarm-complete-cohort", "swarm-finalize-cohort", "swarm-finalize-owed", "swarm-pre-dispatch", "swarm-readiness", "swarm-routing-verify", "swarm-routing-set", "swarm-verify-review-clean", "swarm-worktrees", "framework-commands", "pack-render", "packs-slice", "prd-render", "export-spec", "project-render", "project-write-narratives", "roadmap-render", "rule-map", "spec-render", "spec-reconstruct", "spec-validate", "code-structure-validate", "pack-migrate-skills", "pack-migrate-rules", "pack-migrate-strategies", "pack-migrate-patterns", "pack-migrate-swarm-spec", "policy-set", "setup-ghx", "scope-undo", "scope-demote", "scope-decompose", "changelog-resolve-unreleased", "architecture-preflight-sor", "feedback-file", "value-readback", "product-signal", "freshness-report", "decision-write", "decision-list", "docs-impact", "migrate-clause-ids", "migrate-confidence", "rule-to-verb-parity"];
15
+ export declare const CORE_MODULE_VERBS: readonly ["scm", "scm-readiness", "github-auth-modes", "github-body", "issue-emit", "issue-ingest", "issue-sync-from-xbrief", "reconcile-issues", "swarm-launch", "swarm-complete-cohort", "swarm-finalize-cohort", "swarm-finalize-owed", "swarm-pre-dispatch", "swarm-readiness", "swarm-routing-verify", "swarm-routing-set", "swarm-verify-review-clean", "swarm-worktrees", "framework-commands", "pack-render", "packs-slice", "prd-render", "export-spec", "project-render", "project-write-narratives", "roadmap-render", "rule-map", "spec-render", "spec-reconstruct", "spec-validate", "code-structure-validate", "pack-migrate-skills", "pack-migrate-rules", "pack-migrate-strategies", "pack-migrate-patterns", "pack-migrate-swarm-spec", "policy-set", "setup-ghx", "scope-undo", "scope-demote", "scope-decompose", "changelog-resolve-unreleased", "architecture-preflight-sor", "feedback-file", "value-readback", "product-signal", "freshness-report", "decision-write", "decision-list", "docs-impact", "tutorial", "migrate-clause-ids", "migrate-confidence", "rule-to-verb-parity"];
16
16
  /** Colon aliases for triage-actions (mirrors cli-router SUBCOMMAND_ROUTES). */
17
17
  export declare const TRIAGE_ACTION_ALIAS_SUBCOMMANDS: Readonly<Record<string, string>>;
18
18
  /** Colon aliases for policy subcommands (mirrors cli-router SUBCOMMAND_ROUTES). */
@@ -23,6 +23,8 @@ export declare const AUTHZ_ACTION_ALIAS_SUBCOMMANDS: Readonly<Record<string, str
23
23
  export declare const ESCALATION_ACTION_ALIAS_SUBCOMMANDS: Readonly<Record<string, string>>;
24
24
  /** Colon aliases for plan-sequence subcommands (#2402). */
25
25
  export declare const PLAN_SEQUENCE_ALIAS_SUBCOMMANDS: Readonly<Record<string, string>>;
26
+ /** Colon aliases for the Directive Tutorial (#4981). */
27
+ export declare const TUTORIAL_ALIAS_SUBCOMMANDS: Readonly<Record<string, string>>;
26
28
  /** Colon aliases for product-signal subcommands (#2693). */
27
29
  export declare const PRODUCT_SIGNAL_ALIAS_SUBCOMMANDS: Readonly<Record<string, string>>;
28
30
  /** Colon aliases for freshness subcommands (#3117). */
package/dist/dispatch.js CHANGED
@@ -243,6 +243,7 @@ export const CORE_MODULE_VERBS = [
243
243
  "decision-write",
244
244
  "decision-list",
245
245
  "docs-impact",
246
+ "tutorial",
246
247
  "migrate-clause-ids",
247
248
  "migrate-confidence",
248
249
  "rule-to-verb-parity",
@@ -301,6 +302,20 @@ export const PLAN_SEQUENCE_ALIAS_SUBCOMMANDS = {
301
302
  "plan-sequence:advance": "advance",
302
303
  };
303
304
  const PLAN_SEQUENCE_COLON_ALIASES = Object.fromEntries(Object.keys(PLAN_SEQUENCE_ALIAS_SUBCOMMANDS).map((alias) => [alias, "plan-sequence"]));
305
+ /** Colon aliases for the Directive Tutorial (#4981). */
306
+ export const TUTORIAL_ALIAS_SUBCOMMANDS = {
307
+ "tutorial:offer": "offer",
308
+ "tutorial:start": "start",
309
+ "tutorial:inspect": "inspect",
310
+ "tutorial:advance": "advance",
311
+ "tutorial:resume": "resume",
312
+ "tutorial:skip": "skip",
313
+ "tutorial:leave": "leave",
314
+ "tutorial:reset": "reset",
315
+ "tutorial:decline": "decline",
316
+ "tutorial:defer": "defer",
317
+ };
318
+ const TUTORIAL_COLON_ALIASES = Object.fromEntries(Object.keys(TUTORIAL_ALIAS_SUBCOMMANDS).map((alias) => [alias, "tutorial"]));
304
319
  /** Colon aliases for product-signal subcommands (#2693). */
305
320
  export const PRODUCT_SIGNAL_ALIAS_SUBCOMMANDS = {
306
321
  "product-signal:status": "status",
@@ -416,6 +431,7 @@ export const VERB_ALIASES = {
416
431
  "verify:session-ritual": "verify-session-ritual",
417
432
  "verify:plan-sequence": "verify-plan-sequence",
418
433
  ...PLAN_SEQUENCE_COLON_ALIASES,
434
+ ...TUTORIAL_COLON_ALIASES,
419
435
  "verify-strategy-output": "validate-strategy-output",
420
436
  "validate:strategy-output": "validate-strategy-output",
421
437
  "verify:codebase-map-fresh": "codebase-map-fresh",
@@ -2662,6 +2678,10 @@ async function loadCoreModuleHandler(verb, io) {
2662
2678
  const { docsImpactMain } = await import("@deftai/directive-core/dist/docs/docs-impact.js");
2663
2679
  return (argv) => docsImpactMain(argv);
2664
2680
  }
2681
+ case "tutorial": {
2682
+ const { tutorialMain } = await import("@deftai/directive-core/dist/tutorial/cli.js");
2683
+ return tutorialMain;
2684
+ }
2665
2685
  case "migrate-clause-ids": {
2666
2686
  const { mainEntry } = await import("@deftai/directive-core/dist/xbrief-migrate/clause-ids.js");
2667
2687
  return (argv) => mainEntry(argv);
@@ -3013,6 +3033,7 @@ export async function dispatch(argv, io = defaultIo()) {
3013
3033
  const authzSubcommand = verb !== undefined ? AUTHZ_ACTION_ALIAS_SUBCOMMANDS[verb] : undefined;
3014
3034
  const escalationSubcommand = verb !== undefined ? ESCALATION_ACTION_ALIAS_SUBCOMMANDS[verb] : undefined;
3015
3035
  const planSequenceSubcommand = verb !== undefined ? PLAN_SEQUENCE_ALIAS_SUBCOMMANDS[verb] : undefined;
3036
+ const tutorialSubcommand = verb !== undefined ? TUTORIAL_ALIAS_SUBCOMMANDS[verb] : undefined;
3016
3037
  const productSignalSubcommand = verb !== undefined ? PRODUCT_SIGNAL_ALIAS_SUBCOMMANDS[verb] : undefined;
3017
3038
  const freshnessSubcommand = verb !== undefined ? FRESHNESS_ALIAS_SUBCOMMANDS[verb] : undefined;
3018
3039
  const vbriefValidateSubcommand = verb === "verify:vbrief-conformance" && canonical === "vbrief-validate"
@@ -3030,13 +3051,15 @@ export async function dispatch(argv, io = defaultIo()) {
3030
3051
  ? [escalationSubcommand, ...rest]
3031
3052
  : planSequenceSubcommand !== undefined && canonical === "plan-sequence"
3032
3053
  ? [planSequenceSubcommand, ...rest]
3033
- : productSignalSubcommand !== undefined && canonical === "product-signal"
3034
- ? [productSignalSubcommand, ...rest]
3035
- : freshnessSubcommand !== undefined && canonical === "freshness-report"
3036
- ? [freshnessSubcommand, ...rest]
3037
- : vbriefValidateSubcommand !== undefined
3038
- ? [vbriefValidateSubcommand, ...rest]
3039
- : rest;
3054
+ : tutorialSubcommand !== undefined && canonical === "tutorial"
3055
+ ? [tutorialSubcommand, ...rest]
3056
+ : productSignalSubcommand !== undefined && canonical === "product-signal"
3057
+ ? [productSignalSubcommand, ...rest]
3058
+ : freshnessSubcommand !== undefined && canonical === "freshness-report"
3059
+ ? [freshnessSubcommand, ...rest]
3060
+ : vbriefValidateSubcommand !== undefined
3061
+ ? [vbriefValidateSubcommand, ...rest]
3062
+ : rest;
3040
3063
  const helpRc = interceptHelp(canonical.replaceAll("-", "_"), handlerArgv, {
3041
3064
  write: io.writeOut,
3042
3065
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deftai/directive",
3
- "version": "0.125.0",
3
+ "version": "0.125.1",
4
4
  "description": "Directive CLI — npm install path for the Deft Directive framework.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://deftai.github.io/directive/",
@@ -35,8 +35,8 @@
35
35
  "provenance": true
36
36
  },
37
37
  "dependencies": {
38
- "@deftai/directive-core": "^0.125.0",
39
- "@deftai/directive-content": "^0.125.0"
38
+ "@deftai/directive-core": "^0.125.1",
39
+ "@deftai/directive-content": "^0.125.1"
40
40
  },
41
41
  "scripts": {
42
42
  "build": "tsc -b",