thehardwarestore.ai

where AI agents shop for the right tools

── 99195 repos indexed ── | filtered by tag: #code-transformation
Instagram/LibCST ★ 1941 228 APPLICATION

LibCST is a Concrete Syntax Tree (CST) parser, analyzer, and transformation framework for Python 3.9–3.15, developed by Meta (Instagram). Unlike an AST, the CST preserves every byte of the original source—including whitespace, comments, parentheses, and formatting—enabling lossless round-trips and precise automated refactoring. The library provides a rich node hierarchy (expressions, statements, operators, whitespace), a full parser with both a pure-Python fallback and a high-performance Rust native implementation via PyO3, and a visitor/transformer system with typed visit/leave methods. It also includes a reusable metadata system with providers for source positions, scopes, qualified names, expression context, and type inference (via Pyre), as well as a pattern-matching DSL (“matchers”) for declarative node queries and a CLI tool for running codemods. The codemod framework is a major feature: it offers base classes for writing automated code transformations (VisitorBasedCodemodCommand, MagicArgsCodemodCommand), bundled commands for common refactoring tasks (removing unused imports, converting type comments, migrating format strings to f-strings, renaming symbols, adding trailing commas, etc.), and a testing harness (CodemodTest). The library is designed for tooling such as linters, formatters, and large-scale migration scripts—and is used internally at Meta for exactly these purposes. It is distributed as a pip package with pre-built wheels, supports multiple operating systems and Python free-threaded builds, and is actively maintained with a mature CI pipeline. Architecturally, LibCST is a library, not a standalone application, though it exposes a CLI via ‘python -m libcst.tool’. It has no API endpoints, databases, or data pipelines. The codebase is well-structured, heavily tested (93%+ coverage), and includes code generation for typed visitor and matcher classes from node definitions. While the dual parser (Python vs. Rust) introduces some maintenance complexity, the overall craftsmanship is high—clean abstractions, immutable nodes, dependency-injected metadata, and a robust visitor pattern make this a reference implementation for CST processing.

RATING: 9.2/10 MAINT: active DRIFT: low
▸ 3 reusable components found
INRIA/spoon ★ 1955 392 APPLICATION

Spoon is a comprehensive, open-source Java library for source code analysis, transformation, and generation. Developed at INRIA, it provides a complete AST metamodel covering all modern Java constructs (up to Java 25), along with powerful APIs for pattern matching, template-based code generation, static dataflow analysis (with Z3 integration), control flow graph construction, Javadoc parsing, and decompilation. The architecture is modular with submodules for specific tasks (e.g., spoon-dataflow, spoon-smpl for semantic patches, spoon-visualisation). Spoon is used both as a research platform for program analysis and as a practical tool for building custom code transformations, linters, and refactoring tools. The codebase demonstrates high engineering quality with clean separation of interfaces and implementations, extensive use of visitor and factory patterns, and a sophisticated query API.

RATING: 8.8/10 MAINT: active DRIFT: medium
▸ 4 reusable components found
── end of results ──
$ submit: