adamantite 0.30.0 → 0.30.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,13 +1,13 @@
1
- import Ft from"node:process";import*as P from"@effect/cli/Command";import*as Cn from"@effect/platform-node/NodeContext";import*as et from"@effect/platform-node/NodeRuntime";import*as cn from"@effect/platform/CommandExecutor";import*as A from"effect/Effect";import*as nt from"effect/Exit";import*as tt from"effect/Layer";import*as te from"@effect/cli/Command";import*as ie from"@effect/cli/Options";import*as Q from"@effect/platform/Command";import*as hn from"@effect/platform/CommandExecutor";import*as oe from"effect/Effect";import*as u from"effect/Data";import{printParseErrorCode as it}from"jsonc-parser";function ot(e=[]){if(e.length===0)return"- Unknown JSON/JSONC parsing error";return e.slice(0,3).map((t)=>`- ${it(t.error)} (offset: ${t.offset})`).join(`
2
- `)}class Le extends u.TaggedError("CliNotFound"){get message(){return`Command \`${this.command}\` not found. Please install it and try again.`}}class h extends u.TaggedError("CommandFailed"){get message(){return`Command \`${this.command}\` failed with exit code ${this.exitCode}.`}}class C extends u.TaggedError("FailedToCreateDirectory"){get message(){return`Failed to create directory ${this.path?`\`${this.path}\``:"the target directory"}.`}}class Ee extends u.TaggedError("FailedToInstallDependency"){get message(){return`Failed to install dependencies${this.packages?.length?`: ${this.packages.join(", ")}`:""}.`}}class Re extends u.TaggedError("FailedToInstallExtension"){get message(){return`Failed to install ${this.extension?`\`${this.extension}\``:"the target extension"}.`}}class Ge extends u.TaggedError("FailedToMergeConfig"){get message(){return`Failed to merge configuration.${this.cause instanceof Error?` Cause: ${this.cause.message}`:""}`}}class Je extends u.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:",ot(this.errors)].join(`
3
- `)}}class w extends u.TaggedError("FailedToReadFile"){get message(){return`Failed to read ${this.path?`\`${this.path}\``:"the target file"}.`}}class Ne extends u.TaggedError("FailedToDeleteFile"){get message(){return`Failed to delete ${this.path?`\`${this.path}\``:"the target file"}.`}}class l extends u.TaggedError("FailedToWriteFile"){get message(){return`Failed to write ${this.path?`\`${this.path}\``:"the target file"}.`}}class ee extends u.TaggedError("FileNotFound"){get message(){return this.path?`File not found: \`${this.path}\`.`:"File not found."}}class x extends u.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 ke extends u.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 st extends u.TaggedError("MissingPackageVersion"){get message(){return`Missing version field in ${this.path?`\`${this.path}\``:"package.json"}.`}}class Se extends u.TaggedError("OperationCancelled"){get message(){return`Operation cancelled.${this.reason?` Reason: ${this.reason}`:""}`}}class Fe extends u.TaggedError("UnknownScript"){get message(){return`Unknown script: \`${this.script}\`.`}}class Ie extends u.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*as Te from"@effect/platform/FileSystem";import*as nn from"@effect/platform/Path";import*as H from"effect/Effect";var gn={$schema:"https://unpkg.com/knip@5/schema.json",rules:{files:"error",dependencies:"error",devDependencies:"error",optionalPeerDependencies:"warn",unlisted:"error",binaries:"error",unresolved:"error",exports:"warn",nsExports:"warn",types:"warn",nsTypes:"warn",enumMembers:"off",classMembers:"off",duplicates:"warn"},ignoreExportsUsedInFile:!0,ignoreFiles:["**/dist/**","**/build/**","**/coverage/**","**/.next/**","**/.vercel/**","**/.turbo/**"],ignore:["**/*.d.ts"]};import lt from"node:process";import*as De from"@effect/platform/Command";import*as yn from"@effect/platform/CommandExecutor";import*as je from"@effect/platform/FileSystem";import*as Pe from"@effect/platform/Path";import*as vn from"@effect/platform/Terminal";import{defu as ct}from"defu";import*as wn from"effect/Console";import*as c from"effect/Effect";import{parse as dt}from"jsonc-parser";import at from"node:process";import*as pn from"effect/Context";import*as un from"effect/Effect";import*as mn from"effect/Layer";class K extends pn.Tag("Cwd")(){}var fn=mn.succeed(K,{get:un.sync(()=>at.cwd())});var En=(e)=>{let t=lt.platform==="win32"?"where":"which";return De.make(t,e).pipe(De.exitCode,c.flatMap((n)=>n===yn.ExitCode(0)?c.succeed(!0):c.fail(new Le({command:e}))))},k=(e,t)=>c.sync(()=>{let n=[],i=dt(e,n,{allowTrailingComma:!0});return{errors:n,parsed:i}}).pipe(c.flatMap(({errors:n,parsed:i})=>n.length>0?c.fail(new Je({errors:n,path:t})):c.succeed(i)));function D(e){return e!==null&&typeof e==="object"&&!Array.isArray(e)}var gt=/^workspace:/,pt=/^[\^~]/;function $n(e){return e.trim().replace(gt,"").replace(pt,"")}var U=(e,t)=>c.try({catch:(n)=>new Ge({cause:n}),try:()=>ct(e,t)}),$e=(e)=>c.gen(function*(){let t=yield*je.FileSystem,n=yield*Pe.Path,i=yield*K,o=e??(yield*i.get),s=n.join(o,"package.json"),r=yield*t.readFileString(s).pipe(c.mapError((f)=>new w({cause:f,path:s})));return yield*k(r,s)}),Ce=()=>c.gen(function*(){let e=yield*je.FileSystem,t=yield*Pe.Path,i=yield*(yield*K).get;if(yield*e.exists(t.join(i,"pnpm-workspace.yaml")))return!0;return(yield*$e()).workspaces!==void 0}),bn=(e)=>c.gen(function*(){yield*(yield*je.FileSystem).makeDirectory(e,{recursive:!0}).pipe(c.mapError((n)=>new C({cause:n,path:e})))}),ze=()=>c.gen(function*(){let t=yield*(yield*vn.Terminal).columns,n='\n .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',i='\n .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'.split(`
4
- `).reduce((o,s)=>Math.max(o,s.trim().length),0);if(!t||t<i)return;yield*wn.info('\n .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')});var en="knip.json",ut="knip.jsonc",j={config:gn,create:()=>H.gen(function*(){let e=yield*Te.FileSystem,n=(yield*nn.Path).join(process.cwd(),en),i=JSON.stringify(j.config,null,2);yield*e.writeFileString(n,`${i}
5
- `).pipe(H.mapError((o)=>new l({cause:o,path:n})))}),exists:()=>H.gen(function*(){let e=yield*Te.FileSystem,t=yield*nn.Path,n=t.join(process.cwd(),en),i=t.join(process.cwd(),ut);if(yield*e.exists(n))return{path:n};if(yield*e.exists(i))return{path:i};return{path:null}}),name:"knip",update:()=>H.gen(function*(){let e=yield*Te.FileSystem,{path:t}=yield*j.exists();if(!t)return yield*H.fail(new ee({path:en}));let n=yield*e.readFileString(t).pipe(H.mapError((r)=>new w({cause:r,path:t}))),i=yield*k(n,t);if(!D(i))return yield*H.fail(new x({path:t}));let o=yield*U(i,j.config),s=t.endsWith(".jsonc");o.$schema=s?"https://unpkg.com/knip@5/schema-jsonc.json":"https://unpkg.com/knip@5/schema.json",yield*e.writeFileString(t,`${JSON.stringify(o,null,2)}
6
- `).pipe(H.mapError((r)=>new l({cause:r,path:t})))}),version:"5.85.0"};var mt=ie.boolean("fix").pipe(ie.withDescription("Automatically fix issues")),ft=ie.boolean("strict").pipe(ie.withDescription("Enable strict mode")),xn=te.make("analyze",{fix:mt,strict:ft}).pipe(te.withDescription("Find unused dependencies, exports, and files using knip"),te.withHandler(({fix:e,strict:t})=>oe.gen(function*(){let n=[];if(e)n.push("--fix","--allow-remove-files");if(t)n.push("--production","--strict");return yield*Q.make(j.name,...n).pipe(Q.stdout("inherit"),Q.stderr("inherit"),Q.exitCode,oe.filterOrFail((i)=>i===hn.ExitCode(0),(i)=>new h({command:j.name,exitCode:i})),oe.asVoid)})));import*as O from"@effect/cli/Args";import*as se from"@effect/cli/Command";import*as W from"@effect/platform/Command";import*as zn from"@effect/platform/CommandExecutor";import*as re from"effect/Effect";import*as Tn from"effect/Option";import*as Ae from"@effect/platform/FileSystem";import*as He from"@effect/platform/Path";import*as z from"effect/Effect";var tn="oxlint.config.ts",kn=".oxlintrc.json",yt=/^(?:\.\/)?node_modules\/adamantite\/presets\/lint\/([a-z0-9-]+)\.(?:json|ts)$/,vt=/^adamantite\/lint(?:\/([a-z0-9-]+))?$/;function Sn(e=[]){return e.includes("core")?e:["core",...e]}function wt(e){if(Array.isArray(e))return e.filter((t)=>typeof t==="string");if(typeof e==="string")return[e];return[]}function Dn(e){return e.replaceAll(/-([a-z])/g,(t,n)=>n.toUpperCase())}function Et(e){return e==="core"?"adamantite/lint":`adamantite/lint/${e}`}function $t(e){let t=e.match(yt);if(t?.[1])return t[1];let n=e.match(vt);if(n)return n[1]??"core";return null}function bt(e,t){let n=" ".repeat(t);return e.map(([i,o])=>`${n}${i}: ${o},`).join(`
7
- `)}function jn(e,t,n=[]){let i=['import { defineConfig } from "oxlint"',...t.map((f)=>`import ${Dn(f)} from "${Et(f)}"`)],s=[...t.map((f)=>Dn(f)),...n.map((f)=>JSON.stringify(f))],r=[...Object.entries(e).map(([f,S])=>[f,JSON.stringify(S,null,2)]),["extends",`[${s.join(", ")}]`]],y=bt(r,2);return[...i,"","export default defineConfig({",y,"})",""].join(`
8
- `)}var m={create:(e=[])=>z.gen(function*(){let t=yield*Ae.FileSystem,i=(yield*He.Path).join(process.cwd(),tn),o=jn({},Sn(e));yield*t.writeFileString(i,o).pipe(z.mapError((s)=>new l({cause:s,path:i})))}),exists:()=>z.gen(function*(){let e=yield*Ae.FileSystem,t=yield*He.Path,n=t.join(process.cwd(),tn),i=t.join(process.cwd(),kn),o=yield*e.exists(n),s=yield*e.exists(i),r=o?"ts":s?"json":null;return{format:r,hasBoth:o&&s,jsonPath:s?i:null,path:r==="ts"?n:r==="json"?i:null,tsPath:o?n:null}}),name:"oxlint",update:(e=[])=>z.gen(function*(){let t=yield*Ae.FileSystem,n=yield*He.Path,i=yield*m.exists();if(i.tsPath)return;if(!i.jsonPath)return yield*z.fail(new ee({path:kn}));let o=i.jsonPath,s=n.join(process.cwd(),tn),r=yield*t.readFileString(o).pipe(z.mapError((v)=>new w({cause:v,path:o}))),y=yield*k(r,o);if(!D(y))return yield*z.fail(new x({path:o}));let{$schema:f,...S}=y,he=wt(S.extends),xe=new Set(Sn(e)),we=new Set;for(let v of he){let dn=$t(v);if(dn)xe.add(dn);else we.add(v)}let{extends:Xe,...Y}=S;yield*t.writeFileString(s,jn(Y,[...xe],[...we])).pipe(z.mapError((v)=>new l({cause:v,path:s}))),yield*t.remove(o).pipe(z.mapError((v)=>new Ne({cause:v,path:o})))}),version:"1.50.0"},be={name:"oxlint-tsgolint",version:"0.14.2"};var ht=O.file({exists:"yes"}).pipe(O.withDescription("Specific files to lint (optional)"),O.repeated,O.optional),An=se.make("check",{files:ht}).pipe(se.withDescription("Find issues in code using oxlint"),se.withHandler(({files:e})=>re.gen(function*(){let t=["--type-aware"];if(Tn.isSome(e))t.push(...e.value);return yield*W.make(m.name,...t).pipe(W.stdout("inherit"),W.stderr("inherit"),W.exitCode,re.filterOrFail((n)=>n===zn.ExitCode(0),(n)=>new h({command:m.name,exitCode:n})),re.asVoid)})));import*as X from"@effect/cli/Args";import*as ae from"@effect/cli/Command";import*as L from"@effect/cli/Options";import*as R from"@effect/platform/Command";import*as Hn from"@effect/platform/CommandExecutor";import*as le from"effect/Effect";import*as Mn from"effect/Option";var xt=X.file({exists:"yes"}).pipe(X.withDescription("Specific files to fix (optional)"),X.repeated,X.optional),kt=L.boolean("suggested").pipe(L.withDescription("Apply suggested fixes")),St=L.boolean("dangerous").pipe(L.withDescription("Apply dangerous fixes")),Dt=L.boolean("all").pipe(L.withDescription("Apply all fixes, including suggested and dangerous fixes")),Vn=ae.make("fix",{all:Dt,dangerous:St,files:xt,suggested:kt}).pipe(ae.withDescription("Fix issues in code using oxlint"),ae.withHandler(({all:e,dangerous:t,files:n,suggested:i})=>le.gen(function*(){let o=new Set(["--type-aware","--fix"]);if(i||e)o.add("--fix-suggestions");if(t||e)o.add("--fix-dangerously");if(Mn.isSome(n))for(let s of n.value)o.add(s);return yield*R.make(m.name,...o).pipe(R.stdout("inherit"),R.stderr("inherit"),R.exitCode,le.filterOrFail((s)=>s===Hn.ExitCode(0),(s)=>new h({command:m.name,exitCode:s})),le.asVoid)})));import*as G from"@effect/cli/Args";import*as ce from"@effect/cli/Command";import*as Ve from"@effect/cli/Options";import*as J from"@effect/platform/Command";import*as Un from"@effect/platform/CommandExecutor";import*as de from"effect/Effect";import*as _n from"effect/Option";import*as Me from"@effect/platform/FileSystem";import*as sn from"@effect/platform/Path";import*as M from"effect/Effect";var Zn={$schema:"../node_modules/oxfmt/configuration_schema.json",arrowParens:"always",bracketSameLine:!1,bracketSpacing:!0,embeddedLanguageFormatting:"auto",endOfLine:"lf",sortImports:{groups:[["value-builtin","type-import"],["value-external"],["type-internal"],["value-internal"],["type-subpath"],["value-subpath"],["type-parent","type-sibling","type-index"],["value-parent","value-sibling","value-index"],["unknown"]],ignoreCase:!0,newlinesBetween:!1,partitionByNewline:!0,order:"asc",partitionByComment:!0,sortSideEffects:!1},sortTailwindcss:{attributes:["className","class"],functions:["clsx","cn","cva","tw","twMerge"],preserveDuplicates:!1,preserveWhitespace:!1},insertFinalNewline:!0,jsxSingleQuote:!1,objectWrap:"preserve",printWidth:100,quoteProps:"as-needed",semi:!1,singleAttributePerLine:!1,singleQuote:!1,tabWidth:2,trailingComma:"es5",useTabs:!1};var on=".oxfmtrc.jsonc",zt=".oxfmtrc.json",E={config:{...Zn,$schema:"./node_modules/oxfmt/configuration_schema.json"},create:()=>M.gen(function*(){let e=yield*Me.FileSystem,n=(yield*sn.Path).join(process.cwd(),on),i=JSON.stringify(E.config,null,2);yield*e.writeFileString(n,`${i}
9
- `).pipe(M.mapError((o)=>new l({cause:o,path:n})))}),exists:()=>M.gen(function*(){let e=yield*Me.FileSystem,t=yield*sn.Path,n=t.join(process.cwd(),on),i=t.join(process.cwd(),zt);if(yield*e.exists(n))return{path:n};if(yield*e.exists(i))return{path:i};return{path:null}}),name:"oxfmt",update:()=>M.gen(function*(){let e=yield*Me.FileSystem,{path:t}=yield*E.exists();if(!t)return yield*M.fail(new ee({path:on}));let n=yield*e.readFileString(t).pipe(M.mapError((s)=>new w({cause:s,path:t}))),i=yield*k(n,t);if(!D(i))return yield*M.fail(new x({path:t}));let o=yield*U(i,E.config);o.$schema=E.config.$schema,yield*e.writeFileString(t,`${JSON.stringify(o,null,2)}
10
- `).pipe(M.mapError((s)=>new l({cause:s,path:t})))}),version:"0.35.0"};var Tt=G.file({exists:"yes"}).pipe(G.withDescription("Specific files to format (optional)"),G.repeated,G.optional),At=Ve.boolean("check").pipe(Ve.withDescription("Check if files are formatted without writing")),qn=ce.make("format",{check:At,files:Tt}).pipe(ce.withDescription("Format files using oxfmt"),ce.withHandler(({check:e,files:t})=>de.gen(function*(){let n=[];if(e)n.push("--check");if(_n.isSome(t))n.push(...t.value);return yield*J.make(E.name,...n).pipe(J.stdout("inherit"),J.stderr("inherit"),J.exitCode,de.filterOrFail((i)=>i===Un.ExitCode(0),(i)=>new h({command:E.name,exitCode:i})),de.asVoid)})));import Zt from"node:process";import*as pe from"@effect/cli/Command";import*as Xn from"@effect/platform/FileSystem";import*as Ln from"@effect/platform/Path";import*as a from"effect/Effect";import{addDevDependency as Ut,detectPackageManager as _t}from"nypm";import*as Ze from"@effect/platform/FileSystem";import*as Ue from"@effect/platform/Path";import*as ne from"effect/Effect";import{runScriptCommand as Ht}from"nypm";var Mt={bun:` - name: Setup Node.js
1
+ import*as wg from"@effect/platform-node/NodeRuntime";import*as eg from"@effect/platform-node/NodeServices";import*as X from"effect/Effect";import*as dg from"effect/Exit";import*as cg from"effect/Layer";import*as pg from"effect/Runtime";import*as t from"effect/unstable/cli/Command";import*as sg from"effect/unstable/process/ChildProcessSpawner";import*as zg from"effect/Effect";import*as w from"effect/unstable/cli/Command";import*as e from"effect/unstable/cli/Flag";import*as Ug from"effect/unstable/process/ChildProcessSpawner";import*as q from"effect/Data";import{printParseErrorCode as a$}from"jsonc-parser";function g$(a=[]){if(a.length===0)return"- Unknown JSON/JSONC parsing error";return a.slice(0,3).map((g)=>`- ${a$(g.error)} (offset: ${g.offset})`).join(`
2
+ `)}class Ta extends q.TaggedError("CliNotFound"){get message(){return`Command \`${this.command}\` not found. Please install it and try again.`}}class L extends q.TaggedError("CommandFailed"){get message(){return`Command \`${this.command}\` failed with exit code ${this.exitCode}.`}}class P extends q.TaggedError("FailedToCreateDirectory"){get message(){return`Failed to create directory ${this.path?`\`${this.path}\``:"the target directory"}.`}}class Fa extends q.TaggedError("FailedToInstallDependency"){get message(){return`Failed to install dependencies${this.packages?.length?`: ${this.packages.join(", ")}`:""}.`}}class Ha extends q.TaggedError("FailedToInstallExtension"){get message(){return`Failed to install ${this.extension?`\`${this.extension}\``:"the target extension"}.`}}class Ia extends q.TaggedError("FailedToMergeConfig"){get message(){return`Failed to merge configuration.${this.cause instanceof Error?` Cause: ${this.cause.message}`:""}`}}class ka extends q.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:",g$(this.errors)].join(`
3
+ `)}}class Z extends q.TaggedError("FailedToReadFile"){get message(){return`Failed to read ${this.path?`\`${this.path}\``:"the target file"}.`}}class oa extends q.TaggedError("FailedToDeleteFile"){get message(){return`Failed to delete ${this.path?`\`${this.path}\``:"the target file"}.`}}class z extends q.TaggedError("FailedToWriteFile"){get message(){return`Failed to write ${this.path?`\`${this.path}\``:"the target file"}.`}}class h extends q.TaggedError("FileNotFound"){get message(){return this.path?`File not found: \`${this.path}\`.`:"File not found."}}class j extends q.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 _a extends q.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 $$ extends q.TaggedError("MissingPackageVersion"){get message(){return`Missing version field in ${this.path?`\`${this.path}\``:"package.json"}.`}}class Za extends q.TaggedError("OperationCancelled"){get message(){return`Operation cancelled.${this.reason?` Reason: ${this.reason}`:""}`}}class xa extends q.TaggedError("UnknownScript"){get message(){return`Unknown script: \`${this.script}\`.`}}class ta extends q.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*as m from"effect/Effect";import*as Xa from"effect/FileSystem";import*as ia from"effect/Path";var ag={$schema:"https://unpkg.com/knip@5/schema.json",rules:{files:"error",dependencies:"error",devDependencies:"error",optionalPeerDependencies:"warn",unlisted:"error",binaries:"error",unresolved:"error",exports:"warn",nsExports:"warn",types:"warn",nsTypes:"warn",enumMembers:"off",classMembers:"off",duplicates:"warn"},ignoreExportsUsedInFile:!0,ignoreFiles:["**/dist/**","**/build/**","**/coverage/**","**/.next/**","**/.vercel/**","**/.turbo/**"],ignore:["**/*.d.ts"]};import na from"node:process";import{defu as v$}from"defu";import*as gg from"effect/Console";import*as U from"effect/Effect";import*as ba from"effect/FileSystem";import*as Pa from"effect/Path";import*as $g from"effect/Terminal";import*as Dg from"effect/unstable/process/ChildProcess";import*as vg from"effect/unstable/process/ChildProcessSpawner";import{parse as l$}from"jsonc-parser";var lg=(a)=>{let g=na.platform==="win32"?"where":"which";return U.scoped(U.gen(function*(){return yield*(yield*Dg.make(g,[a],{stderr:"ignore",stdin:"ignore",stdout:"ignore"})).exitCode})).pipe(U.flatMap(($)=>$===vg.ExitCode(0)?U.succeed(!0):U.fail(new Ta({command:a}))))},A=(a,g)=>U.sync(()=>{let $=[],D=l$(a,$,{allowTrailingComma:!0});return{errors:$,parsed:D}}).pipe(U.flatMap(({errors:$,parsed:D})=>$.length>0?U.fail(new ka({errors:$,path:g})):U.succeed(D)));function W(a){return a!==null&&typeof a==="object"&&!Array.isArray(a)}var y$=/^workspace:/,E$=/^[\^~]/;function yg(a){return a.trim().replace(y$,"").replace(E$,"")}var u=(a,g)=>U.try({catch:($)=>new Ia({cause:$}),try:()=>v$(a,g)}),za=(a=na.cwd())=>U.gen(function*(){let g=yield*ba.FileSystem,D=(yield*Pa.Path).join(a,"package.json"),l=yield*g.readFileString(D).pipe(U.mapError((y)=>new Z({cause:y,path:D})));return yield*A(l,D)}),ha=(a=na.cwd())=>U.gen(function*(){let g=yield*ba.FileSystem,$=yield*Pa.Path;if(yield*g.exists($.join(a,"pnpm-workspace.yaml")))return!0;return(yield*za(a)).workspaces!==void 0}),Eg=(a)=>U.gen(function*(){yield*(yield*ba.FileSystem).makeDirectory(a,{recursive:!0}).pipe(U.mapError(($)=>new P({cause:$,path:a})))}),Ka=()=>U.gen(function*(){let g=yield*(yield*$g.Terminal).columns,$='\n .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',D='\n .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'.split(`
4
+ `).reduce((l,v)=>Math.max(l,v.trim().length),0);if(!g||g<D)return;yield*gg.info('\n .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')});var Ca="knip.json",f$="knip.jsonc",M={config:ag,create:(a)=>m.gen(function*(){let g=yield*Xa.FileSystem,D=(yield*ia.Path).join(a,Ca),l=JSON.stringify(M.config,null,2);yield*g.writeFileString(D,`${l}
5
+ `).pipe(m.mapError((v)=>new z({cause:v,path:D})))}),exists:(a)=>m.gen(function*(){let g=yield*Xa.FileSystem,$=yield*ia.Path,D=$.join(a,Ca),l=$.join(a,f$);if(yield*g.exists(D))return{path:D};if(yield*g.exists(l))return{path:l};return{path:null}}),name:"knip",update:(a)=>m.gen(function*(){let g=yield*Xa.FileSystem,{path:$}=yield*M.exists(a);if(!$)return yield*new h({path:Ca});let D=yield*g.readFileString($).pipe(m.mapError((E)=>new Z({cause:E,path:$}))),l=yield*A(D,$);if(!W(l))return yield*new j({path:$});let v=yield*u(l,M.config),y=$.endsWith(".jsonc");v.$schema=y?"https://unpkg.com/knip@5/schema-jsonc.json":"https://unpkg.com/knip@5/schema.json",yield*g.writeFileString($,`${JSON.stringify(v,null,2)}
6
+ `).pipe(m.mapError((E)=>new z({cause:E,path:$})))}),version:"5.85.0"};import*as J from"effect/Effect";import*as fg from"effect/Layer";import*as Tg from"effect/ServiceMap";import*as _g from"effect/unstable/process/ChildProcess";class b extends Tg.Service()("CommandRunner"){static layer=fg.succeed(this)({run:({args:a,command:g,cwd:$,stderr:D="inherit",stdin:l="ignore",stdout:v="inherit"})=>J.mapError(J.scoped(J.gen(function*(){return yield*(yield*J.fromYieldable(_g.make(g,a,{cwd:$,stderr:D,stdin:l,stdout:v}))).exitCode})),(y)=>y.reason._tag==="NotFound"?new Ta({command:g}):y)})}var T$=e.boolean("fix").pipe(e.withDescription("Automatically fix issues")),_$=e.boolean("strict").pipe(e.withDescription("Enable strict mode")),Bg=w.make("analyze",{fix:T$,strict:_$}).pipe(w.withDescription("Find unused dependencies, exports, and files using knip"),w.withHandler(({fix:a,strict:g})=>zg.gen(function*(){let $=yield*b,D=[];if(a)D.push("--fix","--allow-remove-files");if(g)D.push("--production","--strict");let l=yield*$.run({args:D,command:M.name});if(l!==Ug.ExitCode(0))yield*new L({command:M.name,exitCode:l})})));import*as Zg from"effect/Effect";import*as d from"effect/unstable/cli/Argument";import*as c from"effect/unstable/cli/Command";import*as bg from"effect/unstable/process/ChildProcessSpawner";import*as G from"effect/Effect";import*as Ma from"effect/FileSystem";import*as Va from"effect/Path";var wa="oxlint.config.ts",Qg=".oxlintrc.json",z$=/^(?:\.\/)?node_modules\/adamantite\/presets\/lint\/([a-z0-9-]+)\.(?:json|ts)$/,U$=/^adamantite\/lint(?:\/([a-z0-9-]+))?$/;function qg(a=[]){return a.includes("core")?a:["core",...a]}function B$(a){if(Array.isArray(a))return a.filter((g)=>typeof g==="string");if(typeof a==="string")return[a];return[]}function Yg(a){return a.replaceAll(/-([a-z])/g,(g,$)=>$.toUpperCase())}function Q$(a){return a==="core"?"adamantite/lint":`adamantite/lint/${a}`}function q$(a){let g=a.match(z$);if(g?.[1])return g[1];let $=a.match(U$);if($)return $[1]??"core";return null}function Y$(a,g){let $=" ".repeat(g);return a.map(([D,l])=>`${$}${D}: ${l},`).join(`
7
+ `)}function Hg(a,g,$=[]){let D=['import { defineConfig } from "oxlint"',...g.map((f)=>`import ${Yg(f)} from "${Q$(f)}"`)],v=[...g.map((f)=>Yg(f)),...$.map((f)=>JSON.stringify(f))],y=[...Object.entries(a).map(([f,Ea])=>[f,JSON.stringify(Ea,null,2)]),["extends",`[${v.join(", ")}]`]],E=Y$(y,2);return[...D,"","export default defineConfig({",E,"})",""].join(`
8
+ `)}var Y={create:(a,g=[])=>G.gen(function*(){let $=yield*Ma.FileSystem,l=(yield*Va.Path).join(a,wa),v=Hg({},qg(g));yield*$.writeFileString(l,v).pipe(G.mapError((y)=>new z({cause:y,path:l})))}),exists:(a)=>G.gen(function*(){let g=yield*Ma.FileSystem,$=yield*Va.Path,D=$.join(a,wa),l=$.join(a,Qg),v=yield*g.exists(D),y=yield*g.exists(l),E=v?"ts":y?"json":null;return{format:E,hasBoth:v&&y,jsonPath:y?l:null,path:E==="ts"?D:E==="json"?l:null,tsPath:v?D:null}}),name:"oxlint",update:(a,g=[])=>G.gen(function*(){let $=yield*Ma.FileSystem,D=yield*Va.Path,l=yield*Y.exists(a);if(l.tsPath)return;if(!l.jsonPath)return yield*new h({path:Qg});let v=l.jsonPath,y=D.join(a,wa),E=yield*$.readFileString(v).pipe(G.mapError((H)=>new Z({cause:H,path:v}))),f=yield*A(E,v);if(!W(f))return yield*new j({path:v});let{$schema:Ea,...Ba}=f,Qa=B$(Ba.extends),fa=new Set(qg(g)),qa=new Set;for(let H of Qa){let n=q$(H);if(n)fa.add(n);else qa.add(H)}let{extends:ra,...Ya}=Ba;yield*$.writeFileString(y,Hg(Ya,[...fa],[...qa])).pipe(G.mapError((H)=>new z({cause:H,path:y}))),yield*$.remove(v).pipe(G.mapError((H)=>new oa({cause:H,path:v})))}),version:"1.50.0"},Ua={name:"oxlint-tsgolint",version:"0.14.2"};var H$=d.file("files",{mustExist:!0}).pipe(d.withDescription("Specific files to lint (optional)"),d.variadic()),Kg=c.make("check",{files:H$}).pipe(c.withDescription("Find issues in code using oxlint"),c.withHandler(({files:a})=>Zg.gen(function*(){let $=yield*(yield*b).run({args:["--type-aware",...a],command:Y.name});if($!==bg.ExitCode(0))yield*new L({command:Y.name,exitCode:$})})));import*as Xg from"effect/Effect";import*as p from"effect/unstable/cli/Argument";import*as s from"effect/unstable/cli/Command";import*as r from"effect/unstable/cli/Flag";import*as Mg from"effect/unstable/process/ChildProcessSpawner";var Z$=p.file("files",{mustExist:!0}).pipe(p.withDescription("Specific files to fix (optional)"),p.variadic()),b$=r.boolean("suggested").pipe(r.withDescription("Apply suggested fixes")),K$=r.boolean("dangerous").pipe(r.withDescription("Apply dangerous fixes")),X$=r.boolean("all").pipe(r.withDescription("Apply all fixes, including suggested and dangerous fixes")),Vg=s.make("fix",{all:X$,dangerous:K$,files:Z$,suggested:b$}).pipe(s.withDescription("Fix issues in code using oxlint"),s.withHandler(({all:a,dangerous:g,files:$,suggested:D})=>Xg.gen(function*(){let l=yield*b,v=new Set(["--type-aware","--fix"]);if(D||a)v.add("--fix-suggestions");if(g||a)v.add("--fix-dangerously");for(let E of $)v.add(E);let y=yield*l.run({args:[...v],command:Y.name});if(y!==Mg.ExitCode(0))yield*new L({command:Y.name,exitCode:y})})));import*as jg from"effect/Effect";import*as aa from"effect/unstable/cli/Argument";import*as ga from"effect/unstable/cli/Command";import*as ja from"effect/unstable/cli/Flag";import*as Ag from"effect/unstable/process/ChildProcessSpawner";import*as F from"effect/Effect";import*as La from"effect/FileSystem";import*as da from"effect/Path";var Lg={$schema:"../node_modules/oxfmt/configuration_schema.json",arrowParens:"always",bracketSameLine:!1,bracketSpacing:!0,embeddedLanguageFormatting:"auto",endOfLine:"lf",sortImports:{groups:[["value-builtin","type-import"],["value-external"],["type-internal"],["value-internal"],["type-subpath"],["value-subpath"],["type-parent","type-sibling","type-index"],["value-parent","value-sibling","value-index"],["unknown"]],ignoreCase:!0,newlinesBetween:!1,partitionByNewline:!0,order:"asc",partitionByComment:!0,sortSideEffects:!1},sortTailwindcss:{attributes:["className","class"],functions:["clsx","cn","cva","tw","twMerge"],preserveDuplicates:!1,preserveWhitespace:!1},insertFinalNewline:!0,jsxSingleQuote:!1,objectWrap:"preserve",printWidth:100,quoteProps:"as-needed",semi:!1,singleAttributePerLine:!1,singleQuote:!1,tabWidth:2,trailingComma:"es5",useTabs:!1};var ea=".oxfmtrc.jsonc",V$=".oxfmtrc.json",K={config:{...Lg,$schema:"./node_modules/oxfmt/configuration_schema.json"},create:(a)=>F.gen(function*(){let g=yield*La.FileSystem,D=(yield*da.Path).join(a,ea),l=JSON.stringify(K.config,null,2);yield*g.writeFileString(D,`${l}
9
+ `).pipe(F.mapError((v)=>new z({cause:v,path:D})))}),exists:(a)=>F.gen(function*(){let g=yield*La.FileSystem,$=yield*da.Path,D=$.join(a,ea),l=$.join(a,V$);if(yield*g.exists(D))return{path:D};if(yield*g.exists(l))return{path:l};return{path:null}}),name:"oxfmt",update:(a)=>F.gen(function*(){let g=yield*La.FileSystem,{path:$}=yield*K.exists(a);if(!$)return yield*new h({path:ea});let D=yield*g.readFileString($).pipe(F.mapError((y)=>new Z({cause:y,path:$}))),l=yield*A(D,$);if(!W(l))return yield*new j({path:$});let v=yield*u(l,K.config);v.$schema=K.config.$schema,yield*g.writeFileString($,`${JSON.stringify(v,null,2)}
10
+ `).pipe(F.mapError((y)=>new z({cause:y,path:$})))}),version:"0.35.0"};var L$=aa.file("files",{mustExist:!0}).pipe(aa.withDescription("Specific files to format (optional)"),aa.variadic()),j$=ja.boolean("check").pipe(ja.withDescription("Check if files are formatted without writing")),Wg=ga.make("format",{check:j$,files:L$}).pipe(ga.withDescription("Format files using oxfmt"),ga.withHandler(({check:a,files:g})=>jg.gen(function*(){let $=yield*b,D=[];if(a)D.push("--check");D.push(...g);let l=yield*$.run({args:D,command:K.name});if(l!==Ag.ExitCode(0))yield*new L({command:K.name,exitCode:l})})));import u$ from"node:process";import*as T from"effect/Effect";import*as Fg from"effect/FileSystem";import*as Ig from"effect/Path";import*as Da from"effect/unstable/cli/Command";import*as C from"effect/Effect";import*as Aa from"effect/FileSystem";import*as Wa from"effect/Path";import{runScriptCommand as A$}from"nypm";var W$={bun:` - name: Setup Node.js
11
11
  uses: actions/setup-node@v6
12
12
  with:
13
13
  node-version: "22"
@@ -54,7 +54,7 @@ import Ft from"node:process";import*as P from"@effect/cli/Command";import*as Cn
54
54
  cache: "yarn"
55
55
 
56
56
  - name: Install dependencies
57
- run: yarn install --frozen-lockfile`},Yn=[{name:"lint",script:"check"},{args:["--check"],name:"format",script:"format"},{name:"types",script:"typecheck"},{name:"monorepo",script:"check:monorepo"},{name:"analyze",script:"analyze"}];function Bn({packageManager:e,scripts:t}){let n=[];for(let s of Yn){if(!t.includes(s.script))continue;n.push({command:Ht(e,s.script,{args:s.args}),name:s.name})}if(n.length===0)return null;return`${`name: adamantite
57
+ run: yarn install --frozen-lockfile`},Og=[{name:"lint",script:"check"},{args:["--check"],name:"format",script:"format"},{name:"types",script:"typecheck"},{name:"monorepo",script:"check:monorepo"},{name:"analyze",script:"analyze"}];function Ng({packageManager:a,scripts:g}){let $=[];for(let v of Og){if(!g.includes(v.script))continue;$.push({command:A$(a,v.script,{args:v.args}),name:v.name})}if($.length===0)return null;return`${`name: adamantite
58
58
 
59
59
  on:
60
60
  push:
@@ -79,23 +79,23 @@ jobs:
79
79
  fail-fast: false
80
80
  matrix:
81
81
  include:
82
- ${n.map((s)=>` - name: ${s.name}
83
- command: ${s.command}`).join(`
82
+ ${$.map((v)=>` - name: ${v.name}
83
+ command: ${v.command}`).join(`
84
84
  `)}
85
85
 
86
86
  steps:
87
87
  - name: Checkout
88
88
  uses: actions/checkout@v4
89
89
 
90
- ${Mt[e]}
90
+ ${W$[a]}
91
91
 
92
92
  - name: Run \${{ matrix.name }}
93
93
  run: \${{ matrix.command }}`}
94
- `}var Vt=new Set(Yn.map((e)=>e.script));function Kn(e){return e.some((t)=>Vt.has(t))}var _e={create:(e)=>ne.gen(function*(){let t=yield*Ze.FileSystem,n=yield*Ue.Path,i=n.join(process.cwd(),".github","workflows");yield*bn(i);let o=Bn(e);if(!o)return;let s=n.join(i,"adamantite.yml");yield*t.writeFileString(s,o).pipe(ne.mapError((r)=>new l({cause:r,path:s})))}),exists:()=>ne.gen(function*(){let e=yield*Ze.FileSystem,t=yield*Ue.Path;return yield*e.exists(t.join(process.cwd(),".github","workflows","adamantite.yml"))}),update:(e)=>ne.gen(function*(){let t=yield*Ze.FileSystem,i=(yield*Ue.Path).join(process.cwd(),".github","workflows","adamantite.yml"),o=Bn(e);if(!o)return;yield*t.writeFileString(i,o).pipe(ne.mapError((s)=>new l({cause:s,path:i})))}),workflowPath:".github/workflows/adamantite.yml"};import*as F from"@effect/platform/Command";import*as qe from"@effect/platform/FileSystem";import*as Be from"@effect/platform/Path";import*as d from"effect/Effect";var rn="settings.json",N={cliExists:()=>En("code").pipe(d.mapError((e)=>new Ie({cause:e}))),config:{"[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,"typescript.tsdk":"node_modules/typescript/lib"},create:()=>d.gen(function*(){let e=yield*qe.FileSystem,t=yield*Be.Path,n=t.join(process.cwd(),".vscode"),i=t.join(n,rn);yield*e.makeDirectory(n,{recursive:!0}).pipe(d.mapError((o)=>new C({cause:o,path:n}))),yield*e.writeFileString(i,`${JSON.stringify(N.config,null,2)}
95
- `).pipe(d.mapError((o)=>new l({cause:o,path:i})))}),exists:()=>d.gen(function*(){let e=yield*qe.FileSystem,t=yield*Be.Path;return yield*e.exists(t.join(process.cwd(),".vscode",rn))}),extension:(e=[])=>d.gen(function*(){yield*N.cliExists();let t=(s)=>F.make("code","--install-extension",s).pipe(F.stdout("inherit"),F.stderr("inherit"),F.exitCode,d.mapError((r)=>new Re({cause:r,extension:s}))),n=[e.includes("check")||e.includes("fix")||e.includes("format")?t("oxc.oxc-vscode"):d.void,e.includes("analyze")?t("webpro.vscode-knip"):d.void],o=(yield*d.all(n,{mode:"either"})).find((s)=>s._tag==="Left");if(o)yield*d.fail(o.left)}),update:()=>d.gen(function*(){let e=yield*qe.FileSystem,n=(yield*Be.Path).join(process.cwd(),".vscode",rn),i=yield*e.readFileString(n).pipe(d.mapError((r)=>new w({cause:r,path:n}))),o=yield*k(i,n);if(!D(o))return yield*d.fail(new x({path:n}));let s=yield*U(N.config,o);yield*e.writeFileString(n,`${JSON.stringify(s,null,2)}
96
- `).pipe(d.mapError((r)=>new l({cause:r,path:n})))})};import*as Ye from"@effect/platform/FileSystem";import*as Ke from"@effect/platform/Path";import*as V from"effect/Effect";var an="settings.json",ge={config:{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"}}]},TypeScript:{format_on_save:"on",formatter:[{language_server:{name:"oxfmt"}}]},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"}}}}},create:()=>V.gen(function*(){let e=yield*Ye.FileSystem,t=yield*Ke.Path,n=t.join(process.cwd(),".zed"),i=t.join(n,an);yield*e.makeDirectory(n,{recursive:!0}).pipe(V.mapError((o)=>new C({cause:o,path:n}))),yield*e.writeFileString(i,`${JSON.stringify(ge.config,null,2)}
97
- `).pipe(V.mapError((o)=>new l({cause:o,path:i})))}),exists:()=>V.gen(function*(){let e=yield*Ye.FileSystem,t=yield*Ke.Path;return yield*e.exists(t.join(process.cwd(),".zed",an))}),update:()=>V.gen(function*(){let e=yield*Ye.FileSystem,n=(yield*Ke.Path).join(process.cwd(),".zed",an),i=yield*e.readFileString(n).pipe(V.mapError((r)=>new w({cause:r,path:n}))),o=yield*k(i,n);if(!D(o))return yield*V.fail(new x({path:n}));let s=yield*U(ge.config,o);yield*e.writeFileString(n,`${JSON.stringify(s,null,2)}
98
- `).pipe(V.mapError((r)=>new l({cause:r,path:n})))})};var I={name:"sherif",version:"1.10.0"};import*as Qe from"@effect/platform/FileSystem";import*as Oe from"@effect/platform/Path";import*as _ from"effect/Effect";var ln="tsconfig.json",Z={command:"tsc",config:{extends:"adamantite/typescript"},create:()=>_.gen(function*(){let e=yield*Qe.FileSystem,n=(yield*Oe.Path).join(process.cwd(),ln),i=JSON.stringify(Z.config,null,2);yield*e.writeFileString(n,`${i}
99
- `).pipe(_.mapError((o)=>new l({cause:o,path:n})))}),exists:()=>_.gen(function*(){let e=yield*Qe.FileSystem,t=yield*Oe.Path;return yield*e.exists(t.join(process.cwd(),ln))}),name:"typescript",update:()=>_.gen(function*(){let e=yield*Qe.FileSystem,n=(yield*Oe.Path).join(process.cwd(),ln),i=yield*e.readFileString(n).pipe(_.mapError((r)=>new w({cause:r,path:n}))),o=yield*k(i,n);if(!D(o))return yield*_.fail(new x({path:n}));let s=yield*U(Z.config,o);yield*e.writeFileString(n,`${JSON.stringify(s,null,2)}
100
- `).pipe(_.mapError((r)=>new l({cause:r,path:n})))}),version:"5.9.3"};import*as g from"@clack/prompts";import*as Qn from"effect/Context";import*as $ from"effect/Effect";import*as On from"effect/Layer";class p extends Qn.Tag("Prompter")(){}var Wn=On.succeed(p,{cancel:(e)=>$.sync(()=>{g.cancel(e)}),confirm:(e)=>$.promise(()=>g.confirm(e)).pipe($.filterOrFail((t)=>!g.isCancel(t),()=>new Se({}))),intro:(e)=>$.sync(()=>{g.intro(e)}),log:{error:(e)=>$.sync(()=>{g.log.error(e)}),info:(e)=>$.sync(()=>{g.log.info(e)}),success:(e)=>$.sync(()=>{g.log.success(e)}),warning:(e)=>$.sync(()=>{g.log.warning(e)})},multiselect:(e)=>$.promise(()=>g.multiselect(e)).pipe($.filterOrFail((t)=>!g.isCancel(t),()=>new Se({}))),outro:(e)=>$.sync(()=>{g.outro(e)}),spinner:()=>g.spinner()});var qt=(e)=>a.gen(function*(){let n=(yield*p).spinner();n.start("Installing dependencies...");let i=yield*Ce();yield*a.tryPromise({catch:(o)=>new Ee({cause:o,packages:e}),try:()=>Ut(e,{silent:!0,workspace:i})}).pipe(a.tapError(()=>a.sync(()=>{n.stop("Failed to install dependencies.")}))),n.stop("Dependencies installed.")}),Bt=(e)=>a.gen(function*(){let t=yield*p,n=t.spinner();n.start("Setting up oxlint config...");let i=yield*m.exists();if(i.hasBoth)yield*t.log.warning("Found both `oxlint.config.ts` and `.oxlintrc.json`. Adamantite will use `oxlint.config.ts`.");if(i.format==="json")n.message("Found `.oxlintrc.json`, migrating to `oxlint.config.ts`..."),yield*m.update(e),n.stop("oxlint config migrated successfully.");else if(i.format==="ts")n.message("Found `oxlint.config.ts`, keeping existing config."),n.stop("oxlint config is ready.");else n.message("`oxlint.config.ts` not found, creating..."),yield*m.create(e),n.stop("oxlint config created successfully.")}),Yt=()=>a.gen(function*(){let t=(yield*p).spinner();t.start("Setting up oxfmt config...");let n=yield*E.exists();if(n.path)t.message(`Found \`${n.path}\`, updating...`),yield*E.update(),t.stop("oxfmt config updated successfully.");else t.message("`.oxfmtrc.jsonc` or `.oxfmtrc.json` not found, creating..."),yield*E.create(),t.stop("oxfmt config created successfully.")}),Kt=(e)=>a.gen(function*(){let t=yield*Xn.FileSystem,n=yield*Ln.Path,i=yield*K,o=yield*p,s=yield*$e(),r=o.spinner();r.start("Adding scripts to your `package.json`..."),s.scripts??={};for(let S of e)switch(S){case"check":s.scripts.check="adamantite check";break;case"fix":s.scripts.fix="adamantite fix";break;case"format":s.scripts.format="adamantite format";break;case"typecheck":s.scripts.typecheck="adamantite typecheck";break;case"check:monorepo":s.scripts["check:monorepo"]="adamantite monorepo";break;case"fix:monorepo":s.scripts["fix:monorepo"]="adamantite monorepo --fix";break;case"analyze":s.scripts.analyze="adamantite analyze";break;default:return yield*a.fail(new Fe({script:S}))}let y=yield*i.get,f=n.join(y,"package.json");yield*t.writeFileString(f,`${JSON.stringify(s,null,2)}
101
- `).pipe(a.mapError((S)=>new l({cause:S,path:f}))),r.stop("Scripts added to your `package.json`")}),Qt=()=>a.gen(function*(){let t=(yield*p).spinner();t.start("Setting up knip config...");let n=yield*j.exists();if(n.path)t.message(`Found \`${n.path}\`, updating...`),yield*j.update(),t.stop("knip config updated successfully.");else t.message("`knip.json` not found, creating..."),yield*j.create(),t.stop("knip config created successfully.")}),Ot=()=>a.gen(function*(){let t=(yield*p).spinner();if(t.start("Setting up TypeScript config..."),yield*Z.exists())t.message("`tsconfig.json` found, updating..."),yield*Z.update(),t.stop("`tsconfig.json` updated successfully");else t.message("`tsconfig.json` not found, creating..."),yield*Z.create(),t.stop("`tsconfig.json` created successfully")}),Wt=(e)=>a.gen(function*(){let t=yield*p;if(e.includes("vscode")){let n=t.spinner();if(n.start("Checking for `.vscode/settings.json`..."),yield*N.exists())n.message("`.vscode/settings.json` found, updating..."),yield*N.update(),n.stop("`.vscode/settings.json` updated with Adamantite preset.");else n.message("`.vscode/settings.json` not found, creating..."),yield*N.create(),n.stop("`.vscode/settings.json` created with Adamantite preset.")}if(e.includes("zed")){let n=t.spinner();if(n.start("Checking for `.zed/settings.json`..."),yield*ge.exists())n.message("`.zed/settings.json` found, updating..."),yield*ge.update(),n.stop("`.zed/settings.json` updated with Adamantite preset.");else n.message("`.zed/settings.json` not found, creating..."),yield*ge.create(),n.stop("`.zed/settings.json` created with Adamantite preset.")}}),Xt=(e,t)=>a.gen(function*(){let n=yield*p,i=n.spinner();i.start("Installing editor extensions...");let o=e.includes("zed"),s=e.includes("vscode");if(yield*a.gen(function*(){if(e.includes("vscode"))i.message("Installing VS Code extension..."),yield*N.extension(t);return!0}).pipe(a.tapError(()=>a.sync(()=>{i.stop()})),a.catchTags({FailedToInstallExtension:(y)=>a.gen(function*(){return yield*n.log.warning(`⚠️ Failed to install the \`${y.extension}\` extension.`),yield*n.log.warning("Please install it manually after setup completes."),!1}),VscodeCliNotFound:()=>a.gen(function*(){return yield*n.log.error("VSCode CLI ('code' command) not found."),yield*n.log.info("To install it:"),yield*n.log.info(" 1. Open VS Code"),yield*n.log.info(" 2. Press Cmd+Shift+P (macOS) or Ctrl+Shift+P (Windows/Linux)"),yield*n.log.info(` 3. Run 'Shell Command: Install "code" command in PATH'`),!1})})))if(o&&!s)i.stop("Zed extensions require manual install.");else i.stop("Editor extensions installed successfully.");if(o)yield*n.log.info("Install the Zed `oxc` extension: zed://extension/oxc")}),Lt=(e,t)=>a.gen(function*(){let i=(yield*p).spinner();if(i.start("Setting up GitHub Actions workflow..."),yield*_e.exists())i.message("`.github/workflows/adamantite.yml` found, updating..."),yield*_e.update({packageManager:e,scripts:t}),i.stop("GitHub Actions workflow updated successfully.");else i.message("Creating `.github/workflows/adamantite.yml`..."),yield*_e.create({packageManager:e,scripts:t}),i.stop("GitHub Actions workflow created successfully.")}).pipe(a.option),Rn=pe.make("init").pipe(pe.withDescription("Initialize Adamantite in the current directory"),pe.withHandler(()=>a.gen(function*(){let e=yield*p;yield*ze(),yield*e.intro("\uD83D\uDCA0 adamantite init");let t=yield*a.tryPromise({catch:(v)=>new ke({cause:v}),try:()=>_t(Zt.cwd())});if(!t)return yield*a.fail(new ke({}));if(t.warnings?.length)for(let v of t.warnings)yield*e.log.warning(v);yield*e.log.info(`Detected package manager: ${t.name}`);let n=yield*Ce();if(n)yield*e.log.info("We've detected a monorepo setup in your project.");let i=yield*e.multiselect({message:"Which scripts do you want to add to your `package.json`?",options:[{hint:"recommended",label:"check - find issues in code 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"},{hint:"extends the `adamantite/typescript` preset in your `tsconfig.json`",label:"typecheck - type-check your code using tsc",value:"typecheck"},{disabled:!n,hint:n?void 0:"available for monorepo projects",label:"check:monorepo - check for monorepo-specific issues using Sherif",value:"check:monorepo"},{disabled:!n,hint:n?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"}]}),o=i.includes("check")||i.includes("fix"),s=[];if(o)s=yield*e.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 r=yield*e.multiselect({message:"Which editors do you want to configure? (optional)",options:[{label:"VSCode / Cursor / Windsurf",value:"vscode"},{label:"Zed",value:"zed"}],required:!1}),y=!1;if(r.length>0)y=yield*e.confirm({initialValue:!0,message:"Do you want to install the recommended editor extensions?"});let f=Kn(i),S=!1;if(f)S=yield*e.confirm({message:"Do you want to add a GitHub Actions workflow to run checks in CI?"});let he=i.includes("format"),xe=i.includes("check:monorepo")||i.includes("fix:monorepo"),we=i.includes("typecheck"),Xe=i.includes("analyze"),Y=["adamantite"];if(o)Y.push(`${m.name}@${m.version}`),Y.push(`${be.name}@${be.version}`);if(he)Y.push(`${E.name}@${E.version}`);if(xe)Y.push(`${I.name}@${I.version}`);if(we)Y.push(`${Z.name}@${Z.version}`);if(Xe)Y.push(`${j.name}@${j.version}`);if(yield*qt(Y),he)yield*Yt();if(o)yield*Bt(s);if(Xe)yield*Qt();if(yield*Kt(i),we)yield*Ot();if(yield*Wt(r),y)yield*Xt(r,i);if(S)yield*Lt(t.name,i);yield*e.log.success("Your project is now configured"),yield*e.outro("\uD83D\uDCA0 Adamantite initialized successfully!")}).pipe(a.catchTags({OperationCancelled:()=>a.gen(function*(){yield*(yield*p).cancel("You've cancelled the initialization process.")})}))));import*as ue from"@effect/cli/Command";import*as We from"@effect/cli/Options";import*as q from"@effect/platform/Command";import*as Gn from"@effect/platform/CommandExecutor";import*as me from"effect/Effect";var Rt=We.boolean("fix").pipe(We.withDescription("Automatically fix issues")),Jn=ue.make("monorepo",{fix:Rt}).pipe(ue.withDescription("Find and fix monorepo-specific issues using Sherif"),ue.withHandler(({fix:e})=>me.gen(function*(){let t=[];if(e)t.push("--fix");return yield*q.make(I.name,...t).pipe(q.stdin("inherit"),q.stdout("inherit"),q.stderr("inherit"),q.exitCode,me.filterOrFail((n)=>n===Gn.ExitCode(0),(n)=>new h({command:I.name,exitCode:n})),me.asVoid)})));import*as fe from"@effect/cli/Command";import*as T from"@effect/cli/Options";import*as B from"@effect/platform/Command";import*as Nn from"@effect/platform/CommandExecutor";import*as ye from"effect/Effect";import*as Fn from"effect/Option";var Gt=T.file("project").pipe(T.withAlias("p"),T.optional,T.withDescription("Path to tsconfig.json file")),Jt=T.boolean("watch").pipe(T.withAlias("w"),T.withDescription("Run in watch mode")),In=fe.make("typecheck",{project:Gt,watch:Jt}).pipe(fe.withDescription("Run TypeScript type checking"),fe.withHandler(({project:e,watch:t})=>ye.gen(function*(){let i=yield*(yield*K).get,o=["--noEmit"];if(Fn.isSome(e))o.push("--project",e.value);if(t)o.push("--watch");return yield*B.make(Z.command,...o).pipe(B.workingDirectory(i),B.stdout("inherit"),B.stderr("inherit"),B.exitCode,ye.filterOrFail((s)=>s===Nn.ExitCode(0),(s)=>new h({command:Z.command,exitCode:s})),ye.asVoid)})));import*as ve from"@effect/cli/Command";import*as b from"effect/Effect";import{addDevDependency as Nt}from"nypm";var Pn=ve.make("update").pipe(ve.withDescription("Update adamantite dependencies to latest compatible versions"),ve.withHandler(()=>b.gen(function*(){let e=yield*p,t=yield*$e(),n=yield*m.exists(),i=n.format==="json";yield*ze(),yield*e.intro("\uD83D\uDCA0 adamantite update");let o=[];for(let s of[m,be,E,I]){let r=t.devDependencies?.[s.name];if(r&&$n(r)!==s.version)o.push({currentVersion:r,isDevDependency:!0,name:s.name,targetVersion:s.version})}if(o.length===0&&!i)return yield*e.log.success("All adamantite dependencies are already up to date!"),"no-updates";if(o.length>0){yield*e.log.info("The following dependencies will be updated:");for(let r of o)yield*e.log.info(` ${r.name}: ${r.currentVersion} → ${r.targetVersion}`);if(!(yield*e.confirm({message:"Do you want to proceed with these updates?"})))return"cancelled"}if(o.length>0){let s=e.spinner();s.start("Updating dependencies..."),yield*b.tryPromise({catch:(r)=>new Ee({cause:r,packages:o.map((y)=>y.name)}),try:()=>Nt(o.map((r)=>`${r.name}@${r.targetVersion}`),{silent:!0})}).pipe(b.tapError(()=>b.sync(()=>{s.stop("Failed to update dependencies")}))),s.stop("Dependencies updated successfully")}if(n.hasBoth)yield*e.log.warning("Found both `oxlint.config.ts` and `.oxlintrc.json`. Adamantite will use `oxlint.config.ts`.");if(i){let s=e.spinner();s.start("Migrating `.oxlintrc.json` to `oxlint.config.ts`..."),yield*m.update(),s.stop("Oxlint config migrated successfully")}if(o.length===0&&i)return"migrated";return"updated"}).pipe(b.tap((e)=>b.gen(function*(){let t=yield*p;switch(e){case"no-updates":yield*t.outro("✅ No updates needed");break;case"cancelled":yield*t.outro("⚠️ Update cancelled");break;case"updated":yield*t.outro("✅ Dependencies updated successfully!");break;case"migrated":yield*t.outro("✅ Oxlint config migrated to `oxlint.config.ts`!");break;default:break}})),b.catchTags({OperationCancelled:()=>b.gen(function*(){yield*(yield*p).cancel("You've cancelled the update process.")})}))));var It=P.make("adamantite").pipe(P.withDescription("Opinionated preset package for modern TypeScript applications"),P.withSubcommands([xn,An,Vn,qn,Rn,Jn,In,Pn])),Pt=await"0.30.0",Ct=P.run(It,{name:"adamantite",version:Pt});Ct(Ft.argv).pipe(A.as(cn.ExitCode(0)),A.catchTag("CommandFailed",(e)=>A.succeed(e.exitCode)),A.catchAll((e)=>A.gen(function*(){let t=yield*p,n="message"in e&&e.message?e.message:"An unexpected error occurred.";return yield*t.log.error(n),cn.ExitCode(1)}))).pipe(A.provide(tt.mergeAll(Cn.layer,Wn,fn)),et.runMain({teardown:(e,t)=>{t(nt.isSuccess(e)?e.value:1)}}));
94
+ `}var N$=new Set(Og.map((a)=>a.script));function Sg(a){return a.some((g)=>N$.has(g))}var Na={create:(a,g)=>C.gen(function*(){let $=yield*Aa.FileSystem,D=yield*Wa.Path,l=D.join(a,".github","workflows");yield*Eg(l);let v=Ng(g);if(!v)return;let y=D.join(l,"adamantite.yml");yield*$.writeFileString(y,v).pipe(C.mapError((E)=>new z({cause:E,path:y})))}),exists:(a)=>C.gen(function*(){let g=yield*Aa.FileSystem,$=yield*Wa.Path;return yield*g.exists($.join(a,".github","workflows","adamantite.yml"))}),update:(a,g)=>C.gen(function*(){let $=yield*Aa.FileSystem,l=(yield*Wa.Path).join(a,".github","workflows","adamantite.yml"),v=Ng(g);if(!v)return;yield*$.writeFileString(l,v).pipe(C.mapError((y)=>new z({cause:y,path:l})))}),workflowPath:".github/workflows/adamantite.yml"};import*as _ from"effect/Effect";import*as Oa from"effect/FileSystem";import*as Sa from"effect/Path";import*as ug from"effect/unstable/process/ChildProcess";import*as Gg from"effect/unstable/process/ChildProcessSpawner";var ca="settings.json",I={cliExists:()=>lg("code").pipe(_.mapError((a)=>new ta({cause:a}))),config:{"[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,"typescript.tsdk":"node_modules/typescript/lib"},create:(a)=>_.gen(function*(){let g=yield*Oa.FileSystem,$=yield*Sa.Path,D=$.join(a,".vscode"),l=$.join(D,ca);yield*g.makeDirectory(D,{recursive:!0}).pipe(_.mapError((v)=>new P({cause:v,path:D}))),yield*g.writeFileString(l,`${JSON.stringify(I.config,null,2)}
95
+ `).pipe(_.mapError((v)=>new z({cause:v,path:l})))}),exists:(a)=>_.gen(function*(){let g=yield*Oa.FileSystem,$=yield*Sa.Path;return yield*g.exists($.join(a,".vscode",ca))}),extension:(a=[])=>_.scoped(_.gen(function*(){yield*I.cliExists();function g(v){return _.gen(function*(){return yield*(yield*ug.make("code",["--install-extension",v],{stderr:"inherit",stdin:"ignore",stdout:"inherit"})).exitCode}).pipe(_.mapError((y)=>new Ha({cause:y,extension:v})),_.filterOrFail((y)=>y===Gg.ExitCode(0),(y)=>new Ha({cause:y,extension:v})),_.asVoid)}let $=[a.includes("check")||a.includes("fix")||a.includes("format")?g("oxc.oxc-vscode"):_.void,a.includes("analyze")?g("webpro.vscode-knip"):_.void],l=(yield*_.all($.map((v)=>v.pipe(_.match({onFailure:(y)=>y,onSuccess:()=>null}))))).find((v)=>v!==null);if(l)yield*_.fail(l)})),update:(a)=>_.gen(function*(){let g=yield*Oa.FileSystem,D=(yield*Sa.Path).join(a,".vscode",ca),l=yield*g.readFileString(D).pipe(_.mapError((E)=>new Z({cause:E,path:D}))),v=yield*A(l,D);if(!W(v))return yield*new j({path:D});let y=yield*u(I.config,v);yield*g.writeFileString(D,`${JSON.stringify(y,null,2)}
96
+ `).pipe(_.mapError((E)=>new z({cause:E,path:D})))})};import*as R from"effect/Effect";import*as ua from"effect/FileSystem";import*as Ga from"effect/Path";var pa="settings.json",$a={config:{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"}}]},TypeScript:{format_on_save:"on",formatter:[{language_server:{name:"oxfmt"}}]},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"}}}}},create:(a)=>R.gen(function*(){let g=yield*ua.FileSystem,$=yield*Ga.Path,D=$.join(a,".zed"),l=$.join(D,pa);yield*g.makeDirectory(D,{recursive:!0}).pipe(R.mapError((v)=>new P({cause:v,path:D}))),yield*g.writeFileString(l,`${JSON.stringify($a.config,null,2)}
97
+ `).pipe(R.mapError((v)=>new z({cause:v,path:l})))}),exists:(a)=>R.gen(function*(){let g=yield*ua.FileSystem,$=yield*Ga.Path;return yield*g.exists($.join(a,".zed",pa))}),update:(a)=>R.gen(function*(){let g=yield*ua.FileSystem,D=(yield*Ga.Path).join(a,".zed",pa),l=yield*g.readFileString(D).pipe(R.mapError((E)=>new Z({cause:E,path:D}))),v=yield*A(l,D);if(!W(v))return yield*new j({path:D});let y=yield*u($a.config,v);yield*g.writeFileString(D,`${JSON.stringify(y,null,2)}
98
+ `).pipe(R.mapError((E)=>new z({cause:E,path:D})))})};var k={name:"sherif",version:"1.10.0"};import*as o from"effect/Effect";import*as Ra from"effect/FileSystem";import*as ma from"effect/Path";var sa="tsconfig.json",S={command:"tsc",config:{extends:"adamantite/typescript"},create:(a)=>o.gen(function*(){let g=yield*Ra.FileSystem,D=(yield*ma.Path).join(a,sa),l=JSON.stringify(S.config,null,2);yield*g.writeFileString(D,`${l}
99
+ `).pipe(o.mapError((v)=>new z({cause:v,path:D})))}),exists:(a)=>o.gen(function*(){let g=yield*Ra.FileSystem,$=yield*ma.Path;return yield*g.exists($.join(a,sa))}),name:"typescript",update:(a)=>o.gen(function*(){let g=yield*Ra.FileSystem,D=(yield*ma.Path).join(a,sa),l=yield*g.readFileString(D).pipe(o.mapError((E)=>new Z({cause:E,path:D}))),v=yield*A(l,D);if(!W(v))return yield*new j({path:D});let y=yield*u(S.config,v);yield*g.writeFileString(D,`${JSON.stringify(y,null,2)}
100
+ `).pipe(o.mapError((E)=>new z({cause:E,path:D})))}),version:"5.9.3"};import*as i from"effect/Effect";import*as Rg from"effect/Layer";import*as mg from"effect/ServiceMap";import{addDevDependency as O$,detectPackageManager as S$}from"nypm";class x extends mg.Service()("DependencyInstaller"){static layer=Rg.succeed(this)({addDevDependencies:(a,g,$)=>i.tryPromise({catch:(D)=>new Fa({cause:D,packages:a}),try:()=>O$(a,{...$,cwd:g})}).pipe(i.asVoid),detectPackageManager:(a)=>i.tryPromise({catch:(g)=>new _a({cause:g}),try:()=>S$(a)}).pipe(i.map((g)=>g??null))})}import*as B from"@clack/prompts";import*as V from"effect/Effect";import*as Jg from"effect/Layer";import*as rg from"effect/ServiceMap";class Q extends rg.Service()("Prompter"){static layer=Jg.succeed(this)({cancel:(a)=>V.sync(()=>{B.cancel(a)}),confirm:(a)=>V.promise(()=>B.confirm(a)).pipe(V.filterOrFail((g)=>!B.isCancel(g),()=>new Za({}))),intro:(a)=>V.sync(()=>{B.intro(a)}),log:{error:(a)=>V.sync(()=>{B.log.error(a)}),info:(a)=>V.sync(()=>{B.log.info(a)}),success:(a)=>V.sync(()=>{B.log.success(a)}),warning:(a)=>V.sync(()=>{B.log.warning(a)})},multiselect:(a)=>V.promise(()=>B.multiselect(a)).pipe(V.filterOrFail((g)=>!B.isCancel(g),()=>new Za({}))),outro:(a)=>V.sync(()=>{B.outro(a)}),spinner:()=>B.spinner()})}var G$=(a,g)=>T.gen(function*(){let $=yield*x,l=(yield*Q).spinner();l.start("Installing dependencies...");let v=yield*ha(a);yield*$.addDevDependencies(g,a,{silent:!0,workspace:v}).pipe(T.tapError(()=>T.sync(()=>{l.stop("Failed to install dependencies.")}))),l.stop("Dependencies installed.")}),R$=(a,g)=>T.gen(function*(){let $=yield*Q,D=$.spinner();D.start("Setting up oxlint config...");let l=yield*Y.exists(a);if(l.hasBoth)yield*$.log.warning("Found both `oxlint.config.ts` and `.oxlintrc.json`. Adamantite will use `oxlint.config.ts`.");if(l.format==="json")D.message("Found `.oxlintrc.json`, migrating to `oxlint.config.ts`..."),yield*Y.update(a,g),D.stop("oxlint config migrated successfully.");else if(l.format==="ts")D.message("Found `oxlint.config.ts`, keeping existing config."),D.stop("oxlint config is ready.");else D.message("`oxlint.config.ts` not found, creating..."),yield*Y.create(a,g),D.stop("oxlint config created successfully.")}),m$=(a)=>T.gen(function*(){let $=(yield*Q).spinner();$.start("Setting up oxfmt config...");let D=yield*K.exists(a);if(D.path)$.message(`Found \`${D.path}\`, updating...`),yield*K.update(a),$.stop("oxfmt config updated successfully.");else $.message("`.oxfmtrc.jsonc` or `.oxfmtrc.json` not found, creating..."),yield*K.create(a),$.stop("oxfmt config created successfully.")}),J$=(a,g)=>T.gen(function*(){let $=yield*Fg.FileSystem,D=yield*Ig.Path,l=yield*Q,v=yield*za(a),y=l.spinner();y.start("Adding scripts to your `package.json`..."),v.scripts??={};for(let f of g)switch(f){case"check":v.scripts.check="adamantite check";break;case"fix":v.scripts.fix="adamantite fix";break;case"format":v.scripts.format="adamantite format";break;case"typecheck":v.scripts.typecheck="adamantite typecheck";break;case"check:monorepo":v.scripts["check:monorepo"]="adamantite monorepo";break;case"fix:monorepo":v.scripts["fix:monorepo"]="adamantite monorepo --fix";break;case"analyze":v.scripts.analyze="adamantite analyze";break;default:return yield*new xa({script:f})}let E=D.join(a,"package.json");yield*$.writeFileString(E,`${JSON.stringify(v,null,2)}
101
+ `).pipe(T.mapError((f)=>new z({cause:f,path:E}))),y.stop("Scripts added to your `package.json`")}),r$=(a)=>T.gen(function*(){let $=(yield*Q).spinner();$.start("Setting up knip config...");let D=yield*M.exists(a);if(D.path)$.message(`Found \`${D.path}\`, updating...`),yield*M.update(a),$.stop("knip config updated successfully.");else $.message("`knip.json` not found, creating..."),yield*M.create(a),$.stop("knip config created successfully.")}),F$=(a)=>T.gen(function*(){let $=(yield*Q).spinner();if($.start("Setting up TypeScript config..."),yield*S.exists(a))$.message("`tsconfig.json` found, updating..."),yield*S.update(a),$.stop("`tsconfig.json` updated successfully");else $.message("`tsconfig.json` not found, creating..."),yield*S.create(a),$.stop("`tsconfig.json` created successfully")}),I$=(a,g)=>T.gen(function*(){let $=yield*Q;if(g.includes("vscode")){let D=$.spinner();if(D.start("Checking for `.vscode/settings.json`..."),yield*I.exists(a))D.message("`.vscode/settings.json` found, updating..."),yield*I.update(a),D.stop("`.vscode/settings.json` updated with Adamantite preset.");else D.message("`.vscode/settings.json` not found, creating..."),yield*I.create(a),D.stop("`.vscode/settings.json` created with Adamantite preset.")}if(g.includes("zed")){let D=$.spinner();if(D.start("Checking for `.zed/settings.json`..."),yield*$a.exists(a))D.message("`.zed/settings.json` found, updating..."),yield*$a.update(a),D.stop("`.zed/settings.json` updated with Adamantite preset.");else D.message("`.zed/settings.json` not found, creating..."),yield*$a.create(a),D.stop("`.zed/settings.json` created with Adamantite preset.")}}),k$=(a,g)=>T.gen(function*(){let $=yield*Q,D=$.spinner();D.start("Installing editor extensions...");let l=a.includes("zed"),v=a.includes("vscode");if(yield*T.gen(function*(){if(a.includes("vscode"))D.message("Installing VS Code extension..."),yield*I.extension(g);return!0}).pipe(T.tapError(()=>T.sync(()=>{D.stop()})),T.catchTag("FailedToInstallExtension",(E)=>T.gen(function*(){return yield*$.log.warning(`⚠️ Failed to install the \`${E.extension}\` extension.`),yield*$.log.warning("Please install it manually after setup completes."),!1})),T.catchTag("VscodeCliNotFound",()=>T.gen(function*(){return yield*$.log.error("VSCode CLI ('code' command) not found."),yield*$.log.info("To install it:"),yield*$.log.info(" 1. Open VS Code"),yield*$.log.info(" 2. Press Cmd+Shift+P (macOS) or Ctrl+Shift+P (Windows/Linux)"),yield*$.log.info(` 3. Run 'Shell Command: Install "code" command in PATH'`),!1}))))if(l&&!v)D.stop("Zed extensions require manual install.");else D.stop("Editor extensions installed successfully.");if(l)yield*$.log.info("Install the Zed `oxc` extension: zed://extension/oxc")}),o$=(a,g,$)=>T.gen(function*(){let l=(yield*Q).spinner();if(l.start("Setting up GitHub Actions workflow..."),yield*Na.exists(a))l.message("`.github/workflows/adamantite.yml` found, updating..."),yield*Na.update(a,{packageManager:g,scripts:$}),l.stop("GitHub Actions workflow updated successfully.");else l.message("Creating `.github/workflows/adamantite.yml`..."),yield*Na.create(a,{packageManager:g,scripts:$}),l.stop("GitHub Actions workflow created successfully.")}).pipe(T.option),kg=Da.make("init").pipe(Da.withDescription("Initialize Adamantite in the current directory"),Da.withHandler(()=>T.gen(function*(){let a=u$.cwd(),g=yield*Q;yield*Ka(),yield*g.intro("\uD83D\uDCA0 adamantite init");let D=yield*(yield*x).detectPackageManager(a);if(!D)return yield*new _a({});if(D.warnings?.length)for(let n of D.warnings)yield*g.log.warning(n);yield*g.log.info(`Detected package manager: ${D.name}`);let l=yield*ha(a);if(l)yield*g.log.info("We've detected a monorepo setup in your project.");let v=yield*g.multiselect({message:"Which scripts do you want to add to your `package.json`?",options:[{hint:"recommended",label:"check - find issues in code 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"},{hint:"extends the `adamantite/typescript` preset in your `tsconfig.json`",label:"typecheck - type-check your code using tsc",value:"typecheck"},{disabled:!l,hint:l?void 0:"available for monorepo projects",label:"check:monorepo - check for monorepo-specific issues using Sherif",value:"check:monorepo"},{disabled:!l,hint:l?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"}]}),y=v.includes("check")||v.includes("fix"),E=[];if(y)E=yield*g.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 f=yield*g.multiselect({message:"Which editors do you want to configure? (optional)",options:[{label:"VSCode / Cursor / Windsurf",value:"vscode"},{label:"Zed",value:"zed"}],required:!1}),Ea=!1;if(f.length>0)Ea=yield*g.confirm({initialValue:!0,message:"Do you want to install the recommended editor extensions?"});let Ba=Sg(v),Qa=!1;if(Ba)Qa=yield*g.confirm({message:"Do you want to add a GitHub Actions workflow to run checks in CI?"});let fa=v.includes("format"),qa=v.includes("check:monorepo")||v.includes("fix:monorepo"),ra=v.includes("typecheck"),Ya=v.includes("analyze"),H=["adamantite"];if(y)H.push(`${Y.name}@${Y.version}`),H.push(`${Ua.name}@${Ua.version}`);if(fa)H.push(`${K.name}@${K.version}`);if(qa)H.push(`${k.name}@${k.version}`);if(ra)H.push(`${S.name}@${S.version}`);if(Ya)H.push(`${M.name}@${M.version}`);if(yield*G$(a,H),fa)yield*m$(a);if(y)yield*R$(a,E);if(Ya)yield*r$(a);if(yield*J$(a,v),ra)yield*F$(a);if(yield*I$(a,f),Ea)yield*k$(f,v);if(Qa)yield*o$(a,D.name,v);yield*g.log.success("Your project is now configured"),yield*g.outro("\uD83D\uDCA0 Adamantite initialized successfully!")}).pipe(T.catchTags({OperationCancelled:()=>T.gen(function*(){yield*(yield*Q).cancel("You've cancelled the initialization process.")})}))));import*as og from"effect/Effect";import*as va from"effect/unstable/cli/Command";import*as Ja from"effect/unstable/cli/Flag";import*as xg from"effect/unstable/process/ChildProcessSpawner";var x$=Ja.boolean("fix").pipe(Ja.withDescription("Automatically fix issues")),tg=va.make("monorepo",{fix:x$}).pipe(va.withDescription("Find and fix monorepo-specific issues using Sherif"),va.withHandler(({fix:a})=>og.gen(function*(){let g=yield*b,$=a?["--fix"]:[],D=yield*g.run({args:$,command:k.name,stdin:"inherit"});if(D!==xg.ExitCode(0))yield*new L({command:k.name,exitCode:D})})));import t$ from"node:process";import*as ng from"effect/Effect";import*as Pg from"effect/Option";import*as la from"effect/unstable/cli/Command";import*as N from"effect/unstable/cli/Flag";import*as hg from"effect/unstable/process/ChildProcessSpawner";var n$=N.file("project",{mustExist:!0}).pipe(N.withAlias("p"),N.optional,N.withDescription("Path to tsconfig.json file")),P$=N.boolean("watch").pipe(N.withAlias("w"),N.withDescription("Run in watch mode")),Cg=la.make("typecheck",{project:n$,watch:P$}).pipe(la.withDescription("Run TypeScript type checking"),la.withHandler(({project:a,watch:g})=>ng.gen(function*(){let $=yield*b,D=t$.cwd(),l=["--noEmit"];if(Pg.isSome(a))l.push("--project",a.value);if(g)l.push("--watch");let v=yield*$.run({args:l,command:S.command,cwd:D});if(v!==hg.ExitCode(0))yield*new L({command:S.command,exitCode:v})})));import h$ from"node:process";import*as O from"effect/Effect";import*as ya from"effect/unstable/cli/Command";var ig=ya.make("update").pipe(ya.withDescription("Update adamantite dependencies to latest compatible versions"),ya.withHandler(()=>O.gen(function*(){let a=h$.cwd(),g=yield*Q,$=yield*za(a),D=yield*Y.exists(a),l=D.format==="json";yield*Ka(),yield*g.intro("\uD83D\uDCA0 adamantite update");let v=yield*x,y=[];for(let E of[Y,Ua,K,k,M]){let f=$.devDependencies?.[E.name];if(f&&yg(f)!==E.version)y.push({currentVersion:f,isDevDependency:!0,name:E.name,targetVersion:E.version})}if(D.hasBoth)yield*g.log.warning("Found both `oxlint.config.ts` and `.oxlintrc.json`. Adamantite will use `oxlint.config.ts`.");if(y.length===0&&!l)return yield*g.log.success("All adamantite dependencies are already up to date!"),"no-updates";if(y.length>0){yield*g.log.info("The following dependencies will be updated:");for(let f of y)yield*g.log.info(` ${f.name}: ${f.currentVersion} → ${f.targetVersion}`);if(!(yield*g.confirm({message:"Do you want to proceed with these updates?"})))return"cancelled"}if(y.length>0){let E=g.spinner();E.start("Updating dependencies..."),yield*v.addDevDependencies(y.map((f)=>`${f.name}@${f.targetVersion}`),a,{silent:!0}).pipe(O.tapError(()=>O.sync(()=>{E.stop("Failed to update dependencies")}))),E.stop("Dependencies updated successfully")}if(l){let E=g.spinner();E.start("Migrating `.oxlintrc.json` to `oxlint.config.ts`..."),yield*Y.update(a),E.stop("Oxlint config migrated successfully")}if(y.length===0&&l)return"migrated";return"updated"}).pipe(O.tap((a)=>O.gen(function*(){let g=yield*Q;switch(a){case"no-updates":yield*g.outro("✅ No updates needed");break;case"cancelled":yield*g.outro("⚠️ Update cancelled");break;case"updated":yield*g.outro("✅ Dependencies updated successfully!");break;case"migrated":yield*g.outro("✅ Oxlint config migrated to `oxlint.config.ts`!");break;default:break}})),O.catchTags({OperationCancelled:()=>O.gen(function*(){yield*(yield*Q).cancel("You've cancelled the update process.")})}))));var C$=t.make("adamantite").pipe(t.withDescription("Opinionated preset package for modern TypeScript applications"),t.withSubcommands([Bg,Kg,Vg,Wg,kg,tg,Cg,ig])),i$=await"0.30.2",w$=t.run(C$,{version:i$}).pipe(X.as(0),X.catchTag("CommandFailed",(a)=>X.succeed(a.exitCode)),X.catch((a)=>X.service(Q).pipe(X.flatMap((g)=>g.log.error(a.message)),X.as(sg.ExitCode(1)))),X.provide(cg.mergeAll(eg.layer,Q.layer,b.layer,x.layer)));wg.runMain(w$,{teardown:(a,g)=>{if(dg.isSuccess(a)){g(Number(a.value));return}pg.defaultTeardown(a,g)}});
@@ -0,0 +1,44 @@
1
+ {
2
+ "$schema": "../node_modules/oxfmt/configuration_schema.json",
3
+ "arrowParens": "always",
4
+ "bracketSameLine": false,
5
+ "bracketSpacing": true,
6
+ "embeddedLanguageFormatting": "auto",
7
+ "endOfLine": "lf",
8
+ "sortImports": {
9
+ "groups": [
10
+ ["value-builtin", "type-import"],
11
+ ["value-external"],
12
+ ["type-internal"],
13
+ ["value-internal"],
14
+ ["type-subpath"],
15
+ ["value-subpath"],
16
+ ["type-parent", "type-sibling", "type-index"],
17
+ ["value-parent", "value-sibling", "value-index"],
18
+ ["unknown"]
19
+ ],
20
+ "ignoreCase": true,
21
+ "newlinesBetween": false,
22
+ "partitionByNewline": true,
23
+ "order": "asc",
24
+ "partitionByComment": true,
25
+ "sortSideEffects": false
26
+ },
27
+ "sortTailwindcss": {
28
+ "attributes": ["className", "class"],
29
+ "functions": ["clsx", "cn", "cva", "tw", "twMerge"],
30
+ "preserveDuplicates": false,
31
+ "preserveWhitespace": false
32
+ },
33
+ "insertFinalNewline": true,
34
+ "jsxSingleQuote": false,
35
+ "objectWrap": "preserve",
36
+ "printWidth": 100,
37
+ "quoteProps": "as-needed",
38
+ "semi": false,
39
+ "singleAttributePerLine": false,
40
+ "singleQuote": false,
41
+ "tabWidth": 2,
42
+ "trailingComma": "es5",
43
+ "useTabs": false
44
+ }
@@ -0,0 +1,29 @@
1
+ {
2
+ "$schema": "https://unpkg.com/knip@5/schema.json",
3
+ "rules": {
4
+ "files": "error",
5
+ "dependencies": "error",
6
+ "devDependencies": "error",
7
+ "optionalPeerDependencies": "warn",
8
+ "unlisted": "error",
9
+ "binaries": "error",
10
+ "unresolved": "error",
11
+ "exports": "warn",
12
+ "nsExports": "warn",
13
+ "types": "warn",
14
+ "nsTypes": "warn",
15
+ "enumMembers": "off",
16
+ "classMembers": "off",
17
+ "duplicates": "warn"
18
+ },
19
+ "ignoreExportsUsedInFile": true,
20
+ "ignoreFiles": [
21
+ "**/dist/**",
22
+ "**/build/**",
23
+ "**/coverage/**",
24
+ "**/.next/**",
25
+ "**/.vercel/**",
26
+ "**/.turbo/**"
27
+ ],
28
+ "ignore": ["**/*.d.ts"]
29
+ }