feat: color themes, dark mode, HC/sepia themes, moon tooltip, docs update

This commit is contained in:
catarrh committed 2026-08-02 23:45:56 +03:00
1 parent 857adce5da
commit f45791579b
16 files changed
+389 -240

No files matched your search

+51 -47
View File
@@ -4,11 +4,17 @@
Run enrichment in safe mode first:
```bash
# Dry run to see matches
# Minei dry run
npx tsx scripts/enrich-lives.ts
# Write changes when confident
npx tsx scripts/enrich-lates.ts --write
# Minei write
npx tsx scripts/enrich-lives.ts --write
# Bulgakov dry run
npx tsx scripts/enrich-lives.ts --bulgakov
# Bulgakov write
npx tsx scripts/enrich-lives.ts --bulgakov --write
```
## Common Enrichment Mistakes
@@ -31,20 +37,23 @@ npx tsx scripts/enrich-lates.ts --write
- ⚠️ Don't append to CIds that already have life.text without checking collision behavior
- ⚠️ Don't assume all multi-source CIds follow same pattern
### Bulgakov-Specific Issues
- ⚠️ Bulgakov only covers Menaion (saints by calendar date), not Triodion/Pentecostarion
- ⚠️ Bulgakov is secondary source — only fills gaps, never overrides Minei
- ⚠️ Some Bulgakov entries are feast descriptions, not saint lives — may have no target CId
### Validation Skipping
- ⚠️ Don't skip `npx tsx scripts/validate-data.ts` — it catches real errors
- ⚠️ Don't skip `npx tsc --noEmit` — type errors indicate real problems
- ⚠️ Don't skip `npm run build` — build failures need investigation
- ⚠️ Don't assume "all files valid" without actually running it
- ⚠️ Don't skip data validation — run `validate-data.ts` after changes
## Decision Points for AI Agents
### When to Add MANUAL_FIXES
- When score is 0.35-0.6 and you can identify the correct target
- When source title contains distinctive substring not in other titles on same date
- When auto-matcher picks wrong saint (e.g., different homonym on same date)
- When target CId exists but is listed on wrong calendar date (bundle bug)
- When narrative maps to known CId but has empty life (can be enriched)
- When Bulgakov title contains distinctive substring not in Minei titles
### When to Leave Unmatched
- When source is a narrative or homily without saint association
@@ -60,7 +69,7 @@ npx tsx scripts/enrich-lates.ts --write
## Quality Checkpoints
### After Manual Fixes Addition
- Verify substring uniqueness per date (use verification script)
- Verify substring uniqueness per date
- Check that target CIds exist and are empty
- Re-run dry run to verify improvement
- Check for potential new conflicts with existing fixes
@@ -72,9 +81,9 @@ npx tsx scripts/enrich-lates.ts --write
- Verify no unintended side effects on other files
### Before Committing
- Run full validation: `npx tsx scripts/validate-data.ts`
- Type check: `npx tsc --noEmit`
- Build verify: `npm run build`
- Run data validation: `npx tsx scripts/validate-data.ts`
- Check git status to confirm intended files staged
## Troubleshooting Common Issues
@@ -105,25 +114,20 @@ npx tsx scripts/enrich-lates.ts --write
- ⚠️ **Expected behavior**: First source writes without heading, subsequent sources append
- **Check**: Verify total chapters match expected count for CId
### Strange JSON Syntax Errors
- **Problem**: Parse errors in data files after modification
- **Solution**: Check JSON syntax, fix trailing commas, quote issues
- **Verify**: Run `validate-data.ts` to get specific error location
### Build Size Changes
- **Problem**: Unexpected file size increases/decreases
- **Solution**: Check for malformed content, duplicate data, formatting changes
- **Check**: Compare before/after file sizes in git diff
### Bulgakov-Specific Issues
- **Problem**: Bulgakov entry has no matching CId
- **Solution**: Check if it's a feast day description (not a saint life)
- **Alternative**: Search lives-index.json for the saint's name
- **Check**: Verify the date has the correct CIds in the menaion bundle
## Verification Commands
### Coverage Tracking
```bash
# Check coverage statistics
python3 -c "
import json, glob, os
total=has=0
for fp in glob.glob('static/data/ru/lives/*.json'):
for fp in sorted(glob.glob('static/data/ru/lives/*.json') + glob.glob('static/data/ru/lives/misc/*.json')):
data=json.load(open(fp))
for cid,entry in data.items():
total+=1
@@ -135,14 +139,15 @@ print(f'Coverage: {has}/{total} ({has*100//total}%) lives with text')
### Collision Chapter Count Check
```bash
# Check collision targets have correct chapter counts
python3 -c "
import json, re
misc = json.load(open('static/data/ru/lives/misc.json'))
for cid in ['493', '1674', '257401']: # Known collision targets
text = misc[cid]['life']['text']
headings = re.findall(r'<b>([^<]+)</b>', text)
print(f'{cid}: {len(headings)} chapters')
for fp in ['static/data/ru/lives/misc/4.json', 'static/data/ru/lives/misc/1.json']:
data = json.load(open(fp))
for cid in ['493', '1674', '257401']:
if cid in data:
text = data[cid]['life']['text']
headings = re.findall(r'<b>([^<]+)</b>', text)
print(f'{cid}: {len(headings)} chapters')
"
```
@@ -159,21 +164,22 @@ npx tsx scripts/tools/stats.ts --lang ru
## Recent Context Updates
### Known Fixed Issues
- 868 Иаков Боровицký moved from 05-22 to 10-23 (bundle mis-mapping correction)
- 868 Иаков Боровицкий moved from 05-22 to 10-23 (bundle mis-mapping correction)
- Сретение→373 added (02-02 Сказание about Presentation)
- Захарий Печерский→822 added (03-24 miracle story)
- Анна пророчица→2396 added (08-28 prophetess Anna)
### Current Unmatched Floor
- 27 entries remain unmatched (all narratives/homilies or already-filled targets)
- These are at the floor for Chetyi-Minei source — no recoverable matches available
- **Minei**: 27 entries remain unmatched (all narratives/homilies or already-filled targets)
- **Bulgakov**: 121 entries unmatched (no recoverable targets — saints already have lives or no CId)
- These are at the floor for both sources — no recoverable matches available
## File Routing Quick Reference
### Lives File Routing
- Files: `static/data/ru/lives/01.json` through `12.json` for month-prefixed CIds
- File: `misc.json` for non-month-prefixed CIds
- Route: `bundleFileForCid(cid: string):` checks `/^(0[1-9]|1[0-2])\d+/.test(cid)`
- Files: `static/data/ru/lives/misc/0.json` through `9.json` for non-month-prefixed CIds
- Route: `bundleFileForCid(cid)` checks `/^(0[1-9]|1[0-2])\d+/.test(cid)`
### Bundle File Organization
- Main bundle: `static/data/cu/menaion-bundle.json` (authoritative calendar)
@@ -188,14 +194,14 @@ npx tsx scripts/tools/stats.ts --lang ru
- Confirm coverage increased as expected
### Documentation Updates
- Update DATA_FORMAT.md or DATA_RUS.md if schema changed
- Update DATA_EN.md or DATA_RUS.md if schema changed
- Update coverage statistics in relevant documentation
- Add new manual fixes to enrichment documentation if needed
### Commit Sequence
```bash
# 1. Validate, typecheck, build all passing
npx tsx scripts/validate-data.ts && npx tsc --noEmit && npm run build
# 1. Typecheck, build, validate all passing
npx tsc --noEmit && npm run build && npx tsx scripts/validate-data.ts
# 2. Stage all changes
git add scripts/enrich-lives.ts scripts/output/lives-match-report.json static/data/ru/lives/
@@ -208,20 +214,19 @@ git commit -m "enrich [N] more ru lives: [description]"
### Current Status
- Total CIds: 3046
- Lives with text: 1190 (enriched from Chetyi-Minei)
- Unmatched minei chapters: 27 (floor: narratives, no-target, already-filled)
- Files validated: 274 files (all passing)
- Lives with text: 1203 (enriched from Chetyi-Minei + Bulgakov)
- Unmatched Minei: 27 (floor: narratives, no-target, already-filled)
- Unmatched Bulgakov: 121 (floor: no recoverable targets)
### Recent Enrichment Work
- Baseline: 1009 lives with text (from prior work)
- Latest commits added 181 lives (121 + 57 + 3)
- Manual fixes added: 214 total in enrich-lives.ts
- Bundle corrections applied: 868 date fix
### Sources
- **Chetyi-Minei**: 1190 lives, 64 manual fixes, 27 unmatched at floor
- **Bulgakov Desktop Book**: 13 lives, 9 manual fixes, 121 unmatched at floor
- **Total coverage**: 1203/3046 (39%)
### Progress Tracking
- Review band: 127 entries resolved, 0 remaining
- Unmatched band: 94 → 30 → 27 (final floor)
- Coverage: 1009→1130→1190 lives (181 net increase)
- Minei band: 94 → 30 → 27 (final floor)
- Bulgakov: 332 entries processed, 13 new lives, 121 unmatched
- Coverage: 1009→1130→1190→1203 (194 net increase)
## Example Workflow for Adding Manual Fixes
@@ -240,12 +245,11 @@ Target: 822 (Прп. Захарий Печерский, EMPTY) - correct saint
### Step 3: Verify Uniqueness
```bash
# Check if substring is unique on date 03-24
python3 -c "
import json, re
m=json.load(open('scripts/output/minei.json'))
titles=[t['title'] for t in m['03-24']]
cnt=sum(1 for t in titles if 'воспоминание о чуде' in re.sub(r'\s+',' ',t['title']).lower())
cnt=sum(1 for t in titles if 'воспоминание о чуде' in re.sub(r'\s+',' ',t).lower())
print(f'Count: {cnt}')
"
```