skild 0.10.3 → 0.10.5

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 (2) hide show
  1. package/dist/index.js +65 -48
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -580,6 +580,17 @@ function discoverSkillDirsWithHeuristics(rootDir, options) {
580
580
  path.join(".windsurf", "skills"),
581
581
  path.join(".github", "skills")
582
582
  ];
583
+ const results = [];
584
+ const seen = /* @__PURE__ */ new Set();
585
+ const addResults = (entries, prefix) => {
586
+ for (const entry of entries) {
587
+ const absKey = path.resolve(entry.absDir);
588
+ if (seen.has(absKey)) continue;
589
+ seen.add(absKey);
590
+ const relPath = prefix ? normalizeRelPath(path.join(prefix, entry.relPath)) : normalizeRelPath(entry.relPath);
591
+ results.push({ relPath, absDir: entry.absDir });
592
+ }
593
+ };
583
594
  for (const rel of candidates) {
584
595
  const candidateDir = path.join(root, rel);
585
596
  if (!fs.existsSync(candidateDir)) continue;
@@ -588,13 +599,12 @@ function discoverSkillDirsWithHeuristics(rootDir, options) {
588
599
  } catch {
589
600
  continue;
590
601
  }
591
- const found = discoverSkillDirs(candidateDir, options).map((s) => ({
592
- relPath: normalizeRelPath(path.join(rel, s.relPath)),
593
- absDir: s.absDir
594
- }));
595
- if (found.length) return found;
602
+ const found = discoverSkillDirs(candidateDir, options);
603
+ addResults(found, rel);
596
604
  }
597
- return discoverSkillDirs(root, options);
605
+ const fullScan = discoverSkillDirs(root, options);
606
+ addResults(fullScan);
607
+ return results;
598
608
  }
599
609
 
600
610
  // src/commands/markdown-discovery.ts
@@ -1296,8 +1306,8 @@ async function discoverSkills(ctx) {
1296
1306
  const maybeLocalRoot = path3.resolve(resolvedSource);
1297
1307
  const isLocal = fs3.existsSync(maybeLocalRoot);
1298
1308
  if (isLocal) {
1299
- const hasSkillMd2 = fs3.existsSync(path3.join(maybeLocalRoot, "SKILL.md"));
1300
- if (hasSkillMd2) {
1309
+ const hasSkillMd = fs3.existsSync(path3.join(maybeLocalRoot, "SKILL.md"));
1310
+ if (hasSkillMd) {
1301
1311
  const metadata = readSkillMetadata(maybeLocalRoot);
1302
1312
  ctx.isSingleSkill = true;
1303
1313
  ctx.selectedSkills = [{
@@ -1308,26 +1318,57 @@ async function discoverSkills(ctx) {
1308
1318
  }];
1309
1319
  return true;
1310
1320
  }
1311
- const discovered2 = discoverSkillDirsWithHeuristics(maybeLocalRoot, { maxDepth: scanDepth, maxSkills });
1312
- if (discovered2.length === 0) {
1313
- const message = `No SKILL.md found at ${maybeLocalRoot} (or within subdirectories).`;
1321
+ const discovered = discoverSkillDirsWithHeuristics(maybeLocalRoot, { maxDepth: scanDepth, maxSkills });
1322
+ if (discovered.length === 0) {
1323
+ const message2 = `No SKILL.md found at ${maybeLocalRoot} (or within subdirectories).`;
1314
1324
  if (jsonOnly) {
1315
- printJson({ ok: false, error: "SKILL_MD_NOT_FOUND", message, source: ctx.source, resolvedSource });
1325
+ printJson({ ok: false, error: "SKILL_MD_NOT_FOUND", message: message2, source: ctx.source, resolvedSource });
1316
1326
  } else {
1317
1327
  if (ctx.spinner) ctx.spinner.stop();
1318
- console.error(chalk3.red(message));
1328
+ console.error(chalk3.red(message2));
1319
1329
  }
1320
1330
  process.exitCode = 1;
1321
1331
  return false;
1322
1332
  }
1323
1333
  ctx.discoveredSkills = asDiscoveredSkills(
1324
- discovered2,
1334
+ discovered,
1325
1335
  (d) => path3.join(maybeLocalRoot, d.relPath),
1326
1336
  void 0,
1327
1337
  (d) => d.absDir
1328
1338
  );
1329
1339
  return true;
1330
1340
  }
1341
+ let materializeError = null;
1342
+ try {
1343
+ const materialized = await materializeSourceToTemp2(resolvedSource);
1344
+ ctx.materializedDir = materialized.dir;
1345
+ ctx.cleanupMaterialized = appendCleanup(ctx.cleanupMaterialized, materialized.cleanup);
1346
+ const hasSkillMd = fs3.existsSync(path3.join(ctx.materializedDir, "SKILL.md"));
1347
+ if (hasSkillMd) {
1348
+ const metadata = readSkillMetadata(ctx.materializedDir);
1349
+ ctx.isSingleSkill = true;
1350
+ ctx.selectedSkills = [{
1351
+ relPath: ".",
1352
+ suggestedSource: resolvedSource,
1353
+ materializedDir: ctx.materializedDir,
1354
+ displayName: metadata?.name,
1355
+ description: metadata?.description
1356
+ }];
1357
+ return true;
1358
+ }
1359
+ const discovered = discoverSkillDirsWithHeuristics(ctx.materializedDir, { maxDepth: scanDepth, maxSkills });
1360
+ if (discovered.length > 0) {
1361
+ ctx.discoveredSkills = asDiscoveredSkills(
1362
+ discovered,
1363
+ (d) => deriveChildSource2(resolvedSource, d.relPath),
1364
+ (d) => d.absDir,
1365
+ (d) => d.absDir
1366
+ );
1367
+ return true;
1368
+ }
1369
+ } catch (error) {
1370
+ materializeError = error;
1371
+ }
1331
1372
  const markdownResult = await discoverMarkdownSkillsFromSource({
1332
1373
  source: resolvedSource,
1333
1374
  maxDocDepth: markdownDepth,
@@ -1349,41 +1390,15 @@ async function discoverSkills(ctx) {
1349
1390
  ctx.cleanupMaterialized = appendCleanup(ctx.cleanupMaterialized, markdownResult.cleanup);
1350
1391
  return true;
1351
1392
  }
1352
- const materialized = await materializeSourceToTemp2(resolvedSource);
1353
- ctx.materializedDir = materialized.dir;
1354
- ctx.cleanupMaterialized = appendCleanup(ctx.cleanupMaterialized, materialized.cleanup);
1355
- const hasSkillMd = fs3.existsSync(path3.join(ctx.materializedDir, "SKILL.md"));
1356
- if (hasSkillMd) {
1357
- const metadata = readSkillMetadata(ctx.materializedDir);
1358
- ctx.isSingleSkill = true;
1359
- ctx.selectedSkills = [{
1360
- relPath: ".",
1361
- suggestedSource: resolvedSource,
1362
- materializedDir: ctx.materializedDir,
1363
- displayName: metadata?.name,
1364
- description: metadata?.description
1365
- }];
1366
- return true;
1367
- }
1368
- const discovered = discoverSkillDirsWithHeuristics(ctx.materializedDir, { maxDepth: scanDepth, maxSkills });
1369
- if (discovered.length === 0) {
1370
- const message = `No SKILL.md found in source "${resolvedSource}".`;
1371
- if (jsonOnly) {
1372
- printJson({ ok: false, error: "SKILL_MD_NOT_FOUND", message, source: ctx.source, resolvedSource });
1373
- } else {
1374
- if (ctx.spinner) ctx.spinner.stop();
1375
- console.error(chalk3.red(message));
1376
- }
1377
- process.exitCode = 1;
1378
- return false;
1393
+ const message = `No SKILL.md found in source "${resolvedSource}".` + (materializeError ? " (materialize failed, markdown fallback empty)" : "");
1394
+ if (jsonOnly) {
1395
+ printJson({ ok: false, error: "SKILL_MD_NOT_FOUND", message, source: ctx.source, resolvedSource });
1396
+ } else {
1397
+ if (ctx.spinner) ctx.spinner.stop();
1398
+ console.error(chalk3.red(message));
1379
1399
  }
1380
- ctx.discoveredSkills = asDiscoveredSkills(
1381
- discovered,
1382
- (d) => deriveChildSource2(resolvedSource, d.relPath),
1383
- (d) => d.absDir,
1384
- (d) => d.absDir
1385
- );
1386
- return true;
1400
+ process.exitCode = 1;
1401
+ return false;
1387
1402
  } catch (error) {
1388
1403
  const message = error instanceof SkildError ? error.message : error instanceof Error ? error.message : String(error);
1389
1404
  if (jsonOnly) printJson({ ok: false, error: message });
@@ -1663,6 +1678,8 @@ async function install(source, options = {}) {
1663
1678
  }
1664
1679
  }
1665
1680
  async function reportDownload(record, registryOverride) {
1681
+ const enableStats = process.env.SKILD_ENABLE_STATS === "1" || process.env.SKILD_ENABLE_DOWNLOAD_STATS === "1" || process.env.SKILD_ENABLE_TELEMETRY === "1";
1682
+ if (!enableStats) return;
1666
1683
  try {
1667
1684
  if (record.sourceType === "local") return;
1668
1685
  const registryUrl = resolveRegistryUrl(record.registryUrl || registryOverride);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skild",
3
- "version": "0.10.3",
3
+ "version": "0.10.5",
4
4
  "description": "The npm for Agent Skills — Discover, install, manage, and publish AI Agent Skills with ease.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",