@nuvin/nuvin-cli 2.0.0-rc.14 → 2.0.0-rc.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +183 -125
- package/dist/README.md +183 -125
- package/dist/VERSION +2 -2
- package/dist/index.js +2 -0
- package/package.json +28 -71
- package/dist/AutoUpdater-GLKCOT3I.js +0 -1
- package/dist/TokenStorage-OZ7HSAEA.js +0 -1
- package/dist/UpdateChecker-KXSUKQKP.js +0 -1
- package/dist/chunk-3YTWOK4O.js +0 -1
- package/dist/chunk-AJHDLTY3.js +0 -1
- package/dist/chunk-BWIY46RS.js +0 -1
- package/dist/chunk-LBDREW4D.js +0 -1
- package/dist/chunk-LNOV575A.js +0 -1
- package/dist/chunk-NHBPZPAB.js +0 -1
- package/dist/chunk-NXU5OEYC.js +0 -1
- package/dist/chunk-WLSA5EYU.js +0 -1
- package/dist/chunk-ZYA3K6XN.js +0 -1
- package/dist/cli.js +0 -2
- package/dist/clipboard-ZREGZN7K.js +0 -1
- package/dist/demo-mode-LWWKK5HH.js +0 -1
- package/dist/mcp-handler-4NECBU7D.js +0 -1
- package/dist/messageProcessor-SGJ57DZ5.js +0 -1
- package/dist/profile-handler-QQEL2P7I.js +0 -1
- package/dist/start-3AVYS3QD.js +0 -1
- package/dist/useSessionManagement-GPVAFT7B.js +0 -1
package/README.md
CHANGED
|
@@ -1,186 +1,244 @@
|
|
|
1
1
|
# @nuvin/nuvin-cli
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
Your terminal, your choice of model, your rules—nothing hidden.
|
|
3
|
+
A full-featured terminal UI (TUI) coding assistant built with **React** and **Ink**. It provides an interactive, streaming chat interface in your terminal that connects to LLM providers (Anthropic, OpenAI-compatible) and gives the assistant a suite of workspace tools — file reading/writing, search, shell execution, and more — with a human-in-the-loop approval system for safety-critical operations.
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
**Provider Freedom** — Use any LLM provider without lock-in. Supports OpenRouter, Anthropic, GitHub Models, DeepInfra, ZAI, Moonshot, Kimi, MiniMax out of the box. Switch models mid-conversation.
|
|
5
|
+
---
|
|
9
6
|
|
|
10
|
-
|
|
7
|
+
## Features
|
|
11
8
|
|
|
12
|
-
**
|
|
9
|
+
- **Interactive Terminal UI** — Full-screen TUI with virtualized message list, scrolling, keyboard navigation, and alt-screen buffer support.
|
|
10
|
+
- **Streaming Responses** — Real-time streaming of assistant text, reasoning, and tool output as they arrive.
|
|
11
|
+
- **Workspace Tools** — Built-in tools for file inspection (`FileRead`, `Ls`, `Glob`, `Grep`), file editing (`FileEdit`, `FileNew`), and shell execution (`Bash`).
|
|
12
|
+
- **Human-in-the-Loop Approvals** — Tool calls that modify state (e.g., `Bash`, `FileEdit`, `FileNew`) require explicit user approval before execution. Read-only tools (`FileRead`, `Ls`, `Glob`, `Grep`) are auto-approved.
|
|
13
|
+
- **Delegated Agents** — Pluggable agent delegation system (`AssignTask`) for spawning specialist sub-agents (code review, debugging, planning, etc.) with nested message rendering.
|
|
14
|
+
- **Rich Markdown Rendering** — Terminal-optimized markdown with syntax highlighting, table rendering, emoji support, and configurable text reflow.
|
|
15
|
+
- **Theming Engine** — Adaptive light/dark theme with automatic terminal color-depth detection, background fills, dim variants for modals, and full customization via config/env variables.
|
|
16
|
+
- **Diff View** — Inline file-diff rendering for `FileEdit` tool calls showing additions, removals, and context lines with color-coded highlighting.
|
|
17
|
+
- **Customizable Chat Model** — Configurable LLM provider with support for Anthropic Messages API, OpenAI-compatible endpoints, bearer/API-key auth schemes, and reasoning effort settings.
|
|
13
18
|
|
|
14
|
-
|
|
19
|
+
---
|
|
15
20
|
|
|
16
|
-
|
|
21
|
+
## Architecture
|
|
17
22
|
|
|
18
|
-
|
|
23
|
+
```
|
|
24
|
+
src/
|
|
25
|
+
├── index.ts # Entry point — boots the app
|
|
26
|
+
├── root.tsx # Main bootstrap: config, model, agent, render
|
|
27
|
+
├── app.tsx # Root React component — state, events, approvals
|
|
28
|
+
├── components/
|
|
29
|
+
│ ├── Header.tsx # Top bar: brand, cwd, model name, approval mode
|
|
30
|
+
│ ├── Composer.tsx # User input field with busy/idle states
|
|
31
|
+
│ ├── MessageList.tsx # Virtualized scrollable message list
|
|
32
|
+
│ ├── MessageRow.tsx # Renders a single message (text or tool)
|
|
33
|
+
│ ├── ToolMessageRow.tsx # Tool-specific message rendering
|
|
34
|
+
│ ├── ApprovalModal.tsx # Modal for approving/denying tool calls
|
|
35
|
+
│ ├── StatusFooter.tsx # Footer with hints + live memory usage
|
|
36
|
+
│ ├── Modal.tsx # Generic modal overlay component
|
|
37
|
+
│ ├── ChildMessagesContext.tsx # Context for nested delegation messages
|
|
38
|
+
│ └── tool-renders/ # Per-tool renderers
|
|
39
|
+
│ ├── BashToolRender.tsx
|
|
40
|
+
│ ├── FileReadToolRender.tsx
|
|
41
|
+
│ ├── FileEditToolRender.tsx
|
|
42
|
+
│ ├── FileNewToolRender.tsx
|
|
43
|
+
│ ├── FileDiffView.tsx # Inline diff display
|
|
44
|
+
│ ├── GlobToolRender.tsx
|
|
45
|
+
│ ├── GrepToolRender.tsx
|
|
46
|
+
│ ├── LsToolRender.tsx
|
|
47
|
+
│ ├── AssignTaskToolRender.tsx
|
|
48
|
+
│ ├── UnknownToolRender.tsx
|
|
49
|
+
│ └── ...
|
|
50
|
+
└── lib/
|
|
51
|
+
├── agent-channel.ts # Event bridge between Agent and React UI
|
|
52
|
+
├── approvals/
|
|
53
|
+
│ └── queue.ts # Approval queue with FIFO processing
|
|
54
|
+
├── chat/
|
|
55
|
+
│ └── model.ts # Chat model factory (provider config, auth)
|
|
56
|
+
├── diagnostics/
|
|
57
|
+
│ └── memory.ts # Memory tracking & diagnostics
|
|
58
|
+
├── markdown/ # Markdown → terminal rendering pipeline
|
|
59
|
+
│ ├── cache.ts
|
|
60
|
+
│ ├── provider.ts # Cached Marked instance management
|
|
61
|
+
│ ├── render.ts
|
|
62
|
+
│ └── renderers/
|
|
63
|
+
│ ├── terminal-renderer.ts
|
|
64
|
+
│ ├── code-highlighter.ts
|
|
65
|
+
│ ├── table-renderer.ts
|
|
66
|
+
│ ├── list-renderer.ts
|
|
67
|
+
│ ├── text-reflow.ts
|
|
68
|
+
│ ├── emoji-processor.ts
|
|
69
|
+
│ └── text-utils.ts
|
|
70
|
+
├── messages/
|
|
71
|
+
│ └── state.ts # Immutable message state machine
|
|
72
|
+
├── theme/
|
|
73
|
+
│ ├── runtime.ts # Theme resolution (light/dark, color depth)
|
|
74
|
+
│ └── store.ts # Zustand theme store with dim support
|
|
75
|
+
└── tools/
|
|
76
|
+
└── argsRenderer.ts # Tool argument formatting for approval UI
|
|
77
|
+
```
|
|
19
78
|
|
|
20
|
-
|
|
79
|
+
### Key Design Patterns
|
|
21
80
|
|
|
22
|
-
|
|
81
|
+
| Pattern | Description |
|
|
82
|
+
|---------|-------------|
|
|
83
|
+
| **Agent Channel** | Decouples the imperative `Agent` (constructed before React mounts) from the UI via an `EventEmitter`-based channel. The agent publishes events and requests tool decisions; `<App />` subscribes and resolves approvals. |
|
|
84
|
+
| **Immutable State** | All message and approval state transitions use pure functions that return new state objects, composed inside React's `setState`. |
|
|
85
|
+
| **Virtualized List** | Only visible messages are rendered (with overscan), using `@nuvin/ink-virtualized-list` for efficient scrolling through long conversations. |
|
|
86
|
+
| **Singleton Theme Store** | A Zustand store (not React Context) holds the resolved theme, enabling both React hook access (`useTheme()`) and vanilla JS snapshots (`getTheme()`). |
|
|
87
|
+
| **Cached Markdown Provider** | `Marked` instances are cached by config key (width, tokens, reflow) to avoid re-creating the parser pipeline on every render frame. |
|
|
23
88
|
|
|
24
|
-
|
|
89
|
+
---
|
|
25
90
|
|
|
26
|
-
|
|
27
|
-
# Install globally
|
|
28
|
-
npm install --global @nuvin/nuvin-cli
|
|
91
|
+
## Getting Started
|
|
29
92
|
|
|
30
|
-
|
|
31
|
-
npx @nuvin/nuvin-cli
|
|
93
|
+
### Prerequisites
|
|
32
94
|
|
|
33
|
-
|
|
34
|
-
npm
|
|
95
|
+
- **Node.js** ≥ 22
|
|
96
|
+
- **npm**, **pnpm**, or **yarn** (monorepo workspace setup with `pnpm` recommended)
|
|
35
97
|
|
|
36
|
-
|
|
37
|
-
pnpm add @nuvin/nuvin-cli
|
|
98
|
+
### Install Dependencies
|
|
38
99
|
|
|
39
|
-
|
|
40
|
-
|
|
100
|
+
```bash
|
|
101
|
+
pnpm install
|
|
41
102
|
```
|
|
42
103
|
|
|
43
|
-
|
|
104
|
+
### Development
|
|
44
105
|
|
|
45
106
|
```bash
|
|
46
|
-
#
|
|
47
|
-
|
|
107
|
+
# Run in dev mode with hot reload
|
|
108
|
+
pnpm dev
|
|
48
109
|
|
|
49
|
-
#
|
|
50
|
-
|
|
110
|
+
# Run with file watcher
|
|
111
|
+
pnpm dev:watch
|
|
112
|
+
```
|
|
51
113
|
|
|
52
|
-
|
|
53
|
-
nuvin --provider anthropic --model claude-sonnet-4-5
|
|
114
|
+
### Build
|
|
54
115
|
|
|
55
|
-
|
|
56
|
-
|
|
116
|
+
```bash
|
|
117
|
+
pnpm build
|
|
118
|
+
```
|
|
57
119
|
|
|
58
|
-
|
|
59
|
-
nuvin --config ./my-config.yaml
|
|
120
|
+
Output is written to `dist/`. The CLI entry point is `dist/index.js`.
|
|
60
121
|
|
|
61
|
-
|
|
62
|
-
nuvin --help
|
|
122
|
+
### Run Tests
|
|
63
123
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
124
|
+
```bash
|
|
125
|
+
# Run all tests once
|
|
126
|
+
pnpm test
|
|
67
127
|
|
|
68
|
-
|
|
128
|
+
# Run tests in watch mode
|
|
129
|
+
pnpm test:watch
|
|
130
|
+
```
|
|
69
131
|
|
|
70
|
-
|
|
132
|
+
Test files are co-located alongside source files using the `.test.ts` / `.test.tsx` convention, run via [Vitest](https://vitest.dev/).
|
|
71
133
|
|
|
72
|
-
|
|
73
|
-
# Start interactive mode with default provider
|
|
74
|
-
nuvin
|
|
134
|
+
---
|
|
75
135
|
|
|
76
|
-
|
|
77
|
-
nuvin --provider openrouter --model openai/gpt-4o
|
|
136
|
+
## Configuration
|
|
78
137
|
|
|
79
|
-
|
|
80
|
-
nuvin --provider anthropic --model claude-sonnet-4-5
|
|
138
|
+
### Config File
|
|
81
139
|
|
|
82
|
-
|
|
83
|
-
nuvin --provider github --model claude-sonnet-4.5
|
|
140
|
+
The CLI loads configuration from a `config.yaml` (or the path resolved by `@nuvin/config`). Example:
|
|
84
141
|
|
|
85
|
-
|
|
86
|
-
|
|
142
|
+
```yaml
|
|
143
|
+
database:
|
|
144
|
+
host: localhost
|
|
145
|
+
port: 5432
|
|
146
|
+
name: myapp_db
|
|
87
147
|
|
|
88
|
-
|
|
89
|
-
|
|
148
|
+
server:
|
|
149
|
+
port: 9000
|
|
150
|
+
timeout: 60
|
|
151
|
+
debug: true
|
|
152
|
+
ssl_enabled: true
|
|
90
153
|
|
|
91
|
-
|
|
92
|
-
|
|
154
|
+
features:
|
|
155
|
+
- login
|
|
156
|
+
- signup
|
|
157
|
+
- profile
|
|
158
|
+
- dashboard
|
|
159
|
+
- api_integration
|
|
93
160
|
```
|
|
94
161
|
|
|
95
|
-
###
|
|
162
|
+
### Environment Variables
|
|
96
163
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
164
|
+
| Variable | Description |
|
|
165
|
+
|----------|-------------|
|
|
166
|
+
| `API_KEY` | LLM provider API key (fallback if not in config) |
|
|
167
|
+
| `NUVIN_THEME_MODE` | Force `"dark"` or `"light"` theme |
|
|
168
|
+
| `NUVIN_THEME_BACKGROUNDS` | Background fills: `"on"`, `"off"`, or `"auto"` |
|
|
169
|
+
| `NUVIN_MESSAGE_STYLE` | Message styling: `"plain"` or `"tinted"` |
|
|
170
|
+
| `FORCE_COLOR` | Force color level (`0`=none, `1`=16-color, `2`=256-color, `3`=truecolor) |
|
|
171
|
+
| `NO_COLOR` | Disable all colors |
|
|
172
|
+
| `COLORFGBG` | Auto-detect light/dark terminal background |
|
|
100
173
|
|
|
101
|
-
|
|
102
|
-
nuvin --provider zai --model glm-4.7
|
|
103
|
-
```
|
|
174
|
+
---
|
|
104
175
|
|
|
105
|
-
|
|
176
|
+
## Approval System
|
|
106
177
|
|
|
107
|
-
|
|
178
|
+
Tool calls fall into two categories:
|
|
108
179
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
180
|
+
| Category | Tools | Behavior |
|
|
181
|
+
|----------|-------|----------|
|
|
182
|
+
| **Auto-approved** | `FileRead`, `Ls`, `Glob`, `Grep` | Execute immediately without prompting |
|
|
183
|
+
| **Requires approval** | `Bash`, `FileEdit`, `FileNew`, `AssignTask` | Pauses for user decision |
|
|
112
184
|
|
|
113
|
-
|
|
185
|
+
When a tool requires approval, the **Approval Modal** appears with:
|
|
114
186
|
|
|
115
|
-
|
|
187
|
+
- **Tool name & parameters** — scrollable argument display
|
|
188
|
+
- **Yes** (1) — approve this call
|
|
189
|
+
- **No** (2) — deny this call
|
|
190
|
+
- **Yes, for this session** (3) — auto-approve this tool for the rest of the session
|
|
191
|
+
- **Comment input** (4) — submit a change request / denial reason
|
|
116
192
|
|
|
117
|
-
|
|
193
|
+
Navigate with `Tab`, confirm with `Enter`, dismiss with `Escape`.
|
|
118
194
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
export ANTHROPIC_API_KEY=sk-ant-xxxxxxxx
|
|
123
|
-
export GITHUB_ACCESS_TOKEN=ghp_xxxxxxxxxxxx
|
|
124
|
-
|
|
125
|
-
# Optional Tool Configuration
|
|
126
|
-
export GOOGLE_CSE_KEY=your_google_cse_key
|
|
127
|
-
export GOOGLE_CSE_CX=your_search_engine_id
|
|
128
|
-
```
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## Theming
|
|
129
198
|
|
|
130
|
-
|
|
199
|
+
The theme system automatically adapts to your terminal:
|
|
131
200
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
-
|
|
135
|
-
|
|
136
|
-
- "Set up automated testing for my codebase"
|
|
137
|
-
- "Refactor this function to follow SOLID principles"
|
|
201
|
+
1. **Mode** — Detects light vs. dark background via `COLORFGBG` or `NUVIN_THEME_MODE`
|
|
202
|
+
2. **Color Level** — Reads `FORCE_COLOR` / `NO_COLOR` or probes `stdout.getColorDepth()`
|
|
203
|
+
3. **Backgrounds** — Enables colored surface fills only when truecolor/256-color is available (off by default in light mode)
|
|
204
|
+
4. **Dim Variant** — When a modal opens, all background colors blend toward a neutral target so the overlay stands out
|
|
138
205
|
|
|
139
|
-
|
|
140
|
-
- "Delegate code review to the specialist agent"
|
|
141
|
-
- "Create a comprehensive test suite for this module"
|
|
142
|
-
- "Research documentation for this API and create usage examples"
|
|
143
|
-
- "Organize my git changes into conventional commits"
|
|
144
|
-
- "Have the architect review this design and suggest improvements"
|
|
206
|
+
The theme is accessible via `useTheme()` in React components or `getTheme()` in vanilla code.
|
|
145
207
|
|
|
146
|
-
|
|
208
|
+
---
|
|
147
209
|
|
|
148
|
-
|
|
149
|
-
- **[Commands Reference](docs/commands.md)** - Built-in commands and usage examples
|
|
150
|
-
- **[MCP Integration](docs/mcp-integration.md)** - Model Context Protocol setup and usage
|
|
151
|
-
- **[Specialist Agents](docs/agents.md)** - Multi-agent system and delegation guide
|
|
152
|
-
- **[Development Guide](docs/development.md)** - Contributing and development workflow
|
|
153
|
-
- **[Tool Approval Renderers](docs/tool-approval-renderers.md)** - Tool approval system and custom renderers
|
|
210
|
+
## Delegated Agents
|
|
154
211
|
|
|
155
|
-
|
|
212
|
+
The CLI supports a pluggable agent delegation system. Agent definitions are discovered from configured directories and can be enabled/disabled per profile. When enabled, the coordinator agent can delegate subtasks to specialists:
|
|
156
213
|
|
|
157
|
-
|
|
214
|
+
- **Code Reviewer** — Reviews code for quality, bugs, and best practices
|
|
215
|
+
- **React Senior Dev** — Expert React/TypeScript/CSS implementation
|
|
216
|
+
- **News Collector** — Gathers current news and updates
|
|
217
|
+
- **GSD Agents** — Planning, execution, verification, debugging workflows
|
|
158
218
|
|
|
159
|
-
|
|
160
|
-
- Ensure Node.js 18+ is installed: `node --version`
|
|
161
|
-
- Clear npm cache: `npm cache clean --force`
|
|
162
|
-
- Use specific version: `npm install -g @nuvin/nuvin-cli@latest`
|
|
219
|
+
Delegated agents run with their own tool set and publish events back through the `AgentChannel`, rendered as nested messages under the parent `AssignTask` tool call.
|
|
163
220
|
|
|
164
|
-
|
|
165
|
-
- Check API keys are set correctly as environment variables
|
|
166
|
-
- Verify keys have proper permissions for the provider
|
|
167
|
-
- Test with free models first before upgrading
|
|
221
|
+
---
|
|
168
222
|
|
|
169
|
-
|
|
170
|
-
- Validate YAML syntax (use online validator)
|
|
171
|
-
- Check file paths are correct
|
|
172
|
-
- Use absolute paths if relative paths fail
|
|
223
|
+
## Key Dependencies
|
|
173
224
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
-
|
|
177
|
-
|
|
225
|
+
| Package | Purpose |
|
|
226
|
+
|---------|---------|
|
|
227
|
+
| `@nuvin/nuvin-core` | Agent runtime, tool definitions, chat model abstractions |
|
|
228
|
+
| `@nuvin/config` | Configuration management, profiles, env loading |
|
|
229
|
+
| `@nuvin/ink` | React-based terminal rendering (fork of Ink) |
|
|
230
|
+
| `@nuvin/ink-input` | Keyboard input handling |
|
|
231
|
+
| `@nuvin/ink-text-input` | Text input component |
|
|
232
|
+
| `@nuvin/ink-virtualized-list` | Virtualized scrolling list |
|
|
233
|
+
| `react` / `react-dom` | UI framework |
|
|
234
|
+
| `zustand` | Lightweight state management (theme store) |
|
|
235
|
+
| `marked` | Markdown parsing |
|
|
236
|
+
| `chalk` | Terminal color utilities |
|
|
237
|
+
| `cli-highlight` | Syntax highlighting |
|
|
238
|
+
| `vitest` | Test framework |
|
|
178
239
|
|
|
179
|
-
|
|
180
|
-
- Run `nuvin --help` for command options
|
|
181
|
-
- Check [GitHub Issues](https://github.com/marschhuynh/nuvin-cli/issues) for known problems
|
|
182
|
-
- Enable debug mode (if available) for detailed logs
|
|
240
|
+
---
|
|
183
241
|
|
|
184
242
|
## License
|
|
185
243
|
|
|
186
|
-
|
|
244
|
+
Private — All rights reserved.
|