ktx/packages/cli/src/io/symbols.ts
Luca Martial 50ffebd98b
refactor(cli): unify output formatting across commands (#111)
* refactor(cli): unify output formatting across search and status commands

Replace clack-style box borders (◇/│/└) and bullets (●/◆) in printList
pretty mode with a clean status-style layout: bold headers, indented
aligned rows, no decorative framing. Migrate status-project.ts from
hand-rolled ANSI escape codes to shared symbols.ts color helpers.
Remove dead clack symbols from SYMBOLS, add yellow() for warnings.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(cli): update stale badge role docstring after dim removal

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-15 08:54:36 -04:00

44 lines
985 B
TypeScript

import { styleText } from 'node:util';
function detectUnicodeSupport(env: NodeJS.ProcessEnv = process.env): boolean {
if (process.platform !== 'win32') {
return env.TERM !== 'linux';
}
return (
Boolean(env.WT_SESSION) ||
env.TERM_PROGRAM === 'vscode' ||
env.TERM === 'xterm-256color' ||
env.TERM === 'alacritty'
);
}
const unicode = detectUnicodeSupport();
export const SYMBOLS = {
middot: unicode ? '·' : '-',
emDash: unicode ? '—' : '--',
} as const;
export function dim(text: string): string {
return styleText('dim', text);
}
export function bold(text: string): string {
return styleText('bold', text);
}
export function gray(text: string): string {
return styleText('gray', text);
}
export function green(text: string): string {
return styleText('green', text);
}
export function red(text: string): string {
return styleText('red', text);
}
export function yellow(text: string): string {
return styleText('yellow', text);
}