@gunshi/definition 0.35.1 → 0.35.2

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/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- //#region ../../node_modules/.pnpm/args-tokens@0.27.0/node_modules/args-tokens/lib/parser-DT7Ztcch.d.ts
1
+ //#region ../../node_modules/.pnpm/args-tokens@0.28.0/node_modules/args-tokens/lib/parser-DT7Ztcch.d.ts
2
2
  //#region src/parser.d.ts
3
3
  /**
4
4
  * Entry point of argument parser.
@@ -55,7 +55,7 @@ interface ArgToken {
55
55
  * Parser Options.
56
56
  */
57
57
  //#endregion
58
- //#region ../../node_modules/.pnpm/args-tokens@0.27.0/node_modules/args-tokens/lib/resolver.d.ts
58
+ //#region ../../node_modules/.pnpm/args-tokens@0.28.0/node_modules/args-tokens/lib/resolver.d.ts
59
59
  //#region src/resolver.d.ts
60
60
  /**
61
61
  * An argument schema definition for command-line argument parsing.
@@ -476,7 +476,7 @@ interface ArgSchema {
476
476
  *
477
477
  * @param value - Raw string value from command line
478
478
  * @returns Parsed value of any type
479
- * @throws Error or subclass when value is invalid
479
+ * @throws {Error} Error or subclass when value is invalid
480
480
  *
481
481
  * @example
482
482
  * Custom parsing functions:
@@ -508,6 +508,13 @@ interface ArgSchema {
508
508
  */
509
509
  parse?: (value: string) => any;
510
510
  }
511
+ /**
512
+ * Machine-readable error codes for {@link ArgsValidationError}.
513
+ *
514
+ * Each code identifies a validation failure category and is also suitable as an
515
+ * i18n resource key for localized rendering.
516
+ */
517
+
511
518
  /**
512
519
  * An object that contains {@link ArgSchema | argument schema}.
513
520
  *
@@ -922,6 +929,13 @@ interface CommandEnvironment<G extends GunshiParamsConstraint = DefaultGunshiPar
922
929
  * @see {@linkcode CliOptions.usageSilent}
923
930
  */
924
931
  usageSilent: boolean;
932
+ /**
933
+ * Whether to treat undefined options as argument validation errors.
934
+ *
935
+ * @default false
936
+ * @see {@linkcode CliOptions.strict}
937
+ */
938
+ strict: boolean;
925
939
  /**
926
940
  * Sub commands.
927
941
  *
@@ -1009,6 +1023,16 @@ interface CliOptions<G extends GunshiParamsConstraint = DefaultGunshiParams> {
1009
1023
  * Whether to display the command usage.
1010
1024
  */
1011
1025
  usageSilent?: boolean;
1026
+ /**
1027
+ * Whether to treat undefined options as argument validation errors.
1028
+ *
1029
+ * When enabled, option tokens that are not declared by the resolved command
1030
+ * arguments or installed global options are reported as validation errors
1031
+ * before the command runner is executed.
1032
+ *
1033
+ * @default false
1034
+ */
1035
+ strict?: boolean;
1012
1036
  /**
1013
1037
  * Render function the command usage.
1014
1038
  */
package/lib/index.js CHANGED
@@ -19,6 +19,7 @@ const CLI_OPTIONS_DEFAULT = {
19
19
  middleMargin: 10,
20
20
  usageOptionType: false,
21
21
  usageOptionValue: true,
22
+ strict: false,
22
23
  renderHeader: void 0,
23
24
  renderUsage: void 0,
24
25
  renderValidationErrors: void 0,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gunshi/definition",
3
3
  "description": "utilities for gunshi command definition",
4
- "version": "0.35.1",
4
+ "version": "0.35.2",
5
5
  "author": {
6
6
  "name": "kazuya kawaguchi",
7
7
  "email": "kawakazu80@gmail.com"
@@ -57,7 +57,7 @@
57
57
  "jsr-exports-lint": "^0.4.2",
58
58
  "publint": "^0.3.20",
59
59
  "tsdown": "0.21.0",
60
- "gunshi": "0.35.1"
60
+ "gunshi": "0.35.2"
61
61
  },
62
62
  "scripts": {
63
63
  "build": "tsdown",