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
GateStatusScreen.tsx9.6 KB · 352 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
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
import React, { useCallback } from 'react';
import {
  FlatList,
  ScrollView,
  StyleSheet,
  Text,
  TouchableOpacity,
  View,
  ActivityIndicator,
} from 'react-native';
import { SafeAreaView } from 'react-native-safe-area-context';
import type { NativeStackScreenProps } from '@react-navigation/native-stack';
import { useGates } from '../hooks/useGates';
import { GateStatusBadge } from '../components/GateStatusBadge';
import { LoadingSpinner } from '../components/LoadingSpinner';
import { ErrorBanner } from '../components/ErrorBanner';
import { colors } from '../theme/colors';
import type { RepoStackParamList } from '../navigation/AppNavigator';
import type { GateRun } from '../api/gates';

type Props = NativeStackScreenProps<RepoStackParamList, 'GateStatus'>;

function formatRelative(dateStr: string): string {
  const diff = Date.now() - new Date(dateStr).getTime();
  const mins = Math.floor(diff / 60000);
  if (mins < 1) return 'just now';
  if (mins < 60) return `${mins}m ago`;
  const hrs = Math.floor(mins / 60);
  if (hrs < 24) return `${hrs}h ago`;
  const days = Math.floor(hrs / 24);
  if (days < 30) return `${days}d ago`;
  const months = Math.floor(days / 30);
  if (months < 12) return `${months}mo ago`;
  return `${Math.floor(months / 12)}y ago`;
}

function duration(start: string, end: string | null): string {
  if (!end) return 'running...';
  const ms = new Date(end).getTime() - new Date(start).getTime();
  const secs = Math.round(ms / 1000);
  if (secs < 60) return `${secs}s`;
  return `${Math.floor(secs / 60)}m ${secs % 60}s`;
}

function GateRunCard({ run }: { run: GateRun }): React.ReactElement {
  const [expanded, setExpanded] = React.useState(false);

  return (
    <View style={styles.runCard}>
      <View style={styles.runHeader}>
        <GateStatusBadge status={run.status} aiRepaired={run.aiRepaired} size="small" />
        <View style={styles.runMeta}>
          <Text style={styles.runBranch}>{run.branch}</Text>
          <Text style={styles.runSha}>{run.commitSha.slice(0, 7)}</Text>
        </View>
        <Text style={styles.runTime}>{formatRelative(run.createdAt)}</Text>
      </View>

      <View style={styles.runDetails}>
        <Text style={styles.runDetailText}>
          Duration: {duration(run.startedAt, run.completedAt)}
        </Text>
        {run.triggeredBy !== null && (
          <Text style={styles.runDetailText}>Triggered by {run.triggeredBy}</Text>
        )}
        {run.aiRepaired && run.repairedCommitSha !== null && (
          <View style={styles.repairedRow}>
            <Text style={styles.sparkle}></Text>
            <Text style={styles.repairedText}>
              AI auto-repaired → {run.repairedCommitSha.slice(0, 7)}
            </Text>
          </View>
        )}
      </View>

      {run.output !== null && run.output.length > 0 && (
        <TouchableOpacity
          style={styles.outputToggle}
          onPress={() => setExpanded((v) => !v)}
          activeOpacity={0.8}
        >
          <Text style={styles.outputToggleText}>
            {expanded ? '▾ Hide output' : '▸ Show output'}
          </Text>
        </TouchableOpacity>
      )}

      {expanded && run.output !== null && (
        <ScrollView horizontal showsHorizontalScrollIndicator={false}>
          <View style={styles.outputBox}>
            <Text style={styles.outputText} selectable>
              {run.output}
            </Text>
          </View>
        </ScrollView>
      )}
    </View>
  );
}

export function GateStatusScreen({ route }: Props): React.ReactElement {
  const { owner, repo } = route.params;
  const { runs, isLoading, error, isTriggering, triggerRun, loadMore, hasMore, refresh } =
    useGates(owner, repo);

  const renderRun = useCallback(
    ({ item }: { item: GateRun }) => <GateRunCard run={item} />,
    [],
  );

  const keyExtractor = useCallback((item: GateRun) => item.id, []);

  const renderFooter = useCallback(
    () => (hasMore ? <LoadingSpinner size="small" /> : null),
    [hasMore],
  );

  // Summary stats
  const passed = runs.filter((r) => r.status === 'passed').length;
  const failed = runs.filter((r) => r.status === 'failed').length;
  const repaired = runs.filter((r) => r.aiRepaired).length;

  if (isLoading && runs.length === 0) return <LoadingSpinner fullScreen />;

  return (
    <SafeAreaView style={styles.safe} edges={['bottom']}>
      {error !== null && <ErrorBanner message={error} onRetry={refresh} />}

      <FlatList
        data={runs}
        keyExtractor={keyExtractor}
        renderItem={renderRun}
        onEndReached={loadMore}
        onEndReachedThreshold={0.3}
        ListFooterComponent={renderFooter}
        contentContainerStyle={styles.listContent}
        ListHeaderComponent={
          <View>
            {/* Stats banner */}
            <View style={styles.statsBanner}>
              <View style={styles.statItem}>
                <Text style={[styles.statValue, { color: colors.accent }]}>{passed}</Text>
                <Text style={styles.statLabel}>Passed</Text>
              </View>
              <View style={[styles.statItem, styles.statItemBorder]}>
                <Text style={[styles.statValue, { color: colors.accentRed }]}>{failed}</Text>
                <Text style={styles.statLabel}>Failed</Text>
              </View>
              <View style={styles.statItem}>
                <Text style={[styles.statValue, { color: colors.accentPurple }]}>{repaired}</Text>
                <Text style={styles.statLabel}>AI Repaired</Text>
              </View>
            </View>

            {/* Trigger button */}
            <View style={styles.triggerSection}>
              <TouchableOpacity
                style={[styles.triggerButton, isTriggering && styles.triggerButtonDisabled]}
                onPress={triggerRun}
                disabled={isTriggering}
                activeOpacity={0.8}
              >
                {isTriggering ? (
                  <ActivityIndicator size="small" color={colors.text} />
                ) : (
                  <Text style={styles.triggerText}>⚡ Run Gate Check</Text>
                )}
              </TouchableOpacity>
            </View>

            {runs.length > 0 && (
              <View style={styles.sectionHeader}>
                <Text style={styles.sectionTitle}>Gate Run History</Text>
              </View>
            )}
          </View>
        }
        ListEmptyComponent={
          <View style={styles.emptyState}>
            <Text style={styles.emptyText}>No gate runs yet</Text>
            <Text style={styles.emptySubText}>
              Gate checks run automatically on every push to the default branch.
            </Text>
          </View>
        }
      />
    </SafeAreaView>
  );
}

const styles = StyleSheet.create({
  safe: {
    flex: 1,
    backgroundColor: colors.bg,
  },
  listContent: {
    paddingBottom: 24,
  },
  statsBanner: {
    flexDirection: 'row',
    backgroundColor: colors.bgSecondary,
    borderBottomWidth: 1,
    borderBottomColor: colors.border,
  },
  statItem: {
    flex: 1,
    paddingVertical: 16,
    alignItems: 'center',
    gap: 4,
  },
  statItemBorder: {
    borderLeftWidth: 1,
    borderRightWidth: 1,
    borderColor: colors.border,
  },
  statValue: {
    fontSize: 24,
    fontWeight: '700',
  },
  statLabel: {
    fontSize: 11,
    color: colors.textMuted,
  },
  triggerSection: {
    padding: 16,
    borderBottomWidth: 1,
    borderBottomColor: colors.border,
  },
  triggerButton: {
    backgroundColor: colors.bgTertiary,
    borderRadius: 8,
    paddingVertical: 12,
    alignItems: 'center',
    borderWidth: 1,
    borderColor: colors.accentBlue,
    minHeight: 44,
    justifyContent: 'center',
  },
  triggerButtonDisabled: {
    opacity: 0.5,
  },
  triggerText: {
    fontSize: 14,
    fontWeight: '600',
    color: colors.accentBlue,
  },
  sectionHeader: {
    paddingHorizontal: 16,
    paddingVertical: 10,
  },
  sectionTitle: {
    fontSize: 12,
    fontWeight: '600',
    color: colors.textMuted,
    textTransform: 'uppercase',
    letterSpacing: 0.5,
  },
  runCard: {
    backgroundColor: colors.bgSecondary,
    borderBottomWidth: 1,
    borderBottomColor: colors.border,
    marginHorizontal: 16,
    marginBottom: 10,
    borderRadius: 8,
    borderWidth: 1,
    overflow: 'hidden',
  },
  runHeader: {
    flexDirection: 'row',
    alignItems: 'center',
    padding: 12,
    gap: 10,
  },
  runMeta: {
    flex: 1,
    gap: 2,
  },
  runBranch: {
    fontSize: 13,
    fontFamily: 'monospace',
    color: colors.text,
  },
  runSha: {
    fontSize: 11,
    fontFamily: 'monospace',
    color: colors.textMuted,
  },
  runTime: {
    fontSize: 12,
    color: colors.textMuted,
  },
  runDetails: {
    paddingHorizontal: 12,
    paddingBottom: 10,
    gap: 3,
  },
  runDetailText: {
    fontSize: 12,
    color: colors.textMuted,
  },
  repairedRow: {
    flexDirection: 'row',
    alignItems: 'center',
    gap: 5,
    marginTop: 4,
  },
  sparkle: {
    fontSize: 12,
    color: colors.accentPurple,
  },
  repairedText: {
    fontSize: 12,
    color: colors.accentPurple,
    fontFamily: 'monospace',
  },
  outputToggle: {
    paddingHorizontal: 12,
    paddingVertical: 8,
    borderTopWidth: 1,
    borderTopColor: colors.border,
  },
  outputToggleText: {
    fontSize: 12,
    color: colors.textLink,
  },
  outputBox: {
    padding: 12,
    backgroundColor: colors.bg,
  },
  outputText: {
    fontSize: 11,
    fontFamily: 'monospace',
    color: colors.text,
    lineHeight: 16,
  },
  emptyState: {
    padding: 40,
    alignItems: 'center',
    gap: 8,
  },
  emptyText: {
    fontSize: 16,
    fontWeight: '600',
    color: colors.textMuted,
  },
  emptySubText: {
    fontSize: 13,
    color: colors.textMuted,
    textAlign: 'center',
    lineHeight: 18,
  },
});