feat(api): migrate SRS ladder to +3/+7 and adjust rest‑day logic

This commit is contained in:
Prad Nukala
2026-08-31 10:41:21 -04:00
parent bd9afc6ea1
commit e8b0d4dc30
7 changed files with 506 additions and 140 deletions
+7 -3
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env bun
/**
* Sync work/ leetcode solutions into apps/docs/content/ pages.
* Sync work/1 leetcode solutions into apps/docs/content/ pages.
*
* - New problems get a full page (frontmatter, badge, warning, examples,
* constraints, solution) in the gold-standard format.
@@ -9,12 +9,16 @@
* - When a problem is solved in both JavaScript and Python the solution
* renders as a <CodeGroup> (Python first); single-language solutions
* render as a plain fence.
*
* Only the first-solve bucket is read: work/3 and work/7 hold blind re-solves
* of problems whose page already exists (see work.ts), and a fresh scaffold
* there would otherwise wipe the page's `## Solution`.
*/
import { mkdir, rename } from "node:fs/promises";
import { basename, join } from "node:path";
const ROOT = join(import.meta.dir, "..", "..");
const WORK = join(ROOT, "work");
const WORK = join(ROOT, "work", "1");
const DOCS = join(ROOT, "apps", "docs", "content");
type Lang = "js" | "py";
@@ -323,7 +327,7 @@ for await (const rel of new Bun.Glob("**/*.{js,py}").scan(WORK)) {
const file = basename(rel);
const m = file.match(/^(\d+)\.(.+)\.(?:js|py)$/);
if (!m) {
console.warn(`skip (unrecognized name): work/${rel}`);
console.warn(`skip (unrecognized name): work/1/${rel}`);
continue;
}
const num = Number(m[1]);