Repository navigation
Claude/missionary calendar app ti6dr6 #2764
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 150 commits
1126e73
45996ff
a76767f
77bca8c
3274d51
2c7443e
8130078
297274c
07f2351
ade9cef
09185c1
f94ad31
4bd1bf7
f130bc2
9cbc23f
026aded
8c0a082
8bda2b8
499de24
602bd29
e034da2
d08509c
065a8a8
b1e64aa
816d3b2
d1839c9
5e3eea7
a6ccd6d
e3a6368
9acaab4
2515e64
9d3386b
fb85952
a206943
9ffff26
e08d112
1006ba1
fca59ed
53de0f0
5135401
cb149f0
40dc565
b5f6fc2
1be23d5
7178983
291c8ce
51e7d1d
53f2c77
9f0de36
3c633e9
0b96c06
4488d4f
002f930
4bb5d2c
af7987b
5e789d0
322a7ac
ed021a0
a84eef0
6476128
aee69d6
f6f6b2a
e427bd5
3468cb7
f06bde8
a9426d2
e1dce49
fc4ce51
027fe02
3a57611
4dbfc4a
b3dc2cd
d9affb8
23c0c5e
54ee3a2
3dc3a18
324e0a7
c6d92d9
60439e6
6905c26
aaf8907
3f57e79
9dc9214
5b4c0bc
ec46d76
ea96c80
17c0678
2c44b5a
7a737a9
89701f1
3fcffb5
268c610
272f0de
55224d5
41281ea
87477ad
155812c
26e6885
d92cb09
3728580
1c4599b
a5a9c25
b38e4a2
2746664
a95ad81
4996d3c
6249215
b17a8b9
84b3012
308f99d
ef878ad
3db6cd4
25c4f29
3f6e433
07a7e11
9b0d3bb
40b7b54
3bbf474
581d771
db48606
65cfa97
84b9154
45fbaeb
e413f98
0abd78d
95d1121
af3aa6b
78f5447
220de02
8ddaa82
de30b5e
cecdfd9
68f67b4
b974998
4d6f8b1
fa46c7e
d025d3e
c71aadb
96940ff
c68557f
e95ebc5
970eea7
af451db
9c0fec4
d5a0f3a
7dafb5a
63ad306
78acaeb
cef06fa
13ff219
ded3e5b
48f93d0
1e15553
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| name: Deploy schedule app | ||
|
|
||
| # Builds schedule-app/ and publishes it to GitHub Pages. Once Pages is enabled | ||
| # (Settings → Pages → Source: "GitHub Actions"), every push that touches the app | ||
| # redeploys it to https://<owner>.github.io/<repo>/. | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| - claude/missionary-calendar-app-ti6dr6 | ||
| paths: | ||
| - 'schedule-app/**' | ||
| - '.github/workflows/deploy-schedule-app.yml' | ||
| workflow_dispatch: | ||
|
|
||
| # Least-privilege token, plus the scopes the Pages deploy needs. | ||
| permissions: | ||
| contents: read | ||
| pages: write | ||
| id-token: write | ||
|
Comment on lines
+18
to
+21
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- workflow ---'
cat -n .github/workflows/deploy-schedule-app.yml
printf '%s\n' '--- related package metadata ---'
if [ -f schedule-app/package.json ]; then
cat -n schedule-app/package.json
fi
printf '%s\n' '--- action references ---'
rg -n 'uses:|node-version|environment:|permissions:|npm (ci|run build)' .github/workflows/deploy-schedule-app.ymlRepository: affaan-m/ECC Length of output: 3394 🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- Pages environment policy ---'
curl -fsSL https://api.github.com/repos/affaan-m/ECC/environments/github-pages \
-H 'Accept: application/vnd.github+json' |
jq '{name, protection_rules, deployment_branch_policy}'
printf '%s\n' '--- workflow and lockfile tracking ---'
git ls-files .github/workflows/deploy-schedule-app.yml schedule-app/package-lock.json
printf '%s\n' '--- workflow-level versus job-level permissions ---'
python3 - <<'PY'
from pathlib import Path
import re
text = Path(".github/workflows/deploy-schedule-app.yml").read_text()
workflow = re.search(r"(?ms)^permissions:\n(.*?)(?=^\S|\Z)", text)
build = re.search(r"(?ms)^ build:\n(.*?)(?=^ deploy:|\Z)", text)
deploy = re.search(r"(?ms)^ deploy:\n(.*)", text)
print("workflow_permissions:", workflow.group(1).strip().splitlines() if workflow else None)
print("build_has_job_permissions:", bool(build and re.search(r"(?m)^ permissions:", build.group(1))))
print("deploy_has_job_permissions:", bool(deploy and re.search(r"(?m)^ permissions:", deploy.group(1))))
PYRepository: affaan-m/ECC Length of output: 543 🌐 Web query:
💡 Result: Node.js 20 (codenamed "Iron") reached its official end-of-life (EOL) on April 30, 2026 [1][2]. As of today, August 11, 2026, this version is no longer supported by the Node.js project, meaning it does not receive security patches, bug fixes, or any other updates [3][4]. Users still running applications on Node.js 20 are advised to migrate to a currently supported version of Node.js to ensure the security and stability of their environments [3][5]. Citations:
🌐 Web query:
💡 Result: In GitHub Actions, the Citations:
Scope deployment permissions to the
🧰 Tools🪛 zizmor (1.29.0)[error] 20-20: overly broad permissions (excessive-permissions): pages: write is overly broad at the workflow level (excessive-permissions) [error] 21-21: overly broad permissions (excessive-permissions): id-token: write is overly broad at the workflow level (excessive-permissions) [warning] 20-20: permissions without explanatory comments (undocumented-permissions): needs an explanatory comment (undocumented-permissions) 🤖 Prompt for AI AgentsSources: Path instructions, Linters/SAST tools |
||
|
|
||
| # Allow one Pages deploy at a time; don't cancel an in-flight publish. | ||
| concurrency: | ||
| group: pages | ||
| cancel-in-progress: false | ||
|
|
||
| jobs: | ||
| build: | ||
| name: Build | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 10 | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
for action in \
actions/checkout@v4 \
actions/setup-node@v4 \
actions/upload-pages-artifact@v3 \
actions/deploy-pages@v4
do
repo="${action%@*}"
tag="${action#*@}"
sha="$(git ls-remote "https://github.com/${repo}.git" "refs/tags/${tag}^{}" \
| awk 'NR == 1 { print $1 }')"
sha="${sha:-$(git ls-remote "https://github.com/${repo}.git" "refs/tags/${tag}" \
| awk 'NR == 1 { print $1 }')}"
printf '%s@%s # %s\n' "$repo" "$sha" "$tag"
doneRepository: affaan-m/ECC Length of output: 421 🏁 Script executed: #!/bin/bash
set -euo pipefail
file=".github/workflows/deploy-schedule-app.yml"
sed -n '25,78p' "$file"
python3 - <<'PY'
from pathlib import Path
p = Path(".github/workflows/deploy-schedule-app.yml")
text = p.read_text()
expected = [
"actions/checkout@v4",
"actions/setup-node@v4",
"actions/upload-pages-artifact@v3",
"actions/deploy-pages@v4",
]
for ref in expected:
print(f"{ref}: {text.count(ref)} occurrence(s)")
PY
if command -v gh >/dev/null 2>&1; then
for item in \
"actions/checkout v4 11d5960a326750d5838078e36cf38b85af677262" \
"actions/setup-node v4 49933ea5288caeca8642d1e84afbd3f7d6820020" \
"actions/upload-pages-artifact v3 56afc609e74202658d3ffba0e8f6dda462b719fa" \
"actions/deploy-pages v4 d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e"
do
set -- $item
repo="$1/$2"
tag="$3"
sha="$4"
printf '%s tag: ' "$repo"
gh api "repos/$repo/git/ref/tags/$tag" --jq '.object.type + " " + .object.sha'
printf '%s commit: ' "$repo"
gh api "repos/$repo/commits/$sha" --jq '.sha'
done
else
echo "gh is not available; no API commit-resolution check was run" >&2
fiRepository: affaan-m/ECC Length of output: 1403 Pin all four actions to full commit SHAs. Replace the mutable version tags at lines 35, 40, 55, and 70 with immutable commit SHA references. 🧰 Tools🪛 zizmor (1.29.0)[error] 35-35: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy) (unpinned-uses) 📍 Affects 1 file
🤖 Prompt for AI AgentsSources: Path instructions, Linters/SAST tools |
||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Setup Node | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '20' | ||
| cache: npm | ||
| cache-dependency-path: schedule-app/package-lock.json | ||
|
|
||
| - name: Install dependencies | ||
| working-directory: schedule-app | ||
| run: npm ci | ||
|
|
||
| - name: Build | ||
| working-directory: schedule-app | ||
| run: npm run build | ||
|
|
||
| - name: Upload Pages artifact | ||
| uses: actions/upload-pages-artifact@v3 | ||
| with: | ||
| path: schedule-app/dist | ||
|
|
||
| deploy: | ||
| name: Deploy | ||
| needs: build | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 10 | ||
| environment: | ||
| name: github-pages | ||
| url: ${{ steps.deployment.outputs.page_url }} | ||
| steps: | ||
| - name: Deploy to GitHub Pages | ||
| id: deployment | ||
| uses: actions/deploy-pages@v4 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| # Postgres connection string. In production this comes from Render/Railway's | ||
| # managed Postgres add-on. For local dev, see backend/README.md. | ||
| DATABASE_URL="postgresql://user:password@localhost:5432/keystone_dev?schema=public" | ||
|
|
||
| # Clerk Dashboard -> your app -> API Keys | ||
| CLERK_PUBLISHABLE_KEY="pk_test_..." | ||
| CLERK_SECRET_KEY="sk_test_..." | ||
| # Clerk Dashboard -> Webhooks -> your endpoint -> Signing Secret | ||
| CLERK_WEBHOOK_SIGNING_SECRET="whsec_..." | ||
|
|
||
| # Stripe Dashboard -> Developers -> API keys (use test-mode keys until launch) | ||
| STRIPE_SECRET_KEY="sk_test_..." | ||
| # Stripe Dashboard -> Developers -> Webhooks -> your endpoint -> Signing secret | ||
| STRIPE_WEBHOOK_SECRET="whsec_..." | ||
| # Price ID for the one-time Pro purchase (Stripe Dashboard -> Product | ||
| # catalog). This must be a **one-time** price, not a recurring one — | ||
| # checkout runs in `payment` mode and a recurring price will be rejected. | ||
| # STRIPE_PRICE_ID is accepted as a fallback name. | ||
| STRIPE_PRICE_ID_LIFETIME="price_..." | ||
|
|
||
| # Anthropic Console -> API keys. Powers the in-app assistant (the chat | ||
| # bubble). Optional: leave it unset and the bubble simply doesn't appear. | ||
| # This key must never be copied into the frontend's own .env — anything in | ||
| # the PWA bundle is public. | ||
| ANTHROPIC_API_KEY="sk-ant-..." | ||
|
|
||
| # The deployed frontend's origin (CORS + redirect URLs). Use your Vite dev | ||
| # server URL (e.g. http://localhost:5173) while developing locally. | ||
| FRONTEND_URL="http://localhost:5173" | ||
|
|
||
| PORT=4000 |
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,3 @@ | ||||||||||||||
| node_modules/ | ||||||||||||||
| .env | ||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win Ignore all The pattern 🔒 Proposed fix node_modules/
-.env
+.env
+.env.*
+!.env.example
generated/As per coding guidelines: "NEVER hardcode secrets in source code - ALWAYS use environment variables or a secret manager". 📝 Committable suggestion
Suggested change
🤖 Prompt for AI AgentsSource: Coding guidelines |
||||||||||||||
| generated/ | ||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,191 @@ | ||
| # Keystone backend | ||
|
|
||
| Accounts + billing for Keystone. This service does **not** yet store your | ||
| calendar/contacts data — that still lives in the browser's `localStorage`, | ||
| same as before. This is just the foundation: who you are (Clerk) and | ||
| whether you're paying (Stripe). Syncing the actual app data to the server | ||
| is separate follow-up work. | ||
|
Comment on lines
+3
to
+7
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win Correct the data-storage description. Lines 3-7 state that calendar and contact data remains only in 🤖 Prompt for AI Agents |
||
|
|
||
| ## Stack | ||
|
|
||
| - Node.js + Express (ESM) | ||
| - Postgres via Prisma 7 (`@prisma/client` + `@prisma/adapter-pg`) | ||
| - [Clerk](https://clerk.com) for accounts/sessions | ||
| - [Stripe](https://stripe.com) for subscription billing | ||
|
|
||
| ## 1. Local development | ||
|
|
||
| ### Database | ||
|
|
||
| You need a local Postgres instance. Quickest path with Postgres already | ||
| installed: | ||
|
|
||
| ```bash | ||
| sudo -u postgres psql -c "CREATE USER keystone WITH PASSWORD 'keystone_dev' CREATEDB;" | ||
| sudo -u postgres psql -c "CREATE DATABASE keystone_dev OWNER keystone;" | ||
| ``` | ||
|
|
||
| Or use Docker: `docker run -d -p 5432:5432 -e POSTGRES_PASSWORD=keystone_dev -e POSTGRES_USER=keystone -e POSTGRES_DB=keystone_dev postgres:16`. | ||
|
Comment on lines
+23
to
+28
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win Do not publish PostgreSQL with a documented password. Lines 23-28 use Require a user-provided local password and bind the development database to As per coding guidelines: "Never hardcode API keys, passwords, tokens, or other secrets; use environment variables or a secret manager." 🤖 Prompt for AI AgentsSource: Coding guidelines |
||
|
|
||
| ### Install + configure | ||
|
|
||
| ```bash | ||
| cd backend | ||
| npm install | ||
| cp .env.example .env # fill in DATABASE_URL at minimum to start | ||
| npm run db:migrate # applies prisma/migrations, generates the client | ||
| npm run dev # http://localhost:4000 | ||
| ``` | ||
|
|
||
| `GET /api/health` should return `{"ok":true}` even before Clerk/Stripe are | ||
| configured — auth-gated routes will 500 until those env vars are real. | ||
|
Comment on lines
+40
to
+41
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
ast-grep outline backend/src/app.js --items all
ast-grep outline backend/src/server.js --items all
rg -n -C 4 \
'process\.env|CLERK_|STRIPE_|ANTHROPIC_|DATABASE_URL|listen\(|throw new Error' \
backend/src/app.js backend/src/server.jsRepository: affaan-m/ECC Length of output: 2677 🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
printf '%s\n' '--- backend/src/server.js ---'
cat -n backend/src/server.js
printf '%s\n' '--- backend/src/app.js ---'
cat -n backend/src/app.js
printf '%s\n' '--- route configuration usage ---'
rg -n -C 3 \
'CLERK_|STRIPE_|process\.env|clerkMiddleware|auth\(|requireAuth|new Stripe|DATABASE_URL' \
backend/src backend/package.jsonRepository: affaan-m/ECC Length of output: 9259 🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
printf '%s\n' '--- package metadata ---'
cat -n backend/package.json
rg -n -C 2 \
'requireAuth|auth\(|clerkMiddleware|STRIPE_SECRET_KEY|STRIPE_PRICE_ID|CLERK_SECRET_KEY|CLERK_PUBLISHABLE_KEY' \
backend/src backend/package-lock.json backend/pnpm-lock.yaml backend/yarn.lock 2>/dev/null || true
printf '%s\n' '--- route entry points ---'
for file in backend/src/routes/me.js backend/src/routes/billing.js backend/src/routes/data.js backend/src/routes/calendars.js backend/src/routes/assistant.js; do
if [ -f "$file" ]; then
echo "--- $file ---"
cat -n "$file"
fi
doneRepository: affaan-m/ECC Length of output: 37845 Fail fast when required route configuration is missing.
🤖 Prompt for AI AgentsSource: Coding guidelines |
||
|
|
||
| ## 2. Set up Clerk | ||
|
|
||
| 1. Create an app at [dashboard.clerk.com](https://dashboard.clerk.com). | ||
| 2. **API Keys** page → copy the Publishable key and Secret key into `.env` | ||
| (`CLERK_PUBLISHABLE_KEY`, `CLERK_SECRET_KEY`) and into the frontend's | ||
| `.env` as `VITE_CLERK_PUBLISHABLE_KEY` (see `../schedule-app/.env.example`). | ||
| 3. **Webhooks** page → add an endpoint pointing at | ||
| `https://<your-backend-domain>/api/webhooks/clerk` (for local dev, use a | ||
| tunnel like `ngrok http 4000` and point it at the tunnel URL). Subscribe | ||
| to at least `user.created` and `user.deleted`. Copy the **Signing | ||
| Secret** into `CLERK_WEBHOOK_SIGNING_SECRET`. | ||
|
|
||
| This webhook keeps a `User` row in our database in sync with Clerk. (The | ||
| backend also lazily creates the row on first authenticated request, so | ||
| things still work if the webhook hasn't fired yet — but the webhook is | ||
| what keeps emails in sync and cleans up on account deletion.) | ||
|
|
||
| ## 3. Set up Stripe | ||
|
|
||
| 1. Create/use a [Stripe](https://dashboard.stripe.com) account. Use | ||
| **test mode** until you're ready to charge real cards. | ||
| 2. **Product catalog** → create a "Keystone Pro" product with a **one-time** | ||
| price (Stripe calls this "One off" / non-recurring). Copy its Price ID | ||
| into `STRIPE_PRICE_ID_LIFETIME`. It must not be a recurring price — | ||
| checkout runs in `payment` mode and Stripe rejects recurring prices there. | ||
| 3. **Developers → API keys** → copy the Secret key into `STRIPE_SECRET_KEY`. | ||
| 4. **Developers → Webhooks** → add an endpoint at | ||
| `https://<your-backend-domain>/api/webhooks/stripe`. Subscribe to | ||
| `checkout.session.completed` — that is what grants Pro. If you have | ||
| subscribers from before the switch, also keep | ||
| `customer.subscription.created`, `customer.subscription.updated`, and | ||
| `customer.subscription.deleted` so their access stays accurate. Copy the | ||
| **Signing secret** into `STRIPE_WEBHOOK_SECRET`. | ||
| 5. **Customer portal** (Settings → Billing → Customer portal) → only needed | ||
| if you have pre-switch subscribers; it is how they cancel. New buyers | ||
| never see it, since a one-time purchase has nothing to manage. | ||
|
|
||
| Test the whole loop with Stripe's test card `4242 4242 4242 4242`, any | ||
| future expiry, any CVC. | ||
|
|
||
| ## 4. Deploy (Render or Railway) | ||
|
|
||
| Both work the same way for this service: | ||
|
|
||
| 1. Create a Postgres database on the platform; it gives you a | ||
| `DATABASE_URL` — put that in the service's env vars. | ||
| 2. Create a Node web service pointed at this `backend/` directory. | ||
| - Build command: `npm install && npm run db:deploy` (applies migrations | ||
| without the interactive prompts `migrate dev` uses). | ||
| - Start command: `npm start`. | ||
| 3. Set every var from `.env.example` in the platform's environment | ||
| settings — `FRONTEND_URL` should be your deployed frontend's real URL | ||
| (not localhost), which also feeds the Stripe redirect URLs. | ||
| 4. Re-point the Clerk and Stripe webhook endpoints (steps 2.3 / 3.4 above) | ||
| at the deployed URL once you have it. | ||
|
|
||
| ## API surface | ||
|
|
||
| | Route | Auth | Notes | | ||
| | --- | --- | --- | | ||
| | `GET /api/health` | none | liveness probe | | ||
| | `GET /api/me` | Clerk session | `{ id, email, isPro, subscriptionStatus, currentPeriodEnd }` | | ||
| | `GET /api/data` | Clerk session | `{ data, updatedAt }` — the whole synced app data blob, or `{ data: null }` if nothing's been pushed yet | | ||
| | `PUT /api/data` | Clerk session | body `{ data: <object> }`, upserts the whole blob, returns `{ updatedAt }` | | ||
| | `POST /api/billing/checkout` | Clerk session | body `{ plan: "monthly" \| "annual" }`, returns `{ url }` — redirect the browser there | | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Document the lifetime checkout request. The API table documents 🤖 Prompt for AI Agents |
||
| | `POST /api/billing/portal` | Clerk session | returns `{ url }` for Stripe's hosted subscription-management page | | ||
| | `POST /api/assistant` | Clerk session, Pro | body `{ messages, context? }`, returns one Claude reply as `{ content, stop_reason, usage }` — see below | | ||
| | `POST /api/webhooks/clerk` | Clerk webhook signature | keeps `User.email` in sync | | ||
| | `POST /api/webhooks/stripe` | Stripe webhook signature | keeps subscription status in sync | | ||
| | `GET /api/calendars` | Clerk session | calendars you're a member of, with your role on each | | ||
| | `POST /api/calendars` | Clerk session | body `{ name, color? }`, creates a calendar with you as owner | | ||
| | `GET /api/calendars/:id` | Clerk session, member | `{ calendar, role, members, events }` | | ||
| | `PATCH /api/calendars/:id` | Clerk session, owner | body `{ name?, color? }` | | ||
| | `DELETE /api/calendars/:id` | Clerk session, owner | | | ||
| | `DELETE /api/calendars/:id/members/:memberId` | Clerk session, self or owner | can't remove the owner | | ||
| | `GET /api/calendars/:id/invites` | Clerk session, owner | pending invites | | ||
| | `POST /api/calendars/:id/invites` | Clerk session, owner/editor | body `{ email, role? }`, returns `{ invite }` (send the `token` yourself — no email is sent) | | ||
| | `DELETE /api/calendars/:id/invites/:inviteId` | Clerk session, owner | revoke a pending invite | | ||
| | `POST /api/calendars/invites/:token/accept` | Clerk session | joins the calendar the token was issued for | | ||
| | `POST /api/calendars/:id/events` | Clerk session, owner/editor | body `{ title, date, start, end, notes? }` | | ||
| | `PATCH /api/calendars/:id/events/:eventId` | Clerk session, owner/editor | | | ||
| | `DELETE /api/calendars/:id/events/:eventId` | Clerk session, owner/editor | | | ||
|
|
||
| Authenticated routes expect `Authorization: Bearer <clerk session token>` — | ||
| the frontend gets this from Clerk's `useAuth().getToken()`. | ||
|
|
||
| ### The assistant (`POST /api/assistant`) | ||
|
|
||
| The chat bubble in the app talks to Claude through this route. It exists so | ||
| the `ANTHROPIC_API_KEY` stays on the server: a key in the PWA bundle is a | ||
| public key. | ||
|
|
||
| The route holds the system prompt and the tool definitions and relays a | ||
| single turn. It never executes a tool. The user's data lives in their | ||
| browser (this server only ever sees it as an opaque blob), so the agent loop | ||
| runs client-side: the browser posts the conversation, gets back an assistant | ||
| message that may contain `tool_use` blocks, runs those against the app's own | ||
| reducer, appends the results and posts again. That keeps every write on the | ||
| normal undo/sync path and means a dropped connection can't leave a change | ||
| half-applied. | ||
|
|
||
| - `messages` is the Anthropic Messages-API array, echoed back verbatim by | ||
| the client (including `thinking` blocks, which must be preserved across | ||
| tool-result turns). | ||
| - `context` is a plain-text digest of the user's schedule and contacts, | ||
| built in the browser and capped at 24k characters. | ||
| - Set `ANTHROPIC_API_KEY` to turn the feature on. Leave it unset and the | ||
| route answers `503 not_configured`, which the app treats as "hide the | ||
| bubble" rather than as an error. | ||
| - Requests are throttled to 60 per user per 10 minutes, in memory. That's | ||
| per process — if you ever run more than one instance, move it to the | ||
| database or a shared cache. | ||
|
|
||
| ## Known gaps / next steps | ||
|
|
||
| - **The lifetime-purchase migration hasn't been run.** Pro switched from a | ||
| subscription to a one-time purchase; | ||
| `prisma/migrations/20260727010000_lifetime_purchase` adds the | ||
| `lifetimePurchasedAt` / `lifetimeSessionId` columns that grant it. Until | ||
| it's applied, `/api/me` will error on the missing columns. Run | ||
| `npm run db:migrate` locally or `npm run db:deploy` in production. The | ||
| migration is additive and leaves the old subscription columns alone, so | ||
| anyone who subscribed before the switch keeps working — `isPro` is true | ||
| for a lifetime purchase *or* an still-active legacy subscription, and the | ||
| pricing page offers those users a "Manage billing" link to cancel. Don't | ||
| forget to swap the Stripe price (see §3) — the old recurring price will be | ||
| rejected in `payment` mode. | ||
|
|
||
| - **Shared calendars are scaffolded but not migrated.** The | ||
| `SharedCalendar` / `SharedCalendarMember` / `SharedCalendarInvite` / | ||
| `SharedEvent` models exist in `prisma/schema.prisma` and the routes in | ||
| `src/routes/calendars.js` are wired up, but no migration has been run | ||
| against any database — run `npm run db:migrate` (creates one against | ||
| your local dev DB) or `npm run db:deploy` (applies pending migrations, | ||
| for CI/production) once you're ready to turn this on. Invites don't send | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift Commit a shared-calendar migration before enabling these routes. This README states that the shared-calendar models and routes exist but no migration creates their tables. A fresh deployment runs Generate and commit the migration with the schema change. Validate it against an empty database before release. 🤖 Prompt for AI Agents |
||
| an email; `POST /api/calendars/:id/invites` just returns the invite | ||
| (with its `token`) for you to deliver however you like (a `mailto:` | ||
| link, copy-to-clipboard, etc.) — see `schedule-app/src/pages/ | ||
| SharedCalendarsPage.jsx` for the frontend that already expects this | ||
| shape. Shared events are intentionally simple (no recurrence) — see the | ||
| schema comment for why. | ||
| - Data sync (`/api/data`) stores the whole app state as one JSON blob per | ||
| user — simple last-write-wins across a person's own devices, not a | ||
| conflict-resolving multi-editor sync. It's a real prerequisite for any | ||
| server-side feature that needs a user's history (e.g. an AI assistant), | ||
| but that feature itself still needs to be built. | ||
| - `subscriptionStatus` treats `active` and `trialing` as Pro; adjust | ||
| `PRO_STATUSES` in `src/routes/me.js` if you add a trial or grace-period | ||
| policy. | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: affaan-m/ECC
Length of output: 308
🏁 Script executed:
Repository: affaan-m/ECC
Length of output: 2671
🏁 Script executed:
Repository: affaan-m/ECC
Length of output: 3803
🌐 Web query:
GitHub Actions environments deployment branch policy environment does not exist auto-created deploy-pages github-pages💡 Result:
When you run a GitHub Actions workflow that references an environment (such as github-pages) that does not yet exist, GitHub automatically creates the environment for you [1][2][3]. Key details regarding this behavior and deployment branch policies include: Environment Creation: If a workflow references a non-existent environment, it is created automatically upon the first run of that workflow [1][3]. Protection Rules: - Implicit Creation: If the environment is created as part of an implicit Pages build (e.g., from a branch or folder source), the source branch is automatically added as a deployment branch protection rule [1][3]. - Manual/Explicit Creation: If you create the environment via a workflow file or manually, it will not have any protection rules or secrets configured by default [1][3]. Deployment Policy Errors: You may encounter errors like "Invalid deployment branch" or "Branch is not allowed to deploy" if your repository's Pages source settings or environment protection rules are misaligned [4][5]. For example, if your Pages source is set to a specific branch, but your workflow attempts to deploy from a different branch without that branch being explicitly allowed in the github-pages environment protection rules, the deployment will fail [4][5]. To resolve deployment branch policy issues: 1. Navigate to your repository's Settings > Environments. 2. Select the github-pages environment (or the one you are targeting). 3. Review the Deployment branches section. Ensure that your intended deployment branches are included under Selected branches and tags or that the policy is set to All branches if you do not require restrictions [1][6][4]. 4. Verify your Pages source settings under Settings > Pages to ensure they align with your deployment strategy (if using Custom Workflows, it is recommended to set the source to GitHub Actions) [2][5].
Citations:
Restrict Pages deployments to
mainOnce Pages is enabled, this trigger allows
claude/missionary-calendar-app-ti6dr6to publish to the same Pages site. Configuregithub-pagesto allow onlymain, or remove this branch fromon.push.branches. GitHub creates a referenced environment without branch protection by default.🤖 Prompt for AI Agents
Source: Path instructions