@sanity/cli 4.0.0-0 → 4.0.0-next.0-6e19f0599b-202507141628
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/lib/_chunks-cjs/cli.js +414 -261
- package/lib/_chunks-cjs/cli.js.map +1 -1
- package/package.json +10 -10
package/lib/_chunks-cjs/cli.js
CHANGED
@@ -3767,7 +3767,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
3767
3767
|
}(lodash$1, lodash$1.exports)), lodash$1.exports;
|
3768
3768
|
}
|
3769
3769
|
var lodashExports = requireLodash();
|
3770
|
-
const helpText$
|
3770
|
+
const helpText$p = `
|
3771
3771
|
Arguments
|
3772
3772
|
<type> Type of Resource to add (currently only 'function' is supported)
|
3773
3773
|
|
@@ -3803,13 +3803,13 @@ Examples:
|
|
3803
3803
|
|
3804
3804
|
# Add a document-publish .js Function with helpers and install with npm
|
3805
3805
|
sanity blueprints add function -n roboto --fn-type document-publish --js -i
|
3806
|
-
`, defaultFlags$
|
3806
|
+
`, defaultFlags$c = {
|
3807
3807
|
"fn-language": "ts"
|
3808
3808
|
// 'fn-helpers': true, // ask, for now
|
3809
3809
|
}, addBlueprintsCommand = {
|
3810
3810
|
name: "add",
|
3811
3811
|
group: "blueprints",
|
3812
|
-
helpText: helpText$
|
3812
|
+
helpText: helpText$p,
|
3813
3813
|
signature: "<type> [--name <name>] [--fn-type <document-publish>] [--fn-lang <ts|js>] [--javascript]",
|
3814
3814
|
description: "Add a Resource to a Blueprint",
|
3815
3815
|
async action(args, context) {
|
@@ -3831,7 +3831,7 @@ Examples:
|
|
3831
3831
|
if (foundConflict)
|
3832
3832
|
throw new Error(`--example can't be used with --${foundConflict}`);
|
3833
3833
|
}
|
3834
|
-
const flags = { ...defaultFlags$
|
3834
|
+
const flags = { ...defaultFlags$c, ...extOptions }, client2 = apiClient({
|
3835
3835
|
requireUser: !0,
|
3836
3836
|
requireProject: !1
|
3837
3837
|
}), { token: token2 } = client2.config();
|
@@ -3870,7 +3870,7 @@ Examples:
|
|
3870
3870
|
signature: "[COMMAND]",
|
3871
3871
|
isGroupRoot: !0,
|
3872
3872
|
description: "Deploy and manage Sanity Blueprints and Stacks (IaC)"
|
3873
|
-
}, helpText$
|
3873
|
+
}, helpText$o = `
|
3874
3874
|
Options
|
3875
3875
|
--edit, -e Edit the configuration
|
3876
3876
|
--test, -t Test the configuration
|
@@ -3888,16 +3888,16 @@ Examples:
|
|
3888
3888
|
|
3889
3889
|
# Edit and test configuration
|
3890
3890
|
sanity blueprints config -et
|
3891
|
-
`, defaultFlags$
|
3891
|
+
`, defaultFlags$b = {
|
3892
3892
|
//
|
3893
3893
|
}, configBlueprintsCommand = {
|
3894
3894
|
name: "config",
|
3895
3895
|
group: "blueprints",
|
3896
|
-
helpText: helpText$
|
3896
|
+
helpText: helpText$o,
|
3897
3897
|
signature: "[--edit] [-e] [--test] [-t] [--project-id <id>]",
|
3898
3898
|
description: "View or edit local Blueprints configuration",
|
3899
3899
|
async action(args, context) {
|
3900
|
-
const { apiClient, output } = context, flags = { ...defaultFlags$
|
3900
|
+
const { apiClient, output } = context, flags = { ...defaultFlags$b, ...args.extOptions }, client2 = apiClient({
|
3901
3901
|
requireUser: !0,
|
3902
3902
|
requireProject: !1
|
3903
3903
|
}), { token: token2 } = client2.config();
|
@@ -3920,7 +3920,7 @@ Examples:
|
|
3920
3920
|
});
|
3921
3921
|
if (!success) throw new Error(error2);
|
3922
3922
|
}
|
3923
|
-
}, helpText$
|
3923
|
+
}, helpText$n = `
|
3924
3924
|
Options
|
3925
3925
|
--no-wait Do not wait for deployment to complete
|
3926
3926
|
|
@@ -3930,16 +3930,16 @@ Examples:
|
|
3930
3930
|
|
3931
3931
|
# Deploy the current blueprint without waiting for completion
|
3932
3932
|
sanity blueprints deploy --no-wait
|
3933
|
-
`, defaultFlags$
|
3933
|
+
`, defaultFlags$a = {
|
3934
3934
|
//
|
3935
3935
|
}, deployBlueprintsCommand = {
|
3936
3936
|
name: "deploy",
|
3937
3937
|
group: "blueprints",
|
3938
|
-
helpText: helpText$
|
3938
|
+
helpText: helpText$n,
|
3939
3939
|
signature: "[--no-wait]",
|
3940
3940
|
description: "Deploy a Blueprint to create or update a Stack",
|
3941
3941
|
async action(args, context) {
|
3942
|
-
const { apiClient, output } = context, flags = { ...defaultFlags$
|
3942
|
+
const { apiClient, output } = context, flags = { ...defaultFlags$a, ...args.extOptions }, client2 = apiClient({
|
3943
3943
|
requireUser: !0,
|
3944
3944
|
requireProject: !1
|
3945
3945
|
}), { token: token2 } = client2.config();
|
@@ -3958,7 +3958,7 @@ Examples:
|
|
3958
3958
|
});
|
3959
3959
|
if (!success) throw new Error(error2);
|
3960
3960
|
}
|
3961
|
-
}, helpText$
|
3961
|
+
}, helpText$m = `
|
3962
3962
|
Options
|
3963
3963
|
--force, -f Force destroy without confirmation
|
3964
3964
|
--no-wait Do not wait for destroy to complete
|
@@ -3972,16 +3972,16 @@ Examples:
|
|
3972
3972
|
|
3973
3973
|
# Destroy without waiting for completion
|
3974
3974
|
sanity blueprints destroy --no-wait
|
3975
|
-
`, defaultFlags$
|
3975
|
+
`, defaultFlags$9 = {
|
3976
3976
|
//
|
3977
3977
|
}, destroyBlueprintsCommand = {
|
3978
3978
|
name: "destroy",
|
3979
3979
|
group: "blueprints",
|
3980
|
-
helpText: helpText$
|
3980
|
+
helpText: helpText$m,
|
3981
3981
|
signature: "[--force] [-f] [--no-wait]",
|
3982
3982
|
description: "Destroy a Blueprint deployment",
|
3983
3983
|
async action(args, context) {
|
3984
|
-
const { apiClient, output } = context, flags = { ...defaultFlags$
|
3984
|
+
const { apiClient, output } = context, flags = { ...defaultFlags$9, ...args.extOptions }, client2 = apiClient({
|
3985
3985
|
requireUser: !0,
|
3986
3986
|
requireProject: !1
|
3987
3987
|
}), { token: token2 } = client2.config();
|
@@ -4003,20 +4003,20 @@ Examples:
|
|
4003
4003
|
});
|
4004
4004
|
if (!success) throw new Error(error2);
|
4005
4005
|
}
|
4006
|
-
}, helpText$
|
4006
|
+
}, helpText$l = `
|
4007
4007
|
Examples:
|
4008
4008
|
# Retrieve information about the current Stack
|
4009
4009
|
sanity blueprints info
|
4010
|
-
`, defaultFlags$
|
4010
|
+
`, defaultFlags$8 = {
|
4011
4011
|
//
|
4012
4012
|
}, infoBlueprintsCommand = {
|
4013
4013
|
name: "info",
|
4014
4014
|
group: "blueprints",
|
4015
|
-
helpText: helpText$
|
4015
|
+
helpText: helpText$l,
|
4016
4016
|
signature: "",
|
4017
4017
|
description: "Retrieve information about a Blueprint Stack",
|
4018
4018
|
async action(args, context) {
|
4019
|
-
const { apiClient, output } = context, flags = { ...defaultFlags$
|
4019
|
+
const { apiClient, output } = context, flags = { ...defaultFlags$8, ...args.extOptions }, client2 = apiClient({
|
4020
4020
|
requireUser: !0,
|
4021
4021
|
requireProject: !1
|
4022
4022
|
}), { token: token2 } = client2.config();
|
@@ -4033,7 +4033,7 @@ Examples:
|
|
4033
4033
|
});
|
4034
4034
|
if (!success) throw new Error(error2);
|
4035
4035
|
}
|
4036
|
-
}, helpText$
|
4036
|
+
}, helpText$k = `
|
4037
4037
|
Arguments
|
4038
4038
|
[dir] Path to initialize the Blueprint in
|
4039
4039
|
|
@@ -4050,16 +4050,16 @@ Examples:
|
|
4050
4050
|
|
4051
4051
|
# Create a new Blueprint project in a specific directory with an example
|
4052
4052
|
sanity blueprints init --example example-name
|
4053
|
-
`, defaultFlags$
|
4053
|
+
`, defaultFlags$7 = {
|
4054
4054
|
//
|
4055
4055
|
}, initBlueprintsCommand = {
|
4056
4056
|
name: "init",
|
4057
4057
|
group: "blueprints",
|
4058
|
-
helpText: helpText$
|
4058
|
+
helpText: helpText$k,
|
4059
4059
|
signature: "[dir] [--blueprint-type <type>] [--project-id <id>]",
|
4060
4060
|
description: "Initialize a new Blueprint manifest file",
|
4061
4061
|
async action(args, context) {
|
4062
|
-
const { apiClient, output } = context, flags = { ...defaultFlags$
|
4062
|
+
const { apiClient, output } = context, flags = { ...defaultFlags$7, ...args.extOptions }, [dir] = args.argsWithoutOptions, client2 = apiClient({
|
4063
4063
|
requireUser: !0,
|
4064
4064
|
requireProject: !1
|
4065
4065
|
}), { token: token2 } = client2.config();
|
@@ -4095,7 +4095,7 @@ Examples:
|
|
4095
4095
|
});
|
4096
4096
|
if (!success) throw new Error(error2);
|
4097
4097
|
}
|
4098
|
-
}, helpText$
|
4098
|
+
}, helpText$j = `
|
4099
4099
|
Options
|
4100
4100
|
--watch, -w Watch for new logs (streaming mode)
|
4101
4101
|
|
@@ -4105,16 +4105,16 @@ Examples:
|
|
4105
4105
|
|
4106
4106
|
# Watch for new logs (streaming mode)
|
4107
4107
|
sanity blueprints logs --watch
|
4108
|
-
`, defaultFlags$
|
4108
|
+
`, defaultFlags$6 = {
|
4109
4109
|
//
|
4110
4110
|
}, logsBlueprintsCommand = {
|
4111
4111
|
name: "logs",
|
4112
4112
|
group: "blueprints",
|
4113
|
-
helpText: helpText$
|
4113
|
+
helpText: helpText$j,
|
4114
4114
|
signature: "[--watch] [-w]",
|
4115
4115
|
description: "Display logs for the current Blueprint Stack",
|
4116
4116
|
async action(args, context) {
|
4117
|
-
const { apiClient, output } = context, flags = { ...defaultFlags$
|
4117
|
+
const { apiClient, output } = context, flags = { ...defaultFlags$6, ...args.extOptions }, client2 = apiClient({
|
4118
4118
|
requireUser: !0,
|
4119
4119
|
requireProject: !1
|
4120
4120
|
}), { token: token2 } = client2.config();
|
@@ -4133,7 +4133,7 @@ Examples:
|
|
4133
4133
|
});
|
4134
4134
|
if (streaming && await streaming, !success) throw new Error(error2);
|
4135
4135
|
}
|
4136
|
-
}, helpText$
|
4136
|
+
}, helpText$i = `
|
4137
4137
|
Safe to run at any time. Will not modify any Resources.
|
4138
4138
|
|
4139
4139
|
Examples:
|
@@ -4142,7 +4142,7 @@ Examples:
|
|
4142
4142
|
`, planBlueprintsCommand = {
|
4143
4143
|
name: "plan",
|
4144
4144
|
group: "blueprints",
|
4145
|
-
helpText: helpText$
|
4145
|
+
helpText: helpText$i,
|
4146
4146
|
signature: "",
|
4147
4147
|
description: "Enumerate Resources to be deployed",
|
4148
4148
|
async action(args, context) {
|
@@ -4162,7 +4162,7 @@ Examples:
|
|
4162
4162
|
});
|
4163
4163
|
if (!success) throw new Error(error2);
|
4164
4164
|
}
|
4165
|
-
}, helpText$
|
4165
|
+
}, helpText$h = `
|
4166
4166
|
Options
|
4167
4167
|
--project-id <id> Project ID to use
|
4168
4168
|
|
@@ -4172,17 +4172,17 @@ Examples:
|
|
4172
4172
|
|
4173
4173
|
# List Stacks for a specific project
|
4174
4174
|
sanity blueprints stacks --project-id abc123
|
4175
|
-
`, defaultFlags$
|
4175
|
+
`, defaultFlags$5 = {
|
4176
4176
|
//
|
4177
4177
|
}, stacksBlueprintsCommand = {
|
4178
4178
|
name: "stacks",
|
4179
4179
|
group: "blueprints",
|
4180
|
-
helpText: helpText$
|
4180
|
+
helpText: helpText$h,
|
4181
4181
|
signature: "[--project-id <id>]",
|
4182
4182
|
description: "List all Blueprint Stacks for the current Project",
|
4183
4183
|
hideFromHelp: !0,
|
4184
4184
|
async action(args, context) {
|
4185
|
-
const { apiClient, output } = context, flags = { ...defaultFlags$
|
4185
|
+
const { apiClient, output } = context, flags = { ...defaultFlags$5, ...args.extOptions }, client2 = apiClient({
|
4186
4186
|
requireUser: !0,
|
4187
4187
|
requireProject: !1
|
4188
4188
|
}), { token: token2 } = client2.config();
|
@@ -4345,7 +4345,7 @@ function ensureNpx() {
|
|
4345
4345
|
);
|
4346
4346
|
}
|
4347
4347
|
}
|
4348
|
-
const helpText$
|
4348
|
+
const helpText$g = `
|
4349
4349
|
Runs a given code modification script on the current studio folder.
|
4350
4350
|
Running the command without a specified codemod name will list available transformations.
|
4351
4351
|
|
@@ -4367,7 +4367,7 @@ Examples
|
|
4367
4367
|
name: "codemod",
|
4368
4368
|
signature: "[CODEMOD_NAME]",
|
4369
4369
|
description: "Updates Sanity Studio codebase with a code modification script",
|
4370
|
-
helpText: helpText$
|
4370
|
+
helpText: helpText$g,
|
4371
4371
|
action: codemodAction
|
4372
4372
|
};
|
4373
4373
|
var lodash_isplainobject, hasRequiredLodash_isplainobject;
|
@@ -6221,13 +6221,13 @@ function requireRegistryAuthToken() {
|
|
6221
6221
|
return authInfo;
|
6222
6222
|
if (!options2.recursive)
|
6223
6223
|
return /\/$/.test(checkUrl) ? void 0 : getRegistryAuthInfo(new URL("./", parsed), options2);
|
6224
|
-
parsed.pathname = urlResolve(
|
6224
|
+
parsed.pathname = urlResolve(normalizePath2(pathname), "..") || "/";
|
6225
6225
|
}
|
6226
6226
|
}
|
6227
6227
|
function getLegacyAuthInfo(npmrc) {
|
6228
6228
|
return npmrc.get("_auth") ? { token: replaceEnvironmentVariable(npmrc.get("_auth")), type: "Basic" } : void 0;
|
6229
6229
|
}
|
6230
|
-
function
|
6230
|
+
function normalizePath2(path2) {
|
6231
6231
|
return path2[path2.length - 1] === "/" ? path2 : path2 + "/";
|
6232
6232
|
}
|
6233
6233
|
function getAuthInfoForUrl(regUrl, npmrc) {
|
@@ -7896,14 +7896,172 @@ function requireOpen() {
|
|
7896
7896
|
})), open2.apps = apps, open2.openApp = openApp, open_1 = open2, open_1;
|
7897
7897
|
}
|
7898
7898
|
var openExports = requireOpen(), open = /* @__PURE__ */ loadEnv.getDefaultExportFromCjs(openExports);
|
7899
|
-
|
7900
|
-
|
7899
|
+
async function browse(url) {
|
7900
|
+
await open(url);
|
7901
|
+
}
|
7902
|
+
const browseCommand = {
|
7903
|
+
name: "browse",
|
7904
|
+
group: "docs",
|
7901
7905
|
helpText: "",
|
7902
|
-
signature: "
|
7903
|
-
description: "
|
7906
|
+
signature: "",
|
7907
|
+
description: "Open Sanity docs in a web browser",
|
7904
7908
|
async action(args, context) {
|
7905
7909
|
const { output } = context, { print } = output, url = "https://www.sanity.io/docs";
|
7906
|
-
print(`Opening ${url}`), await
|
7910
|
+
print(`Opening ${url}`), await browse(url);
|
7911
|
+
}
|
7912
|
+
}, docsGroup = {
|
7913
|
+
name: "docs",
|
7914
|
+
signature: "[COMMAND]",
|
7915
|
+
isGroupRoot: !0,
|
7916
|
+
description: "Search, read, and browse Sanity documentation"
|
7917
|
+
};
|
7918
|
+
async function readDoc(options2, context) {
|
7919
|
+
const { output } = context;
|
7920
|
+
try {
|
7921
|
+
const url = `https://www.sanity.io${options2.path}.md`, response = await fetch(url, {
|
7922
|
+
signal: AbortSignal.timeout(1e4)
|
7923
|
+
});
|
7924
|
+
return response.status === 404 ? (output.error(`Article not found: ${options2.path}`), null) : (response.ok || (context.output.error("The article API is currently unavailable. Please try again later."), process.exit(1)), await response.text());
|
7925
|
+
} catch {
|
7926
|
+
return context.output.error("The article API is currently unavailable. Please try again later."), process.exit(1), null;
|
7927
|
+
}
|
7928
|
+
}
|
7929
|
+
var readDoc$1 = /* @__PURE__ */ Object.freeze({
|
7930
|
+
__proto__: null,
|
7931
|
+
readDoc
|
7932
|
+
});
|
7933
|
+
function normalizePath(input2) {
|
7934
|
+
const sanityDocsPrefix = "https://www.sanity.io";
|
7935
|
+
return input2.startsWith(sanityDocsPrefix) ? input2.replace(sanityDocsPrefix, "") : input2;
|
7936
|
+
}
|
7937
|
+
const helpText$f = `
|
7938
|
+
Arguments
|
7939
|
+
<path> Path or URL to article, found in search results and docs content as links
|
7940
|
+
|
7941
|
+
Options
|
7942
|
+
-w, --web Open in a web browser
|
7943
|
+
|
7944
|
+
Examples
|
7945
|
+
# Read as markdown in terminal
|
7946
|
+
sanity docs read /docs/studio/installation
|
7947
|
+
sanity docs read https://www.sanity.io/docs/studio/installation
|
7948
|
+
|
7949
|
+
# Open in web browser
|
7950
|
+
sanity docs read /docs/studio/installation --web
|
7951
|
+
sanity docs read https://www.sanity.io/docs/studio/installation -w
|
7952
|
+
`, readCommand = {
|
7953
|
+
name: "read",
|
7954
|
+
group: "docs",
|
7955
|
+
helpText: helpText$f,
|
7956
|
+
signature: "<path|url> [-w, --web]",
|
7957
|
+
description: "Read an article in terminal",
|
7958
|
+
async action(args, context) {
|
7959
|
+
const { output } = context, flags = args.extOptions, input2 = args.argsWithoutOptions[0];
|
7960
|
+
if (!input2 || typeof input2 != "string") {
|
7961
|
+
output.error("Please provide an article path or URL"), output.print(""), output.print(helpText$f), process.exit(1);
|
7962
|
+
return;
|
7963
|
+
}
|
7964
|
+
const path2 = normalizePath(input2);
|
7965
|
+
if (!path2.startsWith("/")) {
|
7966
|
+
output.error("Invalid path or URL. Expected a Sanity docs path or URL."), output.print("Examples:"), output.print(" /docs/studio/installation"), output.print(" https://www.sanity.io/docs/studio/installation"), process.exit(1);
|
7967
|
+
return;
|
7968
|
+
}
|
7969
|
+
if (flags.web || flags.w) {
|
7970
|
+
const url = `https://www.sanity.io${path2}`;
|
7971
|
+
output.print(`Opening ${url}`), await browse(url);
|
7972
|
+
return;
|
7973
|
+
}
|
7974
|
+
output.print(`Reading article: ${path2}`);
|
7975
|
+
const content = await readDoc({ path: path2 }, context);
|
7976
|
+
content && (output.print(`
|
7977
|
+
---
|
7978
|
+
`), output.print(content));
|
7979
|
+
}
|
7980
|
+
};
|
7981
|
+
async function searchDocs(options2, context) {
|
7982
|
+
const { output } = context, { limit = 10 } = options2, baseUrl = "https://www.sanity.io/docs/api/search/semantic", url = new URL(baseUrl);
|
7983
|
+
url.searchParams.set("query", options2.query);
|
7984
|
+
const response = await fetch(url, {
|
7985
|
+
signal: AbortSignal.timeout(1e4)
|
7986
|
+
});
|
7987
|
+
response.ok || (output.error("The documentation search API is currently unavailable. Please try again later."), process.exit(1));
|
7988
|
+
const results = await response.json();
|
7989
|
+
return Array.isArray(results) ? results.slice(0, limit) : [];
|
7990
|
+
}
|
7991
|
+
const isInteractive$1 = process.stdout.isTTY && process.env.TERM !== "dumb" && !("CI" in process.env), helpText$e = `
|
7992
|
+
Arguments
|
7993
|
+
<query> Search query for documentation
|
7994
|
+
|
7995
|
+
Options
|
7996
|
+
--limit <limit> Maximum number of results to return [default: 10]
|
7997
|
+
|
7998
|
+
Examples
|
7999
|
+
# Search for documentation about schemas
|
8000
|
+
sanity docs search schema
|
8001
|
+
|
8002
|
+
# Search with phrase
|
8003
|
+
sanity docs search "groq functions"
|
8004
|
+
|
8005
|
+
# Limit search results
|
8006
|
+
sanity docs search "deployment" --limit=5
|
8007
|
+
`, defaultFlags$4 = {
|
8008
|
+
limit: 10
|
8009
|
+
}, searchCommand = {
|
8010
|
+
name: "search",
|
8011
|
+
group: "docs",
|
8012
|
+
helpText: helpText$e,
|
8013
|
+
signature: "<query> [--limit <limit>]",
|
8014
|
+
description: "Search Sanity docs",
|
8015
|
+
async action(args, context) {
|
8016
|
+
const { output, prompt: prompt2 } = context, flags = { ...defaultFlags$4, ...args.extOptions }, query = args.argsWithoutOptions[0];
|
8017
|
+
if (!query) {
|
8018
|
+
output.error("Please provide a search query"), output.print('Usage: sanity docs search "your query"'), process.exit(1);
|
8019
|
+
return;
|
8020
|
+
}
|
8021
|
+
output.print(`Searching documentation for: "${query}"`);
|
8022
|
+
let results;
|
8023
|
+
try {
|
8024
|
+
if (results = await searchDocs(
|
8025
|
+
{
|
8026
|
+
query,
|
8027
|
+
limit: flags.limit
|
8028
|
+
},
|
8029
|
+
context
|
8030
|
+
), results.length === 0) {
|
8031
|
+
output.print("No results found. Try a different search term.");
|
8032
|
+
return;
|
8033
|
+
}
|
8034
|
+
} catch {
|
8035
|
+
output.error("The documentation search API is currently unavailable. Please try again later."), process.exit(1);
|
8036
|
+
return;
|
8037
|
+
}
|
8038
|
+
if (output.print(`
|
8039
|
+
Found ${results.length} result(s):
|
8040
|
+
`), results.forEach((result, index) => {
|
8041
|
+
output.print(`${index + 1}. ${result.title}`), output.print(` ${chalk__default.default.cyan(`URL: https://www.sanity.io${result.path}`)}`), result.description && output.print(` ${result.description}`), output.print("");
|
8042
|
+
}), isInteractive$1 || (output.print("Use `sanity docs read <url>` to read an article in terminal."), output.print("Use `sanity docs read <path>` to follow links found within articles."), output.print("")), results.length > 1 && isInteractive$1) {
|
8043
|
+
const choices2 = results.map((result, index) => ({
|
8044
|
+
name: `${index + 1}. ${result.title} (${result.path})`,
|
8045
|
+
value: index,
|
8046
|
+
short: result.title
|
8047
|
+
}));
|
8048
|
+
try {
|
8049
|
+
const selectedIndex = await prompt2.single({
|
8050
|
+
type: "list",
|
8051
|
+
message: "Select an article to read in terminal:",
|
8052
|
+
choices: [...choices2, { name: "Exit", value: -1, short: "Exit" }]
|
8053
|
+
});
|
8054
|
+
if (typeof selectedIndex == "number" && selectedIndex >= 0) {
|
8055
|
+
const selected = results[selectedIndex], { readDoc: readDoc2 } = await Promise.resolve().then(function() {
|
8056
|
+
return readDoc$1;
|
8057
|
+
}), content = await readDoc2({ path: selected.path }, context);
|
8058
|
+
content && (output.print(`
|
8059
|
+
---
|
8060
|
+
`), output.print(content));
|
8061
|
+
}
|
8062
|
+
} catch {
|
8063
|
+
}
|
8064
|
+
}
|
7907
8065
|
}
|
7908
8066
|
}, helpText$d = `
|
7909
8067
|
Options
|
@@ -8094,6 +8252,7 @@ Arguments
|
|
8094
8252
|
Options
|
8095
8253
|
--data <data> Data to send to the function
|
8096
8254
|
--file <file> Read data from file and send to the function
|
8255
|
+
--document-id <id> Document to fetch and send to function
|
8097
8256
|
--timeout <timeout> Execution timeout value in seconds
|
8098
8257
|
--api <version> Sanity API Version to use
|
8099
8258
|
--dataset <dataset> The Sanity dataset to use
|
@@ -8118,7 +8277,7 @@ Examples
|
|
8118
8277
|
name: "test",
|
8119
8278
|
group: "functions",
|
8120
8279
|
helpText: helpText$a,
|
8121
|
-
signature: "<name> [--data <json>] [--file <filename>] [--timeout <seconds>] [--api <version>] [--dataset <name>] [--project-id] <id>] [--with-user-token]",
|
8280
|
+
signature: "<name> [--data <json>] [--file <filename>] [--document-id <id>] [--timeout <seconds>] [--api <version>] [--dataset <name>] [--project-id] <id>] [--with-user-token]",
|
8122
8281
|
description: "Invoke a local Sanity Function",
|
8123
8282
|
async action(args, context) {
|
8124
8283
|
const { apiClient, output, chalk: chalk2 } = context, [name] = args.argsWithoutOptions, flags = { ...defaultFlags$1, ...args.extOptions }, client2 = apiClient({
|
@@ -8148,6 +8307,7 @@ Examples
|
|
8148
8307
|
flags: {
|
8149
8308
|
data: flags.data,
|
8150
8309
|
file: flags.file,
|
8310
|
+
"document-id": flags["document-id"],
|
8151
8311
|
timeout: flags.timeout,
|
8152
8312
|
api: flags.api,
|
8153
8313
|
dataset: flags.dataset || actualDataset,
|
@@ -18342,10 +18502,10 @@ function requireGetWorkspacePackagePaths() {
|
|
18342
18502
|
return results.map((packagePath) => posixPath.join(rootPath, posixPath.dirname(packagePath)));
|
18343
18503
|
}
|
18344
18504
|
getWorkspacePackagePaths.getWorkspacePackagePaths = getWorkspacePackagePaths$1;
|
18345
|
-
const isWin = process.platform === "win32",
|
18505
|
+
const isWin = process.platform === "win32", normalizePath2 = (p) => isWin ? p.replace(/\\/g, "/") : p;
|
18346
18506
|
async function getPackagePaths(packages, fs2) {
|
18347
18507
|
return (await Promise.all(packages.map((packageGlob) => new Promise((resolve, reject) => {
|
18348
|
-
(0, glob_12.default)(
|
18508
|
+
(0, glob_12.default)(normalizePath2(posixPath.join(packageGlob, "package.json")), {
|
18349
18509
|
cwd: "/",
|
18350
18510
|
fs: (0, get_glob_fs_1.getGlobFs)(fs2)
|
18351
18511
|
}, (err, matches) => {
|
@@ -23273,7 +23433,7 @@ function requirePreferredPm() {
|
|
23273
23433
|
}, preferredPm;
|
23274
23434
|
}
|
23275
23435
|
var preferredPmExports = requirePreferredPm(), preferredPM = /* @__PURE__ */ loadEnv.getDefaultExportFromCjs(preferredPmExports), whichExports = requireWhich(), which = /* @__PURE__ */ loadEnv.getDefaultExportFromCjs(whichExports);
|
23276
|
-
const
|
23436
|
+
const ALLOWED_PACKAGE_MANAGERS = ["npm", "yarn", "pnpm", "bun", "manual"], allowedPackageManagersString = ALLOWED_PACKAGE_MANAGERS.map((pm) => `"${pm}"`).join(
|
23277
23437
|
" | "
|
23278
23438
|
), EXPERIMENTAL = ["bun"];
|
23279
23439
|
async function getPackageManagerChoice(workDir, options2) {
|
@@ -55061,7 +55221,10 @@ const baseCommands = [
|
|
55061
55221
|
logoutCommand,
|
55062
55222
|
installCommand,
|
55063
55223
|
versionsCommand,
|
55064
|
-
|
55224
|
+
docsGroup,
|
55225
|
+
browseCommand,
|
55226
|
+
searchCommand,
|
55227
|
+
readCommand,
|
55065
55228
|
manageCommand,
|
55066
55229
|
debugCommand,
|
55067
55230
|
command$1,
|
@@ -79295,6 +79458,209 @@ function prompt(questions) {
|
|
79295
79458
|
}
|
79296
79459
|
prompt.Separator = inquirer.Separator;
|
79297
79460
|
prompt.single = (question) => prompt([{ ...question, name: "value" }]).then((answers) => answers.value);
|
79461
|
+
class CommandRunner {
|
79462
|
+
handlers;
|
79463
|
+
commands;
|
79464
|
+
commandGroups;
|
79465
|
+
constructor(handlers, commands = baseCommands) {
|
79466
|
+
this.handlers = handlers, this.commands = lodashExports.sortBy(commands, "name"), this.commandGroups = {};
|
79467
|
+
for (const cmd of this.commands) {
|
79468
|
+
const group = "group" in cmd && cmd.group || "default";
|
79469
|
+
this.commandGroups[group] = this.commandGroups[group] || [], this.commandGroups[group].push(cmd);
|
79470
|
+
}
|
79471
|
+
if (!handlers.outputter || !handlers.prompter)
|
79472
|
+
throw new Error("`prompter` and `outputter` handlers must be defined");
|
79473
|
+
}
|
79474
|
+
// eslint-disable-next-line complexity
|
79475
|
+
async runCommand(commandOrGroup, args, options2) {
|
79476
|
+
if (!commandOrGroup)
|
79477
|
+
return this.handlers.outputter.print(generateCommandsDocumentation(this.commandGroups)), Promise.resolve();
|
79478
|
+
const cmdArgs = lodashExports.cloneDeep(args), subCommandName = args.argsWithoutOptions[0], commandInfo = this.resolveCommand(commandOrGroup, subCommandName);
|
79479
|
+
if (!commandInfo)
|
79480
|
+
throw new Error(getNoSuchCommandText(commandOrGroup, subCommandName, this.commandGroups));
|
79481
|
+
const command2 = commandInfo.command;
|
79482
|
+
!isCommandGroup(command2) && command2.group && command2.group !== "default" && (cmdArgs.argsWithoutOptions = args.argsWithoutOptions.slice(1));
|
79483
|
+
const output = this.handlers.outputter, prompt2 = this.handlers.prompter, { cliConfig, ...commandOptions } = options2, apiClient = getClientWrapper(
|
79484
|
+
cliConfig?.config?.api || null,
|
79485
|
+
cliConfig?.path || (cliConfig?.version === 2 ? "sanity.json" : "sanity.cli.js")
|
79486
|
+
), context = {
|
79487
|
+
output,
|
79488
|
+
prompt: prompt2,
|
79489
|
+
apiClient,
|
79490
|
+
chalk: chalk__default.default,
|
79491
|
+
cliPackageManager,
|
79492
|
+
...commandOptions,
|
79493
|
+
commandRunner: this,
|
79494
|
+
...getVersionedContextParams(cliConfig)
|
79495
|
+
};
|
79496
|
+
if (isCommandGroup(command2))
|
79497
|
+
return context.output.print(generateCommandsDocumentation(this.commandGroups, command2.name));
|
79498
|
+
if (typeof command2.action != "function") {
|
79499
|
+
const cmdName = command2.name || commandOrGroup || "<unknown>";
|
79500
|
+
loadEnv.debug(`Command "${cmdName}" doesnt have a valid "action"-property, showing help`);
|
79501
|
+
const groupName = command2.group && command2.group !== "default" ? command2.group : null;
|
79502
|
+
return context.output.print(generateCommandDocumentation(command2, groupName, subCommandName));
|
79503
|
+
}
|
79504
|
+
return loadEnv.debug(`Running command "${command2.name}"`), command2.action(cmdArgs, context);
|
79505
|
+
}
|
79506
|
+
resolveCommand(commandOrGroup, subCommandName) {
|
79507
|
+
if (this.commandGroups[commandOrGroup] && subCommandName) {
|
79508
|
+
loadEnv.debug(`Found group for name "${commandOrGroup}", resolving subcommand`);
|
79509
|
+
const subCommand = this.resolveSubcommand(
|
79510
|
+
this.commandGroups[commandOrGroup],
|
79511
|
+
subCommandName,
|
79512
|
+
commandOrGroup
|
79513
|
+
);
|
79514
|
+
return loadEnv.debug(
|
79515
|
+
subCommand ? `Subcommand resolved to "${subCommand.commandName}"` : `Subcommand with name "${subCommandName}" not found`
|
79516
|
+
), subCommand;
|
79517
|
+
}
|
79518
|
+
loadEnv.debug(`No group found with name "${commandOrGroup}", looking for command`);
|
79519
|
+
const command2 = this.commandGroups.default.find((cmd) => cmd.name === commandOrGroup);
|
79520
|
+
return command2 ? (loadEnv.debug(`Found command in default group with name "${commandOrGroup}"`), {
|
79521
|
+
command: command2,
|
79522
|
+
commandName: command2.name,
|
79523
|
+
parentName: "default",
|
79524
|
+
isGroup: !1,
|
79525
|
+
isCommand: !0
|
79526
|
+
}) : (loadEnv.debug(`No default command with name "${commandOrGroup}" found, giving up`), null);
|
79527
|
+
}
|
79528
|
+
resolveSubcommand(group, subCommandName, parentGroupName) {
|
79529
|
+
if (!subCommandName)
|
79530
|
+
return null;
|
79531
|
+
const subCommand = group.find((cmd) => cmd.name === subCommandName);
|
79532
|
+
if (!subCommand)
|
79533
|
+
throw new Error(getNoSuchCommandText(subCommandName, parentGroupName, this.commandGroups));
|
79534
|
+
return {
|
79535
|
+
command: subCommand,
|
79536
|
+
commandName: subCommandName,
|
79537
|
+
parentName: parentGroupName,
|
79538
|
+
isGroup: !1,
|
79539
|
+
isCommand: !0
|
79540
|
+
};
|
79541
|
+
}
|
79542
|
+
resolveHelpForGroup() {
|
79543
|
+
const command2 = this.commandGroups.default.find((cmd) => cmd.name === "help");
|
79544
|
+
if (!command2)
|
79545
|
+
throw new Error("Failed to find default `help` command");
|
79546
|
+
return {
|
79547
|
+
command: command2,
|
79548
|
+
commandName: "help",
|
79549
|
+
isGroup: !1,
|
79550
|
+
isCommand: !0
|
79551
|
+
};
|
79552
|
+
}
|
79553
|
+
}
|
79554
|
+
function getCliRunner(commands) {
|
79555
|
+
return new CommandRunner(
|
79556
|
+
{
|
79557
|
+
outputter: cliOutputter,
|
79558
|
+
prompter: prompt
|
79559
|
+
},
|
79560
|
+
commands
|
79561
|
+
);
|
79562
|
+
}
|
79563
|
+
function getVersionedContextParams(cliConfig) {
|
79564
|
+
return cliConfig?.version === 2 ? {
|
79565
|
+
sanityMajorVersion: 2,
|
79566
|
+
cliConfig: cliConfig?.config || void 0,
|
79567
|
+
cliConfigPath: cliConfig?.path || void 0
|
79568
|
+
} : {
|
79569
|
+
sanityMajorVersion: 3,
|
79570
|
+
cliConfig: cliConfig?.config || void 0,
|
79571
|
+
cliConfigPath: cliConfig?.path || void 0
|
79572
|
+
};
|
79573
|
+
}
|
79574
|
+
function detectRuntime() {
|
79575
|
+
return "Deno" in globalThis ? "deno" : "Bun" in globalThis ? "bun" : "node";
|
79576
|
+
}
|
79577
|
+
async function mergeCommands(baseCommands2, corePath, options2) {
|
79578
|
+
if (!corePath)
|
79579
|
+
return baseCommands2;
|
79580
|
+
const { cliVersion } = options2, coreImport = getCliConfig.dynamicRequire(corePath);
|
79581
|
+
semver__default.default.coerce(cliVersion);
|
79582
|
+
const core2 = "cliProjectCommands" in coreImport ? coreImport.cliProjectCommands : coreImport;
|
79583
|
+
return baseCommands2.concat(core2.commands).map(addDefaultGroup).reverse().reduce(
|
79584
|
+
(cmds, cmd) => {
|
79585
|
+
const group = isCommandGroup(cmd) ? void 0 : cmd.group;
|
79586
|
+
return lodashExports.find(cmds, { name: cmd.name, group }) || cmds.push(cmd), cmds;
|
79587
|
+
},
|
79588
|
+
[]
|
79589
|
+
);
|
79590
|
+
}
|
79591
|
+
function addDefaultGroup(cmd) {
|
79592
|
+
return !isCommandGroup(cmd) && !cmd.group && (cmd.group = "default"), cmd;
|
79593
|
+
}
|
79594
|
+
var escapeStringRegexp, hasRequiredEscapeStringRegexp;
|
79595
|
+
function requireEscapeStringRegexp() {
|
79596
|
+
return hasRequiredEscapeStringRegexp || (hasRequiredEscapeStringRegexp = 1, escapeStringRegexp = (string) => {
|
79597
|
+
if (typeof string != "string")
|
79598
|
+
throw new TypeError("Expected a string");
|
79599
|
+
return string.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
|
79600
|
+
}), escapeStringRegexp;
|
79601
|
+
}
|
79602
|
+
var cleanStack$1, hasRequiredCleanStack;
|
79603
|
+
function requireCleanStack() {
|
79604
|
+
if (hasRequiredCleanStack) return cleanStack$1;
|
79605
|
+
hasRequiredCleanStack = 1;
|
79606
|
+
const os2 = require$$0__default$2.default, escapeStringRegexp2 = requireEscapeStringRegexp(), extractPathRegex = /\s+at.*[(\s](.*)\)?/, pathRegex = /^(?:(?:(?:node|(?:(?:node:)?internal\/[\w/]*|.*node_modules\/(?:babel-polyfill|pirates)\/.*)?\w+)(?:\.js)?:\d+:\d+)|native)/, homeDir = typeof os2.homedir > "u" ? "" : os2.homedir();
|
79607
|
+
return cleanStack$1 = (stack2, { pretty = !1, basePath } = {}) => {
|
79608
|
+
const basePathRegex = basePath && new RegExp(`(at | \\()${escapeStringRegexp2(basePath)}`, "g");
|
79609
|
+
return stack2.replace(/\\/g, "/").split(`
|
79610
|
+
`).filter((line3) => {
|
79611
|
+
const pathMatches = line3.match(extractPathRegex);
|
79612
|
+
if (pathMatches === null || !pathMatches[1])
|
79613
|
+
return !0;
|
79614
|
+
const match2 = pathMatches[1];
|
79615
|
+
return match2.includes(".app/Contents/Resources/electron.asar") || match2.includes(".app/Contents/Resources/default_app.asar") ? !1 : !pathRegex.test(match2);
|
79616
|
+
}).filter((line3) => line3.trim() !== "").map((line3) => (basePathRegex && (line3 = line3.replace(basePathRegex, "$1")), pretty && (line3 = line3.replace(extractPathRegex, (m, p1) => m.replace(p1, p1.replace(homeDir, "~")))), line3)).join(`
|
79617
|
+
`);
|
79618
|
+
}, cleanStack$1;
|
79619
|
+
}
|
79620
|
+
var cleanStackExports = requireCleanStack(), cleanStack = /* @__PURE__ */ loadEnv.getDefaultExportFromCjs(cleanStackExports);
|
79621
|
+
const options = { pretty: process.platform !== "win32" };
|
79622
|
+
function neatStack(error2) {
|
79623
|
+
if (typeof error2 == "string")
|
79624
|
+
return chalk.red(cleanStack(error2, options));
|
79625
|
+
if (error2 === null || typeof error2 != "object" || typeof error2.stack != "string")
|
79626
|
+
return chalk.red(util$4.inspect(error2));
|
79627
|
+
const title = error2.toString(), stack2 = cleanStack(error2.stack, options);
|
79628
|
+
return stack2.startsWith(title) ? chalk.red(`${title}${chalk.dim(cleanStack(error2.stack, options).slice(title.length))}`) : chalk.red(stack2);
|
79629
|
+
}
|
79630
|
+
var minimistExports = requireMinimist(), minimist = /* @__PURE__ */ loadEnv.getDefaultExportFromCjs(minimistExports);
|
79631
|
+
function parseArguments(argv = process.argv) {
|
79632
|
+
const {
|
79633
|
+
_,
|
79634
|
+
h,
|
79635
|
+
help: help2,
|
79636
|
+
d,
|
79637
|
+
debug: debug2,
|
79638
|
+
v,
|
79639
|
+
version: version2,
|
79640
|
+
"--": extraArguments,
|
79641
|
+
...extOptions
|
79642
|
+
} = minimist(argv.slice(2), {
|
79643
|
+
"--": !0,
|
79644
|
+
boolean: ["h", "help", "d", "debug", "v", "version"],
|
79645
|
+
string: ["_"]
|
79646
|
+
}), [groupOrCommand, ...argsWithoutOptions] = _;
|
79647
|
+
return {
|
79648
|
+
groupOrCommand,
|
79649
|
+
argv,
|
79650
|
+
extOptions,
|
79651
|
+
argsWithoutOptions,
|
79652
|
+
extraArguments: extraArguments || [],
|
79653
|
+
// prettier-ignore
|
79654
|
+
coreOptions: {
|
79655
|
+
h,
|
79656
|
+
help: help2,
|
79657
|
+
d,
|
79658
|
+
debug: debug2,
|
79659
|
+
v,
|
79660
|
+
version: version2
|
79661
|
+
}
|
79662
|
+
};
|
79663
|
+
}
|
79298
79664
|
var boxen$1 = { exports: {} }, stringWidth = { exports: {} }, ansiRegex, hasRequiredAnsiRegex;
|
79299
79665
|
function requireAnsiRegex() {
|
79300
79666
|
return hasRequiredAnsiRegex || (hasRequiredAnsiRegex = 1, ansiRegex = ({ onlyFirst = !1 } = {}) => {
|
@@ -79620,219 +79986,6 @@ function requireBoxen() {
|
|
79620
79986
|
}, boxen$1.exports._borderStyles = cliBoxes2, boxen$1.exports;
|
79621
79987
|
}
|
79622
79988
|
var boxenExports = requireBoxen(), boxen = /* @__PURE__ */ loadEnv.getDefaultExportFromCjs(boxenExports);
|
79623
|
-
function printNewMajorVersionMessage(context) {
|
79624
|
-
const { chalk: chalk2 } = context, message = `${chalk2.yellow.bold(
|
79625
|
-
"The `sanity` package is moving to v4 on July 15 and will require Node.js 20+."
|
79626
|
-
)}
|
79627
|
-
Learn what this means for your apps at https://www.sanity.io/blog/a-major-version-bump-for-a-minor-reason`, boxedMessage = boxen(message, {
|
79628
|
-
padding: 1,
|
79629
|
-
margin: 1
|
79630
|
-
});
|
79631
|
-
console.warn(boxedMessage);
|
79632
|
-
}
|
79633
|
-
class CommandRunner {
|
79634
|
-
handlers;
|
79635
|
-
commands;
|
79636
|
-
commandGroups;
|
79637
|
-
constructor(handlers, commands = baseCommands) {
|
79638
|
-
this.handlers = handlers, this.commands = lodashExports.sortBy(commands, "name"), this.commandGroups = {};
|
79639
|
-
for (const cmd of this.commands) {
|
79640
|
-
const group = "group" in cmd && cmd.group || "default";
|
79641
|
-
this.commandGroups[group] = this.commandGroups[group] || [], this.commandGroups[group].push(cmd);
|
79642
|
-
}
|
79643
|
-
if (!handlers.outputter || !handlers.prompter)
|
79644
|
-
throw new Error("`prompter` and `outputter` handlers must be defined");
|
79645
|
-
}
|
79646
|
-
// eslint-disable-next-line complexity
|
79647
|
-
async runCommand(commandOrGroup, args, options2) {
|
79648
|
-
if (!commandOrGroup)
|
79649
|
-
return this.handlers.outputter.print(generateCommandsDocumentation(this.commandGroups)), Promise.resolve();
|
79650
|
-
const cmdArgs = lodashExports.cloneDeep(args), subCommandName = args.argsWithoutOptions[0], commandInfo = this.resolveCommand(commandOrGroup, subCommandName);
|
79651
|
-
if (!commandInfo)
|
79652
|
-
throw new Error(getNoSuchCommandText(commandOrGroup, subCommandName, this.commandGroups));
|
79653
|
-
const command2 = commandInfo.command;
|
79654
|
-
!isCommandGroup(command2) && command2.group && command2.group !== "default" && (cmdArgs.argsWithoutOptions = args.argsWithoutOptions.slice(1));
|
79655
|
-
const output = this.handlers.outputter, prompt2 = this.handlers.prompter, { cliConfig, ...commandOptions } = options2, apiClient = getClientWrapper(
|
79656
|
-
cliConfig?.config?.api || null,
|
79657
|
-
cliConfig?.path || (cliConfig?.version === 2 ? "sanity.json" : "sanity.cli.js")
|
79658
|
-
), context = {
|
79659
|
-
output,
|
79660
|
-
prompt: prompt2,
|
79661
|
-
apiClient,
|
79662
|
-
chalk: chalk__default.default,
|
79663
|
-
cliPackageManager,
|
79664
|
-
...commandOptions,
|
79665
|
-
commandRunner: this,
|
79666
|
-
...getVersionedContextParams(cliConfig)
|
79667
|
-
};
|
79668
|
-
if (isCommandGroup(command2))
|
79669
|
-
return context.output.print(generateCommandsDocumentation(this.commandGroups, command2.name));
|
79670
|
-
if (typeof command2.action != "function") {
|
79671
|
-
const cmdName = command2.name || commandOrGroup || "<unknown>";
|
79672
|
-
loadEnv.debug(`Command "${cmdName}" doesnt have a valid "action"-property, showing help`);
|
79673
|
-
const groupName = command2.group && command2.group !== "default" ? command2.group : null;
|
79674
|
-
return context.output.print(generateCommandDocumentation(command2, groupName, subCommandName));
|
79675
|
-
}
|
79676
|
-
return loadEnv.debug(`Running command "${command2.name}"`), cmdArgs.extOptions["hide-major-message"] || printNewMajorVersionMessage(context), command2.action(cmdArgs, context);
|
79677
|
-
}
|
79678
|
-
resolveCommand(commandOrGroup, subCommandName) {
|
79679
|
-
if (this.commandGroups[commandOrGroup] && subCommandName) {
|
79680
|
-
loadEnv.debug(`Found group for name "${commandOrGroup}", resolving subcommand`);
|
79681
|
-
const subCommand = this.resolveSubcommand(
|
79682
|
-
this.commandGroups[commandOrGroup],
|
79683
|
-
subCommandName,
|
79684
|
-
commandOrGroup
|
79685
|
-
);
|
79686
|
-
return loadEnv.debug(
|
79687
|
-
subCommand ? `Subcommand resolved to "${subCommand.commandName}"` : `Subcommand with name "${subCommandName}" not found`
|
79688
|
-
), subCommand;
|
79689
|
-
}
|
79690
|
-
loadEnv.debug(`No group found with name "${commandOrGroup}", looking for command`);
|
79691
|
-
const command2 = this.commandGroups.default.find((cmd) => cmd.name === commandOrGroup);
|
79692
|
-
return command2 ? (loadEnv.debug(`Found command in default group with name "${commandOrGroup}"`), {
|
79693
|
-
command: command2,
|
79694
|
-
commandName: command2.name,
|
79695
|
-
parentName: "default",
|
79696
|
-
isGroup: !1,
|
79697
|
-
isCommand: !0
|
79698
|
-
}) : (loadEnv.debug(`No default command with name "${commandOrGroup}" found, giving up`), null);
|
79699
|
-
}
|
79700
|
-
resolveSubcommand(group, subCommandName, parentGroupName) {
|
79701
|
-
if (!subCommandName)
|
79702
|
-
return null;
|
79703
|
-
const subCommand = group.find((cmd) => cmd.name === subCommandName);
|
79704
|
-
if (!subCommand)
|
79705
|
-
throw new Error(getNoSuchCommandText(subCommandName, parentGroupName, this.commandGroups));
|
79706
|
-
return {
|
79707
|
-
command: subCommand,
|
79708
|
-
commandName: subCommandName,
|
79709
|
-
parentName: parentGroupName,
|
79710
|
-
isGroup: !1,
|
79711
|
-
isCommand: !0
|
79712
|
-
};
|
79713
|
-
}
|
79714
|
-
resolveHelpForGroup() {
|
79715
|
-
const command2 = this.commandGroups.default.find((cmd) => cmd.name === "help");
|
79716
|
-
if (!command2)
|
79717
|
-
throw new Error("Failed to find default `help` command");
|
79718
|
-
return {
|
79719
|
-
command: command2,
|
79720
|
-
commandName: "help",
|
79721
|
-
isGroup: !1,
|
79722
|
-
isCommand: !0
|
79723
|
-
};
|
79724
|
-
}
|
79725
|
-
}
|
79726
|
-
function getCliRunner(commands) {
|
79727
|
-
return new CommandRunner(
|
79728
|
-
{
|
79729
|
-
outputter: cliOutputter,
|
79730
|
-
prompter: prompt
|
79731
|
-
},
|
79732
|
-
commands
|
79733
|
-
);
|
79734
|
-
}
|
79735
|
-
function getVersionedContextParams(cliConfig) {
|
79736
|
-
return cliConfig?.version === 2 ? {
|
79737
|
-
sanityMajorVersion: 2,
|
79738
|
-
cliConfig: cliConfig?.config || void 0,
|
79739
|
-
cliConfigPath: cliConfig?.path || void 0
|
79740
|
-
} : {
|
79741
|
-
sanityMajorVersion: 3,
|
79742
|
-
cliConfig: cliConfig?.config || void 0,
|
79743
|
-
cliConfigPath: cliConfig?.path || void 0
|
79744
|
-
};
|
79745
|
-
}
|
79746
|
-
function detectRuntime() {
|
79747
|
-
return "Deno" in globalThis ? "deno" : "Bun" in globalThis ? "bun" : "node";
|
79748
|
-
}
|
79749
|
-
async function mergeCommands(baseCommands2, corePath, options2) {
|
79750
|
-
if (!corePath)
|
79751
|
-
return baseCommands2;
|
79752
|
-
const { cliVersion } = options2, coreImport = getCliConfig.dynamicRequire(corePath);
|
79753
|
-
semver__default.default.coerce(cliVersion);
|
79754
|
-
const core2 = "cliProjectCommands" in coreImport ? coreImport.cliProjectCommands : coreImport;
|
79755
|
-
return baseCommands2.concat(core2.commands).map(addDefaultGroup).reverse().reduce(
|
79756
|
-
(cmds, cmd) => {
|
79757
|
-
const group = isCommandGroup(cmd) ? void 0 : cmd.group;
|
79758
|
-
return lodashExports.find(cmds, { name: cmd.name, group }) || cmds.push(cmd), cmds;
|
79759
|
-
},
|
79760
|
-
[]
|
79761
|
-
);
|
79762
|
-
}
|
79763
|
-
function addDefaultGroup(cmd) {
|
79764
|
-
return !isCommandGroup(cmd) && !cmd.group && (cmd.group = "default"), cmd;
|
79765
|
-
}
|
79766
|
-
var escapeStringRegexp, hasRequiredEscapeStringRegexp;
|
79767
|
-
function requireEscapeStringRegexp() {
|
79768
|
-
return hasRequiredEscapeStringRegexp || (hasRequiredEscapeStringRegexp = 1, escapeStringRegexp = (string) => {
|
79769
|
-
if (typeof string != "string")
|
79770
|
-
throw new TypeError("Expected a string");
|
79771
|
-
return string.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
|
79772
|
-
}), escapeStringRegexp;
|
79773
|
-
}
|
79774
|
-
var cleanStack$1, hasRequiredCleanStack;
|
79775
|
-
function requireCleanStack() {
|
79776
|
-
if (hasRequiredCleanStack) return cleanStack$1;
|
79777
|
-
hasRequiredCleanStack = 1;
|
79778
|
-
const os2 = require$$0__default$2.default, escapeStringRegexp2 = requireEscapeStringRegexp(), extractPathRegex = /\s+at.*[(\s](.*)\)?/, pathRegex = /^(?:(?:(?:node|(?:(?:node:)?internal\/[\w/]*|.*node_modules\/(?:babel-polyfill|pirates)\/.*)?\w+)(?:\.js)?:\d+:\d+)|native)/, homeDir = typeof os2.homedir > "u" ? "" : os2.homedir();
|
79779
|
-
return cleanStack$1 = (stack2, { pretty = !1, basePath } = {}) => {
|
79780
|
-
const basePathRegex = basePath && new RegExp(`(at | \\()${escapeStringRegexp2(basePath)}`, "g");
|
79781
|
-
return stack2.replace(/\\/g, "/").split(`
|
79782
|
-
`).filter((line3) => {
|
79783
|
-
const pathMatches = line3.match(extractPathRegex);
|
79784
|
-
if (pathMatches === null || !pathMatches[1])
|
79785
|
-
return !0;
|
79786
|
-
const match2 = pathMatches[1];
|
79787
|
-
return match2.includes(".app/Contents/Resources/electron.asar") || match2.includes(".app/Contents/Resources/default_app.asar") ? !1 : !pathRegex.test(match2);
|
79788
|
-
}).filter((line3) => line3.trim() !== "").map((line3) => (basePathRegex && (line3 = line3.replace(basePathRegex, "$1")), pretty && (line3 = line3.replace(extractPathRegex, (m, p1) => m.replace(p1, p1.replace(homeDir, "~")))), line3)).join(`
|
79789
|
-
`);
|
79790
|
-
}, cleanStack$1;
|
79791
|
-
}
|
79792
|
-
var cleanStackExports = requireCleanStack(), cleanStack = /* @__PURE__ */ loadEnv.getDefaultExportFromCjs(cleanStackExports);
|
79793
|
-
const options = { pretty: process.platform !== "win32" };
|
79794
|
-
function neatStack(error2) {
|
79795
|
-
if (typeof error2 == "string")
|
79796
|
-
return chalk.red(cleanStack(error2, options));
|
79797
|
-
if (error2 === null || typeof error2 != "object" || typeof error2.stack != "string")
|
79798
|
-
return chalk.red(util$4.inspect(error2));
|
79799
|
-
const title = error2.toString(), stack2 = cleanStack(error2.stack, options);
|
79800
|
-
return stack2.startsWith(title) ? chalk.red(`${title}${chalk.dim(cleanStack(error2.stack, options).slice(title.length))}`) : chalk.red(stack2);
|
79801
|
-
}
|
79802
|
-
var minimistExports = requireMinimist(), minimist = /* @__PURE__ */ loadEnv.getDefaultExportFromCjs(minimistExports);
|
79803
|
-
function parseArguments(argv = process.argv) {
|
79804
|
-
const {
|
79805
|
-
_,
|
79806
|
-
h,
|
79807
|
-
help: help2,
|
79808
|
-
d,
|
79809
|
-
debug: debug2,
|
79810
|
-
v,
|
79811
|
-
version: version2,
|
79812
|
-
"--": extraArguments,
|
79813
|
-
...extOptions
|
79814
|
-
} = minimist(argv.slice(2), {
|
79815
|
-
"--": !0,
|
79816
|
-
boolean: ["h", "help", "d", "debug", "v", "version"],
|
79817
|
-
string: ["_"]
|
79818
|
-
}), [groupOrCommand, ...argsWithoutOptions] = _;
|
79819
|
-
return {
|
79820
|
-
groupOrCommand,
|
79821
|
-
argv,
|
79822
|
-
extOptions,
|
79823
|
-
argsWithoutOptions,
|
79824
|
-
extraArguments: extraArguments || [],
|
79825
|
-
// prettier-ignore
|
79826
|
-
coreOptions: {
|
79827
|
-
h,
|
79828
|
-
help: help2,
|
79829
|
-
d,
|
79830
|
-
debug: debug2,
|
79831
|
-
v,
|
79832
|
-
version: version2
|
79833
|
-
}
|
79834
|
-
};
|
79835
|
-
}
|
79836
79989
|
const TELEMETRY_DISCLOSED_CONFIG_KEY = "telemetryDisclosed";
|
79837
79990
|
function telemetryDisclosure() {
|
79838
79991
|
const userConfig = getUserConfig();
|