@@ -69,9 +69,124 @@ Plugins are discovered from two locations (priority: **last wins**):
6969
7070** Important** : If a plugin exists in both locations, the ** local** version wins.
7171
72- Each location can contain:
73- - ** Monorepo** : Package with subdirectories containing ` .opencode/ ` (e.g., opencode-plugins)
74- - ** Singlerepo** : Package with ` plugin.json ` + content dirs in root (e.g., opencode-plugin-time-tracking)
72+ ## Plugin Types
73+
74+ ### Monorepo Plugins
75+
76+ A monorepo contains multiple plugins in subdirectories, each with a ` .opencode/ ` folder.
77+
78+ ** Example:** [ opencode-plugins] ( https://github.com/techdivision/opencode-plugins )
79+
80+ ```
81+ opencode-plugins/
82+ ├── package.json
83+ ├── core/
84+ │ └── .opencode/
85+ │ ├── commands/
86+ │ ├── agents/
87+ │ └── skills/
88+ ├── pm/
89+ │ └── .opencode/
90+ │ ├── commands/
91+ │ └── agents/
92+ └── magento/
93+ └── .opencode/
94+ └── commands/
95+ ```
96+
97+ Install: ` npm install github:techdivision/opencode-plugins `
98+
99+ ### Singlerepo Plugins
100+
101+ A singlerepo is a standalone plugin with content directories in the package root.
102+
103+ ** Example:** [ opencode-plugin-magento] ( https://github.com/techdivision/opencode-plugin-magento )
104+
105+ ```
106+ opencode-plugin-magento/
107+ ├── package.json
108+ ├── plugin.json # Plugin metadata (name, category, hooks)
109+ ├── commands/
110+ │ ├── quality.md
111+ │ └── deploy.md
112+ ├── agents/
113+ │ └── magento-expert.md
114+ └── skills/
115+ └── magento/
116+ └── ...
117+ ```
118+
119+ Install: ` npm install github:techdivision/opencode-plugin-magento `
120+
121+ ## How Linking Works
122+
123+ When you run ` opencode-link <plugin> ` , the CLI:
124+
125+ 1 . ** Discovers** plugins from user config and local ` node_modules/ `
126+ 2 . ** Creates symlinks** from target directory to plugin source files
127+ 3 . ** Runs postlink hooks** if defined in ` plugin.json `
128+
129+ ### Example: Linking in a Project
130+
131+ ``` bash
132+ cd /path/to/my-project
133+ opencode-link magento
134+ ```
135+
136+ ** Before:**
137+ ```
138+ my-project/
139+ └── .opencode/
140+ └── node_modules/
141+ └── @techdivision/opencode-plugin-magento/
142+ └── commands/
143+ ├── quality.md
144+ └── deploy.md
145+ ```
146+
147+ ** After:**
148+ ```
149+ my-project/
150+ └── .opencode/
151+ ├── commands/
152+ │ ├── magento.quality.md -> ../node_modules/.../commands/quality.md
153+ │ └── magento.deploy.md -> ../node_modules/.../commands/deploy.md
154+ └── node_modules/
155+ └── ...
156+ ```
157+
158+ ### Example: Linking in User Config
159+
160+ ``` bash
161+ cd ~ /.config/opencode
162+ opencode-link time-tracking
163+ ```
164+
165+ ** Result:**
166+ ```
167+ ~/.config/opencode/
168+ ├── config.json # OpenCode main config (not touched)
169+ ├── commands/
170+ │ ├── time-tracking.init.md -> ./node_modules/.../commands/init.md
171+ │ └── time-tracking.timesheet.md -> ...
172+ ├── agents/
173+ │ └── time-tracking.md -> ./node_modules/.../agents/time-tracking.md
174+ └── node_modules/
175+ └── @techdivision/opencode-plugin-time-tracking/
176+ └── ...
177+ ```
178+
179+ ### Symlink Naming Convention
180+
181+ | Content Type | Source File | Target Symlink |
182+ | --------------| -------------| ----------------|
183+ | commands | ` commands/deploy.md ` | ` commands/{plugin}.deploy.md ` |
184+ | agents | ` agents/expert.md ` | ` agents/expert.md ` |
185+ | guidelines | ` guidelines/style.md ` | ` guidelines/style.md ` |
186+ | skills | ` skills/group/skill-name/ ` | ` skills/skill-name/ ` |
187+ | tools | ` tools/my-tool.ts ` | ` tools/my-tool.ts ` |
188+
189+ ** Note:** Commands are prefixed with the plugin name to avoid conflicts between plugins.
75190
76191## Commands
77192
0 commit comments