opencode-beads 0.1.2 → 0.2.1
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 +2 -2
- package/src/vendor.ts +64 -21
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
|
package/src/vendor.ts
CHANGED
|
@@ -84,26 +84,69 @@ async function listVendorFiles(relativePath: string): Promise<string[]> {
|
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
- \`
|
|
94
|
-
- \`
|
|
95
|
-
- \`
|
|
96
|
-
- \`
|
|
97
|
-
- \`
|
|
98
|
-
- \`
|
|
99
|
-
- \`
|
|
100
|
-
- \`
|
|
101
|
-
- \`
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
87
|
+
const BEADS_CLI_USAGE = `## CLI Usage
|
|
88
|
+
|
|
89
|
+
**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.
|
|
90
|
+
|
|
91
|
+
Use the \`bd\` CLI via bash for beads operations:
|
|
92
|
+
|
|
93
|
+
- \`bd init [prefix]\` - Initialize beads
|
|
94
|
+
- \`bd ready --json\` - List ready tasks
|
|
95
|
+
- \`bd show <id> --json\` - Show task details
|
|
96
|
+
- \`bd create "title" -t bug|feature|task -p 0-4 --json\` - Create issue
|
|
97
|
+
- \`bd update <id> --status in_progress --json\` - Update status
|
|
98
|
+
- \`bd close <id> --reason "message" --json\` - Close issue
|
|
99
|
+
- \`bd reopen <id> --json\` - Reopen issue
|
|
100
|
+
- \`bd dep add <from> <to> --type blocks|discovered-from --json\` - Add dependency
|
|
101
|
+
- \`bd list --status open --json\` - List issues
|
|
102
|
+
- \`bd blocked --json\` - Show blocked issues
|
|
103
|
+
- \`bd stats --json\` - Show statistics
|
|
104
|
+
- \`bd sync\` - Sync with git
|
|
105
|
+
|
|
106
|
+
If a tool is not listed above, try \`bd <tool> --help\`.
|
|
107
|
+
|
|
108
|
+
Always use \`--json\` flag for structured output.`;
|
|
109
|
+
|
|
110
|
+
const BEADS_SUBAGENT_CONTEXT = `## Subagent Context
|
|
111
|
+
|
|
112
|
+
You are called as a subagent. Your **final message** is what gets returned to the calling agent - make it count.
|
|
113
|
+
|
|
114
|
+
**Your purpose:** Handle both status queries AND autonomous task completion.
|
|
115
|
+
|
|
116
|
+
**For status/overview requests** ("what's next", "show me blocked work"):
|
|
117
|
+
- Run the necessary \`bd\` commands to gather data
|
|
118
|
+
- Process the JSON output internally
|
|
119
|
+
- Return a **concise, human-readable summary** with key information
|
|
120
|
+
- Use tables or lists to organize information clearly
|
|
121
|
+
- Example: "You have 3 ready tasks (2 P0, 1 P1), 5 in-progress, and 8 blocked by Epic X"
|
|
122
|
+
|
|
123
|
+
**For task completion requests** ("complete ready work", "work on issues"):
|
|
124
|
+
- Find ready work, claim it, execute it, close it
|
|
125
|
+
- Report progress as you work
|
|
126
|
+
- End with a summary of what was accomplished
|
|
127
|
+
|
|
128
|
+
**Critical:** Do NOT dump raw JSON in your final response. Parse it, summarize it, make it useful.`;
|
|
129
|
+
|
|
130
|
+
export const BEADS_GUIDANCE = `<beads-guidance>
|
|
131
|
+
${BEADS_CLI_USAGE}
|
|
132
|
+
|
|
133
|
+
## Agent Delegation
|
|
134
|
+
|
|
135
|
+
**Default to the agent.** For ANY beads work involving multiple commands or context gathering, use the \`task\` tool with \`subagent_type: "beads-task-agent"\`:
|
|
136
|
+
- Status overviews ("what's next", "what's blocked", "show me progress")
|
|
137
|
+
- Exploring the issue graph (ready + in-progress + blocked queries)
|
|
138
|
+
- Finding and completing ready work
|
|
139
|
+
- Working through multiple issues in sequence
|
|
140
|
+
- Any request that would require 2+ bd commands
|
|
141
|
+
|
|
142
|
+
**Use CLI directly ONLY for single, atomic operations:**
|
|
143
|
+
- Creating exactly one issue: \`bd create "title" ...\`
|
|
144
|
+
- Closing exactly one issue: \`bd close <id> ...\`
|
|
145
|
+
- Updating one specific field: \`bd update <id> --status ...\`
|
|
146
|
+
- When user explicitly requests a specific command
|
|
147
|
+
|
|
148
|
+
**Why delegate?** The agent processes multiple commands internally and returns only a concise summary. Running bd commands directly dumps hundreds of lines of raw JSON into context, wasting tokens and making the conversation harder to follow.
|
|
149
|
+
</beads-guidance>`;
|
|
107
150
|
|
|
108
151
|
export async function loadAgent(): Promise<Config["agent"]> {
|
|
109
152
|
const content = await readVendorFile("agents/task-agent.md");
|
|
@@ -118,7 +161,7 @@ export async function loadAgent(): Promise<Config["agent"]> {
|
|
|
118
161
|
return {
|
|
119
162
|
"beads-task-agent": {
|
|
120
163
|
description,
|
|
121
|
-
prompt:
|
|
164
|
+
prompt: BEADS_CLI_USAGE + "\n\n" + BEADS_SUBAGENT_CONTEXT + "\n\n" + parsed.body,
|
|
122
165
|
mode: "subagent",
|
|
123
166
|
},
|
|
124
167
|
};
|