You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add GitHub Actions CI workflow and update Git workflow documentation
Setup automated CI pipeline that runs on all pushes and PRs:
- Type checking with TypeScript
- Linting with ESLint
- Build verification with Next.js
Updated CLAUDE.md to reflect new PR-based workflow:
- All changes go through GitHub Pull Requests
- Never merge to main locally
- Never push main branch directly
- CI validates all changes before merge
This ensures code quality and establishes a proper CI/CD foundation
for the project, even as a solo developer.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
Copy file name to clipboardExpand all lines: CLAUDE.md
+49-26Lines changed: 49 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
7
7
Next.js application called "Map of AI Futures" - an interactive probability flowchart visualizing potential AI future scenarios. Users adjust probability sliders to explore how different decisions affect outcome likelihoods.
8
8
9
9
**Key Features:**
10
+
10
11
- Interactive probability sliders with real-time DAG-based calculations
@@ -16,17 +17,20 @@ Next.js application called "Map of AI Futures" - an interactive probability flow
16
17
## Development
17
18
18
19
**Commands:**
20
+
19
21
-`npm run dev` - Start dev server (http://localhost:3000)
20
22
-`npm run build` - Build for production
21
23
-`npm run lint` - Run ESLint
22
24
23
25
**Process Management:**
26
+
24
27
-**To stop a dev server cleanly:**`fuser -k <port>/tcp` (e.g., `fuser -k 3000/tcp`)
25
28
- This kills all processes using that port, including orphaned child processes
26
29
- More reliable than KillShell which can leave next-server processes running
27
30
- Prevents accumulation of zombie processes that consume CPU/memory
28
31
29
32
**Environment Variables:**
33
+
30
34
-`NEXT_PUBLIC_SUPABASE_URL`
31
35
-`NEXT_PUBLIC_SUPABASE_ANON_KEY`
32
36
-`SUPABASE_SERVICE_ROLE_KEY` (server-side only)
@@ -38,63 +42,78 @@ Next.js application called "Map of AI Futures" - an interactive probability flow
38
42
**Important:** This repository uses **multiple worktrees** - the user may be working in different directories on different branches simultaneously.
39
43
40
44
**Worktree Safety Rule:**
45
+
41
46
-**NEVER** make edits to files in any worktree other than the one Claude Code was started in
42
47
- Only read from, write to, and execute commands within the current working directory
43
48
- If the user needs changes in a different worktree, they will navigate there and start a new session
44
49
45
50
**Development Model:**
46
-
- Solo developer project - no GitHub PRs or code review process
47
-
- Merge feature branches to main locally, then push to GitHub
48
-
- Direct push workflow: test locally → merge to main → push
49
51
50
-
**Branch Merging Protocol:**
51
-
**IMPORTANT:** Only merge to main when the user explicitly says it's time to merge. Do not automatically merge or test for merging during development - features may need multiple iterations before being ready.
52
+
- Solo developer project using GitHub Pull Request workflow
53
+
- All changes go through PRs with automated CI checks
54
+
- Work on feature branches → push to GitHub → create PR → merge via GitHub UI
55
+
-**NEVER merge to main locally**
56
+
-**NEVER push main branch directly**
52
57
53
-
When the user says to merge a feature branch to main, ALWAYS follow this sequence:
58
+
**Pull Request Workflow:**
59
+
60
+
1.**Create and push feature branch:**
54
61
55
-
1.**First, update the feature branch with main:**
56
62
```bash
57
-
git checkout feature-branch
58
-
git merge main
59
-
# Resolve any conflicts HERE on the featurebranch, never on main
63
+
git checkout -b feature-branch
64
+
# Make your changes and commit
65
+
git push origin feature-branch
60
66
```
61
67
62
-
2.**Test after merging:**
63
-
-Clear the Next.js cache: `rm -rf .next`
64
-
-Start dev server: `npm run dev`
65
-
-Verify it runs without errors before proceeding
68
+
2.**Create Pull Request:**
69
+
-Use GitHub UI or `gh pr create` command
70
+
-CI automatically runs type-check, lint, and build
71
+
-PR cannot be merged until all CI checks pass
66
72
67
-
3.**Only then, merge to main using fast-forward only:**
68
-
```bash
69
-
git checkout main
70
-
git merge --ff-only feature-branch
71
-
# If this fails, return to step 1 - there are unresolved issues
72
-
git push origin main
73
-
```
73
+
3.**Merge via GitHub:**
74
+
- Once CI passes and changes are ready, merge via GitHub PR interface
75
+
- Delete feature branch after merging (can be done automatically)
76
+
- Pull latest main locally: `git checkout main && git pull origin main`
77
+
78
+
**CI/CD Pipeline:**
79
+
80
+
- GitHub Actions workflow runs on all pushes and PRs (`.github/workflows/ci.yml`)
- Local pre-commit hooks run same checks (via Husky) to catch issues early
84
+
85
+
**Branch Protection (configure in GitHub settings):**
86
+
87
+
- Require PR reviews before merging (optional for solo dev)
88
+
- Require status checks to pass (CI workflow)
89
+
- Require branches to be up to date before merging
74
90
75
91
**Key Rules:**
76
-
- NEVER merge to main unless the user explicitly says to merge
77
-
- NEVER resolve merge conflicts while on `main` branch
78
-
-ALWAYS use `--ff-only` when merging into main (ensures clean, conflict-free merge)
79
-
-ALWAYS test the dev server after merging but before pushing
80
-
- If user says "merge to main", first update feature branch with main, then merge to main
92
+
93
+
- NEVER merge to main locally - always use GitHub PRs
94
+
-NEVER push main branch directly - only push feature branches
95
+
-Let CI validate all changes before merging
96
+
- If CI fails, fix issues and push updates to the PR branch
81
97
82
98
## Architecture
83
99
84
100
### Core System
85
101
86
102
**Probability Engine:**
103
+
87
104
-**DAG Structure** (`lib/graphData.ts`, `graphData.json`): Nodes (question/start/outcome types) and edges with conditional probabilities
88
105
-**Calculation** (`lib/probability.ts`): Recursive probability propagation with memoization. Question nodes (21 total) use slider values to control YES/NO branch probabilities
89
106
-**URL State** (`lib/urlState.ts`): Slider values encoded as `?p=50i70i25i...` (integers separated by 'i')
90
107
91
108
**Unified Document Storage:**
109
+
92
110
- Single `documents` table replaces old `saved_scenarios` and `user_graphs` tables
93
111
- Each document contains: graph nodes, slider values, metadata (all in one JSONB field)
94
112
- Auto-save with 2-second debounce for authenticated users
95
113
- localStorage fallback for anonymous users with auto-migration on signup
96
114
97
115
**Authentication:**
116
+
98
117
- Supabase passwordless magic link (`lib/supabase/`)
99
118
- Server actions in `lib/actions/documents.ts`
100
119
- Custom `useAuth` hook (`hooks/useAuth.ts`) with localStorage migration logic
@@ -113,23 +132,27 @@ When the user says to merge a feature branch to main, ALWAYS follow this sequenc
113
132
### Important Implementation Details
114
133
115
134
**Node Interaction:**
135
+
116
136
- Clicking a node sets it as probability root (recalculates all probabilities from that point)
0 commit comments