Skip to content

Improve checkSymlinkSafety error message for ~/.agents/ #392

Description

@williamthorsen

Problem

When ~/.agents/ is a directory symlink, checkSymlinkSafety throws a terse error directing the user to remove the symlink. It doesn't warn that other files inside the symlinked directory will become inaccessible, leading to silent data loss.

Context

Encountered during the #377 migration. The configs.macos side of the migration (configs.macos#177) will eliminate the directory symlink, but until that runs, users hitting this error need actionable guidance.

Solution

Update the error message in checkSymlinkSafety to list the contents of the symlinked directory (up to 5 entries, with a count of remaining entries if more). This shows the user exactly what's at risk without hardcoding any assumptions about the directory.

Use readdirSync on the symlink path, which naturally follows the link.

Acceptance criteria

  • Error message lists up to 5 directory entries, with ... and N more when there are more than 5
  • Error message advises the user to preserve files before removing the symlink
  • Graceful handling if reading the directory fails (fall back to the warning without a file list)
  • Existing tests updated; new behavior covered by tests

Metadata

Metadata

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions