fix(cli): accept source prefixes in the wizard package prompt - #88
Merged
harlan-zw merged 2 commits intoAug 13, 2026
Merged
Conversation
The wizard passed manually entered packages through unparsed, so the `npm:` prefix documented for `skilld add` reached `getCacheDir` as a literal package name and aborted the run. Normalise with `parseSkillInput` as `add` does, and direct non-npm sources to `skilld add`. `resolvePkgDir` treats an unusable name as a cache miss rather than propagating the validation error, and rejects an empty name instead of resolving to `node_modules`.
Preserve requested npm tags when the wizard strips source prefixes. Validate package names before probing node_modules so traversal inputs cannot escape the package directory.
Collaborator
|
awesome, thanks! |
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.
Problem
The interactive wizard rejects the source prefixes documented for
skilld add, with a stack trace rather than a message:addnormalises its inputs:The wizard does not:
npm:unlighthousetravels as a literal package name untilgetCacheDirrejects it, and the throw ends the run.Change
Both manual-entry prompts normalise through
parseSkillInput.npm:prefixed and bare names resolve; other sources report where they belong:resolvePkgDirno longer propagates the validation error. It probes for an optional cache hit, so a namegetCacheDirwill not accept is a miss. Traversal is still rejected; it just no longer aborts a sync from a read path. An empty name also returns null rather than resolving to<cwd>/node_modules, whichjoinproduces for an empty segment.Coverage
test/unit/pkg-dir-probe.test.tscoversresolvePkgDirreturning null fornpm:vue,gh:owner/repo,../escape, and an empty name, andgetShippedSkillsreporting none for the same.Docs
README notes that the documented prefixes work in the wizard prompt, and the prompt placeholder shows one.