opencode-orchestrator 0.1.6
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/LICENSE +21 -0
- package/README.md +156 -0
- package/bin/orchestrator +0 -0
- package/dist/index.d.ts +75 -0
- package/dist/index.js +13033 -0
- package/dist/scripts/postinstall.js +53 -0
- package/package.json +80 -0
- package/scripts/postinstall.ts +73 -0
- package/src/index.ts +791 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// scripts/postinstall.ts
|
|
4
|
+
import { existsSync, readFileSync, writeFileSync, mkdirSync } from "fs";
|
|
5
|
+
import { join } from "path";
|
|
6
|
+
import { homedir } from "os";
|
|
7
|
+
var CONFIG_DIR = join(homedir(), ".config", "opencode");
|
|
8
|
+
var CONFIG_FILE = join(CONFIG_DIR, "opencode.json");
|
|
9
|
+
var PLUGIN_NAME = "opencode-orchestrator";
|
|
10
|
+
function getPluginPath() {
|
|
11
|
+
try {
|
|
12
|
+
const packagePath = new URL(".", import.meta.url).pathname;
|
|
13
|
+
return packagePath.replace(/\/$/, "");
|
|
14
|
+
} catch {
|
|
15
|
+
return PLUGIN_NAME;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
function install() {
|
|
19
|
+
console.log("\uD83E\uDD80 OpenCode Orchestrator - Installing...");
|
|
20
|
+
if (!existsSync(CONFIG_DIR)) {
|
|
21
|
+
mkdirSync(CONFIG_DIR, { recursive: true });
|
|
22
|
+
}
|
|
23
|
+
let config = {};
|
|
24
|
+
if (existsSync(CONFIG_FILE)) {
|
|
25
|
+
try {
|
|
26
|
+
config = JSON.parse(readFileSync(CONFIG_FILE, "utf-8"));
|
|
27
|
+
} catch {
|
|
28
|
+
config = {};
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
if (!config.plugin) {
|
|
32
|
+
config.plugin = [];
|
|
33
|
+
}
|
|
34
|
+
const pluginPath = getPluginPath();
|
|
35
|
+
const hasPlugin = config.plugin.some((p) => p === PLUGIN_NAME || p === pluginPath || p.includes("opencode-orchestrator"));
|
|
36
|
+
if (!hasPlugin) {
|
|
37
|
+
config.plugin.push(PLUGIN_NAME);
|
|
38
|
+
writeFileSync(CONFIG_FILE, JSON.stringify(config, null, 2));
|
|
39
|
+
console.log("✅ Plugin registered!");
|
|
40
|
+
console.log(` Config: ${CONFIG_FILE}`);
|
|
41
|
+
} else {
|
|
42
|
+
console.log("✅ Plugin already registered.");
|
|
43
|
+
}
|
|
44
|
+
console.log("");
|
|
45
|
+
console.log("\uD83D\uDE80 Ready! Restart OpenCode to use.");
|
|
46
|
+
console.log("");
|
|
47
|
+
console.log("Commands:");
|
|
48
|
+
console.log(' /auto "task" - Autonomous execution');
|
|
49
|
+
console.log(' /plan "task" - Decompose into atomic tasks');
|
|
50
|
+
console.log(" /review - Quality check");
|
|
51
|
+
console.log("");
|
|
52
|
+
}
|
|
53
|
+
install();
|
package/package.json
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "opencode-orchestrator",
|
|
3
|
+
"version": "0.1.6",
|
|
4
|
+
"description": "6-Agent collaborative architecture for OpenCode - Make any model reliable",
|
|
5
|
+
"author": "agnusdei1207",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/agnusdei1207/opencode-orchestrator"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/agnusdei1207/opencode-orchestrator#readme",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/agnusdei1207/opencode-orchestrator/issues"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"opencode",
|
|
17
|
+
"ai",
|
|
18
|
+
"agent",
|
|
19
|
+
"orchestrator",
|
|
20
|
+
"multi-agent",
|
|
21
|
+
"llm",
|
|
22
|
+
"plugin",
|
|
23
|
+
"code-generation"
|
|
24
|
+
],
|
|
25
|
+
"main": "dist/index.js",
|
|
26
|
+
"types": "dist/index.d.ts",
|
|
27
|
+
"type": "module",
|
|
28
|
+
"bin": {
|
|
29
|
+
"opencode-orchestrator": "./bin/orchestrator"
|
|
30
|
+
},
|
|
31
|
+
"exports": {
|
|
32
|
+
".": {
|
|
33
|
+
"types": "./dist/index.d.ts",
|
|
34
|
+
"import": "./dist/index.js"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"files": [
|
|
38
|
+
"dist",
|
|
39
|
+
"bin",
|
|
40
|
+
"src",
|
|
41
|
+
"scripts",
|
|
42
|
+
"README.md",
|
|
43
|
+
"LICENSE"
|
|
44
|
+
],
|
|
45
|
+
"scripts": {
|
|
46
|
+
"// === BUILD: Individual Steps ===": "",
|
|
47
|
+
"build:rust": "docker compose run --rm dev",
|
|
48
|
+
"build:rust:copy": "docker compose run --rm dev sh -c 'cp /app/target/release/orchestrator /app/bin/' && chmod +x bin/orchestrator",
|
|
49
|
+
"build:ts": "bun build src/index.ts --outdir dist --target bun --format esm && tsc --emitDeclarationOnly",
|
|
50
|
+
"build:scripts": "mkdir -p dist/scripts && bun build scripts/postinstall.ts --outdir dist/scripts --target node",
|
|
51
|
+
"// === BUILD: Combined ===": "",
|
|
52
|
+
"build": "bun run build:ts && bun run build:scripts",
|
|
53
|
+
"build:full": "bun run build:rust && bun run build:rust:copy && bun run build",
|
|
54
|
+
"// === TEST ===": "",
|
|
55
|
+
"test": "docker compose run --rm test",
|
|
56
|
+
"test:local": "cargo test",
|
|
57
|
+
"// === PUBLISH: Steps ===": "",
|
|
58
|
+
"version:patch": "npm version patch --no-git-tag-version",
|
|
59
|
+
"version:minor": "npm version minor --no-git-tag-version",
|
|
60
|
+
"version:major": "npm version major --no-git-tag-version",
|
|
61
|
+
"// === PUBLISH: Combined ===": "",
|
|
62
|
+
"prepublishOnly": "bun run build",
|
|
63
|
+
"publish:npm": "npm publish --access public",
|
|
64
|
+
"// === RELEASE: Full Workflow ===": "",
|
|
65
|
+
"release:patch": "bun run build:full && bun run test && bun run version:patch && bun run publish:npm && bun run release:git",
|
|
66
|
+
"release:minor": "bun run build:full && bun run test && bun run version:minor && bun run publish:npm && bun run release:git",
|
|
67
|
+
"release:major": "bun run build:full && bun run test && bun run version:major && bun run publish:npm && bun run release:git",
|
|
68
|
+
"release:git": "git add -A && git commit -m \"Release v$(node -p \"require('./package.json').version\")\" && git tag \"v$(node -p \"require('./package.json').version\")\" && git push && git push --tags",
|
|
69
|
+
"// === INSTALL HOOKS ===": "",
|
|
70
|
+
"postinstall": "node dist/scripts/postinstall.js 2>/dev/null || true"
|
|
71
|
+
},
|
|
72
|
+
"dependencies": {
|
|
73
|
+
"@opencode-ai/plugin": "^1.1.1",
|
|
74
|
+
"@opencode-ai/sdk": "^1.1.14"
|
|
75
|
+
},
|
|
76
|
+
"devDependencies": {
|
|
77
|
+
"@types/node": "^22.0.0",
|
|
78
|
+
"typescript": "^5.7.0"
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* OpenCode Orchestrator - Post-install script
|
|
5
|
+
* Automatically registers the plugin with OpenCode
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { existsSync, readFileSync, writeFileSync, mkdirSync } from "fs";
|
|
9
|
+
import { join } from "path";
|
|
10
|
+
import { homedir } from "os";
|
|
11
|
+
|
|
12
|
+
const CONFIG_DIR = join(homedir(), ".config", "opencode");
|
|
13
|
+
const CONFIG_FILE = join(CONFIG_DIR, "opencode.json");
|
|
14
|
+
const PLUGIN_NAME = "opencode-orchestrator";
|
|
15
|
+
|
|
16
|
+
function getPluginPath() {
|
|
17
|
+
// Find where this package is installed
|
|
18
|
+
try {
|
|
19
|
+
const packagePath = new URL(".", import.meta.url).pathname;
|
|
20
|
+
return packagePath.replace(/\/$/, "");
|
|
21
|
+
} catch {
|
|
22
|
+
return PLUGIN_NAME;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function install() {
|
|
27
|
+
console.log("🦀 OpenCode Orchestrator - Installing...");
|
|
28
|
+
|
|
29
|
+
// Ensure config directory exists
|
|
30
|
+
if (!existsSync(CONFIG_DIR)) {
|
|
31
|
+
mkdirSync(CONFIG_DIR, { recursive: true });
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Load or create config
|
|
35
|
+
let config: Record<string, any> = {};
|
|
36
|
+
if (existsSync(CONFIG_FILE)) {
|
|
37
|
+
try {
|
|
38
|
+
config = JSON.parse(readFileSync(CONFIG_FILE, "utf-8"));
|
|
39
|
+
} catch {
|
|
40
|
+
config = {};
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Add plugin if not already present
|
|
45
|
+
if (!config.plugin) {
|
|
46
|
+
config.plugin = [];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const pluginPath = getPluginPath();
|
|
50
|
+
const hasPlugin = config.plugin.some((p: string) =>
|
|
51
|
+
p === PLUGIN_NAME || p === pluginPath || p.includes("opencode-orchestrator")
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
if (!hasPlugin) {
|
|
55
|
+
config.plugin.push(PLUGIN_NAME);
|
|
56
|
+
writeFileSync(CONFIG_FILE, JSON.stringify(config, null, 2));
|
|
57
|
+
console.log("✅ Plugin registered!");
|
|
58
|
+
console.log(` Config: ${CONFIG_FILE}`);
|
|
59
|
+
} else {
|
|
60
|
+
console.log("✅ Plugin already registered.");
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
console.log("");
|
|
64
|
+
console.log("🚀 Ready! Restart OpenCode to use.");
|
|
65
|
+
console.log("");
|
|
66
|
+
console.log("Commands:");
|
|
67
|
+
console.log(" /auto \"task\" - Autonomous execution");
|
|
68
|
+
console.log(" /plan \"task\" - Decompose into atomic tasks");
|
|
69
|
+
console.log(" /review - Quality check");
|
|
70
|
+
console.log("");
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
install();
|