From e21abc7dc9423f5ed7db38e91a273f9294462763 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EC=A7=80=ED=9B=88?= <155136709+dlwlgnsrhy@users.noreply.github.com> Date: Wed, 18 Nov 2026 17:33:14 +0900 Subject: [PATCH 1/2] fix(extensions): report missing command files on install List only commands with installed source files. Report missing sources by manifest command name and path, including files excluded by .extensionignore. Assisted-by: OpenAI Codex (model: GPT-6, autonomous) --- src/specify_cli/extensions/command_add.py | 20 +++++++-- .../extensions/test_command_add.py | 45 +++++++++++++++++++ 2 files changed, 62 insertions(+), 3 deletions(-) diff --git a/src/specify_cli/extensions/command_add.py b/src/specify_cli/extensions/command_add.py index a9d981687b..44ce44029c 100644 --- a/src/specify_cli/extensions/command_add.py +++ b/src/specify_cli/extensions/command_add.py @@ -318,10 +318,24 @@ def extension_add( for warning in manifest.warnings: console.print(f"\n[yellow]⚠ Compatibility warning:[/yellow] {_escape_markup(str(warning))}") - console.print("\n[bold cyan]Provided commands:[/bold cyan]") + extension_dir = manager.extensions_dir / manifest.id + provided_commands = [] + missing_commands = [] for cmd in manifest.commands: - cmd_name = _commands._registered_command_name(project_root, cmd['name']) - console.print(f" • {_escape_markup(str(cmd_name))} - {_escape_markup(str(cmd.get('description', '')))}") + if (extension_dir / cmd["file"]).is_file(): + provided_commands.append(cmd) + else: + missing_commands.append(cmd) + + if provided_commands: + console.print("\n[bold cyan]Provided commands:[/bold cyan]") + for cmd in provided_commands: + cmd_name = _commands._registered_command_name(project_root, cmd["name"]) + console.print(f" • {_escape_markup(str(cmd_name))} - {_escape_markup(str(cmd.get('description', '')))}") + if missing_commands: + console.print("\n[yellow]Warning:[/yellow] Command files missing:") + for cmd in missing_commands: + console.print(f" • {_escape_markup(cmd['name'])} ({_escape_markup(cmd['file'])})") # Report agent skills registration reg_meta = manager.registry.get(manifest.id) diff --git a/tests/specify_cli/extensions/test_command_add.py b/tests/specify_cli/extensions/test_command_add.py index 2fc9a2b522..78eafa0529 100644 --- a/tests/specify_cli/extensions/test_command_add.py +++ b/tests/specify_cli/extensions/test_command_add.py @@ -40,6 +40,51 @@ class TestExtensionAddCLI: """CLI tests for ``specify extension add``.""" + @pytest.mark.parametrize( + ("agent", "skills_dir"), + [("codex", ".agents/skills"), ("claude", ".claude/skills")], + ) + @pytest.mark.parametrize("case", ["complete", "missing-one", "missing-all", "ignored"]) + def test_add_dev_reports_missing_command_files( + self, extension_dir, project_dir, valid_manifest_data, monkeypatch, agent, skills_dir, case + ): + provides = valid_manifest_data["provides"] + provides["commands"].append({ + "name": "speckit.test-ext.second", + "file": "commands/second.md", + "description": "Second test command", + }) + (extension_dir / "extension.yml").write_text( + yaml.safe_dump(valid_manifest_data), encoding="utf-8" + ) + if case in {"complete", "ignored"}: + (extension_dir / "commands/second.md").write_text( + "---\ndescription: Second test command\n---\n\nSecond command\n", + encoding="utf-8", + ) + if case == "ignored": + (extension_dir / ".extensionignore").write_text("commands/second.md\n", encoding="utf-8") + if case == "missing-all": + (extension_dir / "commands/hello.md").unlink() + + write_listing_project_options(project_dir, {"ai": agent, "ai_skills": True}) + monkeypatch.chdir(project_dir) + result = CliRunner().invoke(app, ["extension", "add", "--dev", str(extension_dir)]) + output = strip_ansi(result.output) + + assert result.exit_code == 0, output + assert "Extension installed successfully" in output + assert ("Provided commands:" in output) == (case != "missing-all") + assert ("Command files missing:" in output) == (case != "complete") + for command in provides["commands"]: + name = command["name"] + filename = command["file"] + skill_name = name.replace(".", "-") + available = case == "complete" or (case != "missing-all" and name.endswith(".hello")) + assert (project_dir / skills_dir / skill_name / "SKILL.md").is_file() == available + assert (f"• {skill_name} - " in output) == available + assert (f"• {name} ({filename})" in output) == (not available) + @pytest.mark.parametrize( ("config", "warns"), [ From 01e90ae15935e9c2742d73482e1aacd504114d4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EC=A7=80=ED=9B=88?= <155136709+dlwlgnsrhy@users.noreply.github.com> Date: Thu, 19 Nov 2026 08:23:29 +0900 Subject: [PATCH 2/2] test(extensions): restore working directory before fixture cleanup Limit the working directory change to the CLI invocation so the temporary extension project can be removed during fixture teardown on Windows. Assisted-by: OpenAI Codex (model: GPT-6.2, autonomous) --- tests/specify_cli/extensions/test_command_add.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/specify_cli/extensions/test_command_add.py b/tests/specify_cli/extensions/test_command_add.py index 78eafa0529..47c2a26164 100644 --- a/tests/specify_cli/extensions/test_command_add.py +++ b/tests/specify_cli/extensions/test_command_add.py @@ -68,8 +68,9 @@ def test_add_dev_reports_missing_command_files( (extension_dir / "commands/hello.md").unlink() write_listing_project_options(project_dir, {"ai": agent, "ai_skills": True}) - monkeypatch.chdir(project_dir) - result = CliRunner().invoke(app, ["extension", "add", "--dev", str(extension_dir)]) + with monkeypatch.context() as project_context: + project_context.chdir(project_dir) + result = CliRunner().invoke(app, ["extension", "add", "--dev", str(extension_dir)]) output = strip_ansi(result.output) assert result.exit_code == 0, output