@dereekb/dbx-cli 13.11.1 → 13.11.3
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/firebase-api-manifest/main.js +142 -25
- package/firebase-api-manifest/package.json +1 -1
- package/index.cjs.js +202 -26
- package/index.esm.js +201 -27
- package/manifest-extract/LICENSE +21 -0
- package/manifest-extract/index.cjs.default.js +1 -0
- package/manifest-extract/index.cjs.js +459 -0
- package/manifest-extract/index.cjs.mjs +2 -0
- package/manifest-extract/index.d.ts +1 -0
- package/manifest-extract/index.esm.js +457 -0
- package/manifest-extract/package.json +20 -0
- package/manifest-extract/src/index.d.ts +2 -0
- package/manifest-extract/src/lib/extract-crud.d.ts +36 -0
- package/manifest-extract/src/lib/types.d.ts +86 -0
- package/package.json +10 -4
- package/src/lib/api/call-model.command.factory.d.ts +1 -0
- package/src/lib/auth/auth.command.factory.d.ts +1 -0
- package/src/lib/auth/oidc.flow.d.ts +1 -0
- package/src/lib/config/env.d.ts +1 -1
- package/src/lib/config/paths.d.ts +1 -0
- package/src/lib/config/token.cache.d.ts +1 -0
- package/src/lib/context/cli.context.d.ts +1 -0
- package/src/lib/doctor/doctor.command.factory.d.ts +1 -0
- package/src/lib/env/env.command.factory.d.ts +1 -0
- package/src/lib/manifest/build-manifest-commands.d.ts +39 -0
- package/src/lib/manifest/types.d.ts +20 -0
- package/src/lib/middleware/auth.middleware.d.ts +1 -0
- package/src/lib/middleware/output.middleware.d.ts +1 -0
- package/src/lib/output/output.command.factory.d.ts +1 -0
- package/src/lib/runner/run.d.ts +1 -0
- package/src/lib/util/context.slot.d.ts +1 -0
- package/src/lib/util/output.d.ts +2 -0
package/index.cjs.js
CHANGED
|
@@ -274,6 +274,7 @@ var _errorMapper;
|
|
|
274
274
|
* @param extension - File extension to append (`json` for full responses, `ndjson` for streaming dumps).
|
|
275
275
|
* @param suffix - Optional suffix appended to the filename before the extension.
|
|
276
276
|
* @returns The absolute file path, or `undefined` when `dumpDir` is not configured.
|
|
277
|
+
* @__NO_SIDE_EFFECTS__
|
|
277
278
|
*/ function buildDumpFilePath(extension, suffix) {
|
|
278
279
|
var dumpDir = _outputOptions.dumpDir, commandPath = _outputOptions.commandPath;
|
|
279
280
|
if (!dumpDir) {
|
|
@@ -410,6 +411,7 @@ function pickFromObject(obj, fields) {
|
|
|
410
411
|
*
|
|
411
412
|
* @param error - The thrown value to convert.
|
|
412
413
|
* @returns The structured {@link CliErrorOutput}.
|
|
414
|
+
* @__NO_SIDE_EFFECTS__
|
|
413
415
|
*/ function buildErrorOutput(error) {
|
|
414
416
|
if (_errorMapper) {
|
|
415
417
|
var mapped = _errorMapper(error);
|
|
@@ -671,6 +673,7 @@ function trimSlash$1(url) {
|
|
|
671
673
|
* @param input - Optional slot configuration.
|
|
672
674
|
* @param input.notInitializedMessage - Custom error message thrown by `require()` when the slot is unset.
|
|
673
675
|
* @returns A new {@link ContextSlot} for type `T`.
|
|
676
|
+
* @__NO_SIDE_EFFECTS__
|
|
674
677
|
*/ function createContextSlot(input) {
|
|
675
678
|
var _ref;
|
|
676
679
|
var _value;
|
|
@@ -715,6 +718,7 @@ var getCliContext = _cliContextSlot.get;
|
|
|
715
718
|
* @param input.env - The resolved {@link CliEnvConfig} for the active env.
|
|
716
719
|
* @param input.accessToken - The Bearer access token to include on outgoing API calls.
|
|
717
720
|
* @returns The constructed {@link CliContext}.
|
|
721
|
+
* @__NO_SIDE_EFFECTS__
|
|
718
722
|
*/ function createCliContext(input) {
|
|
719
723
|
return {
|
|
720
724
|
cliName: input.cliName,
|
|
@@ -914,6 +918,7 @@ function _ts_generator$e(thisArg, body) {
|
|
|
914
918
|
*
|
|
915
919
|
* @param spec - The command spec describing the yargs command surface plus how to map argv into the typed call params and the result.
|
|
916
920
|
* @returns A yargs `CommandModule` whose handler runs the spec against the active CLI context.
|
|
921
|
+
* @__NO_SIDE_EFFECTS__
|
|
917
922
|
*/ function createCallModelCommand(spec) {
|
|
918
923
|
return {
|
|
919
924
|
command: spec.command,
|
|
@@ -1660,7 +1665,7 @@ function mergeOutputCommandsConfig(existing, updates) {
|
|
|
1660
1665
|
* The `model.*` write scopes filtered out by {@link filterReadOnlyModelScopes}.
|
|
1661
1666
|
*
|
|
1662
1667
|
* Mirrors the write half of the dbx-components callModel CRUD scope set
|
|
1663
|
-
* (`CALL_MODEL_OIDC_SCOPES` in `@dereekb/firebase
|
|
1668
|
+
* (`CALL_MODEL_OIDC_SCOPES` in `@dereekb/firebase`) — duplicated here so the
|
|
1664
1669
|
* CLI doesn't take a server-side dependency just to know the names.
|
|
1665
1670
|
*/ var MODEL_WRITE_OIDC_SCOPES = [
|
|
1666
1671
|
'model.create',
|
|
@@ -1788,6 +1793,7 @@ function nonEmpty(value) {
|
|
|
1788
1793
|
* @param config.cliName - The CLI's binary name; the default config dir is `~/.<cliName>`.
|
|
1789
1794
|
* @param config.configDirOverride - Optional override that replaces the default config directory verbatim (used by tests).
|
|
1790
1795
|
* @returns The {@link CliPaths} pointing at `configDir`, the config file, and the token cache file.
|
|
1796
|
+
* @__NO_SIDE_EFFECTS__
|
|
1791
1797
|
*/ function buildCliPaths(config) {
|
|
1792
1798
|
var _config_configDirOverride;
|
|
1793
1799
|
var configDir = (_config_configDirOverride = config.configDirOverride) !== null && _config_configDirOverride !== void 0 ? _config_configDirOverride : node_path.join(node_os.homedir(), ".".concat(config.cliName));
|
|
@@ -1807,6 +1813,7 @@ function nonEmpty(value) {
|
|
|
1807
1813
|
* @param input - The cache store inputs.
|
|
1808
1814
|
* @param input.tokenCachePath - Absolute path to the JSON file backing the cache.
|
|
1809
1815
|
* @returns A {@link CliTokenCacheStore} keyed by env name.
|
|
1816
|
+
* @__NO_SIDE_EFFECTS__
|
|
1810
1817
|
*/ function createCliTokenCacheStore(input) {
|
|
1811
1818
|
return nestjs.createMemoizedJsonFileAsyncKeyedValueCache({
|
|
1812
1819
|
filePath: input.tokenCachePath
|
|
@@ -2534,6 +2541,7 @@ function _ts_generator$a(thisArg, body) {
|
|
|
2534
2541
|
* @param input.state - The opaque OAuth state token used for CSRF protection.
|
|
2535
2542
|
* @param input.codeChallenge - The PKCE code challenge derived from the verifier.
|
|
2536
2543
|
* @returns The full authorization URL with all OAuth params merged in.
|
|
2544
|
+
* @__NO_SIDE_EFFECTS__
|
|
2537
2545
|
*/ function buildAuthorizationUrl(input) {
|
|
2538
2546
|
var _input_scopes;
|
|
2539
2547
|
var authParams = {
|
|
@@ -3066,6 +3074,7 @@ function maskEnv$1(env) {
|
|
|
3066
3074
|
* @param input.envVarName - Override for the env-name env var. Defaults to `<CLINAME>_ENV` (e.g. `DEMO_CLI_ENV`).
|
|
3067
3075
|
* @param input.defaultEnvs - Built-in env presets merged underneath the user's stored env when names match.
|
|
3068
3076
|
* @returns A yargs `CommandModule` exposing the full `auth` subcommand surface.
|
|
3077
|
+
* @__NO_SIDE_EFFECTS__
|
|
3069
3078
|
*/ function createAuthCommand(input) {
|
|
3070
3079
|
var _input_envVarName;
|
|
3071
3080
|
var cliName = input.cliName;
|
|
@@ -4413,6 +4422,7 @@ function _ts_generator$8(thisArg, body) {
|
|
|
4413
4422
|
* @param input.checks - Additional checks to append after the default check list.
|
|
4414
4423
|
* @param input.defaultEnvs - Built-in env presets merged underneath the user's stored env when names match.
|
|
4415
4424
|
* @returns A yargs `CommandModule` exposing the `doctor` command.
|
|
4425
|
+
* @__NO_SIDE_EFFECTS__
|
|
4416
4426
|
*/ function createDoctorCommand(input) {
|
|
4417
4427
|
var _input_checks;
|
|
4418
4428
|
var cliName = input.cliName;
|
|
@@ -4851,6 +4861,7 @@ function resolveEnvWithDefault(input) {
|
|
|
4851
4861
|
* @param input.cliName - The CLI's binary name.
|
|
4852
4862
|
* @param input.defaultEnvs - Built-in env presets merged underneath the user's stored env when names match.
|
|
4853
4863
|
* @returns A yargs `CommandModule` exposing the full `env` subcommand surface.
|
|
4864
|
+
* @__NO_SIDE_EFFECTS__
|
|
4854
4865
|
*/ function createEnvCommand(input) {
|
|
4855
4866
|
var paths = buildCliPaths({
|
|
4856
4867
|
cliName: input.cliName
|
|
@@ -5466,6 +5477,7 @@ function _ts_generator$6(thisArg, body) {
|
|
|
5466
5477
|
* @param input.skipCommands - Top-level command names that bypass authentication entirely.
|
|
5467
5478
|
* @param input.defaultEnvs - Built-in env presets merged underneath the user's stored env when names match.
|
|
5468
5479
|
* @returns A yargs middleware function suitable for `.middleware([..., true])`.
|
|
5480
|
+
* @__NO_SIDE_EFFECTS__
|
|
5469
5481
|
*/ function createAuthMiddleware(input) {
|
|
5470
5482
|
var paths = buildCliPaths({
|
|
5471
5483
|
cliName: input.cliName
|
|
@@ -5784,6 +5796,7 @@ function _ts_generator$5(thisArg, body) {
|
|
|
5784
5796
|
* @param input.loadOutputConfig - Optional override for how the output config is read.
|
|
5785
5797
|
* @param input.saveCommandOutputConfig - Optional override for how a per-command output config is persisted.
|
|
5786
5798
|
* @returns A yargs middleware function suitable for `.middleware([..., true])`.
|
|
5799
|
+
* @__NO_SIDE_EFFECTS__
|
|
5787
5800
|
*/ function createOutputMiddleware(input) {
|
|
5788
5801
|
var _input_loadOutputConfig, _input_saveCommandOutputConfig;
|
|
5789
5802
|
var paths = buildCliPaths({
|
|
@@ -6343,6 +6356,7 @@ function resolveCallbacks(input) {
|
|
|
6343
6356
|
* @param input.mergeOutputConfig - Optional override for persisting partial output-config updates.
|
|
6344
6357
|
* @param input.clearOutputConfig - Optional override for clearing the persisted output config entirely.
|
|
6345
6358
|
* @returns A yargs `CommandModule` exposing the full `output` subcommand surface.
|
|
6359
|
+
* @__NO_SIDE_EFFECTS__
|
|
6346
6360
|
*/ function createOutputCommand(input) {
|
|
6347
6361
|
var callbacks = resolveCallbacks(input);
|
|
6348
6362
|
var setCommand = {
|
|
@@ -6704,6 +6718,7 @@ function _ts_generator$2(thisArg, body) {
|
|
|
6704
6718
|
* @param input.argv - Argv to parse. Defaults to `hideBin(process.argv)`.
|
|
6705
6719
|
* @param input.disableCallPassthrough - When `true`, omits the built-in `call` passthrough.
|
|
6706
6720
|
* @returns The configured yargs `Argv` ready to be `.parse()`-d.
|
|
6721
|
+
* @__NO_SIDE_EFFECTS__
|
|
6707
6722
|
*/ function createCli(input) {
|
|
6708
6723
|
var _input_configCommands, _input_apiCommands, _input_argv;
|
|
6709
6724
|
var cliName = input.cliName;
|
|
@@ -7093,6 +7108,15 @@ var SKIPPED_VERBS = new Set([
|
|
|
7093
7108
|
'standalone'
|
|
7094
7109
|
]);
|
|
7095
7110
|
var ALL_HELP_FLAG = '--all-help';
|
|
7111
|
+
var HELP_MODE_FLAG = '--help-mode';
|
|
7112
|
+
/**
|
|
7113
|
+
* Default help mode when no override is supplied.
|
|
7114
|
+
*/ var DEFAULT_MANIFEST_HELP_MODE = 'both';
|
|
7115
|
+
var MANIFEST_HELP_MODES = new Set([
|
|
7116
|
+
'action',
|
|
7117
|
+
'params',
|
|
7118
|
+
'both'
|
|
7119
|
+
]);
|
|
7096
7120
|
/**
|
|
7097
7121
|
* Default schema format when no override is supplied.
|
|
7098
7122
|
*/ var DEFAULT_MANIFEST_HELP_DATA_FORMAT = 'jsonschema';
|
|
@@ -7124,8 +7148,9 @@ var DATA_HELP_FLAG = '--data-help';
|
|
|
7124
7148
|
* @param options - Optional overrides; see {@link BuildManifestCommandsOptions}.
|
|
7125
7149
|
* @returns The yargs `CommandModule[]` ready to be passed to `runCli({ apiCommands })`. Empty
|
|
7126
7150
|
* when the manifest has no callable entries.
|
|
7151
|
+
* @__NO_SIDE_EFFECTS__
|
|
7127
7152
|
*/ function buildManifestCommands(manifest, options) {
|
|
7128
|
-
var _ref, _ref1, _ref2, _ref3, _ref4;
|
|
7153
|
+
var _ref, _ref1, _ref2, _ref3, _ref4, _ref5;
|
|
7129
7154
|
var callable = manifest.filter(function(e) {
|
|
7130
7155
|
return !SKIPPED_VERBS.has(e.verb);
|
|
7131
7156
|
});
|
|
@@ -7162,15 +7187,17 @@ var DATA_HELP_FLAG = '--data-help';
|
|
|
7162
7187
|
}
|
|
7163
7188
|
var argv = (_ref = options === null || options === void 0 ? void 0 : options.argv) !== null && _ref !== void 0 ? _ref : process.argv;
|
|
7164
7189
|
var dataHelpFormat = (_ref1 = options === null || options === void 0 ? void 0 : options.dataHelpFormat) !== null && _ref1 !== void 0 ? _ref1 : detectDataHelpFormat(argv);
|
|
7165
|
-
var
|
|
7166
|
-
var
|
|
7167
|
-
var
|
|
7190
|
+
var helpMode = (_ref2 = options === null || options === void 0 ? void 0 : options.helpMode) !== null && _ref2 !== void 0 ? _ref2 : detectHelpMode(argv);
|
|
7191
|
+
var focusHelp = ((_ref3 = options === null || options === void 0 ? void 0 : options.focusHelpOnDataHelp) !== null && _ref3 !== void 0 ? _ref3 : true) && hasDataHelpFlag(argv) && !hasAllHelpFlag(argv);
|
|
7192
|
+
var hideOnFocus = focusHelp ? (_ref4 = options === null || options === void 0 ? void 0 : options.hiddenWhenFocused) !== null && _ref4 !== void 0 ? _ref4 : STANDARD_GLOBAL_OPTION_NAMES : [];
|
|
7193
|
+
var modelCommandName = (_ref5 = options === null || options === void 0 ? void 0 : options.modelCommandName) !== null && _ref5 !== void 0 ? _ref5 : DEFAULT_MANIFEST_MODEL_COMMAND_NAME;
|
|
7168
7194
|
var sortedModels = _to_consumable_array(byModel.entries()).sort(function(param, param1) {
|
|
7169
7195
|
var _param = _sliced_to_array(param, 1), a = _param[0], _param1 = _sliced_to_array(param1, 1), b = _param1[0];
|
|
7170
7196
|
return a.localeCompare(b);
|
|
7171
7197
|
});
|
|
7172
7198
|
var context = {
|
|
7173
7199
|
dataHelpFormat: dataHelpFormat,
|
|
7200
|
+
helpMode: helpMode,
|
|
7174
7201
|
hideOnFocus: hideOnFocus
|
|
7175
7202
|
};
|
|
7176
7203
|
return [
|
|
@@ -7263,6 +7290,38 @@ var DATA_HELP_FLAG = '--data-help';
|
|
|
7263
7290
|
function parseDataHelpFormat(value) {
|
|
7264
7291
|
return MANIFEST_HELP_DATA_FORMATS.has(value) ? value : undefined;
|
|
7265
7292
|
}
|
|
7293
|
+
/**
|
|
7294
|
+
* Inspects an argv array for `--help-mode=<mode>` or `--help-mode <mode>` and
|
|
7295
|
+
* returns the requested {@link ManifestHelpMode}. Unrecognized values fall
|
|
7296
|
+
* back to {@link DEFAULT_MANIFEST_HELP_MODE}.
|
|
7297
|
+
*
|
|
7298
|
+
* Implemented as a raw argv scan (rather than going through yargs) because the
|
|
7299
|
+
* value is needed when each command's builder runs — which is before yargs
|
|
7300
|
+
* parses argv.
|
|
7301
|
+
*
|
|
7302
|
+
* @param argv - argv to inspect (defaults to `process.argv`).
|
|
7303
|
+
* @returns The detected mode, or {@link DEFAULT_MANIFEST_HELP_MODE}.
|
|
7304
|
+
*/ function detectHelpMode() {
|
|
7305
|
+
var argv = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : process.argv;
|
|
7306
|
+
var result = DEFAULT_MANIFEST_HELP_MODE;
|
|
7307
|
+
for(var i = 0; i < argv.length; i++){
|
|
7308
|
+
var arg = argv[i];
|
|
7309
|
+
if (arg.startsWith("".concat(HELP_MODE_FLAG, "="))) {
|
|
7310
|
+
var _parseHelpMode;
|
|
7311
|
+
result = (_parseHelpMode = parseHelpMode(arg.slice(HELP_MODE_FLAG.length + 1))) !== null && _parseHelpMode !== void 0 ? _parseHelpMode : result;
|
|
7312
|
+
break;
|
|
7313
|
+
}
|
|
7314
|
+
if (arg === HELP_MODE_FLAG && i + 1 < argv.length) {
|
|
7315
|
+
var _parseHelpMode1;
|
|
7316
|
+
result = (_parseHelpMode1 = parseHelpMode(argv[i + 1])) !== null && _parseHelpMode1 !== void 0 ? _parseHelpMode1 : result;
|
|
7317
|
+
break;
|
|
7318
|
+
}
|
|
7319
|
+
}
|
|
7320
|
+
return result;
|
|
7321
|
+
}
|
|
7322
|
+
function parseHelpMode(value) {
|
|
7323
|
+
return MANIFEST_HELP_MODES.has(value) ? value : undefined;
|
|
7324
|
+
}
|
|
7266
7325
|
function buildModelCommand(model, entries, context) {
|
|
7267
7326
|
return {
|
|
7268
7327
|
command: "".concat(model, " <action>"),
|
|
@@ -7297,14 +7356,15 @@ function buildModelCommand(model, entries, context) {
|
|
|
7297
7356
|
};
|
|
7298
7357
|
}
|
|
7299
7358
|
function buildEntryCommand(entry, context) {
|
|
7300
|
-
var
|
|
7359
|
+
var _oneLineDescription;
|
|
7301
7360
|
var action = entry.specifier && entry.specifier !== '_' ? "".concat(entry.verb, "-").concat(entry.specifier) : entry.verb;
|
|
7302
7361
|
var specPart = entry.specifier && entry.specifier !== '_' ? ' ' + entry.specifier : '';
|
|
7303
|
-
var
|
|
7304
|
-
var
|
|
7362
|
+
var fallbackDescribe = "".concat(entry.verb).concat(specPart, " on ").concat(entry.model);
|
|
7363
|
+
var describeOneLine = (_oneLineDescription = oneLineDescription(entry.description)) !== null && _oneLineDescription !== void 0 ? _oneLineDescription : fallbackDescribe;
|
|
7364
|
+
var epilogue = buildEntryEpilogue(entry, context);
|
|
7305
7365
|
return {
|
|
7306
7366
|
command: action,
|
|
7307
|
-
describe:
|
|
7367
|
+
describe: describeOneLine,
|
|
7308
7368
|
builder: function builder(yargs) {
|
|
7309
7369
|
var y = yargs.option('data', {
|
|
7310
7370
|
type: 'string',
|
|
@@ -7353,6 +7413,12 @@ function buildEntryCommand(entry, context) {
|
|
|
7353
7413
|
}
|
|
7354
7414
|
};
|
|
7355
7415
|
}
|
|
7416
|
+
function oneLineDescription(description) {
|
|
7417
|
+
var _description_split_;
|
|
7418
|
+
if (!description) return undefined;
|
|
7419
|
+
var firstLine = (_description_split_ = description.split('\n', 1)[0]) === null || _description_split_ === void 0 ? void 0 : _description_split_.trim();
|
|
7420
|
+
return firstLine && firstLine.length > 0 ? firstLine : undefined;
|
|
7421
|
+
}
|
|
7356
7422
|
function hideGlobalOptions(yargs, names) {
|
|
7357
7423
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
7358
7424
|
try {
|
|
@@ -7376,37 +7442,145 @@ function hideGlobalOptions(yargs, names) {
|
|
|
7376
7442
|
}
|
|
7377
7443
|
}
|
|
7378
7444
|
/**
|
|
7379
|
-
* Builds the help epilogue for a manifest-driven command. Surfaces the
|
|
7380
|
-
*
|
|
7381
|
-
*
|
|
7382
|
-
* the source `.api.ts`
|
|
7383
|
-
*
|
|
7384
|
-
* `--
|
|
7445
|
+
* Builds the help epilogue for a manifest-driven command. Surfaces the action
|
|
7446
|
+
* description JSDoc, the params interface description and per-field
|
|
7447
|
+
* descriptions, the params arktype validator (as JSON Schema and/or arktype
|
|
7448
|
+
* expression — see {@link ManifestHelpDataFormat}), and the source `.api.ts`
|
|
7449
|
+
* path for traceability. Designed to give both humans and LLM agents enough
|
|
7450
|
+
* information from `--help` alone to understand a command and construct a
|
|
7451
|
+
* valid `--data` payload.
|
|
7385
7452
|
*
|
|
7386
7453
|
* @param entry - Manifest entry whose metadata becomes the help epilogue.
|
|
7387
|
-
* @param
|
|
7454
|
+
* @param context - Builder context controlling schema format and which sections
|
|
7455
|
+
* to render (see {@link ManifestHelpMode}).
|
|
7388
7456
|
* @returns Multi-section epilogue string, or `undefined` when the entry has no
|
|
7389
7457
|
* metadata worth surfacing.
|
|
7390
|
-
*/ function buildEntryEpilogue(entry,
|
|
7391
|
-
var
|
|
7458
|
+
*/ function buildEntryEpilogue(entry, context) {
|
|
7459
|
+
var dataHelpFormat = context.dataHelpFormat, helpMode = context.helpMode;
|
|
7460
|
+
var showAction = helpMode === 'action' || helpMode === 'both';
|
|
7461
|
+
var showParams = helpMode === 'params' || helpMode === 'both';
|
|
7392
7462
|
var sections = [];
|
|
7393
|
-
if (
|
|
7394
|
-
|
|
7395
|
-
|
|
7396
|
-
|
|
7397
|
-
|
|
7398
|
-
if (
|
|
7399
|
-
|
|
7463
|
+
if (showAction) {
|
|
7464
|
+
var actionSection = buildActionSection(entry);
|
|
7465
|
+
if (actionSection) sections.push(actionSection);
|
|
7466
|
+
}
|
|
7467
|
+
var schemaSections = [];
|
|
7468
|
+
if (showParams) {
|
|
7469
|
+
var _sections;
|
|
7470
|
+
var paramsSection = buildParamsSection(entry);
|
|
7471
|
+
if (paramsSection) sections.push(paramsSection);
|
|
7472
|
+
schemaSections = renderParamsSchemaSections(entry, dataHelpFormat);
|
|
7473
|
+
(_sections = sections).push.apply(_sections, _to_consumable_array(schemaSections));
|
|
7474
|
+
var resultSection = buildResultSection(entry);
|
|
7475
|
+
if (resultSection) {
|
|
7476
|
+
sections.push(resultSection);
|
|
7477
|
+
} else if (entry.resultTypeName) {
|
|
7478
|
+
sections.push("Result: ".concat(entry.resultTypeName));
|
|
7479
|
+
}
|
|
7400
7480
|
}
|
|
7401
7481
|
if (entry.sourceFile) {
|
|
7402
7482
|
sections.push("Source: ".concat(entry.sourceFile));
|
|
7403
7483
|
}
|
|
7404
|
-
if (schemaSections.length > 0 && dataHelpFormat !== 'both') {
|
|
7484
|
+
if (showParams && schemaSections.length > 0 && dataHelpFormat !== 'both') {
|
|
7405
7485
|
var other = dataHelpFormat === 'jsonschema' ? 'arktype' : 'jsonschema';
|
|
7406
7486
|
sections.push("(Pass --data-help=".concat(other, " or --data-help=both to switch the schema format above.)"));
|
|
7407
7487
|
}
|
|
7488
|
+
if (helpMode === 'both' && (entry.description || entry.paramsTypeDescription || entry.paramsFields && entry.paramsFields.length > 0)) {
|
|
7489
|
+
sections.push("(Pass --help-mode=action or --help-mode=params to focus this help on a single section.)");
|
|
7490
|
+
}
|
|
7408
7491
|
return sections.length > 0 ? sections.join('\n\n') : undefined;
|
|
7409
7492
|
}
|
|
7493
|
+
function buildActionSection(entry) {
|
|
7494
|
+
if (!entry.description) return undefined;
|
|
7495
|
+
return "About:\n".concat(indentLines(entry.description, ' '));
|
|
7496
|
+
}
|
|
7497
|
+
function buildParamsSection(entry) {
|
|
7498
|
+
if (!entry.paramsTypeName && !entry.paramsTypeDescription && !(entry.paramsFields && entry.paramsFields.length > 0)) {
|
|
7499
|
+
return undefined;
|
|
7500
|
+
}
|
|
7501
|
+
var lines = [];
|
|
7502
|
+
if (entry.paramsTypeName) {
|
|
7503
|
+
lines.push("Params: ".concat(entry.paramsTypeName));
|
|
7504
|
+
}
|
|
7505
|
+
if (entry.paramsTypeDescription) {
|
|
7506
|
+
lines.push(indentLines(entry.paramsTypeDescription, ' '));
|
|
7507
|
+
}
|
|
7508
|
+
if (entry.paramsFields && entry.paramsFields.length > 0) {
|
|
7509
|
+
lines.push('');
|
|
7510
|
+
lines.push('Fields:');
|
|
7511
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
7512
|
+
try {
|
|
7513
|
+
for(var _iterator = entry.paramsFields[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
7514
|
+
var field = _step.value;
|
|
7515
|
+
var header = " - ".concat(field.name, ": ").concat(field.typeText);
|
|
7516
|
+
lines.push(header);
|
|
7517
|
+
if (field.description) {
|
|
7518
|
+
lines.push(indentLines(field.description, ' '));
|
|
7519
|
+
}
|
|
7520
|
+
}
|
|
7521
|
+
} catch (err) {
|
|
7522
|
+
_didIteratorError = true;
|
|
7523
|
+
_iteratorError = err;
|
|
7524
|
+
} finally{
|
|
7525
|
+
try {
|
|
7526
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
7527
|
+
_iterator.return();
|
|
7528
|
+
}
|
|
7529
|
+
} finally{
|
|
7530
|
+
if (_didIteratorError) {
|
|
7531
|
+
throw _iteratorError;
|
|
7532
|
+
}
|
|
7533
|
+
}
|
|
7534
|
+
}
|
|
7535
|
+
}
|
|
7536
|
+
return lines.join('\n');
|
|
7537
|
+
}
|
|
7538
|
+
function buildResultSection(entry) {
|
|
7539
|
+
if (!entry.resultTypeDescription && !(entry.resultFields && entry.resultFields.length > 0)) {
|
|
7540
|
+
return undefined;
|
|
7541
|
+
}
|
|
7542
|
+
var lines = [];
|
|
7543
|
+
if (entry.resultTypeName) {
|
|
7544
|
+
lines.push("Result: ".concat(entry.resultTypeName));
|
|
7545
|
+
}
|
|
7546
|
+
if (entry.resultTypeDescription) {
|
|
7547
|
+
lines.push(indentLines(entry.resultTypeDescription, ' '));
|
|
7548
|
+
}
|
|
7549
|
+
if (entry.resultFields && entry.resultFields.length > 0) {
|
|
7550
|
+
lines.push('');
|
|
7551
|
+
lines.push('Fields:');
|
|
7552
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
7553
|
+
try {
|
|
7554
|
+
for(var _iterator = entry.resultFields[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
7555
|
+
var field = _step.value;
|
|
7556
|
+
var header = " - ".concat(field.name, ": ").concat(field.typeText);
|
|
7557
|
+
lines.push(header);
|
|
7558
|
+
if (field.description) {
|
|
7559
|
+
lines.push(indentLines(field.description, ' '));
|
|
7560
|
+
}
|
|
7561
|
+
}
|
|
7562
|
+
} catch (err) {
|
|
7563
|
+
_didIteratorError = true;
|
|
7564
|
+
_iteratorError = err;
|
|
7565
|
+
} finally{
|
|
7566
|
+
try {
|
|
7567
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
7568
|
+
_iterator.return();
|
|
7569
|
+
}
|
|
7570
|
+
} finally{
|
|
7571
|
+
if (_didIteratorError) {
|
|
7572
|
+
throw _iteratorError;
|
|
7573
|
+
}
|
|
7574
|
+
}
|
|
7575
|
+
}
|
|
7576
|
+
}
|
|
7577
|
+
return lines.join('\n');
|
|
7578
|
+
}
|
|
7579
|
+
function indentLines(text, indent) {
|
|
7580
|
+
return text.split('\n').map(function(line) {
|
|
7581
|
+
return "".concat(indent).concat(line);
|
|
7582
|
+
}).join('\n');
|
|
7583
|
+
}
|
|
7410
7584
|
function renderParamsSchemaSections(entry, dataHelpFormat) {
|
|
7411
7585
|
var sections = [];
|
|
7412
7586
|
if (!entry.paramsValidator) {
|
|
@@ -8119,6 +8293,7 @@ exports.CliError = CliError;
|
|
|
8119
8293
|
exports.DEFAULT_CLI_OIDC_SCOPES = DEFAULT_CLI_OIDC_SCOPES;
|
|
8120
8294
|
exports.DEFAULT_CLI_SECRET_PATTERNS = DEFAULT_CLI_SECRET_PATTERNS;
|
|
8121
8295
|
exports.DEFAULT_MANIFEST_HELP_DATA_FORMAT = DEFAULT_MANIFEST_HELP_DATA_FORMAT;
|
|
8296
|
+
exports.DEFAULT_MANIFEST_HELP_MODE = DEFAULT_MANIFEST_HELP_MODE;
|
|
8122
8297
|
exports.DEFAULT_MANIFEST_MODEL_COMMAND_NAME = DEFAULT_MANIFEST_MODEL_COMMAND_NAME;
|
|
8123
8298
|
exports.DUMP_MERGE_MODES = DUMP_MERGE_MODES;
|
|
8124
8299
|
exports.DUMP_OUTPUT_MODES = DUMP_OUTPUT_MODES;
|
|
@@ -8150,6 +8325,7 @@ exports.createOutputCommand = createOutputCommand;
|
|
|
8150
8325
|
exports.createOutputMiddleware = createOutputMiddleware;
|
|
8151
8326
|
exports.defaultDoctorChecks = defaultDoctorChecks;
|
|
8152
8327
|
exports.detectDataHelpFormat = detectDataHelpFormat;
|
|
8328
|
+
exports.detectHelpMode = detectHelpMode;
|
|
8153
8329
|
exports.discoverOidcMetadata = discoverOidcMetadata;
|
|
8154
8330
|
exports.dumpTimestamp = dumpTimestamp;
|
|
8155
8331
|
exports.exchangeAuthorizationCode = exchangeAuthorizationCode;
|