@mirrowel/opencode-souk 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/docs/CONFIG.md ADDED
@@ -0,0 +1,67 @@
1
+ # OpenCode Souk Configuration
2
+
3
+ Souk stores its sidecar config at:
4
+
5
+ ```text
6
+ ~/.config/opencode/souk.jsonc
7
+ ```
8
+
9
+ The cache is stored at:
10
+
11
+ ```text
12
+ ~/.config/opencode/souk-cache.json
13
+ ```
14
+
15
+ Backups and debug logs are stored at:
16
+
17
+ ```text
18
+ ~/.config/opencode/souk.backup.json
19
+ ~/.config/opencode/souk.debug.log
20
+ ```
21
+
22
+ See `souk.example.jsonc` for a commented starter config.
23
+
24
+ ## Top-Level Fields
25
+
26
+ - `debug`: enables best-effort debug logging. Logging is hot-read and never fatal.
27
+ - `ui`: dialog sizing. `width` is `medium`, `large`, or `xlarge`; `height` is a preset; `height_percent` is clamped to 25-100.
28
+ - `ui.browser`: item browser table sizing. It has its own `width` so the browser can be wider than normal menus.
29
+ - `cache`: fetch/cache policy. Souk fetches on empty cache and manual refresh by default.
30
+ - `install`: native install preferences. Conflict policy is intentionally `refuse`.
31
+ - `forge`: experimental Kāf installer-agent settings.
32
+ - `sources`: community source URLs and enablement.
33
+ - `hidden`: item IDs hidden from normal browsing.
34
+
35
+ Debug and UI-only saves do not create backup entries. Meaningful settings saves create reverse-patch restore points.
36
+
37
+ ## Forge
38
+
39
+ Forge mode is experimental and disabled by default.
40
+
41
+ ```jsonc
42
+ {
43
+ "forge": {
44
+ "enabled": false,
45
+ "agent": {
46
+ "model": "opencode/big-pickle",
47
+ "personality": "curio-shelf"
48
+ }
49
+ }
50
+ }
51
+ ```
52
+
53
+ When enabled, Forge opens a dedicated Kāf session for selected items.
54
+
55
+ Native installs do not require Forge. Forge remains useful for custom installs, ambiguous sources, batch reasoning, or extra security review.
56
+
57
+ Kāf model and provider variant are selected from OpenCode's provider catalog when available. Souk intentionally does not use named model shortcuts.
58
+
59
+ ## Sources
60
+
61
+ Souk fetches only when the cache is empty or when the user refreshes manually.
62
+
63
+ Default sources:
64
+
65
+ - `opencode.cafe`
66
+ - `awesome-opencode`
67
+ - OpenCode ecosystem docs
package/package.json ADDED
@@ -0,0 +1,86 @@
1
+ {
2
+ "name": "@mirrowel/opencode-souk",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "description": "OpenCode Souk: a TUI marketplace and Forge for plugins, MCPs, agents, commands, themes, and extensions",
6
+ "license": "MIT",
7
+ "author": "Mirrowel",
8
+ "homepage": "https://github.com/Mirrowel/opencode-souk#readme",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/Mirrowel/opencode-souk.git"
12
+ },
13
+ "bugs": {
14
+ "url": "https://github.com/Mirrowel/opencode-souk/issues"
15
+ },
16
+ "main": "dist/server.js",
17
+ "types": "dist/server.d.ts",
18
+ "exports": {
19
+ ".": {
20
+ "types": "./dist/server.d.ts",
21
+ "import": "./dist/server.js"
22
+ },
23
+ "./server": {
24
+ "types": "./dist/server.d.ts",
25
+ "import": "./dist/server.js"
26
+ },
27
+ "./tui": {
28
+ "types": "./dist/tui.d.ts",
29
+ "import": "./src/tui.tsx"
30
+ }
31
+ },
32
+ "files": [
33
+ "dist",
34
+ "src/tui.tsx",
35
+ "src/skill",
36
+ "docs",
37
+ "README.md",
38
+ "souk.example.jsonc",
39
+ "IMPLEMENTATION_PLAN.md",
40
+ "LICENSE"
41
+ ],
42
+ "keywords": [
43
+ "opencode",
44
+ "opencode-plugin",
45
+ "plugin",
46
+ "mcp",
47
+ "marketplace",
48
+ "tui"
49
+ ],
50
+ "oc-plugin": [
51
+ "server",
52
+ "tui"
53
+ ],
54
+ "publishConfig": {
55
+ "registry": "https://registry.npmjs.org/",
56
+ "access": "public"
57
+ },
58
+ "scripts": {
59
+ "clean": "node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\"",
60
+ "build": "npm run clean && tsc --outDir dist --declaration",
61
+ "commit:check": "npm run ci",
62
+ "hooks:install": "node scripts/install-git-hooks.mjs",
63
+ "release:intent": "node scripts/set-release-intent.mjs",
64
+ "release:intent:check": "node scripts/check-release-intent.mjs",
65
+ "typecheck": "tsc --noEmit",
66
+ "verify:registry:live": "npm run build && node scripts/verify-registry-live.mjs",
67
+ "verify:install-plans": "npm run build && node scripts/verify-install-plans.mjs",
68
+ "pack:dry-run": "npm pack --dry-run",
69
+ "ci": "npm run release:intent:check && npm run typecheck && npm run build && npm pack --dry-run",
70
+ "prepublishOnly": "npm run typecheck && npm run build"
71
+ },
72
+ "dependencies": {
73
+ "@opencode-ai/plugin": ">=1.14.0",
74
+ "comment-json": "^4.2.5",
75
+ "solid-js": "^1.9.12",
76
+ "zod": "^4.1.8"
77
+ },
78
+ "devDependencies": {
79
+ "@opentui/solid": "^0.2.16",
80
+ "@types/node": "^22.0.0",
81
+ "typescript": "^5.8.0"
82
+ },
83
+ "peerDependencies": {
84
+ "@opencode-ai/plugin": ">=1.14.0"
85
+ }
86
+ }
@@ -0,0 +1,68 @@
1
+ {
2
+ // Enables best-effort debug logging to ~/.config/opencode/souk.debug.log.
3
+ // Debug logging is hot-read and never fatal.
4
+ "debug": false,
5
+
6
+ // Souk TUI display preferences. These can be changed from Debug & advanced.
7
+ "ui": {
8
+ "width": "large",
9
+ "height": "tall",
10
+ "height_percent": 68,
11
+
12
+ // Item browser table width. This is separate so the browser can be wider
13
+ // than normal Souk menus and info windows.
14
+ "browser": {
15
+ "width": "xlarge"
16
+ }
17
+ },
18
+
19
+ // Cache policy. Souk fetches only when cache is empty or when you refresh manually.
20
+ "cache": {
21
+ "fetch_on_empty": true,
22
+ "refresh_manually": true,
23
+ "stale_after_hours": 168
24
+ },
25
+
26
+ // Native install defaults.
27
+ "install": {
28
+ "default_scope": "ask",
29
+ "conflict_policy": "refuse",
30
+ "allow_claude_mcp_conversion": "ask",
31
+ "runtime_mcp_connect": true
32
+ },
33
+
34
+ // Experimental Kāf Forge mode. Forge is hidden from install choices unless enabled;
35
+ // advanced settings remain available so you can configure it before enabling.
36
+ "forge": {
37
+ "enabled": false,
38
+ "bulk": true,
39
+ "require_typed_high_risk": true,
40
+ "agent": {
41
+ "model": "opencode/big-pickle",
42
+ // Optional provider-specific variant. Leave unset for provider default.
43
+ // "variant": "high",
44
+ "temperature": 0.2,
45
+ "top_p": 0.95,
46
+ "options": {},
47
+ "personality": "curio-shelf"
48
+ }
49
+ },
50
+
51
+ "sources": {
52
+ "opencode_cafe": {
53
+ "enabled": true,
54
+ "url": "https://curious-quail-727.convex.cloud/api/query"
55
+ },
56
+ "awesome_opencode": {
57
+ "enabled": true,
58
+ "url": "https://raw.githubusercontent.com/awesome-opencode/awesome-opencode/main/dist/registry.json"
59
+ },
60
+ "opencode_docs": {
61
+ "enabled": true,
62
+ "url": "https://raw.githubusercontent.com/anomalyco/opencode/dev/packages/web/src/content/docs/ecosystem.mdx"
63
+ }
64
+ },
65
+
66
+ // Item IDs hidden from normal marketplace browsing.
67
+ "hidden": {}
68
+ }
@@ -0,0 +1,313 @@
1
+ ---
2
+ name: souk-installer
3
+ description: Use when Kāf or Souk is installing, appraising, converting, or securing OpenCode extensions including plugins, MCPs, agents, commands, themes, skills, tools, and ecosystem projects.
4
+ ---
5
+
6
+ # Souk Installer
7
+
8
+ You are helping OpenCode Souk inspect, appraise, plan, or install an OpenCode extension. Treat every install as a security-sensitive config change.
9
+
10
+ ## First Rule
11
+
12
+ Prefer Souk's deterministic native tools when they clearly support the item. Use manual installation when native tools are incomplete, ambiguous, likely to fail, or unable to preserve the intended install semantics.
13
+
14
+ Native tools are helpers, not a cage. Many real ecosystem items require manual install steps, repository inspection, package-specific configuration, generated files, OAuth setup, external service credentials, or custom commands. If the native preview looks uncertain, partial, lossy, or wrong, explain that and plan a manual install instead.
15
+
16
+ ## Backup Requirement
17
+
18
+ Before any install action, make or verify a backup.
19
+
20
+ - Souk native installs create a pre-install backup automatically. Confirm the tool result reports the backup path.
21
+ - Manual installs must create a backup before writing config, copying files, installing packages, or running setup commands.
22
+ - Back up every file or directory that may be modified, plus nearby OpenCode config likely to be affected.
23
+ - For global installs, back up relevant files under the global OpenCode config directory: `opencode.json(c)`, `tui.json(c)`, `agent(s)`, `command(s)`, `skill(s)`, `theme(s)`, and plugin directories as applicable.
24
+ - For project installs, back up the project `opencode.json(c)`, `tui.json(c)`, and `.opencode/**` as applicable.
25
+ - If a manual install uses shell commands or package managers that write outside OpenCode config, identify those locations and back them up when feasible.
26
+ - Toggling an already-installed plugin active/inactive does not require a backup.
27
+
28
+ If you cannot create a meaningful backup, stop and ask the user before proceeding.
29
+
30
+ In plan mode:
31
+
32
+ - Use `souk_registry_search` to resolve marketplace items and inspect merged source provenance.
33
+ - Use `souk_native_preview` to preview deterministic native writes/actions.
34
+ - If native preview is unsupported, partial, suspicious, or likely to install the wrong thing, plan a manual install instead.
35
+ - Do not write files, patch config, run install commands, or mutate state.
36
+ - When the plan is concrete, call `souk_request_action` with security risks and planned actions.
37
+
38
+ In action mode:
39
+
40
+ - Use `souk_native_install` for supported native installs.
41
+ - For manual installs, create backups first, then perform only the approved writes/commands.
42
+ - Execute only the approved plan.
43
+ - Stop and ask again if scope, files, commands, permissions, or risks change.
44
+ - Do not silently expand from one item to more items.
45
+
46
+ ## Mandatory Security Analysis
47
+
48
+ Before proposing or executing any install, analyze all of the following:
49
+
50
+ - Provenance: every source record, repository owner, package publisher, source URL, source recency, and whether the source is official or community-maintained.
51
+ - Source agreement: whether opencode.cafe, awesome-opencode, OpenCode docs, package metadata, and repository contents agree on name, kind, and install method.
52
+ - Install method: native OpenCode config, npm package, file copy, shell command, clone/build, curl pipe, custom script, OAuth flow, or remote service setup.
53
+ - File writes: every file or directory that will be created, modified, overwritten, or removed.
54
+ - Config writes: `opencode.json`, `opencode.jsonc`, `tui.json`, `tui.jsonc`, `.opencode/**`, and global config under the OpenCode config directory.
55
+ - Tool/permission impact: plugin hooks, MCP tools, shell access, edit/write access, network access, auth headers, environment variables, tokens, and OAuth.
56
+ - Runtime effects: whether the change hot-loads or requires a full OpenCode restart.
57
+ - Ambiguity: stale docs, missing package names, non-native config formats, unclear repo subpaths, generated files, or unclear setup steps.
58
+
59
+ If confidence is not complete, say plainly: "The souk can make mistakes." Explain what is uncertain.
60
+
61
+ ## OpenCode Native Install Shapes
62
+
63
+ Use these shapes both for native-tool verification and for manual installs.
64
+
65
+ ### Plugins
66
+
67
+ Runtime/server plugin config lives in `opencode.json` or `opencode.jsonc`:
68
+
69
+ ```jsonc
70
+ {
71
+ "$schema": "https://opencode.ai/config.json",
72
+ "plugin": [
73
+ "npm-package-name",
74
+ "@scope/npm-package",
75
+ ["npm-package-with-options", { "key": "value" }],
76
+ "./relative/plugin.ts",
77
+ "file:///absolute/plugin.ts"
78
+ ]
79
+ }
80
+ ```
81
+
82
+ TUI plugin config lives in `tui.json` or `tui.jsonc`:
83
+
84
+ ```jsonc
85
+ {
86
+ "$schema": "https://opencode.ai/tui.json",
87
+ "plugin": ["@scope/opencode-tui-plugin"],
88
+ "plugin_enabled": {
89
+ "plugin-id": true
90
+ }
91
+ }
92
+ ```
93
+
94
+ Package inspection checklist:
95
+
96
+ - `oc-plugin` should include `server`, `tui`, or both.
97
+ - Server entry is usually `exports["./server"]` or `main`.
98
+ - TUI entry is usually `exports["./tui"]`.
99
+ - Theme-only packages may expose `oc-themes`.
100
+ - Check `engines.opencode` when present.
101
+ - Do not assume a display name is an npm package name.
102
+
103
+ ### MCP Servers
104
+
105
+ Native OpenCode MCP config lives in `opencode.json(c)` under `mcp`:
106
+
107
+ ```jsonc
108
+ {
109
+ "$schema": "https://opencode.ai/config.json",
110
+ "mcp": {
111
+ "local-name": {
112
+ "type": "local",
113
+ "command": ["npx", "-y", "package"],
114
+ "environment": { "TOKEN": "{env:TOKEN}" },
115
+ "enabled": true,
116
+ "timeout": 30000
117
+ },
118
+ "remote-name": {
119
+ "type": "remote",
120
+ "url": "https://example.com/mcp",
121
+ "headers": { "Authorization": "Bearer {env:TOKEN}" },
122
+ "oauth": false,
123
+ "enabled": true
124
+ }
125
+ }
126
+ }
127
+ ```
128
+
129
+ Rules:
130
+
131
+ - `type` is required for native OpenCode MCP config.
132
+ - Local `command` must be an array of strings.
133
+ - Use `environment`, not Claude's `env`, in native OpenCode config.
134
+ - Runtime connect/auth is best-effort; persistent config is the source of truth.
135
+ - MCPs add tools and context load. Review token/env/OAuth handling carefully.
136
+
137
+ ### Claude MCP Conversion
138
+
139
+ Claude-style `mcpServers` is not OpenCode's native shape. Never convert silently.
140
+
141
+ Ask before converting and preview the converted shape:
142
+
143
+ - Claude `command` plus `args` maps to OpenCode `type: "local", command: [command, ...args]`.
144
+ - Claude `env` maps to OpenCode `environment`.
145
+ - Remote URL entries map to OpenCode `type: "remote", url`.
146
+ - Preserve headers only when they are explicit and safe.
147
+ - Do not invent tokens or secret values.
148
+
149
+ ### Agents
150
+
151
+ Inline config:
152
+
153
+ ```jsonc
154
+ {
155
+ "agent": {
156
+ "review": {
157
+ "description": "Reviews code.",
158
+ "mode": "subagent",
159
+ "model": "provider/model",
160
+ "permission": { "edit": "deny" },
161
+ "prompt": "You are a reviewer."
162
+ }
163
+ }
164
+ }
165
+ ```
166
+
167
+ Markdown file locations:
168
+
169
+ - Project: `.opencode/agent/<name>.md` or `.opencode/agents/<name>.md`
170
+ - Global: `<config>/agent/<name>.md` or `<config>/agents/<name>.md`
171
+
172
+ Markdown shape:
173
+
174
+ ```markdown
175
+ ---
176
+ description: Reviews code.
177
+ mode: subagent
178
+ model: provider/model
179
+ permission:
180
+ edit: deny
181
+ ---
182
+
183
+ Prompt body.
184
+ ```
185
+
186
+ Allowed fields include `name`, `model`, `variant`, `description`, `mode`, `hidden`, `color`, `steps`, `options`, `permission`, `disable`, `temperature`, and `top_p`.
187
+
188
+ ### Commands
189
+
190
+ Inline config:
191
+
192
+ ```jsonc
193
+ {
194
+ "command": {
195
+ "test": {
196
+ "template": "Run tests for $ARGUMENTS",
197
+ "description": "Run tests",
198
+ "agent": "build",
199
+ "model": "provider/model",
200
+ "subtask": false
201
+ }
202
+ }
203
+ }
204
+ ```
205
+
206
+ Markdown file locations:
207
+
208
+ - Project: `.opencode/command/<name>.md` or `.opencode/commands/<name>.md`
209
+ - Global: `<config>/command/<name>.md` or `<config>/commands/<name>.md`
210
+
211
+ The markdown body becomes the command template. Frontmatter supplies optional metadata.
212
+
213
+ ### Skills
214
+
215
+ Skill files live in a folder containing `SKILL.md`:
216
+
217
+ - Project: `.opencode/skills/<name>/SKILL.md`
218
+ - Global: `<config>/skills/<name>/SKILL.md`
219
+ - External OpenCode scans may also see `.claude/skills` and `.agents/skills`.
220
+
221
+ Recommended `SKILL.md` shape:
222
+
223
+ ```markdown
224
+ ---
225
+ name: my-skill
226
+ description: Use when the user asks for the exact capability this skill provides.
227
+ ---
228
+
229
+ # My Skill
230
+
231
+ Instructions.
232
+ ```
233
+
234
+ Check companion files before installing a skill folder. Do not copy unrelated repository files into a skill directory.
235
+
236
+ ### Themes
237
+
238
+ Theme files live under `themes` and selection lives in `tui.json(c)`:
239
+
240
+ ```jsonc
241
+ {
242
+ "$schema": "https://opencode.ai/tui.json",
243
+ "theme": "theme-name"
244
+ }
245
+ ```
246
+
247
+ Theme file shape:
248
+
249
+ ```jsonc
250
+ {
251
+ "$schema": "https://opencode.ai/theme.json",
252
+ "defs": {},
253
+ "theme": {
254
+ "primary": "#ffffff"
255
+ }
256
+ }
257
+ ```
258
+
259
+ Validate theme JSON before writing. Ask before activating a theme.
260
+
261
+ ## Scope Rules
262
+
263
+ Both native installs and Forge installs must ask for scope before persistent writes.
264
+
265
+ - Global scope writes to the global OpenCode config directory.
266
+ - Project scope writes under the selected project's `.opencode` directory/config.
267
+ - If project scope is selected, identify the exact project root before writing.
268
+
269
+ ## Source Interpretation Rules
270
+
271
+ - opencode.cafe usually has the richest install instructions and reviewed entries.
272
+ - awesome-opencode has broad coverage but no installation field; treat entries as repo metadata, not verified install specs.
273
+ - OpenCode docs are curated but usually lack install instructions.
274
+ - A merged Souk combo item may have multiple source records. Inspect all of them before deciding kind, confidence, and install path.
275
+ - Prefer repository/package metadata over display names for package specs.
276
+ - Shell installers such as `curl | bash`, `sudo`, and destructive commands require direct warnings and explicit user approval.
277
+
278
+ ## Manual Install Procedure
279
+
280
+ Use manual installation when Souk native tools are unsupported, uncertain, or insufficient.
281
+
282
+ 1. Inspect all available source records, repository files, package manifests, README instructions, release notes, and OpenCode docs.
283
+ 2. Decide whether the item is truly an OpenCode plugin, TUI plugin, MCP, agent, command, skill, theme, tool, app, project, or resource. Preserve alternate interpretations in the explanation.
284
+ 3. Identify the exact scope and target paths before writing.
285
+ 4. Create backups before the first write or install command.
286
+ 5. Prefer minimal native OpenCode file/config writes over shell installers when equivalent.
287
+ 6. If shell commands are necessary, explain what they install, where they write, and why native config/file copy is not enough.
288
+ 7. Never run `curl | sh`, `curl | bash`, `sudo`, destructive commands, or token/OAuth setup without explicit user approval after explaining risk.
289
+ 8. Preserve existing config and comments where possible. Refuse conflicting overwrites unless the user explicitly approves a diff.
290
+ 9. Validate written shapes against OpenCode config expectations.
291
+ 10. Report the backup path, exact changes, skipped steps, and restart requirements.
292
+
293
+ Manual install examples:
294
+
295
+ - A repo has `.opencode/agents/reviewer.md`: copy that file into the selected scope's agent directory after backing up the target directory.
296
+ - A repo has a `SKILL.md` plus reference files: copy only the skill folder contents required by the skill, not the whole repository.
297
+ - A plugin package has unusual options: patch `opencode.json(c)` or `tui.json(c)` with the documented tuple form after backing up the config file.
298
+ - An MCP README shows Claude `mcpServers`: convert only after approval and show the OpenCode `mcp` diff.
299
+ - A web app or tool is not a native OpenCode extension: do not pretend it is. Explain the manual setup and risks.
300
+
301
+ ## Planning Output
302
+
303
+ Your plan should include:
304
+
305
+ - Selected item IDs and all source records considered.
306
+ - Chosen native kind and any alternate kinds.
307
+ - Exact scope.
308
+ - Exact files/config keys that will change.
309
+ - Whether Souk native tools can perform the install.
310
+ - Security risks and uncertainty.
311
+ - Restart/hot-load expectations.
312
+
313
+ If approval is denied, continue planning and propose switching again only when the plan is refined or the user's concern is addressed.