@guanghechen/commander 4.7.6 → 4.7.7

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,12 @@
1
1
  # Change Log
2
2
 
3
+ ## 4.7.7
4
+
5
+ ### Patch Changes
6
+
7
+ - Improve preset schema naming consistency and extend envFile preset-path resolution test coverage.
8
+ Stabilize commander test coverage thresholds.
9
+
3
10
  ## 4.7.6
4
11
 
5
12
  ### Patch Changes
package/README.md CHANGED
@@ -248,7 +248,7 @@ Schema:
248
248
 
249
249
  ```json
250
250
  {
251
- "$schema": "./node_modules/@guanghechen/commander/lib/schema/preset.config.schema.json"
251
+ "$schema": "./node_modules/@guanghechen/commander/lib/schema/preset.schema.json"
252
252
  }
253
253
  ```
254
254
 
@@ -0,0 +1,152 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://guanghechen.github.io/sora/schemas/commander/preset.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
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guanghechen/commander",
3
- "version": "4.7.6",
3
+ "version": "4.7.7",
4
4
  "description": "A minimal, type-safe command-line interface builder with fluent API",
5
5
  "author": {
6
6
  "name": "guanghechen",