@nanocollective/nanocoder
Version:
A local-first CLI coding agent that brings the power of agentic coding tools like Claude Code and Gemini CLI to local models or controlled APIs like OpenRouter
20 lines • 930 B
JavaScript
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
/**
* ASCII progress bar component for usage visualization
*/
import { Text } from 'ink';
/**
* Renders an ASCII progress bar
*/
export function ProgressBar({ percent, width, color }) {
// Ensure values are valid numbers to prevent crashes
const safePercent = Number.isFinite(percent) ? percent : 0;
const safeWidth = Number.isFinite(width) && width > 0 ? Math.floor(width) : 10;
const clampedPercent = Math.min(100, Math.max(0, safePercent));
const filledWidth = Math.round((safeWidth * clampedPercent) / 100);
const emptyWidth = safeWidth - filledWidth;
const filledBar = '█'.repeat(filledWidth);
const emptyBar = '░'.repeat(emptyWidth);
return (_jsxs(Text, { children: [_jsx(Text, { color: color, children: filledBar }), _jsx(Text, { color: "gray", children: emptyBar })] }));
}
//# sourceMappingURL=progress-bar.js.map