adamantite 0.34.3 → 0.34.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -116,4 +116,4 @@ ${af[r]}
116
116
  `)?`
117
117
  `:`
118
118
 
119
- `;return yield*t.writeFileString(f,`${l}${m}${O}`).pipe(hr.mapError((h)=>new S({cause:h,path:f}))),"updated"});import Wf from"node:process";import*as yn from"effect/Effect";import*as an from"effect/FileSystem";import*as mn from"effect/Path";var Ge=(r=Wf.cwd())=>yn.gen(function*(){let e=yield*an.FileSystem,t=yield*mn.Path;if(yield*e.exists(t.join(r,"pnpm-workspace.yaml")))return!0;return(yield*b(r)).workspaces!==void 0});var Kf=(r,e)=>$.gen(function*(){let t=yield*Y;yield*(yield*o).withSpinner(()=>$.gen(function*(){let f=yield*Ge(r);yield*t.addDevDependencies(e,r,{silent:!0,workspace:f})}),{failure:"Failed to install dependencies.",start:"Installing dependencies...",success:"Dependencies installed."})});function Me(r,e,t){return $.gen(function*(){let n=yield*o,f=yield*n.withSpinner((u)=>$.gen(function*(){let l=yield*e.detect(r);for(let a of l.warnings)yield*n.log.warning(a);if(l.active===null)return yield*u.message(`\`${e.config}\` not found, creating...`),yield*t,{created:!0,legacyConfig:null};if(l.active.format==="ts")return yield*u.message(`Found \`${e.config}\`, keeping existing config.`),{created:!1,legacyConfig:null};return yield*u.message(`Found \`${l.active.file}\`, keeping existing config.`),{created:!1,legacyConfig:l.active.file}}),{failure:`Failed to set up ${e.name} config.`,start:`Setting up ${e.name} config...`,success:(u)=>u.created?`${e.name} config created successfully.`:`${e.name} config is ready.`});if(f.legacyConfig)yield*n.log.info(`Legacy \`${f.legacyConfig}\` was preserved during \`adamantite init\`. Run \`adamantite doctor --fix\` to migrate it to the latest ${e.name} config.`)})}var Pf=(r,e)=>$.gen(function*(){let t=yield*o,n=yield*b(r);yield*t.withSpinner(()=>$.gen(function*(){n.scripts??={};for(let f of e)n.scripts[f]=ur[f];yield*Gr(r,n)}),{failure:"Failed to add scripts to `package.json`.",start:"Adding scripts to your `package.json`...",success:"Scripts added to your `package.json`"})}),Ff=(r)=>$.gen(function*(){yield*(yield*o).withSpinner((t)=>$.gen(function*(){if(yield*V.detect(r))return yield*t.message(`\`${V.config}\` found, updating...`),yield*V.update(r),!1;return yield*t.message(`\`${V.config}\` not found, creating...`),yield*V.create(r),!0}),{failure:"Failed to set up TypeScript config.",start:"Setting up TypeScript config...",success:(t)=>t?`\`${V.config}\` created successfully`:`\`${V.config}\` updated successfully`})}),Tf=(r,e)=>$.gen(function*(){let t=yield*o;if(e.includes("vscode"))yield*t.withSpinner((n)=>$.gen(function*(){let f=yield*k.detect(r);return yield*n.message(`\`${k.config}\` ${f?"found, updating":"not found, creating"}...`),yield*f?k.update(r):k.create(r),!f}),{failure:"Failed to set up VS Code config.",start:`Checking for \`${k.config}\`...`,success:(n)=>`\`${k.config}\` ${n?"created":"updated"} with Adamantite preset.`});if(e.includes("zed"))yield*t.withSpinner((n)=>$.gen(function*(){let f=yield*Er.detect(r);return yield*n.message(`\`${Er.config}\` ${f?"found, updating":"not found, creating"}...`),yield*f?Er.update(r):Er.create(r),!f}),{failure:"Failed to set up Zed config.",start:`Checking for \`${Er.config}\`...`,success:(n)=>`\`${Er.config}\` ${n?"created":"updated"} with Adamantite preset.`})}),Yf=(r,e)=>$.gen(function*(){let t=yield*o,n=r.includes("zed"),f=r.includes("vscode");if(yield*t.withSpinner((u)=>$.gen(function*(){if(f)yield*u.message("Installing VS Code extension..."),yield*k.extension(e);return!0}),{start:"Installing editor extensions...",success:n&&!f?"Zed extensions require manual install.":"Editor extensions installed successfully."}).pipe($.catchTag("FailedToInstallExtension",(u)=>$.gen(function*(){return yield*t.log.warning(`⚠️ Failed to install the \`${u.extension}\` extension.`),yield*t.log.warning("Please install it manually after setup completes."),!1})),$.catchTag("VscodeCliNotFound",()=>$.gen(function*(){return yield*t.log.error("VSCode CLI ('code' command) not found."),yield*t.log.info("To install it:"),yield*t.log.info(" 1. Open VS Code"),yield*t.log.info(" 2. Press Cmd+Shift+P (macOS) or Ctrl+Shift+P (Windows/Linux)"),yield*t.log.info(` 3. Run 'Shell Command: Install "code" command in PATH'`),!1}))),n)yield*t.log.info("Install the Zed `oxc` extension: zed://extension/oxc")}),_f=(r,e,t)=>$.gen(function*(){let n=yield*o,f=g.files[0].path;yield*n.withSpinner((u)=>$.gen(function*(){let l=yield*g.detect(r);return yield*u.message(l?`\`${f}\` found, updating...`:`Creating \`${f}\`...`),yield*l?g.update(r,{packageManager:e,scripts:t}):g.create(r,{packageManager:e,scripts:t}),!l}),{failure:"Failed to set up GitHub Actions workflow.",start:"Setting up GitHub Actions workflow...",success:(u)=>`GitHub Actions workflow ${u?"created":"updated"} successfully.`})}).pipe($.option),Xf=(r,e,t)=>$.gen(function*(){let n=yield*o,f=yield*n.withSpinner(()=>ln(r,{packageManager:e,scripts:t}),{failure:"Failed to update AGENTS.md.",start:"Updating AGENTS.md...",success:"AGENTS.md check complete."}).pipe($.catchTag(["FailedToReadFile","FailedToWriteFile"],(u)=>$.gen(function*(){return yield*n.log.warning(`Could not update AGENTS.md. ${u.message} Adamantite will continue initialization.`),"failed"})));if(f==="failed")return;if(f==="malformed")yield*n.log.warning("Could not update AGENTS.md because Adamantite markers are incomplete. Remove the stale ADAMANTITE marker and run adamantite init again.")}),En=["check","fix","format","check:monorepo","fix:monorepo","analyze"],hn=["react","nextjs","vue","jest","vitest","node"],On=["vscode","zed"],Nf=$.fn("validateInitOptions")(function*(r,e){let t={agents:r.agents,editors:Zr.dedupe(r.editors),githubActions:r.githubActions,installExtensions:r.installExtensions,presets:Zr.dedupe(r.presets),scripts:Zr.dedupe(r.scripts),typescript:r.typescript};if(t.scripts.length===0)return yield*new X({reason:"Select at least one script with `--script <name>`."});let n=t.scripts.includes("check")||t.scripts.includes("fix");if((t.scripts.includes("check:monorepo")||t.scripts.includes("fix:monorepo"))&&!e.isMonorepo)return yield*new X({reason:"Monorepo scripts can only be selected in a detected monorepo."});if(t.presets.length>0&&!n)return yield*new X({reason:"`--preset` requires the `check` or `fix` script."});if(t.typescript&&!n)return yield*new X({reason:"`--typescript` requires the `check` or `fix` script."});if(t.installExtensions&&t.editors.length===0)return yield*new X({reason:"`--install-extensions` requires at least one `--editor`."});if(t.githubActions&&!Hr(t.scripts))return yield*new X({reason:"`--github-actions` requires a CI-compatible script."});if(t.githubActions&&e.nonInteractive&&!Xr(e.packageManager))return yield*new X({reason:`\`--github-actions\` does not support the detected package manager \`${e.packageManager}\`. Use bun, deno, npm, pnpm, or yarn.`});return t}),Hf=v.boolean("non-interactive").pipe(v.withDescription("Configure without prompts; requires at least one --script")),Lf=v.choice("script",En).pipe(v.atMost(En.length),v.withDescription("Package script to configure; repeatable and required in non-interactive mode. Monorepo scripts require a detected monorepo")),xf=v.choice("preset",hn).pipe(v.atMost(hn.length),v.withDescription("Oxlint preset to configure; repeatable and requires --script check or fix")),Jf=v.choice("editor",On).pipe(v.atMost(On.length),v.withDescription("Editor to configure; may be specified multiple times")),If=v.boolean("typescript").pipe(v.withDescription("Configure the TypeScript preset; requires --script check or fix")),df=v.boolean("install-extensions").pipe(v.withDescription("Install recommended extensions; requires at least one --editor")),Af=v.boolean("github-actions").pipe(v.withDescription("Configure CI; requires a compatible script and bun, deno, npm, pnpm, or yarn")),Gf=v.boolean("agents").pipe(v.withDescription("Add Adamantite guidance to AGENTS.md")),Mf=$.fn("collectInteractiveInitOptions")(function*(r){let e=yield*o,t=yield*e.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:!r,hint:r?void 0:"available for monorepo projects",label:"check:monorepo - check for monorepo-specific issues using Sherif",value:"check:monorepo"},{disabled:!r,hint:r?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"}]}),n=t.includes("check")||t.includes("fix"),f=[];if(n)f=yield*e.multiselect({message:"Which presets do you want to install? (core is always included)",options:[{label:"React",value:"react"},{label:"Next.js",value:"nextjs"},{label:"Vue",value:"vue"},{label:"Jest",value:"jest"},{label:"Vitest",value:"vitest"},{label:"Node",value:"node"}],required:!1});let u=n?yield*e.confirm({initialValue:!0,message:"Adamantite provides a TypeScript preset to enforce strict type-safety. Would you like to use it?"}):!1,l=yield*e.multiselect({message:"Which editors do you want to configure? (optional)",options:[{label:"VSCode / Cursor / Windsurf",value:"vscode"},{label:"Zed",value:"zed"}],required:!1}),a=l.length>0?yield*e.confirm({initialValue:!0,message:"Do you want to install the recommended editor extensions?"}):!1,y=Hr(t)?yield*e.confirm({message:"Do you want to add a GitHub Actions workflow to run checks in CI?"}):!1;return{agents:yield*e.confirm({initialValue:!0,message:"Add Adamantite guidance to AGENTS.md so coding agents know how to run project checks?"}),editors:l,githubActions:y,installExtensions:a,presets:f,scripts:t,typescript:u}}),jn=er.make("init",{agents:Gf,editors:Jf,githubActions:Af,installExtensions:df,nonInteractive:Hf,presets:xf,scripts:Lf,typescript:If}).pipe(er.withDescription("Initialize Adamantite in the current directory. Setup flags require --non-interactive; omitted boolean setup flags are disabled"),er.withExamples([{command:"adamantite init --non-interactive --script check",description:"Configure linting without prompts"},{command:"adamantite init --non-interactive --script check --script format --preset react --editor vscode --typescript --install-extensions --github-actions --agents",description:"Configure a React project with VS Code, TypeScript, CI, and agent guidance"},{command:"adamantite init --non-interactive --script check:monorepo",description:"Configure monorepo checks in a detected monorepo"}]),er.withHandler((r)=>$.gen(function*(){let e=Zf.cwd(),t=yield*o;yield*Rr(),yield*t.intro("\uD83D\uDCA0 adamantite init");let f=yield*(yield*Y).detectPackageManager(e);if(!f)return yield*new _r({});if(f.warnings?.length)for(let Yr of f.warnings)yield*t.log.warning(Yr);yield*t.log.info(`Detected package manager: ${f.name}`);let u=yield*Ge(e);if(u)yield*t.log.info("We've detected a monorepo setup in your project.");if(!r.nonInteractive&&Zr.some([r.scripts.length>0,r.presets.length>0,r.editors.length>0,r.typescript,r.installExtensions,r.githubActions,r.agents],$n.isTruthy))return yield*new X({reason:"Setup flags require `--non-interactive`."});let l=r.nonInteractive?r:yield*Mf(u),a=yield*Nf(l,{isMonorepo:u,nonInteractive:r.nonInteractive,packageManager:f.name}),y=a.scripts,O=a.presets,m=a.editors,h=a.typescript,i=a.installExtensions,I=a.githubActions,Or=a.agents,E=y.includes("check")||y.includes("fix"),d=y.includes("format"),Zn=y.includes("check:monorepo")||y.includes("fix:monorepo"),Ce=y.includes("analyze"),Tr=["adamantite"];if(E)Tr.push(`${j.name}@${j.version}`,`${C.name}@${C.version}`);if(d)Tr.push(`${K.name}@${K.version}`);if(Zn)Tr.push(`${_.name}@${_.version}`);if(Ce)Tr.push(`${Z.name}@${Z.version}`);if(yield*Kf(e,Tr),d)yield*Me(e,K,K.create(e));if(E)yield*Me(e,j,j.create(e,O));if(Ce)yield*Me(e,Z,Z.create(e));if(yield*Pf(e,y),Or)yield*Xf(e,f.name,y);if(h)yield*Ff(e);if(yield*Tf(e,m),i)yield*Yf(m,y);if(I){let Yr=f.name;if(Xr(Yr))yield*_f(e,Yr,y);else yield*t.log.warning(`Skipping GitHub Actions setup: \`${Yr}\` is not a supported package manager for CI workflow generation.`)}yield*t.log.success("Your project is now configured"),yield*t.outro("\uD83D\uDCA0 Adamantite initialized successfully!")}).pipe($.catchTags({OperationCancelled:()=>$.gen(function*(){yield*(yield*o).cancel("You've cancelled the initialization process.")})}))));import*as on from"effect/Effect";import*as Kr from"effect/unstable/cli/Command";import*as Se from"effect/unstable/cli/Flag";import*as Sn from"effect/unstable/process/ChildProcessSpawner";var gf=Se.boolean("fix").pipe(Se.withDescription("Automatically fix issues")),ge=Kr.make("monorepo",{fix:gf}).pipe(Kr.withDescription("Find and fix monorepo-specific issues using Sherif"),Kr.withHandler(({fix:r})=>on.gen(function*(){let e=yield*P,t=yield*s,n=r?["--fix",...e]:[...e],f=yield*t.run({args:n,command:_.name,stdin:"inherit"});if(f!==Sn.ExitCode(0))yield*new Q({command:_.name,exitCode:f})})));import*as vn from"effect/Effect";import*as Pr from"effect/unstable/cli/Command";import*as Dn from"effect/unstable/process/ChildProcessSpawner";var we=Pr.make("typecheck").pipe(Pr.withDescription("Deprecated alias for `check`"),Pr.withHandler(()=>vn.gen(function*(){let r=yield*P,e=yield*o,t=yield*s;yield*e.log.warning("Deprecated. Use `adamantite check` for typechecking.");let n=yield*t.run({args:[...r],command:j.name});if(n!==Dn.ExitCode(0))yield*new Q({command:j.name,exitCode:n})})));import wf from"node:process";import*as tr from"effect/Effect";import*as Fr from"effect/unstable/cli/Command";var Cf=[j,C,K,_,Z],pf=[j,C,K,_,Z];function cf(r,e){let t=[];for(let n of pf){if(e.has(n.name))continue;let f=r.devDependencies?.[n.name]??r.dependencies?.[n.name];if(f&&Ar(f)!==n.version)t.push({currentVersion:f,name:n.name,targetVersion:n.version})}return t}var zn=Fr.make("update").pipe(Fr.withDescription("Run applicable Adamantite migrations and update managed dependencies"),Fr.withHandler(()=>tr.gen(function*(){let r=wf.cwd(),e=yield*o,t=yield*Y,n={cwd:r};yield*Rr(),yield*e.intro("\uD83D\uDCA0 adamantite update");let f=()=>Ee(Cf,r),u=yield*f(),l=[];for(let E of Le.filter((d)=>d.tags.includes("update"))){let d=yield*E.check(n);l.push({migration:E,result:d})}let a=new Set([...u.flatMap(({assessment:E})=>E.warnings),...l.flatMap(({result:E})=>E.warnings)]);for(let E of a)yield*e.log.warning(E);let y=[];for(let{migration:E,result:d}of l){if(d.status!=="needed")continue;yield*e.log.info(d.summary),yield*te(E,n,{onRestore:e.log.warning(`Migration "${E.title}" failed, restoring files...`)}),y.push(E.id)}if(y.length>0)yield*e.log.success("Migrations ran successfully.");let O=yield*b(r),m=yield*f(),h=m.flatMap(({assessment:E})=>E.actions).filter((E)=>E.type==="create_config"||E.type==="update_config"||E.type==="manual_fix"),i=m.flatMap(({assessment:E})=>E.actions).filter((E)=>E.type==="install_package"||E.type==="update_package").map((E)=>E.type==="install_package"?{currentVersion:"not installed",name:E.package,targetVersion:E.targetVersion}:{currentVersion:E.currentVersion,name:E.package,targetVersion:E.targetVersion}),I=new Set(i.map((E)=>E.name)),Or=[...i,...cf(O,I)];if(Or.length>0){yield*e.log.info("The following dependencies will be updated:");for(let E of Or)yield*e.log.info(` ${E.name}: ${E.currentVersion} → ${E.targetVersion}`);yield*e.withSpinner(()=>t.addDevDependencies(Or.map((E)=>`${E.name}@${E.targetVersion}`),r,{silent:!0}),{failure:"Failed to update dependencies",start:"Updating dependencies...",success:"Dependencies updated successfully"}),yield*e.log.success("Dependencies updated successfully.")}if(h.length>0){yield*e.log.warning("Some configuration follow-up belongs to `adamantite doctor --fix`.");for(let E of h)yield*e.log.warning(`Doctor follow-up: ${E.description}`)}if(y.length===0&&Or.length===0&&h.length===0)return yield*e.log.success("No changes needed."),"no-changes";return"success"}).pipe(tr.tapError(()=>tr.gen(function*(){yield*(yield*o).outro("❌ Update failed")})),tr.tap((r)=>tr.gen(function*(){let e=yield*o;switch(r){case"no-changes":yield*e.outro("✅ Adamantite is already up to date.");break;case"success":yield*e.outro("✅ Update completed successfully!");break;default:break}})))));var kf=[_e,He,Je,Ie,ge,we],qn=[_e,He,Gt,Je,Ie,jn,ge,we,zn],ru=new Set(qn.map((r)=>r.name)),eu=new Set(kf.map((r)=>r.name)),tu=nr.make("adamantite").pipe(nr.withDescription("Opinionated preset package for modern TypeScript applications"),nr.withSubcommands(qn)),Bn=De.fn("runCli")(function*(r,e){let[t,n]=ve.splitWhere(r,(l)=>l==="--"),f=ve.drop(n,1),u=t.find((l)=>ru.has(l));if(f.length>0&&u!==void 0&&!eu.has(u))return yield*new Ve({command:u});yield*nr.runWith(tu,{version:e})(t).pipe(De.provideService(P,f))});var nu=U.gen(function*(){let e=yield*(yield*Vn.Stdio).args;yield*Bn(e,"0.34.3")}).pipe(U.as(0),U.catchTag("CommandFailed",(r)=>U.succeed(r.exitCode)),U.catch((r)=>U.service(o).pipe(U.flatMap((e)=>e.log.error(r.message)),U.as(Wn.ExitCode(1)))),U.provide(Un.mergeAll(bn.layer,o.layer,s.layer,Y.layer)));Rn.runMain(nu,{teardown:(r,e)=>{if(sn.isSuccess(r)){e(Number(r.value));return}Qn.defaultTeardown(r,e)}});
119
+ `;return yield*t.writeFileString(f,`${l}${m}${O}`).pipe(hr.mapError((h)=>new S({cause:h,path:f}))),"updated"});import Wf from"node:process";import*as yn from"effect/Effect";import*as an from"effect/FileSystem";import*as mn from"effect/Path";var Ge=(r=Wf.cwd())=>yn.gen(function*(){let e=yield*an.FileSystem,t=yield*mn.Path;if(yield*e.exists(t.join(r,"pnpm-workspace.yaml")))return!0;return(yield*b(r)).workspaces!==void 0});var Kf=(r,e)=>$.gen(function*(){let t=yield*Y;yield*(yield*o).withSpinner(()=>$.gen(function*(){let f=yield*Ge(r);yield*t.addDevDependencies(e,r,{silent:!0,workspace:f})}),{failure:"Failed to install dependencies.",start:"Installing dependencies...",success:"Dependencies installed."})});function Me(r,e,t){return $.gen(function*(){let n=yield*o,f=yield*n.withSpinner((u)=>$.gen(function*(){let l=yield*e.detect(r);for(let a of l.warnings)yield*n.log.warning(a);if(l.active===null)return yield*u.message(`\`${e.config}\` not found, creating...`),yield*t,{created:!0,legacyConfig:null};if(l.active.format==="ts")return yield*u.message(`Found \`${e.config}\`, keeping existing config.`),{created:!1,legacyConfig:null};return yield*u.message(`Found \`${l.active.file}\`, keeping existing config.`),{created:!1,legacyConfig:l.active.file}}),{failure:`Failed to set up ${e.name} config.`,start:`Setting up ${e.name} config...`,success:(u)=>u.created?`${e.name} config created successfully.`:`${e.name} config is ready.`});if(f.legacyConfig)yield*n.log.info(`Legacy \`${f.legacyConfig}\` was preserved during \`adamantite init\`. Run \`adamantite doctor --fix\` to migrate it to the latest ${e.name} config.`)})}var Pf=(r,e)=>$.gen(function*(){let t=yield*o,n=yield*b(r);yield*t.withSpinner(()=>$.gen(function*(){n.scripts??={};for(let f of e)n.scripts[f]=ur[f];yield*Gr(r,n)}),{failure:"Failed to add scripts to `package.json`.",start:"Adding scripts to your `package.json`...",success:"Scripts added to your `package.json`"})}),Ff=(r)=>$.gen(function*(){yield*(yield*o).withSpinner((t)=>$.gen(function*(){if(yield*V.detect(r))return yield*t.message(`\`${V.config}\` found, updating...`),yield*V.update(r),!1;return yield*t.message(`\`${V.config}\` not found, creating...`),yield*V.create(r),!0}),{failure:"Failed to set up TypeScript config.",start:"Setting up TypeScript config...",success:(t)=>t?`\`${V.config}\` created successfully`:`\`${V.config}\` updated successfully`})}),Tf=(r,e)=>$.gen(function*(){let t=yield*o;if(e.includes("vscode"))yield*t.withSpinner((n)=>$.gen(function*(){let f=yield*k.detect(r);return yield*n.message(`\`${k.config}\` ${f?"found, updating":"not found, creating"}...`),yield*f?k.update(r):k.create(r),!f}),{failure:"Failed to set up VS Code config.",start:`Checking for \`${k.config}\`...`,success:(n)=>`\`${k.config}\` ${n?"created":"updated"} with Adamantite preset.`});if(e.includes("zed"))yield*t.withSpinner((n)=>$.gen(function*(){let f=yield*Er.detect(r);return yield*n.message(`\`${Er.config}\` ${f?"found, updating":"not found, creating"}...`),yield*f?Er.update(r):Er.create(r),!f}),{failure:"Failed to set up Zed config.",start:`Checking for \`${Er.config}\`...`,success:(n)=>`\`${Er.config}\` ${n?"created":"updated"} with Adamantite preset.`})}),Yf=(r,e)=>$.gen(function*(){let t=yield*o,n=r.includes("zed"),f=r.includes("vscode");if(yield*t.withSpinner((u)=>$.gen(function*(){if(f)yield*u.message("Installing VS Code extension..."),yield*k.extension(e);return!0}),{start:"Installing editor extensions...",success:n&&!f?"Zed extensions require manual install.":"Editor extensions installed successfully."}).pipe($.catchTag("FailedToInstallExtension",(u)=>$.gen(function*(){return yield*t.log.warning(`⚠️ Failed to install the \`${u.extension}\` extension.`),yield*t.log.warning("Please install it manually after setup completes."),!1})),$.catchTag("VscodeCliNotFound",()=>$.gen(function*(){return yield*t.log.error("VSCode CLI ('code' command) not found."),yield*t.log.info("To install it:"),yield*t.log.info(" 1. Open VS Code"),yield*t.log.info(" 2. Press Cmd+Shift+P (macOS) or Ctrl+Shift+P (Windows/Linux)"),yield*t.log.info(` 3. Run 'Shell Command: Install "code" command in PATH'`),!1}))),n)yield*t.log.info("Install the Zed `oxc` extension: zed://extension/oxc")}),_f=(r,e,t)=>$.gen(function*(){let n=yield*o,f=g.files[0].path;yield*n.withSpinner((u)=>$.gen(function*(){let l=yield*g.detect(r);return yield*u.message(l?`\`${f}\` found, updating...`:`Creating \`${f}\`...`),yield*l?g.update(r,{packageManager:e,scripts:t}):g.create(r,{packageManager:e,scripts:t}),!l}),{failure:"Failed to set up GitHub Actions workflow.",start:"Setting up GitHub Actions workflow...",success:(u)=>`GitHub Actions workflow ${u?"created":"updated"} successfully.`})}).pipe($.option),Xf=(r,e,t)=>$.gen(function*(){let n=yield*o,f=yield*n.withSpinner(()=>ln(r,{packageManager:e,scripts:t}),{failure:"Failed to update AGENTS.md.",start:"Updating AGENTS.md...",success:"AGENTS.md check complete."}).pipe($.catchTag(["FailedToReadFile","FailedToWriteFile"],(u)=>$.gen(function*(){return yield*n.log.warning(`Could not update AGENTS.md. ${u.message} Adamantite will continue initialization.`),"failed"})));if(f==="failed")return;if(f==="malformed")yield*n.log.warning("Could not update AGENTS.md because Adamantite markers are incomplete. Remove the stale ADAMANTITE marker and run adamantite init again.")}),En=["check","fix","format","check:monorepo","fix:monorepo","analyze"],hn=["react","nextjs","vue","jest","vitest","node"],On=["vscode","zed"],Nf=$.fn("validateInitOptions")(function*(r,e){let t={agents:r.agents,editors:Zr.dedupe(r.editors),githubActions:r.githubActions,installExtensions:r.installExtensions,presets:Zr.dedupe(r.presets),scripts:Zr.dedupe(r.scripts),typescript:r.typescript};if(t.scripts.length===0)return yield*new X({reason:"Select at least one script with `--script <name>`."});let n=t.scripts.includes("check")||t.scripts.includes("fix");if((t.scripts.includes("check:monorepo")||t.scripts.includes("fix:monorepo"))&&!e.isMonorepo)return yield*new X({reason:"Monorepo scripts can only be selected in a detected monorepo."});if(t.presets.length>0&&!n)return yield*new X({reason:"`--preset` requires the `check` or `fix` script."});if(t.typescript&&!n)return yield*new X({reason:"`--typescript` requires the `check` or `fix` script."});if(t.installExtensions&&t.editors.length===0)return yield*new X({reason:"`--install-extensions` requires at least one `--editor`."});if(t.githubActions&&!Hr(t.scripts))return yield*new X({reason:"`--github-actions` requires a CI-compatible script."});if(t.githubActions&&e.nonInteractive&&!Xr(e.packageManager))return yield*new X({reason:`\`--github-actions\` does not support the detected package manager \`${e.packageManager}\`. Use bun, deno, npm, pnpm, or yarn.`});return t}),Hf=v.boolean("non-interactive").pipe(v.withDescription("Configure without prompts; requires at least one --script")),Lf=v.choice("script",En).pipe(v.atMost(En.length),v.withDescription("Package script to configure; repeatable and required in non-interactive mode. Monorepo scripts require a detected monorepo")),xf=v.choice("preset",hn).pipe(v.atMost(hn.length),v.withDescription("Oxlint preset to configure; repeatable and requires --script check or fix")),Jf=v.choice("editor",On).pipe(v.atMost(On.length),v.withDescription("Editor to configure; may be specified multiple times")),If=v.boolean("typescript").pipe(v.withDescription("Configure the TypeScript preset; requires --script check or fix")),df=v.boolean("install-extensions").pipe(v.withDescription("Install recommended extensions; requires at least one --editor")),Af=v.boolean("github-actions").pipe(v.withDescription("Configure CI; requires a compatible script and bun, deno, npm, pnpm, or yarn")),Gf=v.boolean("agents").pipe(v.withDescription("Add Adamantite guidance to AGENTS.md")),Mf=$.fn("collectInteractiveInitOptions")(function*(r){let e=yield*o,t=yield*e.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:!r,hint:r?void 0:"available for monorepo projects",label:"check:monorepo - check for monorepo-specific issues using Sherif",value:"check:monorepo"},{disabled:!r,hint:r?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"}]}),n=t.includes("check")||t.includes("fix"),f=[];if(n)f=yield*e.multiselect({message:"Which presets do you want to install? (core is always included)",options:[{label:"React",value:"react"},{label:"Next.js",value:"nextjs"},{label:"Vue",value:"vue"},{label:"Jest",value:"jest"},{label:"Vitest",value:"vitest"},{label:"Node",value:"node"}],required:!1});let u=n?yield*e.confirm({initialValue:!0,message:"Adamantite provides a TypeScript preset to enforce strict type-safety. Would you like to use it?"}):!1,l=yield*e.multiselect({message:"Which editors do you want to configure? (optional)",options:[{label:"VSCode / Cursor / Windsurf",value:"vscode"},{label:"Zed",value:"zed"}],required:!1}),a=l.length>0?yield*e.confirm({initialValue:!0,message:"Do you want to install the recommended editor extensions?"}):!1,y=Hr(t)?yield*e.confirm({message:"Do you want to add a GitHub Actions workflow to run checks in CI?"}):!1;return{agents:yield*e.confirm({initialValue:!0,message:"Add Adamantite guidance to AGENTS.md so coding agents know how to run project checks?"}),editors:l,githubActions:y,installExtensions:a,presets:f,scripts:t,typescript:u}}),jn=er.make("init",{agents:Gf,editors:Jf,githubActions:Af,installExtensions:df,nonInteractive:Hf,presets:xf,scripts:Lf,typescript:If}).pipe(er.withDescription("Initialize Adamantite in the current directory. Setup flags require --non-interactive; omitted boolean setup flags are disabled"),er.withExamples([{command:"adamantite init --non-interactive --script check",description:"Configure linting without prompts"},{command:"adamantite init --non-interactive --script check --script format --preset react --editor vscode --typescript --install-extensions --github-actions --agents",description:"Configure a React project with VS Code, TypeScript, CI, and agent guidance"},{command:"adamantite init --non-interactive --script check:monorepo",description:"Configure monorepo checks in a detected monorepo"}]),er.withHandler((r)=>$.gen(function*(){let e=Zf.cwd(),t=yield*o;yield*Rr(),yield*t.intro("\uD83D\uDCA0 adamantite init");let f=yield*(yield*Y).detectPackageManager(e);if(!f)return yield*new _r({});if(f.warnings?.length)for(let Yr of f.warnings)yield*t.log.warning(Yr);yield*t.log.info(`Detected package manager: ${f.name}`);let u=yield*Ge(e);if(u)yield*t.log.info("We've detected a monorepo setup in your project.");if(!r.nonInteractive&&Zr.some([r.scripts.length>0,r.presets.length>0,r.editors.length>0,r.typescript,r.installExtensions,r.githubActions,r.agents],$n.isTruthy))return yield*new X({reason:"Setup flags require `--non-interactive`."});let l=r.nonInteractive?r:yield*Mf(u),a=yield*Nf(l,{isMonorepo:u,nonInteractive:r.nonInteractive,packageManager:f.name}),y=a.scripts,O=a.presets,m=a.editors,h=a.typescript,i=a.installExtensions,I=a.githubActions,Or=a.agents,E=y.includes("check")||y.includes("fix"),d=y.includes("format"),Zn=y.includes("check:monorepo")||y.includes("fix:monorepo"),Ce=y.includes("analyze"),Tr=["adamantite"];if(E)Tr.push(`${j.name}@${j.version}`,`${C.name}@${C.version}`);if(d)Tr.push(`${K.name}@${K.version}`);if(Zn)Tr.push(`${_.name}@${_.version}`);if(Ce)Tr.push(`${Z.name}@${Z.version}`);if(yield*Kf(e,Tr),d)yield*Me(e,K,K.create(e));if(E)yield*Me(e,j,j.create(e,O));if(Ce)yield*Me(e,Z,Z.create(e));if(yield*Pf(e,y),Or)yield*Xf(e,f.name,y);if(h)yield*Ff(e);if(yield*Tf(e,m),i)yield*Yf(m,y);if(I){let Yr=f.name;if(Xr(Yr))yield*_f(e,Yr,y);else yield*t.log.warning(`Skipping GitHub Actions setup: \`${Yr}\` is not a supported package manager for CI workflow generation.`)}yield*t.log.success("Your project is now configured"),yield*t.outro("\uD83D\uDCA0 Adamantite initialized successfully!")}).pipe($.catchTags({OperationCancelled:()=>$.gen(function*(){yield*(yield*o).cancel("You've cancelled the initialization process.")})}))));import*as on from"effect/Effect";import*as Kr from"effect/unstable/cli/Command";import*as Se from"effect/unstable/cli/Flag";import*as Sn from"effect/unstable/process/ChildProcessSpawner";var gf=Se.boolean("fix").pipe(Se.withDescription("Automatically fix issues")),ge=Kr.make("monorepo",{fix:gf}).pipe(Kr.withDescription("Find and fix monorepo-specific issues using Sherif"),Kr.withHandler(({fix:r})=>on.gen(function*(){let e=yield*P,t=yield*s,n=r?["--fix",...e]:[...e],f=yield*t.run({args:n,command:_.name,stdin:"inherit"});if(f!==Sn.ExitCode(0))yield*new Q({command:_.name,exitCode:f})})));import*as vn from"effect/Effect";import*as Pr from"effect/unstable/cli/Command";import*as Dn from"effect/unstable/process/ChildProcessSpawner";var we=Pr.make("typecheck").pipe(Pr.withDescription("Deprecated alias for `check`"),Pr.withHandler(()=>vn.gen(function*(){let r=yield*P,e=yield*o,t=yield*s;yield*e.log.warning("Deprecated. Use `adamantite check` for typechecking.");let n=yield*t.run({args:[...r],command:j.name});if(n!==Dn.ExitCode(0))yield*new Q({command:j.name,exitCode:n})})));import wf from"node:process";import*as tr from"effect/Effect";import*as Fr from"effect/unstable/cli/Command";var Cf=[j,C,K,_,Z],pf=[j,C,K,_,Z];function cf(r,e){let t=[];for(let n of pf){if(e.has(n.name))continue;let f=r.devDependencies?.[n.name]??r.dependencies?.[n.name];if(f&&Ar(f)!==n.version)t.push({currentVersion:f,name:n.name,targetVersion:n.version})}return t}var zn=Fr.make("update").pipe(Fr.withDescription("Run applicable Adamantite migrations and update managed dependencies"),Fr.withHandler(()=>tr.gen(function*(){let r=wf.cwd(),e=yield*o,t=yield*Y,n={cwd:r};yield*Rr(),yield*e.intro("\uD83D\uDCA0 adamantite update");let f=()=>Ee(Cf,r),u=yield*f(),l=[];for(let E of Le.filter((d)=>d.tags.includes("update"))){let d=yield*E.check(n);l.push({migration:E,result:d})}let a=new Set([...u.flatMap(({assessment:E})=>E.warnings),...l.flatMap(({result:E})=>E.warnings)]);for(let E of a)yield*e.log.warning(E);let y=[];for(let{migration:E,result:d}of l){if(d.status!=="needed")continue;yield*e.log.info(d.summary),yield*te(E,n,{onRestore:e.log.warning(`Migration "${E.title}" failed, restoring files...`)}),y.push(E.id)}if(y.length>0)yield*e.log.success("Migrations ran successfully.");let O=yield*b(r),m=yield*f(),h=m.flatMap(({assessment:E})=>E.actions).filter((E)=>E.type==="create_config"||E.type==="update_config"||E.type==="manual_fix"),i=m.flatMap(({assessment:E})=>E.actions).filter((E)=>E.type==="install_package"||E.type==="update_package").map((E)=>E.type==="install_package"?{currentVersion:"not installed",name:E.package,targetVersion:E.targetVersion}:{currentVersion:E.currentVersion,name:E.package,targetVersion:E.targetVersion}),I=new Set(i.map((E)=>E.name)),Or=[...i,...cf(O,I)];if(Or.length>0){yield*e.log.info("The following dependencies will be updated:");for(let E of Or)yield*e.log.info(` ${E.name}: ${E.currentVersion} → ${E.targetVersion}`);yield*e.withSpinner(()=>t.addDevDependencies(Or.map((E)=>`${E.name}@${E.targetVersion}`),r,{silent:!0}),{failure:"Failed to update dependencies",start:"Updating dependencies...",success:"Dependencies updated successfully"}),yield*e.log.success("Dependencies updated successfully.")}if(h.length>0){yield*e.log.warning("Some configuration follow-up belongs to `adamantite doctor --fix`.");for(let E of h)yield*e.log.warning(`Doctor follow-up: ${E.description}`)}if(y.length===0&&Or.length===0&&h.length===0)return yield*e.log.success("No changes needed."),"no-changes";return"success"}).pipe(tr.tapError(()=>tr.gen(function*(){yield*(yield*o).outro("❌ Update failed")})),tr.tap((r)=>tr.gen(function*(){let e=yield*o;switch(r){case"no-changes":yield*e.outro("✅ Adamantite is already up to date.");break;case"success":yield*e.outro("✅ Update completed successfully!");break;default:break}})))));var kf=[_e,He,Je,Ie,ge,we],qn=[_e,He,Gt,Je,Ie,jn,ge,we,zn],ru=new Set(qn.map((r)=>r.name)),eu=new Set(kf.map((r)=>r.name)),tu=nr.make("adamantite").pipe(nr.withDescription("Opinionated preset package for modern TypeScript applications"),nr.withSubcommands(qn)),Bn=De.fn("runCli")(function*(r,e){let[t,n]=ve.splitWhere(r,(l)=>l==="--"),f=ve.drop(n,1),u=t.find((l)=>ru.has(l));if(f.length>0&&u!==void 0&&!eu.has(u))return yield*new Ve({command:u});yield*nr.runWith(tu,{version:e})(t).pipe(De.provideService(P,f))});var nu=U.gen(function*(){let e=yield*(yield*Vn.Stdio).args;yield*Bn(e,"0.34.4")}).pipe(U.as(0),U.catchTag("CommandFailed",(r)=>U.succeed(r.exitCode)),U.catch((r)=>U.service(o).pipe(U.flatMap((e)=>e.log.error(r.message)),U.as(Wn.ExitCode(1)))),U.provide(Un.mergeAll(bn.layer,o.layer,s.layer,Y.layer)));Rn.runMain(nu,{teardown:(r,e)=>{if(sn.isSuccess(r)){e(Number(r.value));return}Qn.defaultTeardown(r,e)}});
@@ -1,15 +1,6 @@
1
1
  // presets/analyze.ts
2
2
  var config = {
3
- ignore: ["**/*.d.ts"],
4
3
  ignoreExportsUsedInFile: true,
5
- ignoreFiles: [
6
- "**/dist/**",
7
- "**/build/**",
8
- "**/coverage/**",
9
- "**/.next/**",
10
- "**/.vercel/**",
11
- "**/.turbo/**"
12
- ],
13
4
  rules: {
14
5
  binaries: "error",
15
6
  catalog: "error",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adamantite",
3
- "version": "0.34.3",
3
+ "version": "0.34.4",
4
4
  "description": "An strict and opinionated set of presets for modern TypeScript applications",
5
5
  "keywords": [
6
6
  "adamantite",
@@ -1,16 +1,7 @@
1
1
  import type { KnipConfiguration } from "knip"
2
2
 
3
3
  const config: KnipConfiguration = {
4
- ignore: ["**/*.d.ts"],
5
4
  ignoreExportsUsedInFile: true,
6
- ignoreFiles: [
7
- "**/dist/**",
8
- "**/build/**",
9
- "**/coverage/**",
10
- "**/.next/**",
11
- "**/.vercel/**",
12
- "**/.turbo/**",
13
- ],
14
5
  rules: {
15
6
  binaries: "error",
16
7
  catalog: "error",