@moritakaaz/markflow 0.2.0 → 0.4.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/package.json CHANGED
@@ -19,5 +19,5 @@
19
19
  "test": "node --test"
20
20
  },
21
21
  "type": "module",
22
- "version": "0.2.0"
22
+ "version": "0.4.0"
23
23
  }
package/src/discover.js CHANGED
@@ -19,6 +19,86 @@ const MANIFESTS = {
19
19
  "Gemfile": "Ruby",
20
20
  };
21
21
 
22
+ // Discovery records dependency names as written.
23
+ // It does not map them to framework names.
24
+
25
+ function parsePackageDeps(text) {
26
+ try {
27
+ const pkg = JSON.parse(text);
28
+ return [
29
+ ...Object.keys(pkg.dependencies || {}),
30
+ ...Object.keys(pkg.devDependencies || {}),
31
+ ];
32
+ } catch {
33
+ return [];
34
+ }
35
+ }
36
+
37
+ function parseRequirements(text) {
38
+ const names = [];
39
+ for (const raw of text.split("\n")) {
40
+ let line = raw.split("#")[0].trim();
41
+ if (!line || line.startsWith("-")) {
42
+ continue;
43
+ }
44
+ line = line.split(";")[0].trim();
45
+ const name = line.split(/[\s=<>~!\[]/)[0].trim();
46
+ if (name) {
47
+ names.push(name);
48
+ }
49
+ }
50
+ return names;
51
+ }
52
+
53
+ function parseGoMod(text) {
54
+ const names = [];
55
+ for (const raw of text.split("\n")) {
56
+ const line = raw.trim();
57
+ if (!line || line === ")" || line.startsWith("//")) {
58
+ continue;
59
+ }
60
+ const parts = line.split(/\s+/);
61
+ let mod = null;
62
+ if (parts[0] === "require") {
63
+ mod = parts[1];
64
+ } else if (
65
+ !["module", "go", "require", "replace", "exclude", "retract"].includes(
66
+ parts[0]
67
+ ) &&
68
+ parts.length >= 2
69
+ ) {
70
+ mod = parts[0];
71
+ }
72
+ if (!mod || mod.startsWith("(")) {
73
+ continue;
74
+ }
75
+ const segments = mod.split("/");
76
+ let last = segments[segments.length - 1];
77
+ if (/^v\d+$/.test(last)) {
78
+ last = segments[segments.length - 2] || "";
79
+ }
80
+ if (last) {
81
+ names.push(last);
82
+ }
83
+ }
84
+ return names;
85
+ }
86
+
87
+ function parseComposerDeps(text) {
88
+ try {
89
+ const pkg = JSON.parse(text);
90
+ const names = [
91
+ ...Object.keys(pkg.require || {}),
92
+ ...Object.keys(pkg["require-dev"] || {}),
93
+ ];
94
+ return names.filter(
95
+ (n) => n !== "php" && !n.startsWith("ext-") && !n.startsWith("lib-")
96
+ );
97
+ } catch {
98
+ return [];
99
+ }
100
+ }
101
+
22
102
  const WORKSPACE_FILES = ["pnpm-workspace.yaml", "lerna.json"];
23
103
 
24
104
  const CONFIG_PATTERNS = [
@@ -63,7 +143,9 @@ export async function discover(root) {
63
143
  const configs = [];
64
144
  const workspaceEvidence = [];
65
145
  const memberDirs = new Set();
146
+ const dependencies = [];
66
147
  const seen = new Set();
148
+ const seenDeps = new Set();
67
149
  function addStack(name, evidence, confidence) {
68
150
  manifests.push(evidence);
69
151
  if (seen.has(name)) {
@@ -72,6 +154,37 @@ export async function discover(root) {
72
154
  seen.add(name);
73
155
  stacks.push({ name, evidence, confidence });
74
156
  }
157
+ function addDependency(name, evidence) {
158
+ const key = name + "@" + evidence;
159
+ if (seenDeps.has(key)) {
160
+ return;
161
+ }
162
+ seenDeps.add(key);
163
+ dependencies.push({ name, evidence, confidence: "detected" });
164
+ }
165
+ async function collectDeps(fileName, fullPath, evidence) {
166
+ let text;
167
+ try {
168
+ text = await readFile(fullPath, "utf8");
169
+ } catch {
170
+ return;
171
+ }
172
+ let names = [];
173
+ if (fileName === "package.json") {
174
+ names = parsePackageDeps(text);
175
+ } else if (fileName === "requirements.txt") {
176
+ names = parseRequirements(text);
177
+ } else if (fileName === "go.mod") {
178
+ names = parseGoMod(text);
179
+ } else if (fileName === "composer.json") {
180
+ names = parseComposerDeps(text);
181
+ } else {
182
+ return;
183
+ }
184
+ for (const dep of names) {
185
+ addDependency(dep, evidence);
186
+ }
187
+ }
75
188
  async function scanDir(dir, rel, confidence, depth) {
76
189
  let entries;
77
190
  try {
@@ -102,6 +215,7 @@ export async function discover(root) {
102
215
  if (rel) {
103
216
  memberDirs.add(rel.split("/").slice(0, 2).join("/"));
104
217
  }
218
+ await collectDeps(entry.name, join(dir, entry.name), childRel);
105
219
  }
106
220
  }
107
221
  }
@@ -177,6 +291,7 @@ export async function discover(root) {
177
291
  stacks,
178
292
  manifests,
179
293
  configs,
294
+ dependencies,
180
295
  workspace: {
181
296
  detected: workspaceEvidence.length > 0,
182
297
  evidence: workspaceEvidence,
package/src/doctor.js CHANGED
@@ -22,6 +22,25 @@ const REQUIRED = [
22
22
 
23
23
  const AGENT_FILES = ["CLAUDE.md", ".cursor/rules/markflow.mdc"];
24
24
 
25
+ // TBD in these files blocks the start. TBD in other docs can wait.
26
+ const TBD_NOW = [
27
+ "markflow/docs/PRD.md",
28
+ "markflow/docs/ARCHITECTURE.md",
29
+ "markflow/docs/STACK.md",
30
+ "markflow/TASKS.md",
31
+ ];
32
+
33
+ function isTbdNow(rel) {
34
+ if (TBD_NOW.includes(rel)) {
35
+ return true;
36
+ }
37
+ return (
38
+ rel.startsWith("markflow/specs/") &&
39
+ !rel.endsWith("/index.md") &&
40
+ !rel.endsWith("/_template.md")
41
+ );
42
+ }
43
+
25
44
  async function walk(dir, out) {
26
45
  let entries;
27
46
  try {
@@ -161,7 +180,8 @@ export async function runDoctor(options) {
161
180
  for (const file of AGENT_FILES) {
162
181
  mdFiles.push(join(root, file));
163
182
  }
164
- let tbd = 0;
183
+ let tbdNow = 0;
184
+ let tbdLater = 0;
165
185
  for (const file of mdFiles) {
166
186
  let text;
167
187
  try {
@@ -182,7 +202,12 @@ export async function runDoctor(options) {
182
202
  break;
183
203
  }
184
204
  }
185
- tbd += text.split("TBD").length - 1;
205
+ const count = text.split("TBD").length - 1;
206
+ if (isTbdNow(rel)) {
207
+ tbdNow += count;
208
+ } else {
209
+ tbdLater += count;
210
+ }
186
211
  for (const link of findLinks(text)) {
187
212
  if (
188
213
  link.startsWith("http") ||
@@ -204,25 +229,32 @@ export async function runDoctor(options) {
204
229
  }
205
230
  }
206
231
  }
232
+ const stillTemplate = [];
207
233
  try {
208
234
  const templatesDir = await findTemplatesDir();
209
- const projectName =
210
- (marker && marker.project) || basename(root);
211
- const prdTemplate = (
212
- await readFile(join(templatesDir, "markflow/docs/PRD.md"), "utf8")
213
- )
214
- .split("{{project_name}}")
215
- .join(projectName);
216
- const prdText = await readFile(
217
- join(root, "markflow/docs/PRD.md"),
218
- "utf8"
219
- );
220
- if (prdText === prdTemplate) {
221
- console.log("Warning PRD is still the template markflow/docs/PRD.md");
222
- warnings.push("markflow/docs/PRD.md");
235
+ const projectName = (marker && marker.project) || basename(root);
236
+ for (const [rel, label] of [
237
+ ["markflow/docs/PRD.md", "PRD"],
238
+ ["markflow/docs/ARCHITECTURE.md", "ARCHITECTURE"],
239
+ ["markflow/TASKS.md", "TASKS"],
240
+ ]) {
241
+ const templateText = (
242
+ await readFile(join(templatesDir, rel), "utf8")
243
+ )
244
+ .split("{{project_name}}")
245
+ .join(projectName);
246
+ const text = await readFile(join(root, rel), "utf8");
247
+ if (text === templateText) {
248
+ console.log("Warning " + label + " is still the template " + rel);
249
+ warnings.push(rel);
250
+ stillTemplate.push(rel);
251
+ }
223
252
  }
224
253
  } catch {
225
- // Template or PRD is missing, so skip this check.
254
+ // Template or doc is missing, so skip this check.
255
+ }
256
+ if (stillTemplate.length > 0) {
257
+ console.log("Next. Fill " + stillTemplate[0] + ".");
226
258
  }
227
259
  let specTotal = 0;
228
260
  let specDraft = 0;
@@ -271,7 +303,8 @@ export async function runDoctor(options) {
271
303
  } catch {
272
304
  // Missing specs folder is already reported above.
273
305
  }
274
- console.log("Info " + tbd + " TBD left in docs.");
306
+ console.log("Info " + tbdNow + " TBD left to decide now.");
307
+ console.log("Info " + tbdLater + " TBD left for later.");
275
308
  console.log("Info " + specTotal + " specs, " + specDraft + " draft.");
276
309
  if (errors.length === 0 && warnings.length === 0) {
277
310
  console.log("Doctor found no issues.");
package/src/init.js CHANGED
@@ -85,7 +85,8 @@ export function fillArchitecture(text, context) {
85
85
  .replace("- Language. TBD", "- Language. " + names)
86
86
  .replace(
87
87
  "- Framework. TBD",
88
- "- Framework. TBD\n- Evidence. " +
88
+ "- Framework. TBD" +
89
+ "\n- Evidence. " +
89
90
  evidence +
90
91
  "\n- Monorepo. " +
91
92
  (context.monorepo ? "Yes" : "No")
@@ -136,8 +137,17 @@ export async function runInit(options) {
136
137
  const lines = context.stacks.map(
137
138
  (s) => "- " + s.name + " from " + s.evidence + ", confidence " + s.confidence
138
139
  );
139
- const filled =
140
+ let filled =
140
141
  stack + "\n## Detected stacks\n\nDiscovery found these stacks.\n\n" + lines.join("\n") + "\n";
142
+ if (context.dependencies.length > 0) {
143
+ const depLines = context.dependencies.map(
144
+ (d) => "- " + d.name + " from " + d.evidence + ", detected"
145
+ );
146
+ filled +=
147
+ "\n## Detected dependencies\n\nDiscovery found these dependencies.\n\n" +
148
+ depLines.join("\n") +
149
+ "\n";
150
+ }
141
151
  await writeFile(stackPath, filled);
142
152
  }
143
153
  }
@@ -206,6 +216,7 @@ export async function runInit(options) {
206
216
  stacks: context.stacks,
207
217
  manifests: context.manifests,
208
218
  monorepo: context.monorepo,
219
+ dependencies: context.dependencies,
209
220
  };
210
221
  // Record hashes only for files this run created.
211
222
  // A file the user wrote before init stays untracked,
package/src/versions.js CHANGED
@@ -2,5 +2,5 @@
2
2
  // Bump methodology when the docs in docs change.
3
3
  // Bump template when the files in templates change.
4
4
  // The CLI version comes from package.json.
5
- export const METHODOLOGY_VERSION = "0.2.0";
6
- export const TEMPLATE_VERSION = "0.2.0";
5
+ export const METHODOLOGY_VERSION = "0.4.0";
6
+ export const TEMPLATE_VERSION = "0.4.0";
@@ -6,6 +6,8 @@ This file is the router for AI agents in this project. Read it first.
6
6
 
7
7
  All project context lives in the `markflow` folder. Do not create new Markdown files in the root.
8
8
 
9
+ If the PRD is still the template, start with the onboarding workflow in `markflow/.agents/workflows/onboarding.md`. It interviews the user one question at a time and fills the first docs.
10
+
9
11
  Start with these files in order.
10
12
 
11
13
  1. Read `markflow/docs/PRD.md` to learn what this project is.
@@ -8,12 +8,13 @@ Do not read when. The PRD is already filled. Use the other workflows instead.
8
8
 
9
9
  1. Ask one question at a time. Wait for the answer before you ask the next one.
10
10
  2. Start with the problem. What hurts today, and for whom.
11
- 3. Ask who uses the product. Ask what each user must be able to do.
12
- 4. Ask what the product must not do.
13
- 5. Read the code to learn the stack and the layout. Use only what the code shows.
14
- 6. Write PRD.md from the answers. Write ARCHITECTURE.md from the answers and from the code.
15
- 7. Mark anything you do not know as TBD. Never invent a decision or an architecture detail.
16
- 8. End with a list of open questions. The user answers them to clear the TBD marks.
11
+ 3. Ask which language to use in this conversation. Then ask which language to use for docs and code comments. Ask each one as its own question. Code names stay in English.
12
+ 4. Ask who uses the product. Ask what each user must be able to do.
13
+ 5. Ask what the product must not do.
14
+ 6. Read the code to learn the stack and the layout. Use only what the code shows.
15
+ 7. Write PRD.md from the answers. Write ARCHITECTURE.md from the answers and from the code. Write the two language answers in PRD.md.
16
+ 8. Mark anything you do not know as TBD. Never invent a decision or an architecture detail.
17
+ 9. End with a list of open questions. The user answers them to clear the TBD marks.
17
18
 
18
19
  ## Rules
19
20
 
@@ -10,4 +10,5 @@ Do not read when. The spec is still a draft. Wait until it is ready.
10
10
  2. Check each requirement is checkable.
11
11
  3. Check out of scope is written.
12
12
  4. Check acceptance cases exist.
13
- 5. Mark the spec Approved only when all checks pass. If not, list what is missing.
13
+ 5. Run the review and list what is missing. Only the user marks a spec Approved.
14
+ 6. If the user says yes, change Draft to Approved in the spec and in specs/index.md. Then coding starts with implement-spec.
@@ -6,7 +6,11 @@ Do not read when. You only need one spec. Open that spec directly instead.
6
6
 
7
7
  ## Active
8
8
 
9
- - [ ] Add the first spec in `specs/index.md`
9
+ - Finish onboarding in markflow/.agents/workflows/onboarding.md
10
+ - Write spec 01 from markflow/specs/_template.md and list it in markflow/specs/index.md
11
+ - Review spec 01 with review-spec.md and mark it Approved in specs/index.md and in the spec
12
+ - Build spec 01 with implement-spec.md and run the tests
13
+ - Update TASKS.md when spec 01 is done
10
14
 
11
15
  ## Done
12
16
 
@@ -8,6 +8,13 @@ Do not read when. You need code detail. Open a spec in `specs` instead.
8
8
 
9
9
  <!-- Write one short paragraph. What problem does this project solve. Who has that problem today. -->
10
10
 
11
+ ## Language
12
+
13
+ <!-- Write which language to use in this conversation and which language to use for docs and code comments. Code names stay in English. -->
14
+
15
+ - Conversation. TBD
16
+ - Docs. TBD
17
+
11
18
  ## Users
12
19
 
13
20
  <!-- List the main users. Write one line per user type. Say what each type needs most. -->
@@ -10,6 +10,8 @@ Draft means the spec is still being written. Approved means it is ready to build
10
10
 
11
11
  ## Specs
12
12
 
13
- | ID | Title | Status |
14
- |---|---|---|
15
- | 01 | TBD | Draft |
13
+ Add one row per spec. Write the file name in the File column. Doctor checks the file name, not the title.
14
+
15
+ | ID | File | Title | Status |
16
+ |---|---|---|---|
17
+ | 01 | TBD | TBD | Draft |
package/test/cli.test.js CHANGED
@@ -81,6 +81,49 @@ describe("discover", () => {
81
81
  assert.equal(result.workspace.detected, true);
82
82
  });
83
83
 
84
+ it("detects dependencies from package.json", async (t) => {
85
+ const dir = await tempDir(t);
86
+ await write(
87
+ dir,
88
+ "package.json",
89
+ JSON.stringify({
90
+ dependencies: { alpha: "^1.0.0", beta: "^2.0.0" },
91
+ devDependencies: { gamma: "^3.0.0" },
92
+ })
93
+ );
94
+ const result = await discover(dir);
95
+ assert.deepEqual(
96
+ result.dependencies.map((d) => d.name),
97
+ ["alpha", "beta", "gamma"]
98
+ );
99
+ assert.equal(result.dependencies[0].confidence, "detected");
100
+ assert.equal(result.dependencies[0].evidence, "package.json");
101
+ });
102
+
103
+ it("detects dependencies from requirements.txt", async (t) => {
104
+ const dir = await tempDir(t);
105
+ await write(dir, "requirements.txt", "alpha==1.0\nbeta>=2.0\n");
106
+ const result = await discover(dir);
107
+ assert.deepEqual(
108
+ result.dependencies.map((d) => d.name),
109
+ ["alpha", "beta"]
110
+ );
111
+ });
112
+
113
+ it("detects dependencies from go.mod", async (t) => {
114
+ const dir = await tempDir(t);
115
+ await write(
116
+ dir,
117
+ "go.mod",
118
+ "module example.com/demo\n\ngo 1.21\n\nrequire (\n\tgithub.com/example/alpha v1.0.0\n\tgithub.com/example/beta/v4 v4.0.0\n)\n"
119
+ );
120
+ const result = await discover(dir);
121
+ assert.deepEqual(
122
+ result.dependencies.map((d) => d.name),
123
+ ["alpha", "beta"]
124
+ );
125
+ });
126
+
84
127
  it("skips venv, target, and .next dirs", async (t) => {
85
128
  const dir = await tempDir(t);
86
129
  await write(dir, "package.json", "{}");
@@ -163,6 +206,35 @@ describe("init", () => {
163
206
  assert.ok(filled.includes("- Monorepo. No"));
164
207
  });
165
208
 
209
+ it("fillArchitecture leaves framework as TBD", () => {
210
+ const filled = fillArchitecture("- Language. TBD\n- Framework. TBD\n", {
211
+ stacks: [{ name: "JavaScript", evidence: "package.json", confidence: "high" }],
212
+ monorepo: false,
213
+ });
214
+ assert.ok(filled.includes("- Framework. TBD"));
215
+ });
216
+
217
+ it("writes detected dependencies into docs", async (t) => {
218
+ const dir = await tempDir(t);
219
+ await write(
220
+ dir,
221
+ "package.json",
222
+ JSON.stringify({ dependencies: { alpha: "^1.0.0" } })
223
+ );
224
+ await runInit({ target: dir });
225
+ const arch = await readFile(
226
+ join(dir, "markflow/docs/ARCHITECTURE.md"),
227
+ "utf8"
228
+ );
229
+ assert.ok(arch.includes("- Framework. TBD"));
230
+ const stack = await readFile(
231
+ join(dir, "markflow/docs/STACK.md"),
232
+ "utf8"
233
+ );
234
+ assert.ok(stack.includes("## Detected dependencies"));
235
+ assert.ok(stack.includes("- alpha from package.json, detected"));
236
+ });
237
+
166
238
  it("fillArchitecture throws when template lines are missing", () => {
167
239
  assert.throws(
168
240
  () =>
@@ -214,6 +286,47 @@ describe("init", () => {
214
286
  assert.equal(marker.minimal, false);
215
287
  });
216
288
 
289
+ it("created AGENTS.md points to onboarding", async (t) => {
290
+ const dir = await tempDir(t);
291
+ await runInit({ target: dir });
292
+ const text = await readFile(join(dir, "AGENTS.md"), "utf8");
293
+ assert.ok(text.includes("markflow/.agents/workflows/onboarding.md"));
294
+ });
295
+
296
+ it("onboarding asks the two language questions", async (t) => {
297
+ const dir = await tempDir(t);
298
+ await runInit({ target: dir });
299
+ const workflow = await readFile(
300
+ join(dir, "markflow/.agents/workflows/onboarding.md"),
301
+ "utf8"
302
+ );
303
+ assert.ok(workflow.includes("which language to use in this conversation"));
304
+ assert.ok(workflow.includes("which language to use for docs and code comments"));
305
+ assert.ok(workflow.includes("Code names stay in English"));
306
+ const prd = await readFile(join(dir, "markflow/docs/PRD.md"), "utf8");
307
+ assert.ok(prd.includes("## Language"));
308
+ assert.ok(prd.includes("- Conversation. TBD"));
309
+ assert.ok(prd.includes("- Docs. TBD"));
310
+ });
311
+
312
+ it("tasks list the first five steps and review names the user as approver", async (t) => {
313
+ const dir = await tempDir(t);
314
+ await runInit({ target: dir });
315
+ const tasks = await readFile(join(dir, "markflow/TASKS.md"), "utf8");
316
+ assert.ok(tasks.includes("Finish onboarding in markflow/.agents/workflows/onboarding.md"));
317
+ assert.ok(tasks.includes("Write spec 01 from markflow/specs/_template.md"));
318
+ assert.ok(tasks.includes("Review spec 01 with review-spec.md"));
319
+ assert.ok(tasks.includes("Build spec 01 with implement-spec.md"));
320
+ assert.ok(tasks.includes("Update TASKS.md when spec 01 is done"));
321
+ const review = await readFile(
322
+ join(dir, "markflow/.agents/workflows/review-spec.md"),
323
+ "utf8"
324
+ );
325
+ assert.ok(review.includes("Only the user marks a spec Approved"));
326
+ assert.ok(review.includes("change Draft to Approved in the spec and in specs/index.md"));
327
+ assert.ok(review.includes("Then coding starts with implement-spec"));
328
+ });
329
+
217
330
  it("init suggests onboarding on first run only", async (t) => {
218
331
  const dir = await tempDir(t);
219
332
  const first = await runInit({ target: dir });
@@ -258,6 +371,62 @@ describe("doctor", () => {
258
371
  assert.ok(result.warnings.some((w) => w.includes("99-new.md")));
259
372
  });
260
373
 
374
+ it("spec listed by file name in index passes", async (t) => {
375
+ const dir = await tempDir(t);
376
+ await runInit({ target: dir });
377
+ const index = await readFile(
378
+ join(dir, "markflow/specs/index.md"),
379
+ "utf8"
380
+ );
381
+ assert.ok(index.includes("| ID | File | Title | Status |"));
382
+ assert.ok(index.includes("Write the file name in the File column."));
383
+ await write(
384
+ dir,
385
+ "markflow/specs/01-record-a-sale.md",
386
+ "# Record a sale\n\n## Goal\n\nRecord one sale.\n\n## Acceptance\n\n- The sale is saved.\n\n## Status\n\nDraft\n"
387
+ );
388
+ await write(
389
+ dir,
390
+ "markflow/specs/index.md",
391
+ index.replace(
392
+ "| 01 | TBD | TBD | Draft |",
393
+ "| 01 | 01-record-a-sale.md | Record a sale | Draft |"
394
+ )
395
+ );
396
+ const result = await runDoctor({ target: dir });
397
+ assert.equal(result.ok, true);
398
+ assert.ok(
399
+ !result.warnings.some((w) => w.includes("01-record-a-sale.md"))
400
+ );
401
+ });
402
+
403
+ it("spec listed by title only still warns", async (t) => {
404
+ const dir = await tempDir(t);
405
+ await runInit({ target: dir });
406
+ const index = await readFile(
407
+ join(dir, "markflow/specs/index.md"),
408
+ "utf8"
409
+ );
410
+ await write(
411
+ dir,
412
+ "markflow/specs/01-record-a-sale.md",
413
+ "# Record a sale\n\n## Goal\n\nRecord one sale.\n\n## Acceptance\n\n- The sale is saved.\n\n## Status\n\nDraft\n"
414
+ );
415
+ await write(
416
+ dir,
417
+ "markflow/specs/index.md",
418
+ index.replace(
419
+ "| 01 | TBD | TBD | Draft |",
420
+ "| 01 | TBD | Record a sale | Draft |"
421
+ )
422
+ );
423
+ const result = await runDoctor({ target: dir });
424
+ assert.equal(result.ok, true);
425
+ assert.ok(
426
+ result.warnings.some((w) => w.includes("01-record-a-sale.md"))
427
+ );
428
+ });
429
+
261
430
  it("warns on empty acceptance in a spec", async (t) => {
262
431
  const dir = await tempDir(t);
263
432
  await runInit({ target: dir });
@@ -306,6 +475,28 @@ describe("doctor", () => {
306
475
  assert.ok(result.warnings.includes("markflow/docs/PRD.md"));
307
476
  });
308
477
 
478
+ it("splits the TBD count into now and later", async (t) => {
479
+ const dir = await tempDir(t);
480
+ await runInit({ target: dir });
481
+ const result = runCli(["doctor"], dir);
482
+ assert.match(result.stdout, /20 TBD left to decide now\./);
483
+ assert.match(result.stdout, /39 TBD left for later\./);
484
+ assert.ok(!result.stdout.includes("TBD left in docs"));
485
+ });
486
+
487
+ it("moves a real spec TBD into the now count", async (t) => {
488
+ const dir = await tempDir(t);
489
+ await runInit({ target: dir });
490
+ await write(
491
+ dir,
492
+ "markflow/specs/01-test.md",
493
+ "# 01 Test\n\n## Status\n\nDraft\n\nTBD\n"
494
+ );
495
+ const result = runCli(["doctor"], dir);
496
+ assert.match(result.stdout, /21 TBD left to decide now\./);
497
+ assert.match(result.stdout, /39 TBD left for later\./);
498
+ });
499
+
309
500
  it("warns when instruction text is left visible", async (t) => {
310
501
  const dir = await tempDir(t);
311
502
  await runInit({ target: dir });
@@ -358,6 +549,28 @@ describe("doctor", () => {
358
549
  assert.equal(result.errors.length, 0);
359
550
  });
360
551
 
552
+ it("warns when ARCHITECTURE and TASKS are still the template", async (t) => {
553
+ const dir = await tempDir(t);
554
+ await runInit({ target: dir });
555
+ const result = await runDoctor({ target: dir });
556
+ assert.equal(result.ok, true);
557
+ assert.ok(result.warnings.includes("markflow/docs/ARCHITECTURE.md"));
558
+ assert.ok(result.warnings.includes("markflow/TASKS.md"));
559
+ });
560
+
561
+ it("no template warnings when all three are filled", async (t) => {
562
+ const dir = await tempDir(t);
563
+ await runInit({ target: dir });
564
+ await write(dir, "markflow/docs/PRD.md", "Our own product.\n");
565
+ await write(dir, "markflow/docs/ARCHITECTURE.md", "Our own stack.\n");
566
+ await write(dir, "markflow/TASKS.md", "Our own tasks.\n");
567
+ const result = await runDoctor({ target: dir });
568
+ assert.equal(result.ok, true);
569
+ assert.ok(!result.warnings.includes("markflow/docs/PRD.md"));
570
+ assert.ok(!result.warnings.includes("markflow/docs/ARCHITECTURE.md"));
571
+ assert.ok(!result.warnings.includes("markflow/TASKS.md"));
572
+ });
573
+
361
574
  it("no PRD warning when PRD is filled", async (t) => {
362
575
  const dir = await tempDir(t);
363
576
  await runInit({ target: dir });
@@ -552,7 +765,7 @@ describe("parser", () => {
552
765
  const dir = await tempDir(t);
553
766
  const result = runCli(["--version"], dir);
554
767
  assert.equal(result.status, 0);
555
- assert.equal(result.stdout.trim(), "0.2.0");
768
+ assert.equal(result.stdout.trim(), "0.4.0");
556
769
  });
557
770
  });
558
771