Repository navigation
feat(cli): preflight answer, first slice (#447) - #455
Merged
Merged
Conversation
Split each --files path into its own name tokens (kebab, snake, dot, camelCase), drop generic layout segments (packages, src, lib, dist, index, test dirs, extensions, node_modules), and feed them to the existing trigger matcher alongside the extension and directory signals. `adf context --files packages/adf/src/manifest.ts` now resolves adf-dev.adf. The non-bundle JSON output gains an additive triggerMatches key (same shape as --bundle) so agents can see which token matched which trigger. Closes #442 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…paths MCP getProjectContext split the task on whitespace only, so "ADF." failed to match the ADF trigger and on-demand modules were silently dropped. It now resolves through a shared resolveProjectContext helper that uses the CLI's tokenizeTask. getProjectContext is the only MCP tool taking a task. adf context --bundle joined aiDir onto paths bundleModules had already resolved, exiting 2 with "Module not found: core.adf". The reader now reads the path as given. Closes #438 Closes #439 Part of #437 Co-Authored-By: Claude Opus 5.5 <[email protected]>
For each --files entry that maps to a manifest METRICS source, adf context
now adds an additive `ceilings` array ({ file, metric, value, ceiling,
headroom, status, module }) to its JSON output, plus a Ceilings block in
text mode. Measurement moves into a shared adf-ceilings module that adf
evidence --auto-measure now also uses, so the value an agent sees before
editing is exactly what the gate enforces (trailing newline included).
Closes #443
Part of #437
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…g' into feat/issue-447-preflight-slice
… into feat/issue-447-preflight-slice # Conflicts: # packages/cli/src/commands/adf-context.ts
Text mode for `charter adf context --files <path>` now leads with a preflight block: Binds (load-bearing rules of resolved on-demand modules, with .ai/<module>:<line> locations), Headroom (live ceilings from #443), and Contract/Run first/Fresh as `unknown` until #445/#444/#440 land. A file nothing binds prints one short line. JSON gains an additive `rules[]` key next to `ceilings[]` (only with --files); unbuilt fields are not emitted. MCP getProjectContext accepts an optional `files` array and appends the same preflight text and rules/ceilings JSON; without `files` its response is unchanged. New logic lives in packages/cli/src/commands/adf-preflight.ts. Refs #447 Part of #437 Co-Authored-By: Claude Opus 5.5 <[email protected]>
filePathToTokens tokenized every segment of an absolute path, so the directories a checkout sits in (C:\Users\..., /home/...) became routing keywords. Paths are now made relative to the repo root (git toplevel from the --ai-dir's parent, else that parent) before tokenizing, handling Windows drive letters, backslashes, ./ and ../. A path outside the repo contributes no path tokens. - Add a small checkout-root backstop to the stop-list (home, documents, desktop, repo, repos); domain-ish words like users/projects stay routable. - Tests: absolute POSIX and Windows paths, ./ and ../, mixed file sets, and a guard manifest with user/users/home/projects/documents triggers for a repo nested under those directories. - docs/cli-reference.md: document path tokens, the stop-list and the triggerMatches JSON key for adf context. Refs #442 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…g' into feat/issue-447-preflight-slice Brings in eb3c0a1 (relativize --files paths before deriving path tokens). Conflict in adf-context.ts imports resolved by keeping both sides. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Parse guard: a resolved on-demand module the ADF parser rejects is
reported in a new additive `unreadable[]` ({ module, file, reason }) and
as "(unreadable: <reason>)" in Binds; the exit code stays 0.
- locate() matches the real section header (escaped key, optional emoji
and [load-bearing]/[advisory], then ':'), and the n-th occurrence for
repeated sections, so TASK text that mentions the key no longer wins.
- Rule and ceiling paths are shown relative to the repo root, not cwd.
Ceilings measure METRICS paths from the .ai dir's parent, so
--ai-dir ../.ai from a subdirectory gives the same answer.
- CLI and MCP share fileRoutingKeywords(), which feeds both the
extension/directory signals and path tokens repo-relative paths, so an
absolute C:/Users/... path routes like the relative one.
- filePathToKeywords moves to the leaf module adf-path-tokens.ts
(re-exported from adf-context.ts) to break the
index -> serve -> project-context -> adf-context -> index cycle.
- MCP getProjectContext with files: when nothing binds, return only the
short answer and { rules, ceilings, unreadable, binds } JSON, not the
default bundle. Content building moves to projectContextContent().
- Additive `binds` boolean in --files JSON output.
- --bundle text prints the preflight block on stderr (stdout stays ADF).
- Multi-file Headroom lines name the file they measure; the text answer
labels files repo-relative.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
) adf-preflight-guards.test.ts: absolute, forward-slash, lower-case drive and backslash --files paths (fixture under Users/... and this repo's ci.yml / adf-migrate.ts), an unparseable module (exit 0, unreadable), header-mismatch line location, subdirectory display paths, --bundle text stderr block, multi-file Headroom, the filePathToKeywords re-export, and the serve.ts getProjectContext content-array shapes via a stub server. docs/cli-reference.md: preflight text block, JSON keys, MCP files arg. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Member
Author
|
Review response, pushed as e1a41c5 (fixes) and 07b4cfa (tests and docs), after merging eb3c0a1 from #452. No force-push.
Full suite: 2144 passed and 9 failed. Six are the known Windows-only failures. Three are 5 s timeouts in |
Brings in #453 (task tokenizer parity, --bundle path fix) and #454 (ceiling headroom). Resolves the adf-context.ts conflict by keeping both the path-token import and triggerMatches (this branch) and the ceilings field (main). The adf-ceilings key-order test now expects triggerMatches between resolvedModules and ceilings. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Directory signals (api, test, session, ...) now read the repo-relative path, like path tokens do, so folders above the checkout never route a module. A path outside the repo keeps only its extension signals. - Resolve symlinks and junctions on both sides when relativizing, with a fallback for paths that do not exist yet. - A relative path that is missing under the cwd but exists under the repo root is read as repo-relative (running from packages/cli). - Memoize the git toplevel lookup per .ai location. - filePathToKeywords moves to adf-path-tokens.ts (re-exported from adf-context.ts) next to a shared filePathRoutingKeywords helper. - Test manifest mirror now includes typed-data-access.adf. Refs #442 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…o feat/issue-447-preflight-slice Brings in #453 and #454 (squash-merged on main) through #452's round-3 merge, plus #452's memoized resolvePathTokenRoot and filePathRoutingKeywords. Conflicts resolved toward this branch's preflight code (which already contains the #443/#454 ceilings work); fileRoutingKeywords is kept as a thin wrapper over #452's filePathRoutingKeywords. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Round-2 review fixes for PR #455: - computeFileCeilings matches requested files through relativizeFilePath, the same resolver path tokens and rule locations use, so Headroom is the same from the repo root, a subdirectory, and MCP with any cwd. - locate() ends a section at the next section header, so column-0 list items (`- rule`) get their own line instead of the header's. - MCP getProjectContext keeps the task's bundle when task and files are given and nothing binds the files. - The CLI and MCP look the memoized git root up once per call and pass it to routing, rules, ceilings and labels (new preflightAnswer helper). - Multi-file Binds names the files that trigger each module, or "the task keywords" when none does; no suffix when every file triggers it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…#447) - This repo: adf-migrate.ts from the root and from packages/cli (repo-relative, cwd-relative and absolute) gives the same rules, ceilings and text; MCP with an absolute aiDir gives the same answer from the repo root, packages/ and a temp dir. - locate() with column-0 list items, end to end and unit. - MCP task+files with nothing binding keeps the bundle; files-only and a blank task keep the short answer. - Multi-file Binds attribution. - docs/cli-reference.md: attribution, ceiling matching, MCP task+files. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Member
Author
|
Round 3 is pushed as three new commits: merge 2a84423 (#452, which includes
Full suite: the 5 known Windows-only failures, nothing else. The description has fresh output from the root and from |
…o content change) Co-Authored-By: Claude Opus 5.5 <[email protected]>
stackbilt-admin
marked this pull request as ready for review
November 28, 2026 03:04
stackbilt-admin
pushed a commit
that referenced
this pull request
Nov 28, 2026
Review fixes for #458: - #454 entry: ceilings print as the preflight Headroom line, not a Ceilings: block; drop the stale "--keywords-only output unchanged". - #455 entry: parse errors are tolerated only without --bundle; the preflight block goes to stderr with --bundle; MCP returns the full preflight fields. - Changed: #452 signals now read the repo-relative path; nothing-binds shortens CLI text and the MCP response. - Breaking: scope "MCP argument shapes unchanged" to the Zod migration. Co-Authored-By: Claude Opus 5.5 <[email protected]>
stackbilt-admin
pushed a commit
that referenced
this pull request
Nov 28, 2026
Second review round for #458: - Changed: --files text output changes on every run (preflight block first); the nothing-binds one-liner applies without --bundle only. - Move the MCP files response shape into the #455 Added entry; calls without files are unchanged. - Parse errors under --bundle/MCP produce no preflight fields; rule locations are repo-root relative; note the non-git root fallback and checkout-root words. - cli-reference: scope the unreadable and one-line claims to non-bundle. - Zod 4 migration guide: scope "argument shapes remain stable" to the migration and point at the new optional files argument. Co-Authored-By: Claude Opus 5.5 <[email protected]>
stackbilt-admin
pushed a commit
that referenced
this pull request
Nov 28, 2026
Round-3 review notes for #458: - #452 Changed: a relative path from a subdirectory now gains that subdirectory's signals, not only loses checkout-root ones. - #455 Added: over MCP, unreadable is always empty because a parse error fails the call; drop it from "same as the CLI". Co-Authored-By: Claude Opus 5.5 <[email protected]>
stackbilt-admin
added a commit
that referenced
this pull request
Nov 28, 2026
* docs(changelog): add 3.0.0 entries for #452 and #455 Both merged after #457, so 3.0.0 would have shipped them without notes. Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs(changelog): correct 3.0.0 entries for #452, #454 and #455 Review fixes for #458: - #454 entry: ceilings print as the preflight Headroom line, not a Ceilings: block; drop the stale "--keywords-only output unchanged". - #455 entry: parse errors are tolerated only without --bundle; the preflight block goes to stderr with --bundle; MCP returns the full preflight fields. - Changed: #452 signals now read the repo-relative path; nothing-binds shortens CLI text and the MCP response. - Breaking: scope "MCP argument shapes unchanged" to the Zod migration. Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs: scope 3.0.0 preflight notes to --bundle and MCP behavior Second review round for #458: - Changed: --files text output changes on every run (preflight block first); the nothing-binds one-liner applies without --bundle only. - Move the MCP files response shape into the #455 Added entry; calls without files are unchanged. - Parse errors under --bundle/MCP produce no preflight fields; rule locations are repo-root relative; note the non-git root fallback and checkout-root words. - cli-reference: scope the unreadable and one-line claims to non-bundle. - Zod 4 migration guide: scope "argument shapes remain stable" to the migration and point at the new optional files argument. Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs(changelog): note subdirectory signals and MCP unreadable scope Round-3 review notes for #458: - #452 Changed: a relative path from a subdirectory now gains that subdirectory's signals, not only loses checkout-root ones. - #455 Added: over MCP, unreadable is always empty because a parse error fails the call; drop it from "same as the CLI". Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Kurt Overmier <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #447
Part of #437
Stacks on (merge that first)
#453 and #454 are now squash-merged on
main. This branch hasmainin it, through #452's round-3 merge (2648897). The only prerequisite left is:feat/issue-442-path-token-routing): adf context --files: route modules from the file's own path tokens #442 path-token routing for--files, including its memoizedresolvePathTokenRootandfilePathRoutingKeywords.Merge this after #452. The diff against
mainincludes #452's commits until #452 lands.Merge 2a84423 brought in #452 (and
mainwith it). The conflicts were where the same #453/#454 changes came in as different commits. They were resolved toward this branch's code, which already contains #454's ceilings work and builds on it:adf-path-tokens.tstakes feat(cli): route adf context --files modules from path tokens #452's version as is.fileRoutingKeywords()stays as a thin wrapper over feat(cli): route adf context --files modules from path tokens #452'sfilePathRoutingKeywords().adf-context.ts,project-context.ts,serve.tsandadf-ceilings.tskeep the preflight code. feat(cli): report live ceiling headroom in adf context --files #454's separateprintCeilingsline is dropped, because the preflight's Headroom line already prints those ceilings.adf-ceilings.test.tskeeps the merged key list:keywords, resolvedModules, triggerMatches, ceilings, rules, unreadable, binds.What this slice adds
The new module is
packages/cli/src/commands/adf-preflight.ts, used by both the CLI and MCP.charter adf context --files <path>): the output starts with a preflight block.Binds: the load-bearing rules of each resolved ON_DEMAND module, each with its.ai/<module>:<line>location. DEFAULT_LOAD modules apply to every file, so they are not listed.Headroom: the live ceilings from adf context --files: report live ceiling headroom for each file #443.Contract,Run firstandFreshprintunknown, because Detect when a file's behaviour is pinned by a contract test, and say what a change means for semver #445, Rank first-test candidates by direct symbol evidence, not import distance #444 and context-refresh --once and charter_context serve a stale snapshot as fresh after a branch, HEAD or working-tree change #440 aren't built yet.--files, in both list and--bundleoutput), additive keys:rules[]:{ module, section, rule, file, line }ceilings[]unreadable[]:{ module, file, reason }binds: a booleancontract,tests,freshandnextActionsare left out on purpose. No existing key or exit code changed.getProjectContexttakes an optionalfiles: string[], routed with the same keyword helper as the CLI.Round 3: review fixes (c112971, tests and docs in 83f4fd3)
computeFileCeilingsnow matches requested files to METRICS sources throughrelativizeFilePath. That is feat(cli): route adf context --files modules from path tokens #452's resolver, the same one path tokens and rule locations use.adf-migrate.ts:packages/cliwith the repo-relative, cwd-relative and absolute paths, the rules, ceilings and full text output match the root run.resolveProjectContextwith an absolute aiDir gives the same rules, ceilings and text from the repo root, frompackages/and from a temp dir. The reviewer's probe case, which gaveceilings: []before this fix, is covered here.locate()and column-0 list items:SECTION_HEADER_REreads one. Before, it ended at the first unindented line.- rulewritten at column 0 gets its own line, not the header's.--format json.[task bundle, nothing-binds line, JSON].[line, JSON].docs/cli-reference.mdsay so. Tested.resolvePathTokenRootonce.preflightAnswer()helper.for <file>when only some of the files trigger that module.for the task keywordswhen the module came only from--keywordsor the MCP task.rules[]shape is unchanged. A per-rulefileskey would be additive, and is left as a follow-up.Earlier rounds, still in place: absolute and Windows paths, the parse guard (
unreadable[], exit code 0), exact section-header matching, the import-cycle fix, repo-root display paths, the short MCP answer, and--bundletext on stderr.Real output from this run (rebuilt
dist, Windows, PowerShell)From the repo root:
From
packages/cli, with a cwd-relative path and an absolute Windows path, the output is identical, line for line:From
packages/cliwith the repo-relative path, the case the major finding was about. Headroom is present:(Git Bash rewrites a
C:/...argument intoC;C:/Program Files/Git/..., so I ran the absolute-path examples in PowerShell.)Tests
adf-preflight-cwd.test.ts(10 tests):packages/cli, with repo-relative, cwd-relative and absolute pathslocate()with column-0 items, unit and end to endadf-preflight.test.ts(9) andadf-preflight-guards.test.ts(14): unchanged and passing.tsc --buildandtsc --noEmitare clean. The pre-commit hook passed (tsc andadf evidence). No ceilings were changed or recalibrated, andadf_migrate_locis untouched at 792/792.smart-commit.shcan't set a message or trailers.Not in this slice / follow-ups
nextActions[]is not built yet.fileskey to JSONrules[]would be additive, and is left for a later slice.bindscovers the combined file and task keywords. TheNothing binds <files>line is still accurate then, because neither the files nor the task resolved an on-demand module.adf evidencegate still measures METRICS paths from cwd (adf context --files: report live ceiling headroom for each file #443 shares the measurement helper, but the gate was left as is).🤖 Generated with Claude Code