-
Notifications
You must be signed in to change notification settings - Fork 155
feat(install): SKILL_BUNDLE -- day-0 install parity with npx skills add
#974
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
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
a14ae04
feat: Phase 1 -- SKILL_BUNDLE detection layer
danielmeppiel 3d57932
feat: Phase 2+3 -- SKILL_BUNDLE validation + integration routing
danielmeppiel ce43477
feat: Phase 4 -- --skill CLI flag with full threading
danielmeppiel bbc90c9
feat: Phase 5 -- SKILL_BUNDLE unit tests (31 tests)
danielmeppiel b237316
docs: Phase 6 -- SKILL_BUNDLE CHANGELOG + package-types reference
danielmeppiel 595e35d
chore: revert out-of-scope triage-panel changes
danielmeppiel a2d297b
fix: SKILL_BUNDLE integration bugs + live tests
danielmeppiel d0c53fe
fix(skill-bundle): panel review polish (help text + CHANGELOG framing)
ee8b6c0
chore(changelog): drop incorrect issue reference (was a release PR)
3e1355e
Merge branch 'main' into feat/skill-bundle-shape
danielmeppiel 55e20cc
feat(install): persist --skill subset in apm.yml and lockfile (Phase 11)
danielmeppiel 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
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -4,7 +4,7 @@ sidebar: | |||||||||||||||
| order: 4 | ||||||||||||||||
| --- | ||||||||||||||||
|
|
||||||||||||||||
| APM supports three package layouts, each with distinct install semantics. | ||||||||||||||||
| APM supports four package layouts, each with distinct install semantics. | ||||||||||||||||
| Pick the layout that matches the author's intent -- APM preserves it. | ||||||||||||||||
|
|
||||||||||||||||
| ## Layout summary | ||||||||||||||||
|
|
@@ -13,6 +13,7 @@ Pick the layout that matches the author's intent -- APM preserves it. | |||||||||||||||
| |---|---|---| | ||||||||||||||||
| | `.apm/` (with or without apm.yml) | "I have N independent primitives" | Hoist each primitive into the target's runtime dirs | | ||||||||||||||||
| | `SKILL.md` (alone or with apm.yml -- HYBRID) | "I am one skill bundle" | Copy the whole bundle to `<target>/skills/<name>/` | | ||||||||||||||||
| | `skills/<name>/SKILL.md` (nested) | "I ship many skills in one repo" | Promote each nested skill to `<target>/skills/<name>/` | | ||||||||||||||||
| | `plugin.json` / `.claude-plugin/` | Claude plugin collection | Dissect via plugin artifact mapping | | ||||||||||||||||
|
|
||||||||||||||||
| ## APM package (`.apm/` directory) | ||||||||||||||||
|
|
@@ -96,6 +97,70 @@ agent runtime expects. `apm pack` warns when `apm.yml.description` is | |||||||||||||||
| missing so the human-facing surfaces do not degrade silently while | ||||||||||||||||
| the agent runtime keeps working. | ||||||||||||||||
|
|
||||||||||||||||
| ## Skill collection (`skills/<name>/SKILL.md`) | ||||||||||||||||
|
|
||||||||||||||||
| A multi-skill package following the [agentskills.io](https://agentskills.io) / | ||||||||||||||||
| `npx skills` convention. Each skill lives in its own subdirectory under | ||||||||||||||||
| `skills/` with its own `SKILL.md`. | ||||||||||||||||
|
|
||||||||||||||||
| An optional `apm.yml` at the root provides version metadata and dependencies. | ||||||||||||||||
| If absent, APM synthesizes minimal metadata from the directory name. | ||||||||||||||||
|
|
||||||||||||||||
| ``` | ||||||||||||||||
| azure-skills/ | ||||||||||||||||
| +-- skills/ | ||||||||||||||||
| | +-- cosmos-db/ | ||||||||||||||||
| | | +-- SKILL.md | ||||||||||||||||
| | | +-- examples/ | ||||||||||||||||
| | +-- functions/ | ||||||||||||||||
| | | +-- SKILL.md | ||||||||||||||||
| | +-- aks/ | ||||||||||||||||
| | +-- SKILL.md | ||||||||||||||||
| +-- apm.yml # optional | ||||||||||||||||
| ``` | ||||||||||||||||
|
|
||||||||||||||||
| **What gets installed:** each `skills/<name>/` directory is promoted to | ||||||||||||||||
| `<target>/skills/<name>/`, preserving internal structure. Equivalent to | ||||||||||||||||
| installing N separate CLAUDE_SKILL packages. | ||||||||||||||||
|
|
||||||||||||||||
| **Selective install:** use `--skill <name>` to install only specific skills | ||||||||||||||||
| from the bundle (repeatable). The selection is **persisted** in `apm.yml` | ||||||||||||||||
| (as a `skills:` field) and `apm.lock.yaml` (as `skill_subset`), so | ||||||||||||||||
| subsequent bare `apm install` commands are deterministic. | ||||||||||||||||
| Use `--skill '*'` to reset and install all skills. | ||||||||||||||||
|
|
||||||||||||||||
| ```bash | ||||||||||||||||
| # Install only two skills (persisted to apm.yml): | ||||||||||||||||
| apm install microsoft/azure-skills --skill cosmos-db --skill functions | ||||||||||||||||
|
|
||||||||||||||||
| # Bare reinstall respects the persisted selection: | ||||||||||||||||
| apm install | ||||||||||||||||
|
|
||||||||||||||||
| # Reset to all skills: | ||||||||||||||||
| apm install microsoft/azure-skills --skill '*' | ||||||||||||||||
| ``` | ||||||||||||||||
|
|
||||||||||||||||
| The `apm.yml` entry is promoted to dict form with a `skills:` list: | ||||||||||||||||
|
|
||||||||||||||||
| ```yaml | ||||||||||||||||
| dependencies: | ||||||||||||||||
| apm: | ||||||||||||||||
| - git: microsoft/azure-skills | ||||||||||||||||
| skills: | ||||||||||||||||
| - cosmos-db | ||||||||||||||||
| - functions | ||||||||||||||||
| ``` | ||||||||||||||||
|
|
||||||||||||||||
| **Validation rules:** | ||||||||||||||||
| - Frontmatter `name` field (if present) must match the directory name. | ||||||||||||||||
| - Frontmatter `description` should be present (warning if absent). | ||||||||||||||||
| - All frontmatter values must be ASCII-only. | ||||||||||||||||
|
Comment on lines
+155
to
+157
|
||||||||||||||||
| - Frontmatter `name` field (if present) must match the directory name. | |
| - Frontmatter `description` should be present (warning if absent). | |
| - All frontmatter values must be ASCII-only. | |
| - Frontmatter `name` field (if present) should match the directory name; | |
| mismatches emit a warning. | |
| - Frontmatter `description` should be present (warning if absent). | |
| - Frontmatter values should be ASCII-only; non-ASCII values emit a warning. |
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 |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| """Write-back helper for persisting skill subset selection in apm.yml. | ||
|
|
||
| Single helper ``set_skill_subset_for_entry`` is the one source of truth | ||
| for promoting entries to dict form and setting/clearing the ``skills:`` | ||
| field. Keeps write-back logic isolated and unit-testable. | ||
| """ | ||
|
|
||
| from pathlib import Path | ||
| from typing import List, Optional | ||
|
|
||
| from ..models.dependency.reference import DependencyReference | ||
| from ..utils.yaml_io import dump_yaml, load_yaml | ||
|
|
||
|
|
||
| def set_skill_subset_for_entry( | ||
| manifest_path: Path, | ||
| repo_url: str, | ||
| subset: Optional[List[str]], | ||
| ) -> bool: | ||
| """Promote entry to dict form and set/clear skills: field. | ||
|
|
||
| subset=None or empty list -> remove skills: from entry (reset to all). | ||
| subset=[...] -> set skills: to sorted+deduped list. | ||
|
|
||
| Returns True if file was modified. | ||
| """ | ||
| data = load_yaml(manifest_path) or {} | ||
| deps_section = data.get("dependencies", {}) | ||
| apm_deps = deps_section.get("apm", []) | ||
| if not apm_deps: | ||
| return False | ||
|
|
||
| modified = False | ||
| new_deps = [] | ||
|
|
||
| for entry in apm_deps: | ||
| if _entry_matches(entry, repo_url): | ||
| entry = _apply_subset(entry, subset) | ||
| modified = True | ||
| new_deps.append(entry) | ||
|
|
||
| if not modified: | ||
| return False | ||
|
|
||
| deps_section["apm"] = new_deps | ||
| data["dependencies"] = deps_section | ||
| dump_yaml(data, manifest_path) | ||
| return True | ||
|
|
||
|
|
||
| def _entry_matches(entry, repo_url: str) -> bool: | ||
| """Check if an apm.yml entry matches the given repo_url.""" | ||
| try: | ||
| if isinstance(entry, str): | ||
| ref = DependencyReference.parse(entry) | ||
| elif isinstance(entry, dict): | ||
| ref = DependencyReference.parse_from_dict(entry) | ||
| else: | ||
| return False | ||
| return ref.repo_url == repo_url | ||
| except (ValueError, TypeError, AttributeError, KeyError): | ||
| return False | ||
|
|
||
|
|
||
| def _apply_subset(entry, subset: Optional[List[str]]): | ||
| """Apply skill subset to an entry, promoting to dict form if needed.""" | ||
| # Parse current entry to get canonical info | ||
| if isinstance(entry, str): | ||
| ref = DependencyReference.parse(entry) | ||
| elif isinstance(entry, dict): | ||
| ref = DependencyReference.parse_from_dict(entry) | ||
| else: | ||
| return entry | ||
|
|
||
| # Determine if we should set or clear | ||
| if subset: | ||
| ref.skill_subset = sorted(set(subset)) | ||
| else: | ||
| ref.skill_subset = None | ||
|
|
||
| return ref.to_apm_yml_entry() |
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
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.
The layout summary says an APM package can be just
.apm/"with or without apm.yml", but the current detection/validation logic only classifies APM_PACKAGE when apm.yml is present (and .apm/ is a directory). Please either update the docs to require apm.yml for.apm/packages, or adjust detection if "apm.yml optional" is still intended for.apm/-only packages.See below for a potential fix: