-
Notifications
You must be signed in to change notification settings - Fork 29
Allow synced skill resources to run via shell #1551
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Aaronontheweb
merged 3 commits into
netclaw-dev:dev
from
Aaronontheweb:issue-1537-skill-shell-execution
Jul 2, 2026
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,8 +14,8 @@ namespace Netclaw.Actors.Skills; | |
| /// <summary> | ||
| /// Discovers skills under the skills directory using the AgentSkills.io | ||
| /// directory layout: each skill is a directory containing <c>SKILL.md</c> | ||
| /// with YAML frontmatter. Optional subdirectories (<c>scripts/</c>, | ||
| /// <c>references/</c>, <c>assets/</c>) hold progressive-disclosure resources. | ||
| /// with YAML frontmatter. Additional files under the skill directory are | ||
| /// progressive-disclosure resources. | ||
| /// </summary> | ||
| public static partial class SkillScanner | ||
| { | ||
|
|
@@ -28,11 +28,6 @@ public static partial class SkillScanner | |
| /// </summary> | ||
| public const string SystemCategory = ".system"; | ||
|
|
||
| /// <summary> | ||
| /// Standard subdirectories within a skill directory that contain resources. | ||
| /// </summary> | ||
| private static readonly string[] ResourceSubdirectories = ["scripts", "references", "assets"]; | ||
|
|
||
| [GeneratedRegex(@"^#\s+(.+)$", RegexOptions.Multiline)] | ||
| private static partial Regex HeadingRegex(); | ||
|
|
||
|
|
@@ -571,47 +566,40 @@ private static (bool HasSubagentMetadata, string? Subagent, string? Error) Parse | |
| } | ||
|
|
||
| /// <summary> | ||
| /// Enumerates resource files in standard subdirectories of a skill directory. | ||
| /// Enumerates non-root resource files under a skill directory. | ||
| /// Returns null if no resources are found. | ||
| /// </summary> | ||
| private static IReadOnlyList<string>? EnumerateResources(string skillDirectory, string rootDirectory, List<SkillScanIssue> issues, bool allowSymlinks = false) | ||
| { | ||
| List<string>? resources = null; | ||
| var canonicalRoot = PathUtility.Normalize(rootDirectory); | ||
|
|
||
| foreach (var subDirName in ResourceSubdirectories) | ||
| string[] files; | ||
| try | ||
| { | ||
| var subDir = Path.Combine(skillDirectory, subDirName); | ||
| if (!Directory.Exists(subDir)) | ||
| continue; | ||
| files = Directory.GetFiles(skillDirectory, "*", SearchOption.AllDirectories); | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. find all files in this skill directory |
||
| } | ||
| catch (Exception ex) when (ex is IOException or UnauthorizedAccessException) | ||
| { | ||
| issues.Add(new SkillScanIssue( | ||
| Path: skillDirectory, | ||
| Kind: SkillScanIssueKind.ResourceEnumerationFailed, | ||
| Message: $"Failed to enumerate resources: {ex.Message}")); | ||
| return null; | ||
| } | ||
|
|
||
| if (ValidateCanonicalPath(subDir, canonicalRoot, issues, $"resource directory '{subDirName}'", allowSymlinks) is null) | ||
| return null; | ||
| foreach (var file in files.OrderBy(static f => f, StringComparer.Ordinal)) | ||
| { | ||
| if (PathUtility.AreEquivalentPaths(file, Path.Combine(skillDirectory, SkillFileName))) | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. validate symlinks et al |
||
| continue; | ||
|
|
||
| string[] files; | ||
| try | ||
| { | ||
| files = Directory.GetFiles(subDir, "*", SearchOption.AllDirectories); | ||
| } | ||
| catch (Exception ex) when (ex is IOException or UnauthorizedAccessException) | ||
| { | ||
| issues.Add(new SkillScanIssue( | ||
| Path: subDir, | ||
| Kind: SkillScanIssueKind.ResourceEnumerationFailed, | ||
| Message: $"Failed to enumerate resources: {ex.Message}")); | ||
| if (ValidateCanonicalPath(file, canonicalRoot, issues, "resource file", allowSymlinks) is null) | ||
| return null; | ||
| } | ||
|
|
||
| foreach (var file in files) | ||
| { | ||
| if (ValidateCanonicalPath(file, canonicalRoot, issues, "resource file", allowSymlinks) is null) | ||
| return null; | ||
|
|
||
| var relativePath = Path.GetRelativePath(skillDirectory, file) | ||
| .Replace(Path.DirectorySeparatorChar, '/'); | ||
| resources ??= []; | ||
| resources.Add(relativePath); | ||
| } | ||
| var relativePath = Path.GetRelativePath(skillDirectory, file) | ||
| .Replace(Path.DirectorySeparatorChar, '/'); | ||
| resources ??= []; | ||
| resources.Add(relativePath); | ||
| } | ||
|
|
||
| return resources; | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than scan static skill resource directories, we enumerate them on the fly now since the AgentSkills.io standard doesn't mandate strictly these ones.