Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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/
75 changes: 3 additions & 72 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
29 changes: 15 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 |
Expand All @@ -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.

---

Expand All @@ -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 |
Expand Down Expand Up @@ -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)
```

---
Expand Down
1 change: 1 addition & 0 deletions src/middleware.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { proxy as middleware, config } from '@/proxy';
Loading