@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.
@@ -0,0 +1,176 @@
1
+ # OpenCode Souk Implementation Plan
2
+
3
+ Package: `@mirrowel/opencode-souk`
4
+
5
+ UI title: `OpenCode Souk`
6
+
7
+ Souk replaces the built-in OpenCode plugin manager with a TUI-native extension bazaar for plugins, MCP servers, agents, commands, themes, skills, and experimental ecosystem items.
8
+
9
+ ## Core Principles
10
+
11
+ - Everything important is inspectable with `i`.
12
+ - Native install paths are preferred when Souk can verify them.
13
+ - Forge mode is available for any selected item, including verified items.
14
+ - Low-confidence paths must say that the souk can make mistakes.
15
+ - Persistent writes must be previewed or explicitly approved.
16
+ - Security analysis is mandatory for Kāf and the `souk-installer` skill.
17
+ - Claude-style MCP config conversion is never silent.
18
+ - Native installs and Kāf installs must ask for scope: global or project. If project is selected, ask which project/path.
19
+
20
+ ## TUI Controls
21
+
22
+ - `Enter`: select or unselect the current item.
23
+ - `Space`: open the install menu for all selected items.
24
+ - `i`: inspect/appraise the current item.
25
+ - `r`: refresh community sources.
26
+ - `Esc`: cancel/back.
27
+
28
+ Install menu after `Space`:
29
+
30
+ - `Safe install`: deterministic native installer where available.
31
+ - `Forge with Kāf`: LLM-assisted install for all selected items.
32
+ - `Preview`: proposed deterministic writes/actions.
33
+ - `Scope`: choose global or project target.
34
+ - `Cancel`.
35
+
36
+ Appraisal/details are in the `i` panel, not a separate action.
37
+
38
+ ## Supported Categories
39
+
40
+ - Plugins
41
+ - MCP servers
42
+ - Agents
43
+ - Commands
44
+ - Themes
45
+ - Skills
46
+ - Other ecosystem items through experimental Forge mode
47
+
48
+ ## Kāf
49
+
50
+ Dedicated Souk installer agent title/name: `Kāf`.
51
+
52
+ Internal agents:
53
+
54
+ - `kāf-plan`: read/inspect/plan only. It may use MCP tools for research/appraisal, but not for writes or mutation.
55
+ - `kāf-action`: approved action mode, can make changes with confirmation-oriented permissions.
56
+
57
+ Default model: `opencode/big-pickle`.
58
+
59
+ Kāf settings are hidden unless experimental Forge mode is enabled:
60
+
61
+ - Model
62
+ - Model variant
63
+ - Temperature
64
+ - Top P
65
+ - Provider/model options
66
+ - Personality preset
67
+ - Permission preset
68
+ - Bulk Forge enablement
69
+ - High-risk typed confirmation policy
70
+
71
+ Kāf always loads or is instructed to load:
72
+
73
+ - `customize-opencode`
74
+ - `souk-installer`
75
+
76
+ ## Personality Presets
77
+
78
+ Default: `curio-shelf`.
79
+
80
+ Available presets:
81
+
82
+ - `curio-shelf`
83
+ - `expedition-cataloguer`
84
+ - `the-fence`
85
+ - `wayfinder`
86
+ - `quartermaster`
87
+ - `appraiser`
88
+ - `the-souk`
89
+ - `wary-antiquarian`
90
+ - `friendly-stallkeeper`
91
+ - `contract-scribe`
92
+ - `pragmatic-artisan`
93
+ - `sober-host`
94
+
95
+ Personality never hides risk. Warnings use plain language.
96
+
97
+ ## Forge Flow
98
+
99
+ 1. User selects one or more items.
100
+ 2. User presses `Space`.
101
+ 3. User chooses `Forge with Kāf`.
102
+ 4. Souk asks for scope: global or project, and asks which project/path for project scope.
103
+ 5. Souk shows a confirmation with count, confidence summary, and security warning.
104
+ 6. Souk creates a new dedicated session with `kāf-plan`.
105
+ 7. Initial prompt includes structured metadata for all selected items.
106
+ 8. Initial prompt instructs Kāf to load `customize-opencode` and `souk-installer`.
107
+ 9. Kāf performs security analysis and proposes a plan. MCP tools may be used during planning if they help inspect or verify the item, but Kāf must not use MCPs for mutation before approval.
108
+ 10. Kāf calls `souk_request_action` when it is appropriate to ask for action mode.
109
+ 11. The tool presents a minimal yes/no confirmation including security risks.
110
+ 12. If the user says no: nothing changes. The tool output must tell Kāf the user wishes to continue planning and that it should propose switching again only when appropriate.
111
+ 13. If the user says yes: the tool queues a same-session continuation using `kāf-action` and instructs Kāf to execute only the approved plan.
112
+
113
+ ## Kāf Approval Tool
114
+
115
+ Tool: `souk_request_action`.
116
+
117
+ Behavior:
118
+
119
+ - Exclusive to Kāf agents through permissions where possible.
120
+ - Runtime rejects calls from non-Kāf agents.
121
+ - Shows yes/no approval only.
122
+ - Includes security risks and planned writes/actions.
123
+ - Does not install directly.
124
+ - On rejection, tells Kāf to continue planning.
125
+ - On approval, queues a `kāf-action` continuation in the same session.
126
+
127
+ ## Future Kāf Expansion
128
+
129
+ Kāf may later receive native Souk tools for safe deterministic actions, such as:
130
+
131
+ - Native plugin install/import.
132
+ - Native MCP config add/connect/auth.
133
+ - Native agent/command/theme/skill install.
134
+ - Native config preview/diff generation.
135
+
136
+ These tools should still respect scope prompts and preview/approval boundaries.
137
+
138
+ ## Deterministic Native Installer Rules
139
+
140
+ Native installers should be complete for first-class installable categories:
141
+
142
+ - Plugins use OpenCode's native plugin installer.
143
+ - MCP servers patch persistent `mcp` config, convert Claude `mcpServers` only with approval, and best-effort add/connect at runtime.
144
+ - Agents install from inline `agent` config, markdown snippets, or conventional `{agent,agents}/**/*.md` files in GitHub repos.
145
+ - Commands install from inline `command` config, markdown snippets, or conventional `{command,commands}/**/*.md` files in GitHub repos.
146
+ - Themes install valid theme JSON into `themes/*.json` and may optionally activate by patching `tui.jsonc`.
147
+ - Skills install `SKILL.md` plus companion files from the skill folder.
148
+
149
+ Native installers must refuse conflicting overwrites and tell the user to use Forge or manual review when source metadata is insufficient.
150
+
151
+ ## Sources
152
+
153
+ Initial sources:
154
+
155
+ - `opencode.cafe` Convex approved extension API.
156
+ - `awesome-opencode` `dist/registry.json`.
157
+ - OpenCode ecosystem docs markdown.
158
+
159
+ Cache policy:
160
+
161
+ - Fetch only when cache is empty or user asks refresh.
162
+ - Keep stale cache on failure.
163
+ - Cache raw source results separately from validation results.
164
+
165
+ ## Acceptance Criteria
166
+
167
+ - `Plugins` and `Install plugin` open Souk.
168
+ - Built-in `internal:plugin-manager` is disabled/replaced.
169
+ - `Enter`, `Space`, and `i` work as specified.
170
+ - Items show source, type, confidence, and security/appraisal info.
171
+ - Native install asks scope and previews writes.
172
+ - Forge asks scope and creates a dedicated Kāf session.
173
+ - Kāf starts in plan mode and cannot use action mode without approval.
174
+ - Approval tool is yes/no and Kāf-exclusive.
175
+ - Security analysis is required by the skill and prompt.
176
+ - Model/variant settings reuse the agent-variants style, without inheritance/routing.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Mirrowel
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,91 @@
1
+ # OpenCode Souk
2
+
3
+ `@mirrowel/opencode-souk` replaces OpenCode's built-in plugin manager with a TUI marketplace for extensions.
4
+
5
+ Souk can browse deduped community sources, show installed plugins separately, select multiple marketplace items, preview native installs, and optionally open an experimental Kāf Forge session for LLM-assisted installation.
6
+
7
+ ## Current Status
8
+
9
+ Initial implementation. See `IMPLEMENTATION_PLAN.md` for the product and engineering plan.
10
+
11
+ The marketplace fetches three sources by default: opencode.cafe, awesome-opencode, and the OpenCode ecosystem docs. Deduped combo items preserve all source records and choose the richest source for display.
12
+
13
+ Native installers currently support:
14
+
15
+ - OpenCode plugins through the native plugin installer.
16
+ - MCP servers through persistent `mcp` config patching, Claude `mcpServers` conversion with explicit approval, and best-effort runtime add/connect.
17
+ - Agents from inline config, markdown snippets, or conventional GitHub repo paths.
18
+ - Commands from inline config, markdown snippets, or conventional GitHub repo paths.
19
+ - Themes from theme JSON snippets or conventional GitHub repo paths, with optional activation.
20
+ - Skills from `SKILL.md` snippets or conventional GitHub repo paths, including companion files under the skill folder.
21
+
22
+ Native installs create a pre-install backup snapshot before supported install actions, then refuse to overwrite existing files or conflicting config entries.
23
+
24
+ ## Commands
25
+
26
+ Souk deactivates OpenCode's built-in plugin manager and adds one palette entry:
27
+
28
+ - Category: `Plugin Manager`
29
+ - Command: `Souk`
30
+
31
+ The built-in `Plugins` and `Install plugin` entries are intentionally removed while Souk is active.
32
+
33
+ The palette command opens a normal Souk main menu. Item browsing/selection is one option; diagnostics, settings, debug tools, source refresh, and info are separate menu actions.
34
+
35
+ ## Local Install
36
+
37
+ Build the local package:
38
+
39
+ ```powershell
40
+ npm install
41
+ npm run build
42
+ ```
43
+
44
+ Then add the local package directory to both configs.
45
+
46
+ `opencode.jsonc`:
47
+
48
+ ```jsonc
49
+ {
50
+ "plugin": ["file:///C:/Projects/OC%20Plugins/plugin-repo"]
51
+ }
52
+ ```
53
+
54
+ `tui.jsonc`:
55
+
56
+ ```jsonc
57
+ {
58
+ "plugin": ["file:///C:/Projects/OC%20Plugins/plugin-repo"]
59
+ }
60
+ ```
61
+
62
+ No `plugin_enabled` entry should be needed in normal use. Souk deactivates `internal:plugin-manager` during TUI startup and registers its own `Plugin Manager > Souk` palette command.
63
+
64
+ ## Controls
65
+
66
+ - `Enter`: select/unselect item.
67
+ - `Space`: install selected items.
68
+ - `/`: search marketplace items.
69
+ - `i`: inspect item details and security appraisal.
70
+ - `r`: refresh sources.
71
+ - `Shift+Up/Down` or `Ctrl+Up/Down`: jump kind groups.
72
+ - `Shift+Left/Right`: jump tag groups.
73
+ - `Esc`: close/back.
74
+
75
+ Installed plugins are managed from the separate `Installed plugins` view. There, `Enter` toggles the highlighted plugin active/inactive; no batch install or Forge flow is available.
76
+
77
+ ## Verification
78
+
79
+ ```powershell
80
+ npm run verify:registry:live
81
+ npm run verify:install-plans
82
+ npm run ci
83
+ ```
84
+
85
+ The live registry check verifies source counts, parsing, classification, dedupe provenance, and the integrated `loadRegistry()` path. The install-plan check uses a temporary OpenCode config directory and verifies plugin, MCP, Claude MCP conversion, agent, command, skill, and theme plans.
86
+
87
+ ## Safety
88
+
89
+ The souk can make mistakes. Low-confidence installs are marked, Forge mode is experimental, and Kāf is instructed to perform security analysis before proposing changes.
90
+
91
+ Souk keeps sidecar config backups in `~/.config/opencode/souk.backup.json`, creates native install snapshots under `~/.config/opencode/souk-install-backups/`, and writes debug logs to `~/.config/opencode/souk.debug.log` when debug mode is enabled.