mini-coder 0.4.1 → 0.5.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.
Files changed (51) hide show
  1. package/README.md +87 -48
  2. package/assets/icon-1-minimal.svg +31 -0
  3. package/assets/icon-2-dark-terminal.svg +48 -0
  4. package/assets/icon-3-gradient-modern.svg +45 -0
  5. package/assets/icon-4-filled-bold.svg +54 -0
  6. package/assets/icon-5-community-badge.svg +63 -0
  7. package/assets/preview-0-5-0.png +0 -0
  8. package/assets/preview.gif +0 -0
  9. package/bin/mc.ts +14 -0
  10. package/bun.lock +438 -0
  11. package/package.json +12 -29
  12. package/src/agent.ts +592 -0
  13. package/src/cli.ts +124 -0
  14. package/src/git.ts +164 -0
  15. package/src/headless.ts +140 -0
  16. package/src/index.ts +645 -0
  17. package/src/input.ts +155 -0
  18. package/src/paths.ts +37 -0
  19. package/src/plugins.ts +183 -0
  20. package/src/prompt.ts +294 -0
  21. package/src/session.ts +838 -0
  22. package/src/settings.ts +184 -0
  23. package/src/skills.ts +258 -0
  24. package/src/submit.ts +323 -0
  25. package/src/theme.ts +147 -0
  26. package/src/tools.ts +636 -0
  27. package/src/ui/agent.test.ts +49 -0
  28. package/src/ui/agent.ts +210 -0
  29. package/src/ui/commands.test.ts +610 -0
  30. package/src/ui/commands.ts +638 -0
  31. package/src/ui/conversation.test.ts +892 -0
  32. package/src/ui/conversation.ts +926 -0
  33. package/src/ui/help.test.ts +26 -0
  34. package/src/ui/help.ts +119 -0
  35. package/src/ui/input.test.ts +74 -0
  36. package/src/ui/input.ts +138 -0
  37. package/src/ui/overlay.test.ts +42 -0
  38. package/src/ui/overlay.ts +59 -0
  39. package/src/ui/status.test.ts +450 -0
  40. package/src/ui/status.ts +357 -0
  41. package/src/ui.ts +615 -0
  42. package/.claude/settings.local.json +0 -54
  43. package/.prettierignore +0 -7
  44. package/dist/mc-edit.js +0 -275
  45. package/dist/mc.js +0 -7355
  46. package/docs/KNOWN_ISSUES.md +0 -13
  47. package/docs/design-decisions.md +0 -31
  48. package/docs/mini-coder.1.md +0 -227
  49. package/docs/superpowers/plans/2026-03-30-anthropic-oauth-removal.md +0 -61
  50. package/docs/superpowers/specs/2026-03-30-anthropic-oauth-removal-design.md +0 -47
  51. package/lefthook.yml +0 -4
@@ -1,13 +0,0 @@
1
- # KNOWN ISSUES
2
-
3
- ## Bugs
4
-
5
- - AI SDK expands `claude-3-5-haiku` → dated variant that Zen doesn't serve (404).
6
- - Shell tool: model can `tmux kill-session` the host tmux session if names collide (e.g. audit skill creates session named "audit" matching the user's). Not a code bug — the skill/model just picks a conflicting name. Mitigate via skill wording or session name prefixing.
7
- - Shell tool output truncation only stops reading stdout/stderr; it does not terminate the underlying process yet. Commands that emit a lot of output and then keep running can still block until they exit or hit timeout.
8
-
9
- ## Features
10
-
11
- - Conversation summary on max context instead of just an error with `/new` suggestion.
12
-
13
- ## Refactors
@@ -1,31 +0,0 @@
1
- # Design Decisions
2
-
3
- Documenting why mini-coder makes certain architectural choices — especially where we intentionally diverge from common patterns.
4
-
5
- ## Why no tool-call permissions?
6
-
7
- **Decision:** No approval prompts, no blacklists, no whitelists. Every tool call executes immediately.
8
-
9
- Our inspirations (Claude Code, OpenCode) require user approval for tool calls — shell commands, file writes, etc. We intentionally skip this.
10
-
11
- ### Permission systems provide a false sense of security
12
-
13
- - **Shell bypasses everything.** An LLM with shell access can `curl`, `eval`, pipe through `bash`, encode payloads, or chain commands in ways no static blacklist can anticipate. Any permission scheme that allows shell but blocks specific patterns is playing whack-a-mole.
14
- - **Blacklists and whitelists always have gaps.** Block `rm -rf /`? The model uses `find -delete`. Block `git push --force`? It uses `git push origin +main`. The surface area is unbounded.
15
- - **Approval fatigue degrades security.** After the 20th "Allow shell command?" prompt, users auto-approve everything. The permission system trains the user to click "yes" reflexively — the opposite of its intent.
16
-
17
- ### Permissions are cumbersome
18
-
19
- A coding agent runs dozens of shell commands per task. Requiring approval for each one destroys the flow that makes a CLI agent useful. The whole point of mini-coder is: small, fast, stays out of the way.
20
-
21
- ### Isolation is a separate concern
22
-
23
- Sandboxing is a real need, but it belongs at the OS/container level — not inside the agent. Tools like [Anthropic Sandbox Runtime (`srt`)](https://github.com/anthropic-experimental/sandbox-runtime) and [nono](https://nono.sh/) provide proper filesystem and network isolation that the LLM cannot circumvent. This is defense in depth done right: the agent runs unrestricted inside a sandbox that enforces actual boundaries.
24
-
25
- ### Our approach
26
-
27
- - The system prompt includes safety rules (no secrets, confirm destructive actions, no unauthorized reverts).
28
- - The user can interrupt at any time with ESC (preserve context) or Ctrl+C (hard exit).
29
- - For real isolation, run mini-coder inside a sandboxed environment.
30
-
31
- **Summary:** Permission dialogs give the appearance of safety without the substance. Real security comes from sandboxing the environment, not gatekeeping individual tool calls. Mini-coder codes — isolating it is a job for the right tool.
@@ -1,227 +0,0 @@
1
- # MINI-CODER(1)
2
-
3
- ## NAME
4
-
5
- **mini-coder** — a small, fast CLI coding agent (executable: `mc`)
6
-
7
- ## SYNOPSIS
8
-
9
- `mc` \[_options_\] \[_prompt_\]
10
-
11
- ## DESCRIPTION
12
-
13
- Developer-focused CLI coding agent. Prioritizes dev flow — no slow startup, no GUI, no vendor lock-in. Uses 16 ANSI colors to inherit terminal theme. Built on Bun.js.
14
-
15
- ## OPTIONS
16
-
17
- `-m`, `--model` _id_
18
- : Model to use (e.g. `zen/claude-sonnet-4-6`).
19
-
20
- `-c`, `--continue`
21
- : Continue most recent session.
22
-
23
- `-r`, `--resume` _id_
24
- : Resume a specific session.
25
-
26
- `-l`, `--list`
27
- : List recent sessions.
28
-
29
- `--cwd` _path_
30
- : Set working directory.
31
-
32
- `-h`, `--help`
33
- : Display help.
34
-
35
- _prompt_
36
- : Optional one-shot prompt. Runs once then exits.
37
-
38
- ## INTERACTIVE COMMANDS
39
-
40
- `/model`
41
- : List all available models.
42
-
43
- `/models`
44
- : Alias for `/model`.
45
-
46
- `/model` _id_
47
- : Switch model.
48
-
49
- `/models` _id_
50
- : Alias for `/model` _id_.
51
-
52
- `/model effort` _low|medium|high|xhigh|off_
53
- : Set reasoning effort.
54
-
55
- `/session` \[_id_\]
56
- : List sessions or switch to one.
57
-
58
- `/new`
59
- : Start a fresh session.
60
-
61
- `/undo`
62
- : Remove last turn (does NOT revert filesystem).
63
-
64
- `/reasoning` \[_on|off_\]
65
- : Toggle reasoning display.
66
-
67
- `/verbose` \[_on|off_\]
68
- : Toggle output truncation.
69
-
70
- `/mcp list`
71
- : List MCP servers.
72
-
73
- `/mcp add` _name_ `http` _url_
74
- : Add HTTP MCP server.
75
-
76
- `/mcp add` _name_ `stdio` _cmd_ \[_args..._\]
77
- : Add stdio MCP server.
78
-
79
- `/mcp remove` _name_
80
- : Remove MCP server.
81
-
82
- `/login`
83
- : Show OAuth login status.
84
-
85
- `/login` _provider_
86
- : Login via OAuth (opens browser for device flow). Currently supports `openai`.
87
-
88
- `/logout` _provider_
89
- : Clear saved OAuth tokens.
90
-
91
- `/help`
92
- : Command help.
93
-
94
- `/exit`, `/quit`, `/q`
95
- : Leave session.
96
-
97
- ## INLINE FEATURES
98
-
99
- `!` prefix
100
- : Runs shell commands inline — output is sent to the LLM as a user message.
101
-
102
- `@` prefix
103
- : Embeds a file into the prompt (Tab to complete file paths).
104
-
105
- `/` prefix
106
- : Reference a skill in the prompt (Tab to complete skill names).
107
-
108
- ## KEYS
109
-
110
- `ESC`
111
- : Interrupt the assistant response — partial output is preserved in history.
112
-
113
- `Ctrl+C`
114
- : Exit forcefully.
115
-
116
- `Ctrl+D`
117
- : Graceful exit (EOF).
118
-
119
- `↑` / `↓`
120
- : Navigate command history.
121
-
122
- `Ctrl+R`
123
- : Search command history.
124
-
125
- ## BUILT-IN TOOLS
126
-
127
- **shell**
128
- : Execute bash commands; repo inspection and `mc-edit` edits happen here.
129
-
130
- **listSkills**
131
- : List discovered skills (metadata only).
132
-
133
- **readSkill**
134
- : Load one SKILL.md on demand.
135
-
136
- **webSearch**
137
- : Search the web (requires `EXA_API_KEY`).
138
-
139
- **webContent**
140
- : Fetch page content (requires `EXA_API_KEY`).
141
-
142
- MCP tools are connected dynamically from configured MCP servers.
143
-
144
- ## FILE EDITING — mc-edit
145
-
146
- `mc-edit` is the helper for targeted file edits, invoked from **shell**.
147
-
148
- ```
149
- mc-edit <path> (--old <text> | --old-file <path>) [--new <text> | --new-file <path>] [--cwd <path>]
150
- ```
151
-
152
- - Applies one exact-text edit to an existing file.
153
- - The old text must match exactly once.
154
- - Omit `--new`/`--new-file` to delete the matched text.
155
- - Success: prints unified diff + metadata (`ok`, `path`, `changed`).
156
- - No-op: prints `(no changes)` + metadata.
157
- - Errors go to stderr.
158
-
159
- Workflow: inspect with **shell** → edit with **mc-edit** → verify with **shell**.
160
-
161
- ## SKILLS
162
-
163
- Skills are reusable instruction files at `.agents/skills/<name>/SKILL.md`.
164
-
165
- `.claude/skills/<name>/SKILL.md` is also supported.
166
-
167
- **Frontmatter (both required):**
168
-
169
- `name`
170
- : Lowercase alphanumeric + hyphens, 1–64 chars.
171
-
172
- `description`
173
- : Help text.
174
-
175
- Skills are auto discovered. To load explicitly:
176
-
177
- - `/skill-name` in prompts (injects body as a user message).
178
- - **listSkills** / **readSkill** tools at runtime.
179
-
180
- Local discovery walks up from cwd to the git worktree root.
181
-
182
- ## CONFIGURATION
183
-
184
- Config roots: `.agents/`, `.claude/` — local (repo) or global (`~/`).
185
-
186
- **Context files** (global files first, then the nearest local directory with context files):
187
-
188
- - Global files concatenate in this order: `~/.agents/AGENTS.md` → `~/.agents/CLAUDE.md` → `~/.claude/CLAUDE.md`
189
- - Local files concatenate in this order within the nearest matching directory (the same nearest-directory precedence applies to both `AGENTS.md` and `CLAUDE.md`): `./.agents/AGENTS.md` → `./.agents/CLAUDE.md` → `./.claude/CLAUDE.md` → `./CLAUDE.md` → `./AGENTS.md`
190
-
191
- **Precedence:**
192
-
193
- 1. Local context is loaded from the nearest directory between cwd and the git root.
194
- 2. Within one scope, matching files are concatenated in the order above.
195
- 3. Global context appears before local context in the system prompt.
196
- 4. Skills: nearest ancestor directory wins.
197
-
198
- ## ENVIRONMENT
199
-
200
- `OPENCODE_API_KEY`
201
- : OpenCode Zen (recommended).
202
-
203
- `ANTHROPIC_API_KEY`
204
- : Direct Anthropic.
205
-
206
- `OPENAI_API_KEY`
207
- : Direct OpenAI.
208
-
209
- `GOOGLE_API_KEY` / `GEMINI_API_KEY`
210
- : Direct Gemini.
211
-
212
- `OLLAMA_BASE_URL`
213
- : Ollama local (defaults to `http://localhost:11434`).
214
-
215
- `EXA_API_KEY`
216
- : Enables **webSearch** / **webContent**.
217
-
218
- ## FILES
219
-
220
- `~/.config/mini-coder/`
221
- : App data directory (sessions.db, with tables for error and other logs).
222
-
223
- `.agents/` or `.claude/`
224
- : Config directories for skills and context files.
225
-
226
- `AGENTS.md` / `CLAUDE.md`
227
- : Project context files.
@@ -1,61 +0,0 @@
1
- # Anthropic OAuth Removal Implementation Plan
2
-
3
- > **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
4
-
5
- **Goal:** Remove Claude Code subscription OAuth support without affecting Anthropic API-key access or Zen Claude models.
6
-
7
- **Architecture:** Delete the Anthropic OAuth provider registration and stop consulting Anthropic OAuth state in discovery/model-info paths. Preserve all direct `ANTHROPIC_API_KEY` behavior and Anthropic-family handling needed by Zen and direct API use.
8
-
9
- **Tech Stack:** Bun, TypeScript, bun:test, SQLite-backed auth storage, AI SDK providers.
10
-
11
- ---
12
-
13
- ### Task 1: Track the work and lock the user-facing contract
14
-
15
- **Files:**
16
-
17
- - Modify: `TODO.md`
18
- - Reference: `docs/superpowers/specs/2026-03-30-anthropic-oauth-removal-design.md`
19
-
20
- - [ ] **Step 1: Update TODO.md with active work item**
21
- - [ ] **Step 2: Keep TODO.md current as tasks complete**
22
-
23
- ### Task 2: Write failing tests for Anthropic OAuth removal
24
-
25
- **Files:**
26
-
27
- - Modify: `src/llm-api/providers-resolve.test.ts`
28
- - Modify: `src/llm-api/model-info.test.ts`
29
- - Create: `src/session/oauth/auth-storage.test.ts`
30
-
31
- - [ ] **Step 1: Add a test asserting OAuth providers list only OpenAI**
32
- - [ ] **Step 2: Add tests asserting Anthropic discovery requires `ANTHROPIC_API_KEY`**
33
- - [ ] **Step 3: Run focused tests to verify they fail for the expected reason**
34
-
35
- ### Task 3: Remove Anthropic OAuth registration and discovery usage
36
-
37
- **Files:**
38
-
39
- - Delete: `src/session/oauth/anthropic.ts`
40
- - Modify: `src/session/oauth/auth-storage.ts`
41
- - Modify: `src/llm-api/providers.ts`
42
- - Modify: `src/llm-api/model-info.ts`
43
- - Modify: `src/llm-api/model-info-fetch.ts`
44
-
45
- - [ ] **Step 1: Remove the Anthropic OAuth provider from auth storage**
46
- - [ ] **Step 2: Remove Anthropic OAuth-based provider discovery/autodiscovery**
47
- - [ ] **Step 3: Remove Anthropic OAuth-based model list fetching**
48
- - [ ] **Step 4: Run the focused tests and make them pass**
49
-
50
- ### Task 4: Update CLI/docs and finish verification
51
-
52
- **Files:**
53
-
54
- - Modify: `src/cli/commands-help.ts`
55
- - Modify: `docs/mini-coder.1.md`
56
- - Modify: `TODO.md`
57
-
58
- - [ ] **Step 1: Remove Anthropic OAuth mentions from help/manpage**
59
- - [ ] **Step 2: Run formatting if needed**
60
- - [ ] **Step 3: Run focused tests, then broader verification commands**
61
- - [ ] **Step 4: Clear the completed TODO item**
@@ -1,47 +0,0 @@
1
- # Anthropic OAuth Removal Design
2
-
3
- ## Goal
4
-
5
- Remove Claude Code subscription OAuth support from mini-coder while preserving:
6
-
7
- - direct Anthropic API key support via `ANTHROPIC_API_KEY`
8
- - Anthropic-family models served through Opencode Zen (`zen/claude-*`)
9
-
10
- ## Approved behavior
11
-
12
- - `anthropic` is removed completely from the user-facing OAuth surface.
13
- - `/login anthropic` is no longer supported and behaves like any unknown provider.
14
- - `/logout anthropic` is no longer documented or advertised as a supported path.
15
- - Existing saved Anthropic OAuth rows in SQLite are ignored; no migration or cleanup is required.
16
- - Anthropic remains available through `ANTHROPIC_API_KEY`.
17
- - Zen-backed Claude models remain available and unchanged.
18
-
19
- ## Approach
20
-
21
- Use a narrow OAuth-only removal:
22
-
23
- 1. Remove the Anthropic OAuth provider module and provider registration.
24
- 2. Stop consulting Anthropic OAuth state during provider discovery and model-info refresh visibility.
25
- 3. Keep direct Anthropic provider resolution via `ANTHROPIC_API_KEY`.
26
- 4. Keep Anthropic-family request handling and Zen backend routing unchanged.
27
- 5. Update tests and docs to match the new OAuth surface.
28
-
29
- ## Files in scope
30
-
31
- - `src/session/oauth/anthropic.ts` — delete
32
- - `src/session/oauth/auth-storage.ts` — unregister Anthropic OAuth
33
- - `src/llm-api/providers.ts` — stop treating Anthropic OAuth as connected
34
- - `src/llm-api/model-info.ts` — stop treating Anthropic OAuth as a refresh/visibility source
35
- - `src/llm-api/model-info-fetch.ts` — stop fetching Anthropic models via OAuth tokens
36
- - `src/cli/commands-help.ts` — remove Anthropic OAuth example text
37
- - `docs/mini-coder.1.md` — document OpenAI-only OAuth support
38
- - tests around provider discovery/model info — update to be deterministic and Anthropic-OAuth-free
39
-
40
- ## Risks and mitigations
41
-
42
- - Risk: accidentally breaking direct Anthropic API-key support.
43
- - Mitigation: keep direct provider resolver and add/update tests that verify `ANTHROPIC_API_KEY` still wins.
44
- - Risk: accidentally breaking Zen Claude behavior.
45
- - Mitigation: avoid touching Anthropic-family routing/caching code used for Zen.
46
- - Risk: stale Anthropic OAuth tokens still affecting behavior.
47
- - Mitigation: remove all Anthropic OAuth checks from discovery and model fetching paths.
package/lefthook.yml DELETED
@@ -1,4 +0,0 @@
1
- pre-commit:
2
- commands:
3
- check:
4
- run: bun run check