workflow-agent-cli 2.2.0 → 2.2.2

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.
@@ -0,0 +1,308 @@
1
+ // src/utils/check-runner.ts
2
+ import { execa } from "execa";
3
+ import chalk from "chalk";
4
+ var QUALITY_CHECKS = [
5
+ {
6
+ name: "typecheck",
7
+ displayName: "Type Check",
8
+ command: "pnpm",
9
+ args: ["typecheck"],
10
+ canAutoFix: false
11
+ // TypeScript errors need manual/LLM fix
12
+ },
13
+ {
14
+ name: "lint",
15
+ displayName: "Lint",
16
+ command: "pnpm",
17
+ args: ["lint"],
18
+ fixCommand: "pnpm",
19
+ fixArgs: ["lint", "--fix"],
20
+ canAutoFix: true
21
+ },
22
+ {
23
+ name: "format",
24
+ displayName: "Format",
25
+ command: "pnpm",
26
+ args: ["format", "--check"],
27
+ fixCommand: "pnpm",
28
+ fixArgs: ["format"],
29
+ canAutoFix: true
30
+ },
31
+ {
32
+ name: "test",
33
+ displayName: "Tests",
34
+ command: "pnpm",
35
+ args: ["test"],
36
+ canAutoFix: false
37
+ // Tests need manual/LLM fix
38
+ },
39
+ {
40
+ name: "build",
41
+ displayName: "Build",
42
+ command: "pnpm",
43
+ args: ["build"],
44
+ canAutoFix: false
45
+ // Build errors need manual/LLM fix
46
+ }
47
+ ];
48
+ async function runCheck(check, cwd) {
49
+ const startTime = Date.now();
50
+ try {
51
+ const result = await execa(check.command, check.args, {
52
+ cwd,
53
+ reject: false,
54
+ all: true
55
+ });
56
+ const duration = Date.now() - startTime;
57
+ if (result.exitCode === 0) {
58
+ return {
59
+ check,
60
+ success: true,
61
+ output: result.all || "",
62
+ duration
63
+ };
64
+ } else {
65
+ return {
66
+ check,
67
+ success: false,
68
+ output: result.all || "",
69
+ error: result.stderr || result.all || "Check failed",
70
+ duration
71
+ };
72
+ }
73
+ } catch (error) {
74
+ const duration = Date.now() - startTime;
75
+ const execaError = error;
76
+ return {
77
+ check,
78
+ success: false,
79
+ output: execaError.all?.toString() || execaError.message || "",
80
+ error: execaError.message,
81
+ duration
82
+ };
83
+ }
84
+ }
85
+ async function applyFix(check, cwd) {
86
+ if (!check.canAutoFix || !check.fixCommand) {
87
+ return { success: false, output: "Check does not support auto-fix" };
88
+ }
89
+ try {
90
+ const result = await execa(check.fixCommand, check.fixArgs || [], {
91
+ cwd,
92
+ reject: false,
93
+ all: true
94
+ });
95
+ return {
96
+ success: result.exitCode === 0,
97
+ output: result.all || ""
98
+ };
99
+ } catch (error) {
100
+ const execaError = error;
101
+ return {
102
+ success: false,
103
+ output: execaError.message
104
+ };
105
+ }
106
+ }
107
+ function formatFixCommand(check) {
108
+ if (!check.fixCommand) return "";
109
+ return `${check.fixCommand} ${(check.fixArgs || []).join(" ")}`;
110
+ }
111
+ async function runAllChecks(cwd, options = {}) {
112
+ const {
113
+ maxRetries = 10,
114
+ autoFix = true,
115
+ dryRun = false,
116
+ onProgress
117
+ } = options;
118
+ const log = (message, type = "info") => {
119
+ if (onProgress) {
120
+ onProgress(message, type);
121
+ } else {
122
+ switch (type) {
123
+ case "success":
124
+ console.log(chalk.green(message));
125
+ break;
126
+ case "error":
127
+ console.log(chalk.red(message));
128
+ break;
129
+ case "warning":
130
+ console.log(chalk.yellow(message));
131
+ break;
132
+ default:
133
+ console.log(message);
134
+ }
135
+ }
136
+ };
137
+ let attempt = 0;
138
+ let fixesApplied = 0;
139
+ const pendingFixes = [];
140
+ while (attempt < maxRetries) {
141
+ attempt++;
142
+ log(`
143
+ ${"\u2501".repeat(50)}`, "info");
144
+ log(`\u{1F504} Validation Cycle ${attempt}/${maxRetries}`, "info");
145
+ log(`${"\u2501".repeat(50)}
146
+ `, "info");
147
+ const results = [];
148
+ let allPassed = true;
149
+ let fixAppliedThisCycle = false;
150
+ for (let i = 0; i < QUALITY_CHECKS.length; i++) {
151
+ const check = QUALITY_CHECKS[i];
152
+ const stepNum = i + 1;
153
+ const totalSteps = QUALITY_CHECKS.length;
154
+ log(`\u{1F4CB} Step ${stepNum}/${totalSteps}: ${check.displayName}...`, "info");
155
+ const result = await runCheck(check, cwd);
156
+ results.push(result);
157
+ if (result.success) {
158
+ log(`\u2705 ${check.displayName} passed (${result.duration}ms)`, "success");
159
+ } else {
160
+ allPassed = false;
161
+ log(`\u274C ${check.displayName} failed`, "error");
162
+ if (autoFix && check.canAutoFix && check.fixCommand) {
163
+ if (dryRun) {
164
+ log(
165
+ `\u{1F527} [DRY-RUN] Would run: ${formatFixCommand(check)}`,
166
+ "warning"
167
+ );
168
+ pendingFixes.push({ check, command: formatFixCommand(check) });
169
+ continue;
170
+ }
171
+ log(`\u{1F527} Attempting auto-fix for ${check.displayName}...`, "warning");
172
+ const fixResult = await applyFix(check, cwd);
173
+ if (fixResult.success) {
174
+ log(`\u2728 Auto-fix applied for ${check.displayName}`, "success");
175
+ fixesApplied++;
176
+ fixAppliedThisCycle = true;
177
+ log(
178
+ `
179
+ \u{1F504} Fix applied - restarting all checks to verify...`,
180
+ "warning"
181
+ );
182
+ break;
183
+ } else {
184
+ log(`\u26A0\uFE0F Auto-fix failed for ${check.displayName}`, "error");
185
+ log(` Manual intervention required`, "error");
186
+ if (result.error) {
187
+ const errorPreview = result.error.slice(0, 500);
188
+ log(`
189
+ ${chalk.dim(errorPreview)}`, "error");
190
+ if (result.error.length > 500) {
191
+ log(
192
+ chalk.dim(
193
+ `... (${result.error.length - 500} more characters)`
194
+ ),
195
+ "error"
196
+ );
197
+ }
198
+ }
199
+ return {
200
+ success: false,
201
+ results,
202
+ totalAttempts: attempt,
203
+ fixesApplied
204
+ };
205
+ }
206
+ } else {
207
+ if (check.canAutoFix) {
208
+ log(
209
+ `\u26A0\uFE0F ${check.displayName} can be fixed with: ${formatFixCommand(check)}`,
210
+ "warning"
211
+ );
212
+ } else {
213
+ log(`\u26A0\uFE0F ${check.displayName} requires manual fix`, "error");
214
+ }
215
+ if (result.error) {
216
+ const errorPreview = result.error.slice(0, 500);
217
+ log(`
218
+ ${chalk.dim(errorPreview)}`, "error");
219
+ if (result.error.length > 500) {
220
+ log(
221
+ chalk.dim(`... (${result.error.length - 500} more characters)`),
222
+ "error"
223
+ );
224
+ }
225
+ }
226
+ if (!dryRun) {
227
+ return {
228
+ success: false,
229
+ results,
230
+ totalAttempts: attempt,
231
+ fixesApplied
232
+ };
233
+ }
234
+ }
235
+ }
236
+ }
237
+ if (dryRun && pendingFixes.length > 0) {
238
+ log(`
239
+ ${"\u2501".repeat(50)}`, "info");
240
+ log(`\u{1F4CB} DRY-RUN SUMMARY`, "info");
241
+ log(`${"\u2501".repeat(50)}`, "info");
242
+ log(`
243
+ The following fixes would be applied:`, "warning");
244
+ for (const fix of pendingFixes) {
245
+ log(` \u2022 ${fix.check.displayName}: ${fix.command}`, "info");
246
+ }
247
+ log(`
248
+ Run without --dry-run to apply fixes.`, "info");
249
+ return {
250
+ success: false,
251
+ results,
252
+ totalAttempts: attempt,
253
+ fixesApplied: 0,
254
+ pendingFixes
255
+ };
256
+ }
257
+ if (allPassed) {
258
+ return {
259
+ success: true,
260
+ results,
261
+ totalAttempts: attempt,
262
+ fixesApplied
263
+ };
264
+ }
265
+ if (!fixAppliedThisCycle) {
266
+ return {
267
+ success: false,
268
+ results,
269
+ totalAttempts: attempt,
270
+ fixesApplied
271
+ };
272
+ }
273
+ }
274
+ log(`
275
+ \u274C Maximum retries (${maxRetries}) exceeded`, "error");
276
+ return {
277
+ success: false,
278
+ results: [],
279
+ totalAttempts: attempt,
280
+ fixesApplied
281
+ };
282
+ }
283
+ async function hasUncommittedChanges(cwd) {
284
+ try {
285
+ const result = await execa("git", ["status", "--porcelain"], { cwd });
286
+ return result.stdout.trim().length > 0;
287
+ } catch {
288
+ return false;
289
+ }
290
+ }
291
+ async function stageAllChanges(cwd) {
292
+ try {
293
+ await execa("git", ["add", "-A"], { cwd });
294
+ return true;
295
+ } catch {
296
+ return false;
297
+ }
298
+ }
299
+
300
+ export {
301
+ QUALITY_CHECKS,
302
+ runCheck,
303
+ applyFix,
304
+ runAllChecks,
305
+ hasUncommittedChanges,
306
+ stageAllChanges
307
+ };
308
+ //# sourceMappingURL=chunk-AN6UOHBB.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utils/check-runner.ts"],"sourcesContent":["/**\n * Check Runner - Orchestrates quality checks with fix-and-revalidate pattern\n *\n * Pattern: Run check → If fails, fix → Re-run ALL checks from start\n * This ensures fixes don't introduce new issues in earlier checks.\n */\n\nimport { execa, type ExecaError } from \"execa\";\nimport chalk from \"chalk\";\n\nexport interface CheckDefinition {\n name: string;\n displayName: string;\n command: string;\n args: string[];\n fixCommand?: string;\n fixArgs?: string[];\n canAutoFix: boolean;\n}\n\nexport interface CheckResult {\n check: CheckDefinition;\n success: boolean;\n output: string;\n error?: string;\n duration: number;\n}\n\nexport interface RunAllChecksResult {\n success: boolean;\n results: CheckResult[];\n totalAttempts: number;\n fixesApplied: number;\n pendingFixes?: Array<{ check: CheckDefinition; command: string }>;\n}\n\nexport type ProgressType = \"info\" | \"success\" | \"error\" | \"warning\";\n\nexport interface CheckRunnerOptions {\n maxRetries?: number;\n autoFix?: boolean;\n dryRun?: boolean;\n onProgress?: (message: string, type: ProgressType) => void;\n}\n\n/**\n * Standard quality checks in recommended order\n * Order: typecheck → lint → format → test → build\n * Type errors cascade, so we fix them first\n */\nexport const QUALITY_CHECKS: CheckDefinition[] = [\n {\n name: \"typecheck\",\n displayName: \"Type Check\",\n command: \"pnpm\",\n args: [\"typecheck\"],\n canAutoFix: false, // TypeScript errors need manual/LLM fix\n },\n {\n name: \"lint\",\n displayName: \"Lint\",\n command: \"pnpm\",\n args: [\"lint\"],\n fixCommand: \"pnpm\",\n fixArgs: [\"lint\", \"--fix\"],\n canAutoFix: true,\n },\n {\n name: \"format\",\n displayName: \"Format\",\n command: \"pnpm\",\n args: [\"format\", \"--check\"],\n fixCommand: \"pnpm\",\n fixArgs: [\"format\"],\n canAutoFix: true,\n },\n {\n name: \"test\",\n displayName: \"Tests\",\n command: \"pnpm\",\n args: [\"test\"],\n canAutoFix: false, // Tests need manual/LLM fix\n },\n {\n name: \"build\",\n displayName: \"Build\",\n command: \"pnpm\",\n args: [\"build\"],\n canAutoFix: false, // Build errors need manual/LLM fix\n },\n];\n\n/**\n * Run a single check\n */\nexport async function runCheck(\n check: CheckDefinition,\n cwd: string,\n): Promise<CheckResult> {\n const startTime = Date.now();\n\n try {\n const result = await execa(check.command, check.args, {\n cwd,\n reject: false,\n all: true,\n });\n\n const duration = Date.now() - startTime;\n\n if (result.exitCode === 0) {\n return {\n check,\n success: true,\n output: result.all || \"\",\n duration,\n };\n } else {\n return {\n check,\n success: false,\n output: result.all || \"\",\n error: result.stderr || result.all || \"Check failed\",\n duration,\n };\n }\n } catch (error) {\n const duration = Date.now() - startTime;\n const execaError = error as ExecaError;\n\n return {\n check,\n success: false,\n output: execaError.all?.toString() || execaError.message || \"\",\n error: execaError.message,\n duration,\n };\n }\n}\n\n/**\n * Apply fix for a check that supports auto-fix\n */\nexport async function applyFix(\n check: CheckDefinition,\n cwd: string,\n): Promise<{ success: boolean; output: string }> {\n if (!check.canAutoFix || !check.fixCommand) {\n return { success: false, output: \"Check does not support auto-fix\" };\n }\n\n try {\n const result = await execa(check.fixCommand, check.fixArgs || [], {\n cwd,\n reject: false,\n all: true,\n });\n\n return {\n success: result.exitCode === 0,\n output: result.all || \"\",\n };\n } catch (error) {\n const execaError = error as ExecaError;\n return {\n success: false,\n output: execaError.message,\n };\n }\n}\n\n/**\n * Format a fix command for display\n */\nfunction formatFixCommand(check: CheckDefinition): string {\n if (!check.fixCommand) return \"\";\n return `${check.fixCommand} ${(check.fixArgs || []).join(\" \")}`;\n}\n\n/**\n * Run all quality checks with fix-and-revalidate pattern\n *\n * When a check fails and can be auto-fixed:\n * 1. Apply the fix\n * 2. Re-run ALL checks from the beginning\n * 3. Repeat until all pass or max retries reached\n *\n * @param cwd - Working directory\n * @param options - Configuration options\n */\nexport async function runAllChecks(\n cwd: string,\n options: CheckRunnerOptions = {},\n): Promise<RunAllChecksResult> {\n const {\n maxRetries = 10,\n autoFix = true,\n dryRun = false,\n onProgress,\n } = options;\n\n const log = (message: string, type: ProgressType = \"info\") => {\n if (onProgress) {\n onProgress(message, type);\n } else {\n // Default console output with colors\n switch (type) {\n case \"success\":\n console.log(chalk.green(message));\n break;\n case \"error\":\n console.log(chalk.red(message));\n break;\n case \"warning\":\n console.log(chalk.yellow(message));\n break;\n default:\n console.log(message);\n }\n }\n };\n\n let attempt = 0;\n let fixesApplied = 0;\n const pendingFixes: Array<{ check: CheckDefinition; command: string }> = [];\n\n while (attempt < maxRetries) {\n attempt++;\n\n log(`\\n${\"━\".repeat(50)}`, \"info\");\n log(`🔄 Validation Cycle ${attempt}/${maxRetries}`, \"info\");\n log(`${\"━\".repeat(50)}\\n`, \"info\");\n\n const results: CheckResult[] = [];\n let allPassed = true;\n let fixAppliedThisCycle = false;\n\n // Run each check in order\n for (let i = 0; i < QUALITY_CHECKS.length; i++) {\n const check = QUALITY_CHECKS[i];\n const stepNum = i + 1;\n const totalSteps = QUALITY_CHECKS.length;\n\n log(`📋 Step ${stepNum}/${totalSteps}: ${check.displayName}...`, \"info\");\n\n const result = await runCheck(check, cwd);\n results.push(result);\n\n if (result.success) {\n log(`✅ ${check.displayName} passed (${result.duration}ms)`, \"success\");\n } else {\n allPassed = false;\n log(`❌ ${check.displayName} failed`, \"error\");\n\n // Try to auto-fix if possible\n if (autoFix && check.canAutoFix && check.fixCommand) {\n if (dryRun) {\n // In dry-run mode, just record what would be fixed\n log(\n `🔧 [DRY-RUN] Would run: ${formatFixCommand(check)}`,\n \"warning\",\n );\n pendingFixes.push({ check, command: formatFixCommand(check) });\n\n // Continue to next check to show all issues\n continue;\n }\n\n log(`🔧 Attempting auto-fix for ${check.displayName}...`, \"warning\");\n\n const fixResult = await applyFix(check, cwd);\n\n if (fixResult.success) {\n log(`✨ Auto-fix applied for ${check.displayName}`, \"success\");\n fixesApplied++;\n fixAppliedThisCycle = true;\n\n // IMPORTANT: Re-run ALL checks from the beginning\n log(\n `\\n🔄 Fix applied - restarting all checks to verify...`,\n \"warning\",\n );\n break; // Exit the for loop to restart from the beginning\n } else {\n log(`⚠️ Auto-fix failed for ${check.displayName}`, \"error\");\n log(` Manual intervention required`, \"error\");\n\n // Show error details\n if (result.error) {\n const errorPreview = result.error.slice(0, 500);\n log(`\\n${chalk.dim(errorPreview)}`, \"error\");\n if (result.error.length > 500) {\n log(\n chalk.dim(\n `... (${result.error.length - 500} more characters)`,\n ),\n \"error\",\n );\n }\n }\n\n return {\n success: false,\n results,\n totalAttempts: attempt,\n fixesApplied,\n };\n }\n } else {\n // Cannot auto-fix this check\n if (check.canAutoFix) {\n log(\n `⚠️ ${check.displayName} can be fixed with: ${formatFixCommand(check)}`,\n \"warning\",\n );\n } else {\n log(`⚠️ ${check.displayName} requires manual fix`, \"error\");\n }\n\n // Show error details\n if (result.error) {\n const errorPreview = result.error.slice(0, 500);\n log(`\\n${chalk.dim(errorPreview)}`, \"error\");\n if (result.error.length > 500) {\n log(\n chalk.dim(`... (${result.error.length - 500} more characters)`),\n \"error\",\n );\n }\n }\n\n if (!dryRun) {\n return {\n success: false,\n results,\n totalAttempts: attempt,\n fixesApplied,\n };\n }\n }\n }\n }\n\n // Handle dry-run completion\n if (dryRun && pendingFixes.length > 0) {\n log(`\\n${\"━\".repeat(50)}`, \"info\");\n log(`📋 DRY-RUN SUMMARY`, \"info\");\n log(`${\"━\".repeat(50)}`, \"info\");\n log(`\\nThe following fixes would be applied:`, \"warning\");\n for (const fix of pendingFixes) {\n log(` • ${fix.check.displayName}: ${fix.command}`, \"info\");\n }\n log(`\\nRun without --dry-run to apply fixes.`, \"info\");\n\n return {\n success: false,\n results,\n totalAttempts: attempt,\n fixesApplied: 0,\n pendingFixes,\n };\n }\n\n // If all checks passed, we're done!\n if (allPassed) {\n return {\n success: true,\n results,\n totalAttempts: attempt,\n fixesApplied,\n };\n }\n\n // If no fix was applied this cycle but we still failed, we're stuck\n if (!fixAppliedThisCycle) {\n return {\n success: false,\n results,\n totalAttempts: attempt,\n fixesApplied,\n };\n }\n\n // Otherwise, continue to next cycle (fix was applied, need to re-verify)\n }\n\n // Max retries exceeded\n log(`\\n❌ Maximum retries (${maxRetries}) exceeded`, \"error\");\n\n return {\n success: false,\n results: [],\n totalAttempts: attempt,\n fixesApplied,\n };\n}\n\n/**\n * Check if there are uncommitted changes in git\n */\nexport async function hasUncommittedChanges(cwd: string): Promise<boolean> {\n try {\n const result = await execa(\"git\", [\"status\", \"--porcelain\"], { cwd });\n return result.stdout.trim().length > 0;\n } catch {\n return false;\n }\n}\n\n/**\n * Stage all changes in git\n */\nexport async function stageAllChanges(cwd: string): Promise<boolean> {\n try {\n await execa(\"git\", [\"add\", \"-A\"], { cwd });\n return true;\n } catch {\n return false;\n }\n}\n"],"mappings":";AAOA,SAAS,aAA8B;AACvC,OAAO,WAAW;AA0CX,IAAM,iBAAoC;AAAA,EAC/C;AAAA,IACE,MAAM;AAAA,IACN,aAAa;AAAA,IACb,SAAS;AAAA,IACT,MAAM,CAAC,WAAW;AAAA,IAClB,YAAY;AAAA;AAAA,EACd;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,aAAa;AAAA,IACb,SAAS;AAAA,IACT,MAAM,CAAC,MAAM;AAAA,IACb,YAAY;AAAA,IACZ,SAAS,CAAC,QAAQ,OAAO;AAAA,IACzB,YAAY;AAAA,EACd;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,aAAa;AAAA,IACb,SAAS;AAAA,IACT,MAAM,CAAC,UAAU,SAAS;AAAA,IAC1B,YAAY;AAAA,IACZ,SAAS,CAAC,QAAQ;AAAA,IAClB,YAAY;AAAA,EACd;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,aAAa;AAAA,IACb,SAAS;AAAA,IACT,MAAM,CAAC,MAAM;AAAA,IACb,YAAY;AAAA;AAAA,EACd;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,aAAa;AAAA,IACb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AAS;AAAA,QACT;AAAA,QACA,eAAe;AAAA,QACf;AAAA,MACF;AAAA,IACF;AAAA,EAGF;AAGA,MAAI;AAAA,0BAAwB,UAAU,cAAc,OAAO;AAE3D,SAAO;AAAA,IACL,SAAS;AAAA,IACT,SAAS,CAAC;AAAA,IACV,eAAe;AAAA,IACf;AAAA,EACF;AACF;AAKA,eAAsB,sBAAsB,KAA+B;AACzE,MAAI;AACF,UAAM,SAAS,MAAM,MAAM,OAAO,CAAC,UAAU,aAAa,GAAG,EAAE,IAAI,CAAC;AACpE,WAAO,OAAO,OAAO,KAAK,EAAE,SAAS;AAAA,EACvC,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAKA,eAAsB,gBAAgB,KAA+B;AACnE,MAAI;AACF,UAAM,MAAM,OAAO,CAAC,OAAO,IAAI,GAAG,EAAE,IAAI,CAAC;AACzC,WAAO;AAAA,EACT,QAAQ;AACN,WAAO;AAAA,EACT;AACF;","names":[]}
@@ -0,0 +1,165 @@
1
+ // src/config/index.ts
2
+ import { cosmiconfig } from "cosmiconfig";
3
+
4
+ // src/config/schema.ts
5
+ import { z } from "zod";
6
+ var RESERVED_SCOPE_NAMES = [
7
+ "init",
8
+ "create",
9
+ "build",
10
+ "test",
11
+ "config",
12
+ "docs",
13
+ "ci",
14
+ "deps"
15
+ ];
16
+ var ScopeSchema = z.object({
17
+ name: z.string().min(1).max(32, "Scope name must be 32 characters or less").regex(
18
+ /^[a-z0-9-]+$/,
19
+ "Scope name must be lowercase alphanumeric with hyphens"
20
+ ).refine((name) => !RESERVED_SCOPE_NAMES.includes(name), {
21
+ message: `Scope name cannot be a reserved word: ${RESERVED_SCOPE_NAMES.join(", ")}`
22
+ }),
23
+ description: z.string().min(10, "Scope description must be at least 10 characters"),
24
+ emoji: z.string().optional(),
25
+ category: z.enum([
26
+ "auth",
27
+ "features",
28
+ "infrastructure",
29
+ "documentation",
30
+ "testing",
31
+ "performance",
32
+ "other"
33
+ ]).optional()
34
+ });
35
+ var BranchTypeSchema = z.enum([
36
+ "feature",
37
+ "bugfix",
38
+ "hotfix",
39
+ "chore",
40
+ "refactor",
41
+ "docs",
42
+ "test",
43
+ "release"
44
+ ]);
45
+ var ConventionalTypeSchema = z.enum([
46
+ "feat",
47
+ "fix",
48
+ "refactor",
49
+ "chore",
50
+ "docs",
51
+ "test",
52
+ "perf",
53
+ "style",
54
+ "ci",
55
+ "build",
56
+ "revert"
57
+ ]);
58
+ var EnforcementLevelSchema = z.enum([
59
+ "strict",
60
+ "advisory",
61
+ "learning"
62
+ ]);
63
+ var AnalyticsConfigSchema = z.object({
64
+ enabled: z.boolean().default(false),
65
+ shareAnonymous: z.boolean().default(false)
66
+ });
67
+ var CIConfigSchema = z.object({
68
+ provider: z.enum(["github", "gitlab", "azure"]).default("github"),
69
+ nodeVersions: z.array(z.string()).optional(),
70
+ defaultBranch: z.string().default("main"),
71
+ checks: z.array(z.enum(["lint", "typecheck", "format", "build", "test"])).optional()
72
+ });
73
+ var HooksConfigSchema = z.object({
74
+ preCommit: z.array(z.string()).optional(),
75
+ commitMsg: z.array(z.string()).optional(),
76
+ prePush: z.array(z.string()).optional()
77
+ });
78
+ var GuidelinesConfigSchema = z.object({
79
+ mandatoryTemplates: z.array(z.string()).optional(),
80
+ optionalTemplates: z.array(z.string()).optional(),
81
+ customTemplatesDir: z.string().optional(),
82
+ additionalMandatory: z.array(z.string()).optional(),
83
+ optionalOverrides: z.array(z.string()).optional()
84
+ });
85
+ var WorkflowConfigSchema = z.object({
86
+ projectName: z.string().min(1),
87
+ scopes: z.array(ScopeSchema).min(1),
88
+ branchTypes: z.array(BranchTypeSchema).optional(),
89
+ conventionalTypes: z.array(ConventionalTypeSchema).optional(),
90
+ enforcement: EnforcementLevelSchema.default("strict"),
91
+ language: z.string().default("en"),
92
+ analytics: AnalyticsConfigSchema.optional(),
93
+ adapter: z.string().optional(),
94
+ syncRemote: z.string().optional(),
95
+ ci: CIConfigSchema.optional(),
96
+ hooks: HooksConfigSchema.optional(),
97
+ guidelines: GuidelinesConfigSchema.optional()
98
+ });
99
+ function validateScopeDefinitions(scopes) {
100
+ const errors = [];
101
+ const seenNames = /* @__PURE__ */ new Set();
102
+ for (const scope of scopes) {
103
+ if (seenNames.has(scope.name)) {
104
+ errors.push(`Duplicate scope name: "${scope.name}"`);
105
+ }
106
+ seenNames.add(scope.name);
107
+ const result = ScopeSchema.safeParse(scope);
108
+ if (!result.success) {
109
+ result.error.errors.forEach((err) => {
110
+ errors.push(`Scope "${scope.name}": ${err.message}`);
111
+ });
112
+ }
113
+ }
114
+ return {
115
+ valid: errors.length === 0,
116
+ errors
117
+ };
118
+ }
119
+
120
+ // src/config/index.ts
121
+ import { join } from "path";
122
+ import { existsSync } from "fs";
123
+ var explorer = cosmiconfig("workflow", {
124
+ searchPlaces: [
125
+ "workflow.config.ts",
126
+ "workflow.config.js",
127
+ "workflow.config.json",
128
+ ".workflowrc",
129
+ ".workflowrc.json",
130
+ "package.json"
131
+ ]
132
+ });
133
+ async function loadConfig(cwd = process.cwd()) {
134
+ try {
135
+ const result = await explorer.search(cwd);
136
+ if (!result || !result.config) {
137
+ return null;
138
+ }
139
+ const validated = WorkflowConfigSchema.parse(result.config);
140
+ return validated;
141
+ } catch (error) {
142
+ if (error instanceof Error) {
143
+ throw new Error(`Failed to load workflow config: ${error.message}`);
144
+ }
145
+ throw error;
146
+ }
147
+ }
148
+ function hasConfig(cwd = process.cwd()) {
149
+ const configPaths = [
150
+ "workflow.config.ts",
151
+ "workflow.config.js",
152
+ "workflow.config.json",
153
+ ".workflowrc",
154
+ ".workflowrc.json"
155
+ ];
156
+ return configPaths.some((path) => existsSync(join(cwd, path)));
157
+ }
158
+
159
+ export {
160
+ WorkflowConfigSchema,
161
+ validateScopeDefinitions,
162
+ loadConfig,
163
+ hasConfig
164
+ };
165
+ //# sourceMappingURL=chunk-RDVTKGQV.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/config/index.ts","../src/config/schema.ts"],"sourcesContent":["import { cosmiconfig } from \"cosmiconfig\";\nimport { WorkflowConfig, WorkflowConfigSchema } from \"./schema.js\";\nimport { join } from \"path\";\nimport { existsSync } from \"fs\";\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 Error) {\n throw new Error(`Failed to load workflow config: ${error.message}`);\n }\n throw error;\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} from \"./schema.js\";\n","import { z } from \"zod\";\n\n// Reserved scope names that cannot be used\nconst RESERVED_SCOPE_NAMES = [\n \"init\",\n \"create\",\n \"build\",\n \"test\",\n \"config\",\n \"docs\",\n \"ci\",\n \"deps\",\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 .refine((name) => !RESERVED_SCOPE_NAMES.includes(name), {\n message: `Scope name cannot be a reserved word: ${RESERVED_SCOPE_NAMES.join(\", \")}`,\n }),\n description: z\n .string()\n .min(10, \"Scope description must be at least 10 characters\"),\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 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 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\nexport const CIConfigSchema = z.object({\n provider: z.enum([\"github\", \"gitlab\", \"azure\"]).default(\"github\"),\n nodeVersions: z.array(z.string()).optional(),\n defaultBranch: z.string().default(\"main\"),\n checks: z\n .array(z.enum([\"lint\", \"typecheck\", \"format\", \"build\", \"test\"]))\n .optional(),\n});\n\nexport const HooksConfigSchema = z.object({\n preCommit: z.array(z.string()).optional(),\n commitMsg: z.array(z.string()).optional(),\n prePush: z.array(z.string()).optional(),\n});\n\nexport const GuidelinesConfigSchema = z.object({\n mandatoryTemplates: z.array(z.string()).optional(),\n optionalTemplates: z.array(z.string()).optional(),\n customTemplatesDir: z.string().optional(),\n additionalMandatory: z.array(z.string()).optional(),\n optionalOverrides: z.array(z.string()).optional(),\n});\n\nexport const WorkflowConfigSchema = z.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 ci: CIConfigSchema.optional(),\n hooks: HooksConfigSchema.optional(),\n guidelines: GuidelinesConfigSchema.optional(),\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 CIConfig = z.infer<typeof CIConfigSchema>;\nexport type HooksConfig = z.infer<typeof HooksConfigSchema>;\nexport type GuidelinesConfig = z.infer<typeof GuidelinesConfigSchema>;\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;AAGlB,IAAM,uBAAuB;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEO,IAAM,cAAc,EAAE,OAAO;AAAA,EAClC,MAAM,EAC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