mini-coder 0.5.13 → 0.6.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 (67) hide show
  1. package/README.md +25 -108
  2. package/bin/mc.ts +8 -11
  3. package/bun.lock +79 -269
  4. package/package.json +17 -22
  5. package/src/agent.ts +242 -915
  6. package/src/args.ts +289 -0
  7. package/src/headless.ts +43 -385
  8. package/src/index.ts +29 -836
  9. package/src/oauth.ts +117 -0
  10. package/src/prompt.ts +227 -276
  11. package/src/session.ts +57 -961
  12. package/src/shared.ts +117 -38
  13. package/src/tool-bash.ts +110 -0
  14. package/src/tool-edit.ts +133 -0
  15. package/src/tool-task.ts +114 -0
  16. package/src/tui-components.ts +150 -0
  17. package/src/tui-conversation.ts +262 -0
  18. package/src/tui-editor.ts +29 -0
  19. package/src/tui-overlay.ts +403 -0
  20. package/src/tui.ts +236 -0
  21. package/src/types.ts +160 -0
  22. package/tsconfig.json +17 -0
  23. package/BENCHMARK.md +0 -107
  24. package/LICENSE +0 -9
  25. package/PROGRESS.md +0 -4
  26. package/assets/icon-1-minimal.svg +0 -31
  27. package/assets/icon-2-dark-terminal.svg +0 -48
  28. package/assets/icon-3-gradient-modern.svg +0 -45
  29. package/assets/icon-4-filled-bold.svg +0 -54
  30. package/assets/icon-5-community-badge.svg +0 -63
  31. package/assets/mc-claude-smart.png +0 -0
  32. package/assets/mc-gpt-smart.png +0 -0
  33. package/assets/preview-0-5-0.png +0 -0
  34. package/assets/preview.gif +0 -0
  35. package/benchmark-baseline.sh +0 -15
  36. package/benchmark-loop.sh +0 -19
  37. package/skills-lock.json +0 -15
  38. package/src/cli.ts +0 -134
  39. package/src/errors.ts +0 -15
  40. package/src/git.ts +0 -247
  41. package/src/input.ts +0 -168
  42. package/src/mcp.ts +0 -609
  43. package/src/paths.ts +0 -37
  44. package/src/session-message.ts +0 -393
  45. package/src/settings.ts +0 -449
  46. package/src/skills.ts +0 -271
  47. package/src/submit.ts +0 -371
  48. package/src/text.ts +0 -71
  49. package/src/theme.ts +0 -330
  50. package/src/tool-common.ts +0 -93
  51. package/src/tool-grep.ts +0 -606
  52. package/src/tool-read.ts +0 -313
  53. package/src/tool-shell.ts +0 -1001
  54. package/src/tools.ts +0 -854
  55. package/src/ui/agent.ts +0 -317
  56. package/src/ui/commands.test.ts +0 -913
  57. package/src/ui/commands.ts +0 -834
  58. package/src/ui/conversation.test.ts +0 -585
  59. package/src/ui/conversation.ts +0 -1836
  60. package/src/ui/help.ts +0 -158
  61. package/src/ui/input.test.ts +0 -64
  62. package/src/ui/input.ts +0 -138
  63. package/src/ui/overlay.ts +0 -59
  64. package/src/ui/runtime.ts +0 -69
  65. package/src/ui/status.ts +0 -220
  66. package/src/ui.ts +0 -1190
  67. package/src/version.ts +0 -48
package/README.md CHANGED
@@ -20,7 +20,7 @@
20
20
  </picture>
21
21
  </p>
22
22
 
23
- mini-coder (`mc`) is a terminal coding agent that reads your repo, edits files, runs commands, and keeps going until the work is done. Small core tool surface, flat architecture, fast turns, and streaming everywhere it matters.
23
+ mini-coder (`mc`) is a terminal coding agent, hand crafted for transparency and good engineering performance.
24
24
 
25
25
  ## Install
26
26
 
@@ -37,125 +37,42 @@ $ mc
37
37
  - **Performance** — startup and turn latency matter more than features.
38
38
  - **Streaming end-to-end** — assistant text, reasoning, tool calls, and tool output show up as they happen.
39
39
 
40
- ## Tools
41
-
42
- Six built-in tools, plus a conditional read-only image tool and any configured MCP tools:
43
-
44
- - **`shell`** — runs commands in the user's shell. Returns stdout, stderr, and exit code. Large output is truncated to protect model context.
45
- - **`read`** — reads UTF-8 text files from disk, optionally by line window.
46
- - **`grep`** — searches file contents with ripgrep-style options and returns structured matches.
47
- - **`edit`** — exact-text replacement in a single file. Fails deterministically if the target is missing or ambiguous. Creates new files when old text is empty.
48
- - **`todoWrite`** — creates or updates the session todo list incrementally and returns the full current snapshot.
49
- - **`todoRead`** — returns the full current session todo list snapshot.
50
- - **`readImage`** — reads PNG, JPEG, GIF, and WebP files as model input. Only registered when the active model supports images.
51
- - **Configured MCP tools** — tools discovered from `settings.json` Streamable HTTP MCP servers. Imported tool names are prefixed with the server name, for example `docs__search`.
52
-
53
- ## Features
54
-
55
- - **Multi-provider model support** — Anthropic, OpenAI, Google, Bedrock, Mistral, Groq, xAI, OpenRouter, Ollama, Copilot, and more via pi-ai.
56
- - **Streaming TUI** — markdown conversation log, tool blocks with diffs, animated divider, multi-line input, and a one-line pill status bar with independent ANSI16 effort/context tones.
57
- - **Session persistence** — SQLite-backed sessions with undo, fork, resume, and cumulative usage stats. Sessions are scoped to the working directory.
58
- - **Reasoning and verbosity controls** — toggle thinking visibility and verbose tool rendering on demand. Preferences persist across launches.
59
- - **[AGENTS.md](https://agents.md) support** — project-specific instructions discovered root-to-leaf, with `~/.agents/` for global instructions.
60
- - **[Agent Skills](https://agentskills.io)** — skill catalogs exposed in the prompt. `/skill:name` injects a skill body into the next user message, and `/skill` opens a picker that fills in the selected skill reference without submitting.
61
- - **Settings-driven MCP tools** — connect Streamable HTTP MCP servers from `~/.config/mini-coder/settings.json` and expose their tools directly in the core runtime.
62
-
63
- ## Commands
64
-
65
- | Command | Description |
66
- | ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
67
- | `/model` | Switch models and save the choice as the global default. |
68
- | `/session` | Open the session picker for the current working directory. |
69
- | `/new` | Start a fresh session and reset the running token and cost totals. |
70
- | `/fork` | Fork the current chat into a new session, keep the original, and add a UI-only `Forked session.` note. |
71
- | `/undo` | Remove the last conversational turn without touching filesystem changes. |
72
- | `/reasoning` | Show or hide model thinking. The setting is saved and restored on launch. |
73
- | `/verbose` | Toggle compact vs full rendering for verbose-aware tool previews/results, including shell, read, grep, edit previews/errors, and MCP tool blocks. |
74
- | `/mcp` | Open the MCP server picker and toggle configured servers on or off for future turns. |
75
- | `/todo` | Show the current session todo list in the conversation log as a UI-only checklist block. |
76
- | `/login` | Sign in with a supported OAuth provider. |
77
- | `/logout` | Remove saved OAuth credentials for a logged-in provider. |
78
- | `/effort` | Choose low, medium, high, or xhigh reasoning effort. |
79
- | `/help` | Show commands, current toggles, loaded AGENTS.md files, skills, and MCP servers with on/off state. |
80
- | `/skill:name` | Insert a discovered skill into the next message. Submit `/skill` or pick `/skill:name` from slash-command autocomplete to choose a skill without auto-submitting. |
81
-
82
- ## Key bindings
83
-
84
- | Key | Action |
85
- | ------------- | ---------------------------------------------------------------------------------------------------------- |
86
- | `Enter` | Submit message |
87
- | `Shift+Enter` | Insert newline |
88
- | `Escape` | Dismiss the overlay without changing the draft; otherwise interrupt the running turn; otherwise do nothing |
89
- | `Tab` | Autocomplete a path, or open the command picker when the draft starts with `/` without clearing the draft |
90
- | `Ctrl+R` | Search global raw input history |
91
- | `Ctrl+C` | Graceful exit |
92
- | `Ctrl+D` | Graceful exit when the input is empty |
93
- | `:q` | Graceful exit |
94
- | `Ctrl+Z` | Suspend the process |
95
- | Mouse wheel | Scroll conversation history |
96
-
97
- ## Headless one-shot mode
98
-
99
- mini-coder also supports a non-interactive one-shot mode for scripts and benchmark harnesses.
100
-
101
- ```bash
102
- $ mc -p "summarize this repo"
103
- $ printf '%s\n' 'fix the failing tests' | mc
104
- ```
105
-
106
- - Starts when `-p/--prompt` is provided or when stdin or stdout is not a TTY.
107
- - If stdout is redirected but stdin is still interactive, pass `-p`; headless mode will not fall back to an interactive prompt.
108
- - Uses the same parser as the TUI for plain text, `/skill:name`, and standalone image paths.
109
- - Without `--json`, keeps stdout script-friendly by writing only the final assistant text there, while lightweight assistant commentary snippets from tool-use turns go to stderr.
110
- - With `--json`, writes NDJSON events for completed assistant/tool-result messages plus `done` / `error` / `aborted` outcomes; queued `user_message` events may also appear. Streaming deltas are omitted.
111
- - Headless runs still persist like normal sessions and show up in `/session` history for that working directory.
112
- - Interactive slash commands such as `/skill` without a name, `/model`, `/session`, `/mcp`, and `/help` are not available in headless mode.
113
-
114
40
  ## Settings
115
41
 
42
+ > Warning, settings have changed, update your old settings file!
43
+
116
44
  Global defaults live in `~/.config/mini-coder/settings.json`.
117
45
 
46
+ Create or edit it directly to set the default provider, model, reasoning effort, and any custom models. `customProviders` entries use the pi-ai `Model` shape; the top-level `provider` and `model` select the active entry.
47
+
118
48
  ```json
119
49
  {
50
+ "provider": "ollama",
51
+ "model": "llama3.1:8b",
52
+ "effort": "medium",
120
53
  "customProviders": [
121
54
  {
122
- "name": "lm-studio",
123
- "baseUrl": "http://127.0.0.1:1234/v1"
55
+ "id": "llama3.1:8b",
56
+ "name": "Llama 3.1 8B (Ollama)",
57
+ "api": "openai-completions",
58
+ "provider": "ollama",
59
+ "baseUrl": "http://localhost:11434/v1",
60
+ "reasoning": false,
61
+ "input": ["text"],
62
+ "cost": {
63
+ "input": 0,
64
+ "output": 0,
65
+ "cacheRead": 0,
66
+ "cacheWrite": 0
67
+ },
68
+ "contextWindow": 128000,
69
+ "maxTokens": 32000
124
70
  }
125
- ],
126
- "mcp": {
127
- "servers": [
128
- {
129
- "name": "docs",
130
- "url": "http://127.0.0.1:8787/mcp",
131
- "enabled": true
132
- }
133
- ]
134
- }
71
+ ]
135
72
  }
136
73
  ```
137
74
 
138
- - `mcp.servers` currently supports Streamable HTTP MCP endpoints.
139
- - Each server `name` becomes the imported tool prefix, so a remote `search` tool appears as `docs__search`.
140
- - MCP servers with `enabled: true` connect at startup; disabled ones stay disconnected until you turn them back on.
141
- - Invalid MCP URLs are skipped immediately, and enabled servers that are unreachable are skipped with a warning.
142
- - `/mcp` can enable or disable configured MCP servers during the current app run, and that on/off state is persisted.
143
-
144
- ## Docs
145
-
146
- - **Docs site:** https://sacenox.github.io/mini-coder/
147
- - **Spec:** [`spec.md`](spec.md)
148
- - **Repo instructions:** [`AGENTS.md`](AGENTS.md)
149
-
150
- ## Development
151
-
152
- ```bash
153
- bun install
154
- bun test
155
- bun run check
156
- bun run format
157
- bun run typecheck
158
- ```
75
+ Use `api: "openai-completions"` for OpenAI-compatible servers such as Ollama, vLLM, LiteLLM, and local proxies. For local OpenAI-compatible custom providers, mini-coder supplies the dummy API key required by pi-ai when no real key is needed.
159
76
 
160
77
  ## Also makes LLMs smarter
161
78
 
package/bin/mc.ts CHANGED
@@ -1,14 +1,11 @@
1
1
  #!/usr/bin/env bun
2
-
3
- /**
4
- * Executable launcher for the mini-coder CLI.
5
- *
6
- * @module
7
- */
8
-
9
2
  import { main } from "../src/index.ts";
10
3
 
11
- main().catch((err) => {
12
- console.error(err instanceof Error ? err.message : String(err));
13
- process.exit(1);
14
- });
4
+ if (import.meta.main) {
5
+ try {
6
+ await main();
7
+ } catch (err) {
8
+ console.log(err instanceof Error ? err.message : String(err));
9
+ process.exit(1);
10
+ }
11
+ }