Conversation
There was a problem hiding this comment.
Pull request overview
This pull request adds support for skills.sh by implementing a new kool scripts command that lists available scripts from kool.yml files with optional JSON output for machine consumption.
Changes:
- Adds new
kool scriptscommand with--jsonflag to list scripts from kool.yml files - Upgrades YAML parser to v3 to support comment extraction from kool.yml files
- Adds ScriptDetail structure to capture script names, comments, and commands for AI/agent consumption
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| skills/kool/SKILL.md | New skill documentation for skills.sh integration explaining how AI agents should use kool commands |
| docs/05-Commands-Reference/kool-scripts.md | Command reference documentation for the new kool scripts command |
| docs/05-Commands-Reference/0-kool.md | Updated to include reference to the new kool scripts command |
| core/parser/yml.go | Enhanced YAML parser to use yaml.v3, added comment extraction, and ScriptDetail support |
| core/parser/yml_test.go | Updated tests to validate YAML structure instead of string comparison, added tests for comment parsing |
| core/parser/parser.go | Added ParseAvailableScriptsDetails method to Parser interface |
| core/parser/parser_test.go | Added tests for the new ParseAvailableScriptsDetails functionality |
| core/parser/fake_parser.go | Extended fake parser to support ParseAvailableScriptsDetails for testing |
| commands/scripts.go | New command implementation with JSON and human-readable output modes |
| commands/scripts_test.go | Comprehensive tests for the scripts command including JSON output validation |
| commands/root.go | Registered the new scripts command |
| commands/root_test.go | Updated test to verify scripts command is registered |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // ParseKoolYamlWithDetails decodes the target kool.yml and includes script details. | ||
| func ParseKoolYamlWithDetails(filePath string) (parsed *KoolYaml, err error) { | ||
| var ( | ||
| file *os.File | ||
| raw []byte | ||
| root yaml.Node | ||
| ) | ||
|
|
||
| if file, err = os.OpenFile(filePath, os.O_RDONLY, os.ModePerm); err != nil { | ||
| return | ||
| } | ||
|
|
||
| defer file.Close() | ||
|
|
||
| if raw, err = io.ReadAll(file); err != nil { | ||
| return | ||
| } | ||
|
|
||
| parsed = new(KoolYaml) | ||
| if err = yaml.Unmarshal(raw, parsed); err != nil { | ||
| return | ||
| } | ||
|
|
||
| if err = yaml.Unmarshal(raw, &root); err != nil { | ||
| return | ||
| } | ||
|
|
||
| parsed.ScriptDetails = parseScriptDetails(&root) | ||
| return | ||
| } |
There was a problem hiding this comment.
The ParseKoolYamlWithDetails function reads the file twice and unmarshals the content twice. This could be optimized by reading the file once and unmarshaling once into both the KoolYaml structure and the yaml.Node for comment extraction. Consider refactoring to improve performance, especially for large files.
Adding new
kool run --json,Adding support for https://skills.sh/