@sanity/runtime-cli 17.3.2 → 17.4.0-blueprinit.g596ac51
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 +50 -47
- package/SKILL.md +59 -0
- package/dist/actions/blueprinit/manifest.d.ts +15 -0
- package/dist/actions/blueprinit/manifest.js +82 -0
- package/dist/actions/blueprinit/studio.d.ts +6 -0
- package/dist/actions/blueprinit/studio.js +43 -0
- package/dist/actions/blueprinit/templates.d.ts +34 -0
- package/dist/actions/blueprinit/templates.js +83 -0
- package/dist/actions/blueprinit/workspace.d.ts +16 -0
- package/dist/actions/blueprinit/workspace.js +143 -0
- package/dist/actions/blueprints/pre-deploy.d.ts +15 -6
- package/dist/actions/blueprints/pre-deploy.js +29 -70
- package/dist/actions/blueprints/process-assets.d.ts +29 -0
- package/dist/actions/blueprints/process-assets.js +80 -0
- package/dist/actions/functions/list.d.ts +34 -0
- package/dist/actions/functions/list.js +33 -0
- package/dist/actions/sanity/datasets.d.ts +15 -0
- package/dist/actions/sanity/datasets.js +26 -0
- package/dist/baseCommands.d.ts +2 -0
- package/dist/baseCommands.js +3 -0
- package/dist/commands/blueprinit.d.ts +17 -0
- package/dist/commands/blueprinit.js +59 -0
- package/dist/commands/blueprints/deploy.d.ts +2 -0
- package/dist/commands/blueprints/deploy.js +22 -1
- package/dist/commands/blueprints/destroy.js +1 -1
- package/dist/commands/blueprints/info.d.ts +1 -0
- package/dist/commands/blueprints/info.js +5 -0
- package/dist/commands/blueprints/init.js +1 -2
- package/dist/commands/blueprints/logs.js +1 -0
- package/dist/commands/functions/add.js +3 -3
- package/dist/commands/functions/dev.js +2 -2
- package/dist/commands/functions/list.d.ts +14 -0
- package/dist/commands/functions/list.js +38 -0
- package/dist/commands/functions/logs.d.ts +1 -1
- package/dist/commands/functions/logs.js +3 -0
- package/dist/cores/blueprinit/adopt.d.ts +6 -0
- package/dist/cores/blueprinit/adopt.js +119 -0
- package/dist/cores/blueprinit/finish.d.ts +14 -0
- package/dist/cores/blueprinit/finish.js +64 -0
- package/dist/cores/blueprinit/fresh.d.ts +3 -0
- package/dist/cores/blueprinit/fresh.js +120 -0
- package/dist/cores/blueprinit/preview.d.ts +15 -0
- package/dist/cores/blueprinit/preview.js +14 -0
- package/dist/cores/blueprinit/prompts.d.ts +5 -0
- package/dist/cores/blueprinit/prompts.js +22 -0
- package/dist/cores/blueprinit/selection.d.ts +15 -0
- package/dist/cores/blueprinit/selection.js +90 -0
- package/dist/cores/blueprinit/types.d.ts +16 -0
- package/dist/cores/blueprinit/types.js +1 -0
- package/dist/cores/blueprinit.d.ts +7 -0
- package/dist/cores/blueprinit.js +48 -0
- package/dist/cores/blueprints/deploy.js +69 -19
- package/dist/cores/functions/add.js +1 -1
- package/dist/cores/functions/list.d.ts +10 -0
- package/dist/cores/functions/list.js +34 -0
- package/dist/utils/display/blueprints-formatting.js +3 -3
- package/dist/utils/display/functions-formatting.d.ts +7 -0
- package/dist/utils/display/functions-formatting.js +95 -0
- package/dist/utils/style-text.js +1 -0
- package/oclif.manifest.json +271 -15
- package/package.json +31 -17
- package/skills/_functions-build.md +23 -0
- package/skills/_functions-list.md +28 -0
- package/skills/blueprinit.md +155 -0
- package/skills/blueprints-add.md +8 -0
- package/skills/blueprints-config.md +33 -0
- package/skills/blueprints-deploy.md +36 -0
- package/skills/blueprints-destroy.md +30 -0
- package/skills/blueprints-doctor.md +31 -0
- package/skills/blueprints-info.md +23 -0
- package/skills/blueprints-init.md +48 -0
- package/skills/blueprints-logs.md +33 -0
- package/skills/blueprints-mint-deploy-token.md +25 -0
- package/skills/blueprints-plan.md +28 -0
- package/skills/blueprints-promote.md +31 -0
- package/skills/blueprints-stacks.md +28 -0
- package/skills/functions-add.md +35 -0
- package/skills/functions-dev.md +21 -0
- package/skills/functions-env-add.md +29 -0
- package/skills/functions-env-list.md +21 -0
- package/skills/functions-env-remove.md +22 -0
- package/skills/functions-logs.md +39 -0
- package/skills/functions-test.md +31 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# `npx @sanity/cli functions logs`
|
|
2
|
+
|
|
3
|
+
Fetch, stream, or delete logs for one deployed Function. Always provide the Function name; omitting it only prints valid names and command help.
|
|
4
|
+
|
|
5
|
+
Run from the Blueprint directory or a subdirectory; the manifest supplies the valid Function names.
|
|
6
|
+
|
|
7
|
+
## Fetch logs
|
|
8
|
+
|
|
9
|
+
Prefer a bounded, structured query for agent work:
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
npx @sanity/cli functions logs process-order --limit 100 --json
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
`--limit` defaults to 50. Entries without both a level and a message are dropped, so a returned count can be lower than the limit even when more logs exist.
|
|
16
|
+
|
|
17
|
+
When entries are found, the JSON result contains a `logs` array of `{time, requestId, level, message}`. Human-readable output drops `requestId` and prints local timestamps unless `--utc` is passed. Pass `--stack NAME_OR_ID` to override the locally configured Stack.
|
|
18
|
+
|
|
19
|
+
Logs may contain payload data or application secrets. Summarize only what is needed and do not reproduce credentials or personal data.
|
|
20
|
+
|
|
21
|
+
## Stream logs
|
|
22
|
+
|
|
23
|
+
`--watch` (alias `--follow`, `-w`) keeps running until interrupted and emits human-readable output:
|
|
24
|
+
|
|
25
|
+
```sh
|
|
26
|
+
npx @sanity/cli functions logs process-order --watch
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
`--watch` cannot be combined with `--json`. Streamed timestamps are always UTC, so `--utc` is ignored. Use watch mode only when continuous monitoring is requested, and stop it when monitoring is complete.
|
|
30
|
+
|
|
31
|
+
## Delete logs
|
|
32
|
+
|
|
33
|
+
Deleting removes all logs for the Function. Obtain explicit authorization and confirm the Function and Stack first:
|
|
34
|
+
|
|
35
|
+
```sh
|
|
36
|
+
npx @sanity/cli functions logs process-order --delete
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
The command prompts (defaulting to no) unless `--force` is supplied, and `--force` requires `--delete`. Use `--force` only for an authorized non-interactive deletion. `--delete` is rejected alongside `--limit` or `--json`.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# `npx @sanity/cli functions test`
|
|
2
|
+
|
|
3
|
+
Invoke a local Function with a test payload. Local execution can still make network requests or mutate external systems, so inspect the handler and payload before running it.
|
|
4
|
+
|
|
5
|
+
## Run a bounded test
|
|
6
|
+
|
|
7
|
+
Always provide the Function name. Prefer a JSON file for nontrivial payloads:
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npx @sanity/cli functions test process-order --file payload.json --json
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Use `--data '{"orderId":"order-123"}'` for a small inline JSON object. `--data`, `--file`, and `--document-id` are alternative input modes, and each must resolve to a JSON object. File paths are joined to the current working directory, so pass relative paths.
|
|
14
|
+
|
|
15
|
+
Payloads reach document and media-library Functions only. Scheduled and sync-tag-invalidation Functions are invoked with a fixed scheduled event, and any payload flag is accepted and then ignored.
|
|
16
|
+
|
|
17
|
+
For document and media-library Functions, the event defaults to `create` and also accepts `update` and `delete`. For an update event, provide one complete before/after pair:
|
|
18
|
+
|
|
19
|
+
```sh
|
|
20
|
+
npx @sanity/cli functions test process-order --event update --file-before before.json --file-after after.json --json
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
The Blueprint's `event.filter` and `event.projection` are applied to the payload before the handler runs, and a payload the filter excludes is skipped rather than executed. `--timeout SECONDS` overrides the Function's configured `timeout` for this run (default 10 seconds).
|
|
24
|
+
|
|
25
|
+
## Remote data and credentials
|
|
26
|
+
|
|
27
|
+
`--document-id` fetches a document (`--project-id`, `--dataset`) or a media-library asset (`--media-library-id`) with the CLI's stored token before local execution. `--api` sets the API version used for that fetch.
|
|
28
|
+
|
|
29
|
+
`--with-user-token` injects the authenticated CLI token into the Function context. Use it only for trusted local code when authenticated API behavior is part of the test. Never include the token in payloads or output.
|
|
30
|
+
|
|
31
|
+
The JSON result contains logs and any Function response. Review logs for sensitive data before sharing them.
|