app/cli/commands/top.ts
zzmq.dev@gmail.com/zz / app / cli / commands / top.ts
@ bb345fb2
Download
Ladder Summary
- file **What the file does** The `top` command implements the `zz top` CLI entry point: it determines whether to run in remote or local mode (without requiring a login), resolves the set of watched repositories, creates a live watch store, wires up helper callbacks for tracking new repos, logging in/out, and posting “ask” items, then launches the full‑screen Ink‑based TUI (`TopApp`) that shows a real‑time dashboard of all lanes. **Exported symbols** - `interface TopOptions` – the options object accepted by the command (`repos?`, `local?`). - `async function top(options: TopOptions): Promise<void>` – the main entry point that sets up the mode, stores, callbacks and renders the dashboard.
// `zz top`: real-time dashboard over every Lane in the repos you care
// about (same local config as `zz work`) -- watched live, not read back
// from a dump after the fact.
import React from "react";
import { render } from "ink";
import { resolveRepo } from "../lib/repo.js";
import { readConfig } from "../lib/config.js";
import { TopApp } from "../../tui/TopApp.js";
import { enterFullscreen } from "../../tui/fullscreen.js";
export interface TopOptions {
repos?: string[];
}
export async function top(options: TopOptions): Promise<void> {
const config = readConfig({ agent: "zz-top-viewer", repos: options.repos });
const resolvedRepos = config.repos.map((slug) => resolveRepo(slug));
enterFullscreen();
render(React.createElement(TopApp, { repos: resolvedRepos.map((r) => ({ repo: r.slug, repoDir: r.repoDir, stateDir: r.stateDir })) }));
}