Skip to content

fix: make rr plugins add work without a TTY and leave a project rr check passes - #276

Merged
rqbazan merged 5 commits into
mainfrom
fix/rr-plugins-add-unattended
Oct 18, 2026
Merged

rqbazan merged 5 commits into
mainfrom
fix/rr-plugins-add-unattended

Conversation

@rqbazan

@rqbazan rqbazan commented Oct 18, 2026 •

Copy link
Copy Markdown
Member

Pairs with #269 at runtime, not in code: a project that keeps oxc's type-check needs #269's oxlint-tsgolint range. Nothing here touches #269's files, and the verification below uses oxc for lint and format only.

Summary

The vland templates (#271) ship plugins: [], and each project runs rr plugins add for the ones it wants, often from an agent with no TTY. On a fresh project, that never ended with a green rr check. Five fixes, one commit each, a patch changeset per package:

 rr plugins add biome            # stdin and stdout are pipes
-  "Scaffold biome.json?" → waits forever, or exit 13 on a closed stdin (plugin installed, not configured)
+  no TTY → unattended, like --yes                                    cli: add.ts, canPrompt()
   biome.json
-    "$schema": ".../schemas/2.4.4/schema.json", "extends": [⏎ … ⏎]  → Biome format error
+    "$schema": "./node_modules/@biomejs/biome/configuration_schema.json", "extends": ["@rrlab/biome-config"]
   run-run.config.mts
-    each import first, reversed; blank lines from recast; no final newline  → Biome organizeImports error
+    each import in Biome's order, together, final newline           cli: config-ast.ts
 rr plugins add ts               # in apps/web, which depends on react
-  --yes / no TTY → "no-dom-app" preset → TS2584 `document`, TS17004 JSX
+  react in (peer|dev)dependencies → "react" preset (also the prompt's initial value)
 rr lint | rr jsc | rr check     # with the oxc plugin
-  oxlint --check   → "`--check` is not expected in this context"
+  oxlint            # checks by default
 rr format --fix
-  oxfmt --fix      → not an oxfmt flag
+  oxfmt --write
 rr plugins remove biome         # no TTY, no --yes
-  waits on "Proceed?"
+  ConfirmationRequiredError: "... Re-run it with --yes."   (it deletes files and deps)

canPrompt() asks for TTYs on both stdin and stdout, because clack reads one and draws on the other. clibuddy's hasTTY only checks stdout. Decision 004 already says the unattended flow takes the defaults; this only adds the missing TTY as a trigger.

Import order: Biome's groups (protocol, package, alias, path), then plain code-unit order inside each, not localeCompare. localeCompare puts tsdown-plugin before ts-plugin, and rr jsc would fail on the file rr just wrote.

Evidence

  • Before, the published rr 1.3.5: each template generated with feat: bring the vland templates to the org standard, and fix vland init's git identity and hooks #271, then each plugin added with no TTY and no --yes:

    library  biome ts tsdown vitest:  add-biome=13 add-ts=13 add-tsdown=13 add-vitest=0  check=1 pack=1
    library  oxc tsdown vitest:       add-oxc=0 add-tsdown=13                        check=1 (oxlint --check)
    monorepo biome ts vitest:         add-biome=13 add-ts=13                         check=1
    

    After, this branch packed into tarballs and installed into each generated project through pnpm overrides, under the same matrix:

    library  biome ts tsdown vitest:          every add=0  check=0 test=0 pack=0
    library  oxc ts tsdown vitest:            every add=0  check=0 test=0 pack=0
    backend  biome ts tsdown vitest:          every add=0  check=0 test=0 pack=0
    backend  oxc ts tsdown vitest:            every add=0  check=0 test=0 pack=0
    monorepo biome ts vitest + ts/tsdown per workspace (apps/web → react preset): check=0 test=0 build=0
    monorepo oxc ts vitest  + the same:                                           check=0 test=0 build=0
    

    oxc runs as oxc({ only: ["lint", "format"] }), which feat: bring the vland templates to the org standard, and fix vland init's git identity and hooks #271's READMEs ask for, because oxc and ts both provide the type-check.

  • Tests, each red on the code before its fix:

    plugins.test   add without a TTY: takes the defaults, and what it writes passes `rr jsc`   # pnpm stub on PATH, no network
                   ts picks the React preset for a package that depends on react
                   remove without a TTY: asks for --yes, and changes nothing
    config-ast     imports in Biome's order whatever order the plugins come
                   leaves the others alone; after `node:`, before `./`
                   imports together and sorted across separate `rr plugins add` runs (exact file)
                   ends a new or existing config with a newline
    lint.test      oxc: runs oxlint in its default check mode
    format.test    oxc: checks with oxfmt; --fix writes the file formatted
    ts-plugin      React preset from dependencies / peerDependencies; the prompt starts there
    

    There was no oxc case in lint or format, so --check went unnoticed: dx only uses oxc for the type-check.

Merge Danger

Door: two-way

Blast Radius: rr plugins add / remove

  • An interactive add stays the same, except that ts starts on the React preset when there's a react dependency.
  • An existing biome.json keeps its own $schema, because the patch path only sets it if it's missing.
  • rr plugins remove from a script without --yes now exits 1 instead of hanging.
  • Saving run-run.config.mts joins any blank lines between consecutive imports, including ones a user left to separate groups.

Not fixed here, for later:

  • rr plugins add tsdown doesn't install typescript, but @rrlab/tsdown-config builds with dts: true. A project with tsdown and no ts plugin fails rr pack ("TypeScript is not installed").
  • The patch path (an existing biome.json) can still write a file Biome reformats.
  • The ts plugin rewrites @types/node to >=20.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Tj9MBgi2cQcRxSD9uikx6k

@changeset-bot

changeset-bot Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: c9903ab

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

This PR includes changesets to release 4 packages
Name Type
@rrlab/biome-plugin Patch
@rrlab/cli Patch
@rrlab/oxc-plugin Patch
@rrlab/ts-plugin Patch

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 and others added 5 commits October 17, 2026 19:08
…e-terminated

magicast's imports.$add puts each new import first, so after
`rr plugins add tsdown`, `ts` and `biome` the imports came in reverse, and
recast dropped the final newline: `rr jsc` failed on the file rr had just
written.

Move each added import to its place in Biome's organizeImports order, without
reordering the others, join the blank lines recast leaves between imports, and
end the file with a newline.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Tj9MBgi2cQcRxSD9uikx6k
The scaffold came out of JSON.stringify, which puts the one-item `extends`
array on three lines, so Biome's own format check failed. Its `$schema` was a
2.4.4 URL while the plugin installs `@biomejs/biome@^2.0.0`.

Write it in Biome's format, and point `$schema` at the installed Biome's
configuration_schema.json, which always matches its version.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Tj9MBgi2cQcRxSD9uikx6k
`rr lint` ran `oxlint --check`, which exits with "`--check` is not expected in
this context" (1.66 and 1.88 alike), and `rr format --fix` ran `oxfmt --fix`
where oxfmt writes with `--write`. dx only uses oxc for the type-check, so no
test ran either.

Run oxlint without a mode flag to check, and oxfmt with `--write` to fix. Add
oxc cases to the lint and format integration tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Tj9MBgi2cQcRxSD9uikx6k
…s on react

With `--yes` or without a TTY, `rr plugins add ts` always picked the Node.js
app preset, which can't type-check a React app (no DOM lib, no JSX).

Default to the React preset when react is in dependencies, devDependencies or
peerDependencies. It's also where the interactive prompt now starts.

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

Only --yes made `rr plugins add` non-interactive, so from an agent or CI it
waited on "Scaffold biome.json?" or exited 13 on a closed stdin, with the
plugin installed but not configured. `rr plugins remove` waited on its
confirmation the same way.

Treat a run without a TTY on stdin and stdout as unattended. add takes the
defaults, as with --yes. remove, which deletes files and dependencies, stops
with an error that asks for --yes. The integration tests add plugins with a
pnpm stub and then run `rr jsc` on the result.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Tj9MBgi2cQcRxSD9uikx6k
@rqbazan
rqbazan force-pushed the fix/rr-plugins-add-unattended branch from 6c531ee to c9903ab Compare October 18, 2026 00:09
@rqbazan
rqbazan changed the base branch from chore/bump-tsgolint to main October 18, 2026 00:09
@rqbazan rqbazan closed this Oct 18, 2026
@rqbazan rqbazan reopened this Oct 18, 2026
@vland-bot

vland-bot Bot commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

Preview release

Latest commit: c9903ab

Some packages have been released:

Package Version Install
@rrlab/biome-plugin 1.1.5-git-c9903ab.0 @rrlab/biome-plugin@1.1.5-git-c9903ab.0
@rrlab/cli 1.3.6-git-c9903ab.0 @rrlab/cli@1.3.6-git-c9903ab.0
@rrlab/oxc-plugin 1.1.5-git-c9903ab.0 @rrlab/oxc-plugin@1.1.5-git-c9903ab.0
@rrlab/ts-plugin 1.1.5-git-c9903ab.0 @rrlab/ts-plugin@1.1.5-git-c9903ab.0

Note

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

pnpm add @rrlab/biome-plugin@pr-276

@rqbazan
rqbazan merged commit db8398e into main Oct 18, 2026
8 checks passed
@rqbazan
rqbazan deleted the fix/rr-plugins-add-unattended branch October 18, 2026 04:15
@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