@damian87/omp 0.19.0 → 0.20.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/README.md +3 -0
- package/dist/src/cli.js +113 -11
- package/dist/src/cli.js.map +1 -1
- package/dist/src/commands/models.d.ts +21 -0
- package/dist/src/commands/models.js +80 -0
- package/dist/src/commands/models.js.map +1 -0
- package/dist/src/commands/registry.js +2 -1
- package/dist/src/commands/registry.js.map +1 -1
- package/dist/src/copilot/doctor.d.ts +13 -0
- package/dist/src/copilot/doctor.js +43 -0
- package/dist/src/copilot/doctor.js.map +1 -1
- package/dist/src/copilot/models.d.ts +49 -0
- package/dist/src/copilot/models.js +67 -0
- package/dist/src/copilot/models.js.map +1 -0
- package/dist/src/copilot/paths.d.ts +3 -0
- package/dist/src/copilot/paths.js +8 -2
- package/dist/src/copilot/paths.js.map +1 -1
- package/dist/src/copilot/setup.d.ts +16 -1
- package/dist/src/copilot/setup.js +109 -6
- package/dist/src/copilot/setup.js.map +1 -1
- package/dist/src/council/engine.js +1 -5
- package/dist/src/council/engine.js.map +1 -1
- package/dist/src/council/persona.d.ts +14 -0
- package/dist/src/council/persona.js +45 -0
- package/dist/src/council/persona.js.map +1 -0
- package/dist/src/council/types.d.ts +8 -0
- package/dist/src/council/types.js +10 -1
- package/dist/src/council/types.js.map +1 -1
- package/dist/src/memory-review/config.d.ts +7 -0
- package/dist/src/memory-review/config.js +29 -0
- package/dist/src/memory-review/config.js.map +1 -1
- package/dist/src/memory-review/enable.d.ts +25 -0
- package/dist/src/memory-review/enable.js +106 -0
- package/dist/src/memory-review/enable.js.map +1 -0
- package/dist/src/memory-review/index.js +10 -0
- package/dist/src/memory-review/index.js.map +1 -1
- package/package.json +1 -1
- package/plugin.json +1 -1
- package/scripts/lib/memory-review-trigger.mjs +18 -8
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { spawn as nodeSpawn } from "node:child_process";
|
|
2
2
|
import { existsSync, readFileSync } from "node:fs";
|
|
3
|
+
import { homedir } from "node:os";
|
|
3
4
|
import { fileURLToPath } from "node:url";
|
|
4
5
|
import { dirname, join } from "node:path";
|
|
5
6
|
import { ompRoot } from "./omp-root.mjs";
|
|
@@ -9,20 +10,29 @@ import { ompRoot } from "./omp-root.mjs";
|
|
|
9
10
|
// downstream claim guard de-dupes against the wrapper fallback. Fail-open:
|
|
10
11
|
// any error means "don't trigger", never throw into the hook.
|
|
11
12
|
|
|
12
|
-
function
|
|
13
|
-
const env = process.env.OMP_MEMORY_MODE;
|
|
14
|
-
if (env === "on") return "on";
|
|
15
|
-
if (env === "off") return "off";
|
|
13
|
+
function readModeFrom(p) {
|
|
16
14
|
try {
|
|
17
|
-
|
|
18
|
-
if (!existsSync(p)) return "off";
|
|
15
|
+
if (!existsSync(p)) return undefined;
|
|
19
16
|
const raw = JSON.parse(readFileSync(p, "utf8"));
|
|
20
|
-
return raw && raw.memoryMode === "on"
|
|
17
|
+
return raw && (raw.memoryMode === "on" || raw.memoryMode === "off") ? raw.memoryMode : undefined;
|
|
21
18
|
} catch {
|
|
22
|
-
return
|
|
19
|
+
return undefined;
|
|
23
20
|
}
|
|
24
21
|
}
|
|
25
22
|
|
|
23
|
+
// Precedence mirrors readMemoryConfig (TS): OMP_MEMORY_MODE env > project
|
|
24
|
+
// .omp/config.json > GLOBAL ~/.omp/config.json. The global fallback is essential
|
|
25
|
+
// — `omp config set memory-mode on` writes GLOBAL, so without it the hook would
|
|
26
|
+
// never trigger for a globally-enabled (but project-unset) memory mode.
|
|
27
|
+
function readMemoryMode(cwd) {
|
|
28
|
+
const env = process.env.OMP_MEMORY_MODE;
|
|
29
|
+
if (env === "on" || env === "off") return env;
|
|
30
|
+
const projectMode = readModeFrom(join(ompRoot(cwd), ".omp", "config.json"));
|
|
31
|
+
if (projectMode) return projectMode;
|
|
32
|
+
const home = process.env.OMP_HOME_OVERRIDE || homedir();
|
|
33
|
+
return readModeFrom(join(home, ".omp", "config.json")) ?? "off";
|
|
34
|
+
}
|
|
35
|
+
|
|
26
36
|
function defaultDistPath() {
|
|
27
37
|
// scripts/lib/ -> packageRoot/dist/src/cli.js (present in the npm package and
|
|
28
38
|
// dev builds, but NOT in a plugin installed from GitHub — dist is gitignored).
|