adamantite 0.30.2 → 0.32.0

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/README.md CHANGED
@@ -37,10 +37,9 @@ npx adamantite init
37
37
  Adamantite will automatically configure your project with linting, formatting, and type-safety rules.
38
38
 
39
39
  ```shell
40
- adamantite check # Check code for issues without fixing using oxlint
40
+ adamantite check # Check code for issues and type errors using oxlint
41
41
  adamantite fix # Fix code issues using oxlint
42
42
  adamantite format # Format code using oxfmt
43
- adamantite typecheck # Run TypeScript type checking using the strict preset
44
43
  adamantite monorepo # Check monorepo for dependency issues using Sherif
45
44
  adamantite update # Update Adamantite's dependencies to the latest compatible versions
46
45
  ```
@@ -68,7 +67,7 @@ This interactive command will:
68
67
 
69
68
  - Install Adamantite, [oxlint](https://oxc.rs/docs/guide/usage/linter.html), and [oxfmt](https://oxc.rs/docs/guide/usage/formatter.html) as dev dependencies
70
69
  - Create `oxlint.config.ts` with opinionated presets
71
- - Create `.oxfmtrc.json` with formatting configuration
70
+ - Create `oxfmt.config.ts` with formatting configuration
72
71
  - Set up `tsconfig.json` with strict TypeScript rules
73
72
  - Add lint/format scripts to your `package.json`
74
73
  - Also adds monorepo-specific scripts if running a monorepo
@@ -78,7 +77,7 @@ This interactive command will:
78
77
 
79
78
  ### `adamantite check`
80
79
 
81
- Check your code for issues without automatically fixing them using oxlint:
80
+ Check your code for issues and type errors without automatically fixing them using oxlint:
82
81
 
83
82
  ```shell
84
83
  # Check all files
@@ -97,7 +96,7 @@ Fix issues in your code with automatic formatting and safe fixes:
97
96
  adamantite fix
98
97
 
99
98
  # Fix specific files
100
- adamantite fix src/utils.ts
99
+ adamantite fix src/index.ts
101
100
 
102
101
  # Apply suggested fixes
103
102
  adamantite fix --suggested
@@ -118,7 +117,7 @@ Format your code using oxfmt:
118
117
  adamantite format
119
118
 
120
119
  # Format specific files
121
- adamantite format src/utils.ts
120
+ adamantite format src/index.ts
122
121
 
123
122
  # Check if files are formatted without writing
124
123
  adamantite format --check
@@ -143,27 +142,17 @@ Automatically detects and fixes:
143
142
  - Unused dependencies
144
143
  - Package.json formatting issues
145
144
 
146
- ### `adamantite typecheck`
147
-
148
- Run TypeScript type checking using tsc and the strict preset:
149
-
150
- ```shell
151
- # Type check all files
152
- adamantite typecheck
153
-
154
- # Type check a specific project
155
- adamantite typecheck --project tsconfig.json
156
- ```
157
-
158
145
  ### `adamantite update`
159
146
 
160
- Keep your dependencies current:
147
+ Run applicable migrations and update Adamantite-managed dependencies:
161
148
 
162
149
  ```shell
163
- # Update to latest compatible versions
150
+ # Run migrations and update managed dependencies
164
151
  adamantite update
165
152
  ```
166
153
 
154
+ This also migrates legacy `.oxfmtrc.json(c)` configs to `oxfmt.config.ts` and `knip.json(c)` configs to `knip.config.ts`.
155
+
167
156
  ## Presets
168
157
 
169
158
  ### Linting ([presets/lint/](./presets/lint/))
@@ -193,9 +182,13 @@ Framework-specific presets are available for:
193
182
  - **Jest** ([jest.ts](./presets/lint/jest.ts)) - Jest testing rules
194
183
  - **Vitest** ([vitest.ts](./presets/lint/vitest.ts)) - Vitest testing rules
195
184
 
196
- ### Formatting ([presets/format.json](./presets/format.json))
185
+ ### Formatting ([format.ts](./presets/format.ts))
186
+
187
+ Opinionated code formatting with oxfmt, configured for consistency and readability. The published formatter preset is available as `adamantite/format` and is designed to be used from `oxfmt.config.ts`.
188
+
189
+ ### Analyze ([analyze.ts](./presets/analyze.ts))
197
190
 
198
- Opinionated code formatting with oxfmt, configured for consistency and readability. Includes automatic import sorting and organization.
191
+ Opinionated Knip configuration for dependency and unused-file analysis. The published analyze preset is available as `adamantite/analyze` and is designed to be used from `knip.config.ts`.
199
192
 
200
193
  ### TypeScript ([presets/tsconfig.json](./presets/tsconfig.json))
201
194
 
@@ -215,8 +208,8 @@ bun test
215
208
  # Build CLI
216
209
  bun run build
217
210
 
218
- # Type checking
219
- bun run typecheck
211
+ # Linting and type checking
212
+ bun run check
220
213
  ```
221
214
 
222
215
  ## 🤝 Contributing
package/dist/index.js CHANGED
@@ -1,13 +1,23 @@
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
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(`
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(`
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(`
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(`
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(`
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(`
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
11
21
  uses: actions/setup-node@v6
12
22
  with:
13
23
  node-version: "22"
@@ -54,7 +64,7 @@ import*as wg from"@effect/platform-node/NodeRuntime";import*as eg from"@effect/p
54
64
  cache: "yarn"
55
65
 
56
66
  - name: Install dependencies
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
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
58
68
 
59
69
  on:
60
70
  push:
@@ -79,23 +89,24 @@ jobs:
79
89
  fail-fast: false
80
90
  matrix:
81
91
  include:
82
- ${$.map((v)=>` - name: ${v.name}
83
- command: ${v.command}`).join(`
92
+ ${r.map((i)=>` - name: ${i.name}
93
+ command: ${i.command}`).join(`
84
94
  `)}
85
95
 
86
96
  steps:
87
97
  - name: Checkout
88
98
  uses: actions/checkout@v4
89
99
 
90
- ${W$[a]}
100
+ ${Zr[e]}
91
101
 
92
102
  - name: Run \${{ matrix.name }}
93
103
  run: \${{ matrix.command }}`}
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)}});
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.0",_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)}});
@@ -0,0 +1,23 @@
1
+ declare const _default: {
2
+ readonly ignore: readonly ["**/*.d.ts"];
3
+ readonly ignoreExportsUsedInFile: true;
4
+ readonly ignoreFiles: readonly ["**/dist/**", "**/build/**", "**/coverage/**", "**/.next/**", "**/.vercel/**", "**/.turbo/**"];
5
+ readonly rules: {
6
+ readonly binaries: "error";
7
+ readonly catalog: "error";
8
+ readonly dependencies: "error";
9
+ readonly devDependencies: "error";
10
+ readonly duplicates: "warn";
11
+ readonly enumMembers: "off";
12
+ readonly exports: "warn";
13
+ readonly files: "error";
14
+ readonly namespaceMembers: "warn";
15
+ readonly nsExports: "warn";
16
+ readonly nsTypes: "warn";
17
+ readonly optionalPeerDependencies: "warn";
18
+ readonly types: "warn";
19
+ readonly unlisted: "error";
20
+ readonly unresolved: "error";
21
+ };
22
+ };
23
+ export { _default as default };
@@ -0,0 +1,33 @@
1
+ // presets/analyze.ts
2
+ var analyze_default = {
3
+ ignore: ["**/*.d.ts"],
4
+ ignoreExportsUsedInFile: true,
5
+ ignoreFiles: [
6
+ "**/dist/**",
7
+ "**/build/**",
8
+ "**/coverage/**",
9
+ "**/.next/**",
10
+ "**/.vercel/**",
11
+ "**/.turbo/**"
12
+ ],
13
+ rules: {
14
+ binaries: "error",
15
+ catalog: "error",
16
+ dependencies: "error",
17
+ devDependencies: "error",
18
+ duplicates: "warn",
19
+ enumMembers: "off",
20
+ exports: "warn",
21
+ files: "error",
22
+ namespaceMembers: "warn",
23
+ nsExports: "warn",
24
+ nsTypes: "warn",
25
+ optionalPeerDependencies: "warn",
26
+ types: "warn",
27
+ unlisted: "error",
28
+ unresolved: "error"
29
+ }
30
+ };
31
+ export {
32
+ analyze_default as default
33
+ };
@@ -0,0 +1,50 @@
1
+ declare const _default: {
2
+ readonly arrowParens: "always";
3
+ readonly bracketSameLine: false;
4
+ readonly bracketSpacing: true;
5
+ readonly embeddedLanguageFormatting: "auto";
6
+ readonly endOfLine: "lf";
7
+ readonly htmlWhitespaceSensitivity: "css";
8
+ readonly insertFinalNewline: true;
9
+ readonly jsdoc: {
10
+ readonly addDefaultToDescription: true;
11
+ readonly bracketSpacing: false;
12
+ readonly capitalizeDescriptions: true;
13
+ readonly commentLineStrategy: "multiline";
14
+ readonly descriptionTag: false;
15
+ readonly descriptionWithDot: false;
16
+ readonly keepUnparsableExampleIndent: false;
17
+ readonly lineWrappingStyle: "greedy";
18
+ readonly preferCodeFences: false;
19
+ readonly separateReturnsFromParam: true;
20
+ };
21
+ readonly jsxSingleQuote: false;
22
+ readonly objectWrap: "preserve";
23
+ readonly printWidth: 100;
24
+ readonly quoteProps: "as-needed";
25
+ readonly semi: false;
26
+ readonly singleAttributePerLine: false;
27
+ readonly singleQuote: false;
28
+ readonly sortImports: {
29
+ readonly groups: readonly [readonly ["value-builtin", "type-import"], readonly ["value-external"], readonly ["type-internal"], readonly ["value-internal"], readonly ["type-subpath"], readonly ["value-subpath"], readonly ["type-parent", "type-sibling", "type-index"], readonly ["value-parent", "value-sibling", "value-index"], readonly ["unknown"]];
30
+ readonly ignoreCase: true;
31
+ readonly newlinesBetween: false;
32
+ readonly order: "asc";
33
+ readonly partitionByComment: true;
34
+ readonly partitionByNewline: true;
35
+ readonly sortSideEffects: false;
36
+ };
37
+ readonly sortPackageJson: {
38
+ readonly sortScripts: true;
39
+ };
40
+ readonly sortTailwindcss: {
41
+ readonly attributes: readonly ["className", "class"];
42
+ readonly functions: readonly ["clsx", "cn", "cva", "tw", "twMerge"];
43
+ readonly preserveDuplicates: false;
44
+ readonly preserveWhitespace: false;
45
+ };
46
+ readonly tabWidth: 2;
47
+ readonly trailingComma: "es5";
48
+ readonly useTabs: false;
49
+ };
50
+ export { _default as default };