opencode-hive 0.8.2 → 0.8.3

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.
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Builtin Skills for Hive
3
+ *
4
+ * Following OMO-Slim pattern - skills are loaded from templates.
5
+ * This file provides the infrastructure to load builtin skills.
6
+ */
7
+ import type { SkillDefinition, SkillLoadResult } from './types.js';
8
+ /**
9
+ * List of builtin skill names.
10
+ * These are loaded from packages/hive-core/templates/skills/
11
+ */
12
+ export declare const BUILTIN_SKILLS: readonly ["hive"];
13
+ export type BuiltinSkillName = typeof BUILTIN_SKILLS[number];
14
+ /**
15
+ * Load a builtin skill by name.
16
+ */
17
+ export declare function loadBuiltinSkill(name: string): SkillLoadResult;
18
+ /**
19
+ * Get all builtin skills.
20
+ */
21
+ export declare function getBuiltinSkills(): SkillDefinition[];
22
+ /**
23
+ * Get skill metadata for tool description (XML format).
24
+ */
25
+ export declare function getBuiltinSkillsXml(): string;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Hive Skills System
3
+ *
4
+ * Export skill infrastructure for use in hive_skill tool.
5
+ */
6
+ export type { SkillDefinition, SkillLoadResult } from './types.js';
7
+ export { BUILTIN_SKILLS, loadBuiltinSkill, getBuiltinSkills, getBuiltinSkillsXml, type BuiltinSkillName } from './builtin.js';
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Hive Skill System Types
3
+ *
4
+ * Following OMO-Slim pattern for skill definitions.
5
+ */
6
+ /**
7
+ * Definition of a skill that can be loaded by agents.
8
+ */
9
+ export interface SkillDefinition {
10
+ /** Unique identifier for the skill */
11
+ name: string;
12
+ /** Brief description shown in available_skills list */
13
+ description: string;
14
+ /** Markdown content with detailed instructions */
15
+ template: string;
16
+ }
17
+ /**
18
+ * Result returned when loading a skill.
19
+ */
20
+ export interface SkillLoadResult {
21
+ /** Whether the skill was found */
22
+ found: boolean;
23
+ /** The loaded skill definition if found */
24
+ skill?: SkillDefinition;
25
+ /** Error message if not found */
26
+ error?: string;
27
+ /** Source of the skill (builtin or file path) */
28
+ source?: 'builtin' | string;
29
+ }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Agent selection for OMO-Slim delegation.
3
+ * Maps task content patterns to specialized agent types.
4
+ */
5
+ export type OmoSlimAgent = 'general' | 'explore' | 'librarian' | 'oracle' | 'frontend-ui-ux-engineer' | 'document-writer' | 'multimodal-looker' | 'code-simplicity-reviewer';
6
+ /**
7
+ * Select the best OMO-Slim agent for a task based on content analysis.
8
+ *
9
+ * @param taskName - The task name/title
10
+ * @param spec - The task specification/description
11
+ * @returns The selected agent type
12
+ */
13
+ export declare function selectAgent(taskName: string, spec: string): OmoSlimAgent;
14
+ /**
15
+ * Get a human-readable description of an agent's purpose.
16
+ */
17
+ export declare function getAgentDescription(agent: OmoSlimAgent): string;
18
+ /**
19
+ * Get all available agent types.
20
+ */
21
+ export declare function getAvailableAgents(): OmoSlimAgent[];
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Worker prompt builder for Hive delegated execution.
3
+ * Builds context-rich prompts for worker agents with all Hive context.
4
+ */
5
+ export interface ContextFile {
6
+ name: string;
7
+ content: string;
8
+ }
9
+ export interface CompletedTask {
10
+ name: string;
11
+ summary: string;
12
+ }
13
+ export interface ContinueFromBlocked {
14
+ status: 'blocked';
15
+ previousSummary: string;
16
+ decision: string;
17
+ }
18
+ export interface WorkerPromptParams {
19
+ feature: string;
20
+ task: string;
21
+ taskOrder: number;
22
+ worktreePath: string;
23
+ branch: string;
24
+ plan: string;
25
+ contextFiles: ContextFile[];
26
+ spec: string;
27
+ previousTasks?: CompletedTask[];
28
+ continueFrom?: ContinueFromBlocked;
29
+ }
30
+ /**
31
+ * Build a context-rich prompt for a worker agent.
32
+ *
33
+ * Includes:
34
+ * - Assignment details (feature, task, worktree, branch)
35
+ * - Plan context
36
+ * - Context files (royal jelly)
37
+ * - Previous task summaries
38
+ * - Mission (spec)
39
+ * - Blocker protocol (NOT question tool)
40
+ * - Completion protocol
41
+ */
42
+ export declare function buildWorkerPrompt(params: WorkerPromptParams): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-hive",
3
- "version": "0.8.2",
3
+ "version": "0.8.3",
4
4
  "type": "module",
5
5
  "description": "OpenCode plugin for Agent Hive - from vibe coding to hive coding",
6
6
  "license": "MIT WITH Commons-Clause",
@@ -45,5 +45,9 @@
45
45
  "@types/node": "^20.0.0",
46
46
  "typescript": "^5.0.0"
47
47
  },
48
- "files": ["dist/", "README.md"]
48
+ "files": [
49
+ "dist/",
50
+ "skills/",
51
+ "README.md"
52
+ ]
49
53
  }
@@ -0,0 +1,293 @@
1
+ ---
2
+ name: hive-execution
3
+ description: Execute Hive feature tasks with worktree isolation, parallel orchestration, and clean git history. Use when running synced Hive tasks.
4
+ ---
5
+
6
+ # Hive Execution Orchestration
7
+
8
+ Execute Hive feature tasks with worktree isolation and clean git history. Supports both sequential (single executor) and parallel (multiple executors) workflows.
9
+
10
+ ## When to Use This Skill
11
+
12
+ - Executing a Hive feature with synced tasks
13
+ - Managing worktree lifecycle (create, work, merge, cleanup)
14
+ - Ensuring single-commit-per-task on main branch
15
+ - Optionally: Running tasks in parallel when multiple executors are available
16
+
17
+ ## Pre-Execution Checklist
18
+
19
+ Before starting execution, verify:
20
+
21
+ 1. **Feature exists**: `hive_feature_list` shows target feature
22
+ 2. **Plan approved**: Feature status is `approved` or `executing`
23
+ 3. **Tasks synced**: `hive_session_open(feature)` shows task list
24
+ 4. **Base branch clean**: No uncommitted changes in main worktree
25
+
26
+ ## Execution Models
27
+
28
+ ### Sequential Execution (Single Executor)
29
+
30
+ When running with a single executor, process tasks in order:
31
+
32
+ ```
33
+ Task 01 → complete → merge
34
+ Task 02 → complete → merge
35
+ Task 03 → complete → merge
36
+ ...
37
+ ```
38
+
39
+ Follow task numbering order unless dependencies require otherwise.
40
+
41
+ ### Parallel Execution (Multiple Executors - Optional)
42
+
43
+ If your environment supports multiple parallel executors, tasks can be organized into **phases** based on dependencies:
44
+
45
+ ```
46
+ Phase 0 (start immediately, parallel):
47
+ - Executor A: Task that creates shared infrastructure (BLOCKER)
48
+ - Executor B: Independent task (no dependencies)
49
+ - Executor C: Independent task (no dependencies)
50
+
51
+ Phase 1 (after Phase 0 blockers merged, parallel):
52
+ - Executor A: Task depending on Phase 0 blocker
53
+ - Executor B: Another dependent task
54
+ - Executor C: Another dependent task
55
+
56
+ Phase 2 (final gate):
57
+ - Any executor: Verification/integration task
58
+ ```
59
+
60
+ ### Dependency Rules
61
+
62
+ When determining execution order (sequential or parallel):
63
+
64
+ | Dependency Type | Action |
65
+ |-----------------|--------|
66
+ | **Blocker task** | Must be merged before dependents start |
67
+ | **Shared files** | Tasks touching same files = sequential |
68
+ | **Independent** | Can run in parallel (if supported) or in any order |
69
+
70
+ ## Task Execution Lifecycle
71
+
72
+ For EACH task, follow this exact sequence:
73
+
74
+ ### 1. Start Task (creates isolated worktree)
75
+
76
+ ```
77
+ hive_exec_start(task="<task-folder-name>")
78
+ ```
79
+
80
+ This:
81
+ - Creates a git worktree from current base branch
82
+ - Sets task status to `in_progress`
83
+ - Generates `spec.md` with context from completed tasks
84
+
85
+ ### 2. Implement in Worktree
86
+
87
+ Work ONLY within the task's worktree directory. The worktree path is returned by `hive_exec_start`.
88
+
89
+ - Read `spec.md` for task context and acceptance criteria
90
+ - Implement changes
91
+ - Verify against acceptance criteria
92
+ - Run tests/build if applicable
93
+
94
+ ### 3. Complete Task (commits to task branch)
95
+
96
+ ```
97
+ hive_exec_complete(task="<task-folder-name>", summary="<what-was-done>")
98
+ ```
99
+
100
+ This:
101
+ - Commits all changes to the task branch
102
+ - Generates `report.md` with diff stats
103
+ - Sets task status to `done`
104
+ - **Does NOT merge** - worktree preserved
105
+
106
+ ### 4. Merge to Main (squash for clean history)
107
+
108
+ ```
109
+ hive_merge(task="<task-folder-name>", strategy="squash")
110
+ ```
111
+
112
+ This:
113
+ - Squash-merges task branch into current branch
114
+ - Results in exactly ONE commit per task on main
115
+ - Commit message follows format: `hive(<task>): <summary>`
116
+
117
+ ### 5. Cleanup (optional, recommended)
118
+
119
+ After successful merge, the worktree can be removed via git:
120
+
121
+ ```bash
122
+ git worktree remove .hive/worktrees/<feature>/<task>
123
+ git branch -d hive/<feature>/<task>
124
+ ```
125
+
126
+ ## Scheduling Strategy
127
+
128
+ ### Single Executor (Default)
129
+
130
+ Execute tasks sequentially in numerical order:
131
+
132
+ ```
133
+ 1. hive_exec_start → implement → hive_exec_complete → hive_merge
134
+ 2. Move to next task
135
+ 3. Repeat until all tasks done
136
+ ```
137
+
138
+ Respect dependencies: if Task 05 depends on Task 02, ensure Task 02 is merged before starting Task 05.
139
+
140
+ ### Multiple Executors (Optional Optimization)
141
+
142
+ If your environment supports parallel execution (e.g., multiple agent sessions, CI runners, or orchestration tools):
143
+
144
+ 1. **Identify blockers**: Tasks that create shared resources others depend on
145
+ 2. **Group by phase**: Tasks that can run in parallel within each phase
146
+ 3. **Assign to executors**: Balance workload across available executors
147
+ 4. **Minimize conflicts**: Avoid assigning tasks touching same files to same phase
148
+
149
+ #### Example Schedule (3 Executors)
150
+
151
+ ```markdown
152
+ ## Scheduling (3 executors)
153
+
154
+ ### Phase 0 (start immediately, parallel)
155
+ - Executor A: 02-create-shared-helpers (BLOCKER - others depend on this)
156
+ - Executor B: 01-update-documentation (independent)
157
+ - Executor C: 08-fix-config-issue (independent)
158
+
159
+ ### Phase 1 (after Task 02 merged, parallel)
160
+ - Executor A: 06-feature-using-helpers, then 03-another-feature
161
+ - Executor B: 04-related-feature
162
+ - Executor C: 07-different-feature
163
+
164
+ ### Phase 2 (final gate)
165
+ - Any executor: 09-final-verification
166
+ ```
167
+
168
+ > **Note**: Parallel execution is an optimization. The same tasks can always be executed sequentially by a single executor.
169
+
170
+ ## Tool Quick Reference
171
+
172
+ | Phase | Tool | Purpose |
173
+ |-------|------|---------|
174
+ | Start | `hive_exec_start(task)` | Create worktree, begin work |
175
+ | Work | `hive_subtask_create(task, name, type)` | Break into TDD subtasks |
176
+ | Progress | `hive_subtask_update(task, subtask, status)` | Track subtask completion |
177
+ | Complete | `hive_exec_complete(task, summary)` | Commit changes to branch |
178
+ | Integrate | `hive_merge(task, strategy="squash")` | Merge to main with single commit |
179
+ | Abort | `hive_exec_abort(task)` | Discard changes, reset status |
180
+ | Status | `hive_worktree_list()` | See all active worktrees |
181
+
182
+ ## Commit Discipline
183
+
184
+ ### Requirements
185
+
186
+ - **One commit per task on main**: Use `hive_merge(strategy="squash")`
187
+ - **Meaningful message**: Reflect the "why" not just "what"
188
+ - **Follow conventions**: Check repo's existing commit style
189
+
190
+ ### Commit Message Format
191
+
192
+ ```
193
+ hive(<task-folder>): <concise summary of change>
194
+
195
+ <optional body explaining why this change was needed>
196
+ ```
197
+
198
+ ## Error Recovery
199
+
200
+ ### Task Failed Mid-Execution
201
+
202
+ ```
203
+ hive_exec_abort(task="<task>") # Discards changes, resets to pending
204
+ hive_exec_start(task="<task>") # Fresh start
205
+ ```
206
+
207
+ ### Merge Conflicts
208
+
209
+ If `hive_merge` reports conflicts:
210
+
211
+ 1. Resolve conflicts in the worktree
212
+ 2. Commit the resolution
213
+ 3. Run `hive_merge` again OR merge manually
214
+
215
+ ### Blocker Task Failed
216
+
217
+ If a Phase 0 blocker fails:
218
+
219
+ 1. Do NOT start Phase 1 tasks
220
+ 2. Fix the blocker
221
+ 3. Complete and merge blocker
222
+ 4. THEN start Phase 1
223
+
224
+ ## Verification Gate
225
+
226
+ Before marking feature complete:
227
+
228
+ - [ ] All tasks show status `done`
229
+ - [ ] All task branches merged to main
230
+ - [ ] No orphaned worktrees (`hive_worktree_list` empty or cleaned)
231
+ - [ ] Final verification task passed
232
+ - [ ] Build passes on main branch
233
+
234
+ ## Example: Full Execution Flow
235
+
236
+ ### Sequential (Single Executor)
237
+
238
+ ```
239
+ # 1. Open session to see current state
240
+ hive_session_open(feature="my-feature")
241
+
242
+ # 2. Execute tasks in order
243
+ hive_exec_start(task="01-first-task")
244
+ # ... implement ...
245
+ hive_exec_complete(task="01-first-task", summary="Completed first task")
246
+ hive_merge(task="01-first-task", strategy="squash")
247
+
248
+ hive_exec_start(task="02-second-task")
249
+ # ... implement ...
250
+ hive_exec_complete(task="02-second-task", summary="Completed second task")
251
+ hive_merge(task="02-second-task", strategy="squash")
252
+
253
+ # Continue for remaining tasks...
254
+
255
+ # 3. Complete feature
256
+ hive_feature_complete(feature="my-feature")
257
+ ```
258
+
259
+ ### Parallel (Multiple Executors - Optional)
260
+
261
+ ```
262
+ # 1. Open session to see current state
263
+ hive_session_open(feature="my-feature")
264
+
265
+ # 2. Phase 0 - Start parallel tasks
266
+ # Executor A:
267
+ hive_exec_start(task="02-shared-helpers")
268
+ # ... implement ...
269
+ hive_exec_complete(task="02-shared-helpers", summary="Added shared test helpers module")
270
+ hive_merge(task="02-shared-helpers", strategy="squash")
271
+
272
+ # Executor B (parallel):
273
+ hive_exec_start(task="01-update-docs")
274
+ # ... implement ...
275
+ hive_exec_complete(task="01-update-docs", summary="Updated README with new metrics")
276
+ hive_merge(task="01-update-docs", strategy="squash")
277
+
278
+ # 3. Phase 1 - After blocker merged
279
+ # Executor A:
280
+ hive_exec_start(task="06-use-helpers")
281
+ # ... implement using the helpers from task 02 ...
282
+ hive_exec_complete(task="06-use-helpers", summary="Integrated shared helpers in tests")
283
+ hive_merge(task="06-use-helpers", strategy="squash")
284
+
285
+ # 4. Final verification
286
+ hive_exec_start(task="09-final-check")
287
+ # ... run full test suite, verify everything works ...
288
+ hive_exec_complete(task="09-final-check", summary="All tests pass, CI green")
289
+ hive_merge(task="09-final-check", strategy="squash")
290
+
291
+ # 5. Complete feature
292
+ hive_feature_complete(feature="my-feature")
293
+ ```