@freetesh/canon 0.16.0 → 0.17.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/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +8 -6
- package/cli/dist/checks/designs.d.ts +5 -0
- package/cli/dist/checks/designs.js +33 -0
- package/cli/dist/checks/index.js +2 -0
- package/cli/dist/config/load.js +2 -2
- package/cli/dist/config/schema.d.ts +3 -1
- package/cli/dist/config/schema.js +5 -1
- package/cli/dist/standards.d.ts +11 -6
- package/cli/dist/standards.js +37 -17
- package/package.json +2 -1
- package/scripts/check-designs.py +709 -0
- package/standards/README.md +23 -6
- package/standards/agent-contract.md +21 -6
- package/standards/context-layout.md +41 -6
- package/standards/library/design-sets.md +857 -0
- package/standards/library/expo.md +54 -0
- package/standards/library/frontend.md +44 -0
- package/standards/library/performance.md +45 -0
- package/standards/library/pipeline.md +42 -0
- package/standards/library/secrets.md +37 -0
- package/standards/library/store-listing.md +122 -0
package/standards/README.md
CHANGED
|
@@ -1,14 +1,31 @@
|
|
|
1
1
|
# standards/
|
|
2
2
|
|
|
3
|
-
canon's
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
replaces it; a configured `constitution.md` adds principles instead.
|
|
3
|
+
canon's standards. `canon standards` lists the ones that apply to a repo.
|
|
4
|
+
|
|
5
|
+
## Defaults — apply to every repo
|
|
7
6
|
|
|
8
7
|
| File | What it holds |
|
|
9
8
|
|---|---|
|
|
10
|
-
| `constitution.md` | The principles a request is weighed against (C-01 to C-
|
|
9
|
+
| `constitution.md` | The principles a request is weighed against (C-01 to C-15; C-01 to C-19 are canon's) |
|
|
11
10
|
| `wiki-schema.md` | Wiki page types, frontmatter, required sections, lint rules |
|
|
12
|
-
| `context-layout.md` | The `.context/` ten-folder layout, where each kind of document lives, `features/` and `tasks.md` formats |
|
|
11
|
+
| `context-layout.md` | The `.context/` ten-folder layout, where each kind of document lives, the repo root, `features/` and `tasks.md` formats |
|
|
13
12
|
| `dev-methods.md` | The evidence spec-, test- and data-driven work leaves behind |
|
|
14
13
|
| `agent-contract.md` | What every agent does before, during and after work |
|
|
14
|
+
|
|
15
|
+
## Library — a repo opts in by name
|
|
16
|
+
|
|
17
|
+
A repo lists the ones it wants in `.claude/canon.yaml`:
|
|
18
|
+
`standards: [design-sets, pipeline, expo]`.
|
|
19
|
+
|
|
20
|
+
| Name | What it holds |
|
|
21
|
+
|---|---|
|
|
22
|
+
| `design-sets` | HTML design sets: layout, `routes.js`, the navbar, the flow chart, tokens, checks |
|
|
23
|
+
| `pipeline` | The five stages and their hard gates; principles C-16 and C-17 |
|
|
24
|
+
| `expo` | Scaffolding an Expo app, its layout, the versioned-docs rule, release checks |
|
|
25
|
+
| `frontend` | `.tsx` code rules: one component per file, thin routes, helpers in `lib/` and `hooks/`, UniWind |
|
|
26
|
+
| `performance` | No redraw after a local edit, counted round trips, no blank navigation, a number before and after |
|
|
27
|
+
| `secrets` | Every secret backed up the moment it exists; key names only in `INVENTORY.md` |
|
|
28
|
+
| `store-listing` | `.context/listing/` as fastlane's tree, screenshots, release notes from `features/` |
|
|
29
|
+
|
|
30
|
+
A library standard may add principles in the constitution's `### C-NN Title`
|
|
31
|
+
format; they apply only to repos that opt in.
|
|
@@ -8,7 +8,9 @@ file with its own `agent-contract.md` in a configured standards folder.
|
|
|
8
8
|
- Read the repo's `CLAUDE.md` / `AGENTS.md`: stack, layout, the rules that are
|
|
9
9
|
the repo's own.
|
|
10
10
|
- Read `.context/tasks.md`. It is the ordered queue — the top item of `## Now`
|
|
11
|
-
is the next action. After finishing, delete the task.
|
|
11
|
+
is the next action. After finishing, delete the task. The repo's `AGENTS.md`
|
|
12
|
+
(or `CLAUDE.md`) carries these two lines, because without them an agent that
|
|
13
|
+
was not told about `.context/` never finds it.
|
|
12
14
|
- For a non-trivial request, run the weigh gate first (`/canon:weigh`).
|
|
13
15
|
|
|
14
16
|
## Repository rules
|
|
@@ -17,10 +19,11 @@ file with its own `agent-contract.md` in a configured standards folder.
|
|
|
17
19
|
(`context-layout.md`). The wiki is the knowledge base; its schema is
|
|
18
20
|
`wiki-schema.md`.
|
|
19
21
|
2. Do not add top-level `docs/` or `wireframes/` folders, or root `TODO.md`,
|
|
20
|
-
`STATUS.md` or `SETUP.md`.
|
|
21
|
-
`
|
|
22
|
-
`.github/` — stay at the root.
|
|
22
|
+
`STATUS.md` or `SETUP.md`. What stays at the root, and where the rest goes:
|
|
23
|
+
`context-layout.md`, "Repo root".
|
|
23
24
|
3. Generated folders are never hand-edited; change their source and regenerate.
|
|
25
|
+
4. File names are lowercase kebab-case unless the language says otherwise.
|
|
26
|
+
5. Names follow the repo's current identity, not a legacy name.
|
|
24
27
|
|
|
25
28
|
## Replies
|
|
26
29
|
|
|
@@ -34,13 +37,25 @@ Write a comment only to explain **why**. The code already says how.
|
|
|
34
37
|
|
|
35
38
|
A comment earns its place when it records something the reader cannot recover
|
|
36
39
|
from the code: a constraint, a trade-off, a bug it prevents, or a non-obvious
|
|
37
|
-
consequence. If it restates what the next line does, delete it.
|
|
40
|
+
consequence. If it restates what the next line does, delete it.
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
// Good — the reason is invisible in the code:
|
|
44
|
+
// Prune only. Recomputing here would discard the user's per-pack choices
|
|
45
|
+
// on every launch, which is the bug this replaced.
|
|
46
|
+
state.selectedPackIds = prunePackIds(...);
|
|
47
|
+
|
|
48
|
+
// Bad — narrates the mechanism:
|
|
49
|
+
// Loop over the packs and filter out the locked ones
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
No
|
|
38
53
|
section-divider comments, no changelog comments, no comments restating a
|
|
39
54
|
function's own name.
|
|
40
55
|
|
|
41
56
|
## Before calling work done
|
|
42
57
|
|
|
43
|
-
1. Update any `.context/` page the change made wrong. Add a page only if an
|
|
58
|
+
1. Update `CLAUDE.md` and any `.context/` page the change made wrong. Add a page only if an
|
|
44
59
|
agent would get something wrong without it.
|
|
45
60
|
2. Run the repo's own lint, typecheck and tests.
|
|
46
61
|
3. Run `canon check`. Every checker the repo declares under `commands:` runs
|
|
@@ -24,8 +24,9 @@ folder.
|
|
|
24
24
|
## Rules
|
|
25
25
|
|
|
26
26
|
1. **Ten folders, one job each.** There is no `documents/`, `research/`,
|
|
27
|
-
`architecture/` or `
|
|
28
|
-
page, an architecture note is a wiki concept, an ADR is
|
|
27
|
+
`architecture/`, `decisions/` or `email-templates/` folder: a research brief
|
|
28
|
+
is a wiki synthesis page, an architecture note is a wiki concept, an ADR is
|
|
29
|
+
`wiki/decisions/`, a transactional email is HTML in `designs/`.
|
|
29
30
|
A product that truly needs another folder adds it in `.claude/canon.yaml`,
|
|
30
31
|
with the reason: `context: { folders: [{ folder: research, reason: … }] }`.
|
|
31
32
|
The ten cannot be removed.
|
|
@@ -38,7 +39,8 @@ folder.
|
|
|
38
39
|
4. **One home per artifact; everything else is an export.** Source art lives in
|
|
39
40
|
`designs/`; store images and press kits are generated from it.
|
|
40
41
|
5. **Authored vs generated is visible.** A generated file is committed but never
|
|
41
|
-
hand-edited.
|
|
42
|
+
hand-edited. Its source is a hand-written file such as `marketing/context.md`,
|
|
43
|
+
`metrics/definitions.yml` or `metrics/events.yml`.
|
|
42
44
|
|
|
43
45
|
## What a repo is expected to have
|
|
44
46
|
|
|
@@ -53,7 +55,8 @@ folder.
|
|
|
53
55
|
|
|
54
56
|
## Naming and frontmatter
|
|
55
57
|
|
|
56
|
-
- Dated sources (`raw/`) → ISO date: `YYYY-MM-DD-slug.md`.
|
|
58
|
+
- Dated sources (`raw/`) → ISO date: `YYYY-MM-DD-slug.md`. Month-grain data
|
|
59
|
+
keeps `YYYY-MM.csv`.
|
|
57
60
|
- Features → zero-padded number: `NNNN-slug.md`.
|
|
58
61
|
- Everything else is named by topic and edited in place.
|
|
59
62
|
- Frontmatter: `last-verified`, kebab-case keys. See the wiki schema.
|
|
@@ -74,10 +77,40 @@ separate folder per name.
|
|
|
74
77
|
| Know-how | `wiki/concepts/`; `ops/` when it is a runbook |
|
|
75
78
|
| Bug | the issue tracker; a wiki concept only when it teaches a rule |
|
|
76
79
|
| Data source | `wiki/entities/` — see the wiki schema, "Data sources" |
|
|
80
|
+
| Setup notes (account IDs, console links, where credentials live) | `ops/setup.md` |
|
|
81
|
+
| What is live right now, per surface | `ops/release.yml` |
|
|
82
|
+
| Runbook | `ops/runbooks/<slug>.md` |
|
|
83
|
+
| Incident | `ops/incidents/YYYY-MM-DD-<slug>.md` |
|
|
84
|
+
| Dated engineering narrative | `CHANGELOG.md` at the repo root |
|
|
77
85
|
|
|
78
86
|
If a document fits none of these for a real product, add a wiki type or a
|
|
79
87
|
folder in `.claude/canon.yaml` with its reason — not a new convention by hand.
|
|
80
88
|
|
|
89
|
+
## Inside the folders
|
|
90
|
+
|
|
91
|
+
A folder holds only what it uses; these are the usual names.
|
|
92
|
+
|
|
93
|
+
```
|
|
94
|
+
marketing/ context.md (identity, goals, markets) · brand/ (WORDS only — art is in designs/brand/)
|
|
95
|
+
posts/ · video/ · launch/ · press/ (press/media/ is an export of designs/brand/)
|
|
96
|
+
metrics/ definitions.yml (the KPI dictionary) · events.yml (what each event means)
|
|
97
|
+
history/YYYY-MM.csv (metric,period,value)
|
|
98
|
+
support/ SUPPORT.md · faq/ · replies/ · reviews/
|
|
99
|
+
legal/ privacy policy · terms · data deletion
|
|
100
|
+
ops/ release.yml · setup.md · runbooks/ · incidents/
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Repo root
|
|
104
|
+
|
|
105
|
+
These stay at the root, because a host renders them or a tool reads them by
|
|
106
|
+
exact path: `README.md` · `LICENSE` · `CHANGELOG.md` · `CONTRIBUTING.md` ·
|
|
107
|
+
`SECURITY.md` · `CLAUDE.md` · `AGENTS.md` · `.github/`.
|
|
108
|
+
|
|
109
|
+
`TODO.md`, `STATUS.md` and `SETUP.md` do not. `SETUP.md` becomes `ops/setup.md`.
|
|
110
|
+
The other two are not single documents, so split them: the backlog goes to
|
|
111
|
+
`tasks.md`, what is live to `ops/release.yml`, the dated narrative to
|
|
112
|
+
`CHANGELOG.md`, canonical values to `wiki/entities/`, a how-to to `ops/runbooks/`.
|
|
113
|
+
|
|
81
114
|
## `features/` — what is next
|
|
82
115
|
|
|
83
116
|
One page per feature, `NNNN-<slug>.md`:
|
|
@@ -88,7 +121,9 @@ id: FEAT-0031
|
|
|
88
121
|
type: feature # feature | experiment | chore | platform
|
|
89
122
|
status: building # planned | building | shipped | shelved | superseded
|
|
90
123
|
last-verified: 2026-04-02
|
|
91
|
-
release: 3.4.0
|
|
124
|
+
release: 3.4.0 # ties to CHANGELOG.md and the release notes
|
|
125
|
+
superseded-by: null
|
|
126
|
+
surfaces: ["[[settings-screen]]"]
|
|
92
127
|
---
|
|
93
128
|
## Summary · ## Motivation · ## Acceptance scenarios (Given/When/Then)
|
|
94
129
|
## Out of scope · ## Open questions
|
|
@@ -100,7 +135,7 @@ An experiment adds `## Hypothesis`, `## Metric` (a name from
|
|
|
100
135
|
`metrics/definitions.yml`) and `## Result` once it has run.
|
|
101
136
|
|
|
102
137
|
The wiki describes what *is*; `features/` describes what is *next*. A shipped
|
|
103
|
-
feature goes `status: shipped
|
|
138
|
+
feature goes `status: shipped` and is never deleted, so the reasoning survives.
|
|
104
139
|
|
|
105
140
|
## `tasks.md` — open work only
|
|
106
141
|
|