CLI Tool
Introduction
Standard Ranklist CLI is a command-line tool for srk files. Its executable name is srk, and it is designed for local development, data maintenance, and CI workflows that need validation, diagnostics, patching, format conversion, browser previews, static HTML rendering, and similar operations.
Installation
npm install -g @algoux/standard-ranklist-cliThe CLI requires Node.js >=22.
Commands
| Command | Purpose |
|---|---|
validate | Quickly checks srk Schema fields, types, enum values, and formats |
diagnose | Prints a data diagnostics report and can generate an srk-patch file for auto-fixable issues |
patch | Applies an srk-patch file to srk |
convert | Exports srk to Excel, VJudge Replay, or Codeforces Gym Ghost files |
preview | Starts a local preview server for a single srk file or a directory tree |
render | Renders a single srk file or a directory into static HTML for archives, publishing, and preview pages |
Quick Usage
Validate Structure
srk validate srk.jsonvalidate is suitable as a lightweight CI structure check. It checks JSON syntax, required fields, field types, enum values, Schema formats, and similar structure constraints.
Diagnose
srk diagnose srk.json
srk diagnose --format json srk.json
# Generate a patch file for auto-fixable suggested issues
srk diagnose --patch generated.patch.json srk.jsondiagnose finds completeness and correctness issues in srk data. Diagnostics findings themselves do not make the command fail.
Patch
srk patch srk.json fix.patch.json > fixed.srk.json
srk patch -o fixed.srk.json srk.json fix.patch.json
# Patch and overwrite the input file
srk patch --in-place srk.json fix.patch.jsonConvert Formats
srk convert excel srk.json -o ranklist.xlsx
srk convert vjudge srk.json -o replay.xlsx
srk convert gym srk.json -o ghost.datconvert will invoke the converter to generate the target format file.
Preview Locally
srk preview srk.json
srk preview ./ranklists
srk preview -w -p 3003 ./ranklists
srk preview --git-diff-base main --git-diff-head HEAD ./ranklistsFile mode renders the selected srk file directly. Directory mode allows access to all *.srk.json files inside the directory.
Render Static HTML
srk render srk.json > ranklist.html
srk render -o ranklist.html srk.json
srk render -o ./review-site ./ranklists
srk render -o ./review-site --git-diff-base main --git-diff-head HEAD ./ranklistsDirectory render mode generates index.html and a data/ directory for static hosting. Git diff options can render only srk files changed in a branch or commit range.
More Documentation
For complete option references and release history, see the project repository: