@jini-ai/devops 0.3.3 → 0.4.0

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.
@@ -1,62 +0,0 @@
1
- import { type DeployPublishInput, type DeployPublishResult, type DeployTarget, type DeploymentUrlCheck } from './types.js';
2
- export declare const GITHUB_PAGES_TARGET_ID = "github-pages";
3
- /** Auth/repo-scoping config a caller supplies when constructing a `GitHubPagesDeployTarget`. */
4
- export interface GitHubPagesDeployConfig {
5
- /** A token with `repo` scope (classic PAT) or equivalent fine-grained "Contents" + "Pages" write permissions. */
6
- token: string;
7
- owner: string;
8
- repo: string;
9
- /** Branch to publish to and to configure as the Pages source. Defaults to `'gh-pages'`. */
10
- branch?: string;
11
- }
12
- /**
13
- * `DeployTarget` adapter for GitHub Pages, built on the Git Data API (create
14
- * blobs → a tree → a commit → create/update a branch ref) rather than the
15
- * newer artifact-based "Pages deployments" API
16
- * (`POST /repos/{owner}/{repo}/pages/deployments`). See
17
- * `packages/devops/source-map.md`'s 2026-07-21 addition for the full
18
- * research trail; in short: that endpoint requires an `oidc_token` "issued
19
- * by GitHub Actions certifying the origin of the deployment" — a token this
20
- * package (running outside an Actions runner, authenticating with a plain
21
- * PAT) has no way to mint. The Git Data API has no such requirement: any
22
- * token with repo write access can push a commit and (once the branch
23
- * exists) enable/observe Pages against it, which is exactly what
24
- * `actions/deploy-pages`'s *predecessor* tooling (and every non-Actions
25
- * GitHub Pages deploy tool in the wild, e.g. `gh-pages`/
26
- * `JamesIves/github-pages-deploy-action` in non-artifact mode) has always
27
- * done.
28
- *
29
- * Unlike `VercelDeployTarget`/`NetlifyDeployTarget`/`CloudflarePagesDeployTarget`,
30
- * this target does not derive a project/site identity from
31
- * `input.projectName` — a GitHub Pages "site" is intrinsically the
32
- * `{owner, repo}` the caller configures, not a freely-named resource this
33
- * package could create on the fly. `input.projectName` is used only as a
34
- * human label in the generated commit message.
35
- */
36
- export declare class GitHubPagesDeployTarget implements DeployTarget {
37
- private readonly config;
38
- readonly id = "github-pages";
39
- constructor(config: GitHubPagesDeployConfig);
40
- /**
41
- * Publishes `input.files` as a new commit on the configured Pages branch
42
- * (creating the branch if it doesn't exist yet), ensures the repository's
43
- * Pages site is enabled against that branch, waits for GitHub's own build
44
- * of that exact commit to finish, then waits for the resulting URL to
45
- * become publicly reachable.
46
- *
47
- * Sequencing note: the branch is pushed to *before* Pages is
48
- * enabled/verified, not after. `POST /repos/{owner}/{repo}/pages` requires
49
- * `source.branch` to already exist in the repository — enabling Pages
50
- * against a branch that doesn't exist yet fails, so the branch must be
51
- * created first via the Git Data API flow below.
52
- *
53
- * @param input - File set plus a caller-chosen label used only for the commit message.
54
- * @throws {DeployError} If `config.token`/`config.owner`/`config.repo` is
55
- * missing, or GitHub's API rejects any step of the blob/tree/commit/ref/
56
- * pages flow, or the resulting Pages build reaches `status: 'errored'`.
57
- */
58
- publish(input: DeployPublishInput): Promise<DeployPublishResult>;
59
- /** Probes `url` with the shared reachability checker — no documented GitHub Pages equivalent to Vercel's Deployment Protection auth wall was found, same reasoning `netlify.ts`/`cloudflare-pages.ts` already applied to their own `checkReachability`. */
60
- checkReachability(url: string): Promise<DeploymentUrlCheck>;
61
- }
62
- //# sourceMappingURL=github-pages.d.ts.map
@@ -1,373 +0,0 @@
1
- import { createHash } from 'node:crypto';
2
- import { FETCH_TIMEOUT_MS, fetchWithTimeout } from '@jini-ai/platform';
3
- import { checkDeploymentUrl, normalizeDeploymentUrl, waitForReachableDeploymentUrl } from './reachability.js';
4
- import { assertNotRedirected, redirectGuardInit } from './redirect-guard.js';
5
- import { DeployError, } from './types.js';
6
- export const GITHUB_PAGES_TARGET_ID = 'github-pages';
7
- const GITHUB_API = 'https://api.github.com';
8
- /** Pinned per GitHub's own recommendation (`X-GitHub-Api-Version` header) so a future server-side default bump can't silently change this file's response shapes underneath it. */
9
- const GITHUB_API_VERSION = '2026-03-10';
10
- /** The long-standing GitHub Pages convention branch name (used by `gh-pages`-the-npm-package, `JamesIves/github-pages-deploy-action`, etc.) — deliberately distinct from a repo's default/production branch so a publish never touches source code. */
11
- const DEFAULT_GITHUB_PAGES_BRANCH = 'gh-pages';
12
- /**
13
- * The only two terminal values this file commits to, independently
14
- * cross-validated against `GET /repos/{owner}/{repo}/pages`'s own confirmed
15
- * clean enum (`built | building | errored | null` — documented as "the
16
- * status of the most recent build", the same underlying concept
17
- * `builds/latest`'s `status` field represents). Any other value —
18
- * `'building'`, `null`, or an unlisted future value — is treated as
19
- * in-progress; see `pollGitHubPagesBuild`'s doc comment for why this file
20
- * does not commit to `builds/latest`'s full enum (GitHub's own docs render
21
- * that field's enum widget client-side and it did not come through cleanly
22
- * via a direct fetch of the docs page during this file's research pass).
23
- */
24
- const GITHUB_PAGES_BUILD_SUCCESS = 'built';
25
- const GITHUB_PAGES_BUILD_FAILURE = 'errored';
26
- /**
27
- * `DeployTarget` adapter for GitHub Pages, built on the Git Data API (create
28
- * blobs → a tree → a commit → create/update a branch ref) rather than the
29
- * newer artifact-based "Pages deployments" API
30
- * (`POST /repos/{owner}/{repo}/pages/deployments`). See
31
- * `packages/devops/source-map.md`'s 2026-07-21 addition for the full
32
- * research trail; in short: that endpoint requires an `oidc_token` "issued
33
- * by GitHub Actions certifying the origin of the deployment" — a token this
34
- * package (running outside an Actions runner, authenticating with a plain
35
- * PAT) has no way to mint. The Git Data API has no such requirement: any
36
- * token with repo write access can push a commit and (once the branch
37
- * exists) enable/observe Pages against it, which is exactly what
38
- * `actions/deploy-pages`'s *predecessor* tooling (and every non-Actions
39
- * GitHub Pages deploy tool in the wild, e.g. `gh-pages`/
40
- * `JamesIves/github-pages-deploy-action` in non-artifact mode) has always
41
- * done.
42
- *
43
- * Unlike `VercelDeployTarget`/`NetlifyDeployTarget`/`CloudflarePagesDeployTarget`,
44
- * this target does not derive a project/site identity from
45
- * `input.projectName` — a GitHub Pages "site" is intrinsically the
46
- * `{owner, repo}` the caller configures, not a freely-named resource this
47
- * package could create on the fly. `input.projectName` is used only as a
48
- * human label in the generated commit message.
49
- */
50
- export class GitHubPagesDeployTarget {
51
- config;
52
- id = GITHUB_PAGES_TARGET_ID;
53
- constructor(config) {
54
- this.config = config;
55
- }
56
- /**
57
- * Publishes `input.files` as a new commit on the configured Pages branch
58
- * (creating the branch if it doesn't exist yet), ensures the repository's
59
- * Pages site is enabled against that branch, waits for GitHub's own build
60
- * of that exact commit to finish, then waits for the resulting URL to
61
- * become publicly reachable.
62
- *
63
- * Sequencing note: the branch is pushed to *before* Pages is
64
- * enabled/verified, not after. `POST /repos/{owner}/{repo}/pages` requires
65
- * `source.branch` to already exist in the repository — enabling Pages
66
- * against a branch that doesn't exist yet fails, so the branch must be
67
- * created first via the Git Data API flow below.
68
- *
69
- * @param input - File set plus a caller-chosen label used only for the commit message.
70
- * @throws {DeployError} If `config.token`/`config.owner`/`config.repo` is
71
- * missing, or GitHub's API rejects any step of the blob/tree/commit/ref/
72
- * pages flow, or the resulting Pages build reaches `status: 'errored'`.
73
- */
74
- async publish(input) {
75
- if (!this.config.token) {
76
- throw new DeployError('GitHub token is required.', 400);
77
- }
78
- const { owner, repo } = this.config;
79
- if (!owner || !repo) {
80
- throw new DeployError('GitHub Pages owner and repo are required.', 400);
81
- }
82
- const branch = this.config.branch || DEFAULT_GITHUB_PAGES_BRANCH;
83
- const parentSha = await getGitHubRefSha(this.config, owner, repo, branch);
84
- const treeSha = await createGitHubTreeFromFiles(this.config, owner, repo, input.files);
85
- const label = typeof input.projectName === 'string' && input.projectName.trim() ? input.projectName.trim() : 'site';
86
- const commitSha = await createGitHubCommit(this.config, owner, repo, `Deploy ${label} via @jini-ai/deploy`, treeSha, parentSha ? [parentSha] : []);
87
- if (parentSha) {
88
- await updateGitHubRef(this.config, owner, repo, branch, commitSha);
89
- }
90
- else {
91
- await createGitHubRef(this.config, owner, repo, branch, commitSha);
92
- }
93
- const site = await ensureGitHubPagesSite(this.config, owner, repo, branch);
94
- const configuredBranch = typeof site.source?.branch === 'string' ? site.source.branch : undefined;
95
- const sourceBranchMismatch = configuredBranch !== undefined && configuredBranch !== branch;
96
- const build = await pollGitHubPagesBuild(this.config, owner, repo, commitSha);
97
- if (build?.status === GITHUB_PAGES_BUILD_FAILURE) {
98
- throw new DeployError(build.errorMessage || 'GitHub Pages build errored.', 502, build.raw);
99
- }
100
- const candidates = githubPagesUrlCandidates(site);
101
- const link = await waitForReachableDeploymentUrl(candidates, { providerLabel: 'GitHub Pages' });
102
- return {
103
- targetId: this.id,
104
- url: link.url || candidates[0] || '',
105
- deploymentId: commitSha,
106
- status: link.status,
107
- statusMessage: link.statusMessage,
108
- ...(link.reachableAt !== undefined ? { reachableAt: link.reachableAt } : {}),
109
- providerMetadata: {
110
- owner,
111
- repo,
112
- branch,
113
- branchCreated: !parentSha,
114
- ...(sourceBranchMismatch ? { sourceBranchMismatch: true } : {}),
115
- },
116
- };
117
- }
118
- /** Probes `url` with the shared reachability checker — no documented GitHub Pages equivalent to Vercel's Deployment Protection auth wall was found, same reasoning `netlify.ts`/`cloudflare-pages.ts` already applied to their own `checkReachability`. */
119
- async checkReachability(url) {
120
- return checkDeploymentUrl(url);
121
- }
122
- }
123
- function enc(value) {
124
- return encodeURIComponent(value);
125
- }
126
- function githubHeaders(token, extra = {}) {
127
- return {
128
- Authorization: `Bearer ${token}`,
129
- Accept: 'application/vnd.github+json',
130
- 'X-GitHub-Api-Version': GITHUB_API_VERSION,
131
- ...extra,
132
- };
133
- }
134
- async function readGitHubJson(resp) {
135
- try {
136
- return (await resp.json());
137
- }
138
- catch {
139
- throw new DeployError('GitHub returned a non-JSON response.', resp.status || 502);
140
- }
141
- }
142
- /**
143
- * `fallback` (the second operand of the `||`) is unreachable today: every
144
- * one of this file's 8 call sites passes a non-empty string literal — same
145
- * situation `netlify.ts`'s `netlifyError` documents for its own callers.
146
- * Kept as the sane default a future caller forgetting to pass `fallback`
147
- * would fall through to, not deleted for coverage's sake.
148
- */
149
- function githubError(json, status, fallback) {
150
- const message = typeof json?.message === 'string' && json.message ? json.message : fallback || `GitHub request failed (${status}).`;
151
- return new DeployError(message, status, json);
152
- }
153
- function sha256Hex(data) {
154
- return createHash('sha256').update(Buffer.from(data)).digest('hex');
155
- }
156
- /** Looks up the tip commit sha of `heads/{branch}`, or `undefined` if the branch does not exist yet (a brand-new Pages publish). */
157
- async function getGitHubRefSha(config, owner, repo, branch) {
158
- const resp = await fetchWithTimeout(`${GITHUB_API}/repos/${enc(owner)}/${enc(repo)}/git/ref/heads/${enc(branch)}`, redirectGuardInit({ headers: githubHeaders(config.token) }), { timeoutMs: FETCH_TIMEOUT_MS.QUICK });
159
- assertNotRedirected(resp, 'GitHub Pages branch lookup');
160
- if (resp.status === 404)
161
- return undefined;
162
- const json = await readGitHubJson(resp);
163
- if (!resp.ok)
164
- throw githubError(json, resp.status, 'GitHub Pages branch lookup failed.');
165
- const object = json.object;
166
- return typeof object?.sha === 'string' ? object.sha : undefined;
167
- }
168
- async function createGitHubBlob(config, owner, repo, data) {
169
- const resp = await fetchWithTimeout(`${GITHUB_API}/repos/${enc(owner)}/${enc(repo)}/git/blobs`, redirectGuardInit({
170
- method: 'POST',
171
- headers: githubHeaders(config.token, { 'Content-Type': 'application/json' }),
172
- body: JSON.stringify({ content: Buffer.from(data).toString('base64'), encoding: 'base64' }),
173
- }), { timeoutMs: FETCH_TIMEOUT_MS.QUICK });
174
- assertNotRedirected(resp, 'GitHub blob creation');
175
- const json = await readGitHubJson(resp);
176
- if (!resp.ok)
177
- throw githubError(json, resp.status, 'GitHub blob creation failed.');
178
- const sha = typeof json.sha === 'string' ? json.sha : '';
179
- if (!sha)
180
- throw new DeployError('GitHub blob response did not include a sha.', 502, json);
181
- return sha;
182
- }
183
- /**
184
- * Creates one blob per distinct file content (deduped by a local sha256 key
185
- * — a plain dedup key, not a wire-protocol requirement the way Netlify's
186
- * SHA1 manifest is, so any stable collision-resistant digest works; sha256
187
- * via `node:crypto` matches `cloudflare-pages.ts`'s own no-new-dependency
188
- * choice for the same class of problem) and assembles the resulting tree in
189
- * one call. Deliberately always creates real blobs rather than using the
190
- * tree endpoint's inline `content` shortcut — that shortcut only accepts
191
- * text content, and a static site's asset set (images, fonts, ...) is not
192
- * reliably valid UTF-8.
193
- */
194
- async function createGitHubTreeFromFiles(config, owner, repo, files) {
195
- const blobShaByHash = new Map();
196
- const tree = [];
197
- for (const file of files) {
198
- const hash = sha256Hex(file.data);
199
- let blobSha = blobShaByHash.get(hash);
200
- if (!blobSha) {
201
- blobSha = await createGitHubBlob(config, owner, repo, file.data);
202
- blobShaByHash.set(hash, blobSha);
203
- }
204
- tree.push({ path: file.file, mode: '100644', type: 'blob', sha: blobSha });
205
- }
206
- const resp = await fetchWithTimeout(`${GITHUB_API}/repos/${enc(owner)}/${enc(repo)}/git/trees`, redirectGuardInit({
207
- method: 'POST',
208
- headers: githubHeaders(config.token, { 'Content-Type': 'application/json' }),
209
- body: JSON.stringify({ tree }),
210
- }), { timeoutMs: FETCH_TIMEOUT_MS.QUICK });
211
- assertNotRedirected(resp, 'GitHub tree creation');
212
- const json = await readGitHubJson(resp);
213
- if (!resp.ok)
214
- throw githubError(json, resp.status, 'GitHub tree creation failed.');
215
- const sha = typeof json.sha === 'string' ? json.sha : '';
216
- if (!sha)
217
- throw new DeployError('GitHub tree response did not include a sha.', 502, json);
218
- return sha;
219
- }
220
- async function createGitHubCommit(config, owner, repo, message, treeSha, parents) {
221
- const resp = await fetchWithTimeout(`${GITHUB_API}/repos/${enc(owner)}/${enc(repo)}/git/commits`, redirectGuardInit({
222
- method: 'POST',
223
- headers: githubHeaders(config.token, { 'Content-Type': 'application/json' }),
224
- body: JSON.stringify({ message, tree: treeSha, parents }),
225
- }), { timeoutMs: FETCH_TIMEOUT_MS.QUICK });
226
- assertNotRedirected(resp, 'GitHub commit creation');
227
- const json = await readGitHubJson(resp);
228
- if (!resp.ok)
229
- throw githubError(json, resp.status, 'GitHub commit creation failed.');
230
- const sha = typeof json.sha === 'string' ? json.sha : '';
231
- if (!sha)
232
- throw new DeployError('GitHub commit response did not include a sha.', 502, json);
233
- return sha;
234
- }
235
- async function createGitHubRef(config, owner, repo, branch, sha) {
236
- const resp = await fetchWithTimeout(`${GITHUB_API}/repos/${enc(owner)}/${enc(repo)}/git/refs`, redirectGuardInit({
237
- method: 'POST',
238
- headers: githubHeaders(config.token, { 'Content-Type': 'application/json' }),
239
- body: JSON.stringify({ ref: `refs/heads/${branch}`, sha }),
240
- }), { timeoutMs: FETCH_TIMEOUT_MS.QUICK });
241
- assertNotRedirected(resp, 'GitHub Pages branch creation');
242
- const json = await readGitHubJson(resp);
243
- if (!resp.ok)
244
- throw githubError(json, resp.status, 'GitHub Pages branch creation failed.');
245
- }
246
- /**
247
- * `force: true` even though `sha` is always a direct child of the branch's
248
- * current tip (`createGitHubCommit`'s `parents` was seeded from this exact
249
- * ref lookup, so this update is a genuine fast-forward): a concurrent
250
- * publish racing between this file's own ref-lookup and this update could
251
- * otherwise turn a legitimate fast-forward into a rejected non-fast-forward
252
- * update (422). `force: true` trades that narrow race for the same
253
- * "last publish wins" semantics every other target in this package already
254
- * has (a second concurrent `publish()` call also just overwrites whatever
255
- * the first one produced).
256
- */
257
- async function updateGitHubRef(config, owner, repo, branch, sha) {
258
- const resp = await fetchWithTimeout(`${GITHUB_API}/repos/${enc(owner)}/${enc(repo)}/git/refs/heads/${enc(branch)}`, redirectGuardInit({
259
- method: 'PATCH',
260
- headers: githubHeaders(config.token, { 'Content-Type': 'application/json' }),
261
- body: JSON.stringify({ sha, force: true }),
262
- }), { timeoutMs: FETCH_TIMEOUT_MS.QUICK });
263
- assertNotRedirected(resp, 'GitHub Pages branch update');
264
- const json = await readGitHubJson(resp);
265
- if (!resp.ok)
266
- throw githubError(json, resp.status, 'GitHub Pages branch update failed.');
267
- }
268
- /**
269
- * Finds the repository's Pages site config, creating it (pointed at
270
- * `branch`, `build_type: 'legacy'` — the branch-based build model, matching
271
- * this file's Git Data API publish mechanism rather than the Actions
272
- * `'workflow'` build type) if none exists yet. Never mutates an
273
- * already-enabled site's configuration — see `publish()`'s
274
- * `sourceBranchMismatch` handling for what happens when the existing site
275
- * is configured against a different branch than this call targets.
276
- */
277
- async function ensureGitHubPagesSite(config, owner, repo, branch) {
278
- const getResp = await fetchWithTimeout(`${GITHUB_API}/repos/${enc(owner)}/${enc(repo)}/pages`, redirectGuardInit({ headers: githubHeaders(config.token) }), { timeoutMs: FETCH_TIMEOUT_MS.QUICK });
279
- assertNotRedirected(getResp, 'GitHub Pages site lookup');
280
- if (getResp.status === 404) {
281
- const createResp = await fetchWithTimeout(`${GITHUB_API}/repos/${enc(owner)}/${enc(repo)}/pages`, redirectGuardInit({
282
- method: 'POST',
283
- headers: githubHeaders(config.token, { 'Content-Type': 'application/json' }),
284
- body: JSON.stringify({ source: { branch, path: '/' }, build_type: 'legacy' }),
285
- }), { timeoutMs: FETCH_TIMEOUT_MS.DEPLOY });
286
- assertNotRedirected(createResp, 'GitHub Pages site creation');
287
- const created = await readGitHubJson(createResp);
288
- if (!createResp.ok)
289
- throw githubError(created, createResp.status, 'GitHub Pages site creation failed.');
290
- return created;
291
- }
292
- const json = await readGitHubJson(getResp);
293
- if (!getResp.ok)
294
- throw githubError(json, getResp.status, 'GitHub Pages site lookup failed.');
295
- return json;
296
- }
297
- /**
298
- * Polls `GET /repos/{owner}/{repo}/pages/builds/latest` — deliberately not
299
- * the Pages site resource's own `status` field (`GET
300
- * /repos/{owner}/{repo}/pages`), even though that field is documented with
301
- * a cleaner confirmed enum. Reason: the site-level `status` is shared
302
- * across every publish to the same site, so immediately after pushing a new
303
- * commit it can still reflect the *previous* build's terminal state for a
304
- * moment — a false-positive "already built" race with no way to tell it
305
- * apart from a genuinely finished new build. `builds/latest`'s `commit`
306
- * field lets this function confirm it is actually looking at *this*
307
- * publish's build (`commit === commitSha`) before trusting its `status` at
308
- * all, closing that race at the cost of committing to a smaller slice of
309
- * that field's enum (see `GITHUB_PAGES_BUILD_SUCCESS`/`_FAILURE`'s doc
310
- * comment for why only two values are treated as terminal).
311
- *
312
- * A 404 (no build has run yet — expected immediately after a brand-new
313
- * site's first-ever push/enable, undocumented but consistent with GitHub
314
- * REST's general "resource doesn't exist yet" convention), a stale,
315
- * non-matching `commit`, and a response this file cannot parse as JSON are
316
- * ALL treated as "keep polling," not an error — see the `catch` below for
317
- * why the non-JSON case joins that list. Any other non-2xx response whose
318
- * body DID parse still fails fast, matching
319
- * `pollVercelDeployment`/`pollNetlifyDeploy`'s existing convention. Same
320
- * fixed 30-attempt/1s-then-2s budget as this package's other targets.
321
- */
322
- async function pollGitHubPagesBuild(config, owner, repo, commitSha) {
323
- let last = null;
324
- for (let i = 0; i < 30; i += 1) {
325
- await new Promise((resolve) => setTimeout(resolve, i < 5 ? 1000 : 2000));
326
- const resp = await fetchWithTimeout(`${GITHUB_API}/repos/${enc(owner)}/${enc(repo)}/pages/builds/latest`, redirectGuardInit({ headers: githubHeaders(config.token) }), { timeoutMs: FETCH_TIMEOUT_MS.DEPLOY });
327
- assertNotRedirected(resp, 'GitHub Pages build status check');
328
- if (resp.status === 404)
329
- continue;
330
- let json;
331
- try {
332
- json = await readGitHubJson(resp);
333
- }
334
- catch {
335
- // Same "nothing usable to report yet" bucket as the 404 branch above, not a
336
- // publish failure: every step up to and including enabling the Pages site has
337
- // already irreversibly succeeded by the time this loop runs (see `publish()`'s
338
- // call order), so a response this file cannot parse as JSON — an empty/no-content
339
- // body while GitHub's build-tracking record has not been written yet, or a
340
- // transient gateway/edge response — is exactly as uninformative as a 404, never a
341
- // reason to report the whole publish as failed. A genuinely persistent problem
342
- // still surfaces: this loop is bounded by the same fixed 30-attempt budget as every
343
- // other outcome (see `proceeds to the reachability wait ... exhausts its 30-attempt
344
- // budget`), after which `publish()` falls through to the reachability probe with
345
- // whatever URL it already has — never a false "published: false" for a site that is
346
- // actually live (`github-pages.test.ts`'s `keeps polling past a builds/latest
347
- // response that fails to parse as JSON` regression test).
348
- continue;
349
- }
350
- if (!resp.ok)
351
- throw githubError(json, resp.status, 'GitHub Pages build status check failed.');
352
- const commit = typeof json.commit === 'string' ? json.commit : '';
353
- if (commit !== commitSha)
354
- continue;
355
- const status = typeof json.status === 'string' ? json.status : '';
356
- const errorObj = json.error;
357
- const errorMessage = typeof errorObj?.message === 'string' ? errorObj.message : undefined;
358
- last = { status, ...(errorMessage ? { errorMessage } : {}), raw: json };
359
- if (status === GITHUB_PAGES_BUILD_SUCCESS || status === GITHUB_PAGES_BUILD_FAILURE)
360
- return last;
361
- }
362
- return last;
363
- }
364
- /** Collects candidate public URLs from a Pages site response, preferring `html_url` (the browser-facing field, standard GitHub REST convention) over the bare `url` field (the API resource URL, which happens to also be public-reachable for Pages but is documented separately). */
365
- function githubPagesUrlCandidates(site) {
366
- const urls = [];
367
- if (site && typeof site.html_url === 'string')
368
- urls.push(site.html_url);
369
- if (site && typeof site.url === 'string')
370
- urls.push(site.url);
371
- return [...new Set(urls.map(normalizeDeploymentUrl).filter(Boolean))];
372
- }
373
- //# sourceMappingURL=github-pages.js.map
@@ -1,40 +0,0 @@
1
- import { type DeployPublishInput, type DeployPublishResult, type DeployTarget, type DeploymentUrlCheck } from './types.js';
2
- export declare const NETLIFY_TARGET_ID = "netlify";
3
- /** Auth config a caller supplies when constructing a `NetlifyDeployTarget`. */
4
- export interface NetlifyDeployConfig {
5
- token: string;
6
- }
7
- /**
8
- * `DeployTarget` adapter for Netlify's digest-based deploy API: find-or-create
9
- * a site for the caller's `projectName`, create a deploy from a SHA1 file
10
- * manifest, upload whichever files Netlify reports as `required`, poll until
11
- * the deploy reaches a terminal `state`, then wait for the resulting URL to
12
- * become publicly reachable.
13
- *
14
- * No OD origin — `apps/daemon/src/deploy.ts` never implemented a Netlify
15
- * target (only `vercel-self` and `cloudflare-pages` exist there); this is new
16
- * work built directly against Netlify's own published OpenAPI contract
17
- * (`https://open-api.netlify.com`), following the same `DeployTarget` shape
18
- * `vercel.ts`/`cloudflare-pages.ts` already establish. See `source-map.md`'s
19
- * 2026-07-21 addition for the exact endpoints/fields this was built from.
20
- */
21
- export declare class NetlifyDeployTarget implements DeployTarget {
22
- private readonly config;
23
- readonly id = "netlify";
24
- constructor(config: NetlifyDeployConfig);
25
- /**
26
- * Publishes `input.files` as a new Netlify deploy (creating the target site
27
- * on first use) and waits for the resulting URL to be reachable.
28
- *
29
- * @param input - File set plus a caller-chosen project name label.
30
- * @returns The published deploy's URL/status once Netlify has a terminal
31
- * `state` (or the poll budget is exhausted).
32
- * @throws {DeployError} If `config.token` is missing, the site cannot be
33
- * found/created, or Netlify reports a terminal failure state
34
- * (`'error'`/`'rejected'`).
35
- */
36
- publish(input: DeployPublishInput): Promise<DeployPublishResult>;
37
- /** Probes `url` with the shared reachability checker (no Netlify-specific auth-wall detection is needed/documented). */
38
- checkReachability(url: string): Promise<DeploymentUrlCheck>;
39
- }
40
- //# sourceMappingURL=netlify.d.ts.map