@sanity/runtime-cli 17.4.0-blueprinit.g0ac8878 → 17.4.0-blueprinit.gb640804
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 +50 -12
- package/dist/actions/blueprinit/manifest.js +21 -15
- 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/commands/blueprints/deploy.js +3 -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/logs.d.ts +1 -1
- package/dist/commands/functions/logs.js +3 -0
- package/dist/commands/{blueprinit.d.ts → init.d.ts} +1 -1
- package/dist/commands/{blueprinit.js → init.js} +1 -1
- package/dist/cores/blueprinit.js +1 -1
- package/dist/cores/blueprints/deploy.js +69 -19
- package/dist/cores/functions/add.js +1 -1
- package/dist/utils/display/blueprints-formatting.js +3 -3
- package/dist/utils/style-text.js +1 -0
- package/oclif.manifest.json +24 -18
- package/package.json +27 -17
- package/skills/_functions-build.md +23 -0
- package/skills/_functions-list.md +28 -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
- package/skills/{blueprinit.md → init.md} +6 -6
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# `npx @sanity/cli functions env remove`
|
|
2
|
+
|
|
3
|
+
Delete one environment variable from a deployed Function. The command does not ask for confirmation and does not redeploy the Stack.
|
|
4
|
+
|
|
5
|
+
Run from the Blueprint directory or a subdirectory; the manifest is required even though the command only touches remote state.
|
|
6
|
+
|
|
7
|
+
## Required checks
|
|
8
|
+
|
|
9
|
+
1. Obtain authorization to remove the key.
|
|
10
|
+
2. Resolve the exact Function and Stack.
|
|
11
|
+
3. Run `functions env list` and confirm that the key is present.
|
|
12
|
+
4. Check whether the Function still requires the variable.
|
|
13
|
+
|
|
14
|
+
## Remove
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
npx @sanity/cli functions env remove process-order LEGACY_API_URL --json
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Override the locally configured Stack with `--stack NAME_OR_ID`.
|
|
21
|
+
|
|
22
|
+
The JSON result contains the Function name and removed key, not the old value. If the value may be needed again, arrange a user-approved backup before removal; this command cannot retrieve it.
|
|
@@ -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.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# init
|
|
2
2
|
|
|
3
|
-
Use `
|
|
3
|
+
Use `init` to scaffold a Blueprint around an existing Sanity project. The command is
|
|
4
4
|
experimental, hidden from root help, and available from the `blueprinit` npm dist-tag.
|
|
5
5
|
|
|
6
6
|
Use it for demos and evaluation, not as a stable project initializer. Its flags, generated files,
|
|
@@ -8,7 +8,7 @@ and resource model may change.
|
|
|
8
8
|
|
|
9
9
|
## Know what it does
|
|
10
10
|
|
|
11
|
-
`
|
|
11
|
+
`init` uses an existing Sanity organization, project, and dataset. It writes local Blueprint
|
|
12
12
|
files, then creates an empty organization-scoped Stack. The generated Blueprint attaches the
|
|
13
13
|
project and dataset and declares resources for a later deployment.
|
|
14
14
|
|
|
@@ -65,7 +65,7 @@ npx @sanity/runtime-cli@blueprinit blueprints doctor
|
|
|
65
65
|
When the organization and project IDs are known, run this from the target directory:
|
|
66
66
|
|
|
67
67
|
```sh
|
|
68
|
-
npx @sanity/runtime-cli@blueprinit
|
|
68
|
+
npx @sanity/runtime-cli@blueprinit init --yes \
|
|
69
69
|
--organization-id <organization-id> \
|
|
70
70
|
--project-id <project-id> \
|
|
71
71
|
--dataset <dataset-name>
|
|
@@ -91,7 +91,7 @@ For interactive organization, project, dataset, confirmation, and Studio-name pr
|
|
|
91
91
|
user run:
|
|
92
92
|
|
|
93
93
|
```sh
|
|
94
|
-
npx @sanity/runtime-cli@blueprinit
|
|
94
|
+
npx @sanity/runtime-cli@blueprinit init
|
|
95
95
|
```
|
|
96
96
|
|
|
97
97
|
When the project has several datasets, the interactive command prompts for one and lists
|
|
@@ -152,4 +152,4 @@ the user's request.
|
|
|
152
152
|
Do not delete or replace it without the user's direction.
|
|
153
153
|
- **Stack quota or duplicate-name error.** Local scaffold files may already exist while
|
|
154
154
|
`.sanity/blueprint.config.json` does not. Resolve the Stack error, then run the recovery command
|
|
155
|
-
printed by `
|
|
155
|
+
printed by `init`, which is `blueprints init`. It connects the existing manifest without rewriting it.
|