@sfship/plugin-ship 1.0.0-beta.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 (229) hide show
  1. package/LICENSE.txt +206 -0
  2. package/README.md +164 -0
  3. package/lib/commands/ship/flow/eject.d.ts +15 -0
  4. package/lib/commands/ship/flow/eject.js +55 -0
  5. package/lib/commands/ship/flow/eject.js.map +1 -0
  6. package/lib/commands/ship/flow/info.d.ts +15 -0
  7. package/lib/commands/ship/flow/info.js +86 -0
  8. package/lib/commands/ship/flow/info.js.map +1 -0
  9. package/lib/commands/ship/flow/list.d.ts +12 -0
  10. package/lib/commands/ship/flow/list.js +51 -0
  11. package/lib/commands/ship/flow/list.js.map +1 -0
  12. package/lib/commands/ship/flow/run.d.ts +16 -0
  13. package/lib/commands/ship/flow/run.js +90 -0
  14. package/lib/commands/ship/flow/run.js.map +1 -0
  15. package/lib/commands/ship/project/init.d.ts +13 -0
  16. package/lib/commands/ship/project/init.js +81 -0
  17. package/lib/commands/ship/project/init.js.map +1 -0
  18. package/lib/commands/ship/service/connect/github.d.ts +12 -0
  19. package/lib/commands/ship/service/connect/github.js +47 -0
  20. package/lib/commands/ship/service/connect/github.js.map +1 -0
  21. package/lib/commands/ship/service/delete.d.ts +13 -0
  22. package/lib/commands/ship/service/delete.js +44 -0
  23. package/lib/commands/ship/service/delete.js.map +1 -0
  24. package/lib/commands/ship/service/info.d.ts +13 -0
  25. package/lib/commands/ship/service/info.js +51 -0
  26. package/lib/commands/ship/service/info.js.map +1 -0
  27. package/lib/commands/ship/service/list.d.ts +9 -0
  28. package/lib/commands/ship/service/list.js +55 -0
  29. package/lib/commands/ship/service/list.js.map +1 -0
  30. package/lib/commands/ship/task/info.d.ts +15 -0
  31. package/lib/commands/ship/task/info.js +75 -0
  32. package/lib/commands/ship/task/info.js.map +1 -0
  33. package/lib/commands/ship/task/list.d.ts +12 -0
  34. package/lib/commands/ship/task/list.js +45 -0
  35. package/lib/commands/ship/task/list.js.map +1 -0
  36. package/lib/commands/ship/task/run.d.ts +16 -0
  37. package/lib/commands/ship/task/run.js +72 -0
  38. package/lib/commands/ship/task/run.js.map +1 -0
  39. package/lib/core/config.dependency.schema.d.ts +24 -0
  40. package/lib/core/config.dependency.schema.js +34 -0
  41. package/lib/core/config.dependency.schema.js.map +1 -0
  42. package/lib/core/config.loader.d.ts +23 -0
  43. package/lib/core/config.loader.js +62 -0
  44. package/lib/core/config.loader.js.map +1 -0
  45. package/lib/core/config.ship.schema.d.ts +174 -0
  46. package/lib/core/config.ship.schema.js +67 -0
  47. package/lib/core/config.ship.schema.js.map +1 -0
  48. package/lib/core/error.d.ts +29 -0
  49. package/lib/core/error.js +59 -0
  50. package/lib/core/error.js.map +1 -0
  51. package/lib/core/file.d.ts +34 -0
  52. package/lib/core/file.js +123 -0
  53. package/lib/core/file.js.map +1 -0
  54. package/lib/core/flow.context.d.ts +22 -0
  55. package/lib/core/flow.context.js +4 -0
  56. package/lib/core/flow.context.js.map +1 -0
  57. package/lib/core/flow.definition.schema.d.ts +60 -0
  58. package/lib/core/flow.definition.schema.js +56 -0
  59. package/lib/core/flow.definition.schema.js.map +1 -0
  60. package/lib/core/flow.interpolate.d.ts +21 -0
  61. package/lib/core/flow.interpolate.js +64 -0
  62. package/lib/core/flow.interpolate.js.map +1 -0
  63. package/lib/core/flow.registry.d.ts +32 -0
  64. package/lib/core/flow.registry.js +99 -0
  65. package/lib/core/flow.registry.js.map +1 -0
  66. package/lib/core/flow.renderer.d.ts +51 -0
  67. package/lib/core/flow.renderer.js +137 -0
  68. package/lib/core/flow.renderer.js.map +1 -0
  69. package/lib/core/flow.runner.d.ts +13 -0
  70. package/lib/core/flow.runner.js +133 -0
  71. package/lib/core/flow.runner.js.map +1 -0
  72. package/lib/core/flow.store.d.ts +24 -0
  73. package/lib/core/flow.store.js +57 -0
  74. package/lib/core/flow.store.js.map +1 -0
  75. package/lib/core/flow.view.d.ts +20 -0
  76. package/lib/core/flow.view.js +77 -0
  77. package/lib/core/flow.view.js.map +1 -0
  78. package/lib/core/flows/create/package.yml +18 -0
  79. package/lib/core/flows/dependencies/lock.yml +4 -0
  80. package/lib/core/flows/deploy/beta.yml +38 -0
  81. package/lib/core/flows/deploy/dev.yml +26 -0
  82. package/lib/core/flows/deploy/feature.yml +56 -0
  83. package/lib/core/flows/deploy/qa.yml +51 -0
  84. package/lib/core/flows/deploy/regression.yml +60 -0
  85. package/lib/core/flows/deploy/release.yml +38 -0
  86. package/lib/core/flows/release/beta.yml +25 -0
  87. package/lib/core/flows/release/production.yml +16 -0
  88. package/lib/core/org.registry.d.ts +45 -0
  89. package/lib/core/org.registry.js +76 -0
  90. package/lib/core/org.registry.js.map +1 -0
  91. package/lib/core/org.scratch.schema.d.ts +44 -0
  92. package/lib/core/org.scratch.schema.js +62 -0
  93. package/lib/core/org.scratch.schema.js.map +1 -0
  94. package/lib/core/package.dependencies.d.ts +45 -0
  95. package/lib/core/package.dependencies.js +158 -0
  96. package/lib/core/package.dependencies.js.map +1 -0
  97. package/lib/core/package.installer.d.ts +13 -0
  98. package/lib/core/package.installer.js +60 -0
  99. package/lib/core/package.installer.js.map +1 -0
  100. package/lib/core/package.metadata.d.ts +6 -0
  101. package/lib/core/package.metadata.js +33 -0
  102. package/lib/core/package.metadata.js.map +1 -0
  103. package/lib/core/package.namespace.d.ts +10 -0
  104. package/lib/core/package.namespace.js +40 -0
  105. package/lib/core/package.namespace.js.map +1 -0
  106. package/lib/core/package.version.d.ts +42 -0
  107. package/lib/core/package.version.js +60 -0
  108. package/lib/core/package.version.js.map +1 -0
  109. package/lib/core/project.init.d.ts +11 -0
  110. package/lib/core/project.init.js +121 -0
  111. package/lib/core/project.init.js.map +1 -0
  112. package/lib/core/service.d.ts +45 -0
  113. package/lib/core/service.github.d.ts +98 -0
  114. package/lib/core/service.github.js +270 -0
  115. package/lib/core/service.github.js.map +1 -0
  116. package/lib/core/service.js +91 -0
  117. package/lib/core/service.js.map +1 -0
  118. package/lib/core/sfdx-project.d.ts +25 -0
  119. package/lib/core/sfdx-project.js +39 -0
  120. package/lib/core/sfdx-project.js.map +1 -0
  121. package/lib/core/stdout.d.ts +1 -0
  122. package/lib/core/stdout.js +27 -0
  123. package/lib/core/stdout.js.map +1 -0
  124. package/lib/core/task.definition.schema.d.ts +69 -0
  125. package/lib/core/task.definition.schema.js +33 -0
  126. package/lib/core/task.definition.schema.js.map +1 -0
  127. package/lib/core/task.output.d.ts +29 -0
  128. package/lib/core/task.output.js +39 -0
  129. package/lib/core/task.output.js.map +1 -0
  130. package/lib/core/task.param.d.ts +30 -0
  131. package/lib/core/task.param.js +141 -0
  132. package/lib/core/task.param.js.map +1 -0
  133. package/lib/core/task.param.schema.d.ts +22 -0
  134. package/lib/core/task.param.schema.js +26 -0
  135. package/lib/core/task.param.schema.js.map +1 -0
  136. package/lib/core/task.registry.d.ts +22 -0
  137. package/lib/core/task.registry.js +85 -0
  138. package/lib/core/task.registry.js.map +1 -0
  139. package/lib/core/task.view.d.ts +10 -0
  140. package/lib/core/task.view.js +25 -0
  141. package/lib/core/task.view.js.map +1 -0
  142. package/lib/core/tasks/apex/run/test.d.ts +25 -0
  143. package/lib/core/tasks/apex/run/test.js +85 -0
  144. package/lib/core/tasks/apex/run/test.js.map +1 -0
  145. package/lib/core/tasks/data/import/tree.d.ts +12 -0
  146. package/lib/core/tasks/data/import/tree.js +61 -0
  147. package/lib/core/tasks/data/import/tree.js.map +1 -0
  148. package/lib/core/tasks/git/release/create.d.ts +42 -0
  149. package/lib/core/tasks/git/release/create.js +197 -0
  150. package/lib/core/tasks/git/release/create.js.map +1 -0
  151. package/lib/core/tasks/git/release/fetch.d.ts +24 -0
  152. package/lib/core/tasks/git/release/fetch.js +93 -0
  153. package/lib/core/tasks/git/release/fetch.js.map +1 -0
  154. package/lib/core/tasks/git/repo/info.d.ts +12 -0
  155. package/lib/core/tasks/git/repo/info.js +47 -0
  156. package/lib/core/tasks/git/repo/info.js.map +1 -0
  157. package/lib/core/tasks/metadata/deploy.d.ts +12 -0
  158. package/lib/core/tasks/metadata/deploy.js +39 -0
  159. package/lib/core/tasks/metadata/deploy.js.map +1 -0
  160. package/lib/core/tasks/org/assign/permsets.d.ts +12 -0
  161. package/lib/core/tasks/org/assign/permsets.js +54 -0
  162. package/lib/core/tasks/org/assign/permsets.js.map +1 -0
  163. package/lib/core/tasks/org/create/scratch.d.ts +36 -0
  164. package/lib/core/tasks/org/create/scratch.js +127 -0
  165. package/lib/core/tasks/org/create/scratch.js.map +1 -0
  166. package/lib/core/tasks/org/delete/scratch.d.ts +12 -0
  167. package/lib/core/tasks/org/delete/scratch.js +10 -0
  168. package/lib/core/tasks/org/delete/scratch.js.map +1 -0
  169. package/lib/core/tasks/package/create.d.ts +36 -0
  170. package/lib/core/tasks/package/create.js +93 -0
  171. package/lib/core/tasks/package/create.js.map +1 -0
  172. package/lib/core/tasks/package/dependencies/lock.d.ts +6 -0
  173. package/lib/core/tasks/package/dependencies/lock.js +35 -0
  174. package/lib/core/tasks/package/dependencies/lock.js.map +1 -0
  175. package/lib/core/tasks/package/dependencies/verify.d.ts +6 -0
  176. package/lib/core/tasks/package/dependencies/verify.js +44 -0
  177. package/lib/core/tasks/package/dependencies/verify.js.map +1 -0
  178. package/lib/core/tasks/package/install/dependencies.d.ts +22 -0
  179. package/lib/core/tasks/package/install/dependencies.js +43 -0
  180. package/lib/core/tasks/package/install/dependencies.js.map +1 -0
  181. package/lib/core/tasks/package/install/index.d.ts +25 -0
  182. package/lib/core/tasks/package/install/index.js +37 -0
  183. package/lib/core/tasks/package/install/index.js.map +1 -0
  184. package/lib/core/tasks/package/version/create.d.ts +36 -0
  185. package/lib/core/tasks/package/version/create.js +133 -0
  186. package/lib/core/tasks/package/version/create.js.map +1 -0
  187. package/lib/core/tasks/package/version/promote.d.ts +30 -0
  188. package/lib/core/tasks/package/version/promote.js +79 -0
  189. package/lib/core/tasks/package/version/promote.js.map +1 -0
  190. package/lib/core/tasks/package/version/resolve-latest.d.ts +24 -0
  191. package/lib/core/tasks/package/version/resolve-latest.js +78 -0
  192. package/lib/core/tasks/package/version/resolve-latest.js.map +1 -0
  193. package/lib/core/tasks/package/version/resolve-next.d.ts +24 -0
  194. package/lib/core/tasks/package/version/resolve-next.js +49 -0
  195. package/lib/core/tasks/package/version/resolve-next.js.map +1 -0
  196. package/lib/core/tasks/project/deploy/start.d.ts +22 -0
  197. package/lib/core/tasks/project/deploy/start.js +117 -0
  198. package/lib/core/tasks/project/deploy/start.js.map +1 -0
  199. package/lib/core/tasks/project/reset/tracking.d.ts +25 -0
  200. package/lib/core/tasks/project/reset/tracking.js +32 -0
  201. package/lib/core/tasks/project/reset/tracking.js.map +1 -0
  202. package/lib/core/tasks/util/file/exists.d.ts +24 -0
  203. package/lib/core/tasks/util/file/exists.js +53 -0
  204. package/lib/core/tasks/util/file/exists.js.map +1 -0
  205. package/lib/core/tasks/util/file/find.d.ts +30 -0
  206. package/lib/core/tasks/util/file/find.js +70 -0
  207. package/lib/core/tasks/util/file/find.js.map +1 -0
  208. package/lib/core/tasks/util/log.d.ts +13 -0
  209. package/lib/core/tasks/util/log.js +10 -0
  210. package/lib/core/tasks/util/log.js.map +1 -0
  211. package/lib/core/templates/README.md +35 -0
  212. package/lib/core/tree.d.ts +7 -0
  213. package/lib/core/tree.js +42 -0
  214. package/lib/core/tree.js.map +1 -0
  215. package/messages/service.connect.github.md +16 -0
  216. package/messages/ship.flow.eject.md +21 -0
  217. package/messages/ship.flow.info.md +21 -0
  218. package/messages/ship.flow.list.md +15 -0
  219. package/messages/ship.flow.run.md +23 -0
  220. package/messages/ship.project.init.md +23 -0
  221. package/messages/ship.service.delete.md +19 -0
  222. package/messages/ship.service.info.md +19 -0
  223. package/messages/ship.service.list.md +11 -0
  224. package/messages/ship.task.info.md +25 -0
  225. package/messages/ship.task.list.md +15 -0
  226. package/messages/ship.task.run.md +29 -0
  227. package/oclif.lock +10313 -0
  228. package/oclif.manifest.json +707 -0
  229. package/package.json +254 -0
@@ -0,0 +1,45 @@
1
+ /*
2
+ * Licensed under the Apache License, Version 2.0 (the "License");
3
+ * you may not use this file except in compliance with the License.
4
+ * You may obtain a copy of the License at
5
+ *
6
+ * http://www.apache.org/licenses/LICENSE-2.0
7
+ *
8
+ * Unless required by applicable law or agreed to in writing, software
9
+ * distributed under the License is distributed on an "AS IS" BASIS,
10
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ * See the License for the specific language governing permissions and
12
+ * limitations under the License.
13
+ */
14
+ import { SfCommand, Flags, StandardColors } from '@salesforce/sf-plugins-core';
15
+ import { Messages } from '@salesforce/core';
16
+ import { loadConfig, resolveProjectPaths } from '../../../core/config.loader.js';
17
+ import { TaskRegistry } from '../../../core/task.registry.js';
18
+ import { renderTree } from '../../../core/tree.js';
19
+ Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
20
+ const messages = Messages.loadMessages('@sfship/plugin-ship', 'ship.task.list');
21
+ /** Lists all available tasks. */
22
+ export default class TaskList extends SfCommand {
23
+ static summary = messages.getMessage('summary');
24
+ static description = messages.getMessage('description');
25
+ static examples = messages.getMessages('examples');
26
+ static flags = {
27
+ config: Flags.file({ default: 'ship.yml', summary: messages.getMessage('flags.config.summary') }),
28
+ };
29
+ static enableJsonFlag = false;
30
+ async run() {
31
+ const { flags } = await this.parse(TaskList);
32
+ const config = loadConfig(flags.config);
33
+ const { shipDir } = resolveProjectPaths(flags.config, config);
34
+ const tasks = new TaskRegistry(shipDir).list();
35
+ this.log('');
36
+ this.styledHeader('Task List');
37
+ this.log(renderTree(tasks));
38
+ this.log(StandardColors.info('Tip:') +
39
+ ' Run ' +
40
+ StandardColors.success('sf ship task info <path>') +
41
+ ' to see full details for a task.');
42
+ this.log('');
43
+ }
44
+ }
45
+ //# sourceMappingURL=list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.js","sourceRoot":"","sources":["../../../../src/commands/ship/task/list.ts"],"names":[],"mappings":"AAAA;;;;;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E,MAAM,CAAC,CAAC;QAE9D,MAAM,KAAK,GAAG,IAAI,YAAY,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC;QAE/C,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACb,IAAI,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC;QAC/B,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;QAC5B,IAAI,CAAC,GAAG,CACN,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC;YACzB,OAAO;YACP,cAAc,CAAC,OAAO,CAAC,0BAA0B,CAAC;YAClD,kCAAkC,CACrC,CAAC;QACF,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACf,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { SfCommand } from '@salesforce/sf-plugins-core';
2
+ /** Runs a single task directly, outside of a flow. */
3
+ export default class TaskRun extends SfCommand<void> {
4
+ static readonly summary: string;
5
+ static readonly description: string;
6
+ static readonly examples: string[];
7
+ static readonly args: {
8
+ taskName: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
9
+ };
10
+ static readonly flags: {
11
+ config: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
12
+ param: import("@oclif/core/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/interfaces").CustomOptions>;
13
+ };
14
+ static readonly enableJsonFlag = false;
15
+ run(): Promise<void>;
16
+ }
@@ -0,0 +1,72 @@
1
+ /*
2
+ * Licensed under the Apache License, Version 2.0 (the "License");
3
+ * you may not use this file except in compliance with the License.
4
+ * You may obtain a copy of the License at
5
+ *
6
+ * http://www.apache.org/licenses/LICENSE-2.0
7
+ *
8
+ * Unless required by applicable law or agreed to in writing, software
9
+ * distributed under the License is distributed on an "AS IS" BASIS,
10
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ * See the License for the specific language governing permissions and
12
+ * limitations under the License.
13
+ */
14
+ import { resolve } from 'node:path';
15
+ import { Args } from '@oclif/core';
16
+ import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
17
+ import { Messages } from '@salesforce/core';
18
+ import { loadConfig, resolveProjectPaths } from '../../../core/config.loader.js';
19
+ import { formatTaskPreview } from '../../../core/task.view.js';
20
+ import { createFlowContext } from '../../../core/flow.context.js';
21
+ import { parseCliParams, validateParams } from '../../../core/task.param.js';
22
+ import { OrgRegistry } from '../../../core/org.registry.js';
23
+ import { TaskRegistry } from '../../../core/task.registry.js';
24
+ import { Store } from '../../../core/flow.store.js';
25
+ import { handleError } from '../../../core/error.js';
26
+ Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
27
+ const messages = Messages.loadMessages('@sfship/plugin-ship', 'ship.task.run');
28
+ /** Runs a single task directly, outside of a flow. */
29
+ export default class TaskRun extends SfCommand {
30
+ static summary = messages.getMessage('summary');
31
+ static description = messages.getMessage('description');
32
+ static examples = messages.getMessages('examples');
33
+ static args = {
34
+ taskName: Args.string({ description: messages.getMessage('args.taskName.summary'), required: true }),
35
+ };
36
+ static flags = {
37
+ config: Flags.file({ default: 'ship.yml', summary: messages.getMessage('flags.config.summary') }),
38
+ param: Flags.string({ summary: messages.getMessage('flags.param.summary'), multiple: true }),
39
+ };
40
+ static enableJsonFlag = false;
41
+ async run() {
42
+ const { args, flags } = await this.parse(TaskRun);
43
+ const params = parseCliParams(flags.param ?? []);
44
+ const config = loadConfig(flags.config);
45
+ const { projectDir, shipDir } = resolveProjectPaths(flags.config, config);
46
+ const context = createFlowContext({
47
+ projectDir,
48
+ shipDir,
49
+ config,
50
+ orgs: new OrgRegistry(resolve(shipDir, 'orgs'), config.project.slug),
51
+ log: (message) => this.log(message),
52
+ params,
53
+ runCommand: (id, argv) => this.config.runCommand(id, argv),
54
+ });
55
+ const runner = new TaskRegistry(shipDir);
56
+ const task = await runner.resolveTask(args.taskName);
57
+ this.log('');
58
+ this.log(formatTaskPreview(task));
59
+ const validatedParams = validateParams(params, task.params);
60
+ const store = new Store();
61
+ const output = store.getTaskOutput(args.taskName);
62
+ const taskContext = { flow: context, params: validatedParams, output };
63
+ try {
64
+ await task.run(taskContext);
65
+ }
66
+ catch (err) {
67
+ handleError(err, (msg) => this.log(msg));
68
+ }
69
+ this.log('');
70
+ }
71
+ }
72
+ //# sourceMappingURL=run.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run.js","sourceRoot":"","sources":["../../../../src/commands/ship/task/run.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACjF,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAE9D,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,qBAAqB,EAAE,eAAe,CAAC,CAAC;AAE/E,sDAAsD;AACtD,MAAM,CAAC,OAAO,OAAO,OAAQ,SAAQ,SAAe;IAC3C,MAAM,CAAU,OA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resolves via the annotated tag message on the latest (or pinned) release. */
3
+ export declare const ShipGitHubDependencySchema: z.ZodObject<{
4
+ github: z.ZodString;
5
+ tag: z.ZodOptional<z.ZodString>;
6
+ name: z.ZodOptional<z.ZodString>;
7
+ }, z.core.$strip>;
8
+ /** A plugin-ship package dependency identified by package version ID. */
9
+ export declare const ShipPackageIdDependencySchema: z.ZodObject<{
10
+ versionId: z.ZodString;
11
+ name: z.ZodOptional<z.ZodString>;
12
+ }, z.core.$strip>;
13
+ /** A single entry in a `ship.yml` dependency list. */
14
+ export declare const ShipDependencySchema: z.ZodUnion<readonly [z.ZodObject<{
15
+ github: z.ZodString;
16
+ tag: z.ZodOptional<z.ZodString>;
17
+ name: z.ZodOptional<z.ZodString>;
18
+ }, z.core.$strip>, z.ZodObject<{
19
+ versionId: z.ZodString;
20
+ name: z.ZodOptional<z.ZodString>;
21
+ }, z.core.$strip>]>;
22
+ export type ShipGitHubDependency = z.infer<typeof ShipGitHubDependencySchema>;
23
+ export type ShipPackageIdDependency = z.infer<typeof ShipPackageIdDependencySchema>;
24
+ export type ShipDependency = z.infer<typeof ShipDependencySchema>;
@@ -0,0 +1,34 @@
1
+ /*
2
+ * Licensed under the Apache License, Version 2.0 (the "License");
3
+ * you may not use this file except in compliance with the License.
4
+ * You may obtain a copy of the License at
5
+ *
6
+ * http://www.apache.org/licenses/LICENSE-2.0
7
+ *
8
+ * Unless required by applicable law or agreed to in writing, software
9
+ * distributed under the License is distributed on an "AS IS" BASIS,
10
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ * See the License for the specific language governing permissions and
12
+ * limitations under the License.
13
+ */
14
+ import { z } from 'zod';
15
+ /** A plugin-ship GitHub repository dependency. Resolves via the annotated tag message on the latest (or pinned) release. */
16
+ export const ShipGitHubDependencySchema = z.object({
17
+ /** GitHub repository as a full URL or `owner/repo` slug. */
18
+ github: z.string(),
19
+ /** Pin to a specific release tag instead of resolving to latest. */
20
+ tag: z.string().optional(),
21
+ /** Human-readable label for this dependency, used to name the repo's own package step in log output. */
22
+ name: z.string().optional(),
23
+ });
24
+ /** A plugin-ship package dependency identified by package version ID. */
25
+ export const ShipPackageIdDependencySchema = z.object({
26
+ /** The 04t package version ID. */
27
+ versionId: z.string(),
28
+ /** Human-readable label used in log output. */
29
+ name: z.string().optional(),
30
+ });
31
+ /** A single entry in a `ship.yml` dependency list. */
32
+ export const ShipDependencySchema = z.union([ShipGitHubDependencySchema, ShipPackageIdDependencySchema]);
33
+ /* c8 ignore stop */
34
+ //# sourceMappingURL=config.dependency.schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.dependency.schema.js","sourceRoot":"","sources":["../../src/core/config.dependency.schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,4HAA4H;AAC5H,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC;IACjD,4DAA4D;IAC5D,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,oEAAoE;IACpE,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC1B,wGAAwG;IACxG,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC5B,CAAC,CAAC;AAEH,yEAAyE;AACzE,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,CAAC,MAAM,CAAC;IACpD,kCAAkC;IAClC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,+CAA+C;IAC/C,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC5B,CAAC,CAAC;AAEH,sDAAsD;AACtD,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,0BAA0B,EAAE,6BAA6B,CAAC,CAAC,CAAC;AAKzG,oBAAoB"}
@@ -0,0 +1,23 @@
1
+ import { ShipConfig } from './config.ship.schema.js';
2
+ /**
3
+ * Reads and parses a `ship.yml` config file, validating it against {@link ShipConfigSchema}.
4
+ *
5
+ * @param configPath - Path to the config file. Defaults to `'ship.yml'` in the current directory.
6
+ * @returns The validated {@link ShipConfig}.
7
+ * @throws If the file cannot be read or fails schema validation.
8
+ */
9
+ export declare function loadConfig(configPath?: string): ShipConfig;
10
+ /**
11
+ * Resolves a project's directory layout from the path to its `ship.yml`.
12
+ *
13
+ * `projectDir` is the directory containing the config file; `shipDir` is
14
+ * `config.dir` resolved relative to it. Every command goes through this so
15
+ * `.ship` is located the same way regardless of the process's working directory.
16
+ *
17
+ * @param configPath - The `--config` path to the `ship.yml` file.
18
+ * @param config - The loaded config, for its `dir` setting.
19
+ */
20
+ export declare function resolveProjectPaths(configPath: string, config: ShipConfig): {
21
+ projectDir: string;
22
+ shipDir: string;
23
+ };
@@ -0,0 +1,62 @@
1
+ /*
2
+ * Licensed under the Apache License, Version 2.0 (the "License");
3
+ * you may not use this file except in compliance with the License.
4
+ * You may obtain a copy of the License at
5
+ *
6
+ * http://www.apache.org/licenses/LICENSE-2.0
7
+ *
8
+ * Unless required by applicable law or agreed to in writing, software
9
+ * distributed under the License is distributed on an "AS IS" BASIS,
10
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ * See the License for the specific language governing permissions and
12
+ * limitations under the License.
13
+ */
14
+ import { dirname, join, resolve } from 'node:path';
15
+ import { parse } from 'yaml';
16
+ import { ShipConfigSchema } from './config.ship.schema.js';
17
+ import { readText } from './file.js';
18
+ import { ExpectedError, formatZodError } from './error.js';
19
+ /**
20
+ * Reads and parses a `ship.yml` config file, validating it against {@link ShipConfigSchema}.
21
+ *
22
+ * @param configPath - Path to the config file. Defaults to `'ship.yml'` in the current directory.
23
+ * @returns The validated {@link ShipConfig}.
24
+ * @throws If the file cannot be read or fails schema validation.
25
+ */
26
+ export function loadConfig(configPath = 'ship.yml') {
27
+ let raw;
28
+ try {
29
+ raw = readText(configPath);
30
+ }
31
+ catch {
32
+ throw new ExpectedError(`No ship.yml found at ${configPath}`);
33
+ }
34
+ let parsed;
35
+ try {
36
+ parsed = parse(raw);
37
+ }
38
+ catch (err) {
39
+ throw new ExpectedError(`Could not parse ship.yml: ${err.message}`);
40
+ }
41
+ try {
42
+ return ShipConfigSchema.parse(parsed);
43
+ }
44
+ catch (err) {
45
+ throw new ExpectedError(`Invalid ship.yml:\n${formatZodError(err)}`);
46
+ }
47
+ }
48
+ /**
49
+ * Resolves a project's directory layout from the path to its `ship.yml`.
50
+ *
51
+ * `projectDir` is the directory containing the config file; `shipDir` is
52
+ * `config.dir` resolved relative to it. Every command goes through this so
53
+ * `.ship` is located the same way regardless of the process's working directory.
54
+ *
55
+ * @param configPath - The `--config` path to the `ship.yml` file.
56
+ * @param config - The loaded config, for its `dir` setting.
57
+ */
58
+ export function resolveProjectPaths(configPath, config) {
59
+ const projectDir = resolve(dirname(configPath));
60
+ return { projectDir, shipDir: join(projectDir, config.dir) };
61
+ }
62
+ //# sourceMappingURL=config.loader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.loader.js","sourceRoot":"","sources":["../../src/core/config.loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEnD,OAAO,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAc,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE3D;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,aAAqB,UAAU;IACxD,IAAI,GAAW,CAAC;IAChB,IAAI,CAAC;QACH,GAAG,GAAG,QAAQ,CAAC,UAAU,CAAC,CAAC;IAC7B,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,aAAa,CAAC,wBAAwB,UAAU,EAAE,CAAC,CAAC;IAChE,CAAC;IAED,IAAI,MAAe,CAAC;IACpB,IAAI,CAAC;QACH,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;IACtB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,IAAI,aAAa,CAAC,6BAA8B,GAAa,CAAC,OAAO,EAAE,CAAC,CAAC;IACjF,CAAC;IAED,IAAI,CAAC;QACH,OAAO,gBAAgB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,IAAI,aAAa,CAAC,sBAAsB,cAAc,CAAC,GAAe,CAAC,EAAE,CAAC,CAAC;IACnF,CAAC;AACH,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,mBAAmB,CAAC,UAAkB,EAAE,MAAkB;IACxE,MAAM,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC;IAChD,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC;AAC/D,CAAC"}
@@ -0,0 +1,174 @@
1
+ import { z } from 'zod';
2
+ import { ShipDependency } from './config.dependency.schema.js';
3
+ /** Salesforce packaging metadata for the project. */
4
+ declare const ProjectPackageConfigSchema: z.ZodObject<{
5
+ name: z.ZodString;
6
+ namespace: z.ZodOptional<z.ZodString>;
7
+ type: z.ZodEnum<{
8
+ Managed: "Managed";
9
+ Unlocked: "Unlocked";
10
+ }>;
11
+ permsets: z.ZodOptional<z.ZodArray<z.ZodString>>;
12
+ testPattern: z.ZodDefault<z.ZodString>;
13
+ dependencies: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
14
+ github: z.ZodString;
15
+ tag: z.ZodOptional<z.ZodString>;
16
+ name: z.ZodOptional<z.ZodString>;
17
+ }, z.core.$strip>, z.ZodObject<{
18
+ versionId: z.ZodString;
19
+ name: z.ZodOptional<z.ZodString>;
20
+ }, z.core.$strip>]>>>;
21
+ }, z.core.$strict>;
22
+ /** Git/GitHub configuration for the project. */
23
+ declare const ProjectGitConfigSchema: z.ZodObject<{
24
+ defaultBranch: z.ZodOptional<z.ZodString>;
25
+ repoUrl: z.ZodOptional<z.ZodURL>;
26
+ }, z.core.$strip>;
27
+ /** Top-level project metadata within a ship config. */
28
+ declare const ProjectConfigSchema: z.ZodPipe<z.ZodObject<{
29
+ slug: z.ZodOptional<z.ZodString>;
30
+ package: z.ZodOptional<z.ZodObject<{
31
+ name: z.ZodString;
32
+ namespace: z.ZodOptional<z.ZodString>;
33
+ type: z.ZodEnum<{
34
+ Managed: "Managed";
35
+ Unlocked: "Unlocked";
36
+ }>;
37
+ permsets: z.ZodOptional<z.ZodArray<z.ZodString>>;
38
+ testPattern: z.ZodDefault<z.ZodString>;
39
+ dependencies: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
40
+ github: z.ZodString;
41
+ tag: z.ZodOptional<z.ZodString>;
42
+ name: z.ZodOptional<z.ZodString>;
43
+ }, z.core.$strip>, z.ZodObject<{
44
+ versionId: z.ZodString;
45
+ name: z.ZodOptional<z.ZodString>;
46
+ }, z.core.$strip>]>>>;
47
+ }, z.core.$strict>>;
48
+ git: z.ZodOptional<z.ZodObject<{
49
+ defaultBranch: z.ZodOptional<z.ZodString>;
50
+ repoUrl: z.ZodOptional<z.ZodURL>;
51
+ }, z.core.$strip>>;
52
+ }, z.core.$strict>, z.ZodTransform<{
53
+ slug: string;
54
+ package?: {
55
+ name: string;
56
+ type: "Managed" | "Unlocked";
57
+ testPattern: string;
58
+ namespace?: string | undefined;
59
+ permsets?: string[] | undefined;
60
+ dependencies?: ({
61
+ github: string;
62
+ tag?: string | undefined;
63
+ name?: string | undefined;
64
+ } | {
65
+ versionId: string;
66
+ name?: string | undefined;
67
+ })[] | undefined;
68
+ } | undefined;
69
+ git?: {
70
+ defaultBranch?: string | undefined;
71
+ repoUrl?: string | undefined;
72
+ } | undefined;
73
+ }, {
74
+ slug?: string | undefined;
75
+ package?: {
76
+ name: string;
77
+ type: "Managed" | "Unlocked";
78
+ testPattern: string;
79
+ namespace?: string | undefined;
80
+ permsets?: string[] | undefined;
81
+ dependencies?: ({
82
+ github: string;
83
+ tag?: string | undefined;
84
+ name?: string | undefined;
85
+ } | {
86
+ versionId: string;
87
+ name?: string | undefined;
88
+ })[] | undefined;
89
+ } | undefined;
90
+ git?: {
91
+ defaultBranch?: string | undefined;
92
+ repoUrl?: string | undefined;
93
+ } | undefined;
94
+ }>>;
95
+ /**
96
+ * Zod schema for the top-level `ship.yml`.
97
+ * Defines the project and optional ship directory override.
98
+ */
99
+ export declare const ShipConfigSchema: z.ZodObject<{
100
+ project: z.ZodPipe<z.ZodObject<{
101
+ slug: z.ZodOptional<z.ZodString>;
102
+ package: z.ZodOptional<z.ZodObject<{
103
+ name: z.ZodString;
104
+ namespace: z.ZodOptional<z.ZodString>;
105
+ type: z.ZodEnum<{
106
+ Managed: "Managed";
107
+ Unlocked: "Unlocked";
108
+ }>;
109
+ permsets: z.ZodOptional<z.ZodArray<z.ZodString>>;
110
+ testPattern: z.ZodDefault<z.ZodString>;
111
+ dependencies: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
112
+ github: z.ZodString;
113
+ tag: z.ZodOptional<z.ZodString>;
114
+ name: z.ZodOptional<z.ZodString>;
115
+ }, z.core.$strip>, z.ZodObject<{
116
+ versionId: z.ZodString;
117
+ name: z.ZodOptional<z.ZodString>;
118
+ }, z.core.$strip>]>>>;
119
+ }, z.core.$strict>>;
120
+ git: z.ZodOptional<z.ZodObject<{
121
+ defaultBranch: z.ZodOptional<z.ZodString>;
122
+ repoUrl: z.ZodOptional<z.ZodURL>;
123
+ }, z.core.$strip>>;
124
+ }, z.core.$strict>, z.ZodTransform<{
125
+ slug: string;
126
+ package?: {
127
+ name: string;
128
+ type: "Managed" | "Unlocked";
129
+ testPattern: string;
130
+ namespace?: string | undefined;
131
+ permsets?: string[] | undefined;
132
+ dependencies?: ({
133
+ github: string;
134
+ tag?: string | undefined;
135
+ name?: string | undefined;
136
+ } | {
137
+ versionId: string;
138
+ name?: string | undefined;
139
+ })[] | undefined;
140
+ } | undefined;
141
+ git?: {
142
+ defaultBranch?: string | undefined;
143
+ repoUrl?: string | undefined;
144
+ } | undefined;
145
+ }, {
146
+ slug?: string | undefined;
147
+ package?: {
148
+ name: string;
149
+ type: "Managed" | "Unlocked";
150
+ testPattern: string;
151
+ namespace?: string | undefined;
152
+ permsets?: string[] | undefined;
153
+ dependencies?: ({
154
+ github: string;
155
+ tag?: string | undefined;
156
+ name?: string | undefined;
157
+ } | {
158
+ versionId: string;
159
+ name?: string | undefined;
160
+ })[] | undefined;
161
+ } | undefined;
162
+ git?: {
163
+ defaultBranch?: string | undefined;
164
+ repoUrl?: string | undefined;
165
+ } | undefined;
166
+ }>>;
167
+ dir: z.ZodDefault<z.ZodString>;
168
+ }, z.core.$strict>;
169
+ export type { ShipDependency };
170
+ export type ProjectConfig = z.infer<typeof ProjectConfigSchema>;
171
+ export type ProjectPackageConfig = z.infer<typeof ProjectPackageConfigSchema>;
172
+ export type ProjectGitConfig = z.infer<typeof ProjectGitConfigSchema>;
173
+ /** The validated top-level ship configuration, inferred from {@link ShipConfigSchema}. */
174
+ export type ShipConfig = z.infer<typeof ShipConfigSchema>;
@@ -0,0 +1,67 @@
1
+ /*
2
+ * Licensed under the Apache License, Version 2.0 (the "License");
3
+ * you may not use this file except in compliance with the License.
4
+ * You may obtain a copy of the License at
5
+ *
6
+ * http://www.apache.org/licenses/LICENSE-2.0
7
+ *
8
+ * Unless required by applicable law or agreed to in writing, software
9
+ * distributed under the License is distributed on an "AS IS" BASIS,
10
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ * See the License for the specific language governing permissions and
12
+ * limitations under the License.
13
+ */
14
+ import { z } from 'zod';
15
+ import { ShipDependencySchema } from './config.dependency.schema.js';
16
+ /** Salesforce packaging metadata for the project. */
17
+ const ProjectPackageConfigSchema = z
18
+ .object({
19
+ /** The package name as it appears in the Salesforce packaging UI. */
20
+ name: z.string(),
21
+ /** The package namespace. */
22
+ namespace: z.string().optional(),
23
+ type: z.enum(['Managed', 'Unlocked']),
24
+ /** Permission sets (and/or permission set groups) to assign to the running user after package install in flow contexts. */
25
+ permsets: z.array(z.string()).optional(),
26
+ /** Glob pattern used to discover Apex test classes. Defaults to "*_Test". */
27
+ testPattern: z.string().default('*_Test'),
28
+ /** Packages to install before deploying or packaging. */
29
+ dependencies: z.array(ShipDependencySchema).optional(),
30
+ })
31
+ .strict();
32
+ /** Git/GitHub configuration for the project. */
33
+ const ProjectGitConfigSchema = z.object({
34
+ /** The main branch name. Defaults to `main`. */
35
+ defaultBranch: z.string().optional(),
36
+ /** The GitHub repository URL. */
37
+ repoUrl: z.url().optional(),
38
+ });
39
+ /** Top-level project metadata within a ship config. */
40
+ const ProjectConfigSchema = z
41
+ .object({
42
+ /** URL/alias-safe slug used as a prefix for generated org aliases. Defaults to package.name lowercased with spaces replaced by hyphens. */
43
+ slug: z.string().optional(),
44
+ /** Optional Salesforce package metadata. */
45
+ package: ProjectPackageConfigSchema.optional(),
46
+ /** Optional Git repository configuration. */
47
+ git: ProjectGitConfigSchema.optional(),
48
+ })
49
+ .strict()
50
+ .transform((data) => ({
51
+ ...data,
52
+ slug: data.slug ?? data.package?.name?.toLowerCase().replace(/\s+/g, '-') ?? 'project',
53
+ }));
54
+ /**
55
+ * Zod schema for the top-level `ship.yml`.
56
+ * Defines the project and optional ship directory override.
57
+ */
58
+ export const ShipConfigSchema = z
59
+ .object({
60
+ /** Project metadata. */
61
+ project: ProjectConfigSchema,
62
+ /** Directory used to resolve custom tasks, scratch-org defs, and other ship assets. Defaults to `.ship`. */
63
+ dir: z.string().default('.ship'),
64
+ })
65
+ .strict();
66
+ /* c8 ignore stop */
67
+ //# sourceMappingURL=config.ship.schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.ship.schema.js","sourceRoot":"","sources":["../../src/core/config.ship.schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,oBAAoB,EAAkB,MAAM,+BAA+B,CAAC;AAErF,qDAAqD;AACrD,MAAM,0BAA0B,GAAG,CAAC;KACjC,MAAM,CAAC;IACN,qEAAqE;IACrE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,6BAA6B;IAC7B,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAChC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;IACrC,2HAA2H;IAC3H,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IACxC,6EAA6E;IAC7E,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC;IACzC,yDAAyD;IACzD,YAAY,EAAE,CAAC,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC,QAAQ,EAAE;CACvD,CAAC;KACD,MAAM,EAAE,CAAC;AAEZ,gDAAgD;AAChD,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,gDAAgD;IAChD,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACpC,iCAAiC;IACjC,OAAO,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;CAC5B,CAAC,CAAC;AAEH,uDAAuD;AACvD,MAAM,mBAAmB,GAAG,CAAC;KAC1B,MAAM,CAAC;IACN,2IAA2I;IAC3I,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC3B,4CAA4C;IAC5C,OAAO,EAAE,0BAA0B,CAAC,QAAQ,EAAE;IAC9C,6CAA6C;IAC7C,GAAG,EAAE,sBAAsB,CAAC,QAAQ,EAAE;CACvC,CAAC;KACD,MAAM,EAAE;KACR,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IACpB,GAAG,IAAI;IACP,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,SAAS;CACvF,CAAC,CAAC,CAAC;AAEN;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC;KAC9B,MAAM,CAAC;IACN,wBAAwB;IACxB,OAAO,EAAE,mBAAmB;IAC5B,4GAA4G;IAC5G,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC;CACjC,CAAC;KACD,MAAM,EAAE,CAAC;AAQZ,oBAAoB"}
@@ -0,0 +1,29 @@
1
+ import { ZodError } from 'zod';
2
+ /**
3
+ * Coerces an unknown caught value into an `Error`.
4
+ * Returns the original instance if it is already an `Error`; otherwise wraps it with `String()`.
5
+ *
6
+ * @param err - The value caught in a `catch` block.
7
+ */
8
+ export declare function asError(err: unknown): Error;
9
+ /**
10
+ * Formats a ZodError into a human-readable string for display in CLI output.
11
+ *
12
+ * @param err - The ZodError to format.
13
+ */
14
+ export declare function formatZodError(err: ZodError): string;
15
+ /**
16
+ * An error thrown when a known, user-facing failure occurs — invalid input,
17
+ * missing config, etc. The flow renderer suppresses the stack trace for these
18
+ * since they indicate a user mistake rather than an unexpected bug.
19
+ */
20
+ export declare class ExpectedError extends Error {
21
+ }
22
+ /**
23
+ * Handles a caught error uniformly.
24
+ * - `ExpectedError`: prints the message and exits with code 1 (no stack trace).
25
+ * - Anything else: rethrows so the caller sees a full stack trace.
26
+ *
27
+ * @param err - The value caught in a `catch` block.
28
+ */
29
+ export declare function handleError(err: unknown, log: (message: string) => void): never;
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Coerces an unknown caught value into an `Error`.
3
+ * Returns the original instance if it is already an `Error`; otherwise wraps it with `String()`.
4
+ *
5
+ * @param err - The value caught in a `catch` block.
6
+ */
7
+ export function asError(err) {
8
+ return err instanceof Error ? err : new Error(String(err));
9
+ }
10
+ function formatIssue(issue, pathPrefix = []) {
11
+ const fullPath = [...pathPrefix, ...issue.path].join('.');
12
+ const label = fullPath || '(root)';
13
+ if (issue.code === 'invalid_union' && issue.errors?.length) {
14
+ const variants = issue.errors
15
+ .map((variantIssues) => {
16
+ const first = variantIssues[0];
17
+ // c8 ignore next — Zod always provides at least one issue per union variant
18
+ if (!first)
19
+ return null;
20
+ const variantPath = [...pathPrefix, ...issue.path, ...first.path].join('.');
21
+ return ` ${variantPath || '(root)'}: ${first.message}`;
22
+ })
23
+ .filter(Boolean)
24
+ .join('\n');
25
+ return ` - ${label}: Invalid input — expected one of:\n${variants}`;
26
+ }
27
+ return ` - ${label}: ${issue.message}`;
28
+ }
29
+ /**
30
+ * Formats a ZodError into a human-readable string for display in CLI output.
31
+ *
32
+ * @param err - The ZodError to format.
33
+ */
34
+ export function formatZodError(err) {
35
+ return err.issues.map((i) => formatIssue(i)).join('\n');
36
+ }
37
+ /**
38
+ * An error thrown when a known, user-facing failure occurs — invalid input,
39
+ * missing config, etc. The flow renderer suppresses the stack trace for these
40
+ * since they indicate a user mistake rather than an unexpected bug.
41
+ */
42
+ export class ExpectedError extends Error {
43
+ }
44
+ /**
45
+ * Handles a caught error uniformly.
46
+ * - `ExpectedError`: prints the message and exits with code 1 (no stack trace).
47
+ * - Anything else: rethrows so the caller sees a full stack trace.
48
+ *
49
+ * @param err - The value caught in a `catch` block.
50
+ */
51
+ export function handleError(err, log) {
52
+ const error = asError(err);
53
+ if (error instanceof ExpectedError) {
54
+ log(error.message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