Skip to content

Commit 750c8e5

Browse files
committed
docs: update README and AGENTS.md for new plugin structure
- Document the proper OpenCode plugin API structure - Add Plugin API section explaining exports - Update project structure to reflect new files - Add plugin function and metadata module descriptions Signed-off-by: leocavalcante <leo@cavalcante.dev>
1 parent 06107c1 commit 750c8e5

File tree

2 files changed

+78
-4
lines changed

2 files changed

+78
-4
lines changed

AGENTS.md

Lines changed: 50 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ This file provides instructions for AI coding agents working in this repository.
44

55
## Project Overview
66

7-
This is an **OpenCode plugin** that provides autonomous development agents. The plugin installs three agents that work together to create an infinite Plan-Build-Commit loop.
7+
This is an **OpenCode plugin** that provides autonomous development agents. The plugin follows the [OpenCode plugin API](https://opencode.ai/docs/plugins/) and installs three agents that work together to create an infinite Plan-Build-Commit loop.
88

99
- **Type**: OpenCode Plugin
1010
- **Runtime**: Bun
11-
- **Language**: TypeScript (minimal)
11+
- **Language**: TypeScript
1212

1313
## Project Structure
1414

@@ -19,19 +19,66 @@ opencode-plugin-opencoder/
1919
│ ├── opencoder-planner.md # Planning subagent
2020
│ └── opencoder-builder.md # Building subagent
2121
├── src/
22-
│ └── index.ts # Plugin entry point (exports metadata)
22+
│ ├── index.ts # Main entry: exports plugin + re-exports metadata
23+
│ ├── plugin.ts # Plugin function (OpenCode plugin API)
24+
│ ├── metadata.ts # Metadata exports (name, version, agents)
25+
│ ├── paths.mjs # Path utilities for install/uninstall scripts
26+
│ └── paths.d.mts # Type declarations for paths.mjs
27+
├── tests/
28+
│ ├── index.test.ts # Tests for main exports
29+
│ ├── plugin.test.ts # Tests for plugin function
30+
│ ├── agents.test.ts # Tests for agent files
31+
│ ├── install.test.ts # Tests for install/uninstall scripts
32+
│ └── paths.test.ts # Tests for path utilities
2333
├── postinstall.mjs # Copies agents to ~/.config/opencode/agents/
34+
├── preuninstall.mjs # Removes agents on uninstall
2435
├── package.json # npm package configuration
2536
├── biome.json # Linter configuration
2637
└── tsconfig.json # TypeScript configuration
2738
```
2839

40+
## Plugin Architecture
41+
42+
The plugin follows the OpenCode plugin structure:
43+
44+
### Main Exports (`src/index.ts`)
45+
46+
```typescript
47+
// Plugin function (default + named export)
48+
export { OpenCoderPlugin } from "./plugin"
49+
export { OpenCoderPlugin as default } from "./plugin"
50+
51+
// Metadata re-exports (backwards compatibility)
52+
export { name, version, description, agents } from "./metadata"
53+
```
54+
55+
### Plugin Function (`src/plugin.ts`)
56+
57+
```typescript
58+
import type { Plugin } from "@opencode-ai/plugin"
59+
60+
export const OpenCoderPlugin: Plugin = async (ctx) => {
61+
// Returns hooks object (minimal for now)
62+
return {}
63+
}
64+
```
65+
66+
### Metadata (`src/metadata.ts`)
67+
68+
Contains package metadata exports for introspection and backwards compatibility.
69+
2970
## Commands
3071

3172
```bash
3273
# Install dependencies
3374
bun install
3475

76+
# Run tests
77+
bun test
78+
79+
# Run type checker
80+
bun run typecheck
81+
3582
# Run linter
3683
bun run lint
3784

README.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ OpenCode plugin providing autonomous development agents for continuous codebase
44

55
## Overview
66

7-
This plugin installs three agents that work together to create an infinite autonomous development loop:
7+
This plugin follows the [OpenCode plugin API](https://opencode.ai/docs/plugins/) and installs three agents that work together to create an infinite autonomous development loop:
88

99
| Agent | Purpose |
1010
|-------|---------|
@@ -14,6 +14,17 @@ This plugin installs three agents that work together to create an infinite auton
1414

1515
## Installation
1616

17+
Add the plugin to your `opencode.json` config:
18+
19+
```json
20+
{
21+
"$schema": "https://opencode.ai/config.json",
22+
"plugin": ["opencode-plugin-opencoder"]
23+
}
24+
```
25+
26+
Or install manually:
27+
1728
```bash
1829
bun add opencode-plugin-opencoder
1930
```
@@ -115,6 +126,22 @@ Or copy the agents manually:
115126
cp node_modules/opencode-plugin-opencoder/agents/*.md ~/.config/opencode/agents/
116127
```
117128

129+
## Plugin API
130+
131+
This plugin exports:
132+
133+
```typescript
134+
// Main plugin function (OpenCode plugin API)
135+
import { OpenCoderPlugin } from "opencode-plugin-opencoder"
136+
// or
137+
import OpenCoderPlugin from "opencode-plugin-opencoder"
138+
139+
// Metadata exports (for introspection)
140+
import { name, version, description, agents } from "opencode-plugin-opencoder"
141+
```
142+
143+
The plugin currently provides a minimal hooks structure that can be extended in the future. Agent registration is handled via the postinstall script since the OpenCode plugin API does not yet support dynamic agent registration.
144+
118145
## Development
119146

120147
```bash

0 commit comments

Comments
 (0)