ultracite 7.0.10 → 7.0.11

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.
@@ -633,6 +633,16 @@
633
633
  "allowTrailingCommas": true
634
634
  }
635
635
  }
636
+ },
637
+ {
638
+ // JSONC files (JSON with Comments)
639
+ "includes": ["**/*.jsonc"],
640
+ "json": {
641
+ "parser": {
642
+ "allowComments": true,
643
+ "allowTrailingCommas": true
644
+ }
645
+ }
636
646
  }
637
647
  ]
638
648
  }
package/dist/index.js CHANGED
@@ -128,7 +128,7 @@ ${i}`)}}});var v3,D1=L(()=>{v3=H1({"./husky.ts":()=>($1(),s1(Rt)),"./lefthook.ts
128
128
  `}else e+=`${o}: '${i}'
129
129
  `;return e},j3=async()=>{try{let t=T1(await h1("./package.json","utf-8"));return t?t.type==="module":!1}catch{return!1}},P3=async t=>{let e=T1(await h1("./package.json","utf-8"));e&&(e["lint-staged"]?e["lint-staged"]=e1(e["lint-staged"],E(t)):e["lint-staged"]=E(t),await _("./package.json",JSON.stringify(e,null,2)))},E3=async(t,e)=>{let o=await h1(t,"utf-8"),i=T1(o);if(!i)return;let n=e1(i,E(e));await _(t,JSON.stringify(n,null,2))},A3=async(t,e)=>{let o=await h1(t,"utf-8"),i=C3(o);if(!i)return;let n=e1(i,E(e));await _(t,S3(n))},I3=async(t,e)=>{let n=(await import(y3(t).href)).default||{},s=e1(n,E(e)),r=`export default ${JSON.stringify(s,null,2)};
130
130
  `;await _(t,r)},O3=async(t,e)=>{delete P1.cache[P1.resolve(`./${t}`)];let o=v3(`./${t}`),i=e1(o,E(e)),n=`module.exports = ${JSON.stringify(i,null,2)};
131
- `;await _(t,n)},N1=async t=>{await _(".lintstagedrc.json",JSON.stringify(E(t),null,2))},B3=async(t,e)=>{if(t==="./package.json"){await P3(e);return}if(t.endsWith(".json")||t==="./.lintstagedrc"){await E3(t,e);return}if(t.endsWith(".yaml")||t.endsWith(".yml")){await A3(t,e);return}let o=await j3();if(t.endsWith(".mjs")||t.endsWith(".js")&&o){try{await I3(t,e)}catch{await N1(e)}return}if(t.endsWith(".cjs")||t.endsWith(".js")&&!o)try{await O3(t,e)}catch{await N1(e)}},X={exists:async()=>{for(let t of Vt)if(await l(t))return!0;return!1},install:async t=>{await k3("lint-staged",{packageManager:t,workspace:await j(),silent:!0})},create:async t=>{await _(".lintstagedrc.json",JSON.stringify(E(t),null,2))},update:async t=>{let e=null;for(let o of Vt)if(await l(o)){e=o;break}if(!e){await N1(t);return}await B3(e,t)}}});var W1="./aider-K7JLZT2D.svg";var V1="./amazon-q-TSOJNPXB.svg";var X1="./amp-EV4LVL5I.svg";var Q1="./augmentcode-Q62PVXKO.svg";var K1="./claude-6DLEHRDQ.svg";var Y1="./cline-6HWKIYN7.svg";var Z1="./codex-NQZ5TJCL.svg";var q1="./copilot-L2IY45R2.svg";var tt="./crush-LYLRDQGZ.svg";var r1="./cursor-GQNH5LCA.svg";var et="./droid-266OHJBT.svg";var ot="./firebase-studio-ILLWWYU7.svg";var it="./firebender-UNO6LSZG.svg";var nt="./gemini-OYS6V4BH.svg";var st="./goose-XBIEVD4H.svg";var rt="./jules-HJPVWU73.svg";var at="./junie-RUWBUV6N.svg";var ct="./kilo-code-4QYUYY2E.svg";var lt="./mistral-HQ63EC2B.svg";var ft="./open-hands-K5EYKO6T.svg";var dt="./opencode-K3274JKQ.svg";var mt="./qwen-N3D5CQYL.svg";var pt="./roo-code-CVLBTS7D.svg";var gt="./vercel-L62WLWYQ.svg";var ht="./warp-OZKAAQRT.svg";var C=[{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:K1,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:Z1},{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:rt},{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:`---
131
+ `;await _(t,n)},N1=async t=>{await _(".lintstagedrc.json",JSON.stringify(E(t),null,2))},B3=async(t,e)=>{if(t==="./package.json"){await P3(e);return}if(t.endsWith(".json")||t==="./.lintstagedrc"){await E3(t,e);return}if(t.endsWith(".yaml")||t.endsWith(".yml")){await A3(t,e);return}let o=await j3();if(t.endsWith(".mjs")||t.endsWith(".js")&&o){try{await I3(t,e)}catch{await N1(e)}return}if(t.endsWith(".cjs")||t.endsWith(".js")&&!o)try{await O3(t,e)}catch{await N1(e)}},X={exists:async()=>{for(let t of Vt)if(await l(t))return!0;return!1},install:async t=>{await k3("lint-staged",{packageManager:t,workspace:await j(),silent:!0})},create:async t=>{await _(".lintstagedrc.json",JSON.stringify(E(t),null,2))},update:async t=>{let e=null;for(let o of Vt)if(await l(o)){e=o;break}if(!e){await N1(t);return}await B3(e,t)}}});var W1="./aider-K7JLZT2D.svg";var V1="./amazon-q-TSOJNPXB.svg";var X1="./amp-EV4LVL5I.svg";var Q1="./augmentcode-Q62PVXKO.svg";var K1="./claude-6DLEHRDQ.svg";var Y1="./cline-6HWKIYN7.svg";var Z1="./codex-NQZ5TJCL.svg";var q1="./copilot-L2IY45R2.svg";var tt="./crush-LYLRDQGZ.svg";var r1="./cursor-GQNH5LCA.svg";var et="./droid-266OHJBT.svg";var ot="./firebase-studio-ILLWWYU7.svg";var it="./firebender-UNO6LSZG.svg";var nt="./gemini-OYS6V4BH.svg";var st="./goose-XBIEVD4H.svg";var rt="./jules-HJPVWU73.svg";var at="./junie-RUWBUV6N.svg";var ct="./kilo-code-4QYUYY2E.svg";var lt="./mistral-HQ63EC2B.svg";var ft="./open-hands-K5EYKO6T.svg";var dt="./opencode-K3274JKQ.svg";var mt="./qwen-N3D5CQYL.svg";var pt="./roo-code-CVLBTS7D.svg";var gt="./vercel-27VSITAQ.svg";var ht="./warp-OZKAAQRT.svg";var C=[{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:K1,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:Z1},{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:rt},{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:`---
132
132
  applyTo: "**/*.{ts,tsx,js,jsx}"
133
133
  ---`},logo:q1},{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:Y1},{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:"AGENT.md",appendMode:!0},logo:X1},{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:W1},{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:ot},{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:ft},{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:nt},{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:at},{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:ct},{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:st},{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:pt},{id:"warp",name:"Warp",subtitle:"Modern AI terminal",description:"A modern terminal with AI-powered command suggestions and workflow automation.",config:{path:"WARP.md",appendMode:!0},logo:ht},{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:et},{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:dt},{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:tt},{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:mt},{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:V1},{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:it},{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:r1},{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:lt},{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:gt}];import U from"deepmerge";var ut="./antigravity-JVONECNW.svg";var wt="./kiro-N2M256R6.svg";var xt="./trae-RXVCFBOF.svg";var vt="./void-NYH3U3BB.svg";var yt="./vscode-DEOUEB65.svg";var kt="./windsurf-5T7JOTST.svg";var bt="./zed-SIARPESF.svg";var a1={"editor.defaultFormatter":"esbenp.prettier-vscode","typescript.tsdk":"node_modules/typescript/lib","editor.formatOnSave":!0,"editor.formatOnPaste":!0,"emmet.showExpandedAbbreviation":"never"},Qe={"[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"}},Ke={"[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"}},Ye={"editor.codeActionsOnSave":{"source.fixAll.eslint":"explicit","source.organizeImports":"explicit"}},A=(t="biome")=>{switch(t){case"biome":return U(a1,Qe);case"eslint":return U(a1,Ye);case"oxlint":return U(a1,Ke);default:return a1}},c1={formatter:"language_server",format_on_save:"on",lsp:{"typescript-language-server":{settings:{typescript:{preferences:{includePackageJsonAutoImports:"on"}}}}}},Ze={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}}}},qe={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}}}},t2={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}}}}},e2=(t="biome")=>{switch(t){case"biome":return U(c1,Ze);case"eslint":return U(c1,qe);case"oxlint":return U(c1,t2);default:return c1}},S=[{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:yt,config:{path:".vscode/settings.json",getContent:A,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:r1,rules:{path:".cursor/rules/ultracite.mdc",header:`---
134
134
  description: Ultracite Rules - AI-Ready Formatter and Linter
@@ -168,7 +168,7 @@ export default defineConfig([
168
168
  "arrowParens": "always",
169
169
  "proseWrap": "never",
170
170
  "printWidth": 80,
171
- }`}],vscodeExtensionId:"oxc.oxc-vscode"}];var d2=["react","next","solid","vue","svelte","qwik","remix","angular","astro"],m2=["husky","lefthook","lint-staged","pre-commit"],p2=["eslint","prettier"],v={linters:D.map(t=>t.id),editorConfigs:S.map(t=>t.id),agents:C.map(t=>t.id),integrations:m2,hooks:I.map(t=>t.id),frameworks:d2,migrations:p2};import{initTRPC as jo}from"@trpc/server";import{packageManagers as Po}from"nypm";import{createCli as Eo}from"trpc-cli";import c from"zod";var k={name:"ultracite",description:"The AI-ready formatter that helps you write and generate code faster.",version:"7.0.10",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.11","@eslint/js":"^9.39.2","@next/eslint-plugin-next":"^16.1.1","@repo/data":"workspace:*","@tanstack/eslint-plugin-query":"^5.91.2","@types/node":"^25.0.3","@typescript-eslint/eslint-plugin":"^8.51.0","@typescript-eslint/parser":"^8.51.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.0.2","eslint-plugin-cypress":"^5.2.0","eslint-plugin-github":"6.0.0","eslint-plugin-html":"^8.1.3","eslint-plugin-import":"^2.32.0","eslint-plugin-jest":"^29.12.0","eslint-plugin-jsx-a11y":"^6.10.2","eslint-plugin-n":"^17.23.1","eslint-plugin-prettier":"^5.5.4","eslint-plugin-promise":"^7.2.1","eslint-plugin-qwik":"^1.18.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.5","eslint-plugin-storybook":"^10.1.11","eslint-plugin-svelte":"^3.13.1","eslint-plugin-tailwindcss":"^3.18.2","eslint-plugin-unicorn":"^62.0.0","eslint-plugin-unused-imports":"^4.3.0","eslint-plugin-vue":"^10.6.2",globals:"^16.5.0","prettier-plugin-tailwindcss":"^0.7.2","stylelint-config-idiomatic-order":"^10.0.0","stylelint-config-standard":"^39.0.1","stylelint-prettier":"^5.0.3",tsup:"^8.5.1"},dependencies:{"@clack/prompts":"^0.11.0","@trpc/server":"^11.8.1",deepmerge:"^4.3.1",glob:"^13.0.0","jsonc-parser":"^3.3.1",nypm:"^0.6.2",oxlint:"^1.36.0","trpc-cli":"^0.12.1",zod:"^4.3.2"},packageManager:"bun@1.3.5"};m();import{spawnSync as R}from"child_process";import N from"process";import{detectPackageManager as T,dlxCommand as G}from"nypm";var S2=async(t,e,o)=>{let i=["check","--no-errors-on-unmatched"];e&&i.push(`--diagnostic-level=${e}`),o&&i.push("--error-on-warnings"),t.length>0?i.push(...u(t)):i.push("./");let s=(await T(N.cwd()))?.name||"npm",r=G(s,"@biomejs/biome",{args:i,short:s==="npm"}),a=R(r,{stdio:"inherit",shell:!0});if(a.error)throw new Error(`Failed to run Biome: ${a.error.message}`);return{hasErrors:a.status!==0}},j2=async t=>{let e=t.length>0?u(t):["."],i=(await T(N.cwd()))?.name||"npm",n=G(i,"eslint",{args:e,short:i==="npm"}),s=R(n,{stdio:"inherit",shell:!0});if(s.error)throw new Error(`Failed to run ESLint: ${s.error.message}`);return{hasErrors:s.status!==0}},P2=async t=>{let e=["--check",...t.length>0?u(t):["."]],i=(await T(N.cwd()))?.name||"npm",n=G(i,"prettier",{args:e,short:i==="npm"}),s=R(n,{stdio:"inherit",shell:!0});if(s.error)throw new Error(`Failed to run Prettier: ${s.error.message}`);return{hasErrors:s.status!==0}},E2=async t=>{let e=t.length>0?u(t):["."],i=(await T(N.cwd()))?.name||"npm",n=G(i,"stylelint",{args:e,short:i==="npm"}),s=R(n,{stdio:"inherit",shell:!0});if(s.error)throw new Error(`Failed to run Stylelint: ${s.error.message}`);return{hasErrors:s.status!==0}},A2=async(t,e,o)=>{let i=[];e&&i.push("--type-aware"),o&&i.push("--type-check"),i.push(...t.length>0?u(t):["."]);let s=(await T(N.cwd()))?.name||"npm",r=G(s,"oxlint",{args:i,short:s==="npm"}),a=R(r,{stdio:"inherit",shell:!0});if(a.error)throw new Error(`Failed to run Oxlint: ${a.error.message}`);return{hasErrors:a.status!==0}},I2=async(t,e)=>{let o=["--check"];e&&o.push("--no-error-on-unmatched-pattern"),o.push(...t.length>0?u(t):["."]);let n=(await T(N.cwd()))?.name||"npm",s=G(n,"oxfmt",{args:o,short:n==="npm"}),r=R(s,{stdio:"inherit",shell:!0});if(r.error)throw new Error(`Failed to run oxfmt: ${r.error.message}`);return{hasErrors:r.status!==0}},At=async t=>{let e=t?.[0]||[],o=t?.[1]["diagnostic-level"],n=t?.[1].linter||await l1();if(!n)throw new Error("No linter configuration found. Run `ultracite init` to set up a linter.");switch(n){case"eslint":{let s=await P2(e),r=await j2(e),a=await E2(e);return{hasErrors:s.hasErrors||r.hasErrors||a.hasErrors}}case"oxlint":{let s=await I2(e,t?.[1]["no-error-on-unmatched-pattern"]),r=await A2(e,t?.[1]["type-aware"],t?.[1]["type-check"]);return{hasErrors:s.hasErrors||r.hasErrors}}default:return S2(e,o,t?.[1]["error-on-warnings"])}};import{spawnSync as A1}from"child_process";import{existsSync as O}from"fs";import{readFile as d1}from"fs/promises";import{join as B}from"path";import w from"process";import{intro as O2,log as f1,outro as E1,spinner as B2}from"@clack/prompts";import{parse as It}from"jsonc-parser";import{detectPackageManager as m1,dlxCommand as p1}from"nypm";var F2=[".prettierrc",".prettierrc.js",".prettierrc.cjs",".prettierrc.mjs",".prettierrc.json",".prettierrc.yaml",".prettierrc.yml","prettier.config.js","prettier.config.mjs","prettier.config.cjs"],$2=[".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"],_2=async()=>{let e=(await m1(w.cwd()))?.name||"npm",o=p1(e,"@biomejs/biome",{args:["--version"],short:e==="npm"}),i=A1(o,{shell:!0,encoding:"utf-8"});return i.status===0&&i.stdout?{name:"Biome installation",status:"pass",message:`Biome is installed (${i.stdout.trim()})`}:{name:"Biome installation",status:"fail",message:"Biome is not installed or not accessible"}},L2=async()=>{let e=(await m1(w.cwd()))?.name||"npm",o=p1(e,"eslint",{args:["--version"],short:e==="npm"}),i=A1(o,{shell:!0,encoding:"utf-8"});return i.status===0&&i.stdout?{name:"ESLint installation",status:"pass",message:`ESLint is installed (${i.stdout.trim()})`}:{name:"ESLint installation",status:"warn",message:"ESLint is not installed (optional)"}},U2=async()=>{let e=(await m1(w.cwd()))?.name||"npm",o=p1(e,"oxlint",{args:["--version"],short:e==="npm"}),i=A1(o,{shell:!0,encoding:"utf-8"});return i.status===0&&i.stdout?{name:"Oxlint installation",status:"pass",message:`Oxlint is installed (${i.stdout.trim()})`}:{name:"Oxlint installation",status:"warn",message:"Oxlint is not installed (optional)"}},D2=async()=>{let t=B(w.cwd(),"biome.json"),e=B(w.cwd(),"biome.jsonc"),o=null;if(O(t)?o=t:O(e)&&(o=e),!o)return{name:"Biome configuration",status:"warn",message:"No biome.json or biome.jsonc file found"};try{let i=await d1(o,"utf-8"),n=It(i);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"}}},R2=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 o of t){let i=B(w.cwd(),o);if(O(i)){e=i;break}}if(!e)return{name:"ESLint configuration",status:"warn",message:"No eslint.config.* file found (optional)"};try{return(await d1(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"}}},N2=t=>`./node_modules/ultracite/config/oxlint/${t}/.oxlintrc.json`,T2=async()=>{let t=B(w.cwd(),".oxlintrc.json");if(!O(t))return{name:"Oxlint configuration",status:"warn",message:"No .oxlintrc.json file found (optional)"};try{let e=await d1(t,"utf-8"),o=It(e);return Array.isArray(o?.extends)&&o.extends.includes(N2("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"}}},G2=async()=>{let t=B(w.cwd(),"package.json");if(!O(t))return{name:"Ultracite dependency",status:"warn",message:"No package.json found"};try{let e=JSON.parse(await d1(t,"utf-8")),o=e.dependencies?.ultracite||e.devDependencies?.ultracite||e.peerDependencies?.ultracite;return o?{name:"Ultracite dependency",status:"pass",message:`Ultracite is in package.json (${o})`}:{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"}}},M2=()=>{let t=F2.some(i=>O(B(w.cwd(),i))),o=$2.filter(i=>!i.startsWith("eslint.config")).some(i=>O(B(w.cwd(),i)));if(t||o){let i=[];return t&&i.push("Prettier"),o&&i.push("ESLint (legacy config)"),{name:"Conflicting tools",status:"warn",message:`Found potentially conflicting tools: ${i.join(", ")}`}}return{name:"Conflicting tools",status:"pass",message:"No conflicting formatting/linting tools found"}},P=async(t,e)=>{let o=B2();o.start(`Checking ${e}...`);let i=await t();return i.status==="pass"||i.status,o.stop(i.message),i},Ot=async()=>{O2(`Ultracite v${k.version} Doctor`);let e=(await m1(w.cwd()))?.name||"npm",o=p1(e,"ultracite",{args:["init"],short:e==="npm"}),i=[];i.push(await P(_2,"Biome installation")),i.push(await P(L2,"ESLint installation")),i.push(await P(U2,"Oxlint installation")),i.push(await P(D2,"Biome configuration")),i.push(await P(R2,"ESLint configuration")),i.push(await P(T2,"Oxlint configuration")),i.push(await P(G2,"Ultracite dependency")),i.push(await P(M2,"conflicting tools"));let n=i.filter(a=>a.status==="pass").length,s=i.filter(a=>a.status==="fail").length,r=i.filter(a=>a.status==="warn").length;if(f1.info(`Summary: ${n} passed, ${r} warnings, ${s} failed`),s>0)throw f1.error(`Some checks failed. Run '${o}' to fix issues.`),E1("Doctor complete"),new Error("Doctor checks failed");if(r>0){f1.warn(`Some optional improvements available. Run '${o}' to configure.`),E1("Doctor complete");return}f1.success("Everything looks good!"),E1("Doctor complete")};m();import{spawnSync as M}from"child_process";import J from"process";import{detectPackageManager as H,dlxCommand as W}from"nypm";var J2=async(t,e,o)=>{let i=["check","--write","--no-errors-on-unmatched"];e&&i.push("--unsafe"),o&&i.push("--error-on-warnings"),t.length>0?i.push(...u(t)):i.push("./");let s=(await H(J.cwd()))?.name||"npm",r=W(s,"@biomejs/biome",{args:i,short:s==="npm"}),a=M(r,{stdio:"inherit",shell:!0});if(a.error)throw new Error(`Failed to run Biome: ${a.error.message}`);return{hasErrors:a.status!==0}},H2=async t=>{let e=["--fix",...t.length>0?u(t):["."]],i=(await H(J.cwd()))?.name||"npm",n=W(i,"eslint",{args:e,short:i==="npm"}),s=M(n,{stdio:"inherit",shell:!0});if(s.error)throw new Error(`Failed to run ESLint: ${s.error.message}`);return{hasErrors:s.status!==0}},W2=async t=>{let e=["--write",...t.length>0?u(t):["."]],i=(await H(J.cwd()))?.name||"npm",n=W(i,"prettier",{args:e,short:i==="npm"}),s=M(n,{stdio:"inherit",shell:!0});if(s.error)throw new Error(`Failed to run Prettier: ${s.error.message}`);return{hasErrors:s.status!==0}},V2=async t=>{let e=["--fix",...t.length>0?u(t):["."]],i=(await H(J.cwd()))?.name||"npm",n=W(i,"stylelint",{args:e,short:i==="npm"}),s=M(n,{stdio:"inherit",shell:!0});if(s.error)throw new Error(`Failed to run Stylelint: ${s.error.message}`);return{hasErrors:s.status!==0}},X2=async(t,e,o,i)=>{let n=[i?"--fix-dangerously":"--fix"];e&&n.push("--type-aware"),o&&n.push("--type-check"),n.push(...t.length>0?u(t):["."]);let r=(await H(J.cwd()))?.name||"npm",a=W(r,"oxlint",{args:n,short:r==="npm"}),f=M(a,{stdio:"inherit",shell:!0});if(f.error)throw new Error(`Failed to run Oxlint: ${f.error.message}`);return{hasErrors:f.status!==0}},Q2=async t=>{let e=["--write",...t.length>0?u(t):["."]],i=(await H(J.cwd()))?.name||"npm",n=W(i,"oxfmt",{args:e,short:i==="npm"}),s=M(n,{stdio:"inherit",shell:!0});if(s.error)throw new Error(`Failed to run oxfmt: ${s.error.message}`);return{hasErrors:s.status!==0}},Bt=async(t,e={})=>{let o=e.linter||await l1();if(!o)throw new Error("No linter configuration found. Run `ultracite init` to set up a linter.");switch(o){case"eslint":{let i=await W2(t),n=await H2(t),s=await V2(t);return{hasErrors:i.hasErrors||n.hasErrors||s.hasErrors}}case"oxlint":{let i=await Q2(t),n=await X2(t,e["type-aware"],e["type-check"],e.unsafe);return{hasErrors:i.hasErrors||n.hasErrors}}default:return J2(t,e.unsafe,e["error-on-warnings"])}};import so from"process";import{cancel as K,intro as ro,isCancel as Y,log as C1,multiselect as o1,select as ao,spinner as g}from"@clack/prompts";import{addDevDependency as co,detectPackageManager as lo}from"nypm";import{readFile as K2,writeFile as I1}from"fs/promises";var Ft=(t,e)=>`# Ultracite Code Standards
171
+ }`}],vscodeExtensionId:"oxc.oxc-vscode"}];var d2=["react","next","solid","vue","svelte","qwik","remix","angular","astro"],m2=["husky","lefthook","lint-staged","pre-commit"],p2=["eslint","prettier"],v={linters:D.map(t=>t.id),editorConfigs:S.map(t=>t.id),agents:C.map(t=>t.id),integrations:m2,hooks:I.map(t=>t.id),frameworks:d2,migrations:p2};import{initTRPC as jo}from"@trpc/server";import{packageManagers as Po}from"nypm";import{createCli as Eo}from"trpc-cli";import c from"zod";var k={name:"ultracite",description:"The AI-ready formatter that helps you write and generate code faster.",version:"7.0.11",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.11","@eslint/js":"^9.39.2","@next/eslint-plugin-next":"^16.1.1","@repo/data":"workspace:*","@tanstack/eslint-plugin-query":"^5.91.2","@types/node":"^25.0.3","@typescript-eslint/eslint-plugin":"^8.52.0","@typescript-eslint/parser":"^8.52.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.0.2","eslint-plugin-cypress":"^5.2.1","eslint-plugin-github":"6.0.0","eslint-plugin-html":"^8.1.3","eslint-plugin-import":"^2.32.0","eslint-plugin-jest":"^29.12.1","eslint-plugin-jsx-a11y":"^6.10.2","eslint-plugin-n":"^17.23.1","eslint-plugin-prettier":"^5.5.4","eslint-plugin-promise":"^7.2.1","eslint-plugin-qwik":"^1.18.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.5","eslint-plugin-storybook":"^10.1.11","eslint-plugin-svelte":"^3.14.0","eslint-plugin-tailwindcss":"^3.18.2","eslint-plugin-unicorn":"^62.0.0","eslint-plugin-unused-imports":"^4.3.0","eslint-plugin-vue":"^10.6.2",globals:"^17.0.0","prettier-plugin-tailwindcss":"^0.7.2","stylelint-config-idiomatic-order":"^10.0.0","stylelint-config-standard":"^39.0.1","stylelint-prettier":"^5.0.3",tsup:"^8.5.1",oxlint:"^1.38.0"},dependencies:{"@clack/prompts":"^0.11.0","@trpc/server":"^11.8.1",deepmerge:"^4.3.1",glob:"^13.0.0","jsonc-parser":"^3.3.1",nypm:"^0.6.2","trpc-cli":"^0.12.2",zod:"^4.3.5"},peerDependencies:{oxlint:"^1.0.0"},peerDependenciesMeta:{oxlint:{optional:!0}},packageManager:"bun@1.3.5"};m();import{spawnSync as R}from"child_process";import N from"process";import{detectPackageManager as T,dlxCommand as G}from"nypm";var S2=async(t,e,o)=>{let i=["check","--no-errors-on-unmatched"];e&&i.push(`--diagnostic-level=${e}`),o&&i.push("--error-on-warnings"),t.length>0?i.push(...u(t)):i.push("./");let s=(await T(N.cwd()))?.name||"npm",r=G(s,"@biomejs/biome",{args:i,short:s==="npm"}),a=R(r,{stdio:"inherit",shell:!0});if(a.error)throw new Error(`Failed to run Biome: ${a.error.message}`);return{hasErrors:a.status!==0}},j2=async t=>{let e=t.length>0?u(t):["."],i=(await T(N.cwd()))?.name||"npm",n=G(i,"eslint",{args:e,short:i==="npm"}),s=R(n,{stdio:"inherit",shell:!0});if(s.error)throw new Error(`Failed to run ESLint: ${s.error.message}`);return{hasErrors:s.status!==0}},P2=async t=>{let e=["--check",...t.length>0?u(t):["."]],i=(await T(N.cwd()))?.name||"npm",n=G(i,"prettier",{args:e,short:i==="npm"}),s=R(n,{stdio:"inherit",shell:!0});if(s.error)throw new Error(`Failed to run Prettier: ${s.error.message}`);return{hasErrors:s.status!==0}},E2=async t=>{let e=t.length>0?u(t):["."],i=(await T(N.cwd()))?.name||"npm",n=G(i,"stylelint",{args:e,short:i==="npm"}),s=R(n,{stdio:"inherit",shell:!0});if(s.error)throw new Error(`Failed to run Stylelint: ${s.error.message}`);return{hasErrors:s.status!==0}},A2=async(t,e,o)=>{let i=[];e&&i.push("--type-aware"),o&&i.push("--type-check"),i.push(...t.length>0?u(t):["."]);let s=(await T(N.cwd()))?.name||"npm",r=G(s,"oxlint",{args:i,short:s==="npm"}),a=R(r,{stdio:"inherit",shell:!0});if(a.error)throw new Error(`Failed to run Oxlint: ${a.error.message}`);return{hasErrors:a.status!==0}},I2=async(t,e)=>{let o=["--check"];e&&o.push("--no-error-on-unmatched-pattern"),o.push(...t.length>0?u(t):["."]);let n=(await T(N.cwd()))?.name||"npm",s=G(n,"oxfmt",{args:o,short:n==="npm"}),r=R(s,{stdio:"inherit",shell:!0});if(r.error)throw new Error(`Failed to run oxfmt: ${r.error.message}`);return{hasErrors:r.status!==0}},At=async t=>{let e=t?.[0]||[],o=t?.[1]["diagnostic-level"],n=t?.[1].linter||await l1();if(!n)throw new Error("No linter configuration found. Run `ultracite init` to set up a linter.");switch(n){case"eslint":{let s=await P2(e),r=await j2(e),a=await E2(e);return{hasErrors:s.hasErrors||r.hasErrors||a.hasErrors}}case"oxlint":{let s=await I2(e,t?.[1]["no-error-on-unmatched-pattern"]),r=await A2(e,t?.[1]["type-aware"],t?.[1]["type-check"]);return{hasErrors:s.hasErrors||r.hasErrors}}default:return S2(e,o,t?.[1]["error-on-warnings"])}};import{spawnSync as A1}from"child_process";import{existsSync as O}from"fs";import{readFile as d1}from"fs/promises";import{join as B}from"path";import w from"process";import{intro as O2,log as f1,outro as E1,spinner as B2}from"@clack/prompts";import{parse as It}from"jsonc-parser";import{detectPackageManager as m1,dlxCommand as p1}from"nypm";var F2=[".prettierrc",".prettierrc.js",".prettierrc.cjs",".prettierrc.mjs",".prettierrc.json",".prettierrc.yaml",".prettierrc.yml","prettier.config.js","prettier.config.mjs","prettier.config.cjs"],$2=[".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"],_2=async()=>{let e=(await m1(w.cwd()))?.name||"npm",o=p1(e,"@biomejs/biome",{args:["--version"],short:e==="npm"}),i=A1(o,{shell:!0,encoding:"utf-8"});return i.status===0&&i.stdout?{name:"Biome installation",status:"pass",message:`Biome is installed (${i.stdout.trim()})`}:{name:"Biome installation",status:"fail",message:"Biome is not installed or not accessible"}},L2=async()=>{let e=(await m1(w.cwd()))?.name||"npm",o=p1(e,"eslint",{args:["--version"],short:e==="npm"}),i=A1(o,{shell:!0,encoding:"utf-8"});return i.status===0&&i.stdout?{name:"ESLint installation",status:"pass",message:`ESLint is installed (${i.stdout.trim()})`}:{name:"ESLint installation",status:"warn",message:"ESLint is not installed (optional)"}},U2=async()=>{let e=(await m1(w.cwd()))?.name||"npm",o=p1(e,"oxlint",{args:["--version"],short:e==="npm"}),i=A1(o,{shell:!0,encoding:"utf-8"});return i.status===0&&i.stdout?{name:"Oxlint installation",status:"pass",message:`Oxlint is installed (${i.stdout.trim()})`}:{name:"Oxlint installation",status:"warn",message:"Oxlint is not installed (optional)"}},D2=async()=>{let t=B(w.cwd(),"biome.json"),e=B(w.cwd(),"biome.jsonc"),o=null;if(O(t)?o=t:O(e)&&(o=e),!o)return{name:"Biome configuration",status:"warn",message:"No biome.json or biome.jsonc file found"};try{let i=await d1(o,"utf-8"),n=It(i);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"}}},R2=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 o of t){let i=B(w.cwd(),o);if(O(i)){e=i;break}}if(!e)return{name:"ESLint configuration",status:"warn",message:"No eslint.config.* file found (optional)"};try{return(await d1(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"}}},N2=t=>`./node_modules/ultracite/config/oxlint/${t}/.oxlintrc.json`,T2=async()=>{let t=B(w.cwd(),".oxlintrc.json");if(!O(t))return{name:"Oxlint configuration",status:"warn",message:"No .oxlintrc.json file found (optional)"};try{let e=await d1(t,"utf-8"),o=It(e);return Array.isArray(o?.extends)&&o.extends.includes(N2("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"}}},G2=async()=>{let t=B(w.cwd(),"package.json");if(!O(t))return{name:"Ultracite dependency",status:"warn",message:"No package.json found"};try{let e=JSON.parse(await d1(t,"utf-8")),o=e.dependencies?.ultracite||e.devDependencies?.ultracite||e.peerDependencies?.ultracite;return o?{name:"Ultracite dependency",status:"pass",message:`Ultracite is in package.json (${o})`}:{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"}}},M2=()=>{let t=F2.some(i=>O(B(w.cwd(),i))),o=$2.filter(i=>!i.startsWith("eslint.config")).some(i=>O(B(w.cwd(),i)));if(t||o){let i=[];return t&&i.push("Prettier"),o&&i.push("ESLint (legacy config)"),{name:"Conflicting tools",status:"warn",message:`Found potentially conflicting tools: ${i.join(", ")}`}}return{name:"Conflicting tools",status:"pass",message:"No conflicting formatting/linting tools found"}},P=async(t,e)=>{let o=B2();o.start(`Checking ${e}...`);let i=await t();return i.status==="pass"||i.status,o.stop(i.message),i},Ot=async()=>{O2(`Ultracite v${k.version} Doctor`);let e=(await m1(w.cwd()))?.name||"npm",o=p1(e,"ultracite",{args:["init"],short:e==="npm"}),i=[];i.push(await P(_2,"Biome installation")),i.push(await P(L2,"ESLint installation")),i.push(await P(U2,"Oxlint installation")),i.push(await P(D2,"Biome configuration")),i.push(await P(R2,"ESLint configuration")),i.push(await P(T2,"Oxlint configuration")),i.push(await P(G2,"Ultracite dependency")),i.push(await P(M2,"conflicting tools"));let n=i.filter(a=>a.status==="pass").length,s=i.filter(a=>a.status==="fail").length,r=i.filter(a=>a.status==="warn").length;if(f1.info(`Summary: ${n} passed, ${r} warnings, ${s} failed`),s>0)throw f1.error(`Some checks failed. Run '${o}' to fix issues.`),E1("Doctor complete"),new Error("Doctor checks failed");if(r>0){f1.warn(`Some optional improvements available. Run '${o}' to configure.`),E1("Doctor complete");return}f1.success("Everything looks good!"),E1("Doctor complete")};m();import{spawnSync as M}from"child_process";import J from"process";import{detectPackageManager as H,dlxCommand as W}from"nypm";var J2=async(t,e,o)=>{let i=["check","--write","--no-errors-on-unmatched"];e&&i.push("--unsafe"),o&&i.push("--error-on-warnings"),t.length>0?i.push(...u(t)):i.push("./");let s=(await H(J.cwd()))?.name||"npm",r=W(s,"@biomejs/biome",{args:i,short:s==="npm"}),a=M(r,{stdio:"inherit",shell:!0});if(a.error)throw new Error(`Failed to run Biome: ${a.error.message}`);return{hasErrors:a.status!==0}},H2=async t=>{let e=["--fix",...t.length>0?u(t):["."]],i=(await H(J.cwd()))?.name||"npm",n=W(i,"eslint",{args:e,short:i==="npm"}),s=M(n,{stdio:"inherit",shell:!0});if(s.error)throw new Error(`Failed to run ESLint: ${s.error.message}`);return{hasErrors:s.status!==0}},W2=async t=>{let e=["--write",...t.length>0?u(t):["."]],i=(await H(J.cwd()))?.name||"npm",n=W(i,"prettier",{args:e,short:i==="npm"}),s=M(n,{stdio:"inherit",shell:!0});if(s.error)throw new Error(`Failed to run Prettier: ${s.error.message}`);return{hasErrors:s.status!==0}},V2=async t=>{let e=["--fix",...t.length>0?u(t):["."]],i=(await H(J.cwd()))?.name||"npm",n=W(i,"stylelint",{args:e,short:i==="npm"}),s=M(n,{stdio:"inherit",shell:!0});if(s.error)throw new Error(`Failed to run Stylelint: ${s.error.message}`);return{hasErrors:s.status!==0}},X2=async(t,e,o,i)=>{let n=[i?"--fix-dangerously":"--fix"];e&&n.push("--type-aware"),o&&n.push("--type-check"),n.push(...t.length>0?u(t):["."]);let r=(await H(J.cwd()))?.name||"npm",a=W(r,"oxlint",{args:n,short:r==="npm"}),f=M(a,{stdio:"inherit",shell:!0});if(f.error)throw new Error(`Failed to run Oxlint: ${f.error.message}`);return{hasErrors:f.status!==0}},Q2=async t=>{let e=["--write",...t.length>0?u(t):["."]],i=(await H(J.cwd()))?.name||"npm",n=W(i,"oxfmt",{args:e,short:i==="npm"}),s=M(n,{stdio:"inherit",shell:!0});if(s.error)throw new Error(`Failed to run oxfmt: ${s.error.message}`);return{hasErrors:s.status!==0}},Bt=async(t,e={})=>{let o=e.linter||await l1();if(!o)throw new Error("No linter configuration found. Run `ultracite init` to set up a linter.");switch(o){case"eslint":{let i=await W2(t),n=await H2(t),s=await V2(t);return{hasErrors:i.hasErrors||n.hasErrors||s.hasErrors}}case"oxlint":{let i=await Q2(t),n=await X2(t,e["type-aware"],e["type-check"],e.unsafe);return{hasErrors:i.hasErrors||n.hasErrors}}default:return J2(t,e.unsafe,e["error-on-warnings"])}};import so from"process";import{cancel as K,intro as ro,isCancel as Y,log as C1,multiselect as o1,select as ao,spinner as g}from"@clack/prompts";import{addDevDependency as co,detectPackageManager as lo}from"nypm";import{readFile as K2,writeFile as I1}from"fs/promises";var Ft=(t,e)=>`# Ultracite Code Standards
172
172
 
173
173
  This project uses **Ultracite**, a zero-config preset that enforces strict code quality standards through automated formatting and linting.
174
174
 
@@ -310,4 +310,4 @@ ${JSON.stringify(te,null,2)}
310
310
  ${JSON.stringify(i,null,2)}
311
311
  `;await qt(x1,n)}};m();import{readFile as T3,writeFile as ee}from"fs/promises";import G3 from"deepmerge";import{parse as M3}from"jsonc-parser";var y1="./.oxlintrc.json",Q=t=>`./node_modules/ultracite/config/oxlint/${t}/.oxlintrc.json`,oe={$schema:"./node_modules/oxlint/configuration_schema.json",extends:[Q("core")]},k1={exists:async()=>await l(y1),create:async t=>{let e=[Q("core")];if(t?.frameworks&&t.frameworks.length>0)for(let i of t.frameworks)e.push(Q(i));let o={...oe,extends:e};return await ee(y1,JSON.stringify(o,null,2))},update:async t=>{let e=await T3(y1,"utf-8"),i=M3(e)||{},n=i.extends&&Array.isArray(i.extends)?i.extends:[],s=p=>n.some(y=>y===Q(p)),r=[...n];if(s("core")||r.push(Q("core")),t?.frameworks&&t.frameworks.length>0)for(let p of t.frameworks)s(p)||r.push(Q(p));i.extends=r;let a={$schema:oe.$schema},f=G3(i,a);await ee(y1,JSON.stringify(f,null,2))}};m();import{readFile as J3,writeFile as ie}from"fs/promises";var H3=["./.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"],ne="./prettier.config.mjs",W3=async()=>{try{return"prettier"in JSON.parse(await J3("./package.json","utf-8"))}catch{return!1}},V3=async()=>{if(await W3())return"./package.json";for(let t of H3)if(await l(t))return t;return null},se=()=>`export { default } from "ultracite/prettier";
312
312
  `,b1={exists:async()=>await V3()!==null,create:async()=>{let t=se();await ie(ne,t)},update:async()=>{let t=se();await ie(ne,t)}};m();import{readFile as X3,writeFile as re}from"fs/promises";var Q3=["./.stylelintrc.mjs","./stylelint.config.mjs","./.stylelintrc.cjs","./stylelint.config.cjs","./.stylelintrc.js","./stylelint.config.js","./.stylelintrc","./.stylelintrc.json","./.stylelintrc.yml","./.stylelintrc.yaml"],ae="./stylelint.config.mjs",K3=async()=>{try{return"stylelint"in JSON.parse(await X3("./package.json","utf-8"))}catch{return!1}},Y3=async()=>{if(await K3())return"./package.json";for(let t of Q3)if(await l(t))return t;return null},ce=()=>`export { default } from "ultracite/stylelint";
313
- `,z1={exists:async()=>await Y3()!==null,create:async()=>{let t=ce();await re(ae,t)},update:async()=>{let t=ce();await re(ae,t)}};import{readFile as Z3,writeFile as le}from"fs/promises";import{glob as q3}from"glob";import{applyEdits as to,modify as eo,parse as oo}from"jsonc-parser";var fe=async()=>{try{return await q3("**/tsconfig*.json",{ignore:["**/node_modules/**","**/dist/**","**/build/**","**/.next/**"],absolute:!1})}catch{return[]}},io=t=>{if(!t)return!1;let e=t.compilerOptions;return e?e.strict===!0||e.strictNullChecks===!0:!1},no=async t=>{try{let e=await Z3(t,"utf-8"),o=oo(e);if(io(o))return;if(o===void 0){await le(t,JSON.stringify({compilerOptions:{strictNullChecks:!0}},null,2));return}let n=eo(e,["compilerOptions","strictNullChecks"],!0,{formattingOptions:{tabSize:2,insertSpaces:!0}}),s=to(e,n);await le(t,s)}catch(e){console.warn(`Failed to update ${t}:`,e)}},M1={exists:async()=>(await fe()).length>0,update:async()=>{let t=await fe();if(t.length===0){console.warn("No tsconfig.json files found in the project");return}await Promise.all(t.map(e=>no(e)))}};m();var de=k.devDependencies["@biomejs/biome"],J1=k.version,fo=async(t,e="biome",o=!0,i=!1,n=!1)=>{let s=g();i||s.start("Installing dependencies...");let r=[`ultracite@${J1}`];if(e==="biome"&&r.push(`@biomejs/biome@${de}`),e==="eslint"&&(r.push("eslint@latest"),r.push("prettier@latest"),r.push("stylelint@latest")),e==="oxlint"&&(r.push("oxlint@latest"),r.push("oxfmt@latest"),n&&r.push("oxlint-tsgolint@latest")),o)for(let a of r)await co(a,{packageManager:t,workspace:await j(),silent:!0});else{let a={ultracite:J1};e==="biome"&&(a["@biomejs/biome"]=de),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 b({devDependencies:a})}i||s.stop("Dependencies installed.")},mo=async(t=!1)=>{let e=g();if(t||e.start("Checking for tsconfig.json files..."),await M1.exists()){t||e.message("Found tsconfig.json files, updating with strictNullChecks..."),await M1.update(),t||e.stop("tsconfig.json files updated.");return}t||e.stop("No tsconfig.json files found, skipping.")},po=async(t,e="biome",o=!1)=>{let i=S.find(r=>r.id===t);if(!i)throw new Error(`Editor "${t}" not found`);let n=_t(t,e),s=g();if(o||s.start(`Checking for ${i.config.path}...`),await n.exists()){o||s.message(`${i.config.path} found, updating...`),await n.update(),o||s.stop(`${i.config.path} updated.`);return}if(o||s.message(`${i.config.path} not found, creating...`),await n.create(),n.extension){let r=D.find(a=>a.id===e)?.vscodeExtensionId;if(!r)throw new Error(`Linter extension not found for ${e}`);o||s.message(`Installing ${r} extension...`);try{if(n.extension(r).status===0){o||s.stop(`${i.config.path} created and ${r} extension installed.`);return}}catch{}o||s.stop(`${i.config.path} created. Install ${r} extension manually.`);return}o||(t==="zed"?s.stop(`${i.config.path} created. Install the Biome extension: https://biomejs.dev/reference/zed/`):s.stop(`${i.config.path} created.`))},go=async(t,e=!1)=>{let o=g();if(e||o.start("Checking for Biome configuration..."),await u1.exists()){e||o.message("Biome configuration found, updating..."),await u1.update({frameworks:t}),e||o.stop("Biome configuration updated.");return}e||o.message("Biome configuration not found, creating..."),await u1.create({frameworks:t}),e||o.stop("Biome configuration created.")},ho=async(t,e=!1)=>{let o=g();if(e||o.start("Checking for ESLint configuration..."),await w1.exists()){e||o.message("ESLint configuration found, updating..."),await w1.update({frameworks:t}),e||o.stop("ESLint configuration updated.");return}e||o.message("ESLint configuration not found, creating..."),await w1.create({frameworks:t}),e||o.stop("ESLint configuration created.")},uo=async(t,e=!1)=>{let o=g();if(e||o.start("Checking for Oxlint configuration..."),await k1.exists()){e||o.message("Oxlint configuration found, updating..."),await k1.update({frameworks:t}),e||o.stop("Oxlint configuration updated.");return}e||o.message("Oxlint configuration not found, creating..."),await k1.create({frameworks:t}),e||o.stop("Oxlint configuration created.")},wo=async(t=!1)=>{let e=g();if(t||e.start("Checking for Prettier configuration..."),await b1.exists()){t||e.message("Prettier configuration found, updating..."),await b1.update(),t||e.stop("Prettier configuration updated.");return}t||e.message("Prettier configuration not found, creating..."),await b1.create(),t||e.stop("Prettier configuration created.")},xo=async(t=!1)=>{let e=g();if(t||e.start("Checking for Stylelint configuration..."),await z1.exists()){t||e.message("Stylelint configuration found, updating..."),await z1.update(),t||e.stop("Stylelint configuration updated.");return}t||e.message("Stylelint configuration not found, creating..."),await z1.create(),t||e.stop("Stylelint configuration created.")},vo=async(t=!1)=>{let e=g();if(t||e.start("Checking for oxfmt configuration..."),await v1.exists()){t||e.message("oxfmt configuration found, updating..."),await v1.update(),t||e.stop("oxfmt configuration updated.");return}t||e.message("oxfmt configuration not found, creating..."),await v1.create(),t||e.stop("oxfmt configuration created.")},yo=async(t,e=!0,o=!1)=>{let i=g();if(o||(i.start("Initializing pre-commit hooks..."),i.message("Installing Husky...")),e?await F.install(t):await b({devDependencies:{husky:"latest"},scripts:{prepare:"husky"}}),o||i.message("Initializing Husky..."),F.init(t),await F.exists()){o||i.message("Pre-commit hook found, updating..."),await F.update(t),o||i.stop("Pre-commit hook updated.");return}o||i.message("Pre-commit hook not found, creating..."),await F.create(t),o||i.stop("Pre-commit hook created.")},ko=async(t,e=!0,o=!1)=>{let i=g();if(o||(i.start("Initializing lefthook..."),i.message("Installing lefthook...")),e?await V.install(t):await b({devDependencies:{lefthook:"latest"}}),await V.exists()){o||i.message("lefthook.yml found, updating..."),await V.update(t),o||i.stop("lefthook.yml updated.");return}o||i.message("lefthook.yml not found, creating..."),await V.create(t),o||i.stop("lefthook.yml created.")},bo=async(t,e=!0,o=!1)=>{let i=g();if(o||(i.start("Initializing lint-staged..."),i.message("Installing lint-staged...")),e?await X.install(t):await b({devDependencies:{"lint-staged":"latest"}}),await X.exists()){o||i.message("lint-staged found, updating..."),await X.update(t),o||i.stop("lint-staged updated.");return}o||i.message("lint-staged not found, creating..."),await X.create(t),o||i.stop("lint-staged created.")},zo=async(t,e=!1)=>{let o=g();if(e||o.start("Initializing pre-commit..."),await t1.exists()){e||o.message(".pre-commit-config.yaml found, updating..."),await t1.update(t),e||o.stop(".pre-commit-config.yaml updated.");return}e||o.message(".pre-commit-config.yaml not found, creating..."),await t1.create(t),e||o.stop(".pre-commit-config.yaml created.")},Co=async(t,e,o,i,n=!1)=>{let s=g();n||s.start(`Checking for ${e}...`);let r=$t(t,o,i);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.`)},So=async(t,e,o=!1)=>{let i=g(),n=I.find(r=>r.id===t)?.name??t;o||i.start(`Checking for ${n} hooks...`);let s=Lt(t,e);if(await s.exists()){o||i.message(`${n} hooks found, updating...`),await s.update(),o||i.stop(`${n} hooks updated.`);return}o||i.message(`${n} hooks not found, creating...`),await s.create(),o||i.stop(`${n} hooks created.`)},me=async t=>{let e=t??{},o=e.quiet??!1;o||ro(`Ultracite v${J1} Initialization`);try{let{pm:i}=e;if(!i){let d=await lo(so.cwd());if(!d)throw new Error("No package manager specified or detected");if(!o&&d.warnings)for(let h of d.warnings)C1.warn(h);o||C1.info(`Detected lockfile, using ${d.name}`),i=d.name}let n=e.linter;if(n===void 0)if(o||e.pm||e.editors||e.agents||e.hooks||e.integrations!==void 0||e.frameworks!==void 0)n="biome";else{let h=await ao({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(Y(h)){K("Operation cancelled.");return}n=h}let s=e.frameworks;if(s===void 0)if(o||e.pm||e.editors||e.agents||e.hooks||e.integrations!==void 0)s=[];else{let h=await o1({message:"Which frameworks are you using (optional)?",options:[{label:"React",value:"react"},{label:"Next.js",value:"next"},{label:"Solid",value:"solid"},{label:"Vue",value:"vue"},{label:"Svelte",value:"svelte"},{label:"Qwik",value:"qwik"},{label:"Angular",value:"angular"},{label:"Remix / TanStack Router / React Router",value:"remix"},{label:"Astro",value:"astro"}],required:!1});if(Y(h)){K("Operation cancelled.");return}s=h}let r=e.editors;if(!r)if(o)r=[];else{let d=await o1({message:"Which editors do you want to configure (recommended)?",options:[{label:"VSCode / Cursor / Windsurf",value:"vscode"},{label:"Zed",value:"zed"}],required:!1});if(Y(d)){K("Operation cancelled.");return}r=d}let a=e.agents,f=e.hooks,p=Object.fromEntries(C.map(d=>[d.id,d.name]));if(!a)if(o)a=[];else{let d=await o1({message:"Which agents do you want to enable (optional)?",options:Object.entries(p).map(([h,S1])=>({value:h,label:S1})),required:!1});if(Y(d)){K("Operation cancelled.");return}a=d}let y=Object.fromEntries(I.map(d=>[d.id,d.name]));if(!f)if(o)f=[];else{let d=await o1({message:"Which agent hooks do you want to enable (optional)?",options:Object.entries(y).map(([h,S1])=>({value:h,label:S1})),required:!1});if(Y(d)){K("Operation cancelled.");return}f=d}let x=e.integrations;if(x===void 0)if(o||e.pm||e.editors||e.agents||e.hooks)x=[];else{let h=await o1({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(Y(h)){K("Operation cancelled.");return}x=h}await fo(i,n,!e.skipInstall,o,n==="oxlint"&&e["type-aware"]),await mo(o),n==="biome"&&await go(s,o),n==="eslint"&&(await ho(s,o),await wo(o),await xo(o)),n==="oxlint"&&(await uo(s,o),await vo(o));for(let d of r??[])await po(d,n,o);for(let d of a??[])await Co(d,p[d],i,n,o);for(let d of f??[])await So(d,i,o);x?.includes("husky")&&await yo(i,!e.skipInstall,o),x?.includes("lefthook")&&await ko(i,!e.skipInstall,o),x?.includes("lint-staged")&&await bo(i,!e.skipInstall,o),x?.includes("pre-commit")&&await zo(i,o),o||C1.success("Successfully initialized Ultracite! Make sure to check out ultracite.ai/cloud for our pro version.")}catch(i){let n=i instanceof Error?i.message:"Unknown error";throw o||C1.error(`Failed to initialize Ultracite configuration: ${n}`),i}};var i1=jo.meta().create(),Ao=i1.router({init:i1.procedure.meta({description:"Initialize Ultracite in the current directory"}).input(c.object({pm:c.enum(Po.map(t=>t.name)).optional().describe("Package manager to use"),linter:c.enum(v.linters).optional().describe("Linter / formatter to use"),editors:c.array(c.enum(v.editorConfigs)).optional().describe("Editors to configure"),agents:c.array(c.enum(v.agents)).optional().describe("Agents to enable"),hooks:c.array(c.enum(v.hooks)).optional().describe("Hooks to enable"),frameworks:c.array(c.enum(v.frameworks)).optional().describe("Frameworks being used"),integrations:c.array(c.enum(v.integrations)).optional().describe("Additional integrations to enable"),migrate:c.array(c.enum(v.migrations)).optional().describe("Migration tools to remove (e.g., eslint, prettier). Removes dependencies, config files, and editor settings."),"type-aware":c.boolean().optional().describe("enable type-aware linting (oxlint only, installs oxlint-tsgolint)"),skipInstall:c.boolean().default(!1).describe("Skip installing dependencies"),quiet:c.boolean().default(process.env.CI==="true"||process.env.CI==="1").describe("Suppress all interactive prompts and visual output. Automatically enabled in CI environments.")})).mutation(async({input:t})=>{await me(t)}),check:i1.procedure.meta({description:"Run linter without fixing files"}).input(c.tuple([c.array(c.string()).optional().default([]).describe("specific files to lint"),c.object({"diagnostic-level":c.enum(["info","warn","error"]).optional().describe("level of diagnostics to show. In order, from the lowest to the most important: info, warn, error."),linter:c.enum(v.linters).optional().describe("linter to use (biome, eslint, or oxlint)"),"type-aware":c.boolean().optional().describe("enable type-aware linting rules (oxlint only)"),"type-check":c.boolean().optional().describe("enable TypeScript compiler diagnostics (oxlint only)"),"no-error-on-unmatched-pattern":c.boolean().optional().describe("suppress errors when files don't match patterns (useful for hooks/CI)"),"error-on-warnings":c.boolean().optional().describe("treat warnings as errors (biome only)")})]).optional()).query(async({input:t})=>{await At(t)}),fix:i1.procedure.meta({description:"Run linter and fix files"}).input(c.tuple([c.array(c.string()).optional().default([]).describe("specific files to format"),c.object({unsafe:c.boolean().optional().describe("apply unsafe fixes"),linter:c.enum(v.linters).optional().describe("linter to use (biome, eslint, or oxlint)"),"type-aware":c.boolean().optional().describe("enable type-aware linting rules (oxlint only)"),"type-check":c.boolean().optional().describe("enable TypeScript compiler diagnostics (oxlint only)"),"error-on-warnings":c.boolean().optional().describe("treat warnings as errors (biome only)")})]).optional()).mutation(async({input:t})=>{let[e,o]=t??[[],{}];await Bt(e,{unsafe:o.unsafe,linter:o.linter,"type-aware":o["type-aware"],"type-check":o["type-check"],"error-on-warnings":o["error-on-warnings"]})}),doctor:i1.procedure.meta({description:"Verify your Ultracite setup and check for issues"}).query(async()=>{await Ot()})}),Io=Eo({router:Ao,name:k.name,version:k.version,description:k.description});process.env.TEST||Io.run();export{Ao as router};
313
+ `,z1={exists:async()=>await Y3()!==null,create:async()=>{let t=ce();await re(ae,t)},update:async()=>{let t=ce();await re(ae,t)}};import{readFile as Z3,writeFile as le}from"fs/promises";import{glob as q3}from"glob";import{applyEdits as to,modify as eo,parse as oo}from"jsonc-parser";var fe=async()=>{try{return await q3("**/tsconfig*.json",{ignore:["**/node_modules/**","**/dist/**","**/build/**","**/.next/**"],absolute:!1})}catch{return[]}},io=t=>{if(!t)return!1;let e=t.compilerOptions;return e?e.strict===!0||e.strictNullChecks===!0:!1},no=async t=>{try{let e=await Z3(t,"utf-8"),o=oo(e);if(io(o))return;if(o===void 0){await le(t,JSON.stringify({compilerOptions:{strictNullChecks:!0}},null,2));return}let n=eo(e,["compilerOptions","strictNullChecks"],!0,{formattingOptions:{tabSize:2,insertSpaces:!0}}),s=to(e,n);await le(t,s)}catch(e){console.warn(`Failed to update ${t}:`,e)}},M1={exists:async()=>(await fe()).length>0,update:async()=>{let t=await fe();if(t.length===0){console.warn("No tsconfig.json files found in the project");return}await Promise.all(t.map(e=>no(e)))}};m();var de=k.devDependencies["@biomejs/biome"],J1=k.version,fo=async(t,e="biome",o=!0,i=!1,n=!1)=>{let s=g();i||s.start("Installing dependencies...");let r=[`ultracite@${J1}`];if(e==="biome"&&r.push(`@biomejs/biome@${de}`),e==="eslint"&&(r.push("eslint@latest"),r.push("prettier@latest"),r.push("stylelint@latest")),e==="oxlint"&&(r.push("oxlint@latest"),r.push("oxfmt@latest"),n&&r.push("oxlint-tsgolint@latest")),o)for(let a of r)await co(a,{packageManager:t,workspace:await j(),silent:!0});else{let a={ultracite:J1};e==="biome"&&(a["@biomejs/biome"]=de),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 b({devDependencies:a})}i||s.stop("Dependencies installed.")},mo=async(t=!1)=>{let e=g();if(t||e.start("Checking for tsconfig.json files..."),await M1.exists()){t||e.message("Found tsconfig.json files, updating with strictNullChecks..."),await M1.update(),t||e.stop("tsconfig.json files updated.");return}t||e.stop("No tsconfig.json files found, skipping.")},po=async(t,e="biome",o=!1)=>{let i=S.find(r=>r.id===t);if(!i)throw new Error(`Editor "${t}" not found`);let n=_t(t,e),s=g();if(o||s.start(`Checking for ${i.config.path}...`),await n.exists()){o||s.message(`${i.config.path} found, updating...`),await n.update(),o||s.stop(`${i.config.path} updated.`);return}if(o||s.message(`${i.config.path} not found, creating...`),await n.create(),n.extension){let r=D.find(a=>a.id===e)?.vscodeExtensionId;if(!r)throw new Error(`Linter extension not found for ${e}`);o||s.message(`Installing ${r} extension...`);try{if(n.extension(r).status===0){o||s.stop(`${i.config.path} created and ${r} extension installed.`);return}}catch{}o||s.stop(`${i.config.path} created. Install ${r} extension manually.`);return}o||(t==="zed"?s.stop(`${i.config.path} created. Install the Biome extension: https://biomejs.dev/reference/zed/`):s.stop(`${i.config.path} created.`))},go=async(t,e=!1)=>{let o=g();if(e||o.start("Checking for Biome configuration..."),await u1.exists()){e||o.message("Biome configuration found, updating..."),await u1.update({frameworks:t}),e||o.stop("Biome configuration updated.");return}e||o.message("Biome configuration not found, creating..."),await u1.create({frameworks:t}),e||o.stop("Biome configuration created.")},ho=async(t,e=!1)=>{let o=g();if(e||o.start("Checking for ESLint configuration..."),await w1.exists()){e||o.message("ESLint configuration found, updating..."),await w1.update({frameworks:t}),e||o.stop("ESLint configuration updated.");return}e||o.message("ESLint configuration not found, creating..."),await w1.create({frameworks:t}),e||o.stop("ESLint configuration created.")},uo=async(t,e=!1)=>{let o=g();if(e||o.start("Checking for Oxlint configuration..."),await k1.exists()){e||o.message("Oxlint configuration found, updating..."),await k1.update({frameworks:t}),e||o.stop("Oxlint configuration updated.");return}e||o.message("Oxlint configuration not found, creating..."),await k1.create({frameworks:t}),e||o.stop("Oxlint configuration created.")},wo=async(t=!1)=>{let e=g();if(t||e.start("Checking for Prettier configuration..."),await b1.exists()){t||e.message("Prettier configuration found, updating..."),await b1.update(),t||e.stop("Prettier configuration updated.");return}t||e.message("Prettier configuration not found, creating..."),await b1.create(),t||e.stop("Prettier configuration created.")},xo=async(t=!1)=>{let e=g();if(t||e.start("Checking for Stylelint configuration..."),await z1.exists()){t||e.message("Stylelint configuration found, updating..."),await z1.update(),t||e.stop("Stylelint configuration updated.");return}t||e.message("Stylelint configuration not found, creating..."),await z1.create(),t||e.stop("Stylelint configuration created.")},vo=async(t=!1)=>{let e=g();if(t||e.start("Checking for oxfmt configuration..."),await v1.exists()){t||e.message("oxfmt configuration found, updating..."),await v1.update(),t||e.stop("oxfmt configuration updated.");return}t||e.message("oxfmt configuration not found, creating..."),await v1.create(),t||e.stop("oxfmt configuration created.")},yo=async(t,e=!0,o=!1)=>{let i=g();if(o||(i.start("Initializing pre-commit hooks..."),i.message("Installing Husky...")),e?await F.install(t):await b({devDependencies:{husky:"latest"},scripts:{prepare:"husky"}}),o||i.message("Initializing Husky..."),F.init(t),await F.exists()){o||i.message("Pre-commit hook found, updating..."),await F.update(t),o||i.stop("Pre-commit hook updated.");return}o||i.message("Pre-commit hook not found, creating..."),await F.create(t),o||i.stop("Pre-commit hook created.")},ko=async(t,e=!0,o=!1)=>{let i=g();if(o||(i.start("Initializing lefthook..."),i.message("Installing lefthook...")),e?await V.install(t):await b({devDependencies:{lefthook:"latest"}}),await V.exists()){o||i.message("lefthook.yml found, updating..."),await V.update(t),o||i.stop("lefthook.yml updated.");return}o||i.message("lefthook.yml not found, creating..."),await V.create(t),o||i.stop("lefthook.yml created.")},bo=async(t,e=!0,o=!1)=>{let i=g();if(o||(i.start("Initializing lint-staged..."),i.message("Installing lint-staged...")),e?await X.install(t):await b({devDependencies:{"lint-staged":"latest"}}),await X.exists()){o||i.message("lint-staged found, updating..."),await X.update(t),o||i.stop("lint-staged updated.");return}o||i.message("lint-staged not found, creating..."),await X.create(t),o||i.stop("lint-staged created.")},zo=async(t,e=!1)=>{let o=g();if(e||o.start("Initializing pre-commit..."),await t1.exists()){e||o.message(".pre-commit-config.yaml found, updating..."),await t1.update(t),e||o.stop(".pre-commit-config.yaml updated.");return}e||o.message(".pre-commit-config.yaml not found, creating..."),await t1.create(t),e||o.stop(".pre-commit-config.yaml created.")},Co=async(t,e,o,i,n=!1)=>{let s=g();n||s.start(`Checking for ${e}...`);let r=$t(t,o,i);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.`)},So=async(t,e,o=!1)=>{let i=g(),n=I.find(r=>r.id===t)?.name??t;o||i.start(`Checking for ${n} hooks...`);let s=Lt(t,e);if(await s.exists()){o||i.message(`${n} hooks found, updating...`),await s.update(),o||i.stop(`${n} hooks updated.`);return}o||i.message(`${n} hooks not found, creating...`),await s.create(),o||i.stop(`${n} hooks created.`)},me=async t=>{let e=t??{},o=e.quiet??!1;o||ro(`Ultracite v${J1} Initialization`);try{let{pm:i}=e;if(!i){let d=await lo(so.cwd());if(!d)throw new Error("No package manager specified or detected");if(!o&&d.warnings)for(let h of d.warnings)C1.warn(h);o||C1.info(`Detected lockfile, using ${d.name}`),i=d.name}let n=e.linter;if(n===void 0)if(o||e.pm||e.editors||e.agents||e.hooks||e.integrations!==void 0||e.frameworks!==void 0)n="biome";else{let h=await ao({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(Y(h)){K("Operation cancelled.");return}n=h}let s=e.frameworks;if(s===void 0)if(o||e.pm||e.editors||e.agents||e.hooks||e.integrations!==void 0)s=[];else{let h=await o1({message:"Which frameworks are you using (optional)?",options:[{label:"React",value:"react"},{label:"Next.js",value:"next"},{label:"Solid",value:"solid"},{label:"Vue",value:"vue"},{label:"Svelte",value:"svelte"},{label:"Qwik",value:"qwik"},{label:"Angular",value:"angular"},{label:"Remix / TanStack Router / React Router",value:"remix"},{label:"Astro",value:"astro"}],required:!1});if(Y(h)){K("Operation cancelled.");return}s=h}let r=e.editors;if(!r)if(o)r=[];else{let d=await o1({message:"Which editors do you want to configure (recommended)?",options:[{label:"VSCode / Cursor / Windsurf",value:"vscode"},{label:"Zed",value:"zed"}],required:!1});if(Y(d)){K("Operation cancelled.");return}r=d}let a=e.agents,f=e.hooks,p=Object.fromEntries(C.map(d=>[d.id,d.name]));if(!a)if(o)a=[];else{let d=await o1({message:"Which agents do you want to enable (optional)?",options:Object.entries(p).map(([h,S1])=>({value:h,label:S1})),required:!1});if(Y(d)){K("Operation cancelled.");return}a=d}let y=Object.fromEntries(I.map(d=>[d.id,d.name]));if(!f)if(o)f=[];else{let d=await o1({message:"Which agent hooks do you want to enable (optional)?",options:Object.entries(y).map(([h,S1])=>({value:h,label:S1})),required:!1});if(Y(d)){K("Operation cancelled.");return}f=d}let x=e.integrations;if(x===void 0)if(o||e.pm||e.editors||e.agents||e.hooks)x=[];else{let h=await o1({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(Y(h)){K("Operation cancelled.");return}x=h}await fo(i,n,!e.skipInstall,o,n==="oxlint"&&e["type-aware"]),await mo(o),n==="biome"&&await go(s,o),n==="eslint"&&(await ho(s,o),await wo(o),await xo(o)),n==="oxlint"&&(await uo(s,o),await vo(o));for(let d of r??[])await po(d,n,o);for(let d of a??[])await Co(d,p[d],i,n,o);for(let d of f??[])await So(d,i,o);x?.includes("husky")&&await yo(i,!e.skipInstall,o),x?.includes("lefthook")&&await ko(i,!e.skipInstall,o),x?.includes("lint-staged")&&await bo(i,!e.skipInstall,o),x?.includes("pre-commit")&&await zo(i,o),o||C1.success("Successfully initialized Ultracite! Make sure to check out ultracite.ai/cloud for our pro version.")}catch(i){let n=i instanceof Error?i.message:"Unknown error";throw o||C1.error(`Failed to initialize Ultracite configuration: ${n}`),i}};var i1=jo.meta().create(),Ao=i1.router({init:i1.procedure.meta({description:"Initialize Ultracite in the current directory"}).input(c.object({pm:c.enum(Po.map(t=>t.name)).optional().describe("Package manager to use"),linter:c.enum(v.linters).optional().describe("Linter / formatter to use"),editors:c.array(c.enum(v.editorConfigs)).optional().describe("Editors to configure"),agents:c.array(c.enum(v.agents)).optional().describe("Agents to enable"),hooks:c.array(c.enum(v.hooks)).optional().describe("Hooks to enable"),frameworks:c.array(c.enum(v.frameworks)).optional().describe("Frameworks being used"),integrations:c.array(c.enum(v.integrations)).optional().describe("Additional integrations to enable"),migrate:c.array(c.enum(v.migrations)).optional().describe("Migration tools to remove (e.g., eslint, prettier). Removes dependencies, config files, and editor settings."),"type-aware":c.boolean().optional().describe("enable type-aware linting (oxlint only, installs oxlint-tsgolint)"),skipInstall:c.boolean().default(!1).describe("Skip installing dependencies"),quiet:c.boolean().default(process.env.CI==="true"||process.env.CI==="1").describe("Suppress all interactive prompts and visual output. Automatically enabled in CI environments.")})).mutation(async({input:t})=>{await me(t)}),check:i1.procedure.meta({description:"Run linter without fixing files"}).input(c.tuple([c.array(c.string()).optional().default([]).describe("specific files to lint"),c.object({"diagnostic-level":c.enum(["info","warn","error"]).optional().describe("level of diagnostics to show. In order, from the lowest to the most important: info, warn, error."),linter:c.enum(v.linters).optional().describe("linter to use (biome, eslint, or oxlint)"),"type-aware":c.boolean().optional().describe("enable type-aware linting rules (oxlint only)"),"type-check":c.boolean().optional().describe("enable TypeScript compiler diagnostics (oxlint only)"),"no-error-on-unmatched-pattern":c.boolean().optional().describe("suppress errors when files don't match patterns (useful for hooks/CI)"),"error-on-warnings":c.boolean().optional().describe("treat warnings as errors (biome only)")})]).optional()).query(async({input:t})=>{if((await At(t)).hasErrors)throw new Error("Lint errors found")}),fix:i1.procedure.meta({description:"Run linter and fix files"}).input(c.tuple([c.array(c.string()).optional().default([]).describe("specific files to format"),c.object({unsafe:c.boolean().optional().describe("apply unsafe fixes"),linter:c.enum(v.linters).optional().describe("linter to use (biome, eslint, or oxlint)"),"type-aware":c.boolean().optional().describe("enable type-aware linting rules (oxlint only)"),"type-check":c.boolean().optional().describe("enable TypeScript compiler diagnostics (oxlint only)"),"error-on-warnings":c.boolean().optional().describe("treat warnings as errors (biome only)")})]).optional()).mutation(async({input:t})=>{let[e,o]=t??[[],{}];if((await Bt(e,{unsafe:o.unsafe,linter:o.linter,"type-aware":o["type-aware"],"type-check":o["type-check"],"error-on-warnings":o["error-on-warnings"]})).hasErrors)throw new Error("Lint errors found")}),doctor:i1.procedure.meta({description:"Verify your Ultracite setup and check for issues"}).query(async()=>{await Ot()})}),Io=Eo({router:Ao,name:k.name,version:k.version,description:k.description});process.env.TEST||Io.run();export{Ao as router};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ultracite",
3
3
  "description": "The AI-ready formatter that helps you write and generate code faster.",
4
- "version": "7.0.10",
4
+ "version": "7.0.11",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "ultracite": "dist/index.js"
@@ -53,18 +53,18 @@
53
53
  "@repo/data": "workspace:*",
54
54
  "@tanstack/eslint-plugin-query": "^5.91.2",
55
55
  "@types/node": "^25.0.3",
56
- "@typescript-eslint/eslint-plugin": "^8.51.0",
57
- "@typescript-eslint/parser": "^8.51.0",
56
+ "@typescript-eslint/eslint-plugin": "^8.52.0",
57
+ "@typescript-eslint/parser": "^8.52.0",
58
58
  "eslint-config-prettier": "^10.1.8",
59
59
  "eslint-import-resolver-typescript": "^4.4.4",
60
60
  "eslint-plugin-angular": "^5.0.0",
61
61
  "eslint-plugin-astro": "^1.5.0",
62
62
  "eslint-plugin-compat": "^6.0.2",
63
- "eslint-plugin-cypress": "^5.2.0",
63
+ "eslint-plugin-cypress": "^5.2.1",
64
64
  "eslint-plugin-github": "6.0.0",
65
65
  "eslint-plugin-html": "^8.1.3",
66
66
  "eslint-plugin-import": "^2.32.0",
67
- "eslint-plugin-jest": "^29.12.0",
67
+ "eslint-plugin-jest": "^29.12.1",
68
68
  "eslint-plugin-jsx-a11y": "^6.10.2",
69
69
  "eslint-plugin-n": "^17.23.1",
70
70
  "eslint-plugin-prettier": "^5.5.4",
@@ -76,17 +76,18 @@
76
76
  "eslint-plugin-solid": "^0.14.5",
77
77
  "eslint-plugin-sonarjs": "^3.0.5",
78
78
  "eslint-plugin-storybook": "^10.1.11",
79
- "eslint-plugin-svelte": "^3.13.1",
79
+ "eslint-plugin-svelte": "^3.14.0",
80
80
  "eslint-plugin-tailwindcss": "^3.18.2",
81
81
  "eslint-plugin-unicorn": "^62.0.0",
82
82
  "eslint-plugin-unused-imports": "^4.3.0",
83
83
  "eslint-plugin-vue": "^10.6.2",
84
- "globals": "^16.5.0",
84
+ "globals": "^17.0.0",
85
85
  "prettier-plugin-tailwindcss": "^0.7.2",
86
86
  "stylelint-config-idiomatic-order": "^10.0.0",
87
87
  "stylelint-config-standard": "^39.0.1",
88
88
  "stylelint-prettier": "^5.0.3",
89
- "tsup": "^8.5.1"
89
+ "tsup": "^8.5.1",
90
+ "oxlint": "^1.38.0"
90
91
  },
91
92
  "dependencies": {
92
93
  "@clack/prompts": "^0.11.0",
@@ -95,9 +96,16 @@
95
96
  "glob": "^13.0.0",
96
97
  "jsonc-parser": "^3.3.1",
97
98
  "nypm": "^0.6.2",
98
- "oxlint": "^1.36.0",
99
- "trpc-cli": "^0.12.1",
100
- "zod": "^4.3.2"
99
+ "trpc-cli": "^0.12.2",
100
+ "zod": "^4.3.5"
101
+ },
102
+ "peerDependencies": {
103
+ "oxlint": "^1.0.0"
104
+ },
105
+ "peerDependenciesMeta": {
106
+ "oxlint": {
107
+ "optional": true
108
+ }
101
109
  },
102
110
  "packageManager": "bun@1.3.5"
103
111
  }