CodeIssuesDiscussionsWikiPull RequestsProjectsCommitsActionsReleasesContributorsPulse● GatesSecuritySettingsDeploymentsPipelineInsightsAgents✨ Explain✨ Ask AI✨ Workspace✨ Spec✨ Tests▓ Debt Map✨ NL Search🏛 Archaeology
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 | ||
| 90fa787 | 3 | AI-native code intelligence platform — git hosting, automated CI, and push-time gate enforcement. |
| fc1817a | 4 | |
| 9ab6971 | 5 | ## READ FIRST — every session |
| 6 | ||
| 7 | **`BUILD_BIBLE.md` is mandatory reading for every Claude agent before any code changes.** | |
| 8 | ||
| 9 | It contains: | |
| 10 | - Agent policy (do-not-undo rule, continuous-build rule) | |
| 11 | - GitHub parity scorecard (what's shipped vs missing) | |
| 12 | - Numbered build plan (Blocks A–H) | |
| 13 | - Locked components that cannot be altered without owner permission | |
| 14 | - Session workflow | |
| 15 | ||
| 16 | Do not skip it. Do not refactor locked files. Do not stop mid-block. | |
| 17 | ||
| fc1817a | 18 | ## Stack |
| 19 | ||
| 20 | - **Runtime:** Bun | |
| 21 | - **Framework:** Hono (with JSX for server-rendered views) | |
| 22 | - **Database:** Drizzle ORM + Neon (PostgreSQL) | |
| 23 | - **Git:** Smart HTTP protocol via git CLI subprocesses | |
| 24 | ||
| 25 | ## Development | |
| 26 | ||
| 27 | ```bash | |
| 28 | bun install # install dependencies | |
| 29 | bun dev # start dev server (hot reload) | |
| 30 | bun test # run tests | |
| 31 | bun run db:migrate # run database migrations | |
| 32 | ``` | |
| 33 | ||
| 34 | ## Architecture | |
| 35 | ||
| 36 | ``` | |
| 37 | src/ | |
| 43de941 | 38 | index.ts Entry point (Bun server) |
| 39 | app.tsx Hono app composition + error handlers | |
| 40 | lib/ | |
| 41 | config.ts Environment config (getters, reads env at access time) | |
| 42 | auth.ts Password hashing (bcrypt), session tokens | |
| 43 | highlight.ts Syntax highlighting (highlight.js, 40+ languages) | |
| 44 | markdown.ts Markdown rendering (GFM + syntax highlighting) | |
| fc1817a | 45 | db/ |
| 43de941 | 46 | schema.ts Drizzle schema (all tables) |
| 47 | index.ts Lazy DB connection (proxy pattern) | |
| 48 | migrate.ts Migration runner | |
| fc1817a | 49 | git/ |
| 43de941 | 50 | repository.ts Git operations (tree, blob, commits, diff, branches, blame, search, raw) |
| 51 | protocol.ts Smart HTTP protocol (pkt-line, service RPC) | |
| fc1817a | 52 | hooks/ |
| 90fa787 | 53 | post-receive.ts GateTest + optional deploy webhook on push |
| 43de941 | 54 | middleware/ |
| 55 | auth.ts softAuth + requireAuth middleware | |
| fc1817a | 56 | routes/ |
| 43de941 | 57 | git.ts Git HTTP endpoints (clone/push) |
| 58 | api.ts REST API (repo CRUD, setup) | |
| 59 | auth.tsx Register, login, logout (web + API) | |
| 60 | web.tsx Web UI (file browser, commits, diffs, search, blame, raw) | |
| 61 | issues.tsx Issue tracker (CRUD, comments, close/reopen) | |
| 62 | pulls.tsx Pull requests (create, review, merge, close) | |
| 63 | editor.tsx Web file editor (create/edit via git plumbing) | |
| 64 | compare.tsx Branch comparison (diff + commit list) | |
| 65 | settings.tsx User settings (profile, SSH keys) | |
| 66 | repo-settings.tsx Repository settings (description, visibility, delete) | |
| 67 | webhooks.tsx Webhook management + delivery engine | |
| 68 | fork.ts Repository forking | |
| 69 | explore.tsx Explore/discover public repos | |
| 70 | tokens.tsx Personal access tokens | |
| 71 | contributors.tsx Contributor list + commit activity graph | |
| fc1817a | 72 | views/ |
| 43de941 | 73 | layout.tsx HTML shell + CSS (dark theme) + auth-aware nav |
| 74 | components.tsx UI components (file table, commit list, diff viewer, etc.) | |
| fc1817a | 75 | ``` |
| 76 | ||
| 43de941 | 77 | ## Database Schema |
| 78 | ||
| 79 | - `users` — accounts with bcrypt password hashing | |
| 80 | - `sessions` — cookie-based auth sessions (30 day expiry) | |
| 81 | - `repositories` — repos with fork tracking, star/fork/issue counts | |
| 82 | - `stars` — user-repo star relationships | |
| 83 | - `issues` — issue tracker with open/closed state | |
| 84 | - `issue_comments` — threaded comments on issues | |
| 85 | - `labels` + `issue_labels` — issue categorization | |
| 86 | - `pull_requests` — PRs with base/head branches, open/closed/merged state | |
| 87 | - `pr_comments` — PR comments with AI review flag + file/line annotations | |
| 88 | - `activity_feed` — event log for repos | |
| 89 | - `webhooks` — registered webhook URLs with HMAC secret + event filtering | |
| 90 | - `api_tokens` — personal access tokens with SHA-256 hashing | |
| 91 | - `repo_topics` — repository tags for discoverability | |
| 92 | - `ssh_keys` — user SSH public keys | |
| 93 | ||
| fc1817a | 94 | ## Integrations |
| 95 | ||
| 90fa787 | 96 | - **GateTest (optional):** third-party security scanner. When `GATETEST_URL` is set, `git push` POSTs to it; inbound results accepted at `POST /api/hooks/gatetest`. |
| 97 | - **Outbound deploy webhook (optional):** when `CRONTECH_DEPLOY_URL` is set, pushes to the default branch POST there. | |
| 98 | - **Webhooks:** POST to user-registered URLs on push/issue/PR/star events with HMAC signatures. | |
| fc1817a | 99 | |
| 100 | ## Environment Variables | |
| 101 | ||
| 102 | See `.env.example` for required variables. Key ones: | |
| 103 | - `DATABASE_URL` — Neon PostgreSQL connection string | |
| 104 | - `GIT_REPOS_PATH` — directory for bare git repos (default: `./repos`) | |
| 105 | - `PORT` — HTTP port (default: 3000) | |
| fc0785e | 106 | |
| 107 | ## Deployment | |
| 108 | ||
| 90fa787 | 109 | - **Primary target:** Fly.io — the repo ships a ready `fly.toml` (release command runs `bun run db:migrate`, `gluecron_repos` volume mounted at `/app/repos`). |
| 110 | - **Other hosts:** a `Dockerfile` is in the repo, so any standard Docker host works. | |
| 111 | - **Database:** Neon PostgreSQL (direct connection via `DATABASE_URL`). | |
| 112 | - See DEPLOY.md for full deployment instructions. | |
| 43095dc | 113 | |
| 114 | ## Skills available for this project | |
| 115 | ||
| 116 | Claude Code skill bundle for the Gluecron MCP write surface lives in | |
| 117 | `.claude/skills/`. The install script (`scripts/install.sh`) copies these | |
| 118 | into `~/.claude/skills/` so they are available across all projects: | |
| 119 | ||
| 120 | - **`gluecron-pr`** — open, list, fetch, comment on, merge, or close pull | |
| 121 | requests on a Gluecron-hosted repository. | |
| 122 | - **`gluecron-issue`** — create, list, comment on, close, or reopen issues | |
| 123 | on a Gluecron-hosted repository. | |
| 124 | - **`gluecron-review`** — act as a secondary AI code reviewer on a | |
| 125 | Gluecron PR; complements the built-in `src/lib/ai-review.ts` pass. | |
| 126 | ||
| 127 | All three skills drive the K1 MCP write tools defined in | |
| 128 | `src/lib/mcp-tools.ts` (`gluecron_create_issue`, `gluecron_create_pr`, | |
| 129 | `gluecron_merge_pr`, etc.). They auto-invoke when the active repo's | |
| 130 | origin URL contains `gluecron.com` or matches `$GLUECRON_HOST`. |