@ericrisco/rsc 1.2.2 → 1.3.0
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 +46 -53
- package/manifest.json +1 -1
- package/package.json +1 -1
- package/scripts/install-apply.js +158 -32
- package/scripts/install-plan.js +2 -2
- package/scripts/lib/manifest-file.js +2 -1
- package/scripts/lib/onboarding-apply.js +206 -0
- package/scripts/lib/onboarding.js +301 -0
- package/scripts/rsc.js +224 -9
- package/scripts/spec-gate.js +143 -11
- package/skills/design/scripts/verify.sh +4 -1
- package/skills/suggest/SKILL.md +3 -0
- package/targets/_md-block.js +5 -2
- package/targets/claude.js +26 -4
- package/targets/cursor.js +5 -2
- package/targets/index.js +2 -2
- package/targets/session-memory-adapter.mjs +16 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { existsSync, readFileSync } from 'node:fs';
|
|
3
|
-
import { resolve, join } from 'node:path';
|
|
3
|
+
import { resolve, join, dirname } from 'node:path';
|
|
4
4
|
import { capture, resume } from './session-memory-core.mjs';
|
|
5
5
|
|
|
6
6
|
const LOCAL_TARGETS = new Set(['claude', 'codex', 'cursor', 'gemini', 'opencode']);
|
|
@@ -15,6 +15,20 @@ function projectSettings(cwd) {
|
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
// The project is the nearest ancestor holding `.rsc.json` — the file that IS the harness's decision.
|
|
19
|
+
// The hook payload's `cwd` is only where the tool call happened to run; inside a container of child
|
|
20
|
+
// repos that is routinely a subdirectory with no harness of its own, and anchoring there scatters
|
|
21
|
+
// one session's journal across children. With no harness anywhere above, the cwd stays the project.
|
|
22
|
+
function nearestHarness(dir) {
|
|
23
|
+
let current = dir;
|
|
24
|
+
for (;;) {
|
|
25
|
+
if (existsSync(join(current, '.rsc.json'))) return current;
|
|
26
|
+
const parent = dirname(current);
|
|
27
|
+
if (parent === current) return dir;
|
|
28
|
+
current = parent;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
18
32
|
function sessionId(native, target) {
|
|
19
33
|
return native?.session_id || native?.sessionId || native?.sessionID || native?.conversation_id
|
|
20
34
|
|| native?.thread_id || `${target}-${process.ppid}`;
|
|
@@ -63,7 +77,7 @@ export function handleLifecycle({ target, event, native = {}, cwd, settings } =
|
|
|
63
77
|
try {
|
|
64
78
|
if (!LOCAL_TARGETS.has(target)) throw new Error(`unsupported memory target: ${target}`);
|
|
65
79
|
if (isRemote(target, native)) return { output: {}, capture: null, remote: true, degraded: false };
|
|
66
|
-
const project = resolve(cwd || native.cwd || process.env.RSC_PROJECT_CWD || process.cwd());
|
|
80
|
+
const project = nearestHarness(resolve(cwd || native.cwd || process.env.RSC_PROJECT_CWD || process.cwd()));
|
|
67
81
|
if (!existsSync(project)) throw new Error('project directory unavailable');
|
|
68
82
|
const config = settings || projectSettings(project);
|
|
69
83
|
if (config.enabled === false) return { output: {}, capture: null, remote: false, degraded: false };
|