@danielstyle/featflow 0.0.0-stage → 0.6.4

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.
Files changed (63) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +249 -2
  3. package/README.zh-CN.md +250 -0
  4. package/bin/featflow.mjs +116 -0
  5. package/package.json +63 -4
  6. package/skills/featflow/SKILL.md +127 -0
  7. package/skills/featflow-issues/SKILL.md +104 -0
  8. package/skills/featflow-regression/SKILL.md +63 -0
  9. package/src/agent-docs.mjs +143 -0
  10. package/src/changed-files.mjs +204 -0
  11. package/src/commands/cleanup.mjs +221 -0
  12. package/src/commands/codegraph.mjs +108 -0
  13. package/src/commands/doctor.mjs +303 -0
  14. package/src/commands/finish.mjs +249 -0
  15. package/src/commands/hook-cmd.mjs +78 -0
  16. package/src/commands/hooks-cmd.mjs +247 -0
  17. package/src/commands/init.mjs +477 -0
  18. package/src/commands/issue.mjs +434 -0
  19. package/src/commands/new.mjs +311 -0
  20. package/src/commands/plan-check.mjs +75 -0
  21. package/src/commands/policy-cmd.mjs +55 -0
  22. package/src/commands/pr-cleanup.mjs +194 -0
  23. package/src/commands/regression.mjs +206 -0
  24. package/src/commands/setup.mjs +343 -0
  25. package/src/commands/size-check.mjs +137 -0
  26. package/src/commands/skills.mjs +181 -0
  27. package/src/commands/status.mjs +100 -0
  28. package/src/commands/sync.mjs +421 -0
  29. package/src/commands/verify.mjs +206 -0
  30. package/src/commands/worktree.mjs +205 -0
  31. package/src/config.mjs +295 -0
  32. package/src/detect.mjs +314 -0
  33. package/src/git.mjs +331 -0
  34. package/src/hook-adapters.mjs +218 -0
  35. package/src/hooks-core.mjs +420 -0
  36. package/src/index.mjs +14 -0
  37. package/src/init-args.mjs +294 -0
  38. package/src/init-hooks.mjs +312 -0
  39. package/src/init-prompts.mjs +191 -0
  40. package/src/issues-helpers.mjs +463 -0
  41. package/src/issues.mjs +521 -0
  42. package/src/plan.mjs +202 -0
  43. package/src/policy.mjs +143 -0
  44. package/src/regression.mjs +338 -0
  45. package/src/size-check.mjs +203 -0
  46. package/src/skills-manager.mjs +348 -0
  47. package/src/tui-select.mjs +378 -0
  48. package/templates/adapters/antigravity/hooks.json +42 -0
  49. package/templates/adapters/claude-code/settings.json +46 -0
  50. package/templates/adapters/codex/config.toml +19 -0
  51. package/templates/adapters/cursor/hooks.json +27 -0
  52. package/templates/agents/codex/codebase-locator.toml +28 -0
  53. package/templates/agents/codex/implementation-scout.toml +28 -0
  54. package/templates/agents/codex/regression-guard-planner.toml +20 -0
  55. package/templates/features/README.md +56 -0
  56. package/templates/features/_program_template.md +79 -0
  57. package/templates/features/_template.md +120 -0
  58. package/templates/features/current-feature.md +18 -0
  59. package/templates/githooks/post-merge +10 -0
  60. package/templates/githooks/pre-commit +14 -0
  61. package/templates/githooks/pre-push +13 -0
  62. package/templates/regression/regression-ledger.yml +23 -0
  63. package/templates/snippets/AGENTS-workflow.md +21 -0
@@ -0,0 +1,378 @@
1
+ import { createInterface } from "node:readline";
2
+
3
+ export function createPromptReader() {
4
+ const rl = createInterface({ input: process.stdin, output: process.stdout });
5
+ const queuedLines = [];
6
+ const waiters = [];
7
+ let closed = false;
8
+
9
+ rl.on("line", (line) => {
10
+ if (waiters.length > 0) {
11
+ const resolve = waiters.shift();
12
+ resolve(line);
13
+ } else {
14
+ queuedLines.push(line);
15
+ }
16
+ });
17
+
18
+ rl.on("close", () => {
19
+ closed = true;
20
+ while (waiters.length > 0) {
21
+ const resolve = waiters.shift();
22
+ resolve("");
23
+ }
24
+ });
25
+
26
+ return {
27
+ async question(promptText) {
28
+ process.stdout.write(promptText);
29
+ if (queuedLines.length > 0) {
30
+ return queuedLines.shift();
31
+ }
32
+ if (closed) {
33
+ return "";
34
+ }
35
+ return new Promise((resolve) => {
36
+ waiters.push(resolve);
37
+ });
38
+ },
39
+ close() {
40
+ rl.close();
41
+ },
42
+ };
43
+ }
44
+
45
+ export function isRawTtySupported() {
46
+ return Boolean(
47
+ process.stdin.isTTY &&
48
+ process.stdout.isTTY &&
49
+ typeof process.stdin.setRawMode === "function" &&
50
+ process.env.FEATFLOW_FORCE_TTY !== "1",
51
+ );
52
+ }
53
+
54
+ export function createSmartPrompter() {
55
+ let rl = null;
56
+ const rawTty = isRawTtySupported();
57
+
58
+ function ensureRl() {
59
+ if (!rl) {
60
+ rl = createPromptReader();
61
+ }
62
+ return rl;
63
+ }
64
+
65
+ function releaseRl() {
66
+ if (rl) {
67
+ rl.close();
68
+ rl = null;
69
+ }
70
+ }
71
+
72
+ return {
73
+ isRawTty: rawTty,
74
+ async question(promptText) {
75
+ return ensureRl().question(promptText);
76
+ },
77
+ releaseRl,
78
+ close() {
79
+ releaseRl();
80
+ if (rawTty) {
81
+ process.stdin.pause();
82
+ if (typeof process.stdin.unref === "function") {
83
+ process.stdin.unref();
84
+ }
85
+ }
86
+ },
87
+ };
88
+ }
89
+
90
+ function visualLineCount(lines) {
91
+ const cols = Math.max(20, process.stdout.columns || 80);
92
+ let total = 0;
93
+ for (const line of lines) {
94
+ total += Math.max(1, Math.ceil(line.length / cols));
95
+ }
96
+ return total;
97
+ }
98
+
99
+ function renderLines(lines, prevVisualRows) {
100
+ if (prevVisualRows > 0) {
101
+ process.stdout.write(`\x1b[${prevVisualRows}A\x1b[0J`);
102
+ }
103
+ process.stdout.write(`${lines.join("\n")}\n`);
104
+ return visualLineCount(lines);
105
+ }
106
+
107
+ export function tokenizeRawKeys(text) {
108
+ const keys = [];
109
+ for (let i = 0; i < text.length; i += 1) {
110
+ if (text[i] === "\x1b") {
111
+ if ((text[i + 1] === "[" || text[i + 1] === "O") && i + 2 < text.length) {
112
+ keys.push(text.slice(i, i + 3));
113
+ i += 2;
114
+ continue;
115
+ }
116
+ keys.push("\x1b");
117
+ continue;
118
+ }
119
+ keys.push(text[i]);
120
+ }
121
+ return keys;
122
+ }
123
+
124
+ function runRawSingleSelect(title, choices, defaultId) {
125
+ return new Promise((resolve) => {
126
+ const initialIdx = choices.findIndex((c) => c.id === defaultId);
127
+ let cursor = initialIdx >= 0 ? initialIdx : 0;
128
+ let renderedRows = 0;
129
+
130
+ const buildLines = () => [
131
+ `${title} (↑/↓ move, Enter confirm)`,
132
+ ...choices.map((choice, idx) => {
133
+ const pointer = idx === cursor ? ">" : " ";
134
+ const radio = idx === cursor ? "(•)" : "( )";
135
+ const detail = choice.detail ? ` — ${choice.detail}` : "";
136
+ return ` ${pointer} ${radio} ${choice.label}${detail}`;
137
+ }),
138
+ ];
139
+
140
+ const stdin = process.stdin;
141
+ const prevRaw = stdin.isRaw;
142
+ stdin.setRawMode(true);
143
+ stdin.resume();
144
+ process.stdout.write("\x1b[?25l");
145
+ renderedRows = renderLines(buildLines(), 0);
146
+
147
+ const cleanup = () => {
148
+ stdin.off("data", onData);
149
+ if (typeof stdin.setRawMode === "function") {
150
+ stdin.setRawMode(Boolean(prevRaw));
151
+ }
152
+ stdin.pause();
153
+ process.stdout.write("\x1b[?25h");
154
+ };
155
+
156
+ const onData = (chunk) => {
157
+ let dirty = false;
158
+ for (const key of tokenizeRawKeys(chunk.toString("utf8"))) {
159
+ if (key === "\x03") {
160
+ cleanup();
161
+ process.stdout.write("\n");
162
+ process.exit(130);
163
+ }
164
+ if (key === "\r" || key === "\n") {
165
+ cleanup();
166
+ const chosen = choices[cursor];
167
+ if (renderedRows > 0) {
168
+ process.stdout.write(`\x1b[${renderedRows}A\x1b[0J`);
169
+ }
170
+ process.stdout.write(`${title}: ${chosen.label}\n`);
171
+ resolve(chosen.id);
172
+ return;
173
+ }
174
+ if (key === "\x1b[A" || key === "\x1bOA" || key === "k" || key === "K") {
175
+ cursor = (cursor - 1 + choices.length) % choices.length;
176
+ dirty = true;
177
+ } else if (key === "\x1b[B" || key === "\x1bOB" || key === "j" || key === "J") {
178
+ cursor = (cursor + 1) % choices.length;
179
+ dirty = true;
180
+ } else if (/^[1-9]$/.test(key)) {
181
+ const idx = Number.parseInt(key, 10) - 1;
182
+ if (idx >= 0 && idx < choices.length) {
183
+ cursor = idx;
184
+ dirty = true;
185
+ }
186
+ }
187
+ }
188
+ if (dirty) {
189
+ renderedRows = renderLines(buildLines(), renderedRows);
190
+ }
191
+ };
192
+
193
+ stdin.on("data", onData);
194
+ });
195
+ }
196
+
197
+ function runRawMultiSelect(title, choices) {
198
+ return new Promise((resolve) => {
199
+ const selected = new Set(choices.filter((item) => item.checked).map((item) => item.id));
200
+ let cursor = 0;
201
+ let renderedRows = 0;
202
+
203
+ const buildLines = () => [
204
+ `${title} (↑/↓ move, Space toggle, a all/none, Enter confirm)`,
205
+ ...choices.map((choice, idx) => {
206
+ const pointer = idx === cursor ? ">" : " ";
207
+ const box = selected.has(choice.id) ? "[x]" : "[ ]";
208
+ const detail = choice.detail ? ` — ${choice.detail}` : "";
209
+ return ` ${pointer} ${box} ${choice.label}${detail}`;
210
+ }),
211
+ ];
212
+
213
+ const stdin = process.stdin;
214
+ const prevRaw = stdin.isRaw;
215
+ stdin.setRawMode(true);
216
+ stdin.resume();
217
+ process.stdout.write("\x1b[?25l");
218
+ renderedRows = renderLines(buildLines(), 0);
219
+
220
+ const cleanup = () => {
221
+ stdin.off("data", onData);
222
+ if (typeof stdin.setRawMode === "function") {
223
+ stdin.setRawMode(Boolean(prevRaw));
224
+ }
225
+ stdin.pause();
226
+ process.stdout.write("\x1b[?25h");
227
+ };
228
+
229
+ const toggleId = (id) => {
230
+ if (selected.has(id)) selected.delete(id);
231
+ else selected.add(id);
232
+ };
233
+
234
+ const onData = (chunk) => {
235
+ let dirty = false;
236
+ for (const key of tokenizeRawKeys(chunk.toString("utf8"))) {
237
+ if (key === "\x03") {
238
+ cleanup();
239
+ process.stdout.write("\n");
240
+ process.exit(130);
241
+ }
242
+ if (key === "\r" || key === "\n") {
243
+ cleanup();
244
+ const chosenIds = choices.filter((c) => selected.has(c.id)).map((c) => c.id);
245
+ const chosenLabels = choices.filter((c) => selected.has(c.id)).map((c) => c.label);
246
+ if (renderedRows > 0) {
247
+ process.stdout.write(`\x1b[${renderedRows}A\x1b[0J`);
248
+ }
249
+ process.stdout.write(`${title}: ${chosenLabels.length > 0 ? chosenLabels.join(", ") : "(none)"}\n`);
250
+ resolve(chosenIds);
251
+ return;
252
+ }
253
+ if (key === "\x1b[A" || key === "\x1bOA" || key === "k" || key === "K") {
254
+ cursor = (cursor - 1 + choices.length) % choices.length;
255
+ dirty = true;
256
+ } else if (key === "\x1b[B" || key === "\x1bOB" || key === "j" || key === "J") {
257
+ cursor = (cursor + 1) % choices.length;
258
+ dirty = true;
259
+ } else if (key === " ") {
260
+ toggleId(choices[cursor].id);
261
+ dirty = true;
262
+ } else if (/^[1-9]$/.test(key)) {
263
+ const idx = Number.parseInt(key, 10) - 1;
264
+ if (idx >= 0 && idx < choices.length) {
265
+ cursor = idx;
266
+ toggleId(choices[idx].id);
267
+ dirty = true;
268
+ }
269
+ } else if (key === "a" || key === "A") {
270
+ if (selected.size === choices.length) {
271
+ selected.clear();
272
+ } else {
273
+ for (const choice of choices) selected.add(choice.id);
274
+ }
275
+ dirty = true;
276
+ }
277
+ }
278
+ if (dirty) {
279
+ renderedRows = renderLines(buildLines(), renderedRows);
280
+ }
281
+ };
282
+
283
+ stdin.on("data", onData);
284
+ });
285
+ }
286
+
287
+ export function parseSingleSelectInput(answer, choices, defaultId) {
288
+ const fallback = defaultId ?? choices[0]?.id ?? "";
289
+ const trimmed = String(answer ?? "").trim().toLowerCase();
290
+ if (!trimmed) {
291
+ return fallback;
292
+ }
293
+
294
+ const num = Number.parseInt(trimmed, 10);
295
+ if (Number.isInteger(num) && String(num) === trimmed && num >= 1 && num <= choices.length) {
296
+ return choices[num - 1].id;
297
+ }
298
+
299
+ for (const choice of choices) {
300
+ if (choice.id.toLowerCase() === trimmed) {
301
+ return choice.id;
302
+ }
303
+ if (Array.isArray(choice.aliases) && choice.aliases.some((alias) => alias.toLowerCase() === trimmed)) {
304
+ return choice.id;
305
+ }
306
+ }
307
+ return fallback;
308
+ }
309
+
310
+ export async function promptSingleSelect(prompter, { title, choices, defaultId }) {
311
+ if (!Array.isArray(choices) || choices.length === 0) {
312
+ return defaultId ?? "";
313
+ }
314
+ const resolvedDefault = choices.some((c) => c.id === defaultId) ? defaultId : choices[0].id;
315
+
316
+ if (prompter?.isRawTty) {
317
+ prompter.releaseRl();
318
+ return runRawSingleSelect(title, choices, resolvedDefault);
319
+ }
320
+
321
+ console.log(`${title}:`);
322
+ choices.forEach((choice, idx) => {
323
+ const marker = choice.id === resolvedDefault ? "(•)" : "( )";
324
+ const detail = choice.detail ? ` — ${choice.detail}` : "";
325
+ console.log(` ${idx + 1}. ${marker} ${choice.label}${detail}`);
326
+ });
327
+ const answer = await prompter.question(`Choose [1-${choices.length}] (Enter for ${resolvedDefault}): `);
328
+ return parseSingleSelectInput(answer, choices, resolvedDefault);
329
+ }
330
+
331
+ export function parseMultiSelectInput(answer, choices) {
332
+ const trimmed = String(answer ?? "").trim().toLowerCase();
333
+ if (!trimmed) {
334
+ return choices.filter((c) => c.checked).map((c) => c.id);
335
+ }
336
+ if (trimmed === "all" || trimmed === "*") {
337
+ return choices.map((c) => c.id);
338
+ }
339
+ if (trimmed === "none" || trimmed === "0" || trimmed === "n") {
340
+ return [];
341
+ }
342
+
343
+ const picked = new Set();
344
+ const byId = new Map(choices.map((c) => [c.id.toLowerCase(), c.id]));
345
+ for (const token of trimmed.split(/[,\s]+/).filter(Boolean)) {
346
+ const num = Number.parseInt(token, 10);
347
+ if (Number.isInteger(num) && String(num) === token && num >= 1 && num <= choices.length) {
348
+ picked.add(choices[num - 1].id);
349
+ continue;
350
+ }
351
+ if (byId.has(token)) {
352
+ picked.add(byId.get(token));
353
+ }
354
+ }
355
+ return choices.filter((c) => picked.has(c.id)).map((c) => c.id);
356
+ }
357
+
358
+ export async function promptMultiSelect(prompter, { title, choices }) {
359
+ if (!Array.isArray(choices) || choices.length === 0) {
360
+ return [];
361
+ }
362
+
363
+ if (prompter?.isRawTty) {
364
+ prompter.releaseRl();
365
+ return runRawMultiSelect(title, choices);
366
+ }
367
+
368
+ console.log(`${title}:`);
369
+ choices.forEach((choice, idx) => {
370
+ const box = choice.checked ? "[x]" : "[ ]";
371
+ const detail = choice.detail ? ` — ${choice.detail}` : "";
372
+ console.log(` ${idx + 1}. ${box} ${choice.label}${detail}`);
373
+ });
374
+ const answer = await prompter.question(
375
+ 'Select numbers (e.g. 1,3), "all", "none", or Enter to keep defaults: ',
376
+ );
377
+ return parseMultiSelectInput(answer, choices);
378
+ }
@@ -0,0 +1,42 @@
1
+ {
2
+ "featflow": {
3
+ "PreInvocation": [
4
+ {
5
+ "type": "command",
6
+ "command": "featflow hook antigravity pre-invocation",
7
+ "timeout": 5
8
+ }
9
+ ],
10
+ "PreToolUse": [
11
+ {
12
+ "matcher": "run_command|edit_file|write_file|replace_file_content|multi_replace_file_content|write_to_file",
13
+ "hooks": [
14
+ {
15
+ "type": "command",
16
+ "command": "featflow hook antigravity pre-tool-use",
17
+ "timeout": 5
18
+ }
19
+ ]
20
+ }
21
+ ],
22
+ "PostToolUse": [
23
+ {
24
+ "matcher": "edit_file|write_file|replace_file_content|multi_replace_file_content|write_to_file",
25
+ "hooks": [
26
+ {
27
+ "type": "command",
28
+ "command": "featflow hook antigravity post-tool-use",
29
+ "timeout": 15
30
+ }
31
+ ]
32
+ }
33
+ ],
34
+ "Stop": [
35
+ {
36
+ "type": "command",
37
+ "command": "featflow hook antigravity stop",
38
+ "timeout": 15
39
+ }
40
+ ]
41
+ }
42
+ }
@@ -0,0 +1,46 @@
1
+ {
2
+ "hooks": {
3
+ "UserPromptSubmit": [
4
+ {
5
+ "hooks": [
6
+ {
7
+ "type": "command",
8
+ "command": "featflow hook claude-code user-prompt"
9
+ }
10
+ ]
11
+ }
12
+ ],
13
+ "PreToolUse": [
14
+ {
15
+ "matcher": "Bash|Edit|MultiEdit|Write|NotebookEdit",
16
+ "hooks": [
17
+ {
18
+ "type": "command",
19
+ "command": "featflow hook claude-code pre-tool-use"
20
+ }
21
+ ]
22
+ }
23
+ ],
24
+ "PostToolUse": [
25
+ {
26
+ "matcher": "Edit|MultiEdit|Write|NotebookEdit",
27
+ "hooks": [
28
+ {
29
+ "type": "command",
30
+ "command": "featflow hook claude-code post-tool-use"
31
+ }
32
+ ]
33
+ }
34
+ ],
35
+ "Stop": [
36
+ {
37
+ "hooks": [
38
+ {
39
+ "type": "command",
40
+ "command": "featflow hook claude-code stop"
41
+ }
42
+ ]
43
+ }
44
+ ]
45
+ }
46
+ }
@@ -0,0 +1,19 @@
1
+ # featflow hooks adapter for OpenAI Codex (.codex/config.toml)
2
+ # Requires `featflow` on PATH (or replace `featflow` with `npx --no-install featflow`).
3
+
4
+ [hooks]
5
+ userPromptSubmit = [
6
+ { command = "featflow hook codex user-prompt", timeoutSec = 5, statusMessage = "Checking featflow workflow routing" },
7
+ ]
8
+
9
+ preToolUse = [
10
+ { command = "featflow hook codex pre-tool-use", timeoutSec = 5, statusMessage = "Checking featflow branch and plan policy" },
11
+ ]
12
+
13
+ postToolUse = [
14
+ { command = "featflow hook codex post-tool-use", timeoutSec = 30, statusMessage = "Checking featflow file-size budget" },
15
+ ]
16
+
17
+ stop = [
18
+ { command = "featflow hook codex stop", timeoutSec = 8, statusMessage = "Checking featflow verification reminders" },
19
+ ]
@@ -0,0 +1,27 @@
1
+ {
2
+ "version": 1,
3
+ "hooks": {
4
+ "beforeSubmitPrompt": [
5
+ {
6
+ "command": "featflow hook cursor before-submit-prompt"
7
+ }
8
+ ],
9
+ "preToolUse": [
10
+ {
11
+ "command": "featflow hook cursor pre-tool-use",
12
+ "matcher": "Shell|Write|StrReplace|Edit|MultiEdit|Bash"
13
+ }
14
+ ],
15
+ "postToolUse": [
16
+ {
17
+ "command": "featflow hook cursor post-tool-use",
18
+ "matcher": "Write|StrReplace|Edit|MultiEdit"
19
+ }
20
+ ],
21
+ "stop": [
22
+ {
23
+ "command": "featflow hook cursor stop"
24
+ }
25
+ ]
26
+ }
27
+ }
@@ -0,0 +1,28 @@
1
+ name = "codebase-locator"
2
+ description = "Quickly locates likely owner files, symbols, tests, and follow-ups for unclear codebase tasks without editing files."
3
+ sandbox_mode = "read-only"
4
+ developer_instructions = """
5
+ You are the read-only codebase locator.
6
+
7
+ Use this agent when affected files, owning surfaces, or the shortest read path are unclear. Your job is to answer "where should the main thread look first?" with minimal context load.
8
+
9
+ Default posture:
10
+ - Read and analyze only. Do not edit files, run formatters, stage changes, commit, change branches, or create worktrees.
11
+ - Prefer CodeGraph before broad text search when a `.codegraph/` directory exists (`codegraph explore` for questions, `codegraph node` for symbols/files). Fall back to `rg` and targeted reads for docs, configs, or unindexed files.
12
+ - Locate ownership, symbols, tests, and risks. Do not design or implement the solution.
13
+
14
+ Hard budgets:
15
+ - Return at most 8 likely owner files.
16
+ - Return at most 5 key symbols or entry points.
17
+ - Read at most 5 source/test/doc snippets unless the prompt explicitly grants a larger budget.
18
+ - Do not paste long source blocks. Use file paths, line references, symbol names, and one-sentence rationale.
19
+ - Stop as soon as you can name the shortest useful read path.
20
+
21
+ Output shape:
22
+ - Likely surface: owning directory/module and why.
23
+ - Owner files: up to 8 paths with one-line rationale.
24
+ - Key symbols: up to 5 symbols, functions, classes, routes, or config keys.
25
+ - Shortest read path: ordered list of files/lines for the main thread to inspect.
26
+ - Nearby tests/checks: relevant test files or verification commands.
27
+ - Unknowns: only items that materially affect scoping.
28
+ """
@@ -0,0 +1,28 @@
1
+ name = "implementation-scout"
2
+ description = "Inspects a bounded target area and recommends the smallest safe implementation path, risks, and checks without editing files."
3
+ sandbox_mode = "read-only"
4
+ developer_instructions = """
5
+ You are the read-only implementation scout.
6
+
7
+ Use this agent after files or modules have been narrowed by the main thread, CodeGraph, or `codebase-locator`. Your job is to answer "what is the smallest safe implementation path?" without editing files.
8
+
9
+ Default posture:
10
+ - Read and analyze only. Do not edit files, run formatters, stage changes, commit, change branches, or create worktrees.
11
+ - Work strictly inside the provided target area. If scope is too vague, recommend running `codebase-locator` first and stop.
12
+ - Prefer existing local abstractions, boundaries, and test patterns over new patterns.
13
+ - Keep recommendations concise and implementation-ready; the main thread owns planning approval, edits, verification, and commits.
14
+
15
+ Hard budgets:
16
+ - Inspect at most 8 source files and 4 test/doc/config files unless explicitly granted more.
17
+ - Return at most 10 affected files.
18
+ - Do not paste long source blocks; quote only tiny signatures or field names when essential.
19
+
20
+ Output shape:
21
+ - Scope confirmation: files/modules inspected.
22
+ - Proposed minimal change: concise step-by-step path, not a patch.
23
+ - Affected files: up to 10 files with expected edit/no-edit role.
24
+ - Existing patterns to follow: helpers, contracts, and test styles.
25
+ - Risks and invariants: what must not regress.
26
+ - Suggested checks: exact narrow verification commands.
27
+ - Stop summary: one short paragraph to proceed.
28
+ """
@@ -0,0 +1,20 @@
1
+ name = "regression-guard-planner"
2
+ description = "Plans durable regression guards for bug fixes, failing tests, and GitHub Issue bugs without editing files."
3
+ sandbox_mode = "read-only"
4
+ developer_instructions = """
5
+ You are the read-only regression guard planner.
6
+
7
+ Use this agent when investigating a bug fix, failing test, regression, or fragile code path that needs durable automated guard coverage.
8
+
9
+ Default posture:
10
+ - Read and analyze only. Do not edit files, stage changes, commit, or switch branches.
11
+ - Prefer small, executable guards over memory or prose warnings.
12
+ - Inspect the repository's regression ledger (if configured in `.featflow.json`, or `featflow regression impact --json`) and nearby test suites.
13
+
14
+ Output shape:
15
+ - Bug invariant: one sentence stating what must stay true.
16
+ - Best guard: exact test/check file and why it is the smallest reliable guard.
17
+ - Existing coverage: nearby tests or ledger entries protecting this path.
18
+ - Commands: exact narrow verification commands from the repository root.
19
+ - Residual risk: anything that remains manual or unguarded.
20
+ """
@@ -0,0 +1,56 @@
1
+ # Feature Records
2
+
3
+ This directory tracks substantial project-level engineering work from discovery and planning through execution, verification, and handoff.
4
+
5
+ ## Structure
6
+
7
+ ```text
8
+ features/
9
+ README.md
10
+ _template.md
11
+ _program_template.md
12
+ active/ # Features currently being implemented
13
+ done/ # Completed feature records
14
+ paused/ # Parked work ready to resume later
15
+ programs/ # Multi-phase roadmaps linking multiple feature records
16
+ ```
17
+
18
+ > **Note on `current-feature.md`:** By default, `features/current-feature.md` is ignored by Git to avoid merge conflicts across parallel worktrees and developers. `features/active/` is the canonical active list, and `featflow status` summarizes all active and paused records automatically.
19
+
20
+ ## Workflow Summary
21
+
22
+ 1. **Discover** (read-only) relevant files, contracts, and tests.
23
+ 2. **Plan & Get Approval** before creating an implementation worktree or editing tracked files.
24
+ 3. **Isolate** work in a typed-branch worktree: `featflow worktree <prefix>/<task-name>`.
25
+ 4. **Document** the concrete `Feature Brief` and `Plan Details` in `features/active/YYYY-MM-DD-HHMM-short-kebab-title.md` (drafted and maintained by the AI, verified with `featflow plan-check`).
26
+ 5. **Implement & Verify**, updating `Execution Log`, `Decisions`, `Changed Files`, and `Verification`.
27
+ 6. **Complete**: move the record to `features/done/`, commit on the task branch, and run `featflow finish <branch>`.
28
+
29
+ ## Branch Prefixes
30
+
31
+ - `feat/` — new user-facing capability or substantial enhancement
32
+ - `fix/` — bug fix, regression, or incident repair
33
+ - `chore/` — tooling, dependencies, config, or workflow maintenance
34
+ - `docs/` — documentation-only change
35
+ - `test/` — test-only additions or hardening
36
+ - `refactor/` — behavior-preserving restructuring
37
+ - `perf/` — performance improvement
38
+ - `security/` — security hardening or vulnerability fix
39
+
40
+ ## Status Values
41
+
42
+ - `planned` — scoped, awaiting implementation
43
+ - `in_progress` — actively being implemented
44
+ - `review` — ready for or awaiting pull request review
45
+ - `blocked` — waiting on user decision or external dependency
46
+ - `paused` — intentionally parked for later resumption
47
+ - `done` — verified, merged/handed off, and archived in `features/done/`
48
+ - `cancelled` — stopped without completion
49
+
50
+ ## Naming Convention
51
+
52
+ Use local 24-hour time in `YYYY-MM-DD-HHMM-short-kebab-title.md` so multiple same-day features never collide:
53
+
54
+ ```text
55
+ features/active/2026-06-15-1430-oauth-pkce-login.md
56
+ ```