Start the LeetCode daily question from the site

A "Today's LeetCode" button on the problem list (admin only) does what
`usaco daily` does: it asks LeetCode for the daily question, runs the
clone's lib/leetcode.py to import it into solving/ (statement, starter,
driver.h and the examples as tests), commits it as "Start <slug>" and
opens its solve page. A daily question already in the repo is only
opened. The importer stays the CLI's one script rather than a Go copy
of its driver generator, so the site image now has python3.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-10-20 11:29:39 +01:00
co-authored by Claude Opus 5.5
parent c972fa9fd9
commit af070ffcf9
9 changed files with 337 additions and 2 deletions
+2
View File
@@ -52,6 +52,7 @@ internal/explain/ the explanation prompt and schema, explain.md rendering, the
internal/transcribe/ OpenAI-compatible speech-to-text client, and pace/pause/filler metrics
internal/review/ the review prompt and schema, reviews/<id>.md rendering
internal/audiostore/ optional S3 bucket (Garage) that keeps review recordings for playback
internal/leetcode/ today's daily question, imported by running the clone's lib/leetcode.py
internal/statement/ fetches statements from LeetCode (GraphQL) and USACO (the problem page)
web/ Vue 3 + Vite SPA, built for base /usaco/
```
@@ -79,6 +80,7 @@ Everything is served under `BASE_PATH` (`/usaco`). nginx proxies the prefix thro
| `POST /usaco/api/problems/<name>/run` | admin | `{lang, source, mode: tests\|custom, input?}`: compiles once and runs the saved tests (or the custom input) on the runner; answers its verdicts. 503 without `RUNNER_URL` |
| `POST /usaco/api/problems/<name>/lint` | admin | `{lang, source}`: the runner's diagnostics (g++ and clang-tidy, or python and ruff) |
| `PUT /usaco/api/problems/<name>/code` | admin | `{lang, source}`: commits `main.cpp`, or `main.py` (`sol.py` where that is the existing file), as "Edit <name>" |
| `POST /usaco/api/leetcode/daily` | admin | imports today's LeetCode daily question into `solving/` with the CLI's `lib/leetcode.py` and commits it as "Start <slug>", or finds it if it is already a problem; answers `{name, created}`. 502 if LeetCode or the import fails |
| `POST /usaco/api/hooks/gitea` | HMAC (`X-Gitea-Signature`) | queue a pull |
| `GET /usaco/api/health` | open | 200 once the clone is indexed |