Skip to content

Commit 9d3ab0d

Browse files
committed
test: Document OpenCode integration in docs/TUTORIAL.md and docs change log
1 parent e2e27f5 commit 9d3ab0d

2 files changed

Lines changed: 72 additions & 8 deletions

File tree

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
### Added
1111

12+
- **OpenCode Support**: Full integration with OpenCode AI assistant
13+
- Bootstrap creates `opencode.json` at project root with MCP server configuration
14+
- Skills directory `.opencode/skills/` with TaskWing slash commands (tw-next, tw-done, tw-brief, etc.)
15+
- Plugin hooks `.opencode/plugins/taskwing-hooks.js` for autonomous task execution using Bun's ctx.$ API
16+
- Doctor health checks validate OpenCode configuration (MCP, skills, plugins)
17+
- Integration tests and CI job for OpenCode-specific validation
18+
- Documentation in TUTORIAL.md with opencode.json example, skill structure, and plugin format
1219
- **Workspace-Aware Knowledge Scoping**: Full monorepo support for knowledge management
1320
- New `tw workspaces` command to list detected workspaces in a monorepo
1421
- `--workspace` and `--all` flags for `tw list` and `tw context` commands

docs/TUTORIAL.md

Lines changed: 65 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -261,30 +261,75 @@ taskwing mcp install opencode
261261
```
262262

263263
This creates:
264-
- `opencode.json` - MCP server configuration at project root
264+
- `opencode.json` - MCP server configuration **at project root** (required location)
265265
- `.opencode/skills/` - TaskWing slash commands (tw-next, tw-done, etc.)
266266
- `.opencode/plugins/taskwing-hooks.js` - Hooks for auto-continue
267267

268+
**opencode.json Example:**
269+
270+
The `opencode.json` file **must live at the repository root**. It configures the MCP server:
271+
```json
272+
{
273+
"$schema": "https://opencode.ai/config.json",
274+
"mcp": {
275+
"taskwing-mcp": {
276+
"type": "local",
277+
"command": ["taskwing", "mcp"],
278+
"timeout": 5000
279+
}
280+
}
281+
}
282+
```
283+
268284
**Skills (Slash Commands):**
269285
```
270286
/tw-next - Start next task
271287
/tw-done - Complete current task
272288
/tw-brief - Get project knowledge brief
273289
/tw-status - Show current task status
274290
/tw-context - Fetch architecture context
291+
/tw-block - Mark current task as blocked
275292
```
276293

277294
**Skill Structure:**
278-
Skills live in `.opencode/skills/<skill-name>/SKILL.md` with YAML frontmatter:
295+
296+
Skills live in `.opencode/skills/<skill-name>/SKILL.md`. The **directory name must match** the `name` field in the YAML frontmatter:
279297
```yaml
280298
---
281-
name: tw-next
282-
description: Start working on the next pending task
299+
name: tw-brief
300+
description: Get compact project knowledge brief (decisions, patterns, constraints)
283301
---
284302

285-
# tw-next
303+
!taskwing slash brief
304+
```
305+
306+
Valid skill names follow the pattern: `^[a-z0-9]+(-[a-z0-9]+)*$` (lowercase, hyphens allowed)
307+
308+
**Plugin Structure:**
309+
310+
Plugins live in `.opencode/plugins/` and use JavaScript with Bun's shell API (`ctx.$`):
311+
```javascript
312+
// .opencode/plugins/taskwing-hooks.js
313+
export default async (ctx) => ({
314+
// session.created: Called when a new session starts
315+
"session.created": async (event) => {
316+
await ctx.$`taskwing hook session-init`;
317+
},
318+
319+
// session.idle: Called when task completes (auto-continue)
320+
"session.idle": async (event) => {
321+
await ctx.$`taskwing hook continue-check --max-tasks=5 --max-minutes=30`;
322+
}
323+
});
324+
```
325+
326+
**Doctor Checks:**
286327

287-
Instructions for the AI...
328+
Run `taskwing doctor` to verify your OpenCode installation:
329+
```bash
330+
taskwing doctor
331+
# ✅ MCP (OpenCode): taskwing-mcp registered in opencode.json
332+
# ✅ Skills (OpenCode): 6 skills validated
288333
```
289334

290335
**Integration Testing:**
@@ -297,8 +342,20 @@ go test -v ./tests/integration/... -run "TestOpenCode"
297342
```
298343

299344
**Development Notes:**
300-
- During development, use `taskwing-local-dev-mcp` for testing
301-
- The production MCP uses the Homebrew-installed binary
345+
346+
> ⚠️ **CRITICAL**: When developing or testing TaskWing code changes, you **MUST use `taskwing-local-dev-mcp`** instead of the production MCP. The production `taskwing-mcp` uses the Homebrew-installed binary, which won't reflect your code changes.
347+
348+
```bash
349+
# Development workflow:
350+
# 1. Make code changes
351+
# 2. Build: make build
352+
# 3. Test via local dev MCP (uses ./bin/taskwing)
353+
# 4. Run tests: make test-opencode
354+
```
355+
356+
For OpenCode development specifically:
357+
- During development, configure `taskwing-local-dev-mcp` in your opencode.json
358+
- The production MCP (`taskwing-mcp`) uses the Homebrew-installed binary
302359
- Changes to code require rebuild: `make build`
303360

304361
---

0 commit comments

Comments
 (0)