Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HPCGame CLI

Participant-focused command-line client for the HPCGame and AOI Online Judge Platform. It discovers the files required by an AOI problem, packages matching files from the current directory, submits them, follows judge state changes, saves the result, and prints a compact summary.

Requirements and setup

Node.js 22 or newer and pnpm are required.

Install the published package:

npm add --global @lcpu/hpcgame-cli

For local development:

corepack enable
pnpm install
pnpm build
pnpm link --global

The installed command is hpcgame.

Login

Browser/device login delegates authentication to the AOI web interface, so the browser can use IAAA without exposing PKU credentials to this CLI:

hpcgame login

The default device app ID is 77db0551-125b-4438-afd7-ecf918dec46f. A different AOI OAuth app with device flow enabled can be selected when needed:

hpcgame login --app-id OTHER-APP-UUID

Other supported methods:

hpcgame login --method mail --email user@example.edu
hpcgame login --method token

Tokens are stored per server in ${XDG_CONFIG_HOME:-~/.config}/hpcgame/config.json. The directory and file are restricted to the current user. Tokens, OTPs, authorization codes, and presigned URLs are never printed.

Submit

Run the command in a directory containing every file named by the problem's form configuration:

cd my-solution
hpcgame submit \
  https://hpcgame.pku.edu.cn/org/2df8f692-0316-4682-80cd-591732b1eda6/problem/a2a1a3f1-722b-42a4-bac9-3170ce069dbb

URLs may have extra path segments, query parameters, or fragments. For example, this is also accepted:

https://hpcgame.pku.edu.cn/org/2df8f692-0316-4682-80cd-591732b1eda6/problem/a2a1a3f1-722b-42a4-bac9-3170ce069dbb/submit

The URL remains safe and unambiguous only when it contains one unique valid UUID following an org segment and one unique valid UUID following a problem segment.

The CLI:

  1. fetches the problem and prints its required paths, such as cc.cu and 1.py;
  2. validates that each path is a regular file safely contained beneath the working directory;
  3. creates the same form ZIP shape used by AOI's web client;
  4. hashes, uploads, and submits it;
  5. polls until AOI reports Completed;
  6. downloads judge details when policy permits;
  7. writes a filename-safe UTC timestamp such as result/2026-07-31T05-17-18.123Z+<solution-id>.json, containing { "solution": ..., "details": ... }.

Useful options:

-C, --cwd <directory>           read submission files from another directory
-s, --server <origin>           require the problem URL to match an origin
--poll-interval <milliseconds>  polling interval (default: 1500, minimum: 100)
--private                       prefer a private runner

Only standard, non-contest form submissions are supported. Direct file-upload and folder-upload problems are reported but not submitted automatically.

Development

pnpm check

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages