Files
memind/executor-display-label.mjs
T

29 lines
1.1 KiB
JavaScript
Raw Normal View History

const EXECUTOR_DISPLAY_LABELS = Object.freeze({
cursor: 'TKMind 智趣',
aider: 'Aider',
openhands: 'OpenHands',
goose: 'TKMind',
});
export function resolveExecutorDisplayLabel(executor, executorLabel = '') {
const label = String(executorLabel ?? '').trim();
if (label && !/^cursor$/i.test(label)) return label;
const normalized = String(executor ?? '').trim().toLowerCase();
if (EXECUTOR_DISPLAY_LABELS[normalized]) return EXECUTOR_DISPLAY_LABELS[normalized];
if (label) return label.replace(/cursor/gi, 'TKMind 智趣');
return normalized || 'TKMind 智趣';
}
export function sanitizeUserFacingBrandText(text) {
return String(text ?? '')
.replace(/\bCursor Chat Bridge\b/g, 'TKMind Chat Bridge')
.replace(/\bcursor\s+agent\b/gi, 'TKMind 智趣')
.replace(/\bcursor\s+cli\b/gi, 'TKMind 智趣')
.replace(/\bCursor agent\b/g, 'TKMind 智趣')
.replace(/\bCursor 执行器\b/g, 'TKMind 智趣执行器')
.replace(/\bCursor 启动\b/g, 'TKMind 智趣启动')
.replace(/\bCursor\b/g, 'TKMind 智趣')
.replace(/\bcursor\b/g, 'TKMind 智趣');
}