workflow-agent-cli 2.22.1 → 2.22.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.
- package/dist/{chunk-KVM6A42U.js → chunk-3ADL5QDN.js} +84 -9
- package/dist/chunk-3ADL5QDN.js.map +1 -0
- package/dist/{chunk-OMHCXETM.js → chunk-3ARRW423.js} +2 -2
- package/dist/cli/index.js +3 -3
- package/dist/index.d.ts +5 -1
- package/dist/index.js +5 -1
- package/dist/verify-XGCZKY7S.js +8 -0
- package/package.json +1 -1
- package/dist/chunk-KVM6A42U.js.map +0 -1
- package/dist/verify-2PDVNYWV.js +0 -8
- /package/dist/{chunk-OMHCXETM.js.map → chunk-3ARRW423.js.map} +0 -0
- /package/dist/{verify-2PDVNYWV.js.map → verify-XGCZKY7S.js.map} +0 -0
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
// src/utils/check-runner.ts
|
|
2
2
|
import { execa } from "execa";
|
|
3
3
|
import chalk from "chalk";
|
|
4
|
+
import { existsSync, readFileSync } from "fs";
|
|
5
|
+
import { join } from "path";
|
|
4
6
|
var QUALITY_CHECKS = [
|
|
5
7
|
{
|
|
6
8
|
name: "typecheck",
|
|
7
9
|
displayName: "Type Check",
|
|
8
10
|
command: "pnpm",
|
|
9
11
|
args: ["typecheck"],
|
|
10
|
-
canAutoFix: false
|
|
12
|
+
canAutoFix: false,
|
|
11
13
|
// TypeScript errors need manual/LLM fix
|
|
14
|
+
requiredScript: "typecheck",
|
|
15
|
+
fallbackCommand: ["tsc", "--noEmit"]
|
|
12
16
|
},
|
|
13
17
|
{
|
|
14
18
|
name: "lint",
|
|
@@ -17,7 +21,8 @@ var QUALITY_CHECKS = [
|
|
|
17
21
|
args: ["lint"],
|
|
18
22
|
fixCommand: "pnpm",
|
|
19
23
|
fixArgs: ["lint", "--fix"],
|
|
20
|
-
canAutoFix: true
|
|
24
|
+
canAutoFix: true,
|
|
25
|
+
requiredScript: "lint"
|
|
21
26
|
},
|
|
22
27
|
{
|
|
23
28
|
name: "format",
|
|
@@ -26,25 +31,74 @@ var QUALITY_CHECKS = [
|
|
|
26
31
|
args: ["format", "--check"],
|
|
27
32
|
fixCommand: "pnpm",
|
|
28
33
|
fixArgs: ["format"],
|
|
29
|
-
canAutoFix: true
|
|
34
|
+
canAutoFix: true,
|
|
35
|
+
requiredScript: "format"
|
|
30
36
|
},
|
|
31
37
|
{
|
|
32
38
|
name: "test",
|
|
33
39
|
displayName: "Tests",
|
|
34
40
|
command: "pnpm",
|
|
35
41
|
args: ["test"],
|
|
36
|
-
canAutoFix: false
|
|
42
|
+
canAutoFix: false,
|
|
37
43
|
// Tests need manual/LLM fix
|
|
44
|
+
requiredScript: "test"
|
|
38
45
|
},
|
|
39
46
|
{
|
|
40
47
|
name: "build",
|
|
41
48
|
displayName: "Build",
|
|
42
49
|
command: "pnpm",
|
|
43
50
|
args: ["build"],
|
|
44
|
-
canAutoFix: false
|
|
51
|
+
canAutoFix: false,
|
|
45
52
|
// Build errors need manual/LLM fix
|
|
53
|
+
requiredScript: "build"
|
|
46
54
|
}
|
|
47
55
|
];
|
|
56
|
+
function getAvailableScripts(cwd) {
|
|
57
|
+
const packageJsonPath = join(cwd, "package.json");
|
|
58
|
+
if (!existsSync(packageJsonPath)) {
|
|
59
|
+
return /* @__PURE__ */ new Set();
|
|
60
|
+
}
|
|
61
|
+
try {
|
|
62
|
+
const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
|
|
63
|
+
return new Set(Object.keys(packageJson.scripts || {}));
|
|
64
|
+
} catch {
|
|
65
|
+
return /* @__PURE__ */ new Set();
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
async function commandExists(cmd) {
|
|
69
|
+
try {
|
|
70
|
+
await execa("which", [cmd]);
|
|
71
|
+
return true;
|
|
72
|
+
} catch {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
async function getApplicableChecks(cwd) {
|
|
77
|
+
const availableScripts = getAvailableScripts(cwd);
|
|
78
|
+
const applicableChecks = [];
|
|
79
|
+
for (const check of QUALITY_CHECKS) {
|
|
80
|
+
if (!check.requiredScript) {
|
|
81
|
+
applicableChecks.push(check);
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
if (availableScripts.has(check.requiredScript)) {
|
|
85
|
+
applicableChecks.push(check);
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
if (check.fallbackCommand && check.fallbackCommand.length > 0) {
|
|
89
|
+
const fallbackCmd = check.fallbackCommand[0];
|
|
90
|
+
if (await commandExists(fallbackCmd)) {
|
|
91
|
+
applicableChecks.push({
|
|
92
|
+
...check,
|
|
93
|
+
command: fallbackCmd,
|
|
94
|
+
args: check.fallbackCommand.slice(1)
|
|
95
|
+
});
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return applicableChecks;
|
|
101
|
+
}
|
|
48
102
|
async function runCheck(check, cwd) {
|
|
49
103
|
const startTime = Date.now();
|
|
50
104
|
try {
|
|
@@ -138,6 +192,25 @@ async function runAllChecks(cwd, options = {}) {
|
|
|
138
192
|
let fixesApplied = 0;
|
|
139
193
|
const appliedFixes = [];
|
|
140
194
|
const pendingFixes = [];
|
|
195
|
+
const applicableChecks = await getApplicableChecks(cwd);
|
|
196
|
+
const skippedChecks = QUALITY_CHECKS.filter(
|
|
197
|
+
(qc) => !applicableChecks.some((ac) => ac.name === qc.name)
|
|
198
|
+
);
|
|
199
|
+
if (skippedChecks.length > 0) {
|
|
200
|
+
log(`
|
|
201
|
+
\u23ED\uFE0F Skipping checks (scripts not found): ${skippedChecks.map((c) => c.displayName).join(", ")}`, "warning");
|
|
202
|
+
}
|
|
203
|
+
if (applicableChecks.length === 0) {
|
|
204
|
+
log(`
|
|
205
|
+
\u26A0\uFE0F No applicable checks found. Add scripts to package.json: typecheck, lint, format, test, build`, "warning");
|
|
206
|
+
return {
|
|
207
|
+
success: true,
|
|
208
|
+
results: [],
|
|
209
|
+
totalAttempts: 0,
|
|
210
|
+
fixesApplied: 0,
|
|
211
|
+
appliedFixes: []
|
|
212
|
+
};
|
|
213
|
+
}
|
|
141
214
|
while (attempt < maxRetries) {
|
|
142
215
|
attempt++;
|
|
143
216
|
log(`
|
|
@@ -148,10 +221,10 @@ ${"\u2501".repeat(50)}`, "info");
|
|
|
148
221
|
const results = [];
|
|
149
222
|
let allPassed = true;
|
|
150
223
|
let fixAppliedThisCycle = false;
|
|
151
|
-
for (let i = 0; i <
|
|
152
|
-
const check =
|
|
224
|
+
for (let i = 0; i < applicableChecks.length; i++) {
|
|
225
|
+
const check = applicableChecks[i];
|
|
153
226
|
const stepNum = i + 1;
|
|
154
|
-
const totalSteps =
|
|
227
|
+
const totalSteps = applicableChecks.length;
|
|
155
228
|
log(`\u{1F4CB} Step ${stepNum}/${totalSteps}: ${check.displayName}...`, "info");
|
|
156
229
|
const result = await runCheck(check, cwd);
|
|
157
230
|
results.push(result);
|
|
@@ -312,10 +385,12 @@ async function stageAllChanges(cwd) {
|
|
|
312
385
|
|
|
313
386
|
export {
|
|
314
387
|
QUALITY_CHECKS,
|
|
388
|
+
getAvailableScripts,
|
|
389
|
+
getApplicableChecks,
|
|
315
390
|
runCheck,
|
|
316
391
|
applyFix,
|
|
317
392
|
runAllChecks,
|
|
318
393
|
hasUncommittedChanges,
|
|
319
394
|
stageAllChanges
|
|
320
395
|
};
|
|
321
|
-
//# sourceMappingURL=chunk-
|
|
396
|
+
//# sourceMappingURL=chunk-3ADL5QDN.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\";\nimport { existsSync, readFileSync } from \"fs\";\nimport { join } from \"path\";\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 /** The npm script name this check depends on (e.g., \"typecheck\", \"lint\") */\n requiredScript?: string;\n /** Fallback command if the script doesn't exist (e.g., [\"tsc\", \"--noEmit\"]) */\n fallbackCommand?: string[];\n}\n\nexport interface CheckResult {\n check: CheckDefinition;\n success: boolean;\n output: string;\n error?: string;\n duration: number;\n}\n\nexport interface AppliedFix {\n checkName: string;\n displayName: string;\n command: string;\n timestamp: Date;\n}\n\nexport interface RunAllChecksResult {\n success: boolean;\n results: CheckResult[];\n totalAttempts: number;\n fixesApplied: number;\n appliedFixes: AppliedFix[];\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 requiredScript: \"typecheck\",\n fallbackCommand: [\"tsc\", \"--noEmit\"],\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 requiredScript: \"lint\",\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 requiredScript: \"format\",\n },\n {\n name: \"test\",\n displayName: \"Tests\",\n command: \"pnpm\",\n args: [\"test\"],\n canAutoFix: false, // Tests need manual/LLM fix\n requiredScript: \"test\",\n },\n {\n name: \"build\",\n displayName: \"Build\",\n command: \"pnpm\",\n args: [\"build\"],\n canAutoFix: false, // Build errors need manual/LLM fix\n requiredScript: \"build\",\n },\n];\n\n/**\n * Get available scripts from the target project's package.json\n */\nexport function getAvailableScripts(cwd: string): Set<string> {\n const packageJsonPath = join(cwd, \"package.json\");\n \n if (!existsSync(packageJsonPath)) {\n return new Set();\n }\n \n try {\n const packageJson = JSON.parse(readFileSync(packageJsonPath, \"utf-8\"));\n return new Set(Object.keys(packageJson.scripts || {}));\n } catch {\n return new Set();\n }\n}\n\n/**\n * Check if a command exists in PATH\n */\nasync function commandExists(cmd: string): Promise<boolean> {\n try {\n await execa(\"which\", [cmd]);\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Get applicable checks for the target project\n * Filters out checks for scripts that don't exist, uses fallbacks when available\n */\nexport async function getApplicableChecks(cwd: string): Promise<CheckDefinition[]> {\n const availableScripts = getAvailableScripts(cwd);\n const applicableChecks: CheckDefinition[] = [];\n \n for (const check of QUALITY_CHECKS) {\n // If no required script, always include\n if (!check.requiredScript) {\n applicableChecks.push(check);\n continue;\n }\n \n // If the script exists in package.json, use the pnpm command\n if (availableScripts.has(check.requiredScript)) {\n applicableChecks.push(check);\n continue;\n }\n \n // If there's a fallback command and it exists, use that\n if (check.fallbackCommand && check.fallbackCommand.length > 0) {\n const fallbackCmd = check.fallbackCommand[0];\n if (await commandExists(fallbackCmd)) {\n applicableChecks.push({\n ...check,\n command: fallbackCmd,\n args: check.fallbackCommand.slice(1),\n });\n continue;\n }\n }\n \n // Script doesn't exist and no valid fallback - skip this check\n // (will be logged as skipped in runAllChecks)\n }\n \n return applicableChecks;\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 appliedFixes: AppliedFix[] = [];\n const pendingFixes: Array<{ check: CheckDefinition; command: string }> = [];\n\n // Get applicable checks for this project (filters out missing scripts)\n const applicableChecks = await getApplicableChecks(cwd);\n \n // Log skipped checks\n const skippedChecks = QUALITY_CHECKS.filter(\n qc => !applicableChecks.some(ac => ac.name === qc.name)\n );\n if (skippedChecks.length > 0) {\n log(`\\n⏭️ Skipping checks (scripts not found): ${skippedChecks.map(c => c.displayName).join(\", \")}`, \"warning\");\n }\n \n if (applicableChecks.length === 0) {\n log(`\\n⚠️ No applicable checks found. Add scripts to package.json: typecheck, lint, format, test, build`, \"warning\");\n return {\n success: true,\n results: [],\n totalAttempts: 0,\n fixesApplied: 0,\n appliedFixes: [],\n };\n }\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 < applicableChecks.length; i++) {\n const check = applicableChecks[i];\n const stepNum = i + 1;\n const totalSteps = applicableChecks.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 appliedFixes.push({\n checkName: check.name,\n displayName: check.displayName,\n command: formatFixCommand(check),\n timestamp: new Date(),\n });\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 appliedFixes,\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 appliedFixes,\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 appliedFixes: [],\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 appliedFixes,\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 appliedFixes,\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 appliedFixes,\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;AAClB,SAAS,YAAY,oBAAoB;AACzC,SAAS,YAAY;AAsDd,IAAM,iBAAoC;AAAA,EAC/C;AAAA,IACE,MAAM;AAAA,IACN,aAAa;AAAA,IACb,SAAS;AAAA,IACT,MAAM,CAAC,WAAW;AAAA,IAClB,YAAY;AAAA;AAAA,IACZ,gBAAgB;AAAA,IAChB,iBAAiB,CAAC,OAAO,UAAU;AAAA,EACrC;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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KA,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":[]}
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
hasUncommittedChanges,
|
|
3
3
|
runAllChecks,
|
|
4
4
|
stageAllChanges
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-3ADL5QDN.js";
|
|
6
6
|
|
|
7
7
|
// src/cli/commands/verify.ts
|
|
8
8
|
import chalk from "chalk";
|
|
@@ -235,4 +235,4 @@ async function recordSuccessfulFixes(cwd, result) {
|
|
|
235
235
|
export {
|
|
236
236
|
verifyCommand
|
|
237
237
|
};
|
|
238
|
-
//# sourceMappingURL=chunk-
|
|
238
|
+
//# sourceMappingURL=chunk-3ARRW423.js.map
|
package/dist/cli/index.js
CHANGED
|
@@ -36,8 +36,8 @@ import {
|
|
|
36
36
|
} from "../chunk-YELUGXOM.js";
|
|
37
37
|
import {
|
|
38
38
|
verifyCommand
|
|
39
|
-
} from "../chunk-
|
|
40
|
-
import "../chunk-
|
|
39
|
+
} from "../chunk-3ARRW423.js";
|
|
40
|
+
import "../chunk-3ADL5QDN.js";
|
|
41
41
|
import {
|
|
42
42
|
syncCommand
|
|
43
43
|
} from "../chunk-WXHRDBAB.js";
|
|
@@ -8298,7 +8298,7 @@ async function hooksTestCommand(options) {
|
|
|
8298
8298
|
if (options.dryRun) {
|
|
8299
8299
|
console.log(chalk22.bold.cyan("\n Dry-run hook simulation:\n"));
|
|
8300
8300
|
console.log(chalk22.dim(" Simulating pre-commit hook..."));
|
|
8301
|
-
const { verifyCommand: verifyCommand2 } = await import("../verify-
|
|
8301
|
+
const { verifyCommand: verifyCommand2 } = await import("../verify-XGCZKY7S.js");
|
|
8302
8302
|
try {
|
|
8303
8303
|
await verifyCommand2({ fix: false, dryRun: true, maxRetries: "1" });
|
|
8304
8304
|
} catch {
|
package/dist/index.d.ts
CHANGED
|
@@ -11,6 +11,8 @@ interface CheckDefinition {
|
|
|
11
11
|
fixCommand?: string;
|
|
12
12
|
fixArgs?: string[];
|
|
13
13
|
canAutoFix: boolean;
|
|
14
|
+
requiredScript?: string;
|
|
15
|
+
fallbackCommand?: string[];
|
|
14
16
|
}
|
|
15
17
|
interface CheckResult {
|
|
16
18
|
check: CheckDefinition;
|
|
@@ -44,6 +46,8 @@ interface CheckRunnerOptions {
|
|
|
44
46
|
onProgress?: (message: string, type: ProgressType) => void;
|
|
45
47
|
}
|
|
46
48
|
declare const QUALITY_CHECKS: CheckDefinition[];
|
|
49
|
+
declare function getAvailableScripts(cwd: string): Set<string>;
|
|
50
|
+
declare function getApplicableChecks(cwd: string): Promise<CheckDefinition[]>;
|
|
47
51
|
declare function runCheck(check: CheckDefinition, cwd: string): Promise<CheckResult>;
|
|
48
52
|
declare function applyFix(check: CheckDefinition, cwd: string): Promise<{
|
|
49
53
|
success: boolean;
|
|
@@ -120,4 +124,4 @@ declare function generateAuditReport(projectPath?: string): Promise<AuditReport>
|
|
|
120
124
|
declare function formatAuditReport(report: AuditReport): string;
|
|
121
125
|
declare function runAllSetups(projectPath?: string, onProgress?: (step: string, status: "start" | "done" | "error") => void): Promise<SetupResult[]>;
|
|
122
126
|
|
|
123
|
-
export { type AppliedFix, type AuditReport, type CheckDefinition, type CheckResult, type CheckRunnerOptions, type ConfigChange, type ExistingConfigs, type ExistingScripts, type FrameworkType, type ProgressType, type ProjectAnalysis, QUALITY_CHECKS, type RunAllChecksResult, type SetupPlan, type SetupResult, analyzeProject, applyFix, formatAuditReport, generateAuditReport, hasUncommittedChanges, runAllChecks, runAllSetups, runCheck, stageAllChanges };
|
|
127
|
+
export { type AppliedFix, type AuditReport, type CheckDefinition, type CheckResult, type CheckRunnerOptions, type ConfigChange, type ExistingConfigs, type ExistingScripts, type FrameworkType, type ProgressType, type ProjectAnalysis, QUALITY_CHECKS, type RunAllChecksResult, type SetupPlan, type SetupResult, analyzeProject, applyFix, formatAuditReport, generateAuditReport, getApplicableChecks, getAvailableScripts, hasUncommittedChanges, runAllChecks, runAllSetups, runCheck, stageAllChanges };
|
package/dist/index.js
CHANGED
|
@@ -31,11 +31,13 @@ import {
|
|
|
31
31
|
import {
|
|
32
32
|
QUALITY_CHECKS,
|
|
33
33
|
applyFix,
|
|
34
|
+
getApplicableChecks,
|
|
35
|
+
getAvailableScripts,
|
|
34
36
|
hasUncommittedChanges,
|
|
35
37
|
runAllChecks,
|
|
36
38
|
runCheck,
|
|
37
39
|
stageAllChanges
|
|
38
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-3ADL5QDN.js";
|
|
39
41
|
export {
|
|
40
42
|
QUALITY_CHECKS,
|
|
41
43
|
WorkflowConfigSchema,
|
|
@@ -50,6 +52,8 @@ export {
|
|
|
50
52
|
formatAuditReport,
|
|
51
53
|
generateAuditReport,
|
|
52
54
|
getAllScopes,
|
|
55
|
+
getApplicableChecks,
|
|
56
|
+
getAvailableScripts,
|
|
53
57
|
hasConfig,
|
|
54
58
|
hasUncommittedChanges,
|
|
55
59
|
invalidateCustomScopesCache,
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
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 AppliedFix {\n checkName: string;\n displayName: string;\n command: string;\n timestamp: Date;\n}\n\nexport interface RunAllChecksResult {\n success: boolean;\n results: CheckResult[];\n totalAttempts: number;\n fixesApplied: number;\n appliedFixes: AppliedFix[];\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 appliedFixes: AppliedFix[] = [];\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 appliedFixes.push({\n checkName: check.name,\n displayName: check.displayName,\n command: formatFixCommand(check),\n timestamp: new Date(),\n });\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 appliedFixes,\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 appliedFixes,\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 appliedFixes: [],\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 appliedFixes,\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 appliedFixes,\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 appliedFixes,\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;AAkDX,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,SAAS;AAAA,IACT,MAAM,CAAC,OAAO;AAAA,IACd,YAAY;AAAA;AAAA,EACd;AACF;AAKA,eAAsB,SACpB,OACA,KACsB;AACtB,QAAM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ACT;AAAA,QACA,eAAe;AAAA,QACf;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAGA,QAAI,CAAC,qBAAqB;AACxB,aAAO;AAAA,QACL,SAAS;AAAA,QACT;AAAA,QACA,eAAe;AAAA,QACf;AAAA,QACA;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,IACA;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":[]}
|
package/dist/verify-2PDVNYWV.js
DELETED
|
File without changes
|
|
File without changes
|