@seamapi/cli 0.25.0 → 0.27.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/README.md +12 -7
- package/bin/cli.js +5 -1
- package/bin/cli.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/commands/local/wizard.d.ts +8 -2
- package/lib/commands/local/wizard.js +27 -8
- package/lib/commands/local/wizard.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 +4 -3
- package/src/bin/cli.ts +9 -1
- package/src/lib/commands/local/completion.ts +23 -3
- package/src/lib/commands/local/wizard.ts +45 -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 <shell> --loader`.
|
|
311
|
+
For example, a package can install the Bash loader with:
|
|
312
|
+
|
|
313
|
+
```sh
|
|
314
|
+
seam completion bash --loader > /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;
|
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,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AAK,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"}
|
|
@@ -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,CAA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E,SAAS,CAAC;CACpC,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { WizardAdapter } from '@seamapi/wizard';
|
|
1
|
+
import type { default as wizard, WizardAdapter } from '@seamapi/wizard';
|
|
2
2
|
import type { Command } from '../../commands/registry.js';
|
|
3
3
|
import { type CliConfig } from '../../config/index.js';
|
|
4
4
|
/**
|
|
@@ -7,10 +7,16 @@ import { type CliConfig } from '../../config/index.js';
|
|
|
7
7
|
* Intercepted by the entry before argument parsing so the wizard owns its
|
|
8
8
|
* own argv; the registered executor covers selecting it interactively.
|
|
9
9
|
*/
|
|
10
|
-
|
|
10
|
+
type Wizard = typeof wizard;
|
|
11
|
+
type WizardModule = {
|
|
12
|
+
default: Wizard;
|
|
13
|
+
};
|
|
14
|
+
type LoadWizard = () => Promise<WizardModule>;
|
|
15
|
+
export declare const runWizard: (argv: string[], load?: LoadWizard) => Promise<void>;
|
|
11
16
|
export declare const wizardCommand: Command;
|
|
12
17
|
export declare const createWizardAdapter: ({ cliConfig, configPath, statePath, }?: {
|
|
13
18
|
cliConfig?: CliConfig;
|
|
14
19
|
configPath?: string;
|
|
15
20
|
statePath?: string;
|
|
16
21
|
}) => WizardAdapter;
|
|
22
|
+
export {};
|
|
@@ -3,14 +3,28 @@ import { isApiKey } from '@seamapi/http';
|
|
|
3
3
|
import Configstore from 'configstore';
|
|
4
4
|
import { getConfig, rootPaths } from '../../config/index.js';
|
|
5
5
|
import { resolveAuth } from '../../context.js';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
6
|
+
import { UsageError } from '../../errors.js';
|
|
7
|
+
const loadWizard = async () => await import('@seamapi/wizard');
|
|
8
|
+
export const runWizard = async (argv, load = loadWizard) => {
|
|
9
|
+
let wizard;
|
|
10
|
+
try {
|
|
11
|
+
const module = await load();
|
|
12
|
+
wizard = module.default;
|
|
13
|
+
}
|
|
14
|
+
catch (error) {
|
|
15
|
+
if (isMissingWizard(error)) {
|
|
16
|
+
throw new UsageError([
|
|
17
|
+
'The Seam Wizard is not available in this installation.',
|
|
18
|
+
'',
|
|
19
|
+
'This is most likely because the packaging source does not allow software that includes dependencies with non-commercial licenses, including the Claude SDK used by the Wizard.',
|
|
20
|
+
'',
|
|
21
|
+
'To use the Wizard, install the Seam CLI from npm:',
|
|
22
|
+
'',
|
|
23
|
+
' npm i -g seam',
|
|
24
|
+
].join('\n'));
|
|
25
|
+
}
|
|
26
|
+
throw error;
|
|
27
|
+
}
|
|
14
28
|
await wizard({
|
|
15
29
|
argv,
|
|
16
30
|
commandName: 'seam wizard',
|
|
@@ -31,6 +45,11 @@ export const wizardCommand = {
|
|
|
31
45
|
return { kind: 'done' };
|
|
32
46
|
},
|
|
33
47
|
};
|
|
48
|
+
const isMissingWizard = (error) => error instanceof Error &&
|
|
49
|
+
'code' in error &&
|
|
50
|
+
(error.code === 'ERR_MODULE_NOT_FOUND' ||
|
|
51
|
+
error.code === 'MODULE_NOT_FOUND') &&
|
|
52
|
+
error.message.includes("'@seamapi/wizard'");
|
|
34
53
|
const wizardFileName = 'wizard.json';
|
|
35
54
|
export const createWizardAdapter = ({ cliConfig = getConfig(), configPath = join(rootPaths.config, wizardFileName), statePath = join(rootPaths.log, wizardFileName), } = {}) => ({
|
|
36
55
|
getAuth: async () => toWizardAuth(cliConfig),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wizard.js","sourceRoot":"","sources":["../../../src/lib/commands/local/wizard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"wizard.js","sourceRoot":"","sources":["../../../src/lib/commands/local/wizard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC,OAAO,EAAE,QA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IAAI,WAAW,CAAC,UAAU,EAAE,SAAS,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAA;IAE1E,OAAO;QACL,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC;QAClC,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE;YACxB,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;QACvB,CAAC;KACF,CAAA;AACH,CAAC,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 <shell> --loader`.
|
|
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 <shell> --loader`.
|
|
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,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,MAAM,SAAS,GAA2D;IACxE,IAAI,EAAE,oBAAoB;IAC1B,IAAI,EAAE,oBAAoB;IAC1B,GAAG,EAAE,mBAAmB;CACzB,CAAA;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,KAAsB,EACtB,IAAiB,EACT,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAA;AAEnC;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,KAAsB,EAAU,EAAE,CACrE,KAAK,CAAC,KAAK,CAAC,CAAA;AAEd;;;GAGG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAoC;IACxE,IAAI,EAAE,yCAAyC;IAC/C,IAAI,EAAE,yCAAyC;IAC/C,GAAG,EAAE,eAAe;CACrB,CAAA;AAED,MAAM,UAAU,GAAG,CAAC,KAAsB,EAAU,EAAE,CACpD,KAAK,KAAK;;;;uEAI2D,KAAK,IAAI,CAAA;AAEhF,MAAM,KAAK,GAAoC;IAC7C,IAAI,EAAE,GAAG,UAAU,CAAC,MAAM,CAAC;;;;;;;;OAQtB,yBAAyB,CAAC,IAAI;;;;CAIpC;IACC,IAAI,EAAE,GAAG,UAAU,CAAC,MAAM,CAAC;;;;;;;+BAOE,yBAAyB,CAAC,IAAI;;;;CAI5D;IACC,GAAG,EAAE;EACL,UAAU,CAAC,KAAK,CAAC;;;;;;;;;;;wCAWqB,yBAAyB,CAAC,GAAG;;;CAGpE;CACA,CAAA"}
|
package/lib/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.0",
|
|
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",
|
|
@@ -87,11 +86,13 @@
|
|
|
87
86
|
"onFail": "warn"
|
|
88
87
|
}
|
|
89
88
|
},
|
|
89
|
+
"optionalDependencies": {
|
|
90
|
+
"@seamapi/wizard": "0.8.0"
|
|
91
|
+
},
|
|
90
92
|
"dependencies": {
|
|
91
93
|
"@clack/prompts": "^1.7.0",
|
|
92
94
|
"@seamapi/blueprint": "1.5.0",
|
|
93
95
|
"@seamapi/http": "2.3.0",
|
|
94
|
-
"@seamapi/wizard": "0.8.0",
|
|
95
96
|
"chalk": "^6.0.0",
|
|
96
97
|
"command-line-usage": "^7.0.4",
|
|
97
98
|
"configstore": "^8.0.0",
|
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
|
|
@@ -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
|
})
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import { join } from 'node:path'
|
|
2
2
|
|
|
3
3
|
import { isApiKey } from '@seamapi/http'
|
|
4
|
-
import type {
|
|
4
|
+
import type {
|
|
5
|
+
default as wizard,
|
|
6
|
+
StorageAdapter,
|
|
7
|
+
WizardAdapter,
|
|
8
|
+
WizardAuth,
|
|
9
|
+
} from '@seamapi/wizard'
|
|
5
10
|
import Configstore from 'configstore'
|
|
6
11
|
|
|
7
12
|
import type { Command } from 'lib/commands/registry.js'
|
|
8
13
|
import { type CliConfig, getConfig, rootPaths } from 'lib/config/index.js'
|
|
9
14
|
import { resolveAuth } from 'lib/context.js'
|
|
15
|
+
import { UsageError } from 'lib/errors.js'
|
|
10
16
|
|
|
11
17
|
/**
|
|
12
18
|
* Run the Seam setup wizard.
|
|
@@ -14,8 +20,37 @@ import { resolveAuth } from 'lib/context.js'
|
|
|
14
20
|
* Intercepted by the entry before argument parsing so the wizard owns its
|
|
15
21
|
* own argv; the registered executor covers selecting it interactively.
|
|
16
22
|
*/
|
|
17
|
-
|
|
18
|
-
|
|
23
|
+
type Wizard = typeof wizard
|
|
24
|
+
type WizardModule = { default: Wizard }
|
|
25
|
+
type LoadWizard = () => Promise<WizardModule>
|
|
26
|
+
|
|
27
|
+
const loadWizard: LoadWizard = async () => await import('@seamapi/wizard')
|
|
28
|
+
|
|
29
|
+
export const runWizard = async (
|
|
30
|
+
argv: string[],
|
|
31
|
+
load: LoadWizard = loadWizard,
|
|
32
|
+
): Promise<void> => {
|
|
33
|
+
let wizard: Wizard
|
|
34
|
+
try {
|
|
35
|
+
const module = await load()
|
|
36
|
+
wizard = module.default
|
|
37
|
+
} catch (error) {
|
|
38
|
+
if (isMissingWizard(error)) {
|
|
39
|
+
throw new UsageError(
|
|
40
|
+
[
|
|
41
|
+
'The Seam Wizard is not available in this installation.',
|
|
42
|
+
'',
|
|
43
|
+
'This is most likely because the packaging source does not allow software that includes dependencies with non-commercial licenses, including the Claude SDK used by the Wizard.',
|
|
44
|
+
'',
|
|
45
|
+
'To use the Wizard, install the Seam CLI from npm:',
|
|
46
|
+
'',
|
|
47
|
+
' npm i -g seam',
|
|
48
|
+
].join('\n'),
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
throw error
|
|
52
|
+
}
|
|
53
|
+
|
|
19
54
|
await wizard({
|
|
20
55
|
argv,
|
|
21
56
|
commandName: 'seam wizard',
|
|
@@ -39,6 +74,13 @@ export const wizardCommand: Command = {
|
|
|
39
74
|
},
|
|
40
75
|
}
|
|
41
76
|
|
|
77
|
+
const isMissingWizard = (error: unknown): boolean =>
|
|
78
|
+
error instanceof Error &&
|
|
79
|
+
'code' in error &&
|
|
80
|
+
(error.code === 'ERR_MODULE_NOT_FOUND' ||
|
|
81
|
+
error.code === 'MODULE_NOT_FOUND') &&
|
|
82
|
+
error.message.includes("'@seamapi/wizard'")
|
|
83
|
+
|
|
42
84
|
const wizardFileName = 'wizard.json'
|
|
43
85
|
|
|
44
86
|
export const createWizardAdapter = ({
|
|
@@ -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 <shell> --loader`.
|
|
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
|