supipowers 0.7.3 → 0.7.5
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/ctx-mode-wrapper.mjs +21 -0
- package/bin/install.mjs +6 -2
- package/package.json +1 -1
- package/src/context-mode/hooks.ts +3 -5
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Wrapper for context-mode MCP server that preserves the project directory.
|
|
3
|
+
// OMP launches MCP servers with cwd set to the project directory, but
|
|
4
|
+
// context-mode's start.mjs immediately does process.chdir(__dirname),
|
|
5
|
+
// losing the project path. This wrapper captures cwd first.
|
|
6
|
+
|
|
7
|
+
import { resolve } from "node:path";
|
|
8
|
+
|
|
9
|
+
// Capture the real project directory BEFORE start.mjs clobbers it
|
|
10
|
+
const projectDir = resolve(process.cwd());
|
|
11
|
+
process.env.CLAUDE_PROJECT_DIR = projectDir;
|
|
12
|
+
|
|
13
|
+
// Resolve start.mjs path from the first CLI argument
|
|
14
|
+
const startMjs = process.argv[2];
|
|
15
|
+
if (!startMjs) {
|
|
16
|
+
process.stderr.write("ctx-mode-wrapper: missing start.mjs path argument\n");
|
|
17
|
+
process.exit(1);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Dynamic import to run start.mjs
|
|
21
|
+
await import(startMjs);
|
package/bin/install.mjs
CHANGED
|
@@ -170,9 +170,10 @@ async function main() {
|
|
|
170
170
|
rmSync(extDir, { recursive: true });
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
-
// Copy extension (src/ + package.json) → ~/.omp/agent/extensions/supipowers/
|
|
173
|
+
// Copy extension (src/ + bin/ + package.json) → ~/.omp/agent/extensions/supipowers/
|
|
174
174
|
mkdirSync(extDir, { recursive: true });
|
|
175
175
|
cpSync(join(packageRoot, "src"), join(extDir, "src"), { recursive: true });
|
|
176
|
+
cpSync(join(packageRoot, "bin"), join(extDir, "bin"), { recursive: true });
|
|
176
177
|
cpSync(join(packageRoot, "package.json"), join(extDir, "package.json"));
|
|
177
178
|
|
|
178
179
|
// Copy skills → ~/.omp/agent/skills/<skillname>/SKILL.md
|
|
@@ -233,9 +234,12 @@ async function main() {
|
|
|
233
234
|
}
|
|
234
235
|
|
|
235
236
|
const startMjs = join(ctxInstallPath, "start.mjs");
|
|
237
|
+
// Use our wrapper script that captures cwd as CLAUDE_PROJECT_DIR
|
|
238
|
+
// before context-mode's start.mjs clobbers it with process.chdir(__dirname)
|
|
239
|
+
const wrapperMjs = join(extDir, "bin", "ctx-mode-wrapper.mjs");
|
|
236
240
|
mcpConfig.mcpServers["context-mode"] = {
|
|
237
241
|
command: "node",
|
|
238
|
-
args: [startMjs],
|
|
242
|
+
args: [wrapperMjs, startMjs],
|
|
239
243
|
};
|
|
240
244
|
|
|
241
245
|
const { writeFileSync: writeFs } = await import("node:fs");
|
package/package.json
CHANGED
|
@@ -92,11 +92,9 @@ export function registerContextModeHooks(pi: ExtensionAPI, config: SupipowersCon
|
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
-
// Phase 1: routing instructions
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
cachedStatus = detectContextMode(pi.getActiveTools());
|
|
99
|
-
if (!cachedStatus.available) return;
|
|
95
|
+
// Phase 1: routing instructions — always inject when enforceRouting is on,
|
|
96
|
+
// regardless of MCP tool detection (tools may load after this hook fires)
|
|
97
|
+
if (!config.contextMode.routingInstructions && !config.contextMode.enforceRouting) return;
|
|
100
98
|
|
|
101
99
|
const skill = loadRoutingSkill();
|
|
102
100
|
if (!skill) return;
|