@serviceme/devtools-core 2.0.0 → 2.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/dist/auth-Bzss8zOv.mjs +995 -0
- package/dist/auth-Bzss8zOv.mjs.map +1 -0
- package/dist/auth-DXam3c4S.js +1078 -0
- package/dist/auth-DXam3c4S.js.map +1 -0
- package/dist/auth.d.mts +2 -2
- package/dist/auth.d.ts +2 -2
- package/dist/auth.js +14 -1029
- package/dist/auth.mjs +2 -991
- package/dist/device-CDDcwDY6.mjs +758 -0
- package/dist/device-CDDcwDY6.mjs.map +1 -0
- package/dist/device-DuAYH8bk.js +839 -0
- package/dist/device-DuAYH8bk.js.map +1 -0
- package/dist/device.d.mts +2 -455
- package/dist/device.d.ts +2 -455
- package/dist/device.js +15 -728
- package/dist/device.mjs +2 -679
- package/dist/index-2rX86yMq.d.mts +331 -0
- package/dist/index-BI11AfMH.d.mts +377 -0
- package/dist/index-BI11AfMH.d.ts +377 -0
- package/dist/index-CoA6y0MP.d.mts +498 -0
- package/dist/index-CoA6y0MP.d.ts +498 -0
- package/dist/index-DaW7IYA-.d.mts +185 -0
- package/dist/index-DaW7IYA-.d.ts +185 -0
- package/dist/index-Dp6FwWKh.d.ts +331 -0
- package/dist/index.d.mts +2340 -2101
- package/dist/index.d.ts +2340 -2101
- package/dist/index.js +8117 -10538
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7895 -10318
- package/dist/index.mjs.map +1 -1
- package/dist/rolldown-runtime-VH7oDXx4.js +28 -0
- package/dist/skill-linker.d.mts +82 -81
- package/dist/skill-linker.d.ts +82 -81
- package/dist/skill-linker.js +359 -402
- package/dist/skill-linker.js.map +1 -1
- package/dist/skill-linker.mjs +345 -357
- package/dist/skill-linker.mjs.map +1 -1
- package/dist/skill-store-Bym2yinU.mjs +388 -0
- package/dist/skill-store-Bym2yinU.mjs.map +1 -0
- package/dist/skill-store-CJdYyyxu.js +408 -0
- package/dist/skill-store-CJdYyyxu.js.map +1 -0
- package/dist/skill-store.d.mts +41 -42
- package/dist/skill-store.d.ts +41 -42
- package/dist/skill-store.js +5 -338
- package/dist/skill-store.mjs +2 -301
- package/dist/submit-Cg7wSa3x.mjs +84 -0
- package/dist/submit-Cg7wSa3x.mjs.map +1 -0
- package/dist/submit-CltE6YOZ.js +98 -0
- package/dist/submit-CltE6YOZ.js.map +1 -0
- package/dist/submit.d.mts +2 -3
- package/dist/submit.d.ts +2 -3
- package/dist/submit.js +4 -166
- package/dist/submit.mjs +2 -130
- package/dist/toolbox-CbfxpNg-.mjs +540 -0
- package/dist/toolbox-CbfxpNg-.mjs.map +1 -0
- package/dist/toolbox-CxnOr-FY.js +614 -0
- package/dist/toolbox-CxnOr-FY.js.map +1 -0
- package/dist/toolbox.d.mts +2 -244
- package/dist/toolbox.d.ts +2 -244
- package/dist/toolbox.js +14 -584
- package/dist/toolbox.mjs +2 -536
- package/dist/{types-B9gk3dXH.d.ts → types-BCV3IedE.d.mts} +25 -23
- package/dist/{types-B9gk3dXH.d.mts → types-BCV3IedE.d.ts} +25 -23
- package/dist/userHome-BquDeFVE.js +526 -0
- package/dist/userHome-BquDeFVE.js.map +1 -0
- package/dist/userHome-CcnAQPG1.mjs +212 -0
- package/dist/userHome-CcnAQPG1.mjs.map +1 -0
- package/package.json +10 -10
- package/dist/auth.js.map +0 -1
- package/dist/auth.mjs.map +0 -1
- package/dist/device.js.map +0 -1
- package/dist/device.mjs.map +0 -1
- package/dist/index-BMk4tqIT.d.mts +0 -328
- package/dist/index-CymN0x9Z.d.ts +0 -328
- package/dist/index-PD135hlB.d.mts +0 -626
- package/dist/index-PD135hlB.d.ts +0 -626
- package/dist/skill-store.js.map +0 -1
- package/dist/skill-store.mjs.map +0 -1
- package/dist/submit.js.map +0 -1
- package/dist/submit.mjs.map +0 -1
- package/dist/toolbox.js.map +0 -1
- package/dist/toolbox.mjs.map +0 -1
package/dist/skill-store.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { a as SkillNotFoundError, i as SkillKind, n as SkillEntry, r as SkillFile, t as SkillDetail } from "./types-BCV3IedE.js";
|
|
2
|
+
//#region src/skill-store/index.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Minimal frontmatter reader — same shape as the extension's
|
|
6
5
|
* `WorkspaceSkillsInitializationService.extractFrontmatter`. We avoid
|
|
@@ -10,44 +9,44 @@ export { c as SkillKind, d as SkillNotFoundError } from './types-B9gk3dXH.js';
|
|
|
10
9
|
* string value — the very common `description: >` form would
|
|
11
10
|
* otherwise surface the bare `>` indicator as the whole description.
|
|
12
11
|
*/
|
|
13
|
-
declare function extractFrontmatter(raw: string): {
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
export declare function extractFrontmatter(raw: string): {
|
|
13
|
+
data: Record<string, unknown>;
|
|
14
|
+
body: string;
|
|
16
15
|
} | null;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
private walkRepo;
|
|
16
|
+
export declare class SkillStore {
|
|
17
|
+
private readonly repoRoots;
|
|
18
|
+
/**
|
|
19
|
+
* Per-instance memo of repo walks. The catalog walk is a recursive
|
|
20
|
+
* readdir over the whole checkout — the dominant cost of every
|
|
21
|
+
* list/get — so results (and the in-flight promise) are reused for
|
|
22
|
+
* the store's lifetime. The handler that owns long-lived stores
|
|
23
|
+
* bounds staleness by rebuilding the store on a short TTL; within
|
|
24
|
+
* one store instance the tree is treated as immutable.
|
|
25
|
+
*/
|
|
26
|
+
private readonly entriesMemo;
|
|
27
|
+
constructor(opts: {
|
|
28
|
+
repos: ReadonlyArray<{
|
|
29
|
+
id: string;
|
|
30
|
+
rootPath: string;
|
|
31
|
+
}>;
|
|
32
|
+
});
|
|
33
|
+
/** All skills + agents across all registered repos. Repos are walked
|
|
34
|
+
* concurrently — one slow checkout no longer stretches the total. */
|
|
35
|
+
listAll(): Promise<SkillEntry[]>;
|
|
36
|
+
/** All skills + agents under a single repo. */
|
|
37
|
+
listByRepo(repoId: string): Promise<SkillEntry[]>;
|
|
38
|
+
/** Single entry detail (manifest + all files inside its dir). */
|
|
39
|
+
get(repoId: string, name: string): Promise<SkillDetail>;
|
|
40
|
+
/** All files inside a single entry's directory (manifest + extras). */
|
|
41
|
+
getFiles(repoId: string, name: string): Promise<SkillFile[]>;
|
|
42
|
+
/**
|
|
43
|
+
* Memoized walk. Sharing the promise collapses concurrent list/get
|
|
44
|
+
* calls over the same repo into a single traversal; a rejected walk
|
|
45
|
+
* is dropped so the next call retries from disk.
|
|
46
|
+
*/
|
|
47
|
+
private listByRepoCached;
|
|
48
|
+
private walkRepo;
|
|
51
49
|
}
|
|
52
|
-
|
|
53
|
-
export { SkillDetail, SkillEntry, SkillFile,
|
|
50
|
+
//#endregion
|
|
51
|
+
export { type SkillDetail, type SkillEntry, type SkillFile, type SkillKind, SkillNotFoundError };
|
|
52
|
+
//# sourceMappingURL=skill-store.d.ts.map
|
package/dist/skill-store.js
CHANGED
|
@@ -1,338 +1,5 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
|
|
30
|
-
// src/skill-store/index.ts
|
|
31
|
-
var skill_store_exports = {};
|
|
32
|
-
__export(skill_store_exports, {
|
|
33
|
-
SkillNotFoundError: () => SkillNotFoundError,
|
|
34
|
-
SkillStore: () => SkillStore,
|
|
35
|
-
extractFrontmatter: () => extractFrontmatter
|
|
36
|
-
});
|
|
37
|
-
module.exports = __toCommonJS(skill_store_exports);
|
|
38
|
-
var fs2 = __toESM(require("fs/promises"));
|
|
39
|
-
var path2 = __toESM(require("path"));
|
|
40
|
-
|
|
41
|
-
// src/repo-layout/index.ts
|
|
42
|
-
var fs = __toESM(require("fs/promises"));
|
|
43
|
-
var path = __toESM(require("path"));
|
|
44
|
-
var MARKER_FILENAME = ".serviceme-repo.json";
|
|
45
|
-
var SUPPORTED_SCHEMA = 1;
|
|
46
|
-
var DEFAULT_REPO_LAYOUT = {
|
|
47
|
-
schema: SUPPORTED_SCHEMA,
|
|
48
|
-
include: [],
|
|
49
|
-
exclude: [],
|
|
50
|
-
treatFilesAsSkills: false
|
|
51
|
-
};
|
|
52
|
-
async function loadRepoLayout(repoRoot) {
|
|
53
|
-
const markerPath = path.join(repoRoot, MARKER_FILENAME);
|
|
54
|
-
let raw;
|
|
55
|
-
try {
|
|
56
|
-
raw = await fs.readFile(markerPath, "utf8");
|
|
57
|
-
} catch {
|
|
58
|
-
return DEFAULT_REPO_LAYOUT;
|
|
59
|
-
}
|
|
60
|
-
let parsed;
|
|
61
|
-
try {
|
|
62
|
-
parsed = JSON.parse(raw);
|
|
63
|
-
} catch {
|
|
64
|
-
return null;
|
|
65
|
-
}
|
|
66
|
-
if (!parsed || typeof parsed !== "object") return null;
|
|
67
|
-
const obj = parsed;
|
|
68
|
-
if (obj.schema !== SUPPORTED_SCHEMA) return null;
|
|
69
|
-
if (!Array.isArray(obj.include) || obj.include.some((s) => typeof s !== "string")) {
|
|
70
|
-
return null;
|
|
71
|
-
}
|
|
72
|
-
if (!Array.isArray(obj.exclude) || obj.exclude.some((s) => typeof s !== "string")) {
|
|
73
|
-
return null;
|
|
74
|
-
}
|
|
75
|
-
if (typeof obj.treatFilesAsSkills !== "boolean") return null;
|
|
76
|
-
return {
|
|
77
|
-
schema: SUPPORTED_SCHEMA,
|
|
78
|
-
include: obj.include,
|
|
79
|
-
exclude: obj.exclude,
|
|
80
|
-
treatFilesAsSkills: obj.treatFilesAsSkills
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// src/skill-store/types.ts
|
|
85
|
-
var SkillNotFoundError = class extends Error {
|
|
86
|
-
constructor(repoId, skillName) {
|
|
87
|
-
super(`skill/agent not found: ${repoId}/${skillName}`);
|
|
88
|
-
this.repoId = repoId;
|
|
89
|
-
this.skillName = skillName;
|
|
90
|
-
this.name = "SkillNotFoundError";
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
// src/skill-store/index.ts
|
|
95
|
-
function extractFrontmatter(raw) {
|
|
96
|
-
if (typeof raw !== "string") return null;
|
|
97
|
-
const match = raw.match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/);
|
|
98
|
-
if (!match) return null;
|
|
99
|
-
const yamlBody = match[1] ?? "";
|
|
100
|
-
const body = match[2] ?? "";
|
|
101
|
-
const data = {};
|
|
102
|
-
const lines = yamlBody.split(/\r?\n/);
|
|
103
|
-
for (let i = 0; i < lines.length; i++) {
|
|
104
|
-
const line = lines[i] ?? "";
|
|
105
|
-
if (line.trim().length === 0) continue;
|
|
106
|
-
if (line.trim().startsWith("#")) continue;
|
|
107
|
-
const kv = line.match(/^([a-zA-Z_][\w-]*)\s*:\s*(.*)$/);
|
|
108
|
-
if (!kv?.[1]) continue;
|
|
109
|
-
let value = (kv[2] ?? "").trim();
|
|
110
|
-
if (typeof value === "string" && /^[>|][+-]?$/.test(value)) {
|
|
111
|
-
const folded = [];
|
|
112
|
-
let j = i + 1;
|
|
113
|
-
for (; j < lines.length; j++) {
|
|
114
|
-
const next = lines[j] ?? "";
|
|
115
|
-
if (next.trim().length === 0) {
|
|
116
|
-
const after = lines[j + 1];
|
|
117
|
-
if (after !== void 0 && /^[ \t]/.test(after)) {
|
|
118
|
-
folded.push("");
|
|
119
|
-
continue;
|
|
120
|
-
}
|
|
121
|
-
break;
|
|
122
|
-
}
|
|
123
|
-
if (!/^[ \t]/.test(next)) break;
|
|
124
|
-
folded.push(next.trim());
|
|
125
|
-
}
|
|
126
|
-
i = j - 1;
|
|
127
|
-
value = folded.join(" ").replace(/\s+/g, " ").trim();
|
|
128
|
-
data[kv[1]] = value;
|
|
129
|
-
continue;
|
|
130
|
-
}
|
|
131
|
-
if (typeof value === "string") {
|
|
132
|
-
if (value.startsWith('"') && value.endsWith('"') || value.startsWith("'") && value.endsWith("'")) {
|
|
133
|
-
value = value.slice(1, -1);
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
data[kv[1]] = value;
|
|
137
|
-
}
|
|
138
|
-
return { data, body };
|
|
139
|
-
}
|
|
140
|
-
var SkillStore = class {
|
|
141
|
-
constructor(opts) {
|
|
142
|
-
/**
|
|
143
|
-
* Per-instance memo of repo walks. The catalog walk is a recursive
|
|
144
|
-
* readdir over the whole checkout — the dominant cost of every
|
|
145
|
-
* list/get — so results (and the in-flight promise) are reused for
|
|
146
|
-
* the store's lifetime. The handler that owns long-lived stores
|
|
147
|
-
* bounds staleness by rebuilding the store on a short TTL; within
|
|
148
|
-
* one store instance the tree is treated as immutable.
|
|
149
|
-
*/
|
|
150
|
-
this.entriesMemo = /* @__PURE__ */ new Map();
|
|
151
|
-
this.repoRoots = /* @__PURE__ */ new Map();
|
|
152
|
-
for (const r of opts.repos) this.repoRoots.set(r.id, r.rootPath);
|
|
153
|
-
}
|
|
154
|
-
/** All skills + agents across all registered repos. Repos are walked
|
|
155
|
-
* concurrently — one slow checkout no longer stretches the total. */
|
|
156
|
-
async listAll() {
|
|
157
|
-
const perRepo = await Promise.all(
|
|
158
|
-
[...this.repoRoots.keys()].map((repoId) => this.listByRepo(repoId))
|
|
159
|
-
);
|
|
160
|
-
return perRepo.flat();
|
|
161
|
-
}
|
|
162
|
-
/** All skills + agents under a single repo. */
|
|
163
|
-
async listByRepo(repoId) {
|
|
164
|
-
const entries = await this.listByRepoCached(repoId);
|
|
165
|
-
return [...entries];
|
|
166
|
-
}
|
|
167
|
-
/** Single entry detail (manifest + all files inside its dir). */
|
|
168
|
-
async get(repoId, name) {
|
|
169
|
-
const entries = await this.listByRepoCached(repoId);
|
|
170
|
-
const found = entries.find((e) => e.name === name);
|
|
171
|
-
if (!found) throw new SkillNotFoundError(repoId, name);
|
|
172
|
-
const files = await collectEntryFiles(found);
|
|
173
|
-
return { ...found, files };
|
|
174
|
-
}
|
|
175
|
-
/** All files inside a single entry's directory (manifest + extras). */
|
|
176
|
-
async getFiles(repoId, name) {
|
|
177
|
-
const entries = await this.listByRepoCached(repoId);
|
|
178
|
-
const found = entries.find((e) => e.name === name);
|
|
179
|
-
if (!found) throw new SkillNotFoundError(repoId, name);
|
|
180
|
-
return collectEntryFiles(found);
|
|
181
|
-
}
|
|
182
|
-
/**
|
|
183
|
-
* Memoized walk. Sharing the promise collapses concurrent list/get
|
|
184
|
-
* calls over the same repo into a single traversal; a rejected walk
|
|
185
|
-
* is dropped so the next call retries from disk.
|
|
186
|
-
*/
|
|
187
|
-
listByRepoCached(repoId) {
|
|
188
|
-
const memoized = this.entriesMemo.get(repoId);
|
|
189
|
-
if (memoized) return memoized;
|
|
190
|
-
const walk = this.walkRepo(repoId).catch((error) => {
|
|
191
|
-
this.entriesMemo.delete(repoId);
|
|
192
|
-
throw error;
|
|
193
|
-
});
|
|
194
|
-
this.entriesMemo.set(repoId, walk);
|
|
195
|
-
return walk;
|
|
196
|
-
}
|
|
197
|
-
async walkRepo(repoId) {
|
|
198
|
-
const root = this.repoRoots.get(repoId);
|
|
199
|
-
if (!root) return [];
|
|
200
|
-
const layout = await loadRepoLayout(root) ?? DEFAULT_REPO_LAYOUT;
|
|
201
|
-
const entries = [];
|
|
202
|
-
await walkForEntries(root, repoId, entries, layout);
|
|
203
|
-
return entries;
|
|
204
|
-
}
|
|
205
|
-
};
|
|
206
|
-
async function collectEntryFiles(found) {
|
|
207
|
-
const out = [];
|
|
208
|
-
if (found.dir === found.manifestPath) {
|
|
209
|
-
const content = await fs2.readFile(found.manifestPath, "utf8");
|
|
210
|
-
return [{ path: path2.basename(found.manifestPath), content }];
|
|
211
|
-
}
|
|
212
|
-
await collectFilesRecursive(found.dir, found.dir, out);
|
|
213
|
-
out.sort((a, b) => {
|
|
214
|
-
const aIsManifest = a.path === "SKILL.md" || a.path === "AGENT.md";
|
|
215
|
-
const bIsManifest = b.path === "SKILL.md" || b.path === "AGENT.md";
|
|
216
|
-
if (aIsManifest && !bIsManifest) return -1;
|
|
217
|
-
if (bIsManifest && !aIsManifest) return 1;
|
|
218
|
-
return a.path.localeCompare(b.path);
|
|
219
|
-
});
|
|
220
|
-
return out;
|
|
221
|
-
}
|
|
222
|
-
var SKIP_DIRS = /* @__PURE__ */ new Set([".git", "node_modules", ".vscode", "dist", "build", "out"]);
|
|
223
|
-
var SKIP_TOP_LEVEL_SCAN_DIRS = /* @__PURE__ */ new Set([...SKIP_DIRS, "plugins"]);
|
|
224
|
-
var FLAT_AGENT_FILE_SUFFIX = ".agent.md";
|
|
225
|
-
async function walkForEntries(rootDir, repoId, out, layout = DEFAULT_REPO_LAYOUT) {
|
|
226
|
-
let dirents;
|
|
227
|
-
try {
|
|
228
|
-
dirents = await fs2.readdir(rootDir, { withFileTypes: true });
|
|
229
|
-
} catch {
|
|
230
|
-
return;
|
|
231
|
-
}
|
|
232
|
-
for (const d of dirents) {
|
|
233
|
-
if (d.isFile() && d.name.endsWith(FLAT_AGENT_FILE_SUFFIX)) {
|
|
234
|
-
const filePath = path2.join(rootDir, d.name);
|
|
235
|
-
const stat2 = await fs2.stat(filePath);
|
|
236
|
-
const content = await fs2.readFile(filePath, "utf8");
|
|
237
|
-
const parsed = extractFrontmatter(content);
|
|
238
|
-
out.push({
|
|
239
|
-
repoId,
|
|
240
|
-
name: d.name.slice(0, -FLAT_AGENT_FILE_SUFFIX.length),
|
|
241
|
-
kind: "agent",
|
|
242
|
-
manifestPath: filePath,
|
|
243
|
-
// Sentinel: `dir === manifestPath` marks a flat single-file
|
|
244
|
-
// entry (no directory of its own — see getFiles()).
|
|
245
|
-
dir: filePath,
|
|
246
|
-
frontmatter: parsed?.data ?? {},
|
|
247
|
-
modifiedAt: stat2.mtime.toISOString()
|
|
248
|
-
});
|
|
249
|
-
continue;
|
|
250
|
-
}
|
|
251
|
-
if (!d.isDirectory()) continue;
|
|
252
|
-
if (SKIP_TOP_LEVEL_SCAN_DIRS.has(d.name)) continue;
|
|
253
|
-
if (layout.exclude.includes(d.name)) continue;
|
|
254
|
-
const childDir = path2.join(rootDir, d.name);
|
|
255
|
-
const kind = await detectKind(childDir);
|
|
256
|
-
if (kind) {
|
|
257
|
-
const manifestFilename = kind === "skill" ? "SKILL.md" : "AGENT.md";
|
|
258
|
-
const manifestPath = path2.join(childDir, manifestFilename);
|
|
259
|
-
const stat2 = await fs2.stat(manifestPath);
|
|
260
|
-
const content = await fs2.readFile(manifestPath, "utf8");
|
|
261
|
-
const parsed = extractFrontmatter(content);
|
|
262
|
-
out.push({
|
|
263
|
-
repoId,
|
|
264
|
-
name: d.name,
|
|
265
|
-
kind,
|
|
266
|
-
manifestPath,
|
|
267
|
-
dir: childDir,
|
|
268
|
-
frontmatter: parsed?.data ?? {},
|
|
269
|
-
modifiedAt: stat2.mtime.toISOString()
|
|
270
|
-
});
|
|
271
|
-
continue;
|
|
272
|
-
}
|
|
273
|
-
await walkForEntries(childDir, repoId, out, layout);
|
|
274
|
-
if (layout.treatFilesAsSkills && layout.include.includes(d.name)) {
|
|
275
|
-
await surfaceFilesAsSkills(childDir, d.name, repoId, out);
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
async function surfaceFilesAsSkills(absDir, relName, repoId, out) {
|
|
280
|
-
let dirents;
|
|
281
|
-
try {
|
|
282
|
-
dirents = await fs2.readdir(absDir, { withFileTypes: true });
|
|
283
|
-
} catch {
|
|
284
|
-
return;
|
|
285
|
-
}
|
|
286
|
-
for (const d of dirents) {
|
|
287
|
-
if (!d.isFile()) continue;
|
|
288
|
-
if (!d.name.endsWith(".md")) continue;
|
|
289
|
-
const filePath = path2.join(absDir, d.name);
|
|
290
|
-
const stat2 = await fs2.stat(filePath);
|
|
291
|
-
const content = await fs2.readFile(filePath, "utf8");
|
|
292
|
-
const parsed = extractFrontmatter(content);
|
|
293
|
-
const entryName = `${relName}/${d.name.replace(/\.md$/, "")}`;
|
|
294
|
-
out.push({
|
|
295
|
-
repoId,
|
|
296
|
-
name: entryName,
|
|
297
|
-
kind: "skill",
|
|
298
|
-
manifestPath: filePath,
|
|
299
|
-
dir: absDir,
|
|
300
|
-
frontmatter: parsed?.data ?? {},
|
|
301
|
-
modifiedAt: stat2.mtime.toISOString()
|
|
302
|
-
});
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
async function detectKind(dir) {
|
|
306
|
-
const [hasSkill, hasAgent] = await Promise.all([
|
|
307
|
-
fs2.access(path2.join(dir, "SKILL.md")).then(() => true).catch(() => false),
|
|
308
|
-
fs2.access(path2.join(dir, "AGENT.md")).then(() => true).catch(() => false)
|
|
309
|
-
]);
|
|
310
|
-
if (hasSkill) return "skill";
|
|
311
|
-
if (hasAgent) return "agent";
|
|
312
|
-
return null;
|
|
313
|
-
}
|
|
314
|
-
async function collectFilesRecursive(absDir, entryRoot, out) {
|
|
315
|
-
let dirents;
|
|
316
|
-
try {
|
|
317
|
-
dirents = await fs2.readdir(absDir, { withFileTypes: true });
|
|
318
|
-
} catch {
|
|
319
|
-
return;
|
|
320
|
-
}
|
|
321
|
-
for (const d of dirents) {
|
|
322
|
-
if (SKIP_DIRS.has(d.name)) continue;
|
|
323
|
-
const full = path2.join(absDir, d.name);
|
|
324
|
-
if (d.isDirectory()) {
|
|
325
|
-
await collectFilesRecursive(full, entryRoot, out);
|
|
326
|
-
} else if (d.isFile()) {
|
|
327
|
-
const content = await fs2.readFile(full, "utf8");
|
|
328
|
-
out.push({ path: path2.relative(entryRoot, full), content });
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
333
|
-
0 && (module.exports = {
|
|
334
|
-
SkillNotFoundError,
|
|
335
|
-
SkillStore,
|
|
336
|
-
extractFrontmatter
|
|
337
|
-
});
|
|
338
|
-
//# sourceMappingURL=skill-store.js.map
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_skill_store = require("./skill-store-CJdYyyxu.js");
|
|
3
|
+
exports.SkillNotFoundError = require_skill_store.SkillNotFoundError;
|
|
4
|
+
exports.SkillStore = require_skill_store.SkillStore;
|
|
5
|
+
exports.extractFrontmatter = require_skill_store.extractFrontmatter;
|