@deftai/directive 0.79.4 → 0.81.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.
@@ -72,6 +72,11 @@ export const SUBCOMMAND_ROUTES = {
72
72
  "policy:enforce-branches": ["policy", "enforce-branches"],
73
73
  "policy:allow-direct-commits": ["policy", "allow-direct-commits"],
74
74
  "policy:enable-value-feedback": ["policy", "enable-value-feedback"],
75
+ "product-signal:status": ["product-signal", "status"],
76
+ "product-signal:enable": ["product-signal", "enable"],
77
+ "product-signal:consent": ["product-signal", "consent"],
78
+ "product-signal:submit": ["product-signal", "submit"],
79
+ "product-signal:bootstrap-sink": ["product-signal", "bootstrap-sink"],
75
80
  "vbrief:reconcile-graph": ["vbrief-reconcile", "graph"],
76
81
  "vbrief:reconcile-labels": ["vbrief-reconcile", "labels"],
77
82
  "vbrief:reconcile-umbrellas": ["vbrief-reconcile", "umbrellas"],
@@ -12,13 +12,15 @@ 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", "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", "pr-closing-keywords", "pr-merge-readiness", "pr-monitor", "pr-protected-issues", "pr-wait-mergeable", "pr-watch", "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-content-manifest", "verify-contract-drift", "verify-cursor-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", "review-monitor-register", "verify-tools", "verify-wip-cap", "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
- 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", "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"];
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", "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). */
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). */
19
19
  export declare const POLICY_ACTION_ALIAS_SUBCOMMANDS: Readonly<Record<string, string>>;
20
20
  /** Colon aliases for plan-sequence subcommands (#2402). */
21
21
  export declare const PLAN_SEQUENCE_ALIAS_SUBCOMMANDS: Readonly<Record<string, string>>;
22
+ /** Colon aliases for product-signal subcommands (#2693). */
23
+ export declare const PRODUCT_SIGNAL_ALIAS_SUBCOMMANDS: Readonly<Record<string, string>>;
22
24
  /** Task-style aliases (framework_commands / Taskfile names). */
23
25
  export declare const VERB_ALIASES: Readonly<Record<string, string>>;
24
26
  /** Pinned ghx version (display only) — keep in lockstep with .github/workflows/ci.yml env.GHX_VERSION. */
package/dist/dispatch.js CHANGED
@@ -166,6 +166,7 @@ export const CORE_MODULE_VERBS = [
166
166
  "architecture-preflight-sor",
167
167
  "feedback-file",
168
168
  "value-readback",
169
+ "product-signal",
169
170
  ];
170
171
  /** Colon aliases for triage-actions (mirrors cli-router SUBCOMMAND_ROUTES). */
171
172
  export const TRIAGE_ACTION_ALIAS_SUBCOMMANDS = {
@@ -195,6 +196,15 @@ export const PLAN_SEQUENCE_ALIAS_SUBCOMMANDS = {
195
196
  "plan-sequence:advance": "advance",
196
197
  };
197
198
  const PLAN_SEQUENCE_COLON_ALIASES = Object.fromEntries(Object.keys(PLAN_SEQUENCE_ALIAS_SUBCOMMANDS).map((alias) => [alias, "plan-sequence"]));
199
+ /** Colon aliases for product-signal subcommands (#2693). */
200
+ export const PRODUCT_SIGNAL_ALIAS_SUBCOMMANDS = {
201
+ "product-signal:status": "status",
202
+ "product-signal:enable": "enable",
203
+ "product-signal:consent": "consent",
204
+ "product-signal:submit": "submit",
205
+ "product-signal:bootstrap-sink": "bootstrap-sink",
206
+ };
207
+ const PRODUCT_SIGNAL_COLON_ALIASES = Object.fromEntries(Object.keys(PRODUCT_SIGNAL_ALIAS_SUBCOMMANDS).map((alias) => [alias, "product-signal"]));
198
208
  /** Task-style aliases (framework_commands / Taskfile names). */
199
209
  export const VERB_ALIASES = {
200
210
  "hook:dispatch": "hook-dispatch",
@@ -248,6 +258,7 @@ export const VERB_ALIASES = {
248
258
  "triage:scope": "triage-scope",
249
259
  ...TRIAGE_ACTION_COLON_ALIASES,
250
260
  ...POLICY_ACTION_COLON_ALIASES,
261
+ ...PRODUCT_SIGNAL_COLON_ALIASES,
251
262
  "agents:refresh": "agents-refresh",
252
263
  "migrate:preflight": "migrate-preflight",
253
264
  "migrate:xbrief": "migrate-xbrief",
@@ -2348,6 +2359,10 @@ async function loadCoreModuleHandler(verb, io) {
2348
2359
  const { mainEntry } = await import("@deftai/directive-core/dist/value/readback.js");
2349
2360
  return mainEntry;
2350
2361
  }
2362
+ case "product-signal": {
2363
+ const { mainEntry } = await import("@deftai/directive-core/dist/product-signal/submit.js");
2364
+ return mainEntry;
2365
+ }
2351
2366
  default:
2352
2367
  throw new Error(`unknown core verb: ${verb}`);
2353
2368
  }
@@ -2558,6 +2573,7 @@ export async function dispatch(argv, io = defaultIo()) {
2558
2573
  const triageSubcommand = verb !== undefined ? TRIAGE_ACTION_ALIAS_SUBCOMMANDS[verb] : undefined;
2559
2574
  const policySubcommand = verb !== undefined ? POLICY_ACTION_ALIAS_SUBCOMMANDS[verb] : undefined;
2560
2575
  const planSequenceSubcommand = verb !== undefined ? PLAN_SEQUENCE_ALIAS_SUBCOMMANDS[verb] : undefined;
2576
+ const productSignalSubcommand = verb !== undefined ? PRODUCT_SIGNAL_ALIAS_SUBCOMMANDS[verb] : undefined;
2561
2577
  const handlerArgv = canonical === "framework-commands" && verb !== undefined && verb !== canonical
2562
2578
  ? [verb, ...rest]
2563
2579
  : triageSubcommand !== undefined && canonical === "triage-actions"
@@ -2566,7 +2582,9 @@ export async function dispatch(argv, io = defaultIo()) {
2566
2582
  ? [policySubcommand, ...rest]
2567
2583
  : planSequenceSubcommand !== undefined && canonical === "plan-sequence"
2568
2584
  ? [planSequenceSubcommand, ...rest]
2569
- : rest;
2585
+ : productSignalSubcommand !== undefined && canonical === "product-signal"
2586
+ ? [productSignalSubcommand, ...rest]
2587
+ : rest;
2570
2588
  return await invokeHandler(handler, handlerArgv);
2571
2589
  }
2572
2590
  catch (err) {
@@ -57,14 +57,55 @@ export function parseArgs(argv) {
57
57
  return { error: "--event is required" };
58
58
  return parsed;
59
59
  }
60
+ const UTF8_BOM = "\uFEFF";
61
+ const APPLY_PATCH_BEGIN_MARKER = "*** Begin Patch";
62
+ /** Single-file Add/Update only — other *** … File: ops must fail closed (#2738 Greptile). */
63
+ const APPLY_PATCH_MUTATION_LINE_RE = /^\*\*\* (Add File|Update File|Delete File|Move File|Rename File): (.+)$/gm;
64
+ function stripUtf8Bom(raw) {
65
+ return raw.startsWith(UTF8_BOM) ? raw.slice(UTF8_BOM.length) : raw;
66
+ }
67
+ function trySynthesizeFreeFormApplyPatch(normalized) {
68
+ if (!normalized.includes(APPLY_PATCH_BEGIN_MARKER))
69
+ return null;
70
+ const mutations = [];
71
+ for (const match of normalized.matchAll(APPLY_PATCH_MUTATION_LINE_RE)) {
72
+ const op = match[1];
73
+ const path = match[2]?.trim();
74
+ if (op === undefined || !path)
75
+ continue;
76
+ mutations.push({ op, path });
77
+ }
78
+ if (mutations.length !== 1)
79
+ return null;
80
+ const sole = mutations[0];
81
+ if (sole === undefined || (sole.op !== "Add File" && sole.op !== "Update File"))
82
+ return null;
83
+ return {
84
+ payload: {
85
+ tool_name: "ApplyPatch",
86
+ tool_input: {
87
+ path: sole.path,
88
+ patch: normalized,
89
+ },
90
+ },
91
+ context: {},
92
+ };
93
+ }
60
94
  export function parsePayload(raw) {
61
95
  if (raw.trim().length === 0) {
62
96
  return { payload: {}, context: { stdinEmpty: true } };
63
97
  }
98
+ const normalized = stripUtf8Bom(raw);
99
+ if (normalized.trim().length === 0) {
100
+ return { payload: {}, context: { stdinEmpty: true } };
101
+ }
64
102
  try {
65
- return { payload: JSON.parse(raw), context: {} };
103
+ return { payload: JSON.parse(normalized), context: {} };
66
104
  }
67
105
  catch {
106
+ const synthesized = trySynthesizeFreeFormApplyPatch(normalized);
107
+ if (synthesized !== null)
108
+ return synthesized;
68
109
  // tool.before is installed only on direct-write matchers, so an unreadable
69
110
  // payload becomes a missing-tool denial rather than a fail-open crash.
70
111
  return { payload: {}, context: { parseFailed: true } };
@@ -103,6 +144,11 @@ export function run(argv, seams = {}) {
103
144
  }
104
145
  if (decision.code === "session-start-degraded")
105
146
  writeErr(`${decision.message}\n`);
147
+ if (decision.code === "session-compact-rearm" ||
148
+ decision.code === "session-compact-rearm-degraded" ||
149
+ decision.code === "session-compact-noop") {
150
+ writeErr(`${decision.message}\n`);
151
+ }
106
152
  return 0;
107
153
  }
108
154
  if (process.argv[1] !== undefined && fileURLToPath(import.meta.url) === process.argv[1]) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deftai/directive",
3
- "version": "0.79.4",
3
+ "version": "0.81.0",
4
4
  "description": "Directive CLI — npm install path for the Deft Directive framework.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -31,8 +31,8 @@
31
31
  "provenance": true
32
32
  },
33
33
  "dependencies": {
34
- "@deftai/directive-core": "^0.79.4",
35
- "@deftai/directive-content": "^0.79.4"
34
+ "@deftai/directive-core": "^0.81.0",
35
+ "@deftai/directive-content": "^0.81.0"
36
36
  },
37
37
  "scripts": {
38
38
  "build": "tsc -b"