@freesyntax/notch-cli 0.5.22 → 0.5.23
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/dist/{chunk-EPSOOCNB.js → chunk-474TAHDN.js} +46 -6
- package/dist/{chunk-JXQ4HZ47.js → chunk-JVFOAPYV.js} +279 -28
- package/dist/{chunk-J66N6AFH.js → chunk-UHK6SI4H.js} +87 -18
- package/dist/{chunk-FZVPGJJW.js → chunk-YNYVQ7ZI.js} +10 -10
- package/dist/{config-set-3IWEVZQ4.js → config-set-5F4VK7IT.js} +3 -2
- package/dist/index.js +540 -212
- package/dist/{model-download-3NDKS3VM.js → model-download-KCQJCEPW.js} +1 -1
- package/dist/{ollama-bench-5V5CCOCQ.js → ollama-bench-JLC5POG3.js} +6 -6
- package/dist/{ollama-launch-P5KBK7AJ.js → ollama-launch-3IKB2A3Z.js} +3 -3
- package/dist/server-GMF4WV67.js +187 -0
- package/dist/{tools-XWKCW4RN.js → tools-ABRZPCEJ.js} +3 -1
- package/package.json +60 -57
- package/dist/server-IGOZHW52.js +0 -1479
|
@@ -2,17 +2,17 @@ import {
|
|
|
2
2
|
printNotReachable,
|
|
3
3
|
renderProgressLine,
|
|
4
4
|
resolveEndpoint
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-YNYVQ7ZI.js";
|
|
6
|
+
import "./chunk-O6AKZ4OH.js";
|
|
7
|
+
import "./chunk-KCAR5DOB.js";
|
|
8
|
+
import {
|
|
9
|
+
resolveByokModel
|
|
10
|
+
} from "./chunk-JVFOAPYV.js";
|
|
6
11
|
import {
|
|
7
12
|
detectDaemon,
|
|
8
13
|
listModels,
|
|
9
14
|
pullModel
|
|
10
15
|
} from "./chunk-GFVLHUSS.js";
|
|
11
|
-
import "./chunk-O6AKZ4OH.js";
|
|
12
|
-
import "./chunk-KCAR5DOB.js";
|
|
13
|
-
import {
|
|
14
|
-
resolveByokModel
|
|
15
|
-
} from "./chunk-JXQ4HZ47.js";
|
|
16
16
|
import "./chunk-PPEBWOMJ.js";
|
|
17
17
|
import "./chunk-KFQGP6VL.js";
|
|
18
18
|
|
|
@@ -5,11 +5,11 @@ import {
|
|
|
5
5
|
renderProgressLine,
|
|
6
6
|
resolveEndpoint,
|
|
7
7
|
runOllamaCli
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-GFVLHUSS.js";
|
|
8
|
+
} from "./chunk-YNYVQ7ZI.js";
|
|
10
9
|
import "./chunk-O6AKZ4OH.js";
|
|
11
10
|
import "./chunk-KCAR5DOB.js";
|
|
12
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-JVFOAPYV.js";
|
|
12
|
+
import "./chunk-GFVLHUSS.js";
|
|
13
13
|
import "./chunk-PPEBWOMJ.js";
|
|
14
14
|
import "./chunk-KFQGP6VL.js";
|
|
15
15
|
export {
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import "./chunk-KFQGP6VL.js";
|
|
2
|
+
|
|
3
|
+
// src/mcp/server.ts
|
|
4
|
+
import readline from "readline";
|
|
5
|
+
import { zodToJsonSchema } from "zod-to-json-schema";
|
|
6
|
+
var RPC_ERR = {
|
|
7
|
+
PARSE_ERROR: -32700,
|
|
8
|
+
INVALID_REQUEST: -32600,
|
|
9
|
+
METHOD_NOT_FOUND: -32601,
|
|
10
|
+
INVALID_PARAMS: -32602,
|
|
11
|
+
INTERNAL_ERROR: -32603
|
|
12
|
+
};
|
|
13
|
+
function writeMessage(msg) {
|
|
14
|
+
process.stdout.write(JSON.stringify(msg) + "\n");
|
|
15
|
+
}
|
|
16
|
+
function logStderr(msg) {
|
|
17
|
+
process.stderr.write(`[notch-mcp] ${msg}
|
|
18
|
+
`);
|
|
19
|
+
}
|
|
20
|
+
function toolsToMcpList(tools) {
|
|
21
|
+
return tools.map((t) => ({
|
|
22
|
+
name: t.name,
|
|
23
|
+
description: t.description,
|
|
24
|
+
inputSchema: zodToJsonSchema(t.parameters, { target: "openApi3" })
|
|
25
|
+
}));
|
|
26
|
+
}
|
|
27
|
+
async function runMcpServer(opts) {
|
|
28
|
+
const toolsModule = await import("./tools-ABRZPCEJ.js");
|
|
29
|
+
const { pluginManager } = await import("./plugins-PNGRZLFW.js");
|
|
30
|
+
if (opts.includePlugins !== false) {
|
|
31
|
+
try {
|
|
32
|
+
await pluginManager.init(opts.cwd, (m) => logStderr(m));
|
|
33
|
+
} catch (err) {
|
|
34
|
+
logStderr(`plugin init failed: ${err.message}`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
const getTools = () => toolsModule.listToolNames().map((name) => ({ name, desc: toolsModule.describeTools() })).filter(() => true);
|
|
38
|
+
const { readTool } = await import("./read-B64XE7N3.js");
|
|
39
|
+
const { writeTool } = await import("./write-ZOSB7I4J.js");
|
|
40
|
+
const { editTool } = await import("./edit-6QYAXVNU.js");
|
|
41
|
+
const { applyPatchTool } = await import("./apply-patch-U6K67CMT.js");
|
|
42
|
+
const { shellTool } = await import("./shell-BOZTHQUT.js");
|
|
43
|
+
const { gitTool } = await import("./git-DNQ5EELH.js");
|
|
44
|
+
const { githubTool } = await import("./github-34T4QQIH.js");
|
|
45
|
+
const { grepTool } = await import("./grep-T2CXYNRI.js");
|
|
46
|
+
const { globTool } = await import("./glob-XT43LEJ4.js");
|
|
47
|
+
const { webFetchTool } = await import("./web-fetch-OTNDICGJ.js");
|
|
48
|
+
const { lspTool } = await import("./lsp-JXQVU7NP.js");
|
|
49
|
+
const { notebookTool } = await import("./notebook-MFODW345.js");
|
|
50
|
+
const { taskTool } = await import("./task-67G4KLYC.js");
|
|
51
|
+
const exposed = [
|
|
52
|
+
readTool,
|
|
53
|
+
writeTool,
|
|
54
|
+
editTool,
|
|
55
|
+
applyPatchTool,
|
|
56
|
+
shellTool,
|
|
57
|
+
gitTool,
|
|
58
|
+
githubTool,
|
|
59
|
+
grepTool,
|
|
60
|
+
globTool,
|
|
61
|
+
webFetchTool,
|
|
62
|
+
lspTool,
|
|
63
|
+
notebookTool,
|
|
64
|
+
taskTool
|
|
65
|
+
];
|
|
66
|
+
if (opts.includePlugins !== false) {
|
|
67
|
+
exposed.push(...pluginManager.getTools());
|
|
68
|
+
}
|
|
69
|
+
const toolByName = new Map(exposed.map((t) => [t.name, t]));
|
|
70
|
+
const mcpTools = toolsToMcpList(exposed);
|
|
71
|
+
const toolCtx = {
|
|
72
|
+
cwd: opts.cwd,
|
|
73
|
+
requireConfirm: false,
|
|
74
|
+
confirm: async () => true,
|
|
75
|
+
log: (m) => logStderr(m)
|
|
76
|
+
};
|
|
77
|
+
let initialized = false;
|
|
78
|
+
logStderr(`ready \u2014 ${exposed.length} tools on stdio (version ${opts.version})`);
|
|
79
|
+
void getTools;
|
|
80
|
+
const rl = readline.createInterface({ input: process.stdin, terminal: false });
|
|
81
|
+
rl.on("line", async (line) => {
|
|
82
|
+
const trimmed = line.trim();
|
|
83
|
+
if (!trimmed) return;
|
|
84
|
+
let req;
|
|
85
|
+
try {
|
|
86
|
+
req = JSON.parse(trimmed);
|
|
87
|
+
} catch (err) {
|
|
88
|
+
writeMessage({
|
|
89
|
+
jsonrpc: "2.0",
|
|
90
|
+
id: null,
|
|
91
|
+
error: { code: RPC_ERR.PARSE_ERROR, message: `parse error: ${err.message}` }
|
|
92
|
+
});
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
if (req.id === void 0 || req.id === null) {
|
|
96
|
+
if (req.method === "notifications/initialized") {
|
|
97
|
+
initialized = true;
|
|
98
|
+
} else if (req.method === "notifications/cancelled") {
|
|
99
|
+
} else {
|
|
100
|
+
logStderr(`ignored notification: ${req.method}`);
|
|
101
|
+
}
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
const reply = (result) => writeMessage({ jsonrpc: "2.0", id: req.id, result });
|
|
105
|
+
const fail = (code, message, data) => writeMessage({ jsonrpc: "2.0", id: req.id, error: { code, message, data } });
|
|
106
|
+
try {
|
|
107
|
+
switch (req.method) {
|
|
108
|
+
case "initialize": {
|
|
109
|
+
reply({
|
|
110
|
+
protocolVersion: "2024-11-05",
|
|
111
|
+
capabilities: {
|
|
112
|
+
tools: { listChanged: false }
|
|
113
|
+
},
|
|
114
|
+
serverInfo: {
|
|
115
|
+
name: "notch-cli",
|
|
116
|
+
version: opts.version
|
|
117
|
+
},
|
|
118
|
+
instructions: "Notch CLI exposes its code-editing tool registry over MCP. Prefer apply_patch for multi-file edits and edit for surgical single-line changes. The caller is responsible for approval and sandboxing."
|
|
119
|
+
});
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
122
|
+
case "ping": {
|
|
123
|
+
reply({});
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
126
|
+
case "tools/list": {
|
|
127
|
+
reply({ tools: mcpTools });
|
|
128
|
+
break;
|
|
129
|
+
}
|
|
130
|
+
case "tools/call": {
|
|
131
|
+
const params = req.params;
|
|
132
|
+
if (!params?.name) {
|
|
133
|
+
fail(RPC_ERR.INVALID_PARAMS, '"name" is required');
|
|
134
|
+
break;
|
|
135
|
+
}
|
|
136
|
+
const tool = toolByName.get(params.name);
|
|
137
|
+
if (!tool) {
|
|
138
|
+
fail(RPC_ERR.METHOD_NOT_FOUND, `tool not found: ${params.name}`);
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
if (!initialized) {
|
|
142
|
+
logStderr(`tools/call before initialized notification \u2014 proceeding anyway`);
|
|
143
|
+
}
|
|
144
|
+
try {
|
|
145
|
+
const parseResult = tool.parameters.safeParse(params.arguments ?? {});
|
|
146
|
+
if (!parseResult.success) {
|
|
147
|
+
reply({
|
|
148
|
+
content: [{ type: "text", text: `Invalid arguments: ${parseResult.error.message}` }],
|
|
149
|
+
isError: true
|
|
150
|
+
});
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
153
|
+
const result = await tool.execute(parseResult.data, toolCtx);
|
|
154
|
+
reply({
|
|
155
|
+
content: [{ type: "text", text: result.content }],
|
|
156
|
+
isError: result.isError ?? false
|
|
157
|
+
});
|
|
158
|
+
} catch (err) {
|
|
159
|
+
reply({
|
|
160
|
+
content: [{ type: "text", text: `Tool error: ${err.message}` }],
|
|
161
|
+
isError: true
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
break;
|
|
165
|
+
}
|
|
166
|
+
case "shutdown": {
|
|
167
|
+
reply({});
|
|
168
|
+
setTimeout(() => process.exit(0), 50);
|
|
169
|
+
break;
|
|
170
|
+
}
|
|
171
|
+
default:
|
|
172
|
+
fail(RPC_ERR.METHOD_NOT_FOUND, `method not found: ${req.method}`);
|
|
173
|
+
}
|
|
174
|
+
} catch (err) {
|
|
175
|
+
fail(RPC_ERR.INTERNAL_ERROR, `internal error: ${err.message}`);
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
rl.on("close", () => {
|
|
179
|
+
logStderr("stdin closed, exiting");
|
|
180
|
+
process.exit(0);
|
|
181
|
+
});
|
|
182
|
+
await new Promise(() => {
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
export {
|
|
186
|
+
runMcpServer
|
|
187
|
+
};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
buildToolMap,
|
|
3
|
+
describeToolSchemas,
|
|
3
4
|
describeTools,
|
|
4
5
|
disconnectMCPServers,
|
|
5
6
|
initMCPServers,
|
|
6
7
|
listToolNames,
|
|
7
8
|
mcpToolCount
|
|
8
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-474TAHDN.js";
|
|
9
10
|
import "./chunk-6NKRMZTX.js";
|
|
10
11
|
import "./chunk-6CZCFY6H.js";
|
|
11
12
|
import "./chunk-6U3ZAGYA.js";
|
|
@@ -25,6 +26,7 @@ import "./chunk-FAULT7VE.js";
|
|
|
25
26
|
import "./chunk-KFQGP6VL.js";
|
|
26
27
|
export {
|
|
27
28
|
buildToolMap,
|
|
29
|
+
describeToolSchemas,
|
|
28
30
|
describeTools,
|
|
29
31
|
disconnectMCPServers,
|
|
30
32
|
initMCPServers,
|
package/package.json
CHANGED
|
@@ -1,57 +1,60 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@freesyntax/notch-cli",
|
|
3
|
-
"version": "0.5.
|
|
4
|
-
"description": "Notch CLI — AI-powered coding assistant by Driftrail",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"bin": {
|
|
7
|
-
"notch": "dist/index.js"
|
|
8
|
-
},
|
|
9
|
-
"files": [
|
|
10
|
-
"dist"
|
|
11
|
-
],
|
|
12
|
-
"scripts": {
|
|
13
|
-
"build": "tsup --dts",
|
|
14
|
-
"build:publish": "tsup",
|
|
15
|
-
"dev": "tsup --watch",
|
|
16
|
-
"start": "node dist/index.js",
|
|
17
|
-
"typecheck": "tsc --noEmit",
|
|
18
|
-
"lint": "eslint src/",
|
|
19
|
-
"test": "vitest run",
|
|
20
|
-
"prepublishOnly": "npm run build:publish"
|
|
21
|
-
},
|
|
22
|
-
"dependencies": {
|
|
23
|
-
"@ai-sdk/anthropic": "^1.2.12",
|
|
24
|
-
"@ai-sdk/openai": "^1.2.0",
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
"
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
"
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
"
|
|
43
|
-
},
|
|
44
|
-
"
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
"
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
|
|
57
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@freesyntax/notch-cli",
|
|
3
|
+
"version": "0.5.23",
|
|
4
|
+
"description": "Notch CLI — AI-powered coding assistant by Driftrail",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"notch": "dist/index.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist"
|
|
11
|
+
],
|
|
12
|
+
"scripts": {
|
|
13
|
+
"build": "tsup --dts",
|
|
14
|
+
"build:publish": "tsup",
|
|
15
|
+
"dev": "tsup --watch",
|
|
16
|
+
"start": "node dist/index.js",
|
|
17
|
+
"typecheck": "tsc --noEmit",
|
|
18
|
+
"lint": "eslint src/",
|
|
19
|
+
"test": "vitest run",
|
|
20
|
+
"prepublishOnly": "npm run build:publish"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@ai-sdk/anthropic": "^1.2.12",
|
|
24
|
+
"@ai-sdk/openai": "^1.2.0",
|
|
25
|
+
"@mariozechner/pi-agent-core": "0.70.2",
|
|
26
|
+
"@mariozechner/pi-ai": "0.70.2",
|
|
27
|
+
"ai": "^4.3.2",
|
|
28
|
+
"chalk": "^5.3.0",
|
|
29
|
+
"commander": "^12.1.0",
|
|
30
|
+
"glob": "^11.0.0",
|
|
31
|
+
"ignore": "^6.0.2",
|
|
32
|
+
"ora": "^8.1.1",
|
|
33
|
+
"simple-git": "^3.27.0",
|
|
34
|
+
"smol-toml": "^1.6.1",
|
|
35
|
+
"zod": "^3.24.1",
|
|
36
|
+
"zod-to-json-schema": "^3.25.2"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@types/node": "^22.0.0",
|
|
40
|
+
"tsup": "^8.3.6",
|
|
41
|
+
"typescript": "^5.7.0",
|
|
42
|
+
"vitest": "^2.1.9"
|
|
43
|
+
},
|
|
44
|
+
"engines": {
|
|
45
|
+
"node": ">=20.0.0"
|
|
46
|
+
},
|
|
47
|
+
"license": "Apache-2.0",
|
|
48
|
+
"author": "Driftrail <hello@driftrail.com>",
|
|
49
|
+
"repository": {
|
|
50
|
+
"type": "git",
|
|
51
|
+
"url": "git+https://github.com/driftrail/notch-cli.git"
|
|
52
|
+
},
|
|
53
|
+
"keywords": [
|
|
54
|
+
"ai",
|
|
55
|
+
"coding",
|
|
56
|
+
"cli",
|
|
57
|
+
"notch",
|
|
58
|
+
"driftrail"
|
|
59
|
+
]
|
|
60
|
+
}
|