workflow-agent-cli 2.22.0 → 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 +47 -39
- package/dist/cli/index.js.map +1 -1
- 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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,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":[]}
|
|
@@ -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";
|
|
@@ -45,6 +45,9 @@ import {
|
|
|
45
45
|
// src/cli/index.ts
|
|
46
46
|
import { Command as Command7 } from "commander";
|
|
47
47
|
import chalk23 from "chalk";
|
|
48
|
+
import { readFileSync as readFileSync3 } from "fs";
|
|
49
|
+
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
50
|
+
import { dirname as dirname5, join as join12 } from "path";
|
|
48
51
|
|
|
49
52
|
// src/cli/commands/init.ts
|
|
50
53
|
import * as p from "@clack/prompts";
|
|
@@ -924,23 +927,23 @@ async function setupCommand() {
|
|
|
924
927
|
process.exit(1);
|
|
925
928
|
}
|
|
926
929
|
const packageJsonContent = readFileSync(packageJsonPath, "utf-8");
|
|
927
|
-
const
|
|
928
|
-
if (!
|
|
929
|
-
|
|
930
|
+
const packageJson2 = JSON.parse(packageJsonContent);
|
|
931
|
+
if (!packageJson2.scripts) {
|
|
932
|
+
packageJson2.scripts = {};
|
|
930
933
|
}
|
|
931
934
|
let scriptAdded = false;
|
|
932
935
|
let scriptUpdated = false;
|
|
933
936
|
const removedScripts = [];
|
|
934
937
|
for (const deprecatedScript of DEPRECATED_SCRIPTS) {
|
|
935
|
-
if (
|
|
936
|
-
delete
|
|
938
|
+
if (packageJson2.scripts[deprecatedScript] !== void 0) {
|
|
939
|
+
delete packageJson2.scripts[deprecatedScript];
|
|
937
940
|
removedScripts.push(deprecatedScript);
|
|
938
941
|
}
|
|
939
942
|
}
|
|
940
|
-
const oldScripts = validateAllScripts(
|
|
943
|
+
const oldScripts = validateAllScripts(packageJson2.scripts);
|
|
941
944
|
for (const oldScript of oldScripts) {
|
|
942
|
-
if (
|
|
943
|
-
delete
|
|
945
|
+
if (packageJson2.scripts[oldScript] !== void 0) {
|
|
946
|
+
delete packageJson2.scripts[oldScript];
|
|
944
947
|
if (!removedScripts.includes(oldScript)) {
|
|
945
948
|
removedScripts.push(oldScript);
|
|
946
949
|
}
|
|
@@ -948,11 +951,11 @@ async function setupCommand() {
|
|
|
948
951
|
}
|
|
949
952
|
const scriptName = "workflow";
|
|
950
953
|
const scriptCommand = WORKFLOW_SCRIPTS.workflow;
|
|
951
|
-
if (!
|
|
952
|
-
|
|
954
|
+
if (!packageJson2.scripts[scriptName]) {
|
|
955
|
+
packageJson2.scripts[scriptName] = scriptCommand;
|
|
953
956
|
scriptAdded = true;
|
|
954
|
-
} else if (
|
|
955
|
-
|
|
957
|
+
} else if (packageJson2.scripts[scriptName] !== scriptCommand) {
|
|
958
|
+
packageJson2.scripts[scriptName] = scriptCommand;
|
|
956
959
|
scriptUpdated = true;
|
|
957
960
|
}
|
|
958
961
|
const hasChanges = scriptAdded || scriptUpdated || removedScripts.length > 0;
|
|
@@ -964,7 +967,7 @@ async function setupCommand() {
|
|
|
964
967
|
}
|
|
965
968
|
writeFileSync(
|
|
966
969
|
packageJsonPath,
|
|
967
|
-
JSON.stringify(
|
|
970
|
+
JSON.stringify(packageJson2, null, 2) + "\n",
|
|
968
971
|
"utf-8"
|
|
969
972
|
);
|
|
970
973
|
console.log(
|
|
@@ -1373,7 +1376,7 @@ async function scopeCreateCommand(options) {
|
|
|
1373
1376
|
spinner10.start("Creating package structure...");
|
|
1374
1377
|
try {
|
|
1375
1378
|
await mkdir3(join5(outputDir, "src"), { recursive: true });
|
|
1376
|
-
const
|
|
1379
|
+
const packageJson2 = {
|
|
1377
1380
|
name: `@workflow/scopes-${packageName}`,
|
|
1378
1381
|
version: "1.0.0",
|
|
1379
1382
|
description: `Scope preset for ${presetName}`,
|
|
@@ -1414,7 +1417,7 @@ async function scopeCreateCommand(options) {
|
|
|
1414
1417
|
};
|
|
1415
1418
|
await writeFile3(
|
|
1416
1419
|
join5(outputDir, "package.json"),
|
|
1417
|
-
JSON.stringify(
|
|
1420
|
+
JSON.stringify(packageJson2, null, 2),
|
|
1418
1421
|
"utf-8"
|
|
1419
1422
|
);
|
|
1420
1423
|
const tsconfig = {
|
|
@@ -1685,7 +1688,7 @@ async function scopeMigrateCommand(options) {
|
|
|
1685
1688
|
spinner10.start("Migrating scopes to package...");
|
|
1686
1689
|
try {
|
|
1687
1690
|
await mkdir4(join6(outputDir, "src"), { recursive: true });
|
|
1688
|
-
const
|
|
1691
|
+
const packageJson2 = {
|
|
1689
1692
|
name: `@workflow/scopes-${packageName}`,
|
|
1690
1693
|
version: "1.0.0",
|
|
1691
1694
|
description: `Migrated scope preset for ${presetName}`,
|
|
@@ -1726,7 +1729,7 @@ async function scopeMigrateCommand(options) {
|
|
|
1726
1729
|
};
|
|
1727
1730
|
await writeFile4(
|
|
1728
1731
|
join6(outputDir, "package.json"),
|
|
1729
|
-
JSON.stringify(
|
|
1732
|
+
JSON.stringify(packageJson2, null, 2),
|
|
1730
1733
|
"utf-8"
|
|
1731
1734
|
);
|
|
1732
1735
|
const tsconfig = {
|
|
@@ -2377,9 +2380,9 @@ var AdvisoryAnalyzer = class {
|
|
|
2377
2380
|
* Executive depth: High-level business summary only
|
|
2378
2381
|
*/
|
|
2379
2382
|
async analyzeExecutive(timestamp, project) {
|
|
2380
|
-
const
|
|
2381
|
-
const deps =
|
|
2382
|
-
const devDeps =
|
|
2383
|
+
const packageJson2 = await this.readPackageJson();
|
|
2384
|
+
const deps = packageJson2.dependencies || {};
|
|
2385
|
+
const devDeps = packageJson2.devDependencies || {};
|
|
2383
2386
|
const techCategories = this.categorizeTechnologies(deps, devDeps);
|
|
2384
2387
|
const risks = this.calculateExecutiveRisks(project, techCategories);
|
|
2385
2388
|
const opportunities = this.calculateExecutiveOpportunities(
|
|
@@ -2413,18 +2416,18 @@ var AdvisoryAnalyzer = class {
|
|
|
2413
2416
|
* Analyze project overview
|
|
2414
2417
|
*/
|
|
2415
2418
|
async analyzeProject() {
|
|
2416
|
-
const
|
|
2419
|
+
const packageJson2 = await this.readPackageJson();
|
|
2417
2420
|
const isMonorepoProject = await isMonorepo(this.options.cwd);
|
|
2418
2421
|
const fileCount = await this.countFiles();
|
|
2419
2422
|
const totalLines = await this.countTotalLines();
|
|
2420
2423
|
let workspaceCount;
|
|
2421
|
-
if (isMonorepoProject &&
|
|
2422
|
-
workspaceCount = Array.isArray(
|
|
2424
|
+
if (isMonorepoProject && packageJson2.workspaces) {
|
|
2425
|
+
workspaceCount = Array.isArray(packageJson2.workspaces) ? packageJson2.workspaces.length : 0;
|
|
2423
2426
|
}
|
|
2424
2427
|
return {
|
|
2425
|
-
name:
|
|
2426
|
-
version:
|
|
2427
|
-
description:
|
|
2428
|
+
name: packageJson2.name || "Unknown Project",
|
|
2429
|
+
version: packageJson2.version || "0.0.0",
|
|
2430
|
+
description: packageJson2.description,
|
|
2428
2431
|
isMonorepo: isMonorepoProject,
|
|
2429
2432
|
packageManager: await detectPackageManager(this.options.cwd),
|
|
2430
2433
|
workspaceCount,
|
|
@@ -2436,9 +2439,9 @@ var AdvisoryAnalyzer = class {
|
|
|
2436
2439
|
* Analyze technology stack
|
|
2437
2440
|
*/
|
|
2438
2441
|
async analyzeTechnology() {
|
|
2439
|
-
const
|
|
2440
|
-
const deps =
|
|
2441
|
-
const devDeps =
|
|
2442
|
+
const packageJson2 = await this.readPackageJson();
|
|
2443
|
+
const deps = packageJson2.dependencies || {};
|
|
2444
|
+
const devDeps = packageJson2.devDependencies || {};
|
|
2442
2445
|
const projectAnalysis = await analyzeProject(this.options.cwd);
|
|
2443
2446
|
return {
|
|
2444
2447
|
framework: projectAnalysis.framework,
|
|
@@ -2454,9 +2457,9 @@ var AdvisoryAnalyzer = class {
|
|
|
2454
2457
|
* Analyze packages in detail
|
|
2455
2458
|
*/
|
|
2456
2459
|
async analyzePackages() {
|
|
2457
|
-
const
|
|
2458
|
-
const deps =
|
|
2459
|
-
const devDeps =
|
|
2460
|
+
const packageJson2 = await this.readPackageJson();
|
|
2461
|
+
const deps = packageJson2.dependencies || {};
|
|
2462
|
+
const devDeps = packageJson2.devDependencies || {};
|
|
2460
2463
|
const production = this.analyzeDependencies(deps, "production");
|
|
2461
2464
|
const development = this.analyzeDependencies(devDeps, "development");
|
|
2462
2465
|
const categories = this.categorizeTechnologies(deps, devDeps);
|
|
@@ -7267,10 +7270,10 @@ async function inferTagsFromDependencies(cwd) {
|
|
|
7267
7270
|
return tags;
|
|
7268
7271
|
}
|
|
7269
7272
|
try {
|
|
7270
|
-
const
|
|
7273
|
+
const packageJson2 = JSON.parse(fs2.readFileSync(packageJsonPath, "utf-8"));
|
|
7271
7274
|
const allDeps = {
|
|
7272
|
-
...
|
|
7273
|
-
...
|
|
7275
|
+
...packageJson2.dependencies,
|
|
7276
|
+
...packageJson2.devDependencies
|
|
7274
7277
|
};
|
|
7275
7278
|
for (const dep of Object.keys(allDeps)) {
|
|
7276
7279
|
const mappedTags = LIBRARY_TAG_MAP[dep];
|
|
@@ -8295,7 +8298,7 @@ async function hooksTestCommand(options) {
|
|
|
8295
8298
|
if (options.dryRun) {
|
|
8296
8299
|
console.log(chalk22.bold.cyan("\n Dry-run hook simulation:\n"));
|
|
8297
8300
|
console.log(chalk22.dim(" Simulating pre-commit hook..."));
|
|
8298
|
-
const { verifyCommand: verifyCommand2 } = await import("../verify-
|
|
8301
|
+
const { verifyCommand: verifyCommand2 } = await import("../verify-XGCZKY7S.js");
|
|
8299
8302
|
try {
|
|
8300
8303
|
await verifyCommand2({ fix: false, dryRun: true, maxRetries: "1" });
|
|
8301
8304
|
} catch {
|
|
@@ -8403,6 +8406,11 @@ ${chalk22.bold("Examples:")}
|
|
|
8403
8406
|
}
|
|
8404
8407
|
|
|
8405
8408
|
// src/cli/index.ts
|
|
8409
|
+
var __filename4 = fileURLToPath4(import.meta.url);
|
|
8410
|
+
var __dirname4 = dirname5(__filename4);
|
|
8411
|
+
var packageJson = JSON.parse(
|
|
8412
|
+
readFileSync3(join12(__dirname4, "../../package.json"), "utf-8")
|
|
8413
|
+
);
|
|
8406
8414
|
function deprecationWarning(oldCmd, newCmd) {
|
|
8407
8415
|
console.warn(chalk23.yellow(`\u26A0\uFE0F "${oldCmd}" is deprecated and will be removed in v2.0.`));
|
|
8408
8416
|
console.warn(chalk23.yellow(` Use: ${newCmd}
|
|
@@ -8411,7 +8419,7 @@ function deprecationWarning(oldCmd, newCmd) {
|
|
|
8411
8419
|
var program = new Command7();
|
|
8412
8420
|
program.name("workflow").description(
|
|
8413
8421
|
"A self-evolving workflow management system for AI agent development"
|
|
8414
|
-
).version(
|
|
8422
|
+
).version(packageJson.version);
|
|
8415
8423
|
program.addCommand(createDocsCommand());
|
|
8416
8424
|
program.addCommand(createSolutionCommand());
|
|
8417
8425
|
program.addCommand(createLearnCommand());
|