refactor(ids): generate content id unions from the structure documents

scripts/generate-content-types.ts writes the gitignored src/types/content-ids.ts (id unions + project category values) from the four structure documents; wired as generate:ids / predev / prebuild / prepare. src/types/index.ts re-exports them type-only and keeps only the code-owned unions.

Edit mode now writes JSON only: the v4 union leg is deleted (saveIdUnions, diffIdsWithUnions, applyUnionChanges, readUnionBlock, the EditBar union card, edit.union.* labels). Validator rule 7 requires a label for every category a project uses, in both ui/projects.json documents.

Tests: smoke-draft.ts 11/11 (rename re-sluging + category-label rule replace checks 9-12); new scripts/smoke-generated-ids.ts 7/7. Verified: pnpm build (chunk names unchanged, no runtime reference to the generated module), lint with no new warnings, validate:content, resume HTML byte-identical before/after with identical documents.

Docs: spec-v5-generated-content-ids.md added; spec-v4-live-edit.md §3.1 marked superseded + §12 row 23; AGENTS.md and README.md updated.
This commit is contained in:
dong.nguyen committed 2026-10-24 13:16:18 +07:00
1 parent 1a1fc14d0e
commit a3662a9521
18 files changed
+732 -357

No files matched your search

+1 -2
View File
@@ -66,8 +66,7 @@
"mergeHint": "written to the branch — merge into master to deploy",
"offline": "offline — showing bundled content, save disabled",
"draftRestored": "draft restored from this session",
"unionNote": "id unions in src/types/index.ts updated to match the saved content",
"unionFailed": "could not update src/types/index.ts — finish that edit in Gitea",
"labelsUnavailable": "category labels could not be read from this branch — the label check was skipped",
"appearsHome": "home",
"appearsResume": "resume PDF",
"appearsOn": "appears on",
+1 -2
View File
@@ -66,8 +66,7 @@
"mergeHint": "đã ghi lên branch — merge vào master để deploy",
"offline": "ngoại tuyến — đang hiển thị nội dung đóng gói, không lưu được",
"draftRestored": "bản nháp đã khôi phục từ phiên này",
"unionNote": "các id union trong src/types/index.ts đã được cập nhật theo nội dung đã lưu",
"unionFailed": "không cập nhật được src/types/index.ts — hãy hoàn tất sửa trong Gitea",
"labelsUnavailable": "không đọc được nhãn danh mục từ nhánh này — bước kiểm tra nhãn đã được bỏ qua",
"appearsHome": "Trang chủ",
"appearsResume": "CV PDF",
"appearsOn": "xuất hiện tại",