Skip to content

fix(skill): detect local registry sources by filesystem, not string shape - #420

Merged
codeaholicguy merged 3 commits into
mainfrom
fix/skill-registry-local-dir
Oct 24, 2026
Merged

codeaholicguy merged 3 commits into
mainfrom
fix/skill-registry-local-dir

Conversation

@codeaholicguy

Copy link
Copy Markdown
Owner

Summary

Fixes skill add-registry git-cloning local folder sources instead of using them in place.

normalizeRegistrySourceInput decided git-vs-local by string shape: only file: URLs, absolute paths, and .//../ shorthands counted as local. Bare ., ~/x, and plain relative dirs (myfolder) fell through to git clone — which succeeds on local dirs, so a git repo at . produced a stale HEAD clone in ~/.ai-devkit/skills/<id>/ that link-mode installs then pointed at (untracked files and uncommitted edits missing).

Fix: after file:-URL and scheme checks (protocol://, user@host: scp-style), a scheme-less value that path.resolves to a real directory is treated as local → stored as an absolute file:// URL. Only URL-shaped or nonexistent paths reach git.

Bonus: the stored file:// absolute path also fixes relative sources resolving against call-time cwd instead of the config's project root.

Refs #419

Test plan

  • normalizeRegistrySourceInput cases: ., .., ~, ~/x, bare nested, file://, https://, git@, nonexistent path → git fallback
  • skill-registry-source.test.ts — 11/11
  • skill command tests — 47/47
  • tsc --noEmit + oxfmt clean
  • Bug reproduced live on 0.71.0 (. inside a git repo → git clone . → HEAD clone) before fix

…hape

A scheme-less source resolving to a real directory is now treated as a
local registry (file:// URL) instead of a git URL. Fixes add-registry
git-cloning '.', 'myfolder', '~/x' etc. into the skill cache — git clone
succeeds on local dirs, so a git repo at '.' produced a stale HEAD clone
that link-mode installs then pointed at.

Stored value is an absolute file:// URL, so relative-source resolution
no longer depends on call-time cwd.

Refs #419
@codeaholicguy
codeaholicguy merged commit 5e0b67d into main Oct 24, 2026
8 checks passed
@codeaholicguy
codeaholicguy deleted the fix/skill-registry-local-dir branch October 24, 2026 20:12
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.

1 participant