@glrs-dev/harness-plugin-opencode 2.6.0 → 2.7.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/CHANGELOG.md +22 -0
- package/dist/agents/prompts/prime.md +1 -1
- package/dist/cli-exports.d.ts +49 -0
- package/dist/{cli.js → cli-exports.js} +21 -282
- package/dist/index.js +3 -4
- package/package.json +11 -6
- package/dist/cli.d.ts +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.7.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#81](https://github.com/iceglober/glrs/pull/81) [`b0d02dc`](https://github.com/iceglober/glrs/commit/b0d02dcb3ab8636445c4d0317ccd61dc9581bdff) Thanks [@iceglober](https://github.com/iceglober)! - Simplify CLI deployment model and fix runtime module resolution.
|
|
8
|
+
|
|
9
|
+
**Breaking (harness-plugin-opencode):**
|
|
10
|
+
|
|
11
|
+
- Remove `bin` field — the package no longer ships standalone `glrs-oc` / `harness-opencode` binaries. Users should install `@glrs-dev/cli` and use `glrs harness install|configure|doctor|uninstall`.
|
|
12
|
+
- Add `./cli` subpath export for CLI handler functions consumed by `@glrs-dev/cli`.
|
|
13
|
+
|
|
14
|
+
**CLI:**
|
|
15
|
+
|
|
16
|
+
- Add `glrs harness` subcommand (install, configure, uninstall, doctor) — replaces the old `glrs oc` subprocess dispatch.
|
|
17
|
+
- Deprecate `glrs oc` with a redirect notice pointing to `glrs harness`.
|
|
18
|
+
- Fix deep import (`@glrs-dev/autopilot/src/model-resolver.js`) that crashed `glrs loop` when installed from npm.
|
|
19
|
+
- Vendor harness-plugin-opencode into `dist/node_modules/` (same as autopilot/adapter) instead of the old `dist/vendor/` subprocess path.
|
|
20
|
+
|
|
21
|
+
**CI:**
|
|
22
|
+
|
|
23
|
+
- Skip Rust (gs-assume) build/test/clippy/fmt unless `packages/assume/**` files are touched.
|
|
24
|
+
|
|
3
25
|
## 2.6.0
|
|
4
26
|
|
|
5
27
|
### Minor Changes
|
|
@@ -70,7 +70,7 @@ If none match, treat as "unrelated" (rule 6).
|
|
|
70
70
|
|
|
71
71
|
- `/fresh` is a user-invoked command. Its own internal prompts ("delete N stale worktrees?" during `--clean`) are legitimate — they're interactive-by-design. When you auto-invoke `/fresh`, do NOT pass `--clean`. Cleanup stays user-triggered.
|
|
72
72
|
- `/ship` is now a resume/re-entry path (see Resolve). When invoked manually, it executes the same logic as PRIME's Resolve stage. If a PR is already open for the current branch, report it and stop (no-op). Otherwise execute the full ship pipeline as documented in ship.md. Do NOT add extra "confirm before pushing?" prompts on top of Resolve's own flow — that contradicts the command's contract.
|
|
73
|
-
- Autopilot (lights-out mode) is a CLI-only feature: `glrs
|
|
73
|
+
- Autopilot (lights-out mode) is a CLI-only feature: `glrs autopilot "<prompt>"`. It runs a Ralph loop that sends your prompt each iteration and watches for `<autopilot-done>` in your response — when the sentinel appears (or a budget is hit), the loop exits. There is no TUI slash command; if you want the same behavior inside the TUI, just type the task as a normal prompt.
|
|
74
74
|
|
|
75
75
|
# Slash-command fallback
|
|
76
76
|
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import * as cmd_ts_dist_cjs_runner_js from 'cmd-ts/dist/cjs/runner.js';
|
|
2
|
+
import * as cmd_ts_dist_cjs_helpdoc_js from 'cmd-ts/dist/cjs/helpdoc.js';
|
|
3
|
+
import * as cmd_ts_dist_cjs_argparser_js from 'cmd-ts/dist/cjs/argparser.js';
|
|
4
|
+
|
|
5
|
+
interface InstallOptions {
|
|
6
|
+
dryRun?: boolean;
|
|
7
|
+
pin?: boolean;
|
|
8
|
+
nonInteractive?: boolean;
|
|
9
|
+
}
|
|
10
|
+
declare function install(opts?: InstallOptions): Promise<void>;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* `bunx @glrs-dev/harness-plugin-opencode uninstall`
|
|
14
|
+
*
|
|
15
|
+
* Removes "@glrs-dev/harness-plugin-opencode" from the user's opencode.json plugin
|
|
16
|
+
* array. Writes a .bak backup before mutation. Does NOT touch skills (they
|
|
17
|
+
* live in node_modules, removed by `bun remove`). Does NOT touch ~/.claude/.
|
|
18
|
+
*/
|
|
19
|
+
interface UninstallOptions {
|
|
20
|
+
dryRun?: boolean;
|
|
21
|
+
}
|
|
22
|
+
declare function uninstall(opts?: UninstallOptions): void;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* `bunx @glrs-dev/harness-plugin-opencode doctor`
|
|
26
|
+
*
|
|
27
|
+
* Checks the installation health and reports per-check green/yellow/red.
|
|
28
|
+
*/
|
|
29
|
+
declare function doctor(): void;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* `glrs oc configure` — Interactive configuration editor.
|
|
33
|
+
*
|
|
34
|
+
* Shows the current opencode.json config as a navigable menu.
|
|
35
|
+
* The user selects a setting to change, picks from available options
|
|
36
|
+
* (no free-text for model selection), and saves.
|
|
37
|
+
*
|
|
38
|
+
* Unlike `install`, this command:
|
|
39
|
+
* - Never re-prompts for settings you don't want to change
|
|
40
|
+
* - Shows model choices from the Models.dev API (not free-text)
|
|
41
|
+
* - Supports changing a single tier without touching others
|
|
42
|
+
*/
|
|
43
|
+
declare const configureCmd: Partial<cmd_ts_dist_cjs_argparser_js.Register> & {
|
|
44
|
+
parse(context: cmd_ts_dist_cjs_argparser_js.ParseContext): Promise<cmd_ts_dist_cjs_argparser_js.ParsingResult<{}>>;
|
|
45
|
+
} & cmd_ts_dist_cjs_helpdoc_js.PrintHelp & cmd_ts_dist_cjs_helpdoc_js.ProvidesHelp & cmd_ts_dist_cjs_helpdoc_js.Named & Partial<cmd_ts_dist_cjs_helpdoc_js.Versioned> & cmd_ts_dist_cjs_argparser_js.Register & cmd_ts_dist_cjs_runner_js.Handling<{}, Promise<void>> & {
|
|
46
|
+
run(context: cmd_ts_dist_cjs_argparser_js.ParseContext): Promise<cmd_ts_dist_cjs_argparser_js.ParsingResult<Promise<void>>>;
|
|
47
|
+
} & Partial<cmd_ts_dist_cjs_helpdoc_js.Versioned & cmd_ts_dist_cjs_helpdoc_js.Descriptive & cmd_ts_dist_cjs_helpdoc_js.Aliased>;
|
|
48
|
+
|
|
49
|
+
export { type InstallOptions, type UninstallOptions, configureCmd, doctor, install, uninstall };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
#!/usr/bin/env bun
|
|
2
1
|
import {
|
|
3
2
|
getOpenCodeCachePackageDir,
|
|
4
3
|
inspectCachePin,
|
|
@@ -11,16 +10,6 @@ import {
|
|
|
11
10
|
promptMulti
|
|
12
11
|
} from "./chunk-GILWWWMB.js";
|
|
13
12
|
|
|
14
|
-
// src/cli.ts
|
|
15
|
-
import {
|
|
16
|
-
binary,
|
|
17
|
-
command as command2,
|
|
18
|
-
flag,
|
|
19
|
-
positional,
|
|
20
|
-
subcommands,
|
|
21
|
-
run
|
|
22
|
-
} from "cmd-ts";
|
|
23
|
-
|
|
24
13
|
// src/cli/install.ts
|
|
25
14
|
import * as fs2 from "fs";
|
|
26
15
|
import * as path2 from "path";
|
|
@@ -977,17 +966,17 @@ function getOpencodeConfigPath2() {
|
|
|
977
966
|
function uninstall(opts = {}) {
|
|
978
967
|
const { dryRun = false } = opts;
|
|
979
968
|
const configPath = getOpencodeConfigPath2();
|
|
980
|
-
const
|
|
969
|
+
const c3 = {
|
|
981
970
|
reset: "\x1B[0m",
|
|
982
971
|
green: "\x1B[32m",
|
|
983
972
|
yellow: "\x1B[33m",
|
|
984
973
|
blue: "\x1B[34m"
|
|
985
974
|
};
|
|
986
|
-
const ok3 = (msg) => console.log(`${
|
|
987
|
-
const info3 = (msg) => console.log(`${
|
|
988
|
-
const warn2 = (msg) => console.log(`${
|
|
975
|
+
const ok3 = (msg) => console.log(`${c3.green}\u2713${c3.reset} ${msg}`);
|
|
976
|
+
const info3 = (msg) => console.log(`${c3.blue}\u2022${c3.reset} ${msg}`);
|
|
977
|
+
const warn2 = (msg) => console.log(`${c3.yellow}!${c3.reset} ${msg}`);
|
|
989
978
|
console.log(`
|
|
990
|
-
${
|
|
979
|
+
${c3.blue}Uninstalling ${PLUGIN_NAME2}${c3.reset}
|
|
991
980
|
`);
|
|
992
981
|
if (!fs3.existsSync(configPath)) {
|
|
993
982
|
warn2(`No opencode.json found at ${configPath} \u2014 nothing to do`);
|
|
@@ -1057,9 +1046,9 @@ function getOpencodeConfigPath3() {
|
|
|
1057
1046
|
const configHome = process.env["XDG_CONFIG_HOME"] ?? path4.join(os3.homedir(), ".config");
|
|
1058
1047
|
return path4.join(configHome, "opencode", "opencode.json");
|
|
1059
1048
|
}
|
|
1060
|
-
function cmd(
|
|
1049
|
+
function cmd(command2) {
|
|
1061
1050
|
try {
|
|
1062
|
-
return execSync(
|
|
1051
|
+
return execSync(command2, { encoding: "utf8", stdio: ["pipe", "pipe", "pipe"] }).trim();
|
|
1063
1052
|
} catch {
|
|
1064
1053
|
return null;
|
|
1065
1054
|
}
|
|
@@ -1068,18 +1057,18 @@ function which(bin) {
|
|
|
1068
1057
|
return cmd(`which ${bin}`) !== null;
|
|
1069
1058
|
}
|
|
1070
1059
|
function doctor() {
|
|
1071
|
-
const
|
|
1060
|
+
const c3 = {
|
|
1072
1061
|
reset: "\x1B[0m",
|
|
1073
1062
|
green: "\x1B[32m",
|
|
1074
1063
|
yellow: "\x1B[33m",
|
|
1075
1064
|
red: "\x1B[31m",
|
|
1076
1065
|
bold: "\x1B[1m"
|
|
1077
1066
|
};
|
|
1078
|
-
const ok3 = (msg) => console.log(`${
|
|
1079
|
-
const warn2 = (msg) => console.log(`${
|
|
1080
|
-
const fail = (msg) => console.log(`${
|
|
1067
|
+
const ok3 = (msg) => console.log(`${c3.green}\u2713${c3.reset} ${msg}`);
|
|
1068
|
+
const warn2 = (msg) => console.log(`${c3.yellow}!${c3.reset} ${msg}`);
|
|
1069
|
+
const fail = (msg) => console.log(`${c3.red}\u2717${c3.reset} ${msg}`);
|
|
1081
1070
|
console.log(`
|
|
1082
|
-
${
|
|
1071
|
+
${c3.bold}Doctor \u2014 ${PLUGIN_NAME3}${c3.reset}
|
|
1083
1072
|
`);
|
|
1084
1073
|
const ocVersion = cmd("opencode --version 2>/dev/null | head -1");
|
|
1085
1074
|
if (ocVersion) {
|
|
@@ -1150,15 +1139,15 @@ ${c4.bold}Doctor \u2014 ${PLUGIN_NAME3}${c4.reset}
|
|
|
1150
1139
|
for (const entry of invalid) {
|
|
1151
1140
|
fail(`invalid model override at ${entry.keyPath}: "${entry.value}"`);
|
|
1152
1141
|
if (entry.reason) {
|
|
1153
|
-
console.log(` ${
|
|
1142
|
+
console.log(` ${c3.yellow}reason:${c3.reset} ${entry.reason}`);
|
|
1154
1143
|
}
|
|
1155
1144
|
if (entry.suggestion) {
|
|
1156
1145
|
console.log(
|
|
1157
|
-
` ${
|
|
1146
|
+
` ${c3.yellow}fix:${c3.reset} remove this key, or replace with \`${entry.suggestion}\``
|
|
1158
1147
|
);
|
|
1159
1148
|
} else {
|
|
1160
1149
|
console.log(
|
|
1161
|
-
` ${
|
|
1150
|
+
` ${c3.yellow}fix:${c3.reset} remove this key, or run \`bunx ${PLUGIN_NAME3} install\` to pick a current preset`
|
|
1162
1151
|
);
|
|
1163
1152
|
}
|
|
1164
1153
|
}
|
|
@@ -1384,7 +1373,7 @@ var configureCmd = command({
|
|
|
1384
1373
|
const configPath = getOpencodeConfigPath4();
|
|
1385
1374
|
const config = readConfig(configPath);
|
|
1386
1375
|
if (!config) {
|
|
1387
|
-
console.log(`No config found at ${configPath}. Run ${c2.green}glrs
|
|
1376
|
+
console.log(`No config found at ${configPath}. Run ${c2.green}glrs harness install${c2.reset} first.`);
|
|
1388
1377
|
process.exit(1);
|
|
1389
1378
|
}
|
|
1390
1379
|
const opts = extractPluginOptions2(config);
|
|
@@ -1447,259 +1436,9 @@ ${c2.bold}Done.${c2.reset} Restart opencode to pick up changes.
|
|
|
1447
1436
|
}
|
|
1448
1437
|
}
|
|
1449
1438
|
});
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
import { spawn } from "child_process";
|
|
1456
|
-
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
1457
|
-
var PACKAGE_NAME = "@glrs-dev/harness-plugin-opencode";
|
|
1458
|
-
var CHECK_INTERVAL_MS = 24 * 60 * 60 * 1e3;
|
|
1459
|
-
var c3 = {
|
|
1460
|
-
reset: "\x1B[0m",
|
|
1461
|
-
green: "\x1B[32m",
|
|
1462
|
-
yellow: "\x1B[33m",
|
|
1463
|
-
blue: "\x1B[34m",
|
|
1464
|
-
dim: "\x1B[2m",
|
|
1465
|
-
bold: "\x1B[1m"
|
|
1439
|
+
export {
|
|
1440
|
+
configureCmd,
|
|
1441
|
+
doctor,
|
|
1442
|
+
install,
|
|
1443
|
+
uninstall
|
|
1466
1444
|
};
|
|
1467
|
-
function parseSemver(v) {
|
|
1468
|
-
const m = /^(\d+)\.(\d+)\.(\d+)/.exec(v);
|
|
1469
|
-
if (!m) return null;
|
|
1470
|
-
return { major: +m[1], minor: +m[2], patch: +m[3] };
|
|
1471
|
-
}
|
|
1472
|
-
function isNewer(current, latest) {
|
|
1473
|
-
if (latest.major !== current.major) return latest.major > current.major;
|
|
1474
|
-
if (latest.minor !== current.minor) return latest.minor > current.minor;
|
|
1475
|
-
return latest.patch > current.patch;
|
|
1476
|
-
}
|
|
1477
|
-
function isMajorBump(current, latest) {
|
|
1478
|
-
return latest.major > current.major;
|
|
1479
|
-
}
|
|
1480
|
-
function getStateFilePath() {
|
|
1481
|
-
const cacheHome = process.env["XDG_CACHE_HOME"] ?? path6.join(os5.homedir(), ".cache");
|
|
1482
|
-
return path6.join(cacheHome, "harness-opencode", "cli-update.json");
|
|
1483
|
-
}
|
|
1484
|
-
function readState() {
|
|
1485
|
-
try {
|
|
1486
|
-
const raw = fs6.readFileSync(getStateFilePath(), "utf8");
|
|
1487
|
-
return JSON.parse(raw);
|
|
1488
|
-
} catch {
|
|
1489
|
-
return null;
|
|
1490
|
-
}
|
|
1491
|
-
}
|
|
1492
|
-
function writeState(state) {
|
|
1493
|
-
try {
|
|
1494
|
-
const statePath = getStateFilePath();
|
|
1495
|
-
fs6.mkdirSync(path6.dirname(statePath), { recursive: true });
|
|
1496
|
-
fs6.writeFileSync(statePath, JSON.stringify(state));
|
|
1497
|
-
} catch {
|
|
1498
|
-
}
|
|
1499
|
-
}
|
|
1500
|
-
function readInstalledVersion() {
|
|
1501
|
-
const here = path6.dirname(fileURLToPath2(import.meta.url));
|
|
1502
|
-
const candidates = [
|
|
1503
|
-
path6.join(here, "..", "package.json"),
|
|
1504
|
-
path6.join(here, "..", "..", "package.json"),
|
|
1505
|
-
path6.join(here, "package.json")
|
|
1506
|
-
];
|
|
1507
|
-
for (const candidate of candidates) {
|
|
1508
|
-
try {
|
|
1509
|
-
const raw = fs6.readFileSync(candidate, "utf8");
|
|
1510
|
-
const parsed = JSON.parse(raw);
|
|
1511
|
-
if (parsed.name === PACKAGE_NAME && typeof parsed.version === "string") {
|
|
1512
|
-
return parsed.version;
|
|
1513
|
-
}
|
|
1514
|
-
} catch {
|
|
1515
|
-
}
|
|
1516
|
-
}
|
|
1517
|
-
return "0.0.0";
|
|
1518
|
-
}
|
|
1519
|
-
async function fetchLatestVersion() {
|
|
1520
|
-
try {
|
|
1521
|
-
const controller = new AbortController();
|
|
1522
|
-
const timer = setTimeout(() => controller.abort(), 3e3);
|
|
1523
|
-
const res = await fetch(
|
|
1524
|
-
`https://registry.npmjs.org/${PACKAGE_NAME}/latest`,
|
|
1525
|
-
{ signal: controller.signal }
|
|
1526
|
-
);
|
|
1527
|
-
clearTimeout(timer);
|
|
1528
|
-
if (!res.ok) return null;
|
|
1529
|
-
const data = await res.json();
|
|
1530
|
-
return data.version ?? null;
|
|
1531
|
-
} catch {
|
|
1532
|
-
return null;
|
|
1533
|
-
}
|
|
1534
|
-
}
|
|
1535
|
-
function spawnBackgroundUpdate() {
|
|
1536
|
-
try {
|
|
1537
|
-
const child = spawn("bun", ["update", "-g", PACKAGE_NAME], {
|
|
1538
|
-
detached: true,
|
|
1539
|
-
stdio: "ignore"
|
|
1540
|
-
});
|
|
1541
|
-
child.unref();
|
|
1542
|
-
} catch {
|
|
1543
|
-
}
|
|
1544
|
-
}
|
|
1545
|
-
function startUpdateCheck() {
|
|
1546
|
-
if (process.env["HARNESS_OPENCODE_UPDATE_CHECK"] === "0") {
|
|
1547
|
-
return () => {
|
|
1548
|
-
};
|
|
1549
|
-
}
|
|
1550
|
-
const currentVersionStr = readInstalledVersion();
|
|
1551
|
-
const current = parseSemver(currentVersionStr);
|
|
1552
|
-
if (!current) return () => {
|
|
1553
|
-
};
|
|
1554
|
-
const state = readState();
|
|
1555
|
-
if (state && Date.now() - state.last_check_ts < CHECK_INTERVAL_MS) {
|
|
1556
|
-
if (state.latest_version) {
|
|
1557
|
-
const cached = parseSemver(state.latest_version);
|
|
1558
|
-
if (cached && isNewer(current, cached) && isMajorBump(current, cached)) {
|
|
1559
|
-
return () => printMajorNotice(currentVersionStr, state.latest_version);
|
|
1560
|
-
}
|
|
1561
|
-
}
|
|
1562
|
-
return () => {
|
|
1563
|
-
};
|
|
1564
|
-
}
|
|
1565
|
-
let action = null;
|
|
1566
|
-
fetchLatestVersion().then((latestStr) => {
|
|
1567
|
-
writeState({
|
|
1568
|
-
last_check_ts: Date.now(),
|
|
1569
|
-
latest_version: latestStr ?? void 0
|
|
1570
|
-
});
|
|
1571
|
-
if (!latestStr) return;
|
|
1572
|
-
const latest = parseSemver(latestStr);
|
|
1573
|
-
if (!latest || !isNewer(current, latest)) return;
|
|
1574
|
-
if (isMajorBump(current, latest)) {
|
|
1575
|
-
action = () => printMajorNotice(currentVersionStr, latestStr);
|
|
1576
|
-
} else {
|
|
1577
|
-
action = () => {
|
|
1578
|
-
process.stderr.write(
|
|
1579
|
-
`
|
|
1580
|
-
${c3.blue}\u2022${c3.reset} Updating ${PACKAGE_NAME} ${c3.dim}${currentVersionStr}${c3.reset} \u2192 ${c3.green}${latestStr}${c3.reset} in the background...
|
|
1581
|
-
`
|
|
1582
|
-
);
|
|
1583
|
-
spawnBackgroundUpdate();
|
|
1584
|
-
};
|
|
1585
|
-
}
|
|
1586
|
-
}).catch(() => {
|
|
1587
|
-
});
|
|
1588
|
-
return () => {
|
|
1589
|
-
if (action) action();
|
|
1590
|
-
};
|
|
1591
|
-
}
|
|
1592
|
-
function printMajorNotice(current, latest) {
|
|
1593
|
-
process.stderr.write(
|
|
1594
|
-
`
|
|
1595
|
-
${c3.yellow}${c3.bold}Major update available:${c3.reset} ${current} \u2192 ${c3.green}${latest}${c3.reset}
|
|
1596
|
-
${c3.dim}Review the changelog before upgrading:${c3.reset}
|
|
1597
|
-
bun update -g ${PACKAGE_NAME}
|
|
1598
|
-
`
|
|
1599
|
-
);
|
|
1600
|
-
}
|
|
1601
|
-
|
|
1602
|
-
// src/cli.ts
|
|
1603
|
-
{
|
|
1604
|
-
const dispatched = process.env["GLRS_CLI_DISPATCHED"];
|
|
1605
|
-
if (!dispatched || dispatched === "") {
|
|
1606
|
-
const argv1 = process.argv[1] ?? "harness-opencode";
|
|
1607
|
-
const invoke = argv1.replace(/\\/g, "/").split("/").pop() ?? "harness-opencode";
|
|
1608
|
-
process.stderr.write(`[${invoke}] This binary is deprecated when invoked standalone.
|
|
1609
|
-
`);
|
|
1610
|
-
process.stderr.write(`[${invoke}] Install @glrs-dev/cli and use 'glrs oc' instead:
|
|
1611
|
-
`);
|
|
1612
|
-
process.stderr.write(`[${invoke}] npm i -g @glrs-dev/cli
|
|
1613
|
-
`);
|
|
1614
|
-
process.stderr.write(`[${invoke}] glrs oc <args>
|
|
1615
|
-
`);
|
|
1616
|
-
process.stderr.write(`[${invoke}] Docs: https://glrs.dev/install
|
|
1617
|
-
`);
|
|
1618
|
-
process.exit(1);
|
|
1619
|
-
}
|
|
1620
|
-
}
|
|
1621
|
-
if (!process.versions.bun) {
|
|
1622
|
-
const [majorStr = "0", minorStr = "0"] = (process.versions.node ?? "0.0").split(".");
|
|
1623
|
-
const major = Number(majorStr);
|
|
1624
|
-
const minor = Number(minorStr);
|
|
1625
|
-
if (major < 20 || major === 20 && minor < 10) {
|
|
1626
|
-
process.stderr.write(
|
|
1627
|
-
`harness-opencode requires Node.js >= 20.10 (you are on ${process.versions.node}).
|
|
1628
|
-
Upgrade Node or run via a compatible Bun runtime. See the "engines" field in package.json.
|
|
1629
|
-
`
|
|
1630
|
-
);
|
|
1631
|
-
process.exit(1);
|
|
1632
|
-
}
|
|
1633
|
-
}
|
|
1634
|
-
var VERSION = "0.1.0";
|
|
1635
|
-
var installCmd = command2({
|
|
1636
|
-
name: "install",
|
|
1637
|
-
description: 'Add "@glrs-dev/harness-plugin-opencode" to your opencode.json plugin array.',
|
|
1638
|
-
args: {
|
|
1639
|
-
dryRun: flag({
|
|
1640
|
-
long: "dry-run",
|
|
1641
|
-
description: "Preview changes without writing."
|
|
1642
|
-
}),
|
|
1643
|
-
pin: flag({
|
|
1644
|
-
long: "pin",
|
|
1645
|
-
description: "Pin to the current exact version (e.g. @0.1.0)."
|
|
1646
|
-
})
|
|
1647
|
-
},
|
|
1648
|
-
handler: async ({ dryRun, pin }) => {
|
|
1649
|
-
await install({ dryRun, pin });
|
|
1650
|
-
}
|
|
1651
|
-
});
|
|
1652
|
-
var uninstallCmd = command2({
|
|
1653
|
-
name: "uninstall",
|
|
1654
|
-
description: 'Remove "@glrs-dev/harness-plugin-opencode" from your opencode.json plugin array.',
|
|
1655
|
-
args: {
|
|
1656
|
-
dryRun: flag({
|
|
1657
|
-
long: "dry-run",
|
|
1658
|
-
description: "Preview changes without writing."
|
|
1659
|
-
})
|
|
1660
|
-
},
|
|
1661
|
-
handler: ({ dryRun }) => {
|
|
1662
|
-
uninstall({ dryRun });
|
|
1663
|
-
}
|
|
1664
|
-
});
|
|
1665
|
-
var doctorCmd = command2({
|
|
1666
|
-
name: "doctor",
|
|
1667
|
-
description: "Check installation health (OpenCode CLI, plugin registration, MCP backends).",
|
|
1668
|
-
args: {},
|
|
1669
|
-
handler: () => {
|
|
1670
|
-
doctor();
|
|
1671
|
-
}
|
|
1672
|
-
});
|
|
1673
|
-
var installPluginCmd = command2({
|
|
1674
|
-
name: "install-plugin",
|
|
1675
|
-
description: 'Add "@glrs-dev/harness-plugin-opencode" to your opencode.json plugin array.',
|
|
1676
|
-
args: {
|
|
1677
|
-
dryRun: flag({
|
|
1678
|
-
long: "dry-run",
|
|
1679
|
-
description: "Preview changes without writing."
|
|
1680
|
-
}),
|
|
1681
|
-
pin: flag({
|
|
1682
|
-
long: "pin",
|
|
1683
|
-
description: "Pin to the current exact version (e.g. @0.1.0)."
|
|
1684
|
-
})
|
|
1685
|
-
},
|
|
1686
|
-
handler: async ({ dryRun, pin }) => {
|
|
1687
|
-
await install({ dryRun, pin });
|
|
1688
|
-
}
|
|
1689
|
-
});
|
|
1690
|
-
var cli = subcommands({
|
|
1691
|
-
name: "glrs-oc",
|
|
1692
|
-
description: "OpenCode agent harness CLI.",
|
|
1693
|
-
version: VERSION,
|
|
1694
|
-
cmds: {
|
|
1695
|
-
"install-plugin": installPluginCmd,
|
|
1696
|
-
install: installCmd,
|
|
1697
|
-
uninstall: uninstallCmd,
|
|
1698
|
-
configure: configureCmd,
|
|
1699
|
-
doctor: doctorCmd
|
|
1700
|
-
// Note: `loop` and `autopilot` commands have moved to @glrs-dev/cli.
|
|
1701
|
-
}
|
|
1702
|
-
});
|
|
1703
|
-
var printUpdate = startUpdateCheck();
|
|
1704
|
-
process.on("exit", printUpdate);
|
|
1705
|
-
void run(binary(cli), process.argv);
|
package/dist/index.js
CHANGED
|
@@ -217,9 +217,8 @@ var CORE_BASH_ALLOW_LIST = {
|
|
|
217
217
|
"eslint *": "allow",
|
|
218
218
|
"prettier *": "allow",
|
|
219
219
|
"biome *": "allow",
|
|
220
|
-
// Our own CLI (
|
|
221
|
-
"
|
|
222
|
-
"glrs-oc *": "allow",
|
|
220
|
+
// Our own CLI (harness, autopilot, loop, etc.) — reviewer/build invocations.
|
|
221
|
+
"glrs *": "allow",
|
|
223
222
|
// GitHub CLI — read-only gh calls are fine; destructive `gh pr merge`
|
|
224
223
|
// is gated at the PRIME level by human intent (user runs /ship).
|
|
225
224
|
"gh pr view *": "allow",
|
|
@@ -2155,7 +2154,7 @@ import { join as join10 } from "path";
|
|
|
2155
2154
|
var APP_KEY = "A-US-3617699429";
|
|
2156
2155
|
var ENDPOINT = "https://us.aptabase.com/api/v0/event";
|
|
2157
2156
|
var PKG_NAME = "@glrs-dev/harness-plugin-opencode";
|
|
2158
|
-
var PKG_VERSION = true ? "2.
|
|
2157
|
+
var PKG_VERSION = true ? "2.7.0" : "dev";
|
|
2159
2158
|
var DISABLED = process.env.HARNESS_OPENCODE_TELEMETRY === "0" || process.env.HARNESS_OPENCODE_TELEMETRY === "false" || process.env.DO_NOT_TRACK === "1" || process.env.CI === "true";
|
|
2160
2159
|
var SESSION_ID = randomUUID();
|
|
2161
2160
|
function getInstallId() {
|
package/package.json
CHANGED
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@glrs-dev/harness-plugin-opencode",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.0",
|
|
4
4
|
"description": "Opinionated OpenCode agent harness — PRIME, plan, build, QA, skills, MCP wiring, hashline editing.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"module": "./dist/index.mjs",
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"types": "./dist/index.d.ts"
|
|
13
|
+
},
|
|
14
|
+
"./cli": {
|
|
15
|
+
"import": "./dist/cli-exports.js",
|
|
16
|
+
"types": "./dist/cli-exports.d.ts"
|
|
17
|
+
}
|
|
12
18
|
},
|
|
13
19
|
"files": [
|
|
14
20
|
"dist",
|
|
@@ -24,8 +30,7 @@
|
|
|
24
30
|
"typecheck": "tsc --noEmit",
|
|
25
31
|
"test": "bun test",
|
|
26
32
|
"lint": "echo 'no linter configured yet'",
|
|
27
|
-
"dev": "
|
|
28
|
-
"dev:nobuild": "bash -c 'PKG_DIR=\"$PWD\"; cd \"${INIT_CWD:-$PWD}\" && GLRS_CLI_DISPATCHED=1 exec bun \"$PKG_DIR/dist/cli.js\" \"$@\"' --"
|
|
33
|
+
"dev": "tsup --watch"
|
|
29
34
|
},
|
|
30
35
|
"peerDependencies": {
|
|
31
36
|
"@opencode-ai/plugin": "^1.15",
|
package/dist/cli.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bun
|