opencode-beads 0.5.4 → 0.6.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.md +1 -1
- package/package.json +1 -1
- package/src/plugin.ts +42 -0
- package/vendor/agents/task-agent.md +3 -2
- package/vendor/commands/audit.md +1 -1
- package/vendor/commands/export.md +5 -8
- package/vendor/commands/import.md +8 -26
- package/vendor/commands/ready.md +1 -1
- package/vendor/commands/restore.md +3 -4
- package/vendor/commands/sync.md +9 -46
- package/vendor/commands/workflow.md +3 -4
package/README.md
CHANGED
package/package.json
CHANGED
package/src/plugin.ts
CHANGED
|
@@ -14,6 +14,9 @@ import { BEADS_GUIDANCE, loadAgent, loadCommands } from "./vendor";
|
|
|
14
14
|
|
|
15
15
|
type OpencodeClient = PluginInput["client"];
|
|
16
16
|
|
|
17
|
+
/** Name of the plugin's own task agent. Always receives beads context. */
|
|
18
|
+
const BEADS_TASK_AGENT = "beads-task-agent";
|
|
19
|
+
|
|
17
20
|
/**
|
|
18
21
|
* Get the current model/agent context for a session by querying messages.
|
|
19
22
|
*
|
|
@@ -94,6 +97,34 @@ export const BeadsPlugin: Plugin = async ({ client, $ }) => {
|
|
|
94
97
|
|
|
95
98
|
const injectedSessions = new Set<string>();
|
|
96
99
|
|
|
100
|
+
/**
|
|
101
|
+
* Check if an agent should receive beads context injection.
|
|
102
|
+
*
|
|
103
|
+
* Queries the agent list from OpenCode and checks whether the agent is a
|
|
104
|
+
* subagent. Subagents (like `explore` and `general`) are invoked for
|
|
105
|
+
* specific tasks and shouldn't be polluted with beads context — it wastes
|
|
106
|
+
* tokens and can cause them to attempt pointless bd/git operations.
|
|
107
|
+
*
|
|
108
|
+
* Primary agents (`build`, `plan`) are user-facing and benefit from issue
|
|
109
|
+
* awareness. The plugin's own `beads-task-agent` is an explicit exception.
|
|
110
|
+
*
|
|
111
|
+
* Queries fresh each time rather than caching, since agents can change
|
|
112
|
+
* mid-session (config edits, other plugins). This only runs once per
|
|
113
|
+
* session (gated by injectedSessions), so the overhead is negligible.
|
|
114
|
+
*/
|
|
115
|
+
async function shouldInject(agentName: string | undefined): Promise<boolean> {
|
|
116
|
+
if (!agentName || agentName === BEADS_TASK_AGENT) return true;
|
|
117
|
+
|
|
118
|
+
const response = await client.app.agents().catch(() => undefined);
|
|
119
|
+
const agent = response?.data?.find((a) => a.name === agentName);
|
|
120
|
+
if (agent) {
|
|
121
|
+
return agent.mode === "primary" || agent.mode === "all";
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// Query failed or agent not in the list — inject as safe fallback
|
|
125
|
+
return true;
|
|
126
|
+
}
|
|
127
|
+
|
|
97
128
|
return {
|
|
98
129
|
"chat.message": async (_input, output) => {
|
|
99
130
|
const sessionID = output.message.sessionID;
|
|
@@ -101,6 +132,13 @@ export const BeadsPlugin: Plugin = async ({ client, $ }) => {
|
|
|
101
132
|
// Skip if already injected this session
|
|
102
133
|
if (injectedSessions.has(sessionID)) return;
|
|
103
134
|
|
|
135
|
+
// Skip subagents — they're invoked for specific tasks and shouldn't
|
|
136
|
+
// waste tokens on beads context (except our own beads-task-agent)
|
|
137
|
+
if (!(await shouldInject(output.message.agent))) {
|
|
138
|
+
injectedSessions.add(sessionID);
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
|
|
104
142
|
// Check if beads-context was already injected (handles plugin reload/reconnection)
|
|
105
143
|
try {
|
|
106
144
|
const existing = await client.session.messages({
|
|
@@ -140,6 +178,10 @@ export const BeadsPlugin: Plugin = async ({ client, $ }) => {
|
|
|
140
178
|
if (event.type === "session.compacted") {
|
|
141
179
|
const sessionID = event.properties.sessionID;
|
|
142
180
|
const context = await getSessionContext(client, sessionID);
|
|
181
|
+
|
|
182
|
+
// Skip re-injection for subagents
|
|
183
|
+
if (!(await shouldInject(context?.agent))) return;
|
|
184
|
+
|
|
143
185
|
await injectBeadsContext(client, $, sessionID, context);
|
|
144
186
|
}
|
|
145
187
|
},
|
|
@@ -13,7 +13,7 @@ You are a task-completion agent for beads. Your goal is to find ready work and c
|
|
|
13
13
|
|
|
14
14
|
2. **Claim the Task**
|
|
15
15
|
- Use the `show` tool to get full task details
|
|
16
|
-
- Use the `
|
|
16
|
+
- Use the `claim` tool for atomic start-work semantics
|
|
17
17
|
- Report what you're working on
|
|
18
18
|
|
|
19
19
|
3. **Execute the Task**
|
|
@@ -39,7 +39,7 @@ You are a task-completion agent for beads. Your goal is to find ready work and c
|
|
|
39
39
|
|
|
40
40
|
# Important Guidelines
|
|
41
41
|
|
|
42
|
-
- Always claim before working (MCP:
|
|
42
|
+
- Always claim before working (MCP: `claim`; CLI: `--claim`) and close when done
|
|
43
43
|
- Link discovered work with `discovered-from` dependencies
|
|
44
44
|
- Don't close issues unless work is actually complete
|
|
45
45
|
- If blocked, use `update` to set status to `blocked` and explain why
|
|
@@ -50,6 +50,7 @@ You are a task-completion agent for beads. Your goal is to find ready work and c
|
|
|
50
50
|
Via beads MCP server:
|
|
51
51
|
- `ready` - Find unblocked tasks
|
|
52
52
|
- `show` - Get task details
|
|
53
|
+
- `claim` - Atomically claim task for work
|
|
53
54
|
- `update` - Update task status/fields
|
|
54
55
|
- `create` - Create new issues
|
|
55
56
|
- `dep` - Manage dependencies
|
package/vendor/commands/audit.md
CHANGED
|
@@ -23,6 +23,6 @@ Each line is one event. Labeling is done by appending a new `"label"` event refe
|
|
|
23
23
|
## Notes
|
|
24
24
|
|
|
25
25
|
- Audit entries are **append-only** (no in-place edits).
|
|
26
|
-
- `bd
|
|
26
|
+
- `bd dolt push` includes `.beads/interactions.jsonl` in the commit allowlist.
|
|
27
27
|
|
|
28
28
|
|
|
@@ -13,12 +13,9 @@ Export all issues to JSON Lines format (one JSON object per line).
|
|
|
13
13
|
|
|
14
14
|
Issues are sorted by ID for consistent diffs, making git diffs readable.
|
|
15
15
|
|
|
16
|
-
##
|
|
16
|
+
## When to Use
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
-
|
|
22
|
-
- Backup
|
|
23
|
-
- Sharing issues between repositories
|
|
24
|
-
- Data migration
|
|
18
|
+
Dolt is the primary storage backend, so manual export is rarely needed. Use `bd export` when you need:
|
|
19
|
+
- A JSONL snapshot for backup
|
|
20
|
+
- Data migration to another system
|
|
21
|
+
- Sharing issues outside the Dolt workflow
|
|
@@ -1,36 +1,18 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: Import issues from JSONL format
|
|
3
|
-
argument-hint:
|
|
2
|
+
description: Import issues from JSONL format (removed)
|
|
3
|
+
argument-hint: (removed)
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
`bd import` has been **removed**.
|
|
7
7
|
|
|
8
|
-
##
|
|
8
|
+
## Migration
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
- **From file**: `bd import -i issues.jsonl`
|
|
12
|
-
- **Preview**: `bd import -i issues.jsonl --dry-run`
|
|
13
|
-
|
|
14
|
-
## Behavior
|
|
15
|
-
|
|
16
|
-
- **Existing issues** (same ID): Updated with new data
|
|
17
|
-
- **New issues**: Created
|
|
18
|
-
- **Same-ID scenarios**: With hash-based IDs (v0.20.1+), same ID = same issue being updated (not a collision)
|
|
19
|
-
|
|
20
|
-
## Preview Changes
|
|
21
|
-
|
|
22
|
-
Use `--dry-run` to see what will change before importing:
|
|
10
|
+
If you need to import issues from a JSONL file, use `bd init` with the `--from-jsonl` flag:
|
|
23
11
|
|
|
24
12
|
```bash
|
|
25
|
-
bd
|
|
26
|
-
# Shows: new issues, updates, exact matches
|
|
13
|
+
bd init <prefix> --from-jsonl issues.jsonl
|
|
27
14
|
```
|
|
28
15
|
|
|
29
|
-
##
|
|
30
|
-
|
|
31
|
-
The Dolt server automatically imports from `.beads/issues.jsonl` when it's newer than the database (e.g., after `git pull`). Manual import is rarely needed.
|
|
32
|
-
|
|
33
|
-
## Options
|
|
16
|
+
## Note
|
|
34
17
|
|
|
35
|
-
|
|
36
|
-
- **--strict**: Fail on dependency errors instead of warnings
|
|
18
|
+
Dolt is the primary storage backend. Manual JSONL import is no longer supported as a standalone command.
|
package/vendor/commands/ready.md
CHANGED
|
@@ -10,6 +10,6 @@ Call the `ready` tool to get a list of unblocked issues. Then present them to th
|
|
|
10
10
|
- Priority
|
|
11
11
|
- Issue type
|
|
12
12
|
|
|
13
|
-
If there are ready tasks, ask the user which one they'd like to work on. If they choose one, use the `
|
|
13
|
+
If there are ready tasks, ask the user which one they'd like to work on. If they choose one, use the `claim` tool to start work atomically.
|
|
14
14
|
|
|
15
15
|
If there are no ready tasks, suggest checking `blocked` issues or creating a new issue with the `create` tool.
|
|
@@ -8,10 +8,9 @@ Restore full history of a compacted issue from git version control.
|
|
|
8
8
|
When an issue is compacted, the git commit hash is saved. This command:
|
|
9
9
|
|
|
10
10
|
1. Reads the compacted_at_commit from the database
|
|
11
|
-
2.
|
|
12
|
-
3.
|
|
13
|
-
4.
|
|
14
|
-
5. Returns to the current git state
|
|
11
|
+
2. Retrieves the full issue from Dolt history at that point
|
|
12
|
+
3. Displays the full issue history (description, events, etc.)
|
|
13
|
+
4. Returns to the current state
|
|
15
14
|
|
|
16
15
|
## Usage
|
|
17
16
|
|
package/vendor/commands/sync.md
CHANGED
|
@@ -1,54 +1,17 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: Synchronize issues
|
|
3
|
-
argument-hint:
|
|
2
|
+
description: Synchronize issues (deprecated — use bd dolt push/pull)
|
|
3
|
+
argument-hint: (deprecated)
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
`bd sync` is **deprecated** and is now a no-op.
|
|
7
7
|
|
|
8
|
-
##
|
|
8
|
+
## Use Dolt commands instead
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
5. Push local commits to remote
|
|
15
|
-
|
|
16
|
-
Wraps the entire git-based sync workflow for multi-device use.
|
|
17
|
-
|
|
18
|
-
## Usage
|
|
19
|
-
|
|
20
|
-
- **Basic sync**: `bd sync`
|
|
21
|
-
- **Preview**: `bd sync --dry-run`
|
|
22
|
-
- **Custom message**: `bd sync --message "Closed sprint issues"`
|
|
23
|
-
- **Pull only**: `bd sync --no-push`
|
|
24
|
-
- **Push only**: `bd sync --no-pull`
|
|
25
|
-
- **Flush only**: `bd sync --flush-only` (export to JSONL without git operations)
|
|
26
|
-
- **Import only**: `bd sync --import-only` (import from JSONL without git operations)
|
|
27
|
-
|
|
28
|
-
## Separate Branch Workflow
|
|
29
|
-
|
|
30
|
-
When using a separate sync branch (configured via `sync.branch`), additional commands are available:
|
|
31
|
-
|
|
32
|
-
- **Check status**: `bd sync --status` - Show diff between sync branch and main
|
|
33
|
-
- **Merge to main**: `bd sync --merge` - Merge sync branch back to main branch
|
|
34
|
-
- **Preview merge**: `bd sync --merge --dry-run` - Preview what would be merged
|
|
35
|
-
|
|
36
|
-
### Merge Workflow
|
|
37
|
-
|
|
38
|
-
When working with a protected main branch and separate sync branch:
|
|
39
|
-
|
|
40
|
-
1. Beads commits go to the sync branch (e.g., `beads-metadata`)
|
|
41
|
-
2. Use `bd sync --status` to review pending changes
|
|
42
|
-
3. When ready, use `bd sync --merge` to merge back to main
|
|
43
|
-
4. After merge, run `bd import` to update the database
|
|
44
|
-
5. Run `bd sync` to push changes to remote
|
|
45
|
-
|
|
46
|
-
The merge command includes safety checks:
|
|
47
|
-
- Verifies you're not on the sync branch
|
|
48
|
-
- Checks for uncommitted changes in working tree
|
|
49
|
-
- Detects and reports merge conflicts with resolution steps
|
|
50
|
-
- Uses `--no-ff` to create a merge commit for clear history
|
|
10
|
+
- **Push to remote**: `bd dolt push`
|
|
11
|
+
- **Pull from remote**: `bd dolt pull`
|
|
12
|
+
- **Commit pending changes**: `bd dolt commit`
|
|
13
|
+
- **Check connection**: `bd dolt show`
|
|
51
14
|
|
|
52
15
|
## Note
|
|
53
16
|
|
|
54
|
-
Most users should rely on the Dolt server's automatic sync (with `dolt.auto-commit` enabled) instead of running manual sync
|
|
17
|
+
Most users should rely on the Dolt server's automatic sync (with `dolt.auto-commit` enabled) instead of running manual sync commands.
|
|
@@ -14,7 +14,7 @@ Use `/beads:ready` or the `ready` MCP tool to see tasks with no blockers.
|
|
|
14
14
|
## 2. Claim Your Task
|
|
15
15
|
Claim the issue atomically (assignee + `in_progress` in one step):
|
|
16
16
|
- Via command: `/beads:update <id> --claim`
|
|
17
|
-
- Via MCP tool: `
|
|
17
|
+
- Via MCP tool: `claim` with `issue_id: "<id>"`
|
|
18
18
|
|
|
19
19
|
## 3. Work on It
|
|
20
20
|
Implement, test, and document the feature or fix.
|
|
@@ -39,8 +39,7 @@ After closing, check if other work became ready:
|
|
|
39
39
|
- **Priority levels**: 0=critical, 1=high, 2=medium, 3=low, 4=backlog
|
|
40
40
|
- **Issue types**: bug, feature, task, epic, chore
|
|
41
41
|
- **Dependencies**: Use `blocks` for hard dependencies, `related` for soft links
|
|
42
|
-
- **Auto-sync**: Changes
|
|
43
|
-
- **Git workflow**: After `git pull`, JSONL auto-imports if newer than DB
|
|
42
|
+
- **Auto-sync**: Changes are stored in Dolt and synced via `bd dolt push` / `bd dolt pull`
|
|
44
43
|
|
|
45
44
|
## Available Commands
|
|
46
45
|
- `/beads:ready` - Find unblocked work
|
|
@@ -52,7 +51,7 @@ After closing, check if other work became ready:
|
|
|
52
51
|
|
|
53
52
|
## MCP Tools Available
|
|
54
53
|
Use these via the beads MCP server:
|
|
55
|
-
- `ready`, `list`, `show`, `create`, `update`, `close`
|
|
54
|
+
- `ready`, `list`, `show`, `create`, `claim`, `update`, `close`
|
|
56
55
|
- `dep` (manage dependencies), `blocked`, `stats`
|
|
57
56
|
- `init` (initialize bd in a project)
|
|
58
57
|
|