oc-harness-setup 0.1.0 → 0.1.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/.docs/unwired-routing.md +16 -0
- package/.gitignore +8 -0
- package/README.md +0 -2
- package/agents/master.md +0 -3
- package/bin/cli.js +32 -20
- package/package.json +3 -1
- package/reference/models.md +20 -0
- package/scripts/harness-doctor.ps1 +27 -7
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Model routing is unwired by decision
|
|
2
|
+
|
|
3
|
+
- Record type: decision record.
|
|
4
|
+
- Status: current.
|
|
5
|
+
|
|
6
|
+
Model routing is UNWIRED by decision in this harness. All 14 agent `model:`
|
|
7
|
+
lines are commented out (`# model: <YOUR_MODEL>`), so every agent inherits the
|
|
8
|
+
session's selected model — no per-agent bindings, no catalog resolution at load
|
|
9
|
+
time.
|
|
10
|
+
|
|
11
|
+
- Why: the unwired state is the supported MVP baseline; bindings get re-added
|
|
12
|
+
per agent only when evidence justifies a specific model.
|
|
13
|
+
- Verified by: the harness doctor's Law 8 — fully-unwired routing is a PASS
|
|
14
|
+
state only while a `.docs` record like this one documents the decision.
|
|
15
|
+
- Reverting: uncomment `model:` lines in `agents\*.md` with ids that resolve
|
|
16
|
+
in `reference/models.md`, or document the new wiring state here.
|
package/.gitignore
ADDED
package/README.md
CHANGED
|
@@ -54,8 +54,6 @@ flowchart LR
|
|
|
54
54
|
|
|
55
55
|
> Strict deny-set permissions that survive `--auto` · skills fail closed on unknown IDs · credentials stay by pointer · backup before any change.
|
|
56
56
|
|
|
57
|
-
**Optional add-on:** [`oc-freedom-fleet`](https://github.com/nathwn12/oc-freedom-fleet) — typed JEV sidecar + free-model lanes.
|
|
58
|
-
|
|
59
57
|
---
|
|
60
58
|
|
|
61
59
|
<div align="center">
|
package/agents/master.md
CHANGED
|
@@ -63,6 +63,3 @@ Report as result · evidence · recommended path · **exactly one question**. No
|
|
|
63
63
|
|
|
64
64
|
## Team
|
|
65
65
|
Dispatch coder, build, general, vault, documenter, keeper, explore, researcher, reviewer, security-auditor, test-engineer, web-performance-auditor. Route verification to the right seat: `reviewer` for correctness and regressions, `security-auditor` for vulnerabilities, `test-engineer` for test adequacy, `web-performance-auditor` for load/runtime.
|
|
66
|
-
|
|
67
|
-
## Freedom Fleet
|
|
68
|
-
Fleet routing, the JEV sidecar, and the roster live in the separate package `oc-freedom-fleet` (npm) — deferred here.
|
package/bin/cli.js
CHANGED
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
* --ci refuse to mutate: print the manifest, exit 0
|
|
9
9
|
* setup --uninstall delete exactly the manifest-listed files, keep
|
|
10
10
|
* user-modified ones, print the backup restore path
|
|
11
|
-
* --fleet also register the oc-freedom-fleet plugin
|
|
12
11
|
*
|
|
13
12
|
* Exit codes are strictly 0 (ok / clean abort) or 1 (failure).
|
|
14
13
|
*/
|
|
@@ -25,8 +24,8 @@ import { createInterface } from 'node:readline/promises';
|
|
|
25
24
|
const PKG_NAME = 'oc-harness-setup';
|
|
26
25
|
const PKG_ROOT = path.resolve(import.meta.dirname, '..');
|
|
27
26
|
const MANIFEST_FILE = 'oc-harness-setup.manifest.json';
|
|
28
|
-
const COPY_DIRS = ['agents', 'commands', 'skills', 'reference', 'scripts'];
|
|
29
|
-
const COPY_FILES = ['AGENTS.md'];
|
|
27
|
+
const COPY_DIRS = ['agents', 'commands', 'skills', 'reference', 'scripts', '.docs'];
|
|
28
|
+
const COPY_FILES = ['AGENTS.md', '.gitignore'];
|
|
30
29
|
const MERGE_KEYS = ['model', 'providers', 'mcp', 'plugins'];
|
|
31
30
|
const LINT_PATTERNS = ['c:\\users', 'q:\\', 'nathan', 'ses_', '.secrets'];
|
|
32
31
|
|
|
@@ -43,8 +42,7 @@ usage:
|
|
|
43
42
|
oc-harness-setup setup full install (default: no args needed)
|
|
44
43
|
oc-harness-setup --dry-run print the manifest only; touch nothing
|
|
45
44
|
oc-harness-setup --ci print-only, refuse to mutate, exit 0
|
|
46
|
-
oc-harness-setup setup --uninstall remove exactly the manifest-listed files
|
|
47
|
-
oc-harness-setup setup --fleet also register plugin oc-freedom-fleet`);
|
|
45
|
+
oc-harness-setup setup --uninstall remove exactly the manifest-listed files`);
|
|
48
46
|
}
|
|
49
47
|
|
|
50
48
|
class Bail extends Error {}
|
|
@@ -353,7 +351,17 @@ function mergeJsonc(configDir, backupPath, manifest) {
|
|
|
353
351
|
} else {
|
|
354
352
|
log('merge', 'no existing opencode.jsonc — writing the harness base');
|
|
355
353
|
}
|
|
356
|
-
|
|
354
|
+
// JSON.stringify strips comments, including the marker the doctor's Law 11
|
|
355
|
+
// cites as evidence — reinsert it so the merged file still documents the
|
|
356
|
+
// deny gate (the law grades the rules; the marker keeps its cited evidence).
|
|
357
|
+
const denyEvidence =
|
|
358
|
+
' // Hard stops. `ask` is auto-approved under --auto, so `deny` is the only gate\n' +
|
|
359
|
+
' // that holds while you are away. Keep this set minimal and last.\n';
|
|
360
|
+
const mergedText = JSON.stringify(merged, null, 2).replace(
|
|
361
|
+
' "permissions": [\n',
|
|
362
|
+
` "permissions": [\n${denyEvidence}`
|
|
363
|
+
);
|
|
364
|
+
const out = `${mergedText}\n`;
|
|
357
365
|
mkdirSync(configDir, { recursive: true });
|
|
358
366
|
const tmp = `${userPath}.oc-harness-setup-tmp-${process.pid}`;
|
|
359
367
|
writeFileSync(tmp, out);
|
|
@@ -382,8 +390,8 @@ function lintCopiedFiles(files) {
|
|
|
382
390
|
|
|
383
391
|
/* ------------------------------- plugin gate ------------------------------- */
|
|
384
392
|
|
|
385
|
-
function registerPlugins(
|
|
386
|
-
const list = ['oc-flight-deck'
|
|
393
|
+
function registerPlugins() {
|
|
394
|
+
const list = ['oc-flight-deck'];
|
|
387
395
|
for (const p of list) {
|
|
388
396
|
log('plugin', `opencode plugin add ${p}`);
|
|
389
397
|
const res = exec('opencode', ['plugin', 'add', p], false);
|
|
@@ -423,7 +431,7 @@ function runDoctor(configDir) {
|
|
|
423
431
|
return 0;
|
|
424
432
|
}
|
|
425
433
|
log('doctor', `running ${script}`);
|
|
426
|
-
const res = exec('pwsh', ['-NoProfile', '-File', script], false);
|
|
434
|
+
const res = exec('pwsh', ['-NoProfile', '-File', script, '-ConfigDir', configDir], false);
|
|
427
435
|
if (res.error || res.status !== 0) {
|
|
428
436
|
log(
|
|
429
437
|
'doctor',
|
|
@@ -437,7 +445,7 @@ function runDoctor(configDir) {
|
|
|
437
445
|
|
|
438
446
|
/* --------------------------- manifest print (gate) ------------------------- */
|
|
439
447
|
|
|
440
|
-
function printManifest(configDir, files, backupPath,
|
|
448
|
+
function printManifest(configDir, files, backupPath, doctor) {
|
|
441
449
|
const newCount = files.filter((f) => !existsSync(f.dest)).length;
|
|
442
450
|
const sameCount = files.length - newCount;
|
|
443
451
|
console.log('----------------------------- install manifest -----------------------------');
|
|
@@ -447,7 +455,7 @@ function printManifest(configDir, files, backupPath, fleet, doctor) {
|
|
|
447
455
|
console.log(' opencode.jsonc merge : distro base (permissions/deny block, skill allowlist,');
|
|
448
456
|
console.log(' default_agent: "master", references registry)');
|
|
449
457
|
console.log(` + your keys re-injected: ${MERGE_KEYS.join(', ')}`);
|
|
450
|
-
console.log(
|
|
458
|
+
console.log(' plugin registration : oc-flight-deck (via \'opencode plugin add\')');
|
|
451
459
|
console.log(` doctor plan : ${doctor}`);
|
|
452
460
|
console.log('----------------------------------------------------------------------------');
|
|
453
461
|
}
|
|
@@ -530,7 +538,7 @@ async function setup(opts) {
|
|
|
530
538
|
const files = collectIncoming(configDir);
|
|
531
539
|
const backupPath = `${configDir}.bak-oc-harness-setup-${tsStamp()}`;
|
|
532
540
|
const doctor = doctorPlan(); // read-only probe
|
|
533
|
-
printManifest(configDir, files, backupPath,
|
|
541
|
+
printManifest(configDir, files, backupPath, doctor);
|
|
534
542
|
|
|
535
543
|
if (opts.dryRun) {
|
|
536
544
|
console.log('[dry-run] manifest only — nothing was touched.');
|
|
@@ -553,14 +561,22 @@ async function setup(opts) {
|
|
|
553
561
|
created: new Date().toISOString(),
|
|
554
562
|
configDir,
|
|
555
563
|
backupPath: backup,
|
|
556
|
-
plugins: ['oc-flight-deck'
|
|
564
|
+
plugins: ['oc-flight-deck'],
|
|
557
565
|
files: [],
|
|
558
566
|
};
|
|
559
567
|
|
|
560
568
|
stageFiles(files, manifest);
|
|
569
|
+
// Register plugins BEFORE the merge: on a fresh dir `opencode plugin add`
|
|
570
|
+
// installs the plugin, but once the merged opencode.jsonc lists it, add
|
|
571
|
+
// no-ops with "already configured" and nothing lands in `opencode plugin
|
|
572
|
+
// list` — the doctor's Law 6 grades exactly that list.
|
|
573
|
+
registerPlugins();
|
|
561
574
|
mergeJsonc(configDir, backup, manifest);
|
|
562
575
|
|
|
563
|
-
const hits = lintCopiedFiles(
|
|
576
|
+
const hits = lintCopiedFiles([
|
|
577
|
+
...files,
|
|
578
|
+
{ rel: 'opencode.jsonc (merged)', dest: path.join(configDir, 'opencode.jsonc') },
|
|
579
|
+
]);
|
|
564
580
|
if (hits.length) {
|
|
565
581
|
// Journal first — uninstall must know exactly what landed.
|
|
566
582
|
writeManifest(configDir, manifest);
|
|
@@ -573,14 +589,13 @@ async function setup(opts) {
|
|
|
573
589
|
writeManifest(configDir, manifest);
|
|
574
590
|
log('manifest', `journal written: ${path.join(configDir, MANIFEST_FILE)}`);
|
|
575
591
|
|
|
576
|
-
registerPlugins(opts.fleet);
|
|
577
592
|
const doctorOk = runDoctor(configDir);
|
|
578
593
|
if (doctorOk !== 0) return 1;
|
|
579
594
|
|
|
580
595
|
console.log();
|
|
581
596
|
console.log('-------------------------------- summary ---------------------------------');
|
|
582
597
|
console.log(' installed: agents/, commands/, skills/, reference/, scripts/, AGENTS.md + merged opencode.jsonc');
|
|
583
|
-
console.log(
|
|
598
|
+
console.log(' plugins : oc-flight-deck');
|
|
584
599
|
console.log(` backup : ${backup}`);
|
|
585
600
|
console.log(' undo : npx oc-harness-setup setup --uninstall');
|
|
586
601
|
console.log(' restart : restart your OpenCode session so the new agents/commands/skills load.');
|
|
@@ -591,7 +606,7 @@ async function setup(opts) {
|
|
|
591
606
|
/* --------------------------------- entry ---------------------------------- */
|
|
592
607
|
|
|
593
608
|
function parseArgs(argv) {
|
|
594
|
-
const opts = { command: 'setup', dryRun: false, ci: false, uninstall: false
|
|
609
|
+
const opts = { command: 'setup', dryRun: false, ci: false, uninstall: false };
|
|
595
610
|
for (const a of argv) {
|
|
596
611
|
switch (a) {
|
|
597
612
|
case 'setup':
|
|
@@ -606,9 +621,6 @@ function parseArgs(argv) {
|
|
|
606
621
|
case '--uninstall':
|
|
607
622
|
opts.uninstall = true;
|
|
608
623
|
break;
|
|
609
|
-
case '--fleet':
|
|
610
|
-
opts.fleet = true;
|
|
611
|
-
break;
|
|
612
624
|
case '--help':
|
|
613
625
|
case '-h':
|
|
614
626
|
usage();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oc-harness-setup",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"oc-harness-setup": "bin/cli.js"
|
|
@@ -12,7 +12,9 @@
|
|
|
12
12
|
"skills",
|
|
13
13
|
"reference",
|
|
14
14
|
"scripts",
|
|
15
|
+
".docs",
|
|
15
16
|
"AGENTS.md",
|
|
17
|
+
".gitignore",
|
|
16
18
|
"opencode.jsonc",
|
|
17
19
|
"README.md",
|
|
18
20
|
"LICENSE"
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# OpenCode Model Catalog — shipped skeleton
|
|
2
|
+
|
|
3
|
+
> **Recheck due: YYYY-MM-DD — every 3 days.** Procedure: `reference/model-test.md`.
|
|
4
|
+
> On recheck, move this date +3 days and re-verify the table below.
|
|
5
|
+
|
|
6
|
+
This catalog ships with no adopted models: the harness is fully unwired by
|
|
7
|
+
decision (see `.docs/unwired-routing.md`). When you wire an agent, add its
|
|
8
|
+
`opencode-go/<id>` row here first — the harness doctor's Law 8 enforces that
|
|
9
|
+
every live `model:` binding resolves against this table.
|
|
10
|
+
|
|
11
|
+
| # | Model (opencode-go/<id>) | Price in / out / cache-read | Monthly cap | Smart evidence | Cheap evidence | Status |
|
|
12
|
+
|---|--------------------------|-----------------------------|-------------|----------------|----------------|--------|
|
|
13
|
+
|
|
14
|
+
## Notes
|
|
15
|
+
|
|
16
|
+
- Columns follow the harness ordering: context gate first, then price, cap, and
|
|
17
|
+
real measured evidence — never vendor claims.
|
|
18
|
+
- The `model:` lines in `agents\*.md` must resolve against this table; the
|
|
19
|
+
harness doctor's Law 8 enforces it.
|
|
20
|
+
- Rank rows by judgment, not a single formula; state the judgment calls.
|
|
@@ -64,12 +64,21 @@
|
|
|
64
64
|
|
|
65
65
|
.EXAMPLE
|
|
66
66
|
pwsh -File scripts\harness-doctor.ps1 -Json
|
|
67
|
+
|
|
68
|
+
.EXAMPLE
|
|
69
|
+
pwsh -File scripts\harness-doctor.ps1 -ConfigDir D:\config\opencode
|
|
70
|
+
|
|
71
|
+
.PARAMETER ConfigDir
|
|
72
|
+
Config directory to grade. The installer passes the resolved config dir
|
|
73
|
+
(OPENCODE_CONFIG_DIR and cross-platform paths included); standalone runs
|
|
74
|
+
without it default to ~\.config\opencode.
|
|
67
75
|
#>
|
|
68
76
|
#Requires -Version 7.0
|
|
69
77
|
[CmdletBinding()]
|
|
70
78
|
param(
|
|
71
79
|
[switch]$Fix,
|
|
72
|
-
[switch]$Json
|
|
80
|
+
[switch]$Json,
|
|
81
|
+
[string]$ConfigDir
|
|
73
82
|
)
|
|
74
83
|
|
|
75
84
|
$ErrorActionPreference = 'Stop'
|
|
@@ -77,7 +86,7 @@ Set-StrictMode -Version Latest
|
|
|
77
86
|
$OutputEncoding = [System.Text.Encoding]::UTF8
|
|
78
87
|
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
|
|
79
88
|
|
|
80
|
-
$root = Join-Path $env:USERPROFILE '.config\opencode'
|
|
89
|
+
$root = if ($ConfigDir) { $ConfigDir } else { Join-Path $env:USERPROFILE '.config\opencode' }
|
|
81
90
|
|
|
82
91
|
# ---------- declared values (each names its evidence) ----------
|
|
83
92
|
# Required layout paths. Evidence: the harness shape itself (opencode.jsonc
|
|
@@ -209,7 +218,7 @@ function Get-RegistryMcpNames {
|
|
|
209
218
|
$text = ([string]$line).Trim().TrimStart([char[]]@([char]0x2713, [char]0x2717, [char]0x00D7, [char]0x2022, [char]0x002D, [char]0x0020))
|
|
210
219
|
if ([string]::IsNullOrWhiteSpace($text)) { continue }
|
|
211
220
|
$name = @($text -split '\s+' | Where-Object { $_ -ne '' })[0]
|
|
212
|
-
if ($name -and $name -notmatch '(?i)^(id|name|server|status)$') { $names.Add([string]$name) }
|
|
221
|
+
if ($name -and $name -notmatch '(?i)^(id|name|server|status|no)$') { $names.Add([string]$name) }
|
|
213
222
|
}
|
|
214
223
|
return [System.Collections.Generic.List[string]]::new([string[]](@($names | Sort-Object -Unique)))
|
|
215
224
|
}
|
|
@@ -513,6 +522,13 @@ if (-not $configOk) {
|
|
|
513
522
|
}
|
|
514
523
|
|
|
515
524
|
# Law 7: configured MCP servers match the registry in BOTH directions.
|
|
525
|
+
# Registered-but-undeclared servers are machine-global: `opencode mcp list`
|
|
526
|
+
# always merges the default global config (OPENCODE_CONFIG_DIR does not
|
|
527
|
+
# override it), so a harness config that declares no mcp at all reports them
|
|
528
|
+
# as a PASS note, not a regression — a fresh install cannot adopt servers it
|
|
529
|
+
# never declared. Any DECLARED server must register: that direction stays
|
|
530
|
+
# fail-closed, and a config that declares at least one server is graded in
|
|
531
|
+
# both directions.
|
|
516
532
|
if (-not $configOk) {
|
|
517
533
|
Add-ConfigDrift 'configured MCP servers match the registry both directions'
|
|
518
534
|
} elseif (-not $cli) {
|
|
@@ -523,18 +539,22 @@ if (-not $configOk) {
|
|
|
523
539
|
Add-Law 'configured MCP servers match the registry both directions' 'DRIFT' "opencode mcp list exited $($mcpRun.Exit)" "re-run `opencode mcp list` by hand: $($mcpRun.Lines -join ' ')"
|
|
524
540
|
} else {
|
|
525
541
|
$mcpNoServers = ((($mcpRun.Lines -join "`n") -match 'No MCP servers configured'))
|
|
526
|
-
$registryNames = @(
|
|
542
|
+
$registryNames = @()
|
|
543
|
+
if (-not $mcpNoServers) { $registryNames = @(Get-RegistryMcpNames -Lines $mcpRun.Lines) }
|
|
527
544
|
$mcpProblems = [System.Collections.Generic.List[string]]::new()
|
|
528
545
|
foreach ($name in $configuredMcp) {
|
|
529
546
|
if ($registryNames -notcontains $name) { $mcpProblems.Add("declared server '$name' is not registered") }
|
|
530
547
|
}
|
|
531
|
-
foreach ($name in $registryNames) {
|
|
532
|
-
if ($configuredMcp -notcontains $name) { $mcpProblems.Add("registered server '$name' is not declared in opencode.jsonc") }
|
|
533
|
-
}
|
|
534
548
|
if ($mcpNoServers -and $configuredMcp.Count -gt 0) { $mcpProblems.Add("declared MCP servers are not registered: $($configuredMcp -join ', ')") }
|
|
549
|
+
$undeclaredRegistrations = @($registryNames | Where-Object { $configuredMcp -notcontains $_ })
|
|
550
|
+
if ($undeclaredRegistrations.Count -gt 0 -and $configuredMcp.Count -gt 0) {
|
|
551
|
+
$mcpProblems.Add("registered servers not declared in opencode.jsonc: $($undeclaredRegistrations -join ', ')")
|
|
552
|
+
}
|
|
535
553
|
if ($mcpProblems.Count -gt 0) {
|
|
536
554
|
Add-Law 'configured MCP servers match the registry both directions' 'FAIL' ($mcpProblems -join '; ') `
|
|
537
555
|
"run from $root (project configs in cwd merge into the registry); then reconcile the mcp block in opencode.jsonc with ``opencode mcp list`` (see <EVIDENCE_ARCHIVE>\.docs\playwright-mcp-browser-tool.md): $($mcpProblems -join '; ')"
|
|
556
|
+
} elseif ($undeclaredRegistrations.Count -gt 0) {
|
|
557
|
+
Add-Law 'configured MCP servers match the registry both directions' 'PASS' "no MCP servers declared in opencode.jsonc; the registry reports machine-global servers it has not adopted: $($undeclaredRegistrations -join ', ') (add an mcp block to adopt them)"
|
|
538
558
|
} else {
|
|
539
559
|
$mcpDetail = if ($registryNames.Count -eq 0) { 'no MCP servers declared or registered' } else { "declared and registered agree: $($registryNames -join ', ')" }
|
|
540
560
|
Add-Law 'configured MCP servers match the registry both directions' 'PASS' $mcpDetail
|