@vibe-validate/config 0.9.10 → 0.10.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/dist/loader.d.ts +3 -0
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.js +25 -29
- package/dist/schema-export.d.ts +24 -0
- package/dist/schema-export.d.ts.map +1 -0
- package/dist/schema-export.js +31 -0
- package/dist/scripts/generate-schema.d.ts +9 -0
- package/dist/scripts/generate-schema.d.ts.map +1 -0
- package/dist/scripts/generate-schema.js +18 -0
- package/package.json +9 -5
- package/vibe-validate.schema.json +238 -0
package/dist/loader.d.ts
CHANGED
|
@@ -36,6 +36,9 @@
|
|
|
36
36
|
import { type VibeValidateConfig } from './schema.js';
|
|
37
37
|
/**
|
|
38
38
|
* Configuration file names to search for (in order)
|
|
39
|
+
*
|
|
40
|
+
* YAML is the primary and recommended format.
|
|
41
|
+
* .mjs is legacy (deprecated) - supported for migration only.
|
|
39
42
|
*/
|
|
40
43
|
export declare const CONFIG_FILE_NAMES: string[];
|
|
41
44
|
/**
|
package/dist/loader.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAMH,OAAO,EAAkB,KAAK,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAItE;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,UAG7B,CAAC;AAEF;;;;;;GAMG;AACH,wBAAsB,kBAAkB,CACtC,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,kBAAkB,CAAC,CAkC7B;AAED;;;;;;;GAOG;AACH,wBAAsB,iBAAiB,CACrC,GAAG,GAAE,MAAsB,GAC1B,OAAO,CAAC,kBAAkB,GAAG,SAAS,CAAC,CAazC;AA0DD;;;;;;;GAOG;AACH,wBAAsB,sBAAsB,CAC1C,GAAG,GAAE,MAAsB,GAC1B,OAAO,CAAC,kBAAkB,CAAC,CAc7B"}
|
package/dist/loader.js
CHANGED
|
@@ -36,19 +36,19 @@
|
|
|
36
36
|
import { resolve, dirname } from 'path';
|
|
37
37
|
import { readFileSync } from 'fs';
|
|
38
38
|
import { pathToFileURL } from 'url';
|
|
39
|
+
import { load as parseYaml } from 'js-yaml';
|
|
39
40
|
import { validateConfig } from './schema.js';
|
|
40
41
|
import { mergeConfig } from './define-config.js';
|
|
41
42
|
import { getPreset } from './presets/index.js';
|
|
42
43
|
/**
|
|
43
44
|
* Configuration file names to search for (in order)
|
|
45
|
+
*
|
|
46
|
+
* YAML is the primary and recommended format.
|
|
47
|
+
* .mjs is legacy (deprecated) - supported for migration only.
|
|
44
48
|
*/
|
|
45
49
|
export const CONFIG_FILE_NAMES = [
|
|
46
|
-
'vibe-validate.config.
|
|
47
|
-
'vibe-validate.config.
|
|
48
|
-
'vibe-validate.config.js',
|
|
49
|
-
'vibe-validate.config.mjs',
|
|
50
|
-
'vibe-validate.config.json',
|
|
51
|
-
'.vibe-validate.json',
|
|
50
|
+
'vibe-validate.config.yaml',
|
|
51
|
+
'vibe-validate.config.mjs', // DEPRECATED: Legacy format, will be removed in v1.0
|
|
52
52
|
];
|
|
53
53
|
/**
|
|
54
54
|
* Load configuration from a file path
|
|
@@ -59,33 +59,29 @@ export const CONFIG_FILE_NAMES = [
|
|
|
59
59
|
*/
|
|
60
60
|
export async function loadConfigFromFile(configPath) {
|
|
61
61
|
const absolutePath = resolve(configPath);
|
|
62
|
-
//
|
|
63
|
-
if (absolutePath.endsWith('.
|
|
62
|
+
// YAML files (primary format)
|
|
63
|
+
if (absolutePath.endsWith('.yaml')) {
|
|
64
64
|
const content = readFileSync(absolutePath, 'utf-8');
|
|
65
|
-
const raw =
|
|
65
|
+
const raw = parseYaml(content);
|
|
66
|
+
// Remove $schema property if present (used for IDE support only)
|
|
67
|
+
if (raw && typeof raw === 'object' && '$schema' in raw) {
|
|
68
|
+
delete raw['$schema'];
|
|
69
|
+
}
|
|
66
70
|
return await resolveConfig(raw, dirname(absolutePath));
|
|
67
71
|
}
|
|
68
|
-
//
|
|
69
|
-
if (absolutePath.endsWith('.
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
const raw = module.default || module;
|
|
78
|
-
return await resolveConfig(raw, dirname(absolutePath));
|
|
79
|
-
}
|
|
80
|
-
finally {
|
|
81
|
-
unregister();
|
|
82
|
-
}
|
|
72
|
+
// Legacy .mjs files (DEPRECATED - will be removed in v1.0)
|
|
73
|
+
if (absolutePath.endsWith('.mjs')) {
|
|
74
|
+
console.warn('⚠️ WARNING: .mjs config format is deprecated and will be removed in v1.0');
|
|
75
|
+
console.warn(' Please migrate to vibe-validate.config.yaml');
|
|
76
|
+
console.warn(' Run: vibe-validate doctor for migration guidance\n');
|
|
77
|
+
const fileUrl = pathToFileURL(absolutePath).href;
|
|
78
|
+
const module = await import(fileUrl);
|
|
79
|
+
const raw = module.default || module;
|
|
80
|
+
return await resolveConfig(raw, dirname(absolutePath));
|
|
83
81
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
const raw = module.default || module;
|
|
88
|
-
return await resolveConfig(raw, dirname(absolutePath));
|
|
82
|
+
throw new Error(`Unsupported config file format: ${absolutePath}\n` +
|
|
83
|
+
`Only .yaml and .mjs (deprecated) formats are supported.\n` +
|
|
84
|
+
`Please use vibe-validate.config.yaml`);
|
|
89
85
|
}
|
|
90
86
|
/**
|
|
91
87
|
* Find and load configuration from current working directory
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JSON Schema Export for YAML Configuration
|
|
3
|
+
*
|
|
4
|
+
* Generates JSON Schema from Zod configuration schema to enable
|
|
5
|
+
* IDE validation and autocomplete for YAML config files.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Generate JSON Schema from Zod config schema
|
|
9
|
+
*
|
|
10
|
+
* This schema can be referenced in YAML files using the $schema property:
|
|
11
|
+
* ```yaml
|
|
12
|
+
* $schema: ./node_modules/@vibe-validate/config/vibe-validate.schema.json
|
|
13
|
+
* validation:
|
|
14
|
+
* phases: []
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @returns JSON Schema object
|
|
18
|
+
*/
|
|
19
|
+
export declare function generateJsonSchema(): object;
|
|
20
|
+
/**
|
|
21
|
+
* Pre-generated JSON Schema (exported for bundling in npm package)
|
|
22
|
+
*/
|
|
23
|
+
export declare const vibeValidateJsonSchema: object;
|
|
24
|
+
//# sourceMappingURL=schema-export.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-export.d.ts","sourceRoot":"","sources":["../src/schema-export.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAM3C;AAED;;GAEG;AACH,eAAO,MAAM,sBAAsB,QAAuB,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JSON Schema Export for YAML Configuration
|
|
3
|
+
*
|
|
4
|
+
* Generates JSON Schema from Zod configuration schema to enable
|
|
5
|
+
* IDE validation and autocomplete for YAML config files.
|
|
6
|
+
*/
|
|
7
|
+
import { zodToJsonSchema } from 'zod-to-json-schema';
|
|
8
|
+
import { VibeValidateConfigSchema } from './schema.js';
|
|
9
|
+
/**
|
|
10
|
+
* Generate JSON Schema from Zod config schema
|
|
11
|
+
*
|
|
12
|
+
* This schema can be referenced in YAML files using the $schema property:
|
|
13
|
+
* ```yaml
|
|
14
|
+
* $schema: ./node_modules/@vibe-validate/config/vibe-validate.schema.json
|
|
15
|
+
* validation:
|
|
16
|
+
* phases: []
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @returns JSON Schema object
|
|
20
|
+
*/
|
|
21
|
+
export function generateJsonSchema() {
|
|
22
|
+
return zodToJsonSchema(VibeValidateConfigSchema, {
|
|
23
|
+
name: 'VibeValidateConfig',
|
|
24
|
+
$refStrategy: 'none', // Inline all references for simplicity
|
|
25
|
+
target: 'jsonSchema7',
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Pre-generated JSON Schema (exported for bundling in npm package)
|
|
30
|
+
*/
|
|
31
|
+
export const vibeValidateJsonSchema = generateJsonSchema();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-schema.d.ts","sourceRoot":"","sources":["../../src/scripts/generate-schema.ts"],"names":[],"mappings":";AACA;;;;;GAKG"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Generate JSON Schema File
|
|
4
|
+
*
|
|
5
|
+
* Creates vibe-validate.schema.json in the package root for use in YAML configs.
|
|
6
|
+
* This script runs during the build process.
|
|
7
|
+
*/
|
|
8
|
+
import { writeFileSync } from 'node:fs';
|
|
9
|
+
import { fileURLToPath } from 'node:url';
|
|
10
|
+
import { dirname, join } from 'node:path';
|
|
11
|
+
import { vibeValidateJsonSchema } from '../schema-export.js';
|
|
12
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
13
|
+
const __dirname = dirname(__filename);
|
|
14
|
+
const packageRoot = join(__dirname, '..', '..');
|
|
15
|
+
const schemaPath = join(packageRoot, 'vibe-validate.schema.json');
|
|
16
|
+
// Generate and write schema file
|
|
17
|
+
writeFileSync(schemaPath, JSON.stringify(vibeValidateJsonSchema, null, 2), 'utf-8');
|
|
18
|
+
console.log('✓ Generated vibe-validate.schema.json');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vibe-validate/config",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "Configuration system for vibe-validate with TypeScript-first design and framework presets",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"files": [
|
|
15
|
-
"dist"
|
|
15
|
+
"dist",
|
|
16
|
+
"vibe-validate.schema.json"
|
|
16
17
|
],
|
|
17
18
|
"keywords": [
|
|
18
19
|
"validation",
|
|
@@ -29,11 +30,14 @@
|
|
|
29
30
|
"directory": "packages/config"
|
|
30
31
|
},
|
|
31
32
|
"devDependencies": {
|
|
33
|
+
"@types/js-yaml": "^4.0.9",
|
|
32
34
|
"typescript": "^5.7.2"
|
|
33
35
|
},
|
|
34
36
|
"dependencies": {
|
|
37
|
+
"js-yaml": "^4.1.0",
|
|
35
38
|
"tsx": "^4.20.6",
|
|
36
|
-
"zod": "^3.24.1"
|
|
39
|
+
"zod": "^3.24.1",
|
|
40
|
+
"zod-to-json-schema": "^3.24.6"
|
|
37
41
|
},
|
|
38
42
|
"engines": {
|
|
39
43
|
"node": ">=20.0.0"
|
|
@@ -42,7 +46,7 @@
|
|
|
42
46
|
"access": "public"
|
|
43
47
|
},
|
|
44
48
|
"scripts": {
|
|
45
|
-
"build": "tsc",
|
|
46
|
-
"clean": "rm -rf dist"
|
|
49
|
+
"build": "tsc && node --import tsx ./src/scripts/generate-schema.ts",
|
|
50
|
+
"clean": "rm -rf dist vibe-validate.schema.json"
|
|
47
51
|
}
|
|
48
52
|
}
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$ref": "#/definitions/VibeValidateConfig",
|
|
3
|
+
"definitions": {
|
|
4
|
+
"VibeValidateConfig": {
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"validation": {
|
|
8
|
+
"type": "object",
|
|
9
|
+
"properties": {
|
|
10
|
+
"phases": {
|
|
11
|
+
"type": "array",
|
|
12
|
+
"items": {
|
|
13
|
+
"type": "object",
|
|
14
|
+
"properties": {
|
|
15
|
+
"name": {
|
|
16
|
+
"type": "string",
|
|
17
|
+
"minLength": 1
|
|
18
|
+
},
|
|
19
|
+
"parallel": {
|
|
20
|
+
"type": "boolean",
|
|
21
|
+
"default": false
|
|
22
|
+
},
|
|
23
|
+
"dependsOn": {
|
|
24
|
+
"type": "array",
|
|
25
|
+
"items": {
|
|
26
|
+
"type": "string"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"steps": {
|
|
30
|
+
"type": "array",
|
|
31
|
+
"items": {
|
|
32
|
+
"type": "object",
|
|
33
|
+
"properties": {
|
|
34
|
+
"name": {
|
|
35
|
+
"type": "string",
|
|
36
|
+
"minLength": 1
|
|
37
|
+
},
|
|
38
|
+
"command": {
|
|
39
|
+
"type": "string",
|
|
40
|
+
"minLength": 1
|
|
41
|
+
},
|
|
42
|
+
"timeout": {
|
|
43
|
+
"type": "number",
|
|
44
|
+
"exclusiveMinimum": 0
|
|
45
|
+
},
|
|
46
|
+
"continueOnError": {
|
|
47
|
+
"type": "boolean"
|
|
48
|
+
},
|
|
49
|
+
"env": {
|
|
50
|
+
"type": "object",
|
|
51
|
+
"additionalProperties": {
|
|
52
|
+
"type": "string"
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"cwd": {
|
|
56
|
+
"type": "string"
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
"required": [
|
|
60
|
+
"name",
|
|
61
|
+
"command"
|
|
62
|
+
],
|
|
63
|
+
"additionalProperties": false
|
|
64
|
+
},
|
|
65
|
+
"minItems": 1
|
|
66
|
+
},
|
|
67
|
+
"timeout": {
|
|
68
|
+
"type": "number",
|
|
69
|
+
"exclusiveMinimum": 0,
|
|
70
|
+
"default": 300000
|
|
71
|
+
},
|
|
72
|
+
"failFast": {
|
|
73
|
+
"type": "boolean",
|
|
74
|
+
"default": true
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
"required": [
|
|
78
|
+
"name",
|
|
79
|
+
"steps"
|
|
80
|
+
],
|
|
81
|
+
"additionalProperties": false
|
|
82
|
+
},
|
|
83
|
+
"minItems": 1
|
|
84
|
+
},
|
|
85
|
+
"caching": {
|
|
86
|
+
"type": "object",
|
|
87
|
+
"properties": {
|
|
88
|
+
"strategy": {
|
|
89
|
+
"type": "string",
|
|
90
|
+
"enum": [
|
|
91
|
+
"git-tree-hash",
|
|
92
|
+
"timestamp",
|
|
93
|
+
"disabled"
|
|
94
|
+
],
|
|
95
|
+
"default": "git-tree-hash"
|
|
96
|
+
},
|
|
97
|
+
"enabled": {
|
|
98
|
+
"type": "boolean",
|
|
99
|
+
"default": true
|
|
100
|
+
},
|
|
101
|
+
"statePath": {
|
|
102
|
+
"type": "string",
|
|
103
|
+
"default": ".vibe-validate-state.yaml"
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
"additionalProperties": false,
|
|
107
|
+
"default": {
|
|
108
|
+
"strategy": "git-tree-hash",
|
|
109
|
+
"enabled": true,
|
|
110
|
+
"statePath": ".vibe-validate-state.yaml"
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
"required": [
|
|
115
|
+
"phases"
|
|
116
|
+
],
|
|
117
|
+
"additionalProperties": false
|
|
118
|
+
},
|
|
119
|
+
"git": {
|
|
120
|
+
"type": "object",
|
|
121
|
+
"properties": {
|
|
122
|
+
"mainBranch": {
|
|
123
|
+
"type": "string",
|
|
124
|
+
"default": "main"
|
|
125
|
+
},
|
|
126
|
+
"remoteOrigin": {
|
|
127
|
+
"type": "string",
|
|
128
|
+
"default": "origin"
|
|
129
|
+
},
|
|
130
|
+
"autoSync": {
|
|
131
|
+
"type": "boolean",
|
|
132
|
+
"default": false
|
|
133
|
+
},
|
|
134
|
+
"warnIfBehind": {
|
|
135
|
+
"type": "boolean",
|
|
136
|
+
"default": true
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
"additionalProperties": false,
|
|
140
|
+
"default": {
|
|
141
|
+
"mainBranch": "main",
|
|
142
|
+
"remoteOrigin": "origin",
|
|
143
|
+
"autoSync": false,
|
|
144
|
+
"warnIfBehind": true
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
"output": {
|
|
148
|
+
"type": "object",
|
|
149
|
+
"properties": {
|
|
150
|
+
"showProgress": {
|
|
151
|
+
"type": "boolean",
|
|
152
|
+
"default": true
|
|
153
|
+
},
|
|
154
|
+
"verbose": {
|
|
155
|
+
"type": "boolean",
|
|
156
|
+
"default": false
|
|
157
|
+
},
|
|
158
|
+
"noColor": {
|
|
159
|
+
"type": "boolean",
|
|
160
|
+
"default": false
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
"additionalProperties": false,
|
|
164
|
+
"default": {
|
|
165
|
+
"showProgress": true,
|
|
166
|
+
"verbose": false,
|
|
167
|
+
"noColor": false
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
"ci": {
|
|
171
|
+
"type": "object",
|
|
172
|
+
"properties": {
|
|
173
|
+
"nodeVersions": {
|
|
174
|
+
"type": "array",
|
|
175
|
+
"items": {
|
|
176
|
+
"type": "string"
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
"os": {
|
|
180
|
+
"type": "array",
|
|
181
|
+
"items": {
|
|
182
|
+
"type": "string"
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
"failFast": {
|
|
186
|
+
"type": "boolean"
|
|
187
|
+
},
|
|
188
|
+
"coverage": {
|
|
189
|
+
"type": "boolean"
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
"additionalProperties": false
|
|
193
|
+
},
|
|
194
|
+
"hooks": {
|
|
195
|
+
"type": "object",
|
|
196
|
+
"properties": {
|
|
197
|
+
"preCommit": {
|
|
198
|
+
"type": "object",
|
|
199
|
+
"properties": {
|
|
200
|
+
"enabled": {
|
|
201
|
+
"type": "boolean",
|
|
202
|
+
"default": true
|
|
203
|
+
},
|
|
204
|
+
"command": {
|
|
205
|
+
"type": "string",
|
|
206
|
+
"default": "npx vibe-validate pre-commit"
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
"additionalProperties": false,
|
|
210
|
+
"default": {
|
|
211
|
+
"enabled": true,
|
|
212
|
+
"command": "npx vibe-validate pre-commit"
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
"additionalProperties": false,
|
|
217
|
+
"default": {
|
|
218
|
+
"preCommit": {
|
|
219
|
+
"enabled": true,
|
|
220
|
+
"command": "npx vibe-validate pre-commit"
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
},
|
|
224
|
+
"preset": {
|
|
225
|
+
"type": "string"
|
|
226
|
+
},
|
|
227
|
+
"extends": {
|
|
228
|
+
"type": "string"
|
|
229
|
+
}
|
|
230
|
+
},
|
|
231
|
+
"required": [
|
|
232
|
+
"validation"
|
|
233
|
+
],
|
|
234
|
+
"additionalProperties": false
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
"$schema": "http://json-schema.org/draft-07/schema#"
|
|
238
|
+
}
|