supipowers 0.7.5 → 0.7.6

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.
@@ -3,8 +3,18 @@
3
3
  // OMP launches MCP servers with cwd set to the project directory, but
4
4
  // context-mode's start.mjs immediately does process.chdir(__dirname),
5
5
  // losing the project path. This wrapper captures cwd first.
6
+ //
7
+ // Setting CLAUDE_PROJECT_DIR causes start.mjs to also write a CLAUDE.md
8
+ // in the project root. This is harmless (OMP doesn't read it) but the
9
+ // user should gitignore it. We also write .omp/SYSTEM.md with routing
10
+ // rules since that's what OMP actually loads as system prompt.
6
11
 
7
- import { resolve } from "node:path";
12
+ import { resolve, join, dirname } from "node:path";
13
+ import { readFileSync, writeFileSync, existsSync, mkdirSync } from "node:fs";
14
+ import { fileURLToPath } from "node:url";
15
+ import { homedir } from "node:os";
16
+
17
+ const __wrapperDir = dirname(fileURLToPath(import.meta.url));
8
18
 
9
19
  // Capture the real project directory BEFORE start.mjs clobbers it
10
20
  const projectDir = resolve(process.cwd());
@@ -17,5 +27,35 @@ if (!startMjs) {
17
27
  process.exit(1);
18
28
  }
19
29
 
20
- // Dynamic import to run start.mjs
30
+ // Write .omp/SYSTEM.md with routing rules (idempotent — only if marker absent)
31
+ const ROUTING_MARKER = "# context-mode — MANDATORY routing rules";
32
+ try {
33
+ // Find SKILL.md from multiple possible locations
34
+ const skillCandidates = [
35
+ join(homedir(), ".omp", "agent", "skills", "context-mode", "SKILL.md"),
36
+ join(__wrapperDir, "..", "skills", "context-mode", "SKILL.md"),
37
+ ];
38
+ let skillContent = null;
39
+ for (const candidate of skillCandidates) {
40
+ try { skillContent = readFileSync(candidate, "utf-8"); break; } catch { /* next */ }
41
+ }
42
+
43
+ if (skillContent && skillContent.includes(ROUTING_MARKER)) {
44
+ const ompDir = join(projectDir, ".omp");
45
+ const systemMdPath = join(ompDir, "SYSTEM.md");
46
+
47
+ if (!existsSync(ompDir)) mkdirSync(ompDir, { recursive: true });
48
+
49
+ if (!existsSync(systemMdPath)) {
50
+ writeFileSync(systemMdPath, skillContent);
51
+ } else {
52
+ const existing = readFileSync(systemMdPath, "utf-8");
53
+ if (!existing.includes(ROUTING_MARKER)) {
54
+ writeFileSync(systemMdPath, existing.trimEnd() + "\n\n" + skillContent);
55
+ }
56
+ }
57
+ }
58
+ } catch { /* best effort — don't block server startup */ }
59
+
60
+ // Dynamic import to run start.mjs (server starts here)
21
61
  await import(startMjs);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "supipowers",
3
- "version": "0.7.5",
3
+ "version": "0.7.6",
4
4
  "description": "OMP-native workflow extension inspired by supipowers.",
5
5
  "type": "module",
6
6
  "scripts": {