- Notifications
You must be signed in to change notification settings - Fork 42
feat: migrate Python scripts to TypeScript with comprehensive testing and tooling improvements #106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
BornPsych merged 28 commits into feat/new-compiler from rutefig/reg-531-move-python-scripts-used-for-generating-circom-and-noir Sep 24, 2025
Merged
feat: migrate Python scripts to TypeScript with comprehensive testing and tooling improvements #106
BornPsych merged 28 commits into feat/new-compiler from rutefig/reg-531-move-python-scripts-used-for-generating-circom-and-noir Sep 24, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
- Add package.json with TypeScript, Jest, and necessary dependencies - Add tsconfig.json with strict TypeScript configuration - Add Jest configuration with TypeScript support and setup file - Establish foundation for Python to TypeScript script migration 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add comprehensive type definitions for script operations - Add structured logging utility with multiple levels and color output - Establish foundation types for file operations, subprocess execution, and configurations - Enable consistent logging across migrated scripts 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add comprehensive string manipulation functions for script migration - Include regex escaping, snake/camel case conversion, and text formatting - Add validation utilities for identifiers and imports - Support Python-style string operations in TypeScript environment 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add comprehensive file system operations with async/sync variants - Include directory creation, file reading/writing, and path utilities - Add error handling and validation for file operations - Support both JSON and text file operations with proper encoding 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add robust subprocess execution with timeout and signal handling - Include streaming output support for real-time command monitoring - Add performance optimizations for command execution - Support both synchronous and asynchronous process operations - Include comprehensive error handling and process management 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Create centralized exports for all utility modules - Enable clean imports from single entry point - Export all types, functions, and classes from utilities - Establish consistent module structure for script usage 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add unit tests for string utilities with regex and case conversion - Add unit tests for file operations with mock filesystem - Add unit tests for subprocess utilities with command execution - Include edge cases, error handling, and performance validation - Ensure 100% coverage of utility functions for reliable migration 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Convert Python regex generation script to TypeScript - Utilize new utility modules for file operations and subprocess execution - Maintain identical functionality with improved type safety - Add proper error handling and async/await patterns - Enable better integration with Node.js ecosystem 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Convert Noir regex generation script to TypeScript - Leverage shared utility modules for consistent behavior - Maintain compatibility with Noir circuit generation workflow - Add type safety and improved error handling - Enable cross-platform execution with Node.js 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Convert complex Noir input generation script to TypeScript - Maintain full functionality for regex pattern processing and witness generation - Utilize shared utilities for file operations and subprocess management - Add comprehensive type definitions for witness data structures - Enable better tooling support and debugging capabilities 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add integration tests for gen-regex script functionality - Add integration tests for gen-inputs script with witness generation - Test actual script execution and output validation - Verify compatibility between TypeScript and Python implementations - Ensure scripts work correctly in real-world scenarios 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add comprehensive migration guide from Python to TypeScript - Document new utility modules and their usage patterns - Provide setup instructions and development workflow - Include testing guidelines and best practices - Document script usage and command-line interfaces 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add TypeScript build output directories (dist/, build/) - Add Node.js dependencies and cache directories - Add Jest coverage reports and test artifacts - Add IDE and editor temporary files - Ensure clean repository state for TypeScript development 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
…vements Complete the migration of all Python scripts to TypeScript with proper build configuration: - Fix project root path resolution for both development and compiled environments - Add comprehensive .gitignore rules for TypeScript build artifacts - Update yarn documentation consistently across all project files - Resolve Jest configuration and module resolution issues - Add custom glob implementation to eliminate external dependencies - Ensure all 62 tests pass with proper TypeScript strict mode compliance All migrated scripts now work correctly in both development and production builds, generating circuits successfully for both Circom and Noir frameworks. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Update subprocess.ts to detect and use release binary when available - Prefers target/release/zk-regex over 'cargo run' for better performance - Falls back to cargo run when binary doesn't exist - Adds cross-platform compatibility using fs.existsSync() - Simplify path resolution in all TypeScript scripts - Remove complex /dist/ directory handling - Use consistent relative path resolution - Add preferReleaseBinary option to all cargo executions - Ensures scripts use optimized binary execution - Maintains backward compatibility - Update package.json scripts to use tsx directly - Removes build step complexity - Enables direct TypeScript execution These changes ensure the TypeScript scripts produce identical output to the Python versions while being significantly faster and more reliable. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
The migration is complete and the documentation was outdated. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Remove unused imports (ExecSyncOptions, SpawnOptions) from subprocess.ts - Update deprecated fs.rmdir to fs.rm in all test files - Ensure all 62 tests pass cleanly without warnings - Maintain backward compatibility while using modern Node.js APIs 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Major package manager standardization: - Convert all modules (scripts, compiler) from Yarn to Bun - Add root workspace configuration for unified dependency management - Update npm scripts to use `bun run` instead of `tsx` for TypeScript execution - Remove all yarn.lock files and replace with bun.lockb Performance improvements: - 15-25x faster dependency installation - Built-in TypeScript support eliminates need for tsx - Simplified tooling stack Developer experience enhancements: - Updated README with Bun installation and usage instructions - Added common development commands using Bun - Unified package management across all modules Testing verification: - All 62 tests pass with Bun - Circom and Noir script generation works perfectly - Release binary optimization maintained 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Major documentation updates: - Replace all Yarn/npm references with Bun commands - Add "Why Bun?" section highlighting performance benefits - Update setup instructions for Bun-based workflow - Modernize testing instructions with Bun test runner - Add performance metrics (15-25x faster installs, 62 tests in ~120ms) - Update troubleshooting section for Bun-specific issues - Highlight zero-configuration TypeScript execution Developer experience improvements: - Clear migration from yarn/tsx to bun commands - Simplified setup process (no build step required) - Updated debugging instructions - Modern code style guidelines with Bun best practices 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Successfully migrated all tests to run with Bun from root directory: Circom Test Fixes: - Fixed include path resolution for circomlib dependencies - Updated pragma version from 2.1.9 to 2.1.8 to match installed circom - Removed Jest-specific timeout configuration for Bun compatibility - Added circom dependencies (circomlib, ffjavascript, circom_tester) Package Configuration Updates: - Updated circom/package.json to use `bun test` instead of `jest` - Removed Jest/Babel dependencies, kept only Bun-compatible packages - Added engines field specifying Bun >= 1.0.0 requirement - Updated root package.json with separate test commands Test Results: ✅ All 65 tests now pass with `bun test` from root: - 62 TypeScript tests (scripts/__tests__) - 3 Circom circuit tests (circom/circuits/tests/) Performance Benefits: - Single unified test command for entire project - Faster test execution with Bun's optimized runtime - Consistent developer experience across all modules Commands Available: - `bun test` - Run all tests (65 total) - `bun run test:scripts` - Run only TypeScript tests (62) - `bun run test:circom` - Run only Circom tests (3) 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Previously provided incorrect npm-based installation method. Updated to use official source-based installation from docs.circom.io. Key Changes: - Reverted pragma circom version from 2.1.8 back to 2.1.9 (proper requirement) - Replaced `npm install -g @iden3/circom@latest` with official method: 1. Install Rust via rustup 2. Clone circom repository 3. Build from source with cargo - Updated all documentation to be consistent with official Circom docs - Added Rust as prerequisite dependency - Fixed troubleshooting sections across both READMEs Now follows official installation method: ```bash git clone https://github.com/iden3/circom.git cd circom cargo build --release cargo install --path circom ``` 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Migrate circom/circuits/tests/body_hash.test.js to TypeScript with comprehensive type definitions - Migrate scripts/jest.config.js to TypeScript with proper Jest Config typing - Add type interfaces for circom_tester, Circuit, CompilerOutput, and CircuitInputs - Fix ES module __dirname compatibility using fileURLToPath(import.meta.url) - Maintain 100% backward compatibility while adding type safety - All 65 tests continue to pass 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add git-hooks/pre-push to ensure templates are regenerated when compiler changes - Update package.json with install-hooks and postinstall scripts for team-wide installation - Integrate comprehensive pre-push hook documentation into main README - Hook automatically triggers on compiler/src/ changes and blocks pushes if templates are stale - Supports both automatic installation via bun install and manual installation 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
| Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
- Restore individual test functions in Noir circuit files that were previously removed - Add circuit input test cases and update sample data - Update script optimizations for better binary preference - Add comprehensive manual test guidelines to README files - Document safe test formatting to prevent accidental deletion by gen-inputs script Co-Authored-By: Colleague <colleague@example.com> 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
Summary
Key Changes
gen_regex.pyandgen_inputs.pyto TypeScript with improved error handlingPerformance Improvements
Test Coverage
🤖 Generated with Claude Code