CodeIssuesDiscussionsWikiPull RequestsProjectsCommitsActionsReleasesContributorsPulse● GatesSecuritySettingsDeploymentsPipelineInsightsAgents✨ Explain✨ Ask AI✨ Workspace✨ Spec✨ Tests▓ Debt Map✨ NL Search🏛 Archaeology
Blame · Line-by-line history
index.ts
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 | import { mkdir } from "fs/promises"; |
| 2 | import app from "./app"; | |
| 3 | import { config } from "./lib/config"; | |
| eafe8c6 | 4 | import { startWorker } from "./lib/workflow-runner"; |
| 2b821b7 | 5 | import { startAutopilot } from "./lib/autopilot"; |
| 988380a | 6 | import { ensureDemoContent } from "./lib/demo-seed"; |
| 52ad8b1 | 7 | import { ensureDemoActivity } from "./lib/demo-activity-seed"; |
| 2d985e5 | 8 | import { ensureEnvSiteAdmin } from "./lib/admin-bootstrap"; |
| f764c07 | 9 | import { notifySystemdReady } from "./lib/systemd-notify"; |
| fc1817a | 10 | |
| 11 | // Ensure repos directory exists | |
| 12 | await mkdir(config.gitReposPath, { recursive: true }); | |
| 13 | ||
| eafe8c6 | 14 | // Start the Actions-equivalent workflow worker (Block C1). Polls |
| 15 | // workflow_runs for queued rows and executes them sequentially. | |
| 16 | startWorker(); | |
| 17 | ||
| 2b821b7 | 18 | // Autopilot: periodic mirror sync, merge-queue progress, weekly digests, |
| 19 | // advisory rescans. No-op when AUTOPILOT_DISABLED=1. | |
| 20 | startAutopilot(); | |
| 21 | ||
| 2d985e5 | 22 | // Site-admin bootstrap from env (SITE_ADMIN_USERNAME). Idempotent — if the |
| 23 | // user exists, they get a row in site_admins; if not, logged and retried | |
| 24 | // on next boot. Background-fired so a slow DB doesn't block startup. | |
| 25 | void ensureEnvSiteAdmin().catch(() => {}); | |
| 26 | ||
| 988380a | 27 | // Opt-in demo content seed on boot (DEMO_SEED_ON_BOOT=1). Idempotent, never |
| 52ad8b1 | 28 | // throws — safe to run on every start. Block L3 layers extra activity (more |
| 29 | // issues, an open + merged PR on todo-api, AI-review comment, auto-merge | |
| 30 | // audit row) so the live /demo page has content out of the box. | |
| 988380a | 31 | if (process.env.DEMO_SEED_ON_BOOT === "1") { |
| 52ad8b1 | 32 | void (async () => { |
| 33 | try { | |
| 34 | await ensureDemoContent(); | |
| 35 | await ensureDemoActivity(); | |
| 36 | } catch { | |
| 37 | /* never throw out of boot */ | |
| 38 | } | |
| 39 | })(); | |
| 988380a | 40 | } |
| 41 | ||
| fc1817a | 42 | console.log(` |
| 43 | gluecron v0.1.0 | |
| 44 | ────────────────────── | |
| 45 | http://localhost:${config.port} | |
| 46 | repos: ${config.gitReposPath} | |
| 47 | `); | |
| 48 | ||
| f764c07 | 49 | // BLOCK N2 — tell systemd we're ready. No-op when NOTIFY_SOCKET is unset |
| 50 | // (dev / non-systemd hosts). Fire-and-forget; never throws. | |
| 51 | void notifySystemdReady().catch(() => {}); | |
| 52 | ||
| fc1817a | 53 | export default { |
| 54 | port: config.port, | |
| 55 | fetch: app.fetch, | |
| 56 | }; |