@g3nomaly/core 0.3.1 → 0.3.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.
Files changed (222) hide show
  1. package/dist/cli/commands/add.d.ts +24 -4
  2. package/dist/cli/commands/add.d.ts.map +1 -1
  3. package/dist/cli/commands/add.js +37 -14
  4. package/dist/cli/commands/add.js.map +1 -1
  5. package/dist/cli/commands/conflict.d.ts +52 -0
  6. package/dist/cli/commands/conflict.d.ts.map +1 -0
  7. package/dist/cli/commands/conflict.js +88 -0
  8. package/dist/cli/commands/conflict.js.map +1 -0
  9. package/dist/cli/commands/installFromSources.d.ts +42 -13
  10. package/dist/cli/commands/installFromSources.d.ts.map +1 -1
  11. package/dist/cli/commands/installFromSources.js +68 -19
  12. package/dist/cli/commands/installFromSources.js.map +1 -1
  13. package/dist/cli/commands/ls.d.ts +13 -3
  14. package/dist/cli/commands/ls.d.ts.map +1 -1
  15. package/dist/cli/commands/ls.js +26 -6
  16. package/dist/cli/commands/ls.js.map +1 -1
  17. package/dist/cli/commands/remove.d.ts +7 -1
  18. package/dist/cli/commands/remove.d.ts.map +1 -1
  19. package/dist/cli/commands/remove.js +15 -1
  20. package/dist/cli/commands/remove.js.map +1 -1
  21. package/dist/cli/commands/sources.d.ts +34 -10
  22. package/dist/cli/commands/sources.d.ts.map +1 -1
  23. package/dist/cli/commands/sources.js +17 -3
  24. package/dist/cli/commands/sources.js.map +1 -1
  25. package/dist/cli/commands/update.d.ts +11 -4
  26. package/dist/cli/commands/update.d.ts.map +1 -1
  27. package/dist/cli/commands/update.js +32 -14
  28. package/dist/cli/commands/update.js.map +1 -1
  29. package/dist/cli/dialogue.d.ts +65 -13
  30. package/dist/cli/dialogue.d.ts.map +1 -1
  31. package/dist/cli/dialogue.js +46 -7
  32. package/dist/cli/dialogue.js.map +1 -1
  33. package/dist/cli/index.d.ts +1 -1
  34. package/dist/cli/index.d.ts.map +1 -1
  35. package/dist/cli/index.js +1 -1
  36. package/dist/cli/index.js.map +1 -1
  37. package/dist/cli/installDialogues.d.ts +11 -3
  38. package/dist/cli/installDialogues.d.ts.map +1 -1
  39. package/dist/cli/installDialogues.js +22 -5
  40. package/dist/cli/installDialogues.js.map +1 -1
  41. package/dist/cli/pick.d.ts +11 -2
  42. package/dist/cli/pick.d.ts.map +1 -1
  43. package/dist/cli/pick.js +11 -2
  44. package/dist/cli/pick.js.map +1 -1
  45. package/dist/cli/report.d.ts +32 -8
  46. package/dist/cli/report.d.ts.map +1 -1
  47. package/dist/cli/report.js +26 -5
  48. package/dist/cli/report.js.map +1 -1
  49. package/dist/cli/theme.d.ts +4 -0
  50. package/dist/cli/theme.d.ts.map +1 -1
  51. package/dist/cli/theme.js +4 -0
  52. package/dist/cli/theme.js.map +1 -1
  53. package/dist/cli/types.d.ts +56 -5
  54. package/dist/cli/types.d.ts.map +1 -1
  55. package/dist/config/config.d.ts +32 -7
  56. package/dist/config/config.d.ts.map +1 -1
  57. package/dist/config/config.js +37 -7
  58. package/dist/config/config.js.map +1 -1
  59. package/dist/config/types.d.ts +58 -0
  60. package/dist/config/types.d.ts.map +1 -1
  61. package/dist/config/types.js +0 -10
  62. package/dist/config/types.js.map +1 -1
  63. package/dist/hash/hash.d.ts +6 -8
  64. package/dist/hash/hash.d.ts.map +1 -1
  65. package/dist/hash/hash.js +7 -8
  66. package/dist/hash/hash.js.map +1 -1
  67. package/dist/hash/index.d.ts.map +1 -1
  68. package/dist/hash/index.js +1 -0
  69. package/dist/hash/index.js.map +1 -1
  70. package/dist/index.js +1 -0
  71. package/dist/index.js.map +1 -1
  72. package/dist/installer/classify.d.ts +27 -1
  73. package/dist/installer/classify.d.ts.map +1 -1
  74. package/dist/installer/classify.js +36 -1
  75. package/dist/installer/classify.js.map +1 -1
  76. package/dist/installer/files.d.ts +10 -6
  77. package/dist/installer/files.d.ts.map +1 -1
  78. package/dist/installer/files.js +4 -3
  79. package/dist/installer/files.js.map +1 -1
  80. package/dist/installer/index.d.ts +1 -1
  81. package/dist/installer/index.d.ts.map +1 -1
  82. package/dist/installer/index.js +1 -1
  83. package/dist/installer/index.js.map +1 -1
  84. package/dist/installer/install.d.ts +18 -6
  85. package/dist/installer/install.d.ts.map +1 -1
  86. package/dist/installer/install.js +20 -7
  87. package/dist/installer/install.js.map +1 -1
  88. package/dist/installer/io.d.ts +6 -1
  89. package/dist/installer/io.d.ts.map +1 -1
  90. package/dist/installer/io.js +6 -1
  91. package/dist/installer/io.js.map +1 -1
  92. package/dist/installer/manifest.d.ts +29 -19
  93. package/dist/installer/manifest.d.ts.map +1 -1
  94. package/dist/installer/manifest.js +20 -10
  95. package/dist/installer/manifest.js.map +1 -1
  96. package/dist/installer/manifestSources.d.ts +18 -7
  97. package/dist/installer/manifestSources.d.ts.map +1 -1
  98. package/dist/installer/manifestSources.js +18 -7
  99. package/dist/installer/manifestSources.js.map +1 -1
  100. package/dist/installer/marketplace.d.ts +24 -12
  101. package/dist/installer/marketplace.d.ts.map +1 -1
  102. package/dist/installer/marketplace.js +18 -10
  103. package/dist/installer/marketplace.js.map +1 -1
  104. package/dist/installer/origin.d.ts +23 -7
  105. package/dist/installer/origin.d.ts.map +1 -1
  106. package/dist/installer/origin.js +14 -7
  107. package/dist/installer/origin.js.map +1 -1
  108. package/dist/installer/remove.d.ts +17 -5
  109. package/dist/installer/remove.d.ts.map +1 -1
  110. package/dist/installer/remove.js +17 -5
  111. package/dist/installer/remove.js.map +1 -1
  112. package/dist/installer/resolve.d.ts +80 -31
  113. package/dist/installer/resolve.d.ts.map +1 -1
  114. package/dist/installer/resolve.js +96 -29
  115. package/dist/installer/resolve.js.map +1 -1
  116. package/dist/installer/sourceRegistry.d.ts +59 -22
  117. package/dist/installer/sourceRegistry.d.ts.map +1 -1
  118. package/dist/installer/sourceRegistry.js +25 -10
  119. package/dist/installer/sourceRegistry.js.map +1 -1
  120. package/dist/installer/types.d.ts +72 -19
  121. package/dist/installer/types.d.ts.map +1 -1
  122. package/dist/installer/types.js +18 -8
  123. package/dist/installer/types.js.map +1 -1
  124. package/dist/registry/index.d.ts +0 -4
  125. package/dist/registry/index.d.ts.map +1 -1
  126. package/dist/registry/index.js +1 -4
  127. package/dist/registry/index.js.map +1 -1
  128. package/dist/registry/registry.handlers.d.ts +7 -0
  129. package/dist/registry/registry.handlers.d.ts.map +1 -1
  130. package/dist/registry/registry.handlers.js.map +1 -1
  131. package/dist/registry/registry.io.d.ts +23 -7
  132. package/dist/registry/registry.io.d.ts.map +1 -1
  133. package/dist/registry/registry.io.js +37 -14
  134. package/dist/registry/registry.io.js.map +1 -1
  135. package/dist/registry/registry.mutations.d.ts +10 -3
  136. package/dist/registry/registry.mutations.d.ts.map +1 -1
  137. package/dist/registry/registry.mutations.js +10 -3
  138. package/dist/registry/registry.mutations.js.map +1 -1
  139. package/dist/registry/registry.selectors.d.ts +41 -11
  140. package/dist/registry/registry.selectors.d.ts.map +1 -1
  141. package/dist/registry/registry.selectors.js +41 -11
  142. package/dist/registry/registry.selectors.js.map +1 -1
  143. package/dist/registry/registry.store.d.ts +22 -9
  144. package/dist/registry/registry.store.d.ts.map +1 -1
  145. package/dist/registry/registry.store.js +12 -3
  146. package/dist/registry/registry.store.js.map +1 -1
  147. package/dist/registry/registry.template.d.ts +12 -6
  148. package/dist/registry/registry.template.d.ts.map +1 -1
  149. package/dist/registry/registry.template.js +13 -6
  150. package/dist/registry/registry.template.js.map +1 -1
  151. package/dist/registry/types.d.ts +17 -3
  152. package/dist/registry/types.d.ts.map +1 -1
  153. package/dist/registry/types.js +16 -6
  154. package/dist/registry/types.js.map +1 -1
  155. package/dist/security/index.d.ts.map +1 -1
  156. package/dist/security/index.js +1 -0
  157. package/dist/security/index.js.map +1 -1
  158. package/dist/security/securityParser.d.ts +9 -8
  159. package/dist/security/securityParser.d.ts.map +1 -1
  160. package/dist/security/securityParser.js +12 -22
  161. package/dist/security/securityParser.js.map +1 -1
  162. package/dist/security/securityWorker.d.ts +11 -0
  163. package/dist/security/securityWorker.d.ts.map +1 -1
  164. package/dist/security/securityWorker.js +17 -38
  165. package/dist/security/securityWorker.js.map +1 -1
  166. package/dist/sources/checkout.d.ts +10 -4
  167. package/dist/sources/checkout.d.ts.map +1 -1
  168. package/dist/sources/checkout.js +10 -4
  169. package/dist/sources/checkout.js.map +1 -1
  170. package/dist/sources/git.d.ts +5 -3
  171. package/dist/sources/git.d.ts.map +1 -1
  172. package/dist/sources/git.js +5 -3
  173. package/dist/sources/git.js.map +1 -1
  174. package/dist/sources/local.d.ts +6 -4
  175. package/dist/sources/local.d.ts.map +1 -1
  176. package/dist/sources/local.js +6 -4
  177. package/dist/sources/local.js.map +1 -1
  178. package/dist/sources/npm.d.ts +10 -7
  179. package/dist/sources/npm.d.ts.map +1 -1
  180. package/dist/sources/npm.js +49 -15
  181. package/dist/sources/npm.js.map +1 -1
  182. package/dist/sources/parse.d.ts +24 -16
  183. package/dist/sources/parse.d.ts.map +1 -1
  184. package/dist/sources/parse.js +40 -18
  185. package/dist/sources/parse.js.map +1 -1
  186. package/dist/sources/process.d.ts +10 -7
  187. package/dist/sources/process.d.ts.map +1 -1
  188. package/dist/sources/process.js +10 -7
  189. package/dist/sources/process.js.map +1 -1
  190. package/dist/sources/register.d.ts +20 -5
  191. package/dist/sources/register.d.ts.map +1 -1
  192. package/dist/sources/register.js +20 -5
  193. package/dist/sources/register.js.map +1 -1
  194. package/dist/sources/types.d.ts +43 -8
  195. package/dist/sources/types.d.ts.map +1 -1
  196. package/dist/sources/types.js +21 -4
  197. package/dist/sources/types.js.map +1 -1
  198. package/dist/utils/errors.d.ts +6 -1
  199. package/dist/utils/errors.d.ts.map +1 -1
  200. package/dist/utils/errors.js +6 -1
  201. package/dist/utils/errors.js.map +1 -1
  202. package/dist/utils/merge.d.ts +8 -2
  203. package/dist/utils/merge.d.ts.map +1 -1
  204. package/dist/utils/merge.js +9 -2
  205. package/dist/utils/merge.js.map +1 -1
  206. package/dist/utils/packageMeta.d.ts +16 -2
  207. package/dist/utils/packageMeta.d.ts.map +1 -1
  208. package/dist/utils/packageMeta.js +6 -2
  209. package/dist/utils/packageMeta.js.map +1 -1
  210. package/dist/utils/paths.d.ts +16 -5
  211. package/dist/utils/paths.d.ts.map +1 -1
  212. package/dist/utils/paths.js +16 -5
  213. package/dist/utils/paths.js.map +1 -1
  214. package/dist/utils/prompt.d.ts +6 -1
  215. package/dist/utils/prompt.d.ts.map +1 -1
  216. package/dist/utils/prompt.js +6 -1
  217. package/dist/utils/prompt.js.map +1 -1
  218. package/dist/utils/version.d.ts +7 -2
  219. package/dist/utils/version.d.ts.map +1 -1
  220. package/dist/utils/version.js +40 -3
  221. package/dist/utils/version.js.map +1 -1
  222. package/package.json +1 -1
@@ -19,14 +19,17 @@ const PackumentSchema = z.object({
19
19
  })).default({}),
20
20
  });
21
21
  /**
22
- * Resolves an npm source to a folder. A copy in `node_modules` at or above the
23
- * project root is read in place when it satisfies `spec.version` (any copy
24
- * does when no version is set). Otherwise the package tarball is downloaded
25
- * from the registry in `npm_config_registry`, checked against its integrity
26
- * hash and unpacked into a temporary folder.
22
+ * @brief Resolves an npm source to a folder.
27
23
  *
28
- * @param projectRoot - Absolute folder the `node_modules` lookup starts from
29
- * @throws when the registry has no matching version or the download fails its integrity check
24
+ * A copy in `node_modules` at or above the project root is read in place when it satisfies `spec.version`
25
+ * (any copy does when no version is set). Otherwise the package tarball is downloaded from the registry
26
+ * in `npm_config_registry`, checked against its integrity hash and unpacked into a temporary folder.
27
+ *
28
+ * @param name - Name of the source.
29
+ * @param spec - npm spec with the package name and optional version.
30
+ * @param projectRoot - Absolute folder the `node_modules` lookup starts from.
31
+ * @returns Checkout of the package folder.
32
+ * @throws {Error} When the registry has no matching version or the download fails its integrity check.
30
33
  */
31
34
  export async function checkoutNpm(name, spec, projectRoot) {
32
35
  const installed = findInstalled(projectRoot, spec.package);
@@ -35,7 +38,13 @@ export async function checkoutNpm(name, spec, projectRoot) {
35
38
  }
36
39
  return downloadFromRegistry(name, spec);
37
40
  }
38
- /** Real path and version of the nearest `node_modules/<pkg>` at or above `fromDir`, or `null`. */
41
+ /**
42
+ * @brief Finds the nearest installed copy of a package, at or above a folder.
43
+ *
44
+ * @param fromDir - Absolute folder the search starts from.
45
+ * @param pkg - Package name, e.g. `@g3nomaly/g3n-skills`.
46
+ * @returns Real path and version of `node_modules/<pkg>`, or `null` when no copy exists.
47
+ */
39
48
  function findInstalled(fromDir, pkg) {
40
49
  let dir = fromDir;
41
50
  while (true) {
@@ -50,23 +59,35 @@ function findInstalled(fromDir, pkg) {
50
59
  dir = parent;
51
60
  }
52
61
  }
53
- /** Whether an installed version satisfies the requested range; no range accepts any copy. */
62
+ /**
63
+ * @brief Checks whether an installed version satisfies the requested range.
64
+ *
65
+ * @param installed - Installed version, `undefined` when unknown.
66
+ * @param requested - Semver range or dist-tag. `undefined` accepts any copy.
67
+ * @returns `true` when the installed copy can be used.
68
+ */
54
69
  function accepts(installed, requested) {
55
70
  if (requested === undefined)
56
71
  return true;
57
72
  return installed !== undefined && Bun.semver.satisfies(installed, requested);
58
73
  }
59
- /** Registry base URL from `npm_config_registry`, with a trailing slash; npmjs.org when unset. */
74
+ /**
75
+ * @brief Reads the registry base URL from the environment.
76
+ *
77
+ * @returns The URL from `npm_config_registry`, with a trailing slash. npmjs.org when unset.
78
+ */
60
79
  function registryUrl() {
61
80
  const env = RegistryEnvSchema.parse(process.env);
62
81
  const url = env.npm_config_registry ?? env.NPM_CONFIG_REGISTRY ?? DEFAULT_REGISTRY;
63
82
  return url.endsWith("/") ? url : `${url}/`;
64
83
  }
65
84
  /**
66
- * Downloads the version `spec` asks for, checks it against its integrity hash
67
- * and unpacks it into a temporary folder that `dispose` removes.
85
+ * @brief Downloads the version `spec` asks for, checks it against its integrity hash and unpacks it into a temporary folder.
68
86
  *
69
- * @throws when the registry has no matching version, a download fails or the hash does not match
87
+ * @param name - Name of the source.
88
+ * @param spec - npm spec with the package name and optional version.
89
+ * @returns Checkout whose `dispose` removes the temporary folder.
90
+ * @throws {Error} When the registry has no matching version, a download fails or the hash does not match.
70
91
  */
71
92
  async function downloadFromRegistry(name, spec) {
72
93
  const packumentUrl = registryUrl() + spec.package.replace("/", "%2f");
@@ -103,7 +124,13 @@ async function downloadFromRegistry(name, spec) {
103
124
  throw error;
104
125
  }
105
126
  }
106
- /** The dist-tag, the exact version, or the highest version in the range; `latest` when nothing is asked. */
127
+ /**
128
+ * @brief Picks the version to download: a dist-tag, an exact version, or the highest version in a range.
129
+ *
130
+ * @param packument - Registry metadata of the package.
131
+ * @param requested - Dist-tag, exact version or semver range. `latest` when `undefined`.
132
+ * @returns The chosen version, or `undefined` when none matches.
133
+ */
107
134
  function pickVersion(packument, requested) {
108
135
  const wanted = requested ?? "latest";
109
136
  const tagged = packument["dist-tags"][wanted];
@@ -115,7 +142,14 @@ function pickVersion(packument, requested) {
115
142
  .filter((v) => Bun.semver.satisfies(v, wanted))
116
143
  .sort((a, b) => Bun.semver.order(b, a))[0];
117
144
  }
118
- /** Checks an SRI string such as `sha512-<base64>` against the downloaded bytes. */
145
+ /**
146
+ * @brief Checks downloaded bytes against an SRI integrity string.
147
+ *
148
+ * @param bytes - Downloaded tarball.
149
+ * @param integrity - SRI string such as `sha512-<base64>`.
150
+ * @param label - Package and version, used in error messages, e.g. `pkg@1.0.0`.
151
+ * @throws {Error} When the algorithm is unsupported or the hash does not match.
152
+ */
119
153
  function verifyIntegrity(bytes, integrity, label) {
120
154
  const [algorithm, expected] = integrity.split(" ")[0]?.split("-", 2) ?? [];
121
155
  if (algorithm !== "sha512" && algorithm !== "sha256" && algorithm !== "sha1") {
@@ -1 +1 @@
1
- {"version":3,"file":"npm.js","sourceRoot":"","sources":["../../src/sources/npm.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,M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AC"}
@@ -1,34 +1,42 @@
1
1
  import type { SourceSpec } from "./types";
2
2
  /**
3
- * Reads a source as typed on the command line.
3
+ * @brief Reads a source as typed on the command line.
4
4
  *
5
- * `npm:<pkg>[@version]` and `@scope/pkg[@version]` are npm packages, git URLs
6
- * are git repositories, `local:<path>` and paths starting with `.`, `/` or `~`
7
- * are local folders, and `owner/repo` is a GitHub repository.
5
+ * `npm:<pkg>[@version]` and `@scope/pkg[@version]` are npm packages, git URLs are git repositories,
6
+ * `local:<path>` and paths starting with `.`, `/` or `~` are local folders, and `owner/repo` is a GitHub repository.
8
7
  *
9
- * @param input - e.g. `npm:@g3nomaly/g3n-skills@^1`, `git@github.com:me/skills.git`, `./my-skills`
10
- * @param options - `ref` pins a git source to a branch or tag
11
- * @throws when the input matches no form, or `ref` is given for a source that is not git
8
+ * @param input - Text as typed, e.g. `npm:@g3nomaly/g3n-skills@^1`, `git@github.com:me/skills.git`, `./my-skills`.
9
+ * @param options - `ref` pins a git source to a branch or tag.
10
+ * @returns The spec for the first form the input matches.
11
+ * @throws {Error} When the input matches no form, or `ref` is given for a source that is not git.
12
12
  */
13
13
  export declare function parseSourceSpec(input: string, options?: {
14
14
  ref?: string;
15
15
  }): SourceSpec;
16
16
  /**
17
- * Name a source registers under when none is given: the repository name for
18
- * git, the package name without its scope for npm, the folder name for local.
17
+ * @brief Derives the name a source registers under when none is given: the repository name for git,
18
+ * the package name without its scope for npm, the folder name for local.
19
19
  *
20
- * @returns a valid source name, e.g. `skills` for `git@github.com:g3nomaly/skills.git`
20
+ * @param spec - Spec to derive the name from.
21
+ * @returns A valid source name, e.g. `skills` for `git@github.com:g3nomaly/skills.git`.
22
+ * @throws {Error} When no name can be derived. The caller must then ask for one.
21
23
  */
22
24
  export declare function defaultSourceName(spec: SourceSpec): string;
23
- /** `~/x` with the home folder in place of `~`; any other path unchanged. */
25
+ /**
26
+ * @brief Replaces a leading `~` with the home folder.
27
+ *
28
+ * @param localPath - Path that may start with `~`.
29
+ * @returns The path with the home folder in place of `~`. Any other path is returned unchanged.
30
+ */
24
31
  export declare function expandHome(localPath: string): string;
25
32
  /**
26
- * Stores a local path the way it is read back: relative to the project root,
27
- * or absolute when the manifest is shared by every project (a user scope).
28
- * Other kinds are returned unchanged.
33
+ * @brief Stores a local path the way it is read back: relative to the project root, or absolute when the
34
+ * manifest is shared by every project (a user scope). Other kinds are returned unchanged.
29
35
  *
30
- * @param cwd - Absolute folder the path was typed in
31
- * @param projectRoot - Absolute project root, or `null` to store the path absolute
36
+ * @param spec - Spec to anchor. Only `local` specs change.
37
+ * @param cwd - Absolute folder the path was typed in.
38
+ * @param projectRoot - Absolute project root, or `null` to store the path absolute.
39
+ * @returns The spec with its path anchored.
32
40
  */
33
41
  export declare function anchorLocalSpec(spec: SourceSpec, cwd: string, projectRoot: string | null): SourceSpec;
34
42
  //# sourceMappingURL=parse.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../src/sources/parse.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAM1C;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,UAAU,CAOzF;AA4BD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAW1D;AAED,4EAA4E;AAC5E,wBAAgB,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,UAAU,CAIrG"}
1
+ {"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../src/sources/parse.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAM1C;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,UAAU,CAOzF;AA0CD;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAW1D;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,UAAU,CAIrG"}
@@ -6,15 +6,15 @@ const NPM_PREFIX = "npm:";
6
6
  const LOCAL_PREFIX = "local:";
7
7
  const GITHUB_SHORTHAND = /^[\w.-]+\/[\w.-]+$/;
8
8
  /**
9
- * Reads a source as typed on the command line.
9
+ * @brief Reads a source as typed on the command line.
10
10
  *
11
- * `npm:<pkg>[@version]` and `@scope/pkg[@version]` are npm packages, git URLs
12
- * are git repositories, `local:<path>` and paths starting with `.`, `/` or `~`
13
- * are local folders, and `owner/repo` is a GitHub repository.
11
+ * `npm:<pkg>[@version]` and `@scope/pkg[@version]` are npm packages, git URLs are git repositories,
12
+ * `local:<path>` and paths starting with `.`, `/` or `~` are local folders, and `owner/repo` is a GitHub repository.
14
13
  *
15
- * @param input - e.g. `npm:@g3nomaly/g3n-skills@^1`, `git@github.com:me/skills.git`, `./my-skills`
16
- * @param options - `ref` pins a git source to a branch or tag
17
- * @throws when the input matches no form, or `ref` is given for a source that is not git
14
+ * @param input - Text as typed, e.g. `npm:@g3nomaly/g3n-skills@^1`, `git@github.com:me/skills.git`, `./my-skills`.
15
+ * @param options - `ref` pins a git source to a branch or tag.
16
+ * @returns The spec for the first form the input matches.
17
+ * @throws {Error} When the input matches no form, or `ref` is given for a source that is not git.
18
18
  */
19
19
  export function parseSourceSpec(input, options = {}) {
20
20
  const value = input.trim();
@@ -24,7 +24,14 @@ export function parseSourceSpec(input, options = {}) {
24
24
  }
25
25
  return spec;
26
26
  }
27
- /** The spec for one trimmed input, by the first form it matches; `ref` goes onto git specs. */
27
+ /**
28
+ * @brief Builds the spec for one trimmed input, by the first form it matches.
29
+ *
30
+ * @param value - Trimmed input.
31
+ * @param ref - Branch or tag for a git spec. Ignored for other kinds.
32
+ * @returns The spec.
33
+ * @throws {Error} When the input matches no form.
34
+ */
28
35
  function specFor(value, ref) {
29
36
  if (value.startsWith(NPM_PREFIX))
30
37
  return npmSpec(value.slice(NPM_PREFIX.length));
@@ -42,7 +49,14 @@ function specFor(value, ref) {
42
49
  }
43
50
  throw new Error(`"${value}" is not a source: use a git URL, owner/repo, npm:<package>, @scope/package or a local path`);
44
51
  }
45
- /** `pkg`, `pkg@1.2.0`, `@scope/pkg@^1` — the version follows the last `@` that is not the scope's. */
52
+ /**
53
+ * @brief Builds an npm spec from `pkg`, `pkg@1.2.0` or `@scope/pkg@^1`.
54
+ *
55
+ * The version follows the last `@` that is not the scope's.
56
+ *
57
+ * @param value - Package text, with an optional version.
58
+ * @returns The npm spec.
59
+ */
46
60
  function npmSpec(value) {
47
61
  const at = value.lastIndexOf("@");
48
62
  const hasVersion = at > 0;
@@ -53,10 +67,12 @@ function npmSpec(value) {
53
67
  });
54
68
  }
55
69
  /**
56
- * Name a source registers under when none is given: the repository name for
57
- * git, the package name without its scope for npm, the folder name for local.
70
+ * @brief Derives the name a source registers under when none is given: the repository name for git,
71
+ * the package name without its scope for npm, the folder name for local.
58
72
  *
59
- * @returns a valid source name, e.g. `skills` for `git@github.com:g3nomaly/skills.git`
73
+ * @param spec - Spec to derive the name from.
74
+ * @returns A valid source name, e.g. `skills` for `git@github.com:g3nomaly/skills.git`.
75
+ * @throws {Error} When no name can be derived. The caller must then ask for one.
60
76
  */
61
77
  export function defaultSourceName(spec) {
62
78
  const raw = (() => {
@@ -71,17 +87,23 @@ export function defaultSourceName(spec) {
71
87
  throw new Error("could not derive a name for the source, pass one with --name");
72
88
  return name;
73
89
  }
74
- /** `~/x` with the home folder in place of `~`; any other path unchanged. */
90
+ /**
91
+ * @brief Replaces a leading `~` with the home folder.
92
+ *
93
+ * @param localPath - Path that may start with `~`.
94
+ * @returns The path with the home folder in place of `~`. Any other path is returned unchanged.
95
+ */
75
96
  export function expandHome(localPath) {
76
97
  return localPath.startsWith("~") ? path.join(os.homedir(), localPath.slice(1)) : localPath;
77
98
  }
78
99
  /**
79
- * Stores a local path the way it is read back: relative to the project root,
80
- * or absolute when the manifest is shared by every project (a user scope).
81
- * Other kinds are returned unchanged.
100
+ * @brief Stores a local path the way it is read back: relative to the project root, or absolute when the
101
+ * manifest is shared by every project (a user scope). Other kinds are returned unchanged.
82
102
  *
83
- * @param cwd - Absolute folder the path was typed in
84
- * @param projectRoot - Absolute project root, or `null` to store the path absolute
103
+ * @param spec - Spec to anchor. Only `local` specs change.
104
+ * @param cwd - Absolute folder the path was typed in.
105
+ * @param projectRoot - Absolute project root, or `null` to store the path absolute.
106
+ * @returns The spec with its path anchored.
85
107
  */
86
108
  export function anchorLocalSpec(spec, cwd, projectRoot) {
87
109
  if (spec.kind !== "local")
@@ -1 +1 @@
1
- {"version":3,"file":"parse.js","sourceRoot":"","sources":["../../src/sources/parse.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAGnG,MAAM,UAAU,GAAK,MAAM,CAAC;AAC5B,MAAM,YAAY,GAAG,QAAQ,CAAC;AAC9B,MAAM,gBAAgB,GAAG,oBAAoB,CAAC;AAE9C;;;;;;;;;;GAUG;AACH,MAAM,UAAU,eAAe,CAAC,KAA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e,CAAC,IAAgB,EAAE,GAAW,EAAE,WAA0B;IACvF,IAAI,IAAI,CAAC,IAAI,KAAK,OAAO;QAAE,OAAO,IAAI,CAAC;IACvC,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAC1D,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,KAAK,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,QAAQ,CAAC,IAAI,GAAG,EAAE,CAAC;AAChH,CAAC"}
@@ -1,16 +1,19 @@
1
1
  /**
2
- * Runs a command to completion and returns its trimmed stdout. Prompts are
3
- * switched off for git, so a private repository fails instead of hanging.
2
+ * @brief Runs a command to completion and returns its trimmed stdout.
4
3
  *
5
- * @throws with the command's stderr when it exits non-zero
4
+ * Prompts are switched off for git, so a private repository fails instead of hanging.
5
+ *
6
+ * @param argv - Command and its arguments.
7
+ * @param cwd - Folder to run in. The current folder when absent.
8
+ * @returns Trimmed stdout.
9
+ * @throws {Error} With the command's stderr when it exits non-zero.
6
10
  */
7
11
  export declare function runCommand(argv: string[], cwd?: string): Promise<string>;
8
12
  /**
9
- * Creates an empty temporary folder that is also removed at process exit, so
10
- * a command that bails out early leaves nothing behind.
13
+ * @brief Creates an empty temporary folder that is also removed at process exit, so a command that bails out early leaves nothing behind.
11
14
  *
12
- * @param label - Part of the folder name, e.g. `git` gives `/tmp/g3n-source-git-XXXXXX`
13
- * @returns absolute path of the folder
15
+ * @param label - Part of the folder name, e.g. `git` gives `/tmp/g3n-source-git-XXXXXX`.
16
+ * @returns Absolute path of the folder.
14
17
  */
15
18
  export declare function createTempDir(label: string): string;
16
19
  /** Deletes a folder and everything in it; a missing folder is not an error. */
@@ -1 +1 @@
1
- {"version":3,"file":"process.d.ts","sourceRoot":"","sources":["../../src/sources/process.ts"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAc9E;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAInD;AAED,+EAA+E;AAC/E,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAE3C"}
1
+ {"version":3,"file":"process.d.ts","sourceRoot":"","sources":["../../src/sources/process.ts"],"names":[],"mappings":"AAKA;;;;;;;;;GASG;AACH,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAc9E;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAInD;AAED,+EAA+E;AAC/E,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAE3C"}
@@ -3,10 +3,14 @@ import fs from "node:fs";
3
3
  import os from "node:os";
4
4
  import path from "node:path";
5
5
  /**
6
- * Runs a command to completion and returns its trimmed stdout. Prompts are
7
- * switched off for git, so a private repository fails instead of hanging.
6
+ * @brief Runs a command to completion and returns its trimmed stdout.
8
7
  *
9
- * @throws with the command's stderr when it exits non-zero
8
+ * Prompts are switched off for git, so a private repository fails instead of hanging.
9
+ *
10
+ * @param argv - Command and its arguments.
11
+ * @param cwd - Folder to run in. The current folder when absent.
12
+ * @returns Trimmed stdout.
13
+ * @throws {Error} With the command's stderr when it exits non-zero.
10
14
  */
11
15
  export async function runCommand(argv, cwd) {
12
16
  const proc = Bun.spawn(argv, {
@@ -25,11 +29,10 @@ export async function runCommand(argv, cwd) {
25
29
  return stdout.trim();
26
30
  }
27
31
  /**
28
- * Creates an empty temporary folder that is also removed at process exit, so
29
- * a command that bails out early leaves nothing behind.
32
+ * @brief Creates an empty temporary folder that is also removed at process exit, so a command that bails out early leaves nothing behind.
30
33
  *
31
- * @param label - Part of the folder name, e.g. `git` gives `/tmp/g3n-source-git-XXXXXX`
32
- * @returns absolute path of the folder
34
+ * @param label - Part of the folder name, e.g. `git` gives `/tmp/g3n-source-git-XXXXXX`.
35
+ * @returns Absolute path of the folder.
33
36
  */
34
37
  export function createTempDir(label) {
35
38
  const dir = fs.mkdtempSync(path.join(os.tmpdir(), `g3n-source-${label}-`));
@@ -1 +1 @@
1
- {"version":3,"file":"process.js","sourceRoot":"","sources":["../../src/sources/process.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,IAAc,EAAE,GAAY;IAC3D,MAAM,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE;QAC3B,GAAG;QACH,MAAM,EAAE,MAAM;QACd,MAAM,EAAE,MAAM;QACd,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,mBAAmB,EAAE,GAAG,EAAE;KAClD,CAAC,CAAC;IACH,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QACnD,IAAI,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE;QAChC,IAAI,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE;QAChC,IAAI,CAAC,MAAM;KACZ,CAAC,CAAC;IACH,IAAI,QAAQ,KAAK,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,GAAG,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G,CAAC;QACnD,IAAI,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE;QAChC,IAAI,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE;QAChC,IAAI,CAAC,MAAM;KACZ,CAAC,CAAC;IACH,IAAI,QAAQ,KAAK,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,gBAAgB,QAAQ,EAAE,CAAC,CAAC;IACpI,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC;AACvB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,KAAa;IACzC,MAAM,GAAG,GAAG,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,cAAc,KAAK,GAAG,CAAC,CAAC,CAAC;IAC3E,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;IAC3C,OAAO,GAAG,CAAC;AACb,CAAC;AAED,+EAA+E;AAC/E,MAAM,UAAU,SAAS,CAAC,GAAW;IACnC,EAAE,CAAC,MAAM,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AACnD,CAAC"}
@@ -1,16 +1,31 @@
1
1
  import type { RegisteredSource, SourceRecord, SourceSpec } from "./types";
2
- /** Built-in sources first, then the registered ones, each group sorted by name. */
2
+ /**
3
+ * @brief Lists built-in sources first, then the registered ones, each group sorted by name.
4
+ *
5
+ * @param record - Registered sources of one manifest.
6
+ * @param builtins - Sources shipped with the installer.
7
+ * @returns Every source, flagged `builtin` when it ships with the installer.
8
+ */
3
9
  export declare function listSources(record: SourceRecord, builtins: SourceRecord): RegisteredSource[];
4
10
  /**
5
- * Returns `record` with `spec` registered under `name`.
11
+ * @brief Registers a source under a name.
6
12
  *
7
- * @throws when the name is invalid, belongs to a built-in source, or is already registered
13
+ * @param record - Registered sources to add to. Not changed.
14
+ * @param name - Name to register under. Must match `SourceNameSchema`.
15
+ * @param spec - Where the source is read from.
16
+ * @param builtins - Sources shipped with the installer. Their names cannot be registered.
17
+ * @returns A new record with the source added.
18
+ * @throws {Error} When the name is invalid, belongs to a built-in source, or is already registered.
8
19
  */
9
20
  export declare function addSource(record: SourceRecord, name: string, spec: SourceSpec, builtins: SourceRecord): SourceRecord;
10
21
  /**
11
- * Returns `record` without the source registered under `name`.
22
+ * @brief Removes a registered source.
12
23
  *
13
- * @throws when `name` is a built-in source or is not registered
24
+ * @param record - Registered sources to remove from. Not changed.
25
+ * @param name - Name of the source to remove.
26
+ * @param builtins - Sources shipped with the installer. They cannot be removed.
27
+ * @returns A new record without the source.
28
+ * @throws {Error} When `name` is a built-in source or is not registered.
14
29
  */
15
30
  export declare function removeSource(record: SourceRecord, name: string, builtins: SourceRecord): SourceRecord;
16
31
  //# sourceMappingURL=register.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../src/sources/register.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1E,mFAAmF;AACnF,wBAAgB,WAAW,CAAC,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,YAAY,GAAG,gBAAgB,EAAE,CAM5F;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,YAAY,GAAG,YAAY,CAKpH;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,GAAG,YAAY,CAKrG"}
1
+ {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../src/sources/register.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1E;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,YAAY,GAAG,gBAAgB,EAAE,CAM5F;AAED;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,YAAY,GAAG,YAAY,CAKpH;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,GAAG,YAAY,CAKrG"}
@@ -1,6 +1,12 @@
1
1
  // packages/core/src/sources/register.ts
2
2
  import { SourceNameSchema, SourceSpecSchema } from "./types";
3
- /** Built-in sources first, then the registered ones, each group sorted by name. */
3
+ /**
4
+ * @brief Lists built-in sources first, then the registered ones, each group sorted by name.
5
+ *
6
+ * @param record - Registered sources of one manifest.
7
+ * @param builtins - Sources shipped with the installer.
8
+ * @returns Every source, flagged `builtin` when it ships with the installer.
9
+ */
4
10
  export function listSources(record, builtins) {
5
11
  const sorted = (r) => Object.entries(r).sort(([a], [b]) => a.localeCompare(b));
6
12
  return [
@@ -9,9 +15,14 @@ export function listSources(record, builtins) {
9
15
  ];
10
16
  }
11
17
  /**
12
- * Returns `record` with `spec` registered under `name`.
18
+ * @brief Registers a source under a name.
13
19
  *
14
- * @throws when the name is invalid, belongs to a built-in source, or is already registered
20
+ * @param record - Registered sources to add to. Not changed.
21
+ * @param name - Name to register under. Must match `SourceNameSchema`.
22
+ * @param spec - Where the source is read from.
23
+ * @param builtins - Sources shipped with the installer. Their names cannot be registered.
24
+ * @returns A new record with the source added.
25
+ * @throws {Error} When the name is invalid, belongs to a built-in source, or is already registered.
15
26
  */
16
27
  export function addSource(record, name, spec, builtins) {
17
28
  const valid = SourceNameSchema.parse(name);
@@ -22,9 +33,13 @@ export function addSource(record, name, spec, builtins) {
22
33
  return { ...record, [valid]: SourceSpecSchema.parse(spec) };
23
34
  }
24
35
  /**
25
- * Returns `record` without the source registered under `name`.
36
+ * @brief Removes a registered source.
26
37
  *
27
- * @throws when `name` is a built-in source or is not registered
38
+ * @param record - Registered sources to remove from. Not changed.
39
+ * @param name - Name of the source to remove.
40
+ * @param builtins - Sources shipped with the installer. They cannot be removed.
41
+ * @returns A new record without the source.
42
+ * @throws {Error} When `name` is a built-in source or is not registered.
28
43
  */
29
44
  export function removeSource(record, name, builtins) {
30
45
  if (builtins[name] !== undefined)
@@ -1 +1 @@
1
- {"version":3,"file":"register.js","sourceRoot":"","sources":["../../src/sources/register.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAG7D,mFAAmF;AACnF,MAAM,UAAU,WAAW,CAAC,MAAoB,EAAE,QAAsB;IACtE,MAAM,MAAM,GAAG,CAAC,CAAe,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7F,OAAO;QACL,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;Q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AC;IAC/G,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK,SAAS;QAAE,MAAM,IAAI,KAAK,CAAC,mBAAmB,KAAK,yBAAyB,CAAC,CAAC;IACpG,OAAO,EAAE,GAAG,MAAM,EAAE,CAAC,KAAK,CAAC,EAAE,gBAAgB,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;AAC9D,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,YAAY,CAAC,MAAoB,EAAE,IAAY,EAAE,QAAsB;IACrF,IAAI,QAAQ,CAAC,IAAI,CAAC,KAAK,SAAS;QAAE,MAAM,IAAI,KAAK,CAAC,IAAI,IAAI,8CAA8C,CAAC,CAAC;IAC1G,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,SAAS;QAAE,MAAM,IAAI,KAAK,CAAC,oBAAoB,IAAI,iBAAiB,CAAC,CAAC;IAC3F,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;IAC7C,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -5,21 +5,41 @@ export declare const GIT_URL: RegExp;
5
5
  export declare const NPM_PACKAGE: RegExp;
6
6
  /** Name a source is registered under, e.g. `g3n-skills`. */
7
7
  export declare const SourceNameSchema: z.ZodString;
8
+ /**
9
+ * @brief Spec of a git source: a clone of a repository.
10
+ *
11
+ * @property kind - Always `git`.
12
+ * @property url - Clone URL.
13
+ * @property ref - Branch or tag to check out. The default branch when absent.
14
+ */
8
15
  export declare const GitSourceSpecSchema: z.ZodObject<{
9
16
  kind: z.ZodLiteral<"git">;
10
17
  url: z.ZodString;
11
18
  ref: z.ZodOptional<z.ZodString>;
12
19
  }, z.core.$strip>;
20
+ /**
21
+ * @brief Spec of an npm source: a published package.
22
+ *
23
+ * @property kind - Always `npm`.
24
+ * @property package - Package name, scoped or not.
25
+ * @property version - Exact version, semver range or dist-tag. When absent, any installed copy is accepted, else `latest`.
26
+ */
13
27
  export declare const NpmSourceSpecSchema: z.ZodObject<{
14
28
  kind: z.ZodLiteral<"npm">;
15
29
  package: z.ZodString;
16
30
  version: z.ZodOptional<z.ZodString>;
17
31
  }, z.core.$strip>;
32
+ /**
33
+ * @brief Spec of a local source: a folder on disk.
34
+ *
35
+ * @property kind - Always `local`.
36
+ * @property path - Folder holding the source, absolute or relative to the project root.
37
+ */
18
38
  export declare const LocalSourceSpecSchema: z.ZodObject<{
19
39
  kind: z.ZodLiteral<"local">;
20
40
  path: z.ZodString;
21
41
  }, z.core.$strip>;
22
- /** Where a source's files come from. */
42
+ /** Where a source's files come from: a git, npm or local spec. */
23
43
  export declare const SourceSpecSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
24
44
  kind: z.ZodLiteral<"git">;
25
45
  url: z.ZodString;
@@ -45,29 +65,44 @@ export declare const SourceRecordSchema: z.ZodRecord<z.ZodString, z.ZodDiscrimin
45
65
  kind: z.ZodLiteral<"local">;
46
66
  path: z.ZodString;
47
67
  }, z.core.$strip>], "kind">>;
68
+ /** Git source spec, inferred from `GitSourceSpecSchema`. */
48
69
  export type GitSourceSpec = z.infer<typeof GitSourceSpecSchema>;
70
+ /** npm source spec, inferred from `NpmSourceSpecSchema`. */
49
71
  export type NpmSourceSpec = z.infer<typeof NpmSourceSpecSchema>;
72
+ /** Local source spec, inferred from `LocalSourceSpecSchema`. */
50
73
  export type LocalSourceSpec = z.infer<typeof LocalSourceSpecSchema>;
74
+ /** Any source spec, inferred from `SourceSpecSchema`. */
51
75
  export type SourceSpec = z.infer<typeof SourceSpecSchema>;
76
+ /** Registered sources by name, inferred from `SourceRecordSchema`. */
52
77
  export type SourceRecord = z.infer<typeof SourceRecordSchema>;
53
- /** One source an installer can read from, either built into its code or registered by the user. */
78
+ /**
79
+ * @brief One source an installer can read from, either built into its code or registered by the user.
80
+ *
81
+ * @property name - Name the source is listed under.
82
+ * @property spec - Where the source's files come from.
83
+ * @property builtin - Built into the installer. Always listed and never removable.
84
+ */
54
85
  export interface RegisteredSource {
55
86
  name: string;
56
87
  spec: SourceSpec;
57
- /** Built into the installer: always listed, never removable */
58
88
  builtin: boolean;
59
89
  }
60
- /** A source resolved to a folder on disk. Call `dispose` once its files have been read. */
90
+ /**
91
+ * @brief A source resolved to a folder on disk. Call `dispose` once its files have been read.
92
+ *
93
+ * @property name - Name of the source.
94
+ * @property spec - Spec the checkout was made from.
95
+ * @property dir - Absolute root of the source's files.
96
+ * @property commit - Commit the git clone resolved to. Absent for npm and local sources.
97
+ * @property version - Package version for npm sources, or the `version` in a local source's package.json.
98
+ * @property dispose - Removes a temporary checkout. A no-op for folders the checkout did not create.
99
+ */
61
100
  export interface SourceCheckout {
62
101
  name: string;
63
102
  spec: SourceSpec;
64
- /** Absolute root of the source's files */
65
103
  dir: string;
66
- /** Commit the git clone resolved to; absent for npm and local sources */
67
104
  commit?: string;
68
- /** Package version for npm sources, or the `version` in a local source's package.json */
69
105
  version?: string;
70
- /** Removes a temporary checkout; a no-op for folders the checkout did not create */
71
106
  dispose: () => void;
72
107
  }
73
108
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/sources/types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,iHAAiH;AACjH,eAAO,MAAM,OAAO,QAAwD,CAAC;AAE7E,qEAAqE;AACrE,eAAO,MAAM,WAAW,QAAuD,CAAC;AAEhF,4DAA4D;AAC5D,eAAO,MAAM,gBAAgB,aAEyF,CAAC;AAEvH,eAAO,MAAM,mBAAmB;;;;iBAK9B,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;iBAK9B,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;iBAIhC,CAAC;AAEH,wCAAwC;AACxC,eAAO,MAAM,gBAAgB;;;;;;;;;;;2BAI3B,CAAC;AAEH,gGAAgG;AAChG,eAAO,MAAM,kBAAkB;;;;;;;;;;;4BA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