an open-source alternative to the dots, bots and muses of the world, run an office of claude code/codex like agents on your laptop, sandboxes or anywhere, uses your existing subscriptions
HTML agent-harnessagent-orchestrationagentsai-agentsautonomous-agentsclaude-codecodexcoding-agentsdesktop-appdeveloper-toolselectrongemini-cliharnessharness-engineeringlocal-firstmemorymulti-agentopencodeorchestrationtypescript
feat(ci): CI status watcher in Command Center
Chaitanya Girifa6f48bc26a3
diff --git a/src/main/github.ts b/src/main/github.tsindex 2c89077f..04343893 100644--- a/src/main/github.ts+++ b/src/main/github.ts@@ -62,3 +62,61 @@ export function listIssues(cwd: string): Promise<{ ok: boolean; issues?: GHIssue});});}++/** A CI (GitHub Actions) workflow run, normalized for the renderer. */+export interface CIRun {+ name: string;+ status: string;+ conclusion: string | null;+ url: string;+}++/** Shape `gh run list --json` emits for each run (the fields we ask for). */+interface RawCIRun {+ name?: string;+ status?: string;+ conclusion?: string | null;+ url?: string;+ databaseId?: number;+}++/**+ * List up to 5 recent CI (GitHub Actions) workflow runs in the repo at `cwd`+ * via the `gh` CLI.+ *+ * Returns `{ ok: false, error }` on any failure — spawn error (e.g. `gh` not+ * installed), non-zero exit (e.g. unauthenticated / not a repo / no Actions),+ * or a JSON parse failure — so callers never have to try/catch.+ */+export function listCIRuns(cwd: string): Promise<{ ok: boolean; runs?: CIRun[]; error?: string }> {+ return new Promise((resolve) => {+ const proc = spawn(+ 'gh',+ ['run', 'list', '--limit', '5', '--json', 'name,status,conclusion,url,databaseId'],+ { cwd }+ );+ let stdout = '';+ let stderr = '';+ proc.stdout.on('data', (d) => { stdout += d.toString(); });+ proc.stderr.on('data', (d) => { stderr += d.toString(); });+ proc.on('error', (e) => resolve({ ok: false, error: e.message }));+ proc.on('close', (code) => {+ if (code !== 0) {+ resolve({ ok: false, error: stderr.trim() || `gh exited ${code}` });+ return;+ }+ try {+ const raw = JSON.parse(stdout) as RawCIRun[];+ const runs: CIRun[] = (Array.isArray(raw) ? raw : []).map((r) => ({+ name: r.name ?? '',+ status: r.status ?? '',+ conclusion: r.conclusion ?? null,+ url: r.url ?? ''+ }));+ resolve({ ok: true, runs });+ } catch (e) {+ resolve({ ok: false, error: e instanceof Error ? e.message : String(e) });+ }+ });+ });+}diff --git a/src/main/index.ts b/src/main/index.tsindex 71bb9a27..03c22bb0 100644--- a/src/main/index.ts+++ b/src/main/index.ts@@ -15,7 +15,7 @@ import { HiveManager, type AgentMeta, type HiveMessage } from './hive';import { HookServer } from './hooks';import { MemoryManager } from './memory';import { enrichMessage } from './assistant';-import { listIssues } from './github';+import { listIssues, listCIRuns } from './github';const isDev = !!process.env.ELECTRON_RENDERER_URL;const ptyManager = new PtyManager();@@ -308,6 +308,11 @@ ipcMain.handle('github:issues', (_evt, cwd: unknown) =>typeof cwd === 'string' ? listIssues(cwd) : { ok: false, error: 'no cwd' });+// ─── IPC: GitHub CI status watcher (gh CLI) ──────────────────────────────────+ipcMain.handle('github:ciRuns', (_evt, cwd: unknown) =>+ typeof cwd === 'string' ? listCIRuns(cwd) : { ok: false, error: 'no cwd' }+);+app.whenReady().then(() => {// Bootstrap the hive (if harnessHome is configured) and start the message router.if (hive.enabled()) {diff --git a/src/preload/index.ts b/src/preload/index.tsindex 27f4fe17..7a31cfdf 100644--- a/src/preload/index.ts+++ b/src/preload/index.ts@@ -106,6 +106,14 @@ export interface GHIssue {assignees: string[];}+/** A CI (GitHub Actions) workflow run, normalized for the renderer. */+export interface CIRun {+ name: string;+ status: string;+ conclusion: string | null;+ url: string;+}+const api = {version: '0.1.0',@@ -235,7 +243,14 @@ const api = {/** List up to 30 open issues in the repo at `cwd` via the `gh` CLI. Returns* `{ ok: false, error }` if `gh` is missing/unauthenticated or `cwd` isn't a repo. */githubIssues: (cwd: string): Promise<{ ok: boolean; issues?: GHIssue[]; error?: string }> =>- ipcRenderer.invoke('github:issues', cwd)+ ipcRenderer.invoke('github:issues', cwd),++ // ─── GitHub CI status watcher (gh CLI) ─────────────────────────────────────+ /** List up to 5 recent CI (GitHub Actions) runs in the repo at `cwd` via the+ * `gh` CLI. Returns `{ ok: false, error }` if `gh` is missing/unauthenticated,+ * `cwd` isn't a repo, or the repo has no Actions. */+ githubCIRuns: (cwd: string): Promise<{ ok: boolean; runs?: CIRun[]; error?: string }> =>+ ipcRenderer.invoke('github:ciRuns', cwd)};contextBridge.exposeInMainWorld('cth', api);diff --git a/src/renderer/src/components/CommandCenterPanel.tsx b/src/renderer/src/components/CommandCenterPanel.tsxindex 3bc25e4a..4560f8db 100644--- a/src/renderer/src/components/CommandCenterPanel.tsx+++ b/src/renderer/src/components/CommandCenterPanel.tsx@@ -28,6 +28,14 @@ interface GHIssue {assignees: string[];}+/** A CI run as returned by `window.cth.githubCIRuns` (GitHub Actions workflow runs). */+interface CIRun {+ name: string;+ status: string;+ conclusion: string | null;+ url: string;+}+const TABS: { key: CCTab; label: string; icon: Parameters<typeof Icon>[0]['name'] }[] = [{ key: 'terminal', label: 'terminal', icon: 'terminal' },{ key: 'floor', label: 'floor', icon: 'mcp' },@@ -460,6 +468,8 @@ function ActivityTab() {return (<Scroll>+ <CIStatusSection />+<Section title="USAGE (this session)">{agents.map((a) => (<div key={a.id} style={{ display: 'flex', alignItems: 'center', gap: 8, marginBottom: 2 }}>@@ -488,6 +498,125 @@ function ActivityTab() {);}+// ─── CI status — per-repo latest workflow run, polled every 30s ──────────────++/** Per-repo CI poll result: the latest run plus any error surfaced by the IPC. */+interface RepoCIState {+ run: CIRun | null;+ error: string | null;+}++/** A run failed if it completed with a non-success conclusion. */+function ciFailed(run: CIRun): boolean {+ return run.status === 'completed' && run.conclusion !== null && run.conclusion !== 'success';+}++/** Status chip: green=success, red=failure, yellow=in_progress/queued. */+function CIChip({ run }: { run: CIRun }) {+ let bg = 'var(--cth-lemon)';+ let label = run.status || 'queued';+ if (run.status === 'completed') {+ if (run.conclusion === 'success') { bg = 'var(--cth-mint)'; label = 'success'; }+ else { bg = 'var(--cth-coral)'; label = run.conclusion || 'failed'; }+ }+ return (+ <span style={{+ fontSize: 10, lineHeight: '14px', padding: '0 6px', flexShrink: 0,+ background: bg, boxShadow: 'inset 0 0 0 1px var(--cth-ink-900)', color: 'var(--cth-ink-900)'+ }}>{label}</span>+ );+}++/** Polls `githubCIRuns` for every registered repo every 30s. gh being missing+ * or unauthenticated surfaces as a muted per-repo error — never a crash. */+function CIStatusSection() {+ const [repos, setRepos] = useState<string[]>([]);+ const [states, setStates] = useState<Record<string, RepoCIState>>({});+ const [copied, setCopied] = useState<string | null>(null);+ const timer = useRef<ReturnType<typeof setInterval> | null>(null);++ useEffect(() => {+ window.cth.getConfig().then((c) => setRepos(c.registeredRepos ?? [])).catch(() => { /* noop */ });+ }, []);++ useEffect(() => {+ if (repos.length === 0) return;+ let cancelled = false;+ const refresh = async () => {+ const next: Record<string, RepoCIState> = {};+ for (const repo of repos) {+ try {+ const res = await window.cth.githubCIRuns(repo);+ next[repo] = res.ok+ ? { run: (res.runs ?? [])[0] ?? null, error: null }+ : { run: null, error: res.error ?? 'Failed to fetch CI runs.' };+ } catch (e) {+ next[repo] = { run: null, error: e instanceof Error ? e.message : String(e) };+ }+ }+ if (!cancelled) setStates(next);+ };+ refresh();+ timer.current = setInterval(refresh, 30000);+ return () => { cancelled = true; if (timer.current) clearInterval(timer.current); };+ }, [repos]);++ const copyUrl = async (url: string) => {+ try {+ await window.cth.copyToClipboard(url);+ setCopied(url);+ setTimeout(() => setCopied((c) => (c === url ? null : c)), 1300);+ } catch { /* noop */ }+ };++ if (repos.length === 0) return null;++ return (+ <Section title="CI STATUS">+ {repos.map((repo) => {+ const st = states[repo];+ const short = repo.split('/').filter(Boolean).pop() || repo;+ const run = st?.run ?? null;+ return (+ <div key={repo} style={{+ display: 'flex', flexDirection: 'column', gap: 4,+ padding: 6, marginBottom: 6,+ background: 'var(--cth-paper-100)', boxShadow: 'inset 0 0 0 1px var(--cth-ink-300)'+ }}>+ <div style={{ display: 'flex', alignItems: 'center', gap: 6 }}>+ <span style={{ flex: 1, fontSize: 12, color: 'var(--cth-ink-900)', wordBreak: 'break-word' }}>{short}</span>+ {run && <CIChip run={run} />}+ </div>+ {run && (+ <div style={{ fontSize: 11, color: 'var(--cth-ink-500)', wordBreak: 'break-word' }}>+ {run.name || 'workflow'}+ </div>+ )}+ {!st && <Muted>checking…</Muted>}+ {st && !run && !st.error && <Muted>No runs yet.</Muted>}+ {st?.error && (+ <div style={{ fontSize: 11, color: 'var(--cth-ink-500)', wordBreak: 'break-word' }}>{st.error}</div>+ )}+ {run && ciFailed(run) && run.url && (+ <button+ onClick={() => copyUrl(run.url)}+ title="Copy the failing run's URL"+ style={{+ alignSelf: 'flex-start', display: 'inline-flex', alignItems: 'center', gap: 4,+ padding: '2px 7px 1px', border: 'none', cursor: 'pointer',+ background: copied === run.url ? 'var(--cth-mint)' : 'var(--cth-cream-200)',+ boxShadow: 'inset 0 0 0 1px var(--cth-ink-700)',+ fontFamily: 'var(--cth-font-ui)', fontSize: 11, color: 'var(--cth-ink-900)'+ }}+ ><Icon name={copied === run.url ? 'check' : 'code'} /> {copied === run.url ? 'copied' : 'copy run URL'}</button>+ )}+ </div>+ );+ })}+ </Section>+ );+}+// ─── Handbook tab — copyable Claude command reference ────────────────────────interface Cmd { cmd: string; kind: 'slash' | 'cli'; desc: string; usage?: string }