@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
@@ -4,8 +4,16 @@ export declare const StepKind: {
4
4
  readonly Confirm: 2;
5
5
  readonly Text: 3;
6
6
  };
7
+ /** Kind of a dialogue step: select, multi-select, confirm or text. */
7
8
  export type StepKind = (typeof StepKind)[keyof typeof StepKind];
9
+ /** Answers a dialogue collects, keyed by step id. */
8
10
  export type DialogueAnswers = Record<string, unknown>;
11
+ /**
12
+ * @brief One choice of a select or multi-select step.
13
+ *
14
+ * @property value - Value the step answers with.
15
+ * @property label - Text shown for the choice, with `{name}` placeholders filled from the input.
16
+ */
9
17
  export interface StepChoice<V = unknown> {
10
18
  value: V;
11
19
  label: string;
@@ -13,61 +21,105 @@ export interface StepChoice<V = unknown> {
13
21
  /** A literal value, or a function deriving it from the walk's input. */
14
22
  export type Resolvable<Input, V> = V | ((input: Input) => V);
15
23
  /**
16
- * One question of a dialogue. `when` decides whether the step runs at all; a
17
- * skipped step records no answer and falls through to `next`. `next` links to
18
- * the following step: a step id for linear flow, a function of the answer for
19
- * branching, absent to end. `{name}` placeholders in messages and labels are
20
- * filled from the walk's input.
24
+ * @brief One question of a dialogue, shared by every kind of step.
25
+ *
26
+ * `{name}` placeholders in messages and labels are filled from the walk's input.
27
+ *
28
+ * @property message - Question shown to the user.
29
+ * @property when - Decides whether the step runs at all; a skipped step records no answer and falls through to `next`.
30
+ * @property next - Following step: a step id for linear flow, a function of the answer for branching, absent to end.
21
31
  */
22
32
  interface StepBase<Input> {
23
33
  message: string;
24
34
  when?: (input: Input, answers: DialogueAnswers) => boolean;
25
35
  next?: string | ((answer: unknown, answers: DialogueAnswers, input: Input) => string | null);
26
36
  }
37
+ /**
38
+ * @brief A step that asks the user to pick one of its choices.
39
+ *
40
+ * @property kind - Always `StepKind.Select`.
41
+ * @property choices - Choices offered, literal or derived from the input.
42
+ * @property initial - Choice preselected, literal or derived from the input.
43
+ */
27
44
  export interface SelectStep<Input = DialogueAnswers> extends StepBase<Input> {
28
45
  kind: typeof StepKind.Select;
29
46
  choices: Resolvable<Input, StepChoice[]>;
30
47
  initial?: Resolvable<Input, string | number | boolean>;
31
48
  }
49
+ /**
50
+ * @brief A step that asks the user to pick any number of its choices.
51
+ *
52
+ * @property kind - Always `StepKind.MultiSelect`.
53
+ * @property choices - Choices offered, literal or derived from the input.
54
+ * @property initial - Choices preselected, literal or derived from the input.
55
+ * @property required - Whether at least one choice must be picked.
56
+ */
32
57
  export interface MultiSelectStep<Input = DialogueAnswers> extends StepBase<Input> {
33
58
  kind: typeof StepKind.MultiSelect;
34
59
  choices: Resolvable<Input, StepChoice[]>;
35
60
  initial?: Resolvable<Input, unknown[]>;
36
61
  required?: boolean;
37
62
  }
63
+ /**
64
+ * @brief A step that asks a yes or no question.
65
+ *
66
+ * @property kind - Always `StepKind.Confirm`.
67
+ * @property initial - Starting answer, literal or derived from the input.
68
+ */
38
69
  export interface ConfirmStep<Input = DialogueAnswers> extends StepBase<Input> {
39
70
  kind: typeof StepKind.Confirm;
40
71
  initial?: Resolvable<Input, boolean>;
41
72
  }
73
+ /**
74
+ * @brief A step that asks for free text.
75
+ *
76
+ * @property kind - Always `StepKind.Text`.
77
+ * @property initial - Starting text, literal or derived from the input.
78
+ * @property validate - Returns an error message for an invalid value, or `undefined` when it is valid.
79
+ */
42
80
  export interface TextStep<Input = DialogueAnswers> extends StepBase<Input> {
43
81
  kind: typeof StepKind.Text;
44
82
  initial?: Resolvable<Input, string>;
45
83
  validate?: (value: string | undefined) => string | undefined;
46
84
  }
85
+ /** One step of a dialogue, of any kind. */
47
86
  export type DialogueStep<Input = DialogueAnswers> = SelectStep<Input> | MultiSelectStep<Input> | ConfirmStep<Input> | TextStep<Input>;
48
87
  /**
49
- * A command's interaction with the user: a graph of steps keyed by id,
88
+ * @brief A command's interaction with the user: a graph of steps keyed by id,
50
89
  * entered at the first key and linked through each step's `next`. Commands
51
90
  * take dialogues through named slots (e.g. `onNoValue`, `onCollision`) and
52
91
  * run them with `runDialogueValue`; init flows are linked lists run with
53
92
  * `runDialogue`. Preset answers (`options.answers`, keyed by step id) skip
54
93
  * the terminal prompt — that is how tests and non-interactive runs answer.
94
+ *
95
+ * @property steps - Steps keyed by id; the walk enters at the first key.
55
96
  */
56
97
  export interface Dialogue<Input = DialogueAnswers> {
57
98
  steps: Record<string, DialogueStep<Input>>;
58
99
  }
59
100
  /**
60
- * Walks a dialogue from its first step, skipping steps whose `when` is
61
- * false, and collects answers by step id. A preset answer in `answers` is
101
+ * @brief Walks a dialogue from its first step and collects answers by step id.
102
+ *
103
+ * Skips steps whose `when` is false. A preset answer in `answers` is
62
104
  * recorded without prompting; anything else renders in the terminal.
63
- * Returns the cancel symbol as soon as any step is cancelled. Unknown step
64
- * ids throw.
105
+ * Returns the cancel symbol as soon as any step is cancelled.
106
+ *
107
+ * @param dialogue - Dialogue to walk.
108
+ * @param input - Input the steps read.
109
+ * @param answers - Preset answers by step id.
110
+ * @returns Answers by step id, or the cancel symbol.
111
+ * @throws {Error} When the walk reaches a step id that is not in the dialogue.
65
112
  */
66
113
  export declare function runDialogue<Input>(dialogue: Dialogue<Input>, input: Input, answers?: DialogueAnswers): Promise<DialogueAnswers | symbol>;
67
114
  /**
68
- * Runs a dialogue and returns the answer of its last executed step — the
69
- * contract for the commands' named dialogue slots. Returns undefined when no
70
- * step ran, or the cancel symbol.
115
+ * @brief Runs a dialogue and returns the answer of its last executed step.
116
+ *
117
+ * This is the contract for the commands' named dialogue slots.
118
+ *
119
+ * @param dialogue - Dialogue to run.
120
+ * @param input - Input the steps read.
121
+ * @param answers - Preset answers by step id.
122
+ * @returns The answer of the last step that ran, `undefined` when no step ran, or the cancel symbol.
71
123
  */
72
124
  export declare function runDialogueValue<Input>(dialogue: Dialogue<Input>, input: Input, answers?: DialogueAnswers): Promise<unknown>;
73
125
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"dialogue.d.ts","sourceRoot":"","sources":["../../src/cli/dialogue.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,QAAQ;aACnB,MAAM,EAAO,CAAC;aACd,WAAW,EAAE,CAAC;aACd,OAAO,EAAM,CAAC;aACd,IAAI,EAAS,CAAC;CACN,CAAC;AACX,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,QAAQ,CAAC,CAAC,MAAM,OAAO,QAAQ,CAAC,CAAC;AAEhE,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEtD,MAAM,WAAW,UAAU,CAAC,CAAC,GAAG,OAAO;IACrC,KAAK,EAAE,CAAC,CAAC;IACT,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wEAAwE;AACxE,MAAM,MAAM,UAAU,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,KAAK,CAAC,CAAC,CAAC;AAE7D;;;;;;GAMG;AACH,UAAU,QAAQ,CAAC,KAAK;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAI,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,eAAe,KAAK,OAAO,CAAC;IAC7D,IAAI,CAAC,EAAI,MAAM,GAAG,CAAC,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,KAAK,KAAK,MAAM,GAAG,IAAI,CAAC,CAA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,CAAC,CAAC;CACtC;AAED;;;;;;GAMG;AACH,MAAM,WAAW,QAAQ,CAAC,KAAK,GAAG,eAAe,CAAE,SAAQ,QAAQ,CAAC,KAAK,CAAC;IACxE,IAAI,EAAO,OAAO,QAAQ,CAAC,IAAI,CAAC;IAChC,OAAO,CAAC,EAAG,UAAU,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACrC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,KAAK,MAAM,GAAG,SAAS,CAAC;CAC9D;AAED,2CAA2C;AAC3C,MAAM,MAAM,YAAY,CAAC,KAAK,GAAG,eAAe,IAAI,UAAU,CAAC,KAAK,CAAC,GAAG,eAAe,CAAC,KAAK,CAAC,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;AAEtI;;;;;;;;;GASG;AACH,MAAM,WAAW,QAAQ,CAAC,KAAK,GAAG,eAAe;IAC/C,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;CAC5C;AA+HD;;;;;;;;;;;;GAYG;AACH,wBAAsB,WAAW,CAAC,KAAK,EACrC,QAAQ,EAAE,QAAQ,CAAC,KAAK,CAAC,EACzB,KAAK,EAAE,KAAK,EACZ,OAAO,GAAE,eAAoB,GAC5B,OAAO,CAAC,eAAe,GAAG,MAAM,CAAC,CAoBnC;AAED;;;;;;;;;GASG;AACH,wBAAsB,gBAAgB,CAAC,KAAK,EAC1C,QAAQ,EAAE,QAAQ,CAAC,KAAK,CAAC,EACzB,KAAK,EAAE,KAAK,EACZ,OAAO,GAAE,eAAoB,GAC5B,OAAO,CAAC,OAAO,CAAC,CAKlB"}
@@ -9,6 +9,13 @@ export const StepKind = {
9
9
  // ---------------------------------------------------------------------------
10
10
  // Resolving
11
11
  // ---------------------------------------------------------------------------
12
+ /**
13
+ * @brief Fills the `{name}` placeholders of a template from the fields of the input.
14
+ *
15
+ * @param template - Text with `{name}` placeholders.
16
+ * @param input - Object whose fields fill the placeholders; a placeholder without a field stays as written.
17
+ * @returns The text with its placeholders filled.
18
+ */
12
19
  function interpolate(template, input) {
13
20
  const record = (typeof input === "object" && input !== null ? input : {});
14
21
  return template.replace(/\{(\w+)\}/g, (match, name) => {
@@ -16,9 +23,24 @@ function interpolate(template, input) {
16
23
  return value === undefined ? match : String(value);
17
24
  });
18
25
  }
26
+ /**
27
+ * @brief Resolves a value that is literal or a function of the input.
28
+ *
29
+ * @param value - Literal value, or a function of `input`; `undefined` passes through.
30
+ * @param input - Input the function is called with.
31
+ * @returns The literal, or the function's result.
32
+ */
19
33
  function resolveValue(value, input) {
20
34
  return typeof value === "function" ? value(input) : value;
21
35
  }
36
+ /**
37
+ * @brief Resolves every field of a step against the input, ready to render.
38
+ *
39
+ * @param id - Id of the step.
40
+ * @param step - Step to resolve.
41
+ * @param input - Input the placeholders and functions read.
42
+ * @returns The resolved step.
43
+ */
22
44
  function resolveStep(id, step, input) {
23
45
  const resolved = { id, kind: step.kind, message: interpolate(step.message, input) };
24
46
  switch (step.kind) {
@@ -43,6 +65,12 @@ function resolveStep(id, step, input) {
43
65
  // ---------------------------------------------------------------------------
44
66
  // Rendering
45
67
  // ---------------------------------------------------------------------------
68
+ /**
69
+ * @brief Renders one resolved step in the terminal and returns the answer.
70
+ *
71
+ * @param step - Step to render.
72
+ * @returns The user's answer, or the cancel symbol.
73
+ */
46
74
  async function render(step) {
47
75
  switch (step.kind) {
48
76
  case StepKind.Select:
@@ -77,11 +105,17 @@ async function render(step) {
77
105
  // Walking
78
106
  // ---------------------------------------------------------------------------
79
107
  /**
80
- * Walks a dialogue from its first step, skipping steps whose `when` is
81
- * false, and collects answers by step id. A preset answer in `answers` is
108
+ * @brief Walks a dialogue from its first step and collects answers by step id.
109
+ *
110
+ * Skips steps whose `when` is false. A preset answer in `answers` is
82
111
  * recorded without prompting; anything else renders in the terminal.
83
- * Returns the cancel symbol as soon as any step is cancelled. Unknown step
84
- * ids throw.
112
+ * Returns the cancel symbol as soon as any step is cancelled.
113
+ *
114
+ * @param dialogue - Dialogue to walk.
115
+ * @param input - Input the steps read.
116
+ * @param answers - Preset answers by step id.
117
+ * @returns Answers by step id, or the cancel symbol.
118
+ * @throws {Error} When the walk reaches a step id that is not in the dialogue.
85
119
  */
86
120
  export async function runDialogue(dialogue, input, answers = {}) {
87
121
  const collected = {};
@@ -103,9 +137,14 @@ export async function runDialogue(dialogue, input, answers = {}) {
103
137
  return collected;
104
138
  }
105
139
  /**
106
- * Runs a dialogue and returns the answer of its last executed step — the
107
- * contract for the commands' named dialogue slots. Returns undefined when no
108
- * step ran, or the cancel symbol.
140
+ * @brief Runs a dialogue and returns the answer of its last executed step.
141
+ *
142
+ * This is the contract for the commands' named dialogue slots.
143
+ *
144
+ * @param dialogue - Dialogue to run.
145
+ * @param input - Input the steps read.
146
+ * @param answers - Preset answers by step id.
147
+ * @returns The answer of the last step that ran, `undefined` when no step ran, or the cancel symbol.
109
148
  */
110
149
  export async function runDialogueValue(dialogue, input, answers = {}) {
111
150
  const record = await runDialogue(dialogue, input, answers);
@@ -1 +1 @@
1
- {"version":3,"file":"dialogue.js","sourceRoot":"","sources":["../../src/cli/dialogue.ts"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAC;AAEpC,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,MAAM,EAAO,CAAC;IACd,WAAW,EAAE,CAAC;IACd,OAAO,EAAM,CAAC;IACd,IAAI,EAAS,CAAC;CACN,CAAC;AA2EX,8EAA8E;AAC9E,YAAY;AACZ,8EAA8E;AAE9E,SAAS,WAAW,CAAC,QAAgB,EAAE,KAAc;IACnD,MAAM,MAAM,GAAG,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAA4B,CAAC;IACrG,OAAO,QAAQ,C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,KAAK,QAAQ;gBAAE,OAAO,MAAM,CAAC;YAC9C,SAAS,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC;QACzB,CAAC;QAED,EAAE,GAAG,OAAO,IAAI,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC;IACjG,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,QAAyB,EACzB,KAAY,EACZ,OAAO,GAAoB,EAAE;IAE7B,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,QAAQ,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IAC3D,IAAI,OAAO,MAAM,KAAK,QAAQ;QAAE,OAAO,MAAM,CAAC;IAC9C,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IACxC,OAAO,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACvD,CAAC"}
@@ -13,7 +13,7 @@ export { lsSourceRegistry } from "./commands/ls";
13
13
  export { addSourceEntries, lsSources, removeSourceEntries } from "./commands/sources";
14
14
  export type { SourceCommandContext, SourceAddOptions } from "./commands/sources";
15
15
  export { pickOffers, selectEntriesDialogue } from "./pick";
16
- export { overwriteDialogue, removeChangedDialogue, cascadeDialogue, incompleteDialogue, selectRemovalDialogue, notInstalledDialogue } from "./installDialogues";
16
+ export { conflictDialogue, removeChangedDialogue, cascadeDialogue, incompleteDialogue, selectRemovalDialogue, notInstalledDialogue } from "./installDialogues";
17
17
  export { addFromSources, updateFromSources, removeFromTargets } from "./commands/installFromSources";
18
18
  export type { ManifestTarget, InstallCommandContext, AfterTarget } from "./commands/installFromSources";
19
19
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AACA,cAAc,SAAS,CAAA;AACvB,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAChE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AACpE,YAAY,EACV,QAAQ,EAAE,YAAY,EAAE,eAAe,EAAE,UAAU,EAAE,UAAU,EAC/D,UAAU,EAAE,eAAe,EAAE,WAAW,EAAE,QAAQ,GACnD,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AACzC,OAAO,EAAE,CAAC,EAAE,GAAG,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAC5E,OAAO,EAAE,oBAAoB,EAAE,MAAM,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAC/G,YAAY,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAChD,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AACrF,YAAY,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAChF,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAA;AAC1D,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,e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BAAoB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAChF,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAA;AAC1D,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,eAAe,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AAC9J,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAA;AACpG,YAAY,EAAE,cAAc,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAA"}
package/dist/cli/index.js CHANGED
@@ -11,6 +11,6 @@ export { reportSourceRegistry, orExit, reportResolution, entryNotFoundDialogue,
11
11
  export { lsSourceRegistry } from "./commands/ls";
12
12
  export { addSourceEntries, lsSources, removeSourceEntries } from "./commands/sources";
13
13
  export { pickOffers, selectEntriesDialogue } from "./pick";
14
- export { overwriteDialogue, removeChangedDialogue, cascadeDialogue, incompleteDialogue, selectRemovalDialogue, notInstalledDialogue } from "./installDialogues";
14
+ export { conflictDialogue, removeChangedDialogue, cascadeDialogue, incompleteDialogue, selectRemovalDialogue, notInstalledDialogue } from "./installDialogues";
15
15
  export { addFromSources, updateFromSources, removeFromTargets } from "./commands/installFromSources";
16
16
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AAAA,iCAAiC;AACjC,cAAc,SAAS,CAAA;AACvB,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAChE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAKpE,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAE,aAAa,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MAAM,SAAS,CAAA;AAC5E,OAAO,EAAE,oBAAoB,EAAE,MAAM,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAE/G,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAChD,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAErF,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAA;AAC1D,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,eAAe,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AAC9J,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAA"}
@@ -1,14 +1,22 @@
1
1
  import type { Dialogue } from "./dialogue";
2
2
  import type { InstallInput } from "./types";
3
- /** Keep or overwrite an entry with local changes, for `add` and `update`; step id `conflict`. */
4
- export declare const overwriteDialogue: Dialogue<InstallInput>;
3
+ /**
4
+ * @brief Restore, fork or skip an entry with local changes, for `add` and `update`; step id `conflict`, then
5
+ * `forkName` for the key of the fork.
6
+ */
7
+ export declare const conflictDialogue: Dialogue<InstallInput>;
5
8
  /** Keep or remove an entry with local changes, for `remove`; step id `conflict`. */
6
9
  export declare const removeChangedDialogue: Dialogue<InstallInput>;
7
10
  /** Whether to remove the installed entries that depend on one being removed; step id `cascade`. */
8
11
  export declare const cascadeDialogue: Dialogue<InstallInput>;
9
12
  /** Whether to remove an entry with files already missing on disk; step id `incomplete`. */
10
13
  export declare const incompleteDialogue: Dialogue<InstallInput>;
11
- /** Which installed entries to remove when none were named; step id `selectEntries`. */
14
+ /**
15
+ * @brief Builds the picker that asks which installed entries to remove.
16
+ *
17
+ * @param noun - What one entry is called, e.g. `skill`.
18
+ * @returns Dialogue with the step `selectEntries`.
19
+ */
12
20
  export declare function selectRemovalDialogue(noun: string): Dialogue<InstallInput>;
13
21
  /** Whether to go on when some names given to `update` are not installed; step id `entryNotFound`. */
14
22
  export declare const notInstalledDialogue: Dialogue<InstallInput>;
@@ -1 +1 @@
1
- {"version":3,"file":"installDialogues.d.ts","sourceRoot":"","sources":["../../src/cli/installDialogues.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,iGAAiG;AACjG,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,YAAY,CAWpD,CAAC;AAEF,oFAAoF;AACpF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,YAAY,CAWxD,CAAC;AAEF,mGAAmG;AACnG,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,YAAY,CAQlD,CAAC;AAEF,2FAA2F;AAC3F,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,YAAY,CAQrD,CAAC;AAEF,uFAAuF;AACvF,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAAC,YAAY,CAAC,CAU1E;AAED,qGAAqG;AACrG,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,YAAY,CAQvD,CAAC"}
1
+ {"version":3,"file":"installDialogues.d.ts","sourceRoot":"","sources":["../../src/cli/installDialogues.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,YAAY,CAoBnD,CAAC;AAEF,oFAAoF;AACpF,eAAO,MAAM,qBAAqB,EAAE,QAAQ,CAAC,YAAY,CAWxD,CAAC;AAEF,mGAAmG;AACnG,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,YAAY,CAQlD,CAAC;AAEF,2FAA2F;AAC3F,eAAO,MAAM,kBAAkB,EAAE,QAAQ,CAAC,YAAY,CAQrD,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAAC,YAAY,CAAC,CAU1E;AAED,qGAAqG;AACrG,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,YAAY,CAQvD,CAAC"}
@@ -1,16 +1,28 @@
1
1
  // packages/core/src/cli/installDialogues.ts
2
2
  import { ConflictDecision } from "../installer/types";
3
3
  import { StepKind } from "./dialogue";
4
- /** Keep or overwrite an entry with local changes, for `add` and `update`; step id `conflict`. */
5
- export const overwriteDialogue = {
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 = {
6
9
  steps: {
7
10
  conflict: {
8
11
  kind: StepKind.Select,
9
12
  message: "{key} ({target}) has local changes. What would you like to do?",
10
13
  choices: [
11
- { value: ConflictDecision.Keep, label: "Keep my changes: skip modified files" },
12
- { value: ConflictDecision.Overwrite, label: "Overwrite with the source version" },
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" },
13
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),
14
26
  },
15
27
  },
16
28
  };
@@ -47,7 +59,12 @@ export const incompleteDialogue = {
47
59
  },
48
60
  },
49
61
  };
50
- /** Which installed entries to remove when none were named; step id `selectEntries`. */
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
+ */
51
68
  export function selectRemovalDialogue(noun) {
52
69
  return {
53
70
  steps: {
@@ -1 +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,iGAAiG;AACjG,MAAM,CAAC,MAAM,iBAAiB,GAA2B;IACvD,KAAK,EAAE;QACL,QAAQ,EAAE;YACR,IAAI,EAAK,QAAQ,CAAC,MAAM;YACxB,OAAO,EAAE,gEAAgE;YACzE,OAAO,EAAE;gBACP,EAAE,KAAK,EAAE,gBAAgB,CAAC,IAAI,EAAO,KAAK,EAAE,sCAAsC,EAAE;gBACpF,EAAE,KAAK,EAAE,gBAAgB,CAAC,SAAS,EAAE,KAAK,EAAE,mCAAmC,EAAE;aAClF;SACF;KACF;CACF,CAAC;AAEF,oFAAoF;AACpF,MAAM,CAAC,MAAM,qBAAqB,GAA2B;IAC3D,KAAK,EAAE;QACL,QAAQ,EAAE;YACR,IAAI,EAAK,QAAQ,CAAC,MAAM;YACxB,OAAO,EAAE,gEAAgE;YACzE,OAAO,EAAE;gBACP,EAAE,KAAK,EAAE,gBAAgB,CAAC,IAAI,EAAO,KAAK,EAAE,yBAAyB,EAAE;gBACvE,EAAE,KAAK,EAAE,gBAAgB,CAAC,SAAS,EAAE,KAAK,EAAE,wCAAwC,EAAE;aACvF;SACF;KACF;CACF,CAAC;AAEF,mGAAmG;AACnG,MAAM,CAAC,MAAM,eAAe,GAA2B;IACrD,KAAK,EAAE;QACL,OAAO,EAAE;YACP,IAAI,EAAK,QAAQ,CAAC,OAAO;YACzB,OAAO,EAAE,2BAA2B;YACpC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kBAAkB,GAA2B;IACxD,KAAK,EAAE;QACL,UAAU,EAAE;YACV,IAAI,EAAK,QAAQ,CAAC,OAAO;YACzB,OAAO,EAAE,gFAAgF;YACzF,OAAO,EAAE,IAAI;SACd;KACF;CACF,CAAC;AAEF;;;;;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,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"}
@@ -2,12 +2,21 @@ import type { OriginEntry } from "../installer/origin";
2
2
  import type { SourceOffer } from "../installer/sourceRegistry";
3
3
  import type { Dialogue, DialogueAnswers } from "./dialogue";
4
4
  import type { InstallInput } from "./types";
5
- /** The multi-select `pickOffers` asks through, by step id `selectEntries`, for preset answers. */
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
+ */
6
11
  export declare function selectEntriesDialogue(noun: string): Dialogue<InstallInput>;
7
12
  /**
8
- * Asks which offers to install, each as `<key>@<source>`, so two sources
13
+ * @brief Asks which offers to install, each as `<key>@<source>`, so two sources
9
14
  * offering one key stay apart. Exits when the prompt is cancelled.
10
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
+ *
11
20
  * @returns the picked requests, e.g. `["emphasise@g3n-skills"]`
12
21
  */
13
22
  export declare function pickOffers<T extends OriginEntry>(available: readonly SourceOffer<T>[], noun: string, answers?: DialogueAnswers): Promise<string[]>;
@@ -1 +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,kGAAkG;AAClG,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAAC,YAAY,CAAC,CAU1E;AAED;;;;;GAKG;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"}
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"}
package/dist/cli/pick.js CHANGED
@@ -5,7 +5,12 @@ import { guardCancel } from "../utils/prompt";
5
5
  import { StepKind, runDialogueValue } from "./dialogue";
6
6
  import { c } from "./theme";
7
7
  const PicksSchema = z.array(z.string());
8
- /** The multi-select `pickOffers` asks through, by step id `selectEntries`, for preset answers. */
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
+ */
9
14
  export function selectEntriesDialogue(noun) {
10
15
  return {
11
16
  steps: {
@@ -18,9 +23,13 @@ export function selectEntriesDialogue(noun) {
18
23
  };
19
24
  }
20
25
  /**
21
- * Asks which offers to install, each as `<key>@<source>`, so two sources
26
+ * @brief Asks which offers to install, each as `<key>@<source>`, so two sources
22
27
  * offering one key stay apart. Exits when the prompt is cancelled.
23
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
+ *
24
33
  * @returns the picked requests, e.g. `["emphasise@g3n-skills"]`
25
34
  */
26
35
  export async function pickOffers(available, noun, answers) {
@@ -1 +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,M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AC,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"}
@@ -3,30 +3,54 @@ import type { SourceRegistry } from "../installer/sourceRegistry";
3
3
  import type { Resolution } from "../installer/resolve";
4
4
  import type { Dialogue, DialogueAnswers } from "./dialogue";
5
5
  import type { InstallInput } from "./types";
6
- /** Prints every warning of a source registry and every source it could not read. */
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
+ */
7
11
  export declare function reportSourceRegistry<T extends OriginEntry>(registry: SourceRegistry<T>): void;
8
- /** Runs `read`, and on a throw prints its message and exits with code 1. */
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
+ */
9
18
  export declare function orExit<T>(read: () => T): T;
10
- /** What `reportResolution` names in its messages. */
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
+ */
11
25
  export interface ResolutionContext {
12
- /** Installer binary, e.g. `g3n-skills` */
13
26
  bin: string;
14
- /** What one entry is called, e.g. `skill` */
15
27
  noun: string;
16
28
  }
17
- /** The confirm step `reportResolution` asks through, by step id `entryNotFound`, for preset answers. */
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
+ */
18
35
  export declare function entryNotFoundDialogue(noun: string): Dialogue<InstallInput>;
19
36
  /**
20
- * Prints what a resolution could not settle and why each unnamed entry is in
37
+ * @brief Prints what a resolution could not settle and why each unnamed entry is in
21
38
  * it. Exits on an ambiguous name; on unknown names, asks whether to go on
22
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.
23
44
  */
24
45
  export declare function reportResolution<T extends OriginEntry>(resolution: Resolution<T>, context: ResolutionContext, answers?: DialogueAnswers): Promise<void>;
25
46
  /**
26
- * The sources narrowed to `only`, or all of them when it is absent. Exits
47
+ * @brief The sources narrowed to `only`, or all of them when it is absent. Exits
27
48
  * naming the `source ls` command when no source has that name.
28
49
  *
50
+ * @param sources - Sources to narrow.
51
+ * @param only - Name of the one source to keep, or `undefined` for all of them.
29
52
  * @param bin - Installer binary for the hint, e.g. `g3n-skills`
53
+ * @returns The narrowed sources.
30
54
  */
31
55
  export declare function narrowSources<S extends {
32
56
  name: string;
@@ -1 +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,UA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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"}
@@ -1,14 +1,23 @@
1
1
  import { errorMessage } from "../utils/errors";
2
2
  import { StepKind, runDialogueValue } from "./dialogue";
3
3
  import { c, lineError, lineInfo, lineWarn } from "./theme";
4
- /** Prints every warning of a source registry and every source it could not read. */
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
+ */
5
9
  export function reportSourceRegistry(registry) {
6
10
  for (const warning of registry.warnings)
7
11
  console.log(lineWarn(warning));
8
12
  for (const failed of registry.failed)
9
13
  console.log(lineWarn(`${c.key(failed.name)} could not be read: ${failed.error}`));
10
14
  }
11
- /** Runs `read`, and on a throw prints its message and exits with code 1. */
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
+ */
12
21
  export function orExit(read) {
13
22
  try {
14
23
  return read();
@@ -18,7 +27,12 @@ export function orExit(read) {
18
27
  process.exit(1);
19
28
  }
20
29
  }
21
- /** The confirm step `reportResolution` asks through, by step id `entryNotFound`, for preset answers. */
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
+ */
22
36
  export function entryNotFoundDialogue(noun) {
23
37
  return {
24
38
  steps: {
@@ -31,9 +45,13 @@ export function entryNotFoundDialogue(noun) {
31
45
  };
32
46
  }
33
47
  /**
34
- * Prints what a resolution could not settle and why each unnamed entry is in
48
+ * @brief Prints what a resolution could not settle and why each unnamed entry is in
35
49
  * it. Exits on an ambiguous name; on unknown names, asks whether to go on
36
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.
37
55
  */
38
56
  export async function reportResolution(resolution, context, answers) {
39
57
  if (resolution.ambiguous.length > 0) {
@@ -53,10 +71,13 @@ export async function reportResolution(resolution, context, answers) {
53
71
  console.log(lineInfo(`${c.key(key)}: ${why}`));
54
72
  }
55
73
  /**
56
- * The sources narrowed to `only`, or all of them when it is absent. Exits
74
+ * @brief The sources narrowed to `only`, or all of them when it is absent. Exits
57
75
  * naming the `source ls` command when no source has that name.
58
76
  *
77
+ * @param sources - Sources to narrow.
78
+ * @param only - Name of the one source to keep, or `undefined` for all of them.
59
79
  * @param bin - Installer binary for the hint, e.g. `g3n-skills`
80
+ * @returns The narrowed sources.
60
81
  */
61
82
  export function narrowSources(sources, only, bin) {
62
83
  if (only === undefined)
@@ -1 +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,oFAAoF;AACpF,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,4EAA4E;AAC5E,MAAM,UAAU,MAAM,CAAI,IAAa;IACrC,IAAI,CAAC;QACH,OAAO,IAAI,EAAE,CAAC;IAChB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAC9C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAUD,wGAAwG;AACxG,MAAM,UAAU,qBAAqB,CAAC,IAAY;IAChD,OAAO;QACL,KAAK,EAAE;YACL,aAAa,EAAE;gBACb,IAAI,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