ultracite 7.2.5 → 7.3.0
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.
|
@@ -226,11 +226,12 @@
|
|
|
226
226
|
"noProcessGlobal": "off",
|
|
227
227
|
"useUniqueElementIds": "off",
|
|
228
228
|
|
|
229
|
-
/** ------ Project rules
|
|
230
|
-
"noPrivateImports": "
|
|
231
|
-
"noUndeclaredDependencies": "
|
|
232
|
-
"
|
|
233
|
-
"
|
|
229
|
+
/** ------ Project/Scanner rules. Enabled in config but skipped by default at runtime for performance. Use --type-aware to enable. ------ **/
|
|
230
|
+
"noPrivateImports": "error",
|
|
231
|
+
"noUndeclaredDependencies": "error",
|
|
232
|
+
"noUnresolvedImports": "error",
|
|
233
|
+
"useImportExtensions": "error",
|
|
234
|
+
"useJsonImportAttributes": "error",
|
|
234
235
|
|
|
235
236
|
/** ------------------------ CSS Rules ------------------------ **/
|
|
236
237
|
"noInvalidDirectionInLinearGradient": "error",
|
|
@@ -460,6 +461,10 @@
|
|
|
460
461
|
|
|
461
462
|
"noConsole": "off",
|
|
462
463
|
|
|
464
|
+
/** ------ Project/Scanner rules. Enabled in config but skipped by default at runtime for performance. Use --type-aware to enable. ------ **/
|
|
465
|
+
"noDeprecatedImports": "error",
|
|
466
|
+
"noImportCycles": "error",
|
|
467
|
+
|
|
463
468
|
/** ------------------------ CSS Rules ------------------------ **/
|
|
464
469
|
"noDuplicateAtImportRules": "error",
|
|
465
470
|
"noDuplicateCustomProperties": "error",
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
"arrow-body-style": ["error", "as-needed"],
|
|
42
42
|
"max-depth": "off",
|
|
43
43
|
"max-params": "off",
|
|
44
|
+
"max-statements": "off",
|
|
44
45
|
"capitalized-comments": "off",
|
|
45
46
|
"new-cap": "off",
|
|
46
47
|
"no-continue": "off",
|
|
@@ -67,7 +68,9 @@
|
|
|
67
68
|
"import/no-nodejs-modules": "off",
|
|
68
69
|
|
|
69
70
|
"jsdoc/require-param": "off",
|
|
71
|
+
"jsdoc/require-param-type": "off",
|
|
70
72
|
"jsdoc/require-returns": "off",
|
|
73
|
+
"jsdoc/require-returns-type": "off",
|
|
71
74
|
|
|
72
75
|
"unicorn/explicit-length-check": "off",
|
|
73
76
|
"unicorn/no-array-callback-reference": "off",
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var b1=Object.defineProperty;var pe=Object.getOwnPropertyDescriptor;var me=Object.getOwnPropertyNames;var ge=Object.prototype.hasOwnProperty;var z1=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,i)=>(typeof require<"u"?require:e)[i]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')}),G1=t=>e=>{var i=t[e];if(i)return i();throw new Error("Module not found in bundle: "+e)};var
|
|
2
|
+
var b1=Object.defineProperty;var pe=Object.getOwnPropertyDescriptor;var me=Object.getOwnPropertyNames;var ge=Object.prototype.hasOwnProperty;var z1=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,i)=>(typeof require<"u"?require:e)[i]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')}),G1=t=>e=>{var i=t[e];if(i)return i();throw new Error("Module not found in bundle: "+e)};var B=(t,e)=>()=>(t&&(e=t(t=0)),e);var o1=(t,e)=>{for(var i in e)b1(t,i,{get:e[i],enumerable:!0})},ue=(t,e,i,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of me(e))!ge.call(t,n)&&n!==i&&b1(t,n,{get:()=>e[n],enumerable:!(o=pe(e,n))||o.enumerable});return t};var n1=t=>ue(b1({},"__esModule",{value:!0}),t);import{access as we,mkdir as xe,readFile as M1,writeFile as ve}from"fs/promises";import{dirname as J1,join as C1}from"path";import W1 from"process";import{parse as ye}from"jsonc-parser";var p,l,b,v,ke,be,w,y,ze,Ce,Se,s1,m=B(()=>{"use strict";p=W1.platform==="win32",l=async t=>{try{return await we(t),!0}catch{return!1}},b=async()=>{if(await l("pnpm-workspace.yaml"))return!0;try{let t=ye(await M1("package.json","utf-8"));return t?!!t.workspaces||!!t.workspace:!1}catch{return!1}},v=async({dependencies:t,devDependencies:e,scripts:i})=>{let o=await M1("package.json","utf8"),n=JSON.parse(o),s={...n};(n.devDependencies||e)&&(s.devDependencies={...n.devDependencies,...e}),(n.dependencies||t)&&(s.dependencies={...n.dependencies,...t}),(n.scripts||i)&&(s.scripts={...n.scripts,...i}),await ve("package.json",JSON.stringify(s,null,2))},ke=/[ $(){}[\]&|;<>!"'`*?#~]/,be=/'/g,w=t=>t.map(e=>ke.test(e)?`'${e.replace(be,"'\\''")}' `:e),y=async t=>{let e=J1(t);if(e!=="."){let i=e.startsWith("./")?e.slice(2):e;await xe(i,{recursive:!0})}},ze=["biome.json","biome.jsonc"],Ce=["eslint.config.mjs","eslint.config.js","eslint.config.cjs","eslint.config.ts","eslint.config.mts","eslint.config.cts"],Se=".oxlintrc.json",s1=async()=>{let t=W1.cwd();for(;;){for(let i of ze)if(await l(C1(t,i)))return"biome";for(let i of Ce)if(await l(C1(t,i)))return"eslint";if(await l(C1(t,Se)))return"oxlint";let e=J1(t);if(e===t)break;t=e}return null}});var Dt={};o1(Dt,{husky:()=>I});import{execSync as e3}from"child_process";import{mkdir as i3,readFile as o3,writeFile as A1}from"fs/promises";import{addDevDependency as n3,dlxCommand as Q}from"nypm";var _t,Lt,K,T,I,F1=B(()=>{"use strict";m();_t=t=>`#!/bin/sh
|
|
3
3
|
${t}
|
|
4
4
|
`,Lt=t=>`#!/bin/sh
|
|
5
5
|
# Exit on any error
|
|
@@ -29,15 +29,15 @@ if [ $FORMAT_EXIT_CODE -ne 0 ]; then
|
|
|
29
29
|
fi
|
|
30
30
|
|
|
31
31
|
echo "\u2728 Files formatted by Ultracite"
|
|
32
|
-
`,
|
|
33
|
-
${i}`)},update:async(t,e=!1)=>{let i=await o3(
|
|
34
|
-
`),s=n.indexOf(
|
|
35
|
-
`);await A1(
|
|
36
|
-
${
|
|
37
|
-
${o}`:`${
|
|
38
|
-
${o}`)}else await A1(
|
|
39
|
-
${
|
|
40
|
-
${o}`)}}});var Gt={};o1(Gt,{lefthook:()=>
|
|
32
|
+
`,K="./.husky/pre-commit",T="# ultracite",I={exists:()=>l(K),install:async t=>{await n3("husky",{packageManager:t,workspace:await b(),silent:!0,corepack:!1}),await v({scripts:{prepare:"husky"}})},init:t=>{let e=Q(t,"husky",{args:["init"]});try{e3(e,{stdio:"pipe"})}catch{}},create:async(t,e=!1)=>{await i3(".husky",{recursive:!0});let i;if(e){let o=Q(t,"lint-staged",{short:t==="npm"});i=_t(o)}else{let o=Q(t,"ultracite",{args:["fix"],short:t==="npm"});i=Lt(o)}await A1(K,`${T}
|
|
33
|
+
${i}`)},update:async(t,e=!1)=>{let i=await o3(K,"utf-8"),o;if(e){let n=Q(t,"lint-staged",{short:t==="npm"});o=_t(n)}else{let n=Q(t,"ultracite",{args:["fix"],short:t==="npm"});o=Lt(n)}if(i.includes(T)){let n=i.split(`
|
|
34
|
+
`),s=n.indexOf(T),r=n.slice(0,s).join(`
|
|
35
|
+
`);await A1(K,r?`${r}
|
|
36
|
+
${T}
|
|
37
|
+
${o}`:`${T}
|
|
38
|
+
${o}`)}else await A1(K,`${i}
|
|
39
|
+
${T}
|
|
40
|
+
${o}`)}}});var Gt={};o1(Gt,{lefthook:()=>G});import{execSync as s3}from"child_process";import{readFile as r3,writeFile as Z}from"fs/promises";import{addDevDependency as a3,dlxCommand as Rt}from"nypm";var c3,l3,Tt,A,Nt,G,E1=B(()=>{"use strict";m();c3=/(pre-commit:\s*\n\s*jobs:\s*\n)/,l3=/(pre-commit:\s*\n)/,Tt=t=>Rt(t,"ultracite",{args:["fix"],short:t==="npm"}),A="./lefthook.yml",Nt=t=>`pre-commit:
|
|
41
41
|
jobs:
|
|
42
42
|
- run: ${Tt(t)}
|
|
43
43
|
glob:
|
|
@@ -49,7 +49,7 @@ ${o}`)}}});var Gt={};o1(Gt,{lefthook:()=>T});import{execSync as s3}from"child_pr
|
|
|
49
49
|
- "**/*.jsonc"
|
|
50
50
|
- "**/*.css"
|
|
51
51
|
stage_fixed: true
|
|
52
|
-
`,
|
|
52
|
+
`,G={exists:()=>l(A),install:async t=>{await a3("lefthook",{packageManager:t,workspace:await b(),silent:!0,corepack:!1}),await v({scripts:{prepare:"lefthook install"}});let e=Rt(t,"lefthook",{args:["install"],short:t==="npm"});s3(e,{stdio:"pipe"})},create:async t=>{let e=Nt(t);await Z(A,e)},update:async t=>{let e=await r3(A,"utf-8"),i=Tt(t),o=Nt(t);if(e.includes(i))return;if(e.startsWith("# EXAMPLE USAGE:")){await Z(A,o);return}if(e.includes("pre-commit:"))if(e.includes("jobs:")){let s=` - run: ${i}
|
|
53
53
|
glob:
|
|
54
54
|
- "**/*.js"
|
|
55
55
|
- "**/*.jsx"
|
|
@@ -58,8 +58,8 @@ ${o}`)}}});var Gt={};o1(Gt,{lefthook:()=>T});import{execSync as s3}from"child_pr
|
|
|
58
58
|
- "**/*.json"
|
|
59
59
|
- "**/*.jsonc"
|
|
60
60
|
- "**/*.css"
|
|
61
|
-
stage_fixed: true`,r=e.replace(
|
|
62
|
-
`);await
|
|
61
|
+
stage_fixed: true`,r=e.replace(c3,`$1${s}
|
|
62
|
+
`);await Z(A,r)}else{let s=` jobs:
|
|
63
63
|
- run: ${i}
|
|
64
64
|
glob:
|
|
65
65
|
- "**/*.js"
|
|
@@ -69,9 +69,9 @@ ${o}`)}}});var Gt={};o1(Gt,{lefthook:()=>T});import{execSync as s3}from"child_pr
|
|
|
69
69
|
- "**/*.json"
|
|
70
70
|
- "**/*.jsonc"
|
|
71
71
|
- "**/*.css"
|
|
72
|
-
stage_fixed: true`,r=e.replace(
|
|
73
|
-
`);await
|
|
74
|
-
${o}`)}}});var Jt={};o1(Jt,{preCommit:()=>
|
|
72
|
+
stage_fixed: true`,r=e.replace(l3,`$1${s}
|
|
73
|
+
`);await Z(A,r)}else await Z(A,`${e}
|
|
74
|
+
${o}`)}}});var Jt={};o1(Jt,{preCommit:()=>q});import{readFile as f3,writeFile as B1}from"fs/promises";import{dlxCommand as d3}from"nypm";var Y,p3,Mt,m3,q,U1=B(()=>{"use strict";m();Y="./.pre-commit-config.yaml",p3=/^repos:\s*\n/m,Mt=t=>d3(t,"ultracite",{args:["fix"],short:t==="npm"}),m3=t=>`repos:
|
|
75
75
|
- repo: local
|
|
76
76
|
hooks:
|
|
77
77
|
- id: ultracite
|
|
@@ -80,7 +80,7 @@ ${o}`)}}});var Jt={};o1(Jt,{preCommit:()=>Y});import{readFile as f3,writeFile as
|
|
|
80
80
|
language: system
|
|
81
81
|
types_or: [javascript, jsx, ts, tsx, json, css]
|
|
82
82
|
pass_filenames: false
|
|
83
|
-
`,
|
|
83
|
+
`,q={exists:()=>l(Y),create:async t=>{let e=m3(t);await B1(Y,e)},update:async t=>{let e=await f3(Y,"utf-8"),i=Mt(t);if(e.includes("id: ultracite"))return;let o=` - repo: local
|
|
84
84
|
hooks:
|
|
85
85
|
- id: ultracite
|
|
86
86
|
name: ultracite
|
|
@@ -89,21 +89,21 @@ ${o}`)}}});var Jt={};o1(Jt,{preCommit:()=>Y});import{readFile as f3,writeFile as
|
|
|
89
89
|
types_or: [javascript, jsx, ts, tsx, json, css]
|
|
90
90
|
pass_filenames: false
|
|
91
91
|
`;if(e.includes("repos:")){let n=e.replace(p3,`repos:
|
|
92
|
-
${o}`);await B1(
|
|
92
|
+
${o}`);await B1(Y,n)}else await B1(Y,`${e}
|
|
93
93
|
repos:
|
|
94
|
-
${o}`)}}});var g3,$1=
|
|
94
|
+
${o}`)}}});var g3,$1=B(()=>{g3=G1({"./husky.ts":()=>(F1(),n1(Dt)),"./lefthook.ts":()=>(E1(),n1(Gt)),"./lint-staged.ts":()=>(_1(),n1(Wt)),"./pre-commit.ts":()=>(U1(),n1(Jt))})});var Wt={};o1(Wt,{lintStaged:()=>M});import{readFile as p1,writeFile as F}from"fs/promises";import{pathToFileURL as u3}from"url";import t1 from"deepmerge";import{parse as D1}from"jsonc-parser";import{addDevDependency as h3,dlxCommand as w3}from"nypm";var C,Ht,x3,v3,y3,k3,b3,z3,C3,S3,j3,L1,P3,M,_1=B(()=>{"use strict";m();$1();C=t=>({"*.{js,jsx,ts,tsx,json,jsonc,css,scss,md,mdx}":[w3(t,"ultracite",{args:["fix"],short:t==="npm"})]}),Ht=["./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"],x3=(t,e,i,o)=>{let n=t.trim();if(n.includes(":")&&!n.startsWith("-")){i&&o.length>0&&(e[i]=o);let[s,...r]=n.split(":"),a=r.join(":").trim(),f=s.trim().replace(/['"]/g,"");return a&&a!==""?(a.startsWith("[")&&a.endsWith("]")?e[f]=a.slice(1,-1).split(",").map(d=>d.trim().replace(/['"]/g,"")):e[f]=a.replace(/['"]/g,""),{newCurrentKey:null,newCurrentArray:[]}):{newCurrentKey:f,newCurrentArray:[]}}if(n.startsWith("-")&&i){let s=[...o,n.slice(1).trim().replace(/['"]/g,"")];return{newCurrentKey:i,newCurrentArray:s}}return{newCurrentKey:i,newCurrentArray:o}},v3=t=>{let e=t.split(`
|
|
95
95
|
`).filter(s=>s.trim()&&!s.trim().startsWith("#")),i={},o=null,n=[];for(let s of e){let r=x3(s,i,o,n);o=r.newCurrentKey,n=r.newCurrentArray}return o&&n.length>0&&(i[o]=n),i},y3=t=>{let e="";for(let[i,o]of Object.entries(t))if(Array.isArray(o)){e+=`${i}:
|
|
96
96
|
`;for(let n of o)e+=` - '${n}'
|
|
97
97
|
`}else e+=`${i}: '${o}'
|
|
98
|
-
`;return e},k3=async()=>{try{let t=D1(await p1("./package.json","utf-8"));return t?t.type==="module":!1}catch{return!1}},b3=async t=>{let e=D1(await p1("./package.json","utf-8"));e&&(e["lint-staged"]?e["lint-staged"]=
|
|
99
|
-
`;await F(t,r)},j3=async(t,e)=>{delete z1.cache[z1.resolve(`./${t}`)];let i=g3(`./${t}`),o=
|
|
100
|
-
`;await F(t,n)},L1=async t=>{await F(".lintstagedrc.json",JSON.stringify(C(t),null,2))},P3=async(t,e)=>{if(t==="./package.json"){await b3(e);return}if(t.endsWith(".json")||t==="./.lintstagedrc"){await z3(t,e);return}if(t.endsWith(".yaml")||t.endsWith(".yml")){await C3(t,e);return}let i=await k3();if(t.endsWith(".mjs")||t.endsWith(".js")&&i){try{await S3(t,e)}catch{await L1(e)}return}if(t.endsWith(".cjs")||t.endsWith(".js")&&!i)try{await j3(t,e)}catch{await L1(e)}},G={exists:async()=>{for(let t of Ht)if(await c(t))return!0;return!1},install:async t=>{await h3("lint-staged",{packageManager:t,workspace:await b(),silent:!0,corepack:!1})},create:async t=>{await F(".lintstagedrc.json",JSON.stringify(C(t),null,2))},update:async t=>{let e=null;for(let i of Ht)if(await c(i)){e=i;break}if(!e){await L1(t);return}await P3(e,t)}}});import{Command as bi}from"commander";var k={name:"ultracite",description:"The AI-ready formatter that helps you write and generate code faster.",version:"7.2.5",type:"module",bin:{ultracite:"dist/index.js"},files:["config","dist/index.js","dist/index.d.ts","README.md"],scripts:{build:"tsup",test:"bun test","test:coverage":"bun test --coverage"},exports:{"./biome/*":"./config/biome/*/biome.jsonc","./eslint/*":"./config/eslint/*/eslint.config.mjs","./oxlint/*":"./config/oxlint/*/.oxlintrc.json","./prettier":"./config/prettier/prettier.config.mjs","./stylelint":"./config/stylelint/stylelint.config.mjs","./*":"./config/biome/*/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.4.5","@eslint/js":"^10.0.1","@next/eslint-plugin-next":"^16.1.6","@repo/data":"workspace:*","@tanstack/eslint-plugin-query":"^5.91.4","@types/node":"^25.3.3","@typescript-eslint/eslint-plugin":"^8.56.1","@typescript-eslint/parser":"^8.56.1","eslint-config-prettier":"^10.1.8","eslint-import-resolver-typescript":"^4.4.4","eslint-plugin-angular":"^5.0.0","eslint-plugin-astro":"^1.6.0","eslint-plugin-compat":"^7.0.1","eslint-plugin-cypress":"^6.1.0","eslint-plugin-github":"6.0.0","eslint-plugin-html":"^8.1.4","eslint-plugin-import":"^2.32.0","eslint-plugin-jest":"^29.15.0","eslint-plugin-jsx-a11y":"^6.10.2","eslint-plugin-n":"^17.24.0","eslint-plugin-prettier":"^5.5.5","eslint-plugin-promise":"^7.2.1","eslint-plugin-qwik":"^1.19.1","eslint-plugin-react":"^7.37.5","eslint-plugin-react-hooks":"^7.0.1","eslint-plugin-remix":"^1.1.1","eslint-plugin-solid":"^0.14.5","eslint-plugin-sonarjs":"^4.0.0","eslint-plugin-storybook":"^10.2.15","eslint-plugin-svelte":"^3.15.0","eslint-plugin-unicorn":"^63.0.0","eslint-plugin-unused-imports":"^4.4.1","eslint-plugin-vue":"^10.8.0",globals:"^17.4.0","prettier-plugin-tailwindcss":"^0.7.2","stylelint-config-idiomatic-order":"^10.0.0","stylelint-config-standard":"^40.0.0","stylelint-prettier":"^5.0.3",tsup:"^8.5.1",oxlint:"^1.51.0"},dependencies:{"@clack/prompts":"^1.1.0",commander:"^14.0.3",deepmerge:"^4.3.1",glob:"^13.0.6","jsonc-parser":"^3.3.1",nypm:"^0.6.5"},peerDependencies:{oxlint:"^1.0.0"},peerDependenciesMeta:{oxlint:{optional:!0}},packageManager:"bun@1.3.10"};m();import{spawnSync as B}from"child_process";import U from"process";var je=(t,e)=>{let i=["check","--no-errors-on-unmatched",...e];t.length>0?i.push(...h(t)):i.push("./");let o=B("biome",i,{stdio:"inherit",shell:p});if(o.error)throw new Error(`Failed to run Biome: ${o.error.message}`);o.status!==0&&U.exit(o.status??1)},Pe=(t,e)=>{let i=[...e,...t.length>0?h(t):["."]],o=B("eslint",i,{stdio:"inherit",shell:p});if(o.error)throw new Error(`Failed to run ESLint: ${o.error.message}`);o.status!==0&&U.exit(o.status??1)},Oe=(t,e)=>{let i=["--check",...e,...t.length>0?h(t):["."]],o=B("prettier",i,{stdio:"inherit",shell:p});if(o.error)throw new Error(`Failed to run Prettier: ${o.error.message}`);o.status!==0&&U.exit(o.status??1)},Ie=(t,e)=>{let i=[...e,...t.length>0?h(t):["."]],o=B("stylelint",i,{stdio:"inherit",shell:p});if(o.error)throw new Error(`Failed to run Stylelint: ${o.error.message}`);o.status!==0&&U.exit(o.status??1)},Ae=(t,e)=>{let i=[...e,...t.length>0?h(t):["."]],o=B("oxlint",i,{stdio:"inherit",shell:p});if(o.error)throw new Error(`Failed to run Oxlint: ${o.error.message}`);o.status!==0&&U.exit(o.status??1)},Fe=(t,e)=>{let i=["--check",...e,...t.length>0?h(t):["."]],o=B("oxfmt",i,{stdio:"inherit",shell:p});if(o.error)throw new Error(`Failed to run oxfmt: ${o.error.message}`);o.status!==0&&U.exit(o.status??1)},H1=async(t=[],e=[])=>{let i=await s1();if(!i)throw new Error("No linter configuration found. Run `ultracite init` to set up a linter.");switch(i){case"eslint":{await Oe(t,[]),await Pe(t,e),await Ie(t,[]);break}case"oxlint":{await Fe(t,[]),await Ae(t,e);break}default:await je(t,e)}};import{spawnSync as j1}from"child_process";import{existsSync as S}from"fs";import{readFile as a1}from"fs/promises";import{join as j}from"path";import P from"process";import{intro as Ee,log as r1,outro as S1,spinner as Be}from"@clack/prompts";import{parse as V1}from"jsonc-parser";m();var Ue=[".prettierrc",".prettierrc.js",".prettierrc.cjs",".prettierrc.mjs",".prettierrc.json",".prettierrc.yaml",".prettierrc.yml","prettier.config.js","prettier.config.mjs","prettier.config.cjs"],$e=[".eslintrc",".eslintrc.js",".eslintrc.cjs",".eslintrc.mjs",".eslintrc.json",".eslintrc.yaml",".eslintrc.yml","eslint.config.js","eslint.config.mjs","eslint.config.cjs","eslint.config.ts","eslint.config.mts","eslint.config.cts"],_e=()=>{let t=j1("biome",["--version"],{encoding:"utf-8",shell:p});return t.status===0&&t.stdout?{name:"Biome installation",status:"pass",message:`Biome is installed (${t.stdout.trim()})`}:{name:"Biome installation",status:"fail",message:"Biome is not installed or not accessible"}},Le=()=>{let t=j1("eslint",["--version"],{encoding:"utf-8",shell:p});return t.status===0&&t.stdout?{name:"ESLint installation",status:"pass",message:`ESLint is installed (${t.stdout.trim()})`}:{name:"ESLint installation",status:"warn",message:"ESLint is not installed (optional)"}},De=()=>{let t=j1("oxlint",["--version"],{encoding:"utf-8",shell:p});return t.status===0&&t.stdout?{name:"Oxlint installation",status:"pass",message:`Oxlint is installed (${t.stdout.trim()})`}:{name:"Oxlint installation",status:"warn",message:"Oxlint is not installed (optional)"}},Ne=async()=>{let t=j(P.cwd(),"biome.json"),e=j(P.cwd(),"biome.jsonc"),i=null;if(S(t)?i=t:S(e)&&(i=e),!i)return{name:"Biome configuration",status:"warn",message:"No biome.json or biome.jsonc file found"};try{let o=await a1(i,"utf-8"),n=V1(o);return Array.isArray(n?.extends)&&n.extends.includes("ultracite/biome/core")?{name:"Biome configuration",status:"pass",message:"biome.json(c) extends ultracite/biome/core"}:{name:"Biome configuration",status:"warn",message:"biome.json(c) exists but doesn't extend ultracite/biome/core"}}catch{return{name:"Biome configuration",status:"fail",message:"Could not parse biome.json(c) file"}}},Re=async()=>{let t=["eslint.config.mjs","eslint.config.js","eslint.config.cjs","eslint.config.ts","eslint.config.mts","eslint.config.cts"],e=null;for(let i of t){let o=j(P.cwd(),i);if(S(o)){e=o;break}}if(!e)return{name:"ESLint configuration",status:"warn",message:"No eslint.config.* file found (optional)"};try{return(await a1(e,"utf-8")).includes("ultracite/eslint")?{name:"ESLint configuration",status:"pass",message:"eslint.config.* imports ultracite/eslint"}:{name:"ESLint configuration",status:"warn",message:"eslint.config.* exists but doesn't import ultracite/eslint"}}catch{return{name:"ESLint configuration",status:"fail",message:"Could not read eslint.config.* file"}}},Te=t=>`./node_modules/ultracite/config/oxlint/${t}/.oxlintrc.json`,Ge=async()=>{let t=j(P.cwd(),".oxlintrc.json");if(!S(t))return{name:"Oxlint configuration",status:"warn",message:"No .oxlintrc.json file found (optional)"};try{let e=await a1(t,"utf-8"),i=V1(e);return Array.isArray(i?.extends)&&i.extends.includes(Te("core"))?{name:"Oxlint configuration",status:"pass",message:".oxlintrc.json extends ultracite oxlint config"}:{name:"Oxlint configuration",status:"warn",message:".oxlintrc.json exists but doesn't extend ultracite config"}}catch{return{name:"Oxlint configuration",status:"fail",message:"Could not parse .oxlintrc.json file"}}},Me=async()=>{let t=j(P.cwd(),"package.json");if(!S(t))return{name:"Ultracite dependency",status:"warn",message:"No package.json found"};try{let e=JSON.parse(await a1(t,"utf-8")),i=e.dependencies?.ultracite||e.devDependencies?.ultracite||e.peerDependencies?.ultracite;return i?{name:"Ultracite dependency",status:"pass",message:`Ultracite is in package.json (${i})`}:{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"}}},Je=()=>{let t=Ue.some(o=>S(j(P.cwd(),o))),i=$e.filter(o=>!o.startsWith("eslint.config")).some(o=>S(j(P.cwd(),o)));if(t||i){let o=[];return t&&o.push("Prettier"),i&&o.push("ESLint (legacy config)"),{name:"Conflicting tools",status:"warn",message:`Found potentially conflicting tools: ${o.join(", ")}`}}return{name:"Conflicting tools",status:"pass",message:"No conflicting formatting/linting tools found"}},z=async(t,e)=>{let i=Be();i.start(`Checking ${e}...`);let o=await t();return o.status==="pass"||o.status,i.stop(o.message),o},X1=async()=>{Ee(`Ultracite v${k.version} Doctor`);let t=[];t.push(await z(_e,"Biome installation")),t.push(await z(Le,"ESLint installation")),t.push(await z(De,"Oxlint installation")),t.push(await z(Ne,"Biome configuration")),t.push(await z(Re,"ESLint configuration")),t.push(await z(Ge,"Oxlint configuration")),t.push(await z(Me,"Ultracite dependency")),t.push(await z(Je,"conflicting tools"));let e=t.filter(n=>n.status==="pass").length,i=t.filter(n=>n.status==="fail").length,o=t.filter(n=>n.status==="warn").length;if(r1.info(`Summary: ${e} passed, ${o} warnings, ${i} failed`),i>0)throw r1.error("Some checks failed. Run 'ultracite init' to fix issues."),S1("Doctor complete"),new Error("Doctor checks failed");if(o>0){r1.warn("Some optional improvements available. Run 'ultracite init' to configure."),S1("Doctor complete");return}r1.success("Everything looks good!"),S1("Doctor complete")};m();import{spawnSync as $}from"child_process";import _ from"process";var We=(t,e)=>{let i=["check","--write","--no-errors-on-unmatched",...e];t.length>0?i.push(...h(t)):i.push("./");let o=$("biome",i,{stdio:"inherit",shell:p});if(o.error)throw new Error(`Failed to run Biome: ${o.error.message}`);o.status!==0&&_.exit(o.status??1)},He=(t,e)=>{let i=["--fix",...e,...t.length>0?h(t):["."]],o=$("eslint",i,{stdio:"inherit",shell:p});if(o.error)throw new Error(`Failed to run ESLint: ${o.error.message}`);o.status!==0&&_.exit(o.status??1)},Ve=(t,e)=>{let i=["--write",...e,...t.length>0?h(t):["."]],o=$("prettier",i,{stdio:"inherit",shell:p});if(o.error)throw new Error(`Failed to run Prettier: ${o.error.message}`);o.status!==0&&_.exit(o.status??1)},Xe=(t,e)=>{let i=["--fix",...e,...t.length>0?h(t):["."]],o=$("stylelint",i,{stdio:"inherit",shell:p});if(o.error)throw new Error(`Failed to run Stylelint: ${o.error.message}`);o.status!==0&&_.exit(o.status??1)},Qe=(t,e)=>{let i=e.includes("--unsafe"),o=e.filter(r=>r!=="--unsafe"),n=[i?"--fix-dangerously":"--fix",...o,...t.length>0?h(t):["."]],s=$("oxlint",n,{stdio:"inherit",shell:p});if(s.error)throw new Error(`Failed to run Oxlint: ${s.error.message}`);s.status!==0&&_.exit(s.status??1)},Ke=(t,e)=>{let i=["--write",...e,...t.length>0?h(t):["."]],o=$("oxfmt",i,{stdio:"inherit",shell:p});if(o.error)throw new Error(`Failed to run oxfmt: ${o.error.message}`);o.status!==0&&_.exit(o.status??1)},Q1=async(t,e=[])=>{let i=await s1();if(!i)throw new Error("No linter configuration found. Run `ultracite init` to set up a linter.");switch(i){case"eslint":{await Ve(t,[]),await He(t,e),await Xe(t,[]);break}case"oxlint":{await Ke(t,[]),await Qe(t,e);break}default:await We(t,e)}};import ti from"process";import{cancel as J,intro as ei,isCancel as W,log as t1,multiselect as e1,select as ii,spinner as g}from"@clack/prompts";var K1="./aider-K7JLZT2D.svg";var Z1="./amazon-q-TSOJNPXB.svg";var Y1="./amp-EV4LVL5I.svg";var q1="./augmentcode-Q62PVXKO.svg";var tt="./claude-6DLEHRDQ.svg";var et="./cline-6HWKIYN7.svg";var it="./codex-NQZ5TJCL.svg";var ot="./copilot-L2IY45R2.svg";var nt="./crush-LYLRDQGZ.svg";var l1="./cursor-GQNH5LCA.svg";var st="./droid-266OHJBT.svg";var rt="./firebase-studio-ILLWWYU7.svg";var at="./firebender-UNO6LSZG.svg";var lt="./gemini-OYS6V4BH.svg";var ct="./goose-XBIEVD4H.svg";var ft="./jules-HJPVWU73.svg";var dt="./junie-RUWBUV6N.svg";var pt="./kilo-code-4QYUYY2E.svg";var mt="./mistral-HQ63EC2B.svg";var gt="./open-hands-K5EYKO6T.svg";var ut="./opencode-K3274JKQ.svg";var ht="./qwen-N3D5CQYL.svg";var wt="./roo-code-CVLBTS7D.svg";var xt="./vercel-27VSITAQ.svg";var vt="./warp-OZKAAQRT.svg";var L=[{id:"claude",name:"Claude Code",subtitle:"Anthropic's agentic CLI",description:"Anthropic's official CLI for Claude, an agentic coding tool that lives in your terminal.",config:{path:".claude/CLAUDE.md",appendMode:!0},logo:tt,hooks:{path:".claude/settings.json",getContent:t=>({hooks:{PostToolUse:[{matcher:"Write|Edit",hooks:[{type:"command",command:t}]}]}})}},{id:"codex",name:"Codex",subtitle:"OpenAI's coding agent",description:"OpenAI's cloud-based coding agent for autonomous software development tasks.",config:{path:"AGENTS.md",appendMode:!0},logo:it},{id:"jules",name:"Jules",subtitle:"Google's async agent",description:"Google's asynchronous AI coding agent that works in the background to complete development tasks.",config:{path:"AGENTS.md",appendMode:!0},logo:ft},{id:"copilot",name:"GitHub Copilot",subtitle:"GitHub's AI pair programmer",description:"GitHub's AI pair programmer that suggests code completions and helps write code faster.",config:{path:".github/copilot-instructions.md",appendMode:!0,header:`---
|
|
98
|
+
`;return e},k3=async()=>{try{let t=D1(await p1("./package.json","utf-8"));return t?t.type==="module":!1}catch{return!1}},b3=async t=>{let e=D1(await p1("./package.json","utf-8"));e&&(e["lint-staged"]?e["lint-staged"]=t1(e["lint-staged"],C(t)):e["lint-staged"]=C(t),await F("./package.json",JSON.stringify(e,null,2)))},z3=async(t,e)=>{let i=await p1(t,"utf-8"),o=D1(i);if(!o)return;let n=t1(o,C(e));await F(t,JSON.stringify(n,null,2))},C3=async(t,e)=>{let i=await p1(t,"utf-8"),o=v3(i);if(!o)return;let n=t1(o,C(e));await F(t,y3(n))},S3=async(t,e)=>{let n=(await import(u3(t).href)).default||{},s=t1(n,C(e)),r=`export default ${JSON.stringify(s,null,2)};
|
|
99
|
+
`;await F(t,r)},j3=async(t,e)=>{delete z1.cache[z1.resolve(`./${t}`)];let i=g3(`./${t}`),o=t1(i,C(e)),n=`module.exports = ${JSON.stringify(o,null,2)};
|
|
100
|
+
`;await F(t,n)},L1=async t=>{await F(".lintstagedrc.json",JSON.stringify(C(t),null,2))},P3=async(t,e)=>{if(t==="./package.json"){await b3(e);return}if(t.endsWith(".json")||t==="./.lintstagedrc"){await z3(t,e);return}if(t.endsWith(".yaml")||t.endsWith(".yml")){await C3(t,e);return}let i=await k3();if(t.endsWith(".mjs")||t.endsWith(".js")&&i){try{await S3(t,e)}catch{await L1(e)}return}if(t.endsWith(".cjs")||t.endsWith(".js")&&!i)try{await j3(t,e)}catch{await L1(e)}},M={exists:async()=>{for(let t of Ht)if(await l(t))return!0;return!1},install:async t=>{await h3("lint-staged",{packageManager:t,workspace:await b(),silent:!0,corepack:!1})},create:async t=>{await F(".lintstagedrc.json",JSON.stringify(C(t),null,2))},update:async t=>{let e=null;for(let i of Ht)if(await l(i)){e=i;break}if(!e){await L1(t);return}await P3(e,t)}}});import{Command as zi}from"commander";var k={name:"ultracite",description:"The AI-ready formatter that helps you write and generate code faster.",version:"7.3.0",type:"module",bin:{ultracite:"dist/index.js"},files:["config","dist/index.js","dist/index.d.ts","README.md"],scripts:{build:"tsup",test:"bun test","test:coverage":"bun test --coverage"},exports:{"./biome/*":"./config/biome/*/biome.jsonc","./eslint/*":"./config/eslint/*/eslint.config.mjs","./oxlint/*":"./config/oxlint/*/.oxlintrc.json","./prettier":"./config/prettier/prettier.config.mjs","./stylelint":"./config/stylelint/stylelint.config.mjs","./*":"./config/biome/*/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.4.5","@eslint/js":"^10.0.1","@next/eslint-plugin-next":"^16.1.6","@repo/data":"workspace:*","@tanstack/eslint-plugin-query":"^5.91.4","@types/node":"^25.3.3","@typescript-eslint/eslint-plugin":"^8.56.1","@typescript-eslint/parser":"^8.56.1","eslint-config-prettier":"^10.1.8","eslint-import-resolver-typescript":"^4.4.4","eslint-plugin-angular":"^5.0.0","eslint-plugin-astro":"^1.6.0","eslint-plugin-compat":"^7.0.1","eslint-plugin-cypress":"^6.1.0","eslint-plugin-github":"6.0.0","eslint-plugin-html":"^8.1.4","eslint-plugin-import":"^2.32.0","eslint-plugin-jest":"^29.15.0","eslint-plugin-jsx-a11y":"^6.10.2","eslint-plugin-n":"^17.24.0","eslint-plugin-prettier":"^5.5.5","eslint-plugin-promise":"^7.2.1","eslint-plugin-qwik":"^1.19.1","eslint-plugin-react":"^7.37.5","eslint-plugin-react-hooks":"^7.0.1","eslint-plugin-remix":"^1.1.1","eslint-plugin-solid":"^0.14.5","eslint-plugin-sonarjs":"^4.0.0","eslint-plugin-storybook":"^10.2.15","eslint-plugin-svelte":"^3.15.0","eslint-plugin-unicorn":"^63.0.0","eslint-plugin-unused-imports":"^4.4.1","eslint-plugin-vue":"^10.8.0",globals:"^17.4.0","prettier-plugin-tailwindcss":"^0.7.2","stylelint-config-idiomatic-order":"^10.0.0","stylelint-config-standard":"^40.0.0","stylelint-prettier":"^5.0.3",tsup:"^8.5.1",oxlint:"^1.51.0"},dependencies:{"@clack/prompts":"^1.1.0",commander:"^14.0.3",deepmerge:"^4.3.1",glob:"^13.0.6","jsonc-parser":"^3.3.1",nypm:"^0.6.5"},peerDependencies:{oxlint:"^1.0.0"},peerDependenciesMeta:{oxlint:{optional:!0}},packageManager:"bun@1.3.10"};m();import{spawnSync as U}from"child_process";import $ from"process";var je=(t,e)=>{let i=e.includes("--type-aware"),o=e.filter(r=>r!=="--type-aware"),n=["check","--no-errors-on-unmatched"];i||n.push("--skip=project"),n.push(...o),t.length>0?n.push(...w(t)):n.push("./");let s=U("biome",n,{stdio:"inherit",shell:p});if(s.error)throw new Error(`Failed to run Biome: ${s.error.message}`);s.status!==0&&$.exit(s.status??1)},Pe=(t,e)=>{let i=[...e,...t.length>0?w(t):["."]],o=U("eslint",i,{stdio:"inherit",shell:p});if(o.error)throw new Error(`Failed to run ESLint: ${o.error.message}`);o.status!==0&&$.exit(o.status??1)},Oe=(t,e)=>{let i=["--check",...e,...t.length>0?w(t):["."]],o=U("prettier",i,{stdio:"inherit",shell:p});if(o.error)throw new Error(`Failed to run Prettier: ${o.error.message}`);o.status!==0&&$.exit(o.status??1)},Ie=(t,e)=>{let i=[...e,...t.length>0?w(t):["."]],o=U("stylelint",i,{stdio:"inherit",shell:p});if(o.error)throw new Error(`Failed to run Stylelint: ${o.error.message}`);o.status!==0&&$.exit(o.status??1)},Ae=(t,e)=>{let i=[...e,...t.length>0?w(t):["."]],o=U("oxlint",i,{stdio:"inherit",shell:p});if(o.error)throw new Error(`Failed to run Oxlint: ${o.error.message}`);o.status!==0&&$.exit(o.status??1)},Fe=(t,e)=>{let i=["--check",...e,...t.length>0?w(t):["."]],o=U("oxfmt",i,{stdio:"inherit",shell:p});if(o.error)throw new Error(`Failed to run oxfmt: ${o.error.message}`);o.status!==0&&$.exit(o.status??1)},H1=async(t=[],e=[])=>{let i=await s1();if(!i)throw new Error("No linter configuration found. Run `ultracite init` to set up a linter.");switch(i){case"eslint":{await Oe(t,[]),await Pe(t,e),await Ie(t,[]);break}case"oxlint":{await Fe(t,[]),await Ae(t,e);break}default:await je(t,e)}};import{spawnSync as j1}from"child_process";import{existsSync as S}from"fs";import{readFile as a1}from"fs/promises";import{join as j}from"path";import P from"process";import{intro as Ee,log as r1,outro as S1,spinner as Be}from"@clack/prompts";import{parse as V1}from"jsonc-parser";m();var Ue=[".prettierrc",".prettierrc.js",".prettierrc.cjs",".prettierrc.mjs",".prettierrc.json",".prettierrc.yaml",".prettierrc.yml","prettier.config.js","prettier.config.mjs","prettier.config.cjs"],$e=[".eslintrc",".eslintrc.js",".eslintrc.cjs",".eslintrc.mjs",".eslintrc.json",".eslintrc.yaml",".eslintrc.yml","eslint.config.js","eslint.config.mjs","eslint.config.cjs","eslint.config.ts","eslint.config.mts","eslint.config.cts"],_e=()=>{let t=j1("biome",["--version"],{encoding:"utf-8",shell:p});return t.status===0&&t.stdout?{name:"Biome installation",status:"pass",message:`Biome is installed (${t.stdout.trim()})`}:{name:"Biome installation",status:"fail",message:"Biome is not installed or not accessible"}},Le=()=>{let t=j1("eslint",["--version"],{encoding:"utf-8",shell:p});return t.status===0&&t.stdout?{name:"ESLint installation",status:"pass",message:`ESLint is installed (${t.stdout.trim()})`}:{name:"ESLint installation",status:"warn",message:"ESLint is not installed (optional)"}},De=()=>{let t=j1("oxlint",["--version"],{encoding:"utf-8",shell:p});return t.status===0&&t.stdout?{name:"Oxlint installation",status:"pass",message:`Oxlint is installed (${t.stdout.trim()})`}:{name:"Oxlint installation",status:"warn",message:"Oxlint is not installed (optional)"}},Ne=async()=>{let t=j(P.cwd(),"biome.json"),e=j(P.cwd(),"biome.jsonc"),i=null;if(S(t)?i=t:S(e)&&(i=e),!i)return{name:"Biome configuration",status:"warn",message:"No biome.json or biome.jsonc file found"};try{let o=await a1(i,"utf-8"),n=V1(o);return Array.isArray(n?.extends)&&n.extends.includes("ultracite/biome/core")?{name:"Biome configuration",status:"pass",message:"biome.json(c) extends ultracite/biome/core"}:{name:"Biome configuration",status:"warn",message:"biome.json(c) exists but doesn't extend ultracite/biome/core"}}catch{return{name:"Biome configuration",status:"fail",message:"Could not parse biome.json(c) file"}}},Re=async()=>{let t=["eslint.config.mjs","eslint.config.js","eslint.config.cjs","eslint.config.ts","eslint.config.mts","eslint.config.cts"],e=null;for(let i of t){let o=j(P.cwd(),i);if(S(o)){e=o;break}}if(!e)return{name:"ESLint configuration",status:"warn",message:"No eslint.config.* file found (optional)"};try{return(await a1(e,"utf-8")).includes("ultracite/eslint")?{name:"ESLint configuration",status:"pass",message:"eslint.config.* imports ultracite/eslint"}:{name:"ESLint configuration",status:"warn",message:"eslint.config.* exists but doesn't import ultracite/eslint"}}catch{return{name:"ESLint configuration",status:"fail",message:"Could not read eslint.config.* file"}}},Te=t=>`./node_modules/ultracite/config/oxlint/${t}/.oxlintrc.json`,Ge=async()=>{let t=j(P.cwd(),".oxlintrc.json");if(!S(t))return{name:"Oxlint configuration",status:"warn",message:"No .oxlintrc.json file found (optional)"};try{let e=await a1(t,"utf-8"),i=V1(e);return Array.isArray(i?.extends)&&i.extends.includes(Te("core"))?{name:"Oxlint configuration",status:"pass",message:".oxlintrc.json extends ultracite oxlint config"}:{name:"Oxlint configuration",status:"warn",message:".oxlintrc.json exists but doesn't extend ultracite config"}}catch{return{name:"Oxlint configuration",status:"fail",message:"Could not parse .oxlintrc.json file"}}},Me=async()=>{let t=j(P.cwd(),"package.json");if(!S(t))return{name:"Ultracite dependency",status:"warn",message:"No package.json found"};try{let e=JSON.parse(await a1(t,"utf-8")),i=e.dependencies?.ultracite||e.devDependencies?.ultracite||e.peerDependencies?.ultracite;return i?{name:"Ultracite dependency",status:"pass",message:`Ultracite is in package.json (${i})`}:{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"}}},Je=()=>{let t=Ue.some(o=>S(j(P.cwd(),o))),i=$e.filter(o=>!o.startsWith("eslint.config")).some(o=>S(j(P.cwd(),o)));if(t||i){let o=[];return t&&o.push("Prettier"),i&&o.push("ESLint (legacy config)"),{name:"Conflicting tools",status:"warn",message:`Found potentially conflicting tools: ${o.join(", ")}`}}return{name:"Conflicting tools",status:"pass",message:"No conflicting formatting/linting tools found"}},z=async(t,e)=>{let i=Be();i.start(`Checking ${e}...`);let o=await t();return o.status==="pass"||o.status,i.stop(o.message),o},X1=async()=>{Ee(`Ultracite v${k.version} Doctor`);let t=[];t.push(await z(_e,"Biome installation")),t.push(await z(Le,"ESLint installation")),t.push(await z(De,"Oxlint installation")),t.push(await z(Ne,"Biome configuration")),t.push(await z(Re,"ESLint configuration")),t.push(await z(Ge,"Oxlint configuration")),t.push(await z(Me,"Ultracite dependency")),t.push(await z(Je,"conflicting tools"));let e=t.filter(n=>n.status==="pass").length,i=t.filter(n=>n.status==="fail").length,o=t.filter(n=>n.status==="warn").length;if(r1.info(`Summary: ${e} passed, ${o} warnings, ${i} failed`),i>0)throw r1.error("Some checks failed. Run 'ultracite init' to fix issues."),S1("Doctor complete"),new Error("Doctor checks failed");if(o>0){r1.warn("Some optional improvements available. Run 'ultracite init' to configure."),S1("Doctor complete");return}r1.success("Everything looks good!"),S1("Doctor complete")};m();import{spawnSync as _}from"child_process";import L from"process";var We=(t,e)=>{let i=e.includes("--type-aware"),o=e.filter(r=>r!=="--type-aware"),n=["check","--write","--no-errors-on-unmatched"];i||n.push("--skip=project"),n.push(...o),t.length>0?n.push(...w(t)):n.push("./");let s=_("biome",n,{stdio:"inherit",shell:p});if(s.error)throw new Error(`Failed to run Biome: ${s.error.message}`);s.status!==0&&L.exit(s.status??1)},He=(t,e)=>{let i=["--fix",...e,...t.length>0?w(t):["."]],o=_("eslint",i,{stdio:"inherit",shell:p});if(o.error)throw new Error(`Failed to run ESLint: ${o.error.message}`);o.status!==0&&L.exit(o.status??1)},Ve=(t,e)=>{let i=["--write",...e,...t.length>0?w(t):["."]],o=_("prettier",i,{stdio:"inherit",shell:p});if(o.error)throw new Error(`Failed to run Prettier: ${o.error.message}`);o.status!==0&&L.exit(o.status??1)},Xe=(t,e)=>{let i=["--fix",...e,...t.length>0?w(t):["."]],o=_("stylelint",i,{stdio:"inherit",shell:p});if(o.error)throw new Error(`Failed to run Stylelint: ${o.error.message}`);o.status!==0&&L.exit(o.status??1)},Qe=(t,e)=>{let i=e.includes("--unsafe"),o=e.filter(r=>r!=="--unsafe"),n=[i?"--fix-dangerously":"--fix",...o,...t.length>0?w(t):["."]],s=_("oxlint",n,{stdio:"inherit",shell:p});if(s.error)throw new Error(`Failed to run Oxlint: ${s.error.message}`);s.status!==0&&L.exit(s.status??1)},Ke=(t,e)=>{let i=["--write",...e,...t.length>0?w(t):["."]],o=_("oxfmt",i,{stdio:"inherit",shell:p});if(o.error)throw new Error(`Failed to run oxfmt: ${o.error.message}`);o.status!==0&&L.exit(o.status??1)},Q1=async(t,e=[])=>{let i=await s1();if(!i)throw new Error("No linter configuration found. Run `ultracite init` to set up a linter.");switch(i){case"eslint":{await Ve(t,[]),await He(t,e),await Xe(t,[]);break}case"oxlint":{await Ke(t,[]),await Qe(t,e);break}default:await We(t,e)}};import ti from"process";import{cancel as W,intro as ei,isCancel as H,log as e1,multiselect as i1,select as ii,spinner as h}from"@clack/prompts";var K1="./aider-K7JLZT2D.svg";var Z1="./amazon-q-TSOJNPXB.svg";var Y1="./amp-EV4LVL5I.svg";var q1="./augmentcode-Q62PVXKO.svg";var tt="./claude-6DLEHRDQ.svg";var et="./cline-6HWKIYN7.svg";var it="./codex-NQZ5TJCL.svg";var ot="./copilot-L2IY45R2.svg";var nt="./crush-LYLRDQGZ.svg";var c1="./cursor-GQNH5LCA.svg";var st="./droid-266OHJBT.svg";var rt="./firebase-studio-ILLWWYU7.svg";var at="./firebender-UNO6LSZG.svg";var ct="./gemini-OYS6V4BH.svg";var lt="./goose-XBIEVD4H.svg";var ft="./jules-HJPVWU73.svg";var dt="./junie-RUWBUV6N.svg";var pt="./kilo-code-4QYUYY2E.svg";var mt="./mistral-HQ63EC2B.svg";var gt="./open-hands-K5EYKO6T.svg";var ut="./opencode-K3274JKQ.svg";var ht="./qwen-N3D5CQYL.svg";var wt="./roo-code-CVLBTS7D.svg";var xt="./vercel-27VSITAQ.svg";var vt="./warp-OZKAAQRT.svg";var D=[{id:"claude",name:"Claude Code",subtitle:"Anthropic's agentic CLI",description:"Anthropic's official CLI for Claude, an agentic coding tool that lives in your terminal.",config:{path:".claude/CLAUDE.md",appendMode:!0},logo:tt,hooks:{path:".claude/settings.json",getContent:t=>({hooks:{PostToolUse:[{matcher:"Write|Edit",hooks:[{type:"command",command:t}]}]}})}},{id:"codex",name:"Codex",subtitle:"OpenAI's coding agent",description:"OpenAI's cloud-based coding agent for autonomous software development tasks.",config:{path:"AGENTS.md",appendMode:!0},logo:it},{id:"jules",name:"Jules",subtitle:"Google's async agent",description:"Google's asynchronous AI coding agent that works in the background to complete development tasks.",config:{path:"AGENTS.md",appendMode:!0},logo:ft},{id:"copilot",name:"GitHub Copilot",subtitle:"GitHub's AI pair programmer",description:"GitHub's AI pair programmer that suggests code completions and helps write code faster.",config:{path:".github/copilot-instructions.md",appendMode:!0,header:`---
|
|
101
101
|
applyTo: "**/*.{ts,tsx,js,jsx}"
|
|
102
|
-
---`},logo:ot,hooks:{path:".github/hooks/ultracite.json",getContent:t=>({hooks:{PostToolUse:[{type:"command",command:t}]}})}},{id:"cline",name:"Cline",subtitle:"Autonomous VS Code agent",description:"An autonomous coding agent for VS Code that can create and edit files, run commands, and more.",config:{path:".clinerules",appendMode:!0},logo:et},{id:"amp",name:"AMP",subtitle:"Sourcegraph's coding agent",description:"Sourcegraph's AI coding agent that understands your entire codebase for intelligent assistance.",config:{path:"AGENTS.md",appendMode:!0},logo:Y1},{id:"aider",name:"Aider",subtitle:"Terminal pair programming",description:"AI pair programming in your terminal with support for multiple LLM providers.",config:{path:"ultracite.md"},logo:K1},{id:"firebase-studio",name:"Firebase Studio",subtitle:"Google's cloud IDE",description:"Google's AI-powered development environment integrated with Firebase services.",config:{path:".idx/airules.md",appendMode:!0},logo:rt},{id:"open-hands",name:"OpenHands",subtitle:"Open-source AI agents",description:"An open-source platform for AI software development agents with autonomous capabilities.",config:{path:".openhands/microagents/repo.md",appendMode:!0},logo:gt},{id:"gemini",name:"Gemini",subtitle:"Google's terminal AI",description:"Google's command-line interface for Gemini, bringing AI assistance to your terminal.",config:{path:"GEMINI.md",appendMode:!0},logo:
|
|
102
|
+
---`},logo:ot,hooks:{path:".github/hooks/ultracite.json",getContent:t=>({hooks:{PostToolUse:[{type:"command",command:t}]}})}},{id:"cline",name:"Cline",subtitle:"Autonomous VS Code agent",description:"An autonomous coding agent for VS Code that can create and edit files, run commands, and more.",config:{path:".clinerules",appendMode:!0},logo:et},{id:"amp",name:"AMP",subtitle:"Sourcegraph's coding agent",description:"Sourcegraph's AI coding agent that understands your entire codebase for intelligent assistance.",config:{path:"AGENTS.md",appendMode:!0},logo:Y1},{id:"aider",name:"Aider",subtitle:"Terminal pair programming",description:"AI pair programming in your terminal with support for multiple LLM providers.",config:{path:"ultracite.md"},logo:K1},{id:"firebase-studio",name:"Firebase Studio",subtitle:"Google's cloud IDE",description:"Google's AI-powered development environment integrated with Firebase services.",config:{path:".idx/airules.md",appendMode:!0},logo:rt},{id:"open-hands",name:"OpenHands",subtitle:"Open-source AI agents",description:"An open-source platform for AI software development agents with autonomous capabilities.",config:{path:".openhands/microagents/repo.md",appendMode:!0},logo:gt},{id:"gemini",name:"Gemini",subtitle:"Google's terminal AI",description:"Google's command-line interface for Gemini, bringing AI assistance to your terminal.",config:{path:"GEMINI.md",appendMode:!0},logo:ct},{id:"junie",name:"Junie",subtitle:"JetBrains' AI agent",description:"JetBrains' AI coding agent integrated into their IDE ecosystem.",config:{path:".junie/guidelines.md",appendMode:!0},logo:dt},{id:"augmentcode",name:"Augment Code",subtitle:"Enterprise AI assistant",description:"An AI coding assistant focused on enterprise development workflows and team collaboration.",config:{path:".augment/rules/ultracite.md"},logo:q1},{id:"kilo-code",name:"Kilo Code",subtitle:"Customizable VS Code AI",description:"A VS Code extension providing AI-powered coding assistance with customizable rules.",config:{path:".kilocode/rules/ultracite.md"},logo:pt},{id:"goose",name:"Goose",subtitle:"Block's open-source agent",description:"Block's open-source AI developer agent for autonomous software development.",config:{path:".goosehints",appendMode:!0},logo:lt},{id:"roo-code",name:"Roo Code",subtitle:"Codebase navigation AI",description:"An AI coding assistant focused on understanding and navigating complex codebases.",config:{path:".roo/rules/ultracite.md",appendMode:!0},logo:wt},{id:"warp",name:"Warp",subtitle:"Modern AI terminal",description:"A modern terminal with AI-powered command suggestions and workflow automation.",config:{path:"AGENTS.md",appendMode:!0},logo:vt},{id:"droid",name:"Droid",subtitle:"Automated code generation",description:"An AI development agent focused on automated code generation and task completion.",config:{path:"AGENTS.md",appendMode:!0},logo:st},{id:"opencode",name:"OpenCode",subtitle:"Open-source coding agent",description:"An open-source AI coding agent that runs in your terminal, desktop, or IDE with support for 75+ LLM providers.",config:{path:"AGENTS.md",appendMode:!0},logo:ut},{id:"crush",name:"Crush",subtitle:"Glamorous terminal agent",description:"Charmbracelet's glamorous AI coding agent for your terminal with multi-model support.",config:{path:"CRUSH.md",appendMode:!0},logo:nt},{id:"qwen",name:"Qwen Code",subtitle:"Alibaba's coding CLI",description:"Alibaba's command-line interface for Qwen3-Coder, enabling agentic coding with natural language.",config:{path:"AGENTS.md",appendMode:!0},logo:ht},{id:"amazon-q-cli",name:"Amazon Q CLI",subtitle:"AWS's terminal AI",description:"Amazon's AI-powered CLI with command autocompletion, natural language chat, and AWS integration.",config:{path:".amazonq/rules/ultracite.md",appendMode:!0},logo:Z1},{id:"firebender",name:"Firebender",subtitle:"Android Studio AI",description:"The most powerful AI coding assistant for Android Studio with codebase context and up-to-date Android knowledge.",config:{path:"firebender.json"},logo:at},{id:"cursor-cli",name:"Cursor CLI",subtitle:"Cursor's terminal agent",description:"Cursor's CLI, built to help you ship right from your terminal.",config:{path:".cursor/rules/ultracite.mdc",appendMode:!0},logo:c1},{id:"mistral-vibe",name:"Mistral Vibe",subtitle:"Minimal CLI coding agent",description:"Mistral's minimal CLI coding agent for streamlined development tasks.",config:{path:"VIBE.md"},logo:mt},{id:"vercel",name:"Vercel Agent",subtitle:"Vercel's AI Cloud agent",description:"Vercel's agent, powered by their AI Cloud.",config:{path:"AGENTS.md",appendMode:!0},logo:xt}];import N from"deepmerge";var yt="./antigravity-JVONECNW.svg";var kt="./kiro-N2M256R6.svg";var bt="./trae-RXVCFBOF.svg";var zt="./void-NYH3U3BB.svg";var Ct="./vscode-DEOUEB65.svg";var St="./windsurf-5T7JOTST.svg";var jt="./zed-SIARPESF.svg";var l1={"editor.defaultFormatter":"esbenp.prettier-vscode","typescript.tsdk":"node_modules/typescript/lib","editor.formatOnSave":!0,"editor.formatOnPaste":!0,"emmet.showExpandedAbbreviation":"never"},I2={"[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"},"[html]":{"editor.defaultFormatter":"biomejs.biome"},"[vue]":{"editor.defaultFormatter":"biomejs.biome"},"[svelte]":{"editor.defaultFormatter":"biomejs.biome"},"[css]":{"editor.defaultFormatter":"biomejs.biome"},"[yaml]":{"editor.defaultFormatter":"biomejs.biome"},"[graphql]":{"editor.defaultFormatter":"biomejs.biome"},"[markdown]":{"editor.defaultFormatter":"biomejs.biome"},"[mdx]":{"editor.defaultFormatter":"biomejs.biome"},"editor.codeActionsOnSave":{"source.fixAll.biome":"explicit","source.organizeImports.biome":"explicit"}},A2={"[javascript]":{"editor.defaultFormatter":"oxc.oxc-vscode"},"[javascriptreact]":{"editor.defaultFormatter":"oxc.oxc-vscode"},"[typescript]":{"editor.defaultFormatter":"oxc.oxc-vscode"},"[typescriptreact]":{"editor.defaultFormatter":"oxc.oxc-vscode"},"[json]":{"editor.defaultFormatter":"oxc.oxc-vscode"},"[jsonc]":{"editor.defaultFormatter":"oxc.oxc-vscode"},"[yaml]":{"editor.defaultFormatter":"oxc.oxc-vscode"},"[html]":{"editor.defaultFormatter":"oxc.oxc-vscode"},"[vue]":{"editor.defaultFormatter":"oxc.oxc-vscode"},"[vue-html]":{"editor.defaultFormatter":"oxc.oxc-vscode"},"[handlebars]":{"editor.defaultFormatter":"oxc.oxc-vscode"},"[css]":{"editor.defaultFormatter":"oxc.oxc-vscode"},"[scss]":{"editor.defaultFormatter":"oxc.oxc-vscode"},"[less]":{"editor.defaultFormatter":"oxc.oxc-vscode"},"[graphql]":{"editor.defaultFormatter":"oxc.oxc-vscode"},"[markdown]":{"editor.defaultFormatter":"oxc.oxc-vscode"},"editor.codeActionsOnSave":{"source.fixAll.oxc":"explicit"}},F2={"editor.codeActionsOnSave":{"source.fixAll.eslint":"explicit","source.organizeImports":"explicit"}},O=(t="biome")=>{switch(t){case"biome":return N(l1,I2);case"eslint":return N(l1,F2);case"oxlint":return N(l1,A2);default:return l1}},f1={formatter:"language_server",format_on_save:"on",lsp:{"typescript-language-server":{settings:{typescript:{preferences:{includePackageJsonAutoImports:"on"}}}}}},E2={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}}}},B2={languages:{JavaScript:{formatter:{language_server:{name:"eslint"}},code_actions_on_format:{"source.fixAll.eslint":!0,"source.organizeImports.eslint":!0}},TypeScript:{formatter:{language_server:{name:"eslint"}},code_actions_on_format:{"source.fixAll.eslint":!0,"source.organizeImports.eslint":!0}},TSX:{formatter:{language_server:{name:"eslint"}},code_actions_on_format:{"source.fixAll.eslint":!0,"source.organizeImports.eslint":!0}}}},U2={languages:{JavaScript:{formatter:{language_server:{name:"oxfmt"}},code_actions_on_format:{"source.fixAll.oxc":!0,"source.organizeImports.oxc":!0}},TypeScript:{formatter:{language_server:{name:"oxfmt"}},code_actions_on_format:{"source.fixAll.oxc":!0,"source.organizeImports.oxc":!0}},TSX:{formatter:{language_server:{name:"oxfmt"}},code_actions_on_format:{"source.fixAll.oxc":!0,"source.organizeImports.oxc":!0}}},lsp:{oxlint:{initialization_options:{settings:{disableNestedConfig:!1,fixKind:"safe_fix",run:"onType",typeAware:!0,unusedDisableDirectives:"deny"}}},oxfmt:{initialization_options:{settings:{configPath:null,flags:{},"fmt.configPath":null,"fmt.experimental":!0,run:"onSave",typeAware:!1,unusedDisableDirectives:!1}}}}},$2=(t="biome")=>{switch(t){case"biome":return N(f1,E2);case"eslint":return N(f1,B2);case"oxlint":return N(f1,U2);default:return f1}},R=[{id:"vscode",name:"Visual Studio Code",subtitle:"The most popular code editor",description:"Microsoft's popular code editor with extensive extension support and built-in Git integration.",logo:Ct,config:{path:".vscode/settings.json",getContent:O,extensionCommand:"code --install-extension"}},{id:"cursor",name:"Cursor",subtitle:"The AI-first code editor",description:"The AI-first code editor built on VS Code with deep AI integration for coding assistance.",logo:c1,rules:{path:".cursor/rules/ultracite.mdc",header:`---
|
|
103
103
|
description: Ultracite Rules - AI-Ready Formatter and Linter
|
|
104
104
|
globs: "**/*.{ts,tsx,js,jsx,json,jsonc,html,vue,svelte,astro,css,yaml,yml,graphql,gql,md,mdx,grit}"
|
|
105
105
|
alwaysApply: false
|
|
106
|
-
---`},hooks:{path:".cursor/hooks.json",getContent:t=>({version:1,hooks:{afterFileEdit:[{command:t}]}})},config:{path:".vscode/settings.json",getContent:O,extensionCommand:"code --install-extension"}},{id:"windsurf",name:"Windsurf",subtitle:"The agentic IDE by Codeium",description:"Codeium's agentic IDE that combines AI assistance with a powerful VS Code-based development environment.",logo:St,rules:{path:".windsurf/rules/ultracite.md"},hooks:{path:".windsurf/hooks.json",getContent:t=>({hooks:{post_write_code:[{command:t,show_output:!0}]}})},config:{path:".vscode/settings.json",getContent:O,extensionCommand:"code --install-extension"}},{id:"antigravity",name:"Antigravity",subtitle:"Google's next-generation IDE",description:"An AI-powered development platform built on VS Code for building and deploying applications faster.",logo:yt,config:{path:".vscode/settings.json",getContent:O,extensionCommand:"code --install-extension"}},{id:"kiro",name:"Kiro",subtitle:"AWS's spec-driven IDE",description:"AWS's spec-driven AI development environment for building production-ready applications.",logo:kt,rules:{path:".kiro/steering/ultracite.md"},config:{path:".vscode/settings.json",getContent:O,extensionCommand:"code --install-extension"}},{id:"trae",name:"Trae",subtitle:"ByteDance's AI IDE",description:"ByteDance's AI-powered IDE built on VS Code - the real AI engineer.",logo:bt,rules:{path:".trae/rules/project_rules.md"},config:{path:".vscode/settings.json",getContent:O,extensionCommand:"code --install-extension"}},{id:"void",name:"Void",subtitle:"Open-source AI editor",description:"An open-source AI code editor built on VS Code with a focus on privacy and extensibility.",logo:zt,config:{path:".vscode/settings.json",getContent:O,extensionCommand:"code --install-extension"}},{id:"zed",name:"Zed",subtitle:"The high-performance editor",description:"A high-performance, multiplayer code editor built in Rust with built-in AI assistance.",logo:jt,rules:{path:".rules",appendMode:!0},config:{path:".zed/settings.json",getContent:$2}}];var _2=t=>!!t.hooks,L2=t=>!!t.hooks,D2=()=>
|
|
106
|
+
---`},hooks:{path:".cursor/hooks.json",getContent:t=>({version:1,hooks:{afterFileEdit:[{command:t}]}})},config:{path:".vscode/settings.json",getContent:O,extensionCommand:"code --install-extension"}},{id:"windsurf",name:"Windsurf",subtitle:"The agentic IDE by Codeium",description:"Codeium's agentic IDE that combines AI assistance with a powerful VS Code-based development environment.",logo:St,rules:{path:".windsurf/rules/ultracite.md"},hooks:{path:".windsurf/hooks.json",getContent:t=>({hooks:{post_write_code:[{command:t,show_output:!0}]}})},config:{path:".vscode/settings.json",getContent:O,extensionCommand:"code --install-extension"}},{id:"antigravity",name:"Antigravity",subtitle:"Google's next-generation IDE",description:"An AI-powered development platform built on VS Code for building and deploying applications faster.",logo:yt,config:{path:".vscode/settings.json",getContent:O,extensionCommand:"code --install-extension"}},{id:"kiro",name:"Kiro",subtitle:"AWS's spec-driven IDE",description:"AWS's spec-driven AI development environment for building production-ready applications.",logo:kt,rules:{path:".kiro/steering/ultracite.md"},config:{path:".vscode/settings.json",getContent:O,extensionCommand:"code --install-extension"}},{id:"trae",name:"Trae",subtitle:"ByteDance's AI IDE",description:"ByteDance's AI-powered IDE built on VS Code - the real AI engineer.",logo:bt,rules:{path:".trae/rules/project_rules.md"},config:{path:".vscode/settings.json",getContent:O,extensionCommand:"code --install-extension"}},{id:"void",name:"Void",subtitle:"Open-source AI editor",description:"An open-source AI code editor built on VS Code with a focus on privacy and extensibility.",logo:zt,config:{path:".vscode/settings.json",getContent:O,extensionCommand:"code --install-extension"}},{id:"zed",name:"Zed",subtitle:"The high-performance editor",description:"A high-performance, multiplayer code editor built in Rust with built-in AI assistance.",logo:jt,rules:{path:".rules",appendMode:!0},config:{path:".zed/settings.json",getContent:$2}}];var _2=t=>!!t.hooks,L2=t=>!!t.hooks,D2=()=>R.filter(_2).map(t=>({id:t.id,name:t.name,hooks:t.hooks})),N2=()=>D.filter(L2).map(t=>({id:t.id,name:t.name,hooks:t.hooks})),X=[...D2(),...N2()];var Pt="./biome-TVLEY2T4.svg";var Ot="./eslint-7IULJKW7.svg";var It="./oxlint-5IE3ABOZ.svg";var At="./prettier-O4V2FSEA.svg";var Ft="./stylelint-DEBSWZVS.svg";var d1=[{id:"biome",name:"Biome",subtitle:"The modern all-in-one toolchain",description:"The modern, all-in-one toolchain. Biome is a fast formatter and linter written in Rust that handles JavaScript, TypeScript, JSON, CSS, and more with a single tool.",benefits:[{title:"Lightning fast",description:"Written in Rust, Biome can format a large codebase in milliseconds.",icon:"Zap"},{title:"All-in-one toolchain",description:"No more juggling ESLint, Prettier, and other tools. Biome handles formatting and linting in a single pass.",icon:"Layers"},{title:"287 preconfigured rules",description:"Covers accessibility, complexity, correctness, performance, security, style, and suspicious patterns.",icon:"ShieldCheck"},{title:"Multi-language support",description:"Natively supports JavaScript, TypeScript, JSX, TSX, JSON, JSONC, CSS, GraphQL, and HTML.",icon:"Code"},{title:"Smart sorting",description:"Automatically organizes imports and JSX attributes, plus sorts Tailwind CSS classes.",icon:"ArrowUpDown"},{title:"Zero dependencies",description:"Biome has no JavaScript dependencies. One binary does everything with consistent behavior.",icon:"Package"}],logo:Pt,videos:["https://www.youtube.com/watch?v=lEkXbneUnWg","https://www.youtube.com/watch?v=b_F4LaycQcE"],configFiles:[{name:"biome.jsonc",lang:"json",code:t=>`{
|
|
107
107
|
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
|
|
108
108
|
"extends": [
|
|
109
109
|
${t.map(e=>`"ultracite/biome/${e}"`).join(`,
|
|
@@ -260,23 +260,23 @@ ${e}'s linter will catch most issues automatically. Focus your attention on:
|
|
|
260
260
|
---
|
|
261
261
|
|
|
262
262
|
Most formatting and common issues are automatically fixed by ${e}. Run \`${t} ultracite fix\` before committing to ensure compliance.
|
|
263
|
-
`;m();import{dlxCommand as H2}from"nypm";var Bt=(t,e,i)=>{let o=
|
|
263
|
+
`;m();import{dlxCommand as H2}from"nypm";var Bt=(t,e,i)=>{let o=D.find(f=>f.id===t);if(!o)throw new Error(`Agent "${t}" not found`);let n=d1.find(f=>f.id===i);if(!n)throw new Error(`Provider "${i}" not found`);let s=H2(e,""),r=Et(s,n.name),a=o.config.header?`${o.config.header}
|
|
264
264
|
|
|
265
|
-
${r}`:r;return{exists:()=>
|
|
265
|
+
${r}`:r;return{exists:()=>l(o.config.path),create:async()=>{await y(o.config.path),await P1(o.config.path,a)},update:async()=>{await y(o.config.path);let f=await l(o.config.path);if(!(o.config.appendMode&&f)){await P1(o.config.path,a);return}let d=await W2(o.config.path,"utf-8");d.includes(r.trim())||await P1(o.config.path,`${d}
|
|
266
266
|
|
|
267
|
-
${r}`)}}};import{spawnSync as V2}from"child_process";import{readFile as X2,writeFile as O1}from"fs/promises";m();import Q2 from"deepmerge";import{parse as K2}from"jsonc-parser";var Ut=(t,e="biome")=>{let i=
|
|
267
|
+
${r}`)}}};import{spawnSync as V2}from"child_process";import{readFile as X2,writeFile as O1}from"fs/promises";m();import Q2 from"deepmerge";import{parse as K2}from"jsonc-parser";var Ut=(t,e="biome")=>{let i=R.find(n=>n.id===t);if(!i)throw new Error(`Editor "${t}" not found`);let o=i.config.getContent(e);return{exists:()=>l(i.config.path),create:async()=>{await y(i.config.path),await O1(i.config.path,JSON.stringify(o,null,2))},update:async()=>{if(await y(i.config.path),!await l(i.config.path)){await O1(i.config.path,JSON.stringify(o,null,2));return}let s=await X2(i.config.path,"utf-8"),a=K2(s)||{},f=Q2(a,o);await O1(i.config.path,JSON.stringify(f,null,2))},extension:i.config.extensionCommand?n=>V2(`${i.config.extensionCommand} ${n}`,{stdio:"pipe",shell:!0}):void 0}};import{readFile as Z2,writeFile as I1}from"fs/promises";m();import Y2 from"deepmerge";import{parse as q2}from"jsonc-parser";var t3=(t,e,i=[])=>{let o=[t];return t==="npm"&&o.push("run"),o.push(e),i.length>0&&(t==="npm"&&o.push("--"),o.push(...i)),o.join(" ")},$t=(t,e,i="biome")=>{let o=X.find(g=>g.id===t);if(!o)throw new Error(`Hook integration "${t}" not found`);let s=t3(e,"fix",i==="biome"?["--skip=correctness/noUnusedImports"]:[]),r=o.hooks.getContent(s),a=g=>typeof g=="object"&&g!==null&&!Array.isArray(g),f=g=>{let E=JSON.stringify(g);return E.includes("ultracite")||E.includes(s)},d=async()=>{if(!await l(o.hooks.path)){await I1(o.hooks.path,JSON.stringify(r,null,2));return}let E=await Z2(o.hooks.path,"utf-8"),x=q2(E),c=a(x)?x:{};if(!f(c)){let u=Y2(c,r);await I1(o.hooks.path,JSON.stringify(u,null,2))}};return{exists:()=>l(o.hooks.path),create:async()=>{await y(o.hooks.path),await I1(o.hooks.path,JSON.stringify(r,null,2))},update:async()=>{await y(o.hooks.path),await d()}}};F1();E1();_1();U1();m();import{readFile as O3,writeFile as Vt}from"fs/promises";import I3 from"deepmerge";import{parse as A3}from"jsonc-parser";var Xt={$schema:"./node_modules/@biomejs/biome/configuration_schema.json",extends:["ultracite/biome/core"]},N1=async()=>await l("./biome.json")?"./biome.json":"./biome.jsonc",m1={exists:async()=>{let t=await N1();return l(t)},create:async t=>{let e=await N1(),i=["ultracite/biome/core"];if(t?.frameworks&&t.frameworks.length>0)for(let n of t.frameworks)i.push(`ultracite/biome/${n}`);let o={...Xt,extends:i};return Vt(e,JSON.stringify(o,null,2))},update:async t=>{let e=await N1(),i=await O3(e,"utf-8"),n=A3(i)||{},r=[...n.extends&&Array.isArray(n.extends)?n.extends:[]];if(r.includes("ultracite/biome/core")||r.push("ultracite/biome/core"),t?.frameworks&&t.frameworks.length>0)for(let d of t.frameworks){let g=`ultracite/biome/${d}`;r.includes(g)||r.push(g)}n.extends=r;let a={$schema:Xt.$schema},f=I3(n,a);await Vt(e,JSON.stringify(f,null,2))}};m();import{writeFile as Qt}from"fs/promises";var F3=["./eslint.config.mjs","./eslint.config.js","./eslint.config.cjs","./eslint.config.ts","./eslint.config.mts","./eslint.config.cts"],Kt="./eslint.config.mjs",E3=async()=>{for(let t of F3)if(await l(t))return t;return null},Zt=t=>{let e=['import core from "ultracite/eslint/core";'],i=["...core"];if(t?.frameworks&&t.frameworks.length>0)for(let o of t.frameworks)e.push(`import ${o} from "ultracite/eslint/${o}";`),i.push(`...${o}`);return`${e.join(`
|
|
268
268
|
`)}
|
|
269
269
|
|
|
270
270
|
export default [
|
|
271
271
|
${i.join(`,
|
|
272
272
|
`)},
|
|
273
273
|
];
|
|
274
|
-
`},g1={exists:async()=>await E3()!==null,create:async t=>{let e=Zt(t);await Qt(Kt,e)},update:async t=>{let e=Zt(t);await Qt(Kt,e)}};m();import{readFile as B3,writeFile as Yt}from"fs/promises";import U3 from"deepmerge";import{parse as $3}from"jsonc-parser";var u1="./.oxfmtrc.jsonc",qt={$schema:"./node_modules/oxfmt/configuration_schema.json",printWidth:80,tabWidth:2,useTabs:!1,semi:!0,singleQuote:!1,quoteProps:"as-needed",jsxSingleQuote:!1,trailingComma:"es5",bracketSpacing:!0,bracketSameLine:!1,arrowParens:"always",endOfLine:"lf",experimentalSortPackageJson:!0,experimentalSortImports:{ignoreCase:!0,newlinesBetween:!0,order:"asc"}},h1={exists:async()=>await
|
|
274
|
+
`},g1={exists:async()=>await E3()!==null,create:async t=>{let e=Zt(t);await Qt(Kt,e)},update:async t=>{let e=Zt(t);await Qt(Kt,e)}};m();import{readFile as B3,writeFile as Yt}from"fs/promises";import U3 from"deepmerge";import{parse as $3}from"jsonc-parser";var u1="./.oxfmtrc.jsonc",qt={$schema:"./node_modules/oxfmt/configuration_schema.json",printWidth:80,tabWidth:2,useTabs:!1,semi:!0,singleQuote:!1,quoteProps:"as-needed",jsxSingleQuote:!1,trailingComma:"es5",bracketSpacing:!0,bracketSameLine:!1,arrowParens:"always",endOfLine:"lf",experimentalSortPackageJson:!0,experimentalSortImports:{ignoreCase:!0,newlinesBetween:!0,order:"asc"}},h1={exists:async()=>await l(u1),create:async()=>{let t=`// Ultracite oxfmt Configuration
|
|
275
275
|
// https://oxc.rs/docs/guide/usage/formatter/config-file-reference.html
|
|
276
276
|
${JSON.stringify(qt,null,2)}
|
|
277
277
|
`;return await Yt(u1,t)},update:async()=>{let t=await B3(u1,"utf-8"),i=$3(t)||{},o=U3(i,qt),n=`// Ultracite oxfmt Configuration
|
|
278
278
|
// https://oxc.rs/docs/guide/usage/formatter/config-file-reference.html
|
|
279
279
|
${JSON.stringify(o,null,2)}
|
|
280
|
-
`;await Yt(u1,n)}};m();import{readFile as _3,writeFile as te}from"fs/promises";import L3 from"deepmerge";import{parse as D3}from"jsonc-parser";var w1="./.oxlintrc.json",
|
|
281
|
-
`,v1={exists:async()=>await G3()!==null,create:async()=>{let t=ne();await ie(oe,t)},update:async()=>{let t=ne();await ie(oe,t)}};m();import{readFile as M3,writeFile as se}from"fs/promises";var J3=["./.stylelintrc.mjs","./stylelint.config.mjs","./.stylelintrc.cjs","./stylelint.config.cjs","./.stylelintrc.js","./stylelint.config.js","./.stylelintrc","./.stylelintrc.json","./.stylelintrc.yml","./.stylelintrc.yaml"],re="./stylelint.config.mjs",W3=async()=>{try{return"stylelint"in JSON.parse(await M3("./package.json","utf-8"))}catch{return!1}},H3=async()=>{if(await W3())return"./package.json";for(let t of J3)if(await
|
|
282
|
-
`,y1={exists:async()=>await H3()!==null,create:async()=>{let t=ae();await se(re,t)},update:async()=>{let t=ae();await se(re,t)}};import{readFile as V3,writeFile as le}from"fs/promises";import{glob as X3}from"glob";import{applyEdits as Q3,modify as K3,parse as Z3}from"jsonc-parser";var ce=async()=>{try{return await X3("**/tsconfig*.json",{ignore:["**/node_modules/**","**/dist/**","**/build/**","**/.next/**"],absolute:!1})}catch{return[]}},Y3=t=>{if(!t)return!1;let e=t.compilerOptions;return e?e.strict===!0||e.strictNullChecks===!0:!1},q3=async t=>{try{let e=await V3(t,"utf-8"),i=Z3(e);if(Y3(i))return;if(i===void 0){await le(t,JSON.stringify({compilerOptions:{strictNullChecks:!0}},null,2));return}let n=K3(e,["compilerOptions","strictNullChecks"],!0,{formattingOptions:{tabSize:2,insertSpaces:!0}}),s=Q3(e,n);await le(t,s)}catch(e){console.warn(`Failed to update ${t}:`,e)}},R1={exists:async()=>(await ce()).length>0,update:async()=>{let t=await ce();if(t.length===0){console.warn("No tsconfig.json files found in the project");return}await Promise.all(t.map(e=>q3(e)))}};m();var fe=k.devDependencies["@biomejs/biome"],T1=k.version,si={angular:["@angular-eslint/eslint-plugin@latest"],astro:["eslint-plugin-astro@latest"],next:["@next/eslint-plugin-next@latest"],qwik:["eslint-plugin-qwik@latest"],react:["eslint-plugin-react@latest","eslint-plugin-react-hooks@latest","eslint-plugin-jsx-a11y@latest","@tanstack/eslint-plugin-query@latest"],remix:["eslint-plugin-remix@latest"],solid:["eslint-plugin-solid@latest"],svelte:["eslint-plugin-svelte@latest"],vue:["eslint-plugin-vue@latest"]},ri=(t,e)=>{for(let i of e){let o=si[i];o&&t.push(...o)}},ai=async(t,e="biome",i=!0,o=!1,n=!1,s=["react"])=>{let r=g();o||r.start("Installing dependencies...");let l=[`ultracite@${T1}`];if(e==="biome"&&l.push(`@biomejs/biome@${fe}`),e==="eslint"&&(l.push("eslint@latest"),l.push("@typescript-eslint/eslint-plugin@latest","@typescript-eslint/parser@latest","eslint-config-prettier@latest","eslint-import-resolver-typescript@latest","eslint-plugin-compat@latest","eslint-plugin-cypress@latest","eslint-plugin-github@latest","eslint-plugin-html@latest","eslint-plugin-import@latest","eslint-plugin-jest@latest","eslint-plugin-n@latest","eslint-plugin-prettier@latest","eslint-plugin-promise@latest","eslint-plugin-sonarjs@latest","eslint-plugin-storybook@latest","eslint-plugin-unicorn@latest","eslint-plugin-unused-imports@latest","globals@latest"),ri(l,s),l.push("prettier@latest"),l.push("stylelint@latest")),e==="oxlint"&&(l.push("oxlint@latest"),l.push("oxfmt@latest"),n&&l.push("oxlint-tsgolint@latest")),i)for(let a of l)await oi(a,{packageManager:t,workspace:await b(),silent:!0,corepack:!1});else{let a={ultracite:T1};e==="biome"&&(a["@biomejs/biome"]=fe),e==="eslint"&&(a.eslint="latest",a.prettier="latest",a.stylelint="latest"),e==="oxlint"&&(a.oxlint="latest",a.oxfmt="latest",n&&(a["oxlint-tsgolint"]="latest")),await v({devDependencies:a})}await v({scripts:{check:"ultracite check",fix:"ultracite fix"}}),o||r.stop("Dependencies installed.")},li=async(t=!1)=>{let e=g();if(t||e.start("Checking for tsconfig.json files..."),await R1.exists()){t||e.message("Found tsconfig.json files, updating with strictNullChecks..."),await R1.update(),t||e.stop("tsconfig.json files updated.");return}t||e.stop("No tsconfig.json files found, skipping.")},ci=async(t,e="biome",i=!1)=>{let o=N.find(r=>r.id===t);if(!o)throw new Error(`Editor "${t}" not found`);let n=Ut(t,e),s=g();if(i||s.start(`Checking for ${o.config.path}...`),await n.exists()){i||s.message(`${o.config.path} found, updating...`),await n.update(),i||s.stop(`${o.config.path} updated.`);return}if(i||s.message(`${o.config.path} not found, creating...`),await n.create(),n.extension){let r=d1.find(l=>l.id===e)?.vscodeExtensionId;if(!r)throw new Error(`Linter extension not found for ${e}`);i||s.message(`Installing ${r} extension...`);try{if(n.extension(r).status===0){i||s.stop(`${o.config.path} created and ${r} extension installed.`);return}}catch{}i||s.stop(`${o.config.path} created. Install ${r} extension manually.`);return}i||(t==="zed"?s.stop(`${o.config.path} created. Install the Biome extension: https://biomejs.dev/reference/zed/`):s.stop(`${o.config.path} created.`))},fi=async(t,e=!1)=>{let i=g();if(e||i.start("Checking for Biome configuration..."),await m1.exists()){e||i.message("Biome configuration found, updating..."),await m1.update({frameworks:t}),e||i.stop("Biome configuration updated.");return}e||i.message("Biome configuration not found, creating..."),await m1.create({frameworks:t}),e||i.stop("Biome configuration created.")},di=async(t,e=!1)=>{let i=g();if(e||i.start("Checking for ESLint configuration..."),await g1.exists()){e||i.message("ESLint configuration found, updating..."),await g1.update({frameworks:t}),e||i.stop("ESLint configuration updated.");return}e||i.message("ESLint configuration not found, creating..."),await g1.create({frameworks:t}),e||i.stop("ESLint configuration created.")},pi=async(t,e=!1)=>{let i=g();if(e||i.start("Checking for Oxlint configuration..."),await x1.exists()){e||i.message("Oxlint configuration found, updating..."),await x1.update({frameworks:t}),e||i.stop("Oxlint configuration updated.");return}e||i.message("Oxlint configuration not found, creating..."),await x1.create({frameworks:t}),e||i.stop("Oxlint configuration created.")},mi=async(t=!1)=>{let e=g();if(t||e.start("Checking for Prettier configuration..."),await v1.exists()){t||e.message("Prettier configuration found, updating..."),await v1.update(),t||e.stop("Prettier configuration updated.");return}t||e.message("Prettier configuration not found, creating..."),await v1.create(),t||e.stop("Prettier configuration created.")},gi=async(t=!1)=>{let e=g();if(t||e.start("Checking for Stylelint configuration..."),await y1.exists()){t||e.message("Stylelint configuration found, updating..."),await y1.update(),t||e.stop("Stylelint configuration updated.");return}t||e.message("Stylelint configuration not found, creating..."),await y1.create(),t||e.stop("Stylelint configuration created.")},ui=async(t=!1)=>{let e=g();if(t||e.start("Checking for oxfmt configuration..."),await h1.exists()){t||e.message("oxfmt configuration found, updating..."),await h1.update(),t||e.stop("oxfmt configuration updated.");return}t||e.message("oxfmt configuration not found, creating..."),await h1.create(),t||e.stop("oxfmt configuration created.")},hi=async(t,e=!0,i=!1,o=!1)=>{let n=g();if(i||(n.start("Initializing pre-commit hooks..."),n.message("Installing Husky...")),e?await I.install(t):await v({devDependencies:{husky:"latest"},scripts:{prepare:"husky"}}),i||n.message("Initializing Husky..."),I.init(t.name),await I.exists()){i||n.message("Pre-commit hook found, updating..."),await I.update(t.name,o),i||n.stop("Pre-commit hook updated.");return}i||n.message("Pre-commit hook not found, creating..."),await I.create(t.name,o),i||n.stop("Pre-commit hook created.")},wi=async(t,e=!0,i=!1)=>{let o=g();if(i||(o.start("Initializing lefthook..."),o.message("Installing lefthook...")),e?await T.install(t):await v({devDependencies:{lefthook:"latest"}}),await T.exists()){i||o.message("lefthook.yml found, updating..."),await T.update(t.name),i||o.stop("lefthook.yml updated.");return}i||o.message("lefthook.yml not found, creating..."),await T.create(t.name),i||o.stop("lefthook.yml created.")},xi=async(t,e=!0,i=!1)=>{let o=g();if(i||(o.start("Initializing lint-staged..."),o.message("Installing lint-staged...")),e?await G.install(t):await v({devDependencies:{"lint-staged":"latest"}}),await G.exists()){i||o.message("lint-staged found, updating..."),await G.update(t.name),i||o.stop("lint-staged updated.");return}i||o.message("lint-staged not found, creating..."),await G.create(t.name),i||o.stop("lint-staged created.")},vi=async(t,e=!1)=>{let i=g();if(e||i.start("Initializing pre-commit..."),await Y.exists()){e||i.message(".pre-commit-config.yaml found, updating..."),await Y.update(t),e||i.stop(".pre-commit-config.yaml updated.");return}e||i.message(".pre-commit-config.yaml not found, creating..."),await Y.create(t),e||i.stop(".pre-commit-config.yaml created.")},yi=async(t,e,i,o,n=!1)=>{let s=g();n||s.start(`Checking for ${e}...`);let r=Bt(t,i,o);if(await r.exists()){n||s.message(`${e} found, updating...`),await r.update(),n||s.stop(`${e} updated.`);return}n||s.message(`${e} not found, creating...`),await r.create(),n||s.stop(`${e} created.`)},ki=async(t,e,i=!1)=>{let o=g(),n=V.find(r=>r.id===t)?.name??t;i||o.start(`Checking for ${n} hooks...`);let s=$t(t,e);if(await s.exists()){i||o.message(`${n} hooks found, updating...`),await s.update(),i||o.stop(`${n} hooks updated.`);return}i||o.message(`${n} hooks not found, creating...`),await s.create(),i||o.stop(`${n} hooks created.`)},de=async t=>{let e=t??{},i=e.quiet??!1;i||ei(`Ultracite v${T1} Initialization`);try{let{pm:o}=e,n;if(o)n={name:o,command:o};else{let f=await ni(ti.cwd());if(!f)throw new Error("No package manager specified or detected");if(!i&&f.warnings)for(let u of f.warnings)t1.warn(u);i||t1.info(`Detected lockfile, using ${f.name}`),o=f.name,n=f}let s=e.linter;if(s===void 0)if(i||e.pm||e.editors||e.agents||e.hooks||e.integrations!==void 0||e.frameworks!==void 0)s="biome";else{let u=await ii({message:"Which linter do you want to use?",options:[{label:"Biome (Recommended)",value:"biome"},{label:"ESLint + Prettier + Stylelint",value:"eslint"},{label:"Oxlint + Oxfmt",value:"oxlint"}]});if(W(u)){J("Operation cancelled.");return}s=u}let r=e.frameworks;if(r===void 0)if(i||e.pm||e.editors||e.agents||e.hooks||e.integrations!==void 0)r=[];else{let u=await e1({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"},{label:"NestJS",value:"nestjs"}],required:!1});if(W(u)){J("Operation cancelled.");return}r=u}let l=e.editors;if(!l)if(i)l=[];else{let f=await e1({message:"Which editors do you want to configure (recommended)?",options:[{label:"VSCode / Cursor / Windsurf",value:"vscode"},{label:"Zed",value:"zed"}],required:!1});if(W(f)){J("Operation cancelled.");return}l=f}let a=e.agents,d=e.hooks,w=Object.fromEntries(L.map(f=>[f.id,f.name]));if(!a)if(i)a=[];else{let f=await e1({message:"Which agents do you want to enable (optional)?",options:Object.entries(w).map(([u,k1])=>({value:u,label:k1})),required:!1});if(W(f)){J("Operation cancelled.");return}a=f}let i1=Object.fromEntries(V.map(f=>[f.id,f.name]));if(!d)if(i)d=[];else{let f=await e1({message:"Which agent hooks do you want to enable (optional)?",options:Object.entries(i1).map(([u,k1])=>({value:u,label:k1})),required:!1});if(W(f)){J("Operation cancelled.");return}d=f}let x=e.integrations;if(x===void 0)if(i||e.pm||e.editors||e.agents||e.hooks)x=[];else{let u=await e1({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"},{label:"pre-commit (Python framework)",value:"pre-commit"}],required:!1});if(W(u)){J("Operation cancelled.");return}x=u}await ai(n,s,!e.skipInstall,i,s==="oxlint"&&e["type-aware"],r),await li(i),s==="biome"&&await fi(r,i),s==="eslint"&&(await di(r,i),await mi(i),await gi(i)),s==="oxlint"&&(await pi(r,i),await ui(i));for(let f of l??[])await ci(f,s,i);for(let f of a??[])await yi(f,w[f],o,s,i);for(let f of d??[])await ki(f,o,i);if(x?.includes("husky")){let f=x?.includes("lint-staged")??!1;await hi(n,!e.skipInstall,i,f)}x?.includes("lefthook")&&await wi(n,!e.skipInstall,i),x?.includes("lint-staged")&&await xi(n,!e.skipInstall,i),x?.includes("pre-commit")&&await vi(o,i),i||(t1.success("Successfully initialized Ultracite!"),t1.info("You can also run `npx skills add haydenbleasel/ultracite` to install the Ultracite skill."))}catch(o){let n=o instanceof Error?o.message:"Unknown error";throw i||t1.error(`Failed to initialize Ultracite configuration: ${n}`),o}};var H=new bi;H.name("ultracite").version(k.version).description(k.description);H.command("init").description("Initialize Ultracite in the current directory").option("--pm <pm>","Package manager to use").option("--linter <linter>","Linter to use").option("--editors <editors...>","Editors to configure").option("--agents <agents...>","Agents to enable").option("--hooks <hooks...>","Hooks to enable").option("--frameworks <frameworks...>","Frameworks being used").option("--integrations <integrations...>","Integrations to enable").option("--type-aware","Enable type-aware linting (oxlint only)").option("--skip-install","Skip installing dependencies").option("--quiet","Suppress interactive prompts").action(async t=>{await de({pm:t.pm,linter:t.linter,editors:t.editors,agents:t.agents,hooks:t.hooks,frameworks:t.frameworks,integrations:t.integrations,"type-aware":t.typeAware,skipInstall:t.skipInstall,quiet:t.quiet??(process.env.CI==="true"||process.env.CI==="1")})});H.command("check").argument("[files...]","Files to check").description("Run linter without fixing files. Unknown options are passed to the underlying linter.").allowUnknownOption().action(async t=>{let e=process.argv.indexOf("check"),o=process.argv.slice(e+1).filter(s=>s.startsWith("-")),n=t.filter(s=>!s.startsWith("--"));await H1(n,o)});H.command("fix").argument("[files...]","Files to fix").description("Run linter and fix files. Unknown options are passed to the underlying linter.").allowUnknownOption().action(async t=>{let e=process.argv.indexOf("fix"),o=process.argv.slice(e+1).filter(s=>s.startsWith("-")),n=t.filter(s=>!s.startsWith("--"));await Q1(n,o)});H.command("doctor").description("Verify your Ultracite setup").action(async()=>{await X1()});process.env.TEST||H.parse();export{H as program};
|
|
280
|
+
`;await Yt(u1,n)}};m();import{readFile as _3,writeFile as te}from"fs/promises";import L3 from"deepmerge";import{parse as D3}from"jsonc-parser";var w1="./.oxlintrc.json",J=t=>`./node_modules/ultracite/config/oxlint/${t}/.oxlintrc.json`,ee={$schema:"./node_modules/oxlint/configuration_schema.json",extends:[J("core")]},x1={exists:async()=>await l(w1),create:async t=>{let e=[J("core")];if(t?.frameworks&&t.frameworks.length>0)for(let o of t.frameworks)e.push(J(o));let i={...ee,extends:e};return await te(w1,JSON.stringify(i,null,2))},update:async t=>{let e=await _3(w1,"utf-8"),o=D3(e)||{},n=o.extends&&Array.isArray(o.extends)?o.extends:[],s=d=>n.some(g=>g===J(d)),r=[...n];if(s("core")||r.push(J("core")),t?.frameworks&&t.frameworks.length>0)for(let d of t.frameworks)s(d)||r.push(J(d));o.extends=r;let a={$schema:ee.$schema},f=L3(o,a);await te(w1,JSON.stringify(f,null,2))}};m();import{readFile as N3,writeFile as ie}from"fs/promises";var R3=["./.prettierrc.mjs","./prettier.config.mjs","./.prettierrc.mts","./prettier.config.mts","./.prettierrc.cjs","./prettier.config.cjs","./.prettierrc.cts","./prettier.config.cts","./.prettierrc.js","./prettier.config.js","./.prettierrc.ts","./prettier.config.ts","./.prettierrc","./.prettierrc.json","./.prettierrc.json5","./.prettierrc.yml","./.prettierrc.yaml","./.prettierrc.toml"],oe="./prettier.config.mjs",T3=async()=>{try{return"prettier"in JSON.parse(await N3("./package.json","utf-8"))}catch{return!1}},G3=async()=>{if(await T3())return"./package.json";for(let t of R3)if(await l(t))return t;return null},ne=()=>`export { default } from "ultracite/prettier";
|
|
281
|
+
`,v1={exists:async()=>await G3()!==null,create:async()=>{let t=ne();await ie(oe,t)},update:async()=>{let t=ne();await ie(oe,t)}};m();import{readFile as M3,writeFile as se}from"fs/promises";var J3=["./.stylelintrc.mjs","./stylelint.config.mjs","./.stylelintrc.cjs","./stylelint.config.cjs","./.stylelintrc.js","./stylelint.config.js","./.stylelintrc","./.stylelintrc.json","./.stylelintrc.yml","./.stylelintrc.yaml"],re="./stylelint.config.mjs",W3=async()=>{try{return"stylelint"in JSON.parse(await M3("./package.json","utf-8"))}catch{return!1}},H3=async()=>{if(await W3())return"./package.json";for(let t of J3)if(await l(t))return t;return null},ae=()=>`export { default } from "ultracite/stylelint";
|
|
282
|
+
`,y1={exists:async()=>await H3()!==null,create:async()=>{let t=ae();await se(re,t)},update:async()=>{let t=ae();await se(re,t)}};import{readFile as V3,writeFile as ce}from"fs/promises";import{glob as X3}from"glob";import{applyEdits as Q3,modify as K3,parse as Z3}from"jsonc-parser";var le=async()=>{try{return await X3("**/tsconfig*.json",{ignore:["**/node_modules/**","**/dist/**","**/build/**","**/.next/**"],absolute:!1})}catch{return[]}},Y3=t=>{if(!t)return!1;let e=t.compilerOptions;return e?e.strict===!0||e.strictNullChecks===!0:!1},q3=async t=>{try{let e=await V3(t,"utf-8"),i=Z3(e);if(Y3(i))return;if(i===void 0){await ce(t,JSON.stringify({compilerOptions:{strictNullChecks:!0}},null,2));return}let n=K3(e,["compilerOptions","strictNullChecks"],!0,{formattingOptions:{tabSize:2,insertSpaces:!0}}),s=Q3(e,n);await ce(t,s)}catch(e){console.warn(`Failed to update ${t}:`,e)}},R1={exists:async()=>(await le()).length>0,update:async()=>{let t=await le();if(t.length===0){console.warn("No tsconfig.json files found in the project");return}await Promise.all(t.map(e=>q3(e)))}};m();var fe=k.devDependencies["@biomejs/biome"],T1=k.version,si={angular:["@angular-eslint/eslint-plugin@latest"],astro:["eslint-plugin-astro@latest"],next:["@next/eslint-plugin-next@latest"],qwik:["eslint-plugin-qwik@latest"],react:["eslint-plugin-react@latest","eslint-plugin-react-hooks@latest","eslint-plugin-jsx-a11y@latest","@tanstack/eslint-plugin-query@latest"],remix:["eslint-plugin-remix@latest"],solid:["eslint-plugin-solid@latest"],svelte:["eslint-plugin-svelte@latest"],vue:["eslint-plugin-vue@latest"]},ri=(t,e)=>{for(let i of e){let o=si[i];o&&t.push(...o)}},ai=(t,e)=>{let i={ultracite:T1};return t==="biome"&&(i["@biomejs/biome"]=fe),t==="eslint"&&(i.eslint="latest",i.prettier="latest",i.stylelint="latest"),t==="oxlint"&&(i.oxlint="latest",i.oxfmt="latest",e&&(i["oxlint-tsgolint"]="latest")),i},ci=async(t,e="biome",i=!0,o=!1,n=!1,s=["react"])=>{let r=h();o||r.start("Installing dependencies...");let a=[`ultracite@${T1}`];if(e==="biome"&&a.push(`@biomejs/biome@${fe}`),e==="eslint"&&(a.push("eslint@latest"),a.push("@typescript-eslint/eslint-plugin@latest","@typescript-eslint/parser@latest","eslint-config-prettier@latest","eslint-import-resolver-typescript@latest","eslint-plugin-compat@latest","eslint-plugin-cypress@latest","eslint-plugin-github@latest","eslint-plugin-html@latest","eslint-plugin-import@latest","eslint-plugin-jest@latest","eslint-plugin-n@latest","eslint-plugin-prettier@latest","eslint-plugin-promise@latest","eslint-plugin-sonarjs@latest","eslint-plugin-storybook@latest","eslint-plugin-unicorn@latest","eslint-plugin-unused-imports@latest","globals@latest"),ri(a,s),a.push("prettier@latest"),a.push("stylelint@latest")),e==="oxlint"&&(a.push("oxlint@latest"),a.push("oxfmt@latest"),n&&a.push("oxlint-tsgolint@latest")),i)for(let d of a)await oi(d,{packageManager:t,workspace:await b(),silent:!0,corepack:!1});else{let d=ai(e,n);await v({devDependencies:d})}let f=n?" --type-aware":"";await v({scripts:{check:`ultracite check${f}`,fix:`ultracite fix${f}`}}),o||r.stop("Dependencies installed.")},li=async(t=!1)=>{let e=h();if(t||e.start("Checking for tsconfig.json files..."),await R1.exists()){t||e.message("Found tsconfig.json files, updating with strictNullChecks..."),await R1.update(),t||e.stop("tsconfig.json files updated.");return}t||e.stop("No tsconfig.json files found, skipping.")},fi=async(t,e="biome",i=!1)=>{let o=R.find(r=>r.id===t);if(!o)throw new Error(`Editor "${t}" not found`);let n=Ut(t,e),s=h();if(i||s.start(`Checking for ${o.config.path}...`),await n.exists()){i||s.message(`${o.config.path} found, updating...`),await n.update(),i||s.stop(`${o.config.path} updated.`);return}if(i||s.message(`${o.config.path} not found, creating...`),await n.create(),n.extension){let r=d1.find(a=>a.id===e)?.vscodeExtensionId;if(!r)throw new Error(`Linter extension not found for ${e}`);i||s.message(`Installing ${r} extension...`);try{if(n.extension(r).status===0){i||s.stop(`${o.config.path} created and ${r} extension installed.`);return}}catch{}i||s.stop(`${o.config.path} created. Install ${r} extension manually.`);return}i||(t==="zed"?s.stop(`${o.config.path} created. Install the Biome extension: https://biomejs.dev/reference/zed/`):s.stop(`${o.config.path} created.`))},di=async(t,e=!1)=>{let i=h();if(e||i.start("Checking for Biome configuration..."),await m1.exists()){e||i.message("Biome configuration found, updating..."),await m1.update({frameworks:t}),e||i.stop("Biome configuration updated.");return}e||i.message("Biome configuration not found, creating..."),await m1.create({frameworks:t}),e||i.stop("Biome configuration created.")},pi=async(t,e=!1)=>{let i=h();if(e||i.start("Checking for ESLint configuration..."),await g1.exists()){e||i.message("ESLint configuration found, updating..."),await g1.update({frameworks:t}),e||i.stop("ESLint configuration updated.");return}e||i.message("ESLint configuration not found, creating..."),await g1.create({frameworks:t}),e||i.stop("ESLint configuration created.")},mi=async(t,e=!1)=>{let i=h();if(e||i.start("Checking for Oxlint configuration..."),await x1.exists()){e||i.message("Oxlint configuration found, updating..."),await x1.update({frameworks:t}),e||i.stop("Oxlint configuration updated.");return}e||i.message("Oxlint configuration not found, creating..."),await x1.create({frameworks:t}),e||i.stop("Oxlint configuration created.")},gi=async(t=!1)=>{let e=h();if(t||e.start("Checking for Prettier configuration..."),await v1.exists()){t||e.message("Prettier configuration found, updating..."),await v1.update(),t||e.stop("Prettier configuration updated.");return}t||e.message("Prettier configuration not found, creating..."),await v1.create(),t||e.stop("Prettier configuration created.")},ui=async(t=!1)=>{let e=h();if(t||e.start("Checking for Stylelint configuration..."),await y1.exists()){t||e.message("Stylelint configuration found, updating..."),await y1.update(),t||e.stop("Stylelint configuration updated.");return}t||e.message("Stylelint configuration not found, creating..."),await y1.create(),t||e.stop("Stylelint configuration created.")},hi=async(t=!1)=>{let e=h();if(t||e.start("Checking for oxfmt configuration..."),await h1.exists()){t||e.message("oxfmt configuration found, updating..."),await h1.update(),t||e.stop("oxfmt configuration updated.");return}t||e.message("oxfmt configuration not found, creating..."),await h1.create(),t||e.stop("oxfmt configuration created.")},wi=async(t,e=!0,i=!1,o=!1)=>{let n=h();if(i||(n.start("Initializing pre-commit hooks..."),n.message("Installing Husky...")),e?await I.install(t):await v({devDependencies:{husky:"latest"},scripts:{prepare:"husky"}}),i||n.message("Initializing Husky..."),I.init(t.name),await I.exists()){i||n.message("Pre-commit hook found, updating..."),await I.update(t.name,o),i||n.stop("Pre-commit hook updated.");return}i||n.message("Pre-commit hook not found, creating..."),await I.create(t.name,o),i||n.stop("Pre-commit hook created.")},xi=async(t,e=!0,i=!1)=>{let o=h();if(i||(o.start("Initializing lefthook..."),o.message("Installing lefthook...")),e?await G.install(t):await v({devDependencies:{lefthook:"latest"}}),await G.exists()){i||o.message("lefthook.yml found, updating..."),await G.update(t.name),i||o.stop("lefthook.yml updated.");return}i||o.message("lefthook.yml not found, creating..."),await G.create(t.name),i||o.stop("lefthook.yml created.")},vi=async(t,e=!0,i=!1)=>{let o=h();if(i||(o.start("Initializing lint-staged..."),o.message("Installing lint-staged...")),e?await M.install(t):await v({devDependencies:{"lint-staged":"latest"}}),await M.exists()){i||o.message("lint-staged found, updating..."),await M.update(t.name),i||o.stop("lint-staged updated.");return}i||o.message("lint-staged not found, creating..."),await M.create(t.name),i||o.stop("lint-staged created.")},yi=async(t,e=!1)=>{let i=h();if(e||i.start("Initializing pre-commit..."),await q.exists()){e||i.message(".pre-commit-config.yaml found, updating..."),await q.update(t),e||i.stop(".pre-commit-config.yaml updated.");return}e||i.message(".pre-commit-config.yaml not found, creating..."),await q.create(t),e||i.stop(".pre-commit-config.yaml created.")},ki=async(t,e,i,o,n=!1)=>{let s=h();n||s.start(`Checking for ${e}...`);let r=Bt(t,i,o);if(await r.exists()){n||s.message(`${e} found, updating...`),await r.update(),n||s.stop(`${e} updated.`);return}n||s.message(`${e} not found, creating...`),await r.create(),n||s.stop(`${e} created.`)},bi=async(t,e,i="biome",o=!1)=>{let n=h(),s=X.find(a=>a.id===t)?.name??t;o||n.start(`Checking for ${s} hooks...`);let r=$t(t,e,i);if(await r.exists()){o||n.message(`${s} hooks found, updating...`),await r.update(),o||n.stop(`${s} hooks updated.`);return}o||n.message(`${s} hooks not found, creating...`),await r.create(),o||n.stop(`${s} hooks created.`)},de=async t=>{let e=t??{},i=e.quiet??!1;i||ei(`Ultracite v${T1} Initialization`);try{let{pm:o}=e,n;if(o)n={name:o,command:o};else{let c=await ni(ti.cwd());if(!c)throw new Error("No package manager specified or detected");if(!i&&c.warnings)for(let u of c.warnings)e1.warn(u);i||e1.info(`Detected lockfile, using ${c.name}`),o=c.name,n=c}let s=e.linter;if(s===void 0)if(i||e.pm||e.editors||e.agents||e.hooks||e.integrations!==void 0||e.frameworks!==void 0)s="biome";else{let u=await ii({message:"Which linter do you want to use?",options:[{label:"Biome (Recommended)",value:"biome"},{label:"ESLint + Prettier + Stylelint",value:"eslint"},{label:"Oxlint + Oxfmt",value:"oxlint"}]});if(H(u)){W("Operation cancelled.");return}s=u}let r=e.frameworks;if(r===void 0)if(i||e.pm||e.editors||e.agents||e.hooks||e.integrations!==void 0)r=[];else{let u=await i1({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"},{label:"NestJS",value:"nestjs"}],required:!1});if(H(u)){W("Operation cancelled.");return}r=u}let a=e.editors;if(!a)if(i)a=[];else{let c=await i1({message:"Which editors do you want to configure (recommended)?",options:[{label:"VSCode / Cursor / Windsurf",value:"vscode"},{label:"Zed",value:"zed"}],required:!1});if(H(c)){W("Operation cancelled.");return}a=c}let f=e.agents,d=e.hooks,g=Object.fromEntries(D.map(c=>[c.id,c.name]));if(!f)if(i)f=[];else{let c=await i1({message:"Which agents do you want to enable (optional)?",options:Object.entries(g).map(([u,k1])=>({value:u,label:k1})),required:!1});if(H(c)){W("Operation cancelled.");return}f=c}let E=Object.fromEntries(X.map(c=>[c.id,c.name]));if(!d)if(i)d=[];else{let c=await i1({message:"Which agent hooks do you want to enable (optional)?",options:Object.entries(E).map(([u,k1])=>({value:u,label:k1})),required:!1});if(H(c)){W("Operation cancelled.");return}d=c}let x=e.integrations;if(x===void 0)if(i||e.pm||e.editors||e.agents||e.hooks)x=[];else{let u=await i1({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"},{label:"pre-commit (Python framework)",value:"pre-commit"}],required:!1});if(H(u)){W("Operation cancelled.");return}x=u}await ci(n,s,!e.skipInstall,i,e["type-aware"],r),await li(i),s==="biome"&&await di(r,i),s==="eslint"&&(await pi(r,i),await gi(i),await ui(i)),s==="oxlint"&&(await mi(r,i),await hi(i));for(let c of a??[])await fi(c,s,i);for(let c of f??[])await ki(c,g[c],o,s,i);for(let c of d??[])await bi(c,o,s,i);if(x?.includes("husky")){let c=x?.includes("lint-staged")??!1;await wi(n,!e.skipInstall,i,c)}x?.includes("lefthook")&&await xi(n,!e.skipInstall,i),x?.includes("lint-staged")&&await vi(n,!e.skipInstall,i),x?.includes("pre-commit")&&await yi(o,i),i||(e1.success("Successfully initialized Ultracite!"),e1.info("You can also run `npx skills add haydenbleasel/ultracite` to install the Ultracite skill."))}catch(o){let n=o instanceof Error?o.message:"Unknown error";throw i||e1.error(`Failed to initialize Ultracite configuration: ${n}`),o}};var V=new zi;V.name("ultracite").version(k.version).description(k.description);V.command("init").description("Initialize Ultracite in the current directory").option("--pm <pm>","Package manager to use").option("--linter <linter>","Linter to use").option("--editors <editors...>","Editors to configure").option("--agents <agents...>","Agents to enable").option("--hooks <hooks...>","Hooks to enable").option("--frameworks <frameworks...>","Frameworks being used").option("--integrations <integrations...>","Integrations to enable").option("--type-aware","Enable type-aware linting (enables project/scanner rules)").option("--skip-install","Skip installing dependencies").option("--quiet","Suppress interactive prompts").action(async t=>{await de({pm:t.pm,linter:t.linter,editors:t.editors,agents:t.agents,hooks:t.hooks,frameworks:t.frameworks,integrations:t.integrations,"type-aware":t.typeAware,skipInstall:t.skipInstall,quiet:t.quiet??(process.env.CI==="true"||process.env.CI==="1")})});V.command("check").argument("[files...]","Files to check").description("Run linter without fixing files. Unknown options are passed to the underlying linter.").allowUnknownOption().action(async t=>{let e=process.argv.indexOf("check"),o=process.argv.slice(e+1).filter(s=>s.startsWith("-")),n=t.filter(s=>!s.startsWith("--"));await H1(n,o)});V.command("fix").argument("[files...]","Files to fix").description("Run linter and fix files. Unknown options are passed to the underlying linter.").allowUnknownOption().action(async t=>{let e=process.argv.indexOf("fix"),o=process.argv.slice(e+1).filter(s=>s.startsWith("-")),n=t.filter(s=>!s.startsWith("--"));await Q1(n,o)});V.command("doctor").description("Verify your Ultracite setup").action(async()=>{await X1()});process.env.TEST||V.parse();export{V as program};
|