feat(agent): enhance interactive CLI with colors, spinner, and status bar (#43)

* feat(agent): improve interactive CLI with colors, spinner, and status bar

- Add colors.ts module with ANSI terminal color utilities
- Add spinner animation for tool execution feedback
- Add persistent status bar showing session/provider/model
- Apply colors to welcome banner, prompts, commands, and suggestions
- Support NO_COLOR env for accessibility

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(agent): correct cursor position with ANSI-colored prompts

Strip ANSI escape codes when calculating visual length of prompt
to ensure cursor is positioned correctly after colored text.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(agent): prevent duplicate input echo in interactive CLI

Lazy-initialize readline.Interface only when multiline mode is active.
This prevents readline from interfering with autocomplete's raw mode,
which was causing user input to be echoed twice.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* refactor(agent): move CLI files to dedicated cli/ directory

Reorganize CLI-related files into src/agent/cli/ for better separation:
- interactive.ts (was interactive-cli.ts)
- non-interactive.ts (was cli.ts)
- profile.ts, skills.ts, tools.ts (was *-cli.ts)
- autocomplete.ts, colors.ts, output.ts (CLI utilities)

Update all imports, package.json scripts, and build configuration.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Jiayuan Zhang 2026-01-31 21:07:07 +08:00 committed by GitHub
parent b7e1063b3a
commit b1d80f29ae
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 437 additions and 87 deletions

View file

@ -12,11 +12,11 @@
},
"scripts": {
"dev": "concurrently -n gateway,console,web -c blue,yellow,green \"pnpm dev:gateway\" \"pnpm dev:console\" \"pnpm dev:web\"",
"agent:cli": "tsx --env-file=.env src/agent/cli.ts",
"agent:interactive": "tsx --env-file=.env src/agent/interactive-cli.ts",
"agent:profile": "tsx --env-file=.env src/agent/profile-cli.ts",
"skills:cli": "tsx --env-file=.env src/agent/skills-cli.ts",
"tools:cli": "tsx --env-file=.env src/agent/tools-cli.ts",
"agent:cli": "tsx --env-file=.env src/agent/cli/non-interactive.ts",
"agent:interactive": "tsx --env-file=.env src/agent/cli/interactive.ts",
"agent:profile": "tsx --env-file=.env src/agent/cli/profile.ts",
"skills:cli": "tsx --env-file=.env src/agent/cli/skills.ts",
"tools:cli": "tsx --env-file=.env src/agent/cli/tools.ts",
"dev:gateway": "tsx --env-file=.env --watch src/gateway/main.ts",
"dev:console": "tsx --env-file=.env --watch src/console/main.ts",
"dev:web": "pnpm --filter @multica/web dev",