@g3nomaly/core 0.3.0 → 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 (247) hide show
  1. package/LICENSE +95 -0
  2. package/dist/cli/commands/add.d.ts +37 -0
  3. package/dist/cli/commands/add.d.ts.map +1 -0
  4. package/dist/cli/commands/add.js +99 -0
  5. package/dist/cli/commands/add.js.map +1 -0
  6. package/dist/cli/commands/conflict.d.ts +52 -0
  7. package/dist/cli/commands/conflict.d.ts.map +1 -0
  8. package/dist/cli/commands/conflict.js +88 -0
  9. package/dist/cli/commands/conflict.js.map +1 -0
  10. package/dist/cli/commands/installFromSources.d.ts +78 -0
  11. package/dist/cli/commands/installFromSources.d.ts.map +1 -0
  12. package/dist/cli/commands/installFromSources.js +187 -0
  13. package/dist/cli/commands/installFromSources.js.map +1 -0
  14. package/dist/cli/commands/ls.d.ts +26 -0
  15. package/dist/cli/commands/ls.d.ts.map +1 -0
  16. package/dist/cli/commands/ls.js +85 -0
  17. package/dist/cli/commands/ls.js.map +1 -0
  18. package/dist/cli/commands/remove.d.ts +19 -0
  19. package/dist/cli/commands/remove.d.ts.map +1 -0
  20. package/dist/cli/commands/remove.js +123 -0
  21. package/dist/cli/commands/remove.js.map +1 -0
  22. package/dist/cli/commands/sources.d.ts +69 -0
  23. package/dist/cli/commands/sources.d.ts.map +1 -0
  24. package/dist/cli/commands/sources.js +103 -0
  25. package/dist/cli/commands/sources.js.map +1 -0
  26. package/dist/cli/commands/update.d.ts +17 -0
  27. package/dist/cli/commands/update.d.ts.map +1 -0
  28. package/dist/cli/commands/update.js +110 -0
  29. package/dist/cli/commands/update.js.map +1 -0
  30. package/dist/cli/dialogue.d.ts +126 -0
  31. package/dist/cli/dialogue.d.ts.map +1 -0
  32. package/dist/cli/dialogue.js +156 -0
  33. package/dist/cli/dialogue.js.map +1 -0
  34. package/dist/cli/index.d.ts +19 -0
  35. package/dist/cli/index.d.ts.map +1 -0
  36. package/dist/cli/index.js +16 -0
  37. package/dist/cli/index.js.map +1 -0
  38. package/dist/cli/installDialogues.d.ts +23 -0
  39. package/dist/cli/installDialogues.d.ts.map +1 -0
  40. package/dist/cli/installDialogues.js +89 -0
  41. package/dist/cli/installDialogues.js.map +1 -0
  42. package/dist/cli/pick.d.ts +23 -0
  43. package/dist/cli/pick.d.ts.map +1 -0
  44. package/dist/cli/pick.js +44 -0
  45. package/dist/cli/pick.js.map +1 -0
  46. package/dist/cli/report.d.ts +58 -0
  47. package/dist/cli/report.d.ts.map +1 -0
  48. package/dist/cli/report.js +92 -0
  49. package/dist/cli/report.js.map +1 -0
  50. package/dist/cli/theme.d.ts +27 -0
  51. package/dist/cli/theme.d.ts.map +1 -0
  52. package/dist/cli/theme.js +29 -0
  53. package/dist/cli/theme.js.map +1 -0
  54. package/dist/cli/types.d.ts +96 -0
  55. package/dist/cli/types.d.ts.map +1 -0
  56. package/dist/cli/types.js +2 -0
  57. package/dist/cli/types.js.map +1 -0
  58. package/dist/config/config.d.ts +55 -0
  59. package/dist/config/config.d.ts.map +1 -0
  60. package/dist/config/config.js +107 -0
  61. package/dist/config/config.js.map +1 -0
  62. package/dist/config/index.d.ts +4 -0
  63. package/dist/config/index.d.ts.map +1 -0
  64. package/dist/config/index.js +3 -0
  65. package/dist/config/index.js.map +1 -0
  66. package/dist/config/types.d.ts +182 -0
  67. package/dist/config/types.d.ts.map +1 -0
  68. package/dist/config/types.js +51 -0
  69. package/dist/config/types.js.map +1 -0
  70. package/dist/hash/hash.d.ts +23 -0
  71. package/dist/hash/hash.d.ts.map +1 -0
  72. package/dist/hash/hash.js +43 -0
  73. package/dist/hash/hash.js.map +1 -0
  74. package/dist/hash/index.d.ts +2 -0
  75. package/dist/hash/index.d.ts.map +1 -0
  76. package/dist/hash/index.js +3 -0
  77. package/dist/hash/index.js.map +1 -0
  78. package/dist/index.d.ts +1 -0
  79. package/dist/index.d.ts.map +1 -0
  80. package/dist/index.js +3 -0
  81. package/dist/index.js.map +1 -0
  82. package/dist/installer/classify.d.ts +33 -0
  83. package/dist/installer/classify.d.ts.map +1 -0
  84. package/dist/installer/classify.js +82 -0
  85. package/dist/installer/classify.js.map +1 -0
  86. package/dist/installer/files.d.ts +19 -0
  87. package/dist/installer/files.d.ts.map +1 -0
  88. package/dist/installer/files.js +23 -0
  89. package/dist/installer/files.js.map +1 -0
  90. package/dist/installer/index.d.ts +19 -0
  91. package/dist/installer/index.d.ts.map +1 -0
  92. package/dist/installer/index.js +14 -0
  93. package/dist/installer/index.js.map +1 -0
  94. package/dist/installer/install.d.ts +25 -0
  95. package/dist/installer/install.d.ts.map +1 -0
  96. package/dist/installer/install.js +74 -0
  97. package/dist/installer/install.js.map +1 -0
  98. package/dist/installer/io.d.ts +9 -0
  99. package/dist/installer/io.d.ts.map +1 -0
  100. package/dist/installer/io.js +23 -0
  101. package/dist/installer/io.js.map +1 -0
  102. package/dist/installer/manifest.d.ts +69 -0
  103. package/dist/installer/manifest.d.ts.map +1 -0
  104. package/dist/installer/manifest.js +70 -0
  105. package/dist/installer/manifest.js.map +1 -0
  106. package/dist/installer/manifestSources.d.ts +32 -0
  107. package/dist/installer/manifestSources.d.ts.map +1 -0
  108. package/dist/installer/manifestSources.js +50 -0
  109. package/dist/installer/manifestSources.js.map +1 -0
  110. package/dist/installer/marketplace.d.ts +46 -0
  111. package/dist/installer/marketplace.d.ts.map +1 -0
  112. package/dist/installer/marketplace.js +72 -0
  113. package/dist/installer/marketplace.js.map +1 -0
  114. package/dist/installer/origin.d.ts +59 -0
  115. package/dist/installer/origin.d.ts.map +1 -0
  116. package/dist/installer/origin.js +29 -0
  117. package/dist/installer/origin.js.map +1 -0
  118. package/dist/installer/remove.d.ts +26 -0
  119. package/dist/installer/remove.d.ts.map +1 -0
  120. package/dist/installer/remove.js +49 -0
  121. package/dist/installer/remove.js.map +1 -0
  122. package/dist/installer/resolve.d.ts +127 -0
  123. package/dist/installer/resolve.d.ts.map +1 -0
  124. package/dist/installer/resolve.js +251 -0
  125. package/dist/installer/resolve.js.map +1 -0
  126. package/dist/installer/sourceRegistry.d.ts +96 -0
  127. package/dist/installer/sourceRegistry.d.ts.map +1 -0
  128. package/dist/installer/sourceRegistry.js +86 -0
  129. package/dist/installer/sourceRegistry.js.map +1 -0
  130. package/dist/installer/types.d.ts +133 -0
  131. package/dist/installer/types.d.ts.map +1 -0
  132. package/dist/installer/types.js +31 -0
  133. package/dist/installer/types.js.map +1 -0
  134. package/dist/registry/index.d.ts +8 -0
  135. package/dist/registry/index.d.ts.map +1 -0
  136. package/dist/registry/index.js +9 -0
  137. package/dist/registry/index.js.map +1 -0
  138. package/dist/registry/registry.handlers.d.ts +16 -0
  139. package/dist/registry/registry.handlers.d.ts.map +1 -0
  140. package/dist/registry/registry.handlers.js +13 -0
  141. package/dist/registry/registry.handlers.js.map +1 -0
  142. package/dist/registry/registry.io.d.ts +38 -0
  143. package/dist/registry/registry.io.d.ts.map +1 -0
  144. package/dist/registry/registry.io.js +101 -0
  145. package/dist/registry/registry.io.js.map +1 -0
  146. package/dist/registry/registry.mutations.d.ts +19 -0
  147. package/dist/registry/registry.mutations.d.ts.map +1 -0
  148. package/dist/registry/registry.mutations.js +29 -0
  149. package/dist/registry/registry.mutations.js.map +1 -0
  150. package/dist/registry/registry.selectors.d.ts +68 -0
  151. package/dist/registry/registry.selectors.d.ts.map +1 -0
  152. package/dist/registry/registry.selectors.js +91 -0
  153. package/dist/registry/registry.selectors.js.map +1 -0
  154. package/dist/registry/registry.store.d.ts +47 -0
  155. package/dist/registry/registry.store.d.ts.map +1 -0
  156. package/dist/registry/registry.store.js +36 -0
  157. package/dist/registry/registry.store.js.map +1 -0
  158. package/dist/registry/registry.template.d.ts +29 -0
  159. package/dist/registry/registry.template.d.ts.map +1 -0
  160. package/dist/registry/registry.template.js +70 -0
  161. package/dist/registry/registry.template.js.map +1 -0
  162. package/dist/registry/types.d.ts +47 -0
  163. package/dist/registry/types.d.ts.map +1 -0
  164. package/dist/registry/types.js +35 -0
  165. package/dist/registry/types.js.map +1 -0
  166. package/dist/security/index.d.ts +2 -0
  167. package/dist/security/index.d.ts.map +1 -0
  168. package/dist/security/index.js +3 -0
  169. package/dist/security/index.js.map +1 -0
  170. package/dist/security/securityParser.d.ts +15 -0
  171. package/dist/security/securityParser.d.ts.map +1 -0
  172. package/dist/security/securityParser.js +79 -0
  173. package/dist/security/securityParser.js.map +1 -0
  174. package/dist/security/securityWorker.d.ts +19 -0
  175. package/dist/security/securityWorker.d.ts.map +1 -0
  176. package/dist/security/securityWorker.js +137 -0
  177. package/dist/security/securityWorker.js.map +1 -0
  178. package/dist/sources/checkout.d.ts +20 -0
  179. package/dist/sources/checkout.d.ts.map +1 -0
  180. package/dist/sources/checkout.js +33 -0
  181. package/dist/sources/checkout.js.map +1 -0
  182. package/dist/sources/git.d.ts +11 -0
  183. package/dist/sources/git.d.ts.map +1 -0
  184. package/dist/sources/git.js +24 -0
  185. package/dist/sources/git.js.map +1 -0
  186. package/dist/sources/index.d.ts +5 -0
  187. package/dist/sources/index.d.ts.map +1 -0
  188. package/dist/sources/index.js +6 -0
  189. package/dist/sources/index.js.map +1 -0
  190. package/dist/sources/local.d.ts +12 -0
  191. package/dist/sources/local.d.ts.map +1 -0
  192. package/dist/sources/local.js +22 -0
  193. package/dist/sources/local.js.map +1 -0
  194. package/dist/sources/npm.d.ts +16 -0
  195. package/dist/sources/npm.d.ts.map +1 -0
  196. package/dist/sources/npm.js +162 -0
  197. package/dist/sources/npm.js.map +1 -0
  198. package/dist/sources/packageJson.d.ts +3 -0
  199. package/dist/sources/packageJson.d.ts.map +1 -0
  200. package/dist/sources/packageJson.js +13 -0
  201. package/dist/sources/packageJson.js.map +1 -0
  202. package/dist/sources/parse.d.ts +42 -0
  203. package/dist/sources/parse.d.ts.map +1 -0
  204. package/dist/sources/parse.js +114 -0
  205. package/dist/sources/parse.js.map +1 -0
  206. package/dist/sources/process.d.ts +21 -0
  207. package/dist/sources/process.d.ts.map +1 -0
  208. package/dist/sources/process.js +46 -0
  209. package/dist/sources/process.js.map +1 -0
  210. package/dist/sources/register.d.ts +31 -0
  211. package/dist/sources/register.d.ts.map +1 -0
  212. package/dist/sources/register.js +52 -0
  213. package/dist/sources/register.js.map +1 -0
  214. package/dist/sources/types.d.ts +108 -0
  215. package/dist/sources/types.d.ts.map +1 -0
  216. package/dist/sources/types.js +53 -0
  217. package/dist/sources/types.js.map +1 -0
  218. package/dist/utils/errors.d.ts +8 -0
  219. package/dist/utils/errors.d.ts.map +1 -0
  220. package/dist/utils/errors.js +11 -0
  221. package/dist/utils/errors.js.map +1 -0
  222. package/dist/utils/index.d.ts +7 -0
  223. package/dist/utils/index.d.ts.map +1 -0
  224. package/dist/utils/index.js +7 -0
  225. package/dist/utils/index.js.map +1 -0
  226. package/dist/utils/merge.d.ts +12 -0
  227. package/dist/utils/merge.d.ts.map +1 -0
  228. package/dist/utils/merge.js +28 -0
  229. package/dist/utils/merge.js.map +1 -0
  230. package/dist/utils/packageMeta.d.ts +26 -0
  231. package/dist/utils/packageMeta.d.ts.map +1 -0
  232. package/dist/utils/packageMeta.js +24 -0
  233. package/dist/utils/packageMeta.js.map +1 -0
  234. package/dist/utils/paths.d.ts +27 -0
  235. package/dist/utils/paths.d.ts.map +1 -0
  236. package/dist/utils/paths.js +51 -0
  237. package/dist/utils/paths.js.map +1 -0
  238. package/dist/utils/prompt.d.ts +8 -0
  239. package/dist/utils/prompt.d.ts.map +1 -0
  240. package/dist/utils/prompt.js +13 -0
  241. package/dist/utils/prompt.js.map +1 -0
  242. package/dist/utils/version.d.ts +14 -0
  243. package/dist/utils/version.d.ts.map +1 -0
  244. package/dist/utils/version.js +140 -0
  245. package/dist/utils/version.js.map +1 -0
  246. package/package.json +64 -3
  247. package/README.md +0 -3
@@ -0,0 +1,89 @@
1
+ // packages/core/src/cli/installDialogues.ts
2
+ import { ConflictDecision } from "../installer/types";
3
+ import { StepKind } from "./dialogue";
4
+ /**
5
+ * @brief Restore, fork or skip an entry with local changes, for `add` and `update`; step id `conflict`, then
6
+ * `forkName` for the key of the fork.
7
+ */
8
+ export const conflictDialogue = {
9
+ steps: {
10
+ conflict: {
11
+ kind: StepKind.Select,
12
+ message: "{key} ({target}) has local changes. What would you like to do?",
13
+ choices: [
14
+ { value: ConflictDecision.Overwrite, label: "Restore: overwrite my changes with the source version" },
15
+ { value: ConflictDecision.Fork, label: "Fork: keep my changes as a local entry under a new name" },
16
+ { value: ConflictDecision.Keep, label: "Skip: leave my changes and ask again next time" },
17
+ ],
18
+ initial: ConflictDecision.Keep,
19
+ next: (answer) => (answer === ConflictDecision.Fork ? "forkName" : null),
20
+ },
21
+ forkName: {
22
+ kind: StepKind.Text,
23
+ message: "Name of the local entry:",
24
+ initial: (input) => input.forkName ?? "",
25
+ validate: (value) => (value === undefined || !/^\S+$/.test(value) ? "Enter a name without spaces" : undefined),
26
+ },
27
+ },
28
+ };
29
+ /** Keep or remove an entry with local changes, for `remove`; step id `conflict`. */
30
+ export const removeChangedDialogue = {
31
+ steps: {
32
+ conflict: {
33
+ kind: StepKind.Select,
34
+ message: "{key} ({target}) has local changes. What would you like to do?",
35
+ choices: [
36
+ { value: ConflictDecision.Keep, label: "Keep it: remove nothing" },
37
+ { value: ConflictDecision.Overwrite, label: "Remove it anyway, including my changes" },
38
+ ],
39
+ },
40
+ },
41
+ };
42
+ /** Whether to remove the installed entries that depend on one being removed; step id `cascade`. */
43
+ export const cascadeDialogue = {
44
+ steps: {
45
+ cascade: {
46
+ kind: StepKind.Confirm,
47
+ message: "Also remove {dependents}?",
48
+ initial: true,
49
+ },
50
+ },
51
+ };
52
+ /** Whether to remove an entry with files already missing on disk; step id `incomplete`. */
53
+ export const incompleteDialogue = {
54
+ steps: {
55
+ incomplete: {
56
+ kind: StepKind.Confirm,
57
+ message: "{key} ({target}) is missing {missing} on disk. Remove the rest and untrack it?",
58
+ initial: true,
59
+ },
60
+ },
61
+ };
62
+ /**
63
+ * @brief Builds the picker that asks which installed entries to remove.
64
+ *
65
+ * @param noun - What one entry is called, e.g. `skill`.
66
+ * @returns Dialogue with the step `selectEntries`.
67
+ */
68
+ export function selectRemovalDialogue(noun) {
69
+ return {
70
+ steps: {
71
+ selectEntries: {
72
+ kind: StepKind.MultiSelect,
73
+ message: `Select ${noun}s to remove:`,
74
+ choices: (input) => input.keyChoices ?? [],
75
+ },
76
+ },
77
+ };
78
+ }
79
+ /** Whether to go on when some names given to `update` are not installed; step id `entryNotFound`. */
80
+ export const notInstalledDialogue = {
81
+ steps: {
82
+ entryNotFound: {
83
+ kind: StepKind.Confirm,
84
+ message: "Not installed: {unknown}. Continue with the remaining selection?",
85
+ initial: false,
86
+ },
87
+ },
88
+ };
89
+ //# sourceMappingURL=installDialogues.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"installDialogues.js","sourceRoot":"","sources":["../../src/cli/installDialogues.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAItC;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAA2B;IACtD,KAAK,EAAE;QACL,QAAQ,EAAE;YACR,IAAI,EAAK,QAAQ,CAAC,MAAM;YACxB,OAAO,EAAE,gEAAgE;YACzE,OAAO,EAAE;gBACP,EAAE,KAAK,EAAE,gBAAgB,CAAC,SAAS,EAAE,KAAK,EAAE,uDAAuD,EAAE;gBACrG,EAAE,KAAK,EAAE,gBAAgB,CAAC,IAAI,EAAO,KAAK,EAAE,yDAAyD,EAAE;gBACvG,EAAE,KAAK,EAAE,gBAAgB,CAAC,IAAI,EAAO,KAAK,EAAE,gDAAgD,EAAE;aAC/F;YACD,OAAO,EAAE,gBAAgB,CAAC,IAAI;YAC9B,IAAI,EAAK,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,KAAK,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,CA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E;gBACb,IAAI,EAAK,QAAQ,CAAC,WAAW;gBAC7B,OAAO,EAAE,UAAU,IAAI,cAAc;gBACrC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU,IAAI,EAAE;aAC3C;SACF;KACF,CAAC;AACJ,CAAC;AAED,qGAAqG;AACrG,MAAM,CAAC,MAAM,oBAAoB,GAA2B;IAC1D,KAAK,EAAE;QACL,aAAa,EAAE;YACb,IAAI,EAAK,QAAQ,CAAC,OAAO;YACzB,OAAO,EAAE,kEAAkE;YAC3E,OAAO,EAAE,KAAK;SACf;KACF;CACF,CAAC"}
@@ -0,0 +1,23 @@
1
+ import type { OriginEntry } from "../installer/origin";
2
+ import type { SourceOffer } from "../installer/sourceRegistry";
3
+ import type { Dialogue, DialogueAnswers } from "./dialogue";
4
+ import type { InstallInput } from "./types";
5
+ /**
6
+ * @brief Builds the multi-select `pickOffers` asks through, by step id `selectEntries`.
7
+ *
8
+ * @param noun - What one entry is called, e.g. `skill`.
9
+ * @returns Dialogue with the step `selectEntries`.
10
+ */
11
+ export declare function selectEntriesDialogue(noun: string): Dialogue<InstallInput>;
12
+ /**
13
+ * @brief Asks which offers to install, each as `<key>@<source>`, so two sources
14
+ * offering one key stay apart. Exits when the prompt is cancelled.
15
+ *
16
+ * @param available - Offers to pick from.
17
+ * @param noun - What one entry is called, e.g. `skill`.
18
+ * @param answers - Preset answers by step id.
19
+ *
20
+ * @returns the picked requests, e.g. `["emphasise@g3n-skills"]`
21
+ */
22
+ export declare function pickOffers<T extends OriginEntry>(available: readonly SourceOffer<T>[], noun: string, answers?: DialogueAnswers): Promise<string[]>;
23
+ //# sourceMappingURL=pick.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pick.d.ts","sourceRoot":"","sources":["../../src/cli/pick.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAG/D,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAK5C;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAAC,YAAY,CAAC,CAU1E;AAED;;;;;;;;;GASG;AACH,wBAAsB,UAAU,CAAC,CAAC,SAAS,WAAW,EAAE,SAAS,EAAE,SAAS,WAAW,CAAC,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAQxJ"}
@@ -0,0 +1,44 @@
1
+ // packages/core/src/cli/pick.ts
2
+ import chalk from "chalk";
3
+ import { z } from "zod";
4
+ import { guardCancel } from "../utils/prompt";
5
+ import { StepKind, runDialogueValue } from "./dialogue";
6
+ import { c } from "./theme";
7
+ const PicksSchema = z.array(z.string());
8
+ /**
9
+ * @brief Builds the multi-select `pickOffers` asks through, by step id `selectEntries`.
10
+ *
11
+ * @param noun - What one entry is called, e.g. `skill`.
12
+ * @returns Dialogue with the step `selectEntries`.
13
+ */
14
+ export function selectEntriesDialogue(noun) {
15
+ return {
16
+ steps: {
17
+ selectEntries: {
18
+ kind: StepKind.MultiSelect,
19
+ message: `Select ${noun}s to install:`,
20
+ choices: (input) => input.keyChoices ?? [],
21
+ },
22
+ },
23
+ };
24
+ }
25
+ /**
26
+ * @brief Asks which offers to install, each as `<key>@<source>`, so two sources
27
+ * offering one key stay apart. Exits when the prompt is cancelled.
28
+ *
29
+ * @param available - Offers to pick from.
30
+ * @param noun - What one entry is called, e.g. `skill`.
31
+ * @param answers - Preset answers by step id.
32
+ *
33
+ * @returns the picked requests, e.g. `["emphasise@g3n-skills"]`
34
+ */
35
+ export async function pickOffers(available, noun, answers) {
36
+ const keyChoices = [...available]
37
+ .sort((a, b) => a.key.localeCompare(b.key) || a.entry.origin.source.localeCompare(b.entry.origin.source))
38
+ .map(({ key, entry }) => ({
39
+ value: `${key}@${entry.origin.source}`,
40
+ label: `${c.key(key)} ${chalk.dim(`@${entry.origin.source}`)} ${chalk.dim("—")} ${chalk.dim(entry.description ?? entry.name)}`,
41
+ }));
42
+ return PicksSchema.parse(guardCancel(await runDialogueValue(selectEntriesDialogue(noun), { keyChoices }, answers)) ?? []);
43
+ }
44
+ //# sourceMappingURL=pick.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pick.js","sourceRoot":"","sources":["../../src/cli/pick.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAGxD,OAAO,EAAE,CAAC,EAAE,MAAM,SAAS,CAAC;AAE5B,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;AAExC;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CAAC,IAAY;IAChD,OAAO;QACL,KAAK,EAAE;YACL,aAAa,EAAE;gBACb,IAAI,EAAK,QAAQ,CAAC,WAAW;gBAC7B,OAAO,EAAE,UAAU,IAAI,eAAe;gBACtC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU,IAAI,EAAE;aAC3C;SACF;KACF,CAAC;AACJ,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAwB,SAAoC,EAAE,IAAY,EAAE,OAAyB;IACnI,MAAM,UAAU,GAAG,CAAC,GAAG,SAAS,CAAC;SAC9B,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;SACxG,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;QACxB,KAAK,EAAE,GAAG,GAAG,IAAI,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE;QACtC,KAAK,EAAE,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,KAAK,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,WAAW,IAAI,KAAK,CAAC,IAAI,CAAC,EAAE;KACjI,CAAC,CAAC,CAAC;IACN,OAAO,WAAW,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,gBAAgB,CAAC,qBAAqB,CAAC,IAAI,CAAC,EAAE,EAAE,UAAU,EAAE,EAAE,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;AAC5H,CAAC"}
@@ -0,0 +1,58 @@
1
+ import type { OriginEntry } from "../installer/origin";
2
+ import type { SourceRegistry } from "../installer/sourceRegistry";
3
+ import type { Resolution } from "../installer/resolve";
4
+ import type { Dialogue, DialogueAnswers } from "./dialogue";
5
+ import type { InstallInput } from "./types";
6
+ /**
7
+ * @brief Prints every warning of a source registry and every source it could not read.
8
+ *
9
+ * @param registry - Registry whose warnings and failed sources are printed.
10
+ */
11
+ export declare function reportSourceRegistry<T extends OriginEntry>(registry: SourceRegistry<T>): void;
12
+ /**
13
+ * @brief Runs `read`, and on a throw prints its message and exits with code 1.
14
+ *
15
+ * @param read - Function to run.
16
+ * @returns What `read` returns.
17
+ */
18
+ export declare function orExit<T>(read: () => T): T;
19
+ /**
20
+ * @brief What `reportResolution` names in its messages.
21
+ *
22
+ * @property bin - Installer binary, e.g. `g3n-skills`.
23
+ * @property noun - What one entry is called, e.g. `skill`.
24
+ */
25
+ export interface ResolutionContext {
26
+ bin: string;
27
+ noun: string;
28
+ }
29
+ /**
30
+ * @brief Builds the confirm dialogue `reportResolution` asks through, by step id `entryNotFound`.
31
+ *
32
+ * @param noun - What one entry is called, e.g. `skill`.
33
+ * @returns Dialogue with the step `entryNotFound`.
34
+ */
35
+ export declare function entryNotFoundDialogue(noun: string): Dialogue<InstallInput>;
36
+ /**
37
+ * @brief Prints what a resolution could not settle and why each unnamed entry is in
38
+ * it. Exits on an ambiguous name; on unknown names, asks whether to go on
39
+ * with the rest and exits when the answer is no or nothing is left.
40
+ *
41
+ * @param resolution - Resolution to report.
42
+ * @param context - Installer binary and entry noun used in the messages.
43
+ * @param answers - Preset answers by step id.
44
+ */
45
+ export declare function reportResolution<T extends OriginEntry>(resolution: Resolution<T>, context: ResolutionContext, answers?: DialogueAnswers): Promise<void>;
46
+ /**
47
+ * @brief The sources narrowed to `only`, or all of them when it is absent. Exits
48
+ * naming the `source ls` command when no source has that name.
49
+ *
50
+ * @param sources - Sources to narrow.
51
+ * @param only - Name of the one source to keep, or `undefined` for all of them.
52
+ * @param bin - Installer binary for the hint, e.g. `g3n-skills`
53
+ * @returns The narrowed sources.
54
+ */
55
+ export declare function narrowSources<S extends {
56
+ name: string;
57
+ }>(sources: readonly S[], only: string | undefined, bin: string): S[];
58
+ //# sourceMappingURL=report.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report.d.ts","sourceRoot":"","sources":["../../src/cli/report.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAElE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAG5C;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,WAAW,EAAE,QAAQ,EAAE,cAAc,CAAC,CAAC,CAAC,GAAG,IAAI,CAG7F;AAED;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,CAO1C;AAED;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAG,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAAC,YAAY,CAAC,CAU1E;AAED;;;;;;;;GAQG;AACH,wBAAsB,gBAAgB,CAAC,CAAC,SAAS,WAAW,EAC1D,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,EACzB,OAAO,EAAE,iBAAiB,EAC1B,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,IAAI,CAAC,CAaf;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,EAAE,CAQ3H"}
@@ -0,0 +1,92 @@
1
+ import { errorMessage } from "../utils/errors";
2
+ import { StepKind, runDialogueValue } from "./dialogue";
3
+ import { c, lineError, lineInfo, lineWarn } from "./theme";
4
+ /**
5
+ * @brief Prints every warning of a source registry and every source it could not read.
6
+ *
7
+ * @param registry - Registry whose warnings and failed sources are printed.
8
+ */
9
+ export function reportSourceRegistry(registry) {
10
+ for (const warning of registry.warnings)
11
+ console.log(lineWarn(warning));
12
+ for (const failed of registry.failed)
13
+ console.log(lineWarn(`${c.key(failed.name)} could not be read: ${failed.error}`));
14
+ }
15
+ /**
16
+ * @brief Runs `read`, and on a throw prints its message and exits with code 1.
17
+ *
18
+ * @param read - Function to run.
19
+ * @returns What `read` returns.
20
+ */
21
+ export function orExit(read) {
22
+ try {
23
+ return read();
24
+ }
25
+ catch (error) {
26
+ console.error(lineError(errorMessage(error)));
27
+ process.exit(1);
28
+ }
29
+ }
30
+ /**
31
+ * @brief Builds the confirm dialogue `reportResolution` asks through, by step id `entryNotFound`.
32
+ *
33
+ * @param noun - What one entry is called, e.g. `skill`.
34
+ * @returns Dialogue with the step `entryNotFound`.
35
+ */
36
+ export function entryNotFoundDialogue(noun) {
37
+ return {
38
+ steps: {
39
+ entryNotFound: {
40
+ kind: StepKind.Confirm,
41
+ message: `Unknown ${noun}(s): {unknown}. Continue with the remaining selection?`,
42
+ initial: false,
43
+ },
44
+ },
45
+ };
46
+ }
47
+ /**
48
+ * @brief Prints what a resolution could not settle and why each unnamed entry is in
49
+ * it. Exits on an ambiguous name; on unknown names, asks whether to go on
50
+ * with the rest and exits when the answer is no or nothing is left.
51
+ *
52
+ * @param resolution - Resolution to report.
53
+ * @param context - Installer binary and entry noun used in the messages.
54
+ * @param answers - Preset answers by step id.
55
+ */
56
+ export async function reportResolution(resolution, context, answers) {
57
+ if (resolution.ambiguous.length > 0) {
58
+ for (const message of resolution.ambiguous)
59
+ console.error(lineError(message));
60
+ process.exit(1);
61
+ }
62
+ if (resolution.unknown.length > 0) {
63
+ const unknown = resolution.unknown.map((k) => c.key(k)).join(", ");
64
+ console.error(lineError(`Unknown ${context.noun}(s): ${unknown}. Run ${c.cmd(`${context.bin} ls`)} to see what the sources offer.`));
65
+ const proceed = resolution.entries.size > 0
66
+ && (await runDialogueValue(entryNotFoundDialogue(context.noun), { unknown }, answers)) === true;
67
+ if (!proceed)
68
+ process.exit(1);
69
+ }
70
+ for (const [key, why] of Object.entries(resolution.notes))
71
+ console.log(lineInfo(`${c.key(key)}: ${why}`));
72
+ }
73
+ /**
74
+ * @brief The sources narrowed to `only`, or all of them when it is absent. Exits
75
+ * naming the `source ls` command when no source has that name.
76
+ *
77
+ * @param sources - Sources to narrow.
78
+ * @param only - Name of the one source to keep, or `undefined` for all of them.
79
+ * @param bin - Installer binary for the hint, e.g. `g3n-skills`
80
+ * @returns The narrowed sources.
81
+ */
82
+ export function narrowSources(sources, only, bin) {
83
+ if (only === undefined)
84
+ return [...sources];
85
+ const narrowed = sources.filter((source) => source.name === only);
86
+ if (narrowed.length === 0) {
87
+ console.error(lineError(`No source named ${c.key(only)} is registered. Run ${c.cmd(`${bin} source ls`)} to see them.`));
88
+ process.exit(1);
89
+ }
90
+ return narrowed;
91
+ }
92
+ //# sourceMappingURL=report.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report.js","sourceRoot":"","sources":["../../src/cli/report.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAGxD,OAAO,EAAE,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAE3D;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAwB,QAA2B;IACrF,KAAK,MAAM,OAAO,IAAI,QAAQ,CAAC,QAAQ;QAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;IACxE,KAAK,MAAM,MAAM,IAAI,QAAQ,CAAC,MAAM;QAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,uBAAuB,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;AAC1H,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,MAAM,CA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c: {
9
+ bold: import("chalk").ChalkInstance;
10
+ dim: import("chalk").ChalkInstance;
11
+ key: import("chalk").ChalkInstance;
12
+ file: import("chalk").ChalkInstance;
13
+ flag: import("chalk").ChalkInstance;
14
+ cmd: import("chalk").ChalkInstance;
15
+ dir: import("chalk").ChalkInstance;
16
+ target: import("chalk").ChalkInstance;
17
+ header: import("chalk").ChalkInstance;
18
+ };
19
+ /** Formats a message as a success line, with a green check. */
20
+ export declare function lineSuccess(msg: string): string;
21
+ /** Formats a message as a warning line, in yellow. */
22
+ export declare function lineWarn(msg: string): string;
23
+ /** Formats a message as a dim info line. */
24
+ export declare function lineInfo(msg: string): string;
25
+ /** Formats a message as an error line, in red. */
26
+ export declare function lineError(msg: string): string;
27
+ //# sourceMappingURL=theme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/cli/theme.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,GAAG;IACd,OAAO;IACP,IAAI;IACJ,IAAI;IACJ,KAAK;IACL,MAAM;CACP,CAAC;AAEF,eAAO,MAAM,CAAC;IACZ,IAAI;IACJ,GAAG;IACH,GAAG;IACH,IAAI;IACJ,IAAI;IACJ,GAAG;IACH,GAAG;IACH,MAAM;IACN,MAAM;CACP,CAAC;AAEF,+DAA+D;AAC/D,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAqC;AACrF,sDAAsD;AACtD,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAmD;AAChG,4CAA4C;AAC5C,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAgD;AAC7F,kDAAkD;AAClD,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAgD"}
@@ -0,0 +1,29 @@
1
+ // packages/core/src/cli/theme.ts
2
+ import chalk from "chalk";
3
+ export const sym = {
4
+ success: chalk.green("✓"),
5
+ warn: chalk.yellow("⚠"),
6
+ info: chalk.dim("i"),
7
+ error: chalk.red("✗"),
8
+ search: chalk.cyan("🔍"),
9
+ };
10
+ export const c = {
11
+ bold: chalk.bold,
12
+ dim: chalk.dim,
13
+ key: chalk.cyan,
14
+ file: chalk.magenta,
15
+ flag: chalk.yellow.bold,
16
+ cmd: chalk.white.bold,
17
+ dir: chalk.blue,
18
+ target: chalk.green,
19
+ header: chalk.bold.underline,
20
+ };
21
+ /** Formats a message as a success line, with a green check. */
22
+ export function lineSuccess(msg) { return `${sym.success} ${msg}`; }
23
+ /** Formats a message as a warning line, in yellow. */
24
+ export function lineWarn(msg) { return `${sym.warn} ${chalk.yellow(msg)}`; }
25
+ /** Formats a message as a dim info line. */
26
+ export function lineInfo(msg) { return `${sym.info} ${chalk.dim(msg)}`; }
27
+ /** Formats a message as an error line, in red. */
28
+ export function lineError(msg) { return `${sym.error} ${chalk.red(msg)}`; }
29
+ //# sourceMappingURL=theme.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme.js","sourceRoot":"","sources":["../../src/cli/theme.ts"],"names":[],"mappings":"AAAA,iCAAiC;AACjC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,CAAC,MAAM,GAAG,GAAG;IACjB,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC;IACzB,IAAI,EAAK,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC;IAC1B,IAAI,EAAK,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC;IACvB,KAAK,EAAI,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC;IACvB,MAAM,EAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC;CAC1B,CAAC;AAEF,MAAM,CAAC,MAAM,CAAC,GAAG;IACf,IAAI,EAAI,KAAK,CAAC,IAAI;IAClB,GAAG,EAAK,KAAK,CAAC,GAAG;IACjB,GAAG,EAAK,KAAK,CAAC,IAAI;IAClB,IAAI,EAAI,KAAK,CAAC,OAAO;IACrB,IAAI,EAAI,KAAK,CAAC,MAAM,CAAC,IAAI;IACzB,GAAG,EAAK,KAAK,CAAC,KAAK,CAAC,IAAI;IACxB,GAAG,EAAK,KAAK,CAAC,IAAI;IAClB,MAAM,EAAE,KAAK,CAAC,KAAK;IACnB,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,SAAS;CAC7B,CAAC;AAEF,+DAA+D;AAC/D,MAAM,UAAU,WAAW,CAAC,GAAW,IAAY,OAAO,GAAG,GAAG,CAAC,OAAO,KAAK,GAAG,EAAE,CAAC,CAAC,CAAC;AACrF,sDAAsD;AACtD,MAAM,UAAU,QAAQ,CAAC,GAAW,IAAe,OAAO,GAAG,GAAG,CAAC,IAAI,KAAK,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;AAChG,4CAA4C;AAC5C,MAAM,UAAU,QAAQ,CAAC,GAAW,IAAe,OAAO,GAAG,GAAG,CAAC,IAAI,KAAK,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;AAC7F,kDAAkD;AAClD,MAAM,UAAU,SAAS,CAAC,GAAW,IAAc,OAAO,GAAG,GAAG,CAAC,KAAK,KAAK,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC"}
@@ -0,0 +1,96 @@
1
+ import type { BaseRegistryEntry } from "../registry/types";
2
+ import type { RegistryStore } from "../registry/registry.store";
3
+ import type { FileSource } from "../installer/types";
4
+ import type { Dialogue, DialogueAnswers, StepChoice } from "./dialogue";
5
+ /**
6
+ * @brief Options the install-shaped commands (add, update, remove) read.
7
+ *
8
+ * @property force - Overwrite local changes without asking.
9
+ * @property dryRun - Report what would change and write nothing.
10
+ * @property answers - Preset dialogue answers by step id; skips the terminal prompt.
11
+ */
12
+ export interface InstallOptions {
13
+ force?: boolean;
14
+ dryRun?: boolean;
15
+ answers?: DialogueAnswers;
16
+ }
17
+ /**
18
+ * @brief Options the `ls` commands read.
19
+ *
20
+ * @property json - Print the listing as JSON instead of text.
21
+ */
22
+ export interface LSOptions {
23
+ json?: boolean;
24
+ }
25
+ /**
26
+ * @brief One install destination: where files land and the manifest tracking them.
27
+ *
28
+ * @property label - Heading printed above the target's output when several targets are installed to.
29
+ * @property installDir - Directory the entries' files are written into.
30
+ * @property store - Store of the entries installed there.
31
+ */
32
+ export interface InstallTarget {
33
+ label: string;
34
+ installDir: string;
35
+ store: RegistryStore<BaseRegistryEntry>;
36
+ }
37
+ /**
38
+ * @brief Where an entry's file contents come from: disk copy, remote fetch or generated.
39
+ *
40
+ * @param entry - Entry whose files are wanted.
41
+ * @returns The files' source, possibly after an async fetch.
42
+ */
43
+ export type EntrySource = (entry: BaseRegistryEntry) => FileSource | Promise<FileSource>;
44
+ /**
45
+ * @brief Input the install dialogues resolve against: picker choices and `{placeholder}` values.
46
+ *
47
+ * @property keyChoices - Choices the picker step offers.
48
+ * @property key - Key of the entry, filling `{key}`.
49
+ * @property target - Label of the install target, filling `{target}`.
50
+ * @property dependents - Dependents to offer for removal, filling `{dependents}`.
51
+ * @property missing - Files missing on disk, filling `{missing}`.
52
+ * @property unknown - Names no source offers, filling `{unknown}`.
53
+ * @property forkName - Suggested key for a fork, e.g. `button-local`.
54
+ */
55
+ export interface InstallInput {
56
+ keyChoices?: StepChoice<string>[];
57
+ key?: string;
58
+ target?: string;
59
+ dependents?: string;
60
+ missing?: string;
61
+ unknown?: string;
62
+ forkName?: string;
63
+ }
64
+ /**
65
+ * @brief Dialogues `addEntries` takes through its named slots.
66
+ *
67
+ * @property onNoValue - Picker shown when no keys are given.
68
+ * @property onCollision - Asked when an entry has local changes.
69
+ */
70
+ export interface AddDialogues {
71
+ onNoValue?: Dialogue<InstallInput>;
72
+ onCollision?: Dialogue<InstallInput>;
73
+ }
74
+ /**
75
+ * @brief Dialogues `updateEntries` takes through its named slots.
76
+ *
77
+ * @property onCollision - Asked when an entry has local changes.
78
+ */
79
+ export interface UpdateDialogues {
80
+ onCollision?: Dialogue<InstallInput>;
81
+ }
82
+ /**
83
+ * @brief Dialogues `removeEntries` takes through its named slots.
84
+ *
85
+ * @property onNoValue - Picker shown when no keys are given, over what is installed.
86
+ * @property onCascade - Asked whether to remove installed dependents too.
87
+ * @property onCollision - Asked when an entry has local changes.
88
+ * @property onIncomplete - Asked when an entry has files missing on disk.
89
+ */
90
+ export interface RemoveDialogues {
91
+ onNoValue?: Dialogue<InstallInput>;
92
+ onCascade?: Dialogue<InstallInput>;
93
+ onCollision?: Dialogue<InstallInput>;
94
+ onIncomplete?: Dialogue<InstallInput>;
95
+ }
96
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/cli/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExE;;;;;;GAMG;AACH,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAG,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,eAAe,CAAC;CAC3B;AAED;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACxB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAO,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAO,aAAa,CAAC,iBAAiB,CAAC,CAAC;CAC9C;AAED;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,KAAK,EAAE,iBAAiB,KAAK,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAEzF;;;;;;;;;;GAUG;AACH,MAAM,WAAW,YAAY;IAC3B,UAAU,CAAC,EAAE,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;IAClC,GAAG,CAAC,EAAS,MAAM,CAAC;IACpB,MAAM,CAAC,EAAM,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAK,MAAM,CAAC;IACpB,OAAO,CAAC,EAAK,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAI,MAAM,CAAC;CACrB;AAED;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B,SAAS,CAAC,EAAI,QAAQ,CAAC,YAAY,CAAC,CAAC;IACrC,WAAW,CAAC,EAAE,QAAQ,CAAC,YAAY,CAAC,CAAC;CACtC;AAED;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,WAAW,CAAC,EAAE,QAAQ,CAAC,YAAY,CAAC,CAAC;CACtC;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,eAAe;IAC9B,SAAS,CAAC,EAAI,QAAQ,CAAC,YAAY,CAAC,CAAC;IACrC,SAAS,CAAC,EAAI,QAAQ,CAAC,YAAY,CAAC,CAAC;IACrC,WAAW,CAAC,EAAE,QAAQ,CAAC,YAAY,CAAC,CAAC;IACrC,YAAY,CAAC,EAAE,QAAQ,CAAC,YAAY,CAAC,CAAC;CACvC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/cli/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,55 @@
1
+ import { type G3nConfig, type G3nConfigFile, type G3nuiConfig, type G3nerateConfig, type SkillsConfig } from "./types";
2
+ /** Returns the path of `.g3n.config.json` inside a project root. */
3
+ export declare function getConfigPath(projectRoot: string): string;
4
+ /**
5
+ * @brief Finds the directory that owns the project's `.g3n.config.json`: the nearest ancestor
6
+ * of `fromDir` holding the config file, else the root of the git repository containing `fromDir`.
7
+ *
8
+ * @param fromDir - Directory to search up from, the working directory by default.
9
+ * @returns The project root, or `null` outside a git repository when no config exists on the way up.
10
+ */
11
+ export declare function resolveProjectRoot(fromDir?: string): string | null;
12
+ /**
13
+ * @brief Loads `.g3n.config.json` from the project root as a fully-defaulted view.
14
+ *
15
+ * Sections missing on disk read as their defaults.
16
+ *
17
+ * @returns The config with every section defaulted.
18
+ */
19
+ export declare function loadConfig(projectRoot: string): Promise<G3nConfig>;
20
+ /** Every key optional at every depth, so a caller can name one setting alone. */
21
+ type DeepPartial<T> = T extends readonly unknown[] ? T : T extends object ? {
22
+ [K in keyof T]?: DeepPartial<T[K]>;
23
+ } : T;
24
+ /**
25
+ * @brief Deep-merges updates into the existing config file and writes back to disk.
26
+ *
27
+ * Only sections already on disk or named in `updates` are written — a
28
+ * package's init never materializes another package's section.
29
+ *
30
+ * @param updates - Partial config to merge, with every key optional at every depth.
31
+ * @returns The saved config with every section defaulted.
32
+ */
33
+ export declare function saveConfig(projectRoot: string, updates: DeepPartial<G3nConfigFile>): Promise<G3nConfig>;
34
+ /**
35
+ * @brief Loads the `g3nui` section with its defaults applied.
36
+ *
37
+ * @returns The section, defaulted where missing on disk.
38
+ */
39
+ export declare function loadG3nuiConfig(projectRoot: string): Promise<G3nuiConfig>;
40
+ /**
41
+ * @brief Loads the `g3nerate` section with its defaults applied.
42
+ *
43
+ * @returns The section, defaulted where missing on disk.
44
+ */
45
+ export declare function loadG3nerateConfig(projectRoot: string): Promise<G3nerateConfig>;
46
+ /**
47
+ * @brief Loads the `skills` section with its defaults applied.
48
+ *
49
+ * @returns The section, defaulted where missing on disk.
50
+ */
51
+ export declare function loadSkillsConfig(projectRoot: string): Promise<SkillsConfig>;
52
+ /** Tells whether `.g3n.config.json` exists in a project root. */
53
+ export declare function configExists(projectRoot: string): Promise<boolean>;
54
+ export {};
55
+ //# sourceMappingURL=config.d.ts.map
@@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