Skip to content

Commit a8b5452

Browse files
committed
add CONTRIBUTING.md, .env.example, and CI workflow
1 parent 96fac47 commit a8b5452

3 files changed

Lines changed: 217 additions & 36 deletions

File tree

.env.example

Lines changed: 13 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,18 @@
1-
# ─── Supabase ────────────────────────────────────────────────────────────────
2-
# Project URL from Supabase dashboard → Settings → API
1+
NEXT_PUBLIC_SITE_URL=http://localhost:3000
32
NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co
3+
NEXT_PUBLIC_SUPABASE_ANON_KEY=
4+
SUPABASE_SERVICE_ROLE_KEY=
45

5-
# Anon (public) key — safe to expose in browser
6-
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key
6+
R2_ACCOUNT_ID=
7+
R2_ACCESS_KEY_ID=
8+
R2_SECRET_ACCESS_KEY=
9+
R2_BUCKET_NAME=agent-postmortem
10+
R2_PUBLIC_URL=https://pub-xxx.r2.dev
711

8-
# Service role key — SERVER ONLY, never expose to client
9-
SUPABASE_SERVICE_ROLE_KEY=your-service-role-key
12+
RESEND_API_KEY=
1013

11-
# ─── Cloudflare R2 (S3-compatible) ───────────────────────────────────────────
12-
# Account ID from Cloudflare dashboard
13-
R2_ACCOUNT_ID=your-account-id
14+
ADMIN_PASSWORD=change-me
1415

15-
# R2 bucket name
16-
R2_BUCKET_NAME=agent-postmortem-uploads
17-
18-
# R2 API credentials (create in Cloudflare → R2 → Manage R2 API tokens)
19-
R2_ACCESS_KEY_ID=your-r2-access-key
20-
R2_SECRET_ACCESS_KEY=your-r2-secret-key
21-
22-
# Public base URL for R2 (after enabling public access or via custom domain)
23-
NEXT_PUBLIC_R2_PUBLIC_URL=https://pub-xxxx.r2.dev
24-
25-
# ─── Resend (email) ──────────────────────────────────────────────────────────
26-
# API key from resend.com dashboard
27-
RESEND_API_KEY=re_xxxxxxxxxxxxxxxxxxxx
28-
29-
# From address for system emails
30-
RESEND_FROM_EMAIL=noreply@agentpostmortem.com
31-
32-
# ─── Security / PII ──────────────────────────────────────────────────────────
33-
# Secret pepper for HMAC-SHA256 IP hashing (generate with: openssl rand -hex 32)
34-
IP_HASH_PEPPER=your-secret-pepper-here
35-
36-
# ─── Admin ───────────────────────────────────────────────────────────────────
37-
# Password for the admin moderation dashboard
38-
ADMIN_PASSWORD=your-admin-password
39-
40-
# ─── App ─────────────────────────────────────────────────────────────────────
41-
NEXT_PUBLIC_APP_URL=http://localhost:3000
16+
# 32+ random hex characters — generate with: node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"
17+
# Never change this after launch — it will invalidate all existing IP hashes
18+
IP_HASH_PEPPER=

.github/workflows/ci.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
lint-and-typecheck:
11+
name: Lint & Type Check
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- uses: actions/setup-node@v4
18+
with:
19+
node-version: 20
20+
cache: npm
21+
22+
- name: Install dependencies
23+
run: npm ci
24+
25+
- name: Type check
26+
run: npx tsc --noEmit
27+
28+
- name: Lint
29+
run: npm run lint
30+
31+
format-check:
32+
name: Format Check
33+
runs-on: ubuntu-latest
34+
35+
steps:
36+
- uses: actions/checkout@v4
37+
38+
- uses: actions/setup-node@v4
39+
with:
40+
node-version: 20
41+
cache: npm
42+
43+
- name: Install dependencies
44+
run: npm ci
45+
46+
- name: Check formatting
47+
run: npx prettier --check .
48+
49+
build:
50+
name: Build
51+
runs-on: ubuntu-latest
52+
needs: [lint-and-typecheck]
53+
54+
env:
55+
NEXT_PUBLIC_SITE_URL: https://agentpostmortem.com
56+
NEXT_PUBLIC_SUPABASE_URL: https://placeholder.supabase.co
57+
NEXT_PUBLIC_SUPABASE_ANON_KEY: placeholder
58+
SUPABASE_SERVICE_ROLE_KEY: placeholder
59+
R2_ACCOUNT_ID: placeholder
60+
R2_ACCESS_KEY_ID: placeholder
61+
R2_SECRET_ACCESS_KEY: placeholder
62+
R2_BUCKET_NAME: placeholder
63+
R2_PUBLIC_URL: https://placeholder.r2.dev
64+
RESEND_API_KEY: placeholder
65+
ADMIN_PASSWORD: placeholder
66+
IP_HASH_PEPPER: placeholder-pepper-32-chars-xxxxxxxxxxxxxxxx
67+
68+
steps:
69+
- uses: actions/checkout@v4
70+
71+
- uses: actions/setup-node@v4
72+
with:
73+
node-version: 20
74+
cache: npm
75+
76+
- name: Install dependencies
77+
run: npm ci
78+
79+
- name: Build
80+
run: npm run build

CONTRIBUTING.md

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
# Contributing to AgentPostmortem
2+
3+
Thanks for your interest in contributing. This document covers how to set up the project locally, what kinds of contributions are welcome, and how to submit them.
4+
5+
---
6+
7+
## Getting started
8+
9+
### Prerequisites
10+
11+
- Node.js 20+
12+
- A Supabase project (free tier works)
13+
- Git
14+
15+
### Setup
16+
17+
```bash
18+
git clone https://github.com/AgentPostmortem/agent-postmortem
19+
cd agent-postmortem
20+
npm install
21+
```
22+
23+
Copy the environment template and fill in your own values:
24+
25+
```bash
26+
cp .env.example .env.local
27+
```
28+
29+
Run the database migration in your Supabase project (paste into the SQL editor or use the CLI):
30+
31+
```bash
32+
# Via Supabase CLI
33+
npx supabase link --project-ref <your-ref>
34+
npx supabase db push
35+
```
36+
37+
Start the dev server:
38+
39+
```bash
40+
npm run dev
41+
```
42+
43+
---
44+
45+
## Development workflow
46+
47+
Before pushing, run:
48+
49+
```bash
50+
npm run lint # ESLint
51+
npm run format # Prettier
52+
npx tsc --noEmit # TypeScript
53+
```
54+
55+
CI runs all three on every PR — failing any of them will block merge.
56+
57+
---
58+
59+
## What to contribute
60+
61+
### Adding a new agent
62+
63+
Agents live in two places:
64+
65+
1. **`lib/constants/agents.ts`** — add the agent metadata (slug, name, company, description)
66+
2. **Database** — the submit form fetches agents dynamically from the DB, so the agent also needs to be seeded
67+
68+
For local testing, insert it directly:
69+
70+
```bash
71+
npm run db "INSERT INTO agents (slug, name, company, description) VALUES ('my-agent', 'My Agent', 'Company', 'Description.');"
72+
```
73+
74+
For production, include the INSERT in your PR description and a maintainer will run it.
75+
76+
### Adding a new tag
77+
78+
Tags follow the same pattern — add to `lib/constants/tags.ts` and include the DB insert in your PR.
79+
80+
### UI / bug fixes
81+
82+
- Keep changes focused — one fix or feature per PR
83+
- Match the existing design tokens (`bg-canvas`, `accent-red`, `text-tertiary`, etc.) defined in `tailwind.config.ts`
84+
- Test on both mobile and desktop before submitting
85+
86+
### New features
87+
88+
Open an issue first to discuss before building. Large PRs without prior discussion may not be merged.
89+
90+
---
91+
92+
## Pull request checklist
93+
94+
- [ ] `npm run lint` passes
95+
- [ ] `npx tsc --noEmit` passes
96+
- [ ] `npm run format` applied
97+
- [ ] Tested locally on dev server
98+
- [ ] PR description explains what changed and why
99+
100+
---
101+
102+
## Project structure
103+
104+
See the [README](README.md) for a full breakdown of the directory structure.
105+
106+
---
107+
108+
## Code style
109+
110+
- **TypeScript strict mode** — no `any`, no type assertions unless unavoidable
111+
- **No comments explaining what code does** — only add a comment when the *why* is non-obvious
112+
- **No unused code** — don't leave dead imports or variables
113+
- **Tailwind only** — no inline styles, no CSS modules
114+
- **Server components by default** — only add `"use client"` when interactivity is required
115+
116+
---
117+
118+
## Reporting issues
119+
120+
Open a GitHub issue with:
121+
- What you expected to happen
122+
- What actually happened
123+
- Steps to reproduce
124+
- Browser / OS if it's a UI bug

0 commit comments

Comments
 (0)