oc-harness-setup 1.0.0 → 1.0.1

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/CHANGELOG.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [1.0.1] - 2026-11-01
6
+
5
7
  ## [1.0.0] - 2026-10-31
6
8
 
7
9
  ### Breaking
package/GLOSSARY.md CHANGED
@@ -6,7 +6,7 @@
6
6
  Not a reading list or bibliography of everything consulted.
7
7
  **capability envelope** — The reach an agent is allowed: what it may read, write, run, and fetch.
8
8
  Not a role, personality, or craft specialty.
9
- **doctor** — The install-time gate (`scripts/harness-doctor.ps1`) checking the pack's shape laws.
9
+ **doctor** — The install-time gate (`scripts/harness-doctor.mjs`) checking the pack's shape laws.
10
10
  Not a prose enforcer; it gates what was installed, never how a sentence reads.
11
11
  **drift** — A rule or fact that aged out of agreement with the tree, accepted openly.
12
12
  Not a regression; only a doctor FAIL is a regression.
package/README.md CHANGED
@@ -8,23 +8,33 @@ A compact OpenCode starter that runs a real loop, researches before it claims, k
8
8
  npx --yes oc-harness-setup setup
9
9
  ```
10
10
 
11
- First run prints a manifest of everything it will touch and waits for you to type `y`. It then lays the agents, commands, skills, references, doctor gate, and merged base config into your OpenCode config dir, seeds your state dir, and ends on the harness doctor gate. `setup --dry-run` prints the same manifest and touches nothing.
11
+ First run prints a manifest of everything it will touch and waits for you to type `y`.
12
12
 
13
- ## What it does
13
+ ## What you get
14
14
 
15
- - Lays down a working OpenCode setup: 10 seats, 6 skills, and 12 on-demand references.
16
- - Closes the loop: brief -> seat -> skill -> evidence -> verify -> memory, with no self-verdicts.
17
- - Researches before it claims: a finding arrives sourced or marked unverified.
18
- - Keeps your model, provider, keys, and state across upgrades, and reverses cleanly on uninstall.
19
- - Grows with you: one skill, command, reference, seat, or config change at a time.
15
+ | Capability | What it does for you |
16
+ | --- | --- |
17
+ | Ten seats on one routing table | Gives every agent a trigger, an owned path set, and a check, so the verdict never comes from the author. |
18
+ | Six skills behind six commands | Ships close, evolve, fast, loop, search and swarm, each loadable on its own trigger. |
19
+ | Twelve on-demand references | Loads one index and then only the file a rule names, instead of a wall of standing instructions. |
20
+ | Doctor gate | Ends every setup run on an 18-law check that names the failing law and the fix. |
21
+ | Consent-first install | Prints the full manifest before anything moves, and `--dry-run` changes nothing at all. |
22
+ | Settings that survive | Keeps your model, provider, keys, plugins and state while the pack owns runtime policy. |
23
+ | Reversible by journal | Records SHA-256 per file, so `--uninstall` restores what was there and removes exactly what it added. |
24
+ | Grows with you | `evolve` turns a repeated workflow into one skill, command, reference, seat, or config change. |
20
25
 
21
26
  ## Requirements
22
27
 
23
- Windows 10/11 only, with Node.js 22 or newer and OpenCode 2.2.0 or newer (the tested floor). A 2.0/2.1 host warns before installing — its `permissions[]`/`policies[]` deny gate is not proven there — and a 1.x host is refused before anything is written.
28
+ Windows 10/11 with Node.js 22 or newer and OpenCode 2.2.0 or newer: a 2.0/2.1 host warns before installing, and a 1.x host is refused before anything is written.
24
29
 
25
- ## Full documentation
30
+ ## Going deeper
26
31
 
27
- - Guide: <https://github.com/nathwn12/oc-collections/blob/main/packages/oc-harness-setup/docs/GUIDE.md>
28
- - Package: <https://www.npmjs.com/package/oc-harness-setup>
32
+ The manual at <https://github.com/nathwn12/oc-collections/blob/main/packages/oc-harness-setup/docs/GUIDE.md> covers the full command list and its exit codes, every environment variable, what the doctor gate checks, the safe upgrade path, and how `evolve` grows the setup.
29
33
 
30
- The guide covers the full command list, the safe upgrade path, what the doctor gate checks, and how `evolve` grows the setup. It also links the changelog, the licence, and the issue tracker.
34
+ <!-- nathwn12 house footer: identical in every repo. Do not edit. -->
35
+ <p align="center">
36
+ <a href="https://github.com/nathwn12"><img src="assets/signature.svg" width="96" alt="nathwn12" /></a>
37
+ </p>
38
+ <p align="center">
39
+ <sub>Built by <a href="https://github.com/nathwn12">nathwn12</a> · <a href="https://github.com/nathwn12?tab=repositories">All projects</a></sub>
40
+ </p>
package/bin/cli.js CHANGED
@@ -206,7 +206,7 @@ function bail(msg) {
206
206
  }
207
207
 
208
208
  // Windows 10/11 only. This installer writes the Windows config home, runs
209
- // PowerShell doctors, and registers Windows shell policy — there is no
209
+ // the Node doctor, and registers Windows shell policy — there is no
210
210
  // macOS/Linux path. --help and --version return from parseArgs before any
211
211
  // dispatch, so they keep working everywhere.
212
212
  function assertWindows() {
@@ -940,32 +940,18 @@ function lintPackagedSource(files) {
940
940
 
941
941
  /* --------------------------------- doctor ---------------------------------- */
942
942
 
943
- function pwshProbe() {
944
- const probe = exec('pwsh', ['-NoProfile', '-Command', 'exit 0'], true);
945
- return { usable: !(probe.error || probe.status !== 0) };
946
- }
947
-
948
943
  function doctorPlan() {
949
- return pwshProbe().usable
950
- ? 'run scripts/harness-doctor.ps1 via pwsh'
951
- : 'pwsh missing — doctor SKIPPED, 18 laws UNVERIFIED (warned + journaled)';
944
+ return 'run scripts/harness-doctor.mjs via node';
952
945
  }
953
946
 
954
- function runDoctor(configDir, probe) {
955
- if (!probe.usable) {
956
- console.warn('[doctor] WARNING: pwsh (PowerShell 7) was not found — harness-doctor did NOT run, so the 18 laws are UNVERIFIED.');
957
- console.warn('[doctor] Your config still landed, and the skip is recorded in the manifest. To verify later:');
958
- console.log(' winget install --id Microsoft.PowerShell --source winget (Windows)');
959
- console.log(' then re-run: npx oc-harness-setup setup');
960
- return { code: 0, skipped: true };
961
- }
962
- const script = path.join(configDir, 'scripts', 'harness-doctor.ps1');
947
+ function runDoctor(configDir) {
948
+ const script = path.join(configDir, 'scripts', 'harness-doctor.mjs');
963
949
  if (!existsSync(script)) {
964
950
  console.warn(`[doctor] WARNING: ${script} not found — harness-doctor did NOT run, so the 18 laws are UNVERIFIED.`);
965
951
  return { code: 0, skipped: true };
966
952
  }
967
953
  log('doctor', `running ${script}`);
968
- const res = exec('pwsh', ['-NoProfile', '-File', script, '-ConfigDir', configDir], false);
954
+ const res = exec(process.execPath, [script, '-ConfigDir', configDir], false);
969
955
  if (res.error || res.status !== 0) {
970
956
  log(
971
957
  'doctor',
@@ -1403,7 +1389,6 @@ async function setup(opts) {
1403
1389
  // already been mutated by the previous install, so restoring from it would be
1404
1390
  // a lie. Keep the original pointer; chain the new snapshot as priorBackup.
1405
1391
  const backupPath = prior && prior.backupPath ? prior.backupPath : newBackupPath;
1406
- const doctorProbe = pwshProbe(); // read-only probe
1407
1392
  printManifest(configDir, files, backupPath, doctorPlan(), prior);
1408
1393
 
1409
1394
  // (F2: --dry-run / --ci already returned print-only before preflight.)
@@ -1441,11 +1426,11 @@ async function setup(opts) {
1441
1426
  mergeJsonc(configDir, backup, manifest, retiredSkills, prior);
1442
1427
 
1443
1428
  // R6: record the skip in the journal so "all 18 laws unrun" is never silent.
1444
- manifest.doctorSkipped = !doctorProbe.usable || !existsSync(path.join(configDir, 'scripts', 'harness-doctor.ps1'));
1429
+ manifest.doctorSkipped = !existsSync(path.join(configDir, 'scripts', 'harness-doctor.mjs'));
1445
1430
  writeManifest(configDir, manifest);
1446
1431
  log('manifest', `journal written: ${path.join(configDir, MANIFEST_FILE)}`);
1447
1432
 
1448
- const doctorResult = runDoctor(configDir, doctorProbe);
1433
+ const doctorResult = runDoctor(configDir);
1449
1434
  if (doctorResult.code !== 0) return 1;
1450
1435
 
1451
1436
  console.log();
@@ -1457,7 +1442,7 @@ async function setup(opts) {
1457
1442
  }
1458
1443
  console.log(` backup : ${manifest.backupPath}${manifest.priorBackup ? `\n snapshot : ${manifest.priorBackup} (chained — backup() pointer above is the original)` : ''}`);
1459
1444
  if (manifest.doctorSkipped) {
1460
- console.log(' doctor : ⚠ SKIPPED — the 18 laws were NOT verified (journaled as doctorSkipped; install PowerShell 7 and re-run to verify)');
1445
+ console.log(' doctor : ⚠ SKIPPED — the 18 laws were NOT verified (journaled as doctorSkipped; re-run setup to verify)');
1461
1446
  }
1462
1447
  console.log(' undo : npx oc-harness-setup setup --uninstall');
1463
1448
  console.log(' restart : restart your OpenCode session so the new agents/commands/skills load.');
package/docs/GUIDE.md CHANGED
@@ -1,45 +1,56 @@
1
- <h1 align="center">oc-harness-setup</h1>
2
- <p align="center"><strong>A compact OpenCode starter that runs a real loop, researches before it claims, keeps a ledger, cleans up after itself, and grows the next skill you need.</strong></p>
1
+ <h1 align="center">oc-harness-setup guide</h1>
3
2
 
4
- ## Install
3
+ ## How it works
5
4
 
6
- ```bash
7
- npx --yes oc-harness-setup setup
8
- ```
5
+ `setup` is a one-shot installer, not a runtime. It reads a file manifest, prints it, waits for your `y`, then writes into your OpenCode config directory. It ships no plugin and starts no process: everything it lays down is markdown, JSON, and one doctor script that Node runs.
6
+
7
+ **What lands where.** The config dir receives `opencode.jsonc` (merged, never replaced), `AGENTS.md`, `agents/` (10 seats), `commands/` (6 commands), `skills/` (6 skills), `reference/` (12 on-demand files behind one index), `scripts/harness-doctor.mjs`, `gitignore.template`, and `.docs/`. Your state dir is seeded once with `state/lessons.md` and `state/template.md` and is never overwritten afterwards.
8
+
9
+ **The loop it installs.** Brief → seat → skill → evidence → verify → memory. One routing table in `reference/flow.md` gives each seat its trigger, owned paths, and check. The verifier never authored the work it grades, and no seat certifies its own output.
10
+
11
+ **Consent gate.** The full manifest prints before anything moves: destination, incoming file count, and the policy line naming how many files update in place, how many are kept beside a `.new` copy, how many are added, and how many are skipped as identical. Nothing is written until you type `y`; `--dry-run` prints the same manifest and exits.
9
12
 
10
- First run prints a manifest of everything it will touch and waits for you to type `y`. It then lays the agents, commands, skills, references, doctor gate, and merged base config into your OpenCode config dir, seeds your `state/` dir, and ends on the harness doctor gate.
13
+ **Merge policy.** Your config is merged, not replaced. The pack owns runtime policy — the `permissions[]`/`policies[]` deny block, `default_agent: orchestrator`, and the skill allow entries — while your model, provider, keys, MCP servers, plugins and any other key survive untouched. A key you set that the pack also owns is reported rather than silently overruled.
11
14
 
12
- ## Why this starter
15
+ **Journal and uninstall.** Every written path is recorded in `oc-harness-setup.manifest.json` inside the config dir, with a SHA-256 per file. `setup --uninstall` reads that manifest and removes exactly what it lists, restoring the pre-install originals from its backup path.
13
16
 
14
- - Small on purpose: 10 seats, 6 skills, 12 on-demand references; the primary loads one, the rest wait for a trigger.
15
- - A loop that closes: brief -> seat -> skill -> evidence -> verify -> memory; no self-verdicts.
16
- - Research that cites: research-agent + search + canon; claims arrive sourced or `UNVERIFIED`.
17
- - Memory that survives: memory-agent writes dated lessons to `state/lessons.md` (superseded ones move to `state/archive/`); your `state/` is seeded and preserved on upgrade.
18
- - Cleanup that ships: leave-no-trail hygiene removes this session's scratch and proves the tree clean at close.
19
- - Grows with you: `evolve` turns a repeated workflow, a user request, or an upstream feature into a skill, command, reference, seat, or config change — 1:1 and doctor-checked.
20
- - Reversible and fail-closed: manifest first, SHA-256 journal, uninstall restores originals, hard denies last.
17
+ **Doctor gate.** Every setup run ends by running `scripts/harness-doctor.mjs` against the config dir. It grades 18 laws and names the failing law with the fix. A failing doctor exits non-zero, and re-running setup is idempotent, so the recipe is: read the named fix, apply it, run again.
21
18
 
22
- ## What you get
19
+ ## Configuration
23
20
 
24
- - 10 seats with named seams: one routing table in `reference/flow.md` gives each seat its trigger, owned paths, and check; the verdict never comes from the author.
25
- - 6 skills behind 6 commands: close, evolve, fast, loop, search, and swarm.
26
- - 12 on-demand references behind a single index; load only the file a rule names.
27
- - 18-law doctor gate: every setup run ends on it, and failures name the check and the fix.
28
- - Consent-first install: the full manifest prints before anything moves, and `--dry-run` changes nothing.
29
- - Your settings and state survive: your model, provider, and keys are preserved while the pack owns runtime policy, and your state dir survives upgrades untouched.
30
- - No plugin, no model pins, no credentials.
21
+ Two environment variables, and the config keys the pack owns.
22
+
23
+ | Variable | Default | Effect |
24
+ | --- | --- | --- |
25
+ | `OPENCODE_CONFIG_DIR` | the path the OpenCode CLI reports, else the platform default under your config home | Overrides the config dir. Use it when the CLI cannot report a path. A relative value is rejected because the host echoes it verbatim. |
26
+ | `OPENCODE_CONFIG` | unset | The host's own single-file config pointer, honoured when present so the installer targets the config the host actually reads. |
27
+
28
+ | Key in `opencode.jsonc` | What the pack sets | Why |
29
+ | --- | --- | --- |
30
+ | `default_agent` | `orchestrator` | The routing seat is the entry point; an existing 0.3.x config keeps resolving. |
31
+ | `permissions[]` / `policies[]` | The deny block, last | Hard denies land after your rules so the gate cannot be widened by ordering. |
32
+ | `skill` allow entries | The six shipped skills | Retired skills are pruned; custom skills are left alone. |
33
+
34
+ Everything else in that file is yours. There are no model pins and no credentials anywhere in the pack.
31
35
 
32
36
  ## Commands
33
37
 
38
+ | Command | Arguments | What it returns | Exit |
39
+ | --- | --- | --- | --- |
40
+ | `oc-harness-setup setup` | none (the default when you pass no command) | Prints the manifest, waits for `y`, installs, ends on the doctor gate | `0` on a clean install, `1` when the doctor fails or an argument is unknown |
41
+ | `oc-harness-setup setup --dry-run` | — | The same manifest, and nothing is written | `0` |
42
+ | `oc-harness-setup setup --ci` | — | The manifest only, refusing to mutate | `0` |
43
+ | `oc-harness-setup setup --uninstall` | `--dry-run` / `--ci` also accepted | Removes exactly the manifest-listed files and restores originals; a preview writes nothing | `0`, or `1` on a doctor failure during setup |
44
+ | `oc-harness-setup --version` | — | The package version | `0` |
45
+ | `oc-harness-setup --help` | — | The usage block | `0` |
46
+
47
+ One example, the one worth running before a first install:
48
+
34
49
  ```bash
35
- npx --yes oc-harness-setup setup # full install (default when you pass no args)
36
- npx --yes oc-harness-setup setup --dry-run # print the manifest, touch nothing
37
- npx --yes oc-harness-setup setup --ci # print-only, refuse to mutate
38
- npx --yes oc-harness-setup setup --uninstall # remove exactly the manifest-listed files
39
- npx --yes oc-harness-setup --help # print usage
50
+ npx --yes oc-harness-setup setup --dry-run
40
51
  ```
41
52
 
42
- Set `OPENCODE_CONFIG_DIR` to override the config dir when the OpenCode CLI cannot report a path; otherwise setup uses the path from the CLI first, then the platform default under your config home. Restart OpenCode after install so the new agents, commands, and skills load.
53
+ It prints the destination config dir, the incoming file count split into new and already-identical, and the policy line — then exits without touching the disk. Restart OpenCode after a real install so the new agents, commands and skills load.
43
54
 
44
55
  ## Safe upgrade
45
56
 
@@ -48,30 +59,53 @@ Set `OPENCODE_CONFIG_DIR` to override the config dir when the OpenCode CLI canno
48
59
  - The installer is additive: an unmodified package file updates in place, while a file you edited or own is kept byte-identical and the new version lands beside it as `<name>.new`.
49
60
  - Stale pack paths the new distro no longer ships are retired only when still byte-identical to the prior install (journaled, restorable on uninstall); anything you modified moves to `state/archive/legacy-0.3.x/` instead of being deleted, and is reported.
50
61
  - Stale `skill` allow entries for retired skills are pruned; custom skills are left alone.
51
- - The custom `/goal` looper ships as `/loop` (`commands/loop.md` + `skills/loop/SKILL.md`); a fresh install writes neither `commands/goal.md` nor `skills/goal`, and both `/loop` bodies name the host's native `/goal` session-continuation command (OpenCode 2.2.1) so the distinction is explicit.
62
+ - The custom `/goal` looper ships as `/loop` (`commands/loop.md` plus `skills/loop/SKILL.md`); a fresh install writes neither `commands/goal.md` nor `skills/goal`, and both `/loop` bodies name the host's native `/goal` session-continuation command so the distinction is explicit.
52
63
  - An upgrade settles a tracked `/goal` path only when a prior manifest entry lists it with a recorded hash, per file: matching bytes are retired, differing bytes are archived under `state/archive/legacy-0.3.x/`.
53
64
  - A `/goal` path the prior manifest never listed, an entry with no recorded hash, or an install with no prior manifest is left in place — so it can still collide with the native `/goal` name; remove it yourself if it does.
54
- - `setup --dry-run` previews it; `--uninstall` restores the pre-upgrade snapshot.
65
+ - `setup --dry-run` previews all of it; `--uninstall` restores the pre-upgrade snapshot.
55
66
 
56
67
  ## Grow it
57
68
 
58
69
  This starter grows through `evolve`: the smallest deliberate extension — one skill, command, reference, seat, or config change at a time, always 1:1 and doctor-checked. Repeat something twice, and `evolve` is how it earns a place.
59
70
 
60
- ## Requirements
71
+ ## Troubleshooting
72
+
73
+ **Setup refuses to start on a 1.x host.** Deliberate. 1.x uses a different config dialect, so the installer stops before writing anything. Upgrade OpenCode first.
74
+
75
+ **Setup warns on a 2.0 or 2.1 host.** The merged `permissions[]`/`policies[]` deny gate is not proven there, so the install proceeds with a warning rather than a claim. 2.2.0 or newer is the tested floor.
76
+
77
+ **The config dir cannot be found.** The CLI is asked first, then `OPENCODE_CONFIG_DIR`, then the platform default. Set `OPENCODE_CONFIG_DIR` explicitly — a relative value is rejected, so give an absolute path.
78
+
79
+ **The doctor fails.** It names the law and the fix. Apply the fix and re-run `setup`; it is idempotent. Removing `state/template.md`, for example, fails the doctor by name.
80
+
81
+ **The doctor did not run at all.** If `scripts/harness-doctor.mjs` is missing from the config dir, setup warns that the 18 laws are unverified and exits `0`. That is a warning, not a pass.
82
+
83
+ **A file I edited got a `.new` beside it.** By design: your bytes were kept and the new version landed next to them. Merge by hand, then delete the `.new`.
84
+
85
+ **An `apiKey` is rejected by the doctor.** A literal key fails; a pointer to one passes. Keep credentials out of `opencode.jsonc`.
86
+
87
+ **Uninstall left something behind.** Uninstall removes only manifest-listed paths. A file you created after the install, or one the manifest never listed, is not ours to delete and is kept.
88
+
89
+ **`/goal` collides with the host's native command.** A fresh install ships `/loop`, not `/goal`. If an old `/goal` pair predates the manifest, it is left in place — remove it yourself.
90
+
91
+ ## Limitations
61
92
 
62
- - Windows 10/11 only; macOS and Linux are not supported.
63
- - Node.js 22 or newer, the only runtime requirement with zero runtime dependencies.
64
- - OpenCode 2.2.0 or newer (the tested floor). A 2.0/2.1 host warns — the merged `permissions[]`/`policies[]` deny gate is unproven there — and a 1.x host is refused before anything is written (different config dialect).
65
- - PowerShell 7 for the doctor gate; without it the doctor reports skipped, never passed.
93
+ - Windows 10/11 only. macOS and Linux are not supported, and the installer refuses rather than half-working.
94
+ - OpenCode 2.2.0 or newer is the tested floor; 2.0/2.1 warns, 1.x is refused before anything is written.
95
+ - It is an installer, not a manager: there is no `update` command, no daemon, and no runtime. Re-running `setup` is the upgrade path.
96
+ - It cannot verify a law it did not ship. A missing doctor script is reported as unverified, never as green.
97
+ - It never deletes a file it did not install. Leftovers you own stay yours, including a colliding `/goal`.
98
+ - No plugin, no model pins, no credentials: if you want a plugin or a pinned model, that is your config to write.
99
+ - The pack owns runtime policy keys; a key you set that the pack also owns is reported rather than merged both ways.
66
100
 
67
101
  ## Links
68
102
 
69
- - Source: [nathwn12/oc-collections](https://github.com/nathwn12/oc-collections/tree/main/packages/oc-harness-setup) — the npm package remains individually installable.
70
- - [Published package](https://www.npmjs.com/package/oc-harness-setup)
71
- - [Changelog](../CHANGELOG.md)
72
- - [Releases](https://github.com/nathwn12/oc-collections/releases)
73
- - [Issues](https://github.com/nathwn12/oc-collections/issues)
74
- - [License](../LICENSE)
103
+ - Source: <https://github.com/nathwn12/oc-collections/tree/main/packages/oc-harness-setup>
104
+ - Published package: <https://www.npmjs.com/package/oc-harness-setup>
105
+ - Changelog: [CHANGELOG.md](../CHANGELOG.md)
106
+ - Releases: <https://github.com/nathwn12/oc-collections/releases>
107
+ - Issues: <https://github.com/nathwn12/oc-collections/issues>
108
+ - License: [LICENSE](../LICENSE)
75
109
 
76
110
  <!-- nathwn12 house footer: identical in every repo. Do not edit. -->
77
111
  <p align="center">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oc-harness-setup",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "oc-harness-setup": "bin/cli.js"