Skip to content

fix(cli): MCP/CLI task tokenizer parity and adf context --bundle paths - #453

Merged
stackbilt-admin merged 1 commit into
mainfrom
fix/issue-438-439-context-parity
Nov 28, 2026
Merged

stackbilt-admin merged 1 commit into
mainfrom
fix/issue-438-439-context-parity

Conversation

@stackbilt-admin

Copy link
Copy Markdown
Member

Summary

Two context bugs, fixed together. Both gave agents a wrong or missing governance answer with no signal that anything had gone wrong.

#438: MCP getProjectContext drops on-demand rules on trailing punctuation

  • getProjectContext split the task on whitespace only, so ADF. never matched the ADF trigger.
  • New packages/cli/src/commands/project-context.ts (resolveProjectContext) tokenizes with the CLI's tokenizeTask. serve.ts now calls it.
  • I checked every other MCP tool. getProjectContext is the only one that takes a task string, so nothing else needed changing.
  • Note: the telemetry keywords for mcp.getProjectContext now keep the original casing, the same as the CLI bundle and context sources. The old code lowercased them. Trigger matching was already case-insensitive. No output JSON keys or exit codes changed.

#439: adf context --bundle exits 2 with "Module not found: core.adf"

  • The readFile callback joined aiDir onto a path that bundleModules had already resolved. It now reads the path it is given.

Verification

Before the fix (built CLI, this repo):

  • adf context --files packages/adf/src/manifest.ts --keywords ADF --bundle --format json gave Bundle error (core.adf): Module not found: core.adf, exit 2.
  • MCP over stdio, getProjectContext: "...for ADF." returned 5,508 chars without the "zero runtime dependencies" rule. "...for ADF" returned 7,100 chars with the rule.

After the fix:

  • The adf context command exits 0 and resolves core.adf, state.adf, adf-dev.adf.
  • MCP returns 7,100 chars with the rule for both tasks.

Tests: new packages/cli/src/__tests__/context-parity.test.ts (8 tests):

  • CLI adf bundle and MCP resolveProjectContext resolve the same modules for the task with and without the trailing period.
  • adf context --bundle with --files, with --keywords, with both, and with a custom relative or absolute --ai-dir.
  • All 5 --bundle tests fail when only the old reader is put back.

Full suite on Windows: 2091 passed, 10 failed. Re-run in isolation, every failure passes except one known environmental case:

Closes #438
Closes #439
Part of #437

🤖 Generated with Claude Code

…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]>
@stackbilt-admin
stackbilt-admin merged commit 3d37d4f into main Nov 28, 2026
7 checks passed
@stackbilt-admin
stackbilt-admin deleted the fix/issue-438-439-context-parity branch November 28, 2026 02:08
stackbilt-admin pushed a commit that referenced this pull request Nov 28, 2026
Add 3.0.0 entries for #453 (MCP getProjectContext task tokenizer parity,
adf context --bundle path fix; #438, #439), #454 (live ceiling headroom in
adf context --files; #443), #382 (publish:check on Windows) and #385
(Dependabot covers the pinned SBOM generator).

Apply the #456 review nits: drop the two stray blank lines that made the
Changed list loose, and note that #425 also updated the supply-chain
workflow and dependabot.yml comments.

The 3.0.0 date placeholder is left for the release owner.

Refs #397

Co-Authored-By: Claude Opus 5.5 <[email protected]>
stackbilt-admin pushed a commit that referenced this pull request Nov 28, 2026
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]>
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 added a commit that referenced this pull request Nov 28, 2026
Add 3.0.0 entries for #453 (MCP getProjectContext task tokenizer parity,
adf context --bundle path fix; #438, #439), #454 (live ceiling headroom in
adf context --files; #443), #382 (publish:check on Windows) and #385
(Dependabot covers the pinned SBOM generator).

Apply the #456 review nits: drop the two stray blank lines that made the
Changed list loose, and note that #425 also updated the supply-chain
workflow and dependabot.yml comments.

The 3.0.0 date placeholder is left for the release owner.

Refs #397

Co-authored-by: Kurt Overmier <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants