418b6801a0
- Extracted git operations from ControlledGit class into centralized utils/git module with 1276 lines of typed command wrappers. - Replaced dependency injection of ControlledGit instances with direct cwd string parameters across commit agent tools and workflows. - Migrated all git command execution from inline shell calls and custom helpers to structured git module API (diff, status, branch, worktree, patch, etc.). - Removed ControlledGit class, operations.ts, and helper functions (findGitHeadPath, mergeStdoutStderr, joinPatch) now provided by git module. - Exported git utilities from main package entry point for extension and plugin use.
31 lines
1.7 KiB
TypeScript
31 lines
1.7 KiB
TypeScript
import type { TabBarTheme } from "@oh-my-pi/pi-tui";
|
|
import { theme } from "./theme/theme";
|
|
|
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
// Text Sanitization
|
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
|
|
/** Sanitize text for display in a single-line status. Replaces newlines/tabs with space, collapses runs, trims. */
|
|
export function sanitizeStatusText(text: string): string {
|
|
return text
|
|
.replace(/[\r\n\t]/g, " ")
|
|
.replace(/ +/g, " ")
|
|
.trim();
|
|
}
|
|
|
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
// Tab Bar Theme
|
|
// ═══════════════════════════════════════════════════════════════════════════
|
|
|
|
/** Shared tab bar theme used by model-selector and settings-selector. */
|
|
export function getTabBarTheme(): TabBarTheme {
|
|
return {
|
|
label: (text: string) => theme.bold(theme.fg("accent", text)),
|
|
activeTab: (text: string) => theme.bold(theme.bg("selectedBg", theme.fg("text", text))),
|
|
inactiveTab: (text: string) => theme.fg("muted", text),
|
|
hint: (text: string) => theme.fg("dim", text),
|
|
};
|
|
}
|
|
|
|
export { parseCommandArgs } from "../utils/command-args";
|