ultracite 7.9.1 → 7.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,6 +9,8 @@
9
9
  // see issue #679.
10
10
  "includes": [
11
11
  "**",
12
+ "!!**/node_modules",
13
+ "!!**/.git",
12
14
  "!!**/dist",
13
15
  "!!**/build",
14
16
  "!!**/out",
@@ -6,6 +6,13 @@
6
6
  * tools (oxlint, oxfmt, eslint) import this module directly.
7
7
  */
8
8
  export const ignorePatterns = [
9
+ // ── Dependencies / VCS ────────────────────────────────────────────
10
+ // oxlint only skips node_modules when a .gitignore lists it, so without
11
+ // this entry `ultracite fix` rewrites installed packages in projects
12
+ // that have no .gitignore (see issue #737).
13
+ "**/node_modules",
14
+ "**/.git",
15
+
9
16
  // ── Build / framework output ──────────────────────────────────────
10
17
  "**/dist",
11
18
  "**/build",
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import{createRequire as xb}from"node:module";var Sb=xb(import.meta.url);import D1 from"node:process";import{Command as Y$}from"commander";var z={name:"ultracite",version:"7.9.1",description:"The AI-ready formatter that helps you write and generate code faster.",keywords:["biome","fixer","formatter","linter","ultracite"],homepage:"https://www.ultracite.ai/",bugs:{url:"https://github.com/haydenbleasel/ultracite/issues"},license:"MIT",author:"Hayden Bleasel <hello@haydenbleasel.com>",repository:{type:"git",url:"git+https://github.com/haydenbleasel/ultracite.git"},bin:{ultracite:"dist/index.js"},files:["config","dist","README.md"],type:"module",exports:{"./biome/*":"./config/biome/*/biome.jsonc","./eslint/*":"./config/eslint/*/eslint.config.mjs","./oxlint/*":{types:"./config/oxlint/*/index.d.mts",default:"./config/oxlint/*/index.mjs"},"./oxfmt":{types:"./config/oxfmt/index.d.mts",default:"./config/oxfmt/index.mjs"},"./prettier":"./config/prettier/prettier.config.mjs","./stylelint":"./config/stylelint/stylelint.config.mjs"},publishConfig:{access:"public",registry:"https://registry.npmjs.org/"},scripts:{prebuild:"bun run scripts/generate-dts.ts",build:"tsgo --noEmit && bun run build.ts",test:"bun test","test:coverage":"bun test --coverage",bench:"bun run benchmarks/cli.bench.ts",types:"tsgo --noEmit"},dependencies:{"@clack/prompts":"^1.5.1","@typescript-eslint/utils":"^8.62.1",commander:"^15.0.0","cross-spawn":"^7.0.6",deepmerge:"^4.3.1",glob:"^13.0.6","jsonc-parser":"^3.3.1",nypm:"^0.6.6",yaml:"^2.9.0",zod:"^4.4.3"},devDependencies:{"@angular-eslint/eslint-plugin":"^22.0.0","@biomejs/biome":"2.5.2","@darraghor/eslint-plugin-nestjs-typed":"^7.2.5","@eslint/js":"^10.0.0","@next/eslint-plugin-next":"^16.2.10","@tanstack/eslint-plugin-query":"^5.101.2","@tanstack/eslint-plugin-router":"^1.162.0","@tanstack/eslint-plugin-start":"^0.1.0","@types/bun":"^1.3.14","@types/cross-spawn":"^6.0.6","@types/node":"^25.9.2","@typescript-eslint/eslint-plugin":"^8.62.1","@typescript-eslint/parser":"^8.62.1","@vitest/eslint-plugin":"^1.6.21",eslint:"^10.0.0","eslint-config-prettier":"^10.1.8","eslint-import-resolver-typescript":"^4.4.5","eslint-plugin-astro":"^2.1.1","eslint-plugin-compat":"^7.0.2","eslint-plugin-cypress":"^6.4.2","eslint-plugin-github":"6.0.0","eslint-plugin-html":"^8.1.4","eslint-plugin-import-x":"^4.17.1","eslint-plugin-jest":"^29.15.4","eslint-plugin-jsdoc":"^63.0.11","eslint-plugin-jsx-a11y":"^6.10.2","eslint-plugin-n":"^18.2.1","eslint-plugin-prettier":"^5.5.6","eslint-plugin-promise":"^7.3.0","eslint-plugin-qwik":"^1.20.0","eslint-plugin-react":"^7.37.5","eslint-plugin-react-doctor":"^0.7.1","eslint-plugin-react-hooks":"^7.1.1","eslint-plugin-remix":"^1.1.1","eslint-plugin-solid":"^0.14.5","eslint-plugin-sonarjs":"^4.1.0","eslint-plugin-storybook":"^10.4.6","eslint-plugin-svelte":"^3.20.0","eslint-plugin-unicorn":"^70.0.0","eslint-plugin-unused-imports":"^4.4.1","eslint-plugin-vue":"^10.9.2",globals:"^17.7.0",oxlint:"^1.72.0","oxlint-plugin-react-doctor":"^0.7.1","prettier-plugin-astro":"^0.14.1","prettier-plugin-svelte":"^4.1.0","prettier-plugin-tailwindcss":"^0.8.0","stylelint-config-idiomatic-order":"^10.0.0","stylelint-config-standard":"^40.0.0","stylelint-prettier":"^5.0.3"},peerDependencies:{oxfmt:">=0.1.0",oxlint:"^1.0.0"},peerDependenciesMeta:{oxfmt:{optional:!0},oxlint:{optional:!0}},packageManager:"bun@1.3.14"};import{existsSync as Ib}from"node:fs";import mb from"node:path";var _b=(b,y,$)=>{let G=$?.indexOf(b)??-1;if(!$||G===-1)return y;return $.slice(G+1)},L1=(b)=>b.map((y)=>y.startsWith("-")?`./${y}`:y),n1="**/*.{css,scss,sass,less}",Fb=[".css",".scss",".sass",".less"],hb=(b)=>{let y=b.toLowerCase();return Fb.some(($)=>y.endsWith($))},x1=(b)=>{if(b.length===0)return[n1];let y=[];for(let $ of b){if(hb($)){y.push($);continue}if(mb.extname($)===""){let G=$.replace(/\/+$/u,"");y.push(G==="."||G===""?n1:`${G}/${n1}`)}}return y},k1=({commandName:b,parsedArgs:y,pathExists:$=Ib,rawArgs:G})=>{let v=_b(b,y,G),U=v.indexOf("--");if(U!==-1)return{files:v.slice(U+1),passthrough:v.slice(0,U)};let Q=[],W=[];for(let o of v){if(o.startsWith("-")&&!$(o)){W.push(o);continue}Q.push(o)}return{files:Q,passthrough:W}};import{sync as Ob}from"cross-spawn";class r extends Error{commandName;exitCode;name="LinterExitError";constructor(b,y){super(`${b} exited with code ${y}`);this.commandName=b,this.exitCode=y}}var j=(b,y,$)=>Ob(b,y,{...$,shell:!1}),d=(b,y)=>{if(y.error)throw Error(`Failed to run ${b}: ${y.error.message}`);if(y.status===null)throw Error(`${b} was killed by signal ${y.signal??"unknown"}`);if(y.status!==0)throw new r(b,y.status)},n=(b)=>{let y=null;for(let $ of b)try{$()}catch(G){if(G instanceof r){y??=G;continue}throw G}if(y)throw new r(y.commandName,y.exitCode)};import{accessSync as cb,lstatSync as w0,mkdirSync as qb,realpathSync as u0}from"node:fs";import{readFile as Pb,writeFile as fb}from"node:fs/promises";import D from"node:path";import C1 from"node:process";import{glob as Mb}from"glob";import lb from"yaml";import{readFileSync as Tb}from"node:fs";import{readFile as Eb}from"node:fs/promises";import{parse as j0}from"jsonc-parser";import{z as V}from"zod";var pb=V.looseObject({dependencies:V.record(V.string(),V.string()).optional(),devDependencies:V.record(V.string(),V.string()).optional(),"lint-staged":V.unknown().optional(),name:V.string().optional(),peerDependencies:V.record(V.string(),V.string()).optional(),prettier:V.unknown().optional(),scripts:V.record(V.string(),V.string()).optional(),stylelint:V.unknown().optional(),type:V.string().optional(),version:V.string().optional(),workspace:V.unknown().optional(),workspaces:V.union([V.array(V.string()),V.record(V.string(),V.unknown())]).optional()}),k=(b)=>{let y=j0(b),$=pb.safeParse(y);return $.success?$.data:void 0},p=(b="package.json")=>{try{let y=Tb(b,"utf-8");return k(y)}catch{return}},s=async(b="package.json")=>{try{let y=await Eb(b,"utf-8");return k(y)}catch{return}},K0=V.looseObject({extends:V.array(V.string()).optional()}),A0=V.looseObject({compilerOptions:V.looseObject({strict:V.boolean().optional(),strictNullChecks:V.boolean().optional()}).optional()}),S1=(b,y)=>{let $=j0(b),G=y.safeParse($);return G.success?G.data:void 0};var i1="pnpm-workspace.yaml",H=(b)=>{try{return cb(b),!0}catch{return!1}},c=()=>{if(H(i1))return!0;let b=p();if(!b)return!1;return!!b.workspaces||!!b.workspace},x=(b)=>{let y=D.dirname(b);if(y!=="."){let $=y.startsWith("./")?y.slice(2):y;qb($,{recursive:!0})}},s1=(b,y)=>{let $=D.relative(y,b);return $===""||!$.startsWith("..")&&!D.isAbsolute($)},t1=(b)=>typeof u0==="function"?u0(b):D.resolve(b),rb=(b)=>{let y=b;while(!0)try{return t1(y)}catch($){if($.code!=="ENOENT")throw $;let G=D.dirname(y);if(G===y)return D.resolve(y);y=G}},nb=(b)=>{let y=t1(C1.cwd()),$=D.resolve(C1.cwd(),b);if(!s1($,y))throw Error(`Refusing to write outside project: ${b}`);let G=D.dirname($),v=rb(G);if(!s1(v,y))throw Error(`Refusing to write through directory outside project: ${b}`);try{if((typeof w0==="function"?w0($):void 0)?.isSymbolicLink())throw Error(`Refusing to write through symbolic link: ${b}`);let Q=t1($);if(!s1(Q,y))throw Error(`Refusing to write outside project: ${b}`)}catch(U){if(U.code==="ENOENT")return;throw U}},Z=async(b,y)=>{nb(b),x(b),await fb(b,y)},L=async({dependencies:b,devDependencies:y,scripts:$,type:G})=>{let v=await s();if(!v)throw Error("Failed to parse package.json: file is missing or invalid");let U={...v};if(G)U.type=G;if(v.devDependencies||y)U.devDependencies={...v.devDependencies,...y};if(v.dependencies||b)U.dependencies={...v.dependencies,...b};if(v.scripts||$)U.scripts={...v.scripts,...$};await Z("package.json",`${JSON.stringify(U,null,2)}
2
+ import{createRequire as xb}from"node:module";var Sb=xb(import.meta.url);import D1 from"node:process";import{Command as Y$}from"commander";var z={name:"ultracite",version:"7.9.2",description:"The AI-ready formatter that helps you write and generate code faster.",keywords:["biome","fixer","formatter","linter","ultracite"],homepage:"https://www.ultracite.ai/",bugs:{url:"https://github.com/haydenbleasel/ultracite/issues"},license:"MIT",author:"Hayden Bleasel <hello@haydenbleasel.com>",repository:{type:"git",url:"git+https://github.com/haydenbleasel/ultracite.git"},bin:{ultracite:"dist/index.js"},files:["config","dist","README.md"],type:"module",exports:{"./biome/*":"./config/biome/*/biome.jsonc","./eslint/*":"./config/eslint/*/eslint.config.mjs","./oxlint/*":{types:"./config/oxlint/*/index.d.mts",default:"./config/oxlint/*/index.mjs"},"./oxfmt":{types:"./config/oxfmt/index.d.mts",default:"./config/oxfmt/index.mjs"},"./prettier":"./config/prettier/prettier.config.mjs","./stylelint":"./config/stylelint/stylelint.config.mjs"},publishConfig:{access:"public",registry:"https://registry.npmjs.org/"},scripts:{prebuild:"bun run scripts/generate-dts.ts",build:"tsgo --noEmit && bun run build.ts",test:"bun test","test:coverage":"bun test --coverage",bench:"bun run benchmarks/cli.bench.ts",types:"tsgo --noEmit"},dependencies:{"@clack/prompts":"^1.5.1","@typescript-eslint/utils":"^8.62.1",commander:"^15.0.0","cross-spawn":"^7.0.6",deepmerge:"^4.3.1",glob:"^13.0.6","jsonc-parser":"^3.3.1",nypm:"^0.6.6",yaml:"^2.9.0",zod:"^4.4.3"},devDependencies:{"@angular-eslint/eslint-plugin":"^22.0.0","@biomejs/biome":"2.5.2","@darraghor/eslint-plugin-nestjs-typed":"^7.2.5","@eslint/js":"^10.0.0","@next/eslint-plugin-next":"^16.2.10","@tanstack/eslint-plugin-query":"^5.101.2","@tanstack/eslint-plugin-router":"^1.162.0","@tanstack/eslint-plugin-start":"^0.1.0","@types/bun":"^1.3.14","@types/cross-spawn":"^6.0.6","@types/node":"^25.9.2","@typescript-eslint/eslint-plugin":"^8.62.1","@typescript-eslint/parser":"^8.62.1","@vitest/eslint-plugin":"^1.6.21",eslint:"^10.0.0","eslint-config-prettier":"^10.1.8","eslint-import-resolver-typescript":"^4.4.5","eslint-plugin-astro":"^2.1.1","eslint-plugin-compat":"^7.0.2","eslint-plugin-cypress":"^6.4.2","eslint-plugin-github":"6.0.0","eslint-plugin-html":"^8.1.4","eslint-plugin-import-x":"^4.17.1","eslint-plugin-jest":"^29.15.4","eslint-plugin-jsdoc":"^63.0.11","eslint-plugin-jsx-a11y":"^6.10.2","eslint-plugin-n":"^18.2.1","eslint-plugin-prettier":"^5.5.6","eslint-plugin-promise":"^7.3.0","eslint-plugin-qwik":"^1.20.0","eslint-plugin-react":"^7.37.5","eslint-plugin-react-doctor":"^0.7.1","eslint-plugin-react-hooks":"^7.1.1","eslint-plugin-remix":"^1.1.1","eslint-plugin-solid":"^0.14.5","eslint-plugin-sonarjs":"^4.1.0","eslint-plugin-storybook":"^10.4.6","eslint-plugin-svelte":"^3.20.0","eslint-plugin-unicorn":"^70.0.0","eslint-plugin-unused-imports":"^4.4.1","eslint-plugin-vue":"^10.9.2",globals:"^17.7.0",oxlint:"^1.72.0","oxlint-plugin-react-doctor":"^0.7.1","prettier-plugin-astro":"^0.14.1","prettier-plugin-svelte":"^4.1.0","prettier-plugin-tailwindcss":"^0.8.0","stylelint-config-idiomatic-order":"^10.0.0","stylelint-config-standard":"^40.0.0","stylelint-prettier":"^5.0.3"},peerDependencies:{oxfmt:">=0.1.0",oxlint:"^1.0.0"},peerDependenciesMeta:{oxfmt:{optional:!0},oxlint:{optional:!0}},packageManager:"bun@1.3.14"};import{existsSync as Ib}from"node:fs";import mb from"node:path";var _b=(b,y,$)=>{let G=$?.indexOf(b)??-1;if(!$||G===-1)return y;return $.slice(G+1)},L1=(b)=>b.map((y)=>y.startsWith("-")?`./${y}`:y),n1="**/*.{css,scss,sass,less}",Fb=[".css",".scss",".sass",".less"],hb=(b)=>{let y=b.toLowerCase();return Fb.some(($)=>y.endsWith($))},x1=(b)=>{if(b.length===0)return[n1];let y=[];for(let $ of b){if(hb($)){y.push($);continue}if(mb.extname($)===""){let G=$.replace(/\/+$/u,"");y.push(G==="."||G===""?n1:`${G}/${n1}`)}}return y},k1=({commandName:b,parsedArgs:y,pathExists:$=Ib,rawArgs:G})=>{let v=_b(b,y,G),U=v.indexOf("--");if(U!==-1)return{files:v.slice(U+1),passthrough:v.slice(0,U)};let Q=[],W=[];for(let o of v){if(o.startsWith("-")&&!$(o)){W.push(o);continue}Q.push(o)}return{files:Q,passthrough:W}};import{sync as Ob}from"cross-spawn";class r extends Error{commandName;exitCode;name="LinterExitError";constructor(b,y){super(`${b} exited with code ${y}`);this.commandName=b,this.exitCode=y}}var j=(b,y,$)=>Ob(b,y,{...$,shell:!1}),d=(b,y)=>{if(y.error)throw Error(`Failed to run ${b}: ${y.error.message}`);if(y.status===null)throw Error(`${b} was killed by signal ${y.signal??"unknown"}`);if(y.status!==0)throw new r(b,y.status)},n=(b)=>{let y=null;for(let $ of b)try{$()}catch(G){if(G instanceof r){y??=G;continue}throw G}if(y)throw new r(y.commandName,y.exitCode)};import{accessSync as cb,lstatSync as w0,mkdirSync as qb,realpathSync as u0}from"node:fs";import{readFile as Pb,writeFile as fb}from"node:fs/promises";import D from"node:path";import C1 from"node:process";import{glob as Mb}from"glob";import lb from"yaml";import{readFileSync as Tb}from"node:fs";import{readFile as Eb}from"node:fs/promises";import{parse as j0}from"jsonc-parser";import{z as V}from"zod";var pb=V.looseObject({dependencies:V.record(V.string(),V.string()).optional(),devDependencies:V.record(V.string(),V.string()).optional(),"lint-staged":V.unknown().optional(),name:V.string().optional(),peerDependencies:V.record(V.string(),V.string()).optional(),prettier:V.unknown().optional(),scripts:V.record(V.string(),V.string()).optional(),stylelint:V.unknown().optional(),type:V.string().optional(),version:V.string().optional(),workspace:V.unknown().optional(),workspaces:V.union([V.array(V.string()),V.record(V.string(),V.unknown())]).optional()}),k=(b)=>{let y=j0(b),$=pb.safeParse(y);return $.success?$.data:void 0},p=(b="package.json")=>{try{let y=Tb(b,"utf-8");return k(y)}catch{return}},s=async(b="package.json")=>{try{let y=await Eb(b,"utf-8");return k(y)}catch{return}},K0=V.looseObject({extends:V.array(V.string()).optional()}),A0=V.looseObject({compilerOptions:V.looseObject({strict:V.boolean().optional(),strictNullChecks:V.boolean().optional()}).optional()}),S1=(b,y)=>{let $=j0(b),G=y.safeParse($);return G.success?G.data:void 0};var i1="pnpm-workspace.yaml",H=(b)=>{try{return cb(b),!0}catch{return!1}},c=()=>{if(H(i1))return!0;let b=p();if(!b)return!1;return!!b.workspaces||!!b.workspace},x=(b)=>{let y=D.dirname(b);if(y!=="."){let $=y.startsWith("./")?y.slice(2):y;qb($,{recursive:!0})}},s1=(b,y)=>{let $=D.relative(y,b);return $===""||!$.startsWith("..")&&!D.isAbsolute($)},t1=(b)=>typeof u0==="function"?u0(b):D.resolve(b),rb=(b)=>{let y=b;while(!0)try{return t1(y)}catch($){if($.code!=="ENOENT")throw $;let G=D.dirname(y);if(G===y)return D.resolve(y);y=G}},nb=(b)=>{let y=t1(C1.cwd()),$=D.resolve(C1.cwd(),b);if(!s1($,y))throw Error(`Refusing to write outside project: ${b}`);let G=D.dirname($),v=rb(G);if(!s1(v,y))throw Error(`Refusing to write through directory outside project: ${b}`);try{if((typeof w0==="function"?w0($):void 0)?.isSymbolicLink())throw Error(`Refusing to write through symbolic link: ${b}`);let Q=t1($);if(!s1(Q,y))throw Error(`Refusing to write outside project: ${b}`)}catch(U){if(U.code==="ENOENT")return;throw U}},Z=async(b,y)=>{nb(b),x(b),await fb(b,y)},L=async({dependencies:b,devDependencies:y,scripts:$,type:G})=>{let v=await s();if(!v)throw Error("Failed to parse package.json: file is missing or invalid");let U={...v};if(G)U.type=G;if(v.devDependencies||y)U.devDependencies={...v.devDependencies,...y};if(v.dependencies||b)U.dependencies={...v.dependencies,...b};if(v.scripts||$)U.scripts={...v.scripts,...$};await Z("package.json",`${JSON.stringify(U,null,2)}
3
3
  `)},d0=/^[a-z][a-z0-9-]*$/u,S=(b)=>{if(!d0.test(b))throw Error(`Invalid framework name "${b}": must match ${d0}`);return b},q=["biome.json","biome.jsonc",".biome.json",".biome.jsonc"],M=["eslint.config.mjs","eslint.config.js","eslint.config.cjs","eslint.config.ts","eslint.config.mts","eslint.config.cts"],D0=[".eslintrc",".eslintrc.json",".eslintrc.js",".eslintrc.cjs",".eslintrc.yaml",".eslintrc.yml"],C=[".prettierrc.mjs","prettier.config.mjs",".prettierrc.mts","prettier.config.mts",".prettierrc.cjs","prettier.config.cjs",".prettierrc.cts","prettier.config.cts",".prettierrc.js","prettier.config.js",".prettierrc.ts","prettier.config.ts",".prettierrc",".prettierrc.json",".prettierrc.json5",".prettierrc.yml",".prettierrc.yaml",".prettierrc.toml"],i=[".stylelintrc.mjs","stylelint.config.mjs",".stylelintrc.cjs","stylelint.config.cjs",".stylelintrc.js","stylelint.config.js",".stylelintrc",".stylelintrc.json",".stylelintrc.yml",".stylelintrc.yaml"],g1=[".oxlintrc.json","oxlint.config.ts"],N0=["oxfmt.config.ts"],kb={"@angular/core":["angular"],"@builder.io/qwik":["qwik"],"@nestjs/core":["nestjs"],"@qwik.dev/core":["qwik"],"@remix-run/node":["remix"],"@remix-run/react":["react","remix"],"@tanstack/react-query":["react","tanstack"],"@tanstack/react-router":["react","tanstack"],"@tanstack/react-start":["react","tanstack"],astro:["astro"],jest:["jest"],next:["react","next"],nuxt:["vue"],react:["react"],"react-router":["react","remix"],"solid-js":["solid"],svelte:["svelte"],vitest:["vitest"],vue:["vue"]},J0=(b)=>{if(!b)return[];return[...Object.keys(b.dependencies??{}),...Object.keys(b.devDependencies??{}),...Object.keys(b.peerDependencies??{})]},sb=async(b)=>{let y=new Set,$=b?.workspaces;if(Array.isArray($))for(let G of $)y.add(G);else if($&&typeof $==="object"){let{packages:G}=$;if(Array.isArray(G)){for(let v of G)if(typeof v==="string")y.add(v)}}if(H(i1))try{let G=await Pb(i1,"utf-8"),v=lb.parse(G);if(Array.isArray(v?.packages)){for(let U of v.packages)if(typeof U==="string")y.add(U)}}catch{}return[...y]},L0=async()=>{let b=new Set;try{let y=await s(),$=new Set(J0(y)),G=await sb(y);if(G.length>0){let v=await Mb(G.map((Q)=>`${Q.replace(/\/+$/u,"")}/package.json`),{absolute:!1,ignore:["**/node_modules/**"]}),U=await Promise.all(v.map((Q)=>s(Q)));for(let Q of U)for(let W of J0(Q))$.add(W)}for(let v of $){let U=kb[v];if(U)for(let Q of U)b.add(Q)}}catch{}return[...b]},t=(b=C1.cwd())=>{let y=b;while(!0){for(let G of q)if(H(D.join(y,G)))return"biome";for(let G of M)if(H(D.join(y,G)))return"eslint";for(let G of g1)if(H(D.join(y,G)))return"oxlint";let $=D.dirname(y);if($===y)break;y=$}return null};var Cb=(b,y)=>{let $=["check","--no-errors-on-unmatched",...y];if(b.length>0)$.push(...b);else $.push("./");let G=j("biome",$,{stdio:"inherit"});d("Biome",G)},ib=(b,y)=>{let $=[...y,...b.length>0?b:["."]],G=j("eslint",$,{stdio:"inherit"});d("ESLint",G)},tb=(b,y)=>{let $=["--check",...y,...b.length>0?b:["."]],G=j("prettier",$,{stdio:"inherit"});d("Prettier",G)},gb=(b,y)=>{let $=x1(b);if($.length===0)return;let G=[...y,"--allow-empty-input",...$],v=j("stylelint",G,{stdio:"inherit"});d("Stylelint",v)},ab=(b,y)=>{let $=[...y,...b.length>0?b:["."]],G=j("oxlint",$,{stdio:"inherit"});d("Oxlint",G)},eb=(b,y)=>{let $=["--check",...y,...b.length>0?b:["."]],G=j("oxfmt",$,{stdio:"inherit"});d("oxfmt",G)},x0=(b=[],y=[])=>{let $=t(),G=L1(b);if(!$)throw Error("No linter configuration found. Run `ultracite init` to set up a linter.");switch($){case"eslint":{n([()=>tb(G,[]),()=>ib(G,y),()=>gb(G,[])]);break}case"oxlint":{n([()=>eb(G,[]),()=>ab(G,y)]);break}default:Cb(G,y)}};import{existsSync as m,readFileSync as m1}from"node:fs";import _ from"node:path";import F from"node:process";import{intro as by,log as I,outro as R1,spinner as yy}from"@clack/prompts";import{parse as $y}from"jsonc-parser";var U1="Biome configuration",Q1="ESLint configuration",a1="Prettier configuration",e1="Stylelint configuration",W1="Oxlint configuration",Z1="oxfmt configuration",z1="Ultracite dependency",b0="Conflicting tools",I1="Doctor complete",g=(b,y)=>{let $=j(b,["--version"],{encoding:"utf-8"});if($.status===0&&$.stdout)return{message:`${b} is installed (${String($.stdout).trim()})`,name:`${b} installation`,status:"pass"};return{message:`${b} is not installed${y?"":" (optional)"}`,name:`${b} installation`,status:y?"fail":"warn"}},Gy=()=>{let b=null,y=null;for(let $ of q){let G=_.join(F.cwd(),$);if(m(G)){b=G,y=$;break}}if(!b)return{message:`No Biome config file found (expected one of: ${q.join(", ")})`,name:U1,status:"fail"};try{let $=m1(b,"utf-8"),G=$y($);if(Array.isArray(G?.extends)&&G.extends.includes("ultracite/biome/core"))return{message:`${y} extends ultracite/biome/core`,name:U1,status:"pass"};return{message:`${y} exists but doesn't extend ultracite/biome/core`,name:U1,status:"warn"}}catch{return{message:`Could not parse ${y} file`,name:U1,status:"fail"}}},vy=()=>{let b=null;for(let y of M){let $=_.join(F.cwd(),y);if(m($)){b=$;break}}if(!b)return{message:"No eslint.config.* file found",name:Q1,status:"fail"};try{if(m1(b,"utf-8").includes("ultracite/eslint"))return{message:"eslint.config.* imports ultracite/eslint",name:Q1,status:"pass"};return{message:"eslint.config.* exists but doesn't import ultracite/eslint",name:Q1,status:"warn"}}catch{return{message:"Could not read eslint.config.* file",name:Q1,status:"fail"}}},Uy=()=>{for(let b of C)if(m(_.join(F.cwd(),b)))return{message:`Prettier configuration found (${b})`,name:a1,status:"pass"};return{message:"No Prettier configuration found",name:a1,status:"fail"}},Qy=()=>{for(let b of i)if(m(_.join(F.cwd(),b)))return{message:`Stylelint configuration found (${b})`,name:e1,status:"pass"};return{message:"No Stylelint configuration found",name:e1,status:"warn"}},Wy=()=>{let b=_.join(F.cwd(),"oxlint.config.ts");if(!m(b))return{message:"No oxlint.config.ts file found",name:W1,status:"fail"};try{if(m1(b,"utf-8").includes("ultracite/oxlint/"))return{message:"oxlint.config.ts extends ultracite oxlint config",name:W1,status:"pass"};return{message:"oxlint.config.ts exists but doesn't extend ultracite config",name:W1,status:"warn"}}catch{return{message:"Could not read oxlint.config.ts file",name:W1,status:"fail"}}},Zy=()=>{let b=_.join(F.cwd(),"oxfmt.config.ts");if(!m(b))return{message:"No oxfmt.config.ts file found",name:Z1,status:"fail"};try{if(m1(b,"utf-8").includes("ultracite/oxfmt"))return{message:"oxfmt.config.ts extends ultracite oxfmt config",name:Z1,status:"pass"};return{message:"oxfmt.config.ts exists but doesn't extend ultracite config",name:Z1,status:"warn"}}catch{return{message:"Could not read oxfmt.config.ts file",name:Z1,status:"fail"}}},zy=()=>{let b=_.join(F.cwd(),"package.json");if(!m(b))return{message:"No package.json found",name:z1,status:"warn"};let y=p(b);if(!y)return{message:"Could not parse package.json",name:z1,status:"warn"};let $=y.dependencies?.ultracite||y.devDependencies?.ultracite||y.peerDependencies?.ultracite;if($)return{message:`Ultracite is in package.json (${$})`,name:z1,status:"pass"};return{message:"Ultracite not found in package.json dependencies",name:z1,status:"warn"}},Yy=(b)=>{let y=[];if(b!=="eslint"){if([".prettierrc",".prettierrc.js",".prettierrc.cjs",".prettierrc.mjs",".prettierrc.json",".prettierrc.yaml",".prettierrc.yml","prettier.config.js","prettier.config.mjs","prettier.config.cjs"].some((v)=>m(_.join(F.cwd(),v))))y.push("Prettier")}if([".eslintrc",".eslintrc.js",".eslintrc.cjs",".eslintrc.mjs",".eslintrc.json",".eslintrc.yaml",".eslintrc.yml"].some((G)=>m(_.join(F.cwd(),G))))y.push("ESLint (legacy config)");if(y.length>0)return{message:`Found potentially conflicting tools: ${y.join(", ")}`,name:b0,status:"warn"};return{message:"No conflicting formatting/linting tools found",name:b0,status:"pass"}},Hy=(b)=>{let y=[];switch(b){case"biome":{y.push({fn:()=>g("biome",!0),name:"Biome installation"},{fn:Gy,name:U1});break}case"eslint":{y.push({fn:()=>g("eslint",!0),name:"ESLint installation"},{fn:vy,name:Q1},{fn:()=>g("prettier",!0),name:"Prettier installation"},{fn:Uy,name:a1},{fn:()=>g("stylelint",!1),name:"Stylelint installation"},{fn:Qy,name:e1});break}case"oxlint":{y.push({fn:()=>g("oxlint",!0),name:"Oxlint installation"},{fn:Wy,name:W1},{fn:()=>g("oxfmt",!0),name:"oxfmt installation"},{fn:Zy,name:Z1});break}default:break}return y.push({fn:zy,name:z1},{fn:()=>Yy(b),name:b0}),y},S0=()=>{by(`Ultracite v${z.version} Doctor`);let b=t();if(!b)throw I.error("No linter configuration found. Run `ultracite init` to set up a linter."),R1(I1),Error("Doctor checks failed");I.info(`Detected linter: ${b}`);let y=yy();y.start("Running diagnostics...");let G=Hy(b).map(({fn:W})=>W());y.stop("Diagnostics complete.");for(let W of G)if(W.status==="pass")I.success(W.message);else if(W.status==="warn")I.warn(W.message);else I.error(W.message);let v=G.filter((W)=>W.status==="pass").length,U=G.filter((W)=>W.status==="fail").length,Q=G.filter((W)=>W.status==="warn").length;if(I.info(`Summary: ${v} passed, ${Q} warnings, ${U} failed`),U>0)throw I.error("Some checks failed. Run 'ultracite init' to fix issues."),R1(I1),Error("Doctor checks failed");if(Q>0){I.warn("Some optional improvements available. Run 'ultracite init' to configure."),R1(I1);return}I.success("Everything looks good!"),R1(I1)};var oy=(b,y)=>{let $=["check","--write","--no-errors-on-unmatched",...y];if(b.length>0)$.push(...b);else $.push("./");let G=j("biome",$,{stdio:"inherit"});d("Biome",G)},Vy=(b,y)=>{let $=["--fix",...y,...b.length>0?b:["."]],G=j("eslint",$,{stdio:"inherit"});d("ESLint",G)},By=(b,y)=>{let $=["--write",...y,...b.length>0?b:["."]],G=j("prettier",$,{stdio:"inherit"});d("Prettier",G)},Xy=(b,y)=>{let $=x1(b);if($.length===0)return;let G=["--fix",...y,"--allow-empty-input",...$],v=j("stylelint",G,{stdio:"inherit"});d("Stylelint",v)},jy=(b,y)=>{let $=y.includes("--unsafe"),G=y.filter((Q)=>Q!=="--unsafe"),v=[$?"--fix-dangerously":"--fix",...G,...b.length>0?b:["."]],U=j("oxlint",v,{stdio:"inherit"});d("Oxlint",U)},Ky=(b,y)=>{let $=["--write",...y,...b.length>0?b:["."]],G=j("oxfmt",$,{stdio:"inherit"});d("oxfmt",G)},R0=(b,y=[])=>{let $=t(),G=L1(b);if(!$)throw Error("No linter configuration found. Run `ultracite init` to set up a linter.");switch($){case"eslint":{n([()=>By(G,[]),()=>Vy(G,y),()=>Xy(G,[])]);break}case"oxlint":{n([()=>Ky(G,[]),()=>jy(G,y)]);break}default:oy(G,y)}};import c2 from"node:process";import{cancel as y1,intro as q2,isCancel as $1,log as d1,multiselect as J1,select as P2,spinner as w}from"@clack/prompts";import{addDevDependency as f2,detectPackageManager as M2}from"nypm";import{readFile as Ay}from"node:fs/promises";import{dlxCommand as wy}from"nypm";var y0=(b,y)=>`# Ultracite Code Standards
4
4
 
5
5
  This project uses **Ultracite**, a zero-config preset that enforces strict code quality standards through automated formatting and linting.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ultracite",
3
- "version": "7.9.1",
3
+ "version": "7.9.2",
4
4
  "description": "The AI-ready formatter that helps you write and generate code faster.",
5
5
  "keywords": [
6
6
  "biome",