@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/README.md CHANGED
@@ -11,15 +11,16 @@ Run tests with npm test from this folder. Tests use temp dirs only. They never t
11
11
  Install it with npx @moritakaaz/markflow init. Then run one of these commands. A command you do not know is rejected and creates no files.
12
12
 
13
13
  - `markflow init` creates the docs layer in the current repo.
14
+ - `markflow init --minimal` creates only PRD, ARCHITECTURE, one spec, and TASKS, plus AGENTS.md and the markflow README. Doctor checks only those files in a minimal project. Run plain `markflow init` later to add the rest.
14
15
  - `markflow init --agent claude` also creates CLAUDE.md. Use `--agent codex` for Codex, which reads AGENTS.md. Use `--agent cursor` for .cursor/rules/markflow.mdc. Use `--agent copilot` for .github/copilot-instructions.md.
15
16
  - `markflow doctor` checks the docs layer for missing files, leftover placeholders, broken internal links, and specs missing from the index. It reports errors, warnings, and info. Only errors make it exit with 1.
16
- - `markflow update` restores missing files and updates files the user did not change. It also protects AGENTS.md and agent files with the same hash check. Use `markflow update --preview` to see what would change without changing any file. The CLI, methodology, and template each have their own version. See src/versions.js for the methodology and template versions.
17
+ - `markflow update` restores missing files and updates files the user did not change. It also protects AGENTS.md and agent files with the same hash check. ARCHITECTURE.md and STACK.md belong to the user after init, so update restores them when missing but never changes their content. Use `markflow update --preview` to see what would change without changing any file. The CLI, methodology, and template each have their own version. See src/versions.js for the methodology and template versions.
17
18
  - `markflow --help` shows the commands.
18
19
  - `markflow --version` shows the CLI version.
19
20
 
20
21
  Init reads a repo, then copies the base templates into it. It is non-interactive by default. It does not init a framework. It does not install app dependencies.
21
22
 
22
- Use --agent to pick the agent file. The default is generic and creates AGENTS.md only. Use --agent claude to also create CLAUDE.md. Use --agent cursor to also create .cursorrules.
23
+ Use --agent to pick the agent file. The default is generic and creates AGENTS.md only. Use --agent claude to also create CLAUDE.md. Use --agent cursor to also create .cursor/rules/markflow.mdc.
23
24
 
24
25
  Init also writes markflow/.markflow.json. That file holds the cli, methodology, and template versions used at init time.
25
26
 
package/package.json CHANGED
@@ -19,5 +19,5 @@
19
19
  "test": "node --test"
20
20
  },
21
21
  "type": "module",
22
- "version": "0.1.0"
22
+ "version": "0.3.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 = [
@@ -40,6 +120,10 @@ const SKIP_DIRS = new Set([
40
120
  "markflow",
41
121
  ".markflow",
42
122
  "vendor",
123
+ ".venv",
124
+ "venv",
125
+ "target",
126
+ ".next",
43
127
  ]);
44
128
 
45
129
  function stackFromEntry(name) {
@@ -59,7 +143,9 @@ export async function discover(root) {
59
143
  const configs = [];
60
144
  const workspaceEvidence = [];
61
145
  const memberDirs = new Set();
146
+ const dependencies = [];
62
147
  const seen = new Set();
148
+ const seenDeps = new Set();
63
149
  function addStack(name, evidence, confidence) {
64
150
  manifests.push(evidence);
65
151
  if (seen.has(name)) {
@@ -68,6 +154,37 @@ export async function discover(root) {
68
154
  seen.add(name);
69
155
  stacks.push({ name, evidence, confidence });
70
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
+ }
71
188
  async function scanDir(dir, rel, confidence, depth) {
72
189
  let entries;
73
190
  try {
@@ -98,6 +215,7 @@ export async function discover(root) {
98
215
  if (rel) {
99
216
  memberDirs.add(rel.split("/").slice(0, 2).join("/"));
100
217
  }
218
+ await collectDeps(entry.name, join(dir, entry.name), childRel);
101
219
  }
102
220
  }
103
221
  }
@@ -173,6 +291,7 @@ export async function discover(root) {
173
291
  stacks,
174
292
  manifests,
175
293
  configs,
294
+ dependencies,
176
295
  workspace: {
177
296
  detected: workspaceEvidence.length > 0,
178
297
  evidence: workspaceEvidence,
package/src/doctor.js CHANGED
@@ -2,7 +2,9 @@
2
2
  // It reports errors, warnings, and info.
3
3
  // Errors fail the check. Warnings and info do not.
4
4
  import { readdir, readFile, stat } from "node:fs/promises";
5
- import { dirname, join, resolve } from "node:path";
5
+ import { basename, dirname, join, resolve } from "node:path";
6
+ import { findTemplatesDir } from "./templates.js";
7
+ import { MINIMAL_REQUIRED } from "./minimal.js";
6
8
 
7
9
  const REQUIRED = [
8
10
  "AGENTS.md",
@@ -18,7 +20,7 @@ const REQUIRED = [
18
20
  "markflow/.markflow.json",
19
21
  ];
20
22
 
21
- const AGENT_FILES = ["CLAUDE.md", ".cursorrules"];
23
+ const AGENT_FILES = ["CLAUDE.md", ".cursor/rules/markflow.mdc"];
22
24
 
23
25
  async function walk(dir, out) {
24
26
  let entries;
@@ -39,6 +41,73 @@ async function walk(dir, out) {
39
41
  }
40
42
  }
41
43
 
44
+ // First sentence of each fill-in instruction in the templates.
45
+ // The full lines live inside HTML comments in the templates.
46
+ // A doc that still shows one of these as visible text was not filled in.
47
+ const INSTRUCTIONS = [
48
+ "Write one short paragraph.",
49
+ "List the main users.",
50
+ "List the core features.",
51
+ "List what this project will not do.",
52
+ "Write how you will know this project works.",
53
+ "Write what discovery found.",
54
+ "Write where code lives.",
55
+ "Write how a request or a job moves through the system.",
56
+ "Add one row per library.",
57
+ "Add one entry per term.",
58
+ "Write what you test at each level.",
59
+ "Write the exact command to run tests.",
60
+ "List the edge cases that often break.",
61
+ "Write your naming pattern here.",
62
+ "Write your function format here.",
63
+ "Write the order of parts in a file here.",
64
+ "List the main entities.",
65
+ "Write how entities link to each other.",
66
+ "Write the rules for data.",
67
+ "Write how schema changes are made and tested.",
68
+ "Write how auth works.",
69
+ "List each endpoint with method, path, request, and response.",
70
+ "Write the shared rules.",
71
+ "Write the steps from main branch to production.",
72
+ "List the env vars that are required.",
73
+ "Write how to roll back a bad release.",
74
+ "Add one entry per server.",
75
+ "Write how the master config in `.agents/mcp.json` is copied to your AI tool.",
76
+ "Write what this feature must do in one or two sentences.",
77
+ "Write who uses this feature.",
78
+ "List what must be true when this feature is done.",
79
+ "List what this feature will not do.",
80
+ "Write how you will test this feature.",
81
+ "Write the decision in one sentence.",
82
+ "Write why this decision was needed.",
83
+ "List the options you considered.",
84
+ "Write what you picked and why.",
85
+ "Write Draft or Approved.",
86
+ "Write the picked stack and the main reason.",
87
+ ];
88
+
89
+ // Remove HTML comments, so hidden instructions do not count as visible text.
90
+ function stripComments(text) {
91
+ return text.replace(/<!--[\s\S]*?-->/g, "");
92
+ }
93
+
94
+ // Lines of one ## section, or null when the section is missing.
95
+ function sectionLines(text, heading) {
96
+ const lines = text.split("\n");
97
+ const start = lines.findIndex((line) => line.trim() === "## " + heading);
98
+ if (start === -1) {
99
+ return null;
100
+ }
101
+ const out = [];
102
+ for (let i = start + 1; i < lines.length; i += 1) {
103
+ if (lines[i].startsWith("## ")) {
104
+ break;
105
+ }
106
+ out.push(lines[i]);
107
+ }
108
+ return out;
109
+ }
110
+
42
111
  function findLinks(text) {
43
112
  const links = [];
44
113
  const re = /\[[^\]]*\]\(([^)\s]+)\)/g;
@@ -53,15 +122,6 @@ export async function runDoctor(options) {
53
122
  const root = (options && options.target) || process.cwd();
54
123
  const errors = [];
55
124
  const warnings = [];
56
- for (const file of REQUIRED) {
57
- try {
58
- await stat(join(root, file));
59
- console.log("OK " + file);
60
- } catch {
61
- console.log("Error Missing " + file);
62
- errors.push(file);
63
- }
64
- }
65
125
  let marker = null;
66
126
  try {
67
127
  marker = JSON.parse(
@@ -72,7 +132,18 @@ export async function runDoctor(options) {
72
132
  errors.push("markflow/.markflow.json");
73
133
  }
74
134
  } catch {
75
- // Missing marker is already reported above.
135
+ // Missing marker is already reported below.
136
+ }
137
+ const required =
138
+ marker && marker.minimal === true ? MINIMAL_REQUIRED : REQUIRED;
139
+ for (const file of required) {
140
+ try {
141
+ await stat(join(root, file));
142
+ console.log("OK " + file);
143
+ } catch {
144
+ console.log("Error Missing " + file);
145
+ errors.push(file);
146
+ }
76
147
  }
77
148
  if (marker && marker.files) {
78
149
  for (const rel of Object.keys(marker.files)) {
@@ -103,6 +174,14 @@ export async function runDoctor(options) {
103
174
  console.log("Error Placeholder left in " + rel);
104
175
  errors.push(rel);
105
176
  }
177
+ const visible = stripComments(text);
178
+ for (const phrase of INSTRUCTIONS) {
179
+ if (visible.includes(phrase)) {
180
+ console.log("Warning Instruction text left in " + rel);
181
+ warnings.push(rel);
182
+ break;
183
+ }
184
+ }
106
185
  tbd += text.split("TBD").length - 1;
107
186
  for (const link of findLinks(text)) {
108
187
  if (
@@ -125,6 +204,33 @@ export async function runDoctor(options) {
125
204
  }
126
205
  }
127
206
  }
207
+ const stillTemplate = [];
208
+ try {
209
+ const templatesDir = await findTemplatesDir();
210
+ const projectName = (marker && marker.project) || basename(root);
211
+ for (const [rel, label] of [
212
+ ["markflow/docs/PRD.md", "PRD"],
213
+ ["markflow/docs/ARCHITECTURE.md", "ARCHITECTURE"],
214
+ ["markflow/TASKS.md", "TASKS"],
215
+ ]) {
216
+ const templateText = (
217
+ await readFile(join(templatesDir, rel), "utf8")
218
+ )
219
+ .split("{{project_name}}")
220
+ .join(projectName);
221
+ const text = await readFile(join(root, rel), "utf8");
222
+ if (text === templateText) {
223
+ console.log("Warning " + label + " is still the template " + rel);
224
+ warnings.push(rel);
225
+ stillTemplate.push(rel);
226
+ }
227
+ }
228
+ } catch {
229
+ // Template or doc is missing, so skip this check.
230
+ }
231
+ if (stillTemplate.length > 0) {
232
+ console.log("Next. Fill " + stillTemplate[0] + ".");
233
+ }
128
234
  let specTotal = 0;
129
235
  let specDraft = 0;
130
236
  try {
@@ -141,14 +247,33 @@ export async function runDoctor(options) {
141
247
  }
142
248
  specTotal += 1;
143
249
  const text = await readFile(file, "utf8");
250
+ const rel = file.slice(root.length + 1);
144
251
  if (text.includes("Status") && text.includes("Draft")) {
145
252
  specDraft += 1;
146
253
  }
147
254
  if (!indexText.includes(name)) {
148
- const rel = file.slice(root.length + 1);
149
255
  console.log("Warning Spec not listed in index " + rel);
150
256
  warnings.push(rel);
151
257
  }
258
+ const acceptance = sectionLines(text, "Acceptance");
259
+ if (acceptance !== null) {
260
+ const cases = stripComments(acceptance.join("\n"))
261
+ .split("\n")
262
+ .filter((line) => line.trim() !== "");
263
+ if (cases.length === 0) {
264
+ console.log("Warning Empty acceptance in " + rel);
265
+ warnings.push(rel);
266
+ }
267
+ }
268
+ const status = sectionLines(text, "Status");
269
+ if (
270
+ status !== null &&
271
+ status.some((line) => line.trim() === "Approved") &&
272
+ text.includes("TBD")
273
+ ) {
274
+ console.log("Warning Approved spec still has TBD in " + rel);
275
+ warnings.push(rel);
276
+ }
152
277
  }
153
278
  } catch {
154
279
  // Missing specs folder is already reported above.
package/src/index.js CHANGED
@@ -9,7 +9,7 @@ import { runUpdate } from "./update.js";
9
9
 
10
10
  const HELP = [
11
11
  "Usage",
12
- " markflow init [--agent generic|claude|codex|cursor|copilot]",
12
+ " markflow init [--agent generic|claude|codex|cursor|copilot] [--minimal]",
13
13
  " markflow doctor",
14
14
  " markflow update [--preview]",
15
15
  " markflow --help",
@@ -49,7 +49,10 @@ if (args.length === 0) {
49
49
  const result = await runUpdate({ preview: args.includes("--preview") });
50
50
  process.exitCode = result.ok ? 0 : 1;
51
51
  } else if (args[0] === "init") {
52
- const result = await runInit({ agent: parseAgent(args.slice(1)) });
52
+ const result = await runInit({
53
+ agent: parseAgent(args.slice(1)),
54
+ minimal: args.includes("--minimal"),
55
+ });
53
56
  process.exitCode = result.ok === false ? 1 : 0;
54
57
  } else {
55
58
  console.log("Unknown command " + args[0] + ".");
package/src/init.js CHANGED
@@ -9,16 +9,46 @@ import { hashText } from "./hash.js";
9
9
  import { AGENTS } from "./agents.js";
10
10
  import { findTemplatesDir } from "./templates.js";
11
11
  import { METHODOLOGY_VERSION, TEMPLATE_VERSION } from "./versions.js";
12
+ import { MINIMAL_FILES } from "./minimal.js";
12
13
 
13
- async function copyDir(src, dest, projectName) {
14
+ // True when any minimal file lives under this dir.
15
+ function underFilter(filter, dirRel) {
16
+ if (!filter) {
17
+ return true;
18
+ }
19
+ const prefix = "markflow/" + dirRel + "/";
20
+ for (const file of filter) {
21
+ if (file.startsWith(prefix)) {
22
+ return true;
23
+ }
24
+ }
25
+ return false;
26
+ }
27
+
28
+ async function copyDir(src, dest, projectName, base, createdPaths, filter) {
14
29
  let created = 0;
15
30
  const entries = await readdir(src, { withFileTypes: true });
16
31
  for (const entry of entries) {
17
32
  const srcPath = join(src, entry.name);
18
33
  const destPath = join(dest, entry.name);
19
34
  if (entry.isDirectory()) {
35
+ const dirRel = destPath.slice(base.length + 1);
36
+ if (!underFilter(filter, dirRel)) {
37
+ continue;
38
+ }
20
39
  await mkdir(destPath, { recursive: true });
21
- created += await copyDir(srcPath, destPath, projectName);
40
+ created += await copyDir(
41
+ srcPath,
42
+ destPath,
43
+ projectName,
44
+ base,
45
+ createdPaths,
46
+ filter
47
+ );
48
+ continue;
49
+ }
50
+ const rel = destPath.slice(base.length + 1);
51
+ if (filter && !filter.has("markflow/" + rel)) {
22
52
  continue;
23
53
  }
24
54
  try {
@@ -31,17 +61,45 @@ async function copyDir(src, dest, projectName) {
31
61
  const replaced = text.split("{{project_name}}").join(projectName);
32
62
  await mkdir(dirname(destPath), { recursive: true });
33
63
  await writeFile(destPath, replaced);
64
+ createdPaths.push(rel);
34
65
  created += 1;
35
66
  }
36
67
  return created;
37
68
  }
38
69
 
70
+ // Fill the ARCHITECTURE.md template with discovery results.
71
+ // Throws when the template lines are gone, so a template
72
+ // change fails loudly instead of silently skipping the fill.
73
+ export function fillArchitecture(text, context) {
74
+ if (
75
+ !text.includes("- Language. TBD") ||
76
+ !text.includes("- Framework. TBD")
77
+ ) {
78
+ throw new Error("ARCHITECTURE.md template changed, fill failed.");
79
+ }
80
+ const names = context.stacks.map((s) => s.name).join(", ");
81
+ const evidence = context.stacks
82
+ .map((s) => s.evidence + " (" + s.confidence + ")")
83
+ .join(", ");
84
+ return text
85
+ .replace("- Language. TBD", "- Language. " + names)
86
+ .replace(
87
+ "- Framework. TBD",
88
+ "- Framework. TBD" +
89
+ "\n- Evidence. " +
90
+ evidence +
91
+ "\n- Monorepo. " +
92
+ (context.monorepo ? "Yes" : "No")
93
+ );
94
+ }
95
+
39
96
  export async function runInit(options) {
40
97
  const agent = options.agent || "generic";
41
98
  if (!(agent in AGENTS)) {
42
99
  console.log("Unknown agent.");
43
100
  return { agent, copied: 0, ok: false };
44
101
  }
102
+ const minimal = options.minimal === true;
45
103
  const target = options.target || process.cwd();
46
104
  const context = await discover(target);
47
105
  const srcDir = dirname(fileURLToPath(import.meta.url));
@@ -60,36 +118,36 @@ export async function runInit(options) {
60
118
  const stackPath = join(markflowDest, "docs/STACK.md");
61
119
  const archExisted = await exists(archPath);
62
120
  const stackExisted = await exists(stackPath);
121
+ const createdPaths = [];
63
122
  const created = await copyDir(
64
123
  join(templatesDir, "markflow"),
65
124
  markflowDest,
66
- context.projectName
125
+ context.projectName,
126
+ markflowDest,
127
+ createdPaths,
128
+ minimal ? new Set(MINIMAL_FILES) : null
67
129
  );
68
130
  if (context.stacks.length > 0) {
69
- const names = context.stacks.map((s) => s.name).join(", ");
70
- const evidence = context.stacks
71
- .map((s) => s.evidence + " (" + s.confidence + ")")
72
- .join(", ");
73
131
  if (!archExisted) {
74
132
  const arch = await readFile(archPath, "utf8");
75
- const filled = arch
76
- .replace("- Language. TBD", "- Language. " + names)
77
- .replace(
78
- "- Framework. TBD",
79
- "- Framework. TBD\n- Evidence. " +
80
- evidence +
81
- "\n- Monorepo. " +
82
- (context.monorepo ? "Yes" : "No")
83
- );
84
- await writeFile(archPath, filled);
133
+ await writeFile(archPath, fillArchitecture(arch, context));
85
134
  }
86
- if (!stackExisted) {
135
+ if (!stackExisted && (await exists(stackPath))) {
87
136
  const stack = await readFile(stackPath, "utf8");
88
137
  const lines = context.stacks.map(
89
138
  (s) => "- " + s.name + " from " + s.evidence + ", confidence " + s.confidence
90
139
  );
91
- const filled =
140
+ let filled =
92
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
+ }
93
151
  await writeFile(stackPath, filled);
94
152
  }
95
153
  }
@@ -152,35 +210,30 @@ export async function runInit(options) {
152
210
  }
153
211
  }
154
212
  marker.agent = marker.agent || agent;
213
+ marker.minimal = minimal;
155
214
  marker.discovery = {
156
215
  mode: context.mode,
157
216
  stacks: context.stacks,
158
217
  manifests: context.manifests,
159
218
  monorepo: context.monorepo,
219
+ dependencies: context.dependencies,
160
220
  };
161
- async function collectHashes(dir) {
162
- const entries = await readdir(dir, { withFileTypes: true });
163
- for (const entry of entries) {
164
- const full = join(dir, entry.name);
165
- if (entry.isDirectory()) {
166
- await collectHashes(full);
167
- continue;
168
- }
169
- if (entry.name === ".markflow.json") {
170
- continue;
171
- }
172
- const rel = full.slice(markflowDest.length + 1);
173
- if (!(rel in marker.files)) {
174
- marker.files[rel] = hashText(await readFile(full, "utf8"));
175
- }
176
- }
221
+ // Record hashes only for files this run created.
222
+ // A file the user wrote before init stays untracked,
223
+ // so update never treats it as a template file.
224
+ for (const rel of createdPaths) {
225
+ marker.files[rel] = hashText(
226
+ await readFile(join(markflowDest, rel), "utf8")
227
+ );
177
228
  }
178
- await collectHashes(markflowDest);
179
229
  await writeFile(markerPath, JSON.stringify(marker, null, 2) + "\n");
230
+ let nextStep;
180
231
  if (created > 0) {
181
232
  console.log("Created markflow folder.");
233
+ nextStep = "Open your AI tool and say: start onboarding.";
234
+ console.log("Next step. " + nextStep);
182
235
  } else {
183
236
  console.log("markflow folder already exists.");
184
237
  }
185
- return { ...context, agent, copied: created };
238
+ return { ...context, agent, copied: created, nextStep, minimal };
186
239
  }
package/src/minimal.js ADDED
@@ -0,0 +1,22 @@
1
+ // Files init --minimal creates. Everything else stays out.
2
+ // Paths are relative to the project root.
3
+ export const MINIMAL_FILES = [
4
+ "AGENTS.md",
5
+ "markflow/README.md",
6
+ "markflow/TASKS.md",
7
+ "markflow/docs/PRD.md",
8
+ "markflow/docs/ARCHITECTURE.md",
9
+ "markflow/specs/index.md",
10
+ "markflow/specs/_template.md",
11
+ ];
12
+
13
+ // Files doctor checks in a minimal project.
14
+ export const MINIMAL_REQUIRED = [
15
+ "AGENTS.md",
16
+ "markflow/README.md",
17
+ "markflow/TASKS.md",
18
+ "markflow/docs/PRD.md",
19
+ "markflow/docs/ARCHITECTURE.md",
20
+ "markflow/specs/index.md",
21
+ "markflow/.markflow.json",
22
+ ];