@vibe-validate/config 0.9.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 ADDED
@@ -0,0 +1,235 @@
1
+ # @vibe-validate/config
2
+
3
+ TypeScript-first configuration system for vibe-validate with Zod schema validation and framework presets.
4
+
5
+ ## Features
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
13
+
14
+ ## Installation
15
+
16
+ ```bash
17
+ npm install @vibe-validate/config
18
+ ```
19
+
20
+ ## Usage
21
+
22
+ ### Basic Configuration
23
+
24
+ Create a `vibe-validate.config.ts` file in your project root:
25
+
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
+ });
42
+ ```
43
+
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
+ });
60
+ ```
61
+
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
88
+
89
+ ### Full Configuration Example
90
+
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
+ });
147
+ ```
148
+
149
+ ## API
150
+
151
+ ### `defineConfig(config)`
152
+
153
+ Type-safe configuration helper providing IDE autocomplete and validation.
154
+
155
+ ### `getPreset(name)`
156
+
157
+ Get a preset by name:
158
+
159
+ ```typescript
160
+ import { getPreset } from '@vibe-validate/config';
161
+
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']
173
+ ```
174
+
175
+ ### `loadConfigFromFile(path)`
176
+
177
+ Load and validate configuration from a file:
178
+
179
+ ```typescript
180
+ import { loadConfigFromFile } from '@vibe-validate/config';
181
+
182
+ const config = await loadConfigFromFile('./vibe-validate.config.ts');
183
+ ```
184
+
185
+ ### `findAndLoadConfig(cwd?)`
186
+
187
+ Find and load configuration from working directory:
188
+
189
+ ```typescript
190
+ import { findAndLoadConfig } from '@vibe-validate/config';
191
+
192
+ const config = await findAndLoadConfig(); // Searches for config in cwd
193
+ ```
194
+
195
+ ### `loadConfigWithFallback(cwd?)`
196
+
197
+ Load configuration with fallback to default preset:
198
+
199
+ ```typescript
200
+ import { loadConfigWithFallback } from '@vibe-validate/config';
201
+
202
+ const config = await loadConfigWithFallback(); // Uses typescript-library preset if no config found
203
+ ```
204
+
205
+ ## Configuration File Discovery
206
+
207
+ The loader searches for config files in this order:
208
+
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`
215
+
216
+ ## Validation
217
+
218
+ Zod schemas provide runtime validation with detailed error messages:
219
+
220
+ ```typescript
221
+ import { validateConfig, safeValidateConfig } from '@vibe-validate/config';
222
+
223
+ // Throws ZodError on invalid config
224
+ const config = validateConfig(rawConfig);
225
+
226
+ // Returns { success, data?, errors? }
227
+ const result = safeValidateConfig(rawConfig);
228
+ if (!result.success) {
229
+ console.error(result.errors);
230
+ }
231
+ ```
232
+
233
+ ## License
234
+
235
+ MIT
@@ -0,0 +1,49 @@
1
+ /**
2
+ * TypeScript-First Config Helper
3
+ *
4
+ * Provides a type-safe way to define vibe-validate configuration
5
+ * with full IDE autocomplete and validation.
6
+ */
7
+ import type { VibeValidateConfig } from './schema.js';
8
+ /**
9
+ * Define a vibe-validate configuration
10
+ *
11
+ * This is a type-safe helper that provides IDE autocomplete and validation.
12
+ * It performs no runtime operations - just returns the config object.
13
+ *
14
+ * @param config - Configuration object
15
+ * @returns The same configuration object (type-checked)
16
+ *
17
+ * @example
18
+ * ```typescript
19
+ * // vibe-validate.config.ts
20
+ * import { defineConfig } from '@vibe-validate/config';
21
+ *
22
+ * export default defineConfig({
23
+ * validation: {
24
+ * phases: [
25
+ * {
26
+ * name: 'Type Checking',
27
+ * parallel: false,
28
+ * steps: [
29
+ * { name: 'TypeScript', command: 'tsc --noEmit' }
30
+ * ]
31
+ * }
32
+ * ]
33
+ * }
34
+ * });
35
+ * ```
36
+ */
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
+ //# sourceMappingURL=define-config.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,72 @@
1
+ /**
2
+ * TypeScript-First Config Helper
3
+ *
4
+ * Provides a type-safe way to define vibe-validate configuration
5
+ * with full IDE autocomplete and validation.
6
+ */
7
+ /**
8
+ * Define a vibe-validate configuration
9
+ *
10
+ * This is a type-safe helper that provides IDE autocomplete and validation.
11
+ * It performs no runtime operations - just returns the config object.
12
+ *
13
+ * @param config - Configuration object
14
+ * @returns The same configuration object (type-checked)
15
+ *
16
+ * @example
17
+ * ```typescript
18
+ * // vibe-validate.config.ts
19
+ * import { defineConfig } from '@vibe-validate/config';
20
+ *
21
+ * export default defineConfig({
22
+ * validation: {
23
+ * phases: [
24
+ * {
25
+ * name: 'Type Checking',
26
+ * parallel: false,
27
+ * steps: [
28
+ * { name: 'TypeScript', command: 'tsc --noEmit' }
29
+ * ]
30
+ * }
31
+ * ]
32
+ * }
33
+ * });
34
+ * ```
35
+ */
36
+ export function defineConfig(config) {
37
+ return config;
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
+ }
@@ -0,0 +1,44 @@
1
+ /**
2
+ * @vibe-validate/config
3
+ *
4
+ * Configuration system for vibe-validate with TypeScript-first design,
5
+ * Zod schema validation, and framework presets.
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * import { defineConfig } from '@vibe-validate/config';
10
+ *
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';
29
+ *
30
+ * export default defineConfig({
31
+ * preset: 'typescript-nodejs',
32
+ * validation: {
33
+ * phases: [
34
+ * // Override or extend preset phases
35
+ * ]
36
+ * }
37
+ * });
38
+ * ```
39
+ */
40
+ export { type ValidationStep, type ValidationPhase, type ValidationConfig, type CachingStrategy, type OutputFormat, type GitConfig, type OutputConfig, type VibeValidateConfig, ValidationStepSchema, ValidationPhaseSchema, ValidationConfigSchema, CachingStrategySchema, OutputFormatSchema, GitConfigSchema, OutputConfigSchema, 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';
44
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,EACtB,qBAAqB,EACrB,kBAAkB,EAClB,eAAe,EACf,kBAAkB,EAClB,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"}
package/dist/index.js ADDED
@@ -0,0 +1,47 @@
1
+ /**
2
+ * @vibe-validate/config
3
+ *
4
+ * Configuration system for vibe-validate with TypeScript-first design,
5
+ * Zod schema validation, and framework presets.
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * import { defineConfig } from '@vibe-validate/config';
10
+ *
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';
29
+ *
30
+ * export default defineConfig({
31
+ * preset: 'typescript-nodejs',
32
+ * validation: {
33
+ * phases: [
34
+ * // Override or extend preset phases
35
+ * ]
36
+ * }
37
+ * });
38
+ * ```
39
+ */
40
+ // Core schema types and validation
41
+ export { ValidationStepSchema, ValidationPhaseSchema, ValidationConfigSchema, CachingStrategySchema, OutputFormatSchema, GitConfigSchema, OutputConfigSchema, 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';
46
+ // Config loading
47
+ export { CONFIG_FILE_NAMES, loadConfigFromFile, findAndLoadConfig, loadConfigWithFallback, } from './loader.js';
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Configuration Loader
3
+ *
4
+ * Loads and resolves vibe-validate configuration from files,
5
+ * including preset resolution and config extension.
6
+ */
7
+ import { type VibeValidateConfig } from './schema.js';
8
+ /**
9
+ * Configuration file names to search for (in order)
10
+ */
11
+ export declare const CONFIG_FILE_NAMES: string[];
12
+ /**
13
+ * Load configuration from a file path
14
+ *
15
+ * @param configPath - Absolute path to config file
16
+ * @returns Loaded and validated configuration
17
+ * @throws Error if file cannot be loaded or is invalid
18
+ */
19
+ export declare function loadConfigFromFile(configPath: string): Promise<VibeValidateConfig>;
20
+ /**
21
+ * Find and load configuration from current working directory
22
+ *
23
+ * Searches for config files in order and loads the first one found.
24
+ *
25
+ * @param cwd - Working directory to search (default: process.cwd())
26
+ * @returns Loaded configuration or undefined if no config found
27
+ */
28
+ export declare function findAndLoadConfig(cwd?: string): Promise<VibeValidateConfig | undefined>;
29
+ /**
30
+ * Load configuration with fallback to default preset
31
+ *
32
+ * Searches for config file, falls back to typescript-library preset if not found.
33
+ *
34
+ * @param cwd - Working directory (default: process.cwd())
35
+ * @returns Configuration (user config or default preset)
36
+ */
37
+ export declare function loadConfigWithFallback(cwd?: string): Promise<VibeValidateConfig>;
38
+ //# sourceMappingURL=loader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,EAAkB,KAAK,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAItE;;GAEG;AACH,eAAO,MAAM,iBAAiB,UAO7B,CAAC;AAEF;;;;;;GAMG;AACH,wBAAsB,kBAAkB,CACtC,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,kBAAkB,CAAC,CAiC7B;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 ADDED
@@ -0,0 +1,147 @@
1
+ /**
2
+ * Configuration Loader
3
+ *
4
+ * Loads and resolves vibe-validate configuration from files,
5
+ * including preset resolution and config extension.
6
+ */
7
+ import { resolve, dirname } from 'path';
8
+ import { readFileSync } from 'fs';
9
+ import { pathToFileURL } from 'url';
10
+ import { validateConfig } from './schema.js';
11
+ import { mergeConfig } from './define-config.js';
12
+ import { getPreset } from './presets/index.js';
13
+ /**
14
+ * Configuration file names to search for (in order)
15
+ */
16
+ export const CONFIG_FILE_NAMES = [
17
+ 'vibe-validate.config.ts',
18
+ 'vibe-validate.config.mts',
19
+ 'vibe-validate.config.js',
20
+ 'vibe-validate.config.mjs',
21
+ 'vibe-validate.config.json',
22
+ '.vibe-validate.json',
23
+ ];
24
+ /**
25
+ * Load configuration from a file path
26
+ *
27
+ * @param configPath - Absolute path to config file
28
+ * @returns Loaded and validated configuration
29
+ * @throws Error if file cannot be loaded or is invalid
30
+ */
31
+ export async function loadConfigFromFile(configPath) {
32
+ const absolutePath = resolve(configPath);
33
+ // JSON files
34
+ if (absolutePath.endsWith('.json')) {
35
+ const content = readFileSync(absolutePath, 'utf-8');
36
+ const raw = JSON.parse(content);
37
+ return await resolveConfig(raw, dirname(absolutePath));
38
+ }
39
+ // TypeScript files - use tsx for loading
40
+ if (absolutePath.endsWith('.ts') || absolutePath.endsWith('.mts')) {
41
+ // Use tsx to load TypeScript files
42
+ const { register } = await import('tsx/esm/api');
43
+ const unregister = register();
44
+ try {
45
+ // Add cache-busting timestamp to force fresh load
46
+ const fileUrl = pathToFileURL(absolutePath).href + '?t=' + Date.now();
47
+ const module = await import(fileUrl);
48
+ const raw = module.default || module;
49
+ return await resolveConfig(raw, dirname(absolutePath));
50
+ }
51
+ finally {
52
+ unregister();
53
+ }
54
+ }
55
+ // JavaScript files (ES modules)
56
+ const fileUrl = pathToFileURL(absolutePath).href;
57
+ const module = await import(fileUrl);
58
+ const raw = module.default || module;
59
+ return await resolveConfig(raw, dirname(absolutePath));
60
+ }
61
+ /**
62
+ * Find and load configuration from current working directory
63
+ *
64
+ * Searches for config files in order and loads the first one found.
65
+ *
66
+ * @param cwd - Working directory to search (default: process.cwd())
67
+ * @returns Loaded configuration or undefined if no config found
68
+ */
69
+ export async function findAndLoadConfig(cwd = process.cwd()) {
70
+ for (const fileName of CONFIG_FILE_NAMES) {
71
+ const configPath = resolve(cwd, fileName);
72
+ try {
73
+ return await loadConfigFromFile(configPath);
74
+ }
75
+ catch (err) {
76
+ // File doesn't exist or can't be loaded - try next
77
+ continue;
78
+ }
79
+ }
80
+ return undefined;
81
+ }
82
+ /**
83
+ * Resolve configuration with preset and extends support
84
+ *
85
+ * @param raw - Raw configuration object
86
+ * @param basePath - Base directory for resolving extends paths
87
+ * @returns Resolved and validated configuration
88
+ */
89
+ async function resolveConfig(raw, basePath) {
90
+ if (typeof raw !== 'object' || raw === null) {
91
+ throw new Error('Configuration must be an object');
92
+ }
93
+ const config = raw;
94
+ // Step 1: Resolve preset if specified
95
+ let baseConfig;
96
+ if (config.preset) {
97
+ baseConfig = getPreset(config.preset);
98
+ if (!baseConfig) {
99
+ throw new Error(`Unknown preset: ${config.preset}`);
100
+ }
101
+ }
102
+ // Step 2: Resolve extends if specified
103
+ if (config.extends) {
104
+ // Check if extends is a preset name or a file path
105
+ const extendedConfig = getPreset(config.extends);
106
+ if (extendedConfig) {
107
+ // It's a preset name
108
+ baseConfig = baseConfig
109
+ ? mergeConfig(baseConfig, extendedConfig)
110
+ : extendedConfig;
111
+ }
112
+ else {
113
+ // It's a file path - resolve relative to basePath
114
+ const extendsPath = resolve(basePath, config.extends);
115
+ const fileConfig = await loadConfigFromFile(extendsPath);
116
+ baseConfig = baseConfig
117
+ ? mergeConfig(baseConfig, fileConfig)
118
+ : fileConfig;
119
+ }
120
+ }
121
+ // Step 3: Merge user config with base
122
+ const finalConfig = baseConfig
123
+ ? mergeConfig(baseConfig, config)
124
+ : config;
125
+ // Step 4: Validate final configuration
126
+ return validateConfig(finalConfig);
127
+ }
128
+ /**
129
+ * Load configuration with fallback to default preset
130
+ *
131
+ * Searches for config file, falls back to typescript-library preset if not found.
132
+ *
133
+ * @param cwd - Working directory (default: process.cwd())
134
+ * @returns Configuration (user config or default preset)
135
+ */
136
+ export async function loadConfigWithFallback(cwd = process.cwd()) {
137
+ const config = await findAndLoadConfig(cwd);
138
+ if (config) {
139
+ return config;
140
+ }
141
+ // Fallback to default preset
142
+ const defaultPreset = getPreset('typescript-library');
143
+ if (!defaultPreset) {
144
+ throw new Error('Default preset not found');
145
+ }
146
+ return defaultPreset;
147
+ }
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Built-in Framework Presets
3
+ *
4
+ * Pre-configured validation setups for common TypeScript project types.
5
+ */
6
+ export { typescriptLibraryPreset } from './typescript-library.js';
7
+ export { typescriptNodejsPreset } from './typescript-nodejs.js';
8
+ export { typescriptReactPreset } from './typescript-react.js';
9
+ import type { VibeValidateConfig } from '../schema.js';
10
+ /**
11
+ * Map of preset name to configuration
12
+ */
13
+ export declare const PRESETS: Record<string, VibeValidateConfig>;
14
+ /**
15
+ * Get a preset by name
16
+ *
17
+ * @param name - Preset name
18
+ * @returns Preset configuration or undefined if not found
19
+ */
20
+ export declare function getPreset(name: string): VibeValidateConfig | undefined;
21
+ /**
22
+ * List all available preset names
23
+ *
24
+ * @returns Array of preset names
25
+ */
26
+ export declare function listPresets(): string[];
27
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/presets/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAE9D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAKvD;;GAEG;AACH,eAAO,MAAM,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAItD,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS,CAEtE;AAED;;;;GAIG;AACH,wBAAgB,WAAW,IAAI,MAAM,EAAE,CAEtC"}