agdex 0.4.2 → 0.5.0

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 (46) hide show
  1. package/README.md +42 -5
  2. package/dist/cli/configurable-select.d.ts +15 -0
  3. package/dist/cli/configurable-select.d.ts.map +1 -0
  4. package/dist/cli/index.js +443 -105
  5. package/dist/{index-4shp3mqh.js → index-974mhezm.js} +413 -60
  6. package/dist/index-g5x6jpyb.js +2304 -0
  7. package/dist/{index-2hm5b6yq.js → index-nn4xptha.js} +29 -13
  8. package/dist/index-pfdh6eyh.js +2241 -0
  9. package/dist/{index-zrmn6fd2.js → index-vf9nfyjb.js} +345 -68
  10. package/dist/{index-pkx4s2ef.js → index-wsqyam11.js} +52 -16
  11. package/dist/index.d.ts +1 -1
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +3 -1
  14. package/dist/lib/agents-md.d.ts +5 -0
  15. package/dist/lib/agents-md.d.ts.map +1 -1
  16. package/dist/lib/providers/cuda-feedstock.d.ts +6 -0
  17. package/dist/lib/providers/cuda-feedstock.d.ts.map +1 -0
  18. package/dist/lib/providers/index.d.ts +3 -0
  19. package/dist/lib/providers/index.d.ts.map +1 -1
  20. package/dist/lib/providers/shadcn-svelte.d.ts +3 -0
  21. package/dist/lib/providers/shadcn-svelte.d.ts.map +1 -0
  22. package/dist/lib/providers/sveltekit.d.ts +3 -0
  23. package/dist/lib/providers/sveltekit.d.ts.map +1 -0
  24. package/dist/lib/skills.d.ts +13 -2
  25. package/dist/lib/skills.d.ts.map +1 -1
  26. package/dist/lib/types.d.ts +18 -3
  27. package/dist/lib/types.d.ts.map +1 -1
  28. package/package.json +1 -1
  29. package/dist/index-57bfejpe.js +0 -1357
  30. package/dist/index-5h59833k.js +0 -1270
  31. package/dist/index-6dj5che8.js +0 -859
  32. package/dist/index-6e18afd7.js +0 -1229
  33. package/dist/index-7adbtddf.js +0 -1123
  34. package/dist/index-9gy9s47s.js +0 -1366
  35. package/dist/index-cfpc7eqp.js +0 -1265
  36. package/dist/index-db6kreh4.js +0 -1188
  37. package/dist/index-exr11by8.js +0 -708
  38. package/dist/index-fxmpwsct.js +0 -779
  39. package/dist/index-gtzz9131.js +0 -708
  40. package/dist/index-hr5jh9yq.js +0 -712
  41. package/dist/index-k299aha0.js +0 -1229
  42. package/dist/index-ntpyfcve.js +0 -1154
  43. package/dist/index-p0xjkwcp.js +0 -1283
  44. package/dist/index-pry8ssn1.js +0 -636
  45. package/dist/index-wgnqr8g3.js +0 -882
  46. package/dist/index-y6zqcrbh.js +0 -788
@@ -351,7 +351,7 @@ async function embed(options) {
351
351
  version,
352
352
  output = "AGENTS.md",
353
353
  docsDir: customDocsDir,
354
- globalCache = false,
354
+ globalCache = true,
355
355
  description
356
356
  } = options;
357
357
  let docsPath;
@@ -380,24 +380,39 @@ async function embed(options) {
380
380
  sizeBefore = Buffer.byteLength(existingContent, "utf-8");
381
381
  isNewFile = false;
382
382
  }
383
- const pullResult = await pullDocs(provider, {
384
- cwd,
385
- version,
386
- docsDir: docsPath
387
- });
388
- if (!pullResult.success) {
389
- return {
390
- success: false,
391
- error: pullResult.error
383
+ const cacheHit = fs.existsSync(docsPath) && fs.readdirSync(docsPath).length > 0;
384
+ let pullResult;
385
+ if (cacheHit) {
386
+ let resolvedVersion = version;
387
+ if (!resolvedVersion && provider.detectVersion) {
388
+ const detected = provider.detectVersion(cwd);
389
+ resolvedVersion = detected.version || undefined;
390
+ }
391
+ pullResult = {
392
+ success: true,
393
+ docsPath,
394
+ version: resolvedVersion
392
395
  };
396
+ } else {
397
+ pullResult = await pullDocs(provider, {
398
+ cwd,
399
+ version,
400
+ docsDir: docsPath
401
+ });
402
+ if (!pullResult.success) {
403
+ return {
404
+ success: false,
405
+ error: pullResult.error
406
+ };
407
+ }
393
408
  }
394
409
  const docFiles = collectDocFiles(docsPath, {
395
410
  extensions: provider.extensions,
396
411
  excludePatterns: provider.excludePatterns
397
412
  });
398
413
  const sections = buildDocTree(docFiles);
399
- const globalFlag = globalCache ? " --global" : "";
400
- const regenerateCommand = `npx agdex --provider ${provider.name} --output ${output}${globalFlag}`;
414
+ const localFlag = !globalCache ? " --local" : "";
415
+ const regenerateCommand = `npx agdex --provider ${provider.name} --output ${output}${localFlag}`;
401
416
  const indexContent = generateIndex({
402
417
  docsPath: docsLinkPath,
403
418
  sections,
@@ -426,7 +441,8 @@ async function embed(options) {
426
441
  sizeBefore,
427
442
  sizeAfter,
428
443
  isNewFile,
429
- gitignoreUpdated
444
+ gitignoreUpdated,
445
+ cacheHit
430
446
  };
431
447
  }
432
448