tx2-cli-0.1.0 is not a library.
tx2-cli
Command-line interface for TX-2 ECS - inspect, debug, and manage TX-2 applications.
Installation
Or build from source:
The binary will be available as tx2 (not tx2-cli).
Features
- Snapshot Management: List, inspect, export, diff, replay, and validate snapshots
- SQL Analytics: Query ECS data using SQLite, PostgreSQL, or DuckDB
- Live Connection: Connect to running TX-2 applications via WebSocket, stdio, or IPC
- Schema Tools: Generate, validate, diff, and migrate database schemas
- Development Tools: Generate test data, benchmark, profile, and fuzz test
- Project Scaffolding: Create new TX-2 projects from templates
Commands
Snapshot Commands
# List all snapshots in a directory
# Show detailed information about a snapshot
# Export snapshot to different format
# Compare two snapshots
# Replay snapshots as animation
# Validate snapshot integrity
Query Commands
# Execute SQL query against SQLite database
# Execute query against PostgreSQL
# Execute query against DuckDB
# Interactive SQL REPL mode
# Save query results to file
Connect Commands
# Connect to running application via WebSocket
# Interactive REPL mode
# TUI (Terminal UI) mode - interactive visual interface
# Connect via stdio
# Connect via IPC
Schema Commands
# Generate schema from Rust source files
# Validate schema against database
# Generate migration between two schemas
# Apply migration to database
Development Commands
# Generate test entities
# Benchmark sync performance
# Profile memory usage
# Validate world consistency
# Fuzz test snapshots
New Project Commands
# Create new application
# Create new game
# Create new multiplayer game
Network Commands
# Monitor network traffic in real-time
# Dump network messages to file
# Replay network dump
# Analyze network dump statistics
Output Formats
Most commands support multiple output formats via the --format flag:
table(default): Pretty-printed tablesjson: Compact JSONjson-pretty: Pretty-printed JSONcsv: Comma-separated valuesyaml: YAML format
Global Flags
--format <FORMAT>: Output format (table, json, csv, yaml)--no-color: Disable colored output--verbose: Enable verbose output
Interactive Modes
Query REPL
REPL commands:
.help- Show help.tables- List all tables.schema <table>- Show table schema.explain <query>- Explain query plan.analyze <table>- Analyze table statistics.exitor.quit- Exit REPL
Connect REPL
REPL commands:
.help- Show help.query <sql>- Execute ECS query.entities- List all entities.entity <id>- Show entity details.components- List component types.component <type>- List entities with component.snapshot- Create snapshot.stats- Show world statistics.ping- Ping the server.exitor.quit- Exit REPL
TUI (Terminal UI) Mode
The TUI mode provides a rich visual interface for inspecting ECS worlds:
Features:
- Live entity list with navigation (↑↓ or j/k keys)
- Component inspector showing selected entity's components
- Real-time updates from connected application
- Keyboard-driven interface
Controls:
↑/↓orj/k- Navigate entity listq- Quit TUI moder- Refresh data
Layout:
┌─────────────────────────────────────────────────────────────┐
│ TX-2 World Inspector - ws://localhost:8080 │
├──────────────────┬──────────────────────────────────────────┤
│ Entities │ Component Inspector │
│ > Entity_0 │ Entity: Entity_0 │
│ Entity_1 │ │
│ Entity_2 │ Components: │
│ Entity_3 │ │
│ ... │ Position: │
│ │ x: 0.0, y: 0.0 │
│ │ │
│ │ Velocity: │
│ │ dx: 0.00, dy: 1.00 │
│ │ │
│ │ Health: │
│ │ current: 100, max: 100 │
├──────────────────┴──────────────────────────────────────────┤
│ [q] Quit [↑↓/jk] Navigate [r] Refresh │
└─────────────────────────────────────────────────────────────┘
Examples
Analyze Game Performance
# Export snapshot to DuckDB for analytics
# Query entity distribution
# Find entities with specific components
Time-Travel Debugging
# List all snapshots
# Compare snapshots before and after bug
# Replay to visualize changes
Live Debugging
# Connect to running game
# In REPL:
Configuration
tx2-cli stores history files in:
- Query REPL:
~/.local/share/tx2/query_history.txt - Connect REPL:
~/.local/share/tx2/repl_history.txt
Building
# Debug build
# Release build
# Run tests
# Check without building
Dependencies
clap- Command-line argument parsingtabled- Table formattingcolored- Terminal colorstokio- Async runtimerustyline- REPL line editingratatui- Terminal UI frameworkcrossterm- Terminal manipulationserde/serde_json/serde_yaml- Serializationtx2-pack- Snapshot managementtx2-query- SQL analytics layertx2-link- Network synchronization
License
MIT
Contributing
tx2-cli is part of the TX-2 ecosystem. For more information, see the main TX-2 repository.