opencode-skill-autodiscovery 1.0.0 → 1.0.2
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/README.md +21 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +31 -10
- package/dist/index.js.map +1 -1
- package/package.json +9 -1
package/README.md
CHANGED
|
@@ -9,7 +9,12 @@ registers them with opencode's `skills.paths` so they appear in every session.
|
|
|
9
9
|
Skills live in different places depending on the tool that installed them:
|
|
10
10
|
|
|
11
11
|
- VS Code agent plugins: `~/.vscode/agent-plugins/installed.json`
|
|
12
|
+
- VS Code agent plugins on a remote host (Remote-SSH, Codespaces, Dev
|
|
13
|
+
Containers): `~/.vscode-server/agent-plugins/installed.json`,
|
|
14
|
+
`~/.vscode-server-insiders/...`, or `~/.vscode-remote/...`
|
|
12
15
|
- Claude Code plugins: `~/.claude/plugins/installed_plugins.json`
|
|
16
|
+
- Claude Code plugins on a remote host (SSH/remote sessions):
|
|
17
|
+
`~/.claude/remote/plugins/installed_plugins.json`
|
|
13
18
|
|
|
14
19
|
Each points at plugin directories that contain `SKILL.md` files. This plugin
|
|
15
20
|
walks those manifests, finds every skill directory, and adds them to the
|
|
@@ -25,11 +30,27 @@ Add the package name to the `plugin` array in your `opencode.json`:
|
|
|
25
30
|
}
|
|
26
31
|
```
|
|
27
32
|
|
|
33
|
+
Use the tuple form to add extra root directories to scan (e.g. a non-standard
|
|
34
|
+
VS Code data location on a remote host):
|
|
35
|
+
|
|
36
|
+
```json
|
|
37
|
+
{
|
|
38
|
+
"plugin": [
|
|
39
|
+
[
|
|
40
|
+
"opencode-skill-autodiscovery",
|
|
41
|
+
{ "extraRoots": ["/home/user/.vscode-server"] }
|
|
42
|
+
]
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
28
47
|
## Notes
|
|
29
48
|
|
|
30
49
|
- Discovery is inherently **machine-local**: it reads manifests from the home
|
|
31
50
|
directory of the machine opencode is running on. Remote sessions on a
|
|
32
51
|
different machine will discover that machine's skills.
|
|
52
|
+
- VS Code account sync only syncs your marketplace extension list; each machine
|
|
53
|
+
still has its own `installed.json` that this plugin reads.
|
|
33
54
|
- The plugin is a no-op when no VS Code or Claude plugin manifests exist, or
|
|
34
55
|
when they contain no skills.
|
|
35
56
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Config } from "@opencode-ai/plugin";
|
|
2
|
-
declare const _default: () => Promise<{
|
|
2
|
+
declare const _default: (_input: import("@opencode-ai/plugin").PluginInput, options: import("@opencode-ai/plugin").PluginOptions | undefined) => Promise<{
|
|
3
3
|
config: (cfg: Config) => Promise<void>;
|
|
4
4
|
}>;
|
|
5
5
|
export default _default;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAU,MAAM,EAAE,MAAM,qBAAqB,CAAC;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAU,MAAM,EAAE,MAAM,qBAAqB,CAAC;;kBAgHlC,MAAM;;AAF9B,wBA2BoB"}
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
import { readFileSync, existsSync, readdirSync, statSync } from "node:fs";
|
|
2
2
|
import { homedir } from "node:os";
|
|
3
3
|
import { join } from "node:path";
|
|
4
|
-
const
|
|
5
|
-
|
|
4
|
+
const VSCODE_ROOTS = [
|
|
5
|
+
join(homedir(), ".vscode"),
|
|
6
|
+
join(homedir(), ".vscode-server"),
|
|
7
|
+
join(homedir(), ".vscode-server-insiders"),
|
|
8
|
+
join(homedir(), ".vscode-remote"),
|
|
9
|
+
];
|
|
10
|
+
const CLAUDE_MANIFESTS = [
|
|
11
|
+
join(homedir(), ".claude", "plugins", "installed_plugins.json"),
|
|
12
|
+
join(homedir(), ".claude", "remote", "plugins", "installed_plugins.json"),
|
|
13
|
+
];
|
|
6
14
|
function findSkillDirs(root, out, seen) {
|
|
7
15
|
const resolved = join(root);
|
|
8
16
|
if (seen.has(resolved))
|
|
@@ -49,12 +57,12 @@ function vscodePluginPath(pluginUri) {
|
|
|
49
57
|
raw = raw.slice(1);
|
|
50
58
|
return raw;
|
|
51
59
|
}
|
|
52
|
-
function
|
|
53
|
-
if (!existsSync(
|
|
60
|
+
function collectVscodeManifest(out, installedJson) {
|
|
61
|
+
if (!existsSync(installedJson))
|
|
54
62
|
return;
|
|
55
63
|
let manifest;
|
|
56
64
|
try {
|
|
57
|
-
manifest = JSON.parse(readFileSync(
|
|
65
|
+
manifest = JSON.parse(readFileSync(installedJson, "utf8"));
|
|
58
66
|
}
|
|
59
67
|
catch {
|
|
60
68
|
return;
|
|
@@ -67,12 +75,18 @@ function collectVscode(out) {
|
|
|
67
75
|
findSkillDirs(dir, out, new Set());
|
|
68
76
|
}
|
|
69
77
|
}
|
|
70
|
-
function
|
|
71
|
-
|
|
78
|
+
function collectVscode(out, roots) {
|
|
79
|
+
for (const root of roots) {
|
|
80
|
+
collectVscodeManifest(out, join(root, "agent-plugins", "installed.json"));
|
|
81
|
+
collectVscodeManifest(out, join(root, "data", "agent-plugins", "installed.json"));
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
function collectClaudeManifest(out, installedJson) {
|
|
85
|
+
if (!existsSync(installedJson))
|
|
72
86
|
return;
|
|
73
87
|
let manifest;
|
|
74
88
|
try {
|
|
75
|
-
manifest = JSON.parse(readFileSync(
|
|
89
|
+
manifest = JSON.parse(readFileSync(installedJson, "utf8"));
|
|
76
90
|
}
|
|
77
91
|
catch {
|
|
78
92
|
return;
|
|
@@ -85,12 +99,19 @@ function collectClaude(out) {
|
|
|
85
99
|
}
|
|
86
100
|
}
|
|
87
101
|
}
|
|
88
|
-
|
|
102
|
+
function collectClaude(out) {
|
|
103
|
+
for (const installedJson of CLAUDE_MANIFESTS) {
|
|
104
|
+
collectClaudeManifest(out, installedJson);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
export default (async (_input, options) => {
|
|
89
108
|
return {
|
|
90
109
|
config: async (cfg) => {
|
|
91
110
|
const config = cfg;
|
|
111
|
+
const roots = VSCODE_ROOTS;
|
|
112
|
+
const extra = Array.isArray(options?.extraRoots) ? options.extraRoots : [];
|
|
92
113
|
const dirs = new Set();
|
|
93
|
-
collectVscode(dirs);
|
|
114
|
+
collectVscode(dirs, [...roots, ...extra]);
|
|
94
115
|
collectClaude(dirs);
|
|
95
116
|
if (dirs.size === 0)
|
|
96
117
|
return;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC1E,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAUjC,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC1E,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAUjC,MAAM,YAAY,GAAG;IACnB,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,CAAC;IAC1B,IAAI,CAAC,OAAO,EAAE,EAAE,gBAAgB,CAAC;IACjC,IAAI,CAAC,OAAO,EAAE,EAAE,yBAAyB,CAAC;IAC1C,IAAI,CAAC,OAAO,EA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IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;YAC/B,aAAa,CAAC,IAAI,EAAE,CAAC,GAAG,KAAK,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC;YAC1C,aAAa,CAAC,IAAI,CAAC,CAAC;YACpB,IAAI,IAAI,CAAC,IAAI,KAAK,CAAC;gBAAE,OAAO;YAC5B,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;YAC/B,MAAM,MAAM,GAAa,EAAE,CAAC;YAC5B,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;gBACvB,MAAM,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,GAAG,EAAG,CAAC;gBACvC,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC;oBAAE,SAAS;gBAC7B,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;gBACf,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACnB,CAAC;YACD,MAAM,CAAC,MAAM,KAAK,EAAE,CAAC;YACrB,MAAM,CAAC,MAAM,CAAC,KAAK,KAAK,EAAE,CAAC;YAC3B,KAAK,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;gBACzB,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;oBACvC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;gBAChC,CAAC;YACH,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC,CAAkB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-skill-autodiscovery",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "OpenCode plugin that auto-discovers skills installed by VS Code agent plugins and Claude Code plugins, and registers them with the local opencode config.",
|
|
5
5
|
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/Marinski/opencode-skill-autodiscovery.git"
|
|
9
|
+
},
|
|
10
|
+
"homepage": "https://github.com/Marinski/opencode-skill-autodiscovery",
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/Marinski/opencode-skill-autodiscovery/issues"
|
|
13
|
+
},
|
|
6
14
|
"type": "module",
|
|
7
15
|
"main": "./dist/index.js",
|
|
8
16
|
"types": "./dist/index.d.ts",
|