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.mdBlame158 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
64```
65src/
43de941Claude66 index.ts Entry point (Bun server)
67 app.tsx Hono app composition + error handlers
68 lib/
69 config.ts Environment config (getters, reads env at access time)
70 auth.ts Password hashing (bcrypt), session tokens
71 highlight.ts Syntax highlighting (highlight.js, 40+ languages)
72 markdown.ts Markdown rendering (GFM + syntax highlighting)
fc1817aClaude73 db/
43de941Claude74 schema.ts Drizzle schema (all tables)
75 index.ts Lazy DB connection (proxy pattern)
76 migrate.ts Migration runner
fc1817aClaude77 git/
43de941Claude78 repository.ts Git operations (tree, blob, commits, diff, branches, blame, search, raw)
79 protocol.ts Smart HTTP protocol (pkt-line, service RPC)
fc1817aClaude80 hooks/
90fa787Claude81 post-receive.ts GateTest + optional deploy webhook on push
43de941Claude82 middleware/
83 auth.ts softAuth + requireAuth middleware
fc1817aClaude84 routes/
43de941Claude85 git.ts Git HTTP endpoints (clone/push)
86 api.ts REST API (repo CRUD, setup)
87 auth.tsx Register, login, logout (web + API)
88 web.tsx Web UI (file browser, commits, diffs, search, blame, raw)
89 issues.tsx Issue tracker (CRUD, comments, close/reopen)
90 pulls.tsx Pull requests (create, review, merge, close)
91 editor.tsx Web file editor (create/edit via git plumbing)
92 compare.tsx Branch comparison (diff + commit list)
93 settings.tsx User settings (profile, SSH keys)
94 repo-settings.tsx Repository settings (description, visibility, delete)
95 webhooks.tsx Webhook management + delivery engine
96 fork.ts Repository forking
97 explore.tsx Explore/discover public repos
98 tokens.tsx Personal access tokens
99 contributors.tsx Contributor list + commit activity graph
fc1817aClaude100 views/
43de941Claude101 layout.tsx HTML shell + CSS (dark theme) + auth-aware nav
102 components.tsx UI components (file table, commit list, diff viewer, etc.)
fc1817aClaude103```
104
43de941Claude105## Database Schema
106
107- `users` — accounts with bcrypt password hashing
108- `sessions` — cookie-based auth sessions (30 day expiry)
109- `repositories` — repos with fork tracking, star/fork/issue counts
110- `stars` — user-repo star relationships
111- `issues` — issue tracker with open/closed state
112- `issue_comments` — threaded comments on issues
113- `labels` + `issue_labels` — issue categorization
114- `pull_requests` — PRs with base/head branches, open/closed/merged state
115- `pr_comments` — PR comments with AI review flag + file/line annotations
116- `activity_feed` — event log for repos
117- `webhooks` — registered webhook URLs with HMAC secret + event filtering
118- `api_tokens` — personal access tokens with SHA-256 hashing
119- `repo_topics` — repository tags for discoverability
120- `ssh_keys` — user SSH public keys
121
fc1817aClaude122## Integrations
123
90fa787Claude124- **GateTest (optional):** third-party security scanner. When `GATETEST_URL` is set, `git push` POSTs to it; inbound results accepted at `POST /api/hooks/gatetest`.
125- **Outbound deploy webhook (optional):** when `CRONTECH_DEPLOY_URL` is set, pushes to the default branch POST there.
126- **Webhooks:** POST to user-registered URLs on push/issue/PR/star events with HMAC signatures.
fc1817aClaude127
128## Environment Variables
129
130See `.env.example` for required variables. Key ones:
131- `DATABASE_URL` — Neon PostgreSQL connection string
132- `GIT_REPOS_PATH` — directory for bare git repos (default: `./repos`)
133- `PORT` — HTTP port (default: 3000)
fc0785eClaude134
135## Deployment
136
90fa787Claude137- **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`).
138- **Other hosts:** a `Dockerfile` is in the repo, so any standard Docker host works.
139- **Database:** Neon PostgreSQL (direct connection via `DATABASE_URL`).
140- See DEPLOY.md for full deployment instructions.
43095dcClaude141
142## Skills available for this project
143
144Claude Code skill bundle for the Gluecron MCP write surface lives in
145`.claude/skills/`. The install script (`scripts/install.sh`) copies these
146into `~/.claude/skills/` so they are available across all projects:
147
148- **`gluecron-pr`** — open, list, fetch, comment on, merge, or close pull
149 requests on a Gluecron-hosted repository.
150- **`gluecron-issue`** — create, list, comment on, close, or reopen issues
151 on a Gluecron-hosted repository.
152- **`gluecron-review`** — act as a secondary AI code reviewer on a
153 Gluecron PR; complements the built-in `src/lib/ai-review.ts` pass.
154
155All three skills drive the K1 MCP write tools defined in
156`src/lib/mcp-tools.ts` (`gluecron_create_issue`, `gluecron_create_pr`,
157`gluecron_merge_pr`, etc.). They auto-invoke when the active repo's
158origin URL contains `gluecron.com` or matches `$GLUECRON_HOST`.