Commit graph

43 commits

Author SHA1 Message Date
c13456b3ad
ci: format 2026-03-05 15:32:04 -05:00
b5aaac3862 fix(commands): canonicalize CF contest IDs and auto-restore on action
Problem: two related gaps in `handle_command` and `parse_command`.
Codeforces contest IDs were passed through raw, so URLs or problem IDs
with trailing letters (e.g. `1933A`, full contest URLs) caused scraper
failures. Separately, action commands like `:CP run` silently failed
when invoked with no active contest instead of attempting recovery.

Solution: add `canonicalize_cf_contest` to strip URLs and trailing
problem letters before building the `contest_setup` command. Add a
guard in `handle_command` that calls `restore_from_current_file()`
before dispatching any contest-requiring action when no platform is
active, returning early if no cached state is found.
2026-03-05 15:29:09 -05:00
Barrett Ruth
a202725cc5
fix(submit): use file path over stdin; fix CF CodeMirror textarea (#305)
## Problem

After the initial submit hardening, two issues remained: source code was
read in Lua and piped as stdin to the scraper (unnecessary roundtrip
since
the file exists on disk), and CF's `page.fill()` timed out on the hidden
`textarea[name="source"]` because CodeMirror owns the editor state.

## Solution

Pass the source file path as a CLI arg instead — AtCoder calls
`page.set_input_files(file_path)` directly, CF reads it with
`Path(file_path).read_text()`. Fix CF source injection via
`page.evaluate()`
into the CodeMirror instance. Extract `BROWSER_SUBMIT_NAV_TIMEOUT` as a
per-platform `defaultdict` (CF defaults to 2× nav timeout). Save the
buffer
with `vim.cmd.update()` before submitting.
2026-03-05 14:34:14 -05:00
Barrett Ruth
49e0ae3885
refactor(credentials): promote login/logout to top-level actions (#292)
## Problem

`:CP credentials login/logout/clear` is verbose and inconsistent with
other
actions that are all top-level (`:CP run`, `:CP submit`, etc.). The
clear-all
subcommand is also unnecessary since re-logging in overwrites existing
credentials.

## Solution

Replace `:CP credentials {login,logout,clear}` with `:CP login
[platform]`
and `:CP logout [platform]`. Remove the clear-all command and the
credentials
subcommand dispatch — login/logout are now regular actions routed
through the
standard action dispatcher.
2026-03-04 13:09:32 -05:00
Barrett Ruth
98ac0aa7a7
refactor(credentials): rename set/clear to login/logout/clear (#291)
## Problem

The `set` and `clear` subcommands don't clearly convey their intent —
`set`
reads like a generic setter rather than an auth action, and `clear`
overloads
single-platform and all-platform semantics in one subcommand.

## Solution

Rename `set` to `login`, split `clear` into `logout` (per-platform,
defaults
to active) and `clear` (all platforms).

New API:
- `:CP credentials login [platform]` — prompt and save credentials
- `:CP credentials logout [platform]` — remove credentials for one
platform
- `:CP credentials clear` — remove all stored credentials
2026-03-04 12:53:37 -05:00
a04702d87c refactor: replace :CP login with :CP credentials subcommand
Problem: :CP login was a poor API — no way to clear credentials without
raw Lua, and the single command didn't scale to multiple operations.

Solution: replace login with a :CP credentials subcommand following the
same pattern as :CP cache. :CP credentials set [platform] prompts and
saves; :CP credentials clear [platform] removes one or all platforms.
Add cache.clear_credentials(), rename login.lua to credentials.lua,
update parse/dispatch/tab-complete, and rewrite vimdoc accordingly.
2026-03-03 16:46:07 -05:00
3e0b7beabf feat: add :CP login command for explicit credential management
Problem: credentials were only set implicitly on first :CP submit.
There was no way to update wrong credentials, log out, or set
credentials ahead of time without editing the cache JSON manually.

Solution: add :CP login [platform] which always prompts for username
and password and overwrites any saved credentials for that platform.
Omitting the platform falls back to the active platform. Wire the
command through constants, parse_command, handle_command, and add
tab-completion (suggests platform names). Document in vimdoc under
the SUBMIT section and in the commands reference.
2026-03-03 16:28:54 -05:00
bfa2cf893c feat: wire race, stress, and submit commands and keymaps
Add command parsing and dispatch for :CP race, :CP race stop, :CP stress,
and :CP submit. Add tab-completion for race (platform/contest/--lang),
stress (cwd executables at arg 2 and 3), and race stop. Add
<Plug>(cp-stress), <Plug>(cp-submit), and <Plug>(cp-race-stop) keymaps.
2026-03-03 15:09:41 -05:00
Barrett Ruth
1b0d5e4d77 feat: fix typign 2025-11-04 22:08:07 -05:00
Barrett Ruth
e1c8c4beaf feat(cli): :CP run with numbered test cases 2025-11-04 21:45:45 -05:00
Barrett Ruth
aab211902e feat: multi-test case view 2025-11-04 21:32:40 -05:00
Barrett Ruth
4b1b75fd6e fix(config): padding spacing 2025-10-24 14:44:33 -04:00
Barrett Ruth
3daf582b7a feat(cache): update cache 2025-10-24 14:26:51 -04:00
Barrett Ruth
9d848eba22 feat: improve autocomplete 2025-10-24 01:44:06 -04:00
Barrett Ruth
bd30fb626c feat: start lang refactor 2025-10-24 01:11:19 -04:00
Barrett Ruth
7e2e712b56 fix: rename file 2025-10-23 23:55:27 -04:00
Barrett Ruth
82021e3d97 fix ci 2025-10-23 23:48:32 -04:00
Barrett Ruth
6a6cf2c594 feat: bindings and --debug flag 2025-10-23 23:36:09 -04:00
Barrett Ruth
60e5aabd99 fix types 2025-10-23 20:15:16 -04:00
Barrett Ruth
59f5066327 fix input display 2025-10-23 20:03:17 -04:00
Barrett Ruth
c312ccbb4d fix: highlighting 2025-10-23 18:16:36 -04:00
Barrett Ruth
114187164e improve some refactors 2025-10-23 11:16:13 -04:00
Barrett Ruth
018d801121 fix: rename run panel to panel 2025-10-23 09:54:55 -04:00
d4df57bd05 fix(scrapers): cses interactive problems 2025-10-05 20:55:43 -04:00
a0b5264761 fix: improve error handling 2025-10-05 16:06:08 -04:00
41a8d1a75b feat: interactive mode 2025-10-05 15:36:28 -04:00
44bfc7317d feat(cli): :CP <problem_id> 2025-10-05 12:59:50 -04:00
91864b2992 fix(ci): type check 2025-10-05 12:40:23 -04:00
f5a72a3a8f doc cleanups 2025-10-05 12:32:43 -04:00
b68ecbbe96 rename and simplify things 2025-10-05 11:59:24 -04:00
ef8ee26edf remove per-problem language config 2025-10-04 16:26:01 -04:00
1974addbd2 fix(lua): bunch of typing 2025-10-02 14:18:26 -04:00
6b8a1e2087 more docs 2025-10-01 21:36:53 -04:00
7eb314b02c fix caching 2025-10-01 20:21:11 -04:00
62af1965f8 fix a lot of logic 2025-10-01 15:15:04 -04:00
b406c0ce4e fix: synchronous problem fetch 2025-10-01 12:25:07 -04:00
316b6628db indeed it toggles 2025-09-26 08:36:00 -04:00
7efd6404b6 feat: interactive terminal 2025-09-26 08:28:19 -04:00
f9cf5b1614 possibly working 2025-09-23 10:17:22 -04:00
e171017ab0 fixup 2025-09-23 09:42:45 -04:00
a32fd396d3 feat: async scraper 2025-09-22 22:59:57 -04:00
9c2be9c6b0 feat: some more updates 2025-09-22 19:11:11 -04:00
5a6902633f refactor: massive file restructure 2025-09-22 19:00:36 -04:00