opencode-dev-framework 1.12.0 → 1.13.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/README.md CHANGED
@@ -162,7 +162,8 @@ semantics, block budgeting, `protect_off` scope, and all eight
162
162
  synthetic continuation, bounded by `gate.max_blocks` (fewer when
163
163
  the failure repeats with no new edits — the gate stands down early on
164
164
  zero progress). On DSH the same verdict runs pre-terminal in the same
165
- turn — no re-prompt round-trip.
165
+ turn — no re-prompt round-trip. Scratch and generated files can skip
166
+ evaluation via `gate.ignore` or `/df-ignore`.
166
167
  - **Verified goals (`/df-goal`).** Wraps a task in native `/goal` with a
167
168
  verification contract the reviewer weighs as evidence.
168
169
  - **Pre-flight gate (optional).** Denies edits until the agent records
@@ -267,13 +268,14 @@ How each layer is enforced, and what it honestly cannot do:
267
268
  | `/df-help` | Instant modal: lists the dev-framework commands. |
268
269
  | `/df-profile` | Instant modal picker (or `/df-profile <name>`): switches profile now, written to config. |
269
270
  | `/df-verify` | Runs the verification suite manually; pass/fail summary in a modal. |
271
+ | `/df-ignore` | Server-side command: skips globs for this session (`-s` stores to `gate.ignore`, `-l` lists, `-r` removes). |
270
272
  | `/df-init` | Server-side command: scaffolds templates, writes the detected config, trial-runs it, hands the brief to the agent. |
271
273
  | `/df-update` | Server-side command: diffs installed templates against shipped, refresh/add each with user approval (detection only, never writes). Drift is also mentioned once at session startup. |
272
274
  | `/df-goal <objective>` | Server-side command: starts a **verified** native goal (requires native `/goal`, a blocking profile, and at least one real check). |
273
275
 
274
276
  The TUI commands open instantly and never feed the LLM; `/df-init`,
275
277
  `/df-update`, and `/df-goal` are server-side and drive the session. Same
276
- eight names on DSH, where they run as host commands returning text instead
278
+ nine names on DSH, where they run as host commands returning text instead
277
279
  of modals. Full reference:
278
280
  [`docs/user/commands.md`](docs/user/commands.md).
279
281
 
@@ -20,7 +20,7 @@ import { randomUUID } from "node:crypto";
20
20
  import { readFile, stat } from "node:fs/promises";
21
21
  import { join } from "node:path";
22
22
  import { createBlockStore, createStuckSnapshotStore } from "../../core/block-store.js";
23
- import { changeProfile, verifyGate } from "../../core/commands.js";
23
+ import { changeProfile, dfIgnore, parseIgnoreArgs, verifyGate, } from "../../core/commands.js";
24
24
  import { CONFIG_FILE_PRECEDENCE, clearConfigCache, loadConfig } from "../../core/config.js";
25
25
  import { renderHelp, renderRuntimeStatus, renderStatus } from "../../core/format-status.js";
26
26
  import { createChangedFileTracker } from "../../core/gate.js";
@@ -668,6 +668,7 @@ export function apply(ctx) {
668
668
  stuckSnapshots: createStuckSnapshotStore(undefined),
669
669
  lintLimiter: createLintLimiter(),
670
670
  passCache: createPassCache(),
671
+ sessionIgnores: [],
671
672
  lastConfigCheck: 0,
672
673
  lastIdleHandled: new Map(),
673
674
  // Probed once at mount so `df-status` reads degraded mounts as
@@ -1419,6 +1420,37 @@ export function apply(ctx) {
1419
1420
  }
1420
1421
  },
1421
1422
  });
1423
+ // Ignore hotlist: session-scoped gate skips with an explicit path to
1424
+ // permanence. Bare patterns add for this session; -s stores to
1425
+ // gate.ignore; -l lists both sources; -r drops session patterns.
1426
+ ctx.commands.register({
1427
+ name: "df-ignore",
1428
+ description: "Add glob patterns to the completion-gate ignore hotlist (session-scoped; -s stores to gate.ignore, -l lists, -r removes).",
1429
+ input: {
1430
+ hint: "[patterns] [-s|--store] [-l|--list] [-r|--remove ...] (removals are session-only)",
1431
+ },
1432
+ handler: async (invocation) => {
1433
+ try {
1434
+ await reloadConfigIfChanged(state);
1435
+ let parsed;
1436
+ try {
1437
+ parsed = parseIgnoreArgs(invocation.rawInput);
1438
+ }
1439
+ catch (error) {
1440
+ return { kind: "error", text: error.message };
1441
+ }
1442
+ const result = await dfIgnore(state.directory, state.sessionIgnores, state.config, parsed);
1443
+ if (parsed.store) {
1444
+ clearConfigCache();
1445
+ state.config = loadConfig(state.directory);
1446
+ }
1447
+ return { kind: "success", text: result.message };
1448
+ }
1449
+ catch (error) {
1450
+ return { kind: "error", text: `df-ignore failed: ${error?.message ?? error}` };
1451
+ }
1452
+ },
1453
+ });
1422
1454
  // On-demand gate: same full completion contract as the turn-stopping gate,
1423
1455
  // run when asked instead of at the boundary. Fills the slot the missing
1424
1456
  // TUI `/df-verify` leaves on DSH.
@@ -1428,7 +1460,7 @@ export function apply(ctx) {
1428
1460
  handler: async () => {
1429
1461
  try {
1430
1462
  await reloadConfigIfChanged(state);
1431
- const result = await verifyGate(run, state.directory, state.config, state.tracker.getChangedFiles());
1463
+ const result = await verifyGate(run, state.directory, state.config, state.tracker.getChangedFiles(), state.sessionIgnores);
1432
1464
  return { kind: "success", text: result.summary };
1433
1465
  }
1434
1466
  catch (error) {
@@ -1607,7 +1639,7 @@ export function apply(ctx) {
1607
1639
  // verify scopes `changed` steps to real edits (mirror of opencode).
1608
1640
  const cfg = holder?.config ?? loadConfig(targetDir);
1609
1641
  const changed = holder !== null ? holder.tracker.getChangedFiles() : [];
1610
- const { summary } = await verifyGate(run, targetDir, cfg, changed);
1642
+ const { summary } = await verifyGate(run, targetDir, cfg, changed, holder?.sessionIgnores ?? []);
1611
1643
  return summary;
1612
1644
  },
1613
1645
  });
@@ -1653,6 +1685,74 @@ export function apply(ctx) {
1653
1685
  return `${message} Change applied immediately.`;
1654
1686
  },
1655
1687
  });
1688
+ registerDshTool(ctx, state, {
1689
+ name: "dev_framework_ignore",
1690
+ description: "Add glob patterns to the completion-gate ignore hotlist (session-scoped; store:true persists to gate.ignore, list:true shows both sources, remove:[...] drops session patterns only, never stored config).",
1691
+ parameters: {
1692
+ type: "object",
1693
+ properties: {
1694
+ patterns: {
1695
+ type: "array",
1696
+ items: { type: "string" },
1697
+ description: "Glob patterns to ignore (e.g. ['scratch/**', '*.local'])",
1698
+ },
1699
+ store: {
1700
+ type: "boolean",
1701
+ description: "Persist to gate.ignore in the config file (default false: session only)",
1702
+ },
1703
+ list: {
1704
+ type: "boolean",
1705
+ description: "List session and stored patterns instead of changing anything",
1706
+ },
1707
+ remove: {
1708
+ type: "array",
1709
+ items: { type: "string" },
1710
+ description: "Session patterns to drop",
1711
+ },
1712
+ directory: {
1713
+ type: "string",
1714
+ description: "Project directory (defaults to current project)",
1715
+ },
1716
+ },
1717
+ additionalProperties: false,
1718
+ },
1719
+ execute: async (input) => {
1720
+ const args = input;
1721
+ const targetDir = args.directory ?? state.directory;
1722
+ const liveState = getActiveState();
1723
+ const live = liveState !== null && liveState.directory === targetDir ? liveState : null;
1724
+ const own = state.directory === targetDir ? state : null;
1725
+ const holder = live ?? own;
1726
+ const parsed = {
1727
+ patterns: args.patterns ?? [],
1728
+ store: args.store ?? false,
1729
+ list: args.list ?? false,
1730
+ remove: args.remove ?? [],
1731
+ };
1732
+ if (holder === null && parsed.patterns.length > 0 && !parsed.store) {
1733
+ return (`No live session for ${targetDir}: session ignores have nowhere to live. ` +
1734
+ `Re-run with store:true to persist to gate.ignore instead.`);
1735
+ }
1736
+ const sessionIgnores = holder?.sessionIgnores ?? [];
1737
+ const cfg = holder?.config ?? loadConfig(targetDir);
1738
+ const result = await dfIgnore(targetDir, sessionIgnores, cfg, parsed);
1739
+ if (parsed.store) {
1740
+ clearConfigCache();
1741
+ const newConfig = loadConfig(targetDir);
1742
+ if (state.directory === targetDir) {
1743
+ state.config = newConfig;
1744
+ }
1745
+ if (live !== null && live !== state) {
1746
+ live.config = newConfig;
1747
+ }
1748
+ }
1749
+ let message = result.message;
1750
+ if (holder === null && result.added.length > 0) {
1751
+ message += ` (No live session for ${targetDir}: kept in config only.)`;
1752
+ }
1753
+ return message;
1754
+ },
1755
+ });
1656
1756
  registerDshTool(ctx, state, {
1657
1757
  name: "dev_framework_status",
1658
1758
  description: "Show the current opencode-dev-framework state for the project: active profile, guardrails, completion gate, on-edit behavior, tracked changed files, and block counts.",
@@ -163,6 +163,7 @@ const plugin = Plugin.define({
163
163
  configMtime,
164
164
  lintLimiter: createLintLimiter(),
165
165
  passCache: createPassCache(),
166
+ sessionIgnores: [],
166
167
  lastConfigCheck: 0,
167
168
  lastIdleHandled: new Map(),
168
169
  };
@@ -685,6 +686,80 @@ const plugin = Plugin.define({
685
686
  return { content: `${message} Change applied immediately.` };
686
687
  },
687
688
  });
689
+ editor.add({
690
+ name: "dev_framework_ignore",
691
+ description: "Add glob patterns to the completion-gate ignore hotlist (e.g. scratch notes, generated output) so the gate skips them. Session-scoped by default; pass store:true to persist to gate.ignore in the config file. Use list:true to show session and stored patterns, or remove:[...] to drop session patterns (removals never touch stored config).",
692
+ input: {
693
+ type: "object",
694
+ properties: {
695
+ patterns: {
696
+ type: "array",
697
+ items: { type: "string" },
698
+ description: "Glob patterns to ignore (e.g. ['scratch/**', '*.local'])",
699
+ },
700
+ store: {
701
+ type: "boolean",
702
+ description: "Persist to gate.ignore in the config file (default false: session only)",
703
+ },
704
+ list: {
705
+ type: "boolean",
706
+ description: "List session and stored patterns instead of changing anything",
707
+ },
708
+ remove: {
709
+ type: "array",
710
+ items: { type: "string" },
711
+ description: "Session patterns to drop",
712
+ },
713
+ directory: {
714
+ type: "string",
715
+ description: "Project directory (defaults to current project)",
716
+ },
717
+ },
718
+ additionalProperties: false,
719
+ },
720
+ async execute(input) {
721
+ const { dfIgnore } = await import("../../core/commands.js");
722
+ const { clearConfigCache: ccc, loadConfig: lc } = await import("../../core/config.js");
723
+ const { loadConstitution: lc2 } = await import("../../core/rules.js");
724
+ const args = input;
725
+ const targetDir = args.directory ?? directory;
726
+ const liveState = getActiveState();
727
+ const live = liveState && liveState.directory === targetDir ? liveState : null;
728
+ const own = state.directory === targetDir ? state : null;
729
+ const holder = live ?? own;
730
+ if (holder === null && (args.patterns?.length ?? 0) > 0 && !args.store) {
731
+ return {
732
+ content: `No live session for ${targetDir}: session ignores have nowhere to live. Re-run with store:true to persist to gate.ignore instead.`,
733
+ };
734
+ }
735
+ const sessionIgnores = holder?.sessionIgnores ?? [];
736
+ const cfg = holder?.config ?? lc(targetDir);
737
+ const result = await dfIgnore(targetDir, sessionIgnores, cfg, {
738
+ patterns: args.patterns ?? [],
739
+ store: args.store ?? false,
740
+ list: args.list ?? false,
741
+ remove: args.remove ?? [],
742
+ });
743
+ if (args.store) {
744
+ ccc();
745
+ const newConfig = lc(targetDir);
746
+ const { constitution: newConstitution } = await lc2(newConfig, targetDir);
747
+ if (state.directory === targetDir) {
748
+ state.config = newConfig;
749
+ state.constitution = newConstitution;
750
+ }
751
+ if (live && live !== state && live.directory === targetDir) {
752
+ live.config = newConfig;
753
+ live.constitution = newConstitution;
754
+ }
755
+ }
756
+ let content = result.message;
757
+ if (holder === null && result.added.length > 0) {
758
+ content += ` (No live session for ${targetDir}: kept in config only.)`;
759
+ }
760
+ return { content };
761
+ },
762
+ });
688
763
  editor.add({
689
764
  name: "dev_framework_verify",
690
765
  description: "Run the full opencode-dev-framework completion contract now (typecheck, tests, changed-file lint, peer-review state) and return the summary. The first line is DEV_FRAMEWORK_VERDICT: PASS or FAIL, reporting the raw inspection outcome. Use for a mid-session gate check without waiting for session idle; unlike the idle gate this never re-prompts, it only reports, and it never mutates retry state.",
@@ -710,7 +785,7 @@ const plugin = Plugin.define({
710
785
  // mid-session verify scopes `changed` steps to real edits.
711
786
  const cfg = holder?.config ?? loadConfig(targetDir);
712
787
  const changed = holder ? holder.tracker.getChangedFiles() : [];
713
- const { summary } = await verifyGate(state.run, targetDir, cfg, changed);
788
+ const { summary } = await verifyGate(state.run, targetDir, cfg, changed, holder?.sessionIgnores ?? []);
714
789
  return { content: summary };
715
790
  },
716
791
  });
@@ -34,4 +34,39 @@ export interface VerifyResult {
34
34
  * `changedFiles` is normally the server's live tracker snapshot (empty for
35
35
  * TUI callers); Git-discovered files are unioned in either way.
36
36
  */
37
- export declare function verifyGate(run: RunCommand, directory: string, config?: ResolvedConfig, changedFiles?: string[]): Promise<VerifyResult>;
37
+ export declare function verifyGate(run: RunCommand, directory: string, config?: ResolvedConfig, changedFiles?: string[], sessionIgnores?: readonly string[]): Promise<VerifyResult>;
38
+ /** Parsed `/df-ignore` arguments. `patterns` add to the session hotlist,
39
+ * `remove` drops from it, `store` persists, `list` reports. Bare
40
+ * invocation (everything empty) lists. */
41
+ export interface DfIgnoreArgs {
42
+ patterns: string[];
43
+ store: boolean;
44
+ list: boolean;
45
+ remove: string[];
46
+ }
47
+ /**
48
+ * Parse `/df-ignore` raw input (the DSH slash form). Flags anywhere:
49
+ * `-s|--store`, `-l|--list`, `-r|--remove` (following non-flag tokens are
50
+ * removals), `--` ends flag parsing. Quote-aware via `splitCommand`, so
51
+ * patterns with spaces quote (`"my dir/**"`). Throws a readable error on
52
+ * unknown flags instead of silently ignoring them.
53
+ */
54
+ export declare function parseIgnoreArgs(rawInput: string): DfIgnoreArgs;
55
+ export interface DfIgnoreResult {
56
+ message: string;
57
+ added: string[];
58
+ alreadyPresent: string[];
59
+ removed: string[];
60
+ notFound: string[];
61
+ stored: string[];
62
+ sessionIgnores: string[];
63
+ configIgnores: string[];
64
+ }
65
+ /**
66
+ * Run the `/df-ignore` hotlist command: session add/remove in place (the
67
+ * caller's live array, so the shared glob-matcher cache stays hot),
68
+ * optional `-s` persistence to the config file, `-l`/bare listing of both
69
+ * sources. Storing writes the file but does not reload it — the caller
70
+ * refreshes its in-memory config the way `/df-profile` does.
71
+ */
72
+ export declare function dfIgnore(directory: string, sessionIgnores: string[], config: ResolvedConfig, args: DfIgnoreArgs): Promise<DfIgnoreResult>;
@@ -1,7 +1,8 @@
1
1
  import { join } from "node:path";
2
+ import { splitCommand } from "./command-utils.js";
2
3
  import { existingConfigPath, loadConfig } from "./config.js";
3
4
  import { inspectCompletion } from "./harness.js";
4
- import { setProfileInFile } from "./installer.js";
5
+ import { setProfileInFile, storeGateIgnores } from "./installer.js";
5
6
  import { createLintLimiter } from "./lint.js";
6
7
  /**
7
8
  * Change the project profile by editing the config file on disk. The server
@@ -29,13 +30,14 @@ export async function changeProfile(directory, profile) {
29
30
  * `changedFiles` is normally the server's live tracker snapshot (empty for
30
31
  * TUI callers); Git-discovered files are unioned in either way.
31
32
  */
32
- export async function verifyGate(run, directory, config, changedFiles = []) {
33
+ export async function verifyGate(run, directory, config, changedFiles = [], sessionIgnores = []) {
33
34
  const cfg = config ?? loadConfig(directory);
34
35
  const inspection = await inspectCompletion({
35
36
  run,
36
37
  config: cfg,
37
38
  directory,
38
39
  trackerFiles: changedFiles,
40
+ sessionIgnores,
39
41
  // Fresh limiter per manual verify (bounds its own lint burst); no pass
40
42
  // cache — an explicit verify always inspects the live tree.
41
43
  lintLimiter: createLintLimiter(),
@@ -44,3 +46,121 @@ export async function verifyGate(run, directory, config, changedFiles = []) {
44
46
  const summary = `DEV_FRAMEWORK_VERDICT: ${verdict}\n${inspection.summary}`;
45
47
  return { report: inspection.report, inspection, verdict, summary };
46
48
  }
49
+ /**
50
+ * Parse `/df-ignore` raw input (the DSH slash form). Flags anywhere:
51
+ * `-s|--store`, `-l|--list`, `-r|--remove` (following non-flag tokens are
52
+ * removals), `--` ends flag parsing. Quote-aware via `splitCommand`, so
53
+ * patterns with spaces quote (`"my dir/**"`). Throws a readable error on
54
+ * unknown flags instead of silently ignoring them.
55
+ */
56
+ export function parseIgnoreArgs(rawInput) {
57
+ const args = { patterns: [], store: false, list: false, remove: [] };
58
+ let toRemove = false;
59
+ let flagsOpen = true;
60
+ for (const token of splitCommand(rawInput)) {
61
+ if (flagsOpen && !toRemove && (token === "-s" || token === "--store")) {
62
+ args.store = true;
63
+ continue;
64
+ }
65
+ if (flagsOpen && !toRemove && (token === "-l" || token === "--list")) {
66
+ args.list = true;
67
+ continue;
68
+ }
69
+ if (flagsOpen && (token === "-r" || token === "--remove")) {
70
+ toRemove = true;
71
+ continue;
72
+ }
73
+ if (flagsOpen && token === "--") {
74
+ flagsOpen = false;
75
+ continue;
76
+ }
77
+ if (flagsOpen && !toRemove && token.startsWith("-") && token !== "-") {
78
+ throw new Error(`Unknown /df-ignore flag "${token}". Flags: -s|--store, -l|--list, -r|--remove, -- to end flag parsing.`);
79
+ }
80
+ (toRemove ? args.remove : args.patterns).push(token);
81
+ }
82
+ return args;
83
+ }
84
+ /**
85
+ * Run the `/df-ignore` hotlist command: session add/remove in place (the
86
+ * caller's live array, so the shared glob-matcher cache stays hot),
87
+ * optional `-s` persistence to the config file, `-l`/bare listing of both
88
+ * sources. Storing writes the file but does not reload it — the caller
89
+ * refreshes its in-memory config the way `/df-profile` does.
90
+ */
91
+ export async function dfIgnore(directory, sessionIgnores, config, args) {
92
+ const added = [];
93
+ const alreadyPresent = [];
94
+ const removed = [];
95
+ const notFound = [];
96
+ let stored = [];
97
+ for (const pattern of args.remove) {
98
+ const index = sessionIgnores.indexOf(pattern);
99
+ if (index !== -1) {
100
+ sessionIgnores.splice(index, 1);
101
+ removed.push(pattern);
102
+ }
103
+ else {
104
+ notFound.push(pattern);
105
+ }
106
+ }
107
+ for (const pattern of args.patterns) {
108
+ if (sessionIgnores.includes(pattern)) {
109
+ alreadyPresent.push(pattern);
110
+ }
111
+ else {
112
+ sessionIgnores.push(pattern);
113
+ added.push(pattern);
114
+ }
115
+ }
116
+ const lines = [];
117
+ if (added.length > 0) {
118
+ lines.push(`Ignored for this session: ${added.join(", ")}.`);
119
+ }
120
+ if (alreadyPresent.length > 0) {
121
+ lines.push(`Already ignored this session: ${alreadyPresent.join(", ")}.`);
122
+ }
123
+ if (removed.length > 0) {
124
+ lines.push(`Removed from session ignores: ${removed.join(", ")}.`);
125
+ }
126
+ if (notFound.length > 0) {
127
+ lines.push(`Not in session ignores: ${notFound.join(", ")}.`);
128
+ }
129
+ if (args.store) {
130
+ const toStore = args.patterns.length > 0 ? args.patterns : [...sessionIgnores];
131
+ if (toStore.length > 0) {
132
+ const configPath = existingConfigPath(directory) ?? join(directory, ".dev-framework.yml");
133
+ stored = await storeGateIgnores(configPath, toStore);
134
+ }
135
+ else {
136
+ lines.push(`Nothing to store.`);
137
+ }
138
+ }
139
+ // Post-store snapshot: `stored` holds exactly what the file gained, so
140
+ // the list line reflects the disk state the adapters reload right after.
141
+ const configIgnores = [...config.gate.ignore, ...stored];
142
+ if (args.store && stored.length > 0) {
143
+ lines.push(`Stored permanently (gate.ignore): ${stored.join(", ")}.`);
144
+ }
145
+ else if (args.store && lines[lines.length - 1] !== `Nothing to store.`) {
146
+ lines.push(`Nothing new to store — already in gate.ignore.`);
147
+ }
148
+ if (args.list || lines.length === 0) {
149
+ const session = sessionIgnores.length > 0 ? sessionIgnores.join(", ") : "(none)";
150
+ const storedList = configIgnores.length > 0 ? configIgnores.join(", ") : "(none)";
151
+ lines.push(`Session ignores: ${session}. Config gate.ignore: ${storedList}.`);
152
+ }
153
+ else if (!args.store) {
154
+ lines.push(`Session-scoped only; re-run with -s to store permanently.`);
155
+ }
156
+ return {
157
+ message: lines.join(" "),
158
+ added,
159
+ alreadyPresent,
160
+ removed,
161
+ notFound,
162
+ stored,
163
+ sessionIgnores: [...sessionIgnores],
164
+ configIgnores,
165
+ };
166
+ }
@@ -90,6 +90,7 @@ const configSchema = z.object({
90
90
  require_review: z.boolean().optional(),
91
91
  timeout: z.number().positive().optional(),
92
92
  max_blocks: z.number().int().positive().optional(),
93
+ ignore: z.array(z.string()).optional(),
93
94
  acceptance: acceptanceListSchema,
94
95
  })
95
96
  .optional(),
@@ -275,6 +276,9 @@ export function mapFlatConfig(flat) {
275
276
  case "gate_max_blocks":
276
277
  gate.max_blocks = toNumber(value);
277
278
  break;
279
+ case "gate_ignore":
280
+ gate.ignore = splitGlobs(value);
281
+ break;
278
282
  case "protect_off":
279
283
  config.protect_off = toBoolean(value);
280
284
  break;
@@ -362,6 +366,7 @@ export function resolveConfig(raw, configPath) {
362
366
  require_review: raw.gate?.require_review ?? profile !== "off",
363
367
  timeout: raw.gate?.timeout,
364
368
  max_blocks: raw.gate?.max_blocks ?? 3,
369
+ ignore: raw.gate?.ignore ?? [],
365
370
  acceptance: raw.gate?.acceptance ?? [],
366
371
  },
367
372
  on_edit: {
@@ -499,6 +504,7 @@ const FLAT_ONLY_KEYS = new Set([
499
504
  "gate_require_review",
500
505
  "gate_timeout",
501
506
  "gate_max_blocks",
507
+ "gate_ignore",
502
508
  ]);
503
509
  function isFlatDottedKey(key) {
504
510
  return key.startsWith("format.") || key.startsWith("lint.");
@@ -139,6 +139,7 @@ export function renderHelp() {
139
139
  lines.push("/df-status Show the current dev-framework state");
140
140
  lines.push("/df-profile Change the profile to off, advisory, standard, or strict");
141
141
  lines.push("/df-verify Run the completion gate manually");
142
+ lines.push("/df-ignore Ignore globs for this session (-s stores, -l lists, -r removes)");
142
143
  lines.push("/df-goal Start a verified native goal (verification contract + native /goal)");
143
144
  lines.push("/df-init Set up this project (scaffold, detected config, trial-run, brief)");
144
145
  lines.push("/df-update Check installed templates against shipped (refresh/add, approved per file)");
@@ -96,6 +96,24 @@ export declare function parseGitStatusPorcelain(stdout: string): string[];
96
96
  export declare function gitChangedFiles(run: RunCommand, cwd: string): Promise<string[]>;
97
97
  /** Union of tracker and git changed files, sorted and deduped. */
98
98
  export declare function mergeChangedFiles(trackerFiles: string[], gitFiles: string[]): string[];
99
+ /**
100
+ * Match a file path against the gate-ignore patterns: permanent config
101
+ * (`gate.ignore`) plus this session's `/df-ignore` additions. Returns the
102
+ * matching pattern, or undefined. Mirrors `matchExclude` semantics — paths
103
+ * resolve against the project directory, and patterns without a slash also
104
+ * match basenames at any depth. Matchers compile once per pattern array via
105
+ * the shared `compileGlobMatchers` cache, so callers pass the live arrays
106
+ * (never a spread copy) to keep the cache hot.
107
+ */
108
+ export declare function matchGateIgnore(config: ResolvedConfig, sessionIgnores: readonly string[], filePath: string, directory?: string): string | undefined;
109
+ /**
110
+ * Drop gate-ignored files from a changed-file list. Applied once at the
111
+ * `inspectCompletion` merge point so ignored files leave the whole gate:
112
+ * command steps, review coverage, and the pass-cache fingerprint all read
113
+ * the filtered list. Session additions and permanent config filter
114
+ * identically — permanence differs, behavior does not.
115
+ */
116
+ export declare function filterGateIgnored(config: ResolvedConfig, sessionIgnores: readonly string[], files: string[], directory?: string): string[];
99
117
  /**
100
118
  * Decide whether a pre-flight config blocks a tool call. Returns the denial
101
119
  * reason, or null when the call is allowed. The artifact path itself is
@@ -133,6 +151,8 @@ export interface CompletionDeps {
133
151
  /** Last-blocked-evaluation snapshots for no-progress early stand-down. */
134
152
  stuckSnapshots: StuckSnapshotStore;
135
153
  log: LogFn;
154
+ /** This session's `/df-ignore` additions (live `HookState.sessionIgnores`). */
155
+ sessionIgnores?: readonly string[];
136
156
  /** Shared limiter bounding concurrent linter subprocesses. */
137
157
  lintLimiter?: LintLimiter;
138
158
  /** Session pass cache; skips redundant gate suites across idle boundaries. */
@@ -160,6 +180,12 @@ export interface InspectionDeps {
160
180
  directory: string;
161
181
  /** Read-only snapshot of tracker files; never mutated. */
162
182
  trackerFiles: string[];
183
+ /**
184
+ * This session's `/df-ignore` additions (live `HookState.sessionIgnores`).
185
+ * Unioned with config `gate.ignore` at the merge point; absent reads as
186
+ * no session additions.
187
+ */
188
+ sessionIgnores?: readonly string[];
163
189
  /** Shared limiter bounding concurrent linter subprocesses. */
164
190
  lintLimiter?: LintLimiter;
165
191
  /**
@@ -17,7 +17,8 @@
17
17
  * synthetic continuation) and the `session.idle` event net (re-prompt).
18
18
  */
19
19
  import { readFile, stat } from "node:fs/promises";
20
- import { isAbsolute, join, normalize, relative } from "node:path";
20
+ import { basename, isAbsolute, join, normalize, relative } from "node:path";
21
+ import { compileGlobMatchers } from "./command-utils.js";
21
22
  import { runGate, summarizeGate } from "./gate.js";
22
23
  import { LEGACY_PREFLIGHT_ARTIFACT_REL, LEGACY_REVIEW_ARTIFACT_REL, PREFLIGHT_ARTIFACT_REL, REVIEW_ARTIFACT_REL, REVIEW_RELS, RUNTIME_STATUS_RELS, } from "./paths.js";
23
24
  import { assessReviewContent, findUncoveredFiles, normalizeReviewPath, staleReviewMessage, templateReviewMessage, thinReviewMessage, } from "./review.js";
@@ -228,6 +229,48 @@ export async function gitChangedFiles(run, cwd) {
228
229
  export function mergeChangedFiles(trackerFiles, gitFiles) {
229
230
  return [...new Set([...trackerFiles, ...gitFiles])].sort();
230
231
  }
232
+ /**
233
+ * Match a file path against the gate-ignore patterns: permanent config
234
+ * (`gate.ignore`) plus this session's `/df-ignore` additions. Returns the
235
+ * matching pattern, or undefined. Mirrors `matchExclude` semantics — paths
236
+ * resolve against the project directory, and patterns without a slash also
237
+ * match basenames at any depth. Matchers compile once per pattern array via
238
+ * the shared `compileGlobMatchers` cache, so callers pass the live arrays
239
+ * (never a spread copy) to keep the cache hot.
240
+ */
241
+ export function matchGateIgnore(config, sessionIgnores, filePath, directory) {
242
+ let candidate = filePath;
243
+ if (directory !== undefined && isAbsolute(filePath)) {
244
+ candidate = relative(directory, filePath);
245
+ }
246
+ candidate = candidate.replace(/^\.\//, "");
247
+ const name = basename(candidate);
248
+ const sources = [config.gate.ignore, sessionIgnores];
249
+ for (const patterns of sources) {
250
+ for (const { pattern, match } of compileGlobMatchers(patterns)) {
251
+ if (match(candidate)) {
252
+ return pattern;
253
+ }
254
+ if (!pattern.includes("/") && match(name)) {
255
+ return pattern;
256
+ }
257
+ }
258
+ }
259
+ return undefined;
260
+ }
261
+ /**
262
+ * Drop gate-ignored files from a changed-file list. Applied once at the
263
+ * `inspectCompletion` merge point so ignored files leave the whole gate:
264
+ * command steps, review coverage, and the pass-cache fingerprint all read
265
+ * the filtered list. Session additions and permanent config filter
266
+ * identically — permanence differs, behavior does not.
267
+ */
268
+ export function filterGateIgnored(config, sessionIgnores, files, directory) {
269
+ if (config.gate.ignore.length === 0 && sessionIgnores.length === 0) {
270
+ return files;
271
+ }
272
+ return files.filter((f) => matchGateIgnore(config, sessionIgnores, f, directory) === undefined);
273
+ }
231
274
  /**
232
275
  * Decide whether a pre-flight config blocks a tool call. Returns the denial
233
276
  * reason, or null when the call is allowed. The artifact path itself is
@@ -379,7 +422,9 @@ export async function inspectCompletion(deps) {
379
422
  return disabled;
380
423
  }
381
424
  const gitFiles = await gitChangedFiles(run, directory);
382
- const changedFiles = mergeChangedFiles(trackerFiles, gitFiles);
425
+ // Gate-ignore hotlist: ignored files leave the whole gate — steps, review
426
+ // coverage, and the fingerprint below all read this filtered list.
427
+ const changedFiles = filterGateIgnored(config, deps.sessionIgnores ?? [], mergeChangedFiles(trackerFiles, gitFiles), directory);
383
428
  if (config.gate.skip_unchanged && changedFiles.length === 0) {
384
429
  return {
385
430
  ...disabled,
@@ -496,6 +541,7 @@ export async function evaluateCompletion(deps) {
496
541
  config,
497
542
  directory,
498
543
  trackerFiles: tracker.getChangedFiles(),
544
+ sessionIgnores: deps.sessionIgnores ?? [],
499
545
  lintLimiter: deps.lintLimiter,
500
546
  passCache: deps.passCache,
501
547
  baseline: deps.baseline,
@@ -150,3 +150,15 @@ export declare function formatWizardBrief(brief: WizardBrief): string[];
150
150
  * instead of re-serializing the YAML so user comments and formatting survive.
151
151
  */
152
152
  export declare function setProfileInFile(configPath: string, profile: Profile): Promise<void>;
153
+ /**
154
+ * Persist gate-ignore patterns to a config file, shape-aware: flat files
155
+ * grow the `gate_ignore:` line, native files grow the `gate: ignore:`
156
+ * sequence, scalar-only files (e.g. just `profile:`) gain a flat line,
157
+ * and JSON files (native-only by design) grow `gate.ignore`. A missing
158
+ * file is created flat. `parseDocument` round-trips the YAML so user
159
+ * comments and formatting survive outside the edited node. Returns the
160
+ * patterns newly stored (already-present ones are skipped, never
161
+ * duplicated). Throws a readable error when the file exists but the
162
+ * `gate:` value is not a mapping.
163
+ */
164
+ export declare function storeGateIgnores(configPath: string, patterns: string[]): Promise<string[]>;
@@ -2,6 +2,7 @@ import { promises as fs } from "node:fs";
2
2
  import { dirname, join, resolve } from "node:path";
3
3
  import { createInterface } from "node:readline";
4
4
  import { fileURLToPath } from "node:url";
5
+ import { isMap, isScalar, isSeq, parseDocument } from "yaml";
5
6
  import { splitCommand } from "./command-utils.js";
6
7
  import { checkConfigEnforceable, DEFAULT_PROTECT, existingConfigPath, resolveConfig, } from "./config.js";
7
8
  import { detectProject } from "./detect.js";
@@ -592,3 +593,143 @@ export async function setProfileInFile(configPath, profile) {
592
593
  }
593
594
  await fs.writeFile(configPath, content, "utf8");
594
595
  }
596
+ /** Read a raw YAML/JSON value as a pattern list: strings split on
597
+ * whitespace (flat `gate_ignore: "a b"` form), sequences as-is, anything
598
+ * else as empty. YAML nodes arrive as `Seq`, not plain arrays — both are
599
+ * handled. */
600
+ function toPatternList(value) {
601
+ if (typeof value === "string") {
602
+ return value.split(/\s+/).filter((p) => p !== "");
603
+ }
604
+ const items = isSeq(value) ? value.items : Array.isArray(value) ? value : null;
605
+ if (items === null) {
606
+ return [];
607
+ }
608
+ return items
609
+ .map((item) => (isScalar(item) ? String(item.value) : String(item)))
610
+ .filter((p) => p !== "");
611
+ }
612
+ /**
613
+ * Persist gate-ignore patterns to a config file, shape-aware: flat files
614
+ * grow the `gate_ignore:` line, native files grow the `gate: ignore:`
615
+ * sequence, scalar-only files (e.g. just `profile:`) gain a flat line,
616
+ * and JSON files (native-only by design) grow `gate.ignore`. A missing
617
+ * file is created flat. `parseDocument` round-trips the YAML so user
618
+ * comments and formatting survive outside the edited node. Returns the
619
+ * patterns newly stored (already-present ones are skipped, never
620
+ * duplicated). Throws a readable error when the file exists but the
621
+ * `gate:` value is not a mapping.
622
+ */
623
+ export async function storeGateIgnores(configPath, patterns) {
624
+ const fresh = patterns.map((p) => p.trim()).filter((p) => p !== "");
625
+ if (fresh.length === 0) {
626
+ return [];
627
+ }
628
+ if (configPath.endsWith(".json")) {
629
+ return storeGateIgnoresJson(configPath, fresh);
630
+ }
631
+ let text = "";
632
+ try {
633
+ text = await fs.readFile(configPath, "utf8");
634
+ }
635
+ catch {
636
+ // File does not exist yet; it will be created below.
637
+ }
638
+ const doc = parseDocument(text);
639
+ if (doc.contents !== null && !isMap(doc.contents)) {
640
+ throw new Error(`Cannot store gate ignores in ${configPath}: root is not a mapping.`);
641
+ }
642
+ const added = [];
643
+ const union = (existing) => {
644
+ for (const p of fresh) {
645
+ if (!existing.includes(p)) {
646
+ existing.push(p);
647
+ added.push(p);
648
+ }
649
+ }
650
+ return existing;
651
+ };
652
+ // Same sniffing as `selectConfigRecord`: native-only keys (with
653
+ // non-null values — the loader filters nulls, so `doc.has` alone would
654
+ // over-count commented-out debris) or object-form `rules:` mean native
655
+ // shape, so a new key must not introduce a flat line (which the loader
656
+ // would reject as mixed-shape).
657
+ const hasNativeKeys = doc.contents !== null &&
658
+ (["commands", "gate", "on_edit"].some((key) => hasLiveKey(doc, key)) ||
659
+ isMap(doc.get("rules", true)));
660
+ if (!hasNativeKeys) {
661
+ // Flat shape: values are space-separated on one line, so patterns
662
+ // with spaces cannot round-trip — fail loudly instead of silently
663
+ // storing two bogus patterns.
664
+ const spaced = fresh.filter((p) => /\s/.test(p));
665
+ if (spaced.length > 0) {
666
+ throw new Error(`Cannot store ${spaced.join(", ")} in ${configPath}: flat-shape ignores are ` +
667
+ `space-separated. Convert the config to native shape (a gate: ignore: list) first.`);
668
+ }
669
+ if (doc.has("gate_ignore")) {
670
+ doc.set("gate_ignore", union(toPatternList(doc.get("gate_ignore"))).join(" "));
671
+ }
672
+ else {
673
+ doc.set("gate_ignore", fresh.join(" "));
674
+ added.push(...fresh);
675
+ }
676
+ }
677
+ else {
678
+ // Null-valued `gate:` counts as absent (the loader filters nulls) —
679
+ // only a non-null non-mapping gate is a real error.
680
+ const gate = doc.get("gate", true);
681
+ if (gate === undefined || gate === null || (isScalar(gate) && gate.value == null)) {
682
+ doc.set("gate", { ignore: union([]) });
683
+ }
684
+ else if (!isMap(gate)) {
685
+ throw new Error(`Cannot store gate ignores in ${configPath}: gate: is not a mapping.`);
686
+ }
687
+ else {
688
+ gate.set("ignore", union(toPatternList(gate.get("ignore"))));
689
+ }
690
+ }
691
+ await fs.writeFile(configPath, String(doc), "utf8");
692
+ return added;
693
+ }
694
+ /** A key the loader's shape sniffing would count: present with a
695
+ * non-null value (`doc.has` alone counts commented-out `key:` debris). */
696
+ function hasLiveKey(doc, key) {
697
+ const node = doc.get(key, true);
698
+ return node !== undefined && node !== null && !(isScalar(node) && node.value == null);
699
+ }
700
+ async function storeGateIgnoresJson(configPath, fresh) {
701
+ let obj = {};
702
+ try {
703
+ const text = await fs.readFile(configPath, "utf8");
704
+ const parsed = JSON.parse(text);
705
+ if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
706
+ throw new Error(`Cannot store gate ignores in ${configPath}: root is not an object.`);
707
+ }
708
+ obj = parsed;
709
+ }
710
+ catch (error) {
711
+ if (error?.code !== "ENOENT") {
712
+ throw error;
713
+ }
714
+ // File does not exist yet; it will be created below.
715
+ }
716
+ const added = [];
717
+ let gate;
718
+ if (typeof obj.gate === "object" && obj.gate !== null && !Array.isArray(obj.gate)) {
719
+ gate = obj.gate;
720
+ }
721
+ else {
722
+ gate = {};
723
+ obj.gate = gate;
724
+ }
725
+ const current = Array.isArray(gate.ignore) ? gate.ignore.map((item) => String(item)) : [];
726
+ for (const p of fresh) {
727
+ if (!current.includes(p)) {
728
+ current.push(p);
729
+ added.push(p);
730
+ }
731
+ }
732
+ gate.ignore = current;
733
+ await fs.writeFile(configPath, `${JSON.stringify(obj, null, 2)}\n`, "utf8");
734
+ return added;
735
+ }
@@ -60,6 +60,13 @@ export interface HookState {
60
60
  lintLimiter: LintLimiter;
61
61
  /** Fingerprint of the last clean gate pass; skips redundant suites. */
62
62
  passCache: PassCache;
63
+ /**
64
+ * This session's gate-ignore hotlist (`/df-ignore` additions, bare form).
65
+ * Session-scoped by design: permanence is an explicit act (`-s|--store`
66
+ * writes config instead). Mutated in place so the shared glob-matcher
67
+ * cache stays hot; read at every gate evaluation via `runCompletion`.
68
+ */
69
+ sessionIgnores: string[];
63
70
  /**
64
71
  * Host seam availability (see `HostSeams`), probed once at mount with
65
72
  * guarded reads. Rendered by status so a degraded mount reads as
@@ -154,6 +154,7 @@ export function runCompletion(state, sessionID) {
154
154
  tracker: state.tracker,
155
155
  blockCounts: state.blocks,
156
156
  stuckSnapshots: state.stuckSnapshots,
157
+ sessionIgnores: state.sessionIgnores,
157
158
  lintLimiter: state.lintLimiter,
158
159
  passCache: state.passCache,
159
160
  baseline: state.initialEnforceable,
@@ -73,6 +73,14 @@ export interface GateConfig {
73
73
  timeout?: number;
74
74
  /** Maximum number of times a failing gate may re-block before standing down. */
75
75
  max_blocks: number;
76
+ /**
77
+ * Ignore hotlist: project-relative globs the completion gate treats as
78
+ * not-the-work (scratch, generated output). Applies to gate steps and
79
+ * review coverage uniformly; the review artifact itself is always
80
+ * retained regardless. Session-scoped `/df-ignore` entries union with
81
+ * this list and die with the session.
82
+ */
83
+ ignore: string[];
76
84
  }
77
85
  export interface OnEditConfig {
78
86
  format: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-dev-framework",
3
- "version": "1.12.0",
3
+ "version": "1.13.0",
4
4
  "description": "Enforcement gates for AI coding agents on OpenCode and DeepSeek Harness",
5
5
  "license": "MIT",
6
6
  "type": "module",