Skip to content

feat: add @rrlab/astro-plugin, which runs astro check for rr tsc and rr check - #270

Merged
rqbazan merged 3 commits into
mainfrom
feat/astro-plugin
Oct 18, 2026
Merged

rqbazan merged 3 commits into
mainfrom
feat/astro-plugin

Conversation

@rqbazan

@rqbazan rqbazan commented Oct 17, 2026 •

Copy link
Copy Markdown
Member

Summary

A new official plugin, @rrlab/astro-plugin, provides typecheck by running astro check. In an Astro project, rr tsc and rr check then type-check .astro files, so www can drop its separate pnpm astro check CI step.

 run-run/
+├── astro-plugin/            # AstroCheckService → `astro check`; install adds @astrojs/check + typescript
 └── cli/src/lib/plugin/
     └── directory.ts         # + astro: { capabilities: ["typecheck"] }
rr check
  jsc  → biome
  tsc  → astro check          # reports .astro and .ts diagnostics

astro check checks plain .ts files too (verified on www), so in an Astro project it replaces ts. Only one plugin can provide typecheck. If two do, the registry raises the usual MultipleProvidersError, and you narrow one with only.

Guard against a silent pass. When @astrojs/check or typescript can't be resolved from the project root, astro check prompts to install it instead of checking. Under rr's captured run that prompt hangs. With stdin closed, astro exits 0 having checked nothing. The plugin resolves both packages first, with astro's own lookup (require.resolve(pkg, { paths: [root] })). If one is missing, it fails the row with rr plugins add astro and never starts astro.

Reviewable choices:

  • What install adds: @astrojs/check and typescript, never astro, since the host owns its framework version. uninstall removes the same two.
  • Peer ranges: astro >=5.0.0, @astrojs/check >=0.9.0, typescript ^5 || ^6. The typescript range matches @astrojs/check's own, and astro check refuses TS 7.
  • engines.node is >=22.18.0, like every published package since fix: require Node 22.18.0, test it in CI, and check the docs' plugin list #272. astro 7 needs >=22.22.0 itself and says so when it starts.
  • vitest.config.ts is not the one-liner the checklist asks for. pnpm's bin shim puts its virtual store on NODE_PATH, which lets the tmp Astro projects in check.test.ts resolve packages they don't have. The config drops NODE_PATH before the workers fork.
  • No ADR. The repo writes one per arch-critic consultation, not one per plugin, and this plugin reuses an existing capability with no kernel change.

Known limitations, not addressed here:

  • In a monorepo, rr tsc runs astro check in every package with a tsconfig.json, whether or not it is an Astro project.
  • rr tsc doctor resolves the deps from the invocation directory. At a monorepo root whose deps live only in apps/www, it would report them missing.

Evidence

  • Tests: run-run/astro-plugin/src/__tests__/check.test.ts runs the real astro check on a tmp Astro project:

    clean .astro + .ts                 → ok
    type error in a .astro frontmatter → fails, shows src/pages/index.astro + "Type 'string' is not assignable to type 'number'"
    type error in a plain .ts          → fails, shows src/lib/bad.ts
    @astrojs/check missing             → fails with the hint, `astro check` never runs
    

    Before (guard removed): the missing-dep test hangs until the 5 s timeout, because astro is waiting on its install prompt.
    After: 14/14 pass on Node 24. On the 22.18.0 floor that CI also runs, the 4 tests that start astro are skipped, because astro 7 requires Node >=22.22.0, and 10/14 pass. pnpm build, pnpm test and pnpm rr check are green on both Node versions; on the floor the tests ran with turbo --force, without cache.

  • www, end to end. I packed @rrlab/cli and @rrlab/astro-plugin from this branch as tarballs and installed them into an isolated copy of www, with no source link. I added astro() to run-run.config.mts by hand.

    clean                       rr check → ✔ check passed (tsc (astro) · www: 24 files, 0 errors)
    Header.astro: const broken: number = "not a number"
      astro check  → exit 1   Header.astro:9:7 error ts(2322) … + warning ts(6133) · 1 error, 1 hint
      rr check     → exit 1   ✖ check failed · tsc — the same two diagnostics, verbatim, under the tsc (astro) row
    index.astro template: {Math.max("a", 1)}
      astro check  → exit 1 (1 error)    rr tsc → exit 1 (1 error)
    rr tsc doctor → ✔ doctor (astro) · www
    

Merge Danger

Door: two-way

This adds a new package and one entry to PLUGINS_DIRECTORY. No existing plugin and no kernel behavior changes.

Blast Radius: contained

  • pnpm-lock.yaml grows by about 2.5k lines from astro and @astrojs/check, which are only devDependencies of the plugin. pnpm audit reports 0 advisories, as on main after fix(deps): clear known vulnerabilities and add a weekly dependency audit #273.
  • The changeset bumps @rrlab/cli minor (new directory entry and README row) and @rrlab/astro-plugin minor (0.0.0 → 0.1.0). Under ADR 011, a CLI minor doesn't bump the other plugins.
  • Before www can run rr plugins add astro, it must move to the released @rrlab/cli minor. The plugin's peer publishes as ^<that version>, and www's current 1.3.2 doesn't know the astro alias.

🤖 Generated with Claude Code

https://claude.ai/code/session_01S4ufXKrCxJ4ZzpevL2fkEH

@changeset-bot

changeset-bot Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f854273

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 Minor
@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

@rqbazan

rqbazan commented Oct 17, 2026

Copy link
Copy Markdown
Member Author

Publish preview fails, and the fix is on npm, not in this branch. The job fails with ENEEDAUTH on @rrlab/astro-plugin. dx publishes through npm trusted publishing (OIDC, publish_mode: oidc-only), and this package doesn't exist on npm yet, so it has no trusted publisher. The release would fail the same way.

Before merging, create @rrlab/astro-plugin on npm and configure its trusted publisher (withvariablelab/dx, workflow ci.yml). Then re-run the preview job. Test is green.

rqbazan and others added 3 commits October 17, 2026 18:59
…rr check

The plugin provides the typecheck capability through `astro check`, which
checks .astro files and plain .ts files alike. It fails before running astro
when @astrojs/check or typescript can't be resolved from the project root:
astro would otherwise prompt to install them, which hangs under rr's
captured run, or exits 0 having checked nothing when stdin is closed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S4ufXKrCxJ4ZzpevL2fkEH
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S4ufXKrCxJ4ZzpevL2fkEH
…version

astro 7 requires Node >=22.22.0, above the repo's 22.18.0 floor that CI now
tests. On the floor, the tests that start astro are skipped; the
missing-dependency tests never start it and still run.

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

vland-bot Bot commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

Preview release

Latest commit: f854273

Some packages have been released:

Package Version Install
@rrlab/astro-plugin 0.0.1-git-f854273.0 @rrlab/astro-plugin@0.0.1-git-f854273.0
@rrlab/cli 1.3.6-git-f854273.0 @rrlab/cli@1.3.6-git-f854273.0

Note

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

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

@rqbazan
rqbazan merged commit 8febcf5 into main Oct 18, 2026
16 of 17 checks passed
@rqbazan
rqbazan deleted the feat/astro-plugin branch October 18, 2026 04:25
@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