Blame · Line-by-line history
CLAUDE.md
Each line is annotated with the commit that last touched it. Click any SHA to jump to that commit and see the surrounding change.
| fc1817a | 1 | # gluecron |
| 2 | ||
| 3 | AI-native code intelligence platform — git hosting, automated CI, and green ecosystem enforcement. | |
| 4 | ||
| 9837657 | 5 | ## Agent Policy — NEVER IDLE |
| 6 | ||
| 7 | **This is a revenue-generating product. Idle time = lost revenue.** | |
| 8 | ||
| 9 | Every session must ship value. The rules: | |
| 10 | ||
| 11 | 1. **See something broken? Fix it.** Don't report it and wait — fix it, commit, push. | |
| 12 | 2. **See a missing feature that would advance the platform? Build it.** Don't ask permission for obvious improvements. | |
| 13 | 3. **Finished a task? Start the next one.** Audit the codebase for gaps, performance issues, missing tests, broken flows. Always have the next thing queued. | |
| 14 | 4. **Run tests after every change.** `bun test` must pass before pushing. If tests break, fix them immediately. | |
| 15 | 5. **Commit and push frequently.** Small, focused commits. Don't batch 10 features into one push. | |
| 16 | 6. **Prioritize by impact:** Security fixes > broken functionality > performance > new features > polish. | |
| 17 | 7. **When in doubt, build.** The worst outcome is sitting idle. The second worst is asking "should I?" when the answer is obviously yes. | |
| 18 | ||
| 9ab6971 | 19 | ## READ FIRST — every session |
| 20 | ||
| 21 | **`BUILD_BIBLE.md` is mandatory reading for every Claude agent before any code changes.** | |
| 22 | ||
| 23 | It contains: | |
| 24 | - Agent policy (do-not-undo rule, continuous-build rule) | |
| 25 | - GitHub parity scorecard (what's shipped vs missing) | |
| 26 | - Numbered build plan (Blocks A–H) | |
| 27 | - Locked components that cannot be altered without owner permission | |
| 28 | - Session workflow | |
| 29 | ||
| 30 | Do not skip it. Do not refactor locked files. Do not stop mid-block. | |
| 31 | ||
| fc1817a | 32 | ## Stack |
| 33 | ||
| 34 | - **Runtime:** Bun | |
| 35 | - **Framework:** Hono (with JSX for server-rendered views) | |
| 36 | - **Database:** Drizzle ORM + Neon (PostgreSQL) | |
| 37 | - **Git:** Smart HTTP protocol via git CLI subprocesses | |
| 38 | ||
| 39 | ## Development | |
| 40 | ||
| 41 | ```bash | |
| 42 | bun install # install dependencies | |
| 43 | bun dev # start dev server (hot reload) | |
| 44 | bun test # run tests | |
| 45 | bun run db:migrate # run database migrations | |
| 46 | ``` | |
| 47 | ||
| 48 | ## Architecture | |
| 49 | ||
| 50 | ``` | |
| 51 | src/ | |
| 43de941 | 52 | index.ts Entry point (Bun server) |
| 53 | app.tsx Hono app composition + error handlers | |
| 54 | lib/ | |
| 55 | config.ts Environment config (getters, reads env at access time) | |
| 56 | auth.ts Password hashing (bcrypt), session tokens | |
| 57 | highlight.ts Syntax highlighting (highlight.js, 40+ languages) | |
| 58 | markdown.ts Markdown rendering (GFM + syntax highlighting) | |
| fc1817a | 59 | db/ |
| 43de941 | 60 | schema.ts Drizzle schema (all tables) |
| 61 | index.ts Lazy DB connection (proxy pattern) | |
| 62 | migrate.ts Migration runner | |
| fc1817a | 63 | git/ |
| 43de941 | 64 | repository.ts Git operations (tree, blob, commits, diff, branches, blame, search, raw) |
| 65 | protocol.ts Smart HTTP protocol (pkt-line, service RPC) | |
| fc1817a | 66 | hooks/ |
| 43de941 | 67 | post-receive.ts GateTest + Crontech webhooks on push |
| 68 | middleware/ | |
| 69 | auth.ts softAuth + requireAuth middleware | |
| fc1817a | 70 | routes/ |
| 43de941 | 71 | git.ts Git HTTP endpoints (clone/push) |
| 72 | api.ts REST API (repo CRUD, setup) | |
| 73 | auth.tsx Register, login, logout (web + API) | |
| 74 | web.tsx Web UI (file browser, commits, diffs, search, blame, raw) | |
| 75 | issues.tsx Issue tracker (CRUD, comments, close/reopen) | |
| 76 | pulls.tsx Pull requests (create, review, merge, close) | |
| 77 | editor.tsx Web file editor (create/edit via git plumbing) | |
| 78 | compare.tsx Branch comparison (diff + commit list) | |
| 79 | settings.tsx User settings (profile, SSH keys) | |
| 80 | repo-settings.tsx Repository settings (description, visibility, delete) | |
| 81 | webhooks.tsx Webhook management + delivery engine | |
| 82 | fork.ts Repository forking | |
| 83 | explore.tsx Explore/discover public repos | |
| 84 | tokens.tsx Personal access tokens | |
| 85 | contributors.tsx Contributor list + commit activity graph | |
| fc1817a | 86 | views/ |
| 43de941 | 87 | layout.tsx HTML shell + CSS (dark theme) + auth-aware nav |
| 88 | components.tsx UI components (file table, commit list, diff viewer, etc.) | |
| fc1817a | 89 | ``` |
| 90 | ||
| 43de941 | 91 | ## Database Schema |
| 92 | ||
| 93 | - `users` — accounts with bcrypt password hashing | |
| 94 | - `sessions` — cookie-based auth sessions (30 day expiry) | |
| 95 | - `repositories` — repos with fork tracking, star/fork/issue counts | |
| 96 | - `stars` — user-repo star relationships | |
| 97 | - `issues` — issue tracker with open/closed state | |
| 98 | - `issue_comments` — threaded comments on issues | |
| 99 | - `labels` + `issue_labels` — issue categorization | |
| 100 | - `pull_requests` — PRs with base/head branches, open/closed/merged state | |
| 101 | - `pr_comments` — PR comments with AI review flag + file/line annotations | |
| 102 | - `activity_feed` — event log for repos | |
| 103 | - `webhooks` — registered webhook URLs with HMAC secret + event filtering | |
| 104 | - `api_tokens` — personal access tokens with SHA-256 hashing | |
| 105 | - `repo_topics` — repository tags for discoverability | |
| 106 | - `ssh_keys` — user SSH public keys | |
| 107 | ||
| fc1817a | 108 | ## Integrations |
| 109 | ||
| 110 | - **GateTest:** POST `https://gatetest.ai/api/scan/run` on every `git push` | |
| 111 | - **Crontech:** POST `https://crontech.ai/api/trpc/tenant.deploy` on push to main | |
| 43de941 | 112 | - **Webhooks:** POST to registered URLs on push/issue/PR/star events with HMAC signatures |
| fc1817a | 113 | |
| 114 | ## Environment Variables | |
| 115 | ||
| 116 | See `.env.example` for required variables. Key ones: | |
| 117 | - `DATABASE_URL` — Neon PostgreSQL connection string | |
| 118 | - `GIT_REPOS_PATH` — directory for bare git repos (default: `./repos`) | |
| 119 | - `PORT` — HTTP port (default: 3000) |