@sanity/runtime-cli 14.10.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 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.10.0 linux-x64 node-v24.14.1
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.10.0/src/commands/blueprints/add.ts)_
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.10.0/src/commands/blueprints/config.ts)_
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
 
@@ -182,7 +182,7 @@ EXAMPLES
182
182
  $ sanity-run blueprints deploy --fn-installer npm
183
183
  ```
184
184
 
185
- _See code: [src/commands/blueprints/deploy.ts](https://github.com/sanity-io/runtime-cli/blob/v14.10.0/src/commands/blueprints/deploy.ts)_
185
+ _See code: [src/commands/blueprints/deploy.ts](https://github.com/sanity-io/runtime-cli/blob/v14.10.1/src/commands/blueprints/deploy.ts)_
186
186
 
187
187
  ## `sanity-run blueprints destroy`
188
188
 
@@ -218,7 +218,7 @@ EXAMPLES
218
218
  $ sanity-run blueprints destroy --stack <name-or-id> --project-id <projectId> --force --no-wait
219
219
  ```
220
220
 
221
- _See code: [src/commands/blueprints/destroy.ts](https://github.com/sanity-io/runtime-cli/blob/v14.10.0/src/commands/blueprints/destroy.ts)_
221
+ _See code: [src/commands/blueprints/destroy.ts](https://github.com/sanity-io/runtime-cli/blob/v14.10.1/src/commands/blueprints/destroy.ts)_
222
222
 
223
223
  ## `sanity-run blueprints doctor`
224
224
 
@@ -250,7 +250,7 @@ EXAMPLES
250
250
  $ sanity-run blueprints doctor --fix
251
251
  ```
252
252
 
253
- _See code: [src/commands/blueprints/doctor.ts](https://github.com/sanity-io/runtime-cli/blob/v14.10.0/src/commands/blueprints/doctor.ts)_
253
+ _See code: [src/commands/blueprints/doctor.ts](https://github.com/sanity-io/runtime-cli/blob/v14.10.1/src/commands/blueprints/doctor.ts)_
254
254
 
255
255
  ## `sanity-run blueprints info`
256
256
 
@@ -282,7 +282,7 @@ EXAMPLES
282
282
  $ sanity-run blueprints info --stack <name-or-id>
283
283
  ```
284
284
 
285
- _See code: [src/commands/blueprints/info.ts](https://github.com/sanity-io/runtime-cli/blob/v14.10.0/src/commands/blueprints/info.ts)_
285
+ _See code: [src/commands/blueprints/info.ts](https://github.com/sanity-io/runtime-cli/blob/v14.10.1/src/commands/blueprints/info.ts)_
286
286
 
287
287
  ## `sanity-run blueprints init [DIR]`
288
288
 
@@ -336,7 +336,7 @@ EXAMPLES
336
336
  $ sanity-run blueprints init --blueprint-type <json|js|ts> --stack-name <stackName>
337
337
  ```
338
338
 
339
- _See code: [src/commands/blueprints/init.ts](https://github.com/sanity-io/runtime-cli/blob/v14.10.0/src/commands/blueprints/init.ts)_
339
+ _See code: [src/commands/blueprints/init.ts](https://github.com/sanity-io/runtime-cli/blob/v14.10.1/src/commands/blueprints/init.ts)_
340
340
 
341
341
  ## `sanity-run blueprints logs`
342
342
 
@@ -367,7 +367,7 @@ EXAMPLES
367
367
  $ sanity-run blueprints logs --watch
368
368
  ```
369
369
 
370
- _See code: [src/commands/blueprints/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v14.10.0/src/commands/blueprints/logs.ts)_
370
+ _See code: [src/commands/blueprints/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v14.10.1/src/commands/blueprints/logs.ts)_
371
371
 
372
372
  ## `sanity-run blueprints plan`
373
373
 
@@ -395,7 +395,7 @@ EXAMPLES
395
395
  $ sanity-run blueprints plan
396
396
  ```
397
397
 
398
- _See code: [src/commands/blueprints/plan.ts](https://github.com/sanity-io/runtime-cli/blob/v14.10.0/src/commands/blueprints/plan.ts)_
398
+ _See code: [src/commands/blueprints/plan.ts](https://github.com/sanity-io/runtime-cli/blob/v14.10.1/src/commands/blueprints/plan.ts)_
399
399
 
400
400
  ## `sanity-run blueprints stacks`
401
401
 
@@ -427,7 +427,7 @@ EXAMPLES
427
427
  $ sanity-run blueprints stacks --organization-id <organizationId>
428
428
  ```
429
429
 
430
- _See code: [src/commands/blueprints/stacks.ts](https://github.com/sanity-io/runtime-cli/blob/v14.10.0/src/commands/blueprints/stacks.ts)_
430
+ _See code: [src/commands/blueprints/stacks.ts](https://github.com/sanity-io/runtime-cli/blob/v14.10.1/src/commands/blueprints/stacks.ts)_
431
431
 
432
432
  ## `sanity-run functions add`
433
433
 
@@ -480,7 +480,7 @@ EXAMPLES
480
480
  $ sanity-run functions add --name my-function --type document-create --type document-update --lang js
481
481
  ```
482
482
 
483
- _See code: [src/commands/functions/add.ts](https://github.com/sanity-io/runtime-cli/blob/v14.10.0/src/commands/functions/add.ts)_
483
+ _See code: [src/commands/functions/add.ts](https://github.com/sanity-io/runtime-cli/blob/v14.10.1/src/commands/functions/add.ts)_
484
484
 
485
485
  ## `sanity-run functions dev`
486
486
 
@@ -516,7 +516,7 @@ EXAMPLES
516
516
  $ sanity-run functions dev --timeout 60
517
517
  ```
518
518
 
519
- _See code: [src/commands/functions/dev.ts](https://github.com/sanity-io/runtime-cli/blob/v14.10.0/src/commands/functions/dev.ts)_
519
+ _See code: [src/commands/functions/dev.ts](https://github.com/sanity-io/runtime-cli/blob/v14.10.1/src/commands/functions/dev.ts)_
520
520
 
521
521
  ## `sanity-run functions env add NAME KEY VALUE`
522
522
 
@@ -547,7 +547,7 @@ EXAMPLES
547
547
  $ sanity-run functions env add MyFunction API_URL https://api.example.com/
548
548
  ```
549
549
 
550
- _See code: [src/commands/functions/env/add.ts](https://github.com/sanity-io/runtime-cli/blob/v14.10.0/src/commands/functions/env/add.ts)_
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)_
551
551
 
552
552
  ## `sanity-run functions env list NAME`
553
553
 
@@ -575,7 +575,7 @@ EXAMPLES
575
575
  $ sanity-run functions env list MyFunction
576
576
  ```
577
577
 
578
- _See code: [src/commands/functions/env/list.ts](https://github.com/sanity-io/runtime-cli/blob/v14.10.0/src/commands/functions/env/list.ts)_
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)_
579
579
 
580
580
  ## `sanity-run functions env remove NAME KEY`
581
581
 
@@ -605,7 +605,7 @@ EXAMPLES
605
605
  $ sanity-run functions env remove MyFunction API_URL
606
606
  ```
607
607
 
608
- _See code: [src/commands/functions/env/remove.ts](https://github.com/sanity-io/runtime-cli/blob/v14.10.0/src/commands/functions/env/remove.ts)_
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)_
609
609
 
610
610
  ## `sanity-run functions logs [NAME]`
611
611
 
@@ -647,7 +647,7 @@ EXAMPLES
647
647
  $ sanity-run functions logs <name> --delete
648
648
  ```
649
649
 
650
- _See code: [src/commands/functions/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v14.10.0/src/commands/functions/logs.ts)_
650
+ _See code: [src/commands/functions/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v14.10.1/src/commands/functions/logs.ts)_
651
651
 
652
652
  ## `sanity-run functions test [NAME]`
653
653
 
@@ -705,7 +705,7 @@ EXAMPLES
705
705
  $ sanity-run functions test <name> --event update --data-before '{ "title": "before" }' --data-after '{ "title": "after" }'
706
706
  ```
707
707
 
708
- _See code: [src/commands/functions/test.ts](https://github.com/sanity-io/runtime-cli/blob/v14.10.0/src/commands/functions/test.ts)_
708
+ _See code: [src/commands/functions/test.ts](https://github.com/sanity-io/runtime-cli/blob/v14.10.1/src/commands/functions/test.ts)_
709
709
 
710
710
  ## `sanity-run help [COMMAND]`
711
711
 
@@ -8,6 +8,7 @@ export interface LogStreamingConfig {
8
8
  verbose?: boolean;
9
9
  log: Logger;
10
10
  onActivity?: () => void;
11
+ onLogEntry?: (log: BlueprintLog) => void;
11
12
  }
12
13
  export interface StreamLogsOptions {
13
14
  stackId: string;
@@ -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
  };
@@ -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';
@@ -81,6 +82,7 @@ export async function blueprintDeployCore(options) {
81
82
  };
82
83
  }
83
84
  log(styleText('dim', 'Stack deployment progress:'));
85
+ const logHints = createLogHintCollector(bin);
84
86
  let logStreamCleanup = null;
85
87
  try {
86
88
  let lastLogAt = Date.now();
@@ -94,6 +96,7 @@ export async function blueprintDeployCore(options) {
94
96
  onActivity: () => {
95
97
  lastLogAt = Date.now();
96
98
  },
99
+ onLogEntry: (logEntry) => logHints.inspect(logEntry),
97
100
  });
98
101
  while (true) {
99
102
  const { ok, stack: currentStack } = await getStack({ stackId: stack.id, auth, logger: log });
@@ -122,6 +125,7 @@ export async function blueprintDeployCore(options) {
122
125
  success: false,
123
126
  error: 'Stack deployment failed',
124
127
  suggestions: [
128
+ ...logHints.getSuggestions(),
125
129
  `Run \`npx ${bin} blueprints logs\` to review deployment logs.`,
126
130
  `Run \`npx ${bin} blueprints plan\` to identify issues with your Blueprint.`,
127
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
  ],
@@ -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
+ }
@@ -2247,5 +2247,5 @@
2247
2247
  ]
2248
2248
  }
2249
2249
  },
2250
- "version": "14.10.0"
2250
+ "version": "14.10.1"
2251
2251
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sanity/runtime-cli",
3
3
  "description": "Sanity's Runtime CLI for Blueprints and Functions",
4
- "version": "14.10.0",
4
+ "version": "14.10.1",
5
5
  "author": "Sanity Runtime Team",
6
6
  "type": "module",
7
7
  "license": "MIT",