@ebay-dt/bonfire-node 0.1.0-alpha.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.
Files changed (71) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +98 -0
  3. package/dist/duplicate.d.ts +24 -0
  4. package/dist/duplicate.d.ts.map +1 -0
  5. package/dist/duplicate.js +333 -0
  6. package/dist/duplicate.js.map +1 -0
  7. package/dist/git-repository.d.ts +73 -0
  8. package/dist/git-repository.d.ts.map +1 -0
  9. package/dist/git-repository.js +385 -0
  10. package/dist/git-repository.js.map +1 -0
  11. package/dist/github-cli.d.ts +27 -0
  12. package/dist/github-cli.d.ts.map +1 -0
  13. package/dist/github-cli.js +203 -0
  14. package/dist/github-cli.js.map +1 -0
  15. package/dist/index.d.ts +7 -0
  16. package/dist/index.d.ts.map +1 -0
  17. package/dist/index.js +4 -0
  18. package/dist/index.js.map +1 -0
  19. package/dist/internal/owned-destination.d.ts +24 -0
  20. package/dist/internal/owned-destination.d.ts.map +1 -0
  21. package/dist/internal/owned-destination.js +232 -0
  22. package/dist/internal/owned-destination.js.map +1 -0
  23. package/dist/internal/prototype-templates.d.ts +9 -0
  24. package/dist/internal/prototype-templates.d.ts.map +1 -0
  25. package/dist/internal/prototype-templates.js +78 -0
  26. package/dist/internal/prototype-templates.js.map +1 -0
  27. package/dist/internal/utils.d.ts +12 -0
  28. package/dist/internal/utils.d.ts.map +1 -0
  29. package/dist/internal/utils.js +13 -0
  30. package/dist/internal/utils.js.map +1 -0
  31. package/dist/lifecycle/dirty-state.d.ts +7 -0
  32. package/dist/lifecycle/dirty-state.d.ts.map +1 -0
  33. package/dist/lifecycle/dirty-state.js +10 -0
  34. package/dist/lifecycle/dirty-state.js.map +1 -0
  35. package/dist/lifecycle/local-prototype-lifecycle.d.ts +35 -0
  36. package/dist/lifecycle/local-prototype-lifecycle.d.ts.map +1 -0
  37. package/dist/lifecycle/local-prototype-lifecycle.js +265 -0
  38. package/dist/lifecycle/local-prototype-lifecycle.js.map +1 -0
  39. package/dist/lifecycle/operation-gate.d.ts +7 -0
  40. package/dist/lifecycle/operation-gate.d.ts.map +1 -0
  41. package/dist/lifecycle/operation-gate.js +31 -0
  42. package/dist/lifecycle/operation-gate.js.map +1 -0
  43. package/dist/lifecycle/runtime-context.d.ts +20 -0
  44. package/dist/lifecycle/runtime-context.d.ts.map +1 -0
  45. package/dist/lifecycle/runtime-context.js +41 -0
  46. package/dist/lifecycle/runtime-context.js.map +1 -0
  47. package/dist/prepare-prototype-files.d.ts +23 -0
  48. package/dist/prepare-prototype-files.d.ts.map +1 -0
  49. package/dist/prepare-prototype-files.js +2 -0
  50. package/dist/prepare-prototype-files.js.map +1 -0
  51. package/dist/process-runner.d.ts +27 -0
  52. package/dist/process-runner.d.ts.map +1 -0
  53. package/dist/process-runner.js +19 -0
  54. package/dist/process-runner.js.map +1 -0
  55. package/dist/prototype-catalog.d.ts +13 -0
  56. package/dist/prototype-catalog.d.ts.map +1 -0
  57. package/dist/prototype-catalog.js +124 -0
  58. package/dist/prototype-catalog.js.map +1 -0
  59. package/dist/prototype-paths.d.ts +14 -0
  60. package/dist/prototype-paths.d.ts.map +1 -0
  61. package/dist/prototype-paths.js +121 -0
  62. package/dist/prototype-paths.js.map +1 -0
  63. package/dist/scaffold.d.ts +24 -0
  64. package/dist/scaffold.d.ts.map +1 -0
  65. package/dist/scaffold.js +173 -0
  66. package/dist/scaffold.js.map +1 -0
  67. package/dist/watcher.d.ts +20 -0
  68. package/dist/watcher.d.ts.map +1 -0
  69. package/dist/watcher.js +182 -0
  70. package/dist/watcher.js.map +1 -0
  71. package/package.json +53 -0
@@ -0,0 +1,385 @@
1
+ import { isAbsolute } from "node:path";
2
+ import { simpleGit } from "simple-git";
3
+ import { asFailure, isNonEmptyString, isPositiveInteger, isRecord, } from "./internal/utils.js";
4
+ const DEFAULT_TIMEOUT_MS = 30_000;
5
+ const DEFAULT_MAX_CONCURRENT_PROCESSES = 1;
6
+ const DEFAULT_COMMIT_IDENTITY = {
7
+ name: "Bonfire",
8
+ email: "bonfire@localhost",
9
+ };
10
+ const NOTHING_TO_COMMIT_MESSAGES = [
11
+ "nothing to commit",
12
+ "nothing added to commit",
13
+ ];
14
+ export class GitRepositoryError extends Error {
15
+ kind;
16
+ operation;
17
+ constructor(kind, operation) {
18
+ super(`Git operation failed: ${operation}`);
19
+ this.name = "GitRepositoryError";
20
+ this.kind = kind;
21
+ this.operation = operation;
22
+ }
23
+ }
24
+ function classifyError(error) {
25
+ if (error instanceof GitRepositoryError)
26
+ return error.kind;
27
+ const failure = asFailure(error);
28
+ const message = typeof failure.message === "string" ? failure.message : "";
29
+ const normalized = message.toLowerCase();
30
+ if (failure.code === "ENOENT" || normalized.includes("enoent")) {
31
+ return "missing-git";
32
+ }
33
+ if (failure.code === "ETIMEDOUT" ||
34
+ failure.killed === true ||
35
+ failure.signal === "SIGTERM" ||
36
+ normalized.includes("timed out") ||
37
+ normalized.includes("timeout")) {
38
+ return "timeout";
39
+ }
40
+ if (normalized.includes("conflict") ||
41
+ normalized.includes("would be overwritten") ||
42
+ normalized.includes("unmerged paths")) {
43
+ return "conflict";
44
+ }
45
+ if (isRecord(error) || error instanceof Error)
46
+ return "command-failure";
47
+ return "unexpected";
48
+ }
49
+ function normalizeError(operation, error) {
50
+ if (error instanceof GitRepositoryError)
51
+ return error;
52
+ return new GitRepositoryError(classifyError(error), operation);
53
+ }
54
+ function assertValidPositiveInteger(value, option) {
55
+ if (!isPositiveInteger(value)) {
56
+ throw new GitRepositoryError("invalid-configuration", option);
57
+ }
58
+ }
59
+ function assertValidBranchName(value, option) {
60
+ if (!isNonEmptyString(value) ||
61
+ value.startsWith("-") ||
62
+ value.includes("\0") ||
63
+ /\s/u.test(value) ||
64
+ value.includes("@{") ||
65
+ value.split(/[\\/]/u).some((segment) => segment === "..")) {
66
+ throw new GitRepositoryError("invalid-configuration", option);
67
+ }
68
+ }
69
+ function assertValidPathspec(pathspec) {
70
+ if (!isNonEmptyString(pathspec) ||
71
+ isAbsolute(pathspec) ||
72
+ /^[A-Za-z]:[\\/]/u.test(pathspec) ||
73
+ pathspec.startsWith("\\") ||
74
+ pathspec.startsWith("-") ||
75
+ pathspec.startsWith(":") ||
76
+ pathspec.includes("\0") ||
77
+ pathspec.includes("*") ||
78
+ pathspec.includes("?") ||
79
+ pathspec.includes("[") ||
80
+ pathspec.includes("]") ||
81
+ pathspec === "." ||
82
+ pathspec.split(/[\\/]/u).some((segment) => segment === "..")) {
83
+ throw new GitRepositoryError("invalid-configuration", "pathspec");
84
+ }
85
+ }
86
+ function assertValidPathspecs(pathspecs) {
87
+ if (pathspecs.length === 0) {
88
+ throw new GitRepositoryError("invalid-configuration", "pathspec");
89
+ }
90
+ for (const pathspec of pathspecs)
91
+ assertValidPathspec(pathspec);
92
+ return [...pathspecs];
93
+ }
94
+ function assertValidArguments(args, operation) {
95
+ if (args.some((argument) => !isNonEmptyString(argument) || argument.includes("\0"))) {
96
+ throw new GitRepositoryError("invalid-configuration", operation);
97
+ }
98
+ return [...args];
99
+ }
100
+ function isNothingToCommit(error) {
101
+ const failure = asFailure(error);
102
+ const message = typeof failure.message === "string" ? failure.message : "";
103
+ return NOTHING_TO_COMMIT_MESSAGES.some((needle) => message.toLowerCase().includes(needle));
104
+ }
105
+ class SimpleGitRepository {
106
+ repositoryRoot;
107
+ #git;
108
+ constructor(options) {
109
+ this.repositoryRoot = options.repositoryRoot;
110
+ this.#git = simpleGit(options.repositoryRoot, {
111
+ baseDir: options.repositoryRoot,
112
+ maxConcurrentProcesses: options.maxConcurrentProcesses,
113
+ config: [
114
+ `user.name=${options.commitIdentity.name}`,
115
+ `user.email=${options.commitIdentity.email}`,
116
+ ],
117
+ timeout: { block: options.timeoutMs },
118
+ });
119
+ }
120
+ async #execute(operation, action) {
121
+ try {
122
+ return await action();
123
+ }
124
+ catch (error) {
125
+ throw normalizeError(operation, error);
126
+ }
127
+ }
128
+ async currentBranch() {
129
+ const result = await this.#execute("current-branch", () => this.#git.revparse(["--abbrev-ref", "HEAD"]));
130
+ if (!isNonEmptyString(result) || result.trim().length === 0) {
131
+ throw new GitRepositoryError("malformed-output", "current-branch");
132
+ }
133
+ return result.trim();
134
+ }
135
+ async status(pathspecs) {
136
+ const validatedPathspecs = pathspecs === undefined ? undefined : assertValidPathspecs(pathspecs);
137
+ const result = await this.#execute("status", () => validatedPathspecs === undefined
138
+ ? this.#git.status()
139
+ : this.#git.status(["--", ...validatedPathspecs]));
140
+ if (!isRecord(result) ||
141
+ !Array.isArray(result.files) ||
142
+ (typeof result.current !== "string" && result.current !== null) ||
143
+ typeof result.isClean !== "function") {
144
+ throw new GitRepositoryError("malformed-output", "status");
145
+ }
146
+ const files = [];
147
+ for (const file of result.files) {
148
+ if (!isRecord(file)) {
149
+ throw new GitRepositoryError("malformed-output", "status");
150
+ }
151
+ if (typeof file.path !== "string" ||
152
+ typeof file.index !== "string" ||
153
+ typeof file.working_dir !== "string") {
154
+ throw new GitRepositoryError("malformed-output", "status");
155
+ }
156
+ files.push({
157
+ path: file.path,
158
+ index: file.index,
159
+ workingDirectory: file.working_dir,
160
+ ...(typeof file.from === "string" ? { from: file.from } : {}),
161
+ });
162
+ }
163
+ let clean;
164
+ try {
165
+ clean = result.isClean();
166
+ }
167
+ catch {
168
+ throw new GitRepositoryError("malformed-output", "status");
169
+ }
170
+ if (typeof clean !== "boolean") {
171
+ throw new GitRepositoryError("malformed-output", "status");
172
+ }
173
+ return {
174
+ current: result.current,
175
+ files,
176
+ clean,
177
+ };
178
+ }
179
+ async remotes() {
180
+ const result = await this.#execute("remotes", () => this.#git.getRemotes(true));
181
+ if (!Array.isArray(result)) {
182
+ throw new GitRepositoryError("malformed-output", "remotes");
183
+ }
184
+ const remotes = [];
185
+ for (const remote of result) {
186
+ if (!isRecord(remote) || typeof remote.name !== "string") {
187
+ throw new GitRepositoryError("malformed-output", "remotes");
188
+ }
189
+ const refs = remote.refs;
190
+ if (!isRecord(refs)) {
191
+ throw new GitRepositoryError("malformed-output", "remotes");
192
+ }
193
+ if (typeof refs.fetch !== "string" || typeof refs.push !== "string") {
194
+ throw new GitRepositoryError("malformed-output", "remotes");
195
+ }
196
+ remotes.push({
197
+ name: remote.name,
198
+ fetchUrl: refs.fetch,
199
+ pushUrl: refs.push,
200
+ });
201
+ }
202
+ return remotes;
203
+ }
204
+ async branches() {
205
+ const result = await this.#execute("branches", () => this.#git.branch(["-a"]));
206
+ if (!isRecord(result) ||
207
+ !Array.isArray(result.all) ||
208
+ (typeof result.current !== "string" && result.current !== null) ||
209
+ !result.all.every((branch) => typeof branch === "string")) {
210
+ throw new GitRepositoryError("malformed-output", "branches");
211
+ }
212
+ return {
213
+ current: result.current,
214
+ all: [...result.all],
215
+ };
216
+ }
217
+ async fetch(remote, branch) {
218
+ assertValidBranchName(remote, "remote");
219
+ assertValidBranchName(branch, "branch");
220
+ await this.#execute("fetch", () => this.#git.fetch(remote, branch));
221
+ }
222
+ async checkout(args) {
223
+ const validatedArgs = assertValidArguments(args, "checkout");
224
+ await this.#execute("checkout", () => this.#git.checkout(validatedArgs));
225
+ }
226
+ async checkoutLocalBranch(branch) {
227
+ assertValidBranchName(branch, "branch");
228
+ await this.#execute("checkout-local-branch", () => this.#git.checkoutLocalBranch(branch));
229
+ }
230
+ async merge(args) {
231
+ const validatedArgs = assertValidArguments(args, "merge");
232
+ await this.#execute("merge", () => this.#git.merge(validatedArgs));
233
+ }
234
+ async add(pathspecs) {
235
+ const validatedPathspecs = assertValidPathspecs(pathspecs);
236
+ await this.#execute("add", () => this.#git.add(validatedPathspecs));
237
+ }
238
+ async commit(message, pathspecs) {
239
+ if (!isNonEmptyString(message)) {
240
+ throw new GitRepositoryError("invalid-configuration", "commit-message");
241
+ }
242
+ const validatedPathspecs = pathspecs === undefined ? undefined : assertValidPathspecs(pathspecs);
243
+ let result;
244
+ try {
245
+ result =
246
+ validatedPathspecs === undefined
247
+ ? await this.#git.commit(message)
248
+ : await this.#git.commit(message, [...validatedPathspecs]);
249
+ }
250
+ catch (error) {
251
+ if (isNothingToCommit(error))
252
+ return null;
253
+ throw normalizeError("commit", error);
254
+ }
255
+ if (!isRecord(result) ||
256
+ typeof result.branch !== "string" ||
257
+ typeof result.commit !== "string" ||
258
+ typeof result.root !== "boolean") {
259
+ throw new GitRepositoryError("malformed-output", "commit");
260
+ }
261
+ return {
262
+ branch: result.branch,
263
+ commit: result.commit,
264
+ root: result.root,
265
+ };
266
+ }
267
+ async push(remote, branch, options = []) {
268
+ assertValidBranchName(remote, "remote");
269
+ assertValidBranchName(branch, "branch");
270
+ const validatedOptions = assertValidArguments(options, "push");
271
+ await this.#execute("push", () => this.#git.push(remote, branch, validatedOptions));
272
+ }
273
+ async restore(pathspecs) {
274
+ const validatedPathspecs = assertValidPathspecs(pathspecs);
275
+ await this.#execute("restore", () => this.#git.checkout(["--", ...validatedPathspecs]));
276
+ }
277
+ async clean(mode, pathspecs) {
278
+ if (!/^[a-z]+$/u.test(mode)) {
279
+ throw new GitRepositoryError("invalid-configuration", "clean-mode");
280
+ }
281
+ const validatedPathspecs = assertValidPathspecs(pathspecs);
282
+ await this.#execute("clean", () => this.#git.clean(mode, validatedPathspecs));
283
+ }
284
+ async raw(args) {
285
+ const validatedArgs = assertValidArguments(args, "raw");
286
+ const result = await this.#execute("raw", () => this.#git.raw(validatedArgs));
287
+ if (typeof result !== "string") {
288
+ throw new GitRepositoryError("malformed-output", "raw");
289
+ }
290
+ return result;
291
+ }
292
+ }
293
+ export async function prepareIdentityBranch(repository, options) {
294
+ assertValidBranchName(options.identityBranch, "identity-branch");
295
+ assertValidBranchName(options.primaryBranch, "primary-branch");
296
+ assertValidBranchName(options.remote, "remote");
297
+ const currentBranch = await repository.currentBranch();
298
+ if (currentBranch === options.identityBranch)
299
+ return;
300
+ const status = await repository.status();
301
+ if (!status.clean) {
302
+ throw new GitRepositoryError("conflict", "prepare-identity-branch");
303
+ }
304
+ const remotes = await repository.remotes();
305
+ const configuredRemote = remotes.some((remote) => remote.name === options.remote);
306
+ if (configuredRemote) {
307
+ await repository.fetch(options.remote, options.primaryBranch);
308
+ }
309
+ const branches = await repository.branches();
310
+ const hasLocalPrimary = branches.all.includes(options.primaryBranch);
311
+ const remotePrimary = `remotes/${options.remote}/${options.primaryBranch}`;
312
+ const hasRemotePrimary = configuredRemote && branches.all.includes(remotePrimary);
313
+ if (!hasLocalPrimary && !hasRemotePrimary) {
314
+ throw new GitRepositoryError("command-failure", "primary-branch");
315
+ }
316
+ if (hasLocalPrimary) {
317
+ await repository.checkout([options.primaryBranch]);
318
+ }
319
+ else {
320
+ await repository.checkout([
321
+ "-b",
322
+ options.primaryBranch,
323
+ "--track",
324
+ `${options.remote}/${options.primaryBranch}`,
325
+ ]);
326
+ }
327
+ if (configuredRemote) {
328
+ await repository.merge([
329
+ `${options.remote}/${options.primaryBranch}`,
330
+ "--ff-only",
331
+ ]);
332
+ }
333
+ if (branches.all.includes(options.identityBranch)) {
334
+ await repository.checkout([options.identityBranch]);
335
+ return;
336
+ }
337
+ const remoteBranch = `remotes/${options.remote}/${options.identityBranch}`;
338
+ if (branches.all.includes(remoteBranch)) {
339
+ await repository.checkout([
340
+ "-b",
341
+ options.identityBranch,
342
+ "--track",
343
+ `${options.remote}/${options.identityBranch}`,
344
+ ]);
345
+ return;
346
+ }
347
+ await repository.checkoutLocalBranch(options.identityBranch);
348
+ }
349
+ export async function commitPath(repository, pathspec, message) {
350
+ const validatedPathspecs = assertValidPathspecs([pathspec]);
351
+ await repository.add(validatedPathspecs);
352
+ return repository.commit(message, validatedPathspecs);
353
+ }
354
+ export async function discardPath(repository, pathspec) {
355
+ const validatedPathspec = assertValidPathspecs([pathspec])[0];
356
+ await repository.raw(["reset", "HEAD", "--", validatedPathspec]);
357
+ await repository.restore([validatedPathspec]);
358
+ await repository.clean("fd", [validatedPathspec]);
359
+ }
360
+ export async function pushBranch(repository, remote, branch) {
361
+ assertValidBranchName(remote, "remote");
362
+ assertValidBranchName(branch, "branch");
363
+ const hasRemote = (await repository.remotes()).some((configuredRemote) => configuredRemote.name === remote);
364
+ if (!hasRemote)
365
+ return { remoteStatus: "local-only" };
366
+ await repository.push(remote, branch, ["--set-upstream"]);
367
+ return { remoteStatus: "pushed" };
368
+ }
369
+ export function createGitRepository(options) {
370
+ if (!isAbsolute(options.repositoryRoot)) {
371
+ throw new GitRepositoryError("invalid-configuration", "repository-root");
372
+ }
373
+ const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
374
+ const maxConcurrentProcesses = options.maxConcurrentProcesses ?? DEFAULT_MAX_CONCURRENT_PROCESSES;
375
+ const commitIdentity = options.commitIdentity ?? DEFAULT_COMMIT_IDENTITY;
376
+ assertValidPositiveInteger(timeoutMs, "timeout");
377
+ assertValidPositiveInteger(maxConcurrentProcesses, "max-concurrent-processes");
378
+ return new SimpleGitRepository({
379
+ repositoryRoot: options.repositoryRoot,
380
+ timeoutMs,
381
+ maxConcurrentProcesses,
382
+ commitIdentity,
383
+ });
384
+ }
385
+ //# sourceMappingURL=git-repository.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git-repository.js","sourceRoot":"","sources":["../src/git-repository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EACL,SAAS,EACT,gBAAgB,EAChB,iBAAiB,EACjB,QAAQ,GACT,MAAM,qBAAqB,CAAC;AAE7B,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAClC,MAAM,gCAAgC,GAAG,CAAC,CAAC;AAC3C,MAAM,uBAAuB,GAAG;IAC9B,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,mBAAmB;CAC3B,CAAC;AACF,MAAM,0BAA0B,GAAG;IACjC,mBAAmB;IACnB,yBAAyB;CAC1B,CAAC;AA2DF,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAClC,IAAI,CAAyB;IAC7B,SAAS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,CAAC,CAAC;IACxC,qBAAqB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAExC,MAAM,SAAS,GAAG,CAAC,MAAM,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CACjD,CAAC,gBAAgB,EAAE,EAAE,CAAC,gBAAgB,CAAC,IAAI,KAAK,MAAM,CACvD,CAAC;IACF,IAAI,CAAC,SAAS;QAAE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,CAAC;IAEtD,MAAM,UAAU,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAC1D,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,CAAC;AACpC,CAAC;AAED,MAAM,UAAU,mBAAmB,CACjC,OAA6B;IAE7B,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,CAAC;QACxC,MAAM,IAAI,kBAAkB,CAAC,uBAAuB,EAAE,iBAAiB,CAAC,CAAC;IAC3E,CAAC;IAED,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,kBAAkB,CAAC;IAC1D,MAAM,sBAAsB,GAC1B,OAAO,CAAC,sBAAsB,IAAI,gCAAgC,CAAC;IACrE,MAAM,cAAc,GAAG,OAAO,CAAC,cAAc,IAAI,uBAAuB,CAAC;IAEzE,0BAA0B,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;IACjD,0BAA0B,CACxB,sBAAsB,EACtB,0BAA0B,CAC3B,CAAC;IAEF,OAAO,IAAI,mBAAmB,CAAC;QAC7B,cAAc,EAAE,OAAO,CAAC,cAAc;QACtC,SAAS;QACT,sBAAsB;QACtB,cAAc;KACf,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,27 @@
1
+ import { type BonfireIdentity } from "@ebay-dt/bonfire-core";
2
+ import { type GitHubCliProcessRunner } from "./process-runner.js";
3
+ export type GitHubCliErrorReason = "missing" | "unauthenticated" | "unknown";
4
+ export declare class GitHubCliError extends Error {
5
+ readonly reason: GitHubCliErrorReason;
6
+ constructor(message: string, reason?: GitHubCliErrorReason);
7
+ }
8
+ export type GitHubCliWebLogin = {
9
+ code: string | null;
10
+ deviceUrl: string;
11
+ };
12
+ export type GitHubCliClientOptions = {
13
+ hostname: string;
14
+ process?: GitHubCliProcessRunner;
15
+ };
16
+ export interface GitHubCliClientLike {
17
+ getUser(): Promise<BonfireIdentity>;
18
+ startWebLogin(): Promise<GitHubCliWebLogin>;
19
+ }
20
+ export declare class GitHubCliClient implements GitHubCliClientLike {
21
+ #private;
22
+ readonly hostname: string;
23
+ constructor(options: GitHubCliClientOptions);
24
+ getUser(): Promise<BonfireIdentity>;
25
+ startWebLogin(): Promise<GitHubCliWebLogin>;
26
+ }
27
+ //# sourceMappingURL=github-cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"github-cli.d.ts","sourceRoot":"","sources":["../src/github-cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,eAAe,EACrB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAGL,KAAK,sBAAsB,EAC5B,MAAM,qBAAqB,CAAC;AAiB7B,MAAM,MAAM,oBAAoB,GAAG,SAAS,GAAG,iBAAiB,GAAG,SAAS,CAAC;AAE7E,qBAAa,cAAe,SAAQ,KAAK;IACvC,QAAQ,CAAC,MAAM,EAAE,oBAAoB,CAAC;IAEtC,YAAY,OAAO,EAAE,MAAM,EAAE,MAAM,GAAE,oBAAgC,EAIpE;CACF;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,sBAAsB,CAAC;CAClC,CAAC;AAEF,MAAM,WAAW,mBAAmB;IAClC,OAAO,IAAI,OAAO,CAAC,eAAe,CAAC,CAAC;IACpC,aAAa,IAAI,OAAO,CAAC,iBAAiB,CAAC,CAAC;CAC7C;AAoFD,qBAAa,eAAgB,YAAW,mBAAmB;;IACzD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAI1B,YAAY,OAAO,EAAE,sBAAsB,EAG1C;IAEK,OAAO,IAAI,OAAO,CAAC,eAAe,CAAC,CA+BxC;IAEK,aAAa,+BA6GlB;CACF"}
@@ -0,0 +1,203 @@
1
+ import { parseBonfireIdentity, } from "@ebay-dt/bonfire-core";
2
+ import { defaultGitHubCliProcessRunner, } from "./process-runner.js";
3
+ const GH_EXECUTABLE = "gh";
4
+ const IDENTITY_TIMEOUT = 10_000;
5
+ const IDENTITY_MAX_BUFFER = 1024 * 1024;
6
+ const DEVICE_LOGIN_TIMEOUT = 5_000;
7
+ const ACTIVE_LOGIN_WINDOW = 10 * 60 * 1000;
8
+ const GH_LOGIN_CODE_PATTERN = /one-time code \(([A-Z0-9-]+)\)/i;
9
+ export class GitHubCliError extends Error {
10
+ reason;
11
+ constructor(message, reason = "unknown") {
12
+ super(message);
13
+ this.name = "GitHubCliError";
14
+ this.reason = reason;
15
+ }
16
+ }
17
+ function asFailure(error) {
18
+ return error && typeof error === "object" ? error : {};
19
+ }
20
+ function outputFrom(value) {
21
+ return typeof value === "string" ? value : "";
22
+ }
23
+ function projectIdentityFields(value) {
24
+ if (typeof value !== "object" || value === null || Array.isArray(value)) {
25
+ return value;
26
+ }
27
+ const record = value;
28
+ return {
29
+ login: record.login,
30
+ ...(Object.hasOwn(record, "name") ? { name: record.name } : {}),
31
+ avatar_url: record.avatar_url,
32
+ };
33
+ }
34
+ function isUnauthenticatedOutput(output) {
35
+ const normalized = output.toLowerCase();
36
+ return (normalized.includes("gh auth login") ||
37
+ normalized.includes("not logged into") ||
38
+ normalized.includes("authentication required") ||
39
+ normalized.includes("must authenticate") ||
40
+ /\b(?:http(?:\s+status)?\s*)?401\b/.test(normalized));
41
+ }
42
+ function describeFailure(failure) {
43
+ if (failure.code === "ENOENT") {
44
+ return "GitHub CLI (`gh`) is not installed or is not available on PATH.";
45
+ }
46
+ if (failure.code === "ETIMEDOUT" ||
47
+ failure.killed === true ||
48
+ failure.signal === "SIGTERM") {
49
+ return "GitHub CLI command timed out.";
50
+ }
51
+ if (failure.code === "ERR_CHILD_PROCESS_STDIO_MAXBUFFER") {
52
+ return "GitHub CLI output exceeded the allowed limit.";
53
+ }
54
+ return "GitHub CLI command failed.";
55
+ }
56
+ function commandFailure(error, hostname) {
57
+ const failure = asFailure(error);
58
+ const output = `${outputFrom(failure.stdout)}\n${outputFrom(failure.stderr)}`;
59
+ const guidance = ` Run: gh auth login --hostname ${hostname}`;
60
+ if (failure.code === "ENOENT") {
61
+ return new GitHubCliError(`GitHub CLI (\`gh\`) is not installed or is not available on PATH.${guidance}`, "missing");
62
+ }
63
+ if (isUnauthenticatedOutput(output)) {
64
+ return new GitHubCliError(`GitHub CLI is not authenticated for ${hostname}.${guidance}`, "unauthenticated");
65
+ }
66
+ return new GitHubCliError(`${describeFailure(failure)}${guidance}`);
67
+ }
68
+ export class GitHubCliClient {
69
+ hostname;
70
+ #process;
71
+ #activeLogin = null;
72
+ constructor(options) {
73
+ this.hostname = options.hostname;
74
+ this.#process = options.process ?? defaultGitHubCliProcessRunner;
75
+ }
76
+ async getUser() {
77
+ const args = ["api", "--hostname", this.hostname, "user"];
78
+ let result;
79
+ try {
80
+ result = await this.#process.execFile(GH_EXECUTABLE, args, {
81
+ timeout: IDENTITY_TIMEOUT,
82
+ maxBuffer: IDENTITY_MAX_BUFFER,
83
+ });
84
+ }
85
+ catch (error) {
86
+ throw commandFailure(error, this.hostname);
87
+ }
88
+ if (isUnauthenticatedOutput(`${result.stdout}\n${result.stderr}`)) {
89
+ throw commandFailure(result, this.hostname);
90
+ }
91
+ let parsed;
92
+ try {
93
+ parsed = JSON.parse(result.stdout);
94
+ }
95
+ catch {
96
+ throw new GitHubCliError(`GitHub CLI returned malformed user data. Run: gh auth login --hostname ${this.hostname}`);
97
+ }
98
+ try {
99
+ return parseBonfireIdentity(projectIdentityFields(parsed));
100
+ }
101
+ catch {
102
+ throw new GitHubCliError("GitHub CLI returned an invalid user profile.");
103
+ }
104
+ }
105
+ async startWebLogin() {
106
+ const activeLogin = this.#activeLogin;
107
+ if (activeLogin) {
108
+ const withinReuseWindow = Date.now() - activeLogin.startedAt < ACTIVE_LOGIN_WINDOW;
109
+ if (!activeLogin.settled ||
110
+ (activeLogin.code !== null && withinReuseWindow)) {
111
+ return activeLogin.promise;
112
+ }
113
+ try {
114
+ activeLogin.child.kill("SIGTERM");
115
+ }
116
+ catch {
117
+ throw new GitHubCliError("The previous GitHub CLI login could not be terminated.");
118
+ }
119
+ this.#activeLogin = null;
120
+ }
121
+ const spawn = this.#process.spawn;
122
+ if (!spawn) {
123
+ throw new GitHubCliError("GitHub CLI device login is unavailable.");
124
+ }
125
+ let child;
126
+ try {
127
+ child = spawn(GH_EXECUTABLE, [
128
+ "auth",
129
+ "login",
130
+ "--hostname",
131
+ this.hostname,
132
+ "--web",
133
+ "--clipboard",
134
+ "--git-protocol",
135
+ "ssh",
136
+ "--skip-ssh-key",
137
+ ], { stdio: ["ignore", "pipe", "pipe"] });
138
+ }
139
+ catch (error) {
140
+ throw commandFailure(error, this.hostname);
141
+ }
142
+ let resolveLogin;
143
+ let rejectLogin;
144
+ const promise = new Promise((resolve, reject) => {
145
+ resolveLogin = resolve;
146
+ rejectLogin = reject;
147
+ });
148
+ const login = {
149
+ child,
150
+ code: null,
151
+ settled: false,
152
+ startedAt: Date.now(),
153
+ promise,
154
+ };
155
+ this.#activeLogin = login;
156
+ let output = "";
157
+ let settled = false;
158
+ let timer;
159
+ const clearActiveLogin = () => {
160
+ if (this.#activeLogin?.child === child)
161
+ this.#activeLogin = null;
162
+ };
163
+ const settle = (code) => {
164
+ if (settled)
165
+ return;
166
+ settled = true;
167
+ login.code = code;
168
+ login.settled = true;
169
+ clearTimeout(timer);
170
+ resolveLogin({
171
+ code,
172
+ deviceUrl: `https://${this.hostname}/login/device`,
173
+ });
174
+ };
175
+ const fail = (error) => {
176
+ clearActiveLogin();
177
+ if (settled)
178
+ return;
179
+ settled = true;
180
+ clearTimeout(timer);
181
+ rejectLogin(commandFailure(error, this.hostname));
182
+ };
183
+ const inspectOutput = (chunk) => {
184
+ output +=
185
+ typeof chunk === "string" ? chunk : Buffer.from(chunk).toString("utf8");
186
+ const code = output.match(GH_LOGIN_CODE_PATTERN)?.[1] ?? null;
187
+ if (code)
188
+ settle(code);
189
+ };
190
+ timer = setTimeout(() => settle(null), DEVICE_LOGIN_TIMEOUT);
191
+ timer.unref?.();
192
+ child.stdout?.on("data", inspectOutput);
193
+ child.stderr?.on("data", inspectOutput);
194
+ child.once("error", fail);
195
+ child.once("close", () => {
196
+ if (!settled)
197
+ settle(null);
198
+ clearActiveLogin();
199
+ });
200
+ return promise;
201
+ }
202
+ }
203
+ //# sourceMappingURL=github-cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"github-cli.js","sourceRoot":"","sources":["../src/github-cli.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,GAErB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,6BAA6B,GAG9B,MAAM,qBAAqB,CAAC;AAE7B,MAAM,aAAa,GAAG,IAAI,CAAC;AAC3B,MAAM,gBAAgB,GAAG,MAAM,CAAC;AAChC,MAAM,mBAAmB,GAAG,IAAI,GAAG,IAAI,CAAC;AACxC,MAAM,oBAAoB,GAAG,KAAK,CAAC;AACnC,MAAM,mBAAmB,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAC3C,MAAM,qBAAqB,GAAG,iCAAiC,CAAC;AAYhE,MAAM,OAAO,cAAe,SAAQ,KAAK;IAC9B,MAAM,CAAuB;IAEtC,YAAY,OAAe,EAAE,MAAM,GAAyB,SAAS;QACnE,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,gBAA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K,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;YAC1E,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,qBAAqB,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;YAC9D,IAAI,IAAI;gBAAE,MAAM,CAAC,IAAI,CAAC,CAAC;QACzB,CAAC,CAAC;QAEF,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,oBAAoB,CAAC,CAAC;QAC7D,KAAK,CAAC,KAAK,EAAE,EAAE,CAAC;QAChB,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;QACxC,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;QACxC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAC1B,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE;YACvB,IAAI,CAAC,OAAO;gBAAE,MAAM,CAAC,IAAI,CAAC,CAAC;YAC3B,gBAAgB,EAAE,CAAC;QACrB,CAAC,CAAC,CAAC;QAEH,OAAO,OAAO,CAAC;IACjB,CAAC;CACF"}
@@ -0,0 +1,7 @@
1
+ export { GitHubCliClient, GitHubCliError, type GitHubCliClientLike, type GitHubCliClientOptions, type GitHubCliErrorReason, type GitHubCliWebLogin, } from "./github-cli.js";
2
+ export type { GitHubCliChildProcess, GitHubCliExecOptions, GitHubCliExecResult, GitHubCliOutputStream, GitHubCliProcessRunner, GitHubCliSpawnOptions, } from "./process-runner.js";
3
+ export { PrototypeCatalog, type PrototypeCatalogLike, } from "./prototype-catalog.js";
4
+ export type { PrototypeCatalogOptions } from "./prototype-paths.js";
5
+ export type { PreparePrototypeFiles, PreparePrototypeFilesRequest, } from "./prepare-prototype-files.js";
6
+ export { LocalPrototypeLifecycle, type LocalPrototypeLifecycleOptions, type PrototypeLifecycle, } from "./lifecycle/local-prototype-lifecycle.js";
7
+ //# sourceMappingURL=index.d.ts.map