uilint 0.2.140 → 0.2.142

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.
Files changed (37) hide show
  1. package/dist/{chunk-RYRHWTLC.js → chunk-7GQXW4CT.js} +14 -10
  2. package/dist/chunk-7GQXW4CT.js.map +1 -0
  3. package/dist/{chunk-VSBVUS56.js → chunk-JWSZKDZY.js} +77 -77
  4. package/dist/chunk-JWSZKDZY.js.map +1 -0
  5. package/dist/{chunk-JIFAHBJ2.js → chunk-OW7Y4RTR.js} +4 -4
  6. package/dist/chunk-OW7Y4RTR.js.map +1 -0
  7. package/dist/{chunk-TKJ27W62.js → chunk-VKI3SQMQ.js} +2 -2
  8. package/dist/{chunk-TKJ27W62.js.map → chunk-VKI3SQMQ.js.map} +1 -1
  9. package/dist/chunk-WG2WZTB2.js +56 -0
  10. package/dist/chunk-WG2WZTB2.js.map +1 -0
  11. package/dist/{chunk-BFHNMKBU.js → chunk-ZUOFUPGT.js} +27 -27
  12. package/dist/chunk-ZUOFUPGT.js.map +1 -0
  13. package/dist/index.js +163 -58
  14. package/dist/index.js.map +1 -1
  15. package/dist/{init-ui-YAXRGBIJ.js → init-ui-KJYYI5DH.js} +42 -17
  16. package/dist/init-ui-KJYYI5DH.js.map +1 -0
  17. package/dist/{plan-2ISQNZBR.js → plan-ZJSVJL5X.js} +4 -4
  18. package/dist/plugin-loader-O6PNFN6D.js +11 -0
  19. package/dist/plugin-loader-O6PNFN6D.js.map +1 -0
  20. package/dist/{remove-ui-RHRSEUWJ.js → remove-ui-ZHW4GUFL.js} +7 -7
  21. package/dist/remove-ui-ZHW4GUFL.js.map +1 -0
  22. package/dist/{render-3GGNWYTF.js → render-43OMCORR.js} +1 -1
  23. package/dist/render-43OMCORR.js.map +1 -0
  24. package/dist/{upgrade-2EVTOYTJ.js → upgrade-TPZ62BT2.js} +8 -6
  25. package/dist/upgrade-TPZ62BT2.js.map +1 -0
  26. package/package.json +12 -7
  27. package/dist/chunk-BFHNMKBU.js.map +0 -1
  28. package/dist/chunk-JIFAHBJ2.js.map +0 -1
  29. package/dist/chunk-RUMBVNPY.js +0 -29
  30. package/dist/chunk-RUMBVNPY.js.map +0 -1
  31. package/dist/chunk-RYRHWTLC.js.map +0 -1
  32. package/dist/chunk-VSBVUS56.js.map +0 -1
  33. package/dist/init-ui-YAXRGBIJ.js.map +0 -1
  34. package/dist/remove-ui-RHRSEUWJ.js.map +0 -1
  35. package/dist/render-3GGNWYTF.js.map +0 -1
  36. package/dist/upgrade-2EVTOYTJ.js.map +0 -1
  37. /package/dist/{plan-2ISQNZBR.js.map → plan-ZJSVJL5X.js.map} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/commands/init/plan.ts"],"sourcesContent":["/**\n * Plan phase - pure function generating InstallPlan from state + choices\n *\n * This function has NO I/O whatsoever. It takes the analyzed ProjectState,\n * user choices, and options, then returns an InstallPlan describing exactly\n * what actions to take.\n */\n\nimport { join } from \"path\";\nimport type { RuleMetadata } from \"uilint-eslint\";\nimport type {\n ProjectState,\n UserChoices,\n InstallPlan,\n InstallAction,\n DependencyInstall,\n PlanOptions,\n} from \"./types.js\";\nimport { GENSTYLEGUIDE_COMMAND_MD } from \"./constants.js\";\nimport { toInstallSpecifier } from \"./versioning.js\";\nimport { loadSkill } from \"../../utils/skill-loader.js\";\nimport { loadSelectedRules } from \"../../utils/rule-loader.js\";\nimport { detectPackageManager } from \"../../utils/package-manager.js\";\n\n/**\n * Create the install plan from project state and user choices\n *\n * @param state - The analyzed project state\n * @param choices - User's installation choices\n * @param options - Planning options (force, etc.)\n * @returns InstallPlan with all actions and dependencies\n */\nexport function createPlan(\n state: ProjectState,\n choices: UserChoices,\n options: PlanOptions = {}\n): InstallPlan {\n const actions: InstallAction[] = [];\n const dependencies: DependencyInstall[] = [];\n\n const { force: _force = false } = options;\n const { items } = choices;\n\n // Ensure .cursor directory exists if needed\n const needsCursorDir =\n items.includes(\"genstyleguide\") || items.includes(\"skill\");\n\n if (needsCursorDir && !state.cursorDir.exists) {\n actions.push({\n type: \"create_directory\",\n path: state.cursorDir.path,\n });\n }\n\n // =========================================================================\n // Genstyleguide Command\n // =========================================================================\n if (items.includes(\"genstyleguide\")) {\n const commandsDir = join(state.cursorDir.path, \"commands\");\n\n actions.push({\n type: \"create_directory\",\n path: commandsDir,\n });\n\n actions.push({\n type: \"create_file\",\n path: join(commandsDir, \"genstyleguide.md\"),\n content: GENSTYLEGUIDE_COMMAND_MD,\n });\n }\n\n // =========================================================================\n // Agent Skill Installation\n // =========================================================================\n if (items.includes(\"skill\")) {\n const skillsDir = join(state.cursorDir.path, \"skills\");\n\n // Create skills directory\n actions.push({\n type: \"create_directory\",\n path: skillsDir,\n });\n\n // Load and install the ui-consistency-enforcer skill\n try {\n const skill = loadSkill(\"ui-consistency-enforcer\");\n const skillDir = join(skillsDir, skill.name);\n\n // Create skill directory\n actions.push({\n type: \"create_directory\",\n path: skillDir,\n });\n\n // Create all skill files\n for (const file of skill.files) {\n const filePath = join(skillDir, file.relativePath);\n\n // Ensure subdirectories exist (e.g., references/)\n const fileDir = join(\n skillDir,\n file.relativePath.split(\"/\").slice(0, -1).join(\"/\")\n );\n if (fileDir !== skillDir && file.relativePath.includes(\"/\")) {\n actions.push({\n type: \"create_directory\",\n path: fileDir,\n });\n }\n\n actions.push({\n type: \"create_file\",\n path: filePath,\n content: file.content,\n });\n }\n } catch {\n // Skill not found - skip silently (shouldn't happen in normal install)\n }\n }\n\n // =========================================================================\n // Next.js Overlay Installation\n // =========================================================================\n if (items.includes(\"next\") && choices.next) {\n const { projectPath, detection, targetFile, createProviders } =\n choices.next;\n\n // Install Next.js routes\n actions.push({\n type: \"install_next_routes\",\n projectPath,\n appRoot: detection.appRoot,\n });\n\n // Install React overlay dependencies using the package manager for this specific target\n dependencies.push({\n packagePath: projectPath,\n packageManager: detectPackageManager(projectPath),\n packages: [\n toInstallSpecifier(\"uilint-react\", {\n preferWorkspaceProtocol: state.packageManager === \"pnpm\",\n workspaceRoot: state.workspaceRoot,\n targetProjectPath: projectPath,\n }),\n toInstallSpecifier(\"uilint-core\", {\n preferWorkspaceProtocol: state.packageManager === \"pnpm\",\n workspaceRoot: state.workspaceRoot,\n targetProjectPath: projectPath,\n }),\n \"jsx-loc-plugin\",\n ],\n });\n\n // Inject <uilint-devtools /> web component into React\n // Use targetFile or createProviders if specified by the user\n actions.push({\n type: \"inject_react\",\n projectPath,\n appRoot: detection.appRoot,\n targetFile,\n createProviders,\n });\n\n // Inject jsx-loc-plugin into next.config\n actions.push({\n type: \"inject_next_config\",\n projectPath,\n });\n\n // Add uilint-react/devtools to tsconfig.json types for TypeScript support\n actions.push({\n type: \"inject_tsconfig\",\n projectPath,\n addDevtoolsTypes: true,\n });\n }\n\n // =========================================================================\n // Vite Overlay Installation\n // =========================================================================\n if (items.includes(\"vite\") && choices.vite) {\n const { projectPath, detection } = choices.vite;\n\n // Install React overlay dependencies using the package manager for this specific target\n dependencies.push({\n packagePath: projectPath,\n packageManager: detectPackageManager(projectPath),\n packages: [\n toInstallSpecifier(\"uilint-react\", {\n preferWorkspaceProtocol: state.packageManager === \"pnpm\",\n workspaceRoot: state.workspaceRoot,\n targetProjectPath: projectPath,\n }),\n toInstallSpecifier(\"uilint-core\", {\n preferWorkspaceProtocol: state.packageManager === \"pnpm\",\n workspaceRoot: state.workspaceRoot,\n targetProjectPath: projectPath,\n }),\n \"jsx-loc-plugin\",\n ],\n });\n\n // Inject <uilint-devtools /> web component into React entry\n actions.push({\n type: \"inject_react\",\n projectPath,\n appRoot: detection.entryRoot,\n mode: \"vite\",\n });\n\n // Inject jsx-loc-plugin into vite.config\n actions.push({\n type: \"inject_vite_config\",\n projectPath,\n });\n\n // Add uilint-react/devtools to tsconfig.json types for TypeScript support\n actions.push({\n type: \"inject_tsconfig\",\n projectPath,\n addDevtoolsTypes: true,\n });\n }\n\n // =========================================================================\n // ESLint Plugin Installation\n // =========================================================================\n if (items.includes(\"eslint\") && choices.eslint) {\n const { packagePaths, selectedRules } = choices.eslint;\n\n for (const pkgPath of packagePaths) {\n const pkgInfo = state.packages.find((p) => p.path === pkgPath);\n\n // Create .uilint/rules directory alongside the target app (not at workspace root)\n const rulesDir = join(pkgPath, \".uilint\", \"rules\");\n actions.push({\n type: \"create_directory\",\n path: rulesDir,\n });\n\n // Load and copy rule files into this target package\n // Use TypeScript rule files if the ESLint config is TypeScript (.ts)\n // This ensures the imports match the actual rule files being copied\n // Skip externally-registered plugin rules (e.g. vision, semantic) — their\n // implementations live in their own npm packages, not in uilint-eslint.\n // Rules with `eslintImport` are imported from their package by the config injector.\n const localRules = selectedRules.filter((r) => !r.eslintImport);\n const isTypeScriptConfig =\n pkgInfo?.eslintConfigPath?.endsWith(\".ts\") ?? false;\n const ruleFiles = loadSelectedRules(\n localRules.map((r) => r.id),\n {\n typescript: isTypeScriptConfig,\n }\n );\n for (const ruleFile of ruleFiles) {\n // For directory-based rules, create the directory structure first\n if (ruleFile.additionalFiles && ruleFile.additionalFiles.length > 0) {\n // Create rule directory (e.g., .uilint/rules/no-mixed-component-libraries/)\n const ruleDir = join(rulesDir, ruleFile.ruleId);\n actions.push({\n type: \"create_directory\",\n path: ruleDir,\n });\n\n // Create lib/ subdirectory if any files are in lib/\n const hasLibFiles = ruleFile.additionalFiles.some((f) =>\n f.relativePath.includes(\"/lib/\")\n );\n if (hasLibFiles) {\n actions.push({\n type: \"create_directory\",\n path: join(ruleDir, \"lib\"),\n });\n }\n }\n\n // Copy implementation file\n actions.push({\n type: \"create_file\",\n path: join(rulesDir, ruleFile.implementation.relativePath),\n content: ruleFile.implementation.content,\n });\n\n // Copy additional files for directory-based rules\n if (ruleFile.additionalFiles) {\n for (const additionalFile of ruleFile.additionalFiles) {\n actions.push({\n type: \"create_file\",\n path: join(rulesDir, additionalFile.relativePath),\n content: additionalFile.content,\n });\n }\n }\n\n // Copy test file if it exists (only for TypeScript configs)\n if (ruleFile.test && isTypeScriptConfig) {\n actions.push({\n type: \"create_file\",\n path: join(rulesDir, ruleFile.test.relativePath),\n content: ruleFile.test.content,\n });\n }\n }\n\n // Install dependencies using the package manager for this specific target\n const packagesToInstall = [\n toInstallSpecifier(\"uilint-eslint\", {\n preferWorkspaceProtocol: state.packageManager === \"pnpm\",\n workspaceRoot: state.workspaceRoot,\n targetProjectPath: pkgPath,\n }),\n \"typescript-eslint\",\n ];\n\n // If require-test-coverage rule is selected, add coverage package and config\n const hasCoverageRule = selectedRules.some(\n (r) => r.id === \"require-test-coverage\"\n );\n if (hasCoverageRule) {\n packagesToInstall.push(\"@vitest/coverage-v8\");\n\n // Add action to inject coverage config into vitest.config.ts\n actions.push({\n type: \"inject_vitest_coverage\",\n projectPath: pkgPath,\n });\n }\n\n // Collect npm dependencies declared by selected rules\n for (const rule of selectedRules) {\n if (rule.npmDependencies) {\n for (const dep of rule.npmDependencies) {\n if (!packagesToInstall.includes(dep)) {\n packagesToInstall.push(dep);\n }\n }\n }\n }\n\n // Install plugin packages for external rules (e.g. uilint-vision, uilint-semantic)\n const externalPkgs = new Set<string>();\n for (const rule of selectedRules) {\n if (rule.eslintImport) {\n // Extract package name from import specifier (e.g. \"uilint-vision/eslint-rules/...\")\n const pkgName = rule.eslintImport.split(\"/\").slice(0, 1).join(\"/\");\n externalPkgs.add(pkgName);\n }\n }\n for (const pkg of externalPkgs) {\n const specifier = toInstallSpecifier(pkg, {\n preferWorkspaceProtocol: state.packageManager === \"pnpm\",\n workspaceRoot: state.workspaceRoot,\n targetProjectPath: pkgPath,\n });\n if (!packagesToInstall.includes(specifier)) {\n packagesToInstall.push(specifier);\n }\n }\n\n dependencies.push({\n packagePath: pkgPath,\n packageManager: detectPackageManager(pkgPath),\n packages: packagesToInstall,\n });\n\n // Inject ESLint rules (will reference local .uilint/rules/ files)\n if (pkgInfo?.eslintConfigPath) {\n actions.push({\n type: \"inject_eslint\",\n packagePath: pkgPath,\n configPath: pkgInfo.eslintConfigPath,\n rules: selectedRules,\n hasExistingRules: pkgInfo.hasUilintRules,\n });\n }\n\n // Add .uilint to tsconfig.json exclude to prevent build errors\n // The rule files are loaded by ESLint at runtime, not compiled with the app\n actions.push({\n type: \"inject_tsconfig\",\n projectPath: pkgPath,\n });\n\n // Update manifest with installed rule versions\n const ruleVersions: Record<string, string> = {};\n for (const rule of selectedRules) {\n // Use version from RuleMeta, default to \"1.0.0\" if not specified\n ruleVersions[rule.id] = rule.version ?? \"1.0.0\";\n }\n actions.push({\n type: \"update_manifest\",\n projectPath: pkgPath,\n rules: ruleVersions,\n });\n }\n\n // Add .uilint/.cache to .gitignore at workspace root\n const gitignorePath = join(state.workspaceRoot, \".gitignore\");\n actions.push({\n type: \"append_to_file\",\n path: gitignorePath,\n content: \"\\n# UILint cache\\n.uilint/.cache\\n\",\n ifNotContains: \".uilint/.cache\",\n });\n }\n\n return { actions, dependencies };\n}\n\n/**\n * Get the list of rules that are missing from a package's ESLint config\n */\nexport function getMissingRules(\n configuredRuleIds: string[],\n selectedRules: RuleMetadata[]\n): RuleMetadata[] {\n const configuredSet = new Set(configuredRuleIds);\n return selectedRules.filter((rule) => !configuredSet.has(rule.id));\n}\n"],"mappings":";;;;;;;;;;;;;;AAQA,SAAS,YAAY;AAwBd,SAAS,WACd,OACA,SACA,UAAuB,CAAC,GACX;AACb,QAAM,UAA2B,CAAC;AAClC,QAAM,eAAoC,CAAC;AAE3C,QAAM,EAAE,OAAO,SAAS,MAAM,IAAI;AAClC,QAAM,EAAE,MAAM,IAAI;AAGlB,QAAM,iBACJ,MAAM,SAAS,eAAe,KAAK,MAAM,SAAS,OAAO;AAE3D,MAAI,kBAAkB,CAAC,MAAM,UAAU,QAAQ;AAC7C,YAAQ,KAAK;AAAA,MACX,MAAM;AAAA,MACN,MAAM,MAAM,UAAU;AAAA,IACxB,CAAC;AAAA,EACH;AAKA,MAAI,MAAM,SAAS,eAAe,GAAG;AACnC,UAAM,cAAc,KAAK,MAAM,UAAU,MAAM,UAAU;AAEzD,YAAQ,KAAK;AAAA,MACX,MA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mB;AAAA,QACrB,CAAC;AACD,YAAI,CAAC,kBAAkB,SAAS,SAAS,GAAG;AAC1C,4BAAkB,KAAK,SAAS;AAAA,QAClC;AAAA,MACF;AAEA,mBAAa,KAAK;AAAA,QAChB,aAAa;AAAA,QACb,gBAAgB,qBAAqB,OAAO;AAAA,QAC5C,UAAU;AAAA,MACZ,CAAC;AAGD,UAAI,SAAS,kBAAkB;AAC7B,gBAAQ,KAAK;AAAA,UACX,MAAM;AAAA,UACN,aAAa;AAAA,UACb,YAAY,QAAQ;AAAA,UACpB,OAAO;AAAA,UACP,kBAAkB,QAAQ;AAAA,QAC5B,CAAC;AAAA,MACH;AAIA,cAAQ,KAAK;AAAA,QACX,MAAM;AAAA,QACN,aAAa;AAAA,MACf,CAAC;AAGD,YAAM,eAAuC,CAAC;AAC9C,iBAAW,QAAQ,eAAe;AAEhC,qBAAa,KAAK,EAAE,IAAI,KAAK,WAAW;AAAA,MAC1C;AACA,cAAQ,KAAK;AAAA,QACX,MAAM;AAAA,QACN,aAAa;AAAA,QACb,OAAO;AAAA,MACT,CAAC;AAAA,IACH;AAGA,UAAM,gBAAgB,KAAK,MAAM,eAAe,YAAY;AAC5D,YAAQ,KAAK;AAAA,MACX,MAAM;AAAA,MACN,MAAM;AAAA,MACN,SAAS;AAAA,MACT,eAAe;AAAA,IACjB,CAAC;AAAA,EACH;AAEA,SAAO,EAAE,SAAS,aAAa;AACjC;AAKO,SAAS,gBACd,mBACA,eACgB;AAChB,QAAM,gBAAgB,IAAI,IAAI,iBAAiB;AAC/C,SAAO,cAAc,OAAO,CAAC,SAAS,CAAC,cAAc,IAAI,KAAK,EAAE,CAAC;AACnE;","names":[]}
@@ -191,7 +191,7 @@ function loadDirectoryRule(rulesDir, ruleId) {
191
191
  }
192
192
  function loadRule(ruleId, options = { typescript: true }) {
193
193
  const { typescript } = options;
194
- const extension = typescript ? ".ts" : ".js";
194
+ const _extension = typescript ? ".ts" : ".js";
195
195
  if (typescript) {
196
196
  const rulesDir = join(getUilintEslintSrcDir(), "rules");
197
197
  if (isDirectoryBasedRule(rulesDir, ruleId)) {
@@ -256,4 +256,4 @@ function loadSelectedRules(ruleIds, options = { typescript: true }) {
256
256
  export {
257
257
  loadSelectedRules
258
258
  };
259
- //# sourceMappingURL=chunk-TKJ27W62.js.map
259
+ //# sourceMappingURL=chunk-VKI3SQMQ.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/utils/rule-loader.ts"],"sourcesContent":["/**\n * Rule Loader Utility\n *\n * Loads ESLint rule source files from the uilint-eslint package for installation\n * into user projects. Rules are copied to .uilint/rules/ in the target project.\n */\n\nimport { readFileSync, existsSync, readdirSync } from \"fs\";\nimport { join, dirname } from \"path\";\nimport { fileURLToPath } from \"url\";\nimport { createRequire } from \"module\";\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = dirname(__filename);\nconst require = createRequire(import.meta.url);\n\nfunction findNodeModulesPackageRoot(\n pkgName: string,\n startDir: string\n): string | null {\n let dir = startDir;\n while (true) {\n const candidate = join(dir, \"node_modules\", pkgName);\n if (existsSync(join(candidate, \"package.json\"))) return candidate;\n const parent = dirname(dir);\n if (parent === dir) break;\n dir = parent;\n }\n return null;\n}\n\nfunction getUilintEslintPackageRoot(): string {\n // Prefer a filesystem-based lookup first. This avoids Node resolution edge\n // cases with package.json \"exports\" (especially ESM-only packages), and works\n // well for monorepos + pnpm where node_modules contains symlinks.\n //\n // Search upwards from process.cwd() (the user's project) and from this file\n // location (for test/dev environments).\n const fromCwd = findNodeModulesPackageRoot(\"uilint-eslint\", process.cwd());\n if (fromCwd) return fromCwd;\n\n const fromHere = findNodeModulesPackageRoot(\"uilint-eslint\", __dirname);\n if (fromHere) return fromHere;\n\n // Last resort: try resolver-based lookup.\n try {\n const entry = require.resolve(\"uilint-eslint\"); // typically .../dist/index.js\n const entryDir = dirname(entry); // typically .../dist\n return dirname(entryDir); // package root\n } catch (e) {\n const msg = e instanceof Error ? e.message : String(e);\n throw new Error(\n `Unable to locate uilint-eslint in node_modules (searched upwards from cwd and uilint's install path).\\n` +\n `Resolver error: ${msg}\\n` +\n `Fix: ensure uilint-eslint is installed in the target project (or workspace) and try again.`\n );\n }\n}\n\n/**\n * Represents a file for a rule (implementation or test)\n */\nexport interface RuleFile {\n /** Relative path within the rules directory (e.g., \"consistent-dark-mode.ts\") */\n relativePath: string;\n /** File content */\n content: string;\n}\n\n/**\n * Represents a complete rule ready for installation\n */\nexport interface RuleFiles {\n /** Rule identifier (e.g., \"consistent-dark-mode\") */\n ruleId: string;\n /** Implementation file (main entry point - index.ts for directory rules, or single file) */\n implementation: RuleFile;\n /** Additional files for directory-based rules (lib/ utilities, etc.) */\n additionalFiles?: RuleFile[];\n /** Test file (if exists) */\n test?: RuleFile;\n}\n\n/**\n * Get the path to the uilint-eslint package source directory\n */\nfunction getUilintEslintSrcDir(): string {\n // In development: packages/uilint-eslint/src/\n // In production (installed): node_modules/uilint-eslint/src/\n\n // Try workspace/dev path first (repo layout)\n const devPath = join(\n __dirname,\n \"..\",\n \"..\",\n \"..\",\n \"..\",\n \"uilint-eslint\",\n \"src\"\n );\n if (existsSync(devPath)) return devPath;\n\n // Try from installed package root (works with \"exports\")\n const pkgRoot = getUilintEslintPackageRoot();\n const srcPath = join(pkgRoot, \"src\");\n if (existsSync(srcPath)) return srcPath;\n\n throw new Error(\n 'Could not find uilint-eslint \"src/\" directory. If you are using a published install of uilint-eslint, ensure it includes source files, or run a JS-only rules install.'\n );\n}\n\n/**\n * Get the path to the uilint-eslint package dist directory\n */\nfunction getUilintEslintDistDir(): string {\n // In development: packages/uilint-eslint/dist/\n // In production (installed): node_modules/uilint-eslint/dist/\n\n // Try workspace/dev path first (repo layout)\n const devPath = join(\n __dirname,\n \"..\",\n \"..\",\n \"..\",\n \"..\",\n \"uilint-eslint\",\n \"dist\"\n );\n if (existsSync(devPath)) return devPath;\n\n // Try from installed package root (works with \"exports\")\n const pkgRoot = getUilintEslintPackageRoot();\n const distPath = join(pkgRoot, \"dist\");\n if (existsSync(distPath)) return distPath;\n\n throw new Error(\n 'Could not find uilint-eslint \"dist/\" directory. This is a bug in uilint installation.'\n );\n}\n\n/**\n * All utilities that are exported from uilint-eslint and can be imported.\n * When adding a new utility to uilint-eslint that rules may import,\n * add it here AND export it from uilint-eslint/src/index.ts.\n *\n * Rules can also declare their dependencies via the `internalDependencies`\n * field in defineRuleMeta() - this serves as documentation and can be\n * used for validation.\n */\nconst EXPORTED_UTILITIES = [\n \"create-rule\",\n \"cache\",\n \"styleguide-loader\",\n \"import-graph\",\n \"component-parser\",\n \"export-resolver\",\n \"coverage-aggregator\",\n \"dependency-graph\",\n \"file-categorizer\",\n \"jsx-coverage-analyzer\",\n];\n\n/**\n * Maps internal export names to their uilint-eslint export names.\n * Some exports are renamed when re-exported from the main package\n * to avoid naming conflicts.\n *\n * Format: \"utilFile:internalName\" -> \"externalName\"\n */\nconst EXPORT_RENAMES: Record<string, string> = {\n \"import-graph:clearCache\": \"clearImportGraphCache\",\n};\n\n/**\n * Transform an import specifier, applying any necessary renames.\n * Handles both simple imports (foo) and aliased imports (foo as bar).\n */\nfunction transformImportSpecifier(specifier: string, utilFile: string): string {\n const trimmed = specifier.trim();\n\n // Check for aliased import: \"localName as alias\"\n const aliasMatch = trimmed.match(/^(\\w+)\\s+as\\s+(\\w+)$/);\n if (aliasMatch) {\n const [, localName, alias] = aliasMatch;\n const renameKey = `${utilFile}:${localName}`;\n const externalName = EXPORT_RENAMES[renameKey];\n if (externalName) {\n // If the alias matches the external name, simplify to just the name\n if (alias === externalName) {\n return externalName;\n }\n // Otherwise, use the external name with the original alias\n return `${externalName} as ${alias}`;\n }\n // No rename needed, keep original\n return trimmed;\n }\n\n // Simple import: check if it needs renaming\n const renameKey = `${utilFile}:${trimmed}`;\n const externalName = EXPORT_RENAMES[renameKey];\n if (externalName) {\n return externalName;\n }\n\n return trimmed;\n}\n\n/**\n * External packages that are re-exported from uilint-eslint.\n * When rules import these packages directly, transform them to import from uilint-eslint instead.\n * This ensures the dependencies are resolved correctly when rules are copied to user projects.\n */\nconst REEXPORTED_PACKAGES: Record<string, string[]> = {\n \"oxc-resolver\": [\"ResolverFactory\"],\n};\n\n/**\n * Transform rule content to fix imports for copied location\n * Changes imports from \"../utils/...\" or \"../../utils/...\" to \"uilint-eslint\"\n * Also transforms external package imports that are re-exported from uilint-eslint\n */\nfunction transformRuleContent(content: string): string {\n let transformed = content;\n\n // Replace all relative utility imports with uilint-eslint imports\n // Pattern: import { ... } from \"../utils/create-rule.js\" or \"../../utils/create-rule.js\"\n // This handles any combination of imports like { createRule, defineRuleMeta }\n transformed = transformed.replace(\n /import\\s+{([^}]+)}\\s+from\\s+[\"'](?:\\.\\.\\/)+utils\\/([^\"']+)\\.js[\"'];?/g,\n (match, imports, utilFile) => {\n if (EXPORTED_UTILITIES.includes(utilFile)) {\n // Transform each import specifier\n const specifiers = imports.split(\",\").map((s: string) =>\n transformImportSpecifier(s, utilFile)\n );\n return `import { ${specifiers.join(\", \")} } from \"uilint-eslint\";`;\n }\n return match; // Keep original if not a known utility\n }\n );\n\n // Also handle default imports: import createRule from \"../utils/create-rule.js\"\n transformed = transformed.replace(\n /import\\s+(\\w+)\\s+from\\s+[\"'](?:\\.\\.\\/)+utils\\/([^\"']+)\\.js[\"'];?/g,\n (match, importName, utilFile) => {\n if (EXPORTED_UTILITIES.includes(utilFile)) {\n return `import { ${importName} } from \"uilint-eslint\";`;\n }\n return match;\n }\n );\n\n // Transform external package imports that are re-exported from uilint-eslint\n // Pattern: import { ResolverFactory } from \"oxc-resolver\"\n for (const [pkgName, exports] of Object.entries(REEXPORTED_PACKAGES)) {\n const escapedPkgName = pkgName.replace(/-/g, \"\\\\-\");\n const regex = new RegExp(\n `import\\\\s+{([^}]+)}\\\\s+from\\\\s+[\"']${escapedPkgName}[\"'];?`,\n \"g\"\n );\n transformed = transformed.replace(regex, (match, imports) => {\n const importNames = imports.split(\",\").map((s: string) => s.trim());\n // Only transform if all imported names are re-exported from uilint-eslint\n const allReexported = importNames.every((name: string) => {\n // Handle \"Foo as Bar\" syntax - extract the original name\n const originalName = name.split(/\\s+as\\s+/)[0].trim();\n return exports.includes(originalName);\n });\n if (allReexported) {\n return `import { ${imports} } from \"uilint-eslint\";`;\n }\n return match;\n });\n }\n\n return transformed;\n}\n\n/**\n * Check if a rule is directory-based (has index.ts/index.js) or single-file\n */\nfunction isDirectoryBasedRule(rulesDir: string, ruleId: string): boolean {\n const ruleDir = join(rulesDir, ruleId);\n return existsSync(ruleDir) && existsSync(join(ruleDir, \"index.ts\"));\n}\n\n/**\n * Load all files from a directory-based rule\n */\nfunction loadDirectoryRule(\n rulesDir: string,\n ruleId: string\n): { files: RuleFile[]; testFile?: RuleFile } {\n const ruleDir = join(rulesDir, ruleId);\n const files: RuleFile[] = [];\n let testFile: RuleFile | undefined;\n\n function collectFiles(dir: string, relativeTo: string): void {\n const entries = readdirSync(dir, { withFileTypes: true });\n for (const entry of entries) {\n const fullPath = join(dir, entry.name);\n const relativePath = join(relativeTo, entry.name);\n\n if (entry.isDirectory()) {\n collectFiles(fullPath, relativePath);\n } else if (entry.name.endsWith(\".ts\")) {\n if (entry.name.endsWith(\".test.ts\")) {\n // Handle test file separately\n testFile = {\n relativePath,\n content: transformRuleContent(readFileSync(fullPath, \"utf-8\")),\n };\n } else {\n files.push({\n relativePath,\n content: transformRuleContent(readFileSync(fullPath, \"utf-8\")),\n });\n }\n }\n }\n }\n\n collectFiles(ruleDir, ruleId);\n return { files, testFile };\n}\n\n/**\n * Load a specific rule by ID\n */\nexport function loadRule(\n ruleId: string,\n options: { typescript: boolean } = { typescript: true }\n): RuleFiles {\n const { typescript } = options;\n const extension = typescript ? \".ts\" : \".js\";\n\n if (typescript) {\n // Load TypeScript source files\n const rulesDir = join(getUilintEslintSrcDir(), \"rules\");\n\n // Check if this is a directory-based rule\n if (isDirectoryBasedRule(rulesDir, ruleId)) {\n const { files, testFile } = loadDirectoryRule(rulesDir, ruleId);\n\n if (files.length === 0) {\n throw new Error(`Rule \"${ruleId}\" directory exists but contains no TypeScript files`);\n }\n\n // Find the index.ts as the main implementation\n const indexFile = files.find((f) => f.relativePath === join(ruleId, \"index.ts\"));\n if (!indexFile) {\n throw new Error(`Rule \"${ruleId}\" directory missing index.ts`);\n }\n\n return {\n ruleId,\n implementation: indexFile,\n additionalFiles: files.filter((f) => f !== indexFile),\n test: testFile,\n };\n }\n\n // Single-file rule\n const implPath = join(rulesDir, `${ruleId}.ts`);\n const testPath = join(rulesDir, `${ruleId}.test.ts`);\n\n if (!existsSync(implPath)) {\n throw new Error(`Rule \"${ruleId}\" not found at ${implPath}`);\n }\n\n const rawContent = readFileSync(implPath, \"utf-8\");\n const transformedContent = transformRuleContent(rawContent);\n\n const implementation: RuleFile = {\n relativePath: `${ruleId}.ts`,\n content: transformedContent,\n };\n\n const test: RuleFile | undefined = existsSync(testPath)\n ? {\n relativePath: `${ruleId}.test.ts`,\n content: transformRuleContent(readFileSync(testPath, \"utf-8\")),\n }\n : undefined;\n\n return {\n ruleId,\n implementation,\n test,\n };\n } else {\n // Load compiled JavaScript files\n const rulesDir = join(getUilintEslintDistDir(), \"rules\");\n const implPath = join(rulesDir, `${ruleId}.js`);\n\n if (!existsSync(implPath)) {\n throw new Error(\n `Rule \"${ruleId}\" not found at ${implPath}. ` +\n `For JavaScript-only projects, uilint-eslint must be built to include compiled rule files in dist/rules/. ` +\n `If you're developing uilint-eslint, run 'pnpm build' in packages/uilint-eslint. ` +\n `If you're using a published package, ensure it includes the dist/ directory.`\n );\n }\n\n // Compiled JS files don't need transformation - they already use uilint-eslint imports\n const content = readFileSync(implPath, \"utf-8\");\n\n const implementation: RuleFile = {\n relativePath: `${ruleId}.js`,\n content,\n };\n\n // Test files are not compiled, so we don't copy them for JS projects\n return {\n ruleId,\n implementation,\n };\n }\n}\n\n/**\n * Load multiple rules by their IDs\n */\nexport function loadSelectedRules(\n ruleIds: string[],\n options: { typescript: boolean } = { typescript: true }\n): RuleFiles[] {\n return ruleIds.map((id) => loadRule(id, options));\n}\n\n/**\n * Get the list of available rule IDs from the registry\n */\nexport function getAvailableRuleIds(): string[] {\n try {\n // Import the rule registry from uilint-eslint\n const { ruleRegistry } = require(\"uilint-eslint\");\n return ruleRegistry.map((rule: { id: string }) => rule.id);\n } catch {\n // Fallback: try to read from filesystem\n const rulesDir = join(getUilintEslintSrcDir(), \"rules\");\n if (!existsSync(rulesDir)) {\n return [];\n }\n\n // This is a fallback - ideally we'd use the registry\n // But if we can't import it, we can at least try to list files\n const files = readdirSync(rulesDir);\n return files\n .filter((f: string) => f.endsWith(\".ts\") && !f.endsWith(\".test.ts\"))\n .map((f: string) => f.replace(\".ts\", \"\"));\n }\n}\n"],"mappings":";;;AAOA,SAAS,cAAc,YAAY,mBAAmB;AACtD,SAAS,MAAM,eAAe;AAC9B,SAAS,qBAAqB;AAC9B,SAAS,qBAAqB;AAE9B,IAAM,aAAa,cAAc,YAAY,GAAG;AAChD,IAAM,YAAY,QAAQ,UAAU;AACpC,IAAMA,WAAU,cAAc,YAAY,GAAG;AAE7C,SAAS,2BACP,SACA,UACe;AACf,MAAI,MAAM;AACV,SAAO,MAAM;AACX,UAAM,YAAY,KAAK,KAAK,gBAAgB,OAAO;AACnD,QAAI,WAAW,KAAK,WAAW,cAAc,CAAC,EAAG,QAAO;AACxD,UAAM,SAAS,QAAQ,GAAG;AAC1B,QAAI,WAAW,IAAK;AACpB,UAAM;AAAA,EACR;AACA,SAAO;AACT;AAEA,SAAS,6BAAqC;AAO5C,QAAM,UAAU,2BAA2B,iBAAiB,QAAQ,IAAI,CAAC;AACzE,MAAI,QAAS,QAAO;AAEpB,QAAM,WAAW,2BAA2B,iBAAiB,SAAS;AACtE,MAAI,SAAU,QAAO;AAGrB,MAAI;AACF,UAAM,QAAQA,SAAQ,QAAQ,eAAe;AAC7C,UAAM,WAAW,QAAQ,KAAK;AAC9B,WAAO,QAAQ,QAAQ;AAAA,EACzB,SAAS,GAAG;AACV,UAAM,MAAM,aAAa,QAAQ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AA,IACF;AAGA,UAAM,UAAU,aAAa,UAAU,OAAO;AAE9C,UAAM,iBAA2B;AAAA,MAC/B,cAAc,GAAG,MAAM;AAAA,MACvB;AAAA,IACF;AAGA,WAAO;AAAA,MACL;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;AAKO,SAAS,kBACd,SACA,UAAmC,EAAE,YAAY,KAAK,GACzC;AACb,SAAO,QAAQ,IAAI,CAAC,OAAO,SAAS,IAAI,OAAO,CAAC;AAClD;","names":["require","renameKey","externalName"]}
1
+ {"version":3,"sources":["../src/utils/rule-loader.ts"],"sourcesContent":["/**\n * Rule Loader Utility\n *\n * Loads ESLint rule source files from the uilint-eslint package for installation\n * into user projects. Rules are copied to .uilint/rules/ in the target project.\n */\n\nimport { readFileSync, existsSync, readdirSync } from \"fs\";\nimport { join, dirname } from \"path\";\nimport { fileURLToPath } from \"url\";\nimport { createRequire } from \"module\";\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = dirname(__filename);\nconst require = createRequire(import.meta.url);\n\nfunction findNodeModulesPackageRoot(\n pkgName: string,\n startDir: string\n): string | null {\n let dir = startDir;\n while (true) {\n const candidate = join(dir, \"node_modules\", pkgName);\n if (existsSync(join(candidate, \"package.json\"))) return candidate;\n const parent = dirname(dir);\n if (parent === dir) break;\n dir = parent;\n }\n return null;\n}\n\nfunction getUilintEslintPackageRoot(): string {\n // Prefer a filesystem-based lookup first. This avoids Node resolution edge\n // cases with package.json \"exports\" (especially ESM-only packages), and works\n // well for monorepos + pnpm where node_modules contains symlinks.\n //\n // Search upwards from process.cwd() (the user's project) and from this file\n // location (for test/dev environments).\n const fromCwd = findNodeModulesPackageRoot(\"uilint-eslint\", process.cwd());\n if (fromCwd) return fromCwd;\n\n const fromHere = findNodeModulesPackageRoot(\"uilint-eslint\", __dirname);\n if (fromHere) return fromHere;\n\n // Last resort: try resolver-based lookup.\n try {\n const entry = require.resolve(\"uilint-eslint\"); // typically .../dist/index.js\n const entryDir = dirname(entry); // typically .../dist\n return dirname(entryDir); // package root\n } catch (e) {\n const msg = e instanceof Error ? e.message : String(e);\n throw new Error(\n `Unable to locate uilint-eslint in node_modules (searched upwards from cwd and uilint's install path).\\n` +\n `Resolver error: ${msg}\\n` +\n `Fix: ensure uilint-eslint is installed in the target project (or workspace) and try again.`\n );\n }\n}\n\n/**\n * Represents a file for a rule (implementation or test)\n */\nexport interface RuleFile {\n /** Relative path within the rules directory (e.g., \"consistent-dark-mode.ts\") */\n relativePath: string;\n /** File content */\n content: string;\n}\n\n/**\n * Represents a complete rule ready for installation\n */\nexport interface RuleFiles {\n /** Rule identifier (e.g., \"consistent-dark-mode\") */\n ruleId: string;\n /** Implementation file (main entry point - index.ts for directory rules, or single file) */\n implementation: RuleFile;\n /** Additional files for directory-based rules (lib/ utilities, etc.) */\n additionalFiles?: RuleFile[];\n /** Test file (if exists) */\n test?: RuleFile;\n}\n\n/**\n * Get the path to the uilint-eslint package source directory\n */\nfunction getUilintEslintSrcDir(): string {\n // In development: packages/uilint-eslint/src/\n // In production (installed): node_modules/uilint-eslint/src/\n\n // Try workspace/dev path first (repo layout)\n const devPath = join(\n __dirname,\n \"..\",\n \"..\",\n \"..\",\n \"..\",\n \"uilint-eslint\",\n \"src\"\n );\n if (existsSync(devPath)) return devPath;\n\n // Try from installed package root (works with \"exports\")\n const pkgRoot = getUilintEslintPackageRoot();\n const srcPath = join(pkgRoot, \"src\");\n if (existsSync(srcPath)) return srcPath;\n\n throw new Error(\n 'Could not find uilint-eslint \"src/\" directory. If you are using a published install of uilint-eslint, ensure it includes source files, or run a JS-only rules install.'\n );\n}\n\n/**\n * Get the path to the uilint-eslint package dist directory\n */\nfunction getUilintEslintDistDir(): string {\n // In development: packages/uilint-eslint/dist/\n // In production (installed): node_modules/uilint-eslint/dist/\n\n // Try workspace/dev path first (repo layout)\n const devPath = join(\n __dirname,\n \"..\",\n \"..\",\n \"..\",\n \"..\",\n \"uilint-eslint\",\n \"dist\"\n );\n if (existsSync(devPath)) return devPath;\n\n // Try from installed package root (works with \"exports\")\n const pkgRoot = getUilintEslintPackageRoot();\n const distPath = join(pkgRoot, \"dist\");\n if (existsSync(distPath)) return distPath;\n\n throw new Error(\n 'Could not find uilint-eslint \"dist/\" directory. This is a bug in uilint installation.'\n );\n}\n\n/**\n * All utilities that are exported from uilint-eslint and can be imported.\n * When adding a new utility to uilint-eslint that rules may import,\n * add it here AND export it from uilint-eslint/src/index.ts.\n *\n * Rules can also declare their dependencies via the `internalDependencies`\n * field in defineRuleMeta() - this serves as documentation and can be\n * used for validation.\n */\nconst EXPORTED_UTILITIES = [\n \"create-rule\",\n \"cache\",\n \"styleguide-loader\",\n \"import-graph\",\n \"component-parser\",\n \"export-resolver\",\n \"coverage-aggregator\",\n \"dependency-graph\",\n \"file-categorizer\",\n \"jsx-coverage-analyzer\",\n];\n\n/**\n * Maps internal export names to their uilint-eslint export names.\n * Some exports are renamed when re-exported from the main package\n * to avoid naming conflicts.\n *\n * Format: \"utilFile:internalName\" -> \"externalName\"\n */\nconst EXPORT_RENAMES: Record<string, string> = {\n \"import-graph:clearCache\": \"clearImportGraphCache\",\n};\n\n/**\n * Transform an import specifier, applying any necessary renames.\n * Handles both simple imports (foo) and aliased imports (foo as bar).\n */\nfunction transformImportSpecifier(specifier: string, utilFile: string): string {\n const trimmed = specifier.trim();\n\n // Check for aliased import: \"localName as alias\"\n const aliasMatch = trimmed.match(/^(\\w+)\\s+as\\s+(\\w+)$/);\n if (aliasMatch) {\n const [, localName, alias] = aliasMatch;\n const renameKey = `${utilFile}:${localName}`;\n const externalName = EXPORT_RENAMES[renameKey];\n if (externalName) {\n // If the alias matches the external name, simplify to just the name\n if (alias === externalName) {\n return externalName;\n }\n // Otherwise, use the external name with the original alias\n return `${externalName} as ${alias}`;\n }\n // No rename needed, keep original\n return trimmed;\n }\n\n // Simple import: check if it needs renaming\n const renameKey = `${utilFile}:${trimmed}`;\n const externalName = EXPORT_RENAMES[renameKey];\n if (externalName) {\n return externalName;\n }\n\n return trimmed;\n}\n\n/**\n * External packages that are re-exported from uilint-eslint.\n * When rules import these packages directly, transform them to import from uilint-eslint instead.\n * This ensures the dependencies are resolved correctly when rules are copied to user projects.\n */\nconst REEXPORTED_PACKAGES: Record<string, string[]> = {\n \"oxc-resolver\": [\"ResolverFactory\"],\n};\n\n/**\n * Transform rule content to fix imports for copied location\n * Changes imports from \"../utils/...\" or \"../../utils/...\" to \"uilint-eslint\"\n * Also transforms external package imports that are re-exported from uilint-eslint\n */\nfunction transformRuleContent(content: string): string {\n let transformed = content;\n\n // Replace all relative utility imports with uilint-eslint imports\n // Pattern: import { ... } from \"../utils/create-rule.js\" or \"../../utils/create-rule.js\"\n // This handles any combination of imports like { createRule, defineRuleMeta }\n transformed = transformed.replace(\n /import\\s+{([^}]+)}\\s+from\\s+[\"'](?:\\.\\.\\/)+utils\\/([^\"']+)\\.js[\"'];?/g,\n (match, imports, utilFile) => {\n if (EXPORTED_UTILITIES.includes(utilFile)) {\n // Transform each import specifier\n const specifiers = imports.split(\",\").map((s: string) =>\n transformImportSpecifier(s, utilFile)\n );\n return `import { ${specifiers.join(\", \")} } from \"uilint-eslint\";`;\n }\n return match; // Keep original if not a known utility\n }\n );\n\n // Also handle default imports: import createRule from \"../utils/create-rule.js\"\n transformed = transformed.replace(\n /import\\s+(\\w+)\\s+from\\s+[\"'](?:\\.\\.\\/)+utils\\/([^\"']+)\\.js[\"'];?/g,\n (match, importName, utilFile) => {\n if (EXPORTED_UTILITIES.includes(utilFile)) {\n return `import { ${importName} } from \"uilint-eslint\";`;\n }\n return match;\n }\n );\n\n // Transform external package imports that are re-exported from uilint-eslint\n // Pattern: import { ResolverFactory } from \"oxc-resolver\"\n for (const [pkgName, exports] of Object.entries(REEXPORTED_PACKAGES)) {\n const escapedPkgName = pkgName.replace(/-/g, \"\\\\-\");\n const regex = new RegExp(\n `import\\\\s+{([^}]+)}\\\\s+from\\\\s+[\"']${escapedPkgName}[\"'];?`,\n \"g\"\n );\n transformed = transformed.replace(regex, (match, imports) => {\n const importNames = imports.split(\",\").map((s: string) => s.trim());\n // Only transform if all imported names are re-exported from uilint-eslint\n const allReexported = importNames.every((name: string) => {\n // Handle \"Foo as Bar\" syntax - extract the original name\n const originalName = name.split(/\\s+as\\s+/)[0].trim();\n return exports.includes(originalName);\n });\n if (allReexported) {\n return `import { ${imports} } from \"uilint-eslint\";`;\n }\n return match;\n });\n }\n\n return transformed;\n}\n\n/**\n * Check if a rule is directory-based (has index.ts/index.js) or single-file\n */\nfunction isDirectoryBasedRule(rulesDir: string, ruleId: string): boolean {\n const ruleDir = join(rulesDir, ruleId);\n return existsSync(ruleDir) && existsSync(join(ruleDir, \"index.ts\"));\n}\n\n/**\n * Load all files from a directory-based rule\n */\nfunction loadDirectoryRule(\n rulesDir: string,\n ruleId: string\n): { files: RuleFile[]; testFile?: RuleFile } {\n const ruleDir = join(rulesDir, ruleId);\n const files: RuleFile[] = [];\n let testFile: RuleFile | undefined;\n\n function collectFiles(dir: string, relativeTo: string): void {\n const entries = readdirSync(dir, { withFileTypes: true });\n for (const entry of entries) {\n const fullPath = join(dir, entry.name);\n const relativePath = join(relativeTo, entry.name);\n\n if (entry.isDirectory()) {\n collectFiles(fullPath, relativePath);\n } else if (entry.name.endsWith(\".ts\")) {\n if (entry.name.endsWith(\".test.ts\")) {\n // Handle test file separately\n testFile = {\n relativePath,\n content: transformRuleContent(readFileSync(fullPath, \"utf-8\")),\n };\n } else {\n files.push({\n relativePath,\n content: transformRuleContent(readFileSync(fullPath, \"utf-8\")),\n });\n }\n }\n }\n }\n\n collectFiles(ruleDir, ruleId);\n return { files, testFile };\n}\n\n/**\n * Load a specific rule by ID\n */\nexport function loadRule(\n ruleId: string,\n options: { typescript: boolean } = { typescript: true }\n): RuleFiles {\n const { typescript } = options;\n const _extension = typescript ? \".ts\" : \".js\";\n\n if (typescript) {\n // Load TypeScript source files\n const rulesDir = join(getUilintEslintSrcDir(), \"rules\");\n\n // Check if this is a directory-based rule\n if (isDirectoryBasedRule(rulesDir, ruleId)) {\n const { files, testFile } = loadDirectoryRule(rulesDir, ruleId);\n\n if (files.length === 0) {\n throw new Error(`Rule \"${ruleId}\" directory exists but contains no TypeScript files`);\n }\n\n // Find the index.ts as the main implementation\n const indexFile = files.find((f) => f.relativePath === join(ruleId, \"index.ts\"));\n if (!indexFile) {\n throw new Error(`Rule \"${ruleId}\" directory missing index.ts`);\n }\n\n return {\n ruleId,\n implementation: indexFile,\n additionalFiles: files.filter((f) => f !== indexFile),\n test: testFile,\n };\n }\n\n // Single-file rule\n const implPath = join(rulesDir, `${ruleId}.ts`);\n const testPath = join(rulesDir, `${ruleId}.test.ts`);\n\n if (!existsSync(implPath)) {\n throw new Error(`Rule \"${ruleId}\" not found at ${implPath}`);\n }\n\n const rawContent = readFileSync(implPath, \"utf-8\");\n const transformedContent = transformRuleContent(rawContent);\n\n const implementation: RuleFile = {\n relativePath: `${ruleId}.ts`,\n content: transformedContent,\n };\n\n const test: RuleFile | undefined = existsSync(testPath)\n ? {\n relativePath: `${ruleId}.test.ts`,\n content: transformRuleContent(readFileSync(testPath, \"utf-8\")),\n }\n : undefined;\n\n return {\n ruleId,\n implementation,\n test,\n };\n } else {\n // Load compiled JavaScript files\n const rulesDir = join(getUilintEslintDistDir(), \"rules\");\n const implPath = join(rulesDir, `${ruleId}.js`);\n\n if (!existsSync(implPath)) {\n throw new Error(\n `Rule \"${ruleId}\" not found at ${implPath}. ` +\n `For JavaScript-only projects, uilint-eslint must be built to include compiled rule files in dist/rules/. ` +\n `If you're developing uilint-eslint, run 'pnpm build' in packages/uilint-eslint. ` +\n `If you're using a published package, ensure it includes the dist/ directory.`\n );\n }\n\n // Compiled JS files don't need transformation - they already use uilint-eslint imports\n const content = readFileSync(implPath, \"utf-8\");\n\n const implementation: RuleFile = {\n relativePath: `${ruleId}.js`,\n content,\n };\n\n // Test files are not compiled, so we don't copy them for JS projects\n return {\n ruleId,\n implementation,\n };\n }\n}\n\n/**\n * Load multiple rules by their IDs\n */\nexport function loadSelectedRules(\n ruleIds: string[],\n options: { typescript: boolean } = { typescript: true }\n): RuleFiles[] {\n return ruleIds.map((id) => loadRule(id, options));\n}\n\n/**\n * Get the list of available rule IDs from the registry\n */\nexport function getAvailableRuleIds(): string[] {\n try {\n // Import the rule registry from uilint-eslint\n const { ruleRegistry } = require(\"uilint-eslint\");\n return ruleRegistry.map((rule: { id: string }) => rule.id);\n } catch {\n // Fallback: try to read from filesystem\n const rulesDir = join(getUilintEslintSrcDir(), \"rules\");\n if (!existsSync(rulesDir)) {\n return [];\n }\n\n // This is a fallback - ideally we'd use the registry\n // But if we can't import it, we can at least try to list files\n const files = readdirSync(rulesDir);\n return files\n .filter((f: string) => f.endsWith(\".ts\") && !f.endsWith(\".test.ts\"))\n .map((f: string) => f.replace(\".ts\", \"\"));\n }\n}\n"],"mappings":";;;AAOA,SAAS,cAAc,YAAY,mBAAmB;AACtD,SAAS,MAAM,eAAe;AAC9B,SAAS,qBAAqB;AAC9B,SAAS,qBAAqB;AAE9B,IAAM,aAAa,cAAc,YAAY,GAAG;AAChD,IAAM,YAAY,QAAQ,UAAU;AACpC,IAAMA,WAAU,cAAc,YAAY,GAAG;AAE7C,SAAS,2BACP,SACA,UACe;AACf,MAAI,MAAM;AACV,SAAO,MAAM;AACX,UAAM,YAAY,KAAK,KAAK,gBAAgB,OAAO;AACnD,QAAI,WAAW,KAAK,WAAW,cAAc,CAAC,EAAG,QAAO;AACxD,UAAM,SAAS,QAAQ,GAAG;AAC1B,QAAI,WAAW,IAAK;AACpB,UAAM;AAAA,EACR;AACA,SAAO;AACT;AAEA,SAAS,6BAAqC;AAO5C,QAAM,UAAU,2BAA2B,iBAAiB,QAAQ,IAAI,CAAC;AACzE,MAAI,QAAS,QAAO;AAEpB,QAAM,WAAW,2BAA2B,iBAAiB,SAAS;AACtE,MAAI,SAAU,QAAO;AAGrB,MAAI;AACF,UAAM,QAAQA,SAAQ,QAAQ,eAAe;AAC7C,UAAM,WAAW,QAAQ,KAAK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,GAAG;AACzB,YAAM,IAAI;AAAA,QACR,SAAS,MAAM,kBAAkB,QAAQ;AAAA,MAI3C;AAAA,IACF;AAGA,UAAM,UAAU,aAAa,UAAU,OAAO;AAE9C,UAAM,iBAA2B;AAAA,MAC/B,cAAc,GAAG,MAAM;AAAA,MACvB;AAAA,IACF;AAGA,WAAO;AAAA,MACL;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;AAKO,SAAS,kBACd,SACA,UAAmC,EAAE,YAAY,KAAK,GACzC;AACb,SAAO,QAAQ,IAAI,CAAC,OAAO,SAAS,IAAI,OAAO,CAAC;AAClD;","names":["require","renameKey","externalName"]}
@@ -0,0 +1,56 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ logInfo
4
+ } from "./chunk-CZNPG4UI.js";
5
+
6
+ // src/utils/plugin-loader.ts
7
+ import { createRequire } from "module";
8
+ import { join } from "path";
9
+ var KNOWN_PLUGIN_PACKAGES = ["uilint-vision", "uilint-semantic", "uilint-duplicates"];
10
+ async function discoverPlugins(resolveFrom) {
11
+ const manifests = [];
12
+ for (const pkg of KNOWN_PLUGIN_PACKAGES) {
13
+ const specifier = `${pkg}/cli-manifest`;
14
+ try {
15
+ let mod;
16
+ if (resolveFrom) {
17
+ const req = createRequire(join(resolveFrom, "package.json"));
18
+ const resolved = req.resolve(specifier);
19
+ mod = await import(resolved);
20
+ } else {
21
+ mod = await import(specifier);
22
+ }
23
+ if (mod.cliManifest) {
24
+ manifests.push(mod.cliManifest);
25
+ }
26
+ } catch {
27
+ }
28
+ }
29
+ return manifests;
30
+ }
31
+ async function loadPluginESLintRules(manifests, resolveFrom) {
32
+ const loaded = [];
33
+ for (const manifest of manifests) {
34
+ try {
35
+ if (resolveFrom) {
36
+ const req = createRequire(join(resolveFrom, "package.json"));
37
+ const resolved = req.resolve(manifest.registerSpecifier);
38
+ await import(resolved);
39
+ } else {
40
+ await import(manifest.registerSpecifier);
41
+ }
42
+ loaded.push(manifest.packageName);
43
+ } catch {
44
+ }
45
+ }
46
+ if (loaded.length > 0) {
47
+ logInfo(`Loaded plugin rules: ${loaded.join(", ")}`);
48
+ }
49
+ return loaded;
50
+ }
51
+
52
+ export {
53
+ discoverPlugins,
54
+ loadPluginESLintRules
55
+ };
56
+ //# sourceMappingURL=chunk-WG2WZTB2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utils/plugin-loader.ts"],"sourcesContent":["/**\n * Dynamic plugin loader for the CLI.\n *\n * Probes known plugin package names for a `cli-manifest` subpath export.\n * Each manifest describes the CLI flag, help text, and registration entry\n * point, keeping the core CLI free of plugin-specific knowledge.\n */\n\nimport { createRequire } from \"module\";\nimport { join } from \"path\";\nimport { logInfo } from \"./prompts.js\";\n\n/**\n * Metadata a plugin exposes via its `<pkg>/cli-manifest` subpath export.\n * Plugins define a plain object matching this shape — no shared type import needed.\n */\nexport interface PluginCLIManifest {\n /** npm package name, e.g. \"uilint-vision\" */\n packageName: string;\n /** CLI flag name (without --), e.g. \"vision\" */\n cliFlag: string;\n /** Description shown in --help */\n cliDescription: string;\n /** Import specifier for the register module, e.g. \"uilint-vision/eslint-rules/register\" */\n registerSpecifier: string;\n}\n\n/** Package names to probe for CLI manifests */\nconst KNOWN_PLUGIN_PACKAGES = [\"uilint-vision\", \"uilint-semantic\", \"uilint-duplicates\"];\n\n/**\n * Discover available plugin manifests by probing `<pkg>/cli-manifest`.\n *\n * @param resolveFrom - Optional project path to resolve plugins from.\n * When provided, uses createRequire anchored to the project's package.json\n * so plugins installed in the project's node_modules can be found.\n * @returns Array of discovered plugin manifests\n */\nexport async function discoverPlugins(\n resolveFrom?: string,\n): Promise<PluginCLIManifest[]> {\n const manifests: PluginCLIManifest[] = [];\n\n for (const pkg of KNOWN_PLUGIN_PACKAGES) {\n const specifier = `${pkg}/cli-manifest`;\n try {\n let mod: { cliManifest?: PluginCLIManifest };\n if (resolveFrom) {\n const req = createRequire(join(resolveFrom, \"package.json\"));\n const resolved = req.resolve(specifier);\n mod = (await import(resolved)) as typeof mod;\n } else {\n mod = (await import(specifier)) as typeof mod;\n }\n if (mod.cliManifest) {\n manifests.push(mod.cliManifest);\n }\n } catch {\n // Plugin not installed — skip silently\n }\n }\n\n return manifests;\n}\n\n/**\n * Load ESLint rules from discovered plugins by importing their register modules.\n *\n * @param manifests - Plugin manifests (from discoverPlugins)\n * @param resolveFrom - Optional project path to resolve plugins from.\n * @returns Array of loaded plugin package names\n */\nexport async function loadPluginESLintRules(\n manifests: PluginCLIManifest[],\n resolveFrom?: string,\n): Promise<string[]> {\n const loaded: string[] = [];\n\n for (const manifest of manifests) {\n try {\n if (resolveFrom) {\n const req = createRequire(join(resolveFrom, \"package.json\"));\n const resolved = req.resolve(manifest.registerSpecifier);\n await import(resolved);\n } else {\n await import(manifest.registerSpecifier);\n }\n loaded.push(manifest.packageName);\n } catch {\n // Plugin register module not available — skip silently\n }\n }\n\n if (loaded.length > 0) {\n logInfo(`Loaded plugin rules: ${loaded.join(\", \")}`);\n }\n\n return loaded;\n}\n"],"mappings":";;;;;;AAQA,SAAS,qBAAqB;AAC9B,SAAS,YAAY;AAmBrB,IAAM,wBAAwB,CAAC,iBAAiB,mBAAmB,mBAAmB;AAUtF,eAAsB,gBACpB,aAC8B;AAC9B,QAAM,YAAiC,CAAC;AAExC,aAAW,OAAO,uBAAuB;AACvC,UAAM,YAAY,GAAG,GAAG;AACxB,QAAI;AACF,UAAI;AACJ,UAAI,aAAa;AACf,cAAM,MAAM,cAAc,KAAK,aAAa,cAAc,CAAC;AAC3D,cAAM,WAAW,IAAI,QAAQ,SAAS;AACtC,cAAO,MAAM,OAAO;AAAA,MACtB,OAAO;AACL,cAAO,MAAM,OAAO;AAAA,MACtB;AACA,UAAI,IAAI,aAAa;AACnB,kBAAU,KAAK,IAAI,WAAW;AAAA,MAChC;AAAA,IACF,QAAQ;AAAA,IAER;AAAA,EACF;AAEA,SAAO;AACT;AASA,eAAsB,sBACpB,WACA,aACmB;AACnB,QAAM,SAAmB,CAAC;AAE1B,aAAW,YAAY,WAAW;AAChC,QAAI;AACF,UAAI,aAAa;AACf,cAAM,MAAM,cAAc,KAAK,aAAa,cAAc,CAAC;AAC3D,cAAM,WAAW,IAAI,QAAQ,SAAS,iBAAiB;AACvD,cAAM,OAAO;AAAA,MACf,OAAO;AACL,cAAM,OAAO,SAAS;AAAA,MACxB;AACA,aAAO,KAAK,SAAS,WAAW;AAAA,IAClC,QAAQ;AAAA,IAER;AAAA,EACF;AAEA,MAAI,OAAO,SAAS,GAAG;AACrB,YAAQ,wBAAwB,OAAO,KAAK,IAAI,CAAC,EAAE;AAAA,EACrD;AAEA,SAAO;AACT;","names":[]}
@@ -9,12 +9,7 @@ import {
9
9
  injectCoverageConfig,
10
10
  installEslintPlugin,
11
11
  removeEslintPlugin
12
- } from "./chunk-RYRHWTLC.js";
13
- import {
14
- GENSTYLEGUIDE_COMMAND_MD,
15
- loadSkill,
16
- toInstallSpecifier
17
- } from "./chunk-VSBVUS56.js";
12
+ } from "./chunk-7GQXW4CT.js";
18
13
  import {
19
14
  updateManifestRule
20
15
  } from "./chunk-ZDSDZNIB.js";
@@ -27,6 +22,11 @@ import {
27
22
  select,
28
23
  text
29
24
  } from "./chunk-CZNPG4UI.js";
25
+ import {
26
+ GENSTYLEGUIDE_COMMAND_MD,
27
+ loadSkill,
28
+ toInstallSpecifier
29
+ } from "./chunk-JWSZKDZY.js";
30
30
  import {
31
31
  detectPackageManager,
32
32
  installDependencies,
@@ -425,7 +425,7 @@ import {
425
425
  chmodSync,
426
426
  rmSync
427
427
  } from "fs";
428
- import { dirname as dirname3, join as join10 } from "path";
428
+ import { dirname as dirname2, join as join10 } from "path";
429
429
  import { fileURLToPath } from "url";
430
430
 
431
431
  // src/utils/react-inject.ts
@@ -650,7 +650,7 @@ function addDevtoolsToClientComponent(program) {
650
650
  return { changed: true };
651
651
  }
652
652
  function generateProvidersContent(isTypeScript) {
653
- const ext = isTypeScript ? "tsx" : "jsx";
653
+ const _ext = isTypeScript ? "tsx" : "jsx";
654
654
  const typeAnnotation = isTypeScript ? ": { children: React.ReactNode }" : "";
655
655
  return `"use client";
656
656
 
@@ -894,7 +894,7 @@ async function installReactUILintOverlay(opts) {
894
894
  };
895
895
  }
896
896
  async function removeReactUILintOverlay(options) {
897
- const { projectPath, appRoot, mode = "next" } = options;
897
+ const { projectPath, appRoot, mode: _mode = "next" } = options;
898
898
  const candidates = getDefaultCandidates(projectPath, appRoot);
899
899
  const modifiedFiles = [];
900
900
  for (const candidate of candidates) {
@@ -1881,7 +1881,7 @@ async function removeNextUILintRoutes(options) {
1881
1881
  // src/utils/prettier.ts
1882
1882
  import { existsSync as existsSync8, utimesSync } from "fs";
1883
1883
  import { spawn } from "child_process";
1884
- import { join as join8, dirname as dirname2 } from "path";
1884
+ import { join as join8, dirname } from "path";
1885
1885
  function getPrettierPath(projectPath) {
1886
1886
  const localPath = join8(projectPath, "node_modules", ".bin", "prettier");
1887
1887
  if (existsSync8(localPath)) return localPath;
@@ -1889,7 +1889,7 @@ function getPrettierPath(projectPath) {
1889
1889
  for (let i = 0; i < 10; i++) {
1890
1890
  const binPath = join8(dir, "node_modules", ".bin", "prettier");
1891
1891
  if (existsSync8(binPath)) return binPath;
1892
- const parent = dirname2(dir);
1892
+ const parent = dirname(dir);
1893
1893
  if (parent === dir) break;
1894
1894
  dir = parent;
1895
1895
  }
@@ -2107,7 +2107,7 @@ async function executeAction(action, options) {
2107
2107
  wouldDo: `Create file: ${action.path}${action.permissions ? ` (mode: ${action.permissions.toString(8)})` : ""}`
2108
2108
  };
2109
2109
  }
2110
- const dir = dirname3(action.path);
2110
+ const dir = dirname2(action.path);
2111
2111
  if (!existsSync10(dir)) {
2112
2112
  mkdirSync(dir, { recursive: true });
2113
2113
  }
@@ -2133,7 +2133,7 @@ async function executeAction(action, options) {
2133
2133
  }
2134
2134
  }
2135
2135
  const merged = deepMerge(existing, action.merge);
2136
- const dir = dirname3(action.path);
2136
+ const dir = dirname2(action.path);
2137
2137
  if (!existsSync10(dir)) {
2138
2138
  mkdirSync(dir, { recursive: true });
2139
2139
  }
@@ -2548,7 +2548,7 @@ async function executeUpdateManifest(action, options) {
2548
2548
  }
2549
2549
  function getCliVersion() {
2550
2550
  try {
2551
- const __dirname = dirname3(fileURLToPath(import.meta.url));
2551
+ const __dirname = dirname2(fileURLToPath(import.meta.url));
2552
2552
  const pkgPath = join10(__dirname, "..", "..", "..", "package.json");
2553
2553
  const pkg = JSON.parse(readFileSync8(pkgPath, "utf-8"));
2554
2554
  return pkg.version || "0.0.0";
@@ -2835,7 +2835,7 @@ var genstyleguideInstaller = {
2835
2835
  name: "/genstyleguide command",
2836
2836
  description: "Cursor command to generate UI style guides",
2837
2837
  icon: "\u{1F4DD}",
2838
- isApplicable(project) {
2838
+ isApplicable(_project) {
2839
2839
  return true;
2840
2840
  },
2841
2841
  getTargets(project) {
@@ -2873,7 +2873,7 @@ var genstyleguideInstaller = {
2873
2873
  dependencies: []
2874
2874
  };
2875
2875
  },
2876
- async *execute(targets, config, project) {
2876
+ async *execute(_targets, _config, _project) {
2877
2877
  yield {
2878
2878
  type: "start",
2879
2879
  message: "Installing /genstyleguide command"
@@ -2911,7 +2911,7 @@ var skillInstaller = {
2911
2911
  name: "UI Consistency Agent skill",
2912
2912
  description: "Claude Code skill for enforcing UI consistency",
2913
2913
  icon: "\u26A1",
2914
- isApplicable(project) {
2914
+ isApplicable(_project) {
2915
2915
  return true;
2916
2916
  },
2917
2917
  getTargets(project) {
@@ -2974,7 +2974,7 @@ var skillInstaller = {
2974
2974
  dependencies: []
2975
2975
  };
2976
2976
  },
2977
- async *execute(targets, config, project) {
2977
+ async *execute(_targets, _config, _project) {
2978
2978
  yield {
2979
2979
  type: "start",
2980
2980
  message: "Installing UI Consistency Agent skill"
@@ -3603,7 +3603,7 @@ ${semanticCat?.icon ?? "\u{1F9E0}"} ${semanticCat?.name ?? "Semantic rules"} (${
3603
3603
  }
3604
3604
  return { actions, dependencies };
3605
3605
  },
3606
- async *execute(targets, config, project) {
3606
+ async *execute(targets, config, _project) {
3607
3607
  const eslintConfig = config;
3608
3608
  yield {
3609
3609
  type: "start",
@@ -3669,7 +3669,7 @@ ${semanticCat?.icon ?? "\u{1F9E0}"} ${semanticCat?.name ?? "Semantic rules"} (${
3669
3669
 
3670
3670
  // src/utils/client-boundary-tracer.ts
3671
3671
  import { existsSync as existsSync13, readFileSync as readFileSync10 } from "fs";
3672
- import { join as join15, dirname as dirname4, relative as relative4 } from "path";
3672
+ import { join as join15, dirname as dirname3, relative as relative4 } from "path";
3673
3673
  import { parseModule as parseModule4 } from "magicast";
3674
3674
  function hasUseClientDirective(filePath) {
3675
3675
  try {
@@ -3718,13 +3718,13 @@ function extractImports(program) {
3718
3718
  return imports;
3719
3719
  }
3720
3720
  function resolveImportPath(importSource, fromFile, projectPath) {
3721
- const fromDir = dirname4(fromFile);
3721
+ const fromDir = dirname3(fromFile);
3722
3722
  let basePath;
3723
3723
  if (importSource.startsWith("@/")) {
3724
3724
  const withoutAlias = importSource.slice(2);
3725
3725
  const srcPath = join15(projectPath, "src", withoutAlias);
3726
3726
  const rootPath = join15(projectPath, withoutAlias);
3727
- basePath = existsSync13(dirname4(srcPath)) ? srcPath : rootPath;
3727
+ basePath = existsSync13(dirname3(srcPath)) ? srcPath : rootPath;
3728
3728
  } else if (importSource.startsWith("~/")) {
3729
3729
  basePath = join15(projectPath, importSource.slice(2));
3730
3730
  } else if (importSource.startsWith(".")) {
@@ -3950,7 +3950,7 @@ var nextOverlayInstaller = {
3950
3950
  });
3951
3951
  return { actions, dependencies };
3952
3952
  },
3953
- async *execute(targets, config, project) {
3953
+ async *execute(targets, config, _project) {
3954
3954
  if (targets.length === 0) return;
3955
3955
  const target = targets[0];
3956
3956
  const nextConfig = config;
@@ -4074,7 +4074,7 @@ var viteOverlayInstaller = {
4074
4074
  });
4075
4075
  return { actions, dependencies };
4076
4076
  },
4077
- async *execute(targets, config, project) {
4077
+ async *execute(targets, _config, _project) {
4078
4078
  if (targets.length === 0) return;
4079
4079
  const target = targets[0];
4080
4080
  yield {
@@ -4162,8 +4162,8 @@ function Spinner() {
4162
4162
  export {
4163
4163
  Spinner,
4164
4164
  getAllInstallers,
4165
- getInjectionPoints,
4166
4165
  analyze,
4167
- execute
4166
+ execute,
4167
+ getInjectionPoints
4168
4168
  };
4169
- //# sourceMappingURL=chunk-BFHNMKBU.js.map
4169
+ //# sourceMappingURL=chunk-ZUOFUPGT.js.map