opencode-plugin-hub 0.0.0-stage → 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/dist/index.js ADDED
@@ -0,0 +1,11 @@
1
+ // src/index.ts
2
+ import { Plugin } from "@opencode/plugin";
3
+ var index_default = Plugin.define({
4
+ id: "plugin-hub",
5
+ setup() {
6
+ return;
7
+ }
8
+ });
9
+ export {
10
+ index_default as default
11
+ };
package/package.json CHANGED
@@ -1,6 +1,63 @@
1
1
  {
2
2
  "name": "opencode-plugin-hub",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "Plugin manager for OpenCode Desktop: browse community plugins, search npm, inspect README and downloads, install and update without editing JSON.",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "author": "meiyx7",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/meiyx7/opencode-plugin-hub.git"
11
+ },
12
+ "homepage": "https://github.com/meiyx7/opencode-plugin-hub#readme",
13
+ "bugs": {
14
+ "url": "https://github.com/meiyx7/opencode-plugin-hub/issues"
15
+ },
16
+ "keywords": [
17
+ "opencode",
18
+ "opencode-plugin",
19
+ "plugin-manager",
20
+ "plugin-hub",
21
+ "marketplace",
22
+ "npm"
23
+ ],
24
+ "main": "./dist/index.js",
25
+ "module": "./dist/index.js",
26
+ "exports": {
27
+ ".": "./dist/index.js",
28
+ "./gui-experimental": "./dist/gui-experimental.cjs",
29
+ "./package.json": "./package.json"
30
+ },
31
+ "files": [
32
+ "dist",
33
+ "src",
34
+ "LICENSE"
35
+ ],
36
+ "engines": {
37
+ "node": ">=20"
38
+ },
39
+ "publishConfig": {
40
+ "access": "public",
41
+ "registry": "https://registry.npmjs.org/"
42
+ },
43
+ "dependencies": {
44
+ "@opencode/plugin": "2.2.5",
45
+ "jsonc-parser": "^3.3.1"
46
+ },
47
+ "devDependencies": {
48
+ "@types/node": "^22.10.0",
49
+ "esbuild": "^0.28.2",
50
+ "effect": "4.0.6",
51
+ "solid-js": "^1.9.5",
52
+ "typescript": "^5.7.0",
53
+ "vite": "^7.1.0",
54
+ "vite-plugin-solid": "^2.11.0"
55
+ },
56
+ "scripts": {
57
+ "build": "vite build && esbuild src/index.ts --bundle --platform=node --format=esm --external:@opencode/plugin --outfile=dist/index.js",
58
+ "dev": "vite build --watch",
59
+ "typecheck": "tsc --noEmit",
60
+ "refresh": "node scripts/refresh-registry.mjs",
61
+ "prepublishOnly": "npm run typecheck && npm run build"
62
+ }
63
+ }
@@ -0,0 +1,186 @@
1
+ import { Ipc } from "@opencode/plugin/gui"
2
+ import { Schema } from "effect"
3
+
4
+ /** One entry of the `plugins` array in opencode.json. */
5
+ export const InstalledEntry = Schema.Struct({
6
+ /** The raw string as written in the config, e.g. `opencode-qoder-bridge` or `/abs/path`. */
7
+ spec: Schema.String,
8
+ /** The package (or directory) name without a version range. */
9
+ name: Schema.String,
10
+ /** `package` for a registry package, `path` for a local directory. */
11
+ kind: Schema.String,
12
+ /** Installed version, or an empty string when it cannot be read. */
13
+ version: Schema.String,
14
+ /** False for the plugin that serves this page, which cannot remove itself. */
15
+ removable: Schema.Boolean,
16
+ })
17
+
18
+ export const HubState = Schema.Struct({
19
+ configPath: Schema.String,
20
+ configKey: Schema.String,
21
+ plugins: Schema.Array(InstalledEntry),
22
+ error: Schema.String,
23
+ })
24
+
25
+ export const SearchHit = Schema.Struct({
26
+ name: Schema.String,
27
+ version: Schema.String,
28
+ description: Schema.String,
29
+ /** Publish date of the latest version, ISO 8601. */
30
+ published: Schema.String,
31
+ /**
32
+ * Legacy alias of `published`, kept on the wire so a window and a service running
33
+ * different builds of this plugin can still decode each other's search results.
34
+ */
35
+ updated: Schema.String,
36
+ installed: Schema.Boolean,
37
+ /** Version on disk, empty when it cannot be read. */
38
+ current: Schema.String,
39
+ /** True when the registry has a newer version than the installed one. */
40
+ hasUpdate: Schema.Boolean,
41
+ /** Downloads in the last week. */
42
+ weekly: Schema.Number,
43
+ /** Downloads in the last month. */
44
+ monthly: Schema.Number,
45
+ publisher: Schema.String,
46
+ license: Schema.String,
47
+ keywords: Schema.Array(Schema.String),
48
+ homepage: Schema.String,
49
+ repo: Schema.String,
50
+ npm: Schema.String,
51
+ })
52
+
53
+ /** Everything the detail dialog shows about one npm package. */
54
+ export const PackageDetail = Schema.Struct({
55
+ name: Schema.String,
56
+ /** Latest published version. */
57
+ version: Schema.String,
58
+ description: Schema.String,
59
+ homepage: Schema.String,
60
+ repo: Schema.String,
61
+ /** Monorepo subdirectory, e.g. `packages/trae`. */
62
+ repoDir: Schema.String,
63
+ npm: Schema.String,
64
+ bugs: Schema.String,
65
+ license: Schema.String,
66
+ keywords: Schema.Array(Schema.String),
67
+ maintainers: Schema.Array(Schema.String),
68
+ weekly: Schema.Number,
69
+ monthly: Schema.Number,
70
+ /** Publish date of the latest version, ISO 8601. */
71
+ published: Schema.String,
72
+ /** First publish date of the package, ISO 8601. */
73
+ created: Schema.String,
74
+ versions: Schema.Number,
75
+ /** Unpacked size of the latest tarball, in bytes. */
76
+ unpacked: Schema.Number,
77
+ files: Schema.Number,
78
+ /** Direct dependencies, as `name@range`. */
79
+ dependencies: Schema.Array(Schema.String),
80
+ /** Deprecation notice of the latest version; empty when it is not deprecated. */
81
+ deprecated: Schema.String,
82
+ readme: Schema.String,
83
+ /** True when the README was cut because it was too long. */
84
+ readmeTruncated: Schema.Boolean,
85
+ installed: Schema.Boolean,
86
+ current: Schema.String,
87
+ hasUpdate: Schema.Boolean,
88
+ /** Empty on success. */
89
+ error: Schema.String,
90
+ })
91
+
92
+ /** One row of the update check performed against the npm registry. */
93
+ export const UpdateInfo = Schema.Struct({
94
+ spec: Schema.String,
95
+ /** Real package name; for a directory plugin this comes from its package.json. */
96
+ name: Schema.String,
97
+ kind: Schema.String,
98
+ current: Schema.String,
99
+ latest: Schema.String,
100
+ hasUpdate: Schema.Boolean,
101
+ /** False for directory plugins, whose files are replaced instead of re-resolved from the registry. */
102
+ managed: Schema.Boolean,
103
+ error: Schema.String,
104
+ })
105
+
106
+ export const UpdatesResult = Schema.Struct({
107
+ items: Schema.Array(UpdateInfo),
108
+ error: Schema.String,
109
+ })
110
+
111
+ export const SearchResult = Schema.Struct({
112
+ hits: Schema.Array(SearchHit),
113
+ error: Schema.String,
114
+ })
115
+
116
+ /** One row of the curated community catalog. */
117
+ export const CatalogEntry = Schema.Struct({
118
+ name: Schema.String,
119
+ /** Empty when the project is only distributed through GitHub, not npm. */
120
+ pkg: Schema.String,
121
+ version: Schema.String,
122
+ type: Schema.String,
123
+ desc: Schema.String,
124
+ long: Schema.String,
125
+ repo: Schema.String,
126
+ tags: Schema.Array(Schema.String),
127
+ installed: Schema.Boolean,
128
+ })
129
+
130
+ export const CatalogResult = Schema.Struct({
131
+ entries: Schema.Array(CatalogEntry),
132
+ /** `network`, `cache` or `builtin`. */
133
+ source: Schema.String,
134
+ fetchedAt: Schema.Number,
135
+ error: Schema.String,
136
+ })
137
+
138
+ export const Browse = Schema.Struct({
139
+ /** Skip the on-disk cache and hit the network. */
140
+ force: Schema.Boolean,
141
+ })
142
+
143
+ export const Url = Schema.Struct({
144
+ url: Schema.String,
145
+ })
146
+
147
+ export const Opened = Schema.Struct({
148
+ ok: Schema.Boolean,
149
+ })
150
+
151
+ export const Mutation = Schema.Struct({
152
+ ok: Schema.Boolean,
153
+ message: Schema.String,
154
+ state: HubState,
155
+ })
156
+
157
+ export const Target = Schema.Struct({
158
+ spec: Schema.String,
159
+ version: Schema.String,
160
+ })
161
+
162
+ export const Query = Schema.Struct({
163
+ query: Schema.String,
164
+ })
165
+
166
+ export const DetailQuery = Schema.Struct({
167
+ name: Schema.String,
168
+ })
169
+
170
+ /** The bridge between this plugin's window page and its main-process file access. */
171
+ export const Admin = Ipc.define({
172
+ id: "plugin-hub.admin",
173
+ methods: {
174
+ snapshot: { output: HubState },
175
+ updates: { output: UpdatesResult },
176
+ search: { input: Query, output: SearchResult },
177
+ detail: { input: DetailQuery, output: PackageDetail },
178
+ browse: { input: Browse, output: CatalogResult },
179
+ openUrl: { input: Url, output: Opened },
180
+ openConfig: { output: Opened },
181
+ install: { input: Target, output: Mutation },
182
+ remove: { input: Target, output: Mutation },
183
+ reload: { output: Mutation },
184
+ restart: { output: Opened },
185
+ },
186
+ })