ultracite 5.3.0 → 5.3.1

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 (2) hide show
  1. package/dist/index.js +94 -26
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- var V=Object.defineProperty;var Ze=Object.getOwnPropertyDescriptor;var Qe=Object.getOwnPropertyNames;var et=Object.prototype.hasOwnProperty;var H=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,s)=>(typeof require<"u"?require:t)[s]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),ce=e=>t=>{var s=e[t];if(s)return s();throw new Error("Module not found in bundle: "+t)};var j=(e,t)=>()=>(e&&(t=e(e=0)),t);var K=(e,t)=>{for(var s in t)V(e,s,{get:t[s],enumerable:!0})},tt=(e,t,s,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Qe(t))!et.call(e,o)&&o!==s&&V(e,o,{get:()=>t[o],enumerable:!(n=Ze(t,o))||n.enumerable});return e};var X=e=>tt(V({},"__esModule",{value:!0}),e);import{access as nt,readFile as le,writeFile as ot}from"fs/promises";import{parse as it}from"jsonc-parser";var a,g,ue,C,at,rt,U,p=j(()=>{"use strict";a=async e=>{try{return await nt(e),!0}catch{return!1}},g=async()=>{if(await a("pnpm-workspace.yaml"))return!0;try{let e=it(await le("package.json","utf-8"));return e?!!e.workspaces||!!e.workspace:!1}catch{return!1}},ue=`
2
+ var H=Object.defineProperty;var Qe=Object.getOwnPropertyDescriptor;var et=Object.getOwnPropertyNames;var tt=Object.prototype.hasOwnProperty;var V=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,s)=>(typeof require<"u"?require:t)[s]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),ce=e=>t=>{var s=e[t];if(s)return s();throw new Error("Module not found in bundle: "+t)};var j=(e,t)=>()=>(e&&(t=e(e=0)),t);var X=(e,t)=>{for(var s in t)H(e,s,{get:t[s],enumerable:!0})},st=(e,t,s,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of et(t))!tt.call(e,o)&&o!==s&&H(e,o,{get:()=>t[o],enumerable:!(n=Qe(t,o))||n.enumerable});return e};var Y=e=>st(H({},"__esModule",{value:!0}),e);import{access as ot,readFile as le,writeFile as it}from"fs/promises";import{parse as at}from"jsonc-parser";var a,g,de,C,rt,ct,F,p=j(()=>{"use strict";a=async e=>{try{return await ot(e),!0}catch{return!1}},g=async()=>{if(await a("pnpm-workspace.yaml"))return!0;try{let e=at(await le("package.json","utf-8"));return e?!!e.workspaces||!!e.workspace:!1}catch{return!1}},de=`
3
3
  888 888 888 88888888888 8888888b. d8888 .d8888b. 8888888 88888888888 8888888888
4
4
  888 888 888 888 888 Y88b d88888 d88P Y88b 888 888 888
5
5
  888 888 888 888 888 888 d88P888 888 888 888 888 888
@@ -8,10 +8,78 @@ var V=Object.defineProperty;var Ze=Object.getOwnPropertyDescriptor;var Qe=Object
8
8
  888 888 888 888 888 T88b d88P 888 888 888 888 888 888
9
9
  Y88b. .d88P 888 888 888 T88b d8888888888 Y88b d88P 888 888 888
10
10
  "Y88888P" 88888888 888 888 T88b d88P 888 "Y8888P" 8888888 888 8888888888
11
- `,C=async({dependencies:e,devDependencies:t})=>{let s=await le("package.json","utf8"),n=JSON.parse(s),o={...n,devDependencies:{...n.devDependencies,...t},dependencies:{...n.dependencies,...e}};await ot("package.json",JSON.stringify(o,null,2))},at=/[ $(){}[\]&|;<>!"'`*?#~]/,rt=/'/g,U=e=>e.map(t=>at.test(t)?`'${t.replace(rt,"'\\''")}' `:t)});var Je={};K(Je,{husky:()=>v});import{mkdir as Vt,readFile as Ht,writeFile as Oe}from"fs/promises";import{addDevDependency as Kt,dlxCommand as Te}from"nypm";var z,v,se=j(()=>{"use strict";p();z="./.husky/pre-commit",v={exists:()=>a(z),install:async e=>{await Kt("husky",{packageManager:e,workspace:await g()})},create:async e=>{await Vt(".husky",{recursive:!0});let t=Te(e,"ultracite",{args:["fix"],short:e==="npm"});await Oe(z,t)},update:async e=>{let t=await Ht(z,"utf-8"),s=Te(e,"ultracite",{args:["fix"],short:e==="npm"});await Oe(z,`${t}
12
- ${s}`)}}});var Be={};K(Be,{lefthook:()=>x});import{execSync as Xt}from"child_process";import{readFile as Yt,writeFile as N}from"fs/promises";import{addDevDependency as Zt,dlxCommand as ze}from"nypm";var Qt,es,Le,y,_e,x,ne=j(()=>{"use strict";p();Qt=/(pre-commit:\s*\n\s*jobs:\s*\n)/,es=/(pre-commit:\s*\n)/,Le=e=>ze(e,"ultracite",{args:["fix"],short:e==="npm"}),y="./lefthook.yml",_e=e=>`pre-commit:
11
+ `,C=async({dependencies:e,devDependencies:t})=>{let s=await le("package.json","utf8"),n=JSON.parse(s),o={...n,devDependencies:{...n.devDependencies,...t},dependencies:{...n.dependencies,...e}};await it("package.json",JSON.stringify(o,null,2))},rt=/[ $(){}[\]&|;<>!"'`*?#~]/,ct=/'/g,F=e=>e.map(t=>rt.test(t)?`'${t.replace(ct,"'\\''")}' `:t)});var Je={};X(Je,{husky:()=>v});import{mkdir as Vt,readFile as Xt,writeFile as Te}from"fs/promises";import{addDevDependency as Yt,dlxCommand as Oe}from"nypm";var _e,L,v,se=j(()=>{"use strict";p();_e=e=>`#!/bin/sh
12
+ # Exit on any error
13
+ set -e
14
+
15
+ # Check if there are any staged files
16
+ if [ -z "$(git diff --cached --name-only)" ]; then
17
+ echo "No staged files to format"
18
+ exit 0
19
+ fi
20
+
21
+ # Store the hash of staged changes to detect modifications
22
+ STAGED_HASH=$(git diff --cached | sha256sum | cut -d' ' -f1)
23
+
24
+ # Save list of staged files (handling all file states)
25
+ STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACMR)
26
+ PARTIALLY_STAGED=$(git diff --name-only)
27
+
28
+ # Stash unstaged changes to preserve working directory
29
+ # --keep-index keeps staged changes in working tree
30
+ git stash push --quiet --keep-index --message "pre-commit-stash" || true
31
+ STASHED=$?
32
+
33
+ # Run formatter on the staged files
34
+ ${e}
35
+ FORMAT_EXIT_CODE=$?
36
+
37
+ # Restore working directory state
38
+ if [ $STASHED -eq 0 ]; then
39
+ # Re-stage the formatted files
40
+ if [ -n "$STAGED_FILES" ]; then
41
+ echo "$STAGED_FILES" | while IFS= read -r file; do
42
+ if [ -f "$file" ]; then
43
+ git add "$file"
44
+ fi
45
+ done
46
+ fi
47
+
48
+ # Restore unstaged changes
49
+ git stash pop --quiet || true
50
+
51
+ # Restore partial staging if files were partially staged
52
+ if [ -n "$PARTIALLY_STAGED" ]; then
53
+ for file in $PARTIALLY_STAGED; do
54
+ if [ -f "$file" ] && echo "$STAGED_FILES" | grep -q "^$file$"; then
55
+ # File was partially staged - need to unstage the unstaged parts
56
+ git restore --staged "$file" 2>/dev/null || true
57
+ git add -p "$file" < /dev/null 2>/dev/null || git add "$file"
58
+ fi
59
+ done
60
+ fi
61
+ else
62
+ # No stash was created, just re-add the formatted files
63
+ if [ -n "$STAGED_FILES" ]; then
64
+ echo "$STAGED_FILES" | while IFS= read -r file; do
65
+ if [ -f "$file" ]; then
66
+ git add "$file"
67
+ fi
68
+ done
69
+ fi
70
+ fi
71
+
72
+ # Check if staged files actually changed
73
+ NEW_STAGED_HASH=$(git diff --cached | sha256sum | cut -d' ' -f1)
74
+ if [ "$STAGED_HASH" != "$NEW_STAGED_HASH" ]; then
75
+ echo "\u2728 Files formatted by Ultracite"
76
+ fi
77
+
78
+ exit $FORMAT_EXIT_CODE
79
+ `,L="./.husky/pre-commit",v={exists:()=>a(L),install:async e=>{await Yt("husky",{packageManager:e,workspace:await g()})},create:async e=>{await Vt(".husky",{recursive:!0});let t=Oe(e,"ultracite",{args:["fix"],short:e==="npm"}),s=_e(t);await Te(L,s)},update:async e=>{let t=await Xt(L,"utf-8"),s=Oe(e,"ultracite",{args:["fix"],short:e==="npm"}),n=_e(s);await Te(L,`${t}
80
+ ${n}`)}}});var We={};X(We,{lefthook:()=>x});import{execSync as Kt}from"child_process";import{readFile as Zt,writeFile as E}from"fs/promises";import{addDevDependency as Qt,dlxCommand as ze}from"nypm";var es,ts,Be,y,Le,x,ne=j(()=>{"use strict";p();es=/(pre-commit:\s*\n\s*jobs:\s*\n)/,ts=/(pre-commit:\s*\n)/,Be=e=>ze(e,"ultracite",{args:["fix"],short:e==="npm"}),y="./lefthook.yml",Le=e=>`pre-commit:
13
81
  jobs:
14
- - run: ${Le(e)}
82
+ - run: ${Be(e)}
15
83
  glob:
16
84
  - "*.js"
17
85
  - "*.jsx"
@@ -21,7 +89,7 @@ ${s}`)}}});var Be={};K(Be,{lefthook:()=>x});import{execSync as Xt}from"child_pro
21
89
  - "*.jsonc"
22
90
  - "*.css"
23
91
  stage_fixed: true
24
- `,x={exists:()=>a(y),install:async e=>{await Zt("lefthook",{packageManager:e,workspace:await g()});let t=ze(e,"lefthook",{args:["install"],short:e==="npm"});Xt(t)},create:async e=>{let t=_e(e);await N(y,t)},update:async e=>{let t=await Yt(y,"utf-8"),s=Le(e),n=_e(e);if(t.includes(s))return;if(t.startsWith("# EXAMPLE USAGE:")){await N(y,n);return}if(t.includes("pre-commit:"))if(t.includes("jobs:")){let i=` - run: ${s}
92
+ `,x={exists:()=>a(y),install:async e=>{await Qt("lefthook",{packageManager:e,workspace:await g()});let t=ze(e,"lefthook",{args:["install"],short:e==="npm"});Kt(t)},create:async e=>{let t=Le(e);await E(y,t)},update:async e=>{let t=await Zt(y,"utf-8"),s=Be(e),n=Le(e);if(t.includes(s))return;if(t.startsWith("# EXAMPLE USAGE:")){await E(y,n);return}if(t.includes("pre-commit:"))if(t.includes("jobs:")){let i=` - run: ${s}
25
93
  glob:
26
94
  - "*.js"
27
95
  - "*.jsx"
@@ -30,8 +98,8 @@ ${s}`)}}});var Be={};K(Be,{lefthook:()=>x});import{execSync as Xt}from"child_pro
30
98
  - "*.json"
31
99
  - "*.jsonc"
32
100
  - "*.css"
33
- stage_fixed: true`,r=t.replace(Qt,`$1${i}
34
- `);await N(y,r)}else{let i=` jobs:
101
+ stage_fixed: true`,r=t.replace(es,`$1${i}
102
+ `);await E(y,r)}else{let i=` jobs:
35
103
  - run: ${s}
36
104
  glob:
37
105
  - "*.js"
@@ -41,20 +109,20 @@ ${s}`)}}});var Be={};K(Be,{lefthook:()=>x});import{execSync as Xt}from"child_pro
41
109
  - "*.json"
42
110
  - "*.jsonc"
43
111
  - "*.css"
44
- stage_fixed: true`,r=t.replace(es,`$1${i}
45
- `);await N(y,r)}else await N(y,`${t}
46
- ${n}`)}}});var ts,oe=j(()=>{ts=ce({"./husky.ts":()=>(se(),X(Je)),"./lefthook.ts":()=>(ne(),X(Be)),"./lint-staged.ts":()=>(ie(),X(We))})});var We={};K(We,{lintStaged:()=>D});import{readFile as L,writeFile as w}from"fs/promises";import{pathToFileURL as ss}from"url";import F from"deepmerge";import{parse as re}from"jsonc-parser";import{addDevDependency as ns,dlxCommand as os}from"nypm";var h,qe,is,as,rs,cs,ls,us,ds,ps,ms,ae,fs,D,ie=j(()=>{"use strict";p();oe();h=e=>({"*.{js,jsx,ts,tsx,json,jsonc,css,scss,md,mdx}":[os(e,"ultracite",{args:["fix"],short:e==="npm"})]}),qe=["./package.json","./.lintstagedrc.json","./.lintstagedrc.js","./.lintstagedrc.cjs","./.lintstagedrc.mjs","./lint-staged.config.js","./lint-staged.config.cjs","./lint-staged.config.mjs","./.lintstagedrc.yaml","./.lintstagedrc.yml","./.lintstagedrc"],is=(e,t,s,n)=>{let o=e.trim();if(o.includes(":")&&!o.startsWith("-")){s&&n.length>0&&(t[s]=n);let[i,...r]=o.split(":"),l=r.join(":").trim(),u=i.trim().replace(/['"]/g,"");return l&&l!==""?(l.startsWith("[")&&l.endsWith("]")?t[u]=l.slice(1,-1).split(",").map(d=>d.trim().replace(/['"]/g,"")):t[u]=l.replace(/['"]/g,""),{newCurrentKey:null,newCurrentArray:[]}):{newCurrentKey:u,newCurrentArray:[]}}if(o.startsWith("-")&&s){let i=[...n,o.slice(1).trim().replace(/['"]/g,"")];return{newCurrentKey:s,newCurrentArray:i}}return{newCurrentKey:s,newCurrentArray:n}},as=e=>{let t=e.split(`
47
- `).filter(i=>i.trim()&&!i.trim().startsWith("#")),s={},n=null,o=[];for(let i of t){let r=is(i,s,n,o);n=r.newCurrentKey,o=r.newCurrentArray}return n&&o.length>0&&(s[n]=o),s},rs=e=>{let t="";for(let[s,n]of Object.entries(e))if(Array.isArray(n)){t+=`${s}:
112
+ stage_fixed: true`,r=t.replace(ts,`$1${i}
113
+ `);await E(y,r)}else await E(y,`${t}
114
+ ${n}`)}}});var ss,oe=j(()=>{ss=ce({"./husky.ts":()=>(se(),Y(Je)),"./lefthook.ts":()=>(ne(),Y(We)),"./lint-staged.ts":()=>(ie(),Y(qe))})});var qe={};X(qe,{lintStaged:()=>D});import{readFile as z,writeFile as w}from"fs/promises";import{pathToFileURL as ns}from"url";import $ from"deepmerge";import{parse as re}from"jsonc-parser";import{addDevDependency as os,dlxCommand as is}from"nypm";var h,Ge,as,rs,cs,ls,ds,us,ps,ms,fs,ae,gs,D,ie=j(()=>{"use strict";p();oe();h=e=>({"*.{js,jsx,ts,tsx,json,jsonc,css,scss,md,mdx}":[is(e,"ultracite",{args:["fix"],short:e==="npm"})]}),Ge=["./package.json","./.lintstagedrc.json","./.lintstagedrc.js","./.lintstagedrc.cjs","./.lintstagedrc.mjs","./lint-staged.config.js","./lint-staged.config.cjs","./lint-staged.config.mjs","./.lintstagedrc.yaml","./.lintstagedrc.yml","./.lintstagedrc"],as=(e,t,s,n)=>{let o=e.trim();if(o.includes(":")&&!o.startsWith("-")){s&&n.length>0&&(t[s]=n);let[i,...r]=o.split(":"),l=r.join(":").trim(),d=i.trim().replace(/['"]/g,"");return l&&l!==""?(l.startsWith("[")&&l.endsWith("]")?t[d]=l.slice(1,-1).split(",").map(u=>u.trim().replace(/['"]/g,"")):t[d]=l.replace(/['"]/g,""),{newCurrentKey:null,newCurrentArray:[]}):{newCurrentKey:d,newCurrentArray:[]}}if(o.startsWith("-")&&s){let i=[...n,o.slice(1).trim().replace(/['"]/g,"")];return{newCurrentKey:s,newCurrentArray:i}}return{newCurrentKey:s,newCurrentArray:n}},rs=e=>{let t=e.split(`
115
+ `).filter(i=>i.trim()&&!i.trim().startsWith("#")),s={},n=null,o=[];for(let i of t){let r=as(i,s,n,o);n=r.newCurrentKey,o=r.newCurrentArray}return n&&o.length>0&&(s[n]=o),s},cs=e=>{let t="";for(let[s,n]of Object.entries(e))if(Array.isArray(n)){t+=`${s}:
48
116
  `;for(let o of n)t+=` - '${o}'
49
117
  `}else t+=`${s}: '${n}'
50
- `;return t},cs=async()=>{try{let e=re(await L("./package.json","utf-8"));return e?e.type==="module":!1}catch{return!1}},ls=async e=>{let t=re(await L("./package.json","utf-8"));t&&(t["lint-staged"]?t["lint-staged"]=F(t["lint-staged"],h(e)):t["lint-staged"]=h(e),await w("./package.json",JSON.stringify(t,null,2)))},us=async(e,t)=>{let s=await L(e,"utf-8"),n=re(s);if(!n)return;let o=F(n,h(t));await w(e,JSON.stringify(o,null,2))},ds=async(e,t)=>{let s=await L(e,"utf-8"),n=as(s);if(!n)return;let o=F(n,h(t));await w(e,rs(o))},ps=async(e,t)=>{let o=(await import(ss(e).href)).default||{},i=F(o,h(t)),r=`export default ${JSON.stringify(i,null,2)};
51
- `;await w(e,r)},ms=async(e,t)=>{delete H.cache[H.resolve(`./${e}`)];let s=ts(`./${e}`),n=F(s,h(t)),o=`module.exports = ${JSON.stringify(n,null,2)};
52
- `;await w(e,o)},ae=async e=>{await w(".lintstagedrc.json",JSON.stringify(h(e),null,2))},fs=async(e,t)=>{if(e==="./package.json"){await ls(t);return}if(e.endsWith(".json")||e==="./.lintstagedrc"){await us(e,t);return}if(e.endsWith(".yaml")||e.endsWith(".yml")){await ds(e,t);return}let s=await cs();if(e.endsWith(".mjs")||e.endsWith(".js")&&s){try{await ps(e,t)}catch{await ae(t)}return}if(e.endsWith(".cjs")||e.endsWith(".js")&&!s)try{await ms(e,t)}catch{await ae(t)}},D={exists:async()=>{for(let e of qe)if(await a(e))return!0;return!1},install:async e=>{await ns("lint-staged",{packageManager:e,workspace:await g()})},create:async e=>{await w(".lintstagedrc.json",JSON.stringify(h(e),null,2))},update:async e=>{let t=null;for(let s of qe)if(await a(s)){t=s;break}if(!t){await ae(e);return}await fs(t,e)}}});import{createCli as Fs,trpcServer as Us}from"trpc-cli";import c from"zod";var f={name:"ultracite",description:"The AI-ready formatter that helps you write and generate code faster.",version:"5.2.17",type:"module",bin:{ultracite:"dist/index.js"},files:["biome.jsonc","dist"],scripts:{build:"tsup",test:"vitest run","test:coverage":"vitest --coverage"},main:"./biome.jsonc",author:"Hayden Bleasel <hello@haydenbleasel.com>",bugs:{url:"https://github.com/haydenbleasel/ultracite/issues"},homepage:"https://github.com/haydenbleasel/ultracite#readme",keywords:["ultracite","biome","linter","formatter","fixer"],license:"MIT",publishConfig:{access:"public",registry:"https://registry.npmjs.org/"},repository:{type:"git",url:"git+https://github.com/haydenbleasel/ultracite.git"},devDependencies:{"@auto-it/all-contributors":"^11.3.0","@auto-it/first-time-contributor":"^11.3.0","@biomejs/biome":"2.2.2","@types/node":"^24.3.0","@vitest/coverage-v8":"3.2.4",tsup:"^8.5.0"},dependencies:{"@clack/prompts":"^0.11.0",deepmerge:"^4.3.1","jsonc-parser":"^3.3.1",nypm:"^0.6.1","trpc-cli":"^0.10.2",vitest:"^3.2.4",zod:"^4.1.5"},packageManager:"pnpm@10.15.0"};p();import{spawnSync as ct}from"child_process";import de from"process";var Y=e=>{let t=["npx","@biomejs/biome","check"];e.length>0?t.push(...U(e)):t.push("./");let s=t.join(" "),n=ct(s,{stdio:"inherit",shell:!0});n.error&&(console.error("Failed to run Ultracite:",n.error.message),de.exit(1)),n.status!==0&&de.exit(n.status??1)};import{spawnSync as Dt}from"child_process";import{existsSync as P}from"fs";import{readFile as we}from"fs/promises";import{join as S}from"path";import{parse as jt}from"jsonc-parser";p();import{readFile as pe,unlink as lt,writeFile as ut}from"fs/promises";import{parse as me}from"jsonc-parser";import{removeDependency as dt}from"nypm";var E=[".eslintrc",".eslintrc.js",".eslintrc.json",".eslintrc.yml",".eslintrc.yaml",".eslintrc.config.js","eslint.config.js","eslint.config.mjs","eslint.config.cjs",".eslintignore"],fe=async()=>{try{let e=await pe("package.json","utf-8"),t=me(e);if(!t||typeof t!="object")return[];let s=t.dependencies||{},n=t.devDependencies||{},o={...s,...n};return Object.keys(o).filter(i=>i.startsWith("eslint")||i.startsWith("@eslint/")||i==="@typescript-eslint/parser"||i==="@typescript-eslint/eslint-plugin")}catch{return[]}},pt=async(e,t)=>{if(t.length!==0)try{for(let s of t)await dt(s,{packageManager:e})}catch(s){console.warn(s)}},mt=async()=>{let e=[];for(let t of E)if(await a(t))try{await lt(t),e.push(t)}catch(s){console.warn(s)}return e},ft=async()=>{let e="./.vscode/settings.json";if(!await a(e))return!1;try{let t=await pe(e,"utf-8"),s=me(t);if(!s||typeof s!="object")return!1;let n=!1,o={...s},i=["eslint.enable","eslint.format.enable","eslint.validate","eslint.workingDirectories","eslint.codeAction.showDocumentation","eslint.run","eslint.autoFixOnSave","eslint.quiet","eslint.packageManager","eslint.options","eslint.trace.server"];for(let r of i)r in o&&(delete o[r],n=!0);if("editor.codeActionsOnSave"in o){let r=o["editor.codeActionsOnSave"];if(r&&typeof r=="object"){let l=["source.fixAll.eslint","source.organizeImports.eslint"];for(let u of l)u in r&&(delete r[u],n=!0);Object.keys(r).length===0&&(o["editor.codeActionsOnSave"]=void 0)}}return n?(await ut(e,JSON.stringify(o,null,2)),!0):!1}catch(t){return console.warn(t),!1}},gt=async()=>{if((await fe()).length>0)return!0;for(let t of E)if(await a(t))return!0;return!1},Z={hasESLint:gt,remove:async e=>{let t=await fe();pt(e,t);let s=await mt(),n=await ft();return{packagesRemoved:t,filesRemoved:s,vsCodeCleaned:n}}};p();import{readFile as ge,unlink as ht,writeFile as yt}from"fs/promises";import{parse as he}from"jsonc-parser";import{removeDependency as wt}from"nypm";var I=[".prettierrc",".prettierrc.js",".prettierrc.json",".prettierrc.yml",".prettierrc.yaml",".prettierrc.config.js","prettier.config.js","prettier.config.mjs",".prettierignore"],ye=async()=>{try{let e=await ge("package.json","utf-8"),t=he(e);if(!t||typeof t!="object")return[];let s=t.dependencies||{},n=t.devDependencies||{},o={...s,...n};return Object.keys(o).filter(i=>i.startsWith("prettier")||i==="eslint-config-prettier"||i==="eslint-plugin-prettier")}catch{return[]}},bt=async(e,t)=>{if(t.length!==0)try{for(let s of t)await wt(s,{packageManager:e})}catch(s){console.warn(s)}},kt=async()=>{let e=[];for(let t of I)if(await a(t))try{await ht(t),e.push(t)}catch(s){console.warn(s)}return e},vt=async()=>{let e="./.vscode/settings.json";if(!await a(e))return!1;try{let t=await ge(e,"utf-8"),s=he(t);if(!s||typeof s!="object")return!1;let n=!1,o={...s},i=["editor.defaultFormatter","prettier.enable","prettier.requireConfig","prettier.configPath","prettier.printWidth","prettier.tabWidth","prettier.useTabs","prettier.semi","prettier.singleQuote","prettier.quoteProps","prettier.trailingComma","prettier.bracketSpacing","prettier.arrowParens","prettier.endOfLine"];for(let l of i)l in o&&(l==="editor.defaultFormatter"&&o[l]==="esbenp.prettier-vscode"||l!=="editor.defaultFormatter")&&(delete o[l],n=!0);let r=Object.keys(o).filter(l=>l.startsWith("[")&&l.includes("javascript"));for(let l of r){let u=o[l];u&&typeof u=="object"&&"editor.defaultFormatter"in u&&u["editor.defaultFormatter"]==="esbenp.prettier-vscode"&&(u["editor.defaultFormatter"]=void 0,n=!0,Object.keys(u).length===0&&delete o[l])}return n?(await yt(e,JSON.stringify(o,null,2)),!0):!1}catch(t){return console.warn(t),!1}},xt=async()=>{if((await ye()).length>0)return!0;for(let t of I)if(await a(t))return!0;return!1},Q={hasPrettier:xt,remove:async e=>{let t=await ye();bt(e,t);let s=await kt(),n=await vt();return{packagesRemoved:t,filesRemoved:s,vsCodeCleaned:n}}};var Ct=()=>{let e=Dt("npx @biomejs/biome --version",{shell:!0,encoding:"utf-8"});return e.status===0&&e.stdout?{name:"Biome installation",status:"pass",message:`Biome is installed (${e.stdout.trim()})`}:{name:"Biome installation",status:"fail",message:"Biome is not installed or not accessible"}},Pt=async()=>{let e=S(process.cwd(),"biome.json"),t=S(process.cwd(),"biome.jsonc"),s=null;if(P(e)?s=e:P(t)&&(s=t),!s)return{name:"Biome configuration",status:"fail",message:"No biome.json or biome.jsonc file found"};try{let n=await we(s,"utf-8"),o=jt(n);return Array.isArray(o?.extends)&&o.extends.includes("ultracite")?{name:"Biome configuration",status:"pass",message:"biome.json(c) extends ultracite"}:{name:"Biome configuration",status:"warn",message:"biome.json(c) exists but doesn't extend ultracite"}}catch{return{name:"Biome configuration",status:"fail",message:"Could not parse biome.json(c) file"}}},St=async()=>{let e=S(process.cwd(),"package.json");if(!P(e))return{name:"Ultracite dependency",status:"warn",message:"No package.json found"};try{let t=JSON.parse(await we(e,"utf-8")),s=t.dependencies?.ultracite||t.devDependencies?.ultracite||t.peerDependencies?.ultracite;return s?{name:"Ultracite dependency",status:"pass",message:`Ultracite is in package.json (${s})`}:{name:"Ultracite dependency",status:"warn",message:"Ultracite not found in package.json dependencies"}}catch{return{name:"Ultracite dependency",status:"warn",message:"Could not parse package.json"}}},Rt=()=>{let e=I.some(s=>P(S(process.cwd(),s))),t=E.some(s=>P(S(process.cwd(),s)));if(e||t){let s=[];return e&&s.push("Prettier"),t&&s.push("ESLint"),{name:"Conflicting tools",status:"warn",message:`Found potentially conflicting tools: ${s.join(", ")}`}}return{name:"Conflicting tools",status:"pass",message:"No conflicting formatting/linting tools found"}},be=async()=>{let e=[];console.log(`\u{1FA7A} Running Ultracite doctor...
53
- `),e.push(Ct()),e.push(await Pt()),e.push(await St()),e.push(Rt());let t=e.filter(o=>o.status==="pass").length,s=e.filter(o=>o.status==="fail").length,n=e.filter(o=>o.status==="warn").length;for(let o of e){let i;o.status==="pass"?i="\u2705":o.status==="fail"?i="\u274C":i="\u26A0\uFE0F",console.log(`${i} ${o.name}: ${o.message}`)}console.log(`
118
+ `;return t},ls=async()=>{try{let e=re(await z("./package.json","utf-8"));return e?e.type==="module":!1}catch{return!1}},ds=async e=>{let t=re(await z("./package.json","utf-8"));t&&(t["lint-staged"]?t["lint-staged"]=$(t["lint-staged"],h(e)):t["lint-staged"]=h(e),await w("./package.json",JSON.stringify(t,null,2)))},us=async(e,t)=>{let s=await z(e,"utf-8"),n=re(s);if(!n)return;let o=$(n,h(t));await w(e,JSON.stringify(o,null,2))},ps=async(e,t)=>{let s=await z(e,"utf-8"),n=rs(s);if(!n)return;let o=$(n,h(t));await w(e,cs(o))},ms=async(e,t)=>{let o=(await import(ns(e).href)).default||{},i=$(o,h(t)),r=`export default ${JSON.stringify(i,null,2)};
119
+ `;await w(e,r)},fs=async(e,t)=>{delete V.cache[V.resolve(`./${e}`)];let s=ss(`./${e}`),n=$(s,h(t)),o=`module.exports = ${JSON.stringify(n,null,2)};
120
+ `;await w(e,o)},ae=async e=>{await w(".lintstagedrc.json",JSON.stringify(h(e),null,2))},gs=async(e,t)=>{if(e==="./package.json"){await ds(t);return}if(e.endsWith(".json")||e==="./.lintstagedrc"){await us(e,t);return}if(e.endsWith(".yaml")||e.endsWith(".yml")){await ps(e,t);return}let s=await ls();if(e.endsWith(".mjs")||e.endsWith(".js")&&s){try{await ms(e,t)}catch{await ae(t)}return}if(e.endsWith(".cjs")||e.endsWith(".js")&&!s)try{await fs(e,t)}catch{await ae(t)}},D={exists:async()=>{for(let e of Ge)if(await a(e))return!0;return!1},install:async e=>{await os("lint-staged",{packageManager:e,workspace:await g()})},create:async e=>{await w(".lintstagedrc.json",JSON.stringify(h(e),null,2))},update:async e=>{let t=null;for(let s of Ge)if(await a(s)){t=s;break}if(!t){await ae(e);return}await gs(t,e)}}});import{createCli as Fs,trpcServer as Ns}from"trpc-cli";import c from"zod";var f={name:"ultracite",description:"The AI-ready formatter that helps you write and generate code faster.",version:"5.3.0",type:"module",bin:{ultracite:"dist/index.js"},files:["biome.jsonc","dist"],scripts:{build:"tsup",test:"vitest run","test:coverage":"vitest --coverage"},main:"./biome.jsonc",author:"Hayden Bleasel <hello@haydenbleasel.com>",bugs:{url:"https://github.com/haydenbleasel/ultracite/issues"},homepage:"https://github.com/haydenbleasel/ultracite#readme",keywords:["ultracite","biome","linter","formatter","fixer"],license:"MIT",publishConfig:{access:"public",registry:"https://registry.npmjs.org/"},repository:{type:"git",url:"git+https://github.com/haydenbleasel/ultracite.git"},devDependencies:{"@auto-it/all-contributors":"^11.3.0","@auto-it/first-time-contributor":"^11.3.0","@biomejs/biome":"2.2.2","@types/node":"^24.3.0","@vitest/coverage-v8":"3.2.4",tsup:"^8.5.0"},dependencies:{"@clack/prompts":"^0.11.0",deepmerge:"^4.3.1","jsonc-parser":"^3.3.1",nypm:"^0.6.1","trpc-cli":"^0.10.2",vitest:"^3.2.4",zod:"^4.1.5"},packageManager:"pnpm@10.15.0"};p();import{spawnSync as lt}from"child_process";import ue from"process";var K=e=>{let t=["npx","@biomejs/biome","check"];e.length>0?t.push(...F(e)):t.push("./");let s=t.join(" "),n=lt(s,{stdio:"inherit",shell:!0});n.error&&(console.error("Failed to run Ultracite:",n.error.message),ue.exit(1)),n.status!==0&&ue.exit(n.status??1)};import{spawnSync as jt}from"child_process";import{existsSync as S}from"fs";import{readFile as we}from"fs/promises";import{join as P}from"path";import{parse as Ct}from"jsonc-parser";p();import{readFile as pe,unlink as dt,writeFile as ut}from"fs/promises";import{parse as me}from"jsonc-parser";import{removeDependency as pt}from"nypm";var N=[".eslintrc",".eslintrc.js",".eslintrc.json",".eslintrc.yml",".eslintrc.yaml",".eslintrc.config.js","eslint.config.js","eslint.config.mjs","eslint.config.cjs",".eslintignore"],fe=async()=>{try{let e=await pe("package.json","utf-8"),t=me(e);if(!t||typeof t!="object")return[];let s=t.dependencies||{},n=t.devDependencies||{},o={...s,...n};return Object.keys(o).filter(i=>i.startsWith("eslint")||i.startsWith("@eslint/")||i==="@typescript-eslint/parser"||i==="@typescript-eslint/eslint-plugin")}catch{return[]}},mt=async(e,t)=>{if(t.length!==0)try{for(let s of t)await pt(s,{packageManager:e})}catch(s){console.warn(s)}},ft=async()=>{let e=[];for(let t of N)if(await a(t))try{await dt(t),e.push(t)}catch(s){console.warn(s)}return e},gt=async()=>{let e="./.vscode/settings.json";if(!await a(e))return!1;try{let t=await pe(e,"utf-8"),s=me(t);if(!s||typeof s!="object")return!1;let n=!1,o={...s},i=["eslint.enable","eslint.format.enable","eslint.validate","eslint.workingDirectories","eslint.codeAction.showDocumentation","eslint.run","eslint.autoFixOnSave","eslint.quiet","eslint.packageManager","eslint.options","eslint.trace.server"];for(let r of i)r in o&&(delete o[r],n=!0);if("editor.codeActionsOnSave"in o){let r=o["editor.codeActionsOnSave"];if(r&&typeof r=="object"){let l=["source.fixAll.eslint","source.organizeImports.eslint"];for(let d of l)d in r&&(delete r[d],n=!0);Object.keys(r).length===0&&(o["editor.codeActionsOnSave"]=void 0)}}return n?(await ut(e,JSON.stringify(o,null,2)),!0):!1}catch(t){return console.warn(t),!1}},ht=async()=>{if((await fe()).length>0)return!0;for(let t of N)if(await a(t))return!0;return!1},Z={hasESLint:ht,remove:async e=>{let t=await fe();mt(e,t);let s=await ft(),n=await gt();return{packagesRemoved:t,filesRemoved:s,vsCodeCleaned:n}}};p();import{readFile as ge,unlink as yt,writeFile as wt}from"fs/promises";import{parse as he}from"jsonc-parser";import{removeDependency as bt}from"nypm";var I=[".prettierrc",".prettierrc.js",".prettierrc.json",".prettierrc.yml",".prettierrc.yaml",".prettierrc.config.js","prettier.config.js","prettier.config.mjs",".prettierignore"],ye=async()=>{try{let e=await ge("package.json","utf-8"),t=he(e);if(!t||typeof t!="object")return[];let s=t.dependencies||{},n=t.devDependencies||{},o={...s,...n};return Object.keys(o).filter(i=>i.startsWith("prettier")||i==="eslint-config-prettier"||i==="eslint-plugin-prettier")}catch{return[]}},kt=async(e,t)=>{if(t.length!==0)try{for(let s of t)await bt(s,{packageManager:e})}catch(s){console.warn(s)}},vt=async()=>{let e=[];for(let t of I)if(await a(t))try{await yt(t),e.push(t)}catch(s){console.warn(s)}return e},xt=async()=>{let e="./.vscode/settings.json";if(!await a(e))return!1;try{let t=await ge(e,"utf-8"),s=he(t);if(!s||typeof s!="object")return!1;let n=!1,o={...s},i=["editor.defaultFormatter","prettier.enable","prettier.requireConfig","prettier.configPath","prettier.printWidth","prettier.tabWidth","prettier.useTabs","prettier.semi","prettier.singleQuote","prettier.quoteProps","prettier.trailingComma","prettier.bracketSpacing","prettier.arrowParens","prettier.endOfLine"];for(let l of i)l in o&&(l==="editor.defaultFormatter"&&o[l]==="esbenp.prettier-vscode"||l!=="editor.defaultFormatter")&&(delete o[l],n=!0);let r=Object.keys(o).filter(l=>l.startsWith("[")&&l.includes("javascript"));for(let l of r){let d=o[l];d&&typeof d=="object"&&"editor.defaultFormatter"in d&&d["editor.defaultFormatter"]==="esbenp.prettier-vscode"&&(d["editor.defaultFormatter"]=void 0,n=!0,Object.keys(d).length===0&&delete o[l])}return n?(await wt(e,JSON.stringify(o,null,2)),!0):!1}catch(t){return console.warn(t),!1}},Dt=async()=>{if((await ye()).length>0)return!0;for(let t of I)if(await a(t))return!0;return!1},Q={hasPrettier:Dt,remove:async e=>{let t=await ye();kt(e,t);let s=await vt(),n=await xt();return{packagesRemoved:t,filesRemoved:s,vsCodeCleaned:n}}};var St=()=>{let e=jt("npx @biomejs/biome --version",{shell:!0,encoding:"utf-8"});return e.status===0&&e.stdout?{name:"Biome installation",status:"pass",message:`Biome is installed (${e.stdout.trim()})`}:{name:"Biome installation",status:"fail",message:"Biome is not installed or not accessible"}},Pt=async()=>{let e=P(process.cwd(),"biome.json"),t=P(process.cwd(),"biome.jsonc"),s=null;if(S(e)?s=e:S(t)&&(s=t),!s)return{name:"Biome configuration",status:"fail",message:"No biome.json or biome.jsonc file found"};try{let n=await we(s,"utf-8"),o=Ct(n);return Array.isArray(o?.extends)&&o.extends.includes("ultracite")?{name:"Biome configuration",status:"pass",message:"biome.json(c) extends ultracite"}:{name:"Biome configuration",status:"warn",message:"biome.json(c) exists but doesn't extend ultracite"}}catch{return{name:"Biome configuration",status:"fail",message:"Could not parse biome.json(c) file"}}},Rt=async()=>{let e=P(process.cwd(),"package.json");if(!S(e))return{name:"Ultracite dependency",status:"warn",message:"No package.json found"};try{let t=JSON.parse(await we(e,"utf-8")),s=t.dependencies?.ultracite||t.devDependencies?.ultracite||t.peerDependencies?.ultracite;return s?{name:"Ultracite dependency",status:"pass",message:`Ultracite is in package.json (${s})`}:{name:"Ultracite dependency",status:"warn",message:"Ultracite not found in package.json dependencies"}}catch{return{name:"Ultracite dependency",status:"warn",message:"Could not parse package.json"}}},At=()=>{let e=I.some(s=>S(P(process.cwd(),s))),t=N.some(s=>S(P(process.cwd(),s)));if(e||t){let s=[];return e&&s.push("Prettier"),t&&s.push("ESLint"),{name:"Conflicting tools",status:"warn",message:`Found potentially conflicting tools: ${s.join(", ")}`}}return{name:"Conflicting tools",status:"pass",message:"No conflicting formatting/linting tools found"}},be=async()=>{let e=[];console.log(`\u{1FA7A} Running Ultracite doctor...
121
+ `),e.push(St()),e.push(await Pt()),e.push(await Rt()),e.push(At());let t=e.filter(o=>o.status==="pass").length,s=e.filter(o=>o.status==="fail").length,n=e.filter(o=>o.status==="warn").length;for(let o of e){let i;o.status==="pass"?i="\u2705":o.status==="fail"?i="\u274C":i="\u26A0\uFE0F",console.log(`${i} ${o.name}: ${o.message}`)}console.log(`
54
122
  \u{1F4CA} Summary:`),console.log(` ${t} passed, ${n} warnings, ${s} failed`),s>0&&(console.log(`
55
123
  \u{1F4A1} To fix issues, run: npx ultracite init`),process.exit(1)),n>0?console.log(`
56
124
  \u{1F4A1} Some optional improvements available. Run 'npx ultracite init' to configure.`):console.log(`
57
- \u2728 Everything looks good!`)};p();import{spawnSync as Mt}from"child_process";import ke from"process";var ee=(e,t={})=>{let s=["npx","@biomejs/biome","check","--write"];t.unsafe&&s.push("--unsafe"),e.length>0?s.push(...U(e)):s.push("./");let n=s.join(" "),o=Mt(n,{stdio:"inherit",shell:!0});o.error&&(console.error("Failed to run Ultracite:",o.error.message),ke.exit(1)),o.status!==0&&ke.exit(o.status??1)};import{packageManagers as At}from"nypm";var R={packageManagers:At.map(e=>e.name),editorConfigs:["vscode","zed"],editorRules:["vscode-copilot","cursor","windsurf","zed","claude","codex","kiro","cline","amp","aider","firebase-studio","open-hands","gemini-cli","junie","augmentcode","kilo-code","goose"],integrations:["husky","lefthook","lint-staged"]};import He from"process";import{intro as ws,log as q,multiselect as G,spinner as m}from"@clack/prompts";import{addDevDependency as bs,detectPackageManager as ks}from"nypm";import{readFile as Nt,writeFile as ve}from"fs/promises";import Ft from"deepmerge";import{parse as Ut}from"jsonc-parser";p();var Et=f.devDependencies["@biomejs/biome"],xe={$schema:`https://biomejs.dev/schemas/${Et}/schema.json`,extends:["ultracite"]},te=async()=>await a("./biome.json")?"./biome.json":"./biome.jsonc",$={exists:async()=>{let e=await te();return a(e)},create:async()=>{let e=await te();return ve(e,JSON.stringify(xe,null,2))},update:async()=>{let e=await te(),t=await Nt(e,"utf-8"),n=Ut(t)||{},o=n.extends&&Array.isArray(n.extends)?n.extends:[];o.includes("ultracite")||(n.extends=[...o,"ultracite"]);let i={$schema:xe.$schema},r=Ft(n,i);await ve(e,JSON.stringify(r,null,2))}};p();import{spawnSync as It}from"child_process";import{mkdir as $t,readFile as Ot,writeFile as De}from"fs/promises";import Tt from"deepmerge";import{parse as Jt}from"jsonc-parser";var je={"editor.defaultFormatter":"esbenp.prettier-vscode","[javascript]":{"editor.defaultFormatter":"biomejs.biome"},"[typescript]":{"editor.defaultFormatter":"biomejs.biome"},"[javascriptreact]":{"editor.defaultFormatter":"biomejs.biome"},"[typescriptreact]":{"editor.defaultFormatter":"biomejs.biome"},"[json]":{"editor.defaultFormatter":"biomejs.biome"},"[jsonc]":{"editor.defaultFormatter":"biomejs.biome"},"[css]":{"editor.defaultFormatter":"biomejs.biome"},"[graphql]":{"editor.defaultFormatter":"biomejs.biome"},"typescript.tsdk":"node_modules/typescript/lib","editor.formatOnSave":!0,"editor.formatOnPaste":!0,"emmet.showExpandedAbbreviation":"never","editor.codeActionsOnSave":{"source.fixAll.biome":"explicit","source.organizeImports.biome":"explicit"}},O="./.vscode/settings.json",M={exists:()=>a(O),create:async()=>{await $t(".vscode",{recursive:!0}),await De(O,JSON.stringify(je,null,2))},update:async()=>{let e=await Ot(O,"utf-8"),s=Jt(e)||{},n=Tt(s,je);await De(O,JSON.stringify(n,null,2))},extension:()=>It("code --install-extension biomejs.biome",{stdio:"inherit",shell:!0})};p();import{mkdir as _t,readFile as zt,writeFile as Ce}from"fs/promises";import Lt from"deepmerge";import{parse as Bt}from"jsonc-parser";var Pe={formatter:"language_server",format_on_save:"on",languages:{JavaScript:{formatter:{language_server:{name:"biome"}},code_actions_on_format:{"source.fixAll.biome":!0,"source.organizeImports.biome":!0}},TypeScript:{formatter:{language_server:{name:"biome"}},code_actions_on_format:{"source.fixAll.biome":!0,"source.organizeImports.biome":!0}},JSX:{formatter:{language_server:{name:"biome"}},code_actions_on_format:{"source.fixAll.biome":!0,"source.organizeImports.biome":!0}},TSX:{formatter:{language_server:{name:"biome"}},code_actions_on_format:{"source.fixAll.biome":!0,"source.organizeImports.biome":!0}}},lsp:{"typescript-language-server":{settings:{typescript:{preferences:{includePackageJsonAutoImports:"on"}}}}}},T="./.zed/settings.json",J={exists:()=>a(T),create:async()=>{await _t(".zed",{recursive:!0}),await Ce(T,JSON.stringify(Pe,null,2))},update:async()=>{let e=await zt(T,"utf-8"),s=Bt(e)||{},n=Lt(s,Pe);await Ce(T,JSON.stringify(n,null,2))}};import{mkdir as Wt,readFile as qt,writeFile as _}from"fs/promises";import{dirname as Gt}from"path";var Se=["Don't use `accessKey` attribute on any HTML element.",'Don\'t set `aria-hidden="true"` on focusable elements.',"Don't add ARIA roles, states, and properties to elements that don't support them.","Don't use distracting elements like `<marquee>` or `<blink>`.","Only use the `scope` prop on `<th>` elements.","Don't assign non-interactive ARIA roles to interactive HTML elements.","Make sure label elements have text content and are associated with an input.","Don't assign interactive ARIA roles to non-interactive HTML elements.","Don't assign `tabIndex` to non-interactive HTML elements.","Don't use positive integers for `tabIndex` property.",`Don't include "image", "picture", or "photo" in img alt prop.`,"Don't use explicit role property that's the same as the implicit/default role.","Make static elements with click handlers use a valid role attribute.","Always include a `title` element for SVG elements.","Give all elements requiring alt text meaningful information for screen readers.","Make sure anchors have content that's accessible to screen readers.","Assign `tabIndex` to non-interactive HTML elements with `aria-activedescendant`.","Include all required ARIA attributes for elements with ARIA roles.","Make sure ARIA properties are valid for the element's supported roles.","Always include a `type` attribute for button elements.","Make elements with interactive roles and handlers focusable.","Give heading elements content that's accessible to screen readers (not hidden with `aria-hidden`).","Always include a `lang` attribute on the html element.","Always include a `title` attribute for iframe elements.","Accompany `onClick` with at least one of: `onKeyUp`, `onKeyDown`, or `onKeyPress`.","Accompany `onMouseOver`/`onMouseOut` with `onFocus`/`onBlur`.","Include caption tracks for audio and video elements.","Use semantic elements instead of role attributes in JSX.","Make sure all anchors are valid and navigable.","Ensure all ARIA properties (`aria-*`) are valid.","Use valid, non-abstract ARIA roles for elements with ARIA roles.","Use valid ARIA state and property values.","Use valid values for the `autocomplete` attribute on input elements.","Use correct ISO language/country codes for the `lang` attribute."],Re=["Don't use consecutive spaces in regular expression literals.","Don't use the `arguments` object.","Don't use primitive type aliases or misleading types.","Don't use the comma operator.","Don't use empty type parameters in type aliases and interfaces.","Don't write functions that exceed a given Cognitive Complexity score.","Don't nest describe() blocks too deeply in test files.","Don't use unnecessary boolean casts.","Don't use unnecessary callbacks with flatMap.","Use for...of statements instead of Array.forEach.","Don't create classes that only have static members (like a static namespace).","Don't use this and super in static contexts.","Don't use unnecessary catch clauses.","Don't use unnecessary constructors.","Don't use unnecessary continue statements.","Don't export empty modules that don't change anything.","Don't use unnecessary escape sequences in regular expression literals.","Don't use unnecessary fragments.","Don't use unnecessary labels.","Don't use unnecessary nested block statements.","Don't rename imports, exports, and destructured assignments to the same name.","Don't use unnecessary string or template literal concatenation.","Don't use String.raw in template literals when there are no escape sequences.","Don't use useless case statements in switch statements.","Don't use ternary operators when simpler alternatives exist.","Don't use useless `this` aliasing.","Don't use any or unknown as type constraints.","Don't initialize variables to undefined.","Don't use the void operators (they're not familiar).","Use arrow functions instead of function expressions.","Use Date.now() to get milliseconds since the Unix Epoch.","Use .flatMap() instead of map().flat() when possible.","Use literal property access instead of computed property access.","Don't use parseInt() or Number.parseInt() when binary, octal, or hexadecimal literals work.","Use concise optional chaining instead of chained logical expressions.","Use regular expression literals instead of the RegExp constructor when possible.","Don't use number literal object member names that aren't base 10 or use underscore separators.","Remove redundant terms from logical expressions.","Use while loops instead of for loops when you don't need initializer and update expressions.","Don't pass children as props.","Don't reassign const variables.","Don't use constant expressions in conditions.","Don't use `Math.min` and `Math.max` to clamp values when the result is constant.","Don't return a value from a constructor.","Don't use empty character classes in regular expression literals.","Don't use empty destructuring patterns.","Don't call global object properties as functions.","Don't declare functions and vars that are accessible outside their block.","Make sure builtins are correctly instantiated.","Don't use super() incorrectly inside classes. Also check that super() is called in classes that extend other constructors.","Don't use variables and function parameters before they're declared.","Don't use 8 and 9 escape sequences in string literals.","Don't use literal numbers that lose precision."],Me=["Don't use the return value of React.render.","Make sure all dependencies are correctly specified in React hooks.","Make sure all React hooks are called from the top level of component functions.","Don't forget key props in iterators and collection literals.","Don't destructure props inside JSX components in Solid projects.","Don't define React components inside other components.","Don't use event handlers on non-interactive elements.","Don't assign to React component props.","Don't use both `children` and `dangerouslySetInnerHTML` props on the same element.","Don't use dangerous JSX props.","Don't use Array index in keys.","Don't insert comments as text nodes.","Don't assign JSX properties multiple times.","Don't add extra closing tags for components without children.","Use `<>...</>` instead of `<Fragment>...</Fragment>`.",'Watch out for possible "wrong" semicolons inside JSX elements.'],Ae=["Don't assign a value to itself.","Don't return a value from a setter.","Don't compare expressions that modify string case with non-compliant values.","Don't use lexical declarations in switch clauses.","Don't use variables that haven't been declared in the document.","Don't write unreachable code.","Make sure super() is called exactly once on every code path in a class constructor before this is accessed if the class has a superclass.","Don't use control flow statements in finally blocks.","Don't use optional chaining where undefined values aren't allowed.","Don't have unused function parameters.","Don't have unused imports.","Don't have unused labels.","Don't have unused private class members.","Don't have unused variables.","Make sure void (self-closing) elements don't have children.","Don't return a value from a function with the return type 'void'","Use isNaN() when checking for NaN.",'Make sure "for" loop update clauses move the counter in the right direction.',"Make sure typeof expressions are compared to valid values.","Make sure generator functions contain yield.","Don't use await inside loops.","Don't use bitwise operators.","Don't use expressions where the operation doesn't change the value.","Make sure Promise-like statements are handled appropriately.","Don't use __dirname and __filename in the global scope.","Prevent import cycles.","Don't use configured elements.","Don't hardcode sensitive data like API keys and tokens.","Don't let variable declarations shadow variables from outer scopes.","Don't use the TypeScript directive @ts-ignore.","Prevent duplicate polyfills from Polyfill.io.","Don't use useless backreferences in regular expressions that always match empty strings.","Don't use unnecessary escapes in string literals.","Don't use useless undefined.","Make sure getters and setters for the same property are next to each other in class and object definitions.","Make sure object literals are declared consistently (defaults to explicit definitions).","Use static Response methods instead of new Response() constructor when possible.","Make sure switch-case statements are exhaustive.","Make sure the `preconnect` attribute is used when using Google Fonts.","Use `Array#{indexOf,lastIndexOf}()` instead of `Array#{findIndex,findLastIndex}()` when looking for the index of an item.","Make sure iterable callbacks return consistent values.",'Use `with { type: "json" }` for JSON module imports.',"Use numeric separators in numeric literals.","Use object spread instead of `Object.assign()` when constructing new objects.","Always use the radix argument when using `parseInt()`.","Make sure JSDoc comment lines start with a single asterisk, except for the first one.","Include a description parameter for `Symbol()`.","Don't use spread (`...`) syntax on accumulators.","Don't use the `delete` operator.","Don't access namespace imports dynamically.","Don't use namespace imports.","Declare regex literals at the top level.",'Don\'t use `target="_blank"` without `rel="noopener"`.'],Ne=["Don't use TypeScript enums.","Don't export imported variables.","Don't add type annotations to variables, parameters, and class properties that are initialized with literal expressions.","Don't use TypeScript namespaces.","Don't use non-null assertions with the `!` postfix operator.","Don't use parameter properties in class constructors.","Don't use user-defined types.","Use `as const` instead of literal types and type annotations.","Use either `T[]` or `Array<T>` consistently.","Initialize each enum member value explicitly.","Use `export type` for types.","Use `import type` for types.","Make sure all enum members are literal values.","Don't use TypeScript const enum.","Don't declare empty interfaces.","Don't let variables evolve into any type through reassignments.","Don't use the any type.","Don't misuse the non-null assertion operator (!) in TypeScript files.","Don't use implicit any type on variable declarations.","Don't merge interfaces and classes unsafely.","Don't use overload signatures that aren't next to each other.","Use the namespace keyword instead of the module keyword to declare TypeScript namespaces."],Fe=["Don't use global `eval()`.","Don't use callbacks in asynchronous tests and hooks.","Don't use negation in `if` statements that have `else` clauses.","Don't use nested ternary expressions.","Don't reassign function parameters.","This rule lets you specify global variable names you don't want to use in your application.","Don't use specified modules when loaded by import or require.","Don't use constants whose value is the upper-case version of their name.","Use `String.slice()` instead of `String.substr()` and `String.substring()`.","Don't use template literals if you don't need interpolation or special-character handling.","Don't use `else` blocks when the `if` block breaks early.","Don't use yoda expressions.","Don't use Array constructors.","Use `at()` instead of integer index access.","Follow curly brace conventions.","Use `else if` instead of nested `if` statements in `else` clauses.","Use single `if` statements instead of nested `if` clauses.","Use `new` for all builtins except `String`, `Number`, and `Boolean`.","Use consistent accessibility modifiers on class properties and methods.","Use `const` declarations for variables that are only assigned once.","Put default function parameters and optional function parameters last.","Include a `default` clause in switch statements.","Use the `**` operator instead of `Math.pow`.","Use `for-of` loops when you need the index to extract an item from the iterated array.","Use `node:assert/strict` over `node:assert`.","Use the `node:` protocol for Node.js builtin modules.","Use Number properties instead of global ones.","Use assignment operator shorthand where possible.","Use function types instead of object types with call signatures.","Use template literals over string concatenation.","Use `new` when throwing an error.","Don't throw non-Error values.","Use `String.trimStart()` and `String.trimEnd()` over `String.trimLeft()` and `String.trimRight()`.","Use standard constants instead of approximated literals.","Don't assign values in expressions.","Don't use async functions as Promise executors.","Don't reassign exceptions in catch clauses.","Don't reassign class members.","Don't compare against -0.","Don't use labeled statements that aren't loops.","Don't use void type outside of generic or return types.","Don't use console.","Don't use control characters and escape sequences that match control characters in regular expression literals.","Don't use debugger.","Don't assign directly to document.cookie.","Use `===` and `!==`.","Don't use duplicate case labels.","Don't use duplicate class members.","Don't use duplicate conditions in if-else-if chains.","Don't use two keys with the same name inside objects.","Don't use duplicate function parameter names.","Don't have duplicate hooks in describe blocks.","Don't use empty block statements and static blocks.","Don't let switch clauses fall through.","Don't reassign function declarations.","Don't allow assignments to native objects and read-only global variables.","Use Number.isFinite instead of global isFinite.","Use Number.isNaN instead of global isNaN.","Don't assign to imported bindings.","Don't use irregular whitespace characters.","Don't use labels that share a name with a variable.","Don't use characters made with multiple code points in character class syntax.","Make sure to use new and constructor properly.","Don't use shorthand assign when the variable appears on both sides.","Don't use octal escape sequences in string literals.","Don't use Object.prototype builtins directly.","Don't redeclare variables, functions, classes, and types in the same scope.",`Don't have redundant "use strict".`,"Don't compare things where both sides are exactly the same.","Don't let identifiers shadow restricted names.","Don't use sparse arrays (arrays with holes).","Don't use template literal placeholder syntax in regular strings.","Don't use the then property.","Don't use unsafe negation.","Don't use var.","Don't use with statements in non-strict contexts.","Make sure async functions actually use await.","Make sure default clauses in switch statements come last.","Make sure to pass a message value when creating a built-in error.","Make sure get methods always return a value.","Use a recommended display strategy with Google Fonts.","Make sure for-in loops include an if statement.","Use Array.isArray() instead of instanceof Array.","Make sure to use the digits argument with Number#toFixed().",'Make sure to use the "use strict" directive in script files.'],Ue=["Don't use `<img>` elements in Next.js projects.","Don't use `<head>` elements in Next.js projects.","Don't import next/document outside of pages/_document.jsx in Next.js projects.","Don't use the next/head module in pages/_document.js on Next.js projects."],Ee=["Don't use export or module.exports in test files.","Don't use focused tests.","Make sure the assertion function, like expect, is placed inside an it() function call.","Don't use disabled tests."],Un=[...Se,...Re,...Me,...Ae,...Ne,...Fe,...Ue,...Ee],A=`# Project Context
125
+ \u2728 Everything looks good!`)};p();import{spawnSync as Mt}from"child_process";import ke from"process";var ee=(e,t={})=>{let s=["npx","@biomejs/biome","check","--write"];t.unsafe&&s.push("--unsafe"),e.length>0?s.push(...F(e)):s.push("./");let n=s.join(" "),o=Mt(n,{stdio:"inherit",shell:!0});o.error&&(console.error("Failed to run Ultracite:",o.error.message),ke.exit(1)),o.status!==0&&ke.exit(o.status??1)};import{packageManagers as Et}from"nypm";var R={packageManagers:Et.map(e=>e.name),editorConfigs:["vscode","zed"],editorRules:["vscode-copilot","cursor","windsurf","zed","claude","codex","kiro","cline","amp","aider","firebase-studio","open-hands","gemini-cli","junie","augmentcode","kilo-code","goose"],integrations:["husky","lefthook","lint-staged"]};import Xe from"process";import{intro as bs,log as q,multiselect as G,spinner as m}from"@clack/prompts";import{addDevDependency as ks,detectPackageManager as vs}from"nypm";import{readFile as $t,writeFile as ve}from"fs/promises";import Ft from"deepmerge";import{parse as Nt}from"jsonc-parser";p();var It=f.devDependencies["@biomejs/biome"],xe={$schema:`https://biomejs.dev/schemas/${It}/schema.json`,extends:["ultracite"]},te=async()=>await a("./biome.json")?"./biome.json":"./biome.jsonc",U={exists:async()=>{let e=await te();return a(e)},create:async()=>{let e=await te();return ve(e,JSON.stringify(xe,null,2))},update:async()=>{let e=await te(),t=await $t(e,"utf-8"),n=Nt(t)||{},o=n.extends&&Array.isArray(n.extends)?n.extends:[];o.includes("ultracite")||(n.extends=[...o,"ultracite"]);let i={$schema:xe.$schema},r=Ft(n,i);await ve(e,JSON.stringify(r,null,2))}};p();import{spawnSync as Ut}from"child_process";import{mkdir as Tt,readFile as Ot,writeFile as De}from"fs/promises";import _t from"deepmerge";import{parse as Jt}from"jsonc-parser";var je={"editor.defaultFormatter":"esbenp.prettier-vscode","[javascript]":{"editor.defaultFormatter":"biomejs.biome"},"[typescript]":{"editor.defaultFormatter":"biomejs.biome"},"[javascriptreact]":{"editor.defaultFormatter":"biomejs.biome"},"[typescriptreact]":{"editor.defaultFormatter":"biomejs.biome"},"[json]":{"editor.defaultFormatter":"biomejs.biome"},"[jsonc]":{"editor.defaultFormatter":"biomejs.biome"},"[css]":{"editor.defaultFormatter":"biomejs.biome"},"[graphql]":{"editor.defaultFormatter":"biomejs.biome"},"typescript.tsdk":"node_modules/typescript/lib","editor.formatOnSave":!0,"editor.formatOnPaste":!0,"emmet.showExpandedAbbreviation":"never","editor.codeActionsOnSave":{"source.fixAll.biome":"explicit","source.organizeImports.biome":"explicit"}},T="./.vscode/settings.json",A={exists:()=>a(T),create:async()=>{await Tt(".vscode",{recursive:!0}),await De(T,JSON.stringify(je,null,2))},update:async()=>{let e=await Ot(T,"utf-8"),s=Jt(e)||{},n=_t(s,je);await De(T,JSON.stringify(n,null,2))},extension:()=>Ut("code --install-extension biomejs.biome",{stdio:"inherit",shell:!0})};p();import{mkdir as Lt,readFile as zt,writeFile as Ce}from"fs/promises";import Bt from"deepmerge";import{parse as Wt}from"jsonc-parser";var Se={formatter:"language_server",format_on_save:"on",languages:{JavaScript:{formatter:{language_server:{name:"biome"}},code_actions_on_format:{"source.fixAll.biome":!0,"source.organizeImports.biome":!0}},TypeScript:{formatter:{language_server:{name:"biome"}},code_actions_on_format:{"source.fixAll.biome":!0,"source.organizeImports.biome":!0}},JSX:{formatter:{language_server:{name:"biome"}},code_actions_on_format:{"source.fixAll.biome":!0,"source.organizeImports.biome":!0}},TSX:{formatter:{language_server:{name:"biome"}},code_actions_on_format:{"source.fixAll.biome":!0,"source.organizeImports.biome":!0}}},lsp:{"typescript-language-server":{settings:{typescript:{preferences:{includePackageJsonAutoImports:"on"}}}}}},O="./.zed/settings.json",_={exists:()=>a(O),create:async()=>{await Lt(".zed",{recursive:!0}),await Ce(O,JSON.stringify(Se,null,2))},update:async()=>{let e=await zt(O,"utf-8"),s=Wt(e)||{},n=Bt(s,Se);await Ce(O,JSON.stringify(n,null,2))}};import{mkdir as qt,readFile as Gt,writeFile as J}from"fs/promises";import{dirname as Ht}from"path";var Pe=["Don't use `accessKey` attribute on any HTML element.",'Don\'t set `aria-hidden="true"` on focusable elements.',"Don't add ARIA roles, states, and properties to elements that don't support them.","Don't use distracting elements like `<marquee>` or `<blink>`.","Only use the `scope` prop on `<th>` elements.","Don't assign non-interactive ARIA roles to interactive HTML elements.","Make sure label elements have text content and are associated with an input.","Don't assign interactive ARIA roles to non-interactive HTML elements.","Don't assign `tabIndex` to non-interactive HTML elements.","Don't use positive integers for `tabIndex` property.",`Don't include "image", "picture", or "photo" in img alt prop.`,"Don't use explicit role property that's the same as the implicit/default role.","Make static elements with click handlers use a valid role attribute.","Always include a `title` element for SVG elements.","Give all elements requiring alt text meaningful information for screen readers.","Make sure anchors have content that's accessible to screen readers.","Assign `tabIndex` to non-interactive HTML elements with `aria-activedescendant`.","Include all required ARIA attributes for elements with ARIA roles.","Make sure ARIA properties are valid for the element's supported roles.","Always include a `type` attribute for button elements.","Make elements with interactive roles and handlers focusable.","Give heading elements content that's accessible to screen readers (not hidden with `aria-hidden`).","Always include a `lang` attribute on the html element.","Always include a `title` attribute for iframe elements.","Accompany `onClick` with at least one of: `onKeyUp`, `onKeyDown`, or `onKeyPress`.","Accompany `onMouseOver`/`onMouseOut` with `onFocus`/`onBlur`.","Include caption tracks for audio and video elements.","Use semantic elements instead of role attributes in JSX.","Make sure all anchors are valid and navigable.","Ensure all ARIA properties (`aria-*`) are valid.","Use valid, non-abstract ARIA roles for elements with ARIA roles.","Use valid ARIA state and property values.","Use valid values for the `autocomplete` attribute on input elements.","Use correct ISO language/country codes for the `lang` attribute."],Re=["Don't use consecutive spaces in regular expression literals.","Don't use the `arguments` object.","Don't use primitive type aliases or misleading types.","Don't use the comma operator.","Don't use empty type parameters in type aliases and interfaces.","Don't write functions that exceed a given Cognitive Complexity score.","Don't nest describe() blocks too deeply in test files.","Don't use unnecessary boolean casts.","Don't use unnecessary callbacks with flatMap.","Use for...of statements instead of Array.forEach.","Don't create classes that only have static members (like a static namespace).","Don't use this and super in static contexts.","Don't use unnecessary catch clauses.","Don't use unnecessary constructors.","Don't use unnecessary continue statements.","Don't export empty modules that don't change anything.","Don't use unnecessary escape sequences in regular expression literals.","Don't use unnecessary fragments.","Don't use unnecessary labels.","Don't use unnecessary nested block statements.","Don't rename imports, exports, and destructured assignments to the same name.","Don't use unnecessary string or template literal concatenation.","Don't use String.raw in template literals when there are no escape sequences.","Don't use useless case statements in switch statements.","Don't use ternary operators when simpler alternatives exist.","Don't use useless `this` aliasing.","Don't use any or unknown as type constraints.","Don't initialize variables to undefined.","Don't use the void operators (they're not familiar).","Use arrow functions instead of function expressions.","Use Date.now() to get milliseconds since the Unix Epoch.","Use .flatMap() instead of map().flat() when possible.","Use literal property access instead of computed property access.","Don't use parseInt() or Number.parseInt() when binary, octal, or hexadecimal literals work.","Use concise optional chaining instead of chained logical expressions.","Use regular expression literals instead of the RegExp constructor when possible.","Don't use number literal object member names that aren't base 10 or use underscore separators.","Remove redundant terms from logical expressions.","Use while loops instead of for loops when you don't need initializer and update expressions.","Don't pass children as props.","Don't reassign const variables.","Don't use constant expressions in conditions.","Don't use `Math.min` and `Math.max` to clamp values when the result is constant.","Don't return a value from a constructor.","Don't use empty character classes in regular expression literals.","Don't use empty destructuring patterns.","Don't call global object properties as functions.","Don't declare functions and vars that are accessible outside their block.","Make sure builtins are correctly instantiated.","Don't use super() incorrectly inside classes. Also check that super() is called in classes that extend other constructors.","Don't use variables and function parameters before they're declared.","Don't use 8 and 9 escape sequences in string literals.","Don't use literal numbers that lose precision."],Ae=["Don't use the return value of React.render.","Make sure all dependencies are correctly specified in React hooks.","Make sure all React hooks are called from the top level of component functions.","Don't forget key props in iterators and collection literals.","Don't destructure props inside JSX components in Solid projects.","Don't define React components inside other components.","Don't use event handlers on non-interactive elements.","Don't assign to React component props.","Don't use both `children` and `dangerouslySetInnerHTML` props on the same element.","Don't use dangerous JSX props.","Don't use Array index in keys.","Don't insert comments as text nodes.","Don't assign JSX properties multiple times.","Don't add extra closing tags for components without children.","Use `<>...</>` instead of `<Fragment>...</Fragment>`.",'Watch out for possible "wrong" semicolons inside JSX elements.'],Me=["Don't assign a value to itself.","Don't return a value from a setter.","Don't compare expressions that modify string case with non-compliant values.","Don't use lexical declarations in switch clauses.","Don't use variables that haven't been declared in the document.","Don't write unreachable code.","Make sure super() is called exactly once on every code path in a class constructor before this is accessed if the class has a superclass.","Don't use control flow statements in finally blocks.","Don't use optional chaining where undefined values aren't allowed.","Don't have unused function parameters.","Don't have unused imports.","Don't have unused labels.","Don't have unused private class members.","Don't have unused variables.","Make sure void (self-closing) elements don't have children.","Don't return a value from a function with the return type 'void'","Use isNaN() when checking for NaN.",'Make sure "for" loop update clauses move the counter in the right direction.',"Make sure typeof expressions are compared to valid values.","Make sure generator functions contain yield.","Don't use await inside loops.","Don't use bitwise operators.","Don't use expressions where the operation doesn't change the value.","Make sure Promise-like statements are handled appropriately.","Don't use __dirname and __filename in the global scope.","Prevent import cycles.","Don't use configured elements.","Don't hardcode sensitive data like API keys and tokens.","Don't let variable declarations shadow variables from outer scopes.","Don't use the TypeScript directive @ts-ignore.","Prevent duplicate polyfills from Polyfill.io.","Don't use useless backreferences in regular expressions that always match empty strings.","Don't use unnecessary escapes in string literals.","Don't use useless undefined.","Make sure getters and setters for the same property are next to each other in class and object definitions.","Make sure object literals are declared consistently (defaults to explicit definitions).","Use static Response methods instead of new Response() constructor when possible.","Make sure switch-case statements are exhaustive.","Make sure the `preconnect` attribute is used when using Google Fonts.","Use `Array#{indexOf,lastIndexOf}()` instead of `Array#{findIndex,findLastIndex}()` when looking for the index of an item.","Make sure iterable callbacks return consistent values.",'Use `with { type: "json" }` for JSON module imports.',"Use numeric separators in numeric literals.","Use object spread instead of `Object.assign()` when constructing new objects.","Always use the radix argument when using `parseInt()`.","Make sure JSDoc comment lines start with a single asterisk, except for the first one.","Include a description parameter for `Symbol()`.","Don't use spread (`...`) syntax on accumulators.","Don't use the `delete` operator.","Don't access namespace imports dynamically.","Don't use namespace imports.","Declare regex literals at the top level.",'Don\'t use `target="_blank"` without `rel="noopener"`.'],Ee=["Don't use TypeScript enums.","Don't export imported variables.","Don't add type annotations to variables, parameters, and class properties that are initialized with literal expressions.","Don't use TypeScript namespaces.","Don't use non-null assertions with the `!` postfix operator.","Don't use parameter properties in class constructors.","Don't use user-defined types.","Use `as const` instead of literal types and type annotations.","Use either `T[]` or `Array<T>` consistently.","Initialize each enum member value explicitly.","Use `export type` for types.","Use `import type` for types.","Make sure all enum members are literal values.","Don't use TypeScript const enum.","Don't declare empty interfaces.","Don't let variables evolve into any type through reassignments.","Don't use the any type.","Don't misuse the non-null assertion operator (!) in TypeScript files.","Don't use implicit any type on variable declarations.","Don't merge interfaces and classes unsafely.","Don't use overload signatures that aren't next to each other.","Use the namespace keyword instead of the module keyword to declare TypeScript namespaces."],$e=["Don't use global `eval()`.","Don't use callbacks in asynchronous tests and hooks.","Don't use negation in `if` statements that have `else` clauses.","Don't use nested ternary expressions.","Don't reassign function parameters.","This rule lets you specify global variable names you don't want to use in your application.","Don't use specified modules when loaded by import or require.","Don't use constants whose value is the upper-case version of their name.","Use `String.slice()` instead of `String.substr()` and `String.substring()`.","Don't use template literals if you don't need interpolation or special-character handling.","Don't use `else` blocks when the `if` block breaks early.","Don't use yoda expressions.","Don't use Array constructors.","Use `at()` instead of integer index access.","Follow curly brace conventions.","Use `else if` instead of nested `if` statements in `else` clauses.","Use single `if` statements instead of nested `if` clauses.","Use `new` for all builtins except `String`, `Number`, and `Boolean`.","Use consistent accessibility modifiers on class properties and methods.","Use `const` declarations for variables that are only assigned once.","Put default function parameters and optional function parameters last.","Include a `default` clause in switch statements.","Use the `**` operator instead of `Math.pow`.","Use `for-of` loops when you need the index to extract an item from the iterated array.","Use `node:assert/strict` over `node:assert`.","Use the `node:` protocol for Node.js builtin modules.","Use Number properties instead of global ones.","Use assignment operator shorthand where possible.","Use function types instead of object types with call signatures.","Use template literals over string concatenation.","Use `new` when throwing an error.","Don't throw non-Error values.","Use `String.trimStart()` and `String.trimEnd()` over `String.trimLeft()` and `String.trimRight()`.","Use standard constants instead of approximated literals.","Don't assign values in expressions.","Don't use async functions as Promise executors.","Don't reassign exceptions in catch clauses.","Don't reassign class members.","Don't compare against -0.","Don't use labeled statements that aren't loops.","Don't use void type outside of generic or return types.","Don't use console.","Don't use control characters and escape sequences that match control characters in regular expression literals.","Don't use debugger.","Don't assign directly to document.cookie.","Use `===` and `!==`.","Don't use duplicate case labels.","Don't use duplicate class members.","Don't use duplicate conditions in if-else-if chains.","Don't use two keys with the same name inside objects.","Don't use duplicate function parameter names.","Don't have duplicate hooks in describe blocks.","Don't use empty block statements and static blocks.","Don't let switch clauses fall through.","Don't reassign function declarations.","Don't allow assignments to native objects and read-only global variables.","Use Number.isFinite instead of global isFinite.","Use Number.isNaN instead of global isNaN.","Don't assign to imported bindings.","Don't use irregular whitespace characters.","Don't use labels that share a name with a variable.","Don't use characters made with multiple code points in character class syntax.","Make sure to use new and constructor properly.","Don't use shorthand assign when the variable appears on both sides.","Don't use octal escape sequences in string literals.","Don't use Object.prototype builtins directly.","Don't redeclare variables, functions, classes, and types in the same scope.",`Don't have redundant "use strict".`,"Don't compare things where both sides are exactly the same.","Don't let identifiers shadow restricted names.","Don't use sparse arrays (arrays with holes).","Don't use template literal placeholder syntax in regular strings.","Don't use the then property.","Don't use unsafe negation.","Don't use var.","Don't use with statements in non-strict contexts.","Make sure async functions actually use await.","Make sure default clauses in switch statements come last.","Make sure to pass a message value when creating a built-in error.","Make sure get methods always return a value.","Use a recommended display strategy with Google Fonts.","Make sure for-in loops include an if statement.","Use Array.isArray() instead of instanceof Array.","Make sure to use the digits argument with Number#toFixed().",'Make sure to use the "use strict" directive in script files.'],Fe=["Don't use `<img>` elements in Next.js projects.","Don't use `<head>` elements in Next.js projects.","Don't import next/document outside of pages/_document.jsx in Next.js projects.","Don't use the next/head module in pages/_document.js on Next.js projects."],Ne=["Don't use export or module.exports in test files.","Don't use focused tests.","Make sure the assertion function, like expect, is placed inside an it() function call.","Don't use disabled tests."],Nn=[...Pe,...Re,...Ae,...Me,...Ee,...$e,...Fe,...Ne],M=`# Project Context
58
126
  Ultracite enforces strict type safety, accessibility standards, and consistent code quality for JavaScript/TypeScript projects using Biome's lightning-fast formatter and linter.
59
127
 
60
128
  ## Key Principles
@@ -72,7 +140,7 @@ Ultracite enforces strict type safety, accessibility standards, and consistent c
72
140
  ## Rules
73
141
 
74
142
  ### Accessibility (a11y)
75
- ${Se.map(e=>`- ${e}`).join(`
143
+ ${Pe.map(e=>`- ${e}`).join(`
76
144
  `)}
77
145
 
78
146
  ### Code Complexity and Quality
@@ -80,27 +148,27 @@ ${Re.map(e=>`- ${e}`).join(`
80
148
  `)}
81
149
 
82
150
  ### React and JSX Best Practices
83
- ${Me.map(e=>`- ${e}`).join(`
151
+ ${Ae.map(e=>`- ${e}`).join(`
84
152
  `)}
85
153
 
86
154
  ### Correctness and Safety
87
- ${Ae.map(e=>`- ${e}`).join(`
155
+ ${Me.map(e=>`- ${e}`).join(`
88
156
  `)}
89
157
 
90
158
  ### TypeScript Best Practices
91
- ${Ne.map(e=>`- ${e}`).join(`
159
+ ${Ee.map(e=>`- ${e}`).join(`
92
160
  `)}
93
161
 
94
162
  ### Style and Consistency
95
- ${Fe.map(e=>`- ${e}`).join(`
163
+ ${$e.map(e=>`- ${e}`).join(`
96
164
  `)}
97
165
 
98
166
  ### Next.js Specific Rules
99
- ${Ue.map(e=>`- ${e}`).join(`
167
+ ${Fe.map(e=>`- ${e}`).join(`
100
168
  `)}
101
169
 
102
170
  ### Testing Best Practices
103
- ${Ee.map(e=>`- ${e}`).join(`
171
+ ${Ne.map(e=>`- ${e}`).join(`
104
172
  `)}
105
173
 
106
174
  ## Common Tasks
@@ -131,8 +199,8 @@ applyTo: "**/*.{ts,tsx,js,jsx}"
131
199
  description: Ultracite Rules - AI-Ready Formatter and Linter
132
200
  globs: "**/*.{ts,tsx,js,jsx}"
133
201
  alwaysApply: true
134
- ---`},windsurf:{path:"./.windsurf/rules/ultracite.md"},zed:{path:"./.rules",appendMode:!0},claude:{path:"./.claude/CLAUDE.md",appendMode:!0},codex:{path:"./AGENTS.md",appendMode:!0},kiro:{path:"./.kiro/steering/ultracite.md"},cline:{path:"./.clinerules",appendMode:!0},amp:{path:"./AGENT.md",appendMode:!0},aider:{path:"./ultracite.md"},"firebase-studio":{path:"./.idx/airules.md",appendMode:!0},"open-hands":{path:"./.openhands/microagents/repo.md",appendMode:!0},"gemini-cli":{path:"./GEMINI.md",appendMode:!0},junie:{path:"./.junie/guidelines.md",appendMode:!0},augmentcode:{path:"./.augment/rules/ultracite.md"},"kilo-code":{path:"./.kilocode/rules/ultracite.md"},goose:{path:"./.goosehints",appendMode:!0}};p();var $e=e=>{let t=Ie[e],s=t.header?`${t.header}
202
+ ---`},windsurf:{path:"./.windsurf/rules/ultracite.md"},zed:{path:"./.rules",appendMode:!0},claude:{path:"./.claude/CLAUDE.md",appendMode:!0},codex:{path:"./AGENTS.md",appendMode:!0},kiro:{path:"./.kiro/steering/ultracite.md"},cline:{path:"./.clinerules",appendMode:!0},amp:{path:"./AGENT.md",appendMode:!0},aider:{path:"./ultracite.md"},"firebase-studio":{path:"./.idx/airules.md",appendMode:!0},"open-hands":{path:"./.openhands/microagents/repo.md",appendMode:!0},"gemini-cli":{path:"./GEMINI.md",appendMode:!0},junie:{path:"./.junie/guidelines.md",appendMode:!0},augmentcode:{path:"./.augment/rules/ultracite.md"},"kilo-code":{path:"./.kilocode/rules/ultracite.md"},goose:{path:"./.goosehints",appendMode:!0}};p();var Ue=e=>{let t=Ie[e],s=t.header?`${t.header}
135
203
 
136
- ${A}`:A,n=async()=>{let o=Gt(t.path);if(o!=="."){let i=o.startsWith("./")?o.slice(2):o;await Wt(i,{recursive:!0})}};return{exists:()=>a(t.path),create:async()=>{await n(),await _(t.path,s)},update:async()=>{if(await n(),t.appendMode){if(!await a(t.path)){await _(t.path,s);return}let o=await qt(t.path,"utf-8");if(o.includes(A.trim()))return;await _(t.path,`${o}
204
+ ${M}`:M,n=async()=>{let o=Ht(t.path);if(o!=="."){let i=o.startsWith("./")?o.slice(2):o;await qt(i,{recursive:!0})}};return{exists:()=>a(t.path),create:async()=>{await n(),await J(t.path,s)},update:async()=>{if(await n(),t.appendMode){if(!await a(t.path)){await J(t.path,s);return}let o=await Gt(t.path,"utf-8");if(o.includes(M.trim()))return;await J(t.path,`${o}
137
205
 
138
- ${A}`)}else await _(t.path,s)}}};se();ne();ie();p();import{readFile as gs,writeFile as Ge}from"fs/promises";import hs from"deepmerge";import{parse as ys}from"jsonc-parser";var Ve={compilerOptions:{strictNullChecks:!0}},B="./tsconfig.json",W={exists:()=>a(B),create:()=>Ge(B,JSON.stringify(Ve,null,2)),update:async()=>{let e=await gs(B,"utf-8"),s=ys(e)||{},n=hs(s,Ve);await Ge(B,JSON.stringify(n,null,2))}};p();var Ke=f.devDependencies["@biomejs/biome"],Xe=f.version,vs=async(e,t=!0)=>{let s=m();s.start("Installing dependencies...");let n=[`ultracite@${Xe}`,`@biomejs/biome@${Ke}`];if(t)for(let o of n)await bs(o,{packageManager:e,workspace:await g()});else await C({devDependencies:{"@biomejs/biome":Ke,ultracite:Xe}});s.stop("Dependencies installed.")},xs=async()=>{let e=m();if(e.start("Checking for tsconfig.json..."),await W.exists()){e.message("tsconfig.json found, updating..."),await W.update(),e.stop("tsconfig.json updated.");return}e.message("tsconfig.json not found, creating..."),await W.create(),e.stop("tsconfig.json created.")},Ds=async()=>{let e=m();if(e.start("Checking for .vscode/settings.json..."),await M.exists()){e.message("settings.json found, updating..."),await M.update(),e.stop("settings.json updated.");return}e.message("settings.json not found, creating..."),await M.create(),e.message("settings.json created."),e.message("Installing Biome extension...");try{M.extension(),e.stop("settings.json created.")}catch(t){e.stop(`Failed to install Biome extension (${t}), but continuing...`)}},js=async()=>{let e=m();if(e.start("Checking for .zed/settings.json..."),await J.exists()){e.message("settings.json found, updating..."),await J.update(),e.stop("settings.json updated.");return}e.message("settings.json not found, creating..."),await J.create(),e.message("settings.json created. Install the Biome extension: https://biomejs.dev/reference/zed/")},Cs=async()=>{let e=m();if(e.start("Checking for Biome configuration..."),await $.exists()){e.message("Biome configuration found, updating..."),await $.update(),e.stop("Biome configuration updated.");return}e.message("Biome configuration not found, creating..."),await $.create(),e.stop("Biome configuration created.")},Ps=async(e,t=!0)=>{let s=m();if(s.start("Initializing pre-commit hooks..."),s.message("Installing Husky..."),t?await v.install(e):await C({devDependencies:{husky:"latest"}}),await v.exists()){s.message("Pre-commit hook found, updating..."),await v.update(e),s.stop("Pre-commit hook updated.");return}s.message("Pre-commit hook not found, creating..."),await v.create(e),s.stop("Pre-commit hook created.")},Ss=async(e,t=!0)=>{let s=m();if(s.start("Initializing lefthook..."),s.message("Installing lefthook..."),t?await x.install(e):await C({devDependencies:{lefthook:"latest"}}),await x.exists()){s.message("lefthook.yml found, updating..."),await x.update(e),s.stop("lefthook.yml updated.");return}s.message("lefthook.yml not found, creating..."),await x.create(e),s.stop("lefthook.yml created.")},Rs=async(e,t=!0)=>{let s=m();if(s.start("Initializing lint-staged..."),s.message("Installing lint-staged..."),t?await D.install(e):await C({devDependencies:{"lint-staged":"latest"}}),await D.exists()){s.message("lint-staged found, updating..."),await D.update(e),s.stop("lint-staged updated.");return}s.message("lint-staged not found, creating..."),await D.create(e),s.stop("lint-staged created.")},Ms=async(e,t)=>{let s=m();s.start(`Checking for ${t}...`);let n=$e(e);if(await n.exists()){s.message(`${t} found, updating...`),await n.update(),s.stop(`${t} updated.`);return}s.message(`${t} not found, creating...`),await n.create(),s.stop(`${t} created.`)},As=async e=>{let t=m();t.start("Removing Prettier dependencies and configuration...");try{let s=await Q.remove(e);s.packagesRemoved.length>0&&t.message(`Removed Prettier packages: ${s.packagesRemoved.join(", ")}`),s.filesRemoved.length>0&&t.message(`Removed config files: ${s.filesRemoved.join(", ")}`),s.vsCodeCleaned&&t.message("Cleaned VS Code settings"),t.stop("Prettier removed successfully.")}catch{t.stop("Failed to remove Prettier completely, but continuing...")}},Ns=async e=>{let t=m();t.start("Removing ESLint dependencies and configuration...");try{let s=await Z.remove(e);s.packagesRemoved.length>0&&t.message(`Removed ESLint packages: ${s.packagesRemoved.join(", ")}`),s.filesRemoved.length>0&&t.message(`Removed config files: ${s.filesRemoved.join(", ")}`),s.vsCodeCleaned&&t.message("Cleaned VS Code settings"),t.stop("ESLint removed successfully.")}catch{t.stop("Failed to remove ESLint completely, but continuing...")}},Ye=async e=>{ws(ue);try{let t=e??{},{pm:s}=t;if(!s){let d=await ks(He.cwd());if(!d)throw new Error("No package manager specified or detected");if(d.warnings)for(let k of d.warnings)q.warn(k);q.info(`Detected lockfile, using ${d.name}`),s=d.name}let n=t.removePrettier,o=t.removeEslint;if(n===void 0||o===void 0){let d=[];if(n===void 0&&await Q.hasPrettier()&&d.push({label:"Remove Prettier (dependencies, config files, VS Code settings)",value:"prettier"}),o===void 0&&await Z.hasESLint()&&d.push({label:"Remove ESLint (dependencies, config files, VS Code settings)",value:"eslint"}),d.length>0){let k=await G({message:"Remove existing formatters/linters (recommended for clean migration)?",options:d,required:!1});n===void 0&&(n=k.includes("prettier")),o===void 0&&(o=k.includes("eslint"))}}let i=t.editors;i||(i=await G({message:"Which editors do you want to configure (recommended)?",options:[{label:"VSCode / Cursor / Windsurf",value:"vscode"},{label:"Zed",value:"zed"}],required:!1}));let r=t.rules,l={"vscode-copilot":"GitHub Copilot (VSCode)",cursor:"Cursor",windsurf:"Windsurf",zed:"Zed",claude:"Claude Code",codex:"OpenAI Codex / Jules / OpenCode",kiro:"Kiro IDE",cline:"Cline",amp:"AMP",aider:"Aider","firebase-studio":"Firebase Studio","open-hands":"Open Hands","gemini-cli":"Gemini CLI",junie:"Junie",augmentcode:"Augment Code","kilo-code":"Kilo Code",goose:"Codename Goose"};r||(r=await G({message:"Which editor rules do you want to enable (optional)?",options:Object.entries(l).map(([d,k])=>({value:d,label:k})),required:!1}));let u=t.integrations;u===void 0&&(t.pm||t.editors||t.rules||t.removePrettier!==void 0||t.removeEslint!==void 0?u=[]:u=await G({message:"Would you like any of the following (optional)?",options:[{label:"Husky pre-commit hook",value:"husky"},{label:"Lefthook pre-commit hook",value:"lefthook"},{label:"Lint-staged",value:"lint-staged"}],required:!1})),n&&await As(s),o&&await Ns(s),await vs(s,!t.skipInstall),await xs(),await Cs(),i?.includes("vscode")&&await Ds(),i?.includes("zed")&&await js();for(let d of r??[])await Ms(d,l[d]);u?.includes("husky")&&await Ps(s,!t.skipInstall),u?.includes("lefthook")&&await Ss(s,!t.skipInstall),u?.includes("lint-staged")&&await Rs(s,!t.skipInstall),q.success("Successfully initialized Ultracite configuration!")}catch(t){let s=t instanceof Error?t.message:"Unknown error";q.error(`Failed to initialize Ultracite configuration: ${s}`),He.exit(1)}};var b=Us.initTRPC.meta().create(),Es=b.router({init:b.procedure.meta({description:"Initialize Ultracite in the current directory"}).input(c.object({pm:c.enum(R.packageManagers).optional().describe("Package manager to use"),editors:c.array(c.enum(R.editorConfigs)).optional().describe("Editors to configure"),rules:c.array(c.enum(R.editorRules)).optional().describe("Editor rules to enable"),integrations:c.array(c.enum(R.integrations)).optional().describe("Additional integrations to enable"),removePrettier:c.boolean().optional().describe("Remove Prettier dependencies and configuration"),removeEslint:c.boolean().optional().describe("Remove ESLint dependencies and configuration"),skipInstall:c.boolean().default(!1).describe("Skip installing dependencies")})).mutation(async({input:e})=>{await Ye(e)}),check:b.procedure.meta({description:"Run Biome linter without fixing files"}).input(c.array(c.string()).optional().default([]).describe("specific files to lint")).query(({input:e})=>{Y(e)}),fix:b.procedure.meta({description:"Run Biome linter and fixes files"}).input(c.tuple([c.array(c.string()).optional().default([]).describe("specific files to format"),c.object({unsafe:c.boolean().optional().describe("apply unsafe fixes")})])).mutation(({input:e})=>{let[t,s]=e;ee(t,{unsafe:s.unsafe})}),doctor:b.procedure.meta({description:"Verify your Ultracite setup and check for issues"}).query(async()=>{await be()}),lint:b.procedure.meta({description:"\u26A0\uFE0F DEPRECATED: Use 'check' instead - Run Biome linter without fixing files"}).input(c.array(c.string()).optional().default([]).describe("specific files to lint")).query(({input:e})=>{console.warn("\u26A0\uFE0F Warning: 'lint' command is deprecated. Please use 'check' instead."),Y(e)}),format:b.procedure.meta({description:"\u26A0\uFE0F DEPRECATED: Use 'fix' instead - Run Biome linter and fixes files"}).input(c.tuple([c.array(c.string()).optional().default([]).describe("specific files to format"),c.object({unsafe:c.boolean().optional().describe("apply unsafe fixes")})])).mutation(({input:e})=>{let[t,s]=e;console.warn("\u26A0\uFE0F Warning: 'format' command is deprecated. Please use 'fix' instead."),ee(t,{unsafe:s.unsafe})})}),Is=Fs({router:Es,name:f.name,version:f.version,description:f.description});process.env.VITEST||Is.run();export{Es as router};
206
+ ${M}`)}else await J(t.path,s)}}};se();ne();ie();p();import{readFile as hs,writeFile as He}from"fs/promises";import ys from"deepmerge";import{parse as ws}from"jsonc-parser";var Ve={compilerOptions:{strictNullChecks:!0}},B="./tsconfig.json",W={exists:()=>a(B),create:()=>He(B,JSON.stringify(Ve,null,2)),update:async()=>{let e=await hs(B,"utf-8"),s=ws(e)||{},n=ys(s,Ve);await He(B,JSON.stringify(n,null,2))}};p();var Ye=f.devDependencies["@biomejs/biome"],Ke=f.version,xs=async(e,t=!0)=>{let s=m();s.start("Installing dependencies...");let n=[`ultracite@${Ke}`,`@biomejs/biome@${Ye}`];if(t)for(let o of n)await ks(o,{packageManager:e,workspace:await g()});else await C({devDependencies:{"@biomejs/biome":Ye,ultracite:Ke}});s.stop("Dependencies installed.")},Ds=async()=>{let e=m();if(e.start("Checking for tsconfig.json..."),await W.exists()){e.message("tsconfig.json found, updating..."),await W.update(),e.stop("tsconfig.json updated.");return}e.message("tsconfig.json not found, creating..."),await W.create(),e.stop("tsconfig.json created.")},js=async()=>{let e=m();if(e.start("Checking for .vscode/settings.json..."),await A.exists()){e.message("settings.json found, updating..."),await A.update(),e.stop("settings.json updated.");return}e.message("settings.json not found, creating..."),await A.create(),e.message("settings.json created."),e.message("Installing Biome extension...");try{A.extension(),e.stop("settings.json created.")}catch(t){e.stop(`Failed to install Biome extension (${t}), but continuing...`)}},Cs=async()=>{let e=m();if(e.start("Checking for .zed/settings.json..."),await _.exists()){e.message("settings.json found, updating..."),await _.update(),e.stop("settings.json updated.");return}e.message("settings.json not found, creating..."),await _.create(),e.message("settings.json created. Install the Biome extension: https://biomejs.dev/reference/zed/")},Ss=async()=>{let e=m();if(e.start("Checking for Biome configuration..."),await U.exists()){e.message("Biome configuration found, updating..."),await U.update(),e.stop("Biome configuration updated.");return}e.message("Biome configuration not found, creating..."),await U.create(),e.stop("Biome configuration created.")},Ps=async(e,t=!0)=>{let s=m();if(s.start("Initializing pre-commit hooks..."),s.message("Installing Husky..."),t?await v.install(e):await C({devDependencies:{husky:"latest"}}),await v.exists()){s.message("Pre-commit hook found, updating..."),await v.update(e),s.stop("Pre-commit hook updated.");return}s.message("Pre-commit hook not found, creating..."),await v.create(e),s.stop("Pre-commit hook created.")},Rs=async(e,t=!0)=>{let s=m();if(s.start("Initializing lefthook..."),s.message("Installing lefthook..."),t?await x.install(e):await C({devDependencies:{lefthook:"latest"}}),await x.exists()){s.message("lefthook.yml found, updating..."),await x.update(e),s.stop("lefthook.yml updated.");return}s.message("lefthook.yml not found, creating..."),await x.create(e),s.stop("lefthook.yml created.")},As=async(e,t=!0)=>{let s=m();if(s.start("Initializing lint-staged..."),s.message("Installing lint-staged..."),t?await D.install(e):await C({devDependencies:{"lint-staged":"latest"}}),await D.exists()){s.message("lint-staged found, updating..."),await D.update(e),s.stop("lint-staged updated.");return}s.message("lint-staged not found, creating..."),await D.create(e),s.stop("lint-staged created.")},Ms=async(e,t)=>{let s=m();s.start(`Checking for ${t}...`);let n=Ue(e);if(await n.exists()){s.message(`${t} found, updating...`),await n.update(),s.stop(`${t} updated.`);return}s.message(`${t} not found, creating...`),await n.create(),s.stop(`${t} created.`)},Es=async e=>{let t=m();t.start("Removing Prettier dependencies and configuration...");try{let s=await Q.remove(e);s.packagesRemoved.length>0&&t.message(`Removed Prettier packages: ${s.packagesRemoved.join(", ")}`),s.filesRemoved.length>0&&t.message(`Removed config files: ${s.filesRemoved.join(", ")}`),s.vsCodeCleaned&&t.message("Cleaned VS Code settings"),t.stop("Prettier removed successfully.")}catch{t.stop("Failed to remove Prettier completely, but continuing...")}},$s=async e=>{let t=m();t.start("Removing ESLint dependencies and configuration...");try{let s=await Z.remove(e);s.packagesRemoved.length>0&&t.message(`Removed ESLint packages: ${s.packagesRemoved.join(", ")}`),s.filesRemoved.length>0&&t.message(`Removed config files: ${s.filesRemoved.join(", ")}`),s.vsCodeCleaned&&t.message("Cleaned VS Code settings"),t.stop("ESLint removed successfully.")}catch{t.stop("Failed to remove ESLint completely, but continuing...")}},Ze=async e=>{bs(de);try{let t=e??{},{pm:s}=t;if(!s){let u=await vs(Xe.cwd());if(!u)throw new Error("No package manager specified or detected");if(u.warnings)for(let k of u.warnings)q.warn(k);q.info(`Detected lockfile, using ${u.name}`),s=u.name}let n=t.removePrettier,o=t.removeEslint;if(n===void 0||o===void 0){let u=[];if(n===void 0&&await Q.hasPrettier()&&u.push({label:"Remove Prettier (dependencies, config files, VS Code settings)",value:"prettier"}),o===void 0&&await Z.hasESLint()&&u.push({label:"Remove ESLint (dependencies, config files, VS Code settings)",value:"eslint"}),u.length>0){let k=await G({message:"Remove existing formatters/linters (recommended for clean migration)?",options:u,required:!1});n===void 0&&(n=k.includes("prettier")),o===void 0&&(o=k.includes("eslint"))}}let i=t.editors;i||(i=await G({message:"Which editors do you want to configure (recommended)?",options:[{label:"VSCode / Cursor / Windsurf",value:"vscode"},{label:"Zed",value:"zed"}],required:!1}));let r=t.rules,l={"vscode-copilot":"GitHub Copilot (VSCode)",cursor:"Cursor",windsurf:"Windsurf",zed:"Zed",claude:"Claude Code",codex:"OpenAI Codex / Jules / OpenCode",kiro:"Kiro IDE",cline:"Cline",amp:"AMP",aider:"Aider","firebase-studio":"Firebase Studio","open-hands":"Open Hands","gemini-cli":"Gemini CLI",junie:"Junie",augmentcode:"Augment Code","kilo-code":"Kilo Code",goose:"Codename Goose"};r||(r=await G({message:"Which editor rules do you want to enable (optional)?",options:Object.entries(l).map(([u,k])=>({value:u,label:k})),required:!1}));let d=t.integrations;d===void 0&&(t.pm||t.editors||t.rules||t.removePrettier!==void 0||t.removeEslint!==void 0?d=[]:d=await G({message:"Would you like any of the following (optional)?",options:[{label:"Husky pre-commit hook",value:"husky"},{label:"Lefthook pre-commit hook",value:"lefthook"},{label:"Lint-staged",value:"lint-staged"}],required:!1})),n&&await Es(s),o&&await $s(s),await xs(s,!t.skipInstall),await Ds(),await Ss(),i?.includes("vscode")&&await js(),i?.includes("zed")&&await Cs();for(let u of r??[])await Ms(u,l[u]);d?.includes("husky")&&await Ps(s,!t.skipInstall),d?.includes("lefthook")&&await Rs(s,!t.skipInstall),d?.includes("lint-staged")&&await As(s,!t.skipInstall),q.success("Successfully initialized Ultracite configuration!")}catch(t){let s=t instanceof Error?t.message:"Unknown error";q.error(`Failed to initialize Ultracite configuration: ${s}`),Xe.exit(1)}};var b=Ns.initTRPC.meta().create(),Is=b.router({init:b.procedure.meta({description:"Initialize Ultracite in the current directory"}).input(c.object({pm:c.enum(R.packageManagers).optional().describe("Package manager to use"),editors:c.array(c.enum(R.editorConfigs)).optional().describe("Editors to configure"),rules:c.array(c.enum(R.editorRules)).optional().describe("Editor rules to enable"),integrations:c.array(c.enum(R.integrations)).optional().describe("Additional integrations to enable"),removePrettier:c.boolean().optional().describe("Remove Prettier dependencies and configuration"),removeEslint:c.boolean().optional().describe("Remove ESLint dependencies and configuration"),skipInstall:c.boolean().default(!1).describe("Skip installing dependencies")})).mutation(async({input:e})=>{await Ze(e)}),check:b.procedure.meta({description:"Run Biome linter without fixing files"}).input(c.array(c.string()).optional().default([]).describe("specific files to lint")).query(({input:e})=>{K(e)}),fix:b.procedure.meta({description:"Run Biome linter and fixes files"}).input(c.tuple([c.array(c.string()).optional().default([]).describe("specific files to format"),c.object({unsafe:c.boolean().optional().describe("apply unsafe fixes")})])).mutation(({input:e})=>{let[t,s]=e;ee(t,{unsafe:s.unsafe})}),doctor:b.procedure.meta({description:"Verify your Ultracite setup and check for issues"}).query(async()=>{await be()}),lint:b.procedure.meta({description:"\u26A0\uFE0F DEPRECATED: Use 'check' instead - Run Biome linter without fixing files"}).input(c.array(c.string()).optional().default([]).describe("specific files to lint")).query(({input:e})=>{console.warn("\u26A0\uFE0F Warning: 'lint' command is deprecated. Please use 'check' instead."),K(e)}),format:b.procedure.meta({description:"\u26A0\uFE0F DEPRECATED: Use 'fix' instead - Run Biome linter and fixes files"}).input(c.tuple([c.array(c.string()).optional().default([]).describe("specific files to format"),c.object({unsafe:c.boolean().optional().describe("apply unsafe fixes")})])).mutation(({input:e})=>{let[t,s]=e;console.warn("\u26A0\uFE0F Warning: 'format' command is deprecated. Please use 'fix' instead."),ee(t,{unsafe:s.unsafe})})}),Us=Fs({router:Is,name:f.name,version:f.version,description:f.description});process.env.VITEST||Us.run();export{Is as router};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ultracite",
3
3
  "description": "The AI-ready formatter that helps you write and generate code faster.",
4
- "version": "5.3.0",
4
+ "version": "5.3.1",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "ultracite": "dist/index.js"