Repository navigation
feat: provenance tracking and installed skills listing - #30
Conversation
Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Pavel Anni <[email protected]>
Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Pavel Anni <[email protected]>
Add TestInstallProvenance to verify roundtrip of provenance fields through skill.yaml parse/serialize. Modify runInstall to call new writeProvenance helper that resolves digest, reads skill.yaml, populates provenance.source and provenance.commit, and writes it back. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Pavel Anni <[email protected]>
Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Pavel Anni <[email protected]>
Add InstalledSkill type and Scan function to discover skills installed in agent target directories. Scan reads skill.yaml files one level deep, parses metadata, and returns installed skill entries with name, version, source, digest, target, and path fields. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Pavel Anni <[email protected]>
Closes #27 (partially) Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Pavel Anni <[email protected]>
Signed-off-by: Pavel Anni <[email protected]>
Signed-off-by: Pavel Anni <[email protected]>
|
Warning Rate limit exceeded
To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughIntroduces design documentation and implementation for adding OCI provenance tracking to installed skills and enabling listing of locally-installed skills via the Changes
Sequence DiagramssequenceDiagram
participant User as User (CLI)
participant Install as install.RunE
participant OCI as oci.Client
participant Store as OCI Store
participant FS as File System
User->>Install: skillctl install <ref>
Install->>OCI: Unpack(ctx, ref, dest)
OCI->>Store: Extract layers
Store->>FS: Write skill files
FS-->>OCI: skill files written
Install->>OCI: ResolveDigest(ctx, ref)
OCI->>Store: Lookup descriptor by tag
Store-->>OCI: descriptor found
OCI-->>Install: digest (sha256:...)
Install->>FS: Read skill.yaml from dest
FS-->>Install: skill.yaml content
Install->>Install: Parse and update Provenance
Install->>FS: Write updated skill.yaml
FS-->>User: Installation complete
sequenceDiagram
participant User as User (CLI)
participant List as list.RunListInstalled
participant Installed as installed.Scan
participant FS as File System
participant Parser as skillcard.Parse
User->>List: skillctl list --installed
List->>List: Resolve target directories
List->>Installed: Scan(targets)
loop For each target directory
Installed->>FS: Walk skill subdirectories
Installed->>FS: Open skill.yaml
FS-->>Installed: YAML content
Installed->>Parser: Parse(content)
Parser-->>Installed: SkillCard + Provenance
Installed->>Installed: Extract metadata & digest
end
Installed-->>List: []InstalledSkill (sorted)
List->>List: Format table output
List-->>User: Tabulated results
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Review rate limit: 0/1 reviews remaining, refill in 50 minutes and 53 seconds.Comment |
Third-party skills built without skill.yaml would fail during install. Now silently skips provenance when no skill.yaml exists. Signed-off-by: Pavel Anni <[email protected]>
Third-party skills without skill.yaml now get a generated one with name/version derived from the OCI ref, so list --installed can discover them. Signed-off-by: Pavel Anni <[email protected]>
- Export SkillNameFromRef and use it in install to fix digest ref handling (test/skill@sha256:abc → correctly extracts "skill") - Make Scan continue on permission errors instead of aborting - Sort Scan output by (target, name) for deterministic listing - Add tests for newSkillCardFromRef including digest refs Signed-off-by: Pavel Anni <[email protected]>
There was a problem hiding this comment.
Actionable comments posted: 4
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
pkg/oci/pull.go (1)
89-99:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winHandle registry ports without a tag.
This parser still treats the last
:as a tag separator, so a ref likelocalhost:5000/ns/namebecomeslocalhostinstead ofname. BecauseSkillNameFromRefnow drives unpack/install paths, that misroutes any port-qualified ref that omits an explicit tag or digest.♻️ Safer parsing approach
func SkillNameFromRef(ref string) string { name := ref if idx := strings.Index(ref, "@"); idx >= 0 { name = ref[:idx] - } else if idx := strings.LastIndex(ref, ":"); idx >= 0 { - name = ref[:idx] + } else if slash := strings.LastIndex(ref, "/"); slash >= 0 { + if idx := strings.LastIndex(ref[slash+1:], ":"); idx >= 0 { + name = ref[:slash+1+idx] + } } if idx := strings.LastIndex(name, "/"); idx >= 0 { name = name[idx+1:] }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@pkg/oci/pull.go` around lines 89 - 99, SkillNameFromRef is incorrectly treating the last ':' as a tag separator even when it's part of a registry host:port (e.g., localhost:5000/ns/name); update the parsing to only treat ':' as a tag separator when that colon occurs after the last '/' in the reference (i.e., in the name portion), and continue to prefer '@' (digest) if present; specifically, in SkillNameFromRef compute lastSlash := strings.LastIndex(ref, "/"), check for '@' first, otherwise find lastColon := strings.LastIndex(ref, ":") and only trim at lastColon if lastColon > lastSlash, then strip any remaining path prefix by taking substring after lastSlash to return the final name.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@internal/cli/install.go`:
- Around line 113-125: The code currently falls back to synthesizing a SkillCard
via newSkillCardFromRef(ref) when os.Open(skillPath) returns os.IsNotExist,
which hides a missing/failed unpack; change the logic in the os.Open/err branch
so that if os.IsNotExist(err) (or any open error) you return a descriptive error
(e.g., "skill.yaml not found in unpacked image: %w") instead of calling
newSkillCardFromRef, and only use skillcard.Parse(f) when the file is
successfully opened; update references to skillPath, os.Open, skillcard.Parse,
newSkillCardFromRef and the sc variable accordingly.
In `@internal/cli/list.go`:
- Around line 113-120: In resolveListTargets, filepath.Abs is treating a leading
"~" as a literal directory; detect and expand a leading "~" (either "~" or "~/"
prefix) to the current user's home directory (via os.UserHomeDir()), then pass
the expanded path to filepath.Abs and return the map using the original
outputDir as the key and the resolved absolute path as the value; update
resolveListTargets to perform this tilde expansion before calling filepath.Abs
so flags like --output ~/skills resolve to the actual home directory.
In `@pkg/installed/installed_test.go`:
- Around line 92-104: TestScanNonExistentDir uses a hard-coded Unix-only path;
change it to derive a non-existent child path from t.TempDir() instead. In
TestScanNonExistentDir, call t.TempDir(), append a child folder name that does
not exist (e.g., filepath.Join(tmp, "does/not/exist")) and use that value in the
targets map passed to installed.Scan so the test remains platform-independent
while still exercising the missing-dir behavior.
In `@pkg/installed/installed.go`:
- Around line 44-48: The code currently swallows errors from os.Open(skillPath)
and simply continues; change that to emit a warning containing the skillPath (or
entry.Name()) and the err before continuing so permission/partial-install
problems are visible. In the block where you call os.Open(skillPath) (and
currently do `if err != nil { continue }`), replace the silent continue with a
logged warning (using the package logger if one exists, otherwise log.Printf or
fmt.Fprintf(os.Stderr, ...)) that includes the path and err, then continue.
---
Outside diff comments:
In `@pkg/oci/pull.go`:
- Around line 89-99: SkillNameFromRef is incorrectly treating the last ':' as a
tag separator even when it's part of a registry host:port (e.g.,
localhost:5000/ns/name); update the parsing to only treat ':' as a tag separator
when that colon occurs after the last '/' in the reference (i.e., in the name
portion), and continue to prefer '@' (digest) if present; specifically, in
SkillNameFromRef compute lastSlash := strings.LastIndex(ref, "/"), check for '@'
first, otherwise find lastColon := strings.LastIndex(ref, ":") and only trim at
lastColon if lastColon > lastSlash, then strip any remaining path prefix by
taking substring after lastSlash to return the final name.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Enterprise
Run ID: e221fc41-9d04-4077-a35b-1b1df7d81c37
📒 Files selected for processing (11)
dev/plans/2026-04-30-installed-skills-listing.mddev/specs/2026-04-30-installed-skills-listing-design.mdinternal/cli/install.gointernal/cli/install_test.gointernal/cli/list.gopkg/installed/installed.gopkg/installed/installed_test.gopkg/oci/pull.gopkg/oci/ref_test.gopkg/oci/resolve.gopkg/oci/resolve_test.go
| f, err := os.Open(skillPath) | ||
| if err != nil { | ||
| if !os.IsNotExist(err) { | ||
| return fmt.Errorf("opening skill.yaml: %w", err) | ||
| } | ||
| sc = newSkillCardFromRef(ref) | ||
| } else { | ||
| sc, err = skillcard.Parse(f) | ||
| _ = f.Close() | ||
| if err != nil { | ||
| return fmt.Errorf("parsing skill.yaml: %w", err) | ||
| } | ||
| } |
There was a problem hiding this comment.
Fail when skill.yaml is missing instead of inventing one.
The fallback to newSkillCardFromRef(ref) hides a broken unpack and can write an incomplete card back to disk. If the image does not contain skill.yaml, install should surface that as an error rather than synthesizing metadata from the ref.
🛠️ Suggested fix
f, err := os.Open(skillPath)
if err != nil {
- if !os.IsNotExist(err) {
- return fmt.Errorf("opening skill.yaml: %w", err)
- }
- sc = newSkillCardFromRef(ref)
- } else {
- sc, err = skillcard.Parse(f)
- _ = f.Close()
- if err != nil {
- return fmt.Errorf("parsing skill.yaml: %w", err)
- }
+ return fmt.Errorf("opening skill.yaml: %w", err)
}
+ sc, err = skillcard.Parse(f)
+ _ = f.Close()
+ if err != nil {
+ return fmt.Errorf("parsing skill.yaml: %w", err)
+ }📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| f, err := os.Open(skillPath) | |
| if err != nil { | |
| if !os.IsNotExist(err) { | |
| return fmt.Errorf("opening skill.yaml: %w", err) | |
| } | |
| sc = newSkillCardFromRef(ref) | |
| } else { | |
| sc, err = skillcard.Parse(f) | |
| _ = f.Close() | |
| if err != nil { | |
| return fmt.Errorf("parsing skill.yaml: %w", err) | |
| } | |
| } | |
| f, err := os.Open(skillPath) | |
| if err != nil { | |
| return fmt.Errorf("opening skill.yaml: %w", err) | |
| } | |
| sc, err = skillcard.Parse(f) | |
| _ = f.Close() | |
| if err != nil { | |
| return fmt.Errorf("parsing skill.yaml: %w", err) | |
| } |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@internal/cli/install.go` around lines 113 - 125, The code currently falls
back to synthesizing a SkillCard via newSkillCardFromRef(ref) when
os.Open(skillPath) returns os.IsNotExist, which hides a missing/failed unpack;
change the logic in the os.Open/err branch so that if os.IsNotExist(err) (or any
open error) you return a descriptive error (e.g., "skill.yaml not found in
unpacked image: %w") instead of calling newSkillCardFromRef, and only use
skillcard.Parse(f) when the file is successfully opened; update references to
skillPath, os.Open, skillcard.Parse, newSkillCardFromRef and the sc variable
accordingly.
- Expand ~ in list --output path before resolving - Use t.TempDir() for non-existent path test (cross-platform) - Warn on skill.yaml permission errors instead of silent skip Signed-off-by: Pavel Anni <[email protected]>
Summary
provenance.source(OCI ref) andprovenance.commit(digest) inskill.yamlduringskillctl installpkg/installed/package withScan()function to discover installed skills across agent directorieslist --installedflag to show installed skills, with--targetand-ofiltersThis is sub-project 1 of #27. The upgrade command (sub-project 2) will be designed separately.
Design decisions
skill.yamlProvenance fields (no new files or schema changes)Scan()reads*/skill.yamlone level deep in each target directory — fast for typical skill counts(local)in the SOURCE columnTest plan
TestResolveDigest— build image, resolve digest, verify sha256 prefixTestResolveDigestNotFound— error on non-existent refTestInstallProvenance— build, unpack, write provenance, read back, verify fieldsTestScan— scan two target dirs with/without provenance, verify resultsTestScanNonExistentDir— no error on missing directoryTestScanMalformedSkillYAML— malformed files skippedgo test ./...— all tests passmake lint— 0 issuesSummary by CodeRabbit
Release Notes
--installedflag to thelistcommand to view installed skills--targetflag to filter installed skills by specific agent--outputflag to scan custom directories for installed skills