@seamapi/cli 0.25.0 → 0.26.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/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/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +4 -2
- package/src/lib/commands/local/wizard.ts +45 -3
- package/src/lib/version.ts +1 -1
|
@@ -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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SAAS,CAAC,CAAA;IAE/D,OAAO;QACL,QAAQ;QACR,MAAM,EAAE,KAAK,IAAI,IAAI,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI;QACvD,WAAW;KACZ,CAAA;AACH,CAAC,CAAA;AAED,MAAM,aAAa,GAAG,CAAC,IAAY,EAAkB,EAAE;IACrD,MAAM,KAAK,GAAG,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"}
|
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.26.0",
|
|
4
4
|
"description": "A command-line interface (CLI) for interacting with the Seam API.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -87,11 +87,13 @@
|
|
|
87
87
|
"onFail": "warn"
|
|
88
88
|
}
|
|
89
89
|
},
|
|
90
|
+
"optionalDependencies": {
|
|
91
|
+
"@seamapi/wizard": "0.8.0"
|
|
92
|
+
},
|
|
90
93
|
"dependencies": {
|
|
91
94
|
"@clack/prompts": "^1.7.0",
|
|
92
95
|
"@seamapi/blueprint": "1.5.0",
|
|
93
96
|
"@seamapi/http": "2.3.0",
|
|
94
|
-
"@seamapi/wizard": "0.8.0",
|
|
95
97
|
"chalk": "^6.0.0",
|
|
96
98
|
"command-line-usage": "^7.0.4",
|
|
97
99
|
"configstore": "^8.0.0",
|
|
@@ -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 = ({
|
package/src/lib/version.ts
CHANGED