@moritakaaz/markflow 0.4.1 → 0.4.3
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 +1 -1
- package/src/doctor.js +50 -5
- package/src/update.js +10 -2
- package/src/versions.js +2 -2
- package/templates/AGENTS.md +10 -1
- package/templates/markflow/docs/PRD.md +2 -2
- package/test/cli.test.js +203 -11
package/package.json
CHANGED
package/src/doctor.js
CHANGED
|
@@ -127,6 +127,16 @@ function sectionLines(text, heading) {
|
|
|
127
127
|
return out;
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
+
// A spec counts as listed only when its exact file name appears.
|
|
131
|
+
// A substring match would also match old-login.md for login.md.
|
|
132
|
+
// A path form such as specs/login.md also counts.
|
|
133
|
+
function indexLists(indexText, name) {
|
|
134
|
+
if (indexText.split(/[\s|,()]+/).includes(name)) {
|
|
135
|
+
return true;
|
|
136
|
+
}
|
|
137
|
+
return indexText.includes("/" + name);
|
|
138
|
+
}
|
|
139
|
+
|
|
130
140
|
function findLinks(text) {
|
|
131
141
|
const links = [];
|
|
132
142
|
const re = /\[[^\]]*\]\(([^)\s]+)\)/g;
|
|
@@ -202,7 +212,7 @@ export async function runDoctor(options) {
|
|
|
202
212
|
break;
|
|
203
213
|
}
|
|
204
214
|
}
|
|
205
|
-
const count =
|
|
215
|
+
const count = visible.split("TBD").length - 1;
|
|
206
216
|
if (isTbdNow(rel)) {
|
|
207
217
|
tbdNow += count;
|
|
208
218
|
} else {
|
|
@@ -256,6 +266,24 @@ export async function runDoctor(options) {
|
|
|
256
266
|
if (stillTemplate.length > 0) {
|
|
257
267
|
console.log("Next. Fill " + stillTemplate[0] + ".");
|
|
258
268
|
}
|
|
269
|
+
if (!stillTemplate.includes("markflow/docs/PRD.md")) {
|
|
270
|
+
try {
|
|
271
|
+
const prdText = await readFile(
|
|
272
|
+
join(root, "markflow/docs/PRD.md"),
|
|
273
|
+
"utf8"
|
|
274
|
+
);
|
|
275
|
+
const language = sectionLines(prdText, "Language");
|
|
276
|
+
if (
|
|
277
|
+
language !== null &&
|
|
278
|
+
language.some((line) => line.includes("TBD"))
|
|
279
|
+
) {
|
|
280
|
+
console.log("Warning Language not answered in markflow/docs/PRD.md");
|
|
281
|
+
warnings.push("markflow/docs/PRD.md");
|
|
282
|
+
}
|
|
283
|
+
} catch {
|
|
284
|
+
// Missing PRD is already reported above.
|
|
285
|
+
}
|
|
286
|
+
}
|
|
259
287
|
let specTotal = 0;
|
|
260
288
|
let specDraft = 0;
|
|
261
289
|
try {
|
|
@@ -273,10 +301,14 @@ export async function runDoctor(options) {
|
|
|
273
301
|
specTotal += 1;
|
|
274
302
|
const text = await readFile(file, "utf8");
|
|
275
303
|
const rel = file.slice(root.length + 1);
|
|
276
|
-
|
|
304
|
+
const status = sectionLines(text, "Status");
|
|
305
|
+
if (
|
|
306
|
+
status !== null &&
|
|
307
|
+
status.some((line) => line.trim() === "Draft")
|
|
308
|
+
) {
|
|
277
309
|
specDraft += 1;
|
|
278
310
|
}
|
|
279
|
-
if (!indexText
|
|
311
|
+
if (!indexLists(indexText, name)) {
|
|
280
312
|
console.log("Warning Spec not listed in index " + rel);
|
|
281
313
|
warnings.push(rel);
|
|
282
314
|
}
|
|
@@ -290,15 +322,28 @@ export async function runDoctor(options) {
|
|
|
290
322
|
warnings.push(rel);
|
|
291
323
|
}
|
|
292
324
|
}
|
|
293
|
-
const status = sectionLines(text, "Status");
|
|
294
325
|
if (
|
|
295
326
|
status !== null &&
|
|
296
327
|
status.some((line) => line.trim() === "Approved") &&
|
|
297
|
-
text.includes("TBD")
|
|
328
|
+
stripComments(text).includes("TBD")
|
|
298
329
|
) {
|
|
299
330
|
console.log("Warning Approved spec still has TBD in " + rel);
|
|
300
331
|
warnings.push(rel);
|
|
301
332
|
}
|
|
333
|
+
if (status !== null) {
|
|
334
|
+
const statusLines = stripComments(status.join("\n"))
|
|
335
|
+
.split("\n")
|
|
336
|
+
.map((line) => line.trim())
|
|
337
|
+
.filter((line) => line !== "");
|
|
338
|
+
if (
|
|
339
|
+
statusLines.length > 0 &&
|
|
340
|
+
!statusLines.includes("Draft") &&
|
|
341
|
+
!statusLines.includes("Approved")
|
|
342
|
+
) {
|
|
343
|
+
console.log("Warning Unknown status in " + rel);
|
|
344
|
+
warnings.push(rel);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
302
347
|
}
|
|
303
348
|
} catch {
|
|
304
349
|
// Missing specs folder is already reported above.
|
package/src/update.js
CHANGED
|
@@ -73,8 +73,16 @@ export async function runUpdate(options) {
|
|
|
73
73
|
return;
|
|
74
74
|
}
|
|
75
75
|
if (userOwned) {
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
if (storedMap[rel] && hashText(current) === storedMap[rel]) {
|
|
77
|
+
console.log("Kept " + rel + ", user owned.");
|
|
78
|
+
kept += 1;
|
|
79
|
+
} else if (storedMap[rel]) {
|
|
80
|
+
console.log("Skipped " + rel + ", modified.");
|
|
81
|
+
skipped += 1;
|
|
82
|
+
} else {
|
|
83
|
+
console.log("Skipped " + rel + ", user owned.");
|
|
84
|
+
skipped += 1;
|
|
85
|
+
}
|
|
78
86
|
return;
|
|
79
87
|
}
|
|
80
88
|
if (storedMap[rel] && hashText(current) === storedMap[rel]) {
|
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.4.
|
|
6
|
-
export const TEMPLATE_VERSION = "0.4.
|
|
5
|
+
export const METHODOLOGY_VERSION = "0.4.3";
|
|
6
|
+
export const TEMPLATE_VERSION = "0.4.3";
|
package/templates/AGENTS.md
CHANGED
|
@@ -17,7 +17,16 @@ Start with these files in order.
|
|
|
17
17
|
|
|
18
18
|
## Rules you must not break
|
|
19
19
|
|
|
20
|
-
- Code is in English. Docs are in English for this template. Change the doc language in `markflow/docs/PRD.md` when the project needs another language.
|
|
20
|
+
- Code is in English. Docs are in English for this template. Change the doc language in `markflow/docs/PRD.md` when the project needs another language. The Markflow repo itself is English only. Your project is not.
|
|
21
|
+
- Use English in file and folder names too.
|
|
22
|
+
- Keep these words in English in every doc. Status, Acceptance, Approved, Draft, and TBD. Doctor reads them. Write the rest in any language.
|
|
23
|
+
- Write short sentences. Write like you talk to a teammate. Avoid em dashes. Avoid colons in prose. Avoid formal and cliché words. Avoid words like delve, leverage, seamless, robust, and cutting edge.
|
|
24
|
+
- Use contractions in English. Write don't instead of do not when it sounds natural.
|
|
25
|
+
- Keep commits small. One logical change per commit. Use the imperative mood. Keep the subject short and clear. Good examples are Add README and Fix typo in PRINCIPLES.
|
|
26
|
+
- Do not invent architecture or decisions. If you do not know something, say so and ask. Do not overwrite user files without approval. Do not change code outside the scope of your task.
|
|
27
|
+
- Every doc file starts with a short note on what it is for and when to read it. Keep the README short. Put details in docs.
|
|
28
|
+
- Name files the way the language expects. Use kebab-case when the language has no rule.
|
|
29
|
+
- Write a comment only when logic is hard to follow without it. Use simple comments. For one line use //. For many lines use /* */. Do not use decorative comment lines.
|
|
21
30
|
- All code lives in the source folder found during discovery. Tests live in the test folder found during discovery. Do not create new top level folders for code.
|
|
22
31
|
- Specs in `markflow/specs` are the source for intent and requirements. If code differs from a spec, stop and check both. Do not assume the spec is always right.
|
|
23
32
|
- Every claim in a doc comes from one of three places. What the user said. What the code shows. Or TBD. Never invent a decision or an architecture detail.
|
|
@@ -12,8 +12,8 @@ Do not read when. You need code detail. Open a spec in `specs` instead.
|
|
|
12
12
|
|
|
13
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
14
|
|
|
15
|
-
- Conversation. TBD
|
|
16
|
-
- Docs. TBD
|
|
15
|
+
- Conversation language. TBD
|
|
16
|
+
- Docs language. TBD
|
|
17
17
|
|
|
18
18
|
## Users
|
|
19
19
|
|
package/test/cli.test.js
CHANGED
|
@@ -309,8 +309,8 @@ describe("init", () => {
|
|
|
309
309
|
);
|
|
310
310
|
const prd = await readFile(join(dir, "markflow/docs/PRD.md"), "utf8");
|
|
311
311
|
assert.ok(prd.includes("## Language"));
|
|
312
|
-
assert.ok(prd.includes("- Conversation. TBD"));
|
|
313
|
-
assert.ok(prd.includes("- Docs. TBD"));
|
|
312
|
+
assert.ok(prd.includes("- Conversation language. TBD"));
|
|
313
|
+
assert.ok(prd.includes("- Docs language. TBD"));
|
|
314
314
|
});
|
|
315
315
|
|
|
316
316
|
it("tasks list the first five steps and review names the user as approver", async (t) => {
|
|
@@ -404,6 +404,81 @@ describe("doctor", () => {
|
|
|
404
404
|
);
|
|
405
405
|
});
|
|
406
406
|
|
|
407
|
+
it("spec with a similar name in index still warns", async (t) => {
|
|
408
|
+
const dir = await tempDir(t);
|
|
409
|
+
await runInit({ target: dir });
|
|
410
|
+
await write(
|
|
411
|
+
dir,
|
|
412
|
+
"markflow/specs/login.md",
|
|
413
|
+
"# Login\n\n## Goal\n\nLog in.\n\n## Acceptance\n\n- The user logs in.\n\n## Status\n\nDraft\n"
|
|
414
|
+
);
|
|
415
|
+
const index = await readFile(
|
|
416
|
+
join(dir, "markflow/specs/index.md"),
|
|
417
|
+
"utf8"
|
|
418
|
+
);
|
|
419
|
+
await write(
|
|
420
|
+
dir,
|
|
421
|
+
"markflow/specs/index.md",
|
|
422
|
+
index.replace(
|
|
423
|
+
"| 01 | TBD | TBD | Draft |",
|
|
424
|
+
"| 01 | old-login.md | Old login | Draft |"
|
|
425
|
+
)
|
|
426
|
+
);
|
|
427
|
+
const result = await runDoctor({ target: dir });
|
|
428
|
+
assert.equal(result.ok, true);
|
|
429
|
+
assert.ok(result.warnings.some((w) => w.includes("login.md")));
|
|
430
|
+
});
|
|
431
|
+
|
|
432
|
+
it("spec listed as a path passes", async (t) => {
|
|
433
|
+
const dir = await tempDir(t);
|
|
434
|
+
await runInit({ target: dir });
|
|
435
|
+
await write(
|
|
436
|
+
dir,
|
|
437
|
+
"markflow/specs/login.md",
|
|
438
|
+
"# Login\n\n## Goal\n\nLog in.\n\n## Acceptance\n\n- The user logs in.\n\n## Status\n\nDraft\n"
|
|
439
|
+
);
|
|
440
|
+
const index = await readFile(
|
|
441
|
+
join(dir, "markflow/specs/index.md"),
|
|
442
|
+
"utf8"
|
|
443
|
+
);
|
|
444
|
+
await write(
|
|
445
|
+
dir,
|
|
446
|
+
"markflow/specs/index.md",
|
|
447
|
+
index.replace(
|
|
448
|
+
"| 01 | TBD | TBD | Draft |",
|
|
449
|
+
"| 01 | specs/login.md | Login | Draft |"
|
|
450
|
+
)
|
|
451
|
+
);
|
|
452
|
+
const result = await runDoctor({ target: dir });
|
|
453
|
+
assert.equal(result.ok, true);
|
|
454
|
+
assert.ok(!result.warnings.some((w) => w.includes("login.md")));
|
|
455
|
+
});
|
|
456
|
+
|
|
457
|
+
it("spec listed as a markdown link passes", async (t) => {
|
|
458
|
+
const dir = await tempDir(t);
|
|
459
|
+
await runInit({ target: dir });
|
|
460
|
+
await write(
|
|
461
|
+
dir,
|
|
462
|
+
"markflow/specs/login.md",
|
|
463
|
+
"# Login\n\n## Goal\n\nLog in.\n\n## Acceptance\n\n- The user logs in.\n\n## Status\n\nDraft\n"
|
|
464
|
+
);
|
|
465
|
+
const index = await readFile(
|
|
466
|
+
join(dir, "markflow/specs/index.md"),
|
|
467
|
+
"utf8"
|
|
468
|
+
);
|
|
469
|
+
await write(
|
|
470
|
+
dir,
|
|
471
|
+
"markflow/specs/index.md",
|
|
472
|
+
index.replace(
|
|
473
|
+
"| 01 | TBD | TBD | Draft |",
|
|
474
|
+
"| 01 | [Login](login.md) | Login | Draft |"
|
|
475
|
+
)
|
|
476
|
+
);
|
|
477
|
+
const result = await runDoctor({ target: dir });
|
|
478
|
+
assert.equal(result.ok, true);
|
|
479
|
+
assert.ok(!result.warnings.some((w) => w.includes("login.md")));
|
|
480
|
+
});
|
|
481
|
+
|
|
407
482
|
it("spec listed by title only still warns", async (t) => {
|
|
408
483
|
const dir = await tempDir(t);
|
|
409
484
|
await runInit({ target: dir });
|
|
@@ -471,6 +546,98 @@ describe("doctor", () => {
|
|
|
471
546
|
);
|
|
472
547
|
});
|
|
473
548
|
|
|
549
|
+
it("Indonesian spec with English keywords passes", async (t) => {
|
|
550
|
+
const dir = await tempDir(t);
|
|
551
|
+
await runInit({ target: dir });
|
|
552
|
+
const agents = await readFile(join(dir, "AGENTS.md"), "utf8");
|
|
553
|
+
assert.ok(agents.includes("Keep these words in English in every doc."));
|
|
554
|
+
await write(
|
|
555
|
+
dir,
|
|
556
|
+
"markflow/specs/01-masuk.md",
|
|
557
|
+
"# Masuk\n\n## Goal\n\nPengguna bisa masuk.\n\n## Acceptance\n\n- Pengguna masuk dengan kata sandi yang benar.\n- Pengguna gagal masuk dengan kata sandi yang salah.\n\n## Status\n\nApproved\n"
|
|
558
|
+
);
|
|
559
|
+
const index = await readFile(
|
|
560
|
+
join(dir, "markflow/specs/index.md"),
|
|
561
|
+
"utf8"
|
|
562
|
+
);
|
|
563
|
+
await write(
|
|
564
|
+
dir,
|
|
565
|
+
"markflow/specs/index.md",
|
|
566
|
+
index.replace(
|
|
567
|
+
"| 01 | TBD | TBD | Draft |",
|
|
568
|
+
"| 01 | 01-masuk.md | Masuk | Approved |"
|
|
569
|
+
)
|
|
570
|
+
);
|
|
571
|
+
const result = await runDoctor({ target: dir });
|
|
572
|
+
assert.equal(result.ok, true);
|
|
573
|
+
assert.ok(!result.warnings.some((w) => w.includes("01-masuk.md")));
|
|
574
|
+
const counts = runCli(["doctor"], dir);
|
|
575
|
+
assert.match(counts.stdout, /1 specs, 0 draft\./);
|
|
576
|
+
});
|
|
577
|
+
|
|
578
|
+
it("warns on unknown status value", async (t) => {
|
|
579
|
+
const dir = await tempDir(t);
|
|
580
|
+
await runInit({ target: dir });
|
|
581
|
+
await write(
|
|
582
|
+
dir,
|
|
583
|
+
"markflow/specs/01-test.md",
|
|
584
|
+
"# Test spec\n\n## Goal\n\nDo a thing.\n\n## Acceptance\n\n- The thing works.\n\n## Status\n\nDisetujui\n"
|
|
585
|
+
);
|
|
586
|
+
const index = await readFile(
|
|
587
|
+
join(dir, "markflow/specs/index.md"),
|
|
588
|
+
"utf8"
|
|
589
|
+
);
|
|
590
|
+
await write(dir, "markflow/specs/index.md", index + "\n01-test.md\n");
|
|
591
|
+
const result = await runDoctor({ target: dir });
|
|
592
|
+
assert.equal(result.ok, true);
|
|
593
|
+
assert.ok(result.warnings.some((w) => w.includes("01-test.md")));
|
|
594
|
+
const counts = runCli(["doctor"], dir);
|
|
595
|
+
assert.match(counts.stdout, /1 specs, 0 draft\./);
|
|
596
|
+
});
|
|
597
|
+
|
|
598
|
+
it("approved spec with Draft in a note is not a draft", async (t) => {
|
|
599
|
+
const dir = await tempDir(t);
|
|
600
|
+
await runInit({ target: dir });
|
|
601
|
+
await write(
|
|
602
|
+
dir,
|
|
603
|
+
"markflow/specs/01-test.md",
|
|
604
|
+
"# Test spec\n\n## Goal\n\nDo a thing.\n\n## Acceptance\n\n- The thing works.\n\n## Status\n\nApproved\n\nNote. Draft copy was reviewed by the team.\n"
|
|
605
|
+
);
|
|
606
|
+
const index = await readFile(
|
|
607
|
+
join(dir, "markflow/specs/index.md"),
|
|
608
|
+
"utf8"
|
|
609
|
+
);
|
|
610
|
+
await write(dir, "markflow/specs/index.md", index + "\n01-test.md\n");
|
|
611
|
+
const result = runCli(["doctor"], dir);
|
|
612
|
+
assert.match(result.stdout, /1 specs, 0 draft\./);
|
|
613
|
+
});
|
|
614
|
+
|
|
615
|
+
it("warns when language is not answered in PRD", async (t) => {
|
|
616
|
+
const dir = await tempDir(t);
|
|
617
|
+
await runInit({ target: dir });
|
|
618
|
+
await write(
|
|
619
|
+
dir,
|
|
620
|
+
"markflow/docs/PRD.md",
|
|
621
|
+
"Our own product.\n\n## Language\n\n- Conversation language. Indonesian\n- Docs language. TBD\n"
|
|
622
|
+
);
|
|
623
|
+
const result = await runDoctor({ target: dir });
|
|
624
|
+
assert.equal(result.ok, true);
|
|
625
|
+
assert.ok(result.warnings.includes("markflow/docs/PRD.md"));
|
|
626
|
+
});
|
|
627
|
+
|
|
628
|
+
it("no language warning when both languages are answered", async (t) => {
|
|
629
|
+
const dir = await tempDir(t);
|
|
630
|
+
await runInit({ target: dir });
|
|
631
|
+
await write(
|
|
632
|
+
dir,
|
|
633
|
+
"markflow/docs/PRD.md",
|
|
634
|
+
"Our own product.\n\n## Language\n\n- Conversation language. Indonesian\n- Docs language. Indonesian\n"
|
|
635
|
+
);
|
|
636
|
+
const result = await runDoctor({ target: dir });
|
|
637
|
+
assert.equal(result.ok, true);
|
|
638
|
+
assert.ok(!result.warnings.includes("markflow/docs/PRD.md"));
|
|
639
|
+
});
|
|
640
|
+
|
|
474
641
|
it("warns when PRD is still the template", async (t) => {
|
|
475
642
|
const dir = await tempDir(t);
|
|
476
643
|
await runInit({ target: dir });
|
|
@@ -483,11 +650,20 @@ describe("doctor", () => {
|
|
|
483
650
|
const dir = await tempDir(t);
|
|
484
651
|
await runInit({ target: dir });
|
|
485
652
|
const result = runCli(["doctor"], dir);
|
|
486
|
-
assert.match(result.stdout, /
|
|
487
|
-
assert.match(result.stdout, /
|
|
653
|
+
assert.match(result.stdout, /19 TBD left to decide now\./);
|
|
654
|
+
assert.match(result.stdout, /37 TBD left for later\./);
|
|
488
655
|
assert.ok(!result.stdout.includes("TBD left in docs"));
|
|
489
656
|
});
|
|
490
657
|
|
|
658
|
+
it("hidden TBD in a comment is not counted", async (t) => {
|
|
659
|
+
const dir = await tempDir(t);
|
|
660
|
+
await runInit({ target: dir });
|
|
661
|
+
const prd = await readFile(join(dir, "markflow/docs/PRD.md"), "utf8");
|
|
662
|
+
await write(dir, "markflow/docs/PRD.md", prd + "\n<!-- TBD -->\n");
|
|
663
|
+
const result = runCli(["doctor"], dir);
|
|
664
|
+
assert.match(result.stdout, /19 TBD left to decide now\./);
|
|
665
|
+
});
|
|
666
|
+
|
|
491
667
|
it("moves a real spec TBD into the now count", async (t) => {
|
|
492
668
|
const dir = await tempDir(t);
|
|
493
669
|
await runInit({ target: dir });
|
|
@@ -497,8 +673,8 @@ describe("doctor", () => {
|
|
|
497
673
|
"# 01 Test\n\n## Status\n\nDraft\n\nTBD\n"
|
|
498
674
|
);
|
|
499
675
|
const result = runCli(["doctor"], dir);
|
|
500
|
-
assert.match(result.stdout, /
|
|
501
|
-
assert.match(result.stdout, /
|
|
676
|
+
assert.match(result.stdout, /20 TBD left to decide now\./);
|
|
677
|
+
assert.match(result.stdout, /37 TBD left for later\./);
|
|
502
678
|
});
|
|
503
679
|
|
|
504
680
|
it("warns when instruction text is left visible", async (t) => {
|
|
@@ -619,7 +795,8 @@ describe("update", () => {
|
|
|
619
795
|
const result = await runUpdate({ target: dir });
|
|
620
796
|
assert.equal(result.ok, true);
|
|
621
797
|
assert.equal(result.updated, 0);
|
|
622
|
-
assert.equal(result.skipped,
|
|
798
|
+
assert.equal(result.skipped, 1);
|
|
799
|
+
assert.equal(result.kept, 2);
|
|
623
800
|
const after = await readFile(join(dir, "markflow/docs/PRD.md"), "utf8");
|
|
624
801
|
assert.equal(after, "MY OWN PRD TEXT\n");
|
|
625
802
|
});
|
|
@@ -641,7 +818,8 @@ describe("update", () => {
|
|
|
641
818
|
const result = await runUpdate({ target: dir });
|
|
642
819
|
assert.equal(result.ok, true);
|
|
643
820
|
assert.equal(result.updated, 0);
|
|
644
|
-
assert.equal(result.skipped,
|
|
821
|
+
assert.equal(result.skipped, 0);
|
|
822
|
+
assert.equal(result.kept, 2);
|
|
645
823
|
const archAfter = await readFile(
|
|
646
824
|
join(dir, "markflow/docs/ARCHITECTURE.md"),
|
|
647
825
|
"utf8"
|
|
@@ -654,6 +832,19 @@ describe("update", () => {
|
|
|
654
832
|
assert.ok(stackAfter.includes("Detected stacks"));
|
|
655
833
|
});
|
|
656
834
|
|
|
835
|
+
it("untouched user owned file is kept, not skipped", async (t) => {
|
|
836
|
+
const dir = await tempDir(t);
|
|
837
|
+
await write(dir, "package.json", "{}");
|
|
838
|
+
await runInit({ target: dir, minimal: true });
|
|
839
|
+
const result = runCli(["update", "--preview"], dir);
|
|
840
|
+
assert.ok(
|
|
841
|
+
result.stdout.includes("Kept docs/ARCHITECTURE.md, user owned.")
|
|
842
|
+
);
|
|
843
|
+
assert.ok(
|
|
844
|
+
!result.stdout.includes("Skipped docs/ARCHITECTURE.md")
|
|
845
|
+
);
|
|
846
|
+
});
|
|
847
|
+
|
|
657
848
|
it("restores ARCHITECTURE.md when missing", async (t) => {
|
|
658
849
|
const dir = await tempDir(t);
|
|
659
850
|
await write(dir, "package.json", "{}");
|
|
@@ -677,7 +868,8 @@ describe("update", () => {
|
|
|
677
868
|
const result = await runUpdate({ target: dir });
|
|
678
869
|
assert.equal(result.ok, true);
|
|
679
870
|
assert.equal(result.restored, 1);
|
|
680
|
-
assert.equal(result.skipped,
|
|
871
|
+
assert.equal(result.skipped, 1);
|
|
872
|
+
assert.equal(result.kept, 2);
|
|
681
873
|
const tasks = await readFile(join(dir, "markflow/TASKS.md"), "utf8");
|
|
682
874
|
assert.equal(tasks, "my own notes\n");
|
|
683
875
|
});
|
|
@@ -709,7 +901,7 @@ describe("update", () => {
|
|
|
709
901
|
marker.files["docs/OLD.md"] = "abc123";
|
|
710
902
|
await writeFile(markerPath, JSON.stringify(marker, null, 2));
|
|
711
903
|
const result = await runUpdate({ target: dir });
|
|
712
|
-
assert.equal(result.kept,
|
|
904
|
+
assert.equal(result.kept, 3);
|
|
713
905
|
});
|
|
714
906
|
|
|
715
907
|
it("no marker fails", async (t) => {
|
|
@@ -769,7 +961,7 @@ describe("parser", () => {
|
|
|
769
961
|
const dir = await tempDir(t);
|
|
770
962
|
const result = runCli(["--version"], dir);
|
|
771
963
|
assert.equal(result.status, 0);
|
|
772
|
-
assert.equal(result.stdout.trim(), "0.4.
|
|
964
|
+
assert.equal(result.stdout.trim(), "0.4.3");
|
|
773
965
|
});
|
|
774
966
|
});
|
|
775
967
|
|