Skip to content

Commit 0484532

Browse files
committed
chore: add README
1 parent 54fad43 commit 0484532

6 files changed

Lines changed: 120 additions & 103 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@ node_modules
22
dist
33
.DS_Store
44
*.tsbuildinfo
5+
opencode.json
6+
AGENTS.md

DESIGN.md

Lines changed: 0 additions & 95 deletions
This file was deleted.

README.md

Lines changed: 78 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,86 @@
11
# opencode-plugin-openspec
22

3-
An OpenCode plugin that integrates OpenSpec.
3+
An OpenCode plugin that integrates OpenSpec, providing a dedicated agent for planning and specifying software architecture.
44

55
## Features
66

7-
- **New Mode: `openspec-plan`**: A dedicated planning mode that allows creating and editing OpenSpec files (`*.spec.md`), while keeping the rest of the codebase read-only.
8-
- **Auto-Permission**: Automatically grants write permissions for openSpec files in `openspec-plan` mode.
7+
- **Auto-Detection**: Automatically detects if the current workspace is an OpenSpec project.
8+
- **New Agent: `openspec-plan`**: A dedicated agent mode for creating and editing OpenSpec files.
9+
- **Smart Permissions**: Automatically grants write permissions for:
10+
- `project.md`
11+
- `AGENTS.md`
12+
- `openspec/**`
13+
- `specs/**`
14+
- **Read-Only Safety**: Keeps the rest of the codebase read-only when using the `openspec-plan` agent, ensuring the implementation details are not accidentally modified during the planning phase.
915

1016
## Installation
1117

12-
(Instructions to be added)
18+
You don't need to build this plugin yourself. You can install it via npm or download the pre-built binary.
19+
20+
### Option 1: Install via npm (Recommended)
21+
22+
1. Install the plugin globally:
23+
```bash
24+
npm install -g opencode-plugin-openspec
25+
```
26+
27+
2. Add it to your `opencode.json` (usually in `~/.config/opencode/opencode.json` or `.opencode/opencode.json`):
28+
29+
```json
30+
{
31+
"plugin": [
32+
"opencode-plugin-openspec"
33+
]
34+
}
35+
```
36+
*(Note: If OpenCode doesn't support package names directly, you may need to provide the full path, e.g., `$(npm root -g)/opencode-plugin-openspec/dist/index.js`)*
37+
38+
### Option 2: Download from Releases
39+
40+
1. Go to the [Releases](https://github.com/yourusername/opencode-plugin-openspec/releases) page.
41+
2. Download the latest `index.js`.
42+
3. Place it anywhere on your disk.
43+
4. Add the path to your `opencode.json`:
44+
```json
45+
{
46+
"plugin": [
47+
"/absolute/path/to/downloaded/index.js"
48+
]
49+
}
50+
```
51+
52+
## Usage
53+
54+
1. Open an OpenSpec project in OpenCode.
55+
2. The plugin will automatically detect the project structure.
56+
3. Switch to the **OpenSpec Architect** agent (colored #FF6B6B) in the agent selector.
57+
4. Start planning your architecture! The agent will have access to modify your spec files while keeping your code safe.
58+
59+
## Development
60+
61+
If you want to contribute or modify the plugin, follow these steps:
62+
63+
1. Clone the repository:
64+
```bash
65+
git clone https://github.com/yourusername/opencode-plugin-openspec.git
66+
cd opencode-plugin-openspec
67+
```
68+
69+
2. Install dependencies:
70+
```bash
71+
bun install
72+
```
73+
74+
3. Build the plugin:
75+
```bash
76+
bun run build
77+
```
78+
79+
4. Run watch mode for development:
80+
```bash
81+
bun run watch
82+
```
83+
84+
## License
85+
86+
MIT

bun.lock

Lines changed: 32 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
{
22
"name": "opencode-plugin-openspec",
33
"version": "0.1.0",
4+
"type": "module",
45
"main": "src/index.ts",
56
"peerDependencies": {
6-
"@opencode-ai/plugin": "^1.1.1",
7-
"@opencode-ai/sdk": "^1.1.1"
7+
"@opencode-ai/plugin": "^1.1.19",
8+
"@opencode-ai/sdk": "^1.1.19"
9+
},
10+
"scripts": {
11+
"build": "bun build ./src/index.ts --outfile ./dist/index.js --target node",
12+
"watch": "bun build ./src/index.ts --outfile ./dist/index.js --target node --watch"
813
},
914
"devDependencies": {
1015
"bun-types": "latest",

src/utils/detection.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import { join } from "node:path";
1111
*/
1212
export async function isOpenSpecProject(ctx: PluginInput): Promise<boolean> {
1313
const openspecAgentsPath = join(ctx.directory, "openspec", "AGENTS.md");
14-
const rootAgentsPath = join(ctx.directory, "AGENTS.md");
1514

16-
return existsSync(openspecAgentsPath) || existsSync(rootAgentsPath);
15+
return existsSync(openspecAgentsPath);
1716
}

0 commit comments

Comments
 (0)