skillex 0.3.1 → 0.4.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.
Files changed (51) hide show
  1. package/CHANGELOG.md +286 -1
  2. package/README.md +82 -16
  3. package/dist/auto-sync.d.ts +66 -0
  4. package/dist/auto-sync.js +91 -0
  5. package/dist/catalog.js +5 -29
  6. package/dist/cli.d.ts +13 -0
  7. package/dist/cli.js +266 -144
  8. package/dist/confirm.js +3 -1
  9. package/dist/direct-github.d.ts +60 -0
  10. package/dist/direct-github.js +177 -0
  11. package/dist/doctor.d.ts +31 -0
  12. package/dist/doctor.js +172 -0
  13. package/dist/downloader.d.ts +42 -0
  14. package/dist/downloader.js +41 -0
  15. package/dist/fs.d.ts +21 -1
  16. package/dist/fs.js +30 -3
  17. package/dist/http.d.ts +28 -7
  18. package/dist/http.js +143 -42
  19. package/dist/install.d.ts +23 -9
  20. package/dist/install.js +75 -348
  21. package/dist/lockfile.d.ts +46 -0
  22. package/dist/lockfile.js +169 -0
  23. package/dist/output.d.ts +11 -0
  24. package/dist/output.js +49 -0
  25. package/dist/recommended.d.ts +13 -0
  26. package/dist/recommended.js +21 -0
  27. package/dist/runner.js +9 -9
  28. package/dist/skill.d.ts +2 -0
  29. package/dist/skill.js +3 -0
  30. package/dist/sync.js +12 -9
  31. package/dist/types.d.ts +39 -0
  32. package/dist/types.js +28 -0
  33. package/dist/ui.js +1 -1
  34. package/dist/user-config.d.ts +5 -0
  35. package/dist/user-config.js +22 -1
  36. package/dist/web-ui.js +5 -0
  37. package/dist-ui/assets/CatalogPage-CKEfRSvG.js +1 -0
  38. package/dist-ui/assets/CatalogPage-W5MqylAz.css +1 -0
  39. package/dist-ui/assets/DoctorPage-C92pEVl_.js +1 -0
  40. package/dist-ui/assets/Skeleton-BISmLuhY.js +1 -0
  41. package/dist-ui/assets/Skeleton-_Ooiw1nN.css +1 -0
  42. package/dist-ui/assets/SkillDetailPage-CBAaWpcc.css +1 -0
  43. package/dist-ui/assets/SkillDetailPage-CWGjTH2M.js +1 -0
  44. package/dist-ui/assets/{index-UBECch6X.css → index-CWm7zQTg.css} +1 -1
  45. package/dist-ui/assets/index-DAVP4Xp_.js +26 -0
  46. package/dist-ui/assets/recommended-D_i10hwH.js +1 -0
  47. package/dist-ui/index.html +2 -2
  48. package/package.json +6 -2
  49. package/dist-ui/assets/CatalogPage-B_qic36n.js +0 -1
  50. package/dist-ui/assets/SkillDetailPage-BJ3onKk4.js +0 -1
  51. package/dist-ui/assets/index-DN-z--cR.js +0 -25
package/dist/catalog.js CHANGED
@@ -6,6 +6,7 @@ import { normalizeAdapterList } from "./adapters.js";
6
6
  import { assertSafeRelativePath } from "./fs.js";
7
7
  import { fetchJson, fetchOptionalJson, fetchText } from "./http.js";
8
8
  import { debug } from "./output.js";
9
+ import { parseSkillFrontmatter } from "./skill.js";
9
10
  import { CatalogError } from "./types.js";
10
11
  const CACHE_TTL_MS = 5 * 60 * 1000; // 5 minutes
11
12
  /**
@@ -210,13 +211,14 @@ async function loadCatalogFromTree(source) {
210
211
  const skillPath = skillFile.path.slice(0, -"/SKILL.md".length);
211
212
  const skillId = skillPath.split("/").pop();
212
213
  const skillBody = await fetchJsonLikeText(buildRawGitHubUrl(source.repo, source.ref, skillFile.path));
213
- const metadata = extractSkillMetadata(skillBody);
214
+ const metadata = parseSkillFrontmatter(skillBody);
214
215
  return normalizeSkill({
215
216
  id: skillId,
216
217
  path: skillPath,
217
218
  name: metadata.name || skillId,
218
219
  description: metadata.description || "",
219
220
  files: collectFilesUnderPath(files, skillPath),
221
+ ...(metadata.category ? { category: metadata.category } : {}),
220
222
  }, source);
221
223
  }));
222
224
  return {
@@ -229,34 +231,6 @@ async function loadCatalogFromTree(source) {
229
231
  async function fetchJsonLikeText(url) {
230
232
  return fetchText(url, { headers: { Accept: "text/plain" } });
231
233
  }
232
- function extractSkillMetadata(content) {
233
- const match = content.match(/^---\s*\n([\s\S]*?)\n---/);
234
- if (!match) {
235
- return {};
236
- }
237
- const frontmatter = match[1];
238
- if (frontmatter === undefined) {
239
- return {};
240
- }
241
- const name = extractFrontmatterValue(frontmatter, "name");
242
- const description = extractFrontmatterValue(frontmatter, "description");
243
- return {
244
- ...(name !== null ? { name } : {}),
245
- ...(description !== null ? { description } : {}),
246
- };
247
- }
248
- function extractFrontmatterValue(frontmatter, key) {
249
- const expression = new RegExp(`^${key}:\\s*(.+)$`, "m");
250
- const match = frontmatter.match(expression);
251
- if (!match) {
252
- return null;
253
- }
254
- const value = match[1];
255
- if (value === undefined) {
256
- return null;
257
- }
258
- return value.trim().replace(/^["']|["']$/g, "");
259
- }
260
234
  function collectFilesUnderPath(treeFiles, skillPath) {
261
235
  return treeFiles
262
236
  .filter((item) => item.type === "blob" && item.path.startsWith(`${skillPath}/`))
@@ -303,6 +277,7 @@ function normalizeSkill(skill, source) {
303
277
  const skillPath = skill.path || `${source.skillsDir}/${id}`;
304
278
  const files = Array.isArray(skill.files) ? skill.files.map(assertSafeRelativePath) : ["SKILL.md"];
305
279
  const uniqueFiles = [...new Set(files)];
280
+ const category = typeof skill.category === "string" && skill.category.trim() ? skill.category.trim() : undefined;
306
281
  return {
307
282
  id,
308
283
  name: skill.name || id,
@@ -314,6 +289,7 @@ function normalizeSkill(skill, source) {
314
289
  entry: skill.entry || "SKILL.md",
315
290
  path: stripLeadingSlash(skillPath),
316
291
  files: uniqueFiles,
292
+ ...(category !== undefined ? { category } : {}),
317
293
  };
318
294
  }
319
295
  /**
package/dist/cli.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { ParsedArgs } from "./types.js";
1
2
  /**
2
3
  * Runs the Skillex CLI entrypoint.
3
4
  *
@@ -6,3 +7,15 @@
6
7
  */
7
8
  export declare function main(argv: string[]): Promise<void>;
8
9
  export declare function resolveCommandRoute(command: string | undefined): string;
10
+ /**
11
+ * Parses argv into a typed `ParsedArgs` shape with strict validation:
12
+ *
13
+ * - Unknown flags raise `UNKNOWN_FLAG` with a "did you mean" suggestion.
14
+ * - Boolean flags (`BOOLEAN_FLAGS`) accept presence-only or `--flag=value` forms.
15
+ * - String flags (`STRING_FLAGS`) require a value via `--flag=value` or
16
+ * `--flag value`. Missing values raise `MISSING_FLAG_VALUE`.
17
+ * - The literal `--` token marks end-of-options; remaining tokens become
18
+ * `positionalAfter` and are forwarded to handlers (used by `run` to pass
19
+ * arguments to the underlying script without flag interpretation).
20
+ */
21
+ export declare function parseArgs(argv: string[]): ParsedArgs;