@moritakaaz/markflow 0.0.0-stage → 0.1.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 +31 -2
- package/package.json +21 -4
- package/src/agents.js +17 -0
- package/src/discover.js +184 -0
- package/src/doctor.js +166 -0
- package/src/hash.js +7 -0
- package/src/index.js +58 -0
- package/src/init.js +186 -0
- package/src/templates.js +17 -0
- package/src/update.js +132 -0
- package/src/versions.js +6 -0
- package/templates/AGENTS.md +25 -0
- package/templates/markflow/.agents/MEMORY.md +17 -0
- package/templates/markflow/.agents/PROMPTS.md +17 -0
- package/templates/markflow/.agents/RULES.md +7 -0
- package/templates/markflow/.agents/mcp.json +3 -0
- package/templates/markflow/.agents/workflows/create-feature.md +14 -0
- package/templates/markflow/.agents/workflows/implement-spec.md +13 -0
- package/templates/markflow/.agents/workflows/pre-deploy-check.md +13 -0
- package/templates/markflow/.agents/workflows/review-spec.md +13 -0
- package/templates/markflow/.agents/workflows/sync-docs.md +13 -0
- package/templates/markflow/CHANGELOG.md +9 -0
- package/templates/markflow/README.md +30 -0
- package/templates/markflow/TASKS.md +13 -0
- package/templates/markflow/docs/API.md +24 -0
- package/templates/markflow/docs/ARCHITECTURE.md +29 -0
- package/templates/markflow/docs/CODING_STANDARDS.md +38 -0
- package/templates/markflow/docs/DATA_MODEL.md +23 -0
- package/templates/markflow/docs/DEPLOY.md +23 -0
- package/templates/markflow/docs/GLOSSARY.md +11 -0
- package/templates/markflow/docs/MCP.md +19 -0
- package/templates/markflow/docs/PRD.md +29 -0
- package/templates/markflow/docs/STACK.md +18 -0
- package/templates/markflow/docs/TESTING.md +27 -0
- package/templates/markflow/docs/adr/001-initial-stack.md +25 -0
- package/templates/markflow/docs/adr/_template.md +27 -0
- package/templates/markflow/specs/_template.md +33 -0
- package/templates/markflow/specs/index.md +14 -0
- package/test/cli.test.js +297 -0
package/src/templates.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Find the templates folder.
|
|
2
|
+
// In the repo it lives at templates/base.
|
|
3
|
+
// In the published package it lives at packages/cli/templates.
|
|
4
|
+
import { access } from "node:fs/promises";
|
|
5
|
+
import { dirname, join, resolve } from "node:path";
|
|
6
|
+
import { fileURLToPath } from "node:url";
|
|
7
|
+
|
|
8
|
+
export async function findTemplatesDir() {
|
|
9
|
+
const srcDir = dirname(fileURLToPath(import.meta.url));
|
|
10
|
+
const packaged = resolve(srcDir, "../templates");
|
|
11
|
+
try {
|
|
12
|
+
await access(join(packaged, "AGENTS.md"));
|
|
13
|
+
return packaged;
|
|
14
|
+
} catch {
|
|
15
|
+
return resolve(srcDir, "../../../templates/base");
|
|
16
|
+
}
|
|
17
|
+
}
|
package/src/update.js
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
// Update restores missing files and updates unmodified files.
|
|
2
|
+
// It never overwrites a file the user changed.
|
|
3
|
+
// Use preview mode to see what would change without changing files.
|
|
4
|
+
import { mkdir, readFile, readdir, stat, writeFile } from "node:fs/promises";
|
|
5
|
+
import { dirname, join } from "node:path";
|
|
6
|
+
import { fileURLToPath } from "node:url";
|
|
7
|
+
import { hashText } from "./hash.js";
|
|
8
|
+
import { AGENTS } from "./agents.js";
|
|
9
|
+
import { findTemplatesDir } from "./templates.js";
|
|
10
|
+
import { METHODOLOGY_VERSION, TEMPLATE_VERSION } from "./versions.js";
|
|
11
|
+
|
|
12
|
+
async function listFiles(dir, base, out) {
|
|
13
|
+
const entries = await readdir(dir, { withFileTypes: true });
|
|
14
|
+
for (const entry of entries) {
|
|
15
|
+
const full = join(dir, entry.name);
|
|
16
|
+
if (entry.isDirectory()) {
|
|
17
|
+
await listFiles(full, base, out);
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
out.push(full.slice(base.length + 1));
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export async function runUpdate(options) {
|
|
25
|
+
const preview = options && options.preview;
|
|
26
|
+
const target = (options && options.target) || process.cwd();
|
|
27
|
+
const markerPath = join(target, "markflow/.markflow.json");
|
|
28
|
+
let marker;
|
|
29
|
+
try {
|
|
30
|
+
marker = JSON.parse(await readFile(markerPath, "utf8"));
|
|
31
|
+
} catch {
|
|
32
|
+
console.log("No version marker found.");
|
|
33
|
+
return { ok: false };
|
|
34
|
+
}
|
|
35
|
+
const srcDir = dirname(fileURLToPath(import.meta.url));
|
|
36
|
+
const templatesDir = await findTemplatesDir();
|
|
37
|
+
const pkg = JSON.parse(await readFile(join(srcDir, "../package.json"), "utf8"));
|
|
38
|
+
const projectName = marker.project || target.split("/").pop();
|
|
39
|
+
const agent = marker.agent && marker.agent in AGENTS ? marker.agent : "generic";
|
|
40
|
+
const stored = marker.files || {};
|
|
41
|
+
const storedRoot = marker.rootFiles || {};
|
|
42
|
+
const rels = [];
|
|
43
|
+
await listFiles(join(templatesDir, "markflow"), join(templatesDir, "markflow"), rels);
|
|
44
|
+
const templateSet = new Set(rels);
|
|
45
|
+
let updated = 0;
|
|
46
|
+
let restored = 0;
|
|
47
|
+
let skipped = 0;
|
|
48
|
+
let kept = 0;
|
|
49
|
+
const files = { ...stored };
|
|
50
|
+
const rootFiles = { ...storedRoot };
|
|
51
|
+
async function sync(rel, dest, templateText, storedMap, newMap) {
|
|
52
|
+
const templateHash = hashText(templateText);
|
|
53
|
+
let current = null;
|
|
54
|
+
try {
|
|
55
|
+
current = await readFile(dest, "utf8");
|
|
56
|
+
} catch {
|
|
57
|
+
console.log((preview ? "Would restore " : "Restored ") + rel);
|
|
58
|
+
if (!preview) {
|
|
59
|
+
await mkdir(dirname(dest), { recursive: true });
|
|
60
|
+
await writeFile(dest, templateText);
|
|
61
|
+
}
|
|
62
|
+
restored += 1;
|
|
63
|
+
newMap[rel] = templateHash;
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
if (storedMap[rel] && hashText(current) === storedMap[rel]) {
|
|
67
|
+
if (templateHash !== storedMap[rel]) {
|
|
68
|
+
console.log((preview ? "Would update " : "Updated ") + rel);
|
|
69
|
+
if (!preview) {
|
|
70
|
+
await writeFile(dest, templateText);
|
|
71
|
+
}
|
|
72
|
+
updated += 1;
|
|
73
|
+
newMap[rel] = templateHash;
|
|
74
|
+
}
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
console.log("Skipped " + rel + ", modified.");
|
|
78
|
+
skipped += 1;
|
|
79
|
+
}
|
|
80
|
+
for (const rel of rels) {
|
|
81
|
+
const templateText = (await readFile(join(templatesDir, "markflow", rel), "utf8"))
|
|
82
|
+
.split("{{project_name}}")
|
|
83
|
+
.join(projectName);
|
|
84
|
+
await sync(rel, join(target, "markflow", rel), templateText, stored, files);
|
|
85
|
+
}
|
|
86
|
+
for (const rel of Object.keys(stored)) {
|
|
87
|
+
if (!templateSet.has(rel)) {
|
|
88
|
+
console.log("Kept " + rel + ", no longer in template.");
|
|
89
|
+
kept += 1;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
const agentsTemplate = (await readFile(join(templatesDir, "AGENTS.md"), "utf8"))
|
|
93
|
+
.split("{{project_name}}")
|
|
94
|
+
.join(projectName);
|
|
95
|
+
await sync("AGENTS.md", join(target, "AGENTS.md"), agentsTemplate, storedRoot, rootFiles);
|
|
96
|
+
let agentsText = agentsTemplate;
|
|
97
|
+
try {
|
|
98
|
+
agentsText = await readFile(join(target, "AGENTS.md"), "utf8");
|
|
99
|
+
} catch {
|
|
100
|
+
// AGENTS.md is missing, so the template text stays in use.
|
|
101
|
+
}
|
|
102
|
+
for (const file of AGENTS[agent]) {
|
|
103
|
+
if (!(file.path in storedRoot)) {
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
const content = file.frontmatter
|
|
107
|
+
? file.frontmatter + "\n" + agentsText
|
|
108
|
+
: agentsText;
|
|
109
|
+
await sync(file.path, join(target, file.path), content, storedRoot, rootFiles);
|
|
110
|
+
}
|
|
111
|
+
if (preview) {
|
|
112
|
+
console.log("Preview only, no files changed.");
|
|
113
|
+
console.log(
|
|
114
|
+
"Would update " + updated + " files. Would restore " + restored + " files. Skipped " + skipped + " files. Kept " + kept + " files."
|
|
115
|
+
);
|
|
116
|
+
return { ok: true, updated, restored, skipped, kept, preview: true };
|
|
117
|
+
}
|
|
118
|
+
marker.cli = pkg.version;
|
|
119
|
+
marker.methodology = METHODOLOGY_VERSION;
|
|
120
|
+
marker.template = TEMPLATE_VERSION;
|
|
121
|
+
marker.project = projectName;
|
|
122
|
+
marker.agent = agent;
|
|
123
|
+
marker.files = files;
|
|
124
|
+
marker.rootFiles = rootFiles;
|
|
125
|
+
await writeFile(markerPath, JSON.stringify(marker, null, 2) + "\n");
|
|
126
|
+
if (updated === 0 && restored === 0 && skipped === 0 && kept === 0) {
|
|
127
|
+
console.log("Already up to date.");
|
|
128
|
+
} else {
|
|
129
|
+
console.log("Updated " + updated + " files. Restored " + restored + " files. Skipped " + skipped + " files. Kept " + kept + " files.");
|
|
130
|
+
}
|
|
131
|
+
return { ok: true, updated, restored, skipped, kept };
|
|
132
|
+
}
|
package/src/versions.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// Versions for the three parts of Markflow.
|
|
2
|
+
// Bump methodology when the docs in docs change.
|
|
3
|
+
// Bump template when the files in templates change.
|
|
4
|
+
// The CLI version comes from package.json.
|
|
5
|
+
export const METHODOLOGY_VERSION = "0.1.0";
|
|
6
|
+
export const TEMPLATE_VERSION = "0.1.0";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# AGENTS.md
|
|
2
|
+
|
|
3
|
+
This file is the router for AI agents in this project. Read it first.
|
|
4
|
+
|
|
5
|
+
## Start here
|
|
6
|
+
|
|
7
|
+
All project context lives in the `markflow` folder. Do not create new Markdown files in the root.
|
|
8
|
+
|
|
9
|
+
Start with these files in order.
|
|
10
|
+
|
|
11
|
+
1. Read `markflow/docs/PRD.md` to learn what this project is.
|
|
12
|
+
2. Read `markflow/docs/ARCHITECTURE.md` to learn the stack and the layout of source code.
|
|
13
|
+
3. Read `markflow/specs/index.md` to learn which spec is active.
|
|
14
|
+
4. Read `markflow/docs/CODING_STANDARDS.md` before you write or review code.
|
|
15
|
+
|
|
16
|
+
## Rules you must not break
|
|
17
|
+
|
|
18
|
+
- 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
|
+
- 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
|
+
- 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.
|
|
21
|
+
- All links inside `markflow` must be relative to that folder. Do not use absolute paths from the root.
|
|
22
|
+
|
|
23
|
+
## If you are human and you do not use AI
|
|
24
|
+
|
|
25
|
+
Ignore the `markflow/.agents` folder. Read `README.md` and `CONTRIBUTING.md` in this project instead.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# MEMORY.md
|
|
2
|
+
|
|
3
|
+
Purpose. This file holds dynamic context for {{project_name}}.
|
|
4
|
+
Read when. You start a task and need lessons from past work.
|
|
5
|
+
Do not read when. You only need one spec. Open that spec instead.
|
|
6
|
+
|
|
7
|
+
## Lessons
|
|
8
|
+
|
|
9
|
+
Add short lessons here. One line per lesson. Say what happened and what to do next time.
|
|
10
|
+
|
|
11
|
+
- TBD
|
|
12
|
+
|
|
13
|
+
## Odd bugs
|
|
14
|
+
|
|
15
|
+
Add bugs that were hard to find. Say what the symptom was and what fixed it.
|
|
16
|
+
|
|
17
|
+
- TBD
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# PROMPTS.md
|
|
2
|
+
|
|
3
|
+
Purpose. This file holds standard prompts for {{project_name}}.
|
|
4
|
+
Read when. You need a prompt for review, refactor, or a new feature.
|
|
5
|
+
Do not read when. You already have a prompt that works. Use it.
|
|
6
|
+
|
|
7
|
+
## Code review
|
|
8
|
+
|
|
9
|
+
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.
|
|
10
|
+
|
|
11
|
+
## Refactor
|
|
12
|
+
|
|
13
|
+
Refactor only the code in scope. Keep behavior the same. Run tests after the change. Show the test result.
|
|
14
|
+
|
|
15
|
+
## New feature
|
|
16
|
+
|
|
17
|
+
Read the spec first. Read ARCHITECTURE.md next. Then write code and tests. Do not skip tests.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Create Feature
|
|
2
|
+
|
|
3
|
+
Purpose. This file is the SOP to create a feature from a spec.
|
|
4
|
+
Read when. You start a new feature.
|
|
5
|
+
Do not read when. You fix a small bug. That does not need a full feature flow.
|
|
6
|
+
|
|
7
|
+
## Steps
|
|
8
|
+
|
|
9
|
+
1. Read the spec in `specs`. Check its status is Approved.
|
|
10
|
+
2. Read ARCHITECTURE.md and CODING_STANDARDS.md.
|
|
11
|
+
3. Write the code in the source folder.
|
|
12
|
+
4. Write tests in the test folder.
|
|
13
|
+
5. Run the tests. Fix failures before you move on.
|
|
14
|
+
6. Update TASKS.md when the feature is done.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Implement Spec
|
|
2
|
+
|
|
3
|
+
Purpose. This file is the SOP to build an approved spec.
|
|
4
|
+
Read when. A spec is Approved and you start coding.
|
|
5
|
+
Do not read when. The spec is not Approved yet. Review it first.
|
|
6
|
+
|
|
7
|
+
## Steps
|
|
8
|
+
|
|
9
|
+
1. Read the spec again. Note the acceptance cases.
|
|
10
|
+
2. Read the related docs listed in the spec.
|
|
11
|
+
3. Write code in small steps. Run tests often.
|
|
12
|
+
4. Do not change code outside the spec scope.
|
|
13
|
+
5. Stop and ask when the spec and the code disagree.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Pre Deploy Check
|
|
2
|
+
|
|
3
|
+
Purpose. This file is the SOP to check before a release.
|
|
4
|
+
Read when. You are about to deploy.
|
|
5
|
+
Do not read when. You only work locally. That does not need a deploy check.
|
|
6
|
+
|
|
7
|
+
## Steps
|
|
8
|
+
|
|
9
|
+
1. Run all tests. All must pass.
|
|
10
|
+
2. Check the spec acceptance cases. All must pass.
|
|
11
|
+
3. Check env vars are set. Do not log real secrets.
|
|
12
|
+
4. Check CHANGELOG.md is updated.
|
|
13
|
+
5. Deploy only when all checks pass. If one fails, fix it first.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Review Spec
|
|
2
|
+
|
|
3
|
+
Purpose. This file is the SOP to review a spec before it is built.
|
|
4
|
+
Read when. A spec is ready for review.
|
|
5
|
+
Do not read when. The spec is still a draft. Wait until it is ready.
|
|
6
|
+
|
|
7
|
+
## Steps
|
|
8
|
+
|
|
9
|
+
1. Read the spec. Check the goal is clear.
|
|
10
|
+
2. Check each requirement is checkable.
|
|
11
|
+
3. Check out of scope is written.
|
|
12
|
+
4. Check acceptance cases exist.
|
|
13
|
+
5. Mark the spec Approved only when all checks pass. If not, list what is missing.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Sync Docs
|
|
2
|
+
|
|
3
|
+
Purpose. This file is the SOP to sync docs when code changes.
|
|
4
|
+
Read when. Code changed and docs may be out of date.
|
|
5
|
+
Do not read when. Only docs changed. That does not need a sync check.
|
|
6
|
+
|
|
7
|
+
## Steps
|
|
8
|
+
|
|
9
|
+
1. List the docs that describe the changed code.
|
|
10
|
+
2. Check each doc still matches the code.
|
|
11
|
+
3. Update the doc when it is wrong. Do not change code to match a wrong doc without a decision.
|
|
12
|
+
4. Update STACK.md and MCP.md when a library changed.
|
|
13
|
+
5. Run doctor checks when they exist.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# markflow
|
|
2
|
+
|
|
3
|
+
Purpose. This folder holds all project context for {{project_name}}. It is the single place for intent, decisions, specs, and tasks.
|
|
4
|
+
Read when. You start work on this project or you need to know why something was built this way.
|
|
5
|
+
Do not read when. You only need one specific spec. Open that spec directly instead.
|
|
6
|
+
|
|
7
|
+
## Map
|
|
8
|
+
|
|
9
|
+
- `docs/PRD.md`. Vision, users, and features. Read it when you start a new feature or check if a feature still fits the vision.
|
|
10
|
+
- `docs/ARCHITECTURE.md`. Stack, layout, and flow. Read it when you pick a stack or decide where code goes.
|
|
11
|
+
- `docs/DATA_MODEL.md`. Schema and relations. Read it when you change data.
|
|
12
|
+
- `docs/API.md`. Endpoints and payloads. Read it when you work on an API.
|
|
13
|
+
- `docs/TESTING.md`. Test strategy. Read it before you write tests.
|
|
14
|
+
- `docs/DEPLOY.md`. Release flow and env setup. Read it before you deploy.
|
|
15
|
+
- `docs/GLOSSARY.md`. Domain terms. Read it when a term is unclear.
|
|
16
|
+
- `docs/CODING_STANDARDS.md`. Code rules. Read it before you write or review code.
|
|
17
|
+
- `docs/STACK.md`. Libraries and their MCP servers. Read it when you add or replace a library.
|
|
18
|
+
- `docs/MCP.md`. MCP servers and setup. Read it when you set up an AI tool.
|
|
19
|
+
- `specs/index.md`. List of all specs plus status. Read it first before you open one spec.
|
|
20
|
+
- `specs/_template.md`. Template for a new spec. Use it when you create a spec.
|
|
21
|
+
- `.agents/MEMORY.md`. Dynamic context, lessons, and odd bugs.
|
|
22
|
+
- `.agents/PROMPTS.md`. Standard prompts.
|
|
23
|
+
- `.agents/RULES.md`. One line pointer to CODING_STANDARDS.md. It holds no duplicate rules.
|
|
24
|
+
- `.agents/mcp.json`. Master MCP config. Copy it to your AI tool location during sync. Do not put API keys here. Use env vars.
|
|
25
|
+
- `.agents/workflows`. Step by step SOPs, from review spec to pre deploy check.
|
|
26
|
+
|
|
27
|
+
## Tasks and changes
|
|
28
|
+
|
|
29
|
+
- `TASKS.md`. Active work and progress.
|
|
30
|
+
- `CHANGELOG.md`. Release history.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# TASKS.md
|
|
2
|
+
|
|
3
|
+
Purpose. This file tracks active work for {{project_name}}.
|
|
4
|
+
Read when. You start work or you want to know what is done and what is left.
|
|
5
|
+
Do not read when. You only need one spec. Open that spec directly instead.
|
|
6
|
+
|
|
7
|
+
## Active
|
|
8
|
+
|
|
9
|
+
- [ ] Add the first spec in `specs/index.md`
|
|
10
|
+
|
|
11
|
+
## Done
|
|
12
|
+
|
|
13
|
+
- [ ] None yet
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# API.md
|
|
2
|
+
|
|
3
|
+
Purpose. This file is the contract for the API of {{project_name}}.
|
|
4
|
+
Read when. You work on an endpoint or a client that calls it.
|
|
5
|
+
Do not read when. You work on code that does not touch the API.
|
|
6
|
+
|
|
7
|
+
## Auth
|
|
8
|
+
|
|
9
|
+
Write how auth works. If there is no auth yet, write TBD.
|
|
10
|
+
|
|
11
|
+
## Endpoints
|
|
12
|
+
|
|
13
|
+
List each endpoint with method, path, request, and response. Keep each entry short.
|
|
14
|
+
|
|
15
|
+
### TBD
|
|
16
|
+
|
|
17
|
+
- Method. TBD
|
|
18
|
+
- Request. TBD
|
|
19
|
+
- Response. TBD
|
|
20
|
+
- Errors. TBD
|
|
21
|
+
|
|
22
|
+
## Rules
|
|
23
|
+
|
|
24
|
+
Write the shared rules. Examples are error format and pagination. Do not repeat one endpoint detail here.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# ARCHITECTURE.md
|
|
2
|
+
|
|
3
|
+
Purpose. This file explains the stack, the layout, and the flow of {{project_name}}.
|
|
4
|
+
Read when. You pick a stack or decide where code goes.
|
|
5
|
+
Do not read when. You need one feature detail. Open its spec instead.
|
|
6
|
+
|
|
7
|
+
## Detected stack
|
|
8
|
+
|
|
9
|
+
Write what discovery found. If discovery found nothing yet, write TBD.
|
|
10
|
+
|
|
11
|
+
- Language. TBD
|
|
12
|
+
- Framework. TBD
|
|
13
|
+
- Database. TBD
|
|
14
|
+
|
|
15
|
+
## Layout
|
|
16
|
+
|
|
17
|
+
Write where code lives. Write where tests live. Do not invent folders that do not exist yet. Mark planned folders as planned.
|
|
18
|
+
|
|
19
|
+
## Flow
|
|
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.
|
|
22
|
+
|
|
23
|
+
1. TBD
|
|
24
|
+
2. TBD
|
|
25
|
+
3. TBD
|
|
26
|
+
|
|
27
|
+
## Decisions
|
|
28
|
+
|
|
29
|
+
Link to ADRs in `adr` when a choice affects architecture. Do not repeat the full reason here.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# CODING_STANDARDS.md
|
|
2
|
+
|
|
3
|
+
Purpose. This file holds the code rules for {{project_name}}.
|
|
4
|
+
Read when. You write or review code.
|
|
5
|
+
Do not read when. You only edit docs. Docs do not need code rules.
|
|
6
|
+
|
|
7
|
+
## 1. Language
|
|
8
|
+
|
|
9
|
+
Code, variable names, function names, class names, file names, and folder names use English.
|
|
10
|
+
Docs use English for this template. Change the doc language in PRD when the project needs another language.
|
|
11
|
+
|
|
12
|
+
## 2. Naming
|
|
13
|
+
|
|
14
|
+
Write your naming pattern here. Decide the case for files, functions, and constants. Then follow it everywhere.
|
|
15
|
+
|
|
16
|
+
- Files. TBD
|
|
17
|
+
- Functions. TBD
|
|
18
|
+
- Constants. TBD
|
|
19
|
+
|
|
20
|
+
## 3. Function format
|
|
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.
|
|
23
|
+
|
|
24
|
+
## 4. Comments
|
|
25
|
+
|
|
26
|
+
Write a comment only when logic is hard to follow without it. Use simple comments. For one line use two slashes. For many lines use slash star and star slash. Do not use decorative comment lines.
|
|
27
|
+
|
|
28
|
+
## 5. File structure
|
|
29
|
+
|
|
30
|
+
Write the order of parts in a file here. Decide what comes first, imports or constants or the main function. Then follow it.
|
|
31
|
+
|
|
32
|
+
## 6. What to avoid
|
|
33
|
+
|
|
34
|
+
Avoid em dashes. Avoid colons in prose. Avoid formal and cliché words. Avoid words like delve, leverage, seamless, robust, and cutting edge. If a sentence sounds like a sales page, rewrite it.
|
|
35
|
+
|
|
36
|
+
## 7. Enforcement
|
|
37
|
+
|
|
38
|
+
This file states intent. Config files enforce it. Examples are editor config, lint config, and format config. Keep both in sync. When a rule here changes, update the config too.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# DATA_MODEL.md
|
|
2
|
+
|
|
3
|
+
Purpose. This file explains the data for {{project_name}}.
|
|
4
|
+
Read when. You change data, add a table, or change a relation.
|
|
5
|
+
Do not read when. You only change UI text. That does not touch data.
|
|
6
|
+
|
|
7
|
+
## Entities
|
|
8
|
+
|
|
9
|
+
List the main entities. One line per entity. Say what it holds.
|
|
10
|
+
|
|
11
|
+
- TBD
|
|
12
|
+
|
|
13
|
+
## Relations
|
|
14
|
+
|
|
15
|
+
Write how entities link to each other. Use plain words. Avoid jargon when you can.
|
|
16
|
+
|
|
17
|
+
## Rules
|
|
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.
|
|
20
|
+
|
|
21
|
+
## Migrations
|
|
22
|
+
|
|
23
|
+
Write how schema changes are made and tested. Keep it short.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# DEPLOY.md
|
|
2
|
+
|
|
3
|
+
Purpose. This file explains how {{project_name}} is released.
|
|
4
|
+
Read when. You deploy or you set up env vars.
|
|
5
|
+
Do not read when. You only change local code. That does not need deploy notes.
|
|
6
|
+
|
|
7
|
+
## Release flow
|
|
8
|
+
|
|
9
|
+
Write the steps from main branch to production. Keep each step to one line.
|
|
10
|
+
|
|
11
|
+
1. TBD
|
|
12
|
+
2. TBD
|
|
13
|
+
3. TBD
|
|
14
|
+
|
|
15
|
+
## Env vars
|
|
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.
|
|
18
|
+
|
|
19
|
+
- TBD
|
|
20
|
+
|
|
21
|
+
## Rollback
|
|
22
|
+
|
|
23
|
+
Write how to roll back a bad release. Keep it short.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# GLOSSARY.md
|
|
2
|
+
|
|
3
|
+
Purpose. This file defines domain terms for {{project_name}}.
|
|
4
|
+
Read when. A term is unclear or two people use the same word in different ways.
|
|
5
|
+
Do not read when. You already know the term. Skip it.
|
|
6
|
+
|
|
7
|
+
## Terms
|
|
8
|
+
|
|
9
|
+
Add one entry per term. Keep each definition to one or two sentences.
|
|
10
|
+
|
|
11
|
+
- TBD. Write the definition here.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# MCP.md
|
|
2
|
+
|
|
3
|
+
Purpose. This file lists MCP servers for {{project_name}}.
|
|
4
|
+
Read when. You set up an AI tool or you add a library that has an MCP server.
|
|
5
|
+
Do not read when. You work without AI. MCP is optional for humans.
|
|
6
|
+
|
|
7
|
+
## Servers
|
|
8
|
+
|
|
9
|
+
Add one entry per server. Say what it is for and what env it needs.
|
|
10
|
+
|
|
11
|
+
- TBD. Purpose. TBD. Env needed. TBD.
|
|
12
|
+
|
|
13
|
+
## Setup
|
|
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.
|
|
16
|
+
|
|
17
|
+
## Rules
|
|
18
|
+
|
|
19
|
+
A library with an MCP server should list it in STACK.md too. Keep both files in sync.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# PRD.md
|
|
2
|
+
|
|
3
|
+
Purpose. This file explains what {{project_name}} is for, who uses it, and what it must do.
|
|
4
|
+
Read when. You start a new feature or check if a feature still fits the vision.
|
|
5
|
+
Do not read when. You need code detail. Open a spec in `specs` instead.
|
|
6
|
+
|
|
7
|
+
## Vision
|
|
8
|
+
|
|
9
|
+
Write one short paragraph. What problem does this project solve. Who has that problem today.
|
|
10
|
+
|
|
11
|
+
## Users
|
|
12
|
+
|
|
13
|
+
List the main users. Write one line per user type. Say what each type needs most.
|
|
14
|
+
|
|
15
|
+
## Features
|
|
16
|
+
|
|
17
|
+
List the core features. Keep each item to one line for now. Detail goes in a spec later.
|
|
18
|
+
|
|
19
|
+
- TBD
|
|
20
|
+
|
|
21
|
+
## Out of scope
|
|
22
|
+
|
|
23
|
+
List what this project will not do. This stops scope creep early.
|
|
24
|
+
|
|
25
|
+
- TBD
|
|
26
|
+
|
|
27
|
+
## Success
|
|
28
|
+
|
|
29
|
+
Write how you will know this project works. Use plain words. Avoid numbers you cannot check.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# STACK.md
|
|
2
|
+
|
|
3
|
+
Purpose. This file lists libraries for {{project_name}} and why each one is used.
|
|
4
|
+
Read when. You add or replace a library.
|
|
5
|
+
Do not read when. You only fix a bug in existing code. That does not change the stack.
|
|
6
|
+
|
|
7
|
+
## Libraries
|
|
8
|
+
|
|
9
|
+
Add one row per library. Keep the reason short.
|
|
10
|
+
|
|
11
|
+
| Need | Library | MCP server | Reason |
|
|
12
|
+
| Auth | TBD | TBD | TBD |
|
|
13
|
+
| Database | TBD | TBD | TBD |
|
|
14
|
+
| UI | TBD | TBD | TBD |
|
|
15
|
+
|
|
16
|
+
## Rules
|
|
17
|
+
|
|
18
|
+
Do not add a library without a need and a reason. A library must bring its MCP server when one exists. Update MCP.md when you add a row here.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# TESTING.md
|
|
2
|
+
|
|
3
|
+
Purpose. This file explains how {{project_name}} is tested.
|
|
4
|
+
Read when. You write tests or you check if a change is safe.
|
|
5
|
+
Do not read when. You only edit docs. Docs do not need tests.
|
|
6
|
+
|
|
7
|
+
## Levels
|
|
8
|
+
|
|
9
|
+
Write what you test at each level. Keep it short.
|
|
10
|
+
|
|
11
|
+
- Unit. TBD
|
|
12
|
+
- Integration. TBD
|
|
13
|
+
- End to end. TBD
|
|
14
|
+
|
|
15
|
+
## How to run tests
|
|
16
|
+
|
|
17
|
+
Write the exact command to run tests. Write what a pass looks like.
|
|
18
|
+
|
|
19
|
+
## Edge cases
|
|
20
|
+
|
|
21
|
+
List the edge cases that often break. Add new ones when you find them.
|
|
22
|
+
|
|
23
|
+
- TBD
|
|
24
|
+
|
|
25
|
+
## Rules
|
|
26
|
+
|
|
27
|
+
Do not claim work is done without test evidence. A green test run is the evidence. A manual check alone is not enough for risky changes.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# 001 Initial Stack
|
|
2
|
+
|
|
3
|
+
Purpose. This file records the first stack choice for {{project_name}}.
|
|
4
|
+
Read when. You wonder why this stack was picked.
|
|
5
|
+
Do not read when. You work on a single feature. Open its spec instead.
|
|
6
|
+
|
|
7
|
+
## Decision
|
|
8
|
+
|
|
9
|
+
The initial stack is TBD. Discovery will fill this in during init.
|
|
10
|
+
|
|
11
|
+
## Context
|
|
12
|
+
|
|
13
|
+
Write what discovery found. List the manifest files that proved the stack.
|
|
14
|
+
|
|
15
|
+
## Options considered
|
|
16
|
+
|
|
17
|
+
- TBD
|
|
18
|
+
|
|
19
|
+
## Outcome
|
|
20
|
+
|
|
21
|
+
Write the picked stack and the main reason. Mark anything unsure as TBD.
|
|
22
|
+
|
|
23
|
+
## Status
|
|
24
|
+
|
|
25
|
+
Draft
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# ADR Template
|
|
2
|
+
|
|
3
|
+
Purpose. This file is the template for a new architecture decision.
|
|
4
|
+
Read when. You need to record a decision that affects architecture.
|
|
5
|
+
Do not read when. You only fix a small bug. That does not need an ADR.
|
|
6
|
+
|
|
7
|
+
## Decision
|
|
8
|
+
|
|
9
|
+
Write the decision in one sentence.
|
|
10
|
+
|
|
11
|
+
## Context
|
|
12
|
+
|
|
13
|
+
Write why this decision was needed. Keep it short.
|
|
14
|
+
|
|
15
|
+
## Options considered
|
|
16
|
+
|
|
17
|
+
List the options you considered. One line per option.
|
|
18
|
+
|
|
19
|
+
- TBD
|
|
20
|
+
|
|
21
|
+
## Outcome
|
|
22
|
+
|
|
23
|
+
Write what you picked and why. Write what you gave up.
|
|
24
|
+
|
|
25
|
+
## Status
|
|
26
|
+
|
|
27
|
+
Write Draft or Approved.
|