From 59253a611f39e2bbaa815e3d55aea9cef32a8ef6 Mon Sep 17 00:00:00 2001 From: CleverThis Date: Thu, 23 Apr 2026 23:09:23 +0000 Subject: [PATCH] fix(showcase): add missing step definitions for CLI version/info/diagnostics showcase The feature file cli_version_info_diagnostics_showcase.feature was added without corresponding Behave step definitions, causing unit_tests CI to fail with AmbiguousStep errors. This commit adds the step definitions file and updates the feature file step text to avoid conflicts with existing steps in execution_environment_steps.py. --- ..._version_info_diagnostics_showcase.feature | 26 +-- ...version_info_diagnostics_showcase_steps.py | 157 ++++++++++++++++++ 2 files changed, 170 insertions(+), 13 deletions(-) create mode 100644 features/steps/cli_version_info_diagnostics_showcase_steps.py diff --git a/features/cli_version_info_diagnostics_showcase.feature b/features/cli_version_info_diagnostics_showcase.feature index 251064674..97301c07c 100644 --- a/features/cli_version_info_diagnostics_showcase.feature +++ b/features/cli_version_info_diagnostics_showcase.feature @@ -6,20 +6,20 @@ Feature: CLI Version, Info, and Diagnostics Commands Showcase Documentation Scenario: Verify showcase documentation exists Given the showcase documentation file exists at "docs/showcase/cli-tools/cli-version-info-diagnostics.md" When I read the documentation file - Then it should contain "Understanding CleverAgents CLI Version, Info, and Diagnostics Commands" - And it should contain "version" command explanation - And it should contain "info" command explanation - And it should contain "diagnostics" command explanation - And it should contain "Fast-Path vs Regular Command Behavior" section - And it should contain JSON output examples - And it should contain YAML output examples + Then the documentation should contain "Understanding CleverAgents CLI Version, Info, and Diagnostics Commands" + And the documentation should contain the "version" command explanation + And the documentation should contain the "info" command explanation + And the documentation should contain the "diagnostics" command explanation + And the documentation should contain the "Fast-Path vs Regular Command Behavior" section + And the documentation should contain JSON output examples + And the documentation should contain YAML output examples Scenario: Verify showcase is registered in examples.json Given the showcase examples registry exists at "docs/showcase/examples.json" When I read the examples registry - Then it should contain an entry for "Understanding CleverAgents CLI Version, Info, and Diagnostics Commands" - And the entry should have category "cli-tools" - And the entry should have path "cli-tools/cli-version-info-diagnostics.md" - And the entry should list version, info, and diagnostics commands - And the entry should have complexity "beginner" - And the entry should have educational_value "high" + Then the registry should contain an entry for "Understanding CleverAgents CLI Version, Info, and Diagnostics Commands" + And the registry entry should have category "cli-tools" + And the registry entry should have path "cli-tools/cli-version-info-diagnostics.md" + And the registry entry should list version, info, and diagnostics commands + And the registry entry should have complexity "beginner" + And the registry entry should have educational_value "high" diff --git a/features/steps/cli_version_info_diagnostics_showcase_steps.py b/features/steps/cli_version_info_diagnostics_showcase_steps.py new file mode 100644 index 000000000..e051560b7 --- /dev/null +++ b/features/steps/cli_version_info_diagnostics_showcase_steps.py @@ -0,0 +1,157 @@ +"""Step definitions for CLI version/info/diagnostics showcase documentation tests.""" + +import json +from pathlib import Path + +from behave import given, then, when + + +@given('the showcase documentation file exists at "{file_path}"') +def step_showcase_doc_file_exists(context, file_path: str) -> None: + """Verify the showcase documentation file exists at the given path.""" + context.doc_file_path = Path(file_path) + assert context.doc_file_path.exists(), ( + f"Showcase documentation file not found: {file_path}" + ) + + +@when("I read the documentation file") +def step_read_documentation_file(context) -> None: + """Read the showcase documentation file content.""" + context.doc_content = context.doc_file_path.read_text(encoding="utf-8") + + +@then('the documentation should contain "{text}"') +def step_doc_should_contain_text(context, text: str) -> None: + """Verify the documentation content contains the given text.""" + assert text in context.doc_content, ( + f"Expected text '{text}' not found in documentation file" + ) + + +@then('the documentation should contain the "version" command explanation') +def step_doc_contains_version_explanation(context) -> None: + """Verify the documentation contains a version command explanation.""" + assert "version" in context.doc_content.lower(), ( + "Documentation does not contain 'version' command explanation" + ) + + +@then('the documentation should contain the "info" command explanation') +def step_doc_contains_info_explanation(context) -> None: + """Verify the documentation contains an info command explanation.""" + assert "info" in context.doc_content.lower(), ( + "Documentation does not contain 'info' command explanation" + ) + + +@then('the documentation should contain the "diagnostics" command explanation') +def step_doc_contains_diagnostics_explanation(context) -> None: + """Verify the documentation contains a diagnostics command explanation.""" + assert "diagnostics" in context.doc_content.lower(), ( + "Documentation does not contain 'diagnostics' command explanation" + ) + + +@then('the documentation should contain the "Fast-Path vs Regular Command Behavior" section') +def step_doc_contains_fast_path_section(context) -> None: + """Verify the documentation contains the Fast-Path vs Regular Command Behavior section.""" + assert "Fast-Path" in context.doc_content, ( + "Documentation does not contain 'Fast-Path vs Regular Command Behavior' section" + ) + + +@then("the documentation should contain JSON output examples") +def step_doc_contains_json_examples(context) -> None: + """Verify the documentation contains JSON output examples.""" + assert "```json" in context.doc_content, ( + "Documentation does not contain JSON output examples (```json code block)" + ) + + +@then("the documentation should contain YAML output examples") +def step_doc_contains_yaml_examples(context) -> None: + """Verify the documentation contains YAML output examples.""" + assert "```yaml" in context.doc_content, ( + "Documentation does not contain YAML output examples (```yaml code block)" + ) + + +@given('the showcase examples registry exists at "{file_path}"') +def step_examples_registry_exists(context, file_path: str) -> None: + """Verify the showcase examples registry file exists at the given path.""" + context.registry_file_path = Path(file_path) + assert context.registry_file_path.exists(), ( + f"Showcase examples registry not found: {file_path}" + ) + + +@when("I read the examples registry") +def step_read_examples_registry(context) -> None: + """Read and parse the showcase examples registry JSON file.""" + content = context.registry_file_path.read_text(encoding="utf-8") + context.registry_data = json.loads(content) + context.registry_examples = context.registry_data.get("examples", []) + + +@then('the registry should contain an entry for "{title}"') +def step_registry_contains_entry(context, title: str) -> None: + """Verify the registry contains an entry with the given title.""" + matching = [e for e in context.registry_examples if e.get("title") == title] + assert len(matching) > 0, ( + f"No registry entry found with title '{title}'. " + f"Available titles: {[e.get('title') for e in context.registry_examples]}" + ) + context.current_entry = matching[0] + + +@then('the registry entry should have category "{category}"') +def step_entry_has_category(context, category: str) -> None: + """Verify the current registry entry has the expected category.""" + actual = context.current_entry.get("category") + assert actual == category, ( + f"Expected category '{category}', got '{actual}'" + ) + + +@then('the registry entry should have path "{path}"') +def step_entry_has_path(context, path: str) -> None: + """Verify the current registry entry has the expected path.""" + actual = context.current_entry.get("path") + assert actual == path, ( + f"Expected path '{path}', got '{actual}'" + ) + + +@then("the registry entry should list version, info, and diagnostics commands") +def step_entry_lists_commands(context) -> None: + """Verify the current registry entry lists version, info, and diagnostics commands.""" + commands = context.current_entry.get("commands", []) + commands_str = " ".join(commands).lower() + assert "version" in commands_str, ( + f"'version' command not found in entry commands: {commands}" + ) + assert "info" in commands_str, ( + f"'info' command not found in entry commands: {commands}" + ) + assert "diagnostics" in commands_str, ( + f"'diagnostics' command not found in entry commands: {commands}" + ) + + +@then('the registry entry should have complexity "{complexity}"') +def step_entry_has_complexity(context, complexity: str) -> None: + """Verify the current registry entry has the expected complexity.""" + actual = context.current_entry.get("complexity") + assert actual == complexity, ( + f"Expected complexity '{complexity}', got '{actual}'" + ) + + +@then('the registry entry should have educational_value "{value}"') +def step_entry_has_educational_value(context, value: str) -> None: + """Verify the current registry entry has the expected educational_value.""" + actual = context.current_entry.get("educational_value") + assert actual == value, ( + f"Expected educational_value '{value}', got '{actual}'" + )