@vibe-validate/config 0.10.2 → 0.11.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/README.md CHANGED
@@ -1,15 +1,13 @@
1
1
  # @vibe-validate/config
2
2
 
3
- TypeScript-first configuration system for vibe-validate with Zod schema validation and framework presets.
3
+ Configuration system for vibe-validate with strict Zod schema validation and JSON Schema support.
4
4
 
5
5
  ## Features
6
6
 
7
- - ✅ **TypeScript-First**: Full type safety with IDE autocomplete
8
- - ✅ **Zod Validation**: Runtime schema validation with detailed error messages
9
- - ✅ **Framework Presets**: Pre-configured setups for common TypeScript project types
10
- - ✅ **Preset Override**: Extend and customize presets easily
11
- - ✅ **Multiple File Formats**: Support for `.ts`, `.mts`, `.js`, `.mjs`, and `.json` configs
12
- - ✅ **Config Extension**: Extend other config files
7
+ - ✅ **Strict Schema Validation**: Runtime validation with Zod (rejects unknown properties)
8
+ - ✅ **JSON Schema Support**: IDE autocomplete and validation for YAML configs
9
+ - ✅ **YAML Configuration**: Primary format with schema validation
10
+ - ✅ **Type Safety**: Full TypeScript definitions for programmatic use
13
11
 
14
12
  ## Installation
15
13
 
@@ -19,167 +17,92 @@ npm install @vibe-validate/config
19
17
 
20
18
  ## Usage
21
19
 
22
- ### Basic Configuration
20
+ ### YAML Configuration (Recommended)
23
21
 
24
- Create a `vibe-validate.config.ts` file in your project root:
22
+ Create a `vibe-validate.config.yaml` file using a template:
25
23
 
26
- ```typescript
27
- import { defineConfig } from '@vibe-validate/config';
28
-
29
- export default defineConfig({
30
- validation: {
31
- phases: [
32
- {
33
- name: 'Type Checking',
34
- parallel: false,
35
- steps: [
36
- { name: 'TypeScript', command: 'tsc --noEmit' }
37
- ]
38
- }
39
- ]
40
- }
41
- });
24
+ ```bash
25
+ npx vibe-validate init --template typescript-nodejs
42
26
  ```
43
27
 
44
- ### Using a Preset
45
-
46
- Start with a framework-specific preset:
47
-
48
- ```typescript
49
- import { defineConfig } from '@vibe-validate/config';
50
-
51
- export default defineConfig({
52
- preset: 'typescript-nodejs',
53
- // Optional: Override or extend preset configuration
54
- validation: {
55
- phases: [
56
- // Add custom phases or override preset phases
57
- ]
58
- }
59
- });
28
+ **Available templates:**
29
+ - `minimal` - Bare-bones starting point
30
+ - `typescript-library` - TypeScript libraries/npm packages
31
+ - `typescript-nodejs` - Node.js applications
32
+ - `typescript-react` - React/Next.js applications
33
+
34
+ All templates: https://github.com/jdutton/vibe-validate/tree/main/config-templates
35
+
36
+ ### Example YAML Configuration
37
+
38
+ <!-- config:example -->
39
+ ```yaml
40
+ $schema: https://raw.githubusercontent.com/jdutton/vibe-validate/main/packages/config/vibe-validate.schema.json
41
+
42
+ # Git settings
43
+ git:
44
+ mainBranch: main
45
+ autoSync: false
46
+ warnIfBehind: true
47
+
48
+ # Validation configuration
49
+ validation:
50
+ phases:
51
+ - name: Pre-Qualification
52
+ parallel: true
53
+ steps:
54
+ - name: TypeScript
55
+ command: tsc --noEmit
56
+ description: Type-check all code
57
+ - name: ESLint
58
+ command: eslint .
59
+ description: Lint for code quality
60
+
61
+ - name: Testing
62
+ parallel: false
63
+ steps:
64
+ - name: Unit Tests
65
+ command: npm test
66
+ description: Run test suite
67
+
68
+ failFast: true # Stop all validation on first phase failure
60
69
  ```
61
70
 
62
- ### Available Presets
63
-
64
- #### `typescript-library`
65
-
66
- Default preset for TypeScript npm libraries:
67
- - TypeScript type checking
68
- - ESLint linting
69
- - Unit tests
70
- - Build validation
71
-
72
- #### `typescript-nodejs`
73
-
74
- Preset for Node.js applications:
75
- - TypeScript type checking + build
76
- - ESLint linting
77
- - Unit + integration tests
78
-
79
- #### `typescript-react`
80
-
81
- Preset for React applications:
82
- - TypeScript type checking
83
- - ESLint linting
84
- - Unit + component tests
85
- - Production build (10min timeout)
86
-
87
- ## Configuration Schema
71
+ ### YAML Schema Support
88
72
 
89
- ### Full Configuration Example
73
+ The `$schema` property enables IDE autocomplete and validation:
90
74
 
91
- ```typescript
92
- import { defineConfig } from '@vibe-validate/config';
93
-
94
- export default defineConfig({
95
- validation: {
96
- phases: [
97
- {
98
- name: 'Phase 1: Pre-Qualification',
99
- parallel: true,
100
- timeout: 300000, // 5 minutes (default)
101
- failFast: true, // Stop on first error (default)
102
- steps: [
103
- {
104
- name: 'TypeScript',
105
- command: 'tsc --noEmit',
106
- timeout: 60000, // Step-specific timeout
107
- continueOnError: false,
108
- env: { NODE_ENV: 'test' },
109
- cwd: './packages/core'
110
- }
111
- ]
112
- }
113
- ],
114
- caching: {
115
- strategy: 'git-tree-hash', // 'git-tree-hash' | 'timestamp' | 'disabled'
116
- enabled: true,
117
- statePath: '.vibe-validate-state.yaml'
118
- }
119
- },
120
- git: {
121
- mainBranch: 'main',
122
- autoSync: false,
123
- warnIfBehind: true
124
- },
125
- output: {
126
- format: 'auto', // 'auto' | 'human' | 'yaml' | 'json'
127
- showProgress: true,
128
- verbose: false,
129
- noColor: false
130
- }
131
- });
132
- ```
133
-
134
- ### Config Extension
135
-
136
- Extend another config file:
137
-
138
- ```typescript
139
- import { defineConfig } from '@vibe-validate/config';
140
-
141
- export default defineConfig({
142
- extends: '../base-config.ts',
143
- validation: {
144
- // Overrides merged with base config
145
- }
146
- });
75
+ <!-- config:partial -->
76
+ ```yaml
77
+ $schema: https://raw.githubusercontent.com/jdutton/vibe-validate/main/packages/config/vibe-validate.schema.json
147
78
  ```
148
79
 
149
- ## API
80
+ This gives you:
81
+ - ✅ Autocomplete for all configuration properties
82
+ - ✅ Inline validation errors
83
+ - ✅ Hover documentation for each field
84
+ - ✅ Type checking for YAML configs
150
85
 
151
- ### `defineConfig(config)`
86
+ ## API (Programmatic Usage)
152
87
 
153
- Type-safe configuration helper providing IDE autocomplete and validation.
88
+ ### `loadConfig(cwd?)`
154
89
 
155
- ### `getPreset(name)`
156
-
157
- Get a preset by name:
90
+ Load configuration from current directory:
158
91
 
159
92
  ```typescript
160
- import { getPreset } from '@vibe-validate/config';
93
+ import { loadConfig } from '@vibe-validate/config';
161
94
 
162
- const preset = getPreset('typescript-library');
163
- ```
164
-
165
- ### `listPresets()`
166
-
167
- List all available presets:
168
-
169
- ```typescript
170
- import { listPresets } from '@vibe-validate/config';
171
-
172
- console.log(listPresets()); // ['typescript-library', 'typescript-nodejs', 'typescript-react']
95
+ const config = await loadConfig(); // Searches for vibe-validate.config.yaml
173
96
  ```
174
97
 
175
98
  ### `loadConfigFromFile(path)`
176
99
 
177
- Load and validate configuration from a file:
100
+ Load and validate configuration from a specific file:
178
101
 
179
102
  ```typescript
180
103
  import { loadConfigFromFile } from '@vibe-validate/config';
181
104
 
182
- const config = await loadConfigFromFile('./vibe-validate.config.ts');
105
+ const config = await loadConfigFromFile('./vibe-validate.config.yaml');
183
106
  ```
184
107
 
185
108
  ### `findAndLoadConfig(cwd?)`
@@ -192,44 +115,55 @@ import { findAndLoadConfig } from '@vibe-validate/config';
192
115
  const config = await findAndLoadConfig(); // Searches for config in cwd
193
116
  ```
194
117
 
195
- ### `loadConfigWithFallback(cwd?)`
118
+ ### `validateConfig(rawConfig)`
196
119
 
197
- Load configuration with fallback to default preset:
120
+ Validate a raw configuration object:
198
121
 
199
122
  ```typescript
200
- import { loadConfigWithFallback } from '@vibe-validate/config';
123
+ import { validateConfig, safeValidateConfig } from '@vibe-validate/config';
124
+
125
+ // Throws ZodError on invalid config
126
+ const config = validateConfig(rawConfig);
201
127
 
202
- const config = await loadConfigWithFallback(); // Uses typescript-library preset if no config found
128
+ // Returns { success, data?, errors? }
129
+ const result = safeValidateConfig(rawConfig);
130
+ if (!result.success) {
131
+ console.error(result.errors);
132
+ }
203
133
  ```
204
134
 
205
135
  ## Configuration File Discovery
206
136
 
207
- The loader searches for config files in this order:
137
+ The loader searches for the config file:
208
138
 
209
- 1. `vibe-validate.config.ts`
210
- 2. `vibe-validate.config.mts`
211
- 3. `vibe-validate.config.js`
212
- 4. `vibe-validate.config.mjs`
213
- 5. `vibe-validate.config.json`
214
- 6. `.vibe-validate.json`
139
+ - `vibe-validate.config.yaml` (only supported format)
215
140
 
216
- ## Validation
217
141
 
218
- Zod schemas provide runtime validation with detailed error messages:
142
+ ## Configuration Schema
219
143
 
220
- ```typescript
221
- import { validateConfig, safeValidateConfig } from '@vibe-validate/config';
144
+ See the complete configuration reference: https://github.com/jdutton/vibe-validate/blob/main/docs/configuration-reference.md
222
145
 
223
- // Throws ZodError on invalid config
224
- const config = validateConfig(rawConfig);
146
+ ### Key Sections
225
147
 
226
- // Returns { success, data?, errors? }
227
- const result = safeValidateConfig(rawConfig);
228
- if (!result.success) {
229
- console.error(result.errors);
230
- }
148
+ - **`git`** - Git repository settings (mainBranch, autoSync, etc.)
149
+ - **`validation`** - Validation phases and steps configuration
150
+ - **`validation.phases`** - Array of validation phases to execute
151
+ - **`validation.phases[].steps`** - Array of commands to run in each phase
152
+ - **`validation.failFast`** - Stop all validation on first phase failure (default: true)
153
+
154
+ ### Strict Validation
155
+
156
+ All Zod schemas use strict validation - unknown properties are rejected:
157
+
158
+ <!-- config:partial -->
159
+ ```yaml
160
+ validation:
161
+ phases: []
162
+ unknownProperty: true # ❌ ERROR: Unrecognized key 'unknownProperty'
231
163
  ```
232
164
 
165
+ This catches typos and prevents configuration drift.
166
+
233
167
  ## License
234
168
 
235
169
  MIT
@@ -16,7 +16,7 @@ import type { VibeValidateConfig } from './schema.js';
16
16
  *
17
17
  * @example
18
18
  * ```typescript
19
- * // vibe-validate.config.ts
19
+ * // vibe-validate.config.yaml
20
20
  * import { defineConfig } from '@vibe-validate/config';
21
21
  *
22
22
  * export default defineConfig({
@@ -35,15 +35,4 @@ import type { VibeValidateConfig } from './schema.js';
35
35
  * ```
36
36
  */
37
37
  export declare function defineConfig(config: VibeValidateConfig): VibeValidateConfig;
38
- /**
39
- * Deep merge two configuration objects
40
- *
41
- * Used for preset overrides - allows users to extend a preset
42
- * while overriding specific values.
43
- *
44
- * @param base - Base configuration (preset)
45
- * @param override - Override configuration (user customizations)
46
- * @returns Merged configuration
47
- */
48
- export declare function mergeConfig(base: VibeValidateConfig, override: Partial<VibeValidateConfig>): VibeValidateConfig;
49
38
  //# sourceMappingURL=define-config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"define-config.d.ts","sourceRoot":"","sources":["../src/define-config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,kBAAkB,GAAG,kBAAkB,CAE3E;AAED;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CACzB,IAAI,EAAE,kBAAkB,EACxB,QAAQ,EAAE,OAAO,CAAC,kBAAkB,CAAC,GACpC,kBAAkB,CAuBpB"}
1
+ {"version":3,"file":"define-config.d.ts","sourceRoot":"","sources":["../src/define-config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,kBAAkB,GAAG,kBAAkB,CAE3E"}
@@ -15,7 +15,7 @@
15
15
  *
16
16
  * @example
17
17
  * ```typescript
18
- * // vibe-validate.config.ts
18
+ * // vibe-validate.config.yaml
19
19
  * import { defineConfig } from '@vibe-validate/config';
20
20
  *
21
21
  * export default defineConfig({
@@ -36,37 +36,3 @@
36
36
  export function defineConfig(config) {
37
37
  return config;
38
38
  }
39
- /**
40
- * Deep merge two configuration objects
41
- *
42
- * Used for preset overrides - allows users to extend a preset
43
- * while overriding specific values.
44
- *
45
- * @param base - Base configuration (preset)
46
- * @param override - Override configuration (user customizations)
47
- * @returns Merged configuration
48
- */
49
- export function mergeConfig(base, override) {
50
- return {
51
- ...base,
52
- validation: {
53
- ...base.validation,
54
- ...(override.validation || {}),
55
- phases: override.validation?.phases || base.validation.phases,
56
- caching: {
57
- ...base.validation.caching,
58
- ...(override.validation?.caching || {}),
59
- },
60
- },
61
- git: {
62
- ...base.git,
63
- ...(override.git || {}),
64
- },
65
- output: {
66
- ...base.output,
67
- ...(override.output || {}),
68
- },
69
- preset: override.preset || base.preset,
70
- extends: override.extends || base.extends,
71
- };
72
- }
package/dist/index.d.ts CHANGED
@@ -1,46 +1,28 @@
1
1
  /**
2
2
  * @vibe-validate/config
3
3
  *
4
- * Configuration system for vibe-validate with TypeScript-first design,
5
- * Zod schema validation, and framework presets.
4
+ * Configuration system for vibe-validate with YAML-first design
5
+ * and Zod schema validation.
6
6
  *
7
- * @example
8
- * ```typescript
9
- * import { defineConfig } from '@vibe-validate/config';
7
+ * @example Basic YAML configuration
8
+ * ```yaml
9
+ * # vibe-validate.config.yaml
10
+ * $schema: https://raw.githubusercontent.com/jdutton/vibe-validate/main/packages/config/vibe-validate.schema.json
10
11
  *
11
- * export default defineConfig({
12
- * validation: {
13
- * phases: [
14
- * {
15
- * name: 'Type Checking',
16
- * parallel: false,
17
- * steps: [
18
- * { name: 'TypeScript', command: 'tsc --noEmit' }
19
- * ]
20
- * }
21
- * ]
22
- * }
23
- * });
24
- * ```
25
- *
26
- * @example Using a preset
27
- * ```typescript
28
- * import { defineConfig } from '@vibe-validate/config';
12
+ * git:
13
+ * mainBranch: main
29
14
  *
30
- * export default defineConfig({
31
- * preset: 'typescript-nodejs',
32
- * validation: {
33
- * phases: [
34
- * // Override or extend preset phases
35
- * ]
36
- * }
37
- * });
15
+ * validation:
16
+ * phases:
17
+ * - name: Type Checking
18
+ * parallel: false
19
+ * steps:
20
+ * - name: TypeScript
21
+ * command: tsc --noEmit
38
22
  * ```
39
23
  */
40
- export { type ValidationStep, type ValidationPhase, type ValidationConfig, type CachingStrategy, type GitConfig, type OutputConfig, type CIConfig, type HooksConfig, type VibeValidateConfig, ValidationStepSchema, ValidationPhaseSchema, ValidationConfigSchema, CachingStrategySchema, GitConfigSchema, OutputConfigSchema, CIConfigSchema, HooksConfigSchema, VibeValidateConfigSchema, validateConfig, safeValidateConfig, } from './schema.js';
41
- export { defineConfig, mergeConfig } from './define-config.js';
42
- export { typescriptLibraryPreset, typescriptNodejsPreset, typescriptReactPreset, PRESETS, getPreset, listPresets, } from './presets/index.js';
43
- export { CONFIG_FILE_NAMES, loadConfigFromFile, findAndLoadConfig, loadConfigWithFallback, } from './loader.js';
24
+ export { type ValidationStep, type ValidationPhase, type ValidationConfig, type GitConfig, type CIConfig, type HooksConfig, type VibeValidateConfig, ValidationStepSchema, ValidationPhaseSchema, ValidationConfigSchema, GitConfigSchema, CIConfigSchema, HooksConfigSchema, VibeValidateConfigSchema, validateConfig, safeValidateConfig, } from './schema.js';
25
+ export { CONFIG_FILE_NAME, loadConfigFromFile, findAndLoadConfig, } from './loader.js';
44
26
  export { GIT_DEFAULTS } from './constants.js';
45
27
  export { getRemoteBranch, getMainBranch, getRemoteOrigin } from './git-helpers.js';
46
28
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAGH,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACvB,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,EACtB,qBAAqB,EACrB,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,iBAAiB,EACjB,wBAAwB,EACxB,cAAc,EACd,kBAAkB,GACnB,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAG/D,OAAO,EACL,uBAAuB,EACvB,sBAAsB,EACtB,qBAAqB,EACrB,OAAO,EACP,SAAS,EACT,WAAW,GACZ,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAGH,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,SAAS,EACd,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACvB,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,EACtB,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,wBAAwB,EACxB,cAAc,EACd,kBAAkB,GACnB,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC"}
package/dist/index.js CHANGED
@@ -1,50 +1,30 @@
1
1
  /**
2
2
  * @vibe-validate/config
3
3
  *
4
- * Configuration system for vibe-validate with TypeScript-first design,
5
- * Zod schema validation, and framework presets.
4
+ * Configuration system for vibe-validate with YAML-first design
5
+ * and Zod schema validation.
6
6
  *
7
- * @example
8
- * ```typescript
9
- * import { defineConfig } from '@vibe-validate/config';
7
+ * @example Basic YAML configuration
8
+ * ```yaml
9
+ * # vibe-validate.config.yaml
10
+ * $schema: https://raw.githubusercontent.com/jdutton/vibe-validate/main/packages/config/vibe-validate.schema.json
10
11
  *
11
- * export default defineConfig({
12
- * validation: {
13
- * phases: [
14
- * {
15
- * name: 'Type Checking',
16
- * parallel: false,
17
- * steps: [
18
- * { name: 'TypeScript', command: 'tsc --noEmit' }
19
- * ]
20
- * }
21
- * ]
22
- * }
23
- * });
24
- * ```
25
- *
26
- * @example Using a preset
27
- * ```typescript
28
- * import { defineConfig } from '@vibe-validate/config';
12
+ * git:
13
+ * mainBranch: main
29
14
  *
30
- * export default defineConfig({
31
- * preset: 'typescript-nodejs',
32
- * validation: {
33
- * phases: [
34
- * // Override or extend preset phases
35
- * ]
36
- * }
37
- * });
15
+ * validation:
16
+ * phases:
17
+ * - name: Type Checking
18
+ * parallel: false
19
+ * steps:
20
+ * - name: TypeScript
21
+ * command: tsc --noEmit
38
22
  * ```
39
23
  */
40
24
  // Core schema types and validation
41
- export { ValidationStepSchema, ValidationPhaseSchema, ValidationConfigSchema, CachingStrategySchema, GitConfigSchema, OutputConfigSchema, CIConfigSchema, HooksConfigSchema, VibeValidateConfigSchema, validateConfig, safeValidateConfig, } from './schema.js';
42
- // Config definition helper
43
- export { defineConfig, mergeConfig } from './define-config.js';
44
- // Presets
45
- export { typescriptLibraryPreset, typescriptNodejsPreset, typescriptReactPreset, PRESETS, getPreset, listPresets, } from './presets/index.js';
25
+ export { ValidationStepSchema, ValidationPhaseSchema, ValidationConfigSchema, GitConfigSchema, CIConfigSchema, HooksConfigSchema, VibeValidateConfigSchema, validateConfig, safeValidateConfig, } from './schema.js';
46
26
  // Config loading
47
- export { CONFIG_FILE_NAMES, loadConfigFromFile, findAndLoadConfig, loadConfigWithFallback, } from './loader.js';
27
+ export { CONFIG_FILE_NAME, loadConfigFromFile, findAndLoadConfig, } from './loader.js';
48
28
  // Git configuration constants and helpers
49
29
  export { GIT_DEFAULTS } from './constants.js';
50
30
  export { getRemoteBranch, getMainBranch, getRemoteOrigin } from './git-helpers.js';
package/dist/loader.d.ts CHANGED
@@ -1,50 +1,19 @@
1
1
  /**
2
2
  * Configuration Loader
3
3
  *
4
- * Loads and resolves vibe-validate configuration from files,
5
- * including preset resolution and config extension.
6
- *
7
- * SECURITY MODEL:
8
- *
9
- * This loader executes user-provided configuration files as code (TypeScript/JavaScript)
10
- * or parses them as data (JSON). This is intentional and necessary for flexibility,
11
- * but has security implications:
12
- *
13
- * **Trust Boundary**: Configuration files are treated as TRUSTED CODE.
14
- * - Config files can execute arbitrary JavaScript/TypeScript
15
- * - Config files define shell commands that will be executed during validation
16
- * - Users MUST only use config files from trusted sources
17
- *
18
- * **No Sandboxing**: Configuration files run with full process permissions.
19
- * - They have access to the file system, network, environment variables
20
- * - They can import arbitrary npm packages
21
- * - They can modify process.env or global state
22
- *
23
- * **Security Responsibilities**:
24
- * - **Users**: Only use configs from trusted sources (own code, official presets)
25
- * - **Preset Authors**: Ensure presets don't execute untrusted commands
26
- * - **This Package**: Validate config schema, but cannot prevent malicious code execution
27
- *
28
- * **Mitigations**:
29
- * - Configuration schema validation (Zod) ensures structure is correct
30
- * - Git command injection prevention (array-based spawn, no shell)
31
- * - No automatic config downloads from remote sources
32
- * - Presets are vetted and included in this package
33
- *
34
- * See SECURITY.md for complete security considerations.
4
+ * Loads and resolves vibe-validate configuration from YAML files.
35
5
  */
36
6
  import { type VibeValidateConfig } from './schema.js';
37
7
  /**
38
- * Configuration file names to search for (in order)
8
+ * Configuration file name
39
9
  *
40
- * YAML is the primary and recommended format.
41
- * .mjs is legacy (deprecated) - supported for migration only.
10
+ * Only YAML format is supported.
42
11
  */
43
- export declare const CONFIG_FILE_NAMES: string[];
12
+ export declare const CONFIG_FILE_NAME = "vibe-validate.config.yaml";
44
13
  /**
45
14
  * Load configuration from a file path
46
15
  *
47
- * @param configPath - Absolute path to config file
16
+ * @param configPath - Absolute path to config file (must be .yaml)
48
17
  * @returns Loaded and validated configuration
49
18
  * @throws Error if file cannot be loaded or is invalid
50
19
  */
@@ -52,19 +21,10 @@ export declare function loadConfigFromFile(configPath: string): Promise<VibeVali
52
21
  /**
53
22
  * Find and load configuration from current working directory
54
23
  *
55
- * Searches for config files in order and loads the first one found.
24
+ * Searches for vibe-validate.config.yaml and loads it if found.
56
25
  *
57
26
  * @param cwd - Working directory to search (default: process.cwd())
58
27
  * @returns Loaded configuration or undefined if no config found
59
28
  */
60
29
  export declare function findAndLoadConfig(cwd?: string): Promise<VibeValidateConfig | undefined>;
61
- /**
62
- * Load configuration with fallback to default preset
63
- *
64
- * Searches for config file, falls back to typescript-library preset if not found.
65
- *
66
- * @param cwd - Working directory (default: process.cwd())
67
- * @returns Configuration (user config or default preset)
68
- */
69
- export declare function loadConfigWithFallback(cwd?: string): Promise<VibeValidateConfig>;
70
30
  //# sourceMappingURL=loader.d.ts.map
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,EAAkB,KAAK,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEtE;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,8BAA8B,CAAC;AAE5D;;;;;;GAMG;AACH,wBAAsB,kBAAkB,CACtC,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,kBAAkB,CAAC,CAqB7B;AAED;;;;;;;GAOG;AACH,wBAAsB,iBAAiB,CACrC,GAAG,GAAE,MAAsB,GAC1B,OAAO,CAAC,kBAAkB,GAAG,SAAS,CAAC,CAQzC"}