Skip to content

fix: unified TypeScript config — all 42 packages typecheck clean#60

Merged
arek-e merged 7 commits into
mainfrom
fix/monorepo-typecheck
Apr 3, 2026
Merged

fix: unified TypeScript config — all 42 packages typecheck clean#60
arek-e merged 7 commits into
mainfrom
fix/monorepo-typecheck

Conversation

@arek-e
Copy link
Copy Markdown
Owner

@arek-e arek-e commented Apr 3, 2026

Summary

Two fixes that make CI green and keep it green:

1. Unified TypeScript config

  • Add @types/bun as root devDependency (Bun types include Node globals)
  • Remove per-package bun-types and @types/node
  • All tsconfigs extend packages/typescript-config/library.json chain
  • Remove per-package "types" overrides that broke tsc auto-detection
  • Result: 42/42 packages pass typecheck (was ~24/42)

2. Bun workspace catalog

  • Define all shared dependency versions in root package.json under workspaces.catalog
  • Each package uses "catalog:" protocol instead of pinning versions
  • One source of truth, zero version drift
  • syncpack lint passes clean (was failing with 11+ version mismatches)

Conventions added to CLAUDE.md:

  • @types/bun at root, never per-package type deps
  • Catalog for dependency versions, never pin directly in packages
  • No as any or as unknown casts, use type guards and narrowing

Test plan

  • turbo run typecheck — 42/42 packages pass
  • syncpack lint — no issues found
  • Pre-push hook added and working

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added a pre-push typecheck step to catch type issues before pushing.
  • Refactor

    • Moved to a central workspace catalog for dependency versioning and unified TypeScript base configs across packages.
    • Switched several packages to catalog-managed dependency resolution and removed per-package Bun type overrides.
    • Normalized SDK client fetch typing to an explicit function signature.
  • Documentation

    • Expanded TypeScript/Bun guidance with workspace/catalog and fetch-mocking recommendations.

…typecheck clean

Root cause: monorepo had no shared type strategy. Some packages used
bun-types, some @types/node, some had types: [] (blocking auto-detection).
Bun and Node types conflicted when both were present.

Fix:
- Add @types/bun as root devDependency (includes Node globals)
- Remove per-package bun-types and @types/node
- All tsconfigs extend packages/typescript-config/library.json (or
  app-bun.json / app-react.json), which extends base.json
- Remove all per-package "types" overrides that broke auto-detection
- Remove stale mcp-server reference from root tsconfig.json
- Add pre-push hook running turbo typecheck

Result: 42/42 packages pass typecheck. CI should go green.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 3, 2026

Warning

Rate limit exceeded

@arek-e has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 9 minutes and 0 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 9 minutes and 0 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a09b20f4-ef32-4f1c-9a76-75f485aee2e3

📥 Commits

Reviewing files that changed from the base of the PR and between c891fa9 and 14d1c3c.

📒 Files selected for processing (1)
  • .github/workflows/ci.yml
📝 Walkthrough

Walkthrough

Centralizes TypeScript configs into a new packages/typescript-config, converts workspace dependency pins to a root workspaces.catalog, removes per-package bun-types in favor of a root @types/bun, updates many package tsconfig.json to extend the shared configs, and adds a Husky pre-push hook that runs bunx turbo run typecheck --filter='!site'.

Changes

Cohort / File(s) Summary
Pre-push Hook & Docs
.husky/pre-push, CLAUDE.md
Added Husky pre-push hook running bunx turbo run typecheck --filter='!site'. Updated CLAUDE.md with Bun/TypeScript gotchas (root @types/bun, catalog usage, avoid as any/as unknown, fetch mock guidance).
Workspace catalog & root package
package.json
Converted workspaces to object with catalog, moved many root deps/devDeps to catalog: references, added root @types/bun, and adjusted root dependency specifiers.
New shared TS config package
packages/typescript-config/package.json, packages/typescript-config/base.json, .../library.json, .../app-bun.json, .../app-react.json
Added private @paws/typescript-config package with base/library/app presets (strict flags, Bun types in base, declaration settings for libraries, app presets for Bun/React).
Mass tsconfig extends updates
packages/.../tsconfig.json (domains/, providers/, integrations, credentials, provisioner, proxy, snapshot-store, firecracker, logger, etc.)
Many packages now extend packages/typescript-config/library.json (centralized inheritance); removed per-package explicit types where present.
Replace per-package pins with catalog refs
apps/*/package.json, packages/*/package.json, providers/*/package.json
Replaced numerous dependency/devDependency semver ranges with catalog: references across apps, packages, and providers; removed bun-types entries from many devDependencies.
Per-package tsconfig cleanup
packages/cli/tsconfig.json, packages/firecracker/tsconfig.json, packages/logger/tsconfig.json, packages/providers/tsconfig.json, packages/sdk/tsconfig.json
Removed explicit types arrays (e.g., bun-types, node) so types are inherited from shared base config.
SDK fetch typing & tests
packages/sdk/src/client.ts, packages/sdk/src/client.test.ts
Changed exported ClientConfig.fetch type from typeof globalThis.fetch to explicit `(input: RequestInfo
CI workflow tweaks
.github/workflows/ci.yml
Removed conditional --affected logic from the Test step (tests now run same Turbo filters for all events) and set Knip step continue-on-error: true.
Other small edits
tsconfig.json
Removed packages/mcp-server from project references.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 I hopped through configs, tidy and spry,
Rooted Bun types where duplicates die.
One catalog, one base, one shared TS song,
Tests still hum as I twitch along.
A carrot for types — neat and strong! 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically summarizes the main change: a unified TypeScript configuration that enables all 42 packages to pass typecheck, which directly reflects the primary objective and outcome of the PR.
Description check ✅ Passed The description is comprehensive and covers all required sections: clear summary of changes, rationale with concrete improvements (42/42 packages passing), test plan validation, and documentation updates to conventions. While the template format differs slightly, all essential information is present and well-structured.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/monorepo-typecheck

Comment @coderabbitai help to get the list of available commands and usage tips.

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Apr 3, 2026

Deploying getpaws with  Cloudflare Pages  Cloudflare Pages

Latest commit: 14d1c3c
Status: ✅  Deploy successful!
Preview URL: https://7f56f446.getpaws-6m4.pages.dev
Branch Preview URL: https://fix-monorepo-typecheck.getpaws-6m4.pages.dev

View logs

arek-e added 2 commits April 3, 2026 22:05
….fetch

Bun's fetch includes preconnect which vitest mocks don't satisfy.
Define FetchFn as the callable signature only. No more as-unknown casts.
These existed locally but were never committed. CI needs them since all
package tsconfigs now extend library.json.
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
package.json (1)

38-51: ⚠️ Potential issue | 🟠 Major

Pipeline failures: syncpack lint reports version mismatches that must be resolved.

The CI is failing due to dependency version mismatches detected by syncpack lint. While unrelated to the @types/bun addition, these failures will block the PR from merging:

  • zod: ^3.25.23 / ^3.25.7 vs ^4.3.6
  • react / react-dom: ^19.1.0 vs ^19.2.4
  • @types/react / @types/react-dom: version drift
  • tailwindcss / @tailwindcss/vite: ^4.1.8 vs ^4.2.2
  • @hono/zod-openapi: missing caret prefix

Run syncpack fix-mismatches or manually align the versions across packages to resolve.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@package.json` around lines 38 - 51, CI is failing due to dependency version
drift reported by syncpack; run syncpack fix-mismatches or manually align
versions in package.json across workspaces so the following keys match
project-wide: zod, react, react-dom, `@types/react`, `@types/react-dom`,
tailwindcss, `@tailwindcss/vite`, and ensure `@hono/zod-openapi` has a caret prefix;
update the versions in the devDependencies block (and any other package.json
files in the repo) to the consistent versions reported by syncpack, then rerun
syncpack lint to confirm the mismatches are resolved.
packages/domains/audit/tsconfig.json (1)

7-7: ⚠️ Potential issue | 🟡 Minor

Remove the types: ["node"] override.

The audit package explicitly overrides types to ["node"], which contradicts the PR objective of removing per-package type overrides. The parent config (library.jsonbase.json) provides @types/bun, which includes Node.js type definitions. Since the audit code uses Node.js fs APIs (e.g., existsSync, readFileSync, writeFileSync) that are available through @types/bun, this explicit override is unnecessary and prevents proper type auto-detection.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/domains/audit/tsconfig.json` at line 7, Remove the explicit "types":
["node"] override from the audit package tsconfig
(packages/domains/audit/tsconfig.json) so it inherits the parent configs
(library.json → base.json) that provide `@types/bun`; delete the "types" entry
entirely to allow proper type auto-detection for Node/Bun APIs like
existsSync/readFileSync/writeFileSync used in the audit code.
packages/domains/common/tsconfig.json (1)

2-8: ⚠️ Potential issue | 🟠 Major

Remove compilerOptions.types to preserve the inherited type configuration.

"types": [] at line 7 overrides the inherited "types": ["@types/bun"] from packages/typescript-config/base.json (via library.json), breaking the shared type strategy. This pattern exists across all 8 domains packages and should be removed to maintain consistency.

Suggested fix
   "extends": "../../../packages/typescript-config/library.json",
   "compilerOptions": {
     "composite": true,
     "outDir": "dist",
     "rootDir": "src",
-    "types": []
   },
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/domains/common/tsconfig.json` around lines 2 - 8, Remove the
explicit "compilerOptions.types" entry (the property `"types": []`) from the
tsconfig.json (the compilerOptions object) so it no longer overrides the
inherited types from the shared config; update the same change across the other
domain packages that currently set `"types": []` to preserve the inherited
`"types": ["@types/bun"]` from the base config.
🧹 Nitpick comments (5)
.husky/pre-push (1)

1-1: Pre-push typecheck hook is a good addition.

Enforcing typecheck before push helps catch issues early. The --filter='!site' exclusion is appropriate since the site package is an Astro project that handles TypeScript checking during the build step rather than as a separate task. However, document this to clarify the intention for future maintainers:

+# Typecheck all packages except 'site' (Astro project uses TypeScript in build)
 bunx turbo run typecheck --filter='!site'
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.husky/pre-push at line 1, Add an inline comment to the existing pre-push
hook explaining why the typecheck command excludes the site package: clarify
that the hook runs "bunx turbo run typecheck --filter='!site'" and that the
Astro-based site performs TypeScript checks during its build so it is
intentionally skipped here; update the .husky/pre-push file (and optionally the
repository CONTRIBUTING or docs) to include this rationale so future maintainers
understand the exclusion.
packages/domains/daemon/tsconfig.json (1)

7-7: Local types: [] override creates hidden dependency on inheritance chain.

While this override may be intentional to exclude Bun types from the daemon package, it creates a fragile pattern where the local config must track and override the inherited base config. If base.json changes its types array, this override silently prevents that change from taking effect.

Consider whether a dedicated shared config (e.g., typescript-config/library-no-runtime.json) would better express the intent for packages that shouldn't include runtime types. Based on relevant code snippets from packages/domains/browser/tsconfig.json:1-10 and packages/cli/tsconfig.json:1-10.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/domains/daemon/tsconfig.json` at line 7, The local tsconfig.json in
the daemon package overrides "types": [] which silently blocks any changes from
the inherited base.json and creates a hidden dependency; replace this local
override by either removing the "types" key so the package inherits base.json's
types, or create/extend a dedicated shared config (e.g.,
typescript-config/library-no-runtime.json) that explicitly omits runtime types
and have packages like daemon extend that instead of setting "types": []; update
the daemon package's tsconfig.json to extend the chosen shared config (or remove
the override) so intent is explicit and inheritance is stable.
packages/providers/tsconfig.json (1)

2-2: Simplify relative path.

From packages/providers/, the path ../../packages/typescript-config/library.json works but is unnecessarily verbose. Use ../typescript-config/library.json instead.

♻️ Simplified path
 {
-  "extends": "../../packages/typescript-config/library.json",
+  "extends": "../typescript-config/library.json",
   "compilerOptions": {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/providers/tsconfig.json` at line 2, Update the "extends" value in
the tsconfig.json in packages/providers from the verbose
"../../packages/typescript-config/library.json" to the shorter relative path
"../typescript-config/library.json"; modify the string assigned to the "extends"
property so the compiler picks up the shared config using the simplified
relative path.
CLAUDE.md (1)

131-133: Consider documenting the narrower type approach as an alternative.

The guidance recommends fn as unknown as typeof globalThis.fetch for mocks. However, packages/sdk/src/client.ts took a different approach: using a narrower explicit signature (input: RequestInfo | URL, init?: RequestInit) => Promise<Response> that vitest mocks naturally satisfy without casting.

Consider documenting this alternative pattern, which avoids double-casting entirely:

📝 Suggested addition
 - **Bun's `fetch` has extra methods.** `typeof globalThis.fetch` under Bun includes `preconnect`,
   which vitest mocks don't have. In tests, use `fn as unknown as typeof globalThis.fetch` to cast
-  mock functions to the fetch type. Don't use `as any`.
+  mock functions to the fetch type. Don't use `as any`. Alternatively, define interfaces with
+  explicit callable signatures `(input: RequestInfo | URL, init?: RequestInit) => Promise<Response>`
+  instead of `typeof globalThis.fetch` to avoid Bun-specific extras entirely.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@CLAUDE.md` around lines 131 - 133, Add a note to the existing fetch-mock
guidance showing the alternative of typing mocks with a narrower explicit
signature instead of double-casting; mention the exact pattern used in
packages/sdk/src/client.ts — an explicit function type like (input: RequestInfo
| URL, init?: RequestInit) => Promise<Response> — and state that vitest mocks
naturally satisfy this narrower signature so you can avoid using fn as unknown
as typeof globalThis.fetch or as any.
providers/hetzner-dedicated/tsconfig.json (1)

1-8: Minor redundancy in compiler options.

The outDir: "dist" and rootDir: "src" values duplicate the defaults already set in library.json. They can be safely removed unless intentionally kept for explicitness.

♻️ Optional cleanup
 {
   "extends": "../../packages/typescript-config/library.json",
-  "compilerOptions": {
-    "outDir": "dist",
-    "rootDir": "src"
-  },
   "include": ["src"]
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@providers/hetzner-dedicated/tsconfig.json` around lines 1 - 8, The
tsconfig.json currently repeats default compiler options by specifying
"compilerOptions": { "outDir": "dist", "rootDir": "src" } which are already
provided by the extended "../../packages/typescript-config/library.json"; remove
the redundant outDir and rootDir entries from the compilerOptions block (or
delete the entire compilerOptions object if it contains nothing else) so the
file simply extends library.json and includes ["src"], keeping the file minimal
and relying on the shared defaults.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@package.json`:
- Around line 38-51: CI is failing due to dependency version drift reported by
syncpack; run syncpack fix-mismatches or manually align versions in package.json
across workspaces so the following keys match project-wide: zod, react,
react-dom, `@types/react`, `@types/react-dom`, tailwindcss, `@tailwindcss/vite`, and
ensure `@hono/zod-openapi` has a caret prefix; update the versions in the
devDependencies block (and any other package.json files in the repo) to the
consistent versions reported by syncpack, then rerun syncpack lint to confirm
the mismatches are resolved.

In `@packages/domains/audit/tsconfig.json`:
- Line 7: Remove the explicit "types": ["node"] override from the audit package
tsconfig (packages/domains/audit/tsconfig.json) so it inherits the parent
configs (library.json → base.json) that provide `@types/bun`; delete the "types"
entry entirely to allow proper type auto-detection for Node/Bun APIs like
existsSync/readFileSync/writeFileSync used in the audit code.

In `@packages/domains/common/tsconfig.json`:
- Around line 2-8: Remove the explicit "compilerOptions.types" entry (the
property `"types": []`) from the tsconfig.json (the compilerOptions object) so
it no longer overrides the inherited types from the shared config; update the
same change across the other domain packages that currently set `"types": []` to
preserve the inherited `"types": ["@types/bun"]` from the base config.

---

Nitpick comments:
In @.husky/pre-push:
- Line 1: Add an inline comment to the existing pre-push hook explaining why the
typecheck command excludes the site package: clarify that the hook runs "bunx
turbo run typecheck --filter='!site'" and that the Astro-based site performs
TypeScript checks during its build so it is intentionally skipped here; update
the .husky/pre-push file (and optionally the repository CONTRIBUTING or docs) to
include this rationale so future maintainers understand the exclusion.

In `@CLAUDE.md`:
- Around line 131-133: Add a note to the existing fetch-mock guidance showing
the alternative of typing mocks with a narrower explicit signature instead of
double-casting; mention the exact pattern used in packages/sdk/src/client.ts —
an explicit function type like (input: RequestInfo | URL, init?: RequestInit) =>
Promise<Response> — and state that vitest mocks naturally satisfy this narrower
signature so you can avoid using fn as unknown as typeof globalThis.fetch or as
any.

In `@packages/domains/daemon/tsconfig.json`:
- Line 7: The local tsconfig.json in the daemon package overrides "types": []
which silently blocks any changes from the inherited base.json and creates a
hidden dependency; replace this local override by either removing the "types"
key so the package inherits base.json's types, or create/extend a dedicated
shared config (e.g., typescript-config/library-no-runtime.json) that explicitly
omits runtime types and have packages like daemon extend that instead of setting
"types": []; update the daemon package's tsconfig.json to extend the chosen
shared config (or remove the override) so intent is explicit and inheritance is
stable.

In `@packages/providers/tsconfig.json`:
- Line 2: Update the "extends" value in the tsconfig.json in packages/providers
from the verbose "../../packages/typescript-config/library.json" to the shorter
relative path "../typescript-config/library.json"; modify the string assigned to
the "extends" property so the compiler picks up the shared config using the
simplified relative path.

In `@providers/hetzner-dedicated/tsconfig.json`:
- Around line 1-8: The tsconfig.json currently repeats default compiler options
by specifying "compilerOptions": { "outDir": "dist", "rootDir": "src" } which
are already provided by the extended
"../../packages/typescript-config/library.json"; remove the redundant outDir and
rootDir entries from the compilerOptions block (or delete the entire
compilerOptions object if it contains nothing else) so the file simply extends
library.json and includes ["src"], keeping the file minimal and relying on the
shared defaults.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5b36e0d1-a1c4-4c9d-bb2f-62706e85d45f

📥 Commits

Reviewing files that changed from the base of the PR and between d169b36 and 64a5e16.

⛔ Files ignored due to path filters (1)
  • bun.lock is excluded by !**/*.lock
📒 Files selected for processing (40)
  • .husky/pre-push
  • CLAUDE.md
  • apps/control-plane/package.json
  • apps/worker/package.json
  • package.json
  • packages/cli/package.json
  • packages/cli/tsconfig.json
  • packages/credentials/tsconfig.json
  • packages/domains/audit/tsconfig.json
  • packages/domains/browser/tsconfig.json
  • packages/domains/common/tsconfig.json
  • packages/domains/daemon/tsconfig.json
  • packages/domains/fleet/tsconfig.json
  • packages/domains/mcp/tsconfig.json
  • packages/domains/network/tsconfig.json
  • packages/domains/session/tsconfig.json
  • packages/domains/snapshot/tsconfig.json
  • packages/firecracker/package.json
  • packages/firecracker/tsconfig.json
  • packages/integrations/tsconfig.json
  • packages/logger/package.json
  • packages/logger/tsconfig.json
  • packages/providers/tsconfig.json
  • packages/provisioner/tsconfig.json
  • packages/proxy/package.json
  • packages/proxy/tsconfig.json
  • packages/sdk/package.json
  • packages/sdk/src/client.test.ts
  • packages/sdk/src/client.ts
  • packages/sdk/tsconfig.json
  • packages/snapshot-store/tsconfig.json
  • packages/typescript-config/app-bun.json
  • packages/typescript-config/app-react.json
  • packages/typescript-config/base.json
  • packages/typescript-config/library.json
  • packages/typescript-config/package.json
  • providers/aws-ec2/tsconfig.json
  • providers/hetzner-cloud/tsconfig.json
  • providers/hetzner-dedicated/tsconfig.json
  • tsconfig.json
💤 Files with no reviewable changes (8)
  • packages/cli/package.json
  • packages/proxy/package.json
  • packages/sdk/package.json
  • packages/firecracker/package.json
  • apps/control-plane/package.json
  • packages/logger/package.json
  • tsconfig.json
  • apps/worker/package.json

arek-e added 4 commits April 3, 2026 22:16
Define all shared dependency versions in root package.json under
workspaces.catalog. Each package uses "catalog:" protocol instead of
pinning versions directly. One source of truth, zero drift.

This replaces syncpack's role as version enforcer — the package manager
itself now guarantees consistency. syncpack lint still runs in CI as a
safety net.

28 package.json files updated. All versions unified to highest.
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@CLAUDE.md`:
- Around line 127-140: Update the contradictory cast policy so it forbids broad
use of "as any" and "as unknown" in production code but explicitly permits
targeted double-casts used for interop test shims (e.g., "fn as unknown as
typeof globalThis.fetch"); change the prose around the rule and the Bun fetch
note to state that tests may use narrow, documented double-casts for
third-party/mock mismatches while recommending alternatives (type guards,
narrower helper types like "type FetchFn", or conditional spreads) for
application code and providing the exact example "fn as unknown as typeof
globalThis.fetch" as the sanctioned exception.

In `@packages/integrations/package.json`:
- Line 22: Remove the package-local bun-types entry from this package.json to
adhere to the root-only typing strategy: delete the dependency key "bun-types"
(the line showing "bun-types": "catalog:") from this package's package.json so
the workspace uses the single, root-provided Bun typings instead.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6dd4d79c-3375-4cb6-842b-41f9b675b5e7

📥 Commits

Reviewing files that changed from the base of the PR and between 64a5e16 and c891fa9.

⛔ Files ignored due to path filters (1)
  • bun.lock is excluded by !**/*.lock
📒 Files selected for processing (28)
  • CLAUDE.md
  • apps/control-plane/package.json
  • apps/dashboard/package.json
  • apps/site/package.json
  • apps/worker/package.json
  • package.json
  • packages/cli/package.json
  • packages/credentials/package.json
  • packages/domains/audit/package.json
  • packages/domains/browser/package.json
  • packages/domains/common/package.json
  • packages/domains/daemon/package.json
  • packages/domains/fleet/package.json
  • packages/domains/mcp/package.json
  • packages/domains/network/package.json
  • packages/domains/session/package.json
  • packages/domains/snapshot/package.json
  • packages/firecracker/package.json
  • packages/integrations/package.json
  • packages/logger/package.json
  • packages/providers/package.json
  • packages/provisioner/package.json
  • packages/proxy/package.json
  • packages/sdk/package.json
  • packages/snapshot-store/package.json
  • providers/aws-ec2/package.json
  • providers/hetzner-cloud/package.json
  • providers/hetzner-dedicated/package.json
✅ Files skipped from review due to trivial changes (12)
  • packages/domains/mcp/package.json
  • packages/domains/network/package.json
  • packages/domains/fleet/package.json
  • providers/hetzner-cloud/package.json
  • providers/hetzner-dedicated/package.json
  • packages/providers/package.json
  • packages/domains/session/package.json
  • packages/snapshot-store/package.json
  • packages/domains/audit/package.json
  • packages/provisioner/package.json
  • packages/domains/common/package.json
  • apps/control-plane/package.json
🚧 Files skipped from review as they are similar to previous changes (7)
  • packages/logger/package.json
  • packages/cli/package.json
  • packages/firecracker/package.json
  • packages/sdk/package.json
  • package.json
  • packages/proxy/package.json
  • apps/worker/package.json

Comment thread CLAUDE.md
Comment on lines +127 to +140
- **No `as any` or `as unknown` typecasts.** Use type guards, narrowing, conditional spreads, or
narrower type definitions. In tests, define explicit helper types (e.g., `type FetchFn`) rather
than casting mocks.

## Gotchas

- **`@types/bun` at root, not per-package.** All TypeScript types come from the root `@types/bun`
devDependency. Every package's `tsconfig.json` extends `packages/typescript-config/library.json`
(or `app-bun.json` / `app-react.json`), which extends `base.json`. Never add `bun-types`,
`@types/bun`, or `@types/node` to individual packages. Never set `"types": [...]` in per-package
tsconfigs, as it overrides auto-detection and breaks type resolution.
- **Bun's `fetch` has extra methods.** `typeof globalThis.fetch` under Bun includes `preconnect`,
which vitest mocks don't have. In tests, use `fn as unknown as typeof globalThis.fetch` to cast
mock functions to the fetch type. Don't use `as any`.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

git ls-files CLAUDE.md

Repository: arek-e/paws

Length of output: 64


🏁 Script executed:

cat -n CLAUDE.md | sed -n '120,145p'

Repository: arek-e/paws

Length of output: 2188


Resolve the contradictory cast policy in this section.

Line 127 bans as any or as unknown categorically, but line 139 explicitly prescribes fn as unknown as typeof globalThis.fetch in tests. Update the rule to allow documented interop edge cases like this one.

Suggested fix
-- **No `as any` or `as unknown` typecasts.** Use type guards, narrowing, conditional spreads, or
-  narrower type definitions. In tests, define explicit helper types (e.g., `type FetchFn`) rather
-  than casting mocks.
+- **No `as any` typecasts; avoid `as unknown` except documented interop edge-cases.** Use type
+  guards, narrowing, conditional spreads, or narrower type definitions. In tests, prefer explicit
+  helper types (e.g., `type FetchFn`) over cast chains.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@CLAUDE.md` around lines 127 - 140, Update the contradictory cast policy so it
forbids broad use of "as any" and "as unknown" in production code but explicitly
permits targeted double-casts used for interop test shims (e.g., "fn as unknown
as typeof globalThis.fetch"); change the prose around the rule and the Bun fetch
note to state that tests may use narrow, documented double-casts for
third-party/mock mismatches while recommending alternatives (type guards,
narrower helper types like "type FetchFn", or conditional spreads) for
application code and providing the exact example "fn as unknown as typeof
globalThis.fetch" as the sanctioned exception.

"devDependencies": {
"bun-types": "^1.3.11",
"vitest": "^4.1.2"
"bun-types": "catalog:",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify no package-level Bun/Node type deps and no per-package compilerOptions.types overrides remain.

echo "== package.json entries =="
rg -n --iglob '**/package.json' '"(bun-types|@types/bun|@types/node)"\s*:'

echo
echo "== tsconfig compilerOptions.types overrides =="
rg -n --iglob '**/tsconfig*.json' '"types"\s*:\s*\['

Repository: arek-e/paws

Length of output: 1336


Remove package-local bun-types to preserve the single-source type strategy.

Line 22 reintroduces per-package Bun typings, which conflicts with the PR's root-only approach and risks ambient type conflicts across the workspace.

Proposed fix
   "devDependencies": {
-    "bun-types": "catalog:",
     "vitest": "catalog:"
   }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"bun-types": "catalog:",
"devDependencies": {
"vitest": "catalog:"
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/integrations/package.json` at line 22, Remove the package-local
bun-types entry from this package.json to adhere to the root-only typing
strategy: delete the dependency key "bun-types" (the line showing "bun-types":
"catalog:") from this package's package.json so the workspace uses the single,
root-provided Bun typings instead.

@arek-e arek-e merged commit e61bc74 into main Apr 3, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant