@moritakaaz/markflow 0.4.2 → 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 +37 -1
- package/src/versions.js +2 -2
- package/templates/AGENTS.md +8 -0
- package/templates/markflow/docs/PRD.md +2 -2
- package/test/cli.test.js +99 -3
package/package.json
CHANGED
package/src/doctor.js
CHANGED
|
@@ -129,8 +129,12 @@ function sectionLines(text, heading) {
|
|
|
129
129
|
|
|
130
130
|
// A spec counts as listed only when its exact file name appears.
|
|
131
131
|
// A substring match would also match old-login.md for login.md.
|
|
132
|
+
// A path form such as specs/login.md also counts.
|
|
132
133
|
function indexLists(indexText, name) {
|
|
133
|
-
|
|
134
|
+
if (indexText.split(/[\s|,()]+/).includes(name)) {
|
|
135
|
+
return true;
|
|
136
|
+
}
|
|
137
|
+
return indexText.includes("/" + name);
|
|
134
138
|
}
|
|
135
139
|
|
|
136
140
|
function findLinks(text) {
|
|
@@ -262,6 +266,24 @@ export async function runDoctor(options) {
|
|
|
262
266
|
if (stillTemplate.length > 0) {
|
|
263
267
|
console.log("Next. Fill " + stillTemplate[0] + ".");
|
|
264
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
|
+
}
|
|
265
287
|
let specTotal = 0;
|
|
266
288
|
let specDraft = 0;
|
|
267
289
|
try {
|
|
@@ -308,6 +330,20 @@ export async function runDoctor(options) {
|
|
|
308
330
|
console.log("Warning Approved spec still has TBD in " + rel);
|
|
309
331
|
warnings.push(rel);
|
|
310
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
|
+
}
|
|
311
347
|
}
|
|
312
348
|
} catch {
|
|
313
349
|
// Missing specs folder is already reported above.
|
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
|
@@ -18,7 +18,15 @@ Start with these files in order.
|
|
|
18
18
|
## Rules you must not break
|
|
19
19
|
|
|
20
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.
|
|
21
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.
|
|
22
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.
|
|
23
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.
|
|
24
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) => {
|
|
@@ -429,6 +429,56 @@ describe("doctor", () => {
|
|
|
429
429
|
assert.ok(result.warnings.some((w) => w.includes("login.md")));
|
|
430
430
|
});
|
|
431
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
|
+
|
|
432
482
|
it("spec listed by title only still warns", async (t) => {
|
|
433
483
|
const dir = await tempDir(t);
|
|
434
484
|
await runInit({ target: dir });
|
|
@@ -525,6 +575,26 @@ describe("doctor", () => {
|
|
|
525
575
|
assert.match(counts.stdout, /1 specs, 0 draft\./);
|
|
526
576
|
});
|
|
527
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
|
+
|
|
528
598
|
it("approved spec with Draft in a note is not a draft", async (t) => {
|
|
529
599
|
const dir = await tempDir(t);
|
|
530
600
|
await runInit({ target: dir });
|
|
@@ -542,6 +612,32 @@ describe("doctor", () => {
|
|
|
542
612
|
assert.match(result.stdout, /1 specs, 0 draft\./);
|
|
543
613
|
});
|
|
544
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
|
+
|
|
545
641
|
it("warns when PRD is still the template", async (t) => {
|
|
546
642
|
const dir = await tempDir(t);
|
|
547
643
|
await runInit({ target: dir });
|
|
@@ -865,7 +961,7 @@ describe("parser", () => {
|
|
|
865
961
|
const dir = await tempDir(t);
|
|
866
962
|
const result = runCli(["--version"], dir);
|
|
867
963
|
assert.equal(result.status, 0);
|
|
868
|
-
assert.equal(result.stdout.trim(), "0.4.
|
|
964
|
+
assert.equal(result.stdout.trim(), "0.4.3");
|
|
869
965
|
});
|
|
870
966
|
});
|
|
871
967
|
|