@kinqs/brainrouter-cli 0.3.6 → 0.3.8
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 +29 -52
- package/agents/architect.json +18 -0
- package/agents/explorer.json +18 -0
- package/agents/reviewer.json +18 -0
- package/agents/verifier.json +18 -0
- package/agents/worker.json +18 -0
- package/changelog/0.2.0.md +15 -0
- package/changelog/0.3.0.md +20 -0
- package/changelog/0.3.1.md +22 -0
- package/changelog/0.3.2.md +15 -0
- package/changelog/0.3.3.md +19 -0
- package/changelog/0.3.4.md +20 -0
- package/changelog/0.3.5.md +9 -0
- package/changelog/0.3.6.md +9 -0
- package/changelog/0.3.7.md +20 -0
- package/changelog/0.3.8.md +30 -0
- package/changelog/README.md +41 -0
- package/dist/agent/agent.d.ts +34 -1
- package/dist/agent/agent.js +372 -79
- package/dist/agent/toolCallRecovery.d.ts +57 -0
- package/dist/agent/toolCallRecovery.js +130 -0
- package/dist/agent/toolSafety.d.ts +17 -0
- package/dist/agent/toolSafety.js +102 -0
- package/dist/cli/banner.d.ts +20 -0
- package/dist/cli/banner.js +47 -14
- package/dist/cli/cliPrompt.d.ts +40 -3
- package/dist/cli/cliPrompt.js +117 -25
- package/dist/cli/commands/_context.d.ts +3 -1
- package/dist/cli/commands/_helpers.d.ts +1 -1
- package/dist/cli/commands/config.d.ts +46 -0
- package/dist/cli/commands/config.js +1042 -0
- package/dist/cli/commands/init.d.ts +20 -0
- package/dist/cli/commands/init.js +64 -0
- package/dist/cli/commands/login.d.ts +13 -0
- package/dist/cli/commands/login.js +179 -0
- package/dist/cli/commands/mcp.d.ts +13 -11
- package/dist/cli/commands/mcp.js +261 -74
- package/dist/cli/commands/mcpInstall.d.ts +20 -0
- package/dist/cli/commands/mcpInstall.js +87 -0
- package/dist/cli/commands/orchestration.js +51 -0
- package/dist/cli/commands/releaseNotes.d.ts +24 -0
- package/dist/cli/commands/releaseNotes.js +109 -0
- package/dist/cli/commands/schedule.d.ts +18 -0
- package/dist/cli/commands/schedule.js +189 -0
- package/dist/cli/commands/ui.js +119 -60
- package/dist/cli/commands/workflow.d.ts +2 -0
- package/dist/cli/commands/workflow.js +54 -8
- package/dist/cli/ink/ChatApp.d.ts +206 -0
- package/dist/cli/ink/ChatApp.js +493 -0
- package/dist/cli/ink/Frame.d.ts +26 -0
- package/dist/cli/ink/Frame.js +5 -0
- package/dist/cli/ink/Picker.d.ts +71 -0
- package/dist/cli/ink/Picker.js +168 -0
- package/dist/cli/ink/SlashPalette.d.ts +51 -0
- package/dist/cli/ink/SlashPalette.js +136 -0
- package/dist/cli/ink/TextField.d.ts +34 -0
- package/dist/cli/ink/TextField.js +47 -0
- package/dist/cli/ink/WizardApp.d.ts +7 -0
- package/dist/cli/ink/WizardApp.js +422 -0
- package/dist/cli/ink/ambientChat.d.ts +34 -0
- package/dist/cli/ink/ambientChat.js +7 -0
- package/dist/cli/ink/consoleCapture.d.ts +11 -0
- package/dist/cli/ink/consoleCapture.js +33 -0
- package/dist/cli/ink/markdownRender.d.ts +41 -0
- package/dist/cli/ink/markdownRender.js +278 -0
- package/dist/cli/ink/renderWithResizeClear.d.ts +14 -0
- package/dist/cli/ink/renderWithResizeClear.js +33 -0
- package/dist/cli/ink/runChat.d.ts +34 -0
- package/dist/cli/ink/runChat.js +682 -0
- package/dist/cli/ink/runPicker.d.ts +31 -0
- package/dist/cli/ink/runPicker.js +139 -0
- package/dist/cli/ink/runSlashPalette.d.ts +23 -0
- package/dist/cli/ink/runSlashPalette.js +33 -0
- package/dist/cli/ink/runWizard.d.ts +22 -0
- package/dist/cli/ink/runWizard.js +133 -0
- package/dist/cli/ink/stdinHandoff.d.ts +51 -0
- package/dist/cli/ink/stdinHandoff.js +78 -0
- package/dist/cli/ink/toolFormat.d.ts +75 -0
- package/dist/cli/ink/toolFormat.js +206 -0
- package/dist/cli/ink/useTerminalSize.d.ts +35 -0
- package/dist/cli/ink/useTerminalSize.js +26 -0
- package/dist/cli/repl.d.ts +25 -3
- package/dist/cli/repl.js +52 -714
- package/dist/cli/slashSuggest.d.ts +32 -0
- package/dist/cli/slashSuggest.js +146 -0
- package/dist/cli/wizard/modelsApi.d.ts +72 -0
- package/dist/cli/wizard/modelsApi.js +166 -0
- package/dist/cli/wizard/picker.d.ts +202 -0
- package/dist/cli/wizard/picker.js +547 -0
- package/dist/cli/wizard/providers.d.ts +86 -0
- package/dist/cli/wizard/providers.js +190 -0
- package/dist/cli/wizard/runner.d.ts +13 -0
- package/dist/cli/wizard/runner.js +488 -0
- package/dist/cli/wizard/types.d.ts +122 -0
- package/dist/cli/wizard/types.js +109 -0
- package/dist/config/config.d.ts +13 -1
- package/dist/config/config.js +45 -3
- package/dist/index.js +157 -206
- package/dist/memory/briefing.d.ts +1 -1
- package/dist/memory/briefing.js +4 -4
- package/dist/memory/consolidation.d.ts +1 -1
- package/dist/orchestration/agentRegistry.d.ts +36 -0
- package/dist/orchestration/agentRegistry.js +64 -0
- package/dist/orchestration/orchestrator.d.ts +7 -0
- package/dist/orchestration/orchestrator.js +2 -0
- package/dist/orchestration/tools.d.ts +105 -3
- package/dist/orchestration/tools.js +167 -8
- package/dist/prompt/skillCatalog.d.ts +11 -0
- package/dist/prompt/skillCatalog.js +134 -0
- package/dist/prompt/skillRunner.d.ts +2 -2
- package/dist/prompt/skillRunner.js +2 -31
- package/dist/prompt/systemPrompt.js +7 -2
- package/dist/runtime/anthropicAdapter.d.ts +100 -0
- package/dist/runtime/anthropicAdapter.js +293 -0
- package/dist/runtime/cronParser.d.ts +23 -0
- package/dist/runtime/cronParser.js +122 -0
- package/dist/runtime/mcpClient.js +14 -11
- package/dist/runtime/mcpPool.d.ts +170 -0
- package/dist/runtime/mcpPool.js +442 -0
- package/dist/runtime/mcpUtils.d.ts +17 -1
- package/dist/runtime/mcpUtils.js +23 -0
- package/dist/runtime/scheduleTicker.d.ts +33 -0
- package/dist/runtime/scheduleTicker.js +99 -0
- package/dist/runtime/vendorSnippets.d.ts +45 -0
- package/dist/runtime/vendorSnippets.js +153 -0
- package/dist/state/scheduleStore.d.ts +37 -0
- package/dist/state/scheduleStore.js +64 -0
- package/package.json +14 -5
- package/.env.example +0 -116
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool call display formatters — claude-code-style semantic rendering.
|
|
3
|
+
*
|
|
4
|
+
* The raw `tool_name({"path": "...", ...})` JSON dump that fell out of
|
|
5
|
+
* `agent.runTurn`'s onToolStart callback is hostile to quick scanning
|
|
6
|
+
* during a long turn. claude-code's transcript format is
|
|
7
|
+
*
|
|
8
|
+
* ⏺ Read(src/auth/login.ts)
|
|
9
|
+
* ⏺ Bash(npm test)
|
|
10
|
+
* ⏺ Grep("authenticate")
|
|
11
|
+
*
|
|
12
|
+
* — one-line, identity-revealing, no JSON. These helpers do the same
|
|
13
|
+
* mapping for our built-in LOCAL_TOOLS (cli/../agent/agent.ts) + MCP
|
|
14
|
+
* tool names (which carry an `mcp_<server>_` namespace prefix that
|
|
15
|
+
* the user doesn't care about).
|
|
16
|
+
*
|
|
17
|
+
* Reference for the convention: claude-code transcripts (see
|
|
18
|
+
* openSrc/claude-code/CHANGELOG.md mentions throughout; the format is
|
|
19
|
+
* not formally documented but used in every claude-code session).
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* Format a tool call as a one-line `Function(args)` summary.
|
|
23
|
+
*
|
|
24
|
+
* Examples:
|
|
25
|
+
* formatToolCall('read_file', { path: 'src/foo.ts' })
|
|
26
|
+
* → "Read(src/foo.ts)"
|
|
27
|
+
* formatToolCall('run_command', { command: 'npm test' })
|
|
28
|
+
* → "Bash(npm test)"
|
|
29
|
+
* formatToolCall('grep_search', { query: 'authenticate', path: '.' })
|
|
30
|
+
* → 'Grep("authenticate")'
|
|
31
|
+
* formatToolCall('mcp_brainrouter_memory_search', { q: 'auth' })
|
|
32
|
+
* → 'MemorySearch("auth")'
|
|
33
|
+
* formatToolCall('spawn_agent', { role: 'researcher', prompt: '...' })
|
|
34
|
+
* → 'Spawn(researcher, "...")'
|
|
35
|
+
* formatToolCall('task_agent', { role: 'reviewer', prompt: '...' })
|
|
36
|
+
* → 'Task(reviewer, "...")'
|
|
37
|
+
*/
|
|
38
|
+
export function formatToolCall(name, args) {
|
|
39
|
+
const safeArgs = args ?? {};
|
|
40
|
+
const clean = stripMcpPrefix(name);
|
|
41
|
+
switch (clean) {
|
|
42
|
+
case 'read_file': {
|
|
43
|
+
const path = safeArgs.path ?? '.';
|
|
44
|
+
const startLine = safeArgs.startLine;
|
|
45
|
+
const endLine = safeArgs.endLine;
|
|
46
|
+
if (startLine && endLine)
|
|
47
|
+
return `Read(${path}:${startLine}-${endLine})`;
|
|
48
|
+
if (startLine)
|
|
49
|
+
return `Read(${path}:${startLine})`;
|
|
50
|
+
return `Read(${path})`;
|
|
51
|
+
}
|
|
52
|
+
case 'write_file':
|
|
53
|
+
return `Write(${safeArgs.path ?? ''})`;
|
|
54
|
+
case 'edit_file':
|
|
55
|
+
return `Edit(${safeArgs.path ?? ''})`;
|
|
56
|
+
case 'list_dir':
|
|
57
|
+
return `LS(${safeArgs.path ?? '.'})`;
|
|
58
|
+
case 'grep_search':
|
|
59
|
+
return `Grep(${quoteShort(safeArgs.query, 50)})`;
|
|
60
|
+
case 'glob_files':
|
|
61
|
+
return `Glob(${quoteShort(safeArgs.pattern, 50)})`;
|
|
62
|
+
case 'run_command':
|
|
63
|
+
return `Bash(${truncateOneLine(safeArgs.command ?? '', 70)})`;
|
|
64
|
+
case 'fetch_url':
|
|
65
|
+
return `Fetch(${truncateOneLine(safeArgs.url ?? '', 70)})`;
|
|
66
|
+
case 'web_search':
|
|
67
|
+
return `WebSearch(${quoteShort(safeArgs.query, 50)})`;
|
|
68
|
+
case 'spawn_agent': {
|
|
69
|
+
const role = String(safeArgs.role ?? 'agent');
|
|
70
|
+
const label = safeArgs.label ? ` [${safeArgs.label}]` : '';
|
|
71
|
+
const task = truncateOneLine(safeArgs.prompt ?? '', 50);
|
|
72
|
+
return `Spawn(${role}${label}, "${task}")`;
|
|
73
|
+
}
|
|
74
|
+
case 'task_agent': {
|
|
75
|
+
const role = String(safeArgs.role ?? safeArgs.agentId ?? 'agent');
|
|
76
|
+
const label = safeArgs.label ? ` [${safeArgs.label}]` : '';
|
|
77
|
+
const task = truncateOneLine(safeArgs.prompt ?? '', 50);
|
|
78
|
+
return `Task(${role}${label}, "${task}")`;
|
|
79
|
+
}
|
|
80
|
+
case 'delegate_agent': {
|
|
81
|
+
const role = String(safeArgs.role ?? safeArgs.agentId ?? 'agent');
|
|
82
|
+
const label = safeArgs.label ? ` [${safeArgs.label}]` : '';
|
|
83
|
+
const task = truncateOneLine(safeArgs.prompt ?? '', 50);
|
|
84
|
+
return `Delegate(${role}${label}, "${task}")`;
|
|
85
|
+
}
|
|
86
|
+
case 'spawn_agents': {
|
|
87
|
+
const agents = Array.isArray(safeArgs.agents) ? safeArgs.agents : [];
|
|
88
|
+
const roles = agents.map((a) => String(a?.role ?? 'agent')).join(', ');
|
|
89
|
+
return `SpawnAll(${agents.length}: ${roles})`;
|
|
90
|
+
}
|
|
91
|
+
case 'update_plan':
|
|
92
|
+
return `UpdatePlan()`;
|
|
93
|
+
case 'ask_user_choice':
|
|
94
|
+
return `AskUser(${quoteShort(safeArgs.question, 50)})`;
|
|
95
|
+
}
|
|
96
|
+
// Generic fallback: PascalCase the name and surface the first string-shaped
|
|
97
|
+
// argument as the identifying value. Better than JSON-dumping everything.
|
|
98
|
+
const pretty = snakeToPascal(clean);
|
|
99
|
+
const firstString = Object.values(safeArgs).find((v) => typeof v === 'string' && v.length > 0);
|
|
100
|
+
if (firstString !== undefined) {
|
|
101
|
+
return `${pretty}(${truncateOneLine(firstString, 60)})`;
|
|
102
|
+
}
|
|
103
|
+
// No args, or no string args — just show the name.
|
|
104
|
+
return `${pretty}()`;
|
|
105
|
+
}
|
|
106
|
+
// Server ids registered at boot. MCP server names may contain underscores
|
|
107
|
+
// (`my_server`), so a naive `^mcp_[^_]+_(.+)$` regex would mis-strip
|
|
108
|
+
// `mcp_my_server_memory_search` to `server_memory_search`. Callers that
|
|
109
|
+
// know the live server inventory register it here so `stripMcpPrefix` can
|
|
110
|
+
// match the longest known id first.
|
|
111
|
+
let knownMcpServerIds = [];
|
|
112
|
+
export function setKnownMcpServerIds(ids) {
|
|
113
|
+
knownMcpServerIds = [...ids].sort((a, b) => b.length - a.length);
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Strip the `mcp_<server>_` namespace prefix from MCP tool names. As of
|
|
117
|
+
* 0.3.8-R5 the pool normalises to single-underscore at the boundary, so
|
|
118
|
+
* downstream call-sites only ever see this shape.
|
|
119
|
+
* `mcp_brainrouter_memory_search` → `memory_search`
|
|
120
|
+
* `mcp_my_server_memory_search` → `memory_search` (when `my_server`
|
|
121
|
+
* is registered via `setKnownMcpServerIds`)
|
|
122
|
+
*/
|
|
123
|
+
export function stripMcpPrefix(name) {
|
|
124
|
+
if (!name.startsWith('mcp_'))
|
|
125
|
+
return name;
|
|
126
|
+
const rest = name.slice('mcp_'.length);
|
|
127
|
+
for (const id of knownMcpServerIds) {
|
|
128
|
+
if (rest.startsWith(`${id}_`))
|
|
129
|
+
return rest.slice(id.length + 1);
|
|
130
|
+
}
|
|
131
|
+
// Fallback when no server ids are registered (test fixtures, early boot):
|
|
132
|
+
// assume the server id has no underscores.
|
|
133
|
+
const idx = rest.indexOf('_');
|
|
134
|
+
return idx >= 0 ? rest.slice(idx + 1) : name;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Convert snake_case to PascalCase for readable display names.
|
|
138
|
+
* `memory_search` → `MemorySearch`.
|
|
139
|
+
*/
|
|
140
|
+
export function snakeToPascal(name) {
|
|
141
|
+
return name
|
|
142
|
+
.split('_')
|
|
143
|
+
.filter((p) => p.length > 0)
|
|
144
|
+
.map((p) => p.charAt(0).toUpperCase() + p.slice(1))
|
|
145
|
+
.join('');
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Quote + truncate a free-form string argument to fit on one line.
|
|
149
|
+
* Returns `""` for missing input — the empty-quote pair signals "empty
|
|
150
|
+
* arg" rather than "no arg" (a no-arg call would not call this at all).
|
|
151
|
+
*/
|
|
152
|
+
export function quoteShort(s, max) {
|
|
153
|
+
if (typeof s !== 'string' || s.length === 0)
|
|
154
|
+
return '""';
|
|
155
|
+
const oneLine = s.replace(/\s+/g, ' ').trim();
|
|
156
|
+
const truncated = oneLine.length > max ? oneLine.slice(0, max - 1) + '…' : oneLine;
|
|
157
|
+
return `"${truncated}"`;
|
|
158
|
+
}
|
|
159
|
+
/** Collapse whitespace + truncate a string to one line bounded by `max`. */
|
|
160
|
+
export function truncateOneLine(s, max) {
|
|
161
|
+
if (typeof s !== 'string')
|
|
162
|
+
return '';
|
|
163
|
+
const oneLine = s.replace(/\s+/g, ' ').trim();
|
|
164
|
+
return oneLine.length > max ? oneLine.slice(0, max - 1) + '…' : oneLine;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Classify a tool-result preview line as part of a unified diff so the
|
|
168
|
+
* renderer can color it (red for removals, green for additions, gray
|
|
169
|
+
* for context). Detects file headers (`+++`, `---`), hunk headers
|
|
170
|
+
* (`@@`), and the per-line +/- gutter sign. Returns undefined when the
|
|
171
|
+
* line doesn't look like diff content so callers can leave it alone.
|
|
172
|
+
*/
|
|
173
|
+
export function classifyDiffLine(line) {
|
|
174
|
+
if (line.startsWith('+++ ') || line.startsWith('--- '))
|
|
175
|
+
return 'header';
|
|
176
|
+
if (line.startsWith('@@'))
|
|
177
|
+
return 'hunk';
|
|
178
|
+
if (line.startsWith('+'))
|
|
179
|
+
return 'add';
|
|
180
|
+
if (line.startsWith('-'))
|
|
181
|
+
return 'del';
|
|
182
|
+
return undefined;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* True when a multi-line preview looks like a unified diff (at least one
|
|
186
|
+
* `@@` hunk header OR multiple +/- gutter lines). Used by the tool-result
|
|
187
|
+
* renderer to decide whether to apply diff coloring to the whole block.
|
|
188
|
+
*/
|
|
189
|
+
export function looksLikeDiff(preview) {
|
|
190
|
+
if (!preview)
|
|
191
|
+
return false;
|
|
192
|
+
const lines = preview.split('\n');
|
|
193
|
+
let hunk = false;
|
|
194
|
+
let gutter = 0;
|
|
195
|
+
for (const line of lines) {
|
|
196
|
+
if (line.startsWith('@@')) {
|
|
197
|
+
hunk = true;
|
|
198
|
+
break;
|
|
199
|
+
}
|
|
200
|
+
if (line.startsWith('+') || line.startsWith('-'))
|
|
201
|
+
gutter++;
|
|
202
|
+
if (gutter >= 2)
|
|
203
|
+
break;
|
|
204
|
+
}
|
|
205
|
+
return hunk || gutter >= 2;
|
|
206
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Live terminal dimensions hook — re-renders the component whenever
|
|
3
|
+
* the user resizes the terminal window.
|
|
4
|
+
*
|
|
5
|
+
* Why this exists:
|
|
6
|
+
*
|
|
7
|
+
* Ink's `useStdout()` returns the stdout stream, and `stdout.columns`
|
|
8
|
+
* IS a live getter that always returns the current width. Ink also
|
|
9
|
+
* subscribes to `stdout.on('resize')` internally and triggers a
|
|
10
|
+
* re-render. In theory, reading `stdout?.columns` inside a render
|
|
11
|
+
* function automatically picks up the new width on the next resize.
|
|
12
|
+
*
|
|
13
|
+
* In practice, several dynamic parts of the chat REPL — the composer
|
|
14
|
+
* divider, the slash palette description column, the footer hints —
|
|
15
|
+
* were computed from a single inline `cols` const at the top of
|
|
16
|
+
* render. When the user dragged the terminal narrower or wider:
|
|
17
|
+
*
|
|
18
|
+
* - The divider stayed at its old length (overflowing or short).
|
|
19
|
+
* - The slash palette's description budget didn't update.
|
|
20
|
+
* - The footer right-side hint didn't collapse on narrow widths.
|
|
21
|
+
*
|
|
22
|
+
* Cause: Ink does re-render on resize, but children that received
|
|
23
|
+
* `cols` as a stable prop weren't being re-invoked with the new value
|
|
24
|
+
* in all of our cases. Explicitly subscribing to `resize` and using a
|
|
25
|
+
* React state update guarantees a re-render with the new dimensions
|
|
26
|
+
* regardless of Ink's internal heuristics.
|
|
27
|
+
*
|
|
28
|
+
* Returns `{ columns, rows }` — both auto-update on every resize event.
|
|
29
|
+
* Defaults to 80 × 24 when stdout is unavailable (non-TTY tests).
|
|
30
|
+
*/
|
|
31
|
+
export interface TerminalSize {
|
|
32
|
+
columns: number;
|
|
33
|
+
rows: number;
|
|
34
|
+
}
|
|
35
|
+
export declare function useTerminalSize(): TerminalSize;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
|
+
import { useStdout } from 'ink';
|
|
3
|
+
const DEFAULT_COLUMNS = 80;
|
|
4
|
+
const DEFAULT_ROWS = 24;
|
|
5
|
+
export function useTerminalSize() {
|
|
6
|
+
const { stdout } = useStdout();
|
|
7
|
+
const [size, setSize] = useState(() => ({
|
|
8
|
+
columns: stdout?.columns ?? DEFAULT_COLUMNS,
|
|
9
|
+
rows: stdout?.rows ?? DEFAULT_ROWS,
|
|
10
|
+
}));
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
if (!stdout)
|
|
13
|
+
return;
|
|
14
|
+
const onResize = () => {
|
|
15
|
+
setSize({
|
|
16
|
+
columns: stdout.columns ?? DEFAULT_COLUMNS,
|
|
17
|
+
rows: stdout.rows ?? DEFAULT_ROWS,
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
stdout.on('resize', onResize);
|
|
21
|
+
return () => {
|
|
22
|
+
stdout.off('resize', onResize);
|
|
23
|
+
};
|
|
24
|
+
}, [stdout]);
|
|
25
|
+
return size;
|
|
26
|
+
}
|
package/dist/cli/repl.d.ts
CHANGED
|
@@ -1,9 +1,31 @@
|
|
|
1
|
+
import readline from 'node:readline';
|
|
1
2
|
import type { Agent } from '../agent/agent.js';
|
|
2
|
-
import type { McpClientWrapper } from '../runtime/
|
|
3
|
+
import type { McpClientPool as McpClientWrapper } from '../runtime/mcpPool.js';
|
|
3
4
|
import type { Config } from '../config/config.js';
|
|
4
|
-
import type {
|
|
5
|
-
|
|
5
|
+
import type { ReplContext } from './commands/_context.js';
|
|
6
|
+
/**
|
|
7
|
+
* All slash commands the REPL recognizes. Used for tab autocomplete and for
|
|
8
|
+
* the readline completer. Keep alphabetically grouped roughly by surface area.
|
|
9
|
+
*
|
|
10
|
+
* The Ink chat REPL (cli/ink/runChat.tsx) consumes this same list for its
|
|
11
|
+
* inline slash palette so both surfaces stay in lockstep as new commands land.
|
|
12
|
+
*/
|
|
13
|
+
export declare const SLASH_COMMANDS: readonly ["/help", "/status", "/workspace", "/where", "/tools", "/skills", "/plan", "/transcript", "/doctor", "/config", "/diff", "/commit", "/clear", "/compact", "/exit", "/quit", "/roles", "/agents", "/agent", "/spawn", "/wait", "/spec", "/feature-dev", "/grill-me", "/review", "/implement-plan", "/skill", "/workflow", "/workflows", "/approve", "/memory", "/recall", "/briefing", "/scenes", "/working", "/forget", "/init", "/login", "/sessions", "/resume", "/model", "/mcp", "/goal", "/copy", "/fork", "/rename", "/permissions", "/hooks", "/hookify", "/loop", "/schedule", "/continue", "/auto-review", "/vim", "/statusline", "/quiet", "/release-notes", "/handover", "/explain", "/trace", "/failed", "/verify", "/audit", "/export", "/import", "/persona", "/skill-hints", "/diagnostics", "/tokens", "/watch", "/yolo", "/mode", "/review-policy", "/sandbox", "/kill", "/theme", "/title", "/personality", "/effort", "/new", "/side", "/btw", "/raw", "/feedback", "/rollout", "/ps", "/stop", "/logout", "/apps", "/plugins", "/experimental", "/memories", "/debug-config", "/mention", "/keymap", "/ide"];
|
|
6
14
|
export declare function renderHelp(category?: string): void;
|
|
15
|
+
/**
|
|
16
|
+
* Look up a one-line description for a slash command by walking the
|
|
17
|
+
* help registry. Used to populate the slash-suggest popup. Falls back
|
|
18
|
+
* to a generic placeholder if the command isn't documented (those
|
|
19
|
+
* commands still work — they just won't get a custom description
|
|
20
|
+
* inside the popup until someone adds them to `HELP_CATEGORIES`).
|
|
21
|
+
*
|
|
22
|
+
* Description text in `HELP_CATEGORIES` sometimes carries a parenthesised
|
|
23
|
+
* argument hint (e.g. "/config [key] [value]"); we strip everything
|
|
24
|
+
* after the first space when matching by cmd token so e.g. `/config`
|
|
25
|
+
* matches `cmd: "/config [key] [value]"`.
|
|
26
|
+
*/
|
|
27
|
+
export declare function lookupSlashDescription(cmd: string): string;
|
|
28
|
+
export declare function handleSlashCommand(command: string, args: string[], agent: Agent, mcpClient: McpClientWrapper, config: Config, rl: readline.Interface, ctx: ReplContext): Promise<void>;
|
|
7
29
|
/**
|
|
8
30
|
* Tab-completion source for `@path/to/file` mentions. Given a partial workspace
|
|
9
31
|
* path, return the matching files and directories one level deep. Stays inside
|