Skip to main content
The phichain-converter is a command-line tool that converts Phigros charts between different formats. It supports Official, Phichain, RPE, and Primitive chart formats.

Installation

The converter is included in the Phichain toolchain. Make sure you have Rust installed, then build the project:
cargo build --release -p phichain-converter
The binary will be available at target/release/phichain-converter.

Usage

Basic Syntax

phichain-converter --input <FORMAT> --output <FORMAT> <PATH>

Arguments

--input
string
required
The input chart format. Available formats:
  • official - Official Phigros format
  • phichain - Phichain native format
  • rpe - Re:PhiEdit format
  • primitive - Primitive chart format
--output
string
required
The output chart format. Same format options as input.
path
string
required
The path to the input chart file. Must be a file, not a directory.

Supported Formats

FormatDescriptionExtension
officialOfficial Phigros chart format.json
phichainPhichain native format with compiler features.json
rpeRe:PhiEdit format.json
primitiveLow-level primitive representation.json

Examples

Convert Official to Phichain

phichain-converter --input official --output phichain chart.json
This creates chart.phichain.json in the same directory.

Convert RPE to Official

phichain-converter --input rpe --output official my-chart.json
Output: my-chart.official.json

Convert to Primitive Format

phichain-converter --input phichain --output primitive advanced.json
The primitive format is useful for debugging or analyzing chart structure.

Output

The converter will:
  1. Convert the chart to an intermediate primitive representation
  2. Convert the primitive chart to the target format
  3. Save the output with the format name appended before the extension

Example Output

$ phichain-converter --input official --output phichain my-chart.json
Converting chart into primitive chart...
Converting chart into `phichain` chart...
The converted chart is saved as my-chart.phichain.json.

Batch Conversion

You can convert multiple charts using shell scripting:
# Convert all official charts to phichain format
for file in charts/*.json; do
  phichain-converter --input official --output phichain "$file"
done

Error Handling

The converter will exit with an error message if:
  • The input file doesn’t exist
  • The path points to a directory instead of a file
  • The input file contains invalid JSON or chart data
  • The conversion between formats fails

Common Errors

# File not found
Error: No such file: chart.json

# Directory provided instead of file
Error: Expected a file, got a directory: charts/

Conversion Process

All conversions go through the primitive format as an intermediate representation. This ensures consistent behavior and makes it easy to add new formats.
The conversion pipeline:
  1. Parse - Read and deserialize the input chart
  2. To Primitive - Convert to primitive representation
  3. From Primitive - Convert to target format
  4. Serialize - Write output file

Tips

  • Always keep backups of your original charts before converting
  • The primitive format is useful for debugging chart issues
  • Some format-specific features may be lost during conversion
  • Output files are named with the format appended (e.g., chart.phichain.json)

See Also