# elcruncharino/hbc-tool architecture

> Architecture diagram of the GitHub repository elcruncharino/hbc-tool, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/elcruncharino/hbc-tool
- Repository: https://github.com/elcruncharino/hbc-tool

## Overview

hbctool is a command-line Hermes bytecode disassembler and assembler. Users disassemble an HBC file into a HASM directory, edit the assembly and string data, then assemble the directory back into bytecode. The implementation dispatches on bytecode version to version-specific parsing and translation code, with shared bit-level utilities. Version-family nodes summarize the modules under their exact existing directories; excerpts of most versions are unavailable, so detailed internal calls and parser-to-translator interactions are not asserted.

Main entry points: [`hbctool/hbc/__init__.py`](https://github.com/elcruncharino/hbc-tool/blob/main/hbctool/hbc/__init__.py) (Version dispatch), [`hbctool/util.py`](https://github.com/elcruncharino/hbc-tool/blob/main/hbctool/util.py) (Bit utilities), [`hbctool/__init__.py`](https://github.com/elcruncharino/hbc-tool/blob/main/hbctool/__init__.py) (CLI commands), [`hbctool/hasm.py`](https://github.com/elcruncharino/hbc-tool/blob/main/hbctool/hasm.py) (HASM conversion)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["CLI workflow"]
  node_commands["CLI commands<br/>[__init__.py]"]
  node_hasm["HASM conversion<br/>[hasm.py]"]
end

subgraph group_core["Bytecode core"]
  node_dispatch["Version dispatch<br/>[__init__.py]"]
  node_bitutils["Bit utilities<br/>[util.py]"]
end

subgraph group_support["Format support"]
  node_v59["HBC 59"]
  node_v62["HBC 62"]
  node_v74["HBC 74"]
  node_v76["HBC 76"]
  node_v83["HBC 83"]
  node_v84["HBC 84"]
  node_v85["HBC 85"]
  node_v86["HBC 86"]
  node_v87["HBC 87"]
  node_v88["HBC 88"]
  node_v89["HBC 89"]
  node_v90["HBC 90"]
  node_v91["HBC 91"]
  node_v92["HBC 92"]
  node_v93["HBC 93"]
  node_v94["HBC 94"]
  node_v95["HBC 95"]
  node_v96["HBC 96"]
  node_v97["HBC 97"]
  node_v98["HBC 98"]
  node_v99["HBC 99"]
end

node_user(("CLI user"))

node_user -->|"invokes"| node_commands
node_commands -->|"routes operations"| node_hasm
node_hasm -->|"uses bytecode API"| node_dispatch
node_dispatch -->|"selects version"| node_v59
node_dispatch -->|"selects version"| node_v62
node_dispatch -->|"selects version"| node_v74
node_dispatch -->|"selects version"| node_v76
node_dispatch -->|"selects version"| node_v83
node_dispatch -->|"selects version"| node_v84
node_dispatch -->|"selects version"| node_v85
node_dispatch -->|"selects version"| node_v86
node_dispatch -->|"selects version"| node_v87
node_dispatch -->|"selects version"| node_v88
node_dispatch -->|"selects version"| node_v89
node_dispatch -->|"selects version"| node_v90
node_dispatch -->|"selects version"| node_v91
node_dispatch -->|"selects version"| node_v92
node_dispatch -->|"selects version"| node_v93
node_dispatch -->|"selects version"| node_v94
node_dispatch -->|"selects version"| node_v95
node_dispatch -->|"selects version"| node_v96
node_dispatch -->|"selects version"| node_v97
node_dispatch -->|"selects version"| node_v98
node_dispatch -->|"selects version"| node_v99
node_v83 -->|"uses bit I/O"| node_bitutils
node_v84 -->|"uses bit I/O"| node_bitutils
node_v85 -->|"uses bit I/O"| node_bitutils
node_v86 -->|"uses bit I/O"| node_bitutils
node_v87 -->|"uses bit I/O"| node_bitutils
node_v88 -->|"uses bit I/O"| node_bitutils
node_v97 -->|"uses bit I/O"| node_bitutils
node_v98 -->|"uses bit I/O"| node_bitutils
node_v99 -->|"uses bit I/O"| node_bitutils

click node_commands "https://github.com/elcruncharino/hbc-tool/blob/main/hbctool/__init__.py"
click node_hasm "https://github.com/elcruncharino/hbc-tool/blob/main/hbctool/hasm.py"
click node_dispatch "https://github.com/elcruncharino/hbc-tool/blob/main/hbctool/hbc/__init__.py"
click node_bitutils "https://github.com/elcruncharino/hbc-tool/blob/main/hbctool/util.py"
click node_v59 "https://github.com/elcruncharino/hbc-tool/tree/main/hbctool/hbc/hbc59"
click node_v62 "https://github.com/elcruncharino/hbc-tool/tree/main/hbctool/hbc/hbc62"
click node_v74 "https://github.com/elcruncharino/hbc-tool/tree/main/hbctool/hbc/hbc74"
click node_v76 "https://github.com/elcruncharino/hbc-tool/tree/main/hbctool/hbc/hbc76"
click node_v83 "https://github.com/elcruncharino/hbc-tool/tree/main/hbctool/hbc/hbc83"
click node_v84 "https://github.com/elcruncharino/hbc-tool/tree/main/hbctool/hbc/hbc84"
click node_v85 "https://github.com/elcruncharino/hbc-tool/tree/main/hbctool/hbc/hbc85"
click node_v86 "https://github.com/elcruncharino/hbc-tool/tree/main/hbctool/hbc/hbc86"
click node_v87 "https://github.com/elcruncharino/hbc-tool/tree/main/hbctool/hbc/hbc87"
click node_v88 "https://github.com/elcruncharino/hbc-tool/tree/main/hbctool/hbc/hbc88"
click node_v89 "https://github.com/elcruncharino/hbc-tool/tree/main/hbctool/hbc/hbc89"
click node_v90 "https://github.com/elcruncharino/hbc-tool/tree/main/hbctool/hbc/hbc90"
click node_v91 "https://github.com/elcruncharino/hbc-tool/tree/main/hbctool/hbc/hbc91"
click node_v92 "https://github.com/elcruncharino/hbc-tool/tree/main/hbctool/hbc/hbc92"
click node_v93 "https://github.com/elcruncharino/hbc-tool/tree/main/hbctool/hbc/hbc93"
click node_v94 "https://github.com/elcruncharino/hbc-tool/tree/main/hbctool/hbc/hbc94"
click node_v95 "https://github.com/elcruncharino/hbc-tool/tree/main/hbctool/hbc/hbc95"
click node_v96 "https://github.com/elcruncharino/hbc-tool/tree/main/hbctool/hbc/hbc96"
click node_v97 "https://github.com/elcruncharino/hbc-tool/tree/main/hbctool/hbc/hbc97"
click node_v98 "https://github.com/elcruncharino/hbc-tool/tree/main/hbctool/hbc/hbc98"
click node_v99 "https://github.com/elcruncharino/hbc-tool/tree/main/hbctool/hbc/hbc99"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_commands,node_hasm,node_user toneBlue
class node_dispatch,node_bitutils toneAmber
class node_v59,node_v62,node_v74,node_v76,node_v83,node_v84,node_v85,node_v86,node_v87,node_v88,node_v89,node_v90,node_v91,node_v92,node_v93,node_v94,node_v95,node_v96,node_v97,node_v98,node_v99 toneMint
```

## Components

### CLI workflow

- [CLI commands](https://github.com/elcruncharino/hbc-tool/blob/main/hbctool/__init__.py): `hbctool/__init__.py`
- [HASM conversion](https://github.com/elcruncharino/hbc-tool/blob/main/hbctool/hasm.py): `hbctool/hasm.py`

### Bytecode core

- [Version dispatch](https://github.com/elcruncharino/hbc-tool/blob/main/hbctool/hbc/__init__.py): `hbctool/hbc/__init__.py`
- [Bit utilities](https://github.com/elcruncharino/hbc-tool/blob/main/hbctool/util.py): `hbctool/util.py`

### Format support

- [HBC 59](https://github.com/elcruncharino/hbc-tool/tree/main/hbctool/hbc/hbc59): `hbctool/hbc/hbc59`
- [HBC 62](https://github.com/elcruncharino/hbc-tool/tree/main/hbctool/hbc/hbc62): `hbctool/hbc/hbc62`
- [HBC 74](https://github.com/elcruncharino/hbc-tool/tree/main/hbctool/hbc/hbc74): `hbctool/hbc/hbc74`
- [HBC 76](https://github.com/elcruncharino/hbc-tool/tree/main/hbctool/hbc/hbc76): `hbctool/hbc/hbc76`
- [HBC 83](https://github.com/elcruncharino/hbc-tool/tree/main/hbctool/hbc/hbc83): `hbctool/hbc/hbc83`
- [HBC 84](https://github.com/elcruncharino/hbc-tool/tree/main/hbctool/hbc/hbc84): `hbctool/hbc/hbc84`
- [HBC 85](https://github.com/elcruncharino/hbc-tool/tree/main/hbctool/hbc/hbc85): `hbctool/hbc/hbc85`
- [HBC 86](https://github.com/elcruncharino/hbc-tool/tree/main/hbctool/hbc/hbc86): `hbctool/hbc/hbc86`
- [HBC 87](https://github.com/elcruncharino/hbc-tool/tree/main/hbctool/hbc/hbc87): `hbctool/hbc/hbc87`
- [HBC 88](https://github.com/elcruncharino/hbc-tool/tree/main/hbctool/hbc/hbc88): `hbctool/hbc/hbc88`
- [HBC 89](https://github.com/elcruncharino/hbc-tool/tree/main/hbctool/hbc/hbc89): `hbctool/hbc/hbc89`
- [HBC 90](https://github.com/elcruncharino/hbc-tool/tree/main/hbctool/hbc/hbc90): `hbctool/hbc/hbc90`
- [HBC 91](https://github.com/elcruncharino/hbc-tool/tree/main/hbctool/hbc/hbc91): `hbctool/hbc/hbc91`
- [HBC 92](https://github.com/elcruncharino/hbc-tool/tree/main/hbctool/hbc/hbc92): `hbctool/hbc/hbc92`
- [HBC 93](https://github.com/elcruncharino/hbc-tool/tree/main/hbctool/hbc/hbc93): `hbctool/hbc/hbc93`
- [HBC 94](https://github.com/elcruncharino/hbc-tool/tree/main/hbctool/hbc/hbc94): `hbctool/hbc/hbc94`
- [HBC 95](https://github.com/elcruncharino/hbc-tool/tree/main/hbctool/hbc/hbc95): `hbctool/hbc/hbc95`
- [HBC 96](https://github.com/elcruncharino/hbc-tool/tree/main/hbctool/hbc/hbc96): `hbctool/hbc/hbc96`
- [HBC 97](https://github.com/elcruncharino/hbc-tool/tree/main/hbctool/hbc/hbc97): `hbctool/hbc/hbc97`
- [HBC 98](https://github.com/elcruncharino/hbc-tool/tree/main/hbctool/hbc/hbc98): `hbctool/hbc/hbc98`
- [HBC 99](https://github.com/elcruncharino/hbc-tool/tree/main/hbctool/hbc/hbc99): `hbctool/hbc/hbc99`

### Other components

- **CLI user**

## Connections

- CLI user → CLI commands: invokes
- CLI commands → HASM conversion: routes operations (evidence: `hbctool/__init__.py`)
- HASM conversion → Version dispatch: uses bytecode API (evidence: `hbctool/hasm.py`)
- Version dispatch → HBC 59: selects version (evidence: `hbctool/hbc/__init__.py`)
- Version dispatch → HBC 62: selects version (evidence: `hbctool/hbc/__init__.py`)
- Version dispatch → HBC 74: selects version (evidence: `hbctool/hbc/__init__.py`)
- Version dispatch → HBC 76: selects version (evidence: `hbctool/hbc/__init__.py`)
- Version dispatch → HBC 83: selects version (evidence: `hbctool/hbc/__init__.py`)
- Version dispatch → HBC 84: selects version (evidence: `hbctool/hbc/__init__.py`)
- Version dispatch → HBC 85: selects version (evidence: `hbctool/hbc/__init__.py`)
- Version dispatch → HBC 86: selects version (evidence: `hbctool/hbc/__init__.py`)
- Version dispatch → HBC 87: selects version (evidence: `hbctool/hbc/__init__.py`)
- Version dispatch → HBC 88: selects version (evidence: `hbctool/hbc/__init__.py`)
- Version dispatch → HBC 89: selects version (evidence: `hbctool/hbc/__init__.py`)
- Version dispatch → HBC 90: selects version (evidence: `hbctool/hbc/__init__.py`)
- Version dispatch → HBC 91: selects version (evidence: `hbctool/hbc/__init__.py`)
- Version dispatch → HBC 92: selects version (evidence: `hbctool/hbc/__init__.py`)
- Version dispatch → HBC 93: selects version (evidence: `hbctool/hbc/__init__.py`)
- Version dispatch → HBC 94: selects version (evidence: `hbctool/hbc/__init__.py`)
- Version dispatch → HBC 95: selects version (evidence: `hbctool/hbc/__init__.py`)
- Version dispatch → HBC 96: selects version (evidence: `hbctool/hbc/__init__.py`)
- Version dispatch → HBC 97: selects version (evidence: `hbctool/hbc/__init__.py`)
- Version dispatch → HBC 98: selects version (evidence: `hbctool/hbc/__init__.py`)
- Version dispatch → HBC 99: selects version (evidence: `hbctool/hbc/__init__.py`)
- HBC 83 → Bit utilities: uses bit I/O (evidence: `hbctool/hbc/hbc83/parser.py`)
- HBC 84 → Bit utilities: uses bit I/O (evidence: `hbctool/hbc/hbc84/parser.py`)
- HBC 85 → Bit utilities: uses bit I/O (evidence: `hbctool/hbc/hbc85/parser.py`)
- HBC 86 → Bit utilities: uses bit I/O (evidence: `hbctool/hbc/hbc86/parser.py`)
- HBC 87 → Bit utilities: uses bit I/O (evidence: `hbctool/hbc/hbc87/parser.py`)
- HBC 88 → Bit utilities: uses bit I/O (evidence: `hbctool/hbc/hbc88/parser.py`)
- HBC 97 → Bit utilities: uses bit I/O (evidence: `hbctool/hbc/hbc97/parser.py`)
- HBC 98 → Bit utilities: uses bit I/O (evidence: `hbctool/hbc/hbc98/parser.py`)
- HBC 99 → Bit utilities: uses bit I/O (evidence: `hbctool/hbc/hbc99/parser.py`)
