## Logic Ish, General TODOS

- [x] auto installed webhooks are "unnamed" — now named "PR Previews" on registration;
    >  boot reconciliation (services/webhookReconcile.ts) backfills the name and adds the missing pull_request_sync event onto existing webhooks
- [x] move docker, node, etc to "preinstall" options where you can select from "docker" (compose included ofc), "node" (even with a specified version), python, go, lua & some basic apt packages. The user can choose with a checkbox which ones they want to install. This will allow for more flexibility in the future and allow for more languages to be supported. Remove that everything is based on nodejs, its dynamic to a ton of languages and frameworks, not just nodejs. 
- [x] when starting a preview from a stopped or deleted state, it should clear the logs from before.
- [x] better logs with timestamps
- [ ] openapi docs for the api based on `../shsf`'s implementation
- [x] add a "rebuild" button to the preview page that does a /pp rebuild
- [x] cost tracking
    - Per Preview (visible in the ui)
    - User Total
    - Repo Total
    - Instance Total
    > Ensure that the cost tracking is accurate and reflects the actual costs. May require AWS integration to get accurate billing data
    - add to stats dashboard
    > Done via uptime × on-demand hourly rate (lib/cost.ts), not AWS billing APIs (those lag hours-to-a-day + need extra IAM). Preview now tracks instanceType/instanceLaunchedAt/accumulatedCostUsd; a cost session opens on launch (firstDeploy) and finalizes on stopPreview. Surfaced per-preview (list + detail), user total (Previews page), repo total (Repos page), and instance-wide total + live $/hr burn (Overview /api/stats + admin previews).
- [x] As gitea admin i see every repo on the instance, that is NOT good, i should only see the repos that i own or that i am a collaborator on.


## (Remaining) Tests
- [x] test other languages (python)
- [x] check if ec2 timeout kill works (!!!)


## UI Related
- [x] ability to by default hide old previews and have them be in a seperate list, aswell as not showing stopped ones.
- [x] Actual homepage with instance stats (total previews, total users, total repos, total instances, total cost, etc) (requires backend changes)
    > New "Overview" homepage at `/` (previews list moved to `/previews`). Global instance-wide stats via GET /api/stats: totalUsers, totalRepos/enabledRepos, totalPreviews/activePreviews, activeInstances (live EC2s), status breakdown + recent activity. Cost omitted — cost tracking is still an open TODO.
- [x] Search bar and filters for public & private repos in /repos
- [x] move repo config into its own page with a "configure" button on /repos
- [x] key-value inputs are seperately sized, bad
- [x] "apt packages" field does not support advertised "space separated" input, i can not press the spacebar
- [x] "configure" button on /repos to configure a repo not just a goofy toggle.
- [x] in light mode code blocks are still dark, make them light mode friendly
- [x] better light/dark mode toggle
- [x] use "professional" icons for the ui instead of the unicode ones.
- [x] use icon from "./icon.png" & move it around & scale with cli for favicon and all types of icons needed for the seo in the ui
- [ ] Fix Theming to be more professional (use frontend themeing skill & make it look like a professional product)
- [x] "save config" should not return me to the repo list...
- [x] sort repos list by configured first, then alphabetically (repo name, not owner. group owner repos sperately, then sort by repo name)


## / Command related
- [x] /pp rebuild doesnt comment, nor do anything on a Stopped preview
    > rebuild now posts an ack comment and, on a STOPPED preview, re-provisions a fresh instance (isFirstDeploy). All commands post acknowledgement comments (webhook.ts `ack()`).
- [x] add "/pp help"
    > `/pp help` posts a command reference table (webhook.ts `buildHelpBody`), striking through commands disabled for the repo.
- [x] pp stop returns no comment
    > stop (and every other command) now posts an ack comment.
- [x] user configs /pp commands
    > New `RepoConfig.disabledCommands` field (migration 20260726120000_pp_command_config) + checkboxes on the Repo Config page. Disabled commands reply "disabled for this repository"; `/pp help` can never be disabled.

## Backend Related
- [x] switch away from t2.medium ASAP (and its prefill configs, make the default a t4a.medium or t3.medium, and make it configurable in the ui, no more t2s and by default migrate all existing t2.mediums to t4a.mediums or t3.mediums) (dont forget cost calculation changes)
    > Default moved to `t3.medium`; repo/admin settings now normalize `t2.*` to `t3.medium`; migration updates existing `RepoConfig` and `AdminSettings` rows/defaults. UI presets no longer include t2 and now show current-generation t3/t3a/t4g options with updated cost estimates. Historical t2 cost rates are retained only for already-launched preview cost snapshots.
- [x] ensure when i rotate credentials for a webhook it auto updates all repos webhooks accordingly
    > Gitea credential saves and webhook secret regeneration now sync every enabled stored Gitea hook with the current target URL, secret, name, active state, and required PP events.
- [ ] split up the codebase more into smaller files, i see a lot of big files
- [x] live app logs from app processes (not just the pp process)
    > New on-demand SSH tail streamed over a separate WS (`/api/previews/{id}/applogs`, services/appLogs.ts + ssh.ts execStream). Non-compose tails /opt/app/pp.log (`tail -F`); compose uses `docker compose logs -f`. Surfaced as a Deploy/App tab toggle on the preview page — not persisted, live only while RUNNING.


## Other (Comments, Gitea, etc)
- [x] "Status: ⚫ Stopped (inactivity timeout / PR closed / manual stop)" Add a propper reason field for the state

## Final Pre-Prod
- [x] A bunch of meta tags for the ui for seo and social media sharing, etc
- [x] Decrease Size of Docker Image lmao & increase build speed !!
- [x] Update Privacy Policy to be more professional and less "i made this in 2 days" and more "this is a professional product"
- [x] CI/CD is STILL missing..... (spec)
    > Added Gitea Actions workflow at `.gitea/workflows/deploy.yml`: pinned pnpm install, Prisma generate, backend/frontend builds, Docker build on PRs, and Harbor push to `registry.reversed.dev/pp-previews/core` on `main`/`dev` pushes.
- [x] Human understandable Readme
- [x] LICENSE, CONTRIBUTING, SECURITY.md, etc

## Future BS
- [ ] CPU, MEM, NET, DISK sentinal first-installed on EC2s to expose a backend for the user's ui to hit, THROUGH A BACKEND PROXY ROUTE so we can cache and rate limit the requests. This will allow for a better dashboard and better stats for the user to see. We'll use an obscure port for the sentinal so that we dont hit any other services the user may have. Sentinal is our own little C program exposing the stats we need, seperate repo for that thing tho!
