Inline and harden tilde path expansion#233
Merged
GrahamCampbell merged 1 commit intomainfrom May 2, 2026
Merged
Conversation
There was a problem hiding this comment.
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.jsthat expands~,~/..., and~<current-user>/..., and throws controlledServerlessErrors on unsafe/unavailable expansion. - Switch create/download/local-template flows to use the internal helper instead of the
untildifypackage. - Add unit tests for
untildifyitself 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.