feat(app): structured launch options with per-tool default args/env - #111
Conversation
Introduces src/line-editor.ts: a single-line text input with a cursor (insert at cursor, ←/→, home/end, backspace/delete, and emacs ctrl a/e/u/k/w bindings) plus renderLineWindow, which horizontally scrolls so the cursor stays visible within a width and draws a reverse-video cursor. Makes the tool-picker renderBox ANSI-aware (stripAnsi width + truncateAnsi truncation + visible-aware padding) so the reverse-video cursor cell no longer breaks box layout, and guards against negative width on tiny terminals. No overlay behavior change yet; wiring follows. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The "o" overlay is now a structured editor with two cursor-editable fields — "Extra args" (appended to the tool's defaults) and "Env vars" (space-separated NAME=VALUE) — switched with Tab/↑↓. The tool's default command is shown read-only so users no longer retype --dangerously-skip-permissions, and a live preview plus inline validation show the resulting launch. Enter builds a LaunchOverride that keeps the tool's own command, so aimux hooks/session tracking always apply. Replaces the toolOptions* host fields with a single launchOptionsState, adds parseEnvAssignments to shell-args, and uses the new line editor for in-field cursor movement. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Adds a separate "O" (shift-o) overlay in the tool picker that opens the full editable command line (binary + args + env, smart-wrapping) — the power-user path — now with cursor movement via the line editor and a clear "full command" framing plus the hooks/raw note. The common cases stay on the structured "o" overlay. Wires a new "tool-advanced" overlay kind through dashboard-control routing and render dispatch and a handleToolAdvancedKey wrapper. Picker help now reads "[o] options [O] full command". Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… overlay Add optional defaultArgs/defaultEnv to ToolConfig. These apply on a plain launch and prefill (editable) in the "o" options dialog, so configured defaults are visible and overridable. Drop the Shift-O advanced full-command overlay in favor of the structured args + env editor. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughThis PR refactors the tool-picker overlay UI to use structured, in-memory line editors for managing launch arguments and environment variables, extends the tool configuration schema with user-default overrides, and introduces foundational text-editing and environment-parsing utilities. ChangesStructured Launch Options Overlay
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
The advanced full-command overlay that consumed it was removed, leaving no production callers. Delete the function and its test block. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Review-loop note (sub-agent findings, resolution recorded): A parallel review pass flagged two astral-plane edge cases in
Resolution: intentionally not fixed. This is a single-line editor for shell launch args and env vars — its realistic input domain is ASCII/BMP shell syntax (flags, paths, |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/shell-args.test.ts (1)
37-53: ⚡ Quick winConsider adding test coverage for variable name validation and multi-equals edge cases.
The existing tests correctly verify the core functionality and error handling. Adding coverage for these realistic edge cases would strengthen the test suite:
- Invalid variable name patterns – Test that names starting with digits or containing hyphens are rejected (e.g.,
123FOO=value,FOO-BAR=value) to validate the regex boundary behavior.- Values containing equals signs – Test that
FOO=bar=bazcorrectly parses as{FOO: "bar=baz"}to document support for values with embedded=(common in URLs, base64, etc.).📋 Example test cases
it("rejects variable names starting with digits", () => { expect(() => parseEnvAssignments("123FOO=value")).toThrow('invalid env var "123FOO=value"'); }); it("rejects variable names containing hyphens", () => { expect(() => parseEnvAssignments("FOO-BAR=value")).toThrow('invalid env var "FOO-BAR=value"'); }); it("supports values containing equals signs", () => { expect(parseEnvAssignments("URL=http://example.com?a=1&b=2")).toEqual({ URL: "http://example.com?a=1&b=2" }); });🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/shell-args.test.ts` around lines 37 - 53, Add unit tests to cover variable-name validation and multi-equals values for parseEnvAssignments: add tests that assert parseEnvAssignments("123FOO=value") and parseEnvAssignments("FOO-BAR=value") throw the same 'invalid env var "<token>"' error pattern used by existing tests, and add a test that parseEnvAssignments("FOO=bar=baz") (or an actual URL with =) returns { FOO: "bar=baz" } to verify values with embedded '=' are parsed as part of the value.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/shell-args.test.ts`:
- Around line 37-53: Add unit tests to cover variable-name validation and
multi-equals values for parseEnvAssignments: add tests that assert
parseEnvAssignments("123FOO=value") and parseEnvAssignments("FOO-BAR=value")
throw the same 'invalid env var "<token>"' error pattern used by existing tests,
and add a test that parseEnvAssignments("FOO=bar=baz") (or an actual URL with =)
returns { FOO: "bar=baz" } to verify values with embedded '=' are parsed as part
of the value.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: b2da6bbf-1c0c-4af3-9fde-1f39ca627ebc
📒 Files selected for processing (2)
src/shell-args.test.tssrc/shell-args.ts
💤 Files with no reviewable changes (1)
- src/shell-args.ts
Summary
Reworks the agent-launch
ooptions dialog into a structured, power-user-friendly editor and adds per-tool launch defaults.odialog — two editable fields, Extra args and Env vars, with cursor-aware line editing (emacs-stylectrl-a/e/u/k/w, arrows, home/end), a read-onlyDefaults:preview of the tool's base command, and a live preview of the final launch command with inline parse errors.CLAUDE_YOLO=1that gets wrapped into the launch (env KEY=VALUE … <command> <args>), the original motivation for this work.defaultArgs/defaultEnvonToolConfig. They apply on a plain launch and prefill (editable) in theodialog, so configured defaults are visible and overridable.isConfiguredToolCommand). Swapping the binary opts out cleanly. Reserved aimux env vars always win over user-supplied env.Implementation
src/line-editor.ts(new) — reusableLineState+applyLineEdit+renderLineWindowwith horizontal scroll and reverse-video cursor.src/shell-args.ts—LaunchOverride,parseShellArgs,parseEnvAssignments.src/multiplexer/tool-picker.ts— structured overlay,formatEnvDefaults,defaultsLaunchOverride.src/config.ts—ToolConfig.defaultArgs/defaultEnv.Test plan
src/line-editor.test.ts,src/multiplexer/tool-picker.test.ts,src/shell-args.test.tscover line editing, defaults override construction, env formatting, and shell-arg parsing.tsc --noEmitclean; full vitest suite green;yarn buildsucceeds.🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Refactor
Tests