@ericrisco/rsc 4.1.3 → 4.1.5
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 +90 -2
- package/manifest.json +1 -1
- package/package.json +1 -1
- package/scripts/doctor.js +17 -1
- package/scripts/install-apply.js +20 -8
- package/scripts/lib/cli-invocation.js +44 -0
- package/scripts/lib/manifest-file.js +2 -1
- package/scripts/lib/risk.js +6 -4
- package/scripts/rsc.js +39 -4
- package/skills/worktrees/SKILL.md +6 -0
- package/skills/worktrees/evals/cases.yaml +7 -0
- package/skills/worktrees/references/orca.md +64 -0
- package/targets/asdd-gate.mjs +401 -52
- package/targets/claude-lifecycle.js +34 -0
- package/targets/claude.js +8 -11
- package/targets/commands.js +2 -1
- package/targets/index.js +52 -3
- package/targets/knowledge-wiring.js +5 -0
- package/targets/memory.js +5 -0
- package/targets/risk-policy.mjs +424 -0
- package/targets/sello.mjs +35 -10
- package/targets/session-memory-adapter.mjs +7 -0
- package/targets/ship-guard.mjs +1 -1
- package/targets/worktree-reaper.mjs +42 -4
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
Keep your project knowledge, skills and working rules together across the assistants you already use.
|
|
16
16
|
Start with your goal. Review what rsc proposes to install. Accept the plan before it changes your project.
|
|
17
17
|
|
|
18
|
-
**MIT licensed · project-local setup ·
|
|
18
|
+
**MIT licensed · project-local setup · 19 assistant targets**
|
|
19
19
|
|
|
20
20
|
Give this URL to your agent and paste the request in the chat:
|
|
21
21
|
|
|
@@ -119,6 +119,12 @@ load progressively: only their description is paid for until a task needs them.
|
|
|
119
119
|
|
|
120
120
|
Prefer a short `rsc` command? `npm install -g @ericrisco/rsc`.
|
|
121
121
|
|
|
122
|
+
When an executable `rsc` is already on PATH, install and sync write operational skill and
|
|
123
|
+
command instructions using that installed CLI. This also applies to unversioned commands
|
|
124
|
+
suggested by hooks. Explicit versions such as `@4.1.1` and `@latest` keep their meaning.
|
|
125
|
+
No execution permission is added for this choice. If the CLI is removed, run sync using the
|
|
126
|
+
version declared in `.rsc.json` to restore the `npx` instructions.
|
|
127
|
+
|
|
122
128
|
> **Run it inside the project you are equipping, not inside a clone of this repo.** The catalog's own
|
|
123
129
|
> `package.json` is named `@ericrisco/rsc`, so `npx @ericrisco/rsc` from within a clone resolves to
|
|
124
130
|
> the local bin and fails with `sh: rsc: command not found`. Working on the catalog itself? Use
|
|
@@ -235,6 +241,12 @@ project. rsc handles four things by default:
|
|
|
235
241
|
| **The agent picks the method** | FTD for simple changes, ASDD for complex ones. The agent decides and says why. | Ask for the other lane |
|
|
236
242
|
| **Knowledge reaches everyone** | `01-TOOLS/`, `02-DOCS/wiki/` and `02-DOCS/attachments/` travel through one exchange branch, `rsc/knowledge`, and reach `main` inside your normal pull requests. | `rsc knowledge-sync off` |
|
|
237
243
|
|
|
244
|
+
**Orca worktrees.** Set `"worktreeManager": "orca"` in `.rsc.json` to retain externally managed
|
|
245
|
+
checkouts even when Orca is unavailable. rsc also recognises a matching Orca CLI response, and never
|
|
246
|
+
removes these checkouts through plain Git. [Setup and cleanup](skills/worktrees/references/orca.md)
|
|
247
|
+
use the pinned harness version and Orca's lifecycle hooks; workspace lineage does not silence
|
|
248
|
+
warnings about unverified concurrent sessions.
|
|
249
|
+
|
|
238
250
|
**How it knows a project is complex.** A hook counts what anyone can check: a CI setup, a deployment
|
|
239
251
|
file (`Dockerfile`, `vercel.json`, `fly.toml`…) or at least two people in the last 50 commits. The
|
|
240
252
|
answer you gave at install always wins over this detection.
|
|
@@ -367,18 +379,32 @@ The wizard asks which ones; `--target a,b` does it non-interactively.
|
|
|
367
379
|
| `amp` | `.amp/rsc/<id>/` → symlink | block in `AGENTS.md` |
|
|
368
380
|
| `opencode` | `.opencode/rsc/<id>/` → symlink | block in `AGENTS.md` |
|
|
369
381
|
| `deepseek` | `.dsh/skills/<id>/` → symlink (discovered natively) | block in `AGENTS.md` |
|
|
382
|
+
| `pi` | `.pi/skills/<id>/` → symlink (copy on Windows; discovered natively) | block in Pi's selected project context file |
|
|
370
383
|
| `jules` | `.jules/rsc/<id>/` → symlink | block in `AGENTS.md` |
|
|
371
384
|
| `junie` | `.junie/rsc/<id>/` → symlink | block in `.junie/guidelines.md` |
|
|
372
385
|
| `kiro` | `.kiro/rsc/<id>/` → symlink | doc in `.kiro/steering/rsc-suggest.md` |
|
|
373
386
|
| `aider` | `.aider/rsc/<id>/` → symlink | block in `CONVENTIONS.md` |
|
|
374
387
|
|
|
375
388
|
> `codex`, `zed`, `amp`, `opencode`, `deepseek` and `jules` share one root `AGENTS.md`; the block is
|
|
376
|
-
> written once.
|
|
389
|
+
> written once. Pi shares it when that is the context file its native loader selects.
|
|
377
390
|
|
|
378
391
|
> **DeepSeek Harness** (`dsh`) has no project-level hooks, so once per machine rsc adds one marked
|
|
379
392
|
> block to `~/.dsh/cordis.patch.yml` that runs the hooks of whichever project the session is in.
|
|
380
393
|
> Restart dsh once after the first install; delete the block to turn it off.
|
|
381
394
|
|
|
395
|
+
> **Pi:** select `--target pi` during onboarding, then run `/reload` in Pi to discover the
|
|
396
|
+
> installed skills. Invoke one explicitly with `/skill:<id>`. Pi loads project resources after
|
|
397
|
+
> project trust is granted; rsc preserves your `.pi/settings.json` and extensions.
|
|
398
|
+
> This target uses Pi's [native skills and context files](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/docs/configuration.md).
|
|
399
|
+
> Its [context loader](https://github.com/earendil-works/pi/blob/main/packages/coding-agent/src/core/resource-loader.ts)
|
|
400
|
+
> selects the first readable file in this order: `AGENTS.override.md`, `AGENTS.md`, `AGENTS.MD`,
|
|
401
|
+
> `CLAUDE.md`, `CLAUDE.MD`. rsc adds its marked block to that file, preserving your instructions;
|
|
402
|
+
> it creates `AGENTS.md` only when none exists. If a new override hides the block, doctor reports
|
|
403
|
+
> the missing wiring and sync writes the block into the selected file.
|
|
404
|
+
> It does not install a custom extension, subagents, automatic session-memory hooks, or tool guards.
|
|
405
|
+
> Pi has no built-in subagents; skills that require independent reviewers need an external review.
|
|
406
|
+
> The instructions request an update check on the first turn, as for other targets without a wired session hook.
|
|
407
|
+
|
|
382
408
|
| Targets | Stack agents | Native commands | Session memory |
|
|
383
409
|
| --- | --- | --- | --- |
|
|
384
410
|
| Claude Code | yes | agent + memory entries | full |
|
|
@@ -386,6 +412,7 @@ The wizard asks which ones; `--target a,b` does it non-interactively.
|
|
|
386
412
|
| Cursor desktop | yes | yes | assisted |
|
|
387
413
|
| Gemini CLI, OpenCode | yes | yes | full |
|
|
388
414
|
| DeepSeek Harness | unsupported | unsupported | full (machine bridge) |
|
|
415
|
+
| Pi | unsupported | native `/skill:<id>` (no generated command files) | unsupported |
|
|
389
416
|
| GitHub Copilot | yes | yes | unsupported |
|
|
390
417
|
| Junie, Kiro | yes | unsupported | unsupported |
|
|
391
418
|
| Windsurf, Cline, Roo | unsupported | yes | unsupported |
|
|
@@ -674,6 +701,67 @@ Most of this catalog is written here. These are not, and they keep their author'
|
|
|
674
701
|
Adapted, not mirrored: each carries rsc frontmatter, routing evals and hand-offs to its siblings. The
|
|
675
702
|
craft bar in them is the original author's.
|
|
676
703
|
|
|
704
|
+
### Shared risk policy and external branch checks
|
|
705
|
+
|
|
706
|
+
Commit `.rsc-risk.json` at the workspace root to share risk rules across clones and submodules:
|
|
707
|
+
|
|
708
|
+
```json
|
|
709
|
+
{
|
|
710
|
+
"version": 1,
|
|
711
|
+
"trunks": ["develop", "integration"],
|
|
712
|
+
"repositories": { "Catman": { "trunks": ["develop"] } },
|
|
713
|
+
"testRepos": ["CatmanTest"],
|
|
714
|
+
"rules": [
|
|
715
|
+
{ "class": "schema", "tier": 2, "path": "\\.Table\\.al$",
|
|
716
|
+
"removed": "^\\s*field\\s*\\(", "productionOnly": true,
|
|
717
|
+
"because": "Removing a field changes the stored schema." },
|
|
718
|
+
{ "class": "api", "tier": 2, "path": "\\.Page\\.al$",
|
|
719
|
+
"contains": "PageType\\s*=\\s*API", "removed": "APIVersion",
|
|
720
|
+
"because": "The API contract changes." },
|
|
721
|
+
{ "class": "platform", "tier": 2, "path": "(^|/)app\\.json$",
|
|
722
|
+
"jsonKeys": ["dependencies", "idRanges", "runtime"],
|
|
723
|
+
"because": "Dependencies or platform requirements change." },
|
|
724
|
+
{ "class": "editor", "tier": 0, "path": "^\\.vscode/settings\\.json$",
|
|
725
|
+
"because": "Editor preferences only." }
|
|
726
|
+
]
|
|
727
|
+
}
|
|
728
|
+
```
|
|
729
|
+
|
|
730
|
+
Rules can also use `added`, `deleted: true` and `repos: ["relative/path"]`. Conditions in one rule
|
|
731
|
+
must all match. `contains` reads the file before and after the change; `added` and `removed` read
|
|
732
|
+
changed lines with whitespace differences ignored. JSON keys are top-level keys. Renames are
|
|
733
|
+
checked as both old and new paths. Matching rules take their highest tier; explicit zero replaces
|
|
734
|
+
ordinary-code defaults, but built-in risk classes and the secrets/harness floors still apply.
|
|
735
|
+
Patterns are case-insensitive and limited to 200 characters; repeated groups, lookarounds and
|
|
736
|
+
backreferences are rejected. Content lines over 2,000 characters are skipped. Rule evaluation has
|
|
737
|
+
a hard one-second timeout and an 8 MiB input budget: exceeding either reports an error at tier 2.
|
|
738
|
+
At most 64 rules and 16 trunk candidates are supported.
|
|
739
|
+
|
|
740
|
+
`rsc risk` and the push gate use the policy **from the workspace trunk**, including repository
|
|
741
|
+
settings and exemptions. A proposed policy cannot relax its own outgoing branch. A policy first
|
|
742
|
+
added on a feature branch stays inactive until it lands. Use `rsc risk --policy-preview` to inspect
|
|
743
|
+
the proposed policy explicitly; the output identifies its source. Local `.rsc/sello-config.json`
|
|
744
|
+
remains available for existing settings and bootstrap. Initial trunk discovery uses `origin/HEAD`,
|
|
745
|
+
then `main`, `master` or `develop`; for another name, set the remote HEAD or the local `trunk` first.
|
|
746
|
+
Once a trusted policy exists, its trunk candidates select the nearest branch by commits ahead.
|
|
747
|
+
`rsc doctor` reports an installed ASDD gate that cannot find a trunk.
|
|
748
|
+
|
|
749
|
+
Specs accept `branches: [feature/a, fix/b]` or a YAML block list, as well as the existing `branch:`.
|
|
750
|
+
An FTD under `02-DOCS/wiki/ftd/` can link its branch to a spec with `spec: <slug>`. Optional trusted
|
|
751
|
+
`asddGate` settings are `require: "spec"` (default: full panel), `exemptBranches: ["^chore/back-merge-"]`
|
|
752
|
+
and `cherryPickSuffix: "-master"`. These settings take effect after the policy reaches the trunk.
|
|
753
|
+
|
|
754
|
+
External PR tools can run `rsc spec gate --branch-check --repo <directory> [--branch <name>]` from
|
|
755
|
+
the workspace, or run the same command inside a submodule. Exit `0` means allowed, `2` means denied,
|
|
756
|
+
and `1` means the check could not run. `--branch` evaluates that branch even when it is not checked
|
|
757
|
+
out. The hook resolves ordinary `git -C`, directory changes, shell `-c`/`eval` wrappers and `gh pr`
|
|
758
|
+
commands. Arbitrary scripts, aliases and shell functions need the explicit CLI check; their bodies
|
|
759
|
+
cannot be inferred from the shell invocation. This is a local review aid, not a remote-server policy.
|
|
760
|
+
|
|
761
|
+
Sync preserves opt-outs declared by teammates in `.rsc.json`. Existing local markers remain local
|
|
762
|
+
choices; doctor reports differences. To explicitly re-arm a team gate, remove its local marker and
|
|
763
|
+
run an explicit install, which records the new decision; sync alone does not erase the declaration.
|
|
764
|
+
|
|
677
765
|
## License
|
|
678
766
|
|
|
679
767
|
MIT. See [LICENSE](LICENSE).
|
package/manifest.json
CHANGED
package/package.json
CHANGED
package/scripts/doctor.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { readPolicy } from '../targets/risk-policy.mjs';
|
|
1
2
|
import { hooksDir, hooksDirIsOurs, classifyWorktrees } from '../targets/worktree-reaper.mjs';
|
|
2
3
|
import { existsSync, readFileSync, readdirSync, statSync, realpathSync } from 'node:fs';
|
|
3
4
|
import { join, dirname, relative, sep } from 'node:path';
|
|
@@ -244,6 +245,13 @@ function invalidClaudeAgentTools(root, names) {
|
|
|
244
245
|
});
|
|
245
246
|
}
|
|
246
247
|
|
|
248
|
+
function piInstructionsWired(file) {
|
|
249
|
+
try {
|
|
250
|
+
const text = readFileSync(file, 'utf8');
|
|
251
|
+
return /^<!-- rsc-suggest:start -->\r?$/m.test(text) && /^<!-- rsc-suggest:end -->\r?$/m.test(text);
|
|
252
|
+
} catch { return false; }
|
|
253
|
+
}
|
|
254
|
+
|
|
247
255
|
export function doctor({ target, home, cwd }) {
|
|
248
256
|
const root = cwd || process.cwd();
|
|
249
257
|
const paths = targetPaths(target, home, cwd);
|
|
@@ -291,7 +299,14 @@ export function doctor({ target, home, cwd }) {
|
|
|
291
299
|
installed: Object.keys(state.skills),
|
|
292
300
|
missing: [],
|
|
293
301
|
// Wired means it can actually run, not merely that the file declaring it is there.
|
|
294
|
-
hookWired: existsSync(paths.hookTarget) && missingHookScripts({ target, home, cwd }).length === 0
|
|
302
|
+
hookWired: existsSync(paths.hookTarget) && missingHookScripts({ target, home, cwd }).length === 0
|
|
303
|
+
&& (target !== 'pi' || piInstructionsWired(paths.hookTarget)),
|
|
304
|
+
...(target === 'pi' ? { contextFile: {
|
|
305
|
+
path: paths.hookTarget,
|
|
306
|
+
...(piInstructionsWired(paths.hookTarget) ? {} : {
|
|
307
|
+
action: 'Run `rsc sync` to restore the managed instructions in the context file Pi currently selects.',
|
|
308
|
+
}),
|
|
309
|
+
} } : {}),
|
|
295
310
|
manifestSkills: manifest.counts.skills,
|
|
296
311
|
backups: {
|
|
297
312
|
exists: existsSync(join(root, '.rsc', 'backups')),
|
|
@@ -306,6 +321,7 @@ export function doctor({ target, home, cwd }) {
|
|
|
306
321
|
worktreeHygiene: worktreeHygiene(root),
|
|
307
322
|
ownSkills: ownSkillsIn(paths, readProjectManifest(root)?.ownSkills || []),
|
|
308
323
|
sello: selloStatus(root),
|
|
324
|
+
asddGate: existsSync(join(root, '.rsc', '.no-asdd-gate')) ? { state: 'off-by-choice' } : existsSync(join(root, '.rsc', 'asdd-gate.mjs')) ? (() => { const p = readPolicy(root); return { state: p.error ? 'invalid-policy' : p.trunk ? 'ready' : 'no-trunk', trunk: p.trunk, policySource: p.source, ...(p.error || !p.trunk ? { action: p.error || 'Set origin/HEAD or configure a trunk before relying on ASDD branch checks.' } : {}) }; })() : { state: 'not-installed' },
|
|
309
325
|
// An inert gate must never read as an armed one (the same rule the sello follows):
|
|
310
326
|
// the gitmoji guard has a per-project kill switch, so say which state it is in.
|
|
311
327
|
gitmojiGuard: state.policy?.gitmojiGuard === false
|
package/scripts/install-apply.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { claudeBootstrapPath } from '../targets/claude-lifecycle.js';
|
|
2
3
|
import { rmSync, rmdirSync, existsSync, cpSync, lstatSync, mkdirSync, readFileSync, realpathSync, writeFileSync, appendFileSync, readdirSync, renameSync } from 'node:fs';
|
|
3
4
|
import { join, dirname, relative, resolve, sep } from 'node:path';
|
|
4
5
|
import { fileURLToPath } from 'node:url';
|
|
5
6
|
import { spawnSync } from 'node:child_process';
|
|
6
7
|
import { planInstall } from './install-plan.js';
|
|
8
|
+
import { installedCli, materializeCliInstructions } from './lib/cli-invocation.js';
|
|
7
9
|
import { targetPaths, writeSkill, wireHook, unwireHook, baseDir, TARGET_IDS } from '../targets/index.js';
|
|
8
10
|
import { shadowTarget } from '../targets/agents-md-shadow.js';
|
|
9
11
|
import {
|
|
@@ -59,13 +61,16 @@ function writeBaseVersions(cwd, versions) {
|
|
|
59
61
|
// overwriting on a version change is safe. Mutates `baseVersions` with the new mark.
|
|
60
62
|
function ensureBase(id, cwd, baseVersions) {
|
|
61
63
|
const dest = baseDir(id, cwd);
|
|
62
|
-
const
|
|
64
|
+
const local = installedCli();
|
|
65
|
+
const stamp = `${CLI_VERSION}:${local ? 'rsc' : 'npx'}`;
|
|
66
|
+
const stale = baseVersions[id] !== stamp;
|
|
63
67
|
if (stale && existsSync(dest)) rmSync(dest, { recursive: true, force: true });
|
|
64
68
|
if (!existsSync(dest)) {
|
|
65
69
|
mkdirSync(dirname(dest), { recursive: true });
|
|
66
70
|
cpSync(join(ROOT, 'skills', id), dest, { recursive: true });
|
|
71
|
+
materializeCliInstructions(dest, local);
|
|
67
72
|
}
|
|
68
|
-
baseVersions[id] =
|
|
73
|
+
baseVersions[id] = stamp;
|
|
69
74
|
return dest;
|
|
70
75
|
}
|
|
71
76
|
|
|
@@ -83,7 +88,7 @@ export function generatedHookFiles({ target, cwd, policy }) {
|
|
|
83
88
|
join(cwd, '.rsc', 'worklog-checkpoint.mjs'),
|
|
84
89
|
join(cwd, '.rsc', 'hook-once.mjs'),
|
|
85
90
|
join(cwd, '.rsc', 'shell-unwrap.mjs'),
|
|
86
|
-
join(cwd, '.rsc', 'worktree-reaper.mjs'),
|
|
91
|
+
join(cwd, '.rsc', 'worktree-reaper.mjs'), join(cwd, '.rsc', 'risk-policy.mjs'),
|
|
87
92
|
join(cwd, '.rsc', 'auto-update.mjs'),
|
|
88
93
|
join(cwd, '.rsc', 'memslop-offer.mjs'),
|
|
89
94
|
// team-safe-default: the 3.0 start-up duties and the trunk policy (also read by branch-guard).
|
|
@@ -111,6 +116,10 @@ export function managedPathsForInstall({ skillIds, agentIds = [], target, home,
|
|
|
111
116
|
const paths = targetPaths(target, home, cwd);
|
|
112
117
|
const plan = planInstall({ skillIds, target, home, cwd, hooks: policy?.alwaysOn !== false });
|
|
113
118
|
const out = [paths.stateFile, versionFile(cwd), baseVersionsFile(cwd)];
|
|
119
|
+
// Knowledge/memory wiring also needs this shared dependency without suggest.
|
|
120
|
+
if (target === 'claude') out.push(claudeBootstrapPath(cwd));
|
|
121
|
+
// Pi can move its managed block when the native context-file precedence changes.
|
|
122
|
+
if (target === 'pi') out.push(...paths.contextFiles);
|
|
114
123
|
if (policy?.context7 === false) out.push(join(cwd, '.rsc', '.no-context7'));
|
|
115
124
|
if (policy?.memory !== false) out.push(...memoryManagedPaths(target, cwd));
|
|
116
125
|
out.push(...updateManagedPaths(target, cwd));
|
|
@@ -208,7 +217,7 @@ export function hydrateLocalDecisions(cwd, manifest) {
|
|
|
208
217
|
// into codex on a machine that already had claude is adding, not replacing. Union, sorted
|
|
209
218
|
// where order carries no meaning, so the file stays diffable and a merge conflict stays
|
|
210
219
|
// readable.
|
|
211
|
-
export function recordInManifest({ cwd, target, skillIds, agentIds = [], catalogVersion = CLI_VERSION, dropTarget, onboarding, gitPermissions }) {
|
|
220
|
+
export function recordInManifest({ cwd, target, skillIds, agentIds = [], catalogVersion = CLI_VERSION, dropTarget, onboarding, gitPermissions, preserveOptOuts = false, rearmOptOuts = [] }) {
|
|
212
221
|
const prev = readManifest(cwd) || { targets: [], skills: [], agents: [], ownSkills: [], optOuts: [] };
|
|
213
222
|
const { optOuts, tier } = localDecisions(cwd);
|
|
214
223
|
const union = (a, b) => [...new Set([...(a || []), ...(b || [])])].sort();
|
|
@@ -225,15 +234,16 @@ export function recordInManifest({ cwd, target, skillIds, agentIds = [], catalog
|
|
|
225
234
|
ownSkills: prev.ownSkills || [],
|
|
226
235
|
catalogVersion,
|
|
227
236
|
tier: tier ?? prev.tier ?? null,
|
|
228
|
-
optOuts: optOuts ?? projectOptOuts(prev.optOuts),
|
|
237
|
+
optOuts: preserveOptOuts ? union(projectOptOuts(prev.optOuts), optOuts).filter(name => !rearmOptOuts.includes(name)) : optOuts ?? projectOptOuts(prev.optOuts),
|
|
229
238
|
memory: prev.memory,
|
|
230
239
|
gitPermissions: gitPermissions ?? prev.gitPermissions,
|
|
231
240
|
agentModels: prev.agentModels,
|
|
241
|
+
worktreeManager: prev.worktreeManager,
|
|
232
242
|
onboarding: onboarding ?? prev.onboarding,
|
|
233
243
|
});
|
|
234
244
|
}
|
|
235
245
|
|
|
236
|
-
export async function applyInstall({ skillIds = [], agentIds = [], target, home, cwd = process.cwd(), operation = 'install', dryRun = false, policy, onboarding }) {
|
|
246
|
+
export async function applyInstall({ skillIds = [], agentIds = [], target, home, cwd = process.cwd(), operation = 'install', dryRun = false, policy, onboarding, rearmOptOuts = [] }) {
|
|
237
247
|
// Read BEFORE anything can create it — the backup writes under `.rsc/`, and one line later the
|
|
238
248
|
// answer would always be "yes, it exists". This single boolean is what separates a clone (the
|
|
239
249
|
// declaration is the only thing that knows what the team decided) from a built machine (the
|
|
@@ -369,7 +379,7 @@ export async function applyInstall({ skillIds = [], agentIds = [], target, home,
|
|
|
369
379
|
writeState(paths.stateFile, state);
|
|
370
380
|
mkdirSync(dirname(versionFile(cwd)), { recursive: true });
|
|
371
381
|
writeFileSync(versionFile(cwd), CLI_VERSION + '\n');
|
|
372
|
-
recordInManifest({ cwd, target, skillIds, agentIds, onboarding, gitPermissions });
|
|
382
|
+
recordInManifest({ cwd, target, skillIds, agentIds, onboarding, gitPermissions, preserveOptOuts: operation === 'sync', rearmOptOuts });
|
|
373
383
|
// The worktree cleanup's trigger. It lives in `.git/hooks/`, which is NOT cloned, so it has to be
|
|
374
384
|
// (re)written by every operation that touches a user's repo — install, sync and repair all land
|
|
375
385
|
// here. Target-agnostic on purpose: it is a git hook, not an assistant hook, and a cleanup that
|
|
@@ -389,6 +399,7 @@ export async function applyInstall({ skillIds = [], agentIds = [], target, home,
|
|
|
389
399
|
if (policy?.codeHooks === false) throw new Error('code hooks not governed by the accepted plan');
|
|
390
400
|
mkdirSync(join(cwd, '.rsc'), { recursive: true });
|
|
391
401
|
cpSync(join(ROOT, 'targets', 'worktree-reaper.mjs'), join(cwd, '.rsc', 'worktree-reaper.mjs'));
|
|
402
|
+
cpSync(join(ROOT, 'targets', 'risk-policy.mjs'), join(cwd, '.rsc', 'risk-policy.mjs'));
|
|
392
403
|
const { installMergeHook } = await import('../targets/worktree-reaper.mjs');
|
|
393
404
|
if (existsSync(join(cwd, '.git'))) mergeHook = installMergeHook(cwd);
|
|
394
405
|
} catch (err) { mergeHook = { installed: false, state: 'skipped', reason: err.message }; }
|
|
@@ -690,7 +701,7 @@ export function pruneSharedBases({ cwd = process.cwd(), skillIds = [] }) {
|
|
|
690
701
|
writeBaseVersions(cwd, versions);
|
|
691
702
|
}
|
|
692
703
|
|
|
693
|
-
export async function syncInstalled({ target, home, cwd = process.cwd(), dryRun = false }) {
|
|
704
|
+
export async function syncInstalled({ target, home, cwd = process.cwd(), dryRun = false, rearmOptOuts = [] }) {
|
|
694
705
|
const paths = targetPaths(target, home, cwd);
|
|
695
706
|
const state = readState(paths.stateFile);
|
|
696
707
|
// The per-target state is machine wiring and does not travel, so a fresh clone has
|
|
@@ -735,6 +746,7 @@ export async function syncInstalled({ target, home, cwd = process.cwd(), dryRun
|
|
|
735
746
|
home,
|
|
736
747
|
cwd,
|
|
737
748
|
operation: 'sync',
|
|
749
|
+
rearmOptOuts,
|
|
738
750
|
policy: manifest?.onboarding?.plan?.policy,
|
|
739
751
|
onboarding: manifest?.onboarding,
|
|
740
752
|
});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { accessSync, constants, statSync, readFileSync, writeFileSync, readdirSync } from 'node:fs';
|
|
2
|
+
import { join, isAbsolute } from 'node:path';
|
|
3
|
+
|
|
4
|
+
// Inspect PATH, never execute a candidate just to discover it. Ignore relative PATH
|
|
5
|
+
// entries: a checked-out executable is not evidence of an installed CLI.
|
|
6
|
+
export function installedCli({ env = process.env, platform = process.platform } = {}) {
|
|
7
|
+
const windows = platform === 'win32';
|
|
8
|
+
const names = windows ? ['rsc.exe', 'rsc.cmd', 'rsc.bat', 'rsc'] : ['rsc'];
|
|
9
|
+
for (const dir of (env.PATH || env.Path || '').split(windows ? ';' : ':')) {
|
|
10
|
+
if (!dir || !isAbsolute(dir)) continue;
|
|
11
|
+
// npm/npx inject these only for this process. They will not make `rsc`
|
|
12
|
+
// available in the assistant's next shell after installation finishes.
|
|
13
|
+
if (/(?:^|[\\/])_npx(?:[\\/]|$)|[\\/]node_modules[\\/]\.bin[\\/]?$/i.test(dir)) continue;
|
|
14
|
+
for (const name of names) {
|
|
15
|
+
try {
|
|
16
|
+
const file = join(dir, name);
|
|
17
|
+
if (!statSync(file).isFile()) continue;
|
|
18
|
+
accessSync(file, windows ? constants.F_OK : constants.X_OK);
|
|
19
|
+
return true;
|
|
20
|
+
} catch { /* absent, unreadable or not executable */ }
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function cliInstructions(text, local = installedCli()) {
|
|
27
|
+
// Explicit versions (including @latest) are deliberate choices, never rewritten.
|
|
28
|
+
return local ? text.replace(/\bnpx[ \t]+(?:-y[ \t]+)?@ericrisco\/rsc(?=[ \t`\n]|$)/g, 'rsc') : text;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function materializeCliInstructions(dir, local) {
|
|
32
|
+
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
33
|
+
const file = join(dir, entry.name);
|
|
34
|
+
if (entry.isDirectory()) materializeCliInstructions(file, local);
|
|
35
|
+
else if (entry.isFile() && entry.name.endsWith('.md')) {
|
|
36
|
+
const before = readFileSync(file, 'utf8');
|
|
37
|
+
let after = cliInstructions(before, local);
|
|
38
|
+
if (local && entry.name === 'SKILL.md' && /\nname: suggest\n/.test(before)) {
|
|
39
|
+
after += '\n**Installed CLI.** Use `rsc` for unversioned `npx @ericrisco/rsc` commands, including commands suggested by hooks. Explicit package versions stay pinned. If `rsc` disappears from PATH, run sync with the declared package version to refresh these instructions. This does not grant execution permissions.\n';
|
|
40
|
+
}
|
|
41
|
+
if (after !== before) writeFileSync(file, after);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -15,7 +15,7 @@ import { join } from 'node:path';
|
|
|
15
15
|
export const MANIFEST = '.rsc.json';
|
|
16
16
|
export const manifestPath = (cwd = process.cwd()) => join(cwd, MANIFEST);
|
|
17
17
|
|
|
18
|
-
const KEYS = ['version', 'targets', 'skills', 'agents', 'ownSkills', 'catalogVersion', 'tier', 'optOuts', 'memory', 'gitPermissions', 'agentModels', 'onboarding'];
|
|
18
|
+
const KEYS = ['version', 'targets', 'skills', 'agents', 'ownSkills', 'catalogVersion', 'tier', 'optOuts', 'memory', 'gitPermissions', 'agentModels', 'worktreeManager', 'onboarding'];
|
|
19
19
|
|
|
20
20
|
export function readManifest(cwd = process.cwd()) {
|
|
21
21
|
const file = manifestPath(cwd);
|
|
@@ -43,6 +43,7 @@ export function readManifest(cwd = process.cwd()) {
|
|
|
43
43
|
// #298 — per-target agent model: { opencode: 'openai/gpt-5' | 'inherit' }. Only plain objects of
|
|
44
44
|
// strings survive the read; what each value may contain is checked where it is rendered.
|
|
45
45
|
agentModels: agentModelsFrom(raw.agentModels),
|
|
46
|
+
worktreeManager: raw.worktreeManager === 'orca' ? 'orca' : undefined,
|
|
46
47
|
onboarding: raw.onboarding ?? undefined,
|
|
47
48
|
};
|
|
48
49
|
}
|
package/scripts/lib/risk.js
CHANGED
|
@@ -16,8 +16,7 @@ const nul = (out) => (out || '').split('\0').filter(Boolean);
|
|
|
16
16
|
|
|
17
17
|
// Every path that differs from the base (committed, staged, unstaged or untracked). The base is the
|
|
18
18
|
// merge-base with `--base`, or with the trunk when none is given.
|
|
19
|
-
export function changedPaths(root, base = null) {
|
|
20
|
-
const cfg = readEffectiveConfig(root);
|
|
19
|
+
export function changedPaths(root, base = null, cfg = readEffectiveConfig(root)) {
|
|
21
20
|
const ref = base || trunkRef(root, cfg);
|
|
22
21
|
if (!ref) return { ok: false, message: 'rsc: no base to compare against. Pass --base <ref> or the paths themselves: npx @ericrisco/rsc risk <path…>' };
|
|
23
22
|
const head = git(root, ['rev-parse', 'HEAD']);
|
|
@@ -45,8 +44,8 @@ export function changedPaths(root, base = null) {
|
|
|
45
44
|
|
|
46
45
|
// `texts` is what the change adds per path (sello.changeText): content signals raise a path that its
|
|
47
46
|
// name alone would leave at tier 1 — auth code in `src/app.js`.
|
|
48
|
-
export function assess(paths, cfg = null, texts = {}) {
|
|
49
|
-
const { tier, classes, configError, content } = classifyChange(paths, texts, cfg);
|
|
47
|
+
export function assess(paths, cfg = null, texts = {}, details = {}) {
|
|
48
|
+
const { tier, classes, configError, content, rules } = classifyChange(paths, texts, cfg, details);
|
|
50
49
|
return {
|
|
51
50
|
tier,
|
|
52
51
|
classes: [...new Set(Object.values(classes))].sort(),
|
|
@@ -56,6 +55,7 @@ export function assess(paths, cfg = null, texts = {}) {
|
|
|
56
55
|
escalate: tier >= 2 ? 'asdd' : null,
|
|
57
56
|
paths: classes,
|
|
58
57
|
content,
|
|
58
|
+
rules,
|
|
59
59
|
...(configError ? { configError } : {}),
|
|
60
60
|
};
|
|
61
61
|
}
|
|
@@ -69,6 +69,8 @@ export function render(r) {
|
|
|
69
69
|
`human approval: ${r.humanApproval ? 'required' : 'not required'}`,
|
|
70
70
|
...(r.base ? [`base: ${r.base}`] : []),
|
|
71
71
|
...(r.escalate ? ['escalate: asdd — tier 2 needs a spec linked to this branch (`branch: <name>` in its frontmatter) that passes `npx @ericrisco/rsc spec gate`; push and PR are refused until it exists. Write it now, before more code.'] : []),
|
|
72
|
+
...(r.policySource ? [`policy: ${r.policySource}`] : []),
|
|
73
|
+
...(r.rules || []).map(r => ` rule: ${r.class} in ${r.path}: ${r.because}`),
|
|
72
74
|
...(r.configError ? [`config ignored: ${r.configError}`] : []),
|
|
73
75
|
...(r.content || []).slice(0, 10).map((h) => ` content: ${h.class} in ${h.path} ("${h.match}")`),
|
|
74
76
|
...top.slice(0, 20).map(([p, c]) => ` ${c.padEnd(10)} ${p}`),
|
package/scripts/rsc.js
CHANGED
|
@@ -78,6 +78,13 @@ const GLOBAL_VALUE_FLAGS = new Set([
|
|
|
78
78
|
'--topic', '--target', '--technical-level', '--accompaniment', '--project-kind', '--goal', '--goal-base64', '--software-scope', '--workflow', '--accept-plan',
|
|
79
79
|
]);
|
|
80
80
|
const COMMANDS = new Set(['ingest', 'copy', 'onboard', 'reassess', 'add', 'install', 'consult', 'catalog', 'audit', 'list', 'doctor', 'memory', 'knowledge-sync', 'git-permissions', 'agent-model', 'agents', 'main', 'isolation', 'sync', 'backups', 'restore', 'upgrade', 'registry', 'worktrees', 'capabilities', 'review', 'risk', 'spec', 'sello', 'repair', 'uninstall', 'purge']);
|
|
81
|
+
// Sync preserves project decisions. Only these explicit transitions clear an opt-out;
|
|
82
|
+
// a missing local marker alone does not revoke a teammate's declared decision.
|
|
83
|
+
const EXPLICIT_REARMS = {
|
|
84
|
+
main: { lock: ['trunk-guard'], unlock: ['trunk-open'] },
|
|
85
|
+
isolation: { on: ['worktree-isolation'] },
|
|
86
|
+
'knowledge-sync': { on: ['knowledge-sync'] },
|
|
87
|
+
};
|
|
81
88
|
function positionalTokens(input) {
|
|
82
89
|
const out = [];
|
|
83
90
|
for (let i = 0; i < input.length; i++) {
|
|
@@ -920,7 +927,8 @@ async function main() {
|
|
|
920
927
|
const lock = join(root, '.rsc', '.no-trunk-open');
|
|
921
928
|
if (sub === ON) writeFileSync(lock, ''); else rmSync(lock, { force: true });
|
|
922
929
|
}
|
|
923
|
-
|
|
930
|
+
const rearmOptOuts = EXPLICIT_REARMS[cmd]?.[sub] || [];
|
|
931
|
+
for (const t of targets) await syncInstalled({ target: t, cwd: root, rearmOptOuts });
|
|
924
932
|
say(isMain
|
|
925
933
|
? (sub === OFF
|
|
926
934
|
? 'rsc main unlock: the agent may now work on the default branch in this project. Commit .rsc.json so the team gets the same decision.'
|
|
@@ -954,7 +962,8 @@ async function main() {
|
|
|
954
962
|
mkdirSync(join(root, '.rsc'), { recursive: true });
|
|
955
963
|
if (sub === 'off') writeFileSync(marker, '');
|
|
956
964
|
else rmSync(marker, { force: true });
|
|
957
|
-
|
|
965
|
+
const rearmOptOuts = EXPLICIT_REARMS[cmd]?.[sub] || [];
|
|
966
|
+
for (const t of targets) await syncInstalled({ target: t, cwd: root, rearmOptOuts });
|
|
958
967
|
say(sub === 'off'
|
|
959
968
|
? 'rsc knowledge-sync off: 01-TOOLS/ and 02-DOCS/ no longer sync on their own in this project. Commit .rsc.json so the team gets the same decision.'
|
|
960
969
|
: 'rsc knowledge-sync on: 01-TOOLS/ and 02-DOCS/ go up when a turn ends and come down before each message. Commit .rsc.json so the team gets the same decision.');
|
|
@@ -1237,6 +1246,28 @@ async function main() {
|
|
|
1237
1246
|
// script inside this package, so the one check ASDD's spec depends on could not run where specs live.
|
|
1238
1247
|
const USE = 'Use: npx @ericrisco/rsc spec gate [spec.md ...]\n Without paths it checks 02-DOCS/wiki/sdd/specs/ of this project. Exits 1 when a spec fails.';
|
|
1239
1248
|
if (argv[1] !== 'gate') { say(USE); if (argv[1]) process.exitCode = 1; return; }
|
|
1249
|
+
if (argv.includes('--branch-check')) {
|
|
1250
|
+
const S = await import('../targets/sello.mjs');
|
|
1251
|
+
const { branchCheck } = await import('../targets/asdd-gate.mjs');
|
|
1252
|
+
const { specCompleteness } = await import('../targets/spec-completeness.mjs');
|
|
1253
|
+
const { git } = await import('../targets/risk-policy.mjs');
|
|
1254
|
+
const { resolve, relative, isAbsolute } = await import('node:path');
|
|
1255
|
+
const rawRepo = flag('repo'); const branch = flag('branch');
|
|
1256
|
+
try {
|
|
1257
|
+
if (rawRepo === true || branch === true) throw new Error('--repo and --branch require values');
|
|
1258
|
+
const at = typeof rawRepo === 'string' ? resolve(rawRepo) : process.cwd();
|
|
1259
|
+
const repo = (git(at, 'rev-parse', '--show-toplevel') || '').trim();
|
|
1260
|
+
if (!repo) throw new Error('not a Git repository; pass --repo <directory>');
|
|
1261
|
+
if (branch && (branch.startsWith('-') || git(repo, 'rev-parse', '--verify', '--quiet', `${branch}^{commit}`) === null)) throw new Error('unknown branch; pass an existing branch name');
|
|
1262
|
+
const caller = (git(process.cwd(), 'rev-parse', '--show-toplevel') || '').trim();
|
|
1263
|
+
const offset = caller ? relative(caller, repo) : '..';
|
|
1264
|
+
const workspace = caller && !isAbsolute(offset) && offset !== '..' && !offset.startsWith('../') && !offset.startsWith('..\\')
|
|
1265
|
+
? S.policyRoot(caller) : S.policyRoot(repo);
|
|
1266
|
+
const denial = branchCheck(workspace, repo, { sello: S, specCompleteness }, { branch, strict: true });
|
|
1267
|
+
say(denial || 'RSC_BRANCH_CHECK_PASS'); process.exitCode = denial ? 2 : 0;
|
|
1268
|
+
} catch (e) { say(`RSC_BRANCH_CHECK_ERROR: ${e.message}`); process.exitCode = 1; }
|
|
1269
|
+
return;
|
|
1270
|
+
}
|
|
1240
1271
|
const { spawnSync } = await import('node:child_process');
|
|
1241
1272
|
const { fileURLToPath: toPath } = await import('node:url');
|
|
1242
1273
|
const rest = argv.slice(2);
|
|
@@ -1251,6 +1282,10 @@ async function main() {
|
|
|
1251
1282
|
const K = await import('./lib/risk.js');
|
|
1252
1283
|
const S = await import('../targets/sello.mjs');
|
|
1253
1284
|
const root = S.resolveRoot(process.cwd());
|
|
1285
|
+
const workspace = S.policyRoot(root);
|
|
1286
|
+
const local = S.readEffectiveConfig(workspace);
|
|
1287
|
+
const policy = S.readPolicy(root, { workspace, localConfig: local, preview: argv.includes('--policy-preview') });
|
|
1288
|
+
const cfg = S.mergePolicyConfig(local, policy);
|
|
1254
1289
|
const base = flag('base');
|
|
1255
1290
|
if (base === true) { say('Use: npx @ericrisco/rsc risk [--base <ref>] [paths…] [--json]'); process.exitCode = 1; return; }
|
|
1256
1291
|
const rest = argv.slice(1);
|
|
@@ -1264,7 +1299,7 @@ async function main() {
|
|
|
1264
1299
|
let against = null;
|
|
1265
1300
|
let from = null;
|
|
1266
1301
|
if (!given.length) {
|
|
1267
|
-
const c = K.changedPaths(root, base || null);
|
|
1302
|
+
const c = K.changedPaths(root, base || null, cfg);
|
|
1268
1303
|
if (!c.ok) { say(c.message); process.exitCode = 1; return; }
|
|
1269
1304
|
paths = c.paths;
|
|
1270
1305
|
against = c.base;
|
|
@@ -1272,7 +1307,7 @@ async function main() {
|
|
|
1272
1307
|
}
|
|
1273
1308
|
// Given paths are read whole (a forecast or a single file); a diff contributes its added lines.
|
|
1274
1309
|
const texts = S.changeText(root, from, paths);
|
|
1275
|
-
const r = { ...K.assess(paths, S.
|
|
1310
|
+
const r = { ...K.assess(paths, cfg, texts, S.changeDetails(root, from, paths)), policySource: policy.source, ...(against ? { base: against } : {}) };
|
|
1276
1311
|
say(argv.includes('--json') ? JSON.stringify(r, null, 2) : K.render(r));
|
|
1277
1312
|
return;
|
|
1278
1313
|
}
|
|
@@ -86,6 +86,12 @@ Only once the tree state is understood and the user's WIP is accounted for do yo
|
|
|
86
86
|
|
|
87
87
|
## Creating the workspace — native first, git fallback
|
|
88
88
|
|
|
89
|
+
**Orca-managed project:** use Orca's lifecycle instead; do not bypass its setup or teardown hooks
|
|
90
|
+
with a native assistant worktree tool or plain Git. Follow [Orca setup and cleanup](references/orca.md).
|
|
91
|
+
Declare `"worktreeManager": "orca"` in `.rsc.json` so cleanup retains these checkouts even on a
|
|
92
|
+
machine without the Orca CLI. A shared worktree or parent/child relationship alone does not prove
|
|
93
|
+
that two agent sessions belong to the same task; verify their identities before sharing changes.
|
|
94
|
+
|
|
89
95
|
**Prefer the native worktree tool when it's available in your environment.** An `EnterWorktree`-style
|
|
90
96
|
tool typically creates an isolated worktree (often under something like `.claude/worktrees/`, though
|
|
91
97
|
the exact location is tool-dependent), switches the session into it, and tracks it for clean exit —
|
|
@@ -34,6 +34,13 @@ should_not_trigger:
|
|
|
34
34
|
why: "Bootstrapping the workspace control plane is the harness skill; nothing to do with git isolation for a feature."
|
|
35
35
|
|
|
36
36
|
capability:
|
|
37
|
+
- scenario: "The project uses Orca, creates worktrees on origin/develop, and runs setup and teardown hooks. Another session is active in this checkout. Create independent work and explain cleanup."
|
|
38
|
+
must_include:
|
|
39
|
+
- "Checks Orca's returned checkout path and actual session identities; workspace lineage alone never suppresses a concurrency warning"
|
|
40
|
+
- "Uses orca worktree create with --no-parent and the declared origin/develop base, then waits for setup"
|
|
41
|
+
- "Runs sync with the exact catalogVersion in .rsc.json, never @latest, and stops setup on failure"
|
|
42
|
+
- "Declares worktreeManager: orca so rsc retains externally managed checkouts even without the CLI"
|
|
43
|
+
- "Uses Orca removal with --run-hooks after verifying the worktree is safe; never plain git worktree remove"
|
|
37
44
|
- scenario: "User says: 'I'm on main with a clean tree, the plan for the order-reservation feature (slug: order-reservation) is approved, and I'm about to implement it. My editor and a dev server are open against the current files. Set up isolation.' The agent has the worktrees skill loaded and a native worktree tool available."
|
|
38
45
|
must_include:
|
|
39
46
|
- "Runs the pre-flight gate: confirms it's a git repo, checks current branch (main), and checks `git status --short` for tree state before creating anything"
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Worktrees managed by Orca
|
|
2
|
+
|
|
3
|
+
Orca tracks the checkout and runs its preparation and teardown hooks. Use its lifecycle when the
|
|
4
|
+
project declares `"worktreeManager": "orca"` in `.rsc.json`, or the CLI identifies the checkout.
|
|
5
|
+
The setting protects all linked checkouts in that project, including clones without Orca installed.
|
|
6
|
+
It does not grant permission to remove anything.
|
|
7
|
+
|
|
8
|
+
## Inspect and create
|
|
9
|
+
|
|
10
|
+
Run `orca worktree current --json` from the checkout. Check that `result.worktree.path` resolves to
|
|
11
|
+
that checkout; caller context can otherwise select another workspace. If the command fails, inspect
|
|
12
|
+
the runtime or configuration; do not infer ownership from a branch name or `.worktrees/` location.
|
|
13
|
+
|
|
14
|
+
For independent work, use `orca worktree create --name <task> --no-parent --json`. Outside an
|
|
15
|
+
unambiguous managed project, add `--repo id:<repoId>` using a previously inspected repository ID.
|
|
16
|
+
When the project specifies a base such as `origin/develop`, add `--base-branch origin/develop`.
|
|
17
|
+
Use the path returned by Orca rather than guessing where the checkout was created. Wait for the
|
|
18
|
+
preparation hooks to finish before starting implementation; use Orca's
|
|
19
|
+
`setupAgentStartupPolicy: wait-for-setup` when the installed version supports it.
|
|
20
|
+
|
|
21
|
+
## Rebuild the declared harness during setup
|
|
22
|
+
|
|
23
|
+
The non-interactive entry point is `sync` from the new checkout. Read `catalogVersion` from its
|
|
24
|
+
committed `.rsc.json`, validate it as an exact version, and invoke that version. Do not substitute
|
|
25
|
+
`@latest`. For a PowerShell setup hook:
|
|
26
|
+
|
|
27
|
+
```powershell
|
|
28
|
+
$manifest = Get-Content -LiteralPath .rsc.json -Raw -Encoding UTF8 | ConvertFrom-Json
|
|
29
|
+
$rscVersion = $manifest.catalogVersion
|
|
30
|
+
if ($rscVersion -notmatch '^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$') {
|
|
31
|
+
throw 'Set an exact catalogVersion in .rsc.json before running setup.'
|
|
32
|
+
}
|
|
33
|
+
npx -y "@ericrisco/rsc@$rscVersion" sync
|
|
34
|
+
if ($LASTEXITCODE -ne 0) { throw 'Harness setup failed; do not start the agent yet.' }
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Use the same exact version with a preinstalled `rsc` executable if the environment disallows npx.
|
|
38
|
+
Keep credential copying and submodule setup in the project's existing Orca hooks; rsc does not
|
|
39
|
+
need to read those credentials or replace those scripts.
|
|
40
|
+
|
|
41
|
+
## Concurrent sessions
|
|
42
|
+
|
|
43
|
+
Inspect the worktree and the actual agent sessions before sharing a checkout. `parentWorktreeId`,
|
|
44
|
+
`childWorktreeIds`, `lineage` and `creatorProvenance` describe workspaces, not proof that every
|
|
45
|
+
active session belongs to the current task. rsc therefore keeps the concurrency warning and gives
|
|
46
|
+
Orca-specific instructions. It does not automatically suppress unrelated sessions based on lineage.
|
|
47
|
+
If session identity cannot be verified, create a separate Orca worktree for the independent task.
|
|
48
|
+
|
|
49
|
+
## Clean up
|
|
50
|
+
|
|
51
|
+
rsc retains Orca-owned checkouts, including when `rsc worktrees reap --confirm` is requested.
|
|
52
|
+
After checking integration, pending changes, ignored files and submodules, use:
|
|
53
|
+
|
|
54
|
+
```text
|
|
55
|
+
orca worktree rm --worktree "path:<absolute-checkout-path>" --run-hooks --json
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
The quotes preserve paths with spaces. Check `orca worktree rm --help` for the installed version
|
|
59
|
+
before using it; if hook execution is unavailable, resolve that with Orca rather than substituting
|
|
60
|
+
`git worktree remove`. rsc does not execute this removal itself. Timeouts, invalid CLI output or a
|
|
61
|
+
different returned path make rsc retain the checkout until ownership can be verified.
|
|
62
|
+
|
|
63
|
+
Sources checked 2026-11-11: [Orca CLI reference](https://www.onorca.dev/docs/cli/reference),
|
|
64
|
+
[upstream CLI guide](https://github.com/stablyai/orca/blob/main/skill-guides/orca-cli.md).
|