@erclx/canon 5.50.0 → 5.51.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/CHANGELOG.md +4024 -0
- package/claude/.claude-plugin/plugin.json +1 -1
- package/claude/skills/auto-ship/references/fan-in.md +20 -6
- package/claude/skills/canon-cli/SKILL.md +9 -7
- package/claude/skills/ci-workflow/REQUIREMENT.md +3 -3
- package/claude/skills/ci-workflow/SKILL.md +26 -1
- package/claude/skills/ci-workflow/references/workflows.md +28 -0
- package/claude/skills/design-record/references/folder.md +1 -1
- package/claude/skills/design-taste/SKILL.md +2 -1
- package/claude/skills/git-followup/SKILL.md +1 -0
- package/claude/skills/git-pr/references/pr.md +1 -1
- package/claude/skills/plan-feature/references/batches.md +1 -1
- package/claude/skills/target-check/references/domains.md +8 -6
- package/docs/agents/index.md +1 -1
- package/docs/agents/migrate.md +2 -0
- package/docs/agents/targets.md +8 -1
- package/docs/target/migrations.md +1 -1
- package/docs/workflow/parallel-features.md +1 -1
- package/governance/detect.toml +1 -1
- package/governance/ledger/tooling/ci-workflow.md +6 -0
- package/governance/ledger/ui/design-reference.md +8 -13
- package/governance/rules/tooling/ci-workflow.md +4 -0
- package/governance/rules/ui/design-reference.md +3 -6
- package/package.json +2 -1
- package/scripts/ci/check-browsers.sh +13 -0
- package/scripts/ci/delete-previews.sh +34 -0
- package/scripts/ci/publish-check.sh +29 -0
- package/scripts/ci/refresh-frames-pr.sh +63 -0
- package/scripts/ci/report-baseline.sh +23 -0
- package/scripts/ci/stack-issues.sh +24 -0
- package/scripts/ci/verify-npm-token.sh +14 -0
- package/src/cli/help.ts +1 -0
- package/src/cli.ts +2 -0
- package/src/commands/changelog.ts +146 -0
- package/src/commands/hooks.ts +7 -5
- package/src/commands/migrate.ts +77 -0
- package/src/commands/worktrees.ts +273 -0
- package/src/gov/detect.ts +28 -10
- package/src/hooks/post-merge.ts +45 -6
- package/src/migrate/status.ts +128 -0
- package/src/version/changelog.ts +156 -0
- package/src/worktrees/members.ts +540 -0
- package/tooling/base/configs/.husky/post-merge +7 -6
- package/tooling/cloudflare/configs/.github/workflows/deploy.yml +10 -28
- package/tooling/cloudflare/configs/scripts/delete-previews.sh +36 -0
- package/tooling/cloudflare/reference.md +7 -4
- package/tooling/web/reference.md +5 -0
- package/tooling/web/seeds/canon/design/index.md +23 -0
|
@@ -48,12 +48,26 @@ Continue Step 2 with the integrator plan's own `**Files to touch:**`, then the r
|
|
|
48
48
|
|
|
49
49
|
### What the pull request carries
|
|
50
50
|
|
|
51
|
-
Say in the pull request body that each member is one merge commit and name the members
|
|
51
|
+
Say in the pull request body that each member is one merge commit, and name the members on one line in `## Summary`, backticked, in merge order:
|
|
52
52
|
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
git worktree remove <member worktree>
|
|
56
|
-
git branch -D <member branch>
|
|
53
|
+
```markdown
|
|
54
|
+
Fan-in members: `feat/a`, `feat/b`, `feat/c`
|
|
57
55
|
```
|
|
58
56
|
|
|
59
|
-
|
|
57
|
+
The line names branches rather than plan stems, since the branch is what gets deleted. Nothing outside it is read, so a branch named in prose elsewhere in the body is never a candidate.
|
|
58
|
+
|
|
59
|
+
### After the merge
|
|
60
|
+
|
|
61
|
+
The post-merge hook runs `canon worktrees retire-members` for each merged pull request number, and the verb deletes each member's branch on origin, its worktree, and its local branch. No session runs a step.
|
|
62
|
+
|
|
63
|
+
No member opens a pull request, so neither head-branch deletion nor `canon worktrees reclaim` ever reads one as merged. The member line is what reaches them.
|
|
64
|
+
|
|
65
|
+
- A member half goes only when its tip is an ancestor of the integrator's merged head, so a commit added after the merge keeps that half
|
|
66
|
+
- A worktree a live session holds, or one with uncommitted work, stays with its local branch
|
|
67
|
+
- A line naming the trunk, the integrator's own branch, or a branch with an open pull request deletes nothing
|
|
68
|
+
|
|
69
|
+
Run the verb by hand for a merge the hook missed, reading the dry run first:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
canon worktrees retire-members --pull-request <number> --dry-run
|
|
73
|
+
```
|
|
@@ -18,13 +18,15 @@ Consult to pick the `canon` verb for a job, and before running a verb that write
|
|
|
18
18
|
|
|
19
19
|
## Project setup
|
|
20
20
|
|
|
21
|
-
| Job | Verb
|
|
22
|
-
| -------------------------------------------- |
|
|
23
|
-
| Bootstrap a project with toolkit domains | `canon init`
|
|
24
|
-
| Bring every installed domain current | `canon sync`
|
|
25
|
-
| Reinstall the CLI itself | `canon upgrade`
|
|
26
|
-
| Move a project off a retired name or layout | `canon migrate`
|
|
27
|
-
|
|
|
21
|
+
| Job | Verb |
|
|
22
|
+
| -------------------------------------------- | ---------------------- |
|
|
23
|
+
| Bootstrap a project with toolkit domains | `canon init` |
|
|
24
|
+
| Bring every installed domain current | `canon sync` |
|
|
25
|
+
| Reinstall the CLI itself | `canon upgrade` |
|
|
26
|
+
| Move a project off a retired name or layout | `canon migrate` |
|
|
27
|
+
| Read what a project still needs to migrate | `canon migrate status` |
|
|
28
|
+
| Read the releases since a target's install | `canon changelog` |
|
|
29
|
+
| List the projects the toolkit installed into | `canon targets` |
|
|
28
30
|
|
|
29
31
|
## Domains
|
|
30
32
|
|
|
@@ -9,15 +9,15 @@ description: Scope boundary for pipeline structure against job contents, and the
|
|
|
9
9
|
|
|
10
10
|
Without this skill, a session chains jobs with `needs` to express reading order rather than a data dependency, so the pipeline costs the sum of its jobs. The same session splits a one-minute gate into parallel jobs, each repaying checkout, install, and toolchain setup, so the gate gets slower while reporting no earlier.
|
|
11
11
|
|
|
12
|
-
The rest surface as flakes.
|
|
12
|
+
The rest surface as flakes. A moving action ref changes under the project, a static cache key serves a stale toolchain, artifacts never expire, a broad default token grants unneeded writes, and a missing manual trigger leaves a run reproducible only by pushing a commit. A Linux-only pin also flags a supported macOS job as a departure.
|
|
13
13
|
|
|
14
14
|
## Must
|
|
15
15
|
|
|
16
16
|
- A job is gated only on a data dependency or a cost that justifies the wait, and checks sharing setup stay in one job until a run log puts the gate past roughly two minutes
|
|
17
17
|
- Every action is pinned to a tag that cannot cross a major version, and every cache is keyed on the version of what it caches
|
|
18
18
|
- Every workflow carries a manual trigger beside its primary one, except one that commits back
|
|
19
|
-
- The token defaults to read-only, with a write scope granted only on the job that needs it
|
|
20
|
-
-
|
|
19
|
+
- The token defaults to read-only, with a write scope granted only on the job that needs it, and artifact upload is bounded to failures and expires
|
|
20
|
+
- A job runs on Linux unless the project states a platform for a layer that differs by platform
|
|
21
21
|
|
|
22
22
|
## Must not
|
|
23
23
|
|
|
@@ -20,7 +20,17 @@ Generate GitHub Actions workflow files for CI pipelines. Enforce parallel job ex
|
|
|
20
20
|
- Include `workflow_dispatch` alongside the primary trigger, except on a commit-back workflow, where a manual run has no branch to commit onto and would pass while doing nothing.
|
|
21
21
|
- Set `permissions: contents: read` at the top level, and grant a write scope only on the job that needs it.
|
|
22
22
|
- Pin all actions to major version tags (`@v4`, never `@latest` or `@main`).
|
|
23
|
-
- Use `runs-on: ubuntu-latest` for
|
|
23
|
+
- Use `runs-on: ubuntu-latest` for every job, except one the runner platform rules below move to another platform.
|
|
24
|
+
|
|
25
|
+
## Runner platform
|
|
26
|
+
|
|
27
|
+
Linux stays the default. A job leaves it only for a layer whose result differs by platform, and only on a platform the project states.
|
|
28
|
+
|
|
29
|
+
- Read the stated platforms from the project's requirements record or README. A platform stated in neither keeps every job on Linux.
|
|
30
|
+
- Keep lint, build, and browser jobs on Linux, since their result does not differ by platform. Name the layers that may leave it and never the steps they run.
|
|
31
|
+
- Name another runner by its `-latest` label, such as `macos-latest`, matching the `ubuntu-latest` convention above.
|
|
32
|
+
- Resolve a macOS `$TMPDIR` or `mktemp` path with `realpath` before comparing it with a tool's output, since the `/var` to `/private/var` symlink hides the target. Treat `$RUNNER_TEMP` alike.
|
|
33
|
+
- Expect a macOS job to cost more per minute than a Linux one. GitHub bills the two differently, so read the rate from its billing page rather than quoting a multiplier.
|
|
24
34
|
|
|
25
35
|
## Job naming
|
|
26
36
|
|
|
@@ -59,6 +69,14 @@ A workflow that pushes a regenerated file onto the pull request branch takes the
|
|
|
59
69
|
- Set `HUSKY: 0` on the commit step when the runner lacks a tool a hook shells out to.
|
|
60
70
|
- Fail a template's first step while a path list still holds its placeholder, so an unfinished install fails loudly rather than never firing.
|
|
61
71
|
|
|
72
|
+
## Steps
|
|
73
|
+
|
|
74
|
+
- Keep an inline `run:` step to five lines and one guard that exits or writes an output. Move other branching, a loop, trap, or function to a script, which runs on a laptop and under shellcheck.
|
|
75
|
+
- Put the script at `scripts/<name>.sh`, or a `.ts` file for a Bun project, and call it after `actions/checkout`, since the runner holds no copy before that.
|
|
76
|
+
- Pass inputs as arguments or `env`, never spliced into the script text, so a branch name with a quote or `$(...)` in it cannot run.
|
|
77
|
+
- Keep `permissions` and secrets on the workflow step, with the script reading its token from `env`.
|
|
78
|
+
- Open the script with `set -e` at least, since the runner gives a `run:` step `bash -e` and a script called directly gets no flags.
|
|
79
|
+
|
|
62
80
|
## Template
|
|
63
81
|
|
|
64
82
|
Load `${CLAUDE_SKILL_DIR}/references/workflows.md` for the base workflow template. Adapt it to the project's stack, test commands, and build output. Add or remove jobs as needed. The template already carries the folded shape, and the split beside it applies once the granularity rule above calls for it.
|
|
@@ -79,5 +97,12 @@ Before responding, also verify:
|
|
|
79
97
|
|
|
80
98
|
- Artifacts upload on `if: failure()` only with `retention-days: 7`.
|
|
81
99
|
- Job names use emoji + title format.
|
|
100
|
+
- Every job runs on `ubuntu-latest`, except one that targets a platform the project states and runs a layer that differs by platform.
|
|
82
101
|
- Deploy, publish, and release jobs carry a placeholder step and a named handoff, never a guessed deploy command.
|
|
83
102
|
- Bun projects use `oven-sh/setup-bun@v2` with `bun install --frozen-lockfile`.
|
|
103
|
+
|
|
104
|
+
### Steps
|
|
105
|
+
|
|
106
|
+
Before responding, also verify:
|
|
107
|
+
|
|
108
|
+
- No `run:` step passes five lines or carries more than one exit-or-output guard, a loop, a trap, or a function. A step that does calls a script, with its inputs as arguments or `env`.
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# CI workflow template
|
|
2
2
|
|
|
3
|
+
## Contents
|
|
4
|
+
|
|
5
|
+
- [Base template](#base-template)
|
|
6
|
+
- [Splitting the check job](#splitting-the-check-job)
|
|
7
|
+
- [Targeting another platform](#targeting-another-platform)
|
|
8
|
+
|
|
9
|
+
## Base template
|
|
10
|
+
|
|
3
11
|
Copy this base template and adapt it to the project's stack, test commands, and build output. It carries the shape a new pipeline starts in, with the checks that share setup in one job, per the granularity rule in the skill body. `e2e` and anything gated on it stay separate jobs at either size.
|
|
4
12
|
|
|
5
13
|
```yaml
|
|
@@ -99,3 +107,23 @@ jobs:
|
|
|
99
107
|
name: build-output
|
|
100
108
|
path: dist/
|
|
101
109
|
```
|
|
110
|
+
|
|
111
|
+
## Targeting another platform
|
|
112
|
+
|
|
113
|
+
Add this job beside the Linux ones only when the project states macOS as a supported platform, per the runner platform rules in the skill body. It runs the unit layer, since that layer differs by platform, and the rest stay on `ubuntu-latest`.
|
|
114
|
+
|
|
115
|
+
```yaml
|
|
116
|
+
jobs:
|
|
117
|
+
unit-macos:
|
|
118
|
+
name: '🧪 Unit Tests (macOS)'
|
|
119
|
+
runs-on: macos-latest
|
|
120
|
+
steps:
|
|
121
|
+
- uses: actions/checkout@v7
|
|
122
|
+
- uses: oven-sh/setup-bun@v2
|
|
123
|
+
with:
|
|
124
|
+
bun-version: latest
|
|
125
|
+
- run: bun install --frozen-lockfile
|
|
126
|
+
- name: Resolve the temp folder
|
|
127
|
+
run: echo "TMPDIR=$(realpath "$RUNNER_TEMP")" >> "$GITHUB_ENV"
|
|
128
|
+
- run: bun run test
|
|
129
|
+
```
|
|
@@ -66,4 +66,4 @@ Each group holds accepted frames a build matches, light and dark.
|
|
|
66
66
|
|
|
67
67
|
## Lifetime
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
The design-reference governance rule states how long a reference stays, when it is redrawn, and when it goes with its surface.
|
|
@@ -154,9 +154,10 @@ Run `${CLAUDE_SKILL_DIR}/references/preflight.md` against the output. It is the
|
|
|
154
154
|
|
|
155
155
|
### Other skills
|
|
156
156
|
|
|
157
|
-
|
|
157
|
+
Five neighbors own the rest.
|
|
158
158
|
|
|
159
159
|
- The candidate loop, the arm set, the render, and the pick: `pick-by-eye`
|
|
160
160
|
- The shape of the project's design document and where its values live: `${CLAUDE_SKILL_DIR}/../design-record/references/design.md`
|
|
161
|
+
- The folder holding the accepted designs and how a reference lands in it: `${CLAUDE_SKILL_DIR}/../design-record/references/folder.md`
|
|
161
162
|
- Reading source for roughness: `ux-audit`. Measuring what a running interface costs to paint: `ux-measure`
|
|
162
163
|
- Prose on the surface being designed: the `write-human` skill
|
|
@@ -59,6 +59,7 @@ A missing tracking ref is not a guard, since an open pull request proves the bra
|
|
|
59
59
|
- A fix commit answering a review changes what shipped exactly as much as an ordinary followup does, so the sync cannot wait on the invocation or the comment count below.
|
|
60
60
|
- A body a person edited by hand between rounds gets no special handling: judge it against the tree the same way regardless of who wrote it last, since a hand-edit the fix commit has made stale is the exact drift this sync exists to close.
|
|
61
61
|
- Carry a `UI pass` line marked `<!-- pr-ui-pass -->` into any rewritten body unchanged, since `canon pr tick` owns it and a dropped marker defeats the reset on a new head.
|
|
62
|
+
- Carry a `Fan-in members:` line into any rewritten body unchanged, since the post-merge hook reads it to delete the members and a dropped line deletes nothing and says nothing.
|
|
62
63
|
8. Route on the invocation and the comment count for the reply alone.
|
|
63
64
|
- When invoked with `reply-owned`, skip this step: the caller posts its own reply.
|
|
64
65
|
- Otherwise, if the count is above zero, the followup addresses review feedback: write a one-line summary of the fix to `.canon/tmp/pr/followup/summary-<number>.md` in its own call, run `canon labels scan --body-file .canon/tmp/pr/followup/summary-<number>.md` against it, which applies the rule in `${CLAUDE_SKILL_DIR}/../git-pr/references/publish.md`, then post it with `gh api -X POST repos/{owner}/{repo}/issues/<number>/comments -F body=@.canon/tmp/pr/followup/summary-<number>.md --silent`. A hook on `Bash` runs the same scan on that body file and denies the post on a hit, and it refuses an inline `-f body=` value, so the body goes through a file. The `pull_request` check the git-pr surface carries triggers on a push or an open rather than a plain edit, so neither this comment nor the title and body step 7 synced reaches it.
|
|
@@ -66,7 +66,7 @@ Past 5 bullets, group Key changes under bold labels, 5 bullets a group at most.
|
|
|
66
66
|
|
|
67
67
|
### Closing lines
|
|
68
68
|
|
|
69
|
-
The closing lines end `## Summary`, one `Closes #NNN` per issue and no trailing period
|
|
69
|
+
The closing lines end `## Summary`, one `Closes #NNN` per issue and no trailing period, and a sliced task carries them on its last slice. `closing-issues.md` decides the list. A fan-in member line sits above them, per `${CLAUDE_SKILL_DIR}/../auto-ship/references/fan-in.md`.
|
|
70
70
|
|
|
71
71
|
### Context section
|
|
72
72
|
|
|
@@ -90,4 +90,4 @@ The integrator merges each member branch with `git merge --no-ff` in the order i
|
|
|
90
90
|
|
|
91
91
|
- Say in the pull request body that each member is one merge commit, so a reviewer reads `git log --first-parent` one member at a time
|
|
92
92
|
- Fix a semantic conflict a merge surfaces on the integrator's branch, since a member has no pull request to fix it on
|
|
93
|
-
-
|
|
93
|
+
- Name the members on the body's `Fan-in members:` line, which the post-merge hook reads to delete each member's branches and worktree, per `${CLAUDE_SKILL_DIR}/../auto-ship/references/fan-in.md`
|
|
@@ -21,7 +21,7 @@ This domain is first because it conditions the other five. A target a release be
|
|
|
21
21
|
|
|
22
22
|
## 2. The `canon/` folder
|
|
23
23
|
|
|
24
|
-
Read four fields off the same report, then
|
|
24
|
+
Read four fields off the same report, then three verbs:
|
|
25
25
|
|
|
26
26
|
- `unmigrated`: a domain still at the root layout with nothing under `.claude/`. The most urgent finding, because such a domain reports no drift of its own while being entirely behind.
|
|
27
27
|
- `superseded`: a file a newer seed folder replaced. No command moves it, since the content is the project's own.
|
|
@@ -34,19 +34,21 @@ The fourth field and the two verbs cover what the toolkit stopped shipping and w
|
|
|
34
34
|
- `reverse`: `unclaimed` names folders at roots the toolkit stopped shipping, each with an `attribution` of `dropped`, `unattributed`, or `project`.
|
|
35
35
|
- `canon context audit --json`: required sections, entry length, citations, and index drift across the context folder.
|
|
36
36
|
- `canon records validate <kind> --json`, once per record folder the target carries.
|
|
37
|
+
- `canon migrate status --json`: every migration in run order, each with a `state` of `pending`, `clean`, or `refused`. It exits 2 while any is pending.
|
|
37
38
|
|
|
38
39
|
### Verdicts
|
|
39
40
|
|
|
40
|
-
Each of the three states takes all
|
|
41
|
+
Each of the three states takes all seven reads together.
|
|
41
42
|
|
|
42
|
-
- Current: `unmigrated`, `superseded`, and `unmovedSurfaces` all empty, `reverse.unclaimed` carrying nothing outside `project` attribution, and
|
|
43
|
-
- Behind: any of those carrying an entry. Name the entry and its attribution, and for `unmovedSurfaces` each `rel` with its `movesTo`.
|
|
44
|
-
- Unread: `historyUnavailable` set on `reverse`, a `reverse` or `unmovedSurfaces` key the report does not carry, or
|
|
43
|
+
- Current: `unmigrated`, `superseded`, and `unmovedSurfaces` all empty, `reverse.unclaimed` carrying nothing outside `project` attribution, and all three verbs finding nothing.
|
|
44
|
+
- Behind: any of those carrying an entry, or a `pending` migration. Name the entry and its attribution, and for `unmovedSurfaces` each `rel` with its `movesTo`.
|
|
45
|
+
- Unread: `historyUnavailable` set on `reverse`, a `reverse` or `unmovedSurfaces` key the report does not carry, or any verb refusing, a `refused` migration included
|
|
45
46
|
- A missing key is a binary predating the field rather than a target with nothing to report, so name the installed version beside it
|
|
46
47
|
|
|
47
48
|
Routes by finding.
|
|
48
49
|
|
|
49
|
-
- `
|
|
50
|
+
- A `pending` migration routes to its entry's `verb`, which only reports its plan until `--write` is passed. Name each in the order the status gives, and run neither form.
|
|
51
|
+
- `unmovedSurfaces` is the `surface-roots` migration. Name each entry's `rel` and `movesTo` beside its verb.
|
|
50
52
|
- `unmigrated` routes to a relocation the user runs, since no command moves it.
|
|
51
53
|
- `superseded` routes to a split the user makes, since no command moves the content and no skill proposes it.
|
|
52
54
|
- An `unclaimed` folder carrying `project` attribution routes nowhere, since history proved the project owns it.
|
package/docs/agents/index.md
CHANGED
|
@@ -18,4 +18,4 @@ CLI catalog and invocation rules for agents, split by command domain. Start with
|
|
|
18
18
|
- [Overview](overview.md): What this folder covers, the invocation rules every command inherits, and how canon docs resolves a topic name
|
|
19
19
|
- [Records](records.md): Backing the record folders to a private remote, restoring them on a new machine, reading folder size, and pruning stale scratch
|
|
20
20
|
- [Sessions transfer](sessions-transfer.md): Moving a session to another machine with export and import, the manifest fields, the refusal reasons, and what a resume on the target depends on
|
|
21
|
-
- [Targets](targets.md): The projects this toolkit installed into, where each answer comes from,
|
|
21
|
+
- [Targets](targets.md): The projects this toolkit installed into, where each answer comes from, the cross-target pull request read, and the releases since a target's install
|
package/docs/agents/migrate.md
CHANGED
|
@@ -10,6 +10,7 @@ kind: reference
|
|
|
10
10
|
|
|
11
11
|
| Verb | Moves |
|
|
12
12
|
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
13
|
+
| `status` | Nothing. It lists every migration the project still needs, in run order. |
|
|
13
14
|
| `rename` | The retired `aitk` name. `--scope target` rewrites toolkit-owned folders only. |
|
|
14
15
|
| `skill-names` | Plugin skills off their `claude-` and `draft-` prefixes and other retired names, with every citation |
|
|
15
16
|
| `records` | Session records from `.claude/` to `.canon/`, with every tracked citation |
|
|
@@ -32,6 +33,7 @@ kind: reference
|
|
|
32
33
|
- `record-tree` reports closed groundwork and intake trails, the scratch folder, and backup history as counts and rewrites none
|
|
33
34
|
- `records` reports skipped record folders as a count on its own line
|
|
34
35
|
- A `record-tree` rewrite has no undo in version control, so read the report before `--write`
|
|
36
|
+
- `status` runs each verb as a dry run and exits 2 while any is pending, with a refusal outranking that. A clean entry can turn pending once an earlier one applies, so run it again after each `--write`.
|
|
35
37
|
|
|
36
38
|
Three markers keep an old spelling on a line. Each also covers the nearest non-blank line, below it for `canon-keep-record-root` and above it for `canon-keep-surface-root`.
|
|
37
39
|
|
package/docs/agents/targets.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Targets
|
|
3
|
-
description: The projects this toolkit installed into, where each answer comes from,
|
|
3
|
+
description: The projects this toolkit installed into, where each answer comes from, the cross-target pull request read, and the releases since a target's install
|
|
4
4
|
kind: reference
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -12,6 +12,13 @@ kind: reference
|
|
|
12
12
|
- Each stamping sync records its target in `$XDG_STATE_HOME/canon/targets.json`, and no row is removed
|
|
13
13
|
- A sweep finds installs the index never held
|
|
14
14
|
|
|
15
|
+
`canon changelog` prints the releases a target has not seen, from the `CHANGELOG.md` the installed package ships. It reads no registry and needs no `gh`.
|
|
16
|
+
|
|
17
|
+
- The start defaults to the oldest `version` across the target's stamp domains. `--since <version>` overrides it, and `--root <path>` names the target.
|
|
18
|
+
- `--json` carries `since`, `running`, and `entries`, each with its `version` and raw `markdown`, oldest first
|
|
19
|
+
- A start equal to the running version is the one empty range, since that target is current
|
|
20
|
+
- A refusal names its `reason` instead of printing an empty range, being `no-stamp`, `no-changelog`, or `unknown-version`. The last covers a pre-release and a start newer than the binary.
|
|
21
|
+
|
|
15
22
|
## Output
|
|
16
23
|
|
|
17
24
|
- `bound` on a sweep names the roots walked, the depth, and what it skipped. Read it before trusting a count.
|
|
@@ -6,7 +6,7 @@ category: Agent surface
|
|
|
6
6
|
|
|
7
7
|
# Target migrations
|
|
8
8
|
|
|
9
|
-
Each section is a move a project runs once, when it was scaffolded before the change it names. Run `canon upgrade` first. The recurring sync that follows is in [target sync](sync.md).
|
|
9
|
+
Each section is a move a project runs once, when it was scaffolded before the change it names. Run `canon upgrade` first, then `canon migrate status --json` to list the moves a project still needs in the order to run them. The recurring sync that follows is in [target sync](sync.md).
|
|
10
10
|
|
|
11
11
|
## Move the records first, once
|
|
12
12
|
|
|
@@ -60,4 +60,4 @@ Merge order matters only when two branches touch the same file. Expect to rebase
|
|
|
60
60
|
|
|
61
61
|
`canon:task-board` creates a task file, and `canon:task-complete` marks outcomes. The `post-merge` hook archives the task a merged pull request closed, with its plan, and a `post-rewrite` hook does the same for a rebase pull. Both archive a closed task whose merge carried a PR number, and a slice merged before then moves only its own plan.
|
|
62
62
|
|
|
63
|
-
|
|
63
|
+
The hook also deletes the member branches and worktrees a merged fan-in integrator names, and `canon worktrees retire-members --pull-request <n>` does it for a merge the hook missed. `CANON_SKIP_RECLAIM` turns off that step and the reclaim, and `CANON_SKIP_UPGRADE` and `CANON_SKIP_PLUGIN_UPDATE` turn off the other two.
|
package/governance/detect.toml
CHANGED
|
@@ -22,6 +22,12 @@ The field is continuous integration on GitHub Actions, and the authority is GitH
|
|
|
22
22
|
| Skip a fork's pull request | [Workflow syntax, permissions](https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax): "if the workflow was triggered by a pull request event other than `pull_request_target` from a forked repository, and the Send write tokens to workflows from pull requests setting is not selected, the permissions are adjusted to change any write permissions to read only" | 2026-10-18 |
|
|
23
23
|
| Never commit back to the trunk | House choice: a workflow pushing onto the trunk lands a change no pull request carried and no reviewer read | 2026-10-18 |
|
|
24
24
|
|
|
25
|
+
## Steps
|
|
26
|
+
|
|
27
|
+
| Bullet | Source | Read |
|
|
28
|
+
| ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- |
|
|
29
|
+
| Long steps call a script, 5 max | House choice, from [issue 2531](https://github.com/erclx/canon/issues/2531): a 33-line publish check copied out of a workflow carried a program no laptop or shellcheck could run. [Workflow syntax, run](https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax) documents `run` as a command run in the shell, with no limit on its size. One guard stays inline, since a placeholder or secrets guard of three lines gains nothing from a script | 2026-10-21 |
|
|
30
|
+
|
|
25
31
|
## Token scopes
|
|
26
32
|
|
|
27
33
|
| Bullet | Source | Read |
|
|
@@ -9,13 +9,14 @@ The rule states canon's own design handoff, generalized from Frameboard's projec
|
|
|
9
9
|
|
|
10
10
|
## Where the design lives
|
|
11
11
|
|
|
12
|
-
| Bullet | Source
|
|
13
|
-
| ------------------------------ |
|
|
14
|
-
| Build against the tracked copy | House choice: a canvas changes under the build with no history, so a reviewer cannot tell which version a surface was built against
|
|
15
|
-
| Load the keeper skill | House choice: the rule governs an edit and carries no procedure, so a session without the skill copies frames in by hand or skips the index row
|
|
16
|
-
| Land a design
|
|
17
|
-
| No hand edits | House choice: a reference edited by hand drifts from its canvas source, and the next sync overwrites the edit or reports it as a change nobody made
|
|
18
|
-
| Index row before the sync | House choice: the sync writes only the surfaces the index names, so a missing row drops the new surface's reference
|
|
12
|
+
| Bullet | Source | Read |
|
|
13
|
+
| ------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- |
|
|
14
|
+
| Build against the tracked copy | House choice: a canvas changes under the build with no history, so a reviewer cannot tell which version a surface was built against | 2026-10-18 |
|
|
15
|
+
| Load the keeper skill | House choice: the rule governs an edit and carries no procedure, so a session without the skill copies frames in by hand or skips the index row | 2026-10-21 |
|
|
16
|
+
| Land a design with its build | House choice: a design merged as its own pull request waits on a review that reads a picture with no build beside it, and the pick drifts before anything uses it | 2026-10-21 |
|
|
17
|
+
| No hand edits | House choice: a reference edited by hand drifts from its canvas source, and the next sync overwrites the edit or reports it as a change nobody made | 2026-10-18 |
|
|
18
|
+
| Index row before the sync | House choice: the sync writes only the surfaces the index names, so a missing row drops the new surface's reference | 2026-10-21 |
|
|
19
|
+
| Reference lifetime | House choice: a reference kept past its surface misleads the next build, and one redrawn without a design change hides a departure the review should see | 2026-10-21 |
|
|
19
20
|
|
|
20
21
|
## Building against a reference
|
|
21
22
|
|
|
@@ -32,12 +33,6 @@ The rule states canon's own design handoff, generalized from Frameboard's projec
|
|
|
32
33
|
| Name each departure | House choice: an unnamed departure reads as an accident, and the next build against the same reference repeats or reverts it | 2026-10-18 |
|
|
33
34
|
| Unexplained departure is a finding | House choice: without the finding, an unexplained departure merges as the new design with no one having chosen it | 2026-10-18 |
|
|
34
35
|
|
|
35
|
-
## Naming
|
|
36
|
-
|
|
37
|
-
| Bullet | Source | Read |
|
|
38
|
-
| ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | ---------- |
|
|
39
|
-
| One folder per app part | House choice: a fixed folder and theme suffix let the sync and a reviewer find a surface's pair of references without reading an index | 2026-10-18 |
|
|
40
|
-
|
|
41
36
|
## Declined
|
|
42
37
|
|
|
43
38
|
The rewrite kept every bullet. Each was already under 200 characters and states a step a reviewer can check against the pull request.
|
|
@@ -17,6 +17,10 @@ paths:
|
|
|
17
17
|
- Skip a pull request from a fork with `github.event.pull_request.head.repo.full_name == github.repository`, since the default token cannot push to a fork's branch.
|
|
18
18
|
- Never commit back to the trunk. A commit with no pull request and no reviewer needs an operator's decision, not a workflow's.
|
|
19
19
|
|
|
20
|
+
## Steps
|
|
21
|
+
|
|
22
|
+
- Keep an inline `run:` step to five lines at most with one guard allowed and no other branching, loop, trap, or function, and call a script for anything longer, per the `canon:ci-workflow` skill.
|
|
23
|
+
|
|
20
24
|
## Token scopes
|
|
21
25
|
|
|
22
26
|
- In a workflow with more than one job, add a write scope to the job that needs it, never to the workflow-level block, so every other job keeps the read-only token.
|
|
@@ -18,9 +18,10 @@ paths:
|
|
|
18
18
|
|
|
19
19
|
- Build UI against `canon/design/`, never against the canvas directly.
|
|
20
20
|
- Load the `canon:design-record` skill before adding, redrawing, or removing a reference under `canon/design/`, and report it rather than proceeding silently when it does not resolve.
|
|
21
|
-
- Land a picked or changed
|
|
21
|
+
- Land a picked or changed design in `canon/design/` through the project's design sync, in the first commit of the branch that builds against it or with its design round, never as its own pull request.
|
|
22
22
|
- Never copy, edit, or delete a reference file under `canon/design/` by hand.
|
|
23
|
-
- Add a new surface's row to the index in `canon/design/` before running the sync
|
|
23
|
+
- Add a new surface's row to the index in `canon/design/` before running the sync.
|
|
24
|
+
- Keep a reference while its surface exists, redraw it only on an intentional design change, and remove it with its index row in the change that removes the surface.
|
|
24
25
|
|
|
25
26
|
## Building against a reference
|
|
26
27
|
|
|
@@ -32,7 +33,3 @@ paths:
|
|
|
32
33
|
- Put each changed surface's reference image beside its built capture, light and dark, in the pull request description.
|
|
33
34
|
- Name each place the build departs from its reference, with its reason, in the pull request description.
|
|
34
35
|
- Report an unexplained departure from a reference as a review finding.
|
|
35
|
-
|
|
36
|
-
## Naming
|
|
37
|
-
|
|
38
|
-
- Give each app part one plain kebab-case folder under `canon/design/`, and name each file `<name>-dark` or `<name>-light`.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@erclx/canon",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "5.
|
|
4
|
+
"version": "5.51.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": {
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
"tooling",
|
|
15
15
|
"claude",
|
|
16
16
|
"docs",
|
|
17
|
+
"CHANGELOG.md",
|
|
17
18
|
"tsconfig.json",
|
|
18
19
|
"assets/brand/mark.svg",
|
|
19
20
|
"!scripts/eval",
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Fails when a Playwright browser named in the arguments is missing from the
|
|
3
|
+
# cache, called after the cache restore in pr-visual-checks.yml. A cache hit
|
|
4
|
+
# skips the install step, so a restore that came back empty would otherwise
|
|
5
|
+
# surface later as a launch error.
|
|
6
|
+
set -e
|
|
7
|
+
|
|
8
|
+
for browser in "$@"; do
|
|
9
|
+
if ! compgen -G "$HOME/.cache/ms-playwright/${browser}-*" >/dev/null; then
|
|
10
|
+
echo "Missing Playwright browser: ${browser}" >&2
|
|
11
|
+
exit 1
|
|
12
|
+
fi
|
|
13
|
+
done
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Deletes the Cloudflare Pages preview deployments minted for one branch, called
|
|
3
|
+
# by the cleanup-preview job in deploy-site.yml with the Pages project name and
|
|
4
|
+
# the branch. CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID come from the step
|
|
5
|
+
# env.
|
|
6
|
+
#
|
|
7
|
+
# Deployments are listed through the REST API rather than wrangler, whose
|
|
8
|
+
# listing carries no branch filter. `force=true` is what lets a deployment
|
|
9
|
+
# still holding its branch alias be deleted.
|
|
10
|
+
#
|
|
11
|
+
# tooling/cloudflare/configs/scripts/delete-previews.sh is the seeded copy,
|
|
12
|
+
# which adds a skip for an absent secret. Keep the two otherwise the same.
|
|
13
|
+
set -e
|
|
14
|
+
|
|
15
|
+
PROJECT_NAME=$1
|
|
16
|
+
BRANCH=$2
|
|
17
|
+
|
|
18
|
+
api="https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/pages/projects/$PROJECT_NAME/deployments"
|
|
19
|
+
auth="Authorization: Bearer $CLOUDFLARE_API_TOKEN"
|
|
20
|
+
page=1
|
|
21
|
+
ids=""
|
|
22
|
+
while :; do
|
|
23
|
+
listing=$(curl -fsS -H "$auth" "$api?env=preview&per_page=25&page=$page")
|
|
24
|
+
[ "$(echo "$listing" | jq '.result | length')" -eq 0 ] && break
|
|
25
|
+
ids="$ids $(echo "$listing" | jq -r --arg branch "$BRANCH" '.result[] | select(.deployment_trigger.metadata.branch == $branch) | .id')"
|
|
26
|
+
page=$((page + 1))
|
|
27
|
+
done
|
|
28
|
+
deleted=0
|
|
29
|
+
for id in $ids; do
|
|
30
|
+
curl -fsS -X DELETE -H "$auth" "$api/$id?force=true" >/dev/null
|
|
31
|
+
echo "Deleted $id"
|
|
32
|
+
deleted=$((deleted + 1))
|
|
33
|
+
done
|
|
34
|
+
echo "Deleted $deleted preview deployments for $BRANCH."
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Reports whether the newest GitHub release reached npm, called by the
|
|
3
|
+
# publish-check job in release-please.yml. The step passes GH_TOKEN and GH_REPO
|
|
4
|
+
# for gh. A release inside the publish job's 15-minute window passes, since its
|
|
5
|
+
# publish may still be running.
|
|
6
|
+
set -e
|
|
7
|
+
|
|
8
|
+
package=@erclx/canon
|
|
9
|
+
|
|
10
|
+
if ! release=$(gh release view --json tagName,publishedAt --jq '"\(.tagName) \(.publishedAt)"') || [ -z "$release" ]; then
|
|
11
|
+
echo "::error::Could not read the newest GitHub release, so whether it reached npm is unknown."
|
|
12
|
+
exit 1
|
|
13
|
+
fi
|
|
14
|
+
read -r tag published <<<"$release"
|
|
15
|
+
age=$(($(date +%s) - $(date -d "$published" +%s)))
|
|
16
|
+
if [ "$age" -lt 900 ]; then
|
|
17
|
+
echo "$tag is ${age}s old, inside the 15-minute window its publish job runs in."
|
|
18
|
+
exit 0
|
|
19
|
+
fi
|
|
20
|
+
# A missing version is an E404, so read the whole list to tell it from an outage
|
|
21
|
+
if ! versions=$(npm view "$package" versions --json); then
|
|
22
|
+
echo "::error::Could not read $package from npm, so whether $tag reached it is unknown."
|
|
23
|
+
exit 1
|
|
24
|
+
fi
|
|
25
|
+
if ! jq -e --arg v "${tag#v}" '[.] | flatten | index($v) != null' <<<"$versions" >/dev/null; then
|
|
26
|
+
echo "::error::$tag has a GitHub release but npm does not serve it. Publish it with: gh workflow run release-please.yml -f tag=$tag"
|
|
27
|
+
exit 1
|
|
28
|
+
fi
|
|
29
|
+
echo "$tag is on npm."
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Commits the regenerated capture frames onto the refresh branch and opens or
|
|
3
|
+
# updates its pull request, called by refresh-capture-frames.yml after the
|
|
4
|
+
# capture steps. The step holds GH_TOKEN and HUSKY, since the token scope is
|
|
5
|
+
# read off the workflow.
|
|
6
|
+
#
|
|
7
|
+
# Hooks stay off, since pre-push runs a check whose format step needs shfmt,
|
|
8
|
+
# which the runner lacks. verify.yml checks the pull request.
|
|
9
|
+
#
|
|
10
|
+
# The frames commit where they rendered, then only the files that commit wrote
|
|
11
|
+
# or dropped carry onto main fetched now, so a merge landing mid-run neither
|
|
12
|
+
# leaves the branch on an older base nor loses a frame it moved. The pull
|
|
13
|
+
# request resolves by number, since every merged refresh leaves a closed one on
|
|
14
|
+
# the same head.
|
|
15
|
+
set -e
|
|
16
|
+
|
|
17
|
+
branch=chore/refresh-capture-frames
|
|
18
|
+
title="chore(web): refresh capture frames"
|
|
19
|
+
|
|
20
|
+
if [ -z "$(git status --porcelain assets/captures assets/frames assets/evidence)" ]; then
|
|
21
|
+
echo "Frames are current, nothing to refresh."
|
|
22
|
+
exit 0
|
|
23
|
+
fi
|
|
24
|
+
git config user.name "github-actions[bot]"
|
|
25
|
+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" # canon-allow-reference: the bot account id, not a commit
|
|
26
|
+
git add assets/captures assets/frames assets/evidence
|
|
27
|
+
git commit -m "$title"
|
|
28
|
+
rendered=$(git rev-parse HEAD)
|
|
29
|
+
written=$(git diff --name-only --no-renames --diff-filter=d HEAD~1 HEAD)
|
|
30
|
+
dropped=$(git diff --name-only --no-renames --diff-filter=D HEAD~1 HEAD)
|
|
31
|
+
git fetch --depth=1 origin +refs/heads/main:refs/remotes/origin/main
|
|
32
|
+
git checkout -B "$branch" origin/main
|
|
33
|
+
if [ -n "$written" ]; then
|
|
34
|
+
printf '%s\n' "$written" | xargs -d '\n' git checkout "$rendered" --
|
|
35
|
+
fi
|
|
36
|
+
if [ -n "$dropped" ]; then
|
|
37
|
+
printf '%s\n' "$dropped" | xargs -d '\n' git rm -q --ignore-unmatch --
|
|
38
|
+
fi
|
|
39
|
+
if git diff --cached --quiet -- assets/captures assets/frames assets/evidence; then
|
|
40
|
+
echo "Main already carries these frames, nothing to refresh."
|
|
41
|
+
exit 0
|
|
42
|
+
fi
|
|
43
|
+
git commit -m "$title"
|
|
44
|
+
git push --force origin "$branch"
|
|
45
|
+
number=$(gh pr list --head "$branch" --state open --json number --jq '.[0].number')
|
|
46
|
+
if [ -z "$number" ]; then
|
|
47
|
+
gh pr create \
|
|
48
|
+
--base main \
|
|
49
|
+
--head "$branch" \
|
|
50
|
+
--title "$title" \
|
|
51
|
+
--body "## Summary
|
|
52
|
+
|
|
53
|
+
- Refreshes the capture frames from main so their counts and tokens stay current.
|
|
54
|
+
|
|
55
|
+
## Key changes
|
|
56
|
+
|
|
57
|
+
- Regenerates the count and token bearing frames, their images, and their stamps from main.
|
|
58
|
+
- Recaptures the home page baseline under assets/evidence/home.
|
|
59
|
+
- Merges itself by squash once its required check passes."
|
|
60
|
+
number=$(gh pr list --head "$branch" --state open --json number --jq '.[0].number')
|
|
61
|
+
fi
|
|
62
|
+
# Every run, so a force-push from a later run leaves it queued either way
|
|
63
|
+
gh pr merge "$number" --auto --squash
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Writes the step summary saying whether the captured landing page frames match
|
|
3
|
+
# the committed baseline, called by the capture job in pr-visual-checks.yml. A
|
|
4
|
+
# moved capture is expected when a catalog the page counts has moved, so it
|
|
5
|
+
# reports and never fails.
|
|
6
|
+
set -e
|
|
7
|
+
|
|
8
|
+
if git diff --quiet -- assets/evidence/home; then
|
|
9
|
+
echo "The captured frames match the committed baseline." >>"$GITHUB_STEP_SUMMARY"
|
|
10
|
+
exit 0
|
|
11
|
+
fi
|
|
12
|
+
{
|
|
13
|
+
echo "### The landing page capture moved"
|
|
14
|
+
echo
|
|
15
|
+
echo "These frames differ from the committed baseline. That is expected"
|
|
16
|
+
echo "when a catalog this page counts has moved, and it is not a failure."
|
|
17
|
+
echo
|
|
18
|
+
echo '```'
|
|
19
|
+
git diff --stat -- assets/evidence/home
|
|
20
|
+
echo '```'
|
|
21
|
+
echo
|
|
22
|
+
echo "Download the \`landing-page-capture\` artifact to view them."
|
|
23
|
+
} >>"$GITHUB_STEP_SUMMARY"
|