@sanity/runtime-cli 14.11.0 → 14.12.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 +45 -43
- package/dist/actions/blueprints/blueprint.d.ts +49 -16
- package/dist/actions/blueprints/blueprint.js +97 -139
- package/dist/actions/blueprints/resolve.d.ts +51 -0
- package/dist/actions/blueprints/resolve.js +52 -0
- package/dist/actions/blueprints/resources.js +35 -12
- package/dist/actions/functions/dev.d.ts +1 -2
- package/dist/actions/functions/dev.js +2 -2
- package/dist/baseCommands.d.ts +47 -30
- package/dist/baseCommands.js +187 -72
- package/dist/commands/blueprints/add.d.ts +3 -2
- package/dist/commands/blueprints/add.js +3 -2
- package/dist/commands/blueprints/config.d.ts +3 -2
- package/dist/commands/blueprints/config.js +3 -2
- package/dist/commands/blueprints/deploy.d.ts +3 -2
- package/dist/commands/blueprints/deploy.js +4 -3
- package/dist/commands/blueprints/destroy.d.ts +3 -2
- package/dist/commands/blueprints/destroy.js +3 -2
- package/dist/commands/blueprints/doctor.d.ts +0 -1
- package/dist/commands/blueprints/doctor.js +2 -3
- package/dist/commands/blueprints/info.d.ts +4 -2
- package/dist/commands/blueprints/info.js +6 -3
- package/dist/commands/blueprints/init.d.ts +0 -1
- package/dist/commands/blueprints/init.js +1 -2
- package/dist/commands/blueprints/logs.d.ts +3 -2
- package/dist/commands/blueprints/logs.js +4 -3
- package/dist/commands/blueprints/plan.d.ts +3 -2
- package/dist/commands/blueprints/plan.js +5 -3
- package/dist/commands/blueprints/promote.d.ts +3 -2
- package/dist/commands/blueprints/promote.js +3 -2
- package/dist/commands/blueprints/stacks.d.ts +3 -2
- package/dist/commands/blueprints/stacks.js +3 -2
- package/dist/commands/functions/add.d.ts +3 -2
- package/dist/commands/functions/add.js +4 -3
- package/dist/commands/functions/build.d.ts +3 -2
- package/dist/commands/functions/build.js +3 -2
- package/dist/commands/functions/dev.d.ts +3 -2
- package/dist/commands/functions/dev.js +3 -2
- package/dist/commands/functions/env/add.d.ts +3 -2
- package/dist/commands/functions/env/add.js +3 -2
- package/dist/commands/functions/env/list.d.ts +3 -2
- package/dist/commands/functions/env/list.js +3 -2
- package/dist/commands/functions/env/remove.d.ts +3 -2
- package/dist/commands/functions/env/remove.js +3 -2
- package/dist/commands/functions/logs.d.ts +3 -2
- package/dist/commands/functions/logs.js +4 -3
- package/dist/commands/functions/test.d.ts +3 -2
- package/dist/commands/functions/test.js +3 -2
- package/dist/constants.d.ts +15 -2
- package/dist/constants.js +14 -10
- package/dist/cores/blueprints/config.js +9 -4
- package/dist/cores/blueprints/destroy.js +78 -56
- package/dist/cores/blueprints/doctor.js +19 -5
- package/dist/cores/blueprints/init.js +2 -2
- package/dist/cores/functions/add.js +11 -7
- package/dist/cores/functions/dev.js +1 -1
- package/dist/server/app.d.ts +1 -2
- package/dist/server/app.js +16 -8
- package/dist/server/handlers/invoke.d.ts +1 -2
- package/dist/server/handlers/invoke.js +4 -4
- package/dist/server/static/components/rule-panel.js +8 -10
- package/oclif.manifest.json +503 -73
- package/package.json +2 -2
package/dist/baseCommands.js
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
// * https://oclif.io/docs/base_class
|
|
2
2
|
import { Command, CommandHelp, Flags as OclifFlags } from '@oclif/core';
|
|
3
|
-
import {
|
|
3
|
+
import { findBlueprintFile, loadBlueprintFile, parseBlueprintContent, } from './actions/blueprints/blueprint.js';
|
|
4
|
+
import { backfillProjectBasedStackId, readConfigFile } from './actions/blueprints/config.js';
|
|
5
|
+
import { resolveIds } from './actions/blueprints/resolve.js';
|
|
6
|
+
import { getStack, resolveStackIdByNameOrId } from './actions/blueprints/stacks.js';
|
|
7
|
+
import { presentBlueprintParserErrors } from './utils/display/errors.js';
|
|
4
8
|
import { Logger } from './utils/logger.js';
|
|
9
|
+
import { validTokenOrErrorMessage } from './utils/validated-token.js';
|
|
5
10
|
/**
|
|
6
11
|
* Fallback error-to-hint patterns for RuntimeCommand.catch().
|
|
7
12
|
* Each entry maps a regex to a function that returns suggestion strings.
|
|
@@ -11,23 +16,25 @@ const CATCH_HINT_PATTERNS = [
|
|
|
11
16
|
// Add patterns here as needed, for example:
|
|
12
17
|
// [/scope/i, (bin) => [`Run \`npx ${bin} blueprints promote\` to change the Stack scope.`]],
|
|
13
18
|
];
|
|
14
|
-
const
|
|
19
|
+
export const pathFlagConfig = {
|
|
20
|
+
description: 'Path to a Blueprint file or directory containing one',
|
|
21
|
+
env: 'SANITY_BLUEPRINT_PATH',
|
|
22
|
+
aliases: ['blueprint-path'],
|
|
23
|
+
char: 'p',
|
|
24
|
+
};
|
|
15
25
|
export const baseFlags = {
|
|
16
26
|
json: OclifFlags.boolean({
|
|
17
27
|
// override defaults from oclif's built-in --json flag
|
|
18
28
|
description: 'Format output as json',
|
|
19
29
|
}),
|
|
20
30
|
path: OclifFlags.string({
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
aliases: ['blueprint-path'],
|
|
24
|
-
char: 'p',
|
|
25
|
-
hidden,
|
|
31
|
+
...pathFlagConfig,
|
|
32
|
+
hidden: true,
|
|
26
33
|
}),
|
|
27
34
|
trace: OclifFlags.boolean({
|
|
28
35
|
description: 'Trace output',
|
|
29
36
|
default: false,
|
|
30
|
-
hidden,
|
|
37
|
+
hidden: true,
|
|
31
38
|
}),
|
|
32
39
|
'validate-resources': OclifFlags.boolean({
|
|
33
40
|
description: 'Validate resources',
|
|
@@ -37,13 +44,12 @@ export const baseFlags = {
|
|
|
37
44
|
verbose: OclifFlags.boolean({
|
|
38
45
|
description: 'Verbose output',
|
|
39
46
|
default: false,
|
|
40
|
-
hidden,
|
|
47
|
+
hidden: true,
|
|
41
48
|
}),
|
|
42
49
|
};
|
|
43
|
-
export const
|
|
50
|
+
export const stackFlagConfig = {
|
|
44
51
|
description: 'Stack name or ID to use instead of the locally configured Stack',
|
|
45
|
-
|
|
46
|
-
});
|
|
52
|
+
};
|
|
47
53
|
export const projectIdFlagConfig = {
|
|
48
54
|
description: 'Sanity project ID used to scope Blueprint and Stack',
|
|
49
55
|
aliases: ['project', 'projectId'],
|
|
@@ -52,13 +58,6 @@ export const organizationIdFlagConfig = {
|
|
|
52
58
|
description: 'Sanity organization ID used to scope Blueprint and Stack',
|
|
53
59
|
aliases: ['organization', 'organizationId', 'org'],
|
|
54
60
|
};
|
|
55
|
-
/**
|
|
56
|
-
* Unhides a flag by setting its hidden property to false
|
|
57
|
-
* Also makes oclif's types happy when destructuring the flag
|
|
58
|
-
*/
|
|
59
|
-
export function unhide(flag) {
|
|
60
|
-
return { ...flag, hidden: false };
|
|
61
|
-
}
|
|
62
61
|
/**
|
|
63
62
|
* Guarantees flags and args.
|
|
64
63
|
* Also centralizes baseFlags and enables oclif's built-in --json for all subclasses.
|
|
@@ -155,69 +154,185 @@ export class RuntimeCommand extends Command {
|
|
|
155
154
|
}
|
|
156
155
|
}
|
|
157
156
|
/**
|
|
158
|
-
*
|
|
159
|
-
*
|
|
157
|
+
* Base command that resolves context declaratively from a `static needs` array.
|
|
158
|
+
* Commands declare what they *directly use*; the base class resolves transitive
|
|
159
|
+
* dependencies automatically (e.g. 'deployedStack' implies token, scope, stackId).
|
|
160
|
+
*
|
|
161
|
+
* When a command needs only remote context (e.g. `['deployedStack']`),
|
|
162
|
+
* no local blueprint file is required -- flags and config are sufficient.
|
|
163
|
+
*
|
|
164
|
+
* @example
|
|
165
|
+
* ```ts
|
|
166
|
+
* class InfoCommand extends ResolvedCommand<typeof InfoCommand> {
|
|
167
|
+
* static needs = ['deployedStack'] as const
|
|
168
|
+
* // token, scope, stackId resolved automatically
|
|
169
|
+
* }
|
|
170
|
+
* ```
|
|
171
|
+
*
|
|
160
172
|
* @extends RuntimeCommand
|
|
161
173
|
*/
|
|
162
|
-
export class
|
|
174
|
+
export class ResolvedCommand extends RuntimeCommand {
|
|
175
|
+
static needs = [];
|
|
176
|
+
static baseFlags = {
|
|
177
|
+
...baseFlags,
|
|
178
|
+
stack: OclifFlags.string({ ...stackFlagConfig, hidden: true }),
|
|
179
|
+
'project-id': OclifFlags.string({ ...projectIdFlagConfig, hidden: true }),
|
|
180
|
+
'organization-id': OclifFlags.string({ ...organizationIdFlagConfig, hidden: true }),
|
|
181
|
+
};
|
|
182
|
+
// Populated by init() according to `needs`
|
|
163
183
|
sanityToken;
|
|
164
184
|
blueprint;
|
|
165
|
-
static baseFlags = baseFlags;
|
|
166
|
-
async init() {
|
|
167
|
-
await super.init();
|
|
168
|
-
const result = await initBlueprintConfig({
|
|
169
|
-
bin: this.config.bin,
|
|
170
|
-
log: Logger(this.log.bind(this), this.flags),
|
|
171
|
-
validateResources: this.flags['validate-resources'],
|
|
172
|
-
blueprintPath: this.flags.path,
|
|
173
|
-
});
|
|
174
|
-
if (!result.ok) {
|
|
175
|
-
const suggestions = [];
|
|
176
|
-
if (/token|login/i.test(result.error)) {
|
|
177
|
-
suggestions.push('Run `npx @sanity/cli login` to authenticate.');
|
|
178
|
-
}
|
|
179
|
-
else if (/blueprint/i.test(result.error) && /error/i.test(result.error)) {
|
|
180
|
-
suggestions.push('Fix the Blueprint errors listed above.');
|
|
181
|
-
}
|
|
182
|
-
suggestions.push(`Run \`${this.config.bin} blueprints doctor\` to check your configuration.`);
|
|
183
|
-
this.error(result.error, { suggestions });
|
|
184
|
-
}
|
|
185
|
-
this.sanityToken = result.value.token;
|
|
186
|
-
this.blueprint = result.value.blueprint;
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
/**
|
|
190
|
-
* Guarantees flags, args, sanityToken, blueprint, scopeType, scopeId, stackId, auth, and deployedStack.
|
|
191
|
-
* If scope or stack is missing, the command exits with an error
|
|
192
|
-
* @extends LocalBlueprintCommand
|
|
193
|
-
*/
|
|
194
|
-
export class DeployedStackCommand extends LocalBlueprintCommand {
|
|
195
|
-
auth;
|
|
196
|
-
deployedStack;
|
|
197
185
|
scopeType;
|
|
198
186
|
scopeId;
|
|
199
187
|
stackId;
|
|
200
|
-
|
|
188
|
+
auth;
|
|
189
|
+
deployedStack;
|
|
201
190
|
async init() {
|
|
202
|
-
await super.init();
|
|
203
|
-
const
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
191
|
+
await super.init(); // RuntimeCommand: parse flags + args
|
|
192
|
+
const needs = new Set(this.constructor.needs);
|
|
193
|
+
if (needs.size === 0)
|
|
194
|
+
return;
|
|
195
|
+
const log = Logger(this.log.bind(this), this.flags);
|
|
196
|
+
const needsToken = needs.has('token') || needs.has('scope') || needs.has('stackId') || needs.has('deployedStack');
|
|
197
|
+
const needsScope = needs.has('scope') || needs.has('deployedStack');
|
|
198
|
+
const needsStack = needs.has('stackId') || needs.has('deployedStack');
|
|
199
|
+
const needsBlueprint = needs.has('blueprint');
|
|
200
|
+
const needsDeployedStack = needs.has('deployedStack');
|
|
201
|
+
// 1. Token
|
|
202
|
+
if (needsToken) {
|
|
203
|
+
const check = await validTokenOrErrorMessage(log);
|
|
204
|
+
if (!check.ok) {
|
|
205
|
+
this.error(check.error.message, {
|
|
206
|
+
suggestions: ['Run `npx @sanity/cli login` to authenticate.'],
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
this.sanityToken = check.value;
|
|
210
|
+
}
|
|
211
|
+
// 2. Read config file (cheap single-file JSON read).
|
|
212
|
+
// Anchor to --path flag or the blueprint file location if found, else cwd.
|
|
213
|
+
const blueprintFileInfo = findBlueprintFile(this.flags.path);
|
|
214
|
+
const blueprintConfig = readConfigFile(blueprintFileInfo?.blueprintFilePath);
|
|
215
|
+
// 3. Blueprint (if needed)
|
|
216
|
+
let blueprintModule;
|
|
217
|
+
if (needsBlueprint) {
|
|
218
|
+
if (!blueprintFileInfo) {
|
|
219
|
+
this.error('Could not find Blueprint file! Use the `blueprints init` command.', {
|
|
220
|
+
suggestions: [
|
|
221
|
+
`Run \`${this.config.bin} blueprints init\` to create one.`,
|
|
222
|
+
`Run \`${this.config.bin} blueprints doctor\` to check your configuration.`,
|
|
223
|
+
],
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
const loaded = await loadBlueprintFile(blueprintFileInfo);
|
|
227
|
+
const parsed = parseBlueprintContent(loaded.rawBlueprint, {
|
|
228
|
+
validateResources: this.flags['validate-resources'],
|
|
229
|
+
});
|
|
230
|
+
if (parsed.errors.length > 0) {
|
|
231
|
+
log(presentBlueprintParserErrors(parsed.errors));
|
|
232
|
+
this.error('Blueprint file contains errors.', {
|
|
233
|
+
suggestions: [
|
|
234
|
+
'Fix the Blueprint errors listed above.',
|
|
235
|
+
`Run \`${this.config.bin} blueprints doctor\` to check your configuration.`,
|
|
236
|
+
],
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
blueprintModule = loaded.module;
|
|
240
|
+
// Assemble the full ReadBlueprintResult -- will be completed with resolved IDs below
|
|
241
|
+
this.blueprint = {
|
|
242
|
+
fileInfo: blueprintFileInfo,
|
|
243
|
+
blueprintConfig,
|
|
244
|
+
rawBlueprint: loaded.rawBlueprint,
|
|
245
|
+
...parsed,
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
// 4. Resolve IDs
|
|
249
|
+
const resolved = resolveIds({
|
|
250
|
+
flags: {
|
|
251
|
+
projectId: this.flags['project-id'],
|
|
252
|
+
organizationId: this.flags['organization-id'],
|
|
253
|
+
},
|
|
254
|
+
module: blueprintModule,
|
|
255
|
+
config: blueprintConfig,
|
|
211
256
|
});
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
257
|
+
// Legacy stack ID inference (only when we have a blueprint file path for the write side-effect)
|
|
258
|
+
if (!resolved.stackId && resolved.projectId && blueprintFileInfo) {
|
|
259
|
+
try {
|
|
260
|
+
const inferred = await backfillProjectBasedStackId({
|
|
261
|
+
blueprintFilePath: blueprintFileInfo.blueprintFilePath,
|
|
262
|
+
projectId: resolved.projectId,
|
|
263
|
+
logger: log,
|
|
264
|
+
});
|
|
265
|
+
if (inferred) {
|
|
266
|
+
resolved.stackId = inferred;
|
|
267
|
+
resolved.sources.stackId = 'inferred';
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
catch {
|
|
271
|
+
// assumption was wrong; leave stackId undefined
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
// Backfill resolved IDs onto the blueprint result if it was loaded
|
|
275
|
+
if (this.blueprint) {
|
|
276
|
+
Object.assign(this.blueprint, {
|
|
277
|
+
organizationId: resolved.organizationId,
|
|
278
|
+
projectId: resolved.projectId,
|
|
279
|
+
stackId: resolved.stackId,
|
|
280
|
+
scopeType: resolved.scopeType,
|
|
281
|
+
scopeId: resolved.scopeId,
|
|
282
|
+
sources: resolved.sources,
|
|
215
283
|
});
|
|
216
284
|
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
285
|
+
// 5. Scope
|
|
286
|
+
if (needsScope) {
|
|
287
|
+
if (!resolved.scopeType || !resolved.scopeId) {
|
|
288
|
+
this.error('Missing scope: provide --project-id or --organization-id, or configure a Blueprint.', {
|
|
289
|
+
suggestions: [
|
|
290
|
+
`Run \`${this.config.bin} blueprints doctor\` to check your configuration.`,
|
|
291
|
+
],
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
this.scopeType = resolved.scopeType;
|
|
295
|
+
this.scopeId = resolved.scopeId;
|
|
296
|
+
}
|
|
297
|
+
// 6. Stack
|
|
298
|
+
if (needsStack) {
|
|
299
|
+
let { stackId } = resolved;
|
|
300
|
+
const stackOverride = this.flags.stack;
|
|
301
|
+
if (stackOverride) {
|
|
302
|
+
const auth = {
|
|
303
|
+
token: this.sanityToken,
|
|
304
|
+
scopeType: this.scopeType,
|
|
305
|
+
scopeId: this.scopeId,
|
|
306
|
+
};
|
|
307
|
+
stackId = await resolveStackIdByNameOrId(stackOverride, auth, log);
|
|
308
|
+
}
|
|
309
|
+
if (!stackId) {
|
|
310
|
+
this.error('Missing Stack: provide --stack, or configure a Blueprint with a Stack.', {
|
|
311
|
+
suggestions: [
|
|
312
|
+
`Run \`${this.config.bin} blueprints doctor\` to check your configuration.`,
|
|
313
|
+
],
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
this.stackId = stackId;
|
|
317
|
+
}
|
|
318
|
+
// 7. Auth
|
|
319
|
+
if (needsScope) {
|
|
320
|
+
this.auth = { token: this.sanityToken, scopeType: this.scopeType, scopeId: this.scopeId };
|
|
321
|
+
}
|
|
322
|
+
// 8. Deployed Stack
|
|
323
|
+
if (needsDeployedStack) {
|
|
324
|
+
const spinner = log.ora('Loading Stack deployment...').start();
|
|
325
|
+
const response = await getStack({ stackId: this.stackId, auth: this.auth, logger: log });
|
|
326
|
+
if (!response.ok) {
|
|
327
|
+
spinner.fail('Could not load Stack deployment');
|
|
328
|
+
this.error('Missing Stack deployment', {
|
|
329
|
+
suggestions: [
|
|
330
|
+
`Run \`${this.config.bin} blueprints doctor\` to check your configuration.`,
|
|
331
|
+
],
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
spinner.stop().clear();
|
|
335
|
+
this.deployedStack = response.stack;
|
|
336
|
+
}
|
|
222
337
|
}
|
|
223
338
|
}
|
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
* @deprecated Use `functions add` instead.
|
|
4
4
|
* We're in the process of deprecating the `blueprints add` command.
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
7
|
-
export default class AddCommand extends
|
|
6
|
+
import { ResolvedCommand } from '../../baseCommands.js';
|
|
7
|
+
export default class AddCommand extends ResolvedCommand<typeof AddCommand> {
|
|
8
|
+
static needs: readonly ["blueprint"];
|
|
8
9
|
static summary: string;
|
|
9
10
|
static description: string;
|
|
10
11
|
static examples: string[];
|
|
@@ -4,13 +4,14 @@
|
|
|
4
4
|
* We're in the process of deprecating the `blueprints add` command.
|
|
5
5
|
*/
|
|
6
6
|
import { Args, Flags } from '@oclif/core';
|
|
7
|
-
import {
|
|
7
|
+
import { ResolvedCommand } from '../../baseCommands.js';
|
|
8
8
|
import { FUNCTION_TYPES } from '../../constants.js';
|
|
9
9
|
import { functionAddCore } from '../../cores/functions/index.js';
|
|
10
10
|
import { Logger } from '../../utils/logger.js';
|
|
11
11
|
import { INSTALLER_OPTIONS } from '../../utils/types.js';
|
|
12
12
|
// import {warn} from '../../utils/display/presenters.js'
|
|
13
|
-
export default class AddCommand extends
|
|
13
|
+
export default class AddCommand extends ResolvedCommand {
|
|
14
|
+
static needs = ['blueprint'];
|
|
14
15
|
// static state = 'deprecated'
|
|
15
16
|
// static deprecationOptions = {
|
|
16
17
|
// message: '`blueprints add` is deprecated. Use `functions add` instead.',
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export default class ConfigCommand extends
|
|
1
|
+
import { ResolvedCommand } from '../../baseCommands.js';
|
|
2
|
+
export default class ConfigCommand extends ResolvedCommand<typeof ConfigCommand> {
|
|
3
|
+
static needs: readonly ["token", "blueprint"];
|
|
3
4
|
static summary: string;
|
|
4
5
|
static description: string;
|
|
5
6
|
static examples: string[];
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Flags } from '@oclif/core';
|
|
2
|
-
import {
|
|
2
|
+
import { organizationIdFlagConfig, projectIdFlagConfig, ResolvedCommand } from '../../baseCommands.js';
|
|
3
3
|
import { blueprintConfigCore } from '../../cores/blueprints/config.js';
|
|
4
4
|
import { Logger } from '../../utils/logger.js';
|
|
5
|
-
export default class ConfigCommand extends
|
|
5
|
+
export default class ConfigCommand extends ResolvedCommand {
|
|
6
|
+
static needs = ['token', 'blueprint'];
|
|
6
7
|
static summary = 'View or edit the local Blueprint configuration';
|
|
7
8
|
static description = `Manages the local Blueprint configuration, which links your Blueprint to a Sanity project and Stack.
|
|
8
9
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export default class DeployCommand extends
|
|
1
|
+
import { ResolvedCommand } from '../../baseCommands.js';
|
|
2
|
+
export default class DeployCommand extends ResolvedCommand<typeof DeployCommand> {
|
|
3
|
+
static needs: readonly ["deployedStack", "blueprint"];
|
|
3
4
|
static summary: string;
|
|
4
5
|
static description: string;
|
|
5
6
|
static examples: string[];
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Flags } from '@oclif/core';
|
|
2
|
-
import {
|
|
2
|
+
import { ResolvedCommand, stackFlagConfig } from '../../baseCommands.js';
|
|
3
3
|
import { blueprintDeployCore } from '../../cores/blueprints/deploy.js';
|
|
4
4
|
import { Logger } from '../../utils/logger.js';
|
|
5
5
|
import { INSTALLER_OPTIONS } from '../../utils/types.js';
|
|
6
|
-
export default class DeployCommand extends
|
|
6
|
+
export default class DeployCommand extends ResolvedCommand {
|
|
7
|
+
static needs = ['deployedStack', 'blueprint'];
|
|
7
8
|
static summary = 'Deploy the local Blueprint to the remote Stack';
|
|
8
9
|
static description = `Applies your local Blueprint to the remote Stack, creating, updating, or removing resources as needed. This is the primary command for applying infrastructure changes.
|
|
9
10
|
|
|
@@ -21,7 +22,7 @@ Set SANITY_ASSET_TIMEOUT (seconds) to override the 60-second timeout for process
|
|
|
21
22
|
'<%= config.bin %> <%= command.id %> --fn-installer npm',
|
|
22
23
|
];
|
|
23
24
|
static flags = {
|
|
24
|
-
stack:
|
|
25
|
+
stack: Flags.string({ ...stackFlagConfig }),
|
|
25
26
|
message: Flags.string({
|
|
26
27
|
description: 'Message describing the deployment (e.g. reason for change)',
|
|
27
28
|
char: 'm',
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export default class DestroyCommand extends
|
|
1
|
+
import { ResolvedCommand } from '../../baseCommands.js';
|
|
2
|
+
export default class DestroyCommand extends ResolvedCommand<typeof DestroyCommand> {
|
|
3
|
+
static needs: readonly ["token", "blueprint"];
|
|
3
4
|
static summary: string;
|
|
4
5
|
static description: string;
|
|
5
6
|
static examples: string[];
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Flags } from '@oclif/core';
|
|
2
|
-
import {
|
|
2
|
+
import { organizationIdFlagConfig, projectIdFlagConfig, ResolvedCommand } from '../../baseCommands.js';
|
|
3
3
|
import { blueprintDestroyCore } from '../../cores/blueprints/destroy.js';
|
|
4
4
|
import { Logger } from '../../utils/logger.js';
|
|
5
|
-
export default class DestroyCommand extends
|
|
5
|
+
export default class DestroyCommand extends ResolvedCommand {
|
|
6
|
+
static needs = ['token', 'blueprint'];
|
|
6
7
|
static summary = 'Destroy a remote Stack deployment and its resources';
|
|
7
8
|
static description = `Permanently removes the remote Stack and all its provisioned resources. Your local Blueprint files remain untouched, allowing you to redeploy later with 'blueprints init' + 'blueprints deploy'.
|
|
8
9
|
|
|
@@ -6,7 +6,6 @@ export default class DoctorCommand extends RuntimeCommand<typeof DoctorCommand>
|
|
|
6
6
|
static flags: {
|
|
7
7
|
path: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
8
|
fix: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
9
|
-
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
9
|
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
11
10
|
};
|
|
12
11
|
run(): Promise<Record<string, unknown> | undefined>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Flags } from '@oclif/core';
|
|
2
|
-
import {
|
|
2
|
+
import { pathFlagConfig, RuntimeCommand } from '../../baseCommands.js';
|
|
3
3
|
import config from '../../config.js';
|
|
4
4
|
import { blueprintDoctorCore } from '../../cores/blueprints/doctor.js';
|
|
5
5
|
import { Logger } from '../../utils/logger.js';
|
|
@@ -14,12 +14,11 @@ Run this command when encountering errors with other Blueprint commands. Use --f
|
|
|
14
14
|
'<%= config.bin %> <%= command.id %> --fix',
|
|
15
15
|
];
|
|
16
16
|
static flags = {
|
|
17
|
-
path:
|
|
17
|
+
path: Flags.string({ ...pathFlagConfig }),
|
|
18
18
|
fix: Flags.boolean({
|
|
19
19
|
description: 'Interactively fix configuration issues',
|
|
20
20
|
default: false,
|
|
21
21
|
}),
|
|
22
|
-
json: unhide(baseFlags.json),
|
|
23
22
|
verbose: Flags.boolean({
|
|
24
23
|
description: 'Verbose output; defaults to true',
|
|
25
24
|
default: true,
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export default class InfoCommand extends
|
|
1
|
+
import { ResolvedCommand } from '../../baseCommands.js';
|
|
2
|
+
export default class InfoCommand extends ResolvedCommand<typeof InfoCommand> {
|
|
3
|
+
static needs: readonly ["deployedStack"];
|
|
3
4
|
static summary: string;
|
|
4
5
|
static description: string;
|
|
5
6
|
static examples: string[];
|
|
6
7
|
static flags: {
|
|
7
8
|
stack: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
'project-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
10
|
};
|
|
9
11
|
run(): Promise<Record<string, unknown> | undefined>;
|
|
10
12
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Flags } from '@oclif/core';
|
|
2
|
-
import {
|
|
2
|
+
import { projectIdFlagConfig, ResolvedCommand } from '../../baseCommands.js';
|
|
3
3
|
import { blueprintInfoCore } from '../../cores/blueprints/info.js';
|
|
4
4
|
import { Logger } from '../../utils/logger.js';
|
|
5
|
-
export default class InfoCommand extends
|
|
5
|
+
export default class InfoCommand extends ResolvedCommand {
|
|
6
|
+
static needs = ['deployedStack'];
|
|
6
7
|
static summary = 'Display the status and resources of the remote Stack deployment';
|
|
7
8
|
static description = `Displays the current state and metadata of your remote Stack deployment, including deployed resources, status, and configuration.
|
|
8
9
|
|
|
@@ -12,12 +13,14 @@ Run 'blueprints stacks' to see all available Stacks in your project or organizat
|
|
|
12
13
|
static examples = [
|
|
13
14
|
'<%= config.bin %> <%= command.id %>',
|
|
14
15
|
'<%= config.bin %> <%= command.id %> --stack <name-or-id>',
|
|
16
|
+
'<%= config.bin %> <%= command.id %> --project-id <id> --stack <name-or-id>',
|
|
15
17
|
];
|
|
16
18
|
static flags = {
|
|
17
19
|
stack: Flags.string({
|
|
18
|
-
description: 'Stack name or ID
|
|
20
|
+
description: 'Stack name or ID',
|
|
19
21
|
aliases: ['id'],
|
|
20
22
|
}),
|
|
23
|
+
'project-id': Flags.string({ ...projectIdFlagConfig }),
|
|
21
24
|
};
|
|
22
25
|
async run() {
|
|
23
26
|
const result = await blueprintInfoCore({
|
|
@@ -14,7 +14,6 @@ export default class InitCommand extends RuntimeCommand<typeof InitCommand> {
|
|
|
14
14
|
'organization-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
15
15
|
'stack-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
16
16
|
'stack-name': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
17
|
-
verbose: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
18
17
|
};
|
|
19
18
|
run(): Promise<void>;
|
|
20
19
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Args, Flags } from '@oclif/core';
|
|
2
|
-
import {
|
|
2
|
+
import { organizationIdFlagConfig, projectIdFlagConfig, RuntimeCommand } from '../../baseCommands.js';
|
|
3
3
|
import { blueprintInitCore } from '../../cores/blueprints/init.js';
|
|
4
4
|
import { Logger } from '../../utils/logger.js';
|
|
5
5
|
import { validTokenOrErrorMessage } from '../../utils/validated-token.js';
|
|
@@ -50,7 +50,6 @@ After initialization, use 'blueprints plan' to preview changes, then 'blueprints
|
|
|
50
50
|
aliases: ['name'],
|
|
51
51
|
exclusive: ['stack-id'],
|
|
52
52
|
}),
|
|
53
|
-
verbose: unhide(baseFlags.verbose),
|
|
54
53
|
};
|
|
55
54
|
async run() {
|
|
56
55
|
const log = Logger(this.log.bind(this), this.flags);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export default class LogsCommand extends
|
|
1
|
+
import { ResolvedCommand } from '../../baseCommands.js';
|
|
2
|
+
export default class LogsCommand extends ResolvedCommand<typeof LogsCommand> {
|
|
3
|
+
static needs: readonly ["deployedStack"];
|
|
3
4
|
static summary: string;
|
|
4
5
|
static description: string;
|
|
5
6
|
static examples: string[];
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Flags } from '@oclif/core';
|
|
2
|
-
import {
|
|
2
|
+
import { ResolvedCommand, stackFlagConfig } from '../../baseCommands.js';
|
|
3
3
|
import { blueprintLogsCore } from '../../cores/blueprints/logs.js';
|
|
4
4
|
import { Logger } from '../../utils/logger.js';
|
|
5
|
-
export default class LogsCommand extends
|
|
5
|
+
export default class LogsCommand extends ResolvedCommand {
|
|
6
|
+
static needs = ['deployedStack'];
|
|
6
7
|
static summary = "Display logs for the current Blueprint's Stack deployment";
|
|
7
8
|
static description = `Retrieves Stack deployment logs, useful for debugging and monitoring deployment activity.
|
|
8
9
|
|
|
@@ -14,7 +15,7 @@ If you're not seeing expected logs, verify your Stack is deployed with 'blueprin
|
|
|
14
15
|
'<%= config.bin %> <%= command.id %> --watch',
|
|
15
16
|
];
|
|
16
17
|
static flags = {
|
|
17
|
-
stack:
|
|
18
|
+
stack: Flags.string({ ...stackFlagConfig }),
|
|
18
19
|
watch: Flags.boolean({
|
|
19
20
|
char: 'w',
|
|
20
21
|
description: 'Watch for new Stack logs (streaming mode)',
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export default class PlanCommand extends
|
|
1
|
+
import { ResolvedCommand } from '../../baseCommands.js';
|
|
2
|
+
export default class PlanCommand extends ResolvedCommand<typeof PlanCommand> {
|
|
3
|
+
static needs: readonly ["token", "blueprint"];
|
|
3
4
|
static summary: string;
|
|
4
5
|
static description: string;
|
|
5
6
|
static examples: string[];
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
|
+
import { ResolvedCommand, stackFlagConfig } from '../../baseCommands.js';
|
|
2
3
|
import { blueprintPlanCore } from '../../cores/blueprints/plan.js';
|
|
3
4
|
import { Logger } from '../../utils/logger.js';
|
|
4
|
-
export default class PlanCommand extends
|
|
5
|
+
export default class PlanCommand extends ResolvedCommand {
|
|
6
|
+
static needs = ['token', 'blueprint'];
|
|
5
7
|
static summary = 'Preview changes that will be applied to the remote Stack';
|
|
6
8
|
static description = `Use this command to preview what changes will be applied to your remote Stack before deploying. This is a safe, read-only operation—no resources are created, modified, or deleted.
|
|
7
9
|
|
|
8
10
|
Run 'blueprints plan' after making local changes to your Blueprint manifest to verify the expected diff. When ready, run 'blueprints deploy' to apply changes.`;
|
|
9
11
|
static examples = ['<%= config.bin %> <%= command.id %>'];
|
|
10
12
|
static flags = {
|
|
11
|
-
stack:
|
|
13
|
+
stack: Flags.string({ ...stackFlagConfig }),
|
|
12
14
|
};
|
|
13
15
|
async run() {
|
|
14
16
|
const result = await blueprintPlanCore({
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export default class PromoteCommand extends
|
|
1
|
+
import { ResolvedCommand } from '../../baseCommands.js';
|
|
2
|
+
export default class PromoteCommand extends ResolvedCommand<typeof PromoteCommand> {
|
|
3
|
+
static needs: readonly ["deployedStack", "blueprint"];
|
|
3
4
|
static summary: string;
|
|
4
5
|
static description: string;
|
|
5
6
|
static hidden: boolean;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Flags } from '@oclif/core';
|
|
2
|
-
import {
|
|
2
|
+
import { ResolvedCommand } from '../../baseCommands.js';
|
|
3
3
|
import { blueprintPromoteCore } from '../../cores/blueprints/promote.js';
|
|
4
4
|
import { Logger } from '../../utils/logger.js';
|
|
5
|
-
export default class PromoteCommand extends
|
|
5
|
+
export default class PromoteCommand extends ResolvedCommand {
|
|
6
|
+
static needs = ['deployedStack', 'blueprint'];
|
|
6
7
|
static summary = 'Promote a Stack from project scope to organization scope';
|
|
7
8
|
static description = `Promotes a deployed Stack to organization scope, enabling management of org-level resources. Promotion cannot be reversed.
|
|
8
9
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export default class StacksCommand extends
|
|
1
|
+
import { ResolvedCommand } from '../../baseCommands.js';
|
|
2
|
+
export default class StacksCommand extends ResolvedCommand<typeof StacksCommand> {
|
|
3
|
+
static needs: readonly ["token", "blueprint"];
|
|
3
4
|
static summary: string;
|
|
4
5
|
static description: string;
|
|
5
6
|
static examples: string[];
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Flags } from '@oclif/core';
|
|
2
|
-
import {
|
|
2
|
+
import { organizationIdFlagConfig, projectIdFlagConfig, ResolvedCommand } from '../../baseCommands.js';
|
|
3
3
|
import { blueprintStacksCore } from '../../cores/blueprints/stacks.js';
|
|
4
4
|
import { Logger } from '../../utils/logger.js';
|
|
5
|
-
export default class StacksCommand extends
|
|
5
|
+
export default class StacksCommand extends ResolvedCommand {
|
|
6
|
+
static needs = ['token', 'blueprint'];
|
|
6
7
|
static summary = 'List remote Stack deployments for your project or organization';
|
|
7
8
|
static description = `Shows all Stacks associated with a project or organization. By default, lists Stacks scoped to the local Blueprint.
|
|
8
9
|
|