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
claude/adoring-hopper-5x74bqclaude/affectionate-feynman-ykrf1hclaude/architecture-audit-design-wxprenclaude/build-status-update-3MXsfclaude/charming-meitner-mllb5rclaude/compare-gate-gluecron-s4mFQclaude/confident-faraday-tikcwbclaude/continue-work-XMTlIclaude/crontech-gluecron-deploy-7MIECclaude/crontech-platform-setup-SeKfwclaude/design-2026claude/ecstatic-ptolemy-jMdigclaude/enhance-github-integration-QNHdGclaude/fix-aa-loop-issue-PonMQclaude/fix-actions-and-processclaude/fix-desktop-errors-XqoW8claude/fix-red-workflowsclaude/fix-website-access-6FKJNclaude/gatetest-integration-hardeningclaude/github-audit-improvements-bDFr9claude/gluecron-launch-status-FoMRlclaude/hopeful-lamport-olfCTclaude/issue-to-pr-and-protectionsclaude/jolly-heisenberg-2sg1Qclaude/launch-preparation-QmTb6claude/new-session-xk1l7claude/plan-platform-architecture-kkN4yclaude/platform-analysis-roadmap-1nUGLclaude/platform-launch-assessment-8dWV8claude/polish-platform-release-AeDrUclaude/resume-previous-work-KzyLwclaude/review-crontech-handoff-qYEVqclaude/review-project-completeness-lHhS2claude/review-readme-docs-ulqPKclaude/serene-edison-rj87weclaude/setup-multi-repo-dev-BCwNQclaude/ship-fixes-and-tests-Jvz1cclaude/site-audit-competitive-pctlwgclaude/site-migration-vercel-XstpKclaude/standalone-product-repos-XHFTDcopilot/feat-smart-empty-states-keyboard-first-enhancementcopilot/feat-smart-morning-digest-review-context-restorecopilot/fix-and-process-workflowscopilot/update-ai-powered-code-reviewfeat/debt-mapfeat/push-policy-codeowners-hardeningfeat/smart-digest-contextfeat/stage-impactfeat/t1-secret-migrationfeat/u-polishfeat/w-self-hostfeat/w2-claude-configfix/agent-journey-orphan-sweepgatetest/auto-fix-1776586424172gatetest/auto-fix-1776586534814gatetest/auto-fix-1776590685143gatetest/auto-fix-1776590808199mainops/redeploy-retriggerstyle/dxt-cta-themeworktree-agent-a3377aad30d55da26worktree-agent-a7ef607b7ee1d6c74
health.tsx9.3 KB · 288 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
/**
 * Repository Health Dashboard — the page GitHub doesn't have.
 *
 * Shows a live health score, security scan results, test coverage estimate,
 * dependency freshness, complexity analysis, and actionable insights.
 *
 * This runs EVERY TIME someone views the repo. No config needed.
 * No yaml. No CI setup. Just push code and gluecron tells you what's wrong.
 */

import { Hono } from "hono";
import { Layout } from "../views/layout";
import { RepoHeader, RepoNav } from "../views/components";
import {
  computeHealthScore,
  detectCIConfig,
  type RepoHealthReport,
  type SecurityIssue,
} from "../lib/intelligence";
import { repoExists, getDefaultBranch } from "../git/repository";
import { softAuth } from "../middleware/auth";
import type { AuthEnv } from "../middleware/auth";

const health = new Hono<AuthEnv>();

health.use("*", softAuth);

health.get("/:owner/:repo/health", async (c) => {
  const { owner, repo } = c.req.param();
  const user = c.get("user");

  if (!(await repoExists(owner, repo))) return c.notFound();

  const ref = (await getDefaultBranch(owner, repo)) || "main";

  // Run analysis in parallel
  const [report, ciConfig] = await Promise.all([
    computeHealthScore(owner, repo),
    detectCIConfig(owner, repo, ref),
  ]);

  const gradeColor =
    report.grade === "A+" || report.grade === "A"
      ? "var(--green)"
      : report.grade === "B"
        ? "#58a6ff"
        : report.grade === "C"
          ? "var(--yellow)"
          : "var(--red)";

  return c.html(
    <Layout title={`Health — ${owner}/${repo}`} user={user}>
      <RepoHeader owner={owner} repo={repo} />
      <HealthNav owner={owner} repo={repo} active="health" />

      <div style="display: flex; gap: 24px; flex-wrap: wrap; margin-bottom: 32px">
        <div
          style={`text-align: center; padding: 24px 40px; background: var(--bg-secondary); border: 2px solid ${gradeColor}; border-radius: var(--radius);`}
        >
          <div style={`font-size: 48px; font-weight: 800; color: ${gradeColor}`}>
            {report.grade}
          </div>
          <div style="font-size: 32px; font-weight: 600; color: var(--text)">
            {report.score}/100
          </div>
          <div style="font-size: 13px; color: var(--text-muted); margin-top: 4px">
            Health Score
          </div>
        </div>

        <div style="flex: 1; min-width: 300px">
          <h3 style="margin-bottom: 12px">Insights</h3>
          {report.insights.map((insight) => (
            <div style="padding: 8px 0; font-size: 14px; border-bottom: 1px solid var(--border); display: flex; gap: 8px; align-items: start">
              <span style="color: var(--text-link); flex-shrink: 0">*</span>
              <span>{insight}</span>
            </div>
          ))}
        </div>
      </div>

      <div class="card-grid" style="grid-template-columns: repeat(auto-fill, minmax(280px, 1fr))">
        <ScoreCard
          title="Security"
          score={report.breakdown.security.score}
          details={[
            `${report.breakdown.security.issues.length} issue${report.breakdown.security.issues.length !== 1 ? "s" : ""} found`,
            `${report.breakdown.security.issues.filter((i) => i.severity === "critical").length} critical`,
            `${report.breakdown.security.issues.filter((i) => i.severity === "high").length} high`,
          ]}
        />
        <ScoreCard
          title="Testing"
          score={report.breakdown.testing.score}
          details={[
            report.breakdown.testing.hasTests ? `${report.breakdown.testing.testFileCount} test files` : "No tests found",
            `Coverage estimate: ${report.breakdown.testing.estimatedCoverage}`,
          ]}
        />
        <ScoreCard
          title="Complexity"
          score={report.breakdown.complexity.score}
          details={[
            `${report.breakdown.complexity.totalFiles} source files`,
            `Avg file size: ${report.breakdown.complexity.avgFileSize} bytes`,
          ]}
        />
        <ScoreCard
          title="Dependencies"
          score={report.breakdown.dependencies.score}
          details={[
            `${report.breakdown.dependencies.total} dependencies`,
            report.breakdown.dependencies.lockfileExists ? "Lockfile present" : "No lockfile",
          ]}
        />
        <ScoreCard
          title="Documentation"
          score={report.breakdown.documentation.score}
          details={[
            report.breakdown.documentation.hasReadme ? "README found" : "No README",
            report.breakdown.documentation.hasLicense ? "License present" : "No license",
            `${report.breakdown.documentation.docFileCount} doc files`,
          ]}
        />
        <ScoreCard
          title="Activity"
          score={report.breakdown.activity.score}
          details={[
            `${report.breakdown.activity.recentCommits} commits (30d)`,
            `${report.breakdown.activity.uniqueContributors} contributors`,
            `Last push: ${report.breakdown.activity.lastPushDaysAgo}d ago`,
          ]}
        />
      </div>

      {report.breakdown.security.issues.length > 0 && (
        <div style="margin-top: 32px">
          <h3 style="margin-bottom: 12px">Security Issues</h3>
          <div class="issue-list">
            {report.breakdown.security.issues.map((issue) => (
              <div class="issue-item">
                <div style="display: flex; gap: 8px; align-items: center">
                  <SeverityBadge severity={issue.severity} />
                  <div>
                    <div style="font-size: 14px; font-weight: 500">
                      {issue.message}
                    </div>
                    <div style="font-size: 12px; color: var(--text-muted); font-family: var(--font-mono)">
                      {issue.file}
                      {issue.line ? `:${issue.line}` : ""} — {issue.rule}
                    </div>
                  </div>
                </div>
              </div>
            ))}
          </div>
        </div>
      )}

      {ciConfig.commands.length > 0 && (
        <div style="margin-top: 32px">
          <h3 style="margin-bottom: 12px">
            Zero-Config CI
            <span style="font-size: 13px; color: var(--text-muted); font-weight: 400; margin-left: 8px">
              Auto-detected
            </span>
          </h3>
          <div style="background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px">
            <div style="margin-bottom: 12px; font-size: 13px; color: var(--text-muted)">
              {ciConfig.detected.join(" | ")}
            </div>
            {ciConfig.commands.map((cmd) => (
              <div style="display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); align-items: center">
                <span style="font-size: 14px; font-weight: 500">
                  {cmd.name}
                </span>
                <code style="font-size: 12px; background: var(--bg-tertiary); padding: 4px 8px; border-radius: 3px">
                  {cmd.command}
                </code>
              </div>
            ))}
          </div>
        </div>
      )}
    </Layout>
  );
});

const HealthNav = ({
  owner,
  repo,
  active,
}: {
  owner: string;
  repo: string;
  active: string;
}) => (
  <div class="repo-nav">
    <a href={`/${owner}/${repo}`} class={active === "code" ? "active" : ""}>
      Code
    </a>
    <a
      href={`/${owner}/${repo}/issues`}
      class={active === "issues" ? "active" : ""}
    >
      Issues
    </a>
    <a
      href={`/${owner}/${repo}/pulls`}
      class={active === "pulls" ? "active" : ""}
    >
      Pull Requests
    </a>
    <a
      href={`/${owner}/${repo}/health`}
      class={active === "health" ? "active" : ""}
    >
      Health
    </a>
    <a
      href={`/${owner}/${repo}/commits`}
      class={active === "commits" ? "active" : ""}
    >
      Commits
    </a>
  </div>
);

const ScoreCard = ({
  title,
  score,
  details,
}: {
  title: string;
  score: number;
  details: string[];
}) => {
  const color =
    score >= 80 ? "var(--green)" : score >= 50 ? "var(--yellow)" : "var(--red)";
  return (
    <div class="card">
      <div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px">
        <h3 style="font-size: 15px">{title}</h3>
        <span
          style={`font-size: 18px; font-weight: 700; color: ${color}`}
        >
          {score}
        </span>
      </div>
      <div
        style="height: 4px; background: var(--bg-tertiary); border-radius: 2px; margin-bottom: 8px; overflow: hidden"
      >
        <div
          style={`height: 100%; width: ${score}%; background: ${color}; border-radius: 2px; transition: width 0.3s;`}
        />
      </div>
      {details.map((d) => (
        <div style="font-size: 12px; color: var(--text-muted); margin-top: 2px">
          {d}
        </div>
      ))}
    </div>
  );
};

const SeverityBadge = ({
  severity,
}: {
  severity: SecurityIssue["severity"];
}) => {
  const colors: Record<string, string> = {
    critical: "var(--red)",
    high: "#ff7b72",
    medium: "var(--yellow)",
    low: "var(--text-muted)",
    info: "var(--text-link)",
  };
  return (
    <span
      class="badge"
      style={`color: ${colors[severity]}; border-color: ${colors[severity]}; font-size: 11px; text-transform: uppercase`}
    >
      {severity}
    </span>
  );
};

export default health;