Skip to content

Commit af464fe

Browse files
committed
fix: normalize extension skill authors
Assisted-by: OpenAI Codex (model: GPT-5, autonomous)
1 parent 1e6a1d1 commit af464fe

4 files changed

Lines changed: 32 additions & 12 deletions

File tree

‎src/specify_cli/agents.py‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ def render_skill_command(
402402
source_file: str,
403403
project_root: Path,
404404
extension_id: Optional[str] = None,
405-
author: str = "github-spec-kit",
405+
author: object = "github-spec-kit",
406406
) -> str:
407407
"""Render a command override as a SKILL.md file.
408408
@@ -443,15 +443,18 @@ def build_skill_frontmatter(
443443
skill_name: str,
444444
description: str,
445445
source: str,
446-
author: str = "github-spec-kit",
446+
author: object = "github-spec-kit",
447447
) -> dict:
448448
"""Build consistent SKILL.md frontmatter across all skill generators."""
449+
normalized_author = (
450+
"github-spec-kit" if author is None or author == "" else str(author)
451+
)
449452
skill_frontmatter = {
450453
"name": skill_name,
451454
"description": description,
452455
"compatibility": "Requires spec-kit project structure with .specify/ directory",
453456
"metadata": {
454-
"author": author,
457+
"author": normalized_author,
455458
"source": source,
456459
},
457460
}
@@ -621,7 +624,7 @@ def register_commands(
621624
_resolved_dir: Optional[Path] = None,
622625
link_outputs: bool = False,
623626
extension_id: Optional[str] = None,
624-
author: str = "github-spec-kit",
627+
author: object = "github-spec-kit",
625628
) -> List[str]:
626629
"""Register commands for a specific agent.
627630
@@ -1068,7 +1071,7 @@ def register_commands_for_all_agents(
10681071
create_missing_active_skills_dir: bool = False,
10691072
extension_id: Optional[str] = None,
10701073
only_agent: Optional[str] = None,
1071-
author: str = "github-spec-kit",
1074+
author: object = "github-spec-kit",
10721075
) -> Dict[str, List[str]]:
10731076
"""Register commands for all detected agents in the project.
10741077

‎src/specify_cli/extensions/__init__.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1687,7 +1687,7 @@ def _replacement(match: re.Match[str]) -> str:
16871687
skill_name,
16881688
description,
16891689
f"extension:{manifest.id}",
1690-
author=manifest.data["extension"].get("author") or "github-spec-kit",
1690+
author=manifest.data["extension"].get("author"),
16911691
)
16921692
# Preserve the command's argument-hint in the generated skill,
16931693
# mirroring the core template path (ClaudeIntegration.setup injects
@@ -3616,7 +3616,7 @@ def register_commands_for_agent(
36163616
context_note=context_note,
36173617
link_outputs=link_outputs,
36183618
extension_id=manifest.id,
3619-
author=manifest.data["extension"].get("author") or "github-spec-kit",
3619+
author=manifest.data["extension"].get("author"),
36203620
)
36213621

36223622
def register_commands_for_all_agents(
@@ -3640,7 +3640,7 @@ def register_commands_for_all_agents(
36403640
create_missing_active_skills_dir=create_missing_active_skills_dir,
36413641
only_agent=only_agent,
36423642
extension_id=manifest.id,
3643-
author=manifest.data["extension"].get("author") or "github-spec-kit",
3643+
author=manifest.data["extension"].get("author"),
36443644
)
36453645

36463646
def unregister_commands(

‎src/specify_cli/presets/__init__.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2894,7 +2894,7 @@ def _build_extension_skill_restore_index(self) -> Dict[str, Dict[str, Any]]:
28942894
"command_name": cmd_name,
28952895
"source_file": source_file,
28962896
"source": f"extension:{manifest.id}",
2897-
"author": manifest.data["extension"].get("author") or "github-spec-kit",
2897+
"author": manifest.data["extension"].get("author"),
28982898
"extension_id": manifest.id,
28992899
"extension_dir": ext_root,
29002900
}

‎tests/test_extension_skills.py‎

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -447,9 +447,26 @@ def test_skill_md_content_correct(self, skills_project, extension_dir):
447447

448448
@pytest.mark.parametrize("register_commands", [False, True])
449449
@pytest.mark.parametrize("link_commands", [False, True])
450-
@pytest.mark.parametrize("author", ["acme-corp", 'Acme: "Platform"\nTeam', None, ""])
450+
@pytest.mark.parametrize(
451+
("author", "expected_author"),
452+
[
453+
("acme-corp", "acme-corp"),
454+
('Acme: "Platform"\nTeam', 'Acme: "Platform"\nTeam'),
455+
(None, "github-spec-kit"),
456+
("", "github-spec-kit"),
457+
(123, "123"),
458+
(0, "0"),
459+
(False, "False"),
460+
],
461+
)
451462
def test_extension_author_preserved(
452-
self, skills_project, extension_dir, register_commands, link_commands, author
463+
self,
464+
skills_project,
465+
extension_dir,
466+
register_commands,
467+
link_commands,
468+
author,
469+
expected_author,
453470
):
454471
"""Both skill generators retain attribution, including dev output and aliases."""
455472
project_dir, skills_dir = skills_project
@@ -471,7 +488,7 @@ def test_extension_author_preserved(
471488
for name in names:
472489
content = (skills_dir / f"speckit-test-ext-{name}" / "SKILL.md").read_text()
473490
frontmatter = yaml.safe_load(content.split("---", 2)[1])
474-
assert frontmatter["metadata"]["author"] == (author or "github-spec-kit")
491+
assert frontmatter["metadata"]["author"] == expected_author
475492
assert "test-ext" in frontmatter["metadata"]["source"]
476493

477494
def test_skill_md_has_parseable_yaml(self, skills_project, extension_dir):

0 commit comments

Comments
 (0)