Skip to content

Commit fe248c2

Browse files
kovermierclaude
andcommitted
Merge origin/main (e55afd7) into fix/366-hook-pnp
Keeps every CHANGELOG entry; the #366 scope note now points at #380 for the CI workflow. Co-Authored-By: Claude Opus 5.5 <[email protected]>
2 parents 9d0f5a3 + e55afd7 commit fe248c2

31 files changed

Lines changed: 638 additions & 122 deletions

‎.ai/.adf.lock‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"core.adf": "3cdf240b0742dd97"
2+
"core.adf": "7df256b278aa77ca"
33
}

‎.ai/adf-dev.adf‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ ADF: 0.1
1414
- Hash algo: crypto.createHash('sha256').update(content).digest('hex').slice(0, 16)
1515
- Sync: loadLockFile / hashSource in packages/cli/src/commands/adf.ts
1616

17-
⚠ CONSTRAINTS [load-bearing]:
17+
⚠️ CONSTRAINTS [load-bearing]:
1818
- ADF package has zero runtime dependencies
1919
- Parser is tolerant (handles messy LLM output); formatter is strict (canonical emission)
2020
- Patcher is immutable (deep clone via JSON.parse/stringify; original never mutated)

‎.ai/analysis.adf‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ADF: 0.1
99
- CLI command handlers in packages/cli/src/commands/blast.ts and surface.ts
1010
- Feed governance signals: blast radius ≥20 files → CROSS_CUTTING warning
1111

12-
⚠ CONSTRAINTS [load-bearing]:
12+
⚠️ CONSTRAINTS [load-bearing]:
1313
- blast and surface commands must support --format json for stable machine output
1414
- blast: --root and --depth flags must be in VALUE_FLAGS to avoid positional sweep
1515
- blast must handle ESM .js → .ts rewrite, tsconfig extends chains, src/index.* fallback

‎.ai/classifier.adf‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ ADF: 0.1
2020
- --auto-route should explain its reasoning (which signals fired, confidence level)
2121
- --dry-run must preview the full routing decision before writing
2222

23-
⚠ CONSTRAINTS [load-bearing]:
23+
⚠️ CONSTRAINTS [load-bearing]:
2424
- Deterministic heuristics first — do not require LLM inference for classification
2525
- Every new command must support --dry-run --format json
2626
- Classifier decisions must be explainable: which patterns matched, why this section, why this weight

‎.ai/core.adf‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ ADF: 0.1
1414
- This is a **public infrastructure package** governed by the Stackbilt OSS Infrastructure Package Update Policy.
1515
- Full policy: `stackbilt_llc/policies/oss-infrastructure-update-policy.md`
1616

17-
⚠ CONSTRAINTS [load-bearing]:
17+
⚠️ CONSTRAINTS [load-bearing]:
1818
- TypeScript strict mode, ES2022 target, CommonJS output
1919
- 2-space indent, semicolons, single quotes, kebab-case filenames
2020
- Pure functions in library packages; side effects only in CLI command handlers

‎.ai/governance.adf‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ADF: 0.1
88
- Trailer parsing extracts Governed-By, Resolves-Request from commit messages
99
- Risk assessment scores HIGH/MEDIUM/LOW based on file path patterns
1010

11-
⚠ CONSTRAINTS [load-bearing]:
11+
⚠️ CONSTRAINTS [load-bearing]:
1212
- validate, drift, audit commands must support --ci and --format json
1313
- --ci mode: exit 1 on policy violation, exit 0 on pass
1414
- validate exposes policyOffenders and riskOffenders in evidence

‎.ai/typed-data-access.adf‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ ADF: 0.1
1717
- billing_critical — writable only by the owning service plus its designated payment-webhook handler; never leaves the owning service boundary even via RPC (e.g., subscription, invoice)
1818
- secrets — never leaves the owning service boundary under any circumstance (e.g., api_key)
1919

20-
⚠ CONSTRAINTS [load-bearing]:
20+
⚠️ CONSTRAINTS [load-bearing]:
2121
- New code referencing a business concept MUST check the canonical registry first; terms not in the registry or its aliases MUST be added before the code lands
2222
- Non-owning services reading or writing `cross_service_rpc` concepts MUST use the declared accessor — raw storage access to another service's table is a violation
2323
- `pii_scoped` access requires an audit-log entry at the call site — no silent reads

‎.github/dependabot.yml‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,27 @@ updates:
1111
commit-message:
1212
prefix: "chore(deps):"
1313

14+
# Pinned SBOM generator used by the Supply Chain workflow (#368). Version
15+
# updates cover @cyclonedx/cdxgen only: Dependabot does not update the
16+
# `overrides` entry for undici in .github/sbom/package.json. When a cdxgen
17+
# bump lands, check whether its own undici is fixed and bump or drop the
18+
# override by hand (the exact pin would otherwise hold undici at 7.29.1).
19+
- package-ecosystem: "npm"
20+
directory: "/.github/sbom"
21+
schedule:
22+
interval: "weekly"
23+
day: "monday"
24+
open-pull-requests-limit: 5
25+
labels:
26+
- "dependencies"
27+
- "ci"
28+
commit-message:
29+
prefix: "chore(ci):"
30+
groups:
31+
sbom-tooling:
32+
patterns:
33+
- "*"
34+
1435
- package-ecosystem: "github-actions"
1536
directory: "/"
1637
schedule:

‎.github/workflows/ci.yml‎

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,22 @@ jobs:
1010
build-and-test:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
14-
- uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6.0.10
15-
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
13+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
14+
- uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6.0.10
15+
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
1616
with:
1717
node-version: '20'
1818
cache: 'pnpm'
19-
- run: pnpm install --frozen-lockfile
20-
- run: pnpm run supply-chain:check
21-
- run: pnpm run build
22-
- name: Verify context routing benchmark
23-
run: pnpm run benchmark:context
24-
- name: Measure brief token budget
19+
- run: pnpm install --frozen-lockfile
20+
- run: pnpm run supply-chain:check
21+
- run: pnpm run build
22+
# Same check release.yml runs before publishing; exercised here so a
23+
# change to the script can't first fail at release time.
24+
- name: Verify packed packages are publishable
25+
run: pnpm run publish:check
26+
- name: Verify context routing benchmark
27+
run: pnpm run benchmark:context
28+
- name: Measure brief token budget
2529
run: node scripts/measure-brief-size.mjs
2630
- name: Eval brief orientation coverage
2731
run: node scripts/eval-brief-coverage.mjs

‎CHANGELOG.md‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ The format is based on Keep a Changelog and follows Semantic Versioning.
88

99
### Changed
1010

11+
- **`charter adf fmt` keeps the emoji form of the standard `CONSTRAINTS`, `FILES` and `TOOLS` decorations** (`#351`). These are written with a U+FE0F variation selector (`⚠️`, `🗂️`, `🛠️`), as every Charter scaffold writes `⚠️ CONSTRAINTS`. The parser drops the selector, and the formatter used to emit what it parsed, so `adf fmt --write` rewrote them to the text-style glyph (`⚠`) and `adf fmt --check` reported a freshly scaffolded file as non-canonical. The formatter now emits a section's standard decoration whenever the parsed one equals it apart from U+FE0F, whichever form the file had; any other decoration is emitted as parsed (still without U+FE0F, which the parser does not keep). **`adf fmt --write` output changes for files with a bare `⚠ CONSTRAINTS`, `🗂 FILES` or `🛠 TOOLS` header** (it now writes the U+FE0F form), and `adf fmt --check` reports such files as non-canonical until rewritten. The other commands that re-render a whole `.adf` file through the formatter (`adf tidy`, `adf migrate`, `adf patch`, `adf metrics`, the MCP patch tool) write the same headers. The parsed AST is unchanged, so commands that read these files behave as before. `adf sync` hashes the raw bytes, so once one of these writers rewrites a sync source, `adf sync --check` reports it as changed until `adf sync --write`. That check fails the same way after any edit. `adf populate` and the other text-preserving writers add a section header in the same form `adf fmt` emits; a non-standard text-style decoration (say `⚙ NOTES`) is no longer given a U+FE0F that `adf fmt` would then remove. New export `canonicalDecoration(key, decoration)` in `@stackbilt/adf`. This repo's `.ai/*.adf` headers were rewritten to `⚠️ CONSTRAINTS`.
12+
1113
- **`bootstrap --ci github` and `setup --ci github` no longer overwrite a hand-edited `.github/workflows/charter-governance.yml`, and no longer silently widen its permissions** (`#374`). Without `--force`, an existing workflow is refreshed only when it is the current npm or pnpm template; a switch between the two is named (`Updated … (package manager npm → pnpm; adds pnpm/action-setup@v4)`, `packageManagerChange` in JSON). The known templates, each with a `safe` flag and a hand-written description, are listed in `commands/github-workflow.ts`. Every older Charter template had `contents: read` and ran on `pull_request` only. It is now kept with a warning that says what refreshing it changes (`contents: read → write; adds push and workflow_dispatch triggers; adds a step that commits and pushes to the repo`) and names `--force`; when the upgrade also switches package manager, the warning, the `Replaced` line and JSON (`packageManagerChange`) say so (`package manager npm → pnpm (adds pnpm/action-setup@v4)`). Before this change `bootstrap --ci github` made that upgrade silently. Any other workflow is treated as hand-edited and kept byte for byte, with a warning that states what the current template grants and asks you to review it before `--force`. Charter does not describe what a hand edit changed. The warnings name what else `--force` does in each command, and say that deleting the workflow and re-running replaces only it. Comparison drops a leading BOM, CRLF line endings, trailing whitespace and trailing blank lines. A pinned `@stackbilt/[email protected]` is normalized too, but the only template that pinned one predates the current permissions, so a pinned workflow is kept unless `--force`. JSON: bootstrap lists a kept workflow in `setup.details.kept` (platform separator, like the `.charter/` entries) and records `setup.details.workflow: { file, action, reason?, changes?, templatePermissions?, backup?, packageManagerChange? }`; setup sets `workflow.kept`, `workflow.reason`, `workflow.changes` and `workflow.templatePermissions`. `reason` is `hand-edited` or `would-widen-permissions`. Under `--force` the workflow is first copied to `.charter/.backup/github-workflows-charter-governance.yml.<timestamp>` (gitignored), then replaced, printed as `Replaced … (backup: …; changes: …)` or `(backup: …; the current Charter template grants …)` (`setup.details.replaced` in bootstrap JSON; `workflow.backup` and an entry in top-level `replaced` in setup JSON). If that backup fails, the workflow is not replaced and the command exits 1: bootstrap lists it in `setup.details.notReplaced`, fails the setup step (JSON `status: "partial"`) and prints `Bootstrap finished with failures.` instead of `Bootstrap complete.`; setup lists it in `notReplaced` (with `reason`), sets `workflow.notReplaced: true` and prints `CI policy gate: not replaced (backup failed)`. A missing workflow is still created and an identical one left alone. `setup --ci github` without `--force` now refreshes the other package manager's current template, which it used to leave alone; setup's `mutationPlan.workflow.action` is `noop` for a workflow it will keep.
1214
- **`charter init --guided --format json` is refused** (`#375`). It used to ask its questions on a terminal and then print the init result document, with the banner and prompts mixed into stdout ahead of it; with a closed stdin it exited 0 having printed no JSON at all. It now exits 1 before asking anything and prints one JSON document: `error`, `errorCode: "GUIDED_REQUIRES_TEXT"`, `guided: true`, `writesPerformed: 0`. For a JSON result, use `charter init --preset <name> --format json`.
1315
- **`charter init --guided --ci` is refused** (`#375`): exit 1 before asking anything, with a message on stderr naming `charter init --preset <name>`. A CI stdin that stays open would otherwise leave guided mode waiting forever.
@@ -38,7 +40,10 @@ The format is based on Keep a Changelog and follows Semantic Versioning.
3840
- In each of those three cases, Charter is not called again.
3941
- **1.x:** one warning to upgrade `@stackbilt/cli` to 2.x (as a devDependency, or your global install), since 1.x ignores `--staged` and `--print-paths`.
4042

41-
A doctor that ran and reported findings gets no devDependency hint. When tidy leaves a staged vendor file alone (for example, an unmanaged one), its note is shown under `[pre-commit] adf tidy notes:`. Neither that case nor a failed tidy dry run goes on to say "Vendor config files are clean." `charter doctor` and the hook now detect PnP from one shared source. The `CHARTER_HOOK_SCOPED_DOCTOR` token flow is unchanged. Scope: this fix covers the pre-commit hook only; the CI workflow `charter setup` generates still calls `npx charter` (tracked separately). **Installed hooks do not update themselves:** run `charter hook install --pre-commit` again (no `--force` needed for a Charter-managed hook). This is needed under Yarn PnP and recommended everywhere else. `charter doctor` reports an older hook as INFO in a PnP repo.
43+
A doctor that ran and reported findings gets no devDependency hint. When tidy leaves a staged vendor file alone (for example, an unmanaged one), its note is shown under `[pre-commit] adf tidy notes:`. Neither that case nor a failed tidy dry run goes on to say "Vendor config files are clean." `charter doctor` and the hook now detect PnP from one shared source. The `CHARTER_HOOK_SCOPED_DOCTOR` token flow is unchanged. Scope: this fix covers the pre-commit hook only; the CI workflow `charter setup` generates is fixed separately (`#380`). **Installed hooks do not update themselves:** run `charter hook install --pre-commit` again (no `--force` needed for a Charter-managed hook). This is needed under Yarn PnP and recommended everywhere else. `charter doctor` reports an older hook as INFO in a PnP repo.
44+
- **The GitHub workflow that `charter setup --ci github` and `charter bootstrap --ci github` generate no longer runs a bare `npx charter`** (`#380`). When `@stackbilt/cli` was not installed, `npx charter` fetched the unrelated `charter` registry package (no executable, so the step failed with `could not determine executable to run`). Each step now runs the CLI the install step put in `node_modules`: `pnpm exec charter …` for pnpm, and `npm exec --no --package=@stackbilt/cli -- charter …` for npm. Neither form installs anything; without a local `@stackbilt/cli` the step fails. `setup` and `bootstrap` add it to `devDependencies`, except under `--no-dependency-sync` or in a repo with no root `package.json`. The npm form still contains `charter validate --ci`, so doctor's gate-enforcement check recognizes it. The template has no Yarn form (it supports npm and pnpm only), so a Yarn repo gets the npm form. The previous template (003ec8d, with `npx charter`) has the same permissions and triggers, so `setup`/`bootstrap` refresh it without a warning, as before. Its `KNOWN_WORKFLOWS` entry stays `safe` and records what the refresh changes.
45+
- **`charter adf compile --target claude --write --mode compiled` no longer carries the template's empty `## Environment` placeholder into the retained block** (`#364`). A `CLAUDE.md` written by any bootstrap since 0.3.3 (the 1.9.3 upgrade path included) holds `## Environment` with only the `<!-- Add runtime/OS/shell-specific notes here (not stack rules) -->` comment. When you had added a second `## Environment` of your own, converting the pointer to compiled output carried both, comment included, and reported `kept ## Environment, ## Environment`. Each retained section is now compared with the pointer templates on its own (ignoring CRLF, whitespace at line ends and blank lines around the body), so the untouched placeholder is dropped as template text and only your section is carried. A placeholder you wrote under is yours and is carried as before. A retained block that an earlier compile already wrote is copied verbatim as always: if yours holds the placeholder, delete it from the block by hand.
46+
- **`charter adf migrate` and `charter bootstrap` wrote the generic "This project uses [ADF]…" pointer instead of the named template when run from the CLI** (`#355`). This hit `GEMINI.md`, `AGENTS.md`, `.cursorrules` and `copilot-instructions.md` in the default mode, and `CLAUDE.md` too under `--replace`. `adf-migrate` built its template table when the module loaded, and the CLI loads it while `adf.ts` is still initialising (`index` → `doctor` → `adf` → `adf-migrate`), so every entry was `undefined`. The template is now looked up when the pointer is written. Unit tests that imported `adf-migrate` directly never saw the cycle.
4247
- **`charter adf populate`, and so every `charter bootstrap`, re-added stack constraints to a `CONSTRAINTS` section you had edited** (`#371`; 2.1.0 listed this as still open under `#354`). Deleting a bullet from `core.adf` and re-running bootstrap brought a stack rule back (for example the Cloudflare `No Node.js-specific APIs in Worker handlers` rule), because populate appended any detected stack constraint it did not find. Populate now remembers what it has added or offered in a new file, `.ai/.populate.json` (`{ "version": 1, "constraints": { "core.adf": { "added": [...], "offered": [...] } } }`, sorted, written only when it changes). Commit it with the rest of `.ai/`; bootstrap lists it under what it created, and its `git add .ai` next step already includes it. The rules:
4348
- A constraint recorded as added or offered is never added again, whether it is still in the section or you deleted it. Deleting the one rule populate added to a plain Worker repo now sticks, and a deleted `CONSTRAINTS` section is not recreated once the file has a record.
4449
- New constraints go only into a section that is untouched: the template's bullets, in order, followed by nothing but bullets populate recorded as added. A missing section is created only while there is no record. It goes right after whichever of `GUIDE` and `CONTEXT` comes later, which in the scaffold's order is its own place, rather than at the end of the file (when populate adds a missing `CONTEXT` in the same run, that one is appended at the end and `CONSTRAINTS` follows it); its header is written as the scaffold writes it (`⚠️ CONSTRAINTS [load-bearing]:`).
@@ -54,6 +59,7 @@ The format is based on Keep a Changelog and follows Semantic Versioning.
5459
- **The interactive y/N prompts (`bootstrap`'s "Register these modules now?" and the `--reset-adf` "Replace them?") left the CLI to exit 0 mid-run when stdin closed at the prompt or Ctrl-C was pressed** (`#375`). Ctrl-D on an empty line (or any close before an answer) now counts as N, with `No answer (input closed); treating it as N.` on stderr: bootstrap leaves the orphan modules unregistered and carries on, and `--reset-adf` is declined (exit 1, nothing written). Ctrl-C stops the command: it prints `charter: Aborted.` on stderr and exits 130 (the usage-log event is still recorded), so bootstrap does not go on to migrate agent configs or install packages.
5560
- **`charter init --guided --preset <name>` silently ignored `--preset`** (`#375`). It now seeds the answer: the preset is used when the language answer names no known stack (blank, or something like `cobol`), and the first question says `blank keeps --preset <name>`. A recognized language or a Cloudflare `y` still decides, as before.
5661
- Preset lists named four or five presets where six are accepted: the root `--help` (`charter init`, `charter setup` and the `--preset` option), `charter adf --help`, `packages/cli/README.md`, `docs-snippets/charter-cli-reference.md` and the Global Flags table of `docs/cli-reference.md` now list all six (`worker|frontend|backend|fullstack|docs|rust-wasm`).
62+
- **Help text gaps** (`#363`). The root `--help` lists `charter doctor [--adf-only] [--ci] [--format text|json]` and the pre-commit-hook-only `--staged [--tidy-skipped "<files>"]`, and its `charter adf` entry names all fifteen subcommands (it named nine). `charter adf --help` describes `tidy --source` and `--print-paths`, gives each `adf vendor` subcommand (`status`, `set`, `init`, `restore`, `rename-legacy`) its own line and flags, and documents `adf context`, which it left out. `docs/cli-reference.md` lists doctor's `--format json`.
5763

5864
## [2.1.0] - 2026-10-17
5965

0 commit comments

Comments
 (0)