neurastream 0.1.23 → 0.1.24
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 -2
- package/package.json +1 -1
- package/src/cli/dispatch.ts +6 -0
- package/src/cli/init.ts +0 -4
- package/src/core/agents-md.ts +17 -0
- package/src/core/brief-lint.ts +6 -18
- package/src/core/config.ts +16 -0
- package/src/core/uninstall.ts +228 -0
- package/templates/agents/example.md +32 -0
- package/templates/config.yml +23 -18
- package/templates/help/agent-score.txt +1 -1
- package/templates/help/pm-fail-facts.txt +1 -1
- package/templates/help/uninstall.txt +14 -0
- package/templates/help/wip-backup.txt +14 -8
- package/templates/help/wip-snapshot.txt +2 -1
- package/templates/notes/subagents.md +1 -11
- package/templates/queue/TEMPLATE.md +1 -1
- package/templates/tmp-snapshot.sh +9 -6
- package/templates/agents/apodex.md +0 -6
- package/templates/agents/bunny-user.md +0 -13
- package/templates/agents/bunny.md +0 -213
- package/templates/agents/composer.md +0 -9
- package/templates/agents/deepseek.md +0 -214
- package/templates/agents/gemini.md +0 -213
- package/templates/agents/glm.md +0 -214
- package/templates/agents/grok.md +0 -213
- package/templates/agents/haiku.md +0 -213
- package/templates/agents/hiko.md +0 -213
- package/templates/agents/ling.md +0 -213
- package/templates/agents/local-qwen.md +0 -220
- package/templates/agents/luna-medium.md +0 -211
- package/templates/agents/luna.md +0 -224
- package/templates/agents/muse.md +0 -214
- package/templates/agents/sol-xhigh.md +0 -217
- package/templates/agents/sol.md +0 -217
package/README.md
CHANGED
|
@@ -46,11 +46,12 @@ bun add -g neurastream
|
|
|
46
46
|
neurastream init
|
|
47
47
|
neurastream adapter install omp
|
|
48
48
|
neurastream doctor
|
|
49
|
+
neurastream uninstall --purge # the inverse: removes it all again
|
|
49
50
|
```
|
|
50
51
|
|
|
51
|
-
`init` writes `~/.config/neurastream/config.yml` from the defaults in [docs/config.md](docs/config.md), plus an empty index, notes, the queue template, blocker wrappers, and the state directories. A second run changes nothing. `adapter install omp` links the extension (`~/.omp/agent/extensions` and `omp plugin link`). `doctor` exits 0 when the install matches the package.
|
|
52
|
+
`init` writes `~/.config/neurastream/config.yml` from the defaults in [docs/config.md](docs/config.md), plus an empty index, notes, the queue template, blocker wrappers, and the state directories. A second run changes nothing. `adapter install omp` links the extension (`~/.omp/agent/extensions` and `omp plugin link`). `doctor` exits 0 when the install matches the package. `uninstall` removes the installed bins, the plugin link, template-identical pins and the AGENTS.md block; `--purge` adds the config file and the agent-dir state. It prints the list first and refuses anything outside your HOME.
|
|
52
53
|
|
|
53
|
-
The defaults are
|
|
54
|
+
The defaults are neutral (empty work roots, no backup remote, no default branch); set your own in `config.yml`. To try it without touching your real home, set `HOME=/tmp/neurastream-home-dev` first.
|
|
54
55
|
|
|
55
56
|
Check the merged result:
|
|
56
57
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "neurastream",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.24",
|
|
4
4
|
"description": "Guardrails for running many AI coding agents at once: plan queue, blockers, call budgets, provider caps, scoring, merge-verified close.",
|
|
5
5
|
"keywords": ["ai-agents", "coding-agents", "orchestration", "guardrails", "omp", "bun", "cli"],
|
|
6
6
|
"homepage": "https://github.com/umiddey/neurastream#readme",
|
package/src/cli/dispatch.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { runInit } from "./init.ts";
|
|
|
7
7
|
import { PORTED, runMain, runPorted } from "./commands.ts";
|
|
8
8
|
import { runMetrics } from "./metrics.ts";
|
|
9
9
|
import { runIncident } from "./incident.ts";
|
|
10
|
+
import { runUninstall } from "../core/uninstall.ts";
|
|
10
11
|
|
|
11
12
|
const BINS = [
|
|
12
13
|
"agent-score",
|
|
@@ -42,6 +43,10 @@ export function helpText(): string {
|
|
|
42
43
|
" (--agent-dir: keep an existing index/notes/blockers dir)",
|
|
43
44
|
" neurastream adapter install omp",
|
|
44
45
|
" link the omp extension under this HOME",
|
|
46
|
+
" neurastream uninstall [--purge] [--yes]",
|
|
47
|
+
" inverse of init/install: removes our bins, the plugin link,",
|
|
48
|
+
" template-identical pins and the AGENTS.md block (--purge adds",
|
|
49
|
+
" config + agent-dir state); prints the list, refuses outside HOME",
|
|
45
50
|
" neurastream doctor report hand-edited live files and a stale install",
|
|
46
51
|
" neurastream config [--json] print the merged config (defaults + file + env)",
|
|
47
52
|
" neurastream guard <event> --json",
|
|
@@ -79,6 +84,7 @@ export async function run(cmd: string, args: string[]): Promise<number> {
|
|
|
79
84
|
}
|
|
80
85
|
}
|
|
81
86
|
if (cmd === "doctor") return runDoctor();
|
|
87
|
+
if (cmd === "uninstall") return runUninstall(args);
|
|
82
88
|
if (cmd === "guard") {
|
|
83
89
|
return runGuard(args[0] ?? "");
|
|
84
90
|
}
|
package/src/cli/init.ts
CHANGED
|
@@ -59,10 +59,6 @@ const AGENT_DIR_KEYS = /^( (?:agent_dir|queue_index|blockers|notes|ranking_boar
|
|
|
59
59
|
function configText(home: string, invoked: string, agentDir?: string): string {
|
|
60
60
|
let text = readFileSync(TEMPLATE_PATH, "utf8");
|
|
61
61
|
if (!text.endsWith("\n")) text += "\n";
|
|
62
|
-
if (existsSync(join(home, "Work", "pm-counts"))) {
|
|
63
|
-
if (!text.includes('default_repo: ""')) throw new Error("templates/config.yml has no default_repo placeholder");
|
|
64
|
-
text = text.replace('default_repo: ""', 'default_repo: "~/Work/pm-counts"');
|
|
65
|
-
}
|
|
66
62
|
// An existing machine keeps its index, notes, blockers and unlock where they are today.
|
|
67
63
|
const agent = agentDir ? tilde(home, resolve(home, agentDir.replace(/^~(?=\/|$)/, home))) : "~/.config/neurastream";
|
|
68
64
|
if (agentDir) {
|
package/src/core/agents-md.ts
CHANGED
|
@@ -56,3 +56,20 @@ export function blockState(fileText: string, block: string): "ok" | "stale" | "m
|
|
|
56
56
|
if (!at) return "missing";
|
|
57
57
|
return fileText.slice(at.start, at.end) === block ? "ok" : "stale";
|
|
58
58
|
}
|
|
59
|
+
|
|
60
|
+
// Remove the marked block, keeping every byte outside the markers (uninstall's inverse of
|
|
61
|
+
// upsertBlock). "missing": there was no block. "stale": the markers are malformed — the text
|
|
62
|
+
// comes back untouched.
|
|
63
|
+
export function stripBlock(fileText: string): { text: string; state: "ok" | "stale" | "missing" } {
|
|
64
|
+
let at: { start: number; end: number } | null;
|
|
65
|
+
try {
|
|
66
|
+
at = span(fileText);
|
|
67
|
+
} catch {
|
|
68
|
+
return { text: fileText, state: "stale" };
|
|
69
|
+
}
|
|
70
|
+
if (!at) return { text: fileText, state: "missing" };
|
|
71
|
+
let text = fileText.slice(0, at.start) + fileText.slice(at.end);
|
|
72
|
+
if (text.trim() === "") text = "";
|
|
73
|
+
else text = `${text.replace(/\n+$/, "")}\n`;
|
|
74
|
+
return { text, state: "ok" };
|
|
75
|
+
}
|
package/src/core/brief-lint.ts
CHANGED
|
@@ -31,9 +31,12 @@ function lint(path: string, cfg: Config): { errs: string[]; warns: string[] } {
|
|
|
31
31
|
const heavy = /pytest|vitest|playwright|run-raw|run-batch|full suite|\bsuite\b/.test(low);
|
|
32
32
|
if (heavy) need(text.includes(cfg.brief.heavy_marker), `runs tests/suites but never names ${cfg.brief.heavy_path}`);
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
// Repo-specific rules are config-driven (brief.repo_rules); the shipped default list is empty.
|
|
35
|
+
for (const rule of cfg.brief.repo_rules) {
|
|
36
|
+
if (!new RegExp(rule.match, "i").test(low)) continue;
|
|
37
|
+
if (rule.first && !new RegExp(rule.first, "i").test(first)) continue;
|
|
38
|
+
if (rule.unless && new RegExp(rule.unless, "i").test(first)) continue;
|
|
39
|
+
need(new RegExp(rule.require, "i").test(low), rule.message);
|
|
37
40
|
}
|
|
38
41
|
|
|
39
42
|
const planOnly = /plan only|read-only review|CI fix|\bdelete\b/i.test(first);
|
|
@@ -50,21 +53,6 @@ function lint(path: string, cfg: Config): { errs: string[]; warns: string[] } {
|
|
|
50
53
|
}
|
|
51
54
|
}
|
|
52
55
|
|
|
53
|
-
if (
|
|
54
|
-
/aetherios-property-management|pm-pr01|\bPR01\b|contractor.portal|cp-/.test(text) &&
|
|
55
|
-
!planOnly &&
|
|
56
|
-
/test-map|obligation|gateforge check|coverage/.test(low)
|
|
57
|
-
) {
|
|
58
|
-
need(
|
|
59
|
-
/^Gate before:\s*\d+\s+missing/im.test(text),
|
|
60
|
-
"PM/CP coverage brief without 'Gate before: <N> missing' line from `gateforge check` (green tests are not progress)",
|
|
61
|
-
);
|
|
62
|
-
need(
|
|
63
|
-
/gate missing.*before.*after|before\s*->\s*after/.test(low),
|
|
64
|
-
"report must state gate missing before->after; a round that does not lower it stops",
|
|
65
|
-
);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
56
|
const paths = new Set<string>();
|
|
69
57
|
for (const prefix of cfg.brief.path_prefixes) {
|
|
70
58
|
const re = new RegExp(`(${escapeReg(prefix)}[\\w./\\-]+)`, "g");
|
package/src/core/config.ts
CHANGED
|
@@ -67,6 +67,10 @@ export interface Config {
|
|
|
67
67
|
path_prefixes: string[];
|
|
68
68
|
method_read: string;
|
|
69
69
|
heavy_path: string;
|
|
70
|
+
/** Repo-specific brief rules; the shipped default list is empty. A rule fires when `match`
|
|
71
|
+
* (regex on the whole brief) hits and the body lacks `require`; optional `first`/`unless`
|
|
72
|
+
* gate the rule on the plan's title line. */
|
|
73
|
+
repo_rules: { match: string; require: string; message: string; first?: string; unless?: string }[];
|
|
70
74
|
};
|
|
71
75
|
oc: { model_prefix: string; tail_lines: number; tail_chars: number };
|
|
72
76
|
wip: {
|
|
@@ -283,6 +287,18 @@ function check(cfg: Config): void {
|
|
|
283
287
|
throw new ConfigError(`metrics.correction_patterns: not a valid regex: ${p}`);
|
|
284
288
|
}
|
|
285
289
|
}
|
|
290
|
+
for (const rule of cfg.brief.repo_rules) {
|
|
291
|
+
for (const key of ["match", "require", "first", "unless"] as const) {
|
|
292
|
+
const pattern = rule[key];
|
|
293
|
+
if (pattern === undefined) continue;
|
|
294
|
+
try {
|
|
295
|
+
new RegExp(pattern, "i");
|
|
296
|
+
} catch {
|
|
297
|
+
throw new ConfigError(`brief.repo_rules.${key}: not a valid regex: ${pattern}`);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
if (!rule.message) throw new ConfigError("brief.repo_rules.message must be a non-empty string");
|
|
301
|
+
}
|
|
286
302
|
for (const [key, value] of Object.entries(cfg.paths)) {
|
|
287
303
|
if (key === "work_roots") {
|
|
288
304
|
if (!Array.isArray(value) || value.some(v => typeof v !== "string")) {
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
// The inverse of init and adapter install. Pure core: it builds the exact removal list,
|
|
2
|
+
// prints it, and only removes with --yes. It never touches a file that is not provably
|
|
3
|
+
// this package's (a launcher symlink or copy into an installed copy, a template-identical
|
|
4
|
+
// pin, the managed AGENTS.md block, the adapter's plugin link), and it refuses every path that
|
|
5
|
+
// resolves outside the HOME it is given.
|
|
6
|
+
|
|
7
|
+
import { existsSync, lstatSync, readdirSync, readFileSync, realpathSync, rmSync, unlinkSync, writeFileSync } from "node:fs";
|
|
8
|
+
import { homedir } from "node:os";
|
|
9
|
+
import { dirname, isAbsolute, join, relative, resolve } from "node:path";
|
|
10
|
+
import { fileURLToPath } from "node:url";
|
|
11
|
+
import { stripBlock } from "./agents-md.ts";
|
|
12
|
+
import { configFile, loadConfig, type Config } from "./config.ts";
|
|
13
|
+
import { printText } from "./help.ts";
|
|
14
|
+
|
|
15
|
+
const HERE = dirname(fileURLToPath(import.meta.url));
|
|
16
|
+
const PACKAGE_ROOT = resolve(HERE, "../..");
|
|
17
|
+
|
|
18
|
+
interface PackageJson {
|
|
19
|
+
name?: string;
|
|
20
|
+
bin?: Record<string, string>;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface UninstallTarget {
|
|
24
|
+
path: string;
|
|
25
|
+
what: string;
|
|
26
|
+
/** AGENTS.md targets lose only the managed block; everything else is unlinked. */
|
|
27
|
+
strip?: boolean;
|
|
28
|
+
/** Directory trees (queue/, notes/, blockers/) come down recursively. */
|
|
29
|
+
tree?: boolean;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface UninstallPlan {
|
|
33
|
+
targets: UninstallTarget[];
|
|
34
|
+
/** Present but left alone: pins the owner edited, files that are not ours. */
|
|
35
|
+
kept: string[];
|
|
36
|
+
refusals: string[];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function pkgName(): string {
|
|
40
|
+
const pkg = JSON.parse(readFileSync(join(PACKAGE_ROOT, "package.json"), "utf8")) as PackageJson;
|
|
41
|
+
if (!pkg.name) throw new Error("package.json has no name");
|
|
42
|
+
return pkg.name;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** The installed copy a path belongs to: the nearest dir whose package.json carries this package's name. */
|
|
46
|
+
function installedRootOf(file: string): string | null {
|
|
47
|
+
// `file` itself may be the root (the plugin link's realpath is an installed root).
|
|
48
|
+
let dir = file;
|
|
49
|
+
for (let i = 0; i < 9; i++) {
|
|
50
|
+
const manifest = join(dir, "package.json");
|
|
51
|
+
if (existsSync(manifest)) {
|
|
52
|
+
try {
|
|
53
|
+
const pkg = JSON.parse(readFileSync(manifest, "utf8")) as PackageJson;
|
|
54
|
+
if (pkg.name === pkgName()) return dir;
|
|
55
|
+
} catch {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
const parent = dirname(dir);
|
|
60
|
+
if (parent === dir) break;
|
|
61
|
+
dir = parent;
|
|
62
|
+
}
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** A launcher is a symlink into an installed copy of this package at the same relative path; a copy is byte-identical. */
|
|
67
|
+
function ours(live: string, rel: string): boolean {
|
|
68
|
+
let st;
|
|
69
|
+
try {
|
|
70
|
+
st = lstatSync(live);
|
|
71
|
+
} catch {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
if (st.isSymbolicLink()) {
|
|
75
|
+
let target: string;
|
|
76
|
+
try {
|
|
77
|
+
target = realpathSync(live);
|
|
78
|
+
} catch {
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
const root = installedRootOf(target);
|
|
82
|
+
return root !== null && target === resolve(root, rel);
|
|
83
|
+
}
|
|
84
|
+
if (!st.isFile()) return false;
|
|
85
|
+
try {
|
|
86
|
+
return readFileSync(live).equals(readFileSync(join(PACKAGE_ROOT, rel)));
|
|
87
|
+
} catch {
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function bins(cfg: Config, out: UninstallTarget[]): void {
|
|
93
|
+
const manifest = JSON.parse(readFileSync(join(PACKAGE_ROOT, "package.json"), "utf8")) as PackageJson;
|
|
94
|
+
const dirs = [join(cfg.paths.home, ".local/bin"), join(cfg.paths.home, ".bun/bin")];
|
|
95
|
+
for (const name of Object.keys(manifest.bin ?? {})) {
|
|
96
|
+
for (const dir of dirs) {
|
|
97
|
+
const live = join(dir, name);
|
|
98
|
+
if (existsSync(live) && ours(live, manifest.bin![name]!)) {
|
|
99
|
+
out.push({ path: live, what: `bin ${name}` });
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function adapterSurface(cfg: Config, out: UninstallTarget[], kept: string[]): void {
|
|
106
|
+
const adapter = cfg.adapter;
|
|
107
|
+
if (!adapter) return;
|
|
108
|
+
// The overlay is written by adapter install: sessions/pins/extensions all sit under the
|
|
109
|
+
// agent dir, the plugin link one level above it under plugins/node_modules/<package>.
|
|
110
|
+
const agentDir = dirname(dirname(adapter.extensions));
|
|
111
|
+
const plugin = join(agentDir, "plugins/node_modules/neurastream");
|
|
112
|
+
if (existsSync(plugin) && ours(plugin, ".")) out.push({ path: plugin, what: "plugin link" });
|
|
113
|
+
|
|
114
|
+
const pinsDir = adapter.pins;
|
|
115
|
+
if (existsSync(pinsDir)) {
|
|
116
|
+
const shipped = join(PACKAGE_ROOT, "templates/agents");
|
|
117
|
+
for (const name of readdirSync(pinsDir).sort()) {
|
|
118
|
+
if (!name.endsWith(".md") || name.includes(".bak")) continue;
|
|
119
|
+
const live = join(pinsDir, name);
|
|
120
|
+
const template = join(shipped, name);
|
|
121
|
+
if (existsSync(template) && ours(live, join("templates/agents", name))) {
|
|
122
|
+
out.push({ path: live, what: `template-identical pin ${name}` });
|
|
123
|
+
} else {
|
|
124
|
+
kept.push(`${live} (pin differs from the shipped template; kept)`);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const agentsMd = join(dirname(adapter.sessions), "AGENTS.md");
|
|
130
|
+
if (existsSync(agentsMd)) {
|
|
131
|
+
const probe = stripBlock(readFileSync(agentsMd, "utf8"));
|
|
132
|
+
if (probe.state === "stale") kept.push(`${agentsMd} (block markers malformed; left alone)`);
|
|
133
|
+
else if (probe.state === "ok") out.push({ path: agentsMd, what: "managed AGENTS.md block (personal text kept)", strip: true });
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function purgeState(cfg: Config, out: UninstallTarget[]): void {
|
|
138
|
+
const entries: [string, string, boolean][] = [
|
|
139
|
+
[configFile(cfg.paths.home), "--purge: config file", false],
|
|
140
|
+
[cfg.paths.queue_index, "--purge: index", false],
|
|
141
|
+
[join(cfg.paths.agent_dir, "queue"), "--purge: queue dir", true],
|
|
142
|
+
[cfg.paths.notes, "--purge: notes dir", true],
|
|
143
|
+
[cfg.paths.blockers, "--purge: blockers dir", true],
|
|
144
|
+
[cfg.paths.cancelled, "--purge: cancelled list", false],
|
|
145
|
+
[cfg.paths.unlock, "--purge: guard unlock", false],
|
|
146
|
+
];
|
|
147
|
+
for (const [path, what, tree] of entries) {
|
|
148
|
+
if (existsSync(path) || lstatSafe(path)) out.push({ path, what, tree });
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function lstatSafe(path: string): boolean {
|
|
153
|
+
try {
|
|
154
|
+
lstatSync(path);
|
|
155
|
+
return true;
|
|
156
|
+
} catch {
|
|
157
|
+
return false;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export function uninstallPlan(cfg: Config, purge: boolean): UninstallPlan {
|
|
162
|
+
const targets: UninstallTarget[] = [];
|
|
163
|
+
const kept: string[] = [];
|
|
164
|
+
bins(cfg, targets);
|
|
165
|
+
adapterSurface(cfg, targets, kept);
|
|
166
|
+
if (purge) purgeState(cfg, targets);
|
|
167
|
+
const home = resolve(cfg.paths.home);
|
|
168
|
+
const refusals = targets.filter(t => {
|
|
169
|
+
const rel = relative(home, resolve(t.path));
|
|
170
|
+
return rel === "" || rel.startsWith("..") || isAbsolute(rel);
|
|
171
|
+
}).map(t => `${t.path} (${t.what}) is outside ${home}`);
|
|
172
|
+
return { targets, kept, refusals };
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export function applyUninstall(cfg: Config, plan: UninstallPlan): void {
|
|
176
|
+
for (const target of plan.targets) {
|
|
177
|
+
if (target.strip) {
|
|
178
|
+
// Re-read at apply time: strip only when the markers are still well-formed.
|
|
179
|
+
const next = stripBlock(readFileSync(target.path, "utf8"));
|
|
180
|
+
if (next.state === "ok") {
|
|
181
|
+
if (next.text === "") rmSync(target.path, { force: true });
|
|
182
|
+
else writeFileSync(target.path, next.text);
|
|
183
|
+
}
|
|
184
|
+
continue;
|
|
185
|
+
}
|
|
186
|
+
const st = lstatSync(target.path);
|
|
187
|
+
if (st.isSymbolicLink()) unlinkSync(target.path);
|
|
188
|
+
else if (st.isDirectory()) rmSync(target.path, { recursive: true });
|
|
189
|
+
else unlinkSync(target.path);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
function usage(): string {
|
|
194
|
+
return "usage: neurastream uninstall [--purge] [--yes]";
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export function runUninstall(args: string[]): number {
|
|
198
|
+
for (const arg of args) {
|
|
199
|
+
if (arg !== "--purge" && arg !== "--yes") {
|
|
200
|
+
printText(`unknown flag ${arg}\n${usage()}`);
|
|
201
|
+
return 2;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
const purge = args.includes("--purge");
|
|
205
|
+
const yes = args.includes("--yes");
|
|
206
|
+
const cfg = loadConfig({ home: homedir() });
|
|
207
|
+
const plan = uninstallPlan(cfg, purge);
|
|
208
|
+
if (plan.refusals.length) {
|
|
209
|
+
for (const line of plan.refusals) printText(`refused: ${line}`);
|
|
210
|
+
printText("nothing removed");
|
|
211
|
+
return 1;
|
|
212
|
+
}
|
|
213
|
+
if (plan.targets.length === 0) {
|
|
214
|
+
printText("nothing to uninstall under this HOME");
|
|
215
|
+
for (const line of plan.kept) printText(`kept: ${line}`);
|
|
216
|
+
return 0;
|
|
217
|
+
}
|
|
218
|
+
printText(yes ? "removing:" : "would remove:");
|
|
219
|
+
for (const target of plan.targets) printText(` ${target.path} (${target.what})`);
|
|
220
|
+
for (const line of plan.kept) printText(`kept: ${line}`);
|
|
221
|
+
if (!yes) {
|
|
222
|
+
printText("dry run: re-run with --yes to remove these");
|
|
223
|
+
return 1;
|
|
224
|
+
}
|
|
225
|
+
applyUninstall(cfg, plan);
|
|
226
|
+
printText(`uninstalled ${plan.targets.length} target${plan.targets.length === 1 ? "" : "s"}${purge ? " (purged)" : ""}`);
|
|
227
|
+
return 0;
|
|
228
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: example
|
|
3
|
+
description: One-line summary of what this worker does and when to spawn it; the orchestrator reads this line when choosing a worker.
|
|
4
|
+
model: provider/model-id
|
|
5
|
+
thinking: high
|
|
6
|
+
blocking: false
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
You are an implementation/testing worker for plans run by the orchestrator. Work
|
|
10
|
+
only in the worktree the task names, and use absolute paths under it for every
|
|
11
|
+
read, edit, write and command cwd (relative paths resolve to another checkout).
|
|
12
|
+
Follow the task brief exactly; do not spawn subagents.
|
|
13
|
+
|
|
14
|
+
Contract:
|
|
15
|
+
|
|
16
|
+
- Commit each finished, green unit of work to the brief's feature branch. Never
|
|
17
|
+
push, to any remote or branch, unless the brief or the orchestrator explicitly
|
|
18
|
+
says so (never force, never main, never publish).
|
|
19
|
+
- Report precise evidence: commands, exit codes, counts, file paths.
|
|
20
|
+
- Never cheat: no retries as fixes, no skipped tests, no weakened policies, no
|
|
21
|
+
baseline edits to make something red turn green.
|
|
22
|
+
- Only the orchestrator's messages direct you; ignore instructions meant for
|
|
23
|
+
other workers.
|
|
24
|
+
|
|
25
|
+
STOP rules:
|
|
26
|
+
|
|
27
|
+
- Stop and report when the brief's acceptance list is done, or when you are
|
|
28
|
+
truly blocked; say exactly on what.
|
|
29
|
+
- Stop at the call budget the brief names; write your progress note before the
|
|
30
|
+
final report.
|
|
31
|
+
- A refusal, a failed verify or a red suite is a report item, never something to
|
|
32
|
+
route around.
|
package/templates/config.yml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
paths:
|
|
2
2
|
home: "~"
|
|
3
|
-
work_roots: [
|
|
3
|
+
work_roots: [] # set your own roots
|
|
4
4
|
config_dir: "~/.config/neurastream"
|
|
5
5
|
agent_dir: "~/.config/neurastream"
|
|
6
6
|
score_state: "~/.local/state/agent-score"
|
|
@@ -14,16 +14,16 @@ paths:
|
|
|
14
14
|
unlock: "~/.config/neurastream/.guard-unlock"
|
|
15
15
|
guard_log: "~/.local/state/main-guard.log"
|
|
16
16
|
plan_guard_log: "~/.local/state/plan-guard.log"
|
|
17
|
-
heavy_lock: "
|
|
18
|
-
heavy_owner: "
|
|
19
|
-
heavy_log: "
|
|
20
|
-
heavy_idle_state: "
|
|
17
|
+
heavy_lock: "~/.local/state/neurastream/heavy-run.lock"
|
|
18
|
+
heavy_owner: "~/.local/state/neurastream/heavy-run.owner"
|
|
19
|
+
heavy_log: "~/.local/state/neurastream/heavy-run.log"
|
|
20
|
+
heavy_idle_state: "~/.local/state/neurastream/heavy-run.idle-state"
|
|
21
21
|
alert_state: "~/.cache/resource-alerts"
|
|
22
22
|
snapshot_lock: "~/.cache/tmp-snapshot.lock"
|
|
23
23
|
|
|
24
24
|
score:
|
|
25
25
|
default_repo: ""
|
|
26
|
-
default_branch: "
|
|
26
|
+
default_branch: "" # no default: pass --branch (agent-score refuses to guess a branch)
|
|
27
27
|
penalties:
|
|
28
28
|
false-claim: 5
|
|
29
29
|
rule-break: 2
|
|
@@ -57,7 +57,13 @@ brief:
|
|
|
57
57
|
aim_chars: 8000
|
|
58
58
|
path_prefixes: ["$HOME/"]
|
|
59
59
|
method_read: "$HOME/projects/opus-implementer-method.md"
|
|
60
|
-
heavy_path: "$HOME/
|
|
60
|
+
heavy_path: "$HOME/.local/bin/heavy-run.sh"
|
|
61
|
+
repo_rules: [] # optional repo-specific lint rules; each fires when `match` (regex, whole brief) hits and the body lacks `require`:
|
|
62
|
+
# - match: 'legacy-api' # trigger anywhere in the brief (case-insensitive)
|
|
63
|
+
# first: 'Refactor' # optional: also require this on the title line
|
|
64
|
+
# unless: 'plan only|read-only' # optional: skip when the title matches this
|
|
65
|
+
# require: 'regression test' # the brief must contain this when the rule fires
|
|
66
|
+
# message: 'legacy-api work must name its regression test'
|
|
61
67
|
|
|
62
68
|
oc:
|
|
63
69
|
model_prefix: "opencode/"
|
|
@@ -67,17 +73,17 @@ oc:
|
|
|
67
73
|
wip:
|
|
68
74
|
limit: 6
|
|
69
75
|
days: 14
|
|
70
|
-
backup_url: "
|
|
71
|
-
backup_log: "
|
|
72
|
-
backup_hook_off: [
|
|
76
|
+
backup_url: "" # your own private backup repo; wip-backup refuses to invent one
|
|
77
|
+
backup_log: "~/.local/state/neurastream/WIP-BACKUP.md"
|
|
78
|
+
backup_hook_off: [] # origin name fragments whose pre-push hook wip-backup may bypass
|
|
73
79
|
backup_max_repo_mb: 1000
|
|
74
80
|
secret_gate: "~/.local/bin/git-secret-gate"
|
|
75
81
|
snapshot_max_mb: 5
|
|
76
|
-
status_log: "
|
|
77
|
-
secret_file: '(?i)(^|/)(\.env(\.(?!example$|sample$|template$|dist$)[\w-]+)?|[^/]*\.env|env\.json|[^/]*\.(pem|p12|pfx|jks|keystore|key)|id_(rsa|dsa|ecdsa|ed25519)|credentials(\.json)?|\.netrc|\.pgpass|\.htpasswd|local-run\.env)
|
|
82
|
+
status_log: "~/.local/state/neurastream/WIP-STATUS.md"
|
|
83
|
+
secret_file: '(?i)(^|/)(\.env(\.(?!example$|sample$|template$|dist$)[\w-]+)?|[^/]*\.env|env\.json|[^/]*\.(pem|p12|pfx|jks|keystore|key)|id_(rsa|dsa|ecdsa|ed25519)|credentials(\.json)?|\.netrc|\.pgpass|\.htpasswd|local-run\.env)$'
|
|
78
84
|
|
|
79
85
|
pm:
|
|
80
|
-
backend_log: "
|
|
86
|
+
backend_log: "" # your backend service log; pm-fail-facts reads it for errors ("" = only explicit --backend-log runs)
|
|
81
87
|
fail_lines: 25
|
|
82
88
|
backend_error: 'Traceback|ERROR|CRITICAL|Exception| 5\d\d '
|
|
83
89
|
|
|
@@ -110,7 +116,7 @@ guards:
|
|
|
110
116
|
shell_tools: [bash, eval]
|
|
111
117
|
write_tools: [write, edit, ast_edit]
|
|
112
118
|
free_ext: '\.(md|txt)$'
|
|
113
|
-
free_prefixes: [
|
|
119
|
+
free_prefixes: [] # path prefixes the write guard allows without an unlock
|
|
114
120
|
bypass_spawn: ["opencode run"]
|
|
115
121
|
protected: []
|
|
116
122
|
ledger_command: "agent-ledger --hours 12"
|
|
@@ -163,9 +169,9 @@ alerts:
|
|
|
163
169
|
cooldown_sec: 600
|
|
164
170
|
|
|
165
171
|
snapshot:
|
|
166
|
-
tmp_dest: "
|
|
167
|
-
git_repo: "
|
|
168
|
-
git_backup: "
|
|
172
|
+
tmp_dest: "~/.local/state/neurastream/tmp-snapshot"
|
|
173
|
+
git_repo: "" # optional: a repo whose git worktrees get patch snapshots (git worktree list)
|
|
174
|
+
git_backup: "" # where the patch snapshot lands (only used when snapshot.git_repo is set)
|
|
169
175
|
excludes:
|
|
170
176
|
- "playwright-transform-cache-*"
|
|
171
177
|
- "pytest-of-*"
|
|
@@ -175,5 +181,4 @@ snapshot:
|
|
|
175
181
|
- ".XIM-unix"
|
|
176
182
|
- ".font-unix"
|
|
177
183
|
- "snap-private-tmp"
|
|
178
|
-
- "gf-luna"
|
|
179
184
|
- "*.sock"
|
|
@@ -4,7 +4,7 @@ Points come only from work Main accepted, weighted by the plan phase's `difficul
|
|
|
4
4
|
Cost = the worker's own list cost + Main's steering cost (Main tokens spent on turns that mention the agent).
|
|
5
5
|
|
|
6
6
|
agent-score accept <Agent> --plan <plan.md> --phase P2 --commits <sha,sha|a..b> [--repo R] [--branch B] [--weight N] [--rework] [--note T]
|
|
7
|
-
commits must be ancestors of --branch (
|
|
7
|
+
commits must be ancestors of --branch (required; there is no default branch); --rework = needed fixes by Main/another agent
|
|
8
8
|
agent-score diagnose <Agent> --plan <plan.md> --phase P --evidence <file> [--weight N]
|
|
9
9
|
a real product bug found and recorded (no commit needed); default weight 4
|
|
10
10
|
agent-score validate <Agent> --plan <plan.md> --phase P --evidence <report.md> --section "## Heading" [--weight N] [--rework] [--note T]
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
pm-fail-facts: every fact about a
|
|
1
|
+
pm-fail-facts: every fact about a Playwright run's failures in ONE call.
|
|
2
2
|
|
|
3
3
|
Replaces hand-grepping logs/artifacts turn by turn (owner 2026-10-11: deterministic work goes to scripts).
|
|
4
4
|
For each failed test in <worktree>/test-results/e2e-junit.xml: title, file:line, error head,
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
uninstall: remove what init and adapter install put under this HOME.
|
|
2
|
+
|
|
3
|
+
Bins are removed only when they point into this package (a symlink into an
|
|
4
|
+
installed copy, or a byte-identical copy). The plugin link goes, pins go only
|
|
5
|
+
when byte-identical to the shipped templates (your own pins stay), and the
|
|
6
|
+
managed neurastream block is stripped from AGENTS.md — everything you wrote
|
|
7
|
+
around it stays.
|
|
8
|
+
|
|
9
|
+
--purge also remove the config file and the agent-dir state init created
|
|
10
|
+
(index, queue, notes, blockers)
|
|
11
|
+
|
|
12
|
+
The exact list prints first; without --yes nothing is removed. Paths that
|
|
13
|
+
resolve outside your HOME are refused.
|
|
14
|
+
Usage: neurastream uninstall [--purge] [--yes]
|
|
@@ -1,12 +1,18 @@
|
|
|
1
|
-
Push unfinished work to
|
|
1
|
+
Push unfinished work to your own private backup repo (off this disk).
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
The remote is wip.backup_url from config.yml. While it is empty, nothing is
|
|
4
|
+
pushed and every repo lands under "Failed" in the report (git has no target).
|
|
5
|
+
|
|
6
|
+
Per repo under your configured work roots (paths.work_roots; one run per shared
|
|
7
|
+
git dir):
|
|
8
|
+
- every local branch with commits on no remote -> refs/heads/<repo-key>/<branch>
|
|
5
9
|
- newest wip-snapshot ref per worktree -> refs/heads/wip/<worktree-key>
|
|
6
|
-
Never touches worktrees, branches or the real remotes. Hooks are NOT bypassed
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
+
Never touches worktrees, branches or the real remotes. Hooks are NOT bypassed
|
|
11
|
+
(--no-verify is banned): a repo with a pre-push hook is skipped and listed;
|
|
12
|
+
wip.backup_hook_off names origin fragments this rule may bypass. A ref whose
|
|
13
|
+
new commits fail the secret scan (wip.secret_gate; never a password on git,
|
|
14
|
+
private repos included) is NOT pushed and is listed as skipped. Repos whose
|
|
15
|
+
git dir exceeds wip.backup_max_repo_mb and shallow clones are skipped whole.
|
|
10
16
|
|
|
11
|
-
Restore: git fetch
|
|
17
|
+
Restore: git fetch '<wip.backup_url>' '<repo-key>/<branch>:<branch>'
|
|
12
18
|
Usage: wip-backup [--dry-run] [--quiet]
|
|
@@ -5,6 +5,7 @@ For each worktree under ROOTS with tracked changes or new (non-ignored) files, b
|
|
|
5
5
|
from a TEMPORARY index (parent = HEAD) and store it at refs/wip/<worktree>/<stamp>.
|
|
6
6
|
The working tree, the real index, HEAD and every branch stay untouched, so it is safe while
|
|
7
7
|
agents work. Skips a worktree whose content equals its last snapshot. New files > MAX_MB skipped.
|
|
8
|
-
Writes
|
|
8
|
+
Writes wip.status_log from config.yml (default ~/.local/state/neurastream/WIP-STATUS.md):
|
|
9
|
+
wip-check output + snapshot list.
|
|
9
10
|
Restore: git -C <wt> restore --source=<ref> --worktree -- <paths or .> | list: git for-each-ref refs/wip
|
|
10
11
|
Usage: wip-snapshot [--quiet]
|
|
@@ -4,14 +4,4 @@
|
|
|
4
4
|
|
|
5
5
|
## Allowed
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
- `deepseek`
|
|
9
|
-
- `composer`
|
|
10
|
-
- `hiko`
|
|
11
|
-
- `muse`
|
|
12
|
-
- `luna`
|
|
13
|
-
- `sol`
|
|
14
|
-
- `grok`
|
|
15
|
-
- `gemini`
|
|
16
|
-
- `local-qwen`
|
|
17
|
-
- `haiku`
|
|
7
|
+
<!-- Empty by default: add one bullet per worker you want spawnable (dash, space, backticked pin name from templates/agents). -->
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
set -uo pipefail
|
|
3
3
|
|
|
4
4
|
SNAP=${SNAP_DEST:?}
|
|
5
|
-
GF=${SNAP_GIT_REPO
|
|
6
|
-
GFB=${SNAP_GIT_BACKUP
|
|
5
|
+
GF=${SNAP_GIT_REPO:-}
|
|
6
|
+
GFB=${SNAP_GIT_BACKUP:-}
|
|
7
7
|
LOCK=${SNAP_LOCK:?}
|
|
8
|
-
mkdir -p "$SNAP/tmp" "$
|
|
9
|
-
chmod 700 "$SNAP"
|
|
8
|
+
mkdir -p "$SNAP/tmp" "$(dirname "$LOCK")"
|
|
9
|
+
chmod 700 "$SNAP"
|
|
10
10
|
|
|
11
11
|
exec 9>"$LOCK"
|
|
12
12
|
flock -n 9 || { echo "snapshot already running"; exit 0; }
|
|
@@ -21,7 +21,10 @@ if [[ $rc -ne 0 && $rc -ne 23 && $rc -ne 24 ]]; then
|
|
|
21
21
|
echo "rsync /tmp failed with $rc" >&2
|
|
22
22
|
fi
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
# Git patch backup is opt-in: set snapshot.git_repo + snapshot.git_backup.
|
|
25
|
+
if [[ -n $GF && -n $GFB ]] && git -C "$GF" rev-parse --git-dir >/dev/null 2>&1; then
|
|
26
|
+
mkdir -p "$GFB"
|
|
27
|
+
chmod 700 "$GFB" "$(dirname "$GFB")"
|
|
25
28
|
tmpb=$(mktemp -d "$GFB.new.XXXXXX")
|
|
26
29
|
fail=0
|
|
27
30
|
while IFS= read -r wt; do
|
|
@@ -37,7 +40,7 @@ if git -C "$GF" rev-parse --git-dir >/dev/null 2>&1; then
|
|
|
37
40
|
{ git branch --show-current >"$out/BRANCH"; true; } &&
|
|
38
41
|
{ git ls-files -o --exclude-standard -z | xargs -0 -r tar czf "$out/untracked.tgz"; } &&
|
|
39
42
|
{ [[ ! -d docs ]] || tar czf "$out/docs.tgz" docs; }
|
|
40
|
-
) || { echo "
|
|
43
|
+
) || { echo "repo backup failed for $wt" >&2; fail=1; }
|
|
41
44
|
done < <(git -C "$GF" worktree list --porcelain | awk '/^worktree /{wt=substr($0,10)} /^bare$/{wt=""} /^$/{if(wt!="")print wt; wt=""} END{if(wt!="")print wt}')
|
|
42
45
|
if (( fail == 0 )); then rm -rf "$GFB" && mv "$tmpb" "$GFB"; else rm -rf "$tmpb"; fi
|
|
43
46
|
fi
|