Skip to content

Fix leading space in code-link directory names from emoji project names#602

Open
huntercaron wants to merge 1 commit intomainfrom
huntercaron/codelink-trim-names
Open

Fix leading space in code-link directory names from emoji project names#602
huntercaron wants to merge 1 commit intomainfrom
huntercaron/codelink-trim-names

Conversation

@huntercaron
Copy link
Collaborator

@huntercaron huntercaron commented Mar 23, 2026

Description

Project names with emoji prefixes like "🧠 Logic" produce directory names with a leading space. The emoji gets replaced with hyphens by the sanitization regex, then boundary hyphen removal strips those hyphens — revealing a space that wasn't at the boundary before. Adding a second trim() after boundary hyphen removal fixes this.

Changelog

  • Fixed code-link CLI creating directories with leading spaces when project names contain emoji prefixes

Testing

  • Emoji-prefixed project names produce clean directory names
    • Create a project named "🧠 Logic" and sync via code-link
    • Verify the directory is named "Logic" (no leading space)
  • Existing name sanitization still works
    • Run npx vitest run src/utils/project.test.ts — all 10 tests pass

Add second trim() after boundary hyphen removal in toDirectoryName()
to handle spaces revealed when emoji-replacement hyphens are stripped.
Copilot AI review requested due to automatic review settings March 23, 2026 10:31
@github-actions github-actions bot added the Auto submit to Marketplace on merge Submits the plugin to the marketplace after merging label Mar 23, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a directory-name sanitization edge case in the code-link CLI where emoji-prefixed project names could result in a leading space after hyphen-boundary cleanup.

Changes:

  • Add an extra trim() in toDirectoryName() after stripping boundary hyphens to remove newly-exposed leading/trailing whitespace.
  • Add tests covering emoji-prefixed project names to prevent regressions.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
packages/code-link-cli/src/utils/project.ts Ensures directory names are re-trimmed after boundary hyphen removal to avoid leading spaces from emoji prefixes.
packages/code-link-cli/src/utils/project.test.ts Adds unit tests validating emoji-prefixed project names sanitize to clean directory names.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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

Labels

Auto submit to Marketplace on merge Submits the plugin to the marketplace after merging

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants