(filePath: string)
| 30 | } |
| 31 | |
| 32 | export function displayPath(filePath: string): string { |
| 33 | const cwd = process.cwd(); |
| 34 | const relative = path.relative(cwd, filePath); |
| 35 | if (!relative.startsWith('..') && !path.isAbsolute(relative)) { |
| 36 | return relative; |
| 37 | } |
| 38 | |
| 39 | const home = os.homedir(); |
| 40 | if (filePath === home) { |
| 41 | return '~'; |
| 42 | } |
| 43 | if (filePath.startsWith(home + '/')) { |
| 44 | return '~/' + filePath.slice(home.length + 1); |
| 45 | } |
| 46 | |
| 47 | return filePath; |
| 48 | } |
| 49 | |
| 50 | const OPERATION_EMOJI: Record<ToolPreflightParams['operation'], string> = { |
| 51 | Build: '\u{1F528}', |
no outgoing calls