gcb-client 0.0.0-stage → 0.0.1

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 ADDED
@@ -0,0 +1,9 @@
1
+ # gcb-client
2
+
3
+ ## 0.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#33](https://github.com/code-vaults/git-credential-broker/pull/33) [`4bab834`](https://github.com/code-vaults/git-credential-broker/commit/4bab834c781e6175b6b6e588ad542fa09d532be7) Thanks [@JounQin](https://github.com/JounQin)! - Prepare the first public release of the renamed packages.
8
+ - Updated dependencies [[`4bab834`](https://github.com/code-vaults/git-credential-broker/commit/4bab834c781e6175b6b6e588ad542fa09d532be7)]:
9
+ - gcb-core@0.0.1
package/bin/gcb.js ADDED
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env node
2
+ import { runCli } from 'gcb-core';
3
+ import { clientBackend, runHelper } from 'gcb-client';
4
+
5
+ const argv = process.argv.slice(2);
6
+ const operation = argv[0];
7
+
8
+ if (operation === 'get' || operation === 'store' || operation === 'erase') {
9
+ process.exitCode = await runHelper(argv);
10
+ } else {
11
+ process.exitCode = await runCli(argv, clientBackend);
12
+ }
@@ -0,0 +1,13 @@
1
+ /** Usage text for `gh`. */
2
+ export declare const GH_USAGE: string;
3
+ /**
4
+ * Run the `gh` command.
5
+ *
6
+ * @param argv - arguments after `gh`.
7
+ * @returns the process exit code: 0 success, 1 refusal, and the requested unreachable code
8
+ * (1 by default; `pr` passes 3 for runPr's contract).
9
+ */
10
+ export declare function runGh(argv: readonly string[], options?: {
11
+ readonly unreachableExitCode?: number;
12
+ }): Promise<number>;
13
+ //# sourceMappingURL=gh.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gh.d.ts","sourceRoot":"","sources":["../../src/commands/gh.ts"],"names":[],"mappings":"AA8CA,2BAA2B;AAC3B,eAAO,MAAM,QAAQ,QAcL,CAAC;AAEjB;;;;;;GAMG;AACH,wBAAsB,KAAK,CACzB,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,OAAO,GAAE;IAAE,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAA;CAAO,GACtD,OAAO,CAAC,MAAM,CAAC,CA6LjB"}
@@ -0,0 +1,261 @@
1
+ /**
2
+ * `gh` — run one catalogued GitHub action through the broker.
3
+ *
4
+ * The action catalog defines the command, flags, positionals and permissions. The client only
5
+ * parses names and values; the broker rebuilds the canonical argv and runs gh with its own token.
6
+ */
7
+ import { GH_ACTIONS, getGhAction, parseArgs, say, fail } from 'gcb-core';
8
+ import { requestOverSocket, resolveSocketPath } from '../helper.js';
9
+ import { remoteRepo } from './remotes.js';
10
+ const ACTION_LINES = Object.values(GH_ACTIONS)
11
+ .map((action) => {
12
+ const positionals = action.positionals
13
+ .map((positional) => (positional.required === true ? `<${positional.name}>` : `[${positional.name}]`))
14
+ .join(' ');
15
+ const flags = action.flags
16
+ .map((flag) => {
17
+ const spelling = `--${flag.name}${flag.type === 'boolean' ? '' : ` <${flag.type}>`}`;
18
+ return flag.required === true ? spelling : `[${spelling}]`;
19
+ })
20
+ .join(' ');
21
+ const modes = action.exactlyOneOf === undefined
22
+ ? ''
23
+ : ` (one of ${action.exactlyOneOf.map((flag) => `--${flag}`).join(', ')})`;
24
+ const body = action.bodyRequiredWith === undefined
25
+ ? ''
26
+ : ` (--body required with ${action.bodyRequiredWith.map((flag) => `--${flag}`).join(', ')})`;
27
+ return ` ${action.command.join(' ')}${positionals ? ` ${positionals}` : ''}${flags ? ` ${flags}` : ''}${modes}${body}`;
28
+ })
29
+ .join('\n');
30
+ /**
31
+ * Read owner/repo from the checkout's `origin` remote.
32
+ *
33
+ * The URL parsing lives in `remotes.ts`, beside `--head origin:branch`, so the two cannot disagree
34
+ * about what a remote points at.
35
+ *
36
+ * @param cwd - the checkout to ask.
37
+ * @returns the normalized repository, or undefined when no remote names one.
38
+ */
39
+ function repoFromCheckout(cwd) {
40
+ const found = remoteRepo('origin', cwd);
41
+ return found === undefined ? undefined : { repo: `${found.owner}/${found.repo}`, host: found.host };
42
+ }
43
+ /** Usage text for `gh`. */
44
+ export const GH_USAGE = `Usage: gcb gh <domain> <command> [options]
45
+
46
+ Run a catalogued GitHub action through the broker.
47
+ gcb pr <subcommand> and gcb run <subcommand> are shorthands for the same actions.
48
+
49
+ Common
50
+ -R, --repo <owner/name> Repository the action belongs to (default: origin remote)
51
+ --host <host> Host as configured, e.g. github.com (default: github.com)
52
+ --socket <path> Broker socket (default: GIT_BROKER_SOCKET)
53
+ --proxy <url> Use this proxy for this action
54
+ --no-proxy Reach GitHub directly for this action
55
+ -h, --help Show this help
56
+
57
+ Commands, from the action catalog
58
+ ${ACTION_LINES}`;
59
+ /**
60
+ * Run the `gh` command.
61
+ *
62
+ * @param argv - arguments after `gh`.
63
+ * @returns the process exit code: 0 success, 1 refusal, and the requested unreachable code
64
+ * (1 by default; `pr` passes 3 for runPr's contract).
65
+ */
66
+ export async function runGh(argv, options = {}) {
67
+ if (argv.length === 0) {
68
+ say(GH_USAGE);
69
+ return 1;
70
+ }
71
+ const [domain, command, ...rawRest] = argv;
72
+ if (domain === '--help' || domain === '-h' || command === '--help' || command === '-h') {
73
+ say(GH_USAGE);
74
+ return 0;
75
+ }
76
+ if (domain === undefined || command === undefined) {
77
+ // A caller with a domain and no command (`gcb run`, `gcb gh pr`) gets the catalog rather than one
78
+ // example: the answer is every action, and the example would only be right for one of them.
79
+ say(GH_USAGE);
80
+ return 1;
81
+ }
82
+ const actionName = `${domain}:${command}`;
83
+ let action;
84
+ try {
85
+ action = getGhAction(actionName);
86
+ }
87
+ catch {
88
+ if (rawRest.includes('--help') || rawRest.includes('-h')) {
89
+ say(GH_USAGE);
90
+ return 0;
91
+ }
92
+ fail(`unknown gh action ${JSON.stringify(actionName)}`);
93
+ }
94
+ // A known value-taking flag consumes the next token only when that token is a value. A following
95
+ // known flag is not taken as a value (so a missing value fails as missing), except a literal
96
+ // --help/-h: a body that is exactly one of those is data, not a help request. The parser then
97
+ // sees --body=--help.
98
+ const valueFlags = new Set([
99
+ ...action.flags.filter((flag) => flag.type !== 'boolean').map((flag) => flag.name),
100
+ 'repo',
101
+ 'R',
102
+ 'host',
103
+ 'socket',
104
+ 'proxy',
105
+ ]);
106
+ const allowed = new Set([
107
+ ...action.flags.map((flag) => flag.name),
108
+ 'repo',
109
+ 'R',
110
+ 'host',
111
+ 'socket',
112
+ 'proxy',
113
+ 'no-proxy',
114
+ ]);
115
+ const knownFlags = new Set([...allowed, 'help']);
116
+ const rest = [];
117
+ let missingValue;
118
+ let help = false;
119
+ for (let index = 0; index < rawRest.length; index += 1) {
120
+ const raw = rawRest[index];
121
+ // Match parseArgs: -h is help everywhere; any other single-dash letter is its long flag. A
122
+ // single-dash operand belongs to a preceding value flag and was consumed before this point.
123
+ const argument = raw?.replace(/^-h$/, '--help').replace(/^-(?=[A-Za-z])/, '--');
124
+ if (argument === undefined)
125
+ continue;
126
+ if (argument === '--') {
127
+ rest.push(...rawRest.slice(index));
128
+ break;
129
+ }
130
+ if (argument === '--help') {
131
+ help = true;
132
+ rest.push(argument);
133
+ continue;
134
+ }
135
+ const name = argument.startsWith('--') && !argument.includes('=') ? argument.slice(2) : undefined;
136
+ if (name === undefined || !valueFlags.has(name)) {
137
+ rest.push(argument);
138
+ continue;
139
+ }
140
+ const next = rawRest[index + 1];
141
+ if (next === undefined) {
142
+ missingValue ??= `${raw} needs a value`;
143
+ rest.push(argument);
144
+ continue;
145
+ }
146
+ if (next === '--help' || next === '-h') {
147
+ if (name === 'body') {
148
+ rest.push(`${argument}=${next}`);
149
+ index += 1;
150
+ }
151
+ else {
152
+ help = true;
153
+ rest.push(argument);
154
+ }
155
+ continue;
156
+ }
157
+ if (next.startsWith('--')) {
158
+ const nextName = next.slice(2).split('=')[0];
159
+ if (nextName !== undefined && knownFlags.has(nextName)) {
160
+ missingValue ??= `${raw} needs a value`;
161
+ }
162
+ // Leave both tokens alone: a known flag is a missing value, an unknown one must reach the
163
+ // unknown-option check rather than becoming a value.
164
+ rest.push(argument);
165
+ continue;
166
+ }
167
+ rest.push(`${argument}=${next}`);
168
+ index += 1;
169
+ }
170
+ if (help) {
171
+ say(GH_USAGE);
172
+ return 0;
173
+ }
174
+ if (missingValue !== undefined)
175
+ fail(missingValue);
176
+ const booleans = action.flags.filter((flag) => flag.type === 'boolean').map((flag) => flag.name);
177
+ const args = parseArgs(rest, { booleans: [...booleans, 'no-proxy'] });
178
+ if (args.has('no-proxy') && args.value('proxy') !== undefined)
179
+ fail('--proxy and --no-proxy are mutually exclusive');
180
+ const proxy = args.has('no-proxy') ? null : args.value('proxy');
181
+ const host = args.value('host') ?? 'github.com';
182
+ let repo = args.value('repo') ?? args.value('R');
183
+ if (repo === undefined) {
184
+ const found = repoFromCheckout(process.cwd());
185
+ if (found === undefined)
186
+ fail('--repo is required when the checkout has no usable origin remote');
187
+ if (found.host !== host.toLowerCase()) {
188
+ fail(`the checkout's remote is on ${found.host}, but --host is ${host}; pass --repo or --host`);
189
+ }
190
+ repo = found.repo;
191
+ }
192
+ const socketPath = resolveSocketPath(args.value('socket'), process.env);
193
+ if (socketPath === undefined)
194
+ fail('no broker socket is configured');
195
+ for (const argument of rest) {
196
+ if (argument === '--')
197
+ break;
198
+ const match = /^--([^=]+)/.exec(argument);
199
+ if (match?.[1] !== undefined && !allowed.has(match[1])) {
200
+ fail(`unknown option --${match[1]} for gcb gh ${domain} ${command}`);
201
+ }
202
+ }
203
+ const values = {};
204
+ for (const [index, positional] of action.positionals.entries()) {
205
+ const value = args.positionals[index];
206
+ if (value === undefined) {
207
+ if (positional.required === true)
208
+ fail(`gcb gh ${domain} ${command} needs ${positional.name}`);
209
+ continue;
210
+ }
211
+ values[positional.name] = value;
212
+ }
213
+ if (args.positionals.length > action.positionals.length) {
214
+ fail(`gcb gh ${domain} ${command} has too many positional arguments`);
215
+ }
216
+ for (const flag of action.flags) {
217
+ if (flag.type === 'boolean') {
218
+ if (args.has(flag.name))
219
+ values[flag.name] = true;
220
+ continue;
221
+ }
222
+ const entries = args.values(flag.name);
223
+ if (entries.length === 0) {
224
+ if (flag.required === true)
225
+ fail(`gcb gh ${domain} ${command} needs --${flag.name}`);
226
+ continue;
227
+ }
228
+ if (flag.repeatable === true)
229
+ values[flag.name] = entries;
230
+ else
231
+ values[flag.name] = entries[0];
232
+ }
233
+ let response;
234
+ try {
235
+ response = await requestOverSocket(socketPath, { op: 'action', host, path: repo, ghAction: actionName, values: values, proxy, session: 'gh', pid: process.pid }, action.timeoutSeconds * 1000 + 30_000);
236
+ }
237
+ catch (error) {
238
+ process.stderr.write(`unreachable: ${error.message}\n`);
239
+ return options.unreachableExitCode ?? 1;
240
+ }
241
+ if (response.ok !== true) {
242
+ if (response.warning)
243
+ process.stderr.write(`warning: ${response.warning}\n`);
244
+ fail(`refused [${response.code ?? 'unknown'}]: ${response.reason ?? 'no reason'}`);
245
+ }
246
+ if (response.stdout)
247
+ process.stdout.write(response.stdout);
248
+ if (response.stderr)
249
+ process.stderr.write(response.stderr);
250
+ if (response.warning)
251
+ process.stderr.write(`warning: ${response.warning}\n`);
252
+ if (response.truncated === true) {
253
+ process.stderr.write('warning: the action output was truncated at the broker\x27s limit\n');
254
+ }
255
+ if (response.timedOut === true) {
256
+ process.stderr.write(`warning: the action timed out after ${action.timeoutSeconds}s; a write may have completed before it was killed\n`);
257
+ return 1;
258
+ }
259
+ return response.exitCode === 0 ? 0 : 1;
260
+ }
261
+ //# sourceMappingURL=gh.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gh.js","sourceRoot":"","sources":["../../src/commands/gh.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,GAAG,EAAE,IAAI,EAAqB,MAAM,UAAU,CAAC;AAE5F,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,C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AAC;IACD,IAAI,QAAQ,CAAC,EAAE,KAAK,IAAI,EAAE,CAAC;QACzB,IAAI,QAAQ,CAAC,OAAO;YAAE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,YAAY,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;QAC7E,IAAI,CAAC,YAAY,QAAQ,CAAC,IAAI,IAAI,SAAS,MAAM,QAAQ,CAAC,MAAM,IAAI,WAAW,EAAE,CAAC,CAAC;IACrF,CAAC;IACD,IAAI,QAAQ,CAAC,MAAM;QAAE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC3D,IAAI,QAAQ,CAAC,MAAM;QAAE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC3D,IAAI,QAAQ,CAAC,OAAO;QAAE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,YAAY,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;IAC7E,IAAI,QAAQ,CAAC,SAAS,KAAK,IAAI,EAAE,CAAC;QAChC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,qEAAqE,CAAC,CAAC;IAC9F,CAAC;IACD,IAAI,QAAQ,CAAC,QAAQ,KAAK,IAAI,EAAE,CAAC;QAC/B,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,uCAAuC,MAAM,CAAC,cAAc,sDAAsD,CACnH,CAAC;QACF,OAAO,CAAC,CAAC;IACX,CAAC;IACD,OAAO,QAAQ,CAAC,QAAQ,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACzC,CAAC"}
@@ -0,0 +1,10 @@
1
+ /** Usage text for `logs`. */
2
+ export declare const LOGS_USAGE = "Usage: gcb logs [options]\n\nRead a workflow job log through the broker, without the credential ever reaching this side.\n\n --socket <path> Broker socket (default: $GIT_BROKER_SOCKET or the socket file)\n --host <host> Host as configured, e.g. github.com [required]\n --repo <owner/name> Repository the job belongs to [required]\n --job <id> Workflow job id, which is also the check run id [required]\n --proxy <url> Use this proxy for this request\n --no-proxy Reach GitHub directly for this request\n -h, --help Show this help\n";
3
+ /**
4
+ * Run the `logs` command.
5
+ *
6
+ * @param argv - arguments after the command name.
7
+ * @returns the process exit code: 0 read, 1 refused, 3 unreachable.
8
+ */
9
+ export declare function runLogs(argv: readonly string[]): Promise<number>;
10
+ //# sourceMappingURL=logs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logs.d.ts","sourceRoot":"","sources":["../../src/commands/logs.ts"],"names":[],"mappings":"AAoBA,6BAA6B;AAC7B,eAAO,MAAM,UAAU,2mBAWtB,CAAC;AAEF;;;;;GAKG;AACH,wBAAsB,OAAO,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAyDtE"}
@@ -0,0 +1,94 @@
1
+ /**
2
+ * `logs` — read one workflow job's log through the broker.
3
+ *
4
+ * The credential never leaves the broker. The broker mints a read-only, single-repository token
5
+ * narrowed to `actions: read`, fetches the log itself, and answers with the text: the agent gets the
6
+ * log without ever holding something that could read anything else.
7
+ *
8
+ * Exit codes: 0 read, 1 refused, 3 broker unreachable.
9
+ */
10
+ import { requestOverSocket, resolveSocketPath } from '../helper.js';
11
+ import { fail, parseArgs, say } from 'gcb-core';
12
+ /**
13
+ * How long to wait for the broker.
14
+ *
15
+ * Longer than a credential request: this is three API round trips (a token, a repository-scoped job
16
+ * lookup, then the log), and the first one after a restart can be slow.
17
+ */
18
+ const LOGS_TIMEOUT_MS = 60_000;
19
+ /** Usage text for `logs`. */
20
+ export const LOGS_USAGE = `Usage: gcb logs [options]
21
+
22
+ Read a workflow job log through the broker, without the credential ever reaching this side.
23
+
24
+ --socket <path> Broker socket (default: $GIT_BROKER_SOCKET or the socket file)
25
+ --host <host> Host as configured, e.g. github.com [required]
26
+ --repo <owner/name> Repository the job belongs to [required]
27
+ --job <id> Workflow job id, which is also the check run id [required]
28
+ --proxy <url> Use this proxy for this request
29
+ --no-proxy Reach GitHub directly for this request
30
+ -h, --help Show this help
31
+ `;
32
+ /**
33
+ * Run the `logs` command.
34
+ *
35
+ * @param argv - arguments after the command name.
36
+ * @returns the process exit code: 0 read, 1 refused, 3 unreachable.
37
+ */
38
+ export async function runLogs(argv) {
39
+ const args = parseArgs(argv, { booleans: ['help', 'no-proxy'] });
40
+ if (args.has('no-proxy') && args.value('proxy') !== undefined)
41
+ fail('--proxy and --no-proxy are mutually exclusive');
42
+ if (args.has('proxy') && args.value('proxy') === undefined)
43
+ fail('--proxy needs a value');
44
+ const proxy = args.has('no-proxy') ? null : args.value('proxy');
45
+ if (args.has('help') || args.has('h')) {
46
+ say(LOGS_USAGE);
47
+ return 0;
48
+ }
49
+ const socketPath = resolveSocketPath(args.value('socket'), process.env);
50
+ const host = args.value('host');
51
+ const repo = args.value('repo');
52
+ const rawJob = args.value('job');
53
+ if (!socketPath) {
54
+ fail('no broker socket: pass --socket, set GIT_BROKER_SOCKET, or run `gcb setup`');
55
+ }
56
+ if (!host)
57
+ fail('--host is required (e.g. github.com)');
58
+ if (!repo)
59
+ fail('--repo is required (e.g. owner/name)');
60
+ if (!rawJob)
61
+ fail('--job is required (the workflow job id, which is also the check run id)');
62
+ const jobId = Number(rawJob);
63
+ if (!Number.isInteger(jobId) || jobId <= 0) {
64
+ fail(`--job must be a positive integer, got ${JSON.stringify(rawJob)}`);
65
+ }
66
+ let response;
67
+ try {
68
+ response = await requestOverSocket(socketPath, {
69
+ v: 1,
70
+ op: 'logs',
71
+ host,
72
+ path: repo,
73
+ jobId,
74
+ proxy,
75
+ session: 'logs',
76
+ pid: process.pid,
77
+ }, LOGS_TIMEOUT_MS);
78
+ }
79
+ catch (error) {
80
+ process.stderr.write(`unreachable: ${error.message}\n`);
81
+ return 3;
82
+ }
83
+ if (!response.ok) {
84
+ process.stderr.write(`refused [${response.code ?? 'unknown'}]: ${response.reason ?? 'no reason given'}\n`);
85
+ return 1;
86
+ }
87
+ if (response.truncated === true) {
88
+ process.stderr.write('note: the broker truncated this log\n');
89
+ }
90
+ const text = response.log ?? '';
91
+ process.stdout.write(text.endsWith('\n') || text === '' ? text : `${text}\n`);
92
+ return 0;
93
+ }
94
+ //# sourceMappingURL=logs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logs.js","sourceRoot":"","sources":["../../src/commands/logs.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAEhD;;;;;GAKG;AACH,MAAM,eAAe,GAAG,MAAM,CAAC;AAE/B,6BAA6B;AAC7B,MAAM,CAAC,MAAM,UAAU,GAAG;;;;;;;;;;;CAWzB,CAAC;AAEF;;;;;GAKG;AACH,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,UAAU,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,SAAS;QAAE,IAAI,CAAC,+CAA+C,CAAC,CAAC;IACrH,IAAI,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,SAAS;QAAE,IAAI,CAAC,uBAAuB,CAAC,CAAC;IAC1F,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAChE,IAAI,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,IAA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IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,gBAAiB,KAAe,CAAC,OAAO,IAAI,CAAC,CAAC;QACnE,OAAO,CAAC,CAAC;IACX,CAAC;IAED,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,YAAY,QAAQ,CAAC,IAAI,IAAI,SAAS,MAAM,QAAQ,CAAC,MAAM,IAAI,iBAAiB,IAAI,CAAC,CAAC;QAC3G,OAAO,CAAC,CAAC;IACX,CAAC;IAED,IAAI,QAAQ,CAAC,SAAS,KAAK,IAAI,EAAE,CAAC;QAChC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,uCAAuC,CAAC,CAAC;IAChE,CAAC;IACD,MAAM,IAAI,GAAG,QAAQ,CAAC,GAAG,IAAI,EAAE,CAAC;IAChC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,CAAC,CAAC;IAC9E,OAAO,CAAC,CAAC;AACX,CAAC"}
@@ -0,0 +1,10 @@
1
+ /** Usage text for `pr`. */
2
+ export declare const PR_USAGE = "Usage: gcb pr [options]\n\nOpen, update or inspect a pull request through the broker, without the credential\never reaching this side.\n\nA subcommand the gh action catalog has (pr view, pr close, \u2026) runs as that action instead;\ngcb gh --help lists them. The flags below are the flag-only lifecycle gh cannot express.\n\nOpening (the default)\n --head <branch> The branch holding the change [required]\n May be <remote>:<branch>, e.g. origin:feat/x, to name a fork\n --base <branch> The branch to merge into (default: main)\n A <remote>:<branch> here names the same repository as --repo\n --title <text> The title [required]\n --body <text> The body, inline\n --body-file <path> The body, read from a file \u2014 a pull request body is usually long\n --draft Open it as a draft\n --via-host Ask a host-side opener to create it, as you, instead of as the app\n (run 'gcb host-opener' on the host to provide one)\n\nActing on one\n --number <n> The pull request number [required]\n --proxy <url> Use this proxy for this request\n --no-proxy Reach GitHub directly for this request\n --status Report its state, mergeability and the runs for its commit\n --comment Post an anchored review comment (also needs --file and --line);\n for a plain comment use: gcb gh pr comment <number> --body ...\n --file <path> Anchor that comment to a line of this file, repository-relative\n --line <n> The line to anchor to, in the new file unless --side says otherwise\n --side <left|right> Which side of the diff --line counts on (default: right)\n --threads List its review threads: their ids, whether they are resolved, and the comments\n --reply-to <id> Reply inside the thread that comment id belongs to, with --body/--body-file\n --edit <id> Replace the body of that review comment, with --body/--body-file\n (an id --threads prints; no --number is needed)\n --resolve <thread> Mark that review thread resolved (the id --threads prints)\n With --number and none of the above, the title, body or base is updated.\n\nCommon\n --socket <path> Broker socket (default: $GIT_BROKER_SOCKET or the socket file)\n --host <host> Host as configured, e.g. github.com (default: github.com)\n --repo <owner/name> Repository the pull request belongs to (default: origin remote)\n -h, --help Show this help\n";
3
+ /**
4
+ * Run the `pr` command.
5
+ *
6
+ * @param argv - arguments after the command name.
7
+ * @returns the process exit code: 0 done, 1 refused, 3 unreachable.
8
+ */
9
+ export declare function runPr(argv: readonly string[]): Promise<number>;
10
+ //# sourceMappingURL=pr.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pr.d.ts","sourceRoot":"","sources":["../../src/commands/pr.ts"],"names":[],"mappings":"AAuCA,2BAA2B;AAC3B,eAAO,MAAM,QAAQ,smFA0CpB,CAAC;AAyBF;;;;;GAKG;AACH,wBAAsB,KAAK,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CA4PpE"}