Skip to content

fix(oxfmt): Make Rust CLI as just formatting CLI#16768

Merged
graphite-app[bot] merged 1 commit intomainfrom
12-12-fix_oxfmt_make_rust_cli_as_just_formatting_cli
Dec 12, 2025
Merged

fix(oxfmt): Make Rust CLI as just formatting CLI#16768
graphite-app[bot] merged 1 commit intomainfrom
12-12-fix_oxfmt_make_rust_cli_as_just_formatting_cli

Conversation

@leaysgur
Copy link
Member

@leaysgur leaysgur commented Dec 12, 2025

When adding new features primarily using JS via napi, to reduce future maintenance burdens such as missed implementations.

@github-actions github-actions bot added A-cli Area - CLI A-formatter Area - Formatter C-bug Category - Bug labels Dec 12, 2025
Copy link
Member Author

leaysgur commented Dec 12, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

Copy link

@charliecreates charliecreates bot left a comment

Choose a reason for hiding this comment

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

Enabling oxfmt default features in tasks/website_formatter is a potentially significant packaging/CI regression (extra deps, slower builds, possible platform constraints) and doesn’t clearly follow from making the Rust CLI formatting-only. Also, relying on cfg_attr(... expect(irrefutable_let_patterns)) in FormatRunner weakens compile-time guarantees; a small cfg-split can encode the invariant more robustly.

Summary of changes

Summary

This PR narrows the pure Rust oxfmt CLI to be a formatting-only entrypoint and gates non-formatting modes behind the napi feature.

Key changes

  • Mode::{Init,Lsp} are now #[cfg(feature = "napi")]
    • apps/oxfmt/src/cli/command.rs wraps the --init and --lsp flag parsing in cfg(feature = "napi") blocks.
    • When napi is not enabled, only the formatting output mode parser is exposed with a Mode::Cli(OutputMode::Write) fallback.
  • FormatRunner assumes Mode::Cli
    • apps/oxfmt/src/cli/format.rs keeps the Mode::Cli destructure, adding a cfg_attr to silence the irrefutable pattern lint when napi is disabled.
  • main.rs becomes formatting-only
    • Removes the match over Mode and always initializes tracing/miette/rayon then runs FormatRunner.
  • Website formatter now uses oxfmt default features
    • tasks/website_formatter/Cargo.toml switches from default-features = false to default features enabled.

@charliecreates charliecreates bot removed the request for review from CharlieHelps December 12, 2025 03:55
@leaysgur leaysgur requested a review from Dunqing December 12, 2025 04:42
@graphite-app graphite-app bot added the 0-merge Merge with Graphite Merge Queue label Dec 12, 2025
@graphite-app
Copy link
Contributor

graphite-app bot commented Dec 12, 2025

Merge activity

@graphite-app graphite-app bot force-pushed the 12-12-fix_oxfmt_remove_jsonc_parser_override_for_tsconfig.json branch from 1323c0e to 2577814 Compare December 12, 2025 05:30
graphite-app bot pushed a commit that referenced this pull request Dec 12, 2025
When adding new features primarily using JS via napi, to reduce future maintenance burdens such as missed implementations.
@graphite-app graphite-app bot force-pushed the 12-12-fix_oxfmt_make_rust_cli_as_just_formatting_cli branch from ca7f3b3 to b6f4a3e Compare December 12, 2025 05:31
Base automatically changed from 12-12-fix_oxfmt_remove_jsonc_parser_override_for_tsconfig.json to main December 12, 2025 05:37
@graphite-app graphite-app bot added 0-merge Merge with Graphite Merge Queue and removed 0-merge Merge with Graphite Merge Queue labels Dec 12, 2025
When adding new features primarily using JS via napi, to reduce future maintenance burdens such as missed implementations.
Copilot AI review requested due to automatic review settings December 12, 2025 05:44
@graphite-app graphite-app bot force-pushed the 12-12-fix_oxfmt_make_rust_cli_as_just_formatting_cli branch from b6f4a3e to d719988 Compare December 12, 2025 05:44
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@graphite-app graphite-app bot merged commit d719988 into main Dec 12, 2025
18 checks passed
@graphite-app graphite-app bot deleted the 12-12-fix_oxfmt_make_rust_cli_as_just_formatting_cli branch December 12, 2025 05:49
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Dec 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-cli Area - CLI A-formatter Area - Formatter C-bug Category - Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants