adamantite 0.33.1 → 0.33.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -119,4 +119,4 @@ ${Mr[t]}
119
119
  `:`
120
120
 
121
121
  `;return yield*r.writeFileString(o,`${f}${p}${a}`).pipe(ht.mapError((l)=>new O({cause:l,path:o}))),"updated"});import yo from"node:process";import*as rr from"effect/Effect";import*as or from"effect/FileSystem";import*as ir from"effect/Path";var Ze=(t=yo.cwd())=>rr.gen(function*(){let e=yield*or.FileSystem,r=yield*ir.Path;if(yield*e.exists(r.join(t,"pnpm-workspace.yaml")))return!0;return(yield*F(t)).workspaces!==void 0});var ho=(t,e)=>g.gen(function*(){let r=yield*Y,o=(yield*E).spinner();o.start("Installing dependencies...");let i=yield*Ze(t);yield*r.addDevDependencies(e,t,{silent:!0,workspace:i}).pipe(g.tapError(()=>g.sync(()=>{o.stop("Failed to install dependencies.")}))),o.stop("Dependencies installed.")});function xe(t,e){return g.gen(function*(){yield*(yield*E).log.info(`Legacy \`${e}\` was preserved during \`adamantite init\`. \`adamantite init\` does not migrate legacy ${t} configs yet.`)})}var Eo=(t,e)=>g.gen(function*(){let r=yield*E,n=r.spinner();n.start("Setting up oxlint config...");let o=yield*y.exists(t),i=y.files[1].path;if(o.active?.format==="ts"&&o.legacy.length>0)yield*r.log.warning(`Found both \`${y.config}\` and \`${i}\`. Adamantite will use \`${y.config}\`.`);if(o.active?.format==="json")n.message(`Found \`${i}\`, keeping existing config.`),n.stop("oxlint config is ready."),yield*xe("oxlint",i);else if(o.active?.format==="ts")n.message(`Found \`${y.config}\`, keeping existing config.`),n.stop("oxlint config is ready.");else n.message(`\`${y.config}\` not found, creating...`),yield*y.create(t,e),n.stop("oxlint config created successfully.")}),go=(t)=>g.gen(function*(){let e=yield*E,r=e.spinner();r.start("Setting up oxfmt config...");let n=yield*m.exists(t);if(n.active?.format==="ts"&&n.legacy.length>0)yield*e.log.warning(`Found both \`${m.config}\` and \`.oxfmtrc.json(c)\`. Adamantite will use \`${m.config}\`.`);if(n.active&&n.active.format!=="ts"&&n.legacy.length>0)yield*e.log.warning("Found both `.oxfmtrc.json` and `.oxfmtrc.jsonc`. Multiple legacy oxfmt configs exist; Adamantite will treat `.oxfmtrc.jsonc` as the source of truth when migration is needed.");if(n.active?.format==="json"||n.active?.format==="jsonc"){let o=n.active.path.endsWith(m.files[1].path)?m.files[1].path:m.files[2].path;r.message(`Found \`${o}\`, keeping existing config.`),r.stop("oxfmt config is ready."),yield*xe("oxfmt",o)}else if(n.active?.format==="ts")r.message(`Found \`${m.config}\`, keeping existing config.`),r.stop("oxfmt config is ready.");else r.message(`\`${m.config}\` not found, creating...`),yield*m.create(t),r.stop("oxfmt config created successfully.")}),Oo=(t,e)=>g.gen(function*(){let r=yield*fr.FileSystem,n=yield*ar.Path,o=yield*E,i=yield*F(t),f=o.spinner();f.start("Adding scripts to your `package.json`..."),i.scripts??={};for(let c of e)switch(c){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 Ve({script:c})}let s=n.join(t,"package.json");yield*r.writeFileString(s,`${JSON.stringify(i,null,2)}
122
- `).pipe(g.mapError((c)=>new O({cause:c,path:s}))),f.stop("Scripts added to your `package.json`")}),jo=(t)=>g.gen(function*(){let e=yield*E,r=e.spinner();r.start("Setting up knip config...");let n=yield*d.exists(t);if(n.active?.format==="ts"&&n.legacy.length>0)yield*e.log.warning(`Found both \`${d.config}\` and \`knip.json(c)\`. Adamantite will use \`${d.config}\`.`);if(n.active&&n.active.format!=="ts"&&n.legacy.length>0)yield*e.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(d.files[1].path)?d.files[1].path:d.files[2].path;r.message(`Found \`${o}\`, keeping existing config.`),r.stop("knip config is ready."),yield*xe("knip",o)}else if(n.active?.format==="ts")r.message(`Found \`${d.config}\`, keeping existing config.`),r.stop("knip config is ready.");else r.message(`\`${d.config}\` not found, creating...`),yield*d.create(t),r.stop("knip config created successfully.")}),So=(t)=>g.gen(function*(){let r=(yield*E).spinner();if(r.start("Setting up TypeScript config..."),yield*z.exists(t))r.message(`\`${z.config}\` found, updating...`),yield*z.update(t),r.stop(`\`${z.config}\` updated successfully`);else r.message(`\`${z.config}\` not found, creating...`),yield*z.create(t),r.stop(`\`${z.config}\` created successfully`)}),$o=(t,e)=>g.gen(function*(){let r=yield*E;if(e.includes("vscode")){let n=r.spinner();if(n.start(`Checking for \`${et.config}\`...`),yield*et.exists(t))n.message(`\`${et.config}\` found, updating...`),yield*et.update(t),n.stop(`\`${et.config}\` updated with Adamantite preset.`);else n.message(`\`${et.config}\` not found, creating...`),yield*et.create(t),n.stop(`\`${et.config}\` created with Adamantite preset.`)}if(e.includes("zed")){let n=r.spinner();if(n.start(`Checking for \`${at.config}\`...`),yield*at.exists(t))n.message(`\`${at.config}\` found, updating...`),yield*at.update(t),n.stop(`\`${at.config}\` updated with Adamantite preset.`);else n.message(`\`${at.config}\` not found, creating...`),yield*at.create(t),n.stop(`\`${at.config}\` created with Adamantite preset.`)}}),Fo=(t,e)=>g.gen(function*(){let r=yield*E,n=r.spinner();n.start("Installing editor extensions...");let o=t.includes("zed"),i=t.includes("vscode");if(yield*g.gen(function*(){if(t.includes("vscode"))n.message("Installing VS Code extension..."),yield*et.extension(e);return!0}).pipe(g.tapError(()=>g.sync(()=>{n.stop()})),g.catchTag("FailedToInstallExtension",(s)=>g.gen(function*(){return yield*r.log.warning(`⚠️ Failed to install the \`${s.extension}\` extension.`),yield*r.log.warning("Please install it manually after setup completes."),!1})),g.catchTag("VscodeCliNotFound",()=>g.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")}),vo=(t,e,r)=>g.gen(function*(){let o=(yield*E).spinner();o.start("Setting up GitHub Actions workflow...");let i=yield*it.exists(t),f=it.files[0].path;if(i)o.message(`\`${f}\` found, updating...`),yield*it.update(t,{packageManager:e,scripts:r}),o.stop("GitHub Actions workflow updated successfully.");else o.message(`Creating \`${f}\`...`),yield*it.create(t,{packageManager:e,scripts:r}),o.stop("GitHub Actions workflow created successfully.")}).pipe(g.option),Ro=(t,e,r)=>g.gen(function*(){let n=yield*E,o=n.spinner();o.start("Updating AGENTS.md...");let i=yield*nr(t,{packageManager:e,scripts:r}).pipe(g.catchTag(["FailedToReadFile","FailedToWriteFile"],(f)=>g.gen(function*(){return o.stop("Failed to update AGENTS.md."),yield*n.log.warning(`Could not update AGENTS.md. ${f.message} Adamantite will continue initialization.`),"failed"})));if(i==="failed")return;if(o.stop("AGENTS.md check complete."),i==="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.")}),lr=zt.make("init").pipe(zt.withDescription("Initialize Adamantite in the current directory"),zt.withHandler(()=>g.gen(function*(){let t=mo.cwd(),e=yield*E;yield*Vt(),yield*e.intro("\uD83D\uDCA0 adamantite init");let n=yield*(yield*Y).detectPackageManager(t);if(!n)return yield*new bt({});if(n.warnings?.length)for(let j of n.warnings)yield*e.log.warning(j);yield*e.log.info(`Detected package manager: ${n.name}`);let o=yield*Ze(t);if(o)yield*e.log.info("We've detected a monorepo setup in your project.");let i=yield*e.multiselect({message:"Which scripts do you want to add to your `package.json`?",options:[{hint:"recommended",label:"check - find issues 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"}]}),f=i.includes("check")||i.includes("fix"),s=[];if(f)s=yield*e.multiselect({message:"Which presets do you want to install? (core is always included)",options:[{label:"React",value:"react"},{label:"Next.js",value:"nextjs"},{label:"Vue",value:"vue"},{label:"Jest",value:"jest"},{label:"Vitest",value:"vitest"},{label:"Node",value:"node"}],required:!1});let c=!1;if(f)c=yield*e.confirm({initialValue:!0,message:"Adamantite provides a TypeScript preset to enforce strict type-safety. Would you like to use it?"});let a=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}),p=!1;if(a.length>0)p=yield*e.confirm({initialValue:!0,message:"Do you want to install the recommended editor extensions?"});let l=ae(i),h=!1;if(l)h=yield*e.confirm({message:"Do you want to add a GitHub Actions workflow to run checks in CI?"});let $=yield*e.confirm({initialValue:!0,message:"Add Adamantite guidance to AGENTS.md so coding agents know how to run project checks?"}),R=i.includes("format"),_=i.includes("check:monorepo")||i.includes("fix:monorepo"),nt=i.includes("analyze"),u=["adamantite"];if(f)u.push(`${y.name}@${y.version}`,`${lt.name}@${lt.version}`);if(R)u.push(`${m.name}@${m.version}`);if(_)u.push(`${M.name}@${M.version}`);if(nt)u.push(`${d.name}@${d.version}`);if(yield*ho(t,u),R)yield*go(t);if(f)yield*Eo(t,s);if(nt)yield*jo(t);if(yield*Oo(t,i),$)yield*Ro(t,n.name,i);if(c)yield*So(t);if(yield*$o(t,a),p)yield*Fo(a,i);if(h){let j=n.name;if(At(j))yield*vo(t,j,i);else yield*e.log.warning(`Skipping GitHub Actions setup: \`${j}\` is not a supported package manager for CI workflow generation.`)}yield*e.log.success("Your project is now configured"),yield*e.outro("\uD83D\uDCA0 Adamantite initialized successfully!")}).pipe(g.catchTags({OperationCancelled:()=>g.gen(function*(){yield*(yield*E).cancel("You've cancelled the initialization process.")})}))));import*as sr from"effect/Effect";import*as kt from"effect/unstable/cli/Command";import*as je from"effect/unstable/cli/Flag";import*as pr from"effect/unstable/process/ChildProcessSpawner";var Do=je.boolean("fix").pipe(je.withDescription("Automatically fix issues")),ur=kt.make("monorepo",{fix:Do}).pipe(kt.withDescription("Find and fix monorepo-specific issues using Sherif"),kt.withHandler(({fix:t})=>sr.gen(function*(){let e=yield*I,r=t?["--fix"]:[],n=yield*e.run({args:r,command:M.name,stdin:"inherit"});if(n!==pr.ExitCode(0))yield*new T({command:M.name,exitCode:n})})));import*as cr from"effect/Effect";import*as Ut from"effect/unstable/cli/Command";import*as yr from"effect/unstable/process/ChildProcessSpawner";var dr=Ut.make("typecheck").pipe(Ut.withDescription("Deprecated alias for `check`"),Ut.withHandler(()=>cr.gen(function*(){let t=yield*E,e=yield*I;yield*t.log.warning("Deprecated. Use `adamantite check` for typechecking.");let r=yield*e.run({args:[],command:y.name});if(r!==yr.ExitCode(0))yield*new T({command:y.name,exitCode:r})})));import Vo from"node:process";import*as w from"effect/Effect";import*as Jt from"effect/unstable/cli/Command";var Po=[y,lt,m,M,d],No=[y,lt,m,M,d];function _o(t){return t.applicable&&Array.isArray(t.actions)}function Io(t,e){let r=[];for(let n of No){if(e.has(n.name))continue;let o=t.devDependencies?.[n.name]??t.dependencies?.[n.name];if(o&&x(o)!==n.version)r.push({currentVersion:o,name:n.name,targetVersion:n.version})}return r}var mr=Jt.make("update").pipe(Jt.withDescription("Run applicable Adamantite migrations and update managed dependencies"),Jt.withHandler(()=>w.gen(function*(){let t=Vo.cwd(),e=yield*E,r=yield*Y,n={cwd:t};yield*Vt(),yield*e.intro("\uD83D\uDCA0 adamantite update");let o=()=>w.gen(function*(){let u=[];for(let j of Po){let Ht=yield*j.assess(t);if(_o(Ht))u.push({assessment:Ht,integration:j})}return u}),i=yield*o();for(let{assessment:u}of i)for(let j of u.warnings)yield*e.log.warning(j);let f=new Set(i.map(({integration:u})=>u.name)),s=i.flatMap(({assessment:u})=>u.actions),c=new Set(s.filter((u)=>u.type==="run_migration").map((u)=>u.migrationId)),a=[];for(let u of ye.filter((j)=>j.tags.includes("update"))){let j=Un[u.id];if(f.has(j))continue;let Ht=yield*u.check(n);a.push({migration:u,result:Ht})}for(let u of a){for(let j of u.result.warnings)yield*e.log.warning(j);if(u.result.applicable&&u.result.summary)yield*e.log.info(u.result.summary)}let p=[];for(let u of ye){if(!c.has(u.id))continue;yield*Zt(u,n,{onRestore:e.log.warning(`Migration "${u.title}" failed, restoring files...`)}),p.push(u.id)}for(let{migration:u,result:j}of a){if(!j.applicable||!j.summary)continue;yield*Zt(u,n,{onRestore:e.log.warning(`Migration "${u.title}" failed, restoring files...`)}),p.push(u.id)}if(p.length>0)yield*e.log.success("Migrations ran successfully.");let l=yield*F(t),h=yield*o(),$=h.flatMap(({assessment:u})=>u.actions).filter((u)=>u.type==="create_config"||u.type==="update_config"||u.type==="manual_fix"),R=h.flatMap(({assessment:u})=>u.actions).filter((u)=>u.type==="install_package"||u.type==="update_package").map((u)=>u.type==="install_package"?{currentVersion:"not installed",name:u.package,targetVersion:u.targetVersion}:{currentVersion:u.currentVersion,name:u.package,targetVersion:u.targetVersion}),_=new Set(R.map((u)=>u.name)),nt=[...R,...Io(l,_)];if(nt.length>0){yield*e.log.info("The following dependencies will be updated:");for(let j of nt)yield*e.log.info(` ${j.name}: ${j.currentVersion} → ${j.targetVersion}`);let u=e.spinner();u.start("Updating dependencies..."),yield*r.addDevDependencies(nt.map((j)=>`${j.name}@${j.targetVersion}`),t,{silent:!0}).pipe(w.tapError(()=>w.sync(()=>{u.stop("Failed to update dependencies")}))),u.stop("Dependencies updated successfully"),yield*e.log.success("Dependencies updated successfully.")}if($.length>0){yield*e.log.warning("Some configuration follow-up belongs to `adamantite doctor --fix`.");for(let u of $)yield*e.log.warning(`Doctor follow-up: ${u.description}`)}if(p.length===0&&nt.length===0&&$.length===0)return yield*e.log.success("No changes needed."),"no-changes";return"success"}).pipe(w.tapError(()=>w.gen(function*(){yield*(yield*E).outro("❌ Update failed")})),w.tap((t)=>w.gen(function*(){let e=yield*E;switch(t){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 To=ct.make("adamantite").pipe(ct.withDescription("Opinionated preset package for modern TypeScript applications"),ct.withSubcommands([Le,ln,xn,wn,Kn,lr,ur,dr,mr]));var qo=ct.run(To,{version:"0.33.1"}).pipe(U.as(0),U.catchTag("CommandFailed",(t)=>U.succeed(t.exitCode)),U.catch((t)=>U.service(E).pipe(U.flatMap((e)=>e.log.error(t.message)),U.as(Sr.ExitCode(1)))),U.provide(Or.mergeAll(Er.layer,E.layer,I.layer,Y.layer)));hr.runMain(qo,{teardown:(t,e)=>{if(gr.isSuccess(t)){e(Number(t.value));return}jr.defaultTeardown(t,e)}});
122
+ `).pipe(g.mapError((c)=>new O({cause:c,path:s}))),f.stop("Scripts added to your `package.json`")}),jo=(t)=>g.gen(function*(){let e=yield*E,r=e.spinner();r.start("Setting up knip config...");let n=yield*d.exists(t);if(n.active?.format==="ts"&&n.legacy.length>0)yield*e.log.warning(`Found both \`${d.config}\` and \`knip.json(c)\`. Adamantite will use \`${d.config}\`.`);if(n.active&&n.active.format!=="ts"&&n.legacy.length>0)yield*e.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(d.files[1].path)?d.files[1].path:d.files[2].path;r.message(`Found \`${o}\`, keeping existing config.`),r.stop("knip config is ready."),yield*xe("knip",o)}else if(n.active?.format==="ts")r.message(`Found \`${d.config}\`, keeping existing config.`),r.stop("knip config is ready.");else r.message(`\`${d.config}\` not found, creating...`),yield*d.create(t),r.stop("knip config created successfully.")}),So=(t)=>g.gen(function*(){let r=(yield*E).spinner();if(r.start("Setting up TypeScript config..."),yield*z.exists(t))r.message(`\`${z.config}\` found, updating...`),yield*z.update(t),r.stop(`\`${z.config}\` updated successfully`);else r.message(`\`${z.config}\` not found, creating...`),yield*z.create(t),r.stop(`\`${z.config}\` created successfully`)}),$o=(t,e)=>g.gen(function*(){let r=yield*E;if(e.includes("vscode")){let n=r.spinner();if(n.start(`Checking for \`${et.config}\`...`),yield*et.exists(t))n.message(`\`${et.config}\` found, updating...`),yield*et.update(t),n.stop(`\`${et.config}\` updated with Adamantite preset.`);else n.message(`\`${et.config}\` not found, creating...`),yield*et.create(t),n.stop(`\`${et.config}\` created with Adamantite preset.`)}if(e.includes("zed")){let n=r.spinner();if(n.start(`Checking for \`${at.config}\`...`),yield*at.exists(t))n.message(`\`${at.config}\` found, updating...`),yield*at.update(t),n.stop(`\`${at.config}\` updated with Adamantite preset.`);else n.message(`\`${at.config}\` not found, creating...`),yield*at.create(t),n.stop(`\`${at.config}\` created with Adamantite preset.`)}}),Fo=(t,e)=>g.gen(function*(){let r=yield*E,n=r.spinner();n.start("Installing editor extensions...");let o=t.includes("zed"),i=t.includes("vscode");if(yield*g.gen(function*(){if(t.includes("vscode"))n.message("Installing VS Code extension..."),yield*et.extension(e);return!0}).pipe(g.tapError(()=>g.sync(()=>{n.stop()})),g.catchTag("FailedToInstallExtension",(s)=>g.gen(function*(){return yield*r.log.warning(`⚠️ Failed to install the \`${s.extension}\` extension.`),yield*r.log.warning("Please install it manually after setup completes."),!1})),g.catchTag("VscodeCliNotFound",()=>g.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")}),vo=(t,e,r)=>g.gen(function*(){let o=(yield*E).spinner();o.start("Setting up GitHub Actions workflow...");let i=yield*it.exists(t),f=it.files[0].path;if(i)o.message(`\`${f}\` found, updating...`),yield*it.update(t,{packageManager:e,scripts:r}),o.stop("GitHub Actions workflow updated successfully.");else o.message(`Creating \`${f}\`...`),yield*it.create(t,{packageManager:e,scripts:r}),o.stop("GitHub Actions workflow created successfully.")}).pipe(g.option),Ro=(t,e,r)=>g.gen(function*(){let n=yield*E,o=n.spinner();o.start("Updating AGENTS.md...");let i=yield*nr(t,{packageManager:e,scripts:r}).pipe(g.catchTag(["FailedToReadFile","FailedToWriteFile"],(f)=>g.gen(function*(){return o.stop("Failed to update AGENTS.md."),yield*n.log.warning(`Could not update AGENTS.md. ${f.message} Adamantite will continue initialization.`),"failed"})));if(i==="failed")return;if(o.stop("AGENTS.md check complete."),i==="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.")}),lr=zt.make("init").pipe(zt.withDescription("Initialize Adamantite in the current directory"),zt.withHandler(()=>g.gen(function*(){let t=mo.cwd(),e=yield*E;yield*Vt(),yield*e.intro("\uD83D\uDCA0 adamantite init");let n=yield*(yield*Y).detectPackageManager(t);if(!n)return yield*new bt({});if(n.warnings?.length)for(let j of n.warnings)yield*e.log.warning(j);yield*e.log.info(`Detected package manager: ${n.name}`);let o=yield*Ze(t);if(o)yield*e.log.info("We've detected a monorepo setup in your project.");let i=yield*e.multiselect({message:"Which scripts do you want to add to your `package.json`?",options:[{hint:"recommended",label:"check - find issues 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"}]}),f=i.includes("check")||i.includes("fix"),s=[];if(f)s=yield*e.multiselect({message:"Which presets do you want to install? (core is always included)",options:[{label:"React",value:"react"},{label:"Next.js",value:"nextjs"},{label:"Vue",value:"vue"},{label:"Jest",value:"jest"},{label:"Vitest",value:"vitest"},{label:"Node",value:"node"}],required:!1});let c=!1;if(f)c=yield*e.confirm({initialValue:!0,message:"Adamantite provides a TypeScript preset to enforce strict type-safety. Would you like to use it?"});let a=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}),p=!1;if(a.length>0)p=yield*e.confirm({initialValue:!0,message:"Do you want to install the recommended editor extensions?"});let l=ae(i),h=!1;if(l)h=yield*e.confirm({message:"Do you want to add a GitHub Actions workflow to run checks in CI?"});let $=yield*e.confirm({initialValue:!0,message:"Add Adamantite guidance to AGENTS.md so coding agents know how to run project checks?"}),R=i.includes("format"),_=i.includes("check:monorepo")||i.includes("fix:monorepo"),nt=i.includes("analyze"),u=["adamantite"];if(f)u.push(`${y.name}@${y.version}`,`${lt.name}@${lt.version}`);if(R)u.push(`${m.name}@${m.version}`);if(_)u.push(`${M.name}@${M.version}`);if(nt)u.push(`${d.name}@${d.version}`);if(yield*ho(t,u),R)yield*go(t);if(f)yield*Eo(t,s);if(nt)yield*jo(t);if(yield*Oo(t,i),$)yield*Ro(t,n.name,i);if(c)yield*So(t);if(yield*$o(t,a),p)yield*Fo(a,i);if(h){let j=n.name;if(At(j))yield*vo(t,j,i);else yield*e.log.warning(`Skipping GitHub Actions setup: \`${j}\` is not a supported package manager for CI workflow generation.`)}yield*e.log.success("Your project is now configured"),yield*e.outro("\uD83D\uDCA0 Adamantite initialized successfully!")}).pipe(g.catchTags({OperationCancelled:()=>g.gen(function*(){yield*(yield*E).cancel("You've cancelled the initialization process.")})}))));import*as sr from"effect/Effect";import*as kt from"effect/unstable/cli/Command";import*as je from"effect/unstable/cli/Flag";import*as pr from"effect/unstable/process/ChildProcessSpawner";var Do=je.boolean("fix").pipe(je.withDescription("Automatically fix issues")),ur=kt.make("monorepo",{fix:Do}).pipe(kt.withDescription("Find and fix monorepo-specific issues using Sherif"),kt.withHandler(({fix:t})=>sr.gen(function*(){let e=yield*I,r=t?["--fix"]:[],n=yield*e.run({args:r,command:M.name,stdin:"inherit"});if(n!==pr.ExitCode(0))yield*new T({command:M.name,exitCode:n})})));import*as cr from"effect/Effect";import*as Ut from"effect/unstable/cli/Command";import*as yr from"effect/unstable/process/ChildProcessSpawner";var dr=Ut.make("typecheck").pipe(Ut.withDescription("Deprecated alias for `check`"),Ut.withHandler(()=>cr.gen(function*(){let t=yield*E,e=yield*I;yield*t.log.warning("Deprecated. Use `adamantite check` for typechecking.");let r=yield*e.run({args:[],command:y.name});if(r!==yr.ExitCode(0))yield*new T({command:y.name,exitCode:r})})));import Vo from"node:process";import*as w from"effect/Effect";import*as Jt from"effect/unstable/cli/Command";var Po=[y,lt,m,M,d],No=[y,lt,m,M,d];function _o(t){return t.applicable&&Array.isArray(t.actions)}function Io(t,e){let r=[];for(let n of No){if(e.has(n.name))continue;let o=t.devDependencies?.[n.name]??t.dependencies?.[n.name];if(o&&x(o)!==n.version)r.push({currentVersion:o,name:n.name,targetVersion:n.version})}return r}var mr=Jt.make("update").pipe(Jt.withDescription("Run applicable Adamantite migrations and update managed dependencies"),Jt.withHandler(()=>w.gen(function*(){let t=Vo.cwd(),e=yield*E,r=yield*Y,n={cwd:t};yield*Vt(),yield*e.intro("\uD83D\uDCA0 adamantite update");let o=()=>w.gen(function*(){let u=[];for(let j of Po){let Ht=yield*j.assess(t);if(_o(Ht))u.push({assessment:Ht,integration:j})}return u}),i=yield*o();for(let{assessment:u}of i)for(let j of u.warnings)yield*e.log.warning(j);let f=new Set(i.map(({integration:u})=>u.name)),s=i.flatMap(({assessment:u})=>u.actions),c=new Set(s.filter((u)=>u.type==="run_migration").map((u)=>u.migrationId)),a=[];for(let u of ye.filter((j)=>j.tags.includes("update"))){let j=Un[u.id];if(f.has(j))continue;let Ht=yield*u.check(n);a.push({migration:u,result:Ht})}for(let u of a){for(let j of u.result.warnings)yield*e.log.warning(j);if(u.result.applicable&&u.result.summary)yield*e.log.info(u.result.summary)}let p=[];for(let u of ye){if(!c.has(u.id))continue;yield*Zt(u,n,{onRestore:e.log.warning(`Migration "${u.title}" failed, restoring files...`)}),p.push(u.id)}for(let{migration:u,result:j}of a){if(!j.applicable||!j.summary)continue;yield*Zt(u,n,{onRestore:e.log.warning(`Migration "${u.title}" failed, restoring files...`)}),p.push(u.id)}if(p.length>0)yield*e.log.success("Migrations ran successfully.");let l=yield*F(t),h=yield*o(),$=h.flatMap(({assessment:u})=>u.actions).filter((u)=>u.type==="create_config"||u.type==="update_config"||u.type==="manual_fix"),R=h.flatMap(({assessment:u})=>u.actions).filter((u)=>u.type==="install_package"||u.type==="update_package").map((u)=>u.type==="install_package"?{currentVersion:"not installed",name:u.package,targetVersion:u.targetVersion}:{currentVersion:u.currentVersion,name:u.package,targetVersion:u.targetVersion}),_=new Set(R.map((u)=>u.name)),nt=[...R,...Io(l,_)];if(nt.length>0){yield*e.log.info("The following dependencies will be updated:");for(let j of nt)yield*e.log.info(` ${j.name}: ${j.currentVersion} → ${j.targetVersion}`);let u=e.spinner();u.start("Updating dependencies..."),yield*r.addDevDependencies(nt.map((j)=>`${j.name}@${j.targetVersion}`),t,{silent:!0}).pipe(w.tapError(()=>w.sync(()=>{u.stop("Failed to update dependencies")}))),u.stop("Dependencies updated successfully"),yield*e.log.success("Dependencies updated successfully.")}if($.length>0){yield*e.log.warning("Some configuration follow-up belongs to `adamantite doctor --fix`.");for(let u of $)yield*e.log.warning(`Doctor follow-up: ${u.description}`)}if(p.length===0&&nt.length===0&&$.length===0)return yield*e.log.success("No changes needed."),"no-changes";return"success"}).pipe(w.tapError(()=>w.gen(function*(){yield*(yield*E).outro("❌ Update failed")})),w.tap((t)=>w.gen(function*(){let e=yield*E;switch(t){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 To=ct.make("adamantite").pipe(ct.withDescription("Opinionated preset package for modern TypeScript applications"),ct.withSubcommands([Le,ln,xn,wn,Kn,lr,ur,dr,mr]));var qo=ct.run(To,{version:"0.33.2"}).pipe(U.as(0),U.catchTag("CommandFailed",(t)=>U.succeed(t.exitCode)),U.catch((t)=>U.service(E).pipe(U.flatMap((e)=>e.log.error(t.message)),U.as(Sr.ExitCode(1)))),U.provide(Or.mergeAll(Er.layer,E.layer,I.layer,Y.layer)));hr.runMain(qo,{teardown:(t,e)=>{if(gr.isSuccess(t)){e(Number(t.value));return}jr.defaultTeardown(t,e)}});
@@ -37,7 +37,6 @@ var config = {
37
37
  "jsx-a11y/role-supports-aria-props": "error",
38
38
  "jsx-a11y/scope": "error",
39
39
  "jsx-a11y/tabindex-no-positive": "error",
40
- "react-perf/jsx-no-jsx-as-prop": "error",
41
40
  "react/button-has-type": "error",
42
41
  "react/checked-requires-onchange-or-readonly": "error",
43
42
  "react/display-name": "off",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adamantite",
3
- "version": "0.33.1",
3
+ "version": "0.33.2",
4
4
  "description": "An strict and opinionated set of presets for modern TypeScript applications",
5
5
  "keywords": [
6
6
  "adamantite",
@@ -38,7 +38,6 @@ const config: OxlintConfig = {
38
38
  "jsx-a11y/role-supports-aria-props": "error",
39
39
  "jsx-a11y/scope": "error",
40
40
  "jsx-a11y/tabindex-no-positive": "error",
41
- "react-perf/jsx-no-jsx-as-prop": "error",
42
41
  "react/button-has-type": "error",
43
42
  "react/checked-requires-onchange-or-readonly": "error",
44
43
  "react/display-name": "off",