feat: competitive companion HTTP listener #255
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
barrettruth/cp.nvim#255
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
cp.nvim's custom Python scrapers cover only 4 platforms (AtCoder, CodeChef, Codeforces, CSES). The Competitive Companion browser extension supports 116+ judges (LeetCode, USACO, HackerRank, Kattis, Toph, etc.) and is the industry-standard protocol for getting test cases into any CP tool. Every other Neovim CP plugin (competitest.nvim, cphelper.nvim, assistant.nvim) integrates with it. cp.nvim has no listener at all.
Proposed solution
Implement a local HTTP server (listening on port 10042, Competitive Companion's default) using
vim.uvTCP primitives — no external dependencies required. AcceptPOST /requests and decode the Competitive Companion JSON payload:The payload maps cleanly onto existing types:
timeLimit→timeout_ms,memoryLimit→memory_mb,tests[].input/output→TestCase[]. Batch mode (where size > 1) allows receiving entire contests at once.Expose via config:
companion = { enabled = true, port = 10042 }. A:CP companiontoggle command could start/stop the listener.Alternatives considered
Continuing to maintain platform-specific Python scrapers. This is viable but limits coverage to platforms we choose to support and requires ongoing maintenance as site structures change.
Closing — cp.nvim's core value is self-contained scrapers without browser extension dependencies.