supipowers 0.7.0 → 0.7.1
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/bin/install.mjs +42 -33
- package/package.json +1 -1
- package/src/context-mode/hooks.ts +4 -2
- package/src/context-mode/routing.ts +22 -0
package/bin/install.mjs
CHANGED
|
@@ -83,6 +83,11 @@ function isInstalled(binary) {
|
|
|
83
83
|
return result.status === 0;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
+
// ── CLI Flags ────────────────────────────────────────────────
|
|
87
|
+
|
|
88
|
+
const args = process.argv.slice(2);
|
|
89
|
+
const skipLsp = args.includes("--skip-lsp");
|
|
90
|
+
|
|
86
91
|
// ── Main ─────────────────────────────────────────────────────
|
|
87
92
|
|
|
88
93
|
async function main() {
|
|
@@ -191,41 +196,45 @@ async function main() {
|
|
|
191
196
|
}
|
|
192
197
|
}
|
|
193
198
|
|
|
194
|
-
// ── Step 3: LSP setup (optional)
|
|
195
|
-
|
|
196
|
-
const lspSpinner = spinner();
|
|
197
|
-
lspSpinner.start("Checking installed LSP servers...");
|
|
198
|
-
const lspOptions = LSP_SERVERS.map((srv) => {
|
|
199
|
-
const installed = isInstalled(srv.server);
|
|
200
|
-
return {
|
|
201
|
-
value: srv,
|
|
202
|
-
label: srv.language,
|
|
203
|
-
hint: installed ? `${srv.server} (installed)` : srv.server,
|
|
204
|
-
};
|
|
205
|
-
});
|
|
206
|
-
const installedCount = lspOptions.filter((o) => o.hint.includes("(installed)")).length;
|
|
207
|
-
lspSpinner.stop(`Found ${installedCount}/${LSP_SERVERS.length} LSP servers installed`);
|
|
199
|
+
// ── Step 3: LSP setup (optional, skipped with --skip-lsp) ──
|
|
208
200
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
201
|
+
if (skipLsp) {
|
|
202
|
+
note("LSP setup skipped (--skip-lsp)", "LSP");
|
|
203
|
+
} else {
|
|
204
|
+
const lspSpinner = spinner();
|
|
205
|
+
lspSpinner.start("Checking installed LSP servers...");
|
|
206
|
+
const lspOptions = LSP_SERVERS.map((srv) => {
|
|
207
|
+
const installed = isInstalled(srv.server);
|
|
208
|
+
return {
|
|
209
|
+
value: srv,
|
|
210
|
+
label: srv.language,
|
|
211
|
+
hint: installed ? `${srv.server} (installed)` : srv.server,
|
|
212
|
+
};
|
|
213
|
+
});
|
|
214
|
+
const installedCount = lspOptions.filter((o) => o.hint.includes("(installed)")).length;
|
|
215
|
+
lspSpinner.stop(`Found ${installedCount}/${LSP_SERVERS.length} LSP servers installed`);
|
|
214
216
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
ls.
|
|
217
|
+
const selected = await multiselect({
|
|
218
|
+
message: "Install LSP servers for better code intelligence?",
|
|
219
|
+
options: lspOptions,
|
|
220
|
+
required: false,
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
if (!isCancel(selected) && selected.length > 0) {
|
|
224
|
+
for (const srv of selected) {
|
|
225
|
+
if (isInstalled(srv.server)) {
|
|
226
|
+
note(`${srv.server} is already installed, skipping.`, srv.language);
|
|
227
|
+
continue;
|
|
228
|
+
}
|
|
229
|
+
const ls = spinner();
|
|
230
|
+
ls.start(`Installing ${srv.server}...`);
|
|
231
|
+
const [cmd, ...installArgs] = srv.installCmd.split(" ");
|
|
232
|
+
const r = run(cmd, installArgs);
|
|
233
|
+
if (r.status !== 0) {
|
|
234
|
+
ls.stop(`Failed to install ${srv.server} — you can install manually: ${srv.installCmd}`);
|
|
235
|
+
} else {
|
|
236
|
+
ls.stop(`${srv.server} installed`);
|
|
237
|
+
}
|
|
229
238
|
}
|
|
230
239
|
}
|
|
231
240
|
}
|
package/package.json
CHANGED
|
@@ -67,9 +67,11 @@ export function registerContextModeHooks(pi: ExtensionAPI, config: SupipowersCon
|
|
|
67
67
|
|
|
68
68
|
// Phase 1: Tool routing — block native tools and redirect to ctx_* equivalents
|
|
69
69
|
pi.on("tool_call", (event) => {
|
|
70
|
-
|
|
70
|
+
// Always re-detect: MCP tools may load after extension init
|
|
71
|
+
const status = detectContextMode(pi.getActiveTools());
|
|
72
|
+
cachedStatus = status;
|
|
71
73
|
|
|
72
|
-
return routeToolCall(event.toolName, event.input as any,
|
|
74
|
+
return routeToolCall(event.toolName, event.input as any, status, {
|
|
73
75
|
enforceRouting: config.contextMode.enforceRouting,
|
|
74
76
|
blockHttpCommands: config.contextMode.blockHttpCommands,
|
|
75
77
|
});
|
|
@@ -73,6 +73,28 @@ export function routeToolCall(
|
|
|
73
73
|
};
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
+
// Find/Glob → block, redirect to ctx_execute or ctx_batch_execute
|
|
77
|
+
if (options.enforceRouting && toolName === "find") {
|
|
78
|
+
if (!status.tools.ctxExecute) return undefined;
|
|
79
|
+
return {
|
|
80
|
+
block: true,
|
|
81
|
+
reason:
|
|
82
|
+
'Use ctx_execute(language: "shell", code: "find ...") or ctx_batch_execute instead of Find/Glob. ' +
|
|
83
|
+
"Results are indexed and compressed to save context window.",
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Fetch/WebFetch → block, redirect to ctx_fetch_and_index
|
|
88
|
+
if (toolName === "fetch" || toolName === "web_fetch") {
|
|
89
|
+
if (!status.tools.ctxFetchAndIndex) return undefined;
|
|
90
|
+
return {
|
|
91
|
+
block: true,
|
|
92
|
+
reason:
|
|
93
|
+
"Use ctx_fetch_and_index instead of Fetch/WebFetch. " +
|
|
94
|
+
"It fetches the URL, indexes the content, and returns a compressed summary.",
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
|
|
76
98
|
// Read (full-file, no limit/offset) → block, redirect to ctx_execute_file
|
|
77
99
|
if (options.enforceRouting && toolName === "read") {
|
|
78
100
|
if (!status.tools.ctxExecuteFile) return undefined;
|