@jini-ai/agent-plugins 0.7.3-next.1 → 0.7.3-next.3
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.
- package/CHANGELOG.md +2 -0
- package/README.md +22 -4
- package/calendly/README.md +29 -0
- package/calendly/mcp.json +1 -1
- package/cloudflare/lib/assets.mjs +1 -1
- package/cloudflare/lib/cms-forms.mjs +1 -1
- package/core/persistent-state.d.ts +4 -1
- package/core/persistent-state.js +55 -21
- package/dist/admin-surfaces/callback-field-inbox.d.ts +1 -6
- package/dist/admin-surfaces/connections/connections.d.ts +2 -6
- package/dist/admin-surfaces/connections/index.d.ts +3 -2
- package/dist/admin-surfaces/index.d.ts +3 -1
- package/dist/connect/access-token-tool.d.ts +1 -1
- package/dist/connect/access-token-tool.js +1 -1
- package/dist/connect/catalog.d.ts +26 -0
- package/dist/connect/catalog.js +42 -0
- package/dist/connect/connect-tool.d.ts +2 -294
- package/dist/connect/connect-tool.js +2 -53
- package/dist/connect/contracts.d.ts +257 -0
- package/dist/connect/contracts.js +2 -0
- package/dist/connect/credential-cards.d.ts +2 -0
- package/dist/connect/credential-cards.js +7 -4
- package/dist/connect/grant-signed-in-defaults.js +1 -1
- package/dist/connect/host-deps.d.ts +32 -0
- package/dist/connect/host-deps.js +35 -0
- package/dist/connect/import-access-token.js +1 -1
- package/dist/connect/index.d.ts +7 -2
- package/dist/connect/index.js +5 -2
- package/dist/connect/installed-plugin.d.ts +28 -0
- package/dist/connect/installed-plugin.js +19 -0
- package/dist/connect/new-site-agent-plugin-tokens.d.ts +88 -0
- package/dist/connect/new-site-agent-plugin-tokens.js +107 -0
- package/dist/connect/plugin-host/index.d.ts +2 -2
- package/dist/connect/plugin-host/index.js +19 -10
- package/dist/connect/token-sign-in.d.ts +1 -14
- package/dist/connect/token-sign-in.js +4 -23
- package/dist/core/export-props.d.ts +10 -0
- package/dist/core/export-props.js +31 -0
- package/dist/core/folder-zip-error.d.ts +5 -0
- package/dist/core/folder-zip-error.js +8 -0
- package/dist/core/host-incompatible-error.d.ts +8 -0
- package/dist/core/host-incompatible-error.js +9 -0
- package/dist/core/identity-namespace.d.ts +27 -16
- package/dist/core/identity-namespace.js +25 -22
- package/dist/core/plugin-display-name.d.ts +7 -0
- package/dist/core/plugin-display-name.js +11 -0
- package/dist/core/provider-plugin-link.d.ts +7 -0
- package/dist/core/provider-plugin-link.js +5 -0
- package/dist/{connect → core}/token-map.d.ts +11 -1
- package/dist/{connect → core}/token-map.js +15 -0
- package/dist/core/token-sign-in-list.d.ts +18 -0
- package/dist/core/token-sign-in-list.js +23 -0
- package/dist/core/update-error.d.ts +8 -0
- package/dist/core/update-error.js +9 -0
- package/dist/{lifecycle → core}/update-plan.d.ts +1 -1
- package/dist/ffmpeg-transcode/adapter.d.ts +74 -0
- package/dist/ffmpeg-transcode/adapter.js +155 -0
- package/dist/folder-zip-node.d.ts +2 -1
- package/dist/folder-zip-node.js +6 -5
- package/dist/folder-zip.d.ts +0 -4
- package/dist/folder-zip.js +1 -7
- package/dist/index.d.ts +3 -1
- package/dist/lifecycle/activation.d.ts +39 -3
- package/dist/lifecycle/activation.js +467 -418
- package/dist/lifecycle/automatic-use-offer.d.ts +62 -0
- package/dist/lifecycle/automatic-use-offer.js +52 -0
- package/dist/lifecycle/automatic-use.d.ts +33 -1
- package/dist/lifecycle/automatic-use.js +157 -38
- package/dist/lifecycle/bundled-source-archive.d.ts +1 -1
- package/dist/lifecycle/capability-projection.d.ts +0 -1
- package/dist/lifecycle/capability-projection.js +92 -23
- package/dist/lifecycle/compatibility-metadata.d.ts +1 -0
- package/dist/lifecycle/compatibility-metadata.js +6 -1
- package/dist/lifecycle/compatibility.d.ts +1 -8
- package/dist/lifecycle/compatibility.js +1 -8
- package/dist/lifecycle/credential-card-metadata.d.ts +2 -2
- package/dist/lifecycle/exports.d.ts +2 -45
- package/dist/lifecycle/exports.js +1 -30
- package/dist/lifecycle/host-tools/identity.d.ts +5 -4
- package/dist/lifecycle/host-tools/identity.js +5 -5
- package/dist/lifecycle/host-tools/ports.d.ts +10 -1
- package/dist/lifecycle/host-tools/search-tool.d.ts +4 -2
- package/dist/lifecycle/host-tools/search-tool.js +19 -8
- package/dist/lifecycle/host-tools/skill-tool.js +1 -1
- package/dist/lifecycle/index.d.ts +20 -17
- package/dist/lifecycle/index.js +5 -4
- package/dist/lifecycle/install-from-url.d.ts +1 -2
- package/dist/lifecycle/install.d.ts +4 -34
- package/dist/lifecycle/install.js +3 -3
- package/dist/lifecycle/installed-package-index.d.ts +1 -1
- package/dist/lifecycle/installed-package-index.js +4 -4
- package/dist/lifecycle/layout.d.ts +21 -25
- package/dist/lifecycle/layout.js +79 -0
- package/dist/lifecycle/manifest.d.ts +10 -7
- package/dist/lifecycle/manifest.js +20 -15
- package/dist/lifecycle/mcp-provisioning.d.ts +1 -1
- package/dist/lifecycle/metadata.d.ts +6 -3
- package/dist/lifecycle/metadata.js +2 -1
- package/dist/lifecycle/package-paths.js +59 -56
- package/dist/lifecycle/persistent-state.d.ts +10 -1
- package/dist/lifecycle/persistent-state.js +4 -2
- package/dist/lifecycle/ports.d.ts +18 -6
- package/dist/lifecycle/resolve-agent-plugin-refs.d.ts +2 -14
- package/dist/lifecycle/retire-bundled.d.ts +1 -1
- package/dist/lifecycle/search-projection.d.ts +3 -1
- package/dist/lifecycle/search-projection.js +7 -3
- package/dist/lifecycle/search.d.ts +1 -0
- package/dist/lifecycle/seed-bundled.d.ts +86 -1
- package/dist/lifecycle/seed-bundled.js +48 -84
- package/dist/lifecycle/set-enabled.d.ts +1 -13
- package/dist/lifecycle/set-enabled.js +11 -7
- package/dist/lifecycle/trusted-plugin-files.d.ts +1 -1
- package/dist/lifecycle/trusted-plugin-files.js +33 -30
- package/dist/lifecycle/types.d.ts +13 -34
- package/dist/lifecycle/uninstall.d.ts +1 -33
- package/dist/lifecycle/update-store.d.ts +0 -7
- package/dist/lifecycle/update-store.js +1 -8
- package/dist/lifecycle/update.d.ts +1 -1
- package/dist/lifecycle/update.js +60 -10
- package/dist/lifecycle/yauzl-archive-reader.d.ts +7 -2
- package/dist/lifecycle/yauzl-archive-reader.js +11 -6
- package/dist/manifest.d.ts +4 -8
- package/dist/react/AgentPluginDetailsModal.d.ts +187 -0
- package/dist/react/AgentPluginDetailsModal.js +29 -0
- package/dist/react/agent-plugin-install-port.d.ts +24 -0
- package/dist/react/agent-plugin-install-port.js +15 -0
- package/dist/react/installed-skills-composer-source.d.ts +60 -0
- package/dist/react/installed-skills-composer-source.js +111 -0
- package/dist/react/use-agent-plugins.hooks.d.ts +211 -0
- package/dist/react/use-agent-plugins.hooks.js +128 -0
- package/dist/site/activation-effects.d.ts +17 -0
- package/dist/site/activation-effects.js +31 -0
- package/dist/site/admin-surfaces/capabilities.d.ts +29 -0
- package/dist/site/admin-surfaces/capabilities.js +30 -0
- package/dist/site/admin-surfaces/delivery-bindings.d.ts +81 -0
- package/dist/site/admin-surfaces/delivery-bindings.js +161 -0
- package/dist/site/admin-surfaces/forms.d.ts +28 -0
- package/dist/site/admin-surfaces/forms.js +29 -0
- package/dist/site/admin-surfaces/handlers.d.ts +61 -0
- package/dist/site/admin-surfaces/handlers.js +35 -0
- package/dist/site/admin-surfaces/public-config.d.ts +12 -0
- package/dist/site/admin-surfaces/public-config.js +28 -0
- package/dist/site/analytics-provider-registry.d.ts +87 -0
- package/dist/site/analytics-provider-registry.js +87 -0
- package/dist/site/archive-reader-abi.d.ts +35 -0
- package/dist/site/archive-reader-abi.js +25 -0
- package/dist/site/auth-schemes.d.ts +110 -0
- package/dist/site/auth-schemes.js +119 -0
- package/dist/site/automatic-agent-plugins.d.ts +200 -0
- package/dist/site/automatic-agent-plugins.js +277 -0
- package/dist/site/bundled-contribution-sources.d.ts +24 -0
- package/dist/site/bundled-contribution-sources.js +17 -0
- package/dist/site/bundled-id-upgrade.d.ts +115 -0
- package/dist/site/bundled-id-upgrade.js +169 -0
- package/dist/site/customize-tool.d.ts +39 -0
- package/dist/site/customize-tool.js +31 -0
- package/dist/site/deploy-split-activation.d.ts +28 -0
- package/dist/site/deploy-split-activation.js +21 -0
- package/dist/site/exports/diagnostics.d.ts +37 -0
- package/dist/site/exports/diagnostics.js +55 -0
- package/dist/site/exports/runtime.d.ts +54 -0
- package/dist/site/exports/runtime.js +196 -0
- package/dist/site/exports/source.d.ts +42 -0
- package/dist/site/exports/source.js +58 -0
- package/dist/site/host-plugin-guidance.d.ts +137 -0
- package/dist/site/host-plugin-guidance.js +223 -0
- package/dist/site/host-signals.d.ts +78 -0
- package/dist/site/host-signals.js +83 -0
- package/dist/site/install-tool.d.ts +69 -0
- package/dist/site/install-tool.js +192 -0
- package/dist/site/install-upload.d.ts +175 -0
- package/dist/site/install-upload.js +324 -0
- package/dist/site/memory-i18n.d.ts +5 -0
- package/dist/site/memory-i18n.js +176 -0
- package/dist/site/memory.d.ts +80 -0
- package/dist/site/memory.js +83 -0
- package/dist/site/plugin-memory.d.ts +80 -0
- package/dist/site/plugin-memory.js +86 -0
- package/dist/site/provider-plugin-link.d.ts +112 -0
- package/dist/site/provider-plugin-link.js +100 -0
- package/dist/site/retired-plugin-tool-aliases.d.ts +40 -0
- package/dist/site/retired-plugin-tool-aliases.js +41 -0
- package/dist/site/service-ports.d.ts +108 -0
- package/dist/site/service-ports.js +2 -0
- package/dist/site/set-enabled.d.ts +80 -0
- package/dist/site/set-enabled.js +42 -0
- package/dist/site/soon-lock.d.ts +83 -0
- package/dist/site/soon-lock.js +78 -0
- package/dist/site/supersession.d.ts +61 -0
- package/dist/site/supersession.js +122 -0
- package/dist/site/uninstall-tool.d.ts +136 -0
- package/dist/site/uninstall-tool.js +203 -0
- package/dist/site/update-effects.d.ts +47 -0
- package/dist/site/update-effects.js +49 -0
- package/ffmpeg-transcode/plugin.json +16 -0
- package/github/source-control/backup-push.mjs +66 -46
- package/github/source-control/commit-site.mjs +124 -67
- package/github/source-control/write-files.mjs +86 -53
- package/github-pages/targets/github-pages.mjs +294 -233
- package/google-workspace/form-destinations/mapping.mjs +15 -7
- package/google-workspace/form-destinations/sheets.mjs +4 -2
- package/google-workspace/plugin.json +1 -0
- package/kuinetic/CHANGELOG.md +4 -0
- package/kuinetic/plugin.json +4 -1
- package/kuinetic/skills/kuinetic/SKILL.md +1 -2
- package/package.json +297 -20
- package/persistent-state.d.ts +4 -1
- package/resend/adapters/resend.mjs +5 -2
- package/resend/plugin.json +1 -1
- package/s3-compatible/jini-deploy-targets.json +1 -1
- package/s3-compatible/object-stores/s3-compatible.mjs +27 -4
- package/s3-compatible/targets/s3-compatible.mjs +3 -3
- package/site-import/plugin.json +3 -3
- package/site-import/skills/site-import/SKILL.md +62 -54
- package/site-import/skills/site-import/references/content-mapping.md +26 -20
- package/slide-design/plugin.json +1 -1
- package/slide-design/skills/slide-design/SKILL.md +8 -2
- package/ui-ux-design/CHANGELOG.md +6 -0
- package/ui-ux-design/plugin.json +1 -1
- package/ui-ux-design/skills/gstack-design/SKILL.md +6 -6
- package/ui-ux-design/skills/ui-ux-design/SKILL.md +3 -2
- package/ui-ux-design/skills/ui-ux-design/references/chrome-mobile-test-matrix.md +14 -12
- package/ui-ux-design/skills/ui-ux-design/references/ui-loop.md +16 -17
- package/vercel/NOTES.md +2 -1
- package/vercel/object-stores/vercel-blob.mjs +3 -4
- package/vercel/targets/vercel.mjs +425 -351
- package/core/commerce-server.d.ts +0 -2
- package/core/commerce-server.mjs +0 -2
- package/dist/admin-surfaces/connections/ports.d.ts +0 -110
- package/dist/admin-surfaces/connections/ports.js +0 -2
- /package/dist/{lifecycle → core}/install-errors.d.ts +0 -0
- /package/dist/{lifecycle → core}/install-errors.js +0 -0
- /package/dist/{lifecycle → core}/update-plan.js +0 -0
|
@@ -38,169 +38,85 @@ function withNoJekyll(files) {
|
|
|
38
38
|
return files.some((file) => file.file === NOJEKYLL_FILE) ? files : [...files, { file: NOJEKYLL_FILE, data: "" }];
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
const GITHUB_API = 'https://api.github.com';
|
|
42
|
+
/** 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. */
|
|
43
|
+
const GITHUB_API_VERSION = '2026-03-10';
|
|
44
|
+
/** 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. */
|
|
45
|
+
const DEFAULT_GITHUB_PAGES_BRANCH = 'gh-pages';
|
|
41
46
|
/**
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
47
|
+
* The only two terminal values this file commits to, independently
|
|
48
|
+
* cross-validated against `GET /repos/{owner}/{repo}/pages`'s own confirmed
|
|
49
|
+
* clean enum (`built | building | errored | null` — documented as "the
|
|
50
|
+
* status of the most recent build", the same underlying concept
|
|
51
|
+
* `builds/latest`'s `status` field represents). Any other value —
|
|
52
|
+
* `'building'`, `null`, or an unlisted future value — is treated as
|
|
53
|
+
* in-progress; see `pollGitHubPagesBuild`'s doc comment for why this file
|
|
54
|
+
* does not commit to `builds/latest`'s full enum (GitHub's own docs render
|
|
55
|
+
* that field's enum widget client-side and it did not come through cleanly
|
|
56
|
+
* via a direct fetch of the docs page during this file's research pass).
|
|
49
57
|
*/
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
if (!response.ok) throw githubError(body, response.status, 'GitHub Pages site lookup failed.');
|
|
113
|
-
const url = githubPagesUrlCandidates(body)[0];
|
|
114
|
-
if (!url) throw new DeployError('GitHub Pages did not report a public URL.', 502);
|
|
115
|
-
return url;
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* Publishes `input.files` as a new commit on the configured Pages branch
|
|
119
|
-
* (creating the branch if it doesn't exist yet), ensures the repository's
|
|
120
|
-
* Pages site is enabled against that branch, waits for GitHub's own build
|
|
121
|
-
* of that exact commit to finish, then waits for the resulting URL to
|
|
122
|
-
* become publicly reachable.
|
|
123
|
-
*
|
|
124
|
-
* Sequencing note: the branch is pushed to *before* Pages is
|
|
125
|
-
* enabled/verified, not after. `POST /repos/{owner}/{repo}/pages` requires
|
|
126
|
-
* `source.branch` to already exist in the repository — enabling Pages
|
|
127
|
-
* against a branch that doesn't exist yet fails, so the branch must be
|
|
128
|
-
* created first via the Git Data API flow below.
|
|
129
|
-
*
|
|
130
|
-
* @param input - File set plus a caller-chosen label used only for the commit message.
|
|
131
|
-
* @throws {DeployError} If `config.token`/`config.owner`/`config.repo` is
|
|
132
|
-
* missing, or GitHub's API rejects any step of the blob/tree/commit/ref/
|
|
133
|
-
* pages flow, or the resulting Pages build reaches `status: 'errored'`.
|
|
134
|
-
*/
|
|
135
|
-
async publish(input) {
|
|
136
|
-
if (!this.config.token) {
|
|
137
|
-
throw new DeployError('GitHub token is required.', 400);
|
|
138
|
-
}
|
|
139
|
-
const { owner, repo } = this.config;
|
|
140
|
-
if (!owner || !repo) {
|
|
141
|
-
throw new DeployError('GitHub Pages owner and repo are required.', 400);
|
|
142
|
-
}
|
|
143
|
-
const branch = this.config.branch || DEFAULT_GITHUB_PAGES_BRANCH;
|
|
144
|
-
const { parentSha, commitSha } = await pushGitHubPagesFiles({ config: this.config, owner, repo, branch, input });
|
|
145
|
-
const { site, sourceBranchMismatch } = await prepareGitHubPagesSite({ config: this.config, owner, repo, branch, commitSha });
|
|
146
|
-
const candidates = githubPagesUrlCandidates(site);
|
|
147
|
-
const link = await waitForReachableDeploymentUrl(candidates, { providerLabel: 'GitHub Pages' });
|
|
148
|
-
return {
|
|
149
|
-
targetId: this.id,
|
|
150
|
-
url: link.url || candidates[0] || '',
|
|
151
|
-
deploymentId: commitSha,
|
|
152
|
-
status: link.status,
|
|
153
|
-
statusMessage: link.statusMessage,
|
|
154
|
-
...(link.reachableAt !== undefined ? { reachableAt: link.reachableAt } : {}),
|
|
155
|
-
providerMetadata: {
|
|
156
|
-
owner,
|
|
157
|
-
repo,
|
|
158
|
-
branch,
|
|
159
|
-
commitSha,
|
|
160
|
-
branchCreated: !parentSha,
|
|
161
|
-
...(sourceBranchMismatch ? { sourceBranchMismatch: true } : {}),
|
|
162
|
-
},
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
/** 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`. */
|
|
166
|
-
async checkReachability(url) {
|
|
167
|
-
return checkDeploymentUrl(url);
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
async function pushGitHubPagesFiles({ config, owner, repo, branch, input }, _options = {}) {
|
|
171
|
-
const parentSha = await getGitHubRefSha(config, owner, repo, branch);
|
|
172
|
-
const treeSha = await createGitHubTreeFromFiles(config, owner, repo, input.files);
|
|
173
|
-
const label = typeof input.projectName === 'string' && input.projectName.trim() ? input.projectName.trim() : 'site';
|
|
174
|
-
const commitSha = await createGitHubCommit(config, owner, repo, `Deploy ${label} via @jini-ai/deploy`, treeSha, parentSha ? [parentSha] : []);
|
|
175
|
-
if (parentSha) {
|
|
176
|
-
await updateGitHubRef(config, owner, repo, branch, commitSha);
|
|
177
|
-
}
|
|
178
|
-
else {
|
|
179
|
-
await createGitHubRef(config, owner, repo, branch, commitSha);
|
|
180
|
-
}
|
|
181
|
-
return { parentSha, commitSha };
|
|
182
|
-
}
|
|
183
|
-
async function prepareGitHubPagesSite({ config, owner, repo, branch, commitSha }, _options = {}) {
|
|
184
|
-
const site = await ensureGitHubPagesSite(config, owner, repo, branch);
|
|
185
|
-
const configuredBranch = typeof site.source?.branch === 'string' ? site.source.branch : undefined;
|
|
186
|
-
const sourceBranchMismatch = configuredBranch !== undefined && configuredBranch !== branch;
|
|
187
|
-
const build = await pollGitHubPagesBuild(config, owner, repo, commitSha);
|
|
188
|
-
if (build?.status === GITHUB_PAGES_BUILD_FAILURE) {
|
|
189
|
-
throw new DeployError(build.errorMessage || 'GitHub Pages build errored.', 502, build.raw);
|
|
190
|
-
}
|
|
191
|
-
return { site, sourceBranchMismatch };
|
|
192
|
-
}
|
|
193
|
-
function enc(value) {
|
|
194
|
-
return encodeURIComponent(value);
|
|
195
|
-
}
|
|
196
|
-
function githubHeaders(token, extra = {}) {
|
|
197
|
-
return {
|
|
198
|
-
Authorization: `Bearer ${token}`,
|
|
199
|
-
Accept: 'application/vnd.github+json',
|
|
200
|
-
'X-GitHub-Api-Version': GITHUB_API_VERSION,
|
|
201
|
-
...extra,
|
|
202
|
-
};
|
|
203
|
-
}
|
|
58
|
+
const GITHUB_PAGES_BUILD_SUCCESS = 'built';
|
|
59
|
+
const GITHUB_PAGES_BUILD_FAILURE = 'errored';
|
|
60
|
+
|
|
61
|
+
function enc(value) {
|
|
62
|
+
return encodeURIComponent(value);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function githubHeaders(token, extra = {}) {
|
|
66
|
+
return {
|
|
67
|
+
Authorization: `Bearer ${token}`,
|
|
68
|
+
Accept: 'application/vnd.github+json',
|
|
69
|
+
'X-GitHub-Api-Version': GITHUB_API_VERSION,
|
|
70
|
+
...extra,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function sha256Hex(data) {
|
|
75
|
+
return createHash('sha256').update(Buffer.from(data)).digest('hex');
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function pagesBuildState({ json }, _options = {}) {
|
|
79
|
+
const status = typeof json.status === 'string' ? json.status : '';
|
|
80
|
+
const errorObj = json.error;
|
|
81
|
+
const errorMessage = typeof errorObj?.message === 'string' ? errorObj.message : undefined;
|
|
82
|
+
return { status, ...(errorMessage ? { errorMessage } : {}), raw: json };
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function isPagesBuildForCommit({ json, commitSha }, _options = {}) {
|
|
86
|
+
const commit = typeof json.commit === 'string' ? json.commit : '';
|
|
87
|
+
return commit === commitSha;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** 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). */
|
|
91
|
+
function githubPagesUrlCandidates(site, normalizeDeploymentUrl) {
|
|
92
|
+
const urls = [];
|
|
93
|
+
if (site && typeof site.html_url === 'string')
|
|
94
|
+
urls.push(site.html_url);
|
|
95
|
+
if (site && typeof site.url === 'string')
|
|
96
|
+
urls.push(site.url);
|
|
97
|
+
return [...new Set(urls.map(normalizeDeploymentUrl).filter(Boolean))];
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function pagesPublishResult({ targetId, link, candidates, commitSha, owner, repo, branch, parentSha, sourceBranchMismatch }) {
|
|
101
|
+
return {
|
|
102
|
+
targetId,
|
|
103
|
+
url: link.url || candidates[0] || '',
|
|
104
|
+
deploymentId: commitSha,
|
|
105
|
+
status: link.status,
|
|
106
|
+
statusMessage: link.statusMessage,
|
|
107
|
+
...(link.reachableAt !== undefined ? { reachableAt: link.reachableAt } : {}),
|
|
108
|
+
providerMetadata: {
|
|
109
|
+
owner,
|
|
110
|
+
repo,
|
|
111
|
+
branch,
|
|
112
|
+
commitSha,
|
|
113
|
+
branchCreated: !parentSha,
|
|
114
|
+
...(sourceBranchMismatch ? { sourceBranchMismatch: true } : {}),
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function createPagesResponseReaders(DeployError) {
|
|
204
120
|
async function readGitHubJson(resp) {
|
|
205
121
|
try {
|
|
206
122
|
return (await resp.json());
|
|
@@ -209,6 +125,7 @@ export function bindGitHubPages(kit, _optional = {}) {
|
|
|
209
125
|
throw new DeployError('GitHub returned a non-JSON response.', resp.status || 502);
|
|
210
126
|
}
|
|
211
127
|
}
|
|
128
|
+
|
|
212
129
|
/**
|
|
213
130
|
* `fallback` (the second operand of the `||`) is unreachable today: every
|
|
214
131
|
* one of this file's 8 call sites passes a non-empty string literal — same
|
|
@@ -220,21 +137,11 @@ export function bindGitHubPages(kit, _optional = {}) {
|
|
|
220
137
|
const message = typeof json?.message === 'string' && json.message ? json.message : fallback || `GitHub request failed (${status}).`;
|
|
221
138
|
return new DeployError(message, status, json);
|
|
222
139
|
}
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
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 });
|
|
229
|
-
assertNotRedirected(resp, 'GitHub Pages branch lookup');
|
|
230
|
-
if (resp.status === 404)
|
|
231
|
-
return undefined;
|
|
232
|
-
const json = await readGitHubJson(resp);
|
|
233
|
-
if (!resp.ok)
|
|
234
|
-
throw githubError(json, resp.status, 'GitHub Pages branch lookup failed.');
|
|
235
|
-
const object = json.object;
|
|
236
|
-
return typeof object?.sha === 'string' ? object.sha : undefined;
|
|
237
|
-
}
|
|
140
|
+
|
|
141
|
+
return { readGitHubJson, githubError };
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function createPagesTreeWriter({ fetchWithTimeout, FETCH_TIMEOUT_MS, assertNotRedirected, redirectGuardInit, readGitHubJson, githubError, DeployError }) {
|
|
238
145
|
async function createGitHubBlob(config, owner, repo, data) {
|
|
239
146
|
const resp = await fetchWithTimeout(`${GITHUB_API}/repos/${enc(owner)}/${enc(repo)}/git/blobs`, redirectGuardInit({
|
|
240
147
|
method: 'POST',
|
|
@@ -250,6 +157,7 @@ export function bindGitHubPages(kit, _optional = {}) {
|
|
|
250
157
|
throw new DeployError('GitHub blob response did not include a sha.', 502, json);
|
|
251
158
|
return sha;
|
|
252
159
|
}
|
|
160
|
+
|
|
253
161
|
/**
|
|
254
162
|
* Creates one blob per distinct file content (deduped by a local sha256 key
|
|
255
163
|
* — a plain dedup key, not a wire-protocol requirement the way Netlify's
|
|
@@ -287,21 +195,24 @@ export function bindGitHubPages(kit, _optional = {}) {
|
|
|
287
195
|
throw new DeployError('GitHub tree response did not include a sha.', 502, json);
|
|
288
196
|
return sha;
|
|
289
197
|
}
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
198
|
+
|
|
199
|
+
return createGitHubTreeFromFiles;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
function createPagesRefOperations({ fetchWithTimeout, FETCH_TIMEOUT_MS, assertNotRedirected, redirectGuardInit, readGitHubJson, githubError }) {
|
|
203
|
+
/** Looks up the tip commit sha of `heads/{branch}`, or `undefined` if the branch does not exist yet (a brand-new Pages publish). */
|
|
204
|
+
async function getGitHubRefSha(config, owner, repo, branch) {
|
|
205
|
+
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 });
|
|
206
|
+
assertNotRedirected(resp, 'GitHub Pages branch lookup');
|
|
207
|
+
if (resp.status === 404)
|
|
208
|
+
return undefined;
|
|
297
209
|
const json = await readGitHubJson(resp);
|
|
298
210
|
if (!resp.ok)
|
|
299
|
-
throw githubError(json, resp.status, 'GitHub
|
|
300
|
-
const
|
|
301
|
-
|
|
302
|
-
throw new DeployError('GitHub commit response did not include a sha.', 502, json);
|
|
303
|
-
return sha;
|
|
211
|
+
throw githubError(json, resp.status, 'GitHub Pages branch lookup failed.');
|
|
212
|
+
const object = json.object;
|
|
213
|
+
return typeof object?.sha === 'string' ? object.sha : undefined;
|
|
304
214
|
}
|
|
215
|
+
|
|
305
216
|
async function createGitHubRef(config, owner, repo, branch, sha) {
|
|
306
217
|
const resp = await fetchWithTimeout(`${GITHUB_API}/repos/${enc(owner)}/${enc(repo)}/git/refs`, redirectGuardInit({
|
|
307
218
|
method: 'POST',
|
|
@@ -313,6 +224,7 @@ export function bindGitHubPages(kit, _optional = {}) {
|
|
|
313
224
|
if (!resp.ok)
|
|
314
225
|
throw githubError(json, resp.status, 'GitHub Pages branch creation failed.');
|
|
315
226
|
}
|
|
227
|
+
|
|
316
228
|
/**
|
|
317
229
|
* `force: true` even though `sha` is always a direct child of the branch's
|
|
318
230
|
* current tip (`createGitHubCommit`'s `parents` was seeded from this exact
|
|
@@ -335,35 +247,45 @@ export function bindGitHubPages(kit, _optional = {}) {
|
|
|
335
247
|
if (!resp.ok)
|
|
336
248
|
throw githubError(json, resp.status, 'GitHub Pages branch update failed.');
|
|
337
249
|
}
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
assertNotRedirected(
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
250
|
+
|
|
251
|
+
return { getGitHubRefSha, createGitHubRef, updateGitHubRef };
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
function createPagesCommitPusher({ fetchWithTimeout, FETCH_TIMEOUT_MS, assertNotRedirected, redirectGuardInit, readGitHubJson, githubError, DeployError, createGitHubTreeFromFiles, getGitHubRefSha, createGitHubRef, updateGitHubRef }) {
|
|
255
|
+
async function createGitHubCommit(config, owner, repo, message, treeSha, parents) {
|
|
256
|
+
const resp = await fetchWithTimeout(`${GITHUB_API}/repos/${enc(owner)}/${enc(repo)}/git/commits`, redirectGuardInit({
|
|
257
|
+
method: 'POST',
|
|
258
|
+
headers: githubHeaders(config.token, { 'Content-Type': 'application/json' }),
|
|
259
|
+
body: JSON.stringify({ message, tree: treeSha, parents }),
|
|
260
|
+
}), { timeoutMs: FETCH_TIMEOUT_MS.QUICK });
|
|
261
|
+
assertNotRedirected(resp, 'GitHub commit creation');
|
|
262
|
+
const json = await readGitHubJson(resp);
|
|
263
|
+
if (!resp.ok)
|
|
264
|
+
throw githubError(json, resp.status, 'GitHub commit creation failed.');
|
|
265
|
+
const sha = typeof json.sha === 'string' ? json.sha : '';
|
|
266
|
+
if (!sha)
|
|
267
|
+
throw new DeployError('GitHub commit response did not include a sha.', 502, json);
|
|
268
|
+
return sha;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
async function pushGitHubPagesFiles({ config, owner, repo, branch, input }, _options = {}) {
|
|
272
|
+
const parentSha = await getGitHubRefSha(config, owner, repo, branch);
|
|
273
|
+
const treeSha = await createGitHubTreeFromFiles(config, owner, repo, input.files);
|
|
274
|
+
const label = typeof input.projectName === 'string' && input.projectName.trim() ? input.projectName.trim() : 'site';
|
|
275
|
+
const commitSha = await createGitHubCommit(config, owner, repo, `Deploy ${label} via @jini-ai/deploy`, treeSha, parentSha ? [parentSha] : []);
|
|
276
|
+
if (parentSha) {
|
|
277
|
+
await updateGitHubRef(config, owner, repo, branch, commitSha);
|
|
361
278
|
}
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
return
|
|
279
|
+
else {
|
|
280
|
+
await createGitHubRef(config, owner, repo, branch, commitSha);
|
|
281
|
+
}
|
|
282
|
+
return { parentSha, commitSha };
|
|
366
283
|
}
|
|
284
|
+
|
|
285
|
+
return pushGitHubPagesFiles;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
function createPagesBuildPoller({ fetchWithTimeout, FETCH_TIMEOUT_MS, assertNotRedirected, redirectGuardInit, readGitHubJson, githubError, sleep }) {
|
|
367
289
|
async function readPagesBuildResponse({ resp }, _options = {}) {
|
|
368
290
|
if (resp.status === 404)
|
|
369
291
|
return undefined;
|
|
@@ -391,16 +313,7 @@ export function bindGitHubPages(kit, _optional = {}) {
|
|
|
391
313
|
throw githubError(json, resp.status, 'GitHub Pages build status check failed.');
|
|
392
314
|
return { json };
|
|
393
315
|
}
|
|
394
|
-
|
|
395
|
-
const status = typeof json.status === 'string' ? json.status : '';
|
|
396
|
-
const errorObj = json.error;
|
|
397
|
-
const errorMessage = typeof errorObj?.message === 'string' ? errorObj.message : undefined;
|
|
398
|
-
return { status, ...(errorMessage ? { errorMessage } : {}), raw: json };
|
|
399
|
-
}
|
|
400
|
-
function isPagesBuildForCommit({ json, commitSha }, _options = {}) {
|
|
401
|
-
const commit = typeof json.commit === 'string' ? json.commit : '';
|
|
402
|
-
return commit === commitSha;
|
|
403
|
-
}
|
|
316
|
+
|
|
404
317
|
/**
|
|
405
318
|
* Polls `GET /repos/{owner}/{repo}/pages/builds/latest` — deliberately not
|
|
406
319
|
* the Pages site resource's own `status` field (`GET
|
|
@@ -443,16 +356,164 @@ export function bindGitHubPages(kit, _optional = {}) {
|
|
|
443
356
|
}
|
|
444
357
|
return last;
|
|
445
358
|
}
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
359
|
+
|
|
360
|
+
return pollGitHubPagesBuild;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
function createPagesSitePreparer({ fetchWithTimeout, FETCH_TIMEOUT_MS, assertNotRedirected, redirectGuardInit, readGitHubJson, githubError, DeployError, pollGitHubPagesBuild }) {
|
|
364
|
+
/**
|
|
365
|
+
* Finds the repository's Pages site config, creating it (pointed at
|
|
366
|
+
* `branch`, `build_type: 'legacy'` — the branch-based build model, matching
|
|
367
|
+
* this file's Git Data API publish mechanism rather than the Actions
|
|
368
|
+
* `'workflow'` build type) if none exists yet. Never mutates an
|
|
369
|
+
* already-enabled site's configuration — see `publish()`'s
|
|
370
|
+
* `sourceBranchMismatch` handling for what happens when the existing site
|
|
371
|
+
* is configured against a different branch than this call targets.
|
|
372
|
+
*/
|
|
373
|
+
async function ensureGitHubPagesSite(config, owner, repo, branch) {
|
|
374
|
+
const getResp = await fetchWithTimeout(`${GITHUB_API}/repos/${enc(owner)}/${enc(repo)}/pages`, redirectGuardInit({ headers: githubHeaders(config.token) }), { timeoutMs: FETCH_TIMEOUT_MS.QUICK });
|
|
375
|
+
assertNotRedirected(getResp, 'GitHub Pages site lookup');
|
|
376
|
+
if (getResp.status === 404) {
|
|
377
|
+
const createResp = await fetchWithTimeout(`${GITHUB_API}/repos/${enc(owner)}/${enc(repo)}/pages`, redirectGuardInit({
|
|
378
|
+
method: 'POST',
|
|
379
|
+
headers: githubHeaders(config.token, { 'Content-Type': 'application/json' }),
|
|
380
|
+
body: JSON.stringify({ source: { branch, path: '/' }, build_type: 'legacy' }),
|
|
381
|
+
}), { timeoutMs: FETCH_TIMEOUT_MS.DEPLOY });
|
|
382
|
+
assertNotRedirected(createResp, 'GitHub Pages site creation');
|
|
383
|
+
const created = await readGitHubJson(createResp);
|
|
384
|
+
if (!createResp.ok)
|
|
385
|
+
throw githubError(created, createResp.status, 'GitHub Pages site creation failed.');
|
|
386
|
+
return created;
|
|
387
|
+
}
|
|
388
|
+
const json = await readGitHubJson(getResp);
|
|
389
|
+
if (!getResp.ok)
|
|
390
|
+
throw githubError(json, getResp.status, 'GitHub Pages site lookup failed.');
|
|
391
|
+
return json;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
async function prepareGitHubPagesSite({ config, owner, repo, branch, commitSha }, _options = {}) {
|
|
395
|
+
const site = await ensureGitHubPagesSite(config, owner, repo, branch);
|
|
396
|
+
const configuredBranch = typeof site.source?.branch === 'string' ? site.source.branch : undefined;
|
|
397
|
+
const sourceBranchMismatch = configuredBranch !== undefined && configuredBranch !== branch;
|
|
398
|
+
const build = await pollGitHubPagesBuild(config, owner, repo, commitSha);
|
|
399
|
+
if (build?.status === GITHUB_PAGES_BUILD_FAILURE) {
|
|
400
|
+
throw new DeployError(build.errorMessage || 'GitHub Pages build errored.', 502, build.raw);
|
|
401
|
+
}
|
|
402
|
+
return { site, sourceBranchMismatch };
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
return prepareGitHubPagesSite;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
function createGitHubPagesTarget({ fetchWithTimeout, FETCH_TIMEOUT_MS, assertNotRedirected, redirectGuardInit, readGitHubJson, githubError, DeployError,
|
|
409
|
+
checkDeploymentUrl, normalizeDeploymentUrl, waitForReachableDeploymentUrl, pushGitHubPagesFiles, prepareGitHubPagesSite }) {
|
|
410
|
+
/**
|
|
411
|
+
* `DeployTarget` adapter for GitHub Pages, built on the Git Data API (create
|
|
412
|
+
* blobs → a tree → a commit → create/update a branch ref) rather than the
|
|
413
|
+
* newer artifact-based "Pages deployments" API
|
|
414
|
+
* (`POST /repos/{owner}/{repo}/pages/deployments`). See
|
|
415
|
+
* `packages/devops/source-map.md`'s 2026-07-21 addition for the full
|
|
416
|
+
* research trail; in short: that endpoint requires an `oidc_token` "issued
|
|
417
|
+
* by GitHub Actions certifying the origin of the deployment" — a token this
|
|
418
|
+
* package (running outside an Actions runner, authenticating with a plain
|
|
419
|
+
* PAT) has no way to mint. The Git Data API has no such requirement: any
|
|
420
|
+
* token with repo write access can push a commit and (once the branch
|
|
421
|
+
* exists) enable/observe Pages against it, which is exactly what
|
|
422
|
+
* `actions/deploy-pages`'s *predecessor* tooling (and every non-Actions
|
|
423
|
+
* GitHub Pages deploy tool in the wild, e.g. `gh-pages`/
|
|
424
|
+
* `JamesIves/github-pages-deploy-action` in non-artifact mode) has always
|
|
425
|
+
* done.
|
|
426
|
+
*
|
|
427
|
+
* Unlike `VercelDeployTarget`/`NetlifyDeployTarget`/`CloudflarePagesDeployTarget`,
|
|
428
|
+
* this target does not derive a project/site identity from
|
|
429
|
+
* `input.projectName` — a GitHub Pages "site" is intrinsically the
|
|
430
|
+
* `{owner, repo}` the caller configures, not a freely-named resource this
|
|
431
|
+
* package could create on the fly. `input.projectName` is used only as a
|
|
432
|
+
* human label in the generated commit message.
|
|
433
|
+
*/
|
|
434
|
+
class GitHubPagesDeployTarget {
|
|
435
|
+
config;
|
|
436
|
+
id = GITHUB_PAGES_TARGET_ID;
|
|
437
|
+
constructor(config) {
|
|
438
|
+
this.config = config;
|
|
439
|
+
}
|
|
440
|
+
/** Existing Pages sites can use a custom domain; read it before rendering. A new site has
|
|
441
|
+
* GitHub's fixed owner/repository address until its first Pages branch exists.
|
|
442
|
+
* @complexity One bounded read, no branch writes or Pages provisioning.
|
|
443
|
+
*/
|
|
444
|
+
async resolvePublicUrl(_required, _options = {}) {
|
|
445
|
+
const { owner, repo } = this.config;
|
|
446
|
+
const response = await fetchWithTimeout(`${GITHUB_API}/repos/${enc(owner)}/${enc(repo)}/pages`, redirectGuardInit({ headers: githubHeaders(this.config.token) }), { timeoutMs: FETCH_TIMEOUT_MS.QUICK });
|
|
447
|
+
assertNotRedirected(response, 'GitHub Pages public URL lookup');
|
|
448
|
+
const body = await readGitHubJson(response);
|
|
449
|
+
if (response.status === 404) return `https://${owner.toLowerCase()}.github.io${repo.toLowerCase() === `${owner.toLowerCase()}.github.io` ? '' : `/${repo}`}`;
|
|
450
|
+
if (!response.ok) throw githubError(body, response.status, 'GitHub Pages site lookup failed.');
|
|
451
|
+
const url = githubPagesUrlCandidates(body, normalizeDeploymentUrl)[0];
|
|
452
|
+
if (!url) throw new DeployError('GitHub Pages did not report a public URL.', 502);
|
|
453
|
+
return url;
|
|
454
|
+
}
|
|
455
|
+
/**
|
|
456
|
+
* Publishes `input.files` as a new commit on the configured Pages branch
|
|
457
|
+
* (creating the branch if it doesn't exist yet), ensures the repository's
|
|
458
|
+
* Pages site is enabled against that branch, waits for GitHub's own build
|
|
459
|
+
* of that exact commit to finish, then waits for the resulting URL to
|
|
460
|
+
* become publicly reachable.
|
|
461
|
+
*
|
|
462
|
+
* Sequencing note: the branch is pushed to *before* Pages is
|
|
463
|
+
* enabled/verified, not after. `POST /repos/{owner}/{repo}/pages` requires
|
|
464
|
+
* `source.branch` to already exist in the repository — enabling Pages
|
|
465
|
+
* against a branch that doesn't exist yet fails, so the branch must be
|
|
466
|
+
* created first via the Git Data API flow below.
|
|
467
|
+
*
|
|
468
|
+
* @param input - File set plus a caller-chosen label used only for the commit message.
|
|
469
|
+
* @throws {DeployError} If `config.token`/`config.owner`/`config.repo` is
|
|
470
|
+
* missing, or GitHub's API rejects any step of the blob/tree/commit/ref/
|
|
471
|
+
* pages flow, or the resulting Pages build reaches `status: 'errored'`.
|
|
472
|
+
*/
|
|
473
|
+
async publish(input) {
|
|
474
|
+
if (!this.config.token) {
|
|
475
|
+
throw new DeployError('GitHub token is required.', 400);
|
|
476
|
+
}
|
|
477
|
+
const { owner, repo } = this.config;
|
|
478
|
+
if (!owner || !repo) {
|
|
479
|
+
throw new DeployError('GitHub Pages owner and repo are required.', 400);
|
|
480
|
+
}
|
|
481
|
+
const branch = this.config.branch || DEFAULT_GITHUB_PAGES_BRANCH;
|
|
482
|
+
const { parentSha, commitSha } = await pushGitHubPagesFiles({ config: this.config, owner, repo, branch, input });
|
|
483
|
+
const { site, sourceBranchMismatch } = await prepareGitHubPagesSite({ config: this.config, owner, repo, branch, commitSha });
|
|
484
|
+
const candidates = githubPagesUrlCandidates(site, normalizeDeploymentUrl);
|
|
485
|
+
const link = await waitForReachableDeploymentUrl(candidates, { providerLabel: 'GitHub Pages' });
|
|
486
|
+
return pagesPublishResult({ targetId: this.id, link, candidates, commitSha, owner, repo, branch, parentSha, sourceBranchMismatch });
|
|
487
|
+
}
|
|
488
|
+
/** 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`. */
|
|
489
|
+
async checkReachability(url) {
|
|
490
|
+
return checkDeploymentUrl(url);
|
|
491
|
+
}
|
|
454
492
|
}
|
|
455
493
|
|
|
494
|
+
return GitHubPagesDeployTarget;
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
/**
|
|
498
|
+
* Binds the ported GitHub Pages code to one host kit.
|
|
499
|
+
*
|
|
500
|
+
* @param {{ fetch(url: string, init: RequestInit, options: { timeoutMs: number }): Promise<Response>,
|
|
501
|
+
* timeouts: { QUICK: number, DEPLOY: number, UPLOAD: number }, sleep(ms: number): Promise<void> } & Record<string, any>} kit
|
|
502
|
+
* The host's deploy kit in the positional ABI installed modules are written against (devops'
|
|
503
|
+
* `DeployHostKit` helpers, called positionally; `DeployError` is `new (message, status?, details?)`).
|
|
504
|
+
* @returns The target class, constructed with `{ token, owner, repo, branch? }` as in devops.
|
|
505
|
+
*/
|
|
506
|
+
export function bindGitHubPages(kit, _optional = {}) {
|
|
507
|
+
const { fetch: fetchWithTimeout, timeouts: FETCH_TIMEOUT_MS, sleep, DeployError, checkDeploymentUrl, normalizeDeploymentUrl, waitForReachableDeploymentUrl, assertNotRedirected, redirectGuardInit } = kit;
|
|
508
|
+
const transport = { fetchWithTimeout, FETCH_TIMEOUT_MS, assertNotRedirected, redirectGuardInit, ...createPagesResponseReaders(DeployError) };
|
|
509
|
+
const createGitHubTreeFromFiles = createPagesTreeWriter({ ...transport, DeployError });
|
|
510
|
+
const refs = createPagesRefOperations(transport);
|
|
511
|
+
const pushGitHubPagesFiles = createPagesCommitPusher({ ...transport, ...refs, DeployError, createGitHubTreeFromFiles });
|
|
512
|
+
const pollGitHubPagesBuild = createPagesBuildPoller({ ...transport, sleep });
|
|
513
|
+
const prepareGitHubPagesSite = createPagesSitePreparer({ ...transport, DeployError, pollGitHubPagesBuild });
|
|
514
|
+
const GitHubPagesDeployTarget = createGitHubPagesTarget({ ...transport, DeployError, checkDeploymentUrl, normalizeDeploymentUrl,
|
|
515
|
+
waitForReachableDeploymentUrl, pushGitHubPagesFiles, prepareGitHubPagesSite });
|
|
516
|
+
|
|
456
517
|
return { GitHubPagesDeployTarget };
|
|
457
518
|
}
|
|
458
519
|
|