@guanghechen/commander 4.7.9 → 4.8.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Change Log
2
2
 
3
+ ## 4.8.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Expose preset directives in command help output under a dedicated `Preset Directives:` section.
8
+
3
9
  ## 4.7.9
4
10
 
5
11
  ### Patch Changes
@@ -1333,6 +1333,7 @@ class CommandHelpRenderer {
1333
1333
  usage,
1334
1334
  arguments: argumentsLines,
1335
1335
  options,
1336
+ presetDirectives: params.presetDirectives ?? [],
1336
1337
  commands,
1337
1338
  examples,
1338
1339
  };
@@ -1403,6 +1404,14 @@ class CommandHelpRenderer {
1403
1404
  }
1404
1405
  lines.push('');
1405
1406
  }
1407
+ const presetDirectives = helpData.presetDirectives ?? [];
1408
+ if (presetDirectives.length > 0) {
1409
+ lines.push('Preset Directives:');
1410
+ for (const { sig, desc } of presetDirectives) {
1411
+ lines.push(this.#renderAlignedHelpLine(sig, desc, labelWidth));
1412
+ }
1413
+ lines.push('');
1414
+ }
1406
1415
  if (helpData.commands.length > 0) {
1407
1416
  lines.push('Commands:');
1408
1417
  for (const { name, desc } of helpData.commands) {
@@ -1442,6 +1451,14 @@ class CommandHelpRenderer {
1442
1451
  }
1443
1452
  lines.push('');
1444
1453
  }
1454
+ const presetDirectives = helpData.presetDirectives ?? [];
1455
+ if (presetDirectives.length > 0) {
1456
+ lines.push(styleText('Preset Directives:', TERMINAL_STYLE.bold, TERMINAL_STYLE.underline));
1457
+ for (const { sig, desc } of presetDirectives) {
1458
+ lines.push(this.#renderAlignedHelpLine(sig, desc, labelWidth, value => styleText(value, TERMINAL_STYLE.cyan)));
1459
+ }
1460
+ lines.push('');
1461
+ }
1445
1462
  if (helpData.commands.length > 0) {
1446
1463
  lines.push(styleText('Commands:', TERMINAL_STYLE.bold, TERMINAL_STYLE.underline));
1447
1464
  for (const { name, desc } of helpData.commands) {
@@ -1464,6 +1481,7 @@ class CommandHelpRenderer {
1464
1481
  const labels = [
1465
1482
  ...helpData.arguments.map(line => line.sig),
1466
1483
  ...helpData.options.map(line => line.sig),
1484
+ ...(helpData.presetDirectives ?? []).map(line => line.sig),
1467
1485
  ...helpData.commands.map(line => line.name),
1468
1486
  ];
1469
1487
  if (labels.length === 0) {
@@ -3386,6 +3404,16 @@ class Command {
3386
3404
  commandPath: this.#getCommandPath(),
3387
3405
  arguments: this.#arguments,
3388
3406
  options: this.#resolveOptionPolicy().mergedOptions,
3407
+ presetDirectives: [
3408
+ {
3409
+ sig: `${PRESET_FILE_FLAG} <value>`,
3410
+ desc: 'Load preset manifest file',
3411
+ },
3412
+ {
3413
+ sig: `${PRESET_PROFILE_FLAG} <value>`,
3414
+ desc: 'Select preset profile: <profile> or <profile>:<variant>; requires --preset-file or command preset.file',
3415
+ },
3416
+ ],
3389
3417
  supportsBuiltinVersion: this.#supportsBuiltinVersion(),
3390
3418
  subcommands,
3391
3419
  examples: this.#examples,
package/lib/cjs/node.cjs CHANGED
@@ -1346,6 +1346,7 @@ class CommandHelpRenderer {
1346
1346
  usage,
1347
1347
  arguments: argumentsLines,
1348
1348
  options,
1349
+ presetDirectives: params.presetDirectives ?? [],
1349
1350
  commands,
1350
1351
  examples,
1351
1352
  };
@@ -1416,6 +1417,14 @@ class CommandHelpRenderer {
1416
1417
  }
1417
1418
  lines.push('');
1418
1419
  }
1420
+ const presetDirectives = helpData.presetDirectives ?? [];
1421
+ if (presetDirectives.length > 0) {
1422
+ lines.push('Preset Directives:');
1423
+ for (const { sig, desc } of presetDirectives) {
1424
+ lines.push(this.#renderAlignedHelpLine(sig, desc, labelWidth));
1425
+ }
1426
+ lines.push('');
1427
+ }
1419
1428
  if (helpData.commands.length > 0) {
1420
1429
  lines.push('Commands:');
1421
1430
  for (const { name, desc } of helpData.commands) {
@@ -1455,6 +1464,14 @@ class CommandHelpRenderer {
1455
1464
  }
1456
1465
  lines.push('');
1457
1466
  }
1467
+ const presetDirectives = helpData.presetDirectives ?? [];
1468
+ if (presetDirectives.length > 0) {
1469
+ lines.push(styleText('Preset Directives:', TERMINAL_STYLE.bold, TERMINAL_STYLE.underline));
1470
+ for (const { sig, desc } of presetDirectives) {
1471
+ lines.push(this.#renderAlignedHelpLine(sig, desc, labelWidth, value => styleText(value, TERMINAL_STYLE.cyan)));
1472
+ }
1473
+ lines.push('');
1474
+ }
1458
1475
  if (helpData.commands.length > 0) {
1459
1476
  lines.push(styleText('Commands:', TERMINAL_STYLE.bold, TERMINAL_STYLE.underline));
1460
1477
  for (const { name, desc } of helpData.commands) {
@@ -1477,6 +1494,7 @@ class CommandHelpRenderer {
1477
1494
  const labels = [
1478
1495
  ...helpData.arguments.map(line => line.sig),
1479
1496
  ...helpData.options.map(line => line.sig),
1497
+ ...(helpData.presetDirectives ?? []).map(line => line.sig),
1480
1498
  ...helpData.commands.map(line => line.name),
1481
1499
  ];
1482
1500
  if (labels.length === 0) {
@@ -3399,6 +3417,16 @@ class Command {
3399
3417
  commandPath: this.#getCommandPath(),
3400
3418
  arguments: this.#arguments,
3401
3419
  options: this.#resolveOptionPolicy().mergedOptions,
3420
+ presetDirectives: [
3421
+ {
3422
+ sig: `${PRESET_FILE_FLAG} <value>`,
3423
+ desc: 'Load preset manifest file',
3424
+ },
3425
+ {
3426
+ sig: `${PRESET_PROFILE_FLAG} <value>`,
3427
+ desc: 'Select preset profile: <profile> or <profile>:<variant>; requires --preset-file or command preset.file',
3428
+ },
3429
+ ],
3402
3430
  supportsBuiltinVersion: this.#supportsBuiltinVersion(),
3403
3431
  subcommands,
3404
3432
  examples: this.#examples,
@@ -1331,6 +1331,7 @@ class CommandHelpRenderer {
1331
1331
  usage,
1332
1332
  arguments: argumentsLines,
1333
1333
  options,
1334
+ presetDirectives: params.presetDirectives ?? [],
1334
1335
  commands,
1335
1336
  examples,
1336
1337
  };
@@ -1401,6 +1402,14 @@ class CommandHelpRenderer {
1401
1402
  }
1402
1403
  lines.push('');
1403
1404
  }
1405
+ const presetDirectives = helpData.presetDirectives ?? [];
1406
+ if (presetDirectives.length > 0) {
1407
+ lines.push('Preset Directives:');
1408
+ for (const { sig, desc } of presetDirectives) {
1409
+ lines.push(this.#renderAlignedHelpLine(sig, desc, labelWidth));
1410
+ }
1411
+ lines.push('');
1412
+ }
1404
1413
  if (helpData.commands.length > 0) {
1405
1414
  lines.push('Commands:');
1406
1415
  for (const { name, desc } of helpData.commands) {
@@ -1440,6 +1449,14 @@ class CommandHelpRenderer {
1440
1449
  }
1441
1450
  lines.push('');
1442
1451
  }
1452
+ const presetDirectives = helpData.presetDirectives ?? [];
1453
+ if (presetDirectives.length > 0) {
1454
+ lines.push(styleText('Preset Directives:', TERMINAL_STYLE.bold, TERMINAL_STYLE.underline));
1455
+ for (const { sig, desc } of presetDirectives) {
1456
+ lines.push(this.#renderAlignedHelpLine(sig, desc, labelWidth, value => styleText(value, TERMINAL_STYLE.cyan)));
1457
+ }
1458
+ lines.push('');
1459
+ }
1443
1460
  if (helpData.commands.length > 0) {
1444
1461
  lines.push(styleText('Commands:', TERMINAL_STYLE.bold, TERMINAL_STYLE.underline));
1445
1462
  for (const { name, desc } of helpData.commands) {
@@ -1462,6 +1479,7 @@ class CommandHelpRenderer {
1462
1479
  const labels = [
1463
1480
  ...helpData.arguments.map(line => line.sig),
1464
1481
  ...helpData.options.map(line => line.sig),
1482
+ ...(helpData.presetDirectives ?? []).map(line => line.sig),
1465
1483
  ...helpData.commands.map(line => line.name),
1466
1484
  ];
1467
1485
  if (labels.length === 0) {
@@ -3384,6 +3402,16 @@ class Command {
3384
3402
  commandPath: this.#getCommandPath(),
3385
3403
  arguments: this.#arguments,
3386
3404
  options: this.#resolveOptionPolicy().mergedOptions,
3405
+ presetDirectives: [
3406
+ {
3407
+ sig: `${PRESET_FILE_FLAG} <value>`,
3408
+ desc: 'Load preset manifest file',
3409
+ },
3410
+ {
3411
+ sig: `${PRESET_PROFILE_FLAG} <value>`,
3412
+ desc: 'Select preset profile: <profile> or <profile>:<variant>; requires --preset-file or command preset.file',
3413
+ },
3414
+ ],
3387
3415
  supportsBuiltinVersion: this.#supportsBuiltinVersion(),
3388
3416
  subcommands,
3389
3417
  examples: this.#examples,
package/lib/esm/node.mjs CHANGED
@@ -1344,6 +1344,7 @@ class CommandHelpRenderer {
1344
1344
  usage,
1345
1345
  arguments: argumentsLines,
1346
1346
  options,
1347
+ presetDirectives: params.presetDirectives ?? [],
1347
1348
  commands,
1348
1349
  examples,
1349
1350
  };
@@ -1414,6 +1415,14 @@ class CommandHelpRenderer {
1414
1415
  }
1415
1416
  lines.push('');
1416
1417
  }
1418
+ const presetDirectives = helpData.presetDirectives ?? [];
1419
+ if (presetDirectives.length > 0) {
1420
+ lines.push('Preset Directives:');
1421
+ for (const { sig, desc } of presetDirectives) {
1422
+ lines.push(this.#renderAlignedHelpLine(sig, desc, labelWidth));
1423
+ }
1424
+ lines.push('');
1425
+ }
1417
1426
  if (helpData.commands.length > 0) {
1418
1427
  lines.push('Commands:');
1419
1428
  for (const { name, desc } of helpData.commands) {
@@ -1453,6 +1462,14 @@ class CommandHelpRenderer {
1453
1462
  }
1454
1463
  lines.push('');
1455
1464
  }
1465
+ const presetDirectives = helpData.presetDirectives ?? [];
1466
+ if (presetDirectives.length > 0) {
1467
+ lines.push(styleText('Preset Directives:', TERMINAL_STYLE.bold, TERMINAL_STYLE.underline));
1468
+ for (const { sig, desc } of presetDirectives) {
1469
+ lines.push(this.#renderAlignedHelpLine(sig, desc, labelWidth, value => styleText(value, TERMINAL_STYLE.cyan)));
1470
+ }
1471
+ lines.push('');
1472
+ }
1456
1473
  if (helpData.commands.length > 0) {
1457
1474
  lines.push(styleText('Commands:', TERMINAL_STYLE.bold, TERMINAL_STYLE.underline));
1458
1475
  for (const { name, desc } of helpData.commands) {
@@ -1475,6 +1492,7 @@ class CommandHelpRenderer {
1475
1492
  const labels = [
1476
1493
  ...helpData.arguments.map(line => line.sig),
1477
1494
  ...helpData.options.map(line => line.sig),
1495
+ ...(helpData.presetDirectives ?? []).map(line => line.sig),
1478
1496
  ...helpData.commands.map(line => line.name),
1479
1497
  ];
1480
1498
  if (labels.length === 0) {
@@ -3397,6 +3415,16 @@ class Command {
3397
3415
  commandPath: this.#getCommandPath(),
3398
3416
  arguments: this.#arguments,
3399
3417
  options: this.#resolveOptionPolicy().mergedOptions,
3418
+ presetDirectives: [
3419
+ {
3420
+ sig: `${PRESET_FILE_FLAG} <value>`,
3421
+ desc: 'Load preset manifest file',
3422
+ },
3423
+ {
3424
+ sig: `${PRESET_PROFILE_FLAG} <value>`,
3425
+ desc: 'Select preset profile: <profile> or <profile>:<variant>; requires --preset-file or command preset.file',
3426
+ },
3427
+ ],
3400
3428
  supportsBuiltinVersion: this.#supportsBuiltinVersion(),
3401
3429
  subcommands,
3402
3430
  examples: this.#examples,
@@ -391,6 +391,11 @@ interface IHelpOptionLine {
391
391
  sig: string;
392
392
  desc: string;
393
393
  }
394
+ /** Help preset directive line (internal) */
395
+ interface IHelpPresetDirectiveLine {
396
+ sig: string;
397
+ desc: string;
398
+ }
394
399
  /** Help argument line (internal) */
395
400
  interface IHelpArgumentLine {
396
401
  sig: string;
@@ -413,6 +418,7 @@ interface IHelpData {
413
418
  usage: string;
414
419
  arguments: IHelpArgumentLine[];
415
420
  options: IHelpOptionLine[];
421
+ presetDirectives?: IHelpPresetDirectiveLine[];
416
422
  commands: IHelpCommandLine[];
417
423
  examples: IHelpExampleLine[];
418
424
  }
@@ -674,4 +680,4 @@ declare function getDefaultCommandRuntime(): ICommandRuntime;
674
680
  declare function setDefaultCommandRuntime(runtime: ICommandRuntime): void;
675
681
 
676
682
  export { Coerce, Command, CommanderError, createBrowserCommandRuntime, getDefaultCommandRuntime, isDomain, isIp, isIpv4, isIpv6, logColorfulOption, logDateOption, setDefaultCommandRuntime, silentOption };
677
- export type { ICommand, ICommandAction, ICommandActionParams, ICommandArgumentConfig, ICommandArgumentKind, ICommandArgumentType, ICommandArgvSegment, ICommandBuiltinConfig, ICommandBuiltinOptionConfig, ICommandBuiltinOptionResolved, ICommandBuiltinParsedOptions, ICommandBuiltinResolved, ICommandConfig, ICommandContext, ICommandControlScanResult, ICommandControls, ICommandErrorIssue, ICommandErrorIssueCode, ICommandErrorMeta, ICommandExample, ICommandHintIssue, ICommandHintIssueCode, ICommandInputSources, ICommandIssue, ICommandIssueBase, ICommandIssueCode, ICommandIssueKind, ICommandIssueReason, ICommandIssueScope, ICommandIssueSourceAttribution, ICommandOptionArgs, ICommandOptionConfig, ICommandOptionType, ICommandParseResult, ICommandParsedArgs, ICommandParsedOpts, ICommandPresetConfig, ICommandPresetIssueMeta, ICommandPresetProfileDefaults, ICommandPresetProfileItem, ICommandPresetProfileManifest, ICommandPresetProfileOptionValue, ICommandPresetProfileVariantItem, ICommandPresetResult, ICommandPresetSourceMeta, ICommandPresetSourceState, ICommandResolveResult, ICommandRouteResult, ICommandRunParams, ICommandRuntime, ICommandRuntimeStats, ICommandShiftResult, ICommandStage, ICommandToken, ICommandTokenSource, ICommandTokenType, ICommandTokenizeResult, ICommanderErrorKind, ICompletionArgumentMeta, ICompletionCommandConfig, ICompletionMeta, ICompletionOptionMeta, ICompletionPaths, ICompletionShellType, IHelpArgumentLine, IHelpCommandLine, IHelpData, IHelpExampleLine, IHelpOptionLine, ISubcommandEntry };
683
+ export type { ICommand, ICommandAction, ICommandActionParams, ICommandArgumentConfig, ICommandArgumentKind, ICommandArgumentType, ICommandArgvSegment, ICommandBuiltinConfig, ICommandBuiltinOptionConfig, ICommandBuiltinOptionResolved, ICommandBuiltinParsedOptions, ICommandBuiltinResolved, ICommandConfig, ICommandContext, ICommandControlScanResult, ICommandControls, ICommandErrorIssue, ICommandErrorIssueCode, ICommandErrorMeta, ICommandExample, ICommandHintIssue, ICommandHintIssueCode, ICommandInputSources, ICommandIssue, ICommandIssueBase, ICommandIssueCode, ICommandIssueKind, ICommandIssueReason, ICommandIssueScope, ICommandIssueSourceAttribution, ICommandOptionArgs, ICommandOptionConfig, ICommandOptionType, ICommandParseResult, ICommandParsedArgs, ICommandParsedOpts, ICommandPresetConfig, ICommandPresetIssueMeta, ICommandPresetProfileDefaults, ICommandPresetProfileItem, ICommandPresetProfileManifest, ICommandPresetProfileOptionValue, ICommandPresetProfileVariantItem, ICommandPresetResult, ICommandPresetSourceMeta, ICommandPresetSourceState, ICommandResolveResult, ICommandRouteResult, ICommandRunParams, ICommandRuntime, ICommandRuntimeStats, ICommandShiftResult, ICommandStage, ICommandToken, ICommandTokenSource, ICommandTokenType, ICommandTokenizeResult, ICommanderErrorKind, ICompletionArgumentMeta, ICompletionCommandConfig, ICompletionMeta, ICompletionOptionMeta, ICompletionPaths, ICompletionShellType, IHelpArgumentLine, IHelpCommandLine, IHelpData, IHelpExampleLine, IHelpOptionLine, IHelpPresetDirectiveLine, ISubcommandEntry };
@@ -391,6 +391,11 @@ interface IHelpOptionLine {
391
391
  sig: string;
392
392
  desc: string;
393
393
  }
394
+ /** Help preset directive line (internal) */
395
+ interface IHelpPresetDirectiveLine {
396
+ sig: string;
397
+ desc: string;
398
+ }
394
399
  /** Help argument line (internal) */
395
400
  interface IHelpArgumentLine {
396
401
  sig: string;
@@ -413,6 +418,7 @@ interface IHelpData {
413
418
  usage: string;
414
419
  arguments: IHelpArgumentLine[];
415
420
  options: IHelpOptionLine[];
421
+ presetDirectives?: IHelpPresetDirectiveLine[];
416
422
  commands: IHelpCommandLine[];
417
423
  examples: IHelpExampleLine[];
418
424
  }
@@ -727,4 +733,4 @@ declare class PwshCompletion {
727
733
  }
728
734
 
729
735
  export { BashCompletion, Coerce, Command, CommanderError, CompletionCommand, FishCompletion, PwshCompletion, createBrowserCommandRuntime, createNodeCommandRuntime, getDefaultCommandRuntime, isDomain, isIp, isIpv4, isIpv6, logColorfulOption, logDateOption, setDefaultCommandRuntime, silentOption };
730
- export type { ICommand, ICommandAction, ICommandActionParams, ICommandArgumentConfig, ICommandArgumentKind, ICommandArgumentType, ICommandArgvSegment, ICommandBuiltinConfig, ICommandBuiltinOptionConfig, ICommandBuiltinOptionResolved, ICommandBuiltinParsedOptions, ICommandBuiltinResolved, ICommandConfig, ICommandContext, ICommandControlScanResult, ICommandControls, ICommandErrorIssue, ICommandErrorIssueCode, ICommandErrorMeta, ICommandExample, ICommandHintIssue, ICommandHintIssueCode, ICommandInputSources, ICommandIssue, ICommandIssueBase, ICommandIssueCode, ICommandIssueKind, ICommandIssueReason, ICommandIssueScope, ICommandIssueSourceAttribution, ICommandOptionArgs, ICommandOptionConfig, ICommandOptionType, ICommandParseResult, ICommandParsedArgs, ICommandParsedOpts, ICommandPresetConfig, ICommandPresetIssueMeta, ICommandPresetProfileDefaults, ICommandPresetProfileItem, ICommandPresetProfileManifest, ICommandPresetProfileOptionValue, ICommandPresetProfileVariantItem, ICommandPresetResult, ICommandPresetSourceMeta, ICommandPresetSourceState, ICommandResolveResult, ICommandRouteResult, ICommandRunParams, ICommandRuntime, ICommandRuntimeStats, ICommandShiftResult, ICommandStage, ICommandToken, ICommandTokenSource, ICommandTokenType, ICommandTokenizeResult, ICommanderErrorKind, ICompletionArgumentMeta, ICompletionCommandConfig, ICompletionMeta, ICompletionOptionMeta, ICompletionPaths, ICompletionShellType, IHelpArgumentLine, IHelpCommandLine, IHelpData, IHelpExampleLine, IHelpOptionLine, ISubcommandEntry };
736
+ export type { ICommand, ICommandAction, ICommandActionParams, ICommandArgumentConfig, ICommandArgumentKind, ICommandArgumentType, ICommandArgvSegment, ICommandBuiltinConfig, ICommandBuiltinOptionConfig, ICommandBuiltinOptionResolved, ICommandBuiltinParsedOptions, ICommandBuiltinResolved, ICommandConfig, ICommandContext, ICommandControlScanResult, ICommandControls, ICommandErrorIssue, ICommandErrorIssueCode, ICommandErrorMeta, ICommandExample, ICommandHintIssue, ICommandHintIssueCode, ICommandInputSources, ICommandIssue, ICommandIssueBase, ICommandIssueCode, ICommandIssueKind, ICommandIssueReason, ICommandIssueScope, ICommandIssueSourceAttribution, ICommandOptionArgs, ICommandOptionConfig, ICommandOptionType, ICommandParseResult, ICommandParsedArgs, ICommandParsedOpts, ICommandPresetConfig, ICommandPresetIssueMeta, ICommandPresetProfileDefaults, ICommandPresetProfileItem, ICommandPresetProfileManifest, ICommandPresetProfileOptionValue, ICommandPresetProfileVariantItem, ICommandPresetResult, ICommandPresetSourceMeta, ICommandPresetSourceState, ICommandResolveResult, ICommandRouteResult, ICommandRunParams, ICommandRuntime, ICommandRuntimeStats, ICommandShiftResult, ICommandStage, ICommandToken, ICommandTokenSource, ICommandTokenType, ICommandTokenizeResult, ICommanderErrorKind, ICompletionArgumentMeta, ICompletionCommandConfig, ICompletionMeta, ICompletionOptionMeta, ICompletionPaths, ICompletionShellType, IHelpArgumentLine, IHelpCommandLine, IHelpData, IHelpExampleLine, IHelpOptionLine, IHelpPresetDirectiveLine, ISubcommandEntry };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guanghechen/commander",
3
- "version": "4.7.9",
3
+ "version": "4.8.0",
4
4
  "description": "A minimal, type-safe command-line interface builder with fluent API",
5
5
  "author": {
6
6
  "name": "guanghechen",
@@ -1,152 +0,0 @@
1
- {
2
- "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://guanghechen.github.io/sora/schemas/commander/preset.config.schema.json",
4
- "title": "Commander Preset Config",
5
- "description": "Preset profile manifest for @guanghechen/commander --preset-file.",
6
- "type": "object",
7
- "additionalProperties": false,
8
- "required": ["version", "profiles"],
9
- "examples": [
10
- {
11
- "version": 1,
12
- "defaults": { "profile": "dev:local" },
13
- "profiles": {
14
- "dev": {
15
- "envFile": "dev.env",
16
- "envs": { "NODE_ENV": "development" },
17
- "opts": { "logLevel": "debug", "retry": 2 },
18
- "defaultVariant": "local",
19
- "variants": {
20
- "local": { "opts": { "retry": 1 } },
21
- "ci": { "envFile": "ci.env", "envs": { "CI": "1" } }
22
- }
23
- }
24
- }
25
- }
26
- ],
27
- "properties": {
28
- "$schema": {
29
- "type": "string",
30
- "description": "Optional schema reference for editors (e.g. VSCode)."
31
- },
32
- "version": {
33
- "type": "integer",
34
- "const": 1,
35
- "description": "Schema version."
36
- },
37
- "defaults": {
38
- "type": "object",
39
- "additionalProperties": false,
40
- "properties": {
41
- "profile": {
42
- "$ref": "#/$defs/profileSelector"
43
- }
44
- },
45
- "description": "Default selector when --preset-profile is not provided."
46
- },
47
- "profiles": {
48
- "type": "object",
49
- "minProperties": 1,
50
- "propertyNames": {
51
- "$ref": "#/$defs/profileName"
52
- },
53
- "additionalProperties": {
54
- "$ref": "#/$defs/profileItem"
55
- },
56
- "description": "Profiles keyed by profile name."
57
- }
58
- },
59
- "$defs": {
60
- "profileName": {
61
- "type": "string",
62
- "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]*$",
63
- "description": "Profile/variant name."
64
- },
65
- "profileSelector": {
66
- "type": "string",
67
- "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]*(?::[A-Za-z0-9][A-Za-z0-9._-]*)?$",
68
- "description": "Selector format: <profile> or <profile>:<variant>."
69
- },
70
- "optionName": {
71
- "type": "string",
72
- "pattern": "^(?:--)?(?:[a-z][a-zA-Z0-9]*|[A-Za-z][A-Za-z0-9]*(?:-[A-Za-z0-9]+)+)$",
73
- "description": "Option key in opts map; aligned with runtime normalization."
74
- },
75
- "optionValue": {
76
- "oneOf": [
77
- { "type": "boolean" },
78
- { "type": "string" },
79
- { "type": "number" },
80
- {
81
- "type": "array",
82
- "items": {
83
- "oneOf": [{ "type": "string" }, { "type": "number" }]
84
- }
85
- }
86
- ]
87
- },
88
- "envMap": {
89
- "type": "object",
90
- "additionalProperties": {
91
- "type": "string"
92
- }
93
- },
94
- "optsMap": {
95
- "type": "object",
96
- "propertyNames": {
97
- "$ref": "#/$defs/optionName"
98
- },
99
- "additionalProperties": {
100
- "$ref": "#/$defs/optionValue"
101
- }
102
- },
103
- "variantItem": {
104
- "type": "object",
105
- "additionalProperties": false,
106
- "properties": {
107
- "envFile": {
108
- "type": "string",
109
- "minLength": 1
110
- },
111
- "envs": {
112
- "$ref": "#/$defs/envMap"
113
- },
114
- "opts": {
115
- "$ref": "#/$defs/optsMap"
116
- }
117
- }
118
- },
119
- "variantsMap": {
120
- "type": "object",
121
- "propertyNames": {
122
- "$ref": "#/$defs/profileName"
123
- },
124
- "additionalProperties": {
125
- "$ref": "#/$defs/variantItem"
126
- }
127
- },
128
- "profileItem": {
129
- "type": "object",
130
- "additionalProperties": false,
131
- "properties": {
132
- "envFile": {
133
- "type": "string",
134
- "minLength": 1
135
- },
136
- "envs": {
137
- "$ref": "#/$defs/envMap"
138
- },
139
- "opts": {
140
- "$ref": "#/$defs/optsMap"
141
- },
142
- "defaultVariant": {
143
- "$ref": "#/$defs/profileName"
144
- },
145
- "variants": {
146
- "$ref": "#/$defs/variantsMap"
147
- }
148
- },
149
- "description": "defaultVariant existence in variants must still be validated by runtime."
150
- }
151
- }
152
- }