ultracite 7.2.0 → 7.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +41 -41
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
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 E=(t,e)=>()=>(t&&(e=t(t=0)),e);var i1=(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 o1=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,h,y,ze,Ce,Se,n1,m=E(()=>{"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,h=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",n1=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={};i1(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 X}from"nypm";var _t,Lt,Q,R,I,F1=E(()=>{"use strict";m();_t=t=>`#!/bin/sh
|
|
3
3
|
${t}
|
|
4
|
-
`,
|
|
4
|
+
`,Lt=t=>`#!/bin/sh
|
|
5
5
|
# Exit on any error
|
|
6
6
|
set -e
|
|
7
7
|
|
|
@@ -29,17 +29,17 @@ 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
|
|
34
|
-
`),s=n.indexOf(
|
|
35
|
-
`);await
|
|
36
|
-
${
|
|
37
|
-
${o}`:`${
|
|
38
|
-
${o}`)}else await
|
|
39
|
-
${
|
|
40
|
-
${o}`)}}});var
|
|
32
|
+
`,Q="./.husky/pre-commit",R="# ultracite",I={exists:()=>l(Q),install:async t=>{await n3("husky",{packageManager:t,workspace:await b(),silent:!0,corepack:!1}),await v({scripts:{prepare:"husky"}})},init:t=>{let e=X(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=X(t,"lint-staged",{short:t==="npm"});i=_t(o)}else{let o=X(t,"ultracite",{args:["fix"],short:t==="npm"});i=Lt(o)}await A1(Q,`${R}
|
|
33
|
+
${i}`)},update:async(t,e=!1)=>{let i=await o3(Q,"utf-8"),o;if(e){let n=X(t,"lint-staged",{short:t==="npm"});o=_t(n)}else{let n=X(t,"ultracite",{args:["fix"],short:t==="npm"});o=Lt(n)}if(i.includes(R)){let n=i.split(`
|
|
34
|
+
`),s=n.indexOf(R),r=n.slice(0,s).join(`
|
|
35
|
+
`);await A1(Q,r?`${r}
|
|
36
|
+
${R}
|
|
37
|
+
${o}`:`${R}
|
|
38
|
+
${o}`)}else await A1(Q,`${i}
|
|
39
|
+
${R}
|
|
40
|
+
${o}`)}}});var Gt={};i1(Gt,{lefthook:()=>T});import{execSync as s3}from"child_process";import{readFile as r3,writeFile as K}from"fs/promises";import{addDevDependency as a3,dlxCommand as Rt}from"nypm";var c3,l3,Tt,A,Nt,T,E1=E(()=>{"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
|
-
- run: ${
|
|
42
|
+
- run: ${Tt(t)}
|
|
43
43
|
glob:
|
|
44
44
|
- "**/*.js"
|
|
45
45
|
- "**/*.jsx"
|
|
@@ -49,7 +49,7 @@ ${o}`)}}});var Rt={};e1(Rt,{lefthook:()=>R});import{execSync as o3}from"child_pr
|
|
|
49
49
|
- "**/*.jsonc"
|
|
50
50
|
- "**/*.css"
|
|
51
51
|
stage_fixed: true
|
|
52
|
-
`,
|
|
52
|
+
`,T={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 K(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 K(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 Rt={};e1(Rt,{lefthook:()=>R});import{execSync as o3}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 K(A,r)}else{let s=` jobs:
|
|
63
63
|
- run: ${i}
|
|
64
64
|
glob:
|
|
65
65
|
- "**/*.js"
|
|
@@ -69,18 +69,18 @@ ${o}`)}}});var Rt={};e1(Rt,{lefthook:()=>R});import{execSync as o3}from"child_pr
|
|
|
69
69
|
- "**/*.json"
|
|
70
70
|
- "**/*.jsonc"
|
|
71
71
|
- "**/*.css"
|
|
72
|
-
stage_fixed: true`,r=e.replace(
|
|
73
|
-
`);await
|
|
74
|
-
${o}`)}}});var
|
|
72
|
+
stage_fixed: true`,r=e.replace(l3,`$1${s}
|
|
73
|
+
`);await K(A,r)}else await K(A,`${e}
|
|
74
|
+
${o}`)}}});var Jt={};i1(Jt,{preCommit:()=>Y});import{readFile as f3,writeFile as B1}from"fs/promises";import{dlxCommand as d3}from"nypm";var Z,p3,Mt,m3,Y,$1=E(()=>{"use strict";m();Z="./.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
|
|
78
78
|
name: ultracite
|
|
79
|
-
entry: ${
|
|
79
|
+
entry: ${Mt(t)}
|
|
80
80
|
language: system
|
|
81
81
|
types_or: [javascript, jsx, ts, tsx, json, css]
|
|
82
82
|
pass_filenames: false
|
|
83
|
-
`,
|
|
83
|
+
`,Y={exists:()=>l(Z),create:async t=>{let e=m3(t);await B1(Z,e)},update:async t=>{let e=await f3(Z,"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
|
|
@@ -88,28 +88,28 @@ ${o}`)}}});var Gt={};e1(Gt,{preCommit:()=>Z});import{readFile as c3,writeFile as
|
|
|
88
88
|
language: system
|
|
89
89
|
types_or: [javascript, jsx, ts, tsx, json, css]
|
|
90
90
|
pass_filenames: false
|
|
91
|
-
`;if(e.includes("repos:")){let n=e.replace(
|
|
92
|
-
${o}`);await
|
|
91
|
+
`;if(e.includes("repos:")){let n=e.replace(p3,`repos:
|
|
92
|
+
${o}`);await B1(Z,n)}else await B1(Z,`${e}
|
|
93
93
|
repos:
|
|
94
|
-
${o}`)}}});var
|
|
95
|
-
`).filter(s=>s.trim()&&!s.trim().startsWith("#")),i={},o=null,n=[];for(let s of e){let r=
|
|
94
|
+
${o}`)}}});var g3,U1=E(()=>{g3=G1({"./husky.ts":()=>(F1(),o1(Dt)),"./lefthook.ts":()=>(E1(),o1(Gt)),"./lint-staged.ts":()=>(_1(),o1(Wt)),"./pre-commit.ts":()=>($1(),o1(Jt))})});var Wt={};i1(Wt,{lintStaged:()=>G});import{readFile as d1,writeFile as F}from"fs/promises";import{pathToFileURL as u3}from"url";import q 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,G,_1=E(()=>{"use strict";m();U1();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(":"),c=r.join(":").trim(),a=s.trim().replace(/['"]/g,"");return c&&c!==""?(c.startsWith("[")&&c.endsWith("]")?e[a]=c.slice(1,-1).split(",").map(d=>d.trim().replace(/['"]/g,"")):e[a]=c.replace(/['"]/g,""),{newCurrentKey:null,newCurrentArray:[]}):{newCurrentKey:a,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
|
+
`).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},
|
|
99
|
-
`;await
|
|
100
|
-
`;await A(t,n)},_1=async t=>{await A(".lintstagedrc.json",JSON.stringify(z(t),null,2))},S3=async(t,e)=>{if(t==="./package.json"){await y3(e);return}if(t.endsWith(".json")||t==="./.lintstagedrc"){await k3(t,e);return}if(t.endsWith(".yaml")||t.endsWith(".yml")){await b3(t,e);return}let i=await v3();if(t.endsWith(".mjs")||t.endsWith(".js")&&i){try{await z3(t,e)}catch{await _1(e)}return}if(t.endsWith(".cjs")||t.endsWith(".js")&&!i)try{await C3(t,e)}catch{await _1(e)}},T={exists:async()=>{for(let t of Jt)if(await l(t))return!0;return!1},install:async t=>{await g3("lint-staged",{packageManager:t,workspace:await k(),silent:!0,corepack:!1})},create:async t=>{await A(".lintstagedrc.json",JSON.stringify(z(t),null,2))},update:async t=>{let e=null;for(let i of Jt)if(await l(i)){e=i;break}if(!e){await _1(t);return}await S3(e,t)}}});import{Command as yi}from"commander";var y={name:"ultracite",description:"The AI-ready formatter that helps you write and generate code faster.",version:"7.2.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.3.15","@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.2.3","@typescript-eslint/eslint-plugin":"^8.55.0","@typescript-eslint/parser":"^8.55.0","eslint-config-prettier":"^10.1.8","eslint-import-resolver-typescript":"^4.4.4","eslint-plugin-angular":"^5.0.0","eslint-plugin-astro":"^1.5.0","eslint-plugin-compat":"^6.1.0","eslint-plugin-cypress":"^5.3.0","eslint-plugin-github":"6.0.0","eslint-plugin-html":"^8.1.4","eslint-plugin-import":"^2.32.0","eslint-plugin-jest":"^29.14.0","eslint-plugin-jsx-a11y":"^6.10.2","eslint-plugin-n":"^17.23.2","eslint-plugin-prettier":"^5.5.5","eslint-plugin-promise":"^7.2.1","eslint-plugin-qwik":"^1.19.0","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":"^3.0.7","eslint-plugin-storybook":"^10.2.8","eslint-plugin-svelte":"^3.15.0","eslint-plugin-unicorn":"^63.0.0","eslint-plugin-unused-imports":"^4.4.1","eslint-plugin-vue":"^10.7.0",globals:"^17.3.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.47.0"},dependencies:{"@clack/prompts":"^1.0.1",commander:"^14.0.3",deepmerge:"^4.3.1",glob:"^13.0.3","jsonc-parser":"^3.3.1",nypm:"^0.6.5"},peerDependencies:{oxlint:"^1.0.0"},peerDependenciesMeta:{oxlint:{optional:!0}},packageManager:"bun@1.3.9"};p();import{spawnSync as E}from"child_process";import B from"process";var Ce=(t,e)=>{let i=["check","--no-errors-on-unmatched",...e];t.length>0?i.push(...u(t)):i.push("./");let o=E("biome",i,{stdio:"inherit"});if(o.error)throw new Error(`Failed to run Biome: ${o.error.message}`);o.status!==0&&B.exit(o.status??1)},Se=(t,e)=>{let i=[...e,...t.length>0?u(t):["."]],o=E("eslint",i,{stdio:"inherit"});if(o.error)throw new Error(`Failed to run ESLint: ${o.error.message}`);o.status!==0&&B.exit(o.status??1)},je=(t,e)=>{let i=["--check",...e,...t.length>0?u(t):["."]],o=E("prettier",i,{stdio:"inherit"});if(o.error)throw new Error(`Failed to run Prettier: ${o.error.message}`);o.status!==0&&B.exit(o.status??1)},Pe=(t,e)=>{let i=[...e,...t.length>0?u(t):["."]],o=E("stylelint",i,{stdio:"inherit"});if(o.error)throw new Error(`Failed to run Stylelint: ${o.error.message}`);o.status!==0&&B.exit(o.status??1)},Oe=(t,e)=>{let i=[...e,...t.length>0?u(t):["."]],o=E("oxlint",i,{stdio:"inherit"});if(o.error)throw new Error(`Failed to run Oxlint: ${o.error.message}`);o.status!==0&&B.exit(o.status??1)},Ie=(t,e)=>{let i=["--check",...e,...t.length>0?u(t):["."]],o=E("oxfmt",i,{stdio:"inherit"});if(o.error)throw new Error(`Failed to run oxfmt: ${o.error.message}`);o.status!==0&&B.exit(o.status??1)},J1=async(t=[],e=[])=>{let i=await o1();if(!i)throw new Error("No linter configuration found. Run `ultracite init` to set up a linter.");switch(i){case"eslint":{await je(t,[]),await Se(t,e),await Pe(t,[]);break}case"oxlint":{await Ie(t,[]),await Oe(t,e);break}default:await Ce(t,e)}};import{spawnSync as S1}from"child_process";import{existsSync as C}from"fs";import{readFile as s1}from"fs/promises";import{join as S}from"path";import j from"process";import{intro as Ae,log as n1,outro as C1,spinner as Fe}from"@clack/prompts";import{parse as W1}from"jsonc-parser";var Ee=[".prettierrc",".prettierrc.js",".prettierrc.cjs",".prettierrc.mjs",".prettierrc.json",".prettierrc.yaml",".prettierrc.yml","prettier.config.js","prettier.config.mjs","prettier.config.cjs"],Be=[".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=S1("biome",["--version"],{encoding:"utf-8"});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"}},Ue=()=>{let t=S1("eslint",["--version"],{encoding:"utf-8"});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)"}},_e=()=>{let t=S1("oxlint",["--version"],{encoding:"utf-8"});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)"}},Le=async()=>{let t=S(j.cwd(),"biome.json"),e=S(j.cwd(),"biome.jsonc"),i=null;if(C(t)?i=t:C(e)&&(i=e),!i)return{name:"Biome configuration",status:"warn",message:"No biome.json or biome.jsonc file found"};try{let o=await s1(i,"utf-8"),n=W1(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"}}},De=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=S(j.cwd(),i);if(C(o)){e=o;break}}if(!e)return{name:"ESLint configuration",status:"warn",message:"No eslint.config.* file found (optional)"};try{return(await s1(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"}}},Ne=t=>`./node_modules/ultracite/config/oxlint/${t}/.oxlintrc.json`,Re=async()=>{let t=S(j.cwd(),".oxlintrc.json");if(!C(t))return{name:"Oxlint configuration",status:"warn",message:"No .oxlintrc.json file found (optional)"};try{let e=await s1(t,"utf-8"),i=W1(e);return Array.isArray(i?.extends)&&i.extends.includes(Ne("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"}}},Te=async()=>{let t=S(j.cwd(),"package.json");if(!C(t))return{name:"Ultracite dependency",status:"warn",message:"No package.json found"};try{let e=JSON.parse(await s1(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"}}},Ge=()=>{let t=Ee.some(o=>C(S(j.cwd(),o))),i=Be.filter(o=>!o.startsWith("eslint.config")).some(o=>C(S(j.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"}},b=async(t,e)=>{let i=Fe();i.start(`Checking ${e}...`);let o=await t();return o.status==="pass"||o.status,i.stop(o.message),o},H1=async()=>{Ae(`Ultracite v${y.version} Doctor`);let t=[];t.push(await b($e,"Biome installation")),t.push(await b(Ue,"ESLint installation")),t.push(await b(_e,"Oxlint installation")),t.push(await b(Le,"Biome configuration")),t.push(await b(De,"ESLint configuration")),t.push(await b(Re,"Oxlint configuration")),t.push(await b(Te,"Ultracite dependency")),t.push(await b(Ge,"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(n1.info(`Summary: ${e} passed, ${o} warnings, ${i} failed`),i>0)throw n1.error("Some checks failed. Run 'ultracite init' to fix issues."),C1("Doctor complete"),new Error("Doctor checks failed");if(o>0){n1.warn("Some optional improvements available. Run 'ultracite init' to configure."),C1("Doctor complete");return}n1.success("Everything looks good!"),C1("Doctor complete")};p();import{spawnSync as $}from"child_process";import U from"process";var Me=(t,e)=>{let i=["check","--write","--no-errors-on-unmatched",...e];t.length>0?i.push(...u(t)):i.push("./");let o=$("biome",i,{stdio:"inherit"});if(o.error)throw new Error(`Failed to run Biome: ${o.error.message}`);o.status!==0&&U.exit(o.status??1)},Je=(t,e)=>{let i=["--fix",...e,...t.length>0?u(t):["."]],o=$("eslint",i,{stdio:"inherit"});if(o.error)throw new Error(`Failed to run ESLint: ${o.error.message}`);o.status!==0&&U.exit(o.status??1)},We=(t,e)=>{let i=["--write",...e,...t.length>0?u(t):["."]],o=$("prettier",i,{stdio:"inherit"});if(o.error)throw new Error(`Failed to run Prettier: ${o.error.message}`);o.status!==0&&U.exit(o.status??1)},He=(t,e)=>{let i=["--fix",...e,...t.length>0?u(t):["."]],o=$("stylelint",i,{stdio:"inherit"});if(o.error)throw new Error(`Failed to run Stylelint: ${o.error.message}`);o.status!==0&&U.exit(o.status??1)},Ve=(t,e)=>{let i=e.includes("--unsafe"),o=e.filter(r=>r!=="--unsafe"),n=[i?"--fix-dangerously":"--fix",...o,...t.length>0?u(t):["."]],s=$("oxlint",n,{stdio:"inherit"});if(s.error)throw new Error(`Failed to run Oxlint: ${s.error.message}`);s.status!==0&&U.exit(s.status??1)},Xe=(t,e)=>{let i=["--write",...e,...t.length>0?u(t):["."]],o=$("oxfmt",i,{stdio:"inherit"});if(o.error)throw new Error(`Failed to run oxfmt: ${o.error.message}`);o.status!==0&&U.exit(o.status??1)},V1=async(t,e=[])=>{let i=await o1();if(!i)throw new Error("No linter configuration found. Run `ultracite init` to set up a linter.");switch(i){case"eslint":{await We(t,[]),await Je(t,e),await He(t,[]);break}case"oxlint":{await Xe(t,[]),await Ve(t,e);break}default:await Me(t,e)}};import Y3 from"process";import{cancel as M,intro as q3,isCancel as J,log as v1,multiselect as q,select as ti,spinner as m}from"@clack/prompts";var X1="./aider-K7JLZT2D.svg";var Q1="./amazon-q-TSOJNPXB.svg";var K1="./amp-EV4LVL5I.svg";var Z1="./augmentcode-Q62PVXKO.svg";var Y1="./claude-6DLEHRDQ.svg";var q1="./cline-6HWKIYN7.svg";var tt="./codex-NQZ5TJCL.svg";var et="./copilot-L2IY45R2.svg";var it="./crush-LYLRDQGZ.svg";var r1="./cursor-GQNH5LCA.svg";var ot="./droid-266OHJBT.svg";var nt="./firebase-studio-ILLWWYU7.svg";var st="./firebender-UNO6LSZG.svg";var rt="./gemini-OYS6V4BH.svg";var at="./goose-XBIEVD4H.svg";var ct="./jules-HJPVWU73.svg";var lt="./junie-RUWBUV6N.svg";var ft="./kilo-code-4QYUYY2E.svg";var dt="./mistral-HQ63EC2B.svg";var pt="./open-hands-K5EYKO6T.svg";var mt="./opencode-K3274JKQ.svg";var gt="./qwen-N3D5CQYL.svg";var ut="./roo-code-CVLBTS7D.svg";var ht="./vercel-27VSITAQ.svg";var wt="./warp-OZKAAQRT.svg";var _=[{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:Y1,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:tt},{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:ct},{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 d1("./package.json","utf-8"));return t?t.type==="module":!1}catch{return!1}},b3=async t=>{let e=D1(await d1("./package.json","utf-8"));e&&(e["lint-staged"]?e["lint-staged"]=q(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 d1(t,"utf-8"),o=D1(i);if(!o)return;let n=q(o,C(e));await F(t,JSON.stringify(n,null,2))},C3=async(t,e)=>{let i=await d1(t,"utf-8"),o=v3(i);if(!o)return;let n=q(o,C(e));await F(t,y3(n))},S3=async(t,e)=>{let n=(await import(u3(t).href)).default||{},s=q(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=q(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)}},G={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 bi}from"commander";var k={name:"ultracite",description:"The AI-ready formatter that helps you write and generate code faster.",version:"7.2.2",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.3.15","@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.2.3","@typescript-eslint/eslint-plugin":"^8.55.0","@typescript-eslint/parser":"^8.55.0","eslint-config-prettier":"^10.1.8","eslint-import-resolver-typescript":"^4.4.4","eslint-plugin-angular":"^5.0.0","eslint-plugin-astro":"^1.5.0","eslint-plugin-compat":"^6.1.0","eslint-plugin-cypress":"^5.3.0","eslint-plugin-github":"6.0.0","eslint-plugin-html":"^8.1.4","eslint-plugin-import":"^2.32.0","eslint-plugin-jest":"^29.14.0","eslint-plugin-jsx-a11y":"^6.10.2","eslint-plugin-n":"^17.23.2","eslint-plugin-prettier":"^5.5.5","eslint-plugin-promise":"^7.2.1","eslint-plugin-qwik":"^1.19.0","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":"^3.0.7","eslint-plugin-storybook":"^10.2.8","eslint-plugin-svelte":"^3.15.0","eslint-plugin-unicorn":"^63.0.0","eslint-plugin-unused-imports":"^4.4.1","eslint-plugin-vue":"^10.7.0",globals:"^17.3.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.47.0"},dependencies:{"@clack/prompts":"^1.0.1",commander:"^14.0.3",deepmerge:"^4.3.1",glob:"^13.0.3","jsonc-parser":"^3.3.1",nypm:"^0.6.5"},peerDependencies:{oxlint:"^1.0.0"},peerDependenciesMeta:{oxlint:{optional:!0}},packageManager:"bun@1.3.9"};m();import{spawnSync as B}from"child_process";import $ 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&&$.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&&$.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&&$.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&&$.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&&$.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&&$.exit(o.status??1)},H1=async(t=[],e=[])=>{let i=await n1();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 r1}from"fs/promises";import{join as j}from"path";import P from"process";import{intro as Ee,log as s1,outro as S1,spinner as Be}from"@clack/prompts";import{parse as V1}from"jsonc-parser";m();var $e=[".prettierrc",".prettierrc.js",".prettierrc.cjs",".prettierrc.mjs",".prettierrc.json",".prettierrc.yaml",".prettierrc.yml","prettier.config.js","prettier.config.mjs","prettier.config.cjs"],Ue=[".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 r1(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 r1(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 r1(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 r1(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=$e.some(o=>S(j(P.cwd(),o))),i=Ue.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(s1.info(`Summary: ${e} passed, ${o} warnings, ${i} failed`),i>0)throw s1.error("Some checks failed. Run 'ultracite init' to fix issues."),S1("Doctor complete"),new Error("Doctor checks failed");if(o>0){s1.warn("Some optional improvements available. Run 'ultracite init' to configure."),S1("Doctor complete");return}s1.success("Everything looks good!"),S1("Doctor complete")};m();import{spawnSync as U}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=U("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=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)},Ve=(t,e)=>{let i=["--write",...e,...t.length>0?h(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)},Xe=(t,e)=>{let i=["--fix",...e,...t.length>0?h(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)},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=U("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=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)},Q1=async(t,e=[])=>{let i=await n1();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 y1,multiselect as t1,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 a1="./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 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:`---
|
|
101
101
|
applyTo: "**/*.{ts,tsx,js,jsx}"
|
|
102
|
-
---`},logo:
|
|
102
|
+
---`},logo:ot},{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:a1},{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 D 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 c1={"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 D(c1,I2);case"eslint":return D(c1,F2);case"oxlint":return D(c1,A2);default:return c1}},l1={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}}}},$2={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}}}}},U2=(t="biome")=>{switch(t){case"biome":return D(l1,E2);case"eslint":return D(l1,B2);case"oxlint":return D(l1,$2);default:return l1}},N=[{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:a1,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:
|
|
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:U2}}];var _2=t=>!!t.hooks,L2=t=>!!t.hooks,D2=()=>N.filter(_2).map(t=>({id:t.id,name:t.name,hooks:t.hooks})),N2=()=>L.filter(L2).map(t=>({id:t.id,name:t.name,hooks:t.hooks})),V=[...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 f1=[{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(`,
|
|
110
110
|
`)}
|
|
111
111
|
]
|
|
112
|
-
}`}],vscodeExtensionId:"biomejs.biome"},{id:"eslint",name:"ESLint + Prettier + Stylelint",subtitle:"The most mature linting ecosystem",description:"The most mature and comprehensive linting solution. Combines ESLint for JavaScript/TypeScript, Prettier for formatting, and Stylelint for CSS with 20+ plugins and hundreds of preconfigured rules.",benefits:[{title:"Battle-tested",description:"Used by millions of developers worldwide. The largest ecosystem of plugins and configurations available.",icon:"ShieldCheck"},{title:"20+ plugins included",description:"React, TypeScript, JSX A11y, Import, Promise, Node, Next.js, Unicorn, SonarJS, and more preconfigured.",icon:"Puzzle"},{title:"Three tools in one",description:"ESLint handles code quality, Prettier ensures consistent formatting, and Stylelint keeps your CSS clean.",icon:"Layers"},{title:"Framework-aware",description:"First-class support for React, Next.js, Vue, Svelte, and more with framework-specific rules.",icon:"Box"},{title:"Type-aware linting",description:"Deep TypeScript integration with type-aware rules that catch bugs static analysis alone can't find.",icon:"FileCode"},{title:"Maximum coverage",description:"Hundreds of rules covering accessibility, security, performance, and best practices out of the box.",icon:"Target"}],includes:["ESLint","Prettier","Stylelint"],logo:
|
|
112
|
+
}`}],vscodeExtensionId:"biomejs.biome"},{id:"eslint",name:"ESLint + Prettier + Stylelint",subtitle:"The most mature linting ecosystem",description:"The most mature and comprehensive linting solution. Combines ESLint for JavaScript/TypeScript, Prettier for formatting, and Stylelint for CSS with 20+ plugins and hundreds of preconfigured rules.",benefits:[{title:"Battle-tested",description:"Used by millions of developers worldwide. The largest ecosystem of plugins and configurations available.",icon:"ShieldCheck"},{title:"20+ plugins included",description:"React, TypeScript, JSX A11y, Import, Promise, Node, Next.js, Unicorn, SonarJS, and more preconfigured.",icon:"Puzzle"},{title:"Three tools in one",description:"ESLint handles code quality, Prettier ensures consistent formatting, and Stylelint keeps your CSS clean.",icon:"Layers"},{title:"Framework-aware",description:"First-class support for React, Next.js, Vue, Svelte, and more with framework-specific rules.",icon:"Box"},{title:"Type-aware linting",description:"Deep TypeScript integration with type-aware rules that catch bugs static analysis alone can't find.",icon:"FileCode"},{title:"Maximum coverage",description:"Hundreds of rules covering accessibility, security, performance, and best practices out of the box.",icon:"Target"}],includes:["ESLint","Prettier","Stylelint"],logo:Ot,additionalLogos:[At,Ft],configFiles:[{name:"eslint.config.mjs",lang:"javascript",code:t=>`import { defineConfig } from "eslint/config";
|
|
113
113
|
${t.map(e=>`import ${e} from "ultracite/eslint/${e}";`).join(`
|
|
114
114
|
`)}
|
|
115
115
|
|
|
@@ -120,7 +120,7 @@ export default defineConfig([
|
|
|
120
120
|
`)}
|
|
121
121
|
],
|
|
122
122
|
},
|
|
123
|
-
]);`},{name:"prettier.config.mjs",lang:"javascript",code:()=>'export { default } from "ultracite/prettier";'},{name:"stylelint.config.mjs",lang:"javascript",code:()=>'export { default } from "ultracite/stylelint";'}],vscodeExtensionId:"dbaeumer.vscode-eslint"},{id:"oxlint",name:"Oxlint + Oxfmt",subtitle:"The fastest linter available",description:"The fastest linter available. Oxlint is part of the Oxc project, running 50-100x faster than ESLint with a focus on catching bugs and reducing false positives.",benefits:[{title:"50-100x faster",description:"Lint your entire codebase in milliseconds. No more waiting for slow linting processes.",icon:"Zap"},{title:"15 plugin equivalents",description:"Built-in support for React, TypeScript, Next.js, Vue, Jest, Vitest, JSDoc, and more without extra deps.",icon:"Puzzle"},{title:"Bug-focused rules",description:"Prioritizes catching real bugs over stylistic issues. High signal-to-noise ratio.",icon:"Bug"},{title:"Oxc ecosystem",description:"Part of the larger Oxc project with parser, resolver, transformer, and minifier built for speed.",icon:"Boxes"},{title:"Category-based config",description:"Rules organized into correctness, suspicious, pedantic, performance, restriction, and style categories.",icon:"FolderTree"},{title:"Drop-in ready",description:"Works alongside your existing ESLint setup or as a complete replacement with Oxfmt for formatting.",icon:"RefreshCw"}],includes:["Oxlint","Oxfmt"],logo:
|
|
123
|
+
]);`},{name:"prettier.config.mjs",lang:"javascript",code:()=>'export { default } from "ultracite/prettier";'},{name:"stylelint.config.mjs",lang:"javascript",code:()=>'export { default } from "ultracite/stylelint";'}],vscodeExtensionId:"dbaeumer.vscode-eslint"},{id:"oxlint",name:"Oxlint + Oxfmt",subtitle:"The fastest linter available",description:"The fastest linter available. Oxlint is part of the Oxc project, running 50-100x faster than ESLint with a focus on catching bugs and reducing false positives.",benefits:[{title:"50-100x faster",description:"Lint your entire codebase in milliseconds. No more waiting for slow linting processes.",icon:"Zap"},{title:"15 plugin equivalents",description:"Built-in support for React, TypeScript, Next.js, Vue, Jest, Vitest, JSDoc, and more without extra deps.",icon:"Puzzle"},{title:"Bug-focused rules",description:"Prioritizes catching real bugs over stylistic issues. High signal-to-noise ratio.",icon:"Bug"},{title:"Oxc ecosystem",description:"Part of the larger Oxc project with parser, resolver, transformer, and minifier built for speed.",icon:"Boxes"},{title:"Category-based config",description:"Rules organized into correctness, suspicious, pedantic, performance, restriction, and style categories.",icon:"FolderTree"},{title:"Drop-in ready",description:"Works alongside your existing ESLint setup or as a complete replacement with Oxfmt for formatting.",icon:"RefreshCw"}],includes:["Oxlint","Oxfmt"],logo:It,configFiles:[{name:".oxlintrc.json",lang:"json",code:t=>`{
|
|
124
124
|
"$schema": "./node_modules/oxlint/configuration_schema.json",
|
|
125
125
|
"extends": [
|
|
126
126
|
${t.map(e=>`"./node_modules/ultracite/config/oxlint/${e}/.oxlintrc.json"`).join(`,
|
|
@@ -137,7 +137,7 @@ export default defineConfig([
|
|
|
137
137
|
"arrowParens": "always",
|
|
138
138
|
"proseWrap": "never",
|
|
139
139
|
"printWidth": 80,
|
|
140
|
-
}`}],vscodeExtensionId:"oxc.oxc-vscode"}];import{addDevDependency as
|
|
140
|
+
}`}],vscodeExtensionId:"oxc.oxc-vscode"}];import{addDevDependency as oi,detectPackageManager as ni}from"nypm";import{readFile as W2,writeFile as P1}from"fs/promises";var Et=(t,e)=>`# Ultracite Code Standards
|
|
141
141
|
|
|
142
142
|
This project uses **Ultracite**, a zero-config preset that enforces strict code quality standards through automated formatting and linting.
|
|
143
143
|
|
|
@@ -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
|
-
`;
|
|
263
|
+
`;m();import{dlxCommand as H2}from"nypm";var Bt=(t,e,i)=>{let o=L.find(a=>a.id===t);if(!o)throw new Error(`Agent "${t}" not found`);let n=f1.find(a=>a.id===i);if(!n)throw new Error(`Provider "${i}" not found`);let s=H2(e,""),r=Et(s,n.name),c=o.config.header?`${o.config.header}
|
|
264
264
|
|
|
265
|
-
${r}`:r;return{exists:()=>l(o.config.path),create:async()=>{await
|
|
265
|
+
${r}`:r;return{exists:()=>l(o.config.path),create:async()=>{await y(o.config.path),await P1(o.config.path,c)},update:async()=>{await y(o.config.path);let a=await l(o.config.path);if(!(o.config.appendMode&&a)){await P1(o.config.path,c);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
|
|
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 $t=(t,e="biome")=>{let i=N.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"),c=K2(s)||{},a=Q2(c,o);await O1(i.config.path,JSON.stringify(a,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";import{dlxCommand as t3}from"nypm";var Ut=(t,e)=>{let i=V.find(a=>a.id===t);if(!i)throw new Error(`Hook integration "${t}" not found`);let o=t3(e,"ultracite",{args:["fix"],short:e==="npm"}),n=i.hooks.getContent(o),s=a=>typeof a=="object"&&a!==null&&!Array.isArray(a),r=a=>JSON.stringify(a).includes("ultracite"),c=async()=>{if(!await l(i.hooks.path)){await I1(i.hooks.path,JSON.stringify(n,null,2));return}let d=await Z2(i.hooks.path,"utf-8"),w=q2(d),e1=s(w)?w:{};if(!r(e1)){let x=Y2(e1,n);await I1(i.hooks.path,JSON.stringify(x,null,2))}};return{exists:()=>l(i.hooks.path),create:async()=>{await y(i.hooks.path),await I1(i.hooks.path,JSON.stringify(n,null,2))},update:async()=>{await y(i.hooks.path),await c()}}};F1();E1();_1();$1();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",p1={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 w=`ultracite/biome/${d}`;r.includes(w)||r.push(w)}n.extends=r;let c={$schema:Xt.$schema},a=I3(n,c);await Vt(e,JSON.stringify(a,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
|
-
`},
|
|
274
|
+
`},m1={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 $3 from"deepmerge";import{parse as U3}from"jsonc-parser";var g1="./.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"}},u1={exists:async()=>await l(g1),create:async()=>{let t=`// Ultracite oxfmt Configuration
|
|
275
275
|
// https://oxc.rs/docs/guide/usage/formatter/config-file-reference.html
|
|
276
|
-
${JSON.stringify(
|
|
277
|
-
`;return await
|
|
276
|
+
${JSON.stringify(qt,null,2)}
|
|
277
|
+
`;return await Yt(g1,t)},update:async()=>{let t=await B3(g1,"utf-8"),i=U3(t)||{},o=$3(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
|
|
281
|
-
`,
|
|
282
|
-
`,x1={exists:async()=>await J3()!==null,create:async()=>{let t=se();await oe(ne,t)},update:async()=>{let t=se();await oe(ne,t)}};import{readFile as W3,writeFile as re}from"fs/promises";import{glob as H3}from"glob";import{applyEdits as V3,modify as X3,parse as Q3}from"jsonc-parser";var ae=async()=>{try{return await H3("**/tsconfig*.json",{ignore:["**/node_modules/**","**/dist/**","**/build/**","**/.next/**"],absolute:!1})}catch{return[]}},K3=t=>{if(!t)return!1;let e=t.compilerOptions;return e?e.strict===!0||e.strictNullChecks===!0:!1},Z3=async t=>{try{let e=await W3(t,"utf-8"),i=Q3(e);if(K3(i))return;if(i===void 0){await re(t,JSON.stringify({compilerOptions:{strictNullChecks:!0}},null,2));return}let n=X3(e,["compilerOptions","strictNullChecks"],!0,{formattingOptions:{tabSize:2,insertSpaces:!0}}),s=V3(e,n);await re(t,s)}catch(e){console.warn(`Failed to update ${t}:`,e)}},N1={exists:async()=>(await ae()).length>0,update:async()=>{let t=await ae();if(t.length===0){console.warn("No tsconfig.json files found in the project");return}await Promise.all(t.map(e=>Z3(e)))}};p();var ce=y.devDependencies["@biomejs/biome"],R1=y.version,oi={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"]},ni=(t,e)=>{for(let i of e){let o=oi[i];o&&t.push(...o)}},si=async(t,e="biome",i=!0,o=!1,n=!1,s=["react"])=>{let r=m();o||r.start("Installing dependencies...");let c=[`ultracite@${R1}`];if(e==="biome"&&c.push(`@biomejs/biome@${ce}`),e==="eslint"&&(c.push("eslint@latest"),c.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"),ni(c,s),c.push("prettier@latest"),c.push("stylelint@latest")),e==="oxlint"&&(c.push("oxlint@latest"),c.push("oxfmt@latest"),n&&c.push("oxlint-tsgolint@latest")),i)for(let a of c)await ei(a,{packageManager:t,workspace:await k(),silent:!0,corepack:!1});else{let a={ultracite:R1};e==="biome"&&(a["@biomejs/biome"]=ce),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 x({devDependencies:a})}await x({scripts:{check:"ultracite check",fix:"ultracite fix"}}),o||r.stop("Dependencies installed.")},ri=async(t=!1)=>{let e=m();if(t||e.start("Checking for tsconfig.json files..."),await N1.exists()){t||e.message("Found tsconfig.json files, updating with strictNullChecks..."),await N1.update(),t||e.stop("tsconfig.json files updated.");return}t||e.stop("No tsconfig.json files found, skipping.")},ai=async(t,e="biome",i=!1)=>{let o=D.find(r=>r.id===t);if(!o)throw new Error(`Editor "${t}" not found`);let n=Et(t,e),s=m();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=l1.find(c=>c.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.`))},ci=async(t,e=!1)=>{let i=m();if(e||i.start("Checking for Biome configuration..."),await d1.exists()){e||i.message("Biome configuration found, updating..."),await d1.update({frameworks:t}),e||i.stop("Biome configuration updated.");return}e||i.message("Biome configuration not found, creating..."),await d1.create({frameworks:t}),e||i.stop("Biome configuration created.")},li=async(t,e=!1)=>{let i=m();if(e||i.start("Checking for ESLint configuration..."),await p1.exists()){e||i.message("ESLint configuration found, updating..."),await p1.update({frameworks:t}),e||i.stop("ESLint configuration updated.");return}e||i.message("ESLint configuration not found, creating..."),await p1.create({frameworks:t}),e||i.stop("ESLint configuration created.")},fi=async(t,e=!1)=>{let i=m();if(e||i.start("Checking for Oxlint configuration..."),await h1.exists()){e||i.message("Oxlint configuration found, updating..."),await h1.update({frameworks:t}),e||i.stop("Oxlint configuration updated.");return}e||i.message("Oxlint configuration not found, creating..."),await h1.create({frameworks:t}),e||i.stop("Oxlint configuration created.")},di=async(t=!1)=>{let e=m();if(t||e.start("Checking for Prettier configuration..."),await w1.exists()){t||e.message("Prettier configuration found, updating..."),await w1.update(),t||e.stop("Prettier configuration updated.");return}t||e.message("Prettier configuration not found, creating..."),await w1.create(),t||e.stop("Prettier configuration created.")},pi=async(t=!1)=>{let e=m();if(t||e.start("Checking for Stylelint configuration..."),await x1.exists()){t||e.message("Stylelint configuration found, updating..."),await x1.update(),t||e.stop("Stylelint configuration updated.");return}t||e.message("Stylelint configuration not found, creating..."),await x1.create(),t||e.stop("Stylelint configuration created.")},mi=async(t=!1)=>{let e=m();if(t||e.start("Checking for oxfmt configuration..."),await g1.exists()){t||e.message("oxfmt configuration found, updating..."),await g1.update(),t||e.stop("oxfmt configuration updated.");return}t||e.message("oxfmt configuration not found, creating..."),await g1.create(),t||e.stop("oxfmt configuration created.")},gi=async(t,e=!0,i=!1,o=!1)=>{let n=m();if(i||(n.start("Initializing pre-commit hooks..."),n.message("Installing Husky...")),e?await O.install(t):await x({devDependencies:{husky:"latest"},scripts:{prepare:"husky"}}),i||n.message("Initializing Husky..."),O.init(t.name),await O.exists()){i||n.message("Pre-commit hook found, updating..."),await O.update(t.name,o),i||n.stop("Pre-commit hook updated.");return}i||n.message("Pre-commit hook not found, creating..."),await O.create(t.name,o),i||n.stop("Pre-commit hook created.")},ui=async(t,e=!0,i=!1)=>{let o=m();if(i||(o.start("Initializing lefthook..."),o.message("Installing lefthook...")),e?await R.install(t):await x({devDependencies:{lefthook:"latest"}}),await R.exists()){i||o.message("lefthook.yml found, updating..."),await R.update(t.name),i||o.stop("lefthook.yml updated.");return}i||o.message("lefthook.yml not found, creating..."),await R.create(t.name),i||o.stop("lefthook.yml created.")},hi=async(t,e=!0,i=!1)=>{let o=m();if(i||(o.start("Initializing lint-staged..."),o.message("Installing lint-staged...")),e?await T.install(t):await x({devDependencies:{"lint-staged":"latest"}}),await T.exists()){i||o.message("lint-staged found, updating..."),await T.update(t.name),i||o.stop("lint-staged updated.");return}i||o.message("lint-staged not found, creating..."),await T.create(t.name),i||o.stop("lint-staged created.")},wi=async(t,e=!1)=>{let i=m();if(e||i.start("Initializing pre-commit..."),await Z.exists()){e||i.message(".pre-commit-config.yaml found, updating..."),await Z.update(t),e||i.stop(".pre-commit-config.yaml updated.");return}e||i.message(".pre-commit-config.yaml not found, creating..."),await Z.create(t),e||i.stop(".pre-commit-config.yaml created.")},xi=async(t,e,i,o,n=!1)=>{let s=m();n||s.start(`Checking for ${e}...`);let r=Ft(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.`)},vi=async(t,e,i=!1)=>{let o=m(),n=H.find(r=>r.id===t)?.name??t;i||o.start(`Checking for ${n} hooks...`);let s=Bt(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.`)},le=async t=>{let e=t??{},i=e.quiet??!1;i||q3(`Ultracite v${R1} Initialization`);try{let{pm:o}=e,n;if(o)n={name:o,command:o};else{let f=await ii(Y3.cwd());if(!f)throw new Error("No package manager specified or detected");if(!i&&f.warnings)for(let g of f.warnings)v1.warn(g);i||v1.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 g=await ti({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(J(g)){M("Operation cancelled.");return}s=g}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 g=await q({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(J(g)){M("Operation cancelled.");return}r=g}let c=e.editors;if(!c)if(i)c=[];else{let f=await q({message:"Which editors do you want to configure (recommended)?",options:[{label:"VSCode / Cursor / Windsurf",value:"vscode"},{label:"Zed",value:"zed"}],required:!1});if(J(f)){M("Operation cancelled.");return}c=f}let a=e.agents,d=e.hooks,h=Object.fromEntries(_.map(f=>[f.id,f.name]));if(!a)if(i)a=[];else{let f=await q({message:"Which agents do you want to enable (optional)?",options:Object.entries(h).map(([g,y1])=>({value:g,label:y1})),required:!1});if(J(f)){M("Operation cancelled.");return}a=f}let t1=Object.fromEntries(H.map(f=>[f.id,f.name]));if(!d)if(i)d=[];else{let f=await q({message:"Which agent hooks do you want to enable (optional)?",options:Object.entries(t1).map(([g,y1])=>({value:g,label:y1})),required:!1});if(J(f)){M("Operation cancelled.");return}d=f}let w=e.integrations;if(w===void 0)if(i||e.pm||e.editors||e.agents||e.hooks)w=[];else{let g=await q({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(J(g)){M("Operation cancelled.");return}w=g}await si(n,s,!e.skipInstall,i,s==="oxlint"&&e["type-aware"],r),await ri(i),s==="biome"&&await ci(r,i),s==="eslint"&&(await li(r,i),await di(i),await pi(i)),s==="oxlint"&&(await fi(r,i),await mi(i));for(let f of c??[])await ai(f,s,i);for(let f of a??[])await xi(f,h[f],o,s,i);for(let f of d??[])await vi(f,o,i);if(w?.includes("husky")){let f=w?.includes("lint-staged")??!1;await gi(n,!e.skipInstall,i,f)}w?.includes("lefthook")&&await ui(n,!e.skipInstall,i),w?.includes("lint-staged")&&await hi(n,!e.skipInstall,i),w?.includes("pre-commit")&&await wi(o,i),i||v1.success("Successfully initialized Ultracite! Make sure to check out ultracite.ai/cloud for our pro version.")}catch(o){let n=o instanceof Error?o.message:"Unknown error";throw i||v1.error(`Failed to initialize Ultracite configuration: ${n}`),o}};var W=new yi;W.name("ultracite").version(y.version).description(y.description);W.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 le({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")})});W.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 J1(n,o)});W.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 V1(n,o)});W.command("doctor").description("Verify your Ultracite setup").action(async()=>{await H1()});process.env.TEST||W.parse();export{W as program};
|
|
280
|
+
`;await Yt(g1,n)}};m();import{readFile as _3,writeFile as te}from"fs/promises";import L3 from"deepmerge";import{parse as D3}from"jsonc-parser";var h1="./.oxlintrc.json",M=t=>`./node_modules/ultracite/config/oxlint/${t}/.oxlintrc.json`,ee={$schema:"./node_modules/oxlint/configuration_schema.json",extends:[M("core")]},w1={exists:async()=>await l(h1),create:async t=>{let e=[M("core")];if(t?.frameworks&&t.frameworks.length>0)for(let o of t.frameworks)e.push(M(o));let i={...ee,extends:e};return await te(h1,JSON.stringify(i,null,2))},update:async t=>{let e=await _3(h1,"utf-8"),o=D3(e)||{},n=o.extends&&Array.isArray(o.extends)?o.extends:[],s=d=>n.some(w=>w===M(d)),r=[...n];if(s("core")||r.push(M("core")),t?.frameworks&&t.frameworks.length>0)for(let d of t.frameworks)s(d)||r.push(M(d));o.extends=r;let c={$schema:ee.$schema},a=L3(o,c);await te(h1,JSON.stringify(a,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
|
+
`,x1={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
|
+
`,v1={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=async(t,e="biome",i=!0,o=!1,n=!1,s=["react"])=>{let r=g();o||r.start("Installing dependencies...");let c=[`ultracite@${T1}`];if(e==="biome"&&c.push(`@biomejs/biome@${fe}`),e==="eslint"&&(c.push("eslint@latest"),c.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(c,s),c.push("prettier@latest"),c.push("stylelint@latest")),e==="oxlint"&&(c.push("oxlint@latest"),c.push("oxfmt@latest"),n&&c.push("oxlint-tsgolint@latest")),i)for(let a of c)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.")},ci=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.")},li=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=$t(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=f1.find(c=>c.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 p1.exists()){e||i.message("Biome configuration found, updating..."),await p1.update({frameworks:t}),e||i.stop("Biome configuration updated.");return}e||i.message("Biome configuration not found, creating..."),await p1.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 m1.exists()){e||i.message("ESLint configuration found, updating..."),await m1.update({frameworks:t}),e||i.stop("ESLint configuration updated.");return}e||i.message("ESLint configuration not found, creating..."),await m1.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 w1.exists()){e||i.message("Oxlint configuration found, updating..."),await w1.update({frameworks:t}),e||i.stop("Oxlint configuration updated.");return}e||i.message("Oxlint configuration not found, creating..."),await w1.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 x1.exists()){t||e.message("Prettier configuration found, updating..."),await x1.update(),t||e.stop("Prettier configuration updated.");return}t||e.message("Prettier configuration not found, creating..."),await x1.create(),t||e.stop("Prettier configuration created.")},gi=async(t=!1)=>{let e=g();if(t||e.start("Checking for Stylelint configuration..."),await v1.exists()){t||e.message("Stylelint configuration found, updating..."),await v1.update(),t||e.stop("Stylelint configuration updated.");return}t||e.message("Stylelint configuration not found, creating..."),await v1.create(),t||e.stop("Stylelint configuration created.")},ui=async(t=!1)=>{let e=g();if(t||e.start("Checking for oxfmt configuration..."),await u1.exists()){t||e.message("oxfmt configuration found, updating..."),await u1.update(),t||e.stop("oxfmt configuration updated.");return}t||e.message("oxfmt configuration not found, creating..."),await u1.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=Ut(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)y1.warn(u);i||y1.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 t1({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 c=e.editors;if(!c)if(i)c=[];else{let f=await t1({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}c=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 t1({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 e1=Object.fromEntries(V.map(f=>[f.id,f.name]));if(!d)if(i)d=[];else{let f=await t1({message:"Which agent hooks do you want to enable (optional)?",options:Object.entries(e1).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 t1({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 ci(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 c??[])await li(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||y1.success("Successfully initialized Ultracite! Make sure to check out ultracite.ai/cloud for our pro version.")}catch(o){let n=o instanceof Error?o.message:"Unknown error";throw i||y1.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};
|