Repository navigation
fix(bootstrap): --force merges .ai/ instead of replacing it; add --reset-adf - #372
Conversation
…set-adf (closes #354) bootstrap --force replaced manifest.adf, core.adf, state.adf and the preset modules with the template, dropping custom triggers, RULES, METRICS ceilings and constraints (copies survived only in an ungitignored .ai/.backup/). - --force now merges: a file gains only the whole template sections it lacks, and manifest.adf gains entries (with template triggers) for preset modules it has no entry for. Existing sections are never edited. Every write goes through a re-parse guard; CRLF and trailing-newline state are kept. A file the guard refuses or cannot parse is left as is, naming --reset-adf. - New --reset-adf does the old replacement: unique non-overwriting backups, .ai/.backup/.gitignore (*), "Replaced ... (backup: ...)" and a loss report (sections, items, METRICS rows, reset entries). It needs --yes or an interactive y; otherwise exit 1 with nothing written. It does not imply --force. - Phase 6 populate is scaffold-only (CONTEXT/STATE replaced only while they hold scaffold text), so plain bootstrap --yes stops clobbering them; its embedded JSON no longer precedes bootstrap's own report on stdout. - Text output never prints "Created" for an existing file; JSON gains scaffolds/replaced/mode/backupGitignore and top-level resetAdf only. - Hints name `charter adf create <module> --load default|on-demand` instead of the nonexistent `adf register`. Closes #347 Co-Authored-By: Claude Opus 5.5 <[email protected]>
stackbilt-admin
left a comment
There was a problem hiding this comment.
Adversarial review: #372 (bootstrap --force merges, --reset-adf)
Verdict: CHANGES_REQUESTED. Phase 3 does what it claims. The merge is append-only and byte-preserving, it is idempotent, the guard holds, the refusal works, and the JSON changes are only additions. But phase 6 (populate) still rewrites and drops user bytes in core.adf and state.adf under bare --force, --yes and no flags. That contradicts what this PR's docs promise.
Verification: I checked out head 68e0c2e. pnpm build && pnpm test gives 1500 passed and 3 failed (the 3 known Windows failures). CI is green. Every scenario ran against built dist/bin.js in fresh scratch git repos, and 2.0.0 ran via npx @stackbilt/[email protected] in twin repos.
Findings
- [CRITICAL]
packages/cli/src/commands/adf-populate.ts:129: phase 6 rewrites the whole file throughformatAdfwhenever any op applies, after phase 3 printedUnchanged.- Repro: in a wrangler and hono repo, bootstrap, then hand-write
core.adf. Make it CRLF, with sections in the order METRICS, CONTEXT, CONSTRAINTS, GUIDE, no scaffold markers, and the user has deleted the CF constraint. Runbootstrap --force --yes. - Output:
Unchanged .ai/core.adf, then[ok] .ai\core.adf (1 op applied).git diff --statshowscore.adf | 29 +++---. CRLF became LF, METRICS moved to the end, and whitespace was normalized. - This contradicts
docs/cli-reference.md:103: "custom triggers, RULES lines, METRICS ceilings and constraints survive byte for byte, as do line endings". It also contradicts the CHANGELOG's "A section the file already has is never edited". - #371 covers which bullet gets re-added. It does not cover the whole-file reformat, which happens for any op, including a legitimate CONTEXT fill.
- Fix options: make populate's writes byte-preserving the way phase 3's are (text insert or replace plus a re-parse guard), or narrow the docs to phase 3 and say that phase 6 reformats.
- Repro: in a wrangler and hono repo, bootstrap, then hand-write
- [CRITICAL]
adf-populate.ts:43-46: the "still template text" check is a substring test, so a lightly edited section is classified as scaffold and replaced wholesale.- Repro, CONTEXT: the list holds the placeholder bullet
Project context (run 'charter adf populate' …)plusCUSTOM: billing team owns src/pay. Run plainbootstrap --yes,bootstrapwith no flags, or--force --yes. The custom bullet is gone. - Repro, STATE: the map holds
CURRENT: Repository initialized with ADF context systemplusBLOCKED: waiting on legal sign-off for EU. The BLOCKED row is gone, under every flag combination. - The letter of INV-10 is met, but the CHANGELOG line "no longer replaces hand-written CONTEXT and STATE" is not true for partially edited sections. This is the same class of silent loss as #354.
- Suggested fix: treat a section as scaffold only when its items are a subset of the template's scaffold items, or replace just the placeholder items.
- Repro, CONTEXT: the list holds the placeholder bullet
- [NON-CRITICAL]
CHANGELOG.md:14: a refused--reset-adf"writes nothing, including under.charter/" is false.- Repro: run
bootstrap --reset-adf </dev/nulland then--reset-adf --format json. Both exit 1, and each run changes.charter/telemetry/events.ndjson. Nothing else changes, confirmed by md5 of every file outside.git. - Either suppress telemetry for that path or drop "including under
.charter/". The same applies to "writes nothing" indocs/cli-reference.md:104.
- Repro: run
- [NON-CRITICAL] The loss report (
adf-scaffold-merge.ts:192-255) is incomplete in places and overstated in others.- Entries in a non-last duplicate
ON_DEMAND/DEFAULT_LOADsection are dropped silently, becauseentryBulletsreads onlylastSectionIndexand those keys are skipped. Repro: a firstON_DEMANDholdingold.adf (Triggers on: legacy)is not reported. - A change to a section's weight or decoration (
[advisory]to[load-bearing]) is not reported. - VENDORS entries that are invalid, and so are not carried over, are not reported.
- It reports CONTEXT and STATE items as lost when phase 6 refills them in the same run. The repro reported 2 STATE items and 1 backend CONTEXT item as lost, yet
git statusshowedstate.adfandbackend.adfunchanged.
- Entries in a non-last duplicate
- [NON-CRITICAL]
bootstrap.ts:1050-1060:--reset-adf --yesexits 0 when every backup fails.- Repro: make
.ai/.backupa file. All 4 files printCould not back up …; not replaced, and the exit code is 0. - Not replacing the files is correct. But exit 0 means a scripted reset fails silently. Consider
partialwith a non-zero exit.
- Repro: make
- [NON-CRITICAL]
bootstrap.ts:1228: the managed-pointer warning recommends--force"which merges .ai/*.adf and never replaces it" as the way to regenerate one file.--forcealso rewrites every managed pointer and replaces.mcp.json'smcpServers.charterentry, and finding 1 still applies under it.- "Delete the file and re-run" is the narrow remedy. Either keep it alone or name the side effects.
- [NON-CRITICAL] Text output: phase 3 prints
Unchanged .ai/core.adf, and phase 6 then modifies that file in the same run (finding 1).- A user reads
Unchangedas "not touched". - The
[ok] .ai\core.adfline in phase 6 uses\, and it prints before the[6/7]header because the header is printed after the phase body runs. That ordering predates this PR and is cosmetic.
- A user reads
Verified as claimed
- Phase 3 merge. Tested with CRLF, no trailing newline, non-canonical order, duplicate
ON_DEMANDandRULES, an undecoratedROLE [advisory], custom triggers and METRICS. The diff was insertions only: thebackend.adftemplate-trigger bullet plus RULES appended. A second--force --yeschanged nothing under.ai/. - Doctor.
adf required wiringpasses after the merge, including for a manifest that had neither DEFAULT_LOAD nor ON_DEMAND. - CP-3. It never duplicated an entry and did not fight orphan registration (
billing.adfwas registered once with its stem). - Unparseable or unsupported manifest.
ADF: 9.9is left as is in both skip and merge, and the warning names--reset-adf. CP-3 is not attempted. - Refusal. Non-TTY, closed stdin and
--format jsonexit 1 with no.ai/, hook,package.jsonor config write. Telemetry is the exception (finding 3). The JSON refusal is a single document. --reset-adf --yes. Backups match the old files,.ai/.backup/.gitignorecontains*, and the files are untracked ingit status. The METRICS, RULES and dropped-entry lines are accurate. A failed backup means the file is not replaced.- JSON vs 2.0.0. Compared on fresh
--yes, re-run--yesand--force --yes: 2.0.0 does print two JSON documents. This PR prints one. No key was removed or retyped. The only additions areadf-init.details.{scaffolds,replaced,mode,backupGitignore}.
Rulings
I mapped (a)–(d) to the PR's "Notes for review", since the PR does not label them.
- (a) Reworded
--forcewarnings: accept. Keep the.mcp.jsonand pointer wording honest (finding 6). - (b) Embedded populate JSON suppressed: accept. It fixes the two-document stdout I reproduced. Note that the populate per-file results are now absent from bootstrap JSON.
- (c) CP-3 in every mode, with skip mode reported as
mergedandaddedSections: []: accept. It matches the scope table. Be aware that plainbootstrapwith no flags now writesmanifest.adfwithout a prompt. - (d) VENDORS excluded from the loss report: accept. Entries that are carried over are not losses. Invalid entries that are dropped should still be reported (finding 4).
- Caveat, telemetry after refusal: the behavior is acceptable, but the doc claim is not (finding 3).
- Caveat,
.mcp.jsonreplaced under--yesalone: acceptable to defer. It predates this PR (setupOverwrite = yes || force,bootstrap.ts:152). Make sure #369 covers.mcp.jsonexplicitly, since its title only names.charter/config.json.
Not verified
- The interactive TTY y/N prompt, since no TTY was available.
- Timing with a non-TTY stdin held open: the exit code was 1, but the shell pipeline wait masked how long node itself ran.
- Backup-name collisions in a real run (covered by unit tests only).
- Non-Windows platforms.
…ions (refs #354) Co-Authored-By: Claude Opus 5.5 <[email protected]>
stackbilt-admin
left a comment
There was a problem hiding this comment.
Adversarial re-review: #372 at 2c0a725
Verdict: CHANGES_REQUESTED. All 7 findings from the previous review are fixed, and I verified each against real runs. The one change I'm asking for is small: the new re-parse guard makes populate refuse benign input that 2.0.0 handled (finding 1 below), and on a fresh bootstrap that leaves core.adf unpopulated. The other findings are non-blocking.
How I checked
- Detached checkout of 2c0a725.
pnpm install && pnpm build && pnpm testgives 1519 passed, 3 failed. The 3 failures are the known Windows ones: bootstrap #307 fixture, context-refresh "captures git signals", serve-context "returns existing snapshot". - CI: all checks pass (Governance Scorecard skipped).
- Every scenario ran against the built
dist/bin.jsin fresh scratch git repos (hono, wrangler and typescript). Comparison runs usednpx @stackbilt/[email protected]and@2.0.0.
The 7 previous findings
- Fixed: populate rewrote the whole file via
formatAdf. I re-ran the previous repro:- Setup: a CRLF
core.adfwith sections reordered as METRICS, CONTEXT, CONSTRAINTS, GUIDE, no markers, and the CF constraint deleted. - Under
--yes, no flags, and--force --yes,git diffis a single inserted CRLF line in CONSTRAINTS. That line is the #371 re-add, which is a known, separate issue. Order, CRLF and whitespace are untouched.
- Setup: a CRLF
- Fixed: partial edits to CONTEXT/STATE were replaced. A
backend.adfCONTEXT holding the placeholder plusCUSTOM: billing team owns src/pay, and astate.adfholding the placeholderCURRENTplusBLOCKED: …, are byte-identical after all three flag sets. - Fixed: refused-reset docs claimed nothing under
.charter/was written. The CHANGELOG and cli-reference now say the telemetry log is still appended. A refused--reset-adf, with stdin from/dev/nulland with--format json, exits 1, andgit statusshows no project change. The JSON refusal is one document. - Fixed: loss report gaps. Against a hand-built manifest, core and state:
- These are now reported: entries in a non-last
ON_DEMANDsection (old.adf (Triggers on: legacy) -> (Triggers on: old)),RULES [load-bearing] -> RULES,CONSTRAINTS [advisory] -> ⚠ CONSTRAINTS [load-bearing],dropped VENDORS entry: NOPE.md: banana, the METRICS rows, and the lost items. - Content refilled by populate is no longer reported:
backend.adf … nothing lost. - I checked every line against
diff backup final. It is accurate apart from the gap in finding 4 below.
- These are now reported: entries in a non-last
- Fixed: exit 0 when every backup fails. With
.ai/.backupas a regular file:- Text output prints
4 of 4 file(s) not resetand exits 1. --format jsonexits 1 withadf-init: fail,notResetholding 4 entries andreplaced: [].- A normal reset still exits 0.
- Text output prints
- Fixed: the managed-pointer warning oversold
--force. It now leads with "delete and re-run" and lists what--forcealso does: pointers,.mcp.json, and the.ai/merge. - Fixed: phase 3 printed
Unchangedfor files phase 6 then modified. Phase 3 now printsUnchanged by merge: .ai/core.adf. Phase 6 then printsAdded CONSTRAINTS item in .ai/core.adf: …, with forward slashes and after the[6/7]header. The embedded[ok] .ai\core.adfline is gone.
New findings
- [MEDIUM]
adf-populate.ts:233andadf-text-patch.ts:105-112: populate builds values that do not round-trip through the parser, so the guard refuses the whole file. This regresses from 2.0.0.- Cause:
contextItemsembedspackage.jsondescriptionverbatim. The parsertrim()s list items and splits on newlines, so a description with trailing whitespace, or one containing\n, can never equalapplyPatches(parse(old), ops). The guard then refuses every op forcore.adf, including the stack CONSTRAINTS bullet. - Repro: a fresh repo with
"description": "Demo app ", or"Demo\nsecond line", thenbootstrap --yes. - Result:
core.adfkeeps the placeholderProject context (run 'charter adf populate' …)and gets noNo Node.js-specific APIs…constraint. Output:Warning: .ai/core.adf could not be edited in place without changing other content (guard); left as is.JSON:populate: pass, populated 0. - 2.0.0 on the same repo fills CONTEXT with
project: demo — Demo app. - The warning blames "other content", but the only problem is populate's own value. Every later bootstrap repeats it.
- Suggested fix: normalize generated values before building ops (trim, collapse internal newlines). Add a test with a whitespace-padded or multi-line description.
- Cause:
- [LOW]
populate.details.skippedmixes two outcomes. It counts both "nothing to do" files and files the guard refused, so JSON consumers cannot tell them apart. Example: in the repro above, a re-run reportsskipped: 3, and one of those 3 was refused. The refusal appears only as a free-text warning.populated/skippedalso change meaning compared with 2.0.0, where they meant "populate ran (1/0)". The CHANGELOG discloses this, but it is a semantic change of existing keys, not an addition. Its wording "always reported1/0" is slightly off, since 2.0.0 reported0on failure.- Consider a
refusedcount or a per-filestatus: 'refused'.
- [LOW]
adf-text-patch.ts:55: in a mixed-ending file, edited lines become CRLF.crlf = text.includes('\r\n'), so a mostly LF file with one CRLF line gets its inserted or replaced lines written as CRLF.- Probe:
'ADF: 0.1\nCONTEXT:\n - old\r\n\nCONSTRAINTS:\n - a\n'gives… - project: x\r\n… - NEW\r\n. - The guard passes, because the parser ignores endings. "Line endings are kept" holds only for uniform files. Cosmetic.
- Probe:
- [LOW]
adf-scaffold-merge.ts:165: a VENDORS header change is not reported.VENDORSsits inMANIFEST_EXCLUDED_KEYS, so the header check skips it. In my reset run,🔌 VENDORS:became🏷 VENDORS:with nochanged headerline, although the docs promise "changed section decorations or weights".- Also cosmetic:
headerChanges.aftershows⚠without U+FE0F, because the parser drops it, so the reported header differs from the bytes in the file.
- Also cosmetic:
- [LOW]
docs/cli-reference.md:107and the CHANGELOG: "absent" is true for CONTEXT only. Both say phase 6 fills CONTEXT/STATE "while the section is absent, empty, or exactly the template's text". For STATE,buildStateOpsreturnsnullwhen the section is absent, so an absent STATE is never filled.
Probes of the new code that held up
applyOpsAsTexthandles the following correctly:- CRLF, no trailing newline, an empty section at EOF (CRLF, no final newline), tabs, nested-indent bullets, a header with trailing spaces and a weight, a BOM, and an inline header value plus body.
- Text-type bodies replaced under force, and trailing blank lines kept.
- ADD_SECTION with no final newline, and the guard refusing a body that is part list, part text.
- Lone-CR files and a same-key ADD_SECTION are refused. The refused ADD_SECTION is labeled
unparseablebecauseapplyPatchesthrows, which is a mislabel but safe.
- Duplicate sections:
sectionHeaders(...).own[0]andapplyPatches'doc.sections.findboth target the FIRST section with a key, so the guard checks the right section. - Bytes the parser does not model: the REPLACE range is the section body from the header to the next header. The scaffold-only path enters it only when the normalized body equals the template, so the most it can lose is trailing whitespace or blank lines inside a placeholder section.
isUntouchedScaffold:- Ignores whitespace-only edits (true).
- Treats reordered template bullets and
*bullets as hand-written (false, the conservative direction). - Also treats the inline or undashed text form, and STATE written as a list, as untouched (harmless).
- 1.9.3 templates still count as scaffold, so the template-version risk is zero in practice.
- The constants are textually identical to 1.9.3's.
- A 1.9.3
bootstrap --yesrepo, upgraded withbootstrap --yes, gets no.ai/*.adfchange. Only the lock changes, because 1.9.3 had already populated it. - A 1.9.3
adf initrepo: plainadf populateandbootstrap --yesfill all four files, as 2.0.0 does, but without the re-render.
- Plain
charter adf populate: without flags it fills only exact-template sections, and--forcestill overwrites customized CONTEXT/STATE. JSON rows gainchanges, andreasonwhen one applies.--dry-runleaves the file unchanged (md5 identical). The INV-10 tests cover plain,--yesand--force. - JSON vs 2.0.0:
notResetappears only in reset mode, andpopulate.details.changesis added. No key is removed or retyped (see finding 2 for the semantic change).
Not verified
- The interactive TTY y/N prompt, since no TTY was available.
- Non-Windows platforms.
- Reset where only some backups fail (I covered all-fail and none-fail; the unit tests cover partial).
… reset report (refs #354) Co-Authored-By: Claude Opus 5.5 <[email protected]>
Closes #354
Closes #347
Summary
charter bootstrap --forcereplaced.ai/manifest.adf,core.adf,state.adfand the preset modules with the template. That silently dropped custom ON_DEMAND triggers, manifestRULES, the manifestMETRICSsection, custom constraints andcore.adfMETRICS ceilings (entry_loc: 120 / 150became0 / 500). The only copies were in an ungitignored.ai/.backup/.This PR implements blueprint option D:
--forcemerges. A file gains only the whole template sections it lacks, andmanifest.adfgains an entry, with the template's triggers, for each preset module it has no entry for. A section the file already has is never edited. Every write goes through a re-parse guard (the same contract as the adf migrate: new modules not registered in manifest or CLAUDE.md module index #239/feat(adf): register modules adf migrate creates in manifest.adf #348 writer, reusingsectionHeaders,lastSectionIndexandregisterManifestModules). CRLF and the trailing-newline state are kept. A file that cannot be parsed, or that the guard refuses, is left as is, and the warning names--reset-adf.New
--reset-adfdoes the old replacement:COPYFILE_EXCLplus a suffix);.ai/.backup/.gitignorecontaining*;Replaced .ai/x (backup: …)followed by a loss report (lost sections, items, METRICS rows, reset entries), capped at 10 lines per file, with the full report in JSON.It needs
--yesor an interactivey. Otherwise it exits 1 and writes nothing. It does not imply--force.Phase 6 populate is scaffold-only. It passes an explicit
mode: 'scaffold-only';adf populaterun directly keeps its own--force/--yes.Housekeeping. "Created" is never printed for a file that existed: a rewritten lock prints
Updated .ai/.adf.lock. bootstrap: warnings tell users to run 'charter adf register', which does not exist #347: both hints now namecharter adf create <module> --load default|on-demand, and the orphan hint is printed only when the orphans were left unregistered.New module
packages/cli/src/commands/adf-scaffold-merge.ts(304 LOC).adf.tsis untouched (1027/1041).Before → after (reproduction from the blueprint, built CLI, non-TTY)
S = the scaffold files (manifest, core, state, preset modules) when they hold custom content.
.ai/.backup/--yes--force/--force --yes--reset-adf--reset-adf --yes--reset-adf --force --yes.mcp.jsonrewrittenPhase 6 CONTEXT/STATE: always replaced → scaffold-only, under every flag combination.
Operator sign-offs
--reset-adfrequires--yesor an interactive y/N. The merge adds missing sections and missing template modules only. Phase 6 populate is scaffold-only. Housekeeping: gitignore backups, print "Replaced", fix bootstrap: warnings tell users to run 'charter adf register', which does not exist #347.bootstrap --yesstops replacing CONTEXT/STATE.--reset-adfrefusal.### Changed(with a prominent lead paragraph and the migration) and### Fixed.Invariants and where they are tested
Unit tests are in
bootstrap-force-merge.test.ts; the built-CLI tests are inintegration/bootstrap-reset-cli.test.ts..ai/.backup/.gitignoredescribe block, including a backup dir left by 2.0.0 under a merge--format json, and N at the prompt (unit tests); built CLI with stdinignoreand with a closed pipe.ai/and vendor files)--yestestOther scope tests: guard refusal →
skipped{guard}; unsupportedADF:version →skipped{unparseable}; non-listDEFAULT_LOAD→skipped{not-a-list}; template module file-only / entry-only / neither; loss report text and JSON, including the cap; #347 hint text. The existingbootstrap.test.ts:98-119pin is re-pinned to--reset-adf --yes.Mutation checks: each of the following was made by hand and caught by at least one test.
COPYFILE_EXCL--yes2.0.0 vs this PR (twin scratch repos,
npx @stackbilt/[email protected]vsdist/bin.js)Fresh
bootstrap --yes(first commit; see Review round 1 for the populate changes). Text output is identical. The trees are identical apart from the blessed-stackgeneratedAttimestamp and telemetry. In JSON, 2.0.0 printed two JSON documents on stdout (populate's report, then bootstrap's); this PR prints one. In bootstrap's own document no key was removed or retyped. The only additions areadf-init.details.{scaffolds,replaced,mode,backupGitignore}; all other values are equal.Re-run
bootstrap --yes(each item is sanctioned):Created .ai/.adf.lockbecomesUpdated .ai/.adf.lock(INV-11).--forceas safe instead of "Do not use --force … re-scaffolds .ai/*.adf". That sentence is no longer true after this change.[skip] … (already customized)instead of[ok] … 1 op applied(CP-7). The trees are identical.Re-run
bootstrap --force --yes:Created .ai/{manifest,core,state,backend}.adfbecomesUnchanged …(the merge; INV-11).Backed up 4 filesline and the 4 per-fileBacked up …warnings are gone (no.ai/.backup/is written). The warning count drops from 5 to 1..ai/.adf.locknow hashes the current core/state. In 2.0.0 it hashed the template that populate then overwrote.Reproduction under
--force --yes.git diff --no-indexof.ai/before and after shows only the.adf.lockhash. With missing RULES/GUIDE plus a CRLF manifest with no trailing newline, the diff is pure insertions:+ backend.adf (Triggers on: API, Node, DB),+ RULESblock,+ GUIDEblock. A second--forcerun changes nothing, and doctor required wiring passes.--reset-adf --yesprints:The backups match the old files and
.ai/.backup/.gitignoreis*.Non-TTY
--reset-adfexits 1 and writes nothing (the git status is clean).Notes for review
--force"re-scaffolds .ai/*.adf" (pointer custom/managed, both.mcp.jsonmessages) were reworded, because that is no longer true.bootstrap --format json. In 2.0.0 that output made stdout two JSON documents.merged, withaddedSections: [].--reset-adf,VENDORSis excluded from the loss report because it is carried over..charter/telemetry/events.ndjson, gitignored,index.ts) is still appended after a refused--reset-adf. That write predates this change and is not bootstrap's. The integration test excludes it explicitly.--yesalone,.mcp.json's charter entry is replaced in both 2.0.0 and this PR (setupOverwrite = yes || force). The scope table says "warn"; this belongs with bootstrap --yes overwrites .charter/config.json, .mcp.json's charter entry and related files without --force or a backup #369.NOT in scope (filed separately)
.charter/config.jsonoverwritten under--yes(bootstrap --yes overwrites .charter/config.json, .mcp.json's charter entry and related files without --force or a backup #369)adf init --forcewith no backup (adf init --force replaces the manifest and modules with no backup #370)generatedAtchurnadf populateCLI semanticsgit rm -r --cached)adf registeraliasReview round 1 (commit 2c0a725): all 7 findings fixed
adf-text-patch.tsapplies populate's ops as in-place text edits: ADD_BULLET, REPLACE_SECTION (list or map), and ADD_SECTION.applyPatches(old, ops). If it does not, the file is skipped with a reason.adf populateCLI.--force --yes: the core.adf diff is now1 +, the adf populate re-adds deleted default CONSTRAINTS bullets on every bootstrap #371 constraint re-add inserted in place with CRLF. A second run showsNo scaffold content to replace.--yesand--force --yes.charter adf populate(no--force) fills. Before, it was a substring match on scaffold phrases.--force/--yesstill force. This is stated in the CHANGELOG..charter/telemetry/events.ndjsonis still appended. Updated in the CHANGELOG andcli-reference.md.headerChanges) and VENDORS entries that were not carried over (vendorsDropped).state.adfandbackend.adfshownothing lost, and billing shows-> (Triggers on: billing).--reset-adf --yesbackup failures.partialand the exit code is 1.N of M file(s) not reset: ….adf-init.details.notReset(reset mode only) carries the same list.--forcealso does: rewrites every managed pointer, replaces.mcp.json'smcpServers.charter, and merges.ai/*.adfwithout rewriting existing content. The generic.mcp.jsonwarning says the same.Unchanged by merge: .ai/<f>(andAlready the template:under reset).Filled CONTEXT in .ai/core.adf,Added CONSTRAINTS item in .ai/core.adf: ….changes.populated/skippednow count files; 2.0.0 always reported 1/0.New tests:
bootstrap-force-merge.test.ts:applyOpsAsText: CRLF, no final newline, map replace, append, guard, version.isUntouchedScaffold, including CLI default vs--force.copyFileSync.integration/bootstrap-reset-cli.test.ts:Mutation-checked: restoring the substring check fails 5 tests; restoring the whole-file reformat fails the CRLF test.
New 2.0.0-vs-PR differences (twin repos):
bootstrap --yes:Filled …/Added …lines instead of populate's embedded block and thePopulated 1 module(s)line.ADF: 0.1stays, and the decoration stays⚠️. 2.0.0 had formatAdf's canonical order and⚠.--yes: the custom-content byte counts differ by 1 because of that layout, the lock hashes differ for the same reason, and the output saysNo scaffold content to replace.--force --yes: printsUnchanged by merge:(wasCreated), and the backup lines are gone, as before.All are consequences of findings 1, 2 and 7.
Review round 2 (commit f1fccb2): all 5 findings fixed
package.jsondescription, the README summary, and every list item and map value.bootstrap --yeswith descriptions"Demo app ","Demo second line"and"Demo app": CONTEXT is filled (project: demo — Demo second line, and so on) and the CF constraint is added.refusedis[]and there are no warnings.could not be edited in place: after the edit, section RULES would not re-parse as the intended content.status: "refused"with areason.populate.detailsgainsrefused: [{file, reason}]. A refused file is counted in neitherpopulatednorskipped.populated/skippedchange exactly. In 2.0.0 they meant 1/0 when populate succeeded and 0 when it failed; they now count files.… - NEW
⚠️ CONSTRAINTS [load-bearing]
. 4. **[LOW] Reset report header changes.** They are now checked for every key, VENDORS and the module lists included (🔌 VENDORS -> 🏷 VENDORS). Headers are printed as the file has them, keeping U+FE0F (). 5. **[LOW] Docs say what phase 6 fills.** CONTEXT is filled when it is absent, empty or exactly the template. STATE is filled only when it is empty or exactly the template; an absent STATE is not added. Fixed indocs/cli-reference.md` and the CHANGELOG.New tests:
normalizeValue; populate with the three descriptions; a refused row in populate JSON; the guard detail; mixed endings; VENDORS header changes with U+FE0F.bootstrap --yeswith the three descriptions fills CONTEXT and adds the stack constraint, withrefused: [].Mutation checks: removing the normalization fails 3 tests. Using the dominant ending for an inserted bullet fails the mixed-ending test.
Reviewer scripts
s4.sh(all three descriptions) ands5.sh(the reset report) were re-run against this build, along withprobe.cjs(mixed endings). The 2.0.0 twin comparison shows no new differences beyond those listed for round 1.Tests: build, typecheck and
verify:adfall pass. Vitest: 1530 pass. The 3 known Windows-only failures remain.Implemented via constellation-loop against a locked blueprint.
🤖 Generated with Claude Code