[PR #734] Add Rust implementation of JS variable renamer (humanify-rs) #731

Open
opened 2026-03-03 13:55:52 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/jehna/humanify/pull/734
Author: @jehna
Created: 2/1/2026
Status: 🔄 Open

Base: mainHead: claude/rust-ast-rewrite-SjZI6


📝 Commits (4)

  • 48f00c8 Add Rust implementation of JS variable renamer (humanify-rs)
  • b0f85f3 Add LLM inference module with llama.cpp bindings
  • 01cbb29 Add LocalRenamer and unminify module for local LLM variable renaming
  • 265b7ef Add CLI binary for humanify-rs with local and download commands

📊 Changes

14 files changed (+4395 additions, -0 deletions)

View changed files

humanify-rs/.gitignore (+1 -0)
humanify-rs/Cargo.lock (+1966 -0)
humanify-rs/Cargo.toml (+42 -0)
humanify-rs/src/bin/humanify.rs (+258 -0)
humanify-rs/src/error.rs (+19 -0)
humanify-rs/src/identifier.rs (+166 -0)
humanify-rs/src/lib.rs (+37 -0)
humanify-rs/src/llm/grammar.rs (+282 -0)
humanify-rs/src/llm/mod.rs (+23 -0)
humanify-rs/src/llm/model.rs (+253 -0)
humanify-rs/src/llm/prompt.rs (+282 -0)
humanify-rs/src/llm/unminify.rs (+286 -0)
humanify-rs/src/renamer.rs (+87 -0)
humanify-rs/src/visitor.rs (+693 -0)

📄 Description

This is a Rust rewrite of the core JS AST traversal and variable renaming functionality. Key features:

  • Parse JavaScript to AST using oxc parser
  • Visit all binding identifiers (variables, functions, classes, params)
  • Process identifiers from largest scope to smallest for correct renaming
  • Support callback-based renaming via the Renamer trait
  • Handle shadowed variables, reserved keywords, and name collisions
  • Apply renames via text replacement

The implementation passes 24 tests ported from the TypeScript version, covering scope ordering, shadowing, class methods, object properties, and various edge cases.

https://claude.ai/code/session_019FrkBNBMtr3yPtHoYzKHDa


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/jehna/humanify/pull/734 **Author:** [@jehna](https://github.com/jehna) **Created:** 2/1/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `claude/rust-ast-rewrite-SjZI6` --- ### 📝 Commits (4) - [`48f00c8`](https://github.com/jehna/humanify/commit/48f00c8f2930155a3ef0def9a003c9f994d31a94) Add Rust implementation of JS variable renamer (humanify-rs) - [`b0f85f3`](https://github.com/jehna/humanify/commit/b0f85f3a41f3cd5cea6847cff44fc9c0235bdcaa) Add LLM inference module with llama.cpp bindings - [`01cbb29`](https://github.com/jehna/humanify/commit/01cbb297d22dd4c01475704e58c23ce04e212693) Add LocalRenamer and unminify module for local LLM variable renaming - [`265b7ef`](https://github.com/jehna/humanify/commit/265b7ef6bb45504ef8405d583186549c0453ed2e) Add CLI binary for humanify-rs with local and download commands ### 📊 Changes **14 files changed** (+4395 additions, -0 deletions) <details> <summary>View changed files</summary> ➕ `humanify-rs/.gitignore` (+1 -0) ➕ `humanify-rs/Cargo.lock` (+1966 -0) ➕ `humanify-rs/Cargo.toml` (+42 -0) ➕ `humanify-rs/src/bin/humanify.rs` (+258 -0) ➕ `humanify-rs/src/error.rs` (+19 -0) ➕ `humanify-rs/src/identifier.rs` (+166 -0) ➕ `humanify-rs/src/lib.rs` (+37 -0) ➕ `humanify-rs/src/llm/grammar.rs` (+282 -0) ➕ `humanify-rs/src/llm/mod.rs` (+23 -0) ➕ `humanify-rs/src/llm/model.rs` (+253 -0) ➕ `humanify-rs/src/llm/prompt.rs` (+282 -0) ➕ `humanify-rs/src/llm/unminify.rs` (+286 -0) ➕ `humanify-rs/src/renamer.rs` (+87 -0) ➕ `humanify-rs/src/visitor.rs` (+693 -0) </details> ### 📄 Description This is a Rust rewrite of the core JS AST traversal and variable renaming functionality. Key features: - Parse JavaScript to AST using oxc parser - Visit all binding identifiers (variables, functions, classes, params) - Process identifiers from largest scope to smallest for correct renaming - Support callback-based renaming via the Renamer trait - Handle shadowed variables, reserved keywords, and name collisions - Apply renames via text replacement The implementation passes 24 tests ported from the TypeScript version, covering scope ordering, shadowing, class methods, object properties, and various edge cases. https://claude.ai/code/session_019FrkBNBMtr3yPtHoYzKHDa --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/humanify#731
No description provided.