@agntn/registries 0.2.0 → 0.3.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 (113) hide show
  1. package/README.md +26 -3
  2. package/dist/THIRD-PARTY-LICENSES.md +36 -0
  3. package/dist/_chunks/cache.mjs +15 -0
  4. package/dist/{cache/index.mjs.map → _chunks/cache.mjs.map} +1 -1
  5. package/dist/{commands/cache.mjs → _chunks/cache2.mjs} +6 -8
  6. package/dist/_chunks/cache2.mjs.map +1 -0
  7. package/dist/{cache → _chunks}/cached-registry.mjs +12 -8
  8. package/dist/_chunks/cached-registry.mjs.map +1 -0
  9. package/dist/{commands → _chunks}/deps.mjs +20 -14
  10. package/dist/_chunks/deps.mjs.map +1 -0
  11. package/dist/_chunks/helpers.mjs +53 -19
  12. package/dist/_chunks/helpers.mjs.map +1 -1
  13. package/dist/_chunks/index.d.mts +9 -23
  14. package/dist/_chunks/index.d.mts.map +1 -1
  15. package/dist/_chunks/index2.d.mts +156 -25
  16. package/dist/_chunks/index2.d.mts.map +1 -1
  17. package/dist/_chunks/index3.d.mts +173 -3
  18. package/dist/_chunks/index3.d.mts.map +1 -1
  19. package/dist/_chunks/info.mjs +105 -0
  20. package/dist/_chunks/info.mjs.map +1 -0
  21. package/dist/_chunks/libs/typebox.mjs +278 -0
  22. package/dist/_chunks/libs/typebox.mjs.map +1 -0
  23. package/dist/_chunks/lockfile.mjs +183 -0
  24. package/dist/_chunks/lockfile.mjs.map +1 -0
  25. package/dist/_chunks/maintainers.mjs +53 -0
  26. package/dist/_chunks/maintainers.mjs.map +1 -0
  27. package/dist/_chunks/mcp.mjs +15 -0
  28. package/dist/_chunks/mcp.mjs.map +1 -0
  29. package/dist/_chunks/registries.mjs +514 -245
  30. package/dist/_chunks/registries.mjs.map +1 -1
  31. package/dist/_chunks/registry.d.mts +121 -10
  32. package/dist/_chunks/registry.d.mts.map +1 -1
  33. package/dist/_chunks/registry.mjs +121 -31
  34. package/dist/_chunks/registry.mjs.map +1 -1
  35. package/dist/{commands → _chunks}/shared.mjs +15 -8
  36. package/dist/_chunks/shared.mjs.map +1 -0
  37. package/dist/_chunks/tool-operations.mjs +63 -0
  38. package/dist/_chunks/tool-operations.mjs.map +1 -0
  39. package/dist/_chunks/version.mjs +4 -0
  40. package/dist/_chunks/version.mjs.map +1 -0
  41. package/dist/{commands → _chunks}/versions.mjs +10 -9
  42. package/dist/_chunks/versions.mjs.map +1 -0
  43. package/dist/ai.d.mts +2 -8
  44. package/dist/ai.d.mts.map +1 -1
  45. package/dist/ai.mjs +0 -1
  46. package/dist/ai.mjs.map +1 -1
  47. package/dist/cache/index.d.mts +1 -6
  48. package/dist/cache/index.mjs +4 -11
  49. package/dist/cli.mjs +9 -7
  50. package/dist/cli.mjs.map +1 -1
  51. package/dist/index.d.mts +3 -9
  52. package/dist/index.mjs +4 -7
  53. package/dist/mcp.d.mts +7 -0
  54. package/dist/mcp.d.mts.map +1 -0
  55. package/dist/mcp.mjs +155 -0
  56. package/dist/mcp.mjs.map +1 -0
  57. package/dist/registries/index.d.mts +0 -1
  58. package/dist/registries/index.mjs +0 -1
  59. package/dist/tool-operations.d.mts +36 -0
  60. package/dist/tool-operations.d.mts.map +1 -0
  61. package/dist/tool-operations.mjs +5 -0
  62. package/package.json +55 -9
  63. package/packages/omp/extensions/registries.ts +112 -0
  64. package/packages/pi/extensions/registries.ts +125 -0
  65. package/dist/_chunks/cached-registry.d.mts +0 -35
  66. package/dist/_chunks/cached-registry.d.mts.map +0 -1
  67. package/dist/_chunks/errors.d.mts +0 -90
  68. package/dist/_chunks/errors.d.mts.map +0 -1
  69. package/dist/_chunks/lockfile.d.mts +0 -50
  70. package/dist/_chunks/lockfile.d.mts.map +0 -1
  71. package/dist/_chunks/paths.d.mts +0 -11
  72. package/dist/_chunks/paths.d.mts.map +0 -1
  73. package/dist/_chunks/purl.mjs +0 -192
  74. package/dist/_chunks/purl.mjs.map +0 -1
  75. package/dist/_chunks/storage.d.mts +0 -22
  76. package/dist/_chunks/storage.d.mts.map +0 -1
  77. package/dist/_chunks/types.d.mts +0 -73
  78. package/dist/_chunks/types.d.mts.map +0 -1
  79. package/dist/cache/cached-registry.d.mts +0 -4
  80. package/dist/cache/cached-registry.mjs.map +0 -1
  81. package/dist/cache/lockfile.d.mts +0 -2
  82. package/dist/cache/lockfile.mjs +0 -68
  83. package/dist/cache/lockfile.mjs.map +0 -1
  84. package/dist/cache/paths.d.mts +0 -2
  85. package/dist/cache/paths.mjs +0 -26
  86. package/dist/cache/paths.mjs.map +0 -1
  87. package/dist/cache/storage.d.mts +0 -2
  88. package/dist/cache/storage.mjs +0 -40
  89. package/dist/cache/storage.mjs.map +0 -1
  90. package/dist/commands/cache.d.mts +0 -7
  91. package/dist/commands/cache.d.mts.map +0 -1
  92. package/dist/commands/cache.mjs.map +0 -1
  93. package/dist/commands/deps.d.mts +0 -23
  94. package/dist/commands/deps.d.mts.map +0 -1
  95. package/dist/commands/deps.mjs.map +0 -1
  96. package/dist/commands/info.d.mts +0 -26
  97. package/dist/commands/info.d.mts.map +0 -1
  98. package/dist/commands/info.mjs +0 -54
  99. package/dist/commands/info.mjs.map +0 -1
  100. package/dist/commands/maintainers.d.mts +0 -23
  101. package/dist/commands/maintainers.d.mts.map +0 -1
  102. package/dist/commands/maintainers.mjs +0 -46
  103. package/dist/commands/maintainers.mjs.map +0 -1
  104. package/dist/commands/shared.d.mts +0 -27
  105. package/dist/commands/shared.d.mts.map +0 -1
  106. package/dist/commands/shared.mjs.map +0 -1
  107. package/dist/commands/versions.d.mts +0 -31
  108. package/dist/commands/versions.d.mts.map +0 -1
  109. package/dist/commands/versions.mjs.map +0 -1
  110. package/dist/core/index.d.mts +0 -4
  111. package/dist/core/index.mjs +0 -3
  112. package/dist/types.d.mts +0 -3
  113. package/dist/types.mjs +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"shared.mjs","names":[],"sources":["../../src/commands/shared.ts"],"sourcesContent":["import consola from \"consola\";\nimport { createFromPURL, parsePURL, fullName } from \"../core/purl.ts\";\nimport { create, ecosystems, type Registry } from \"../core/registry.ts\";\nimport {\n HTTPError,\n NotFoundError,\n RateLimitError,\n UnknownEcosystemError,\n InvalidPURLError,\n} from \"../core/errors.ts\";\nimport { CachedRegistry } from \"../cache/cached-registry.ts\";\nimport \"../registries/index.ts\";\n\nexport const sharedArgs = {\n json: {\n type: \"boolean\" as const,\n description: \"Output as JSON\",\n default: false,\n },\n \"no-cache\": {\n type: \"boolean\" as const,\n description: \"Bypass cache, fetch fresh data\",\n default: false,\n },\n} as const;\n\n/**\n * Resolve a PURL string or shorthand into [registry, name, version].\n * Uses CachedRegistry unless --no-cache is set.\n */\nexport function resolvePURL(input: string, useCache = true): [Registry, string, string] {\n let purl = input;\n if (!purl.startsWith(\"pkg:\")) {\n purl = `pkg:${purl}`;\n }\n\n if (useCache) {\n const parsed = parsePURL(purl);\n const baseURL = parsed.qualifiers[\"repository_url\"] ?? \"\";\n const inner = create(parsed.type, baseURL || undefined);\n const reg = new CachedRegistry(inner);\n return [reg, fullName(parsed), parsed.version];\n }\n\n return createFromPURL(purl);\n}\n\n/** Run a command with standard error handling. */\nexport async function withErrorHandling(fn: () => Promise<void>): Promise<void> {\n try {\n await fn();\n } catch (error) {\n if (error instanceof NotFoundError) {\n consola.error(\n `Package not found: ${error.ecosystem}/${error.packageName}${error.version ? `@${error.version}` : \"\"}`,\n );\n return process.exit(1);\n }\n if (error instanceof UnknownEcosystemError) {\n consola.error(`Unknown ecosystem: ${error.ecosystem}`);\n consola.info(`Supported: ${ecosystems().join(\", \")}`);\n return process.exit(1);\n }\n if (error instanceof InvalidPURLError) {\n consola.error(`Invalid PURL: ${error.purl}`);\n consola.info(\"Examples: pkg:npm/lodash, npm/lodash@4.17.21, pkg:cargo/serde\");\n return process.exit(1);\n }\n if (error instanceof RateLimitError) {\n consola.error(`Rate limited by registry. Retry after ${error.retryAfter}s`);\n return process.exit(1);\n }\n if (error instanceof HTTPError) {\n consola.error(`Registry request failed: HTTP ${error.statusCode} (${error.url})`);\n if (error.isServerError()) {\n consola.info(\"The registry may be temporarily unavailable. Try again later.\");\n }\n return process.exit(1);\n }\n throw error;\n }\n}\n"],"mappings":";;;;;AAaA,MAAa,aAAa;CACxB,MAAM;EACJ,MAAM;EACN,aAAa;EACb,SAAS;EACV;CACD,YAAY;EACV,MAAM;EACN,aAAa;EACb,SAAS;;CAEZ;;;;;AAMD,SAAgB,YAAY,OAAe,WAAW,MAAkC;CACtF,IAAI,OAAO;AACX,KAAI,CAAC,KAAK,WAAW,OAAO,CAC1B,QAAO,OAAO;AAGhB,KAAI,UAAU;EACZ,MAAM,SAAS,UAAU,KAAK;EAC9B,MAAM,UAAU,OAAO,WAAW,qBAAqB;AAGvD,SAAO;GADK,IAAI,eADF,OAAO,OAAO,MAAM,WAAW,KAAA,EAAU,CAClB;GACxB,SAAS,OAAO;GAAE,OAAO;GAAQ;;AAGhD,QAAO,eAAe,KAAK;;;AAI7B,eAAsB,kBAAkB,IAAwC;AAC9E,KAAI;AACF,QAAM,IAAI;UACH,OAAO;AACd,MAAI,iBAAiB,eAAe;AAClC,WAAQ,MACN,sBAAsB,MAAM,UAAU,GAAG,MAAM,cAAc,MAAM,UAAU,IAAI,MAAM,YAAY,KACpG;AACD,UAAO,QAAQ,KAAK,EAAE;;AAExB,MAAI,iBAAiB,uBAAuB;AAC1C,WAAQ,MAAM,sBAAsB,MAAM,YAAY;AACtD,WAAQ,KAAK,cAAc,YAAY,CAAC,KAAK,KAAK,GAAG;AACrD,UAAO,QAAQ,KAAK,EAAE;;AAExB,MAAI,iBAAiB,kBAAkB;AACrC,WAAQ,MAAM,iBAAiB,MAAM,OAAO;AAC5C,WAAQ,KAAK,gEAAgE;AAC7E,UAAO,QAAQ,KAAK,EAAE;;AAExB,MAAI,iBAAiB,gBAAgB;AACnC,WAAQ,MAAM,yCAAyC,MAAM,WAAW,GAAG;AAC3E,UAAO,QAAQ,KAAK,EAAE;;AAExB,MAAI,iBAAiB,WAAW;AAC9B,WAAQ,MAAM,iCAAiC,MAAM,WAAW,IAAI,MAAM,IAAI,GAAG;AACjF,OAAI,MAAM,eAAe,CACvB,SAAQ,KAAK,gEAAgE;AAE/E,UAAO,QAAQ,KAAK,EAAE;;AAExB,QAAM"}
@@ -1,31 +0,0 @@
1
- import { l as Version } from "../_chunks/types.mjs";
2
- import * as citty from "citty";
3
-
4
- //#region src/commands/versions.d.ts
5
- declare function selectRecentVersions(versions: Version[], limit: number): Version[];
6
- declare const _default: citty.CommandDef<{
7
- readonly purl: {
8
- readonly type: "positional";
9
- readonly description: "Package PURL (e.g. pkg:npm/lodash, cargo/serde)";
10
- readonly required: true;
11
- };
12
- readonly limit: {
13
- readonly type: "string";
14
- readonly alias: "l";
15
- readonly description: "Max versions to show";
16
- readonly default: "20";
17
- };
18
- readonly json: {
19
- readonly type: "boolean";
20
- readonly description: "Output as JSON";
21
- readonly default: false;
22
- };
23
- readonly "no-cache": {
24
- readonly type: "boolean";
25
- readonly description: "Bypass cache, fetch fresh data";
26
- readonly default: false;
27
- };
28
- }>;
29
- //#endregion
30
- export { _default as default, selectRecentVersions };
31
- //# sourceMappingURL=versions.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"versions.d.mts","names":[],"sources":["../../src/commands/versions.ts"],"mappings":";;;;iBAKgB,oBAAA,CAAqB,QAAA,EAAU,OAAA,IAAW,KAAA,WAAgB,OAAA;AAAA,cAQzE,QAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"versions.mjs","names":[],"sources":["../../src/commands/versions.ts"],"sourcesContent":["import { defineCommand } from \"citty\";\nimport consola from \"consola\";\nimport type { Version } from \"../core/types.ts\";\n\nimport { sharedArgs, resolvePURL, withErrorHandling } from \"./shared.ts\";\nexport function selectRecentVersions(versions: Version[], limit: number): Version[] {\n return versions\n .toSorted((a, b) => {\n if (a.publishedAt === null) return b.publishedAt === null ? 0 : 1;\n if (b.publishedAt === null) return -1;\n return b.publishedAt.getTime() - a.publishedAt.getTime();\n })\n .slice(0, limit);\n}\n\nexport default defineCommand({\n meta: {\n name: \"versions\",\n description: \"List package versions\",\n },\n args: {\n ...sharedArgs,\n purl: {\n type: \"positional\",\n description: \"Package PURL (e.g. pkg:npm/lodash, cargo/serde)\",\n required: true,\n },\n limit: {\n type: \"string\",\n alias: \"l\",\n description: \"Max versions to show\",\n default: \"20\",\n },\n },\n async run({ args }) {\n await withErrorHandling(async () => {\n const [reg, name] = resolvePURL(args.purl, !args[\"no-cache\"]);\n const versions = await reg.fetchVersions(name);\n const limit = Number.parseInt(args.limit, 10) || 20;\n const shown = selectRecentVersions(versions, limit);\n\n if (args.json) {\n console.log(JSON.stringify(shown, null, 2));\n return;\n }\n\n consola.log(\"\");\n consola.log(\n ` \\x1b[1m${name}\\x1b[0m — ${versions.length} version${versions.length === 1 ? \"\" : \"s\"}`,\n );\n consola.log(\"\");\n\n for (const v of shown) {\n const status = v.status ? ` \\x1b[33m[${v.status}]\\x1b[0m` : \"\";\n const date = v.publishedAt\n ? ` \\x1b[90m${v.publishedAt.toISOString().slice(0, 10)}\\x1b[0m`\n : \"\";\n consola.log(` ${v.number}${status}${date}`);\n }\n\n if (versions.length > limit) {\n consola.log(\n `\\n \\x1b[90m... and ${versions.length - limit} more (use --limit to show more)\\x1b[0m`,\n );\n }\n consola.log(\"\");\n });\n },\n});\n"],"mappings":";;;;;;AAKA,SAAgB,qBAAqB,UAAqB,OAA0B;AAClF,QAAO,SACJ,UAAU,GAAG,MAAM;AAClB,MAAI,EAAE,gBAAgB,KAAM,QAAO,EAAE,gBAAgB,OAAO,IAAI;AAChE,MAAI,EAAE,gBAAgB,KAAM,QAAO;AACnC,SAAO,EAAE,YAAY,SAAS,GAAG,EAAE,YAAY,SAAS;GACxD,CACD,MAAM,GAAG,MAAM;;AAGpB,IAAA,mBAAe,cAAc;CAC3B,MAAM;EACJ,MAAM;EACN,aAAa;EACd;CACD,MAAM;EACJ,GAAG;EACH,MAAM;GACJ,MAAM;GACN,aAAa;GACb,UAAU;GACX;EACD,OAAO;GACL,MAAM;GACN,OAAO;GACP,aAAa;GACb,SAAS;;EAEZ;CACD,MAAM,IAAI,EAAE,QAAQ;AAClB,QAAM,kBAAkB,YAAY;GAClC,MAAM,CAAC,KAAK,QAAQ,YAAY,KAAK,MAAM,CAAC,KAAK,YAAY;GAC7D,MAAM,WAAW,MAAM,IAAI,cAAc,KAAK;GAC9C,MAAM,QAAQ,OAAO,SAAS,KAAK,OAAO,GAAG,IAAI;GACjD,MAAM,QAAQ,qBAAqB,UAAU,MAAM;AAEnD,OAAI,KAAK,MAAM;AACb,YAAQ,IAAI,KAAK,UAAU,OAAO,MAAM,EAAE,CAAC;AAC3C;;AAGF,WAAQ,IAAI,GAAG;AACf,WAAQ,IACN,YAAY,KAAK,YAAY,SAAS,OAAO,UAAU,SAAS,WAAW,IAAI,KAAK,MACrF;AACD,WAAQ,IAAI,GAAG;AAEf,QAAK,MAAM,KAAK,OAAO;IACrB,MAAM,SAAS,EAAE,SAAS,aAAa,EAAE,OAAO,YAAY;IAC5D,MAAM,OAAO,EAAE,cACX,aAAa,EAAE,YAAY,aAAa,CAAC,MAAM,GAAG,GAAG,CAAC,WACtD;AACJ,YAAQ,IAAI,KAAK,EAAE,SAAS,SAAS,OAAO;;AAG9C,OAAI,SAAS,SAAS,MACpB,SAAQ,IACN,uBAAuB,SAAS,SAAS,MAAM,yCAChD;AAEH,WAAQ,IAAI,GAAG;IACf;;CAEL,CAAC"}
@@ -1,4 +0,0 @@
1
- import { a as ParsedPURL, c as URLBuilder, i as Package, l as Version, n as Dependency, o as RateLimiter, r as Maintainer, s as Scope, t as ClientOptions, u as VersionStatus } from "../_chunks/types.mjs";
2
- import { a as register, i as has, n as create, o as Client, r as ecosystems, s as defaultClient, t as Registry } from "../_chunks/registry.mjs";
3
- import { a as RateLimitError, c as combineLicenses, d as createFromPURL, f as fullName, i as PkioError, l as normalizeLicense, n as InvalidPURLError, o as UnknownEcosystemError, p as parsePURL, r as NotFoundError, s as normalizeRepositoryURL, t as HTTPError, u as buildPURL } from "../_chunks/errors.mjs";
4
- export { Client, type ClientOptions, type Dependency, HTTPError, InvalidPURLError, type Maintainer, NotFoundError, type Package, type ParsedPURL, PkioError, RateLimitError, type RateLimiter, Registry, type Scope, type URLBuilder, UnknownEcosystemError, type Version, type VersionStatus, buildPURL, combineLicenses, create, createFromPURL, defaultClient, ecosystems, fullName, has, normalizeLicense, normalizeRepositoryURL, parsePURL, register };
@@ -1,3 +0,0 @@
1
- import { a as register, c as HTTPError, d as PkioError, f as RateLimitError, i as has, l as InvalidPURLError, n as create, o as Client, p as UnknownEcosystemError, r as ecosystems, s as defaultClient, t as Registry, u as NotFoundError } from "../_chunks/registry.mjs";
2
- import { a as normalizeRepositoryURL, i as parsePURL, n as createFromPURL, o as combineLicenses, r as fullName, s as normalizeLicense, t as buildPURL } from "../_chunks/purl.mjs";
3
- export { Client, HTTPError, InvalidPURLError, NotFoundError, PkioError, RateLimitError, Registry, UnknownEcosystemError, buildPURL, combineLicenses, create, createFromPURL, defaultClient, ecosystems, fullName, has, normalizeLicense, normalizeRepositoryURL, parsePURL, register };
package/dist/types.d.mts DELETED
@@ -1,3 +0,0 @@
1
- import { a as ParsedPURL, c as URLBuilder, i as Package, l as Version, n as Dependency, o as RateLimiter, r as Maintainer, s as Scope, t as ClientOptions, u as VersionStatus } from "./_chunks/types.mjs";
2
- import { t as Registry } from "./_chunks/registry.mjs";
3
- export { type ClientOptions, type Dependency, type Maintainer, type Package, type ParsedPURL, type RateLimiter, type Registry, type Scope, type URLBuilder, type Version, type VersionStatus };
package/dist/types.mjs DELETED
@@ -1 +0,0 @@
1
- export {};