Remove formatPathForDisplay function completely

- Delete formatPathForDisplay function from path-utils.ts
- Update all components to use displayWorkingDir from server
- Clean up imports in affected components
- Add refactoring philosophy note to CLAUDE.md
This commit is contained in:
Peter Steinberger 2025-06-28 10:31:18 +02:00
parent 856dc3ce91
commit f2eb262384
4 changed files with 10 additions and 22 deletions

View file

@ -52,4 +52,9 @@ NEVER give a code reference or location in any other format.
## CRITICAL
**IMPORTANT**: BEFORE YOU DO ANYTHING, READ spec.md IN FULL USING THE READ TOOL!
**IMPORTANT**: NEVER USE GREP. ALWAYS USE RIPGREP!
**IMPORTANT**: NEVER USE GREP. ALWAYS USE RIPGREP!
## Refactoring Philosophy
- We do not care about deprecation - remove old code completely
- Always prefer clean refactoring over gradual migration
- Delete unused functions and code paths immediately

View file

@ -10,7 +10,7 @@
import { html, LitElement } from 'lit';
import { customElement, property } from 'lit/decorators.js';
import { createLogger } from '../utils/logger.js';
import { copyToClipboard, formatPathForDisplay } from '../utils/path-utils.js';
import { copyToClipboard } from '../utils/path-utils.js';
import './copy-icon.js';
const logger = createLogger('clickable-path');
@ -65,7 +65,7 @@ export class ClickablePath extends LitElement {
render() {
if (!this.path) return html``;
const displayText = this.displayPath || formatPathForDisplay(this.path);
const displayText = this.displayPath || this.path;
return html`
<div

View file

@ -23,7 +23,6 @@ import type { Session } from '../../shared/types.js';
import type { AuthClient } from '../services/auth-client.js';
import './session-card.js';
import { createLogger } from '../utils/logger.js';
import { formatPathForDisplay } from '../utils/path-utils.js';
const logger = createLogger('session-list');
@ -294,7 +293,7 @@ export class SessionList extends LitElement {
}
</div>
<div class="text-xs text-dark-text-muted truncate">
${formatPathForDisplay(session.workingDir)}
${session.displayWorkingDir || session.workingDir}
</div>
</div>
<div class="flex items-center gap-2 flex-shrink-0">

View file

@ -1,23 +1,7 @@
/**
* Path utilities for formatting and displaying paths
* Path utilities for clipboard operations
*/
/**
* Format a file path for display by replacing the home directory with ~
*
* NOTE: This function is deprecated and only used as a fallback.
* The server now provides pre-formatted paths via the displayWorkingDir field.
*
* @param path The absolute path to format
* @returns The formatted path (no transformation applied)
* @deprecated Use displayWorkingDir from server response instead
*/
export function formatPathForDisplay(path: string): string {
// Client-side cannot reliably detect the home directory
// Return the path as-is; server should provide formatted paths
return path;
}
/**
* Copy text to clipboard with fallback for older browsers
* @param text The text to copy