You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Defer ink and @/app loading in cli.tsx until the interactive TUI branch so --acp (and other non-TUI paths) no longer pay the Ink/App module-graph cost at startup. Extract a framework-free parseContextLimit() for --context-max, add ACP startup metrics to the quality benchmark, refresh the baseline, and correct ACP vs legacy --vscode docs.
Related to #810 — first step toward Headless API Mode. --acp already runs the Ink-free ACP server; this PR removes the remaining CLI-level cost of resolving Ink/App before that branch is taken.
Type of Change
Bug fix
New feature
Breaking change
Documentation update
Changeset
Added a changeset (pnpm changeset) describing this change for the changelog
Docs-only or internal chores need no changeset (or run pnpm changeset --empty to note that intentionally).
Testing
Automated Tests
New features include passing tests in .spec.ts/tsx files
All existing tests pass (pnpm test:all completes successfully)
Tests cover both success and error scenarios
Focused coverage used for this change:
pnpm run test:ava source/cli.spec.ts source/app/utils/app-util.spec.ts source/app/utils/handlers/context-max-handler.spec.ts source/acp/acp-capabilities.spec.ts
pnpm run test:types && pnpm run test:format && pnpm run test:lint
pnpm run build && pnpm run test:benchmark (confirms acp_module_count / acp_boot_ms_approx)
Manual Testing
Tested with Ollama
Tested with OpenRouter
Tested with OpenAI-compatible API
Tested MCP integration (if applicable)
Manual smoke checks:
node dist/cli.js --json --acp run "hi" rejects with --json cannot be combined with --acp
node dist/cli.js --acp --provider … --model … starts the ACP server (no Ink TUI)
ACP module-URL capture shows no dist/app/App.js / dist/app/index.js
Checklist
Code follows project style guidelines
Self-review completed
Documentation updated (if needed)
No breaking changes (or clearly documented)
Appropriate logging added using structured logging (see CONTRIBUTING.md)
Thanks for this @AryanNandanwar , the core change is right and the win is bigger than the description suggests. I measured the module graph before/after on the built dist:
--acp: 612 -> 427 modules
--plain run: 597 -> 411 modules
copilot login: 593 -> 11 modules
So the eager Promise.all at the top of main() was costing every non-TUI path, not just ACP. Worth calling that out in the description.
A few things before this can go in:
pnpm test:knip fails, which is a required check. parseContextLimit at source/app/utils/handlers/context-max-handler.ts:15 is now an unused re-export once app-util.ts points at the new module. Deleting that export line should do it.
Please drop the benchmarks/baseline.json changes from this PR. audit_high_vulns: 2 → 17 is a security signal that shouldn't get absorbed by a startup-cost change, and the wall-clock numbers (interactive_boot_ms_approx 606 → 1415, first_render_ms_approx 549 → 1127) are machine-dependent, so committing them makes the baseline less useful for everyone else. The stale counters are worth refreshing, just as a separate chore PR.
This doesn't fully bypass Ink. source/custom-tools/formatter.tsx imports ink directly and is pulled in by the tool registry, so --acp and --plain still load all 54 Ink modules plus React. Could you switch Closes #810 to Refs #810 and reword the changeset to patch? Splitting the formatters out of tool registration is the follow-up that would actually close it, happy to open an issue for that.
Minor: a spec next to the new source/utils/parse-context-limit.ts would be good, right now it's only covered transitively through app-util.spec.ts.
pnpm test:types and the focused specs both pass on my end.
Hey @will-lamerton , I've made the required changes. Changed the PR Description to Refs instead of closes.
I'd be happy to work on the Ink import in formatter as well
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
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 #810
Description
Defer
inkand@/apploading incli.tsxuntil the interactive TUI branch so--acp(and other non-TUI paths) no longer pay the Ink/App module-graph cost at startup. Extract a framework-freeparseContextLimit()for--context-max, add ACP startup metrics to the quality benchmark, refresh the baseline, and correct ACP vs legacy--vscodedocs.Related to #810 — first step toward Headless API Mode.
--acpalready runs the Ink-free ACP server; this PR removes the remaining CLI-level cost of resolving Ink/Appbefore that branch is taken.Type of Change
Changeset
pnpm changeset) describing this change for the changelogDocs-only or internal chores need no changeset (or run
pnpm changeset --emptyto note that intentionally).Testing
Automated Tests
.spec.ts/tsxfilespnpm test:allcompletes successfully)Focused coverage used for this change:
pnpm run test:ava source/cli.spec.ts source/app/utils/app-util.spec.ts source/app/utils/handlers/context-max-handler.spec.ts source/acp/acp-capabilities.spec.tspnpm run test:types && pnpm run test:format && pnpm run test:lintpnpm run build && pnpm run test:benchmark(confirmsacp_module_count/acp_boot_ms_approx)Manual Testing
Manual smoke checks:
node dist/cli.js --json --acp run "hi"rejects with--json cannot be combined with --acpnode dist/cli.js --acp --provider … --model …starts the ACP server (no Ink TUI)dist/app/App.js/dist/app/index.jsChecklist