Skip to content

Inline and harden tilde path expansion#233

Merged
GrahamCampbell merged 1 commit intomainfrom
remove-untildify
May 2, 2026
Merged

Inline and harden tilde path expansion#233
GrahamCampbell merged 1 commit intomainfrom
remove-untildify

Conversation

@GrahamCampbell
Copy link
Copy Markdown
Contributor

Remove the untildify dependency and replace it with an internal helper that fails closed when home paths cannot be safely expanded. Add coverage to ensure expansion failures happen before copy/download side effects.

Copy link
Copy Markdown

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

This PR removes the external untildify dependency and replaces it with an internal lib/utils/untildify helper that performs strict (fail-closed) tilde expansion, with added unit coverage ensuring failures occur before any copy/download side effects.

Changes:

  • Add internal lib/utils/untildify.js that expands ~, ~/..., and ~<current-user>/..., and throws controlled ServerlessErrors on unsafe/unavailable expansion.
  • Switch create/download/local-template flows to use the internal helper instead of the untildify package.
  • Add unit tests for untildify itself and for early-failure behavior in create/download flows.

Reviewed changes

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

Show a summary per file
File Description
lib/utils/untildify.js New internal tilde expansion helper with caching + controlled errors.
lib/utils/download-template-from-repo.js Swap external untildify for internal helper for download target resolution.
lib/utils/create-from-local-template.js Swap external untildify for internal helper for local template resolution.
lib/plugins/create/create.js Swap external untildify for internal helper for --template-path and --path.
test/unit/lib/utils/untildify.test.js New unit coverage for expansion behavior, caching, and error cases.
test/unit/lib/utils/download-template-from-repo.test.js Add coverage for ~ download paths and early failure before side effects.
test/unit/lib/utils/create-from-local-template.test.js Add coverage for ~ template paths and early failure before side effects.
test/unit/lib/plugins/create/create.test.js Add coverage for ~ paths in create local template flow and early failure behavior.
package.json Remove untildify dependency.

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

@GrahamCampbell GrahamCampbell merged commit 3537b14 into main May 2, 2026
8 checks passed
@GrahamCampbell GrahamCampbell deleted the remove-untildify branch May 2, 2026 11:52
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.

2 participants