Skip to content

docs: add missing adf command reference and record #295 fix - #308

Merged
stackbilt-admin merged 6 commits into
mainfrom
docs/adf-command-reference
Sep 20, 2026
Merged

stackbilt-admin merged 6 commits into
mainfrom
docs/adf-command-reference

Conversation

@stackbilt-admin

Copy link
Copy Markdown
Member

Docs sweep run against main at 1856a64.

Reference gap

docs/cli-reference.md documented nine adf subcommands and omitted five that exist: adf compile, adf tidy, adf populate, adf context, adf suggest.

Two of those are load-bearing in documented workflows — adf compile appears in the README quickstart and is the CI drift gate (--check), and adf tidy runs inside the generated pre-commit hook. Flags and behavior were taken from the commands' own help text and source, not inferred.

Compile guard documented as it now behaves

The adf compile entry describes the overwrite guard after #295 / PR #300: Charter pointers are accepted, hand-authored files are still refused, and a pointer carrying your own content under a retained heading is refused rather than silently overwritten.

adf tidy documented as it actually is, not as intended

The entry states plainly that the compiler-output skip lives in the generated pre-commit hook (hook.ts:53), not in adf tidy itself. adf-tidy.ts:243 gates on POINTER_MARKERS, and POINTER_MARKERS[0] is COMPILE_BANNER_MARKER — so a compiled file passes that test and gets folded back into .ai/. That is open issue #296, and the docs link to it rather than describing it as fixed. Detail posted to #296.

CHANGELOG

Adds an [Unreleased] section recording the #295 fix, which merged without an entry.

Verification

  • pnpm run docs:check passes
  • charter score reference resolution unchanged before/after: 54/128 referenced paths resolve; 43/50 code-block commands look runnable — these edits add no broken references and no unrunnable commands
  • Pre-commit hook passed (tsc, ADF evidence ceilings)

No source files touched, so no conflict with open PRs #301 or #304.

Does not close #295 — that stays open until #301 lands.

stackbilt-admin and others added 6 commits September 19, 2026 20:24
…json

Two files that `charter bootstrap` generates were not safe to commit.

1. `.charter/telemetry/events.ndjson` is per-machine usage data that grows
   with every command and conflicts on every cross-machine merge, but the
   generated `.charter/.gitignore` covered only `.cache/` and `context.md`,
   so a normal `git add -A` staged it. Add `telemetry/` to GITIGNORE_CONTENT.
   The pattern is relative to the config dir, matching the path telemetry.ts
   builds as `<configPath>/telemetry/events.ndjson`.

2. `.mcp.json` is a committed, shared file, but bootstrap wrote
   `path.resolve(aiDir)` into the `--ai-dir` arg, baking the author's
   absolute path into it. That breaks the MCP server for every other clone
   and for CI, and leaks the local directory layout. Write the relative
   `aiDir` instead. `charter serve` already resolves `--ai-dir` against its
   own cwd (serve.ts), which MCP clients set to the repo root, and `.ai` is
   its default. `charter hook print --mcp-config` already emitted a relative
   path, so bootstrap was the outlier.

Also drop the "Generated .mcp.json uses an absolute --ai-dir path" warning,
which is now false. The caller already guards on `mcpConfig.warning`.

Because `writeIfChanged` rewrites on content diff, an already-bootstrapped
repo picks up the new `.charter/.gitignore` on its next `charter bootstrap`
or `charter init`.

Tests: updated the existing `.mcp.json` assertion, which encoded the old
absolute-path behaviour, and added regression tests for both parts. The
`.mcp.json` test asserts on the raw generated text (no temp dir, no
absolute arg), not just that the file parses. Both new tests were confirmed
to fail with the bugs reintroduced.

Resolves-Request: #298

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Round 1 review follow-up. The code fix was correct but what surrounded it
was not: the manual still instructed the behaviour the fix removed, and
neither upgrade path was stated anywhere a user would find it.

1. Docs contradicted the generator. docs/cli-reference.md told users to
   "Use an absolute path for --ai-dir" and shipped a copy-paste .mcp.json
   example with an absolute path, in three places; README.md carried the
   same example. All four now show the repo-relative `.ai`. The real
   caveat survives as the escape hatch: if the MCP client spawns the
   server outside the project root, set the client's cwd or pass an
   absolute --ai-dir and keep it untracked. Noted that a wrong cwd fails
   loudly -- serve.ts emits a startup error naming the resolved path -- so
   the relative form is diagnosable, not silently wrong.

2. Gitignoring telemetry does not untrack telemetry. A gitignore entry
   never removes a path already in the index, so for the repos that hit
   this -- the ones whose events.ndjson is committed and conflicting --
   the generator fix alone changes nothing. Added an upgrade section under
   `charter init` with the one-time `git rm -r --cached .charter/telemetry`,
   and documented which parts of .charter/ are local-only.

3. Stopped recommending `bootstrap --force` as the .mcp.json migration.
   The same flag drives writeAdfScaffolds, so it re-scaffolds .ai/*.adf and
   overwrites hand-authored modules -- disproportionate for fixing one JSON
   string, and a data-loss risk. ensureProjectMcpConfig now detects the
   stale-absolute-path case specifically and names the one-line hand-edit
   at the moment the user hits the warning, explicitly steering off --force.
   The generic branch notes the ADF re-scaffold side effect too.

Tests: added a regression test asserting the warning names the offending
path, names the replacement, and says not to use --force. Verified it fails
when the detection is disabled. 885/885, typecheck clean.

Resolves-Request: #298

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The setup phase collected warnings but never printed them. Phase 3 loops
`adfResult.step.warnings` and prints each as "  Warning: ...", phase 2 had
no such loop, so setup warnings only ever reached the user as a number in
the closing "Bootstrap complete. N warning(s)." tally.

That made the previous commit's stale-absolute-path message unreachable in
practice: a user running plain `charter bootstrap` saw "1 warning" and no
way to learn which file, what was wrong with it, or how to fix it. The
message was only visible with --format json. The same gap hid the older
generic "already defines mcpServers.charter" warning, which is likely why
nobody noticed it was recommending a destructive --force.

Mirrors the phase 3 loop exactly. Retargeted the regression test from the
JSON result to the printed log lines, so it asserts what a default run
actually shows rather than a field the user never sees. Verified the test
fails when the loop is removed.

885/885, typecheck clean.

Resolves-Request: #298

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Round 2 review follow-up. The previous commits left the tool contradicting
its own manual: the docs offer an absolute --ai-dir as the escape hatch for
clients that spawn outside the repo root, while the new warning fired on
exactly that, telling anyone who followed the documented advice that their
config was broken on every run.

The harm in #298 is a machine-specific path inside a committed, shared
file. An absolute path in an untracked or gitignored .mcp.json harms nobody
and is the supported escape hatch. So the warning is now gated on whether
git actually tracks .mcp.json.

isTrackedByGit fails closed, via the existing runGit helper: outside a git
repo, before `git init`, or with git unavailable it reports false and
bootstrap stays quiet rather than warning on a guess. Silence is the safe
outcome here -- the cost of missing a warning is one stale path, the cost
of a false one is telling correct users they are wrong.

Also replaced the remedy text, which was not literally actionable: "keep
that entry out of version control" cannot be done per-JSON-key. It now
names gitignoring .mcp.json wholesale plus `git rm --cached`, the move that
actually works. Docs escape hatch in cli-reference.md and README.md aligned
with the same instruction, and the docs now state the warning is gated on
tracked-ness so a deliberately machine-local config stays quiet.

Tests: tracked .mcp.json warns; untracked stays silent; outside a git repo
stays silent. All three use a real git index rather than a mock, since the
distinction under test is exactly what git reports. Verified the two
silence tests fail when the gate is removed.

887/887, typecheck clean.

Resolves-Request: #298

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Adds CLI reference entries for `adf compile`, `adf tidy`, `adf populate`,
`adf context` and `adf suggest` -- all implemented, none documented, and
`adf compile` is used in the README quickstart and the CI drift gate.

Documents the compile overwrite guard as it behaves after #295 (PR #300),
including the refusal on retained sections.

Records the #295 fix under [Unreleased]; it was merged with no changelog entry.

The `adf tidy` entry states where the compiler-output skip actually lives --
the generated pre-commit hook, not the command -- rather than describing #296
as fixed.

Resolves-Request: #295

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
`adf context --keywords` runs through tokenizeTask (flags.ts:39), which splits
on whitespace and `,;:()[]{}` and drops single characters -- it is not a plain
comma split, so free text works too.

Uses `### Changed` rather than a non-standard `### Documentation` heading,
matching the 1.9.2 entry's treatment of documentation work.

Resolves-Request: #295

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@stackbilt-admin
stackbilt-admin merged commit 2c9a2c6 into main Sep 20, 2026
5 checks passed
@stackbilt-admin
stackbilt-admin deleted the docs/adf-command-reference branch September 20, 2026 11:13
stackbilt-admin added a commit that referenced this pull request Sep 21, 2026
…policies (#321)

The adf tidy entry in the CLI reference described behavior #296 changed, and was
wrong in a second way that was never right. It credited the generated pre-commit
hook with dropping banner-carrying files before invoking tidy: the hook does
filter them out of STAGED_VENDORS, but then calls `adf tidy --dry-run --format
json` with no --source, and adf-tidy.ts:106-108 falls back to scanning every
vendor file on disk, so the filtered list never reaches the command (#320). The
entry now states what the command does -- skip a file carrying the compile
banner, because it is the ruleset rendered from .ai/ rather than a thin pointer.

Three top-level commands were implemented but carried no reference entry, the
same completeness gap #308 closed for the adf subcommands: score, telemetry and
stamp-policies (16 of 19 commands were documented). Flags and behavior came from
each command's own help output and source rather than inference, with the
load-bearing claims checked against the implementation: CI_MIN_SCORE = 60
(score.ts:290), the .charter/badge.json path (score.ts:318), and the 30m/24h/7d
periods defaulting to 7d (telemetry.ts:47,161).

The score entry also documents how grounding resolves path references, which #293
changed materially and which nothing described: a reference that does not resolve
literally is retried by basename, requiring both a unique match and agreement
between the authored path segments and the real file's trailing segments. That is
what stops a fenced directory tree scoring as dozens of broken references while
leaving a genuinely stale path reported.

README, CHANGELOG and CLAUDE.md audited and clean; the existing CLI-reference
completeness CHANGELOG line was extended rather than duplicated. charter score
stays 93/100 and broken references fall 48 -> 47, so the added path references
resolve rather than costing grounding. No source files touched.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(adf compile): refuses to overwrite the vendor files bootstrap just generated, requiring --force on first compile

1 participant