neurastream 0.2.1 → 0.2.3

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neurastream",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
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",
@@ -183,10 +183,10 @@ export function bypassRegExp(entry: string): RegExp {
183
183
  const RESEARCH_ASK = /\b(research|investigate|find where|map the code|read the code for)\b/i;
184
184
  const PLAN_WRITE = /\b(write|writing|draft|drafting|author)\b[^\n]*\bplan\b/i;
185
185
 
186
- // Phase ids (P1, P2 ...) in the plan's Phases section that are not ticked yet.
186
+ // Phase ids (P1, P2, P4a ...) in the plan's Phases section that are not ticked yet.
187
187
  function unticked(p: Plan): string[] {
188
188
  const phases = q.sections(p.text).get("phases") ?? "";
189
- return [...phases.matchAll(/^\s*[-*]\s+\[ \]\s+(P\d+)\b/gm)].map(m => m[1]!);
189
+ return [...phases.matchAll(/^\s*[-*]\s+\[ \]\s+(P\d+[a-z]?)\b/gm)].map(m => m[1]!);
190
190
  }
191
191
 
192
192
  // Plans an implementer brief may run on; returns [reason, null] or [null, plan files].
@@ -301,7 +301,7 @@ function subRules(e: ToolEvent, input: Record<string, unknown>, paths: string[],
301
301
  return `${p} is a plan file: change its "## Progress" section only with the edit or write tool.`;
302
302
  }
303
303
  for (const plan of plans) {
304
- const hit = paths.filter(p => !q.isOrchestrationPath(p, plans) && q.planCovers(plan, p));
304
+ const hit = paths.filter(p => !q.isOrchestrationPath(p, plans) && q.planCovers(plan, p, plans));
305
305
  if (!hit.length) continue;
306
306
  if (plan.errors.length) return `plan ${plan.file} is invalid (${plan.errors.join("; ")}). Stop and report to Main.`;
307
307
  const why = runBlockers(plan, hit, e, cfg);
@@ -283,9 +283,16 @@ function under(p: string, root: string): boolean {
283
283
  return p === root || p.startsWith(`${root}/`);
284
284
  }
285
285
 
286
- export function planCovers(plan: Plan, p: string): boolean {
287
- if (under(p, plan.repo) || plan.appliesTo.some(a => under(p, a)) || (plan.worktree && under(p, plan.worktree))) return true;
288
- return repoRoot(p) === plan.repo;
286
+ export function planCovers(plan: Plan, p: string, plans: Plan[] = []): boolean {
287
+ // One plan = one worktree (0.2.0 one-index): a linked worktree that another open plan names
288
+ // as its Worktree is that plan's ground, so this plan covers such a path only through its
289
+ // own Worktree or ## Applies to — the repo-level fallback below must not claim every
290
+ // worktree of the shared repo. Paths in the main checkout and in worktrees no open plan
291
+ // names stay covered as before (safe default).
292
+ const g = gitTop(p);
293
+ if (g && plans.some(o => o !== plan && o.status === "open" && o.worktree && o.worktree === g.top))
294
+ return plan.appliesTo.some(a => under(p, a)) || (!!plan.worktree && under(p, plan.worktree));
295
+ return under(p, plan.repo) || plan.appliesTo.some(a => under(p, a)) || (!!plan.worktree && under(p, plan.worktree)) || repoRoot(p) === plan.repo;
289
296
  }
290
297
 
291
298
  export function planAt(p: string, plans: Plan[]): Plan | null {