Skip to content

feat: print all entries and schema URLs in non-TTY mode (#2226)#2227

Merged
upupming merged 3 commits intolynx-family:mainfrom
knullptr:feat/no-tty
Feb 24, 2026
Merged

feat: print all entries and schema URLs in non-TTY mode (#2226)#2227
upupming merged 3 commits intolynx-family:mainfrom
knullptr:feat/no-tty

Conversation

@knullptr
Copy link
Copy Markdown
Contributor

@knullptr knullptr commented Feb 12, 2026

In non-TTY environments (CI/CD, AI coding agents, piped output), the interactive loop was skipped and only the first entry's QR code was rendered — which is useless in these contexts.

Now registerConsoleShortcuts detects non-TTY and prints a structured list of all entries with all schema URLs, buffered into a single write to avoid interleaving with other async output.

Summary by CodeRabbit

  • New Features
    • Non-TTY support: plugin now prints all entries and all schema URLs in non-interactive environments and invokes provided callbacks for each URL.
  • Tests
    • Added test coverage for non-TTY behavior, ensuring output content, callback invocation, and no interactive loop.
  • Chores
    • Published a patch changeset documenting the non-TTY output behavior.

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).
  • Changeset added, and when a BREAKING CHANGE occurs, it needs to be clearly marked (or not required).

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Feb 12, 2026

🦋 Changeset detected

Latest commit: 55273a4

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

This PR includes changesets to release 1 package
Name Type
@lynx-js/qrcode-rsbuild-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

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Feb 12, 2026

📝 Walkthrough

Walkthrough

A non-TTY handling path was added to the QR code plugin's registerConsoleShortcuts: when stdin or stdout is not a TTY, a new printNonTTY function prints all entries and their schema URLs in a structured format, invokes onPrint callbacks, and returns early instead of running the interactive loop.

Changes

Cohort / File(s) Summary
QR Code Plugin Implementation
packages/rspeedy/plugin-qrcode/src/shortcuts.ts
Adds non-TTY branch that unconditionally calls loop but returns early for non-TTY by invoking new async printNonTTY(options) which prints all entries and schema URLs and triggers onPrint callbacks.
QR Code Plugin Tests
packages/rspeedy/plugin-qrcode/test/shortcuts.test.ts
Adds non-TTY mode test suite: simulates non-TTY stdio, asserts single write containing all entries and Lynx bundle URLs, verifies onPrint called for every generated URL, ensures interactive prompts are not invoked, and tests multiple schema URLs per entry.
Release Notes
.changeset/buffer-nontty-output.md
New changeset documenting patch release: in non-TTY environments print all entries with all schema URLs rather than only a single QR code.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related issues

Possibly related PRs

Suggested reviewers

  • upupming
  • colinaaa
  • luhc228

Poem

🐰 A hop through code, no TTY to bind,

I print each link for every find.
No prompts to chase, just URLs in sight,
Each entry shown in plain daylight,
A rabbit cheers for output kind.

🚥 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 'feat: print all entries and schema URLs in non-TTY mode' clearly and accurately summarizes the main change - adding support for printing all entries and schema URLs in non-TTY environments, which directly matches the file changes and PR objectives.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copy link
Copy Markdown
Contributor

@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: 1

🤖 Fix all issues with AI agents
In `@packages/rspeedy/plugin-qrcode/src/shortcuts.ts`:
- Line 94: S_BAR_END is being pushed raw into the lines array while S_BAR
symbols are wrapped with color.gray; update the usage where
lines.push(`${S_BAR_END}`) is called so S_BAR_END is wrapped with color.gray
(same wrapper used for S_BAR) to keep bar symbol coloring consistent (locate the
lines.push call for S_BAR_END and mirror the color.gray(...) usage applied to
S_BAR).
🧹 Nitpick comments (1)
packages/rspeedy/plugin-qrcode/test/shortcuts.test.ts (1)

55-73: Consider using afterEach for writeSpy cleanup to guard against assertion failures.

If an assertion throws before writeSpy.mockRestore() is reached, the spy leaks into subsequent tests. Moving the restore into an afterEach (or using vitest's vi.restoreAllMocks config) would be more robust.

Also applies to: 108-131

…2226)

In non-TTY environments (CI/CD, AI coding agents, piped output),
the interactive loop was skipped and only the first entry's QR code
was rendered — which is useless in these contexts.

Now `registerConsoleShortcuts` detects non-TTY and prints a structured
list of all entries with all schema URLs, buffered into a single write
to avoid interleaving with other async output.

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

relativeci bot commented Feb 24, 2026

Web Explorer

#7772 Bundle Size — 383.74KiB (0%).

55273a4(current) vs 98b2504 main#7766(baseline)

Bundle metrics  no changes
                 Current
#7772
     Baseline
#7766
No change  Initial JS 154.88KiB 154.88KiB
No change  Initial CSS 35.06KiB 35.06KiB
No change  Cache Invalidation 0% 0%
No change  Chunks 8 8
No change  Assets 8 8
No change  Modules 238 238
No change  Duplicate Modules 16 16
No change  Duplicate Code 2.99% 2.99%
No change  Packages 4 4
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#7772
     Baseline
#7766
No change  JS 252.83KiB 252.83KiB
No change  Other 95.85KiB 95.85KiB
No change  CSS 35.06KiB 35.06KiB

Bundle analysis reportBranch knullptr:feat/no-ttyProject dashboard


Generated by RelativeCIDocumentationReport issue

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Feb 24, 2026

Merging this PR will degrade performance by 5.47%

⚡ 1 improved benchmark
❌ 1 regressed benchmark
✅ 61 untouched benchmarks
⏩ 3 skipped benchmarks1

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Benchmark BASE HEAD Efficiency
transform 1000 view elements 45.1 ms 40.4 ms +11.46%
basic-performance-small-css 7.6 ms 8 ms -5.47%

Comparing knullptr:feat/no-tty (55273a4) with main (98b2504)

Open in CodSpeed

Footnotes

  1. 3 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@upupming
Copy link
Copy Markdown
Collaborator

LGTM, thanks!

@upupming upupming merged commit 49c1b7b into lynx-family:main Feb 24, 2026
45 of 46 checks passed
colinaaa pushed a commit that referenced this pull request Mar 2, 2026
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @lynx-js/react@0.116.4

### Patch Changes

- Support `ReactLynx::hooks::setState` trace for function components.
([#2198](#2198))

- fix: properly cleanup `__DestroyLifetime` listeners and listCallbacks
in `snapshotDestroyList`.
([#2224](#2224))

## @lynx-js/qrcode-rsbuild-plugin@0.4.6

### Patch Changes

- Print all entries with all schema URLs in non-TTY environments instead
of only showing the first entry's QR code.
([#2227](#2227))

## @lynx-js/react-rsbuild-plugin@0.12.9

### Patch Changes

- Add alias for `use-sync-external-store/with-selector.js` and
`use-sync-external-store/shim/with-selector.js` pointing to
@lynx-js/use-sync-external-store.
([#2200](#2200))

- Updated dependencies
\[[`9033e2d`](9033e2d)]:
    -   @lynx-js/template-webpack-plugin@0.10.4
    -   @lynx-js/react-alias-rsbuild-plugin@0.12.9
    -   @lynx-js/use-sync-external-store@1.5.0
    -   @lynx-js/react-refresh-webpack-plugin@0.3.4
    -   @lynx-js/react-webpack-plugin@0.7.4
    -   @lynx-js/css-extract-webpack-plugin@0.7.0

## @lynx-js/css-serializer@0.1.4

### Patch Changes

- Move `cssChunksToMap` implementation from
`@lynx-js/template-webpack-plugin` to `@lynx-js/css-serializer` for
future reuse.
([#2269](#2269))

## @lynx-js/web-core-wasm@0.0.4

### Patch Changes

- Refactor web element templates and server-side rendering logic
([#2205](#2205))

- Updated dependencies
\[[`94e5779`](94e5779),
[`9033e2d`](9033e2d)]:
    -   @lynx-js/web-elements@0.11.3
    -   @lynx-js/css-serializer@0.1.4

## @lynx-js/web-elements@0.11.3

### Patch Changes

- fix: firefox 147+ layout issue
([#2205](#2205))

## @lynx-js/template-webpack-plugin@0.10.4

### Patch Changes

- Move `cssChunksToMap` implementation from
`@lynx-js/template-webpack-plugin` to `@lynx-js/css-serializer` for
future reuse.
([#2269](#2269))

- Updated dependencies
\[[`9033e2d`](9033e2d)]:
    -   @lynx-js/css-serializer@0.1.4

## @lynx-js/react-alias-rsbuild-plugin@0.12.9

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.

2 participants