@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
@@ -1,6 +1,12 @@
1
+ // packages/core/src/registry/registry.template.ts
1
2
  /**
2
- * Recursively serializes a value to a TypeScript object literal string.
3
- * Used by generateRegistryFile to produce human-readable .ts output.
3
+ * @brief Recursively serializes a value to a TypeScript object literal string.
4
+ *
5
+ * Used by `generateRegistryFile` to produce human-readable `.ts` output.
6
+ *
7
+ * @param value - Value to serialize. Objects, arrays, strings, numbers, booleans and null are written as literals.
8
+ * @param depth - Nesting level of `value`, used for indentation.
9
+ * @returns Source text of the literal.
4
10
  */
5
11
  export function stringifyValue(value, depth = 0) {
6
12
  const indent = " ".repeat(depth);
@@ -33,11 +39,12 @@ export function stringifyValue(value, depth = 0) {
33
39
  return String(value);
34
40
  }
35
41
  /**
36
- * Generates the full content of a typed .ts registry manifest file.
42
+ * @brief Generates the full content of a typed `.ts` registry manifest file.
37
43
  *
38
- * @param entries - The registry entries to serialize
39
- * @param typeName - TypeScript type name for the `satisfies` clause
40
- * @param importFrom - Package to import the type from
44
+ * @param entries - Registry entries to serialize, by key.
45
+ * @param typeName - TypeScript type name for the `satisfies` clause, e.g. `G3nerateRegistry`.
46
+ * @param importFrom - Package the type is imported from, e.g. `@g3nomaly/g3nerate`.
47
+ * @returns Source text of the file, ending with a newline.
41
48
  *
42
49
  * @example
43
50
  * generateRegistryFile(entries, "G3nerateRegistry", "@g3nomaly/g3nerate")
@@ -1 +1 @@
1
- {"version":3,"file":"registry.template.js","sourceRoot":"","sources":["../../src/registry/registry.template.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,KAAc,EAAE,KAAK,GAAG,CAAC;IACtD,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;IACjC,MAAM,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,CAAA;IAE1C,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,MAAM,CAAA;IACjC,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,WAAW,CAAA;IAC3C,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;IAC3D,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,SAAS;QAAE,OAAO,MAAM,CAAC,KAAK,CAAC,CAAA;IAEjF,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,IAAI,CAAA;QACnC,MAAM,KAAK,GAAG,KAAK;aAChB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,WAAW,GAAG,cAAc,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,EAAE,CAAC;aAC3D,IAAI,CAAC,KAAK,CAAC,CAAA;QACd,OAAO,MAAM,KAAK,MAAM,MAAM,GAAG,CAAA;IACnC,CAAC;IAED,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,KAAgC,CAAC,CAAA;QAChE,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,IAAI,CAAA;QACrC,MAAM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E,KAAK,GAAG,CAAC,CAAC,EAAE,CAAC;aACtF,IAAI,CAAC,KAAK,CAAC,CAAA;QACd,OAAO,MAAM,KAAK,MAAM,MAAM,GAAG,CAAA;IACnC,CAAC;IAED,OAAO,MAAM,CAAC,KAAK,CAAC,CAAA;AACtB,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,oBAAoB,CAClC,OAAgC,EAChC,QAAgB,EAChB,UAAkB;IAElB,MAAM,KAAK,GAAa,EAAE,CAAA;IAE1B,KAAK,CAAC,IAAI,CAAC,iBAAiB,QAAQ,YAAY,UAAU,GAAG,CAAC,CAAA;IAC9D,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IACd,KAAK,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAA;IAEvC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QACnD,KAAK,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,cAAc,CAAC,KAAK,EAAE,CAAC,CAAC,GAAG,CAAC,CAAA;IACtE,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,wBAAwB,QAAQ,EAAE,CAAC,CAAA;IAC9C,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IAEd,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACzB,CAAC"}
@@ -1,6 +1,11 @@
1
1
  import { z } from "zod";
2
2
  /**
3
- * Base file entry — extended by each package with their own `type` enum.
3
+ * @brief One file of a registry entry. Each package extends it with its own `type` values.
4
+ *
5
+ * @property path - Path of the file relative to the entry's folder.
6
+ * @property type - Kind of file, set by each package.
7
+ * @property hash - Content hash. Set at build or install time, absent in unbuilt source meta files.
8
+ * @property version - Version of the file. Set at build or install time, absent in unbuilt source meta files.
4
9
  */
5
10
  export declare const BaseFileEntrySchema: z.ZodObject<{
6
11
  path: z.ZodString;
@@ -8,9 +13,17 @@ export declare const BaseFileEntrySchema: z.ZodObject<{
8
13
  hash: z.ZodOptional<z.ZodString>;
9
14
  version: z.ZodOptional<z.ZodString>;
10
15
  }, z.core.$strip>;
16
+ /** One file of a registry entry, inferred from `BaseFileEntrySchema`. */
11
17
  export type BaseFileEntry = z.infer<typeof BaseFileEntrySchema>;
12
18
  /**
13
- * Base registry entry — extended by each package with their own fields.
19
+ * @brief One entry of a registry. Each package extends it with its own fields.
20
+ *
21
+ * @property name - Unique name of the entry.
22
+ * @property description - What the entry is for.
23
+ * @property version - Version of the entry.
24
+ * @property group - Display group for `ls`. Packages derive it when the registry is built or loaded.
25
+ * @property registryDependencies - Keys of entries this entry needs installed alongside it.
26
+ * @property files - Files that make up the entry. At least one.
14
27
  */
15
28
  export declare const BaseRegistryEntrySchema: z.ZodObject<{
16
29
  name: z.ZodString;
@@ -25,9 +38,10 @@ export declare const BaseRegistryEntrySchema: z.ZodObject<{
25
38
  version: z.ZodOptional<z.ZodString>;
26
39
  }, z.core.$strip>>;
27
40
  }, z.core.$strip>;
41
+ /** One registry entry, inferred from `BaseRegistryEntrySchema`. */
28
42
  export type BaseRegistryEntry = z.infer<typeof BaseRegistryEntrySchema>;
29
43
  /**
30
- * Generic registry map — key → entry.
44
+ * Registry map from key to entry.
31
45
  */
32
46
  export type BaseRegistry<T extends BaseRegistryEntry = BaseRegistryEntry> = Record<string, T>;
33
47
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/registry/types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB;;GAEG;AACH,eAAO,MAAM,mBAAmB;;;;;iBAK9B,CAAA;AAEF,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAE/D;;GAEG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;iBASlC,CAAA;AAEF,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAA;AAEvE;;GAEG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,iBAAiB,GAAG,iBAAiB,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAA"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/registry/types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB;;;;;iBAK9B,CAAA;AAEF,yEAAyE;AACzE,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAE/D;;;;;;;;;GASG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;iBAOlC,CAAA;AAEF,mEAAmE;AACnE,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAA;AAEvE;;GAEG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,iBAAiB,GAAG,iBAAiB,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAA"}
@@ -1,24 +1,34 @@
1
1
  // packages/core/src/registry/types.ts
2
2
  import { z } from "zod";
3
3
  /**
4
- * Base file entry — extended by each package with their own `type` enum.
4
+ * @brief One file of a registry entry. Each package extends it with its own `type` values.
5
+ *
6
+ * @property path - Path of the file relative to the entry's folder.
7
+ * @property type - Kind of file, set by each package.
8
+ * @property hash - Content hash. Set at build or install time, absent in unbuilt source meta files.
9
+ * @property version - Version of the file. Set at build or install time, absent in unbuilt source meta files.
5
10
  */
6
11
  export const BaseFileEntrySchema = z.object({
7
12
  path: z.string().min(1),
8
13
  type: z.string(),
9
- hash: z.string().min(1).optional(), // populated at build/install time, absent in unbuilt source meta files
10
- version: z.string().min(1).optional(), // populated at build/install time, absent in unbuilt source meta files
14
+ hash: z.string().min(1).optional(),
15
+ version: z.string().min(1).optional(),
11
16
  });
12
17
  /**
13
- * Base registry entry — extended by each package with their own fields.
18
+ * @brief One entry of a registry. Each package extends it with its own fields.
19
+ *
20
+ * @property name - Unique name of the entry.
21
+ * @property description - What the entry is for.
22
+ * @property version - Version of the entry.
23
+ * @property group - Display group for `ls`. Packages derive it when the registry is built or loaded.
24
+ * @property registryDependencies - Keys of entries this entry needs installed alongside it.
25
+ * @property files - Files that make up the entry. At least one.
14
26
  */
15
27
  export const BaseRegistryEntrySchema = z.object({
16
28
  name: z.string().min(1),
17
29
  description: z.string().optional(),
18
30
  version: z.string().optional(),
19
- /** Display group for `ls`; packages derive it at registry build/load time */
20
31
  group: z.string().optional(),
21
- /** Keys of entries this entry needs installed alongside it */
22
32
  registryDependencies: z.array(z.string().min(1)).optional(),
23
33
  files: z.array(BaseFileEntrySchema).min(1),
24
34
  });
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/registry/types.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,IAAI,EAAK,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1B,IAAI,EAAK,CAAC,CAAC,MAAM,EAAE;IACnB,IAAI,EAAK,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,EAAE,uEAAuE;IAC9G,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,EAAE,uEAAuE;CAC/G,CAAC,CAAA;AAIF;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CA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vB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAClC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC9B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,oBAAoB,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IAC3D,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;CAC3C,CAAC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/security/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/security/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC"}
@@ -1,2 +1,3 @@
1
+ // packages/core/src/security/index.ts
1
2
  export { getSafeObject } from "./securityParser";
2
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/security/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/security/index.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC"}
@@ -1,14 +1,15 @@
1
1
  import type { ZodType, z } from "zod";
2
2
  /**
3
- * Safely parses a TypeScript file that has a default export object literal.
4
- * Transpiles the file, extracts the object literal via regex, evaluates it
5
- * inside a sandboxed Worker with a timeout, then validates with the provided
6
- * Zod schema.
3
+ * @brief Parses a TypeScript file that has a default export object literal, without running it in the main thread.
7
4
  *
8
- * @param filePath - Absolute path to the .ts file to parse
9
- * @param schema - Zod schema to validate the extracted object against
10
- * @param timeoutMs - Worker timeout in milliseconds (default: 1000)
11
- * @returns Validated, typed object
5
+ * Transpiles the file, extracts the object literal with a regex, evaluates it in a sandboxed Worker with a
6
+ * timeout, then validates the result with `schema`.
7
+ *
8
+ * @param filePath - Absolute path to the `.ts` file to parse.
9
+ * @param schema - Zod schema the extracted object must match.
10
+ * @param timeoutMs - Worker timeout in milliseconds.
11
+ * @returns Validated object, typed by `schema`.
12
+ * @throws {Error} When static analysis blocks the source, no object literal is found, the worker fails or times out, or validation fails.
12
13
  */
13
14
  export declare function getSafeObject<TSchema extends ZodType>(filePath: string, schema: TSchema, timeoutMs?: number): Promise<z.infer<TSchema>>;
14
15
  //# sourceMappingURL=securityParser.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"securityParser.d.ts","sourceRoot":"","sources":["../../src/security/securityParser.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAEtC;;;;;;;;;;GAUG;AACH,wBAAsB,aAAa,CAAC,OAAO,SAAS,OAAO,EACzD,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,OAAO,EACf,SAAS,SAAO,GACf,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAkG3B"}
1
+ {"version":3,"file":"securityParser.d.ts","sourceRoot":"","sources":["../../src/security/securityParser.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAEtC;;;;;;;;;;;GAWG;AACH,wBAAsB,aAAa,CAAC,OAAO,SAAS,OAAO,EACzD,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,OAAO,EACf,SAAS,SAAO,GACf,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAsF3B"}
@@ -1,47 +1,37 @@
1
1
  // packages/core/src/security/securityParser.ts
2
2
  import { Transpiler } from "bun";
3
3
  /**
4
- * Safely parses a TypeScript file that has a default export object literal.
5
- * Transpiles the file, extracts the object literal via regex, evaluates it
6
- * inside a sandboxed Worker with a timeout, then validates with the provided
7
- * Zod schema.
4
+ * @brief Parses a TypeScript file that has a default export object literal, without running it in the main thread.
8
5
  *
9
- * @param filePath - Absolute path to the .ts file to parse
10
- * @param schema - Zod schema to validate the extracted object against
11
- * @param timeoutMs - Worker timeout in milliseconds (default: 1000)
12
- * @returns Validated, typed object
6
+ * Transpiles the file, extracts the object literal with a regex, evaluates it in a sandboxed Worker with a
7
+ * timeout, then validates the result with `schema`.
8
+ *
9
+ * @param filePath - Absolute path to the `.ts` file to parse.
10
+ * @param schema - Zod schema the extracted object must match.
11
+ * @param timeoutMs - Worker timeout in milliseconds.
12
+ * @returns Validated object, typed by `schema`.
13
+ * @throws {Error} When static analysis blocks the source, no object literal is found, the worker fails or times out, or validation fails.
13
14
  */
14
15
  export async function getSafeObject(filePath, schema, timeoutMs = 1000) {
15
16
  const file = Bun.file(filePath);
16
17
  const rawContent = await file.text();
17
18
  const transpiler = new Transpiler({ loader: "ts" });
18
19
  const jsCode = transpiler.transformSync(rawContent);
19
- // ---------------------------------------------------------------------------
20
- // Pre-eval static analysis
21
- // Catches attacks that are undetectable at runtime because they complete
22
- // successfully before the sanitiser sees any output.
23
- // ---------------------------------------------------------------------------
20
+ // Static analysis runs before evaluation, since some attacks finish before the sanitiser sees any output.
24
21
  const DANGEROUS_PATTERNS = [
25
22
  [/\bimport\s*\(/, "dynamic import()"],
26
23
  [/\bimport\.meta\b/, "import.meta"],
27
24
  [/\bnew\s+Worker\b/, "Worker construction"],
28
25
  [/\beval\s*\(/, "eval()"],
29
26
  [/\.constructor\s*\.\s*constructor/, "constructor.constructor chain"],
30
- // deep-object.meta.ts: IIFE builds 100k nested object literals in a loop.
31
- // Object literal construction bypasses any runtime stub (the Object()
32
- // constructor is not called for `{}`), so the only reliable catch is
33
- // source-level: reject any for/while loop that contains an object literal.
34
- // Pattern: a for(...) or while(...) body that contains `{` (object/block).
27
+ // Object literals skip the Object() constructor, so loops that build objects are rejected in the source.
35
28
  [/\bfor\s*\([\s\S]{0,200}?\)\s*\{[\s\S]{0,500}?\bnested\b/,
36
29
  "deep object construction loop"],
37
- // Broader: any loop body that reassigns via `= {` (obj = { ... })
38
30
  [/\bfor\s*\([^)]*\)[^{]*\{[^}]*=\s*\{/,
39
31
  "object-building loop"],
40
32
  [/\bwhile\s*\([^)]*\)[^{]*\{[^}]*=\s*\{/,
41
33
  "object-building loop"],
42
- // regex-bomb.meta.ts: uses a regex *literal* /(a+)+$/ — the RegExp constructor
43
- // stub in the worker never fires for literals. Detect nested quantifiers
44
- // statically: pattern (x+)+ or (x*)* or (x+)* are canonical ReDoS forms.
34
+ // Regex literals bypass the RegExp stub in the worker, so nested quantifiers such as (x+)+ are rejected in the source.
45
35
  [/\/[^/]*\([^)]*[+*]\)[+*]/, "catastrophic regex literal (nested quantifier)"],
46
36
  ];
47
37
  for (const [pattern, label] of DANGEROUS_PATTERNS) {
@@ -1 +1 @@
1
- {"version":3,"file":"securityParser.js","sourceRoot":"","sources":["../../src/security/securityParser.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAGjC;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,QAAgB,EAChB,MAAe,EACf,SAAS,GAAG,IAAI;IAEhB,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAChC,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;IAErC,MAAM,UAAU,GAAG,IAAI,UAAU,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;IACpD,MAAM,MAAM,GAAG,UAAU,CAAC,aAAa,CAAC,UAAU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,CAAC;QAEF,MAAM,CAAC,OAAO,GAAG,CAAC,GAAe,EAAE,EAAE;YACnC,YAAY,CAAC,OAAO,CAAC,CAAC;YACtB,MAAM,CAAC,SAAS,EAAE,CAAC;YACnB,GAAG,CAAC,IAAI,KAAK,CAAC,oBAAoB,QAAQ,KAAK,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;QACjE,CAAC,CAAC;QAEF,MAAM,CAAC,WAAW,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IACxC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CACb,gCAAgC,QAAQ,MAAM,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,CACrE,CAAC;IACJ,CAAC;IAED,OAAO,MAAM,CAAC,IAAwB,CAAC;AACzC,CAAC"}
@@ -3,6 +3,17 @@ declare const MAX_DEPTH = 20;
3
3
  declare const MAX_KEYS = 1000;
4
4
  declare const MAX_STRLEN = 100000;
5
5
  declare let totalKeys: number;
6
+ /**
7
+ * @brief Copies evaluated sandbox data into plain values, rejecting anything that can carry code, memory or stacks.
8
+ *
9
+ * Getters and setters are dropped without running them.
10
+ *
11
+ * @param value - Value to copy. Usually the result of the sandbox evaluation.
12
+ * @param depth - Current nesting depth, starting at 0.
13
+ * @returns Plain copy of `value`.
14
+ * @throws {Error} When the value nests too deep, has too many keys, is a function, symbol, RegExp, buffer, error,
15
+ * promise or non-plain object, or is a string that is too long or looks like a stack trace.
16
+ */
6
17
  declare function sanitise(value: unknown, depth?: number): unknown;
7
18
  declare const SANDBOX_PREAMBLE = "\n \"use strict\";\n\n const process = undefined;\n const global = undefined;\n const globalThis = Object.create(null); // isolated dummy \u2014 writes succeed but go nowhere\n const module = undefined;\n const require = undefined;\n const __dirname = undefined;\n const __filename = undefined;\n const importScripts = undefined;\n const Function = undefined;\n const Reflect = undefined;\n const Proxy = undefined;\n\n // Stub ArrayBuffer \u2014 catches IIFE allocation bombs before they run.\n const ArrayBuffer = function() {\n throw new RangeError(\"ArrayBuffer construction is not allowed in meta files\");\n };\n\n // Stub RegExp constructor \u2014 catches IIFE regex bombs constructed via\n // new RegExp(...) or RegExp(...). Regex *literals* are a different path\n // (they don't call the RegExp constructor at parse time) but executing\n // .match()/.exec() on them still goes through the engine's regex executor.\n // The Worker timeout is the backstop for literal-based regex bombs.\n const RegExp = function() {\n throw new Error(\"RegExp construction is not allowed in meta files\");\n };\n";
8
19
  //# sourceMappingURL=securityWorker.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"securityWorker.d.ts","sourceRoot":"","sources":["../../src/security/securityWorker.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,MAAM,EAAsB,0BAA0B,CAAC;AAM7D,QAAA,MAAM,SAAS,KAAM,CAAC;AACtB,QAAA,MAAM,QAAQ,OAAU,CAAC;AACzB,QAAA,MAAM,UAAU,SAAU,CAAC;AAC3B,QAAA,IAAM,SAAS,QAAK,CAAC;AAErB,iBAAS,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,SAAI,GAAG,OAAO,CAwEpD;AAwCD,QAAA,MAAM,gBAAgB,uqCA4BrB,CAAC"}
1
+ {"version":3,"file":"securityWorker.d.ts","sourceRoot":"","sources":["../../src/security/securityWorker.ts"],"names":[],"mappings":"AACA,QAAA,MAAM,MAAM,EAAsB,0BAA0B,CAAC;AAM7D,QAAA,MAAM,SAAS,KAAM,CAAC;AACtB,QAAA,MAAM,QAAQ,OAAU,CAAC;AACzB,QAAA,MAAM,UAAU,SAAU,CAAC;AAC3B,QAAA,IAAM,SAAS,QAAK,CAAC;AAErB;;;;;;;;;;GAUG;AACH,iBAAS,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,SAAI,GAAG,OAAO,CAoEpD;AAWD,QAAA,MAAM,gBAAgB,uqCA4BrB,CAAC"}
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ // packages/core/src/security/securityWorker.ts
2
3
  const worker = self;
3
4
  // ---------------------------------------------------------------------------
4
5
  // Deep object sanitiser
@@ -7,6 +8,17 @@ const MAX_DEPTH = 20;
7
8
  const MAX_KEYS = 1_000;
8
9
  const MAX_STRLEN = 100_000;
9
10
  let totalKeys = 0;
11
+ /**
12
+ * @brief Copies evaluated sandbox data into plain values, rejecting anything that can carry code, memory or stacks.
13
+ *
14
+ * Getters and setters are dropped without running them.
15
+ *
16
+ * @param value - Value to copy. Usually the result of the sandbox evaluation.
17
+ * @param depth - Current nesting depth, starting at 0.
18
+ * @returns Plain copy of `value`.
19
+ * @throws {Error} When the value nests too deep, has too many keys, is a function, symbol, RegExp, buffer, error,
20
+ * promise or non-plain object, or is a string that is too long or looks like a stack trace.
21
+ */
10
22
  function sanitise(value, depth = 0) {
11
23
  if (depth > MAX_DEPTH) {
12
24
  throw new Error(`Object exceeds maximum nesting depth (${MAX_DEPTH})`);
@@ -48,8 +60,6 @@ function sanitise(value, depth = 0) {
48
60
  throw new Error("Object exceeds maximum key/element count");
49
61
  const desc = descriptors[key];
50
62
  if (desc.get || desc.set) {
51
- // Silently skip getter/setter properties — the getter-side-effect test
52
- // expects a clean resolve and verifies the side effect did not happen.
53
63
  continue;
54
64
  }
55
65
  out[key] = sanitise(value[key], depth + 1);
@@ -60,9 +70,7 @@ function sanitise(value, depth = 0) {
60
70
  if (value.length > MAX_STRLEN) {
61
71
  throw new Error(`String value exceeds maximum length (${MAX_STRLEN})`);
62
72
  }
63
- // Reject strings that look like captured error stack traces.
64
- // error-stack.meta.ts catches an Error and returns e.stack as a plain
65
- // string — detectable by the " at " stack frame marker.
73
+ // A stack frame line starts with four spaces and "at ".
66
74
  if (/\n {4}at /.test(value)) {
67
75
  throw new Error("String value appears to contain a stack trace");
68
76
  }
@@ -72,39 +80,10 @@ function sanitise(value, depth = 0) {
72
80
  // ---------------------------------------------------------------------------
73
81
  // Resource-limit stubs injected into the sandbox
74
82
  //
75
- // IIFEs run during object construction, before our sanitise() pass sees the
76
- // result. We stub dangerous builtins so they throw at the point of the call.
77
- //
78
- // array-buffer.meta.ts → new ArrayBuffer(1e9) — stubbed below
79
- // regex-bomb.meta.ts → /(a+)+$/.exec(str) — stubbed via RegExp
80
- // deep-object.meta.ts → 100k nested { nested: obj } literals
81
- // Object literals bypass the Object() constructor so
82
- // they cannot be intercepted via a stub. Instead we
83
- // cap total object allocations with a counter in the
84
- // Object stub for `new Object()` / `Object.assign`
85
- // style calls, AND we rely on the IIFE loop itself
86
- // being detectable via a loop-iteration counter.
87
- //
88
- // The loop counter trick: we inject a global __iterCount variable into the
89
- // sandbox and wrap the sandbox body so that — via a Proxy on the iteration
90
- // variable — we detect runaway loops. However, this is complex and fragile.
91
- //
92
- // Simpler reliable approach for deep-object: the fixture runs a for-loop
93
- // 100,000 times. We shadow the Number constructor and use a Proxy on the
94
- // iteration space? No — object literals are truly uninterceptable at the
95
- // VM level without a custom realm.
96
- //
97
- // Pragmatic solution: raise a hard iteration budget by injecting a
98
- // __checkBudget() call... but we can't inject into the transpiled fixture.
99
- //
100
- // FINAL approach: use a SharedArrayBuffer + Atomics watchdog from the
101
- // parent thread to measure wall-clock time inside the worker, and terminate
102
- // if the IIFE phase takes too long. Since we already have a Worker timeout,
103
- // the deep-object IIFE completing in 6ms means it's genuinely fast — the
104
- // nesting is built but immediately discarded and the string is returned.
105
- //
106
- // The ONLY reliable fix for deep-object is to reject the *input source* via
107
- // static analysis in securityParser.ts before it reaches the worker.
83
+ // IIFEs run during object construction, before sanitise() sees the result, so the
84
+ // builtins they can allocate or match with are stubbed to throw at the call.
85
+ // Object literals cannot be stubbed; loops that build them are rejected by
86
+ // static analysis in securityParser.ts.
108
87
  // ---------------------------------------------------------------------------
109
88
  const SANDBOX_PREAMBLE = `
110
89
  "use strict";
@@ -1 +1 @@
1
- {"version":3,"file":"securityWorker.js","sourceRoot":"","sources":["../../src/security/securityW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;QACd,MAAM,OAAO,GAAG,OAAO,EAAE,CAAC;QAC1B,MAAM,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC;QAEnC,MAAM,CAAC,WAAW,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;IACxD,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,MAAM,WAAW,GAAG,CAAC,KAAK,EAAE,OAAO,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QACrE,MAAM,CAAC,WAAW,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC,CAAC;IAC7D,CAAC;AACH,CAAC,CAAC"}
@@ -1,14 +1,20 @@
1
1
  import type { SourceCheckout, SourceSpec } from "./types";
2
2
  /**
3
- * Resolves a source to a folder holding its files: a shallow clone for git,
4
- * an installed or downloaded package for npm, the folder itself for local.
3
+ * @brief Resolves a source to a folder holding its files: a shallow clone for git, an installed or downloaded package for npm, the folder itself for local.
5
4
  *
6
- * @param projectRoot - Absolute project root; local paths and the `node_modules` lookup start there
5
+ * @param source - Name and spec of the source to check out.
6
+ * @param projectRoot - Absolute project root. Local paths and the `node_modules` lookup start there.
7
+ * @returns Checkout of the source's folder.
7
8
  */
8
9
  export declare function checkoutSource(source: {
9
10
  name: string;
10
11
  spec: SourceSpec;
11
12
  }, projectRoot: string): Promise<SourceCheckout>;
12
- /** One line naming where a source comes from, e.g. `git https://github.com/me/skills.git#main`. */
13
+ /**
14
+ * @brief Names where a source comes from, in one line.
15
+ *
16
+ * @param spec - Spec to describe.
17
+ * @returns Text such as `git https://github.com/me/skills.git#main`.
18
+ */
13
19
  export declare function describeSource(spec: SourceSpec): string;
14
20
  //# sourceMappingURL=checkout.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"checkout.d.ts","sourceRoot":"","sources":["../../src/sources/checkout.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1D;;;;;GAKG;AACH,wBAAsB,cAAc,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,UAAU,CAAA;CAAE,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAO7H;AAED,mGAAmG;AACnG,wBAAgB,cAAc,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAMvD"}
1
+ {"version":3,"file":"checkout.d.ts","sourceRoot":"","sources":["../../src/sources/checkout.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1D;;;;;;GAMG;AACH,wBAAsB,cAAc,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,UAAU,CAAA;CAAE,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAO7H;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAMvD"}
@@ -3,10 +3,11 @@ import { checkoutGit } from "./git";
3
3
  import { checkoutLocal } from "./local";
4
4
  import { checkoutNpm } from "./npm";
5
5
  /**
6
- * Resolves a source to a folder holding its files: a shallow clone for git,
7
- * an installed or downloaded package for npm, the folder itself for local.
6
+ * @brief Resolves a source to a folder holding its files: a shallow clone for git, an installed or downloaded package for npm, the folder itself for local.
8
7
  *
9
- * @param projectRoot - Absolute project root; local paths and the `node_modules` lookup start there
8
+ * @param source - Name and spec of the source to check out.
9
+ * @param projectRoot - Absolute project root. Local paths and the `node_modules` lookup start there.
10
+ * @returns Checkout of the source's folder.
10
11
  */
11
12
  export async function checkoutSource(source, projectRoot) {
12
13
  const { name, spec } = source;
@@ -16,7 +17,12 @@ export async function checkoutSource(source, projectRoot) {
16
17
  case "local": return checkoutLocal(name, spec, projectRoot);
17
18
  }
18
19
  }
19
- /** One line naming where a source comes from, e.g. `git https://github.com/me/skills.git#main`. */
20
+ /**
21
+ * @brief Names where a source comes from, in one line.
22
+ *
23
+ * @param spec - Spec to describe.
24
+ * @returns Text such as `git https://github.com/me/skills.git#main`.
25
+ */
20
26
  export function describeSource(spec) {
21
27
  switch (spec.kind) {
22
28
  case "git": return `git ${spec.url}${spec.ref === undefined ? "" : `#${spec.ref}`}`;
@@ -1 +1 @@
1
- {"version":3,"file":"checkout.js","sourceRoot":"","sources":["../../src/sources/checkout.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAGpC;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,MAA0C,EAAE,WAAmB;IAClG,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC;IAC9B,QAAQ,IAAI,CAAC,IAAI,EAAE,CAAC;QAClB,KAAK,KAAK,EAAI,OAAO,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAC7C,KAAK,KAAK,EAAI,OAAO,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;QAC1D,KAAK,OAAO,EAAE,OAAO,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;IAC9D,CAAC;AACH,CAAC;AAED,mGAAmG;AACnG,MAAM,UAAU,cAAc,CAAC,IAAgB;IAC7C,QAAQ,IAAI,CAAC,IAAI,EAAE,CAAC;QAClB,KAAK,KAAK,EAAI,OAAO,OAAO,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,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IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;QACtF,KAAK,KAAK,EAAI,OAAO,OAAO,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC;QAClG,KAAK,OAAO,EAAE,OAAO,SAAS,IAAI,CAAC,IAAI,EAAE,CAAC;IAC5C,CAAC;AACH,CAAC"}
@@ -1,9 +1,11 @@
1
1
  import type { GitSourceSpec, SourceCheckout } from "./types";
2
2
  /**
3
- * Shallow-clones a git source into a temporary folder, at its `ref` when set
4
- * and at the default branch otherwise, and resolves the commit it landed on.
3
+ * @brief Shallow-clones a git source into a temporary folder, at its `ref` when set and at the default branch otherwise.
5
4
  *
6
- * @throws when the clone fails, e.g. an unknown ref or an unreachable host
5
+ * @param name - Name of the source.
6
+ * @param spec - Git spec with the URL and optional ref.
7
+ * @returns Checkout with the commit the clone resolved to.
8
+ * @throws {Error} When the clone fails, e.g. an unknown ref or an unreachable host.
7
9
  */
8
10
  export declare function checkoutGit(name: string, spec: GitSourceSpec): Promise<SourceCheckout>;
9
11
  //# sourceMappingURL=git.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../src/sources/git.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE7D;;;;;GAKG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC,CAW5F"}
1
+ {"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../src/sources/git.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE7D;;;;;;;GAOG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC,CAW5F"}
@@ -1,10 +1,12 @@
1
1
  // packages/core/src/sources/git.ts
2
2
  import { createTempDir, removeDir, runCommand } from "./process";
3
3
  /**
4
- * Shallow-clones a git source into a temporary folder, at its `ref` when set
5
- * and at the default branch otherwise, and resolves the commit it landed on.
4
+ * @brief Shallow-clones a git source into a temporary folder, at its `ref` when set and at the default branch otherwise.
6
5
  *
7
- * @throws when the clone fails, e.g. an unknown ref or an unreachable host
6
+ * @param name - Name of the source.
7
+ * @param spec - Git spec with the URL and optional ref.
8
+ * @returns Checkout with the commit the clone resolved to.
9
+ * @throws {Error} When the clone fails, e.g. an unknown ref or an unreachable host.
8
10
  */
9
11
  export async function checkoutGit(name, spec) {
10
12
  const dir = createTempDir("git");
@@ -1 +1 @@
1
- {"version":3,"file":"git.js","sourceRoot":"","sources":["../../src/sources/git.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAGjE;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,IAAY,EAAE,IAAmB;IACjE,MAAM,GAAG,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;IACjC,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;QACjE,MAAM,UAAU,CAAC,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;QAC3F,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,CAAC,KAAK,EAAE,WAAW,EAAE,MAAM,CAAC,EAAE,G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IACd,CAAC;AACH,CAAC"}
@@ -1,10 +1,12 @@
1
1
  import type { LocalSourceSpec, SourceCheckout } from "./types";
2
2
  /**
3
- * Resolves a local source to its folder. Nothing is copied, so `dispose` is a
4
- * no-op and the version is the one in the folder's package.json, if any.
3
+ * @brief Resolves a local source to its folder. Nothing is copied, so `dispose` is a no-op.
5
4
  *
6
- * @param projectRoot - Absolute path a relative `spec.path` is resolved against
7
- * @throws when the folder does not exist
5
+ * @param name - Name of the source.
6
+ * @param spec - Local spec with the folder path.
7
+ * @param projectRoot - Absolute path a relative `spec.path` is resolved against.
8
+ * @returns Checkout whose version is read from the folder's package.json, if any.
9
+ * @throws {Error} When the folder does not exist.
8
10
  */
9
11
  export declare function checkoutLocal(name: string, spec: LocalSourceSpec, projectRoot: string): SourceCheckout;
10
12
  //# sourceMappingURL=local.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"local.d.ts","sourceRoot":"","sources":["../../src/sources/local.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE/D;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,GAAG,cAAc,CAMtG"}
1
+ {"version":3,"file":"local.d.ts","sourceRoot":"","sources":["../../src/sources/local.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE/D;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,GAAG,cAAc,CAMtG"}
@@ -4,11 +4,13 @@ import path from "node:path";
4
4
  import { expandHome } from "./parse";
5
5
  import { readPackageVersion } from "./packageJson";
6
6
  /**
7
- * Resolves a local source to its folder. Nothing is copied, so `dispose` is a
8
- * no-op and the version is the one in the folder's package.json, if any.
7
+ * @brief Resolves a local source to its folder. Nothing is copied, so `dispose` is a no-op.
9
8
  *
10
- * @param projectRoot - Absolute path a relative `spec.path` is resolved against
11
- * @throws when the folder does not exist
9
+ * @param name - Name of the source.
10
+ * @param spec - Local spec with the folder path.
11
+ * @param projectRoot - Absolute path a relative `spec.path` is resolved against.
12
+ * @returns Checkout whose version is read from the folder's package.json, if any.
13
+ * @throws {Error} When the folder does not exist.
12
14
  */
13
15
  export function checkoutLocal(name, spec, projectRoot) {
14
16
  const dir = path.resolve(projectRoot, expandHome(spec.path));
@@ -1 +1 @@
1
- {"version":3,"file":"local.js","sourceRoot":"","sources":["../../src/sources/local.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAGnD;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,IAAY,EAAE,IAAqB,EAAE,WAAmB;IACpF,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAC7D,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC;QAC3D,MAAM,IAAI,KAAK,CAAC,GAAG,GAAG,kBAAkB,CAAC,CAAC;IAC5C,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,kBAAkB,CAAC,GAAG,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,GAAE,CAAC,EAAE,CAAC;AAClF,CAAC"}
1
+ {"version":3,"file":"local.js","sourceRoot":"","sources":["../../src/sources/local.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAGnD;;;;;;;;GAQG;AACH,MAAM,UAAU,aAAa,CAAC,IAAY,EAAE,IAAqB,EAAE,WAAmB;IACpF,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAC7D,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC;QAC3D,MAAM,IAAI,KAAK,CAAC,GAAG,GAAG,kBAAkB,CAAC,CAAC;IAC5C,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,kBAAkB,CAAC,GAAG,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,GAAE,CAAC,EAAE,CAAC;AAClF,CAAC"}
@@ -1,13 +1,16 @@
1
1
  import type { NpmSourceSpec, SourceCheckout } from "./types";
2
2
  /**
3
- * Resolves an npm source to a folder. A copy in `node_modules` at or above the
4
- * project root is read in place when it satisfies `spec.version` (any copy
5
- * does when no version is set). Otherwise the package tarball is downloaded
6
- * from the registry in `npm_config_registry`, checked against its integrity
7
- * hash and unpacked into a temporary folder.
3
+ * @brief Resolves an npm source to a folder.
8
4
  *
9
- * @param projectRoot - Absolute folder the `node_modules` lookup starts from
10
- * @throws when the registry has no matching version or the download fails its integrity check
5
+ * A copy in `node_modules` at or above the project root is read in place when it satisfies `spec.version`
6
+ * (any copy does when no version is set). Otherwise the package tarball is downloaded from the registry
7
+ * in `npm_config_registry`, checked against its integrity hash and unpacked into a temporary folder.
8
+ *
9
+ * @param name - Name of the source.
10
+ * @param spec - npm spec with the package name and optional version.
11
+ * @param projectRoot - Absolute folder the `node_modules` lookup starts from.
12
+ * @returns Checkout of the package folder.
13
+ * @throws {Error} When the registry has no matching version or the download fails its integrity check.
11
14
  */
12
15
  export declare function checkoutNpm(name: string, spec: NpmSourceSpec, projectRoot: string): Promise<SourceCheckout>;
13
16
  //# sourceMappingURL=npm.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"npm.d.ts","sourceRoot":"","sources":["../../src/sources/npm.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAqB7D;;;;;;;;;GASG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAMjH"}
1
+ {"version":3,"file":"npm.d.ts","sourceRoot":"","sources":["../../src/sources/npm.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAsB7D;;;;;;;;;;;;GAYG;AACH,wBAAsB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAMjH"}