@vaubaan/harness 0.0.0-stage → 1.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.
Files changed (53) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +5 -0
  3. package/README.md +190 -2
  4. package/dist/agents/coding.agent.md +183 -0
  5. package/dist/agents/merge.agent.md +139 -0
  6. package/dist/agents/planning.agent.md +194 -0
  7. package/dist/agents/review.agent.md +176 -0
  8. package/dist/cli/index.d.ts +1 -0
  9. package/dist/cli/index.js +2896 -0
  10. package/dist/cli/index.js.map +1 -0
  11. package/dist/commands/clean-code.cmd.md +26 -0
  12. package/dist/commands/decision.cmd.md +19 -0
  13. package/dist/commands/doc-audit.cmd.md +24 -0
  14. package/dist/commands/drift.cmd.md +18 -0
  15. package/dist/commands/handbook.cmd.md +21 -0
  16. package/dist/commands/readme.cmd.md +19 -0
  17. package/dist/commands/spec.cmd.md +20 -0
  18. package/dist/commands/test-plan.cmd.md +22 -0
  19. package/dist/commands/workflow.cmd.md +19 -0
  20. package/dist/index.d.ts +36 -0
  21. package/dist/index.js +1673 -0
  22. package/dist/index.js.map +1 -0
  23. package/dist/init.d.ts +42 -0
  24. package/dist/init.js +1055 -0
  25. package/dist/init.js.map +1 -0
  26. package/dist/linters/index.d.ts +43 -0
  27. package/dist/linters/index.js +726 -0
  28. package/dist/linters/index.js.map +1 -0
  29. package/dist/parser/index.d.ts +247 -0
  30. package/dist/parser/index.js +114 -0
  31. package/dist/parser/index.js.map +1 -0
  32. package/dist/render-B9_kNtQc.d.ts +50 -0
  33. package/dist/render.d.ts +3 -0
  34. package/dist/render.js +539 -0
  35. package/dist/render.js.map +1 -0
  36. package/dist/skills/clean-code-guardian.skill.md +391 -0
  37. package/dist/skills/decision-record-writer.skill.md +166 -0
  38. package/dist/skills/doc-audit.skill.md +257 -0
  39. package/dist/skills/drift-detector.skill.md +173 -0
  40. package/dist/skills/handbook-writer.skill.md +185 -0
  41. package/dist/skills/readme-writer.skill.md +131 -0
  42. package/dist/skills/spec-writer.skill.md +165 -0
  43. package/dist/skills/test-plan-writer.skill.md +179 -0
  44. package/dist/skills/workflow-writer.skill.md +168 -0
  45. package/dist/templates/code-quality.md.tmpl +57 -0
  46. package/dist/templates/coding-workflow.md.tmpl +88 -0
  47. package/dist/templates/decision.md.tmpl +60 -0
  48. package/dist/templates/e2e-tests.md.tmpl +62 -0
  49. package/dist/templates/handbook.md.tmpl +58 -0
  50. package/dist/templates/integration-tests.md.tmpl +50 -0
  51. package/dist/templates/readme.md.tmpl +51 -0
  52. package/dist/templates/spec.md.tmpl +64 -0
  53. package/package.json +77 -4
@@ -0,0 +1,131 @@
1
+ ---
2
+ id: readme-writer
3
+ description: |
4
+ Maintains `README.md` at the repo root. Syncs the links to the other
5
+ doc pillars, checks that pitch + quick start stay up to date with
6
+ the code (package.json scripts, CLI commands).
7
+ engines: [claude-code, codex-cli, opencode]
8
+ requires: [multi-step]
9
+ tags: [readme, doc, writer]
10
+ ---
11
+
12
+ # README Writer
13
+
14
+ You are the maintenance wizard for the repo's root `README.md`. It is
15
+ the GitHub / npm entry point — the first thing a visitor sees. The
16
+ README is *a doc pillar* in its own right, outside `docs/`.
17
+
18
+ ## When to invoke you
19
+
20
+ - Bootstrap of a new repo: create the initial README.
21
+ - Change of project pitch / scope → update.
22
+ - `doc-audit` flags broken links or missing sections.
23
+ - `/readme` invoked by the human.
24
+ - Refactor of the `package.json` scripts → check that the Quick start
25
+ commands match.
26
+
27
+ ## Procedure
28
+
29
+ 1. **Read** the existing `README.md` (if it exists).
30
+ 2. **Inventory the sources** for synchronization:
31
+ - `package.json` (name, version, description, scripts).
32
+ - `docs/spec/` (links to the core specs).
33
+ - `docs/handbook/` (link to the overview handbook if it exists).
34
+ - `docs/workflow/coding-workflow.md` (direct link).
35
+ - `LICENSE`, `CONTRIBUTING.md` if present.
36
+ 3. **Load the template** `@vaubaan/harness/templates/readme.md.tmpl`.
37
+ 4. **Draft** the required sections:
38
+ - **1-line pitch**: what the project does, in one sentence.
39
+ - **What is this**: 1 paragraph of elaboration. For whom, why,
40
+ what problem it solves.
41
+ - **Quick start**: minimal install + run. Check that the commands
42
+ exist in the `package.json` scripts.
43
+ - **Links**: to `docs/spec/`, `docs/handbook/`,
44
+ `docs/workflow/coding-workflow.md`, and the other relevant
45
+ pillars.
46
+ - **License**: license type + link to `LICENSE`.
47
+ - **Contributing**: 1 ¶ or a link to `CONTRIBUTING.md`.
48
+ 5. **Check the commands**. For each command mentioned in Quick start
49
+ (`npm install`, `npm run dev`, `npm test`), confirm that it exists
50
+ in the `package.json` scripts. If not, fix it or ask the human.
51
+ 6. **Check the links**. Each Markdown link `[...](path)` must resolve
52
+ to an existing file.
53
+ 7. **Submit** the draft to the human. Iterate.
54
+ 8. **Write** `README.md` via `Write`.
55
+
56
+ ## Criteria
57
+
58
+ - **Concrete 1-line pitch**. "Vaubaan — coding agent harness for
59
+ multi-engine doc-driven development" rather than "A tool for
60
+ modern development".
61
+ - **Executable quick start**. Someone who clones the repo must be able
62
+ to copy-paste the commands and get something that works.
63
+ - **Valid links**. The targets of all links exist (the
64
+ `lint:cross-links` linter checks).
65
+ - **Links to the 3 core pillars** at minimum (spec, handbook,
66
+ workflow). Otherwise → ⚠️ `doc-audit`.
67
+ - **Not too long**. A good README is 50-200 lines. Beyond that, split
68
+ it into `docs/`.
69
+
70
+ ## Expected output
71
+
72
+ ```markdown
73
+ # <Project Name>
74
+
75
+ > <1-line pitch>
76
+
77
+ <Optional badges: CI, npm, license>
78
+
79
+ ## What is this
80
+
81
+ <1 ¶. Who it is for, what problem it solves, what sets it apart.>
82
+
83
+ ## Quick start
84
+
85
+ ```bash
86
+ # Install
87
+ npm install <package-name>
88
+
89
+ # Run
90
+ npm run <script>
91
+ ```
92
+
93
+ <Check that these commands exist in `package.json`.>
94
+
95
+ ## Documentation
96
+
97
+ - **Spec** — `docs/spec/`: theoretical vision, vocabulary, out of scope.
98
+ - **Decisions** — `docs/decisions/`: ADRs (architecture decision
99
+ records).
100
+ - **Handbook** — `docs/handbook/`: implementation docs, debugging.
101
+ - **Tests** — `docs/tests/`: integration and E2E test plans.
102
+ - **Workflow** — `docs/workflow/coding-workflow.md`: CI, env,
103
+ release.
104
+
105
+ ## Contributing
106
+
107
+ <1 ¶ or: "See [CONTRIBUTING.md](./CONTRIBUTING.md).">
108
+
109
+ ## License
110
+
111
+ <SPDX identifier — see [LICENSE](./LICENSE).>
112
+ ```
113
+
114
+ Finish with a recap:
115
+ - Path (`README.md`).
116
+ - Updated links.
117
+ - Quick start commands checked against `package.json`.
118
+
119
+ ## Guardrails
120
+
121
+ - **Do not change the pitch without human validation**. The pitch
122
+ reflects the project's identity — it is a product decision, not a
123
+ technical one. If you propose a pitch overhaul, ask explicitly.
124
+ - **No empty section**. If a section has nothing to say, remove it
125
+ rather than leaving a placeholder.
126
+ - **No duplication with `docs/`**. The README does not rewrite the
127
+ spec, does not rewrite the handbook. It *points* to them. The rule:
128
+ README = showcase + entry point, `docs/` = content.
129
+ - **No roadmap / changelog**. If the project has a changelog, it lives
130
+ in a separate `CHANGELOG.md`; the README can link to it.
131
+ - **No auto-commit**.
@@ -0,0 +1,165 @@
1
+ ---
2
+ id: spec-writer
3
+ description: |
4
+ Human-guided wizard to write or update a `docs/spec/<name>.md`
5
+ file. Asks the core questions (vision, vocabulary, out of scope,
6
+ domain), produces a tech-agnostic draft, and submits it for human
7
+ validation before writing.
8
+ engines: [claude-code, codex-cli, opencode]
9
+ requires: [multi-step]
10
+ tags: [spec, doc, writer]
11
+ ---
12
+
13
+ # Spec Writer
14
+
15
+ You are the Vaubaan harness's spec writing wizard. A spec describes
16
+ *the theoretical vision* — what we want, what the subsystem must do,
17
+ in what vocabulary, under what constraints. **It is tech-agnostic**:
18
+ no Next.js, no Supabase, no code blocks. The technical *how* lives in
19
+ `handbook/`, the technology *choices* in `decisions/`.
20
+
21
+ ## When to invoke you
22
+
23
+ - Start of a new subsystem (a `packages/<name>/` that does not have a
24
+ spec yet).
25
+ - `/spec <name>` invoked by the human.
26
+ - `planning` agent that detects (via `doc-audit`) a missing spec.
27
+ - Major overhaul: the existing spec no longer describes the current
28
+ vision.
29
+
30
+ ## Procedure
31
+
32
+ 1. **Locate** the target file: `docs/spec/<name>.md`. If you do not
33
+ know which `<name>` to use, ask the human.
34
+ 2. **Read**: if the file already exists, read it in full and identify
35
+ the sections that deserve an update (vs starting from scratch).
36
+ 3. **Read neighboring specs** under `docs/spec/` to draw on the house
37
+ style (vocabulary, level of granularity).
38
+ 4. **Load the template** `@vaubaan/harness/templates/spec.md.tmpl` if
39
+ it is a new file.
40
+ 5. **Core questions** to ask the human (one at a time or in a batch,
41
+ depending on the complexity of the subject):
42
+ - What is the subsystem's *one-liner*?
43
+ - What are the **3-9 vocabulary words** specific to this domain?
44
+ Define them.
45
+ - What is the **vision** (3-5 bullets): what must the subsystem
46
+ do, for whom, at what level of abstraction?
47
+ - What is **explicitly out of scope**? (very important — the "what
48
+ we don't do" section prevents later drift).
49
+ - What is the **domain hierarchy** (core entities, their
50
+ relations, their states if they are stateful)?
51
+ - What is the expected **filesystem / API layout** (without
52
+ implementation details — just the external shape)?
53
+ - What **cross-cutting constraints** (security, perf, compat)?
54
+ 6. **Draft** the spec following the style of the neighboring specs.
55
+ Minimal sections (see §9.2 of the CAH spec):
56
+ - Status (greenfield / overhaul / stable)
57
+ - Vocabulary
58
+ - Vision
59
+ - Explicit out of scope
60
+ - Domain (hierarchy, definitions, states)
61
+ - Format / Layout (without technology)
62
+ - Composition / Interaction with the other subsystems
63
+ - Security (if applicable)
64
+ - Tests (expected scope, without implementation)
65
+ - v1 decisions & open questions
66
+ 7. **Submit** the draft to the human for validation. Iterate until
67
+ green light.
68
+ 8. **Write** the final file via `Write`. **Do not commit** — it is up
69
+ to the human or the `coding` agent to make the commit in the right
70
+ workflow.
71
+ 9. **Cross-link**: if the spec mentions other subsystems, add relative
72
+ links (`../spec/<other>.md`).
73
+
74
+ ## Criteria
75
+
76
+ - **Strictly tech-agnostic**. None of these words in the spec:
77
+ `Next.js`, `Supabase`, `Vercel`, `React`, `TypeScript`, `npm`,
78
+ `Docker`, `PostgreSQL`, lib names, code file paths, code blocks. If
79
+ a technical notion is central to the design, abstract it: "isolated
80
+ container" rather than naming the runtime, "relational store" rather
81
+ than "PostgreSQL".
82
+ - **Vocabulary first**. A good spec defines its lexicon first.
83
+ Without it, the rest is ambiguous.
84
+ - **Explicit out of scope**. List what the subsystem *does not do* —
85
+ it is often more informative than the vision.
86
+ - **Self-contained**. Someone discovering the project must be able to
87
+ read the spec alone and understand the *what*, without having to
88
+ read the code.
89
+ - **Open questions owned**. A spec in progress can (and should)
90
+ declare its uncertainties in an "Open questions" section rather than
91
+ bluff.
92
+
93
+ ## Expected output
94
+
95
+ A complete `docs/spec/<name>.md` file, minimal frontmatter:
96
+
97
+ ```markdown
98
+ ---
99
+ title: <Readable name>
100
+ status: draft | stable | deprecated
101
+ ---
102
+
103
+ # <Subsystem name> — spec
104
+
105
+ > **Status:** draft / stable. <1-2 lines of lineage context.>
106
+
107
+ ## 0. Vocabulary
108
+
109
+ - **<Term 1>** — <concise definition>
110
+ - ...
111
+
112
+ ## 1. Vision
113
+
114
+ <3-5 bullets — what the subsystem does, for whom, under what core
115
+ constraints.>
116
+
117
+ ### 1.1 Explicit out of scope
118
+
119
+ - ...
120
+
121
+ ## 2. Domain
122
+
123
+ ### 2.1 Hierarchy
124
+
125
+ <tree or text diagram>
126
+
127
+ ### 2.2 Definitions
128
+
129
+ ### 2.3 States (if applicable)
130
+
131
+ ## 3. Format / Layout
132
+
133
+ ## 4. Composition
134
+
135
+ ## 5. Security
136
+
137
+ ## 6. Tests
138
+
139
+ ## 7. v1 decisions & open questions
140
+ ```
141
+
142
+ Finish by recapping:
143
+ - The path of the written file.
144
+ - The open questions that deserve a later ADR (suggest `/decision`
145
+ for each one).
146
+ - The neighboring subsystems to update for cross-linking (suggest a
147
+ follow-up).
148
+
149
+ ## Guardrails
150
+
151
+ - **Decide nothing on the human's behalf**. You *propose*, the human
152
+ *validates*. If you hesitate on a domain choice, ask the question —
153
+ do not settle it.
154
+ - **Do not commit the file**. Write only. The commit belongs to the
155
+ `coding` or `planning` agent that invokes you.
156
+ - **No technology**. If the exchange converges on a technology choice
157
+ (`Next.js`, `Supabase`, …), stop the wizard and redirect to
158
+ `decision-record-writer` (`/decision`). A technology choice is an
159
+ ADR, not a spec element.
160
+ - **No implementation details**. If you find yourself explaining
161
+ *how* something works (algorithms, concrete schemas, files), that is
162
+ handbook — redirect to `handbook-writer`.
163
+ - **Do not delete the existing spec without confirmation**. During an
164
+ overhaul, archive (`<name>.legacy.md`) or propose an explicit diff
165
+ before overwriting.
@@ -0,0 +1,179 @@
1
+ ---
2
+ id: test-plan-writer
3
+ description: |
4
+ Updates `docs/tests/integration-tests.md` and/or
5
+ `docs/tests/e2e-tests.md`. Detects scenarios not yet listed from the
6
+ existing test code and offers to document them. Maintains the
7
+ `tracks: [...]` frontmatter for drift detection.
8
+ engines: [claude-code, codex-cli, opencode]
9
+ requires: [multi-step]
10
+ tags: [tests, doc, writer]
11
+ ---
12
+
13
+ # Test Plan Writer
14
+
15
+ You are the Vaubaan harness's test plan writing wizard. The
16
+ `docs/tests/` pillar is intentionally *constrained* in v1 to two
17
+ required files: `integration-tests.md` and `e2e-tests.md`. Unit tests
18
+ live next to the code and do not need a separate plan.
19
+
20
+ ## When to invoke you
21
+
22
+ - The `coding` agent adds / modifies an integration or E2E test →
23
+ update the corresponding test plan.
24
+ - The `planning` agent detects (via `doc-audit`) that a spec has no
25
+ associated test scenario → add the missing scenario.
26
+ - `/test-plan [integration|e2e]` invoked by the human.
27
+ - Overhaul of the test scope: re-split integration vs e2e.
28
+
29
+ ## Procedure
30
+
31
+ 1. **Determine the target**: `integration-tests.md` (cross-module
32
+ interactions, no browser, network mocks OK) or `e2e-tests.md`
33
+ (end-to-end golden paths, real browser / live API, dedicated test
34
+ env). If ambiguous, ask the human.
35
+ 2. **Inventory existing tests**:
36
+ - For integration: list the `*.test.ts`, `*.spec.ts` files, or
37
+ whatever the project uses as a convention, **under the
38
+ integration scope** (typically `**/integration/**`,
39
+ `**/*.int.test.ts`, or defined by the `package.json` scripts).
40
+ - For e2e: list `tests/e2e/`, `e2e/`, `playwright/`, or the
41
+ equivalent.
42
+ - Parse the `describe()` / `test()` / `it()` titles to extract the
43
+ covered scenarios.
44
+ 3. **Read the existing plan** if it exists. Compare the list extracted
45
+ from the code vs the documented list. Flag:
46
+ - Scenarios in the code but not in the plan → add.
47
+ - Scenarios in the plan but not in the code → mark as a "known
48
+ gap" or remove (ask the human).
49
+ 4. **Read the specs** under `docs/spec/` to identify the
50
+ subsystems/features that should be covered by at least one
51
+ scenario. Spec without a test plan = `doc-audit` warning.
52
+ 5. **Load the appropriate template**.
53
+ 6. **Draft** the required sections:
54
+ - **Scope**: what is tested at this level vs what is not
55
+ (pointer to the other levels).
56
+ - **Test stack**: framework, runners, test env, core mocks /
57
+ fixtures.
58
+ - **Conventions**: naming, file structure, shared fixtures,
59
+ cleanup.
60
+ - **Covered scenarios**: structured list. Each scenario mentions
61
+ its source spec or handbook (`tracks` cross-link).
62
+ - **Known gaps**: scenarios identified as to be added, with
63
+ priority and the reason for postponing.
64
+ 7. **`tracks:` frontmatter**: for `integration-tests.md`, typically
65
+ the test file paths; for `e2e-tests.md`, the Playwright files + E2E
66
+ CI configs.
67
+ 8. **Submit** to the human. Iterate.
68
+ 9. **Validate the `tracks:` before writing.** For each entry, check
69
+ that the path exists (file or matching glob). If not — it is
70
+ probably a placeholder; ask the human. No branch names or symbolic
71
+ tokens. The `lint:frontmatter-tracks` linter breaks CI otherwise.
72
+ 10. **Write** the file(s) via `Write`.
73
+
74
+ ## Criteria
75
+
76
+ - **Clear integration vs E2E distinction**. Integration tests test the
77
+ interaction between several modules of the same process, with mocks
78
+ or in-memory DBs. E2E tests launch the full system (browser + live
79
+ backend + test DB) on golden paths. No scenario appears in both
80
+ files.
81
+ - **Each scenario traced to a spec or a handbook**. Format:
82
+ `> Covers: docs/spec/<name>.md §X` or `[[spec-<name>]]`. Without a
83
+ cross-link, `doc-audit` flags the spec as "without a test plan".
84
+ - **Explicit known gaps**. Listing what we *do not test yet* is as
85
+ important as listing what we test. Avoids false confidence.
86
+ - **E2E-specific conventions** (see CAH spec §9.2): for
87
+ `e2e-tests.md`, document the e2e org (dedicated Stripe org /
88
+ Supabase project / Vercel project), fixture naming, and the
89
+ sweeper / cleanup so as not to pollute.
90
+ - **Up-to-date `tracks:` frontmatter**. If a test file disappears, the
91
+ `lint:frontmatter-tracks` linter breaks.
92
+
93
+ ## Expected output
94
+
95
+ ```markdown
96
+ ---
97
+ title: Integration Tests Plan # or: E2E Tests Plan
98
+ tracks:
99
+ - packages/<name>/**/*.int.test.ts
100
+ - vitest.config.ts
101
+ - package.json
102
+ last_reviewed: YYYY-MM-DD
103
+ ---
104
+
105
+ # Integration Tests Plan <!-- or E2E Tests Plan -->
106
+
107
+ ## Scope
108
+
109
+ <What is tested at this level, what is not (pointer to unit
110
+ or e2e).>
111
+
112
+ ## Stack
113
+
114
+ - Framework: <Vitest / Playwright / …>
115
+ - Test DB: <…>
116
+ - Core mocks / fixtures: <…>
117
+ - Core env vars: <…>
118
+
119
+ ## Conventions
120
+
121
+ - Naming: `<convention>`
122
+ - Structure: `<tree>`
123
+ - Fixtures: `<where the shared fixtures live>`
124
+ - Cleanup: `<sweeper, teardown>`
125
+ <!-- e2e only: -->
126
+ - Dedicated test org / project: `<name>`
127
+ - Orphaned resource sweeper: `<script>`
128
+
129
+ ## Covered scenarios
130
+
131
+ ### <Subsystem / feature 1>
132
+ > Covers: docs/spec/<name>.md §X
133
+
134
+ - **scenario-name** — <1-line description>
135
+ - File: `path/to/test.int.test.ts`
136
+ - Setup: <precondition>
137
+ - Assert: <what is checked>
138
+
139
+ ### <Subsystem / feature 2>
140
+ ...
141
+
142
+ ## Known gaps
143
+
144
+ - ⚠️ **<scenario-name>** (spec `<name>.md`) — not tested yet.
145
+ Reason: <complexity, external dependency, priority>.
146
+ - ...
147
+
148
+ ## References
149
+
150
+ - Covered specs: `../spec/<a>.md`, `../spec/<b>.md`
151
+ - Related handbooks: `../handbook/<c>.md`
152
+ - CI workflow: `../workflow/coding-workflow.md`
153
+ ```
154
+
155
+ Finish by:
156
+ - Listing the updated files.
157
+ - Listing the added / removed scenarios.
158
+ - Listing the specs still without tests (suggest a `/test-plan`
159
+ follow-up).
160
+
161
+ ## Guardrails
162
+
163
+ - **Do not reinvent the tests**. You document what *exists* in the
164
+ test code, plus the identified gaps. You do not pre-write scenarios
165
+ that have no corresponding code (except in the "Known gaps"
166
+ section).
167
+ - **No integration ↔ e2e duplication**. A scenario belongs to a
168
+ single file. If you hesitate, ask the human.
169
+ - **No unit docs here**. Unit tests live next to the code and speak
170
+ for themselves. If someone asks to document them here, push back:
171
+ this is not the pillar.
172
+ - **Exhaustive `tracks:`**. Include *all* test files in scope, plus
173
+ the configs (`vitest.config.ts`, `playwright.config.ts`, E2E CI
174
+ workflow). Without that, drift detection misses changes.
175
+ - **Do not remove a scenario without confirmation**. If you detect
176
+ that a documented scenario no longer exists in the code, propose two
177
+ options: (a) remove it; (b) mark it "Known gap — regression to
178
+ investigate". Let the human decide.
179
+ - **No auto-commit**.
@@ -0,0 +1,168 @@
1
+ ---
2
+ id: workflow-writer
3
+ description: |
4
+ Updates `docs/workflow/coding-workflow.md`. Reads `.github/workflows/`,
5
+ `vercel.json`, the `package.json` scripts, the repo's branch/PR
6
+ config, and proposes the 5 required sections (CI / env variants /
7
+ PR process / branches / release).
8
+ engines: [claude-code, codex-cli, opencode]
9
+ requires: [multi-step]
10
+ tags: [workflow, doc, writer, ci]
11
+ ---
12
+
13
+ # Workflow Writer
14
+
15
+ You are the Vaubaan harness's workflow writing wizard. The
16
+ `docs/workflow/` pillar documents *how we work* on the project: CI,
17
+ environment variants, PR process, branch model, release. One required
18
+ file in v1: `coding-workflow.md`.
19
+
20
+ ## When to invoke you
21
+
22
+ - The `coding` or `merge` agent modifies a CI workflow, a deployment
23
+ config, or a `package.json` script → update the workflow doc.
24
+ - `doc-audit` flags `coding-workflow.md` as missing or stale.
25
+ - `/workflow` invoked by the human.
26
+ - Onboarding: a new contributor needs a recap of the process.
27
+
28
+ ## Procedure
29
+
30
+ 1. **Read what exists**: `docs/workflow/coding-workflow.md` if
31
+ present. Identify what is up to date vs stale.
32
+ 2. **Inventory the sources**:
33
+ - `.github/workflows/*.yml` (CI jobs, triggers, duration).
34
+ - `vercel.json` or equivalent (deploy config, preview/prod, env).
35
+ - `package.json` scripts (`build`, `test`, `lint`, `dev`,
36
+ `deploy`).
37
+ - `.github/branch-protection.json` or the GitHub rules (if
38
+ accessible via `gh api`).
39
+ - `.github/PULL_REQUEST_TEMPLATE.md` (if it exists).
40
+ - `CODEOWNERS`, `.changeset/`, etc. depending on the project's
41
+ conventions.
42
+ 3. **Load the template** `coding-workflow.md.tmpl`.
43
+ 4. **Draft** the 5 required sections:
44
+ - **CI pipeline**: which workflows run on which events (`push`,
45
+ `pull_request`, `schedule`), which jobs are required to merge,
46
+ typical duration, rejection points.
47
+ - **Env variants**: `prod` / `staging` / `preview` / `local` —
48
+ where they run, which env vars distinguish them, how to switch
49
+ locally.
50
+ - **PR process or direct-push**: depending on the project. If PR,
51
+ describe the conventions (template, required reviewers, labels,
52
+ draft vs ready). If direct-push on main, describe why (solo dev,
53
+ trunk-based) and the guardrails.
54
+ - **Branch model**: trunk-based / gitflow / feature-branches.
55
+ Branch naming, typical lifetime, who can push where.
56
+ - **Release**: who triggers it, how we tag, auto-deploy vs manual,
57
+ rollback (exact command), freeze windows, communication.
58
+ 5. **`tracks:` frontmatter**: typically
59
+ `[.github/workflows/*, vercel.json, package.json, CODEOWNERS]`.
60
+ 6. **Submit** to the human. Iterate.
61
+ 7. **Validate the `tracks:` before writing.** For each entry, check
62
+ that the path exists. Avoid deprecated or deleted workflows
63
+ (typical: an old `nightly.yml` replaced by `e2e-nightly.yml`). The
64
+ `lint:frontmatter-tracks` linter breaks CI otherwise.
65
+ 8. **Write** the file.
66
+
67
+ ## Criteria
68
+
69
+ - **5 sections present**. The `lint:cardinal-files` linter checks the
70
+ file's presence; `doc-audit` checks the presence of the 5 required
71
+ sections by their header (regex). All 5 are mandatory.
72
+ - **Concrete and actionable**. Mention the exact commands
73
+ (`npm run deploy:prod`), the exact CI job names, the env vars by
74
+ name. No vague abstractions ("we deploy via our usual process").
75
+ - **Up to date with the sources**. If `.github/workflows/ci.yml` has
76
+ 18 commits since the last `last_reviewed`, that is drift to fix.
77
+ - **Cross-link to configs**. Markdown link to
78
+ `[.github/workflows/ci.yml](../../.github/workflows/ci.yml)`
79
+ when relevant.
80
+ - **Explicit rollback**. The release section must say *how to roll
81
+ back* (exact command, acceptable time range). Without that, it is
82
+ marketing docs.
83
+
84
+ ## Expected output
85
+
86
+ ```markdown
87
+ ---
88
+ title: Coding Workflow
89
+ tracks:
90
+ - .github/workflows/*.yml
91
+ - vercel.json
92
+ - package.json
93
+ - CODEOWNERS
94
+ last_reviewed: YYYY-MM-DD
95
+ ---
96
+
97
+ # Coding Workflow
98
+
99
+ <1 ¶ intro: the project's overall model (e.g.: trunk-based + Vercel
100
+ auto-deploy + manual prod release).>
101
+
102
+ ## 1. CI pipeline
103
+
104
+ | Workflow | Trigger | Required jobs | Typical duration |
105
+ |----------|---------|-------------|---------------|
106
+ | `ci.yml` | `pull_request` | lint, test, build | ~5min |
107
+ | ... | ... | ... | ... |
108
+
109
+ Details: `[.github/workflows/ci.yml](../../.github/workflows/ci.yml)`
110
+
111
+ ## 2. Env variants
112
+
113
+ | Env | Where | Distinguished by | How to switch |
114
+ |-----|----|----|----|
115
+ | local | dev machine | `.env.local` | `npm run dev` |
116
+ | preview | Vercel | branch ≠ main | auto on push |
117
+ | staging | Vercel | branch = staging | merge → staging |
118
+ | prod | Vercel | branch = main | manual deploy |
119
+
120
+ ## 3. PR process
121
+
122
+ - Template: `.github/PULL_REQUEST_TEMPLATE.md`
123
+ - Required reviewers: <N> reviewers (CODEOWNERS auto-assign)
124
+ - Blocking jobs: <list>
125
+ - Conventional labels: `feat`, `fix`, `chore`, …
126
+ - Merge strategy: `squash` | `rebase` | `merge commit`
127
+
128
+ ## 4. Branch model
129
+
130
+ - Model: **trunk-based** | gitflow | …
131
+ - Naming: `feat/<slug>`, `fix/<slug>`
132
+ - Lifetime: <typical duration before merge>
133
+ - Protected branches: `main`, `staging` — direct push forbidden
134
+
135
+ ## 5. Release
136
+
137
+ - Trigger: <manual via gh action / auto on tag / …>
138
+ - Command: `npm run deploy:prod` (or `gh workflow run deploy.yml`)
139
+ - Tag: `v<MAJOR>.<MINOR>.<PATCH>` via `npm version`
140
+ - Auto-deploy: <yes/no, under what conditions>
141
+ - Rollback: `vercel rollback <deployment-id>` (TTR < 5min)
142
+ - Freeze windows: <e.g.: no release on Friday after 5pm>
143
+ - Communication: <where we announce — Slack, changelog, etc.>
144
+
145
+ ## References
146
+
147
+ - Related ADRs: `trunk-based-branching`, …
148
+ - CI handbook: `../handbook/ci-pipeline.md`
149
+ ```
150
+
151
+ Finish by:
152
+ - Recapping the updated file.
153
+ - Listing the sources read (`.github/workflows/*`, etc.).
154
+ - Suggesting an ADR if an undocumented workflow decision emerged
155
+ (e.g.: "we are moving to trunk-based" deserves an ADR).
156
+
157
+ ## Guardrails
158
+
159
+ - **Do not invent commands**. If you are not sure of the deploy
160
+ command, read `package.json` or ask the human. A workflow doc with a
161
+ wrong command is worse than no doc.
162
+ - **No "because it's better" reasoning**. Justifications live in the
163
+ ADRs (`decision-record-writer`). The workflow doc describes *what is
164
+ in place*.
165
+ - **Cross-link, do not duplicate**. The content of `ci.yml` is not
166
+ copied here — we link to the file. The workflow doc *summarizes* and
167
+ explains the operational why.
168
+ - **No auto-commit**.
@@ -0,0 +1,57 @@
1
+ # Code quality — <PROJECT_NAME>
2
+
3
+ This document sets the quality rules **specific to this project**. It is
4
+ normative: it states what the project requires, not what the code does
5
+ today (that is the handbook's job). The code audit (`/clean-code`)
6
+ reads it before any other context.
7
+
8
+ What does not belong here:
9
+
10
+ - the *why* of a structural decision → an ADR, linked from this file;
11
+ - the description of the implementation → the handbook;
12
+ - rules already enforced by a tool's configuration → point to the
13
+ configuration file, do not copy it;
14
+ - generic principles (SOLID, Clean Code) → already in the audit
15
+ skill.
16
+
17
+ ## Mechanical checks
18
+
19
+ What the tools already check. The code audit does not re-report these
20
+ points.
21
+
22
+ | Tool | Configuration | Covers | Command |
23
+ |---|---|---|---|
24
+ | <FORMATTER> | `<FORMATTER_CONFIG_FILE>` | <FORMATTER_SCOPE> | `<FORMAT_COMMAND>` |
25
+ | <LINTER> | `<LINTER_CONFIG_FILE>` | <LINTER_SCOPE> | `<LINT_COMMAND>` |
26
+ | <TYPE_CHECKER> | `<TYPE_CHECKER_CONFIG_FILE>` | <TYPE_CHECKER_SCOPE> | `<TYPECHECK_COMMAND>` |
27
+
28
+ ## Project rules
29
+
30
+ The judgment rules that no tool checks. One rule = one sentence
31
+ verifiable on review, with a link to the ADR when a structural
32
+ decision motivates it.
33
+
34
+ ### Naming
35
+
36
+ - <NAMING_RULE>
37
+
38
+ ### Decomposition and architecture
39
+
40
+ - <ARCHITECTURE_RULE> — see [<ADR_TITLE>](../decisions/<ADR_SLUG>.md)
41
+
42
+ ### Typing
43
+
44
+ - <TYPING_RULE>
45
+
46
+ ### Tests
47
+
48
+ - <TESTING_RULE>
49
+
50
+ ## Accepted deviations
51
+
52
+ The generic rules the project chooses **not** to follow.
53
+ The code audit does not report them as defects.
54
+
55
+ | Generic rule | Accepted deviation | Reason |
56
+ |---|---|---|
57
+ | <GENERIC_RULE> | <PROJECT_DEVIATION> | <REASON_OR_ADR_LINK> |