neurastream 0.3.21 → 0.3.22
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 +1 -0
- package/package.json +1 -1
- package/src/adapters/omp/doctor.ts +6 -0
- package/src/cli/dispatch.ts +7 -0
- package/src/cli/reuse.ts +109 -0
- package/src/cli/setup.ts +25 -1
- package/src/core/config.ts +29 -0
- package/src/core/guards/plan-edit.ts +200 -8
- package/src/core/guards/spawn.ts +13 -3
- package/src/core/queue/lib.ts +58 -4
- package/src/core/reuse-map.ts +742 -0
- package/src/core/setup-detect.ts +8 -3
- package/src/core/uninstall.ts +14 -0
- package/templates/config.yml +7 -0
package/src/core/setup-detect.ts
CHANGED
|
@@ -53,14 +53,19 @@ export interface SetupFacts {
|
|
|
53
53
|
current: Config | null;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
/** Direct children of dir that are git repositories (`.git` file = worktree), unsorted (plan 20261122_1828_reuse_map P3: the one walk `reuse on` candidates reuse). */
|
|
57
|
+
export function repoDirs(dir: string): string[] {
|
|
57
58
|
try {
|
|
58
|
-
return readdirSync(dir, { withFileTypes: true }).
|
|
59
|
+
return readdirSync(dir, { withFileTypes: true }).filter(c => c.isDirectory() && existsSync(join(dir, c.name, ".git"))).map(c => join(dir, c.name));
|
|
59
60
|
} catch {
|
|
60
|
-
return
|
|
61
|
+
return [];
|
|
61
62
|
}
|
|
62
63
|
}
|
|
63
64
|
|
|
65
|
+
function hasRepoBelow(dir: string): boolean {
|
|
66
|
+
return repoDirs(dir).length > 0;
|
|
67
|
+
}
|
|
68
|
+
|
|
64
69
|
function workRoots(home: string): string[] {
|
|
65
70
|
return readdirSync(home, { withFileTypes: true })
|
|
66
71
|
.filter(d => d.isDirectory() && !d.name.startsWith("."))
|
package/src/core/uninstall.ts
CHANGED
|
@@ -12,6 +12,7 @@ import { stripBlock } from "./agents-md.ts";
|
|
|
12
12
|
import { configFile, loadConfig, type Config } from "./config.ts";
|
|
13
13
|
import { printText } from "./help.ts";
|
|
14
14
|
import { indexLockPath } from "./queue/lib.ts";
|
|
15
|
+
import { reuseOff } from "./reuse-map.ts";
|
|
15
16
|
|
|
16
17
|
const HERE = dirname(fileURLToPath(import.meta.url));
|
|
17
18
|
const PACKAGE_ROOT = resolve(HERE, "../..");
|
|
@@ -248,6 +249,19 @@ export function runUninstall(args: string[]): number {
|
|
|
248
249
|
printText("dry run: re-run with --yes to remove these");
|
|
249
250
|
return 1;
|
|
250
251
|
}
|
|
252
|
+
// Reuse map (plan 20261122_1828_reuse_map P3): uninstalling with the map on runs the off
|
|
253
|
+
// routine first (exclude lines, config); --purge passes through, so graphify-out/ goes and
|
|
254
|
+
// graphifyy is uninstalled too. A failed off stops the uninstall: the gate must not stay on
|
|
255
|
+
// while its config is being removed.
|
|
256
|
+
if (cfg.reuse_map.enabled) {
|
|
257
|
+
const off = reuseOff(args.filter((a) => a === "--purge"), { home: homedir(), env: process.env, terminal: false, ask: () => "n" });
|
|
258
|
+
for (const l of off.out) printText(l);
|
|
259
|
+
if (off.code !== 0) {
|
|
260
|
+
for (const l of off.err) printText(l);
|
|
261
|
+
printText("uninstall stopped: the reuse map could not be turned off");
|
|
262
|
+
return 1;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
251
265
|
applyUninstall(cfg, plan);
|
|
252
266
|
printText(`uninstalled ${plan.targets.length} target${plan.targets.length === 1 ? "" : "s"}${purge ? " (purged)" : ""}`);
|
|
253
267
|
return 0;
|
package/templates/config.yml
CHANGED
|
@@ -240,6 +240,13 @@ tuning: # the tuner steps existing rules down and back up (
|
|
|
240
240
|
guards: false # guard ids are scored and stepped only when this is true
|
|
241
241
|
keep_off: [] # rule ids probation never raises
|
|
242
242
|
|
|
243
|
+
reuse_map: # the opt-in Graphify code map gating new plans (src/core/reuse-map.ts)
|
|
244
|
+
enabled: false # off: no graphify/uv/pipx process, no graphify-out/ read, nothing changes
|
|
245
|
+
tool: graphify # the mapping tool; only "graphify" (PyPI: graphifyy) is implemented
|
|
246
|
+
min_cited: 2 # distinct matched files a plan's `## Reuse` map line must have cited
|
|
247
|
+
repos: [] # repos `neurastream reuse on` mapped; set only by `reuse on`/`reuse off`
|
|
248
|
+
exclude: [] # globs `graphify extract` skips in every mapped repo
|
|
249
|
+
|
|
243
250
|
machine:
|
|
244
251
|
load_over_cores: 4 # load above the core count that draws a warning (used when load_max is 0)
|
|
245
252
|
load_max: 0 # load ceiling; 0 = core count + load_over_cores
|