command-code 1.4.0 → 1.4.2

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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # command-code
2
2
 
3
+ ## 1.4.2
4
+
5
+ ### Patch Changes
6
+
7
+ - fix(cli): honor `--model` / `-m` — the flag was validated then silently ignored
8
+
9
+ ## 1.4.1
10
+
11
+ ### Patch Changes
12
+
13
+ - fix: forward $defs on mcp tool schemas
14
+
3
15
  ## 1.4.0
4
16
 
5
17
  ### Minor Changes
@@ -35,9 +35,8 @@ the matching reference file.
35
35
  - `reference/custom-agents.md` — Custom Agents
36
36
  - `reference/memory.md` — Memory
37
37
  - `reference/headless.md` — Headless Mode
38
- - `reference/plan-mode.md` — Plan Mode and Auto-Accept Mode
39
- - `reference/plan-review.md` — Plan Review
40
- - `reference/checkpoints.md` — Sessions & Checkpoints
38
+ - `reference/plan-mode.md` — Plan Mode
39
+ - `reference/sessions.md` — Sessions & Checkpoints
41
40
  - `reference/models.md` — Command Code Models
42
41
  - `reference/product-help.md` — Product help (slash commands, CLI, taste, FAQ, pricing)
43
42
  <!-- generated:reference-index:end -->
@@ -319,7 +319,7 @@ Quick lookup:
319
319
 
320
320
  ## Next steps
321
321
 
322
- - [Interactive mode](https://commandcode.ai/docs/core-concepts/interactive-mode) - slash commands and session controls
323
- - [Background tasks](https://commandcode.ai/docs/core-concepts/background-tasks) - detached, long-running work
322
+ - [Interactive mode](https://commandcode.ai/docs/interactive-mode) - slash commands and session controls
323
+ - [Background tasks](https://commandcode.ai/docs/background-tasks) - detached, long-running work
324
324
  - [Memory](./memory.md) - project and user instructions in `AGENTS.md`
325
325
  - [Skills](./skills.md) - reusable skill packages vs. full subagents
@@ -1,345 +1,269 @@
1
- <!-- GENERATED FILE — do not edit. Source: packages/docs/src/app/core-concepts/slash-commands/page.mdx. Regenerate: pnpm generate:knowledge -->
1
+ <!-- GENERATED FILE — do not edit. Source: packages/docs/src/app/reference/slash-commands/page.mdx. Regenerate: pnpm generate:knowledge -->
2
2
 
3
3
  # Slash Commands
4
4
 
5
- Command Code includes built-in slash commands for interactive workflows, and also supports custom slash commands from markdown files.
5
+ Command Code ships with **over 60 built-in slash commands** covering sessions, context, permission modes, models, billing, and everything in between - and you can extend the set with your own custom commands, skills, and mod-added commands.
6
6
 
7
- ---
7
+ ## How the slash menu works
8
8
 
9
- ## Built-in Slash Commands
9
+ Type `/` at the start of the input to open the command menu:
10
10
 
11
- For the full list of built-in slash commands, see [Interactive Mode - Slash Commands](https://commandcode.ai/docs/reference/cli#cli-slash-commands).
11
+ - **Filtering** - as you type, rows are ranked by match quality: a command whose name starts with your query ranks highest, then commands containing it, then description matches. The list re-sorts on every keystroke.
12
+ - **Exact-match highlighting** - the input text stays plain while you type a partial name; it only turns accent-colored once it names a real command (a half-typed `/mod` stays plain, `/model` lights up).
13
+ - **Aliases on canonical rows** - an alias is not a second menu row. `/new` resolves to `/clear` everywhere, and the single canonical row advertises it as `/clear (new)`. Typing the alias still surfaces and ranks that row.
14
+ - **Navigation** - `↑`/`↓` move the selection, `Enter` runs the selected command, `Tab` or `→` inserts it into the input with a trailing space so you can type arguments, `Esc` closes the menu.
15
+ - **Dynamic rows** - custom commands, mod commands, and skills load asynchronously; built-ins render first and the dynamic rows appear as discovery settles.
12
16
 
13
17
  ---
14
18
 
15
- ## Custom Slash Commands
16
-
17
- Custom slash commands let you save frequently used prompts as markdown files. Define a command once, then run it anytime with dynamic arguments. Commands can be project-level or user-level (shared across all projects).
18
-
19
- ---
20
-
21
- ## Syntax
22
-
23
- ```bash
24
- /<command-name> [arguments]
25
- ```
26
-
27
- | **Parameter** | **Description** |
28
- | ---------------- | ----------------------------------------------------------------- |
29
- | `<command-name>` | Name derived from the markdown filename (without `.md` extension) |
30
- | `[arguments]` | Optional arguments passed to the command |
19
+ ## Built-in Commands
20
+
21
+ Every built-in command, grouped by area. Aliases are shown in parentheses on the canonical command; optional arguments in `[brackets]`, alternatives separated by `|`.
22
+
23
+ ### Sessions
24
+
25
+ | **Command** | **Description** |
26
+ | ------------------------------ | ----------------------------------------------------------------------------------------------------- |
27
+ | `/clear` (`/new`) | Start a new session with empty context; previous stays on disk, resumable with `/resume` |
28
+ | `/resume` (`/sessions`) | Resume a past conversation |
29
+ | `/rename [name]` | Rename the current session |
30
+ | `/name [name]` | Alias of `/rename`; bare `/name` shows the current name |
31
+ | `/fork [name]` | Fork the conversation into a new session |
32
+ | `/clone` | Clone the current branch into a new session and switch to it (never takes an argument) |
33
+ | `/tree` | Browse the session tree and jump to any point in it |
34
+ | `/rewind` | Restore to a previous checkpoint (press Esc twice) |
35
+ | `/session` | Show session info: id, model, messages, context |
36
+ | `/session-file` | Show the current session id and session file path |
37
+ | `/export [html\|jsonl\|md]` or `/export <path>` | Export the session - a bare format keyword or a file path; HTML is the default format |
38
+ | `/share [gist [html\|jsonl\|md]]` | Share the conversation - bare `/share` copies a link; `/share gist` posts a secret GitHub gist |
39
+ | `/unshare` | Stop sharing conversation |
40
+ | `/exit` (`/quit`) | Exit Command Code |
41
+ | `/reload` | Restart Command Code and resume this session (applies a staged update) |
42
+
43
+ ### Context & Compaction
44
+
45
+ | **Command** | **Description** |
46
+ | --------------- | -------------------------------------------- |
47
+ | `/compact` | Compact the conversation history |
48
+ | `/compact-mode` | Select a compact mode to compact sessions |
49
+ | `/context` | Show context window usage and breakdown |
50
+ | `/memory` | Manage Command Code memory |
51
+ | `/init` | Initialize AGENTS.md for this project |
52
+
53
+ ### Modes & Planning
54
+
55
+ | **Command** | **Description** |
56
+ | ------------------------------------ | ---------------------------------------------------------------------------------- |
57
+ | `/mode [default\|auto-accept\|plan]` | Show or switch the permission mode; bare `/mode` prints the current mode |
58
+ | `/mode:default` | Switch to default mode (prompt before edits/commands) |
59
+ | `/mode:auto-accept` | Switch to auto-accept mode (accept edits automatically) |
60
+ | `/mode:plan` | Switch to plan mode (read-only, no side effects) |
61
+ | `/plan [task]` | Enter plan mode; `/plan <task>` plans that task |
62
+ | `/plans [name]` | Browse, review, and annotate saved plans; bare `/plans` opens the browser |
63
+ | `/plan-review` | Open this session's latest plan in review |
64
+ | `/goal <objective>\|clear\|status` | Set an objective for the agent to work towards autonomously |
65
+ | `/todos` | Manage the session todo list - `c` completes the selected item, `x` removes it, `a` clears the list |
66
+ | `/review [pr-number]` | Review a pull request |
67
+ | `/pr-comments` | Fetch all PR comments for current branch |
68
+
69
+ Yolo (bypass permissions) mode is deliberately **not** switchable via
70
+ `/mode` - slash commands are agent-invokable, so a mid-session route into
71
+ bypass would let the model disable its own permission prompts. It is only
72
+ reachable through the explicit `--yolo` launch flag, which also adds it to
73
+ the shift+tab mode cycle.
74
+
75
+ ### Models & Providers
76
+
77
+ | **Command** | **Description** |
78
+ | ----------------- | ---------------------------------------------------------------------------------------- |
79
+ | `/model [id]` | Switch between Command Code models - `/model <id>` applies directly, bare opens a picker |
80
+ | `/effort [level]` | Set reasoning effort for the current model (levels depend on the model) |
81
+ | `/provider` | Select AI provider (Command Code or Anthropic) |
82
+ | `/login` | Log in to Command Code or a provider |
83
+ | `/logout` | Log out of Command Code or a provider |
84
+
85
+ ### Extensibility & Integrations
86
+
87
+ | **Command** | **Description** |
88
+ | -------------------------------------------------- | --------------------------------------------------------------------------------- |
89
+ | `/skills` | Browse and open agent skills |
90
+ | `/agents` | Manage agent configurations |
91
+ | `/mcp` | Manage MCP server connections |
92
+ | `/design [mode]` | Design partner: audit, build, compose, and ship UI - bare `/design` browses modes |
93
+ | `/import [claude\|codex\|cursor\|pi\|opencode\|gemini]` | Import your setup from another coding agent; bare `/import` imports from all sources |
94
+ | `/taste` | Manage Taste learning and usage |
95
+ | `/learn-taste` | Learn taste from sessions with other coding agents (Claude Code, Cursor, etc) |
96
+ | `/ide` | Connect IDE to share your open file and selected lines |
97
+ | `/terminal-setup` | Setup VSCode keybindings (only shown in the menu inside a VS Code terminal) |
98
+
99
+ ### Workspace
100
+
101
+ | **Command** | **Description** |
102
+ | ------------------------------------------ | -------------------------------------------------- |
103
+ | `/add-dir <directory>` | Add directory to workspace context |
104
+ | `/worktree [name\|list\|remove <name>]` | Create, list, or switch git worktrees |
105
+
106
+ ### Billing & Account
107
+
108
+ | **Command** | **Description** |
109
+ | ----------- | -------------------------------------------- |
110
+ | `/usage` | Display credits, plan, and usage metrics |
111
+ | `/upgrade` | Open billing page to upgrade your plan |
112
+ | `/extra` | Open billing page to buy on-demand credits |
113
+
114
+ ### Utilities
115
+
116
+ | **Command** | **Description** |
117
+ | ------------------ | -------------------------------------------------------------- |
118
+ | `/help` | Show available shortcuts |
119
+ | `/hotkeys` | Show all keyboard shortcuts |
120
+ | `/config [query]` | Search and change settings |
121
+ | `/theme [dark\|light]` | Switch between dark and light themes |
122
+ | `/status` | Show comprehensive environment status |
123
+ | `/changelog [all]` | See what's new in Command Code (`all` for the full history) |
124
+ | `/courses` | Open Command Code courses in your browser |
125
+ | `/update` | Update Command Code to the latest version |
126
+ | `/feedback` | Share feedback or report bugs |
127
+ | `/trace` | Copy the current trace id; required for support debugging |
128
+ | `/copy` | Copy the last response to the clipboard |
31
129
 
32
130
  ---
33
131
 
34
- ## Command Types
132
+ ## Command behavior
35
133
 
36
- There are two types of commands:
134
+ ### Bare invocations that open a picker
37
135
 
38
- ### Project-Level Commands
136
+ `/model`, `/effort`, and `/theme` each take an optional value (`/model gpt-5`, `/effort high`, `/theme dark`) that applies directly as a one-shot. But unlike other optional-value commands, running them **bare** doesn't perform a default action - it opens an interactive picker immediately. Bare `/mode` also runs immediately, printing the current mode and the available switches (`/mode:default`, `/mode:auto-accept`, `/mode:plan` - or press shift+tab to cycle).
39
137
 
40
- Commands saved directly in your project. When shown in `/help`, they appear with “(project)” after their description.
138
+ `/effort` only opens its selector when the current model supports reasoning effort levels; otherwise it prints a notice that effort isn't supported for that model.
41
139
 
42
- **Location:** `.commandcode/commands/`
140
+ ### Commands with meaningful default actions when bare
43
141
 
44
- ```bash
45
- # Create a project-level command
46
- mkdir -p .commandcode/commands
47
- echo "Generate unit tests for this code following our testing conventions" > .commandcode/commands/test.md
48
- ```
142
+ Some optional-argument commands do something useful with no argument instead of opening a picker: bare `/share` creates a share link, bare `/import` imports from all detected sources, bare `/export` exports in the default format, bare `/goal` (or `/goal status`) shows the current goal, bare `/name` shows the current session name, and bare `/plan` enters plan mode without a task.
49
143
 
50
- This makes `/test` command available only within this project.
144
+ ### Safe while the agent is busy
51
145
 
52
- ### User-Level Commands
146
+ Most commands are **blocked mid-turn** - mode flips, session switches, model changes, compaction, and anything that would race an active turn waits until the agent finishes. A deliberate set of read-only or local commands stays available while a turn is running:
53
147
 
54
- Commands that are available across all your projects. In the command menu, they appear with “(user)” after their description.
148
+ - `/trace` - capture the live trace id of the running turn (its main purpose)
149
+ - `/session-file`, `/session` - read-only session facts
150
+ - `/copy` - clipboard only
151
+ - `/todos` (also `ctrl+x`) - edits local todo state, most useful mid-turn while a plan is being driven
152
+ - `/exit` / `/quit` - always available
153
+ - `/goal clear` - stops the goal loop; the current step finishes, then the loop stops. Setting a **new** goal mid-turn is refused with a busy notice.
55
154
 
56
- **Location:** `~/.commandcode/commands/`
155
+ Most other commands - `/clear`, `/mode`, `/plan`, `/model`, `/compact`, `/worktree`, `/resume`, `/login`, and the like - report busy and ask you to wait for the current turn (or press Ctrl+C). (`/review` is an exception: it runs mid-turn.)
57
156
 
58
- ```bash
59
- # Create a user-level command
60
- mkdir -p ~/.commandcode/commands
61
- echo "I am currently being onboarded on this project, help me understand it." > ~/.commandcode/commands/understand.md
62
- ```
157
+ ### `/goal` in detail
63
158
 
64
- This makes `/understand` command available in all your projects.
159
+ `/goal <objective>` sets an objective (up to a length limit) and arms an autonomous loop capped at a maximum number of turns. `/goal status` (or bare `/goal`) shows the active goal and progress; `/goal clear` clears it. `/goal resume` and `/goal pause` are reserved but not available yet.
65
160
 
66
161
  ---
67
162
 
68
- ## Namespacing
69
-
70
- Organize commands in subdirectories. The subdirectories appear in the command description but do not affect the command name.
71
-
72
- | **File Location** | **Command** | **Description Shows** |
73
- | --------------------------------------------- | ------------ | --------------------- |
74
- | `.commandcode/commands/frontend/component.md` | `/component` | `(project: frontend)` |
75
- | `~/.commandcode/commands/git/commit.md` | `/commit` | `(user: git)` |
76
- | `.commandcode/commands/simple.md` | `/simple` | `(project)` |
77
-
78
- ### Unlimited Nesting Depth
79
-
80
- You can organize commands as deeply as needed:
81
-
82
- ```
83
- .commandcode/commands/
84
- ├── frontend/
85
- │ ├── react/
86
- │ │ ├── hooks/
87
- │ │ │ └── use-auth.md → /use-auth (project: frontend/react/hooks)
88
- │ │ └── components/
89
- │ │ └── button.md → /button (project: frontend/react/components)
90
- │ └── vue/
91
- │ └── composable.md → /composable (project: frontend/vue)
92
- ├── backend/
93
- │ └── api/
94
- │ └── endpoint.md → /endpoint (project: backend/api)
95
- └── simple.md → /simple (project)
96
- ```
97
-
98
- The command name comes from the filename only, not the folder path. So
99
- `frontend/button.md` and `backend/button.md` both create `/button`, they
100
- will conflict. Use unique filenames like `frontend-button.md` and
101
- `backend-button.md` instead.
102
-
103
- ---
104
-
105
- ## Arguments
106
-
107
- Pass dynamic values to commands using argument placeholders.
108
-
109
- ### All Arguments with `$ARGUMENTS` (or `$@`)
110
-
111
- The `$ARGUMENTS` placeholder captures all arguments as a single string. `$@` is
112
- a shorthand alias for the same value, and the braced forms `${ARGUMENTS}` and
113
- `${@}` work too:
114
-
115
- **Command definition** (`.commandcode/commands/explain.md`):
116
-
117
- ```markdown
118
- Explain the following concept in simple terms: $ARGUMENTS
119
- ```
163
+ ## Custom Slash Commands
120
164
 
121
- **Usage:**
165
+ Custom slash commands let you save frequently used prompts as markdown files. Define a command once, then run it anytime with dynamic arguments.
122
166
 
123
167
  ```bash
124
- /explain how async await works in JavaScript
168
+ /<command-name> [arguments]
125
169
  ```
126
170
 
127
- **Result:** `$ARGUMENTS` becomes `"how async await works in JavaScript"`
128
-
129
- ### Positional Arguments with `$1`, `$2`, etc.
171
+ The command name comes from the markdown filename (without the `.md` extension).
130
172
 
131
- Access specific arguments using positional parameters. Arguments start at `$1` (there is no `$0`):
173
+ ### Locations
132
174
 
133
- **Command definition** (`.commandcode/commands/create-component.md`):
134
-
135
- ```markdown
136
- Create a $1 component named $2 with the following features: $3
137
- ```
138
-
139
- **Usage:**
175
+ | **Type** | **Location** | **Menu label** | **Scope** |
176
+ | --------- | -------------------------- | -------------- | --------------------- |
177
+ | Project | `.commandcode/commands/` | `(project)` | This project only |
178
+ | User | `~/.commandcode/commands/` | `(user)` | All your projects |
140
179
 
141
180
  ```bash
142
- /create-component React Button "onClick and disabled props"
143
- ```
144
-
145
- **Result:**
146
-
147
- - `$1` → `"React"`
148
- - `$2` → `"Button"`
149
- - `$3` → `"onClick and disabled props"`
150
-
151
- Positional arguments also support the braced form `${1}`, `${2}`, etc. Use it
152
- when a placeholder sits directly next to other characters, for example
153
- `v${1}.0` or `${1}px`, so the parser knows where the number ends.
154
-
155
- ### Default Values with `${N:-default}`
156
-
157
- Wrap a placeholder in `${...}` and add `:-default` to fall back to a default
158
- value when that argument is missing or empty. This is handy for optional
159
- arguments:
160
-
161
- **Command definition** (`.commandcode/commands/summarize.md`):
162
-
163
- ```markdown
164
- Summarize the current state in ${1:-7} bullet points.
165
- ```
166
-
167
- **Usage:**
181
+ # Project-level command
182
+ mkdir -p .commandcode/commands
183
+ echo "Generate unit tests for this code following our testing conventions" > .commandcode/commands/test.md
168
184
 
169
- ```bash
170
- /summarize # "Summarize the current state in 7 bullet points."
171
- /summarize 3 # "Summarize the current state in 3 bullet points."
185
+ # User-level command
186
+ mkdir -p ~/.commandcode/commands
187
+ echo "I am currently being onboarded on this project, help me understand it." > ~/.commandcode/commands/understand.md
172
188
  ```
173
189
 
174
- Defaults work with `$@`/`$ARGUMENTS` as well - `${@:-the current diff}` uses all
175
- arguments when provided, otherwise the literal text `the current diff`.
176
-
177
- ### Argument Slices with `${@:N}` and `${@:N:L}`
178
-
179
- Select a range of positional arguments (1-indexed) and join them with spaces:
190
+ The file's full trimmed body is the prompt that runs; the slash menu shows its first meaningful line (skipping YAML frontmatter and markdown markers, truncated to ~80 chars) plus the location label.
180
191
 
181
- - `${@:N}` - every argument from the Nth position to the end
182
- - `${@:N:L}` - `L` arguments starting at the Nth position
183
-
184
- **Command definition** (`.commandcode/commands/commit.md`):
185
-
186
- ```markdown
187
- Write a commit of type "$1" with message: ${@:2}
188
- ```
192
+ ### Namespacing
189
193
 
190
- **Usage:**
194
+ Organize commands in subdirectories to any depth. The subdirectory appears in the description label but does **not** affect the command name:
191
195
 
192
- ```bash
193
- /commit fix resolve the flaky login test
194
- ```
196
+ | **File Location** | **Command** | **Menu shows** |
197
+ | --------------------------------------------- | ------------ | --------------------- |
198
+ | `.commandcode/commands/frontend/component.md` | `/component` | `(project: frontend)` |
199
+ | `~/.commandcode/commands/git/commit.md` | `/commit` | `(user: git)` |
200
+ | `.commandcode/commands/simple.md` | `/simple` | `(project)` |
195
201
 
196
- **Result:**
202
+ Because the name comes from the filename only, `frontend/button.md` and
203
+ `backend/button.md` both create `/button` and will conflict. On a
204
+ user/project name collision, the user copy wins at dispatch (user
205
+ directories are scanned first), though both rows still appear in the menu.
206
+ Use unique filenames to avoid this.
197
207
 
198
- - `$1` → `"fix"`
199
- - `${@:2}` → `"resolve the flaky login test"`
208
+ ### Argument templating
200
209
 
201
- An out-of-range slice (e.g. `${@:9}` when only three arguments were passed)
202
- expands to an empty string.
210
+ Placeholders in the command body are replaced with your arguments in a single pass (substituted text is never re-scanned, so an argument containing `$1` lands literally):
203
211
 
204
- ### Quoted Strings
212
+ | **Placeholder** | **Description** |
213
+ | --------------------- | ---------------------------------------------------------------------- |
214
+ | `$ARGUMENTS` / `$@` | All arguments as a single string (`${ARGUMENTS}` / `${@}` work too) |
215
+ | `$1`, `$2`, … `$N` | Positional arguments, 1-indexed (there is no `$0`); missing args → `""` |
216
+ | `${1}`, `${2}`, … | Braced positional - safe directly next to other text (`v${1}.0`) |
217
+ | `${N:-default}` | Nth argument, or `default` when missing/empty |
218
+ | `${@:-default}` | All arguments, or `default` when none were provided |
219
+ | `${@:N}` | Arguments from the Nth position to the end |
220
+ | `${@:N:L}` | `L` arguments starting at the Nth position (clamped to what exists) |
205
221
 
206
- Arguments containing spaces can be wrapped in quotes:
222
+ Arguments split on whitespace, respecting single and double quotes:
207
223
 
208
224
  ```bash
209
225
  /create-component React "Login Form" "email validation and submit handler"
226
+ # $1 → React $2 → Login Form $3 → email validation and submit handler
210
227
  ```
211
228
 
212
- **Result:**
213
-
214
- - `$1` → `"React"`
215
- - `$2` → `"Login Form"`
216
- - `$3` → `"email validation and submit handler"`
217
-
218
- ---
219
-
220
- ## Edge Cases
221
-
222
- | **Scenario** | **Behavior** |
223
- | ---------------------------------------------- | --------------------------------------------------------------- |
224
- | Missing argument (e.g., `$3` with only 2 args) | Replaced with empty string (use `${3:-default}` for a fallback) |
225
- | Extra arguments | Captured in `$ARGUMENTS`/`$@`, ignored by unused `$N` |
226
- | No arguments provided | `$ARGUMENTS` = `""`, all `$N` = `""` |
227
- | Command without placeholders | Template passed through unchanged |
228
- | Missing or empty arg with `${N:-default}` | Replaced with `default` |
229
- | Out-of-range slice (e.g. `${@:9}`) | Replaced with empty string |
230
- | Slice length past the end (e.g. `${@:2:99}`) | Clamped to the available arguments |
231
- | Unrecognized `${...}` (e.g. `${HOME}`) | Left untouched, so shell/env-style text is preserved |
232
-
233
- ---
234
-
235
- ## Examples
236
-
237
- ### Test Generator Command
238
-
239
- **File:** `.commandcode/commands/test.md`
229
+ **Example** (`.commandcode/commands/commit.md`):
240
230
 
241
231
  ```markdown
242
- Write $1 tests for the following code using $2.
243
-
244
- Requirements:
245
-
246
- - Cover edge cases and error scenarios
247
- - Add descriptive test names
248
- - Follow testing best practices
232
+ Write a commit of type "${1:-fix}" with message: ${@:2}
249
233
  ```
250
234
 
251
- **Usage:**
252
-
253
235
  ```bash
254
- /test unit Jest
255
- ```
256
-
257
- ### Documentation Command
258
-
259
- **File:** `~/.commandcode/commands/docs.md`
260
-
261
- ```markdown
262
- Generate documentation for this $1.
263
-
264
- Include:
265
-
266
- - Description and purpose
267
- - Parameters/props with types
268
- - Usage examples
269
- - Return values if applicable
236
+ /commit feat add slash command reference
237
+ # → Write a commit of type "feat" with message: add slash command reference
270
238
  ```
271
239
 
272
- **Usage:**
273
-
274
- ```bash
275
- /docs function
276
- ```
240
+ Edge cases: an out-of-range slice (`${@:9}` with three args) expands to an empty string; an unrecognized `${...}` expression (e.g. a literal `${HOME}`) is left untouched so shell/env-style text survives; a template with no placeholders passes through unchanged.
277
241
 
278
242
  ---
279
243
 
280
- ## How It Works
244
+ ## Dispatch precedence
281
245
 
282
- 1. **Type `/`** to open the interactive command menu
283
- 2. **Select a command** from the dropdown (e.g., `/test`)
284
- 3. **Command is inserted** into the input field with a trailing space
285
- 4. **Type your arguments** (e.g., `unit Jest`)
286
- 5. **Press Enter** to execute
287
- 6. **Placeholders are replaced** with your arguments
288
- 7. **Processed prompt** is sent to the AI
289
-
290
- ---
291
-
292
- Custom commands cannot override built-in commands. If you create a command
293
- with the same name as a built-in, the built-in takes precedence.
294
-
295
- ---
246
+ When multiple sources define the same name, dispatch resolves in this order - first writer wins:
296
247
 
297
- ## Quick Reference
298
-
299
- ### Placeholders
300
-
301
- | **Placeholder** | **Description** | **Example Input** | **Result** |
302
- | ------------------- | --------------------------------------------- | ----------------- | ----------------- |
303
- | `$ARGUMENTS` / `$@` | All arguments as string | `unit Jest async` | `unit Jest async` |
304
- | `$1` | First argument | `unit Jest` | `unit` |
305
- | `$2` | Second argument | `unit Jest` | `Jest` |
306
- | `$N` | Nth argument | - | - |
307
- | `${N}` | Braced Nth argument (safe next to other text) | `unit Jest` | `unit` |
308
- | `${N:-default}` | Nth argument, or `default` when missing/empty | `` (none) | `default` |
309
- | `${@:N}` | Arguments from the Nth position to the end | `a b c` | `b c` (N=2) |
310
- | `${@:N:L}` | `L` arguments starting at the Nth position | `a b c d` | `b c` (N=2, L=2) |
311
-
312
- ### Command Locations
313
-
314
- | **Type** | **Location** | **Description Label** |
315
- | ---------------- | --------------------------------- | --------------------- |
316
- | Project | `.commandcode/commands/` | `(project)` |
317
- | Project (nested) | `.commandcode/commands/subdir/` | `(project: subdir)` |
318
- | User | `~/.commandcode/commands/` | `(user)` |
319
- | User (nested) | `~/.commandcode/commands/subdir/` | `(user: subdir)` |
320
-
321
- ---
248
+ 1. **Built-in** commands (the full set, including any the menu hides)
249
+ 2. **Mod** commands (added by active mods)
250
+ 3. **Custom** commands (`.commandcode/commands/`, `~/.commandcode/commands/`)
251
+ 4. **Skills**
322
252
 
323
- ## Troubleshooting
253
+ So a custom command can never override a built-in, and a skill shadowed by any of the above resolves to its owner. Shadowed skills still render in the menu with a `- shadowed by /<name>` note so you know they exist. Lookup is case-insensitive (`/Reload` resolves to `/reload`).
324
254
 
325
- ### Command not appearing in menu
255
+ ### Skill invocation
326
256
 
327
- 1. Ensure the file has `.md` extension
328
- 2. Check file is in correct directory (`.commandcode/commands/` or `~/.commandcode/commands/`)
329
- 3. Verify file permissions allow reading
257
+ Installed skills are invocable as `/<skill-name>` and appear in the menu with a `[skill]` badge. A skill's `argument-hint` frontmatter leads its menu description (e.g. `/pr-desc [skill] <branch> - Generate a PR…`), and skills marked `user-invocable: false` stay model-invocable but never appear in the `/` menu. Duplicate skill names dedupe with project taking precedence over global.
330
258
 
331
- ### Arguments not being replaced
259
+ ### Mod commands
332
260
 
333
- 1. Use `$1`, `$2`, etc. for positional args (not `$0`)
334
- 2. Use `$ARGUMENTS` (or `$@`) for all args as a string
335
- 3. Check for typos in placeholder names (case-sensitive)
336
- 4. For defaults and slices, keep the braces and syntax exact: `${1:-default}`,
337
- `${@:2}`, `${@:2:3}`. A malformed `${...}` expression is left in the prompt
338
- unchanged rather than replaced.
261
+ Active mods can register their own slash commands; they slot in between built-ins and custom commands in both the menu and dispatch. Discovery is fault-tolerant - a broken commands directory or unreadable skill never breaks the menu; each source just degrades to empty.
339
262
 
340
263
  ---
341
264
 
342
265
  ## Next steps
343
266
 
344
- - Create your first custom slash command and try it out
267
+ - Explore the [CLI Reference](https://commandcode.ai/docs/reference/cli) for flags and subcommands
268
+ - Create your first custom command and try it out
345
269
  - Join our [Discord community](https://commandcode.ai/discord) for feedback, requests, and support.
@@ -1,9 +1,21 @@
1
- <!-- GENERATED FILE — do not edit. Source: packages/docs/src/app/core-concepts/headless/page.mdx. Regenerate: pnpm generate:knowledge -->
1
+ <!-- GENERATED FILE — do not edit. Source: packages/docs/src/app/headless/page.mdx. Regenerate: pnpm generate:knowledge -->
2
2
 
3
3
  # Headless Mode
4
4
 
5
5
  Run Command Code non-interactively in scripts, CI/CD pipelines, and automation workflows. Headless mode executes a single query, outputs the response to stdout, and exits.
6
6
 
7
+ ```
8
+ stdin ──┐
9
+ ├──► cmd -p "query" ──┬──► stdout
10
+ argv ──┘ │ │ text, or
11
+ │ │ JSON frames
12
+ │ └──► stderr
13
+ │ --verbose
14
+ ▼ progress
15
+ exit code
16
+ 0 ok · 8 max-turns hit
17
+ ```
18
+
7
19
  ---
8
20
 
9
21
  ## Basic Usage
@@ -66,9 +78,14 @@ Only use `--yolo` in trusted environments. It allows Command Code to modify file
66
78
 
67
79
  ---
68
80
 
81
+ **Permissions**
82
+ Headless runs still go through the permission engine. The complete guide
83
+ covers `dont-ask` — the fail-closed allowlist mode built for CI — plus rule
84
+ syntax and the decision ladder.
85
+
69
86
  ## Tool Calls
70
87
 
71
- Headless mode supports multi-turn tool execution. Command Code can read files, search code, and (with permissions) edit files and run commands, just like [interactive mode](https://commandcode.ai/docs/core-concepts/interactive-mode).
88
+ Headless mode supports multi-turn tool execution. Command Code can read files, search code, and (with permissions) edit files and run commands, just like [interactive mode](https://commandcode.ai/docs/interactive-mode).
72
89
 
73
90
  The conversation loop runs for up to **100 turns** by default. Raise or lower it with `--max-turns`. If the limit is reached, a warning is printed to stderr and the partial response is returned.
74
91
 
@@ -271,5 +288,5 @@ scriptable automatically. Confirmations print to stderr, keeping `-p` stdout cle
271
288
  ## Next steps
272
289
 
273
290
  - See [CLI Reference](https://commandcode.ai/docs/reference/cli) for the full list of flags and commands
274
- - Learn about [Interactive Mode](https://commandcode.ai/docs/core-concepts/interactive-mode) for full-featured sessions
291
+ - Learn about [Interactive Mode](https://commandcode.ai/docs/interactive-mode) for full-featured sessions
275
292
  - Join our [Discord community](https://commandcode.ai/discord) for support