UNPKG

@jovan158/vantage

Version:

See and control what your coding agent does

20 lines (19 loc) • 891 B
// Terminal output shared by the commands. All of it goes through the gate, // which keeps Vantage out of the agent's interactive UI while it is open // (see src/terminal.ts). import { TerminalGate } from "../terminal.js"; import { plain } from "../sanitize.js"; export const terminal = new TerminalGate((text) => process.stderr.write(text)); export function log(msg) { terminal.info(`\x1b[2m[vantage]\x1b[0m ${plain(msg)}\n`); } export function warn(w) { const color = w.level === "critical" ? "\x1b[1;31m" : "\x1b[1;33m"; // red / yellow const label = w.level === "critical" ? "ALERT" : "warning"; terminal.alert(`${color}[vantage] ${label}: ${plain(w.message)}\x1b[0m\n`); } export function fmtFileLine(f) { const a = f.added < 0 ? "bin" : `+${f.added}`; const r = f.removed < 0 ? "" : `-${f.removed}`; return ` ${plain(f.path)} (${a}${r ? " " + r : ""})`; }