ultracite 6.4.0 → 6.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config/core/biome.jsonc +21 -15
- package/config/vue/biome.jsonc +1 -0
- package/dist/index.js +32 -32
- package/package.json +3 -3
package/config/core/biome.jsonc
CHANGED
|
@@ -212,13 +212,13 @@
|
|
|
212
212
|
"useYield": "error",
|
|
213
213
|
|
|
214
214
|
"noNodejsModules": "off",
|
|
215
|
-
"noPrivateImports": "off",
|
|
216
215
|
"noProcessGlobal": "off",
|
|
217
|
-
"noUndeclaredDependencies": "off",
|
|
218
|
-
"useImportExtensions": "off",
|
|
219
216
|
"useUniqueElementIds": "off",
|
|
220
217
|
|
|
221
218
|
/** ------ Project rules use Scanner and are too slow (https://biomejs.dev/linter/domains/#project-rules) ------ **/
|
|
219
|
+
"noPrivateImports": "off",
|
|
220
|
+
"noUndeclaredDependencies": "off",
|
|
221
|
+
"useImportExtensions": "off",
|
|
222
222
|
"useJsonImportAttributes": "off",
|
|
223
223
|
|
|
224
224
|
/** ------------------------ CSS Rules ------------------------ **/
|
|
@@ -236,6 +236,7 @@
|
|
|
236
236
|
"noUnmatchableAnbSelector": "error"
|
|
237
237
|
},
|
|
238
238
|
"nursery": {
|
|
239
|
+
"noAmbiguousAnchorText": "error",
|
|
239
240
|
"noDuplicateDependencies": "error",
|
|
240
241
|
"noDuplicatedSpreadProps": "error",
|
|
241
242
|
"noEmptySource": "error",
|
|
@@ -250,25 +251,16 @@
|
|
|
250
251
|
"noMultiStr": "error",
|
|
251
252
|
"noParametersOnlyUsedInRecursion": "error",
|
|
252
253
|
"noProto": "error",
|
|
254
|
+
"noScriptUrl": "error",
|
|
253
255
|
"noShadow": "error",
|
|
254
256
|
"noSyncScripts": "error",
|
|
257
|
+
"noUndeclaredEnvVars": "error",
|
|
255
258
|
"noUnusedExpressions": "error",
|
|
256
259
|
"noUselessUndefined": "error",
|
|
257
260
|
"useConsistentArrowReturn": "error",
|
|
258
261
|
"useConsistentGraphqlDescriptions": "error",
|
|
259
262
|
"useDeprecatedDate": "error",
|
|
260
263
|
"useMaxParams": "error",
|
|
261
|
-
"useUniqueGraphqlOperationName": "error",
|
|
262
|
-
|
|
263
|
-
"noContinue": "off",
|
|
264
|
-
"noForIn": "off",
|
|
265
|
-
"noJsxLiterals": "off",
|
|
266
|
-
"noTernary": "off",
|
|
267
|
-
"noUselessCatchBinding": "off",
|
|
268
|
-
"noUnnecessaryConditions": "off",
|
|
269
|
-
"useArraySortCompare": "off",
|
|
270
|
-
"useExplicitType": "off",
|
|
271
|
-
"useFind": "error",
|
|
272
264
|
"useSortedClasses": {
|
|
273
265
|
"fix": "safe",
|
|
274
266
|
"level": "error",
|
|
@@ -278,14 +270,28 @@
|
|
|
278
270
|
}
|
|
279
271
|
},
|
|
280
272
|
"useSpread": "error",
|
|
273
|
+
"useUniqueGraphqlOperationName": "error",
|
|
274
|
+
|
|
275
|
+
"noContinue": "off",
|
|
276
|
+
"noForIn": "off",
|
|
277
|
+
"noJsxLiterals": "off",
|
|
278
|
+
"noTernary": "off",
|
|
279
|
+
"noUselessCatchBinding": "off",
|
|
280
|
+
"useExplicitType": "off",
|
|
281
|
+
"useRequiredScripts": "off",
|
|
281
282
|
|
|
282
283
|
/** ------ Project rules use Scanner and are too slow (https://biomejs.dev/linter/domains/#project-rules) ------ **/
|
|
283
284
|
"noDeprecatedImports": "off",
|
|
284
285
|
"noFloatingPromises": "off",
|
|
285
286
|
"noMisusedPromises": "off",
|
|
287
|
+
"noUnnecessaryConditions": "off",
|
|
286
288
|
"noUnresolvedImports": "off",
|
|
287
289
|
"noImportCycles": "off",
|
|
288
|
-
"
|
|
290
|
+
"useArraySortCompare": "off",
|
|
291
|
+
"useAwaitThenable": "off",
|
|
292
|
+
"useFind": "off",
|
|
293
|
+
"useExhaustiveSwitchCases": "off",
|
|
294
|
+
"useRegexpExec": "off"
|
|
289
295
|
},
|
|
290
296
|
"performance": {
|
|
291
297
|
/** ------------------------ JavaScript Rules ------------------------ **/
|
package/config/vue/biome.jsonc
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var
|
|
2
|
+
var ie=Object.defineProperty;var lt=Object.getOwnPropertyDescriptor;var dt=Object.getOwnPropertyNames;var ft=Object.prototype.hasOwnProperty;var re=(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')}),Pe=e=>t=>{var s=e[t];if(s)return s();throw new Error("Module not found in bundle: "+t)};var U=(e,t)=>()=>(e&&(t=e(e=0)),t);var ae=(e,t)=>{for(var s in t)ie(e,s,{get:t[s],enumerable:!0})},mt=(e,t,s,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of dt(t))!ft.call(e,o)&&o!==s&&ie(e,o,{get:()=>t[o],enumerable:!(n=lt(t,o))||n.enumerable});return e};var ce=e=>mt(ie({},"__esModule",{value:!0}),e);import{access as Ct,readFile as $e,writeFile as jt}from"fs/promises";import{parse as Pt}from"jsonc-parser";var f,C,H,v,St,$t,z,h=U(()=>{"use strict";f=async e=>{try{return await Ct(e),!0}catch{return!1}},C=async()=>{if(await f("pnpm-workspace.yaml"))return!0;try{let e=Pt(await $e("package.json","utf-8"));return e?!!e.workspaces||!!e.workspace:!1}catch{return!1}},H=`
|
|
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,7 +8,7 @@ var re=Object.defineProperty;var at=Object.getOwnPropertyDescriptor;var ct=Objec
|
|
|
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
|
-
`,v=async({dependencies:
|
|
11
|
+
`,v=async({dependencies:e,devDependencies:t,scripts:s})=>{let n=await $e("package.json","utf8"),o=JSON.parse(n),i={...o};(o.devDependencies||t)&&(i.devDependencies={...o.devDependencies,...t}),(o.dependencies||e)&&(i.dependencies={...o.dependencies,...e}),(o.scripts||s)&&(i.scripts={...o.scripts,...s}),await jt("package.json",JSON.stringify(i,null,2))},St=/[ $(){}[\]&|;<>!"'`*?#~]/,$t=/'/g,z=e=>e.map(t=>St.test(t)?`'${t.replace($t,"'\\''")}' `:t)});var Ze={};ae(Ze,{husky:()=>$});import{execSync as Ss}from"child_process";import{mkdir as $s,readFile as Rs,writeFile as Xe}from"fs/promises";import{addDevDependency as Es,dlxCommand as ye}from"nypm";var Qe,te,$,we=U(()=>{"use strict";h();Qe=e=>`#!/bin/sh
|
|
12
12
|
# Exit on any error
|
|
13
13
|
set -e
|
|
14
14
|
|
|
@@ -31,7 +31,7 @@ git stash push --quiet --keep-index --message "pre-commit-stash" || true
|
|
|
31
31
|
STASHED=$?
|
|
32
32
|
|
|
33
33
|
# Run formatter on the staged files
|
|
34
|
-
${
|
|
34
|
+
${e}
|
|
35
35
|
FORMAT_EXIT_CODE=$?
|
|
36
36
|
|
|
37
37
|
# Restore working directory state
|
|
@@ -76,10 +76,10 @@ if [ "$STAGED_HASH" != "$NEW_STAGED_HASH" ]; then
|
|
|
76
76
|
fi
|
|
77
77
|
|
|
78
78
|
exit $FORMAT_EXIT_CODE
|
|
79
|
-
`,
|
|
80
|
-
${
|
|
79
|
+
`,te="./.husky/pre-commit",$={exists:()=>f(te),install:async e=>{await Es("husky",{packageManager:e,workspace:await C(),silent:!0}),await v({scripts:{prepare:"husky"}})},init:e=>{let t=ye(e,"husky",{args:["init"]});try{Ss(t,{stdio:"pipe"})}catch{}},create:async e=>{await $s(".husky",{recursive:!0});let t=ye(e,"ultracite",{args:["fix"],short:e==="npm"}),s=Qe(t);await Xe(te,s)},update:async e=>{let t=await Rs(te,"utf-8"),s=ye(e,"ultracite",{args:["fix"],short:e==="npm"}),n=Qe(s);await Xe(te,`${t}
|
|
80
|
+
${n}`)}}});var st={};ae(st,{lefthook:()=>D});import{execSync as As}from"child_process";import{readFile as Fs,writeFile as B}from"fs/promises";import{addDevDependency as Ds,dlxCommand as et}from"nypm";var Ns,Os,tt,R,qe,D,ke=U(()=>{"use strict";h();Ns=/(pre-commit:\s*\n\s*jobs:\s*\n)/,Os=/(pre-commit:\s*\n)/,tt=e=>et(e,"ultracite",{args:["fix"],short:e==="npm"}),R="./lefthook.yml",qe=e=>`pre-commit:
|
|
81
81
|
jobs:
|
|
82
|
-
- run: ${
|
|
82
|
+
- run: ${tt(e)}
|
|
83
83
|
glob:
|
|
84
84
|
- "*.js"
|
|
85
85
|
- "*.jsx"
|
|
@@ -89,7 +89,7 @@ ${s}`)}}});var et={};ce(et,{lefthook:()=>D});import{execSync as $n}from"child_pr
|
|
|
89
89
|
- "*.jsonc"
|
|
90
90
|
- "*.css"
|
|
91
91
|
stage_fixed: true
|
|
92
|
-
`,D={exists:()=>f(
|
|
92
|
+
`,D={exists:()=>f(R),install:async e=>{await Ds("lefthook",{packageManager:e,workspace:await C(),silent:!0}),await v({scripts:{prepare:"lefthook install"}});let t=et(e,"lefthook",{args:["install"],short:e==="npm"});As(t,{stdio:"pipe"})},create:async e=>{let t=qe(e);await B(R,t)},update:async e=>{let t=await Fs(R,"utf-8"),s=tt(e),n=qe(e);if(t.includes(s))return;if(t.startsWith("# EXAMPLE USAGE:")){await B(R,n);return}if(t.includes("pre-commit:"))if(t.includes("jobs:")){let i=` - run: ${s}
|
|
93
93
|
glob:
|
|
94
94
|
- "*.js"
|
|
95
95
|
- "*.jsx"
|
|
@@ -98,9 +98,9 @@ ${s}`)}}});var et={};ce(et,{lefthook:()=>D});import{execSync as $n}from"child_pr
|
|
|
98
98
|
- "*.json"
|
|
99
99
|
- "*.jsonc"
|
|
100
100
|
- "*.css"
|
|
101
|
-
stage_fixed: true`,
|
|
102
|
-
`);await
|
|
103
|
-
- run: ${
|
|
101
|
+
stage_fixed: true`,a=t.replace(Ns,`$1${i}
|
|
102
|
+
`);await B(R,a)}else{let i=` jobs:
|
|
103
|
+
- run: ${s}
|
|
104
104
|
glob:
|
|
105
105
|
- "*.js"
|
|
106
106
|
- "*.jsx"
|
|
@@ -109,37 +109,37 @@ ${s}`)}}});var et={};ce(et,{lefthook:()=>D});import{execSync as $n}from"child_pr
|
|
|
109
109
|
- "*.json"
|
|
110
110
|
- "*.jsonc"
|
|
111
111
|
- "*.css"
|
|
112
|
-
stage_fixed: true`,
|
|
113
|
-
`);await
|
|
114
|
-
${
|
|
115
|
-
`).filter(i=>i.trim()&&!i.trim().startsWith("#")),
|
|
116
|
-
`;for(let o of
|
|
117
|
-
`}else
|
|
118
|
-
`;return
|
|
119
|
-
`;await
|
|
120
|
-
`;await
|
|
121
|
-
`);return{line:
|
|
122
|
-
`),{line:
|
|
123
|
-
${m.red("Error:")} No output received from Biome. The command may have failed silently.`,hasErrors:!0};try{let
|
|
124
|
-
`),hasErrors:
|
|
112
|
+
stage_fixed: true`,a=t.replace(Os,`$1${i}
|
|
113
|
+
`);await B(R,a)}else await B(R,`${t}
|
|
114
|
+
${n}`)}}});var Ms,be=U(()=>{Ms=Pe({"./husky.ts":()=>(we(),ce(Ze)),"./lefthook.ts":()=>(ke(),ce(st)),"./lint-staged.ts":()=>(xe(),ce(nt))})});var nt={};ae(nt,{lintStaged:()=>N});import{readFile as se,writeFile as E}from"fs/promises";import{pathToFileURL as Ts}from"url";import L from"deepmerge";import{parse as Ce}from"jsonc-parser";import{addDevDependency as Us,dlxCommand as Is}from"nypm";var P,ot,Js,_s,Bs,Ls,Ws,Hs,zs,Gs,Vs,ve,Ys,N,xe=U(()=>{"use strict";h();be();P=e=>({"*.{js,jsx,ts,tsx,json,jsonc,css,scss,md,mdx}":[Is(e,"ultracite",{args:["fix"],short:e==="npm"})]}),ot=["./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"],Js=(e,t,s,n)=>{let o=e.trim();if(o.includes(":")&&!o.startsWith("-")){s&&n.length>0&&(t[s]=n);let[i,...a]=o.split(":"),r=a.join(":").trim(),c=i.trim().replace(/['"]/g,"");return r&&r!==""?(r.startsWith("[")&&r.endsWith("]")?t[c]=r.slice(1,-1).split(",").map(p=>p.trim().replace(/['"]/g,"")):t[c]=r.replace(/['"]/g,""),{newCurrentKey:null,newCurrentArray:[]}):{newCurrentKey:c,newCurrentArray:[]}}if(o.startsWith("-")&&s){let i=[...n,o.slice(1).trim().replace(/['"]/g,"")];return{newCurrentKey:s,newCurrentArray:i}}return{newCurrentKey:s,newCurrentArray:n}},_s=e=>{let t=e.split(`
|
|
115
|
+
`).filter(i=>i.trim()&&!i.trim().startsWith("#")),s={},n=null,o=[];for(let i of t){let a=Js(i,s,n,o);n=a.newCurrentKey,o=a.newCurrentArray}return n&&o.length>0&&(s[n]=o),s},Bs=e=>{let t="";for(let[s,n]of Object.entries(e))if(Array.isArray(n)){t+=`${s}:
|
|
116
|
+
`;for(let o of n)t+=` - '${o}'
|
|
117
|
+
`}else t+=`${s}: '${n}'
|
|
118
|
+
`;return t},Ls=async()=>{try{let e=Ce(await se("./package.json","utf-8"));return e?e.type==="module":!1}catch{return!1}},Ws=async e=>{let t=Ce(await se("./package.json","utf-8"));t&&(t["lint-staged"]?t["lint-staged"]=L(t["lint-staged"],P(e)):t["lint-staged"]=P(e),await E("./package.json",JSON.stringify(t,null,2)))},Hs=async(e,t)=>{let s=await se(e,"utf-8"),n=Ce(s);if(!n)return;let o=L(n,P(t));await E(e,JSON.stringify(o,null,2))},zs=async(e,t)=>{let s=await se(e,"utf-8"),n=_s(s);if(!n)return;let o=L(n,P(t));await E(e,Bs(o))},Gs=async(e,t)=>{let o=(await import(Ts(e).href)).default||{},i=L(o,P(t)),a=`export default ${JSON.stringify(i,null,2)};
|
|
119
|
+
`;await E(e,a)},Vs=async(e,t)=>{delete re.cache[re.resolve(`./${e}`)];let s=Ms(`./${e}`),n=L(s,P(t)),o=`module.exports = ${JSON.stringify(n,null,2)};
|
|
120
|
+
`;await E(e,o)},ve=async e=>{await E(".lintstagedrc.json",JSON.stringify(P(e),null,2))},Ys=async(e,t)=>{if(e==="./package.json"){await Ws(t);return}if(e.endsWith(".json")||e==="./.lintstagedrc"){await Hs(e,t);return}if(e.endsWith(".yaml")||e.endsWith(".yml")){await zs(e,t);return}let s=await Ls();if(e.endsWith(".mjs")||e.endsWith(".js")&&s){try{await Gs(e,t)}catch{await ve(t)}return}if(e.endsWith(".cjs")||e.endsWith(".js")&&!s)try{await Vs(e,t)}catch{await ve(t)}},N={exists:async()=>{for(let e of ot)if(await f(e))return!0;return!1},install:async e=>{await Us("lint-staged",{packageManager:e,workspace:await C(),silent:!0})},create:async e=>{await E(".lintstagedrc.json",JSON.stringify(P(e),null,2))},update:async e=>{let t=null;for(let s of ot)if(await f(s)){t=s;break}if(!t){await ve(e);return}await Ys(t,e)}}});import{initTRPC as kn}from"@trpc/server";import{createCli as bn}from"trpc-cli";import l from"zod";var k={name:"ultracite",description:"The AI-ready formatter that helps you write and generate code faster.",version:"6.4.2",type:"module",bin:{ultracite:"dist/index.js"},files:["config","dist","README.md"],scripts:{build:"tsup",test:"bun test","test:coverage":"bun test --coverage"},exports:{"./*":"./config/*/biome.jsonc"},author:"Hayden Bleasel <hello@haydenbleasel.com>",bugs:{url:"https://github.com/haydenbleasel/ultracite/issues"},homepage:"https://www.ultracite.ai/",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:{"@biomejs/biome":"2.3.10","@types/node":"^25.0.0",tsup:"^8.5.1",turbo:"^2.6.3"},dependencies:{"@clack/prompts":"^0.11.0","@trpc/server":"^11.8.0",deepmerge:"^4.3.1",glob:"^13.0.0","jsonc-parser":"^3.3.1",nypm:"^0.6.2",picocolors:"^1.1.1","trpc-cli":"^0.12.1",zod:"^4.1.13"},packageManager:"bun@1.3.4"};import{spawnSync as Rt}from"child_process";import Et from"process";import{detectPackageManager as At,dlxCommand as Ft}from"nypm";import m from"picocolors";var b=e=>`\x1B[38;5;208m${e}\x1B[39m`,Se=(e,t)=>{let n=e.slice(0,t[0]).split(`
|
|
121
|
+
`);return{line:n.length,column:(n.at(-1)?.length??0)+1}},ut=(e,t)=>{let s=e.split(`
|
|
122
|
+
`),{line:n,column:o}=Se(e,t),i=[],a=Math.max(1,n-1),r=Math.min(s.length,n+2);for(let c=a;c<=r;c++){let p=String(c).padStart(5," "),u=s[c-1]||"";if(c===n){i.push(`${b(">")}${m.dim(p)} ${m.gray("\u2502")} ${u}`);let x=" ".repeat(o-1),y=Math.min(t[1]-t[0],u.length-o+1),d="^".repeat(Math.max(1,y));i.push(`${m.dim(" ")} ${m.gray("\u2502")} ${x}${b(d)}`)}else i.push(` ${m.dim(p)} ${m.gray("\u2502")} ${u}`)}return i},gt=e=>{let t=e.secs*1e3+e.nanos/1e6;return t<1e3?`${Math.round(t)}ms`:`${(t/1e3).toFixed(2)}s`},ht=m.dim("\u2500".repeat(60)),yt=e=>e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),wt=e=>{let t=e.split("/");if(t.length<3||t[0]!=="lint")return null;let s=t.at(-1);return s?`https://biomejs.dev/linter/rules/${yt(s)}/`:null},kt=e=>["",`${b("Ultracite")} ${b(`v${k.version}`)} ${e}`],bt=(e,t)=>{let s=[],n=e.changed+e.unchanged,o=e.errors+e.warnings,i=gt(e.duration);if(o>0){let r=o!==1?"errors":"error";s.push(`${m.dim("Found")} ${o} ${r}${m.dim(".")}`)}let a=n!==1?"files":"file";if(s.push(`${m.green("\u2713")} ${m.dim("Finished in")} ${i} ${m.dim("on")} ${n} ${a}${m.dim(".")}`),t==="fix"&&e.changed>0){let r=e.changed!==1?"files":"file";s.push(`${m.dim("Fixed")} ${e.changed} ${r}${m.dim(".")}`)}return s},xt=e=>{let t=[],{location:s,category:n,description:o,advices:i}=e,a=s.path.file,r=a;if(s.span&&s.sourceCode){let{line:p,column:u}=Se(s.sourceCode,s.span);r=`${a}:${p}:${u}`}if(t.push(`${b(r)} ${m.dim(n)}`),t.push(m.dim(o)),s.span&&s.sourceCode){t.push("");let p=ut(s.sourceCode,s.span);for(let u of p)t.push(` ${u}`)}for(let p of i.advices)if(p.log){let[u,x]=p.log,y=b(u==="info"?"i":"!"),d=m.dim(x.map(g=>g.content).join(""));t.push(""),t.push(` ${y} ${d}`)}let c=wt(n);return c&&(t.push(""),t.push(` ${m.cyan("\u2192")} ${m.dim("Docs:")} ${m.cyan(c)}`)),t.push(""),t.push(`${ht}`),t.push(""),t},vt=(e,t)=>{if(e.length===0)return[];let s=[""],n=t==="fix"?"Here are the issues we couldn't fix automatically:":"Issues found:";s.push(`${m.yellow(n)}`),s.push("");for(let o of e)s.push(...xt(o));return s},W=(e,t)=>{if(!e.trim())return{output:`${b("Ultracite")} ${b(`v${k.version}`)} ${m.magenta(t)}
|
|
123
|
+
${m.red("Error:")} No output received from Biome. The command may have failed silently.`,hasErrors:!0};try{let s=JSON.parse(e),{summary:n,diagnostics:o}=s;return{output:[...kt(t),...bt(n,t),...vt(o,t)].join(`
|
|
124
|
+
`),hasErrors:n.errors>0}}catch{return{output:`${b("Ultracite")} ${b(`v${k.version}`)} ${m.magenta(t)}
|
|
125
125
|
${m.red("Error:")} Failed to parse Biome output.
|
|
126
126
|
|
|
127
127
|
Raw output:
|
|
128
|
-
${
|
|
128
|
+
${e}`,hasErrors:!0}}};h();var le=async e=>{let t=e?.[0]||[],s=e?.[1]["diagnostic-level"],n=["check","--no-errors-on-unmatched","--reporter=json"];s&&n.push(`--diagnostic-level=${s}`),t.length>0?n.push(...z(t)):n.push("./");let i=(await At(Et.cwd()))?.name||"npm",a=Ft(i,"@biomejs/biome",{args:n,short:i==="npm"}),r=Rt(a,{stdio:"pipe",shell:!0,maxBuffer:100*1024*1024});if(r.error)throw new Error(`Failed to run Ultracite: ${r.error.message}`);let c=r.stdout?.toString()||"",p=r.stderr?.toString()||"",u=c.trim().startsWith("{")?c:p,{output:x,hasErrors:y}=W(u,"check");return console.log(x),{hasErrors:y}};import{spawnSync as Gt}from"child_process";import{existsSync as I}from"fs";import{readFile as Oe}from"fs/promises";import{join as J}from"path";import S from"process";import{intro as Vt,log as Y,outro as me,spinner as Yt}from"@clack/prompts";import{parse as Kt}from"jsonc-parser";import{detectPackageManager as Me,dlxCommand as Te}from"nypm";h();import{readFile as Re,unlink as Dt,writeFile as Nt}from"fs/promises";import{parse as Ee}from"jsonc-parser";import{removeDependency as Ot}from"nypm";var G=[".eslintrc",".eslintrc.js",".eslintrc.json",".eslintrc.yml",".eslintrc.yaml",".eslintrc.config.js","eslint.config.js","eslint.config.mjs","eslint.config.cjs",".eslintignore"],Ae=async()=>{try{let e=await Re("package.json","utf-8"),t=Ee(e);if(!t||typeof t!="object")return[];let s=t.dependencies||{},n=t.devDependencies||{},o={...s,...n};return Object.keys(o).filter(i=>i.includes("eslint"))}catch{return[]}},Mt=async(e,t)=>{if(t.length!==0)try{for(let s of t)await Ot(s,{packageManager:e})}catch(s){console.warn(s)}},Tt=async()=>{let e=[];for(let t of G)if(await f(t))try{await Dt(t),e.push(t)}catch(s){console.warn(s)}return e},Ut=async()=>{let e="./.vscode/settings.json";if(!await f(e))return!1;try{let t=await Re(e,"utf-8"),s=Ee(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 a of i)a in o&&(delete o[a],n=!0);if("editor.codeActionsOnSave"in o){let a=o["editor.codeActionsOnSave"];if(a&&typeof a=="object"){let r=["source.fixAll.eslint","source.organizeImports.eslint"];for(let c of r)c in a&&(delete a[c],n=!0);Object.keys(a).length===0&&(o["editor.codeActionsOnSave"]=void 0)}}return n?(await Nt(e,JSON.stringify(o,null,2)),!0):!1}catch(t){return console.warn(t),!1}},It=async()=>{if((await Ae()).length>0)return!0;for(let t of G)if(await f(t))return!0;return!1},de={hasEsLint:It,remove:async e=>{let t=await Ae();await Mt(e,t);let s=await Tt(),n=await Ut();return{packagesRemoved:t,filesRemoved:s,vsCodeCleaned:n}}};h();import{readFile as Fe,unlink as Jt,writeFile as _t}from"fs/promises";import{parse as De}from"jsonc-parser";import{removeDependency as Bt}from"nypm";var V=[".prettierrc",".prettierrc.js",".prettierrc.json",".prettierrc.yml",".prettierrc.yaml",".prettierrc.config.js","prettier.config.js","prettier.config.mjs",".prettierignore"],Ne=async()=>{try{let e=await Fe("package.json","utf-8"),t=De(e);if(!t||typeof t!="object")return[];let s=t.dependencies||{},n=t.devDependencies||{},o={...s,...n};return Object.keys(o).filter(i=>i.includes("prettier"))}catch{return[]}},Lt=async(e,t)=>{if(t.length!==0)try{for(let s of t)await Bt(s,{packageManager:e})}catch(s){console.warn(s)}},Wt=async()=>{let e=[];for(let t of V)if(await f(t))try{await Jt(t),e.push(t)}catch(s){console.warn(s)}return e},Ht=async()=>{let e="./.vscode/settings.json";if(!await f(e))return!1;try{let t=await Fe(e,"utf-8"),s=De(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 r of i)r in o&&(r==="editor.defaultFormatter"&&o[r]==="esbenp.prettier-vscode"||r!=="editor.defaultFormatter")&&(delete o[r],n=!0);let a=Object.keys(o).filter(r=>r.startsWith("[")&&r.includes("javascript"));for(let r of a){let c=o[r];c&&typeof c=="object"&&"editor.defaultFormatter"in c&&c["editor.defaultFormatter"]==="esbenp.prettier-vscode"&&(delete c["editor.defaultFormatter"],n=!0,Object.keys(c).length===0&&delete o[r])}return n?(await _t(e,JSON.stringify(o,null,2)),!0):!1}catch(t){return console.warn(t),!1}},zt=async()=>{if((await Ne()).length>0)return!0;for(let t of V)if(await f(t))return!0;return!1},fe={hasPrettier:zt,remove:async e=>{let t=await Ne();await Lt(e,t);let s=await Wt(),n=await Ht();return{packagesRemoved:t,filesRemoved:s,vsCodeCleaned:n}}};h();var Xt=async()=>{let t=(await Me(S.cwd()))?.name||"npm",s=Te(t,"@biomejs/biome",{args:["--version"],short:t==="npm"}),n=Gt(s,{shell:!0,encoding:"utf-8"});return n.status===0&&n.stdout?{name:"Biome installation",status:"pass",message:`Biome is installed (${n.stdout.trim()})`}:{name:"Biome installation",status:"fail",message:"Biome is not installed or not accessible"}},Qt=async()=>{let e=J(S.cwd(),"biome.json"),t=J(S.cwd(),"biome.jsonc"),s=null;if(I(e)?s=e:I(t)&&(s=t),!s)return{name:"Biome configuration",status:"fail",message:"No biome.json or biome.jsonc file found"};try{let n=await Oe(s,"utf-8"),o=Kt(n);return Array.isArray(o?.extends)&&o.extends.includes("ultracite/core")?{name:"Biome configuration",status:"pass",message:"biome.json(c) extends ultracite/core"}:{name:"Biome configuration",status:"warn",message:"biome.json(c) exists but doesn't extend ultracite/core"}}catch{return{name:"Biome configuration",status:"fail",message:"Could not parse biome.json(c) file"}}},Zt=async()=>{let e=J(S.cwd(),"package.json");if(!I(e))return{name:"Ultracite dependency",status:"warn",message:"No package.json found"};try{let t=JSON.parse(await Oe(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"}}},qt=()=>{let e=V.some(s=>I(J(S.cwd(),s))),t=G.some(s=>I(J(S.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"}},K=async(e,t)=>{let s=Yt();s.start(`Checking ${t}...`);let n=await e();return n.status==="pass"||n.status,s.stop(n.message),n},Ue=async()=>{Vt(H);let t=(await Me(S.cwd()))?.name||"npm",s=Te(t,"ultracite",{args:["init"],short:t==="npm"}),n=[];n.push(await K(Xt,"Biome installation")),n.push(await K(Qt,"Biome configuration")),n.push(await K(Zt,"Ultracite dependency")),n.push(await K(qt,"conflicting tools"));let o=n.filter(r=>r.status==="pass").length,i=n.filter(r=>r.status==="fail").length,a=n.filter(r=>r.status==="warn").length;if(Y.info(`Summary: ${o} passed, ${a} warnings, ${i} failed`),i>0)throw Y.error(`Some checks failed. Run '${s}' to fix issues.`),me("Doctor complete"),new Error("Doctor checks failed");if(a>0){Y.warn(`Some optional improvements available. Run '${s}' to configure.`),me("Doctor complete");return}Y.success("Everything looks good!"),me("Doctor complete")};import{spawnSync as es}from"child_process";import ts from"process";import{detectPackageManager as ss,dlxCommand as ns}from"nypm";h();var pe=async(e,t={})=>{let s=["check","--write","--no-errors-on-unmatched","--reporter=json"];t.unsafe&&s.push("--unsafe"),e.length>0?s.push(...z(e)):s.push("./");let o=(await ss(ts.cwd()))?.name||"npm",i=ns(o,"@biomejs/biome",{args:s,short:o==="npm"}),a=es(i,{stdio:"pipe",shell:!0,maxBuffer:100*1024*1024});if(a.error)throw new Error(`Failed to run Ultracite: ${a.error.message}`);let r=a.stdout?.toString()||"",c=a.stderr?.toString()||"",p=r.trim().startsWith("{")?r:c,{output:u,hasErrors:x}=W(p,"fix");return console.log(u),{hasErrors:x}};import{packageManagers as os}from"nypm";var j={packageManagers:os.map(e=>e.name),editorConfigs:["vscode","zed"],agents:["vscode-copilot","cursor","windsurf","zed","claude","codex","kiro","cline","amp","aider","firebase-studio","open-hands","gemini-cli","junie","augmentcode","kilo-code","goose","roo-code","warp","droid"],integrations:["husky","lefthook","lint-staged"],hooks:["cursor","claude"],frameworks:["react","next","solid","vue","svelte","qwik","remix","angular","astro"],migrations:["eslint","prettier"]};import sn from"process";import{cancel as O,intro as nn,isCancel as M,log as ne,multiselect as T,spinner as w}from"@clack/prompts";import{addDevDependency as on,detectPackageManager as rn}from"nypm";import{mkdir as is,readFile as rs,writeFile as X}from"fs/promises";import{dirname as as}from"path";import{dlxCommand as cs}from"nypm";var Ie={"vscode-copilot":{path:"./.github/copilot-instructions.md",header:`---
|
|
129
129
|
applyTo: "**/*.{ts,tsx,js,jsx}"
|
|
130
130
|
---`,appendMode:!0},cursor:{path:"./.cursor/rules/ultracite.mdc",header:`---
|
|
131
131
|
description: Ultracite Rules - AI-Ready Formatter and Linter
|
|
132
132
|
globs: "**/*.{ts,tsx,js,jsx,json,jsonc,html,vue,svelte,astro,css,yaml,yml,graphql,gql,md,mdx,grit}"
|
|
133
133
|
alwaysApply: false
|
|
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},"roo-code":{path:"./.roo/rules/ultracite.md",appendMode:!0},warp:{path:"./WARP.md",appendMode:!0},droid:{path:"./AGENTS.md",appendMode:!0}},
|
|
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},"roo-code":{path:"./.roo/rules/ultracite.md",appendMode:!0},warp:{path:"./WARP.md",appendMode:!0},droid:{path:"./AGENTS.md",appendMode:!0}},Je={cursor:{path:"./.cursor/hooks.json"},claude:{path:"./.claude/settings.json"}};h();var _e=e=>`# Ultracite Code Standards
|
|
135
135
|
|
|
136
136
|
This project uses **Ultracite**, a zero-config Biome preset that enforces strict code quality standards through automated formatting and linting.
|
|
137
137
|
|
|
138
138
|
## Quick Reference
|
|
139
139
|
|
|
140
|
-
- **Format code**:
|
|
141
|
-
- **Check for issues**:
|
|
142
|
-
- **Diagnose setup**:
|
|
140
|
+
- **Format code**: \`${e} ultracite fix\`
|
|
141
|
+
- **Check for issues**: \`${e} ultracite check\`
|
|
142
|
+
- **Diagnose setup**: \`${e} ultracite doctor\`
|
|
143
143
|
|
|
144
144
|
Biome (the underlying engine) provides extremely fast Rust-based linting and formatting. Most issues are automatically fixable.
|
|
145
145
|
|
|
@@ -253,9 +253,9 @@ Biome's linter will catch most issues automatically. Focus your attention on:
|
|
|
253
253
|
|
|
254
254
|
---
|
|
255
255
|
|
|
256
|
-
Most formatting and common issues are automatically fixed by Biome. Run
|
|
257
|
-
`;var
|
|
256
|
+
Most formatting and common issues are automatically fixed by Biome. Run \`${e} ultracite fix\` before committing to ensure compliance.
|
|
257
|
+
`;var Be=(e,t)=>{let s=Ie[e],n=cs(t,""),o=_e(n),i=s.header?`${s.header}
|
|
258
258
|
|
|
259
|
-
${
|
|
259
|
+
${o}`:o,a=async()=>{let r=as(s.path);if(r!=="."){let c=r.startsWith("./")?r.slice(2):r;await is(c,{recursive:!0})}};return{exists:()=>f(s.path),create:async()=>{await a(),await X(s.path,i)},update:async()=>{if(await a(),s.appendMode){if(!await f(s.path)){await X(s.path,i);return}let r=await rs(s.path,"utf-8");if(r.includes(o.trim()))return;await X(s.path,`${r}
|
|
260
260
|
|
|
261
|
-
${_}`)}else await Q(e.path,n)}}};h();import{readFile as an,writeFile as _e}from"fs/promises";import cn from"deepmerge";import{parse as ln}from"jsonc-parser";var Be={$schema:"./node_modules/@biomejs/biome/configuration_schema.json",extends:["ultracite/core"]},ge=async()=>await f("./biome.json")?"./biome.json":"./biome.jsonc",Z={exists:async()=>{let t=await ge();return f(t)},create:async t=>{let e=await ge(),n=["ultracite/core"];if(t?.frameworks&&t.frameworks.length>0)for(let o of t.frameworks)n.push(`ultracite/${o}`);let s={...Be,extends:n};return _e(e,JSON.stringify(s,null,2))},update:async t=>{let e=await ge(),n=await an(e,"utf-8"),o=ln(n)||{},r=[...o.extends&&Array.isArray(o.extends)?o.extends:[]];if(r.includes("ultracite/core")||r.push("ultracite/core"),t?.frameworks&&t.frameworks.length>0)for(let p of t.frameworks){let u=`ultracite/${p}`;r.includes(u)||r.push(u)}o.extends=r;let a={$schema:Be.$schema},c=cn(o,a);await _e(e,JSON.stringify(c,null,2))}};h();import{spawnSync as dn}from"child_process";import{mkdir as fn,readFile as mn,writeFile as Le}from"fs/promises";import pn from"deepmerge";import{parse as un}from"jsonc-parser";var he={"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"}};var q="./.vscode/settings.json",B={exists:()=>f(q),create:async()=>{await fn(".vscode",{recursive:!0}),await Le(q,JSON.stringify(he,null,2))},update:async()=>{let t=await mn(q,"utf-8"),n=un(t)||{},s=pn(n,he);await Le(q,JSON.stringify(s,null,2))},extension:()=>dn("code --install-extension biomejs.biome",{stdio:"inherit",shell:!0})};h();import{mkdir as gn,readFile as hn,writeFile as We}from"fs/promises";import yn from"deepmerge";import{parse as wn}from"jsonc-parser";var ye={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}},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"}}}}}};var ee="./.zed/settings.json",te={exists:()=>f(ee),create:async()=>{await gn(".zed",{recursive:!0}),await We(ee,JSON.stringify(ye,null,2))},update:async()=>{let t=await hn(ee,"utf-8"),n=wn(t)||{},s=yn(n,ye);await We(ee,JSON.stringify(s,null,2))}};import{mkdir as kn,readFile as He,writeFile as F}from"fs/promises";import{dirname as bn}from"path";h();var ze=t=>({version:1,hooks:{afterFileEdit:[{command:t}]}}),Ge=t=>({hooks:{PostToolUse:[{matcher:"Edit|Write",hooks:[{type:"command",command:t}]}]}}),xn=async(t,e)=>{if(!await f(t)){await F(t,JSON.stringify(ze(e),null,2));return}let n=await He(t,"utf-8"),s=JSON.parse(n);s.hooks.afterFileEdit.some(i=>i.command.includes("ultracite"))||(s.hooks.afterFileEdit.push({command:e}),await F(t,JSON.stringify(s,null,2)))},vn=async(t,e)=>{if(!await f(t)){await F(t,JSON.stringify(Ge(e),null,2));return}let n=await He(t,"utf-8"),s=JSON.parse(n);s.hooks||(s.hooks={}),s.hooks.PostToolUse||(s.hooks.PostToolUse=[]),s.hooks.PostToolUse.some(i=>i.hooks?.some(r=>r.command.includes("ultracite")))||(s.hooks.PostToolUse.push({matcher:"Edit|Write",hooks:[{type:"command",command:e}]}),await F(t,JSON.stringify(s,null,2)))},Ve=t=>{let e=Ie[t],n=async()=>{let s=bn(e.path);if(s!=="."){let o=s.startsWith("./")?s.slice(2):s;await kn(o,{recursive:!0})}};return{exists:()=>f(e.path),create:async()=>{await n(),t==="cursor"?await F(e.path,JSON.stringify(ze(e.command),null,2)):t==="claude"&&await F(e.path,JSON.stringify(Ge(e.command),null,2))},update:async()=>{await n(),t==="cursor"?await xn(e.path,e.command):t==="claude"&&await vn(e.path,e.command)}}};ke();be();ve();import{readFile as Gn,writeFile as Vn}from"fs/promises";import Yn from"deepmerge";import{glob as Kn}from"glob";import{parse as Xn}from"jsonc-parser";var Qn={compilerOptions:{strictNullChecks:!0}},st=async()=>{try{return await Kn("**/tsconfig*.json",{ignore:["**/node_modules/**","**/dist/**","**/build/**","**/.next/**"],absolute:!1})}catch{return[]}},Zn=async t=>{try{let e=await Gn(t,"utf-8"),s=Xn(e)||{},o=Yn(s,Qn);await Vn(t,JSON.stringify(o,null,2))}catch(e){console.warn(`Failed to update ${t}:`,e)}},Se={exists:async()=>(await st()).length>0,update:async()=>{let t=await st();if(t.length===0){console.warn("No tsconfig.json files found in the project");return}await Promise.all(t.map(e=>Zn(e)))}};h();var ot=k.devDependencies["@biomejs/biome"],it=k.version,ss=async(t,e=!0,n=!1)=>{let s=w();n||s.start("Installing dependencies...");let o=[`ultracite@${it}`,`@biomejs/biome@${ot}`];if(e)for(let i of o)await ts(i,{packageManager:t,workspace:await C(),silent:n});else await v({devDependencies:{"@biomejs/biome":ot,ultracite:it}});n||s.stop("Dependencies installed.")},os=async(t=!1)=>{let e=w();if(t||e.start("Checking for tsconfig.json files..."),await Se.exists()){t||e.message("Found tsconfig.json files, updating with strictNullChecks..."),await Se.update(),t||e.stop("tsconfig.json files updated.");return}t||e.stop("No tsconfig.json files found, skipping.")},is=async(t=!1)=>{let e=w();if(t||e.start("Checking for .vscode/settings.json..."),await B.exists()){t||e.message("settings.json found, updating..."),await B.update(),t||e.stop("settings.json updated.");return}t||e.message("settings.json not found, creating..."),await B.create(),t||(e.message("settings.json created."),e.message("Installing Biome extension..."));try{B.extension(),t||e.stop("settings.json created.")}catch(n){t||e.stop(`Failed to install Biome extension (${n}), but continuing...`)}},rs=async(t=!1)=>{let e=w();if(t||e.start("Checking for .zed/settings.json..."),await te.exists()){t||e.message("settings.json found, updating..."),await te.update(),t||e.stop("settings.json updated.");return}t||e.message("settings.json not found, creating..."),await te.create(),t||e.message("settings.json created. Install the Biome extension: https://biomejs.dev/reference/zed/")},as=async(t,e=!1)=>{let n=w();if(e||n.start("Checking for Biome configuration..."),await Z.exists()){e||n.message("Biome configuration found, updating..."),await Z.update({frameworks:t}),e||n.stop("Biome configuration updated.");return}e||n.message("Biome configuration not found, creating..."),await Z.create({frameworks:t}),e||n.stop("Biome configuration created.")},cs=async(t,e=!0,n=!1)=>{let s=w();if(n||(s.start("Initializing pre-commit hooks..."),s.message("Installing Husky...")),e?await P.install(t):await v({devDependencies:{husky:"latest"},scripts:{prepare:"husky"}}),n||s.message("Initializing Husky..."),P.init(t),await P.exists()){n||s.message("Pre-commit hook found, updating..."),await P.update(t),n||s.stop("Pre-commit hook updated.");return}n||s.message("Pre-commit hook not found, creating..."),await P.create(t),n||s.stop("Pre-commit hook created.")},ls=async(t,e=!0,n=!1)=>{let s=w();if(n||(s.start("Initializing lefthook..."),s.message("Installing lefthook...")),e?await D.install(t):await v({devDependencies:{lefthook:"latest"}}),await D.exists()){n||s.message("lefthook.yml found, updating..."),await D.update(t),n||s.stop("lefthook.yml updated.");return}n||s.message("lefthook.yml not found, creating..."),await D.create(t),n||s.stop("lefthook.yml created.")},ds=async(t,e=!0,n=!1)=>{let s=w();if(n||(s.start("Initializing lint-staged..."),s.message("Installing lint-staged...")),e?await O.install(t):await v({devDependencies:{"lint-staged":"latest"}}),await O.exists()){n||s.message("lint-staged found, updating..."),await O.update(t),n||s.stop("lint-staged updated.");return}n||s.message("lint-staged not found, creating..."),await O.create(t),n||s.stop("lint-staged created.")},fs=async(t,e,n=!1)=>{let s=w();n||s.start(`Checking for ${e}...`);let o=Je(t);if(await o.exists()){n||s.message(`${e} found, updating...`),await o.update(),n||s.stop(`${e} updated.`);return}n||s.message(`${e} not found, creating...`),await o.create(),n||s.stop(`${e} created.`)},ms=async(t,e,n=!1)=>{let s=w();n||s.start(`Checking for ${e} hooks...`);let o=Ve(t);if(await o.exists()){n||s.message(`${e} hooks found, updating...`),await o.update(),n||s.stop(`${e} hooks updated.`);return}n||s.message(`${e} hooks not found, creating...`),await o.create(),n||s.stop(`${e} hooks created.`)},ps=async(t,e=!1)=>{let n=w();e||n.start("Removing Prettier dependencies and configuration...");try{let s=await me.remove(t);e||(s.packagesRemoved.length>0&&n.message(`Removed Prettier packages: ${s.packagesRemoved.join(", ")}`),s.filesRemoved.length>0&&n.message(`Removed config files: ${s.filesRemoved.join(", ")}`),s.vsCodeCleaned&&n.message("Cleaned VS Code settings"),n.stop("Prettier removed successfully."))}catch{e||n.stop("Failed to remove Prettier completely, but continuing...")}},us=async(t,e=!1)=>{let n=w();e||n.start("Removing ESLint dependencies and configuration...");try{let s=await fe.remove(t);e||(s.packagesRemoved.length>0&&n.message(`Removed ESLint packages: ${s.packagesRemoved.join(", ")}`),s.filesRemoved.length>0&&n.message(`Removed config files: ${s.filesRemoved.join(", ")}`),s.vsCodeCleaned&&n.message("Cleaned VS Code settings"),n.stop("ESLint removed successfully."))}catch{e||n.stop("Failed to remove ESLint completely, but continuing...")}},rt=async t=>{let e=t??{},n=e.quiet??!1;n||es(z);try{let{pm:s}=e;if(!s){let d=await ns(qn.cwd());if(!d)throw new Error("No package manager specified or detected");if(!n&&d.warnings)for(let g of d.warnings)oe.warn(g);n||oe.info(`Detected lockfile, using ${d.name}`),s=d.name}let o=e.migrate?.includes("prettier"),i=e.migrate?.includes("eslint");if(!n&&(o===void 0||i===void 0)){let d=[];if(o===void 0&&await me.hasPrettier()&&d.push({label:"Remove Prettier (dependencies, config files, VS Code settings)",value:"prettier"}),i===void 0&&await fe.hasEsLint()&&d.push({label:"Remove ESLint (dependencies, config files, VS Code settings)",value:"eslint"}),d.length>0){let g=await T({message:"Remove existing formatters/linters (recommended for clean migration)?",options:d,required:!1});if(M(g)){N("Operation cancelled.");return}o===void 0&&(o=g.includes("prettier")),i===void 0&&(i=g.includes("eslint"))}}n&&(o===void 0&&(o=!1),i===void 0&&(i=!1));let r=e.frameworks;if(r===void 0)if(n||e.pm||e.editors||e.agents||e.hooks||e.integrations!==void 0||e.migrate!==void 0)r=[];else{let g=await T({message:"Which frameworks are you using (optional)?",options:[{label:"React",value:"react"},{label:"Next.js",value:"next"},{label:"Solid",value:"solid"},{label:"Vue",value:"vue"},{label:"Svelte",value:"svelte"},{label:"Qwik",value:"qwik"},{label:"Angular",value:"angular"},{label:"Remix / TanStack Router / React Router",value:"remix"},{label:"Astro",value:"astro"}],required:!1});if(M(g)){N("Operation cancelled.");return}r=g}let a=e.editors;if(!a)if(n)a=[];else{let d=await T({message:"Which editors do you want to configure (recommended)?",options:[{label:"VSCode / Cursor / Windsurf",value:"vscode"},{label:"Zed",value:"zed"}],required:!1});if(M(d)){N("Operation cancelled.");return}a=d}let c=e.agents,p=e.hooks,u={"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","roo-code":"Roo Code",warp:"Warp",droid:"Droid"};if(!c)if(n)c=[];else{let d=await T({message:"Which agents do you want to enable (optional)?",options:Object.entries(u).map(([g,ie])=>({value:g,label:ie})),required:!1});if(M(d)){N("Operation cancelled.");return}c=d}let x={cursor:"Cursor",claude:"Claude Code"};if(!p)if(n)p=[];else{let d=await T({message:"Which agent hooks do you want to enable (optional)?",options:Object.entries(x).map(([g,ie])=>({value:g,label:ie})),required:!1});if(M(d)){N("Operation cancelled.");return}p=d}let y=e.integrations;if(y===void 0)if(n||e.pm||e.editors||e.agents||e.hooks||e.migrate!==void 0)y=[];else{let g=await T({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});if(M(g)){N("Operation cancelled.");return}y=g}o&&await ps(s,n),i&&await us(s,n),await ss(s,!e.skipInstall,n),await os(n),await as(r,n),a?.includes("vscode")&&await is(n),a?.includes("zed")&&await rs(n);for(let d of c??[])await fs(d,u[d],n);for(let d of p??[])await ms(d,x[d],n);y?.includes("husky")&&await cs(s,!e.skipInstall,n),y?.includes("lefthook")&&await ls(s,!e.skipInstall,n),y?.includes("lint-staged")&&await ds(s,!e.skipInstall,n),n||oe.success("Successfully initialized Ultracite configuration!")}catch(s){let o=s instanceof Error?s.message:"Unknown error";throw n||oe.error(`Failed to initialize Ultracite configuration: ${o}`),s}};var E=gs.meta().create(),ys=E.router({init:E.procedure.meta({description:"Initialize Ultracite in the current directory"}).input(l.object({pm:l.enum(j.packageManagers).optional().describe("Package manager to use"),editors:l.array(l.enum(j.editorConfigs)).optional().describe("Editors to configure"),agents:l.array(l.enum(j.agents)).optional().describe("Agents to enable"),hooks:l.array(l.enum(j.hooks)).optional().describe("Hooks to enable"),frameworks:l.array(l.enum(j.frameworks)).optional().describe("Frameworks being used"),integrations:l.array(l.enum(j.integrations)).optional().describe("Additional integrations to enable"),migrate:l.array(l.enum(j.migrations)).optional().describe("Migration tools to remove (e.g., eslint, prettier). Removes dependencies, config files, and editor settings."),skipInstall:l.boolean().default(!1).describe("Skip installing dependencies"),quiet:l.boolean().default(process.env.CI==="true"||process.env.CI==="1").describe("Suppress all interactive prompts and visual output. Automatically enabled in CI environments.")})).mutation(async({input:t})=>{await rt(t)}),check:E.procedure.meta({description:"Run Biome linter without fixing files"}).input(l.tuple([l.array(l.string()).optional().default([]).describe("specific files to lint"),l.object({"diagnostic-level":l.enum(["info","warn","error"]).optional().describe("level of diagnostics to show. In order, from the lowest to the most important: info, warn, error.")})]).optional()).query(async({input:t})=>{await de(t)}),fix:E.procedure.meta({description:"Run Biome linter and fixes files"}).input(l.tuple([l.array(l.string()).optional().default([]).describe("specific files to format"),l.object({unsafe:l.boolean().optional().describe("apply unsafe fixes")})])).mutation(async({input:t})=>{let[e,n]=t;await ue(e,{unsafe:n.unsafe})}),doctor:E.procedure.meta({description:"Verify your Ultracite setup and check for issues"}).query(async()=>{await Te()}),lint:E.procedure.meta({description:"\u26A0\uFE0F DEPRECATED: Use 'check' instead - Run Biome linter without fixing files"}).input(l.array(l.string()).optional().default([]).describe("specific files to lint")).query(async({input:t})=>{console.warn("\u26A0\uFE0F Warning: 'lint' command is deprecated. Please use 'check' instead."),await de([t,{}])}),format:E.procedure.meta({description:"\u26A0\uFE0F DEPRECATED: Use 'fix' instead - Run Biome linter and fixes files"}).input(l.tuple([l.array(l.string()).optional().default([]).describe("specific files to format"),l.object({unsafe:l.boolean().optional().describe("apply unsafe fixes")})])).mutation(async({input:t})=>{let[e,n]=t;console.warn("\u26A0\uFE0F Warning: 'format' command is deprecated. Please use 'fix' instead."),await ue(e,{unsafe:n.unsafe})})}),ws=hs({router:ys,name:k.name,version:k.version,description:k.description});process.env.TEST||ws.run();export{ys as router};
|
|
261
|
+
${o}`)}else await X(s.path,i)}}};h();import{readFile as ls,writeFile as Le}from"fs/promises";import ds from"deepmerge";import{parse as fs}from"jsonc-parser";var We={$schema:"./node_modules/@biomejs/biome/configuration_schema.json",extends:["ultracite/core"]},ue=async()=>await f("./biome.json")?"./biome.json":"./biome.jsonc",Q={exists:async()=>{let e=await ue();return f(e)},create:async e=>{let t=await ue(),s=["ultracite/core"];if(e?.frameworks&&e.frameworks.length>0)for(let o of e.frameworks)s.push(`ultracite/${o}`);let n={...We,extends:s};return Le(t,JSON.stringify(n,null,2))},update:async e=>{let t=await ue(),s=await ls(t,"utf-8"),o=fs(s)||{},a=[...o.extends&&Array.isArray(o.extends)?o.extends:[]];if(a.includes("ultracite/core")||a.push("ultracite/core"),e?.frameworks&&e.frameworks.length>0)for(let p of e.frameworks){let u=`ultracite/${p}`;a.includes(u)||a.push(u)}o.extends=a;let r={$schema:We.$schema},c=ds(o,r);await Le(t,JSON.stringify(c,null,2))}};h();import{spawnSync as ms}from"child_process";import{mkdir as ps,readFile as us,writeFile as He}from"fs/promises";import gs from"deepmerge";import{parse as hs}from"jsonc-parser";var ge={"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"}};var Z="./.vscode/settings.json",_={exists:()=>f(Z),create:async()=>{await ps(".vscode",{recursive:!0}),await He(Z,JSON.stringify(ge,null,2))},update:async()=>{let e=await us(Z,"utf-8"),s=hs(e)||{},n=gs(s,ge);await He(Z,JSON.stringify(n,null,2))},extension:()=>ms("code --install-extension biomejs.biome",{stdio:"pipe",shell:!0})};h();import{mkdir as ys,readFile as ws,writeFile as ze}from"fs/promises";import ks from"deepmerge";import{parse as bs}from"jsonc-parser";var he={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}},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"}}}}}};var q="./.zed/settings.json",ee={exists:()=>f(q),create:async()=>{await ys(".zed",{recursive:!0}),await ze(q,JSON.stringify(he,null,2))},update:async()=>{let e=await ws(q,"utf-8"),s=bs(e)||{},n=ks(s,he);await ze(q,JSON.stringify(n,null,2))}};import{mkdir as xs,readFile as Ge,writeFile as F}from"fs/promises";import{dirname as vs}from"path";import{dlxCommand as Cs}from"nypm";h();var Ve=e=>({version:1,hooks:{afterFileEdit:[{command:e}]}}),Ye=e=>({hooks:{PostToolUse:[{matcher:"Edit|Write",hooks:[{type:"command",command:e}]}]}}),js=async(e,t)=>{if(!await f(e)){await F(e,JSON.stringify(Ve(t),null,2));return}let s=await Ge(e,"utf-8"),n=JSON.parse(s);n.hooks.afterFileEdit.some(i=>i.command.includes("ultracite"))||(n.hooks.afterFileEdit.push({command:t}),await F(e,JSON.stringify(n,null,2)))},Ps=async(e,t)=>{if(!await f(e)){await F(e,JSON.stringify(Ye(t),null,2));return}let s=await Ge(e,"utf-8"),n=JSON.parse(s);n.hooks||(n.hooks={}),n.hooks.PostToolUse||(n.hooks.PostToolUse=[]),n.hooks.PostToolUse.some(i=>i.hooks?.some(a=>a.command.includes("ultracite")))||(n.hooks.PostToolUse.push({matcher:"Edit|Write",hooks:[{type:"command",command:t}]}),await F(e,JSON.stringify(n,null,2)))},Ke=(e,t)=>{let s=Je[e],n=Cs(t,"ultracite",{args:["fix"],short:t==="npm"}),o=async()=>{let i=vs(s.path);if(i!=="."){let a=i.startsWith("./")?i.slice(2):i;await xs(a,{recursive:!0})}};return{exists:()=>f(s.path),create:async()=>{await o(),e==="cursor"?await F(s.path,JSON.stringify(Ve(n),null,2)):e==="claude"&&await F(s.path,JSON.stringify(Ye(n),null,2))},update:async()=>{await o(),e==="cursor"?await js(s.path,n):e==="claude"&&await Ps(s.path,n)}}};we();ke();xe();import{readFile as Ks,writeFile as Xs}from"fs/promises";import Qs from"deepmerge";import{glob as Zs}from"glob";import{parse as qs}from"jsonc-parser";var en={compilerOptions:{strictNullChecks:!0}},it=async()=>{try{return await Zs("**/tsconfig*.json",{ignore:["**/node_modules/**","**/dist/**","**/build/**","**/.next/**"],absolute:!1})}catch{return[]}},tn=async e=>{try{let t=await Ks(e,"utf-8"),n=qs(t)||{},o=Qs(n,en);await Xs(e,JSON.stringify(o,null,2))}catch(t){console.warn(`Failed to update ${e}:`,t)}},je={exists:async()=>(await it()).length>0,update:async()=>{let e=await it();if(e.length===0){console.warn("No tsconfig.json files found in the project");return}await Promise.all(e.map(t=>tn(t)))}};h();var rt=k.devDependencies["@biomejs/biome"],at=k.version,an=async(e,t=!0,s=!1)=>{let n=w();s||n.start("Installing dependencies...");let o=[`ultracite@${at}`,`@biomejs/biome@${rt}`];if(t)for(let i of o)await on(i,{packageManager:e,workspace:await C(),silent:!0});else await v({devDependencies:{"@biomejs/biome":rt,ultracite:at}});s||n.stop("Dependencies installed.")},cn=async(e=!1)=>{let t=w();if(e||t.start("Checking for tsconfig.json files..."),await je.exists()){e||t.message("Found tsconfig.json files, updating with strictNullChecks..."),await je.update(),e||t.stop("tsconfig.json files updated.");return}e||t.stop("No tsconfig.json files found, skipping.")},ln=async(e=!1)=>{let t=w();if(e||t.start("Checking for .vscode/settings.json..."),await _.exists()){e||t.message("settings.json found, updating..."),await _.update(),e||t.stop("settings.json updated.");return}e||t.message("settings.json not found, creating..."),await _.create(),e||(t.message("settings.json created."),t.message("Installing Biome extension..."));try{let s=_.extension();e||(s.status===0?t.stop("settings.json created and Biome extension installed."):t.stop("settings.json created. Install Biome extension manually."))}catch{e||t.stop("settings.json created. Install Biome extension manually.")}},dn=async(e=!1)=>{let t=w();if(e||t.start("Checking for .zed/settings.json..."),await ee.exists()){e||t.message("settings.json found, updating..."),await ee.update(),e||t.stop("settings.json updated.");return}e||t.message("settings.json not found, creating..."),await ee.create(),e||t.message("settings.json created. Install the Biome extension: https://biomejs.dev/reference/zed/")},fn=async(e,t=!1)=>{let s=w();if(t||s.start("Checking for Biome configuration..."),await Q.exists()){t||s.message("Biome configuration found, updating..."),await Q.update({frameworks:e}),t||s.stop("Biome configuration updated.");return}t||s.message("Biome configuration not found, creating..."),await Q.create({frameworks:e}),t||s.stop("Biome configuration created.")},mn=async(e,t=!0,s=!1)=>{let n=w();if(s||(n.start("Initializing pre-commit hooks..."),n.message("Installing Husky...")),t?await $.install(e):await v({devDependencies:{husky:"latest"},scripts:{prepare:"husky"}}),s||n.message("Initializing Husky..."),$.init(e),await $.exists()){s||n.message("Pre-commit hook found, updating..."),await $.update(e),s||n.stop("Pre-commit hook updated.");return}s||n.message("Pre-commit hook not found, creating..."),await $.create(e),s||n.stop("Pre-commit hook created.")},pn=async(e,t=!0,s=!1)=>{let n=w();if(s||(n.start("Initializing lefthook..."),n.message("Installing lefthook...")),t?await D.install(e):await v({devDependencies:{lefthook:"latest"}}),await D.exists()){s||n.message("lefthook.yml found, updating..."),await D.update(e),s||n.stop("lefthook.yml updated.");return}s||n.message("lefthook.yml not found, creating..."),await D.create(e),s||n.stop("lefthook.yml created.")},un=async(e,t=!0,s=!1)=>{let n=w();if(s||(n.start("Initializing lint-staged..."),n.message("Installing lint-staged...")),t?await N.install(e):await v({devDependencies:{"lint-staged":"latest"}}),await N.exists()){s||n.message("lint-staged found, updating..."),await N.update(e),s||n.stop("lint-staged updated.");return}s||n.message("lint-staged not found, creating..."),await N.create(e),s||n.stop("lint-staged created.")},gn=async(e,t,s,n=!1)=>{let o=w();n||o.start(`Checking for ${t}...`);let i=Be(e,s);if(await i.exists()){n||o.message(`${t} found, updating...`),await i.update(),n||o.stop(`${t} updated.`);return}n||o.message(`${t} not found, creating...`),await i.create(),n||o.stop(`${t} created.`)},hn=async(e,t,s,n=!1)=>{let o=w();n||o.start(`Checking for ${t} hooks...`);let i=Ke(e,s);if(await i.exists()){n||o.message(`${t} hooks found, updating...`),await i.update(),n||o.stop(`${t} hooks updated.`);return}n||o.message(`${t} hooks not found, creating...`),await i.create(),n||o.stop(`${t} hooks created.`)},yn=async(e,t=!1)=>{let s=w();t||s.start("Removing Prettier dependencies and configuration...");try{let n=await fe.remove(e);t||(n.packagesRemoved.length>0&&s.message(`Removed Prettier packages: ${n.packagesRemoved.join(", ")}`),n.filesRemoved.length>0&&s.message(`Removed config files: ${n.filesRemoved.join(", ")}`),n.vsCodeCleaned&&s.message("Cleaned VS Code settings"),s.stop("Prettier removed successfully."))}catch{t||s.stop("Failed to remove Prettier completely, but continuing...")}},wn=async(e,t=!1)=>{let s=w();t||s.start("Removing ESLint dependencies and configuration...");try{let n=await de.remove(e);t||(n.packagesRemoved.length>0&&s.message(`Removed ESLint packages: ${n.packagesRemoved.join(", ")}`),n.filesRemoved.length>0&&s.message(`Removed config files: ${n.filesRemoved.join(", ")}`),n.vsCodeCleaned&&s.message("Cleaned VS Code settings"),s.stop("ESLint removed successfully."))}catch{t||s.stop("Failed to remove ESLint completely, but continuing...")}},ct=async e=>{let t=e??{},s=t.quiet??!1;s||nn(H);try{let{pm:n}=t;if(!n){let d=await rn(sn.cwd());if(!d)throw new Error("No package manager specified or detected");if(!s&&d.warnings)for(let g of d.warnings)ne.warn(g);s||ne.info(`Detected lockfile, using ${d.name}`),n=d.name}let o=t.migrate?.includes("prettier"),i=t.migrate?.includes("eslint");if(!s&&(o===void 0||i===void 0)){let d=[];if(o===void 0&&await fe.hasPrettier()&&d.push({label:"Remove Prettier (dependencies, config files, VS Code settings)",value:"prettier"}),i===void 0&&await de.hasEsLint()&&d.push({label:"Remove ESLint (dependencies, config files, VS Code settings)",value:"eslint"}),d.length>0){let g=await T({message:"Remove existing formatters/linters (recommended for clean migration)?",options:d,required:!1});if(M(g)){O("Operation cancelled.");return}o===void 0&&(o=g.includes("prettier")),i===void 0&&(i=g.includes("eslint"))}}s&&(o===void 0&&(o=!1),i===void 0&&(i=!1));let a=t.frameworks;if(a===void 0)if(s||t.pm||t.editors||t.agents||t.hooks||t.integrations!==void 0||t.migrate!==void 0)a=[];else{let g=await T({message:"Which frameworks are you using (optional)?",options:[{label:"React",value:"react"},{label:"Next.js",value:"next"},{label:"Solid",value:"solid"},{label:"Vue",value:"vue"},{label:"Svelte",value:"svelte"},{label:"Qwik",value:"qwik"},{label:"Angular",value:"angular"},{label:"Remix / TanStack Router / React Router",value:"remix"},{label:"Astro",value:"astro"}],required:!1});if(M(g)){O("Operation cancelled.");return}a=g}let r=t.editors;if(!r)if(s)r=[];else{let d=await T({message:"Which editors do you want to configure (recommended)?",options:[{label:"VSCode / Cursor / Windsurf",value:"vscode"},{label:"Zed",value:"zed"}],required:!1});if(M(d)){O("Operation cancelled.");return}r=d}let c=t.agents,p=t.hooks,u={"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","roo-code":"Roo Code",warp:"Warp",droid:"Droid"};if(!c)if(s)c=[];else{let d=await T({message:"Which agents do you want to enable (optional)?",options:Object.entries(u).map(([g,oe])=>({value:g,label:oe})),required:!1});if(M(d)){O("Operation cancelled.");return}c=d}let x={cursor:"Cursor",claude:"Claude Code"};if(!p)if(s)p=[];else{let d=await T({message:"Which agent hooks do you want to enable (optional)?",options:Object.entries(x).map(([g,oe])=>({value:g,label:oe})),required:!1});if(M(d)){O("Operation cancelled.");return}p=d}let y=t.integrations;if(y===void 0)if(s||t.pm||t.editors||t.agents||t.hooks||t.migrate!==void 0)y=[];else{let g=await T({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});if(M(g)){O("Operation cancelled.");return}y=g}o&&await yn(n,s),i&&await wn(n,s),await an(n,!t.skipInstall,s),await cn(s),await fn(a,s),r?.includes("vscode")&&await ln(s),r?.includes("zed")&&await dn(s);for(let d of c??[])await gn(d,u[d],n,s);for(let d of p??[])await hn(d,x[d],n,s);y?.includes("husky")&&await mn(n,!t.skipInstall,s),y?.includes("lefthook")&&await pn(n,!t.skipInstall,s),y?.includes("lint-staged")&&await un(n,!t.skipInstall,s),s||ne.success("Successfully initialized Ultracite configuration!")}catch(n){let o=n instanceof Error?n.message:"Unknown error";throw s||ne.error(`Failed to initialize Ultracite configuration: ${o}`),n}};var A=kn.meta().create(),xn=A.router({init:A.procedure.meta({description:"Initialize Ultracite in the current directory"}).input(l.object({pm:l.enum(j.packageManagers).optional().describe("Package manager to use"),editors:l.array(l.enum(j.editorConfigs)).optional().describe("Editors to configure"),agents:l.array(l.enum(j.agents)).optional().describe("Agents to enable"),hooks:l.array(l.enum(j.hooks)).optional().describe("Hooks to enable"),frameworks:l.array(l.enum(j.frameworks)).optional().describe("Frameworks being used"),integrations:l.array(l.enum(j.integrations)).optional().describe("Additional integrations to enable"),migrate:l.array(l.enum(j.migrations)).optional().describe("Migration tools to remove (e.g., eslint, prettier). Removes dependencies, config files, and editor settings."),skipInstall:l.boolean().default(!1).describe("Skip installing dependencies"),quiet:l.boolean().default(process.env.CI==="true"||process.env.CI==="1").describe("Suppress all interactive prompts and visual output. Automatically enabled in CI environments.")})).mutation(async({input:e})=>{await ct(e)}),check:A.procedure.meta({description:"Run Biome linter without fixing files"}).input(l.tuple([l.array(l.string()).optional().default([]).describe("specific files to lint"),l.object({"diagnostic-level":l.enum(["info","warn","error"]).optional().describe("level of diagnostics to show. In order, from the lowest to the most important: info, warn, error.")})]).optional()).query(async({input:e})=>{await le(e)}),fix:A.procedure.meta({description:"Run Biome linter and fixes files"}).input(l.tuple([l.array(l.string()).optional().default([]).describe("specific files to format"),l.object({unsafe:l.boolean().optional().describe("apply unsafe fixes")})])).mutation(async({input:e})=>{let[t,s]=e;await pe(t,{unsafe:s.unsafe})}),doctor:A.procedure.meta({description:"Verify your Ultracite setup and check for issues"}).query(async()=>{await Ue()}),lint:A.procedure.meta({description:"\u26A0\uFE0F DEPRECATED: Use 'check' instead - Run Biome linter without fixing files"}).input(l.array(l.string()).optional().default([]).describe("specific files to lint")).query(async({input:e})=>{console.warn("\u26A0\uFE0F Warning: 'lint' command is deprecated. Please use 'check' instead."),await le([e,{}])}),format:A.procedure.meta({description:"\u26A0\uFE0F DEPRECATED: Use 'fix' instead - Run Biome linter and fixes files"}).input(l.tuple([l.array(l.string()).optional().default([]).describe("specific files to format"),l.object({unsafe:l.boolean().optional().describe("apply unsafe fixes")})])).mutation(async({input:e})=>{let[t,s]=e;console.warn("\u26A0\uFE0F Warning: 'format' command is deprecated. Please use 'fix' instead."),await pe(t,{unsafe:s.unsafe})})}),vn=bn({router:xn,name:k.name,version:k.version,description:k.description});process.env.TEST||vn.run();export{xn 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": "6.4.
|
|
4
|
+
"version": "6.4.2",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"ultracite": "dist/index.js"
|
|
@@ -41,14 +41,14 @@
|
|
|
41
41
|
"url": "git+https://github.com/haydenbleasel/ultracite.git"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@biomejs/biome": "2.3.
|
|
44
|
+
"@biomejs/biome": "2.3.10",
|
|
45
45
|
"@types/node": "^25.0.0",
|
|
46
46
|
"tsup": "^8.5.1",
|
|
47
47
|
"turbo": "^2.6.3"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"@clack/prompts": "^0.11.0",
|
|
51
|
-
"@trpc/server": "^11.
|
|
51
|
+
"@trpc/server": "^11.8.0",
|
|
52
52
|
"deepmerge": "^4.3.1",
|
|
53
53
|
"glob": "^13.0.0",
|
|
54
54
|
"jsonc-parser": "^3.3.1",
|