Skip to content

feat: provenance tracking and installed skills listing - #30

Merged
pavelanni merged 12 commits into
mainfrom
feature/installed-skills-listing
Apr 30, 2026
Merged

pavelanni merged 12 commits into
mainfrom
feature/installed-skills-listing

Conversation

@pavelanni

@pavelanni pavelanni commented Apr 30, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Populate provenance.source (OCI ref) and provenance.commit (digest) in skill.yaml during skillctl install
  • Add pkg/installed/ package with Scan() function to discover installed skills across agent directories
  • Add list --installed flag to show installed skills, with --target and -o filters

This is sub-project 1 of #27. The upgrade command (sub-project 2) will be designed separately.

Design decisions

  • Provenance stored in existing skill.yaml Provenance fields (no new files or schema changes)
  • Scan() reads */skill.yaml one level deep in each target directory — fast for typical skill counts
  • Skills without provenance show (local) in the SOURCE column
  • Non-existent target directories silently skipped; malformed skill.yaml warned and skipped

Test plan

  • TestResolveDigest — build image, resolve digest, verify sha256 prefix
  • TestResolveDigestNotFound — error on non-existent ref
  • TestInstallProvenance — build, unpack, write provenance, read back, verify fields
  • TestScan — scan two target dirs with/without provenance, verify results
  • TestScanNonExistentDir — no error on missing directory
  • TestScanMalformedSkillYAML — malformed files skipped
  • go test ./... — all tests pass
  • make lint — 0 issues

Summary by CodeRabbit

Release Notes

  • New Features
    • Added --installed flag to the list command to view installed skills
    • Added --target flag to filter installed skills by specific agent
    • Added --output flag to scan custom directories for installed skills
    • Install command now tracks provenance metadata for installed skills, including source reference and resolved digest

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]>
@coderabbitai

coderabbitai Bot commented Apr 30, 2026 •

Copy link
Copy Markdown

Warning

Rate limit exceeded

@pavelanni has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 50 minutes and 53 seconds before requesting another review.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Enterprise

Run ID: c62ebf73-be0d-420c-9376-a71959ec2134

📥 Commits

Reviewing files that changed from the base of the PR and between 544d88c and 85384e8.

📒 Files selected for processing (3)
  • internal/cli/list.go
  • pkg/installed/installed.go
  • pkg/installed/installed_test.go
📝 Walkthrough

Walkthrough

Introduces design documentation and implementation for adding OCI provenance tracking to installed skills and enabling listing of locally-installed skills via the skillctl CLI. Adds digest resolution to the OCI client, writes provenance metadata during installation, creates a new package to scan installed skills from agent directories, and extends the list command with --installed mode.

Changes

Cohort / File(s) Summary
Documentation & Planning
dev/plans/2026-04-30-installed-skills-listing.md, dev/specs/2026-04-30-installed-skills-listing-design.md
Implementation plan and design specification for provenance tracking and installed-skill listing feature, including control flow, flag interactions, error handling, and test coverage expectations.
OCI Client Enhancements
pkg/oci/pull.go, pkg/oci/resolve.go, pkg/oci/ref_test.go
Exports SkillNameFromRef helper to handle both tag and digest reference formats. Adds new ResolveDigest(ctx, ref) method to look up image descriptors and return digest strings, with error handling for missing images.
Installation Flow with Provenance
internal/cli/install.go, internal/cli/install_test.go
Updates installation process to resolve digest after unpacking and write provenance metadata (Provenance.Source and Provenance.Commit) into skill.yaml. Adds unit test TestNewSkillCardFromRef to validate skill card generation from OCI references.
Installed Skills Scanning Package
pkg/installed/installed.go, pkg/installed/installed_test.go
New package with InstalledSkill type and Scan(targets) function that traverses agent target directories, parses skill.yaml, extracts provenance-derived metadata, silently skips malformed entries with stderr warnings, and returns sorted results.
List Command --installed Extension
internal/cli/list.go
Adds --installed/-i mode to list command with --target/-t and --output/-o flags. Routes to new runListInstalled function that resolves scan directories, calls installed.Scan, and displays tabulated results with name, version, source, and target columns.

Sequence Diagrams

sequenceDiagram
    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
Loading
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
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 11.11% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main changes: adding provenance tracking to install and implementing skill listing functionality for installed skills.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/installed-skills-listing

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.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 50 minutes and 53 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

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]>
@pavelanni
pavelanni marked this pull request as ready for review April 30, 2026 21:47

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 win

Handle registry ports without a tag.

This parser still treats the last : as a tag separator, so a ref like localhost:5000/ns/name becomes localhost instead of name. Because SkillNameFromRef now 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

📥 Commits

Reviewing files that changed from the base of the PR and between fa9fd65 and 544d88c.

📒 Files selected for processing (11)
  • dev/plans/2026-04-30-installed-skills-listing.md
  • dev/specs/2026-04-30-installed-skills-listing-design.md
  • internal/cli/install.go
  • internal/cli/install_test.go
  • internal/cli/list.go
  • pkg/installed/installed.go
  • pkg/installed/installed_test.go
  • pkg/oci/pull.go
  • pkg/oci/ref_test.go
  • pkg/oci/resolve.go
  • pkg/oci/resolve_test.go

Comment thread internal/cli/install.go
Comment on lines +113 to +125
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)
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

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.

Suggested change
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.

Comment thread internal/cli/list.go Resolved
Comment thread pkg/installed/installed_test.go Resolved
Comment thread pkg/installed/installed.go Resolved
- 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]>
@pavelanni
pavelanni merged commit 0494ebf into main Apr 30, 2026
5 checks passed
@pavelanni
pavelanni deleted the feature/installed-skills-listing branch April 30, 2026 22:08
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