@moritakaaz/markflow 0.1.0 → 0.3.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/src/update.js CHANGED
@@ -8,6 +8,7 @@ import { hashText } from "./hash.js";
8
8
  import { AGENTS } from "./agents.js";
9
9
  import { findTemplatesDir } from "./templates.js";
10
10
  import { METHODOLOGY_VERSION, TEMPLATE_VERSION } from "./versions.js";
11
+ import { MINIMAL_FILES } from "./minimal.js";
11
12
 
12
13
  async function listFiles(dir, base, out) {
13
14
  const entries = await readdir(dir, { withFileTypes: true });
@@ -21,6 +22,10 @@ async function listFiles(dir, base, out) {
21
22
  }
22
23
  }
23
24
 
25
+ // Files init fills from discovery. After init they belong to the user.
26
+ // Update restores them when missing but never changes their content.
27
+ const USER_OWNED = new Set(["docs/ARCHITECTURE.md", "docs/STACK.md"]);
28
+
24
29
  export async function runUpdate(options) {
25
30
  const preview = options && options.preview;
26
31
  const target = (options && options.target) || process.cwd();
@@ -42,13 +47,17 @@ export async function runUpdate(options) {
42
47
  const rels = [];
43
48
  await listFiles(join(templatesDir, "markflow"), join(templatesDir, "markflow"), rels);
44
49
  const templateSet = new Set(rels);
50
+ const syncRels =
51
+ marker.minimal === true
52
+ ? rels.filter((rel) => MINIMAL_FILES.includes("markflow/" + rel))
53
+ : rels;
45
54
  let updated = 0;
46
55
  let restored = 0;
47
56
  let skipped = 0;
48
57
  let kept = 0;
49
58
  const files = { ...stored };
50
59
  const rootFiles = { ...storedRoot };
51
- async function sync(rel, dest, templateText, storedMap, newMap) {
60
+ async function sync(rel, dest, templateText, storedMap, newMap, userOwned) {
52
61
  const templateHash = hashText(templateText);
53
62
  let current = null;
54
63
  try {
@@ -63,6 +72,11 @@ export async function runUpdate(options) {
63
72
  newMap[rel] = templateHash;
64
73
  return;
65
74
  }
75
+ if (userOwned) {
76
+ console.log("Skipped " + rel + ", user owned.");
77
+ skipped += 1;
78
+ return;
79
+ }
66
80
  if (storedMap[rel] && hashText(current) === storedMap[rel]) {
67
81
  if (templateHash !== storedMap[rel]) {
68
82
  console.log((preview ? "Would update " : "Updated ") + rel);
@@ -77,11 +91,11 @@ export async function runUpdate(options) {
77
91
  console.log("Skipped " + rel + ", modified.");
78
92
  skipped += 1;
79
93
  }
80
- for (const rel of rels) {
94
+ for (const rel of syncRels) {
81
95
  const templateText = (await readFile(join(templatesDir, "markflow", rel), "utf8"))
82
96
  .split("{{project_name}}")
83
97
  .join(projectName);
84
- await sync(rel, join(target, "markflow", rel), templateText, stored, files);
98
+ await sync(rel, join(target, "markflow", rel), templateText, stored, files, USER_OWNED.has(rel));
85
99
  }
86
100
  for (const rel of Object.keys(stored)) {
87
101
  if (!templateSet.has(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.1.0";
6
- export const TEMPLATE_VERSION = "0.1.0";
5
+ export const METHODOLOGY_VERSION = "0.3.0";
6
+ export const TEMPLATE_VERSION = "0.3.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.
@@ -18,6 +20,7 @@ Start with these files in order.
18
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.
19
21
  - 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.
20
22
  - 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
+ - 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.
21
24
  - All links inside `markflow` must be relative to that folder. Do not use absolute paths from the root.
22
25
 
23
26
  ## If you are human and you do not use AI
@@ -1,9 +1,13 @@
1
1
  # PROMPTS.md
2
2
 
3
3
  Purpose. This file holds standard prompts for {{project_name}}.
4
- Read when. You need a prompt for review, refactor, or a new feature.
4
+ Read when. You need a prompt for onboarding, review, refactor, or a new feature.
5
5
  Do not read when. You already have a prompt that works. Use it.
6
6
 
7
+ ## Onboarding
8
+
9
+ Interview me one question at a time. Start with the problem and the users. Then write PRD.md and ARCHITECTURE.md from my answers and from the code. Mark what you do not know as TBD and list the open questions at the end.
10
+
7
11
  ## Code review
8
12
 
9
13
  Review the change against the spec and CODING_STANDARDS.md. List what breaks the spec. List what breaks the standards. Do not praise without reason.
@@ -0,0 +1,22 @@
1
+ # Onboarding
2
+
3
+ Purpose. This file is the SOP to interview a new user and fill the first docs.
4
+ Read when. A project just got Markflow and the PRD is still the template.
5
+ Do not read when. The PRD is already filled. Use the other workflows instead.
6
+
7
+ ## Steps
8
+
9
+ 1. Ask one question at a time. Wait for the answer before you ask the next one.
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.
17
+
18
+ ## Rules
19
+
20
+ - One question per message. No lists of questions.
21
+ - Every claim in PRD.md and ARCHITECTURE.md comes from the user, from the code, or is TBD.
22
+ - Do not write code in this workflow. Docs first. Code starts after the first spec is approved.
@@ -6,11 +6,11 @@ Do not read when. You work on code that does not touch the API.
6
6
 
7
7
  ## Auth
8
8
 
9
- Write how auth works. If there is no auth yet, write TBD.
9
+ <!-- Write how auth works. If there is no auth yet, write TBD. -->
10
10
 
11
11
  ## Endpoints
12
12
 
13
- List each endpoint with method, path, request, and response. Keep each entry short.
13
+ <!-- List each endpoint with method, path, request, and response. Keep each entry short. -->
14
14
 
15
15
  ### TBD
16
16
 
@@ -21,4 +21,4 @@ List each endpoint with method, path, request, and response. Keep each entry sho
21
21
 
22
22
  ## Rules
23
23
 
24
- Write the shared rules. Examples are error format and pagination. Do not repeat one endpoint detail here.
24
+ <!-- Write the shared rules. Examples are error format and pagination. Do not repeat one endpoint detail here. -->
@@ -6,7 +6,7 @@ Do not read when. You need one feature detail. Open its spec instead.
6
6
 
7
7
  ## Detected stack
8
8
 
9
- Write what discovery found. If discovery found nothing yet, write TBD.
9
+ <!-- Write what discovery found. If discovery found nothing yet, write TBD. -->
10
10
 
11
11
  - Language. TBD
12
12
  - Framework. TBD
@@ -14,11 +14,11 @@ Write what discovery found. If discovery found nothing yet, write TBD.
14
14
 
15
15
  ## Layout
16
16
 
17
- Write where code lives. Write where tests live. Do not invent folders that do not exist yet. Mark planned folders as planned.
17
+ <!-- Write where code lives. Write where tests live. Do not invent folders that do not exist yet. Mark planned folders as planned. -->
18
18
 
19
19
  ## Flow
20
20
 
21
- Write how a request or a job moves through the system. Use short steps. Keep it to five steps or less when you can.
21
+ <!-- Write how a request or a job moves through the system. Use short steps. Keep it to five steps or less when you can. -->
22
22
 
23
23
  1. TBD
24
24
  2. TBD
@@ -11,7 +11,7 @@ Docs use English for this template. Change the doc language in PRD when the proj
11
11
 
12
12
  ## 2. Naming
13
13
 
14
- Write your naming pattern here. Decide the case for files, functions, and constants. Then follow it everywhere.
14
+ <!-- Write your naming pattern here. Decide the case for files, functions, and constants. Then follow it everywhere. -->
15
15
 
16
16
  - Files. TBD
17
17
  - Functions. TBD
@@ -19,7 +19,9 @@ Write your naming pattern here. Decide the case for files, functions, and consta
19
19
 
20
20
  ## 3. Function format
21
21
 
22
- Write your function format here. Decide how long a function can be and how many tasks it should do. One function should do one task.
22
+ <!-- Write your function format here. Decide how long a function can be and how many tasks it should do. -->
23
+
24
+ One function should do one task.
23
25
 
24
26
  ## 4. Comments
25
27
 
@@ -27,7 +29,7 @@ Write a comment only when logic is hard to follow without it. Use simple comment
27
29
 
28
30
  ## 5. File structure
29
31
 
30
- Write the order of parts in a file here. Decide what comes first, imports or constants or the main function. Then follow it.
32
+ <!-- Write the order of parts in a file here. Decide what comes first, imports or constants or the main function. Then follow it. -->
31
33
 
32
34
  ## 6. What to avoid
33
35
 
@@ -6,18 +6,18 @@ Do not read when. You only change UI text. That does not touch data.
6
6
 
7
7
  ## Entities
8
8
 
9
- List the main entities. One line per entity. Say what it holds.
9
+ <!-- List the main entities. One line per entity. Say what it holds. -->
10
10
 
11
11
  - TBD
12
12
 
13
13
  ## Relations
14
14
 
15
- Write how entities link to each other. Use plain words. Avoid jargon when you can.
15
+ <!-- Write how entities link to each other. Use plain words. Avoid jargon when you can. -->
16
16
 
17
17
  ## Rules
18
18
 
19
- Write the rules for data. Examples are what must stay unique and what must never be deleted. Mark rules you are unsure about as TBD.
19
+ <!-- Write the rules for data. Examples are what must stay unique and what must never be deleted. Mark rules you are unsure about as TBD. -->
20
20
 
21
21
  ## Migrations
22
22
 
23
- Write how schema changes are made and tested. Keep it short.
23
+ <!-- Write how schema changes are made and tested. Keep it short. -->
@@ -6,7 +6,7 @@ Do not read when. You only change local code. That does not need deploy notes.
6
6
 
7
7
  ## Release flow
8
8
 
9
- Write the steps from main branch to production. Keep each step to one line.
9
+ <!-- Write the steps from main branch to production. Keep each step to one line. -->
10
10
 
11
11
  1. TBD
12
12
  2. TBD
@@ -14,10 +14,10 @@ Write the steps from main branch to production. Keep each step to one line.
14
14
 
15
15
  ## Env vars
16
16
 
17
- List the env vars that are required. Do not write real secrets here. Write example values only. Real values live in local env files.
17
+ <!-- List the env vars that are required. Do not write real secrets here. Write example values only. Real values live in local env files. -->
18
18
 
19
19
  - TBD
20
20
 
21
21
  ## Rollback
22
22
 
23
- Write how to roll back a bad release. Keep it short.
23
+ <!-- Write how to roll back a bad release. Keep it short. -->
@@ -6,6 +6,11 @@ Do not read when. You already know the term. Skip it.
6
6
 
7
7
  ## Terms
8
8
 
9
- Add one entry per term. Keep each definition to one or two sentences.
9
+ <!-- Add one entry per term. Keep each definition to one or two sentences. -->
10
10
 
11
- - TBD. Write the definition here.
11
+ - PRD. A product requirements document. It says what the product is for, who uses it, and what it must do. It does not say how to build it.
12
+ - Spec. A specification for one piece of work. It lists the goal, the scope, the steps, and the acceptance cases that prove the work is done. Code starts only after a spec is approved.
13
+ - Task. One small unit of work from TASKS.md. A task belongs to a spec or to a fix that is too small for a spec.
14
+ - Architecture. The layout of the system. It names the stack, the main parts, and how they connect. It also records the evidence for each choice.
15
+ - TBD. To be decided. A mark for something unknown. Never guess a TBD. Ask a human or check the code, then replace the mark with the answer.
16
+ - Evidence. Proof from the repo. A file, a test result, or a line of code that shows a claim is true. A claim without evidence is a guess.
@@ -6,13 +6,13 @@ Do not read when. You work without AI. MCP is optional for humans.
6
6
 
7
7
  ## Servers
8
8
 
9
- Add one entry per server. Say what it is for and what env it needs.
9
+ <!-- Add one entry per server. Say what it is for and what env it needs. -->
10
10
 
11
11
  - TBD. Purpose. TBD. Env needed. TBD.
12
12
 
13
13
  ## Setup
14
14
 
15
- Write how the master config in `.agents/mcp.json` is copied to your AI tool. Do not put API keys in that file. Use env vars. List the env names in DEPLOY.md, not the real values.
15
+ <!-- Write how the master config in `.agents/mcp.json` is copied to your AI tool. Do not put API keys in that file. Use env vars. List the env names in DEPLOY.md, not the real values. -->
16
16
 
17
17
  ## Rules
18
18
 
@@ -6,24 +6,24 @@ Do not read when. You need code detail. Open a spec in `specs` instead.
6
6
 
7
7
  ## Vision
8
8
 
9
- Write one short paragraph. What problem does this project solve. Who has that problem today.
9
+ <!-- Write one short paragraph. What problem does this project solve. Who has that problem today. -->
10
10
 
11
11
  ## Users
12
12
 
13
- List the main users. Write one line per user type. Say what each type needs most.
13
+ <!-- List the main users. Write one line per user type. Say what each type needs most. -->
14
14
 
15
15
  ## Features
16
16
 
17
- List the core features. Keep each item to one line for now. Detail goes in a spec later.
17
+ <!-- List the core features. Keep each item to one line for now. Detail goes in a spec later. -->
18
18
 
19
19
  - TBD
20
20
 
21
21
  ## Out of scope
22
22
 
23
- List what this project will not do. This stops scope creep early.
23
+ <!-- List what this project will not do. This stops scope creep early. -->
24
24
 
25
25
  - TBD
26
26
 
27
27
  ## Success
28
28
 
29
- Write how you will know this project works. Use plain words. Avoid numbers you cannot check.
29
+ <!-- Write how you will know this project works. Use plain words. Avoid numbers you cannot check. -->
@@ -6,9 +6,10 @@ Do not read when. You only fix a bug in existing code. That does not change the
6
6
 
7
7
  ## Libraries
8
8
 
9
- Add one row per library. Keep the reason short.
9
+ <!-- Add one row per library. Keep the reason short. -->
10
10
 
11
11
  | Need | Library | MCP server | Reason |
12
+ |---|---|---|---|
12
13
  | Auth | TBD | TBD | TBD |
13
14
  | Database | TBD | TBD | TBD |
14
15
  | UI | TBD | TBD | TBD |
@@ -6,7 +6,7 @@ Do not read when. You only edit docs. Docs do not need tests.
6
6
 
7
7
  ## Levels
8
8
 
9
- Write what you test at each level. Keep it short.
9
+ <!-- Write what you test at each level. Keep it short. -->
10
10
 
11
11
  - Unit. TBD
12
12
  - Integration. TBD
@@ -14,11 +14,11 @@ Write what you test at each level. Keep it short.
14
14
 
15
15
  ## How to run tests
16
16
 
17
- Write the exact command to run tests. Write what a pass looks like.
17
+ <!-- Write the exact command to run tests. Write what a pass looks like. -->
18
18
 
19
19
  ## Edge cases
20
20
 
21
- List the edge cases that often break. Add new ones when you find them.
21
+ <!-- List the edge cases that often break. Add new ones when you find them. -->
22
22
 
23
23
  - TBD
24
24
 
@@ -10,7 +10,7 @@ The initial stack is TBD. Discovery will fill this in during init.
10
10
 
11
11
  ## Context
12
12
 
13
- Write what discovery found. List the manifest files that proved the stack.
13
+ <!-- Write what discovery found. List the manifest files that proved the stack. -->
14
14
 
15
15
  ## Options considered
16
16
 
@@ -18,7 +18,7 @@ Write what discovery found. List the manifest files that proved the stack.
18
18
 
19
19
  ## Outcome
20
20
 
21
- Write the picked stack and the main reason. Mark anything unsure as TBD.
21
+ <!-- Write the picked stack and the main reason. Mark anything unsure as TBD. -->
22
22
 
23
23
  ## Status
24
24
 
@@ -6,22 +6,22 @@ Do not read when. You only fix a small bug. That does not need an ADR.
6
6
 
7
7
  ## Decision
8
8
 
9
- Write the decision in one sentence.
9
+ <!-- Write the decision in one sentence. -->
10
10
 
11
11
  ## Context
12
12
 
13
- Write why this decision was needed. Keep it short.
13
+ <!-- Write why this decision was needed. Keep it short. -->
14
14
 
15
15
  ## Options considered
16
16
 
17
- List the options you considered. One line per option.
17
+ <!-- List the options you considered. One line per option. -->
18
18
 
19
19
  - TBD
20
20
 
21
21
  ## Outcome
22
22
 
23
- Write what you picked and why. Write what you gave up.
23
+ <!-- Write what you picked and why. Write what you gave up. -->
24
24
 
25
25
  ## Status
26
26
 
27
- Write Draft or Approved.
27
+ <!-- Write Draft or Approved. -->
@@ -6,27 +6,27 @@ Do not read when. You implement a spec that already exists. Open that spec inste
6
6
 
7
7
  ## Goal
8
8
 
9
- Write what this feature must do in one or two sentences.
9
+ <!-- Write what this feature must do in one or two sentences. -->
10
10
 
11
11
  ## Users
12
12
 
13
- Write who uses this feature.
13
+ <!-- Write who uses this feature. -->
14
14
 
15
15
  ## Requirements
16
16
 
17
- List what must be true when this feature is done. Use plain words. Each item must be checkable.
17
+ <!-- List what must be true when this feature is done. Use plain words. Each item must be checkable. -->
18
18
 
19
19
  - [ ] TBD
20
20
 
21
21
  ## Out of scope
22
22
 
23
- List what this feature will not do.
23
+ <!-- List what this feature will not do. -->
24
24
 
25
25
  - TBD
26
26
 
27
27
  ## Acceptance
28
28
 
29
- Write how you will test this feature. List the main cases.
29
+ <!-- Write how you will test this feature. List the main cases. -->
30
30
 
31
31
  ## Status
32
32
 
@@ -10,5 +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
- | 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 |