ultracite 7.0.6 → 7.0.7
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.d.ts +3 -0
- package/dist/index.js +45 -45
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -30,6 +30,8 @@ declare const router: _trpc_server.TRPCBuiltRouter<{
|
|
|
30
30
|
linter?: "biome" | "eslint" | "oxlint" | undefined;
|
|
31
31
|
"type-aware"?: boolean | undefined;
|
|
32
32
|
"type-check"?: boolean | undefined;
|
|
33
|
+
"no-error-on-unmatched-pattern"?: boolean | undefined;
|
|
34
|
+
"error-on-warnings"?: boolean | undefined;
|
|
33
35
|
}] | undefined;
|
|
34
36
|
output: void;
|
|
35
37
|
meta: TrpcCliMeta;
|
|
@@ -40,6 +42,7 @@ declare const router: _trpc_server.TRPCBuiltRouter<{
|
|
|
40
42
|
linter?: "biome" | "eslint" | "oxlint" | undefined;
|
|
41
43
|
"type-aware"?: boolean | undefined;
|
|
42
44
|
"type-check"?: boolean | undefined;
|
|
45
|
+
"error-on-warnings"?: boolean | undefined;
|
|
43
46
|
}] | undefined;
|
|
44
47
|
output: void;
|
|
45
48
|
meta: TrpcCliMeta;
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var
|
|
2
|
+
var C1=Object.defineProperty;var fe=Object.getOwnPropertyDescriptor;var de=Object.getOwnPropertyNames;var me=Object.prototype.hasOwnProperty;var S1=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,o)=>(typeof require<"u"?require:e)[o]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')}),M1=t=>e=>{var o=t[e];if(o)return o();throw new Error("Module not found in bundle: "+e)};var $=(t,e)=>()=>(t&&(e=t(t=0)),e);var i1=(t,e)=>{for(var o in e)C1(t,o,{get:e[o],enumerable:!0})},pe=(t,e,o,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of de(e))!me.call(t,n)&&n!==o&&C1(t,n,{get:()=>e[n],enumerable:!(i=fe(e,n))||i.enumerable});return t};var n1=t=>pe(C1({},"__esModule",{value:!0}),t);import{access as r2,mkdir as a2,readFile as St,writeFile as c2}from"fs/promises";import{dirname as l2}from"path";import{parse as f2}from"jsonc-parser";var l,C,b,d2,m2,h,z,p2,g2,u2,a1,p=$(()=>{"use strict";l=async t=>{try{return await r2(t),!0}catch{return!1}},C=async()=>{if(await l("pnpm-workspace.yaml"))return!0;try{let t=f2(await St("package.json","utf-8"));return t?!!t.workspaces||!!t.workspace:!1}catch{return!1}},b=async({dependencies:t,devDependencies:e,scripts:o})=>{let i=await St("package.json","utf8"),n=JSON.parse(i),s={...n};(n.devDependencies||e)&&(s.devDependencies={...n.devDependencies,...e}),(n.dependencies||t)&&(s.dependencies={...n.dependencies,...t}),(n.scripts||o)&&(s.scripts={...n.scripts,...o}),await c2("package.json",JSON.stringify(s,null,2))},d2=/[ $(){}[\]&|;<>!"'`*?#~]/,m2=/'/g,h=t=>t.map(e=>d2.test(e)?`'${e.replace(m2,"'\\''")}' `:e),z=async t=>{let e=l2(t);if(e!=="."){let o=e.startsWith("./")?e.slice(2):e;await a2(o,{recursive:!0})}},p2=["./biome.json","./biome.jsonc"],g2=["./eslint.config.mjs","./eslint.config.js","./eslint.config.cjs","./eslint.config.ts","./eslint.config.mts","./eslint.config.cts"],u2="./.oxlintrc.json",a1=async()=>{for(let t of p2)if(await l(t))return"biome";for(let t of g2)if(await l(t))return"eslint";return await l(u2)?"oxlint":null}});var Ut={};i1(Ut,{husky:()=>I});import{execSync as K2}from"child_process";import{mkdir as Y2,readFile as Z2,writeFile as $t}from"fs/promises";import{addDevDependency as q2,dlxCommand as I1}from"nypm";var _t,m1,I,F1=$(()=>{"use strict";p();_t=t=>`#!/bin/sh
|
|
3
3
|
# Exit on any error
|
|
4
4
|
set -e
|
|
5
5
|
|
|
@@ -67,8 +67,8 @@ if [ "$STAGED_HASH" != "$NEW_STAGED_HASH" ]; then
|
|
|
67
67
|
fi
|
|
68
68
|
|
|
69
69
|
exit $FORMAT_EXIT_CODE
|
|
70
|
-
`,
|
|
71
|
-
${
|
|
70
|
+
`,m1="./.husky/pre-commit",I={exists:()=>l(m1),install:async t=>{await q2("husky",{packageManager:t,workspace:await C(),silent:!0}),await b({scripts:{prepare:"husky"}})},init:t=>{let e=I1(t,"husky",{args:["init"]});try{K2(e,{stdio:"pipe"})}catch{}},create:async t=>{await Y2(".husky",{recursive:!0});let e=I1(t,"ultracite",{args:["fix"],short:t==="npm"}),o=_t(e);await $t(m1,o)},update:async t=>{let e=await Z2(m1,"utf-8"),o=I1(t,"ultracite",{args:["fix"],short:t==="npm"}),i=_t(o);await $t(m1,`${e}
|
|
71
|
+
${i}`)}}});var Nt={};i1(Nt,{lefthook:()=>H});import{execSync as t3}from"child_process";import{readFile as e3,writeFile as Y}from"fs/promises";import{addDevDependency as o3,dlxCommand as Dt}from"nypm";var i3,n3,Rt,F,Lt,H,B1=$(()=>{"use strict";p();i3=/(pre-commit:\s*\n\s*jobs:\s*\n)/,n3=/(pre-commit:\s*\n)/,Rt=t=>Dt(t,"ultracite",{args:["fix"],short:t==="npm"}),F="./lefthook.yml",Lt=t=>`pre-commit:
|
|
72
72
|
jobs:
|
|
73
73
|
- run: ${Rt(t)}
|
|
74
74
|
glob:
|
|
@@ -80,7 +80,7 @@ ${o}`)}}});var Dt={};e1(Dt,{lefthook:()=>W});import{execSync as Z2}from"child_pr
|
|
|
80
80
|
- "*.jsonc"
|
|
81
81
|
- "*.css"
|
|
82
82
|
stage_fixed: true
|
|
83
|
-
`,
|
|
83
|
+
`,H={exists:()=>l(F),install:async t=>{await o3("lefthook",{packageManager:t,workspace:await C(),silent:!0}),await b({scripts:{prepare:"lefthook install"}});let e=Dt(t,"lefthook",{args:["install"],short:t==="npm"});t3(e,{stdio:"pipe"})},create:async t=>{let e=Lt(t);await Y(F,e)},update:async t=>{let e=await e3(F,"utf-8"),o=Rt(t),i=Lt(t);if(e.includes(o))return;if(e.startsWith("# EXAMPLE USAGE:")){await Y(F,i);return}if(e.includes("pre-commit:"))if(e.includes("jobs:")){let s=` - run: ${o}
|
|
84
84
|
glob:
|
|
85
85
|
- "*.js"
|
|
86
86
|
- "*.jsx"
|
|
@@ -89,9 +89,9 @@ ${o}`)}}});var Dt={};e1(Dt,{lefthook:()=>W});import{execSync as Z2}from"child_pr
|
|
|
89
89
|
- "*.json"
|
|
90
90
|
- "*.jsonc"
|
|
91
91
|
- "*.css"
|
|
92
|
-
stage_fixed: true`,r=e.replace(
|
|
93
|
-
`);await
|
|
94
|
-
- run: ${
|
|
92
|
+
stage_fixed: true`,r=e.replace(i3,`$1${s}
|
|
93
|
+
`);await Y(F,r)}else{let s=` jobs:
|
|
94
|
+
- run: ${o}
|
|
95
95
|
glob:
|
|
96
96
|
- "*.js"
|
|
97
97
|
- "*.jsx"
|
|
@@ -100,47 +100,47 @@ ${o}`)}}});var Dt={};e1(Dt,{lefthook:()=>W});import{execSync as Z2}from"child_pr
|
|
|
100
100
|
- "*.json"
|
|
101
101
|
- "*.jsonc"
|
|
102
102
|
- "*.css"
|
|
103
|
-
stage_fixed: true`,r=e.replace(
|
|
104
|
-
`);await
|
|
105
|
-
${
|
|
103
|
+
stage_fixed: true`,r=e.replace(n3,`$1${s}
|
|
104
|
+
`);await Y(F,r)}else await Y(F,`${e}
|
|
105
|
+
${i}`)}}});var Gt={};i1(Gt,{preCommit:()=>q});import{readFile as s3,writeFile as $1}from"fs/promises";import{dlxCommand as r3}from"nypm";var Z,a3,Tt,c3,q,_1=$(()=>{"use strict";p();Z="./.pre-commit-config.yaml",a3=/^repos:\s*\n/m,Tt=t=>r3(t,"ultracite",{args:["fix"],short:t==="npm"}),c3=t=>`repos:
|
|
106
106
|
- repo: local
|
|
107
107
|
hooks:
|
|
108
108
|
- id: ultracite
|
|
109
109
|
name: ultracite
|
|
110
|
-
entry: ${
|
|
110
|
+
entry: ${Tt(t)}
|
|
111
111
|
language: system
|
|
112
112
|
types_or: [javascript, jsx, ts, tsx, json, css]
|
|
113
113
|
pass_filenames: false
|
|
114
|
-
`,
|
|
114
|
+
`,q={exists:()=>l(Z),create:async t=>{let e=c3(t);await $1(Z,e)},update:async t=>{let e=await s3(Z,"utf-8"),o=Tt(t);if(e.includes("id: ultracite"))return;let i=` - repo: local
|
|
115
115
|
hooks:
|
|
116
116
|
- id: ultracite
|
|
117
117
|
name: ultracite
|
|
118
|
-
entry: ${
|
|
118
|
+
entry: ${o}
|
|
119
119
|
language: system
|
|
120
120
|
types_or: [javascript, jsx, ts, tsx, json, css]
|
|
121
121
|
pass_filenames: false
|
|
122
|
-
`;if(e.includes("repos:")){let n=e.replace(
|
|
123
|
-
${
|
|
122
|
+
`;if(e.includes("repos:")){let n=e.replace(a3,`repos:
|
|
123
|
+
${i}`);await $1(Z,n)}else await $1(Z,`${e}
|
|
124
124
|
repos:
|
|
125
|
-
${
|
|
126
|
-
`).filter(s=>s.trim()&&!s.trim().startsWith("#")),
|
|
127
|
-
`;for(let n of
|
|
128
|
-
`}else e+=`${
|
|
129
|
-
`;return e},
|
|
130
|
-
`;await
|
|
131
|
-
`;await
|
|
125
|
+
${i}`)}}});var l3,U1=$(()=>{l3=M1({"./husky.ts":()=>(F1(),n1(Ut)),"./lefthook.ts":()=>(B1(),n1(Nt)),"./lint-staged.ts":()=>(L1(),n1(Mt)),"./pre-commit.ts":()=>(_1(),n1(Gt))})});var Mt={};i1(Mt,{lintStaged:()=>V});import{readFile as p1,writeFile as B}from"fs/promises";import{pathToFileURL as f3}from"url";import t1 from"deepmerge";import{parse as R1}from"jsonc-parser";import{addDevDependency as d3,dlxCommand as m3}from"nypm";var j,Jt,p3,g3,u3,h3,w3,x3,y3,v3,k3,D1,b3,V,L1=$(()=>{"use strict";p();U1();j=t=>({"*.{js,jsx,ts,tsx,json,jsonc,css,scss,md,mdx}":[m3(t,"ultracite",{args:["fix"],short:t==="npm"})]}),Jt=["./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"],p3=(t,e,o,i)=>{let n=t.trim();if(n.includes(":")&&!n.startsWith("-")){o&&i.length>0&&(e[o]=i);let[s,...r]=n.split(":"),a=r.join(":").trim(),d=s.trim().replace(/['"]/g,"");return a&&a!==""?(a.startsWith("[")&&a.endsWith("]")?e[d]=a.slice(1,-1).split(",").map(m=>m.trim().replace(/['"]/g,"")):e[d]=a.replace(/['"]/g,""),{newCurrentKey:null,newCurrentArray:[]}):{newCurrentKey:d,newCurrentArray:[]}}if(n.startsWith("-")&&o){let s=[...i,n.slice(1).trim().replace(/['"]/g,"")];return{newCurrentKey:o,newCurrentArray:s}}return{newCurrentKey:o,newCurrentArray:i}},g3=t=>{let e=t.split(`
|
|
126
|
+
`).filter(s=>s.trim()&&!s.trim().startsWith("#")),o={},i=null,n=[];for(let s of e){let r=p3(s,o,i,n);i=r.newCurrentKey,n=r.newCurrentArray}return i&&n.length>0&&(o[i]=n),o},u3=t=>{let e="";for(let[o,i]of Object.entries(t))if(Array.isArray(i)){e+=`${o}:
|
|
127
|
+
`;for(let n of i)e+=` - '${n}'
|
|
128
|
+
`}else e+=`${o}: '${i}'
|
|
129
|
+
`;return e},h3=async()=>{try{let t=R1(await p1("./package.json","utf-8"));return t?t.type==="module":!1}catch{return!1}},w3=async t=>{let e=R1(await p1("./package.json","utf-8"));e&&(e["lint-staged"]?e["lint-staged"]=t1(e["lint-staged"],j(t)):e["lint-staged"]=j(t),await B("./package.json",JSON.stringify(e,null,2)))},x3=async(t,e)=>{let o=await p1(t,"utf-8"),i=R1(o);if(!i)return;let n=t1(i,j(e));await B(t,JSON.stringify(n,null,2))},y3=async(t,e)=>{let o=await p1(t,"utf-8"),i=g3(o);if(!i)return;let n=t1(i,j(e));await B(t,u3(n))},v3=async(t,e)=>{let n=(await import(f3(t).href)).default||{},s=t1(n,j(e)),r=`export default ${JSON.stringify(s,null,2)};
|
|
130
|
+
`;await B(t,r)},k3=async(t,e)=>{delete S1.cache[S1.resolve(`./${t}`)];let o=l3(`./${t}`),i=t1(o,j(e)),n=`module.exports = ${JSON.stringify(i,null,2)};
|
|
131
|
+
`;await B(t,n)},D1=async t=>{await B(".lintstagedrc.json",JSON.stringify(j(t),null,2))},b3=async(t,e)=>{if(t==="./package.json"){await w3(e);return}if(t.endsWith(".json")||t==="./.lintstagedrc"){await x3(t,e);return}if(t.endsWith(".yaml")||t.endsWith(".yml")){await y3(t,e);return}let o=await h3();if(t.endsWith(".mjs")||t.endsWith(".js")&&o){try{await v3(t,e)}catch{await D1(e)}return}if(t.endsWith(".cjs")||t.endsWith(".js")&&!o)try{await k3(t,e)}catch{await D1(e)}},V={exists:async()=>{for(let t of Jt)if(await l(t))return!0;return!1},install:async t=>{await d3("lint-staged",{packageManager:t,workspace:await C(),silent:!0})},create:async t=>{await B(".lintstagedrc.json",JSON.stringify(j(t),null,2))},update:async t=>{let e=null;for(let o of Jt)if(await l(o)){e=o;break}if(!e){await D1(t);return}await b3(e,t)}}});var J1="./aider-K7JLZT2D.svg";var W1="./amazon-q-TSOJNPXB.svg";var H1="./amp-EV4LVL5I.svg";var V1="./augmentcode-Q62PVXKO.svg";var X1="./claude-6DLEHRDQ.svg";var Q1="./cline-6HWKIYN7.svg";var K1="./codex-NQZ5TJCL.svg";var Y1="./copilot-L2IY45R2.svg";var Z1="./crush-LYLRDQGZ.svg";var q1="./droid-266OHJBT.svg";var tt="./firebase-studio-ILLWWYU7.svg";var et="./firebender-UNO6LSZG.svg";var ot="./gemini-OYS6V4BH.svg";var it="./goose-XBIEVD4H.svg";var nt="./jules-HJPVWU73.svg";var st="./junie-RUWBUV6N.svg";var rt="./kilo-code-4QYUYY2E.svg";var at="./open-hands-K5EYKO6T.svg";var ct="./opencode-K3274JKQ.svg";var lt="./qwen-N3D5CQYL.svg";var ft="./roo-code-CVLBTS7D.svg";var dt="./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:X1},{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:K1},{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:nt},{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
|
-
---`},logo:
|
|
133
|
+
---`},logo:Y1},{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:Q1},{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:H1},{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:J1},{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:tt},{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:at},{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:ot},{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:st},{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:V1},{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:rt},{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:it},{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:ft},{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:dt},{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:q1},{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:ct},{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:Z1},{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:lt},{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:W1},{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:et}];import U from"deepmerge";var mt="./antigravity-JVONECNW.svg";var pt="./cursor-GQNH5LCA.svg";var gt="./kiro-N2M256R6.svg";var ut="./trae-RXVCFBOF.svg";var ht="./void-NYH3U3BB.svg";var wt="./vscode-DEOUEB65.svg";var xt="./windsurf-5T7JOTST.svg";var yt="./zed-SIARPESF.svg";var s1={"editor.defaultFormatter":"esbenp.prettier-vscode","typescript.tsdk":"node_modules/typescript/lib","editor.formatOnSave":!0,"editor.formatOnPaste":!0,"emmet.showExpandedAbbreviation":"never"},Je={"[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"}},We={"[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"}},He={"editor.codeActionsOnSave":{"source.fixAll.eslint":"explicit","source.organizeImports":"explicit"}},E=(t="biome")=>{switch(t){case"biome":return U(s1,Je);case"eslint":return U(s1,He);case"oxlint":return U(s1,We);default:return s1}},r1={formatter:"language_server",format_on_save:"on",lsp:{"typescript-language-server":{settings:{typescript:{preferences:{includePackageJsonAutoImports:"on"}}}}}},Ve={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}}}},Xe={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}}}},Qe={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}}}}},Ke=(t="biome")=>{switch(t){case"biome":return U(r1,Ve);case"eslint":return U(r1,Xe);case"oxlint":return U(r1,Qe);default:return r1}},x=[{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:wt,config:{path:".vscode/settings.json",getContent:E,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:pt,rules:{path:".cursor/rules/ultracite.mdc",header:`---
|
|
134
134
|
description: Ultracite Rules - AI-Ready Formatter and Linter
|
|
135
135
|
globs: "**/*.{ts,tsx,js,jsx,json,jsonc,html,vue,svelte,astro,css,yaml,yml,graphql,gql,md,mdx,grit}"
|
|
136
136
|
alwaysApply: false
|
|
137
|
-
---`},hooks:{path:".cursor/hooks.json",getContent:t=>({version:1,hooks:{afterFileEdit:[{command:t}]}})},config:{path:".vscode/settings.json",getContent:E,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:
|
|
137
|
+
---`},hooks:{path:".cursor/hooks.json",getContent:t=>({version:1,hooks:{afterFileEdit:[{command:t}]}})},config:{path:".vscode/settings.json",getContent:E,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:xt,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:E,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:mt,config:{path:".vscode/settings.json",getContent:E,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:gt,rules:{path:".kiro/steering/ultracite.md"},config:{path:".vscode/settings.json",getContent:E,extensionCommand:"code --install-extension"}},{id:"trae",name:"Trae AI",subtitle:"ByteDance's AI IDE",description:"ByteDance's AI-powered IDE built on VS Code - the real AI engineer.",logo:ut,rules:{path:".trae/rules/project_rules.md"},config:{path:".vscode/settings.json",getContent:E,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:ht,config:{path:".vscode/settings.json",getContent:E,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:yt,rules:{path:".rules",appendMode:!0},config:{path:".zed/settings.json",getContent:Ke}}];var vt="./biome-TVLEY2T4.svg";var kt="./eslint-7IULJKW7.svg";var bt="./oxlint-5IE3ABOZ.svg";var zt="./prettier-O4V2FSEA.svg";var Ct="./stylelint-DEBSWZVS.svg";var L=[{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:vt,videos:["https://www.youtube.com/watch?v=lEkXbneUnWg","https://www.youtube.com/watch?v=b_F4LaycQcE"],configFiles:[{name:"biome.jsonc",lang:"json",code:t=>`{
|
|
138
138
|
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
|
|
139
139
|
"extends": [
|
|
140
140
|
${t.map(e=>`"ultracite/biome/${e}"`).join(`,
|
|
141
141
|
`)}
|
|
142
142
|
]
|
|
143
|
-
}`}],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:
|
|
143
|
+
}`}],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:kt,additionalLogos:[zt,Ct],configFiles:[{name:"eslint.config.mjs",lang:"javascript",code:t=>`import { defineConfig } from "eslint/config";
|
|
144
144
|
${t.map(e=>`import ${e} from "ultracite/eslint/${e}";`).join(`
|
|
145
145
|
`)}
|
|
146
146
|
|
|
@@ -151,10 +151,10 @@ export default defineConfig([
|
|
|
151
151
|
`)}
|
|
152
152
|
],
|
|
153
153
|
},
|
|
154
|
-
]);`},{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:
|
|
154
|
+
]);`},{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:bt,configFiles:[{name:".oxlintrc.json",lang:"json",code:t=>`{
|
|
155
155
|
"$schema": "./node_modules/oxlint/configuration_schema.json",
|
|
156
156
|
"extends": [
|
|
157
|
-
${t.map(e=>`"ultracite/oxlint/${e}"`).join(`,
|
|
157
|
+
${t.map(e=>`"./node_modules/ultracite/config/oxlint/${e}/.oxlintrc.json"`).join(`,
|
|
158
158
|
`)}
|
|
159
159
|
]
|
|
160
160
|
}`},{name:".oxfmtrc.jsonc",lang:"json",code:()=>`{
|
|
@@ -168,9 +168,9 @@ export default defineConfig([
|
|
|
168
168
|
"arrowParens": "always",
|
|
169
169
|
"proseWrap": "never",
|
|
170
170
|
"printWidth": 80,
|
|
171
|
-
}`}],vscodeExtensionId:"oxc.oxc-vscode"}];var e2=["react","next","solid","vue","svelte","qwik","remix","angular","astro"],i2=["husky","lefthook","lint-staged","pre-commit"],o2=["eslint","prettier"],v={linters:s1.map(t=>t.id),editorConfigs:x.map(t=>t.id),agents:_.map(t=>t.id),integrations:i2,hooks:x.filter(t=>t.hooks).map(t=>t.id),frameworks:e2,migrations:o2};import{initTRPC as pi}from"@trpc/server";import{packageManagers as gi}from"nypm";import{createCli as ui}from"trpc-cli";import l from"zod";var y={name:"ultracite",description:"The AI-ready formatter that helps you write and generate code faster.",version:"7.0.6",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"};f();import{spawnSync as L}from"child_process";import R from"process";import{detectPackageManager as D,dlxCommand as N}from"nypm";var u2=async(t,e)=>{let i=["check","--no-errors-on-unmatched"];e&&i.push(`--diagnostic-level=${e}`),t.length>0?i.push(...u(t)):i.push("./");let n=(await D(R.cwd()))?.name||"npm",s=N(n,"@biomejs/biome",{args:i,short:n==="npm"}),r=L(s,{stdio:"inherit",shell:!0});if(r.error)throw new Error(`Failed to run Biome: ${r.error.message}`);return{hasErrors:r.status!==0}},h2=async t=>{let e=t.length>0?u(t):["."],o=(await D(R.cwd()))?.name||"npm",n=N(o,"eslint",{args:e,short:o==="npm"}),s=L(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=["--check",...t.length>0?u(t):["."]],o=(await D(R.cwd()))?.name||"npm",n=N(o,"prettier",{args:e,short:o==="npm"}),s=L(n,{stdio:"inherit",shell:!0});if(s.error)throw new Error(`Failed to run Prettier: ${s.error.message}`);return{hasErrors:s.status!==0}},x2=async t=>{let e=t.length>0?u(t):["."],o=(await D(R.cwd()))?.name||"npm",n=N(o,"stylelint",{args:e,short:o==="npm"}),s=L(n,{stdio:"inherit",shell:!0});if(s.error)throw new Error(`Failed to run Stylelint: ${s.error.message}`);return{hasErrors:s.status!==0}},v2=async(t,e,i)=>{let o=[];e&&o.push("--type-aware"),i&&o.push("--type-check"),o.push(...t.length>0?u(t):["."]);let s=(await D(R.cwd()))?.name||"npm",r=N(s,"oxlint",{args:o,short:s==="npm"}),a=L(r,{stdio:"inherit",shell:!0});if(a.error)throw new Error(`Failed to run Oxlint: ${a.error.message}`);return{hasErrors:a.status!==0}},y2=async t=>{let e=["--check",...t.length>0?u(t):["."]],o=(await D(R.cwd()))?.name||"npm",n=N(o,"oxfmt",{args:e,short:o==="npm"}),s=L(n,{stdio:"inherit",shell:!0});if(s.error)throw new Error(`Failed to run oxfmt: ${s.error.message}`);return{hasErrors:s.status!==0}},St=async t=>{let e=t?.[0]||[],i=t?.[1]["diagnostic-level"],n=t?.[1].linter||await r1();if(!n)throw new Error("No linter configuration found. Run `ultracite init` to set up a linter.");switch(n){case"eslint":{let s=await w2(e),r=await h2(e),a=await x2(e);return{hasErrors:s.hasErrors||r.hasErrors||a.hasErrors}}case"oxlint":{let s=await y2(e),r=await v2(e,t?.[1]["type-aware"],t?.[1]["type-check"]);return{hasErrors:s.hasErrors||r.hasErrors}}default:return u2(e,i)}};import{spawnSync as j1}from"child_process";import{existsSync as A}from"fs";import{readFile as c1}from"fs/promises";import{join as O}from"path";import w from"process";import{intro as k2,log as a1,outro as S1,spinner as b2}from"@clack/prompts";import{parse as jt}from"jsonc-parser";import{detectPackageManager as l1,dlxCommand as d1}from"nypm";var z2=[".prettierrc",".prettierrc.js",".prettierrc.cjs",".prettierrc.mjs",".prettierrc.json",".prettierrc.yaml",".prettierrc.yml","prettier.config.js","prettier.config.mjs","prettier.config.cjs"],C2=[".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"],S2=async()=>{let e=(await l1(w.cwd()))?.name||"npm",i=d1(e,"@biomejs/biome",{args:["--version"],short:e==="npm"}),o=j1(i,{shell:!0,encoding:"utf-8"});return o.status===0&&o.stdout?{name:"Biome installation",status:"pass",message:`Biome is installed (${o.stdout.trim()})`}:{name:"Biome installation",status:"fail",message:"Biome is not installed or not accessible"}},j2=async()=>{let e=(await l1(w.cwd()))?.name||"npm",i=d1(e,"eslint",{args:["--version"],short:e==="npm"}),o=j1(i,{shell:!0,encoding:"utf-8"});return o.status===0&&o.stdout?{name:"ESLint installation",status:"pass",message:`ESLint is installed (${o.stdout.trim()})`}:{name:"ESLint installation",status:"warn",message:"ESLint is not installed (optional)"}},P2=async()=>{let e=(await l1(w.cwd()))?.name||"npm",i=d1(e,"oxlint",{args:["--version"],short:e==="npm"}),o=j1(i,{shell:!0,encoding:"utf-8"});return o.status===0&&o.stdout?{name:"Oxlint installation",status:"pass",message:`Oxlint is installed (${o.stdout.trim()})`}:{name:"Oxlint installation",status:"warn",message:"Oxlint is not installed (optional)"}},E2=async()=>{let t=O(w.cwd(),"biome.json"),e=O(w.cwd(),"biome.jsonc"),i=null;if(A(t)?i=t:A(e)&&(i=e),!i)return{name:"Biome configuration",status:"warn",message:"No biome.json or biome.jsonc file found"};try{let o=await c1(i,"utf-8"),n=jt(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"}}},A2=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=O(w.cwd(),i);if(A(o)){e=o;break}}if(!e)return{name:"ESLint configuration",status:"warn",message:"No eslint.config.* file found (optional)"};try{return(await c1(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"}}},O2=async()=>{let t=O(w.cwd(),".oxlintrc.json");if(!A(t))return{name:"Oxlint configuration",status:"warn",message:"No .oxlintrc.json file found (optional)"};try{let e=await c1(t,"utf-8"),i=jt(e);return Array.isArray(i?.extends)&&i.extends.includes("ultracite/oxlint/core")?{name:"Oxlint configuration",status:"pass",message:".oxlintrc.json extends ultracite/oxlint/core"}:{name:"Oxlint configuration",status:"warn",message:".oxlintrc.json exists but doesn't extend ultracite/oxlint/core"}}catch{return{name:"Oxlint configuration",status:"fail",message:"Could not parse .oxlintrc.json file"}}},B2=async()=>{let t=O(w.cwd(),"package.json");if(!A(t))return{name:"Ultracite dependency",status:"warn",message:"No package.json found"};try{let e=JSON.parse(await c1(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"}}},I2=()=>{let t=z2.some(o=>A(O(w.cwd(),o))),i=C2.filter(o=>!o.startsWith("eslint.config")).some(o=>A(O(w.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"}},C=async(t,e)=>{let i=b2();i.start(`Checking ${e}...`);let o=await t();return o.status==="pass"||o.status,i.stop(o.message),o},Pt=async()=>{k2(`Ultracite v${y.version} Doctor`);let e=(await l1(w.cwd()))?.name||"npm",i=d1(e,"ultracite",{args:["init"],short:e==="npm"}),o=[];o.push(await C(S2,"Biome installation")),o.push(await C(j2,"ESLint installation")),o.push(await C(P2,"Oxlint installation")),o.push(await C(E2,"Biome configuration")),o.push(await C(A2,"ESLint configuration")),o.push(await C(O2,"Oxlint configuration")),o.push(await C(B2,"Ultracite dependency")),o.push(await C(I2,"conflicting tools"));let n=o.filter(a=>a.status==="pass").length,s=o.filter(a=>a.status==="fail").length,r=o.filter(a=>a.status==="warn").length;if(a1.info(`Summary: ${n} passed, ${r} warnings, ${s} failed`),s>0)throw a1.error(`Some checks failed. Run '${i}' to fix issues.`),S1("Doctor complete"),new Error("Doctor checks failed");if(r>0){a1.warn(`Some optional improvements available. Run '${i}' to configure.`),S1("Doctor complete");return}a1.success("Everything looks good!"),S1("Doctor complete")};f();import{spawnSync as T}from"child_process";import G from"process";import{detectPackageManager as M,dlxCommand as J}from"nypm";var F2=async(t,e)=>{let i=["check","--write","--no-errors-on-unmatched"];e&&i.push("--unsafe"),t.length>0?i.push(...u(t)):i.push("./");let n=(await M(G.cwd()))?.name||"npm",s=J(n,"@biomejs/biome",{args:i,short:n==="npm"}),r=T(s,{stdio:"inherit",shell:!0});if(r.error)throw new Error(`Failed to run Biome: ${r.error.message}`);return{hasErrors:r.status!==0}},$2=async t=>{let e=["--fix",...t.length>0?u(t):["."]],o=(await M(G.cwd()))?.name||"npm",n=J(o,"eslint",{args:e,short:o==="npm"}),s=T(n,{stdio:"inherit",shell:!0});if(s.error)throw new Error(`Failed to run ESLint: ${s.error.message}`);return{hasErrors:s.status!==0}},_2=async t=>{let e=["--write",...t.length>0?u(t):["."]],o=(await M(G.cwd()))?.name||"npm",n=J(o,"prettier",{args:e,short:o==="npm"}),s=T(n,{stdio:"inherit",shell:!0});if(s.error)throw new Error(`Failed to run Prettier: ${s.error.message}`);return{hasErrors:s.status!==0}},U2=async t=>{let e=["--fix",...t.length>0?u(t):["."]],o=(await M(G.cwd()))?.name||"npm",n=J(o,"stylelint",{args:e,short:o==="npm"}),s=T(n,{stdio:"inherit",shell:!0});if(s.error)throw new Error(`Failed to run Stylelint: ${s.error.message}`);return{hasErrors:s.status!==0}},L2=async(t,e,i)=>{let o=["--fix"];e&&o.push("--type-aware"),i&&o.push("--type-check"),o.push(...t.length>0?u(t):["."]);let s=(await M(G.cwd()))?.name||"npm",r=J(s,"oxlint",{args:o,short:s==="npm"}),a=T(r,{stdio:"inherit",shell:!0});if(a.error)throw new Error(`Failed to run Oxlint: ${a.error.message}`);return{hasErrors:a.status!==0}},R2=async t=>{let e=["--write",...t.length>0?u(t):["."]],o=(await M(G.cwd()))?.name||"npm",n=J(o,"oxfmt",{args:e,short:o==="npm"}),s=T(n,{stdio:"inherit",shell:!0});if(s.error)throw new Error(`Failed to run oxfmt: ${s.error.message}`);return{hasErrors:s.status!==0}},Et=async(t,e={})=>{let i=e.linter||await r1();if(!i)throw new Error("No linter configuration found. Run `ultracite init` to set up a linter.");switch(i){case"eslint":{let o=await _2(t),n=await $2(t),s=await U2(t);return{hasErrors:o.hasErrors||n.hasErrors||s.hasErrors}}case"oxlint":{let o=await R2(t),n=await L2(t,e["type-aware"],e["type-check"]);return{hasErrors:o.hasErrors||n.hasErrors}}default:return F2(t,e.unsafe)}};import V3 from"process";import{cancel as V,intro as X3,isCancel as X,log as k1,multiselect as q,select as Q3,spinner as p}from"@clack/prompts";import{addDevDependency as K3,detectPackageManager as Y3}from"nypm";import{readFile as D2,writeFile as P1}from"fs/promises";var At=t=>`# Ultracite Code Standards
|
|
171
|
+
}`}],vscodeExtensionId:"oxc.oxc-vscode"}];var o2=["react","next","solid","vue","svelte","qwik","remix","angular","astro"],i2=["husky","lefthook","lint-staged","pre-commit"],n2=["eslint","prettier"],y={linters:L.map(t=>t.id),editorConfigs:x.map(t=>t.id),agents:_.map(t=>t.id),integrations:i2,hooks:x.filter(t=>t.hooks).map(t=>t.id),frameworks:o2,migrations:n2};import{initTRPC as ho}from"@trpc/server";import{packageManagers as wo}from"nypm";import{createCli as xo}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.7",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"};p();import{spawnSync as D}from"child_process";import R from"process";import{detectPackageManager as N,dlxCommand as T}from"nypm";var h2=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(...h(t)):i.push("./");let s=(await N(R.cwd()))?.name||"npm",r=T(s,"@biomejs/biome",{args:i,short:s==="npm"}),a=D(r,{stdio:"inherit",shell:!0});if(a.error)throw new Error(`Failed to run Biome: ${a.error.message}`);return{hasErrors:a.status!==0}},w2=async t=>{let e=t.length>0?h(t):["."],i=(await N(R.cwd()))?.name||"npm",n=T(i,"eslint",{args:e,short:i==="npm"}),s=D(n,{stdio:"inherit",shell:!0});if(s.error)throw new Error(`Failed to run ESLint: ${s.error.message}`);return{hasErrors:s.status!==0}},x2=async t=>{let e=["--check",...t.length>0?h(t):["."]],i=(await N(R.cwd()))?.name||"npm",n=T(i,"prettier",{args:e,short:i==="npm"}),s=D(n,{stdio:"inherit",shell:!0});if(s.error)throw new Error(`Failed to run Prettier: ${s.error.message}`);return{hasErrors:s.status!==0}},y2=async t=>{let e=t.length>0?h(t):["."],i=(await N(R.cwd()))?.name||"npm",n=T(i,"stylelint",{args:e,short:i==="npm"}),s=D(n,{stdio:"inherit",shell:!0});if(s.error)throw new Error(`Failed to run Stylelint: ${s.error.message}`);return{hasErrors:s.status!==0}},v2=async(t,e,o)=>{let i=[];e&&i.push("--type-aware"),o&&i.push("--type-check"),i.push(...t.length>0?h(t):["."]);let s=(await N(R.cwd()))?.name||"npm",r=T(s,"oxlint",{args:i,short:s==="npm"}),a=D(r,{stdio:"inherit",shell:!0});if(a.error)throw new Error(`Failed to run Oxlint: ${a.error.message}`);return{hasErrors:a.status!==0}},k2=async(t,e)=>{let o=["--check"];e&&o.push("--no-error-on-unmatched-pattern"),o.push(...t.length>0?h(t):["."]);let n=(await N(R.cwd()))?.name||"npm",s=T(n,"oxfmt",{args:o,short:n==="npm"}),r=D(s,{stdio:"inherit",shell:!0});if(r.error)throw new Error(`Failed to run oxfmt: ${r.error.message}`);return{hasErrors:r.status!==0}},jt=async t=>{let e=t?.[0]||[],o=t?.[1]["diagnostic-level"],n=t?.[1].linter||await a1();if(!n)throw new Error("No linter configuration found. Run `ultracite init` to set up a linter.");switch(n){case"eslint":{let s=await x2(e),r=await w2(e),a=await y2(e);return{hasErrors:s.hasErrors||r.hasErrors||a.hasErrors}}case"oxlint":{let s=await k2(e,t?.[1]["no-error-on-unmatched-pattern"]),r=await v2(e,t?.[1]["type-aware"],t?.[1]["type-check"]);return{hasErrors:s.hasErrors||r.hasErrors}}default:return h2(e,o,t?.[1]["error-on-warnings"])}};import{spawnSync as P1}from"child_process";import{existsSync as A}from"fs";import{readFile as l1}from"fs/promises";import{join as O}from"path";import w from"process";import{intro as b2,log as c1,outro as j1,spinner as z2}from"@clack/prompts";import{parse as Pt}from"jsonc-parser";import{detectPackageManager as f1,dlxCommand as d1}from"nypm";var C2=[".prettierrc",".prettierrc.js",".prettierrc.cjs",".prettierrc.mjs",".prettierrc.json",".prettierrc.yaml",".prettierrc.yml","prettier.config.js","prettier.config.mjs","prettier.config.cjs"],S2=[".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"],j2=async()=>{let e=(await f1(w.cwd()))?.name||"npm",o=d1(e,"@biomejs/biome",{args:["--version"],short:e==="npm"}),i=P1(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"}},P2=async()=>{let e=(await f1(w.cwd()))?.name||"npm",o=d1(e,"eslint",{args:["--version"],short:e==="npm"}),i=P1(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)"}},E2=async()=>{let e=(await f1(w.cwd()))?.name||"npm",o=d1(e,"oxlint",{args:["--version"],short:e==="npm"}),i=P1(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)"}},A2=async()=>{let t=O(w.cwd(),"biome.json"),e=O(w.cwd(),"biome.jsonc"),o=null;if(A(t)?o=t:A(e)&&(o=e),!o)return{name:"Biome configuration",status:"warn",message:"No biome.json or biome.jsonc file found"};try{let i=await l1(o,"utf-8"),n=Pt(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"}}},O2=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=O(w.cwd(),o);if(A(i)){e=i;break}}if(!e)return{name:"ESLint configuration",status:"warn",message:"No eslint.config.* file found (optional)"};try{return(await l1(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"}}},I2=t=>`./node_modules/ultracite/config/oxlint/${t}/.oxlintrc.json`,F2=async()=>{let t=O(w.cwd(),".oxlintrc.json");if(!A(t))return{name:"Oxlint configuration",status:"warn",message:"No .oxlintrc.json file found (optional)"};try{let e=await l1(t,"utf-8"),o=Pt(e);return Array.isArray(o?.extends)&&o.extends.includes(I2("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"}}},B2=async()=>{let t=O(w.cwd(),"package.json");if(!A(t))return{name:"Ultracite dependency",status:"warn",message:"No package.json found"};try{let e=JSON.parse(await l1(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"}}},$2=()=>{let t=C2.some(i=>A(O(w.cwd(),i))),o=S2.filter(i=>!i.startsWith("eslint.config")).some(i=>A(O(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"}},S=async(t,e)=>{let o=z2();o.start(`Checking ${e}...`);let i=await t();return i.status==="pass"||i.status,o.stop(i.message),i},Et=async()=>{b2(`Ultracite v${k.version} Doctor`);let e=(await f1(w.cwd()))?.name||"npm",o=d1(e,"ultracite",{args:["init"],short:e==="npm"}),i=[];i.push(await S(j2,"Biome installation")),i.push(await S(P2,"ESLint installation")),i.push(await S(E2,"Oxlint installation")),i.push(await S(A2,"Biome configuration")),i.push(await S(O2,"ESLint configuration")),i.push(await S(F2,"Oxlint configuration")),i.push(await S(B2,"Ultracite dependency")),i.push(await S($2,"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(c1.info(`Summary: ${n} passed, ${r} warnings, ${s} failed`),s>0)throw c1.error(`Some checks failed. Run '${o}' to fix issues.`),j1("Doctor complete"),new Error("Doctor checks failed");if(r>0){c1.warn(`Some optional improvements available. Run '${o}' to configure.`),j1("Doctor complete");return}c1.success("Everything looks good!"),j1("Doctor complete")};p();import{spawnSync as G}from"child_process";import M from"process";import{detectPackageManager as J,dlxCommand as W}from"nypm";var _2=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(...h(t)):i.push("./");let s=(await J(M.cwd()))?.name||"npm",r=W(s,"@biomejs/biome",{args:i,short:s==="npm"}),a=G(r,{stdio:"inherit",shell:!0});if(a.error)throw new Error(`Failed to run Biome: ${a.error.message}`);return{hasErrors:a.status!==0}},U2=async t=>{let e=["--fix",...t.length>0?h(t):["."]],i=(await J(M.cwd()))?.name||"npm",n=W(i,"eslint",{args:e,short:i==="npm"}),s=G(n,{stdio:"inherit",shell:!0});if(s.error)throw new Error(`Failed to run ESLint: ${s.error.message}`);return{hasErrors:s.status!==0}},L2=async t=>{let e=["--write",...t.length>0?h(t):["."]],i=(await J(M.cwd()))?.name||"npm",n=W(i,"prettier",{args:e,short:i==="npm"}),s=G(n,{stdio:"inherit",shell:!0});if(s.error)throw new Error(`Failed to run Prettier: ${s.error.message}`);return{hasErrors:s.status!==0}},D2=async t=>{let e=["--fix",...t.length>0?h(t):["."]],i=(await J(M.cwd()))?.name||"npm",n=W(i,"stylelint",{args:e,short:i==="npm"}),s=G(n,{stdio:"inherit",shell:!0});if(s.error)throw new Error(`Failed to run Stylelint: ${s.error.message}`);return{hasErrors:s.status!==0}},R2=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?h(t):["."]);let r=(await J(M.cwd()))?.name||"npm",a=W(r,"oxlint",{args:n,short:r==="npm"}),d=G(a,{stdio:"inherit",shell:!0});if(d.error)throw new Error(`Failed to run Oxlint: ${d.error.message}`);return{hasErrors:d.status!==0}},N2=async t=>{let e=["--write",...t.length>0?h(t):["."]],i=(await J(M.cwd()))?.name||"npm",n=W(i,"oxfmt",{args:e,short:i==="npm"}),s=G(n,{stdio:"inherit",shell:!0});if(s.error)throw new Error(`Failed to run oxfmt: ${s.error.message}`);return{hasErrors:s.status!==0}},At=async(t,e={})=>{let o=e.linter||await a1();if(!o)throw new Error("No linter configuration found. Run `ultracite init` to set up a linter.");switch(o){case"eslint":{let i=await L2(t),n=await U2(t),s=await D2(t);return{hasErrors:i.hasErrors||n.hasErrors||s.hasErrors}}case"oxlint":{let i=await N2(t),n=await R2(t,e["type-aware"],e["type-check"],e.unsafe);return{hasErrors:i.hasErrors||n.hasErrors}}default:return _2(t,e.unsafe,e["error-on-warnings"])}};import Q3 from"process";import{cancel as Q,intro as K3,isCancel as K,log as b1,multiselect as e1,select as Y3,spinner as g}from"@clack/prompts";import{addDevDependency as Z3,detectPackageManager as q3}from"nypm";import{readFile as T2,writeFile as E1}from"fs/promises";var Ot=(t,e)=>`# Ultracite Code Standards
|
|
172
172
|
|
|
173
|
-
This project uses **Ultracite**, a zero-config
|
|
173
|
+
This project uses **Ultracite**, a zero-config preset that enforces strict code quality standards through automated formatting and linting.
|
|
174
174
|
|
|
175
175
|
## Quick Reference
|
|
176
176
|
|
|
@@ -178,7 +178,7 @@ This project uses **Ultracite**, a zero-config Biome preset that enforces strict
|
|
|
178
178
|
- **Check for issues**: \`${t} ultracite check\`
|
|
179
179
|
- **Diagnose setup**: \`${t} ultracite doctor\`
|
|
180
180
|
|
|
181
|
-
|
|
181
|
+
${e} (the underlying engine) provides robust linting and formatting. Most issues are automatically fixable.
|
|
182
182
|
|
|
183
183
|
---
|
|
184
184
|
|
|
@@ -277,11 +277,11 @@ Write code that is **accessible, performant, type-safe, and maintainable**. Focu
|
|
|
277
277
|
- Don't use \`.only\` or \`.skip\` in committed code
|
|
278
278
|
- Keep test suites reasonably flat - avoid excessive \`describe\` nesting
|
|
279
279
|
|
|
280
|
-
## When
|
|
280
|
+
## When ${e} Can't Help
|
|
281
281
|
|
|
282
|
-
|
|
282
|
+
${e}'s linter will catch most issues automatically. Focus your attention on:
|
|
283
283
|
|
|
284
|
-
1. **Business logic correctness** -
|
|
284
|
+
1. **Business logic correctness** - ${e} can't validate your algorithms
|
|
285
285
|
2. **Meaningful naming** - Use descriptive names for functions, variables, and types
|
|
286
286
|
3. **Architecture decisions** - Component structure, data flow, and API design
|
|
287
287
|
4. **Edge cases** - Handle boundary conditions and error states
|
|
@@ -290,24 +290,24 @@ Biome's linter will catch most issues automatically. Focus your attention on:
|
|
|
290
290
|
|
|
291
291
|
---
|
|
292
292
|
|
|
293
|
-
Most formatting and common issues are automatically fixed by
|
|
294
|
-
`;
|
|
293
|
+
Most formatting and common issues are automatically fixed by ${e}. Run \`${t} ultracite fix\` before committing to ensure compliance.
|
|
294
|
+
`;p();import{dlxCommand as G2}from"nypm";var It=(t,e,o)=>{let i=_.find(d=>d.id===t);if(!i)throw new Error(`Agent "${t}" not found`);let n=L.find(d=>d.id===o);if(!n)throw new Error(`Provider "${o}" not found`);let s=G2(e,""),r=Ot(s,n.name),a=i.config.header?`${i.config.header}
|
|
295
295
|
|
|
296
|
-
${
|
|
296
|
+
${r}`:r;return{exists:()=>l(i.config.path),create:async()=>{await z(i.config.path),await E1(i.config.path,a)},update:async()=>{await z(i.config.path);let d=await l(i.config.path);if(!(i.config.appendMode&&d)){await E1(i.config.path,a);return}let m=await T2(i.config.path,"utf-8");m.includes(r.trim())||await E1(i.config.path,`${m}
|
|
297
297
|
|
|
298
|
-
${
|
|
298
|
+
${r}`)}}};import{spawnSync as M2}from"child_process";import{readFile as J2,writeFile as A1}from"fs/promises";p();import W2 from"deepmerge";import{parse as H2}from"jsonc-parser";var Ft=(t,e="biome")=>{let o=x.find(n=>n.id===t);if(!o)throw new Error(`Editor "${t}" not found`);let i=o.config.getContent(e);return{exists:()=>l(o.config.path),create:async()=>{await z(o.config.path),await A1(o.config.path,JSON.stringify(i,null,2))},update:async()=>{if(await z(o.config.path),!await l(o.config.path)){await A1(o.config.path,JSON.stringify(i,null,2));return}let s=await J2(o.config.path,"utf-8"),a=H2(s)||{},d=W2(a,i);await A1(o.config.path,JSON.stringify(d,null,2))},extension:o.config.extensionCommand?n=>M2(`${o.config.extensionCommand} ${n}`,{stdio:"pipe",shell:!0}):void 0}};import{readFile as V2,writeFile as O1}from"fs/promises";p();import X2 from"deepmerge";import{dlxCommand as Q2}from"nypm";var Bt=(t,e)=>{let o=x.find(a=>a.id===t);if(!o)throw new Error(`Editor "${t}" not found`);if(!o.hooks)throw new Error(`Editor "${t}" does not support hooks`);let i=Q2(e,"ultracite",{args:["fix"],short:e==="npm"}),n=o.hooks.getContent(i),s=a=>JSON.stringify(a).includes("ultracite"),r=async()=>{if(!o.hooks?.path)throw new Error(`Editor "${t}" does not support hooks`);if(!await l(o.hooks.path)){await O1(o.hooks.path,JSON.stringify(n,null,2));return}let d=await V2(o.hooks.path,"utf-8"),m=JSON.parse(d);if(!s(m)){let v=X2(m,n);await O1(o.hooks.path,JSON.stringify(v,null,2))}};return{exists:()=>o.hooks?.path?l(o.hooks.path):!1,create:async()=>{if(!o.hooks?.path)throw new Error(`Editor "${t}" does not support hooks`);await z(o.hooks.path),await O1(o.hooks.path,JSON.stringify(n,null,2))},update:async()=>{if(!o.hooks?.path)throw new Error(`Editor "${t}" does not support hooks`);await z(o.hooks.path),await r()}}};F1();B1();L1();_1();p();import{readFile as z3,writeFile as Wt}from"fs/promises";import C3 from"deepmerge";import{parse as S3}from"jsonc-parser";var Ht={$schema:"./node_modules/@biomejs/biome/configuration_schema.json",extends:["ultracite/biome/core"]},N1=async()=>await l("./biome.json")?"./biome.json":"./biome.jsonc",g1={exists:async()=>{let t=await N1();return l(t)},create:async t=>{let e=await N1(),o=["ultracite/biome/core"];if(t?.frameworks&&t.frameworks.length>0)for(let n of t.frameworks)o.push(`ultracite/biome/${n}`);let i={...Ht,extends:o};return Wt(e,JSON.stringify(i,null,2))},update:async t=>{let e=await N1(),o=await z3(e,"utf-8"),n=S3(o)||{},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 m of t.frameworks){let v=`ultracite/biome/${m}`;r.includes(v)||r.push(v)}n.extends=r;let a={$schema:Ht.$schema},d=C3(n,a);await Wt(e,JSON.stringify(d,null,2))}};p();import{writeFile as Vt}from"fs/promises";var j3=["./eslint.config.mjs","./eslint.config.js","./eslint.config.cjs","./eslint.config.ts","./eslint.config.mts","./eslint.config.cts"],Xt="./eslint.config.mjs",P3=async()=>{for(let t of j3)if(await l(t))return t;return null},Qt=t=>{let e=['import core from "ultracite/eslint/core";'],o=["...core"];if(t?.frameworks&&t.frameworks.length>0)for(let i of t.frameworks)e.push(`import ${i} from "ultracite/eslint/${i}";`),o.push(`...${i}`);return`${e.join(`
|
|
299
299
|
`)}
|
|
300
300
|
|
|
301
301
|
export default [
|
|
302
|
-
${
|
|
302
|
+
${o.join(`,
|
|
303
303
|
`)},
|
|
304
304
|
];
|
|
305
|
-
`},
|
|
305
|
+
`},u1={exists:async()=>await P3()!==null,create:async t=>{let e=Qt(t);await Vt(Xt,e)},update:async t=>{let e=Qt(t);await Vt(Xt,e)}};p();import{readFile as E3,writeFile as Kt}from"fs/promises";import A3 from"deepmerge";import{parse as O3}from"jsonc-parser";var h1="./.oxfmtrc.jsonc",Yt={$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"}},w1={exists:async()=>await l(h1),create:async()=>{let t=`// Ultracite oxfmt Configuration
|
|
306
306
|
// https://oxc.rs/docs/guide/usage/formatter/config-file-reference.html
|
|
307
|
-
${JSON.stringify(
|
|
308
|
-
`;return await
|
|
307
|
+
${JSON.stringify(Yt,null,2)}
|
|
308
|
+
`;return await Kt(h1,t)},update:async()=>{let t=await E3(h1,"utf-8"),o=O3(t)||{},i=A3(o,Yt),n=`// Ultracite oxfmt Configuration
|
|
309
309
|
// https://oxc.rs/docs/guide/usage/formatter/config-file-reference.html
|
|
310
|
-
${JSON.stringify(
|
|
311
|
-
`;await
|
|
312
|
-
`,v1={exists:async()=>await
|
|
313
|
-
`,y1={exists:async()=>await D3()!==null,create:async()=>{let t=ne();await ie(oe,t)},update:async()=>{let t=ne();await ie(oe,t)}};import{readFile as N3,writeFile as se}from"fs/promises";import{glob as T3}from"glob";import{applyEdits as G3,modify as M3,parse as J3}from"jsonc-parser";var re=async()=>{try{return await T3("**/tsconfig*.json",{ignore:["**/node_modules/**","**/dist/**","**/build/**","**/.next/**"],absolute:!1})}catch{return[]}},W3=t=>{if(!t)return!1;let e=t.compilerOptions;return e?e.strict===!0||e.strictNullChecks===!0:!1},H3=async t=>{try{let e=await N3(t,"utf-8"),i=J3(e);if(W3(i))return;if(i===void 0){await se(t,JSON.stringify({compilerOptions:{strictNullChecks:!0}},null,2));return}let n=M3(e,["compilerOptions","strictNullChecks"],!0,{formattingOptions:{tabSize:2,insertSpaces:!0}}),s=G3(e,n);await se(t,s)}catch(e){console.warn(`Failed to update ${t}:`,e)}},N1={exists:async()=>(await re()).length>0,update:async()=>{let t=await re();if(t.length===0){console.warn("No tsconfig.json files found in the project");return}await Promise.all(t.map(e=>H3(e)))}};f();var ae=y.devDependencies["@biomejs/biome"],T1=y.version,Z3=async(t,e="biome",i=!0,o=!1,n=!1)=>{let s=p();o||s.start("Installing dependencies...");let r=[`ultracite@${T1}`];if(e==="biome"&&r.push(`@biomejs/biome@${ae}`),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")),i)for(let a of r)await K3(a,{packageManager:t,workspace:await z(),silent:!0});else{let a={ultracite:T1};e==="biome"&&(a["@biomejs/biome"]=ae),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 k({devDependencies:a})}o||s.stop("Dependencies installed.")},q3=async(t=!1)=>{let e=p();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.")},ti=async(t,e="biome",i=!1)=>{let o=x.find(r=>r.id===t);if(!o)throw new Error(`Editor "${t}" not found`);let n=Bt(t,e),s=p();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=s1.find(a=>a.id===e)?.vscodeExtensionId;if(!r)throw new Error(`Linter extension not found for ${e}`);i||s.message(`Installing ${r} extension...`);try{if(n.extension(r).status===0){i||s.stop(`${o.config.path} created and ${r} extension installed.`);return}}catch{}i||s.stop(`${o.config.path} created. Install ${r} extension manually.`);return}i||(t==="zed"?s.stop(`${o.config.path} created. Install the Biome extension: https://biomejs.dev/reference/zed/`):s.stop(`${o.config.path} created.`))},ei=async(t,e=!1)=>{let i=p();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.")},ii=async(t,e=!1)=>{let i=p();if(e||i.start("Checking for ESLint configuration..."),await g1.exists()){e||i.message("ESLint configuration found, updating..."),await g1.update({frameworks:t}),e||i.stop("ESLint configuration updated.");return}e||i.message("ESLint configuration not found, creating..."),await g1.create({frameworks:t}),e||i.stop("ESLint configuration created.")},oi=async(t,e=!1)=>{let i=p();if(e||i.start("Checking for Oxlint configuration..."),await x1.exists()){e||i.message("Oxlint configuration found, updating..."),await x1.update({frameworks:t}),e||i.stop("Oxlint configuration updated.");return}e||i.message("Oxlint configuration not found, creating..."),await x1.create({frameworks:t}),e||i.stop("Oxlint configuration created.")},ni=async(t=!1)=>{let e=p();if(t||e.start("Checking for Prettier configuration..."),await v1.exists()){t||e.message("Prettier configuration found, updating..."),await v1.update(),t||e.stop("Prettier configuration updated.");return}t||e.message("Prettier configuration not found, creating..."),await v1.create(),t||e.stop("Prettier configuration created.")},si=async(t=!1)=>{let e=p();if(t||e.start("Checking for Stylelint configuration..."),await y1.exists()){t||e.message("Stylelint configuration found, updating..."),await y1.update(),t||e.stop("Stylelint configuration updated.");return}t||e.message("Stylelint configuration not found, creating..."),await y1.create(),t||e.stop("Stylelint configuration created.")},ri=async(t=!1)=>{let e=p();if(t||e.start("Checking for oxfmt configuration..."),await h1.exists()){t||e.message("oxfmt configuration found, updating..."),await h1.update(),t||e.stop("oxfmt configuration updated.");return}t||e.message("oxfmt configuration not found, creating..."),await h1.create(),t||e.stop("oxfmt configuration created.")},ai=async(t,e=!0,i=!1)=>{let o=p();if(i||(o.start("Initializing pre-commit hooks..."),o.message("Installing Husky...")),e?await B.install(t):await k({devDependencies:{husky:"latest"},scripts:{prepare:"husky"}}),i||o.message("Initializing Husky..."),B.init(t),await B.exists()){i||o.message("Pre-commit hook found, updating..."),await B.update(t),i||o.stop("Pre-commit hook updated.");return}i||o.message("Pre-commit hook not found, creating..."),await B.create(t),i||o.stop("Pre-commit hook created.")},ci=async(t,e=!0,i=!1)=>{let o=p();if(i||(o.start("Initializing lefthook..."),o.message("Installing lefthook...")),e?await W.install(t):await k({devDependencies:{lefthook:"latest"}}),await W.exists()){i||o.message("lefthook.yml found, updating..."),await W.update(t),i||o.stop("lefthook.yml updated.");return}i||o.message("lefthook.yml not found, creating..."),await W.create(t),i||o.stop("lefthook.yml created.")},li=async(t,e=!0,i=!1)=>{let o=p();if(i||(o.start("Initializing lint-staged..."),o.message("Installing lint-staged...")),e?await H.install(t):await k({devDependencies:{"lint-staged":"latest"}}),await H.exists()){i||o.message("lint-staged found, updating..."),await H.update(t),i||o.stop("lint-staged updated.");return}i||o.message("lint-staged not found, creating..."),await H.create(t),i||o.stop("lint-staged created.")},di=async(t,e=!1)=>{let i=p();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.")},fi=async(t,e,i,o=!1)=>{let n=p();o||n.start(`Checking for ${e}...`);let s=Ot(t,i);if(await s.exists()){o||n.message(`${e} found, updating...`),await s.update(),o||n.stop(`${e} updated.`);return}o||n.message(`${e} not found, creating...`),await s.create(),o||n.stop(`${e} created.`)},mi=async(t,e,i,o=!1)=>{let n=p();o||n.start(`Checking for ${e} hooks...`);let s=It(t,i);if(await s.exists()){o||n.message(`${e} hooks found, updating...`),await s.update(),o||n.stop(`${e} hooks updated.`);return}o||n.message(`${e} hooks not found, creating...`),await s.create(),o||n.stop(`${e} hooks created.`)},ce=async t=>{let e=t??{},i=e.quiet??!1;i||X3(`Ultracite v${T1} Initialization`);try{let{pm:o}=e;if(!o){let d=await Y3(V3.cwd());if(!d)throw new Error("No package manager specified or detected");if(!i&&d.warnings)for(let g of d.warnings)k1.warn(g);i||k1.info(`Detected lockfile, using ${d.name}`),o=d.name}let n=e.linter;if(n===void 0)if(i||e.pm||e.editors||e.agents||e.hooks||e.integrations!==void 0||e.frameworks!==void 0)n="biome";else{let g=await Q3({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(X(g)){V("Operation cancelled.");return}n=g}let s=e.frameworks;if(s===void 0)if(i||e.pm||e.editors||e.agents||e.hooks||e.integrations!==void 0)s=[];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"}],required:!1});if(X(g)){V("Operation cancelled.");return}s=g}let r=e.editors;if(!r)if(i)r=[];else{let d=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(X(d)){V("Operation cancelled.");return}r=d}let a=e.agents,m=e.hooks,h=Object.fromEntries(_.map(d=>[d.id,d.name]));if(!a)if(i)a=[];else{let d=await q({message:"Which agents do you want to enable (optional)?",options:Object.entries(h).map(([g,b1])=>({value:g,label:b1})),required:!1});if(X(d)){V("Operation cancelled.");return}a=d}let j=Object.fromEntries(x.filter(d=>d.hooks).map(d=>[d.id,d.name]));if(!m)if(i)m=[];else{let d=await q({message:"Which agent hooks do you want to enable (optional)?",options:Object.entries(j).map(([g,b1])=>({value:g,label:b1})),required:!1});if(X(d)){V("Operation cancelled.");return}m=d}let P=e.integrations;if(P===void 0)if(i||e.pm||e.editors||e.agents||e.hooks)P=[];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(X(g)){V("Operation cancelled.");return}P=g}await Z3(o,n,!e.skipInstall,i,n==="oxlint"&&e["type-aware"]),await q3(i),n==="biome"&&await ei(s,i),n==="eslint"&&(await ii(s,i),await ni(i),await si(i)),n==="oxlint"&&(await oi(s,i),await ri(i));for(let d of r??[])await ti(d,n,i);for(let d of a??[])await fi(d,h[d],o,i);for(let d of m??[])await mi(d,j[d],o,i);P?.includes("husky")&&await ai(o,!e.skipInstall,i),P?.includes("lefthook")&&await ci(o,!e.skipInstall,i),P?.includes("lint-staged")&&await li(o,!e.skipInstall,i),P?.includes("pre-commit")&&await di(o,i),i||k1.success("Successfully initialized Ultracite configuration!")}catch(o){let n=o instanceof Error?o.message:"Unknown error";throw i||k1.error(`Failed to initialize Ultracite configuration: ${n}`),o}};var t1=pi.meta().create(),hi=t1.router({init:t1.procedure.meta({description:"Initialize Ultracite in the current directory"}).input(l.object({pm:l.enum(gi.map(t=>t.name)).optional().describe("Package manager to use"),linter:l.enum(v.linters).optional().describe("Linter / formatter to use"),editors:l.array(l.enum(v.editorConfigs)).optional().describe("Editors to configure"),agents:l.array(l.enum(v.agents)).optional().describe("Agents to enable"),hooks:l.array(l.enum(v.hooks)).optional().describe("Hooks to enable"),frameworks:l.array(l.enum(v.frameworks)).optional().describe("Frameworks being used"),integrations:l.array(l.enum(v.integrations)).optional().describe("Additional integrations to enable"),migrate:l.array(l.enum(v.migrations)).optional().describe("Migration tools to remove (e.g., eslint, prettier). Removes dependencies, config files, and editor settings."),"type-aware":l.boolean().optional().describe("enable type-aware linting (oxlint only, installs oxlint-tsgolint)"),skipInstall:l.boolean().default(!1).describe("Skip installing dependencies"),quiet:l.boolean().default(process.env.CI==="true"||process.env.CI==="1").describe("Suppress all interactive prompts and visual output. Automatically enabled in CI environments.")})).mutation(async({input:t})=>{await ce(t)}),check:t1.procedure.meta({description:"Run linter without fixing files"}).input(l.tuple([l.array(l.string()).optional().default([]).describe("specific files to lint"),l.object({"diagnostic-level":l.enum(["info","warn","error"]).optional().describe("level of diagnostics to show. In order, from the lowest to the most important: info, warn, error."),linter:l.enum(v.linters).optional().describe("linter to use (biome, eslint, or oxlint)"),"type-aware":l.boolean().optional().describe("enable type-aware linting rules (oxlint only)"),"type-check":l.boolean().optional().describe("enable TypeScript compiler diagnostics (oxlint only)")})]).optional()).query(async({input:t})=>{await St(t)}),fix:t1.procedure.meta({description:"Run linter and fix files"}).input(l.tuple([l.array(l.string()).optional().default([]).describe("specific files to format"),l.object({unsafe:l.boolean().optional().describe("apply unsafe fixes"),linter:l.enum(v.linters).optional().describe("linter to use (biome, eslint, or oxlint)"),"type-aware":l.boolean().optional().describe("enable type-aware linting rules (oxlint only)"),"type-check":l.boolean().optional().describe("enable TypeScript compiler diagnostics (oxlint only)")})]).optional()).mutation(async({input:t})=>{let[e,i]=t??[[],{}];await Et(e,{unsafe:i.unsafe,linter:i.linter,"type-aware":i["type-aware"],"type-check":i["type-check"]})}),doctor:t1.procedure.meta({description:"Verify your Ultracite setup and check for issues"}).query(async()=>{await Pt()})}),wi=ui({router:hi,name:y.name,version:y.version,description:y.description});process.env.TEST||wi.run();export{hi as router};
|
|
310
|
+
${JSON.stringify(i,null,2)}
|
|
311
|
+
`;await Kt(h1,n)}};p();import{readFile as I3,writeFile as Zt}from"fs/promises";import F3 from"deepmerge";import{parse as B3}from"jsonc-parser";var x1="./.oxlintrc.json",X=t=>`./node_modules/ultracite/config/oxlint/${t}/.oxlintrc.json`,qt={$schema:"./node_modules/oxlint/configuration_schema.json",extends:[X("core")]},y1={exists:async()=>await l(x1),create:async t=>{let e=[X("core")];if(t?.frameworks&&t.frameworks.length>0)for(let i of t.frameworks)e.push(X(i));let o={...qt,extends:e};return await Zt(x1,JSON.stringify(o,null,2))},update:async t=>{let e=await I3(x1,"utf-8"),i=B3(e)||{},n=i.extends&&Array.isArray(i.extends)?i.extends:[],s=m=>n.some(v=>v===X(m)),r=[...n];if(s("core")||r.push(X("core")),t?.frameworks&&t.frameworks.length>0)for(let m of t.frameworks)s(m)||r.push(X(m));i.extends=r;let a={$schema:qt.$schema},d=F3(i,a);await Zt(x1,JSON.stringify(d,null,2))}};p();import{readFile as $3,writeFile as te}from"fs/promises";var _3=["./.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"],ee="./prettier.config.mjs",U3=async()=>{try{return"prettier"in JSON.parse(await $3("./package.json","utf-8"))}catch{return!1}},L3=async()=>{if(await U3())return"./package.json";for(let t of _3)if(await l(t))return t;return null},oe=()=>`export { default } from "ultracite/prettier";
|
|
312
|
+
`,v1={exists:async()=>await L3()!==null,create:async()=>{let t=oe();await te(ee,t)},update:async()=>{let t=oe();await te(ee,t)}};p();import{readFile as D3,writeFile as ie}from"fs/promises";var R3=["./.stylelintrc.mjs","./stylelint.config.mjs","./.stylelintrc.cjs","./stylelint.config.cjs","./.stylelintrc.js","./stylelint.config.js","./.stylelintrc","./.stylelintrc.json","./.stylelintrc.yml","./.stylelintrc.yaml"],ne="./stylelint.config.mjs",N3=async()=>{try{return"stylelint"in JSON.parse(await D3("./package.json","utf-8"))}catch{return!1}},T3=async()=>{if(await N3())return"./package.json";for(let t of R3)if(await l(t))return t;return null},se=()=>`export { default } from "ultracite/stylelint";
|
|
313
|
+
`,k1={exists:async()=>await T3()!==null,create:async()=>{let t=se();await ie(ne,t)},update:async()=>{let t=se();await ie(ne,t)}};import{readFile as G3,writeFile as re}from"fs/promises";import{glob as M3}from"glob";import{applyEdits as J3,modify as W3,parse as H3}from"jsonc-parser";var ae=async()=>{try{return await M3("**/tsconfig*.json",{ignore:["**/node_modules/**","**/dist/**","**/build/**","**/.next/**"],absolute:!1})}catch{return[]}},V3=t=>{if(!t)return!1;let e=t.compilerOptions;return e?e.strict===!0||e.strictNullChecks===!0:!1},X3=async t=>{try{let e=await G3(t,"utf-8"),o=H3(e);if(V3(o))return;if(o===void 0){await re(t,JSON.stringify({compilerOptions:{strictNullChecks:!0}},null,2));return}let n=W3(e,["compilerOptions","strictNullChecks"],!0,{formattingOptions:{tabSize:2,insertSpaces:!0}}),s=J3(e,n);await re(t,s)}catch(e){console.warn(`Failed to update ${t}:`,e)}},T1={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=>X3(e)))}};p();var ce=k.devDependencies["@biomejs/biome"],G1=k.version,to=async(t,e="biome",o=!0,i=!1,n=!1)=>{let s=g();i||s.start("Installing dependencies...");let r=[`ultracite@${G1}`];if(e==="biome"&&r.push(`@biomejs/biome@${ce}`),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 Z3(a,{packageManager:t,workspace:await C(),silent:!0});else{let a={ultracite:G1};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 b({devDependencies:a})}i||s.stop("Dependencies installed.")},eo=async(t=!1)=>{let e=g();if(t||e.start("Checking for tsconfig.json files..."),await T1.exists()){t||e.message("Found tsconfig.json files, updating with strictNullChecks..."),await T1.update(),t||e.stop("tsconfig.json files updated.");return}t||e.stop("No tsconfig.json files found, skipping.")},oo=async(t,e="biome",o=!1)=>{let i=x.find(r=>r.id===t);if(!i)throw new Error(`Editor "${t}" not found`);let n=Ft(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=L.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.`))},io=async(t,e=!1)=>{let o=g();if(e||o.start("Checking for Biome configuration..."),await g1.exists()){e||o.message("Biome configuration found, updating..."),await g1.update({frameworks:t}),e||o.stop("Biome configuration updated.");return}e||o.message("Biome configuration not found, creating..."),await g1.create({frameworks:t}),e||o.stop("Biome configuration created.")},no=async(t,e=!1)=>{let o=g();if(e||o.start("Checking for ESLint configuration..."),await u1.exists()){e||o.message("ESLint configuration found, updating..."),await u1.update({frameworks:t}),e||o.stop("ESLint configuration updated.");return}e||o.message("ESLint configuration not found, creating..."),await u1.create({frameworks:t}),e||o.stop("ESLint configuration created.")},so=async(t,e=!1)=>{let o=g();if(e||o.start("Checking for Oxlint configuration..."),await y1.exists()){e||o.message("Oxlint configuration found, updating..."),await y1.update({frameworks:t}),e||o.stop("Oxlint configuration updated.");return}e||o.message("Oxlint configuration not found, creating..."),await y1.create({frameworks:t}),e||o.stop("Oxlint configuration created.")},ro=async(t=!1)=>{let e=g();if(t||e.start("Checking for Prettier configuration..."),await v1.exists()){t||e.message("Prettier configuration found, updating..."),await v1.update(),t||e.stop("Prettier configuration updated.");return}t||e.message("Prettier configuration not found, creating..."),await v1.create(),t||e.stop("Prettier configuration created.")},ao=async(t=!1)=>{let e=g();if(t||e.start("Checking for Stylelint configuration..."),await k1.exists()){t||e.message("Stylelint configuration found, updating..."),await k1.update(),t||e.stop("Stylelint configuration updated.");return}t||e.message("Stylelint configuration not found, creating..."),await k1.create(),t||e.stop("Stylelint configuration created.")},co=async(t=!1)=>{let e=g();if(t||e.start("Checking for oxfmt configuration..."),await w1.exists()){t||e.message("oxfmt configuration found, updating..."),await w1.update(),t||e.stop("oxfmt configuration updated.");return}t||e.message("oxfmt configuration not found, creating..."),await w1.create(),t||e.stop("oxfmt configuration created.")},lo=async(t,e=!0,o=!1)=>{let i=g();if(o||(i.start("Initializing pre-commit hooks..."),i.message("Installing Husky...")),e?await I.install(t):await b({devDependencies:{husky:"latest"},scripts:{prepare:"husky"}}),o||i.message("Initializing Husky..."),I.init(t),await I.exists()){o||i.message("Pre-commit hook found, updating..."),await I.update(t),o||i.stop("Pre-commit hook updated.");return}o||i.message("Pre-commit hook not found, creating..."),await I.create(t),o||i.stop("Pre-commit hook created.")},fo=async(t,e=!0,o=!1)=>{let i=g();if(o||(i.start("Initializing lefthook..."),i.message("Installing lefthook...")),e?await H.install(t):await b({devDependencies:{lefthook:"latest"}}),await H.exists()){o||i.message("lefthook.yml found, updating..."),await H.update(t),o||i.stop("lefthook.yml updated.");return}o||i.message("lefthook.yml not found, creating..."),await H.create(t),o||i.stop("lefthook.yml created.")},mo=async(t,e=!0,o=!1)=>{let i=g();if(o||(i.start("Initializing lint-staged..."),i.message("Installing lint-staged...")),e?await V.install(t):await b({devDependencies:{"lint-staged":"latest"}}),await V.exists()){o||i.message("lint-staged found, updating..."),await V.update(t),o||i.stop("lint-staged updated.");return}o||i.message("lint-staged not found, creating..."),await V.create(t),o||i.stop("lint-staged created.")},po=async(t,e=!1)=>{let o=g();if(e||o.start("Initializing pre-commit..."),await q.exists()){e||o.message(".pre-commit-config.yaml found, updating..."),await q.update(t),e||o.stop(".pre-commit-config.yaml updated.");return}e||o.message(".pre-commit-config.yaml not found, creating..."),await q.create(t),e||o.stop(".pre-commit-config.yaml created.")},go=async(t,e,o,i,n=!1)=>{let s=g();n||s.start(`Checking for ${e}...`);let r=It(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.`)},uo=async(t,e,o,i=!1)=>{let n=g();i||n.start(`Checking for ${e} hooks...`);let s=Bt(t,o);if(await s.exists()){i||n.message(`${e} hooks found, updating...`),await s.update(),i||n.stop(`${e} hooks updated.`);return}i||n.message(`${e} hooks not found, creating...`),await s.create(),i||n.stop(`${e} hooks created.`)},le=async t=>{let e=t??{},o=e.quiet??!1;o||K3(`Ultracite v${G1} Initialization`);try{let{pm:i}=e;if(!i){let f=await q3(Q3.cwd());if(!f)throw new Error("No package manager specified or detected");if(!o&&f.warnings)for(let u of f.warnings)b1.warn(u);o||b1.info(`Detected lockfile, using ${f.name}`),i=f.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 u=await Y3({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(K(u)){Q("Operation cancelled.");return}n=u}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 u=await e1({message:"Which frameworks are you using (optional)?",options:[{label:"React",value:"react"},{label:"Next.js",value:"next"},{label:"Solid",value:"solid"},{label:"Vue",value:"vue"},{label:"Svelte",value:"svelte"},{label:"Qwik",value:"qwik"},{label:"Angular",value:"angular"},{label:"Remix / TanStack Router / React Router",value:"remix"},{label:"Astro",value:"astro"}],required:!1});if(K(u)){Q("Operation cancelled.");return}s=u}let r=e.editors;if(!r)if(o)r=[];else{let f=await e1({message:"Which editors do you want to configure (recommended)?",options:[{label:"VSCode / Cursor / Windsurf",value:"vscode"},{label:"Zed",value:"zed"}],required:!1});if(K(f)){Q("Operation cancelled.");return}r=f}let a=e.agents,d=e.hooks,m=Object.fromEntries(_.map(f=>[f.id,f.name]));if(!a)if(o)a=[];else{let f=await e1({message:"Which agents do you want to enable (optional)?",options:Object.entries(m).map(([u,z1])=>({value:u,label:z1})),required:!1});if(K(f)){Q("Operation cancelled.");return}a=f}let v=Object.fromEntries(x.filter(f=>f.hooks).map(f=>[f.id,f.name]));if(!d)if(o)d=[];else{let f=await e1({message:"Which agent hooks do you want to enable (optional)?",options:Object.entries(v).map(([u,z1])=>({value:u,label:z1})),required:!1});if(K(f)){Q("Operation cancelled.");return}d=f}let P=e.integrations;if(P===void 0)if(o||e.pm||e.editors||e.agents||e.hooks)P=[];else{let u=await e1({message:"Would you like any of the following (optional)?",options:[{label:"Husky pre-commit hook",value:"husky"},{label:"Lefthook pre-commit hook",value:"lefthook"},{label:"Lint-staged",value:"lint-staged"},{label:"pre-commit (Python framework)",value:"pre-commit"}],required:!1});if(K(u)){Q("Operation cancelled.");return}P=u}await to(i,n,!e.skipInstall,o,n==="oxlint"&&e["type-aware"]),await eo(o),n==="biome"&&await io(s,o),n==="eslint"&&(await no(s,o),await ro(o),await ao(o)),n==="oxlint"&&(await so(s,o),await co(o));for(let f of r??[])await oo(f,n,o);for(let f of a??[])await go(f,m[f],i,n,o);for(let f of d??[])await uo(f,v[f],i,o);P?.includes("husky")&&await lo(i,!e.skipInstall,o),P?.includes("lefthook")&&await fo(i,!e.skipInstall,o),P?.includes("lint-staged")&&await mo(i,!e.skipInstall,o),P?.includes("pre-commit")&&await po(i,o),o||b1.success("Successfully initialized Ultracite configuration!")}catch(i){let n=i instanceof Error?i.message:"Unknown error";throw o||b1.error(`Failed to initialize Ultracite configuration: ${n}`),i}};var o1=ho.meta().create(),yo=o1.router({init:o1.procedure.meta({description:"Initialize Ultracite in the current directory"}).input(c.object({pm:c.enum(wo.map(t=>t.name)).optional().describe("Package manager to use"),linter:c.enum(y.linters).optional().describe("Linter / formatter to use"),editors:c.array(c.enum(y.editorConfigs)).optional().describe("Editors to configure"),agents:c.array(c.enum(y.agents)).optional().describe("Agents to enable"),hooks:c.array(c.enum(y.hooks)).optional().describe("Hooks to enable"),frameworks:c.array(c.enum(y.frameworks)).optional().describe("Frameworks being used"),integrations:c.array(c.enum(y.integrations)).optional().describe("Additional integrations to enable"),migrate:c.array(c.enum(y.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 le(t)}),check:o1.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(y.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 jt(t)}),fix:o1.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(y.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 At(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:o1.procedure.meta({description:"Verify your Ultracite setup and check for issues"}).query(async()=>{await Et()})}),vo=xo({router:yo,name:k.name,version:k.version,description:k.description});process.env.TEST||vo.run();export{yo as router};
|