|
1 | 1 | # opencode-plugin-openspec |
2 | | -An OpenCode plugin that integrates OpenSpec, allowing Plan Mode to create and edit spec files. |
| 2 | + |
| 3 | +An OpenCode plugin that integrates OpenSpec, providing a dedicated agent for planning and specifying software architecture. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 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. |
| 15 | + |
| 16 | +## Installation |
| 17 | + |
| 18 | +### For Humans |
| 19 | + |
| 20 | +**Option 1: Let your agent do it (Recommended)** |
| 21 | + |
| 22 | +Paste this prompt into OpenCode: |
| 23 | + |
| 24 | +``` |
| 25 | +Install opencode-plugin-openspec. It is an NPM package. Please add "opencode-plugin-openspec" to my opencode.json plugin list. |
| 26 | +``` |
| 27 | + |
| 28 | +**Option 2: Manual Installation** |
| 29 | + |
| 30 | +Add the plugin package name to your `opencode.json` configuration file (usually located at `~/.config/opencode/opencode.json` or `.opencode/opencode.json`): |
| 31 | + |
| 32 | +```json |
| 33 | +{ |
| 34 | + "plugin": [ |
| 35 | + "opencode-plugin-openspec" |
| 36 | + ] |
| 37 | +} |
| 38 | +``` |
| 39 | + |
| 40 | +OpenCode will automatically download and install the plugin the next time it runs. |
| 41 | + |
| 42 | +### For LLM Agents |
| 43 | + |
| 44 | +If you are an AI agent tasked with installing this plugin, follow these steps: |
| 45 | + |
| 46 | +1. **Locate Configuration**: Find the user's OpenCode configuration file. It is typically at `~/.config/opencode/opencode.json` or `.opencode/opencode.json` in the workspace root. |
| 47 | +2. **Read Configuration**: Read the content of the configuration file. |
| 48 | +3. **Update Configuration**: Add `"opencode-plugin-openspec"` to the `plugin` array. If the `plugin` array does not exist, create it. |
| 49 | + ```json |
| 50 | + { |
| 51 | + "plugin": [ |
| 52 | + "opencode-plugin-openspec" |
| 53 | + ] |
| 54 | + } |
| 55 | + ``` |
| 56 | +4. **Verify**: Inform the user that the plugin has been added and will be installed on the next OpenCode run. |
| 57 | + |
| 58 | +## Usage |
| 59 | + |
| 60 | +1. Open an OpenSpec project in OpenCode. |
| 61 | +2. The plugin will automatically detect the project structure. |
| 62 | +3. Switch to the **OpenSpec Architect** agent (colored #FF6B6B) in the agent selector. |
| 63 | +4. Start planning your architecture! The agent will have access to modify your spec files while keeping your code safe. |
| 64 | + |
| 65 | +## Development |
| 66 | + |
| 67 | +1. Clone the repository: |
| 68 | + ```bash |
| 69 | + git clone https://github.com/yourusername/opencode-plugin-openspec.git |
| 70 | + cd opencode-plugin-openspec |
| 71 | + ``` |
| 72 | + |
| 73 | +2. Install dependencies: |
| 74 | + ```bash |
| 75 | + bun install |
| 76 | + ``` |
| 77 | + |
| 78 | +3. Build the plugin: |
| 79 | + ```bash |
| 80 | + bun run build |
| 81 | + ``` |
| 82 | + |
| 83 | +4. Run watch mode for development: |
| 84 | + ```bash |
| 85 | + bun run watch |
| 86 | + ``` |
| 87 | + |
| 88 | +## License |
| 89 | + |
| 90 | +MIT |
0 commit comments