neurastream 0.2.3 → 0.2.4
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/package.json +1 -1
- package/src/core/brief-lint.ts +26 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "neurastream",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
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/core/brief-lint.ts
CHANGED
|
@@ -2,8 +2,32 @@ import { existsSync, readFileSync, statSync } from "node:fs";
|
|
|
2
2
|
import { basename, dirname } from "node:path";
|
|
3
3
|
import type { Config } from "./config.ts";
|
|
4
4
|
import { exitText, helpDoc, printText } from "./help.ts";
|
|
5
|
+
import { sections } from "./queue/lib.ts";
|
|
5
6
|
|
|
6
7
|
const OUTPUT_HINT = /(report|progress|review|handoff|log|brief)[\w\-]*\.(md|log|txt|json)$|\.log$/;
|
|
8
|
+
const TICKED_PHASE = /^\s*[-*]\s+\[[xX]\]/;
|
|
9
|
+
|
|
10
|
+
// A plan's paths are live work only in the header lines, Goal, Forbidden, Blockers, unticked phase
|
|
11
|
+
// lines and Done check. Ticked phases and the history sections (Code read by Main, Progress,
|
|
12
|
+
// Background) cite worktrees removed after their work landed, so the path check skips them. A plain
|
|
13
|
+
// brief (no `## Phases`) is checked whole.
|
|
14
|
+
function liveText(text: string): string {
|
|
15
|
+
const secs = sections(text);
|
|
16
|
+
if (!secs.has("phases")) return text;
|
|
17
|
+
const header = text.slice(0, text.search(/^## /m));
|
|
18
|
+
const unticked = (secs.get("phases") ?? "")
|
|
19
|
+
.split("\n")
|
|
20
|
+
.filter(l => !TICKED_PHASE.test(l))
|
|
21
|
+
.join("\n");
|
|
22
|
+
return [
|
|
23
|
+
header,
|
|
24
|
+
secs.get("goal") ?? "",
|
|
25
|
+
secs.get("forbidden") ?? "",
|
|
26
|
+
secs.get("blockers") ?? "",
|
|
27
|
+
unticked,
|
|
28
|
+
secs.get("done check") ?? "",
|
|
29
|
+
].join("\n");
|
|
30
|
+
}
|
|
7
31
|
|
|
8
32
|
function escapeReg(s: string): string {
|
|
9
33
|
return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
@@ -41,9 +65,10 @@ function lint(path: string, cfg: Config): { errs: string[]; warns: string[] } {
|
|
|
41
65
|
|
|
42
66
|
|
|
43
67
|
const paths = new Set<string>();
|
|
68
|
+
const scan = liveText(text);
|
|
44
69
|
for (const prefix of cfg.brief.path_prefixes) {
|
|
45
70
|
const re = new RegExp(`(${escapeReg(prefix)}[\\w./\\-]+)`, "g");
|
|
46
|
-
for (const hit of
|
|
71
|
+
for (const hit of scan.matchAll(re)) paths.add(hit[1]!);
|
|
47
72
|
}
|
|
48
73
|
for (const raw of [...paths].sort()) {
|
|
49
74
|
let p = raw.replace(/[.,)]+$/, "");
|