Skip to content

feat: user settings at ~/.baton/settings.json - #3

Merged
qiankunli merged 3 commits into
mainfrom
feat/settings-json
Jul 9, 2026
Merged

feat: user settings at ~/.baton/settings.json#3
qiankunli merged 3 commits into
mainfrom
feat/settings-json

Conversation

@qiankunli

Copy link
Copy Markdown
Collaborator
  • src/config/settings.ts: load/merge/validate with precedence env >
    settings.json > defaults; auto-creates the file with defaults on first run;
    corrupt or invalid values fall back instead of crashing the entry point
  • settings: defaultAgent, claudeExecutable (persistent alternative to
    BATON_CLAUDE_BIN), codexCommand, mentionBudgetChars
  • wired into TUI, REPL and bin help; mention/catch-up budgets now configurable
  • docs: design.md data layout renamed config.json → settings.json

Verified: bun run check green (51 tests, 6 new settings tests).

- src/cli/bin.ts: unified command entry — baton (TUI, default) / baton repl / baton sessions / baton help
- package.json: bin field so bun link exposes a global baton command (runs TS source directly, no build step)
- AGENTS.md: document local install via bun install && bun link, and why bun build --compile is avoided (opentui native FFI + Claude SDK dynamic loading)

Verified: bun link → baton help / sessions / TUI render smoke in pty all pass; bun run check green (41 tests).
Rework the TUI per user feedback (opening screen was a confusing empty rail +
modal with no obvious input): now baton opens straight into a chat, cursor in
the composer, type and go — same feel as claude/codex CLI.

- open baton → session auto-created, input focused immediately
- '@codex …' / '@claude …' message prefix switches the target agent; both
  agents share one timeline (colored speaker labels)
- switching agents auto-injects the other agent's latest turn summaries
  (buildCatchUpContext) so the newcomer needs no manual context handoff
- @bs_xxx cross-session mentions still work; Esc interrupts a running turn
- reduce: MessageState now records provider for speaker labeling
- approval modal fixed (explicit flexDirection/height so options render)

Verified: bun run check green (45 tests incl. 4 new catch-up tests); pty smoke
shows chat layout with focused composer.

Note: branch based on feat/cli-bin; PR shows its commit until #1 merges.
- src/config/settings.ts: load/merge/validate with precedence env >
  settings.json > defaults; auto-creates the file with defaults on first run;
  corrupt or invalid values fall back instead of crashing the entry point
- settings: defaultAgent, claudeExecutable (persistent alternative to
  BATON_CLAUDE_BIN), codexCommand, mentionBudgetChars
- wired into TUI, REPL and bin help; mention/catch-up budgets now configurable
- docs: design.md data layout renamed config.json → settings.json

Verified: bun run check green (51 tests, 6 new settings tests).
@qiankunli
qiankunli merged commit 2fe78c8 into main Jul 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants