adamantite 0.32.2 → 0.32.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,23 +1,23 @@
1
- import*as mr from"@effect/platform-node/NodeRuntime";import*as dr from"@effect/platform-node/NodeServices";import*as M from"effect/Effect";import*as hr from"effect/Exit";import*as gr from"effect/Layer";import*as Er from"effect/Runtime";import*as ye from"effect/unstable/cli/Command";import*as jr from"effect/unstable/process/ChildProcessSpawner";import*as Kt from"effect/Effect";import*as Fe from"effect/unstable/cli/Command";import*as $e from"effect/unstable/cli/Flag";import*as Gt from"effect/unstable/process/ChildProcessSpawner";import*as Se from"effect/Effect";import*as et from"effect/FileSystem";import*as tt from"effect/Path";function _(e){return e}import*as T from"effect/Data";import{printParseErrorCode as Or}from"jsonc-parser";function Sr(e=[]){if(e.length===0)return"- Unknown JSON/JSONC parsing error";return e.slice(0,3).map((t)=>`- ${Or(t.error)} (offset: ${t.offset})`).join(`
2
- `)}class $t extends T.TaggedError("CliNotFound"){get message(){return`Command \`${this.command}\` not found. Please install it and try again.`}}class A extends T.TaggedError("CommandFailed"){get message(){return`Command \`${this.command}\` failed with exit code ${this.exitCode}.`}}class me extends T.TaggedError("FailedToCreateDirectory"){get message(){return`Failed to create directory ${this.path?`\`${this.path}\``:"the target directory"}.`}}class Tt extends T.TaggedError("FailedToInstallDependency"){get message(){return`Failed to install dependencies${this.packages?.length?`: ${this.packages.join(", ")}`:""}.`}}class Ge extends T.TaggedError("FailedToInstallExtension"){get message(){return`Failed to install ${this.extension?`\`${this.extension}\``:"the target extension"}.`}}class vt extends T.TaggedError("FailedToMergeConfig"){get message(){return`Failed to merge configuration.${this.cause instanceof Error?` Cause: ${this.cause.message}`:""}`}}class Pt extends T.TaggedError("FailedToParseFile"){get message(){return[`Failed to parse ${this.path?`\`${this.path}\``:"the target file"}.`,"Please fix the JSON/JSONC syntax and run the command again.","","Parse details:",Sr(this.errors)].join(`
3
- `)}}class D extends T.TaggedError("FailedToReadFile"){get message(){return`Failed to read ${this.path?`\`${this.path}\``:"the target file"}.`}}class re extends T.TaggedError("FailedToDeleteFile"){get message(){return`Failed to delete ${this.path?`\`${this.path}\``:"the target file"}.`}}class O extends T.TaggedError("FailedToWriteFile"){get message(){return`Failed to write ${this.path?`\`${this.path}\``:"the target file"}.`}}class _t extends T.TaggedError("FileNotFound"){get message(){return this.path?`File not found: \`${this.path}\`.`:"File not found."}}class x extends T.TaggedError("InvalidConfigFormat"){get message(){return`Invalid config format in ${this.path?`\`${this.path}\``:"the target config file"}. The config must be a JSON object (for example: {}).`}}class Dt extends T.TaggedError("UnsupportedConfigState"){get message(){let e=this.path?`\`${this.path}\``:"the target config file",t=this.reason?` ${this.reason}`:"";return`Unsupported config state in ${e}.${t}`}}class xe extends T.TaggedError("NoPackageManager"){get message(){return`No package manager detected. Please run this command from a project with a lockfile.${this.cause instanceof Error?` Cause: ${this.cause.message}`:""}`}}class Fr extends T.TaggedError("MissingPackageVersion"){get message(){return`Missing version field in ${this.path?`\`${this.path}\``:"package.json"}.`}}class H extends T.TaggedError("MigrationValidationFailed"){get message(){return`Migration \`${this.migrationId}\` validation failed. ${this.reason}`}}class Ce extends T.TaggedError("OperationCancelled"){get message(){return`Operation cancelled.${this.reason?` Reason: ${this.reason}`:""}`}}class Nt extends T.TaggedError("UnknownScript"){get message(){return`Unknown script: \`${this.script}\`.`}}class kt extends T.TaggedError("VscodeCliNotFound"){get message(){return`VS Code CLI (\`code\`) not found. Please install it to manage extensions.${this.cause instanceof Error?` Cause: ${this.cause.message}`:""}`}}import{defu as $r}from"defu";import*as G from"effect/Effect";import{parse as Tr}from"jsonc-parser";var w=(e,t)=>G.sync(()=>{let r=[],n=Tr(e,r,{allowTrailingComma:!0});return{errors:r,parsed:n}}).pipe(G.flatMap(({errors:r,parsed:n})=>r.length>0?G.fail(new Pt({errors:r,path:t})):G.succeed(n)));function N(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function ge(e,t={}){let{continuationIndent:r,indentation:n=2}=t,o=JSON.stringify(e,null,n).replaceAll(/"([A-Za-z_$][\w$]*)":/g,"$1:");if(!r)return o;return o.replaceAll(`
1
+ import*as pr from"@effect/platform-node/NodeRuntime";import*as ur from"@effect/platform-node/NodeServices";import*as A from"effect/Effect";import*as cr from"effect/Exit";import*as dr from"effect/Layer";import*as yr from"effect/Runtime";import*as ce from"effect/unstable/cli/Command";import*as mr from"effect/unstable/process/ChildProcessSpawner";import*as Zt from"effect/Effect";import*as je from"effect/unstable/cli/Command";import*as Fe from"effect/unstable/cli/Flag";import*as Xt from"effect/unstable/process/ChildProcessSpawner";import*as Oe from"effect/Effect";import*as He from"effect/FileSystem";import*as Ge from"effect/Path";function P(e){return e}import*as v from"effect/Data";import{printParseErrorCode as hr}from"jsonc-parser";function Er(e=[]){if(e.length===0)return"- Unknown JSON/JSONC parsing error";return e.slice(0,3).map((t)=>`- ${hr(t.error)} (offset: ${t.offset})`).join(`
2
+ `)}class Ot extends v.TaggedError("CliNotFound"){get message(){return`Command \`${this.command}\` not found. Please install it and try again.`}}class I extends v.TaggedError("CommandFailed"){get message(){return`Command \`${this.command}\` failed with exit code ${this.exitCode}.`}}class de extends v.TaggedError("FailedToCreateDirectory"){get message(){return`Failed to create directory ${this.path?`\`${this.path}\``:"the target directory"}.`}}class St extends v.TaggedError("FailedToInstallDependency"){get message(){return`Failed to install dependencies${this.packages?.length?`: ${this.packages.join(", ")}`:""}.`}}class Ze extends v.TaggedError("FailedToInstallExtension"){get message(){return`Failed to install ${this.extension?`\`${this.extension}\``:"the target extension"}.`}}class jt extends v.TaggedError("FailedToMergeConfig"){get message(){return`Failed to merge configuration.${this.cause instanceof Error?` Cause: ${this.cause.message}`:""}`}}class Ft extends v.TaggedError("FailedToParseFile"){get message(){return[`Failed to parse ${this.path?`\`${this.path}\``:"the target file"}.`,"Please fix the JSON/JSONC syntax and run the command again.","","Parse details:",Er(this.errors)].join(`
3
+ `)}}class T extends v.TaggedError("FailedToReadFile"){get message(){return`Failed to read ${this.path?`\`${this.path}\``:"the target file"}.`}}class re extends v.TaggedError("FailedToDeleteFile"){get message(){return`Failed to delete ${this.path?`\`${this.path}\``:"the target file"}.`}}class S extends v.TaggedError("FailedToWriteFile"){get message(){return`Failed to write ${this.path?`\`${this.path}\``:"the target file"}.`}}class $t extends v.TaggedError("FileNotFound"){get message(){return this.path?`File not found: \`${this.path}\`.`:"File not found."}}class J extends v.TaggedError("InvalidConfigFormat"){get message(){return`Invalid config format in ${this.path?`\`${this.path}\``:"the target config file"}. The config must be a JSON object (for example: {}).`}}class vt extends v.TaggedError("UnsupportedConfigState"){get message(){let e=this.path?`\`${this.path}\``:"the target config file",t=this.reason?` ${this.reason}`:"";return`Unsupported config state in ${e}.${t}`}}class Ue extends v.TaggedError("NoPackageManager"){get message(){return`No package manager detected. Please run this command from a project with a lockfile.${this.cause instanceof Error?` Cause: ${this.cause.message}`:""}`}}class gr extends v.TaggedError("MissingPackageVersion"){get message(){let e=this.path?`\`${this.path}\``:"package.json";if(this.dependency)return`Missing \`${this.dependency}\` in ${e} dependencies or devDependencies.`;return`Missing version field in ${e}.`}}class Y extends v.TaggedError("MigrationValidationFailed"){get message(){return`Migration \`${this.migrationId}\` validation failed. ${this.reason}`}}class Xe extends v.TaggedError("OperationCancelled"){get message(){return`Operation cancelled.${this.reason?` Reason: ${this.reason}`:""}`}}class Rt extends v.TaggedError("UnknownScript"){get message(){return`Unknown script: \`${this.script}\`.`}}class Dt extends v.TaggedError("VscodeCliNotFound"){get message(){return`VS Code CLI (\`code\`) not found. Please install it to manage extensions.${this.cause instanceof Error?` Cause: ${this.cause.message}`:""}`}}import{defu as Or}from"defu";import*as G from"effect/Effect";import{parse as Sr}from"jsonc-parser";var U=(e,t)=>G.sync(()=>{let r=[],n=Sr(e,r,{allowTrailingComma:!0});return{errors:r,parsed:n}}).pipe(G.flatMap(({errors:r,parsed:n})=>r.length>0?G.fail(new Ft({errors:r,path:t})):G.succeed(n)));function V(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}function he(e,t={}){let{continuationIndent:r,indentation:n=2}=t,o=JSON.stringify(e,null,n).replaceAll(/"([A-Za-z_$][\w$]*)":/g,"$1:");if(!r)return o;return o.replaceAll(`
4
4
  `,`
5
- ${r}`)}var Ee=(e,t)=>G.try({catch:(r)=>new vt({cause:r}),try:()=>$r(e,t)});function Le(e={}){let t=Object.entries(e).map(([r,n])=>{if(r==="rules"&&typeof n==="object"&&n!==null&&!Array.isArray(n))return[" rules: {"," ...analyze.rules,",...Object.entries(n).map(([i,a])=>` ${i}: ${ge(a,{continuationIndent:" ",indentation:" "})},`)," },"].join(`
6
- `);return` ${r}: ${ge(n)},`});if(t.length===0)return['import type { KnipConfig } from "knip"','import analyze from "adamantite/analyze"',"","const config: KnipConfig = analyze","","export default config",""].join(`
5
+ ${r}`)}var Ee=(e,t)=>G.try({catch:(r)=>new jt({cause:r}),try:()=>Or(e,t)});function Ye(e={}){let t=Object.entries(e).map(([r,n])=>{if(r==="rules"&&typeof n==="object"&&n!==null&&!Array.isArray(n))return[" rules: {"," ...analyze.rules,",...Object.entries(n).map(([i,a])=>` ${i}: ${he(a,{continuationIndent:" ",indentation:" "})},`)," },"].join(`
6
+ `);return` ${r}: ${he(n)},`});if(t.length===0)return['import type { KnipConfig } from "knip"','import analyze from "adamantite/analyze"',"","const config: KnipConfig = analyze","","export default config",""].join(`
7
7
  `);return['import type { KnipConfig } from "knip"','import analyze from "adamantite/analyze"',"","const config: KnipConfig = {"," ...analyze,",...t,"}","","export default config",""].join(`
8
- `)}import vr from"node:process";import*as je from"effect/Effect";import*as Rt from"effect/FileSystem";import*as At from"effect/Path";var Pr=/^workspace:/,_r=/^[\^~]/;function B(e){return e.trim().replace(Pr,"").replace(_r,"")}var $=(e=vr.cwd())=>je.gen(function*(){let t=yield*Rt.FileSystem,n=(yield*At.Path).join(e,"package.json"),o=yield*t.readFileString(n).pipe(je.mapError((a)=>new D({cause:a,path:n})));return yield*w(o,n)}),Zt=(e,t)=>je.gen(function*(){let r=yield*Rt.FileSystem,o=(yield*At.Path).join(e,"package.json");yield*r.writeFileString(o,`${JSON.stringify(t,null,2)}
9
- `).pipe(je.mapError((i)=>new O({cause:i,path:o})))}),It={analyze:"adamantite analyze",check:"adamantite check","check:monorepo":"adamantite monorepo",fix:"adamantite fix","fix:monorepo":"adamantite monorepo --fix",format:"adamantite format"};function Q(e){let t=e.scripts??{},r=[];for(let[n,o]of Object.entries(It))if(t[n]===o)r.push(n);return r}var U=[{path:"knip.config.ts",type:"config"},{path:"knip.json",type:"legacy_config"},{path:"knip.jsonc",type:"legacy_config"}],Oe="6.6.1",m=_({assess:(e)=>Se.gen(function*(){let t=yield*et.FileSystem,r=yield*tt.Path,n=yield*$(e);if(!Q(n).includes("analyze"))return{applicable:!1,warnings:[]};let i=n.devDependencies?.knip??n.dependencies?.knip,a=r.join(e,U[0].path),u=r.join(e,U[1].path),y=r.join(e,U[2].path),f=yield*t.exists(a),s=yield*t.exists(u),l=yield*t.exists(y),h=f?"ts":l?"jsonc":s?"json":null,S=[],k=[];if(f&&(s||l))k.push("Found both `knip.config.ts` and `knip.json(c)`. Adamantite will use `knip.config.ts`.");if(!f&&s&&l)k.push("Found both `knip.json` and `knip.jsonc`. Multiple legacy knip configs exist; Adamantite will treat `knip.jsonc` as the source of truth when migration is needed.");if(!i)S.push({description:`Install \`knip@${Oe}\` for the managed \`analyze\` script.`,package:"knip",targetVersion:Oe,type:"install_package"});else if(B(i)!==Oe)S.push({currentVersion:i,description:`Update \`knip\` from \`${i}\` to \`${Oe}\`.`,package:"knip",targetVersion:Oe,type:"update_package"});if(h===null)S.push({description:`Create \`${U[0].path}\` for \`knip\`.`,path:U[0].path,type:"create_config"});if(h==="json"||h==="jsonc")S.push({description:`Migrate legacy \`${h==="json"?U[1].path:U[2].path}\` to \`${U[0].path}\`.`,migrationId:"legacy-knip-json",type:"run_migration"});return{actions:S,applicable:!0,warnings:k}}),config:U[0].path,create:(e)=>Se.gen(function*(){let t=yield*et.FileSystem,n=(yield*tt.Path).join(e,U[0].path);yield*t.writeFileString(n,Le()).pipe(Se.mapError((o)=>new O({cause:o,path:n})))}),exists:(e)=>Se.gen(function*(){let t=yield*et.FileSystem,r=yield*tt.Path,n=r.join(e,U[0].path),o=r.join(e,U[1].path),i=r.join(e,U[2].path),a=yield*t.exists(n),u=yield*t.exists(o),y=yield*t.exists(i),f=a?"ts":y?"jsonc":u?"json":null,s=[];if(a&&u)s.push({format:"json",path:o});if(a&&y)s.push({format:"jsonc",path:i});if(!a&&u&&y)s.push({format:"json",path:o});return{active:f===null?null:{format:f,path:f==="ts"?n:f==="jsonc"?i:o},legacy:s}}),files:U,kind:"tooling",name:"knip",version:Oe});import*as Xt from"effect/Context";import*as se from"effect/Effect";import*as Yt from"effect/Layer";import*as Ht from"effect/unstable/process/ChildProcess";class R extends Xt.Service()("CommandRunner"){static layer=Yt.succeed(this)({run:({args:e,command:t,cwd:r,stderr:n="inherit",stdin:o="ignore",stdout:i="inherit"})=>se.mapError(se.scoped(se.gen(function*(){return yield*(yield*se.fromYieldable(Ht.make(t,e,{cwd:r,stderr:n,stdin:o,stdout:i}))).exitCode})),(a)=>a.reason._tag==="NotFound"?new $t({command:t}):a)})}var Dr=$e.boolean("fix").pipe($e.withDescription("Automatically fix issues")),Nr=$e.boolean("strict").pipe($e.withDescription("Enable strict mode")),Ct=Fe.make("analyze",{fix:Dr,strict:Nr}).pipe(Fe.withDescription("Find unused dependencies, exports, and files using knip"),Fe.withHandler(({fix:e,strict:t})=>Kt.gen(function*(){let r=yield*R,n=[];if(e)n.push("--fix","--allow-remove-files");if(t)n.push("--production","--strict");let o=yield*r.run({args:n,command:m.name});if(o!==Gt.ExitCode(0))yield*new A({command:m.name,exitCode:o})})));import*as sn from"effect/Effect";import*as ve from"effect/unstable/cli/Argument";import*as Pe from"effect/unstable/cli/Command";import*as ln from"effect/unstable/process/ChildProcessSpawner";import*as L from"effect/Effect";import*as We from"effect/FileSystem";import*as Be from"effect/Path";import*as C from"effect/Effect";import*as E from"effect/Option";import{print as kr}from"esrap";import Rr from"esrap/languages/ts";import{parseSync as Ar}from"oxc-parser";var on=["typeAware","typeCheck"],Lt="`oxlint.config.ts` must export an object literal directly, with or without `defineConfig(...)`, for Adamantite to patch `options` safely.",en="`oxlint.config.ts` has an `options` property, but it is not an object literal that Adamantite can patch safely.",tn="`oxlint.config.ts` already defines `typeAware` or `typeCheck`, but not as a boolean literal Adamantite can safely patch.",an="Adamantite could not generate the required `options.typeAware` and `options.typeCheck` patch.";function rt(e=[]){return e.includes("core")?e:["core",...e]}function nn(e){return e.replaceAll(/-([a-z])/g,(t,r)=>r.toUpperCase())}function ot(e,t,r=[]){let{options:n,...o}=e,i=['import { defineConfig } from "oxlint"',...t.map((h)=>`import ${nn(h)} from "${h==="core"?"adamantite/lint":`adamantite/lint/${h}`}"`)],u=[...t.map((h)=>nn(h)),...r.map((h)=>JSON.stringify(h))],y=JSON.stringify(N(n)?{...n,typeAware:!0,typeCheck:!0}:{typeAware:!0,typeCheck:!0},null,2),f=Object.entries(o).map(([h,S])=>[h,JSON.stringify(S,null,2)]),s=`[${u.join(", ")}]`,l=[["options",y],...f,["extends",s]].map(([h,S])=>` ${h}: ${S},`).join(`
8
+ `)}import jr from"node:process";import*as ge from"effect/Effect";import*as Nt from"effect/FileSystem";import*as Pt from"effect/Path";var Fr=/^workspace:/,$r=/^[\^~]/;function B(e){return e.trim().replace(Fr,"").replace($r,"")}var $=(e=jr.cwd())=>ge.gen(function*(){let t=yield*Nt.FileSystem,n=(yield*Pt.Path).join(e,"package.json"),o=yield*t.readFileString(n).pipe(ge.mapError((a)=>new T({cause:a,path:n})));return yield*U(o,n)}),wt=(e,t)=>ge.gen(function*(){let r=yield*Nt.FileSystem,o=(yield*Pt.Path).join(e,"package.json");yield*r.writeFileString(o,`${JSON.stringify(t,null,2)}
9
+ `).pipe(ge.mapError((i)=>new S({cause:i,path:o})))});function Ke(e){return e==="bun"||e==="deno"||e==="npm"||e==="pnpm"||e==="yarn"}var Tt={analyze:"adamantite analyze",check:"adamantite check","check:monorepo":"adamantite monorepo",fix:"adamantite fix","fix:monorepo":"adamantite monorepo --fix",format:"adamantite format"};function Q(e){let t=e.scripts??{},r=[];for(let[n,o]of Object.entries(Tt))if(t[n]===o)r.push(n);return r}var M=[{path:"knip.config.ts",type:"config"},{path:"knip.json",type:"legacy_config"},{path:"knip.jsonc",type:"legacy_config"}];var y=P({assess:(e)=>Oe.gen(function*(){let t=yield*He.FileSystem,r=yield*Ge.Path,n=yield*$(e);if(!Q(n).includes("analyze"))return{applicable:!1,warnings:[]};let i=n.devDependencies?.knip??n.dependencies?.knip,a=r.join(e,M[0].path),u=r.join(e,M[1].path),d=r.join(e,M[2].path),s=yield*t.exists(a),p=yield*t.exists(u),l=yield*t.exists(d),h=s?"ts":l?"jsonc":p?"json":null,j=[],D=[];if(s&&(p||l))D.push("Found both `knip.config.ts` and `knip.json(c)`. Adamantite will use `knip.config.ts`.");if(!s&&p&&l)D.push("Found both `knip.json` and `knip.jsonc`. Multiple legacy knip configs exist; Adamantite will treat `knip.jsonc` as the source of truth when migration is needed.");if(!i)j.push({description:`Install \`knip@${"6.23.0"}\` for the managed \`analyze\` script.`,package:"knip",targetVersion:"6.23.0",type:"install_package"});else if(B(i)!=="6.23.0")j.push({currentVersion:i,description:`Update \`knip\` from \`${i}\` to \`${"6.23.0"}\`.`,package:"knip",targetVersion:"6.23.0",type:"update_package"});if(h===null)j.push({description:`Create \`${M[0].path}\` for \`knip\`.`,path:M[0].path,type:"create_config"});if(h==="json"||h==="jsonc")j.push({description:`Migrate legacy \`${h==="json"?M[1].path:M[2].path}\` to \`${M[0].path}\`.`,migrationId:"legacy-knip-json",type:"run_migration"});return{actions:j,applicable:!0,warnings:D}}),config:M[0].path,create:(e)=>Oe.gen(function*(){let t=yield*He.FileSystem,n=(yield*Ge.Path).join(e,M[0].path);yield*t.writeFileString(n,Ye()).pipe(Oe.mapError((o)=>new S({cause:o,path:n})))}),exists:(e)=>Oe.gen(function*(){let t=yield*He.FileSystem,r=yield*Ge.Path,n=r.join(e,M[0].path),o=r.join(e,M[1].path),i=r.join(e,M[2].path),a=yield*t.exists(n),u=yield*t.exists(o),d=yield*t.exists(i),s=a?"ts":d?"jsonc":u?"json":null,p=[];if(a&&u)p.push({format:"json",path:o});if(a&&d)p.push({format:"jsonc",path:i});if(!a&&u&&d)p.push({format:"json",path:o});return{active:s===null?null:{format:s,path:s==="ts"?n:s==="jsonc"?i:o},legacy:p}}),files:M,kind:"tooling",name:"knip",version:"6.23.0"});import*as Wt from"effect/Context";import*as Se from"effect/Effect";import*as Bt from"effect/Layer";import*as Qt from"effect/unstable/process/ChildProcess";class _ extends Wt.Service()("CommandRunner"){static layer=Bt.succeed(this)({run:({args:e,command:t,cwd:r,stderr:n="inherit",stdin:o="ignore",stdout:i="inherit"})=>Se.mapError(Se.scoped(Se.gen(function*(){return yield*(yield*Qt.make(t,e,{cwd:r,stderr:n,stdin:o,stdout:i})).exitCode})),(a)=>a.reason._tag==="NotFound"?new Ot({command:t}):a)})}var vr=Fe.boolean("fix").pipe(Fe.withDescription("Automatically fix issues")),Rr=Fe.boolean("strict").pipe(Fe.withDescription("Enable strict mode")),Yt=je.make("analyze",{fix:vr,strict:Rr}).pipe(je.withDescription("Find unused dependencies, exports, and files using knip"),je.withHandler(({fix:e,strict:t})=>Zt.gen(function*(){let r=yield*_,n=[];if(e)n.push("--fix","--allow-remove-files");if(t)n.push("--production","--strict");let o=yield*r.run({args:n,command:y.name});if(o!==Xt.ExitCode(0))yield*new I({command:y.name,exitCode:o})})));import*as rn from"effect/Effect";import*as $e from"effect/unstable/cli/Argument";import*as ve from"effect/unstable/cli/Command";import*as on from"effect/unstable/process/ChildProcessSpawner";import*as L from"effect/Effect";import*as Me from"effect/FileSystem";import*as xe from"effect/Path";import*as C from"effect/Effect";import*as g from"effect/Option";import{print as Dr}from"esrap";import Nr from"esrap/languages/ts";import{parseSync as Pr}from"oxc-parser";var en=["respectEslintDisableDirectives","typeAware","typeCheck"],Kt="`oxlint.config.ts` must export an object literal directly, with or without `defineConfig(...)`, for Adamantite to patch `options` safely.",Ht="`oxlint.config.ts` has an `options` property, but it is not an object literal that Adamantite can patch safely.",Gt="`oxlint.config.ts` has an `options` object Adamantite cannot patch safely. Make sure each required option is a plain `key: true | false` property—avoid spreads (`...rest`), computed keys (`[name]: ...`), duplicate keys, methods/getters/setters, and non-boolean-literal values.",tn="Adamantite could not generate the required `options` patch.";function Le(e=[]){return e.includes("core")?e:["core",...e]}function Ct(e){return e.replaceAll(/-([a-z])/g,(t,r)=>r.toUpperCase())}function et(e,t,r=[]){let{options:n,...o}=e,i=['import { defineConfig } from "oxlint"',...t.map((h)=>`import ${Ct(h)} from "${h==="core"?"adamantite/lint":`adamantite/lint/${h}`}"`)],u=[...t.map((h)=>Ct(h)),...r.map((h)=>JSON.stringify(h))],d=JSON.stringify(V(n)?{...n,respectEslintDisableDirectives:!0,typeAware:!0,typeCheck:!0}:{respectEslintDisableDirectives:!0,typeAware:!0,typeCheck:!0},null,2),s=Object.entries(o).map(([h,j])=>[h,JSON.stringify(j,null,2)]),p=`[${u.join(", ")}]`,l=[["options",d],...s,["extends",p]].map(([h,j])=>` ${h}: ${j},`).join(`
10
10
  `);return[...i,"","export default defineConfig({",l,"})",""].join(`
11
- `)}function nt(e){return N(e)&&e.type==="ObjectExpression"&&Array.isArray(e.properties)}function Vt(e){return N(e)&&e.type==="Property"}function zt(e){return C.try({catch:()=>null,try:()=>Ar("oxlint.config.ts",e,{astType:"ts",lang:"ts",sourceType:"module"})}).pipe(C.match({onFailure:()=>E.none(),onSuccess:(t)=>t.errors.length===0?E.fromNullishOr(t.program):E.none()}))}function fn(e){let{code:t}=kr(e,Rr({quotes:"double"}));return t.endsWith(`
11
+ `)}function Ce(e){return V(e)&&e.type==="ObjectExpression"&&Array.isArray(e.properties)}function Vt(e){return V(e)&&e.type==="Property"}function _t(e){return C.try({catch:()=>null,try:()=>Pr("oxlint.config.ts",e,{astType:"ts",lang:"ts",sourceType:"module"})}).pipe(C.match({onFailure:()=>g.none(),onSuccess:(t)=>t.errors.length===0?g.fromNullishOr(t.program):g.none()}))}function nn(e){let{code:t}=Dr(e,Nr({quotes:"double"}));return t.endsWith(`
12
12
  `)?t:`${t}
13
- `}function rn(e){if(e.type==="Identifier")return e.name;if(e.type==="Literal"&&typeof e.value==="string")return e.value;return null}function Mt(e){let t=e.body.filter((i)=>i.type==="ExportDefaultDeclaration");if(t.length!==1)return E.none();let[r]=t;if(!r)return E.none();let n=r.declaration;if(nt(n))return E.fromNullishOr(n);if(n.type!=="CallExpression")return E.none();if(n.callee.type!=="Identifier"||n.callee.name!=="defineConfig")return E.none();if(n.arguments.length!==1)return E.none();let[o]=n.arguments;if(nt(o))return E.fromNullishOr(o);return E.none()}function wt(e,t){let r=null;for(let n of e.properties){if(n.type==="SpreadElement")return{status:"manual"};if(!Vt(n))return{status:"manual"};if(n.computed)return{status:"manual"};if(n.method||n.kind!=="init"){if(rn(n.key)===t)return{status:"manual"};continue}if(rn(n.key)!==t)continue;if(r)return{status:"manual"};r=n}if(!r)return{status:"missing"};return{property:r,status:"found"}}function Ir(e){let t=`export default { options: { ${e.map((r)=>`${r}: true`).join(", ")} } }
14
- `;return zt(t).pipe(C.map((r)=>{if(E.isNone(r))return E.none();let n=Mt(r.value);if(E.isNone(n))return E.none();let o=wt(n.value,"options");if(o.status!=="found")return E.none();if(!nt(o.property.value))return E.none();let i=o.property.value.properties.filter(Vt);return i.length===o.property.value.properties.length?E.fromNullishOr(i):E.none()}))}function Vr(){let e=`export default { options: { ${on.map((t)=>`${t}: true`).join(", ")} } }
15
- `;return zt(e).pipe(C.map((t)=>{if(E.isNone(t))return E.none();let r=Mt(t.value);if(E.isNone(r)||r.value.properties.length!==1)return E.none();let[n]=r.value.properties;if(!n||!Vt(n)||n.computed||n.method||n.kind!=="init")return E.none();return E.fromNullishOr(n)}))}function zr(e,t){return C.gen(function*(){let r=[],n=!1;for(let o of on){let i=wt(t,o);if(i.status==="manual")return{kind:"manual",reason:tn};if(i.status==="missing"){r.push(o);continue}let a=i.property.value;if(a.type!=="Literal"||typeof a.value!=="boolean")return{kind:"manual",reason:tn};if(a.value)continue;a.raw="true",a.value=!0,n=!0}if(r.length>0){let o=yield*Ir(r);if(E.isNone(o))return{kind:"manual",reason:an};t.properties.unshift(...o.value),n=!0}if(!n)return{kind:"configured"};return{kind:"patchable",updatedContent:fn(e)}})}function Ut(e){return C.gen(function*(){let t=yield*zt(e);if(E.isNone(t))return{kind:"manual",reason:Lt};let r=Mt(t.value);if(E.isNone(r))return{kind:"manual",reason:Lt};let n=wt(r.value,"options");if(n.status==="manual")return{kind:"manual",reason:en};if(n.status==="missing"){let o=yield*Vr();if(E.isNone(o))return{kind:"manual",reason:an};return r.value.properties.unshift(o.value),{kind:"patchable",updatedContent:fn(t.value)}}if(!nt(n.property.value))return{kind:"manual",reason:en};return yield*zr(t.value,n.property.value)})}var I=[{path:"oxlint.config.ts",type:"config"},{path:".oxlintrc.json",type:"legacy_config"}],Te="1.61.0",c=_({assess:(e)=>L.gen(function*(){let t=yield*We.FileSystem,r=yield*Be.Path,n=yield*$(e),o=Q(n);if(!o.includes("check")&&!o.includes("fix"))return{applicable:!1,warnings:[]};let i=n.devDependencies?.oxlint??n.dependencies?.oxlint,a=r.join(e,I[0].path),u=r.join(e,I[1].path),y=yield*t.exists(a),f=yield*t.exists(u),s={active:y?{format:"ts",path:a}:f?{format:"json",path:u}:null,legacy:y&&f?[{format:"json",path:u}]:[]},l=[],h=[];if(s.active?.format==="ts"&&s.legacy.length>0)h.push("Found both `oxlint.config.ts` and `.oxlintrc.json`. Adamantite will use `oxlint.config.ts`.");if(!i)l.push({description:`Install \`oxlint@${Te}\` for the managed lint scripts.`,package:"oxlint",targetVersion:Te,type:"install_package"});else if(B(i)!==Te)l.push({currentVersion:i,description:`Update \`oxlint\` from \`${i}\` to \`${Te}\`.`,package:"oxlint",targetVersion:Te,type:"update_package"});if(s.active===null)l.push({description:`Create \`${I[0].path}\` for \`oxlint\`.`,path:I[0].path,type:"create_config"});if(s.active?.format==="json")l.push({description:`Migrate legacy \`${I[1].path}\` to \`${I[0].path}\`.`,migrationId:"legacy-oxlint-json",type:"run_migration"});if(s.active?.format==="ts"){let S=yield*t.readFileString(a).pipe(L.mapError((P)=>new D({cause:P,path:a}))),k=yield*Ut(S);if(k.kind==="patchable")l.push({description:"Update `oxlint.config.ts` to enable `options.typeAware` and `options.typeCheck`.",path:I[0].path,type:"update_config"});if(k.kind==="manual")l.push({description:"Manually update `oxlint.config.ts` to enable `options.typeAware` and `options.typeCheck`; Adamantite cannot patch the current file shape safely.",path:I[0].path,type:"manual_fix"})}return{actions:l,applicable:!0,warnings:h}}),config:I[0].path,create:(e,t=[])=>L.gen(function*(){let r=yield*We.FileSystem,o=(yield*Be.Path).join(e,I[0].path),i=ot({},rt(t));yield*r.writeFileString(o,i).pipe(L.mapError((a)=>new O({cause:a,path:o})))}),exists:(e)=>L.gen(function*(){let t=yield*We.FileSystem,r=yield*Be.Path,n=r.join(e,I[0].path),o=r.join(e,I[1].path),i=yield*t.exists(n),a=yield*t.exists(o),u=i?"ts":a?"json":null,y=[];if(i&&a)y.push({format:"json",path:o});return{active:u===null?null:{format:u,path:u==="ts"?n:o},legacy:y}}),files:I,kind:"tooling",name:"oxlint",update:(e)=>L.gen(function*(){let t=yield*We.FileSystem,n=(yield*Be.Path).join(e,I[0].path);if(!(yield*t.exists(n)))return yield*new _t({path:I[0].path});let o=yield*t.readFileString(n).pipe(L.mapError((a)=>new D({cause:a,path:n}))),i=yield*Ut(o);if(i.kind==="configured")return;if(i.kind==="manual")return yield*new Dt({path:I[0].path,reason:i.reason});yield*t.writeFileString(n,i.updatedContent).pipe(L.mapError((a)=>new O({cause:a,path:n})))}),version:Te});var Mr=ve.file("files",{mustExist:!0}).pipe(ve.withDescription("Specific files to lint (optional)"),ve.variadic()),pn=Pe.make("check",{files:Mr}).pipe(Pe.withDescription("Find issues and type errors in code using oxlint"),Pe.withHandler(({files:e})=>sn.gen(function*(){let r=yield*(yield*R).run({args:[...e],command:c.name});if(r!==ln.ExitCode(0))yield*new A({command:c.name,exitCode:r})})));import Gr from"node:process";import*as Ae from"effect/Effect";import*as Ie from"effect/unstable/cli/Command";import*as ht from"effect/unstable/cli/Flag";import*as Wt from"effect/unstable/process/ChildProcessSpawner";import*as De from"effect/Effect";import*as at from"effect/FileSystem";import*as ft from"effect/Path";var wr=new Set(["sortImports","sortPackageJson","sortTailwindcss"]);function Ur(e){let t=e.split(`
13
+ `}function Lt(e){if(e.type==="Identifier")return e.name;if(e.type==="Literal"&&typeof e.value==="string")return e.value;return null}function It(e){let t=e.body.filter((i)=>i.type==="ExportDefaultDeclaration");if(t.length!==1)return g.none();let[r]=t;if(!r)return g.none();let n=r.declaration;if(Ce(n))return g.fromNullishOr(n);if(n.type!=="CallExpression")return g.none();if(n.callee.type!=="Identifier"||n.callee.name!=="defineConfig")return g.none();if(n.arguments.length!==1)return g.none();let[o]=n.arguments;if(Ce(o))return g.fromNullishOr(o);return g.none()}function kt(e,t){let r=null;for(let n of e.properties){if(n.type==="SpreadElement")return{status:"manual"};if(!Vt(n))return{status:"manual"};if(n.computed)return{status:"manual"};if(n.method||n.kind!=="init"){if(Lt(n.key)===t)return{status:"manual"};continue}if(Lt(n.key)!==t)continue;if(r)return{status:"manual"};r=n}if(!r)return{status:"missing"};return{property:r,status:"found"}}function Tr(e){let t=`export default { options: { ${e.map((r)=>`${r}: true`).join(", ")} } }
14
+ `;return _t(t).pipe(C.map((r)=>{if(g.isNone(r))return g.none();let n=It(r.value);if(g.isNone(n))return g.none();let o=kt(n.value,"options");if(o.status!=="found")return g.none();if(!Ce(o.property.value))return g.none();let i=o.property.value.properties.filter(Vt);return i.length===o.property.value.properties.length?g.fromNullishOr(i):g.none()}))}function Vr(){let e=`export default { options: { ${en.map((t)=>`${t}: true`).join(", ")} } }
15
+ `;return _t(e).pipe(C.map((t)=>{if(g.isNone(t))return g.none();let r=It(t.value);if(g.isNone(r)||r.value.properties.length!==1)return g.none();let[n]=r.value.properties;if(!n||!Vt(n)||n.computed||n.method||n.kind!=="init")return g.none();return g.fromNullishOr(n)}))}function _r(e,t){return C.gen(function*(){let r=[],n=!1;for(let o of en){let i=kt(t,o);if(i.status==="manual")return{kind:"manual",reason:Gt};if(i.status==="missing"){r.push(o);continue}let a=i.property.value;if(a.type!=="Literal"||typeof a.value!=="boolean")return{kind:"manual",reason:Gt};if(a.value)continue;a.raw="true",a.value=!0,n=!0}if(r.length>0){let o=yield*Tr(r);if(g.isNone(o))return{kind:"manual",reason:tn};t.properties.unshift(...o.value),n=!0}if(!n)return{kind:"configured"};return{kind:"patchable",updatedContent:nn(e)}})}function qt(e){return C.gen(function*(){let t=yield*_t(e);if(g.isNone(t))return{kind:"manual",reason:Kt};let r=It(t.value);if(g.isNone(r))return{kind:"manual",reason:Kt};let n=kt(r.value,"options");if(n.status==="manual")return{kind:"manual",reason:Ht};if(n.status==="missing"){let o=yield*Vr();if(g.isNone(o))return{kind:"manual",reason:tn};return r.value.properties.unshift(o.value),{kind:"patchable",updatedContent:nn(t.value)}}if(!Ce(n.property.value))return{kind:"manual",reason:Ht};return yield*_r(t.value,n.property.value)})}var k=[{path:"oxlint.config.ts",type:"config"},{path:".oxlintrc.json",type:"legacy_config"}];var c=P({assess:(e)=>L.gen(function*(){let t=yield*Me.FileSystem,r=yield*xe.Path,n=yield*$(e),o=Q(n);if(!o.includes("check")&&!o.includes("fix"))return{applicable:!1,warnings:[]};let i=n.devDependencies?.oxlint??n.dependencies?.oxlint,a=r.join(e,k[0].path),u=r.join(e,k[1].path),d=yield*t.exists(a),s=yield*t.exists(u),p={active:d?{format:"ts",path:a}:s?{format:"json",path:u}:null,legacy:d&&s?[{format:"json",path:u}]:[]},l=[],h=[];if(p.active?.format==="ts"&&p.legacy.length>0)h.push("Found both `oxlint.config.ts` and `.oxlintrc.json`. Adamantite will use `oxlint.config.ts`.");if(!i)l.push({description:`Install \`oxlint@${"1.72.0"}\` for the managed lint scripts.`,package:"oxlint",targetVersion:"1.72.0",type:"install_package"});else if(B(i)!=="1.72.0")l.push({currentVersion:i,description:`Update \`oxlint\` from \`${i}\` to \`${"1.72.0"}\`.`,package:"oxlint",targetVersion:"1.72.0",type:"update_package"});if(p.active===null)l.push({description:`Create \`${k[0].path}\` for \`oxlint\`.`,path:k[0].path,type:"create_config"});if(p.active?.format==="json")l.push({description:`Migrate legacy \`${k[1].path}\` to \`${k[0].path}\`.`,migrationId:"legacy-oxlint-json",type:"run_migration"});if(p.active?.format==="ts"){let j=yield*t.readFileString(a).pipe(L.mapError((N)=>new T({cause:N,path:a}))),D=yield*qt(j);if(D.kind==="patchable")l.push({description:"Update `oxlint.config.ts` with Adamantite's required options.",path:k[0].path,type:"update_config"});if(D.kind==="manual")l.push({description:"Manually update `oxlint.config.ts` with Adamantite's required options; Adamantite cannot patch the current file shape safely.",path:k[0].path,type:"manual_fix"})}return{actions:l,applicable:!0,warnings:h}}),config:k[0].path,create:(e,t=[])=>L.gen(function*(){let r=yield*Me.FileSystem,o=(yield*xe.Path).join(e,k[0].path),i=et({},Le(t));yield*r.writeFileString(o,i).pipe(L.mapError((a)=>new S({cause:a,path:o})))}),exists:(e)=>L.gen(function*(){let t=yield*Me.FileSystem,r=yield*xe.Path,n=r.join(e,k[0].path),o=r.join(e,k[1].path),i=yield*t.exists(n),a=yield*t.exists(o),u=i?"ts":a?"json":null,d=[];if(i&&a)d.push({format:"json",path:o});return{active:u===null?null:{format:u,path:u==="ts"?n:o},legacy:d}}),files:k,kind:"tooling",name:"oxlint",update:(e)=>L.gen(function*(){let t=yield*Me.FileSystem,n=(yield*xe.Path).join(e,k[0].path);if(!(yield*t.exists(n)))return yield*new $t({path:k[0].path});let o=yield*t.readFileString(n).pipe(L.mapError((a)=>new T({cause:a,path:n}))),i=yield*qt(o);if(i.kind==="configured")return;if(i.kind==="manual")return yield*new vt({path:k[0].path,reason:i.reason});yield*t.writeFileString(n,i.updatedContent).pipe(L.mapError((a)=>new S({cause:a,path:n})))}),version:"1.72.0"});var Ir=$e.file("files",{mustExist:!0}).pipe($e.withDescription("Specific files to lint (optional)"),$e.variadic()),an=ve.make("check",{files:Ir}).pipe(ve.withDescription("Find issues and type errors in code using oxlint"),ve.withHandler(({files:e})=>rn.gen(function*(){let r=yield*(yield*_).run({args:[...e],command:c.name});if(r!==on.ExitCode(0))yield*new I({command:c.name,exitCode:r})})));import Xr from"node:process";import*as Ne from"effect/Effect";import*as Pe from"effect/unstable/cli/Command";import*as ct from"effect/unstable/cli/Flag";import*as xt from"effect/unstable/process/ChildProcessSpawner";import*as Re from"effect/Effect";import*as nt from"effect/FileSystem";import*as rt from"effect/Path";var kr=new Set(["sortImports","sortPackageJson","sortTailwindcss"]);function qr(e){let t=e.split(`
16
16
  `);if(t.length===1)return e.slice(1,-1).trim();return t.slice(1,-1).map((r)=>` ${r.trimStart()}`).join(`
17
- `)}function br(e,t){let r=ge(t),n=Ur(r);return[` ${e}: {`,` ...format.${e},`,...n===""?[]:[n]," },"].join(`
18
- `)}function it(e={}){let t=Object.entries(e).map(([r,n])=>{if(wr.has(r)&&N(n))return br(r,n);let o=ge(n,{continuationIndent:" "});return` ${r}: ${o},`});if(t.length===0)return['import { defineConfig } from "oxfmt"','import format from "adamantite/format"',"","export default defineConfig(format)",""].join(`
17
+ `)}function zr(e,t){let r=he(t),n=qr(r);return[` ${e}: {`,` ...format.${e},`,...n===""?[]:[n]," },"].join(`
18
+ `)}function tt(e={}){let t=Object.entries(e).map(([r,n])=>{if(kr.has(r)&&V(n))return zr(r,n);let o=he(n,{continuationIndent:" "});return` ${r}: ${o},`});if(t.length===0)return['import { defineConfig } from "oxfmt"','import format from "adamantite/format"',"","export default defineConfig(format)",""].join(`
19
19
  `);return['import { defineConfig } from "oxfmt"','import format from "adamantite/format"',"","export default defineConfig({"," ...format,",...t,"})",""].join(`
20
- `)}var b=[{path:"oxfmt.config.ts",type:"config"},{path:".oxfmtrc.json",type:"legacy_config"},{path:".oxfmtrc.jsonc",type:"legacy_config"}],_e="0.46.0",d=_({assess:(e)=>De.gen(function*(){let t=yield*at.FileSystem,r=yield*ft.Path,n=yield*$(e);if(!Q(n).includes("format"))return{applicable:!1,warnings:[]};let i=n.devDependencies?.oxfmt??n.dependencies?.oxfmt,a=r.join(e,b[0].path),u=r.join(e,b[1].path),y=r.join(e,b[2].path),f=yield*t.exists(a),s=yield*t.exists(u),l=yield*t.exists(y),h=f?"ts":l?"jsonc":s?"json":null,S=[],k=[];if(f&&(s||l))k.push("Found both `oxfmt.config.ts` and `.oxfmtrc.json(c)`. Adamantite will use `oxfmt.config.ts`.");if(!f&&s&&l)k.push("Found both `.oxfmtrc.json` and `.oxfmtrc.jsonc`. Multiple legacy oxfmt configs exist; Adamantite will treat `.oxfmtrc.jsonc` as the source of truth when migration is needed.");if(!i)S.push({description:`Install \`oxfmt@${_e}\` for the managed \`format\` script.`,package:"oxfmt",targetVersion:_e,type:"install_package"});else if(B(i)!==_e)S.push({currentVersion:i,description:`Update \`oxfmt\` from \`${i}\` to \`${_e}\`.`,package:"oxfmt",targetVersion:_e,type:"update_package"});if(h===null)S.push({description:`Create \`${b[0].path}\` for \`oxfmt\`.`,path:b[0].path,type:"create_config"});if(h==="json"||h==="jsonc")S.push({description:`Migrate legacy \`${h==="json"?b[1].path:b[2].path}\` to \`${b[0].path}\`.`,migrationId:"legacy-oxfmt-json",type:"run_migration"});return{actions:S,applicable:!0,warnings:k}}),config:b[0].path,create:(e)=>De.gen(function*(){let t=yield*at.FileSystem,n=(yield*ft.Path).join(e,b[0].path);yield*t.writeFileString(n,it()).pipe(De.mapError((o)=>new O({cause:o,path:n})))}),exists:(e)=>De.gen(function*(){let t=yield*at.FileSystem,r=yield*ft.Path,n=r.join(e,b[0].path),o=r.join(e,b[1].path),i=r.join(e,b[2].path),a=yield*t.exists(n),u=yield*t.exists(o),y=yield*t.exists(i),f=a?"ts":y?"jsonc":u?"json":null,s=[];if(a&&u)s.push({format:"json",path:o});if(a&&y)s.push({format:"jsonc",path:i});if(!a&&u&&y)s.push({format:"json",path:o});return{active:f===null?null:{format:f,path:f==="ts"?n:f==="jsonc"?i:o},legacy:s}}),files:b,kind:"tooling",name:"oxfmt",version:_e});import*as un from"effect/Effect";var Ne="1.11.1",K=_({assess:(e)=>un.gen(function*(){let t=yield*$(e),r=Q(t);if(!r.includes("check:monorepo")&&!r.includes("fix:monorepo"))return{applicable:!1,warnings:[]};let n=t.devDependencies?.sherif??t.dependencies?.sherif,o=[];if(!n)o.push({description:`Install \`sherif@${Ne}\` for the managed monorepo scripts.`,package:"sherif",targetVersion:Ne,type:"install_package"});else if(B(n)!==Ne)o.push({currentVersion:n,description:`Update \`sherif\` from \`${n}\` to \`${Ne}\`.`,package:"sherif",targetVersion:Ne,type:"update_package"});return{actions:o,applicable:!0,warnings:[]}}),kind:"tooling",name:"sherif",version:Ne});import*as cn from"effect/Effect";var ke="0.21.1",le=_({assess:(e)=>cn.gen(function*(){let t=yield*$(e),r=Q(t);if(!r.includes("check")&&!r.includes("fix"))return{applicable:!1,warnings:[]};let n=t.devDependencies?.["oxlint-tsgolint"]??t.dependencies?.["oxlint-tsgolint"],o=[];if(!n)o.push({description:`Install \`oxlint-tsgolint@${ke}\` for the managed lint scripts.`,package:"oxlint-tsgolint",targetVersion:ke,type:"install_package"});else if(B(n)!==ke)o.push({currentVersion:n,description:`Update \`oxlint-tsgolint\` from \`${n}\` to \`${ke}\`.`,package:"oxlint-tsgolint",targetVersion:ke,type:"update_package"});return{actions:o,applicable:!0,warnings:[]}}),kind:"tooling",name:"oxlint-tsgolint",version:ke});import*as z from"effect/Effect";import*as yn from"effect/Exit";import*as mn from"effect/FileSystem";import*as dn from"effect/Path";function pe(e){return e}function Qe(e,t,r){return z.gen(function*(){let n=yield*mn.FileSystem,o=yield*dn.Path,i=e.files??[],a=new Map;for(let y of i){let f=o.join(t.cwd,y);if(yield*n.exists(f)){let l=yield*n.readFileString(f);a.set(f,l)}else a.set(f,null)}let u=yield*z.exit(e.migrate(t).pipe(z.andThen(()=>e.validate?.(t)??z.void)));if(yn.isSuccess(u))return;if(r?.onRestore)yield*r.onRestore;for(let[y,f]of a){if(f!==null){yield*n.writeFileString(y,f).pipe(z.ignore);continue}if(!(yield*n.exists(y).pipe(z.orElseSucceed(()=>!1))))continue;yield*n.remove(y).pipe(z.ignore)}return yield*z.failCause(u.cause)})}import*as ee from"effect/Effect";import*as En from"effect/FileSystem";import*as jn from"effect/Path";import*as v from"@clack/prompts";import*as hn from"effect/Context";import*as q from"effect/Effect";import*as gn from"effect/Layer";class g extends hn.Service()("Prompter"){static layer=gn.succeed(this)({cancel:(e)=>q.sync(()=>{v.cancel(e)}),confirm:(e)=>q.promise(()=>v.confirm(e)).pipe(q.filterOrFail((t)=>!v.isCancel(t),()=>new Ce({}))),intro:(e)=>q.sync(()=>{v.intro(e)}),log:{error:(e)=>q.sync(()=>{v.log.error(e)}),info:(e)=>q.sync(()=>{v.log.info(e)}),success:(e)=>q.sync(()=>{v.log.success(e)}),warning:(e)=>q.sync(()=>{v.log.warning(e)})},multiselect:(e)=>q.promise(()=>v.multiselect(e)).pipe(q.filterOrFail((t)=>!v.isCancel(t),()=>new Ce({}))),outro:(e)=>q.sync(()=>{v.outro(e)}),spinner:()=>v.spinner()})}function On(){return[m.files[1].path,m.files[2].path]}function qr(e){let t=On();return`Migrating legacy \`${e==="json"?t[0]:t[1]}\` configuration to \`${m.config}\`.`}function Jr(e){return ee.gen(function*(){let t=yield*En.FileSystem,r=yield*jn.Path,n=yield*m.exists(e);if(n.active?.format!=="json"&&n.active?.format!=="jsonc")return;let o=n.active.path,i=r.join(e,m.config),a=yield*t.readFileString(o).pipe(ee.mapError((l)=>new D({cause:l,path:o}))),u=yield*w(a,o);if(!N(u))return yield*new x({path:o});let{$schema:y,...f}=u;yield*t.writeFileString(i,Le(f)).pipe(ee.mapError((l)=>new O({cause:l,path:i}))),yield*t.remove(o).pipe(ee.mapError((l)=>new re({cause:l,path:o})));let s=n.legacy[0]?.path??null;if(s&&s!==o)yield*t.remove(s).pipe(ee.mapError((l)=>new re({cause:l,path:s})))})}var bt=pe({check:(e)=>ee.gen(function*(){let t=yield*m.exists(e.cwd),r=[];if(t.active?.format==="ts"&&t.legacy.length>0)r.push("Found both `knip.config.ts` and `knip.json(c)`. Adamantite will use `knip.config.ts`.");if(t.active&&t.active.format!=="ts"&&t.legacy.length>0)r.push("Found both `knip.json` and `knip.jsonc`. Multiple legacy knip configs exist; Adamantite will treat `knip.jsonc` as the source of truth when migration is needed.");if(t.active?.format==="json"||t.active?.format==="jsonc")return{applicable:!0,summary:qr(t.active.format),warnings:r};if(t.active?.format==="ts")return{applicable:!0,warnings:r};return{applicable:!1,warnings:r}}),files:[m.config,...On()],id:"legacy-knip-json",migrate:(e)=>ee.gen(function*(){let r=(yield*g).spinner(),o=(yield*m.exists(e.cwd)).active?.path.endsWith(m.files[2].path)?m.files[2].path:m.files[1].path;r.start(`Migrating \`${o}\` to \`${m.config}\`...`),yield*Jr(e.cwd),r.stop(`Knip config migrated to \`${m.config}\` successfully.`)}),tags:["update"],title:"Legacy Knip JSON config",validate:(e)=>ee.gen(function*(){if((yield*m.exists(e.cwd)).active?.format!=="ts")return yield*new H({migrationId:"legacy-knip-json",reason:`\`${m.config}\` is not the active Knip config.`})})});import*as te from"effect/Effect";import*as Sn from"effect/FileSystem";import*as Fn from"effect/Path";function $n(){return[d.files[1].path,d.files[2].path]}function xr(e){let t=$n();return`Migrating legacy \`${e==="json"?t[0]:t[1]}\` configuration to \`${d.config}\`.`}function Wr(e){return te.gen(function*(){let t=yield*Sn.FileSystem,r=yield*Fn.Path,n=yield*d.exists(e);if(n.active?.format!=="json"&&n.active?.format!=="jsonc")return;let o=n.active.path,i=r.join(e,d.config),a=yield*t.readFileString(o).pipe(te.mapError((l)=>new D({cause:l,path:o}))),u=yield*w(a,o);if(!N(u))return yield*new x({path:o});let{$schema:y,...f}=u;yield*t.writeFileString(i,it(f)).pipe(te.mapError((l)=>new O({cause:l,path:i}))),yield*t.remove(o).pipe(te.mapError((l)=>new re({cause:l,path:o})));let s=n.legacy[0]?.path??null;if(s&&s!==o)yield*t.remove(s).pipe(te.mapError((l)=>new re({cause:l,path:s})))})}var qt=pe({check:(e)=>te.gen(function*(){let t=yield*d.exists(e.cwd),r=[];if(t.active?.format==="ts"&&t.legacy.length>0)r.push("Found both `oxfmt.config.ts` and `.oxfmtrc.json(c)`. Adamantite will use `oxfmt.config.ts`.");if(t.active&&t.active.format!=="ts"&&t.legacy.length>0)r.push("Found both `.oxfmtrc.json` and `.oxfmtrc.jsonc`. Multiple legacy oxfmt configs exist; Adamantite will treat `.oxfmtrc.jsonc` as the source of truth when migration is needed.");if(t.active?.format==="json"||t.active?.format==="jsonc")return{applicable:!0,summary:xr(t.active.format),warnings:r};if(t.active?.format==="ts")return{applicable:!0,warnings:r};return{applicable:!1,warnings:r}}),files:[d.config,...$n()],id:"legacy-oxfmt-json",migrate:(e)=>te.gen(function*(){let r=(yield*g).spinner(),o=(yield*d.exists(e.cwd)).active?.path.endsWith(d.files[2].path)?d.files[2].path:d.files[1].path;r.start(`Migrating \`${o}\` to \`${d.config}\`...`),yield*Wr(e.cwd),r.stop(`Oxfmt config migrated to \`${d.config}\` successfully.`)}),tags:["update"],title:"Legacy oxfmt JSON config",validate:(e)=>te.gen(function*(){if((yield*d.exists(e.cwd)).active?.format!=="ts")return yield*new H({migrationId:"legacy-oxfmt-json",reason:`\`${d.config}\` is not the active oxfmt config.`})})});import*as oe from"effect/Effect";import*as Tn from"effect/FileSystem";import*as vn from"effect/Path";function Br(e){return oe.gen(function*(){let t=yield*Tn.FileSystem,r=yield*vn.Path,n=yield*c.exists(e);if(n.active?.format!=="json")return;let o=n.active.path,i=r.join(e,c.config),a=yield*t.readFileString(o).pipe(oe.mapError((P)=>new D({cause:P,path:o}))),u=yield*w(a,o);if(!N(u))return yield*new x({path:o});let{$schema:y,...f}=u,s=Array.isArray(f.extends)?f.extends.filter((P)=>typeof P==="string"):typeof f.extends==="string"?[f.extends]:[],l=new Set(rt()),h=new Set;for(let P of s){let J=P.match(/^(?:\.\/)?node_modules\/adamantite\/presets\/lint\/([a-z0-9-]+)\.(?:json|ts)$/),p=P.match(/^adamantite\/lint(?:\/([a-z0-9-]+))?$/),F=J?.[1]??(p?p[1]??"core":null);if(F)l.add(F);else h.add(P)}let{extends:S,...k}=f;yield*t.writeFileString(i,ot(k,[...l],[...h])).pipe(oe.mapError((P)=>new O({cause:P,path:i}))),yield*t.remove(o).pipe(oe.mapError((P)=>new re({cause:P,path:o})))})}var Jt=pe({id:"legacy-oxlint-json",files:[c.config,c.files[1].path],tags:["update"],title:"Legacy oxlint JSON config",check:(e)=>oe.gen(function*(){let t=yield*c.exists(e.cwd),r=t.active?.format==="ts"&&t.legacy.length>0?[`Found both \`${c.config}\` and \`${c.files[1].path}\`. Adamantite will use \`${c.config}\`.`]:[];if(t.active?.format==="json")return{applicable:!0,summary:`Migrating legacy \`${c.files[1].path}\` configuration to \`${c.config}\`.`,warnings:r};if(t.active?.format==="ts")return{applicable:!0,warnings:r};return{applicable:!1,warnings:r}}),migrate:(e)=>oe.gen(function*(){let r=(yield*g).spinner();r.start(`Migrating \`${c.files[1].path}\` to \`${c.config}\`...`),yield*Br(e.cwd),r.stop(`Oxlint config migrated to \`${c.config}\` successfully.`)}),validate:(e)=>oe.gen(function*(){if((yield*c.exists(e.cwd)).active?.format!=="ts")return yield*new H({migrationId:"legacy-oxlint-json",reason:`\`${c.config}\` is not the active oxlint config.`})})});import*as W from"effect/Effect";import*as xt from"effect/Exit";import*as de from"effect/Effect";import*as ut from"effect/FileSystem";import*as ct from"effect/Path";import*as st from"effect/Effect";import*as Pn from"effect/FileSystem";var _n=(e)=>st.gen(function*(){yield*(yield*Pn.FileSystem).makeDirectory(e,{recursive:!0}).pipe(st.mapError((r)=>new me({cause:r,path:e})))});import{runScriptCommand as Qr}from"nypm";var Dn=[{name:"check",script:"check"},{args:["--check"],name:"format",script:"format"},{name:"monorepo",script:"check:monorepo"},{name:"analyze",script:"analyze"}];function Nn(e,t){let r=[];for(let n of Dn){if(!t.includes(n.script))continue;r.push({command:Qr(e,n.script,{args:n.args}),name:n.name})}return r}function lt(e){return Dn.some((t)=>e.includes(t.script))}var Zr={bun:` - name: Setup Node.js
20
+ `)}var x=[{path:"oxfmt.config.ts",type:"config"},{path:".oxfmtrc.json",type:"legacy_config"},{path:".oxfmtrc.jsonc",type:"legacy_config"}];var m=P({assess:(e)=>Re.gen(function*(){let t=yield*nt.FileSystem,r=yield*rt.Path,n=yield*$(e);if(!Q(n).includes("format"))return{applicable:!1,warnings:[]};let i=n.devDependencies?.oxfmt??n.dependencies?.oxfmt,a=r.join(e,x[0].path),u=r.join(e,x[1].path),d=r.join(e,x[2].path),s=yield*t.exists(a),p=yield*t.exists(u),l=yield*t.exists(d),h=s?"ts":l?"jsonc":p?"json":null,j=[],D=[];if(s&&(p||l))D.push("Found both `oxfmt.config.ts` and `.oxfmtrc.json(c)`. Adamantite will use `oxfmt.config.ts`.");if(!s&&p&&l)D.push("Found both `.oxfmtrc.json` and `.oxfmtrc.jsonc`. Multiple legacy oxfmt configs exist; Adamantite will treat `.oxfmtrc.jsonc` as the source of truth when migration is needed.");if(!i)j.push({description:`Install \`oxfmt@${"0.57.0"}\` for the managed \`format\` script.`,package:"oxfmt",targetVersion:"0.57.0",type:"install_package"});else if(B(i)!=="0.57.0")j.push({currentVersion:i,description:`Update \`oxfmt\` from \`${i}\` to \`${"0.57.0"}\`.`,package:"oxfmt",targetVersion:"0.57.0",type:"update_package"});if(h===null)j.push({description:`Create \`${x[0].path}\` for \`oxfmt\`.`,path:x[0].path,type:"create_config"});if(h==="json"||h==="jsonc")j.push({description:`Migrate legacy \`${h==="json"?x[1].path:x[2].path}\` to \`${x[0].path}\`.`,migrationId:"legacy-oxfmt-json",type:"run_migration"});return{actions:j,applicable:!0,warnings:D}}),config:x[0].path,create:(e)=>Re.gen(function*(){let t=yield*nt.FileSystem,n=(yield*rt.Path).join(e,x[0].path);yield*t.writeFileString(n,tt()).pipe(Re.mapError((o)=>new S({cause:o,path:n})))}),exists:(e)=>Re.gen(function*(){let t=yield*nt.FileSystem,r=yield*rt.Path,n=r.join(e,x[0].path),o=r.join(e,x[1].path),i=r.join(e,x[2].path),a=yield*t.exists(n),u=yield*t.exists(o),d=yield*t.exists(i),s=a?"ts":d?"jsonc":u?"json":null,p=[];if(a&&u)p.push({format:"json",path:o});if(a&&d)p.push({format:"jsonc",path:i});if(!a&&u&&d)p.push({format:"json",path:o});return{active:s===null?null:{format:s,path:s==="ts"?n:s==="jsonc"?i:o},legacy:p}}),files:x,kind:"tooling",name:"oxfmt",version:"0.57.0"});import*as sn from"effect/Effect";var K=P({assess:(e)=>sn.gen(function*(){let t=yield*$(e),r=Q(t);if(!r.includes("check:monorepo")&&!r.includes("fix:monorepo"))return{applicable:!1,warnings:[]};let n=t.devDependencies?.sherif??t.dependencies?.sherif,o=[];if(!n)o.push({description:`Install \`sherif@${"1.12.0"}\` for the managed monorepo scripts.`,package:"sherif",targetVersion:"1.12.0",type:"install_package"});else if(B(n)!=="1.12.0")o.push({currentVersion:n,description:`Update \`sherif\` from \`${n}\` to \`${"1.12.0"}\`.`,package:"sherif",targetVersion:"1.12.0",type:"update_package"});return{actions:o,applicable:!0,warnings:[]}}),kind:"tooling",name:"sherif",version:"1.12.0"});import*as fn from"effect/Effect";var fe=P({assess:(e)=>fn.gen(function*(){let t=yield*$(e),r=Q(t);if(!r.includes("check")&&!r.includes("fix"))return{applicable:!1,warnings:[]};let n=t.devDependencies?.["oxlint-tsgolint"]??t.dependencies?.["oxlint-tsgolint"],o=[];if(!n)o.push({description:`Install \`oxlint-tsgolint@${"0.24.0"}\` for the managed lint scripts.`,package:"oxlint-tsgolint",targetVersion:"0.24.0",type:"install_package"});else if(B(n)!=="0.24.0")o.push({currentVersion:n,description:`Update \`oxlint-tsgolint\` from \`${n}\` to \`${"0.24.0"}\`.`,package:"oxlint-tsgolint",targetVersion:"0.24.0",type:"update_package"});return{actions:o,applicable:!0,warnings:[]}}),kind:"tooling",name:"oxlint-tsgolint",version:"0.24.0"});import*as z from"effect/Effect";import*as ln from"effect/Exit";import*as pn from"effect/FileSystem";import*as un from"effect/Path";function le(e){return e}function be(e,t,r){return z.gen(function*(){let n=yield*pn.FileSystem,o=yield*un.Path,i=e.files??[],a=new Map;for(let d of i){let s=o.join(t.cwd,d);if(yield*n.exists(s)){let l=yield*n.readFileString(s);a.set(s,l)}else a.set(s,null)}let u=yield*z.exit(e.migrate(t).pipe(z.andThen(()=>e.validate?.(t)??z.void)));if(ln.isSuccess(u))return;if(r?.onRestore)yield*r.onRestore;for(let[d,s]of a){if(s!==null){yield*n.writeFileString(d,s).pipe(z.ignore);continue}if(!(yield*n.exists(d).pipe(z.orElseSucceed(()=>!1))))continue;yield*n.remove(d).pipe(z.ignore)}return yield*z.failCause(u.cause)})}import*as ee from"effect/Effect";import*as yn from"effect/FileSystem";import*as mn from"effect/Path";import*as R from"@clack/prompts";import*as cn from"effect/Context";import*as b from"effect/Effect";import*as dn from"effect/Layer";class E extends cn.Service()("Prompter"){static layer=dn.succeed(this)({cancel:(e)=>b.sync(()=>{R.cancel(e)}),confirm:(e)=>b.promise(()=>R.confirm(e)).pipe(b.filterOrFail((t)=>!R.isCancel(t),()=>new Xe({}))),intro:(e)=>b.sync(()=>{R.intro(e)}),log:{error:(e)=>b.sync(()=>{R.log.error(e)}),info:(e)=>b.sync(()=>{R.log.info(e)}),success:(e)=>b.sync(()=>{R.log.success(e)}),warning:(e)=>b.sync(()=>{R.log.warning(e)})},multiselect:(e)=>b.promise(()=>R.multiselect(e)).pipe(b.filterOrFail((t)=>!R.isCancel(t),()=>new Xe({}))),outro:(e)=>b.sync(()=>{R.outro(e)}),spinner:()=>R.spinner()})}function hn(){return[y.files[1].path,y.files[2].path]}function Ar(e){let t=hn();return`Migrating legacy \`${e==="json"?t[0]:t[1]}\` configuration to \`${y.config}\`.`}function Ur(e){return ee.gen(function*(){let t=yield*yn.FileSystem,r=yield*mn.Path,n=yield*y.exists(e);if(n.active?.format!=="json"&&n.active?.format!=="jsonc")return;let o=n.active.path,i=r.join(e,y.config),a=yield*t.readFileString(o).pipe(ee.mapError((l)=>new T({cause:l,path:o}))),u=yield*U(a,o);if(!V(u))return yield*new J({path:o});let{$schema:d,...s}=u;yield*t.writeFileString(i,Ye(s)).pipe(ee.mapError((l)=>new S({cause:l,path:i}))),yield*t.remove(o).pipe(ee.mapError((l)=>new re({cause:l,path:o})));let p=n.legacy[0]?.path??null;if(p&&p!==o)yield*t.remove(p).pipe(ee.mapError((l)=>new re({cause:l,path:p})))})}var zt=le({check:(e)=>ee.gen(function*(){let t=yield*y.exists(e.cwd),r=[];if(t.active?.format==="ts"&&t.legacy.length>0)r.push("Found both `knip.config.ts` and `knip.json(c)`. Adamantite will use `knip.config.ts`.");if(t.active&&t.active.format!=="ts"&&t.legacy.length>0)r.push("Found both `knip.json` and `knip.jsonc`. Multiple legacy knip configs exist; Adamantite will treat `knip.jsonc` as the source of truth when migration is needed.");if(t.active?.format==="json"||t.active?.format==="jsonc")return{applicable:!0,summary:Ar(t.active.format),warnings:r};if(t.active?.format==="ts")return{applicable:!0,warnings:r};return{applicable:!1,warnings:r}}),files:[y.config,...hn()],id:"legacy-knip-json",migrate:(e)=>ee.gen(function*(){let r=(yield*E).spinner(),o=(yield*y.exists(e.cwd)).active?.path.endsWith(y.files[2].path)?y.files[2].path:y.files[1].path;r.start(`Migrating \`${o}\` to \`${y.config}\`...`),yield*Ur(e.cwd),r.stop(`Knip config migrated to \`${y.config}\` successfully.`)}),tags:["update"],title:"Legacy Knip JSON config",validate:(e)=>ee.gen(function*(){if((yield*y.exists(e.cwd)).active?.format!=="ts")return yield*new Y({migrationId:"legacy-knip-json",reason:`\`${y.config}\` is not the active Knip config.`})})});import*as te from"effect/Effect";import*as En from"effect/FileSystem";import*as gn from"effect/Path";function On(){return[m.files[1].path,m.files[2].path]}function Mr(e){let t=On();return`Migrating legacy \`${e==="json"?t[0]:t[1]}\` configuration to \`${m.config}\`.`}function xr(e){return te.gen(function*(){let t=yield*En.FileSystem,r=yield*gn.Path,n=yield*m.exists(e);if(n.active?.format!=="json"&&n.active?.format!=="jsonc")return;let o=n.active.path,i=r.join(e,m.config),a=yield*t.readFileString(o).pipe(te.mapError((l)=>new T({cause:l,path:o}))),u=yield*U(a,o);if(!V(u))return yield*new J({path:o});let{$schema:d,...s}=u;yield*t.writeFileString(i,tt(s)).pipe(te.mapError((l)=>new S({cause:l,path:i}))),yield*t.remove(o).pipe(te.mapError((l)=>new re({cause:l,path:o})));let p=n.legacy[0]?.path??null;if(p&&p!==o)yield*t.remove(p).pipe(te.mapError((l)=>new re({cause:l,path:p})))})}var At=le({check:(e)=>te.gen(function*(){let t=yield*m.exists(e.cwd),r=[];if(t.active?.format==="ts"&&t.legacy.length>0)r.push("Found both `oxfmt.config.ts` and `.oxfmtrc.json(c)`. Adamantite will use `oxfmt.config.ts`.");if(t.active&&t.active.format!=="ts"&&t.legacy.length>0)r.push("Found both `.oxfmtrc.json` and `.oxfmtrc.jsonc`. Multiple legacy oxfmt configs exist; Adamantite will treat `.oxfmtrc.jsonc` as the source of truth when migration is needed.");if(t.active?.format==="json"||t.active?.format==="jsonc")return{applicable:!0,summary:Mr(t.active.format),warnings:r};if(t.active?.format==="ts")return{applicable:!0,warnings:r};return{applicable:!1,warnings:r}}),files:[m.config,...On()],id:"legacy-oxfmt-json",migrate:(e)=>te.gen(function*(){let r=(yield*E).spinner(),o=(yield*m.exists(e.cwd)).active?.path.endsWith(m.files[2].path)?m.files[2].path:m.files[1].path;r.start(`Migrating \`${o}\` to \`${m.config}\`...`),yield*xr(e.cwd),r.stop(`Oxfmt config migrated to \`${m.config}\` successfully.`)}),tags:["update"],title:"Legacy oxfmt JSON config",validate:(e)=>te.gen(function*(){if((yield*m.exists(e.cwd)).active?.format!=="ts")return yield*new Y({migrationId:"legacy-oxfmt-json",reason:`\`${m.config}\` is not the active oxfmt config.`})})});import*as oe from"effect/Effect";import*as Sn from"effect/FileSystem";import*as jn from"effect/Path";function br(e){return oe.gen(function*(){let t=yield*Sn.FileSystem,r=yield*jn.Path,n=yield*c.exists(e);if(n.active?.format!=="json")return;let o=n.active.path,i=r.join(e,c.config),a=yield*t.readFileString(o).pipe(oe.mapError((N)=>new T({cause:N,path:o}))),u=yield*U(a,o);if(!V(u))return yield*new J({path:o});let{$schema:d,...s}=u,p=Array.isArray(s.extends)?s.extends.filter((N)=>typeof N==="string"):typeof s.extends==="string"?[s.extends]:[],l=new Set(Le()),h=new Set;for(let N of p){let W=N.match(/^(?:\.\/)?node_modules\/adamantite\/presets\/lint\/([a-z0-9-]+)\.(?:json|ts)$/),f=N.match(/^adamantite\/lint(?:\/([a-z0-9-]+))?$/),F=W?.[1]??(f?f[1]??"core":null);if(F)l.add(F);else h.add(N)}let{extends:j,...D}=s;yield*t.writeFileString(i,et(D,[...l],[...h])).pipe(oe.mapError((N)=>new S({cause:N,path:i}))),yield*t.remove(o).pipe(oe.mapError((N)=>new re({cause:N,path:o})))})}var Ut=le({id:"legacy-oxlint-json",files:[c.config,c.files[1].path],tags:["update"],title:"Legacy oxlint JSON config",check:(e)=>oe.gen(function*(){let t=yield*c.exists(e.cwd),r=t.active?.format==="ts"&&t.legacy.length>0?[`Found both \`${c.config}\` and \`${c.files[1].path}\`. Adamantite will use \`${c.config}\`.`]:[];if(t.active?.format==="json")return{applicable:!0,summary:`Migrating legacy \`${c.files[1].path}\` configuration to \`${c.config}\`.`,warnings:r};if(t.active?.format==="ts")return{applicable:!0,warnings:r};return{applicable:!1,warnings:r}}),migrate:(e)=>oe.gen(function*(){let r=(yield*E).spinner();r.start(`Migrating \`${c.files[1].path}\` to \`${c.config}\`...`),yield*br(e.cwd),r.stop(`Oxlint config migrated to \`${c.config}\` successfully.`)}),validate:(e)=>oe.gen(function*(){if((yield*c.exists(e.cwd)).active?.format!=="ts")return yield*new Y({migrationId:"legacy-oxlint-json",reason:`\`${c.config}\` is not the active oxlint config.`})})});import*as w from"effect/Effect";import*as Mt from"effect/Exit";import*as ye from"effect/Effect";import*as st from"effect/FileSystem";import*as ft from"effect/Path";import*as ot from"effect/Effect";import*as Fn from"effect/FileSystem";var $n=(e)=>ot.gen(function*(){yield*(yield*Fn.FileSystem).makeDirectory(e,{recursive:!0}).pipe(ot.mapError((r)=>new de({cause:r,path:e})))});import{runScriptCommand as Jr}from"nypm";var vn=[{name:"check",script:"check"},{args:["--check"],name:"format",script:"format"},{name:"monorepo",script:"check:monorepo"},{name:"analyze",script:"analyze"}];function Rn(e,t){let r=[];for(let n of vn){if(!t.includes(n.script))continue;r.push({command:Jr(e,n.script,{args:n.args}),name:n.name})}return r}function it(e){return vn.some((t)=>e.includes(t.script))}var wr={bun:` - name: Setup Node.js
21
21
  uses: actions/setup-node@v6
22
22
  with:
23
23
  node-version: "22"
@@ -64,7 +64,7 @@ ${r}`)}var Ee=(e,t)=>G.try({catch:(r)=>new vt({cause:r}),try:()=>$r(e,t)});funct
64
64
  cache: "yarn"
65
65
 
66
66
  - name: Install dependencies
67
- run: yarn install --frozen-lockfile`};function kn({packageManager:e,scripts:t}){let r=Nn(e,t);if(r.length===0)return null;return`${`name: adamantite
67
+ run: yarn install --frozen-lockfile`};function Dn({packageManager:e,scripts:t}){let r=Rn(e,t);if(r.length===0)return null;return`${`name: adamantite
68
68
 
69
69
  on:
70
70
  push:
@@ -97,16 +97,16 @@ ${r.map((i)=>` - name: ${i.name}
97
97
  - name: Checkout
98
98
  uses: actions/checkout@v4
99
99
 
100
- ${Zr[e]}
100
+ ${wr[e]}
101
101
 
102
102
  - name: Run \${{ matrix.name }}
103
103
  run: \${{ matrix.command }}`}
104
- `}var pt=[{path:".github/workflows/adamantite.yml",type:"ci"}],ie=_({create:(e,t)=>de.gen(function*(){let r=yield*ut.FileSystem,n=yield*ct.Path,o=n.join(e,pt[0].path);yield*_n(n.dirname(o));let i=kn(t);if(!i)return;yield*r.writeFileString(o,i).pipe(de.mapError((a)=>new O({cause:a,path:o})))}),exists:(e)=>de.gen(function*(){let t=yield*ut.FileSystem,r=yield*ct.Path;return yield*t.exists(r.join(e,pt[0].path))}),files:pt,kind:"ci",name:"github",update:(e,t)=>de.gen(function*(){let r=yield*ut.FileSystem,o=(yield*ct.Path).join(e,pt[0].path),i=kn(t);if(!i)return;yield*r.writeFileString(o,i).pipe(de.mapError((a)=>new O({cause:a,path:o})))})});import*as Rn from"effect/Context";import*as he from"effect/Effect";import*as An from"effect/Layer";import{addDevDependency as Xr,detectPackageManager as Yr}from"nypm";class Z extends Rn.Service()("DependencyInstaller"){static layer=An.succeed(this)({addDevDependencies:(e,t,r)=>he.tryPromise({catch:(n)=>new Tt({cause:n,packages:e}),try:()=>Xr(e,{...r,cwd:t})}).pipe(he.asVoid),detectPackageManager:(e)=>he.tryPromise({catch:(t)=>new xe({cause:t}),try:()=>Yr(e)}).pipe(he.map((t)=>t??null))})}import*as ue from"effect/Effect";import*as yt from"effect/FileSystem";import*as mt from"effect/Path";var Ze=[{path:"tsconfig.json",type:"config"}],In={extends:"adamantite/typescript"},V=_({config:Ze[0].path,create:(e)=>ue.gen(function*(){let t=yield*yt.FileSystem,n=(yield*mt.Path).join(e,Ze[0].path),o=JSON.stringify(In,null,2);yield*t.writeFileString(n,`${o}
105
- `).pipe(ue.mapError((i)=>new O({cause:i,path:n})))}),exists:(e)=>ue.gen(function*(){let t=yield*yt.FileSystem,r=yield*mt.Path;return yield*t.exists(r.join(e,Ze[0].path))}),files:Ze,kind:"workspace",name:"tsconfig",update:(e)=>ue.gen(function*(){let t=yield*yt.FileSystem,n=(yield*mt.Path).join(e,Ze[0].path),o=yield*t.readFileString(n).pipe(ue.mapError((u)=>new D({cause:u,path:n}))),i=yield*w(o,n);if(!N(i))return yield*new x({path:n});let a=yield*Ee(In,i);yield*t.writeFileString(n,`${JSON.stringify(a,null,2)}
106
- `).pipe(ue.mapError((u)=>new O({cause:u,path:n})))})});var zn="adamantite typecheck";function Hr(){return c.files[1].path}function Kr(){return ie.files[0].path}function Vn(e){let t={...e.scripts};if(t.typecheck!==zn)return{migrated:!1,packageJson:e};return delete t.typecheck,t.check??=It.check,{migrated:!0,packageJson:{...e,scripts:t}}}var Mn=pe({check:(e)=>W.gen(function*(){let t=yield*$(e.cwd),{migrated:r}=Vn(t);if(!r)return{applicable:!1,warnings:[]};return{applicable:!0,summary:"Migrating `typecheck` to `check` so oxlint handles linting and type diagnostics together.",warnings:[]}}),files:["package.json",c.config,Hr(),V.config,Kr()],id:"legacy-typecheck-script",migrate:(e)=>W.gen(function*(){let t=yield*g,r=yield*Z,n=t.spinner(),o=W.gen(function*(){let i=yield*$(e.cwd),a=Vn(i);if(!a.migrated)return"noop";yield*Zt(e.cwd,a.packageJson);let u=yield*c.exists(e.cwd);if(u.active===null)yield*c.create(e.cwd);else if(u.active.format==="ts")yield*c.update(e.cwd);yield*(yield*V.exists(e.cwd))?V.update(e.cwd):V.create(e.cwd);let f=yield*ie.exists(e.cwd),s=Q(a.packageJson);if(f&&lt(s)){let l=yield*r.detectPackageManager(e.cwd);if(l){let h=t.spinner();h.start("Updating GitHub Actions workflow..."),yield*ie.update(e.cwd,{packageManager:l.name,scripts:s}).pipe(W.onExit((S)=>W.sync(()=>{h.stop(xt.match(S,{onFailure:()=>"Failed to update GitHub Actions workflow.",onSuccess:()=>"GitHub Actions workflow updated successfully"}))})))}else yield*t.log.warning("Could not detect a package manager, so the GitHub Actions workflow was not updated.")}return"migrated"});n.start("Migrating `typecheck` script to unified `check` command..."),yield*o.pipe(W.onExit((i)=>W.sync(()=>{n.stop(xt.match(i,{onFailure:()=>"Legacy `typecheck` script migration failed.",onSuccess:(a)=>a==="noop"?"No migration needed.":"Legacy `typecheck` script migrated to `check` successfully."}))})),W.asVoid)}),tags:["update"],title:"Legacy typecheck script",validate:(e)=>W.gen(function*(){if((yield*$(e.cwd)).scripts?.typecheck===zn)return yield*new H({migrationId:"legacy-typecheck-script",reason:"The legacy `typecheck` script is still present in `package.json`."});if((yield*c.exists(e.cwd)).active?.format!=="ts")return yield*new H({migrationId:"legacy-typecheck-script",reason:`\`${c.config}\` is not the active oxlint config.`});if(!(yield*V.exists(e.cwd)))return yield*new H({migrationId:"legacy-typecheck-script",reason:`\`${V.config}\` is missing after the migration.`})})});var dt=[qt,bt,Jt,Mn],wn=Object.fromEntries(dt.map((e)=>[e.id,e])),Un={[bt.id]:m.name,[qt.id]:d.name,[Jt.id]:c.name};import*as bn from"effect/Console";import*as qn from"effect/Effect";import*as Jn from"effect/Terminal";var Re=()=>qn.gen(function*(){let t=yield*(yield*Jn.Terminal).columns,r=' .o8 . o8o . \n "888 .o8 `"\' .o8 \n .oooo. .oooo888 .oooo. ooo. .oo. .oo. .oooo. ooo. .oo. .o888oo oooo .o888oo .ooooo. \n`P )88b d88\' `888 `P )88b `888P"Y88bP"Y88b `P )88b `888P"Y88b 888 `888 888 d88\' `88b \n .oP"888 888 888 .oP"888 888 888 888 .oP"888 888 888 888 888 888 888ooo888 \nd8( 888 888 888 d8( 888 888 888 888 d8( 888 888 888 888 . 888 888 . 888 .o \n`Y888""8o `Y8bod88P" `Y888""8o o888o o888o o888o `Y888""8o o888o o888o "888" o888o "888" `Y8bod8P\' \n \n \n '.split(`
107
- `).reduce((n,o)=>Math.max(n,o.trim().length),0);if(!t||t<r)return;yield*bn.info(' .o8 . o8o . \n "888 .o8 `"\' .o8 \n .oooo. .oooo888 .oooo. ooo. .oo. .oo. .oooo. ooo. .oo. .o888oo oooo .o888oo .ooooo. \n`P )88b d88\' `888 `P )88b `888P"Y88bP"Y88b `P )88b `888P"Y88b 888 `888 888 d88\' `88b \n .oP"888 888 888 .oP"888 888 888 888 .oP"888 888 888 888 888 888 888ooo888 \nd8( 888 888 888 d8( 888 888 888 888 d8( 888 888 888 888 . 888 888 . 888 .o \n`Y888""8o `Y8bod88P" `Y888""8o o888o o888o o888o `Y888""8o o888o o888o "888" o888o "888" `Y8bod8P\' \n \n \n ')});var Cr=ht.boolean("fix").pipe(ht.withDescription("Automatically fix safe package install/update issues")),Lr=[m,d,c,K,le];function eo(e){return e.applicable&&Array.isArray(e.actions)}var xn={[m.name]:m,[d.name]:d,[c.name]:c},Wn={[c.name]:c};function Bn(e,t){return Object.hasOwn(e,t)}function Xe(e,t){switch(t.type){case"install_package":return`${e}:${t.type}:${t.package}:${t.targetVersion}`;case"update_package":return`${e}:${t.type}:${t.package}:${t.targetVersion}`;case"create_config":case"update_config":return`${e}:${t.type}:${t.path}`;case"manual_fix":return`${e}:${t.type}:${t.path??t.description}`;case"run_migration":return`${e}:${t.type}:${t.migrationId}`}}var Qn=Ie.make("doctor",{fix:Cr}).pipe(Ie.withDescription("Check Adamantite-managed integrations in the current project"),Ie.withHandler(({fix:e})=>Ae.gen(function*(){let t=Gr.cwd(),r=yield*g;yield*Re(),yield*r.intro("\uD83D\uDCA0 adamantite doctor");let n=yield*$(t);if(!n.devDependencies?.adamantite&&!n.dependencies?.adamantite)yield*r.log.warning("`adamantite` is not installed in this project. Install it before running `adamantite doctor`."),yield*r.outro("⚠️ Doctor found issues."),yield*new A({command:"doctor",exitCode:Wt.ExitCode(1)});let o=[];for(let y of Lr){let f=yield*y.assess(t);if(eo(f))o.push({assessment:f,integration:y})}for(let{assessment:y}of o)for(let f of y.warnings)yield*r.log.warning(f);if(o.length===0){yield*r.log.success("No applicable integrations found."),yield*r.outro("✅ Doctor completed successfully!");return}let i=o.flatMap(({assessment:y,integration:f})=>y.actions.map((s)=>({action:s,integration:f})));if(i.length===0){yield*r.log.success("No issues found."),yield*r.outro("✅ Doctor completed successfully!");return}let a=new Set;if(e)yield*Ae.gen(function*(){let y=i.filter(({action:f})=>f.type==="install_package"||f.type==="update_package");if(y.length>0){let f=yield*Z,s=[];for(let{action:l}of y)if(l.type==="install_package"||l.type==="update_package")s.push(`${l.package}@${l.targetVersion}`);yield*f.addDevDependencies(s,t,{silent:!0});for(let{action:l,integration:h}of y){if(l.type==="install_package")yield*r.log.success(`Fixed: installed \`${l.package}@${l.targetVersion}\`.`);if(l.type==="update_package")yield*r.log.success(`Fixed: updated \`${l.package}\` from \`${l.currentVersion}\` to \`${l.targetVersion}\`.`);a.add(Xe(h.name,l))}}for(let{action:f,integration:s}of i){if(f.type!=="create_config")continue;if(!Bn(xn,s.name))continue;yield*xn[s.name].create(t),yield*r.log.success(`Fixed: created \`${f.path}\`.`),a.add(Xe(s.name,f))}for(let{action:f,integration:s}of i){if(f.type!=="update_config")continue;if(!Bn(Wn,s.name))continue;yield*Wn[s.name].update(t),yield*r.log.success(`Fixed: updated \`${f.path}\`.`),a.add(Xe(s.name,f))}for(let{action:f,integration:s}of i){if(f.type!=="run_migration")continue;let l=wn[f.migrationId];if(!l)continue;yield*Qe(l,{cwd:t}),a.add(Xe(s.name,f))}}).pipe(Ae.tapError(()=>Ae.gen(function*(){yield*r.outro("❌ Doctor failed")})));let u=i.filter(({action:y,integration:f})=>!a.has(Xe(f.name,y)));if(e&&u.length===0){yield*r.outro("✅ Doctor completed successfully!");return}for(let{action:y}of e?u:i)yield*r.log.warning(`Needs attention: ${y.description}`);yield*r.outro("⚠️ Doctor found issues."),yield*new A({command:"doctor",exitCode:Wt.ExitCode(1)})})));import*as Zn from"effect/Effect";import*as Ve from"effect/unstable/cli/Argument";import*as ze from"effect/unstable/cli/Command";import*as ce from"effect/unstable/cli/Flag";import*as Xn from"effect/unstable/process/ChildProcessSpawner";var to=Ve.file("files",{mustExist:!0}).pipe(Ve.withDescription("Specific files to fix (optional)"),Ve.variadic()),no=ce.boolean("suggested").pipe(ce.withDescription("Apply suggested fixes")),ro=ce.boolean("dangerous").pipe(ce.withDescription("Apply dangerous fixes")),oo=ce.boolean("all").pipe(ce.withDescription("Apply all fixes, including suggested and dangerous fixes")),Yn=ze.make("fix",{all:oo,dangerous:ro,files:to,suggested:no}).pipe(ze.withDescription("Fix issues in code using oxlint"),ze.withHandler(({all:e,dangerous:t,files:r,suggested:n})=>Zn.gen(function*(){let o=yield*R,i=new Set(["--fix"]);if(n||e)i.add("--fix-suggestions");if(t||e)i.add("--fix-dangerously");for(let u of r)i.add(u);let a=yield*o.run({args:[...i],command:c.name});if(a!==Xn.ExitCode(0))yield*new A({command:c.name,exitCode:a})})));import*as Hn from"effect/Effect";import*as Me from"effect/unstable/cli/Argument";import*as we from"effect/unstable/cli/Command";import*as gt from"effect/unstable/cli/Flag";import*as Kn from"effect/unstable/process/ChildProcessSpawner";var io=Me.file("files",{mustExist:!0}).pipe(Me.withDescription("Specific files to format (optional)"),Me.variadic()),ao=gt.boolean("check").pipe(gt.withDescription("Check if files are formatted without writing")),Gn=we.make("format",{check:ao,files:io}).pipe(we.withDescription("Format files using oxfmt"),we.withHandler(({check:e,files:t})=>Hn.gen(function*(){let r=yield*R,n=[];if(e)n.push("--check");n.push(...t);let o=yield*r.run({args:n,command:d.name});if(o!==Kn.ExitCode(0))yield*new A({command:d.name,exitCode:o})})));import so from"node:process";import*as j from"effect/Effect";import*as or from"effect/FileSystem";import*as ir from"effect/Path";import*as Ue from"effect/unstable/cli/Command";import*as X from"effect/Effect";import*as Et from"effect/FileSystem";import*as jt from"effect/Path";import*as Ln from"effect/unstable/process/ChildProcessSpawner";var Ye=[{path:".vscode/settings.json",type:"config"}],Cn={"[css]":{"editor.defaultFormatter":"oxc.oxc-vscode"},"[graphql]":{"editor.defaultFormatter":"oxc.oxc-vscode"},"[javascript]":{"editor.defaultFormatter":"oxc.oxc-vscode"},"[javascriptreact]":{"editor.defaultFormatter":"oxc.oxc-vscode"},"[json]":{"editor.defaultFormatter":"oxc.oxc-vscode"},"[jsonc]":{"editor.defaultFormatter":"oxc.oxc-vscode"},"[typescript]":{"editor.defaultFormatter":"oxc.oxc-vscode"},"[typescriptreact]":{"editor.defaultFormatter":"oxc.oxc-vscode"},"editor.codeActionsOnSave":{"source.fixAll.oxc":"explicit"},"editor.defaultFormatter":"oxc.oxc-vscode","editor.formatOnPaste":!0,"editor.formatOnSave":!0,"oxc.typeAware":!0},ne=_({config:Ye[0].path,create:(e)=>X.gen(function*(){let t=yield*Et.FileSystem,r=yield*jt.Path,n=r.join(e,Ye[0].path),o=r.dirname(n);yield*t.makeDirectory(o,{recursive:!0}).pipe(X.mapError((i)=>new me({cause:i,path:o}))),yield*t.writeFileString(n,`${JSON.stringify(Cn,null,2)}
108
- `).pipe(X.mapError((i)=>new O({cause:i,path:n})))}),exists:(e)=>X.gen(function*(){let t=yield*Et.FileSystem,r=yield*jt.Path;return yield*t.exists(r.join(e,Ye[0].path))}),extension:(e=[])=>X.gen(function*(){function t(n){return X.gen(function*(){let i=yield*(yield*R).run({args:["--install-extension",n],command:"code"}).pipe(X.mapError((a)=>a._tag==="CliNotFound"&&a.command==="code"?new kt({cause:a}):new Ge({cause:a,extension:n})));if(i!==Ln.ExitCode(0))return yield*new Ge({cause:i,extension:n})})}let r=[];if(e.includes("check")||e.includes("fix")||e.includes("format"))r.push("oxc.oxc-vscode");if(e.includes("analyze"))r.push("webpro.vscode-knip");for(let n of r)yield*t(n)}),files:Ye,kind:"editor",name:"vscode",update:(e)=>X.gen(function*(){let t=yield*Et.FileSystem,n=(yield*jt.Path).join(e,Ye[0].path),o=yield*t.readFileString(n).pipe(X.mapError((u)=>new D({cause:u,path:n}))),i=yield*w(o,n);if(!N(i))return yield*new x({path:n});let a=yield*Ee(Cn,i);yield*t.writeFileString(n,`${JSON.stringify(a,null,2)}
109
- `).pipe(X.mapError((u)=>new O({cause:u,path:n})))})});import*as ae from"effect/Effect";import*as Ot from"effect/FileSystem";import*as St from"effect/Path";var He=[{path:".zed/settings.json",type:"config"}],er={languages:{CSS:{format_on_save:"on",formatter:[{language_server:{name:"oxfmt"}}]},HTML:{format_on_save:"on",formatter:[{language_server:{name:"oxfmt"}}]},JSON:{format_on_save:"on",formatter:[{language_server:{name:"oxfmt"}}]},JSONC:{format_on_save:"on",formatter:[{language_server:{name:"oxfmt"}}]},JavaScript:{format_on_save:"on",formatter:[{language_server:{name:"oxfmt"}},{code_action:"source.fixAll.oxc"}]},MDX:{format_on_save:"on",formatter:[{language_server:{name:"oxfmt"}}]},Markdown:{format_on_save:"on",formatter:[{language_server:{name:"oxfmt"}}]},TSX:{format_on_save:"on",formatter:[{language_server:{name:"oxfmt"}},{code_action:"source.fixAll.oxc"}]},TypeScript:{format_on_save:"on",formatter:[{language_server:{name:"oxfmt"}},{code_action:"source.fixAll.oxc"}]},YAML:{format_on_save:"on",formatter:[{language_server:{name:"oxfmt"}}]}},lsp:{oxfmt:{initialization_options:{settings:{configPath:null,"fmt.experimental":!0,run:"onSave",typeAware:!1,unusedDisableDirectives:!1}}},oxlint:{initialization_options:{settings:{configPath:null,fixKind:"safe_fix",run:"onType",typeAware:!0,unusedDisableDirectives:"deny"}}}}},fe=_({config:He[0].path,create:(e)=>ae.gen(function*(){let t=yield*Ot.FileSystem,r=yield*St.Path,n=r.join(e,He[0].path),o=r.dirname(n);yield*t.makeDirectory(o,{recursive:!0}).pipe(ae.mapError((i)=>new me({cause:i,path:o}))),yield*t.writeFileString(n,`${JSON.stringify(er,null,2)}
110
- `).pipe(ae.mapError((i)=>new O({cause:i,path:n})))}),exists:(e)=>ae.gen(function*(){let t=yield*Ot.FileSystem,r=yield*St.Path;return yield*t.exists(r.join(e,He[0].path))}),files:He,kind:"editor",name:"zed",update:(e)=>ae.gen(function*(){let t=yield*Ot.FileSystem,n=(yield*St.Path).join(e,He[0].path),o=yield*t.readFileString(n).pipe(ae.mapError((u)=>new D({cause:u,path:n}))),i=yield*w(o,n);if(!N(i))return yield*new x({path:n});let a=yield*Ee(er,i);yield*t.writeFileString(n,`${JSON.stringify(a,null,2)}
111
- `).pipe(ae.mapError((u)=>new O({cause:u,path:n})))})});import fo from"node:process";import*as tr from"effect/Effect";import*as nr from"effect/FileSystem";import*as rr from"effect/Path";var Bt=(e=fo.cwd())=>tr.gen(function*(){let t=yield*nr.FileSystem,r=yield*rr.Path;if(yield*t.exists(r.join(e,"pnpm-workspace.yaml")))return!0;return(yield*$(e)).workspaces!==void 0});var lo=(e,t)=>j.gen(function*(){let r=yield*Z,o=(yield*g).spinner();o.start("Installing dependencies...");let i=yield*Bt(e);yield*r.addDevDependencies(t,e,{silent:!0,workspace:i}).pipe(j.tapError(()=>j.sync(()=>{o.stop("Failed to install dependencies.")}))),o.stop("Dependencies installed.")});function Qt(e,t){return j.gen(function*(){yield*(yield*g).log.info(`Legacy \`${t}\` was preserved during \`adamantite init\`. \`adamantite init\` does not migrate legacy ${e} configs yet.`)})}var po=(e,t)=>j.gen(function*(){let r=yield*g,n=r.spinner();n.start("Setting up oxlint config...");let o=yield*c.exists(e),i=c.files[1].path;if(o.active?.format==="ts"&&o.legacy.length>0)yield*r.log.warning(`Found both \`${c.config}\` and \`${i}\`. Adamantite will use \`${c.config}\`.`);if(o.active?.format==="json")n.message(`Found \`${i}\`, keeping existing config.`),n.stop("oxlint config is ready."),yield*Qt("oxlint",i);else if(o.active?.format==="ts")n.message(`Found \`${c.config}\`, keeping existing config.`),n.stop("oxlint config is ready.");else n.message(`\`${c.config}\` not found, creating...`),yield*c.create(e,t),n.stop("oxlint config created successfully.")}),uo=(e)=>j.gen(function*(){let t=yield*g,r=t.spinner();r.start("Setting up oxfmt config...");let n=yield*d.exists(e);if(n.active?.format==="ts"&&n.legacy.length>0)yield*t.log.warning(`Found both \`${d.config}\` and \`.oxfmtrc.json(c)\`. Adamantite will use \`${d.config}\`.`);if(n.active&&n.active.format!=="ts"&&n.legacy.length>0)yield*t.log.warning("Found both `.oxfmtrc.json` and `.oxfmtrc.jsonc`. Multiple legacy oxfmt configs exist; Adamantite will treat `.oxfmtrc.jsonc` as the source of truth when migration is needed.");if(n.active?.format==="json"||n.active?.format==="jsonc"){let o=n.active.path.endsWith(d.files[1].path)?d.files[1].path:d.files[2].path;r.message(`Found \`${o}\`, keeping existing config.`),r.stop("oxfmt config is ready."),yield*Qt("oxfmt",o)}else if(n.active?.format==="ts")r.message(`Found \`${d.config}\`, keeping existing config.`),r.stop("oxfmt config is ready.");else r.message(`\`${d.config}\` not found, creating...`),yield*d.create(e),r.stop("oxfmt config created successfully.")}),co=(e,t)=>j.gen(function*(){let r=yield*or.FileSystem,n=yield*ir.Path,o=yield*g,i=yield*$(e),a=o.spinner();a.start("Adding scripts to your `package.json`..."),i.scripts??={};for(let y of t)switch(y){case"check":i.scripts.check="adamantite check";break;case"fix":i.scripts.fix="adamantite fix";break;case"format":i.scripts.format="adamantite format";break;case"check:monorepo":i.scripts["check:monorepo"]="adamantite monorepo";break;case"fix:monorepo":i.scripts["fix:monorepo"]="adamantite monorepo --fix";break;case"analyze":i.scripts.analyze="adamantite analyze";break;default:return yield*new Nt({script:y})}let u=n.join(e,"package.json");yield*r.writeFileString(u,`${JSON.stringify(i,null,2)}
112
- `).pipe(j.mapError((y)=>new O({cause:y,path:u}))),a.stop("Scripts added to your `package.json`")}),yo=(e)=>j.gen(function*(){let t=yield*g,r=t.spinner();r.start("Setting up knip config...");let n=yield*m.exists(e);if(n.active?.format==="ts"&&n.legacy.length>0)yield*t.log.warning(`Found both \`${m.config}\` and \`knip.json(c)\`. Adamantite will use \`${m.config}\`.`);if(n.active&&n.active.format!=="ts"&&n.legacy.length>0)yield*t.log.warning("Found both `knip.json` and `knip.jsonc`. Multiple legacy knip configs exist; Adamantite will treat `knip.jsonc` as the source of truth when migration is needed.");if(n.active?.format==="json"||n.active?.format==="jsonc"){let o=n.active.path.endsWith(m.files[1].path)?m.files[1].path:m.files[2].path;r.message(`Found \`${o}\`, keeping existing config.`),r.stop("knip config is ready."),yield*Qt("knip",o)}else if(n.active?.format==="ts")r.message(`Found \`${m.config}\`, keeping existing config.`),r.stop("knip config is ready.");else r.message(`\`${m.config}\` not found, creating...`),yield*m.create(e),r.stop("knip config created successfully.")}),mo=(e)=>j.gen(function*(){let r=(yield*g).spinner();if(r.start("Setting up TypeScript config..."),yield*V.exists(e))r.message(`\`${V.config}\` found, updating...`),yield*V.update(e),r.stop(`\`${V.config}\` updated successfully`);else r.message(`\`${V.config}\` not found, creating...`),yield*V.create(e),r.stop(`\`${V.config}\` created successfully`)}),ho=(e,t)=>j.gen(function*(){let r=yield*g;if(t.includes("vscode")){let n=r.spinner();if(n.start(`Checking for \`${ne.config}\`...`),yield*ne.exists(e))n.message(`\`${ne.config}\` found, updating...`),yield*ne.update(e),n.stop(`\`${ne.config}\` updated with Adamantite preset.`);else n.message(`\`${ne.config}\` not found, creating...`),yield*ne.create(e),n.stop(`\`${ne.config}\` created with Adamantite preset.`)}if(t.includes("zed")){let n=r.spinner();if(n.start(`Checking for \`${fe.config}\`...`),yield*fe.exists(e))n.message(`\`${fe.config}\` found, updating...`),yield*fe.update(e),n.stop(`\`${fe.config}\` updated with Adamantite preset.`);else n.message(`\`${fe.config}\` not found, creating...`),yield*fe.create(e),n.stop(`\`${fe.config}\` created with Adamantite preset.`)}}),go=(e,t)=>j.gen(function*(){let r=yield*g,n=r.spinner();n.start("Installing editor extensions...");let o=e.includes("zed"),i=e.includes("vscode");if(yield*j.gen(function*(){if(e.includes("vscode"))n.message("Installing VS Code extension..."),yield*ne.extension(t);return!0}).pipe(j.tapError(()=>j.sync(()=>{n.stop()})),j.catchTag("FailedToInstallExtension",(u)=>j.gen(function*(){return yield*r.log.warning(`⚠️ Failed to install the \`${u.extension}\` extension.`),yield*r.log.warning("Please install it manually after setup completes."),!1})),j.catchTag("VscodeCliNotFound",()=>j.gen(function*(){return yield*r.log.error("VSCode CLI ('code' command) not found."),yield*r.log.info("To install it:"),yield*r.log.info(" 1. Open VS Code"),yield*r.log.info(" 2. Press Cmd+Shift+P (macOS) or Ctrl+Shift+P (Windows/Linux)"),yield*r.log.info(` 3. Run 'Shell Command: Install "code" command in PATH'`),!1}))))if(o&&!i)n.stop("Zed extensions require manual install.");else n.stop("Editor extensions installed successfully.");if(o)yield*r.log.info("Install the Zed `oxc` extension: zed://extension/oxc")}),Eo=(e,t,r)=>j.gen(function*(){let o=(yield*g).spinner();o.start("Setting up GitHub Actions workflow...");let i=yield*ie.exists(e),a=ie.files[0].path;if(i)o.message(`\`${a}\` found, updating...`),yield*ie.update(e,{packageManager:t,scripts:r}),o.stop("GitHub Actions workflow updated successfully.");else o.message(`Creating \`${a}\`...`),yield*ie.create(e,{packageManager:t,scripts:r}),o.stop("GitHub Actions workflow created successfully.")}).pipe(j.option),ar=Ue.make("init").pipe(Ue.withDescription("Initialize Adamantite in the current directory"),Ue.withHandler(()=>j.gen(function*(){let e=so.cwd(),t=yield*g;yield*Re(),yield*t.intro("\uD83D\uDCA0 adamantite init");let n=yield*(yield*Z).detectPackageManager(e);if(!n)return yield*new xe({});if(n.warnings?.length)for(let p of n.warnings)yield*t.log.warning(p);yield*t.log.info(`Detected package manager: ${n.name}`);let o=yield*Bt(e);if(o)yield*t.log.info("We've detected a monorepo setup in your project.");let i=yield*t.multiselect({message:"Which scripts do you want to add to your `package.json`?",options:[{hint:"recommended",label:"check - find issues and type errors using oxlint",value:"check"},{hint:"recommended",label:"fix - fix code issues using oxlint",value:"fix"},{hint:"recommended",label:"format - code formatting using oxfmt",value:"format"},{disabled:!o,hint:o?void 0:"available for monorepo projects",label:"check:monorepo - check for monorepo-specific issues using Sherif",value:"check:monorepo"},{disabled:!o,hint:o?void 0:"available for monorepo projects",label:"fix:monorepo - fix monorepo-specific issues using Sherif",value:"fix:monorepo"},{label:"analyze - find unused dependencies, exports, and files using knip",value:"analyze"}]}),a=i.includes("check")||i.includes("fix"),u=[];if(a)u=yield*t.multiselect({message:"Which presets do you want to install? (core is always included)",options:[{label:"React",value:"react"},{label:"Next.js",value:"nextjs"},{label:"Vue",value:"vue"},{label:"Jest",value:"jest"},{label:"Vitest",value:"vitest"},{label:"Node",value:"node"}],required:!1});let y=!1;if(a)y=yield*t.confirm({initialValue:!0,message:"Adamantite provides a TypeScript preset to enforce strict type-safety. Would you like to use it?"});let f=yield*t.multiselect({message:"Which editors do you want to configure? (optional)",options:[{label:"VSCode / Cursor / Windsurf",value:"vscode"},{label:"Zed",value:"zed"}],required:!1}),s=!1;if(f.length>0)s=yield*t.confirm({initialValue:!0,message:"Do you want to install the recommended editor extensions?"});let l=lt(i),h=!1;if(l)h=yield*t.confirm({message:"Do you want to add a GitHub Actions workflow to run checks in CI?"});let S=i.includes("format"),k=i.includes("check:monorepo")||i.includes("fix:monorepo"),P=i.includes("analyze"),J=["adamantite"];if(a)J.push(`${c.name}@${c.version}`),J.push(`${le.name}@${le.version}`);if(S)J.push(`${d.name}@${d.version}`);if(k)J.push(`${K.name}@${K.version}`);if(P)J.push(`${m.name}@${m.version}`);if(yield*lo(e,J),S)yield*uo(e);if(a)yield*po(e,u);if(P)yield*yo(e);if(yield*co(e,i),y)yield*mo(e);if(yield*ho(e,f),s)yield*go(f,i);if(h)yield*Eo(e,n.name,i);yield*t.log.success("Your project is now configured"),yield*t.outro("\uD83D\uDCA0 Adamantite initialized successfully!")}).pipe(j.catchTags({OperationCancelled:()=>j.gen(function*(){yield*(yield*g).cancel("You've cancelled the initialization process.")})}))));import*as fr from"effect/Effect";import*as be from"effect/unstable/cli/Command";import*as Ft from"effect/unstable/cli/Flag";import*as sr from"effect/unstable/process/ChildProcessSpawner";var jo=Ft.boolean("fix").pipe(Ft.withDescription("Automatically fix issues")),lr=be.make("monorepo",{fix:jo}).pipe(be.withDescription("Find and fix monorepo-specific issues using Sherif"),be.withHandler(({fix:e})=>fr.gen(function*(){let t=yield*R,r=e?["--fix"]:[],n=yield*t.run({args:r,command:K.name,stdin:"inherit"});if(n!==sr.ExitCode(0))yield*new A({command:K.name,exitCode:n})})));import*as pr from"effect/Effect";import*as qe from"effect/unstable/cli/Command";import*as ur from"effect/unstable/process/ChildProcessSpawner";var cr=qe.make("typecheck").pipe(qe.withDescription("Deprecated alias for `check`"),qe.withHandler(()=>pr.gen(function*(){let e=yield*g,t=yield*R;yield*e.log.warning("Deprecated. Use `adamantite check` for typechecking.");let r=yield*t.run({args:[],command:c.name});if(r!==ur.ExitCode(0))yield*new A({command:c.name,exitCode:r})})));import Oo from"node:process";import*as Y from"effect/Effect";import*as Je from"effect/unstable/cli/Command";var So=[c,le,d,K,m],Fo=[c,le,d,K,m];function $o(e){return e.applicable&&Array.isArray(e.actions)}function To(e,t){let r=[];for(let n of Fo){if(t.has(n.name))continue;let o=e.devDependencies?.[n.name]??e.dependencies?.[n.name];if(o&&B(o)!==n.version)r.push({currentVersion:o,name:n.name,targetVersion:n.version})}return r}var yr=Je.make("update").pipe(Je.withDescription("Run applicable Adamantite migrations and update managed dependencies"),Je.withHandler(()=>Y.gen(function*(){let e=Oo.cwd(),t=yield*g,r=yield*Z,n={cwd:e};yield*Re(),yield*t.intro("\uD83D\uDCA0 adamantite update");let o=()=>Y.gen(function*(){let p=[];for(let F of So){let Ke=yield*F.assess(e);if($o(Ke))p.push({assessment:Ke,integration:F})}return p}),i=yield*o();for(let{assessment:p}of i)for(let F of p.warnings)yield*t.log.warning(F);let a=new Set(i.map(({integration:p})=>p.name)),u=i.flatMap(({assessment:p})=>p.actions),y=new Set(u.filter((p)=>p.type==="run_migration").map((p)=>p.migrationId)),f=[];for(let p of dt.filter((F)=>F.tags.includes("update"))){let F=Un[p.id];if(a.has(F))continue;let Ke=yield*p.check(n);f.push({migration:p,result:Ke})}for(let p of f){for(let F of p.result.warnings)yield*t.log.warning(F);if(p.result.applicable&&p.result.summary)yield*t.log.info(p.result.summary)}let s=[];for(let p of dt){if(!y.has(p.id))continue;yield*Qe(p,n,{onRestore:t.log.warning(`Migration "${p.title}" failed, restoring files...`)}),s.push(p.id)}for(let{migration:p,result:F}of f){if(!F.applicable||!F.summary)continue;yield*Qe(p,n,{onRestore:t.log.warning(`Migration "${p.title}" failed, restoring files...`)}),s.push(p.id)}if(s.length>0)yield*t.log.success("Migrations ran successfully.");let l=yield*$(e),h=yield*o(),S=h.flatMap(({assessment:p})=>p.actions).filter((p)=>p.type==="create_config"||p.type==="update_config"||p.type==="manual_fix"),k=h.flatMap(({assessment:p})=>p.actions).filter((p)=>p.type==="install_package"||p.type==="update_package").map((p)=>p.type==="install_package"?{currentVersion:"not installed",name:p.package,targetVersion:p.targetVersion}:{currentVersion:p.currentVersion,name:p.package,targetVersion:p.targetVersion}),P=new Set(k.map((p)=>p.name)),J=[...k,...To(l,P)];if(J.length>0){yield*t.log.info("The following dependencies will be updated:");for(let F of J)yield*t.log.info(` ${F.name}: ${F.currentVersion} → ${F.targetVersion}`);let p=t.spinner();p.start("Updating dependencies..."),yield*r.addDevDependencies(J.map((F)=>`${F.name}@${F.targetVersion}`),e,{silent:!0}).pipe(Y.tapError(()=>Y.sync(()=>{p.stop("Failed to update dependencies")}))),p.stop("Dependencies updated successfully"),yield*t.log.success("Dependencies updated successfully.")}if(S.length>0){yield*t.log.warning("Some configuration follow-up belongs to `adamantite doctor --fix`.");for(let p of S)yield*t.log.warning(`Doctor follow-up: ${p.description}`)}if(s.length===0&&J.length===0&&S.length===0)return yield*t.log.success("No changes needed."),"no-changes";return"success"}).pipe(Y.tapError(()=>Y.gen(function*(){yield*(yield*g).outro("❌ Update failed")})),Y.tap((e)=>Y.gen(function*(){let t=yield*g;switch(e){case"no-changes":yield*t.outro("✅ Adamantite is already up to date.");break;case"success":yield*t.outro("✅ Update completed successfully!");break;default:break}})))));var vo=ye.make("adamantite").pipe(ye.withDescription("Opinionated preset package for modern TypeScript applications"),ye.withSubcommands([Ct,pn,Qn,Yn,Gn,ar,lr,cr,yr])),Po=await"0.32.2",_o=ye.run(vo,{version:Po}).pipe(M.as(0),M.catchTag("CommandFailed",(e)=>M.succeed(e.exitCode)),M.catch((e)=>M.service(g).pipe(M.flatMap((t)=>t.log.error(e.message)),M.as(jr.ExitCode(1)))),M.provide(gr.mergeAll(dr.layer,g.layer,R.layer,Z.layer)));mr.runMain(_o,{teardown:(e,t)=>{if(hr.isSuccess(e)){t(Number(e.value));return}Er.defaultTeardown(e,t)}});
104
+ `}var at=[{path:".github/workflows/adamantite.yml",type:"ci"}],ie=P({create:(e,t)=>ye.gen(function*(){let r=yield*st.FileSystem,n=yield*ft.Path,o=n.join(e,at[0].path);yield*$n(n.dirname(o));let i=Dn(t);if(!i)return;yield*r.writeFileString(o,i).pipe(ye.mapError((a)=>new S({cause:a,path:o})))}),exists:(e)=>ye.gen(function*(){let t=yield*st.FileSystem,r=yield*ft.Path;return yield*t.exists(r.join(e,at[0].path))}),files:at,kind:"ci",name:"github",update:(e,t)=>ye.gen(function*(){let r=yield*st.FileSystem,o=(yield*ft.Path).join(e,at[0].path),i=Dn(t);if(!i)return;yield*r.writeFileString(o,i).pipe(ye.mapError((a)=>new S({cause:a,path:o})))})});import*as Nn from"effect/Context";import*as me from"effect/Effect";import*as Pn from"effect/Layer";import{addDevDependency as Wr,detectPackageManager as Br}from"nypm";class Z extends Nn.Service()("DependencyInstaller"){static layer=Pn.succeed(this)({addDevDependencies:(e,t,r)=>me.tryPromise({catch:(n)=>new St({cause:n,packages:e}),try:()=>Wr(e,{...r,cwd:t})}).pipe(me.asVoid),detectPackageManager:(e)=>me.tryPromise({catch:(t)=>new Ue({cause:t}),try:()=>Br(e)}).pipe(me.map((t)=>t??null))})}import*as pe from"effect/Effect";import*as lt from"effect/FileSystem";import*as pt from"effect/Path";var Je=[{path:"tsconfig.json",type:"config"}],Tn={extends:"adamantite/typescript"},q=P({config:Je[0].path,create:(e)=>pe.gen(function*(){let t=yield*lt.FileSystem,n=(yield*pt.Path).join(e,Je[0].path),o=JSON.stringify(Tn,null,2);yield*t.writeFileString(n,`${o}
105
+ `).pipe(pe.mapError((i)=>new S({cause:i,path:n})))}),exists:(e)=>pe.gen(function*(){let t=yield*lt.FileSystem,r=yield*pt.Path;return yield*t.exists(r.join(e,Je[0].path))}),files:Je,kind:"workspace",name:"tsconfig",update:(e)=>pe.gen(function*(){let t=yield*lt.FileSystem,n=(yield*pt.Path).join(e,Je[0].path),o=yield*t.readFileString(n).pipe(pe.mapError((u)=>new T({cause:u,path:n}))),i=yield*U(o,n);if(!V(i))return yield*new J({path:n});let a=yield*Ee(Tn,i);yield*t.writeFileString(n,`${JSON.stringify(a,null,2)}
106
+ `).pipe(pe.mapError((u)=>new S({cause:u,path:n})))})});var _n="adamantite typecheck";function Qr(){return c.files[1].path}function Zr(){return ie.files[0].path}function Vn(e){let t={...e.scripts};if(t.typecheck!==_n)return{migrated:!1,packageJson:e};return delete t.typecheck,t.check??=Tt.check,{migrated:!0,packageJson:{...e,scripts:t}}}var In=le({check:(e)=>w.gen(function*(){let t=yield*$(e.cwd),{migrated:r}=Vn(t);if(!r)return{applicable:!1,warnings:[]};return{applicable:!0,summary:"Migrating `typecheck` to `check` so oxlint handles linting and type diagnostics together.",warnings:[]}}),files:["package.json",c.config,Qr(),q.config,Zr()],id:"legacy-typecheck-script",migrate:(e)=>w.gen(function*(){let t=yield*E,r=yield*Z,n=t.spinner(),o=w.gen(function*(){let i=yield*$(e.cwd),a=Vn(i);if(!a.migrated)return"noop";yield*wt(e.cwd,a.packageJson);let u=yield*c.exists(e.cwd);if(u.active===null)yield*c.create(e.cwd);else if(u.active.format==="ts")yield*c.update(e.cwd);yield*(yield*q.exists(e.cwd))?q.update(e.cwd):q.create(e.cwd);let s=yield*ie.exists(e.cwd),p=Q(a.packageJson);if(s&&it(p)){let l=yield*r.detectPackageManager(e.cwd);if(l&&Ke(l.name)){let h=l.name,j=t.spinner();j.start("Updating GitHub Actions workflow..."),yield*ie.update(e.cwd,{packageManager:h,scripts:p}).pipe(w.onExit((D)=>w.sync(()=>{j.stop(Mt.match(D,{onFailure:()=>"Failed to update GitHub Actions workflow.",onSuccess:()=>"GitHub Actions workflow updated successfully"}))})))}else if(l)yield*t.log.warning(`\`${l.name}\` is not a supported package manager for CI workflow generation, so the GitHub Actions workflow was not updated.`);else yield*t.log.warning("Could not detect a package manager, so the GitHub Actions workflow was not updated.")}return"migrated"});n.start("Migrating `typecheck` script to unified `check` command..."),yield*o.pipe(w.onExit((i)=>w.sync(()=>{n.stop(Mt.match(i,{onFailure:()=>"Legacy `typecheck` script migration failed.",onSuccess:(a)=>a==="noop"?"No migration needed.":"Legacy `typecheck` script migrated to `check` successfully."}))})),w.asVoid)}),tags:["update"],title:"Legacy typecheck script",validate:(e)=>w.gen(function*(){if((yield*$(e.cwd)).scripts?.typecheck===_n)return yield*new Y({migrationId:"legacy-typecheck-script",reason:"The legacy `typecheck` script is still present in `package.json`."});if((yield*c.exists(e.cwd)).active?.format!=="ts")return yield*new Y({migrationId:"legacy-typecheck-script",reason:`\`${c.config}\` is not the active oxlint config.`});if(!(yield*q.exists(e.cwd)))return yield*new Y({migrationId:"legacy-typecheck-script",reason:`\`${q.config}\` is missing after the migration.`})})});var ut=[At,zt,Ut,In],kn=Object.fromEntries(ut.map((e)=>[e.id,e])),qn={[zt.id]:y.name,[At.id]:m.name,[Ut.id]:c.name};import*as zn from"effect/Console";import*as An from"effect/Effect";import*as Un from"effect/Terminal";var De=()=>An.gen(function*(){let t=yield*(yield*Un.Terminal).columns,r=' .o8 . o8o . \n "888 .o8 `"\' .o8 \n .oooo. .oooo888 .oooo. ooo. .oo. .oo. .oooo. ooo. .oo. .o888oo oooo .o888oo .ooooo. \n`P )88b d88\' `888 `P )88b `888P"Y88bP"Y88b `P )88b `888P"Y88b 888 `888 888 d88\' `88b \n .oP"888 888 888 .oP"888 888 888 888 .oP"888 888 888 888 888 888 888ooo888 \nd8( 888 888 888 d8( 888 888 888 888 d8( 888 888 888 888 . 888 888 . 888 .o \n`Y888""8o `Y8bod88P" `Y888""8o o888o o888o o888o `Y888""8o o888o o888o "888" o888o "888" `Y8bod8P\' \n \n \n '.split(`
107
+ `).reduce((n,o)=>Math.max(n,o.trim().length),0);if(!t||t<r)return;yield*zn.info(' .o8 . o8o . \n "888 .o8 `"\' .o8 \n .oooo. .oooo888 .oooo. ooo. .oo. .oo. .oooo. ooo. .oo. .o888oo oooo .o888oo .ooooo. \n`P )88b d88\' `888 `P )88b `888P"Y88bP"Y88b `P )88b `888P"Y88b 888 `888 888 d88\' `88b \n .oP"888 888 888 .oP"888 888 888 888 .oP"888 888 888 888 888 888 888ooo888 \nd8( 888 888 888 d8( 888 888 888 888 d8( 888 888 888 888 . 888 888 . 888 .o \n`Y888""8o `Y8bod88P" `Y888""8o o888o o888o o888o `Y888""8o o888o o888o "888" o888o "888" `Y8bod8P\' \n \n \n ')});var Yr=ct.boolean("fix").pipe(ct.withDescription("Automatically fix safe package install/update issues")),Kr=[y,m,c,K,fe];function Hr(e){return e.applicable&&Array.isArray(e.actions)}var Mn={[y.name]:y,[m.name]:m,[c.name]:c},xn={[c.name]:c};function bn(e,t){return Object.hasOwn(e,t)}function we(e,t){switch(t.type){case"install_package":return`${e}:${t.type}:${t.package}:${t.targetVersion}`;case"update_package":return`${e}:${t.type}:${t.package}:${t.targetVersion}`;case"create_config":case"update_config":return`${e}:${t.type}:${t.path}`;case"manual_fix":return`${e}:${t.type}:${t.path??t.description}`;case"run_migration":return`${e}:${t.type}:${t.migrationId}`}}var Jn=Pe.make("doctor",{fix:Yr}).pipe(Pe.withDescription("Check Adamantite-managed integrations in the current project"),Pe.withHandler(({fix:e})=>Ne.gen(function*(){let t=Xr.cwd(),r=yield*E;yield*De(),yield*r.intro("\uD83D\uDCA0 adamantite doctor");let n=yield*$(t);if(!n.devDependencies?.adamantite&&!n.dependencies?.adamantite)yield*r.log.warning("`adamantite` is not installed in this project. Install it before running `adamantite doctor`."),yield*r.outro("⚠️ Doctor found issues."),yield*new I({command:"doctor",exitCode:xt.ExitCode(1)});let o=[];for(let d of Kr){let s=yield*d.assess(t);if(Hr(s))o.push({assessment:s,integration:d})}for(let{assessment:d}of o)for(let s of d.warnings)yield*r.log.warning(s);if(o.length===0){yield*r.log.success("No applicable integrations found."),yield*r.outro("✅ Doctor completed successfully!");return}let i=o.flatMap(({assessment:d,integration:s})=>d.actions.map((p)=>({action:p,integration:s})));if(i.length===0){yield*r.log.success("No issues found."),yield*r.outro("✅ Doctor completed successfully!");return}let a=new Set;if(e)yield*Ne.gen(function*(){let d=i.filter(({action:s})=>s.type==="install_package"||s.type==="update_package");if(d.length>0){let s=yield*Z,p=[];for(let{action:l}of d)if(l.type==="install_package"||l.type==="update_package")p.push(`${l.package}@${l.targetVersion}`);yield*s.addDevDependencies(p,t,{silent:!0});for(let{action:l,integration:h}of d){if(l.type==="install_package")yield*r.log.success(`Fixed: installed \`${l.package}@${l.targetVersion}\`.`);if(l.type==="update_package")yield*r.log.success(`Fixed: updated \`${l.package}\` from \`${l.currentVersion}\` to \`${l.targetVersion}\`.`);a.add(we(h.name,l))}}for(let{action:s,integration:p}of i){if(s.type!=="create_config")continue;if(!bn(Mn,p.name))continue;yield*Mn[p.name].create(t),yield*r.log.success(`Fixed: created \`${s.path}\`.`),a.add(we(p.name,s))}for(let{action:s,integration:p}of i){if(s.type!=="update_config")continue;if(!bn(xn,p.name))continue;yield*xn[p.name].update(t),yield*r.log.success(`Fixed: updated \`${s.path}\`.`),a.add(we(p.name,s))}for(let{action:s,integration:p}of i){if(s.type!=="run_migration")continue;let l=kn[s.migrationId];if(!l)continue;yield*be(l,{cwd:t}),a.add(we(p.name,s))}}).pipe(Ne.tapError(()=>Ne.gen(function*(){yield*r.outro("❌ Doctor failed")})));let u=i.filter(({action:d,integration:s})=>!a.has(we(s.name,d)));if(e&&u.length===0){yield*r.outro("✅ Doctor completed successfully!");return}for(let{action:d}of e?u:i)yield*r.log.warning(`Needs attention: ${d.description}`);yield*r.outro("⚠️ Doctor found issues."),yield*new I({command:"doctor",exitCode:xt.ExitCode(1)})})));import*as wn from"effect/Effect";import*as Te from"effect/unstable/cli/Argument";import*as Ve from"effect/unstable/cli/Command";import*as ue from"effect/unstable/cli/Flag";import*as Wn from"effect/unstable/process/ChildProcessSpawner";var Gr=Te.file("files",{mustExist:!0}).pipe(Te.withDescription("Specific files to fix (optional)"),Te.variadic()),Cr=ue.boolean("suggested").pipe(ue.withDescription("Apply suggested fixes")),Lr=ue.boolean("dangerous").pipe(ue.withDescription("Apply dangerous fixes")),eo=ue.boolean("all").pipe(ue.withDescription("Apply all fixes, including suggested and dangerous fixes")),Bn=Ve.make("fix",{all:eo,dangerous:Lr,files:Gr,suggested:Cr}).pipe(Ve.withDescription("Fix issues in code using oxlint"),Ve.withHandler(({all:e,dangerous:t,files:r,suggested:n})=>wn.gen(function*(){let o=yield*_,i=new Set(["--fix"]);if(n||e)i.add("--fix-suggestions");if(t||e)i.add("--fix-dangerously");for(let u of r)i.add(u);let a=yield*o.run({args:[...i],command:c.name});if(a!==Wn.ExitCode(0))yield*new I({command:c.name,exitCode:a})})));import*as Qn from"effect/Effect";import*as _e from"effect/unstable/cli/Argument";import*as Ie from"effect/unstable/cli/Command";import*as dt from"effect/unstable/cli/Flag";import*as Zn from"effect/unstable/process/ChildProcessSpawner";var to=_e.file("files",{mustExist:!0}).pipe(_e.withDescription("Specific files to format (optional)"),_e.variadic()),no=dt.boolean("check").pipe(dt.withDescription("Check if files are formatted without writing")),Xn=Ie.make("format",{check:no,files:to}).pipe(Ie.withDescription("Format files using oxfmt"),Ie.withHandler(({check:e,files:t})=>Qn.gen(function*(){let r=yield*_,n=[];if(e)n.push("--check");n.push(...t);let o=yield*r.run({args:n,command:m.name});if(o!==Zn.ExitCode(0))yield*new I({command:m.name,exitCode:o})})));import oo from"node:process";import*as O from"effect/Effect";import*as er from"effect/FileSystem";import*as tr from"effect/Path";import*as ke from"effect/unstable/cli/Command";import*as H from"effect/Effect";import*as yt from"effect/FileSystem";import*as mt from"effect/Path";import*as Kn from"effect/unstable/process/ChildProcessSpawner";var We=[{path:".vscode/settings.json",type:"config"}],Yn={"[css]":{"editor.defaultFormatter":"oxc.oxc-vscode"},"[graphql]":{"editor.defaultFormatter":"oxc.oxc-vscode"},"[javascript]":{"editor.defaultFormatter":"oxc.oxc-vscode"},"[javascriptreact]":{"editor.defaultFormatter":"oxc.oxc-vscode"},"[json]":{"editor.defaultFormatter":"oxc.oxc-vscode"},"[jsonc]":{"editor.defaultFormatter":"oxc.oxc-vscode"},"[typescript]":{"editor.defaultFormatter":"oxc.oxc-vscode"},"[typescriptreact]":{"editor.defaultFormatter":"oxc.oxc-vscode"},"editor.codeActionsOnSave":{"source.fixAll.oxc":"explicit"},"editor.defaultFormatter":"oxc.oxc-vscode","editor.formatOnPaste":!0,"editor.formatOnSave":!0,"oxc.typeAware":!0},ne=P({config:We[0].path,create:(e)=>H.gen(function*(){let t=yield*yt.FileSystem,r=yield*mt.Path,n=r.join(e,We[0].path),o=r.dirname(n);yield*t.makeDirectory(o,{recursive:!0}).pipe(H.mapError((i)=>new de({cause:i,path:o}))),yield*t.writeFileString(n,`${JSON.stringify(Yn,null,2)}
108
+ `).pipe(H.mapError((i)=>new S({cause:i,path:n})))}),exists:(e)=>H.gen(function*(){let t=yield*yt.FileSystem,r=yield*mt.Path;return yield*t.exists(r.join(e,We[0].path))}),extension:(e=[])=>H.gen(function*(){let t=[];if(e.includes("check")||e.includes("fix")||e.includes("format"))t.push("oxc.oxc-vscode");if(e.includes("analyze"))t.push("webpro.vscode-knip");for(let r of t){let o=yield*(yield*_).run({args:["--install-extension",r],command:"code"}).pipe(H.mapError((i)=>i._tag==="CliNotFound"&&i.command==="code"?new Dt({cause:i}):new Ze({cause:i,extension:r})));if(o!==Kn.ExitCode(0))return yield*new Ze({cause:o,extension:r})}}),files:We,kind:"editor",name:"vscode",update:(e)=>H.gen(function*(){let t=yield*yt.FileSystem,n=(yield*mt.Path).join(e,We[0].path),o=yield*t.readFileString(n).pipe(H.mapError((u)=>new T({cause:u,path:n}))),i=yield*U(o,n);if(!V(i))return yield*new J({path:n});let a=yield*Ee(Yn,i);yield*t.writeFileString(n,`${JSON.stringify(a,null,2)}
109
+ `).pipe(H.mapError((u)=>new S({cause:u,path:n})))})});import*as ae from"effect/Effect";import*as ht from"effect/FileSystem";import*as Et from"effect/Path";var Be=[{path:".zed/settings.json",type:"config"}],Hn={languages:{CSS:{format_on_save:"on",formatter:[{language_server:{name:"oxfmt"}}]},HTML:{format_on_save:"on",formatter:[{language_server:{name:"oxfmt"}}]},JSON:{format_on_save:"on",formatter:[{language_server:{name:"oxfmt"}}]},JSONC:{format_on_save:"on",formatter:[{language_server:{name:"oxfmt"}}]},JavaScript:{format_on_save:"on",formatter:[{language_server:{name:"oxfmt"}},{code_action:"source.fixAll.oxc"}]},MDX:{format_on_save:"on",formatter:[{language_server:{name:"oxfmt"}}]},Markdown:{format_on_save:"on",formatter:[{language_server:{name:"oxfmt"}}]},TSX:{format_on_save:"on",formatter:[{language_server:{name:"oxfmt"}},{code_action:"source.fixAll.oxc"}]},TypeScript:{format_on_save:"on",formatter:[{language_server:{name:"oxfmt"}},{code_action:"source.fixAll.oxc"}]},YAML:{format_on_save:"on",formatter:[{language_server:{name:"oxfmt"}}]}},lsp:{oxfmt:{initialization_options:{settings:{configPath:null,"fmt.experimental":!0,run:"onSave",typeAware:!1,unusedDisableDirectives:!1}}},oxlint:{initialization_options:{settings:{configPath:null,fixKind:"safe_fix",run:"onType",typeAware:!0,unusedDisableDirectives:"deny"}}}}},se=P({config:Be[0].path,create:(e)=>ae.gen(function*(){let t=yield*ht.FileSystem,r=yield*Et.Path,n=r.join(e,Be[0].path),o=r.dirname(n);yield*t.makeDirectory(o,{recursive:!0}).pipe(ae.mapError((i)=>new de({cause:i,path:o}))),yield*t.writeFileString(n,`${JSON.stringify(Hn,null,2)}
110
+ `).pipe(ae.mapError((i)=>new S({cause:i,path:n})))}),exists:(e)=>ae.gen(function*(){let t=yield*ht.FileSystem,r=yield*Et.Path;return yield*t.exists(r.join(e,Be[0].path))}),files:Be,kind:"editor",name:"zed",update:(e)=>ae.gen(function*(){let t=yield*ht.FileSystem,n=(yield*Et.Path).join(e,Be[0].path),o=yield*t.readFileString(n).pipe(ae.mapError((u)=>new T({cause:u,path:n}))),i=yield*U(o,n);if(!V(i))return yield*new J({path:n});let a=yield*Ee(Hn,i);yield*t.writeFileString(n,`${JSON.stringify(a,null,2)}
111
+ `).pipe(ae.mapError((u)=>new S({cause:u,path:n})))})});import ro from"node:process";import*as Gn from"effect/Effect";import*as Cn from"effect/FileSystem";import*as Ln from"effect/Path";var bt=(e=ro.cwd())=>Gn.gen(function*(){let t=yield*Cn.FileSystem,r=yield*Ln.Path;if(yield*t.exists(r.join(e,"pnpm-workspace.yaml")))return!0;return(yield*$(e)).workspaces!==void 0});var io=(e,t)=>O.gen(function*(){let r=yield*Z,o=(yield*E).spinner();o.start("Installing dependencies...");let i=yield*bt(e);yield*r.addDevDependencies(t,e,{silent:!0,workspace:i}).pipe(O.tapError(()=>O.sync(()=>{o.stop("Failed to install dependencies.")}))),o.stop("Dependencies installed.")});function Jt(e,t){return O.gen(function*(){yield*(yield*E).log.info(`Legacy \`${t}\` was preserved during \`adamantite init\`. \`adamantite init\` does not migrate legacy ${e} configs yet.`)})}var ao=(e,t)=>O.gen(function*(){let r=yield*E,n=r.spinner();n.start("Setting up oxlint config...");let o=yield*c.exists(e),i=c.files[1].path;if(o.active?.format==="ts"&&o.legacy.length>0)yield*r.log.warning(`Found both \`${c.config}\` and \`${i}\`. Adamantite will use \`${c.config}\`.`);if(o.active?.format==="json")n.message(`Found \`${i}\`, keeping existing config.`),n.stop("oxlint config is ready."),yield*Jt("oxlint",i);else if(o.active?.format==="ts")n.message(`Found \`${c.config}\`, keeping existing config.`),n.stop("oxlint config is ready.");else n.message(`\`${c.config}\` not found, creating...`),yield*c.create(e,t),n.stop("oxlint config created successfully.")}),so=(e)=>O.gen(function*(){let t=yield*E,r=t.spinner();r.start("Setting up oxfmt config...");let n=yield*m.exists(e);if(n.active?.format==="ts"&&n.legacy.length>0)yield*t.log.warning(`Found both \`${m.config}\` and \`.oxfmtrc.json(c)\`. Adamantite will use \`${m.config}\`.`);if(n.active&&n.active.format!=="ts"&&n.legacy.length>0)yield*t.log.warning("Found both `.oxfmtrc.json` and `.oxfmtrc.jsonc`. Multiple legacy oxfmt configs exist; Adamantite will treat `.oxfmtrc.jsonc` as the source of truth when migration is needed.");if(n.active?.format==="json"||n.active?.format==="jsonc"){let o=n.active.path.endsWith(m.files[1].path)?m.files[1].path:m.files[2].path;r.message(`Found \`${o}\`, keeping existing config.`),r.stop("oxfmt config is ready."),yield*Jt("oxfmt",o)}else if(n.active?.format==="ts")r.message(`Found \`${m.config}\`, keeping existing config.`),r.stop("oxfmt config is ready.");else r.message(`\`${m.config}\` not found, creating...`),yield*m.create(e),r.stop("oxfmt config created successfully.")}),fo=(e,t)=>O.gen(function*(){let r=yield*er.FileSystem,n=yield*tr.Path,o=yield*E,i=yield*$(e),a=o.spinner();a.start("Adding scripts to your `package.json`..."),i.scripts??={};for(let d of t)switch(d){case"check":i.scripts.check="adamantite check";break;case"fix":i.scripts.fix="adamantite fix";break;case"format":i.scripts.format="adamantite format";break;case"check:monorepo":i.scripts["check:monorepo"]="adamantite monorepo";break;case"fix:monorepo":i.scripts["fix:monorepo"]="adamantite monorepo --fix";break;case"analyze":i.scripts.analyze="adamantite analyze";break;default:return yield*new Rt({script:d})}let u=n.join(e,"package.json");yield*r.writeFileString(u,`${JSON.stringify(i,null,2)}
112
+ `).pipe(O.mapError((d)=>new S({cause:d,path:u}))),a.stop("Scripts added to your `package.json`")}),lo=(e)=>O.gen(function*(){let t=yield*E,r=t.spinner();r.start("Setting up knip config...");let n=yield*y.exists(e);if(n.active?.format==="ts"&&n.legacy.length>0)yield*t.log.warning(`Found both \`${y.config}\` and \`knip.json(c)\`. Adamantite will use \`${y.config}\`.`);if(n.active&&n.active.format!=="ts"&&n.legacy.length>0)yield*t.log.warning("Found both `knip.json` and `knip.jsonc`. Multiple legacy knip configs exist; Adamantite will treat `knip.jsonc` as the source of truth when migration is needed.");if(n.active?.format==="json"||n.active?.format==="jsonc"){let o=n.active.path.endsWith(y.files[1].path)?y.files[1].path:y.files[2].path;r.message(`Found \`${o}\`, keeping existing config.`),r.stop("knip config is ready."),yield*Jt("knip",o)}else if(n.active?.format==="ts")r.message(`Found \`${y.config}\`, keeping existing config.`),r.stop("knip config is ready.");else r.message(`\`${y.config}\` not found, creating...`),yield*y.create(e),r.stop("knip config created successfully.")}),po=(e)=>O.gen(function*(){let r=(yield*E).spinner();if(r.start("Setting up TypeScript config..."),yield*q.exists(e))r.message(`\`${q.config}\` found, updating...`),yield*q.update(e),r.stop(`\`${q.config}\` updated successfully`);else r.message(`\`${q.config}\` not found, creating...`),yield*q.create(e),r.stop(`\`${q.config}\` created successfully`)}),uo=(e,t)=>O.gen(function*(){let r=yield*E;if(t.includes("vscode")){let n=r.spinner();if(n.start(`Checking for \`${ne.config}\`...`),yield*ne.exists(e))n.message(`\`${ne.config}\` found, updating...`),yield*ne.update(e),n.stop(`\`${ne.config}\` updated with Adamantite preset.`);else n.message(`\`${ne.config}\` not found, creating...`),yield*ne.create(e),n.stop(`\`${ne.config}\` created with Adamantite preset.`)}if(t.includes("zed")){let n=r.spinner();if(n.start(`Checking for \`${se.config}\`...`),yield*se.exists(e))n.message(`\`${se.config}\` found, updating...`),yield*se.update(e),n.stop(`\`${se.config}\` updated with Adamantite preset.`);else n.message(`\`${se.config}\` not found, creating...`),yield*se.create(e),n.stop(`\`${se.config}\` created with Adamantite preset.`)}}),co=(e,t)=>O.gen(function*(){let r=yield*E,n=r.spinner();n.start("Installing editor extensions...");let o=e.includes("zed"),i=e.includes("vscode");if(yield*O.gen(function*(){if(e.includes("vscode"))n.message("Installing VS Code extension..."),yield*ne.extension(t);return!0}).pipe(O.tapError(()=>O.sync(()=>{n.stop()})),O.catchTag("FailedToInstallExtension",(u)=>O.gen(function*(){return yield*r.log.warning(`⚠️ Failed to install the \`${u.extension}\` extension.`),yield*r.log.warning("Please install it manually after setup completes."),!1})),O.catchTag("VscodeCliNotFound",()=>O.gen(function*(){return yield*r.log.error("VSCode CLI ('code' command) not found."),yield*r.log.info("To install it:"),yield*r.log.info(" 1. Open VS Code"),yield*r.log.info(" 2. Press Cmd+Shift+P (macOS) or Ctrl+Shift+P (Windows/Linux)"),yield*r.log.info(` 3. Run 'Shell Command: Install "code" command in PATH'`),!1}))))if(o&&!i)n.stop("Zed extensions require manual install.");else n.stop("Editor extensions installed successfully.");if(o)yield*r.log.info("Install the Zed `oxc` extension: zed://extension/oxc")}),yo=(e,t,r)=>O.gen(function*(){let o=(yield*E).spinner();o.start("Setting up GitHub Actions workflow...");let i=yield*ie.exists(e),a=ie.files[0].path;if(i)o.message(`\`${a}\` found, updating...`),yield*ie.update(e,{packageManager:t,scripts:r}),o.stop("GitHub Actions workflow updated successfully.");else o.message(`Creating \`${a}\`...`),yield*ie.create(e,{packageManager:t,scripts:r}),o.stop("GitHub Actions workflow created successfully.")}).pipe(O.option),nr=ke.make("init").pipe(ke.withDescription("Initialize Adamantite in the current directory"),ke.withHandler(()=>O.gen(function*(){let e=oo.cwd(),t=yield*E;yield*De(),yield*t.intro("\uD83D\uDCA0 adamantite init");let n=yield*(yield*Z).detectPackageManager(e);if(!n)return yield*new Ue({});if(n.warnings?.length)for(let f of n.warnings)yield*t.log.warning(f);yield*t.log.info(`Detected package manager: ${n.name}`);let o=yield*bt(e);if(o)yield*t.log.info("We've detected a monorepo setup in your project.");let i=yield*t.multiselect({message:"Which scripts do you want to add to your `package.json`?",options:[{hint:"recommended",label:"check - find issues and type errors using oxlint",value:"check"},{hint:"recommended",label:"fix - fix code issues using oxlint",value:"fix"},{hint:"recommended",label:"format - code formatting using oxfmt",value:"format"},{disabled:!o,hint:o?void 0:"available for monorepo projects",label:"check:monorepo - check for monorepo-specific issues using Sherif",value:"check:monorepo"},{disabled:!o,hint:o?void 0:"available for monorepo projects",label:"fix:monorepo - fix monorepo-specific issues using Sherif",value:"fix:monorepo"},{label:"analyze - find unused dependencies, exports, and files using knip",value:"analyze"}]}),a=i.includes("check")||i.includes("fix"),u=[];if(a)u=yield*t.multiselect({message:"Which presets do you want to install? (core is always included)",options:[{label:"React",value:"react"},{label:"Next.js",value:"nextjs"},{label:"Vue",value:"vue"},{label:"Jest",value:"jest"},{label:"Vitest",value:"vitest"},{label:"Node",value:"node"}],required:!1});let d=!1;if(a)d=yield*t.confirm({initialValue:!0,message:"Adamantite provides a TypeScript preset to enforce strict type-safety. Would you like to use it?"});let s=yield*t.multiselect({message:"Which editors do you want to configure? (optional)",options:[{label:"VSCode / Cursor / Windsurf",value:"vscode"},{label:"Zed",value:"zed"}],required:!1}),p=!1;if(s.length>0)p=yield*t.confirm({initialValue:!0,message:"Do you want to install the recommended editor extensions?"});let l=it(i),h=!1;if(l)h=yield*t.confirm({message:"Do you want to add a GitHub Actions workflow to run checks in CI?"});let j=i.includes("format"),D=i.includes("check:monorepo")||i.includes("fix:monorepo"),N=i.includes("analyze"),W=["adamantite"];if(a)W.push(`${c.name}@${c.version}`,`${fe.name}@${fe.version}`);if(j)W.push(`${m.name}@${m.version}`);if(D)W.push(`${K.name}@${K.version}`);if(N)W.push(`${y.name}@${y.version}`);if(yield*io(e,W),j)yield*so(e);if(a)yield*ao(e,u);if(N)yield*lo(e);if(yield*fo(e,i),d)yield*po(e);if(yield*uo(e,s),p)yield*co(s,i);if(h){let f=n.name;if(Ke(f))yield*yo(e,f,i);else yield*t.log.warning(`Skipping GitHub Actions setup: \`${f}\` is not a supported package manager for CI workflow generation.`)}yield*t.log.success("Your project is now configured"),yield*t.outro("\uD83D\uDCA0 Adamantite initialized successfully!")}).pipe(O.catchTags({OperationCancelled:()=>O.gen(function*(){yield*(yield*E).cancel("You've cancelled the initialization process.")})}))));import*as rr from"effect/Effect";import*as qe from"effect/unstable/cli/Command";import*as gt from"effect/unstable/cli/Flag";import*as or from"effect/unstable/process/ChildProcessSpawner";var mo=gt.boolean("fix").pipe(gt.withDescription("Automatically fix issues")),ir=qe.make("monorepo",{fix:mo}).pipe(qe.withDescription("Find and fix monorepo-specific issues using Sherif"),qe.withHandler(({fix:e})=>rr.gen(function*(){let t=yield*_,r=e?["--fix"]:[],n=yield*t.run({args:r,command:K.name,stdin:"inherit"});if(n!==or.ExitCode(0))yield*new I({command:K.name,exitCode:n})})));import*as ar from"effect/Effect";import*as ze from"effect/unstable/cli/Command";import*as sr from"effect/unstable/process/ChildProcessSpawner";var fr=ze.make("typecheck").pipe(ze.withDescription("Deprecated alias for `check`"),ze.withHandler(()=>ar.gen(function*(){let e=yield*E,t=yield*_;yield*e.log.warning("Deprecated. Use `adamantite check` for typechecking.");let r=yield*t.run({args:[],command:c.name});if(r!==sr.ExitCode(0))yield*new I({command:c.name,exitCode:r})})));import ho from"node:process";import*as X from"effect/Effect";import*as Ae from"effect/unstable/cli/Command";var Eo=[c,fe,m,K,y],go=[c,fe,m,K,y];function Oo(e){return e.applicable&&Array.isArray(e.actions)}function So(e,t){let r=[];for(let n of go){if(t.has(n.name))continue;let o=e.devDependencies?.[n.name]??e.dependencies?.[n.name];if(o&&B(o)!==n.version)r.push({currentVersion:o,name:n.name,targetVersion:n.version})}return r}var lr=Ae.make("update").pipe(Ae.withDescription("Run applicable Adamantite migrations and update managed dependencies"),Ae.withHandler(()=>X.gen(function*(){let e=ho.cwd(),t=yield*E,r=yield*Z,n={cwd:e};yield*De(),yield*t.intro("\uD83D\uDCA0 adamantite update");let o=()=>X.gen(function*(){let f=[];for(let F of Eo){let Qe=yield*F.assess(e);if(Oo(Qe))f.push({assessment:Qe,integration:F})}return f}),i=yield*o();for(let{assessment:f}of i)for(let F of f.warnings)yield*t.log.warning(F);let a=new Set(i.map(({integration:f})=>f.name)),u=i.flatMap(({assessment:f})=>f.actions),d=new Set(u.filter((f)=>f.type==="run_migration").map((f)=>f.migrationId)),s=[];for(let f of ut.filter((F)=>F.tags.includes("update"))){let F=qn[f.id];if(a.has(F))continue;let Qe=yield*f.check(n);s.push({migration:f,result:Qe})}for(let f of s){for(let F of f.result.warnings)yield*t.log.warning(F);if(f.result.applicable&&f.result.summary)yield*t.log.info(f.result.summary)}let p=[];for(let f of ut){if(!d.has(f.id))continue;yield*be(f,n,{onRestore:t.log.warning(`Migration "${f.title}" failed, restoring files...`)}),p.push(f.id)}for(let{migration:f,result:F}of s){if(!F.applicable||!F.summary)continue;yield*be(f,n,{onRestore:t.log.warning(`Migration "${f.title}" failed, restoring files...`)}),p.push(f.id)}if(p.length>0)yield*t.log.success("Migrations ran successfully.");let l=yield*$(e),h=yield*o(),j=h.flatMap(({assessment:f})=>f.actions).filter((f)=>f.type==="create_config"||f.type==="update_config"||f.type==="manual_fix"),D=h.flatMap(({assessment:f})=>f.actions).filter((f)=>f.type==="install_package"||f.type==="update_package").map((f)=>f.type==="install_package"?{currentVersion:"not installed",name:f.package,targetVersion:f.targetVersion}:{currentVersion:f.currentVersion,name:f.package,targetVersion:f.targetVersion}),N=new Set(D.map((f)=>f.name)),W=[...D,...So(l,N)];if(W.length>0){yield*t.log.info("The following dependencies will be updated:");for(let F of W)yield*t.log.info(` ${F.name}: ${F.currentVersion} → ${F.targetVersion}`);let f=t.spinner();f.start("Updating dependencies..."),yield*r.addDevDependencies(W.map((F)=>`${F.name}@${F.targetVersion}`),e,{silent:!0}).pipe(X.tapError(()=>X.sync(()=>{f.stop("Failed to update dependencies")}))),f.stop("Dependencies updated successfully"),yield*t.log.success("Dependencies updated successfully.")}if(j.length>0){yield*t.log.warning("Some configuration follow-up belongs to `adamantite doctor --fix`.");for(let f of j)yield*t.log.warning(`Doctor follow-up: ${f.description}`)}if(p.length===0&&W.length===0&&j.length===0)return yield*t.log.success("No changes needed."),"no-changes";return"success"}).pipe(X.tapError(()=>X.gen(function*(){yield*(yield*E).outro("❌ Update failed")})),X.tap((e)=>X.gen(function*(){let t=yield*E;switch(e){case"no-changes":yield*t.outro("✅ Adamantite is already up to date.");break;case"success":yield*t.outro("✅ Update completed successfully!");break;default:break}})))));var jo=ce.make("adamantite").pipe(ce.withDescription("Opinionated preset package for modern TypeScript applications"),ce.withSubcommands([Yt,an,Jn,Bn,Xn,nr,ir,fr,lr]));var Fo=ce.run(jo,{version:"0.32.3"}).pipe(A.as(0),A.catchTag("CommandFailed",(e)=>A.succeed(e.exitCode)),A.catch((e)=>A.service(E).pipe(A.flatMap((t)=>t.log.error(e.message)),A.as(mr.ExitCode(1)))),A.provide(dr.mergeAll(ur.layer,E.layer,_.layer,Z.layer)));pr.runMain(Fo,{teardown:(e,t)=>{if(cr.isSuccess(e)){t(Number(e.value));return}yr.defaultTeardown(e,t)}});
@@ -6,14 +6,6 @@ var config = {
6
6
  "array-callback-return": "error",
7
7
  "arrow-body-style": ["error", "as-needed"],
8
8
  "block-scoped-var": "error",
9
- "capitalized-comments": [
10
- "error",
11
- "always",
12
- {
13
- ignoreConsecutiveComments: true,
14
- ignoreInlineComments: true
15
- }
16
- ],
17
9
  "class-methods-use-this": "warn",
18
10
  "constructor-super": "error",
19
11
  "default-case": "off",
@@ -27,6 +19,7 @@ var config = {
27
19
  "import/first": "error",
28
20
  "import/named": "error",
29
21
  "import/namespace": "error",
22
+ "import/newline-after-import": "error",
30
23
  "import/no-absolute-path": "error",
31
24
  "import/no-amd": "error",
32
25
  "import/no-cycle": "error",
@@ -54,7 +47,11 @@ var config = {
54
47
  "jsdoc/require-property-name": "error",
55
48
  "jsdoc/require-property-type": "error",
56
49
  "jsdoc/require-returns-description": "error",
50
+ "jsdoc/require-throws-description": "error",
51
+ "jsdoc/require-throws-type": "error",
57
52
  "jsdoc/require-yields": "error",
53
+ "jsdoc/require-yields-description": "error",
54
+ "jsdoc/require-yields-type": "error",
58
55
  "no-array-constructor": "error",
59
56
  "no-async-promise-executor": "error",
60
57
  "no-await-in-loop": "error",
@@ -97,6 +94,8 @@ var config = {
97
94
  "no-fallthrough": "error",
98
95
  "no-func-assign": "error",
99
96
  "no-global-assign": "error",
97
+ "no-implicit-globals": "error",
98
+ "no-implied-eval": "error",
100
99
  "no-import-assign": "error",
101
100
  "no-inner-declarations": "error",
102
101
  "no-invalid-regexp": "error",
@@ -107,6 +106,7 @@ var config = {
107
106
  "no-lonely-if": "error",
108
107
  "no-loop-func": "error",
109
108
  "no-loss-of-precision": "error",
109
+ "no-misleading-character-class": "error",
110
110
  "no-multi-assign": "error",
111
111
  "no-multi-str": "error",
112
112
  "no-negated-condition": "error",
@@ -140,10 +140,12 @@ var config = {
140
140
  "no-sparse-arrays": "error",
141
141
  "no-template-curly-in-string": "error",
142
142
  "no-this-before-super": "error",
143
+ "no-throw-literal": "error",
143
144
  "no-unassigned-vars": "error",
144
145
  "no-unexpected-multiline": "error",
145
146
  "no-unmodified-loop-condition": "error",
146
147
  "no-unneeded-ternary": "error",
148
+ "no-unreachable": "error",
147
149
  "no-unsafe-finally": "error",
148
150
  "no-unsafe-negation": "error",
149
151
  "no-unsafe-optional-chaining": "error",
@@ -194,15 +196,18 @@ var config = {
194
196
  "oxc/number-arg-out-of-range": "error",
195
197
  "oxc/only-used-in-recursion": "error",
196
198
  "oxc/uninvoked-array-callback": "error",
199
+ "prefer-arrow-callback": "error",
197
200
  "prefer-const": "error",
198
201
  "prefer-exponentiation-operator": "error",
199
202
  "prefer-object-has-own": "error",
200
203
  "prefer-object-spread": "error",
204
+ "prefer-regex-literals": "error",
201
205
  "prefer-rest-params": "error",
202
206
  "prefer-spread": "error",
203
207
  "prefer-template": "error",
204
208
  "preserve-caught-error": "error",
205
209
  "promise/always-return": "error",
210
+ "promise/catch-or-return": "error",
206
211
  "promise/no-callback-in-promise": "error",
207
212
  "promise/no-multiple-resolved": "error",
208
213
  "promise/no-nesting": "error",
@@ -211,6 +216,7 @@ var config = {
211
216
  "promise/no-return-in-finally": "error",
212
217
  "promise/no-return-wrap": "error",
213
218
  "promise/param-names": "error",
219
+ "promise/prefer-catch": "error",
214
220
  "promise/spec-only": "error",
215
221
  "promise/valid-params": "error",
216
222
  radix: "error",
@@ -247,6 +253,7 @@ var config = {
247
253
  "typescript/ban-tslint-comment": "error",
248
254
  "typescript/class-literal-property-style": "error",
249
255
  "typescript/consistent-generic-constructors": "error",
256
+ "typescript/consistent-indexed-object-style": "error",
250
257
  "typescript/consistent-return": "off",
251
258
  "typescript/consistent-type-assertions": "error",
252
259
  "typescript/consistent-type-exports": "error",
@@ -279,6 +286,7 @@ var config = {
279
286
  "typescript/no-non-null-asserted-optional-chain": "error",
280
287
  "typescript/no-non-null-assertion": "error",
281
288
  "typescript/no-redundant-type-constituents": "error",
289
+ "typescript/no-require-imports": "error",
282
290
  "typescript/no-this-alias": "error",
283
291
  "typescript/no-unnecessary-boolean-literal-compare": "error",
284
292
  "typescript/no-unnecessary-condition": "error",
@@ -302,6 +310,7 @@ var config = {
302
310
  "typescript/no-var-requires": "error",
303
311
  "typescript/no-wrapper-object-types": "error",
304
312
  "typescript/non-nullable-type-assertion-style": "error",
313
+ "typescript/only-throw-error": "error",
305
314
  "typescript/parameter-properties": "error",
306
315
  "typescript/prefer-as-const": "error",
307
316
  "typescript/prefer-enum-initializers": "error",
@@ -357,6 +366,7 @@ var config = {
357
366
  "unicorn/no-abusive-eslint-disable": "error",
358
367
  "unicorn/no-accessor-recursion": "error",
359
368
  "unicorn/no-array-callback-reference": "error",
369
+ "unicorn/no-array-fill-with-reference-type": "error",
360
370
  "unicorn/no-array-method-this-argument": "error",
361
371
  "unicorn/no-array-reverse": "error",
362
372
  "unicorn/no-array-sort": "error",
@@ -419,6 +429,7 @@ var config = {
419
429
  "unicorn/prefer-dom-node-remove": "error",
420
430
  "unicorn/prefer-dom-node-text-content": "error",
421
431
  "unicorn/prefer-event-target": "error",
432
+ "unicorn/prefer-export-from": "error",
422
433
  "unicorn/prefer-global-this": "error",
423
434
  "unicorn/prefer-import-meta-properties": "error",
424
435
  "unicorn/prefer-keyboard-event-key": "error",
@@ -440,9 +451,9 @@ var config = {
440
451
  "unicorn/prefer-response-static-json": "error",
441
452
  "unicorn/prefer-set-has": "error",
442
453
  "unicorn/prefer-set-size": "error",
454
+ "unicorn/prefer-single-call": "error",
443
455
  "unicorn/prefer-string-replace-all": "error",
444
456
  "unicorn/prefer-string-slice": "error",
445
- "unicorn/prefer-string-starts-ends-with": "error",
446
457
  "unicorn/prefer-string-trim-start-end": "error",
447
458
  "unicorn/prefer-structured-clone": "error",
448
459
  "unicorn/prefer-ternary": ["error", "only-single-line"],
@@ -28,6 +28,7 @@ var config = {
28
28
  "jest/no-standalone-expect": "error",
29
29
  "jest/no-test-prefixes": "error",
30
30
  "jest/no-test-return-statement": "error",
31
+ "jest/no-unneeded-async-expect-function": "error",
31
32
  "jest/no-untyped-mock-factory": "error",
32
33
  "jest/padding-around-after-all-blocks": "error",
33
34
  "jest/padding-around-test-blocks": "error",
@@ -36,12 +37,15 @@ var config = {
36
37
  "jest/prefer-each": "error",
37
38
  "jest/prefer-ending-with-an-expect": "error",
38
39
  "jest/prefer-equality-matcher": "error",
40
+ "jest/prefer-expect-assertions": "error",
39
41
  "jest/prefer-expect-resolves": "error",
40
42
  "jest/prefer-hooks-in-order": "error",
41
43
  "jest/prefer-hooks-on-top": "error",
42
44
  "jest/prefer-jest-mocked": "error",
43
45
  "jest/prefer-lowercase-title": "error",
44
46
  "jest/prefer-mock-promise-shorthand": "error",
47
+ "jest/prefer-mock-return-shorthand": "error",
48
+ "jest/prefer-snapshot-hint": "error",
45
49
  "jest/prefer-spy-on": "error",
46
50
  "jest/prefer-strict-equal": "error",
47
51
  "jest/prefer-to-be": "error",
@@ -2,7 +2,9 @@
2
2
  var config = {
3
3
  plugins: ["node"],
4
4
  rules: {
5
+ "node/handle-callback-err": "error",
5
6
  "node/no-exports-assign": "error",
7
+ "node/no-mixed-requires": "error",
6
8
  "node/no-new-require": "error",
7
9
  "node/no-path-concat": "error"
8
10
  }
@@ -12,10 +12,12 @@ var config = {
12
12
  "jsx-a11y/aria-unsupported-elements": "error",
13
13
  "jsx-a11y/autocomplete-valid": "error",
14
14
  "jsx-a11y/click-events-have-key-events": "error",
15
+ "jsx-a11y/control-has-associated-label": "error",
15
16
  "jsx-a11y/heading-has-content": "error",
16
17
  "jsx-a11y/html-has-lang": "error",
17
18
  "jsx-a11y/iframe-has-title": "error",
18
19
  "jsx-a11y/img-redundant-alt": "error",
20
+ "jsx-a11y/interactive-supports-focus": "error",
19
21
  "jsx-a11y/label-has-associated-control": "error",
20
22
  "jsx-a11y/lang": "error",
21
23
  "jsx-a11y/media-has-caption": "error",
@@ -24,16 +26,26 @@ var config = {
24
26
  "jsx-a11y/no-aria-hidden-on-focusable": "error",
25
27
  "jsx-a11y/no-autofocus": "error",
26
28
  "jsx-a11y/no-distracting-elements": "error",
29
+ "jsx-a11y/no-interactive-element-to-noninteractive-role": "error",
30
+ "jsx-a11y/no-noninteractive-element-interactions": "error",
31
+ "jsx-a11y/no-noninteractive-element-to-interactive-role": "error",
27
32
  "jsx-a11y/no-noninteractive-tabindex": "error",
28
33
  "jsx-a11y/no-redundant-roles": "error",
34
+ "jsx-a11y/no-static-element-interactions": "error",
29
35
  "jsx-a11y/prefer-tag-over-role": "error",
30
36
  "jsx-a11y/role-has-required-aria-props": "error",
31
37
  "jsx-a11y/role-supports-aria-props": "error",
32
38
  "jsx-a11y/scope": "error",
33
39
  "jsx-a11y/tabindex-no-positive": "error",
40
+ "react-perf/jsx-no-jsx-as-prop": "error",
41
+ "react-perf/jsx-no-new-array-as-prop": "error",
42
+ "react-perf/jsx-no-new-function-as-prop": "error",
43
+ "react-perf/jsx-no-new-object-as-prop": "error",
44
+ "react/button-has-type": "error",
34
45
  "react/checked-requires-onchange-or-readonly": "error",
35
46
  "react/display-name": "off",
36
47
  "react/exhaustive-deps": "error",
48
+ "react/forward-ref-uses-ref": "error",
37
49
  "react/hook-use-state": "error",
38
50
  "react/iframe-missing-sandbox": "error",
39
51
  "react/jsx-boolean-value": "error",
@@ -48,6 +60,7 @@ var config = {
48
60
  "react/jsx-handler-names": "error",
49
61
  "react/jsx-key": "error",
50
62
  "react/jsx-no-comment-textnodes": "error",
63
+ "react/jsx-no-constructed-context-values": "error",
51
64
  "react/jsx-no-duplicate-props": "error",
52
65
  "react/jsx-no-script-url": "error",
53
66
  "react/jsx-no-target-blank": "error",
@@ -57,6 +70,7 @@ var config = {
57
70
  "react/jsx-props-no-spread-multi": "error",
58
71
  "react/no-array-index-key": "error",
59
72
  "react/no-children-prop": "error",
73
+ "react/no-clone-element": "error",
60
74
  "react/no-danger": "error",
61
75
  "react/no-danger-with-children": "error",
62
76
  "react/no-direct-mutation-state": "error",
@@ -64,6 +78,8 @@ var config = {
64
78
  "react/no-is-mounted": "error",
65
79
  "react/no-multi-comp": "off",
66
80
  "react/no-namespace": "error",
81
+ "react/no-object-type-as-default-prop": "error",
82
+ "react/no-react-children": "error",
67
83
  "react/no-redundant-should-component-update": "error",
68
84
  "react/no-render-return-value": "error",
69
85
  "react/no-set-state": "error",
@@ -71,8 +87,11 @@ var config = {
71
87
  "react/no-unescaped-entities": "error",
72
88
  "react/no-unknown-property": "error",
73
89
  "react/no-unsafe": "error",
90
+ "react/no-unstable-nested-components": "error",
74
91
  "react/prefer-es6-class": ["error", "always"],
75
92
  "react/prefer-function-component": "error",
93
+ "react/react-compiler": "error",
94
+ "react/require-render-return": "error",
76
95
  "react/rules-of-hooks": "error",
77
96
  "react/self-closing-comp": "error",
78
97
  "react/state-in-constructor": ["error", "never"],
@@ -3,22 +3,68 @@ var config = {
3
3
  plugins: ["vitest"],
4
4
  rules: {
5
5
  "vitest/consistent-each-for": "error",
6
+ "vitest/consistent-test-it": "error",
6
7
  "vitest/hoisted-apis-on-top": "error",
8
+ "vitest/max-expects": "error",
9
+ "vitest/max-nested-describe": "error",
10
+ "vitest/no-alias-methods": "error",
11
+ "vitest/no-commented-out-tests": "error",
12
+ "vitest/no-conditional-expect": "error",
13
+ "vitest/no-conditional-in-test": "error",
7
14
  "vitest/no-conditional-tests": "error",
15
+ "vitest/no-disabled-tests": "error",
16
+ "vitest/no-duplicate-hooks": "error",
17
+ "vitest/no-focused-tests": "error",
18
+ "vitest/no-hooks": "error",
19
+ "vitest/no-identical-title": "error",
8
20
  "vitest/no-import-node-test": "error",
9
21
  "vitest/no-importing-vitest-globals": "error",
22
+ "vitest/no-interpolation-in-snapshots": "error",
23
+ "vitest/no-large-snapshots": "error",
24
+ "vitest/no-mocks-import": "error",
25
+ "vitest/no-restricted-matchers": "error",
26
+ "vitest/no-standalone-expect": "error",
27
+ "vitest/no-test-prefixes": "error",
28
+ "vitest/no-test-return-statement": "error",
10
29
  "vitest/no-unneeded-async-expect-function": "error",
11
30
  "vitest/prefer-called-exactly-once-with": "error",
12
31
  "vitest/prefer-called-once": "error",
13
32
  "vitest/prefer-called-times": "error",
33
+ "vitest/prefer-called-with": "error",
34
+ "vitest/prefer-comparison-matcher": "error",
14
35
  "vitest/prefer-describe-function-title": "error",
36
+ "vitest/prefer-each": "error",
37
+ "vitest/prefer-equality-matcher": "error",
38
+ "vitest/prefer-expect-assertions": "error",
39
+ "vitest/prefer-expect-resolves": "error",
15
40
  "vitest/prefer-expect-type-of": "error",
41
+ "vitest/prefer-hooks-in-order": "error",
42
+ "vitest/prefer-hooks-on-top": "error",
16
43
  "vitest/prefer-import-in-mock": "error",
44
+ "vitest/prefer-importing-vitest-globals": "error",
45
+ "vitest/prefer-lowercase-title": "error",
46
+ "vitest/prefer-mock-promise-shorthand": "error",
47
+ "vitest/prefer-mock-return-shorthand": "error",
48
+ "vitest/prefer-snapshot-hint": "error",
49
+ "vitest/prefer-spy-on": "error",
17
50
  "vitest/prefer-strict-boolean-matchers": "error",
51
+ "vitest/prefer-strict-equal": "error",
52
+ "vitest/prefer-to-be": "error",
18
53
  "vitest/prefer-to-be-object": "error",
54
+ "vitest/prefer-to-contain": "error",
55
+ "vitest/prefer-to-have-been-called-times": "error",
56
+ "vitest/prefer-to-have-length": "error",
57
+ "vitest/prefer-todo": "error",
19
58
  "vitest/require-awaited-expect-poll": "error",
59
+ "vitest/require-hook": "error",
20
60
  "vitest/require-local-test-context-for-concurrent-snapshots": "error",
21
- "vitest/require-mock-type-parameters": "error"
61
+ "vitest/require-mock-type-parameters": "error",
62
+ "vitest/require-to-throw-message": "error",
63
+ "vitest/require-top-level-describe": "error",
64
+ "vitest/valid-describe-callback": "error",
65
+ "vitest/valid-expect": "error",
66
+ "vitest/valid-expect-in-promise": "error",
67
+ "vitest/valid-title": "error"
22
68
  }
23
69
  };
24
70
  var vitest_default = config;
@@ -7,17 +7,44 @@ var config = {
7
7
  "vue/define-props-destructuring": "error",
8
8
  "vue/max-props": "error",
9
9
  "vue/no-arrow-functions-in-watch": "error",
10
+ "vue/no-async-in-computed-properties": "error",
11
+ "vue/no-computed-properties-in-data": "error",
12
+ "vue/no-deprecated-data-object-declaration": "error",
13
+ "vue/no-deprecated-delete-set": "error",
10
14
  "vue/no-deprecated-destroyed-lifecycle": "error",
15
+ "vue/no-deprecated-events-api": "error",
16
+ "vue/no-deprecated-model-definition": "error",
17
+ "vue/no-deprecated-props-default-this": "error",
18
+ "vue/no-deprecated-vue-config-keycodes": "error",
19
+ "vue/no-dupe-keys": "error",
11
20
  "vue/no-export-in-script-setup": "error",
21
+ "vue/no-expose-after-await": "error",
12
22
  "vue/no-import-compiler-macros": "error",
13
23
  "vue/no-lifecycle-after-await": "error",
14
24
  "vue/no-multiple-slot-args": "error",
15
25
  "vue/no-required-prop-with-default": "error",
26
+ "vue/no-reserved-component-names": "error",
27
+ "vue/no-reserved-keys": "error",
28
+ "vue/no-reserved-props": "error",
29
+ "vue/no-shared-component-data": "error",
30
+ "vue/no-side-effects-in-computed-properties": "error",
31
+ "vue/no-this-in-before-route-enter": "error",
32
+ "vue/no-watch-after-await": "error",
16
33
  "vue/prefer-import-from-vue": "error",
17
34
  "vue/require-default-export": "error",
35
+ "vue/require-default-prop": "error",
36
+ "vue/require-direct-export": "error",
37
+ "vue/require-prop-type-constructor": "error",
38
+ "vue/require-prop-types": "error",
39
+ "vue/require-render-return": "error",
40
+ "vue/require-slots-as-functions": "error",
18
41
  "vue/require-typed-ref": "error",
42
+ "vue/return-in-computed-property": "error",
43
+ "vue/return-in-emits-validator": "error",
19
44
  "vue/valid-define-emits": "error",
20
- "vue/valid-define-props": "error"
45
+ "vue/valid-define-options": "error",
46
+ "vue/valid-define-props": "error",
47
+ "vue/valid-next-tick": "error"
21
48
  }
22
49
  };
23
50
  var vue_default = config;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adamantite",
3
- "version": "0.32.2",
3
+ "version": "0.32.3",
4
4
  "description": "An strict and opinionated set of presets for modern TypeScript applications",
5
5
  "keywords": [
6
6
  "adamantite",
@@ -69,32 +69,32 @@
69
69
  "version": "changeset version"
70
70
  },
71
71
  "dependencies": {
72
- "@clack/prompts": "1.2.0",
73
- "@effect/platform-node": "4.0.0-beta.56",
72
+ "@clack/prompts": "1.6.0",
73
+ "@effect/platform-node": "4.0.0-beta.92",
74
74
  "defu": "6.1.7",
75
- "effect": "4.0.0-beta.56",
76
- "esrap": "2.2.5",
75
+ "effect": "4.0.0-beta.92",
76
+ "esrap": "2.2.13",
77
77
  "jsonc-parser": "3.3.1",
78
- "nypm": "0.6.5",
79
- "oxc-parser": "^0.127.0"
78
+ "nypm": "0.6.8",
79
+ "oxc-parser": "^0.138.0"
80
80
  },
81
81
  "devDependencies": {
82
82
  "@changesets/changelog-github": "0.7.0",
83
83
  "@changesets/cli": "2.31.0",
84
- "@types/bun": "1.3.13",
84
+ "@types/bun": "1.3.14",
85
85
  "@types/figlet": "1.7.0",
86
- "@typescript/native-preview": "7.0.0-dev.20260422.1",
87
- "bunup": "0.16.31",
86
+ "@typescript/native-preview": "7.0.0-dev.20260701.1",
87
+ "bunup": "0.16.32",
88
88
  "figlet": "1.11.0",
89
- "knip": "6.6.1",
90
- "oxfmt": "0.46.0",
91
- "oxlint": "1.61.0",
92
- "oxlint-tsgolint": "0.21.1",
93
- "sherif": "1.11.1",
94
- "type-fest": "5.6.0"
89
+ "knip": "6.23.0",
90
+ "oxfmt": "0.57.0",
91
+ "oxlint": "1.72.0",
92
+ "oxlint-tsgolint": "0.24.0",
93
+ "sherif": "1.12.0",
94
+ "type-fest": "5.7.0"
95
95
  },
96
96
  "engines": {
97
- "bun": ">=1.3.6"
97
+ "bun": ">=1.3.14"
98
98
  },
99
- "packageManager": "bun@1.3.10"
99
+ "packageManager": "bun@1.3.14"
100
100
  }
@@ -7,14 +7,6 @@ const config: OxlintConfig = {
7
7
  "array-callback-return": "error",
8
8
  "arrow-body-style": ["error", "as-needed"],
9
9
  "block-scoped-var": "error",
10
- "capitalized-comments": [
11
- "error",
12
- "always",
13
- {
14
- ignoreConsecutiveComments: true,
15
- ignoreInlineComments: true,
16
- },
17
- ],
18
10
  "class-methods-use-this": "warn",
19
11
  "constructor-super": "error",
20
12
  "default-case": "off",
@@ -28,6 +20,7 @@ const config: OxlintConfig = {
28
20
  "import/first": "error",
29
21
  "import/named": "error",
30
22
  "import/namespace": "error",
23
+ "import/newline-after-import": "error",
31
24
  "import/no-absolute-path": "error",
32
25
  "import/no-amd": "error",
33
26
  "import/no-cycle": "error",
@@ -55,7 +48,11 @@ const config: OxlintConfig = {
55
48
  "jsdoc/require-property-name": "error",
56
49
  "jsdoc/require-property-type": "error",
57
50
  "jsdoc/require-returns-description": "error",
51
+ "jsdoc/require-throws-description": "error",
52
+ "jsdoc/require-throws-type": "error",
58
53
  "jsdoc/require-yields": "error",
54
+ "jsdoc/require-yields-description": "error",
55
+ "jsdoc/require-yields-type": "error",
59
56
  "no-array-constructor": "error",
60
57
  "no-async-promise-executor": "error",
61
58
  "no-await-in-loop": "error",
@@ -98,6 +95,8 @@ const config: OxlintConfig = {
98
95
  "no-fallthrough": "error",
99
96
  "no-func-assign": "error",
100
97
  "no-global-assign": "error",
98
+ "no-implicit-globals": "error",
99
+ "no-implied-eval": "error",
101
100
  "no-import-assign": "error",
102
101
  "no-inner-declarations": "error",
103
102
  "no-invalid-regexp": "error",
@@ -108,6 +107,7 @@ const config: OxlintConfig = {
108
107
  "no-lonely-if": "error",
109
108
  "no-loop-func": "error",
110
109
  "no-loss-of-precision": "error",
110
+ "no-misleading-character-class": "error",
111
111
  "no-multi-assign": "error",
112
112
  "no-multi-str": "error",
113
113
  "no-negated-condition": "error",
@@ -141,10 +141,12 @@ const config: OxlintConfig = {
141
141
  "no-sparse-arrays": "error",
142
142
  "no-template-curly-in-string": "error",
143
143
  "no-this-before-super": "error",
144
+ "no-throw-literal": "error",
144
145
  "no-unassigned-vars": "error",
145
146
  "no-unexpected-multiline": "error",
146
147
  "no-unmodified-loop-condition": "error",
147
148
  "no-unneeded-ternary": "error",
149
+ "no-unreachable": "error",
148
150
  "no-unsafe-finally": "error",
149
151
  "no-unsafe-negation": "error",
150
152
  "no-unsafe-optional-chaining": "error",
@@ -195,15 +197,18 @@ const config: OxlintConfig = {
195
197
  "oxc/number-arg-out-of-range": "error",
196
198
  "oxc/only-used-in-recursion": "error",
197
199
  "oxc/uninvoked-array-callback": "error",
200
+ "prefer-arrow-callback": "error",
198
201
  "prefer-const": "error",
199
202
  "prefer-exponentiation-operator": "error",
200
203
  "prefer-object-has-own": "error",
201
204
  "prefer-object-spread": "error",
205
+ "prefer-regex-literals": "error",
202
206
  "prefer-rest-params": "error",
203
207
  "prefer-spread": "error",
204
208
  "prefer-template": "error",
205
209
  "preserve-caught-error": "error",
206
210
  "promise/always-return": "error",
211
+ "promise/catch-or-return": "error",
207
212
  "promise/no-callback-in-promise": "error",
208
213
  "promise/no-multiple-resolved": "error",
209
214
  "promise/no-nesting": "error",
@@ -212,6 +217,7 @@ const config: OxlintConfig = {
212
217
  "promise/no-return-in-finally": "error",
213
218
  "promise/no-return-wrap": "error",
214
219
  "promise/param-names": "error",
220
+ "promise/prefer-catch": "error",
215
221
  "promise/spec-only": "error",
216
222
  "promise/valid-params": "error",
217
223
  radix: "error",
@@ -248,6 +254,7 @@ const config: OxlintConfig = {
248
254
  "typescript/ban-tslint-comment": "error",
249
255
  "typescript/class-literal-property-style": "error",
250
256
  "typescript/consistent-generic-constructors": "error",
257
+ "typescript/consistent-indexed-object-style": "error",
251
258
  "typescript/consistent-return": "off",
252
259
  "typescript/consistent-type-assertions": "error",
253
260
  "typescript/consistent-type-exports": "error",
@@ -280,6 +287,7 @@ const config: OxlintConfig = {
280
287
  "typescript/no-non-null-asserted-optional-chain": "error",
281
288
  "typescript/no-non-null-assertion": "error",
282
289
  "typescript/no-redundant-type-constituents": "error",
290
+ "typescript/no-require-imports": "error",
283
291
  "typescript/no-this-alias": "error",
284
292
  "typescript/no-unnecessary-boolean-literal-compare": "error",
285
293
  "typescript/no-unnecessary-condition": "error",
@@ -303,6 +311,7 @@ const config: OxlintConfig = {
303
311
  "typescript/no-var-requires": "error",
304
312
  "typescript/no-wrapper-object-types": "error",
305
313
  "typescript/non-nullable-type-assertion-style": "error",
314
+ "typescript/only-throw-error": "error",
306
315
  "typescript/parameter-properties": "error",
307
316
  "typescript/prefer-as-const": "error",
308
317
  "typescript/prefer-enum-initializers": "error",
@@ -358,6 +367,7 @@ const config: OxlintConfig = {
358
367
  "unicorn/no-abusive-eslint-disable": "error",
359
368
  "unicorn/no-accessor-recursion": "error",
360
369
  "unicorn/no-array-callback-reference": "error",
370
+ "unicorn/no-array-fill-with-reference-type": "error",
361
371
  "unicorn/no-array-method-this-argument": "error",
362
372
  "unicorn/no-array-reverse": "error",
363
373
  "unicorn/no-array-sort": "error",
@@ -420,6 +430,7 @@ const config: OxlintConfig = {
420
430
  "unicorn/prefer-dom-node-remove": "error",
421
431
  "unicorn/prefer-dom-node-text-content": "error",
422
432
  "unicorn/prefer-event-target": "error",
433
+ "unicorn/prefer-export-from": "error",
423
434
  "unicorn/prefer-global-this": "error",
424
435
  "unicorn/prefer-import-meta-properties": "error",
425
436
  "unicorn/prefer-keyboard-event-key": "error",
@@ -441,9 +452,9 @@ const config: OxlintConfig = {
441
452
  "unicorn/prefer-response-static-json": "error",
442
453
  "unicorn/prefer-set-has": "error",
443
454
  "unicorn/prefer-set-size": "error",
455
+ "unicorn/prefer-single-call": "error",
444
456
  "unicorn/prefer-string-replace-all": "error",
445
457
  "unicorn/prefer-string-slice": "error",
446
- "unicorn/prefer-string-starts-ends-with": "error",
447
458
  "unicorn/prefer-string-trim-start-end": "error",
448
459
  "unicorn/prefer-structured-clone": "error",
449
460
  "unicorn/prefer-ternary": ["error", "only-single-line"],
@@ -29,6 +29,7 @@ const config: OxlintConfig = {
29
29
  "jest/no-standalone-expect": "error",
30
30
  "jest/no-test-prefixes": "error",
31
31
  "jest/no-test-return-statement": "error",
32
+ "jest/no-unneeded-async-expect-function": "error",
32
33
  "jest/no-untyped-mock-factory": "error",
33
34
  "jest/padding-around-after-all-blocks": "error",
34
35
  "jest/padding-around-test-blocks": "error",
@@ -37,12 +38,15 @@ const config: OxlintConfig = {
37
38
  "jest/prefer-each": "error",
38
39
  "jest/prefer-ending-with-an-expect": "error",
39
40
  "jest/prefer-equality-matcher": "error",
41
+ "jest/prefer-expect-assertions": "error",
40
42
  "jest/prefer-expect-resolves": "error",
41
43
  "jest/prefer-hooks-in-order": "error",
42
44
  "jest/prefer-hooks-on-top": "error",
43
45
  "jest/prefer-jest-mocked": "error",
44
46
  "jest/prefer-lowercase-title": "error",
45
47
  "jest/prefer-mock-promise-shorthand": "error",
48
+ "jest/prefer-mock-return-shorthand": "error",
49
+ "jest/prefer-snapshot-hint": "error",
46
50
  "jest/prefer-spy-on": "error",
47
51
  "jest/prefer-strict-equal": "error",
48
52
  "jest/prefer-to-be": "error",
@@ -3,7 +3,9 @@ import type { OxlintConfig } from "oxlint"
3
3
  const config: OxlintConfig = {
4
4
  plugins: ["node"],
5
5
  rules: {
6
+ "node/handle-callback-err": "error",
6
7
  "node/no-exports-assign": "error",
8
+ "node/no-mixed-requires": "error",
7
9
  "node/no-new-require": "error",
8
10
  "node/no-path-concat": "error",
9
11
  },
@@ -13,10 +13,12 @@ const config: OxlintConfig = {
13
13
  "jsx-a11y/aria-unsupported-elements": "error",
14
14
  "jsx-a11y/autocomplete-valid": "error",
15
15
  "jsx-a11y/click-events-have-key-events": "error",
16
+ "jsx-a11y/control-has-associated-label": "error",
16
17
  "jsx-a11y/heading-has-content": "error",
17
18
  "jsx-a11y/html-has-lang": "error",
18
19
  "jsx-a11y/iframe-has-title": "error",
19
20
  "jsx-a11y/img-redundant-alt": "error",
21
+ "jsx-a11y/interactive-supports-focus": "error",
20
22
  "jsx-a11y/label-has-associated-control": "error",
21
23
  "jsx-a11y/lang": "error",
22
24
  "jsx-a11y/media-has-caption": "error",
@@ -25,16 +27,26 @@ const config: OxlintConfig = {
25
27
  "jsx-a11y/no-aria-hidden-on-focusable": "error",
26
28
  "jsx-a11y/no-autofocus": "error",
27
29
  "jsx-a11y/no-distracting-elements": "error",
30
+ "jsx-a11y/no-interactive-element-to-noninteractive-role": "error",
31
+ "jsx-a11y/no-noninteractive-element-interactions": "error",
32
+ "jsx-a11y/no-noninteractive-element-to-interactive-role": "error",
28
33
  "jsx-a11y/no-noninteractive-tabindex": "error",
29
34
  "jsx-a11y/no-redundant-roles": "error",
35
+ "jsx-a11y/no-static-element-interactions": "error",
30
36
  "jsx-a11y/prefer-tag-over-role": "error",
31
37
  "jsx-a11y/role-has-required-aria-props": "error",
32
38
  "jsx-a11y/role-supports-aria-props": "error",
33
39
  "jsx-a11y/scope": "error",
34
40
  "jsx-a11y/tabindex-no-positive": "error",
41
+ "react-perf/jsx-no-jsx-as-prop": "error",
42
+ "react-perf/jsx-no-new-array-as-prop": "error",
43
+ "react-perf/jsx-no-new-function-as-prop": "error",
44
+ "react-perf/jsx-no-new-object-as-prop": "error",
45
+ "react/button-has-type": "error",
35
46
  "react/checked-requires-onchange-or-readonly": "error",
36
47
  "react/display-name": "off",
37
48
  "react/exhaustive-deps": "error",
49
+ "react/forward-ref-uses-ref": "error",
38
50
  "react/hook-use-state": "error",
39
51
  "react/iframe-missing-sandbox": "error",
40
52
  "react/jsx-boolean-value": "error",
@@ -49,6 +61,7 @@ const config: OxlintConfig = {
49
61
  "react/jsx-handler-names": "error",
50
62
  "react/jsx-key": "error",
51
63
  "react/jsx-no-comment-textnodes": "error",
64
+ "react/jsx-no-constructed-context-values": "error",
52
65
  "react/jsx-no-duplicate-props": "error",
53
66
  "react/jsx-no-script-url": "error",
54
67
  "react/jsx-no-target-blank": "error",
@@ -58,6 +71,7 @@ const config: OxlintConfig = {
58
71
  "react/jsx-props-no-spread-multi": "error",
59
72
  "react/no-array-index-key": "error",
60
73
  "react/no-children-prop": "error",
74
+ "react/no-clone-element": "error",
61
75
  "react/no-danger": "error",
62
76
  "react/no-danger-with-children": "error",
63
77
  "react/no-direct-mutation-state": "error",
@@ -65,6 +79,8 @@ const config: OxlintConfig = {
65
79
  "react/no-is-mounted": "error",
66
80
  "react/no-multi-comp": "off",
67
81
  "react/no-namespace": "error",
82
+ "react/no-object-type-as-default-prop": "error",
83
+ "react/no-react-children": "error",
68
84
  "react/no-redundant-should-component-update": "error",
69
85
  "react/no-render-return-value": "error",
70
86
  "react/no-set-state": "error",
@@ -72,8 +88,11 @@ const config: OxlintConfig = {
72
88
  "react/no-unescaped-entities": "error",
73
89
  "react/no-unknown-property": "error",
74
90
  "react/no-unsafe": "error",
91
+ "react/no-unstable-nested-components": "error",
75
92
  "react/prefer-es6-class": ["error", "always"],
76
93
  "react/prefer-function-component": "error",
94
+ "react/react-compiler": "error",
95
+ "react/require-render-return": "error",
77
96
  "react/rules-of-hooks": "error",
78
97
  "react/self-closing-comp": "error",
79
98
  "react/state-in-constructor": ["error", "never"],
@@ -4,22 +4,68 @@ const config: OxlintConfig = {
4
4
  plugins: ["vitest"],
5
5
  rules: {
6
6
  "vitest/consistent-each-for": "error",
7
+ "vitest/consistent-test-it": "error",
7
8
  "vitest/hoisted-apis-on-top": "error",
9
+ "vitest/max-expects": "error",
10
+ "vitest/max-nested-describe": "error",
11
+ "vitest/no-alias-methods": "error",
12
+ "vitest/no-commented-out-tests": "error",
13
+ "vitest/no-conditional-expect": "error",
14
+ "vitest/no-conditional-in-test": "error",
8
15
  "vitest/no-conditional-tests": "error",
16
+ "vitest/no-disabled-tests": "error",
17
+ "vitest/no-duplicate-hooks": "error",
18
+ "vitest/no-focused-tests": "error",
19
+ "vitest/no-hooks": "error",
20
+ "vitest/no-identical-title": "error",
9
21
  "vitest/no-import-node-test": "error",
10
22
  "vitest/no-importing-vitest-globals": "error",
23
+ "vitest/no-interpolation-in-snapshots": "error",
24
+ "vitest/no-large-snapshots": "error",
25
+ "vitest/no-mocks-import": "error",
26
+ "vitest/no-restricted-matchers": "error",
27
+ "vitest/no-standalone-expect": "error",
28
+ "vitest/no-test-prefixes": "error",
29
+ "vitest/no-test-return-statement": "error",
11
30
  "vitest/no-unneeded-async-expect-function": "error",
12
31
  "vitest/prefer-called-exactly-once-with": "error",
13
32
  "vitest/prefer-called-once": "error",
14
33
  "vitest/prefer-called-times": "error",
34
+ "vitest/prefer-called-with": "error",
35
+ "vitest/prefer-comparison-matcher": "error",
15
36
  "vitest/prefer-describe-function-title": "error",
37
+ "vitest/prefer-each": "error",
38
+ "vitest/prefer-equality-matcher": "error",
39
+ "vitest/prefer-expect-assertions": "error",
40
+ "vitest/prefer-expect-resolves": "error",
16
41
  "vitest/prefer-expect-type-of": "error",
42
+ "vitest/prefer-hooks-in-order": "error",
43
+ "vitest/prefer-hooks-on-top": "error",
17
44
  "vitest/prefer-import-in-mock": "error",
45
+ "vitest/prefer-importing-vitest-globals": "error",
46
+ "vitest/prefer-lowercase-title": "error",
47
+ "vitest/prefer-mock-promise-shorthand": "error",
48
+ "vitest/prefer-mock-return-shorthand": "error",
49
+ "vitest/prefer-snapshot-hint": "error",
50
+ "vitest/prefer-spy-on": "error",
18
51
  "vitest/prefer-strict-boolean-matchers": "error",
52
+ "vitest/prefer-strict-equal": "error",
53
+ "vitest/prefer-to-be": "error",
19
54
  "vitest/prefer-to-be-object": "error",
55
+ "vitest/prefer-to-contain": "error",
56
+ "vitest/prefer-to-have-been-called-times": "error",
57
+ "vitest/prefer-to-have-length": "error",
58
+ "vitest/prefer-todo": "error",
20
59
  "vitest/require-awaited-expect-poll": "error",
60
+ "vitest/require-hook": "error",
21
61
  "vitest/require-local-test-context-for-concurrent-snapshots": "error",
22
62
  "vitest/require-mock-type-parameters": "error",
63
+ "vitest/require-to-throw-message": "error",
64
+ "vitest/require-top-level-describe": "error",
65
+ "vitest/valid-describe-callback": "error",
66
+ "vitest/valid-expect": "error",
67
+ "vitest/valid-expect-in-promise": "error",
68
+ "vitest/valid-title": "error",
23
69
  },
24
70
  }
25
71
 
@@ -8,17 +8,44 @@ const config: OxlintConfig = {
8
8
  "vue/define-props-destructuring": "error",
9
9
  "vue/max-props": "error",
10
10
  "vue/no-arrow-functions-in-watch": "error",
11
+ "vue/no-async-in-computed-properties": "error",
12
+ "vue/no-computed-properties-in-data": "error",
13
+ "vue/no-deprecated-data-object-declaration": "error",
14
+ "vue/no-deprecated-delete-set": "error",
11
15
  "vue/no-deprecated-destroyed-lifecycle": "error",
16
+ "vue/no-deprecated-events-api": "error",
17
+ "vue/no-deprecated-model-definition": "error",
18
+ "vue/no-deprecated-props-default-this": "error",
19
+ "vue/no-deprecated-vue-config-keycodes": "error",
20
+ "vue/no-dupe-keys": "error",
12
21
  "vue/no-export-in-script-setup": "error",
22
+ "vue/no-expose-after-await": "error",
13
23
  "vue/no-import-compiler-macros": "error",
14
24
  "vue/no-lifecycle-after-await": "error",
15
25
  "vue/no-multiple-slot-args": "error",
16
26
  "vue/no-required-prop-with-default": "error",
27
+ "vue/no-reserved-component-names": "error",
28
+ "vue/no-reserved-keys": "error",
29
+ "vue/no-reserved-props": "error",
30
+ "vue/no-shared-component-data": "error",
31
+ "vue/no-side-effects-in-computed-properties": "error",
32
+ "vue/no-this-in-before-route-enter": "error",
33
+ "vue/no-watch-after-await": "error",
17
34
  "vue/prefer-import-from-vue": "error",
18
35
  "vue/require-default-export": "error",
36
+ "vue/require-default-prop": "error",
37
+ "vue/require-direct-export": "error",
38
+ "vue/require-prop-type-constructor": "error",
39
+ "vue/require-prop-types": "error",
40
+ "vue/require-render-return": "error",
41
+ "vue/require-slots-as-functions": "error",
19
42
  "vue/require-typed-ref": "error",
43
+ "vue/return-in-computed-property": "error",
44
+ "vue/return-in-emits-validator": "error",
20
45
  "vue/valid-define-emits": "error",
46
+ "vue/valid-define-options": "error",
21
47
  "vue/valid-define-props": "error",
48
+ "vue/valid-next-tick": "error",
22
49
  },
23
50
  }
24
51