CodeIssuesDiscussionsWikiPull RequestsProjectsCommitsActionsReleasesContributorsPulse● GatesSecuritySettingsDeploymentsPipelineInsightsAgents✨ Explain✨ Ask AI✨ Workspace✨ Spec✨ Tests▓ Debt Map✨ NL Search🏛 Archaeology
Blame · Line-by-line history
SETUP-GUIDE.txt
Each line is annotated with the commit that last touched it. Click any SHA to jump to that commit and see the surrounding change.
| 8d2847b | 1 | ================================================================================ |
| 2 | GLUECRON — COMPLETE SETUP & ARCHITECTURE GUIDE FOR ALECRAE | |
| 3 | ================================================================================ | |
| 4 | ||
| 5 | PREREQUISITES | |
| 6 | ------------- | |
| 7 | curl -fsSL https://bun.sh/install | bash | |
| 8 | sudo apt install git | |
| 9 | Sign up at https://neon.tech for PostgreSQL | |
| 10 | ||
| 11 | CLONE & INSTALL | |
| 12 | --------------- | |
| 13 | git clone https://github.com/ccantynz-alt/Gluecron.com.git | |
| 14 | cd Gluecron.com | |
| 15 | bun install | |
| 16 | ||
| 17 | ENVIRONMENT FILE (.env) | |
| 18 | ----------------------- | |
| 19 | DATABASE_URL=postgresql://user:password@host/gluecron | |
| 20 | GIT_REPOS_PATH=./repos | |
| 21 | PORT=3000 | |
| 22 | GATETEST_URL=https://gatetest.ai/api/scan/run | |
| 23 | GATETEST_API_KEY= | |
| 24 | GATETEST_CALLBACK_SECRET= | |
| 25 | GATETEST_HMAC_SECRET= | |
| 26 | CRONTECH_DEPLOY_URL=https://crontech.ai/api/trpc/tenant.deploy | |
| 27 | ANTHROPIC_API_KEY= | |
| 28 | EMAIL_PROVIDER=log | |
| 29 | EMAIL_FROM=gluecron <no-reply@gluecron.local> | |
| 30 | RESEND_API_KEY= | |
| 31 | APP_BASE_URL=http://localhost:3000 | |
| 32 | ||
| 33 | DATABASE SETUP | |
| 34 | -------------- | |
| 35 | bun run db:migrate | |
| 36 | bun run db:studio | |
| 37 | ||
| 38 | RUN | |
| 39 | --- | |
| 40 | bun dev (hot-reload dev server on port 3000) | |
| 41 | bun test (1448 tests must pass) | |
| 42 | bun start (production mode) | |
| 43 | ||
| 44 | VERIFICATION | |
| 45 | ------------ | |
| 46 | bun install | |
| 47 | bun run db:migrate | |
| 48 | mkdir -p repos | |
| 49 | bun test | |
| 50 | bun dev | |
| 51 | curl http://localhost:3000/health | |
| 52 | curl http://localhost:3000/explore | |
| 53 | ||
| 54 | ================================================================================ | |
| 55 | ARCHITECTURE | |
| 56 | ================================================================================ | |
| 57 | ||
| 58 | src/index.ts Bun HTTP server entry point | |
| 59 | src/app.tsx Hono app — middleware + all 87 route mounts | |
| 60 | ||
| 61 | src/db/schema.ts Drizzle ORM — ALL tables | |
| 62 | src/db/index.ts Lazy DB connection (proxy pattern) | |
| 63 | src/db/migrate.ts Migration runner | |
| 64 | ||
| 65 | src/git/repository.ts Git plumbing (tree, blob, commits, diff, branches, blame, search, raw, listTreeRecursive, aheadBehind, diffNumstat) | |
| 66 | src/git/protocol.ts Smart HTTP protocol (pkt-line, clone/push) | |
| 67 | ||
| 68 | src/hooks/post-receive.ts GateTest + Crontech webhooks on every git push | |
| 69 | ||
| 70 | src/middleware/auth.ts softAuth (optional) + requireAuth (required) | |
| 71 | src/middleware/rate-limit.ts Token-bucket rate limiter (X-RateLimit-* headers) | |
| 72 | src/middleware/request-context.ts X-Request-Id + request timing | |
| 73 | ||
| 74 | src/views/layout.tsx HTML shell + dark theme CSS + auth-aware nav | |
| 75 | src/views/components.tsx RepoHeader, RepoNav, RepoCard, FileTable, DiffViewer | |
| 76 | src/views/reactions.tsx ReactionsBar (no-JS compatible) | |
| 77 | ||
| 78 | src/lib/ 80 pure helper modules (IO-free, fully testable) | |
| 79 | src/routes/ 87 Hono route files | |
| 80 | src/__tests__/ 75 test files, 1448 tests | |
| 81 | drizzle/ 37 SQL migration files | |
| 82 | ||
| 83 | ================================================================================ | |
| 84 | COMPONENT CHECKLIST (DEPENDENCY ORDER) | |
| 85 | ================================================================================ | |
| 86 | ||
| 87 | INFRASTRUCTURE (must work first) | |
| 88 | 1. Bun runtime — install Bun, verify bun --version | |
| 89 | 2. PostgreSQL / Neon — get a DATABASE_URL, verify connectivity | |
| 90 | 3. Git CLI — git --version must be 2.x+ | |
| 91 | 4. Run migrations — bun run db:migrate (37 migrations) | |
| 92 | 5. Create repos/ directory — mkdir -p repos | |
| 93 | 6. Verify health — curl http://localhost:3000/health | |
| 94 | ||
| 95 | CORE FEATURES | |
| 96 | 7. Auth — register/login/logout, bcrypt passwords, 30-day sessions | |
| 97 | 8. Repositories — create, clone, push (Smart HTTP protocol) | |
| 98 | 9. File browser — tree view, blob view, syntax highlighting | |
| 99 | 10. Commits — log, diff, blame | |
| 100 | 11. Issues — CRUD, comments, labels, close/reopen | |
| 101 | 12. Pull requests — create, review, merge (merge/squash/rebase), close | |
| 102 | 13. Webhooks — HMAC-signed POST on push/issue/PR/star events | |
| 103 | 14. Fork — full repo fork via git clone --bare | |
| 104 | 15. Search — global search (repos, users, issues, PRs) | |
| 105 | 16. Dashboard — personal feed | |
| 106 | 17. Explore — discover public repos | |
| 107 | ||
| 108 | CI/CD & SECURITY | |
| 109 | 18. GateTest integration — scan on every push, callback webhook | |
| 110 | 19. Workflow runner — .gluecron/workflows/*.yml auto-discovery | |
| 111 | 20. Security scanner — secret detection in push payloads | |
| 112 | 21. Code scanning UI — vulnerability dashboard | |
| 113 | 22. Branch protection — required reviews, status checks | |
| 114 | 23. Rulesets — granular per-branch rules | |
| 115 | ||
| 116 | AI FEATURES (require ANTHROPIC_API_KEY) | |
| 117 | 24. AI code review — automatic review comments on PRs | |
| 118 | 25. AI code explain — /:owner/:repo/explain | |
| 119 | 26. AI changelog — auto-generated release notes | |
| 120 | 27. Copilot completions — POST /api/copilot/completions | |
| 121 | 28. Semantic search — embeddings-based code search | |
| 122 | 29. AI test generator — generate test skeletons | |
| 123 | 30. AI assistant — /ask chat interface | |
| 124 | ||
| 125 | PLATFORM FEATURES | |
| 126 | 31. Organizations + teams — multi-user access control | |
| 127 | 32. OAuth provider — third-party app authorization | |
| 128 | 33. 2FA / TOTP — time-based one-time passwords | |
| 129 | 34. Passkeys / WebAuthn — hardware key auth | |
| 130 | 35. Personal access tokens — SHA-256 hashed API keys | |
| 131 | 36. Notifications — inbox with unread count | |
| 132 | 37. Email notifications — Resend integration | |
| 133 | 38. Releases + tags — semantic versioning, asset uploads | |
| 134 | 39. Package registry — npm-compatible publish/install | |
| 135 | 40. Pages / static hosting — deploy from branch | |
| 136 | 41. Wiki — per-repo documentation | |
| 137 | 42. Discussions — threaded Q&A | |
| 138 | 43. Gists — shareable code snippets | |
| 139 | 44. Projects — kanban boards | |
| 140 | 45. Merge queue — automated merge sequencing | |
| 141 | ||
| 142 | INSIGHTS & ANALYTICS (J-series beyond-parity) | |
| 143 | 46. Insights dashboard — green rate, contributors, commit graph | |
| 144 | 47. Repository pulse — activity summary with rolling window | |
| 145 | 48. Response time metric — p50/p90 time-to-first-response | |
| 146 | 49. PR lead-time metric — created-to-merged percentiles | |
| 147 | 50. PR size distribution — XS/S/M/L/XL classification | |
| 148 | 51. Language breakdown — stacked bar + per-language table | |
| 149 | 52. Size audit — largest files + directory breakdown | |
| 150 | 53. Branch staleness — fresh/aging/stale/abandoned classification | |
| 151 | 54. Stale issue detector — open issues past threshold | |
| 152 | 55. Issue duplicate suggestions — token-Jaccard similarity | |
| 153 | 56. Contribution heatmap — GitHub-style calendar | |
| 154 | 57. Traffic analytics — views, clones, referrers | |
| 155 | 58. Atom feeds — commits/releases/issues.atom | |
| 156 | ||
| 157 | ================================================================================ | |
| 158 | KEY LIB MODULES (src/lib/) | |
| 159 | ================================================================================ | |
| 160 | ||
| 161 | config.ts Environment config | |
| 162 | auth.ts Password hashing (bcrypt), session tokens | |
| 163 | cache.ts LRU cache + cached() helper | |
| 164 | highlight.ts Syntax highlighting (40+ languages) | |
| 165 | markdown.ts Markdown rendering (GFM) | |
| 166 | ai-client.ts Anthropic SDK wrapper | |
| 167 | ai-review.ts AI code review | |
| 168 | ai-explain.ts AI code explanation | |
| 169 | ai-completion.ts Copilot completions | |
| 170 | gate.ts GateTest CI integration | |
| 171 | security-scan.ts Secret scanner | |
| 172 | workflow-parser.ts Actions-equivalent YAML parser | |
| 173 | workflow-runner.ts Workflow execution engine | |
| 174 | dep-updater.ts Dependabot-equivalent | |
| 175 | oauth.ts OAuth 2.0 provider | |
| 176 | totp.ts 2FA / TOTP | |
| 177 | webauthn.ts WebAuthn / passkey | |
| 178 | graphql.ts GraphQL schema | |
| 179 | email.ts Email sending | |
| 180 | notify.ts Notification fan-out | |
| 181 | orgs.ts Organizations + teams | |
| 182 | packages.ts npm-compatible registry | |
| 183 | pages.ts Static hosting | |
| 184 | merge-queue.ts Merge queue | |
| 185 | rulesets.ts Repository rulesets | |
| 186 | branch-protection.ts Branch protection | |
| 187 | branch-rename.ts Branch rename with cascades | |
| 188 | branch-age.ts Branch staleness analysis | |
| 189 | issue-query.ts GitHub-style search DSL | |
| 190 | issue-similarity.ts Duplicate detection | |
| 191 | issue-templates.ts Issue/PR templates | |
| 192 | close-keywords.ts Fixes #N auto-close | |
| 193 | code-suggestions.ts Suggestion block apply | |
| 194 | codeowners-lint.ts CODEOWNERS validator | |
| 195 | release-notes.ts Changelog generator | |
| 196 | response-time.ts Time-to-first-response (J25) | |
| 197 | pr-lead-time.ts PR lead-time (J29) | |
| 198 | pr-size.ts PR size distribution (J32) | |
| 199 | language-stats.ts Language breakdown (J30) | |
| 200 | repo-size.ts Size audit (J31) | |
| 201 | repo-pulse.ts Activity summary | |
| 202 | stale-issues.ts Stale issue detector | |
| 203 | atom-feed.ts Atom feed renderer | |
| 204 | audit-csv.ts CSV export (RFC 4180) | |
| 205 | badge.ts SVG badges | |
| 206 | community.ts Health scorecard | |
| 207 | contribution-heatmap.ts Contribution calendar | |
| 208 | deps.ts Dependency graph | |
| 209 | advisories.ts Security advisories | |
| 210 | sso.ts Enterprise SSO | |
| 211 | mirrors.ts Repository mirroring | |
| 212 | symbols.ts Symbol navigation | |
| 213 | traffic.ts Traffic analytics | |
| 214 | billing.ts Usage tracking | |
| 215 | marketplace.ts App marketplace | |
| 216 | ||
| 217 | ================================================================================ | |
| 218 | KEY ROUTES (src/routes/) | |
| 219 | ================================================================================ | |
| 220 | ||
| 221 | git.ts Smart HTTP clone/push | |
| 222 | api.ts REST API (repo CRUD) | |
| 223 | auth.tsx Register, login, logout | |
| 224 | web.tsx File browser, commits, diffs (catch-all) | |
| 225 | issues.tsx Issue tracker | |
| 226 | pulls.tsx Pull requests | |
| 227 | editor.tsx Web file editor | |
| 228 | compare.tsx Branch comparison | |
| 229 | settings.tsx User settings | |
| 230 | repo-settings.tsx Repository settings | |
| 231 | insights.tsx Insights dashboard | |
| 232 | workflows.tsx CI/CD runner | |
| 233 | packages.tsx Package registry UI | |
| 234 | pages.tsx Static hosting | |
| 235 | discussions.tsx Discussions | |
| 236 | wikis.tsx Wiki | |
| 237 | gists.tsx Gists | |
| 238 | projects.tsx Projects | |
| 239 | orgs.tsx Organizations | |
| 240 | admin.tsx Admin panel | |
| 241 | billing.tsx Billing UI | |
| 242 | graphql.ts GraphQL endpoint | |
| 243 | marketplace.tsx App marketplace | |
| 244 | languages.tsx Language breakdown (J30) | |
| 245 | repo-size.tsx Size audit (J31) | |
| 246 | pr-size.tsx PR size distribution (J32) | |
| 247 | pr-lead-time.tsx PR lead-time (J29) | |
| 248 | response-time.tsx Response-time (J25) | |
| 249 | branch-age.tsx Branch staleness (J27) | |
| 250 | pulse.tsx Repository pulse (J18) | |
| 251 | ||
| 252 | ================================================================================ | |
| 253 | JSON CONFIGURATION (save as gluecron-setup.json) | |
| 254 | ================================================================================ | |
| 255 | ||
| 256 | { | |
| 257 | "project": { | |
| 258 | "name": "gluecron", | |
| 259 | "version": "0.1.0", | |
| 260 | "description": "AI-native code intelligence platform", | |
| 261 | "repository": "https://github.com/ccantynz-alt/Gluecron.com" | |
| 262 | }, | |
| 263 | "runtime": { | |
| 264 | "engine": "bun", | |
| 265 | "minimumVersion": "1.3.0", | |
| 266 | "entryPoint": "src/index.ts" | |
| 267 | }, | |
| 268 | "framework": { | |
| 269 | "name": "hono", | |
| 270 | "version": "^4.7.0", | |
| 271 | "jsx": "react-jsx", | |
| 272 | "jsxImportSource": "hono/jsx", | |
| 273 | "rendering": "server-side (SSR)" | |
| 274 | }, | |
| 275 | "database": { | |
| 276 | "orm": "drizzle-orm", | |
| 277 | "dialect": "postgresql", | |
| 278 | "provider": "neon-serverless", | |
| 279 | "schemaFile": "src/db/schema.ts", | |
| 280 | "migrationsDir": "drizzle/", | |
| 281 | "migrationCount": 37, | |
| 282 | "connectionPattern": "lazy-proxy" | |
| 283 | }, | |
| 284 | "git": { | |
| 285 | "protocol": "smart-http", | |
| 286 | "reposPath": "./repos", | |
| 287 | "storageFormat": "bare", | |
| 288 | "protocolFile": "src/git/protocol.ts", | |
| 289 | "plumbingFile": "src/git/repository.ts" | |
| 290 | }, | |
| 291 | "typescript": { | |
| 292 | "target": "ES2022", | |
| 293 | "module": "ES2022", | |
| 294 | "moduleResolution": "bundler", | |
| 295 | "strict": true, | |
| 296 | "types": ["bun-types"] | |
| 297 | }, | |
| 298 | "testing": { | |
| 299 | "runner": "bun:test", | |
| 300 | "totalTests": 1448, | |
| 301 | "testFiles": 75, | |
| 302 | "testDir": "src/__tests__/", | |
| 303 | "pattern": "**/*.test.ts", | |
| 304 | "command": "bun test" | |
| 305 | }, | |
| 306 | "integrations": { | |
| 307 | "gatetest": { | |
| 308 | "purpose": "CI security scanning on every git push", | |
| 309 | "endpoint": "https://gatetest.ai/api/scan/run", | |
| 310 | "callbackEndpoint": "/api/v1/gate-runs", | |
| 311 | "authMethod": "HMAC" | |
| 312 | }, | |
| 313 | "crontech": { | |
| 314 | "purpose": "Auto-deploy on push to main", | |
| 315 | "endpoint": "https://crontech.ai/api/trpc/tenant.deploy" | |
| 316 | }, | |
| 317 | "anthropic": { | |
| 318 | "purpose": "AI features (review, explain, copilot, search, tests, chat)", | |
| 319 | "sdk": "@anthropic-ai/sdk ^0.88.0", | |
| 320 | "gracefulDegradation": true, | |
| 321 | "fallbackBehavior": "returns placeholder strings when no API key" | |
| 322 | }, | |
| 323 | "resend": { | |
| 324 | "purpose": "Transactional email delivery", | |
| 325 | "fallbackProvider": "log" | |
| 326 | } | |
| 327 | }, | |
| 328 | "auth": { | |
| 329 | "passwordHashing": "bcrypt", | |
| 330 | "sessionDuration": "30 days", | |
| 331 | "cookieBased": true, | |
| 332 | "supportedMethods": [ | |
| 333 | "password", | |
| 334 | "totp-2fa", | |
| 335 | "webauthn-passkeys", | |
| 336 | "oauth-apps", | |
| 337 | "personal-access-tokens", | |
| 338 | "enterprise-sso-oidc" | |
| 339 | ] | |
| 340 | }, | |
| 341 | "architecture": { | |
| 342 | "layers": { | |
| 343 | "entry": ["src/index.ts"], | |
| 344 | "app": ["src/app.tsx"], | |
| 345 | "middleware": ["src/middleware/auth.ts", "src/middleware/rate-limit.ts", "src/middleware/request-context.ts"], | |
| 346 | "routes": "src/routes/ (87 files)", | |
| 347 | "views": ["src/views/layout.tsx", "src/views/components.tsx", "src/views/reactions.tsx"], | |
| 348 | "lib": "src/lib/ (80 pure helper modules)", | |
| 349 | "db": ["src/db/schema.ts", "src/db/index.ts", "src/db/migrate.ts"], | |
| 350 | "git": ["src/git/repository.ts", "src/git/protocol.ts"], | |
| 351 | "hooks": ["src/hooks/post-receive.ts"] | |
| 352 | }, | |
| 353 | "patterns": { | |
| 354 | "pureFirst": "Business logic in src/lib/ as pure functions. Routes are thin shells.", | |
| 355 | "neverFiveHundred": "Every route wraps resolveRepo in try/catch -> null -> 404.", | |
| 356 | "internalReExports": "Every lib module exports __internal for testing.", | |
| 357 | "softAuth": "Read-only routes use softAuth. Write routes use requireAuth.", | |
| 358 | "mountOrder": "Static paths mount BEFORE dynamic /:number routes in app.tsx." | |
| 359 | } | |
| 360 | }, | |
| 361 | "commands": { | |
| 362 | "install": "bun install", | |
| 363 | "dev": "bun dev", | |
| 364 | "start": "bun start", | |
| 365 | "test": "bun test", | |
| 366 | "dbMigrate": "bun run db:migrate", | |
| 367 | "dbGenerate": "bun run db:generate", | |
| 368 | "dbStudio": "bun run db:studio" | |
| 369 | }, | |
| 370 | "environment": { | |
| 371 | "required": ["DATABASE_URL"], | |
| 372 | "optional": [ | |
| 373 | "GIT_REPOS_PATH (default: ./repos)", | |
| 374 | "PORT (default: 3000)", | |
| 375 | "ANTHROPIC_API_KEY (unlocks AI features)", | |
| 376 | "GATETEST_URL", | |
| 377 | "GATETEST_API_KEY", | |
| 378 | "GATETEST_CALLBACK_SECRET", | |
| 379 | "GATETEST_HMAC_SECRET", | |
| 380 | "CRONTECH_DEPLOY_URL", | |
| 381 | "EMAIL_PROVIDER (log | resend)", | |
| 382 | "EMAIL_FROM", | |
| 383 | "RESEND_API_KEY", | |
| 384 | "APP_BASE_URL" | |
| 385 | ] | |
| 386 | }, | |
| 387 | "featureCounts": { | |
| 388 | "routes": 87, | |
| 389 | "libModules": 80, | |
| 390 | "dbMigrations": 37, | |
| 391 | "testFiles": 75, | |
| 392 | "totalTests": 1448, | |
| 393 | "totalExpects": 3810 | |
| 394 | }, | |
| 395 | "lockedComponents": [ | |
| 396 | "src/db/schema.ts", | |
| 397 | "src/git/repository.ts", | |
| 398 | "src/git/protocol.ts", | |
| 399 | "src/hooks/post-receive.ts", | |
| 400 | "src/views/layout.tsx", | |
| 401 | "src/views/components.tsx", | |
| 402 | "src/middleware/auth.ts", | |
| 403 | "src/lib/config.ts", | |
| 404 | "src/lib/auth.ts", | |
| 405 | "src/lib/gate.ts", | |
| 406 | "src/lib/security-scan.ts", | |
| 407 | "BUILD_BIBLE.md" | |
| 408 | ] | |
| 409 | } | |
| 410 | ||
| 411 | ================================================================================ | |
| 412 | END OF GUIDE | |
| 413 | ================================================================================ |