@ngandu/ulicode 0.0.6
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/CHANGELOG.md +1081 -0
- package/README.md +312 -0
- package/dist/agents/definitions/ask.agent.md +53 -0
- package/dist/agents/definitions/audit-tests.agent.md +138 -0
- package/dist/agents/definitions/build.agent.md +111 -0
- package/dist/agents/definitions/execute.agent.md +99 -0
- package/dist/agents/definitions/explore.agent.md +57 -0
- package/dist/agents/definitions/fast.agent.md +48 -0
- package/dist/agents/definitions/plan-mode.agent.md +102 -0
- package/dist/agents/definitions/planner.agent.md +59 -0
- package/dist/chunk-3YYDXNUH.js +854 -0
- package/dist/chunk-3YYDXNUH.js.map +1 -0
- package/dist/chunk-IEV2IT3O.cjs +873 -0
- package/dist/chunk-IEV2IT3O.cjs.map +1 -0
- package/dist/chunk-MBWGSXBT.js +11927 -0
- package/dist/chunk-MBWGSXBT.js.map +1 -0
- package/dist/chunk-MS5RYNRK.js +137 -0
- package/dist/chunk-MS5RYNRK.js.map +1 -0
- package/dist/chunk-OXFO76JC.js +2633 -0
- package/dist/chunk-OXFO76JC.js.map +1 -0
- package/dist/chunk-PKRLG6A4.js +1756 -0
- package/dist/chunk-PKRLG6A4.js.map +1 -0
- package/dist/chunk-PUVEPQQ3.cjs +1805 -0
- package/dist/chunk-PUVEPQQ3.cjs.map +1 -0
- package/dist/chunk-R6JK3DE3.cjs +148 -0
- package/dist/chunk-R6JK3DE3.cjs.map +1 -0
- package/dist/chunk-Y3HWP75B.cjs +11974 -0
- package/dist/chunk-Y3HWP75B.cjs.map +1 -0
- package/dist/chunk-Y5PO67TG.cjs +2659 -0
- package/dist/chunk-Y5PO67TG.cjs.map +1 -0
- package/dist/cli.cjs +372 -0
- package/dist/cli.cjs.map +1 -0
- package/dist/cli.d.cts +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +370 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.cjs +16 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +165 -0
- package/dist/index.d.ts +165 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/permissions-NRD36MYI.cjs +40 -0
- package/dist/permissions-NRD36MYI.cjs.map +1 -0
- package/dist/permissions-RC7CYR5H.js +3 -0
- package/dist/permissions-RC7CYR5H.js.map +1 -0
- package/dist/project-q9WpahUs.d.cts +329 -0
- package/dist/project-q9WpahUs.d.ts +329 -0
- package/dist/storage-6P53PQBL.cjs +24 -0
- package/dist/storage-6P53PQBL.cjs.map +1 -0
- package/dist/storage-QELMNBZ2.js +3 -0
- package/dist/storage-QELMNBZ2.js.map +1 -0
- package/dist/tui.cjs +76 -0
- package/dist/tui.cjs.map +1 -0
- package/dist/tui.d.cts +1013 -0
- package/dist/tui.d.ts +1013 -0
- package/dist/tui.js +3 -0
- package/dist/tui.js.map +1 -0
- package/package.json +107 -0
package/README.md
ADDED
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
# Ulicode
|
|
2
|
+
|
|
3
|
+
A terminal-based coding agent TUI built with [Mastra](https://mastra.ai) and [pi-tui](https://github.com/badlogic/pi-mono).
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- 🤖 **Multi-model support**: Use Claude, GPT, Gemini, and 70+ other models via Mastra's unified model router
|
|
8
|
+
- 🔐 **Flexible auth**: Authenticate with OAuth or save named API keys for Anthropic, OpenAI, and Google
|
|
9
|
+
- 💾 **Persistent conversations**: Threads are saved per-project and resume automatically
|
|
10
|
+
- 🛠️ **Coding tools**: View files, edit code, run shell commands
|
|
11
|
+
- 📋 **Plan persistence**: Approved plans are saved as markdown files for future reference
|
|
12
|
+
- 📊 **Token tracking**: Monitor usage with persistent token counts per thread
|
|
13
|
+
- 🎨 **Beautiful TUI**: Polished terminal interface with streaming responses
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
Install from npm with your package manager of choice.
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install -g @ngandu/ulicode
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
After install, run:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
ulicode
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
If you prefer not to install packages globally, you can use `npx`:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npx @ngandu/ulicode
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
On first launch, an interactive onboarding wizard guides you through:
|
|
36
|
+
|
|
37
|
+
1. **Authentication** — log in with your AI provider or save a named API key
|
|
38
|
+
2. **Model packs** — choose default models for each mode (build / plan / fast)
|
|
39
|
+
3. **Observational Memory** — pick a model for OM (learns about you over time)
|
|
40
|
+
4. **YOLO mode** — auto-approve tool calls, or require manual confirmation
|
|
41
|
+
|
|
42
|
+
You can re-run setup anytime with `/setup`.
|
|
43
|
+
|
|
44
|
+
## Prerequisites
|
|
45
|
+
|
|
46
|
+
### Optional: `fd` for file autocomplete
|
|
47
|
+
|
|
48
|
+
The `@` file autocomplete feature uses [`fd`](https://github.com/sharkdp/fd), a fast file finder that respects `.gitignore`. Without it, `@` autocomplete silently does nothing.
|
|
49
|
+
|
|
50
|
+
Install with your package manager:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
# macOS
|
|
54
|
+
brew install fd
|
|
55
|
+
|
|
56
|
+
# Ubuntu/Debian
|
|
57
|
+
sudo apt install fd-find
|
|
58
|
+
|
|
59
|
+
# Arch
|
|
60
|
+
sudo pacman -S fd
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
On Ubuntu/Debian the binary is called `fdfind` — Ulicode detects both `fd` and `fdfind` automatically.
|
|
64
|
+
|
|
65
|
+
## Usage
|
|
66
|
+
|
|
67
|
+
### Starting a conversation
|
|
68
|
+
|
|
69
|
+
Type your message and press Enter. If the agent is already working, Enter queues your next message and sends it after the current run finishes.
|
|
70
|
+
|
|
71
|
+
### `@` file references
|
|
72
|
+
|
|
73
|
+
Type `@` followed by a partial filename to fuzzy-search project files and reference them in your message. This requires `fd` to be installed (see [Prerequisites](#prerequisites)).
|
|
74
|
+
|
|
75
|
+
- `@setup` — fuzzy-matches files like `setup.ts`, `setup.py`, etc.
|
|
76
|
+
- `@src/tui` — scoped search within a directory
|
|
77
|
+
- `@"path with spaces"` — quoted form for paths containing spaces
|
|
78
|
+
|
|
79
|
+
Select a suggestion with arrow keys and press Tab to insert it.
|
|
80
|
+
|
|
81
|
+
### Slash commands
|
|
82
|
+
|
|
83
|
+
| Command | Description |
|
|
84
|
+
| ------------------- | ------------------------------------------------ |
|
|
85
|
+
| `/new` | Start a new conversation thread |
|
|
86
|
+
| `/threads` | List and switch between threads |
|
|
87
|
+
| `/models` | Switch/manage model packs (built-in/custom) |
|
|
88
|
+
| `/custom-providers` | Manage custom OpenAI-compatible providers/models |
|
|
89
|
+
| `/mode` | Switch agent mode |
|
|
90
|
+
| `/subagents` | Configure subagent model defaults |
|
|
91
|
+
| `/om` | Configure Observational Memory models |
|
|
92
|
+
| `/think` | Set thinking level (Anthropic) |
|
|
93
|
+
| `/skills` | List available skills |
|
|
94
|
+
| `/diff` | Show modified files or git diff |
|
|
95
|
+
| `/name` | Rename current thread |
|
|
96
|
+
| `/cost` | Show token usage and estimated costs |
|
|
97
|
+
| `/review` | Review a GitHub pull request |
|
|
98
|
+
| `/hooks` | Show/reload configured hooks |
|
|
99
|
+
| `/mcp` | Show/reload MCP server connections |
|
|
100
|
+
| `/sandbox` | Manage allowed paths (add/remove dirs) |
|
|
101
|
+
| `/permissions` | View/manage tool approval permissions |
|
|
102
|
+
| `/settings` | General settings (notifications, YOLO, etc.) |
|
|
103
|
+
| `/yolo` | Toggle YOLO mode (auto-approve all tools) |
|
|
104
|
+
| `/resource` | Show/switch resource ID (tag for sharing) |
|
|
105
|
+
| `/thread:tag-dir` | Tag current thread with this directory |
|
|
106
|
+
| `/login` | Authenticate with OAuth or save a named API key |
|
|
107
|
+
| `/logout` | Log out from a provider |
|
|
108
|
+
| `/setup` | Re-run the interactive setup wizard |
|
|
109
|
+
| `/help` | Show available commands |
|
|
110
|
+
| `/exit` | Exit the TUI |
|
|
111
|
+
|
|
112
|
+
### Keyboard shortcuts
|
|
113
|
+
|
|
114
|
+
| Shortcut | Action |
|
|
115
|
+
| ----------- | --------------------------------------------------------------- |
|
|
116
|
+
| `Ctrl+C` | Interrupt current operation or clear input |
|
|
117
|
+
| `Ctrl+C` ×2 | Exit (double-tap) |
|
|
118
|
+
| `Ctrl+D` | Exit (when editor is empty) |
|
|
119
|
+
| `Ctrl+Z` | Suspend process (`fg` to resume) |
|
|
120
|
+
| `Alt+Z` | Undo last clear |
|
|
121
|
+
| `Ctrl+T` | Toggle thinking blocks visibility |
|
|
122
|
+
| `Ctrl+E` | Expand/collapse all tool outputs |
|
|
123
|
+
| `Enter` | Send a message, or queue a follow-up while the agent is running |
|
|
124
|
+
| `Ctrl+Y` | Toggle YOLO mode |
|
|
125
|
+
|
|
126
|
+
## Configuration
|
|
127
|
+
|
|
128
|
+
### Project-based threads
|
|
129
|
+
|
|
130
|
+
Threads are automatically scoped to your project based on:
|
|
131
|
+
|
|
132
|
+
1. Git remote URL (if available)
|
|
133
|
+
2. Absolute path (fallback)
|
|
134
|
+
|
|
135
|
+
This means conversations are shared across clones, worktrees, and SSH/HTTPS URLs of the same repository.
|
|
136
|
+
|
|
137
|
+
### Database location
|
|
138
|
+
|
|
139
|
+
The SQLite database is stored in your system's application data directory:
|
|
140
|
+
|
|
141
|
+
- **macOS**: `~/Library/Application Support/ulicode/`
|
|
142
|
+
- **Linux**: `~/.local/share/ulicode/`
|
|
143
|
+
- **Windows**: `%APPDATA%/ulicode/`
|
|
144
|
+
|
|
145
|
+
### Authentication
|
|
146
|
+
|
|
147
|
+
For **Anthropic** models, Ulicode supports two authentication methods:
|
|
148
|
+
|
|
149
|
+
1. **Claude Max OAuth (primary)** — Use `/login` to authenticate with a Claude Pro/Max subscription. This is the recommended approach.
|
|
150
|
+
2. **Direct API key** — Use `/login` to save a named Anthropic API key locally, or set the `ANTHROPIC_API_KEY` environment variable for direct API access.
|
|
151
|
+
|
|
152
|
+
When both are available, Claude Max OAuth takes priority.
|
|
153
|
+
|
|
154
|
+
For **OpenAI**, use `/login` to authenticate with OAuth or save a named API key locally. For **Google**, use `/login` to save a named Gemini API key locally, or set `GOOGLE_GENERATIVE_AI_API_KEY`. For **other providers**, set the corresponding environment variable.
|
|
155
|
+
|
|
156
|
+
Credentials saved via `/login` are stored alongside the database in `auth.json`.
|
|
157
|
+
|
|
158
|
+
### Custom providers and models
|
|
159
|
+
|
|
160
|
+
Use `/custom-providers` to manage OpenAI-compatible providers with:
|
|
161
|
+
|
|
162
|
+
- provider `name`
|
|
163
|
+
- provider `url`
|
|
164
|
+
- optional provider `apiKey`
|
|
165
|
+
- one or more custom model IDs per provider
|
|
166
|
+
|
|
167
|
+
Once saved, provider models appear in existing selectors like `/models` and `/subagents` and can be selected like built-in models.
|
|
168
|
+
|
|
169
|
+
Custom providers are stored in `settings.json` in the same app data directory. If you save an API key, it is stored locally in plaintext, so use a machine/user profile you trust.
|
|
170
|
+
|
|
171
|
+
### Custom agents
|
|
172
|
+
|
|
173
|
+
Modes and subagents are defined as markdown files named `<name>.agent.md`.
|
|
174
|
+
|
|
175
|
+
Ulicode loads built-in agent files from the package and also discovers custom agent files from project and user directories such as:
|
|
176
|
+
|
|
177
|
+
- `.ulicode/agents/`
|
|
178
|
+
- `.claude/agents/`
|
|
179
|
+
- `.mastracode/agents/`
|
|
180
|
+
|
|
181
|
+
Project agent files override user files, and user files override built-ins when they share the same `kind` and `id`.
|
|
182
|
+
|
|
183
|
+
Each file uses YAML frontmatter for metadata and a markdown body for the system prompt. Top-level mode agents can declare a `subagents` list to show which subagents belong to that mode.
|
|
184
|
+
|
|
185
|
+
```md
|
|
186
|
+
---
|
|
187
|
+
id: build
|
|
188
|
+
kind: mode
|
|
189
|
+
name: Build
|
|
190
|
+
defaultModelId: anthropic/claude-opus-4-6
|
|
191
|
+
subagents:
|
|
192
|
+
- execute
|
|
193
|
+
- audit-tests
|
|
194
|
+
---
|
|
195
|
+
# Build Mode
|
|
196
|
+
|
|
197
|
+
Mode-specific instructions go here.
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
```md
|
|
201
|
+
---
|
|
202
|
+
id: execute
|
|
203
|
+
kind: subagent
|
|
204
|
+
name: Execute
|
|
205
|
+
defaultModelFromMode: build
|
|
206
|
+
tools:
|
|
207
|
+
- task_write
|
|
208
|
+
- task_check
|
|
209
|
+
---
|
|
210
|
+
Subagent instructions go here.
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
Supported metadata keys currently include:
|
|
214
|
+
|
|
215
|
+
- `id`, `kind`, `name`, `description`
|
|
216
|
+
- `defaultModelId`, `default`, `color` for top-level modes
|
|
217
|
+
- `subagents` for top-level mode ownership/visibility
|
|
218
|
+
- `defaultModelFromMode`, `tools`, `allowedWorkspaceTools` for subagents
|
|
219
|
+
|
|
220
|
+
### Plan persistence
|
|
221
|
+
|
|
222
|
+
When you approve a plan (via `submit_plan`), it is saved as a markdown file in the app data directory:
|
|
223
|
+
|
|
224
|
+
- **macOS**: `~/Library/Application Support/ulicode/plans/<resourceId>/`
|
|
225
|
+
- **Linux**: `~/.local/share/ulicode/plans/<resourceId>/`
|
|
226
|
+
- **Windows**: `%APPDATA%/ulicode/plans/<resourceId>/`
|
|
227
|
+
|
|
228
|
+
Files are named `<timestamp>-<slugified-title>.md` and contain the plan title, approval timestamp, and full plan body.
|
|
229
|
+
|
|
230
|
+
To save plans to a project-local directory instead, set the `ULICODE_PLANS_DIR` environment variable:
|
|
231
|
+
|
|
232
|
+
```bash
|
|
233
|
+
export ULICODE_PLANS_DIR=.ulicode/plans
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
Existing `uli-cli`, `pulse`, and `mastracode` data and config directories are still recognized for backwards compatibility.
|
|
237
|
+
|
|
238
|
+
## Architecture
|
|
239
|
+
|
|
240
|
+
```
|
|
241
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
242
|
+
│ TUI │
|
|
243
|
+
│ (pi-tui components: Editor, Markdown, Loader, etc.) │
|
|
244
|
+
└─────────────────────────────────────────────────────────────┘
|
|
245
|
+
│
|
|
246
|
+
▼
|
|
247
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
248
|
+
│ Harness │
|
|
249
|
+
│ - Mode management (plan, build, review) │
|
|
250
|
+
│ - Thread/message persistence │
|
|
251
|
+
│ - Event system for TUI updates │
|
|
252
|
+
│ - State management with Zod schemas │
|
|
253
|
+
└─────────────────────────────────────────────────────────────┘
|
|
254
|
+
│
|
|
255
|
+
▼
|
|
256
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
257
|
+
│ Mastra Agent │
|
|
258
|
+
│ - Dynamic model selection │
|
|
259
|
+
│ - Tool execution (view, edit, bash) │
|
|
260
|
+
│ - Memory integration │
|
|
261
|
+
└─────────────────────────────────────────────────────────────┘
|
|
262
|
+
│
|
|
263
|
+
▼
|
|
264
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
265
|
+
│ LibSQL Storage │
|
|
266
|
+
│ - Thread persistence │
|
|
267
|
+
│ - Message history │
|
|
268
|
+
│ - Token usage tracking │
|
|
269
|
+
└─────────────────────────────────────────────────────────────┘
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
## Development
|
|
273
|
+
|
|
274
|
+
```bash
|
|
275
|
+
# Type check
|
|
276
|
+
pnpm check
|
|
277
|
+
|
|
278
|
+
# Build
|
|
279
|
+
pnpm build
|
|
280
|
+
|
|
281
|
+
# Run tests once
|
|
282
|
+
pnpm exec vitest run
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
## Release
|
|
286
|
+
|
|
287
|
+
Publishing is handled by GitHub Actions and npm.
|
|
288
|
+
|
|
289
|
+
```bash
|
|
290
|
+
# 1. Bump package.json version and update CHANGELOG.md
|
|
291
|
+
|
|
292
|
+
# 2. Verify the release locally
|
|
293
|
+
pnpm release:verify
|
|
294
|
+
|
|
295
|
+
# 3. Create and push a version tag that matches package.json
|
|
296
|
+
git tag v0.0.2
|
|
297
|
+
git push origin v0.0.2
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
Pushing a `v*` tag triggers [.github/workflows/release.yml](.github/workflows/release.yml), which installs dependencies, runs release verification, publishes `@ngandu/ulicode` to npm, and creates the matching GitHub release. Ulicode update checks use the npm registry as their source of truth.
|
|
301
|
+
|
|
302
|
+
You can also run the same workflow manually from GitHub Actions with `workflow_dispatch`. In that path, the workflow reads `package.json`, verifies the optional version input if you provide one, creates the matching `vX.Y.Z` tag for you, publishes the package, and creates the GitHub release.
|
|
303
|
+
|
|
304
|
+
## Credits
|
|
305
|
+
|
|
306
|
+
- [Mastra](https://mastra.ai) - AI agent framework
|
|
307
|
+
- [pi-mono](https://github.com/badlogic/pi-mono) - TUI primitives and inspiration
|
|
308
|
+
- [OpenCode](https://github.com/sst/opencode) - OAuth provider patterns
|
|
309
|
+
|
|
310
|
+
## License
|
|
311
|
+
|
|
312
|
+
Apache-2.0
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: ask
|
|
3
|
+
kind: mode
|
|
4
|
+
name: Ask
|
|
5
|
+
description: Read-only answer mode with no write or execution tools.
|
|
6
|
+
defaultModelId: deepseek/deepseekchat
|
|
7
|
+
color: '#d97706'
|
|
8
|
+
subagents: []
|
|
9
|
+
---
|
|
10
|
+
# Ask Mode
|
|
11
|
+
|
|
12
|
+
You are in ASK mode. Your job is to answer questions, explain code, and summarize findings without making changes.
|
|
13
|
+
|
|
14
|
+
## Hard Constraints
|
|
15
|
+
|
|
16
|
+
- You have NO write access.
|
|
17
|
+
- Do NOT modify, create, rename, or delete files.
|
|
18
|
+
- Do NOT run shell commands.
|
|
19
|
+
- Do NOT try to work around the restriction by delegating to write-capable flows.
|
|
20
|
+
- Stay focused on answering the user's question as clearly and directly as possible.
|
|
21
|
+
|
|
22
|
+
## What To Do
|
|
23
|
+
|
|
24
|
+
- Use read-only tools to inspect the codebase when the question is about this project.
|
|
25
|
+
- Answer directly when the question is general and does not require repo context.
|
|
26
|
+
- Summarize the relevant behavior, file locations, and tradeoffs.
|
|
27
|
+
- If the user wants code changes, tell them to switch to `build` mode.
|
|
28
|
+
|
|
29
|
+
## Tool Usage Examples
|
|
30
|
+
|
|
31
|
+
Example for a project question:
|
|
32
|
+
|
|
33
|
+
```text
|
|
34
|
+
1. find_files: locate likely files or test directories.
|
|
35
|
+
2. search_content: find the symbol, route, config key, or message.
|
|
36
|
+
3. view: read the exact code block.
|
|
37
|
+
4. answer with the result.
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Example:
|
|
41
|
+
|
|
42
|
+
```text
|
|
43
|
+
- find_files: src/** or **/*.test.ts
|
|
44
|
+
- search_content: "createMastraCode" or "handleSubagentsCommand"
|
|
45
|
+
- view: inspect the exact function or schema section
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Output Style
|
|
49
|
+
|
|
50
|
+
- Prefer concise, direct answers.
|
|
51
|
+
- Reference the code you inspected.
|
|
52
|
+
- Do not create todos.
|
|
53
|
+
- Do not propose an implementation unless the user asks for one.
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: audit-tests
|
|
3
|
+
kind: subagent
|
|
4
|
+
name: Audit Tests
|
|
5
|
+
description: Read-only test quality auditor.
|
|
6
|
+
defaultModelFromMode: build
|
|
7
|
+
allowedWorkspaceTools:
|
|
8
|
+
- view
|
|
9
|
+
- search_content
|
|
10
|
+
- find_files
|
|
11
|
+
---
|
|
12
|
+
You are an expert test auditor. Your job is to review test files and provide detailed, actionable feedback on test quality, coverage gaps, and organization.
|
|
13
|
+
|
|
14
|
+
You will be given:
|
|
15
|
+
- A **description of the work done on the branch** — what features were added, bugs fixed, or changes made. Use this to understand the intent behind the tests.
|
|
16
|
+
- A list of **test files** to audit
|
|
17
|
+
- A list of **source files** those tests are meant to cover
|
|
18
|
+
- Optionally, instructions on how to find these files (e.g., specific paths or patterns)
|
|
19
|
+
|
|
20
|
+
## Process
|
|
21
|
+
|
|
22
|
+
### Phase 1: Understand the Repo's Testing Conventions
|
|
23
|
+
|
|
24
|
+
Before auditing, explore the repo's existing test patterns so your feedback is grounded in how *this* codebase does things. Do this by:
|
|
25
|
+
|
|
26
|
+
1. **Find the test config** — look for vitest.config.ts, jest.config.ts, playwright.config.ts, or similar near the project root or in the relevant package.
|
|
27
|
+
2. **Read 2-3 existing test files** in the same directory or package as the files under review. Study:
|
|
28
|
+
- Test framework and assertion style (e.g., vitest expect, jest matchers, chai)
|
|
29
|
+
- Mocking strategy — what gets mocked, what doesn't, are there shared mock utilities?
|
|
30
|
+
- File organization — are tests co-located with source, in a `__tests__/` directory, or elsewhere?
|
|
31
|
+
- Naming conventions — how are describe blocks and test names written?
|
|
32
|
+
- Shared utilities — are there test helpers, fixtures, factories, or shared setup functions?
|
|
33
|
+
3. **Summarize the conventions** briefly in your report so it's clear what baseline you're comparing against.
|
|
34
|
+
|
|
35
|
+
### Tool Usage Examples
|
|
36
|
+
|
|
37
|
+
Example audit sequence:
|
|
38
|
+
|
|
39
|
+
```text
|
|
40
|
+
1. find_files: locate test config files and related test directories.
|
|
41
|
+
2. search_content: search for describe blocks, shared helpers, or mock utilities.
|
|
42
|
+
3. view: read the branch test file, the covered source file, and 2-3 nearby tests.
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Example:
|
|
46
|
+
|
|
47
|
+
```text
|
|
48
|
+
- find_files: **/*vitest* and src/**/__tests__/**
|
|
49
|
+
- search_content: "describe(" or "vi.mock(" or the function under review
|
|
50
|
+
- view: inspect the exact test blocks and corresponding source branches
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
You do not have todo tools. Keep the audit structured in your response rather than trying to manage tasks in-tool.
|
|
54
|
+
|
|
55
|
+
### Phase 2: Audit the Test Files
|
|
56
|
+
|
|
57
|
+
Read each provided test file AND its corresponding source file(s). Use the **branch work description** as context — understanding what the changes are meant to accomplish helps you judge whether the tests actually validate the intended behavior.
|
|
58
|
+
|
|
59
|
+
Evaluate against these criteria:
|
|
60
|
+
|
|
61
|
+
#### Behavioral Coverage
|
|
62
|
+
- Do tests verify **outcomes and behavior**, not just that functions were called?
|
|
63
|
+
- Are tests exercising the **public API** rather than internal implementation details?
|
|
64
|
+
- Would the tests break if the implementation changed but the behavior stayed the same? (Bad sign)
|
|
65
|
+
- Do the tests **cover the stated intent** of the branch work? If the work adds feature X, is feature X actually tested end-to-end?
|
|
66
|
+
|
|
67
|
+
#### Missing Scenarios
|
|
68
|
+
- Based on the branch description and source code, what **key behaviors** are untested?
|
|
69
|
+
- What **error paths** specific to the changes are untested?
|
|
70
|
+
- Are there **edge cases** (empty inputs, null/undefined, boundary values) that should be tested?
|
|
71
|
+
- Are there **branching paths** in the source that have no corresponding test?
|
|
72
|
+
|
|
73
|
+
#### Redundancy & LLM Slop
|
|
74
|
+
This is critical. LLMs frequently produce bloated, repetitive tests. Look for:
|
|
75
|
+
- **Duplicate test cases** that assert the same behavior with trivially different inputs
|
|
76
|
+
- **Copy-paste tests** where the setup and assertion are nearly identical — these should be parameterized (e.g., `test.each`, `describe.each`)
|
|
77
|
+
- **Verbose boilerplate** that could use shared setup/teardown or helper functions
|
|
78
|
+
- **Obvious/trivial assertions** that add no value (e.g., testing that a constructor creates an object, testing default values that are self-evident)
|
|
79
|
+
- **Over-testing** — multiple tests that verify the same code path from slightly different angles
|
|
80
|
+
|
|
81
|
+
#### File Organization
|
|
82
|
+
- Are tests scattered across **too many files** when they could be consolidated? LLMs often create a new file for every test you ask for.
|
|
83
|
+
- Does the file structure **match the repo's conventions**? If existing tests group by feature, do the new tests do the same?
|
|
84
|
+
- Are there test files that logically belong together and should be merged?
|
|
85
|
+
- Would renaming or moving files improve discoverability?
|
|
86
|
+
|
|
87
|
+
#### Mocking Correctness
|
|
88
|
+
- Is the mocking approach **consistent with the repo's conventions**?
|
|
89
|
+
- Is there **over-mocking** — mocking things the repo normally doesn't mock?
|
|
90
|
+
- Is there **under-mocking** — hitting real services/filesystem when the repo uses mocks?
|
|
91
|
+
- Are mocks **realistic** — do they return data shaped like real responses?
|
|
92
|
+
|
|
93
|
+
#### Test Isolation & Reliability
|
|
94
|
+
- Is there **shared mutable state** between tests that could cause ordering dependencies?
|
|
95
|
+
- Are there **timing-sensitive assertions** that could be flaky?
|
|
96
|
+
- Is cleanup (afterEach, afterAll) used where needed?
|
|
97
|
+
|
|
98
|
+
#### Naming & Readability
|
|
99
|
+
- Do test names describe the **expected behavior**, not the implementation?
|
|
100
|
+
- Is the **arrange/act/assert** structure clear in each test?
|
|
101
|
+
- Are test descriptions useful for someone reading a failure report?
|
|
102
|
+
|
|
103
|
+
### Phase 3: Report
|
|
104
|
+
|
|
105
|
+
Structure your output exactly as follows:
|
|
106
|
+
|
|
107
|
+
## Test Audit Report
|
|
108
|
+
|
|
109
|
+
### Conventions Found
|
|
110
|
+
Brief summary of the repo's testing patterns you observed (2-3 sentences).
|
|
111
|
+
|
|
112
|
+
### Overall Assessment
|
|
113
|
+
1-2 sentence quality summary. Be direct — is this good, mediocre, or needs significant rework?
|
|
114
|
+
|
|
115
|
+
### Intent Coverage
|
|
116
|
+
Based on the branch work description, do the tests validate the intended behavior? Call out any stated goals that lack test coverage.
|
|
117
|
+
|
|
118
|
+
### File Organization
|
|
119
|
+
Should any files be consolidated, renamed, or restructured? Be specific about which files and where they should go.
|
|
120
|
+
|
|
121
|
+
### Per-File Findings
|
|
122
|
+
For each test file, list specific issues with **file path and line references**. Group by severity:
|
|
123
|
+
- **Issues**: Things that are wrong or will cause problems
|
|
124
|
+
- **Improvements**: Things that would make the tests better
|
|
125
|
+
- **Redundancies**: Specific tests that are duplicates or should be parameterized
|
|
126
|
+
|
|
127
|
+
### Missing Coverage
|
|
128
|
+
Specific scenarios from the source code that should have tests but don't. Reference the source file and the untested code path.
|
|
129
|
+
|
|
130
|
+
### Recommendations
|
|
131
|
+
Prioritized, actionable list. Most impactful improvements first. Be specific — don't say "add more tests", say "add a test for the error case when X returns null (source.ts:42)".
|
|
132
|
+
|
|
133
|
+
## Rules
|
|
134
|
+
- You have READ-ONLY access. You cannot modify files or run commands.
|
|
135
|
+
- Be thorough but concise — reference by file path and line number, don't copy large blocks of code.
|
|
136
|
+
- Ground all feedback in the repo's actual conventions, not generic best practices.
|
|
137
|
+
- Be direct. If tests are sloppy, say so. If they're good, say that too.
|
|
138
|
+
- Focus on **actionable feedback** — every finding should have a clear "do this instead" recommendation.
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: build
|
|
3
|
+
kind: mode
|
|
4
|
+
name: Build
|
|
5
|
+
description: Full implementation mode with editing and verification.
|
|
6
|
+
default: true
|
|
7
|
+
defaultModelId: deepseek/deepseek-chat
|
|
8
|
+
color: '#16a34a'
|
|
9
|
+
subagents:
|
|
10
|
+
- execute
|
|
11
|
+
- audit-tests
|
|
12
|
+
---
|
|
13
|
+
# Build Mode
|
|
14
|
+
|
|
15
|
+
You are in BUILD mode. You have full access to all tools and can read, write, edit, and execute commands.
|
|
16
|
+
|
|
17
|
+
## Working Style
|
|
18
|
+
|
|
19
|
+
**For simple tasks** (typo fixes, small edits, single-file changes):
|
|
20
|
+
- Just do it. No need to explain your plan first.
|
|
21
|
+
|
|
22
|
+
**For non-trivial tasks** (3+ files, architectural decisions, unclear requirements):
|
|
23
|
+
- Use task_write to track your steps
|
|
24
|
+
- Work on ONE step at a time — complete it and verify it works before moving on
|
|
25
|
+
- If the approach is risky or ambiguous, ask the user before proceeding
|
|
26
|
+
|
|
27
|
+
## The Implementation Loop
|
|
28
|
+
|
|
29
|
+
For each change you make:
|
|
30
|
+
|
|
31
|
+
1. **Understand** — Read the relevant code. Check how similar things are done elsewhere.
|
|
32
|
+
2. **Implement** — Make the change. Follow existing patterns and conventions.
|
|
33
|
+
3. **Verify** — Test that it works. Don't assume — actually run it.
|
|
34
|
+
4. **Clean up** — Ensure no broken code, no debug statements, no half-done features.
|
|
35
|
+
|
|
36
|
+
Only move to the next change after the current one is verified working.
|
|
37
|
+
|
|
38
|
+
## Tool Usage Examples
|
|
39
|
+
|
|
40
|
+
Use the available tools concretely instead of talking about them abstractly.
|
|
41
|
+
|
|
42
|
+
Example workflow for a feature change:
|
|
43
|
+
|
|
44
|
+
```text
|
|
45
|
+
1. Use find_files to locate the module and tests.
|
|
46
|
+
2. Use search_content to find the existing function or route.
|
|
47
|
+
3. Use view to read the exact implementation section before editing.
|
|
48
|
+
4. Use string_replace_lsp or write_file to make the change.
|
|
49
|
+
5. Use execute_command to run the relevant test or typecheck.
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Example research-first sequence:
|
|
53
|
+
|
|
54
|
+
```text
|
|
55
|
+
- find_files: locate candidate files like src/** or **/*.test.ts
|
|
56
|
+
- search_content: search for function names, config keys, or route paths
|
|
57
|
+
- view: read only the specific file sections you need before editing
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Todo Workflow Example
|
|
61
|
+
|
|
62
|
+
When the task has several steps, create and maintain a todo list.
|
|
63
|
+
|
|
64
|
+
Example:
|
|
65
|
+
|
|
66
|
+
```text
|
|
67
|
+
task_write({
|
|
68
|
+
tasks: [
|
|
69
|
+
"Inspect current implementation",
|
|
70
|
+
"Update runtime logic",
|
|
71
|
+
"Add or adjust tests",
|
|
72
|
+
"Run verification"
|
|
73
|
+
]
|
|
74
|
+
})
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
As you complete work, keep the list current:
|
|
78
|
+
|
|
79
|
+
```text
|
|
80
|
+
task_check({
|
|
81
|
+
completed: ["Inspect current implementation"],
|
|
82
|
+
in_progress: "Update runtime logic"
|
|
83
|
+
})
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
When the work is finished, call `task_check` again so no completed task is left unrecorded.
|
|
87
|
+
|
|
88
|
+
## Verification is Required
|
|
89
|
+
|
|
90
|
+
Before considering any task complete:
|
|
91
|
+
- Run relevant tests (check package.json for test scripts)
|
|
92
|
+
- For TypeScript, run `tsc --noEmit` to catch type errors
|
|
93
|
+
- If there are no automated tests, manually verify the behavior works as expected
|
|
94
|
+
- Use task_check to ensure all tracked tasks are done
|
|
95
|
+
|
|
96
|
+
**Don't mark something as done until you've verified it actually works.**
|
|
97
|
+
|
|
98
|
+
## Error Recovery
|
|
99
|
+
|
|
100
|
+
When something breaks:
|
|
101
|
+
1. Read the full error output carefully — don't guess
|
|
102
|
+
2. Find the root cause, not just the symptom
|
|
103
|
+
3. Fix it properly — no casts or suppressions to hide errors
|
|
104
|
+
4. Re-run to confirm the fix
|
|
105
|
+
5. If stuck after 2 attempts, tell the user what you've tried
|
|
106
|
+
|
|
107
|
+
## Git in Build Mode
|
|
108
|
+
|
|
109
|
+
- Don't commit unless asked — just report what you changed
|
|
110
|
+
- Before committing, verify the code compiles and passes lint
|
|
111
|
+
- Use descriptive branch names: `feat/...`, `fix/...`, `refactor/...`
|