opencode-herdr-orchestration 0.1.3 → 0.1.4
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 +1 -1
- package/package.json +4 -8
- package/src/installer.js +18 -26
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ Capability-separated OpenCode agents for planning, implementation, independent r
|
|
|
4
4
|
|
|
5
5
|
This package registers the agents, provides complete structured worker-response retrieval, injects session-specific orchestration mode into shell environments, and ships a reproducible Git `pre-push` policy for new and existing repositories.
|
|
6
6
|
|
|
7
|
-
Requires Node.js
|
|
7
|
+
Requires Node.js 20 or newer when running the package CLI or tests.
|
|
8
8
|
|
|
9
9
|
## Installation
|
|
10
10
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-herdr-orchestration",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "Capability-separated Herdr orchestration agents for OpenCode",
|
|
5
5
|
"author": "CodingJinxx",
|
|
6
6
|
"repository": {
|
|
@@ -31,13 +31,7 @@
|
|
|
31
31
|
"check": "node --check src/plugin.js && node --check src/index.js && node --check src/agents.js && node --check src/prompts.js && node --check src/response.js && node --check bin/orchestration.js"
|
|
32
32
|
},
|
|
33
33
|
"engines": {
|
|
34
|
-
"node": ">=
|
|
35
|
-
},
|
|
36
|
-
"peerDependencies": {
|
|
37
|
-
"@opencode-ai/plugin": ">=1.3.0 <2"
|
|
38
|
-
},
|
|
39
|
-
"devDependencies": {
|
|
40
|
-
"@opencode-ai/plugin": "1.3.14"
|
|
34
|
+
"node": ">=20"
|
|
41
35
|
},
|
|
42
36
|
"keywords": [
|
|
43
37
|
"opencode",
|
|
@@ -47,6 +41,8 @@
|
|
|
47
41
|
],
|
|
48
42
|
"license": "MIT",
|
|
49
43
|
"dependencies": {
|
|
44
|
+
"@opencode-ai/plugin": "1.3.14",
|
|
45
|
+
"cross-spawn": "7.0.6",
|
|
50
46
|
"jsonc-parser": "3.3.1"
|
|
51
47
|
}
|
|
52
48
|
}
|
package/src/installer.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { execFileSync } from "node:child_process";
|
|
2
1
|
import { copyFileSync, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
3
2
|
import { homedir } from "node:os";
|
|
4
|
-
import {
|
|
3
|
+
import { join, resolve } from "node:path";
|
|
5
4
|
import { pathToFileURL } from "node:url";
|
|
5
|
+
import spawn from "cross-spawn";
|
|
6
6
|
import { applyEdits, modify, parse, printParseErrorCode } from "jsonc-parser";
|
|
7
7
|
|
|
8
8
|
export const PACKAGE_NAME = "opencode-herdr-orchestration";
|
|
9
|
-
const NPM_COMMAND =
|
|
10
|
-
const
|
|
11
|
-
const OPENCODE_COMMAND = process.platform === "win32" ? "opencode.exe" : "opencode";
|
|
9
|
+
const NPM_COMMAND = "npm";
|
|
10
|
+
const OPENCODE_COMMAND = "opencode";
|
|
12
11
|
export const AGENT_NAMES = [
|
|
13
12
|
"shepherd-plan",
|
|
14
13
|
"shepherd-build",
|
|
@@ -18,22 +17,6 @@ export const AGENT_NAMES = [
|
|
|
18
17
|
"shearer-review-medium",
|
|
19
18
|
];
|
|
20
19
|
|
|
21
|
-
function resolveWindowsCommand(name) {
|
|
22
|
-
try {
|
|
23
|
-
return execFileSync("where.exe", [name], { encoding: "utf8", windowsHide: true })
|
|
24
|
-
.split(/\r?\n/)
|
|
25
|
-
.find(Boolean)
|
|
26
|
-
.trim();
|
|
27
|
-
} catch {
|
|
28
|
-
return name;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function resolveNpmCli() {
|
|
33
|
-
const npmShim = resolveWindowsCommand("npm.cmd");
|
|
34
|
-
return join(dirname(npmShim), "node_modules", "npm", "bin", "npm-cli.js");
|
|
35
|
-
}
|
|
36
|
-
|
|
37
20
|
export function configDirectory(env = process.env) {
|
|
38
21
|
if (env.OPENCODE_CONFIG_DIR) return resolve(env.OPENCODE_CONFIG_DIR);
|
|
39
22
|
const home = env.HOME || env.USERPROFILE || homedir();
|
|
@@ -99,12 +82,21 @@ export function backupFile(file, now = new Date()) {
|
|
|
99
82
|
}
|
|
100
83
|
|
|
101
84
|
function run(command, args, options = {}) {
|
|
102
|
-
|
|
85
|
+
const result = spawn.sync(command, args, {
|
|
103
86
|
encoding: "utf8",
|
|
104
87
|
windowsHide: true,
|
|
105
88
|
stdio: ["ignore", "pipe", "pipe"],
|
|
106
89
|
...options,
|
|
107
|
-
})
|
|
90
|
+
});
|
|
91
|
+
if (result.error) throw result.error;
|
|
92
|
+
if (result.status !== 0) {
|
|
93
|
+
const error = new Error(`${command} exited with status ${result.status}.`);
|
|
94
|
+
error.status = result.status;
|
|
95
|
+
error.stdout = result.stdout;
|
|
96
|
+
error.stderr = result.stderr;
|
|
97
|
+
throw error;
|
|
98
|
+
}
|
|
99
|
+
return result.stdout.trim();
|
|
108
100
|
}
|
|
109
101
|
|
|
110
102
|
export function installedVersion(configDir) {
|
|
@@ -118,7 +110,7 @@ export function packageVersion(packageRoot) {
|
|
|
118
110
|
}
|
|
119
111
|
|
|
120
112
|
export function latestVersion() {
|
|
121
|
-
return JSON.parse(run(NPM_COMMAND, [
|
|
113
|
+
return JSON.parse(run(NPM_COMMAND, ["view", PACKAGE_NAME, "version", "--json", "--prefer-online"]));
|
|
122
114
|
}
|
|
123
115
|
|
|
124
116
|
export function installPackage(configDir, version) {
|
|
@@ -126,7 +118,7 @@ export function installPackage(configDir, version) {
|
|
|
126
118
|
const backups = ["package.json", "package-lock.json"]
|
|
127
119
|
.map((name) => backupFile(join(configDir, name)))
|
|
128
120
|
.filter(Boolean);
|
|
129
|
-
run(NPM_COMMAND, [
|
|
121
|
+
run(NPM_COMMAND, ["install", "--save-exact", `${PACKAGE_NAME}@${version}`], { cwd: configDir });
|
|
130
122
|
return backups;
|
|
131
123
|
}
|
|
132
124
|
|
|
@@ -135,7 +127,7 @@ export function uninstallPackage(configDir) {
|
|
|
135
127
|
.map((name) => backupFile(join(configDir, name)))
|
|
136
128
|
.filter(Boolean);
|
|
137
129
|
try {
|
|
138
|
-
run(NPM_COMMAND, [
|
|
130
|
+
run(NPM_COMMAND, ["uninstall", PACKAGE_NAME], { cwd: configDir });
|
|
139
131
|
} catch {}
|
|
140
132
|
return backups;
|
|
141
133
|
}
|