monkeyscode-cli 0.1.12 → 1.0.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 +148 -51
- package/dist/monkeyscode-cli.cjs +894 -448
- package/package.json +5 -3
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> AI-powered coding agent for the terminal. Works on macOS, Linux, and Windows.
|
|
4
4
|
|
|
5
|
-
[](https://www.npmjs.com/package/monkeyscode-cli)
|
|
6
6
|
[](https://github.com/MonkeysCloud/monkeyscode/actions)
|
|
7
7
|
[](LICENSE)
|
|
8
8
|
|
|
@@ -12,23 +12,25 @@
|
|
|
12
12
|
## Quick Install
|
|
13
13
|
|
|
14
14
|
```bash
|
|
15
|
-
# macOS / Linux
|
|
16
|
-
curl -fsSL https://monkeyscode.com/install.sh |
|
|
15
|
+
# macOS / Linux (installs `mc` to /usr/local/bin; override with MC_INSTALL_DIR)
|
|
16
|
+
curl -fsSL https://monkeyscode.com/cli/install.sh | bash
|
|
17
17
|
|
|
18
18
|
# Windows (PowerShell)
|
|
19
|
-
irm https://monkeyscode.com/install.ps1 | iex
|
|
19
|
+
irm https://monkeyscode.com/cli/install.ps1 | iex
|
|
20
20
|
|
|
21
|
-
# npm
|
|
22
|
-
npm install -g
|
|
23
|
-
|
|
24
|
-
# Homebrew
|
|
25
|
-
brew install monkeyscode
|
|
21
|
+
# npm (Node 18+)
|
|
22
|
+
npm install -g monkeyscode-cli
|
|
26
23
|
```
|
|
27
24
|
|
|
25
|
+
The binary is installed as `mc`, with `monkeyscode` (and `mcode` from the
|
|
26
|
+
install script) as aliases. A Homebrew formula template lives in
|
|
27
|
+
`packaging/homebrew/`, but there is no published tap yet.
|
|
28
|
+
|
|
28
29
|
## Usage
|
|
29
30
|
|
|
30
31
|
```bash
|
|
31
|
-
# Interactive REPL
|
|
32
|
+
# Interactive REPL (optionally with a first prompt)
|
|
33
|
+
mc
|
|
32
34
|
mc "refactor the auth module"
|
|
33
35
|
|
|
34
36
|
# Headless (CI/CD)
|
|
@@ -37,11 +39,11 @@ mc -p "fix all lint errors" --headless --auto-approve
|
|
|
37
39
|
# Background job with auto-PR
|
|
38
40
|
mc -p "write tests" --background --auto-branch --auto-pr
|
|
39
41
|
|
|
40
|
-
# Pipe mode
|
|
42
|
+
# Pipe mode: stdin becomes the prompt, the answer goes to stdout
|
|
41
43
|
echo "explain this error" | mc
|
|
42
44
|
|
|
43
45
|
# Model selection
|
|
44
|
-
mc --model
|
|
46
|
+
mc --model opus "deep architecture review"
|
|
45
47
|
```
|
|
46
48
|
|
|
47
49
|
<!-- TODO: Record with asciinema and convert to GIF -->
|
|
@@ -50,11 +52,13 @@ mc --model claude-opus "deep architecture review"
|
|
|
50
52
|
## Features
|
|
51
53
|
|
|
52
54
|
### 🤖 Multi-Model Support
|
|
53
|
-
Switch between
|
|
55
|
+
Switch between MonkeysCode's own Capuchin model (the default), Claude Sonnet
|
|
56
|
+
and Opus, Gemini 2.5 Pro, and GPT-4.1. `mc models list` shows the full list with
|
|
57
|
+
pricing.
|
|
54
58
|
|
|
55
59
|
```bash
|
|
56
|
-
mc --model auto "fix the bug"
|
|
57
|
-
mc --model
|
|
60
|
+
mc --model auto "fix the bug" # Your configured default model
|
|
61
|
+
mc --model opus "review PR" # Aliases: sonnet, opus, capuchin, or a full model id
|
|
58
62
|
```
|
|
59
63
|
|
|
60
64
|
### 📁 Full Tool Suite
|
|
@@ -64,11 +68,14 @@ The agent can edit files, run terminal commands, search code, and manage git —
|
|
|
64
68
|
<!--  -->
|
|
65
69
|
|
|
66
70
|
### 🔒 Sandboxed Execution
|
|
67
|
-
Run agent commands in isolated sandboxes (bubblewrap, sandbox-exec
|
|
71
|
+
Run agent commands in isolated sandboxes (bubblewrap on Linux, sandbox-exec on
|
|
72
|
+
macOS, Docker anywhere). The best available provider is picked automatically;
|
|
73
|
+
without one, `--sandbox` reports it as unavailable instead of pretending.
|
|
68
74
|
|
|
69
75
|
```bash
|
|
70
76
|
mc --sandbox "run the migration script"
|
|
71
|
-
mc --sandbox-network
|
|
77
|
+
mc --sandbox --sandbox-network none "process sensitive data" # none | local | full
|
|
78
|
+
mc --sandbox --sandbox-provider docker "try the install script"
|
|
72
79
|
```
|
|
73
80
|
|
|
74
81
|
### 🌐 Background Jobs
|
|
@@ -90,32 +97,82 @@ mc dream # Consolidate session history into memory
|
|
|
90
97
|
```
|
|
91
98
|
|
|
92
99
|
### ⚡ CI/CD Integration
|
|
93
|
-
Run headlessly in GitHub Actions, GitLab CI, or any CI system.
|
|
100
|
+
Run headlessly in GitHub Actions, GitLab CI, or any CI system. The action lives
|
|
101
|
+
in this directory (`apps/cli/action.yml`), not at the repository root:
|
|
94
102
|
|
|
95
103
|
```yaml
|
|
96
|
-
# .github/workflows/
|
|
97
|
-
- uses: MonkeysCloud/monkeyscode@main
|
|
104
|
+
# .github/workflows/monkeyscode-mention.yml — answers "@monkeyscode …" comments, read-only
|
|
105
|
+
- uses: MonkeysCloud/monkeyscode/apps/cli@main
|
|
98
106
|
with:
|
|
99
|
-
prompt: 'Review this PR'
|
|
100
|
-
mode: plan
|
|
101
|
-
output: github
|
|
102
107
|
api-key: ${{ secrets.MONKEYSCODE_API_KEY }}
|
|
108
|
+
max-cost: '1'
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Ready-made workflows are in [`workflows/`](workflows/): PR review (SARIF),
|
|
112
|
+
`@monkeyscode` mentions, fix failing CI → PR, issue → draft PR, and nightly
|
|
113
|
+
dependency updates. Each one limits what the agent may run, never lets it
|
|
114
|
+
push, and skips fork runs that would expose your key. Give CI a
|
|
115
|
+
**restricted key** (spend cap + model allowlist); the action warns when it
|
|
116
|
+
isn't. See [docs/cli/ci.md](../../docs/cli/ci.md).
|
|
117
|
+
|
|
118
|
+
Anywhere else, call the CLI directly:
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
mc -p "fix the failing test" --allowed-tools "run_command(npm test:*)" "edit_file(src/**)" -o json --max-cost 2
|
|
122
|
+
git diff | mc -p "review this diff" # stdin is appended to the prompt
|
|
123
|
+
mc -p -o stream-json "refactor utils" # one JSON event per line
|
|
103
124
|
```
|
|
104
125
|
|
|
126
|
+
The exit code tells you what happened: `0` ok, `2` bad flags, `3` auth,
|
|
127
|
+
`4` quota, `5` `--max-cost`/`--max-tokens`, `6` only denials, `124`
|
|
128
|
+
timeout. Flags, the event stream, multi-turn stdin and permission prompts are in
|
|
129
|
+
[docs/cli/headless.md](../../docs/cli/headless.md).
|
|
130
|
+
|
|
105
131
|
### 🔌 MCP Servers
|
|
106
132
|
Extend the agent with custom tools via the Model Context Protocol.
|
|
107
133
|
|
|
108
134
|
```bash
|
|
109
|
-
mc mcp
|
|
110
|
-
mc mcp add
|
|
135
|
+
mc mcp browse # 35+ curated servers
|
|
136
|
+
mc mcp add jira # Add from the registry by id
|
|
137
|
+
mc mcp add my-tools npx -y my-mcp-server # Or any command
|
|
111
138
|
mc mcp list
|
|
112
139
|
```
|
|
113
140
|
|
|
141
|
+
Servers start in the background when a session opens; their tools reach the model as
|
|
142
|
+
`mcp__<server>__<tool>` (e.g. `mcp__jira__create_issue`) and follow permission rules like
|
|
143
|
+
any other tool (`mcp__jira__*` allows or denies a whole server). `/mcp` shows status and
|
|
144
|
+
tool counts and can `reconnect`, `disable` or `enable` a server for the session.
|
|
145
|
+
|
|
146
|
+
A server defined by the repository (`.monkeyscode/settings.json`, `.monkeyscode/mcp.json`)
|
|
147
|
+
runs a command someone else chose, so it does not start until you approve it with
|
|
148
|
+
`/mcp approve <name>` or `mc mcp approve <name>`. Editing the entry voids the approval.
|
|
149
|
+
Servers you add with `mc mcp add` are approved automatically.
|
|
150
|
+
|
|
151
|
+
### 🧩 Commands, Subagents, Skills, Hooks & Plugins
|
|
152
|
+
Extend the agent with plain files in `.monkeyscode/`, in Claude Code's formats:
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
mc import claude --dry-run # bring over .claude/ (commands, agents, skills, hooks, MCP)
|
|
156
|
+
mc import cursor # .cursor/rules, .cursorrules, .cursor/mcp.json
|
|
157
|
+
mc plugin install https://github.com/<owner>/<repo> # guarded: nothing from it runs
|
|
158
|
+
mc plugin enable <name> # review what it can do, then trust + enable
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
- `.monkeyscode/commands/*.md` → `/name` (`$ARGUMENTS`, `@file`, `` !`cmd` ``, `allowed-tools`)
|
|
162
|
+
- `.monkeyscode/agents/*.md` → subagents the model delegates to
|
|
163
|
+
- `.monkeyscode/skills/<name>/SKILL.md` → skills, loaded on demand
|
|
164
|
+
- `hooks` in settings → Claude-compatible hooks (exit 2 blocks)
|
|
165
|
+
|
|
166
|
+
Hooks, scripts and status lines from a repository wait for **workspace trust**.
|
|
167
|
+
Plugins are validated, hash-pinned, re-verified on every start and capped at runtime.
|
|
168
|
+
The full reference is [docs/cli/extensibility.md](../../docs/cli/extensibility.md).
|
|
169
|
+
|
|
114
170
|
### 👥 Multi-Agent Teams
|
|
115
171
|
Spawn parallel agents to divide and conquer large tasks.
|
|
116
172
|
|
|
117
173
|
```bash
|
|
118
|
-
|
|
174
|
+
# One quoted prompt per agent; each runs in its own git worktree
|
|
175
|
+
mc team spawn "Implement auth" "Implement payments" "Implement email" --max-agents 3
|
|
119
176
|
mc team status
|
|
120
177
|
mc team merge team-abc123
|
|
121
178
|
```
|
|
@@ -124,25 +181,54 @@ mc team merge team-abc123
|
|
|
124
181
|
|
|
125
182
|
| Format | Use Case |
|
|
126
183
|
|--------|----------|
|
|
127
|
-
| `text` |
|
|
128
|
-
| `json` |
|
|
129
|
-
| `
|
|
184
|
+
| `text` | The final answer (default) |
|
|
185
|
+
| `json` | One `result` object: answer, cost, usage, session id, denials |
|
|
186
|
+
| `stream-json` | Every event, one per line (the protocol the SDKs speak) |
|
|
187
|
+
| `jsonl` | Legacy event stream |
|
|
130
188
|
| `diff` | Unified diff (`git apply` compatible) |
|
|
131
189
|
| `markdown` | Clean markdown (for PR descriptions) |
|
|
132
190
|
| `github` | GitHub Actions output format |
|
|
133
191
|
| `azure` | Azure DevOps format |
|
|
134
192
|
| `sarif` | SARIF 2.1.0 for code scanning |
|
|
193
|
+
| `stream` | Raw event stream |
|
|
194
|
+
|
|
195
|
+
## Permissions & Effort
|
|
196
|
+
|
|
197
|
+
What the agent **may do** (permission mode + rules) and how hard the model
|
|
198
|
+
**thinks** (effort) are separate settings.
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
mc --permission-mode acceptEdits "refactor utils" # default | acceptEdits | plan | bypass
|
|
202
|
+
mc -p "fix tests" --headless --allowed-tools "run_command(npm test:*)" "edit_file(src/**)"
|
|
203
|
+
mc --effort high "find the race condition" # low | medium | high
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
In a session: Shift+Tab cycles `default` → `acceptEdits` → `plan`, `/plan` jumps to plan mode, `/effort high` changes
|
|
207
|
+
effort from the next request, and `/permissions` lists every effective rule
|
|
208
|
+
and the file it came from. Headless runs never prompt. A call that would
|
|
209
|
+
prompt is denied and reported in `permissionDenials`. If *only* denials
|
|
210
|
+
happened, the exit code is **6**.
|
|
211
|
+
|
|
212
|
+
The rule syntax, evaluation order and shell-command handling are in
|
|
213
|
+
[docs/cli/permissions.md](../../docs/cli/permissions.md).
|
|
135
214
|
|
|
136
215
|
## Configuration
|
|
137
216
|
|
|
138
217
|
```bash
|
|
139
|
-
mc config set
|
|
140
|
-
mc config set
|
|
141
|
-
mc config list
|
|
142
|
-
mc config path
|
|
218
|
+
mc config set model claude-sonnet # user settings
|
|
219
|
+
mc config set permissions.defaultMode acceptEdits --scope project
|
|
220
|
+
mc config list --show-origin # effective values + where each came from
|
|
221
|
+
mc config path # settings file locations
|
|
222
|
+
mc config migrate # fold legacy config.json/permissions.json/mcp.json
|
|
223
|
+
mc doctor # auth, settings layers, invalid rules, defaults
|
|
143
224
|
```
|
|
144
225
|
|
|
145
|
-
|
|
226
|
+
Settings are layered. From highest to lowest precedence: managed policy →
|
|
227
|
+
flags → env → `.monkeyscode/settings.local.json` (gitignored) →
|
|
228
|
+
`.monkeyscode/settings.json` (committed) → `~/.monkeyscode/settings.json`.
|
|
229
|
+
Permission rules are combined across layers. For other keys, the
|
|
230
|
+
highest-precedence layer wins. A repository can't set backend URLs or other
|
|
231
|
+
trusted-only keys. Legacy `config.json` files are still read.
|
|
146
232
|
|
|
147
233
|
## Shell Completions
|
|
148
234
|
|
|
@@ -150,7 +236,7 @@ Project-level config: `.monkeyscode/config.json`
|
|
|
150
236
|
mc completions bash >> ~/.bashrc
|
|
151
237
|
mc completions zsh >> ~/.zshrc
|
|
152
238
|
mc completions fish > ~/.config/fish/completions/mc.fish
|
|
153
|
-
mc completions
|
|
239
|
+
mc completions pwsh >> $PROFILE
|
|
154
240
|
```
|
|
155
241
|
|
|
156
242
|
## Slash Commands (REPL)
|
|
@@ -158,35 +244,40 @@ mc completions powershell >> $PROFILE
|
|
|
158
244
|
| Command | Description |
|
|
159
245
|
|---------|-------------|
|
|
160
246
|
| `/help` | Show all commands |
|
|
247
|
+
| `/clear` | Start a fresh conversation (the old one stays resumable); Ctrl+L only clears the screen |
|
|
161
248
|
| `/model <name>` | Switch model |
|
|
162
|
-
| `/
|
|
163
|
-
| `/
|
|
249
|
+
| `/plan` | Switch to plan (read-only) mode; Shift+Tab to cycle back |
|
|
250
|
+
| `/effort [low\|medium\|high]` | Show or set reasoning effort |
|
|
251
|
+
| `/permissions` | Show rules and their sources; `allow`/`deny`/`ask`/`remove` |
|
|
252
|
+
| `/status` | Model, mode, effort, context and cost at a glance |
|
|
253
|
+
| `/compact ["focus"]` | Summarise the conversation to free context |
|
|
164
254
|
| `/diff` | Show session changes |
|
|
165
|
-
| `/undo` | Revert last
|
|
255
|
+
| `/undo` | Revert the last turn's file changes |
|
|
166
256
|
| `/commit [msg]` | Commit changes |
|
|
167
257
|
| `/files` | List touched files |
|
|
168
|
-
| `/cost` |
|
|
258
|
+
| `/cost [all]` | Session cost totals plus a per-turn breakdown |
|
|
169
259
|
| `/vim` | Toggle Vim keybindings |
|
|
170
260
|
| `/cloud` | Hand off to cloud |
|
|
171
|
-
| `/context
|
|
261
|
+
| `/context [file]` | Show context usage, or add a file to it |
|
|
172
262
|
|
|
173
263
|
## SDK
|
|
174
264
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
```bash
|
|
178
|
-
npm install @monkeyscode/sdk
|
|
179
|
-
```
|
|
265
|
+
Run this agent from your own code, with your settings, rules, hooks and MCP
|
|
266
|
+
servers:
|
|
180
267
|
|
|
181
268
|
```typescript
|
|
182
|
-
import {
|
|
269
|
+
import { query } from '@monkeyscode/agent'; // the engine in process (Node)
|
|
183
270
|
|
|
184
|
-
const
|
|
185
|
-
const
|
|
186
|
-
console.log(result.summary);
|
|
271
|
+
const q = query({ prompt: 'Fix the failing test', options: { allowedTools: ['run_command(npm test:*)'], maxCostUsd: 1 } });
|
|
272
|
+
for await (const e of q) if (e.type === 'result') console.log(e.result);
|
|
187
273
|
```
|
|
188
274
|
|
|
189
|
-
|
|
275
|
+
From Python (`monkeyscode.cli_process`), Go (`monkeyscode.Query`) or
|
|
276
|
+
TypeScript (`@monkeyscode/sdk/subprocess`), the same API drives an installed
|
|
277
|
+
`mc` over stdio. Guide: [docs/cli/sdk.md](../../docs/cli/sdk.md).
|
|
278
|
+
|
|
279
|
+
The cloud clients (`MonkeysCode` in [`@monkeyscode/sdk`](../../packages/sdk-typescript/))
|
|
280
|
+
call the hosted API instead.
|
|
190
281
|
|
|
191
282
|
## Accessibility
|
|
192
283
|
|
|
@@ -216,9 +307,15 @@ Respects the `DO_NOT_TRACK=1` environment variable.
|
|
|
216
307
|
- [Core Runtime](../../docs/coding-agent/cli/01-core-runtime.md)
|
|
217
308
|
- [Interactive Experience](../../docs/coding-agent/cli/02-interactive-experience.md)
|
|
218
309
|
- [Auth & Configuration](../../docs/coding-agent/cli/03-auth-configuration.md)
|
|
219
|
-
- [Headless
|
|
310
|
+
- [Headless mode: flags, exit codes, stream-json](../../docs/cli/headless.md)
|
|
311
|
+
- [CI: workflow recipes and restricted keys](../../docs/cli/ci.md)
|
|
312
|
+
- [SDKs: in process and subprocess](../../docs/cli/sdk.md)
|
|
313
|
+
- [Headless / CI/CD (older overview)](../../docs/coding-agent/cli/04-headless-cicd.md)
|
|
220
314
|
- [Background & Cloud](../../docs/coding-agent/cli/05-background-cloud.md)
|
|
221
315
|
- [Distribution](../../docs/coding-agent/cli/06-distribution.md)
|
|
316
|
+
- [Permissions](../../docs/cli/permissions.md)
|
|
317
|
+
- [Extensibility: memory, commands, subagents, skills, hooks, MCP, plugins, import](../../docs/cli/extensibility.md)
|
|
318
|
+
- [Plugin marketplace contract](../../docs/plugin-marketplace.md)
|
|
222
319
|
- [SDK & Extensibility](../../docs/coding-agent/cli/07-sdk-extensibility.md)
|
|
223
320
|
|
|
224
321
|
## License
|