feat(commands): add inline overrides for slash commands - #1183
Open
MayurK-cmd wants to merge 1 commit into
Open
Conversation
MayurK-cmd
requested review from
Avtrkrb,
akramcodez and
will-lamerton
as code owners
September 4, 2026 11:30
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.
Description
Slash commands now accept inline
?key=valueoverrides that scope a setting to the current command only. Lets users test a value for one command without round-tripping through/settingsor otherwise mutating the session state.How it works
parseInlineOverrides(args)(new, pure) splits an args array into{args, overrides}. Only tokens starting with?areconsidered; bad keys (leading digit, whitespace) are kept in
argsso the command's own "unknown arg" path runs.expandOverrideArgs(overrides)turns recognised legacy keys (preview,llm,mechanical,aggressive,conservative,auto-on,auto-off) into the corresponding--flag valuetokens, so existing handlers see them as if the user had typed thelong form.
applyOnceOverrides(overrides)is async and writes recognised session-override keys (threshold,auto-compact,context-max)to the existing
setAutoCompactThreshold/setAutoCompactEnabled/setSessionContextLimitsetters. It returns arestorecallback that the dispatcher calls in a
finallyblock, so the override only persists for the single command invocation.source/app/utils/app-util.tsis wrapped in atry/finallysorestorealways runs, even if ahandler throws.
Adding a new inline-override key is a one-line change: add a
caseinapplyOnceOverridesand (if it isn't an existing--flag)optionally add an entry in
LEGACY_FLAG_NAMES.Why async
applyOnceOverridesdefers the heavyauto-compact/models-dev-clientimports via dynamicimport()so the parser itself is import-free. Without this, the spec timed out under AVA's serial worker because importing@/utils/auto-compactpulls in the chat-handler / config / tokenization init graph.Files
source/utils/inline-overrides.ts(new)source/utils/inline-overrides.spec.ts(new)source/app/utils/app-util.ts(wrap dispatcher in try/finally, rebuildcommandPartsfromparseInlineOverrides+expandOverrideArgs)source/app/utils/app-util.spec.ts(4 new dispatcher tests).changeset/inline-once-overrides.md(minor: new feature).gitignore(.pnpm-store/)Out of scope
The pre-existing
bash command - queues a completed BashProgress with showOutputtest inapp-util.spec.tsstill fails on this branch (it has been failing since #826 / July 2026). It is unrelated to this change and is not fixed here. Worth a separate issue.Type of Change
Changeset
pnpm changeset) describing this change for the changelog.changeset/inline-once-overrides.mdis aminorchangeset naming@nanocollective/nanocoderand explaining the new?key=valuesyntax. Validated locally with
node scripts/validate-changesets.js(72 changesets checked, all resolve).Docs-only or internal chores need no changeset (or run
pnpm changeset --emptyto note that intentionally).Testing
Automated Tests
.spec.ts/tsxfilespnpm test:allcompletes successfully)Verified locally:
pnpm test:ava source/utils/inline-overrides.spec.ts→ 16/16 passedpnpm test:ava source/app/utils/app-util.spec.ts→ all 4 new inline-override tests passed; one pre-existing unrelated failure(
bash command - queues a completed BashProgress with showOutput, present since feat: add session-scoped artifact lifecycle across CLI and VS Code #826) — see "Out of scope" abovepnpm test:types→ cleanpnpm test:lint→ 516 files, 0 fixes neededThe 16 parser/helper tests cover: empty input, single key=value, mixed positional + override, bare
?flag(no=),?key=valuewith extra
=in value, dotted/dashed/underscored keys, invalid keys preserved in args,expandOverrideArgsfor both boolean and key=value forms and unknown keys, plusapplyOnceOverridessmoke tests for empty input, unknown keys, unparseablethresholdvalues, and unparseablecontext-maxvalues.Manual Testing
This change is provider-agnostic — the override is wired into the slash-command dispatcher, not into any provider's chat pipeline.
Manual end-to-end testing against a real provider was not done as part of this PR; the change was validated via the unit/
integration tests listed above. The session-override stores it writes to (
auto-compact,setSessionContextLimit) are alreadycovered by their own specs and used in production by
/compact --thresholdand/context-max <n>.Checklist
No documentation update included in this PR — the override syntax is a small extension of existing
--flagbehaviour and the new docblock onapplyOnceOverridesdocuments the public surface. Happy to add a docs page if reviewers want one.No logging added: the override is purely a session-override passthrough that uses the existing setter functions. A successful
override is observable via the normal command result (e.g.
/compact ?threshold=80prints the same "Auto-compact threshold set to 80%" success message as/compact --threshold 80). Failures (unparseable values) are silently ignored per the same behaviour the existing--thresholdparser already follows (the value simply isn't applied).