@ericrisco/rsc 4.1.7 → 4.1.8

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/manifest.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "4.1.7",
2
+ "version": "4.1.8",
3
3
  "counts": {
4
4
  "skills": 273,
5
5
  "agents": 34,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ericrisco/rsc",
3
- "version": "4.1.7",
3
+ "version": "4.1.8",
4
4
  "description": "A guided harness builder that turns your goal into a minimal, verified AI-agent setup using strict best practices.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -30,7 +30,7 @@
30
30
  // The shadow deliberately does NOT `@AGENTS.md`-import: the import would expand the rsc block
31
31
  // into context and recreate the duplication it exists to prevent.
32
32
  import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
33
- import { dirname, join, parse } from 'node:path';
33
+ import { dirname, join } from 'node:path';
34
34
 
35
35
  // The marker _md-block.js wraps the always-on body in. Its presence in a root AGENTS.md is
36
36
  // what makes that file a second carrier of the body rather than the user's own prose.
@@ -70,12 +70,12 @@ const CLAUDE_MD_FORMS = ['CLAUDE.md', join('.claude', 'CLAUDE.md'), 'CLAUDE.loca
70
70
  // Claude Code looks for those files in the working directory AND every directory above it, so a
71
71
  // CLAUDE.md two levels up already suppresses the AGENTS.md read. Walking up costs a few stats and
72
72
  // keeps us from planting a file that was never needed.
73
- function claudeMdAboveOrAt(root) {
73
+ function claudeMdAboveOrAt(root, ancestorBoundary) {
74
74
  let dir = root;
75
75
  for (;;) {
76
76
  for (const form of CLAUDE_MD_FORMS) if (existsSync(join(dir, form))) return join(dir, form);
77
77
  const up = dirname(dir);
78
- if (up === dir || dir === parse(dir).root) return null;
78
+ if (dir === ancestorBoundary || up === dir) return null;
79
79
  dir = up;
80
80
  }
81
81
  }
@@ -109,9 +109,9 @@ function agentsMdCarriesBody(root) {
109
109
  * @returns the path written, or null when nothing was needed. Never throws: a shadow we could not
110
110
  * write costs context, and that must not be the thing that fails an install.
111
111
  */
112
- export function ensureShadowClaudeMd(projectRoot) {
112
+ export function ensureShadowClaudeMd(projectRoot, { ancestorBoundary } = {}) {
113
113
  try {
114
- const dest = shadowTarget(projectRoot);
114
+ const dest = shadowTarget(projectRoot, { ancestorBoundary });
115
115
  if (!dest) return null;
116
116
  mkdirSync(dirname(dest), { recursive: true });
117
117
  writeFileSync(dest, SHADOW_BODY);
@@ -127,11 +127,11 @@ export function ensureShadowClaudeMd(projectRoot) {
127
127
  * @param assumeClaudeWired for a claude install in flight: settings.json names the project as
128
128
  * wired only after wireHook writes it, so at plan time the answer has to be assumed, not read.
129
129
  */
130
- export function shadowTarget(projectRoot, { assumeClaudeWired = false } = {}) {
130
+ export function shadowTarget(projectRoot, { assumeClaudeWired = false, ancestorBoundary } = {}) {
131
131
  try {
132
132
  if (!assumeClaudeWired && !claudeWired(projectRoot)) return null;
133
133
  if (!agentsMdCarriesBody(projectRoot)) return null;
134
- if (claudeMdAboveOrAt(projectRoot)) return null;
134
+ if (claudeMdAboveOrAt(projectRoot, ancestorBoundary)) return null;
135
135
  return join(projectRoot, 'CLAUDE.md');
136
136
  } catch { return null; }
137
137
  }
@@ -327,6 +327,18 @@ function panelSize(root, slugs, stillValid = () => true) {
327
327
  return best;
328
328
  }
329
329
 
330
+ // A linked checkout owns its spec and ledger, just as the review CLI owns its HEAD.
331
+ // Independent child repositories still use their supervising workspace's evidence.
332
+ function reviewEvidenceRoot(workspace, repo) {
333
+ if (workspace === repo) return repo;
334
+ const commonDir = (dir) => {
335
+ const path = git(dir, 'rev-parse', '--git-common-dir')?.trim();
336
+ return path ? resolve(dir, path) : null;
337
+ };
338
+ const shared = commonDir(workspace);
339
+ return shared && shared === commonDir(repo) ? repo : workspace;
340
+ }
341
+
330
342
  /**
331
343
  * null when the command may go ahead; the denial text (with its way out, P6) when it may not.
332
344
  * `lib` carries the sibling modules so tests and the hook load them the same way.
@@ -424,7 +436,8 @@ export function branchCheck(
424
436
  (c) => c !== 'default' && c !== 'docs',
425
437
  );
426
438
  if (tierTwo.length && tierTwo.every((c) => c === 'harness')) return null;
427
- const specs = linkedSpecs(root, branch, specCompleteness, cfg);
439
+ const evidence = reviewEvidenceRoot(root, repo);
440
+ const specs = linkedSpecs(evidence, branch, specCompleteness, cfg);
428
441
  const passing = specs.filter((s) => s.ok);
429
442
  if (passing.length) {
430
443
  if (cfg.asddGate?.require === 'spec') return null;
@@ -432,7 +445,7 @@ export function branchCheck(
432
445
  // by default), recorded against one of its linked specs in the review ledger.
433
446
  const required = sello.lensesRequired(2, cfg);
434
447
  const slugs = passing.map((s) => s.path.split('/').pop().slice(0, -3));
435
- const best = panelSize(root, slugs, (sha) =>
448
+ const best = panelSize(evidence, slugs, (sha) =>
436
449
  reviewedStill(repo, sha, trunk, sello, cfg, tip || 'HEAD'),
437
450
  );
438
451
  if (best >= required) return null;