From b1b2af15300212aad14d588978764f2d799ef496 Mon Sep 17 00:00:00 2001 From: Rex Owen <87263240+RexOwenDev@users.noreply.github.com> Date: Mon, 27 Apr 2026 23:03:44 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20pre-presentation=20cleanup=20=E2=80=94?= =?UTF-8?q?=20middleware,=20README=20accuracy,=20CLAUDE.md=20privacy,=20CI?= =?UTF-8?q?,=20gitignore?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 19 ++++++++++ .gitignore | 3 ++ CLAUDE.md | 75 ++-------------------------------------- README.md | 29 ++++++++-------- src/middleware.ts | 1 + 5 files changed, 41 insertions(+), 86 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 src/middleware.ts diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..689bf4b --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,19 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'npm' + - run: npm ci + - run: npm test diff --git a/.gitignore b/.gitignore index 15dd188..ff78a10 100644 --- a/.gitignore +++ b/.gitignore @@ -81,3 +81,6 @@ fix_*.js # Client deliverable HTML files live under /public or /src/templates, not in repo root automation-meeting-prep.html + +# AI planning artifacts — internal only, not for public portfolio +docs/superpowers/ diff --git a/CLAUDE.md b/CLAUDE.md index e02e672..b9989d9 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -6,7 +6,7 @@ - Next.js 16 (App Router) with React 19 + React Compiler - TypeScript strict mode - Tailwind CSS v4 for app UI — proposal CSS is preserved separately -- Tiptap (headless rich text editor) for inline editing +- Custom block editor (contenteditable-based) for inline editing - Supabase (PostgreSQL + Auth + Storage) - Deployed on Vercel @@ -16,74 +16,5 @@ 3. Public view (/p/[slug]) requires NO auth 4. Auto-save with debounce — no manual save buttons 5. No drag-and-drop — click-to-edit only -6. Design Shopp is a PE client — data flows through Claude models ONLY -7. Use proxy.ts (not middleware.ts) for Next.js 16 -8. All request APIs are async: await cookies(), await headers(), await params - ---- - -# N8N Automation — Claude Code Expert Context - -## My n8n Instance -- URL: https://designshopp.app.n8n.cloud -- MCP: n8n-mcp (czlonkowski) — 1,239 nodes available -- Platform: n8n Cloud (hosted) - -## Mandatory Rules — Follow Every Session -1. Always run `search_nodes` BEFORE configuring any node — never guess node names -2. Always run `n8n_validate_workflow` BEFORE deploying any workflow -3. Always use `n8n_update_partial_workflow` for edits — never rewrite full workflows unless explicitly asked -4. Webhook data lives at `$json.body` — NOT `$json` directly -5. Always prefer native n8n nodes over HTTP Request when a dedicated integration node exists -6. Always activate workflows after creating unless explicitly told otherwise -7. Always add error handling on any node that touches an external API - -## Active Client Projects - -### CMCA (SEO Automation) -- Multi-phase workflow: P0, P2, P3-P4-P5 -- Files: workflows/CMCA/ -- Key files: build_update.js, p0_build_update.js, p2_build_update.js -- Payloads: P0_update_payload.json, P2_update_payload.json, P3-P4-P5_update_payload.json -- Status: Phase 1 complete (see SEO_Report_Automation_Phase1_Summary.md) -- Phase 2 brief: .claude/worktrees/epic-villani/SEO_Automation_Phase2_WorkBrief.md - -### Tornatech -- Translation Phase 2 automated -- File: workflows/Tornatech/TORNATECH-Translation-Phase2-Automated.json - -### CUAL -- Error notification handler active: foILvSy2LhUGBqkQ -- Status: Active client, error handler running - -## Workflow File Conventions -- `_nodes.json` — node definitions -- `_connections.json` — connection maps -- `*_build_update.js` — build scripts -- `*_update_payload.json` — API update payloads -- `_p0_*`, `_p2_*` — phase-specific files - -## Code Preferences -- JavaScript in Code nodes (not Python unless specifically requested) -- Always use try/catch on external API calls -- Use `$input.all()` for multi-item processing -- Use `$input.first()` for single-item processing - -## n8n Expression Quick Reference -- Current item data: `{{ $json.fieldName }}` -- Webhook body data: `{{ $json.body.fieldName }}` -- Previous node data: `{{ $node["NodeName"].json.fieldName }}` -- Current timestamp: `{{ $now }}` -- Environment variable: `{{ $env.VAR_NAME }}` -- All items from node: `{{ $("NodeName").all() }}` - -## MCP Tools Priority Order -1. `search_nodes` — find correct node before anything else -2. `search_templates` — check templates before building from scratch -3. `get_node` — get full node schema (`summary` level for quick checks, full for details) -4. `n8n_validate_workflow` / `validate_workflow` — validate before every deploy -5. `n8n_autofix_workflow` — auto-detect and fix workflow errors -6. `n8n_update_partial_workflow` — preferred update method -7. `n8n_update_full_workflow` — full workflow replacement (use sparingly) -8. `n8n_workflow_versions` — view/restore version history if something breaks -9. `n8n_create_workflow` — only for new workflows +6. Middleware lives in `src/middleware.ts` — it re-exports from `src/proxy.ts` +7. All request APIs are async: await cookies(), await headers(), await params diff --git a/README.md b/README.md index 5c973e8..2e26850 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ Every action is logged to an append-only audit trail with timestamp and user ide flowchart TD subgraph Client["Browser / Mobile"] A1[Dashboard] - A2["Rich Text Editor — Tiptap + auto-save"] + A2["Rich Text Editor — Block editor + auto-save"] A3[Public Proposal Page] A4["Login — Magic Link + Google OAuth"] end @@ -137,7 +137,7 @@ sequenceDiagram | Framework | Next.js 16 — App Router | Server components, async params, Edge-compatible middleware | | Language | TypeScript — strict mode | Catches entire classes of runtime bugs at compile time | | Styling | Tailwind CSS v4 | Zero-runtime CSS, co-located with components | -| Editor | Tiptap | Headless rich text — full control over rendering and serialization | +| Editor | Custom block editor | Contenteditable blocks — full control over rendering and serialization | | Database | Supabase (PostgreSQL + Auth + Realtime) | RLS at DB layer, built-in auth, real-time subscriptions | | AI | Anthropic Claude via AI SDK | Best-in-class instruction following for structured document generation | | Email | Resend | Transactional email with high deliverability | @@ -148,9 +148,9 @@ sequenceDiagram ## Screenshot -![Collaborative Tiptap editor with real-time comments and AI assist](docs/editor-mockup.jpg) +![Collaborative editor with real-time comments and AI assist](docs/editor-mockup.jpg) -The Tiptap-powered editor supports inline formatting, section navigation, real-time comment threads via Supabase Realtime, auto-save with conflict detection, and inline AI assistance — all while three team members edit the same proposal simultaneously. +The block editor supports inline formatting, section navigation, real-time comment threads via Supabase Realtime, auto-save with conflict detection, and inline AI assistance — all while three team members edit the same proposal simultaneously. --- @@ -159,7 +159,7 @@ The Tiptap-powered editor supports inline formatting, section navigation, real-t | Feature | Detail | |---|---| | **AI proposal generation** | Claude generates full proposals from a brief — title, sections, pricing blocks | -| **Rich text editing** | Tiptap editor with inline formatting, block structure, section sidebar navigation | +| **Rich text editing** | Custom block editor with inline formatting, block structure, section sidebar navigation | | **Real-time comments** | Supabase Realtime syncs comments live across all open sessions with dedup | | **Inline comment editing** | Add, resolve, and edit comment threads directly on highlighted text | | **Auto-save** | Debounced 800ms write on every keystroke — no manual save button | @@ -212,15 +212,16 @@ src/ │ ├── dashboard/ Proposal grid, cards, skeleton, create modal │ ├── editor/ Toolbar, realtime comment panel, section sidebar │ └── proposal/ Public renderer (sandboxed iframe), accept button -└── lib/ - ├── ai/ Claude prompt engineering + generation logic - ├── email/ Resend transactional email templates - ├── supabase/ SSR server client + browser client - ├── api.ts Shared security headers + ok/err response helpers - ├── audit.ts Audit event writer (service role, fire-and-forget) - ├── constants.ts Rate limits, field limits, timeouts — single source of truth - ├── env.ts Startup env validation with typed accessors - └── logger.ts Structured JSON logger — stack traces stripped in production +├── lib/ +│ ├── ai/ Claude prompt engineering + generation logic +│ ├── email/ Resend transactional email templates +│ ├── supabase/ SSR server client + browser client +│ ├── api.ts Shared security headers + ok/err response helpers +│ ├── audit.ts Audit event writer (service role, fire-and-forget) +│ ├── constants.ts Rate limits, field limits, timeouts — single source of truth +│ ├── env.ts Startup env validation with typed accessors +│ └── logger.ts Structured JSON logger — stack traces stripped in production +└── middleware.ts Auth guard + security headers (re-exports from proxy.ts) ``` --- diff --git a/src/middleware.ts b/src/middleware.ts new file mode 100644 index 0000000..7522971 --- /dev/null +++ b/src/middleware.ts @@ -0,0 +1 @@ +export { proxy as middleware, config } from '@/proxy';