@sanity/runtime-cli 14.8.3 → 14.8.4
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.8.
|
|
23
|
+
@sanity/runtime-cli/14.8.4 linux-x64 node-v24.14.0
|
|
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.8.
|
|
104
|
+
_See code: [src/commands/blueprints/add.ts](https://github.com/sanity-io/runtime-cli/blob/v14.8.4/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.8.
|
|
143
|
+
_See code: [src/commands/blueprints/config.ts](https://github.com/sanity-io/runtime-cli/blob/v14.8.4/src/commands/blueprints/config.ts)_
|
|
144
144
|
|
|
145
145
|
## `sanity-run blueprints deploy`
|
|
146
146
|
|
|
@@ -179,7 +179,7 @@ EXAMPLES
|
|
|
179
179
|
$ sanity-run blueprints deploy --fn-installer npm
|
|
180
180
|
```
|
|
181
181
|
|
|
182
|
-
_See code: [src/commands/blueprints/deploy.ts](https://github.com/sanity-io/runtime-cli/blob/v14.8.
|
|
182
|
+
_See code: [src/commands/blueprints/deploy.ts](https://github.com/sanity-io/runtime-cli/blob/v14.8.4/src/commands/blueprints/deploy.ts)_
|
|
183
183
|
|
|
184
184
|
## `sanity-run blueprints destroy`
|
|
185
185
|
|
|
@@ -215,7 +215,7 @@ EXAMPLES
|
|
|
215
215
|
$ sanity-run blueprints destroy --stack <name-or-id> --project-id <projectId> --force --no-wait
|
|
216
216
|
```
|
|
217
217
|
|
|
218
|
-
_See code: [src/commands/blueprints/destroy.ts](https://github.com/sanity-io/runtime-cli/blob/v14.8.
|
|
218
|
+
_See code: [src/commands/blueprints/destroy.ts](https://github.com/sanity-io/runtime-cli/blob/v14.8.4/src/commands/blueprints/destroy.ts)_
|
|
219
219
|
|
|
220
220
|
## `sanity-run blueprints doctor`
|
|
221
221
|
|
|
@@ -242,7 +242,7 @@ DESCRIPTION
|
|
|
242
242
|
issues.
|
|
243
243
|
```
|
|
244
244
|
|
|
245
|
-
_See code: [src/commands/blueprints/doctor.ts](https://github.com/sanity-io/runtime-cli/blob/v14.8.
|
|
245
|
+
_See code: [src/commands/blueprints/doctor.ts](https://github.com/sanity-io/runtime-cli/blob/v14.8.4/src/commands/blueprints/doctor.ts)_
|
|
246
246
|
|
|
247
247
|
## `sanity-run blueprints info`
|
|
248
248
|
|
|
@@ -274,7 +274,7 @@ EXAMPLES
|
|
|
274
274
|
$ sanity-run blueprints info --stack <name-or-id>
|
|
275
275
|
```
|
|
276
276
|
|
|
277
|
-
_See code: [src/commands/blueprints/info.ts](https://github.com/sanity-io/runtime-cli/blob/v14.8.
|
|
277
|
+
_See code: [src/commands/blueprints/info.ts](https://github.com/sanity-io/runtime-cli/blob/v14.8.4/src/commands/blueprints/info.ts)_
|
|
278
278
|
|
|
279
279
|
## `sanity-run blueprints init [DIR]`
|
|
280
280
|
|
|
@@ -328,7 +328,7 @@ EXAMPLES
|
|
|
328
328
|
$ sanity-run blueprints init --blueprint-type <json|js|ts> --stack-name <stackName>
|
|
329
329
|
```
|
|
330
330
|
|
|
331
|
-
_See code: [src/commands/blueprints/init.ts](https://github.com/sanity-io/runtime-cli/blob/v14.8.
|
|
331
|
+
_See code: [src/commands/blueprints/init.ts](https://github.com/sanity-io/runtime-cli/blob/v14.8.4/src/commands/blueprints/init.ts)_
|
|
332
332
|
|
|
333
333
|
## `sanity-run blueprints logs`
|
|
334
334
|
|
|
@@ -359,7 +359,7 @@ EXAMPLES
|
|
|
359
359
|
$ sanity-run blueprints logs --watch
|
|
360
360
|
```
|
|
361
361
|
|
|
362
|
-
_See code: [src/commands/blueprints/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v14.8.
|
|
362
|
+
_See code: [src/commands/blueprints/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v14.8.4/src/commands/blueprints/logs.ts)_
|
|
363
363
|
|
|
364
364
|
## `sanity-run blueprints plan`
|
|
365
365
|
|
|
@@ -387,7 +387,7 @@ EXAMPLES
|
|
|
387
387
|
$ sanity-run blueprints plan
|
|
388
388
|
```
|
|
389
389
|
|
|
390
|
-
_See code: [src/commands/blueprints/plan.ts](https://github.com/sanity-io/runtime-cli/blob/v14.8.
|
|
390
|
+
_See code: [src/commands/blueprints/plan.ts](https://github.com/sanity-io/runtime-cli/blob/v14.8.4/src/commands/blueprints/plan.ts)_
|
|
391
391
|
|
|
392
392
|
## `sanity-run blueprints stacks`
|
|
393
393
|
|
|
@@ -419,7 +419,7 @@ EXAMPLES
|
|
|
419
419
|
$ sanity-run blueprints stacks --organization-id <organizationId>
|
|
420
420
|
```
|
|
421
421
|
|
|
422
|
-
_See code: [src/commands/blueprints/stacks.ts](https://github.com/sanity-io/runtime-cli/blob/v14.8.
|
|
422
|
+
_See code: [src/commands/blueprints/stacks.ts](https://github.com/sanity-io/runtime-cli/blob/v14.8.4/src/commands/blueprints/stacks.ts)_
|
|
423
423
|
|
|
424
424
|
## `sanity-run functions add`
|
|
425
425
|
|
|
@@ -472,7 +472,7 @@ EXAMPLES
|
|
|
472
472
|
$ sanity-run functions add --name my-function --type document-create --type document-update --lang js
|
|
473
473
|
```
|
|
474
474
|
|
|
475
|
-
_See code: [src/commands/functions/add.ts](https://github.com/sanity-io/runtime-cli/blob/v14.8.
|
|
475
|
+
_See code: [src/commands/functions/add.ts](https://github.com/sanity-io/runtime-cli/blob/v14.8.4/src/commands/functions/add.ts)_
|
|
476
476
|
|
|
477
477
|
## `sanity-run functions dev`
|
|
478
478
|
|
|
@@ -508,7 +508,7 @@ EXAMPLES
|
|
|
508
508
|
$ sanity-run functions dev --timeout 60
|
|
509
509
|
```
|
|
510
510
|
|
|
511
|
-
_See code: [src/commands/functions/dev.ts](https://github.com/sanity-io/runtime-cli/blob/v14.8.
|
|
511
|
+
_See code: [src/commands/functions/dev.ts](https://github.com/sanity-io/runtime-cli/blob/v14.8.4/src/commands/functions/dev.ts)_
|
|
512
512
|
|
|
513
513
|
## `sanity-run functions env add NAME KEY VALUE`
|
|
514
514
|
|
|
@@ -539,7 +539,7 @@ EXAMPLES
|
|
|
539
539
|
$ sanity-run functions env add MyFunction API_URL https://api.example.com/
|
|
540
540
|
```
|
|
541
541
|
|
|
542
|
-
_See code: [src/commands/functions/env/add.ts](https://github.com/sanity-io/runtime-cli/blob/v14.8.
|
|
542
|
+
_See code: [src/commands/functions/env/add.ts](https://github.com/sanity-io/runtime-cli/blob/v14.8.4/src/commands/functions/env/add.ts)_
|
|
543
543
|
|
|
544
544
|
## `sanity-run functions env list NAME`
|
|
545
545
|
|
|
@@ -567,7 +567,7 @@ EXAMPLES
|
|
|
567
567
|
$ sanity-run functions env list MyFunction
|
|
568
568
|
```
|
|
569
569
|
|
|
570
|
-
_See code: [src/commands/functions/env/list.ts](https://github.com/sanity-io/runtime-cli/blob/v14.8.
|
|
570
|
+
_See code: [src/commands/functions/env/list.ts](https://github.com/sanity-io/runtime-cli/blob/v14.8.4/src/commands/functions/env/list.ts)_
|
|
571
571
|
|
|
572
572
|
## `sanity-run functions env remove NAME KEY`
|
|
573
573
|
|
|
@@ -597,7 +597,7 @@ EXAMPLES
|
|
|
597
597
|
$ sanity-run functions env remove MyFunction API_URL
|
|
598
598
|
```
|
|
599
599
|
|
|
600
|
-
_See code: [src/commands/functions/env/remove.ts](https://github.com/sanity-io/runtime-cli/blob/v14.8.
|
|
600
|
+
_See code: [src/commands/functions/env/remove.ts](https://github.com/sanity-io/runtime-cli/blob/v14.8.4/src/commands/functions/env/remove.ts)_
|
|
601
601
|
|
|
602
602
|
## `sanity-run functions logs [NAME]`
|
|
603
603
|
|
|
@@ -639,7 +639,7 @@ EXAMPLES
|
|
|
639
639
|
$ sanity-run functions logs <name> --delete
|
|
640
640
|
```
|
|
641
641
|
|
|
642
|
-
_See code: [src/commands/functions/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v14.8.
|
|
642
|
+
_See code: [src/commands/functions/logs.ts](https://github.com/sanity-io/runtime-cli/blob/v14.8.4/src/commands/functions/logs.ts)_
|
|
643
643
|
|
|
644
644
|
## `sanity-run functions test [NAME]`
|
|
645
645
|
|
|
@@ -697,7 +697,7 @@ EXAMPLES
|
|
|
697
697
|
$ sanity-run functions test <name> --event update --data-before '{ "title": "before" }' --data-after '{ "title": "after" }'
|
|
698
698
|
```
|
|
699
699
|
|
|
700
|
-
_See code: [src/commands/functions/test.ts](https://github.com/sanity-io/runtime-cli/blob/v14.8.
|
|
700
|
+
_See code: [src/commands/functions/test.ts](https://github.com/sanity-io/runtime-cli/blob/v14.8.4/src/commands/functions/test.ts)_
|
|
701
701
|
|
|
702
702
|
## `sanity-run help [COMMAND]`
|
|
703
703
|
|
|
@@ -5,7 +5,7 @@ import ora from 'ora';
|
|
|
5
5
|
import { readLocalBlueprint, } from '../../actions/blueprints/blueprint.js';
|
|
6
6
|
import { getStack } from '../../actions/blueprints/stacks.js';
|
|
7
7
|
import config, { RUNTIME_CLI_VERSION } from '../../config.js';
|
|
8
|
-
import { check, filePathRelativeToCwd, niceId, severe, unsure, } from '../../utils/display/presenters.js';
|
|
8
|
+
import { check, filePathRelativeToCwd, niceId, renderSection, severe, unsure, } from '../../utils/display/presenters.js';
|
|
9
9
|
import { styleText } from '../../utils/style-text.js';
|
|
10
10
|
import { createTracedFetch } from '../../utils/traced-fetch.js';
|
|
11
11
|
import { validTokenOrErrorMessage } from '../../utils/validated-token.js';
|
|
@@ -31,13 +31,6 @@ function sourceLabel(source) {
|
|
|
31
31
|
return 'unknown';
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
function renderSection(emit, title, rows) {
|
|
35
|
-
const pad = Math.max(...rows.map(([l]) => l.length)) + 3;
|
|
36
|
-
emit(styleText('bold', title));
|
|
37
|
-
for (const [label, value] of rows) {
|
|
38
|
-
emit(` ${styleText('dim', label.padEnd(pad))}${value}`);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
34
|
export async function blueprintDoctorCore(options) {
|
|
42
35
|
const { bin, log, token, validateResources, flags: { verbose: v, path: p, fix }, } = options;
|
|
43
36
|
const path = p || cwd();
|
|
@@ -229,16 +222,16 @@ export async function blueprintDoctorCore(options) {
|
|
|
229
222
|
// --- RENDER REPORT ---
|
|
230
223
|
spinner.stop();
|
|
231
224
|
// Environment (verbose)
|
|
232
|
-
|
|
225
|
+
log.verbose(renderSection('Environment', envRows));
|
|
233
226
|
log.verbose('');
|
|
234
227
|
// Configuration (verbose)
|
|
235
228
|
if (configRows.length > 0) {
|
|
236
|
-
|
|
229
|
+
log.verbose(renderSection('Configuration', configRows));
|
|
237
230
|
log.verbose('');
|
|
238
231
|
}
|
|
239
232
|
// Deployment (verbose)
|
|
240
233
|
if (stackRows.length > 0) {
|
|
241
|
-
|
|
234
|
+
log.verbose(renderSection('Deployment', stackRows));
|
|
242
235
|
log.verbose('');
|
|
243
236
|
}
|
|
244
237
|
// Checks (always visible)
|
|
@@ -3,7 +3,7 @@ import { SANITY_ACCESS_ROBOT, SANITY_ACCESS_ROLE, SANITY_FUNCTION_DOCUMENT, SANI
|
|
|
3
3
|
import { styleText } from '../style-text.js';
|
|
4
4
|
import { isCorsOriginResource, isDatasetResource, isRobotResource, isRoleResource, isWebhookResource, } from '../types.js';
|
|
5
5
|
import { formatDate, formatDuration } from './dates.js';
|
|
6
|
-
import { niceId } from './presenters.js';
|
|
6
|
+
import { capitalize, niceId, renderSection } from './presenters.js';
|
|
7
7
|
import { arrayifyCors, arrayifyDataset, arrayifyFunction, arrayifyRobot, arrayifyRole, arrayifyWebhook, } from './resources-formatting.js';
|
|
8
8
|
const functionCategory = {
|
|
9
9
|
label: 'Functions',
|
|
@@ -159,53 +159,45 @@ export function formatResourceTree(resources, verbose = false) {
|
|
|
159
159
|
}
|
|
160
160
|
export function formatStackInfo(stack, isCurrentStack = false) {
|
|
161
161
|
const isStack = 'id' in stack; // type narrowing
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
if (isStack) {
|
|
165
|
-
let stackName = styleText('bold', `"${stack.name}"`);
|
|
166
|
-
if (isCurrentStack)
|
|
167
|
-
stackName = `${styleText('blue', stackName)} (current)`;
|
|
168
|
-
if (isProjectBasedStack)
|
|
169
|
-
stackName += ' (project-based)';
|
|
170
|
-
output.push(`${stackName} ${niceId(stack.id)}`);
|
|
162
|
+
if (!isStack) {
|
|
163
|
+
return styleText('bold', 'Local Blueprint');
|
|
171
164
|
}
|
|
172
|
-
|
|
173
|
-
|
|
165
|
+
const isProjectBasedStack = stack.id === `ST-${stack.scopeId}`;
|
|
166
|
+
let title = styleText('bold', `"${stack.name}"`);
|
|
167
|
+
if (isCurrentStack)
|
|
168
|
+
title = `${styleText('blue', title)} (current)`;
|
|
169
|
+
if (isProjectBasedStack)
|
|
170
|
+
title += ' (project-based)';
|
|
171
|
+
title = `${title} ${niceId(stack.id)}`;
|
|
172
|
+
const rows = [];
|
|
173
|
+
if (stack.scopeType && stack.scopeId) {
|
|
174
|
+
rows.push([capitalize(stack.scopeType), niceId(stack.scopeId)]);
|
|
174
175
|
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
if (resourceCount != null) {
|
|
178
|
-
infoOutput.push(`${resourceCount} resource${resourceCount === 1 ? '' : 's'}`);
|
|
176
|
+
if (stack.defaultProjectId) {
|
|
177
|
+
rows.push(['Default Project', niceId(stack.defaultProjectId)]);
|
|
179
178
|
}
|
|
180
|
-
|
|
181
|
-
|
|
179
|
+
// Show resource count only for StackSummary (no resource tree follows)
|
|
180
|
+
if ('resourceCount' in stack) {
|
|
181
|
+
const count = stack.resourceCount;
|
|
182
|
+
rows.push(['Resources', `${count ?? 0}`]);
|
|
182
183
|
}
|
|
183
|
-
if (
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
operationOutput.push(`Status: ${styleText(operationColor, status)}`);
|
|
197
|
-
}
|
|
198
|
-
if (operation.createdAt)
|
|
199
|
-
operationOutput.push(`Started: ${formatDate(operation.createdAt)}`);
|
|
200
|
-
if (operation.status === 'COMPLETED' && operation.completedAt && operation.createdAt) {
|
|
201
|
-
operationOutput.push(`Completed: ${formatDate(operation.completedAt)}`);
|
|
202
|
-
operationOutput.push(`Duration: ${styleText('yellow', formatDuration(operation.createdAt, operation.completedAt))}`);
|
|
203
|
-
}
|
|
204
|
-
infoOutput.push(operationOutput);
|
|
184
|
+
if (stack.createdAt)
|
|
185
|
+
rows.push(['Created', formatDate(stack.createdAt)]);
|
|
186
|
+
if (stack.updatedAt)
|
|
187
|
+
rows.push(['Updated', formatDate(stack.updatedAt)]);
|
|
188
|
+
if (stack.recentOperation) {
|
|
189
|
+
const op = stack.recentOperation;
|
|
190
|
+
const color = op.status === 'COMPLETED' ? 'green' : 'red';
|
|
191
|
+
const parts = [styleText(color, op.status || 'UNKNOWN')];
|
|
192
|
+
const time = op.completedAt || op.createdAt;
|
|
193
|
+
if (time)
|
|
194
|
+
parts.push(styleText('dim', formatDate(time)));
|
|
195
|
+
if (op.completedAt && op.createdAt) {
|
|
196
|
+
parts.push(styleText('yellow', `(${formatDuration(op.createdAt, op.completedAt)})`));
|
|
205
197
|
}
|
|
198
|
+
rows.push(['Operation', parts.join(' ')]);
|
|
206
199
|
}
|
|
207
|
-
|
|
208
|
-
return treeify(output, { plain: true });
|
|
200
|
+
return renderSection(title, rows);
|
|
209
201
|
}
|
|
210
202
|
export function formatStacksListing(stacks, currentStackId) {
|
|
211
203
|
if (!stacks || stacks.length === 0)
|
|
@@ -8,3 +8,5 @@ export declare function indent(str: string, spaces?: number): string;
|
|
|
8
8
|
export declare function capitalize(str: string): string;
|
|
9
9
|
export declare function filePathRelativeToCwd(filePath: string): string;
|
|
10
10
|
export declare function labeledId(label: string | undefined, id: string | undefined): string;
|
|
11
|
+
export type Row = [label: string, value: string];
|
|
12
|
+
export declare function renderSection(title: string, rows: Row[]): string;
|
|
@@ -36,3 +36,11 @@ export function filePathRelativeToCwd(filePath) {
|
|
|
36
36
|
export function labeledId(label, id) {
|
|
37
37
|
return `${styleText('blue', capitalize(label || 'unknown'))} ${niceId(id || 'unknown')}`;
|
|
38
38
|
}
|
|
39
|
+
export function renderSection(title, rows) {
|
|
40
|
+
const pad = Math.max(...rows.map(([l]) => l.length)) + 3;
|
|
41
|
+
const lines = [styleText('bold', title)];
|
|
42
|
+
for (const [label, value] of rows) {
|
|
43
|
+
lines.push(` ${styleText('dim', label.padEnd(pad))}${value}`);
|
|
44
|
+
}
|
|
45
|
+
return lines.join('\n');
|
|
46
|
+
}
|
package/oclif.manifest.json
CHANGED