opencode-conductor-plugin 1.22.1 → 1.23.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/README.test.md ADDED
@@ -0,0 +1,51 @@
1
+ # Testing
2
+
3
+ This project uses [Vitest](https://vitest.dev/) for testing.
4
+
5
+ ## Setup
6
+
7
+ Install dependencies:
8
+
9
+ ```bash
10
+ npm install
11
+ ```
12
+
13
+ ## Running Tests
14
+
15
+ Run all tests:
16
+
17
+ ```bash
18
+ npm test
19
+ ```
20
+
21
+ Run tests in watch mode:
22
+
23
+ ```bash
24
+ npm run test:watch
25
+ ```
26
+
27
+ Run tests with coverage:
28
+
29
+ ```bash
30
+ npm run test:coverage
31
+ ```
32
+
33
+ ## Test Structure
34
+
35
+ Tests are located alongside the source files with the `.test.ts` extension:
36
+
37
+ - `src/tools/commands.test.ts` - Tests for command tools
38
+
39
+ ## Writing Tests
40
+
41
+ Tests use Vitest's API with TypeScript support. Example:
42
+
43
+ ```typescript
44
+ import { describe, it, expect, vi } from "vitest"
45
+
46
+ describe("MyFeature", () => {
47
+ it("should work correctly", () => {
48
+ expect(true).toBe(true)
49
+ })
50
+ })
51
+ ```
@@ -32,46 +32,13 @@ async function loadPrompt(filename, replacements = {}) {
32
32
  };
33
33
  }
34
34
  }
35
- // Helper to execute a command prompt in a sub-session
36
- async function executeCommand(ctx, toolContext, promptText, agent, description) {
37
- // Create a sub-session linked to the current one
38
- const createResult = await ctx.client.session.create({
39
- body: {
40
- parentID: toolContext.sessionID,
41
- title: description,
42
- },
43
- });
44
- if (createResult.error)
45
- return `Error: ${createResult.error}`;
46
- const sessionID = createResult.data.id;
47
- // Send the prompt to the agent
48
- await ctx.client.session.prompt({
49
- path: { id: sessionID },
50
- body: {
51
- agent: agent,
52
- parts: [{ type: "text", text: promptText }],
53
- },
54
- });
55
- // Fetch and return the assistant's response
56
- const messagesResult = await ctx.client.session.messages({
57
- path: { id: sessionID },
58
- });
59
- const lastMessage = messagesResult.data
60
- ?.filter((m) => m.info.role === "assistant")
61
- .pop();
62
- const responseText = lastMessage?.parts
63
- ?.filter((p) => p.type === "text")
64
- .map((p) => p.text)
65
- .join("\n") || "No response.";
66
- return `${responseText}\n\n<task_metadata>\nsession_id: ${sessionID}\n</task_metadata>`;
67
- }
68
35
  export function createSetupTool(ctx) {
69
36
  return tool({
70
37
  description: "Scaffolds the project and sets up the Conductor environment",
71
38
  args: {},
72
- async execute(args, toolContext) {
73
- const { prompt, description } = await loadPrompt("setup.toml");
74
- return await executeCommand(ctx, toolContext, prompt, "conductor", description);
39
+ async execute(args) {
40
+ const { prompt } = await loadPrompt("setup.toml");
41
+ return prompt;
75
42
  },
76
43
  });
77
44
  }
@@ -81,12 +48,12 @@ export function createNewTrackTool(ctx) {
81
48
  args: {
82
49
  description: tool.schema.string().optional().describe("Brief description of the track (feature, bug fix, chore, etc.)"),
83
50
  },
84
- async execute(args, toolContext) {
51
+ async execute(args) {
85
52
  const trackDescription = args.description || "";
86
- const { prompt, description } = await loadPrompt("newTrack.toml", {
53
+ const { prompt } = await loadPrompt("newTrack.toml", {
87
54
  args: trackDescription,
88
55
  });
89
- return await executeCommand(ctx, toolContext, prompt, "conductor", description);
56
+ return prompt;
90
57
  },
91
58
  });
92
59
  }
@@ -96,12 +63,12 @@ export function createImplementTool(ctx) {
96
63
  args: {
97
64
  track_name: tool.schema.string().optional().describe("Name or description of the track to implement"),
98
65
  },
99
- async execute(args, toolContext) {
66
+ async execute(args) {
100
67
  const trackName = args.track_name || "";
101
- const { prompt, description } = await loadPrompt("implement.toml", {
68
+ const { prompt } = await loadPrompt("implement.toml", {
102
69
  track_name: trackName,
103
70
  });
104
- return await executeCommand(ctx, toolContext, prompt, "conductor_implementer", description);
71
+ return prompt;
105
72
  },
106
73
  });
107
74
  }
@@ -109,9 +76,9 @@ export function createStatusTool(ctx) {
109
76
  return tool({
110
77
  description: "Displays the current progress of the project",
111
78
  args: {},
112
- async execute(args, toolContext) {
113
- const { prompt, description } = await loadPrompt("status.toml");
114
- return await executeCommand(ctx, toolContext, prompt, "conductor", description);
79
+ async execute(args) {
80
+ const { prompt } = await loadPrompt("status.toml");
81
+ return prompt;
115
82
  },
116
83
  });
117
84
  }
@@ -121,12 +88,12 @@ export function createRevertTool(ctx) {
121
88
  args: {
122
89
  target: tool.schema.string().optional().describe("Target to revert (e.g., 'track <track_id>', 'phase <phase_name>', 'task <task_name>')"),
123
90
  },
124
- async execute(args, toolContext) {
91
+ async execute(args) {
125
92
  const target = args.target || "";
126
- const { prompt, description } = await loadPrompt("revert.toml", {
93
+ const { prompt } = await loadPrompt("revert.toml", {
127
94
  target: target,
128
95
  });
129
- return await executeCommand(ctx, toolContext, prompt, "conductor", description);
96
+ return prompt;
130
97
  },
131
98
  });
132
99
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-conductor-plugin",
3
- "version": "1.22.1",
3
+ "version": "1.23.0",
4
4
  "description": "Conductor plugin for OpenCode",
5
5
  "type": "module",
6
6
  "repository": "derekbar90/opencode-conductor",
@@ -32,6 +32,9 @@
32
32
  "build": "tsc && npm run copy-prompts && npm run copy-templates",
33
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/strategies && cp src/prompts/strategies/*.md dist/prompts/strategies/",
34
34
  "copy-templates": "mkdir -p dist/templates && cp -r src/templates/* dist/templates/",
35
+ "test": "vitest",
36
+ "test:watch": "vitest --watch",
37
+ "test:coverage": "vitest --coverage",
35
38
  "prepublishOnly": "npm run build"
36
39
  },
37
40
  "dependencies": {
@@ -46,8 +49,10 @@
46
49
  "@semantic-release/npm": "^12.0.1",
47
50
  "@semantic-release/release-notes-generator": "^14.0.0",
48
51
  "@types/node": "^20.0.0",
52
+ "@vitest/ui": "^2.0.0",
49
53
  "semantic-release": "^24.2.1",
50
- "typescript": "^5.0.0"
54
+ "typescript": "^5.0.0",
55
+ "vitest": "^2.0.0"
51
56
  },
52
57
  "release": {
53
58
  "branches": [