ai-devkit icon indicating copy to clipboard operation
ai-devkit copied to clipboard

fix(skill): local-folder registry gets git-cloned instead of used in place

Open codeaholicguy opened this issue 1 month ago • 0 comments

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:

  • parseLocalRegistryPath only accepts file: URLs
  • isPathShorthand regex /^\.\.?[\\/]/ 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:

  1. Keep file:/absolute/.//..//~/ → local; extend shorthand to bare ., .., ~
  2. For scheme-less strings, path.resolve(baseDir, value) → exists + isDirectory() → local (return file:// absolute URL — cwd-independent stored value, fixes the relative-path resolution bug for free)
  3. Only URL-shaped or non-existent paths go to git
  4. 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

codeaholicguy avatar Oct 24 '26 07:10 codeaholicguy