Skip to content

Commit f66d860

Browse files
committed
docs: clarify installation options and plugin discovery
- Add three installation options (global+global, local, global+local) - Add table showing discovery priority - Clarify that local plugins override global
1 parent bbb1f37 commit f66d860

1 file changed

Lines changed: 44 additions & 20 deletions

File tree

README.md

Lines changed: 44 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,33 +9,68 @@ CLI tools for OpenCode plugin management.
99

1010
## Installation
1111

12-
### Global (Recommended)
12+
### Option A: Global CLI + Global Plugins
1313

14-
Install once, use everywhere:
14+
Install CLI and plugins globally, use from any project:
1515

1616
```bash
17+
# Install CLI globally
1718
npm install -g github:techdivision/opencode-cli
19+
20+
# Install plugins globally
21+
npm install -g github:techdivision/opencode-plugins
22+
23+
# Use from any project
24+
cd /path/to/my-project
25+
opencode-link # Link standard plugins
26+
opencode-link list # List available plugins
27+
opencode-link status # Show current links
1828
```
1929

20-
Then use from any project:
30+
### Option B: Local Installation (per project)
31+
32+
Install plugins locally in each project:
2133

2234
```bash
2335
cd /path/to/my-project
24-
npx opencode-link # Link standard plugins
25-
npx opencode-link list # List available plugins
26-
npx opencode-link status # Show current links
36+
mkdir -p .opencode && cd .opencode
37+
npm install github:techdivision/opencode-plugins
38+
npx opencode-link
39+
cd ..
2740
```
2841

29-
### As Dependency
42+
### Option C: Global CLI + Local Plugins
3043

31-
Used automatically when you install `@techdivision/opencode-plugins`:
44+
Install CLI globally, plugins per project:
3245

3346
```bash
47+
# Install CLI globally (once)
48+
npm install -g github:techdivision/opencode-cli
49+
50+
# In each project: install plugins locally
3451
cd /path/to/my-project/.opencode
3552
npm install github:techdivision/opencode-plugins
36-
npx opencode-link
53+
cd ..
54+
55+
# Run from project root
56+
opencode-link list # Finds plugins in .opencode/node_modules/
3757
```
3858

59+
## Plugin Discovery
60+
61+
Plugins are discovered from two locations (priority: **last wins**):
62+
63+
| Priority | Location | Path |
64+
|----------|----------|------|
65+
| 1 (low) | Global | `npm config get prefix`/lib/node_modules/ |
66+
| 2 (high) | Local | `{project}/.opencode/node_modules/` |
67+
68+
**Important**: If a plugin exists in both locations, the **local** version wins.
69+
70+
Each location can contain:
71+
- **Monorepo**: Package with subdirectories containing `.opencode/` (e.g., opencode-plugins)
72+
- **Singlerepo**: Package with `plugin.json` + content dirs in root (e.g., opencode-plugin-time-tracking)
73+
3974
## Commands
4075

4176
| Command | Description |
@@ -55,17 +90,6 @@ npx opencode-link
5590
| `--target-dir=<path>` | Override target directory |
5691
| `--singular` | Use singular directory names (agent/ instead of agents/) |
5792

58-
## Plugin Discovery
59-
60-
Plugins are discovered from two locations (priority: last wins):
61-
62-
1. **Global**: `npm config get prefix`/lib/node_modules/
63-
2. **Local**: `{project}/.opencode/node_modules/`
64-
65-
Each location can contain:
66-
- **Monorepo**: Package with subdirectories containing `.opencode/` (e.g., opencode-plugins)
67-
- **Singlerepo**: Package with `plugin.json` + content dirs in root (e.g., opencode-plugin-time-tracking)
68-
6993
## Programmatic Usage
7094

7195
You can also use the CLI modules programmatically:

0 commit comments

Comments
 (0)