@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,270 @@
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
+ /* eslint-disable camelcase */
15
+ import { join } from 'node:path';
16
+ import { parse } from 'yaml';
17
+ import { ensureDir, writeBinary } from './file.js';
18
+ import { getToken, setToken } from './service.js';
19
+ import { ExpectedError } from './error.js';
20
+ const SERVICE = 'github';
21
+ /** Returns the stored GitHub access token for the given alias, or `undefined` if not connected. */
22
+ export function getGithubToken(alias = 'default') {
23
+ return getToken(SERVICE, alias) ?? undefined;
24
+ }
25
+ /**
26
+ * Persists a GitHub access token securely for the given alias.
27
+ * The token is stored in the OS keychain; metadata is written alongside it.
28
+ */
29
+ export function setGithubToken(token, username, alias = 'default', scopes = []) {
30
+ setToken(SERVICE, username, alias, token, scopes);
31
+ }
32
+ // ---- URL utilities -----------------------------------------------------------
33
+ /** Normalises a GitHub reference to an `owner/repo` slug, accepting full URLs or slugs. */
34
+ export function normalizeRepo(github) {
35
+ return github.replace(/^https?:\/\/github\.com\//, '').replace(/\.git$/, '');
36
+ }
37
+ // ---- Internal ----------------------------------------------------------------
38
+ function githubHeaders() {
39
+ const token = getGithubToken();
40
+ const headers = { Accept: 'application/vnd.github+json' };
41
+ if (token)
42
+ headers['Authorization'] = `Bearer ${token}`;
43
+ return headers;
44
+ }
45
+ /** Fetches the authenticated user and their granted OAuth scopes. */
46
+ export async function fetchGithubUser(token) {
47
+ const resp = await fetch('https://api.github.com/user', {
48
+ headers: { Authorization: `Bearer ${token}`, 'User-Agent': 'plugin-ship' },
49
+ });
50
+ const user = (await resp.json());
51
+ const scopes = (resp.headers.get('x-oauth-scopes') ?? '')
52
+ .split(',')
53
+ .map((s) => s.trim())
54
+ .filter(Boolean);
55
+ return { user, scopes };
56
+ }
57
+ // ---- API helpers -------------------------------------------------------------
58
+ /**
59
+ * Fetches a GitHub release for `repo`. Returns `null` if no release exists.
60
+ * When `tag` is provided, fetches that specific release.
61
+ * When `prerelease` is true, fetches the latest pre-release; otherwise fetches the latest production release.
62
+ */
63
+ export async function fetchRelease(repo, tag, prerelease = false) {
64
+ if (prerelease && !tag) {
65
+ const res = await fetch(`https://api.github.com/repos/${repo}/releases?per_page=100`, {
66
+ headers: githubHeaders(),
67
+ });
68
+ if (!res.ok)
69
+ return null;
70
+ const releases = (await res.json());
71
+ const found = releases.find((r) => r.prerelease);
72
+ return found ? { tagName: found.tag_name } : null;
73
+ }
74
+ const url = tag
75
+ ? `https://api.github.com/repos/${repo}/releases/tags/${encodeURIComponent(tag)}`
76
+ : `https://api.github.com/repos/${repo}/releases/latest`;
77
+ const res = await fetch(url, { headers: githubHeaders() });
78
+ if (res.status === 404)
79
+ return null;
80
+ if (!res.ok)
81
+ throw new ExpectedError(`Failed to fetch release for ${repo}: ${res.statusText}`);
82
+ const data = (await res.json());
83
+ return { tagName: data.tag_name };
84
+ }
85
+ /** Fetches raw file content from a GitHub repository at a specific ref. Returns `null` if the file does not exist. */
86
+ export async function fetchRaw(repo, ref, filename) {
87
+ const res = await fetch(`https://raw.githubusercontent.com/${repo}/${ref}/${filename}`);
88
+ if (res.status === 404)
89
+ return null;
90
+ if (!res.ok)
91
+ throw new ExpectedError(`Failed to fetch ${filename} from ${repo}@${ref}: ${res.statusText}`);
92
+ return res.text();
93
+ }
94
+ /**
95
+ * Fetches the annotated git tag object for `tagName` in `repo`.
96
+ * Returns `null` for lightweight tags (no message) or if the tag does not exist.
97
+ */
98
+ export async function fetchGitTag(repo, tagName) {
99
+ const refRes = await fetch(`https://api.github.com/repos/${repo}/git/refs/tags/${encodeURIComponent(tagName)}`, {
100
+ headers: githubHeaders(),
101
+ });
102
+ if (!refRes.ok)
103
+ return null;
104
+ const ref = (await refRes.json());
105
+ if (ref.object.type !== 'tag')
106
+ return null;
107
+ const tagRes = await fetch(`https://api.github.com/repos/${repo}/git/tags/${ref.object.sha}`, {
108
+ headers: githubHeaders(),
109
+ });
110
+ if (!tagRes.ok)
111
+ return null;
112
+ return (await tagRes.json());
113
+ }
114
+ /** Fetches basic repository metadata from the GitHub API using an explicit token. */
115
+ export async function fetchRepoInfo(repo, token) {
116
+ const resp = await fetch(`https://api.github.com/repos/${repo}`, {
117
+ headers: { Authorization: `Bearer ${token}`, Accept: 'application/vnd.github+json' },
118
+ });
119
+ if (!resp.ok)
120
+ throw new ExpectedError(`GitHub API error: ${resp.status} ${resp.statusText}`);
121
+ return (await resp.json());
122
+ }
123
+ /**
124
+ * Returns the package namespace declared in a CCI repo's `cumulusci.yml` at `ref`.
125
+ * Returns an empty string if the file is missing or declares no namespace.
126
+ */
127
+ export async function fetchCciNamespace(repo, ref) {
128
+ const raw = await fetchRaw(repo, ref, 'cumulusci.yml');
129
+ if (!raw)
130
+ return '';
131
+ const parsed = parse(raw);
132
+ return parsed?.project?.package?.namespace ?? '';
133
+ }
134
+ /**
135
+ * Lists the immediate subdirectories of `path` in a GitHub repo at `ref`.
136
+ * Returns an empty array if the path does not exist.
137
+ */
138
+ export async function fetchSubdirs(repo, ref, path) {
139
+ const url = `https://api.github.com/repos/${repo}/contents/${path}?ref=${encodeURIComponent(ref)}`;
140
+ const res = await fetch(url, { headers: githubHeaders() });
141
+ if (res.status === 404)
142
+ return [];
143
+ if (!res.ok)
144
+ throw new ExpectedError(`Failed to list ${path} in ${repo}@${ref}: ${res.statusText}`);
145
+ const entries = (await res.json());
146
+ return entries.filter((e) => e.type === 'dir').map((e) => `${path}/${e.name}`);
147
+ }
148
+ /** Downloads a GitHub repository directory at `ref` into `localDir`, recursing into subdirectories. */
149
+ export async function downloadDir(repo, ref, remotePath, localDir) {
150
+ const url = `https://api.github.com/repos/${repo}/contents/${remotePath}?ref=${encodeURIComponent(ref)}`;
151
+ const res = await fetch(url, { headers: githubHeaders() });
152
+ if (!res.ok)
153
+ throw new ExpectedError(`Failed to fetch ${remotePath} from ${repo}@${ref}: ${res.statusText}`);
154
+ const entries = (await res.json());
155
+ ensureDir(localDir);
156
+ await Promise.all(entries.map(async (entry) => {
157
+ const entryLocal = join(localDir, entry.name);
158
+ if (entry.type === 'dir') {
159
+ await downloadDir(repo, ref, entry.path, entryLocal);
160
+ }
161
+ else {
162
+ let buf;
163
+ if (entry.content && entry.encoding === 'base64') {
164
+ buf = Buffer.from(entry.content.replace(/\n/g, ''), 'base64');
165
+ }
166
+ else if (entry.download_url) {
167
+ const fileRes = await fetch(entry.download_url, { headers: githubHeaders() });
168
+ buf = Buffer.from(await fileRes.arrayBuffer());
169
+ }
170
+ else {
171
+ throw new ExpectedError(`Cannot download ${entry.path}: no content or download_url available`);
172
+ }
173
+ writeBinary(entryLocal, buf);
174
+ }
175
+ }));
176
+ }
177
+ // ---- Authenticated API helper ------------------------------------------------
178
+ /** Authenticated GitHub API call. Throws ExpectedError on non-2xx. */
179
+ export async function gh(token, path, init) {
180
+ const headers = {
181
+ Authorization: `Bearer ${token}`,
182
+ Accept: 'application/vnd.github+json',
183
+ };
184
+ if (init?.body !== undefined)
185
+ headers['Content-Type'] = 'application/json';
186
+ const resp = await fetch(`https://api.github.com${path}`, {
187
+ method: init?.method,
188
+ headers,
189
+ body: init?.body !== undefined ? JSON.stringify(init.body) : undefined,
190
+ });
191
+ if (!resp.ok) {
192
+ const text = await resp.text();
193
+ throw new ExpectedError(`GitHub API ${resp.status} ${resp.statusText} on ${path}: ${text}`);
194
+ }
195
+ const data = await resp.json();
196
+ return data;
197
+ }
198
+ /** Returns the SHA of the first commit on the repo's default branch, or null. */
199
+ export async function fetchFirstCommitSha(repo, token) {
200
+ const headers = { Authorization: `Bearer ${token}`, Accept: 'application/vnd.github+json' };
201
+ const resp = await fetch(`https://api.github.com/repos/${repo}/commits?per_page=1`, { headers });
202
+ if (!resp.ok)
203
+ return null;
204
+ const linkHeader = resp.headers.get('link');
205
+ if (!linkHeader) {
206
+ const data = await resp.json();
207
+ const commits = data;
208
+ return commits[0]?.sha ?? null;
209
+ }
210
+ const lastMatch = linkHeader.match(/<[^>]*[?&]page=(\d+)[^>]*>;\s*rel="last"/);
211
+ if (!lastMatch)
212
+ return null;
213
+ const lastResp = await fetch(`https://api.github.com/repos/${repo}/commits?per_page=1&page=${lastMatch[1]}`, {
214
+ headers,
215
+ });
216
+ if (!lastResp.ok)
217
+ return null;
218
+ const lastData = await lastResp.json();
219
+ const lastCommits = lastData;
220
+ return lastCommits[0]?.sha ?? null;
221
+ }
222
+ /** Resolves a commit SHA from a full 40-char SHA, branch name, or the repo's default branch. */
223
+ export async function resolveCommitSha(target, token, repo) {
224
+ if (target && /^[0-9a-f]{40}$/i.test(target))
225
+ return target;
226
+ let branchName = target;
227
+ if (!branchName) {
228
+ const repoInfo = await gh(token, `/repos/${repo}`);
229
+ branchName = repoInfo.default_branch;
230
+ }
231
+ const branchInfo = await gh(token, `/repos/${repo}/branches/${branchName}`);
232
+ return branchInfo.commit.sha;
233
+ }
234
+ // ---- OAuth device flow -------------------------------------------------------
235
+ const CLIENT_ID = 'Ov23liy9NAepXOSybR7K';
236
+ const DEVICE_CODE_URL = 'https://github.com/login/device/code';
237
+ const TOKEN_URL = 'https://github.com/login/oauth/access_token';
238
+ const SCOPE = 'repo';
239
+ /** Initiates the GitHub OAuth device flow and returns the device code response. */
240
+ export async function requestDeviceCode() {
241
+ const resp = await fetch(DEVICE_CODE_URL, {
242
+ method: 'POST',
243
+ headers: { Accept: 'application/json', 'Content-Type': 'application/json' },
244
+ body: JSON.stringify({ client_id: CLIENT_ID, scope: SCOPE }),
245
+ });
246
+ return resp.json();
247
+ }
248
+ /** Polls the GitHub token endpoint until the user authorizes the device or an error occurs. */
249
+ export async function pollForToken(deviceCode, interval) {
250
+ await new Promise((res) => setTimeout(res, interval));
251
+ const resp = await fetch(TOKEN_URL, {
252
+ method: 'POST',
253
+ headers: { Accept: 'application/json', 'Content-Type': 'application/json' },
254
+ body: JSON.stringify({
255
+ client_id: CLIENT_ID,
256
+ device_code: deviceCode,
257
+ grant_type: 'urn:ietf:params:oauth:grant-type:device_code',
258
+ }),
259
+ });
260
+ const data = (await resp.json());
261
+ if (data.access_token)
262
+ return data.access_token;
263
+ // c8 ignore next — slow_down retry delay is always ≥5 s; testing would block the suite
264
+ if (data.error === 'slow_down')
265
+ return pollForToken(deviceCode, ((data.interval ?? interval) / 1000 + 5) * 1000);
266
+ if (data.error === 'authorization_pending')
267
+ return pollForToken(deviceCode, interval);
268
+ throw new ExpectedError(`GitHub authorization failed: ${data.error ?? 'unknown error'}`);
269
+ }
270
+ //# sourceMappingURL=service.github.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service.github.js","sourceRoot":"","sources":["../../src/core/service.github.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,8BAA8B;AAE9B,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAElD,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,MAAM,OAAO,GAAG,QAAQ,CAAC;AAOzB,mGAAmG;AACnG,MAAM,UAAU,cAAc,CAAC,KAAK,GAAG,SAAS;IAC9C,OAAO,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,SAAS,CAAC;AAC/C,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,KAAa,EAAE,QAAgB,EAAE,KAAK,GAAG,SAAS,EAAE,SAAmB,EAAE;IACtG,QAAQ,CAAC,OAAO,EA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,CAAC;AAED,+FAA+F;AAC/F,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,UAAkB,EAAE,QAAgB;IACrE,MAAM,IAAI,OAAO,CAAO,CAAC,GAAG,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC;IAC5D,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,SAAS,EAAE;QAClC,MAAM,EAAE,MAAM;QACd,OAAO,EAAE,EAAE,MAAM,EAAE,kBAAkB,EAAE,cAAc,EAAE,kBAAkB,EAAE;QAC3E,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;YACnB,SAAS,EAAE,SAAS;YAEpB,WAAW,EAAE,UAAU;YAEvB,UAAU,EAAE,8CAA8C;SAC3D,CAAC;KACH,CAAC,CAAC;IACH,MAAM,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC,IAAI,EAAE,CAAsB,CAAC;IACtD,IAAI,IAAI,CAAC,YAAY;QAAE,OAAO,IAAI,CAAC,YAAY,CAAC;IAChD,uFAAuF;IACvF,IAAI,IAAI,CAAC,KAAK,KAAK,WAAW;QAAE,OAAO,YAAY,CAAC,UAAU,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;IACjH,IAAI,IAAI,CAAC,KAAK,KAAK,uBAAuB;QAAE,OAAO,YAAY,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;IACtF,MAAM,IAAI,aAAa,CAAC,gCAAgC,IAAI,CAAC,KAAK,IAAI,eAAe,EAAE,CAAC,CAAC;AAC3F,CAAC"}
@@ -0,0 +1,91 @@
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 { join } from 'node:path';
15
+ import { homedir } from 'node:os';
16
+ import { Entry } from '@napi-rs/keyring';
17
+ import { ensureDir, listDir, readJson, writeJson, removeFile } from './file.js';
18
+ const KEYRING_SERVICE = 'plugin-ship';
19
+ /** Returns the path to the plugin-ship services directory, creating it if needed. */
20
+ function getServicesDir() {
21
+ const dir = join(homedir(), '.sf', 'plugin-ship', 'services');
22
+ ensureDir(dir);
23
+ return dir;
24
+ }
25
+ function metaFilePath(service, account, alias) {
26
+ return join(getServicesDir(), `${service}-${account}-${alias}.meta.json`);
27
+ }
28
+ /**
29
+ * Retrieves the stored token for a service alias from the OS keychain.
30
+ *
31
+ * @param service - The external service name (e.g. `'github.com'`).
32
+ * @param alias - The account alias (e.g. `'default'`).
33
+ * @returns The stored token, or `null` if not found.
34
+ */
35
+ export function getToken(service, alias) {
36
+ return new Entry(KEYRING_SERVICE, `${service}:${alias}`).getPassword() ?? null;
37
+ }
38
+ /**
39
+ * Stores a token in the OS keychain and writes a metadata file alongside it.
40
+ *
41
+ * @param service - The external service name (e.g. `'github.com'`).
42
+ * @param account - The account identifier (e.g. GitHub username).
43
+ * @param alias - The account alias (e.g. `'default'`).
44
+ * @param token - The credential to store.
45
+ * @param scopes - The scopes or permissions granted to this credential.
46
+ */
47
+ export function setToken(service, account, alias, token, scopes = []) {
48
+ new Entry(KEYRING_SERVICE, `${service}:${alias}`).setPassword(token);
49
+ writeJson(metaFilePath(service, account, alias), { service, account, alias, scopes });
50
+ }
51
+ /**
52
+ * Reads the metadata for a stored credential by alias.
53
+ *
54
+ * @param service - The external service name.
55
+ * @param alias - The account alias to look up.
56
+ * @returns The metadata, or `undefined` if no credential is stored for this alias.
57
+ */
58
+ export function getMeta(service, alias) {
59
+ const dir = getServicesDir();
60
+ const file = listDir(dir).find((f) => f.startsWith(`${service}-`) && f.endsWith(`-${alias}.meta.json`));
61
+ if (!file)
62
+ return undefined;
63
+ return readJson(join(dir, file));
64
+ }
65
+ /**
66
+ * Returns metadata for all stored credentials.
67
+ */
68
+ export function listMetas() {
69
+ const dir = getServicesDir();
70
+ return listDir(dir)
71
+ .filter((f) => f.endsWith('.meta.json'))
72
+ .map((f) => readJson(join(dir, f)));
73
+ }
74
+ /**
75
+ * Removes a stored credential from the OS keychain and deletes its metadata file.
76
+ *
77
+ * @param service - The external service name.
78
+ * @param account - The account identifier.
79
+ * @param alias - The account alias.
80
+ */
81
+ export function deleteToken(service, account, alias) {
82
+ new Entry(KEYRING_SERVICE, `${service}:${alias}`).deletePassword();
83
+ try {
84
+ removeFile(metaFilePath(service, account, alias));
85
+ }
86
+ catch (err) {
87
+ if (err.code !== 'ENOENT')
88
+ throw err;
89
+ }
90
+ }
91
+ //# sourceMappingURL=service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service.js","sourceRoot":"","sources":["../../src/core/service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEhF,MAAM,eAAe,GAAG,aAAa,CAAC;AAUtC,qFAAqF;AACrF,SAAS,cAAc;IACrB,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,aAAa,EAAE,UAAU,CAAC,CAAC;IAC9D,SAAS,CAAC,GAAG,CAAC,CAAC;IACf,OAAO,GAAG,CAAC;AACb,CAAC;AAED,SAAS,YAAY,CAAC,OAAe,EAAE,OAAe,EAAE,KAAa;IACnE,OAAO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AChB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;SACvC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAc,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;AACrD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAAC,OAAe,EAAE,OAAe,EAAE,KAAa;IACzE,IAAI,KAAK,CAAC,eAAe,EAAE,GAAG,OAAO,IAAI,KAAK,EAAE,CAAC,CAAC,cAAc,EAAE,CAAC;IACnE,IAAI,CAAC;QACH,UAAU,CAAC,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;IACpD,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAK,GAA6B,CAAC,IAAI,KAAK,QAAQ;YAAE,MAAM,GAAG,CAAC;IAClE,CAAC;AACH,CAAC"}
@@ -0,0 +1,25 @@
1
+ /** A single `packageDirectories` entry. Only the fields ship reads or writes are typed. */
2
+ export type PackageDirectory = {
3
+ [key: string]: unknown;
4
+ path: string;
5
+ package?: string;
6
+ default?: boolean;
7
+ dependencies?: Array<{
8
+ package: string;
9
+ versionNumber?: string;
10
+ }>;
11
+ };
12
+ /** The parsed shape of `sfdx-project.json`. Unmodeled fields are preserved on write. */
13
+ export type SfdxProject = {
14
+ [key: string]: unknown;
15
+ packageDirectories: PackageDirectory[];
16
+ packageAliases?: Record<string, string>;
17
+ };
18
+ /** Reads and parses `sfdx-project.json` from the project directory. */
19
+ export declare function readSfdxProject(projectDir: string): SfdxProject;
20
+ /** Writes `sfdx-project.json` back, preserving 2-space indentation and a trailing newline. */
21
+ export declare function writeSfdxProject(projectDir: string, project: SfdxProject): void;
22
+ /** Returns the default packageDirectory (the one flagged `default`, else the first), or undefined if none exist. */
23
+ export declare function defaultPackageDirectory(project: SfdxProject): PackageDirectory | undefined;
24
+ /** Reads sfdx-project.json and returns the package alias of the default packageDirectory. Returns null on any error. */
25
+ export declare function defaultPackageAlias(projectDir: string): string | null;
@@ -0,0 +1,39 @@
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 { join } from 'node:path';
15
+ import { readJson, writeJson } from './file.js';
16
+ const FILE = 'sfdx-project.json';
17
+ /** Reads and parses `sfdx-project.json` from the project directory. */
18
+ export function readSfdxProject(projectDir) {
19
+ return readJson(join(projectDir, FILE));
20
+ }
21
+ /** Writes `sfdx-project.json` back, preserving 2-space indentation and a trailing newline. */
22
+ export function writeSfdxProject(projectDir, project) {
23
+ writeJson(join(projectDir, FILE), project);
24
+ }
25
+ /** Returns the default packageDirectory (the one flagged `default`, else the first), or undefined if none exist. */
26
+ export function defaultPackageDirectory(project) {
27
+ return project.packageDirectories?.find((d) => d.default) ?? project.packageDirectories?.[0];
28
+ }
29
+ /** Reads sfdx-project.json and returns the package alias of the default packageDirectory. Returns null on any error. */
30
+ export function defaultPackageAlias(projectDir) {
31
+ try {
32
+ const project = readSfdxProject(projectDir);
33
+ return defaultPackageDirectory(project)?.package ?? null;
34
+ }
35
+ catch {
36
+ return null;
37
+ }
38
+ }
39
+ //# sourceMappingURL=sfdx-project.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sfdx-project.js","sourceRoot":"","sources":["../../src/core/sfdx-project.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAkBhD,MAAM,IAAI,GAAG,mBAAmB,CAAC;AAEjC,uEAAuE;AACvE,MAAM,UAAU,eAAe,CAAC,UAAkB;IAChD,OAAO,QAAQ,CAAc,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC,CAAC;AACvD,CAAC;AAED,8FAA8F;AAC9F,MAAM,UAAU,gBAAgB,CAAC,UAAkB,EAAE,OAAoB;IACvE,SAAS,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC;AAC7C,CAAC;AAED,oHAAoH;AACpH,MAAM,UAAU,uBAAuB,CAAC,OAAoB;IAC1D,OAAO,OAAO,CAAC,kBAAkB,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAAC,CAAC,CAAC;AAC/F,CAAC;AAED,wHAAwH;AACxH,MAAM,UAAU,mBAAmB,CAAC,UAAkB;IACpD,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,eAAe,CAAC,UAAU,CAAC,CAAC;QAC5C,OAAO,uBAAuB,CAAC,OAAO,CAAC,EAAE,OAAO,IAAI,IAAI,CAAC;IAC3D,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -0,0 +1 @@
1
+ export declare function withSuppressedStdout<T>(fn: () => Promise<T>): Promise<T>;
@@ -0,0 +1,27 @@
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
+ export async function withSuppressedStdout(fn) {
15
+ const originalOut = process.stdout.write.bind(process.stdout);
16
+ const originalErr = process.stderr.write.bind(process.stderr);
17
+ process.stdout.write = () => true;
18
+ process.stderr.write = () => true;
19
+ try {
20
+ return await fn();
21
+ }
22
+ finally {
23
+ process.stdout.write = originalOut;
24
+ process.stderr.write = originalErr;
25
+ }
26
+ }
27
+ //# sourceMappingURL=stdout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stdout.js","sourceRoot":"","sources":["../../src/core/stdout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAI,EAAoB;IAChE,MAAM,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC9D,MAAM,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC9D,OAAO,CAAC,MAAM,CAAC,KAAK,GAAG,GAAY,EAAE,CAAC,IAAI,CAAC;IAC3C,OAAO,CAAC,MAAM,CAAC,KAAK,GAAG,GAAY,EAAE,CAAC,IAAI,CAAC;IAC3C,IAAI,CAAC;QACH,OAAO,MAAM,EAAE,EAAE,CAAC;IACpB,CAAC;YAAS,CAAC;QACT,OAAO,CAAC,MAAM,CAAC,KAAK,GAAG,WAAW,CAAC;QACnC,OAAO,CAAC,MAAM,CAAC,KAAK,GAAG,WAAW,CAAC;IACrC,CAAC;AACH,CAAC"}
@@ -0,0 +1,69 @@
1
+ import { z } from 'zod';
2
+ import { Params } from './task.param.schema.js';
3
+ import { FlowContext } from './flow.context.js';
4
+ import { TaskOutput } from './task.output.js';
5
+ /** Zod schema for a value this task writes to the flow outputs. */
6
+ export declare const TaskOutputDefinitionSchema: z.ZodObject<{
7
+ name: z.ZodString;
8
+ type: z.ZodEnum<{
9
+ string: "string";
10
+ number: "number";
11
+ boolean: "boolean";
12
+ object: "object";
13
+ }>;
14
+ description: z.ZodString;
15
+ }, z.core.$strip>;
16
+ /** Describes a value this task writes to the flow outputs. */
17
+ export type TaskOutputDefinition = z.infer<typeof TaskOutputDefinitionSchema>;
18
+ /**
19
+ * The runtime context passed to a task's `run()` method.
20
+ * Combines the broader flow context with the task's resolved, validated params.
21
+ */
22
+ export type TaskContext = {
23
+ /** The parent flow's context, including config, org registry, and logger. */
24
+ flow: FlowContext;
25
+ /** The validated params for this task invocation. */
26
+ params: Params;
27
+ /** Reads and writes named output values for this step. */
28
+ output: TaskOutput;
29
+ };
30
+ /**
31
+ * The shape every task must satisfy — built-in or custom.
32
+ * Custom tasks are duck-typed against this at runtime.
33
+ */
34
+ export declare const TaskSchema: z.ZodObject<{
35
+ description: z.ZodDefault<z.ZodString>;
36
+ params: z.ZodDefault<z.ZodArray<z.ZodObject<{
37
+ name: z.ZodString;
38
+ type: z.ZodDefault<z.ZodEnum<{
39
+ string: "string";
40
+ number: "number";
41
+ boolean: "boolean";
42
+ record: "record";
43
+ }>>;
44
+ required: z.ZodOptional<z.ZodBoolean>;
45
+ default: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
46
+ description: z.ZodOptional<z.ZodString>;
47
+ }, z.core.$strip>>>;
48
+ outputs: z.ZodDefault<z.ZodArray<z.ZodObject<{
49
+ name: z.ZodString;
50
+ type: z.ZodEnum<{
51
+ string: "string";
52
+ number: "number";
53
+ boolean: "boolean";
54
+ object: "object";
55
+ }>;
56
+ description: z.ZodString;
57
+ }, z.core.$strip>>>;
58
+ run: z.ZodFunction<z.core.$ZodFunctionArgs, z.core.$ZodFunctionOut>;
59
+ }, z.core.$strip>;
60
+ /** The input shape a task file must export — fields with defaults are optional. */
61
+ export type TaskDefinition = z.input<typeof TaskSchema>;
62
+ /**
63
+ * A fully loaded task, with all fields normalized and `name` injected from the file path.
64
+ * This is the type the runner works with internally after loading a {@link TaskDefinition}.
65
+ */
66
+ export type Task = Omit<z.infer<typeof TaskSchema>, 'run'> & {
67
+ name: string;
68
+ run: (context: TaskContext) => Promise<void>;
69
+ };
@@ -0,0 +1,33 @@
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 { ParamDefinitionSchema } from './task.param.schema.js';
16
+ /** Zod schema for a value this task writes to the flow outputs. */
17
+ export const TaskOutputDefinitionSchema = z.object({
18
+ name: z.string(),
19
+ type: z.enum(['string', 'number', 'boolean', 'object']),
20
+ description: z.string(),
21
+ });
22
+ /**
23
+ * The shape every task must satisfy — built-in or custom.
24
+ * Custom tasks are duck-typed against this at runtime.
25
+ */
26
+ export const TaskSchema = z.object({
27
+ description: z.string().default(''),
28
+ params: z.array(ParamDefinitionSchema).default([]),
29
+ outputs: z.array(TaskOutputDefinitionSchema).default([]),
30
+ run: z.function(),
31
+ });
32
+ /* c8 ignore stop */
33
+ //# sourceMappingURL=task.definition.schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"task.definition.schema.js","sourceRoot":"","sources":["../../src/core/task.definition.schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,qBAAqB,EAAU,MAAM,wBAAwB,CAAC;AAIvE,mEAAmE;AACnE,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC;IACjD,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;IACvD,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;CACxB,CAAC,CAAC;AAkBH;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC;IACjC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;IACnC,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;IAClD,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,0BAA0B,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;IACxD,GAAG,EAAE,CAAC,CAAC,QAAQ,EAAE;CAClB,CAAC,CAAC;AAaH,oBAAoB"}
@@ -0,0 +1,29 @@
1
+ import type { Store } from './flow.store.js';
2
+ /**
3
+ * Task-facing output API. Passed into `TaskContext` so tasks can read and write
4
+ * step outputs without holding a reference to the full `Store`.
5
+ *
6
+ * - `get(key)` — reads this step's own output.
7
+ * - `get(stepId, key)` — reads another step's output by its ID.
8
+ * - `set(key, value)` — writes a named output value under this step's namespace.
9
+ */
10
+ export declare class TaskOutput {
11
+ private readonly stepId;
12
+ private readonly store;
13
+ constructor(stepId: string, store: Store);
14
+ /**
15
+ * Writes a named output value under this step's namespace,
16
+ * making it available to subsequent steps via `${{ steps.<id>.<key> }}`.
17
+ *
18
+ * @param key - The output key.
19
+ * @param value - The value to store.
20
+ */
21
+ set(key: string, value: unknown): void;
22
+ /**
23
+ * Reads an output value.
24
+ *
25
+ * @param keyOrStepId - The output key (own step) or step ID (other step).
26
+ * @param key - The output key when reading from another step.
27
+ */
28
+ get(keyOrStepId: string, key?: string): unknown;
29
+ }