Skip to content

Rewrite pgfmt CLI in Rust using libpgfmt#3

Merged
gmr merged 8 commits into
mainfrom
feature/rust-rewrite
Mar 30, 2026
Merged

Rewrite pgfmt CLI in Rust using libpgfmt#3
gmr merged 8 commits into
mainfrom
feature/rust-rewrite

Conversation

@gmr

@gmr gmr commented Mar 30, 2026

Copy link
Copy Markdown
Owner

Summary

  • Rewrites the pgfmt CLI from Python to Rust, powered by libpgfmt
  • Adds justfile, install script, release workflow, and pre-commit config
  • Changes default formatting style from river to aweber (libpgfmt 1.1.0)
  • Removes all Python source, tests, fixtures, and build artifacts

Test plan

  • cargo check passes
  • cargo test passes
  • just check runs formatting, linting, and tests successfully
  • Verify --style flag defaults to aweber
  • Test stdin and file input modes

Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com

gmr and others added 8 commits March 28, 2026 20:08
- Replace Python implementation with Rust CLI using clap and libpgfmt
- Add GitHub Actions release workflow for cross-platform binaries
- Add curl-based install script for Linux/macOS (x86_64/aarch64)
- Update CI to run cargo fmt, clippy, and cargo test
- Remove Python source, tests, pyproject.toml, and pre-commit config

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Replace PyPI badges and install instructions with GitHub Releases
- Add curl installer, cargo install, and direct download options
- Bump version to 1.0.0
- Update parser reference from pgparse to tree-sitter-postgres

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Remove mkdocs, docs workflow, and guide PDFs
- Add pre-commit config with cargo fmt, clippy, and test hooks
- Update CLAUDE.md for Rust project structure

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add a summary table at the top of the Styles section linking to each
style guide source. Include the AWeber SQL style guide doc and fix
the mattmc3 link (repo moved to a Gist).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Update libpgfmt dependency to 1.1 to match the new default
style introduced in libpgfmt 1.1.0.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Mar 30, 2026

Copy link
Copy Markdown

Important

Review skipped

Too many files!

This PR contains 169 files, which is 19 over the limit of 150.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6cbf3fef-6909-424e-b7d4-2fff0ccd6703

📥 Commits

Reviewing files that changed from the base of the PR and between 73d3412 and 85e1c7f.

⛔ Files ignored due to path filters (4)
  • guides/mozilla.pdf is excluded by !**/*.pdf
  • guides/river-style.pdf is excluded by !**/*.pdf
  • river-style.pdf is excluded by !**/*.pdf
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (169)
  • .github/workflows/deploy.yaml
  • .github/workflows/docs.yaml
  • .github/workflows/release.yaml
  • .github/workflows/testing.yaml
  • .gitignore
  • .pre-commit-config.yaml
  • CLAUDE.md
  • Cargo.toml
  • README.md
  • ci/test
  • docs/api.md
  • docs/cli.md
  • docs/index.md
  • docs/styles.md
  • guides/aweber.md
  • guides/mattmc3.md
  • install.sh
  • justfile
  • mkdocs.yml
  • pyproject.toml
  • src/main.rs
  • src/pgfmt/__init__.py
  • src/pgfmt/aweber.py
  • src/pgfmt/cli.py
  • src/pgfmt/dbt.py
  • src/pgfmt/formatter.py
  • src/pgfmt/gitlab.py
  • src/pgfmt/kickstarter.py
  • src/pgfmt/mattmc3.py
  • src/pgfmt/mozilla.py
  • src/pgfmt/river.py
  • tests/__init__.py
  • tests/fixtures/aweber/select_case_join.expected
  • tests/fixtures/aweber/select_case_join.sql
  • tests/fixtures/aweber/select_cte_nested.expected
  • tests/fixtures/aweber/select_cte_nested.sql
  • tests/fixtures/aweber/select_cte_union.expected
  • tests/fixtures/aweber/select_cte_union.sql
  • tests/fixtures/aweber/select_join.expected
  • tests/fixtures/aweber/select_join.sql
  • tests/fixtures/aweber/select_left_join.expected
  • tests/fixtures/aweber/select_left_join.sql
  • tests/fixtures/aweber/select_or.expected
  • tests/fixtures/aweber/select_or.sql
  • tests/fixtures/aweber/select_simple.expected
  • tests/fixtures/aweber/select_simple.sql
  • tests/fixtures/aweber/select_subquery.expected
  • tests/fixtures/aweber/select_subquery.sql
  • tests/fixtures/dbt/select_cte.expected
  • tests/fixtures/dbt/select_cte.sql
  • tests/fixtures/dbt/select_group_order.expected
  • tests/fixtures/dbt/select_group_order.sql
  • tests/fixtures/dbt/select_join.expected
  • tests/fixtures/dbt/select_join.sql
  • tests/fixtures/dbt/select_simple.expected
  • tests/fixtures/dbt/select_simple.sql
  • tests/fixtures/gitlab/select_cte.expected
  • tests/fixtures/gitlab/select_cte.sql
  • tests/fixtures/gitlab/select_group_order.expected
  • tests/fixtures/gitlab/select_group_order.sql
  • tests/fixtures/gitlab/select_join.expected
  • tests/fixtures/gitlab/select_join.sql
  • tests/fixtures/gitlab/select_simple.expected
  • tests/fixtures/gitlab/select_simple.sql
  • tests/fixtures/kickstarter/select_cte.expected
  • tests/fixtures/kickstarter/select_cte.sql
  • tests/fixtures/kickstarter/select_join.expected
  • tests/fixtures/kickstarter/select_join.sql
  • tests/fixtures/kickstarter/select_simple.expected
  • tests/fixtures/kickstarter/select_simple.sql
  • tests/fixtures/kickstarter/select_where.expected
  • tests/fixtures/kickstarter/select_where.sql
  • tests/fixtures/mattmc3/insert_values.expected
  • tests/fixtures/mattmc3/insert_values.sql
  • tests/fixtures/mattmc3/select_join.expected
  • tests/fixtures/mattmc3/select_join.sql
  • tests/fixtures/mattmc3/select_or.expected
  • tests/fixtures/mattmc3/select_or.sql
  • tests/fixtures/mattmc3/select_simple.expected
  • tests/fixtures/mattmc3/select_simple.sql
  • tests/fixtures/mattmc3/update_multi.expected
  • tests/fixtures/mattmc3/update_multi.sql
  • tests/fixtures/mozilla/create_table.expected
  • tests/fixtures/mozilla/create_table.sql
  • tests/fixtures/mozilla/delete_and.expected
  • tests/fixtures/mozilla/delete_and.sql
  • tests/fixtures/mozilla/insert_multi.expected
  • tests/fixtures/mozilla/insert_multi.sql
  • tests/fixtures/mozilla/select_cte.expected
  • tests/fixtures/mozilla/select_cte.sql
  • tests/fixtures/mozilla/select_group_order.expected
  • tests/fixtures/mozilla/select_group_order.sql
  • tests/fixtures/mozilla/select_join.expected
  • tests/fixtures/mozilla/select_join.sql
  • tests/fixtures/mozilla/select_simple.expected
  • tests/fixtures/mozilla/select_simple.sql
  • tests/fixtures/mozilla/select_single_col.expected
  • tests/fixtures/mozilla/select_single_col.sql
  • tests/fixtures/mozilla/select_subquery.expected
  • tests/fixtures/mozilla/select_subquery.sql
  • tests/fixtures/mozilla/select_union.expected
  • tests/fixtures/mozilla/select_union.sql
  • tests/fixtures/mozilla/select_using_join.expected
  • tests/fixtures/mozilla/select_using_join.sql
  • tests/fixtures/mozilla/update_multi.expected
  • tests/fixtures/mozilla/update_multi.sql
  • tests/fixtures/river/create_domain.expected
  • tests/fixtures/river/create_domain.sql
  • tests/fixtures/river/create_foreign_table.expected
  • tests/fixtures/river/create_foreign_table.sql
  • tests/fixtures/river/create_function.expected
  • tests/fixtures/river/create_function.sql
  • tests/fixtures/river/create_matview.expected
  • tests/fixtures/river/create_matview.sql
  • tests/fixtures/river/create_table.expected
  • tests/fixtures/river/create_table.sql
  • tests/fixtures/river/create_table_with.expected
  • tests/fixtures/river/create_table_with.sql
  • tests/fixtures/river/create_view_cte.expected
  • tests/fixtures/river/create_view_cte.sql
  • tests/fixtures/river/delete_simple.expected
  • tests/fixtures/river/delete_simple.sql
  • tests/fixtures/river/insert_values.expected
  • tests/fixtures/river/insert_values.sql
  • tests/fixtures/river/select_agg_functions.expected
  • tests/fixtures/river/select_agg_functions.sql
  • tests/fixtures/river/select_alias.expected
  • tests/fixtures/river/select_alias.sql
  • tests/fixtures/river/select_and.expected
  • tests/fixtures/river/select_and.sql
  • tests/fixtures/river/select_case.expected
  • tests/fixtures/river/select_case.sql
  • tests/fixtures/river/select_cte.expected
  • tests/fixtures/river/select_cte.sql
  • tests/fixtures/river/select_distinct.expected
  • tests/fixtures/river/select_distinct.sql
  • tests/fixtures/river/select_group_by.expected
  • tests/fixtures/river/select_group_by.sql
  • tests/fixtures/river/select_having.expected
  • tests/fixtures/river/select_having.sql
  • tests/fixtures/river/select_join.expected
  • tests/fixtures/river/select_join.sql
  • tests/fixtures/river/select_or.expected
  • tests/fixtures/river/select_or.sql
  • tests/fixtures/river/select_order_limit.expected
  • tests/fixtures/river/select_order_limit.sql
  • tests/fixtures/river/select_simple.expected
  • tests/fixtures/river/select_simple.sql
  • tests/fixtures/river/select_subquery_exists.expected
  • tests/fixtures/river/select_subquery_exists.sql
  • tests/fixtures/river/select_subquery_in.expected
  • tests/fixtures/river/select_subquery_in.sql
  • tests/fixtures/river/select_subquery_nested.expected
  • tests/fixtures/river/select_subquery_nested.sql
  • tests/fixtures/river/select_subquery_scalar.expected
  • tests/fixtures/river/select_subquery_scalar.sql
  • tests/fixtures/river/select_union.expected
  • tests/fixtures/river/select_union.sql
  • tests/fixtures/river/update_multi_set.expected
  • tests/fixtures/river/update_multi_set.sql
  • tests/fixtures/river/update_simple.expected
  • tests/fixtures/river/update_simple.sql
  • tests/test_aweber.py
  • tests/test_dbt.py
  • tests/test_gitlab.py
  • tests/test_kickstarter.py
  • tests/test_mattmc3.py
  • tests/test_mozilla.py
  • tests/test_river.py

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/rust-rewrite

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.

@gmr gmr merged commit c1b0b6a into main Mar 30, 2026
2 checks passed
@gmr gmr deleted the feature/rust-rewrite branch March 30, 2026 15:56
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