@diffra-ai/cli 0.1.2 → 0.1.3
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 +53 -47
- package/dist/bundle/chunks/{anthropic-messages-HME6WDIM.js → anthropic-messages-5EMOURYI.js} +1 -1
- package/dist/bundle/chunks/{azure-openai-responses-WKSFBZF5.js → azure-openai-responses-N67KWG2X.js} +1 -1
- package/dist/bundle/chunks/bedrock-converse-stream.js +1 -1
- package/dist/bundle/chunks/{chunk-SMYD2SB5.js → chunk-3UNTEQ65.js} +1 -1
- package/dist/bundle/chunks/{chunk-MJRIJM22.js → chunk-BF423NQ7.js} +1 -1
- package/dist/bundle/chunks/{chunk-QMZGTPRI.js → chunk-CES65UJH.js} +1 -1
- package/dist/bundle/chunks/{chunk-PXE534VH.js → chunk-HFTZ6OJJ.js} +2 -2
- package/dist/bundle/chunks/{chunk-RUI3NOFB.js → chunk-NEFH2K3C.js} +1 -1
- package/dist/bundle/chunks/{chunk-E3MJ4MPN.js → chunk-PISJX26Y.js} +1 -1
- package/dist/bundle/chunks/{chunk-6L2FT6AE.js → chunk-QYYUGS66.js} +1 -1
- package/dist/bundle/chunks/{chunk-3MKQN3ZR.js → chunk-RLMZZV4Q.js} +1 -1
- package/dist/bundle/chunks/{chunk-GRDBYTYT.js → chunk-RTPG7C5I.js} +4 -4
- package/dist/bundle/chunks/{chunk-MITPYV3F.js → chunk-VOKUVFV4.js} +1 -1
- package/dist/bundle/chunks/{chunk-PQGGR7SQ.js → chunk-VWWMBH3G.js} +1 -1
- package/dist/bundle/chunks/{cli-GKHAGQO6.js → cli-55VO5MAJ.js} +1 -1
- package/dist/bundle/chunks/{cloudflare-workers-ai-system-one-PVUECIVD.js → cloudflare-workers-ai-system-one-HB5U67WC.js} +1 -1
- package/dist/bundle/chunks/{google-generative-ai-2YH7DK5J.js → google-generative-ai-XRHE7R52.js} +1 -1
- package/dist/bundle/chunks/{google-vertex-QNIS4SPE.js → google-vertex-75CQOPKC.js} +1 -1
- package/dist/bundle/chunks/{llama-cpp-classify-EMBT3ZMY.js → llama-cpp-classify-LKIRB7ZR.js} +1 -1
- package/dist/bundle/chunks/{mistral-conversations-RCHJWX2M.js → mistral-conversations-KLGIHK73.js} +1 -1
- package/dist/bundle/chunks/{openai-codex-responses-LBZQ7HUY.js → openai-codex-responses-7L5VV67U.js} +1 -1
- package/dist/bundle/chunks/{openai-completions-U7NS5GFY.js → openai-completions-RBF6UXDW.js} +1 -1
- package/dist/bundle/chunks/{openai-decisions-YC4ZEGAR.js → openai-decisions-W3PJQIOF.js} +1 -1
- package/dist/bundle/chunks/{openai-responses-4YX6XMEO.js → openai-responses-W5ZMLOTR.js} +1 -1
- package/dist/bundle/chunks/{openrouter-images-QPPGKFJY.js → openrouter-images-4FW6VFV4.js} +1 -1
- package/dist/bundle/chunks/{pi-messages-5W3GZ7B6.js → pi-messages-RT7FVQ4G.js} +1 -1
- package/dist/bundle/chunks/{typesafe-system-one-GWMQ2NLX.js → typesafe-system-one-DSJ7OYVL.js} +1 -1
- package/dist/bundle/chunks/{virtual-modules-ENTYMDSQ.js → virtual-modules-M75O3ECA.js} +1 -1
- package/dist/bundle/cli-runtime.js +1 -1
- package/dist/bundle/index.js +1 -1
- package/dist/bundle/rpc-entry.js +1 -1
- package/dist/core/extensions/types.d.ts +2 -2
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/docs/approval-modes.md +99 -99
- package/docs/cli.md +380 -380
- package/docs/docs.json +264 -264
- package/docs/environment-variables.md +110 -110
- package/docs/extensions.md +3 -2
- package/docs/security.md +100 -100
- package/docs/settings.md +198 -198
- package/package.json +6 -6
package/docs/cli.md
CHANGED
|
@@ -1,380 +1,380 @@
|
|
|
1
|
-
<a id="cli-and-modes-reference"></a>
|
|
2
|
-
|
|
3
|
-
# Command Line
|
|
4
|
-
|
|
5
|
-
This page documents Diffra's built-in command-line commands and options. Run `diffra --help` or append `--help` to a command for the exact interface in your installed version. The top-level help also includes options registered by loaded extensions.
|
|
6
|
-
|
|
7
|
-
```sh
|
|
8
|
-
diffra [options] [--] [@files...] [messages...]
|
|
9
|
-
diffra install <source> [options]
|
|
10
|
-
diffra remove <source> [options]
|
|
11
|
-
diffra uninstall <source> [options]
|
|
12
|
-
diffra update [target] [options]
|
|
13
|
-
diffra list
|
|
14
|
-
diffra config [options]
|
|
15
|
-
diffra auth login <provider> [--api-key] [--no-browser]
|
|
16
|
-
diffra auth logout <provider>
|
|
17
|
-
diffra auth <check|print-api-key|print-bearer-token> [options]
|
|
18
|
-
diffra mcp <add|remove|list|login|logout> [options]
|
|
19
|
-
diffra sandbox <setup|uninstall|status>
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
<a id="modes"></a>
|
|
23
|
-
|
|
24
|
-
## Invocation and output
|
|
25
|
-
|
|
26
|
-
```sh
|
|
27
|
-
diffra
|
|
28
|
-
diffra --print "Summarize this repository"
|
|
29
|
-
git diff | diffra --print "Review this change"
|
|
30
|
-
diffra --mode json "Inspect this repository" > events.jsonl
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
With terminal stdin and stdout, Diffra opens the terminal UI unless `--print`, `--mode json`, or `--mode rpc` selects another interface. When either stream is redirected and neither JSON nor RPC mode is selected, Diffra uses print mode. See [CLI Integration](cli-integration.md) for choosing between interactive, print, JSON, RPC, and SDK integration.
|
|
34
|
-
|
|
35
|
-
| Input | Behavior |
|
|
36
|
-
|---|---|
|
|
37
|
-
| `message` | Provide an initial prompt |
|
|
38
|
-
| `@path` | Include a text file or image in the first prompt |
|
|
39
|
-
| Piped stdin | Prepend its contents to the first prompt |
|
|
40
|
-
| `--` | Stop option parsing so a prompt can begin with `-` |
|
|
41
|
-
|
|
42
|
-
Diffra resolves `@path` from the current working directory. The working directory also controls project configuration, resource discovery, and session grouping.
|
|
43
|
-
|
|
44
|
-
`--print` controls whether Diffra runs once and exits. `--mode` selects the output interface. `--mode text` does not force one-shot execution when stdin and stdout are terminals; use `--print` for that behavior.
|
|
45
|
-
|
|
46
|
-
| Option | Behavior |
|
|
47
|
-
|---|---|
|
|
48
|
-
| `-p`, `--print` | Run the supplied prompts, write the final assistant text to stdout, then exit |
|
|
49
|
-
| `--mode text` | Select text output; still open the terminal UI when stdin and stdout are terminals |
|
|
50
|
-
| `--mode json` | Run the supplied prompts, write JSONL events to stdout, then exit |
|
|
51
|
-
| `--mode rpc` | Read JSONL commands from stdin and write responses and events to stdout until shutdown |
|
|
52
|
-
| `--export <input> [output]` | Export a session file to HTML and exit; derive the destination when `output` is omitted |
|
|
53
|
-
|
|
54
|
-
RPC mode rejects `@file` arguments. JSON and RPC modes reserve stdout for protocol records. See [JSON Event Stream](json.md) and [RPC Protocol](rpc.md).
|
|
55
|
-
|
|
56
|
-
<a id="model-options"></a>
|
|
57
|
-
|
|
58
|
-
## Models
|
|
59
|
-
|
|
60
|
-
```sh
|
|
61
|
-
diffra --model sonnet:high
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
See [Choose a Model](models.md) for model selection and [Providers](providers.md) for credentials.
|
|
65
|
-
|
|
66
|
-
- `--provider <name>`<br>
|
|
67
|
-
Restricts `--model` lookup to one provider. It requires `--model`.
|
|
68
|
-
- `--model <pattern>`<br>
|
|
69
|
-
Selects by exact ID or fuzzy ID/name match. It accepts `provider/id` and an optional `:<thinking>` suffix. If several providers match, Diffra prefers the one with credentials, otherwise it asks for `--provider`.
|
|
70
|
-
- `--api-key <key>`<br>
|
|
71
|
-
Uses a non-persistent API-key override. It requires a model selected through `--model` or `--models`. It does not choose between providers that offer the same model.
|
|
72
|
-
- `--thinking <level>`<br>
|
|
73
|
-
Sets `off`, `minimal`, `low`, `medium`, `high`, `xhigh`, or `max`. It overrides a `--model` suffix and is clamped to the model's capabilities.
|
|
74
|
-
- `--models <patterns>`<br>
|
|
75
|
-
Sets a comma-separated scope for startup and cycling. It accepts exact IDs, fuzzy matches, case-insensitive globs, and optional `:<thinking>` suffixes. A model offered by several providers is added for each, with a warning.
|
|
76
|
-
- `--list-models [search]`<br>
|
|
77
|
-
Lists available models, optionally filtered by a fuzzy search, then exits.
|
|
78
|
-
|
|
79
|
-
<a id="session-options"></a>
|
|
80
|
-
|
|
81
|
-
## Sessions
|
|
82
|
-
|
|
83
|
-
```sh
|
|
84
|
-
diffra --continue
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
See [Sessions and Context](sessions.md) for resuming, forking, naming, and storing sessions.
|
|
88
|
-
|
|
89
|
-
- `-c`, `--continue`<br>
|
|
90
|
-
Continues the most recent session for the current directory.
|
|
91
|
-
- `-r`, `--resume`<br>
|
|
92
|
-
Opens the session selector and resumes the chosen session in its working directory. Press Tab to include sessions from other directories.
|
|
93
|
-
- `--session <path|id>`<br>
|
|
94
|
-
Opens a session by file path or full/partial ID, and resumes it in its working directory. If the ID only matches sessions stored for another directory, Diffra offers to fork it into the current directory instead.
|
|
95
|
-
- `--session-id <id>`<br>
|
|
96
|
-
Opens the current directory's existing session with the ID, or creates it otherwise. IDs accept letters, numbers, `.`, `_`, and `-`.
|
|
97
|
-
- `--fork <path|id>`<br>
|
|
98
|
-
Forks a session, chosen by file path or full/partial ID, into a new session in the current directory.
|
|
99
|
-
- `--session-dir <dir>`<br>
|
|
100
|
-
Overrides storage and lookup. It takes precedence over `DIFFRA_CODING_AGENT_SESSION_DIR` and the `sessionDir` setting.
|
|
101
|
-
- `--no-session`<br>
|
|
102
|
-
Uses an in-memory session that is not persisted.
|
|
103
|
-
- `-n`, `--name <name>`<br>
|
|
104
|
-
Sets the session display name.
|
|
105
|
-
|
|
106
|
-
Constraints:
|
|
107
|
-
|
|
108
|
-
- Session IDs must start and end with a letter or number.
|
|
109
|
-
- `--fork` cannot be combined with `--session`, `--continue`, `--resume`, or `--no-session`.
|
|
110
|
-
- `--session-id` cannot be combined with `--session`, `--continue`, or `--resume`. Combine it with `--fork` to choose the new ID.
|
|
111
|
-
|
|
112
|
-
<a id="tool-options"></a>
|
|
113
|
-
|
|
114
|
-
## Tools
|
|
115
|
-
|
|
116
|
-
```sh
|
|
117
|
-
diffra --tools read,grep,find,ls --print "Review this project"
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
See [Settings](settings.md#tools) for configuring the default tool selection.
|
|
121
|
-
|
|
122
|
-
- `-t`, `--tools <list>`<br>
|
|
123
|
-
Replaces the default selection with a comma-separated allowlist of built-in, extension, or custom tools. Entries are tool names or patterns where `*` matches any characters. MCP tools are kept unless an entry starts with `mcp__` (see [MCP tools](#mcp-tools)). A list of only `+name` and `-name` entries is not an allowlist; it changes the default selection instead.
|
|
124
|
-
- `-xt`, `--exclude-tools <list>`<br>
|
|
125
|
-
Disables comma-separated tool names or patterns after all other selection options, MCP tools included.
|
|
126
|
-
- `-nbt`, `--no-builtin-tools`<br>
|
|
127
|
-
Disables default built-in tools while retaining extension and custom tools.
|
|
128
|
-
- `-nt`, `--no-tools`<br>
|
|
129
|
-
Starts with all built-in, extension, custom, and MCP tools disabled.
|
|
130
|
-
|
|
131
|
-
Default enabled tools are `read`, `bash`, `edit`, and `write`, unless `defaultTools` changes them. `--tools` with plain names replaces the whole selection, so name every tool you want. Like `defaultTools`, it also accepts a list of only `+name` and `-name` entries, which adds tools to or removes them from the default selection: `diffra --tools +codemode,-write` keeps the other default tools, enables `codemode`, and disables `write`. These entries take exact tool names, not `*` patterns; use `--exclude-tools` to disable tools by pattern. Plain names and `+name`/`-name` entries cannot be mixed. `/reload` enables tools newly added to `defaultTools`, but a tool removed with `-name` stays removed.
|
|
132
|
-
|
|
133
|
-
<a id="mcp-tools"></a>
|
|
134
|
-
|
|
135
|
-
`--tools` selects the tools declared to the model. It does not remove MCP tools, whose reach is set by their [exposure](mcp.md#control-tool-exposure): `diffra --tools read,codemode` keeps every MCP tool callable from codemode scripts. An MCP tool that no entry names or matches is never declared directly, whatever its exposure; only `tool_search`, if listed, can load it. Once an entry starts with `mcp__`, `--tools` filters MCP tools too, so this keeps only the tools of the `radius` server:
|
|
136
|
-
|
|
137
|
-
```sh
|
|
138
|
-
diffra --tools read,bash,codemode,'mcp__radius__*'
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
The MCP resource tools (`list_mcp_resources`, `list_mcp_resource_templates`, `read_mcp_resource`) count as MCP tools. To remove MCP tools, use `--exclude-tools 'mcp__*'` or [`--no-mcp`](#resource-options).
|
|
142
|
-
|
|
143
|
-
| Built-in | Purpose |
|
|
144
|
-
|---|---|
|
|
145
|
-
| `read` | Read text files and supported images |
|
|
146
|
-
| `bash` | Run shell commands |
|
|
147
|
-
| `powershell` | Run PowerShell commands on Windows |
|
|
148
|
-
| `edit` | Apply exact text replacements to an existing file |
|
|
149
|
-
| `write` | Create or overwrite a file |
|
|
150
|
-
| `grep` | Search file contents |
|
|
151
|
-
| `find` | Find paths using glob patterns |
|
|
152
|
-
| `ls` | List directory contents |
|
|
153
|
-
|
|
154
|
-
Built-in extensions add more tools. They are off by default; the MCP extension turns `codemode` and `tool_search` on when an MCP server needs them (see [MCP](mcp.md#control-tool-exposure)). To enable them yourself, name them in `--tools` or `defaultTools`.
|
|
155
|
-
|
|
156
|
-
| Built-in extension | Purpose |
|
|
157
|
-
|---|---|
|
|
158
|
-
| `codemode` | Run JavaScript that calls the other tools, for example in parallel with `Promise.allSettled`; only the script's output reaches the model |
|
|
159
|
-
| `tool_search` | Search tools that are not declared to the model (`codemode` and `deferred` exposure, such as MCP tools) and declare the matches for the next call |
|
|
160
|
-
| `todo_write` | Keep a user-visible task list for multi-step work (see [Todo list](#todo-list)) |
|
|
161
|
-
|
|
162
|
-
More built-in extension tools are on without configuration: `web_fetch` reads a URL and is active by default, and `web_search` is active while a search backend is available (see [Fetch and Search the Web](web-tools.md)); `agent` delegates to [subagents](subagents.md) and `task_stop` cancels background ones; `enter_worktree` and `exit_worktree` work in a [git worktree](worktrees.md); `cron_create`, `cron_list`, `cron_delete`, and `loop_wakeup` [schedule prompts](scheduled-tasks.md); `exit_plan_mode` is declared in [plan mode](approval-modes.md#plan-mode).
|
|
163
|
-
|
|
164
|
-
### Enable codemode
|
|
165
|
-
|
|
166
|
-
To turn on `codemode` for every session, add it to the default tools in `~/.diffra/agent/settings.json` or a project's `.diffra/settings.json`:
|
|
167
|
-
|
|
168
|
-
```json
|
|
169
|
-
{
|
|
170
|
-
"defaultTools": ["+codemode"]
|
|
171
|
-
}
|
|
172
|
-
```
|
|
173
|
-
|
|
174
|
-
This keeps `read`, `bash`, `edit`, and `write` and adds `codemode`. For one invocation, add it with `--tools`:
|
|
175
|
-
|
|
176
|
-
```sh
|
|
177
|
-
diffra --tools +codemode
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
Codemode is useful without MCP: scripts can run several tool calls in parallel, filter large output before it reaches the model, call classifier models such as TypeSafe's Jev through `models.classify()` (see [Classifier models](models.md#use-classifier-models)), and generate images through `models.generateImages()` (see [Image models](models.md#use-image-models)).
|
|
181
|
-
|
|
182
|
-
### How codemode works
|
|
183
|
-
|
|
184
|
-
Scripts run in a QuickJS sandbox and reach the other tools through `tools.<name>(args)`. [Codemode](codemode.md) describes the script API, how tools are listed and found, the `store()` and `models` globals, and the limits.
|
|
185
|
-
|
|
186
|
-
### Tool search
|
|
187
|
-
|
|
188
|
-
`tool_search` is off by default; enable it with `"defaultTools": ["+tool_search"]` or `--tools`. It uses the same ranking as `searchTools()` over tools that are not declared yet and declares the matches for the next model call. Loaded tools are recorded in the session like other tool changes, so they stay declared on that branch.
|
|
189
|
-
|
|
190
|
-
### Todo list
|
|
191
|
-
|
|
192
|
-
`todo_write` is off by default; enable it with `"defaultTools": ["+todo_write"]` or `--tools +todo_write`. While it is active, the model keeps a short task list for complex or multi-step work. Each call sends the whole list; every todo has an `id`, `content`, a `status` (`pending`, `in_progress`, or `completed`), and optionally `blockedBy`, the ids of todos that must be completed first. Diffra rejects lists with blank ids or content, duplicate ids, and dependencies that are unknown, on the todo itself, or circular. When the model resends a todo of an unfinished list without `blockedBy`, its dependencies are kept; `"blockedBy": []` removes them.
|
|
193
|
-
|
|
194
|
-
The tool result shows the list: `○` pending, `◐` in progress, `●` completed. While a run is in progress and the latest list has scrolled up, a "Current tasks" panel above the editor shows up to five unfinished todos, in-progress first. It is hidden once the user sends a new message or every todo is completed.
|
|
195
|
-
|
|
196
|
-
The list is stored in the tool results of the session, so it survives `--resume` and follows `/tree` and `/fork`: each branch has the list of its latest `todo_write` call.
|
|
197
|
-
|
|
198
|
-
<a id="resource-options"></a>
|
|
199
|
-
|
|
200
|
-
## Resources
|
|
201
|
-
|
|
202
|
-
```sh
|
|
203
|
-
diffra --extension ./review.ts
|
|
204
|
-
```
|
|
205
|
-
|
|
206
|
-
See [Configuration](configuration.md) for conventional directories and project trust, [Settings](settings.md#resources) for configured paths, and [Diffra Packages](packages.md) for package sources.
|
|
207
|
-
|
|
208
|
-
- `-e`, `--extension <path>`<br>
|
|
209
|
-
Loads an extension file or directory, or a built-in extension such as `builtin:mcp`, and is repeatable.
|
|
210
|
-
- `-ne`, `--no-extensions`<br>
|
|
211
|
-
Disables discovered, configured, and built-in extensions. Explicit `-e` paths still load, so `diffra -ne -e builtin:mcp` keeps only the built-in MCP support.
|
|
212
|
-
- `--no-mcp`<br>
|
|
213
|
-
Disables the built-in MCP support for this run: no servers connect, and there are no MCP tools or `/mcp`. It does not affect an extension that replaces the built-in MCP support.
|
|
214
|
-
- `--skill <path>`<br>
|
|
215
|
-
Loads a skill file or directory and is repeatable.
|
|
216
|
-
- `-ns`, `--no-skills`<br>
|
|
217
|
-
Disables discovered and configured skills. Explicit `--skill` paths still load.
|
|
218
|
-
- `--prompt-template <path>`<br>
|
|
219
|
-
Loads a prompt-template file or directory and is repeatable.
|
|
220
|
-
- `-np`, `--no-prompt-templates`<br>
|
|
221
|
-
Disables discovered and configured templates. Explicit `--prompt-template` paths still load.
|
|
222
|
-
- `--theme <path>`<br>
|
|
223
|
-
Loads a theme file or directory and is repeatable.
|
|
224
|
-
- `--use-theme <name[/name]>`<br>
|
|
225
|
-
Selects the initial interactive theme for this run.
|
|
226
|
-
- `--no-themes`<br>
|
|
227
|
-
Disables discovered and configured themes. Explicit `--theme` paths still load.
|
|
228
|
-
- `-nc`, `--no-context-files`<br>
|
|
229
|
-
Disables `AGENTS.md` and `CLAUDE.md` discovery.
|
|
230
|
-
|
|
231
|
-
Resource paths apply only to the current process. Relative paths resolve from the current working directory.
|
|
232
|
-
|
|
233
|
-
<a id="prompt-and-display-options"></a>
|
|
234
|
-
|
|
235
|
-
## Prompts and process
|
|
236
|
-
|
|
237
|
-
```sh
|
|
238
|
-
diffra --append-system-prompt ./instructions.md
|
|
239
|
-
```
|
|
240
|
-
|
|
241
|
-
See [Configuration](configuration.md) for saved configuration, [Security](security.md#understand-project-trust) for project trust, and [Environment Variables](environment-variables.md) for process controls.
|
|
242
|
-
|
|
243
|
-
- `--system-prompt <text|path>`<br>
|
|
244
|
-
Replaces the default system prompt with text or the contents of an existing file.
|
|
245
|
-
- `--append-system-prompt <text|path>`<br>
|
|
246
|
-
Appends text or an existing file to the system prompt and is repeatable.
|
|
247
|
-
- `--tui-mode <mode>`<br>
|
|
248
|
-
Uses `fullscreen` (default) or `regular` terminal mode.
|
|
249
|
-
- `--verbose`<br>
|
|
250
|
-
Shows verbose interactive startup information, overriding `quietStartup`.
|
|
251
|
-
- `-a`, `--approve`<br>
|
|
252
|
-
Trusts project-local configuration and resources for this process.
|
|
253
|
-
- `-na`, `--no-approve`<br>
|
|
254
|
-
Ignores trust-gated project-local configuration and resources for this process.
|
|
255
|
-
- `--offline`<br>
|
|
256
|
-
Disables automatic network activity, including model catalog refreshes. Equivalent to `DIFFRA_OFFLINE=1`.
|
|
257
|
-
- `--worktree [name|#N|PR-url]`<br>
|
|
258
|
-
Runs the session in a git worktree under `.diffra/worktrees`: a new one, the existing one with that name, or one checked out from a pull request. See [Work in a Git Worktree](worktrees.md).
|
|
259
|
-
- `-h`, `--help`<br>
|
|
260
|
-
Shows help, including flags registered by loaded extensions, then exits.
|
|
261
|
-
- `-v`, `--version`<br>
|
|
262
|
-
Shows the Diffra version, then exits.
|
|
263
|
-
|
|
264
|
-
Extensions may register additional long-form options. Unknown short options are rejected.
|
|
265
|
-
|
|
266
|
-
## Package commands
|
|
267
|
-
|
|
268
|
-
```sh
|
|
269
|
-
diffra install npm:@scope/package
|
|
270
|
-
```
|
|
271
|
-
|
|
272
|
-
See [Diffra Packages](packages.md) for source formats, filtering, installation, and project scope.
|
|
273
|
-
|
|
274
|
-
### Common tasks
|
|
275
|
-
|
|
276
|
-
| Task | Command |
|
|
277
|
-
|---|---|
|
|
278
|
-
| Install a package | `diffra install <source>` |
|
|
279
|
-
| List configured packages | `diffra list` |
|
|
280
|
-
| Remove a package and its settings entry | `diffra remove <source>` |
|
|
281
|
-
| Configure which package resources load | `diffra config` |
|
|
282
|
-
|
|
283
|
-
Add `--local` or `-l` to `install`, `remove`, `uninstall`, or `config` to use project settings instead of global settings.
|
|
284
|
-
|
|
285
|
-
### Update Diffra or packages
|
|
286
|
-
|
|
287
|
-
Running `diffra update` without a target updates Diffra itself.
|
|
288
|
-
|
|
289
|
-
| Task | Command |
|
|
290
|
-
|---|---|
|
|
291
|
-
| Update Diffra | `diffra update` |
|
|
292
|
-
| Update all installed packages | `diffra update --extensions` |
|
|
293
|
-
| Update one installed package | `diffra update <source>` |
|
|
294
|
-
| Refresh model catalogs | `diffra update --models` |
|
|
295
|
-
| Update Diffra and all installed packages | `diffra update --all` |
|
|
296
|
-
|
|
297
|
-
Add `--force` to reinstall Diffra when the selected update includes Diffra.
|
|
298
|
-
|
|
299
|
-
`diffra update` cannot update Diffra when another package manager provides it, such as Nix. Update Diffra with that package manager, for example `nix profile upgrade diffra`. Package and model catalog updates still work.
|
|
300
|
-
|
|
301
|
-
#### Custom update command
|
|
302
|
-
|
|
303
|
-
If a wrapper or another package manager provides Diffra, set `DIFFRA_SELF_UPDATE_COMMAND` so `diffra update` runs its update command:
|
|
304
|
-
|
|
305
|
-
```sh
|
|
306
|
-
export DIFFRA_SELF_UPDATE_COMMAND="mise use -g npm:{packageName}@{version}"
|
|
307
|
-
```
|
|
308
|
-
|
|
309
|
-
`diffra update` runs it only when the npm registry has a newer release, replacing `{packageName}`, `{version}`, and `{installSpec}` (`{packageName}@{version}`) with that release. The value is split on spaces. For arguments with spaces, use the `selfUpdateCommand` setting in `~/.diffra/agent/settings.json` instead, an argv array such as `["nix", "profile", "upgrade", "diffra"]`.
|
|
310
|
-
|
|
311
|
-
### Aliases and command options
|
|
312
|
-
|
|
313
|
-
- `diffra uninstall <source>` is an alias for `diffra remove <source>`.
|
|
314
|
-
- `diffra update --self`, `diffra update self`, and `diffra update diffra` are aliases for `diffra update`.
|
|
315
|
-
- `diffra update --extension <source>` is an alias for `diffra update <source>`.
|
|
316
|
-
- `-a`, `--approve` trusts project-local files for one command. `-na`, `--no-approve` ignores trust-gated project-local files.
|
|
317
|
-
- Append `-h` or `--help` to a command for its exact usage and option constraints.
|
|
318
|
-
|
|
319
|
-
## Credential commands
|
|
320
|
-
|
|
321
|
-
`diffra auth login <provider>` logs in to a provider in the terminal and exits, without starting a session. It signs in with an account and opens the browser, like `/login <provider>`. Providers without account sign-in ask for an API key. Logging in to Radius also adds the Radius MCP server to `~/.diffra/agent/mcp.json` when no global server uses that login yet. It requires an interactive terminal.
|
|
322
|
-
|
|
323
|
-
| Option | Description |
|
|
324
|
-
|---|---|
|
|
325
|
-
| `--api-key` | Save an API key instead of signing in with an account; the key is read without echoing it |
|
|
326
|
-
| `--no-browser` | Do not open a browser; use the provider's other sign-in method, such as a device code, for example over SSH. Asks when there are several. Not allowed with `--api-key` |
|
|
327
|
-
|
|
328
|
-
`diffra auth logout <provider>` removes the credentials that `diffra auth login` or `/login` stored, like `/logout`. Environment variables and `models.json` config are unchanged. It exits with status `0` when nothing is stored, so it is safe to repeat.
|
|
329
|
-
|
|
330
|
-
```sh
|
|
331
|
-
diffra auth login radius
|
|
332
|
-
diffra auth logout radius
|
|
333
|
-
diffra auth check --provider openai --json
|
|
334
|
-
```
|
|
335
|
-
|
|
336
|
-
The other authentication commands require `--provider <provider>` or `--model <model>`. See [Providers](providers.md) for supported methods.
|
|
337
|
-
|
|
338
|
-
| Command | Description |
|
|
339
|
-
|---|---|
|
|
340
|
-
| `diffra auth check` | Print `ready`, `not_ready`, or `invalid`; exit with status `0`, `1`, or `2`, respectively |
|
|
341
|
-
| `diffra auth print-api-key` | Print the resolved API key |
|
|
342
|
-
| `diffra auth print-bearer-token` | Print a resolved OAuth bearer token |
|
|
343
|
-
|
|
344
|
-
| Option | Applies to | Description |
|
|
345
|
-
|---|---|---|
|
|
346
|
-
| `--provider <provider>` | All | Resolve credentials for a provider |
|
|
347
|
-
| `--model <model>` | All | Resolve credentials from a model; may be combined with `--provider` |
|
|
348
|
-
| `--json` | `auth check` | Write the structured result as JSON |
|
|
349
|
-
| `--credentials` | `auth check` | Emit the resolved credential when ready |
|
|
350
|
-
| `--no-refresh` | `auth check` | Do not refresh expired OAuth credentials; refresh is the default |
|
|
351
|
-
| `--min-expiry <duration>` | `print-bearer-token` | Require remaining token lifetime using `ms`, `s`, `m`, or `h`, such as `30m` |
|
|
352
|
-
|
|
353
|
-
Credential-printing commands write secrets to stdout.
|
|
354
|
-
|
|
355
|
-
## MCP commands
|
|
356
|
-
|
|
357
|
-
These commands work outside a session, so agents can run them through `bash`. See [MCP Servers](mcp.md).
|
|
358
|
-
|
|
359
|
-
| Command | Description |
|
|
360
|
-
|---|---|
|
|
361
|
-
| `diffra mcp add <server> [options] -- <command> [args...]` | Add or replace a stdio server in `mcp.json`; `--env KEY=VALUE` (repeatable) and `--cwd <dir>` set its environment and working directory. Arguments after the command are passed to it |
|
|
362
|
-
| `diffra mcp add <server> [options] --url <url>` | Add or replace a streamable HTTP server; `--header KEY=VALUE` (repeatable), `--bearer-token-env-var <NAME>` (sends `Authorization: Bearer ${NAME}`), `--oauth-client-id`, `--oauth-client-secret`, `--oauth-callback-port`, `--oauth-client-name`, and `--oauth-client-registration` (`auto`, `cimd`, or `dcr`) configure authentication |
|
|
363
|
-
| `diffra mcp remove <server>` | Remove a server from `mcp.json`; stored OAuth credentials are kept |
|
|
364
|
-
| `diffra mcp list [--json]` | Connect to every enabled server and print its state, tools, and errors; exit with `1` when a config entry is invalid or an enabled server is not connected |
|
|
365
|
-
| `diffra mcp login <server> [-l] [--timeout <seconds>]` | Sign in to an OAuth server: open the authorization page and wait for the browser; a terminal also accepts the pasted redirect URL. `--timeout` limits the whole sign-in, including requests to the authorization server (default 300 seconds). `-l` requires the server to be defined in the project's `.diffra/mcp.json` |
|
|
366
|
-
| `diffra mcp logout <server> [-l]` | Delete the stored OAuth credentials of a server |
|
|
367
|
-
|
|
368
|
-
`add` and `remove` change `~/.diffra/agent/mcp.json`, or `.diffra/mcp.json` in the current directory with `--local` (`-l`). `add` also takes `--exposure <mode>` (see [Exposure](mcp.md#control-tool-exposure)) and `--description <text>` and does not connect; run `diffra mcp list` to check the server.
|
|
369
|
-
|
|
370
|
-
Project `.diffra/mcp.json` files are only read for projects that are already trusted.
|
|
371
|
-
|
|
372
|
-
## Sandbox commands
|
|
373
|
-
|
|
374
|
-
See [Sandbox Commands and Edits](sandbox.md).
|
|
375
|
-
|
|
376
|
-
| Command | Description |
|
|
377
|
-
|---|---|
|
|
378
|
-
| `diffra sandbox status` | Print the sandbox settings in effect, and on Windows whether the elevated sandbox is set up |
|
|
379
|
-
| `diffra sandbox setup` | Windows only: create the sandbox users, group, and firewall rule as administrator, and grant the users read access to your profile |
|
|
380
|
-
| `diffra sandbox uninstall` | Windows only: remove what `setup` created, as administrator |
|
|
1
|
+
<a id="cli-and-modes-reference"></a>
|
|
2
|
+
|
|
3
|
+
# Command Line
|
|
4
|
+
|
|
5
|
+
This page documents Diffra's built-in command-line commands and options. Run `diffra --help` or append `--help` to a command for the exact interface in your installed version. The top-level help also includes options registered by loaded extensions.
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
diffra [options] [--] [@files...] [messages...]
|
|
9
|
+
diffra install <source> [options]
|
|
10
|
+
diffra remove <source> [options]
|
|
11
|
+
diffra uninstall <source> [options]
|
|
12
|
+
diffra update [target] [options]
|
|
13
|
+
diffra list
|
|
14
|
+
diffra config [options]
|
|
15
|
+
diffra auth login <provider> [--api-key] [--no-browser]
|
|
16
|
+
diffra auth logout <provider>
|
|
17
|
+
diffra auth <check|print-api-key|print-bearer-token> [options]
|
|
18
|
+
diffra mcp <add|remove|list|login|logout> [options]
|
|
19
|
+
diffra sandbox <setup|uninstall|status>
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
<a id="modes"></a>
|
|
23
|
+
|
|
24
|
+
## Invocation and output
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
diffra
|
|
28
|
+
diffra --print "Summarize this repository"
|
|
29
|
+
git diff | diffra --print "Review this change"
|
|
30
|
+
diffra --mode json "Inspect this repository" > events.jsonl
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
With terminal stdin and stdout, Diffra opens the terminal UI unless `--print`, `--mode json`, or `--mode rpc` selects another interface. When either stream is redirected and neither JSON nor RPC mode is selected, Diffra uses print mode. See [CLI Integration](cli-integration.md) for choosing between interactive, print, JSON, RPC, and SDK integration.
|
|
34
|
+
|
|
35
|
+
| Input | Behavior |
|
|
36
|
+
|---|---|
|
|
37
|
+
| `message` | Provide an initial prompt |
|
|
38
|
+
| `@path` | Include a text file or image in the first prompt |
|
|
39
|
+
| Piped stdin | Prepend its contents to the first prompt |
|
|
40
|
+
| `--` | Stop option parsing so a prompt can begin with `-` |
|
|
41
|
+
|
|
42
|
+
Diffra resolves `@path` from the current working directory. The working directory also controls project configuration, resource discovery, and session grouping.
|
|
43
|
+
|
|
44
|
+
`--print` controls whether Diffra runs once and exits. `--mode` selects the output interface. `--mode text` does not force one-shot execution when stdin and stdout are terminals; use `--print` for that behavior.
|
|
45
|
+
|
|
46
|
+
| Option | Behavior |
|
|
47
|
+
|---|---|
|
|
48
|
+
| `-p`, `--print` | Run the supplied prompts, write the final assistant text to stdout, then exit |
|
|
49
|
+
| `--mode text` | Select text output; still open the terminal UI when stdin and stdout are terminals |
|
|
50
|
+
| `--mode json` | Run the supplied prompts, write JSONL events to stdout, then exit |
|
|
51
|
+
| `--mode rpc` | Read JSONL commands from stdin and write responses and events to stdout until shutdown |
|
|
52
|
+
| `--export <input> [output]` | Export a session file to HTML and exit; derive the destination when `output` is omitted |
|
|
53
|
+
|
|
54
|
+
RPC mode rejects `@file` arguments. JSON and RPC modes reserve stdout for protocol records. See [JSON Event Stream](json.md) and [RPC Protocol](rpc.md).
|
|
55
|
+
|
|
56
|
+
<a id="model-options"></a>
|
|
57
|
+
|
|
58
|
+
## Models
|
|
59
|
+
|
|
60
|
+
```sh
|
|
61
|
+
diffra --model sonnet:high
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
See [Choose a Model](models.md) for model selection and [Providers](providers.md) for credentials.
|
|
65
|
+
|
|
66
|
+
- `--provider <name>`<br>
|
|
67
|
+
Restricts `--model` lookup to one provider. It requires `--model`.
|
|
68
|
+
- `--model <pattern>`<br>
|
|
69
|
+
Selects by exact ID or fuzzy ID/name match. It accepts `provider/id` and an optional `:<thinking>` suffix. If several providers match, Diffra prefers the one with credentials, otherwise it asks for `--provider`.
|
|
70
|
+
- `--api-key <key>`<br>
|
|
71
|
+
Uses a non-persistent API-key override. It requires a model selected through `--model` or `--models`. It does not choose between providers that offer the same model.
|
|
72
|
+
- `--thinking <level>`<br>
|
|
73
|
+
Sets `off`, `minimal`, `low`, `medium`, `high`, `xhigh`, or `max`. It overrides a `--model` suffix and is clamped to the model's capabilities.
|
|
74
|
+
- `--models <patterns>`<br>
|
|
75
|
+
Sets a comma-separated scope for startup and cycling. It accepts exact IDs, fuzzy matches, case-insensitive globs, and optional `:<thinking>` suffixes. A model offered by several providers is added for each, with a warning.
|
|
76
|
+
- `--list-models [search]`<br>
|
|
77
|
+
Lists available models, optionally filtered by a fuzzy search, then exits.
|
|
78
|
+
|
|
79
|
+
<a id="session-options"></a>
|
|
80
|
+
|
|
81
|
+
## Sessions
|
|
82
|
+
|
|
83
|
+
```sh
|
|
84
|
+
diffra --continue
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
See [Sessions and Context](sessions.md) for resuming, forking, naming, and storing sessions.
|
|
88
|
+
|
|
89
|
+
- `-c`, `--continue`<br>
|
|
90
|
+
Continues the most recent session for the current directory.
|
|
91
|
+
- `-r`, `--resume`<br>
|
|
92
|
+
Opens the session selector and resumes the chosen session in its working directory. Press Tab to include sessions from other directories.
|
|
93
|
+
- `--session <path|id>`<br>
|
|
94
|
+
Opens a session by file path or full/partial ID, and resumes it in its working directory. If the ID only matches sessions stored for another directory, Diffra offers to fork it into the current directory instead.
|
|
95
|
+
- `--session-id <id>`<br>
|
|
96
|
+
Opens the current directory's existing session with the ID, or creates it otherwise. IDs accept letters, numbers, `.`, `_`, and `-`.
|
|
97
|
+
- `--fork <path|id>`<br>
|
|
98
|
+
Forks a session, chosen by file path or full/partial ID, into a new session in the current directory.
|
|
99
|
+
- `--session-dir <dir>`<br>
|
|
100
|
+
Overrides storage and lookup. It takes precedence over `DIFFRA_CODING_AGENT_SESSION_DIR` and the `sessionDir` setting.
|
|
101
|
+
- `--no-session`<br>
|
|
102
|
+
Uses an in-memory session that is not persisted.
|
|
103
|
+
- `-n`, `--name <name>`<br>
|
|
104
|
+
Sets the session display name.
|
|
105
|
+
|
|
106
|
+
Constraints:
|
|
107
|
+
|
|
108
|
+
- Session IDs must start and end with a letter or number.
|
|
109
|
+
- `--fork` cannot be combined with `--session`, `--continue`, `--resume`, or `--no-session`.
|
|
110
|
+
- `--session-id` cannot be combined with `--session`, `--continue`, or `--resume`. Combine it with `--fork` to choose the new ID.
|
|
111
|
+
|
|
112
|
+
<a id="tool-options"></a>
|
|
113
|
+
|
|
114
|
+
## Tools
|
|
115
|
+
|
|
116
|
+
```sh
|
|
117
|
+
diffra --tools read,grep,find,ls --print "Review this project"
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
See [Settings](settings.md#tools) for configuring the default tool selection.
|
|
121
|
+
|
|
122
|
+
- `-t`, `--tools <list>`<br>
|
|
123
|
+
Replaces the default selection with a comma-separated allowlist of built-in, extension, or custom tools. Entries are tool names or patterns where `*` matches any characters. MCP tools are kept unless an entry starts with `mcp__` (see [MCP tools](#mcp-tools)). A list of only `+name` and `-name` entries is not an allowlist; it changes the default selection instead.
|
|
124
|
+
- `-xt`, `--exclude-tools <list>`<br>
|
|
125
|
+
Disables comma-separated tool names or patterns after all other selection options, MCP tools included.
|
|
126
|
+
- `-nbt`, `--no-builtin-tools`<br>
|
|
127
|
+
Disables default built-in tools while retaining extension and custom tools.
|
|
128
|
+
- `-nt`, `--no-tools`<br>
|
|
129
|
+
Starts with all built-in, extension, custom, and MCP tools disabled.
|
|
130
|
+
|
|
131
|
+
Default enabled tools are `read`, `bash`, `edit`, and `write`, unless `defaultTools` changes them. `--tools` with plain names replaces the whole selection, so name every tool you want. Like `defaultTools`, it also accepts a list of only `+name` and `-name` entries, which adds tools to or removes them from the default selection: `diffra --tools +codemode,-write` keeps the other default tools, enables `codemode`, and disables `write`. These entries take exact tool names, not `*` patterns; use `--exclude-tools` to disable tools by pattern. Plain names and `+name`/`-name` entries cannot be mixed. `/reload` enables tools newly added to `defaultTools`, but a tool removed with `-name` stays removed.
|
|
132
|
+
|
|
133
|
+
<a id="mcp-tools"></a>
|
|
134
|
+
|
|
135
|
+
`--tools` selects the tools declared to the model. It does not remove MCP tools, whose reach is set by their [exposure](mcp.md#control-tool-exposure): `diffra --tools read,codemode` keeps every MCP tool callable from codemode scripts. An MCP tool that no entry names or matches is never declared directly, whatever its exposure; only `tool_search`, if listed, can load it. Once an entry starts with `mcp__`, `--tools` filters MCP tools too, so this keeps only the tools of the `radius` server:
|
|
136
|
+
|
|
137
|
+
```sh
|
|
138
|
+
diffra --tools read,bash,codemode,'mcp__radius__*'
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
The MCP resource tools (`list_mcp_resources`, `list_mcp_resource_templates`, `read_mcp_resource`) count as MCP tools. To remove MCP tools, use `--exclude-tools 'mcp__*'` or [`--no-mcp`](#resource-options).
|
|
142
|
+
|
|
143
|
+
| Built-in | Purpose |
|
|
144
|
+
|---|---|
|
|
145
|
+
| `read` | Read text files and supported images |
|
|
146
|
+
| `bash` | Run shell commands |
|
|
147
|
+
| `powershell` | Run PowerShell commands on Windows |
|
|
148
|
+
| `edit` | Apply exact text replacements to an existing file |
|
|
149
|
+
| `write` | Create or overwrite a file |
|
|
150
|
+
| `grep` | Search file contents |
|
|
151
|
+
| `find` | Find paths using glob patterns |
|
|
152
|
+
| `ls` | List directory contents |
|
|
153
|
+
|
|
154
|
+
Built-in extensions add more tools. They are off by default; the MCP extension turns `codemode` and `tool_search` on when an MCP server needs them (see [MCP](mcp.md#control-tool-exposure)). To enable them yourself, name them in `--tools` or `defaultTools`.
|
|
155
|
+
|
|
156
|
+
| Built-in extension | Purpose |
|
|
157
|
+
|---|---|
|
|
158
|
+
| `codemode` | Run JavaScript that calls the other tools, for example in parallel with `Promise.allSettled`; only the script's output reaches the model |
|
|
159
|
+
| `tool_search` | Search tools that are not declared to the model (`codemode` and `deferred` exposure, such as MCP tools) and declare the matches for the next call |
|
|
160
|
+
| `todo_write` | Keep a user-visible task list for multi-step work (see [Todo list](#todo-list)) |
|
|
161
|
+
|
|
162
|
+
More built-in extension tools are on without configuration: `web_fetch` reads a URL and is active by default, and `web_search` is active while a search backend is available (see [Fetch and Search the Web](web-tools.md)); `agent` delegates to [subagents](subagents.md) and `task_stop` cancels background ones; `enter_worktree` and `exit_worktree` work in a [git worktree](worktrees.md); `cron_create`, `cron_list`, `cron_delete`, and `loop_wakeup` [schedule prompts](scheduled-tasks.md); `exit_plan_mode` is declared in [plan mode](approval-modes.md#plan-mode).
|
|
163
|
+
|
|
164
|
+
### Enable codemode
|
|
165
|
+
|
|
166
|
+
To turn on `codemode` for every session, add it to the default tools in `~/.diffra/agent/settings.json` or a project's `.diffra/settings.json`:
|
|
167
|
+
|
|
168
|
+
```json
|
|
169
|
+
{
|
|
170
|
+
"defaultTools": ["+codemode"]
|
|
171
|
+
}
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
This keeps `read`, `bash`, `edit`, and `write` and adds `codemode`. For one invocation, add it with `--tools`:
|
|
175
|
+
|
|
176
|
+
```sh
|
|
177
|
+
diffra --tools +codemode
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Codemode is useful without MCP: scripts can run several tool calls in parallel, filter large output before it reaches the model, call classifier models such as TypeSafe's Jev through `models.classify()` (see [Classifier models](models.md#use-classifier-models)), and generate images through `models.generateImages()` (see [Image models](models.md#use-image-models)).
|
|
181
|
+
|
|
182
|
+
### How codemode works
|
|
183
|
+
|
|
184
|
+
Scripts run in a QuickJS sandbox and reach the other tools through `tools.<name>(args)`. [Codemode](codemode.md) describes the script API, how tools are listed and found, the `store()` and `models` globals, and the limits.
|
|
185
|
+
|
|
186
|
+
### Tool search
|
|
187
|
+
|
|
188
|
+
`tool_search` is off by default; enable it with `"defaultTools": ["+tool_search"]` or `--tools`. It uses the same ranking as `searchTools()` over tools that are not declared yet and declares the matches for the next model call. Loaded tools are recorded in the session like other tool changes, so they stay declared on that branch.
|
|
189
|
+
|
|
190
|
+
### Todo list
|
|
191
|
+
|
|
192
|
+
`todo_write` is off by default; enable it with `"defaultTools": ["+todo_write"]` or `--tools +todo_write`. While it is active, the model keeps a short task list for complex or multi-step work. Each call sends the whole list; every todo has an `id`, `content`, a `status` (`pending`, `in_progress`, or `completed`), and optionally `blockedBy`, the ids of todos that must be completed first. Diffra rejects lists with blank ids or content, duplicate ids, and dependencies that are unknown, on the todo itself, or circular. When the model resends a todo of an unfinished list without `blockedBy`, its dependencies are kept; `"blockedBy": []` removes them.
|
|
193
|
+
|
|
194
|
+
The tool result shows the list: `○` pending, `◐` in progress, `●` completed. While a run is in progress and the latest list has scrolled up, a "Current tasks" panel above the editor shows up to five unfinished todos, in-progress first. It is hidden once the user sends a new message or every todo is completed.
|
|
195
|
+
|
|
196
|
+
The list is stored in the tool results of the session, so it survives `--resume` and follows `/tree` and `/fork`: each branch has the list of its latest `todo_write` call.
|
|
197
|
+
|
|
198
|
+
<a id="resource-options"></a>
|
|
199
|
+
|
|
200
|
+
## Resources
|
|
201
|
+
|
|
202
|
+
```sh
|
|
203
|
+
diffra --extension ./review.ts
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
See [Configuration](configuration.md) for conventional directories and project trust, [Settings](settings.md#resources) for configured paths, and [Diffra Packages](packages.md) for package sources.
|
|
207
|
+
|
|
208
|
+
- `-e`, `--extension <path>`<br>
|
|
209
|
+
Loads an extension file or directory, or a built-in extension such as `builtin:mcp`, and is repeatable.
|
|
210
|
+
- `-ne`, `--no-extensions`<br>
|
|
211
|
+
Disables discovered, configured, and built-in extensions. Explicit `-e` paths still load, so `diffra -ne -e builtin:mcp` keeps only the built-in MCP support.
|
|
212
|
+
- `--no-mcp`<br>
|
|
213
|
+
Disables the built-in MCP support for this run: no servers connect, and there are no MCP tools or `/mcp`. It does not affect an extension that replaces the built-in MCP support.
|
|
214
|
+
- `--skill <path>`<br>
|
|
215
|
+
Loads a skill file or directory and is repeatable.
|
|
216
|
+
- `-ns`, `--no-skills`<br>
|
|
217
|
+
Disables discovered and configured skills. Explicit `--skill` paths still load.
|
|
218
|
+
- `--prompt-template <path>`<br>
|
|
219
|
+
Loads a prompt-template file or directory and is repeatable.
|
|
220
|
+
- `-np`, `--no-prompt-templates`<br>
|
|
221
|
+
Disables discovered and configured templates. Explicit `--prompt-template` paths still load.
|
|
222
|
+
- `--theme <path>`<br>
|
|
223
|
+
Loads a theme file or directory and is repeatable.
|
|
224
|
+
- `--use-theme <name[/name]>`<br>
|
|
225
|
+
Selects the initial interactive theme for this run.
|
|
226
|
+
- `--no-themes`<br>
|
|
227
|
+
Disables discovered and configured themes. Explicit `--theme` paths still load.
|
|
228
|
+
- `-nc`, `--no-context-files`<br>
|
|
229
|
+
Disables `AGENTS.md` and `CLAUDE.md` discovery.
|
|
230
|
+
|
|
231
|
+
Resource paths apply only to the current process. Relative paths resolve from the current working directory.
|
|
232
|
+
|
|
233
|
+
<a id="prompt-and-display-options"></a>
|
|
234
|
+
|
|
235
|
+
## Prompts and process
|
|
236
|
+
|
|
237
|
+
```sh
|
|
238
|
+
diffra --append-system-prompt ./instructions.md
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
See [Configuration](configuration.md) for saved configuration, [Security](security.md#understand-project-trust) for project trust, and [Environment Variables](environment-variables.md) for process controls.
|
|
242
|
+
|
|
243
|
+
- `--system-prompt <text|path>`<br>
|
|
244
|
+
Replaces the default system prompt with text or the contents of an existing file.
|
|
245
|
+
- `--append-system-prompt <text|path>`<br>
|
|
246
|
+
Appends text or an existing file to the system prompt and is repeatable.
|
|
247
|
+
- `--tui-mode <mode>`<br>
|
|
248
|
+
Uses `fullscreen` (default) or `regular` terminal mode.
|
|
249
|
+
- `--verbose`<br>
|
|
250
|
+
Shows verbose interactive startup information, overriding `quietStartup`.
|
|
251
|
+
- `-a`, `--approve`<br>
|
|
252
|
+
Trusts project-local configuration and resources for this process.
|
|
253
|
+
- `-na`, `--no-approve`<br>
|
|
254
|
+
Ignores trust-gated project-local configuration and resources for this process.
|
|
255
|
+
- `--offline`<br>
|
|
256
|
+
Disables automatic network activity, including model catalog refreshes. Equivalent to `DIFFRA_OFFLINE=1`.
|
|
257
|
+
- `--worktree [name|#N|PR-url]`<br>
|
|
258
|
+
Runs the session in a git worktree under `.diffra/worktrees`: a new one, the existing one with that name, or one checked out from a pull request. See [Work in a Git Worktree](worktrees.md).
|
|
259
|
+
- `-h`, `--help`<br>
|
|
260
|
+
Shows help, including flags registered by loaded extensions, then exits.
|
|
261
|
+
- `-v`, `--version`<br>
|
|
262
|
+
Shows the Diffra version, then exits.
|
|
263
|
+
|
|
264
|
+
Extensions may register additional long-form options. Unknown short options are rejected.
|
|
265
|
+
|
|
266
|
+
## Package commands
|
|
267
|
+
|
|
268
|
+
```sh
|
|
269
|
+
diffra install npm:@scope/package
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
See [Diffra Packages](packages.md) for source formats, filtering, installation, and project scope.
|
|
273
|
+
|
|
274
|
+
### Common tasks
|
|
275
|
+
|
|
276
|
+
| Task | Command |
|
|
277
|
+
|---|---|
|
|
278
|
+
| Install a package | `diffra install <source>` |
|
|
279
|
+
| List configured packages | `diffra list` |
|
|
280
|
+
| Remove a package and its settings entry | `diffra remove <source>` |
|
|
281
|
+
| Configure which package resources load | `diffra config` |
|
|
282
|
+
|
|
283
|
+
Add `--local` or `-l` to `install`, `remove`, `uninstall`, or `config` to use project settings instead of global settings.
|
|
284
|
+
|
|
285
|
+
### Update Diffra or packages
|
|
286
|
+
|
|
287
|
+
Running `diffra update` without a target updates Diffra itself.
|
|
288
|
+
|
|
289
|
+
| Task | Command |
|
|
290
|
+
|---|---|
|
|
291
|
+
| Update Diffra | `diffra update` |
|
|
292
|
+
| Update all installed packages | `diffra update --extensions` |
|
|
293
|
+
| Update one installed package | `diffra update <source>` |
|
|
294
|
+
| Refresh model catalogs | `diffra update --models` |
|
|
295
|
+
| Update Diffra and all installed packages | `diffra update --all` |
|
|
296
|
+
|
|
297
|
+
Add `--force` to reinstall Diffra when the selected update includes Diffra.
|
|
298
|
+
|
|
299
|
+
`diffra update` cannot update Diffra when another package manager provides it, such as Nix. Update Diffra with that package manager, for example `nix profile upgrade diffra`. Package and model catalog updates still work.
|
|
300
|
+
|
|
301
|
+
#### Custom update command
|
|
302
|
+
|
|
303
|
+
If a wrapper or another package manager provides Diffra, set `DIFFRA_SELF_UPDATE_COMMAND` so `diffra update` runs its update command:
|
|
304
|
+
|
|
305
|
+
```sh
|
|
306
|
+
export DIFFRA_SELF_UPDATE_COMMAND="mise use -g npm:{packageName}@{version}"
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
`diffra update` runs it only when the npm registry has a newer release, replacing `{packageName}`, `{version}`, and `{installSpec}` (`{packageName}@{version}`) with that release. The value is split on spaces. For arguments with spaces, use the `selfUpdateCommand` setting in `~/.diffra/agent/settings.json` instead, an argv array such as `["nix", "profile", "upgrade", "diffra"]`.
|
|
310
|
+
|
|
311
|
+
### Aliases and command options
|
|
312
|
+
|
|
313
|
+
- `diffra uninstall <source>` is an alias for `diffra remove <source>`.
|
|
314
|
+
- `diffra update --self`, `diffra update self`, and `diffra update diffra` are aliases for `diffra update`.
|
|
315
|
+
- `diffra update --extension <source>` is an alias for `diffra update <source>`.
|
|
316
|
+
- `-a`, `--approve` trusts project-local files for one command. `-na`, `--no-approve` ignores trust-gated project-local files.
|
|
317
|
+
- Append `-h` or `--help` to a command for its exact usage and option constraints.
|
|
318
|
+
|
|
319
|
+
## Credential commands
|
|
320
|
+
|
|
321
|
+
`diffra auth login <provider>` logs in to a provider in the terminal and exits, without starting a session. It signs in with an account and opens the browser, like `/login <provider>`. Providers without account sign-in ask for an API key. Logging in to Radius also adds the Radius MCP server to `~/.diffra/agent/mcp.json` when no global server uses that login yet. It requires an interactive terminal.
|
|
322
|
+
|
|
323
|
+
| Option | Description |
|
|
324
|
+
|---|---|
|
|
325
|
+
| `--api-key` | Save an API key instead of signing in with an account; the key is read without echoing it |
|
|
326
|
+
| `--no-browser` | Do not open a browser; use the provider's other sign-in method, such as a device code, for example over SSH. Asks when there are several. Not allowed with `--api-key` |
|
|
327
|
+
|
|
328
|
+
`diffra auth logout <provider>` removes the credentials that `diffra auth login` or `/login` stored, like `/logout`. Environment variables and `models.json` config are unchanged. It exits with status `0` when nothing is stored, so it is safe to repeat.
|
|
329
|
+
|
|
330
|
+
```sh
|
|
331
|
+
diffra auth login radius
|
|
332
|
+
diffra auth logout radius
|
|
333
|
+
diffra auth check --provider openai --json
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
The other authentication commands require `--provider <provider>` or `--model <model>`. See [Providers](providers.md) for supported methods.
|
|
337
|
+
|
|
338
|
+
| Command | Description |
|
|
339
|
+
|---|---|
|
|
340
|
+
| `diffra auth check` | Print `ready`, `not_ready`, or `invalid`; exit with status `0`, `1`, or `2`, respectively |
|
|
341
|
+
| `diffra auth print-api-key` | Print the resolved API key |
|
|
342
|
+
| `diffra auth print-bearer-token` | Print a resolved OAuth bearer token |
|
|
343
|
+
|
|
344
|
+
| Option | Applies to | Description |
|
|
345
|
+
|---|---|---|
|
|
346
|
+
| `--provider <provider>` | All | Resolve credentials for a provider |
|
|
347
|
+
| `--model <model>` | All | Resolve credentials from a model; may be combined with `--provider` |
|
|
348
|
+
| `--json` | `auth check` | Write the structured result as JSON |
|
|
349
|
+
| `--credentials` | `auth check` | Emit the resolved credential when ready |
|
|
350
|
+
| `--no-refresh` | `auth check` | Do not refresh expired OAuth credentials; refresh is the default |
|
|
351
|
+
| `--min-expiry <duration>` | `print-bearer-token` | Require remaining token lifetime using `ms`, `s`, `m`, or `h`, such as `30m` |
|
|
352
|
+
|
|
353
|
+
Credential-printing commands write secrets to stdout.
|
|
354
|
+
|
|
355
|
+
## MCP commands
|
|
356
|
+
|
|
357
|
+
These commands work outside a session, so agents can run them through `bash`. See [MCP Servers](mcp.md).
|
|
358
|
+
|
|
359
|
+
| Command | Description |
|
|
360
|
+
|---|---|
|
|
361
|
+
| `diffra mcp add <server> [options] -- <command> [args...]` | Add or replace a stdio server in `mcp.json`; `--env KEY=VALUE` (repeatable) and `--cwd <dir>` set its environment and working directory. Arguments after the command are passed to it |
|
|
362
|
+
| `diffra mcp add <server> [options] --url <url>` | Add or replace a streamable HTTP server; `--header KEY=VALUE` (repeatable), `--bearer-token-env-var <NAME>` (sends `Authorization: Bearer ${NAME}`), `--oauth-client-id`, `--oauth-client-secret`, `--oauth-callback-port`, `--oauth-client-name`, and `--oauth-client-registration` (`auto`, `cimd`, or `dcr`) configure authentication |
|
|
363
|
+
| `diffra mcp remove <server>` | Remove a server from `mcp.json`; stored OAuth credentials are kept |
|
|
364
|
+
| `diffra mcp list [--json]` | Connect to every enabled server and print its state, tools, and errors; exit with `1` when a config entry is invalid or an enabled server is not connected |
|
|
365
|
+
| `diffra mcp login <server> [-l] [--timeout <seconds>]` | Sign in to an OAuth server: open the authorization page and wait for the browser; a terminal also accepts the pasted redirect URL. `--timeout` limits the whole sign-in, including requests to the authorization server (default 300 seconds). `-l` requires the server to be defined in the project's `.diffra/mcp.json` |
|
|
366
|
+
| `diffra mcp logout <server> [-l]` | Delete the stored OAuth credentials of a server |
|
|
367
|
+
|
|
368
|
+
`add` and `remove` change `~/.diffra/agent/mcp.json`, or `.diffra/mcp.json` in the current directory with `--local` (`-l`). `add` also takes `--exposure <mode>` (see [Exposure](mcp.md#control-tool-exposure)) and `--description <text>` and does not connect; run `diffra mcp list` to check the server.
|
|
369
|
+
|
|
370
|
+
Project `.diffra/mcp.json` files are only read for projects that are already trusted.
|
|
371
|
+
|
|
372
|
+
## Sandbox commands
|
|
373
|
+
|
|
374
|
+
See [Sandbox Commands and Edits](sandbox.md).
|
|
375
|
+
|
|
376
|
+
| Command | Description |
|
|
377
|
+
|---|---|
|
|
378
|
+
| `diffra sandbox status` | Print the sandbox settings in effect, and on Windows whether the elevated sandbox is set up |
|
|
379
|
+
| `diffra sandbox setup` | Windows only: create the sandbox users, group, and firewall rule as administrator, and grant the users read access to your profile |
|
|
380
|
+
| `diffra sandbox uninstall` | Windows only: remove what `setup` created, as administrator |
|