You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Configure package metadata for crates.io
- Add GitHub workflows for automated publishing and releases
- Create CHANGELOG.md for version tracking
- Add PUBLISHING.md with publishing guide
- Add CLAUDE.md with codebase instructions
- Fix unused import warning
- Set binary name as 'abi2human'
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
+
5
+
## Commands
6
+
7
+
### Build
8
+
```bash
9
+
# Debug build
10
+
cargo build
11
+
12
+
# Release build (optimized)
13
+
cargo build --release
14
+
```
15
+
16
+
### Test
17
+
```bash
18
+
# Run all tests
19
+
cargo test
20
+
21
+
# Run tests with output
22
+
cargo test -- --nocapture
23
+
24
+
# Run specific test
25
+
cargo test test_name
26
+
```
27
+
28
+
### Lint & Format
29
+
```bash
30
+
# Format code
31
+
cargo fmt
32
+
33
+
# Check formatting without applying
34
+
cargo fmt -- --check
35
+
36
+
# Run clippy for linting
37
+
cargo clippy
38
+
39
+
# Run clippy with all targets
40
+
cargo clippy --all-targets --all-features
41
+
```
42
+
43
+
### Run
44
+
```bash
45
+
# Run debug version
46
+
cargo run -- [args]
47
+
48
+
# Run release version
49
+
cargo run --release -- [args]
50
+
51
+
# Or use the compiled binary
52
+
./target/release/abi2human [args]
53
+
```
54
+
55
+
## Architecture
56
+
57
+
This is a zero-dependency Rust CLI tool that converts Ethereum ABI JSON to human-readable format. The codebase is modular with clear separation of concerns:
58
+
59
+
### Core Modules
60
+
61
+
-**`abi.rs`**: Defines ABI data structures (`AbiItem`, `AbiInput`, `AbiOutput`) and implements their Display traits for human-readable formatting
62
+
-**`json_parser.rs`**: Custom JSON parser that handles ABI parsing without external dependencies
63
+
-**`converter.rs`**: Orchestrates the conversion process - parses ABI content and formats output
64
+
-**`file_ops.rs`**: Handles all file I/O operations including single file, directory, and stdin/stdout processing
65
+
-**`main.rs`**: CLI entry point with argument parsing and command routing
66
+
-**`tests.rs`**: Comprehensive test suite
67
+
68
+
### Key Design Patterns
69
+
70
+
1.**Zero Dependencies**: All JSON parsing and formatting is implemented from scratch to avoid supply chain risks
71
+
2.**Stream Processing**: The tool can process stdin to stdout for pipeline integration
72
+
3.**Batch Operations**: Supports converting entire directories with pattern matching
73
+
4.**Multiple Output Formats**: JSON array, raw text, or compact JSON
74
+
75
+
### Data Flow
76
+
77
+
1. Input (file/directory/stdin) →
78
+
2. JSON Parser (converts to ABI structures) →
79
+
3. Converter (formats to human-readable) →
80
+
4. Output (file/stdout with chosen format)
81
+
82
+
The tool is designed to be fast, secure, and easily auditable with no external dependencies.
0 commit comments