@erclx/canon 5.40.0 → 5.42.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/README.md +34 -17
- package/claude/.claude-plugin/plugin.json +1 -1
- package/claude/skills/api-design/references/adopted.md +34 -14
- package/claude/skills/auto-ship/REQUIREMENT.md +2 -0
- package/claude/skills/auto-ship/SKILL.md +28 -2
- package/claude/skills/auto-ship/references/draft-mark.md +32 -6
- package/claude/skills/auto-ship/references/failure-recovery.md +15 -13
- package/claude/skills/auto-ship/references/fan-in.md +59 -0
- package/claude/skills/auto-ship/references/tier-failures.md +31 -10
- package/claude/skills/auto-ship/references/ui-checklist.md +9 -4
- package/claude/skills/auto-ship/references/worktree-name.md +9 -3
- package/claude/skills/build-in-slices/references/adopted.md +35 -21
- package/claude/skills/canvas-board/references/canvas.md +17 -6
- package/claude/skills/canvas-board/references/design.md +26 -7
- package/claude/skills/code-craft/references/adopted.md +58 -20
- package/claude/skills/codebase-layout/references/adopted.md +49 -16
- package/claude/skills/codebase-layout/references/frontend.md +11 -4
- package/claude/skills/codebase-layout/references/tests.md +4 -2
- package/claude/skills/context-fold/references/classify.md +10 -15
- package/claude/skills/context-fold/references/completion-report.md +11 -9
- package/claude/skills/context-fold/references/context-refresh.md +26 -9
- package/claude/skills/context-fold/references/unusable-baseline.md +5 -3
- package/claude/skills/create-rule/REQUIREMENT.md +5 -0
- package/claude/skills/create-rule/SKILL.md +9 -1
- package/claude/skills/create-rule/references/checklist.md +26 -0
- package/claude/skills/create-rule/references/rule.md +98 -20
- package/claude/skills/create-skill/SKILL.md +1 -0
- package/claude/skills/create-skill/references/skill-disclosure.md +10 -2
- package/claude/skills/create-skill/references/skill-frontmatter.md +43 -0
- package/claude/skills/create-skill/references/skill-paths.md +7 -4
- package/claude/skills/create-skill/references/skill-practice.md +6 -3
- package/claude/skills/create-skill/references/skill-requirement.md +4 -2
- package/claude/skills/create-skill/references/skill.md +67 -44
- package/claude/skills/decision-escalate/REQUIREMENT.md +1 -1
- package/claude/skills/decision-escalate/SKILL.md +1 -2
- package/claude/skills/deploy-app/references/vercel.md +2 -1
- package/claude/skills/deprecation-migration/references/adopted.md +44 -25
- package/claude/skills/design-taste/references/adopted.md +9 -1
- package/claude/skills/design-taste/references/craft.md +3 -1
- package/claude/skills/design-taste/references/kinds.md +8 -7
- package/claude/skills/design-taste/references/preflight.md +12 -0
- package/claude/skills/design-taste/references/systems.md +7 -6
- package/claude/skills/design-taste/references/tells.md +24 -25
- package/claude/skills/design-taste/references/vocabulary.md +7 -5
- package/claude/skills/document-health/references/axes.md +54 -30
- package/claude/skills/draft-and-pick/references/live-arms.md +2 -2
- package/claude/skills/draft-doc/references/context.md +4 -3
- package/claude/skills/draft-doc/references/docs.md +6 -3
- package/claude/skills/draft-doc/references/readme/agent-facing.md +6 -0
- package/claude/skills/draft-doc/references/readme/application.md +8 -2
- package/claude/skills/draft-doc/references/readme/cli.md +5 -1
- package/claude/skills/draft-doc/references/readme/library.md +4 -0
- package/claude/skills/draft-doc/references/readme/plugin.md +9 -1
- package/claude/skills/draft-doc/references/readme.md +30 -13
- package/claude/skills/draft-doc/references/requirements.md +17 -4
- package/claude/skills/draft-doc/references/wiki-kind.md +20 -10
- package/claude/skills/draft-figure/references/architecture-set.md +7 -3
- package/claude/skills/draft-figure/references/figures.md +8 -6
- package/claude/skills/draft-figure/references/hand-drawn.md +3 -1
- package/claude/skills/draft-figure/references/mermaid-path.md +19 -9
- package/claude/skills/draft-figure/references/mermaid.md +10 -5
- package/claude/skills/draft-ready/references/ready.md +22 -15
- package/claude/skills/git-branch/REQUIREMENT.md +17 -6
- package/claude/skills/git-branch/SKILL.md +63 -7
- package/claude/skills/git-branch/references/branch.md +11 -1
- package/claude/skills/git-branch/references/slug.md +17 -5
- package/claude/skills/git-commit/references/commit.md +8 -0
- package/claude/skills/git-commit/references/versioning.md +23 -17
- package/claude/skills/git-followup/REQUIREMENT.md +1 -1
- package/claude/skills/git-followup/SKILL.md +5 -6
- package/claude/skills/git-issue/references/issue.md +29 -16
- package/claude/skills/git-pr/REQUIREMENT.md +1 -5
- package/claude/skills/git-pr/SKILL.md +11 -22
- package/claude/skills/git-pr/references/final-command.md +21 -8
- package/claude/skills/git-pr/references/labels.md +45 -28
- package/claude/skills/git-pr/references/pr.md +28 -9
- package/claude/skills/git-pr/references/publish.md +42 -28
- package/claude/skills/git-pr/references/task-number.md +20 -8
- package/claude/skills/git-ship/SKILL.md +1 -1
- package/claude/skills/plan-feature/references/batches.md +48 -1
- package/claude/skills/plan-feature/references/plan-lifecycle.md +10 -3
- package/claude/skills/plan-feature/references/plan.md +59 -20
- package/claude/skills/plan-groundwork/references/groundwork-spikes.md +4 -1
- package/claude/skills/plan-groundwork/references/groundwork.md +14 -16
- package/claude/skills/plan-intake/references/intake.md +29 -24
- package/claude/skills/plan-intake-answer/REQUIREMENT.md +1 -1
- package/claude/skills/plan-intake-answer/SKILL.md +1 -2
- package/claude/skills/pr-evidence/REQUIREMENT.md +40 -0
- package/claude/skills/pr-evidence/SKILL.md +53 -0
- package/claude/skills/pr-evidence/references/evidence.md +150 -0
- package/claude/skills/review-address/references/post-review-findings.md +10 -3
- package/claude/skills/review-address/references/rebase-conflicts.md +22 -7
- package/claude/skills/review-address/references/rest-reads.md +3 -1
- package/claude/skills/review-craft/references/adopted.md +35 -18
- package/claude/skills/review-craft/references/security.md +42 -7
- package/claude/skills/review-craft/references/ui.md +23 -8
- package/claude/skills/review-pr/SKILL.md +6 -6
- package/claude/skills/review-pr/references/body-variants.md +29 -9
- package/claude/skills/review-pr/references/close-out.md +20 -5
- package/claude/skills/review-pr/references/key-changes.md +27 -3
- package/claude/skills/review-pr/references/post.md +83 -31
- package/claude/skills/review-pr/references/scope.md +54 -19
- package/claude/skills/review-ui/SKILL.md +2 -0
- package/claude/skills/review-ui/references/close-out.md +49 -0
- package/claude/skills/review-ui/references/driving.md +24 -4
- package/claude/skills/review-ui/references/post.md +43 -13
- package/claude/skills/role-orchestrator/references/orchestrator-cloud-launch.md +67 -17
- package/claude/skills/role-orchestrator/references/orchestrator-dispatch.md +81 -40
- package/claude/skills/role-orchestrator/references/orchestrator-handback.md +52 -15
- package/claude/skills/role-orchestrator/references/orchestrator-handoff.md +48 -26
- package/claude/skills/role-orchestrator/references/orchestrator-inbound.md +12 -13
- package/claude/skills/role-orchestrator/references/orchestrator-launch.md +72 -36
- package/claude/skills/role-orchestrator/references/orchestrator-output.md +12 -4
- package/claude/skills/role-orchestrator/references/orchestrator-parked.md +64 -24
- package/claude/skills/role-orchestrator/references/orchestrator-poll.md +80 -26
- package/claude/skills/role-orchestrator/references/orchestrator-refill.md +41 -18
- package/claude/skills/role-orchestrator/references/orchestrator-resume.md +19 -7
- package/claude/skills/role-orchestrator/references/orchestrator-review-dispatch.md +22 -12
- package/claude/skills/role-orchestrator/references/orchestrator-reviewer-launch.md +15 -6
- package/claude/skills/role-orchestrator/references/orchestrator-sweep.md +25 -7
- package/claude/skills/role-orchestrator/references/orchestrator-watch.md +34 -8
- package/claude/skills/role-orchestrator/scripts/poll.ts +16 -24
- package/claude/skills/role-worker/REQUIREMENT.md +2 -0
- package/claude/skills/role-worker/SKILL.md +17 -0
- package/claude/skills/search-craft/references/adopted.md +18 -6
- package/claude/skills/session-map/references/session.md +26 -7
- package/claude/skills/session-worktree/references/main-root-writes.md +25 -8
- package/claude/skills/systematic-debugging/references/adopted.md +30 -16
- package/claude/skills/target-check/references/domains.md +39 -11
- package/claude/skills/target-setup/references/detect.md +80 -65
- package/claude/skills/target-setup/references/indexes.md +8 -6
- package/claude/skills/task-board/references/board.md +86 -30
- package/claude/skills/task-board/references/decline.md +29 -13
- package/claude/skills/task-board/references/tasks-decline.md +12 -5
- package/claude/skills/task-board/references/tasks.md +65 -33
- package/claude/skills/task-complete/references/archive.md +41 -17
- package/claude/skills/task-complete/references/receipt-sweep.md +23 -9
- package/claude/skills/task-complete/references/unusable-baseline.md +10 -3
- package/claude/skills/teach-workspace/REQUIREMENT.md +1 -1
- package/claude/skills/teach-workspace/SKILL.md +1 -2
- package/claude/skills/teach-workspace/references/glossary.md +6 -2
- package/claude/skills/teach-workspace/references/lesson-build.md +44 -16
- package/claude/skills/teach-workspace/references/lesson-craft.md +12 -7
- package/claude/skills/teach-workspace/references/pedagogy.md +6 -3
- package/claude/skills/teach-workspace/references/promotion-fold.md +17 -11
- package/claude/skills/teach-workspace/references/promotion.md +31 -8
- package/claude/skills/teach-workspace/references/revisit.md +8 -2
- package/claude/skills/teach-workspace/references/teach.md +17 -9
- package/claude/skills/test-craft/references/adopted.md +48 -14
- package/claude/skills/test-craft/references/component.md +7 -4
- package/claude/skills/test-craft/references/e2e.md +25 -7
- package/claude/skills/test-craft/references/unit.md +3 -1
- package/claude/skills/test-first/references/adopted.md +12 -4
- package/claude/skills/ui-checklist/REQUIREMENT.md +1 -1
- package/claude/skills/ui-checklist/SKILL.md +1 -1
- package/claude/skills/video-craft/references/adopted.md +62 -18
- package/claude/skills/write-human/references/adopted.md +21 -8
- package/docs/workflow/parallel-features.md +2 -1
- package/docs/workflow/skill-map.md +2 -1
- package/package.json +1 -1
- package/src/claude/cases/git.ts +4 -0
- package/src/claude/cases/workflow.ts +5 -0
- package/src/commands/pr.ts +174 -37
- package/src/commands/records.ts +11 -3
- package/src/context/shape-gated.ts +1 -0
- package/src/markdown/scope.ts +150 -2
- package/src/pr/frames.ts +53 -9
- package/src/pr/lift.ts +6 -3
- package/src/pr/review-state.ts +182 -0
- package/src/records/validate.ts +1 -0
- package/src/tasks/answers.ts +79 -2
- package/src/tasks/fan-in.ts +176 -0
- package/src/tasks/stack.ts +1 -1
- package/tooling/astro/reference.md +80 -39
- package/tooling/base/reference.md +63 -32
- package/tooling/base/seeds/canon/context/ci.md +7 -15
- package/tooling/base/seeds/canon/context/development.md +14 -14
- package/tooling/claude/reference.md +40 -22
- package/tooling/cloudflare/reference.md +31 -12
- package/tooling/go/reference.md +47 -23
- package/tooling/nextjs/reference.md +52 -19
- package/tooling/php/reference.md +35 -16
- package/tooling/python/reference.md +47 -30
- package/tooling/shell/reference.md +6 -5
- package/tooling/vite-react/reference.md +49 -21
- package/tooling/web/reference.md +130 -70
- package/claude/skills/git-pr/references/evidence.md +0 -124
|
@@ -4,50 +4,83 @@
|
|
|
4
4
|
|
|
5
5
|
## Overview
|
|
6
6
|
|
|
7
|
-
The nextjs stack covers Next.js + TypeScript projects using the App Router. It ships golden configs for `next.config.ts`, `vitest.config.ts
|
|
7
|
+
The nextjs stack covers Next.js + TypeScript projects using the App Router. It ships golden configs for `next.config.ts`, `vitest.config.ts`, `playwright.config.ts` (build-then-preview), and an `.oxlintrc.json` that replaces the web layer's.
|
|
8
|
+
|
|
9
|
+
Shared web tooling (oxlint base, screenshot template, VS Code, CI, verify script) comes from the `web` layer.
|
|
8
10
|
|
|
9
11
|
## Scaffold checklist
|
|
10
12
|
|
|
11
|
-
1. Scaffold with `bunx create-next-app@latest <name> --typescript --tailwind --no-linter --app --src-dir --import-alias "@/*" --use-bun --skip-install --disable-git --no-agents-md --yes`.
|
|
12
|
-
2. Install web tooling
|
|
13
|
-
3. Install nextjs configs
|
|
13
|
+
1. Scaffold with `bunx create-next-app@latest <name> --typescript --tailwind --no-linter --app --src-dir --import-alias "@/*" --use-bun --skip-install --disable-git --no-agents-md --yes`.
|
|
14
|
+
2. Install web tooling with `canon tooling sync web . --write`.
|
|
15
|
+
3. Install nextjs configs with `canon tooling sync nextjs . --write`.
|
|
14
16
|
4. Extend the `ci` and `development` context entries under `canon/context/` per the web reference's extend sections plus the nextjs rows below.
|
|
15
17
|
5. Run `bun run lint:fix`, then `bun run format`, then `bun run check`.
|
|
16
18
|
|
|
19
|
+
### Scaffold flags
|
|
20
|
+
|
|
21
|
+
Two flags in step 1 keep the scaffold from writing what the toolkit already owns.
|
|
22
|
+
|
|
23
|
+
- `--no-agents-md` skips the scaffold-time `AGENTS.md` and `CLAUDE.md` write, which would duplicate the root `CLAUDE.md`.
|
|
24
|
+
- `--no-linter` skips the scaffold's `eslint.config.mjs` and `lint` script. It is accepted though `--help` lists only `--eslint` and `--biome`.
|
|
25
|
+
|
|
17
26
|
## What ships as golden configs
|
|
18
27
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
28
|
+
### next.config.ts
|
|
29
|
+
|
|
30
|
+
Two settings keep Next from fighting the checkout.
|
|
31
|
+
|
|
32
|
+
- `agentRules: false` stops Next regenerating `AGENTS.md` and `CLAUDE.md` on every run, which would compete with the root `CLAUDE.md`.
|
|
33
|
+
- `turbopack.root: import.meta.dirname` pins the workspace root, silencing Next's multi-lockfile inference warning in a checkout with more than one lockfile above the project, a worktree included.
|
|
34
|
+
|
|
35
|
+
### Test configs
|
|
36
|
+
|
|
37
|
+
Both test configs differ from the other web stacks.
|
|
38
|
+
|
|
39
|
+
- `vitest.config.ts` is a plain `defineConfig`, since Next has no Vite config to merge from.
|
|
40
|
+
- It sets jsdom, globals, the setup file, `passWithNoTests: true`, v8 coverage, and `.next/**` in test excludes.
|
|
41
|
+
- `playwright.config.ts` runs all browsers, with `webServer` running `bun run build && bun run preview` on port `3000` plus `WORKTREE_PORT_OFFSET` and `reuseExistingServer: false`.
|
|
42
|
+
- `DIST_PREBUILT` drops the `build` half, matching the astro stack's flag.
|
|
43
|
+
|
|
44
|
+
### Lint config
|
|
45
|
+
|
|
46
|
+
`.oxlintrc.json` replaces the web layer's whole file, since oxlint reads one config. It adds `.next` and `next-env.d.ts` to `ignorePatterns`, and turns two rules off for `src/app/**`.
|
|
47
|
+
|
|
48
|
+
- `react/only-export-components` is `off`, since route and layout files export non-component values the rule would flag.
|
|
49
|
+
- `check-file/folder-naming-convention` is `off`, since App Router's bracket, paren, and at-sign folders (dynamic segments, route groups, parallel slots) fail `KEBAB_CASE`.
|
|
23
50
|
|
|
24
51
|
## Port
|
|
25
52
|
|
|
26
|
-
Next has no config-file port hook, unlike `astro.config.mjs`
|
|
53
|
+
Next has no config-file port hook, unlike `server.port` in `astro.config.mjs` or `vite.config.ts`. The `${base} + WORKTREE_PORT_OFFSET` formula is therefore computed twice.
|
|
54
|
+
|
|
55
|
+
- `playwright.config.ts` computes it as a JS expression.
|
|
56
|
+
- `[scripts.override]` computes it as shell arithmetic for `dev` and `preview`, passed to `next`'s own `--port` flag.
|
|
57
|
+
- The default port is `3000`, Next's own.
|
|
27
58
|
|
|
28
59
|
## Typecheck
|
|
29
60
|
|
|
30
|
-
`typecheck` runs `next typegen && tsc --noEmit`. The App Router's route-level types (`LayoutProps`, `PageProps`) are generated into `.next/types/`, gitignored and absent from a fresh checkout,
|
|
61
|
+
`typecheck` runs `next typegen && tsc --noEmit`. The App Router's route-level types (`LayoutProps`, `PageProps`) are generated into `.next/types/`, which is gitignored and absent from a fresh checkout. Without the typegen step first, `tsc` fails on them unresolved.
|
|
31
62
|
|
|
32
|
-
## No golden
|
|
63
|
+
## No golden tsconfig
|
|
33
64
|
|
|
34
|
-
`create-next-app`'s
|
|
65
|
+
`create-next-app`'s default `tsconfig.json` needs no changes beyond project-specific path aliases, so a golden copy would ship nothing the scaffold does not already write.
|
|
35
66
|
|
|
36
67
|
## Gitignore (extend)
|
|
37
68
|
|
|
38
|
-
`[gitignore]` groups
|
|
69
|
+
These `[gitignore]` groups mirror the manifest.
|
|
39
70
|
|
|
40
71
|
- `"# Next" = [".next/"]`
|
|
41
72
|
|
|
42
73
|
## Development docs (extend)
|
|
43
74
|
|
|
44
|
-
Append to the `## Scripts` table
|
|
75
|
+
Append these rows to the `## Scripts` table.
|
|
45
76
|
|
|
46
|
-
|
|
|
47
|
-
|
|
|
48
|
-
| `bun run
|
|
49
|
-
| `bun run
|
|
77
|
+
| Command | Purpose |
|
|
78
|
+
| ------------------- | -------------------------------------------------------------- |
|
|
79
|
+
| `bun run dev` | Start the Next dev server on 3000 plus this worktree's offset. |
|
|
80
|
+
| `bun run build` | Build the production bundle. |
|
|
81
|
+
| `bun run preview` | Serve the built bundle on 3000 plus the worktree offset. |
|
|
82
|
+
| `bun run typecheck` | Run `next typegen` then `tsc --noEmit`. |
|
|
50
83
|
|
|
51
84
|
## CI docs (extend)
|
|
52
85
|
|
|
53
|
-
In `canon/context/development/ci.md`, the Typecheck row
|
|
86
|
+
In `canon/context/development/ci.md`, the Typecheck row asserts `` `next typegen && tsc --noEmit` passes ``. <!-- audit-ignore-citations: canon/context/development/ci.md -->
|
package/tooling/php/reference.md
CHANGED
|
@@ -9,17 +9,19 @@ The php stack covers Composer projects on PHP 8.3 or later, formatted by PHP CS
|
|
|
9
9
|
## Scaffold checklist
|
|
10
10
|
|
|
11
11
|
1. Scaffold with `composer init -n --name <vendor>/<name> --autoload src/`. The package name and namespace are the project's own identity, so this stack never ships a `composer.json`.
|
|
12
|
-
2. Seed `package.json` so the base layer's bun-side tools (husky, oxfmt, commitlint) have a target to install into
|
|
13
|
-
3. Install base tooling
|
|
14
|
-
4. Install php tooling
|
|
15
|
-
5. Install the dev tools
|
|
12
|
+
2. Seed `package.json` with `bun init -y`, so the base layer's bun-side tools (husky, oxfmt, commitlint) have a target to install into.
|
|
13
|
+
3. Install base tooling with `canon tooling sync base . --write`.
|
|
14
|
+
4. Install php tooling with `canon tooling sync php . --write`.
|
|
15
|
+
5. Install the dev tools with `composer require --dev friendsofphp/php-cs-fixer phpstan/phpstan phpunit/phpunit`. This stays manual, since manifest injection runs `bun add -D`.
|
|
16
16
|
6. Run `bun run lint:fix`, then `bun run format`, then `bun run check`.
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
### Requirements
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
Use PHP 8.3 or later, since PHPUnit 12 requires it.
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
- Keep both `src/` and `tests/` in place, since all three tools read both paths and fail when either is missing.
|
|
23
|
+
- The scaffold creates `src/`, but git does not commit an empty folder. A fresh clone with no source fails `lint` and `typecheck` until the first class lands there.
|
|
24
|
+
- The stack ships `tests/SmokeTest.php` as a copy-once seed, so `bun run check` passes on a fresh scaffold. Delete or replace it with real tests.
|
|
23
25
|
|
|
24
26
|
## PHP CS Fixer
|
|
25
27
|
|
|
@@ -41,10 +43,21 @@ The php stack also ships `tests/SmokeTest.php` as a copy-once seed, so `bun run
|
|
|
41
43
|
|
|
42
44
|
## verify.json
|
|
43
45
|
|
|
46
|
+
### Phases
|
|
47
|
+
|
|
48
|
+
The php phase list probes its tools and holds one precondition.
|
|
49
|
+
|
|
44
50
|
- Probe `php` and `composer` first.
|
|
45
51
|
- Hold a precondition on `vendor/bin/phpunit`, so the run stops and names `composer install` when it is missing.
|
|
46
|
-
- Require Typecheck (`phpstan analyse`), Lint (`php-cs-fixer check`), and Unit tests (`phpunit --testdox`).
|
|
47
|
-
-
|
|
52
|
+
- Require Typecheck (`phpstan analyse`), Lint (`php-cs-fixer check`), and Unit tests (`phpunit --testdox`).
|
|
53
|
+
- Base's runner adds its own four phases where the folder declares their scripts, then the markdown bans stage.
|
|
54
|
+
|
|
55
|
+
### Prepare
|
|
56
|
+
|
|
57
|
+
The manifest prepares a scaffold that lacks a `package.json`.
|
|
58
|
+
|
|
59
|
+
- The manifest's `[verify] prepare` runs checklist steps 2 and 5 for `canon tooling verify php`, being `bun init -y` and the `composer require --dev` line.
|
|
60
|
+
- The scaffold writes no `package.json`, and a verify that reaches its end with none fails.
|
|
48
61
|
|
|
49
62
|
## Gitignore
|
|
50
63
|
|
|
@@ -63,14 +76,20 @@ The php stack also ships `tests/SmokeTest.php` as a copy-once seed, so `bun run
|
|
|
63
76
|
|
|
64
77
|
## Development docs (extend)
|
|
65
78
|
|
|
66
|
-
Append to the `## Scripts` table
|
|
79
|
+
Append these rows to the `## Scripts` table.
|
|
67
80
|
|
|
68
|
-
|
|
|
69
|
-
|
|
|
70
|
-
| `bun run
|
|
71
|
-
| `bun run
|
|
72
|
-
| `bun run
|
|
81
|
+
| Command | Purpose |
|
|
82
|
+
| ------------------- | ------------------------------------------- |
|
|
83
|
+
| `bun run lint` | Run `php-cs-fixer check --diff`. |
|
|
84
|
+
| `bun run lint:fix` | Auto-fix with `php-cs-fixer fix`. |
|
|
85
|
+
| `bun run typecheck` | Run `phpstan analyse`. |
|
|
86
|
+
| `bun run test` | Run `phpunit`. |
|
|
87
|
+
| `bun run test:run` | Run `phpunit --testdox` (used by `verify`). |
|
|
73
88
|
|
|
74
89
|
## CI docs (extend)
|
|
75
90
|
|
|
76
|
-
In `canon/context/development/ci.md`,
|
|
91
|
+
In `canon/context/development/ci.md`, add or change three rows. <!-- audit-ignore-citations: canon/context/development/ci.md -->
|
|
92
|
+
|
|
93
|
+
- The Typecheck row asserts `` `phpstan analyse` passes ``.
|
|
94
|
+
- A Lint row asserts `` `php-cs-fixer check` passes ``.
|
|
95
|
+
- A Tests row asserts `` `phpunit` exits 0 ``.
|
|
@@ -6,60 +6,77 @@
|
|
|
6
6
|
|
|
7
7
|
The python stack covers Python 3.13+ projects managed with `uv`. It ships golden sidecar configs for `ruff`, `mypy`, `pytest`, and `coverage`, plus a `.python-version` pin and a python phase list for base's verify runner. Framework adapters layer on top with their own deps and configs.
|
|
8
8
|
|
|
9
|
-
Configs ship as sidecar files (`ruff.toml`, `mypy.ini`, `pytest.ini`, `.coveragerc`) rather than `[tool.*]` sections in `pyproject.toml`. Sync overwrites configs on every run, so
|
|
9
|
+
Configs ship as sidecar files (`ruff.toml`, `mypy.ini`, `pytest.ini`, `.coveragerc`) rather than `[tool.*]` sections in `pyproject.toml`. Sync overwrites configs on every run, so sidecars avoid stomping the user-owned `[project]` block.
|
|
10
10
|
|
|
11
11
|
## Scaffold checklist
|
|
12
12
|
|
|
13
|
-
1. Scaffold with `uv init --package <name>`. This creates `pyproject.toml` with a `uv_build` backend
|
|
14
|
-
2. Seed `package.json` so the base layer's bun-side tools (husky, oxfmt, commitlint) have a target
|
|
15
|
-
3. Install base tooling
|
|
16
|
-
4. Install python tooling
|
|
17
|
-
5. Install
|
|
18
|
-
6. Sync the lockfile and create the venv
|
|
13
|
+
1. Scaffold with `uv init --package <name>`. This creates `pyproject.toml` with a `uv_build` backend and `src/<name with underscores>/__init__.py` holding an annotated `def main() -> None:`.
|
|
14
|
+
2. Seed `package.json` with `bun init -y`, so the base layer's bun-side tools (husky, oxfmt, commitlint) have a target. Without it the sync skips the dep install.
|
|
15
|
+
3. Install base tooling with `canon tooling sync base . --write`.
|
|
16
|
+
4. Install python tooling with `canon tooling sync python . --write`.
|
|
17
|
+
5. Install the deps with `uv add --dev ruff mypy pytest pytest-cov`. This stays manual, since the manifest injector hardcodes `bun add -D`.
|
|
18
|
+
6. Sync the lockfile and create the venv with `uv sync`.
|
|
19
19
|
7. Run `bun run lint:fix`, then `bun run format`, then `bun run check`.
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
### What the scaffold gives
|
|
22
|
+
|
|
23
|
+
Step 1 puts source under `src/`, where `mypy.ini`, `pytest.ini`, and `.coveragerc` look for it. `uv init` also pins `.python-version` to 3.14 and defaults `requires-python` to `>=3.14`, which matches the pin this stack ships.
|
|
24
|
+
|
|
25
|
+
The stack ships `tests/test_smoke.py` as a copy-once seed. `pytest` then collects at least one test on first run, so `bun run test:run` exits 0 instead of the empty-collection exit code 5. Delete or replace it with real tests.
|
|
22
26
|
|
|
23
27
|
## What ships as golden configs
|
|
24
28
|
|
|
25
|
-
- `ruff.toml
|
|
26
|
-
- `mypy.ini
|
|
27
|
-
- `pytest.ini
|
|
28
|
-
- `.coveragerc
|
|
29
|
-
- `.python-version
|
|
30
|
-
|
|
29
|
+
- `ruff.toml` sets line length 88, target `py314`, strict lint rules (`E`, `W`, `F`, `I`, `B`, `C4`, `UP`, `N`), single-quote format, and banned relative imports.
|
|
30
|
+
- `mypy.ini` sets strict mode, `python_version = 3.14`, and `mypy_path = src`, and excludes `tests/` and `docs/`.
|
|
31
|
+
- `pytest.ini` puts tests under `tests/` and source under `src/`.
|
|
32
|
+
- `.coveragerc` measures branch coverage on `src/` with the html report under `.coverage_cache/html`.
|
|
33
|
+
- `.python-version` is pinned to `3.14` to match `uv init` defaults.
|
|
34
|
+
|
|
35
|
+
### Verify list
|
|
36
|
+
|
|
37
|
+
`scripts/verify.json` requires Typecheck (`mypy`), Lint (`ruff check && ruff format --check`), and Tests (`pytest -v`) on top of base's runner. It stops naming `uv` when `uv` is not on PATH, and the markdown bans phase runs as it does everywhere.
|
|
31
38
|
|
|
32
39
|
## Hybrid project shape
|
|
33
40
|
|
|
34
|
-
A python project synced with this stack
|
|
41
|
+
A python project synced with this stack holds both `package.json` from base and `pyproject.toml` from `uv init`. Base brings oxfmt, commitlint, and husky for non-Python files, and `node_modules/` and `.venv/` coexist at the project root. That gives Python projects the toolkit's cross-cutting tools without forking the base stack.
|
|
35
42
|
|
|
36
43
|
## Dependencies
|
|
37
44
|
|
|
38
|
-
The manifest declares no `[dependencies.dev]
|
|
45
|
+
The manifest declares no `[dependencies.dev]`, because manifest injection calls `bun add -D` for any declared deps, which fails for Python packages. Framework adapters that need Python deps require the injector to branch on `runtime`, or to detect `pyproject.toml` and call `uv add --dev`.
|
|
39
46
|
|
|
40
47
|
## Verify command
|
|
41
48
|
|
|
42
|
-
`canon tooling verify python` runs the manifest's `[verify] prepare` before Sync
|
|
49
|
+
`canon tooling verify python` runs the manifest's `[verify] prepare` before Sync. That covers checklist steps 2, 5, and 6, being `bun init -y`, `uv add --dev ruff mypy pytest pytest-cov`, and `uv sync`.
|
|
50
|
+
|
|
51
|
+
- `uv init` writes no `package.json`, and a verify that reaches its end with none fails, so the prepare is what lets `bun run lint:fix`, `bun run format`, and `bun run check` run at all.
|
|
52
|
+
- Python's `verify.json` requires the `lint`, `typecheck`, and `test:run` scripts that delegate to `uv run`, so the run needs `uv` on the machine and a network for the installs.
|
|
53
|
+
- The end-to-end test and screenshot phases are gated on `package.json` script keys python does not declare, so they skip.
|
|
43
54
|
|
|
44
55
|
## Anti-patterns
|
|
45
56
|
|
|
46
|
-
- Do not use `pip` directly. Always go through `uv add
|
|
47
|
-
- Do not move `[tool.ruff]`, `[tool.mypy]`, `[tool.pytest.ini_options]`, or `[tool.coverage.*]` into `pyproject.toml`. Sync owns the
|
|
48
|
-
- Do not pin Python via `[project] requires-python` and `.python-version` independently. Treat `.python-version` as the source of truth and let `requires-python`
|
|
49
|
-
- Do not add `commitizen` for conventional commits. The base stack already ships commitlint + husky
|
|
50
|
-
- Do not ship a `Dockerfile` or `mkdocs` config under tooling. Those are framework or deployment choices and belong in the project
|
|
57
|
+
- Do not use `pip` directly. Always go through `uv add`, `uv sync`, or `uv run`.
|
|
58
|
+
- Do not move `[tool.ruff]`, `[tool.mypy]`, `[tool.pytest.ini_options]`, or `[tool.coverage.*]` into `pyproject.toml`. Sync owns the sidecars, and tool sections there cause silent precedence bugs.
|
|
59
|
+
- Do not pin Python via `[project] requires-python` and `.python-version` independently. Treat `.python-version` as the source of truth and let `requires-python` track it.
|
|
60
|
+
- Do not add `commitizen` for conventional commits. The base stack already ships commitlint + husky, and two enforcers is one too many.
|
|
61
|
+
- Do not ship a `Dockerfile` or `mkdocs` config under tooling. Those are framework or deployment choices and belong in the project or a future adapter stack.
|
|
51
62
|
|
|
52
63
|
## Development docs (extend)
|
|
53
64
|
|
|
54
|
-
Append to the `## Scripts` table
|
|
65
|
+
Append these rows to the `## Scripts` table.
|
|
55
66
|
|
|
56
|
-
|
|
|
57
|
-
|
|
|
58
|
-
| `bun run
|
|
59
|
-
| `bun run
|
|
60
|
-
| `bun run
|
|
61
|
-
| `bun run test
|
|
67
|
+
| Command | Purpose |
|
|
68
|
+
| ------------------- | ---------------------------------------------------- |
|
|
69
|
+
| `bun run lint` | Run `ruff check` and `ruff format --check`. |
|
|
70
|
+
| `bun run lint:fix` | Auto-fix with `ruff check --fix` then `ruff format`. |
|
|
71
|
+
| `bun run typecheck` | Run `mypy` in strict mode. |
|
|
72
|
+
| `bun run test` | Run `pytest`. |
|
|
73
|
+
| `bun run test:run` | Run `pytest -v` (used by `verify`). |
|
|
74
|
+
| `bun run test:cov` | Run `pytest` with branch coverage and HTML report. |
|
|
62
75
|
|
|
63
76
|
## CI docs (extend)
|
|
64
77
|
|
|
65
|
-
In `canon/context/development/ci.md`,
|
|
78
|
+
In `canon/context/development/ci.md`, add or change three rows. <!-- audit-ignore-citations: canon/context/development/ci.md -->
|
|
79
|
+
|
|
80
|
+
- The Typecheck row asserts `` `mypy .` passes ``.
|
|
81
|
+
- A Lint row asserts `` `ruff check` and `ruff format --check` pass ``.
|
|
82
|
+
- A Tests row asserts `` `pytest` exits 0 ``.
|
|
@@ -6,13 +6,13 @@ The shell stack is an add-on that formats and lints the shell scripts a project
|
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
9
|
-
- Install `shfmt` and `shellcheck` by hand
|
|
9
|
+
- Install `shfmt` and `shellcheck` by hand with `sudo apt-get install shfmt shellcheck` or `brew install shfmt shellcheck`. Injection runs only `bun add -D`, and neither ships through the registry.
|
|
10
10
|
- `scripts/verify.ts` probes both before the `Shell` phase and names the install command when one is missing, rather than letting `find` report a missing executable.
|
|
11
11
|
|
|
12
12
|
## shfmt
|
|
13
13
|
|
|
14
14
|
- Indent with 2 spaces, set through `--indent 2` on every call.
|
|
15
|
-
- `.editorconfig` carries an `[*.sh]` block with `indent_style = space` and `indent_size = 2`, so the editor and shfmt agree. Dropping
|
|
15
|
+
- `.editorconfig` carries an `[*.sh]` block with `indent_style = space` and `indent_size = 2`, so the editor and shfmt agree. Dropping it because shfmt sets indentation produces spurious diffs.
|
|
16
16
|
|
|
17
17
|
## shellcheck
|
|
18
18
|
|
|
@@ -27,16 +27,17 @@ The shell stack is an add-on that formats and lints the shell scripts a project
|
|
|
27
27
|
|
|
28
28
|
## Verify
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
`scripts/verify.ts` runs `check:shell` in its `Shell` phase wherever `package.json` declares it, between the format check and the unit tests. No stack's `scripts/verify.json` requires it, so a folder that never synced this stack skips the phase.
|
|
31
31
|
|
|
32
32
|
## lint-staged
|
|
33
33
|
|
|
34
|
-
- `.lintstagedrc` is a base seed this stack cannot reach once written. Add a `**/*.sh` entry by hand
|
|
34
|
+
- `.lintstagedrc` is a base seed this stack cannot reach once written. Add a `**/*.sh` entry by hand to run the checks on commit.
|
|
35
|
+
- That entry runs `shfmt --write --indent 2` then `shellcheck --severity=warning`.
|
|
35
36
|
- Do NOT copy that glob into a `package.json` script. lint-staged expands its own globs and passes matched files as arguments, which a bare shell script does not.
|
|
36
37
|
|
|
37
38
|
## CI
|
|
38
39
|
|
|
39
|
-
|
|
40
|
+
`.github/workflows/shell.yml` runs on pull requests targeting `main` and on `workflow_dispatch`. Its steps are checkout, setup Bun, `bun install --frozen-lockfile`, installing both tools through apt, then `check:shell`.
|
|
40
41
|
|
|
41
42
|
## CLI
|
|
42
43
|
|
|
@@ -4,44 +4,72 @@
|
|
|
4
4
|
|
|
5
5
|
## Overview
|
|
6
6
|
|
|
7
|
-
The vite-react stack covers Vite + React + TypeScript
|
|
7
|
+
The vite-react stack covers Vite + React + TypeScript web apps and Chrome extensions. It ships golden configs for `vite.config.ts`, `vitest.config.ts`, `playwright.config.ts`, and a unified `tsconfig.json` with an `@/` path alias. Shared web tooling (oxlint, screenshot template, VS Code, CI, verify script) comes from the `web` layer.
|
|
8
8
|
|
|
9
9
|
## Scaffold checklist
|
|
10
10
|
|
|
11
11
|
1. Scaffold with `bunx create-vite@latest <name> --template react-ts` (web apps) or `bunx create-crxjs@latest` (Chrome extensions).
|
|
12
|
-
2. Install base and web tooling
|
|
13
|
-
3. Install vite-react deps and configs
|
|
12
|
+
2. Install base and web tooling with `canon tooling sync web . --write`.
|
|
13
|
+
3. Install vite-react deps and configs with `canon tooling sync vite-react . --write`.
|
|
14
14
|
4. Extend the `ci` and `development` context entries under `canon/context/` per the web reference's extend sections plus the vite-react rows below.
|
|
15
15
|
5. Run `bun run lint:fix`, then `bun run format`, then `bun run check`.
|
|
16
16
|
|
|
17
17
|
## What ships as golden configs
|
|
18
18
|
|
|
19
|
-
- `vite.config.ts
|
|
20
|
-
-
|
|
21
|
-
- `
|
|
22
|
-
- `
|
|
19
|
+
- `vite.config.ts` adds `@vitejs/plugin-react`, `@tailwindcss/vite`, the `@` alias to `./src`, and `VITE_BASE_URL` for the base path.
|
|
20
|
+
- It serves dev on port `5173` and preview on `4173`, each plus `WORKTREE_PORT_OFFSET`, both with `strictPort`.
|
|
21
|
+
- `vitest.config.ts` merges from `vite.config.ts`, imported with its `.ts` extension, which Vite 8 requires. It sets jsdom, globals, the setup file, `passWithNoTests: true`, and v8 coverage.
|
|
22
|
+
- `playwright.config.ts` runs all browsers, with `webServer` on `bun run dev` at port `5173` plus `WORKTREE_PORT_OFFSET`, `reuseExistingServer: false`, and trace under `use`.
|
|
23
|
+
- `tsconfig.json` is unified, with `noEmit: true`, `skipLibCheck: true`, `@/` paths, and `vitest/globals` and `@testing-library/jest-dom/vitest` in types.
|
|
23
24
|
|
|
24
25
|
## Chrome extension variant
|
|
25
26
|
|
|
26
|
-
When scaffolding a Chrome extension, override the installed golden configs
|
|
27
|
+
When scaffolding a Chrome extension, override the installed golden configs.
|
|
27
28
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
- `
|
|
33
|
-
- `
|
|
34
|
-
|
|
29
|
+
### Build config
|
|
30
|
+
|
|
31
|
+
The crxjs plugin replaces the plain React build.
|
|
32
|
+
|
|
33
|
+
- `vite.config.ts` uses `crx({ manifest })` and `zip()` from `@crxjs/vite-plugin` instead of `react()` alone. Drop `VITE_BASE_URL`.
|
|
34
|
+
- Keep the derived `server.port` and `server.strictPort: true`, set `server.hmr.clientPort` to the same derived value, and add `chrome-extension://` to CORS origins.
|
|
35
|
+
|
|
36
|
+
### Test configs
|
|
37
|
+
|
|
38
|
+
The plugin also changes how Vitest and Playwright run.
|
|
39
|
+
|
|
40
|
+
- `vitest.config.ts` uses a standalone `defineConfig` with no `mergeConfig`, since the crxjs plugin breaks Vitest. Declare `@vitejs/plugin-react` and `@tailwindcss/vite` directly.
|
|
41
|
+
- It also adds `**/release/**` to excludes, and `manifest.config.ts` and `**/*.d.ts` to coverage excludes.
|
|
42
|
+
- `playwright.config.ts` is chromium-only, since Firefox and WebKit cannot run extensions.
|
|
43
|
+
- It uses the bundled `chromium` channel with no `baseURL` or `webServer`, and tests load the built extension from `dist/`.
|
|
44
|
+
|
|
45
|
+
### Fixtures and manifest
|
|
46
|
+
|
|
47
|
+
The extension needs a fixture file and a manifest config.
|
|
48
|
+
|
|
49
|
+
- `e2e/fixtures.ts` extends Playwright's base `test` with `context`, a persistent context loading the extension from `dist/`, and `extensionId`, extracted from the service worker URL.
|
|
50
|
+
- Rename `use` to `apply` in that file to avoid oxlint's `react/rules-of-hooks`. `waitForEvent('serviceworker')` blocks until the MV3 service worker registers.
|
|
51
|
+
- `manifest.config.ts` uses `defineManifest` from `@crxjs/vite-plugin` and reads `name` and `version` from `package.json`.
|
|
52
|
+
- Its entry points are `src/popup/index.html`, `src/sidepanel/index.html`, `src/background/index.ts`, and `src/content/main.tsx`.
|
|
53
|
+
- Its permissions are `sidePanel`, `contentSettings`, and `storage`, with icon `public/logo.png` at size 48.
|
|
54
|
+
|
|
55
|
+
### Scripts and ignores
|
|
56
|
+
|
|
57
|
+
The extension build changes one script and adds ignores.
|
|
58
|
+
|
|
59
|
+
- The `screenshot` script is `bun run build && bun e2e/screenshot.ts`, with no preview server.
|
|
60
|
+
- Add `*.crx`, `*.pem`, and `release/` to gitignore.
|
|
35
61
|
|
|
36
62
|
## Development docs (extend)
|
|
37
63
|
|
|
38
|
-
Append to the `## Scripts` table
|
|
64
|
+
Append these rows to the `## Scripts` table.
|
|
39
65
|
|
|
40
|
-
|
|
|
41
|
-
|
|
|
42
|
-
| `bun run
|
|
43
|
-
| `bun run
|
|
66
|
+
| Command | Purpose |
|
|
67
|
+
| ------------------- | -------------------------------------------------------------- |
|
|
68
|
+
| `bun run dev` | Start the Vite dev server on 5173 plus this worktree's offset. |
|
|
69
|
+
| `bun run build` | Typecheck then build the production bundle. |
|
|
70
|
+
| `bun run preview` | Serve the built bundle locally. |
|
|
71
|
+
| `bun run typecheck` | Run `tsc --noEmit`. |
|
|
44
72
|
|
|
45
73
|
## CI docs (extend)
|
|
46
74
|
|
|
47
|
-
In `canon/context/development/ci.md`, the Typecheck row
|
|
75
|
+
In `canon/context/development/ci.md`, the Typecheck row asserts `` `tsc --noEmit` passes ``. <!-- audit-ignore-citations: canon/context/development/ci.md -->
|