Commit graph

15 commits

Author SHA1 Message Date
4e709c8470
feat(race): add supports_countdown to ContestListResult
Problem: `:CP race` on platforms without future contests (CSES, USACO)
wastes time fetching the full contest list only to discover there is
no `start_time`. The error message is also uninformative.

Solution: Add `supports_countdown` bool to `ContestListResult` (default
`True`). CSES and USACO set it to `False`. Cache the flag per-platform
so subsequent calls skip the fetch entirely. `race.lua` checks the
cached value first, then the scraper result, and shows
`"<Platform> does not support :CP race"` instead of a generic error.
2026-03-06 18:01:08 -05:00
Barrett Ruth
7bf4cf2538
feat(commands): implement :CP open [problem|contest|standings] (#319)
## Problem

There was no way to open a problem, contest, or standings page in the
browser from within the plugin.

## Solution

Add `contest_url` and `standings_url` to `MetadataResult` and persist
them in the cache. Add `cache.get_open_urls` to resolve all three URLs.
Wire up `:CP open [problem|contest|standings]` in `commands/init.lua`
to call `vim.ui.open`, warning when a URL is unavailable (e.g. CSES
has no standings). Closes #315.
2026-03-05 19:16:05 -05:00
Barrett Ruth
2c119774df
feat: validate credentials on :CP <platform> login (#310)
## Problem

`:CP <platform> login` blindly caches username/password without
server-side
validation. Bad credentials are only discovered at submit time, which is
confusing and wastes a browser session.

## Solution

Wire `:CP <platform> login` through the scraper pipeline so each
platform
actually authenticates before persisting credentials. On failure, the
user
sees an error and nothing is cached.

- CSES: reuses `_check_token` (fast path) and `_web_login`; returns API
token
  in `LoginResult.credentials` so subsequent submits skip re-auth.
- AtCoder/Codeforces: new `_login_headless` functions open a
StealthySession,
solve Turnstile/Cloudflare, fill the login form, and validate success by
  checking for the logout link. Cookies only persist on confirmed login.
- CodeChef/Kattis/USACO: return "not yet implemented" errors.
- `scraper.lua`: generalizes submit-only guards (`needs_browser` flag)
to
  cover both `submit` and `login` subcommands.
- `credentials.lua`: prompts for username/password, passes cached token
for
CSES fast path, shows ndjson status notifications, only caches on
success.
2026-03-05 15:12:09 -05:00
90bd13580b feat(scraper): add precision extraction, start_time, and submit support
Problem: problem pages contain floating-point precision requirements and
contest start timestamps that were not being extracted or stored. The
submit workflow also needed a foundation in the scraper layer.

Solution: add extract_precision() to base.py and propagate through all
scrapers into cache. Add start_time to ContestSummary and extract it
from AtCoder and Codeforces. Add SubmitResult model, abstract submit()
method, submit CLI case with get_language_id() resolution, stdin/env_extra
support in run_scraper, and a full AtCoder submit implementation; stub
the remaining platforms.
2026-03-03 15:09:41 -05:00
Barrett Ruth
aab211902e feat: multi-test case view 2025-11-04 21:32:40 -05:00
Barrett Ruth
fef73887e4 feat(io): multi-test case view 2025-11-04 08:15:08 -05:00
c0e175d84b feat(config): open url option 2025-10-12 16:19:02 -04:00
2426e1cbd4 fix: scrapers 2025-10-05 22:10:26 -04:00
c509102b37 feat(tests): basic tests 2025-10-05 21:58:43 -04:00
aa1dd43e70 fix(scrapers): remove unused field 2025-09-30 21:29:42 -04:00
ae2f8b94cf feat: interactive problem finer-tuning 2025-09-27 10:05:58 -04:00
8e13b8c61d feat(cses): update cses with concept of a category 2025-09-20 14:01:18 -04:00
793063a68e feat(test_panel): integrate scraped data 2025-09-19 20:41:19 -04:00
aedbccffb4 feat(scrapers): update all scrapers to provide time & memory limit 2025-09-19 20:28:20 -04:00
ffaec3b947 fix(ci): type scrapers 2025-09-18 22:14:13 -04:00