workflow-agent-cli 2.2.1 → 2.3.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.
@@ -1,339 +0,0 @@
1
- // src/config/index.ts
2
- import { cosmiconfig } from "cosmiconfig";
3
-
4
- // src/config/schema.ts
5
- import { z } from "zod";
6
- var DEFAULT_RESERVED_SCOPE_NAMES = [
7
- "init",
8
- "create",
9
- "build",
10
- "test",
11
- "config",
12
- "docs",
13
- "ci",
14
- "deps"
15
- ];
16
- function validateScopeName(name, reservedNames = DEFAULT_RESERVED_SCOPE_NAMES) {
17
- if (reservedNames.includes(name)) {
18
- const suggestions = {
19
- docs: "documentation",
20
- test: "testing",
21
- config: "configuration",
22
- build: "builds",
23
- ci: "cicd",
24
- deps: "dependencies"
25
- };
26
- return {
27
- valid: false,
28
- error: `Scope name "${name}" is reserved`,
29
- suggestion: suggestions[name] || `${name}-scope`
30
- };
31
- }
32
- if (!/^[a-z0-9-]+$/.test(name)) {
33
- return {
34
- valid: false,
35
- error: "Scope name must be lowercase alphanumeric with hyphens"
36
- };
37
- }
38
- if (name.length === 0 || name.length > 32) {
39
- return {
40
- valid: false,
41
- error: "Scope name must be 1-32 characters"
42
- };
43
- }
44
- return { valid: true };
45
- }
46
- var BranchTypeSchema = z.enum([
47
- "feature",
48
- "bugfix",
49
- "hotfix",
50
- "chore",
51
- "refactor",
52
- "docs",
53
- "test",
54
- "release"
55
- ]);
56
- var ConventionalTypeSchema = z.enum([
57
- "feat",
58
- "fix",
59
- "refactor",
60
- "chore",
61
- "docs",
62
- "test",
63
- "perf",
64
- "style",
65
- "ci",
66
- "build",
67
- "revert"
68
- ]);
69
- var ScopeSchema = z.object({
70
- name: z.string().min(1).max(32, "Scope name must be 32 characters or less").regex(
71
- /^[a-z0-9-]+$/,
72
- "Scope name must be lowercase alphanumeric with hyphens"
73
- ),
74
- description: z.string().min(10, "Scope description must be at least 10 characters"),
75
- allowedTypes: z.array(ConventionalTypeSchema).optional(),
76
- mandatoryGuidelines: z.array(z.string()).optional(),
77
- emoji: z.string().optional(),
78
- category: z.enum([
79
- "auth",
80
- "features",
81
- "infrastructure",
82
- "documentation",
83
- "testing",
84
- "performance",
85
- "other"
86
- ]).optional()
87
- });
88
- var EnforcementLevelSchema = z.enum([
89
- "strict",
90
- "advisory",
91
- "learning"
92
- ]);
93
- var AnalyticsConfigSchema = z.object({
94
- enabled: z.boolean().default(false),
95
- shareAnonymous: z.boolean().default(false)
96
- });
97
- var HookCheckSchema = z.enum([
98
- "validate-branch",
99
- "validate-commit",
100
- "check-guidelines",
101
- "validate-scopes"
102
- ]);
103
- var HooksConfigSchema = z.object({
104
- /** Whether hooks are enabled */
105
- enabled: z.boolean().default(true),
106
- /** Checks to run on pre-commit */
107
- preCommit: z.array(HookCheckSchema).default(["validate-branch", "check-guidelines"]),
108
- /** Checks to run on commit-msg */
109
- commitMsg: z.array(HookCheckSchema).default(["validate-commit"])
110
- });
111
- var GuidelinesConfigSchema = z.object({
112
- /** Additional templates to make mandatory (beyond the core set) */
113
- additionalMandatory: z.array(z.string()).optional(),
114
- /** Templates to make optional (override core mandatory templates) */
115
- optionalOverrides: z.array(z.string()).optional()
116
- });
117
- var CIProviderSchema = z.enum(["github", "gitlab", "bitbucket"]);
118
- var CICheckSchema = z.enum([
119
- "lint",
120
- "typecheck",
121
- "format",
122
- "test",
123
- "build"
124
- ]);
125
- var CIConfigSchema = z.object({
126
- /** Whether CI setup is enabled */
127
- enabled: z.boolean().default(true),
128
- /** CI provider (currently only github supported) */
129
- provider: CIProviderSchema.default("github"),
130
- /** Checks to run in CI pipeline */
131
- checks: z.array(CICheckSchema).default(["lint", "typecheck", "format", "build", "test"])
132
- });
133
- var LLMProviderSchema = z.enum(["anthropic", "openai"]);
134
- var PipelineConfigSchema = z.object({
135
- /** Whether auto-heal is enabled for pipeline failures */
136
- autoHeal: z.boolean().default(false),
137
- /** Maximum number of retry attempts before giving up */
138
- maxRetries: z.number().min(1).max(100).default(10),
139
- /** Base backoff time in minutes (exponential growth) */
140
- backoffMinutes: z.number().min(1).default(1),
141
- /** Maximum backoff time in minutes */
142
- maxBackoffMinutes: z.number().min(1).default(30),
143
- /** Minimum confidence level required to apply a fix (0-1) */
144
- minConfidence: z.number().min(0).max(1).default(0.7),
145
- /** Whether to create a PR for fixes instead of direct commits */
146
- createPullRequest: z.boolean().default(true),
147
- /** Branches to monitor for auto-heal (empty = all branches) */
148
- branches: z.array(z.string()).optional(),
149
- /** Workflow names to exclude from auto-heal */
150
- excludeWorkflows: z.array(z.string()).optional()
151
- });
152
- var VisualTestingConfigSchema = z.object({
153
- /** Whether visual testing is enabled */
154
- enabled: z.boolean().default(false),
155
- /** LLM provider to use for visual comparison */
156
- llmProvider: LLMProviderSchema.default("anthropic"),
157
- /** Directory to store baseline screenshots */
158
- baselineDir: z.string().default(".visual-baselines"),
159
- /** Default viewport width */
160
- viewportWidth: z.number().default(1280),
161
- /** Default viewport height */
162
- viewportHeight: z.number().default(720),
163
- /** Whether to run visual tests on PRs */
164
- runOnPullRequest: z.boolean().default(true),
165
- /** Whether to block PR merge on visual differences */
166
- blockOnDifference: z.boolean().default(false),
167
- /** URLs to test (can include placeholders like {{baseUrl}}) */
168
- urls: z.array(
169
- z.object({
170
- name: z.string(),
171
- url: z.string(),
172
- viewportWidth: z.number().optional(),
173
- viewportHeight: z.number().optional()
174
- })
175
- ).optional()
176
- });
177
- var WorkflowConfigSchema = z.object({
178
- projectName: z.string().min(1),
179
- scopes: z.array(ScopeSchema).min(1),
180
- branchTypes: z.array(BranchTypeSchema).optional(),
181
- conventionalTypes: z.array(ConventionalTypeSchema).optional(),
182
- enforcement: EnforcementLevelSchema.default("strict"),
183
- language: z.string().default("en"),
184
- analytics: AnalyticsConfigSchema.optional(),
185
- adapter: z.string().optional(),
186
- syncRemote: z.string().optional(),
187
- hooks: HooksConfigSchema.optional(),
188
- guidelines: GuidelinesConfigSchema.optional(),
189
- reservedScopeNames: z.array(z.string()).optional().default(DEFAULT_RESERVED_SCOPE_NAMES),
190
- ci: CIConfigSchema.optional(),
191
- pipeline: PipelineConfigSchema.optional(),
192
- visualTesting: VisualTestingConfigSchema.optional()
193
- }).superRefine((config, ctx) => {
194
- const reservedNames = config.reservedScopeNames || DEFAULT_RESERVED_SCOPE_NAMES;
195
- config.scopes.forEach((scope, index) => {
196
- const validation = validateScopeName(scope.name, reservedNames);
197
- if (!validation.valid) {
198
- let message = validation.error || "Invalid scope name";
199
- if (validation.suggestion) {
200
- message += `. Try renaming to "${validation.suggestion}"`;
201
- }
202
- ctx.addIssue({
203
- code: z.ZodIssueCode.custom,
204
- path: ["scopes", index, "name"],
205
- message
206
- });
207
- }
208
- });
209
- });
210
- function validateScopeDefinitions(scopes) {
211
- const errors = [];
212
- const seenNames = /* @__PURE__ */ new Set();
213
- for (const scope of scopes) {
214
- if (seenNames.has(scope.name)) {
215
- errors.push(`Duplicate scope name: "${scope.name}"`);
216
- }
217
- seenNames.add(scope.name);
218
- const result = ScopeSchema.safeParse(scope);
219
- if (!result.success) {
220
- result.error.errors.forEach((err) => {
221
- errors.push(`Scope "${scope.name}": ${err.message}`);
222
- });
223
- }
224
- }
225
- return {
226
- valid: errors.length === 0,
227
- errors
228
- };
229
- }
230
-
231
- // src/config/index.ts
232
- import { join } from "path";
233
- import { existsSync } from "fs";
234
- import { z as z2 } from "zod";
235
- var explorer = cosmiconfig("workflow", {
236
- searchPlaces: [
237
- "workflow.config.ts",
238
- "workflow.config.js",
239
- "workflow.config.json",
240
- ".workflowrc",
241
- ".workflowrc.json",
242
- "package.json"
243
- ]
244
- });
245
- async function loadConfig(cwd = process.cwd()) {
246
- try {
247
- const result = await explorer.search(cwd);
248
- if (!result || !result.config) {
249
- return null;
250
- }
251
- const validated = WorkflowConfigSchema.parse(result.config);
252
- return validated;
253
- } catch (error) {
254
- if (error instanceof z2.ZodError) {
255
- const result = await explorer.search(cwd);
256
- const formattedErrors = error.errors.map((err) => {
257
- const path = err.path.join(".");
258
- if (err.path[0] === "scopes" && typeof err.path[1] === "number") {
259
- const scopeIndex = err.path[1];
260
- const scopeName = result?.config?.scopes?.[scopeIndex]?.name || `scope at index ${scopeIndex}`;
261
- const field = err.path[2] || "definition";
262
- let message = err.message;
263
- if (message.includes("reserved word")) {
264
- const reservedMatch = message.match(
265
- /Scope name "([^"]+)" is reserved/
266
- );
267
- if (reservedMatch) {
268
- const suggestions = {
269
- docs: "documentation",
270
- test: "testing",
271
- config: "configuration",
272
- build: "builds",
273
- ci: "cicd",
274
- deps: "dependencies"
275
- };
276
- const badName = reservedMatch[1];
277
- const suggestion = suggestions[badName] || `${badName}-scope`;
278
- message = `${message}. Try renaming to "${suggestion}"`;
279
- }
280
- }
281
- return field === "definition" ? `Scope "${scopeName}": ${message}` : `Scope "${scopeName}" ${field}: ${message}`;
282
- }
283
- return `${path}: ${err.message}`;
284
- }).join("\n \u2022 ");
285
- throw new Error(
286
- `Invalid workflow configuration:
287
- \u2022 ${formattedErrors}
288
-
289
- \u{1F4A1} Fix these issues in workflow.config.json or run: workflow config validate`
290
- );
291
- }
292
- if (error instanceof Error) {
293
- throw new Error(`Failed to load workflow config: ${error.message}`);
294
- }
295
- throw error;
296
- }
297
- }
298
- async function validateConfig(cwd = process.cwd()) {
299
- const errors = [];
300
- const warnings = [];
301
- try {
302
- const config = await loadConfig(cwd);
303
- if (!config) {
304
- errors.push("No configuration file found");
305
- return { valid: false, errors, warnings };
306
- }
307
- const scopeValidation = validateScopeDefinitions(config.scopes);
308
- errors.push(...scopeValidation.errors);
309
- return {
310
- valid: errors.length === 0,
311
- errors,
312
- warnings
313
- };
314
- } catch (error) {
315
- errors.push(error instanceof Error ? error.message : String(error));
316
- return { valid: false, errors, warnings };
317
- }
318
- }
319
- function hasConfig(cwd = process.cwd()) {
320
- const configPaths = [
321
- "workflow.config.ts",
322
- "workflow.config.js",
323
- "workflow.config.json",
324
- ".workflowrc",
325
- ".workflowrc.json"
326
- ];
327
- return configPaths.some((path) => existsSync(join(cwd, path)));
328
- }
329
-
330
- export {
331
- DEFAULT_RESERVED_SCOPE_NAMES,
332
- validateScopeName,
333
- WorkflowConfigSchema,
334
- validateScopeDefinitions,
335
- loadConfig,
336
- validateConfig,
337
- hasConfig
338
- };
339
- //# sourceMappingURL=chunk-JCDT4363.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/config/index.ts","../src/config/schema.ts"],"sourcesContent":["import { cosmiconfig } from \"cosmiconfig\";\nimport {\n WorkflowConfig,\n WorkflowConfigSchema,\n validateScopeDefinitions,\n} from \"./schema.js\";\nimport { join } from \"path\";\nimport { existsSync } from \"fs\";\nimport { z } from \"zod\";\n\nconst explorer = cosmiconfig(\"workflow\", {\n searchPlaces: [\n \"workflow.config.ts\",\n \"workflow.config.js\",\n \"workflow.config.json\",\n \".workflowrc\",\n \".workflowrc.json\",\n \"package.json\",\n ],\n});\n\nexport async function loadConfig(\n cwd: string = process.cwd(),\n): Promise<WorkflowConfig | null> {\n try {\n const result = await explorer.search(cwd);\n\n if (!result || !result.config) {\n return null;\n }\n\n // Validate config against schema\n const validated = WorkflowConfigSchema.parse(result.config);\n return validated;\n } catch (error) {\n if (error instanceof z.ZodError) {\n // Format Zod errors to be more user-friendly\n const result = await explorer.search(cwd);\n const formattedErrors = error.errors\n .map((err) => {\n const path = err.path.join(\".\");\n\n // If error is in scopes array, show the scope name\n if (err.path[0] === \"scopes\" && typeof err.path[1] === \"number\") {\n const scopeIndex = err.path[1];\n const scopeName =\n result?.config?.scopes?.[scopeIndex]?.name ||\n `scope at index ${scopeIndex}`;\n const field = err.path[2] || \"definition\";\n\n // Add helpful suggestions for common errors\n let message = err.message;\n if (message.includes(\"reserved word\")) {\n const reservedMatch = message.match(\n /Scope name \"([^\"]+)\" is reserved/,\n );\n if (reservedMatch) {\n const suggestions: Record<string, string> = {\n docs: \"documentation\",\n test: \"testing\",\n config: \"configuration\",\n build: \"builds\",\n ci: \"cicd\",\n deps: \"dependencies\",\n };\n const badName = reservedMatch[1];\n const suggestion = suggestions[badName] || `${badName}-scope`;\n message = `${message}. Try renaming to \"${suggestion}\"`;\n }\n }\n\n return field === \"definition\"\n ? `Scope \"${scopeName}\": ${message}`\n : `Scope \"${scopeName}\" ${field}: ${message}`;\n }\n\n return `${path}: ${err.message}`;\n })\n .join(\"\\n • \");\n\n throw new Error(\n `Invalid workflow configuration:\\n • ${formattedErrors}\\n\\n💡 Fix these issues in workflow.config.json or run: workflow config validate`,\n );\n }\n\n if (error instanceof Error) {\n throw new Error(`Failed to load workflow config: ${error.message}`);\n }\n throw error;\n }\n}\n\nexport async function validateConfig(cwd: string = process.cwd()): Promise<{\n valid: boolean;\n errors: string[];\n warnings: string[];\n}> {\n const errors: string[] = [];\n const warnings: string[] = [];\n\n try {\n const config = await loadConfig(cwd);\n if (!config) {\n errors.push(\"No configuration file found\");\n return { valid: false, errors, warnings };\n }\n\n // Additional validation beyond schema\n const scopeValidation = validateScopeDefinitions(config.scopes);\n errors.push(...scopeValidation.errors);\n\n return {\n valid: errors.length === 0,\n errors,\n warnings,\n };\n } catch (error) {\n errors.push(error instanceof Error ? error.message : String(error));\n return { valid: false, errors, warnings };\n }\n}\n\nexport function hasConfig(cwd: string = process.cwd()): boolean {\n const configPaths = [\n \"workflow.config.ts\",\n \"workflow.config.js\",\n \"workflow.config.json\",\n \".workflowrc\",\n \".workflowrc.json\",\n ];\n\n return configPaths.some((path) => existsSync(join(cwd, path)));\n}\n\nexport {\n WorkflowConfig,\n WorkflowConfigSchema,\n Scope,\n BranchType,\n ConventionalType,\n validateScopeName,\n DEFAULT_RESERVED_SCOPE_NAMES,\n} from \"./schema.js\";\n","import { z } from \"zod\";\n\n// Default reserved scope names that cannot be used\nexport const DEFAULT_RESERVED_SCOPE_NAMES = [\n \"init\",\n \"create\",\n \"build\",\n \"test\",\n \"config\",\n \"docs\",\n \"ci\",\n \"deps\",\n];\n\n/**\n * Validates a scope name against reserved words and naming rules\n */\nexport function validateScopeName(\n name: string,\n reservedNames: string[] = DEFAULT_RESERVED_SCOPE_NAMES,\n): {\n valid: boolean;\n error?: string;\n suggestion?: string;\n} {\n if (reservedNames.includes(name)) {\n // Provide suggestions for common reserved words\n const suggestions: Record<string, string> = {\n docs: \"documentation\",\n test: \"testing\",\n config: \"configuration\",\n build: \"builds\",\n ci: \"cicd\",\n deps: \"dependencies\",\n };\n\n return {\n valid: false,\n error: `Scope name \"${name}\" is reserved`,\n suggestion: suggestions[name] || `${name}-scope`,\n };\n }\n\n if (!/^[a-z0-9-]+$/.test(name)) {\n return {\n valid: false,\n error: \"Scope name must be lowercase alphanumeric with hyphens\",\n };\n }\n\n if (name.length === 0 || name.length > 32) {\n return {\n valid: false,\n error: \"Scope name must be 1-32 characters\",\n };\n }\n\n return { valid: true };\n}\n\nexport const BranchTypeSchema = z.enum([\n \"feature\",\n \"bugfix\",\n \"hotfix\",\n \"chore\",\n \"refactor\",\n \"docs\",\n \"test\",\n \"release\",\n]);\n\nexport const ConventionalTypeSchema = z.enum([\n \"feat\",\n \"fix\",\n \"refactor\",\n \"chore\",\n \"docs\",\n \"test\",\n \"perf\",\n \"style\",\n \"ci\",\n \"build\",\n \"revert\",\n]);\n\nexport const ScopeSchema = z.object({\n name: z\n .string()\n .min(1)\n .max(32, \"Scope name must be 32 characters or less\")\n .regex(\n /^[a-z0-9-]+$/,\n \"Scope name must be lowercase alphanumeric with hyphens\",\n ),\n description: z\n .string()\n .min(10, \"Scope description must be at least 10 characters\"),\n allowedTypes: z.array(ConventionalTypeSchema).optional(),\n mandatoryGuidelines: z.array(z.string()).optional(),\n emoji: z.string().optional(),\n category: z\n .enum([\n \"auth\",\n \"features\",\n \"infrastructure\",\n \"documentation\",\n \"testing\",\n \"performance\",\n \"other\",\n ])\n .optional(),\n});\n\nexport const EnforcementLevelSchema = z.enum([\n \"strict\",\n \"advisory\",\n \"learning\",\n]);\n\nexport const AnalyticsConfigSchema = z.object({\n enabled: z.boolean().default(false),\n shareAnonymous: z.boolean().default(false),\n});\n\n// Pre-commit hook check types\nexport const HookCheckSchema = z.enum([\n \"validate-branch\",\n \"validate-commit\",\n \"check-guidelines\",\n \"validate-scopes\",\n]);\n\n// Git hooks configuration\nexport const HooksConfigSchema = z.object({\n /** Whether hooks are enabled */\n enabled: z.boolean().default(true),\n /** Checks to run on pre-commit */\n preCommit: z\n .array(HookCheckSchema)\n .default([\"validate-branch\", \"check-guidelines\"]),\n /** Checks to run on commit-msg */\n commitMsg: z.array(HookCheckSchema).default([\"validate-commit\"]),\n});\n\n// Guidelines configuration with mandatory templates and user overrides\nexport const GuidelinesConfigSchema = z.object({\n /** Additional templates to make mandatory (beyond the core set) */\n additionalMandatory: z.array(z.string()).optional(),\n /** Templates to make optional (override core mandatory templates) */\n optionalOverrides: z.array(z.string()).optional(),\n});\n\n// CI provider types\nexport const CIProviderSchema = z.enum([\"github\", \"gitlab\", \"bitbucket\"]);\n\n// CI check types\nexport const CICheckSchema = z.enum([\n \"lint\",\n \"typecheck\",\n \"format\",\n \"test\",\n \"build\",\n]);\n\n// CI/CD configuration\nexport const CIConfigSchema = z.object({\n /** Whether CI setup is enabled */\n enabled: z.boolean().default(true),\n /** CI provider (currently only github supported) */\n provider: CIProviderSchema.default(\"github\"),\n /** Checks to run in CI pipeline */\n checks: z\n .array(CICheckSchema)\n .default([\"lint\", \"typecheck\", \"format\", \"build\", \"test\"]),\n});\n\n// LLM provider types\nexport const LLMProviderSchema = z.enum([\"anthropic\", \"openai\"]);\n\n// Pipeline auto-heal configuration\nexport const PipelineConfigSchema = z.object({\n /** Whether auto-heal is enabled for pipeline failures */\n autoHeal: z.boolean().default(false),\n /** Maximum number of retry attempts before giving up */\n maxRetries: z.number().min(1).max(100).default(10),\n /** Base backoff time in minutes (exponential growth) */\n backoffMinutes: z.number().min(1).default(1),\n /** Maximum backoff time in minutes */\n maxBackoffMinutes: z.number().min(1).default(30),\n /** Minimum confidence level required to apply a fix (0-1) */\n minConfidence: z.number().min(0).max(1).default(0.7),\n /** Whether to create a PR for fixes instead of direct commits */\n createPullRequest: z.boolean().default(true),\n /** Branches to monitor for auto-heal (empty = all branches) */\n branches: z.array(z.string()).optional(),\n /** Workflow names to exclude from auto-heal */\n excludeWorkflows: z.array(z.string()).optional(),\n});\n\n// Visual testing configuration\nexport const VisualTestingConfigSchema = z.object({\n /** Whether visual testing is enabled */\n enabled: z.boolean().default(false),\n /** LLM provider to use for visual comparison */\n llmProvider: LLMProviderSchema.default(\"anthropic\"),\n /** Directory to store baseline screenshots */\n baselineDir: z.string().default(\".visual-baselines\"),\n /** Default viewport width */\n viewportWidth: z.number().default(1280),\n /** Default viewport height */\n viewportHeight: z.number().default(720),\n /** Whether to run visual tests on PRs */\n runOnPullRequest: z.boolean().default(true),\n /** Whether to block PR merge on visual differences */\n blockOnDifference: z.boolean().default(false),\n /** URLs to test (can include placeholders like {{baseUrl}}) */\n urls: z\n .array(\n z.object({\n name: z.string(),\n url: z.string(),\n viewportWidth: z.number().optional(),\n viewportHeight: z.number().optional(),\n }),\n )\n .optional(),\n});\n\nexport const WorkflowConfigSchema = z\n .object({\n projectName: z.string().min(1),\n scopes: z.array(ScopeSchema).min(1),\n branchTypes: z.array(BranchTypeSchema).optional(),\n conventionalTypes: z.array(ConventionalTypeSchema).optional(),\n enforcement: EnforcementLevelSchema.default(\"strict\"),\n language: z.string().default(\"en\"),\n analytics: AnalyticsConfigSchema.optional(),\n adapter: z.string().optional(),\n syncRemote: z.string().optional(),\n hooks: HooksConfigSchema.optional(),\n guidelines: GuidelinesConfigSchema.optional(),\n reservedScopeNames: z\n .array(z.string())\n .optional()\n .default(DEFAULT_RESERVED_SCOPE_NAMES),\n ci: CIConfigSchema.optional(),\n pipeline: PipelineConfigSchema.optional(),\n visualTesting: VisualTestingConfigSchema.optional(),\n })\n .superRefine((config, ctx) => {\n // Validate scopes against reserved names\n const reservedNames =\n config.reservedScopeNames || DEFAULT_RESERVED_SCOPE_NAMES;\n\n config.scopes.forEach((scope, index) => {\n const validation = validateScopeName(scope.name, reservedNames);\n if (!validation.valid) {\n let message = validation.error || \"Invalid scope name\";\n if (validation.suggestion) {\n message += `. Try renaming to \"${validation.suggestion}\"`;\n }\n\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: [\"scopes\", index, \"name\"],\n message,\n });\n }\n });\n });\n\nexport type Scope = z.infer<typeof ScopeSchema>;\nexport type BranchType = z.infer<typeof BranchTypeSchema>;\nexport type ConventionalType = z.infer<typeof ConventionalTypeSchema>;\nexport type EnforcementLevel = z.infer<typeof EnforcementLevelSchema>;\nexport type AnalyticsConfig = z.infer<typeof AnalyticsConfigSchema>;\nexport type HookCheck = z.infer<typeof HookCheckSchema>;\nexport type HooksConfig = z.infer<typeof HooksConfigSchema>;\nexport type GuidelinesConfig = z.infer<typeof GuidelinesConfigSchema>;\nexport type CIProvider = z.infer<typeof CIProviderSchema>;\nexport type CICheck = z.infer<typeof CICheckSchema>;\nexport type CIConfig = z.infer<typeof CIConfigSchema>;\nexport type LLMProvider = z.infer<typeof LLMProviderSchema>;\nexport type PipelineConfig = z.infer<typeof PipelineConfigSchema>;\nexport type VisualTestingConfig = z.infer<typeof VisualTestingConfigSchema>;\nexport type WorkflowConfig = z.infer<typeof WorkflowConfigSchema>;\n\nexport const defaultBranchTypes: BranchType[] = [\n \"feature\",\n \"bugfix\",\n \"hotfix\",\n \"chore\",\n \"refactor\",\n \"docs\",\n \"test\",\n];\n\nexport const defaultConventionalTypes: ConventionalType[] = [\n \"feat\",\n \"fix\",\n \"refactor\",\n \"chore\",\n \"docs\",\n \"test\",\n \"perf\",\n \"style\",\n];\n\n/**\n * Validates scope definitions for duplicates, description quality, and category values\n * @param scopes Array of scope definitions to validate\n * @returns Object with validation result and error messages\n */\nexport function validateScopeDefinitions(scopes: Scope[]): {\n valid: boolean;\n errors: string[];\n} {\n const errors: string[] = [];\n const seenNames = new Set<string>();\n\n for (const scope of scopes) {\n // Check for duplicate names\n if (seenNames.has(scope.name)) {\n errors.push(`Duplicate scope name: \"${scope.name}\"`);\n }\n seenNames.add(scope.name);\n\n // Validate using schema (this will catch min length, reserved names, etc.)\n const result = ScopeSchema.safeParse(scope);\n if (!result.success) {\n result.error.errors.forEach((err) => {\n errors.push(`Scope \"${scope.name}\": ${err.message}`);\n });\n }\n }\n\n return {\n valid: errors.length === 0,\n errors,\n };\n}\n"],"mappings":";AAAA,SAAS,mBAAmB;;;ACA5B,SAAS,SAAS;AAGX,IAAM,+BAA+B;AAAA,EAC1C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAKO,SAAS,kBACd,MACA,gBAA0B,8BAK1B;AACA,MAAI,cAAc,SAAS,IAAI,GAAG;AAEhC,UAAM,cAAsC;AAAA,MAC1C,MAAM;AAAA,MACN,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,OAAO;AAAA,MACP,IAAI;AAAA,MACJ,MAAM;AAAA,IACR;AAEA,WAAO;AAAA,MACL,OAAO;AAAA,MACP,OAAO,eAAe,IAAI;AAAA,MAC1B,YAAY,YAAY,IAAI,KAAK,GAAG,IAAI;AAAA,IAC1C;AAAA,EACF;AAEA,MAAI,CAAC,eAAe,KAAK,IAAI,GAAG;AAC9B,WAAO;AAAA,MACL,OAAO;AAAA,MACP,OAAO;AAAA,IACT;AAAA,EACF;AAEA,MAAI,KAAK,WAAW,KAAK,KAAK,SAAS,IAAI;AACzC,WAAO;AAAA,MACL,OAAO;AAAA,MACP,OAAO;AAAA,IACT;AAAA,EACF;AAEA,SAAO,EAAE,OAAO,KAAK;AACvB;AAEO,IAAM,mBAAmB,EAAE,KAAK;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAEM,IAAM,yBAAyB,EAAE,KAAK;AAAA,EAC3C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AA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