@erclx/canon 4.78.0 → 4.80.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 (152) hide show
  1. package/README.md +9 -9
  2. package/claude/.claude-plugin/plugin.json +1 -1
  3. package/claude/skills/canon-operator/SKILL.md +1 -1
  4. package/claude/skills/canon-rollout/SKILL.md +1 -1
  5. package/claude/skills/create-standard/SKILL.md +1 -1
  6. package/claude/skills/design-extract/REQUIREMENT.md +4 -4
  7. package/claude/skills/design-extract/SKILL.md +11 -11
  8. package/claude/skills/docs-fold/SKILL.md +14 -14
  9. package/claude/skills/docs-fold/references/anchor-sweep.md +1 -1
  10. package/claude/skills/docs-fold/references/wireframe-sweep.md +4 -4
  11. package/claude/skills/draft-context/REQUIREMENT.md +6 -6
  12. package/claude/skills/draft-context/SKILL.md +8 -6
  13. package/claude/skills/draft-diagram/SKILL.md +5 -5
  14. package/claude/skills/draft-identity/SKILL.md +3 -3
  15. package/claude/skills/draft-readme/REQUIREMENT.md +1 -1
  16. package/claude/skills/draft-screencast/SKILL.md +1 -1
  17. package/claude/skills/draft-wireframes/REQUIREMENT.md +7 -7
  18. package/claude/skills/draft-wireframes/SKILL.md +7 -5
  19. package/claude/skills/git-pr/SKILL.md +3 -3
  20. package/claude/skills/git-pr/references/labels.md +1 -1
  21. package/claude/skills/memory-capture/REQUIREMENT.md +1 -1
  22. package/claude/skills/memory-capture/SKILL.md +6 -6
  23. package/claude/skills/memory-review/SKILL.md +1 -1
  24. package/claude/skills/migration-claude-md/REQUIREMENT.md +3 -3
  25. package/claude/skills/migration-claude-md/SKILL.md +7 -5
  26. package/claude/skills/migration-context/REQUIREMENT.md +3 -3
  27. package/claude/skills/migration-context/SKILL.md +11 -9
  28. package/claude/skills/plan-feature/SKILL.md +4 -4
  29. package/claude/skills/plan-groundwork/SKILL.md +2 -2
  30. package/claude/skills/plan-intake/SKILL.md +2 -2
  31. package/claude/skills/project-commands/SKILL.md +2 -2
  32. package/claude/skills/review-branch/SKILL.md +3 -3
  33. package/claude/skills/review-pr/SKILL.md +2 -2
  34. package/claude/skills/role-orchestrator/SKILL.md +1 -1
  35. package/claude/skills/role-planner/SKILL.md +1 -1
  36. package/claude/skills/session-relay/REQUIREMENT.md +1 -1
  37. package/claude/skills/session-resume/SKILL.md +1 -1
  38. package/claude/skills/setup-gov/SKILL.md +1 -1
  39. package/claude/skills/setup-init/SKILL.md +1 -1
  40. package/claude/skills/teach-workspace/references/promotion.md +5 -5
  41. package/claude/skills/ux-audit/SKILL.md +5 -5
  42. package/claude/skills/ux-measure/SKILL.md +1 -1
  43. package/docs/agents/audits.md +2 -2
  44. package/docs/agents/commands.md +7 -2
  45. package/docs/agents/context-audit-checks.md +3 -3
  46. package/docs/agents/context-audit.md +2 -2
  47. package/docs/agents/counts.md +3 -3
  48. package/docs/agents/design-board.md +3 -3
  49. package/docs/agents/docs.md +3 -3
  50. package/docs/agents/indexes.md +1 -1
  51. package/docs/agents/install-and-sync.md +4 -4
  52. package/docs/agents/label-coverage.md +1 -1
  53. package/docs/agents/review-classification.md +1 -1
  54. package/docs/agents/routing.md +2 -2
  55. package/docs/agents/rule-citations.md +1 -1
  56. package/docs/agents/sandbox.md +1 -1
  57. package/docs/agents/scripting.md +1 -1
  58. package/docs/agents/skills-audit.md +1 -1
  59. package/docs/agents/skills-reach.md +4 -4
  60. package/docs/target-projects.md +11 -11
  61. package/docs/workflow/ai-workflow.md +15 -13
  62. package/docs/workflow/operating-model.md +2 -2
  63. package/docs/workflow/visual-design-workflow.md +8 -8
  64. package/governance/rules/claude/510-context.md +3 -2
  65. package/governance/rules/claude/520-wireframes.md +3 -2
  66. package/governance/rules/claude/530-requirements.md +2 -1
  67. package/governance/rules/claude/540-architecture.md +2 -1
  68. package/governance/rules/claude/550-design.md +2 -1
  69. package/governance/rules/core/025-indexes.md +1 -1
  70. package/governance/rules/core/045-memory.md +1 -1
  71. package/package.json +1 -1
  72. package/scripts/core/check-ignore-parity.sh +1 -1
  73. package/scripts/core/check-seed-independence.sh +5 -2
  74. package/scripts/core/install-check.sh +1 -1
  75. package/scripts/core/list-seed-roots.sh +3 -3
  76. package/scripts/core/regen-hero.sh +1 -1
  77. package/scripts/docs/list.sh +3 -3
  78. package/scripts/lib/sandbox-git.sh +1 -1
  79. package/scripts/lib/tooling.sh +6 -4
  80. package/snippets/claude/figma-steps.md +1 -1
  81. package/src/audits/baseline.ts +17 -5
  82. package/src/audits/catalog.ts +2 -2
  83. package/src/autoship/paths.ts +1 -1
  84. package/src/claude/cases/authoring.ts +2 -2
  85. package/src/claude/cases/setup.ts +1 -1
  86. package/src/claude/routing.ts +1 -1
  87. package/src/claude/seeds-list.ts +1 -1
  88. package/src/claude/seeds.ts +62 -28
  89. package/src/claude/skills-reach.ts +3 -3
  90. package/src/commands/claude.ts +1 -1
  91. package/src/commands/context.ts +8 -8
  92. package/src/commands/design.ts +1 -1
  93. package/src/commands/gov.ts +1 -1
  94. package/src/commands/migrate.ts +182 -1
  95. package/src/commands/sync.ts +1 -1
  96. package/src/context/audit.ts +1 -1
  97. package/src/context/citations.ts +7 -5
  98. package/src/context/folders.ts +2 -2
  99. package/src/counts/scan.ts +4 -4
  100. package/src/design/board.ts +5 -5
  101. package/src/design/components.ts +2 -2
  102. package/src/design/css.ts +1 -1
  103. package/src/design/document.ts +1 -1
  104. package/src/design/regen.ts +1 -1
  105. package/src/design/render.ts +1 -1
  106. package/src/design/tokens.ts +2 -2
  107. package/src/docs/read.ts +9 -3
  108. package/src/gate/measures.ts +14 -11
  109. package/src/gate/stages.ts +4 -4
  110. package/src/labels/map.ts +19 -5
  111. package/src/legacy-path.ts +15 -0
  112. package/src/markdown/scan.ts +1 -1
  113. package/src/migrate/plan.ts +1 -0
  114. package/src/migrate/surface-roots.ts +457 -0
  115. package/src/record-root.ts +6 -4
  116. package/src/sandbox/census.ts +1 -1
  117. package/src/shipped/references.ts +3 -3
  118. package/src/surface-root.ts +33 -8
  119. package/src/sync/layout.ts +10 -6
  120. package/src/sync/reverse.ts +1 -1
  121. package/src/sync/stamp.ts +22 -17
  122. package/src/targets/sweep.ts +6 -2
  123. package/src/tooling/inject.ts +5 -3
  124. package/src/tooling/scan.ts +4 -1
  125. package/standards/architecture.md +4 -4
  126. package/standards/context.md +7 -7
  127. package/standards/design.md +3 -3
  128. package/standards/diagrams.md +6 -6
  129. package/standards/index.md +5 -5
  130. package/standards/markdown.md +2 -2
  131. package/standards/publish.md +3 -3
  132. package/standards/readme.md +1 -1
  133. package/standards/requirements.md +4 -4
  134. package/standards/skill.md +2 -2
  135. package/standards/tasks.md +1 -1
  136. package/standards/wiki.md +1 -1
  137. package/standards/wireframes.md +8 -8
  138. package/tooling/astro/reference.md +3 -3
  139. package/tooling/base/reference.md +3 -3
  140. package/tooling/claude/reference.md +7 -3
  141. package/tooling/claude/seeds/CLAUDE.md +9 -9
  142. package/tooling/nextjs/reference.md +2 -2
  143. package/tooling/python/reference.md +1 -1
  144. package/tooling/vite-react/reference.md +2 -2
  145. package/tooling/web/reference.md +2 -2
  146. /package/tooling/base/seeds/{.claude → canon}/context/ci.md +0 -0
  147. /package/tooling/base/seeds/{.claude → canon}/context/development.md +0 -0
  148. /package/tooling/base/seeds/{.claude → canon}/context/index.md +0 -0
  149. /package/tooling/claude/seeds/{.claude → canon}/ARCHITECTURE.md +0 -0
  150. /package/tooling/claude/seeds/{.claude → canon}/DESIGN.md +0 -0
  151. /package/tooling/claude/seeds/{.claude → canon}/REQUIREMENTS.md +0 -0
  152. /package/tooling/claude/seeds/{.claude → canon}/wireframes/index.md +0 -0
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@erclx/canon",
3
3
  "type": "module",
4
- "version": "4.78.0",
4
+ "version": "4.80.0",
5
5
  "description": "Infrastructure and quality tooling for developer workflows",
6
6
  "license": "MIT",
7
7
  "bin": {
@@ -19,7 +19,7 @@ SECTION="# Claude"
19
19
  # The diagrams divergence is the one that cost something. A target used to track
20
20
  # its diagrams and keep the context audit's default coverage of them, and it now
21
21
  # ignores them with the rest of its records, so that coverage is gone unless the
22
- # project names the folder itself. `.claude/context/tooling.md` carries the
22
+ # project names the folder itself. `canon/context/tooling.md` carries the
23
23
  # narrative.
24
24
  #
25
25
  # An exception mechanism is not kept against a future divergence, because an
@@ -23,7 +23,7 @@ fi
23
23
  # stages disagree about what the same condition means.
24
24
  seed_roots=$(collect_seed_roots)
25
25
  if [ -z "$seed_roots" ]; then
26
- echo "No seed root carries .claude/, nothing to check." >&2
26
+ echo "No seed root carries .claude/ or canon/, nothing to check." >&2
27
27
  exit 0
28
28
  fi
29
29
 
@@ -36,9 +36,12 @@ measured=0
36
36
  while IFS= read -r seed_root; do
37
37
  while IFS= read -r file; do
38
38
  measured=$((measured + 1))
39
+ # A token followed by `/` is the tracked surface root, a folder the seed
40
+ # itself installs, rather than the binary. Every other spelling still
41
+ # reports, which keeps a verb, a plugin skill prefix, and a bare mention in.
39
42
  while IFS= read -r hit; do
40
43
  cited="$cited ${file#"$PROJECT_ROOT/"}:$hit"$'\n'
41
- done < <(grep -n "$TOOLKIT_TOKEN" "$file" || true)
44
+ done < <(grep -nE "${TOOLKIT_TOKEN}([^/]|$)" "$file" || true)
42
45
  done < <(find "$PROJECT_ROOT/$seed_root" -type f -name '*.md')
43
46
  done <<<"$seed_roots"
44
47
 
@@ -95,7 +95,7 @@ log_step "Assert scaffold"
95
95
  # `@`-reference convention rule is the one snippets-domain file that still
96
96
  # installs, since `base` carries `governance/rules/snippets/` as a
97
97
  # folder-whole entry the same way it does `core` and `claude`.
98
- for path in "CLAUDE.md" ".claude/wiki/index.md" ".claude" ".claude/context/index.md" ".claude/wireframes/index.md" ".canon/diagrams/index.md" \
98
+ for path in "CLAUDE.md" ".claude/wiki/index.md" ".claude" "canon/context/index.md" "canon/wireframes/index.md" ".canon/diagrams/index.md" \
99
99
  ".prettierrc" ".editorconfig" ".lintstagedrc" ".husky/pre-commit" ".github/workflows/verify.yml" "scripts/verify.sh" \
100
100
  ".claude/rules/canon/core/000-constitution.md" ".claude/rules/canon/snippets/600-at-references.md"; do
101
101
  if [ ! -e "$TARGET_DIR/$path" ]; then
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env bash
2
- # Prints every seed root carrying a `.claude/`, one per line and relative to
3
- # the project root.
2
+ # Prints every seed root carrying a `.claude/` or a `canon/`, one per line and
3
+ # relative to the project root.
4
4
  #
5
5
  # The discovery rule has one definition, `collect_seed_roots` in
6
6
  # `scripts/lib/tooling.sh`, which `check-seed-independence.sh` already reads.
7
7
  # This file is the route a caller outside bash takes to that same answer, so a
8
- # stack seeding `.claude/` later reaches both readers and the two stages
8
+ # stack seeding either root later reaches both readers and the two stages
9
9
  # measuring seed content cannot disagree about which roots exist.
10
10
  set -e
11
11
  set -o pipefail
@@ -3,7 +3,7 @@
3
3
  # source, writing the .html beside each one.
4
4
  #
5
5
  # The name says hero because the hero was the only template when it was written
6
- # and every citation of it across docs/, .claude/context/, and src/ spells that
6
+ # and every citation of it across docs/, canon/context/, and src/ spells that
7
7
  # name. Renaming the file is a sweep across roughly twenty surfaces for a
8
8
  # cosmetic gain, so the file keeps its name and the loop below covers whatever
9
9
  # templates the folder holds.
@@ -9,7 +9,7 @@ source "$PROJECT_ROOT/scripts/lib/ui.sh"
9
9
  source "$PROJECT_ROOT/scripts/lib/frontmatter.sh"
10
10
 
11
11
  DOCS_DIR="$PROJECT_ROOT/docs"
12
- CONTEXT_DIR="$PROJECT_ROOT/.claude/context"
12
+ CONTEXT_DIR="$PROJECT_ROOT/canon/context"
13
13
 
14
14
  INTERNAL_TOPICS=" ci development sandbox "
15
15
 
@@ -97,7 +97,7 @@ collect_context() {
97
97
  [ "$name" = "index" ] && continue
98
98
  is_internal_topic "$name" && continue
99
99
  description=$(read_frontmatter_field "$file" "description")
100
- printf '%s\t%s\t%s\n' "$name" "$description" ".claude/context/$name.md"
100
+ printf '%s\t%s\t%s\n' "$name" "$description" "canon/context/$name.md"
101
101
  done < <(find "$CONTEXT_DIR" -maxdepth 1 -type f -name "*.md")
102
102
 
103
103
  # A split domain is named by its folder and described by its generated
@@ -106,7 +106,7 @@ collect_context() {
106
106
  name=$(basename "$(dirname "$file")")
107
107
  is_internal_topic "$name" && continue
108
108
  description=$(read_frontmatter_field "$file" "subtitle")
109
- printf '%s\t%s\t%s\n' "$name" "$description" ".claude/context/$name/index.md"
109
+ printf '%s\t%s\t%s\n' "$name" "$description" "canon/context/$name/index.md"
110
110
  done < <(find "$CONTEXT_DIR" -mindepth 2 -maxdepth 2 -type f -name "index.md")
111
111
  } | sort
112
112
  }
@@ -95,7 +95,7 @@ ensure_sandbox_anchor_repo() {
95
95
  # nine to a pass against something that is not the anchor. Refusing is the safe
96
96
  # default and creating is the opt-in, the shape `canon tooling sync --write`
97
97
  # already sets. `canon records push` refuses outright for the reason
98
- # `.claude/context/development/scratch.md` records, so the two still differ.
98
+ # `canon/context/development/scratch.md` records, so the two still differ.
99
99
  # The sibling SANDBOX_ flags are presence tests, so any non-empty value turns
100
100
  # them on. This one allowlists instead, because a presence test would have
101
101
  # SANDBOX_ANCHOR_CREATE=false provisioning a repository. Both spellings are
@@ -23,13 +23,15 @@ list_tooling_stacks() {
23
23
  done < <(find "$tooling_dir" -mindepth 1 -maxdepth 1 -type d | sort)
24
24
  }
25
25
 
26
- # Seed roots that carry a `.claude/`, emitted relative to `PROJECT_ROOT`. Every
27
- # stage measuring seed content discovers through this rather than naming a stack,
28
- # so a stack seeding `.claude/` later arrives covered with no edit to any caller.
26
+ # Seed roots that carry a `.claude/` or a `canon/`, emitted relative to
27
+ # `PROJECT_ROOT`. Every stage measuring seed content discovers through this
28
+ # rather than naming a stack, so a stack seeding either root later arrives
29
+ # covered with no edit to any caller. A stack seeding only tracked surfaces
30
+ # carries `canon/` alone, which a `.claude/` test would drop from both stages.
29
31
  collect_seed_roots() {
30
32
  local dir
31
33
  for dir in "$PROJECT_ROOT"/tooling/*/seeds; do
32
- [ -d "$dir/.claude" ] || continue
34
+ [ -d "$dir/.claude" ] || [ -d "$dir/canon" ] || continue
33
35
  printf '%s\n' "${dir#"$PROJECT_ROOT"/}"
34
36
  done
35
37
  }
@@ -1,4 +1,4 @@
1
- Read the relevant spec from `.claude/DESIGN.md` and any other design files needed. Write step-by-step Figma instructions to produce the component exactly.
1
+ Read the relevant spec from `canon/DESIGN.md` and any other design files needed. Write step-by-step Figma instructions to produce the component exactly.
2
2
 
3
3
  For each step, specify:
4
4
 
@@ -1,6 +1,7 @@
1
1
  import { mkdir, readFile, writeFile } from 'node:fs/promises'
2
- import { dirname, join } from 'node:path'
2
+ import { dirname, join, relative } from 'node:path'
3
3
  import type { AuditResult } from '@/audits/catalog'
4
+ import { resolveExisting } from '@/legacy-path'
4
5
 
5
6
  /**
6
7
  * Where the retained counts live, relative to the project root.
@@ -15,7 +16,14 @@ import type { AuditResult } from '@/audits/catalog'
15
16
  * that installs the CLI. A baseline in the package would hand a target this
16
17
  * repository's counts to measure its own tree against.
17
18
  */
18
- export const BASELINE_REL = join('.claude', 'canon', 'baseline.json')
19
+ export const BASELINE_REL = join('canon', 'config', 'baseline.json')
20
+
21
+ /**
22
+ * Where the baseline wrote before this move, `.claude/canon/baseline.json`.
23
+ * `readBaseline` falls back to it so a target that has not moved still reads
24
+ * its recorded floor, and the write no longer lands there.
25
+ */
26
+ const LEGACY_BASELINE_REL = join('.claude', 'canon', 'baseline.json')
19
27
 
20
28
  export interface Baseline {
21
29
  /** The day the record was taken, as `YYYY-MM-DD`. */
@@ -165,7 +173,11 @@ function isBaseline(value: unknown): value is Baseline {
165
173
  export async function readBaseline(
166
174
  root: string,
167
175
  ): Promise<Baseline | undefined> {
168
- const path = join(root, BASELINE_REL)
176
+ const path = resolveExisting([
177
+ join(root, BASELINE_REL),
178
+ join(root, LEGACY_BASELINE_REL),
179
+ ])
180
+ const rel = relative(root, path)
169
181
 
170
182
  let raw: string
171
183
  try {
@@ -178,12 +190,12 @@ export async function readBaseline(
178
190
  try {
179
191
  parsed = JSON.parse(raw)
180
192
  } catch {
181
- throw new Error(`${BASELINE_REL} does not parse as JSON. Fix or delete it.`)
193
+ throw new Error(`${rel} does not parse as JSON. Fix or delete it.`)
182
194
  }
183
195
 
184
196
  if (!isBaseline(parsed)) {
185
197
  throw new Error(
186
- `${BASELINE_REL} carries no recordedAt, commit, and checks. Fix or delete it.`,
198
+ `${rel} carries no recordedAt, commit, and checks. Fix or delete it.`,
187
199
  )
188
200
  }
189
201
 
@@ -490,8 +490,8 @@ export const AUDITS: readonly AuditSpec[] = [
490
490
  corpus: 'tracked',
491
491
  // The one reason this verb refuses for that is an absence rather than a
492
492
  // break, on the same test the reach check and the skill audit take: no
493
- // target adopts `.claude/context/`, `.canon/diagrams/`, and
494
- // `.claude/wireframes/` all at once, so without the allowance every such
493
+ // target adopts `canon/context/`, `.canon/diagrams/`, and
494
+ // `canon/wireframes/` all at once, so without the allowance every such
495
495
  // project reports the verb unmeasured on every run and never changes.
496
496
  absentReasons: ['no-folders'] satisfies ContextAuditRefusal[],
497
497
  counts: contextCounts,
@@ -7,7 +7,7 @@
7
7
  * application three times, so the set moved here and the body now calls a verb
8
8
  * that reads it. Being machine-parsed makes it permanently exempt from any
9
9
  * later design that folds a standard back into the surface citing it, per the
10
- * machine-parsed clause in `.claude/ARCHITECTURE.md`.
10
+ * machine-parsed clause in `canon/ARCHITECTURE.md`.
11
11
  */
12
12
 
13
13
  /**
@@ -48,12 +48,12 @@ export const AUTHORING_CASES: readonly SkillCase[] = [
48
48
  },
49
49
  {
50
50
  prompt:
51
- 'Write a context entry for the payments domain, there is no .claude/context page for it yet.',
51
+ 'Write a context entry for the payments domain, there is no canon/context page for it yet.',
52
52
  expect: 'draft-context',
53
53
  },
54
54
  {
55
55
  prompt:
56
- 'Draft a wireframe for the settings panel, nothing under .claude/wireframes covers that surface yet.',
56
+ 'Draft a wireframe for the settings panel, nothing under canon/wireframes covers that surface yet.',
57
57
  expect: 'draft-wireframes',
58
58
  },
59
59
  {
@@ -72,7 +72,7 @@ export const SETUP_CASES: readonly SkillCase[] = [
72
72
  },
73
73
  // The performing skill wins a phrase naming its operation over the front
74
74
  // door's own routing framing, even though canon-operator's description
75
- // quotes a phrase near this one. See .claude/context/cli/audits.md.
75
+ // quotes a phrase near this one. See canon/context/cli/audits.md.
76
76
  {
77
77
  prompt:
78
78
  "Whatever the right toolkit command is, get this project's rules installed.",
@@ -82,7 +82,7 @@ export function namedPaths(line: string): string[] {
82
82
  * The openable part of a token, which for a shape is the folder above the
83
83
  * placeholder.
84
84
  *
85
- * `.claude/context/<domain>.md` names `.claude/context/` and nothing narrower,
85
+ * `canon/context/<domain>.md` names `canon/context/` and nothing narrower,
86
86
  * so dropping the whole token would report the section that carries it as
87
87
  * naming no path at all. A token whose placeholder sits in the first segment
88
88
  * has no openable prefix and is dropped.
@@ -19,7 +19,7 @@ export interface SeedListingWithContent {
19
19
  /**
20
20
  * Reads the same plan `canon claude init` applies. The bash re-globbed the seeds
21
21
  * directory with its own hard-coded subdirectory list, which had drifted: it
22
- * never listed `.claude/context/`, so a seed init installs went unreported.
22
+ * never listed `canon/context/`, so a seed init installs went unreported.
23
23
  *
24
24
  * The target is irrelevant to a listing, so it resolves against the source
25
25
  * root and only the source-side fields are read.
@@ -1,18 +1,21 @@
1
1
  import { existsSync } from 'node:fs'
2
2
  import { chmod, mkdir, readFile, writeFile } from 'node:fs/promises'
3
- import { dirname, join } from 'node:path'
3
+ import { dirname, join, relative } from 'node:path'
4
4
  import { copyPreservingMode } from '@/copy'
5
5
  import { creationRel, isRecordEntry } from '@/record-root'
6
6
  import { rewritesOnInstall, stripSeedMarker } from '@/seed-marker'
7
+ import { SURFACE_ENTRIES, surfaceDir } from '@/surface-root'
7
8
 
8
9
  const SEEDS_DIR = join('tooling', 'claude', 'seeds')
9
10
  const CLAUDE_DIR = '.claude'
11
+ const SURFACE_DIR = 'canon'
10
12
  const CLAUDE_MD = 'CLAUDE.md'
11
13
  const HOOKS = 'hooks'
12
14
  /**
13
- * Seed subdirectories under `.claude/`. Exported because each one replaced a
14
- * single file of the same stem in an older layout, which is what
15
- * `@/sync/layout` pairs a target against to find a superseded artifact.
15
+ * Seed subdirectories, authored under `.claude/` or, for a tracked surface,
16
+ * under `canon/`. Exported because each one replaced a single file of the same
17
+ * stem in an older layout, which is what `@/sync/layout` pairs a target against
18
+ * to find a superseded artifact.
16
19
  */
17
20
  export const SUBDIRS: readonly string[] = [
18
21
  HOOKS,
@@ -48,10 +51,26 @@ function seedsRoot(root: string): string {
48
51
  return join(root, SEEDS_DIR)
49
52
  }
50
53
 
54
+ function isSurfaceEntry(name: string): boolean {
55
+ return SURFACE_ENTRIES.includes(name)
56
+ }
57
+
58
+ /**
59
+ * Where a surface seed installs, relative to the target.
60
+ *
61
+ * Resolved the way a read resolves rather than fixed at `canon/`. A target that
62
+ * still holds the surface under `.claude/` receives the seed beside the copy it
63
+ * has, since a fresh `canon/` folder there would win read precedence and hide
64
+ * every entry that target already wrote.
65
+ */
66
+ function surfaceRel(target: string, entry: string): string {
67
+ return relative(target, surfaceDir(target, entry))
68
+ }
69
+
51
70
  /**
52
71
  * Lists a single directory level, sorted the way `find -maxdepth 1 -type f |
53
- * sort` was. Bun.Glob skips dotfiles without `dot`, and every path here sits
54
- * under `.claude`, so omitting it would match nothing.
72
+ * sort` was. Bun.Glob skips dotfiles without `dot`, and the `.claude` source
73
+ * sits under a dotted name, so omitting it would match nothing there.
55
74
  */
56
75
  function listLevel(dir: string): string[] {
57
76
  if (!existsSync(dir)) return []
@@ -61,19 +80,19 @@ function listLevel(dir: string): string[] {
61
80
  }
62
81
 
63
82
  /**
64
- * Builds the seed list in the order the bash scanned it: the `.claude` root
65
- * level, then each subdirectory, then the project-level `CLAUDE.md`. Order is
66
- * load-bearing because it is also the order the timeline prints.
83
+ * Builds the seed list in the order the timeline prints it: the `.claude` root
84
+ * level, the `canon` root level, then each subdirectory from whichever source
85
+ * authors it, then the project-level `CLAUDE.md`.
67
86
  */
68
87
  export function planSeeds(root: string, target: string): SeedEntry[] {
69
- const source = join(seedsRoot(root), CLAUDE_DIR)
70
- const destDir = join(target, CLAUDE_DIR)
88
+ const claudeSource = join(seedsRoot(root), CLAUDE_DIR)
89
+ const surfaceSource = join(seedsRoot(root), SURFACE_DIR)
71
90
  const seeds: Seed[] = []
72
91
 
73
- for (const name of listLevel(source)) {
92
+ for (const name of listLevel(claudeSource)) {
74
93
  seeds.push({
75
- src: join(source, name),
76
- dest: join(destDir, name),
94
+ src: join(claudeSource, name),
95
+ dest: join(target, CLAUDE_DIR, name),
77
96
  scanLabel: name,
78
97
  applyLabel: join(CLAUDE_DIR, name),
79
98
  scope: 'claude',
@@ -81,23 +100,38 @@ export function planSeeds(root: string, target: string): SeedEntry[] {
81
100
  })
82
101
  }
83
102
 
103
+ for (const name of listLevel(surfaceSource)) {
104
+ const rel = surfaceRel(target, name)
105
+ seeds.push({
106
+ src: join(surfaceSource, name),
107
+ dest: join(target, rel),
108
+ scanLabel: name,
109
+ applyLabel: rel,
110
+ scope: 'claude',
111
+ executable: false,
112
+ })
113
+ }
114
+
84
115
  for (const subdir of SUBDIRS) {
85
- // The seed tree authors every subdirectory under `.claude/`, and three of
86
- // them are record folders that install under the record root instead. A
87
- // target that has not migrated resolves back to `.claude/`, so the same seed
88
- // lands beside the records already there rather than opening a second root.
89
- // Scaffolding one under `.claude/` now would also land it outside the single
90
- // `.canon/` ignore entry a target receives, which tracks the memory pen.
91
- const installRel = isRecordEntry(subdir)
92
- ? creationRel(target, subdir)
93
- : join(CLAUDE_DIR, subdir)
94
-
95
- for (const name of listLevel(join(source, subdir))) {
96
- const rel = `${subdir}/${name}`
116
+ const surface = isSurfaceEntry(subdir)
117
+ const source = join(surface ? surfaceSource : claudeSource, subdir)
118
+
119
+ // Three of the `.claude/` subdirectories are record folders that install
120
+ // under the record root instead. A target that has not migrated resolves
121
+ // back to `.claude/`, so the same seed lands beside the records already
122
+ // there rather than opening a second root, and never outside the single
123
+ // `.canon/` ignore entry a target receives.
124
+ const installRel = surface
125
+ ? surfaceRel(target, subdir)
126
+ : isRecordEntry(subdir)
127
+ ? creationRel(target, subdir)
128
+ : join(CLAUDE_DIR, subdir)
129
+
130
+ for (const name of listLevel(source)) {
97
131
  seeds.push({
98
- src: join(source, subdir, name),
132
+ src: join(source, name),
99
133
  dest: join(target, installRel, name),
100
- scanLabel: rel,
134
+ scanLabel: `${subdir}/${name}`,
101
135
  applyLabel: join(installRel, name),
102
136
  scope: 'claude',
103
137
  executable: subdir === HOOKS,
@@ -17,7 +17,7 @@ import { SURFACE_ROOTS } from '@/surface-root'
17
17
  * `docs/agents/` is the exception, being the CLI contract pages that exist
18
18
  * here alone.
19
19
  *
20
- * `.claude/context/` carries both surface-root spellings, since this list
20
+ * The context folder carries both surface-root spellings, since this list
21
21
  * decides whether a shipped body names this repository's own tree and a body
22
22
  * naming either root is doing that regardless of which root a given checkout
23
23
  * carries.
@@ -51,7 +51,7 @@ const TOKEN = /`([^`\s]+)`/g
51
51
  * A path a reader could open, which is the only kind worth measuring.
52
52
  *
53
53
  * Requires an extension and a separator, and admits no `<`, `$`, or `*`. A
54
- * body writes `.claude/context/<domain>.md` to name a shape rather than a
54
+ * body writes `canon/context/<domain>.md` to name a shape rather than a
55
55
  * file, and `${CLAUDE_SKILL_DIR}/../../standards/markdown.md` to resolve
56
56
  * against the plugin root, which is self-contained by construction.
57
57
  */
@@ -88,7 +88,7 @@ export function isQualified(line: string): boolean {
88
88
  * The roots that belong to the toolkit rather than to the reader, read
89
89
  * against the corpus being measured.
90
90
  *
91
- * A target's `.claude/context/` is the reader's own tree. A seed put the
91
+ * A target's `canon/context/` is the reader's own tree. A seed put the
92
92
  * entries there and the project owns them afterward, so a body under
93
93
  * `.claude/skills/` citing one names a file its reader holds. Measuring it
94
94
  * would report a correct citation on every run, which is exactly why `src/`
@@ -435,7 +435,7 @@ export function register(program: Command): void {
435
435
  ' carrying that corpus alone. A cited path counts when it sits under',
436
436
  ' an authoring root no install channel delivers and the project',
437
437
  ' holds it. A path under src/, scripts/, or bare docs/ names the',
438
- " reader's own tree and is not measured, and .claude/context/ joins",
438
+ " reader's own tree and is not measured, and canon/context/ joins",
439
439
  " them when the corpus read is a project's own.",
440
440
  '',
441
441
  'Exit codes:',
@@ -455,13 +455,13 @@ function reportReferenceForm(
455
455
  const scoped = folders.filter(matchesSiblings)
456
456
  if (scoped.length === 0) {
457
457
  logInfo(
458
- `Out of scope. A bare name is matched against the siblings of a domain split into a folder, and no audited folder under .claude/${PROVENANCE_FOLDER}/ is one.`,
458
+ `Out of scope. A bare name is matched against the siblings of a domain split into a folder, and no audited folder under canon/${PROVENANCE_FOLDER}/ is one.`,
459
459
  )
460
460
  return
461
461
  }
462
462
 
463
463
  logInfo(
464
- `Covers ${plural(scoped.length, 'split folder')} under .claude/${PROVENANCE_FOLDER}/, whose standard asks a reference to spell its path.`,
464
+ `Covers ${plural(scoped.length, 'split folder')} under canon/${PROVENANCE_FOLDER}/, whose standard asks a reference to spell its path.`,
465
465
  )
466
466
  logInfo(
467
467
  'The flat folder is out of reach, since a domain filename there is shared by seeds and other trees.',
@@ -513,13 +513,13 @@ function reportSections(
513
513
  const governed = folders.filter(governsContent)
514
514
  if (governed.length === 0) {
515
515
  logInfo(
516
- `Out of scope. The list is stated in the standard governing .claude/${PROVENANCE_FOLDER}/, and no audited folder is that one.`,
516
+ `Out of scope. The list is stated in the standard governing canon/${PROVENANCE_FOLDER}/, and no audited folder is that one.`,
517
517
  )
518
518
  return
519
519
  }
520
520
 
521
521
  logInfo(
522
- `Covers .claude/${PROVENANCE_FOLDER}/ alone, whose standard requires ${REQUIRED_SECTIONS.join(' and ')}.`,
522
+ `Covers canon/${PROVENANCE_FOLDER}/ alone, whose standard requires ${REQUIRED_SECTIONS.join(' and ')}.`,
523
523
  )
524
524
  logInfo(
525
525
  'A heading at any level counts. Each entry answers for itself, except in a domain split across a folder, where a sibling answers for the rest.',
@@ -635,13 +635,13 @@ function reportProvenance(
635
635
  const governed = folders.filter(governsContent)
636
636
  if (governed.length === 0) {
637
637
  logInfo(
638
- `Out of scope. The rule is stated in the standard governing .claude/${PROVENANCE_FOLDER}/, and no audited folder is that one.`,
638
+ `Out of scope. The rule is stated in the standard governing canon/${PROVENANCE_FOLDER}/, and no audited folder is that one.`,
639
639
  )
640
640
  return
641
641
  }
642
642
 
643
643
  logInfo(
644
- `Covers .claude/${PROVENANCE_FOLDER}/ alone, whose standard carries the rule. The sibling standards do not restate it.`,
644
+ `Covers canon/${PROVENANCE_FOLDER}/ alone, whose standard carries the rule. The sibling standards do not restate it.`,
645
645
  )
646
646
  logInfo(
647
647
  'Fenced blocks are excluded, and so is a date whose clause stamps a measurement. A marker is a judgment, never a defect.',
@@ -697,7 +697,7 @@ function reportNarration(
697
697
  const governed = folders.filter(governsContent)
698
698
  if (governed.length === 0) {
699
699
  logInfo(
700
- `Out of scope. The rule is stated in the standard governing .claude/${PROVENANCE_FOLDER}/, and no audited folder is that one.`,
700
+ `Out of scope. The rule is stated in the standard governing canon/${PROVENANCE_FOLDER}/, and no audited folder is that one.`,
701
701
  )
702
702
  return
703
703
  }
@@ -710,7 +710,7 @@ function reportNarration(
710
710
  }
711
711
 
712
712
  logInfo(
713
- `Covers .claude/${PROVENANCE_FOLDER}/ alone, reading ${plural(narration.pronouns.length, 'pronoun')} and ${plural(narration.verbs.length, 'verb')} from ${narration.source}.`,
713
+ `Covers canon/${PROVENANCE_FOLDER}/ alone, reading ${plural(narration.pronouns.length, 'pronoun')} and ${plural(narration.verbs.length, 'verb')} from ${narration.source}.`,
714
714
  )
715
715
  logInfo(
716
716
  'A rejected alternative is a legitimate hit, since the standard keeps what was tried and why it lost.',
@@ -28,7 +28,7 @@ export function register(program: Command): void {
28
28
  design
29
29
  .command('regen')
30
30
  .description(
31
- 'Rewrite .claude/DESIGN.md and the base stylesheet from src/design/tokens.ts',
31
+ 'Rewrite canon/DESIGN.md and the base stylesheet from src/design/tokens.ts',
32
32
  )
33
33
  .addHelpText(
34
34
  'after',
@@ -419,7 +419,7 @@ export function register(program: Command): void {
419
419
  '',
420
420
  'Not read, each a shape the corpus writes and none of them a citation:',
421
421
  ' a placeholder or glob segment, which describes a shape rather than',
422
- ' naming a file, such as .claude/context/<domain>.md or app/**/route.ts',
422
+ ' naming a file, such as canon/context/<domain>.md or app/**/route.ts',
423
423
  ' a bare filename naming a convention, such as route.ts or manifest.toml',
424
424
  ' a span carrying no file extension, which is a folder or a module',
425
425
  ' specifier, such as src/pages/ , next/font , or claude/standards',