opencode-skill-autodiscovery 2.0.0 → 2.1.1
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 +117 -25
- package/dist/agents.d.ts +3 -1
- package/dist/agents.d.ts.map +1 -1
- package/dist/agents.js +86 -27
- package/dist/agents.js.map +1 -1
- package/dist/cache.d.ts +5 -0
- package/dist/cache.d.ts.map +1 -0
- package/dist/cache.js +94 -0
- package/dist/cache.js.map +1 -0
- package/dist/discovery-cache.d.ts +9 -0
- package/dist/discovery-cache.d.ts.map +1 -0
- package/dist/discovery-cache.js +169 -0
- package/dist/discovery-cache.js.map +1 -0
- package/dist/discovery.d.ts +28 -6
- package/dist/discovery.d.ts.map +1 -1
- package/dist/discovery.js +417 -105
- package/dist/discovery.js.map +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +62 -11
- package/dist/index.js.map +1 -1
- package/dist/mcp.d.ts +6 -2
- package/dist/mcp.d.ts.map +1 -1
- package/dist/mcp.js +97 -16
- package/dist/mcp.js.map +1 -1
- package/dist/schemas/mcp-schema-1.0.0.d.ts +117 -0
- package/dist/schemas/mcp-schema-1.0.0.d.ts.map +1 -0
- package/dist/schemas/mcp-schema-1.0.0.js +139 -0
- package/dist/schemas/mcp-schema-1.0.0.js.map +1 -0
- package/dist/schemas/plugin-schema-1.0.0.d.ts +66 -0
- package/dist/schemas/plugin-schema-1.0.0.d.ts.map +1 -0
- package/dist/schemas/plugin-schema-1.0.0.js +72 -0
- package/dist/schemas/plugin-schema-1.0.0.js.map +1 -0
- package/dist/spec-schema.d.ts +12 -0
- package/dist/spec-schema.d.ts.map +1 -0
- package/dist/spec-schema.js +71 -0
- package/dist/spec-schema.js.map +1 -0
- package/package.json +6 -3
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { mkdirSync, readdirSync, readFileSync, renameSync, statSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { dirname, join, relative } from "node:path";
|
|
4
|
+
import { pluginCacheRoot } from "./cache.js";
|
|
5
|
+
// findPluginRoots' real walk is the expensive part of a scan: at every
|
|
6
|
+
// directory it calls hasPluginLayout -> hasRootAgentFiles, which reads every
|
|
7
|
+
// flat *.md file's content to check its frontmatter (cache.ts's cachedRead
|
|
8
|
+
// avoids re-parsing an unchanged file's bytes, but the walk still visits
|
|
9
|
+
// every directory and opens every candidate file on every single run). For a
|
|
10
|
+
// large, mostly-unchanged tree (a synced Claude/VS Code plugin marketplace),
|
|
11
|
+
// that per-directory cost dominates opencode's startup time.
|
|
12
|
+
//
|
|
13
|
+
// This module is a second, coarser cache layer in front of the walk itself:
|
|
14
|
+
// fingerprint the subtree cheaply (readdirSync + statSync only, no content
|
|
15
|
+
// reads, no containment/symlink-resolution overhead) and let the caller skip
|
|
16
|
+
// the real walk entirely when the fingerprint matches the last run's. Pure
|
|
17
|
+
// primitives only — no dependency on discovery.ts's walk functions, so
|
|
18
|
+
// discovery.ts can depend on this module without a cycle; the glue that
|
|
19
|
+
// actually runs findPluginRoots on a miss lives in discovery.ts itself.
|
|
20
|
+
const CACHE_FILE_NAME = "discovery-root-cache.json";
|
|
21
|
+
// Bumped from 1 to 2 when the per-entry field storing the cached value was
|
|
22
|
+
// renamed from `packages` (PluginPackage[]-only) to the generic `value`
|
|
23
|
+
// (any JSON-serializable result — readAgents' cache reuses this same store).
|
|
24
|
+
// A version-1 file on disk is now correctly treated as absent rather than
|
|
25
|
+
// misread with the wrong field name.
|
|
26
|
+
//
|
|
27
|
+
// Bumped from 2 to 3 when PluginPackage gained the required `manifestName`
|
|
28
|
+
// field (see discovery.ts's dedupePackages): a cached entry written before
|
|
29
|
+
// that change serializes packages with no such field, so dedupePackages
|
|
30
|
+
// would silently treat every one of them as unidentified and keep every
|
|
31
|
+
// mirror — exactly the double-registration bug this field exists to fix,
|
|
32
|
+
// just reintroduced via a stale cache. Bumping the version discards those
|
|
33
|
+
// entries so the next scan rebuilds them with the new field.
|
|
34
|
+
const CACHE_VERSION = 3;
|
|
35
|
+
// Mirrors discovery.ts's MAX_WALK_DEPTH: this is a separate, cheaper walk
|
|
36
|
+
// (see fingerprintTree below), but it must bound depth the same way for the
|
|
37
|
+
// same reason — a pathological or cyclic tree must not grow this pass
|
|
38
|
+
// unboundedly, even though (unlike the real walk) it does not resolve
|
|
39
|
+
// symlinks to detect cycles precisely. A cycle just gets fingerprinted up to
|
|
40
|
+
// this depth and then stops, exactly like the real walk's own documented
|
|
41
|
+
// "belt-and-braces, not load-bearing" depth cap.
|
|
42
|
+
const MAX_FINGERPRINT_DEPTH = 16;
|
|
43
|
+
let store = null;
|
|
44
|
+
let dirty = false;
|
|
45
|
+
function cacheFilePath() {
|
|
46
|
+
return join(pluginCacheRoot(), CACHE_FILE_NAME);
|
|
47
|
+
}
|
|
48
|
+
function loadStore() {
|
|
49
|
+
if (store)
|
|
50
|
+
return store;
|
|
51
|
+
try {
|
|
52
|
+
const raw = JSON.parse(readFileSync(cacheFilePath(), "utf8"));
|
|
53
|
+
store =
|
|
54
|
+
raw && raw.version === CACHE_VERSION && raw.entries && typeof raw.entries === "object"
|
|
55
|
+
? raw.entries
|
|
56
|
+
: {};
|
|
57
|
+
}
|
|
58
|
+
catch {
|
|
59
|
+
store = {};
|
|
60
|
+
}
|
|
61
|
+
return store;
|
|
62
|
+
}
|
|
63
|
+
// Test-only seam, same rationale as cache.ts's _resetFileCacheForTests: one
|
|
64
|
+
// opencode process makes one config() call, so the module-level singleton is
|
|
65
|
+
// the right scope in production; tests need to force a reload between cases
|
|
66
|
+
// that reuse the same HOME.
|
|
67
|
+
export function _resetDiscoveryCacheForTests() {
|
|
68
|
+
store = null;
|
|
69
|
+
dirty = false;
|
|
70
|
+
}
|
|
71
|
+
// A cheap, content-free signature of everything a full walk of `root` would
|
|
72
|
+
// visit: every directory's direct children, keyed by (path relative to root,
|
|
73
|
+
// file-or-dir, mtimeMs, size), hashed. Any add, remove, rename, or content
|
|
74
|
+
// edit anywhere in the subtree changes at least one child's stat (a write
|
|
75
|
+
// changes the file's own mtime/size; an add/remove/rename changes its parent
|
|
76
|
+
// directory's mtime) and so changes this hash — there is no staleness
|
|
77
|
+
// window, only a cheaper way to notice nothing changed.
|
|
78
|
+
//
|
|
79
|
+
// Deliberately skips realpathSync: that is precisely the overhead the real
|
|
80
|
+
// walk pays for its containment/symlink-cycle guarantees, and this pass does
|
|
81
|
+
// not need those guarantees — it only decides whether to trust a cached
|
|
82
|
+
// *result* of the real (fully-guarded) walk, never emits a path itself.
|
|
83
|
+
export function fingerprintTree(root) {
|
|
84
|
+
const parts = [];
|
|
85
|
+
walkFingerprint(root, root, parts, 0);
|
|
86
|
+
parts.sort();
|
|
87
|
+
const hash = createHash("sha1");
|
|
88
|
+
for (const part of parts)
|
|
89
|
+
hash.update(part).update("\n");
|
|
90
|
+
return hash.digest("hex");
|
|
91
|
+
}
|
|
92
|
+
function walkFingerprint(root, dir, parts, depth) {
|
|
93
|
+
if (depth > MAX_FINGERPRINT_DEPTH)
|
|
94
|
+
return;
|
|
95
|
+
let entries;
|
|
96
|
+
try {
|
|
97
|
+
entries = readdirSync(dir);
|
|
98
|
+
}
|
|
99
|
+
catch {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
for (const entry of entries) {
|
|
103
|
+
if (entry === ".git" || entry === "node_modules")
|
|
104
|
+
continue;
|
|
105
|
+
const full = join(dir, entry);
|
|
106
|
+
let st;
|
|
107
|
+
try {
|
|
108
|
+
st = statSync(full);
|
|
109
|
+
}
|
|
110
|
+
catch {
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
const isDir = st.isDirectory();
|
|
114
|
+
parts.push(`${relative(root, full)}:${isDir ? "d" : "f"}:${st.mtimeMs}:${st.size}`);
|
|
115
|
+
if (isDir)
|
|
116
|
+
walkFingerprint(root, full, parts, depth + 1);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
// Returns the packages cached for `key` when its stored fingerprint matches
|
|
120
|
+
// `fingerprint`, or null on a miss (not cached yet, or the subtree changed).
|
|
121
|
+
export function getCachedPackages(key, fingerprint) {
|
|
122
|
+
return getCachedValue(key, fingerprint);
|
|
123
|
+
}
|
|
124
|
+
// Records `packages` as the result for `key` at `fingerprint`, so the next
|
|
125
|
+
// call with an unchanged fingerprint gets them back from getCachedPackages
|
|
126
|
+
// without re-walking.
|
|
127
|
+
export function setCachedPackages(key, fingerprint, packages) {
|
|
128
|
+
setCachedValue(key, fingerprint, packages);
|
|
129
|
+
}
|
|
130
|
+
// Generic form of the same fingerprint-gated cache, for any JSON-serializable
|
|
131
|
+
// result of a per-directory computation — not just a package list. Used by
|
|
132
|
+
// readAgents (agents.ts) to cache a whole package's extracted agents keyed by
|
|
133
|
+
// a fingerprint of that package's own root: a marketplace layout with few
|
|
134
|
+
// packages but many flat *.md files per package (the exact shape that caused
|
|
135
|
+
// the original hang) would otherwise re-run readdirSync + the per-file
|
|
136
|
+
// containment check for every file, every run, even once the top-level walk
|
|
137
|
+
// itself is fully cached — package roots are typically far smaller subtrees
|
|
138
|
+
// than the marketplace root, so fingerprinting one is cheap.
|
|
139
|
+
export function getCachedValue(key, fingerprint) {
|
|
140
|
+
const cached = loadStore()[key];
|
|
141
|
+
return cached && cached.fingerprint === fingerprint ? cached.value : null;
|
|
142
|
+
}
|
|
143
|
+
export function setCachedValue(key, fingerprint, value) {
|
|
144
|
+
loadStore()[key] = { fingerprint, value, cachedAt: new Date().toISOString() };
|
|
145
|
+
dirty = true;
|
|
146
|
+
}
|
|
147
|
+
// Persists the in-memory cache to disk when it changed, atomically (write to
|
|
148
|
+
// a pid-suffixed temp file, then rename over the real path) so a process
|
|
149
|
+
// killed mid-write can never leave a half-written cache file behind for the
|
|
150
|
+
// next run to trip over. Best-effort, like every other filesystem side
|
|
151
|
+
// effect in this codebase: a failed write is swallowed, and the next run
|
|
152
|
+
// just re-walks.
|
|
153
|
+
export function flushDiscoveryCache() {
|
|
154
|
+
if (!dirty || !store)
|
|
155
|
+
return;
|
|
156
|
+
try {
|
|
157
|
+
const path = cacheFilePath();
|
|
158
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
159
|
+
const payload = { version: CACHE_VERSION, entries: store };
|
|
160
|
+
const tmp = `${path}.${process.pid}.tmp`;
|
|
161
|
+
writeFileSync(tmp, JSON.stringify(payload));
|
|
162
|
+
renameSync(tmp, path);
|
|
163
|
+
dirty = false;
|
|
164
|
+
}
|
|
165
|
+
catch {
|
|
166
|
+
// Non-fatal: the next run just re-walks and rebuilds the cache.
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
//# sourceMappingURL=discovery-cache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discovery-cache.js","sourceRoot":"","sources":["../src/discovery-cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACpG,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAG7C,uEAAuE;AACvE,6EAA6E;AAC7E,2EAA2E;AAC3E,yEAAyE;AACzE,6EAA6E;AAC7E,6EAA6E;AAC7E,6DAA6D;AAC7D,EAAE;AACF,4EAA4E;AAC5E,2EAA2E;AAC3E,6EAA6E;AAC7E,2EAA2E;AAC3E,uEAAuE;AACvE,wEAAwE;AACxE,wEAAwE;AAExE,MAAM,eAAe,GAAG,2BAA2B,CAAC;AACpD,2EAA2E;AAC3E,wEAAwE;AACxE,6EAA6E;AAC7E,0EAA0E;AAC1E,qCAAqC;AACrC,EAAE;AACF,2EAA2E;AAC3E,2EAA2E;AAC3E,wEAAwE;AACxE,wEAAwE;AACxE,yE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C7B,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,aAAa,EAAE,CAAC;QAC7B,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC9C,MAAM,OAAO,GAAc,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;QACtE,MAAM,GAAG,GAAG,GAAG,IAAI,IAAI,OAAO,CAAC,GAAG,MAAM,CAAC;QACzC,aAAa,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;QAC5C,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACtB,KAAK,GAAG,KAAK,CAAC;IAChB,CAAC;IAAC,MAAM,CAAC;QACP,gEAAgE;IAClE,CAAC;AACH,CAAC"}
|
package/dist/discovery.d.ts
CHANGED
|
@@ -9,9 +9,10 @@ export type PluginPackage = {
|
|
|
9
9
|
source: PackageSource;
|
|
10
10
|
/**
|
|
11
11
|
* Two-tier trust model. True when the content was installed or fetched
|
|
12
|
-
* deliberately via a host tool or opencode itself (claude/vscode manifests
|
|
13
|
-
* opencode's package cache). False when present merely as
|
|
14
|
-
* (project node_modules, manifest-less walks
|
|
12
|
+
* deliberately via a host tool or opencode itself (claude/vscode manifests
|
|
13
|
+
* under home roots, opencode's package cache). False when present merely as
|
|
14
|
+
* a side effect (project node_modules, manifest-less walks, and any package
|
|
15
|
+
* reached through a user-supplied extra root).
|
|
15
16
|
*/
|
|
16
17
|
trusted: boolean;
|
|
17
18
|
name: string;
|
|
@@ -20,6 +21,16 @@ export type PluginPackage = {
|
|
|
20
21
|
mcpPath?: string;
|
|
21
22
|
/** Agent Plugins version declared by plugin.json, e.g. "1.0.0". */
|
|
22
23
|
schemaVersion?: string;
|
|
24
|
+
/**
|
|
25
|
+
* True when `name` was read from a real plugin manifest (Agent Plugins
|
|
26
|
+
* schema or a native Claude Code `.claude-plugin/plugin.json`), so it is
|
|
27
|
+
* the plugin's own declared identity rather than a directory-basename
|
|
28
|
+
* fallback. dedupePackages only collapses mirrors discovered at different
|
|
29
|
+
* physical paths when this is true — trusting a bare basename the same
|
|
30
|
+
* way would risk merging two unrelated packages that happen to share a
|
|
31
|
+
* generic directory name.
|
|
32
|
+
*/
|
|
33
|
+
manifestName: boolean;
|
|
23
34
|
};
|
|
24
35
|
export type SkillInfo = {
|
|
25
36
|
dir: string;
|
|
@@ -28,18 +39,25 @@ export type SkillInfo = {
|
|
|
28
39
|
};
|
|
29
40
|
export type ConfigPatch = {
|
|
30
41
|
skillPaths: string[];
|
|
42
|
+
skillTrust: Array<{
|
|
43
|
+
dir: string;
|
|
44
|
+
trusted: boolean;
|
|
45
|
+
}>;
|
|
31
46
|
commands: Array<{
|
|
32
47
|
name: string;
|
|
33
48
|
description: string;
|
|
34
49
|
template: string;
|
|
50
|
+
trusted: boolean;
|
|
35
51
|
}>;
|
|
36
52
|
mcp: Array<{
|
|
37
53
|
key: string;
|
|
38
54
|
entry: McpEntry;
|
|
55
|
+
trusted: boolean;
|
|
39
56
|
}>;
|
|
40
57
|
agents: Array<{
|
|
41
58
|
name: string;
|
|
42
59
|
agent: AgentConfig;
|
|
60
|
+
trusted: boolean;
|
|
43
61
|
}>;
|
|
44
62
|
};
|
|
45
63
|
export type ConfigLike = {
|
|
@@ -54,15 +72,16 @@ export type ConfigLike = {
|
|
|
54
72
|
agent?: Record<string, AgentConfig | undefined>;
|
|
55
73
|
};
|
|
56
74
|
export declare function contains(parent: string, child: string): boolean;
|
|
75
|
+
export declare function resolveContained(root: string, candidate: string): string | null;
|
|
57
76
|
export declare function readSkillInfo(dir: string): SkillInfo | null;
|
|
58
77
|
export declare function readPackage(root: string, source: PackageSource, trusted?: boolean): PluginPackage | null;
|
|
59
78
|
export declare function findSkillDirs(root: string, out: Set<string>, seen: Set<string>): void;
|
|
60
79
|
export declare function findPluginRoots(root: string, out: string[]): void;
|
|
61
80
|
export declare function packageFromDir(root: string, source: PackageSource, trusted?: boolean): PluginPackage | null;
|
|
62
|
-
export declare function collectVscodeManifest(out: PluginPackage[], installedJson: string, exclude?: string[]): void;
|
|
63
|
-
export declare function collectVscodeCache(out: PluginPackage[], cacheJson: string, exclude?: string[]): void;
|
|
81
|
+
export declare function collectVscodeManifest(out: PluginPackage[], installedJson: string, exclude?: string[], trusted?: boolean): void;
|
|
82
|
+
export declare function collectVscodeCache(out: PluginPackage[], cacheJson: string, exclude?: string[], trusted?: boolean): void;
|
|
64
83
|
export declare function collectVscode(out: PluginPackage[], extra: string[], exclude?: string[]): void;
|
|
65
|
-
export declare function collectClaudeManifest(out: PluginPackage[], installedJson: string, exclude?: string[]): void;
|
|
84
|
+
export declare function collectClaudeManifest(out: PluginPackage[], installedJson: string, exclude?: string[], trusted?: boolean): void;
|
|
66
85
|
export declare function collectClaude(out: PluginPackage[], exclude?: string[]): void;
|
|
67
86
|
export declare function opencodeCacheRoot(): string;
|
|
68
87
|
export declare function collectOpencodeCache(packagesRoot: string, out: PluginPackage[], exclude?: string[]): void;
|
|
@@ -74,6 +93,9 @@ export declare function planConfig(packages: PluginPackage[], taken?: {
|
|
|
74
93
|
}, enabled?: {
|
|
75
94
|
mcp?: boolean;
|
|
76
95
|
agents?: boolean;
|
|
96
|
+
}, consent?: {
|
|
97
|
+
mcp?: Iterable<string>;
|
|
98
|
+
agents?: Iterable<string>;
|
|
77
99
|
}): ConfigPatch;
|
|
78
100
|
export declare function applyConfigPatch(config: ConfigLike, plan: ConfigPatch, enabled: {
|
|
79
101
|
mcp: boolean;
|
package/dist/discovery.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../src/discovery.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../src/discovery.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;A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