workflow-agent-cli 2.23.1 → 2.23.3

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.
@@ -2,7 +2,7 @@ import {
2
2
  hasUncommittedChanges,
3
3
  runAllChecks,
4
4
  stageAllChanges
5
- } from "./chunk-KJFRMHQU.js";
5
+ } from "./chunk-JRXA6XDA.js";
6
6
 
7
7
  // src/cli/commands/verify.ts
8
8
  import chalk from "chalk";
@@ -247,4 +247,4 @@ async function recordSuccessfulFixes(cwd, result) {
247
247
  export {
248
248
  verifyCommand
249
249
  };
250
- //# sourceMappingURL=chunk-PLVOGB6Y.js.map
250
+ //# sourceMappingURL=chunk-DKPBHC2E.js.map
@@ -962,15 +962,42 @@ async function applyPrettierSetup(projectPath, filesCreated, filesUpdated) {
962
962
  await writeFile(prettierPath, JSON.stringify(config, null, 2) + "\n");
963
963
  const ignorePath = join2(projectPath, ".prettierignore");
964
964
  if (!existsSync2(ignorePath)) {
965
- const ignoreContent = `dist/
966
- node_modules/
967
- coverage/
968
- .next/
965
+ const ignoreContent = `# Build outputs
966
+ dist/
969
967
  build/
970
- *.min.js
968
+ .next/
969
+ coverage/
970
+
971
+ # Dependencies
972
+ node_modules/
973
+
974
+ # Lock files
971
975
  pnpm-lock.yaml
972
976
  package-lock.json
973
977
  yarn.lock
978
+
979
+ # Minified files
980
+ *.min.js
981
+ *.min.css
982
+
983
+ # Template files (Prettier doesn't support these natively)
984
+ *.liquid
985
+ *.ejs
986
+ *.hbs
987
+ *.handlebars
988
+ *.pug
989
+ *.jade
990
+ *.twig
991
+ *.njk
992
+ *.blade.php
993
+
994
+ # Shopify theme files
995
+ theme/
996
+ sections/
997
+ snippets/
998
+ layout/
999
+ templates/
1000
+ assets/*.liquid
974
1001
  `;
975
1002
  await writeFile(ignorePath, ignoreContent);
976
1003
  filesCreated.push(".prettierignore");
@@ -1479,6 +1506,43 @@ async function getPlatformChecks(cwd) {
1479
1506
  await ensurePlatformCLI(selectedPlatform);
1480
1507
  return PLATFORM_CHECKS.filter((check) => check.platform === selectedPlatform);
1481
1508
  }
1509
+ var SKIPPABLE_ERROR_PATTERNS = [
1510
+ // ESLint no-files patterns
1511
+ {
1512
+ pattern: /No files matching the pattern .* were found/i,
1513
+ reason: "No files found matching the lint pattern"
1514
+ },
1515
+ {
1516
+ pattern: /No files matching .* were found/i,
1517
+ reason: "No files found matching the pattern"
1518
+ },
1519
+ // TypeScript no-files pattern
1520
+ {
1521
+ pattern: /No inputs were found in config file/i,
1522
+ reason: "No TypeScript files found"
1523
+ },
1524
+ {
1525
+ pattern: /No files matching the pattern .* are present/i,
1526
+ reason: "No files present matching the pattern"
1527
+ },
1528
+ // Prettier unsupported file type patterns
1529
+ {
1530
+ pattern: /No parser could be inferred for file/i,
1531
+ reason: "File type not supported by Prettier (add to .prettierignore)"
1532
+ },
1533
+ {
1534
+ pattern: /UndefinedParserError/i,
1535
+ reason: "Prettier cannot parse this file type"
1536
+ }
1537
+ ];
1538
+ function isSkippableError(output) {
1539
+ for (const { pattern, reason } of SKIPPABLE_ERROR_PATTERNS) {
1540
+ if (pattern.test(output)) {
1541
+ return reason;
1542
+ }
1543
+ }
1544
+ return void 0;
1545
+ }
1482
1546
  async function runCheck(check, cwd) {
1483
1547
  const startTime = Date.now();
1484
1548
  try {
@@ -1496,6 +1560,19 @@ async function runCheck(check, cwd) {
1496
1560
  duration
1497
1561
  };
1498
1562
  } else {
1563
+ const combinedOutput = result.all || result.stderr || "";
1564
+ const skipReason = isSkippableError(combinedOutput);
1565
+ if (skipReason) {
1566
+ return {
1567
+ check,
1568
+ success: true,
1569
+ // Treat as success since it's not a real failure
1570
+ output: result.all || "",
1571
+ duration,
1572
+ skipped: true,
1573
+ skipReason
1574
+ };
1575
+ }
1499
1576
  return {
1500
1577
  check,
1501
1578
  success: false,
@@ -1526,8 +1603,25 @@ async function applyFix(check, cwd) {
1526
1603
  reject: false,
1527
1604
  all: true
1528
1605
  });
1606
+ if (result.exitCode === 0) {
1607
+ return {
1608
+ success: true,
1609
+ output: result.all || ""
1610
+ };
1611
+ }
1612
+ const combinedOutput = result.all || result.stderr || "";
1613
+ const skipReason = isSkippableError(combinedOutput);
1614
+ if (skipReason) {
1615
+ return {
1616
+ success: true,
1617
+ // Treat as success since it's not a real failure
1618
+ output: result.all || "",
1619
+ skipped: true,
1620
+ skipReason
1621
+ };
1622
+ }
1529
1623
  return {
1530
- success: result.exitCode === 0,
1624
+ success: false,
1531
1625
  output: result.all || ""
1532
1626
  };
1533
1627
  } catch (error) {
@@ -1686,7 +1780,17 @@ ${"\u2501".repeat(50)}`, "info");
1686
1780
  const result = await runCheck(check, cwd);
1687
1781
  results.push(result);
1688
1782
  if (result.success) {
1689
- log(`\u2705 ${check.displayName} passed (${result.duration}ms)`, "success");
1783
+ if (result.skipped) {
1784
+ log(
1785
+ `\u23ED\uFE0F ${check.displayName} skipped: ${result.skipReason} (${result.duration}ms)`,
1786
+ "warning"
1787
+ );
1788
+ } else {
1789
+ log(
1790
+ `\u2705 ${check.displayName} passed (${result.duration}ms)`,
1791
+ "success"
1792
+ );
1793
+ }
1690
1794
  } else {
1691
1795
  allPassed = false;
1692
1796
  log(`\u274C ${check.displayName} failed`, "error");
@@ -1702,6 +1806,20 @@ ${"\u2501".repeat(50)}`, "info");
1702
1806
  log(`\u{1F527} Attempting auto-fix for ${check.displayName}...`, "warning");
1703
1807
  const fixResult = await applyFix(check, cwd);
1704
1808
  if (fixResult.success) {
1809
+ if (fixResult.skipped) {
1810
+ log(
1811
+ `\u23ED\uFE0F ${check.displayName} skipped: ${fixResult.skipReason}`,
1812
+ "warning"
1813
+ );
1814
+ results[results.length - 1] = {
1815
+ ...results[results.length - 1],
1816
+ success: true,
1817
+ skipped: true,
1818
+ skipReason: fixResult.skipReason
1819
+ };
1820
+ allPassed = true;
1821
+ continue;
1822
+ }
1705
1823
  log(`\u2728 Auto-fix applied for ${check.displayName}`, "success");
1706
1824
  fixesApplied++;
1707
1825
  appliedFixes.push({
@@ -1878,10 +1996,12 @@ export {
1878
1996
  promptPlatformChoice,
1879
1997
  ensurePlatformCLI,
1880
1998
  getPlatformChecks,
1999
+ SKIPPABLE_ERROR_PATTERNS,
2000
+ isSkippableError,
1881
2001
  runCheck,
1882
2002
  applyFix,
1883
2003
  runAllChecks,
1884
2004
  hasUncommittedChanges,
1885
2005
  stageAllChanges
1886
2006
  };
1887
- //# sourceMappingURL=chunk-KJFRMHQU.js.map
2007
+ //# sourceMappingURL=chunk-JRXA6XDA.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utils/auto-setup.ts","../src/utils/git-repo.ts","../src/utils/check-runner.ts"],"sourcesContent":["/**\n * Auto-Setup Utilities\n *\n * Intelligent project setup that:\n * - Analyzes what a project has and needs\n * - Generates audit reports showing what will change\n * - MERGES with existing configs (improves, doesn't replace)\n * - Batches dependency installs for performance\n * - Supports monorepos with root + shared configs\n *\n * Works like a developer would: analyze first, then configure.\n */\n\nimport { existsSync } from \"fs\";\nimport { readFile, writeFile, mkdir } from \"fs/promises\";\nimport { join } from \"path\";\nimport { execa } from \"execa\";\nimport {\n detectPackageManager,\n isMonorepo,\n getPackageScripts,\n type PackageManager,\n} from \"./git-repo.js\";\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface ProjectAnalysis {\n packageManager: PackageManager;\n isMonorepo: boolean;\n isTypeScript: boolean;\n framework: FrameworkType;\n existing: ExistingConfigs;\n scripts: ExistingScripts;\n setupPlans: SetupPlan[];\n}\n\nexport interface ExistingConfigs {\n typescript: boolean;\n eslint: boolean;\n eslintFlat: boolean;\n prettier: boolean;\n vitest: boolean;\n jest: boolean;\n husky: boolean;\n simpleGitHooks: boolean;\n githubActions: boolean;\n}\n\nexport interface ExistingScripts {\n build: boolean;\n test: boolean;\n lint: boolean;\n format: boolean;\n typecheck: boolean;\n verify: boolean;\n}\n\nexport interface SetupPlan {\n name: string;\n description: string;\n priority: \"high\" | \"medium\" | \"low\";\n changes: ConfigChange[];\n dependencies: string[];\n devDependencies: string[];\n}\n\nexport interface ConfigChange {\n type: \"add\" | \"modify\" | \"unchanged\";\n file: string;\n key?: string;\n oldValue?: unknown;\n newValue?: unknown;\n description: string;\n}\n\nexport interface SetupResult {\n success: boolean;\n name: string;\n message: string;\n filesCreated: string[];\n filesUpdated: string[];\n packagesInstalled: string[];\n}\n\nexport interface AuditReport {\n analysis: ProjectAnalysis;\n totalChanges: number;\n allDependencies: string[];\n allDevDependencies: string[];\n plans: SetupPlan[];\n}\n\nexport type FrameworkType =\n | \"nextjs\"\n | \"remix\"\n | \"react\"\n | \"vue\"\n | \"nuxt\"\n | \"svelte\"\n | \"node\"\n | \"express\"\n | \"hono\"\n | \"shopify-theme\"\n | \"shopify-hydrogen\"\n | \"wordpress\"\n | \"magento\"\n | \"woocommerce\"\n | \"unknown\";\n\n/**\n * Result of platform detection - may detect multiple platforms\n */\nexport interface PlatformDetectionResult {\n primary: FrameworkType;\n detected: FrameworkType[];\n}\n\n// Package.json structure for type safety\ninterface PackageJson {\n name?: string;\n dependencies?: Record<string, string>;\n devDependencies?: Record<string, string>;\n scripts?: Record<string, string>;\n \"simple-git-hooks\"?: Record<string, string>;\n \"lint-staged\"?: Record<string, string | string[]>;\n [key: string]: unknown;\n}\n\n// TSConfig structure\ninterface TSConfig {\n compilerOptions?: Record<string, unknown>;\n include?: string[];\n exclude?: string[];\n [key: string]: unknown;\n}\n\n// ============================================================================\n// Project Analysis\n// ============================================================================\n\n/**\n * Analyze a project to determine what setup is needed\n */\nexport async function analyzeProject(\n projectPath: string = process.cwd(),\n): Promise<ProjectAnalysis> {\n const packageManager = await detectPackageManager(projectPath);\n const mono = await isMonorepo(projectPath);\n const scripts = await getPackageScripts(projectPath);\n\n // Check for TypeScript\n const isTypeScript =\n existsSync(join(projectPath, \"tsconfig.json\")) ||\n existsSync(join(projectPath, \"src/index.ts\")) ||\n existsSync(join(projectPath, \"index.ts\"));\n\n // Detect framework\n const framework = await detectFramework(projectPath);\n\n // Check existing configs\n const existing: ExistingConfigs = {\n typescript: existsSync(join(projectPath, \"tsconfig.json\")),\n eslint:\n existsSync(join(projectPath, \"eslint.config.js\")) ||\n existsSync(join(projectPath, \"eslint.config.mjs\")) ||\n existsSync(join(projectPath, \".eslintrc.js\")) ||\n existsSync(join(projectPath, \".eslintrc.json\")) ||\n existsSync(join(projectPath, \".eslintrc\")),\n eslintFlat:\n existsSync(join(projectPath, \"eslint.config.js\")) ||\n existsSync(join(projectPath, \"eslint.config.mjs\")),\n prettier:\n existsSync(join(projectPath, \".prettierrc\")) ||\n existsSync(join(projectPath, \".prettierrc.json\")) ||\n existsSync(join(projectPath, \"prettier.config.js\")) ||\n existsSync(join(projectPath, \"prettier.config.mjs\")),\n vitest:\n existsSync(join(projectPath, \"vitest.config.ts\")) ||\n existsSync(join(projectPath, \"vitest.config.js\")),\n jest:\n existsSync(join(projectPath, \"jest.config.js\")) ||\n existsSync(join(projectPath, \"jest.config.ts\")),\n husky: existsSync(join(projectPath, \".husky\")),\n simpleGitHooks:\n existsSync(join(projectPath, \".git/hooks/pre-commit\")) ||\n (await hasSimpleGitHooksConfig(projectPath)),\n githubActions: existsSync(join(projectPath, \".github/workflows\")),\n };\n\n // Check existing scripts\n const existingScripts: ExistingScripts = {\n build: !!scripts.build,\n test: !!scripts.test,\n lint: !!scripts.lint,\n format: !!scripts.format,\n typecheck: !!scripts.typecheck,\n verify: !!scripts.verify,\n };\n\n // Generate setup plans\n const setupPlans = await generateSetupPlans(\n projectPath,\n packageManager,\n isTypeScript,\n framework,\n existing,\n existingScripts,\n mono,\n );\n\n return {\n packageManager,\n isMonorepo: mono,\n isTypeScript,\n framework,\n existing,\n scripts: existingScripts,\n setupPlans,\n };\n}\n\nasync function hasSimpleGitHooksConfig(projectPath: string): Promise<boolean> {\n try {\n const pkgPath = join(projectPath, \"package.json\");\n if (!existsSync(pkgPath)) return false;\n const pkg = JSON.parse(await readFile(pkgPath, \"utf-8\"));\n return !!pkg[\"simple-git-hooks\"];\n } catch {\n return false;\n }\n}\n\n/**\n * Detect the framework used in the project\n * Returns the primary detected framework for backward compatibility\n */\nasync function detectFramework(projectPath: string): Promise<FrameworkType> {\n const result = await detectAllPlatforms(projectPath);\n return result.primary;\n}\n\n/**\n * Detect all platforms/frameworks in a project\n * Returns both primary and all detected platforms for multi-platform projects\n */\nexport async function detectAllPlatforms(\n projectPath: string,\n): Promise<PlatformDetectionResult> {\n const detected: FrameworkType[] = [];\n\n try {\n const pkgPath = join(projectPath, \"package.json\");\n const hasPkgJson = existsSync(pkgPath);\n\n let deps: Record<string, string> = {};\n let composerDeps: Record<string, string> = {};\n\n if (hasPkgJson) {\n const pkg = JSON.parse(await readFile(pkgPath, \"utf-8\"));\n deps = { ...pkg.dependencies, ...pkg.devDependencies };\n }\n\n // Check for composer.json (PHP projects)\n const composerPath = join(projectPath, \"composer.json\");\n if (existsSync(composerPath)) {\n try {\n const composer = JSON.parse(await readFile(composerPath, \"utf-8\"));\n composerDeps = { ...composer.require, ...composer[\"require-dev\"] };\n } catch {\n // Ignore composer parse errors\n }\n }\n\n // ========================================================================\n // Platform Detection (order matters - more specific first)\n // ========================================================================\n\n // Shopify Hydrogen detection (more specific, check first)\n if (\n deps[\"@shopify/hydrogen\"] ||\n deps[\"@shopify/remix-oxygen\"] ||\n existsSync(join(projectPath, \"hydrogen.config.ts\")) ||\n existsSync(join(projectPath, \"hydrogen.config.js\"))\n ) {\n detected.push(\"shopify-hydrogen\");\n }\n\n // Shopify Theme detection\n if (\n existsSync(join(projectPath, \"shopify.theme.toml\")) ||\n existsSync(join(projectPath, \"config/settings_schema.json\")) ||\n deps[\"@shopify/theme\"] ||\n (await hasLiquidFiles(projectPath))\n ) {\n detected.push(\"shopify-theme\");\n }\n\n // WooCommerce detection (more specific WordPress, check first)\n const hasWooCommerce =\n Object.keys(composerDeps).some((dep) =>\n dep.toLowerCase().includes(\"woocommerce\"),\n ) || existsSync(join(projectPath, \"wp-content/plugins/woocommerce\"));\n\n // WordPress detection\n const isWordPress =\n existsSync(join(projectPath, \"wp-content\")) ||\n existsSync(join(projectPath, \"functions.php\")) ||\n (await hasWordPressThemeHeader(projectPath)) ||\n Object.keys(composerDeps).some(\n (dep) =>\n dep.includes(\"wordpress\") || dep.includes(\"johnpbloch/wordpress\"),\n );\n\n if (hasWooCommerce && isWordPress) {\n detected.push(\"woocommerce\");\n } else if (isWordPress) {\n detected.push(\"wordpress\");\n }\n\n // Magento detection\n if (\n existsSync(join(projectPath, \"app/etc/env.php\")) ||\n existsSync(join(projectPath, \"bin/magento\")) ||\n Object.keys(composerDeps).some((dep) => dep.startsWith(\"magento/\"))\n ) {\n detected.push(\"magento\");\n }\n\n // Standard JS/TS framework detection\n if (deps.next) detected.push(\"nextjs\");\n if (deps[\"@remix-run/react\"] && !detected.includes(\"shopify-hydrogen\")) {\n detected.push(\"remix\");\n }\n if (deps.nuxt) detected.push(\"nuxt\");\n if (deps.vue && !deps.nuxt) detected.push(\"vue\");\n if (deps.svelte || deps[\"@sveltejs/kit\"]) detected.push(\"svelte\");\n if (deps.react && !deps.next && !detected.includes(\"shopify-hydrogen\")) {\n detected.push(\"react\");\n }\n if (deps.hono) detected.push(\"hono\");\n if (deps.express) detected.push(\"express\");\n if (\n (deps[\"@types/node\"] || (hasPkgJson && existsSync(pkgPath))) &&\n detected.length === 0\n ) {\n detected.push(\"node\");\n }\n\n // Determine primary (first detected or unknown)\n const primary = detected.length > 0 ? detected[0] : \"unknown\";\n\n return { primary, detected };\n } catch {\n return { primary: \"unknown\", detected: [] };\n }\n}\n\n/**\n * Check if project has .liquid files (Shopify theme indicator)\n */\nasync function hasLiquidFiles(projectPath: string): Promise<boolean> {\n try {\n const { readdir } = await import(\"fs/promises\");\n const entries = await readdir(projectPath);\n return entries.some((entry) => entry.endsWith(\".liquid\"));\n } catch {\n return false;\n }\n}\n\n/**\n * Check if style.css has WordPress theme header\n */\nasync function hasWordPressThemeHeader(projectPath: string): Promise<boolean> {\n try {\n const stylePath = join(projectPath, \"style.css\");\n if (!existsSync(stylePath)) return false;\n const content = await readFile(stylePath, \"utf-8\");\n return content.includes(\"Theme Name:\");\n } catch {\n return false;\n }\n}\n\n// ============================================================================\n// Setup Plan Generation\n// ============================================================================\n\nasync function generateSetupPlans(\n projectPath: string,\n packageManager: PackageManager,\n isTypeScript: boolean,\n framework: FrameworkType,\n existing: ExistingConfigs,\n scripts: ExistingScripts,\n isMonorepo: boolean,\n): Promise<SetupPlan[]> {\n const plans: SetupPlan[] = [];\n\n // TypeScript setup/improvement\n if (isTypeScript) {\n plans.push(\n await planTypeScriptSetup(\n projectPath,\n framework,\n existing.typescript,\n isMonorepo,\n ),\n );\n }\n\n // ESLint setup/improvement\n plans.push(\n await planESLintSetup(projectPath, isTypeScript, framework, existing),\n );\n\n // Prettier setup/improvement\n plans.push(await planPrettierSetup(projectPath, existing.prettier));\n\n // Testing setup\n plans.push(\n await planTestingSetup(projectPath, isTypeScript, framework, existing),\n );\n\n // Build configuration (for non-framework TS projects)\n if (isTypeScript && ![\"nextjs\", \"remix\", \"nuxt\"].includes(framework)) {\n plans.push(await planBuildSetup(projectPath, scripts.build));\n }\n\n // Scripts setup\n plans.push(\n await planScriptsSetup(projectPath, isTypeScript, framework, scripts),\n );\n\n // Pre-commit hooks\n plans.push(await planHooksSetup(projectPath, existing));\n\n // GitHub Actions CI\n plans.push(\n await planCISetup(\n projectPath,\n packageManager,\n isTypeScript,\n framework,\n existing.githubActions,\n isMonorepo,\n ),\n );\n\n return plans;\n}\n\n// ============================================================================\n// Individual Plan Generators\n// ============================================================================\n\nasync function planTypeScriptSetup(\n projectPath: string,\n _framework: FrameworkType,\n hasExisting: boolean,\n isMonorepo: boolean,\n): Promise<SetupPlan> {\n const changes: ConfigChange[] = [];\n const devDeps: string[] = [];\n\n // Check if typescript is installed\n const pkg = await readPackageJson(projectPath);\n const deps = pkg.dependencies || {};\n const devDepsPkg = pkg.devDependencies || {};\n const allDeps = { ...deps, ...devDepsPkg };\n if (!allDeps.typescript) {\n devDeps.push(\"typescript\");\n }\n\n if (hasExisting) {\n // Audit existing config\n const tsconfig = await readTSConfig(join(projectPath, \"tsconfig.json\"));\n const opts = tsconfig.compilerOptions || {};\n\n // Recommend improvements\n if (!opts.strict) {\n changes.push({\n type: \"modify\",\n file: \"tsconfig.json\",\n key: \"compilerOptions.strict\",\n oldValue: opts.strict,\n newValue: true,\n description: \"Enable strict type checking\",\n });\n }\n if (!opts.skipLibCheck) {\n changes.push({\n type: \"modify\",\n file: \"tsconfig.json\",\n key: \"compilerOptions.skipLibCheck\",\n oldValue: opts.skipLibCheck,\n newValue: true,\n description:\n \"Skip type checking of declaration files for faster builds\",\n });\n }\n if (opts.target !== \"ES2022\" && opts.target !== \"ESNext\") {\n changes.push({\n type: \"modify\",\n file: \"tsconfig.json\",\n key: \"compilerOptions.target\",\n oldValue: opts.target,\n newValue: \"ES2022\",\n description: \"Use modern JavaScript target\",\n });\n }\n } else {\n changes.push({\n type: \"add\",\n file: isMonorepo ? \"tsconfig.base.json\" : \"tsconfig.json\",\n description: `Create TypeScript configuration${isMonorepo ? \" (shared base for monorepo)\" : \"\"}`,\n });\n }\n\n return {\n name: \"typescript\",\n description: hasExisting\n ? \"Improve TypeScript configuration\"\n : \"Set up TypeScript configuration\",\n priority: \"high\",\n changes,\n dependencies: [],\n devDependencies: devDeps,\n };\n}\n\nasync function planESLintSetup(\n projectPath: string,\n isTypeScript: boolean,\n framework: FrameworkType,\n existing: ExistingConfigs,\n): Promise<SetupPlan> {\n const changes: ConfigChange[] = [];\n const devDeps: string[] = [];\n\n const pkg = await readPackageJson(projectPath);\n const deps = pkg.dependencies || {};\n const devDepsPkg = pkg.devDependencies || {};\n const allDeps = { ...deps, ...devDepsPkg };\n\n // Core ESLint\n if (!allDeps.eslint) {\n devDeps.push(\"eslint\");\n }\n\n // TypeScript support\n if (isTypeScript) {\n if (!allDeps[\"@typescript-eslint/eslint-plugin\"]) {\n devDeps.push(\"@typescript-eslint/eslint-plugin\");\n }\n if (!allDeps[\"@typescript-eslint/parser\"]) {\n devDeps.push(\"@typescript-eslint/parser\");\n }\n if (!allDeps[\"typescript-eslint\"]) {\n devDeps.push(\"typescript-eslint\");\n }\n }\n\n // Framework-specific plugins\n if (framework === \"react\" || framework === \"nextjs\") {\n if (!allDeps[\"eslint-plugin-react\"]) devDeps.push(\"eslint-plugin-react\");\n if (!allDeps[\"eslint-plugin-react-hooks\"])\n devDeps.push(\"eslint-plugin-react-hooks\");\n }\n\n if (existing.eslint) {\n if (!existing.eslintFlat) {\n changes.push({\n type: \"modify\",\n file: \"eslint.config.mjs\",\n description: \"Migrate to ESLint 9 flat config format (recommended)\",\n });\n } else {\n changes.push({\n type: \"unchanged\",\n file: \"eslint.config.mjs\",\n description: \"ESLint flat config already exists\",\n });\n }\n } else {\n changes.push({\n type: \"add\",\n file: \"eslint.config.mjs\",\n description: \"Create ESLint configuration with TypeScript support\",\n });\n }\n\n return {\n name: \"eslint\",\n description: existing.eslint\n ? \"Audit ESLint configuration and dependencies\"\n : \"Set up ESLint for code linting\",\n priority: \"high\",\n changes,\n dependencies: [],\n devDependencies: devDeps,\n };\n}\n\nasync function planPrettierSetup(\n projectPath: string,\n hasExisting: boolean,\n): Promise<SetupPlan> {\n const changes: ConfigChange[] = [];\n const devDeps: string[] = [];\n\n const pkg = await readPackageJson(projectPath);\n const deps = pkg.dependencies || {};\n const devDepsPkg = pkg.devDependencies || {};\n const allDeps = { ...deps, ...devDepsPkg };\n\n if (!allDeps.prettier) {\n devDeps.push(\"prettier\");\n }\n\n if (hasExisting) {\n const prettierConfig = await readPrettierConfig(projectPath);\n // Check for recommended settings\n if (prettierConfig.printWidth === undefined) {\n changes.push({\n type: \"modify\",\n file: \".prettierrc\",\n key: \"printWidth\",\n newValue: 100,\n description: \"Add printWidth setting\",\n });\n }\n if (prettierConfig.trailingComma === undefined) {\n changes.push({\n type: \"modify\",\n file: \".prettierrc\",\n key: \"trailingComma\",\n newValue: \"es5\",\n description: \"Add trailing comma setting\",\n });\n }\n if (changes.length === 0) {\n changes.push({\n type: \"unchanged\",\n file: \".prettierrc\",\n description: \"Prettier configuration is complete\",\n });\n }\n } else {\n changes.push({\n type: \"add\",\n file: \".prettierrc\",\n description: \"Create Prettier configuration\",\n });\n changes.push({\n type: \"add\",\n file: \".prettierignore\",\n description: \"Create Prettier ignore file\",\n });\n }\n\n return {\n name: \"prettier\",\n description: hasExisting\n ? \"Audit Prettier configuration\"\n : \"Set up Prettier for code formatting\",\n priority: \"high\",\n changes,\n dependencies: [],\n devDependencies: devDeps,\n };\n}\n\nasync function planTestingSetup(\n projectPath: string,\n isTypeScript: boolean,\n framework: FrameworkType,\n existing: ExistingConfigs,\n): Promise<SetupPlan> {\n const changes: ConfigChange[] = [];\n const devDeps: string[] = [];\n\n const pkg = await readPackageJson(projectPath);\n const deps = pkg.dependencies || {};\n const devDepsPkg = pkg.devDependencies || {};\n const allDeps = { ...deps, ...devDepsPkg };\n\n // Respect existing Jest - don't force Vitest\n if (existing.jest) {\n changes.push({\n type: \"unchanged\",\n file: \"jest.config.*\",\n description: \"Jest configuration exists (preserving existing setup)\",\n });\n return {\n name: \"testing\",\n description: \"Jest testing already configured\",\n priority: \"high\",\n changes,\n dependencies: [],\n devDependencies: [],\n };\n }\n\n // Set up Vitest\n if (!allDeps.vitest) {\n devDeps.push(\"vitest\");\n }\n if (!allDeps[\"@vitest/coverage-v8\"]) {\n devDeps.push(\"@vitest/coverage-v8\");\n }\n\n // DOM testing for frontend frameworks\n if ([\"react\", \"nextjs\", \"vue\", \"nuxt\", \"svelte\"].includes(framework)) {\n if (!allDeps.jsdom) devDeps.push(\"jsdom\");\n if (framework === \"react\" || framework === \"nextjs\") {\n if (!allDeps[\"@testing-library/react\"])\n devDeps.push(\"@testing-library/react\");\n }\n }\n\n if (existing.vitest) {\n changes.push({\n type: \"unchanged\",\n file: `vitest.config.${isTypeScript ? \"ts\" : \"js\"}`,\n description: \"Vitest configuration already exists\",\n });\n } else {\n changes.push({\n type: \"add\",\n file: `vitest.config.${isTypeScript ? \"ts\" : \"js\"}`,\n description: \"Create Vitest configuration\",\n });\n }\n\n return {\n name: \"testing\",\n description: existing.vitest\n ? \"Audit Vitest dependencies\"\n : \"Set up Vitest for testing\",\n priority: \"high\",\n changes,\n dependencies: [],\n devDependencies: devDeps,\n };\n}\n\nasync function planBuildSetup(\n projectPath: string,\n hasBuildScript: boolean,\n): Promise<SetupPlan> {\n const changes: ConfigChange[] = [];\n const devDeps: string[] = [];\n\n const pkg = await readPackageJson(projectPath);\n const deps = pkg.dependencies || {};\n const devDepsPkg = pkg.devDependencies || {};\n const allDeps = { ...deps, ...devDepsPkg };\n\n if (hasBuildScript) {\n changes.push({\n type: \"unchanged\",\n file: \"package.json\",\n key: \"scripts.build\",\n description: \"Build script already configured\",\n });\n } else {\n if (!allDeps.tsup) {\n devDeps.push(\"tsup\");\n }\n changes.push({\n type: \"add\",\n file: \"tsup.config.ts\",\n description: \"Create tsup build configuration\",\n });\n }\n\n return {\n name: \"build\",\n description: hasBuildScript\n ? \"Build configuration exists\"\n : \"Set up tsup for TypeScript builds\",\n priority: \"medium\",\n changes,\n dependencies: [],\n devDependencies: devDeps,\n };\n}\n\nasync function planScriptsSetup(\n _projectPath: string,\n isTypeScript: boolean,\n _framework: FrameworkType,\n scripts: ExistingScripts,\n): Promise<SetupPlan> {\n const changes: ConfigChange[] = [];\n const scriptsToAdd: Record<string, string> = {};\n\n if (!scripts.lint) {\n scriptsToAdd.lint = \"eslint src\";\n changes.push({\n type: \"add\",\n file: \"package.json\",\n key: \"scripts.lint\",\n newValue: \"eslint src\",\n description: \"Add lint script\",\n });\n }\n\n if (!scripts.format) {\n scriptsToAdd.format = 'prettier --write \"src/**/*.{ts,tsx,js,jsx,json}\"';\n changes.push({\n type: \"add\",\n file: \"package.json\",\n key: \"scripts.format\",\n newValue: scriptsToAdd.format,\n description: \"Add format script\",\n });\n }\n\n if (isTypeScript && !scripts.typecheck) {\n scriptsToAdd.typecheck = \"tsc --noEmit\";\n changes.push({\n type: \"add\",\n file: \"package.json\",\n key: \"scripts.typecheck\",\n newValue: \"tsc --noEmit\",\n description: \"Add typecheck script\",\n });\n }\n\n if (!scripts.test) {\n scriptsToAdd.test = \"vitest run\";\n changes.push({\n type: \"add\",\n file: \"package.json\",\n key: \"scripts.test\",\n newValue: \"vitest run\",\n description: \"Add test script\",\n });\n }\n\n if (!scripts.verify) {\n scriptsToAdd.verify = \"workflow-agent verify\";\n changes.push({\n type: \"add\",\n file: \"package.json\",\n key: \"scripts.verify\",\n newValue: \"workflow-agent verify\",\n description: \"Add verify script\",\n });\n }\n\n if (Object.keys(scriptsToAdd).length === 0) {\n changes.push({\n type: \"unchanged\",\n file: \"package.json\",\n description: \"All standard scripts already configured\",\n });\n }\n\n return {\n name: \"scripts\",\n description: \"Configure npm scripts\",\n priority: \"medium\",\n changes,\n dependencies: [],\n devDependencies: [],\n };\n}\n\nasync function planHooksSetup(\n projectPath: string,\n existing: ExistingConfigs,\n): Promise<SetupPlan> {\n const changes: ConfigChange[] = [];\n const devDeps: string[] = [];\n\n const pkg = await readPackageJson(projectPath);\n const deps = pkg.dependencies || {};\n const devDepsPkg = pkg.devDependencies || {};\n const allDeps = { ...deps, ...devDepsPkg };\n\n // Prefer simple-git-hooks over husky\n if (!allDeps[\"simple-git-hooks\"]) {\n devDeps.push(\"simple-git-hooks\");\n }\n if (!allDeps[\"lint-staged\"]) {\n devDeps.push(\"lint-staged\");\n }\n\n if (existing.husky || existing.simpleGitHooks) {\n changes.push({\n type: \"modify\",\n file: \"package.json\",\n key: \"simple-git-hooks\",\n description: \"Ensure pre-commit hook configuration\",\n });\n } else {\n changes.push({\n type: \"add\",\n file: \"package.json\",\n key: \"simple-git-hooks\",\n newValue: { \"pre-commit\": \"npx lint-staged\" },\n description: \"Add pre-commit hook configuration\",\n });\n changes.push({\n type: \"add\",\n file: \"package.json\",\n key: \"lint-staged\",\n description: \"Add lint-staged configuration\",\n });\n }\n\n return {\n name: \"hooks\",\n description:\n existing.husky || existing.simpleGitHooks\n ? \"Audit pre-commit hooks\"\n : \"Set up pre-commit hooks\",\n priority: \"medium\",\n changes,\n dependencies: [],\n devDependencies: devDeps,\n };\n}\n\nasync function planCISetup(\n projectPath: string,\n _packageManager: PackageManager,\n _isTypeScript: boolean,\n _framework: FrameworkType,\n hasExisting: boolean,\n _isMonorepo: boolean,\n): Promise<SetupPlan> {\n const changes: ConfigChange[] = [];\n\n if (hasExisting) {\n // Check if ci.yml exists specifically\n if (existsSync(join(projectPath, \".github/workflows/ci.yml\"))) {\n changes.push({\n type: \"unchanged\",\n file: \".github/workflows/ci.yml\",\n description: \"CI workflow already exists\",\n });\n } else {\n changes.push({\n type: \"add\",\n file: \".github/workflows/ci.yml\",\n description: \"Add CI workflow (other workflows exist)\",\n });\n }\n } else {\n changes.push({\n type: \"add\",\n file: \".github/workflows/ci.yml\",\n description: \"Create GitHub Actions CI workflow\",\n });\n }\n\n return {\n name: \"ci\",\n description: hasExisting\n ? \"Audit CI configuration\"\n : \"Set up GitHub Actions CI\",\n priority: \"low\",\n changes,\n dependencies: [],\n devDependencies: [],\n };\n}\n\n// ============================================================================\n// Audit Report Generation\n// ============================================================================\n\n/**\n * Generate a comprehensive audit report\n */\nexport async function generateAuditReport(\n projectPath: string = process.cwd(),\n): Promise<AuditReport> {\n const analysis = await analyzeProject(projectPath);\n\n // Collect all dependencies across plans\n const allDeps = new Set<string>();\n const allDevDeps = new Set<string>();\n\n for (const plan of analysis.setupPlans) {\n plan.dependencies.forEach((d) => allDeps.add(d));\n plan.devDependencies.forEach((d) => allDevDeps.add(d));\n }\n\n // Count total changes\n const totalChanges = analysis.setupPlans.reduce(\n (sum, plan) =>\n sum + plan.changes.filter((c) => c.type !== \"unchanged\").length,\n 0,\n );\n\n return {\n analysis,\n totalChanges,\n allDependencies: Array.from(allDeps),\n allDevDependencies: Array.from(allDevDeps),\n plans: analysis.setupPlans,\n };\n}\n\n/**\n * Format audit report for console display\n */\nexport function formatAuditReport(report: AuditReport): string {\n const lines: string[] = [];\n\n lines.push(\"📋 Auto-Setup Audit Report\\n\");\n lines.push(`Framework: ${report.analysis.framework}`);\n lines.push(`Package Manager: ${report.analysis.packageManager}`);\n lines.push(`TypeScript: ${report.analysis.isTypeScript ? \"Yes\" : \"No\"}`);\n lines.push(`Monorepo: ${report.analysis.isMonorepo ? \"Yes\" : \"No\"}\\n`);\n\n for (const plan of report.plans) {\n const hasChanges = plan.changes.some((c) => c.type !== \"unchanged\");\n const icon = hasChanges ? \"🔧\" : \"✓\";\n lines.push(\n `${icon} ${plan.name.charAt(0).toUpperCase() + plan.name.slice(1)}`,\n );\n\n for (const change of plan.changes) {\n const symbol =\n change.type === \"add\" ? \"+\" : change.type === \"modify\" ? \"~\" : \"=\";\n\n let line = ` ${symbol} ${change.description}`;\n if (\n change.key &&\n change.oldValue !== undefined &&\n change.newValue !== undefined\n ) {\n line += ` (${String(change.oldValue)} → ${String(change.newValue)})`;\n }\n lines.push(line);\n }\n\n if (plan.devDependencies.length > 0) {\n lines.push(` 📦 Install: ${plan.devDependencies.join(\", \")}`);\n }\n lines.push(\"\");\n }\n\n if (report.allDevDependencies.length > 0) {\n lines.push(\"Dependencies to install (batched):\");\n const pm = report.analysis.packageManager;\n const cmd =\n pm === \"npm\" ? \"npm install\" : pm === \"yarn\" ? \"yarn add\" : `${pm} add`;\n lines.push(` ${cmd} -D ${report.allDevDependencies.join(\" \")}`);\n lines.push(\"\");\n }\n\n lines.push(`Total changes: ${report.totalChanges}`);\n\n return lines.join(\"\\n\");\n}\n\n// ============================================================================\n// Setup Execution\n// ============================================================================\n\n/**\n * Execute all setup plans\n */\nexport async function runAllSetups(\n projectPath: string = process.cwd(),\n onProgress?: (step: string, status: \"start\" | \"done\" | \"error\") => void,\n): Promise<SetupResult[]> {\n const report = await generateAuditReport(projectPath);\n const results: SetupResult[] = [];\n const filesCreated: string[] = [];\n const filesUpdated: string[] = [];\n\n // Step 1: Batch install all dependencies\n if (report.allDevDependencies.length > 0) {\n onProgress?.(\"Installing dependencies\", \"start\");\n try {\n await installDependencies(\n projectPath,\n report.analysis.packageManager,\n report.allDevDependencies,\n );\n onProgress?.(\"Installing dependencies\", \"done\");\n } catch (error) {\n onProgress?.(\"Installing dependencies\", \"error\");\n results.push({\n success: false,\n name: \"dependencies\",\n message: `Failed to install: ${error instanceof Error ? error.message : String(error)}`,\n filesCreated: [],\n filesUpdated: [],\n packagesInstalled: [],\n });\n return results;\n }\n }\n\n // Step 2: Apply each setup\n for (const plan of report.plans) {\n const hasChanges = plan.changes.some((c) => c.type !== \"unchanged\");\n if (!hasChanges && plan.devDependencies.length === 0) continue;\n\n onProgress?.(`Setting up ${plan.name}`, \"start\");\n\n try {\n const result = await applySetupPlan(projectPath, plan, report.analysis);\n results.push(result);\n filesCreated.push(...result.filesCreated);\n filesUpdated.push(...result.filesUpdated);\n onProgress?.(`Setting up ${plan.name}`, \"done\");\n } catch (error) {\n onProgress?.(`Setting up ${plan.name}`, \"error\");\n results.push({\n success: false,\n name: plan.name,\n message: `Failed: ${error instanceof Error ? error.message : String(error)}`,\n filesCreated: [],\n filesUpdated: [],\n packagesInstalled: [],\n });\n }\n }\n\n // Step 3: Initialize git hooks\n onProgress?.(\"Initializing git hooks\", \"start\");\n try {\n await execa(\"npx\", [\"simple-git-hooks\"], {\n cwd: projectPath,\n stdio: \"pipe\",\n });\n onProgress?.(\"Initializing git hooks\", \"done\");\n } catch {\n // May fail if not in a git repo\n onProgress?.(\"Initializing git hooks\", \"error\");\n }\n\n return results;\n}\n\nasync function installDependencies(\n projectPath: string,\n packageManager: PackageManager,\n packages: string[],\n): Promise<void> {\n if (packages.length === 0) return;\n\n const commands: Record<PackageManager, { cmd: string; args: string[] }> = {\n npm: { cmd: \"npm\", args: [\"install\", \"--save-dev\"] },\n pnpm: { cmd: \"pnpm\", args: [\"add\", \"-D\"] },\n yarn: { cmd: \"yarn\", args: [\"add\", \"-D\"] },\n bun: { cmd: \"bun\", args: [\"add\", \"-D\"] },\n };\n\n const { cmd, args } = commands[packageManager];\n await execa(cmd, [...args, ...packages], {\n cwd: projectPath,\n stdio: \"pipe\",\n });\n}\n\nasync function applySetupPlan(\n projectPath: string,\n plan: SetupPlan,\n analysis: ProjectAnalysis,\n): Promise<SetupResult> {\n const filesCreated: string[] = [];\n const filesUpdated: string[] = [];\n\n switch (plan.name) {\n case \"typescript\":\n await applyTypeScriptSetup(\n projectPath,\n analysis,\n filesCreated,\n filesUpdated,\n );\n break;\n case \"eslint\":\n await applyESLintSetup(projectPath, analysis, filesCreated, filesUpdated);\n break;\n case \"prettier\":\n await applyPrettierSetup(projectPath, filesCreated, filesUpdated);\n break;\n case \"testing\":\n await applyTestingSetup(\n projectPath,\n analysis,\n filesCreated,\n filesUpdated,\n );\n break;\n case \"build\":\n await applyBuildSetup(projectPath, filesCreated, filesUpdated);\n break;\n case \"scripts\":\n await applyScriptsSetup(projectPath, analysis, filesUpdated);\n break;\n case \"hooks\":\n await applyHooksSetup(projectPath, filesUpdated);\n break;\n case \"ci\":\n await applyCISetup(projectPath, analysis, filesCreated, filesUpdated);\n break;\n }\n\n return {\n success: true,\n name: plan.name,\n message: `${plan.name} configured successfully`,\n filesCreated,\n filesUpdated,\n packagesInstalled: plan.devDependencies,\n };\n}\n\n// ============================================================================\n// Setup Application Functions\n// ============================================================================\n\nasync function applyTypeScriptSetup(\n projectPath: string,\n analysis: ProjectAnalysis,\n filesCreated: string[],\n filesUpdated: string[],\n): Promise<void> {\n const configName = analysis.isMonorepo\n ? \"tsconfig.base.json\"\n : \"tsconfig.json\";\n const configPath = join(projectPath, configName);\n\n let tsconfig: Record<string, unknown> = {};\n\n if (existsSync(configPath)) {\n tsconfig = await readJsonFile(configPath);\n filesUpdated.push(configName);\n } else {\n filesCreated.push(configName);\n }\n\n // Ensure compilerOptions\n if (!tsconfig.compilerOptions) {\n tsconfig.compilerOptions = {};\n }\n const opts = tsconfig.compilerOptions as Record<string, unknown>;\n\n // Apply improvements (merge with existing)\n const improvements: Record<string, unknown> = {\n target: opts.target || \"ES2022\",\n module: opts.module || \"ESNext\",\n moduleResolution: opts.moduleResolution || \"bundler\",\n esModuleInterop: opts.esModuleInterop ?? true,\n strict: opts.strict ?? true,\n skipLibCheck: opts.skipLibCheck ?? true,\n resolveJsonModule: opts.resolveJsonModule ?? true,\n isolatedModules: opts.isolatedModules ?? true,\n declaration: opts.declaration ?? true,\n declarationMap: opts.declarationMap ?? true,\n sourceMap: opts.sourceMap ?? true,\n };\n\n // Framework-specific options\n const frameworkOpts = getFrameworkTsOptions(analysis.framework);\n\n tsconfig.compilerOptions = { ...opts, ...improvements, ...frameworkOpts };\n\n // Ensure include/exclude\n if (!tsconfig.include) {\n tsconfig.include = [\"src/**/*\"];\n }\n if (!tsconfig.exclude) {\n tsconfig.exclude = [\"node_modules\", \"dist\", \"coverage\"];\n }\n\n await writeFile(configPath, JSON.stringify(tsconfig, null, 2) + \"\\n\");\n}\n\nfunction getFrameworkTsOptions(\n framework: FrameworkType,\n): Record<string, unknown> {\n switch (framework) {\n case \"nextjs\":\n return {\n lib: [\"dom\", \"dom.iterable\", \"esnext\"],\n jsx: \"preserve\",\n incremental: true,\n plugins: [{ name: \"next\" }],\n };\n case \"react\":\n case \"remix\":\n return {\n lib: [\"dom\", \"dom.iterable\", \"esnext\"],\n jsx: \"react-jsx\",\n };\n case \"vue\":\n case \"nuxt\":\n return {\n lib: [\"esnext\", \"dom\"],\n jsx: \"preserve\",\n };\n default:\n return {};\n }\n}\n\nasync function applyESLintSetup(\n projectPath: string,\n analysis: ProjectAnalysis,\n filesCreated: string[],\n _filesUpdated: string[],\n): Promise<void> {\n // Only create new config if no flat config exists\n if (analysis.existing.eslintFlat) {\n return;\n }\n\n const configPath = join(projectPath, \"eslint.config.mjs\");\n const config = generateESLintFlatConfig(\n analysis.isTypeScript,\n analysis.framework,\n );\n\n await writeFile(configPath, config);\n filesCreated.push(\"eslint.config.mjs\");\n}\n\nfunction generateESLintFlatConfig(\n isTypeScript: boolean,\n framework: FrameworkType,\n): string {\n const imports: string[] = [];\n const configs: string[] = [];\n\n if (isTypeScript) {\n imports.push(`import tseslint from \"typescript-eslint\";`);\n }\n\n // Add react plugin import if needed\n if (framework === \"react\" || framework === \"nextjs\") {\n imports.push(`import react from \"eslint-plugin-react\";`);\n imports.push(`import reactHooks from \"eslint-plugin-react-hooks\";`);\n }\n\n // Base config\n if (isTypeScript) {\n configs.push(` ...tseslint.configs.recommended`);\n }\n\n configs.push(` {\n files: [\"**/*.${isTypeScript ? \"{ts,tsx}\" : \"{js,jsx}\"}\"],\n rules: {\n ${isTypeScript ? `\"@typescript-eslint/no-unused-vars\": [\"error\", { argsIgnorePattern: \"^_\" }],` : \"\"}\n \"no-console\": \"warn\",\n },\n }`);\n\n configs.push(` {\n ignores: [\"dist/\", \"node_modules/\", \"coverage/\", \".next/\", \"build/\"],\n }`);\n\n return `${imports.join(\"\\n\")}\n\nexport default [\n${configs.join(\",\\n\")}\n];\n`;\n}\n\nasync function applyPrettierSetup(\n projectPath: string,\n filesCreated: string[],\n filesUpdated: string[],\n): Promise<void> {\n const prettierPath = join(projectPath, \".prettierrc\");\n\n let config: Record<string, unknown> = {\n semi: true,\n singleQuote: false,\n tabWidth: 2,\n trailingComma: \"es5\",\n printWidth: 100,\n bracketSpacing: true,\n };\n\n if (existsSync(prettierPath)) {\n const existing = await readPrettierConfig(projectPath);\n config = { ...config, ...existing };\n filesUpdated.push(\".prettierrc\");\n } else {\n filesCreated.push(\".prettierrc\");\n }\n\n await writeFile(prettierPath, JSON.stringify(config, null, 2) + \"\\n\");\n\n // Create .prettierignore if it doesn't exist\n const ignorePath = join(projectPath, \".prettierignore\");\n if (!existsSync(ignorePath)) {\n const ignoreContent = `# Build outputs\ndist/\nbuild/\n.next/\ncoverage/\n\n# Dependencies\nnode_modules/\n\n# Lock files\npnpm-lock.yaml\npackage-lock.json\nyarn.lock\n\n# Minified files\n*.min.js\n*.min.css\n\n# Template files (Prettier doesn't support these natively)\n*.liquid\n*.ejs\n*.hbs\n*.handlebars\n*.pug\n*.jade\n*.twig\n*.njk\n*.blade.php\n\n# Shopify theme files\ntheme/\nsections/\nsnippets/\nlayout/\ntemplates/\nassets/*.liquid\n`;\n await writeFile(ignorePath, ignoreContent);\n filesCreated.push(\".prettierignore\");\n }\n}\n\nasync function applyTestingSetup(\n projectPath: string,\n analysis: ProjectAnalysis,\n filesCreated: string[],\n _filesUpdated: string[],\n): Promise<void> {\n // Skip if jest exists or vitest already configured\n if (analysis.existing.jest || analysis.existing.vitest) {\n return;\n }\n\n const ext = analysis.isTypeScript ? \"ts\" : \"js\";\n const configPath = join(projectPath, `vitest.config.${ext}`);\n\n const environment = [\"react\", \"nextjs\", \"vue\", \"nuxt\", \"svelte\"].includes(\n analysis.framework,\n )\n ? \"jsdom\"\n : \"node\";\n\n const config = `import { defineConfig } from \"vitest/config\";\n\nexport default defineConfig({\n test: {\n globals: true,\n environment: \"${environment}\",\n coverage: {\n provider: \"v8\",\n reporter: [\"text\", \"json\", \"html\"],\n exclude: [\"node_modules/\", \"dist/\", \"**/*.test.${ext}\"],\n },\n include: [\"src/**/*.test.${ext}\", \"tests/**/*.test.${ext}\"],\n },\n});\n`;\n\n await writeFile(configPath, config);\n filesCreated.push(`vitest.config.${ext}`);\n}\n\nasync function applyBuildSetup(\n projectPath: string,\n filesCreated: string[],\n _filesUpdated: string[],\n): Promise<void> {\n const configPath = join(projectPath, \"tsup.config.ts\");\n\n if (existsSync(configPath)) {\n return;\n }\n\n const config = `import { defineConfig } from \"tsup\";\n\nexport default defineConfig({\n entry: [\"src/index.ts\"],\n format: [\"esm\"],\n dts: true,\n clean: true,\n sourcemap: true,\n});\n`;\n\n await writeFile(configPath, config);\n filesCreated.push(\"tsup.config.ts\");\n}\n\nasync function applyScriptsSetup(\n projectPath: string,\n analysis: ProjectAnalysis,\n filesUpdated: string[],\n): Promise<void> {\n const pkgPath = join(projectPath, \"package.json\");\n const pkg = await readPackageJson(projectPath);\n const scripts = pkg.scripts || {};\n\n // Add missing scripts (don't overwrite)\n const scriptsToAdd: Record<string, string> = {\n lint: \"eslint src\",\n \"lint:fix\": \"eslint src --fix\",\n format: 'prettier --write \"src/**/*.{ts,tsx,js,jsx,json}\"',\n \"format:check\": 'prettier --check \"src/**/*.{ts,tsx,js,jsx,json}\"',\n test: \"vitest run\",\n \"test:watch\": \"vitest\",\n \"test:coverage\": \"vitest run --coverage\",\n verify: \"workflow-agent verify\",\n \"verify:fix\": \"workflow-agent verify --fix\",\n \"pre-commit\": \"workflow-agent verify --fix\",\n };\n\n if (analysis.isTypeScript) {\n scriptsToAdd.typecheck = \"tsc --noEmit\";\n }\n\n let added = false;\n for (const [name, cmd] of Object.entries(scriptsToAdd)) {\n if (!scripts[name]) {\n scripts[name] = cmd;\n added = true;\n }\n }\n\n if (added) {\n pkg.scripts = scripts;\n await writeFile(pkgPath, JSON.stringify(pkg, null, 2) + \"\\n\");\n filesUpdated.push(\"package.json\");\n }\n}\n\nasync function applyHooksSetup(\n projectPath: string,\n filesUpdated: string[],\n): Promise<void> {\n const pkgPath = join(projectPath, \"package.json\");\n const pkg = await readPackageJson(projectPath);\n\n // Add simple-git-hooks config\n if (!pkg[\"simple-git-hooks\"]) {\n pkg[\"simple-git-hooks\"] = {\n \"pre-commit\": \"npx lint-staged\",\n };\n }\n\n // Add lint-staged config\n if (!pkg[\"lint-staged\"]) {\n pkg[\"lint-staged\"] = {\n \"*.{ts,tsx,js,jsx}\": [\"eslint --fix\", \"prettier --write\"],\n \"*.{json,md,yml,yaml}\": [\"prettier --write\"],\n };\n }\n\n await writeFile(pkgPath, JSON.stringify(pkg, null, 2) + \"\\n\");\n filesUpdated.push(\"package.json\");\n}\n\nasync function applyCISetup(\n projectPath: string,\n analysis: ProjectAnalysis,\n filesCreated: string[],\n _filesUpdated: string[],\n): Promise<void> {\n const workflowsDir = join(projectPath, \".github/workflows\");\n await mkdir(workflowsDir, { recursive: true });\n\n const ciPath = join(workflowsDir, \"ci.yml\");\n\n if (existsSync(ciPath)) {\n return;\n }\n\n const workflow = generateCIWorkflow(\n analysis.packageManager,\n analysis.isTypeScript,\n analysis.framework,\n analysis.isMonorepo,\n );\n\n await writeFile(ciPath, workflow);\n filesCreated.push(\".github/workflows/ci.yml\");\n}\n\nfunction generateCIWorkflow(\n packageManager: PackageManager,\n isTypeScript: boolean,\n framework: FrameworkType,\n _isMonorepo: boolean,\n): string {\n const runCmd =\n packageManager === \"npm\"\n ? \"npm run\"\n : packageManager === \"yarn\"\n ? \"yarn\"\n : packageManager;\n const isPnpm = packageManager === \"pnpm\";\n\n return `name: CI\n\non:\n push:\n branches: [main, master]\n pull_request:\n branches: [main, master]\n\njobs:\n ci:\n runs-on: ubuntu-latest\n\n steps:\n - name: Checkout\n uses: actions/checkout@v4\n\n - name: Setup Node.js\n uses: actions/setup-node@v4\n with:\n node-version: \"20\"\n${\n isPnpm\n ? `\n - name: Install pnpm\n uses: pnpm/action-setup@v4\n with:\n version: 9\n`\n : \"\"\n}\n - name: Install dependencies\n run: ${packageManager} install\n\n${\n isTypeScript\n ? ` - name: Type check\n run: ${runCmd} typecheck\n\n`\n : \"\"\n} - name: Lint\n run: ${runCmd} lint\n\n - name: Format check\n run: ${runCmd} format:check || true\n\n - name: Test\n run: ${runCmd} test\n${\n isTypeScript && ![\"nextjs\", \"remix\", \"nuxt\"].includes(framework)\n ? `\n - name: Build\n run: ${runCmd} build\n`\n : \"\"\n}`;\n}\n\n// ============================================================================\n// Utility Functions\n// ============================================================================\n\nasync function readPackageJson(projectPath: string): Promise<PackageJson> {\n const pkgPath = join(projectPath, \"package.json\");\n if (!existsSync(pkgPath)) {\n return {};\n }\n return JSON.parse(await readFile(pkgPath, \"utf-8\")) as PackageJson;\n}\n\nasync function readTSConfig(filePath: string): Promise<TSConfig> {\n if (!existsSync(filePath)) {\n return {};\n }\n return JSON.parse(await readFile(filePath, \"utf-8\")) as TSConfig;\n}\n\nasync function readJsonFile(\n filePath: string,\n): Promise<Record<string, unknown>> {\n if (!existsSync(filePath)) {\n return {};\n }\n return JSON.parse(await readFile(filePath, \"utf-8\"));\n}\n\nasync function readPrettierConfig(\n projectPath: string,\n): Promise<Record<string, unknown>> {\n const files = [\".prettierrc\", \".prettierrc.json\", \"prettier.config.js\"];\n\n for (const file of files) {\n const filePath = join(projectPath, file);\n if (existsSync(filePath)) {\n if (file.endsWith(\".js\")) {\n return {}; // Can't easily read JS config\n }\n try {\n return JSON.parse(await readFile(filePath, \"utf-8\"));\n } catch {\n return {};\n }\n }\n }\n\n return {};\n}\n","/**\n * Git repository utilities for detecting repository info,\n * package manager, monorepo setup, and GitHub remote\n */\n\nimport { execa } from \"execa\";\nimport { existsSync } from \"fs\";\nimport { readFile } from \"fs/promises\";\nimport { join } from \"path\";\n\nexport type PackageManager = \"npm\" | \"pnpm\" | \"yarn\" | \"bun\";\n\nexport interface GitHubInfo {\n owner: string;\n repo: string;\n}\n\nexport interface RepoInfo {\n isGitRepo: boolean;\n remoteUrl: string | null;\n isGitHub: boolean;\n github: GitHubInfo | null;\n defaultBranch: string | null;\n}\n\nexport interface ProjectInfo {\n packageManager: PackageManager;\n isMonorepo: boolean;\n hasLintScript: boolean;\n hasTypecheckScript: boolean;\n hasFormatScript: boolean;\n hasTestScript: boolean;\n hasBuildScript: boolean;\n}\n\n/**\n * Check if the current directory is a git repository\n */\nexport async function isGitRepo(\n projectPath: string = process.cwd(),\n): Promise<boolean> {\n try {\n await execa(\"git\", [\"rev-parse\", \"--git-dir\"], { cwd: projectPath });\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Get the git remote URL for origin\n */\nexport async function getGitRemoteUrl(\n projectPath: string = process.cwd(),\n): Promise<string | null> {\n try {\n const { stdout } = await execa(\"git\", [\"remote\", \"get-url\", \"origin\"], {\n cwd: projectPath,\n });\n return stdout.trim() || null;\n } catch {\n return null;\n }\n}\n\n/**\n * Check if the remote URL is a GitHub repository\n */\nexport function isGitHubRemote(remoteUrl: string | null): boolean {\n if (!remoteUrl) return false;\n return remoteUrl.includes(\"github.com\");\n}\n\n/**\n * Parse GitHub owner and repo from remote URL\n * Supports both SSH (git@github.com:owner/repo.git) and HTTPS (https://github.com/owner/repo.git)\n */\nexport function parseGitHubUrl(remoteUrl: string | null): GitHubInfo | null {\n if (!remoteUrl || !isGitHubRemote(remoteUrl)) return null;\n\n // Match: git@github.com:owner/repo.git or https://github.com/owner/repo.git\n const match = remoteUrl.match(/github\\.com[:/]([^/]+)\\/([^/.]+)/);\n\n if (match) {\n return {\n owner: match[1],\n repo: match[2].replace(/\\.git$/, \"\"),\n };\n }\n\n return null;\n}\n\n/**\n * Get the default branch name\n */\nexport async function getDefaultBranch(\n projectPath: string = process.cwd(),\n): Promise<string | null> {\n try {\n // Try to get from remote\n const { stdout } = await execa(\n \"git\",\n [\"symbolic-ref\", \"refs/remotes/origin/HEAD\"],\n {\n cwd: projectPath,\n },\n );\n return stdout.trim().replace(\"refs/remotes/origin/\", \"\") || \"main\";\n } catch {\n // Fallback: try HEAD\n try {\n const { stdout } = await execa(\n \"git\",\n [\"rev-parse\", \"--abbrev-ref\", \"HEAD\"],\n {\n cwd: projectPath,\n },\n );\n return stdout.trim() || \"main\";\n } catch {\n return \"main\";\n }\n }\n}\n\n/**\n * Get comprehensive repository information\n */\nexport async function getRepoInfo(\n projectPath: string = process.cwd(),\n): Promise<RepoInfo> {\n const isRepo = await isGitRepo(projectPath);\n\n if (!isRepo) {\n return {\n isGitRepo: false,\n remoteUrl: null,\n isGitHub: false,\n github: null,\n defaultBranch: null,\n };\n }\n\n const remoteUrl = await getGitRemoteUrl(projectPath);\n const isGitHub = isGitHubRemote(remoteUrl);\n const github = parseGitHubUrl(remoteUrl);\n const defaultBranch = await getDefaultBranch(projectPath);\n\n return {\n isGitRepo: true,\n remoteUrl,\n isGitHub,\n github,\n defaultBranch,\n };\n}\n\n/**\n * Detect the package manager used in the project\n */\nexport async function detectPackageManager(\n projectPath: string = process.cwd(),\n): Promise<PackageManager> {\n // Check for lockfiles in order of preference\n if (existsSync(join(projectPath, \"pnpm-lock.yaml\"))) {\n return \"pnpm\";\n }\n if (existsSync(join(projectPath, \"yarn.lock\"))) {\n return \"yarn\";\n }\n if (existsSync(join(projectPath, \"bun.lockb\"))) {\n return \"bun\";\n }\n if (existsSync(join(projectPath, \"package-lock.json\"))) {\n return \"npm\";\n }\n\n // Check packageManager field in package.json\n try {\n const pkgPath = join(projectPath, \"package.json\");\n if (existsSync(pkgPath)) {\n const pkg = JSON.parse(await readFile(pkgPath, \"utf-8\"));\n if (pkg.packageManager) {\n if (pkg.packageManager.startsWith(\"pnpm\")) return \"pnpm\";\n if (pkg.packageManager.startsWith(\"yarn\")) return \"yarn\";\n if (pkg.packageManager.startsWith(\"bun\")) return \"bun\";\n }\n }\n } catch {\n // Ignore parse errors\n }\n\n // Default to npm\n return \"npm\";\n}\n\n/**\n * Check if the project is a monorepo\n */\nexport async function isMonorepo(\n projectPath: string = process.cwd(),\n): Promise<boolean> {\n // Check for pnpm workspace\n if (existsSync(join(projectPath, \"pnpm-workspace.yaml\"))) {\n return true;\n }\n\n // Check for yarn/npm workspaces in package.json\n try {\n const pkgPath = join(projectPath, \"package.json\");\n if (existsSync(pkgPath)) {\n const pkg = JSON.parse(await readFile(pkgPath, \"utf-8\"));\n if (pkg.workspaces) {\n return true;\n }\n }\n } catch {\n // Ignore parse errors\n }\n\n // Check for lerna.json\n if (existsSync(join(projectPath, \"lerna.json\"))) {\n return true;\n }\n\n // Check for nx.json\n if (existsSync(join(projectPath, \"nx.json\"))) {\n return true;\n }\n\n // Check for turbo.json\n if (existsSync(join(projectPath, \"turbo.json\"))) {\n return true;\n }\n\n return false;\n}\n\n/**\n * Get available scripts from package.json\n */\nexport async function getPackageScripts(\n projectPath: string = process.cwd(),\n): Promise<Record<string, string>> {\n try {\n const pkgPath = join(projectPath, \"package.json\");\n if (!existsSync(pkgPath)) {\n return {};\n }\n const pkg = JSON.parse(await readFile(pkgPath, \"utf-8\"));\n return pkg.scripts || {};\n } catch {\n return {};\n }\n}\n\n/**\n * Get comprehensive project information\n */\nexport async function getProjectInfo(\n projectPath: string = process.cwd(),\n): Promise<ProjectInfo> {\n const packageManager = await detectPackageManager(projectPath);\n const monorepo = await isMonorepo(projectPath);\n const scripts = await getPackageScripts(projectPath);\n\n return {\n packageManager,\n isMonorepo: monorepo,\n hasLintScript: \"lint\" in scripts,\n hasTypecheckScript: \"typecheck\" in scripts || \"type-check\" in scripts,\n hasFormatScript: \"format\" in scripts || \"format:check\" in scripts,\n hasTestScript: \"test\" in scripts,\n hasBuildScript: \"build\" in scripts,\n };\n}\n\n/**\n * Get the install command for a package manager\n */\nexport function getInstallCommand(packageManager: PackageManager): string {\n switch (packageManager) {\n case \"pnpm\":\n return \"pnpm install --frozen-lockfile\";\n case \"yarn\":\n return \"yarn install --frozen-lockfile\";\n case \"bun\":\n return \"bun install --frozen-lockfile\";\n case \"npm\":\n default:\n return \"npm ci\";\n }\n}\n\n/**\n * Get the run command for a package manager (handles monorepo -r flag for pnpm)\n */\nexport function getRunCommand(\n packageManager: PackageManager,\n script: string,\n isMonorepo: boolean = false,\n): string {\n switch (packageManager) {\n case \"pnpm\":\n return isMonorepo ? `pnpm -r run ${script}` : `pnpm run ${script}`;\n case \"yarn\":\n return isMonorepo\n ? `yarn workspaces run ${script}`\n : `yarn run ${script}`;\n case \"bun\":\n return `bun run ${script}`;\n case \"npm\":\n default:\n return isMonorepo\n ? `npm run ${script} --workspaces --if-present`\n : `npm run ${script}`;\n }\n}\n","/**\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\";\nimport * as p from \"@clack/prompts\";\nimport {\n detectAllPlatforms,\n type FrameworkType,\n type PlatformDetectionResult,\n} from \"./auto-setup.js\";\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 /** Whether the check was skipped (e.g., no files found) */\n skipped?: boolean;\n /** Reason the check was skipped */\n skipReason?: string;\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 /** Whether to include platform-specific checks (default: true) */\n includePlatformChecks?: boolean;\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// Platform-Specific Checks\n// ============================================================================\n\n/**\n * Platform types that have specific checks\n */\nexport type PlatformType =\n | \"shopify-theme\"\n | \"shopify-hydrogen\"\n | \"wordpress\"\n | \"magento\"\n | \"woocommerce\";\n\n/**\n * Platform CLI installation configuration\n */\nexport interface PlatformCLIConfig {\n /** The CLI command to check for */\n cli: string;\n /** Command to install the CLI */\n install: string;\n /** Whether this platform requires Composer (PHP package manager) */\n requiresComposer: boolean;\n /** Human-readable platform name */\n displayName: string;\n}\n\n/**\n * Platform check definition extending CheckDefinition\n */\nexport interface PlatformCheckDefinition extends CheckDefinition {\n /** The platform this check applies to */\n platform: PlatformType;\n}\n\n/**\n * CLI installation commands for each platform\n */\nexport const PLATFORM_CLI_INSTALL: Record<PlatformType, PlatformCLIConfig> = {\n \"shopify-theme\": {\n cli: \"shopify\",\n install: \"npm install -g @shopify/cli @shopify/theme\",\n requiresComposer: false,\n displayName: \"Shopify Theme\",\n },\n \"shopify-hydrogen\": {\n cli: \"shopify\",\n install: \"npm install -g @shopify/cli\",\n requiresComposer: false,\n displayName: \"Shopify Hydrogen\",\n },\n wordpress: {\n cli: \"phpcs\",\n install:\n \"composer global require squizlabs/php_codesniffer wp-coding-standards/wpcs && phpcs --config-set installed_paths $(composer global config home)/vendor/wp-coding-standards/wpcs\",\n requiresComposer: true,\n displayName: \"WordPress\",\n },\n magento: {\n cli: \"phpcs\",\n install:\n \"composer global require squizlabs/php_codesniffer magento/magento-coding-standard && phpcs --config-set installed_paths $(composer global config home)/vendor/magento/magento-coding-standard\",\n requiresComposer: true,\n displayName: \"Magento\",\n },\n woocommerce: {\n cli: \"phpcs\",\n install:\n \"composer global require squizlabs/php_codesniffer automattic/woocommerce-sniffs && phpcs --config-set installed_paths $(composer global config home)/vendor/automattic/woocommerce-sniffs\",\n requiresComposer: true,\n displayName: \"WooCommerce\",\n },\n};\n\n/**\n * Platform-specific quality checks\n */\nexport const PLATFORM_CHECKS: PlatformCheckDefinition[] = [\n {\n platform: \"shopify-theme\",\n name: \"shopify-theme-check\",\n displayName: \"Shopify Theme Check\",\n command: \"shopify\",\n args: [\"theme\", \"check\"],\n canAutoFix: false,\n },\n {\n platform: \"shopify-hydrogen\",\n name: \"shopify-hydrogen-check\",\n displayName: \"Shopify Hydrogen Check\",\n command: \"shopify\",\n args: [\"hydrogen\", \"check\"],\n canAutoFix: false,\n },\n {\n platform: \"wordpress\",\n name: \"wordpress-phpcs\",\n displayName: \"WordPress Coding Standards\",\n command: \"phpcs\",\n args: [\"--standard=WordPress\", \".\"],\n fixCommand: \"phpcbf\",\n fixArgs: [\"--standard=WordPress\", \".\"],\n canAutoFix: true,\n },\n {\n platform: \"magento\",\n name: \"magento-phpcs\",\n displayName: \"Magento Coding Standards\",\n command: \"phpcs\",\n args: [\"--standard=Magento2\", \".\"],\n fixCommand: \"phpcbf\",\n fixArgs: [\"--standard=Magento2\", \".\"],\n canAutoFix: true,\n },\n {\n platform: \"woocommerce\",\n name: \"woocommerce-phpcs\",\n displayName: \"WooCommerce Coding Standards\",\n command: \"phpcs\",\n args: [\"--standard=WooCommerce-Core\", \".\"],\n fixCommand: \"phpcbf\",\n fixArgs: [\"--standard=WooCommerce-Core\", \".\"],\n canAutoFix: true,\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(\n cwd: string,\n): 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// Platform Check Utilities\n// ============================================================================\n\n/**\n * Check if Composer is installed (required for PHP-based platforms)\n * If not installed, shows OS-specific installation instructions and exits\n */\nexport async function ensureComposer(): Promise<void> {\n const hasComposer = await commandExists(\"composer\");\n\n if (!hasComposer) {\n console.log(chalk.red(\"\\n❌ Composer is required but not installed.\\n\"));\n console.log(chalk.yellow(\"Please install Composer for your platform:\\n\"));\n\n // Detect OS and show relevant instructions\n const platform = process.platform;\n\n if (platform === \"darwin\") {\n console.log(chalk.cyan(\" macOS (Homebrew):\"));\n console.log(chalk.dim(\" brew install composer\\n\"));\n } else if (platform === \"linux\") {\n console.log(chalk.cyan(\" Ubuntu/Debian:\"));\n console.log(chalk.dim(\" sudo apt install composer\\n\"));\n console.log(chalk.cyan(\" Fedora/CentOS:\"));\n console.log(chalk.dim(\" sudo dnf install composer\\n\"));\n console.log(chalk.cyan(\" Arch Linux:\"));\n console.log(chalk.dim(\" sudo pacman -S composer\\n\"));\n } else if (platform === \"win32\") {\n console.log(chalk.cyan(\" Windows (Scoop):\"));\n console.log(chalk.dim(\" scoop install composer\\n\"));\n console.log(chalk.cyan(\" Windows (Chocolatey):\"));\n console.log(chalk.dim(\" choco install composer\\n\"));\n }\n\n console.log(chalk.cyan(\" Or download from:\"));\n console.log(chalk.dim(\" https://getcomposer.org/download/\\n\"));\n\n process.exit(1);\n }\n}\n\n/**\n * Prompt user to choose a platform when multiple are detected\n */\nexport async function promptPlatformChoice(\n detected: FrameworkType[],\n): Promise<FrameworkType> {\n // Filter to only platform types we have checks for\n const platformTypes = detected.filter((d): d is PlatformType =>\n Object.keys(PLATFORM_CLI_INSTALL).includes(d),\n );\n\n if (platformTypes.length === 0) {\n return detected[0] || \"unknown\";\n }\n\n if (platformTypes.length === 1) {\n return platformTypes[0];\n }\n\n // Multiple platforms detected - ask user\n console.log(\n chalk.yellow(\"\\n🔍 Multiple platforms detected in this project:\\n\"),\n );\n\n const options = platformTypes.map((pt) => ({\n value: pt,\n label: PLATFORM_CLI_INSTALL[pt].displayName,\n }));\n\n const choice = await p.select({\n message: \"Which platform would you like to run checks for?\",\n options,\n });\n\n if (p.isCancel(choice)) {\n console.log(chalk.yellow(\"\\n⚠️ Platform check cancelled.\"));\n process.exit(0);\n }\n\n return choice as FrameworkType;\n}\n\n/**\n * Ensure the platform CLI is installed\n * If not, automatically installs it after showing the command\n */\nexport async function ensurePlatformCLI(platform: PlatformType): Promise<void> {\n const config = PLATFORM_CLI_INSTALL[platform];\n\n // Check Composer requirement first\n if (config.requiresComposer) {\n await ensureComposer();\n }\n\n // Check if CLI exists\n const hasCLI = await commandExists(config.cli);\n\n if (!hasCLI) {\n console.log(\n chalk.yellow(\n `\\n📦 ${config.displayName} CLI (${config.cli}) not found. Installing...\\n`,\n ),\n );\n console.log(chalk.dim(` Running: ${config.install}\\n`));\n\n try {\n // Run the install command\n await execa(\"sh\", [\"-c\", config.install], {\n stdio: \"inherit\",\n });\n\n // Verify installation\n const nowHasCLI = await commandExists(config.cli);\n if (!nowHasCLI) {\n console.log(\n chalk.red(\n `\\n❌ Failed to install ${config.cli}. Please install manually:\\n`,\n ),\n );\n console.log(chalk.dim(` ${config.install}\\n`));\n process.exit(1);\n }\n\n console.log(\n chalk.green(`\\n✅ ${config.displayName} CLI installed successfully.\\n`),\n );\n } catch (error) {\n console.log(chalk.red(`\\n❌ Failed to install ${config.cli}:\\n`));\n console.log(chalk.dim(` ${(error as Error).message}\\n`));\n console.log(chalk.yellow(\"Please install manually:\\n\"));\n console.log(chalk.dim(` ${config.install}\\n`));\n process.exit(1);\n }\n }\n}\n\n/**\n * Get platform-specific checks for the detected platform(s)\n * Handles multi-platform detection, user prompts, and CLI installation\n */\nexport async function getPlatformChecks(\n cwd: string,\n): Promise<PlatformCheckDefinition[]> {\n // Detect all platforms\n const detection: PlatformDetectionResult = await detectAllPlatforms(cwd);\n\n // Filter to platforms we have checks for\n const platformsWithChecks = detection.detected.filter(\n (d): d is PlatformType => Object.keys(PLATFORM_CLI_INSTALL).includes(d),\n );\n\n if (platformsWithChecks.length === 0) {\n return [];\n }\n\n // If multiple platforms, prompt user to choose\n let selectedPlatform: PlatformType;\n if (platformsWithChecks.length === 1) {\n selectedPlatform = platformsWithChecks[0];\n } else {\n const choice = await promptPlatformChoice(detection.detected);\n if (!Object.keys(PLATFORM_CLI_INSTALL).includes(choice)) {\n return [];\n }\n selectedPlatform = choice as PlatformType;\n }\n\n // Ensure CLI is installed\n await ensurePlatformCLI(selectedPlatform);\n\n // Return checks for the selected platform\n return PLATFORM_CHECKS.filter((check) => check.platform === selectedPlatform);\n}\n\n/**\n * Patterns that indicate a check should be skipped rather than failed.\n * These are non-error conditions where the tool exits non-zero but nothing is wrong.\n */\nexport const SKIPPABLE_ERROR_PATTERNS: Array<{\n pattern: RegExp;\n reason: string;\n}> = [\n // ESLint no-files patterns\n {\n pattern: /No files matching the pattern .* were found/i,\n reason: \"No files found matching the lint pattern\",\n },\n {\n pattern: /No files matching .* were found/i,\n reason: \"No files found matching the pattern\",\n },\n // TypeScript no-files pattern\n {\n pattern: /No inputs were found in config file/i,\n reason: \"No TypeScript files found\",\n },\n {\n pattern: /No files matching the pattern .* are present/i,\n reason: \"No files present matching the pattern\",\n },\n // Prettier unsupported file type patterns\n {\n pattern: /No parser could be inferred for file/i,\n reason: \"File type not supported by Prettier (add to .prettierignore)\",\n },\n {\n pattern: /UndefinedParserError/i,\n reason: \"Prettier cannot parse this file type\",\n },\n];\n\n/**\n * Check if an error output matches a skippable error pattern.\n * @returns The skip reason if matched, undefined otherwise.\n */\nexport function isSkippableError(output: string): string | undefined {\n for (const { pattern, reason } of SKIPPABLE_ERROR_PATTERNS) {\n if (pattern.test(output)) {\n return reason;\n }\n }\n return undefined;\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 // Check if this is a skippable error (e.g., \"no files found\")\n const combinedOutput = result.all || result.stderr || \"\";\n const skipReason = isSkippableError(combinedOutput);\n\n if (skipReason) {\n return {\n check,\n success: true, // Treat as success since it's not a real failure\n output: result.all || \"\",\n duration,\n skipped: true,\n skipReason,\n };\n }\n\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<{\n success: boolean;\n output: string;\n skipped?: boolean;\n skipReason?: string;\n}> {\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 if (result.exitCode === 0) {\n return {\n success: true,\n output: result.all || \"\",\n };\n }\n\n // Check if this is a skippable error (e.g., \"no files found\")\n const combinedOutput = result.all || result.stderr || \"\";\n const skipReason = isSkippableError(combinedOutput);\n\n if (skipReason) {\n return {\n success: true, // Treat as success since it's not a real failure\n output: result.all || \"\",\n skipped: true,\n skipReason,\n };\n }\n\n return {\n success: false,\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 platform-specific checks after standard checks pass\n * Returns results for each platform check run\n */\nasync function runPlatformChecks(\n cwd: string,\n log: (message: string, type: ProgressType) => void,\n autoFix: boolean,\n dryRun: boolean,\n): Promise<CheckResult[]> {\n const results: CheckResult[] = [];\n\n try {\n const platformChecks = await getPlatformChecks(cwd);\n\n if (platformChecks.length === 0) {\n return results;\n }\n\n log(`\\n${\"━\".repeat(50)}`, \"info\");\n log(`🔧 Platform-Specific Checks`, \"info\");\n log(`${\"━\".repeat(50)}\\n`, \"info\");\n\n for (let i = 0; i < platformChecks.length; i++) {\n const check = platformChecks[i];\n const stepNum = i + 1;\n const totalSteps = platformChecks.length;\n\n log(\n `📋 Platform ${stepNum}/${totalSteps}: ${check.displayName}...`,\n \"info\",\n );\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 log(`❌ ${check.displayName} failed`, \"error\");\n\n // Try to auto-fix if possible\n if (autoFix && check.canAutoFix && check.fixCommand) {\n if (dryRun) {\n log(\n `🔧 [DRY-RUN] Would run: ${formatFixCommand(check)}`,\n \"warning\",\n );\n continue;\n }\n\n log(`🔧 Attempting auto-fix for ${check.displayName}...`, \"warning\");\n const fixResult = await applyFix(check, cwd);\n\n if (fixResult.success) {\n log(`✨ Auto-fix applied for ${check.displayName}`, \"success\");\n // Re-run the check after fix\n const reResult = await runCheck(check, cwd);\n results[results.length - 1] = reResult;\n\n if (reResult.success) {\n log(`✅ ${check.displayName} now passes`, \"success\");\n } else {\n log(`⚠️ ${check.displayName} still failing after fix`, \"error\");\n }\n } else {\n log(`⚠️ Auto-fix failed for ${check.displayName}`, \"error\");\n }\n } else if (!check.canAutoFix) {\n log(`⚠️ ${check.displayName} requires manual fix`, \"error\");\n }\n\n // Show error preview\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 }\n } catch (error) {\n // Platform check errors should not crash the entire verification\n log(`\\n⚠️ Platform check error: ${(error as Error).message}`, \"warning\");\n }\n\n return results;\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 includePlatformChecks = true,\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 `\\n⏭️ Skipping checks (scripts not found): ${skippedChecks.map((c) => c.displayName).join(\", \")}`,\n \"warning\",\n );\n }\n\n if (applicableChecks.length === 0) {\n log(\n `\\n⚠️ No applicable checks found. Add scripts to package.json: typecheck, lint, format, test, build`,\n \"warning\",\n );\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 if (result.skipped) {\n log(\n `⏭️ ${check.displayName} skipped: ${result.skipReason} (${result.duration}ms)`,\n \"warning\",\n );\n } else {\n log(\n `✅ ${check.displayName} passed (${result.duration}ms)`,\n \"success\",\n );\n }\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 if (fixResult.skipped) {\n // The fix command also returned \"no files found\" - treat as skip\n log(\n `⏭️ ${check.displayName} skipped: ${fixResult.skipReason}`,\n \"warning\",\n );\n // Update the result to reflect it was skipped, not failed\n results[results.length - 1] = {\n ...results[results.length - 1],\n success: true,\n skipped: true,\n skipReason: fixResult.skipReason,\n };\n allPassed = true;\n // Continue to next check\n continue;\n }\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 // Run platform-specific checks if enabled\n if (includePlatformChecks) {\n const platformCheckResults = await runPlatformChecks(\n cwd,\n log,\n autoFix,\n dryRun,\n );\n\n if (platformCheckResults.length > 0) {\n const platformFailed = platformCheckResults.some((r) => !r.success);\n\n if (platformFailed) {\n return {\n success: false,\n results: [...results, ...platformCheckResults],\n totalAttempts: attempt,\n fixesApplied,\n appliedFixes,\n };\n }\n\n // Add platform results to overall results\n results.push(...platformCheckResults);\n }\n }\n\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":";AAaA,SAAS,cAAAA,mBAAkB;AAC3B,SAAS,YAAAC,WAAU,WAAW,aAAa;AAC3C,SAAS,QAAAC,aAAY;AACrB,SAAS,SAAAC,cAAa;;;ACXtB,SAAS,aAAa;AACtB,SAAS,kBAAkB;AAC3B,SAAS,gBAAgB;AACzB,SAAS,YAAY;AAyJrB,eAAsB,qBACpB,cAAsB,QAAQ,IAAI,GACT;AAEzB,MAAI,WAAW,KAAK,aAAa,gBAAgB,CAAC,GAAG;AACnD,WAAO;AAAA,EACT;AACA,MAAI,WAAW,KAAK,aAAa,WAAW,CAAC,GAAG;AAC9C,WAAO;AAAA,EACT;AACA,MAAI,WAAW,KAAK,aAAa,WAAW,CAAC,GAAG;AAC9C,WAAO;AAAA,EACT;AACA,MAAI,WAAW,KAAK,aAAa,mBAAmB,CAAC,GAAG;AACtD,WAAO;AAAA,EACT;AAGA,MAAI;AACF,UAAM,UAAU,KAAK,aAAa,cAAc;AAChD,QAAI,WAAW,OAAO,GAAG;AACvB,YAAM,MAAM,KAAK,MAAM,MAAM,SAAS,SAAS,OAAO,CAAC;AACvD,UAAI,IAAI,gBAAgB;AACtB,YAAI,IAAI,eAAe,WAAW,MAAM,EAAG,QAAO;AAClD,YAAI,IAAI,eAAe,WAAW,MAAM,EAAG,QAAO;AAClD,YAAI,IAAI,eAAe,WAAW,KAAK,EAAG,QAAO;AAAA,MACnD;AAAA,IACF;AAAA,EACF,QAAQ;AAAA,EAER;AAGA,SAAO;AACT;AAKA,eAAsB,WACpB,cAAsB,QAAQ,IAAI,GAChB;AAElB,MAAI,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AAQ;AACN,WAAO;AAAA,EACT;AACF;","names":["existsSync","readFile","join","execa","existsSync","join","readFile","isMonorepo","execa","execa","existsSync","join","join","existsSync","execa"]}
package/dist/cli/index.js CHANGED
@@ -29,14 +29,14 @@ import {
29
29
  } from "../chunk-NPJJZHJG.js";
30
30
  import {
31
31
  verifyCommand
32
- } from "../chunk-PLVOGB6Y.js";
32
+ } from "../chunk-DKPBHC2E.js";
33
33
  import {
34
34
  analyzeProject,
35
35
  detectPackageManager,
36
36
  generateAuditReport,
37
37
  isMonorepo,
38
38
  runAllSetups
39
- } from "../chunk-KJFRMHQU.js";
39
+ } from "../chunk-JRXA6XDA.js";
40
40
  import {
41
41
  syncCommand
42
42
  } from "../chunk-K42R54II.js";
@@ -5225,7 +5225,7 @@ async function testAction(options) {
5225
5225
  if (options.dryRun) {
5226
5226
  console.log(chalk17.bold.cyan("\n Dry-run hook simulation:\n"));
5227
5227
  console.log(chalk17.dim(" Simulating pre-commit hook..."));
5228
- const { verifyCommand: verifyCommand2 } = await import("../verify-OIHY7SGG.js");
5228
+ const { verifyCommand: verifyCommand2 } = await import("../verify-XCVV6NIR.js");
5229
5229
  try {
5230
5230
  await verifyCommand2({ fix: false, dryRun: true, maxRetries: "1" });
5231
5231
  } catch {
package/dist/index.d.ts CHANGED
@@ -92,6 +92,8 @@ interface CheckResult {
92
92
  output: string;
93
93
  error?: string;
94
94
  duration: number;
95
+ skipped?: boolean;
96
+ skipReason?: string;
95
97
  }
96
98
  interface AppliedFix {
97
99
  checkName: string;
@@ -137,13 +139,20 @@ declare function ensureComposer(): Promise<void>;
137
139
  declare function promptPlatformChoice(detected: FrameworkType[]): Promise<FrameworkType>;
138
140
  declare function ensurePlatformCLI(platform: PlatformType): Promise<void>;
139
141
  declare function getPlatformChecks(cwd: string): Promise<PlatformCheckDefinition[]>;
142
+ declare const SKIPPABLE_ERROR_PATTERNS: Array<{
143
+ pattern: RegExp;
144
+ reason: string;
145
+ }>;
146
+ declare function isSkippableError(output: string): string | undefined;
140
147
  declare function runCheck(check: CheckDefinition, cwd: string): Promise<CheckResult>;
141
148
  declare function applyFix(check: CheckDefinition, cwd: string): Promise<{
142
149
  success: boolean;
143
150
  output: string;
151
+ skipped?: boolean;
152
+ skipReason?: string;
144
153
  }>;
145
154
  declare function runAllChecks(cwd: string, options?: CheckRunnerOptions): Promise<RunAllChecksResult>;
146
155
  declare function hasUncommittedChanges(cwd: string): Promise<boolean>;
147
156
  declare function stageAllChanges(cwd: string): Promise<boolean>;
148
157
 
149
- export { type AppliedFix, type AuditReport, type CheckDefinition, type CheckResult, type CheckRunnerOptions, type ConfigChange, type ExistingConfigs, type ExistingScripts, type FrameworkType, PLATFORM_CHECKS, PLATFORM_CLI_INSTALL, type PlatformCLIConfig, type PlatformCheckDefinition, type PlatformDetectionResult, type PlatformType, type ProgressType, type ProjectAnalysis, QUALITY_CHECKS, type RunAllChecksResult, type SetupPlan, type SetupResult, analyzeProject, applyFix, detectAllPlatforms, ensureComposer, ensurePlatformCLI, formatAuditReport, generateAuditReport, getApplicableChecks, getAvailableScripts, getPlatformChecks, hasUncommittedChanges, promptPlatformChoice, runAllChecks, runAllSetups, runCheck, stageAllChanges };
158
+ export { type AppliedFix, type AuditReport, type CheckDefinition, type CheckResult, type CheckRunnerOptions, type ConfigChange, type ExistingConfigs, type ExistingScripts, type FrameworkType, PLATFORM_CHECKS, PLATFORM_CLI_INSTALL, type PlatformCLIConfig, type PlatformCheckDefinition, type PlatformDetectionResult, type PlatformType, type ProgressType, type ProjectAnalysis, QUALITY_CHECKS, type RunAllChecksResult, SKIPPABLE_ERROR_PATTERNS, type SetupPlan, type SetupResult, analyzeProject, applyFix, detectAllPlatforms, ensureComposer, ensurePlatformCLI, formatAuditReport, generateAuditReport, getApplicableChecks, getAvailableScripts, getPlatformChecks, hasUncommittedChanges, isSkippableError, promptPlatformChoice, runAllChecks, runAllSetups, runCheck, stageAllChanges };
package/dist/index.js CHANGED
@@ -26,6 +26,7 @@ import {
26
26
  PLATFORM_CHECKS,
27
27
  PLATFORM_CLI_INSTALL,
28
28
  QUALITY_CHECKS,
29
+ SKIPPABLE_ERROR_PATTERNS,
29
30
  analyzeProject,
30
31
  applyFix,
31
32
  detectAllPlatforms,
@@ -37,16 +38,18 @@ import {
37
38
  getAvailableScripts,
38
39
  getPlatformChecks,
39
40
  hasUncommittedChanges,
41
+ isSkippableError,
40
42
  promptPlatformChoice,
41
43
  runAllChecks,
42
44
  runAllSetups,
43
45
  runCheck,
44
46
  stageAllChanges
45
- } from "./chunk-KJFRMHQU.js";
47
+ } from "./chunk-JRXA6XDA.js";
46
48
  export {
47
49
  PLATFORM_CHECKS,
48
50
  PLATFORM_CLI_INSTALL,
49
51
  QUALITY_CHECKS,
52
+ SKIPPABLE_ERROR_PATTERNS,
50
53
  WorkflowConfigSchema,
51
54
  analyzeProject,
52
55
  analyzeValidationError,
@@ -68,6 +71,7 @@ export {
68
71
  hasConfig,
69
72
  hasUncommittedChanges,
70
73
  invalidateCustomScopesCache,
74
+ isSkippableError,
71
75
  loadConfig,
72
76
  loadConfigSafe,
73
77
  promptPlatformChoice,
File without changes
@@ -0,0 +1,8 @@
1
+ import {
2
+ verifyCommand
3
+ } from "./chunk-DKPBHC2E.js";
4
+ import "./chunk-JRXA6XDA.js";
5
+ export {
6
+ verifyCommand
7
+ };
8
+ //# sourceMappingURL=verify-XCVV6NIR.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "workflow-agent-cli",
3
- "version": "2.23.1",
3
+ "version": "2.23.3",
4
4
  "description": "A self-evolving workflow management system for AI agent development",
5
5
  "keywords": [
6
6
  "workflow",
@@ -41,34 +41,6 @@
41
41
  "templates",
42
42
  "README.md"
43
43
  ],
44
- "dependencies": {
45
- "@clack/prompts": "^0.7.0",
46
- "chalk": "^5.3.0",
47
- "commander": "^11.1.0",
48
- "cosmiconfig": "^9.0.0",
49
- "didyoumean2": "^6.0.0",
50
- "execa": "^8.0.1",
51
- "fast-glob": "^3.3.2",
52
- "mustache": "^4.2.0",
53
- "picocolors": "^1.0.0",
54
- "zod": "^3.22.4",
55
- "@hawkinside_out/workflow-improvement-tracker": "^1.4.1"
56
- },
57
- "devDependencies": {
58
- "@types/mustache": "^4.2.5",
59
- "@types/node": "^20.11.5",
60
- "eslint": "^8.56.0",
61
- "memfs": "^4.56.2",
62
- "tsup": "^8.0.1",
63
- "typescript": "^5.3.3",
64
- "vitest": "^1.6.1"
65
- },
66
- "engines": {
67
- "node": ">=18.0.0"
68
- },
69
- "publishConfig": {
70
- "access": "public"
71
- },
72
44
  "scripts": {
73
45
  "build": "tsup",
74
46
  "dev": "tsup --watch",
@@ -79,6 +51,7 @@
79
51
  "typecheck": "tsc --noEmit",
80
52
  "clean": "rm -rf dist",
81
53
  "postinstall": "node dist/scripts/postinstall.js || true",
54
+ "prepublishOnly": "pnpm build && pnpm test",
82
55
  "workflow": "node dist/cli/index.js",
83
56
  "workflow:version": "node dist/cli/index.js --version",
84
57
  "workflow:init": "node dist/cli/index.js init",
@@ -116,5 +89,33 @@
116
89
  "workflow:docs": "node dist/cli/index.js docs validate",
117
90
  "workflow:docs-validate": "node dist/cli/index.js docs validate",
118
91
  "workflow:docs-advisory": "node dist/cli/index.js docs advisory"
92
+ },
93
+ "dependencies": {
94
+ "@clack/prompts": "^0.7.0",
95
+ "@hawkinside_out/workflow-improvement-tracker": "workspace:^",
96
+ "chalk": "^5.3.0",
97
+ "commander": "^11.1.0",
98
+ "cosmiconfig": "^9.0.0",
99
+ "didyoumean2": "^6.0.0",
100
+ "execa": "^8.0.1",
101
+ "fast-glob": "^3.3.2",
102
+ "mustache": "^4.2.0",
103
+ "picocolors": "^1.0.0",
104
+ "zod": "^3.22.4"
105
+ },
106
+ "devDependencies": {
107
+ "@types/mustache": "^4.2.5",
108
+ "@types/node": "^20.11.5",
109
+ "eslint": "^8.56.0",
110
+ "memfs": "^4.56.2",
111
+ "tsup": "^8.0.1",
112
+ "typescript": "^5.3.3",
113
+ "vitest": "^1.6.1"
114
+ },
115
+ "engines": {
116
+ "node": ">=18.0.0"
117
+ },
118
+ "publishConfig": {
119
+ "access": "public"
119
120
  }
120
- }
121
+ }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Workflow Agent Team
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/utils/auto-setup.ts","../src/utils/git-repo.ts","../src/utils/check-runner.ts"],"sourcesContent":["/**\n * Auto-Setup Utilities\n *\n * Intelligent project setup that:\n * - Analyzes what a project has and needs\n * - Generates audit reports showing what will change\n * - MERGES with existing configs (improves, doesn't replace)\n * - Batches dependency installs for performance\n * - Supports monorepos with root + shared configs\n *\n * Works like a developer would: analyze first, then configure.\n */\n\nimport { existsSync } from \"fs\";\nimport { readFile, writeFile, mkdir } from \"fs/promises\";\nimport { join } from \"path\";\nimport { execa } from \"execa\";\nimport {\n detectPackageManager,\n isMonorepo,\n getPackageScripts,\n type PackageManager,\n} from \"./git-repo.js\";\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface ProjectAnalysis {\n packageManager: PackageManager;\n isMonorepo: boolean;\n isTypeScript: boolean;\n framework: FrameworkType;\n existing: ExistingConfigs;\n scripts: ExistingScripts;\n setupPlans: SetupPlan[];\n}\n\nexport interface ExistingConfigs {\n typescript: boolean;\n eslint: boolean;\n eslintFlat: boolean;\n prettier: boolean;\n vitest: boolean;\n jest: boolean;\n husky: boolean;\n simpleGitHooks: boolean;\n githubActions: boolean;\n}\n\nexport interface ExistingScripts {\n build: boolean;\n test: boolean;\n lint: boolean;\n format: boolean;\n typecheck: boolean;\n verify: boolean;\n}\n\nexport interface SetupPlan {\n name: string;\n description: string;\n priority: \"high\" | \"medium\" | \"low\";\n changes: ConfigChange[];\n dependencies: string[];\n devDependencies: string[];\n}\n\nexport interface ConfigChange {\n type: \"add\" | \"modify\" | \"unchanged\";\n file: string;\n key?: string;\n oldValue?: unknown;\n newValue?: unknown;\n description: string;\n}\n\nexport interface SetupResult {\n success: boolean;\n name: string;\n message: string;\n filesCreated: string[];\n filesUpdated: string[];\n packagesInstalled: string[];\n}\n\nexport interface AuditReport {\n analysis: ProjectAnalysis;\n totalChanges: number;\n allDependencies: string[];\n allDevDependencies: string[];\n plans: SetupPlan[];\n}\n\nexport type FrameworkType =\n | \"nextjs\"\n | \"remix\"\n | \"react\"\n | \"vue\"\n | \"nuxt\"\n | \"svelte\"\n | \"node\"\n | \"express\"\n | \"hono\"\n | \"shopify-theme\"\n | \"shopify-hydrogen\"\n | \"wordpress\"\n | \"magento\"\n | \"woocommerce\"\n | \"unknown\";\n\n/**\n * Result of platform detection - may detect multiple platforms\n */\nexport interface PlatformDetectionResult {\n primary: FrameworkType;\n detected: FrameworkType[];\n}\n\n// Package.json structure for type safety\ninterface PackageJson {\n name?: string;\n dependencies?: Record<string, string>;\n devDependencies?: Record<string, string>;\n scripts?: Record<string, string>;\n \"simple-git-hooks\"?: Record<string, string>;\n \"lint-staged\"?: Record<string, string | string[]>;\n [key: string]: unknown;\n}\n\n// TSConfig structure\ninterface TSConfig {\n compilerOptions?: Record<string, unknown>;\n include?: string[];\n exclude?: string[];\n [key: string]: unknown;\n}\n\n// ============================================================================\n// Project Analysis\n// ============================================================================\n\n/**\n * Analyze a project to determine what setup is needed\n */\nexport async function analyzeProject(\n projectPath: string = process.cwd(),\n): Promise<ProjectAnalysis> {\n const packageManager = await detectPackageManager(projectPath);\n const mono = await isMonorepo(projectPath);\n const scripts = await getPackageScripts(projectPath);\n\n // Check for TypeScript\n const isTypeScript =\n existsSync(join(projectPath, \"tsconfig.json\")) ||\n existsSync(join(projectPath, \"src/index.ts\")) ||\n existsSync(join(projectPath, \"index.ts\"));\n\n // Detect framework\n const framework = await detectFramework(projectPath);\n\n // Check existing configs\n const existing: ExistingConfigs = {\n typescript: existsSync(join(projectPath, \"tsconfig.json\")),\n eslint:\n existsSync(join(projectPath, \"eslint.config.js\")) ||\n existsSync(join(projectPath, \"eslint.config.mjs\")) ||\n existsSync(join(projectPath, \".eslintrc.js\")) ||\n existsSync(join(projectPath, \".eslintrc.json\")) ||\n existsSync(join(projectPath, \".eslintrc\")),\n eslintFlat:\n existsSync(join(projectPath, \"eslint.config.js\")) ||\n existsSync(join(projectPath, \"eslint.config.mjs\")),\n prettier:\n existsSync(join(projectPath, \".prettierrc\")) ||\n existsSync(join(projectPath, \".prettierrc.json\")) ||\n existsSync(join(projectPath, \"prettier.config.js\")) ||\n existsSync(join(projectPath, \"prettier.config.mjs\")),\n vitest:\n existsSync(join(projectPath, \"vitest.config.ts\")) ||\n existsSync(join(projectPath, \"vitest.config.js\")),\n jest:\n existsSync(join(projectPath, \"jest.config.js\")) ||\n existsSync(join(projectPath, \"jest.config.ts\")),\n husky: existsSync(join(projectPath, \".husky\")),\n simpleGitHooks:\n existsSync(join(projectPath, \".git/hooks/pre-commit\")) ||\n (await hasSimpleGitHooksConfig(projectPath)),\n githubActions: existsSync(join(projectPath, \".github/workflows\")),\n };\n\n // Check existing scripts\n const existingScripts: ExistingScripts = {\n build: !!scripts.build,\n test: !!scripts.test,\n lint: !!scripts.lint,\n format: !!scripts.format,\n typecheck: !!scripts.typecheck,\n verify: !!scripts.verify,\n };\n\n // Generate setup plans\n const setupPlans = await generateSetupPlans(\n projectPath,\n packageManager,\n isTypeScript,\n framework,\n existing,\n existingScripts,\n mono,\n );\n\n return {\n packageManager,\n isMonorepo: mono,\n isTypeScript,\n framework,\n existing,\n scripts: existingScripts,\n setupPlans,\n };\n}\n\nasync function hasSimpleGitHooksConfig(projectPath: string): Promise<boolean> {\n try {\n const pkgPath = join(projectPath, \"package.json\");\n if (!existsSync(pkgPath)) return false;\n const pkg = JSON.parse(await readFile(pkgPath, \"utf-8\"));\n return !!pkg[\"simple-git-hooks\"];\n } catch {\n return false;\n }\n}\n\n/**\n * Detect the framework used in the project\n * Returns the primary detected framework for backward compatibility\n */\nasync function detectFramework(projectPath: string): Promise<FrameworkType> {\n const result = await detectAllPlatforms(projectPath);\n return result.primary;\n}\n\n/**\n * Detect all platforms/frameworks in a project\n * Returns both primary and all detected platforms for multi-platform projects\n */\nexport async function detectAllPlatforms(\n projectPath: string,\n): Promise<PlatformDetectionResult> {\n const detected: FrameworkType[] = [];\n\n try {\n const pkgPath = join(projectPath, \"package.json\");\n const hasPkgJson = existsSync(pkgPath);\n\n let deps: Record<string, string> = {};\n let composerDeps: Record<string, string> = {};\n\n if (hasPkgJson) {\n const pkg = JSON.parse(await readFile(pkgPath, \"utf-8\"));\n deps = { ...pkg.dependencies, ...pkg.devDependencies };\n }\n\n // Check for composer.json (PHP projects)\n const composerPath = join(projectPath, \"composer.json\");\n if (existsSync(composerPath)) {\n try {\n const composer = JSON.parse(await readFile(composerPath, \"utf-8\"));\n composerDeps = { ...composer.require, ...composer[\"require-dev\"] };\n } catch {\n // Ignore composer parse errors\n }\n }\n\n // ========================================================================\n // Platform Detection (order matters - more specific first)\n // ========================================================================\n\n // Shopify Hydrogen detection (more specific, check first)\n if (\n deps[\"@shopify/hydrogen\"] ||\n deps[\"@shopify/remix-oxygen\"] ||\n existsSync(join(projectPath, \"hydrogen.config.ts\")) ||\n existsSync(join(projectPath, \"hydrogen.config.js\"))\n ) {\n detected.push(\"shopify-hydrogen\");\n }\n\n // Shopify Theme detection\n if (\n existsSync(join(projectPath, \"shopify.theme.toml\")) ||\n existsSync(join(projectPath, \"config/settings_schema.json\")) ||\n deps[\"@shopify/theme\"] ||\n (await hasLiquidFiles(projectPath))\n ) {\n detected.push(\"shopify-theme\");\n }\n\n // WooCommerce detection (more specific WordPress, check first)\n const hasWooCommerce =\n Object.keys(composerDeps).some((dep) =>\n dep.toLowerCase().includes(\"woocommerce\"),\n ) || existsSync(join(projectPath, \"wp-content/plugins/woocommerce\"));\n\n // WordPress detection\n const isWordPress =\n existsSync(join(projectPath, \"wp-content\")) ||\n existsSync(join(projectPath, \"functions.php\")) ||\n (await hasWordPressThemeHeader(projectPath)) ||\n Object.keys(composerDeps).some(\n (dep) =>\n dep.includes(\"wordpress\") || dep.includes(\"johnpbloch/wordpress\"),\n );\n\n if (hasWooCommerce && isWordPress) {\n detected.push(\"woocommerce\");\n } else if (isWordPress) {\n detected.push(\"wordpress\");\n }\n\n // Magento detection\n if (\n existsSync(join(projectPath, \"app/etc/env.php\")) ||\n existsSync(join(projectPath, \"bin/magento\")) ||\n Object.keys(composerDeps).some((dep) => dep.startsWith(\"magento/\"))\n ) {\n detected.push(\"magento\");\n }\n\n // Standard JS/TS framework detection\n if (deps.next) detected.push(\"nextjs\");\n if (deps[\"@remix-run/react\"] && !detected.includes(\"shopify-hydrogen\")) {\n detected.push(\"remix\");\n }\n if (deps.nuxt) detected.push(\"nuxt\");\n if (deps.vue && !deps.nuxt) detected.push(\"vue\");\n if (deps.svelte || deps[\"@sveltejs/kit\"]) detected.push(\"svelte\");\n if (deps.react && !deps.next && !detected.includes(\"shopify-hydrogen\")) {\n detected.push(\"react\");\n }\n if (deps.hono) detected.push(\"hono\");\n if (deps.express) detected.push(\"express\");\n if (\n (deps[\"@types/node\"] || (hasPkgJson && existsSync(pkgPath))) &&\n detected.length === 0\n ) {\n detected.push(\"node\");\n }\n\n // Determine primary (first detected or unknown)\n const primary = detected.length > 0 ? detected[0] : \"unknown\";\n\n return { primary, detected };\n } catch {\n return { primary: \"unknown\", detected: [] };\n }\n}\n\n/**\n * Check if project has .liquid files (Shopify theme indicator)\n */\nasync function hasLiquidFiles(projectPath: string): Promise<boolean> {\n try {\n const { readdir } = await import(\"fs/promises\");\n const entries = await readdir(projectPath);\n return entries.some((entry) => entry.endsWith(\".liquid\"));\n } catch {\n return false;\n }\n}\n\n/**\n * Check if style.css has WordPress theme header\n */\nasync function hasWordPressThemeHeader(projectPath: string): Promise<boolean> {\n try {\n const stylePath = join(projectPath, \"style.css\");\n if (!existsSync(stylePath)) return false;\n const content = await readFile(stylePath, \"utf-8\");\n return content.includes(\"Theme Name:\");\n } catch {\n return false;\n }\n}\n\n// ============================================================================\n// Setup Plan Generation\n// ============================================================================\n\nasync function generateSetupPlans(\n projectPath: string,\n packageManager: PackageManager,\n isTypeScript: boolean,\n framework: FrameworkType,\n existing: ExistingConfigs,\n scripts: ExistingScripts,\n isMonorepo: boolean,\n): Promise<SetupPlan[]> {\n const plans: SetupPlan[] = [];\n\n // TypeScript setup/improvement\n if (isTypeScript) {\n plans.push(\n await planTypeScriptSetup(\n projectPath,\n framework,\n existing.typescript,\n isMonorepo,\n ),\n );\n }\n\n // ESLint setup/improvement\n plans.push(\n await planESLintSetup(projectPath, isTypeScript, framework, existing),\n );\n\n // Prettier setup/improvement\n plans.push(await planPrettierSetup(projectPath, existing.prettier));\n\n // Testing setup\n plans.push(\n await planTestingSetup(projectPath, isTypeScript, framework, existing),\n );\n\n // Build configuration (for non-framework TS projects)\n if (isTypeScript && ![\"nextjs\", \"remix\", \"nuxt\"].includes(framework)) {\n plans.push(await planBuildSetup(projectPath, scripts.build));\n }\n\n // Scripts setup\n plans.push(\n await planScriptsSetup(projectPath, isTypeScript, framework, scripts),\n );\n\n // Pre-commit hooks\n plans.push(await planHooksSetup(projectPath, existing));\n\n // GitHub Actions CI\n plans.push(\n await planCISetup(\n projectPath,\n packageManager,\n isTypeScript,\n framework,\n existing.githubActions,\n isMonorepo,\n ),\n );\n\n return plans;\n}\n\n// ============================================================================\n// Individual Plan Generators\n// ============================================================================\n\nasync function planTypeScriptSetup(\n projectPath: string,\n _framework: FrameworkType,\n hasExisting: boolean,\n isMonorepo: boolean,\n): Promise<SetupPlan> {\n const changes: ConfigChange[] = [];\n const devDeps: string[] = [];\n\n // Check if typescript is installed\n const pkg = await readPackageJson(projectPath);\n const deps = pkg.dependencies || {};\n const devDepsPkg = pkg.devDependencies || {};\n const allDeps = { ...deps, ...devDepsPkg };\n if (!allDeps.typescript) {\n devDeps.push(\"typescript\");\n }\n\n if (hasExisting) {\n // Audit existing config\n const tsconfig = await readTSConfig(join(projectPath, \"tsconfig.json\"));\n const opts = tsconfig.compilerOptions || {};\n\n // Recommend improvements\n if (!opts.strict) {\n changes.push({\n type: \"modify\",\n file: \"tsconfig.json\",\n key: \"compilerOptions.strict\",\n oldValue: opts.strict,\n newValue: true,\n description: \"Enable strict type checking\",\n });\n }\n if (!opts.skipLibCheck) {\n changes.push({\n type: \"modify\",\n file: \"tsconfig.json\",\n key: \"compilerOptions.skipLibCheck\",\n oldValue: opts.skipLibCheck,\n newValue: true,\n description:\n \"Skip type checking of declaration files for faster builds\",\n });\n }\n if (opts.target !== \"ES2022\" && opts.target !== \"ESNext\") {\n changes.push({\n type: \"modify\",\n file: \"tsconfig.json\",\n key: \"compilerOptions.target\",\n oldValue: opts.target,\n newValue: \"ES2022\",\n description: \"Use modern JavaScript target\",\n });\n }\n } else {\n changes.push({\n type: \"add\",\n file: isMonorepo ? \"tsconfig.base.json\" : \"tsconfig.json\",\n description: `Create TypeScript configuration${isMonorepo ? \" (shared base for monorepo)\" : \"\"}`,\n });\n }\n\n return {\n name: \"typescript\",\n description: hasExisting\n ? \"Improve TypeScript configuration\"\n : \"Set up TypeScript configuration\",\n priority: \"high\",\n changes,\n dependencies: [],\n devDependencies: devDeps,\n };\n}\n\nasync function planESLintSetup(\n projectPath: string,\n isTypeScript: boolean,\n framework: FrameworkType,\n existing: ExistingConfigs,\n): Promise<SetupPlan> {\n const changes: ConfigChange[] = [];\n const devDeps: string[] = [];\n\n const pkg = await readPackageJson(projectPath);\n const deps = pkg.dependencies || {};\n const devDepsPkg = pkg.devDependencies || {};\n const allDeps = { ...deps, ...devDepsPkg };\n\n // Core ESLint\n if (!allDeps.eslint) {\n devDeps.push(\"eslint\");\n }\n\n // TypeScript support\n if (isTypeScript) {\n if (!allDeps[\"@typescript-eslint/eslint-plugin\"]) {\n devDeps.push(\"@typescript-eslint/eslint-plugin\");\n }\n if (!allDeps[\"@typescript-eslint/parser\"]) {\n devDeps.push(\"@typescript-eslint/parser\");\n }\n if (!allDeps[\"typescript-eslint\"]) {\n devDeps.push(\"typescript-eslint\");\n }\n }\n\n // Framework-specific plugins\n if (framework === \"react\" || framework === \"nextjs\") {\n if (!allDeps[\"eslint-plugin-react\"]) devDeps.push(\"eslint-plugin-react\");\n if (!allDeps[\"eslint-plugin-react-hooks\"])\n devDeps.push(\"eslint-plugin-react-hooks\");\n }\n\n if (existing.eslint) {\n if (!existing.eslintFlat) {\n changes.push({\n type: \"modify\",\n file: \"eslint.config.mjs\",\n description: \"Migrate to ESLint 9 flat config format (recommended)\",\n });\n } else {\n changes.push({\n type: \"unchanged\",\n file: \"eslint.config.mjs\",\n description: \"ESLint flat config already exists\",\n });\n }\n } else {\n changes.push({\n type: \"add\",\n file: \"eslint.config.mjs\",\n description: \"Create ESLint configuration with TypeScript support\",\n });\n }\n\n return {\n name: \"eslint\",\n description: existing.eslint\n ? \"Audit ESLint configuration and dependencies\"\n : \"Set up ESLint for code linting\",\n priority: \"high\",\n changes,\n dependencies: [],\n devDependencies: devDeps,\n };\n}\n\nasync function planPrettierSetup(\n projectPath: string,\n hasExisting: boolean,\n): Promise<SetupPlan> {\n const changes: ConfigChange[] = [];\n const devDeps: string[] = [];\n\n const pkg = await readPackageJson(projectPath);\n const deps = pkg.dependencies || {};\n const devDepsPkg = pkg.devDependencies || {};\n const allDeps = { ...deps, ...devDepsPkg };\n\n if (!allDeps.prettier) {\n devDeps.push(\"prettier\");\n }\n\n if (hasExisting) {\n const prettierConfig = await readPrettierConfig(projectPath);\n // Check for recommended settings\n if (prettierConfig.printWidth === undefined) {\n changes.push({\n type: \"modify\",\n file: \".prettierrc\",\n key: \"printWidth\",\n newValue: 100,\n description: \"Add printWidth setting\",\n });\n }\n if (prettierConfig.trailingComma === undefined) {\n changes.push({\n type: \"modify\",\n file: \".prettierrc\",\n key: \"trailingComma\",\n newValue: \"es5\",\n description: \"Add trailing comma setting\",\n });\n }\n if (changes.length === 0) {\n changes.push({\n type: \"unchanged\",\n file: \".prettierrc\",\n description: \"Prettier configuration is complete\",\n });\n }\n } else {\n changes.push({\n type: \"add\",\n file: \".prettierrc\",\n description: \"Create Prettier configuration\",\n });\n changes.push({\n type: \"add\",\n file: \".prettierignore\",\n description: \"Create Prettier ignore file\",\n });\n }\n\n return {\n name: \"prettier\",\n description: hasExisting\n ? \"Audit Prettier configuration\"\n : \"Set up Prettier for code formatting\",\n priority: \"high\",\n changes,\n dependencies: [],\n devDependencies: devDeps,\n };\n}\n\nasync function planTestingSetup(\n projectPath: string,\n isTypeScript: boolean,\n framework: FrameworkType,\n existing: ExistingConfigs,\n): Promise<SetupPlan> {\n const changes: ConfigChange[] = [];\n const devDeps: string[] = [];\n\n const pkg = await readPackageJson(projectPath);\n const deps = pkg.dependencies || {};\n const devDepsPkg = pkg.devDependencies || {};\n const allDeps = { ...deps, ...devDepsPkg };\n\n // Respect existing Jest - don't force Vitest\n if (existing.jest) {\n changes.push({\n type: \"unchanged\",\n file: \"jest.config.*\",\n description: \"Jest configuration exists (preserving existing setup)\",\n });\n return {\n name: \"testing\",\n description: \"Jest testing already configured\",\n priority: \"high\",\n changes,\n dependencies: [],\n devDependencies: [],\n };\n }\n\n // Set up Vitest\n if (!allDeps.vitest) {\n devDeps.push(\"vitest\");\n }\n if (!allDeps[\"@vitest/coverage-v8\"]) {\n devDeps.push(\"@vitest/coverage-v8\");\n }\n\n // DOM testing for frontend frameworks\n if ([\"react\", \"nextjs\", \"vue\", \"nuxt\", \"svelte\"].includes(framework)) {\n if (!allDeps.jsdom) devDeps.push(\"jsdom\");\n if (framework === \"react\" || framework === \"nextjs\") {\n if (!allDeps[\"@testing-library/react\"])\n devDeps.push(\"@testing-library/react\");\n }\n }\n\n if (existing.vitest) {\n changes.push({\n type: \"unchanged\",\n file: `vitest.config.${isTypeScript ? \"ts\" : \"js\"}`,\n description: \"Vitest configuration already exists\",\n });\n } else {\n changes.push({\n type: \"add\",\n file: `vitest.config.${isTypeScript ? \"ts\" : \"js\"}`,\n description: \"Create Vitest configuration\",\n });\n }\n\n return {\n name: \"testing\",\n description: existing.vitest\n ? \"Audit Vitest dependencies\"\n : \"Set up Vitest for testing\",\n priority: \"high\",\n changes,\n dependencies: [],\n devDependencies: devDeps,\n };\n}\n\nasync function planBuildSetup(\n projectPath: string,\n hasBuildScript: boolean,\n): Promise<SetupPlan> {\n const changes: ConfigChange[] = [];\n const devDeps: string[] = [];\n\n const pkg = await readPackageJson(projectPath);\n const deps = pkg.dependencies || {};\n const devDepsPkg = pkg.devDependencies || {};\n const allDeps = { ...deps, ...devDepsPkg };\n\n if (hasBuildScript) {\n changes.push({\n type: \"unchanged\",\n file: \"package.json\",\n key: \"scripts.build\",\n description: \"Build script already configured\",\n });\n } else {\n if (!allDeps.tsup) {\n devDeps.push(\"tsup\");\n }\n changes.push({\n type: \"add\",\n file: \"tsup.config.ts\",\n description: \"Create tsup build configuration\",\n });\n }\n\n return {\n name: \"build\",\n description: hasBuildScript\n ? \"Build configuration exists\"\n : \"Set up tsup for TypeScript builds\",\n priority: \"medium\",\n changes,\n dependencies: [],\n devDependencies: devDeps,\n };\n}\n\nasync function planScriptsSetup(\n _projectPath: string,\n isTypeScript: boolean,\n _framework: FrameworkType,\n scripts: ExistingScripts,\n): Promise<SetupPlan> {\n const changes: ConfigChange[] = [];\n const scriptsToAdd: Record<string, string> = {};\n\n if (!scripts.lint) {\n scriptsToAdd.lint = \"eslint src\";\n changes.push({\n type: \"add\",\n file: \"package.json\",\n key: \"scripts.lint\",\n newValue: \"eslint src\",\n description: \"Add lint script\",\n });\n }\n\n if (!scripts.format) {\n scriptsToAdd.format = 'prettier --write \"src/**/*.{ts,tsx,js,jsx,json}\"';\n changes.push({\n type: \"add\",\n file: \"package.json\",\n key: \"scripts.format\",\n newValue: scriptsToAdd.format,\n description: \"Add format script\",\n });\n }\n\n if (isTypeScript && !scripts.typecheck) {\n scriptsToAdd.typecheck = \"tsc --noEmit\";\n changes.push({\n type: \"add\",\n file: \"package.json\",\n key: \"scripts.typecheck\",\n newValue: \"tsc --noEmit\",\n description: \"Add typecheck script\",\n });\n }\n\n if (!scripts.test) {\n scriptsToAdd.test = \"vitest run\";\n changes.push({\n type: \"add\",\n file: \"package.json\",\n key: \"scripts.test\",\n newValue: \"vitest run\",\n description: \"Add test script\",\n });\n }\n\n if (!scripts.verify) {\n scriptsToAdd.verify = \"workflow-agent verify\";\n changes.push({\n type: \"add\",\n file: \"package.json\",\n key: \"scripts.verify\",\n newValue: \"workflow-agent verify\",\n description: \"Add verify script\",\n });\n }\n\n if (Object.keys(scriptsToAdd).length === 0) {\n changes.push({\n type: \"unchanged\",\n file: \"package.json\",\n description: \"All standard scripts already configured\",\n });\n }\n\n return {\n name: \"scripts\",\n description: \"Configure npm scripts\",\n priority: \"medium\",\n changes,\n dependencies: [],\n devDependencies: [],\n };\n}\n\nasync function planHooksSetup(\n projectPath: string,\n existing: ExistingConfigs,\n): Promise<SetupPlan> {\n const changes: ConfigChange[] = [];\n const devDeps: string[] = [];\n\n const pkg = await readPackageJson(projectPath);\n const deps = pkg.dependencies || {};\n const devDepsPkg = pkg.devDependencies || {};\n const allDeps = { ...deps, ...devDepsPkg };\n\n // Prefer simple-git-hooks over husky\n if (!allDeps[\"simple-git-hooks\"]) {\n devDeps.push(\"simple-git-hooks\");\n }\n if (!allDeps[\"lint-staged\"]) {\n devDeps.push(\"lint-staged\");\n }\n\n if (existing.husky || existing.simpleGitHooks) {\n changes.push({\n type: \"modify\",\n file: \"package.json\",\n key: \"simple-git-hooks\",\n description: \"Ensure pre-commit hook configuration\",\n });\n } else {\n changes.push({\n type: \"add\",\n file: \"package.json\",\n key: \"simple-git-hooks\",\n newValue: { \"pre-commit\": \"npx lint-staged\" },\n description: \"Add pre-commit hook configuration\",\n });\n changes.push({\n type: \"add\",\n file: \"package.json\",\n key: \"lint-staged\",\n description: \"Add lint-staged configuration\",\n });\n }\n\n return {\n name: \"hooks\",\n description:\n existing.husky || existing.simpleGitHooks\n ? \"Audit pre-commit hooks\"\n : \"Set up pre-commit hooks\",\n priority: \"medium\",\n changes,\n dependencies: [],\n devDependencies: devDeps,\n };\n}\n\nasync function planCISetup(\n projectPath: string,\n _packageManager: PackageManager,\n _isTypeScript: boolean,\n _framework: FrameworkType,\n hasExisting: boolean,\n _isMonorepo: boolean,\n): Promise<SetupPlan> {\n const changes: ConfigChange[] = [];\n\n if (hasExisting) {\n // Check if ci.yml exists specifically\n if (existsSync(join(projectPath, \".github/workflows/ci.yml\"))) {\n changes.push({\n type: \"unchanged\",\n file: \".github/workflows/ci.yml\",\n description: \"CI workflow already exists\",\n });\n } else {\n changes.push({\n type: \"add\",\n file: \".github/workflows/ci.yml\",\n description: \"Add CI workflow (other workflows exist)\",\n });\n }\n } else {\n changes.push({\n type: \"add\",\n file: \".github/workflows/ci.yml\",\n description: \"Create GitHub Actions CI workflow\",\n });\n }\n\n return {\n name: \"ci\",\n description: hasExisting\n ? \"Audit CI configuration\"\n : \"Set up GitHub Actions CI\",\n priority: \"low\",\n changes,\n dependencies: [],\n devDependencies: [],\n };\n}\n\n// ============================================================================\n// Audit Report Generation\n// ============================================================================\n\n/**\n * Generate a comprehensive audit report\n */\nexport async function generateAuditReport(\n projectPath: string = process.cwd(),\n): Promise<AuditReport> {\n const analysis = await analyzeProject(projectPath);\n\n // Collect all dependencies across plans\n const allDeps = new Set<string>();\n const allDevDeps = new Set<string>();\n\n for (const plan of analysis.setupPlans) {\n plan.dependencies.forEach((d) => allDeps.add(d));\n plan.devDependencies.forEach((d) => allDevDeps.add(d));\n }\n\n // Count total changes\n const totalChanges = analysis.setupPlans.reduce(\n (sum, plan) =>\n sum + plan.changes.filter((c) => c.type !== \"unchanged\").length,\n 0,\n );\n\n return {\n analysis,\n totalChanges,\n allDependencies: Array.from(allDeps),\n allDevDependencies: Array.from(allDevDeps),\n plans: analysis.setupPlans,\n };\n}\n\n/**\n * Format audit report for console display\n */\nexport function formatAuditReport(report: AuditReport): string {\n const lines: string[] = [];\n\n lines.push(\"📋 Auto-Setup Audit Report\\n\");\n lines.push(`Framework: ${report.analysis.framework}`);\n lines.push(`Package Manager: ${report.analysis.packageManager}`);\n lines.push(`TypeScript: ${report.analysis.isTypeScript ? \"Yes\" : \"No\"}`);\n lines.push(`Monorepo: ${report.analysis.isMonorepo ? \"Yes\" : \"No\"}\\n`);\n\n for (const plan of report.plans) {\n const hasChanges = plan.changes.some((c) => c.type !== \"unchanged\");\n const icon = hasChanges ? \"🔧\" : \"✓\";\n lines.push(\n `${icon} ${plan.name.charAt(0).toUpperCase() + plan.name.slice(1)}`,\n );\n\n for (const change of plan.changes) {\n const symbol =\n change.type === \"add\" ? \"+\" : change.type === \"modify\" ? \"~\" : \"=\";\n\n let line = ` ${symbol} ${change.description}`;\n if (\n change.key &&\n change.oldValue !== undefined &&\n change.newValue !== undefined\n ) {\n line += ` (${String(change.oldValue)} → ${String(change.newValue)})`;\n }\n lines.push(line);\n }\n\n if (plan.devDependencies.length > 0) {\n lines.push(` 📦 Install: ${plan.devDependencies.join(\", \")}`);\n }\n lines.push(\"\");\n }\n\n if (report.allDevDependencies.length > 0) {\n lines.push(\"Dependencies to install (batched):\");\n const pm = report.analysis.packageManager;\n const cmd =\n pm === \"npm\" ? \"npm install\" : pm === \"yarn\" ? \"yarn add\" : `${pm} add`;\n lines.push(` ${cmd} -D ${report.allDevDependencies.join(\" \")}`);\n lines.push(\"\");\n }\n\n lines.push(`Total changes: ${report.totalChanges}`);\n\n return lines.join(\"\\n\");\n}\n\n// ============================================================================\n// Setup Execution\n// ============================================================================\n\n/**\n * Execute all setup plans\n */\nexport async function runAllSetups(\n projectPath: string = process.cwd(),\n onProgress?: (step: string, status: \"start\" | \"done\" | \"error\") => void,\n): Promise<SetupResult[]> {\n const report = await generateAuditReport(projectPath);\n const results: SetupResult[] = [];\n const filesCreated: string[] = [];\n const filesUpdated: string[] = [];\n\n // Step 1: Batch install all dependencies\n if (report.allDevDependencies.length > 0) {\n onProgress?.(\"Installing dependencies\", \"start\");\n try {\n await installDependencies(\n projectPath,\n report.analysis.packageManager,\n report.allDevDependencies,\n );\n onProgress?.(\"Installing dependencies\", \"done\");\n } catch (error) {\n onProgress?.(\"Installing dependencies\", \"error\");\n results.push({\n success: false,\n name: \"dependencies\",\n message: `Failed to install: ${error instanceof Error ? error.message : String(error)}`,\n filesCreated: [],\n filesUpdated: [],\n packagesInstalled: [],\n });\n return results;\n }\n }\n\n // Step 2: Apply each setup\n for (const plan of report.plans) {\n const hasChanges = plan.changes.some((c) => c.type !== \"unchanged\");\n if (!hasChanges && plan.devDependencies.length === 0) continue;\n\n onProgress?.(`Setting up ${plan.name}`, \"start\");\n\n try {\n const result = await applySetupPlan(projectPath, plan, report.analysis);\n results.push(result);\n filesCreated.push(...result.filesCreated);\n filesUpdated.push(...result.filesUpdated);\n onProgress?.(`Setting up ${plan.name}`, \"done\");\n } catch (error) {\n onProgress?.(`Setting up ${plan.name}`, \"error\");\n results.push({\n success: false,\n name: plan.name,\n message: `Failed: ${error instanceof Error ? error.message : String(error)}`,\n filesCreated: [],\n filesUpdated: [],\n packagesInstalled: [],\n });\n }\n }\n\n // Step 3: Initialize git hooks\n onProgress?.(\"Initializing git hooks\", \"start\");\n try {\n await execa(\"npx\", [\"simple-git-hooks\"], {\n cwd: projectPath,\n stdio: \"pipe\",\n });\n onProgress?.(\"Initializing git hooks\", \"done\");\n } catch {\n // May fail if not in a git repo\n onProgress?.(\"Initializing git hooks\", \"error\");\n }\n\n return results;\n}\n\nasync function installDependencies(\n projectPath: string,\n packageManager: PackageManager,\n packages: string[],\n): Promise<void> {\n if (packages.length === 0) return;\n\n const commands: Record<PackageManager, { cmd: string; args: string[] }> = {\n npm: { cmd: \"npm\", args: [\"install\", \"--save-dev\"] },\n pnpm: { cmd: \"pnpm\", args: [\"add\", \"-D\"] },\n yarn: { cmd: \"yarn\", args: [\"add\", \"-D\"] },\n bun: { cmd: \"bun\", args: [\"add\", \"-D\"] },\n };\n\n const { cmd, args } = commands[packageManager];\n await execa(cmd, [...args, ...packages], {\n cwd: projectPath,\n stdio: \"pipe\",\n });\n}\n\nasync function applySetupPlan(\n projectPath: string,\n plan: SetupPlan,\n analysis: ProjectAnalysis,\n): Promise<SetupResult> {\n const filesCreated: string[] = [];\n const filesUpdated: string[] = [];\n\n switch (plan.name) {\n case \"typescript\":\n await applyTypeScriptSetup(\n projectPath,\n analysis,\n filesCreated,\n filesUpdated,\n );\n break;\n case \"eslint\":\n await applyESLintSetup(projectPath, analysis, filesCreated, filesUpdated);\n break;\n case \"prettier\":\n await applyPrettierSetup(projectPath, filesCreated, filesUpdated);\n break;\n case \"testing\":\n await applyTestingSetup(\n projectPath,\n analysis,\n filesCreated,\n filesUpdated,\n );\n break;\n case \"build\":\n await applyBuildSetup(projectPath, filesCreated, filesUpdated);\n break;\n case \"scripts\":\n await applyScriptsSetup(projectPath, analysis, filesUpdated);\n break;\n case \"hooks\":\n await applyHooksSetup(projectPath, filesUpdated);\n break;\n case \"ci\":\n await applyCISetup(projectPath, analysis, filesCreated, filesUpdated);\n break;\n }\n\n return {\n success: true,\n name: plan.name,\n message: `${plan.name} configured successfully`,\n filesCreated,\n filesUpdated,\n packagesInstalled: plan.devDependencies,\n };\n}\n\n// ============================================================================\n// Setup Application Functions\n// ============================================================================\n\nasync function applyTypeScriptSetup(\n projectPath: string,\n analysis: ProjectAnalysis,\n filesCreated: string[],\n filesUpdated: string[],\n): Promise<void> {\n const configName = analysis.isMonorepo\n ? \"tsconfig.base.json\"\n : \"tsconfig.json\";\n const configPath = join(projectPath, configName);\n\n let tsconfig: Record<string, unknown> = {};\n\n if (existsSync(configPath)) {\n tsconfig = await readJsonFile(configPath);\n filesUpdated.push(configName);\n } else {\n filesCreated.push(configName);\n }\n\n // Ensure compilerOptions\n if (!tsconfig.compilerOptions) {\n tsconfig.compilerOptions = {};\n }\n const opts = tsconfig.compilerOptions as Record<string, unknown>;\n\n // Apply improvements (merge with existing)\n const improvements: Record<string, unknown> = {\n target: opts.target || \"ES2022\",\n module: opts.module || \"ESNext\",\n moduleResolution: opts.moduleResolution || \"bundler\",\n esModuleInterop: opts.esModuleInterop ?? true,\n strict: opts.strict ?? true,\n skipLibCheck: opts.skipLibCheck ?? true,\n resolveJsonModule: opts.resolveJsonModule ?? true,\n isolatedModules: opts.isolatedModules ?? true,\n declaration: opts.declaration ?? true,\n declarationMap: opts.declarationMap ?? true,\n sourceMap: opts.sourceMap ?? true,\n };\n\n // Framework-specific options\n const frameworkOpts = getFrameworkTsOptions(analysis.framework);\n\n tsconfig.compilerOptions = { ...opts, ...improvements, ...frameworkOpts };\n\n // Ensure include/exclude\n if (!tsconfig.include) {\n tsconfig.include = [\"src/**/*\"];\n }\n if (!tsconfig.exclude) {\n tsconfig.exclude = [\"node_modules\", \"dist\", \"coverage\"];\n }\n\n await writeFile(configPath, JSON.stringify(tsconfig, null, 2) + \"\\n\");\n}\n\nfunction getFrameworkTsOptions(\n framework: FrameworkType,\n): Record<string, unknown> {\n switch (framework) {\n case \"nextjs\":\n return {\n lib: [\"dom\", \"dom.iterable\", \"esnext\"],\n jsx: \"preserve\",\n incremental: true,\n plugins: [{ name: \"next\" }],\n };\n case \"react\":\n case \"remix\":\n return {\n lib: [\"dom\", \"dom.iterable\", \"esnext\"],\n jsx: \"react-jsx\",\n };\n case \"vue\":\n case \"nuxt\":\n return {\n lib: [\"esnext\", \"dom\"],\n jsx: \"preserve\",\n };\n default:\n return {};\n }\n}\n\nasync function applyESLintSetup(\n projectPath: string,\n analysis: ProjectAnalysis,\n filesCreated: string[],\n _filesUpdated: string[],\n): Promise<void> {\n // Only create new config if no flat config exists\n if (analysis.existing.eslintFlat) {\n return;\n }\n\n const configPath = join(projectPath, \"eslint.config.mjs\");\n const config = generateESLintFlatConfig(\n analysis.isTypeScript,\n analysis.framework,\n );\n\n await writeFile(configPath, config);\n filesCreated.push(\"eslint.config.mjs\");\n}\n\nfunction generateESLintFlatConfig(\n isTypeScript: boolean,\n framework: FrameworkType,\n): string {\n const imports: string[] = [];\n const configs: string[] = [];\n\n if (isTypeScript) {\n imports.push(`import tseslint from \"typescript-eslint\";`);\n }\n\n // Add react plugin import if needed\n if (framework === \"react\" || framework === \"nextjs\") {\n imports.push(`import react from \"eslint-plugin-react\";`);\n imports.push(`import reactHooks from \"eslint-plugin-react-hooks\";`);\n }\n\n // Base config\n if (isTypeScript) {\n configs.push(` ...tseslint.configs.recommended`);\n }\n\n configs.push(` {\n files: [\"**/*.${isTypeScript ? \"{ts,tsx}\" : \"{js,jsx}\"}\"],\n rules: {\n ${isTypeScript ? `\"@typescript-eslint/no-unused-vars\": [\"error\", { argsIgnorePattern: \"^_\" }],` : \"\"}\n \"no-console\": \"warn\",\n },\n }`);\n\n configs.push(` {\n ignores: [\"dist/\", \"node_modules/\", \"coverage/\", \".next/\", \"build/\"],\n }`);\n\n return `${imports.join(\"\\n\")}\n\nexport default [\n${configs.join(\",\\n\")}\n];\n`;\n}\n\nasync function applyPrettierSetup(\n projectPath: string,\n filesCreated: string[],\n filesUpdated: string[],\n): Promise<void> {\n const prettierPath = join(projectPath, \".prettierrc\");\n\n let config: Record<string, unknown> = {\n semi: true,\n singleQuote: false,\n tabWidth: 2,\n trailingComma: \"es5\",\n printWidth: 100,\n bracketSpacing: true,\n };\n\n if (existsSync(prettierPath)) {\n const existing = await readPrettierConfig(projectPath);\n config = { ...config, ...existing };\n filesUpdated.push(\".prettierrc\");\n } else {\n filesCreated.push(\".prettierrc\");\n }\n\n await writeFile(prettierPath, JSON.stringify(config, null, 2) + \"\\n\");\n\n // Create .prettierignore if it doesn't exist\n const ignorePath = join(projectPath, \".prettierignore\");\n if (!existsSync(ignorePath)) {\n const ignoreContent = `dist/\nnode_modules/\ncoverage/\n.next/\nbuild/\n*.min.js\npnpm-lock.yaml\npackage-lock.json\nyarn.lock\n`;\n await writeFile(ignorePath, ignoreContent);\n filesCreated.push(\".prettierignore\");\n }\n}\n\nasync function applyTestingSetup(\n projectPath: string,\n analysis: ProjectAnalysis,\n filesCreated: string[],\n _filesUpdated: string[],\n): Promise<void> {\n // Skip if jest exists or vitest already configured\n if (analysis.existing.jest || analysis.existing.vitest) {\n return;\n }\n\n const ext = analysis.isTypeScript ? \"ts\" : \"js\";\n const configPath = join(projectPath, `vitest.config.${ext}`);\n\n const environment = [\"react\", \"nextjs\", \"vue\", \"nuxt\", \"svelte\"].includes(\n analysis.framework,\n )\n ? \"jsdom\"\n : \"node\";\n\n const config = `import { defineConfig } from \"vitest/config\";\n\nexport default defineConfig({\n test: {\n globals: true,\n environment: \"${environment}\",\n coverage: {\n provider: \"v8\",\n reporter: [\"text\", \"json\", \"html\"],\n exclude: [\"node_modules/\", \"dist/\", \"**/*.test.${ext}\"],\n },\n include: [\"src/**/*.test.${ext}\", \"tests/**/*.test.${ext}\"],\n },\n});\n`;\n\n await writeFile(configPath, config);\n filesCreated.push(`vitest.config.${ext}`);\n}\n\nasync function applyBuildSetup(\n projectPath: string,\n filesCreated: string[],\n _filesUpdated: string[],\n): Promise<void> {\n const configPath = join(projectPath, \"tsup.config.ts\");\n\n if (existsSync(configPath)) {\n return;\n }\n\n const config = `import { defineConfig } from \"tsup\";\n\nexport default defineConfig({\n entry: [\"src/index.ts\"],\n format: [\"esm\"],\n dts: true,\n clean: true,\n sourcemap: true,\n});\n`;\n\n await writeFile(configPath, config);\n filesCreated.push(\"tsup.config.ts\");\n}\n\nasync function applyScriptsSetup(\n projectPath: string,\n analysis: ProjectAnalysis,\n filesUpdated: string[],\n): Promise<void> {\n const pkgPath = join(projectPath, \"package.json\");\n const pkg = await readPackageJson(projectPath);\n const scripts = pkg.scripts || {};\n\n // Add missing scripts (don't overwrite)\n const scriptsToAdd: Record<string, string> = {\n lint: \"eslint src\",\n \"lint:fix\": \"eslint src --fix\",\n format: 'prettier --write \"src/**/*.{ts,tsx,js,jsx,json}\"',\n \"format:check\": 'prettier --check \"src/**/*.{ts,tsx,js,jsx,json}\"',\n test: \"vitest run\",\n \"test:watch\": \"vitest\",\n \"test:coverage\": \"vitest run --coverage\",\n verify: \"workflow-agent verify\",\n \"verify:fix\": \"workflow-agent verify --fix\",\n \"pre-commit\": \"workflow-agent verify --fix\",\n };\n\n if (analysis.isTypeScript) {\n scriptsToAdd.typecheck = \"tsc --noEmit\";\n }\n\n let added = false;\n for (const [name, cmd] of Object.entries(scriptsToAdd)) {\n if (!scripts[name]) {\n scripts[name] = cmd;\n added = true;\n }\n }\n\n if (added) {\n pkg.scripts = scripts;\n await writeFile(pkgPath, JSON.stringify(pkg, null, 2) + \"\\n\");\n filesUpdated.push(\"package.json\");\n }\n}\n\nasync function applyHooksSetup(\n projectPath: string,\n filesUpdated: string[],\n): Promise<void> {\n const pkgPath = join(projectPath, \"package.json\");\n const pkg = await readPackageJson(projectPath);\n\n // Add simple-git-hooks config\n if (!pkg[\"simple-git-hooks\"]) {\n pkg[\"simple-git-hooks\"] = {\n \"pre-commit\": \"npx lint-staged\",\n };\n }\n\n // Add lint-staged config\n if (!pkg[\"lint-staged\"]) {\n pkg[\"lint-staged\"] = {\n \"*.{ts,tsx,js,jsx}\": [\"eslint --fix\", \"prettier --write\"],\n \"*.{json,md,yml,yaml}\": [\"prettier --write\"],\n };\n }\n\n await writeFile(pkgPath, JSON.stringify(pkg, null, 2) + \"\\n\");\n filesUpdated.push(\"package.json\");\n}\n\nasync function applyCISetup(\n projectPath: string,\n analysis: ProjectAnalysis,\n filesCreated: string[],\n _filesUpdated: string[],\n): Promise<void> {\n const workflowsDir = join(projectPath, \".github/workflows\");\n await mkdir(workflowsDir, { recursive: true });\n\n const ciPath = join(workflowsDir, \"ci.yml\");\n\n if (existsSync(ciPath)) {\n return;\n }\n\n const workflow = generateCIWorkflow(\n analysis.packageManager,\n analysis.isTypeScript,\n analysis.framework,\n analysis.isMonorepo,\n );\n\n await writeFile(ciPath, workflow);\n filesCreated.push(\".github/workflows/ci.yml\");\n}\n\nfunction generateCIWorkflow(\n packageManager: PackageManager,\n isTypeScript: boolean,\n framework: FrameworkType,\n _isMonorepo: boolean,\n): string {\n const runCmd =\n packageManager === \"npm\"\n ? \"npm run\"\n : packageManager === \"yarn\"\n ? \"yarn\"\n : packageManager;\n const isPnpm = packageManager === \"pnpm\";\n\n return `name: CI\n\non:\n push:\n branches: [main, master]\n pull_request:\n branches: [main, master]\n\njobs:\n ci:\n runs-on: ubuntu-latest\n\n steps:\n - name: Checkout\n uses: actions/checkout@v4\n\n - name: Setup Node.js\n uses: actions/setup-node@v4\n with:\n node-version: \"20\"\n${\n isPnpm\n ? `\n - name: Install pnpm\n uses: pnpm/action-setup@v4\n with:\n version: 9\n`\n : \"\"\n}\n - name: Install dependencies\n run: ${packageManager} install\n\n${\n isTypeScript\n ? ` - name: Type check\n run: ${runCmd} typecheck\n\n`\n : \"\"\n} - name: Lint\n run: ${runCmd} lint\n\n - name: Format check\n run: ${runCmd} format:check || true\n\n - name: Test\n run: ${runCmd} test\n${\n isTypeScript && ![\"nextjs\", \"remix\", \"nuxt\"].includes(framework)\n ? `\n - name: Build\n run: ${runCmd} build\n`\n : \"\"\n}`;\n}\n\n// ============================================================================\n// Utility Functions\n// ============================================================================\n\nasync function readPackageJson(projectPath: string): Promise<PackageJson> {\n const pkgPath = join(projectPath, \"package.json\");\n if (!existsSync(pkgPath)) {\n return {};\n }\n return JSON.parse(await readFile(pkgPath, \"utf-8\")) as PackageJson;\n}\n\nasync function readTSConfig(filePath: string): Promise<TSConfig> {\n if (!existsSync(filePath)) {\n return {};\n }\n return JSON.parse(await readFile(filePath, \"utf-8\")) as TSConfig;\n}\n\nasync function readJsonFile(\n filePath: string,\n): Promise<Record<string, unknown>> {\n if (!existsSync(filePath)) {\n return {};\n }\n return JSON.parse(await readFile(filePath, \"utf-8\"));\n}\n\nasync function readPrettierConfig(\n projectPath: string,\n): Promise<Record<string, unknown>> {\n const files = [\".prettierrc\", \".prettierrc.json\", \"prettier.config.js\"];\n\n for (const file of files) {\n const filePath = join(projectPath, file);\n if (existsSync(filePath)) {\n if (file.endsWith(\".js\")) {\n return {}; // Can't easily read JS config\n }\n try {\n return JSON.parse(await readFile(filePath, \"utf-8\"));\n } catch {\n return {};\n }\n }\n }\n\n return {};\n}\n","/**\n * Git repository utilities for detecting repository info,\n * package manager, monorepo setup, and GitHub remote\n */\n\nimport { execa } from \"execa\";\nimport { existsSync } from \"fs\";\nimport { readFile } from \"fs/promises\";\nimport { join } from \"path\";\n\nexport type PackageManager = \"npm\" | \"pnpm\" | \"yarn\" | \"bun\";\n\nexport interface GitHubInfo {\n owner: string;\n repo: string;\n}\n\nexport interface RepoInfo {\n isGitRepo: boolean;\n remoteUrl: string | null;\n isGitHub: boolean;\n github: GitHubInfo | null;\n defaultBranch: string | null;\n}\n\nexport interface ProjectInfo {\n packageManager: PackageManager;\n isMonorepo: boolean;\n hasLintScript: boolean;\n hasTypecheckScript: boolean;\n hasFormatScript: boolean;\n hasTestScript: boolean;\n hasBuildScript: boolean;\n}\n\n/**\n * Check if the current directory is a git repository\n */\nexport async function isGitRepo(\n projectPath: string = process.cwd(),\n): Promise<boolean> {\n try {\n await execa(\"git\", [\"rev-parse\", \"--git-dir\"], { cwd: projectPath });\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Get the git remote URL for origin\n */\nexport async function getGitRemoteUrl(\n projectPath: string = process.cwd(),\n): Promise<string | null> {\n try {\n const { stdout } = await execa(\"git\", [\"remote\", \"get-url\", \"origin\"], {\n cwd: projectPath,\n });\n return stdout.trim() || null;\n } catch {\n return null;\n }\n}\n\n/**\n * Check if the remote URL is a GitHub repository\n */\nexport function isGitHubRemote(remoteUrl: string | null): boolean {\n if (!remoteUrl) return false;\n return remoteUrl.includes(\"github.com\");\n}\n\n/**\n * Parse GitHub owner and repo from remote URL\n * Supports both SSH (git@github.com:owner/repo.git) and HTTPS (https://github.com/owner/repo.git)\n */\nexport function parseGitHubUrl(remoteUrl: string | null): GitHubInfo | null {\n if (!remoteUrl || !isGitHubRemote(remoteUrl)) return null;\n\n // Match: git@github.com:owner/repo.git or https://github.com/owner/repo.git\n const match = remoteUrl.match(/github\\.com[:/]([^/]+)\\/([^/.]+)/);\n\n if (match) {\n return {\n owner: match[1],\n repo: match[2].replace(/\\.git$/, \"\"),\n };\n }\n\n return null;\n}\n\n/**\n * Get the default branch name\n */\nexport async function getDefaultBranch(\n projectPath: string = process.cwd(),\n): Promise<string | null> {\n try {\n // Try to get from remote\n const { stdout } = await execa(\n \"git\",\n [\"symbolic-ref\", \"refs/remotes/origin/HEAD\"],\n {\n cwd: projectPath,\n },\n );\n return stdout.trim().replace(\"refs/remotes/origin/\", \"\") || \"main\";\n } catch {\n // Fallback: try HEAD\n try {\n const { stdout } = await execa(\n \"git\",\n [\"rev-parse\", \"--abbrev-ref\", \"HEAD\"],\n {\n cwd: projectPath,\n },\n );\n return stdout.trim() || \"main\";\n } catch {\n return \"main\";\n }\n }\n}\n\n/**\n * Get comprehensive repository information\n */\nexport async function getRepoInfo(\n projectPath: string = process.cwd(),\n): Promise<RepoInfo> {\n const isRepo = await isGitRepo(projectPath);\n\n if (!isRepo) {\n return {\n isGitRepo: false,\n remoteUrl: null,\n isGitHub: false,\n github: null,\n defaultBranch: null,\n };\n }\n\n const remoteUrl = await getGitRemoteUrl(projectPath);\n const isGitHub = isGitHubRemote(remoteUrl);\n const github = parseGitHubUrl(remoteUrl);\n const defaultBranch = await getDefaultBranch(projectPath);\n\n return {\n isGitRepo: true,\n remoteUrl,\n isGitHub,\n github,\n defaultBranch,\n };\n}\n\n/**\n * Detect the package manager used in the project\n */\nexport async function detectPackageManager(\n projectPath: string = process.cwd(),\n): Promise<PackageManager> {\n // Check for lockfiles in order of preference\n if (existsSync(join(projectPath, \"pnpm-lock.yaml\"))) {\n return \"pnpm\";\n }\n if (existsSync(join(projectPath, \"yarn.lock\"))) {\n return \"yarn\";\n }\n if (existsSync(join(projectPath, \"bun.lockb\"))) {\n return \"bun\";\n }\n if (existsSync(join(projectPath, \"package-lock.json\"))) {\n return \"npm\";\n }\n\n // Check packageManager field in package.json\n try {\n const pkgPath = join(projectPath, \"package.json\");\n if (existsSync(pkgPath)) {\n const pkg = JSON.parse(await readFile(pkgPath, \"utf-8\"));\n if (pkg.packageManager) {\n if (pkg.packageManager.startsWith(\"pnpm\")) return \"pnpm\";\n if (pkg.packageManager.startsWith(\"yarn\")) return \"yarn\";\n if (pkg.packageManager.startsWith(\"bun\")) return \"bun\";\n }\n }\n } catch {\n // Ignore parse errors\n }\n\n // Default to npm\n return \"npm\";\n}\n\n/**\n * Check if the project is a monorepo\n */\nexport async function isMonorepo(\n projectPath: string = process.cwd(),\n): Promise<boolean> {\n // Check for pnpm workspace\n if (existsSync(join(projectPath, \"pnpm-workspace.yaml\"))) {\n return true;\n }\n\n // Check for yarn/npm workspaces in package.json\n try {\n const pkgPath = join(projectPath, \"package.json\");\n if (existsSync(pkgPath)) {\n const pkg = JSON.parse(await readFile(pkgPath, \"utf-8\"));\n if (pkg.workspaces) {\n return true;\n }\n }\n } catch {\n // Ignore parse errors\n }\n\n // Check for lerna.json\n if (existsSync(join(projectPath, \"lerna.json\"))) {\n return true;\n }\n\n // Check for nx.json\n if (existsSync(join(projectPath, \"nx.json\"))) {\n return true;\n }\n\n // Check for turbo.json\n if (existsSync(join(projectPath, \"turbo.json\"))) {\n return true;\n }\n\n return false;\n}\n\n/**\n * Get available scripts from package.json\n */\nexport async function getPackageScripts(\n projectPath: string = process.cwd(),\n): Promise<Record<string, string>> {\n try {\n const pkgPath = join(projectPath, \"package.json\");\n if (!existsSync(pkgPath)) {\n return {};\n }\n const pkg = JSON.parse(await readFile(pkgPath, \"utf-8\"));\n return pkg.scripts || {};\n } catch {\n return {};\n }\n}\n\n/**\n * Get comprehensive project information\n */\nexport async function getProjectInfo(\n projectPath: string = process.cwd(),\n): Promise<ProjectInfo> {\n const packageManager = await detectPackageManager(projectPath);\n const monorepo = await isMonorepo(projectPath);\n const scripts = await getPackageScripts(projectPath);\n\n return {\n packageManager,\n isMonorepo: monorepo,\n hasLintScript: \"lint\" in scripts,\n hasTypecheckScript: \"typecheck\" in scripts || \"type-check\" in scripts,\n hasFormatScript: \"format\" in scripts || \"format:check\" in scripts,\n hasTestScript: \"test\" in scripts,\n hasBuildScript: \"build\" in scripts,\n };\n}\n\n/**\n * Get the install command for a package manager\n */\nexport function getInstallCommand(packageManager: PackageManager): string {\n switch (packageManager) {\n case \"pnpm\":\n return \"pnpm install --frozen-lockfile\";\n case \"yarn\":\n return \"yarn install --frozen-lockfile\";\n case \"bun\":\n return \"bun install --frozen-lockfile\";\n case \"npm\":\n default:\n return \"npm ci\";\n }\n}\n\n/**\n * Get the run command for a package manager (handles monorepo -r flag for pnpm)\n */\nexport function getRunCommand(\n packageManager: PackageManager,\n script: string,\n isMonorepo: boolean = false,\n): string {\n switch (packageManager) {\n case \"pnpm\":\n return isMonorepo ? `pnpm -r run ${script}` : `pnpm run ${script}`;\n case \"yarn\":\n return isMonorepo\n ? `yarn workspaces run ${script}`\n : `yarn run ${script}`;\n case \"bun\":\n return `bun run ${script}`;\n case \"npm\":\n default:\n return isMonorepo\n ? `npm run ${script} --workspaces --if-present`\n : `npm run ${script}`;\n }\n}\n","/**\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\";\nimport * as p from \"@clack/prompts\";\nimport {\n detectAllPlatforms,\n type FrameworkType,\n type PlatformDetectionResult,\n} from \"./auto-setup.js\";\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 /** Whether to include platform-specific checks (default: true) */\n includePlatformChecks?: boolean;\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// Platform-Specific Checks\n// ============================================================================\n\n/**\n * Platform types that have specific checks\n */\nexport type PlatformType =\n | \"shopify-theme\"\n | \"shopify-hydrogen\"\n | \"wordpress\"\n | \"magento\"\n | \"woocommerce\";\n\n/**\n * Platform CLI installation configuration\n */\nexport interface PlatformCLIConfig {\n /** The CLI command to check for */\n cli: string;\n /** Command to install the CLI */\n install: string;\n /** Whether this platform requires Composer (PHP package manager) */\n requiresComposer: boolean;\n /** Human-readable platform name */\n displayName: string;\n}\n\n/**\n * Platform check definition extending CheckDefinition\n */\nexport interface PlatformCheckDefinition extends CheckDefinition {\n /** The platform this check applies to */\n platform: PlatformType;\n}\n\n/**\n * CLI installation commands for each platform\n */\nexport const PLATFORM_CLI_INSTALL: Record<PlatformType, PlatformCLIConfig> = {\n \"shopify-theme\": {\n cli: \"shopify\",\n install: \"npm install -g @shopify/cli @shopify/theme\",\n requiresComposer: false,\n displayName: \"Shopify Theme\",\n },\n \"shopify-hydrogen\": {\n cli: \"shopify\",\n install: \"npm install -g @shopify/cli\",\n requiresComposer: false,\n displayName: \"Shopify Hydrogen\",\n },\n wordpress: {\n cli: \"phpcs\",\n install:\n \"composer global require squizlabs/php_codesniffer wp-coding-standards/wpcs && phpcs --config-set installed_paths $(composer global config home)/vendor/wp-coding-standards/wpcs\",\n requiresComposer: true,\n displayName: \"WordPress\",\n },\n magento: {\n cli: \"phpcs\",\n install:\n \"composer global require squizlabs/php_codesniffer magento/magento-coding-standard && phpcs --config-set installed_paths $(composer global config home)/vendor/magento/magento-coding-standard\",\n requiresComposer: true,\n displayName: \"Magento\",\n },\n woocommerce: {\n cli: \"phpcs\",\n install:\n \"composer global require squizlabs/php_codesniffer automattic/woocommerce-sniffs && phpcs --config-set installed_paths $(composer global config home)/vendor/automattic/woocommerce-sniffs\",\n requiresComposer: true,\n displayName: \"WooCommerce\",\n },\n};\n\n/**\n * Platform-specific quality checks\n */\nexport const PLATFORM_CHECKS: PlatformCheckDefinition[] = [\n {\n platform: \"shopify-theme\",\n name: \"shopify-theme-check\",\n displayName: \"Shopify Theme Check\",\n command: \"shopify\",\n args: [\"theme\", \"check\"],\n canAutoFix: false,\n },\n {\n platform: \"shopify-hydrogen\",\n name: \"shopify-hydrogen-check\",\n displayName: \"Shopify Hydrogen Check\",\n command: \"shopify\",\n args: [\"hydrogen\", \"check\"],\n canAutoFix: false,\n },\n {\n platform: \"wordpress\",\n name: \"wordpress-phpcs\",\n displayName: \"WordPress Coding Standards\",\n command: \"phpcs\",\n args: [\"--standard=WordPress\", \".\"],\n fixCommand: \"phpcbf\",\n fixArgs: [\"--standard=WordPress\", \".\"],\n canAutoFix: true,\n },\n {\n platform: \"magento\",\n name: \"magento-phpcs\",\n displayName: \"Magento Coding Standards\",\n command: \"phpcs\",\n args: [\"--standard=Magento2\", \".\"],\n fixCommand: \"phpcbf\",\n fixArgs: [\"--standard=Magento2\", \".\"],\n canAutoFix: true,\n },\n {\n platform: \"woocommerce\",\n name: \"woocommerce-phpcs\",\n displayName: \"WooCommerce Coding Standards\",\n command: \"phpcs\",\n args: [\"--standard=WooCommerce-Core\", \".\"],\n fixCommand: \"phpcbf\",\n fixArgs: [\"--standard=WooCommerce-Core\", \".\"],\n canAutoFix: true,\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(\n cwd: string,\n): 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// Platform Check Utilities\n// ============================================================================\n\n/**\n * Check if Composer is installed (required for PHP-based platforms)\n * If not installed, shows OS-specific installation instructions and exits\n */\nexport async function ensureComposer(): Promise<void> {\n const hasComposer = await commandExists(\"composer\");\n\n if (!hasComposer) {\n console.log(chalk.red(\"\\n❌ Composer is required but not installed.\\n\"));\n console.log(chalk.yellow(\"Please install Composer for your platform:\\n\"));\n\n // Detect OS and show relevant instructions\n const platform = process.platform;\n\n if (platform === \"darwin\") {\n console.log(chalk.cyan(\" macOS (Homebrew):\"));\n console.log(chalk.dim(\" brew install composer\\n\"));\n } else if (platform === \"linux\") {\n console.log(chalk.cyan(\" Ubuntu/Debian:\"));\n console.log(chalk.dim(\" sudo apt install composer\\n\"));\n console.log(chalk.cyan(\" Fedora/CentOS:\"));\n console.log(chalk.dim(\" sudo dnf install composer\\n\"));\n console.log(chalk.cyan(\" Arch Linux:\"));\n console.log(chalk.dim(\" sudo pacman -S composer\\n\"));\n } else if (platform === \"win32\") {\n console.log(chalk.cyan(\" Windows (Scoop):\"));\n console.log(chalk.dim(\" scoop install composer\\n\"));\n console.log(chalk.cyan(\" Windows (Chocolatey):\"));\n console.log(chalk.dim(\" choco install composer\\n\"));\n }\n\n console.log(chalk.cyan(\" Or download from:\"));\n console.log(chalk.dim(\" https://getcomposer.org/download/\\n\"));\n\n process.exit(1);\n }\n}\n\n/**\n * Prompt user to choose a platform when multiple are detected\n */\nexport async function promptPlatformChoice(\n detected: FrameworkType[],\n): Promise<FrameworkType> {\n // Filter to only platform types we have checks for\n const platformTypes = detected.filter((d): d is PlatformType =>\n Object.keys(PLATFORM_CLI_INSTALL).includes(d),\n );\n\n if (platformTypes.length === 0) {\n return detected[0] || \"unknown\";\n }\n\n if (platformTypes.length === 1) {\n return platformTypes[0];\n }\n\n // Multiple platforms detected - ask user\n console.log(\n chalk.yellow(\"\\n🔍 Multiple platforms detected in this project:\\n\"),\n );\n\n const options = platformTypes.map((pt) => ({\n value: pt,\n label: PLATFORM_CLI_INSTALL[pt].displayName,\n }));\n\n const choice = await p.select({\n message: \"Which platform would you like to run checks for?\",\n options,\n });\n\n if (p.isCancel(choice)) {\n console.log(chalk.yellow(\"\\n⚠️ Platform check cancelled.\"));\n process.exit(0);\n }\n\n return choice as FrameworkType;\n}\n\n/**\n * Ensure the platform CLI is installed\n * If not, automatically installs it after showing the command\n */\nexport async function ensurePlatformCLI(platform: PlatformType): Promise<void> {\n const config = PLATFORM_CLI_INSTALL[platform];\n\n // Check Composer requirement first\n if (config.requiresComposer) {\n await ensureComposer();\n }\n\n // Check if CLI exists\n const hasCLI = await commandExists(config.cli);\n\n if (!hasCLI) {\n console.log(\n chalk.yellow(\n `\\n📦 ${config.displayName} CLI (${config.cli}) not found. Installing...\\n`,\n ),\n );\n console.log(chalk.dim(` Running: ${config.install}\\n`));\n\n try {\n // Run the install command\n await execa(\"sh\", [\"-c\", config.install], {\n stdio: \"inherit\",\n });\n\n // Verify installation\n const nowHasCLI = await commandExists(config.cli);\n if (!nowHasCLI) {\n console.log(\n chalk.red(\n `\\n❌ Failed to install ${config.cli}. Please install manually:\\n`,\n ),\n );\n console.log(chalk.dim(` ${config.install}\\n`));\n process.exit(1);\n }\n\n console.log(\n chalk.green(`\\n✅ ${config.displayName} CLI installed successfully.\\n`),\n );\n } catch (error) {\n console.log(chalk.red(`\\n❌ Failed to install ${config.cli}:\\n`));\n console.log(chalk.dim(` ${(error as Error).message}\\n`));\n console.log(chalk.yellow(\"Please install manually:\\n\"));\n console.log(chalk.dim(` ${config.install}\\n`));\n process.exit(1);\n }\n }\n}\n\n/**\n * Get platform-specific checks for the detected platform(s)\n * Handles multi-platform detection, user prompts, and CLI installation\n */\nexport async function getPlatformChecks(\n cwd: string,\n): Promise<PlatformCheckDefinition[]> {\n // Detect all platforms\n const detection: PlatformDetectionResult = await detectAllPlatforms(cwd);\n\n // Filter to platforms we have checks for\n const platformsWithChecks = detection.detected.filter(\n (d): d is PlatformType => Object.keys(PLATFORM_CLI_INSTALL).includes(d),\n );\n\n if (platformsWithChecks.length === 0) {\n return [];\n }\n\n // If multiple platforms, prompt user to choose\n let selectedPlatform: PlatformType;\n if (platformsWithChecks.length === 1) {\n selectedPlatform = platformsWithChecks[0];\n } else {\n const choice = await promptPlatformChoice(detection.detected);\n if (!Object.keys(PLATFORM_CLI_INSTALL).includes(choice)) {\n return [];\n }\n selectedPlatform = choice as PlatformType;\n }\n\n // Ensure CLI is installed\n await ensurePlatformCLI(selectedPlatform);\n\n // Return checks for the selected platform\n return PLATFORM_CHECKS.filter((check) => check.platform === selectedPlatform);\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 platform-specific checks after standard checks pass\n * Returns results for each platform check run\n */\nasync function runPlatformChecks(\n cwd: string,\n log: (message: string, type: ProgressType) => void,\n autoFix: boolean,\n dryRun: boolean,\n): Promise<CheckResult[]> {\n const results: CheckResult[] = [];\n\n try {\n const platformChecks = await getPlatformChecks(cwd);\n\n if (platformChecks.length === 0) {\n return results;\n }\n\n log(`\\n${\"━\".repeat(50)}`, \"info\");\n log(`🔧 Platform-Specific Checks`, \"info\");\n log(`${\"━\".repeat(50)}\\n`, \"info\");\n\n for (let i = 0; i < platformChecks.length; i++) {\n const check = platformChecks[i];\n const stepNum = i + 1;\n const totalSteps = platformChecks.length;\n\n log(\n `📋 Platform ${stepNum}/${totalSteps}: ${check.displayName}...`,\n \"info\",\n );\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 log(`❌ ${check.displayName} failed`, \"error\");\n\n // Try to auto-fix if possible\n if (autoFix && check.canAutoFix && check.fixCommand) {\n if (dryRun) {\n log(\n `🔧 [DRY-RUN] Would run: ${formatFixCommand(check)}`,\n \"warning\",\n );\n continue;\n }\n\n log(`🔧 Attempting auto-fix for ${check.displayName}...`, \"warning\");\n const fixResult = await applyFix(check, cwd);\n\n if (fixResult.success) {\n log(`✨ Auto-fix applied for ${check.displayName}`, \"success\");\n // Re-run the check after fix\n const reResult = await runCheck(check, cwd);\n results[results.length - 1] = reResult;\n\n if (reResult.success) {\n log(`✅ ${check.displayName} now passes`, \"success\");\n } else {\n log(`⚠️ ${check.displayName} still failing after fix`, \"error\");\n }\n } else {\n log(`⚠️ Auto-fix failed for ${check.displayName}`, \"error\");\n }\n } else if (!check.canAutoFix) {\n log(`⚠️ ${check.displayName} requires manual fix`, \"error\");\n }\n\n // Show error preview\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 }\n } catch (error) {\n // Platform check errors should not crash the entire verification\n log(`\\n⚠️ Platform check error: ${(error as Error).message}`, \"warning\");\n }\n\n return results;\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 includePlatformChecks = true,\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 `\\n⏭️ Skipping checks (scripts not found): ${skippedChecks.map((c) => c.displayName).join(\", \")}`,\n \"warning\",\n );\n }\n\n if (applicableChecks.length === 0) {\n log(\n `\\n⚠️ No applicable checks found. Add scripts to package.json: typecheck, lint, format, test, build`,\n \"warning\",\n );\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 // Run platform-specific checks if enabled\n if (includePlatformChecks) {\n const platformCheckResults = await runPlatformChecks(\n cwd,\n log,\n autoFix,\n dryRun,\n );\n\n if (platformCheckResults.length > 0) {\n const platformFailed = platformCheckResults.some((r) => !r.success);\n\n if (platformFailed) {\n return {\n success: false,\n results: [...results, ...platformCheckResults],\n totalAttempts: attempt,\n fixesApplied,\n appliedFixes,\n };\n }\n\n // Add platform results to overall results\n results.push(...platformCheckResults);\n }\n }\n\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":";AAaA,SAAS,cAAAA,mBAAkB;AAC3B,SAAS,YAAAC,WAAU,WAAW,aAAa;AAC3C,SAAS,QAAAC,aAAY;AACrB,SAAS,SAAAC,cAAa;;;ACXtB,SAAS,aAAa;AACtB,SAAS,kBAAkB;AAC3B,SAAS,gBAAgB;AACzB,SAAS,YAAY;AAyJrB,eAAsB,qBACpB,cAAsB,QAAQ,IAAI,GACT;AAEzB,MAAI,WAAW,KAAK,aAAa,gBAAgB,CAAC,GAAG;AACnD,WAAO;AAAA,EACT;AACA,MAAI,WAAW,KAAK,aAAa,WAAW,CAAC,GAAG;AAC9C,WAAO;AAAA,EACT;AACA,MAAI,WAAW,KAAK,aAAa,WAAW,CAAC,GAAG;AAC9C,WAAO;AAAA,EACT;AACA,MAAI,WAAW,KAAK,aAAa,mBAAmB,CAAC,GAAG;AACtD,WAAO;AAAA,EACT;AAGA,MAAI;AACF,UAAM,UAAU,KAAK,aAAa,cAAc;AAChD,QAAI,WAAW,OAAO,GAAG;AACvB,YAAM,MAAM,KAAK,MAAM,MAAM,SAAS,SAAS,OAAO,CAAC;AACvD,UAAI,IAAI,gBAAgB;AACtB,YAAI,IAAI,eAAe,WAAW,MAAM,EAAG,QAAO;AAClD,YAAI,IAAI,eAAe,WAAW,MAAM,EAAG,QAAO;AAClD,YAAI,IAAI,eAAe,WAAW,KAAK,EAAG,QAAO;AAAA,MACnD;AAAA,IACF;AAAA,EACF,QAAQ;AAAA,EAER;AAGA,SAAO;AACT;AAKA,eAAsB,WACpB,cAAsB,QAAQ,IAAI,GAChB;AAElB,MAAI,WAAW,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AAoB;AAAA,QACtC;AAAA,MACF;AAEA,aAAO;AAAA,QACL,SAAS;AAAA,QACT;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,MAAMA,OAAM,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,UAAMA,OAAM,OAAO,CAAC,OAAO,IAAI,GAAG,EAAE,IAAI,CAAC;AACzC,WAAO;AAAA,EACT,QAAQ;AACN,WAAO;AAAA,EACT;AACF;","names":["existsSync","readFile","join","execa","existsSync","join","readFile","isMonorepo","execa","execa","existsSync","join","join","existsSync","execa"]}
@@ -1,8 +0,0 @@
1
- import {
2
- verifyCommand
3
- } from "./chunk-PLVOGB6Y.js";
4
- import "./chunk-KJFRMHQU.js";
5
- export {
6
- verifyCommand
7
- };
8
- //# sourceMappingURL=verify-OIHY7SGG.js.map