diff --git a/docs/integrations/index.md b/docs/integrations/index.md index 3a686b22c4..096e0dda78 100644 --- a/docs/integrations/index.md +++ b/docs/integrations/index.md @@ -21,6 +21,19 @@ The documentation commonly uses `/speckit.*` notation, but your agent may use hyphenated skills, `$` skills, or another native form. See your integration's page and the [command invocation comparison](cli.md#command-invocation). +## Generated Skill Versions + +Generated `SKILL.md` frontmatter includes `metadata.version` when the supplying +component's version is known. Core skills record the generating Specify CLI +version; extension and preset skills record their respective component versions. +The value is a string, and the key is omitted when the version is unknown. + +Existing metadata, including `metadata.author` and `metadata.source`, keeps its +meaning. Skills regenerated through an existing operation, including restoration +after a preset is removed, record the resulting component's version. Skills +already on disk are not rewritten automatically, and this metadata does not +perform stale-skill detection or upgrades. + ## Adding Another Agent In an initialized project, use diff --git a/src/specify_cli/agents.py b/src/specify_cli/agents.py index 8f3668812f..db086c7489 100644 --- a/src/specify_cli/agents.py +++ b/src/specify_cli/agents.py @@ -408,6 +408,7 @@ def render_skill_command( project_root: Path, extension_id: Optional[str] = None, author: object = "github-spec-kit", + version: str | None = None, ) -> str: """Render a command override as a SKILL.md file. @@ -419,7 +420,8 @@ def render_skill_command( Spec-kit currently has multiple SKILL.md generators (template packaging, init-time conversion, and extension/preset overrides). Keep the skill frontmatter keys aligned (name/description/compatibility/metadata, with - metadata.author and metadata.source subkeys) to avoid drift across agents. + metadata.author, metadata.source, and optional metadata.version subkeys) + to avoid drift across agents. """ if not isinstance(frontmatter, dict): frontmatter = {} @@ -439,6 +441,7 @@ def render_skill_command( description, f"{source_id}:{source_file}", author=author, + version=version, ) return self.render_frontmatter(skill_frontmatter) + "\n" + body @@ -449,6 +452,7 @@ def build_skill_frontmatter( description: str, source: str, author: object = "github-spec-kit", + version: str | None = None, ) -> dict: """Build consistent SKILL.md frontmatter across all skill generators.""" normalized_author = ( @@ -463,6 +467,8 @@ def build_skill_frontmatter( "source": source, }, } + if version and version != "unknown": + skill_frontmatter["metadata"]["version"] = version return skill_frontmatter @staticmethod @@ -651,6 +657,7 @@ def register_commands( link_outputs: bool = False, extension_id: Optional[str] = None, author: object = "github-spec-kit", + version: str | None = None, ) -> List[str]: """Register commands for a specific agent. @@ -670,6 +677,7 @@ def register_commands( to a normal file write when symlinks are unavailable. extension_id: Extension id when rendering extension-owned commands. author: Author attributed in generated skill metadata. + version: Supplying component version, omitted from skills if unknown. Returns: List of registered command names @@ -838,6 +846,7 @@ def register_commands( project_root, extension_id=extension_id, author=author, + version=version, ) elif agent_config["format"] == "markdown": body = self.resolve_skill_placeholders( @@ -930,6 +939,7 @@ def register_commands( project_root, extension_id=extension_id, author=author, + version=version, ) elif agent_config["format"] == "markdown": alias_output = self.render_markdown_command( @@ -964,6 +974,7 @@ def register_commands( project_root, extension_id=extension_id, author=author, + version=version, ) alias_file = ( @@ -1122,6 +1133,7 @@ def register_commands_for_all_agents( extension_id: Optional[str] = None, only_agent: Optional[str] = None, author: object = "github-spec-kit", + version: str | None = None, ) -> Dict[str, List[str]]: """Register commands for all detected agents in the project. @@ -1140,6 +1152,7 @@ def register_commands_for_all_agents( creation fails. extension_id: Extension id when rendering extension-owned commands. author: Author attributed in generated skill metadata. + version: Supplying component version, omitted from skills if unknown. only_agent: If set, restrict registration to this single agent while keeping all detection and recovery safeguards (#2948). @@ -1248,6 +1261,7 @@ def register_commands_for_all_agents( link_outputs=link_outputs, extension_id=extension_id, author=author, + version=version, ) if registered: results[agent_name] = registered diff --git a/src/specify_cli/extensions/__init__.py b/src/specify_cli/extensions/__init__.py index c66ecaa65f..eb809c59bd 100644 --- a/src/specify_cli/extensions/__init__.py +++ b/src/specify_cli/extensions/__init__.py @@ -1688,6 +1688,7 @@ def _replacement(match: re.Match[str]) -> str: description, f"extension:{manifest.id}", author=manifest.data["extension"].get("author"), + version=manifest.version, ) # Preserve the command's argument-hint in the generated skill, # mirroring the core template path (ClaudeIntegration.setup injects @@ -4393,6 +4394,7 @@ def register_commands_for_agent( link_outputs=link_outputs, extension_id=manifest.id, author=manifest.data["extension"].get("author"), + version=manifest.version, ) def register_commands_for_all_agents( @@ -4417,6 +4419,7 @@ def register_commands_for_all_agents( only_agent=only_agent, extension_id=manifest.id, author=manifest.data["extension"].get("author"), + version=manifest.version, ) def unregister_commands( diff --git a/src/specify_cli/integrations/alquimia/__init__.py b/src/specify_cli/integrations/alquimia/__init__.py index 271451749d..e38b9b4b35 100644 --- a/src/specify_cli/integrations/alquimia/__init__.py +++ b/src/specify_cli/integrations/alquimia/__init__.py @@ -56,10 +56,11 @@ def _render_skill( return f"---\n{frontmatter_text}\n---\n\n{body.strip()}\n" def _build_skill_fm(self, name: str, description: str, source: str) -> dict: + from specify_cli import get_speckit_version from specify_cli.agents import CommandRegistrar return CommandRegistrar.build_skill_frontmatter( - self.key, name, description, source + self.key, name, description, source, version=get_speckit_version() ) @staticmethod diff --git a/src/specify_cli/integrations/base.py b/src/specify_cli/integrations/base.py index 6bbc59e2da..89b7dab9a5 100644 --- a/src/specify_cli/integrations/base.py +++ b/src/specify_cli/integrations/base.py @@ -2158,6 +2158,29 @@ def post_process_skill_content(self, content: str) -> str: invocation_prefix = get_invocation_prefix(self.key, True) return self._inject_hook_command_note(content, invocation_prefix) + def _render_core_skill_frontmatter( + self, skill_name: str, description: str, source: str + ) -> str: + """Render shared core provenance with the native skills' quoted layout.""" + from specify_cli import get_speckit_version + from specify_cli.agents import CommandRegistrar + + frontmatter = CommandRegistrar.build_skill_frontmatter( + self.key, skill_name, description, source, + version=get_speckit_version(), + ) + lines = [ + f"{key}: {yaml_quote(value)}" + for key, value in frontmatter.items() + if key != "metadata" + ] + lines.append("metadata:") + lines.extend( + f" {key}: {yaml_quote(value)}" + for key, value in frontmatter["metadata"].items() + ) + return "\n".join(lines) + def setup( self, project_root: Path, @@ -2270,17 +2293,12 @@ def setup( if not description: description = f"Spec Kit: {command_name} workflow" - # Build SKILL.md with manually formatted frontmatter (stable - # double-quoted values). yaml_quote escapes newlines and control - # characters that a plain quoted f-string cannot carry. + frontmatter_text = self._render_core_skill_frontmatter( + skill_name, description, f"templates/commands/{src_file.name}" + ) skill_content = ( f"---\n" - f"name: {yaml_quote(skill_name)}\n" - f"description: {yaml_quote(description)}\n" - f"compatibility: {yaml_quote('Requires spec-kit project structure with .specify/ directory')}\n" - f"metadata:\n" - f" author: {yaml_quote('github-spec-kit')}\n" - f" source: {yaml_quote('templates/commands/' + src_file.name)}\n" + f"{frontmatter_text}\n" f"---\n" f"{processed_body}" ) diff --git a/src/specify_cli/integrations/claude/__init__.py b/src/specify_cli/integrations/claude/__init__.py index 641480fe82..c0b055d573 100644 --- a/src/specify_cli/integrations/claude/__init__.py +++ b/src/specify_cli/integrations/claude/__init__.py @@ -260,9 +260,10 @@ def _render_skill(self, template_name: str, frontmatter: dict[str, Any], body: s return f"---\n{frontmatter_text}\n---\n\n{body.strip()}\n" def _build_skill_fm(self, name: str, description: str, source: str) -> dict: + from specify_cli import get_speckit_version from specify_cli.agents import CommandRegistrar return CommandRegistrar.build_skill_frontmatter( - self.key, name, description, source + self.key, name, description, source, version=get_speckit_version() ) @staticmethod diff --git a/src/specify_cli/integrations/generic/__init__.py b/src/specify_cli/integrations/generic/__init__.py index 0dbe598ab7..937bd8a340 100644 --- a/src/specify_cli/integrations/generic/__init__.py +++ b/src/specify_cli/integrations/generic/__init__.py @@ -14,7 +14,7 @@ import yaml -from ..base import IntegrationOption, MarkdownIntegration, SkillsIntegration, yaml_quote +from ..base import IntegrationOption, MarkdownIntegration, SkillsIntegration from ..manifest import IntegrationManifest @@ -201,14 +201,12 @@ def _build_skill_content( ) description = frontmatter.get("description") or f"Spec Kit: {command_name} workflow" + frontmatter_text = _GenericSkillsHelper()._render_core_skill_frontmatter( + skill_name, description, f"templates/commands/{src_file.name}" + ) skill_content = ( f"---\n" - f"name: {yaml_quote(skill_name)}\n" - f"description: {yaml_quote(description)}\n" - f"compatibility: {yaml_quote('Requires spec-kit project structure with .specify/ directory')}\n" - f"metadata:\n" - f" author: {yaml_quote('github-spec-kit')}\n" - f" source: {yaml_quote('templates/commands/' + src_file.name)}\n" + f"{frontmatter_text}\n" f"---\n" f"{processed_body}" ) diff --git a/src/specify_cli/integrations/hermes/__init__.py b/src/specify_cli/integrations/hermes/__init__.py index 5b3d1977cc..a2370ea9a6 100644 --- a/src/specify_cli/integrations/hermes/__init__.py +++ b/src/specify_cli/integrations/hermes/__init__.py @@ -19,7 +19,7 @@ import yaml -from ..base import IntegrationOption, SkillsIntegration, yaml_quote +from ..base import IntegrationOption, SkillsIntegration from ..manifest import IntegrationManifest @@ -184,18 +184,12 @@ def setup( if not description: description = f"Spec Kit: {command_name} workflow" - # Build SKILL.md with manually formatted frontmatter. yaml_quote - # escapes newlines and control characters that a plain quoted - # f-string cannot carry. + frontmatter_text = self._render_core_skill_frontmatter( + skill_name, description, f"templates/commands/{src_file.name}" + ) skill_content = ( f"---\n" - f"name: {yaml_quote(skill_name)}\n" - f"description: {yaml_quote(description)}\n" - f"compatibility: " - f"{yaml_quote('Requires spec-kit project structure with .specify/ directory')}\n" - f"metadata:\n" - f" author: {yaml_quote('github-spec-kit')}\n" - f" source: {yaml_quote('templates/commands/' + src_file.name)}\n" + f"{frontmatter_text}\n" f"---\n" f"{processed_body}" ) diff --git a/src/specify_cli/integrations/vibe/__init__.py b/src/specify_cli/integrations/vibe/__init__.py index 9bfcb4d509..c01ceddfdd 100644 --- a/src/specify_cli/integrations/vibe/__init__.py +++ b/src/specify_cli/integrations/vibe/__init__.py @@ -168,9 +168,10 @@ def _render_skill(self, template_name: str, frontmatter: dict[str, Any], body: s return f"---\n{frontmatter_text}\n---\n\n{body.strip()}\n" def _build_skill_fm(self, name: str, description: str, source: str) -> dict: + from specify_cli import get_speckit_version from specify_cli.agents import CommandRegistrar return CommandRegistrar.build_skill_frontmatter( - self.key, name, description, source + self.key, name, description, source, version=get_speckit_version() ) @staticmethod diff --git a/src/specify_cli/presets/_manager_commands.py b/src/specify_cli/presets/_manager_commands.py index d171eb28dd..459a6985f7 100644 --- a/src/specify_cli/presets/_manager_commands.py +++ b/src/specify_cli/presets/_manager_commands.py @@ -230,6 +230,7 @@ def _register_commands( self.project_root, create_missing_active_skills_dir=True, only_agent=active_agent, + version=manifest.version, ) def register_enabled_presets_for_agent(self, agent_name: str) -> None: diff --git a/src/specify_cli/presets/_manager_skills.py b/src/specify_cli/presets/_manager_skills.py index 169f6d9215..74343f1c2a 100644 --- a/src/specify_cli/presets/_manager_skills.py +++ b/src/specify_cli/presets/_manager_skills.py @@ -607,6 +607,7 @@ def _build_extension_skill_restore_index(self) -> Dict[str, Dict[str, Any]]: "source_file": source_file, "source": f"extension:{manifest.id}", "author": manifest.data["extension"].get("author"), + "version": manifest.version, "extension_id": manifest.id, "extension_dir": ext_root, } @@ -802,6 +803,7 @@ def _register_skills( target_skill_name, enhanced_desc, f"preset:{manifest.id}", + version=manifest.version, ) registrar.apply_argument_hint(frontmatter, frontmatter_data, integration) frontmatter_text = dump_frontmatter(frontmatter_data) @@ -1330,7 +1332,7 @@ def _unregister_skills_in_dir( Returns: Skill names whose files were restored or removed. """ - from .. import SKILL_DESCRIPTIONS + from .. import SKILL_DESCRIPTIONS, get_speckit_version from ..integrations import get_integration from ..shared_infra import _write_shared_text @@ -1465,6 +1467,7 @@ def _unregister_skills_in_dir( skill_name, enhanced_desc, f"templates/commands/{short_name}.md", + version=get_speckit_version(), ) registrar.apply_argument_hint(frontmatter, frontmatter_data, integration) frontmatter_text = dump_frontmatter(frontmatter_data) @@ -1524,6 +1527,7 @@ def _unregister_skills_in_dir( frontmatter.get("description", f"Extension command: {command_name}"), extension_restore["source"], author=extension_restore.get("author", "github-spec-kit"), + version=extension_restore.get("version"), ) registrar.apply_argument_hint(frontmatter, frontmatter_data, integration) frontmatter_text = dump_frontmatter(frontmatter_data) diff --git a/tests/integrations/test_skill_frontmatter_quoting.py b/tests/integrations/test_skill_frontmatter_quoting.py index c7e7ebb0e8..9efc362439 100644 --- a/tests/integrations/test_skill_frontmatter_quoting.py +++ b/tests/integrations/test_skill_frontmatter_quoting.py @@ -9,8 +9,10 @@ from pathlib import Path +import pytest import yaml +from specify_cli.agents import CommandRegistrar from specify_cli.integrations import get_integration from specify_cli.integrations.base import yaml_quote from specify_cli.integrations.manifest import IntegrationManifest @@ -61,6 +63,84 @@ def _fake_templates(tmp_path: Path, body: str) -> Path: return templates +class TestSkillVersionProvenance: + @pytest.mark.parametrize("all_agents", [False, True]) + def test_registration_without_version_omits_it_for_aliases(self, tmp_path, all_agents): + source = _fake_templates( + tmp_path, "---\ndescription: Example\n---\n\nBody of the command.\n" + ) + skills_dir = tmp_path / ".agents" / "skills" + skills_dir.mkdir(parents=True) + commands = [{ + "name": "speckit.example.plan", + "file": "plan.md", + "aliases": ["speckit.example.alias"], + }] + registrar = CommandRegistrar(tmp_path) + if all_agents: + registrar.register_commands_for_all_agents( + commands, "example", source, tmp_path, only_agent="codex", + ) + else: + registrar.register_commands("codex", commands, "example", source, tmp_path) + for name in ("speckit-example-plan", "speckit-example-alias"): + skill_file = skills_dir / name / "SKILL.md" + parsed = _parse_frontmatter_line_anchored(skill_file) + assert parsed["metadata"] == { + "author": "github-spec-kit", + "source": "example:plan.md", + } + assert parsed["name"] == name + assert parsed["description"] == "Example" + assert "Body of the command." in skill_file.read_text(encoding="utf-8") + + @pytest.mark.parametrize("version", ["1.0", "2.3.4-rc.1+build.5", None, "", "unknown"]) + def test_optional_version_preserves_existing_frontmatter(self, version): + baseline = CommandRegistrar.build_skill_frontmatter( + "claude", "speckit-plan", MULTILINE, "preset:example", author="Acme" + ) + actual = CommandRegistrar.build_skill_frontmatter( + "claude", "speckit-plan", MULTILINE, "preset:example", + author="Acme", version=version, + ) + parsed = yaml.safe_load(CommandRegistrar.render_frontmatter(actual).split("---", 2)[1]) + if version and version != "unknown": + assert parsed["metadata"].pop("version") == version + else: + assert "version" not in parsed["metadata"] + assert parsed == baseline + + @pytest.mark.parametrize("agent", ["agy", "claude", "alquimia", "vibe", "copilot", "hermes", "generic"]) + @pytest.mark.parametrize("version", ["8.7.6", "unknown"]) + def test_core_setup_records_generator_version(self, tmp_path, monkeypatch, agent, version): + monkeypatch.setattr("specify_cli.get_speckit_version", lambda: version) + monkeypatch.setattr(Path, "home", lambda: tmp_path / "home") + integration = get_integration(agent) + templates = _fake_templates(tmp_path, HOSTILE_TEMPLATE) + monkeypatch.setattr( + "specify_cli.integrations.base.IntegrationBase.shared_commands_dir", + lambda self: templates, + ) + options: dict[str, object] = {"skills": True} + if agent == "generic": + options["commands_dir"] = ".custom/skills" + created = integration.setup( + tmp_path, IntegrationManifest(agent, tmp_path), parsed_options=options, + ) + skills = [path for path in created if path.name == "SKILL.md"] + assert skills + for path in skills: + parsed = _parse_frontmatter_line_anchored(path) + if version == "unknown": + assert "version" not in parsed["metadata"] + else: + assert parsed["metadata"]["version"] == version + assert parsed["metadata"]["author"] == "github-spec-kit" + assert parsed["metadata"]["source"] == "templates/commands/plan.md" + assert parsed["description"] == MULTILINE + assert "Body of the command." in path.read_text(encoding="utf-8") + + class TestYamlQuote: def test_simple_value_keeps_plain_double_quoted_form(self): assert yaml_quote("speckit-plan") == '"speckit-plan"' diff --git a/tests/specify_cli/integrations/test_installed_adapters.py b/tests/specify_cli/integrations/test_installed_adapters.py index 1b097d7eb2..46d6072225 100644 --- a/tests/specify_cli/integrations/test_installed_adapters.py +++ b/tests/specify_cli/integrations/test_installed_adapters.py @@ -3676,7 +3676,7 @@ def snapshot_then_interleave(): return scoped_registrar monkeypatch.setattr(manager, "_command_registrar", snapshot_then_interleave) - manifest = SimpleNamespace(id="sample", templates=[{ + manifest = SimpleNamespace(id="sample", version="1.0.0", templates=[{ "type": "command", "name": "speckit.sample", "file": "command.md", }]) manager._register_commands(manifest, source) @@ -3760,7 +3760,7 @@ def load_second(): ) else: manager = PresetManager(first) - manifest = SimpleNamespace(id="sample", templates=[{ + manifest = SimpleNamespace(id="sample", version="1.0.0", templates=[{ "type": "command", "name": "speckit.sample", "file": "command.md", }]) manager._register_commands(manifest, source) diff --git a/tests/specify_cli/presets/test_manager_skills.py b/tests/specify_cli/presets/test_manager_skills.py index 124e0bb3bb..b592423183 100644 --- a/tests/specify_cli/presets/test_manager_skills.py +++ b/tests/specify_cli/presets/test_manager_skills.py @@ -41,6 +41,12 @@ def test_skill_overridden_on_preset_install(self, project_dir, temp_dir): content = skill_file.read_text() assert "preset:self-test" in content, "Skill should reference preset source" assert "disable-model-invocation: false" in content + from specify_cli.presets import PresetManifest + + preset_manifest = PresetManifest( + project_dir / ".specify" / "presets" / "self-test" / "preset.yml" + ) + assert yaml.safe_load(content.split("---", 2)[1])["metadata"]["version"] == preset_manifest.version # Verify it was recorded in registry, keyed by the active agent metadata = manager.registry.get("self-test") @@ -402,6 +408,7 @@ def test_reconcile_override_skill_resolves_command_refs(self, project_dir, temp_ assert "override:speckit.specify" in content, "skill should be restored from the project override" assert "__SPECKIT_COMMAND_" not in content, "raw command token leaked on reconcile" assert "/speckit-plan" in content + assert "version" not in yaml.safe_load(content.split("---", 2)[1])["metadata"] def test_extension_restore_resolves_command_refs(self, project_dir, temp_dir): """Extension-backed skill restore must resolve command tokens (issue #2717). @@ -617,8 +624,10 @@ def test_skill_not_updated_without_init_options(self, project_dir, temp_dir): file_content = skill_file.read_text() assert "untouched" in file_content - def test_skill_restored_on_preset_remove(self, project_dir, temp_dir): + @pytest.mark.parametrize("version", ["9.8.7", "unknown"]) + def test_skill_restored_on_preset_remove(self, project_dir, temp_dir, monkeypatch, version): """When a preset is removed, skills should be restored from core templates.""" + monkeypatch.setattr("specify_cli.get_speckit_version", lambda: version) self._write_init_options(project_dir, ai="claude") skills_dir = project_dir / ".claude" / "skills" self._create_skill(skills_dir, "speckit-specify") @@ -646,6 +655,11 @@ def test_skill_restored_on_preset_remove(self, project_dir, temp_dir): assert "preset:self-test" not in content, "Preset content should be gone" assert "templates/commands/specify.md" in content, "Should reference core template" assert "disable-model-invocation: false" in content + metadata = yaml.safe_load(content.split("---", 2)[1])["metadata"] + if version == "unknown": + assert "version" not in metadata + else: + assert metadata["version"] == version def test_skill_restored_on_preset_remove_without_project_core_templates(self, project_dir): """Removing a preset must restore core skills even when the project @@ -678,6 +692,9 @@ def test_skill_restored_on_preset_remove_without_project_core_templates(self, pr assert "preset:self-test" not in content assert "templates/commands/specify.md" in content assert "Create or update the feature specification" in content + from specify_cli import get_speckit_version + + assert yaml.safe_load(content.split("---", 2)[1])["metadata"]["version"] == get_speckit_version() def test_extension_wins_over_bundled_core_on_preset_remove( self, project_dir, monkeypatch @@ -743,6 +760,7 @@ def test_extension_wins_over_bundled_core_on_preset_remove( assert "source: extension:fakeext" in content assert "extension:fakeext specify body" in content assert "templates/commands/specify.md" not in content + assert "version" not in yaml.safe_load(content.split("---", 2)[1])["metadata"] def test_skill_restored_on_remove_resolves_script_placeholders(self, project_dir): """Core restore should resolve {SCRIPT}/{ARGS} placeholders like other skill paths.""" @@ -870,7 +888,7 @@ def test_extension_skill_restored_on_preset_remove(self, project_dir, temp_dir): "id": "fakeext", "name": "Fake Extension", "author": "acme-corp", - "version": "1.0.0", + "version": "2.3.4", "description": "Test", }, "requires": {"speckit_version": ">=0.1.0"}, @@ -937,6 +955,7 @@ def test_extension_skill_restored_on_preset_remove(self, project_dir, temp_dir): assert "# Fakeext Cmd Skill" in content assert yaml.safe_load(content.split("---", 2)[1])["metadata"]["author"] == "acme-corp" + assert yaml.safe_load(content.split("---", 2)[1])["metadata"]["version"] == "2.3.4" def test_skill_composed_over_extension_base_rewrites_subdir_paths( self, project_dir, temp_dir @@ -2004,6 +2023,10 @@ def test_remove_higher_priority_skills_only_preset_restores_lower_preset( temp_dir, "skills-preset-b", "speckit.specify", "Preset B", "preset B body", ) + manifest_path = preset_b_dir / "preset.yml" + manifest = yaml.safe_load(manifest_path.read_text()) + manifest["preset"]["version"] = "3.2.1" + manifest_path.write_text(yaml.safe_dump(manifest)) manager = PresetManager(project_dir) # Lower priority number = higher precedence. @@ -2025,6 +2048,7 @@ def test_remove_higher_priority_skills_only_preset_restores_lower_preset( "not fall back to core/extension content (#2948)" ) assert "preset:skills-preset-a" not in content + assert yaml.safe_load(content.split("---", 2)[1])["metadata"]["version"] == "3.2.1" def test_remove_reconciles_skill_for_every_historical_agent( self, project_dir, temp_dir diff --git a/tests/test_extension_skills.py b/tests/test_extension_skills.py index 3f65585a30..5f5d16a13e 100644 --- a/tests/test_extension_skills.py +++ b/tests/test_extension_skills.py @@ -474,6 +474,7 @@ def test_extension_author_preserved( data = yaml.safe_load(manifest_path.read_text()) if author is not None: data["extension"]["author"] = author + data["extension"]["version"] = "2.3.4" data["provides"]["commands"][0]["aliases"] = ["speckit.test-ext.greet"] manifest_path.write_text(yaml.safe_dump(data)) @@ -490,6 +491,7 @@ def test_extension_author_preserved( frontmatter = yaml.safe_load(content.split("---", 2)[1]) assert frontmatter["metadata"]["author"] == expected_author assert "test-ext" in frontmatter["metadata"]["source"] + assert frontmatter["metadata"]["version"] == "2.3.4" def test_skill_md_has_parseable_yaml(self, skills_project, extension_dir): """Generated SKILL.md should contain valid, parseable YAML frontmatter.""" diff --git a/tests/test_extensions.py b/tests/test_extensions.py index bb7df29a1a..9f7a4997df 100644 --- a/tests/test_extensions.py +++ b/tests/test_extensions.py @@ -1797,11 +1797,13 @@ def fake_register_all( extension_id=None, only_agent=None, author="github-spec-kit", + version=None, ): captured["create_missing_active_skills_dir"] = ( create_missing_active_skills_dir ) captured["extension_id"] = extension_id + captured["version"] = version return {} monkeypatch.setattr( @@ -1816,6 +1818,7 @@ def fake_register_all( assert captured["create_missing_active_skills_dir"] is False assert captured["extension_id"] == manifest.id + assert captured["version"] == manifest.version def test_install_duplicate(self, extension_dir, project_dir): """Test installing already installed extension."""