@vibe-validate/config 0.17.0-rc4 → 0.17.1-rc.1

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/index.d.ts CHANGED
@@ -25,4 +25,5 @@ export { type ValidationStep, type ValidationPhase, type ValidationConfig, type
25
25
  export { CONFIG_FILE_NAME, loadConfigFromFile, findAndLoadConfig, } from './loader.js';
26
26
  export { GIT_DEFAULTS } from './constants.js';
27
27
  export { getRemoteBranch, getMainBranch, getRemoteOrigin } from './git-helpers.js';
28
+ export { createSafeValidator, createStrictValidator } from './schema-utils.js';
28
29
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
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,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,EACtB,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,oBAAoB,EACpB,yBAAyB,EACzB,6BAA6B,EAC7B,6BAA6B,EAC7B,sBAAsB,EACtB,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"}
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,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC5B,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,EACtB,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,oBAAoB,EACpB,yBAAyB,EACzB,6BAA6B,EAC7B,6BAA6B,EAC7B,sBAAsB,EACtB,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;AAGnF,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC"}
package/dist/index.js CHANGED
@@ -28,3 +28,5 @@ export { CONFIG_FILE_NAME, loadConfigFromFile, findAndLoadConfig, } from './load
28
28
  // Git configuration constants and helpers
29
29
  export { GIT_DEFAULTS } from './constants.js';
30
30
  export { getRemoteBranch, getMainBranch, getRemoteOrigin } from './git-helpers.js';
31
+ // Shared schema utilities (foundational - no dependencies)
32
+ export { createSafeValidator, createStrictValidator } from './schema-utils.js';
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Zod Schema Utilities
3
+ *
4
+ * Shared validation helpers for consistent error handling across packages.
5
+ *
6
+ * @packageDocumentation
7
+ */
8
+ import type { z } from 'zod';
9
+ /**
10
+ * Create a type-safe validator function from a Zod schema
11
+ *
12
+ * Provides consistent error formatting across all schema validations.
13
+ * Error messages include full path (e.g., "phases.0.steps.2.command: Required")
14
+ *
15
+ * @param schema - Zod schema to validate against
16
+ * @returns Safe validation function with success/error union type
17
+ *
18
+ * @example
19
+ * ```typescript
20
+ * const safeValidateResult = createSafeValidator(ValidationResultSchema);
21
+ *
22
+ * const result = safeValidateResult(data);
23
+ * if (result.success) {
24
+ * console.log(result.data); // Typed as ValidationResult
25
+ * } else {
26
+ * console.error(result.errors); // Array of formatted error messages
27
+ * }
28
+ * ```
29
+ */
30
+ export declare function createSafeValidator<T extends z.ZodType>(schema: T): (data: unknown) => {
31
+ success: true;
32
+ data: z.infer<T>;
33
+ } | {
34
+ success: false;
35
+ errors: string[];
36
+ };
37
+ /**
38
+ * Create a strict validator function from a Zod schema
39
+ *
40
+ * Throws on validation failure (useful when invalid data is a critical error).
41
+ *
42
+ * @param schema - Zod schema to validate against
43
+ * @returns Strict validation function that throws on error
44
+ *
45
+ * @example
46
+ * ```typescript
47
+ * const validateResult = createStrictValidator(ValidationResultSchema);
48
+ *
49
+ * try {
50
+ * const result = validateResult(data); // Typed as ValidationResult
51
+ * } catch (error) {
52
+ * console.error('Invalid data:', error);
53
+ * }
54
+ * ```
55
+ */
56
+ export declare function createStrictValidator<T extends z.ZodType>(schema: T): (data: unknown) => z.infer<T>;
57
+ //# sourceMappingURL=schema-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-utils.d.ts","sourceRoot":"","sources":["../src/schema-utils.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC,IACnC,MAAM,OAAO,KACtC;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;CAAE,GACnC;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CAezC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC,IACzC,MAAM,OAAO,KAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAGpD"}
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Zod Schema Utilities
3
+ *
4
+ * Shared validation helpers for consistent error handling across packages.
5
+ *
6
+ * @packageDocumentation
7
+ */
8
+ /**
9
+ * Create a type-safe validator function from a Zod schema
10
+ *
11
+ * Provides consistent error formatting across all schema validations.
12
+ * Error messages include full path (e.g., "phases.0.steps.2.command: Required")
13
+ *
14
+ * @param schema - Zod schema to validate against
15
+ * @returns Safe validation function with success/error union type
16
+ *
17
+ * @example
18
+ * ```typescript
19
+ * const safeValidateResult = createSafeValidator(ValidationResultSchema);
20
+ *
21
+ * const result = safeValidateResult(data);
22
+ * if (result.success) {
23
+ * console.log(result.data); // Typed as ValidationResult
24
+ * } else {
25
+ * console.error(result.errors); // Array of formatted error messages
26
+ * }
27
+ * ```
28
+ */
29
+ export function createSafeValidator(schema) {
30
+ return function safeValidate(data) {
31
+ const result = schema.safeParse(data);
32
+ if (result.success) {
33
+ return { success: true, data: result.data };
34
+ }
35
+ // Extract error messages with full path
36
+ const errors = result.error.errors.map(err => {
37
+ const path = err.path.join('.');
38
+ return path ? `${path}: ${err.message}` : err.message;
39
+ });
40
+ return { success: false, errors };
41
+ };
42
+ }
43
+ /**
44
+ * Create a strict validator function from a Zod schema
45
+ *
46
+ * Throws on validation failure (useful when invalid data is a critical error).
47
+ *
48
+ * @param schema - Zod schema to validate against
49
+ * @returns Strict validation function that throws on error
50
+ *
51
+ * @example
52
+ * ```typescript
53
+ * const validateResult = createStrictValidator(ValidationResultSchema);
54
+ *
55
+ * try {
56
+ * const result = validateResult(data); // Typed as ValidationResult
57
+ * } catch (error) {
58
+ * console.error('Invalid data:', error);
59
+ * }
60
+ * ```
61
+ */
62
+ export function createStrictValidator(schema) {
63
+ return function validate(data) {
64
+ return schema.parse(data);
65
+ };
66
+ }
package/dist/schema.d.ts CHANGED
@@ -286,10 +286,20 @@ export type CIConfig = z.infer<typeof CIConfigSchema>;
286
286
  /**
287
287
  * Secret Scanning Configuration Schema
288
288
  */
289
- export declare const SecretScanningSchema: z.ZodEffects<z.ZodObject<{
289
+ export declare const SecretScanningSchema: z.ZodObject<{
290
290
  /** Enable secret scanning in pre-commit (default: true) */
291
291
  enabled: z.ZodDefault<z.ZodBoolean>;
292
- /** Command to run for secret scanning (required when enabled) */
292
+ /**
293
+ * Command to run for secret scanning (optional)
294
+ * - Explicit command: "gitleaks protect --staged --verbose"
295
+ * - Omit or "autodetect": Automatically detect and run available tools
296
+ *
297
+ * Default: autodetect (runs tools based on config file presence)
298
+ * - Checks for .gitleaks.toml/.gitleaksignore and .secretlintrc.json
299
+ * - Runs gitleaks if available and configured
300
+ * - Runs secretlint (via npx) if configured
301
+ * - Falls back to gitleaks or secretlint if no config files present
302
+ */
293
303
  scanCommand: z.ZodOptional<z.ZodString>;
294
304
  }, "strict", z.ZodTypeAny, {
295
305
  enabled: boolean;
@@ -297,12 +307,6 @@ export declare const SecretScanningSchema: z.ZodEffects<z.ZodObject<{
297
307
  }, {
298
308
  enabled?: boolean | undefined;
299
309
  scanCommand?: string | undefined;
300
- }>, {
301
- enabled: boolean;
302
- scanCommand?: string | undefined;
303
- }, {
304
- enabled?: boolean | undefined;
305
- scanCommand?: string | undefined;
306
310
  }>;
307
311
  export type SecretScanningConfig = z.infer<typeof SecretScanningSchema>;
308
312
  /**
@@ -316,10 +320,20 @@ export declare const HooksConfigSchema: z.ZodObject<{
316
320
  /** Custom pre-commit command (default: 'npx vibe-validate pre-commit') */
317
321
  command: z.ZodDefault<z.ZodString>;
318
322
  /** Secret scanning configuration (optional) */
319
- secretScanning: z.ZodOptional<z.ZodEffects<z.ZodObject<{
323
+ secretScanning: z.ZodOptional<z.ZodObject<{
320
324
  /** Enable secret scanning in pre-commit (default: true) */
321
325
  enabled: z.ZodDefault<z.ZodBoolean>;
322
- /** Command to run for secret scanning (required when enabled) */
326
+ /**
327
+ * Command to run for secret scanning (optional)
328
+ * - Explicit command: "gitleaks protect --staged --verbose"
329
+ * - Omit or "autodetect": Automatically detect and run available tools
330
+ *
331
+ * Default: autodetect (runs tools based on config file presence)
332
+ * - Checks for .gitleaks.toml/.gitleaksignore and .secretlintrc.json
333
+ * - Runs gitleaks if available and configured
334
+ * - Runs secretlint (via npx) if configured
335
+ * - Falls back to gitleaks or secretlint if no config files present
336
+ */
323
337
  scanCommand: z.ZodOptional<z.ZodString>;
324
338
  }, "strict", z.ZodTypeAny, {
325
339
  enabled: boolean;
@@ -327,12 +341,6 @@ export declare const HooksConfigSchema: z.ZodObject<{
327
341
  }, {
328
342
  enabled?: boolean | undefined;
329
343
  scanCommand?: string | undefined;
330
- }>, {
331
- enabled: boolean;
332
- scanCommand?: string | undefined;
333
- }, {
334
- enabled?: boolean | undefined;
335
- scanCommand?: string | undefined;
336
344
  }>>;
337
345
  }, "strict", z.ZodTypeAny, {
338
346
  command: string;
@@ -694,10 +702,20 @@ export declare const VibeValidateConfigSchema: z.ZodObject<{
694
702
  /** Custom pre-commit command (default: 'npx vibe-validate pre-commit') */
695
703
  command: z.ZodDefault<z.ZodString>;
696
704
  /** Secret scanning configuration (optional) */
697
- secretScanning: z.ZodOptional<z.ZodEffects<z.ZodObject<{
705
+ secretScanning: z.ZodOptional<z.ZodObject<{
698
706
  /** Enable secret scanning in pre-commit (default: true) */
699
707
  enabled: z.ZodDefault<z.ZodBoolean>;
700
- /** Command to run for secret scanning (required when enabled) */
708
+ /**
709
+ * Command to run for secret scanning (optional)
710
+ * - Explicit command: "gitleaks protect --staged --verbose"
711
+ * - Omit or "autodetect": Automatically detect and run available tools
712
+ *
713
+ * Default: autodetect (runs tools based on config file presence)
714
+ * - Checks for .gitleaks.toml/.gitleaksignore and .secretlintrc.json
715
+ * - Runs gitleaks if available and configured
716
+ * - Runs secretlint (via npx) if configured
717
+ * - Falls back to gitleaks or secretlint if no config files present
718
+ */
701
719
  scanCommand: z.ZodOptional<z.ZodString>;
702
720
  }, "strict", z.ZodTypeAny, {
703
721
  enabled: boolean;
@@ -705,12 +723,6 @@ export declare const VibeValidateConfigSchema: z.ZodObject<{
705
723
  }, {
706
724
  enabled?: boolean | undefined;
707
725
  scanCommand?: string | undefined;
708
- }>, {
709
- enabled: boolean;
710
- scanCommand?: string | undefined;
711
- }, {
712
- enabled?: boolean | undefined;
713
- scanCommand?: string | undefined;
714
726
  }>>;
715
727
  }, "strict", z.ZodTypeAny, {
716
728
  command: string;
@@ -998,20 +1010,138 @@ export type VibeValidateConfig = z.input<typeof VibeValidateConfigSchema>;
998
1010
  * @returns Validated configuration with defaults applied
999
1011
  * @throws ZodError if validation fails
1000
1012
  */
1001
- export declare function validateConfig(config: unknown): VibeValidateConfig;
1013
+ export declare const validateConfig: (data: unknown) => {
1014
+ validation: {
1015
+ failFast: boolean;
1016
+ phases: {
1017
+ name: string;
1018
+ timeout: number;
1019
+ parallel: boolean;
1020
+ steps: {
1021
+ name: string;
1022
+ command: string;
1023
+ description?: string | undefined;
1024
+ timeout?: number | undefined;
1025
+ continueOnError?: boolean | undefined;
1026
+ env?: Record<string, string> | undefined;
1027
+ cwd?: string | undefined;
1028
+ }[];
1029
+ failFast: boolean;
1030
+ }[];
1031
+ };
1032
+ git: {
1033
+ mainBranch: string;
1034
+ remoteOrigin: string;
1035
+ autoSync: boolean;
1036
+ warnIfBehind: boolean;
1037
+ };
1038
+ hooks: {
1039
+ preCommit: {
1040
+ command: string;
1041
+ enabled: boolean;
1042
+ secretScanning?: {
1043
+ enabled: boolean;
1044
+ scanCommand?: string | undefined;
1045
+ } | undefined;
1046
+ };
1047
+ };
1048
+ locking: {
1049
+ enabled: boolean;
1050
+ concurrencyScope: "directory" | "project";
1051
+ projectId?: string | undefined;
1052
+ };
1053
+ extractors: {
1054
+ builtins: {
1055
+ disable: string[];
1056
+ trust?: "full" | "sandbox" | undefined;
1057
+ };
1058
+ localPlugins: {
1059
+ disable: string[];
1060
+ trust?: "full" | "sandbox" | undefined;
1061
+ };
1062
+ external: {
1063
+ trust: "full" | "sandbox";
1064
+ package: string;
1065
+ }[];
1066
+ };
1067
+ developerFeedback: boolean;
1068
+ ci?: {
1069
+ failFast?: boolean | undefined;
1070
+ nodeVersions?: string[] | undefined;
1071
+ os?: string[] | undefined;
1072
+ coverage?: boolean | undefined;
1073
+ } | undefined;
1074
+ };
1002
1075
  /**
1003
1076
  * Safe validation function for VibeValidateConfig
1004
1077
  *
1005
- * NOTE: This duplicates the pattern from @vibe-validate/core's createSafeValidator.
1006
- * We can't import from core here due to circular dependency (core → config).
1007
- * This is an acceptable trade-off for a foundational package.
1008
- *
1009
1078
  * @param config - Configuration data to validate
1010
1079
  * @returns Validation result with success/error information
1011
1080
  */
1012
- export declare function safeValidateConfig(config: unknown): {
1081
+ export declare const safeValidateConfig: (data: unknown) => {
1013
1082
  success: true;
1014
- data: VibeValidateConfig;
1083
+ data: {
1084
+ validation: {
1085
+ failFast: boolean;
1086
+ phases: {
1087
+ name: string;
1088
+ timeout: number;
1089
+ parallel: boolean;
1090
+ steps: {
1091
+ name: string;
1092
+ command: string;
1093
+ description?: string | undefined;
1094
+ timeout?: number | undefined;
1095
+ continueOnError?: boolean | undefined;
1096
+ env?: Record<string, string> | undefined;
1097
+ cwd?: string | undefined;
1098
+ }[];
1099
+ failFast: boolean;
1100
+ }[];
1101
+ };
1102
+ git: {
1103
+ mainBranch: string;
1104
+ remoteOrigin: string;
1105
+ autoSync: boolean;
1106
+ warnIfBehind: boolean;
1107
+ };
1108
+ hooks: {
1109
+ preCommit: {
1110
+ command: string;
1111
+ enabled: boolean;
1112
+ secretScanning?: {
1113
+ enabled: boolean;
1114
+ scanCommand?: string | undefined;
1115
+ } | undefined;
1116
+ };
1117
+ };
1118
+ locking: {
1119
+ enabled: boolean;
1120
+ concurrencyScope: "directory" | "project";
1121
+ projectId?: string | undefined;
1122
+ };
1123
+ extractors: {
1124
+ builtins: {
1125
+ disable: string[];
1126
+ trust?: "full" | "sandbox" | undefined;
1127
+ };
1128
+ localPlugins: {
1129
+ disable: string[];
1130
+ trust?: "full" | "sandbox" | undefined;
1131
+ };
1132
+ external: {
1133
+ trust: "full" | "sandbox";
1134
+ package: string;
1135
+ }[];
1136
+ };
1137
+ developerFeedback: boolean;
1138
+ ci?: {
1139
+ failFast?: boolean | undefined;
1140
+ nodeVersions?: string[] | undefined;
1141
+ os?: string[] | undefined;
1142
+ coverage?: boolean | undefined;
1143
+ } | undefined;
1144
+ };
1015
1145
  } | {
1016
1146
  success: false;
1017
1147
  errors: string[];
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;;GAIG;AACH,eAAO,MAAM,oBAAoB;IAC/B,kEAAkE;;IAGlE,qDAAqD;;IAGrD,uEAAuE;;IAGvE,+EAA+E;;IAG/E,qDAAqD;;IAGrD,oDAAoD;;IAGpD,0FAA0F;;;;;;;;;;;;;;;;;;EAEjF,CAAC;AAEZ,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB;IAChC,wDAAwD;;IAGxD,iDAAiD;;IAGjD,qCAAqC;;QArCrC,kEAAkE;;QAGlE,qDAAqD;;QAGrD,uEAAuE;;QAGvE,+EAA+E;;QAG/E,qDAAqD;;QAGrD,oDAAoD;;QAGpD,0FAA0F;;;;;;;;;;;;;;;;;;;IAsB1F,q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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEM,CAAC;AAGZ,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E;;;;;;GAMG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAkD,CAAC;AAE9E;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAgD,CAAC"}
package/dist/schema.js CHANGED
@@ -5,6 +5,7 @@
5
5
  * Provides runtime validation and type safety for all configuration options.
6
6
  */
7
7
  import { z } from 'zod';
8
+ import { createSafeValidator, createStrictValidator } from './schema-utils.js';
8
9
  import { GIT_DEFAULTS } from './constants.js';
9
10
  /**
10
11
  * Validation Step Schema
@@ -86,15 +87,19 @@ export const CIConfigSchema = z.object({
86
87
  export const SecretScanningSchema = z.object({
87
88
  /** Enable secret scanning in pre-commit (default: true) */
88
89
  enabled: z.boolean().default(true),
89
- /** Command to run for secret scanning (required when enabled) */
90
+ /**
91
+ * Command to run for secret scanning (optional)
92
+ * - Explicit command: "gitleaks protect --staged --verbose"
93
+ * - Omit or "autodetect": Automatically detect and run available tools
94
+ *
95
+ * Default: autodetect (runs tools based on config file presence)
96
+ * - Checks for .gitleaks.toml/.gitleaksignore and .secretlintrc.json
97
+ * - Runs gitleaks if available and configured
98
+ * - Runs secretlint (via npx) if configured
99
+ * - Falls back to gitleaks or secretlint if no config files present
100
+ */
90
101
  scanCommand: z.string().min(1, 'scanCommand cannot be empty').optional(),
91
- }).strict().refine((data) => {
92
- // If enabled is true, scanCommand must be provided
93
- return !data.enabled || !!data.scanCommand;
94
- }, {
95
- message: 'scanCommand is required when secret scanning is enabled',
96
- path: ['scanCommand'],
97
- });
102
+ }).strict();
98
103
  /**
99
104
  * Hooks Configuration Schema
100
105
  */
@@ -253,28 +258,11 @@ export const VibeValidateConfigSchema = z.object({
253
258
  * @returns Validated configuration with defaults applied
254
259
  * @throws ZodError if validation fails
255
260
  */
256
- export function validateConfig(config) {
257
- return VibeValidateConfigSchema.parse(config);
258
- }
261
+ export const validateConfig = createStrictValidator(VibeValidateConfigSchema);
259
262
  /**
260
263
  * Safe validation function for VibeValidateConfig
261
264
  *
262
- * NOTE: This duplicates the pattern from @vibe-validate/core's createSafeValidator.
263
- * We can't import from core here due to circular dependency (core → config).
264
- * This is an acceptable trade-off for a foundational package.
265
- *
266
265
  * @param config - Configuration data to validate
267
266
  * @returns Validation result with success/error information
268
267
  */
269
- export function safeValidateConfig(config) {
270
- const result = VibeValidateConfigSchema.safeParse(config);
271
- if (result.success) {
272
- return { success: true, data: result.data };
273
- }
274
- // Extract error messages with full path
275
- const errors = result.error.errors.map(err => {
276
- const path = err.path.join('.');
277
- return path ? `${path}: ${err.message}` : err.message;
278
- });
279
- return { success: false, errors };
280
- }
268
+ export const safeValidateConfig = createSafeValidator(VibeValidateConfigSchema);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibe-validate/config",
3
- "version": "0.17.0-rc4",
3
+ "version": "0.17.1-rc.1",
4
4
  "description": "Configuration system for vibe-validate with TypeScript-first design and config templates",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",