supipowers 0.7.7 → 0.7.8
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 +5 -34
- package/package.json +1 -1
package/bin/ctx-mode-wrapper.mjs
CHANGED
|
@@ -10,10 +10,9 @@
|
|
|
10
10
|
// rules since that's what OMP actually loads as system prompt.
|
|
11
11
|
|
|
12
12
|
import { resolve, join, dirname } from "node:path";
|
|
13
|
-
import { readFileSync, writeFileSync, existsSync, mkdirSync
|
|
13
|
+
import { readFileSync, writeFileSync, existsSync, mkdirSync } from "node:fs";
|
|
14
14
|
import { fileURLToPath } from "node:url";
|
|
15
15
|
import { homedir } from "node:os";
|
|
16
|
-
import os from "node:os";
|
|
17
16
|
|
|
18
17
|
const __wrapperDir = dirname(fileURLToPath(import.meta.url));
|
|
19
18
|
|
|
@@ -21,38 +20,10 @@ const __wrapperDir = dirname(fileURLToPath(import.meta.url));
|
|
|
21
20
|
const projectDir = resolve(process.cwd());
|
|
22
21
|
process.env.CLAUDE_PROJECT_DIR = projectDir;
|
|
23
22
|
|
|
24
|
-
//
|
|
25
|
-
//
|
|
26
|
-
//
|
|
27
|
-
//
|
|
28
|
-
// content persists across sessions (context-mode creates per-PID filenames).
|
|
29
|
-
const ctxDbDir = join(projectDir, ".omp", "context-mode");
|
|
30
|
-
if (!existsSync(ctxDbDir)) mkdirSync(ctxDbDir, { recursive: true });
|
|
31
|
-
|
|
32
|
-
// Find the most recent existing DB and copy it for the new session
|
|
33
|
-
const currentDbName = `context-mode-${process.pid}.db`;
|
|
34
|
-
try {
|
|
35
|
-
const existing = readdirSync(ctxDbDir)
|
|
36
|
-
.filter(f => f.match(/^context-mode-\d+\.db$/) && f !== currentDbName);
|
|
37
|
-
if (existing.length > 0) {
|
|
38
|
-
// Pick the newest by mtime
|
|
39
|
-
const newest = existing
|
|
40
|
-
.map(f => ({ name: f, mtime: statSync(join(ctxDbDir, f)).mtimeMs }))
|
|
41
|
-
.sort((a, b) => b.mtime - a.mtime)[0];
|
|
42
|
-
if (newest) {
|
|
43
|
-
copyFileSync(join(ctxDbDir, newest.name), join(ctxDbDir, currentDbName));
|
|
44
|
-
// Also copy WAL/SHM if they exist
|
|
45
|
-
for (const suffix of ["-wal", "-shm"]) {
|
|
46
|
-
const src = join(ctxDbDir, newest.name + suffix);
|
|
47
|
-
if (existsSync(src)) {
|
|
48
|
-
copyFileSync(src, join(ctxDbDir, currentDbName + suffix));
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
} catch { /* best effort */ }
|
|
54
|
-
|
|
55
|
-
os.tmpdir = () => ctxDbDir;
|
|
23
|
+
// Note: context-mode uses per-PID ephemeral FTS5 databases that are cleaned
|
|
24
|
+
// up on process exit. Within a session, indexed content persists and ctx_search
|
|
25
|
+
// can query it. Across sessions, content must be re-indexed.
|
|
26
|
+
// The SKILL.md routing rules emphasize using ctx_search for follow-ups.
|
|
56
27
|
|
|
57
28
|
// Resolve start.mjs path from the first CLI argument
|
|
58
29
|
const startMjs = process.argv[2];
|