Skip to content

fix(cli): preserve sibling home paths in labels - #710

Open
ump45nose wants to merge 1 commit into
langchain-ai:mainfrom
ump45nose:fix/format-home-path-boundary
Open

fix(cli): preserve sibling home paths in labels#710
ump45nose wants to merge 1 commit into
langchain-ai:mainfrom
ump45nose:fix/format-home-path-boundary

Conversation

@ump45nose

Copy link
Copy Markdown

Summary

  • treat the configured home directory as a path boundary instead of a string prefix when formatting the CLI working-directory label
  • keep sibling paths such as /Users/example-backup unchanged when HOME=/Users/example
  • preserve the existing ~ and ~/... output for the home directory and its descendants
  • add a patch changeset

Why

formatCwd currently checks cwd.startsWith(HOME). A path that merely shares the same text prefix is therefore displayed as if it were inside the home directory; for example, /Users/example-backup/openwiki becomes ~-backup/openwiki.

Using path.relative distinguishes real descendants from siblings and also handles platform-specific separators and cross-drive paths.

Testing

  • pnpm exec vitest run test/cli/format.test.ts — 10 passed
  • pnpm exec prettier --check src/cli/format.ts test/cli/format.test.ts .changeset/clean-paths-appear.md
  • pnpm exec eslint src/cli/format.ts test/cli/format.test.ts
  • pnpm run typecheck
  • git diff --check

No dedicated issue; this is a small, self-contained display bug found during a focused CLI audit.

AI-assisted tooling was used during investigation and implementation. I reviewed the final diff and ran the validation listed above.

@changeset-bot

changeset-bot Bot commented Aug 23, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: bfe559c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
openwiki Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant