ai-devkit
ai-devkit copied to clipboard
fix(skill): local-folder registry gets git-cloned instead of used in place
Symptom
ai-devkit skill add-registry <id> . inside a git repo git-clones the source instead of using it in place. The clone lands in ~/.ai-devkit/skills/<id>/ at HEAD — untracked files and uncommitted edits are missing, and skill add (link mode) then symlinks to the stale clone instead of the live folder.
Root cause
normalizeRegistrySourceInput (skill-registry-source.ts) decides git-vs-local by string shape, not filesystem:
parseLocalRegistryPathonly acceptsfile:URLsisPathShorthandregex/^\.\.?[\\/]/requires./..plus a separator — bare.(and..,~/x) falls through- Any relative path without
.//..//~prefix (e.g.myfolder,skills) is returned unchanged →cacheRegistry→prepareGitRegistry→git clone <dir>— which succeeds on local dirs → clone instead of link
Secondary: . is stored raw in .ai-devkit.json — resolves against process.cwd() at call time, not the config's project root → skill update/find from another cwd resolves to the wrong directory.
Proposed fix
Decide by filesystem, not string shape:
- Keep
file:/absolute/.//..//~/→ local; extend shorthand to bare.,..,~ - For scheme-less strings,
path.resolve(baseDir, value)→ exists +isDirectory()→ local (returnfile://absolute URL — cwd-independent stored value, fixes the relative-path resolution bug for free) - Only URL-shaped or non-existent paths go to git
- Secondary: accept
./skills-style sources or clearer error ("source must be parent of skills/")
Repro
cd <git-repo>/jarvis # skills at ./skills/<name>/SKILL.md
ai-devkit skill add-registry jarvis/skills .
# → "Cloning jarvis/skills..." — should have been a live local source