From 127db8c2391eca8ff41d0f70170d01ef7a7e81d4 Mon Sep 17 00:00:00 2001 From: Ryan Lee Date: Fri, 11 Sep 2026 17:08:47 +0000 Subject: [PATCH 1/3] build: bundle the attw CLI into a self-contained bin-only package The published CLI declared five runtime dependencies and externalized them, so installing it pulled the analyzer, effect, and a compiler into the consumer's tree, and the analyzer ran whatever TypeScript the host hoisted. Inline every dependency into the single dist/main.mjs entry, drop the library entry for AttwHandler that nothing outside the package imports, and move the former runtime dependencies to devDependencies. deps.onlyImport fails the build if a bare import survives, so the manifest cannot drift from the bundle; the inlined TypeScript is the analyzer's own pinned 6.0.3. The published manifest now exposes only bin. Verified by packing, installing the tarball in an empty project (npm adds exactly one package, then the bin link resolves), and running attw --pack on an ESM-only fixture from the installed binary --- .changeset/twenty-vans-prove.md | 5 +++++ packages/arethetypeswrong-cli/README.md | 2 ++ packages/arethetypeswrong-cli/package.json | 10 ++++----- .../arethetypeswrong-cli/tsdown.config.ts | 21 +++++++------------ pnpm-lock.yaml | 21 +++++++++---------- 5 files changed, 29 insertions(+), 30 deletions(-) create mode 100644 .changeset/twenty-vans-prove.md diff --git a/.changeset/twenty-vans-prove.md b/.changeset/twenty-vans-prove.md new file mode 100644 index 000000000..31d64b96d --- /dev/null +++ b/.changeset/twenty-vans-prove.md @@ -0,0 +1,5 @@ +--- +"@systemfsoftware/arethetypeswrong-cli": minor +--- + +The package now ships a single self-contained `attw` executable and declares no runtime dependencies, so installing the CLI no longer adds its dependency tree to your project. The command, its flags, and its output are unchanged. diff --git a/packages/arethetypeswrong-cli/README.md b/packages/arethetypeswrong-cli/README.md index 5e3cab861..6b6800823 100644 --- a/packages/arethetypeswrong-cli/README.md +++ b/packages/arethetypeswrong-cli/README.md @@ -34,6 +34,8 @@ pnpm exec attw --pack . > [!NOTE] > Prefer a lockfile-pinned install over `npx`. A tool that audits what your package resolves should not itself be resolved fresh from the registry on each run. +The package is self-contained — the analyzer and the compiler it uses ship inside the executable, and it declares no runtime dependencies — so installing it adds nothing else to your `node_modules`. + To use `attw` outside any project, install it globally: ```shell diff --git a/packages/arethetypeswrong-cli/package.json b/packages/arethetypeswrong-cli/package.json index 0df130942..58f362d61 100644 --- a/packages/arethetypeswrong-cli/package.json +++ b/packages/arethetypeswrong-cli/package.json @@ -32,24 +32,22 @@ "prepack": "pnpm build" }, "type": "module", - "dependencies": { + "devDependencies": { "@effect/platform-node": "catalog:", "@effect/platform-node-shared": "catalog:", - "@systemfsoftware/arethetypeswrong": "workspace:*", - "@systemfsoftware/npm-package": "catalog:", - "effect": "catalog:" - }, - "devDependencies": { "@effect/vitest": "catalog:", "@systemfsoftware/all": "catalog:", + "@systemfsoftware/arethetypeswrong": "workspace:*", "@systemfsoftware/arethetypeswrong-recipes": "workspace:*", "@systemfsoftware/effect-gherkin-spec": "catalog:", "@systemfsoftware/effect-schema-law": "catalog:", "@systemfsoftware/effect-schema-vite": "catalog:", + "@systemfsoftware/npm-package": "catalog:", "@systemfsoftware/oxlint-plugin-effect-dmmf": "catalog:", "@systemfsoftware/tsconfig": "catalog:", "@types/node": "catalog:", "@vitest/coverage-v8": "catalog:", + "effect": "catalog:", "fast-check": "catalog:", "oxlint": "catalog:", "rimraf": "catalog:", diff --git a/packages/arethetypeswrong-cli/tsdown.config.ts b/packages/arethetypeswrong-cli/tsdown.config.ts index 76e668092..546553104 100644 --- a/packages/arethetypeswrong-cli/tsdown.config.ts +++ b/packages/arethetypeswrong-cli/tsdown.config.ts @@ -1,22 +1,17 @@ import { defineConfig } from 'tsdown' export default defineConfig({ - entry: [ - 'src/main.ts', - 'src/AttwHandler.ts', - ], + entry: ['src/main.ts'], format: 'esm', clean: true, - dts: true, - outExtensions: () => ({ js: '.mjs', dts: '.d.ts' }), + platform: 'node', + shims: true, + dts: false, + outExtensions: () => ({ js: '.mjs' }), tsconfig: './tsconfig.build.json', deps: { - neverBundle: [ - '@systemfsoftware/arethetypeswrong', - '@systemfsoftware/npm-package', - 'effect', - '@effect/cli', - '@effect/printer', - ], + alwaysBundle: [/./], + onlyImport: [/^node:/], + onlyBundle: false, }, }) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7a124cd3c..e6a3cbe3f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -243,29 +243,22 @@ importers: version: 4.1.11(@types/node@24.13.3)(@vitest/coverage-v8@4.1.11)(vite@8.2.2(@types/node@24.13.3)(jiti@2.6.1)(yaml@2.9.0)) packages/arethetypeswrong-cli: - dependencies: + devDependencies: '@effect/platform-node': specifier: 'catalog:' version: 4.0.0-rc.112(effect@4.0.0-rc.112)(redis@6.2.1) '@effect/platform-node-shared': specifier: 'catalog:' version: 4.0.0-rc.112(effect@4.0.0-rc.112) - '@systemfsoftware/arethetypeswrong': - specifier: workspace:* - version: link:../arethetypeswrong - '@systemfsoftware/npm-package': - specifier: 'catalog:' - version: 0.2.2(effect@4.0.0-rc.112) - effect: - specifier: 'catalog:' - version: 4.0.0-rc.112 - devDependencies: '@effect/vitest': specifier: 'catalog:' version: 4.0.0-rc.112(effect@4.0.0-rc.112)(vitest@4.1.11) '@systemfsoftware/all': specifier: 'catalog:' version: 1.1.3(effect@4.0.0-rc.112)(oxlint-tsgolint@7.0.2001)(oxlint@1.82.0(oxlint-tsgolint@7.0.2001))(typescript@7.0.2) + '@systemfsoftware/arethetypeswrong': + specifier: workspace:* + version: link:../arethetypeswrong '@systemfsoftware/arethetypeswrong-recipes': specifier: workspace:* version: link:../arethetypeswrong-recipes @@ -278,6 +271,9 @@ importers: '@systemfsoftware/effect-schema-vite': specifier: 'catalog:' version: 2.0.3(@systemfsoftware/effect-schema-law@2.0.2(@effect/vitest@4.0.0-rc.112(effect@4.0.0-rc.112)(vitest@4.1.11))(effect@4.0.0-rc.112)(vitest@4.1.11))(effect@4.0.0-rc.112)(vite@8.2.2(@types/node@24.13.3)(jiti@2.6.1)(yaml@2.9.0))(vitest@4.1.11) + '@systemfsoftware/npm-package': + specifier: 'catalog:' + version: 0.2.2(effect@4.0.0-rc.112) '@systemfsoftware/oxlint-plugin-effect-dmmf': specifier: 'catalog:' version: 5.3.0(effect@4.0.0-rc.112)(oxlint@1.82.0(oxlint-tsgolint@7.0.2001))(typescript@7.0.2) @@ -290,6 +286,9 @@ importers: '@vitest/coverage-v8': specifier: 'catalog:' version: 4.1.11(vitest@4.1.11) + effect: + specifier: 'catalog:' + version: 4.0.0-rc.112 fast-check: specifier: 'catalog:' version: 4.9.0 From 431b911e82f7fa5a8749ca5bbeaef3840fe291f3 Mon Sep 17 00:00:00 2001 From: Ryan Lee Date: Fri, 11 Sep 2026 17:12:05 +0000 Subject: [PATCH 2/3] build: stop building the CLI bundle during install MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `prepare` ran tsdown on every `pnpm install`, before any package was built. The bundle inlines the analyzer, so on a fresh clone the analyzer's dist/ did not exist yet, rolldown left it external, and the onlyImport gate failed the install with "@systemfsoftware/arethetypeswrong is imported in main.mjs but is not included in deps.onlyImport option" — the Commitlint workflow's `pnpm install --frozen-lockfile` broke on it. turbo already orders this: every task that needs dist depends on `^build`, so `pnpm build` builds the analyzer before the CLI. Install no longer builds, and the bundle is produced by the task graph that knows the order --- packages/arethetypeswrong-cli/package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/arethetypeswrong-cli/package.json b/packages/arethetypeswrong-cli/package.json index 58f362d61..d97c5a622 100644 --- a/packages/arethetypeswrong-cli/package.json +++ b/packages/arethetypeswrong-cli/package.json @@ -22,7 +22,6 @@ }, "scripts": { "build": "tsdown", - "prepare": "tsdown", "clean": "rimraf dist", "typecheck": "tsc --noEmit --incremental", "attw": "node ./dist/main.mjs --pack .", From fa3f6226105814f66a378c5eceebbd28a63d17e9 Mon Sep 17 00:00:00 2001 From: Ryan Lee Date: Fri, 11 Sep 2026 17:13:52 +0000 Subject: [PATCH 3/3] docs: remove the install note added to the CLI README The note was added alongside the bundling change without being part of it. The package page describes what the CLI does; what changed about its packaging belongs to the release note --- packages/arethetypeswrong-cli/README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/arethetypeswrong-cli/README.md b/packages/arethetypeswrong-cli/README.md index 6b6800823..5e3cab861 100644 --- a/packages/arethetypeswrong-cli/README.md +++ b/packages/arethetypeswrong-cli/README.md @@ -34,8 +34,6 @@ pnpm exec attw --pack . > [!NOTE] > Prefer a lockfile-pinned install over `npx`. A tool that audits what your package resolves should not itself be resolved fresh from the registry on each run. -The package is self-contained — the analyzer and the compiler it uses ship inside the executable, and it declares no runtime dependencies — so installing it adds nothing else to your `node_modules`. - To use `attw` outside any project, install it globally: ```shell