opencode-beads 0.1.1 → 0.2.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/package.json +1 -1
- package/src/plugin.ts +16 -7
- package/src/vendor.ts +33 -19
package/package.json
CHANGED
package/src/plugin.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
import type { Plugin, PluginInput } from "@opencode-ai/plugin";
|
|
13
|
-
import {
|
|
13
|
+
import { BEADS_GUIDANCE, loadAgent, loadCommands } from "./vendor";
|
|
14
14
|
|
|
15
15
|
type OpencodeClient = PluginInput["client"];
|
|
16
16
|
|
|
@@ -70,7 +70,7 @@ async function injectBeadsContext(
|
|
|
70
70
|
${primeOutput.trim()}
|
|
71
71
|
</beads-context>
|
|
72
72
|
|
|
73
|
-
${
|
|
73
|
+
${BEADS_GUIDANCE}`;
|
|
74
74
|
|
|
75
75
|
// Inject content via noReply + synthetic
|
|
76
76
|
// Must pass model and agent to prevent mode/model switching
|
|
@@ -101,16 +101,25 @@ export const BeadsPlugin: Plugin = async ({ client, $ }) => {
|
|
|
101
101
|
// Skip if already injected this session
|
|
102
102
|
if (injectedSessions.has(sessionID)) return;
|
|
103
103
|
|
|
104
|
-
// Check if
|
|
104
|
+
// Check if beads-context was already injected (handles plugin reload/reconnection)
|
|
105
105
|
try {
|
|
106
106
|
const existing = await client.session.messages({
|
|
107
107
|
path: { id: sessionID },
|
|
108
|
-
query: { limit: 1 },
|
|
109
108
|
});
|
|
110
109
|
|
|
111
|
-
if (existing.data
|
|
112
|
-
|
|
113
|
-
|
|
110
|
+
if (existing.data) {
|
|
111
|
+
const hasBeadsContext = existing.data.some(msg => {
|
|
112
|
+
const parts = (msg as any).parts || (msg.info as any).parts;
|
|
113
|
+
if (!parts) return false;
|
|
114
|
+
return parts.some((part: any) =>
|
|
115
|
+
part.type === 'text' && part.text?.includes('<beads-context>')
|
|
116
|
+
);
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
if (hasBeadsContext) {
|
|
120
|
+
injectedSessions.add(sessionID);
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
114
123
|
}
|
|
115
124
|
} catch {
|
|
116
125
|
// On error, proceed with injection
|
package/src/vendor.ts
CHANGED
|
@@ -84,26 +84,40 @@ async function listVendorFiles(relativePath: string): Promise<string[]> {
|
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
export const
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
- \`
|
|
95
|
-
- \`
|
|
96
|
-
- \`
|
|
97
|
-
- \`
|
|
98
|
-
- \`
|
|
99
|
-
- \`
|
|
100
|
-
- \`
|
|
101
|
-
- \`
|
|
102
|
-
|
|
103
|
-
|
|
87
|
+
export const BEADS_GUIDANCE = `<beads-guidance>
|
|
88
|
+
## CLI Usage
|
|
89
|
+
|
|
90
|
+
**Note:** Beads MCP tools are not available in this environment. Use the \`bd\` CLI via bash instead. MCP tool names map directly to \`bd\` commands.
|
|
91
|
+
|
|
92
|
+
Use the \`bd\` CLI via bash for beads operations:
|
|
93
|
+
|
|
94
|
+
- \`bd init [prefix]\` - Initialize beads
|
|
95
|
+
- \`bd ready --json\` - List ready tasks
|
|
96
|
+
- \`bd show <id> --json\` - Show task details
|
|
97
|
+
- \`bd create "title" -t bug|feature|task -p 0-4 --json\` - Create issue
|
|
98
|
+
- \`bd update <id> --status in_progress --json\` - Update status
|
|
99
|
+
- \`bd close <id> --reason "message" --json\` - Close issue
|
|
100
|
+
- \`bd reopen <id> --json\` - Reopen issue
|
|
101
|
+
- \`bd dep add <from> <to> --type blocks|discovered-from --json\` - Add dependency
|
|
102
|
+
- \`bd list --status open --json\` - List issues
|
|
103
|
+
- \`bd blocked --json\` - Show blocked issues
|
|
104
|
+
- \`bd stats --json\` - Show statistics
|
|
105
|
+
- \`bd sync\` - Sync with git
|
|
106
|
+
|
|
107
|
+
If a tool is not listed above, try \`bd <tool> --help\`.
|
|
104
108
|
|
|
105
109
|
Always use \`--json\` flag for structured output.
|
|
106
|
-
|
|
110
|
+
|
|
111
|
+
## Agent Delegation
|
|
112
|
+
|
|
113
|
+
For multi-step beads work, use the \`task\` tool with \`subagent_type: "beads-task-agent"\`:
|
|
114
|
+
- Finding and completing ready work autonomously
|
|
115
|
+
- Working through multiple issues in sequence
|
|
116
|
+
- Tasks involving claiming, executing, and closing issues
|
|
117
|
+
- When asked to "work on beads issues", "complete tasks", or similar
|
|
118
|
+
|
|
119
|
+
For single, specific operations (check status, create one issue, query info), use \`bd\` CLI directly.
|
|
120
|
+
</beads-guidance>`;
|
|
107
121
|
|
|
108
122
|
export async function loadAgent(): Promise<Config["agent"]> {
|
|
109
123
|
const content = await readVendorFile("agents/task-agent.md");
|
|
@@ -118,7 +132,7 @@ export async function loadAgent(): Promise<Config["agent"]> {
|
|
|
118
132
|
return {
|
|
119
133
|
"beads-task-agent": {
|
|
120
134
|
description,
|
|
121
|
-
prompt:
|
|
135
|
+
prompt: BEADS_GUIDANCE + "\n" + parsed.body,
|
|
122
136
|
mode: "subagent",
|
|
123
137
|
},
|
|
124
138
|
};
|