Getting Started
Prerequisites
- Go 1.23 or higher
- MongoDB 4.4 or higher
- Node.js 18+ (for JS utilities)
- Git for version control
Clone the Repository
Set Up Development Environment
- Install Go dependencies:
- Install Node.js dependencies:
- Configure environment:
- Start MongoDB:
Build and Test
Development Workflow
1. Create a Feature Branch
2. Make Changes
- Follow the Code Style guidelines
- Write tests for new functionality
- Update documentation as needed
3. Run Tests
4. Commit Changes
Use clear, descriptive commit messages:feat:- New featurefix:- Bug fixdocs:- Documentation changesrefactor:- Code refactoringtest:- Adding or updating testsperf:- Performance improvements
5. Push and Create Pull Request
Code Style
Go Code
Follow the Effective Go guidelines:-
Use
gofmtto format code: -
Use
golintfor linting: -
Write clear comments for exported functions:
File Organization
Adding Bytecode Support
To add support for a new Hermes bytecode version (e.g., v97):1. Download Hermes Definitions
Update the download script to include the new version:2. Generate Opcode Package
Run the opcode generator:pkg/hbc/types/opcodes/bcv97/hbc97.go with:
- Instruction definitions
- Opcode-to-instruction maps
- Builtin function names
3. Register the Parser
Editpkg/hbc/bytecode_parser.go and add the new version to GetParser():
4. Test the New Version
Create a test HBC file with the new bytecode version:5. Update Documentation
Add the new version to:reference/bytecode-versions.mdxREADME.mdCLAUDE.md
6. Submit Pull Request
Include in your PR:- Generated opcode package
- Updated parser registration
- Test HBC file (if small enough)
- Updated documentation
Testing Guidelines
Unit Tests
Write tests for all new functionality:Integration Tests
Test end-to-end workflows:Test Coverage
Aim for >80% code coverage:Documentation
Code Documentation
All exported functions must have documentation comments:User Documentation
Update MDX files indocs/ for user-facing changes:
- Guides -
docs/guides/ - API Reference -
docs/reference/ - Development -
docs/development/
Project Structure
Core Packages
| Package | Purpose | Key Files |
|---|---|---|
pkg/hbc | HBC parsing | HBCReader.go, bytecode_parser.go, normalizer.go |
pkg/analyzer | Fingerprinting | compute.go, minhasher.go, service.go |
pkg/database | MongoDB ops | main.go, service.go, models/ |
pkg/pipeline | Package processing | rnprocessor.go, packages.go, security.go |
pkg/cmd | CLI commands | analyze.go, disassemble.go, maintainDatabase.go |
Utility Packages
| Package | Purpose |
|---|---|
pkg/utils | Logging, file I/O, helpers |
pkg/global | Global state and configuration |
Common Development Tasks
Add a New CLI Command
- Create command file in
pkg/cmd/:
- Add tests:
Add a Database Collection
- Create model in
pkg/database/models/:
- Add service methods in
pkg/database/service.go:
Add a New Normalization Level
Editpkg/hbc/types/functionobject.go:
pkg/analyzer/compute.go.
Release Process
- Update version in
main.go - Update CHANGELOG.md
- Tag release:
- Build binaries for all platforms
- Create GitHub release with binaries attached
Getting Help
- GitHub Issues: Report bugs or request features
- Discussions: Ask questions or propose ideas
- Documentation: Check the docs first