Skip to content

fix(update): resolve dot-dir subdirs in batch update before stale classification - #262

Merged
runkids merged 1 commit into
runkids:mainfrom
masonc15:fix/batch-update-dotdir-stale
Aug 6, 2026
Merged

fix(update): resolve dot-dir subdirs in batch update before stale classification#262
runkids merged 1 commit into
runkids:mainfrom
masonc15:fix/batch-update-dotdir-stale

Conversation

@masonc15

@masonc15 masonc15 commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Type

  • Bug fix
  • Small improvement (docs, typo, minor refactor)
  • Feature proposal (proposals/ only — see CONTRIBUTING.md)

Linked Issue

Closes #261

Checklist

  • I've read CONTRIBUTING.md
  • Tests included and passing (make check) — for code changes
  • No unrelated changes in the diff
  • Scope is focused — one concern per PR

Summary

update --all falsely reports a skill as stale (deleted upstream) when the upstream repo ships the skill only inside a target dot-dir (.claude/, .codex/, .github/, ...). Batch update looks up meta.Subdir in the discovery map, but discovery deliberately skips TargetDotDirs, so the lookup can never succeed for such skills — and --prune would then trash a healthy install. Full analysis in #261.

Fix

On a discovery-map miss, UpdateSkillsFromRepo now falls back to lookupSkillSubdir, a direct SKILL.md stat of the subdir in the cloned repo (mirroring the resolveSubdir fast path that makes single-skill update <name> succeed for the same skill). Only a genuinely absent path is still reported as skill path %q not found in repository and classified stale. The fallback rejects ../absolute subdirs and requires SKILL.md to exist, and fills SkillInfo license/description from frontmatter like regular discovery does.

Tests

  • TestLookupSkillSubdir — resolves a skill under .claude/skills/, rejects missing dirs, dirs without SKILL.md, and traversal/absolute inputs.
  • TestUpdateSkillsFromRepo_SkillOnlyInTargetDotDirNotStale — end-to-end batch update from a file:// repo whose only skill lives in .claude/skills/; asserts no error and the skill installs. Fails on main with the stale misclassification, passes with the fix.

Note: the existing dot-dir e2e coverage (ai_docs/tests/discovery_skip_target_dotdirs_runbook.md) only exercises repos that also carry skills outside the dot-dirs, so this case was previously untested.

Batch update looks up each skill's subdir in the discovery map, but
discovery deliberately skips target dot-dirs (.claude, .codex, ...) to
avoid counting target-synced copies as source skills. A skill installed
from such a subdir therefore never appears in the map and is falsely
reported as stale (deleted upstream), steering users toward --prune on a
healthy skill. Fall back to a direct SKILL.md stat in the cloned repo --
mirroring the single-skill update path -- before declaring the path
missing.

Fixes runkids#261
@runkids
runkids self-requested a review August 6, 2026 02:55
@runkids
runkids marked this pull request as ready for review August 6, 2026 02:56
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@runkids

runkids commented Aug 6, 2026

Copy link
Copy Markdown
Owner

Thanks!

@runkids
runkids merged commit 325c9bb into runkids:main Aug 6, 2026
7 checks passed
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.

bug(update): update --all falsely reports skill stale when repo ships skills only inside target dot-dirs

2 participants