passport-bridge 0.52.0 → 0.53.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.
- package/dist/cliHookClassify.js +34 -10
- package/dist/cliHookParse.d.ts +4 -0
- package/dist/cliHookParse.js +8 -1
- package/dist/connectorKit/cli.generated.d.ts +6 -2
- package/dist/connectorKit/cli.generated.js +51 -40
- package/dist/connectorKit/launchers.generated.d.ts +53 -0
- package/dist/connectorKit/launchers.generated.js +109 -0
- package/dist/connectorKit/shell.generated.js +4 -2
- package/dist/controlPlaneGuard.js +4 -3
- package/dist/controlPlaneKubernetes.js +4 -3
- package/dist/controlPlaneNpmGuard.js +6 -2
- package/dist/controlPlaneRailwayGuard.d.ts +4 -2
- package/dist/controlPlaneRailwayGuard.js +20 -73
- package/dist/controlPlaneRailwayReach.d.ts +1 -1
- package/dist/controlPlaneRailwayReach.js +2 -0
- package/dist/pluginPin.d.ts +1 -1
- package/dist/pluginPin.js +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/dist/cliHookClassify.js
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
import { azRisk, azVerb, azVerbKey, parseAzCommand } from "./azureCommands.js";
|
|
12
12
|
import { basename, INTERPRETERS, normalizeArgv, SHELLS, splitCommands } from "./cliHookParse.js";
|
|
13
13
|
import { awsVerbKey, parseAwsCommand } from "./awsCommands.js";
|
|
14
|
+
import { packageRun } from "./connectorKit/launchers.generated.js";
|
|
14
15
|
import { spawnedCommands } from "./connectorKit/spawns.generated.js";
|
|
15
16
|
import { NPX_PACKAGE_TO_VENDOR, VENDORS } from "./cliHookVendors.js";
|
|
16
17
|
import { parseKube } from "./kubeCommand.js";
|
|
@@ -391,15 +392,40 @@ function classifyVendorVerb(vendor, all, via, envInjected) {
|
|
|
391
392
|
}
|
|
392
393
|
return finding(vendor, verb || positional.slice(0, 2).join(" ") || null, risk, via, verb ? "high" : "low", envInjected);
|
|
393
394
|
}
|
|
395
|
+
/** The vendor a package runner's word names: a package (`@railway/cli@4`, `vercel@latest`), or a vendor's program. */
|
|
396
|
+
function packageVendor(word, program) {
|
|
397
|
+
const trimmed = word.replace(/@[^/]*$/, (match) => (word.startsWith("@") && match.indexOf("/") === -1 ? match : ""));
|
|
398
|
+
for (const key of [word, trimmed, program])
|
|
399
|
+
if (Object.hasOwn(NPX_PACKAGE_TO_VENDOR, key))
|
|
400
|
+
return NPX_PACKAGE_TO_VENDOR[key];
|
|
401
|
+
return vendorSpec(trimmed) ? trimmed : vendorSpec(program) ? program : null;
|
|
402
|
+
}
|
|
403
|
+
/** A package runner (`launchers.ts`: `npx`, `pnpm exec`, `bun x`, `yarn <program>` …) running a vendor's CLI; null
|
|
404
|
+
* when `argv` isn't a package run, or is a bare run (`pnpm add …`) of no vendor. */
|
|
405
|
+
function classifyPackageRun(argv, via, envInjected) {
|
|
406
|
+
const run = packageRun(argv);
|
|
407
|
+
if (!run)
|
|
408
|
+
return null;
|
|
409
|
+
const word = argv[run.at];
|
|
410
|
+
const rest = run.args;
|
|
411
|
+
const vendor = packageVendor(word, run.program);
|
|
412
|
+
// A bare run's first word may be the runner's own command or a script: a vendor only with a command after it.
|
|
413
|
+
if (run.bare)
|
|
414
|
+
return vendor && /^[a-z]/i.test(rest[0] ?? "")
|
|
415
|
+
? [classifyVendor(vendor, rest, [...via, run.runner.trim()], envInjected)]
|
|
416
|
+
: null;
|
|
417
|
+
if (vendor)
|
|
418
|
+
return [classifyVendor(vendor, rest, [...via, run.runner.trim()], envInjected)];
|
|
419
|
+
return run.runner === "npx " || run.runner === "bunx "
|
|
420
|
+
? [opaque([...via, run.runner.trim()], `npx package ${word} not in vendor map`)]
|
|
421
|
+
: [];
|
|
422
|
+
}
|
|
394
423
|
function classifyPackageRunner(argv, prog, via, envInjected) {
|
|
395
424
|
const packageIndex = argv.findIndex((arg, index) => index > 0 && !arg.startsWith("-"));
|
|
396
425
|
if (packageIndex === -1)
|
|
397
426
|
return [];
|
|
398
427
|
const raw = argv[packageIndex];
|
|
399
|
-
const
|
|
400
|
-
const vendor = (Object.hasOwn(NPX_PACKAGE_TO_VENDOR, raw) ? NPX_PACKAGE_TO_VENDOR[raw] : undefined) ??
|
|
401
|
-
(Object.hasOwn(NPX_PACKAGE_TO_VENDOR, trimmed) ? NPX_PACKAGE_TO_VENDOR[trimmed] : undefined) ??
|
|
402
|
-
(vendorSpec(trimmed) ? trimmed : null);
|
|
428
|
+
const vendor = packageVendor(raw, raw);
|
|
403
429
|
if (!vendor)
|
|
404
430
|
return [opaque([...via, prog], `npx package ${raw} not in vendor map`)];
|
|
405
431
|
return [classifyVendor(vendor, argv.slice(packageIndex + 1), [...via, prog], envInjected)];
|
|
@@ -437,14 +463,12 @@ function classifySimpleCommand(argv, via, envInjected, depth) {
|
|
|
437
463
|
}
|
|
438
464
|
if (prog === "xargs")
|
|
439
465
|
return [];
|
|
466
|
+
const packaged = classifyPackageRun(argv, via, envInjected);
|
|
467
|
+
if (packaged)
|
|
468
|
+
return packaged;
|
|
469
|
+
// `npx -c '…'` (a script): read by its own reader; what this one names is the script's first program.
|
|
440
470
|
if (prog === "npx" || prog === "bunx")
|
|
441
471
|
return classifyPackageRunner(argv, prog, via, envInjected);
|
|
442
|
-
if ((prog === "pnpm" || prog === "yarn") && argv[1] === "dlx") {
|
|
443
|
-
const pkg = argv[2];
|
|
444
|
-
const mapped = Object.hasOwn(NPX_PACKAGE_TO_VENDOR, pkg) ? NPX_PACKAGE_TO_VENDOR[pkg] : undefined;
|
|
445
|
-
const vendor = mapped ?? (vendorSpec(pkg) ? pkg : null);
|
|
446
|
-
return vendor ? [classifyVendor(vendor, argv.slice(3), [...via, `${prog} dlx`], envInjected)] : [];
|
|
447
|
-
}
|
|
448
472
|
if (INTERPRETERS.has(prog))
|
|
449
473
|
return classifyInterpreter(argv, prog, via);
|
|
450
474
|
if (prog === "make" || prog === "just" || prog === "task") {
|
package/dist/cliHookParse.d.ts
CHANGED
|
@@ -70,6 +70,10 @@ export type NormalizedArgv = {
|
|
|
70
70
|
* the real program, or empty when the words carry no command of their own.
|
|
71
71
|
*/
|
|
72
72
|
export declare function normalizeArgv(source: string[]): NormalizedArgv;
|
|
73
|
+
/** The program words a package runner runs (`launchers.ts`, the table every reader shares): `npx kubectl …`,
|
|
74
|
+
* `pnpm exec gh …` → the program first. A bare run (`pnpm gh pr merge 1`) counts only for a program `ours` names
|
|
75
|
+
* followed by a command word, since that word may be the runner's own command or a script. Other words unchanged. */
|
|
76
|
+
export declare function runnerArgv(argv: string[], ours: (program: string) => boolean): string[];
|
|
73
77
|
/** The script a command runs as a line of its own: a shell's `-c`, or a runner's `-c`/`--call`. */
|
|
74
78
|
export declare function shellScript(argv: readonly string[]): string | null;
|
|
75
79
|
/** `env -S '…'` (`--split-string`) before the program: the command it splits out, with the words after it. */
|
package/dist/cliHookParse.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* alias/function resolution, runtime variable expansion. Those are the honest
|
|
9
9
|
* limits of a hook that only ever watches.
|
|
10
10
|
*/
|
|
11
|
-
import { launcherEnd, launcherName } from "./connectorKit/launchers.generated.js";
|
|
11
|
+
import { launcherEnd, launcherName, packageArgv } from "./connectorKit/launchers.generated.js";
|
|
12
12
|
import { spawnedCommands } from "./connectorKit/spawns.generated.js";
|
|
13
13
|
/** Words before the real command that the bridge alone skips, beyond the shared launchers (`launchers.ts`): `script`
|
|
14
14
|
* (macOS's `script -q /dev/null cmd`) and `xargs` (the command it runs on each input line). */
|
|
@@ -508,6 +508,13 @@ export function normalizeArgv(source) {
|
|
|
508
508
|
argv[0] = basename(argv[0]);
|
|
509
509
|
return { argv, via, envInjected };
|
|
510
510
|
}
|
|
511
|
+
/** The program words a package runner runs (`launchers.ts`, the table every reader shares): `npx kubectl …`,
|
|
512
|
+
* `pnpm exec gh …` → the program first. A bare run (`pnpm gh pr merge 1`) counts only for a program `ours` names
|
|
513
|
+
* followed by a command word, since that word may be the runner's own command or a script. Other words unchanged. */
|
|
514
|
+
export function runnerArgv(argv, ours) {
|
|
515
|
+
const run = packageArgv(argv, (program, args) => ours(program) && /^[a-z]/i.test(args[0] ?? ""));
|
|
516
|
+
return run ? run.argv : argv;
|
|
517
|
+
}
|
|
511
518
|
/** A shell's `-c` script (`bash -lc '…'`, `bash -c -- '…'`, `fish -c '…'`, `fish --command=…`). */
|
|
512
519
|
function shellCommand(argv) {
|
|
513
520
|
let command = false;
|
|
@@ -11,6 +11,10 @@ export declare function knownOps(m: Manifest): string[];
|
|
|
11
11
|
export declare const present: (value: Value | undefined) => boolean;
|
|
12
12
|
export declare const programName: (word: string) => string;
|
|
13
13
|
/** Strip what runs a program without changing it: env assignments, launchers (`launchers.ts`: env, sudo, timeout,
|
|
14
|
-
* time, nice …), package runners
|
|
15
|
-
|
|
14
|
+
* time, nice …), package runners (`npx`, `pnpm exec`, `bunx` …, and `pnpm <program>` when `bareRun` says what
|
|
15
|
+
* follows is the CLI's command). Returns the folder a runner's option moves the program to (null when the guard
|
|
16
|
+
* can't name it), if one does. */
|
|
17
|
+
export declare function stripLaunchers(words: string[], programs: readonly string[], bareRun?: (args: readonly string[]) => boolean): {
|
|
18
|
+
dir?: string | null;
|
|
19
|
+
};
|
|
16
20
|
export declare function normalizeCli(m: Manifest, argv: readonly string[], given?: string): Normalized | null;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* framework does, positional arguments as $1..$n. Anything the vendor's spec
|
|
6
6
|
* wouldn't accept is a `problem`: the request fails closed.
|
|
7
7
|
*/
|
|
8
|
-
import { launcherEnd, neverLaunches } from "./launchers.generated.js";
|
|
8
|
+
import { launcherEnd, neverLaunches, packageArgv } from "./launchers.generated.js";
|
|
9
9
|
const COBRA_TRUE = new Set(["1", "t", "T", "true", "TRUE", "True"]);
|
|
10
10
|
const COBRA_FALSE = new Set(["0", "f", "F", "false", "FALSE", "False"]);
|
|
11
11
|
const tables = new WeakMap();
|
|
@@ -156,32 +156,47 @@ export const programName = (word) => word
|
|
|
156
156
|
.replace(/@.*$/, "")
|
|
157
157
|
.replace(/\.(exe|cmd|ps1)$/i, "");
|
|
158
158
|
/** Strip what runs a program without changing it: env assignments, launchers (`launchers.ts`: env, sudo, timeout,
|
|
159
|
-
* time, nice …), package runners
|
|
160
|
-
|
|
161
|
-
|
|
159
|
+
* time, nice …), package runners (`npx`, `pnpm exec`, `bunx` …, and `pnpm <program>` when `bareRun` says what
|
|
160
|
+
* follows is the CLI's command). Returns the folder a runner's option moves the program to (null when the guard
|
|
161
|
+
* can't name it), if one does. */
|
|
162
|
+
export function stripLaunchers(words, programs, bareRun) {
|
|
163
|
+
let dir;
|
|
162
164
|
for (let guard = 0; guard < 32 && words.length; guard++) {
|
|
163
165
|
const first = words[0];
|
|
164
166
|
if (programs.includes(programName(first)))
|
|
165
|
-
|
|
167
|
+
break;
|
|
166
168
|
const launcher = launcherEnd(words, 0);
|
|
167
|
-
if (launcher !== null)
|
|
169
|
+
if (launcher !== null) {
|
|
168
170
|
words.splice(0, Math.max(1, launcher));
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
words.splice(0, 2);
|
|
173
|
-
else if (runners.test(first))
|
|
174
|
-
words.shift();
|
|
175
|
-
else if (first === "--" || /^-/.test(first)) {
|
|
176
|
-
// A runner's own option, and its value when it takes one (npx -p supabase, sudo -u admin).
|
|
177
|
-
const valued = /^(-p|--package|-u|--user|-g|--group|-C|--chdir|-n)$/.test(first);
|
|
171
|
+
continue;
|
|
172
|
+
}
|
|
173
|
+
if (/^[A-Za-z_][A-Za-z0-9_]*=/.test(first)) {
|
|
178
174
|
words.shift();
|
|
179
|
-
|
|
180
|
-
words.shift();
|
|
175
|
+
continue;
|
|
181
176
|
}
|
|
182
|
-
|
|
183
|
-
|
|
177
|
+
const run = packageArgv(words, (program, args) => programs.includes(program) && (bareRun?.(args) ?? false));
|
|
178
|
+
if (!run)
|
|
179
|
+
break;
|
|
180
|
+
if (run.run.dir !== undefined)
|
|
181
|
+
dir = run.run.dir === null || dir === null ? null : joinFolder(dir, run.run.dir);
|
|
182
|
+
words.splice(0, words.length, ...run.argv);
|
|
184
183
|
}
|
|
184
|
+
return dir === undefined ? {} : { dir };
|
|
185
|
+
}
|
|
186
|
+
/** `inner` inside `outer` (both relative to the line's folder, or absolute). */
|
|
187
|
+
const joinFolder = (outer, inner) => outer === undefined || inner.startsWith("/")
|
|
188
|
+
? inner
|
|
189
|
+
: inner === "."
|
|
190
|
+
? outer
|
|
191
|
+
: `${outer.replace(/\/+$/, "")}/${inner}`;
|
|
192
|
+
/** Whether `args` (after the CLI's name) name a command the CLI knows, or the CLI runs a default command. */
|
|
193
|
+
function commandFollows(m, args) {
|
|
194
|
+
const cli = m.capture.cli;
|
|
195
|
+
if (cli.defaultCommand !== undefined)
|
|
196
|
+
return true;
|
|
197
|
+
const { topWords, anyFlags } = tablesOf(m);
|
|
198
|
+
const named = canonicalWords(parseArgs(args, anyFlags, false, cli.framework).positional, cli.aliases ?? {});
|
|
199
|
+
return named.length > 0 && topWords.has(named[0]);
|
|
185
200
|
}
|
|
186
201
|
/** The command the words name (aliases resolved), or the CLI's default command when the first word isn't one. */
|
|
187
202
|
function findOp(m, words) {
|
|
@@ -204,18 +219,9 @@ function findOp(m, words) {
|
|
|
204
219
|
function launchedBehind(m, words, programs) {
|
|
205
220
|
if (!words.length || neverLaunches(programName(words[0]), words.slice(1)))
|
|
206
221
|
return false;
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
for (let i = 1; i < words.length; i++) {
|
|
210
|
-
if (!programs.includes(programName(words[i])))
|
|
211
|
-
continue;
|
|
212
|
-
const after = words.slice(i + 1);
|
|
213
|
-
if (cli.defaultCommand !== undefined)
|
|
222
|
+
for (let i = 1; i < words.length; i++)
|
|
223
|
+
if (programs.includes(programName(words[i])) && commandFollows(m, words.slice(i + 1)))
|
|
214
224
|
return true;
|
|
215
|
-
const named = canonicalWords(parseArgs(after, anyFlags, false, cli.framework).positional, cli.aliases ?? {});
|
|
216
|
-
if (named.length && topWords.has(named[0]))
|
|
217
|
-
return true;
|
|
218
|
-
}
|
|
219
225
|
return false;
|
|
220
226
|
}
|
|
221
227
|
/** More arguments than the vendor's usage line allows means something we can't read rides along. */
|
|
@@ -224,11 +230,22 @@ function tooManyArgs(usage, count) {
|
|
|
224
230
|
return false;
|
|
225
231
|
return count > (usage.match(/[<[][^>\]]+[>\]]/g) ?? []).filter((p) => !/flags/.test(p)).length;
|
|
226
232
|
}
|
|
233
|
+
/** Another folder the command runs in, whose link (not this folder's) decides the target: a context flag's or folder
|
|
234
|
+
* argument's, inside a package runner's folder (`pnpm -C apps/web exec …`) when one names it. */
|
|
235
|
+
function folderOf(cli, flags, folderIndex, args, runnerDir) {
|
|
236
|
+
const contextFlag = (cli.contextFlags ?? []).find((flag) => typeof flags[flag] === "string");
|
|
237
|
+
const named = contextFlag
|
|
238
|
+
? flags[contextFlag]
|
|
239
|
+
: folderIndex !== undefined
|
|
240
|
+
? args[folderIndex]
|
|
241
|
+
: undefined;
|
|
242
|
+
return typeof runnerDir === "string" ? joinFolder(runnerDir, named ?? ".") : named;
|
|
243
|
+
}
|
|
227
244
|
export function normalizeCli(m, argv, given) {
|
|
228
245
|
const cli = m.capture.cli;
|
|
229
246
|
const programs = [...cli.programs, ...(cli.aliasPrograms ?? [])];
|
|
230
247
|
const words = [...argv];
|
|
231
|
-
stripLaunchers(words, programs);
|
|
248
|
+
const runner = stripLaunchers(words, programs, (args) => commandFollows(m, args));
|
|
232
249
|
if (!programs.includes(programName(words[0] ?? ""))) {
|
|
233
250
|
// The CLI run by a program we don't know: never call it a read.
|
|
234
251
|
if (launchedBehind(m, words, programs))
|
|
@@ -254,15 +271,9 @@ export function normalizeCli(m, argv, given) {
|
|
|
254
271
|
(op && tooManyArgs(cli.usage?.[op], args.length) ? "more arguments than the command takes" : undefined) ??
|
|
255
272
|
(remote && localFlagsUsed.some((flag) => flag === "local" || !own.some((spec) => spec.long === flag))
|
|
256
273
|
? "remote and local together"
|
|
257
|
-
: undefined)
|
|
258
|
-
|
|
259
|
-
const
|
|
260
|
-
const folderIndex = op ? cli.folderArgs?.[op] : undefined;
|
|
261
|
-
const folder = contextFlag
|
|
262
|
-
? exact.flags[contextFlag]
|
|
263
|
-
: folderIndex !== undefined
|
|
264
|
-
? args[folderIndex]
|
|
265
|
-
: undefined;
|
|
274
|
+
: undefined) ??
|
|
275
|
+
(runner.dir === null ? "a package runner's folder the guard cannot name" : undefined);
|
|
276
|
+
const folder = folderOf(cli, exact.flags, op ? cli.folderArgs?.[op] : undefined, args, runner.dir);
|
|
266
277
|
const info = (cli.infoFlags ?? []).some((flag) => exact.flags[flag] === true);
|
|
267
278
|
return {
|
|
268
279
|
iface: "cli",
|
|
@@ -28,6 +28,59 @@ export type Unwrapped = {
|
|
|
28
28
|
export declare function launcherEnd(words: readonly string[], at: number): number | null;
|
|
29
29
|
/** See through leading assignments and launchers to the command they run. */
|
|
30
30
|
export declare function unwrapLaunchers(words: readonly string[]): Unwrapped;
|
|
31
|
+
/**
|
|
32
|
+
* Package runners: programs that run a package's program (`npx supabase db push`, `pnpm exec wrangler deploy`, `bunx
|
|
33
|
+
* @sentry/cli releases new 1.0`) from the project's node_modules/.bin, then PATH, or fetched from the registry. In many
|
|
34
|
+
* repos this is the normal way to run a platform's CLI. One table for every reader (`cli.ts` for the kit's
|
|
35
|
+
* manifests, and the bridge's Railway, Kubernetes, GitHub and npm readers), so a runner is seen through the same way on
|
|
36
|
+
* every platform.
|
|
37
|
+
*/
|
|
38
|
+
export type PackageRunnerSpec = {
|
|
39
|
+
/** Its subcommands that run a package (`pnpm exec`, `npm x`); none when it runs one itself (`npx`). */
|
|
40
|
+
subcommands?: readonly string[];
|
|
41
|
+
/** Whether its first word may name the program it runs (`pnpm supabase …`, `yarn wrangler …`). That word may also
|
|
42
|
+
* be its own command or a script, so a reader counts a bare run only for its own program followed by a command it
|
|
43
|
+
* knows. */
|
|
44
|
+
bare?: boolean;
|
|
45
|
+
/** Options that take a value as the next word (`-p pkg`, `-C dir`). */
|
|
46
|
+
valued: readonly string[];
|
|
47
|
+
};
|
|
48
|
+
export declare const PACKAGE_RUNNERS: Readonly<Record<string, PackageRunnerSpec>>;
|
|
49
|
+
/** Packages whose program has another name: `npx @railway/cli up` runs `railway`. */
|
|
50
|
+
export declare const PACKAGE_PROGRAMS: Readonly<Record<string, string>>;
|
|
51
|
+
/** The program a package spec runs: `supabase@2.1.0` → `supabase`, `@railway/cli@4` → `railway`. A scoped package
|
|
52
|
+
* this table doesn't name stays as written (without its version), so it never matches a program by accident. */
|
|
53
|
+
export declare function packageProgram(spec: string): string;
|
|
54
|
+
export type PackageRun = {
|
|
55
|
+
/** The runner and its subcommand as Railway's guard keys them (`npx `, `pnpm exec`, `pnpm ` for a bare run). */
|
|
56
|
+
runner: string;
|
|
57
|
+
/** Where the word naming the program or package is. */
|
|
58
|
+
at: number;
|
|
59
|
+
/** The program that runs (`packageProgram` of that word). */
|
|
60
|
+
program: string;
|
|
61
|
+
/** The program's own arguments: npm takes the first `--` for itself (`npm x supabase -- db push`). */
|
|
62
|
+
args: string[];
|
|
63
|
+
/** Whether the program was named as the runner's first word (`pnpm supabase …`). */
|
|
64
|
+
bare: boolean;
|
|
65
|
+
/** Packages named by `-p`/`--package`. */
|
|
66
|
+
packages: string[];
|
|
67
|
+
/** The folder it runs in when an option moves it: a path (relative to the line's folder), or null when the
|
|
68
|
+
* guard can't name it (`--filter`, `-r`). Absent when no option moves it. */
|
|
69
|
+
dir?: string | null;
|
|
70
|
+
/** The option that named `dir`. */
|
|
71
|
+
option?: string;
|
|
72
|
+
};
|
|
73
|
+
/** A package runner at `words[at]` and the program it runs, or null when it is none (or runs a script, or nothing:
|
|
74
|
+
* `npx -c '…'`, `pnpm install`, `npm exec` alone). */
|
|
75
|
+
export declare function packageRun(words: readonly string[], at?: number): PackageRun | null;
|
|
76
|
+
/** The words of the program a package runner runs, its program first (`npx -y supabase@2 db push` → `supabase db
|
|
77
|
+
* push`), or null when `words` aren't a package run. A bare run (`pnpm supabase db push`) counts only when
|
|
78
|
+
* `bareRun(program, its arguments)` says the program and what follows are a CLI's command, the way #1193 counts a
|
|
79
|
+
* CLI's name behind a program it doesn't know. */
|
|
80
|
+
export declare function packageArgv(words: readonly string[], bareRun?: (program: string, args: readonly string[]) => boolean): {
|
|
81
|
+
argv: string[];
|
|
82
|
+
run: PackageRun;
|
|
83
|
+
} | null;
|
|
31
84
|
/** Whether `head` (a program name) given `args` only reads or edits files and runs no other program. */
|
|
32
85
|
export declare function neverLaunches(head: string, args: readonly string[]): boolean;
|
|
33
86
|
/** Where the command `xargs` runs starts in its `args`, or null when an option can't be read. */
|
|
@@ -79,6 +79,115 @@ export function unwrapLaunchers(words) {
|
|
|
79
79
|
}
|
|
80
80
|
return { start: Math.min(at, words.length), via, assignments };
|
|
81
81
|
}
|
|
82
|
+
const NPM_VALUED = ["-p", "--package", "-w", "--workspace", "-C", "--prefix", "--registry", "--cache", "--userconfig"];
|
|
83
|
+
export const PACKAGE_RUNNERS = {
|
|
84
|
+
npx: { valued: [...NPM_VALUED, "-c", "--call"] },
|
|
85
|
+
npm: { subcommands: ["exec", "x"], valued: [...NPM_VALUED, "-c", "--call", "--loglevel"] },
|
|
86
|
+
pnpx: { valued: ["-p", "--package"] },
|
|
87
|
+
pnpm: {
|
|
88
|
+
subcommands: ["exec", "dlx"],
|
|
89
|
+
bare: true,
|
|
90
|
+
valued: ["-C", "--dir", "-F", "--filter", "--reporter", "--loglevel", "--package"]
|
|
91
|
+
},
|
|
92
|
+
yarn: { subcommands: ["exec", "dlx"], bare: true, valued: ["--cwd", "-p", "--package"] },
|
|
93
|
+
bunx: { valued: ["-p", "--package"] },
|
|
94
|
+
bun: { subcommands: ["x"], valued: ["-p", "--package", "--cwd"] }
|
|
95
|
+
};
|
|
96
|
+
/** Packages whose program has another name: `npx @railway/cli up` runs `railway`. */
|
|
97
|
+
export const PACKAGE_PROGRAMS = {
|
|
98
|
+
"@railway/cli": "railway",
|
|
99
|
+
"@sentry/cli": "sentry-cli",
|
|
100
|
+
"@cloudflare/wrangler": "wrangler"
|
|
101
|
+
};
|
|
102
|
+
/** Runner options that name the package to install (the program is the next word that isn't one). */
|
|
103
|
+
const PACKAGE_OPTIONS = new Set(["-p", "--package"]);
|
|
104
|
+
/** Runner options that name the folder the program runs in (pnpm's `-C`; npm's `-C` is `--prefix`). */
|
|
105
|
+
const DIR_OPTIONS = new Set(["--dir", "--cwd"]);
|
|
106
|
+
/** Runner options that run it in folders the guard can't name: each workspace package, a filter's matches, and npm's
|
|
107
|
+
* `--prefix` (`-C`), which moves where packages are found, not reliably the folder the command runs in. */
|
|
108
|
+
const SPREAD_OPTIONS = new Set(["-F", "--filter", "-w", "--workspace", "-r", "--recursive", "--prefix"]);
|
|
109
|
+
/** Options that run a script instead of a package (`npx -c '…'`): read as a line of its own by each reader. */
|
|
110
|
+
const SCRIPT_OPTIONS = new Set(["-c", "--call"]);
|
|
111
|
+
/** The program a package spec runs: `supabase@2.1.0` → `supabase`, `@railway/cli@4` → `railway`. A scoped package
|
|
112
|
+
* this table doesn't name stays as written (without its version), so it never matches a program by accident. */
|
|
113
|
+
export function packageProgram(spec) {
|
|
114
|
+
const bare = /^(@[^/@\s]+\/[^@\s]+|[^@\s]+)@[^/\s]*$/.exec(spec)?.[1] ?? spec;
|
|
115
|
+
return Object.hasOwn(PACKAGE_PROGRAMS, bare) ? PACKAGE_PROGRAMS[bare] : bare;
|
|
116
|
+
}
|
|
117
|
+
/** A package runner at `words[at]` and the program it runs, or null when it is none (or runs a script, or nothing:
|
|
118
|
+
* `npx -c '…'`, `pnpm install`, `npm exec` alone). */
|
|
119
|
+
export function packageRun(words, at = 0) {
|
|
120
|
+
const name = (words[at]?.split(/[\\/]/).pop() ?? "").replace(/\.(exe|cmd|ps1)$/i, "").toLowerCase();
|
|
121
|
+
if (!Object.hasOwn(PACKAGE_RUNNERS, name))
|
|
122
|
+
return null;
|
|
123
|
+
const spec = PACKAGE_RUNNERS[name];
|
|
124
|
+
let sub = spec.subcommands ? null : "";
|
|
125
|
+
const packages = [];
|
|
126
|
+
let dir;
|
|
127
|
+
let dashes = false;
|
|
128
|
+
for (let next = at + 1; next < words.length; next++) {
|
|
129
|
+
const word = words[next];
|
|
130
|
+
if (word === "--") {
|
|
131
|
+
dashes = true;
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
if (word.startsWith("-") && word.length > 1) {
|
|
135
|
+
const eq = word.startsWith("--") ? word.indexOf("=") : -1;
|
|
136
|
+
const option = eq < 0 ? word : word.slice(0, eq);
|
|
137
|
+
if (SCRIPT_OPTIONS.has(option) && spec.valued.includes(option))
|
|
138
|
+
return null;
|
|
139
|
+
const valued = eq < 0 && spec.valued.includes(option);
|
|
140
|
+
const value = eq >= 0 ? word.slice(eq + 1) : valued ? words[next + 1] : undefined;
|
|
141
|
+
if (valued)
|
|
142
|
+
next += 1;
|
|
143
|
+
if (PACKAGE_OPTIONS.has(option) && value !== undefined)
|
|
144
|
+
packages.push(value);
|
|
145
|
+
const named = DIR_OPTIONS.has(option) || (option === "-C" && name === "pnpm");
|
|
146
|
+
if (named && value !== undefined)
|
|
147
|
+
dir = { value, option };
|
|
148
|
+
else if (option === "-C")
|
|
149
|
+
dir = { value: null, option };
|
|
150
|
+
else if (SPREAD_OPTIONS.has(option))
|
|
151
|
+
dir = { value: null, option };
|
|
152
|
+
continue;
|
|
153
|
+
}
|
|
154
|
+
let bare = false;
|
|
155
|
+
if (sub === null) {
|
|
156
|
+
if (spec.subcommands.includes(word)) {
|
|
157
|
+
sub = word;
|
|
158
|
+
continue;
|
|
159
|
+
}
|
|
160
|
+
if (!spec.bare)
|
|
161
|
+
return null;
|
|
162
|
+
sub = "";
|
|
163
|
+
bare = true;
|
|
164
|
+
}
|
|
165
|
+
const args = words.slice(next + 1);
|
|
166
|
+
const own = (name === "npm" || name === "npx") && !dashes ? args.indexOf("--") : -1;
|
|
167
|
+
return {
|
|
168
|
+
runner: `${name} ${sub}`,
|
|
169
|
+
at: next,
|
|
170
|
+
program: packageProgram(word),
|
|
171
|
+
args: own < 0 ? args : [...args.slice(0, own), ...args.slice(own + 1)],
|
|
172
|
+
bare,
|
|
173
|
+
packages,
|
|
174
|
+
...(dir ? { dir: dir.value, option: dir.option } : {})
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
return null;
|
|
178
|
+
}
|
|
179
|
+
/** The words of the program a package runner runs, its program first (`npx -y supabase@2 db push` → `supabase db
|
|
180
|
+
* push`), or null when `words` aren't a package run. A bare run (`pnpm supabase db push`) counts only when
|
|
181
|
+
* `bareRun(program, its arguments)` says the program and what follows are a CLI's command, the way #1193 counts a
|
|
182
|
+
* CLI's name behind a program it doesn't know. */
|
|
183
|
+
export function packageArgv(words, bareRun = () => false) {
|
|
184
|
+
const run = packageRun(words);
|
|
185
|
+
if (!run)
|
|
186
|
+
return null;
|
|
187
|
+
if (run.bare && !bareRun(run.program, run.args))
|
|
188
|
+
return null;
|
|
189
|
+
return { argv: [run.program, ...run.args], run };
|
|
190
|
+
}
|
|
82
191
|
/**
|
|
83
192
|
* Programs that never run another program: a CLI's name among their words is an argument (`ls supabase`, `grep -rn
|
|
84
193
|
* railway .`, `git grep terraform`, `rm -rf supabase`), not that CLI being run. Each reader of a shell line uses it
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
*/
|
|
22
22
|
import { programName } from "./cli.generated.js";
|
|
23
23
|
import { explain, normalize } from "./engine.generated.js";
|
|
24
|
-
import { launcherEnd, launcherName, neverLaunches, xargsCommand } from "./launchers.generated.js";
|
|
24
|
+
import { launcherEnd, launcherName, neverLaunches, packageRun, xargsCommand } from "./launchers.generated.js";
|
|
25
25
|
import { fedScript, mentions, SHELLS } from "./shellFed.generated.js";
|
|
26
26
|
/** A variable set to something the resolver couldn't read. */
|
|
27
27
|
const UNKNOWN = "\u0000";
|
|
@@ -584,7 +584,9 @@ function command(m, words, guard, state, out, depth, lineWords, stdin = []) {
|
|
|
584
584
|
return failing(m, out, "a script the guard cannot read");
|
|
585
585
|
if (body.length)
|
|
586
586
|
return script(m, body.map((w) => w.text).join(" "), guard, state, out, depth + 1);
|
|
587
|
-
|
|
587
|
+
// `bun x supabase …` is a package run (`launchers.ts`), read by the kit's normalizer; `bun script.ts` isn't.
|
|
588
|
+
const packaged = packageRun(rest.map((w) => w.text), 0);
|
|
589
|
+
if (RUNNERS.test(head) && !packaged && mentions(runArgs(head, args), programs))
|
|
588
590
|
return failing(m, out, `run by ${head}`);
|
|
589
591
|
const request = { interface: "cli", argv: rest.map((w) => w.text) };
|
|
590
592
|
const n = normalize(m, request);
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
import { readFileSync } from "node:fs";
|
|
22
22
|
import { join } from "node:path";
|
|
23
23
|
import { classifyGitPushRefs, classifyGithubAll } from "./connectorKit/githubDecide.generated.js";
|
|
24
|
-
import { normalizeArgv, splitCommands } from "./cliHookParse.js";
|
|
24
|
+
import { normalizeArgv, runnerArgv, splitCommands } from "./cliHookParse.js";
|
|
25
25
|
import { maskCommandArgv } from "./controlPlaneUnnamed.generated.js";
|
|
26
26
|
import { readBoundedJson } from "./boundedResponse.js";
|
|
27
27
|
import { newRequestId } from "./controlPlaneLate.js";
|
|
@@ -115,9 +115,10 @@ export function classifyCommands(command, place, git) {
|
|
|
115
115
|
shapes[index - 1]?.next === "|" ||
|
|
116
116
|
shape?.heredoc === true ||
|
|
117
117
|
(shape?.redirects ?? []).some((redirect) => /^0?<(?:<<)?$/.test(redirect.op));
|
|
118
|
-
const { argv } = normalizeArgv(words);
|
|
119
|
-
if (!
|
|
118
|
+
const { argv: typed } = normalizeArgv(words);
|
|
119
|
+
if (!typed.length)
|
|
120
120
|
continue;
|
|
121
|
+
const argv = runnerArgv(typed, (program) => program === "gh");
|
|
121
122
|
const masked = maskCommandArgv(argv);
|
|
122
123
|
if (GIT.test(argv[0])) {
|
|
123
124
|
// Resolved with git in the folder; without git (or a folder git can't read), as `.git` says.
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
import { readdirSync, readFileSync, statSync } from "node:fs";
|
|
15
15
|
import { homedir } from "node:os";
|
|
16
16
|
import { isAbsolute, join, resolve } from "node:path";
|
|
17
|
-
import { innerScript, nestedScript, normalizeArgv, splitCommands } from "./cliHookParse.js";
|
|
17
|
+
import { innerScript, nestedScript, normalizeArgv, runnerArgv, splitCommands } from "./cliHookParse.js";
|
|
18
18
|
import { readBoundedJson } from "./boundedResponse.js";
|
|
19
19
|
import { classifyKube, isKubeProgram } from "./connectorKit/manifests/kubernetesCli.generated.js";
|
|
20
20
|
import { MAX_MANIFEST_OBJECTS, readManifest } from "./connectorKit/manifests/kubernetesObjects.generated.js";
|
|
@@ -161,9 +161,10 @@ export function classifyKubeLine(command, where, depth = 0) {
|
|
|
161
161
|
inner(script);
|
|
162
162
|
continue;
|
|
163
163
|
}
|
|
164
|
-
const { argv, envInjected } = normalizeArgv(words);
|
|
165
|
-
if (!
|
|
164
|
+
const { argv: typed, envInjected } = normalizeArgv(words);
|
|
165
|
+
if (!typed.length)
|
|
166
166
|
continue;
|
|
167
|
+
const argv = runnerArgv(typed, (program) => isKubeProgram(program));
|
|
167
168
|
if (argv[0] === "cd") {
|
|
168
169
|
const target = argv[1];
|
|
169
170
|
cwd =
|
|
@@ -11,8 +11,9 @@
|
|
|
11
11
|
import { readFileSync, statSync } from "node:fs";
|
|
12
12
|
import { homedir } from "node:os";
|
|
13
13
|
import { resolve } from "node:path";
|
|
14
|
-
import { basename, innerScript, nestedScript, normalizeArgv, splitCommands } from "./cliHookParse.js";
|
|
14
|
+
import { basename, innerScript, nestedScript, normalizeArgv, runnerArgv, splitCommands } from "./cliHookParse.js";
|
|
15
15
|
import { readBoundedJson } from "./boundedResponse.js";
|
|
16
|
+
import { packageRun } from "./connectorKit/launchers.generated.js";
|
|
16
17
|
import { classifyNpm, NPM_PROGRAMS } from "./controlPlaneNpmCommands.generated.js";
|
|
17
18
|
import { CP_DECIDE_PATH, CP_DECIDE_TIMEOUT_MS, worstAnswer } from "./controlPlaneAnswer.js";
|
|
18
19
|
import { maskCommandArgv } from "./controlPlaneUnnamed.generated.js";
|
|
@@ -99,10 +100,13 @@ function inner(script, walk, depth) {
|
|
|
99
100
|
walk.cwd = saved;
|
|
100
101
|
}
|
|
101
102
|
function walkCommand(words, walk, depth) {
|
|
102
|
-
const { argv, envInjected } = normalizeArgv(words);
|
|
103
|
+
const { argv: typed, envInjected } = normalizeArgv(words);
|
|
103
104
|
const script = innerScript(words);
|
|
104
105
|
if (script !== null)
|
|
105
106
|
return inner(script, walk, depth);
|
|
107
|
+
// `npx npm publish`, `pnpm exec npm publish`, `pnpm npm publish`: the program a package runner runs. `yarn npm
|
|
108
|
+
// publish` is yarn's own command (its registry settings, not npm's).
|
|
109
|
+
const argv = packageRun(typed)?.runner === "yarn " ? typed : runnerArgv(typed, (name) => name === "npm");
|
|
106
110
|
const program = programOf(argv[0]);
|
|
107
111
|
if (!program)
|
|
108
112
|
return;
|
|
@@ -60,12 +60,14 @@ export declare function linkContext(linked: RailwayLinked | null | undefined): R
|
|
|
60
60
|
export type RailwayCall = {
|
|
61
61
|
words: string[];
|
|
62
62
|
via: "program" | "runner" | "package";
|
|
63
|
-
|
|
63
|
+
/** The folder a runner's option names; null when it can't be named (`--filter`, npm's `--prefix`). */
|
|
64
|
+
dir?: string | null;
|
|
64
65
|
/** For a runner: its name and subcommand (`pnpm exec`), and the option that named `dir`. */
|
|
65
66
|
runner?: string;
|
|
66
67
|
option?: string;
|
|
67
68
|
};
|
|
68
|
-
/** A railway command line however it is run: `railway …` (any path), or Railway's package through a runner
|
|
69
|
+
/** A railway command line however it is run: `railway …` (any path), or Railway's package through a package runner
|
|
70
|
+
* (`launchers.ts`, the table every reader shares). */
|
|
69
71
|
export declare function railwayCall(argv: readonly string[]): RailwayCall | null;
|
|
70
72
|
/** A railway command line's words (`railway …`), however it is run; null when it isn't one. */
|
|
71
73
|
export declare function railwayArgv(argv: readonly string[]): string[] | null;
|
|
@@ -35,6 +35,7 @@ import { basename, innerScript, nestedScript, normalizeArgv, splitCommands } fro
|
|
|
35
35
|
import { readBoundedJson } from "./boundedResponse.js";
|
|
36
36
|
import { beginShadowLine, shadowAlongside, shadowRailwayLine, spoolShadow } from "./kitShadow.js";
|
|
37
37
|
import { cdTarget, runnerFolder } from "./controlPlaneRailwayReach.js";
|
|
38
|
+
import { packageRun } from "./connectorKit/launchers.generated.js";
|
|
38
39
|
import { NO_ANSWER_STATUSES, noAnswer, refusalOf } from "./cpRefusal.js";
|
|
39
40
|
/** At most this many railway commands in one line are asked about; more and the line is refused. */
|
|
40
41
|
export const MAX_RAILWAY_COMMANDS = 8;
|
|
@@ -74,87 +75,33 @@ export function linkContext(linked) {
|
|
|
74
75
|
const isRailway = (argv0) => /^railway(?:\.exe)?$/i.test(basename(argv0 ?? ""));
|
|
75
76
|
/** Railway's CLI package, any version: `@railway/cli`, `@railway/cli@4.10.0`. */
|
|
76
77
|
const RAILWAY_PACKAGE = /^@railway\/cli(?:@[^\s/]+)?$/i;
|
|
77
|
-
const runner = (subcommands, bare, values) => ({
|
|
78
|
-
subcommands,
|
|
79
|
-
bare,
|
|
80
|
-
values: new Set(values)
|
|
81
|
-
});
|
|
82
|
-
const NPX_VALUES = ["-p", "--package", "-c", "--call"];
|
|
83
|
-
const RUNNERS = {
|
|
84
|
-
npx: runner([], true, NPX_VALUES),
|
|
85
|
-
bunx: runner([], true, ["-p", "--package"]),
|
|
86
|
-
pnpx: runner([], true, ["-p", "--package"]),
|
|
87
|
-
pnpm: runner(["dlx", "exec"], true, ["-C", "--dir", "-F", "--filter", "--reporter", "--loglevel"]),
|
|
88
|
-
npm: runner(["exec", "x"], false, [...NPX_VALUES, "-C", "--prefix", "-w", "--workspace", "--loglevel"]),
|
|
89
|
-
yarn: runner(["dlx", "exec"], true, ["--cwd", "-p", "--package"]),
|
|
90
|
-
bun: runner(["x"], false, ["-p", "--package", "--cwd"])
|
|
91
|
-
};
|
|
92
|
-
const PACKAGE_OPTIONS = new Set(["-p", "--package"]);
|
|
93
|
-
/** Runner options naming the folder it runs in. */
|
|
94
|
-
const DIR_OPTIONS = new Set(["-C", "--dir", "--prefix", "--cwd"]);
|
|
95
78
|
/** Runners that run `railway` from node_modules/.bin, else from PATH (which may be Passport's shim). */
|
|
96
79
|
const RESOLVES = new Set(["pnpm exec", "pnpm ", "npm exec", "npm x", "yarn ", "yarn exec"]);
|
|
97
80
|
/** How deep scripts inside scripts are read. */
|
|
98
81
|
const MAX_DEPTH = 3;
|
|
99
|
-
/** A
|
|
100
|
-
|
|
101
|
-
const word = argv[at];
|
|
102
|
-
const eq = word.startsWith("--") ? word.indexOf("=") : -1;
|
|
103
|
-
if (eq !== -1)
|
|
104
|
-
return { name: word.slice(0, eq), value: word.slice(eq + 1), next: at };
|
|
105
|
-
if (!spec.values.has(word))
|
|
106
|
-
return { name: word, next: at };
|
|
107
|
-
const value = argv[at + 1];
|
|
108
|
-
return { name: word, ...(value !== undefined ? { value } : {}), next: at + 1 };
|
|
109
|
-
}
|
|
110
|
-
/** A railway command line however it is run: `railway …` (any path), or Railway's package through a runner. */
|
|
82
|
+
/** A railway command line however it is run: `railway …` (any path), or Railway's package through a package runner
|
|
83
|
+
* (`launchers.ts`, the table every reader shares). */
|
|
111
84
|
export function railwayCall(argv) {
|
|
112
85
|
if (isRailway(argv[0]))
|
|
113
86
|
return { words: ["railway", ...argv.slice(1)], via: "program" };
|
|
114
|
-
const
|
|
115
|
-
if (!
|
|
87
|
+
const run = packageRun(argv);
|
|
88
|
+
if (!run)
|
|
116
89
|
return null;
|
|
117
|
-
const
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
}
|
|
133
|
-
if (sub === null) {
|
|
134
|
-
if (spec.subcommands.includes(word)) {
|
|
135
|
-
sub = word;
|
|
136
|
-
continue;
|
|
137
|
-
}
|
|
138
|
-
if (!spec.bare)
|
|
139
|
-
return null;
|
|
140
|
-
sub = "";
|
|
141
|
-
}
|
|
142
|
-
const words = ["railway", ...argv.slice(at + 1)];
|
|
143
|
-
if (RAILWAY_PACKAGE.test(word))
|
|
144
|
-
return { words, via: "package" };
|
|
145
|
-
// `npx railway` runs the project's (or the registry's) `railway`: decided like the CLI itself.
|
|
146
|
-
if (!isRailway(word))
|
|
147
|
-
return null;
|
|
148
|
-
if (packaged || !RESOLVES.has(`${name} ${sub}`))
|
|
149
|
-
return { words, via: "package" };
|
|
150
|
-
return {
|
|
151
|
-
words,
|
|
152
|
-
via: "runner",
|
|
153
|
-
runner: `${name} ${sub}`,
|
|
154
|
-
...(dir !== undefined ? { dir: dir.value, option: dir.option } : {})
|
|
155
|
-
};
|
|
156
|
-
}
|
|
157
|
-
return null;
|
|
90
|
+
const word = argv[run.at];
|
|
91
|
+
const words = ["railway", ...run.args];
|
|
92
|
+
if (RAILWAY_PACKAGE.test(word))
|
|
93
|
+
return { words, via: "package" };
|
|
94
|
+
// `npx railway` runs the project's (or the registry's) `railway`: decided like the CLI itself.
|
|
95
|
+
if (!isRailway(word))
|
|
96
|
+
return null;
|
|
97
|
+
if (run.packages.some((name) => RAILWAY_PACKAGE.test(name)) || !RESOLVES.has(run.runner))
|
|
98
|
+
return { words, via: "package" };
|
|
99
|
+
return {
|
|
100
|
+
words,
|
|
101
|
+
via: "runner",
|
|
102
|
+
runner: run.runner,
|
|
103
|
+
...(run.dir !== undefined ? { dir: run.dir, option: run.option } : {})
|
|
104
|
+
};
|
|
158
105
|
}
|
|
159
106
|
/** A railway command line's words (`railway …`), however it is run; null when it isn't one. */
|
|
160
107
|
export function railwayArgv(argv) {
|
|
@@ -9,4 +9,4 @@ export declare function cdTarget(argv: readonly string[], words: readonly WordIn
|
|
|
9
9
|
next: string;
|
|
10
10
|
}, cwd: string | null, home: string): string | null | undefined;
|
|
11
11
|
/** A runner's folder option (`pnpm -C dir`, `yarn --cwd dir`), from `cwd`; null when the value isn't plain. */
|
|
12
|
-
export declare function runnerFolder(cwd: string | null, dir: string | undefined, option: string | undefined): string | null;
|
|
12
|
+
export declare function runnerFolder(cwd: string | null, dir: string | null | undefined, option: string | undefined): string | null;
|
|
@@ -30,6 +30,8 @@ export function cdTarget(argv, words, shape, cwd, home) {
|
|
|
30
30
|
export function runnerFolder(cwd, dir, option) {
|
|
31
31
|
if (dir === undefined)
|
|
32
32
|
return cwd;
|
|
33
|
+
if (dir === null)
|
|
34
|
+
return null;
|
|
33
35
|
// `npm --prefix` moves where packages are found, not reliably the folder the command runs in.
|
|
34
36
|
if (cwd === null || option === "--prefix" || /[$`*?[\]{}~]/.test(dir))
|
|
35
37
|
return null;
|
package/dist/pluginPin.d.ts
CHANGED
package/dist/pluginPin.js
CHANGED
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.53.0";
|
package/dist/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Keep in lockstep with bridge/package.json.
|
|
2
|
-
export const VERSION = "0.
|
|
2
|
+
export const VERSION = "0.53.0";
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "passport-bridge",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.53.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "passport-bridge",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.53.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@modelcontextprotocol/sdk": "1.32.1"
|