Skip to content

awerty-noob/ccs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple Competitive Companion Server

demo1.mp4

Inspired by CF-Tool

This command-line tool exposes a lightweight server that receives problem definitions from the Competitive Companion browser extension and prepares local workspaces for solving, testing, and submitting solutions.

Requirements

  • Install the Competitive Companion extension in your browser and enable “custom test case receiver” pointing to your CCS port.
  • Install cph-submit and ensure it is on your PATH so the submit subcommand can forward submissions.

Configuration

CCS reads config.json at startup. By default it searches:

  • Linux: $XDG_CONFIG_HOME/ccs/config.json then ~/.config/ccs/config.json
  • macOS: ~/Library/Application Support/ccs/config.json
  • Windows: %APPDATA%\ccs\config.json
  • Current working directory: ./config.json

Use --config /path/to/config.json to override the location when launching any command.

Run ccs config to generate a starter configuration or add language templates through an interactive prompt.

Example configuration:

{
  "workspace": "/home/ralph/ICPC",
  "template": [
    {
      "alias": "cpp",
      "lang": "89",
      "path": "/home/ralph/Templates/sol.cpp",
      "suffix": ["cpp", "cc"],
      "before_script": "g++ $%full%$ -o $%file%$.exe -O2 -std=c++20",
      "script": "./$%file%$.exe",
      "after_script": "rm $%file%$.exe"
    },
    {
      "alias": "py",
      "lang": 70,
      "path": "/home/ralph/Templates/io.py",
      "suffix": ["py"],
      "before_script": "",
      "script": "python $%full%$",
      "after_script": ""
    }
  ],
  "default": 0,
  "gen_after_parse": true
}
  • workspace selects where problems and samples are stored.
  • template entries describe each language: alias, Codeforces lang id, template path, file suffixes, and optional before_script / script / after_script commands. Placeholders %path%, %file%, %full% (optionally wrapped as $%...%$) are substituted before execution.
  • default picks the template that auto-generates when gen_after_parse is true.
  • gen_after_parse controls whether the daemon runs ccs gen <default alias> automatically after new test data arrives.

Workspace layout

Problems are created beneath the configured workspace. CCS derives nested folders from contest metadata (platform → contest → problem) and emits:

<workspace>/
  <platform>/
    <contest>/
      <problem>/
        in1.txt   # sample input 1
        ans1.txt  # expected output 1
        ...
        <alias>.ext  # generated via config or `ccs gen`

Samples follow the in{n}.txt / ans{n}.txt convention. Templates listed in config.json can be copied on demand with ccs gen <alias> or automatically when gen_after_parse is enabled.

Usage

  1. Build or install the binary:
    cargo install --path .
  2. Ensure your config.json is in place (see above). Override with --config if you keep it elsewhere.
  3. Start the daemon to receive problems:
    ccs daemon --port 27121
    The daemon writes samples into the configured workspace and optionally generates the default template.
  4. Generate additional templates on demand:
    # copy the template with alias "py" into the current directory
    ccs gen py
  5. After Competitive Companion pushes a task, implement your solution and run:
    # Test against stored samples (auto-detects matching files, or choose from a prompt when multiple match)
    ccs test
    
    # Submit via cph-submit (optionally specify a file path)
    ccs submit ./sol.cpp

Useful flags shared by all subcommands:

Flag Description
--config <path> Override the location of config.json.
--port <num> Listening port for the daemon (default 27121).
--log-file <dst> stderr, stdout, or a file path for log output.
--verbose Enable debug logging.
--short-path Use condensed directory layout for compatible problem sources.

Project status

CCS is actively developed; expect breaking changes and incomplete features while we iterate on submission flows and tooling.

About

Yet Another Competitive Programming Command-line Tool.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages