- Migrated src/tools/-only files into packages/builtin-tools/src/tools/ - Rewrote all src/tools/ imports to @claude-code-best/builtin-tools/tools/ - Deleted 121 identical duplicate files from src/tools/ - 238 drifted files preserved in src/tools/ for Phase 2b manual merge - 359 files changed: 914 insertions, 4042 deletions Build: 568 files bundled ✓ Test: 3340 pass / 4 fail (baseline) ✓
27 lines
955 B
TypeScript
27 lines
955 B
TypeScript
import type { TextProps } from '@anthropic/ink'
|
|
import {
|
|
AGENT_COLOR_TO_THEME_COLOR,
|
|
type AgentColorName,
|
|
} from '@claude-code-best/builtin-tools/tools/AgentTool/agentColorManager.js'
|
|
|
|
const DEFAULT_AGENT_THEME_COLOR = 'cyan_FOR_SUBAGENTS_ONLY'
|
|
|
|
/**
|
|
* Convert a color string to Ink's TextProps['color'] format.
|
|
* Colors are typically AgentColorName values like 'blue', 'green', etc.
|
|
* This converts them to theme keys so they respect the current theme.
|
|
* Falls back to the raw ANSI color if the color is not a known agent color.
|
|
*/
|
|
export function toInkColor(color: string | undefined): TextProps['color'] {
|
|
if (!color) {
|
|
return DEFAULT_AGENT_THEME_COLOR
|
|
}
|
|
// Try to map to a theme color if it's a known agent color
|
|
const themeColor = AGENT_COLOR_TO_THEME_COLOR[color as AgentColorName]
|
|
if (themeColor) {
|
|
return themeColor
|
|
}
|
|
// Fall back to raw ANSI color for unknown colors
|
|
return `ansi:${color}` as TextProps['color']
|
|
}
|