mini-coder 0.5.14 → 0.6.1

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 (70) hide show
  1. package/README.md +26 -109
  2. package/bin/mc.ts +8 -11
  3. package/bun.lock +79 -269
  4. package/nono-mini-coder.json +42 -0
  5. package/package.json +17 -22
  6. package/src/agent.ts +243 -1403
  7. package/src/args.ts +289 -0
  8. package/src/headless.ts +41 -359
  9. package/src/index.ts +29 -1016
  10. package/src/oauth.ts +117 -0
  11. package/src/prompt.ts +219 -284
  12. package/src/session.ts +55 -1306
  13. package/src/shared.ts +117 -38
  14. package/src/tool-bash.ts +110 -0
  15. package/src/tool-edit.ts +133 -0
  16. package/src/tool-read.ts +80 -293
  17. package/src/tui-components.ts +150 -0
  18. package/src/tui-conversation.ts +271 -0
  19. package/src/tui-editor.ts +29 -0
  20. package/src/tui-overlay.ts +403 -0
  21. package/src/tui.ts +228 -0
  22. package/src/types.ts +164 -0
  23. package/tsconfig.json +17 -0
  24. package/BENCHMARK.md +0 -107
  25. package/LICENSE +0 -9
  26. package/PROGRESS.md +0 -5
  27. package/assets/icon-1-minimal.svg +0 -31
  28. package/assets/icon-2-dark-terminal.svg +0 -48
  29. package/assets/icon-3-gradient-modern.svg +0 -45
  30. package/assets/icon-4-filled-bold.svg +0 -54
  31. package/assets/icon-5-community-badge.svg +0 -63
  32. package/assets/mc-claude-smart.png +0 -0
  33. package/assets/mc-gpt-smart.png +0 -0
  34. package/assets/preview-0-5-0.png +0 -0
  35. package/assets/preview.gif +0 -0
  36. package/benchmark-baseline.sh +0 -15
  37. package/benchmark-loop.sh +0 -19
  38. package/skills-lock.json +0 -15
  39. package/src/assistant-output.ts +0 -73
  40. package/src/cli.ts +0 -134
  41. package/src/delegation.ts +0 -238
  42. package/src/errors.ts +0 -15
  43. package/src/git.ts +0 -247
  44. package/src/input.ts +0 -168
  45. package/src/mcp.ts +0 -609
  46. package/src/paths.ts +0 -37
  47. package/src/session-message.ts +0 -385
  48. package/src/settings.ts +0 -449
  49. package/src/skills.ts +0 -271
  50. package/src/submit.ts +0 -376
  51. package/src/text.ts +0 -71
  52. package/src/theme.ts +0 -330
  53. package/src/tool-common.ts +0 -93
  54. package/src/tool-delegate.ts +0 -125
  55. package/src/tool-grep.ts +0 -606
  56. package/src/tool-shell.ts +0 -1051
  57. package/src/tools.ts +0 -1179
  58. package/src/ui/agent.ts +0 -320
  59. package/src/ui/commands.test.ts +0 -957
  60. package/src/ui/commands.ts +0 -848
  61. package/src/ui/conversation.test.ts +0 -585
  62. package/src/ui/conversation.ts +0 -1836
  63. package/src/ui/help.ts +0 -158
  64. package/src/ui/input.test.ts +0 -64
  65. package/src/ui/input.ts +0 -138
  66. package/src/ui/overlay.ts +0 -59
  67. package/src/ui/runtime.ts +0 -69
  68. package/src/ui/status.ts +0 -220
  69. package/src/ui.ts +0 -1190
  70. 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
 
@@ -36,127 +36,44 @@ $ mc
36
36
  - **Agent-first** — every decision serves the goal of reading code, making changes, and verifying them via the shell.
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
-
40
- ## Tools
41
-
42
- Seven 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
- - **`delegate`** — runs a bounded subtask in an isolated subagent session using the current model, prompt context, and tools.
46
- - **`read`** — reads UTF-8 text files from disk, optionally by line window.
47
- - **`grep`** — searches file contents with ripgrep-style options and returns structured matches.
48
- - **`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.
49
- - **`todoWrite`** — creates or updates the session todo list incrementally and returns the full current snapshot.
50
- - **`todoRead`** — returns the full current session todo list snapshot.
51
- - **`readImage`** — reads PNG, JPEG, GIF, and WebP files as model input. Only registered when the active model supports images.
52
- - **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`.
53
-
54
- ## Features
55
-
56
- - **Multi-provider model support** — Anthropic, OpenAI, Google, Bedrock, Mistral, Groq, xAI, OpenRouter, Ollama, Copilot, and more via pi-ai.
57
- - **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.
58
- - **Session persistence** — SQLite-backed sessions with undo, fork, resume, and cumulative usage stats. Sessions are scoped to the working directory.
59
- - **Reasoning and verbosity controls** — toggle thinking visibility and verbose tool rendering on demand. Preferences persist across launches.
60
- - **[AGENTS.md](https://agents.md) support** — project-specific instructions discovered root-to-leaf, with `~/.agents/` for global instructions.
61
- - **[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.
62
- - **Settings-driven MCP tools** — connect Streamable HTTP MCP servers from `~/.config/mini-coder/settings.json` and expose their tools directly in the core runtime.
63
-
64
- ## Commands
65
-
66
- | Command | Description |
67
- | ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
68
- | `/model` | Switch models and save the choice as the global default. |
69
- | `/session` | Open the session picker for the current working directory. |
70
- | `/new` | Start a fresh session and reset the running token and cost totals. |
71
- | `/fork` | Fork the current chat into a new session, keep the original, and add a UI-only `Forked session.` note. |
72
- | `/undo` | Remove the last conversational turn without touching filesystem changes. |
73
- | `/reasoning` | Show or hide model thinking. The setting is saved and restored on launch. |
74
- | `/verbose` | Toggle compact vs full rendering for verbose-aware tool previews/results, including shell, read, grep, edit previews/errors, and MCP tool blocks. |
75
- | `/mcp` | Open the MCP server picker and toggle configured servers on or off for future turns. |
76
- | `/todo` | Show the current session todo list in the conversation log as a UI-only checklist block. |
77
- | `/login` | Sign in with a supported OAuth provider. |
78
- | `/logout` | Remove saved OAuth credentials for a logged-in provider. |
79
- | `/effort` | Choose low, medium, high, or xhigh reasoning effort. |
80
- | `/help` | Show commands, current toggles, loaded AGENTS.md files, skills, and MCP servers with on/off state. |
81
- | `/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. |
82
-
83
- ## Key bindings
84
-
85
- | Key | Action |
86
- | ------------- | ---------------------------------------------------------------------------------------------------------- |
87
- | `Enter` | Submit message |
88
- | `Shift+Enter` | Insert newline |
89
- | `Escape` | Dismiss the overlay without changing the draft; otherwise interrupt the running turn; otherwise do nothing |
90
- | `Tab` | Autocomplete a path, or open the command picker when the draft starts with `/` without clearing the draft |
91
- | `Ctrl+R` | Search global raw input history |
92
- | `Ctrl+C` | Graceful exit |
93
- | `Ctrl+D` | Graceful exit when the input is empty |
94
- | `:q` | Graceful exit |
95
- | `Ctrl+Z` | Suspend the process |
96
- | Mouse wheel | Scroll conversation history |
97
-
98
- ## Headless one-shot mode
99
-
100
- mini-coder also supports a non-interactive one-shot mode for scripts and benchmark harnesses.
101
-
102
- ```bash
103
- $ mc -p "summarize this repo"
104
- $ printf '%s\n' 'fix the failing tests' | mc
105
- ```
106
-
107
- - Starts when `-p/--prompt` is provided or when stdin or stdout is not a TTY.
108
- - If stdout is redirected but stdin is still interactive, pass `-p`; headless mode will not fall back to an interactive prompt.
109
- - Uses the same parser as the TUI for plain text, `/skill:name`, and standalone image paths.
110
- - 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.
111
- - 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.
112
- - Headless runs still persist like normal sessions and show up in `/session` history for that working directory.
113
- - Interactive slash commands such as `/skill` without a name, `/model`, `/session`, `/mcp`, and `/help` are not available in headless mode.
39
+ - **Isolation friendly**— works inside [nono](https://nono.sh/). Suggested profile in `nono-mini-coder.json`
114
40
 
115
41
  ## Settings
116
42
 
43
+ > Warning, settings have changed, update your old settings file!
44
+
117
45
  Global defaults live in `~/.config/mini-coder/settings.json`.
118
46
 
47
+ 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.
48
+
119
49
  ```json
120
50
  {
51
+ "provider": "ollama",
52
+ "model": "llama3.1:8b",
53
+ "effort": "medium",
121
54
  "customProviders": [
122
55
  {
123
- "name": "lm-studio",
124
- "baseUrl": "http://127.0.0.1:1234/v1"
56
+ "id": "llama3.1:8b",
57
+ "name": "Llama 3.1 8B (Ollama)",
58
+ "api": "openai-completions",
59
+ "provider": "ollama",
60
+ "baseUrl": "http://localhost:11434/v1",
61
+ "reasoning": false,
62
+ "input": ["text"],
63
+ "cost": {
64
+ "input": 0,
65
+ "output": 0,
66
+ "cacheRead": 0,
67
+ "cacheWrite": 0
68
+ },
69
+ "contextWindow": 128000,
70
+ "maxTokens": 32000
125
71
  }
126
- ],
127
- "mcp": {
128
- "servers": [
129
- {
130
- "name": "docs",
131
- "url": "http://127.0.0.1:8787/mcp",
132
- "enabled": true
133
- }
134
- ]
135
- }
72
+ ]
136
73
  }
137
74
  ```
138
75
 
139
- - `mcp.servers` currently supports Streamable HTTP MCP endpoints.
140
- - Each server `name` becomes the imported tool prefix, so a remote `search` tool appears as `docs__search`.
141
- - MCP servers with `enabled: true` connect at startup; disabled ones stay disconnected until you turn them back on.
142
- - Invalid MCP URLs are skipped immediately, and enabled servers that are unreachable are skipped with a warning.
143
- - `/mcp` can enable or disable configured MCP servers during the current app run, and that on/off state is persisted.
144
-
145
- ## Docs
146
-
147
- - **Docs site:** https://sacenox.github.io/mini-coder/
148
- - **Spec:** [`spec.md`](spec.md)
149
- - **Repo instructions:** [`AGENTS.md`](AGENTS.md)
150
-
151
- ## Development
152
-
153
- ```bash
154
- bun install
155
- bun test
156
- bun run check
157
- bun run format
158
- bun run typecheck
159
- ```
76
+ 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.
160
77
 
161
78
  ## Also makes LLMs smarter
162
79
 
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
+ }