@sanity/runtime-cli 14.9.0 → 14.10.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 +26 -23
- package/dist/actions/blueprints/logs-streaming.d.ts +1 -0
- package/dist/actions/blueprints/logs-streaming.js +1 -0
- package/dist/commands/blueprints/deploy.d.ts +1 -0
- package/dist/commands/blueprints/deploy.js +5 -0
- package/dist/constants.js +1 -0
- package/dist/cores/blueprints/deploy.d.ts +1 -0
- package/dist/cores/blueprints/deploy.js +5 -0
- package/dist/cores/blueprints/destroy.js +4 -0
- package/dist/cores/blueprints/doctor.js +2 -0
- package/dist/utils/blueprints/log-hints.d.ts +25 -0
- package/dist/utils/blueprints/log-hints.js +46 -0
- package/dist/utils/display/blueprints-formatting.js +2 -0
- package/dist/utils/types.d.ts +3 -0
- package/oclif.manifest.json +10 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ $ npm install -g @sanity/runtime-cli
|
|
|
20
20
|
$ sanity-run COMMAND
|
|
21
21
|
running command...
|
|
22
22
|
$ sanity-run (--version)
|
|
23
|
-
@sanity/runtime-cli/14.
|
|
23
|
+
@sanity/runtime-cli/14.10.1 linux-x64 node-v24.14.1
|
|
24
24
|
$ sanity-run --help [COMMAND]
|
|
25
25
|
USAGE
|
|
26
26
|
$ sanity-run COMMAND
|
|
@@ -101,7 +101,7 @@ EXAMPLES
|
|
|
101
101
|
$ sanity-run blueprints add function --name my-function --fn-type document-create --fn-type document-update --lang js
|
|
102
102
|
```
|
|
103
103
|
|
|
104
|
-
_See code: [src/commands/blueprints/add.ts](https://github.com/sanity-io/runtime-cli/blob/v14.
|
|
104
|
+
_See code: [src/commands/blueprints/add.ts](https://github.com/sanity-io/runtime-cli/blob/v14.10.1/src/commands/blueprints/add.ts)_
|
|
105
105
|
|
|
106
106
|
## `sanity-run blueprints config`
|
|
107
107
|
|
|
@@ -140,7 +140,7 @@ EXAMPLES
|
|
|
140
140
|
$ sanity-run blueprints config --edit --project-id <projectId> --stack <name-or-id>
|
|
141
141
|
```
|
|
142
142
|
|
|
143
|
-
_See code: [src/commands/blueprints/config.ts](https://github.com/sanity-io/runtime-cli/blob/v14.
|
|
143
|
+
_See code: [src/commands/blueprints/config.ts](https://github.com/sanity-io/runtime-cli/blob/v14.10.1/src/commands/blueprints/config.ts)_
|
|
144
144
|
|
|
145
145
|
## `sanity-run blueprints deploy`
|
|
146
146
|
|
|
@@ -148,13 +148,14 @@ Deploy the local Blueprint to the remote Stack
|
|
|
148
148
|
|
|
149
149
|
```
|
|
150
150
|
USAGE
|
|
151
|
-
$ sanity-run blueprints deploy [--json] [--validate-resources] [--stack <value>] [--no-wait]
|
|
151
|
+
$ sanity-run blueprints deploy [--json] [--validate-resources] [--stack <value>] [-m <value>] [--no-wait]
|
|
152
152
|
|
|
153
153
|
FLAGS
|
|
154
|
-
--
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
154
|
+
-m, --message=<value> Message describing the deployment (e.g. reason for change)
|
|
155
|
+
--json Format output as json
|
|
156
|
+
--no-wait Do not wait for Stack deployment to complete
|
|
157
|
+
--stack=<value> Stack name or ID to use instead of the locally configured Stack
|
|
158
|
+
--[no-]validate-resources Validate resources
|
|
158
159
|
|
|
159
160
|
DESCRIPTION
|
|
160
161
|
Deploy the local Blueprint to the remote Stack
|
|
@@ -174,12 +175,14 @@ DESCRIPTION
|
|
|
174
175
|
EXAMPLES
|
|
175
176
|
$ sanity-run blueprints deploy
|
|
176
177
|
|
|
178
|
+
$ sanity-run blueprints deploy --message "Enable staging dataset"
|
|
179
|
+
|
|
177
180
|
$ sanity-run blueprints deploy --no-wait
|
|
178
181
|
|
|
179
182
|
$ sanity-run blueprints deploy --fn-installer npm
|
|
180
183
|
```
|
|
181
184
|
|
|
182
|
-
_See code: [src/commands/blueprints/deploy.ts](https://github.com/sanity-io/runtime-cli/blob/v14.
|
|
185
|
+
_See code: [src/commands/blueprints/deploy.ts](https://github.com/sanity-io/runtime-cli/blob/v14.10.1/src/commands/blueprints/deploy.ts)_
|
|
183
186
|
|
|
184
187
|
## `sanity-run blueprints destroy`
|
|
185
188
|
|
|
@@ -215,7 +218,7 @@ EXAMPLES
|
|
|
215
218
|
$ sanity-run blueprints destroy --stack <name-or-id> --project-id <projectId> --force --no-wait
|
|
216
219
|
```
|
|
217
220
|
|
|
218
|
-
_See code: [src/commands/blueprints/destroy.ts](https://github.com/sanity-io/runtime-cli/blob/v14.
|
|
221
|
+
_See code: [src/commands/blueprints/destroy.ts](https://github.com/sanity-io/runtime-cli/blob/v14.10.1/src/commands/blueprints/destroy.ts)_
|
|
219
222
|
|
|
220
223
|
## `sanity-run blueprints doctor`
|
|
221
224
|
|
|
@@ -247,7 +250,7 @@ EXAMPLES
|
|
|
247
250
|
$ sanity-run blueprints doctor --fix
|
|
248
251
|
```
|
|
249
252
|
|
|
250
|
-
_See code: [src/commands/blueprints/doctor.ts](https://github.com/sanity-io/runtime-cli/blob/v14.
|
|
253
|
+
_See code: [src/commands/blueprints/doctor.ts](https://github.com/sanity-io/runtime-cli/blob/v14.10.1/src/commands/blueprints/doctor.ts)_
|
|
251
254
|
|
|
252
255
|
## `sanity-run blueprints info`
|
|
253
256
|
|
|
@@ -279,7 +282,7 @@ EXAMPLES
|
|
|
279
282
|
$ sanity-run blueprints info --stack <name-or-id>
|
|
280
283
|
```
|
|
281
284
|
|
|
282
|
-
_See code: [src/commands/blueprints/info.ts](https://github.com/sanity-io/runtime-cli/blob/v14.
|
|
285
|
+
_See code: [src/commands/blueprints/info.ts](https://github.com/sanity-io/runtime-cli/blob/v14.10.1/src/commands/blueprints/info.ts)_
|
|
283
286
|
|
|
284
287
|
## `sanity-run blueprints init [DIR]`
|
|
285
288
|
|
|
@@ -333,7 +336,7 @@ EXAMPLES
|
|
|
333
336
|
$ sanity-run blueprints init --blueprint-type <json|js|ts> --stack-name <stackName>
|
|
334
337
|
```
|
|
335
338
|
|
|
336
|
-
_See code: [src/commands/blueprints/init.ts](https://github.com/sanity-io/runtime-cli/blob/v14.
|
|
339
|
+
_See code: [src/commands/blueprints/init.ts](https://github.com/sanity-io/runtime-cli/blob/v14.10.1/src/commands/blueprints/init.ts)_
|
|
337
340
|
|
|
338
341
|
## `sanity-run blueprints logs`
|
|
339
342
|
|
|
@@ -364,7 +367,7 @@ EXAMPLES
|
|
|
364
367
|
$ sanity-run blueprints logs --watch
|
|
365
368
|
```
|
|
366
369
|
|
|
367
|
-
_See code: [src/commands/blueprints/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v14.
|
|
370
|
+
_See code: [src/commands/blueprints/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v14.10.1/src/commands/blueprints/logs.ts)_
|
|
368
371
|
|
|
369
372
|
## `sanity-run blueprints plan`
|
|
370
373
|
|
|
@@ -392,7 +395,7 @@ EXAMPLES
|
|
|
392
395
|
$ sanity-run blueprints plan
|
|
393
396
|
```
|
|
394
397
|
|
|
395
|
-
_See code: [src/commands/blueprints/plan.ts](https://github.com/sanity-io/runtime-cli/blob/v14.
|
|
398
|
+
_See code: [src/commands/blueprints/plan.ts](https://github.com/sanity-io/runtime-cli/blob/v14.10.1/src/commands/blueprints/plan.ts)_
|
|
396
399
|
|
|
397
400
|
## `sanity-run blueprints stacks`
|
|
398
401
|
|
|
@@ -424,7 +427,7 @@ EXAMPLES
|
|
|
424
427
|
$ sanity-run blueprints stacks --organization-id <organizationId>
|
|
425
428
|
```
|
|
426
429
|
|
|
427
|
-
_See code: [src/commands/blueprints/stacks.ts](https://github.com/sanity-io/runtime-cli/blob/v14.
|
|
430
|
+
_See code: [src/commands/blueprints/stacks.ts](https://github.com/sanity-io/runtime-cli/blob/v14.10.1/src/commands/blueprints/stacks.ts)_
|
|
428
431
|
|
|
429
432
|
## `sanity-run functions add`
|
|
430
433
|
|
|
@@ -477,7 +480,7 @@ EXAMPLES
|
|
|
477
480
|
$ sanity-run functions add --name my-function --type document-create --type document-update --lang js
|
|
478
481
|
```
|
|
479
482
|
|
|
480
|
-
_See code: [src/commands/functions/add.ts](https://github.com/sanity-io/runtime-cli/blob/v14.
|
|
483
|
+
_See code: [src/commands/functions/add.ts](https://github.com/sanity-io/runtime-cli/blob/v14.10.1/src/commands/functions/add.ts)_
|
|
481
484
|
|
|
482
485
|
## `sanity-run functions dev`
|
|
483
486
|
|
|
@@ -513,7 +516,7 @@ EXAMPLES
|
|
|
513
516
|
$ sanity-run functions dev --timeout 60
|
|
514
517
|
```
|
|
515
518
|
|
|
516
|
-
_See code: [src/commands/functions/dev.ts](https://github.com/sanity-io/runtime-cli/blob/v14.
|
|
519
|
+
_See code: [src/commands/functions/dev.ts](https://github.com/sanity-io/runtime-cli/blob/v14.10.1/src/commands/functions/dev.ts)_
|
|
517
520
|
|
|
518
521
|
## `sanity-run functions env add NAME KEY VALUE`
|
|
519
522
|
|
|
@@ -544,7 +547,7 @@ EXAMPLES
|
|
|
544
547
|
$ sanity-run functions env add MyFunction API_URL https://api.example.com/
|
|
545
548
|
```
|
|
546
549
|
|
|
547
|
-
_See code: [src/commands/functions/env/add.ts](https://github.com/sanity-io/runtime-cli/blob/v14.
|
|
550
|
+
_See code: [src/commands/functions/env/add.ts](https://github.com/sanity-io/runtime-cli/blob/v14.10.1/src/commands/functions/env/add.ts)_
|
|
548
551
|
|
|
549
552
|
## `sanity-run functions env list NAME`
|
|
550
553
|
|
|
@@ -572,7 +575,7 @@ EXAMPLES
|
|
|
572
575
|
$ sanity-run functions env list MyFunction
|
|
573
576
|
```
|
|
574
577
|
|
|
575
|
-
_See code: [src/commands/functions/env/list.ts](https://github.com/sanity-io/runtime-cli/blob/v14.
|
|
578
|
+
_See code: [src/commands/functions/env/list.ts](https://github.com/sanity-io/runtime-cli/blob/v14.10.1/src/commands/functions/env/list.ts)_
|
|
576
579
|
|
|
577
580
|
## `sanity-run functions env remove NAME KEY`
|
|
578
581
|
|
|
@@ -602,7 +605,7 @@ EXAMPLES
|
|
|
602
605
|
$ sanity-run functions env remove MyFunction API_URL
|
|
603
606
|
```
|
|
604
607
|
|
|
605
|
-
_See code: [src/commands/functions/env/remove.ts](https://github.com/sanity-io/runtime-cli/blob/v14.
|
|
608
|
+
_See code: [src/commands/functions/env/remove.ts](https://github.com/sanity-io/runtime-cli/blob/v14.10.1/src/commands/functions/env/remove.ts)_
|
|
606
609
|
|
|
607
610
|
## `sanity-run functions logs [NAME]`
|
|
608
611
|
|
|
@@ -644,7 +647,7 @@ EXAMPLES
|
|
|
644
647
|
$ sanity-run functions logs <name> --delete
|
|
645
648
|
```
|
|
646
649
|
|
|
647
|
-
_See code: [src/commands/functions/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v14.
|
|
650
|
+
_See code: [src/commands/functions/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v14.10.1/src/commands/functions/logs.ts)_
|
|
648
651
|
|
|
649
652
|
## `sanity-run functions test [NAME]`
|
|
650
653
|
|
|
@@ -702,7 +705,7 @@ EXAMPLES
|
|
|
702
705
|
$ sanity-run functions test <name> --event update --data-before '{ "title": "before" }' --data-after '{ "title": "after" }'
|
|
703
706
|
```
|
|
704
707
|
|
|
705
|
-
_See code: [src/commands/functions/test.ts](https://github.com/sanity-io/runtime-cli/blob/v14.
|
|
708
|
+
_See code: [src/commands/functions/test.ts](https://github.com/sanity-io/runtime-cli/blob/v14.10.1/src/commands/functions/test.ts)_
|
|
706
709
|
|
|
707
710
|
## `sanity-run help [COMMAND]`
|
|
708
711
|
|
|
@@ -80,6 +80,7 @@ export async function setupLogStreaming(config) {
|
|
|
80
80
|
return;
|
|
81
81
|
newestTimestamp = new Date(logEntry.timestamp).getTime();
|
|
82
82
|
config.onActivity?.();
|
|
83
|
+
config.onLogEntry?.(logEntry);
|
|
83
84
|
log(formatLogEntry(logEntry, verbose, previousLog));
|
|
84
85
|
previousLog = logEntry;
|
|
85
86
|
};
|
|
@@ -5,6 +5,7 @@ export default class DeployCommand extends DeployedStackCommand<typeof DeployCom
|
|
|
5
5
|
static examples: string[];
|
|
6
6
|
static flags: {
|
|
7
7
|
stack: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
+
message: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
9
|
'fn-installer': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
10
|
'no-wait': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
10
11
|
'new-stack-name': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
@@ -16,11 +16,16 @@ Use --fn-installer to force which package manager to use when deploying function
|
|
|
16
16
|
Set SANITY_ASSET_TIMEOUT (seconds) to override the 60-second timeout for processing resource assets.`;
|
|
17
17
|
static examples = [
|
|
18
18
|
'<%= config.bin %> <%= command.id %>',
|
|
19
|
+
'<%= config.bin %> <%= command.id %> --message "Enable staging dataset"',
|
|
19
20
|
'<%= config.bin %> <%= command.id %> --no-wait',
|
|
20
21
|
'<%= config.bin %> <%= command.id %> --fn-installer npm',
|
|
21
22
|
];
|
|
22
23
|
static flags = {
|
|
23
24
|
stack: unhide(stackFlag),
|
|
25
|
+
message: Flags.string({
|
|
26
|
+
description: 'Message describing the deployment (e.g. reason for change)',
|
|
27
|
+
char: 'm',
|
|
28
|
+
}),
|
|
24
29
|
'fn-installer': Flags.string({
|
|
25
30
|
description: 'Which package manager to use when installing Function dependencies',
|
|
26
31
|
aliases: ['function-installer', 'installer'],
|
package/dist/constants.js
CHANGED
|
@@ -30,6 +30,7 @@ export const FUNCTION_TYPES = [
|
|
|
30
30
|
export const PROJECT_SCOPED_FUNCTION_TYPES = new Set([
|
|
31
31
|
SANITY_FUNCTION_DOCUMENT,
|
|
32
32
|
SANITY_FUNCTION_MEDIA_LIBRARY_ASSET,
|
|
33
|
+
SANITY_FUNCTION_SYNC_TAG_INVALIDATE,
|
|
33
34
|
]);
|
|
34
35
|
export const ORGANIZATION_SCOPED_FUNCTION_TYPES = new Set([
|
|
35
36
|
SANITY_FUNCTION_SCHEDULED,
|
|
@@ -2,6 +2,7 @@ import { setTimeout as sleep } from 'node:timers/promises';
|
|
|
2
2
|
import { stashAsset } from '../../actions/blueprints/assets.js';
|
|
3
3
|
import { setupLogStreaming } from '../../actions/blueprints/logs-streaming.js';
|
|
4
4
|
import { getStack, updateStack } from '../../actions/blueprints/stacks.js';
|
|
5
|
+
import { createLogHintCollector } from '../../utils/blueprints/log-hints.js';
|
|
5
6
|
import { niceId } from '../../utils/display/presenters.js';
|
|
6
7
|
import { styleText } from '../../utils/style-text.js';
|
|
7
8
|
import { isAssetResource } from '../../utils/types.js';
|
|
@@ -54,6 +55,7 @@ export async function blueprintDeployCore(options) {
|
|
|
54
55
|
scopeId,
|
|
55
56
|
name: stackName,
|
|
56
57
|
document: { resources },
|
|
58
|
+
userMessage: flags.message,
|
|
57
59
|
},
|
|
58
60
|
auth,
|
|
59
61
|
logger: log,
|
|
@@ -80,6 +82,7 @@ export async function blueprintDeployCore(options) {
|
|
|
80
82
|
};
|
|
81
83
|
}
|
|
82
84
|
log(styleText('dim', 'Stack deployment progress:'));
|
|
85
|
+
const logHints = createLogHintCollector(bin);
|
|
83
86
|
let logStreamCleanup = null;
|
|
84
87
|
try {
|
|
85
88
|
let lastLogAt = Date.now();
|
|
@@ -93,6 +96,7 @@ export async function blueprintDeployCore(options) {
|
|
|
93
96
|
onActivity: () => {
|
|
94
97
|
lastLogAt = Date.now();
|
|
95
98
|
},
|
|
99
|
+
onLogEntry: (logEntry) => logHints.inspect(logEntry),
|
|
96
100
|
});
|
|
97
101
|
while (true) {
|
|
98
102
|
const { ok, stack: currentStack } = await getStack({ stackId: stack.id, auth, logger: log });
|
|
@@ -121,6 +125,7 @@ export async function blueprintDeployCore(options) {
|
|
|
121
125
|
success: false,
|
|
122
126
|
error: 'Stack deployment failed',
|
|
123
127
|
suggestions: [
|
|
128
|
+
...logHints.getSuggestions(),
|
|
124
129
|
`Run \`npx ${bin} blueprints logs\` to review deployment logs.`,
|
|
125
130
|
`Run \`npx ${bin} blueprints plan\` to identify issues with your Blueprint.`,
|
|
126
131
|
],
|
|
@@ -2,6 +2,7 @@ import { setTimeout as sleep } from 'node:timers/promises';
|
|
|
2
2
|
import { confirm } from '@inquirer/prompts';
|
|
3
3
|
import { setupLogStreaming } from '../../actions/blueprints/logs-streaming.js';
|
|
4
4
|
import { destroyStack, getStack, resolveStackIdByNameOrId } from '../../actions/blueprints/stacks.js';
|
|
5
|
+
import { createLogHintCollector } from '../../utils/blueprints/log-hints.js';
|
|
5
6
|
import { niceId } from '../../utils/display/presenters.js';
|
|
6
7
|
import { styleText } from '../../utils/style-text.js';
|
|
7
8
|
export async function blueprintDestroyCore(options) {
|
|
@@ -103,6 +104,7 @@ export async function blueprintDestroyCore(options) {
|
|
|
103
104
|
return { success: true, json: { stackId: stack.id, stackName: stack.name } };
|
|
104
105
|
}
|
|
105
106
|
log(styleText('dim', 'Stack destruction progress:'));
|
|
107
|
+
const logHints = createLogHintCollector(bin);
|
|
106
108
|
let logStreamCleanup = null;
|
|
107
109
|
try {
|
|
108
110
|
let lastLogAt = Date.now();
|
|
@@ -115,6 +117,7 @@ export async function blueprintDestroyCore(options) {
|
|
|
115
117
|
onActivity: () => {
|
|
116
118
|
lastLogAt = Date.now();
|
|
117
119
|
},
|
|
120
|
+
onLogEntry: (logEntry) => logHints.inspect(logEntry),
|
|
118
121
|
});
|
|
119
122
|
while (true) {
|
|
120
123
|
const { ok, stack: currentStack } = await getStack({ stackId: stack.id, auth, logger: log });
|
|
@@ -134,6 +137,7 @@ export async function blueprintDestroyCore(options) {
|
|
|
134
137
|
success: false,
|
|
135
138
|
error: 'Stack destruction failed',
|
|
136
139
|
suggestions: [
|
|
140
|
+
...logHints.getSuggestions(),
|
|
137
141
|
`Run \`npx ${bin} blueprints logs\` to review destruction logs.`,
|
|
138
142
|
`Run \`npx ${bin} blueprints info\` to view current Stack status.`,
|
|
139
143
|
],
|
|
@@ -163,6 +163,8 @@ export async function blueprintDoctorCore(options) {
|
|
|
163
163
|
? ` ${styleText('dim', new Date(time).toLocaleString('sv-SE'))}`
|
|
164
164
|
: '';
|
|
165
165
|
stackRows.push(['Operation', `${op.status}${timestamp}`]);
|
|
166
|
+
if (op.userMessage)
|
|
167
|
+
stackRows.push([' Message', `"${op.userMessage}"`]);
|
|
166
168
|
}
|
|
167
169
|
if (stack.resources) {
|
|
168
170
|
stackRows.push(['Resources', `${stack.resources.length}`]);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { BlueprintLog } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* A pattern that matches a log message and produces oclif suggestions
|
|
4
|
+
* The regex is tested against `BlueprintLog.message`
|
|
5
|
+
* capture groups are forwarded to the factory so suggestions can include dynamic values
|
|
6
|
+
*/
|
|
7
|
+
type LogHintPattern = [RegExp, (match: RegExpMatchArray, bin: string) => string[]];
|
|
8
|
+
/**
|
|
9
|
+
* Patterns matched against ERROR/FATAL log entries during streaming operations
|
|
10
|
+
* like deploy and destroy. Each entry is a [regex, suggestionFactory] tuple.
|
|
11
|
+
*
|
|
12
|
+
* Add new patterns here -- no other code changes required.
|
|
13
|
+
*/
|
|
14
|
+
export declare const LOG_HINT_PATTERNS: LogHintPattern[];
|
|
15
|
+
/**
|
|
16
|
+
* Creates a collector to create suggestions
|
|
17
|
+
* Use getSuggestions() after all logs are inspected
|
|
18
|
+
*/
|
|
19
|
+
export declare function createLogHintCollector(bin: string): {
|
|
20
|
+
/** Check a log entry against hint patterns; only ERROR/FATAL levels are inspected. */
|
|
21
|
+
inspect(log: BlueprintLog): void;
|
|
22
|
+
/** Return unique collected suggestions. */
|
|
23
|
+
getSuggestions(): string[];
|
|
24
|
+
};
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Patterns matched against ERROR/FATAL log entries during streaming operations
|
|
3
|
+
* like deploy and destroy. Each entry is a [regex, suggestionFactory] tuple.
|
|
4
|
+
*
|
|
5
|
+
* Add new patterns here -- no other code changes required.
|
|
6
|
+
*/
|
|
7
|
+
export const LOG_HINT_PATTERNS = [
|
|
8
|
+
[
|
|
9
|
+
// tester
|
|
10
|
+
/\[TEST\] '(.+)' TEST/,
|
|
11
|
+
(match) => [`TEST SUGGESTION for '${match[1]}'.`],
|
|
12
|
+
],
|
|
13
|
+
[
|
|
14
|
+
// Function requires organization scope
|
|
15
|
+
/\[Functions\] Failed.+: (.+must be attached to an organization scoped stack)/,
|
|
16
|
+
(_match, bin) => [
|
|
17
|
+
`Run \`npx ${bin} blueprints promote\` to move from project to organization scope.`,
|
|
18
|
+
],
|
|
19
|
+
],
|
|
20
|
+
];
|
|
21
|
+
/**
|
|
22
|
+
* Creates a collector to create suggestions
|
|
23
|
+
* Use getSuggestions() after all logs are inspected
|
|
24
|
+
*/
|
|
25
|
+
export function createLogHintCollector(bin) {
|
|
26
|
+
const collected = [];
|
|
27
|
+
return {
|
|
28
|
+
/** Check a log entry against hint patterns; only ERROR/FATAL levels are inspected. */
|
|
29
|
+
inspect(log) {
|
|
30
|
+
const level = log.level.toUpperCase();
|
|
31
|
+
if (level !== 'ERROR' && level !== 'FATAL')
|
|
32
|
+
return;
|
|
33
|
+
for (const [pattern, factory] of LOG_HINT_PATTERNS) {
|
|
34
|
+
const match = log.message.match(pattern);
|
|
35
|
+
if (match) {
|
|
36
|
+
collected.push(...factory(match, bin));
|
|
37
|
+
break; // first matching pattern wins per entry
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
/** Return unique collected suggestions. */
|
|
42
|
+
getSuggestions() {
|
|
43
|
+
return [...new Set(collected)];
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
}
|
|
@@ -197,6 +197,8 @@ export function formatStackInfo(stack, isCurrentStack = false) {
|
|
|
197
197
|
parts.push(styleText('yellow', `(${formatDuration(op.createdAt, op.completedAt)})`));
|
|
198
198
|
}
|
|
199
199
|
rows.push(['Operation', parts.join(' ')]);
|
|
200
|
+
if (op.userMessage)
|
|
201
|
+
rows.push([' Message', `"${op.userMessage}"`]);
|
|
200
202
|
}
|
|
201
203
|
return renderSection(title, rows);
|
|
202
204
|
}
|
package/dist/utils/types.d.ts
CHANGED
|
@@ -72,6 +72,8 @@ export interface StackOperation {
|
|
|
72
72
|
status: string;
|
|
73
73
|
createdAt?: string;
|
|
74
74
|
completedAt?: string;
|
|
75
|
+
userMessage?: string;
|
|
76
|
+
systemMessage?: string;
|
|
75
77
|
}
|
|
76
78
|
/** @internal */
|
|
77
79
|
export interface StackMutation {
|
|
@@ -81,6 +83,7 @@ export interface StackMutation {
|
|
|
81
83
|
document: {
|
|
82
84
|
resources?: BlueprintResource[];
|
|
83
85
|
};
|
|
86
|
+
userMessage?: string;
|
|
84
87
|
}
|
|
85
88
|
/** @internal */
|
|
86
89
|
export interface BuildPayloadOptions {
|
package/oclif.manifest.json
CHANGED
|
@@ -317,6 +317,7 @@
|
|
|
317
317
|
"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.\n\nBefore deploying, run 'blueprints plan' to preview changes. After deployment, use 'blueprints info' to verify Stack status or 'blueprints logs' to monitor activity.\n\nUse --no-wait to queue the deployment and return immediately without waiting for completion.\n\nUse --fn-installer to force which package manager to use when deploying functions.\n\nSet SANITY_ASSET_TIMEOUT (seconds) to override the 60-second timeout for processing resource assets.",
|
|
318
318
|
"examples": [
|
|
319
319
|
"<%= config.bin %> <%= command.id %>",
|
|
320
|
+
"<%= config.bin %> <%= command.id %> --message \"Enable staging dataset\"",
|
|
320
321
|
"<%= config.bin %> <%= command.id %> --no-wait",
|
|
321
322
|
"<%= config.bin %> <%= command.id %> --fn-installer npm"
|
|
322
323
|
],
|
|
@@ -368,6 +369,14 @@
|
|
|
368
369
|
"multiple": false,
|
|
369
370
|
"type": "option"
|
|
370
371
|
},
|
|
372
|
+
"message": {
|
|
373
|
+
"char": "m",
|
|
374
|
+
"description": "Message describing the deployment (e.g. reason for change)",
|
|
375
|
+
"name": "message",
|
|
376
|
+
"hasDynamicHelp": false,
|
|
377
|
+
"multiple": false,
|
|
378
|
+
"type": "option"
|
|
379
|
+
},
|
|
371
380
|
"fn-installer": {
|
|
372
381
|
"aliases": [
|
|
373
382
|
"function-installer",
|
|
@@ -2238,5 +2247,5 @@
|
|
|
2238
2247
|
]
|
|
2239
2248
|
}
|
|
2240
2249
|
},
|
|
2241
|
-
"version": "14.
|
|
2250
|
+
"version": "14.10.1"
|
|
2242
2251
|
}
|