ask-skills 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 95968a26e22f7fe0aa8c2523f42a1768d551469f7f1fd431f049a9ed7cfdd4fe
4
- data.tar.gz: b7e833ef0093db5c81bc0a0ee8e800534db02cfdad3a33bdb9ba681fec296d15
3
+ metadata.gz: 944cddd3dbc0de89913d1deb45668542f189e154bf3d40cc00468184689aeb38
4
+ data.tar.gz: a200f4181fa77aabc25dc6e1d0e2454d450159e5c64fa0cf7acf698910b8269b
5
5
  SHA512:
6
- metadata.gz: 6faf0bf8bf7b78d5e39d5ef50bbf7391b894d70955bdb07f3941c394721d4a67d7bcbab44f81f72bbb87ac9537df80fa6302b4c021669b12f369e1d886ef65d2
7
- data.tar.gz: 6903279580ab3cc1d2bd0e35a1005da8cbbc3a0005557439ecd2af20e0ca398b2d6fb15b8cea72bf0f38b4cfd657a2c5c95d17af8125a0f1ede1439ec07bc0ae
6
+ metadata.gz: bf049da94d308df2c5bb89164adc488abcc625ef65db0e2e14d73b981c03c9a0fe5d8dcf53b7f4037c437c1d3464a6515edf170ad439e28bf2f2afcf0fc7abb7
7
+ data.tar.gz: '03947665d57b76371ce167641b2b98a7d6e8f0587cc2af11c134a282906322c1f72cc4b7d45972c19738189d50eb45fc23cccffbbf1341a6c14dd663f26e0eff'
data/CHANGELOG.md CHANGED
@@ -1,3 +1,45 @@
1
+ ## [0.3.0] - 2026-07-21
2
+
3
+ ### Added
4
+
5
+ - **New discovery paths** — skills are now discovered from `agents/shared/skills/` and `app/agents/shared/skills/` alongside the legacy `.agents/skills/`. These paths follow the existing `agents/` convention already established for agent definitions.
6
+
7
+ ```
8
+ agents/
9
+ ├── health_check/
10
+ ├── daily_report/
11
+ └── shared/
12
+ ├── tools/ ← shared tools
13
+ └── skills/ ← new: shared skills
14
+ └── rails_debug/SKILL.md
15
+ ```
16
+
17
+ - **Per-agent skills** — `Ask::Skills.discover(agent_dir:)` discovers skills scoped to a specific agent directory. These have highest priority over shared, legacy, user, gem, and built-in skills.
18
+
19
+ ```
20
+ agents/health_check/
21
+ ├── agent.rb
22
+ ├── instructions.md
23
+ └── skills/ ← new: only available to health_check agent
24
+ └── nginx_debug/SKILL.md
25
+ ```
26
+
27
+ - **ask-agent integration** — `Ask::Agent::Session` accepts `agent_dir:` parameter. When creating a session from an agent definition via `Ask::Agent.new("name")`, per-agent skills are auto-discovered and included. No configuration needed.
28
+
29
+ ### Changed
30
+
31
+ - `Ask::Skills.discover` now accepts `agent_dir:` keyword. When provided, the source list starts with the per-agent skills directory (highest priority). Shared project skills from `agents/shared/skills/` and `app/agents/shared/skills/` are included in the default source list.
32
+ - Backward compatible — legacy `.agents/skills/` continues to work.
33
+
34
+ ### Tested
35
+
36
+ - 10 new integration tests: discovery from `agents/shared/skills/`, `app/agents/shared/skills/`, per-agent skills, priority ordering, backward compatibility with `.agents/skills/`, and source list verification.
37
+ - Full suite: 79 tests, 217 assertions — 0 failures.
38
+
39
+ ## [0.2.2] - 2026-06-25
40
+
41
+ ### Changed
42
+ - Infrastructure: rubocop, overcommit, bin/setup, CI matrix, gemspec test, .minitest config.
1
43
  # Changelog
2
44
 
3
45
  ## [0.2.0] - 2026-06-10
@@ -1,5 +1,5 @@
1
1
  module Ask
2
2
  module Skills
3
- VERSION = "0.2.1"
3
+ VERSION = "0.3.0"
4
4
  end
5
5
  end
data/lib/ask/skills.rb CHANGED
@@ -16,33 +16,29 @@ module Ask
16
16
  end
17
17
 
18
18
  class << self
19
- def discover(sources: nil)
20
- Registry.new(sources || default_sources)
19
+ # Discover skills from all configured sources.
20
+ #
21
+ # @param agent_dir [String, nil] optional agent directory to discover
22
+ # per-agent skills from (e.g. "agents/health_check")
23
+ # @param sources [Array<Source::Base>, nil] custom source list
24
+ # @return [Registry]
25
+ def discover(sources: nil, agent_dir: nil)
26
+ all_sources = sources || build_source_list(agent_dir: agent_dir)
27
+ Registry.new(all_sources)
21
28
  end
22
29
 
30
+ # Default sources when no custom sources or agent directory given.
31
+ # Legacy `.agents/skills/` is kept for backward compatibility.
23
32
  def default_sources
24
- [
25
- # Highest priority first — first source wins in Registry
26
- Source::Filesystem.new(project_dir: ".agents/skills"),
27
- Source::Filesystem.new(user_dir: "~/.config/ask/skills"),
28
- Source::Gems.new,
29
- Source::Filesystem.new(dir: builtin_skills_dir),
30
- ]
33
+ build_source_list
31
34
  end
32
35
 
36
+ # Built-in skills that ship with the gem.
33
37
  def builtin_skills_dir
34
- # Skills live in lib/ask/skills/<skill_name>/SKILL.md
35
- # __dir__ in this file (lib/ask/skills.rb) is lib/ask/
36
- # The skill directories are in lib/ask/skills/
37
38
  File.join(__dir__, "skills")
38
39
  end
39
40
 
40
41
  # Load a skill from an arbitrary markdown file path.
41
- # Parses frontmatter if present, otherwise uses the filename as the skill name.
42
- #
43
- # @param path [String] absolute or relative path to a markdown (.md) file
44
- # @return [Skill] a skill with the file's content as instructions
45
- # @raise [Errno::ENOENT] if the file does not exist
46
42
  def load_file(path)
47
43
  path = File.expand_path(path)
48
44
  content = File.read(path)
@@ -61,7 +57,6 @@ module Ask
61
57
  end
62
58
 
63
59
  # Simple frontmatter parsing for skill files.
64
- # Returns a hash of key-value pairs from between --- markers.
65
60
  def parse_frontmatter(content)
66
61
  return {} unless content.start_with?("---\n")
67
62
  end_idx = content.index("\n---\n", 4)
@@ -86,6 +81,38 @@ module Ask
86
81
  body = content[(end_idx + 5)..] || ""
87
82
  body.sub(/\A\n/, "").strip
88
83
  end
84
+
85
+ private
86
+
87
+ # Build the prioritized source list.
88
+ # Order: per-agent → shared project → legacy → user → gems → built-in
89
+ def build_source_list(agent_dir: nil)
90
+ sources = []
91
+
92
+ # Per-agent skills (highest priority — agent-specific first)
93
+ if agent_dir
94
+ per_agent = File.join(agent_dir, "skills")
95
+ sources << Source::Filesystem.new(dir: per_agent)
96
+ end
97
+
98
+ # Shared project skills
99
+ sources << Source::Filesystem.new(project_dir: "agents/shared/skills")
100
+ sources << Source::Filesystem.new(project_dir: "app/agents/shared/skills")
101
+
102
+ # Legacy project skills (backward compat)
103
+ sources << Source::Filesystem.new(project_dir: ".agents/skills")
104
+
105
+ # User-global skills
106
+ sources << Source::Filesystem.new(user_dir: "~/.config/ask/skills")
107
+
108
+ # Gems
109
+ sources << Source::Gems.new
110
+
111
+ # Built-in
112
+ sources << Source::Filesystem.new(dir: builtin_skills_dir)
113
+
114
+ sources
115
+ end
89
116
  end
90
117
  end
91
118
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ask-skills
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kaka Ruto