From 3bbc5281e82a638bf75dd09a3dc4166f6c4b9857 Mon Sep 17 00:00:00 2001 From: hugo Date: Fri, 20 Feb 2026 17:54:04 +0100 Subject: [PATCH] feat: first cut at the full renderer --- .claude/settings.local.json | 3 +- CLAUDE.md | 776 ++++++++++++++++ GEMINI.md | 776 ++++++++++++++++ drizzle/0004_overjoyed_paper_doll.sql | 8 + drizzle/meta/0004_snapshot.json | 813 +++++++++++++++++ drizzle/meta/_journal.json | 7 + src/main/database/generatedFileHashStore.ts | 36 + src/main/database/index.ts | 1 + src/main/database/schema.ts | 12 + src/main/engine/BlogGenerationEngine.ts | 564 +++++++++++- src/main/engine/PageRenderer.ts | 812 +++++++++++++++++ src/main/engine/PreviewServer.ts | 856 +----------------- src/main/engine/TaskManager.ts | 8 + src/main/ipc/blogHandlers.ts | 101 ++- src/main/shared/electronApi.ts | 4 + src/renderer/App.tsx | 7 + src/renderer/components/Panel/Panel.css | 62 +- src/renderer/components/Panel/Panel.tsx | 160 +++- .../components/TaskPopup/TaskPopup.css | 35 + .../components/TaskPopup/TaskPopup.tsx | 199 ++-- src/renderer/store/appStore.ts | 2 +- tests/engine/BlogGenerationEngine.test.ts | 514 +++++++++++ tests/ipc/handlers.test.ts | 96 +- tests/renderer/components/Panel.test.tsx | 35 + tests/renderer/components/TaskPopup.test.tsx | 78 ++ 25 files changed, 4989 insertions(+), 976 deletions(-) create mode 100644 CLAUDE.md create mode 100644 GEMINI.md create mode 100644 drizzle/0004_overjoyed_paper_doll.sql create mode 100644 drizzle/meta/0004_snapshot.json create mode 100644 src/main/database/generatedFileHashStore.ts create mode 100644 src/main/engine/PageRenderer.ts create mode 100644 tests/engine/BlogGenerationEngine.test.ts create mode 100644 tests/renderer/components/TaskPopup.test.tsx diff --git a/.claude/settings.local.json b/.claude/settings.local.json index e3e7d67..21eda47 100644 --- a/.claude/settings.local.json +++ b/.claude/settings.local.json @@ -4,7 +4,8 @@ "Bash(npm run build:*)", "Bash(npx tsc:*)", "Bash(node ./node_modules/typescript/bin/tsc:*)", - "Bash(npm run build:main:*)" + "Bash(npm run build:main:*)", + "Bash(npx vitest:*)" ] } } diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..71c7b95 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,776 @@ +# GitHub Copilot Instructions for Blogging Desktop Server (bDS) + +This document provides context and best practices for GitHub Copilot when working on this Electron + TypeScript + SQLite blogging application. + +## Project Overview + +**Blogging Desktop Server (bDS)** is a desktop blogging application built with: +- **Electron** v28+ for cross-platform desktop +- **TypeScript** for all code (strict mode) +- **React** for the renderer UI +- **Drizzle ORM** for type-safe database access +- **@libsql/client** for SQLite (local database) +- **Zustand** for React state management + +--- + +## ⚠️ MANDATORY: Test-First Development + +**STOP!** Before writing ANY implementation code, you MUST: + +1. **Write a failing test first** that describes the expected behavior +2. **Run the test** to confirm it fails (Red) +3. **Write minimal code** to make the test pass (Green) +4. **Refactor** while keeping tests green + +> **No code without tests. No exceptions.** +> +> Tests must import and exercise the REAL implementation classes, not inline helper functions. +> Mock only external dependencies (database, filesystem), never the class under test. + +See the [TDD Requirements](#test-driven-development-tdd-requirements) section for detailed guidelines. + +--- + +## ⚠️ MANDATORY: Fix All Test Failures + +**You MUST investigate and fix ALL test failures before completing any task.** + +- Never leave tests failing, even if they appear unrelated to your changes +- If a test failure is pre-existing, fix it as part of your current work +- Run the full test suite (`npm test`) before considering any task complete +- If you cannot fix a test, explain why and propose a solution + +> **Zero failing tests. No exceptions.** + +--- + +## ⚠️ MANDATORY: Remove Unused Code + +**Never keep unused code around. Always delete it completely.** + +- When a feature is removed, delete ALL related code (implementation, tests, types, configs) +- Do NOT comment out code "for later" - use version control history +- Do NOT skip tests for removed functionality - delete them +- Do NOT leave dead code paths, unused imports, or orphaned functions +- When refactoring, actively look for and remove any code that becomes unused + +> **Delete unused code immediately. No exceptions.** + +--- + +## ⚠️ MANDATORY: Build Verification After Code Changes + +**You MUST run the full build after making code changes.** + +- Run `npm run build` after any code modifications +- Fix ALL build errors before considering the task complete +- Build errors indicate issues that may not be caught by `tsc --noEmit` alone (e.g., event forwarding, renderer build) +- The build must complete successfully before the task is complete + +> **Successful build required. No exceptions.** + +--- + +## ⚠️ MANDATORY: No External JS/CSS in Preview or Generated HTML + +**Do not reference external JavaScript or CSS libraries (CDNs/remote URLs) from the preview server output or generated HTML.** + +- Preview HTML must reference only local/package-bundled assets +- Generated HTML must not include CDN-hosted JS/CSS libraries +- If a library is needed (e.g., Pico CSS, Lightbox), include it as a local dependency and serve/reference it locally +- Avoid introducing any new `