adamantite 0.32.1 → 0.32.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
@@ -109,4 +109,4 @@ ${Zr[e]}
109
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
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
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.1",_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)}});
112
+ `).pipe(j.mapError((y)=>new O({cause:y,path:u}))),a.stop("Scripts added to your `package.json`")}),yo=(e)=>j.gen(function*(){let t=yield*g,r=t.spinner();r.start("Setting up knip config...");let n=yield*m.exists(e);if(n.active?.format==="ts"&&n.legacy.length>0)yield*t.log.warning(`Found both \`${m.config}\` and \`knip.json(c)\`. Adamantite will use \`${m.config}\`.`);if(n.active&&n.active.format!=="ts"&&n.legacy.length>0)yield*t.log.warning("Found both `knip.json` and `knip.jsonc`. Multiple legacy knip configs exist; Adamantite will treat `knip.jsonc` as the source of truth when migration is needed.");if(n.active?.format==="json"||n.active?.format==="jsonc"){let o=n.active.path.endsWith(m.files[1].path)?m.files[1].path:m.files[2].path;r.message(`Found \`${o}\`, keeping existing config.`),r.stop("knip config is ready."),yield*Qt("knip",o)}else if(n.active?.format==="ts")r.message(`Found \`${m.config}\`, keeping existing config.`),r.stop("knip config is ready.");else r.message(`\`${m.config}\` not found, creating...`),yield*m.create(e),r.stop("knip config created successfully.")}),mo=(e)=>j.gen(function*(){let r=(yield*g).spinner();if(r.start("Setting up TypeScript config..."),yield*V.exists(e))r.message(`\`${V.config}\` found, updating...`),yield*V.update(e),r.stop(`\`${V.config}\` updated successfully`);else r.message(`\`${V.config}\` not found, creating...`),yield*V.create(e),r.stop(`\`${V.config}\` created successfully`)}),ho=(e,t)=>j.gen(function*(){let r=yield*g;if(t.includes("vscode")){let n=r.spinner();if(n.start(`Checking for \`${ne.config}\`...`),yield*ne.exists(e))n.message(`\`${ne.config}\` found, updating...`),yield*ne.update(e),n.stop(`\`${ne.config}\` updated with Adamantite preset.`);else n.message(`\`${ne.config}\` not found, creating...`),yield*ne.create(e),n.stop(`\`${ne.config}\` created with Adamantite preset.`)}if(t.includes("zed")){let n=r.spinner();if(n.start(`Checking for \`${fe.config}\`...`),yield*fe.exists(e))n.message(`\`${fe.config}\` found, updating...`),yield*fe.update(e),n.stop(`\`${fe.config}\` updated with Adamantite preset.`);else n.message(`\`${fe.config}\` not found, creating...`),yield*fe.create(e),n.stop(`\`${fe.config}\` created with Adamantite preset.`)}}),go=(e,t)=>j.gen(function*(){let r=yield*g,n=r.spinner();n.start("Installing editor extensions...");let o=e.includes("zed"),i=e.includes("vscode");if(yield*j.gen(function*(){if(e.includes("vscode"))n.message("Installing VS Code extension..."),yield*ne.extension(t);return!0}).pipe(j.tapError(()=>j.sync(()=>{n.stop()})),j.catchTag("FailedToInstallExtension",(u)=>j.gen(function*(){return yield*r.log.warning(`⚠️ Failed to install the \`${u.extension}\` extension.`),yield*r.log.warning("Please install it manually after setup completes."),!1})),j.catchTag("VscodeCliNotFound",()=>j.gen(function*(){return yield*r.log.error("VSCode CLI ('code' command) not found."),yield*r.log.info("To install it:"),yield*r.log.info(" 1. Open VS Code"),yield*r.log.info(" 2. Press Cmd+Shift+P (macOS) or Ctrl+Shift+P (Windows/Linux)"),yield*r.log.info(` 3. Run 'Shell Command: Install "code" command in PATH'`),!1}))))if(o&&!i)n.stop("Zed extensions require manual install.");else n.stop("Editor extensions installed successfully.");if(o)yield*r.log.info("Install the Zed `oxc` extension: zed://extension/oxc")}),Eo=(e,t,r)=>j.gen(function*(){let o=(yield*g).spinner();o.start("Setting up GitHub Actions workflow...");let i=yield*ie.exists(e),a=ie.files[0].path;if(i)o.message(`\`${a}\` found, updating...`),yield*ie.update(e,{packageManager:t,scripts:r}),o.stop("GitHub Actions workflow updated successfully.");else o.message(`Creating \`${a}\`...`),yield*ie.create(e,{packageManager:t,scripts:r}),o.stop("GitHub Actions workflow created successfully.")}).pipe(j.option),ar=Ue.make("init").pipe(Ue.withDescription("Initialize Adamantite in the current directory"),Ue.withHandler(()=>j.gen(function*(){let e=so.cwd(),t=yield*g;yield*Re(),yield*t.intro("\uD83D\uDCA0 adamantite init");let n=yield*(yield*Z).detectPackageManager(e);if(!n)return yield*new xe({});if(n.warnings?.length)for(let p of n.warnings)yield*t.log.warning(p);yield*t.log.info(`Detected package manager: ${n.name}`);let o=yield*Bt(e);if(o)yield*t.log.info("We've detected a monorepo setup in your project.");let i=yield*t.multiselect({message:"Which scripts do you want to add to your `package.json`?",options:[{hint:"recommended",label:"check - find issues and type errors using oxlint",value:"check"},{hint:"recommended",label:"fix - fix code issues using oxlint",value:"fix"},{hint:"recommended",label:"format - code formatting using oxfmt",value:"format"},{disabled:!o,hint:o?void 0:"available for monorepo projects",label:"check:monorepo - check for monorepo-specific issues using Sherif",value:"check:monorepo"},{disabled:!o,hint:o?void 0:"available for monorepo projects",label:"fix:monorepo - fix monorepo-specific issues using Sherif",value:"fix:monorepo"},{label:"analyze - find unused dependencies, exports, and files using knip",value:"analyze"}]}),a=i.includes("check")||i.includes("fix"),u=[];if(a)u=yield*t.multiselect({message:"Which presets do you want to install? (core is always included)",options:[{label:"React",value:"react"},{label:"Next.js",value:"nextjs"},{label:"Vue",value:"vue"},{label:"Jest",value:"jest"},{label:"Vitest",value:"vitest"},{label:"Node",value:"node"}],required:!1});let y=!1;if(a)y=yield*t.confirm({initialValue:!0,message:"Adamantite provides a TypeScript preset to enforce strict type-safety. Would you like to use it?"});let f=yield*t.multiselect({message:"Which editors do you want to configure? (optional)",options:[{label:"VSCode / Cursor / Windsurf",value:"vscode"},{label:"Zed",value:"zed"}],required:!1}),s=!1;if(f.length>0)s=yield*t.confirm({initialValue:!0,message:"Do you want to install the recommended editor extensions?"});let l=lt(i),h=!1;if(l)h=yield*t.confirm({message:"Do you want to add a GitHub Actions workflow to run checks in CI?"});let S=i.includes("format"),k=i.includes("check:monorepo")||i.includes("fix:monorepo"),P=i.includes("analyze"),J=["adamantite"];if(a)J.push(`${c.name}@${c.version}`),J.push(`${le.name}@${le.version}`);if(S)J.push(`${d.name}@${d.version}`);if(k)J.push(`${K.name}@${K.version}`);if(P)J.push(`${m.name}@${m.version}`);if(yield*lo(e,J),S)yield*uo(e);if(a)yield*po(e,u);if(P)yield*yo(e);if(yield*co(e,i),y)yield*mo(e);if(yield*ho(e,f),s)yield*go(f,i);if(h)yield*Eo(e,n.name,i);yield*t.log.success("Your project is now configured"),yield*t.outro("\uD83D\uDCA0 Adamantite initialized successfully!")}).pipe(j.catchTags({OperationCancelled:()=>j.gen(function*(){yield*(yield*g).cancel("You've cancelled the initialization process.")})}))));import*as fr from"effect/Effect";import*as be from"effect/unstable/cli/Command";import*as Ft from"effect/unstable/cli/Flag";import*as sr from"effect/unstable/process/ChildProcessSpawner";var jo=Ft.boolean("fix").pipe(Ft.withDescription("Automatically fix issues")),lr=be.make("monorepo",{fix:jo}).pipe(be.withDescription("Find and fix monorepo-specific issues using Sherif"),be.withHandler(({fix:e})=>fr.gen(function*(){let t=yield*R,r=e?["--fix"]:[],n=yield*t.run({args:r,command:K.name,stdin:"inherit"});if(n!==sr.ExitCode(0))yield*new A({command:K.name,exitCode:n})})));import*as pr from"effect/Effect";import*as qe from"effect/unstable/cli/Command";import*as ur from"effect/unstable/process/ChildProcessSpawner";var cr=qe.make("typecheck").pipe(qe.withDescription("Deprecated alias for `check`"),qe.withHandler(()=>pr.gen(function*(){let e=yield*g,t=yield*R;yield*e.log.warning("Deprecated. Use `adamantite check` for typechecking.");let r=yield*t.run({args:[],command:c.name});if(r!==ur.ExitCode(0))yield*new A({command:c.name,exitCode:r})})));import Oo from"node:process";import*as Y from"effect/Effect";import*as Je from"effect/unstable/cli/Command";var So=[c,le,d,K,m],Fo=[c,le,d,K,m];function $o(e){return e.applicable&&Array.isArray(e.actions)}function To(e,t){let r=[];for(let n of Fo){if(t.has(n.name))continue;let o=e.devDependencies?.[n.name]??e.dependencies?.[n.name];if(o&&B(o)!==n.version)r.push({currentVersion:o,name:n.name,targetVersion:n.version})}return r}var yr=Je.make("update").pipe(Je.withDescription("Run applicable Adamantite migrations and update managed dependencies"),Je.withHandler(()=>Y.gen(function*(){let e=Oo.cwd(),t=yield*g,r=yield*Z,n={cwd:e};yield*Re(),yield*t.intro("\uD83D\uDCA0 adamantite update");let o=()=>Y.gen(function*(){let p=[];for(let F of So){let Ke=yield*F.assess(e);if($o(Ke))p.push({assessment:Ke,integration:F})}return p}),i=yield*o();for(let{assessment:p}of i)for(let F of p.warnings)yield*t.log.warning(F);let a=new Set(i.map(({integration:p})=>p.name)),u=i.flatMap(({assessment:p})=>p.actions),y=new Set(u.filter((p)=>p.type==="run_migration").map((p)=>p.migrationId)),f=[];for(let p of dt.filter((F)=>F.tags.includes("update"))){let F=Un[p.id];if(a.has(F))continue;let Ke=yield*p.check(n);f.push({migration:p,result:Ke})}for(let p of f){for(let F of p.result.warnings)yield*t.log.warning(F);if(p.result.applicable&&p.result.summary)yield*t.log.info(p.result.summary)}let s=[];for(let p of dt){if(!y.has(p.id))continue;yield*Qe(p,n,{onRestore:t.log.warning(`Migration "${p.title}" failed, restoring files...`)}),s.push(p.id)}for(let{migration:p,result:F}of f){if(!F.applicable||!F.summary)continue;yield*Qe(p,n,{onRestore:t.log.warning(`Migration "${p.title}" failed, restoring files...`)}),s.push(p.id)}if(s.length>0)yield*t.log.success("Migrations ran successfully.");let l=yield*$(e),h=yield*o(),S=h.flatMap(({assessment:p})=>p.actions).filter((p)=>p.type==="create_config"||p.type==="update_config"||p.type==="manual_fix"),k=h.flatMap(({assessment:p})=>p.actions).filter((p)=>p.type==="install_package"||p.type==="update_package").map((p)=>p.type==="install_package"?{currentVersion:"not installed",name:p.package,targetVersion:p.targetVersion}:{currentVersion:p.currentVersion,name:p.package,targetVersion:p.targetVersion}),P=new Set(k.map((p)=>p.name)),J=[...k,...To(l,P)];if(J.length>0){yield*t.log.info("The following dependencies will be updated:");for(let F of J)yield*t.log.info(` ${F.name}: ${F.currentVersion} → ${F.targetVersion}`);let p=t.spinner();p.start("Updating dependencies..."),yield*r.addDevDependencies(J.map((F)=>`${F.name}@${F.targetVersion}`),e,{silent:!0}).pipe(Y.tapError(()=>Y.sync(()=>{p.stop("Failed to update dependencies")}))),p.stop("Dependencies updated successfully"),yield*t.log.success("Dependencies updated successfully.")}if(S.length>0){yield*t.log.warning("Some configuration follow-up belongs to `adamantite doctor --fix`.");for(let p of S)yield*t.log.warning(`Doctor follow-up: ${p.description}`)}if(s.length===0&&J.length===0&&S.length===0)return yield*t.log.success("No changes needed."),"no-changes";return"success"}).pipe(Y.tapError(()=>Y.gen(function*(){yield*(yield*g).outro("❌ Update failed")})),Y.tap((e)=>Y.gen(function*(){let t=yield*g;switch(e){case"no-changes":yield*t.outro("✅ Adamantite is already up to date.");break;case"success":yield*t.outro("✅ Update completed successfully!");break;default:break}})))));var vo=ye.make("adamantite").pipe(ye.withDescription("Opinionated preset package for modern TypeScript applications"),ye.withSubcommands([Ct,pn,Qn,Yn,Gn,ar,lr,cr,yr])),Po=await"0.32.2",_o=ye.run(vo,{version:Po}).pipe(M.as(0),M.catchTag("CommandFailed",(e)=>M.succeed(e.exitCode)),M.catch((e)=>M.service(g).pipe(M.flatMap((t)=>t.log.error(e.message)),M.as(jr.ExitCode(1)))),M.provide(gr.mergeAll(dr.layer,g.layer,R.layer,Z.layer)));mr.runMain(_o,{teardown:(e,t)=>{if(hr.isSuccess(e)){t(Number(e.value));return}Er.defaultTeardown(e,t)}});
@@ -3,6 +3,7 @@ var config = {
3
3
  plugins: ["react", "react-perf", "jsx-a11y"],
4
4
  rules: {
5
5
  "jsx-a11y/alt-text": "error",
6
+ "jsx-a11y/anchor-ambiguous-text": "error",
6
7
  "jsx-a11y/anchor-has-content": "error",
7
8
  "jsx-a11y/anchor-is-valid": "error",
8
9
  "jsx-a11y/aria-activedescendant-has-tabindex": "error",
@@ -20,7 +21,6 @@ var config = {
20
21
  "jsx-a11y/media-has-caption": "error",
21
22
  "jsx-a11y/mouse-events-have-key-events": "error",
22
23
  "jsx-a11y/no-access-key": "error",
23
- "jsx-a11y/no-ambiguous-text": "error",
24
24
  "jsx-a11y/no-aria-hidden-on-focusable": "error",
25
25
  "jsx-a11y/no-autofocus": "error",
26
26
  "jsx-a11y/no-distracting-elements": "error",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adamantite",
3
- "version": "0.32.1",
3
+ "version": "0.32.2",
4
4
  "description": "An strict and opinionated set of presets for modern TypeScript applications",
5
5
  "keywords": [
6
6
  "adamantite",
@@ -79,6 +79,7 @@
79
79
  "oxc-parser": "^0.127.0"
80
80
  },
81
81
  "devDependencies": {
82
+ "@changesets/changelog-github": "0.7.0",
82
83
  "@changesets/cli": "2.31.0",
83
84
  "@types/bun": "1.3.13",
84
85
  "@types/figlet": "1.7.0",
@@ -4,6 +4,7 @@ const config: OxlintConfig = {
4
4
  plugins: ["react", "react-perf", "jsx-a11y"],
5
5
  rules: {
6
6
  "jsx-a11y/alt-text": "error",
7
+ "jsx-a11y/anchor-ambiguous-text": "error",
7
8
  "jsx-a11y/anchor-has-content": "error",
8
9
  "jsx-a11y/anchor-is-valid": "error",
9
10
  "jsx-a11y/aria-activedescendant-has-tabindex": "error",
@@ -21,7 +22,6 @@ const config: OxlintConfig = {
21
22
  "jsx-a11y/media-has-caption": "error",
22
23
  "jsx-a11y/mouse-events-have-key-events": "error",
23
24
  "jsx-a11y/no-access-key": "error",
24
- "jsx-a11y/no-ambiguous-text": "error",
25
25
  "jsx-a11y/no-aria-hidden-on-focusable": "error",
26
26
  "jsx-a11y/no-autofocus": "error",
27
27
  "jsx-a11y/no-distracting-elements": "error",