opcrew 0.1.2 → 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 CHANGED
@@ -102,7 +102,7 @@ Publish the package and add it to your OpenCode config:
102
102
 
103
103
  ```json
104
104
  {
105
- "plugin": ["opcrew@0.1.2"]
105
+ "plugin": ["opcrew"]
106
106
  }
107
107
  ```
108
108
 
package/dist/cli.js CHANGED
@@ -7,7 +7,62 @@ import process from "process";
7
7
  // src/cli/install.ts
8
8
  import { mkdir, writeFile } from "fs/promises";
9
9
  import path from "path";
10
-
10
+ // src/core/tools/translations.ts
11
+ var CLAUDE_TOOLS = {
12
+ read: "Read",
13
+ write: "Write",
14
+ edit: "Edit",
15
+ glob: "Glob",
16
+ grep: "Grep",
17
+ execute: "Bash",
18
+ websearch: "WebSearch",
19
+ webfetch: "WebFetch",
20
+ delegate: "Agent",
21
+ todo: "TodoWrite",
22
+ test: "Bash",
23
+ logbook: "Edit",
24
+ skill: "Skill"
25
+ };
26
+ var OPENCODE_TOOLS = {
27
+ read: "read",
28
+ write: "write",
29
+ edit: "edit",
30
+ glob: "glob",
31
+ grep: "grep",
32
+ execute: "bash",
33
+ websearch: "web_search",
34
+ webfetch: "webfetch",
35
+ delegate: "task",
36
+ todo: "todowrite",
37
+ test: "run_tests",
38
+ logbook: "edit_logbook",
39
+ skill: "skill"
40
+ };
41
+ var CODEX_TOOLS = {
42
+ read: "read",
43
+ write: "write",
44
+ edit: "edit",
45
+ glob: "glob",
46
+ grep: "grep",
47
+ execute: "execute",
48
+ websearch: "web_search",
49
+ webfetch: "web_fetch",
50
+ delegate: "task",
51
+ todo: "todo",
52
+ test: "test",
53
+ logbook: "logbook",
54
+ skill: "skill"
55
+ };
56
+ function translateTools(canonicalTools, platform) {
57
+ const maps = {
58
+ claude: CLAUDE_TOOLS,
59
+ opencode: OPENCODE_TOOLS,
60
+ codex: CODEX_TOOLS
61
+ };
62
+ const translationMap = maps[platform];
63
+ const translated = canonicalTools.map((tool) => translationMap[tool]);
64
+ return [...new Set(translated)];
65
+ }
11
66
  // src/core/Agent.ts
12
67
  class OpCrewAgent {
13
68
  config;
@@ -15,10 +70,12 @@ class OpCrewAgent {
15
70
  this.config = config;
16
71
  }
17
72
  compileToMarkdown() {
73
+ const translatedTools = translateTools(this.config.tools, "claude");
74
+ const lowerName = this.config.name.toLowerCase();
18
75
  const frontmatter = `---
19
- name: ${this.config.name}
20
- role: ${this.config.role}
21
- tools: [${this.config.tools.join(", ")}]
76
+ name: ${lowerName}
77
+ description: ${this.config.description}
78
+ tools: [${translatedTools.join(", ")}]
22
79
  ---`;
23
80
  return `${frontmatter}
24
81
  ${this.buildMarkdownBody()}`;
@@ -39,6 +96,16 @@ permission:
39
96
  edit: ${permission.edit}
40
97
  bash: ${permission.bash}
41
98
  webfetch: ${permission.webfetch}
99
+ ---`;
100
+ return `${frontmatter}
101
+ ${this.buildMarkdownBody()}`;
102
+ }
103
+ compileToCodexMarkdown() {
104
+ const translatedTools = translateTools(this.config.tools, "codex");
105
+ const frontmatter = `---
106
+ name: ${this.config.name}
107
+ role: ${this.config.role}
108
+ tools: [${translatedTools.join(", ")}]
42
109
  ---`;
43
110
  return `${frontmatter}
44
111
  ${this.buildMarkdownBody()}`;
@@ -59,6 +126,7 @@ Refer to \`.opcrew/logbook.json\` for the current voyage status.
59
126
  // src/crew/Captain.ts
60
127
  var Captain = new OpCrewAgent({
61
128
  name: "Captain",
129
+ description: "Orchestrator agent that coordinates work delegation and verification. Use for complex multi-step tasks requiring coordination between specialists.",
62
130
  role: "Orchestrator",
63
131
  mode: "primary",
64
132
  instructions: [
@@ -76,12 +144,13 @@ var Captain = new OpCrewAgent({
76
144
  "Knowledge discipline: require crew to read/update docs/knowledge (project map, glossary, relevant ADRs) for any decision or scope change.",
77
145
  "Ensure every material decision is captured as an ADR in docs/knowledge/decisions."
78
146
  ],
79
- tools: ["read_fs", "edit_logbook", "task"]
147
+ tools: ["read", "logbook", "delegate"]
80
148
  });
81
149
 
82
150
  // src/crew/Navigator.ts
83
151
  var Navigator = new OpCrewAgent({
84
152
  name: "Navigator",
153
+ description: "Planning specialist that decomposes work into atomic tasks with clear inputs, outputs, and ownership. Use when you need to chart an implementation path or create a structured plan.",
85
154
  role: "Planner",
86
155
  mode: "subagent",
87
156
  instructions: [
@@ -97,12 +166,13 @@ var Navigator = new OpCrewAgent({
97
166
  "Define verification steps explicitly (diagnostics/tests/build) and include success evidence in the plan.",
98
167
  "Consult docs/knowledge before planning; update project-map/glossary/ADRs when scope or definitions change."
99
168
  ],
100
- tools: ["read_fs", "web_search", "edit_logbook", "todowrite"]
169
+ tools: ["read", "websearch", "logbook", "todo"]
101
170
  });
102
171
 
103
172
  // src/crew/Boatswain.ts
104
173
  var Boatswain = new OpCrewAgent({
105
174
  name: "Boatswain",
175
+ description: "Execution specialist that implements approved plans with precise edits. Use when you need to make code changes, run tests, or execute implementation steps.",
106
176
  role: "Executor",
107
177
  mode: "subagent",
108
178
  instructions: [
@@ -113,14 +183,16 @@ var Boatswain = new OpCrewAgent({
113
183
  "Log completion status, assumptions, and blockers immediately for the Captain.",
114
184
  "Do not re-run delegated exploration; wait for Navigator findings before implementing dependent changes.",
115
185
  "Use verification gates: lsp diagnostics on touched files plus relevant tests/builds before completion.",
116
- "Update docs/knowledge when execution changes assumptions, definitions, or operational steps."
186
+ "Update docs/knowledge when execution changes assumptions, definitions, or operational steps.",
187
+ "Update todo task status immediately upon completion of each task."
117
188
  ],
118
- tools: ["read_fs", "edit_code", "run_tests"]
189
+ tools: ["read", "edit", "test", "todo"]
119
190
  });
120
191
 
121
192
  // src/crew/Quartermaster.ts
122
193
  var Quartermaster = new OpCrewAgent({
123
194
  name: "Quartermaster",
195
+ description: "Quality assurance specialist that reviews diffs, verifies tests pass, and ensures conventions are followed. Use proactively after code changes to verify quality.",
124
196
  role: "Reviewer",
125
197
  mode: "subagent",
126
198
  instructions: [
@@ -133,12 +205,13 @@ var Quartermaster = new OpCrewAgent({
133
205
  "Verify delegation protocol compliance when specialists were involved (task/outcome/tools/must-do/must-not/context).",
134
206
  "Reject approval if docs/knowledge changes are missing for material decisions or scope shifts."
135
207
  ],
136
- tools: ["read", "grep", "bash", "write"]
208
+ tools: ["read", "grep", "execute", "write"]
137
209
  });
138
210
 
139
211
  // src/crew/Scout.ts
140
212
  var Scout = new OpCrewAgent({
141
213
  name: "Scout",
214
+ description: "Research specialist for external information gathering - web searches, documentation lookup, API references, and best practices. Use when you need information from outside the project.",
142
215
  role: "Researcher",
143
216
  mode: "subagent",
144
217
  instructions: [
@@ -153,7 +226,7 @@ var Scout = new OpCrewAgent({
153
226
  "If research reveals the task is more complex than expected, escalate to Navigator for replanning.",
154
227
  "Cache useful references in docs/knowledge for future crew reference."
155
228
  ],
156
- tools: ["web_search", "web_fetch", "read_fs"]
229
+ tools: ["websearch", "webfetch", "read"]
157
230
  });
158
231
 
159
232
  // src/crew/index.ts
@@ -166,7 +239,7 @@ var crew = [
166
239
  ];
167
240
 
168
241
  // src/cli/install.ts
169
- var CLAUDE_DIR = path.join(".claudecode", "agents");
242
+ var CLAUDE_DIR = path.join(".claude", "agents");
170
243
  var OPENCODE_DIR = path.join(".opencode", "agents");
171
244
  var CODEX_FILE = path.join(".codex", "instructions.md");
172
245
  async function ensureDir(targetDir) {
@@ -190,7 +263,7 @@ async function installToTool(tool) {
190
263
  async function installForCodex() {
191
264
  const codexDir = path.dirname(CODEX_FILE);
192
265
  await ensureDir(codexDir);
193
- const compiled = crew.map((agent) => agent.compileToMarkdown()).join(`
266
+ const compiled = crew.map((agent) => agent.compileToCodexMarkdown()).join(`
194
267
 
195
268
  ---
196
269
 
@@ -1,15 +1,74 @@
1
1
  // @bun
2
2
  var __defProp = Object.defineProperty;
3
+ var __returnValue = (v) => v;
4
+ function __exportSetter(name, newValue) {
5
+ this[name] = __returnValue.bind(null, newValue);
6
+ }
3
7
  var __export = (target, all) => {
4
8
  for (var name in all)
5
9
  __defProp(target, name, {
6
10
  get: all[name],
7
11
  enumerable: true,
8
12
  configurable: true,
9
- set: (newValue) => all[name] = () => newValue
13
+ set: __exportSetter.bind(all, name)
10
14
  });
11
15
  };
12
-
16
+ // src/core/tools/translations.ts
17
+ var CLAUDE_TOOLS = {
18
+ read: "Read",
19
+ write: "Write",
20
+ edit: "Edit",
21
+ glob: "Glob",
22
+ grep: "Grep",
23
+ execute: "Bash",
24
+ websearch: "WebSearch",
25
+ webfetch: "WebFetch",
26
+ delegate: "Agent",
27
+ todo: "TodoWrite",
28
+ test: "Bash",
29
+ logbook: "Edit",
30
+ skill: "Skill"
31
+ };
32
+ var OPENCODE_TOOLS = {
33
+ read: "read",
34
+ write: "write",
35
+ edit: "edit",
36
+ glob: "glob",
37
+ grep: "grep",
38
+ execute: "bash",
39
+ websearch: "web_search",
40
+ webfetch: "webfetch",
41
+ delegate: "task",
42
+ todo: "todowrite",
43
+ test: "run_tests",
44
+ logbook: "edit_logbook",
45
+ skill: "skill"
46
+ };
47
+ var CODEX_TOOLS = {
48
+ read: "read",
49
+ write: "write",
50
+ edit: "edit",
51
+ glob: "glob",
52
+ grep: "grep",
53
+ execute: "execute",
54
+ websearch: "web_search",
55
+ webfetch: "web_fetch",
56
+ delegate: "task",
57
+ todo: "todo",
58
+ test: "test",
59
+ logbook: "logbook",
60
+ skill: "skill"
61
+ };
62
+ function translateTools(canonicalTools, platform) {
63
+ const maps = {
64
+ claude: CLAUDE_TOOLS,
65
+ opencode: OPENCODE_TOOLS,
66
+ codex: CODEX_TOOLS
67
+ };
68
+ const translationMap = maps[platform];
69
+ const translated = canonicalTools.map((tool) => translationMap[tool]);
70
+ return [...new Set(translated)];
71
+ }
13
72
  // src/core/Agent.ts
14
73
  class OpCrewAgent {
15
74
  config;
@@ -17,10 +76,12 @@ class OpCrewAgent {
17
76
  this.config = config;
18
77
  }
19
78
  compileToMarkdown() {
79
+ const translatedTools = translateTools(this.config.tools, "claude");
80
+ const lowerName = this.config.name.toLowerCase();
20
81
  const frontmatter = `---
21
- name: ${this.config.name}
22
- role: ${this.config.role}
23
- tools: [${this.config.tools.join(", ")}]
82
+ name: ${lowerName}
83
+ description: ${this.config.description}
84
+ tools: [${translatedTools.join(", ")}]
24
85
  ---`;
25
86
  return `${frontmatter}
26
87
  ${this.buildMarkdownBody()}`;
@@ -41,6 +102,16 @@ permission:
41
102
  edit: ${permission.edit}
42
103
  bash: ${permission.bash}
43
104
  webfetch: ${permission.webfetch}
105
+ ---`;
106
+ return `${frontmatter}
107
+ ${this.buildMarkdownBody()}`;
108
+ }
109
+ compileToCodexMarkdown() {
110
+ const translatedTools = translateTools(this.config.tools, "codex");
111
+ const frontmatter = `---
112
+ name: ${this.config.name}
113
+ role: ${this.config.role}
114
+ tools: [${translatedTools.join(", ")}]
44
115
  ---`;
45
116
  return `${frontmatter}
46
117
  ${this.buildMarkdownBody()}`;
@@ -61,6 +132,7 @@ Refer to \`.opcrew/logbook.json\` for the current voyage status.
61
132
  // src/crew/Captain.ts
62
133
  var Captain = new OpCrewAgent({
63
134
  name: "Captain",
135
+ description: "Orchestrator agent that coordinates work delegation and verification. Use for complex multi-step tasks requiring coordination between specialists.",
64
136
  role: "Orchestrator",
65
137
  mode: "primary",
66
138
  instructions: [
@@ -78,12 +150,13 @@ var Captain = new OpCrewAgent({
78
150
  "Knowledge discipline: require crew to read/update docs/knowledge (project map, glossary, relevant ADRs) for any decision or scope change.",
79
151
  "Ensure every material decision is captured as an ADR in docs/knowledge/decisions."
80
152
  ],
81
- tools: ["read_fs", "edit_logbook", "task"]
153
+ tools: ["read", "logbook", "delegate"]
82
154
  });
83
155
 
84
156
  // src/crew/Navigator.ts
85
157
  var Navigator = new OpCrewAgent({
86
158
  name: "Navigator",
159
+ description: "Planning specialist that decomposes work into atomic tasks with clear inputs, outputs, and ownership. Use when you need to chart an implementation path or create a structured plan.",
87
160
  role: "Planner",
88
161
  mode: "subagent",
89
162
  instructions: [
@@ -99,12 +172,13 @@ var Navigator = new OpCrewAgent({
99
172
  "Define verification steps explicitly (diagnostics/tests/build) and include success evidence in the plan.",
100
173
  "Consult docs/knowledge before planning; update project-map/glossary/ADRs when scope or definitions change."
101
174
  ],
102
- tools: ["read_fs", "web_search", "edit_logbook", "todowrite"]
175
+ tools: ["read", "websearch", "logbook", "todo"]
103
176
  });
104
177
 
105
178
  // src/crew/Boatswain.ts
106
179
  var Boatswain = new OpCrewAgent({
107
180
  name: "Boatswain",
181
+ description: "Execution specialist that implements approved plans with precise edits. Use when you need to make code changes, run tests, or execute implementation steps.",
108
182
  role: "Executor",
109
183
  mode: "subagent",
110
184
  instructions: [
@@ -115,14 +189,16 @@ var Boatswain = new OpCrewAgent({
115
189
  "Log completion status, assumptions, and blockers immediately for the Captain.",
116
190
  "Do not re-run delegated exploration; wait for Navigator findings before implementing dependent changes.",
117
191
  "Use verification gates: lsp diagnostics on touched files plus relevant tests/builds before completion.",
118
- "Update docs/knowledge when execution changes assumptions, definitions, or operational steps."
192
+ "Update docs/knowledge when execution changes assumptions, definitions, or operational steps.",
193
+ "Update todo task status immediately upon completion of each task."
119
194
  ],
120
- tools: ["read_fs", "edit_code", "run_tests"]
195
+ tools: ["read", "edit", "test", "todo"]
121
196
  });
122
197
 
123
198
  // src/crew/Quartermaster.ts
124
199
  var Quartermaster = new OpCrewAgent({
125
200
  name: "Quartermaster",
201
+ description: "Quality assurance specialist that reviews diffs, verifies tests pass, and ensures conventions are followed. Use proactively after code changes to verify quality.",
126
202
  role: "Reviewer",
127
203
  mode: "subagent",
128
204
  instructions: [
@@ -135,12 +211,13 @@ var Quartermaster = new OpCrewAgent({
135
211
  "Verify delegation protocol compliance when specialists were involved (task/outcome/tools/must-do/must-not/context).",
136
212
  "Reject approval if docs/knowledge changes are missing for material decisions or scope shifts."
137
213
  ],
138
- tools: ["read", "grep", "bash", "write"]
214
+ tools: ["read", "grep", "execute", "write"]
139
215
  });
140
216
 
141
217
  // src/crew/Scout.ts
142
218
  var Scout = new OpCrewAgent({
143
219
  name: "Scout",
220
+ description: "Research specialist for external information gathering - web searches, documentation lookup, API references, and best practices. Use when you need information from outside the project.",
144
221
  role: "Researcher",
145
222
  mode: "subagent",
146
223
  instructions: [
@@ -155,7 +232,7 @@ var Scout = new OpCrewAgent({
155
232
  "If research reveals the task is more complex than expected, escalate to Navigator for replanning.",
156
233
  "Cache useful references in docs/knowledge for future crew reference."
157
234
  ],
158
- tools: ["web_search", "web_fetch", "read_fs"]
235
+ tools: ["websearch", "webfetch", "read"]
159
236
  });
160
237
 
161
238
  // src/crew/index.ts
@@ -10251,10 +10328,10 @@ function _property(property, schema, params) {
10251
10328
  ...normalizeParams(params)
10252
10329
  });
10253
10330
  }
10254
- function _mime(types, params) {
10331
+ function _mime(types2, params) {
10255
10332
  return new $ZodCheckMimeType({
10256
10333
  check: "mime_type",
10257
- mime: types,
10334
+ mime: types2,
10258
10335
  ...normalizeParams(params)
10259
10336
  });
10260
10337
  }
@@ -12164,7 +12241,7 @@ var ZodFile = /* @__PURE__ */ $constructor("ZodFile", (inst, def) => {
12164
12241
  ZodType.init(inst, def);
12165
12242
  inst.min = (size, params) => inst.check(_minSize(size, params));
12166
12243
  inst.max = (size, params) => inst.check(_maxSize(size, params));
12167
- inst.mime = (types, params) => inst.check(_mime(Array.isArray(types) ? types : [types], params));
12244
+ inst.mime = (types2, params) => inst.check(_mime(Array.isArray(types2) ? types2 : [types2], params));
12168
12245
  });
12169
12246
  function file(params) {
12170
12247
  return _file(ZodFile, params);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "opcrew",
3
3
  "description": "OpenCrew agents and OpenCode plugin",
4
- "version": "0.1.2",
4
+ "version": "0.1.4",
5
5
  "main": "./dist/opencode-plugin.js",
6
6
  "module": "./dist/opencode-plugin.js",
7
7
  "type": "module",
@@ -1,14 +0,0 @@
1
- export interface AgentConfig {
2
- name: string;
3
- role: 'Orchestrator' | 'Planner' | 'Executor' | 'Reviewer' | 'Researcher';
4
- mode: 'primary' | 'subagent';
5
- instructions: string[];
6
- tools: string[];
7
- }
8
- export declare class OpCrewAgent {
9
- readonly config: AgentConfig;
10
- constructor(config: AgentConfig);
11
- compileToMarkdown(): string;
12
- compileToOpenCodeMarkdown(): string;
13
- private buildMarkdownBody;
14
- }
@@ -1,2 +0,0 @@
1
- import { OpCrewAgent } from "../core/Agent";
2
- export declare const Boatswain: OpCrewAgent;
@@ -1,2 +0,0 @@
1
- import { OpCrewAgent } from "../core/Agent";
2
- export declare const Captain: OpCrewAgent;
@@ -1,2 +0,0 @@
1
- import { OpCrewAgent } from "../core/Agent";
2
- export declare const Navigator: OpCrewAgent;
@@ -1,2 +0,0 @@
1
- import { OpCrewAgent } from "../core/Agent";
2
- export declare const Quartermaster: OpCrewAgent;
@@ -1,2 +0,0 @@
1
- import { OpCrewAgent } from "../core/Agent";
2
- export declare const Scout: OpCrewAgent;
@@ -1,7 +0,0 @@
1
- import { Captain } from "./Captain";
2
- import { Navigator } from "./Navigator";
3
- import { Boatswain } from "./Boatswain";
4
- import { Quartermaster } from "./Quartermaster";
5
- import { Scout } from "./Scout";
6
- export declare const crew: readonly [import("../core/Agent").OpCrewAgent, import("../core/Agent").OpCrewAgent, import("../core/Agent").OpCrewAgent, import("../core/Agent").OpCrewAgent, import("../core/Agent").OpCrewAgent];
7
- export { Captain, Navigator, Boatswain, Quartermaster, Scout };
@@ -1,3 +0,0 @@
1
- import type { Plugin } from "@opencode-ai/plugin";
2
- export declare const OpCrewPlugin: Plugin;
3
- export default OpCrewPlugin;
@@ -1,32 +0,0 @@
1
- export declare const editLogbookTool: {
2
- description: string;
3
- args: {
4
- action: import("zod").ZodEnum<{
5
- add: "add";
6
- update: "update";
7
- remove: "remove";
8
- set_voyage: "set_voyage";
9
- }>;
10
- section: import("zod").ZodOptional<import("zod").ZodEnum<{
11
- missions: "missions";
12
- decisions: "decisions";
13
- blockers: "blockers";
14
- notes: "notes";
15
- }>>;
16
- id: import("zod").ZodOptional<import("zod").ZodString>;
17
- data: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodUnknown>>;
18
- voyage_status: import("zod").ZodOptional<import("zod").ZodEnum<{
19
- idle: "idle";
20
- active: "active";
21
- blocked: "blocked";
22
- completed: "completed";
23
- }>>;
24
- };
25
- execute(args: {
26
- action: "add" | "update" | "remove" | "set_voyage";
27
- section?: "missions" | "decisions" | "blockers" | "notes" | undefined;
28
- id?: string | undefined;
29
- data?: Record<string, unknown> | undefined;
30
- voyage_status?: "idle" | "active" | "blocked" | "completed" | undefined;
31
- }, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
32
- };