Pre-launch — Gluecron is in final validation. Public signups and git hosting for non-owner users open after launch review.
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.

CLAUDE.mdBlame162 lines · 2 contributors
fc1817aClaude1# gluecron
2
90fa787Claude3AI-native code intelligence platform — git hosting, automated CI, and push-time gate enforcement.
fc1817aClaude4
3b99c5fTest User5## Source of truth: Gluecron (not GitHub)
6
7This repository self-hosts on Gluecron itself. The canonical remote is
8`https://gluecron.com/ccantynz/Gluecron.com.git`. GitHub is a 7-day
9fallback mirror only.
10
11**For any AI session working in this repo:**
12
13- Use the Gluecron MCP server (`.claude/settings.json` already points
14 there). Tools: `gluecron_create_pr`, `gluecron_merge_pr`,
15 `gluecron_create_issue`, `gluecron_comment_pr`, etc. See
16 `src/lib/mcp-tools.ts` for the full 15-tool surface.
17- Do NOT call any `mcp__github__*` write tool. The settings file's
18 `permissions.deny` already blocks them; if you encounter a deny
19 error, switch to the equivalent `gluecron_*` tool.
20- The `.claude/skills/gluecron-pr`, `gluecron-issue`, and
21 `gluecron-review` skills are the highest-leverage entry points for
22 routine work. Invoke them when the user mentions a PR, an issue,
23 or wants a second AI review pass.
24- Auth: the `GLUECRON_PAT` env var holds the user's personal access
25 token. If it's missing, prompt the user to generate one at
26 `/settings/tokens` (admin scope required for the merge tools).
27
28**Deploys are self-driven now.** Push to `main` and
29`src/hooks/post-receive.ts` fires `scripts/self-deploy.sh` directly —
30no GitHub Actions involvement. The live site reflects the push in
31~25 seconds. Watch `/admin/deploys` for the live step stream.
32
9ab6971Claude33## READ FIRST — every session
34
35**`BUILD_BIBLE.md` is mandatory reading for every Claude agent before any code changes.**
36
37It contains:
38- Agent policy (do-not-undo rule, continuous-build rule)
39- GitHub parity scorecard (what's shipped vs missing)
40- Numbered build plan (Blocks A–H)
41- Locked components that cannot be altered without owner permission
42- Session workflow
43
44Do not skip it. Do not refactor locked files. Do not stop mid-block.
45
fc1817aClaude46## Stack
47
48- **Runtime:** Bun
49- **Framework:** Hono (with JSX for server-rendered views)
50- **Database:** Drizzle ORM + Neon (PostgreSQL)
51- **Git:** Smart HTTP protocol via git CLI subprocesses
52
53## Development
54
55```bash
56bun install # install dependencies
57bun dev # start dev server (hot reload)
58bun test # run tests
59bun run db:migrate # run database migrations
60```
61
62## Architecture
63
74a8784Claude64> Note (2026-06-10): the tree below is illustrative, not exhaustive — the
65> platform has grown to ~190 route files in `src/routes/` and 161 tables in
66> `src/db/schema.ts`. `BUILD_BIBLE.md` §2 is the authoritative feature map.
67
fc1817aClaude68```
69src/
43de941Claude70 index.ts Entry point (Bun server)
71 app.tsx Hono app composition + error handlers
72 lib/
73 config.ts Environment config (getters, reads env at access time)
74 auth.ts Password hashing (bcrypt), session tokens
75 highlight.ts Syntax highlighting (highlight.js, 40+ languages)
76 markdown.ts Markdown rendering (GFM + syntax highlighting)
fc1817aClaude77 db/
43de941Claude78 schema.ts Drizzle schema (all tables)
79 index.ts Lazy DB connection (proxy pattern)
80 migrate.ts Migration runner
fc1817aClaude81 git/
43de941Claude82 repository.ts Git operations (tree, blob, commits, diff, branches, blame, search, raw)
83 protocol.ts Smart HTTP protocol (pkt-line, service RPC)
fc1817aClaude84 hooks/
90fa787Claude85 post-receive.ts GateTest + optional deploy webhook on push
43de941Claude86 middleware/
87 auth.ts softAuth + requireAuth middleware
fc1817aClaude88 routes/
43de941Claude89 git.ts Git HTTP endpoints (clone/push)
90 api.ts REST API (repo CRUD, setup)
91 auth.tsx Register, login, logout (web + API)
92 web.tsx Web UI (file browser, commits, diffs, search, blame, raw)
93 issues.tsx Issue tracker (CRUD, comments, close/reopen)
94 pulls.tsx Pull requests (create, review, merge, close)
95 editor.tsx Web file editor (create/edit via git plumbing)
96 compare.tsx Branch comparison (diff + commit list)
97 settings.tsx User settings (profile, SSH keys)
98 repo-settings.tsx Repository settings (description, visibility, delete)
99 webhooks.tsx Webhook management + delivery engine
100 fork.ts Repository forking
101 explore.tsx Explore/discover public repos
102 tokens.tsx Personal access tokens
103 contributors.tsx Contributor list + commit activity graph
fc1817aClaude104 views/
43de941Claude105 layout.tsx HTML shell + CSS (dark theme) + auth-aware nav
106 components.tsx UI components (file table, commit list, diff viewer, etc.)
fc1817aClaude107```
108
43de941Claude109## Database Schema
110
111- `users` — accounts with bcrypt password hashing
112- `sessions` — cookie-based auth sessions (30 day expiry)
113- `repositories` — repos with fork tracking, star/fork/issue counts
114- `stars` — user-repo star relationships
115- `issues` — issue tracker with open/closed state
116- `issue_comments` — threaded comments on issues
117- `labels` + `issue_labels` — issue categorization
118- `pull_requests` — PRs with base/head branches, open/closed/merged state
119- `pr_comments` — PR comments with AI review flag + file/line annotations
120- `activity_feed` — event log for repos
121- `webhooks` — registered webhook URLs with HMAC secret + event filtering
122- `api_tokens` — personal access tokens with SHA-256 hashing
123- `repo_topics` — repository tags for discoverability
124- `ssh_keys` — user SSH public keys
125
fc1817aClaude126## Integrations
127
90fa787Claude128- **GateTest (optional):** third-party security scanner. When `GATETEST_URL` is set, `git push` POSTs to it; inbound results accepted at `POST /api/hooks/gatetest`.
9ecf5a4Claude129- **Outbound deploy webhook (optional):** when `VAPRON_DEPLOY_URL` is set (legacy `CRONTECH_DEPLOY_URL` honored), pushes to the default branch POST to Vapron (formerly Crontech).
90fa787Claude130- **Webhooks:** POST to user-registered URLs on push/issue/PR/star events with HMAC signatures.
fc1817aClaude131
132## Environment Variables
133
134See `.env.example` for required variables. Key ones:
135- `DATABASE_URL` — Neon PostgreSQL connection string
136- `GIT_REPOS_PATH` — directory for bare git repos (default: `./repos`)
137- `PORT` — HTTP port (default: 3000)
fc0785eClaude138
139## Deployment
140
90fa787Claude141- **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`).
142- **Other hosts:** a `Dockerfile` is in the repo, so any standard Docker host works.
143- **Database:** Neon PostgreSQL (direct connection via `DATABASE_URL`).
144- See DEPLOY.md for full deployment instructions.
43095dcClaude145
146## Skills available for this project
147
148Claude Code skill bundle for the Gluecron MCP write surface lives in
149`.claude/skills/`. The install script (`scripts/install.sh`) copies these
150into `~/.claude/skills/` so they are available across all projects:
151
152- **`gluecron-pr`** — open, list, fetch, comment on, merge, or close pull
153 requests on a Gluecron-hosted repository.
154- **`gluecron-issue`** — create, list, comment on, close, or reopen issues
155 on a Gluecron-hosted repository.
156- **`gluecron-review`** — act as a secondary AI code reviewer on a
157 Gluecron PR; complements the built-in `src/lib/ai-review.ts` pass.
158
159All three skills drive the K1 MCP write tools defined in
160`src/lib/mcp-tools.ts` (`gluecron_create_issue`, `gluecron_create_pr`,
161`gluecron_merge_pr`, etc.). They auto-invoke when the active repo's
162origin URL contains `gluecron.com` or matches `$GLUECRON_HOST`.