@deftai/directive 0.89.0 → 0.90.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.
@@ -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", "lifecycle-event", "session-start", "plan-sequence", "slice", "subagent-monitor", "toolchain-check", "triage-actions", "triage-bootstrap", "triage-bulk", "triage-classify", "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", "verify-branch", "verify-encoding", "verify-forward-coverage", "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-content-manifest", "verify-skill-external-fetch-gate", "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-subagent-alive", "review-monitor-register", "review-monitor-release", "verify-tools", "verify-wip-cap", "verify-orphan-active", "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", "lifecycle-event", "lifecycle-stats", "session-start", "session-ready", "plan-sequence", "slice", "subagent-monitor", "toolchain-check", "triage-actions", "triage-bootstrap", "triage-bulk", "triage-classify", "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", "verify-branch", "verify-encoding", "verify-forward-coverage", "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-content-manifest", "verify-skill-external-fetch-gate", "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-subagent-alive", "review-monitor-register", "review-monitor-release", "verify-tools", "verify-wip-cap", "verify-orphan-active", "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", "github-auth-modes", "github-body", "issue-emit", "issue-ingest", "issue-sync-from-xbrief", "reconcile-issues", "swarm-launch", "swarm-complete-cohort", "swarm-finalize-cohort", "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"];
16
16
  /** Colon aliases for triage-actions (mirrors cli-router SUBCOMMAND_ROUTES). */
package/dist/dispatch.js CHANGED
@@ -69,7 +69,9 @@ export const CLI_MODULE_VERBS = [
69
69
  "release-rollback",
70
70
  "scope-lifecycle",
71
71
  "lifecycle-event",
72
+ "lifecycle-stats",
72
73
  "session-start",
74
+ "session-ready",
73
75
  "plan-sequence",
74
76
  "slice",
75
77
  "subagent-monitor",
@@ -311,7 +313,9 @@ export const VERB_ALIASES = {
311
313
  "issue:sync-from-xbrief": "issue-sync-from-xbrief",
312
314
  upgrade: "install-upgrade",
313
315
  "session:start": "session-start",
316
+ "session:ready": "session-ready",
314
317
  "lifecycle:event": "lifecycle-event",
318
+ "lifecycle:stats": "lifecycle-stats",
315
319
  "toolchain:check": "toolchain-check",
316
320
  "ts:check-lane": "ts-check-lane",
317
321
  "spec:validate": "spec-validate",
@@ -2516,10 +2520,18 @@ const CURATED_HELP_GROUPS = [
2516
2520
  title: "Session & ritual",
2517
2521
  commands: [
2518
2522
  { name: "session:start", summary: "Record session-start ritual state" },
2523
+ {
2524
+ name: "session:ready",
2525
+ summary: "One-shot recovery to gated write-ready (session + ritual + cache)",
2526
+ },
2519
2527
  {
2520
2528
  name: "lifecycle:event",
2521
2529
  summary: "Record review-cycle plan:approved approval events",
2522
2530
  },
2531
+ {
2532
+ name: "lifecycle:stats",
2533
+ summary: "Local xBRIEF lifecycle folder counts for process rollups",
2534
+ },
2523
2535
  ],
2524
2536
  },
2525
2537
  {
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env node
2
+ export interface ParsedLifecycleStatsArgs {
3
+ projectRoot: string;
4
+ since: string;
5
+ json: boolean;
6
+ error?: string;
7
+ }
8
+ /** Parse lifecycle:stats CLI args. */
9
+ export declare function parseArgs(argv: readonly string[]): ParsedLifecycleStatsArgs;
10
+ /** Native lifecycle:stats handler (#2995). */
11
+ export declare function run(argv?: readonly string[]): number;
12
+ //# sourceMappingURL=lifecycle-stats.d.ts.map
@@ -0,0 +1,100 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * CLI: deft lifecycle:stats — local xBRIEF folder counts for process rollups (#2995).
4
+ */
5
+ import { resolve } from "node:path";
6
+ import { fileURLToPath } from "node:url";
7
+ import { collectLifecycleStats, formatLifecycleStatsText, parseDurationMs, } from "@deftai/directive-core/lifecycle";
8
+ /** Parse lifecycle:stats CLI args. */
9
+ export function parseArgs(argv) {
10
+ const parsed = {
11
+ projectRoot: ".",
12
+ since: "7d",
13
+ json: false,
14
+ };
15
+ for (let i = 0; i < argv.length; i += 1) {
16
+ const arg = argv[i];
17
+ if (arg === undefined)
18
+ continue;
19
+ if (arg === "--json") {
20
+ parsed.json = true;
21
+ continue;
22
+ }
23
+ if (arg === "--help" || arg === "-h") {
24
+ return {
25
+ ...parsed,
26
+ error: "usage: lifecycle:stats [--since=7d] [--json] [--project-root <path>]\n" +
27
+ " Counts xbrief lifecycle folders (filesystem only). See commands.md § lifecycle:stats.",
28
+ };
29
+ }
30
+ if (arg === "--project-root") {
31
+ const value = argv[i + 1];
32
+ if (value === undefined) {
33
+ return { ...parsed, error: "argument --project-root: expected one argument" };
34
+ }
35
+ parsed.projectRoot = value;
36
+ i += 1;
37
+ continue;
38
+ }
39
+ if (arg.startsWith("--project-root=")) {
40
+ parsed.projectRoot = arg.slice("--project-root=".length);
41
+ continue;
42
+ }
43
+ if (arg === "--since") {
44
+ const value = argv[i + 1];
45
+ if (value === undefined) {
46
+ return { ...parsed, error: "argument --since: expected one argument" };
47
+ }
48
+ parsed.since = value;
49
+ i += 1;
50
+ continue;
51
+ }
52
+ if (arg.startsWith("--since=")) {
53
+ parsed.since = arg.slice("--since=".length);
54
+ continue;
55
+ }
56
+ if (arg.startsWith("-")) {
57
+ return { ...parsed, error: `unknown flag: ${arg}` };
58
+ }
59
+ return { ...parsed, error: `unexpected argument: ${arg}` };
60
+ }
61
+ return parsed;
62
+ }
63
+ /** Native lifecycle:stats handler (#2995). */
64
+ export function run(argv = process.argv.slice(2)) {
65
+ const args = parseArgs(argv);
66
+ if (args.error !== undefined) {
67
+ process.stderr.write(`lifecycle_stats: ${args.error}\n`);
68
+ return 2;
69
+ }
70
+ try {
71
+ parseDurationMs(args.since);
72
+ }
73
+ catch (err) {
74
+ const msg = err instanceof Error ? err.message : String(err);
75
+ process.stderr.write(`lifecycle_stats: ${msg}\n`);
76
+ return 2;
77
+ }
78
+ try {
79
+ const stats = collectLifecycleStats({
80
+ projectRoot: resolve(args.projectRoot),
81
+ since: args.since,
82
+ });
83
+ if (args.json) {
84
+ process.stdout.write(`${JSON.stringify(stats, null, 2)}\n`);
85
+ }
86
+ else {
87
+ process.stdout.write(formatLifecycleStatsText(stats));
88
+ }
89
+ return 0;
90
+ }
91
+ catch (err) {
92
+ const msg = err instanceof Error ? err.message : String(err);
93
+ process.stderr.write(`lifecycle_stats: ${msg}\n`);
94
+ return 1;
95
+ }
96
+ }
97
+ if (process.argv[1] !== undefined && fileURLToPath(import.meta.url) === process.argv[1]) {
98
+ process.exit(run(process.argv.slice(2)));
99
+ }
100
+ //# sourceMappingURL=lifecycle-stats.js.map
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env node
2
+ export interface ParsedSessionReadyArgs {
3
+ projectRoot: string;
4
+ emitJson: boolean;
5
+ withNetwork: boolean;
6
+ repo: string | null;
7
+ error?: string;
8
+ }
9
+ /** Parse session:ready CLI args. */
10
+ export declare function parseArgs(argv: readonly string[]): ParsedSessionReadyArgs;
11
+ /** Native session:ready handler (#2993). */
12
+ export declare function run(argv?: readonly string[]): number;
13
+ //# sourceMappingURL=session-ready.d.ts.map
@@ -0,0 +1,112 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * CLI: deft session:ready — one-shot mutation recovery (#2993).
4
+ *
5
+ * Composes session:start (when needed) + verify:session-ritual --tier=gated
6
+ * + cache fetch-all recovery so PreToolUse gated inspect goes green in one verb.
7
+ */
8
+ import { resolve } from "node:path";
9
+ import { fileURLToPath } from "node:url";
10
+ import { runSessionReady } from "@deftai/directive-core/session";
11
+ /** Parse session:ready CLI args. */
12
+ export function parseArgs(argv) {
13
+ const parsed = {
14
+ projectRoot: ".",
15
+ emitJson: false,
16
+ withNetwork: false,
17
+ repo: null,
18
+ };
19
+ for (let i = 0; i < argv.length; i += 1) {
20
+ const arg = argv[i];
21
+ if (arg === undefined)
22
+ continue;
23
+ if (arg === "--")
24
+ continue;
25
+ if (arg === "--json") {
26
+ parsed.emitJson = true;
27
+ continue;
28
+ }
29
+ if (arg === "--with-network") {
30
+ parsed.withNetwork = true;
31
+ continue;
32
+ }
33
+ if (arg === "--help" || arg === "-h") {
34
+ return {
35
+ ...parsed,
36
+ error: "usage: session:ready [--project-root <path>] [--repo OWNER/NAME] [--with-network] [--json]\n" +
37
+ " One-shot recovery: session:start (if needed) + gated ritual + cache recovery (#2993).",
38
+ };
39
+ }
40
+ if (arg === "--project-root") {
41
+ const value = argv[i + 1];
42
+ if (value === undefined) {
43
+ return { ...parsed, error: "argument --project-root: expected one argument" };
44
+ }
45
+ parsed.projectRoot = value;
46
+ i += 1;
47
+ continue;
48
+ }
49
+ if (arg.startsWith("--project-root=")) {
50
+ parsed.projectRoot = arg.slice("--project-root=".length);
51
+ continue;
52
+ }
53
+ if (arg === "--repo") {
54
+ const value = argv[i + 1];
55
+ if (value === undefined) {
56
+ return { ...parsed, error: "argument --repo: expected one argument" };
57
+ }
58
+ parsed.repo = value;
59
+ i += 1;
60
+ continue;
61
+ }
62
+ if (arg.startsWith("--repo=")) {
63
+ parsed.repo = arg.slice("--repo=".length);
64
+ continue;
65
+ }
66
+ if (arg.startsWith("-")) {
67
+ return { ...parsed, error: `unrecognized argument: ${arg}` };
68
+ }
69
+ return { ...parsed, error: `unexpected argument: ${arg}` };
70
+ }
71
+ return parsed;
72
+ }
73
+ /** Native session:ready handler (#2993). */
74
+ export function run(argv = process.argv.slice(2)) {
75
+ const args = parseArgs(argv);
76
+ if (args.error !== undefined) {
77
+ process.stderr.write(`session_ready: ${args.error}\n`);
78
+ return 2;
79
+ }
80
+ const projectRoot = resolve(args.projectRoot);
81
+ const result = runSessionReady(projectRoot, {
82
+ repo: args.repo,
83
+ sessionStartOptions: {
84
+ allowOptionalNetwork: args.withNetwork ? true : undefined,
85
+ writeHistory: false,
86
+ },
87
+ });
88
+ if (args.emitJson) {
89
+ process.stdout.write(`${JSON.stringify({
90
+ ready: result.code === 0,
91
+ exit_code: result.code,
92
+ path: result.path,
93
+ message: result.message,
94
+ steps: result.steps,
95
+ duration_ms: result.duration_ms,
96
+ })}\n`);
97
+ return result.code;
98
+ }
99
+ const sink = result.code === 0 ? process.stdout : process.stderr;
100
+ // Prefer the canonical single success/failure line; keep intermediate lines
101
+ // only when they add recovery context (start output / cache progress).
102
+ const intermediates = result.lines.filter((line) => line !== result.message);
103
+ for (const line of intermediates) {
104
+ sink.write(`${line}\n`);
105
+ }
106
+ sink.write(`${result.message}\n`);
107
+ return result.code;
108
+ }
109
+ if (process.argv[1] !== undefined && fileURLToPath(import.meta.url) === process.argv[1]) {
110
+ process.exit(run(process.argv.slice(2)));
111
+ }
112
+ //# sourceMappingURL=session-ready.js.map
@@ -1,10 +1,15 @@
1
1
  #!/usr/bin/env node
2
+ import { type SessionCeremonyTier } from "@deftai/directive-core/session";
2
3
  export interface ParsedSessionStartArgs {
3
4
  projectRoot: string;
4
5
  deferValues: string[];
5
6
  emitJson: boolean;
6
7
  noHistory: boolean;
7
8
  readOnly: boolean;
9
+ /** #2991: opt into optional network (release probe + triage cache hydrate). */
10
+ withNetwork: boolean;
11
+ /** #2992: cold (full) vs rearm (clock/HEAD refresh without fat path). */
12
+ ceremonyTier: SessionCeremonyTier;
8
13
  error?: string;
9
14
  }
10
15
  /** Parse session:start CLI args, mirroring scripts/session_start.py. */
@@ -1,7 +1,14 @@
1
1
  #!/usr/bin/env node
2
2
  import { resolve } from "node:path";
3
3
  import { fileURLToPath } from "node:url";
4
- import { parseDeferrals, READ_ONLY_POSTURE, ritualStatePath, runSessionStart, } from "@deftai/directive-core/session";
4
+ import { COLD_CEREMONY_TIER, parseDeferrals, READ_ONLY_POSTURE, REARM_CEREMONY_TIER, ritualStatePath, runSessionStart, SESSION_CEREMONY_TIERS, } from "@deftai/directive-core/session";
5
+ function parseCeremonyTier(raw) {
6
+ const value = raw.trim().toLowerCase();
7
+ if (SESSION_CEREMONY_TIERS.includes(value)) {
8
+ return value;
9
+ }
10
+ return null;
11
+ }
5
12
  /** Parse session:start CLI args, mirroring scripts/session_start.py. */
6
13
  export function parseArgs(argv) {
7
14
  const parsed = {
@@ -10,6 +17,8 @@ export function parseArgs(argv) {
10
17
  emitJson: false,
11
18
  noHistory: false,
12
19
  readOnly: false,
20
+ withNetwork: false,
21
+ ceremonyTier: COLD_CEREMONY_TIER,
13
22
  };
14
23
  for (let i = 0; i < argv.length; i += 1) {
15
24
  const arg = argv[i];
@@ -22,6 +31,39 @@ export function parseArgs(argv) {
22
31
  else if (arg === "--read-only") {
23
32
  parsed.readOnly = true;
24
33
  }
34
+ else if (arg === "--with-network") {
35
+ parsed.withNetwork = true;
36
+ }
37
+ else if (arg === "--rearm") {
38
+ // #2992: shortcut for --tier=rearm
39
+ parsed.ceremonyTier = REARM_CEREMONY_TIER;
40
+ }
41
+ else if (arg === "--tier") {
42
+ const value = argv[i + 1];
43
+ if (value === undefined) {
44
+ return { ...parsed, error: "argument --tier: expected one argument (cold|rearm)" };
45
+ }
46
+ const tier = parseCeremonyTier(value);
47
+ if (tier === null) {
48
+ return {
49
+ ...parsed,
50
+ error: `argument --tier: expected cold|rearm, got ${JSON.stringify(value)}`,
51
+ };
52
+ }
53
+ parsed.ceremonyTier = tier;
54
+ i += 1;
55
+ }
56
+ else if (arg?.startsWith("--tier=")) {
57
+ const value = arg.slice("--tier=".length);
58
+ const tier = parseCeremonyTier(value);
59
+ if (tier === null) {
60
+ return {
61
+ ...parsed,
62
+ error: `argument --tier: expected cold|rearm, got ${JSON.stringify(value)}`,
63
+ };
64
+ }
65
+ parsed.ceremonyTier = tier;
66
+ }
25
67
  else if (arg === "--project-root") {
26
68
  const value = argv[i + 1];
27
69
  if (value === undefined) {
@@ -81,6 +123,8 @@ export function run(argv) {
81
123
  deferrals,
82
124
  writeHistory: !args.noHistory,
83
125
  posture: args.readOnly ? READ_ONLY_POSTURE : undefined,
126
+ allowOptionalNetwork: args.withNetwork ? true : undefined,
127
+ ceremonyTier: args.ceremonyTier,
84
128
  });
85
129
  }
86
130
  finally {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deftai/directive",
3
- "version": "0.89.0",
3
+ "version": "0.90.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.89.0",
38
- "@deftai/directive-content": "^0.89.0"
37
+ "@deftai/directive-core": "^0.90.0",
38
+ "@deftai/directive-content": "^0.90.0"
39
39
  },
40
40
  "scripts": {
41
41
  "build": "tsc -b"