@seamapi/cli 0.26.0 → 0.27.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/README.md +12 -7
- package/bin/cli.js +8 -2
- package/bin/cli.js.map +1 -1
- package/lib/args/parse.d.ts +3 -1
- package/lib/args/parse.js +2 -2
- package/lib/args/parse.js.map +1 -1
- package/lib/commands/local/completion.d.ts +2 -0
- package/lib/commands/local/completion.js +22 -4
- package/lib/commands/local/completion.js.map +1 -1
- package/lib/render/completion/index.d.ts +2 -3
- package/lib/render/completion/index.js +2 -7
- package/lib/render/completion/index.js.map +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +1 -2
- package/src/bin/cli.ts +12 -2
- package/src/lib/args/parse.ts +4 -2
- package/src/lib/commands/local/completion.ts +23 -3
- package/src/lib/render/completion/index.ts +2 -8
- package/src/lib/version.ts +1 -1
- package/completions/seam.bash +0 -16
- package/completions/seam.fish +0 -15
- package/completions/seam.zsh +0 -19
package/README.md
CHANGED
|
@@ -306,13 +306,18 @@ seam completion fish > ~/.config/fish/completions/seam.fish
|
|
|
306
306
|
seam completion zsh > "${fpath[1]}/_seam"
|
|
307
307
|
```
|
|
308
308
|
|
|
309
|
-
System packages install completion loaders instead
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
309
|
+
System packages install completion loaders instead. The network-free loaders
|
|
310
|
+
are embedded in the CLI and printed with `seam completion --loader <shell>`.
|
|
311
|
+
For example, a package can install the Bash loader with:
|
|
312
|
+
|
|
313
|
+
```sh
|
|
314
|
+
seam completion --loader bash > /usr/share/bash-completion/completions/seam
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
A loader runs `seam completion` the first time the shell completes a Seam
|
|
318
|
+
command, so installed completions always match the CLI's current Seam API
|
|
319
|
+
schema and never go stale between package updates. The `seam-bin` AUR package
|
|
320
|
+
installs the loaders for all three shells.
|
|
316
321
|
|
|
317
322
|
Completions are generated from the cached Seam API schema, so they may
|
|
318
323
|
briefly lag a newly released API. Pass `--update` to refresh the cache first,
|
package/bin/cli.js
CHANGED
|
@@ -4,7 +4,7 @@ import chalk from 'chalk';
|
|
|
4
4
|
import { cliFlags, getInteractivity, parseCliArgs, toAuthOverrides, toParameterName, } from '../lib/args/parse.js';
|
|
5
5
|
import { assertKnownArgs, assertNoAuthOverrides } from '../lib/args/validate.js';
|
|
6
6
|
import { getApiBlueprint } from '../lib/blueprint/index.js';
|
|
7
|
-
import { printCompletion } from '../lib/commands/local/completion.js';
|
|
7
|
+
import { printCompletion, printCompletionLoader, } from '../lib/commands/local/completion.js';
|
|
8
8
|
import { runWizard } from '../lib/commands/local/wizard.js';
|
|
9
9
|
import { acceptedParamsOf, buildRegistry, findLocalCommand, findLocalCommandTakingPositional, } from '../lib/commands/registry.js';
|
|
10
10
|
import { getConfig } from '../lib/config/index.js';
|
|
@@ -99,6 +99,10 @@ async function cli(args, argv) {
|
|
|
99
99
|
accepted: command == null ? new Set() : acceptedParamsOf(command.definition),
|
|
100
100
|
isLocal: true,
|
|
101
101
|
});
|
|
102
|
+
if (args['loader'] === true) {
|
|
103
|
+
printCompletionLoader(shell);
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
102
106
|
const cachedBlueprint = await getApiBlueprint({ update });
|
|
103
107
|
printCompletion(shell, buildRegistry(cachedBlueprint).spec);
|
|
104
108
|
return;
|
|
@@ -184,7 +188,9 @@ const run = async (argv) => {
|
|
|
184
188
|
await runWizard(argv.slice(1));
|
|
185
189
|
return;
|
|
186
190
|
}
|
|
187
|
-
const args = parseCliArgs(argv
|
|
191
|
+
const args = parseCliArgs(argv, {
|
|
192
|
+
booleanKeys: argv[0]?.toLowerCase() === 'completion' ? ['loader'] : [],
|
|
193
|
+
});
|
|
188
194
|
const isTty = process.stdout.isTTY === true;
|
|
189
195
|
setOutput(createOutput({
|
|
190
196
|
format: resolveOutputFormat(argv, { isTty }),
|
package/bin/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/bin/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,iBAAiB,IAAI,OAAO,EAAE,MAAM,WAAW,CAAA;AAExD,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,EACL,QAAQ,EACR,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,eAAe,GAChB,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAA;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/bin/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,iBAAiB,IAAI,OAAO,EAAE,MAAM,WAAW,CAAA;AAExD,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,EACL,QAAQ,EACR,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,eAAe,GAChB,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAA;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,EACL,eAAe,EACf,qBAAqB,GACtB,MAAM,kCAAkC,CAAA;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AACxD,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,gBAAgB,EAChB,gCAAgC,GACjC,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAC/C,OAAO,EAAmB,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AACxC,OAAO,EAAE,kBAAkB,EAAE,MA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AM,GAAG,GAAG,KAAK,EAAE,IAAc,EAAE,EAAE;IACnC,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAE,CAAC;QACzB,MAAM,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;QAC9B,OAAM;IACR,CAAC;IAED,MAAM,IAAI,GAAG,YAAY,CAAC,IAAI,EAAE;QAC9B,WAAW,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,KAAK,YAAY,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE;KACvE,CAAC,CAAA;IAEF,MAAM,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,KAAK,IAAI,CAAA;IAE3C,SAAS,CACP,YAAY,CAAC;QACX,MAAM,EAAE,mBAAmB,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,CAAC;QAC5C,MAAM,EAAE,KAAK;KACd,CAAC,CACH,CAAA;IAED,MAAM,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;AACvB,CAAC,CAAA;AAED,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAU,EAAE,EAAE;IAC9C,kBAAkB,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,CAAA;AACpC,CAAC,CAAC,CAAA"}
|
package/lib/args/parse.d.ts
CHANGED
|
@@ -29,8 +29,10 @@ export interface ParseCliArgsOptions {
|
|
|
29
29
|
* lose leading zeroes or turn exponent notation into a digit string.
|
|
30
30
|
*/
|
|
31
31
|
stringKeys?: string[];
|
|
32
|
+
/** Argument keys that must not consume the following positional word. */
|
|
33
|
+
booleanKeys?: string[];
|
|
32
34
|
}
|
|
33
|
-
export declare const parseCliArgs: (argv: string[], { stringKeys }?: ParseCliArgsOptions) => ParsedArgs;
|
|
35
|
+
export declare const parseCliArgs: (argv: string[], { stringKeys, booleanKeys }?: ParseCliArgsOptions) => ParsedArgs;
|
|
34
36
|
/**
|
|
35
37
|
* The request params among the parsed arguments: every key normalized to
|
|
36
38
|
* the parameter it names, minus the flags that configure the CLI itself.
|
package/lib/args/parse.js
CHANGED
|
@@ -25,7 +25,7 @@ export const cliFlags = [
|
|
|
25
25
|
'version',
|
|
26
26
|
'workspace_id',
|
|
27
27
|
];
|
|
28
|
-
export const parseCliArgs = (argv, { stringKeys = [] } = {}) => parseArgs(argv, {
|
|
28
|
+
export const parseCliArgs = (argv, { stringKeys = [], booleanKeys = [] } = {}) => parseArgs(argv, {
|
|
29
29
|
// A page cursor and a code are opaque even before the endpoint's own
|
|
30
30
|
// parameter types are known, so always keep them exactly as given. The
|
|
31
31
|
// overrides are read as given for the same reason: a URL or an id is
|
|
@@ -39,7 +39,7 @@ export const parseCliArgs = (argv, { stringKeys = [] } = {}) => parseArgs(argv,
|
|
|
39
39
|
'workspace_id',
|
|
40
40
|
...stringKeys,
|
|
41
41
|
],
|
|
42
|
-
boolean: ['non-interactive', 'interactive', 'json'],
|
|
42
|
+
boolean: ['non-interactive', 'interactive', 'json', ...booleanKeys],
|
|
43
43
|
// Deliberately not aliased to -n, which is reserved for a future
|
|
44
44
|
// --dry-run flag.
|
|
45
45
|
alias: { 'non-interactive': 'y', interactive: 'i' },
|
package/lib/args/parse.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse.js","sourceRoot":"","sources":["../../src/lib/args/parse.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,EAAE,EAAmB,MAAM,UAAU,CAAA;AAgBrD;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAa;IAC1C,iBAAiB;IACjB,GAAG;IACH,aAAa;IACb,GAAG;CACJ,CAAA;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAa;IAChC,GAAG,kBAAkB;IACrB,UAAU;IACV,GAAG;IACH,MAAM;IACN,MAAM;IACN,KAA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IAAI,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,IAAI,CAAA;IACxD,MAAM,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,IAAI,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,IAAI,CAAA;IAExE,IAAI,gBAAgB,IAAI,aAAa,EAAE,CAAC;QACtC,MAAM,IAAI,KAAK,CACb,uEAAuE,CACxE,CAAA;IACH,CAAC;IACD,IAAI,gBAAgB;QAAE,OAAO,iBAAiB,CAAA;IAC9C,uEAAuE;IACvE,IAAI,aAAa;QAAE,OAAO,aAAa,CAAA;IACvC,IAAI,CAAC,SAAS;QAAE,OAAO,iBAAiB,CAAA;IACxC,OAAO,MAAM,CAAA;AACf,CAAC,CAAA;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,aAAqB,EAAU,EAAE,CACzD,KAAK,aAAa,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,CAAA;AAEzC;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,MAAc,EAAU,EAAE,CACxD,MAAM,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;AAEzC;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,MAAc,EAAU,EAAE,CACvD,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,MAAM,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAA"}
|
|
@@ -13,6 +13,8 @@ import { type CompletionShell } from '../../render/completion/index.js';
|
|
|
13
13
|
* the registered command's executor — one implementation for both.
|
|
14
14
|
*/
|
|
15
15
|
export declare const printCompletion: (shell: CompletionShell, spec: CommandSpec) => void;
|
|
16
|
+
/** Print the network-free loader installed in a shell completion directory. */
|
|
17
|
+
export declare const printCompletionLoader: (shell: CompletionShell) => void;
|
|
16
18
|
type BuildSpec = (blueprint: ApiBlueprint) => CommandSpec;
|
|
17
19
|
export declare const createCompletionCommands: (buildSpec: BuildSpec) => Command[];
|
|
18
20
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getOutput } from '../../output/get-output.js';
|
|
2
|
-
import { renderCompletion, } from '../../render/completion/index.js';
|
|
2
|
+
import { renderCompletion, renderCompletionStub, } from '../../render/completion/index.js';
|
|
3
3
|
/**
|
|
4
4
|
* Print the completion script for a shell.
|
|
5
5
|
*
|
|
@@ -13,17 +13,35 @@ import { renderCompletion, } from '../../render/completion/index.js';
|
|
|
13
13
|
export const printCompletion = (shell, spec) => {
|
|
14
14
|
getOutput().text(renderCompletion(shell, spec));
|
|
15
15
|
};
|
|
16
|
+
/** Print the network-free loader installed in a shell completion directory. */
|
|
17
|
+
export const printCompletionLoader = (shell) => {
|
|
18
|
+
getOutput().text(renderCompletionStub(shell));
|
|
19
|
+
};
|
|
16
20
|
const completionCommand = (shell, buildSpec) => ({
|
|
17
21
|
definition: {
|
|
18
22
|
path: ['completion', shell],
|
|
19
23
|
kind: 'cli',
|
|
20
24
|
title: `Print the ${shell} completion script.`,
|
|
21
25
|
description: '',
|
|
22
|
-
flags: [
|
|
26
|
+
flags: [
|
|
27
|
+
{
|
|
28
|
+
long: 'loader',
|
|
29
|
+
short: null,
|
|
30
|
+
description: 'Print the dynamic, network-free loader for installation by a package manager.',
|
|
31
|
+
values: [],
|
|
32
|
+
takesValue: false,
|
|
33
|
+
isRequired: false,
|
|
34
|
+
},
|
|
35
|
+
],
|
|
23
36
|
},
|
|
24
37
|
requiresAuth: false,
|
|
25
|
-
execute: async (
|
|
26
|
-
|
|
38
|
+
execute: async (invocation, ctx) => {
|
|
39
|
+
if (invocation.args['loader'] === true) {
|
|
40
|
+
printCompletionLoader(shell);
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
printCompletion(shell, buildSpec(ctx.blueprint));
|
|
44
|
+
}
|
|
27
45
|
return { kind: 'done' };
|
|
28
46
|
},
|
|
29
47
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"completion.js","sourceRoot":"","sources":["../../../src/lib/commands/local/completion.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,EAEL,gBAAgB,
|
|
1
|
+
{"version":3,"file":"completion.js","sourceRoot":"","sources":["../../../src/lib/commands/local/completion.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,EAEL,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,gCAAgC,CAAA;AAEvC;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,KAAsB,EACtB,IAAiB,EACX,EAAE;IACR,SAAS,EAAE,CAAC,IAAI,CAAC,gBAAgB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAA;AACjD,CAAC,CAAA;AAED,+EAA+E;AAC/E,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,KAAsB,EAAQ,EAAE;IACpE,SAAS,EAAE,CAAC,IAAI,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAAC,CAAA;AAC/C,CAAC,CAAA;AAID,MAAM,iBAAiB,GAAG,CACxB,KAAsB,EACtB,SAAoB,EACX,EAAE,CAAC,CAAC;IACb,UAAU,EAAE;QACV,IAAI,EAAE,CAAC,YAAY,EAAE,KAAK,CAAC;QAC3B,IAAI,EAAE,KAAK;QACX,KAAK,EAAE,aAAa,KAAK,qBAAqB;QAC9C,WAAW,EAAE,EAAE;QACf,KAAK,EAAE;YACL;gBACE,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,IAAI;gBACX,WAAW,EACT,+EAA+E;gBACjF,MAAM,EAAE,EAAE;gBACV,UAAU,EAAE,KAAK;gBACjB,UAAU,EAAE,KAAK;aAClB;SACF;KACF;IACD,YAAY,EAAE,KAAK;IACnB,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,EAAE;QACjC,IAAI,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,IAAI,EAAE,CAAC;YACvC,qBAAqB,CAAC,KAAK,CAAC,CAAA;QAC9B,CAAC;aAAM,CAAC;YACN,eAAe,CAAC,KAAK,EAAE,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAA;QAClD,CAAC;QACD,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAA;IACzB,CAAC;CACF,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,SAAoB,EAAa,EAAE,CAAC;IAC3E,iBAAiB,CAAC,MAAM,EAAE,SAAS,CAAC;IACpC,iBAAiB,CAAC,MAAM,EAAE,SAAS,CAAC;IACpC,iBAAiB,CAAC,KAAK,EAAE,SAAS,CAAC;CACpC,CAAA"}
|
|
@@ -2,11 +2,10 @@ import type { CommandSpec } from '../../commands/spec.js';
|
|
|
2
2
|
export declare const completionShells: readonly ["bash", "fish", "zsh"];
|
|
3
3
|
export type CompletionShell = (typeof completionShells)[number];
|
|
4
4
|
export declare const isCompletionShell: (shell: unknown) => shell is CompletionShell;
|
|
5
|
-
/** File name to install the completion script for each shell as. */
|
|
6
|
-
export declare const completionFileNames: Record<CompletionShell, string>;
|
|
7
5
|
export declare const renderCompletion: (shell: CompletionShell, spec: CommandSpec) => string;
|
|
8
6
|
/**
|
|
9
|
-
* Render the completion loader installed by system packages.
|
|
7
|
+
* Render the completion loader installed by system packages. The loader is
|
|
8
|
+
* embedded in the CLI and printed by `seam completion --loader <shell>`.
|
|
10
9
|
*
|
|
11
10
|
* The loader runs 'seam completion' the first time the shell completes a seam
|
|
12
11
|
* command, so installed completions always match the CLI's current Seam API
|
|
@@ -3,12 +3,6 @@ import { renderFishCompletion } from './render-fish.js';
|
|
|
3
3
|
import { renderZshCompletion } from './render-zsh.js';
|
|
4
4
|
export const completionShells = ['bash', 'fish', 'zsh'];
|
|
5
5
|
export const isCompletionShell = (shell) => completionShells.includes(shell);
|
|
6
|
-
/** File name to install the completion script for each shell as. */
|
|
7
|
-
export const completionFileNames = {
|
|
8
|
-
bash: 'seam.bash',
|
|
9
|
-
fish: 'seam.fish',
|
|
10
|
-
zsh: 'seam.zsh',
|
|
11
|
-
};
|
|
12
6
|
const renderers = {
|
|
13
7
|
bash: renderBashCompletion,
|
|
14
8
|
fish: renderFishCompletion,
|
|
@@ -16,7 +10,8 @@ const renderers = {
|
|
|
16
10
|
};
|
|
17
11
|
export const renderCompletion = (shell, spec) => renderers[shell](spec);
|
|
18
12
|
/**
|
|
19
|
-
* Render the completion loader installed by system packages.
|
|
13
|
+
* Render the completion loader installed by system packages. The loader is
|
|
14
|
+
* embedded in the CLI and printed by `seam completion --loader <shell>`.
|
|
20
15
|
*
|
|
21
16
|
* The loader runs 'seam completion' the first time the shell completes a seam
|
|
22
17
|
* command, so installed completions always match the CLI's current Seam API
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/render/completion/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAErD,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAU,CAAA;AAIhE,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,KAAc,EAA4B,EAAE,CAC5E,gBAAgB,CAAC,QAAQ,CAAC,KAAwB,CAAC,CAAA;AAErD,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/render/completion/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AACvD,OAAO,EAAE,oBAAoB,EAAE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version.d.ts
CHANGED
package/lib/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seamapi/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.27.1",
|
|
4
4
|
"description": "A command-line interface (CLI) for interacting with the Seam API.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -41,7 +41,6 @@
|
|
|
41
41
|
"index.js.map",
|
|
42
42
|
"index.d.ts",
|
|
43
43
|
"bin",
|
|
44
|
-
"completions",
|
|
45
44
|
"lib",
|
|
46
45
|
"src",
|
|
47
46
|
"!test",
|
package/src/bin/cli.ts
CHANGED
|
@@ -13,7 +13,10 @@ import {
|
|
|
13
13
|
} from 'lib/args/parse.js'
|
|
14
14
|
import { assertKnownArgs, assertNoAuthOverrides } from 'lib/args/validate.js'
|
|
15
15
|
import { getApiBlueprint } from 'lib/blueprint/index.js'
|
|
16
|
-
import {
|
|
16
|
+
import {
|
|
17
|
+
printCompletion,
|
|
18
|
+
printCompletionLoader,
|
|
19
|
+
} from 'lib/commands/local/completion.js'
|
|
17
20
|
import { runWizard } from 'lib/commands/local/wizard.js'
|
|
18
21
|
import {
|
|
19
22
|
acceptedParamsOf,
|
|
@@ -130,6 +133,11 @@ async function cli(args: ParsedArgs, argv: string[]) {
|
|
|
130
133
|
isLocal: true,
|
|
131
134
|
})
|
|
132
135
|
|
|
136
|
+
if (args['loader'] === true) {
|
|
137
|
+
printCompletionLoader(shell)
|
|
138
|
+
return
|
|
139
|
+
}
|
|
140
|
+
|
|
133
141
|
const cachedBlueprint = await getApiBlueprint({ update })
|
|
134
142
|
printCompletion(shell, buildRegistry(cachedBlueprint).spec)
|
|
135
143
|
return
|
|
@@ -244,7 +252,9 @@ const run = async (argv: string[]) => {
|
|
|
244
252
|
return
|
|
245
253
|
}
|
|
246
254
|
|
|
247
|
-
const args = parseCliArgs(argv
|
|
255
|
+
const args = parseCliArgs(argv, {
|
|
256
|
+
booleanKeys: argv[0]?.toLowerCase() === 'completion' ? ['loader'] : [],
|
|
257
|
+
})
|
|
248
258
|
|
|
249
259
|
const isTty = process.stdout.isTTY === true
|
|
250
260
|
|
package/src/lib/args/parse.ts
CHANGED
|
@@ -50,11 +50,13 @@ export interface ParseCliArgsOptions {
|
|
|
50
50
|
* lose leading zeroes or turn exponent notation into a digit string.
|
|
51
51
|
*/
|
|
52
52
|
stringKeys?: string[]
|
|
53
|
+
/** Argument keys that must not consume the following positional word. */
|
|
54
|
+
booleanKeys?: string[]
|
|
53
55
|
}
|
|
54
56
|
|
|
55
57
|
export const parseCliArgs = (
|
|
56
58
|
argv: string[],
|
|
57
|
-
{ stringKeys = [] }: ParseCliArgsOptions = {},
|
|
59
|
+
{ stringKeys = [], booleanKeys = [] }: ParseCliArgsOptions = {},
|
|
58
60
|
): ParsedArgs =>
|
|
59
61
|
parseArgs(argv, {
|
|
60
62
|
// A page cursor and a code are opaque even before the endpoint's own
|
|
@@ -70,7 +72,7 @@ export const parseCliArgs = (
|
|
|
70
72
|
'workspace_id',
|
|
71
73
|
...stringKeys,
|
|
72
74
|
],
|
|
73
|
-
boolean: ['non-interactive', 'interactive', 'json'],
|
|
75
|
+
boolean: ['non-interactive', 'interactive', 'json', ...booleanKeys],
|
|
74
76
|
// Deliberately not aliased to -n, which is reserved for a future
|
|
75
77
|
// --dry-run flag.
|
|
76
78
|
alias: { 'non-interactive': 'y', interactive: 'i' },
|
|
@@ -5,6 +5,7 @@ import { getOutput } from 'lib/output/get-output.js'
|
|
|
5
5
|
import {
|
|
6
6
|
type CompletionShell,
|
|
7
7
|
renderCompletion,
|
|
8
|
+
renderCompletionStub,
|
|
8
9
|
} from 'lib/render/completion/index.js'
|
|
9
10
|
|
|
10
11
|
/**
|
|
@@ -24,6 +25,11 @@ export const printCompletion = (
|
|
|
24
25
|
getOutput().text(renderCompletion(shell, spec))
|
|
25
26
|
}
|
|
26
27
|
|
|
28
|
+
/** Print the network-free loader installed in a shell completion directory. */
|
|
29
|
+
export const printCompletionLoader = (shell: CompletionShell): void => {
|
|
30
|
+
getOutput().text(renderCompletionStub(shell))
|
|
31
|
+
}
|
|
32
|
+
|
|
27
33
|
type BuildSpec = (blueprint: ApiBlueprint) => CommandSpec
|
|
28
34
|
|
|
29
35
|
const completionCommand = (
|
|
@@ -35,11 +41,25 @@ const completionCommand = (
|
|
|
35
41
|
kind: 'cli',
|
|
36
42
|
title: `Print the ${shell} completion script.`,
|
|
37
43
|
description: '',
|
|
38
|
-
flags: [
|
|
44
|
+
flags: [
|
|
45
|
+
{
|
|
46
|
+
long: 'loader',
|
|
47
|
+
short: null,
|
|
48
|
+
description:
|
|
49
|
+
'Print the dynamic, network-free loader for installation by a package manager.',
|
|
50
|
+
values: [],
|
|
51
|
+
takesValue: false,
|
|
52
|
+
isRequired: false,
|
|
53
|
+
},
|
|
54
|
+
],
|
|
39
55
|
},
|
|
40
56
|
requiresAuth: false,
|
|
41
|
-
execute: async (
|
|
42
|
-
|
|
57
|
+
execute: async (invocation, ctx) => {
|
|
58
|
+
if (invocation.args['loader'] === true) {
|
|
59
|
+
printCompletionLoader(shell)
|
|
60
|
+
} else {
|
|
61
|
+
printCompletion(shell, buildSpec(ctx.blueprint))
|
|
62
|
+
}
|
|
43
63
|
return { kind: 'done' }
|
|
44
64
|
},
|
|
45
65
|
})
|
|
@@ -11,13 +11,6 @@ export type CompletionShell = (typeof completionShells)[number]
|
|
|
11
11
|
export const isCompletionShell = (shell: unknown): shell is CompletionShell =>
|
|
12
12
|
completionShells.includes(shell as CompletionShell)
|
|
13
13
|
|
|
14
|
-
/** File name to install the completion script for each shell as. */
|
|
15
|
-
export const completionFileNames: Record<CompletionShell, string> = {
|
|
16
|
-
bash: 'seam.bash',
|
|
17
|
-
fish: 'seam.fish',
|
|
18
|
-
zsh: 'seam.zsh',
|
|
19
|
-
}
|
|
20
|
-
|
|
21
14
|
const renderers: Record<CompletionShell, (spec: CommandSpec) => string> = {
|
|
22
15
|
bash: renderBashCompletion,
|
|
23
16
|
fish: renderFishCompletion,
|
|
@@ -30,7 +23,8 @@ export const renderCompletion = (
|
|
|
30
23
|
): string => renderers[shell](spec)
|
|
31
24
|
|
|
32
25
|
/**
|
|
33
|
-
* Render the completion loader installed by system packages.
|
|
26
|
+
* Render the completion loader installed by system packages. The loader is
|
|
27
|
+
* embedded in the CLI and printed by `seam completion --loader <shell>`.
|
|
34
28
|
*
|
|
35
29
|
* The loader runs 'seam completion' the first time the shell completes a seam
|
|
36
30
|
* command, so installed completions always match the CLI's current Seam API
|
package/src/lib/version.ts
CHANGED
package/completions/seam.bash
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
# bash completion loader for the seam command.
|
|
2
|
-
#
|
|
3
|
-
# Generated by @seamapi/cli. Loads completions from the CLI on first use, so
|
|
4
|
-
# they always match the CLI's current Seam API schema. Requires the seam
|
|
5
|
-
# command on PATH. Print the underlying script with 'seam completion bash'.
|
|
6
|
-
#
|
|
7
|
-
# Install to /usr/share/bash-completion/completions/seam
|
|
8
|
-
|
|
9
|
-
if command -v seam > /dev/null 2>&1; then
|
|
10
|
-
__seam_completion_script="$(seam completion bash 2> /dev/null)"
|
|
11
|
-
# Evaluate only a completion script, never anything else the CLI printed.
|
|
12
|
-
case "$__seam_completion_script" in
|
|
13
|
-
'# bash completion for the seam command.'*) eval "$__seam_completion_script" ;;
|
|
14
|
-
esac
|
|
15
|
-
unset __seam_completion_script
|
|
16
|
-
fi
|
package/completions/seam.fish
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
# fish completion loader for the seam command.
|
|
2
|
-
#
|
|
3
|
-
# Generated by @seamapi/cli. Loads completions from the CLI on first use, so
|
|
4
|
-
# they always match the CLI's current Seam API schema. Requires the seam
|
|
5
|
-
# command on PATH. Print the underlying script with 'seam completion fish'.
|
|
6
|
-
#
|
|
7
|
-
# Install to /usr/share/fish/vendor_completions.d/seam.fish
|
|
8
|
-
|
|
9
|
-
if command --query seam
|
|
10
|
-
set -l __seam_completion_script (seam completion fish 2> /dev/null | string collect)
|
|
11
|
-
# Source only a completion script, never anything else the CLI printed.
|
|
12
|
-
if string match --quiet '# fish completion for the seam command.*' -- $__seam_completion_script
|
|
13
|
-
printf '%s\n' $__seam_completion_script | source
|
|
14
|
-
end
|
|
15
|
-
end
|
package/completions/seam.zsh
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
#compdef seam
|
|
2
|
-
# zsh completion loader for the seam command.
|
|
3
|
-
#
|
|
4
|
-
# Generated by @seamapi/cli. Loads completions from the CLI on first use, so
|
|
5
|
-
# they always match the CLI's current Seam API schema. Requires the seam
|
|
6
|
-
# command on PATH. Print the underlying script with 'seam completion zsh'.
|
|
7
|
-
#
|
|
8
|
-
# Install to a directory in fpath as _seam
|
|
9
|
-
|
|
10
|
-
local __seam_completion_script
|
|
11
|
-
__seam_completion_script="$(seam completion zsh 2> /dev/null)"
|
|
12
|
-
|
|
13
|
-
# Evaluate only a completion script, never anything else the CLI printed.
|
|
14
|
-
# The script ends by dispatching on funcstack, so evaluating it while this
|
|
15
|
-
# autoloaded _seam runs both redefines _seam and completes the in-flight
|
|
16
|
-
# request.
|
|
17
|
-
if [[ "$__seam_completion_script" == '#compdef seam'* ]]; then
|
|
18
|
-
eval "$__seam_completion_script"
|
|
19
|
-
fi
|