Repository navigation
feat(cli): route adf context --files modules from path tokens - #452
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]>
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]>
Member
Author
|
Review follow-up (eb3c0a1):
Committed with a plain Conventional Commit, since |
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]>
Member
Author
|
Round 3 changes (merge 2648897, fix 55b605f):
|
stackbilt-admin
pushed a commit
that referenced
this pull request
Nov 28, 2026
…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]>
stackbilt-admin
pushed a commit
that referenced
this pull request
Nov 28, 2026
…o content change) Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Nov 28, 2026
Closed
Open
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
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]>
This was referenced Nov 28, 2026
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.
Summary
packages/cli/src/commands/adf-path-tokens.tsholds all--fileskeyword derivation:filePathToTokens()splits each path into its own name tokens (kebab, snake, dot, camelCase,/and\), drops a small stop-list of generic segments (packages,src,lib,dist,build,index,main, test dirs, extensions,node_modules, pure numbers), and returns lowercase tokens.filePathToKeywords()(the existing extension and directory signals) moved here unchanged and is re-exported fromadf-context.tsfor existing importers.filePathRoutingKeywords()combines both. It makes each path repo-relative once and runs both signals on that relative path.relativizeFilePath):git rev-parse --show-toplevelrun from the--ai-dir's parent, or that parent itself outside git. It is memoized per.ai/location, so git runs at most once per process (including a long-runningserve)../and../.fs.realpathSyncon both sides. A path that doesn't exist yet resolves through its deepest existing parent.--files packages/adf/src/manifest.tsrun frompackages/cligivesadf, manifest, notcli, adf, manifest.Users,home, orapi/,test/,session/folders) never become keywords. A path outside the repo adds no path tokens and no directory signals; only its extension signals count.--format jsonoutput gains an additivetriggerMatcheskey, the samebuildTriggerReportshape--bundlealready emits, so agents can see which token matched which trigger. Existing keys (keywords,resolvedModules, andceilingsfrom feat(cli): report live ceiling headroom in adf context --files #454) and exit codes are unchanged.--bundlenow works together with path routing:adf context --files packages/adf/src/manifest.ts --bundle --format jsonexits 0 and resolvescore.adf, state.adf, adf-dev.adf.Routing (fixture that mirrors this repo's manifest, typed-data-access.adf included)
packages/adf/src/manifest.tsadf-dev.adf(tokenadfmatched triggerADF)packages/cli/src/commands/adf-migrate.tsadf-dev.adfpackages/cli/src/commands/validate.tsgovernance.adfpackages/blast/src/index.tsanalysis.adfpackages/cli/src/commands/tenant-quota.tstyped-data-access.adfserve.ts,context-refresh.ts,ci.ymlTests
adf-path-tokens.test.ts: the tokenizer, the routing table, the JSON trigger report, and these guards:api/test/session/givesdocs, readmeand defaults only for<abs>/docs/readme.txt, the same as the repo-relative spelling;packages/clicwd;relativizeFilePathfor POSIX and Windows paths.adf-path-root.test.ts: git runs once across repeated lookups and repeatedadf contextruns with several--files.adf-ceilings.test.ts(from main): the key-order assertion now expectstriggerMatchesbetweenresolvedModulesandceilings.adf-path-tokens,adf-path-root,adf-context,adf-ceilings,context-parity): 60/60 pass.tsc --buildandtsc --noEmitare clean.Not in this PR
MCP (
serve.ts) does not use path tokens yet; #455 covers that. #455 needs a rebase onto this so that it callsfilePathRoutingKeywordswithresolvePathTokenRoot, which keeps the CLI and MCP in agreement.Closes #442
Part of #437
🤖 Generated with Claude Code