@vibe-validate/config 0.16.1 → 0.17.0-rc.10
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/config.schema.json +90 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/schema-utils.d.ts +57 -0
- package/dist/schema-utils.d.ts.map +1 -0
- package/dist/schema-utils.js +66 -0
- package/dist/schema.d.ts +406 -35
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +89 -28
- package/package.json +1 -1
package/config.schema.json
CHANGED
|
@@ -210,6 +210,96 @@
|
|
|
210
210
|
"concurrencyScope": "directory"
|
|
211
211
|
}
|
|
212
212
|
},
|
|
213
|
+
"extractors": {
|
|
214
|
+
"type": "object",
|
|
215
|
+
"properties": {
|
|
216
|
+
"builtins": {
|
|
217
|
+
"type": "object",
|
|
218
|
+
"properties": {
|
|
219
|
+
"trust": {
|
|
220
|
+
"type": "string",
|
|
221
|
+
"enum": [
|
|
222
|
+
"full",
|
|
223
|
+
"sandbox"
|
|
224
|
+
]
|
|
225
|
+
},
|
|
226
|
+
"disable": {
|
|
227
|
+
"type": "array",
|
|
228
|
+
"items": {
|
|
229
|
+
"type": "string"
|
|
230
|
+
},
|
|
231
|
+
"default": []
|
|
232
|
+
}
|
|
233
|
+
},
|
|
234
|
+
"additionalProperties": false,
|
|
235
|
+
"default": {
|
|
236
|
+
"trust": "full",
|
|
237
|
+
"disable": []
|
|
238
|
+
}
|
|
239
|
+
},
|
|
240
|
+
"localPlugins": {
|
|
241
|
+
"type": "object",
|
|
242
|
+
"properties": {
|
|
243
|
+
"trust": {
|
|
244
|
+
"type": "string",
|
|
245
|
+
"enum": [
|
|
246
|
+
"full",
|
|
247
|
+
"sandbox"
|
|
248
|
+
]
|
|
249
|
+
},
|
|
250
|
+
"disable": {
|
|
251
|
+
"type": "array",
|
|
252
|
+
"items": {
|
|
253
|
+
"type": "string"
|
|
254
|
+
},
|
|
255
|
+
"default": []
|
|
256
|
+
}
|
|
257
|
+
},
|
|
258
|
+
"additionalProperties": false,
|
|
259
|
+
"default": {
|
|
260
|
+
"trust": "sandbox",
|
|
261
|
+
"disable": []
|
|
262
|
+
}
|
|
263
|
+
},
|
|
264
|
+
"external": {
|
|
265
|
+
"type": "array",
|
|
266
|
+
"items": {
|
|
267
|
+
"type": "object",
|
|
268
|
+
"properties": {
|
|
269
|
+
"package": {
|
|
270
|
+
"type": "string",
|
|
271
|
+
"minLength": 1
|
|
272
|
+
},
|
|
273
|
+
"trust": {
|
|
274
|
+
"type": "string",
|
|
275
|
+
"enum": [
|
|
276
|
+
"full",
|
|
277
|
+
"sandbox"
|
|
278
|
+
],
|
|
279
|
+
"default": "sandbox"
|
|
280
|
+
}
|
|
281
|
+
},
|
|
282
|
+
"required": [
|
|
283
|
+
"package"
|
|
284
|
+
],
|
|
285
|
+
"additionalProperties": false
|
|
286
|
+
},
|
|
287
|
+
"default": []
|
|
288
|
+
}
|
|
289
|
+
},
|
|
290
|
+
"additionalProperties": false,
|
|
291
|
+
"default": {
|
|
292
|
+
"builtins": {
|
|
293
|
+
"trust": "full",
|
|
294
|
+
"disable": []
|
|
295
|
+
},
|
|
296
|
+
"localPlugins": {
|
|
297
|
+
"trust": "sandbox",
|
|
298
|
+
"disable": []
|
|
299
|
+
},
|
|
300
|
+
"external": []
|
|
301
|
+
}
|
|
302
|
+
},
|
|
213
303
|
"developerFeedback": {
|
|
214
304
|
"type": "boolean",
|
|
215
305
|
"default": false
|
package/dist/index.d.ts
CHANGED
|
@@ -21,8 +21,9 @@
|
|
|
21
21
|
* command: tsc --noEmit
|
|
22
22
|
* ```
|
|
23
23
|
*/
|
|
24
|
-
export { type ValidationStep, type ValidationPhase, type ValidationConfig, type GitConfig, type CIConfig, type HooksConfig, type SecretScanningConfig, type VibeValidateConfig, ValidationStepSchema, ValidationPhaseSchema, ValidationConfigSchema, GitConfigSchema, CIConfigSchema, HooksConfigSchema, SecretScanningSchema, VibeValidateConfigSchema, validateConfig, safeValidateConfig, } from './schema.js';
|
|
24
|
+
export { type ValidationStep, type ValidationPhase, type ValidationConfig, type GitConfig, type CIConfig, type HooksConfig, type SecretScanningConfig, type ExtractorTrustLevel, type ExtractorCategoryConfig, type ExternalExtractorConfig, type ExtractorsConfig, type VibeValidateConfig, ValidationStepSchema, ValidationPhaseSchema, ValidationConfigSchema, GitConfigSchema, CIConfigSchema, HooksConfigSchema, SecretScanningSchema, ExtractorTrustLevelSchema, ExtractorCategoryConfigSchema, ExternalExtractorConfigSchema, ExtractorsConfigSchema, VibeValidateConfigSchema, validateConfig, safeValidateConfig, } from './schema.js';
|
|
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
|
package/dist/index.d.ts.map
CHANGED
|
@@ -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,kBAAkB,EACvB,oBAAoB,EACpB,qBAAqB,EACrB,sBAAsB,EACtB,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,oBAAoB,EACpB,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
|
@@ -22,9 +22,11 @@
|
|
|
22
22
|
* ```
|
|
23
23
|
*/
|
|
24
24
|
// Core schema types and validation
|
|
25
|
-
export { ValidationStepSchema, ValidationPhaseSchema, ValidationConfigSchema, GitConfigSchema, CIConfigSchema, HooksConfigSchema, SecretScanningSchema, VibeValidateConfigSchema, validateConfig, safeValidateConfig, } from './schema.js';
|
|
25
|
+
export { ValidationStepSchema, ValidationPhaseSchema, ValidationConfigSchema, GitConfigSchema, CIConfigSchema, HooksConfigSchema, SecretScanningSchema, ExtractorTrustLevelSchema, ExtractorCategoryConfigSchema, ExternalExtractorConfigSchema, ExtractorsConfigSchema, VibeValidateConfigSchema, validateConfig, safeValidateConfig, } from './schema.js';
|
|
26
26
|
// Config loading
|
|
27
27
|
export { CONFIG_FILE_NAME, loadConfigFromFile, findAndLoadConfig, } from './loader.js';
|
|
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
|
@@ -23,7 +23,7 @@ export declare const ValidationStepSchema: z.ZodObject<{
|
|
|
23
23
|
continueOnError: z.ZodOptional<z.ZodBoolean>;
|
|
24
24
|
/** Optional: Environment variables for this step */
|
|
25
25
|
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
26
|
-
/** Optional: Working directory for this step (default:
|
|
26
|
+
/** Optional: Working directory for this step, relative to git root (default: git root) */
|
|
27
27
|
cwd: z.ZodOptional<z.ZodString>;
|
|
28
28
|
}, "strict", z.ZodTypeAny, {
|
|
29
29
|
name: string;
|
|
@@ -68,7 +68,7 @@ export declare const ValidationPhaseSchema: z.ZodObject<{
|
|
|
68
68
|
continueOnError: z.ZodOptional<z.ZodBoolean>;
|
|
69
69
|
/** Optional: Environment variables for this step */
|
|
70
70
|
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
71
|
-
/** Optional: Working directory for this step (default:
|
|
71
|
+
/** Optional: Working directory for this step, relative to git root (default: git root) */
|
|
72
72
|
cwd: z.ZodOptional<z.ZodString>;
|
|
73
73
|
}, "strict", z.ZodTypeAny, {
|
|
74
74
|
name: string;
|
|
@@ -145,7 +145,7 @@ export declare const ValidationConfigSchema: z.ZodObject<{
|
|
|
145
145
|
continueOnError: z.ZodOptional<z.ZodBoolean>;
|
|
146
146
|
/** Optional: Environment variables for this step */
|
|
147
147
|
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
148
|
-
/** Optional: Working directory for this step (default:
|
|
148
|
+
/** Optional: Working directory for this step, relative to git root (default: git root) */
|
|
149
149
|
cwd: z.ZodOptional<z.ZodString>;
|
|
150
150
|
}, "strict", z.ZodTypeAny, {
|
|
151
151
|
name: string;
|
|
@@ -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.
|
|
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
|
-
/**
|
|
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.
|
|
323
|
+
secretScanning: z.ZodOptional<z.ZodObject<{
|
|
320
324
|
/** Enable secret scanning in pre-commit (default: true) */
|
|
321
325
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
322
|
-
/**
|
|
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;
|
|
@@ -399,6 +407,133 @@ export declare const LockingConfigSchema: z.ZodObject<{
|
|
|
399
407
|
projectId?: string | undefined;
|
|
400
408
|
}>;
|
|
401
409
|
export type LockingConfig = z.infer<typeof LockingConfigSchema>;
|
|
410
|
+
/**
|
|
411
|
+
* Extractor Trust Level
|
|
412
|
+
*
|
|
413
|
+
* Controls security sandbox behavior for extractors:
|
|
414
|
+
* - 'full': Run with full Node.js access (trusted code)
|
|
415
|
+
* - 'sandbox': Run in isolated V8 context with limited API access (untrusted code)
|
|
416
|
+
*/
|
|
417
|
+
export declare const ExtractorTrustLevelSchema: z.ZodEnum<["full", "sandbox"]>;
|
|
418
|
+
export type ExtractorTrustLevel = z.infer<typeof ExtractorTrustLevelSchema>;
|
|
419
|
+
/**
|
|
420
|
+
* Extractor Category Config Schema
|
|
421
|
+
*
|
|
422
|
+
* Shared configuration for built-in and local plugin extractors.
|
|
423
|
+
*/
|
|
424
|
+
export declare const ExtractorCategoryConfigSchema: z.ZodObject<{
|
|
425
|
+
/** Trust level for extractors in this category (default varies by category) */
|
|
426
|
+
trust: z.ZodOptional<z.ZodEnum<["full", "sandbox"]>>;
|
|
427
|
+
/** List of extractor names to disable (default: []) */
|
|
428
|
+
disable: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
|
|
429
|
+
}, "strict", z.ZodTypeAny, {
|
|
430
|
+
disable: string[];
|
|
431
|
+
trust?: "full" | "sandbox" | undefined;
|
|
432
|
+
}, {
|
|
433
|
+
trust?: "full" | "sandbox" | undefined;
|
|
434
|
+
disable?: string[] | undefined;
|
|
435
|
+
}>;
|
|
436
|
+
export type ExtractorCategoryConfig = z.infer<typeof ExtractorCategoryConfigSchema>;
|
|
437
|
+
/**
|
|
438
|
+
* External Extractor Config Schema
|
|
439
|
+
*
|
|
440
|
+
* Configuration for an explicit npm package extractor.
|
|
441
|
+
*/
|
|
442
|
+
export declare const ExternalExtractorConfigSchema: z.ZodObject<{
|
|
443
|
+
/** npm package name (e.g., '@my-org/vibe-validate-plugin-gradle') */
|
|
444
|
+
package: z.ZodString;
|
|
445
|
+
/** Trust level (default: 'sandbox') */
|
|
446
|
+
trust: z.ZodDefault<z.ZodOptional<z.ZodEnum<["full", "sandbox"]>>>;
|
|
447
|
+
}, "strict", z.ZodTypeAny, {
|
|
448
|
+
trust: "full" | "sandbox";
|
|
449
|
+
package: string;
|
|
450
|
+
}, {
|
|
451
|
+
package: string;
|
|
452
|
+
trust?: "full" | "sandbox" | undefined;
|
|
453
|
+
}>;
|
|
454
|
+
export type ExternalExtractorConfig = z.infer<typeof ExternalExtractorConfigSchema>;
|
|
455
|
+
/**
|
|
456
|
+
* Extractors Configuration Schema
|
|
457
|
+
*
|
|
458
|
+
* Controls extractor plugin loading, trust levels, and selective disabling.
|
|
459
|
+
*/
|
|
460
|
+
export declare const ExtractorsConfigSchema: z.ZodObject<{
|
|
461
|
+
/**
|
|
462
|
+
* Built-in extractors configuration
|
|
463
|
+
* Default: { trust: 'full', disable: [] }
|
|
464
|
+
*/
|
|
465
|
+
builtins: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
466
|
+
/** Trust level for extractors in this category (default varies by category) */
|
|
467
|
+
trust: z.ZodOptional<z.ZodEnum<["full", "sandbox"]>>;
|
|
468
|
+
/** List of extractor names to disable (default: []) */
|
|
469
|
+
disable: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
|
|
470
|
+
}, "strict", z.ZodTypeAny, {
|
|
471
|
+
disable: string[];
|
|
472
|
+
trust?: "full" | "sandbox" | undefined;
|
|
473
|
+
}, {
|
|
474
|
+
trust?: "full" | "sandbox" | undefined;
|
|
475
|
+
disable?: string[] | undefined;
|
|
476
|
+
}>>>;
|
|
477
|
+
/**
|
|
478
|
+
* Local plugins configuration (auto-discovered from vibe-validate-local-plugins/)
|
|
479
|
+
* Default: { trust: 'sandbox', disable: [] }
|
|
480
|
+
*/
|
|
481
|
+
localPlugins: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
482
|
+
/** Trust level for extractors in this category (default varies by category) */
|
|
483
|
+
trust: z.ZodOptional<z.ZodEnum<["full", "sandbox"]>>;
|
|
484
|
+
/** List of extractor names to disable (default: []) */
|
|
485
|
+
disable: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
|
|
486
|
+
}, "strict", z.ZodTypeAny, {
|
|
487
|
+
disable: string[];
|
|
488
|
+
trust?: "full" | "sandbox" | undefined;
|
|
489
|
+
}, {
|
|
490
|
+
trust?: "full" | "sandbox" | undefined;
|
|
491
|
+
disable?: string[] | undefined;
|
|
492
|
+
}>>>;
|
|
493
|
+
/**
|
|
494
|
+
* External npm package extractors (explicit registration required)
|
|
495
|
+
* Default: []
|
|
496
|
+
*/
|
|
497
|
+
external: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
498
|
+
/** npm package name (e.g., '@my-org/vibe-validate-plugin-gradle') */
|
|
499
|
+
package: z.ZodString;
|
|
500
|
+
/** Trust level (default: 'sandbox') */
|
|
501
|
+
trust: z.ZodDefault<z.ZodOptional<z.ZodEnum<["full", "sandbox"]>>>;
|
|
502
|
+
}, "strict", z.ZodTypeAny, {
|
|
503
|
+
trust: "full" | "sandbox";
|
|
504
|
+
package: string;
|
|
505
|
+
}, {
|
|
506
|
+
package: string;
|
|
507
|
+
trust?: "full" | "sandbox" | undefined;
|
|
508
|
+
}>, "many">>>;
|
|
509
|
+
}, "strict", z.ZodTypeAny, {
|
|
510
|
+
builtins: {
|
|
511
|
+
disable: string[];
|
|
512
|
+
trust?: "full" | "sandbox" | undefined;
|
|
513
|
+
};
|
|
514
|
+
localPlugins: {
|
|
515
|
+
disable: string[];
|
|
516
|
+
trust?: "full" | "sandbox" | undefined;
|
|
517
|
+
};
|
|
518
|
+
external: {
|
|
519
|
+
trust: "full" | "sandbox";
|
|
520
|
+
package: string;
|
|
521
|
+
}[];
|
|
522
|
+
}, {
|
|
523
|
+
builtins?: {
|
|
524
|
+
trust?: "full" | "sandbox" | undefined;
|
|
525
|
+
disable?: string[] | undefined;
|
|
526
|
+
} | undefined;
|
|
527
|
+
localPlugins?: {
|
|
528
|
+
trust?: "full" | "sandbox" | undefined;
|
|
529
|
+
disable?: string[] | undefined;
|
|
530
|
+
} | undefined;
|
|
531
|
+
external?: {
|
|
532
|
+
package: string;
|
|
533
|
+
trust?: "full" | "sandbox" | undefined;
|
|
534
|
+
}[] | undefined;
|
|
535
|
+
}>;
|
|
536
|
+
export type ExtractorsConfig = z.infer<typeof ExtractorsConfigSchema>;
|
|
402
537
|
/**
|
|
403
538
|
* Full Configuration Schema
|
|
404
539
|
*
|
|
@@ -427,7 +562,7 @@ export declare const VibeValidateConfigSchema: z.ZodObject<{
|
|
|
427
562
|
continueOnError: z.ZodOptional<z.ZodBoolean>;
|
|
428
563
|
/** Optional: Environment variables for this step */
|
|
429
564
|
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
430
|
-
/** Optional: Working directory for this step (default:
|
|
565
|
+
/** Optional: Working directory for this step, relative to git root (default: git root) */
|
|
431
566
|
cwd: z.ZodOptional<z.ZodString>;
|
|
432
567
|
}, "strict", z.ZodTypeAny, {
|
|
433
568
|
name: string;
|
|
@@ -567,10 +702,20 @@ export declare const VibeValidateConfigSchema: z.ZodObject<{
|
|
|
567
702
|
/** Custom pre-commit command (default: 'npx vibe-validate pre-commit') */
|
|
568
703
|
command: z.ZodDefault<z.ZodString>;
|
|
569
704
|
/** Secret scanning configuration (optional) */
|
|
570
|
-
secretScanning: z.ZodOptional<z.
|
|
705
|
+
secretScanning: z.ZodOptional<z.ZodObject<{
|
|
571
706
|
/** Enable secret scanning in pre-commit (default: true) */
|
|
572
707
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
573
|
-
/**
|
|
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
|
+
*/
|
|
574
719
|
scanCommand: z.ZodOptional<z.ZodString>;
|
|
575
720
|
}, "strict", z.ZodTypeAny, {
|
|
576
721
|
enabled: boolean;
|
|
@@ -578,12 +723,6 @@ export declare const VibeValidateConfigSchema: z.ZodObject<{
|
|
|
578
723
|
}, {
|
|
579
724
|
enabled?: boolean | undefined;
|
|
580
725
|
scanCommand?: string | undefined;
|
|
581
|
-
}>, {
|
|
582
|
-
enabled: boolean;
|
|
583
|
-
scanCommand?: string | undefined;
|
|
584
|
-
}, {
|
|
585
|
-
enabled?: boolean | undefined;
|
|
586
|
-
scanCommand?: string | undefined;
|
|
587
726
|
}>>;
|
|
588
727
|
}, "strict", z.ZodTypeAny, {
|
|
589
728
|
command: string;
|
|
@@ -644,6 +783,92 @@ export declare const VibeValidateConfigSchema: z.ZodObject<{
|
|
|
644
783
|
concurrencyScope?: "directory" | "project" | undefined;
|
|
645
784
|
projectId?: string | undefined;
|
|
646
785
|
}>>>;
|
|
786
|
+
/**
|
|
787
|
+
* Extractor plugins configuration (optional)
|
|
788
|
+
*
|
|
789
|
+
* Controls trust levels and selective disabling for extractors:
|
|
790
|
+
* - Built-in extractors (shipped with vibe-validate)
|
|
791
|
+
* - Local plugins (auto-discovered from vibe-validate-local-plugins/)
|
|
792
|
+
* - External npm packages (explicit registration required)
|
|
793
|
+
*
|
|
794
|
+
* Default: { builtins: { trust: 'full', disable: [] }, localPlugins: { trust: 'sandbox', disable: [] }, external: [] }
|
|
795
|
+
*/
|
|
796
|
+
extractors: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
797
|
+
/**
|
|
798
|
+
* Built-in extractors configuration
|
|
799
|
+
* Default: { trust: 'full', disable: [] }
|
|
800
|
+
*/
|
|
801
|
+
builtins: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
802
|
+
/** Trust level for extractors in this category (default varies by category) */
|
|
803
|
+
trust: z.ZodOptional<z.ZodEnum<["full", "sandbox"]>>;
|
|
804
|
+
/** List of extractor names to disable (default: []) */
|
|
805
|
+
disable: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
|
|
806
|
+
}, "strict", z.ZodTypeAny, {
|
|
807
|
+
disable: string[];
|
|
808
|
+
trust?: "full" | "sandbox" | undefined;
|
|
809
|
+
}, {
|
|
810
|
+
trust?: "full" | "sandbox" | undefined;
|
|
811
|
+
disable?: string[] | undefined;
|
|
812
|
+
}>>>;
|
|
813
|
+
/**
|
|
814
|
+
* Local plugins configuration (auto-discovered from vibe-validate-local-plugins/)
|
|
815
|
+
* Default: { trust: 'sandbox', disable: [] }
|
|
816
|
+
*/
|
|
817
|
+
localPlugins: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
818
|
+
/** Trust level for extractors in this category (default varies by category) */
|
|
819
|
+
trust: z.ZodOptional<z.ZodEnum<["full", "sandbox"]>>;
|
|
820
|
+
/** List of extractor names to disable (default: []) */
|
|
821
|
+
disable: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
|
|
822
|
+
}, "strict", z.ZodTypeAny, {
|
|
823
|
+
disable: string[];
|
|
824
|
+
trust?: "full" | "sandbox" | undefined;
|
|
825
|
+
}, {
|
|
826
|
+
trust?: "full" | "sandbox" | undefined;
|
|
827
|
+
disable?: string[] | undefined;
|
|
828
|
+
}>>>;
|
|
829
|
+
/**
|
|
830
|
+
* External npm package extractors (explicit registration required)
|
|
831
|
+
* Default: []
|
|
832
|
+
*/
|
|
833
|
+
external: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
834
|
+
/** npm package name (e.g., '@my-org/vibe-validate-plugin-gradle') */
|
|
835
|
+
package: z.ZodString;
|
|
836
|
+
/** Trust level (default: 'sandbox') */
|
|
837
|
+
trust: z.ZodDefault<z.ZodOptional<z.ZodEnum<["full", "sandbox"]>>>;
|
|
838
|
+
}, "strict", z.ZodTypeAny, {
|
|
839
|
+
trust: "full" | "sandbox";
|
|
840
|
+
package: string;
|
|
841
|
+
}, {
|
|
842
|
+
package: string;
|
|
843
|
+
trust?: "full" | "sandbox" | undefined;
|
|
844
|
+
}>, "many">>>;
|
|
845
|
+
}, "strict", z.ZodTypeAny, {
|
|
846
|
+
builtins: {
|
|
847
|
+
disable: string[];
|
|
848
|
+
trust?: "full" | "sandbox" | undefined;
|
|
849
|
+
};
|
|
850
|
+
localPlugins: {
|
|
851
|
+
disable: string[];
|
|
852
|
+
trust?: "full" | "sandbox" | undefined;
|
|
853
|
+
};
|
|
854
|
+
external: {
|
|
855
|
+
trust: "full" | "sandbox";
|
|
856
|
+
package: string;
|
|
857
|
+
}[];
|
|
858
|
+
}, {
|
|
859
|
+
builtins?: {
|
|
860
|
+
trust?: "full" | "sandbox" | undefined;
|
|
861
|
+
disable?: string[] | undefined;
|
|
862
|
+
} | undefined;
|
|
863
|
+
localPlugins?: {
|
|
864
|
+
trust?: "full" | "sandbox" | undefined;
|
|
865
|
+
disable?: string[] | undefined;
|
|
866
|
+
} | undefined;
|
|
867
|
+
external?: {
|
|
868
|
+
package: string;
|
|
869
|
+
trust?: "full" | "sandbox" | undefined;
|
|
870
|
+
}[] | undefined;
|
|
871
|
+
}>>>;
|
|
647
872
|
/**
|
|
648
873
|
* Developer feedback for continuous quality improvement (optional, default: false)
|
|
649
874
|
*
|
|
@@ -694,6 +919,20 @@ export declare const VibeValidateConfigSchema: z.ZodObject<{
|
|
|
694
919
|
concurrencyScope: "directory" | "project";
|
|
695
920
|
projectId?: string | undefined;
|
|
696
921
|
};
|
|
922
|
+
extractors: {
|
|
923
|
+
builtins: {
|
|
924
|
+
disable: string[];
|
|
925
|
+
trust?: "full" | "sandbox" | undefined;
|
|
926
|
+
};
|
|
927
|
+
localPlugins: {
|
|
928
|
+
disable: string[];
|
|
929
|
+
trust?: "full" | "sandbox" | undefined;
|
|
930
|
+
};
|
|
931
|
+
external: {
|
|
932
|
+
trust: "full" | "sandbox";
|
|
933
|
+
package: string;
|
|
934
|
+
}[];
|
|
935
|
+
};
|
|
697
936
|
developerFeedback: boolean;
|
|
698
937
|
ci?: {
|
|
699
938
|
failFast?: boolean | undefined;
|
|
@@ -747,6 +986,20 @@ export declare const VibeValidateConfigSchema: z.ZodObject<{
|
|
|
747
986
|
concurrencyScope?: "directory" | "project" | undefined;
|
|
748
987
|
projectId?: string | undefined;
|
|
749
988
|
} | undefined;
|
|
989
|
+
extractors?: {
|
|
990
|
+
builtins?: {
|
|
991
|
+
trust?: "full" | "sandbox" | undefined;
|
|
992
|
+
disable?: string[] | undefined;
|
|
993
|
+
} | undefined;
|
|
994
|
+
localPlugins?: {
|
|
995
|
+
trust?: "full" | "sandbox" | undefined;
|
|
996
|
+
disable?: string[] | undefined;
|
|
997
|
+
} | undefined;
|
|
998
|
+
external?: {
|
|
999
|
+
package: string;
|
|
1000
|
+
trust?: "full" | "sandbox" | undefined;
|
|
1001
|
+
}[] | undefined;
|
|
1002
|
+
} | undefined;
|
|
750
1003
|
developerFeedback?: boolean | undefined;
|
|
751
1004
|
}>;
|
|
752
1005
|
export type VibeValidateConfig = z.input<typeof VibeValidateConfigSchema>;
|
|
@@ -757,20 +1010,138 @@ export type VibeValidateConfig = z.input<typeof VibeValidateConfigSchema>;
|
|
|
757
1010
|
* @returns Validated configuration with defaults applied
|
|
758
1011
|
* @throws ZodError if validation fails
|
|
759
1012
|
*/
|
|
760
|
-
export declare
|
|
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
|
+
};
|
|
761
1075
|
/**
|
|
762
1076
|
* Safe validation function for VibeValidateConfig
|
|
763
1077
|
*
|
|
764
|
-
* NOTE: This duplicates the pattern from @vibe-validate/core's createSafeValidator.
|
|
765
|
-
* We can't import from core here due to circular dependency (core → config).
|
|
766
|
-
* This is an acceptable trade-off for a foundational package.
|
|
767
|
-
*
|
|
768
1078
|
* @param config - Configuration data to validate
|
|
769
1079
|
* @returns Validation result with success/error information
|
|
770
1080
|
*/
|
|
771
|
-
export declare
|
|
1081
|
+
export declare const safeValidateConfig: (data: unknown) => {
|
|
772
1082
|
success: true;
|
|
773
|
-
data:
|
|
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
|
+
};
|
|
774
1145
|
} | {
|
|
775
1146
|
success: false;
|
|
776
1147
|
errors: string[];
|
package/dist/schema.d.ts.map
CHANGED
|
@@ -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;
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;;;GAIG;AACH,eAAO,MAA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;;YAGtD,0EAA0E;;YAG1E,+CAA+C;;gBA/BjD,2DAA2D;;gBAG3D;;;;;;;;;;mBAUG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA4JH,kDAAkD;;QA1HlD,uEAAuE;;QAGvE;;;;WAIG;;QAGH;;;;WAIG;;;;;;;;;;;IAkHH;;;;;;;;;OASG;;QAtEH;;;WAGG;;YAjCH,+EAA+E;;YAG/E,uDAAuD;;;;;;;;;QAoCvD;;;WAGG;;YA1CH,+EAA+E;;YAG/E,uDAAuD;;;;;;;;;QA6CvD;;;WAGG;;YApCH,qEAAqE;;YAGrE,uCAAuC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAyFvC;;;;;;;;OAQG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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
|
|
@@ -24,7 +25,7 @@ export const ValidationStepSchema = z.object({
|
|
|
24
25
|
continueOnError: z.boolean().optional(),
|
|
25
26
|
/** Optional: Environment variables for this step */
|
|
26
27
|
env: z.record(z.string(), z.string()).optional(),
|
|
27
|
-
/** Optional: Working directory for this step (default:
|
|
28
|
+
/** Optional: Working directory for this step, relative to git root (default: git root) */
|
|
28
29
|
cwd: z.string().optional(),
|
|
29
30
|
}).strict();
|
|
30
31
|
/**
|
|
@@ -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
|
-
/**
|
|
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()
|
|
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
|
*/
|
|
@@ -133,6 +138,64 @@ export const LockingConfigSchema = z.object({
|
|
|
133
138
|
*/
|
|
134
139
|
projectId: z.string().optional(),
|
|
135
140
|
}).strict();
|
|
141
|
+
/**
|
|
142
|
+
* Extractor Trust Level
|
|
143
|
+
*
|
|
144
|
+
* Controls security sandbox behavior for extractors:
|
|
145
|
+
* - 'full': Run with full Node.js access (trusted code)
|
|
146
|
+
* - 'sandbox': Run in isolated V8 context with limited API access (untrusted code)
|
|
147
|
+
*/
|
|
148
|
+
export const ExtractorTrustLevelSchema = z.enum(['full', 'sandbox']);
|
|
149
|
+
/**
|
|
150
|
+
* Extractor Category Config Schema
|
|
151
|
+
*
|
|
152
|
+
* Shared configuration for built-in and local plugin extractors.
|
|
153
|
+
*/
|
|
154
|
+
export const ExtractorCategoryConfigSchema = z.object({
|
|
155
|
+
/** Trust level for extractors in this category (default varies by category) */
|
|
156
|
+
trust: ExtractorTrustLevelSchema.optional(),
|
|
157
|
+
/** List of extractor names to disable (default: []) */
|
|
158
|
+
disable: z.array(z.string()).optional().default([]),
|
|
159
|
+
}).strict();
|
|
160
|
+
/**
|
|
161
|
+
* External Extractor Config Schema
|
|
162
|
+
*
|
|
163
|
+
* Configuration for an explicit npm package extractor.
|
|
164
|
+
*/
|
|
165
|
+
export const ExternalExtractorConfigSchema = z.object({
|
|
166
|
+
/** npm package name (e.g., '@my-org/vibe-validate-plugin-gradle') */
|
|
167
|
+
package: z.string().min(1, 'Package name cannot be empty'),
|
|
168
|
+
/** Trust level (default: 'sandbox') */
|
|
169
|
+
trust: ExtractorTrustLevelSchema.optional().default('sandbox'),
|
|
170
|
+
}).strict();
|
|
171
|
+
/**
|
|
172
|
+
* Extractors Configuration Schema
|
|
173
|
+
*
|
|
174
|
+
* Controls extractor plugin loading, trust levels, and selective disabling.
|
|
175
|
+
*/
|
|
176
|
+
export const ExtractorsConfigSchema = z.object({
|
|
177
|
+
/**
|
|
178
|
+
* Built-in extractors configuration
|
|
179
|
+
* Default: { trust: 'full', disable: [] }
|
|
180
|
+
*/
|
|
181
|
+
builtins: ExtractorCategoryConfigSchema.optional().default({
|
|
182
|
+
trust: 'full',
|
|
183
|
+
disable: [],
|
|
184
|
+
}),
|
|
185
|
+
/**
|
|
186
|
+
* Local plugins configuration (auto-discovered from vibe-validate-local-plugins/)
|
|
187
|
+
* Default: { trust: 'sandbox', disable: [] }
|
|
188
|
+
*/
|
|
189
|
+
localPlugins: ExtractorCategoryConfigSchema.optional().default({
|
|
190
|
+
trust: 'sandbox',
|
|
191
|
+
disable: [],
|
|
192
|
+
}),
|
|
193
|
+
/**
|
|
194
|
+
* External npm package extractors (explicit registration required)
|
|
195
|
+
* Default: []
|
|
196
|
+
*/
|
|
197
|
+
external: z.array(ExternalExtractorConfigSchema).optional().default([]),
|
|
198
|
+
}).strict();
|
|
136
199
|
/**
|
|
137
200
|
* Full Configuration Schema
|
|
138
201
|
*
|
|
@@ -162,6 +225,21 @@ export const VibeValidateConfigSchema = z.object({
|
|
|
162
225
|
enabled: true,
|
|
163
226
|
concurrencyScope: 'directory',
|
|
164
227
|
}),
|
|
228
|
+
/**
|
|
229
|
+
* Extractor plugins configuration (optional)
|
|
230
|
+
*
|
|
231
|
+
* Controls trust levels and selective disabling for extractors:
|
|
232
|
+
* - Built-in extractors (shipped with vibe-validate)
|
|
233
|
+
* - Local plugins (auto-discovered from vibe-validate-local-plugins/)
|
|
234
|
+
* - External npm packages (explicit registration required)
|
|
235
|
+
*
|
|
236
|
+
* Default: { builtins: { trust: 'full', disable: [] }, localPlugins: { trust: 'sandbox', disable: [] }, external: [] }
|
|
237
|
+
*/
|
|
238
|
+
extractors: ExtractorsConfigSchema.optional().default({
|
|
239
|
+
builtins: { trust: 'full', disable: [] },
|
|
240
|
+
localPlugins: { trust: 'sandbox', disable: [] },
|
|
241
|
+
external: [],
|
|
242
|
+
}),
|
|
165
243
|
/**
|
|
166
244
|
* Developer feedback for continuous quality improvement (optional, default: false)
|
|
167
245
|
*
|
|
@@ -180,28 +258,11 @@ export const VibeValidateConfigSchema = z.object({
|
|
|
180
258
|
* @returns Validated configuration with defaults applied
|
|
181
259
|
* @throws ZodError if validation fails
|
|
182
260
|
*/
|
|
183
|
-
export
|
|
184
|
-
return VibeValidateConfigSchema.parse(config);
|
|
185
|
-
}
|
|
261
|
+
export const validateConfig = createStrictValidator(VibeValidateConfigSchema);
|
|
186
262
|
/**
|
|
187
263
|
* Safe validation function for VibeValidateConfig
|
|
188
264
|
*
|
|
189
|
-
* NOTE: This duplicates the pattern from @vibe-validate/core's createSafeValidator.
|
|
190
|
-
* We can't import from core here due to circular dependency (core → config).
|
|
191
|
-
* This is an acceptable trade-off for a foundational package.
|
|
192
|
-
*
|
|
193
265
|
* @param config - Configuration data to validate
|
|
194
266
|
* @returns Validation result with success/error information
|
|
195
267
|
*/
|
|
196
|
-
export
|
|
197
|
-
const result = VibeValidateConfigSchema.safeParse(config);
|
|
198
|
-
if (result.success) {
|
|
199
|
-
return { success: true, data: result.data };
|
|
200
|
-
}
|
|
201
|
-
// Extract error messages with full path
|
|
202
|
-
const errors = result.error.errors.map(err => {
|
|
203
|
-
const path = err.path.join('.');
|
|
204
|
-
return path ? `${path}: ${err.message}` : err.message;
|
|
205
|
-
});
|
|
206
|
-
return { success: false, errors };
|
|
207
|
-
}
|
|
268
|
+
export const safeValidateConfig = createSafeValidator(VibeValidateConfigSchema);
|
package/package.json
CHANGED