Skip to content

fix: run astro check only in Astro packages, and point rr tsc doctor at the packages rr tsc checks - #285

Merged
rqbazan merged 2 commits into
mainfrom
fix/tsc-monorepo-targets
Oct 18, 2026
Merged

rqbazan merged 2 commits into
mainfrom
fix/tsc-monorepo-targets

Conversation

@rqbazan

@rqbazan rqbazan commented Oct 18, 2026

Copy link
Copy Markdown
Member

Summary

Two monorepo targeting bugs in rr tsc, one commit each.

1. @rrlab/astro-plugin ran astro check in every package with a tsconfig.json. In a plain TS package that booted Astro, printed Vite warnings and wrote .astro/ into it.

 AstroCheckService.check({ cwd })
+  if not isAstroProject(cwd)        // no astro.config.*, no astro in deps/devDeps/peerDeps
+    return tsc --noEmit --pretty    // keep type-checking it; ts() can't sit next to astro()
   astro check

2. rr tsc doctor ran once at the process cwd, usually the workspace root, which rr tsc never checks.

 rr tsc doctor
-  doctorOneAction → tsc.doctor()                  // spawned at process.cwd()
+  tscDoctorAction
+    monorepo: one row per package rr tsc checks → tsc.doctor({ cwd: pkg })
+    otherwise: one row → tsc.doctor({ cwd: appPkg })
  • Contract: doctor(options?: DoctorOptions), with DoctorOptions = { cwd?: string }. The change is additive and optional. ToolService.doctor spawns at cwd. StaticCheckService forwards the option. Of the official plugins, only astro-plugin overrides doctor; it now checks @astrojs/check only in Astro packages.
  • The other doctor commands and top-level rr doctor now run in the package they report on (appPkg). rr doctor still shows one row per tool and doesn't fan out over the workspace. That's a known limitation: at an Astro monorepo root, its astro row checks the root.
  • Bumps: @rrlab/cli minor (the new optional parameter), @rrlab/astro-plugin patch.

Evidence

Non-TTY e2e with the worktree's packed @rrlab/cli and @rrlab/astro-plugin: a pnpm workspace with apps/site (Astro 7.4) and packages/lib (plain TS), set up with rr plugins add biome and rr plugins add astro.

  • Before: rr tsc runs astro check in lib too: [WARN] Missing pages directory: src/pages, and packages/lib/.astro/ is created.
    After: tsc (astro) · 2 packages ✔ site ($ astro check) ✔ lib ($ tsc --noEmit --pretty), and there is no .astro/ in lib.
  • A type error in packages/lib gives rr tsc exit 1 with src/bad.ts:1:14 - error TS2322. With it removed, rr check passes.
  • Before: rr tsc doctor at the root is one row, run at the root, and reports @astrojs/check missing.
    After: doctor (astro) · 2 packages ✔ site ($ astro --help) ✔ lib ($ tsc --help). From packages/lib and from packages/lib/src it gives ✔ doctor (astro) · lib. A single package still gets one row.
  • Reverting commit 1's source fails 19/27 astro check.test.ts tests, including "runs tsc, not astro check, in a package without Astro". The new cli unit and integration tests fail without commit 2.

Merge Danger

Door: two-way

Blast Radius: medium

doctor commands now spawn in the package directory instead of the process cwd. That's the same directory unless you run rr from a subdirectory. The contract change is optional and additive, so a plugin built against an older CLI keeps working.

🤖 Generated with Claude Code

https://claude.ai/code/session_01EZVC7xzzsEmByszmfff4u2

rqbazan and others added 2 commits October 18, 2026 12:54
… Astro

In a monorepo `rr tsc` hands its single typecheck provider every package
with a tsconfig.json, and the astro plugin ran `astro check` in all of
them. In a plain TypeScript package that booted Astro, printed Vite
warnings and wrote `.astro/` into the package.

The plugin now runs `astro check` only in an Astro package, one with an
`astro.config.*` or with `astro` in its own dependencies, devDependencies
or peerDependencies, and `tsc --noEmit --pretty` in any other. A package
without Astro needs only `typescript`, and doctor checks `tsc` there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EZVC7xzzsEmByszmfff4u2
`rr tsc doctor` ran the typecheck provider's doctor once, at the
directory rr was started from. In a monorepo that is the workspace root,
which `rr tsc` never checks, so the astro plugin looked for
@astrojs/check there and reported it missing while `rr tsc` passed.

The plugin contract's `doctor` takes an optional `{ cwd }`
(`DoctorOptions`), which `ToolService` spawns in and `StaticCheckService`
forwards. `rr tsc doctor` goes through a new `tscDoctorAction` that
shares `rr tsc`'s target selection: one row per workspace package with a
tsconfig.json in a monorepo, else the single row. The other doctor
subcommands and `rr doctor` run in the package they report on. The
astro plugin is the only one that overrides `doctor`; it now checks the
package it is given.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EZVC7xzzsEmByszmfff4u2
@changeset-bot

changeset-bot Bot commented Oct 18, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: c99c5a8

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@rrlab/astro-plugin Patch
@rrlab/cli Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vland-bot

vland-bot Bot commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

Preview release

Latest commit: c99c5a8

Some packages have been released:

Package Version Install
@rrlab/astro-plugin 0.1.2-git-c99c5a8.0 @rrlab/astro-plugin@0.1.2-git-c99c5a8.0
@rrlab/cli 1.5.2-git-c99c5a8.0 @rrlab/cli@1.5.2-git-c99c5a8.0

Note

Use the PR number as tag to install any package. For instance:

pnpm add @rrlab/astro-plugin@pr-285

@rqbazan
rqbazan merged commit f963159 into main Oct 18, 2026
10 checks passed
@rqbazan
rqbazan deleted the fix/tsc-monorepo-targets branch October 18, 2026 18:01
@vland-bot vland-bot Bot mentioned this pull request Oct 18, 2026
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