opencode-conductor-plugin 1.1.1 → 1.1.2
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/dist/index.js +1 -80
- package/package.json +4 -2
- package/scripts/postinstall.cjs +38 -0
package/dist/index.js
CHANGED
|
@@ -3,88 +3,9 @@ import { newTrackCommand } from "./commands/newTrack.js";
|
|
|
3
3
|
import { implementCommand } from "./commands/implement.js";
|
|
4
4
|
import { statusCommand } from "./commands/status.js";
|
|
5
5
|
import { revertCommand } from "./commands/revert.js";
|
|
6
|
-
import { bootstrap } from "./utils/bootstrap.js";
|
|
7
|
-
import { readFile } from "fs/promises";
|
|
8
|
-
import { join, dirname } from "path";
|
|
9
|
-
import { fileURLToPath } from "url";
|
|
10
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
11
|
-
const __dirname = dirname(__filename);
|
|
12
6
|
const ConductorPlugin = async (ctx) => {
|
|
13
|
-
console.log("[Conductor] Plugin
|
|
14
|
-
// Run bootstrap in background to avoid hanging startup
|
|
15
|
-
bootstrap(ctx).catch(err => console.error("[Conductor] Bootstrap failed:", err));
|
|
7
|
+
console.log("[Conductor] Plugin tools loaded.");
|
|
16
8
|
return {
|
|
17
|
-
config: async (config) => {
|
|
18
|
-
console.log("[Conductor] config hook triggered");
|
|
19
|
-
const plugins = config.plugin || [];
|
|
20
|
-
const isOMOActive = plugins.some(p => typeof p === "string" && p.includes("oh-my-opencode"));
|
|
21
|
-
let agentPrompt = "";
|
|
22
|
-
try {
|
|
23
|
-
const promptPath = join(__dirname, "prompts/agent.md");
|
|
24
|
-
agentPrompt = await readFile(promptPath, "utf-8");
|
|
25
|
-
}
|
|
26
|
-
catch (e) {
|
|
27
|
-
console.error("[Conductor] Failed to read agent prompt");
|
|
28
|
-
agentPrompt = "Specialized agent for Conductor spec-driven development.";
|
|
29
|
-
}
|
|
30
|
-
// Do not await toasts in the config hook
|
|
31
|
-
ctx.client.tui.showToast({
|
|
32
|
-
body: {
|
|
33
|
-
title: "Conductor",
|
|
34
|
-
message: isOMOActive ? "Conductor Agent & Commands registered" : "Conductor Commands registered",
|
|
35
|
-
variant: "success",
|
|
36
|
-
duration: 3000
|
|
37
|
-
}
|
|
38
|
-
}).catch(() => { });
|
|
39
|
-
// Register the Conductor Agent logic.
|
|
40
|
-
// User can override the model in their global opencode.json or oh-my-opencode.json
|
|
41
|
-
config.agent = config.agent || {};
|
|
42
|
-
const existingConductor = config.agent["conductor"] || {};
|
|
43
|
-
config.agent["conductor"] = {
|
|
44
|
-
description: "Spec-Driven Development Architect. Manages the project lifecycle using the Conductor protocol.",
|
|
45
|
-
model: existingConductor.model || config.model,
|
|
46
|
-
prompt: agentPrompt,
|
|
47
|
-
...existingConductor,
|
|
48
|
-
tools: {
|
|
49
|
-
...existingConductor.tools,
|
|
50
|
-
conductor_setup: true,
|
|
51
|
-
conductor_new_track: true,
|
|
52
|
-
conductor_implement: true,
|
|
53
|
-
conductor_status: true,
|
|
54
|
-
conductor_revert: true
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
config.command = config.command || {};
|
|
58
|
-
config.command = {
|
|
59
|
-
...config.command,
|
|
60
|
-
"c-setup": {
|
|
61
|
-
description: "Setup or resume Conductor environment",
|
|
62
|
-
agent: "conductor",
|
|
63
|
-
template: "Invoke the conductor_setup tool to start or resume the project initialization. Do NOT create todos during this phase."
|
|
64
|
-
},
|
|
65
|
-
"c-new": {
|
|
66
|
-
description: "Create a new track (feature/bug)",
|
|
67
|
-
agent: "conductor",
|
|
68
|
-
template: "Invoke the conductor_new_track tool with arguments: $ARGUMENTS. Do NOT create todos during this phase."
|
|
69
|
-
},
|
|
70
|
-
"c-implement": {
|
|
71
|
-
description: "Implement the next pending task",
|
|
72
|
-
agent: "conductor",
|
|
73
|
-
template: "Invoke the conductor_implement tool. If a track name is provided ($ARGUMENTS), use it; otherwise, implement the next available track."
|
|
74
|
-
},
|
|
75
|
-
"c-status": {
|
|
76
|
-
description: "Show Conductor project status",
|
|
77
|
-
agent: "conductor",
|
|
78
|
-
template: "Invoke the conductor_status tool to summarize the project progress."
|
|
79
|
-
},
|
|
80
|
-
"c-revert": {
|
|
81
|
-
description: "Revert a track, phase, or task",
|
|
82
|
-
agent: "conductor",
|
|
83
|
-
template: "Invoke the conductor_revert tool for: $ARGUMENTS"
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
console.log("[Conductor] config hook completed");
|
|
87
|
-
},
|
|
88
9
|
tool: {
|
|
89
10
|
conductor_setup: setupCommand(ctx),
|
|
90
11
|
conductor_new_track: newTrackCommand(ctx),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-conductor-plugin",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "Conductor plugin for OpenCode",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": "derekbar90/opencode-conductor",
|
|
@@ -24,9 +24,11 @@
|
|
|
24
24
|
"main": "dist/index.js",
|
|
25
25
|
"types": "dist/index.d.ts",
|
|
26
26
|
"files": [
|
|
27
|
-
"dist"
|
|
27
|
+
"dist",
|
|
28
|
+
"scripts"
|
|
28
29
|
],
|
|
29
30
|
"scripts": {
|
|
31
|
+
"postinstall": "node scripts/postinstall.cjs",
|
|
30
32
|
"build": "tsc && npm run copy-prompts && npm run copy-templates",
|
|
31
33
|
"copy-prompts": "mkdir -p dist/prompts && cp src/prompts/*.toml src/prompts/*.md dist/prompts/ && mkdir -p dist/prompts/agent && cp src/prompts/agent/*.md dist/prompts/agent/ && mkdir -p dist/prompts/commands && cp src/prompts/commands/*.md dist/prompts/commands/",
|
|
32
34
|
"copy-templates": "mkdir -p dist/templates && cp -r src/templates/* dist/templates/",
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const os = require('os');
|
|
4
|
+
|
|
5
|
+
const home = os.homedir();
|
|
6
|
+
const opencodeConfigDir = path.join(home, '.config', 'opencode');
|
|
7
|
+
const targetAgentDir = path.join(opencodeConfigDir, 'agent');
|
|
8
|
+
const targetCommandDir = path.join(opencodeConfigDir, 'command');
|
|
9
|
+
|
|
10
|
+
const sourcePromptsDir = path.join(__dirname, '..', 'dist', 'prompts');
|
|
11
|
+
const sourceAgentFile = path.join(sourcePromptsDir, 'agent', 'conductor.md');
|
|
12
|
+
const sourceCommandsDir = path.join(sourcePromptsDir, 'commands');
|
|
13
|
+
|
|
14
|
+
function ensureDir(dir) {
|
|
15
|
+
if (!fs.existsSync(dir)) {
|
|
16
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
try {
|
|
21
|
+
ensureDir(targetAgentDir);
|
|
22
|
+
ensureDir(targetCommandDir);
|
|
23
|
+
|
|
24
|
+
if (fs.existsSync(sourceAgentFile)) {
|
|
25
|
+
fs.copyFileSync(sourceAgentFile, path.join(targetAgentDir, 'conductor.md'));
|
|
26
|
+
console.log('[Conductor] Installed agent definition.');
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (fs.existsSync(sourceCommandsDir)) {
|
|
30
|
+
const commands = fs.readdirSync(sourceCommandsDir);
|
|
31
|
+
for (const cmdFile of commands) {
|
|
32
|
+
fs.copyFileSync(path.join(sourceCommandsDir, cmdFile), path.join(targetCommandDir, cmdFile));
|
|
33
|
+
}
|
|
34
|
+
console.log('[Conductor] Installed slash commands.');
|
|
35
|
+
}
|
|
36
|
+
} catch (err) {
|
|
37
|
+
console.error('[Conductor] Setup failed:', err.message);
|
|
38
|
+
}
|