@nuvin/nuvin-code 0.0.0-rc.0
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 +244 -0
- package/dist/README.md +244 -0
- package/dist/VERSION +4 -0
- package/dist/index.js +2 -0
- package/package.json +63 -0
package/README.md
ADDED
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
# @nuvin/nuvin-code
|
|
2
|
+
|
|
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.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
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.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Architecture
|
|
22
|
+
|
|
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
|
+
```
|
|
78
|
+
|
|
79
|
+
### Key Design Patterns
|
|
80
|
+
|
|
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. |
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Getting Started
|
|
92
|
+
|
|
93
|
+
### Prerequisites
|
|
94
|
+
|
|
95
|
+
- **Node.js** ≥ 22
|
|
96
|
+
- **npm**, **pnpm**, or **yarn** (monorepo workspace setup with `pnpm` recommended)
|
|
97
|
+
|
|
98
|
+
### Install Dependencies
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
pnpm install
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Development
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
# Run in dev mode with hot reload
|
|
108
|
+
pnpm dev
|
|
109
|
+
|
|
110
|
+
# Run with file watcher
|
|
111
|
+
pnpm dev:watch
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Build
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
pnpm build
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Output is written to `dist/`. The CLI entry point is `dist/index.js`.
|
|
121
|
+
|
|
122
|
+
### Run Tests
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
# Run all tests once
|
|
126
|
+
pnpm test
|
|
127
|
+
|
|
128
|
+
# Run tests in watch mode
|
|
129
|
+
pnpm test:watch
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Test files are co-located alongside source files using the `.test.ts` / `.test.tsx` convention, run via [Vitest](https://vitest.dev/).
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## Configuration
|
|
137
|
+
|
|
138
|
+
### Config File
|
|
139
|
+
|
|
140
|
+
The CLI loads configuration from a `config.yaml` (or the path resolved by `@nuvin/config`). Example:
|
|
141
|
+
|
|
142
|
+
```yaml
|
|
143
|
+
database:
|
|
144
|
+
host: localhost
|
|
145
|
+
port: 5432
|
|
146
|
+
name: myapp_db
|
|
147
|
+
|
|
148
|
+
server:
|
|
149
|
+
port: 9000
|
|
150
|
+
timeout: 60
|
|
151
|
+
debug: true
|
|
152
|
+
ssl_enabled: true
|
|
153
|
+
|
|
154
|
+
features:
|
|
155
|
+
- login
|
|
156
|
+
- signup
|
|
157
|
+
- profile
|
|
158
|
+
- dashboard
|
|
159
|
+
- api_integration
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Environment Variables
|
|
163
|
+
|
|
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 |
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## Approval System
|
|
177
|
+
|
|
178
|
+
Tool calls fall into two categories:
|
|
179
|
+
|
|
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 |
|
|
184
|
+
|
|
185
|
+
When a tool requires approval, the **Approval Modal** appears with:
|
|
186
|
+
|
|
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
|
|
192
|
+
|
|
193
|
+
Navigate with `Tab`, confirm with `Enter`, dismiss with `Escape`.
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## Theming
|
|
198
|
+
|
|
199
|
+
The theme system automatically adapts to your terminal:
|
|
200
|
+
|
|
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
|
|
205
|
+
|
|
206
|
+
The theme is accessible via `useTheme()` in React components or `getTheme()` in vanilla code.
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
## Delegated Agents
|
|
211
|
+
|
|
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:
|
|
213
|
+
|
|
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
|
|
218
|
+
|
|
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.
|
|
220
|
+
|
|
221
|
+
---
|
|
222
|
+
|
|
223
|
+
## Key Dependencies
|
|
224
|
+
|
|
225
|
+
| Package | Purpose |
|
|
226
|
+
|---------|---------|
|
|
227
|
+
| `@nuvin/agent-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 |
|
|
239
|
+
|
|
240
|
+
---
|
|
241
|
+
|
|
242
|
+
## License
|
|
243
|
+
|
|
244
|
+
Private — All rights reserved.
|
package/dist/README.md
ADDED
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
# @nuvin/nuvin-code
|
|
2
|
+
|
|
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.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
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.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Architecture
|
|
22
|
+
|
|
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
|
+
```
|
|
78
|
+
|
|
79
|
+
### Key Design Patterns
|
|
80
|
+
|
|
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. |
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Getting Started
|
|
92
|
+
|
|
93
|
+
### Prerequisites
|
|
94
|
+
|
|
95
|
+
- **Node.js** ≥ 22
|
|
96
|
+
- **npm**, **pnpm**, or **yarn** (monorepo workspace setup with `pnpm` recommended)
|
|
97
|
+
|
|
98
|
+
### Install Dependencies
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
pnpm install
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Development
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
# Run in dev mode with hot reload
|
|
108
|
+
pnpm dev
|
|
109
|
+
|
|
110
|
+
# Run with file watcher
|
|
111
|
+
pnpm dev:watch
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Build
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
pnpm build
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Output is written to `dist/`. The CLI entry point is `dist/index.js`.
|
|
121
|
+
|
|
122
|
+
### Run Tests
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
# Run all tests once
|
|
126
|
+
pnpm test
|
|
127
|
+
|
|
128
|
+
# Run tests in watch mode
|
|
129
|
+
pnpm test:watch
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Test files are co-located alongside source files using the `.test.ts` / `.test.tsx` convention, run via [Vitest](https://vitest.dev/).
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## Configuration
|
|
137
|
+
|
|
138
|
+
### Config File
|
|
139
|
+
|
|
140
|
+
The CLI loads configuration from a `config.yaml` (or the path resolved by `@nuvin/config`). Example:
|
|
141
|
+
|
|
142
|
+
```yaml
|
|
143
|
+
database:
|
|
144
|
+
host: localhost
|
|
145
|
+
port: 5432
|
|
146
|
+
name: myapp_db
|
|
147
|
+
|
|
148
|
+
server:
|
|
149
|
+
port: 9000
|
|
150
|
+
timeout: 60
|
|
151
|
+
debug: true
|
|
152
|
+
ssl_enabled: true
|
|
153
|
+
|
|
154
|
+
features:
|
|
155
|
+
- login
|
|
156
|
+
- signup
|
|
157
|
+
- profile
|
|
158
|
+
- dashboard
|
|
159
|
+
- api_integration
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Environment Variables
|
|
163
|
+
|
|
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 |
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## Approval System
|
|
177
|
+
|
|
178
|
+
Tool calls fall into two categories:
|
|
179
|
+
|
|
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 |
|
|
184
|
+
|
|
185
|
+
When a tool requires approval, the **Approval Modal** appears with:
|
|
186
|
+
|
|
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
|
|
192
|
+
|
|
193
|
+
Navigate with `Tab`, confirm with `Enter`, dismiss with `Escape`.
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## Theming
|
|
198
|
+
|
|
199
|
+
The theme system automatically adapts to your terminal:
|
|
200
|
+
|
|
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
|
|
205
|
+
|
|
206
|
+
The theme is accessible via `useTheme()` in React components or `getTheme()` in vanilla code.
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
## Delegated Agents
|
|
211
|
+
|
|
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:
|
|
213
|
+
|
|
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
|
|
218
|
+
|
|
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.
|
|
220
|
+
|
|
221
|
+
---
|
|
222
|
+
|
|
223
|
+
## Key Dependencies
|
|
224
|
+
|
|
225
|
+
| Package | Purpose |
|
|
226
|
+
|---------|---------|
|
|
227
|
+
| `@nuvin/agent-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 |
|
|
239
|
+
|
|
240
|
+
---
|
|
241
|
+
|
|
242
|
+
## License
|
|
243
|
+
|
|
244
|
+
Private — All rights reserved.
|
package/dist/VERSION
ADDED