Elffuss BraidHub

kikocis/continue public

main · 714 BRawPermalink
1import path from "path";
2
3/**
4 * Formats a single tool argument for display
5 * @param value The argument value
6 * @returns A formatted string representation of the value
7 */
8export function formatToolArgument(value: any): string {
9 if (value === null || value === undefined) {
10 return "";
11 }
12
13 // Convert absolute paths to relative paths
14 if (typeof value === "string" && path.isAbsolute(value)) {
15 const workspaceRoot = process.cwd();
16 const relativePath = path.relative(workspaceRoot, value);
17 // Normalize path separators to forward slashes for cross-platform consistency
18 return (relativePath || value).replace(/\\/g, "/");
19 }
20
21 // Return other values as strings
22 return String(value);
23}