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

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.

index.tsBlame56 lines · 1 contributor
fc1817aClaude1import { mkdir } from "fs/promises";
2import app from "./app";
3import { config } from "./lib/config";
eafe8c6Claude4import { startWorker } from "./lib/workflow-runner";
2b821b7Claude5import { startAutopilot } from "./lib/autopilot";
988380aClaude6import { ensureDemoContent } from "./lib/demo-seed";
52ad8b1Claude7import { ensureDemoActivity } from "./lib/demo-activity-seed";
2d985e5Claude8import { ensureEnvSiteAdmin } from "./lib/admin-bootstrap";
f764c07Claude9import { notifySystemdReady } from "./lib/systemd-notify";
fc1817aClaude10
11// Ensure repos directory exists
12await mkdir(config.gitReposPath, { recursive: true });
13
eafe8c6Claude14// Start the Actions-equivalent workflow worker (Block C1). Polls
15// workflow_runs for queued rows and executes them sequentially.
16startWorker();
17
2b821b7Claude18// Autopilot: periodic mirror sync, merge-queue progress, weekly digests,
19// advisory rescans. No-op when AUTOPILOT_DISABLED=1.
20startAutopilot();
21
2d985e5Claude22// 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.
25void ensureEnvSiteAdmin().catch(() => {});
26
988380aClaude27// Opt-in demo content seed on boot (DEMO_SEED_ON_BOOT=1). Idempotent, never
52ad8b1Claude28// 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.
988380aClaude31if (process.env.DEMO_SEED_ON_BOOT === "1") {
52ad8b1Claude32 void (async () => {
33 try {
34 await ensureDemoContent();
35 await ensureDemoActivity();
36 } catch {
37 /* never throw out of boot */
38 }
39 })();
988380aClaude40}
41
fc1817aClaude42console.log(`
43 gluecron v0.1.0
44 ──────────────────────
45 http://localhost:${config.port}
46 repos: ${config.gitReposPath}
47`);
48
f764c07Claude49// BLOCK N2 — tell systemd we're ready. No-op when NOTIFY_SOCKET is unset
50// (dev / non-systemd hosts). Fire-and-forget; never throws.
51void notifySystemdReady().catch(() => {});
52
fc1817aClaude53export default {
54 port: config.port,
55 fetch: app.fetch,
56};