Fix: fixing imports on the utils folder

This commit is contained in:
2026-02-04 00:35:00 -05:00
parent 21e08d20f1
commit 5c2d79c802
21 changed files with 73 additions and 184 deletions

View File

@@ -1,13 +0,0 @@
/**
* Diff utility for generating colored git-style diff output
*/
export type {
DiffLine,
DiffHunk,
DiffResult,
DiffLineType,
} from "@/types/diff";
export { generateDiff } from "@utils/diff/generate";
export { formatDiff, formatCompactDiff } from "@utils/diff/format";
export { parseDiffOutput, isDiffContent, stripAnsi } from "@utils/diff/index";

View File

@@ -1,13 +1,6 @@
/**
* Diff hunk grouping utilities
*/
import { DIFF_CONTEXT_LINES } from "@constants/diff";
import type { DiffLine, DiffHunk } from "@/types/diff";
/**
* Group diff lines into hunks with context
*/
export const groupIntoHunks = (
lines: DiffLine[],
contextLines = DIFF_CONTEXT_LINES,

View File

@@ -1,19 +1,9 @@
/**
* Diff View Utility Functions
*/
import type { DiffLineData } from "@/types/tui";
/**
* Strip ANSI escape codes from a string
*/
export const stripAnsi = (str: string): string => {
return str.replace(/\x1b\[[0-9;]*m/g, "");
};
/**
* Check if content looks like a diff output
*/
export const isDiffContent = (content: string): boolean => {
// Strip ANSI codes for pattern matching
const cleanContent = stripAnsi(content);
@@ -28,9 +18,6 @@ export const isDiffContent = (content: string): boolean => {
return diffPatterns.some((pattern) => pattern.test(cleanContent));
};
/**
* Parse raw diff output into structured DiffLineData
*/
export const parseDiffOutput = (
diffOutput: string,
): {

View File

@@ -1,10 +1,3 @@
/**
* Longest Common Subsequence computation
*/
/**
* Simple line-based diff using Longest Common Subsequence
*/
export const computeLCS = (
oldLines: string[],
newLines: string[],

View File

@@ -1,12 +1,5 @@
/**
* Diff line generation utilities
*/
import type { DiffLine, DiffOperation } from "@/types/diff";
/**
* Generate diff lines from LCS matrix
*/
export const generateDiffLines = (
oldLines: string[],
newLines: string[],

View File

@@ -3,15 +3,8 @@
*/
import chalk from "chalk";
const DEFAULT_BAR_WIDTH = 40;
interface ProgressBarOptions {
width?: number;
filledChar?: string;
emptyChar?: string;
showPercentage?: boolean;
}
import { DEFAULT_BAR_WIDTH } from "@constants/hooks.js";
import type { ProgressBarOptions } from "@interfactes/ProgressBar";
const defaultOptions: Required<ProgressBarOptions> = {
width: DEFAULT_BAR_WIDTH,

View File

@@ -1,18 +0,0 @@
/**
* Syntax Highlighting Utility
*
* Provides terminal-friendly syntax highlighting for code
* using cli-highlight with language auto-detection.
*/
export {
detectLanguage,
isLanguageSupported,
getLanguageDisplayName,
} from "@utils/syntax-highlight/detect";
export {
highlightLine,
highlightCode,
highlightLines,
} from "@utils/syntax-highlight/highlight";

View File

@@ -1,7 +1,3 @@
/**
* Language detection utilities
*/
import { supportsLanguage } from "cli-highlight";
import {
EXTENSION_TO_LANGUAGE,

View File

@@ -1,17 +1,6 @@
/**
* Code highlighting utilities
*/
import { highlight } from "cli-highlight";
import { detectLanguage } from "@utils/syntax-highlight/detect";
/**
* Highlight a single line of code
*
* @param line - The code line to highlight
* @param language - The programming language
* @returns Highlighted line with ANSI codes
*/
export const highlightLine = (line: string, language?: string): string => {
if (!language || !line.trim()) {
return line;
@@ -30,14 +19,6 @@ export const highlightLine = (line: string, language?: string): string => {
}
};
/**
* Highlight a block of code
*
* @param code - The code to highlight
* @param language - The programming language (auto-detected if not provided)
* @param filePath - Optional file path for language detection
* @returns Highlighted code with ANSI codes
*/
export const highlightCode = (
code: string,
language?: string,
@@ -59,14 +40,6 @@ export const highlightCode = (
}
};
/**
* Highlight multiple lines while preserving line structure
* Useful for diff views where each line needs individual highlighting
*
* @param lines - Array of code lines
* @param language - The programming language
* @returns Array of highlighted lines
*/
export const highlightLines = (
lines: string[],
language?: string,

View File

@@ -1,33 +0,0 @@
/**
* TUI App Utilities - Exports
*/
export {
isMouseEscapeSequence,
cleanInput,
insertAtCursor,
deleteBeforeCursor,
calculateCursorPosition,
} from "@utils/tui-app/input-utils";
export {
isInputLocked,
isModalCommand,
isMainInputActive,
isProcessing,
} from "@utils/tui-app/mode-utils";
export {
countLines,
shouldSummarizePaste,
generatePlaceholder,
createPastedContent,
generatePasteId,
addPastedBlock,
updatePastedBlockPositions,
updatePastedBlocksAfterDelete,
expandPastedContent,
getDisplayBuffer,
normalizeLineEndings,
clearPastedBlocks,
} from "@utils/tui-app/paste-utils";

View File

@@ -1,11 +1,3 @@
/**
* TUI App Input Utilities
*
* Helper functions for input handling in the TUI App
*/
// Mouse escape sequence patterns for filtering
// Note: Patterns for replacement use 'g' flag, patterns for testing don't
const MOUSE_PATTERNS = {
// Full escape sequences (for replacement)
SGR_FULL: /\x1b\[<\d+;\d+;\d+[Mm]/g,
@@ -23,16 +15,11 @@ const MOUSE_PATTERNS = {
BRACKET_SGR_PREFIX: "[<",
} as const;
// Control character patterns for cleaning input
const CONTROL_PATTERNS = {
CONTROL_CHARS: /[\x00-\x1f\x7f]/g,
ESCAPE_SEQUENCES: /\x1b\[.*?[a-zA-Z]/g,
} as const;
/**
* Check if input is a mouse escape sequence
* Handles both full sequences and partial sequences where ESC was stripped
*/
export const isMouseEscapeSequence = (input: string): boolean => {
if (!input) return false;

View File

@@ -1,12 +1,5 @@
/**
* TUI App Mode Utilities
*
* Helper functions for mode checking in the TUI App
*/
import type { AppMode } from "@/types/tui";
// Modes that lock the input
const LOCKED_MODES: ReadonlySet<AppMode> = new Set([
"thinking",
"tool_execution",
@@ -14,7 +7,6 @@ const LOCKED_MODES: ReadonlySet<AppMode> = new Set([
"learning_prompt",
]);
// Commands that open their own modal
const MODAL_COMMANDS: ReadonlySet<string> = new Set([
"model",
"models",