diff --git a/features/steps/agent_skills_loader_steps.py b/features/steps/agent_skills_loader_steps.py index 208fa673b..c1b449a6d 100644 --- a/features/steps/agent_skills_loader_steps.py +++ b/features/steps/agent_skills_loader_steps.py @@ -179,7 +179,9 @@ def step_global_scope_with_skill(context: Context) -> None: if not hasattr(context, "global_scope_dir"): context.global_scope_dir = Path(tempfile.mkdtemp(prefix="global_scope_")) context._cleanup_handlers.append( - lambda: __import__("shutil").rmtree(context.global_scope_dir, ignore_errors=True) + lambda: __import__("shutil").rmtree( + context.global_scope_dir, ignore_errors=True + ) ) # Create a skill folder inside the global scope @@ -195,7 +197,9 @@ def step_project_scope_with_skill(context: Context) -> None: if not hasattr(context, "project_scope_dir"): context.project_scope_dir = Path(tempfile.mkdtemp(prefix="project_scope_")) context._cleanup_handlers.append( - lambda: __import__("shutil").rmtree(context.project_scope_dir, ignore_errors=True) + lambda: __import__("shutil").rmtree( + context.project_scope_dir, ignore_errors=True + ) ) # Create a skill folder inside the project scope @@ -211,7 +215,9 @@ def step_local_scope_with_skill(context: Context) -> None: if not hasattr(context, "local_scope_dir"): context.local_scope_dir = Path(tempfile.mkdtemp(prefix="local_scope_")) context._cleanup_handlers.append( - lambda: __import__("shutil").rmtree(context.local_scope_dir, ignore_errors=True) + lambda: __import__("shutil").rmtree( + context.local_scope_dir, ignore_errors=True + ) ) # Create a skill folder inside the local scope @@ -227,7 +233,9 @@ def step_global_scope_with_multiple_skills(context: Context) -> None: if not hasattr(context, "global_scope_dir"): context.global_scope_dir = Path(tempfile.mkdtemp(prefix="global_scope_")) context._cleanup_handlers.append( - lambda: __import__("shutil").rmtree(context.global_scope_dir, ignore_errors=True) + lambda: __import__("shutil").rmtree( + context.global_scope_dir, ignore_errors=True + ) ) # Create multiple skill folders @@ -257,7 +265,9 @@ def step_empty_global_scope(context: Context) -> None: context.global_scope_dir = Path(tempfile.mkdtemp(prefix="empty_global_scope_")) context._cleanup_handlers.append( - lambda: __import__("shutil").rmtree(context.global_scope_dir, ignore_errors=True) + lambda: __import__("shutil").rmtree( + context.global_scope_dir, ignore_errors=True + ) ) @@ -268,7 +278,9 @@ def step_global_scope_with_non_skill_folders(context: Context) -> None: context.global_scope_dir = Path(tempfile.mkdtemp(prefix="global_non_skill_")) context._cleanup_handlers.append( - lambda: __import__("shutil").rmtree(context.global_scope_dir, ignore_errors=True) + lambda: __import__("shutil").rmtree( + context.global_scope_dir, ignore_errors=True + ) ) # Create folders without SKILL.md @@ -285,7 +297,9 @@ def step_global_scope_with_non_skill_folders(context: Context) -> None: def step_parse_skill_md(context: Context) -> None: """Parse the SKILL.md file.""" try: - context.skill_parse_result = AgentSkillSpec.from_file(context.skill_folder / "SKILL.md") + context.skill_parse_result = AgentSkillSpec.from_file( + context.skill_folder / "SKILL.md" + ) context.skill_parse_error = None except Exception as exc: context.skill_parse_error = exc @@ -296,7 +310,9 @@ def step_parse_skill_md(context: Context) -> None: def step_parse_skill_md_expecting_error(context: Context) -> None: """Parse the SKILL.md file, expecting an error.""" try: - context.skill_parse_result = AgentSkillSpec.from_file(context.skill_folder / "SKILL.md") + context.skill_parse_result = AgentSkillSpec.from_file( + context.skill_folder / "SKILL.md" + ) context.skill_parse_error = None except Exception as exc: context.skill_parse_error = exc @@ -399,30 +415,42 @@ def step_list_resources(context: Context) -> None: @when("I create a discovery with global scope") def step_create_discovery_global(context: Context) -> None: """Create a discovery with global scope.""" - global_dirs = [context.global_scope_dir] if hasattr(context, "global_scope_dir") else [] + global_dirs = ( + [context.global_scope_dir] if hasattr(context, "global_scope_dir") else [] + ) context.discovery = AgentSkillDiscovery.from_config(global_dirs=global_dirs) @when("I create a discovery with project scope") def step_create_discovery_project(context: Context) -> None: """Create a discovery with project scope.""" - project_dirs = [context.project_scope_dir] if hasattr(context, "project_scope_dir") else [] + project_dirs = ( + [context.project_scope_dir] if hasattr(context, "project_scope_dir") else [] + ) context.discovery = AgentSkillDiscovery.from_config(project_dirs=project_dirs) @when("I create a discovery with local scope") def step_create_discovery_local(context: Context) -> None: """Create a discovery with local scope.""" - local_dirs = [context.local_scope_dir] if hasattr(context, "local_scope_dir") else [] + local_dirs = ( + [context.local_scope_dir] if hasattr(context, "local_scope_dir") else [] + ) context.discovery = AgentSkillDiscovery.from_config(local_dirs=local_dirs) @when("I create a discovery with all scopes") def step_create_discovery_all_scopes(context: Context) -> None: """Create a discovery with all scopes.""" - global_dirs = [context.global_scope_dir] if hasattr(context, "global_scope_dir") else [] - project_dirs = [context.project_scope_dir] if hasattr(context, "project_scope_dir") else [] - local_dirs = [context.local_scope_dir] if hasattr(context, "local_scope_dir") else [] + global_dirs = ( + [context.global_scope_dir] if hasattr(context, "global_scope_dir") else [] + ) + project_dirs = ( + [context.project_scope_dir] if hasattr(context, "project_scope_dir") else [] + ) + local_dirs = ( + [context.local_scope_dir] if hasattr(context, "local_scope_dir") else [] + ) context.discovery = AgentSkillDiscovery.from_config( global_dirs=global_dirs, project_dirs=project_dirs, @@ -433,8 +461,12 @@ def step_create_discovery_all_scopes(context: Context) -> None: @when("I create a discovery with global and project scopes") def step_create_discovery_global_project(context: Context) -> None: """Create a discovery with global and project scopes.""" - global_dirs = [context.global_scope_dir] if hasattr(context, "global_scope_dir") else [] - project_dirs = [context.project_scope_dir] if hasattr(context, "project_scope_dir") else [] + global_dirs = ( + [context.global_scope_dir] if hasattr(context, "global_scope_dir") else [] + ) + project_dirs = ( + [context.project_scope_dir] if hasattr(context, "project_scope_dir") else [] + ) context.discovery = AgentSkillDiscovery.from_config( global_dirs=global_dirs, project_dirs=project_dirs, @@ -444,8 +476,12 @@ def step_create_discovery_global_project(context: Context) -> None: @when("I create a discovery with global and local scopes") def step_create_discovery_global_local(context: Context) -> None: """Create a discovery with global and local scopes.""" - global_dirs = [context.global_scope_dir] if hasattr(context, "global_scope_dir") else [] - local_dirs = [context.local_scope_dir] if hasattr(context, "local_scope_dir") else [] + global_dirs = ( + [context.global_scope_dir] if hasattr(context, "global_scope_dir") else [] + ) + local_dirs = ( + [context.local_scope_dir] if hasattr(context, "local_scope_dir") else [] + ) context.discovery = AgentSkillDiscovery.from_config( global_dirs=global_dirs, local_dirs=local_dirs, @@ -518,7 +554,9 @@ def step_parsed_skill_version(context: Context, version: str) -> None: """Assert the parsed skill version.""" spec = context.skill_parse_result assert spec is not None, "No parsed skill result available" - assert spec.version == version, f"Expected version '{version}', got '{spec.version}'" + assert spec.version == version, ( + f"Expected version '{version}', got '{spec.version}'" + ) @then("the parsed skill body should contain {text}") @@ -528,9 +566,7 @@ def step_parsed_skill_body_contains(context: Context, text: str) -> None: assert spec is not None, "No parsed skill result available" # Remove quotes if present text = text.strip('"') - assert text in spec.body, ( - f"Expected body to contain '{text}', got: {spec.body}" - ) + assert text in spec.body, f"Expected body to contain '{text}', got: {spec.body}" @then("the parsed skill allowed tools should include {tool}") @@ -590,8 +626,10 @@ def step_parsed_skill_step_content(context: Context, index: int, content: str) - ) -@then('the parsed skill step {index:d} index should be {expected_index:d}') -def step_parsed_skill_step_index(context: Context, index: int, expected_index: int) -> None: +@then("the parsed skill step {index:d} index should be {expected_index:d}") +def step_parsed_skill_step_index( + context: Context, index: int, expected_index: int +) -> None: """Assert the parsed skill step index.""" spec = context.skill_parse_result assert spec is not None, "No parsed skill result available" @@ -871,9 +909,7 @@ def step_activate_result_body_contains(context: Context, text: str) -> None: ar = context.activate_result assert ar is not None, "No activate result available" text = text.strip('"') - assert text in ar.body, ( - f"Expected body to contain '{text}', got: {ar.body}" - ) + assert text in ar.body, f"Expected body to contain '{text}', got: {ar.body}" @then("the resources list should include {filename}") @@ -965,7 +1001,9 @@ def step_discovered_skills_count(context: Context, count: int) -> None: @then('the discovered skill "{skill_name}" description should be "{description}"') -def step_discovered_skill_description(context: Context, skill_name: str, description: str) -> None: +def step_discovered_skill_description( + context: Context, skill_name: str, description: str +) -> None: """Assert the discovered skill description.""" skills = context.discovered_skills assert skills is not None, "No discovered skills available" @@ -1025,7 +1063,9 @@ def step_folder_contains_script(context: Context, filename: str, content: str) - @given('the folder contains a reference file "{filename}" with content "{content}"') -def step_folder_contains_reference(context: Context, filename: str, content: str) -> None: +def step_folder_contains_reference( + context: Context, filename: str, content: str +) -> None: """Add a reference file to the folder.""" folder = context.skill_folder refs_dir = folder / "references" diff --git a/features/steps/agents_task_validation_steps.py b/features/steps/agents_task_validation_steps.py index 8f44570dc..853410e7c 100644 --- a/features/steps/agents_task_validation_steps.py +++ b/features/steps/agents_task_validation_steps.py @@ -32,12 +32,12 @@ def step_create_temp_repo(context: Context) -> None: Path(context.temp_dir, "src", "cleveragents", "agents", "base.py").write_text( "# test file" ) - Path(context.temp_dir, "features", "steps", "agent_skills_loader_steps.py").write_text( - "# test file" - ) - Path(context.temp_dir, ".opencode", "scripts", "apply_tracking_updates.py").write_text( - "# test file" - ) + Path( + context.temp_dir, "features", "steps", "agent_skills_loader_steps.py" + ).write_text("# test file") + Path( + context.temp_dir, ".opencode", "scripts", "apply_tracking_updates.py" + ).write_text("# test file") @given('a file "{file_path}" exists for task validation') @@ -156,7 +156,9 @@ def step_log_invalid_files(context: Context) -> None: @then("the task validation should pass") def step_task_validation_pass(context: Context) -> None: """Assert that validation passed.""" - assert context.is_valid is True, f"Expected validation to pass, but got: {context.error_msg}" + assert context.is_valid is True, ( + f"Expected validation to pass, but got: {context.error_msg}" + ) @then("the task validation should fail") @@ -168,14 +170,18 @@ def step_task_validation_fail(context: Context) -> None: @then("no error message should be returned for task validation") def step_no_error_message(context: Context) -> None: """Assert that no error message was returned.""" - assert context.error_msg is None, f"Expected no error message, but got: {context.error_msg}" + assert context.error_msg is None, ( + f"Expected no error message, but got: {context.error_msg}" + ) @then('the task validation error message should contain "{text}"') def step_error_message_contains(context: Context, text: str) -> None: """Assert that the error message contains specific text.""" assert context.error_msg is not None, "Expected error message, but got None" - assert text in context.error_msg, f"Expected error message to contain '{text}', but got: {context.error_msg}" + assert text in context.error_msg, ( + f"Expected error message to contain '{text}', but got: {context.error_msg}" + ) @then("the valid files for task assignment should be:") diff --git a/features/steps/tui_first_run_steps.py b/features/steps/tui_first_run_steps.py index 669bbf808..5685e5f58 100644 --- a/features/steps/tui_first_run_steps.py +++ b/features/steps/tui_first_run_steps.py @@ -290,9 +290,7 @@ def step_default_persona_preset_count(context: object, count: int) -> None: persona = context._registry.get("default") assert persona is not None actual_count = len(persona.argument_presets) - assert actual_count == count, ( - f"Expected {count} preset(s), got {actual_count}" - ) + assert actual_count == count, f"Expected {count} preset(s), got {actual_count}" # ---------------------------------------------------------------------------