@sanity/runtime-cli 17.2.0 → 17.3.0-blueprinit.gb1c5e1e
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 +36 -27
- package/SKILL.md +21 -0
- package/dist/actions/blueprinit/manifest.d.ts +13 -0
- package/dist/actions/blueprinit/manifest.js +57 -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 +15 -0
- package/dist/actions/blueprinit/workspace.js +142 -0
- package/dist/actions/blueprints/assets.js +15 -24
- package/dist/actions/blueprints/pre-deploy.d.ts +29 -0
- package/dist/actions/blueprints/pre-deploy.js +164 -0
- package/dist/actions/sanity/datasets.d.ts +15 -0
- package/dist/actions/sanity/datasets.js +26 -0
- package/dist/commands/blueprinit.d.ts +14 -0
- package/dist/commands/blueprinit.js +46 -0
- package/dist/commands/functions/env/add.d.ts +3 -0
- package/dist/commands/functions/env/add.js +6 -2
- package/dist/commands/functions/env/list.d.ts +3 -0
- package/dist/commands/functions/env/list.js +9 -3
- package/dist/commands/functions/env/remove.d.ts +3 -0
- package/dist/commands/functions/env/remove.js +9 -3
- package/dist/constants.d.ts +1 -0
- package/dist/constants.js +1 -0
- package/dist/cores/blueprinit/adopt.d.ts +6 -0
- package/dist/cores/blueprinit/adopt.js +90 -0
- package/dist/cores/blueprinit/finish.d.ts +14 -0
- package/dist/cores/blueprinit/finish.js +36 -0
- package/dist/cores/blueprinit/fresh.d.ts +3 -0
- package/dist/cores/blueprinit/fresh.js +88 -0
- package/dist/cores/blueprinit/prompts.d.ts +4 -0
- package/dist/cores/blueprinit/prompts.js +14 -0
- package/dist/cores/blueprinit/selection.d.ts +15 -0
- package/dist/cores/blueprinit/selection.js +63 -0
- package/dist/cores/blueprinit/types.d.ts +13 -0
- package/dist/cores/blueprinit/types.js +1 -0
- package/dist/cores/blueprinit.d.ts +7 -0
- package/dist/cores/blueprinit.js +39 -0
- package/dist/cores/blueprints/deploy.js +16 -64
- package/dist/server/static/vendor/vendor.bundle.js +10 -14
- package/dist/utils/functions/child-process-wrapper.js +13 -171
- package/dist/utils/functions/child-runtime/console.d.ts +1 -0
- package/dist/utils/functions/child-runtime/console.js +50 -0
- package/dist/utils/functions/child-runtime/invoke.d.ts +4 -0
- package/dist/utils/functions/child-runtime/invoke.js +47 -0
- package/dist/utils/functions/child-runtime/resources.d.ts +4 -0
- package/dist/utils/functions/child-runtime/resources.js +59 -0
- package/dist/utils/studios/prepare-asset.d.ts +6 -0
- package/dist/utils/studios/prepare-asset.js +139 -0
- package/dist/utils/types.d.ts +4 -7
- package/dist/utils/types.js +2 -3
- package/oclif.manifest.json +113 -7
- package/package.json +26 -16
- package/skills/blueprinit.md +137 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import {table as renderTable} from 'node:console'
|
|
2
|
+
import process from 'node:process'
|
|
3
|
+
import {inspect} from 'node:util'
|
|
4
|
+
|
|
5
|
+
// Monkey patch console methods to have logs match server log format
|
|
6
|
+
function logPrefix(level, ...args) {
|
|
7
|
+
const date = new Date()
|
|
8
|
+
const shouldUseColors = process.env.FORCE_COLOR === '1'
|
|
9
|
+
const message = args
|
|
10
|
+
.map((arg) =>
|
|
11
|
+
typeof arg === 'string' ? arg : inspect(arg, {depth: null, colors: shouldUseColors}),
|
|
12
|
+
)
|
|
13
|
+
.join(' ')
|
|
14
|
+
return `${date.toLocaleDateString()} ${date.toLocaleTimeString()} ${level.toUpperCase()} ${message}`
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function installConsole() {
|
|
18
|
+
console.log = (...args) => process.stdout.write(`${logPrefix('info', ...args)}\n`)
|
|
19
|
+
console.info = (...args) => process.stdout.write(`${logPrefix('info', ...args)}\n`)
|
|
20
|
+
console.warn = (...args) => process.stdout.write(`${logPrefix('warn', ...args)}\n`)
|
|
21
|
+
console.error = (...args) => process.stdout.write(`${logPrefix('error', ...args)}\n`)
|
|
22
|
+
console.dir = (obj, options) => {
|
|
23
|
+
const shouldUseColors = process.env.FORCE_COLOR === '1'
|
|
24
|
+
const inspectOptions = {...options, colors: shouldUseColors}
|
|
25
|
+
process.stdout.write(`${logPrefix('info', inspect(obj, inspectOptions))}\n`)
|
|
26
|
+
}
|
|
27
|
+
console.table = (data, columns) => {
|
|
28
|
+
const prefix = logPrefix('info')
|
|
29
|
+
|
|
30
|
+
// Capture table output
|
|
31
|
+
const originalWrite = process.stdout.write.bind(process.stdout)
|
|
32
|
+
let buffer = ''
|
|
33
|
+
|
|
34
|
+
process.stdout.write = (chunk, _encoding, callback) => {
|
|
35
|
+
buffer += chunk
|
|
36
|
+
if (typeof callback === 'function') callback()
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
renderTable(data, columns)
|
|
40
|
+
|
|
41
|
+
// Restore and print
|
|
42
|
+
process.stdout.write = originalWrite
|
|
43
|
+
for (const line of buffer.split('\n')) {
|
|
44
|
+
if (line.trim()) {
|
|
45
|
+
const message = `${!line.startsWith(prefix) ? `${prefix} ${line}` : line}`.trim()
|
|
46
|
+
process.stdout.write(`${message}\n`)
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import process from 'node:process'
|
|
2
|
+
|
|
3
|
+
export function createInvoker() {
|
|
4
|
+
/**
|
|
5
|
+
* Pending nested `context.invoke` calls, keyed by correlation id. Each entry
|
|
6
|
+
* holds the resolve/reject of the Promise returned to the user's handler; it is
|
|
7
|
+
* settled when the matching `invoke-response` arrives from the parent.
|
|
8
|
+
* @type {Map<string, {resolve: (value: unknown) => void, reject: (reason: Error) => void}>}
|
|
9
|
+
*/
|
|
10
|
+
const pending = new Map()
|
|
11
|
+
let invokeSeq = 0
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* `context.invoke(name, payload)` — ask the parent to execute another blueprint
|
|
15
|
+
* function and resolve with its return value. Sent over IPC and correlated by id.
|
|
16
|
+
* @param {string} name
|
|
17
|
+
* @param {Record<string, unknown>} [payload]
|
|
18
|
+
* @returns {Promise<unknown>}
|
|
19
|
+
*/
|
|
20
|
+
function invoke(name, payload = {}) {
|
|
21
|
+
if (typeof name !== 'string' || name.length === 0) {
|
|
22
|
+
return Promise.reject(new Error('context.invoke requires a function name'))
|
|
23
|
+
}
|
|
24
|
+
const id = String(++invokeSeq)
|
|
25
|
+
return new Promise((resolve, reject) => {
|
|
26
|
+
pending.set(id, {resolve, reject})
|
|
27
|
+
process.send(JSON.stringify({type: 'invoke-request', id, name, payload}))
|
|
28
|
+
})
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function handleResponse(msg) {
|
|
32
|
+
const pendingEntry = pending.get(msg.id)
|
|
33
|
+
if (!pendingEntry) return
|
|
34
|
+
pending.delete(msg.id)
|
|
35
|
+
if (msg.ok) {
|
|
36
|
+
pendingEntry.resolve(msg.result?.json)
|
|
37
|
+
} else {
|
|
38
|
+
const {message, stack, name} = msg.error ?? {}
|
|
39
|
+
const err = new Error(message ?? 'Nested invoke failed')
|
|
40
|
+
if (stack) err.stack = stack
|
|
41
|
+
if (name) err.name = name
|
|
42
|
+
pendingEntry.reject(err)
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return {invoke, handleResponse}
|
|
47
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The returned proxy wraps a function so the API itself is callable.
|
|
3
|
+
* @param {Record<string, ResourceEntry[]>} resources
|
|
4
|
+
* @returns {ResourcesApi}
|
|
5
|
+
*/
|
|
6
|
+
export function createResourcesApi(resources) {
|
|
7
|
+
const findByName = (name) => {
|
|
8
|
+
for (const group of Object.values(resources)) {
|
|
9
|
+
const found = group.find((r) => r.name === name)
|
|
10
|
+
if (found) return found
|
|
11
|
+
}
|
|
12
|
+
return undefined
|
|
13
|
+
}
|
|
14
|
+
let allCache
|
|
15
|
+
const all = () => (allCache ??= Object.values(resources).flat())
|
|
16
|
+
|
|
17
|
+
return /** @type {ResourcesApi} */ (
|
|
18
|
+
/** @type {unknown} */ (
|
|
19
|
+
/*
|
|
20
|
+
* The Proxy target is `findByName`, so invoking the API as a function —
|
|
21
|
+
* `context.resources('my-proj')` — bypasses the `get` trap entirely and
|
|
22
|
+
* calls `findByName` directly for a cross-type lookup by name.
|
|
23
|
+
*/
|
|
24
|
+
new Proxy(findByName, {
|
|
25
|
+
get: (_target, prop) => {
|
|
26
|
+
// context.resources.all() — flat array of every resource across types
|
|
27
|
+
if (prop === 'all') return all
|
|
28
|
+
// [...context.resources] / for (const r of context.resources) — iterate all
|
|
29
|
+
if (prop === Symbol.iterator) {
|
|
30
|
+
return function* () {
|
|
31
|
+
yield* all()
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Symbol property access (other than iterator above) and `then`
|
|
37
|
+
* lookups return undefined. The `then` guard prevents the API from
|
|
38
|
+
* looking like a thenable, so `await context.resources` resolves to
|
|
39
|
+
* the proxy itself rather than hanging or unwrapping unexpectedly.
|
|
40
|
+
*/
|
|
41
|
+
if (typeof prop !== 'string' || prop === 'then') {
|
|
42
|
+
return undefined
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* context.resources.<type>(name) — per-type lookup,
|
|
47
|
+
* e.g. context.resources.project('my-proj').
|
|
48
|
+
* Returns a function so the caller supplies the name;
|
|
49
|
+
* unknown types yield a function that always returns undefined.
|
|
50
|
+
*/
|
|
51
|
+
return (/** @type {string} */ name) =>
|
|
52
|
+
Object.hasOwn(resources, prop)
|
|
53
|
+
? resources[prop].find((r) => r.name === name)
|
|
54
|
+
: undefined
|
|
55
|
+
},
|
|
56
|
+
})
|
|
57
|
+
)
|
|
58
|
+
)
|
|
59
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { BlueprintStudioResource } from '@sanity/blueprints';
|
|
2
|
+
import type { AssetPrepResult } from '../types.js';
|
|
3
|
+
export declare function prepareStudioAsset({ blueprintFileDir, resource, }: {
|
|
4
|
+
blueprintFileDir: string;
|
|
5
|
+
resource: BlueprintStudioResource;
|
|
6
|
+
}): Promise<AssetPrepResult>;
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { createWriteStream } from 'node:fs';
|
|
2
|
+
import { mkdtemp, rm, stat } from 'node:fs/promises';
|
|
3
|
+
import { tmpdir } from 'node:os';
|
|
4
|
+
import path, { basename, dirname, join } from 'node:path';
|
|
5
|
+
import { pipeline } from 'node:stream/promises';
|
|
6
|
+
import { createGzip } from 'node:zlib';
|
|
7
|
+
import { buildStudio, compareDependencyVersions } from '@sanity/cli-build/_internal/build';
|
|
8
|
+
import { pack } from 'tar-fs';
|
|
9
|
+
export async function prepareStudioAsset({ blueprintFileDir, resource, }) {
|
|
10
|
+
// validate resource has an externalId
|
|
11
|
+
if (!('externalId' in resource) ||
|
|
12
|
+
typeof resource.externalId !== 'string' ||
|
|
13
|
+
!resource.externalId) {
|
|
14
|
+
return {
|
|
15
|
+
success: false,
|
|
16
|
+
async cleanup() {
|
|
17
|
+
// no op
|
|
18
|
+
},
|
|
19
|
+
error: `Unable to determine appId for sanity.studio resource '${resource.name}'`,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
let cleanup = async () => {
|
|
23
|
+
// no op
|
|
24
|
+
};
|
|
25
|
+
const studioPath = path.resolve(blueprintFileDir, resource.src);
|
|
26
|
+
try {
|
|
27
|
+
const studioPathStat = await stat(studioPath);
|
|
28
|
+
if (!studioPathStat.isDirectory()) {
|
|
29
|
+
return {
|
|
30
|
+
success: false,
|
|
31
|
+
cleanup,
|
|
32
|
+
error: `Property 'src' on resource with type '${resource.type}' must be a directory`,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
38
|
+
return {
|
|
39
|
+
success: false,
|
|
40
|
+
cleanup,
|
|
41
|
+
error: `Unable to read given 'src' on resource with type '${resource.type}': ${msg}`,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
try {
|
|
45
|
+
const outDir = await mkdtemp(join(tmpdir(), `studio-build-`));
|
|
46
|
+
const outFile = `${outDir}.tar.gz`;
|
|
47
|
+
cleanup = async () => {
|
|
48
|
+
await rm(outDir, { force: true, recursive: true });
|
|
49
|
+
await rm(outFile, { force: true });
|
|
50
|
+
};
|
|
51
|
+
const appId = resource.externalId;
|
|
52
|
+
try {
|
|
53
|
+
await buildStudio({
|
|
54
|
+
appId,
|
|
55
|
+
autoUpdatesEnabled: resource.autoUpdates.enabled,
|
|
56
|
+
checkAppId() { },
|
|
57
|
+
async compareDependencyVersions(packages) {
|
|
58
|
+
return compareDependencyVersions(packages, studioPath, { appId });
|
|
59
|
+
},
|
|
60
|
+
determineBasePath() {
|
|
61
|
+
return resource.basePath ?? '/';
|
|
62
|
+
},
|
|
63
|
+
isApp: false,
|
|
64
|
+
isWorkbenchApp: false,
|
|
65
|
+
minify: resource.minify ?? true,
|
|
66
|
+
outDir,
|
|
67
|
+
output: createSilentOutput(),
|
|
68
|
+
reactCompiler: resource.reactCompiler || false,
|
|
69
|
+
schemaExtraction: undefined,
|
|
70
|
+
sourceMap: resource.sourceMap ?? false,
|
|
71
|
+
stats: false,
|
|
72
|
+
unattendedMode: true,
|
|
73
|
+
// TODO pass in vite config from the studio resource
|
|
74
|
+
vite: undefined,
|
|
75
|
+
workDir: studioPath,
|
|
76
|
+
eventListener: {
|
|
77
|
+
onBuildFail({ message }) {
|
|
78
|
+
throw new Error(message);
|
|
79
|
+
},
|
|
80
|
+
onInvalidStyledComponentsVersionRange({ message }) {
|
|
81
|
+
throw new Error(message);
|
|
82
|
+
},
|
|
83
|
+
onNoDeclaredStyledComponentsVersion({ message }) {
|
|
84
|
+
throw new Error(message);
|
|
85
|
+
},
|
|
86
|
+
onNoInstalledSanityVersion({ message }) {
|
|
87
|
+
throw new Error(message);
|
|
88
|
+
},
|
|
89
|
+
onNoInstalledStyledComponentsVersion({ message }) {
|
|
90
|
+
throw new Error(message);
|
|
91
|
+
},
|
|
92
|
+
onPreReleaseInNonInteractiveAutoUpdate({ message }) {
|
|
93
|
+
throw new Error(message);
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
100
|
+
return {
|
|
101
|
+
success: false,
|
|
102
|
+
cleanup,
|
|
103
|
+
error: message,
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
// tar/gzip/write the built output
|
|
107
|
+
await pipeline(pack(dirname(outDir), { entries: [basename(outDir)] }), createGzip(), createWriteStream(outFile));
|
|
108
|
+
return {
|
|
109
|
+
success: true,
|
|
110
|
+
cleanup,
|
|
111
|
+
// studio must be pre built (e.g. with `npm run build`) and tarred/gzipped
|
|
112
|
+
outputPath: outFile,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
return {
|
|
117
|
+
success: false,
|
|
118
|
+
cleanup,
|
|
119
|
+
error: error instanceof Error ? error.message : String(error),
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
function createSilentOutput() {
|
|
124
|
+
return {
|
|
125
|
+
error(input, options) {
|
|
126
|
+
if (typeof options?.exit === 'number') {
|
|
127
|
+
if (input instanceof Error) {
|
|
128
|
+
throw input;
|
|
129
|
+
}
|
|
130
|
+
throw new Error(input);
|
|
131
|
+
}
|
|
132
|
+
return undefined;
|
|
133
|
+
},
|
|
134
|
+
log() { },
|
|
135
|
+
warn(input) {
|
|
136
|
+
return input;
|
|
137
|
+
},
|
|
138
|
+
};
|
|
139
|
+
}
|
package/dist/utils/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type BlueprintCorsOriginResource, type BlueprintDatasetResource, type BlueprintDocumentFunctionResource, type BlueprintDocumentWebhookResource, type BlueprintMediaLibraryAssetFunctionResource, type BlueprintProjectResource, type BlueprintResource, type BlueprintRobotResource, type BlueprintRoleResource, type BlueprintScheduledFunctionResource, type BlueprintSyncTagInvalidateFunctionResource } from '@sanity/blueprints';
|
|
1
|
+
import { type BlueprintCorsOriginResource, type BlueprintDatasetResource, type BlueprintDocumentFunctionResource, type BlueprintDocumentWebhookResource, type BlueprintMediaLibraryAssetFunctionResource, type BlueprintProjectResource, type BlueprintResource, type BlueprintRobotResource, type BlueprintRoleResource, type BlueprintScheduledFunctionResource, type BlueprintStudioResource, type BlueprintSyncTagInvalidateFunctionResource } from '@sanity/blueprints';
|
|
2
2
|
export type ScopeType = 'organization' | 'project';
|
|
3
3
|
/** Result utility type */
|
|
4
4
|
export type Result<T, E = string> = {
|
|
@@ -16,12 +16,8 @@ export interface ActionResponse {
|
|
|
16
16
|
/** @internal */
|
|
17
17
|
export type FunctionGroqResource = BlueprintDocumentFunctionResource | BlueprintMediaLibraryAssetFunctionResource;
|
|
18
18
|
export type FunctionResource = FunctionGroqResource | BlueprintScheduledFunctionResource | BlueprintSyncTagInvalidateFunctionResource;
|
|
19
|
-
export interface StudioResource extends BlueprintResource {
|
|
20
|
-
type: 'sanity.studio';
|
|
21
|
-
src: string;
|
|
22
|
-
}
|
|
23
19
|
/** Resource types that carry a deployable asset (have src: string) */
|
|
24
|
-
export type AssetResource = FunctionResource |
|
|
20
|
+
export type AssetResource = FunctionResource | BlueprintStudioResource;
|
|
25
21
|
/** @internal */
|
|
26
22
|
export interface AuthParams {
|
|
27
23
|
token: string;
|
|
@@ -46,7 +42,7 @@ export declare function isProjectResource(r: unknown): r is BlueprintProjectReso
|
|
|
46
42
|
export declare function isRobotResource(r: unknown): r is BlueprintRobotResource;
|
|
47
43
|
export declare function isRoleResource(r: unknown): r is BlueprintRoleResource;
|
|
48
44
|
export declare function isDatasetResource(r: unknown): r is BlueprintDatasetResource;
|
|
49
|
-
export declare function isStudioResource(r: BlueprintResource): r is
|
|
45
|
+
export declare function isStudioResource(r: BlueprintResource): r is BlueprintStudioResource;
|
|
50
46
|
export declare function isAssetResource(r: BlueprintResource): r is AssetResource;
|
|
51
47
|
export declare function isWebhookResource(r: unknown): r is BlueprintDocumentWebhookResource;
|
|
52
48
|
interface StackBase {
|
|
@@ -84,6 +80,7 @@ export interface StackMutation {
|
|
|
84
80
|
resources?: BlueprintResource[];
|
|
85
81
|
};
|
|
86
82
|
userMessage?: string;
|
|
83
|
+
preDeploy?: boolean;
|
|
87
84
|
}
|
|
88
85
|
/** @internal */
|
|
89
86
|
export interface BuildPayloadOptions {
|
package/dist/utils/types.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { validateCorsOrigin, validateDataset, validateDocumentWebhook, validateProject, validateRobot, validateRole, } from '@sanity/blueprints';
|
|
2
|
-
import { SANITY_FUNCTION_PREFIX } from '../constants.js';
|
|
2
|
+
import { SANITY_FUNCTION_PREFIX, SANITY_STUDIO } from '../constants.js';
|
|
3
3
|
export function isLocalFunctionResource(r) {
|
|
4
4
|
return r.type.startsWith(SANITY_FUNCTION_PREFIX);
|
|
5
5
|
}
|
|
@@ -22,9 +22,8 @@ export function isRoleResource(r) {
|
|
|
22
22
|
export function isDatasetResource(r) {
|
|
23
23
|
return validateDataset(r).length === 0;
|
|
24
24
|
}
|
|
25
|
-
// TODO: update to use blueprints helpers once available
|
|
26
25
|
export function isStudioResource(r) {
|
|
27
|
-
return r.type ===
|
|
26
|
+
return r.type === SANITY_STUDIO;
|
|
28
27
|
}
|
|
29
28
|
export function isAssetResource(r) {
|
|
30
29
|
return isLocalFunctionResource(r) || isStudioResource(r);
|
package/oclif.manifest.json
CHANGED
|
@@ -1,5 +1,111 @@
|
|
|
1
1
|
{
|
|
2
2
|
"commands": {
|
|
3
|
+
"blueprinit": {
|
|
4
|
+
"aliases": [],
|
|
5
|
+
"args": {},
|
|
6
|
+
"description": "Scaffolds a Blueprint, Studio, and starter function around an existing Sanity project.\n\nThis hidden command is an experiment; its interface and generated files are not stable.",
|
|
7
|
+
"examples": [
|
|
8
|
+
"<%= config.bin %> <%= command.id %>",
|
|
9
|
+
"<%= config.bin %> <%= command.id %> --yes"
|
|
10
|
+
],
|
|
11
|
+
"flags": {
|
|
12
|
+
"json": {
|
|
13
|
+
"description": "Format output as json",
|
|
14
|
+
"name": "json",
|
|
15
|
+
"allowNo": false,
|
|
16
|
+
"type": "boolean"
|
|
17
|
+
},
|
|
18
|
+
"path": {
|
|
19
|
+
"aliases": [
|
|
20
|
+
"blueprint-path"
|
|
21
|
+
],
|
|
22
|
+
"char": "p",
|
|
23
|
+
"description": "Path to a Blueprint file or directory containing one",
|
|
24
|
+
"env": "SANITY_BLUEPRINT_PATH",
|
|
25
|
+
"hidden": true,
|
|
26
|
+
"name": "path",
|
|
27
|
+
"hasDynamicHelp": false,
|
|
28
|
+
"multiple": false,
|
|
29
|
+
"type": "option"
|
|
30
|
+
},
|
|
31
|
+
"trace": {
|
|
32
|
+
"description": "Trace output",
|
|
33
|
+
"hidden": true,
|
|
34
|
+
"name": "trace",
|
|
35
|
+
"allowNo": false,
|
|
36
|
+
"type": "boolean"
|
|
37
|
+
},
|
|
38
|
+
"validate-resources": {
|
|
39
|
+
"description": "Validate resources",
|
|
40
|
+
"hidden": true,
|
|
41
|
+
"name": "validate-resources",
|
|
42
|
+
"allowNo": true,
|
|
43
|
+
"type": "boolean"
|
|
44
|
+
},
|
|
45
|
+
"verbose": {
|
|
46
|
+
"description": "Verbose output",
|
|
47
|
+
"hidden": true,
|
|
48
|
+
"name": "verbose",
|
|
49
|
+
"allowNo": false,
|
|
50
|
+
"type": "boolean"
|
|
51
|
+
},
|
|
52
|
+
"llms": {
|
|
53
|
+
"aliases": [
|
|
54
|
+
"skill"
|
|
55
|
+
],
|
|
56
|
+
"description": "Show agent-oriented guidance for this command",
|
|
57
|
+
"name": "llms",
|
|
58
|
+
"allowNo": false,
|
|
59
|
+
"type": "boolean"
|
|
60
|
+
},
|
|
61
|
+
"yes": {
|
|
62
|
+
"char": "y",
|
|
63
|
+
"description": "Skip confirmation prompts",
|
|
64
|
+
"name": "yes",
|
|
65
|
+
"allowNo": false,
|
|
66
|
+
"type": "boolean"
|
|
67
|
+
},
|
|
68
|
+
"organization-id": {
|
|
69
|
+
"aliases": [
|
|
70
|
+
"organization",
|
|
71
|
+
"organizationId",
|
|
72
|
+
"org"
|
|
73
|
+
],
|
|
74
|
+
"description": "Organization to use when the account has several",
|
|
75
|
+
"name": "organization-id",
|
|
76
|
+
"hasDynamicHelp": false,
|
|
77
|
+
"multiple": false,
|
|
78
|
+
"type": "option"
|
|
79
|
+
},
|
|
80
|
+
"project-id": {
|
|
81
|
+
"aliases": [
|
|
82
|
+
"project",
|
|
83
|
+
"projectId"
|
|
84
|
+
],
|
|
85
|
+
"description": "Project to use when the organization has several",
|
|
86
|
+
"name": "project-id",
|
|
87
|
+
"hasDynamicHelp": false,
|
|
88
|
+
"multiple": false,
|
|
89
|
+
"type": "option"
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
"hasDynamicHelp": false,
|
|
93
|
+
"hidden": true,
|
|
94
|
+
"hiddenAliases": [],
|
|
95
|
+
"id": "blueprinit",
|
|
96
|
+
"pluginAlias": "@sanity/runtime-cli",
|
|
97
|
+
"pluginName": "@sanity/runtime-cli",
|
|
98
|
+
"pluginType": "core",
|
|
99
|
+
"strict": true,
|
|
100
|
+
"summary": "Experimental blueprints-first project init",
|
|
101
|
+
"enableJsonFlag": true,
|
|
102
|
+
"isESM": true,
|
|
103
|
+
"relativePath": [
|
|
104
|
+
"dist",
|
|
105
|
+
"commands",
|
|
106
|
+
"blueprinit.js"
|
|
107
|
+
]
|
|
108
|
+
},
|
|
3
109
|
"blueprints:add": {
|
|
4
110
|
"aliases": [],
|
|
5
111
|
"args": {
|
|
@@ -2655,7 +2761,8 @@
|
|
|
2655
2761
|
},
|
|
2656
2762
|
"description": "Sets an environment variable in a deployed Sanity Function. If the variable already exists, its value is updated.\n\nEnvironment variables are useful for API keys, configuration values, and other secrets that shouldn't be hardcoded. Changes take effect on the next function invocation.",
|
|
2657
2763
|
"examples": [
|
|
2658
|
-
"<%= config.bin %> <%= command.id %> MyFunction API_URL https://api.example.com/"
|
|
2764
|
+
"<%= config.bin %> <%= command.id %> MyFunction API_URL https://api.example.com/",
|
|
2765
|
+
"<%= config.bin %> <%= command.id %> --stack <name-or-id> MyFunction API_URL https://api.example.com/"
|
|
2659
2766
|
],
|
|
2660
2767
|
"flags": {
|
|
2661
2768
|
"json": {
|
|
@@ -2700,7 +2807,6 @@
|
|
|
2700
2807
|
},
|
|
2701
2808
|
"stack": {
|
|
2702
2809
|
"description": "Stack name or ID to use instead of the locally configured Stack",
|
|
2703
|
-
"hidden": true,
|
|
2704
2810
|
"name": "stack",
|
|
2705
2811
|
"hasDynamicHelp": false,
|
|
2706
2812
|
"multiple": false,
|
|
@@ -2771,7 +2877,8 @@
|
|
|
2771
2877
|
},
|
|
2772
2878
|
"description": "Displays all environment variables (keys only) configured in a deployed Sanity Function.\n\nUse 'functions env add' to set variables or 'functions env remove' to delete them.",
|
|
2773
2879
|
"examples": [
|
|
2774
|
-
"<%= config.bin %> <%= command.id %> MyFunction"
|
|
2880
|
+
"<%= config.bin %> <%= command.id %> MyFunction",
|
|
2881
|
+
"<%= config.bin %> <%= command.id %> --stack <name-or-id> MyFunction"
|
|
2775
2882
|
],
|
|
2776
2883
|
"flags": {
|
|
2777
2884
|
"json": {
|
|
@@ -2816,7 +2923,6 @@
|
|
|
2816
2923
|
},
|
|
2817
2924
|
"stack": {
|
|
2818
2925
|
"description": "Stack name or ID to use instead of the locally configured Stack",
|
|
2819
|
-
"hidden": true,
|
|
2820
2926
|
"name": "stack",
|
|
2821
2927
|
"hasDynamicHelp": false,
|
|
2822
2928
|
"multiple": false,
|
|
@@ -2892,7 +2998,8 @@
|
|
|
2892
2998
|
},
|
|
2893
2999
|
"description": "Deletes an environment variable from a deployed Sanity Function. The change takes effect on the next function invocation.\n\nUse 'functions env list' to see current variables before removing.",
|
|
2894
3000
|
"examples": [
|
|
2895
|
-
"<%= config.bin %> <%= command.id %> MyFunction API_URL"
|
|
3001
|
+
"<%= config.bin %> <%= command.id %> MyFunction API_URL",
|
|
3002
|
+
"<%= config.bin %> <%= command.id %> --stack <name-or-id> MyFunction API_URL"
|
|
2896
3003
|
],
|
|
2897
3004
|
"flags": {
|
|
2898
3005
|
"json": {
|
|
@@ -2937,7 +3044,6 @@
|
|
|
2937
3044
|
},
|
|
2938
3045
|
"stack": {
|
|
2939
3046
|
"description": "Stack name or ID to use instead of the locally configured Stack",
|
|
2940
|
-
"hidden": true,
|
|
2941
3047
|
"name": "stack",
|
|
2942
3048
|
"hasDynamicHelp": false,
|
|
2943
3049
|
"multiple": false,
|
|
@@ -2998,5 +3104,5 @@
|
|
|
2998
3104
|
]
|
|
2999
3105
|
}
|
|
3000
3106
|
},
|
|
3001
|
-
"version": "17.
|
|
3107
|
+
"version": "17.3.0-blueprinit.gb1c5e1e"
|
|
3002
3108
|
}
|
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": "17.
|
|
4
|
+
"version": "17.3.0-blueprinit.gb1c5e1e",
|
|
5
5
|
"author": "Sanity Runtime Team",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"license": "MIT",
|
|
@@ -26,7 +26,9 @@
|
|
|
26
26
|
"files": [
|
|
27
27
|
"./bin",
|
|
28
28
|
"./dist",
|
|
29
|
-
"./oclif.manifest.json"
|
|
29
|
+
"./oclif.manifest.json",
|
|
30
|
+
"./SKILL.md",
|
|
31
|
+
"./skills"
|
|
30
32
|
],
|
|
31
33
|
"bin": {
|
|
32
34
|
"sanity-run": "bin/run.js"
|
|
@@ -40,7 +42,9 @@
|
|
|
40
42
|
"clean": "shx rm -rf dist oclif.manifest.json",
|
|
41
43
|
"copy:design-tokens": "shx rm -rf ./src/server/static/vendor/design-tokens && shx cp -r ./node_modules/@sanity-labs/design-tokens/dist/css ./src/server/static/vendor/design-tokens",
|
|
42
44
|
"copy:server": "shx cp -r ./src/server/static ./dist/server",
|
|
43
|
-
"copy:wrapper": "
|
|
45
|
+
"copy:wrapper": "npm run copy:wrapper:entry && npm run copy:wrapper:modules",
|
|
46
|
+
"copy:wrapper:entry": "shx cp ./src/utils/functions/child-process-wrapper.js ./dist/utils/functions/child-process-wrapper.js",
|
|
47
|
+
"copy:wrapper:modules": "shx rm -rf ./dist/utils/functions/child-runtime && shx cp -r ./src/utils/functions/child-runtime ./dist/utils/functions/child-runtime",
|
|
44
48
|
"lint": "biome ci",
|
|
45
49
|
"lint:write": "biome check --write",
|
|
46
50
|
"lint:fix": "npm run lint:write",
|
|
@@ -61,51 +65,56 @@
|
|
|
61
65
|
"@architect/hydrate": "~6.0.2",
|
|
62
66
|
"@architect/inventory": "~6.1.0",
|
|
63
67
|
"@inquirer/prompts": "^8.5.2",
|
|
64
|
-
"@oclif/core": "^4.
|
|
65
|
-
"@oclif/plugin-help": "^6.2.
|
|
68
|
+
"@oclif/core": "^4.13.2",
|
|
69
|
+
"@oclif/plugin-help": "^6.2.55",
|
|
66
70
|
"@sanity-labs/design-tokens": "^0.0.2-alpha.2",
|
|
67
|
-
"@sanity/
|
|
71
|
+
"@sanity-labs/oclif-plugin-skills-flag": "^0.1.3",
|
|
72
|
+
"@sanity/blueprints": "^0.23.1",
|
|
68
73
|
"@sanity/blueprints-parser": "^0.4.0",
|
|
69
|
-
"@sanity/
|
|
74
|
+
"@sanity/cli-build": "^5.0.0",
|
|
75
|
+
"@sanity/cli-core": "^2.5.1",
|
|
76
|
+
"@sanity/client": "^7.25.0",
|
|
70
77
|
"adm-zip": "^0.6.0",
|
|
71
78
|
"array-treeify": "^0.1.5",
|
|
72
79
|
"cardinal": "^2.1.1",
|
|
73
80
|
"empathic": "^2.0.1",
|
|
74
81
|
"eventsource": "^4.1.0",
|
|
75
|
-
"groq-js": "^
|
|
82
|
+
"groq-js": "^2.0.0",
|
|
76
83
|
"jiti": "^2.7.0",
|
|
77
84
|
"mime-types": "^3.0.2",
|
|
78
85
|
"ora": "^9.4.1",
|
|
79
86
|
"signal-exit": "^4.1.0",
|
|
80
87
|
"strip-ansi": "^7.2.0",
|
|
88
|
+
"tar-fs": "^3.1.3",
|
|
81
89
|
"tar-stream": "^3.2.0",
|
|
82
|
-
"vite": "^8.1.
|
|
90
|
+
"vite": "^8.1.5",
|
|
83
91
|
"ws": "^8.21.1",
|
|
84
92
|
"xdg-basedir": "^5.1.0"
|
|
85
93
|
},
|
|
86
94
|
"devDependencies": {
|
|
87
|
-
"@biomejs/biome": "2.5.
|
|
95
|
+
"@biomejs/biome": "2.5.5",
|
|
88
96
|
"@codemirror/lang-json": "^6.0.2",
|
|
89
97
|
"@codemirror/state": "^6.7.1",
|
|
90
98
|
"@enhance/store": "^1.0.2",
|
|
91
99
|
"@lezer/highlight": "^1.2.3",
|
|
92
|
-
"@oclif/test": "^4.1.
|
|
93
|
-
"@playwright/test": "^1.
|
|
100
|
+
"@oclif/test": "^4.1.21",
|
|
101
|
+
"@playwright/test": "^1.62.0",
|
|
94
102
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
95
103
|
"@sanity/functions": "^1.4.0",
|
|
96
104
|
"@types/adm-zip": "^0.5.8",
|
|
97
105
|
"@types/cardinal": "^2.1.1",
|
|
98
106
|
"@types/mime-types": "^3.0.1",
|
|
99
107
|
"@types/node": "^22",
|
|
108
|
+
"@types/tar-fs": "^2.0.4",
|
|
100
109
|
"@types/tar-stream": "^3.1.4",
|
|
101
110
|
"@types/ws": "^8.18.1",
|
|
102
111
|
"@vitest/coverage-v8": "4.1.10",
|
|
103
112
|
"codemirror": "^6.0.2",
|
|
104
113
|
"mentoss": "^0.13.0",
|
|
105
|
-
"oclif": "^4.23.
|
|
106
|
-
"pretty-bytes": "^7.1.
|
|
114
|
+
"oclif": "^4.23.29",
|
|
115
|
+
"pretty-bytes": "^7.1.1",
|
|
107
116
|
"pretty-ms": "^9.3.0",
|
|
108
|
-
"rollup": "^4.62.
|
|
117
|
+
"rollup": "^4.62.3",
|
|
109
118
|
"shx": "^0.4.0",
|
|
110
119
|
"typescript": "^7.0.2",
|
|
111
120
|
"vitest": "4.1.10"
|
|
@@ -115,7 +124,8 @@
|
|
|
115
124
|
"dirname": "sanity-run",
|
|
116
125
|
"commands": "./dist/commands",
|
|
117
126
|
"plugins": [
|
|
118
|
-
"@oclif/plugin-help"
|
|
127
|
+
"@oclif/plugin-help",
|
|
128
|
+
"@sanity-labs/oclif-plugin-skills-flag"
|
|
119
129
|
],
|
|
120
130
|
"topicSeparator": " ",
|
|
121
131
|
"topics": {
|