@erclx/canon 5.24.0 → 5.26.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 (185) hide show
  1. package/README.md +2 -1
  2. package/claude/.claude-plugin/plugin.json +1 -1
  3. package/claude/skills/backlog-triage/REQUIREMENT.md +2 -2
  4. package/claude/skills/backlog-triage/SKILL.md +19 -6
  5. package/claude/skills/canvas/REQUIREMENT.md +49 -0
  6. package/claude/skills/canvas/SKILL.md +106 -0
  7. package/claude/skills/context-fold/REQUIREMENT.md +6 -2
  8. package/claude/skills/context-fold/SKILL.md +8 -6
  9. package/claude/skills/context-fold/references/anchor-sweep.md +2 -2
  10. package/claude/skills/design-extract/REQUIREMENT.md +1 -1
  11. package/claude/skills/design-taste/REQUIREMENT.md +1 -1
  12. package/claude/skills/design-taste/SKILL.md +4 -2
  13. package/claude/skills/design-taste/references/adopted.md +40 -0
  14. package/claude/skills/design-taste/references/kinds.md +1 -1
  15. package/claude/skills/design-taste/references/systems.md +1 -7
  16. package/claude/skills/design-taste/references/tells.md +2 -24
  17. package/claude/skills/docs-sync/REQUIREMENT.md +2 -1
  18. package/claude/skills/document-health/REQUIREMENT.md +2 -0
  19. package/claude/skills/document-health/SKILL.md +21 -0
  20. package/claude/skills/document-health/references/axes.md +12 -0
  21. package/claude/skills/draft-and-pick/SKILL.md +1 -1
  22. package/claude/skills/draft-doc/REQUIREMENT.md +1 -1
  23. package/claude/skills/draft-figure/REQUIREMENT.md +14 -3
  24. package/claude/skills/draft-figure/SKILL.md +24 -51
  25. package/claude/skills/draft-figure/references/architecture-set.md +35 -0
  26. package/claude/skills/draft-figure/references/hand-drawn.md +31 -0
  27. package/claude/skills/draft-figure/references/mermaid.md +55 -0
  28. package/claude/skills/draft-identity/SKILL.md +1 -1
  29. package/claude/skills/draft-screencast/SKILL.md +9 -7
  30. package/claude/skills/draft-slides/REQUIREMENT.md +17 -12
  31. package/claude/skills/draft-slides/SKILL.md +31 -20
  32. package/claude/skills/git-followup/SKILL.md +17 -6
  33. package/claude/skills/git-issue/references/issue.md +10 -0
  34. package/claude/skills/git-pr/references/evidence.md +12 -2
  35. package/claude/skills/git-pr/references/labels.md +12 -0
  36. package/claude/skills/git-split/SKILL.md +19 -8
  37. package/claude/skills/index-lookup/SKILL.md +2 -2
  38. package/claude/skills/markdown-propose/references/format.md +9 -0
  39. package/claude/skills/memory-review/references/later-phases.md +7 -0
  40. package/claude/skills/review-address/SKILL.md +6 -13
  41. package/claude/skills/review-address/references/rest-reads.md +43 -0
  42. package/claude/skills/review-craft/references/ui.md +7 -1
  43. package/claude/skills/review-pr/REQUIREMENT.md +1 -0
  44. package/claude/skills/review-pr/SKILL.md +9 -3
  45. package/claude/skills/review-pr/references/close-out.md +2 -2
  46. package/claude/skills/review-pr/references/post.md +17 -5
  47. package/claude/skills/review-pr/references/scope.md +10 -8
  48. package/claude/skills/review-ui/SKILL.md +12 -4
  49. package/claude/skills/review-ui/references/post.md +4 -2
  50. package/claude/skills/role-orchestrator/references/orchestrator-cloud-launch.md +38 -1
  51. package/claude/skills/role-orchestrator/references/orchestrator-dispatch.md +13 -0
  52. package/claude/skills/role-orchestrator/references/orchestrator-launch.md +4 -0
  53. package/claude/skills/role-orchestrator/references/orchestrator-poll.md +4 -4
  54. package/claude/skills/role-orchestrator/references/orchestrator-review-dispatch.md +6 -0
  55. package/claude/skills/role-orchestrator/scripts/poll.ts +90 -27
  56. package/claude/skills/role-orchestrator/scripts/repo.ts +3 -5
  57. package/claude/skills/role-orchestrator/scripts/watch.ts +4 -7
  58. package/claude/skills/search-craft/REQUIREMENT.md +1 -1
  59. package/claude/skills/search-craft/SKILL.md +3 -1
  60. package/claude/skills/search-craft/references/adopted.md +30 -0
  61. package/claude/skills/target-setup/references/detect.md +8 -0
  62. package/claude/skills/target-setup/references/indexes.md +13 -0
  63. package/claude/skills/target-setup/references/verify.md +8 -0
  64. package/claude/skills/test-first/SKILL.md +2 -0
  65. package/claude/skills/test-first/references/adopted.md +36 -0
  66. package/claude/skills/write-human/SKILL.md +1 -1
  67. package/claude/skills/write-human/references/machine-tells.md +13 -0
  68. package/docs/agents/canvas.md +4 -2
  69. package/docs/agents/capture.md +1 -1
  70. package/docs/agents/commands.md +47 -47
  71. package/docs/agents/context-audit-checks.md +2 -2
  72. package/docs/agents/index.md +2 -3
  73. package/docs/agents/key-changes.md +3 -3
  74. package/docs/agents/pr-evidence.md +11 -2
  75. package/docs/agents/pr-reads.md +5 -4
  76. package/docs/agents/records-stale.md +22 -9
  77. package/docs/agents/records.md +1 -1
  78. package/docs/agents/sandbox.md +1 -1
  79. package/docs/agents/skills-audit.md +10 -3
  80. package/docs/agents/slides.md +15 -3
  81. package/docs/target/projects.md +4 -4
  82. package/docs/workflow/ai-workflow.md +1 -2
  83. package/docs/workflow/index.md +1 -0
  84. package/docs/workflow/parallel-features.md +1 -1
  85. package/docs/workflow/skill-map-on-request.md +42 -0
  86. package/docs/workflow/skill-map.md +3 -36
  87. package/docs/workflow/visual-design-workflow.md +1 -0
  88. package/governance/renames.toml +0 -4
  89. package/governance/rules/standards/markdown.md +1 -0
  90. package/package.json +1 -2
  91. package/scripts/core/install-check.sh +1 -1
  92. package/scripts/lib/sandbox-dispatch.sh +1 -1
  93. package/scripts/lib/sandbox-git.sh +1 -9
  94. package/scripts/lib/sandbox-path.sh +1 -1
  95. package/scripts/sandbox-hook.sh +99 -0
  96. package/src/audits/catalog.ts +2 -2
  97. package/src/canvas/capture.ts +1 -9
  98. package/src/canvas/client/inspector/color-field.tsx +368 -0
  99. package/src/canvas/client/inspector/field.tsx +200 -0
  100. package/src/canvas/client/inspector/fields.css +292 -0
  101. package/src/canvas/client/inspector/section.tsx +27 -0
  102. package/src/canvas/client/inspector/values.ts +183 -0
  103. package/src/canvas/client/inspector.tsx +176 -160
  104. package/src/canvas/client/shell.css +0 -101
  105. package/src/capture/render.ts +45 -7
  106. package/src/capture/sources.ts +43 -0
  107. package/src/census/count.ts +1 -1
  108. package/src/claude/cases/misc.ts +5 -0
  109. package/src/claude/cases/workflow.ts +6 -1
  110. package/src/claude/seeds.ts +1 -2
  111. package/src/claude/skills-audit.ts +68 -14
  112. package/src/client-commands.ts +1 -1
  113. package/src/commands/claude.ts +27 -2
  114. package/src/commands/design.ts +2 -64
  115. package/src/commands/feedback.ts +3 -3
  116. package/src/commands/pr.ts +219 -202
  117. package/src/commands/records.ts +88 -6
  118. package/src/commands/sandbox.ts +50 -10
  119. package/src/commands/slides.ts +31 -77
  120. package/src/context/audit.ts +8 -7
  121. package/src/design/tokens.ts +2 -18
  122. package/src/docs/read.ts +1 -1
  123. package/src/{github.ts → feedback/github.ts} +1 -1
  124. package/src/gate/measures.ts +6 -4
  125. package/src/gov/citations.ts +1 -1
  126. package/src/gov/payload.ts +1 -1
  127. package/src/gov/superseded.ts +2 -2
  128. package/src/help.ts +2 -2
  129. package/src/markdown/ceiling.ts +1 -1
  130. package/src/migrate/skill-names.ts +7 -1
  131. package/src/pr/evidence.ts +25 -5
  132. package/src/pr/rest.ts +137 -0
  133. package/src/record-root.ts +1 -0
  134. package/src/records/backup.ts +1 -0
  135. package/src/records/push-guard.ts +1 -1
  136. package/src/records/stale-canonical.ts +146 -0
  137. package/src/records/stale.ts +1 -1
  138. package/src/sandbox/hooks.ts +128 -0
  139. package/src/sandbox/provision.ts +596 -0
  140. package/src/sandbox/tree.ts +103 -4
  141. package/src/secrets/marker.ts +2 -2
  142. package/src/secrets/scan.ts +1 -1
  143. package/src/shipped/references.ts +2 -2
  144. package/src/slides/convert/export.ts +2 -16
  145. package/src/slides/decks.ts +110 -0
  146. package/src/standards/read.ts +1 -1
  147. package/src/sync/seeds-report.ts +1 -1
  148. package/src/tasks/answers.ts +1 -1
  149. package/src/tasks/archive.ts +1 -1
  150. package/src/teach/nav.ts +1 -1
  151. package/src/tooling/inject.ts +1 -1
  152. package/src/web/readme-citations.ts +1 -1
  153. package/standards/architecture.md +1 -0
  154. package/standards/canvas.md +112 -0
  155. package/standards/context.md +2 -1
  156. package/standards/figures.md +0 -1
  157. package/standards/index.md +1 -1
  158. package/standards/markdown.md +1 -0
  159. package/standards/mermaid.md +1 -7
  160. package/standards/requirements.md +2 -0
  161. package/standards/skill-practice.md +2 -1
  162. package/standards/skill.md +1 -0
  163. package/tooling/claude/reference.md +0 -5
  164. package/claude/skills/draft-diagram/REQUIREMENT.md +0 -45
  165. package/claude/skills/draft-diagram/SKILL.md +0 -177
  166. package/docs/agents/design-board.md +0 -33
  167. package/governance/rules/standards/diagrams.md +0 -14
  168. package/governance/rules/standards/mermaid.md +0 -15
  169. package/scripts/core/check-gallery-exclusion.sh +0 -50
  170. package/scripts/manage-sandbox.sh +0 -472
  171. package/src/design/board.ts +0 -576
  172. package/src/slides/layouts.ts +0 -478
  173. package/src/slides/parse.ts +0 -84
  174. package/src/slides/render.ts +0 -110
  175. package/src/slides/styles.ts +0 -96
  176. package/standards/diagrams.md +0 -132
  177. package/tooling/claude/seeds/.claude/diagrams/index.md +0 -8
  178. /package/claude/skills/write-human/references/{source-material.md → adopted.md} +0 -0
  179. /package/src/{commands/feedback-format.ts → feedback/body.ts} +0 -0
  180. /package/src/{github-format.ts → feedback/github-format.ts} +0 -0
  181. /package/src/{frontmatter.ts → markdown/frontmatter.ts} +0 -0
  182. /package/src/{binary.ts → sweep/binary.ts} +0 -0
  183. /package/src/{exempt-marker.ts → sweep/exempt-marker.ts} +0 -0
  184. /package/src/{paths.ts → tasks/paths.ts} +0 -0
  185. /package/src/{seed-marker.ts → tooling/seed-marker.ts} +0 -0
@@ -6,9 +6,9 @@ category: Workflow
6
6
 
7
7
  # Skill map
8
8
 
9
- Groups run in the order a project meets them, so a reader at a known point scans to that group and reads across. The set reconciles the scenarios in [AI workflow](ai-workflow.md) with the lifecycle [target projects](../target/projects.md) describes, rather than inventing a third vocabulary beside those two, so a group name matches neither source exactly and every moment either one names has a group. Each row says when to reach for the skill. What it does is the skill's own description.
9
+ Groups run in the order a project meets them. They reconcile the scenarios in [AI workflow](ai-workflow.md) with the lifecycle [target projects](../target/projects.md) describes, so every moment either one names has a group. Each row says when to reach for a skill, and its description says what it does.
10
10
 
11
- This page is the corpus the coverage claim is measured against: every name `canon claude skills list --names` reports takes exactly one row here. A skill serving two moments sits at the earlier one, and a mention on any other page is prose rather than routing. The landing page's skills field renders from this page, so its build refuses a skill with no row and a row naming no skill.
11
+ This page and [skill map on request](skill-map-on-request.md) are the corpus the coverage claim is measured against: every name `canon claude skills list --names` reports takes exactly one row across the two. A skill serving two moments sits at the earlier one, this page counting as earlier than the sibling, and a mention on any other page is prose rather than routing. The sibling holds the groups that answer a request rather than mark a moment. The landing page's skills field renders from both pages, so its build refuses a skill with no row and a row naming no skill.
12
12
 
13
13
  ## Set up a project
14
14
 
@@ -18,7 +18,6 @@ This page is the corpus the coverage claim is measured against: every name `cano
18
18
  | `canon:canon-operator` | On a project that already exists, to read what it carries before an install is picked |
19
19
  | `canon:sketch-design` | Before `design-extract`'s greenfield path, to trace a design direction from reference images or URLs |
20
20
  | `canon:design-extract` | Before the first UI feature, to draft `canon/DESIGN.md` |
21
- | `canon:draft-diagram` | Once the architecture is written, to draft per-kind entries under `.canon/diagrams/` |
22
21
  | `canon:deploy-app` | Once a project is ready to publish, to set up its Cloudflare or Vercel deploy and stop for token and domain |
23
22
  | `canon:repo-metadata` | When the GitHub About text, homepage, or topics may have drifted, to reconcile them against the README |
24
23
 
@@ -32,6 +31,7 @@ This page is the corpus the coverage claim is measured against: every name `cano
32
31
  | `canon:plan-groundwork` | When the state is unmeasured and more than one approach is live |
33
32
  | `canon:decision-escalate` | When open decisions turn on your preference and want batching into one set |
34
33
  | `canon:draft-and-pick` | When the call is taste and wants several candidates rendered side by side |
34
+ | `canon:canvas` | When a direction should be drawn as frames the operator can see, select, and edit |
35
35
  | `canon:task-board` | When a decided item needs a file on the board, or a shipped one needs archiving |
36
36
  | `canon:plan-feature` | When the approach is settled and the next step is a plan |
37
37
  | `canon:codebase-layout` | When a plan or change adds a file and you need to decide which folder holds it |
@@ -115,36 +115,3 @@ This page is the corpus the coverage claim is measured against: every name `cano
115
115
  | `canon:canon-feedback` | When something in the toolkit is broken, missing, or off, to open an issue on it |
116
116
  | `canon:canon-feedback-triage` | In the toolkit repo, to work through the open feedback issues |
117
117
  | `canon:canon-rollout` | In the toolkit repo, to take one change out to every consuming project at once |
118
-
119
- ## Generate an artifact on demand
120
-
121
- | Skill | When to use |
122
- | ------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
123
- | `canon:create-rule` | For a project-specific governance rule the toolkit does not ship |
124
- | `canon:create-skill` | For a new `SKILL.md` |
125
- | `canon:create-standard` | For a new authoring convention |
126
- | `canon:draft-doc` | For a brand-new `docs/` page, context entry, wireframe surface, wiki reference page, or `README.md`, drafted against the standard for its kind |
127
- | `canon:draft-ready` | For finished files a worker should copy, written as a ready folder with its overview, thin plan, and task |
128
- | `canon:draft-figure` | For a hand-drawn figure inside an existing doc, drafted against `standards/figures.md` in Mermaid or freehand SVG |
129
- | `canon:bash-cli-script` | For a small non-interactive shell wrapper, stopping at 100 lines in favor of TypeScript on Bun |
130
- | `canon:ci-workflow` | For a GitHub Actions workflow file |
131
- | `canon:draft-slides` | For a deck, drafted as `.claude/SLIDES.md` and rendered to PowerPoint |
132
- | `canon:draft-screencast` | For a recording script with beats and defaults already seeded |
133
- | `canon:record-screencast` | For recording a screencast draft, then composing the take into a finished mp4 when the draft asks for a wrap |
134
- | `canon:draft-identity` | For a project's logo mark and its social card, drafted through `draft-and-pick`'s pick loop |
135
-
136
- ## Answer a question at any point
137
-
138
- | Skill | When to use |
139
- | --------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
140
- | `canon:canon-cli` | Before running an unfamiliar verb, a sync, or an install, to learn which command to run, which reference doc covers it, or what it overwrites, merges, or leaves alone |
141
- | `canon:index-lookup` | To find where a topic is documented across the tracked `index.md` catalogs |
142
- | `canon:youtube-transcripts` | When a video transcript is wanted in the repo as context |
143
- | `canon:read-frames` | To read a recorded demo back frame by frame and report what each one shows, with no verdict on whether the recording looks right |
144
- | `canon:teach-workspace` | To learn a subject across sessions, in a workspace that holds the progress |
145
- | `canon:write-human` | Before drafting or revising prose, for voice, rhythm, and density |
146
- | `canon:restate-plainly` | When an answer or a document has to be read again in plain words |
147
-
148
- Every row answers a question rather than marking a point in a project's life, so a phase above would send a reader to the wrong group.
149
-
150
- A learning workspace produces two halves and only one of them leaves. A lesson is worked through once and stays in the workspace, and a reference page or a glossary carries no learner, so it belongs wherever the project already keeps prose on that subject. Asking `canon:teach-workspace` to promote sorts each durable page by who owns its subject, sending an Anthropic-owned subject to the wiki, an internal one to the matching context entry, and everything else, subject-neutral material included, to the public docs. It proposes and waits, because a promoted page is public prose that needs a line naming who owns the subject, and it writes nothing to a destination: each page the operator confirms goes to a handoff file that `canon:context-fold` folds in from a branch. A project with no wiki folder gets a refusal naming `canon wiki init` rather than a folder it never asked for.
@@ -41,6 +41,7 @@ A cell no source anchors ends in `? verify`, and the preview shows that marker b
41
41
  - `canon:ux-audit` for UX gap detection on existing surfaces
42
42
  - `canon:ux-measure` for what a running surface costs to paint, read against published thresholds
43
43
  - `canon:draft-and-pick` for a call settled by looking, drafting several candidates onto one page and taking your pick
44
+ - `canon:canvas` for a direction worked out over several turns, drawn as HTML frames you drag, select, and restyle in the browser while the session reads your changes back. Only the pick moves into `canon/DESIGN.md`, since the canvas folder is gitignored
44
45
  - `canon:ux-walkthrough` for a multi-finding inspection pass over a running app with the operator, drafting arms from the app's own markup and recording each pick for a builder
45
46
  - `canon:draft-identity` to draft a project's logo mark and compose it into an icon sequence and a social card, through `draft-and-pick`'s own render-and-pick loop. On an Astro project holding the card route scaffold, the card lands as a route the project keeps and is captured through a running server, so it reads the project's real stylesheet rather than typed copies of every color. Everywhere else it ships as a PNG and the run says so.
46
47
  - Anthropic's `frontend-design` plugin optional for light visual steering
@@ -38,13 +38,11 @@
38
38
  "557-intake" = "657-intake"
39
39
  "558-plan" = "658-plan"
40
40
  "559-memory" = "659-memory"
41
- "560-diagrams" = "660-diagrams"
42
41
  "561-teach" = "661-teach"
43
42
  "562-session" = "662-session"
44
43
  "563-ready" = "663-ready"
45
44
  "500-prose" = "800-prose"
46
45
  "501-markdown" = "801-markdown"
47
- "502-mermaid" = "802-mermaid"
48
46
  "580-readme" = "880-readme"
49
47
  "591-standard-authoring" = "891-standard-authoring"
50
48
  "065-spelling" = "765-spelling"
@@ -61,13 +59,11 @@
61
59
  "656-groundwork" = "groundwork"
62
60
  "657-intake" = "intake"
63
61
  "659-memory" = "memory"
64
- "660-diagrams" = "diagrams"
65
62
  "661-teach" = "teach"
66
63
  "662-session" = "session"
67
64
  "663-ready" = "ready"
68
65
  "570-skill" = "skill"
69
66
  "590-rule-authoring" = "rule"
70
67
  "801-markdown" = "markdown"
71
- "802-mermaid" = "mermaid"
72
68
  "880-readme" = "readme"
73
69
  "891-standard-authoring" = "standard"
@@ -13,3 +13,4 @@ paths:
13
13
  - Read it before a substantial markdown edit. Do not work the banned characters from memory.
14
14
  - Run `canon markdown audit <path>` after the edit, and rewrite the sentence carrying a hit rather than swapping the token for a near-synonym.
15
15
  - Voice, rhythm, and sentence construction are a separate topic. `800-prose` routes them.
16
+ - Load the `canon:draft-figure` skill before drafting or revising a Mermaid fence or a figure, and report it rather than proceeding silently when it does not resolve.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@erclx/canon",
3
3
  "type": "module",
4
- "version": "5.24.0",
4
+ "version": "5.26.0",
5
5
  "description": "Runs your agent's work and keeps its code good, on one setup for every repo.",
6
6
  "license": "MIT",
7
7
  "bin": {
@@ -45,7 +45,6 @@
45
45
  "web:favicon": "bun scripts/core/regen-web-favicon.ts",
46
46
  "web:previews": "bun scripts/core/regen-web-previews.ts",
47
47
  "web:build": "bun run web:tokens && bun run web:favicon && bun run web:previews && cd web && astro check && astro build",
48
- "web:gallery": "cd web && astro build --config gallery.config.mjs",
49
48
  "web:card": "cd web && astro dev --config card.config.mjs",
50
49
  "web:card:check": "PROJECT_ROOT=web bash tooling/astro/configs/scripts/check-card-exclusion.sh",
51
50
  "web:preview": "cd web && astro preview",
@@ -101,7 +101,7 @@ log_step "Assert scaffold"
101
101
  # scaffold reads a standard through `canon standards <name>`, resolving against
102
102
  # the toolkit rather than a copy this gate could assert on. The two
103
103
  # rule paths stand for the `claude` and `canon` groups `base` takes whole.
104
- for path in "CLAUDE.md" ".claude/wiki/index.md" ".claude" "canon/context/index.md" "canon/wireframes/index.md" ".canon/diagrams/index.md" \
104
+ for path in "CLAUDE.md" ".claude/wiki/index.md" ".claude" "canon/context/index.md" "canon/wireframes/index.md" \
105
105
  ".prettierrc" ".editorconfig" ".lintstagedrc" ".husky/pre-commit" ".github/workflows/verify.yml" "scripts/verify.sh" \
106
106
  ".claude/rules/canon/claude/565-behavior.md" ".claude/rules/canon/canon/604-scratch.md"; do
107
107
  if [ ! -e "$TARGET_DIR/$path" ]; then
@@ -11,7 +11,7 @@
11
11
  #
12
12
  # Three mechanisms sit here rather than in `sandbox/run.sh`, which is the
13
13
  # only caller. Each is reachable from a test that never launches a session:
14
- # `src/sandbox-dispatch.test.ts` drives the shim against a stub binary and the
14
+ # `src/sandbox/dispatch.test.ts` drives the shim against a stub binary and the
15
15
  # reap against a `sleep`, where proving either through `run.sh` would mean
16
16
  # spawning the thing the bound exists to prevent.
17
17
 
@@ -60,7 +60,7 @@ configure_sandbox_git_identity() {
60
60
  SANDBOX_ANCHOR_REPO="canon-sandbox"
61
61
 
62
62
  # A scenario calls this from its own use_anchor hook rather than this file
63
- # defining the hook. manage-sandbox.sh keys off `type -t use_anchor`, so
63
+ # defining the hook. sandbox-hook.sh keys off `type -t use_anchor`, so
64
64
  # declaring it here would hand an anchor to the scenarios that source this file
65
65
  # for the identity helpers alone.
66
66
  use_sandbox_anchor() {
@@ -112,14 +112,6 @@ ensure_sandbox_anchor_repo() {
112
112
  log_info "Created ${GITHUB_ORG}/${repo_name} as a private repository."
113
113
  }
114
114
 
115
- # Mirrors the merge-base resolution the diff-baseline port already carries
116
- # across five skill bodies, so a checkout whose local main trails origin/main
117
- # does not pull in skill bodies other merged branches changed.
118
- resolve_sandbox_skill_diff_base() {
119
- git -C "$PROJECT_ROOT" merge-base HEAD origin/main 2>/dev/null ||
120
- git -C "$PROJECT_ROOT" merge-base HEAD main 2>/dev/null
121
- }
122
-
123
115
  # A remote is useless without an author, so the scenarios that reach one always
124
116
  # configure both. configure_sandbox_git_identity stays callable on its own for
125
117
  # the scenarios that never push. The probe runs first so an absent remote is
@@ -13,7 +13,7 @@
13
13
  # Mints a short random per-run identifier the first time it is asked for, then
14
14
  # holds it in CANON_SANDBOX_RUN_ID for the rest of this process. A direct call
15
15
  # (not `$(...)`) exports it into the caller's own shell, which is what lets
16
- # `run.sh` mint once and have manage-sandbox.sh and the check it shells out to
16
+ # `run.sh` mint once and have the provisioning and the check it shells out to
17
17
  # both inherit the same id as ordinary children. A call already carrying the
18
18
  # variable, inherited from such a parent, reuses it rather than minting a new one.
19
19
  #
@@ -0,0 +1,99 @@
1
+ #!/usr/bin/env bash
2
+ # No `-u`. Scenarios ran under the retired dispatcher without it and read unset
3
+ # variables as empty, so turning it on here changes what they provision.
4
+ set -e
5
+ set -o pipefail
6
+
7
+ # Runs one scenario's hooks for the provisioning order in
8
+ # `src/sandbox/provision.ts`. Scenarios and the library they call stay bash, so
9
+ # the harness reaches them through this entry and nothing else.
10
+ #
11
+ # probe <scenario> runs `use_config` and `use_anchor` when declared
12
+ # and prints every export they changed, closed by an
13
+ # `@anchor=<0|1>` record
14
+ # stage <scenario> <file> re-runs both hooks, runs `stage_setup` inside the
15
+ # tree, and writes the exports it changed to <file>,
16
+ # or an `@exited` record when the shell exits first
17
+ #
18
+ # Pairs are NUL-separated `NAME=value`, since a value can hold a newline. The
19
+ # retired dispatcher ran `stage_setup` in its own shell, so an export, an `exit`,
20
+ # or an `exec` there reached the harness, and the report carries all three: an
21
+ # `exec` skips the EXIT trap and leaves no report at all. The stage re-runs the
22
+ # hooks rather than receiving the probe's pairs, since they only export.
23
+
24
+ SCRIPT_DIR="$(cd "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" && pwd)"
25
+ PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
26
+ export PROJECT_ROOT
27
+
28
+ # Globals carry a prefix, since the scenario sourced below shares this shell.
29
+ _hook_die() {
30
+ echo "sandbox-hook: $1" >&2
31
+ exit 2
32
+ }
33
+ _hook_mode="${1:-}"
34
+ _hook_scenario="${2:-}"
35
+ _hook_report="${3:-}"
36
+
37
+ [[ "$_hook_mode" == "probe" || "$_hook_mode" == "stage" ]] || _hook_die "mode must be probe or stage, got: ${_hook_mode:-<empty>}"
38
+ [ -f "$_hook_scenario" ] || _hook_die "no scenario file at: ${_hook_scenario:-<empty>}"
39
+ [ "$_hook_mode" = "probe" ] || [ -n "$_hook_report" ] || _hook_die "stage needs a file to report its exports to"
40
+ [ "$_hook_mode" = "probe" ] || trap 'printf "@exited\0" >"$_hook_report"' EXIT
41
+
42
+ declare -A _hook_before
43
+ _hook_snapshot() {
44
+ local name
45
+ _hook_before=()
46
+ for name in $(compgen -e); do
47
+ _hook_before[$name]="${!name}"
48
+ done
49
+ }
50
+
51
+ # The shell moves PWD and OLDPWD itself on every `cd`, and neither is state.
52
+ _hook_changed() {
53
+ local name
54
+ for name in $(compgen -e); do
55
+ [[ "$name" == "PWD" || "$name" == "OLDPWD" ]] && continue
56
+ if [[ ! -v _hook_before[$name] ]] || [ "${_hook_before[$name]}" != "${!name}" ]; then
57
+ printf '%s=%s\0' "$name" "${!name}"
58
+ fi
59
+ done
60
+ }
61
+
62
+ # Taken before `config.sh`, so a `GITHUB_ORG` it derives from the remote reaches
63
+ # the harness as an export like any other.
64
+ _hook_snapshot
65
+
66
+ source "$PROJECT_ROOT/scripts/config.sh"
67
+ source "$PROJECT_ROOT/scripts/lib/ui.sh"
68
+ source "$PROJECT_ROOT/scripts/lib/sandbox-path.sh"
69
+ source "$PROJECT_ROOT/scripts/lib/sandbox-git.sh"
70
+ source "$PROJECT_ROOT/scripts/lib/sandbox-fixtures.sh"
71
+
72
+ # Unexported, as the dispatcher held them, so a scenario reads both while a
73
+ # child it spawns sees neither. Shellcheck cannot see the scenario reading them.
74
+ # shellcheck disable=SC2034
75
+ SANDBOX="$(resolve_sandbox_dir)" SANDBOX_DIR="$PROJECT_ROOT/sandbox"
76
+
77
+ # shellcheck source=/dev/null
78
+ source "$_hook_scenario"
79
+
80
+ _hook_declared() { [[ "$(type -t "$1")" == "function" ]]; }
81
+ _hook_run() {
82
+ if _hook_declared use_config; then use_config; fi
83
+ if _hook_declared use_anchor; then use_anchor; fi
84
+ }
85
+
86
+ if [ "$_hook_mode" = "probe" ]; then
87
+ # Stdout carries the pairs alone, so a hook that prints is moved off it.
88
+ _hook_run >&2
89
+ _hook_changed
90
+ if _hook_declared use_anchor; then printf '@anchor=1\0'; else printf '@anchor=0\0'; fi
91
+ exit 0
92
+ fi
93
+
94
+ _hook_run
95
+ _hook_snapshot
96
+ cd "$SANDBOX"
97
+ stage_setup
98
+ trap - EXIT
99
+ _hook_changed >"$_hook_report"
@@ -587,8 +587,8 @@ export const AUDITS: readonly AuditSpec[] = [
587
587
  corpus: 'tracked',
588
588
  // The one reason this verb refuses for that is an absence rather than a
589
589
  // break, on the same test the reach check and the skill audit take: no
590
- // target adopts `canon/context/`, `.canon/diagrams/`, and
591
- // `canon/wireframes/` all at once, so without the allowance every such
590
+ // target adopts `canon/context/`, an older install's `.canon/diagrams/`,
591
+ // and `canon/wireframes/` all at once, so without the allowance every such
592
592
  // project reports the verb unmeasured on every run and never changes.
593
593
  absentReasons: ['no-folders'] satisfies ContextAuditRefusal[],
594
594
  counts: contextCounts,
@@ -196,14 +196,6 @@ async function serveFor<T>(
196
196
  /** The element a composite is captured by, holding every frame and no chrome. */
197
197
  export const COMPOSITE_SELECTOR = '#canvas-composite'
198
198
 
199
- /**
200
- * The container holds no text, so its family exists only for the engine's
201
- * font probe, which rejects a family the machine lacks. The browser default is
202
- * Times New Roman, which a Linux runner often lacks, and `system-ui` is the one
203
- * every platform maps. Each frame keeps its own fonts inside its iframe.
204
- */
205
- const COMPOSITE_FONT = 'system-ui'
206
-
207
199
  export interface Placement {
208
200
  readonly frame: string
209
201
  readonly url: string
@@ -255,7 +247,7 @@ export function buildComposite(
255
247
  const html = [
256
248
  '<!doctype html>',
257
249
  '<html><head><meta charset="utf-8">',
258
- `<style>html,body{margin:0;background:transparent}#canvas-composite{position:relative;font-family:${COMPOSITE_FONT}}#canvas-composite iframe{position:absolute;display:block;border:0;background:transparent}</style>`,
250
+ `<style>html,body{margin:0;background:transparent}#canvas-composite{position:relative}#canvas-composite iframe{position:absolute;display:block;border:0;background:transparent}</style>`,
259
251
  '</head><body>',
260
252
  `<div id="canvas-composite" style="width:${width}px;height:${height}px">`,
261
253
  ...iframes,