gcb-client 0.7.0 → 0.8.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 (45) hide show
  1. package/CHANGELOG.md +23 -2
  2. package/bin/gcb.js +6 -6
  3. package/lib/commands/gh.d.ts +3 -3
  4. package/lib/commands/gh.d.ts.map +1 -1
  5. package/lib/commands/gh.js +95 -47
  6. package/lib/commands/gh.js.map +1 -1
  7. package/lib/commands/host-submit.d.ts +8 -8
  8. package/lib/commands/host-submit.d.ts.map +1 -1
  9. package/lib/commands/host-submit.js +32 -22
  10. package/lib/commands/host-submit.js.map +1 -1
  11. package/lib/commands/logs.d.ts +2 -2
  12. package/lib/commands/logs.d.ts.map +1 -1
  13. package/lib/commands/logs.js +17 -11
  14. package/lib/commands/logs.js.map +1 -1
  15. package/lib/commands/pr.d.ts +2 -2
  16. package/lib/commands/pr.d.ts.map +1 -1
  17. package/lib/commands/pr.js +186 -69
  18. package/lib/commands/pr.js.map +1 -1
  19. package/lib/commands/probe.d.ts +2 -2
  20. package/lib/commands/probe.d.ts.map +1 -1
  21. package/lib/commands/probe.js +19 -13
  22. package/lib/commands/probe.js.map +1 -1
  23. package/lib/commands/remotes.d.ts +24 -21
  24. package/lib/commands/remotes.d.ts.map +1 -1
  25. package/lib/commands/remotes.js +71 -53
  26. package/lib/commands/remotes.js.map +1 -1
  27. package/lib/commands/repo.d.ts.map +1 -1
  28. package/lib/commands/repo.js +26 -16
  29. package/lib/commands/repo.js.map +1 -1
  30. package/lib/commands/setup.d.ts +7 -7
  31. package/lib/commands/setup.d.ts.map +1 -1
  32. package/lib/commands/setup.js +38 -27
  33. package/lib/commands/setup.js.map +1 -1
  34. package/lib/helper.d.ts +27 -27
  35. package/lib/helper.d.ts.map +1 -1
  36. package/lib/helper.js +82 -66
  37. package/lib/helper.js.map +1 -1
  38. package/lib/index.d.ts.map +1 -1
  39. package/lib/index.js +13 -8
  40. package/lib/index.js.map +1 -1
  41. package/lib/primary.d.ts +5 -5
  42. package/lib/primary.d.ts.map +1 -1
  43. package/lib/primary.js +5 -5
  44. package/lib/primary.js.map +1 -1
  45. package/package.json +10 -10
@@ -1,13 +1,12 @@
1
1
  /**
2
2
  * `probe` — ask the broker what it would do for one repository, without pushing.
3
3
  *
4
- * Exercises the real path (JWT, installation lookup, permission pre-flight, token mint) and
5
- * reports the decision with the credential reduced to a fingerprint, so the output is safe to
6
- * paste anywhere. Exit codes: 0 allowed, 1 denied, 3 broker unreachable.
4
+ * Exercises the real path (JWT, installation lookup, permission pre-flight, token mint) and reports
5
+ * the decision with the credential reduced to a fingerprint, so the output is safe to paste
6
+ * anywhere. Exit codes: 0 allowed, 1 denied, 3 broker unreachable.
7
7
  */
8
- import { tokenFingerprint } from 'gcb-core';
8
+ import { fail, parseArgs, say, tokenFingerprint } from 'gcb-core';
9
9
  import { requestOverSocket, resolveSocketPath } from '../helper.js';
10
- import { fail, parseArgs, say } from 'gcb-core';
11
10
  /** Usage text for `probe`. */
12
11
  export const PROBE_USAGE = `Usage: gcb probe [options]
13
12
 
@@ -24,15 +23,17 @@ Ask the broker for a credential without pushing. Prints a fingerprint, never the
24
23
  /**
25
24
  * Run the `probe` command.
26
25
  *
27
- * @param argv - arguments after the command name.
28
- * @returns the process exit code: 0 allowed, 1 denied, 3 unreachable.
26
+ * @param argv - Arguments after the command name.
27
+ * @returns The process exit code: 0 allowed, 1 denied, 3 unreachable.
29
28
  */
30
29
  export async function runProbe(argv) {
31
30
  const args = parseArgs(argv, { booleans: ['help', 'no-proxy'] });
32
- if (args.has('no-proxy') && args.value('proxy') !== undefined)
31
+ if (args.has('no-proxy') && args.value('proxy') !== undefined) {
33
32
  fail('--proxy and --no-proxy are mutually exclusive');
34
- if (args.has('proxy') && args.value('proxy') === undefined)
33
+ }
34
+ if (args.has('proxy') && args.value('proxy') === undefined) {
35
35
  fail('--proxy needs a value');
36
+ }
36
37
  const proxy = args.has('no-proxy') ? null : args.value('proxy');
37
38
  if (args.has('help') || args.has('h')) {
38
39
  say(PROBE_USAGE);
@@ -40,17 +41,20 @@ export async function runProbe(argv) {
40
41
  }
41
42
  const socketPath = resolveSocketPath(args.value('socket'), process.env);
42
43
  const hostArg = args.value('host');
43
- if (args.has('host') && hostArg === undefined)
44
+ if (args.has('host') && hostArg === undefined) {
44
45
  fail('--host needs a value');
45
- if (hostArg === '')
46
+ }
47
+ if (hostArg === '') {
46
48
  fail('--host needs a value');
49
+ }
47
50
  const host = hostArg ?? 'github.com';
48
51
  const repo = args.value('repo');
49
52
  if (!socketPath) {
50
53
  fail('no broker socket: pass --socket, set GIT_BROKER_SOCKET, or run `gcb setup`');
51
54
  }
52
- if (!repo)
55
+ if (!repo) {
53
56
  fail('--repo is required (e.g. owner/name)');
57
+ }
54
58
  const protocol = args.value('protocol') ?? 'https';
55
59
  let response;
56
60
  try {
@@ -77,7 +81,9 @@ export async function runProbe(argv) {
77
81
  say(`allowed: ${host}/${repo} over ${protocol}`);
78
82
  say(` username : ${response.username ?? '(none)'}`);
79
83
  say(` expires_at : ${response.expires_at ?? '(unknown)'}`);
80
- say(` credential : ${password ? `present, fingerprint ${tokenFingerprint(password)} (value not printed)` : 'MISSING'}`);
84
+ say(` credential : ${password
85
+ ? `present, fingerprint ${tokenFingerprint(password)} (value not printed)`
86
+ : 'MISSING'}`);
81
87
  return 0;
82
88
  }
83
89
  //# sourceMappingURL=probe.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"probe.js","sourceRoot":"","sources":["../../src/commands/probe.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAEhD,8BAA8B;AAC9B,MAAM,CAAC,MAAM,WAAW,GAAG;;;;;;;;;;;CAW1B,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CAAA;QAClE,OAAO,CAAC,CAAA;IACV,CAAC;IAED,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,WAAW,QAAQ,CAAC,IAAI,IAAI,SAAS,MAAM,QAAQ,CAAC,MAAM,IAAI,iBAAiB,IAAI,CACpF,CAAA;QACD,OAAO,CAAC,CAAA;IACV,CAAC;IAED,MAAM,QAAQ,GAAG,QAAQ,CAAC,QAAQ,IAAI,EAAE,CAAA;IACxC,GAAG,CAAC,YAAY,IAAI,IAAI,IAAI,SAAS,QAAQ,EAAE,CAAC,CAAA;IAChD,GAAG,CAAC,qBAAqB,QAAQ,CAAC,QAAQ,IAAI,QAAQ,EAAE,CAAC,CAAA;IACzD,GAAG,CAAC,qBAAqB,QAAQ,CAAC,UAAU,IAAI,WAAW,EAAE,CAAC,CAAA;IAC9D,GAAG,CACD,qBACE,QAAQ;QACN,CAAC,CAAC,wBAAwB,gBAAgB,CAAC,QAAQ,CAAC,sBAAsB;QAC1E,CAAC,CAAC,SACN,EAAE,CACH,CAAA;IACD,OAAO,CAAC,CAAA;AACV,CAAC"}
@@ -8,49 +8,52 @@ export interface RemoteRepo {
8
8
  /**
9
9
  * The remotes this checkout knows, in the order git lists them.
10
10
  *
11
- * @param cwd - the directory to ask.
12
- * @returns the names, possibly empty.
11
+ * @param cwd - The directory to ask.
12
+ * @returns The names, possibly empty.
13
13
  */
14
14
  export declare function listRemotes(cwd: string): string[];
15
15
  /**
16
16
  * What repository a remote points at.
17
17
  *
18
- * HTTPS and SSH spell the same thing differently, and both end in `owner/repo`, optionally with a `.git`.
18
+ * HTTPS and SSH spell the same thing differently, and both end in `owner/repo`, optionally with a
19
+ * `.git`.
19
20
  *
20
- * @param name - the remote name.
21
- * @param cwd - the directory to ask.
22
- * @returns the owner, repository and host, or undefined when there is no such remote or the URL is not one.
21
+ * @param name - The remote name.
22
+ * @param cwd - The directory to ask.
23
+ * @returns The owner, repository and host, or undefined when there is no such remote or the URL is
24
+ * not one.
23
25
  */
24
26
  export declare function remoteRepo(name: string, cwd: string, push?: boolean): RemoteRepo | undefined;
25
27
  /**
26
28
  * The URL a remote points at, for saying what was wrong with it.
27
29
  *
28
- * @param name - the remote name.
29
- * @param cwd - the directory to ask.
30
- * @returns the URL, or undefined when there is no such remote.
30
+ * @param name - The remote name.
31
+ * @param cwd - The directory to ask.
32
+ * @returns The URL, or undefined when there is no such remote.
31
33
  */
32
34
  export declare function remoteUrl(name: string, cwd: string): string | undefined;
33
35
  /**
34
36
  * Turn `remote:branch` into `owner:branch`, and leave a plain branch alone.
35
37
  *
36
- * @param value - what the operator wrote.
37
- * @param cwd - the directory to resolve remotes in.
38
- * @returns the value to send.
39
- * @throws {Error} when the prefix is not a remote this checkout knows, naming the ones it does.
38
+ * @param value - What the operator wrote.
39
+ * @param cwd - The directory to resolve remotes in.
40
+ * @returns The value to send.
41
+ * @throws {Error} When the prefix is not a remote this checkout knows, naming the ones it does.
40
42
  */
41
43
  export declare function qualifiedBranch(value: string, cwd: string): string;
42
44
  /**
43
45
  * The branch a `--base` means, given the repository the pull request lands in.
44
46
  *
45
- * `--base upstream:main` names the remote for the check and the branch for the wire: a base is a branch of
46
- * `--repo`, and `owner:branch` is not a branch name anywhere. A remote pointing at a different repository
47
- * is a mistake worth catching here rather than letting GitHub answer confusingly.
47
+ * `--base upstream:main` names the remote for the check and the branch for the wire: a base is a
48
+ * branch of `--repo`, and `owner:branch` is not a branch name anywhere. A remote pointing at a
49
+ * different repository is a mistake worth catching here rather than letting GitHub answer
50
+ * confusingly.
48
51
  *
49
- * @param raw - what the operator wrote.
50
- * @param repo - the repository `--repo` names, as `owner/name`.
51
- * @param cwd - the directory to resolve remotes in.
52
- * @returns the branch to send.
53
- * @throws {Error} when the remote points at a repository other than `repo`.
52
+ * @param raw - What the operator wrote.
53
+ * @param repo - The repository `--repo` names, as `owner/name`.
54
+ * @param cwd - The directory to resolve remotes in.
55
+ * @returns The branch to send.
56
+ * @throws {Error} When the remote points at a repository other than `repo`.
54
57
  */
55
58
  export declare function baseBranchFor(raw: string, repo: string, cwd: string): string;
56
59
  //# sourceMappingURL=remotes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"remotes.d.ts","sourceRoot":"","sources":["../../src/commands/remotes.ts"],"names":[],"mappings":"AAcA,6FAA6F;AAC7F,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,qFAAqF;IACrF,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAsBD;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAKjD;AAED;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,UAAQ,GAAG,UAAU,GAAG,SAAS,CAmC1F;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEvE;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAoBlE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAe5E"}
1
+ {"version":3,"file":"remotes.d.ts","sourceRoot":"","sources":["../../src/commands/remotes.ts"],"names":[],"mappings":"AAcA,6FAA6F;AAC7F,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,qFAAqF;IACrF,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CACtB;AA2BD;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAKjD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,UAAQ,GAAG,UAAU,GAAG,SAAS,CA4C1F;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEvE;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAwBlE;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAmB5E"}
@@ -1,29 +1,34 @@
1
1
  /**
2
- * Let a branch name say *which* repository it is on, by naming a configured remote.
2
+ * Let a branch name say _which_ repository it is on, by naming a configured remote.
3
3
  *
4
- * `--head feat/x` is a branch in the repository `--repo` names. For a pull request from your fork into an
5
- * upstream, one of the two has to name the other repository, and the honest way to say it is the remote
6
- * name you already push to: `--head origin:feat/x --base upstream:main`. A hand-typed `owner/name` is a
7
- * string that can be wrong in a way that looks right; a remote name is one git already knows, and a typo
8
- * gets you the list of the ones that exist.
4
+ * `--head feat/x` is a branch in the repository `--repo` names. For a pull request from your fork
5
+ * into an upstream, one of the two has to name the other repository, and the honest way to say it
6
+ * is the remote name you already push to: `--head origin:feat/x --base upstream:main`. A hand-typed
7
+ * `owner/name` is a string that can be wrong in a way that looks right; a remote name is one git
8
+ * already knows, and a typo gets you the list of the ones that exist.
9
9
  *
10
- * Resolved here rather than on the host, because this process runs in the checkout: the wire carries the
11
- * answer, so the host side needs no git and no repository.
10
+ * Resolved here rather than on the host, because this process runs in the checkout: the wire
11
+ * carries the answer, so the host side needs no git and no repository.
12
12
  */
13
13
  import { execFileSync } from 'node:child_process';
14
14
  /**
15
15
  * Run a git command in a directory, and answer with everything it said.
16
16
  *
17
- * Everything, not the first line: `git remote get-url` answers with one, and `git remote` with all of
18
- * them, and a helper that quietly dropped the rest would report one remote for a checkout with two.
17
+ * Everything, not the first line: `git remote get-url` answers with one, and `git remote` with all
18
+ * of them, and a helper that quietly dropped the rest would report one remote for a checkout with
19
+ * two.
19
20
  *
20
- * @param args - the arguments, without `git`.
21
- * @param cwd - where to run it.
22
- * @returns the output, or undefined when git refused.
21
+ * @param args - The arguments, without `git`.
22
+ * @param cwd - Where to run it.
23
+ * @returns The output, or undefined when git refused.
23
24
  */
24
25
  function git(args, cwd) {
25
26
  try {
26
- const out = execFileSync('git', [...args], { cwd, encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] });
27
+ const out = execFileSync('git', [...args], {
28
+ cwd,
29
+ encoding: 'utf8',
30
+ stdio: ['ignore', 'pipe', 'ignore'],
31
+ });
27
32
  const trimmed = out.replace(/\s+$/, '');
28
33
  return trimmed === '' ? undefined : trimmed;
29
34
  }
@@ -34,37 +39,47 @@ function git(args, cwd) {
34
39
  /**
35
40
  * The remotes this checkout knows, in the order git lists them.
36
41
  *
37
- * @param cwd - the directory to ask.
38
- * @returns the names, possibly empty.
42
+ * @param cwd - The directory to ask.
43
+ * @returns The names, possibly empty.
39
44
  */
40
45
  export function listRemotes(cwd) {
41
46
  return (git(['remote'], cwd) ?? '')
42
47
  .split('\n')
43
- .map((line) => line.trim())
44
- .filter((line) => line !== '');
48
+ .map(line => line.trim())
49
+ .filter(line => line !== '');
45
50
  }
46
51
  /**
47
52
  * What repository a remote points at.
48
53
  *
49
- * HTTPS and SSH spell the same thing differently, and both end in `owner/repo`, optionally with a `.git`.
54
+ * HTTPS and SSH spell the same thing differently, and both end in `owner/repo`, optionally with a
55
+ * `.git`.
50
56
  *
51
- * @param name - the remote name.
52
- * @param cwd - the directory to ask.
53
- * @returns the owner, repository and host, or undefined when there is no such remote or the URL is not one.
57
+ * @param name - The remote name.
58
+ * @param cwd - The directory to ask.
59
+ * @returns The owner, repository and host, or undefined when there is no such remote or the URL is
60
+ * not one.
54
61
  */
55
62
  export function remoteRepo(name, cwd, push = false) {
56
63
  // `--push` for a head: git lets a remote fetch from one place and push to another, and the branch a
57
64
  // pull request comes from lives where it was pushed. The base asks the other question.
58
65
  const url = git(['remote', 'get-url', ...(push ? ['--push'] : []), name], cwd);
59
- if (url === undefined)
66
+ if (url === undefined) {
60
67
  return undefined;
68
+ }
61
69
  // A URL has an authority and then a path; the scp form has a host and then one. Anything else — a local
62
70
  // path, a `file:` URL, a host with no dot — is refused rather than read as an owner that happens to be a
63
71
  // port number or a directory name.
64
72
  let path;
65
73
  let host;
66
74
  const scheme = /^([a-z+]+):\/\//i.exec(url)?.[1]?.toLowerCase();
67
- if (scheme !== undefined) {
75
+ if (scheme === undefined) {
76
+ const scp = /^(?:[^@/]+@)?([^/:]+\.[^/:]+):(.+)$/.exec(url);
77
+ if (scp !== null && scp[1] !== undefined && scp[2] !== undefined) {
78
+ host = scp[1];
79
+ path = scp[2];
80
+ }
81
+ }
82
+ else {
68
83
  const rest = url.replace(/^[a-z+]+:\/\//i, '').replace(/^[^@/]*@/, '');
69
84
  const slash = rest.indexOf('/');
70
85
  const authority = slash < 0 ? '' : rest.slice(0, slash);
@@ -75,27 +90,25 @@ export function remoteRepo(name, cwd, push = false) {
75
90
  path = rest.slice(slash + 1);
76
91
  }
77
92
  }
78
- else {
79
- const scp = /^(?:[^@/]+@)?([^/:]+\.[^/:]+):(.+)$/.exec(url);
80
- if (scp !== null && scp[1] !== undefined && scp[2] !== undefined) {
81
- host = scp[1];
82
- path = scp[2];
83
- }
84
- }
85
- if (path === undefined || host === undefined)
93
+ if (path === undefined || host === undefined) {
86
94
  return undefined;
87
- const cleaned = path.replace(/^\/+/, '').replace(/\/+$/, '').replace(/\.git$/i, '');
88
- const [owner, repo, ...rest] = cleaned.split('/').filter((part) => part !== '');
89
- if (owner === undefined || repo === undefined || rest.length > 0)
95
+ }
96
+ const cleaned = path
97
+ .replace(/^\/+/, '')
98
+ .replace(/\/+$/, '')
99
+ .replace(/\.git$/i, '');
100
+ const [owner, repo, ...rest] = cleaned.split('/').filter(part => part !== '');
101
+ if (owner === undefined || repo === undefined || rest.length > 0) {
90
102
  return undefined;
103
+ }
91
104
  return { owner, repo, host: host.toLowerCase() };
92
105
  }
93
106
  /**
94
107
  * The URL a remote points at, for saying what was wrong with it.
95
108
  *
96
- * @param name - the remote name.
97
- * @param cwd - the directory to ask.
98
- * @returns the URL, or undefined when there is no such remote.
109
+ * @param name - The remote name.
110
+ * @param cwd - The directory to ask.
111
+ * @returns The URL, or undefined when there is no such remote.
99
112
  */
100
113
  export function remoteUrl(name, cwd) {
101
114
  return git(['remote', 'get-url', name], cwd);
@@ -103,15 +116,16 @@ export function remoteUrl(name, cwd) {
103
116
  /**
104
117
  * Turn `remote:branch` into `owner:branch`, and leave a plain branch alone.
105
118
  *
106
- * @param value - what the operator wrote.
107
- * @param cwd - the directory to resolve remotes in.
108
- * @returns the value to send.
109
- * @throws {Error} when the prefix is not a remote this checkout knows, naming the ones it does.
119
+ * @param value - What the operator wrote.
120
+ * @param cwd - The directory to resolve remotes in.
121
+ * @returns The value to send.
122
+ * @throws {Error} When the prefix is not a remote this checkout knows, naming the ones it does.
110
123
  */
111
124
  export function qualifiedBranch(value, cwd) {
112
125
  const colon = value.indexOf(':');
113
- if (colon < 0)
126
+ if (colon < 0) {
114
127
  return value;
128
+ }
115
129
  const name = value.slice(0, colon);
116
130
  const branch = value.slice(colon + 1);
117
131
  const found = remoteRepo(name, cwd, true);
@@ -122,27 +136,31 @@ export function qualifiedBranch(value, cwd) {
122
136
  throw new Error(`remote ${JSON.stringify(name)} points at ${url}, which does not name an owner and a repository`);
123
137
  }
124
138
  throw new Error(`no remote named ${JSON.stringify(name)} here, so ${JSON.stringify(value)} cannot be resolved` +
125
- (known.length > 0 ? `; this checkout has: ${known.join(', ')}` : '; this checkout has no remotes'));
139
+ (known.length > 0
140
+ ? `; this checkout has: ${known.join(', ')}`
141
+ : '; this checkout has no remotes'));
126
142
  }
127
143
  return `${found.owner}:${branch}`;
128
144
  }
129
145
  /**
130
146
  * The branch a `--base` means, given the repository the pull request lands in.
131
147
  *
132
- * `--base upstream:main` names the remote for the check and the branch for the wire: a base is a branch of
133
- * `--repo`, and `owner:branch` is not a branch name anywhere. A remote pointing at a different repository
134
- * is a mistake worth catching here rather than letting GitHub answer confusingly.
148
+ * `--base upstream:main` names the remote for the check and the branch for the wire: a base is a
149
+ * branch of `--repo`, and `owner:branch` is not a branch name anywhere. A remote pointing at a
150
+ * different repository is a mistake worth catching here rather than letting GitHub answer
151
+ * confusingly.
135
152
  *
136
- * @param raw - what the operator wrote.
137
- * @param repo - the repository `--repo` names, as `owner/name`.
138
- * @param cwd - the directory to resolve remotes in.
139
- * @returns the branch to send.
140
- * @throws {Error} when the remote points at a repository other than `repo`.
153
+ * @param raw - What the operator wrote.
154
+ * @param repo - The repository `--repo` names, as `owner/name`.
155
+ * @param cwd - The directory to resolve remotes in.
156
+ * @returns The branch to send.
157
+ * @throws {Error} When the remote points at a repository other than `repo`.
141
158
  */
142
159
  export function baseBranchFor(raw, repo, cwd) {
143
160
  const colon = raw.indexOf(':');
144
- if (colon < 0)
161
+ if (colon < 0) {
145
162
  return raw;
163
+ }
146
164
  const name = raw.slice(0, colon);
147
165
  const found = remoteRepo(name, cwd);
148
166
  if (found === undefined) {
@@ -1 +1 @@
1
- {"version":3,"file":"remotes.js","sourceRoot":"","sources":["../../src/commands/remotes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAUlD;;;;;;;;;GASG;AACH,SAAS,GAAG,CAAC,IAAuB,EAAE,GAAW;IAC/C,IAAI,CAAC;QACH,MAAM,GAAG,GA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ED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,aAAa,CAAC,GAAW,EAAE,IAAY,EAAE,GAAW;IAClE,MAAM,KAAK,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;IAC9B,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;QACd,OAAO,GAAG,CAAA;IACZ,CAAC;IACD,MAAM,IAAI,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAA;IAChC,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;IACnC,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,qFAAqF;QACrF,MAAM,IAAI,KAAK,CACb,gBAAgB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,gDAAgD,CACrF,CAAA;IACH,CAAC;IACD,IAAI,GAAG,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,KAAK,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;QACxE,MAAM,IAAI,KAAK,CACb,qCAAqC,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,IAAI,mBAAmB,IAAI,oEAAoE,CAC1J,CAAA;IACH,CAAC;IACD,OAAO,GAAG,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAA;AAC7B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"repo.d.ts","sourceRoot":"","sources":["../../src/commands/repo.ts"],"names":[],"mappings":"AAiBA,eAAO,MAAM,UAAU,8qBAYtB,CAAC;AAEF,wBAAsB,OAAO,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAwFtE"}
1
+ {"version":3,"file":"repo.d.ts","sourceRoot":"","sources":["../../src/commands/repo.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,UAAU,8qBAYtB,CAAA;AAED,wBAAsB,OAAO,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAmHtE"}
@@ -7,11 +7,9 @@
7
7
  */
8
8
  import { LOGIN, REPOSITORY, fail, parseArgs, say } from 'gcb-core';
9
9
  import { requestOverSocket, resolveSocketPath } from '../helper.js';
10
- import { remoteRepo } from './remotes.js';
11
10
  import { submitToHostBroker } from './host-submit.js';
12
- const KNOWN_FLAGS = new Set([
13
- 'help', 'h', 'as-user', 'proxy', 'no-proxy', 'socket', 'host',
14
- ]);
11
+ import { remoteRepo } from './remotes.js';
12
+ const KNOWN_FLAGS = new Set(['help', 'h', 'as-user', 'proxy', 'no-proxy', 'socket', 'host']);
15
13
  export const REPO_USAGE = `Usage: gcb repo fork [owner/name] [options]
16
14
 
17
15
  Create a fork under a person's account. The app identity cannot own a fork, so --as-user is
@@ -31,20 +29,25 @@ export async function runRepo(argv) {
31
29
  say(REPO_USAGE);
32
30
  return 0;
33
31
  }
34
- if (args.positionals[0] !== 'fork')
32
+ if (args.positionals[0] !== 'fork') {
35
33
  fail('usage: gcb repo fork [owner/name]');
36
- if (args.positionals.length > 2)
34
+ }
35
+ if (args.positionals.length > 2) {
37
36
  fail('unexpected argument ' + JSON.stringify(args.positionals[2]));
37
+ }
38
38
  for (const name of args.names) {
39
- if (!KNOWN_FLAGS.has(name))
39
+ if (!KNOWN_FLAGS.has(name)) {
40
40
  fail('unknown option --' + name + ' for gcb repo fork');
41
+ }
41
42
  }
42
43
  const accounts = args.values('as-user');
43
44
  const asUser = args.has('as-user');
44
- if (accounts.length > 1)
45
+ if (accounts.length > 1) {
45
46
  fail('--as-user may only be given once');
46
- if (asUser && accounts.length > 0)
47
+ }
48
+ if (asUser && accounts.length > 0) {
47
49
  fail('--as-user cannot be both bare and given a login');
50
+ }
48
51
  // `--as-user acme/widget` is an unambiguous source repository, not an account: a login cannot
49
52
  // contain a slash. It saves making the positional depend on whether a bare flag was used.
50
53
  let account = accounts[0];
@@ -60,25 +63,31 @@ export async function runRepo(argv) {
60
63
  fail('--as-user is required for fork: the app identity cannot own a fork');
61
64
  }
62
65
  const proxyValues = args.values('proxy');
63
- if (args.has('proxy') && proxyValues.length === 0)
66
+ if (args.has('proxy') && proxyValues.length === 0) {
64
67
  fail('--proxy needs a value');
68
+ }
65
69
  if (args.has('no-proxy') && (args.has('proxy') || proxyValues.length > 0)) {
66
70
  fail('--proxy and --no-proxy are mutually exclusive');
67
71
  }
68
72
  const proxy = args.has('no-proxy') ? null : args.value('proxy');
69
73
  const origin = remoteRepo('origin', process.cwd());
70
- const source = sourceFromAsUser ?? args.positionals[1] ?? (origin === undefined ? undefined : `${origin.owner}/${origin.repo}`);
71
- if (source === undefined)
74
+ const source = sourceFromAsUser ??
75
+ args.positionals[1] ??
76
+ (origin === undefined ? undefined : `${origin.owner}/${origin.repo}`);
77
+ if (source === undefined) {
72
78
  fail('pass owner/name, or run this from a checkout with an origin remote');
73
- if (!REPOSITORY.test(source))
79
+ }
80
+ if (!REPOSITORY.test(source)) {
74
81
  fail(`not a repository: ${JSON.stringify(source)}`);
82
+ }
75
83
  const hostValue = args.value('host');
76
- if ((args.has('host') || args.values('host').length > 0) && (hostValue === undefined || hostValue.trim() === '')) {
84
+ if ((args.has('host') || args.values('host').length > 0) &&
85
+ (hostValue === undefined || hostValue.trim() === '')) {
77
86
  fail('--host needs a value');
78
87
  }
79
88
  const host = hostValue ?? origin?.host ?? 'github.com';
80
89
  if (account !== undefined) {
81
- return submitToHostBroker({ kind: 'fork', repo: source, host, account, proxy, session: 'repo', pid: process.pid }, (answer) => `forked ${source} as ${account}: ${answer.url ?? '(no url)'}`);
90
+ return submitToHostBroker({ kind: 'fork', repo: source, host, account, proxy, session: 'repo', pid: process.pid }, answer => `forked ${source} as ${account}: ${answer.url ?? '(no url)'}`);
82
91
  }
83
92
  const socketPath = resolveSocketPath(args.value('socket'), process.env);
84
93
  if (socketPath === undefined) {
@@ -106,8 +115,9 @@ export async function runRepo(argv) {
106
115
  process.stderr.write(`refused [${response.code ?? 'unknown'}]: ${response.reason ?? 'no reason given'}\n`);
107
116
  return 1;
108
117
  }
109
- if (response.prUrl === undefined)
118
+ if (response.prUrl === undefined) {
110
119
  fail('the broker did not answer with a fork URL');
120
+ }
111
121
  say(`forked ${source}: ${response.prUrl}`);
112
122
  return 0;
113
123
  }
@@ -1 +1 @@
1
- {"version":3,"file":"repo.js","sourceRoot":"","sources":["../../src/commands/repo.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAEnE,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEtD,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC;IAC1B,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM;CAC9D,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,UAAU,GAAG;;;;;;;;;;;;CAYzB,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,IAAuB;IACnD,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,EAAE,EAAE,QAAQ,EAAE,CAAC,MAAM,EAAE,UAAU,CAAC,EAAE,CAAC,CAAC;IACjE,IAAI,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;QACtC,GAAG,CAAC,UAAU,CAAC,CAAC;QAChB,OAAO,CAAC,CAAC;IACX,CAAC;IACD,IAAI,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,MAAM;QAAE,IAAI,CAAC,mCAAmC,CAAC,CAAC;IAC9E,IAAI,IAAI,CAAC,W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UAAU,EACV;YACE,CAAC,EAAE,CAAC;YACJ,EAAE,EAAE,cAAc;YAClB,IAAI;YACJ,IAAI,EAAE,MAAM;YACZ,MAAM,EAAE,MAAM;YACd,QAAQ,EAAE,MAAM;YAChB,OAAO,EAAE,MAAM;YACf,GAAG,EAAE,OAAO,CAAC,GAAG;YAChB,KAAK;SACN,EACD,MAAM,CACP,CAAA;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,gBAAiB,KAAe,CAAC,OAAO,IAAI,CAAC,CAAA;QAClE,OAAO,CAAC,CAAA;IACV,CAAC;IACD,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,YAAY,QAAQ,CAAC,IAAI,IAAI,SAAS,MAAM,QAAQ,CAAC,MAAM,IAAI,iBAAiB,IAAI,CACrF,CAAA;QACD,OAAO,CAAC,CAAA;IACV,CAAC;IACD,IAAI,QAAQ,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;QACjC,IAAI,CAAC,2CAA2C,CAAC,CAAA;IACnD,CAAC;IACD,GAAG,CAAC,UAAU,MAAM,KAAK,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAA;IAC1C,OAAO,CAAC,CAAA;AACV,CAAC"}
@@ -34,9 +34,9 @@ export interface SetupResult {
34
34
  /**
35
35
  * Apply the configuration.
36
36
  *
37
- * @param input - the resolved options.
38
- * @returns what was done.
39
- * @throws {Error} when the target config is a symlink, or inside a directory the container shares.
37
+ * @param input - The resolved options.
38
+ * @returns What was done.
39
+ * @throws {Error} When the target config is a symlink, or inside a directory the container shares.
40
40
  */
41
41
  export declare function performSetup(input: SetupInput): Promise<SetupResult>;
42
42
  /** Usage text for `setup`. */
@@ -44,15 +44,15 @@ export declare const SETUP_USAGE = "Usage: gcb setup [options]\n\nConfigure this
44
44
  /**
45
45
  * Run the `setup` command.
46
46
  *
47
- * @param argv - arguments after the command name.
48
- * @returns the process exit code.
47
+ * @param argv - Arguments after the command name.
48
+ * @returns The process exit code.
49
49
  */
50
50
  export declare function runSetup(argv: readonly string[]): Promise<number>;
51
51
  /**
52
52
  * Collect the repeatable `--allow` flag; exported so `init` and tests share one implementation.
53
53
  *
54
- * @param args - the parsed arguments.
55
- * @returns the entries.
54
+ * @param args - The parsed arguments.
55
+ * @returns The entries.
56
56
  */
57
57
  export declare function allowList(args: ReturnType<typeof parseArgs>): string[];
58
58
  //# sourceMappingURL=setup.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../src/commands/setup.ts"],"names":[],"mappings":"AAqBA,OAAO,EAQL,SAAS,EAKV,MAAM,UAAU,CAAC;AAElB,0CAA0C;AAC1C,MAAM,WAAW,UAAU;IACzB,wFAAwF;IACxF,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,uCAAuC;IACvC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,gCAAgC;IAChC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,sEAAsE;IACtE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,yFAAyF;IACzF,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,0DAA0D;IAC1D,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,qFAAqF;IACrF,QAAQ,CAAC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IACvC,yDAAyD;IACzD,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,wFAAwF;IACxF,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,8EAA8E;IAC9E,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACrC;AAED,wBAAwB;AACxB,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ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