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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-beads",
3
- "version": "0.1.2",
3
+ "version": "0.2.1",
4
4
  "type": "module",
5
5
  "description": "A plugin for OpenCode that provides integration with the beads issue tracker.",
6
6
  "author": "Josh Thomas <josh@joshthomas.dev>",
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 { CLI_GUIDANCE, loadAgent, loadCommands } from "./vendor";
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
- ${CLI_GUIDANCE}`;
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
- export const CLI_GUIDANCE = `<beads-cli-guidance>
88
- Beads MCP tools are not available. Use the \`bd\` CLI via bash instead:
89
-
90
- - \`init\` → \`bd init [prefix]\`
91
- - \`ready\` \`bd ready --json\`
92
- - \`show\` → \`bd show <id> --json\`
93
- - \`create\` \`bd create "title" -t bug|feature|task -p 0-4 --json\`
94
- - \`update\` \`bd update <id> --status in_progress --json\`
95
- - \`close\` → \`bd close <id> --reason "message" --json\`
96
- - \`reopen\` \`bd reopen <id> --json\`
97
- - \`dep\` → \`bd dep add <from> <to> --type blocks|discovered-from --json\`
98
- - \`list\` \`bd list --status open --json\`
99
- - \`blocked\` \`bd blocked --json\`
100
- - \`stats\` \`bd stats --json\`
101
- - \`sync\` \`bd sync\`
102
-
103
- MCP tools map directly to bd CLI commands. If a tool is not listed above, try \`bd <tool> --help\`.
104
-
105
- Always use \`--json\` flag for structured output.
106
- </beads-cli-guidance>`;
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: CLI_GUIDANCE + "\n" + parsed.body,
164
+ prompt: BEADS_CLI_USAGE + "\n\n" + BEADS_SUBAGENT_CONTEXT + "\n\n" + parsed.body,
122
165
  mode: "subagent",
123
166
  },
124
167
  };