reasonix 0.34.1 → 0.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dashboard/app.css +16 -14
- package/dashboard/dist/app.js +77 -18
- package/dashboard/dist/app.js.map +1 -1
- package/dist/cli/{chat-TD6GR3QK.js → chat-RGMYAOY2.js} +18 -17
- package/dist/cli/{chunk-SA4UGZPG.js → chunk-2MCYGFLK.js} +15 -10
- package/dist/cli/chunk-2MCYGFLK.js.map +1 -0
- package/dist/cli/{chunk-SW3CCXEV.js → chunk-4Q3GRJIU.js} +2 -2
- package/dist/cli/{chunk-5JXXEPDM.js → chunk-BHLHOS5Y.js} +8 -2
- package/dist/cli/chunk-BHLHOS5Y.js.map +1 -0
- package/dist/cli/{chunk-F3ILWP2L.js → chunk-BJ376EN3.js} +9 -8
- package/dist/cli/chunk-BJ376EN3.js.map +1 -0
- package/dist/cli/{chunk-2AWTGJ2C.js → chunk-CRPQUBP6.js} +26 -9
- package/dist/cli/{chunk-2AWTGJ2C.js.map → chunk-CRPQUBP6.js.map} +1 -1
- package/dist/cli/{chunk-EINEIIIW.js → chunk-EN4LAZW5.js} +563 -250
- package/dist/cli/chunk-EN4LAZW5.js.map +1 -0
- package/dist/cli/{chunk-OERAGRJX.js → chunk-IPCPEZWQ.js} +2 -2
- package/dist/cli/{chunk-U3V2ZQ5J.js → chunk-KJQIA4US.js} +6 -2
- package/dist/cli/chunk-KJQIA4US.js.map +1 -0
- package/dist/cli/{chunk-Q36KBLSU.js → chunk-MLXUGPJE.js} +292 -35
- package/dist/cli/chunk-MLXUGPJE.js.map +1 -0
- package/dist/cli/{chunk-SX6L4HZZ.js → chunk-QPNZWUZF.js} +53 -6
- package/dist/cli/chunk-QPNZWUZF.js.map +1 -0
- package/dist/cli/{chunk-LNTORE5K.js → chunk-QRUQ2BFT.js} +159 -40
- package/dist/cli/chunk-QRUQ2BFT.js.map +1 -0
- package/dist/cli/{chunk-KZHMKOJH.js → chunk-T52GAWPP.js} +25 -3
- package/dist/cli/chunk-T52GAWPP.js.map +1 -0
- package/dist/cli/{chunk-I6YIAK6C.js → chunk-UNMYFZPZ.js} +2 -2
- package/dist/cli/{update-4TJWRUIN.js → chunk-WJ3YX4PZ.js} +51 -12
- package/dist/cli/chunk-WJ3YX4PZ.js.map +1 -0
- package/dist/cli/{chunk-RXGEGA7K.js → chunk-XQIFIB3U.js} +18 -7
- package/dist/cli/{chunk-RXGEGA7K.js.map → chunk-XQIFIB3U.js.map} +1 -1
- package/dist/cli/{chunk-2EBODRRO.js → chunk-ZJR4QLXB.js} +5 -1
- package/dist/cli/{chunk-2EBODRRO.js.map → chunk-ZJR4QLXB.js.map} +1 -1
- package/dist/cli/{chunk-6TMHAK5D.js → chunk-ZU45XW3P.js} +2 -2
- package/dist/cli/code-KJB3WDU6.js +435 -0
- package/dist/cli/code-KJB3WDU6.js.map +1 -0
- package/dist/cli/{commands-MEZPSEHV.js → commands-FE2UDFBC.js} +3 -3
- package/dist/cli/{commit-CE4EFTUQ.js → commit-3IAGB22T.js} +5 -4
- package/dist/cli/commit-3IAGB22T.js.map +1 -0
- package/dist/cli/{doctor-YASM64X6.js → doctor-DKD34EFD.js} +7 -7
- package/dist/cli/index.js +35 -33
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/{mcp-LDFK5QJI.js → mcp-2RDEQST6.js} +2 -2
- package/dist/cli/{mcp-browse-FYHEITCM.js → mcp-browse-VM5GLRBQ.js} +2 -2
- package/dist/cli/{mcp-inspect-T2HBR22P.js → mcp-inspect-CWSVCZUQ.js} +3 -3
- package/dist/cli/{prompt-V47QKSAR.js → prompt-YEKXMNNV.js} +3 -3
- package/dist/cli/{replay-JEDLU7F2.js → replay-D7RT2DR7.js} +3 -3
- package/dist/cli/replay-D7RT2DR7.js.map +1 -0
- package/dist/cli/{run-NHD2RSTD.js → run-FK5UBIIM.js} +13 -12
- package/dist/cli/run-FK5UBIIM.js.map +1 -0
- package/dist/cli/{server-MC4A4WAJ.js → server-W4XJK4GX.js} +17 -17
- package/dist/cli/{server-MC4A4WAJ.js.map → server-W4XJK4GX.js.map} +1 -1
- package/dist/cli/{sessions-ZHWJEW4L.js → sessions-YZXWMIWW.js} +10 -10
- package/dist/cli/{setup-DK43MT47.js → setup-IIAJXHP4.js} +196 -130
- package/dist/cli/setup-IIAJXHP4.js.map +1 -0
- package/dist/cli/update-GUCWB4UN.js +13 -0
- package/dist/cli/update-GUCWB4UN.js.map +1 -0
- package/dist/cli/{version-O362UKPM.js → version-DWD6RLIU.js} +12 -12
- package/dist/index.d.ts +19 -2
- package/dist/index.js +543 -78
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/cli/chunk-5JXXEPDM.js.map +0 -1
- package/dist/cli/chunk-EINEIIIW.js.map +0 -1
- package/dist/cli/chunk-F3ILWP2L.js.map +0 -1
- package/dist/cli/chunk-KZHMKOJH.js.map +0 -1
- package/dist/cli/chunk-LNTORE5K.js.map +0 -1
- package/dist/cli/chunk-Q36KBLSU.js.map +0 -1
- package/dist/cli/chunk-SA4UGZPG.js.map +0 -1
- package/dist/cli/chunk-SX6L4HZZ.js.map +0 -1
- package/dist/cli/chunk-U3V2ZQ5J.js.map +0 -1
- package/dist/cli/code-TGUOQBRJ.js +0 -153
- package/dist/cli/code-TGUOQBRJ.js.map +0 -1
- package/dist/cli/commit-CE4EFTUQ.js.map +0 -1
- package/dist/cli/replay-JEDLU7F2.js.map +0 -1
- package/dist/cli/run-NHD2RSTD.js.map +0 -1
- package/dist/cli/setup-DK43MT47.js.map +0 -1
- package/dist/cli/update-4TJWRUIN.js.map +0 -1
- /package/dist/cli/{chat-TD6GR3QK.js.map → chat-RGMYAOY2.js.map} +0 -0
- /package/dist/cli/{chunk-SW3CCXEV.js.map → chunk-4Q3GRJIU.js.map} +0 -0
- /package/dist/cli/{chunk-OERAGRJX.js.map → chunk-IPCPEZWQ.js.map} +0 -0
- /package/dist/cli/{chunk-I6YIAK6C.js.map → chunk-UNMYFZPZ.js.map} +0 -0
- /package/dist/cli/{chunk-6TMHAK5D.js.map → chunk-ZU45XW3P.js.map} +0 -0
- /package/dist/cli/{commands-MEZPSEHV.js.map → commands-FE2UDFBC.js.map} +0 -0
- /package/dist/cli/{doctor-YASM64X6.js.map → doctor-DKD34EFD.js.map} +0 -0
- /package/dist/cli/{mcp-LDFK5QJI.js.map → mcp-2RDEQST6.js.map} +0 -0
- /package/dist/cli/{mcp-browse-FYHEITCM.js.map → mcp-browse-VM5GLRBQ.js.map} +0 -0
- /package/dist/cli/{mcp-inspect-T2HBR22P.js.map → mcp-inspect-CWSVCZUQ.js.map} +0 -0
- /package/dist/cli/{prompt-V47QKSAR.js.map → prompt-YEKXMNNV.js.map} +0 -0
- /package/dist/cli/{sessions-ZHWJEW4L.js.map → sessions-YZXWMIWW.js.map} +0 -0
- /package/dist/cli/{version-O362UKPM.js.map → version-DWD6RLIU.js.map} +0 -0
|
@@ -0,0 +1,435 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
bootstrapSemanticSearchInCodeMode
|
|
4
|
+
} from "./chunk-4Q3GRJIU.js";
|
|
5
|
+
import {
|
|
6
|
+
chatCommand
|
|
7
|
+
} from "./chunk-EN4LAZW5.js";
|
|
8
|
+
import "./chunk-BQNUJJN7.js";
|
|
9
|
+
import {
|
|
10
|
+
preflightStdioSpec
|
|
11
|
+
} from "./chunk-RFX7TYVV.js";
|
|
12
|
+
import "./chunk-MRLXEMZ7.js";
|
|
13
|
+
import {
|
|
14
|
+
markPhase
|
|
15
|
+
} from "./chunk-CPOV2O73.js";
|
|
16
|
+
import {
|
|
17
|
+
ToolRegistry,
|
|
18
|
+
registerChoiceTool,
|
|
19
|
+
registerFilesystemTools,
|
|
20
|
+
registerMemoryTools,
|
|
21
|
+
registerPlanTool,
|
|
22
|
+
registerTodoTool
|
|
23
|
+
} from "./chunk-QRUQ2BFT.js";
|
|
24
|
+
import {
|
|
25
|
+
parseMcpSpec
|
|
26
|
+
} from "./chunk-UNMYFZPZ.js";
|
|
27
|
+
import "./chunk-XJLZ4HKU.js";
|
|
28
|
+
import "./chunk-XHQIK7B6.js";
|
|
29
|
+
import "./chunk-ZU45XW3P.js";
|
|
30
|
+
import "./chunk-T52GAWPP.js";
|
|
31
|
+
import "./chunk-ZJR4QLXB.js";
|
|
32
|
+
import "./chunk-MHDNZXJJ.js";
|
|
33
|
+
import "./chunk-BJ376EN3.js";
|
|
34
|
+
import "./chunk-DAEAAVDF.js";
|
|
35
|
+
import "./chunk-KMWKGPFZ.js";
|
|
36
|
+
import "./chunk-3Q3C4W66.js";
|
|
37
|
+
import "./chunk-4DCHFFEY.js";
|
|
38
|
+
import "./chunk-WJ3YX4PZ.js";
|
|
39
|
+
import "./chunk-2MCYGFLK.js";
|
|
40
|
+
import "./chunk-SOZE7V7V.js";
|
|
41
|
+
import "./chunk-G3XNWSFN.js";
|
|
42
|
+
import {
|
|
43
|
+
JobRegistry,
|
|
44
|
+
registerShellTools
|
|
45
|
+
} from "./chunk-QPNZWUZF.js";
|
|
46
|
+
import {
|
|
47
|
+
SkillStore
|
|
48
|
+
} from "./chunk-KJQIA4US.js";
|
|
49
|
+
import {
|
|
50
|
+
MCP_CATALOG
|
|
51
|
+
} from "./chunk-FM57FNPJ.js";
|
|
52
|
+
import "./chunk-XQIFIB3U.js";
|
|
53
|
+
import "./chunk-IPCPEZWQ.js";
|
|
54
|
+
import "./chunk-5X7LZJDE.js";
|
|
55
|
+
import {
|
|
56
|
+
sanitizeName
|
|
57
|
+
} from "./chunk-DFP4YSVM.js";
|
|
58
|
+
import "./chunk-MLXUGPJE.js";
|
|
59
|
+
import {
|
|
60
|
+
defaultConfigPath,
|
|
61
|
+
loadEditMode,
|
|
62
|
+
loadProjectShellAllowed,
|
|
63
|
+
readConfig,
|
|
64
|
+
writeConfig
|
|
65
|
+
} from "./chunk-BHLHOS5Y.js";
|
|
66
|
+
import "./chunk-WUI3P4RA.js";
|
|
67
|
+
import "./chunk-ZTLZO42A.js";
|
|
68
|
+
import "./chunk-ORM6PK57.js";
|
|
69
|
+
import "./chunk-CRPQUBP6.js";
|
|
70
|
+
|
|
71
|
+
// src/cli/commands/code.tsx
|
|
72
|
+
import { readFileSync } from "fs";
|
|
73
|
+
import { basename, resolve } from "path";
|
|
74
|
+
|
|
75
|
+
// src/tools/scaffold.ts
|
|
76
|
+
var VALID_SKILL_NAME = /^[a-zA-Z0-9][a-zA-Z0-9._-]{0,63}$/;
|
|
77
|
+
var VALID_SERVER_NAME = /^[a-zA-Z_][a-zA-Z0-9_-]{0,63}$/;
|
|
78
|
+
var VALID_TOOL_NAME = /^[a-zA-Z_][a-zA-Z0-9_-]*$/;
|
|
79
|
+
function registerScaffoldTools(registry, opts = {}) {
|
|
80
|
+
const configPath = opts.configPath ?? defaultConfigPath();
|
|
81
|
+
registry.register({
|
|
82
|
+
name: "create_skill",
|
|
83
|
+
description: 'Scaffold a new skill (`SKILL.md` in `.reasonix/skills/<name>.md`) the user can invoke later via `/skill <name>`. Use this when the user asks the agent to add a playbook, automate a recurring workflow, or capture a multi-step recipe as a named skill. The frontmatter is filled from the structured args here (description / allowed_tools / run_as / model) so the model never has to write raw YAML. Use `run_as: "subagent"` for read-and-synthesize playbooks where only the final answer should come back; default `"inline"` appends the body to the parent log so the user sees the steps. Refuses to overwrite an existing skill \u2014 pick a different name or ask the user to delete the old one.',
|
|
84
|
+
parameters: {
|
|
85
|
+
type: "object",
|
|
86
|
+
properties: {
|
|
87
|
+
name: {
|
|
88
|
+
type: "string",
|
|
89
|
+
description: "Skill identifier \u2014 letters/digits/`_`/`-`/`.`, 1\u201364 chars. Becomes the `name` frontmatter and the `<name>.md` filename."
|
|
90
|
+
},
|
|
91
|
+
description: {
|
|
92
|
+
type: "string",
|
|
93
|
+
description: 'One-line summary shown in the pinned skills index. Lead with the verb ("Run X and \u2026") so the parent agent can scan it.'
|
|
94
|
+
},
|
|
95
|
+
body: {
|
|
96
|
+
type: "string",
|
|
97
|
+
description: "Markdown body of the skill \u2014 the playbook the model follows when invoked. Plain prose + bullets; reference tools by name."
|
|
98
|
+
},
|
|
99
|
+
scope: {
|
|
100
|
+
type: "string",
|
|
101
|
+
enum: ["project", "global"],
|
|
102
|
+
description: "`project` = `.reasonix/skills/` under the workspace (default, requires `reasonix code`); `global` = `~/.reasonix/skills/` shared across all repos."
|
|
103
|
+
},
|
|
104
|
+
allowed_tools: {
|
|
105
|
+
type: "array",
|
|
106
|
+
items: { type: "string" },
|
|
107
|
+
description: "Optional whitelist of tool names the subagent registry is scoped to (only meaningful for `run_as: subagent`). Common values: `read_file`, `search_content`, `directory_tree`, `run_command`. Omit to give the subagent the full inherited toolset."
|
|
108
|
+
},
|
|
109
|
+
run_as: {
|
|
110
|
+
type: "string",
|
|
111
|
+
enum: ["inline", "subagent"],
|
|
112
|
+
description: "`inline` (default) appends the body to the parent log as a tool result. `subagent` spawns an isolated child loop and only the final answer comes back \u2014 use for read-and-synthesize playbooks (explore, research, review)."
|
|
113
|
+
},
|
|
114
|
+
model: {
|
|
115
|
+
type: "string",
|
|
116
|
+
enum: ["deepseek-v4-flash", "deepseek-v4-pro"],
|
|
117
|
+
description: "Subagent model override (only meaningful for `run_as: subagent`). Default is the same as `spawn_subagent` \u2014 `deepseek-v4-flash`. Set to `deepseek-v4-pro` only when the playbook empirically needs the stronger model."
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
required: ["name", "description", "body"]
|
|
121
|
+
},
|
|
122
|
+
fn: async (args) => {
|
|
123
|
+
const name = typeof args.name === "string" ? args.name.trim() : "";
|
|
124
|
+
if (!VALID_SKILL_NAME.test(name)) {
|
|
125
|
+
return JSON.stringify({
|
|
126
|
+
error: `invalid skill name: ${JSON.stringify(name)} \u2014 use letters, digits, _, -, .`
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
const description = typeof args.description === "string" ? args.description.trim().replace(/\n+/g, " ") : "";
|
|
130
|
+
if (!description) {
|
|
131
|
+
return JSON.stringify({
|
|
132
|
+
error: "create_skill requires a non-empty 'description'"
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
const body = typeof args.body === "string" ? args.body : "";
|
|
136
|
+
if (!body.trim()) {
|
|
137
|
+
return JSON.stringify({ error: "create_skill requires a non-empty 'body'" });
|
|
138
|
+
}
|
|
139
|
+
const scope = args.scope === "global" ? "global" : opts.projectRoot ? "project" : "global";
|
|
140
|
+
const runAs = args.run_as === "subagent" ? "subagent" : "inline";
|
|
141
|
+
const allowedTools = parseAllowedTools(args.allowed_tools);
|
|
142
|
+
if (allowedTools && "error" in allowedTools) {
|
|
143
|
+
return JSON.stringify({ error: allowedTools.error });
|
|
144
|
+
}
|
|
145
|
+
const model = typeof args.model === "string" && args.model.startsWith("deepseek-") ? args.model : void 0;
|
|
146
|
+
const content = serializeSkill({
|
|
147
|
+
name,
|
|
148
|
+
description,
|
|
149
|
+
runAs,
|
|
150
|
+
allowedTools: allowedTools ?? void 0,
|
|
151
|
+
model,
|
|
152
|
+
body
|
|
153
|
+
});
|
|
154
|
+
const store = new SkillStore({
|
|
155
|
+
homeDir: opts.homeDir,
|
|
156
|
+
projectRoot: opts.projectRoot
|
|
157
|
+
});
|
|
158
|
+
const result = store.createWithContent(name, scope, content);
|
|
159
|
+
if ("error" in result) {
|
|
160
|
+
return JSON.stringify({ error: result.error });
|
|
161
|
+
}
|
|
162
|
+
return JSON.stringify({
|
|
163
|
+
success: true,
|
|
164
|
+
path: result.path,
|
|
165
|
+
scope,
|
|
166
|
+
name,
|
|
167
|
+
run_as: runAs
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
registry.register({
|
|
172
|
+
name: "add_mcp_server",
|
|
173
|
+
description: 'Register a new MCP server in the user\'s Reasonix config (`mcp` array). Takes effect on the next session \u2014 does NOT spawn the server now. Use stdio for local commands (npx packages, local binaries), `sse` or `streamable-http` for remote endpoints. Pass `from_catalog: "<name>"` (e.g. `"filesystem"`, `"memory"`, `"github"`) to auto-fill `command` + `args` from the bundled catalog \u2014 the user still has to supply user-args (filesystem: a sandbox dir; github: GITHUB_PERSONAL_ACCESS_TOKEN in env). Refuses to add a server whose name collides with an existing entry.',
|
|
174
|
+
parameters: {
|
|
175
|
+
type: "object",
|
|
176
|
+
properties: {
|
|
177
|
+
name: {
|
|
178
|
+
type: "string",
|
|
179
|
+
description: "Server name \u2014 used as the namespace prefix on every tool the server exposes. Letters/digits/`_`/`-`, must start with a letter or `_`."
|
|
180
|
+
},
|
|
181
|
+
transport: {
|
|
182
|
+
type: "string",
|
|
183
|
+
enum: ["stdio", "sse", "streamable-http"],
|
|
184
|
+
description: "`stdio` = spawn a local command and pipe MCP over stdin/stdout. `sse` = HTTP+SSE remote. `streamable-http` = Streamable HTTP remote. Required unless `from_catalog` is set."
|
|
185
|
+
},
|
|
186
|
+
command: {
|
|
187
|
+
type: "string",
|
|
188
|
+
description: 'Argv[0] for stdio servers \u2014 typically `npx` or a binary path. Required when `transport: "stdio"` (and no `from_catalog`).'
|
|
189
|
+
},
|
|
190
|
+
args: {
|
|
191
|
+
type: "array",
|
|
192
|
+
items: { type: "string" },
|
|
193
|
+
description: 'Remaining argv for stdio servers \u2014 e.g. `["-y", "@modelcontextprotocol/server-filesystem", "/path/to/dir"]`. The dir at the tail is enforced to exist by the preflight check.'
|
|
194
|
+
},
|
|
195
|
+
url: {
|
|
196
|
+
type: "string",
|
|
197
|
+
description: "Endpoint URL for `sse` / `streamable-http` transports. Must be `http://` or `https://`."
|
|
198
|
+
},
|
|
199
|
+
from_catalog: {
|
|
200
|
+
type: "string",
|
|
201
|
+
description: "Optional shortcut \u2014 name out of the bundled catalog (`filesystem`, `memory`, `github`, `puppeteer`, `everything`). When set, fills `command` + `args` from the catalog entry; you still supply `name` (defaults to the catalog name) and any user-args via `args`."
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
required: ["name"]
|
|
205
|
+
},
|
|
206
|
+
fn: async (args) => {
|
|
207
|
+
const name = typeof args.name === "string" ? args.name.trim() : "";
|
|
208
|
+
if (!VALID_SERVER_NAME.test(name)) {
|
|
209
|
+
return JSON.stringify({
|
|
210
|
+
error: `invalid server name: ${JSON.stringify(name)} \u2014 must match [a-zA-Z_][a-zA-Z0-9_-]*`
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
const specStr = buildSpecString({
|
|
214
|
+
name,
|
|
215
|
+
transport: typeof args.transport === "string" ? args.transport : void 0,
|
|
216
|
+
command: typeof args.command === "string" ? args.command : void 0,
|
|
217
|
+
argv: Array.isArray(args.args) ? args.args.filter((a) => typeof a === "string") : void 0,
|
|
218
|
+
url: typeof args.url === "string" ? args.url : void 0,
|
|
219
|
+
fromCatalog: typeof args.from_catalog === "string" ? args.from_catalog : void 0
|
|
220
|
+
});
|
|
221
|
+
if ("error" in specStr) {
|
|
222
|
+
return JSON.stringify({ error: specStr.error });
|
|
223
|
+
}
|
|
224
|
+
let parsed;
|
|
225
|
+
try {
|
|
226
|
+
parsed = parseMcpSpec(specStr.spec);
|
|
227
|
+
} catch (err) {
|
|
228
|
+
return JSON.stringify({ error: err.message });
|
|
229
|
+
}
|
|
230
|
+
if (parsed.transport === "stdio") {
|
|
231
|
+
try {
|
|
232
|
+
preflightStdioSpec(parsed);
|
|
233
|
+
} catch (err) {
|
|
234
|
+
return JSON.stringify({ error: err.message });
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
const cfg = readConfig(configPath);
|
|
238
|
+
const existing = cfg.mcp ?? [];
|
|
239
|
+
const collision = existing.find((s) => parseSpecName(s) === name);
|
|
240
|
+
if (collision) {
|
|
241
|
+
return JSON.stringify({
|
|
242
|
+
error: `MCP server ${JSON.stringify(name)} already registered: ${collision}`
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
cfg.mcp = [...existing, specStr.spec];
|
|
246
|
+
writeConfig(cfg, configPath);
|
|
247
|
+
return JSON.stringify({
|
|
248
|
+
success: true,
|
|
249
|
+
name,
|
|
250
|
+
transport: parsed.transport,
|
|
251
|
+
spec: specStr.spec,
|
|
252
|
+
config_path: configPath,
|
|
253
|
+
active_on_next_launch: true
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
return registry;
|
|
258
|
+
}
|
|
259
|
+
function serializeSkill(args) {
|
|
260
|
+
const lines = ["---", `name: ${args.name}`, `description: ${args.description}`];
|
|
261
|
+
if (args.runAs === "subagent") {
|
|
262
|
+
lines.push("runAs: subagent");
|
|
263
|
+
}
|
|
264
|
+
if (args.allowedTools && args.allowedTools.length > 0) {
|
|
265
|
+
lines.push(`allowed-tools: ${args.allowedTools.join(", ")}`);
|
|
266
|
+
}
|
|
267
|
+
if (args.model) {
|
|
268
|
+
lines.push(`model: ${args.model}`);
|
|
269
|
+
}
|
|
270
|
+
lines.push("---", "");
|
|
271
|
+
return `${lines.join("\n")}
|
|
272
|
+
${args.body.trim()}
|
|
273
|
+
`;
|
|
274
|
+
}
|
|
275
|
+
function parseAllowedTools(raw) {
|
|
276
|
+
if (raw === void 0 || raw === null) return void 0;
|
|
277
|
+
if (!Array.isArray(raw)) {
|
|
278
|
+
return { error: "'allowed_tools' must be an array of tool-name strings" };
|
|
279
|
+
}
|
|
280
|
+
const out = [];
|
|
281
|
+
for (const v of raw) {
|
|
282
|
+
if (typeof v !== "string") {
|
|
283
|
+
return { error: "'allowed_tools' entries must be strings" };
|
|
284
|
+
}
|
|
285
|
+
const trimmed = v.trim();
|
|
286
|
+
if (!trimmed) continue;
|
|
287
|
+
if (!VALID_TOOL_NAME.test(trimmed)) {
|
|
288
|
+
return { error: `invalid tool name in allowed_tools: ${JSON.stringify(trimmed)}` };
|
|
289
|
+
}
|
|
290
|
+
out.push(trimmed);
|
|
291
|
+
}
|
|
292
|
+
return out.length > 0 ? out : void 0;
|
|
293
|
+
}
|
|
294
|
+
function buildSpecString(input) {
|
|
295
|
+
if (input.fromCatalog) {
|
|
296
|
+
const entry = MCP_CATALOG.find((e) => e.name === input.fromCatalog);
|
|
297
|
+
if (!entry) {
|
|
298
|
+
const known = MCP_CATALOG.map((e) => e.name).join(", ");
|
|
299
|
+
return {
|
|
300
|
+
error: `unknown catalog entry: ${JSON.stringify(input.fromCatalog)} \u2014 known: ${known}`
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
const userArgs = input.argv ?? [];
|
|
304
|
+
if (entry.userArgs && userArgs.length === 0) {
|
|
305
|
+
return {
|
|
306
|
+
error: `catalog entry "${entry.name}" needs ${entry.userArgs} \u2014 pass it via the 'args' parameter`
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
const tail = userArgs.map(quoteIfNeeded).join(" ");
|
|
310
|
+
const body = `npx -y ${entry.package}${tail ? ` ${tail}` : ""}`;
|
|
311
|
+
return { spec: `${input.name}=${body}` };
|
|
312
|
+
}
|
|
313
|
+
const transport = input.transport;
|
|
314
|
+
if (!transport) {
|
|
315
|
+
return { error: "add_mcp_server requires 'transport' (or 'from_catalog')" };
|
|
316
|
+
}
|
|
317
|
+
if (transport === "stdio") {
|
|
318
|
+
if (!input.command || !input.command.trim()) {
|
|
319
|
+
return { error: "stdio transport requires 'command'" };
|
|
320
|
+
}
|
|
321
|
+
const tail = (input.argv ?? []).map(quoteIfNeeded).join(" ");
|
|
322
|
+
const body = `${quoteIfNeeded(input.command.trim())}${tail ? ` ${tail}` : ""}`;
|
|
323
|
+
return { spec: `${input.name}=${body}` };
|
|
324
|
+
}
|
|
325
|
+
if (transport === "sse" || transport === "streamable-http") {
|
|
326
|
+
if (!input.url || !/^https?:\/\//i.test(input.url)) {
|
|
327
|
+
return { error: `${transport} transport requires an http(s):// 'url'` };
|
|
328
|
+
}
|
|
329
|
+
const prefix = transport === "streamable-http" ? "streamable+" : "";
|
|
330
|
+
return { spec: `${input.name}=${prefix}${input.url.trim()}` };
|
|
331
|
+
}
|
|
332
|
+
return { error: `unknown transport: ${JSON.stringify(transport)}` };
|
|
333
|
+
}
|
|
334
|
+
function parseSpecName(spec) {
|
|
335
|
+
const m = spec.trim().match(/^([a-zA-Z_][a-zA-Z0-9_-]*)=/);
|
|
336
|
+
return m ? m[1] ?? null : null;
|
|
337
|
+
}
|
|
338
|
+
function quoteIfNeeded(s) {
|
|
339
|
+
return /\s|"/.test(s) ? `"${s.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"` : s;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
// src/cli/commands/code.tsx
|
|
343
|
+
async function codeCommand(opts = {}) {
|
|
344
|
+
markPhase("code_command_enter");
|
|
345
|
+
const { codeSystemPrompt } = await import("./prompt-YEKXMNNV.js");
|
|
346
|
+
const rootDir = resolve(opts.dir ?? process.cwd());
|
|
347
|
+
const session = opts.noSession ? void 0 : `code-${sanitizeName(basename(rootDir))}`;
|
|
348
|
+
const tools = new ToolRegistry();
|
|
349
|
+
const jobs = new JobRegistry();
|
|
350
|
+
const registerRootedTools = (root) => {
|
|
351
|
+
registerFilesystemTools(tools, { rootDir: root });
|
|
352
|
+
registerShellTools(tools, {
|
|
353
|
+
rootDir: root,
|
|
354
|
+
// Per-project "always allow" list persisted from prior ShellConfirm
|
|
355
|
+
// choices; merged on top of the built-in allowlist in shell.ts.
|
|
356
|
+
// GETTER form — re-read every dispatch so a prefix the user adds
|
|
357
|
+
// via ShellConfirm mid-session takes effect on the next shell call
|
|
358
|
+
// instead of waiting for `/new` or a relaunch.
|
|
359
|
+
extraAllowed: () => loadProjectShellAllowed(root),
|
|
360
|
+
// `yolo` edit-mode disables shell confirmations entirely. Re-read
|
|
361
|
+
// from config on each dispatch so /mode yolo (or Shift+Tab cycling
|
|
362
|
+
// through to it) flips the gate live without forcing a relaunch.
|
|
363
|
+
allowAll: () => loadEditMode() === "yolo",
|
|
364
|
+
jobs
|
|
365
|
+
});
|
|
366
|
+
registerMemoryTools(tools, { projectRoot: root });
|
|
367
|
+
};
|
|
368
|
+
const reBootstrapSemantic = async (root) => {
|
|
369
|
+
const result = await bootstrapSemanticSearchInCodeMode(tools, root);
|
|
370
|
+
if (!result.enabled) tools.unregister("semantic_search");
|
|
371
|
+
return result;
|
|
372
|
+
};
|
|
373
|
+
registerRootedTools(rootDir);
|
|
374
|
+
registerPlanTool(tools);
|
|
375
|
+
registerChoiceTool(tools);
|
|
376
|
+
registerTodoTool(tools);
|
|
377
|
+
registerScaffoldTools(tools, { projectRoot: rootDir });
|
|
378
|
+
markPhase("semantic_bootstrap_start");
|
|
379
|
+
const semantic = await reBootstrapSemantic(rootDir);
|
|
380
|
+
markPhase(
|
|
381
|
+
semantic.enabled ? "semantic_bootstrap_done_enabled" : "semantic_bootstrap_done_skipped"
|
|
382
|
+
);
|
|
383
|
+
process.stderr.write(
|
|
384
|
+
`\u25B8 reasonix code: rooted at ${rootDir}, session "${session ?? "(ephemeral)"}" \xB7 ${tools.size} native tool(s)${semantic.enabled ? " \xB7 semantic_search on" : ""}
|
|
385
|
+
`
|
|
386
|
+
);
|
|
387
|
+
process.once("exit", () => {
|
|
388
|
+
void jobs.shutdown();
|
|
389
|
+
});
|
|
390
|
+
let systemAppendFileContents;
|
|
391
|
+
if (opts.systemAppend !== void 0 && opts.systemAppend.trim().length === 0) {
|
|
392
|
+
process.stderr.write("--system-append is empty \u2014 no prompt text will be appended\n");
|
|
393
|
+
}
|
|
394
|
+
if (opts.systemAppendFile) {
|
|
395
|
+
const filePath = resolve(opts.systemAppendFile);
|
|
396
|
+
try {
|
|
397
|
+
systemAppendFileContents = readFileSync(filePath, "utf8");
|
|
398
|
+
} catch (err) {
|
|
399
|
+
const e = err;
|
|
400
|
+
process.stderr.write(
|
|
401
|
+
`Error: cannot read --system-append-file "${filePath}": ${e.code ? `[${e.code}] ` : ""}${e.message}
|
|
402
|
+
`
|
|
403
|
+
);
|
|
404
|
+
process.exit(1);
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
await chatCommand({
|
|
408
|
+
model: opts.model ?? "deepseek-v4-flash",
|
|
409
|
+
budgetUsd: opts.budgetUsd,
|
|
410
|
+
system: codeSystemPrompt(rootDir, {
|
|
411
|
+
hasSemanticSearch: semantic.enabled,
|
|
412
|
+
systemAppend: opts.systemAppend,
|
|
413
|
+
systemAppendFile: systemAppendFileContents
|
|
414
|
+
}),
|
|
415
|
+
transcript: opts.transcript,
|
|
416
|
+
session,
|
|
417
|
+
seedTools: tools,
|
|
418
|
+
codeMode: {
|
|
419
|
+
rootDir,
|
|
420
|
+
jobs,
|
|
421
|
+
reregisterTools: registerRootedTools,
|
|
422
|
+
reBootstrapSemantic
|
|
423
|
+
},
|
|
424
|
+
mcp: readConfig().mcp,
|
|
425
|
+
forceResume: opts.forceResume,
|
|
426
|
+
forceNew: opts.forceNew,
|
|
427
|
+
noDashboard: opts.noDashboard,
|
|
428
|
+
altScreen: opts.altScreen,
|
|
429
|
+
mouse: opts.mouse
|
|
430
|
+
});
|
|
431
|
+
}
|
|
432
|
+
export {
|
|
433
|
+
codeCommand
|
|
434
|
+
};
|
|
435
|
+
//# sourceMappingURL=code-KJB3WDU6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/cli/commands/code.tsx","../../src/tools/scaffold.ts"],"sourcesContent":["/**\n * `reasonix code [dir]` — opinionated wrapper around `reasonix chat` for\n * code-editing workflows.\n *\n * What it does differently from plain chat:\n * - Registers native filesystem tools rooted at the given directory\n * (CWD by default). No subprocess, no `npx install` step, R1-\n * friendly schemas. Replaced the old `@modelcontextprotocol/server-filesystem`\n * subprocess in 0.4.9 because its `edit_file` argv shape was the\n * biggest driver of R1 DSML hallucinations.\n * - Uses a coding-focused system prompt (src/code/prompt.ts) that\n * teaches the model to propose edits as SEARCH/REPLACE blocks.\n * - Defaults to the `smart` preset (reasoner + harvest) because\n * coding tasks pay back R1 thinking.\n * - Scopes its session to the directory so projects don't share\n * conversation history.\n * - Hooks `codeMode` into the TUI so assistant replies get parsed\n * for SEARCH/REPLACE blocks and applied on disk after each turn.\n */\n\nimport { readFileSync } from \"node:fs\";\nimport { basename, resolve } from \"node:path\";\nimport { loadEditMode, loadProjectShellAllowed, readConfig } from \"../../config.js\";\nimport { bootstrapSemanticSearchInCodeMode } from \"../../index/semantic/tool.js\";\nimport { sanitizeName } from \"../../memory/session.js\";\nimport { ToolRegistry } from \"../../tools.js\";\nimport { registerChoiceTool } from \"../../tools/choice.js\";\nimport { registerFilesystemTools } from \"../../tools/filesystem.js\";\nimport { JobRegistry } from \"../../tools/jobs.js\";\nimport { registerMemoryTools } from \"../../tools/memory.js\";\nimport { registerPlanTool } from \"../../tools/plan.js\";\nimport { registerScaffoldTools } from \"../../tools/scaffold.js\";\nimport { registerShellTools } from \"../../tools/shell.js\";\nimport { registerTodoTool } from \"../../tools/todo.js\";\nimport { markPhase } from \"../startup-profile.js\";\nimport { chatCommand } from \"./chat.js\";\n\nexport interface CodeOptions {\n /** Directory to root the filesystem tools at. Defaults to process.cwd(). */\n dir?: string;\n /** Override the default `smart` model. */\n model?: string;\n /** Disable session persistence. */\n noSession?: boolean;\n /** Transcript file for replay/diff. */\n transcript?: string;\n /** Skip the session picker — always resume prior messages. */\n forceResume?: boolean;\n /** Skip the session picker — always wipe prior messages and start fresh. */\n forceNew?: boolean;\n /**\n * Soft USD spend cap. Off by default. Same semantics as `chat`:\n * warns at 80%, refuses next turn at 100%. Mid-session adjustable\n * via `/budget <usd>` slash command.\n */\n budgetUsd?: number;\n /** Suppress the auto-launched embedded web dashboard. */\n noDashboard?: boolean;\n /** Inline string appended to the code system prompt after the generated base prompt. */\n systemAppend?: string;\n /** Path to a UTF-8 text file whose contents are appended to the code system prompt. */\n systemAppendFile?: string;\n /** Default true. Pass false (CLI: `--no-alt-screen`) to keep chat output in shell scrollback. */\n altScreen?: boolean;\n /** Default true. Pass false (CLI: `--no-mouse`) to keep terminal-native drag-select unmodified. */\n mouse?: boolean;\n}\n\nexport async function codeCommand(opts: CodeOptions = {}): Promise<void> {\n markPhase(\"code_command_enter\");\n const { codeSystemPrompt } = await import(\"../../code/prompt.js\");\n const rootDir = resolve(opts.dir ?? process.cwd());\n // Per-directory session so switching projects doesn't mix histories.\n // `code-<sanitized-basename>` fits the session name rules without\n // truncating most project names.\n const session = opts.noSession ? undefined : `code-${sanitizeName(basename(rootDir))}`;\n\n // Native filesystem tools. No subprocess, ~50-200 ms faster per call\n // than the MCP server was, and `edit_file` takes a flat SEARCH/REPLACE\n // shape instead of the `string=\"false\"` JSON-in-string array that\n // triggered R1's DSML hallucinations all through 0.4.x.\n const tools = new ToolRegistry();\n // Background-process registry shared between the shell tools and the\n // TUI's /jobs + /kill slashes + exit cleanup. One per `reasonix code`\n // run — orphan prevention on SIGINT / process exit kills everything\n // it owns, so dev servers don't outlive the Reasonix process.\n const jobs = new JobRegistry();\n // Bundled re-registration so `/cwd <path>` can swap every rootDir-\n // dependent tool atomically. ToolRegistry.register is keyed by name\n // and overwrites in-place, so re-calling these against the existing\n // registry replaces the closures cleanly without disturbing tool\n // specs (names/descriptions/params don't reference rootDir, so the\n // prefix cache survives).\n const registerRootedTools = (root: string): void => {\n registerFilesystemTools(tools, { rootDir: root });\n registerShellTools(tools, {\n rootDir: root,\n // Per-project \"always allow\" list persisted from prior ShellConfirm\n // choices; merged on top of the built-in allowlist in shell.ts.\n // GETTER form — re-read every dispatch so a prefix the user adds\n // via ShellConfirm mid-session takes effect on the next shell call\n // instead of waiting for `/new` or a relaunch.\n extraAllowed: () => loadProjectShellAllowed(root),\n // `yolo` edit-mode disables shell confirmations entirely. Re-read\n // from config on each dispatch so /mode yolo (or Shift+Tab cycling\n // through to it) flips the gate live without forcing a relaunch.\n allowAll: () => loadEditMode() === \"yolo\",\n jobs,\n });\n // `remember` / `forget` / `recall_memory` — cross-session user memory.\n // Project scope hashes off rootDir so switching projects gets a fresh\n // per-project memory store; the global scope is shared across runs.\n registerMemoryTools(tools, { projectRoot: root });\n };\n // Async tail to `registerRootedTools`. Kept separate because the FS /\n // shell / memory re-registration above is sync and must happen before\n // the next tool dispatch, while semantic-index probing reads disk and\n // can race ahead in the background. On `/cwd`, App.tsx fires this\n // after the sync swap and surfaces the result via postInfo.\n const reBootstrapSemantic = async (root: string): Promise<{ enabled: boolean }> => {\n const result = await bootstrapSemanticSearchInCodeMode(tools, root);\n if (!result.enabled) tools.unregister(\"semantic_search\");\n return result;\n };\n registerRootedTools(rootDir);\n // `submit_plan` is always in the spec list so the prefix cache stays\n // stable across plan-mode toggles (Pillar 1). The tool itself is a\n // no-op outside plan mode and throws `PlanProposedError` when the\n // user has `/plan`-enabled the session.\n registerPlanTool(tools);\n // `ask_choice` — branching primitive. Independent of plan mode: the\n // model uses it to put a 2–4 way choice in front of the user\n // (strategy, style, library pick) without trying to squeeze the\n // menu into a submit_plan body. Keeping it always-registered\n // preserves the prefix cache across plan-mode toggles.\n registerChoiceTool(tools);\n // `todo_write` — lightweight in-session task tracker, no approval gate.\n // Independent of plan mode (readOnly=true so it stays callable in /plan).\n registerTodoTool(tools);\n // `create_skill` / `add_mcp_server` — let the model scaffold from chat.\n // Both writes go through the same paths the wizard / `/skill new` use,\n // so the on-disk shape stays one source of truth. New servers take\n // effect on next launch (no live client churn).\n registerScaffoldTools(tools, { projectRoot: rootDir });\n // `run_skill` is intentionally NOT registered here — App.tsx wires it\n // up with the subagent runner attached, so `runAs: subagent` skills\n // can spawn isolated child loops. Doing it here would mean the App's\n // re-registration would shadow the no-runner version, which works\n // (last write wins) but obscures the wiring.\n\n // Bootstrap semantic_search. Silent: registers the tool when an\n // on-disk index already exists, skips entirely otherwise. Setup\n // happens via the explicit `reasonix index` command — never\n // by surprise on launch.\n markPhase(\"semantic_bootstrap_start\");\n const semantic = await reBootstrapSemantic(rootDir);\n markPhase(\n semantic.enabled ? \"semantic_bootstrap_done_enabled\" : \"semantic_bootstrap_done_skipped\",\n );\n\n process.stderr.write(\n `▸ reasonix code: rooted at ${rootDir}, session \"${session ?? \"(ephemeral)\"}\" · ${tools.size} native tool(s)${\n semantic.enabled ? \" · semantic_search on\" : \"\"\n }\\n`,\n );\n\n // Belt-and-suspenders cleanup: even though spawn(detached:false)\n // should tie child processes to the parent's lifetime, Windows cmd.exe\n // wrappers occasionally leak. We DON'T install SIGINT/SIGTERM\n // handlers here — that overrode Node's default \"exit on Ctrl+C\" with\n // a silent no-op, which made Ctrl+C feel broken in the TUI. App.tsx\n // owns the SIGINT path now (it shows the quit-armed banner and calls\n // exit() on confirmation); this 'exit' hook just guarantees the job\n // registry is drained on the way out, regardless of which exit path\n // fired.\n process.once(\"exit\", () => {\n void jobs.shutdown();\n });\n\n let systemAppendFileContents: string | undefined;\n if (opts.systemAppend !== undefined && opts.systemAppend.trim().length === 0) {\n process.stderr.write(\"--system-append is empty — no prompt text will be appended\\n\");\n }\n if (opts.systemAppendFile) {\n const filePath = resolve(opts.systemAppendFile);\n try {\n systemAppendFileContents = readFileSync(filePath, \"utf8\");\n } catch (err) {\n const e = err as NodeJS.ErrnoException;\n process.stderr.write(\n `Error: cannot read --system-append-file \"${filePath}\": ${e.code ? `[${e.code}] ` : \"\"}${e.message}\\n`,\n );\n process.exit(1);\n }\n }\n\n await chatCommand({\n model: opts.model ?? \"deepseek-v4-flash\",\n budgetUsd: opts.budgetUsd,\n system: codeSystemPrompt(rootDir, {\n hasSemanticSearch: semantic.enabled,\n systemAppend: opts.systemAppend,\n systemAppendFile: systemAppendFileContents,\n }),\n transcript: opts.transcript,\n session,\n seedTools: tools,\n codeMode: {\n rootDir,\n jobs,\n reregisterTools: registerRootedTools,\n reBootstrapSemantic,\n },\n mcp: readConfig().mcp,\n forceResume: opts.forceResume,\n forceNew: opts.forceNew,\n noDashboard: opts.noDashboard,\n altScreen: opts.altScreen,\n mouse: opts.mouse,\n });\n}\n","/** Agent-facing tools for scaffolding skills + MCP servers from chat. Persists via the same paths the wizard / `/skill new` use. */\n\nimport { defaultConfigPath, readConfig, writeConfig } from \"../config.js\";\nimport { MCP_CATALOG } from \"../mcp/catalog.js\";\nimport { preflightStdioSpec } from \"../mcp/preflight.js\";\nimport { type McpSpec, parseMcpSpec } from \"../mcp/spec.js\";\nimport { SkillStore } from \"../skills.js\";\nimport type { ToolRegistry } from \"../tools.js\";\n\nexport interface ScaffoldToolsOptions {\n homeDir?: string;\n projectRoot?: string;\n /** Override config path — tests point this at a tmp file. */\n configPath?: string;\n}\n\nconst VALID_SKILL_NAME = /^[a-zA-Z0-9][a-zA-Z0-9._-]{0,63}$/;\nconst VALID_SERVER_NAME = /^[a-zA-Z_][a-zA-Z0-9_-]{0,63}$/;\nconst VALID_TOOL_NAME = /^[a-zA-Z_][a-zA-Z0-9_-]*$/;\n\nexport function registerScaffoldTools(\n registry: ToolRegistry,\n opts: ScaffoldToolsOptions = {},\n): ToolRegistry {\n const configPath = opts.configPath ?? defaultConfigPath();\n\n registry.register({\n name: \"create_skill\",\n description:\n 'Scaffold a new skill (`SKILL.md` in `.reasonix/skills/<name>.md`) the user can invoke later via `/skill <name>`. Use this when the user asks the agent to add a playbook, automate a recurring workflow, or capture a multi-step recipe as a named skill. The frontmatter is filled from the structured args here (description / allowed_tools / run_as / model) so the model never has to write raw YAML. Use `run_as: \"subagent\"` for read-and-synthesize playbooks where only the final answer should come back; default `\"inline\"` appends the body to the parent log so the user sees the steps. Refuses to overwrite an existing skill — pick a different name or ask the user to delete the old one.',\n parameters: {\n type: \"object\",\n properties: {\n name: {\n type: \"string\",\n description:\n \"Skill identifier — letters/digits/`_`/`-`/`.`, 1–64 chars. Becomes the `name` frontmatter and the `<name>.md` filename.\",\n },\n description: {\n type: \"string\",\n description:\n 'One-line summary shown in the pinned skills index. Lead with the verb (\"Run X and …\") so the parent agent can scan it.',\n },\n body: {\n type: \"string\",\n description:\n \"Markdown body of the skill — the playbook the model follows when invoked. Plain prose + bullets; reference tools by name.\",\n },\n scope: {\n type: \"string\",\n enum: [\"project\", \"global\"],\n description:\n \"`project` = `.reasonix/skills/` under the workspace (default, requires `reasonix code`); `global` = `~/.reasonix/skills/` shared across all repos.\",\n },\n allowed_tools: {\n type: \"array\",\n items: { type: \"string\" },\n description:\n \"Optional whitelist of tool names the subagent registry is scoped to (only meaningful for `run_as: subagent`). Common values: `read_file`, `search_content`, `directory_tree`, `run_command`. Omit to give the subagent the full inherited toolset.\",\n },\n run_as: {\n type: \"string\",\n enum: [\"inline\", \"subagent\"],\n description:\n \"`inline` (default) appends the body to the parent log as a tool result. `subagent` spawns an isolated child loop and only the final answer comes back — use for read-and-synthesize playbooks (explore, research, review).\",\n },\n model: {\n type: \"string\",\n enum: [\"deepseek-v4-flash\", \"deepseek-v4-pro\"],\n description:\n \"Subagent model override (only meaningful for `run_as: subagent`). Default is the same as `spawn_subagent` — `deepseek-v4-flash`. Set to `deepseek-v4-pro` only when the playbook empirically needs the stronger model.\",\n },\n },\n required: [\"name\", \"description\", \"body\"],\n },\n fn: async (args: {\n name?: unknown;\n description?: unknown;\n body?: unknown;\n scope?: unknown;\n allowed_tools?: unknown;\n run_as?: unknown;\n model?: unknown;\n }) => {\n const name = typeof args.name === \"string\" ? args.name.trim() : \"\";\n if (!VALID_SKILL_NAME.test(name)) {\n return JSON.stringify({\n error: `invalid skill name: ${JSON.stringify(name)} — use letters, digits, _, -, .`,\n });\n }\n const description =\n typeof args.description === \"string\" ? args.description.trim().replace(/\\n+/g, \" \") : \"\";\n if (!description) {\n return JSON.stringify({\n error: \"create_skill requires a non-empty 'description'\",\n });\n }\n const body = typeof args.body === \"string\" ? args.body : \"\";\n if (!body.trim()) {\n return JSON.stringify({ error: \"create_skill requires a non-empty 'body'\" });\n }\n const scope: \"project\" | \"global\" =\n args.scope === \"global\" ? \"global\" : opts.projectRoot ? \"project\" : \"global\";\n const runAs: \"inline\" | \"subagent\" = args.run_as === \"subagent\" ? \"subagent\" : \"inline\";\n const allowedTools = parseAllowedTools(args.allowed_tools);\n if (allowedTools && \"error\" in allowedTools) {\n return JSON.stringify({ error: allowedTools.error });\n }\n const model =\n typeof args.model === \"string\" && args.model.startsWith(\"deepseek-\")\n ? args.model\n : undefined;\n\n const content = serializeSkill({\n name,\n description,\n runAs,\n allowedTools: allowedTools ?? undefined,\n model,\n body,\n });\n\n const store = new SkillStore({\n homeDir: opts.homeDir,\n projectRoot: opts.projectRoot,\n });\n const result = store.createWithContent(name, scope, content);\n if (\"error\" in result) {\n return JSON.stringify({ error: result.error });\n }\n return JSON.stringify({\n success: true,\n path: result.path,\n scope,\n name,\n run_as: runAs,\n });\n },\n });\n\n registry.register({\n name: \"add_mcp_server\",\n description:\n 'Register a new MCP server in the user\\'s Reasonix config (`mcp` array). Takes effect on the next session — does NOT spawn the server now. Use stdio for local commands (npx packages, local binaries), `sse` or `streamable-http` for remote endpoints. Pass `from_catalog: \"<name>\"` (e.g. `\"filesystem\"`, `\"memory\"`, `\"github\"`) to auto-fill `command` + `args` from the bundled catalog — the user still has to supply user-args (filesystem: a sandbox dir; github: GITHUB_PERSONAL_ACCESS_TOKEN in env). Refuses to add a server whose name collides with an existing entry.',\n parameters: {\n type: \"object\",\n properties: {\n name: {\n type: \"string\",\n description:\n \"Server name — used as the namespace prefix on every tool the server exposes. Letters/digits/`_`/`-`, must start with a letter or `_`.\",\n },\n transport: {\n type: \"string\",\n enum: [\"stdio\", \"sse\", \"streamable-http\"],\n description:\n \"`stdio` = spawn a local command and pipe MCP over stdin/stdout. `sse` = HTTP+SSE remote. `streamable-http` = Streamable HTTP remote. Required unless `from_catalog` is set.\",\n },\n command: {\n type: \"string\",\n description:\n 'Argv[0] for stdio servers — typically `npx` or a binary path. Required when `transport: \"stdio\"` (and no `from_catalog`).',\n },\n args: {\n type: \"array\",\n items: { type: \"string\" },\n description:\n 'Remaining argv for stdio servers — e.g. `[\"-y\", \"@modelcontextprotocol/server-filesystem\", \"/path/to/dir\"]`. The dir at the tail is enforced to exist by the preflight check.',\n },\n url: {\n type: \"string\",\n description:\n \"Endpoint URL for `sse` / `streamable-http` transports. Must be `http://` or `https://`.\",\n },\n from_catalog: {\n type: \"string\",\n description:\n \"Optional shortcut — name out of the bundled catalog (`filesystem`, `memory`, `github`, `puppeteer`, `everything`). When set, fills `command` + `args` from the catalog entry; you still supply `name` (defaults to the catalog name) and any user-args via `args`.\",\n },\n },\n required: [\"name\"],\n },\n fn: async (args: {\n name?: unknown;\n transport?: unknown;\n command?: unknown;\n args?: unknown;\n url?: unknown;\n from_catalog?: unknown;\n }) => {\n const name = typeof args.name === \"string\" ? args.name.trim() : \"\";\n if (!VALID_SERVER_NAME.test(name)) {\n return JSON.stringify({\n error: `invalid server name: ${JSON.stringify(name)} — must match [a-zA-Z_][a-zA-Z0-9_-]*`,\n });\n }\n\n const specStr = buildSpecString({\n name,\n transport: typeof args.transport === \"string\" ? args.transport : undefined,\n command: typeof args.command === \"string\" ? args.command : undefined,\n argv: Array.isArray(args.args)\n ? (args.args.filter((a) => typeof a === \"string\") as string[])\n : undefined,\n url: typeof args.url === \"string\" ? args.url : undefined,\n fromCatalog: typeof args.from_catalog === \"string\" ? args.from_catalog : undefined,\n });\n if (\"error\" in specStr) {\n return JSON.stringify({ error: specStr.error });\n }\n\n let parsed: McpSpec;\n try {\n parsed = parseMcpSpec(specStr.spec);\n } catch (err) {\n return JSON.stringify({ error: (err as Error).message });\n }\n if (parsed.transport === \"stdio\") {\n try {\n preflightStdioSpec(parsed);\n } catch (err) {\n return JSON.stringify({ error: (err as Error).message });\n }\n }\n\n const cfg = readConfig(configPath);\n const existing = cfg.mcp ?? [];\n const collision = existing.find((s) => parseSpecName(s) === name);\n if (collision) {\n return JSON.stringify({\n error: `MCP server ${JSON.stringify(name)} already registered: ${collision}`,\n });\n }\n cfg.mcp = [...existing, specStr.spec];\n writeConfig(cfg, configPath);\n return JSON.stringify({\n success: true,\n name,\n transport: parsed.transport,\n spec: specStr.spec,\n config_path: configPath,\n active_on_next_launch: true,\n });\n },\n });\n\n return registry;\n}\n\ninterface SerializeSkillArgs {\n name: string;\n description: string;\n runAs: \"inline\" | \"subagent\";\n allowedTools?: readonly string[];\n model?: string;\n body: string;\n}\n\nexport function serializeSkill(args: SerializeSkillArgs): string {\n const lines: string[] = [\"---\", `name: ${args.name}`, `description: ${args.description}`];\n if (args.runAs === \"subagent\") {\n lines.push(\"runAs: subagent\");\n }\n if (args.allowedTools && args.allowedTools.length > 0) {\n lines.push(`allowed-tools: ${args.allowedTools.join(\", \")}`);\n }\n if (args.model) {\n lines.push(`model: ${args.model}`);\n }\n lines.push(\"---\", \"\");\n return `${lines.join(\"\\n\")}\\n${args.body.trim()}\\n`;\n}\n\nfunction parseAllowedTools(raw: unknown): readonly string[] | { error: string } | undefined {\n if (raw === undefined || raw === null) return undefined;\n if (!Array.isArray(raw)) {\n return { error: \"'allowed_tools' must be an array of tool-name strings\" };\n }\n const out: string[] = [];\n for (const v of raw) {\n if (typeof v !== \"string\") {\n return { error: \"'allowed_tools' entries must be strings\" };\n }\n const trimmed = v.trim();\n if (!trimmed) continue;\n if (!VALID_TOOL_NAME.test(trimmed)) {\n return { error: `invalid tool name in allowed_tools: ${JSON.stringify(trimmed)}` };\n }\n out.push(trimmed);\n }\n return out.length > 0 ? out : undefined;\n}\n\ninterface BuildSpecInput {\n name: string;\n transport?: string;\n command?: string;\n argv?: string[];\n url?: string;\n fromCatalog?: string;\n}\n\nfunction buildSpecString(input: BuildSpecInput): { spec: string } | { error: string } {\n if (input.fromCatalog) {\n const entry = MCP_CATALOG.find((e) => e.name === input.fromCatalog);\n if (!entry) {\n const known = MCP_CATALOG.map((e) => e.name).join(\", \");\n return {\n error: `unknown catalog entry: ${JSON.stringify(input.fromCatalog)} — known: ${known}`,\n };\n }\n const userArgs = input.argv ?? [];\n if (entry.userArgs && userArgs.length === 0) {\n return {\n error: `catalog entry \"${entry.name}\" needs ${entry.userArgs} — pass it via the 'args' parameter`,\n };\n }\n const tail = userArgs.map(quoteIfNeeded).join(\" \");\n const body = `npx -y ${entry.package}${tail ? ` ${tail}` : \"\"}`;\n return { spec: `${input.name}=${body}` };\n }\n\n const transport = input.transport;\n if (!transport) {\n return { error: \"add_mcp_server requires 'transport' (or 'from_catalog')\" };\n }\n if (transport === \"stdio\") {\n if (!input.command || !input.command.trim()) {\n return { error: \"stdio transport requires 'command'\" };\n }\n const tail = (input.argv ?? []).map(quoteIfNeeded).join(\" \");\n const body = `${quoteIfNeeded(input.command.trim())}${tail ? ` ${tail}` : \"\"}`;\n return { spec: `${input.name}=${body}` };\n }\n if (transport === \"sse\" || transport === \"streamable-http\") {\n if (!input.url || !/^https?:\\/\\//i.test(input.url)) {\n return { error: `${transport} transport requires an http(s):// 'url'` };\n }\n const prefix = transport === \"streamable-http\" ? \"streamable+\" : \"\";\n return { spec: `${input.name}=${prefix}${input.url.trim()}` };\n }\n return { error: `unknown transport: ${JSON.stringify(transport)}` };\n}\n\nfunction parseSpecName(spec: string): string | null {\n const m = spec.trim().match(/^([a-zA-Z_][a-zA-Z0-9_-]*)=/);\n return m ? (m[1] ?? null) : null;\n}\n\nfunction quoteIfNeeded(s: string): string {\n return /\\s|\"/.test(s) ? `\"${s.replace(/\\\\/g, \"\\\\\\\\\").replace(/\"/g, '\\\\\"')}\"` : s;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBA,SAAS,oBAAoB;AAC7B,SAAS,UAAU,eAAe;;;ACLlC,IAAM,mBAAmB;AACzB,IAAM,oBAAoB;AAC1B,IAAM,kBAAkB;AAEjB,SAAS,sBACd,UACA,OAA6B,CAAC,GAChB;AACd,QAAM,aAAa,KAAK,cAAc,kBAAkB;AAExD,WAAS,SAAS;AAAA,IAChB,MAAM;AAAA,IACN,aACE;AAAA,IACF,YAAY;AAAA,MACV,MAAM;AAAA,MACN,YAAY;AAAA,QACV,MAAM;AAAA,UACJ,MAAM;AAAA,UACN,aACE;AAAA,QACJ;AAAA,QACA,aAAa;AAAA,UACX,MAAM;AAAA,UACN,aACE;AAAA,QACJ;AAAA,QACA,MAAM;AAAA,UACJ,MAAM;AAAA,UACN,aACE;AAAA,QACJ;AAAA,QACA,OAAO;AAAA,UACL,MAAM;AAAA,UACN,MAAM,CAA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,iBAAiB,SAAS;AAAA,MAChC,mBAAmB,SAAS;AAAA,MAC5B,cAAc,KAAK;AAAA,MACnB,kBAAkB;AAAA,IACpB,CAAC;AAAA,IACD,YAAY,KAAK;AAAA,IACjB;AAAA,IACA,WAAW;AAAA,IACX,UAAU;AAAA,MACR;AAAA,MACA;AAAA,MACA,iBAAiB;AAAA,MACjB;AAAA,IACF;AAAA,IACA,KAAK,WAAW,EAAE;AAAA,IAClB,aAAa,KAAK;AAAA,IAClB,UAAU,KAAK;AAAA,IACf,aAAa,KAAK;AAAA,IAClB,WAAW,KAAK;AAAA,IAChB,OAAO,KAAK;AAAA,EACd,CAAC;AACH;","names":[]}
|
|
@@ -4,12 +4,12 @@ import {
|
|
|
4
4
|
checkOllamaStatus,
|
|
5
5
|
pullOllamaModel,
|
|
6
6
|
startOllamaDaemon
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-XQIFIB3U.js";
|
|
8
8
|
import "./chunk-5X7LZJDE.js";
|
|
9
9
|
import {
|
|
10
10
|
loadIndexConfig,
|
|
11
11
|
resolveSemanticEmbeddingConfig
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-BHLHOS5Y.js";
|
|
13
13
|
import "./chunk-WUI3P4RA.js";
|
|
14
14
|
|
|
15
15
|
// src/cli/commands/index.ts
|
|
@@ -350,4 +350,4 @@ function makeTtyWriter() {
|
|
|
350
350
|
export {
|
|
351
351
|
indexCommand
|
|
352
352
|
};
|
|
353
|
-
//# sourceMappingURL=commands-
|
|
353
|
+
//# sourceMappingURL=commands-FE2UDFBC.js.map
|
|
@@ -6,8 +6,9 @@ import {
|
|
|
6
6
|
loadDotenv
|
|
7
7
|
} from "./chunk-3Q3C4W66.js";
|
|
8
8
|
import {
|
|
9
|
-
loadApiKey
|
|
10
|
-
|
|
9
|
+
loadApiKey,
|
|
10
|
+
loadBaseUrl
|
|
11
|
+
} from "./chunk-BHLHOS5Y.js";
|
|
11
12
|
import "./chunk-WUI3P4RA.js";
|
|
12
13
|
|
|
13
14
|
// src/cli/commands/commit.ts
|
|
@@ -230,7 +231,7 @@ async function commitCommand(opts = {}) {
|
|
|
230
231
|
"reasonix commit: diff exceeded 80KB; head + tail sent to the model. Large diffs often produce vague drafts \u2014 consider committing in smaller chunks.\n"
|
|
231
232
|
);
|
|
232
233
|
}
|
|
233
|
-
const client = new DeepSeekClient({ apiKey });
|
|
234
|
+
const client = new DeepSeekClient({ apiKey, baseUrl: loadBaseUrl() });
|
|
234
235
|
const model = opts.model ?? DEFAULT_MODEL;
|
|
235
236
|
const recentCommits = readRecentCommits();
|
|
236
237
|
let message = "";
|
|
@@ -286,4 +287,4 @@ async function commitCommand(opts = {}) {
|
|
|
286
287
|
export {
|
|
287
288
|
commitCommand
|
|
288
289
|
};
|
|
289
|
-
//# sourceMappingURL=commit-
|
|
290
|
+
//# sourceMappingURL=commit-3IAGB22T.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/cli/commands/commit.ts"],"sourcesContent":["/** Drafts via diff + recent log (style mimicry); commit uses `-F -` so multi-line bodies survive shell quoting. */\n\nimport { spawn, spawnSync } from \"node:child_process\";\nimport { mkdtempSync, readFileSync, unlinkSync, writeFileSync } from \"node:fs\";\nimport { tmpdir } from \"node:os\";\nimport { join } from \"node:path\";\nimport { stdin, stdout } from \"node:process\";\nimport { createInterface } from \"node:readline/promises\";\nimport { DeepSeekClient } from \"../../client.js\";\nimport { loadApiKey, loadBaseUrl } from \"../../config.js\";\nimport { loadDotenv } from \"../../env.js\";\n\nexport interface CommitOptions {\n /** Override the default model (deepseek-v4-flash). */\n model?: string;\n /** Skip the confirmation step — useful in scripts where the diff has been pre-reviewed. */\n yes?: boolean;\n}\n\nconst DEFAULT_MODEL = \"deepseek-v4-flash\";\nconst DIFF_BYTE_CAP = 80 * 1024;\nconst LOG_COUNT = 10;\n\nconst SYSTEM_PROMPT = `You draft git commit messages.\n\nOutput ONLY the commit message — no preamble, no \\`\\`\\` fences, no \"Here's a commit message:\" lead-in. The first line of your output IS the commit subject.\n\nMatch the project's existing style:\n- Look at the recent commits provided. Mirror their voice, conventional-commit prefix usage (or absence), tense, length, body structure.\n- If recent commits use a \"type(scope): summary\" prefix, use it. If they don't, don't invent one.\n- Subject line: one line, ≤72 chars, imperative mood, no trailing period.\n- Body (optional): explain WHY when the diff isn't self-evident. Wrap at ~72 chars. Skip the body for trivial changes — repeating the subject in the body is noise.\n\nThe diff is the source of truth for what changed; describe THAT, not your guesses about the broader project. If the diff includes a deletion you can't explain from the surrounding context, name it but don't speculate about why.\n\nNo emojis unless the recent commits use them.\nNo co-author trailers, no \"Generated with X\" footers.`;\n\nfunction runGit(\n args: string[],\n opts: { input?: string } = {},\n): { stdout: string; stderr: string; status: number | null } {\n const result = spawnSync(\"git\", args, {\n encoding: \"utf8\",\n stdio: [\"pipe\", \"pipe\", \"pipe\"],\n input: opts.input,\n maxBuffer: 32 * 1024 * 1024,\n });\n return {\n stdout: result.stdout ?? \"\",\n stderr: result.stderr ?? \"\",\n status: result.status,\n };\n}\n\nfunction dieIfNotGitRepo(): void {\n const r = runGit([\"rev-parse\", \"--is-inside-work-tree\"]);\n if (r.status !== 0) {\n process.stderr.write(\"reasonix commit: not inside a git repository.\\n\");\n process.exit(1);\n }\n}\n\ninterface DiffResult {\n diff: string;\n source: \"staged\" | \"working-tree\";\n truncated: boolean;\n}\n\nfunction readDiff(): DiffResult | null {\n const staged = runGit([\"diff\", \"--staged\", \"--no-color\"]);\n if (staged.status !== 0) {\n process.stderr.write(`reasonix commit: git diff --staged failed: ${staged.stderr.trim()}\\n`);\n process.exit(1);\n }\n if (staged.stdout.trim().length > 0) {\n return capDiff(staged.stdout, \"staged\");\n }\n const wt = runGit([\"diff\", \"--no-color\"]);\n if (wt.stdout.trim().length === 0) {\n return null;\n }\n return capDiff(wt.stdout, \"working-tree\");\n}\n\nfunction capDiff(raw: string, source: \"staged\" | \"working-tree\"): DiffResult {\n if (raw.length <= DIFF_BYTE_CAP) {\n return { diff: raw, source, truncated: false };\n }\n const head = raw.slice(0, Math.floor(DIFF_BYTE_CAP * 0.7));\n const tail = raw.slice(-Math.floor(DIFF_BYTE_CAP * 0.3));\n return {\n diff: `${head}\\n\\n[… ${raw.length - DIFF_BYTE_CAP} bytes of diff truncated …]\\n\\n${tail}`,\n source,\n truncated: true,\n };\n}\n\nfunction readRecentCommits(): string {\n const r = runGit([\"log\", `-${LOG_COUNT}`, \"--no-merges\", \"--format=%s%n%b%n---END---\"]);\n if (r.status !== 0) {\n // Repo may not have any commits yet (initial commit case). Don't\n // fail — let the model work from the diff alone.\n return \"\";\n }\n return r.stdout.trim();\n}\n\nasync function draftMessage(\n client: DeepSeekClient,\n model: string,\n diff: DiffResult,\n recentCommits: string,\n): Promise<string> {\n const userParts: string[] = [];\n if (recentCommits) {\n userParts.push(`Recent commits (style reference):\\n\\n${recentCommits}`);\n }\n if (diff.source === \"working-tree\") {\n userParts.push(\n \"(NOTE: diff is from the working tree, not the staging area — nothing is staged yet. The user will stage selectively after seeing the draft.)\",\n );\n }\n userParts.push(`Diff to summarize:\\n\\n${diff.diff}`);\n\n const resp = await client.chat({\n model,\n messages: [\n { role: \"system\", content: SYSTEM_PROMPT },\n { role: \"user\", content: userParts.join(\"\\n\\n\") },\n ],\n temperature: 0.2,\n });\n return stripCodeFences(resp.content.trim());\n}\n\nfunction stripCodeFences(s: string): string {\n // Some models still wrap output in ``` despite the system prompt\n // telling them not to. Strip a single leading + trailing fence pair\n // if present. Only operates on a wrapping pair — internal fences\n // (a code block inside the body) stay.\n const trimmed = s.trim();\n const fenceOpen = /^```[a-zA-Z]*\\n/;\n const fenceClose = /\\n?```$/;\n if (fenceOpen.test(trimmed) && fenceClose.test(trimmed)) {\n return trimmed.replace(fenceOpen, \"\").replace(fenceClose, \"\").trim();\n }\n return trimmed;\n}\n\nfunction printDraft(message: string): void {\n const sep = \"─\".repeat(60);\n process.stdout.write(`\\n${sep}\\n${message}\\n${sep}\\n\\n`);\n}\n\nasync function promptChoice(): Promise<\"accept\" | \"regen\" | \"edit\" | \"cancel\"> {\n const rl = createInterface({ input: stdin, output: stdout });\n try {\n const answer = await rl.question(\"[a]ccept / [r]egenerate / [e]dit / [c]ancel: \");\n const k = answer.trim().toLowerCase();\n if (k === \"\" || k === \"a\" || k === \"y\" || k === \"yes\") return \"accept\";\n if (k === \"r\" || k === \"regen\" || k === \"regenerate\") return \"regen\";\n if (k === \"e\" || k === \"edit\") return \"edit\";\n return \"cancel\";\n } finally {\n rl.close();\n }\n}\n\nfunction editInExternal(initial: string): string | null {\n const editor = process.env.GIT_EDITOR ?? process.env.VISUAL ?? process.env.EDITOR;\n if (!editor) {\n process.stderr.write(\n \"reasonix commit: no $EDITOR / $VISUAL / $GIT_EDITOR set — can't open editor. Pick [a]ccept and `git commit --amend` afterwards.\\n\",\n );\n return null;\n }\n const dir = mkdtempSync(join(tmpdir(), \"reasonix-commit-\"));\n const path = join(dir, \"COMMIT_EDITMSG\");\n writeFileSync(path, initial, \"utf8\");\n // spawnSync with shell:true is required so $EDITOR strings like\n // `code --wait` work — they're shell command lines, not argv tuples.\n // The trust boundary is the user's own env var; matches how git\n // itself launches editors.\n const result = spawnSync(`${editor} \"${path}\"`, {\n stdio: \"inherit\",\n shell: true,\n });\n if (result.status !== 0) {\n try {\n unlinkSync(path);\n } catch {\n /* ignore */\n }\n process.stderr.write(\n `reasonix commit: editor exited ${result.status} — keeping prior draft.\\n`,\n );\n return null;\n }\n let edited: string;\n try {\n edited = readFileSync(path, \"utf8\");\n } catch {\n return null;\n } finally {\n try {\n unlinkSync(path);\n } catch {\n /* ignore */\n }\n }\n // Strip git's standard `# …` comment lines, even though we didn't\n // emit any — a user habituated to `git commit` may add `#`-prefixed\n // notes by reflex.\n const cleaned = edited\n .split(/\\r?\\n/)\n .filter((line) => !/^\\s*#/.test(line))\n .join(\"\\n\")\n .trim();\n return cleaned || null;\n}\n\nfunction commitWithMessage(message: string): void {\n // -F - reads the message from stdin, sidestepping shell quoting and\n // letting multi-line bodies through cleanly. Inherit stdio so the\n // user sees git's own confirmation / pre-commit hook output.\n const child = spawn(\"git\", [\"commit\", \"-F\", \"-\"], {\n stdio: [\"pipe\", \"inherit\", \"inherit\"],\n });\n child.stdin.write(message);\n child.stdin.end();\n child.on(\"close\", (code) => {\n if (code !== 0) {\n process.stderr.write(`reasonix commit: git commit exited ${code}.\\n`);\n process.exit(code ?? 1);\n }\n });\n}\n\nexport async function commitCommand(opts: CommitOptions = {}): Promise<void> {\n loadDotenv();\n dieIfNotGitRepo();\n\n const apiKey = loadApiKey() ?? process.env.DEEPSEEK_API_KEY;\n if (!apiKey) {\n process.stderr.write(\n \"reasonix commit: DEEPSEEK_API_KEY not set. Run `reasonix setup` to save one, or export it.\\n\",\n );\n process.exit(1);\n }\n\n const diff = readDiff();\n if (!diff) {\n process.stderr.write(\n \"reasonix commit: no staged changes and working tree is clean — nothing to commit.\\n\",\n );\n process.exit(1);\n }\n if (diff.source === \"working-tree\") {\n process.stderr.write(\n \"reasonix commit: nothing staged — drafting from working-tree diff. Stage your changes and re-run, or use the draft as a starting point.\\n\",\n );\n }\n if (diff.truncated) {\n process.stderr.write(\n \"reasonix commit: diff exceeded 80KB; head + tail sent to the model. Large diffs often produce vague drafts — consider committing in smaller chunks.\\n\",\n );\n }\n\n const client = new DeepSeekClient({ apiKey, baseUrl: loadBaseUrl() });\n const model = opts.model ?? DEFAULT_MODEL;\n const recentCommits = readRecentCommits();\n\n let message = \"\";\n let firstPass = true;\n while (true) {\n if (firstPass) {\n process.stdout.write(\"Drafting commit message…\\n\");\n } else {\n process.stdout.write(\"Regenerating…\\n\");\n }\n firstPass = false;\n try {\n message = await draftMessage(client, model, diff, recentCommits);\n } catch (err) {\n process.stderr.write(`reasonix commit: model call failed — ${(err as Error).message}\\n`);\n process.exit(1);\n }\n if (!message) {\n process.stderr.write(\"reasonix commit: model returned an empty draft. Try again.\\n\");\n process.exit(1);\n }\n printDraft(message);\n\n if (opts.yes) break;\n if (diff.source === \"working-tree\") {\n // Refuse to commit a working-tree-derived draft — the staging\n // area is empty so `git commit` would fail anyway. Print the\n // draft so the user can copy it; exit 0 because we did our job.\n process.stdout.write(\n \"(no staged changes — draft printed above for you to copy. Stage with `git add` and re-run to commit.)\\n\",\n );\n return;\n }\n\n const choice = await promptChoice();\n if (choice === \"accept\") break;\n if (choice === \"cancel\") {\n process.stderr.write(\"commit cancelled.\\n\");\n return;\n }\n if (choice === \"edit\") {\n const edited = editInExternal(message);\n if (edited) {\n message = edited;\n printDraft(message);\n // Re-prompt: the user may want to edit again, accept, etc.\n const next = await promptChoice();\n if (next === \"accept\") break;\n if (next === \"cancel\") {\n process.stderr.write(\"commit cancelled.\\n\");\n return;\n }\n // next is \"regen\" or another \"edit\" — fall through to the\n // loop top to re-draft (regen) or land back at this branch.\n }\n // editor returned no edit — loop top will regen by default.\n }\n // Anything else (regen, or unsuccessful edit) → loop top redraws.\n }\n\n commitWithMessage(message);\n}\n"],"mappings":";;;;;;;;;;;;;;AAEA,SAAS,OAAO,iBAAiB;AACjC,SAAS,aAAa,cAAc,YAAY,qBAAqB;AACrE,SAAS,cAAc;AACvB,SAAS,YAAY;AACrB,SAAS,OAAO,cAAc;AAC9B,SAAS,uBAAuB;AAYhC,IAAM,gBAAgB;AACtB,IAAM,gBAAgB,KAAK;AAC3B,IAAM,YAAY;AAElB,IAAM,gBAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAetB,SAAS,OACP,MACA,OAA2B,CAAC,GAC+B;AAC3D,QAAM,SAAS,UAAU,OAAO,MAAM;AAAA,IACpC,UAAU;AAAA,IACV,OAAO,CAAC,QAAQ,QAAQ,MAAM;AAAA,IAC9B,OAAO,KAAK;AAAA,IACZ,WAAW,KAAK,OAAO;AAAA,EACzB,CAAC;AACD,SAAO;AAAA,IACL,QAAQ,OAAO,UAAU;AAAA,IACzB,QAAQ,OAAO,UAA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IAChB;AACA,QAAI,CAAC,SAAS;AACZ,cAAQ,OAAO,MAAM,8DAA8D;AACnF,cAAQ,KAAK,CAAC;AAAA,IAChB;AACA,eAAW,OAAO;AAElB,QAAI,KAAK,IAAK;AACd,QAAI,KAAK,WAAW,gBAAgB;AAIlC,cAAQ,OAAO;AAAA,QACb;AAAA,MACF;AACA;AAAA,IACF;AAEA,UAAM,SAAS,MAAM,aAAa;AAClC,QAAI,WAAW,SAAU;AACzB,QAAI,WAAW,UAAU;AACvB,cAAQ,OAAO,MAAM,qBAAqB;AAC1C;AAAA,IACF;AACA,QAAI,WAAW,QAAQ;AACrB,YAAM,SAAS,eAAe,OAAO;AACrC,UAAI,QAAQ;AACV,kBAAU;AACV,mBAAW,OAAO;AAElB,cAAM,OAAO,MAAM,aAAa;AAChC,YAAI,SAAS,SAAU;AACvB,YAAI,SAAS,UAAU;AACrB,kBAAQ,OAAO,MAAM,qBAAqB;AAC1C;AAAA,QACF;AAAA,MAGF;AAAA,IAEF;AAAA,EAEF;AAEA,oBAAkB,OAAO;AAC3B;","names":[]}
|
|
@@ -2,20 +2,20 @@
|
|
|
2
2
|
import {
|
|
3
3
|
doctorCommand,
|
|
4
4
|
runDoctorChecks
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-BJ376EN3.js";
|
|
6
6
|
import "./chunk-DAEAAVDF.js";
|
|
7
7
|
import "./chunk-KMWKGPFZ.js";
|
|
8
8
|
import "./chunk-3Q3C4W66.js";
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-2AWTGJ2C.js";
|
|
9
|
+
import "./chunk-XQIFIB3U.js";
|
|
10
|
+
import "./chunk-IPCPEZWQ.js";
|
|
12
11
|
import "./chunk-5X7LZJDE.js";
|
|
13
12
|
import "./chunk-DFP4YSVM.js";
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-MLXUGPJE.js";
|
|
14
|
+
import "./chunk-BHLHOS5Y.js";
|
|
16
15
|
import "./chunk-WUI3P4RA.js";
|
|
16
|
+
import "./chunk-CRPQUBP6.js";
|
|
17
17
|
export {
|
|
18
18
|
doctorCommand,
|
|
19
19
|
runDoctorChecks
|
|
20
20
|
};
|
|
21
|
-
//# sourceMappingURL=doctor-
|
|
21
|
+
//# sourceMappingURL=doctor-DKD34EFD.js.map
|