@freetesh/canon 0.15.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.
Files changed (72) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/README.md +24 -7
  4. package/cli/dist/api.d.ts +2 -2
  5. package/cli/dist/api.js +2 -2
  6. package/cli/dist/checks/{external.js → commands.js} +2 -0
  7. package/cli/dist/checks/designs.d.ts +5 -0
  8. package/cli/dist/checks/designs.js +33 -0
  9. package/cli/dist/checks/index.js +6 -3
  10. package/cli/dist/checks/stale-copies.d.ts +2 -0
  11. package/cli/dist/checks/stale-copies.js +18 -0
  12. package/cli/dist/checks/{copies.d.ts → standards-copies.d.ts} +0 -1
  13. package/cli/dist/checks/{copies.js → standards-copies.js} +0 -16
  14. package/cli/dist/commands/add.d.ts +1 -1
  15. package/cli/dist/commands/add.js +1 -1
  16. package/cli/dist/commands/check.d.ts +1 -1
  17. package/cli/dist/commands/check.js +2 -2
  18. package/cli/dist/commands/copies.d.ts +1 -1
  19. package/cli/dist/commands/hooks.d.ts +1 -1
  20. package/cli/dist/commands/hooks.js +2 -2
  21. package/cli/dist/commands/init.d.ts +1 -1
  22. package/cli/dist/commands/init.js +2 -2
  23. package/cli/dist/commands/learn.d.ts +1 -1
  24. package/cli/dist/commands/learn.js +2 -2
  25. package/cli/dist/commands/pipeline.d.ts +1 -1
  26. package/cli/dist/{search → commands}/search.js +1 -1
  27. package/cli/dist/commands/standards.d.ts +1 -1
  28. package/cli/dist/commands/status.d.ts +1 -1
  29. package/cli/dist/commands/sync.d.ts +1 -1
  30. package/cli/dist/commands/sync.js +1 -1
  31. package/cli/dist/commands/ui.d.ts +1 -1
  32. package/cli/dist/commands/ui.js +2 -2
  33. package/cli/dist/config/load.js +18 -6
  34. package/cli/dist/config/schema.d.ts +24 -3
  35. package/cli/dist/config/schema.js +17 -3
  36. package/cli/dist/format.d.ts +1 -1
  37. package/cli/dist/index.js +2 -2
  38. package/cli/dist/init.js +2 -2
  39. package/cli/dist/packs.d.ts +3 -1
  40. package/cli/dist/standards.d.ts +11 -6
  41. package/cli/dist/standards.js +37 -17
  42. package/cli/dist/status.d.ts +1 -1
  43. package/cli/dist/status.js +1 -1
  44. package/package.json +3 -3
  45. package/packs/expo/pack.yaml +1 -1
  46. package/packs/firebase/pack.yaml +1 -1
  47. package/packs/react/pack.yaml +1 -1
  48. package/packs/revenuecat/pack.yaml +1 -1
  49. package/packs/uniwind/pack.yaml +1 -1
  50. package/scripts/check-designs.py +709 -0
  51. package/standards/README.md +23 -6
  52. package/standards/agent-contract.md +21 -6
  53. package/standards/context-layout.md +41 -6
  54. package/standards/library/design-sets.md +857 -0
  55. package/standards/library/expo.md +54 -0
  56. package/standards/library/frontend.md +44 -0
  57. package/standards/library/performance.md +45 -0
  58. package/standards/library/pipeline.md +42 -0
  59. package/standards/library/secrets.md +37 -0
  60. package/standards/library/store-listing.md +122 -0
  61. /package/cli/dist/{run.d.ts → check.d.ts} +0 -0
  62. /package/cli/dist/{run.js → check.js} +0 -0
  63. /package/cli/dist/checks/{external.d.ts → commands.d.ts} +0 -0
  64. /package/cli/dist/checks/{metrics.d.ts → metrics-definitions.d.ts} +0 -0
  65. /package/cli/dist/checks/{metrics.js → metrics-definitions.js} +0 -0
  66. /package/cli/dist/{search → commands}/mcp.d.ts +0 -0
  67. /package/cli/dist/{search → commands}/mcp.js +0 -0
  68. /package/cli/dist/{search → commands}/search.d.ts +0 -0
  69. /package/cli/dist/{commands → lib}/env.d.ts +0 -0
  70. /package/cli/dist/{commands → lib}/env.js +0 -0
  71. /package/cli/dist/{search → lib}/qmd.d.ts +0 -0
  72. /package/cli/dist/{search → lib}/qmd.js +0 -0
@@ -1,14 +1,31 @@
1
1
  # standards/
2
2
 
3
- canon's default standards. `canon standards` lists the ones that apply to a repo:
4
- these first, then each folder named under `standards:` in the estate's and the
5
- repo's `.claude/canon.yaml`. A configured file with the same name as one of these
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-13) |
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`. Files a host or tool reads by exact path —
21
- `README.md`, `LICENSE`, `CHANGELOG.md`, `CONTRIBUTING.md`, `SECURITY.md`,
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. No
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 `decisions/` folder: a research brief is a wiki synthesis
28
- page, an architecture note is a wiki concept, an ADR is `wiki/decisions/`.
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