diff --git a/ROOT_DIRECTORY_AUDIT.json b/ROOT_DIRECTORY_AUDIT.json new file mode 100644 index 00000000..03cc11aa --- /dev/null +++ b/ROOT_DIRECTORY_AUDIT.json @@ -0,0 +1,553 @@ +{ + "audit_metadata": { + "audit_date": "2025-11-03", + "task_id": "ST-001", + "purpose": "Comprehensive inventory of root directory files for cleanup planning", + "auditor": "MAP Framework - Cleanup Task cleanup_root_1762179205" + }, + "summary": { + "total_files": 20, + "total_directories": 3, + "categories": { + "documentation": 5, + "test_files": 3, + "test_dependencies": 2, + "config": 2, + "generated_artifacts": 3, + "hidden_generated": 2, + "standard_project": 3 + }, + "recommendations": { + "keep_in_root": 3, + "move_to_docs": 5, + "move_to_tests": 3, + "delete_or_gitignore": 5, + "already_gitignored": 4 + } + }, + "files": [ + { + "filename": "CHANGELOG.md", + "category": "documentation", + "type": "standard_project", + "size_bytes": 27777, + "size_human": "27 KB", + "last_modified": "2025-11-03 15:07:38", + "purpose": "Project changelog following Keep a Changelog format", + "content_summary": "Version history from 1.2.2 (2025-11-03) back to initial releases. Documents bugfixes, features, breaking changes.", + "dependencies": { + "referenced_by": ["RELEASING.md", "pyproject.toml"], + "references": [] + }, + "recommendation": "KEEP", + "rationale": "Standard project file, required for releases and version tracking", + "action": "none", + "priority": "n/a" + }, + { + "filename": "IMPLEMENTATION_SUMMARY.md", + "category": "documentation", + "type": "feature_analysis", + "size_bytes": 10101, + "size_human": "9.9 KB", + "last_modified": "2025-10-29 16:50:46", + "purpose": "Reddit post findings implementation summary (hooks system, playbook auto-injection)", + "content_summary": "Detailed summary of hook system enhancements: playbook auto-injection (UserPromptSubmit), dev docs auto-generation, test coverage stats", + "dependencies": { + "referenced_by": [], + "references": [".claude/hooks/user-prompt-submit.sh", ".claude/hooks/helpers/inject_playbook_bullets.py"] + }, + "recommendation": "MOVE", + "rationale": "Feature-specific analysis document. Belongs in docs/architecture/ or docs/design-decisions/", + "action": "move_to_docs_architecture", + "priority": "medium", + "proposed_path": "docs/architecture/hooks-system-implementation.md" + }, + { + "filename": "RELEASING.md", + "category": "documentation", + "type": "standard_project", + "size_bytes": 10384, + "size_human": "10 KB", + "last_modified": "2025-10-26 13:05:46", + "purpose": "Complete release process documentation (preparation to verification)", + "content_summary": "PyPI release workflow, version bumping, GitHub Actions CI/CD, troubleshooting, rollback procedures", + "dependencies": { + "referenced_by": [".github/ISSUE_TEMPLATE/release-checklist.md"], + "references": ["CHANGELOG.md", "pyproject.toml"] + }, + "recommendation": "KEEP", + "rationale": "Critical operational documentation for maintainers", + "action": "none", + "priority": "n/a" + }, + { + "filename": "SHOWCASE_ANALYSIS_SUMMARY.md", + "category": "documentation", + "type": "research_analysis", + "size_bytes": 8757, + "size_human": "8.6 KB", + "last_modified": "2025-11-02 18:45:03", + "purpose": "Analysis of claude-code-infrastructure-showcase (2k+ stars repo)", + "content_summary": "Auto-activation pattern analysis, progressive disclosure (500-line rule), workflow suggestions. Analyzed 2025-11-02", + "dependencies": { + "referenced_by": ["ST-001-AUTO-ACTIVATION-ANALYSIS.md"], + "references": [] + }, + "recommendation": "MOVE", + "rationale": "Research/analysis document. Belongs in docs/research/ or docs/analysis/", + "action": "move_to_docs_research", + "priority": "medium", + "proposed_path": "docs/research/showcase-repository-analysis-2025-11-02.md" + }, + { + "filename": "ST-001-AUTO-ACTIVATION-ANALYSIS.md", + "category": "documentation", + "type": "subtask_analysis", + "size_bytes": 21800, + "size_human": "21 KB", + "last_modified": "2025-11-02 19:07:03", + "purpose": "Subtask analysis: UserPromptSubmit hook + workflow-rules.json auto-activation", + "content_summary": "Technical deep-dive into auto-activation mechanism. Execution flow, hook context, timeout constraints, MAP implementation strategy", + "dependencies": { + "referenced_by": [], + "references": ["SHOWCASE_ANALYSIS_SUMMARY.md", ".claude/hooks/user-prompt-submit.sh"] + }, + "recommendation": "MOVE", + "rationale": "Task-specific analysis. Should be in docs/design-decisions/ or archived in .map/completed_analyses/", + "action": "move_to_docs_design_decisions", + "priority": "low", + "proposed_path": "docs/design-decisions/auto-activation-mechanism-analysis.md" + }, + { + "filename": "coverage.json", + "category": "generated_artifacts", + "type": "test_coverage_report", + "size_bytes": 34432, + "size_human": "34 KB", + "last_modified": "2025-10-16 21:26:37", + "purpose": "pytest-cov JSON coverage report (format v3, coverage 7.10.7)", + "content_summary": "Detailed line-by-line coverage data for src/mapify_cli/__init__.py (70% coverage), playbook_manager.py (0% - not tested), semantic_search.py (0%)", + "dependencies": { + "generated_by": "pytest --cov", + "config_file": "pytest.ini", + "related_files": [".coverage", "htmlcov/"] + }, + "recommendation": "GITIGNORE", + "rationale": "Generated artifact, outdated (Oct 16), duplicates .coverage data. Already listed in .gitignore line 53", + "action": "verify_gitignore", + "priority": "high", + "gitignore_status": "already_listed_line_53" + }, + { + "filename": "mapify_cli_verification_20251023_172504.json", + "category": "generated_artifacts", + "type": "verification_report", + "size_bytes": 9564, + "size_human": "9.3 KB", + "last_modified": "2025-10-23 17:29:11", + "purpose": "CLI verification report - automated test output from source code analysis", + "content_summary": "Verification of 3 commands (init, check, upgrade) with parameters, implementation status, line numbers from src/mapify_cli/__init__.py", + "dependencies": { + "generated_by": "automated verification script", + "source_file": "src/mapify_cli/__init__.py" + }, + "recommendation": "DELETE_OR_GITIGNORE", + "rationale": "Temporary verification artifact, one-time use, already gitignored (pattern mapify_cli_verification_*.json line 61)", + "action": "confirm_gitignore_working", + "priority": "low", + "gitignore_status": "pattern_exists_line_61", + "note": "File should auto-cleanup on next generation or manual deletion safe" + }, + { + "filename": "mcp_config.json", + "category": "config", + "type": "mcp_server_config", + "size_bytes": 2351, + "size_human": "2.3 KB", + "last_modified": "2025-10-30 10:55:23", + "purpose": "MCP server configuration (claude-reviewer, sequential-thinking, cipher, codex-bridge, context7, deepwiki)", + "content_summary": "Configuration for 6 MCP servers with enabled flags and settings (auto_review, max_thoughts, similarity_threshold, timeout, tokens)", + "dependencies": { + "referenced_by": ["src/mapify_cli/__init__.py (create_mcp_config function)"], + "template_source": "src/mapify_cli/__init__.py lines 966-1082" + }, + "recommendation": "INVESTIGATE", + "rationale": "Unclear if this is user config or template. If template → delete (duplicates source). If user config → should be in .claude/mcp_config.json", + "action": "clarify_purpose_then_move_or_delete", + "priority": "high", + "questions": [ + "Is this a user's custom config or a leftover template?", + "Should user MCP configs live in .claude/ per .gitignore line 45?", + "Does mapify init create .claude/mcp_config.json or root mcp_config.json?" + ] + }, + { + "filename": "test_semantic_integration.py", + "category": "test_files", + "type": "integration_test", + "size_bytes": 7583, + "size_human": "7.4 KB", + "last_modified": "2025-10-10 23:20:57", + "purpose": "Integration tests for PlaybookManager semantic search functionality", + "content_summary": "5 test functions: initialization, add bullets, semantic search, deduplication, fallback mode. Tests sentence-transformers integration", + "dependencies": { + "requires": ["requirements-semantic.txt"], + "runner": "run_semantic_tests.sh", + "tests": ["src/mapify_cli/playbook_manager.py", "src/mapify_cli/semantic_search.py"] + }, + "recommendation": "MOVE", + "rationale": "Integration test file. Should be in tests/integration/ directory with other tests", + "action": "move_to_tests_integration", + "priority": "high", + "proposed_path": "tests/integration/test_semantic_integration.py" + }, + { + "filename": "run_semantic_tests.sh", + "category": "test_files", + "type": "test_runner", + "size_bytes": 224, + "size_human": "224 bytes", + "last_modified": "2025-10-10 23:21:04", + "purpose": "Shell script to run semantic integration tests with environment variables", + "content_summary": "Sets TRANSFORMERS_NO_TF=1, TF_USE_LEGACY_KERAS=1, TF_CPP_MIN_LOG_LEVEL=3, then runs test_semantic_integration.py", + "dependencies": { + "requires": ["test_semantic_integration.py"], + "related": ["requirements-semantic.txt"] + }, + "recommendation": "MOVE", + "rationale": "Test runner script. Should be in tests/ or scripts/ directory", + "action": "move_to_scripts", + "priority": "medium", + "proposed_path": "scripts/run_semantic_tests.sh", + "alternative": "tests/run_semantic_tests.sh" + }, + { + "filename": "requirements-semantic.txt", + "category": "test_dependencies", + "type": "pip_requirements", + "size_bytes": 590, + "size_human": "590 bytes", + "last_modified": "2025-10-10 23:26:51", + "purpose": "Optional dependencies for semantic search (sentence-transformers, numpy, scikit-learn, tf-keras)", + "content_summary": "4 required packages + optional faiss-cpu (commented). ~500MB model download on first use", + "dependencies": { + "used_by": ["test_semantic_integration.py", "src/mapify_cli/semantic_search.py"], + "documented_in": ["docs/SEMANTIC_SEARCH_SETUP.md", "README.md"] + }, + "recommendation": "KEEP_OR_MOVE", + "rationale": "Optional feature dependencies. Could stay in root (common pattern) OR move to requirements/semantic.txt for organization", + "action": "decision_needed", + "priority": "low", + "options": [ + "Keep in root (standard pattern for optional requirements)", + "Move to requirements/semantic.txt (cleaner organization)", + "Reference in pyproject.toml [extras] section" + ] + }, + { + "filename": "requirements-test.txt", + "category": "test_dependencies", + "type": "pip_requirements", + "size_bytes": 219, + "size_human": "219 bytes", + "last_modified": "2025-10-06 23:13:24", + "purpose": "Test dependencies (pytest, pytest-cov, pytest-mock, pytest-watch, black, ruff, mypy, type stubs)", + "content_summary": "Development dependencies for testing and code quality tools", + "dependencies": { + "used_by": ["tests/", "Makefile"], + "related": ["pytest.ini", ".github/workflows/"] + }, + "recommendation": "KEEP_OR_MOVE", + "rationale": "Standard test dependencies. Could stay in root OR move to requirements/test.txt", + "action": "decision_needed", + "priority": "low", + "options": [ + "Keep in root (standard pattern)", + "Move to requirements/test.txt (matches requirements-semantic.txt move)", + "Consolidate into pyproject.toml [dev-dependencies]" + ] + }, + { + "filename": ".coverage", + "category": "hidden_generated", + "type": "coverage_database", + "size_bytes": 53248, + "size_human": "52 KB", + "last_modified": "2025-11-02 15:24:39", + "purpose": "pytest-cov coverage database (SQLite format)", + "content_summary": "Binary database with line-by-line execution data. Source for coverage.json and htmlcov/ reports", + "dependencies": { + "generated_by": "pytest --cov", + "generates": ["coverage.json", "htmlcov/"], + "config": "pytest.ini" + }, + "recommendation": "GITIGNORE", + "rationale": "Generated artifact, should not be committed. Already in .gitignore line 11", + "action": "verify_gitignore", + "priority": "n/a", + "gitignore_status": "already_listed_line_11" + }, + { + "filename": "htmlcov/", + "category": "hidden_generated", + "type": "coverage_html_report", + "size_bytes": 466944, + "size_human": "456 KB", + "last_modified": "2025-10-06 23:27:00", + "purpose": "HTML coverage report directory with 9+ files (index.html, coverage_html.js, style.css, per-file reports)", + "content_summary": "Interactive HTML coverage report. Outdated (Oct 6). Contains class_index.html, function_index.html, per-file coverage", + "dependencies": { + "generated_by": "pytest --cov --cov-report=html", + "source": [".coverage"] + }, + "recommendation": "GITIGNORE", + "rationale": "Generated artifact directory. Already in .gitignore line 36", + "action": "verify_gitignore", + "priority": "n/a", + "gitignore_status": "already_listed_line_36" + }, + { + "filename": "README.md", + "category": "documentation", + "type": "standard_project", + "size_bytes": 13771, + "size_human": "13 KB", + "last_modified": "2025-11-03 17:10:04", + "purpose": "Project README with quickstart, installation, usage examples", + "content_summary": "MAP Framework overview, installation instructions, workflow commands, MCP integration, links to docs/", + "dependencies": { + "references": ["docs/USAGE.md", "docs/ARCHITECTURE.md", "docs/INSTALL.md", "requirements-semantic.txt", "requirements-test.txt"] + }, + "recommendation": "KEEP", + "rationale": "Essential project file, primary entry point for users", + "action": "none", + "priority": "n/a" + }, + { + "filename": "pyproject.toml", + "category": "config", + "type": "standard_project", + "size_bytes": 1149, + "size_human": "1.1 KB", + "last_modified": "2025-11-03 15:07:38", + "purpose": "Python project configuration (build, dependencies, metadata)", + "content_summary": "Package metadata for mapify-cli, dependencies, build-system (setuptools), version tracking", + "dependencies": { + "referenced_by": ["RELEASING.md", "setup.py", "pip install"], + "references": ["src/mapify_cli/"] + }, + "recommendation": "KEEP", + "rationale": "Required project configuration file", + "action": "none", + "priority": "n/a" + }, + { + "filename": "pytest.ini", + "category": "config", + "type": "test_config", + "size_bytes": 299, + "size_human": "299 bytes", + "last_modified": "2025-10-06 23:12:51", + "purpose": "pytest configuration (test discovery, coverage options)", + "content_summary": "Test paths, coverage settings, output format configuration", + "dependencies": { + "used_by": ["pytest", "requirements-test.txt"] + }, + "recommendation": "KEEP", + "rationale": "Standard test configuration, commonly in root", + "action": "none", + "priority": "n/a" + }, + { + "filename": "Makefile", + "category": "config", + "type": "build_automation", + "size_bytes": 1568, + "size_human": "1.5 KB", + "last_modified": "2025-10-24 14:07:12", + "purpose": "Development automation (install, test, lint, clean, build, publish)", + "content_summary": "Common make targets for development workflow", + "dependencies": { + "uses": ["requirements-test.txt", "pytest", "black", "ruff", "mypy"] + }, + "recommendation": "KEEP", + "rationale": "Standard development tool, commonly in root", + "action": "none", + "priority": "n/a" + }, + { + "filename": ".gitignore", + "category": "config", + "type": "standard_project", + "size_bytes": 1069, + "size_human": "1.0 KB", + "last_modified": "2025-11-02 18:34:43", + "purpose": "Git ignore patterns for generated files, caches, user data", + "content_summary": "67 lines covering Python artifacts, coverage files, user playbooks, MCP configs, verification files, docs submodules", + "dependencies": { + "protects": [".coverage", "htmlcov/", "coverage.json", "mapify_cli_verification_*.json", ".claude/playbook.json"] + }, + "recommendation": "KEEP", + "rationale": "Essential Git configuration", + "action": "none", + "priority": "n/a" + }, + { + "filename": "MANIFEST.in", + "category": "config", + "type": "package_manifest", + "size_bytes": 195, + "size_human": "195 bytes", + "last_modified": "2025-10-06 23:35:02", + "purpose": "Controls which non-Python files are included in source distribution", + "content_summary": "Include patterns for README, LICENSE, templates, agents, commands", + "dependencies": { + "used_by": ["python setup.py sdist", "pyproject.toml build"] + }, + "recommendation": "KEEP", + "rationale": "Required for proper package distribution", + "action": "none", + "priority": "n/a" + } + ], + "dependency_graph": { + "description": "File interdependencies - what depends on what", + "clusters": [ + { + "name": "test_infrastructure", + "files": ["test_semantic_integration.py", "run_semantic_tests.sh", "requirements-semantic.txt", ".coverage", "coverage.json", "htmlcov/", "pytest.ini"], + "recommendation": "Move tests/ and scripts/, keep only pytest.ini in root" + }, + { + "name": "analysis_docs", + "files": ["IMPLEMENTATION_SUMMARY.md", "SHOWCASE_ANALYSIS_SUMMARY.md", "ST-001-AUTO-ACTIVATION-ANALYSIS.md"], + "recommendation": "Move all to docs/architecture/ or docs/research/" + }, + { + "name": "project_config", + "files": ["pyproject.toml", ".gitignore", "MANIFEST.in", "Makefile", "pytest.ini"], + "recommendation": "Keep all in root (standard locations)" + }, + { + "name": "documentation", + "files": ["README.md", "CHANGELOG.md", "RELEASING.md"], + "recommendation": "Keep all in root (standard locations)" + }, + { + "name": "mcp_config_mystery", + "files": ["mcp_config.json"], + "recommendation": "NEEDS INVESTIGATION - purpose unclear" + } + ] + }, + "action_plan": { + "phase_1_high_priority": [ + { + "action": "investigate_mcp_config", + "file": "mcp_config.json", + "questions": [ + "Is this user config or template?", + "Does it duplicate src/mapify_cli/__init__.py create_mcp_config()?", + "Should it be .claude/mcp_config.json per gitignore?" + ], + "outcome_options": ["delete_if_template", "move_to_.claude_if_user_config"] + }, + { + "action": "move_test_file", + "source": "test_semantic_integration.py", + "destination": "tests/integration/test_semantic_integration.py", + "update_references": ["run_semantic_tests.sh"] + }, + { + "action": "verify_gitignore_working", + "files": ["coverage.json", "mapify_cli_verification_20251023_172504.json"], + "expected": "files should not appear in git status" + } + ], + "phase_2_medium_priority": [ + { + "action": "move_analysis_docs", + "files": [ + { + "source": "IMPLEMENTATION_SUMMARY.md", + "destination": "docs/architecture/hooks-system-implementation.md" + }, + { + "source": "SHOWCASE_ANALYSIS_SUMMARY.md", + "destination": "docs/research/showcase-repository-analysis-2025-11-02.md" + } + ] + }, + { + "action": "move_test_runner", + "source": "run_semantic_tests.sh", + "destination": "scripts/run_semantic_tests.sh", + "update_references": ["README.md", "docs/SEMANTIC_SEARCH_SETUP.md"] + } + ], + "phase_3_low_priority": [ + { + "action": "decide_requirements_location", + "files": ["requirements-semantic.txt", "requirements-test.txt"], + "options": [ + "keep_in_root", + "move_to_requirements_dir", + "consolidate_into_pyproject_toml" + ], + "note": "Current pattern (root) is acceptable, move is optional for organization" + }, + { + "action": "archive_or_move_old_analysis", + "source": "ST-001-AUTO-ACTIVATION-ANALYSIS.md", + "destination": "docs/design-decisions/auto-activation-mechanism-analysis.md", + "alternative": ".map/completed_analyses/ST-001-AUTO-ACTIVATION-ANALYSIS.md" + } + ] + }, + "risk_assessment": { + "low_risk_moves": [ + "test_semantic_integration.py → tests/integration/", + "run_semantic_tests.sh → scripts/", + "SHOWCASE_ANALYSIS_SUMMARY.md → docs/research/" + ], + "medium_risk_moves": [ + "IMPLEMENTATION_SUMMARY.md → docs/architecture/ (might be referenced in recent work)", + "ST-001-AUTO-ACTIVATION-ANALYSIS.md → docs/design-decisions/ (current task analysis)" + ], + "requires_investigation": [ + "mcp_config.json - unknown if user config or template" + ], + "no_risk_actions": [ + "verify .gitignore working correctly", + "confirm coverage.json and verification JSON are ignored" + ] + }, + "gitignore_verification": { + "currently_ignored_correctly": [ + ".coverage (line 11)", + "htmlcov/ (line 36)", + "coverage.json (line 53)", + "mapify_cli_verification_*.json (pattern line 61)" + ], + "should_be_ignored": [ + "All currently ignored files are correctly listed" + ], + "action_needed": [ + "Verify coverage.json actually ignored (exists in root despite gitignore)", + "Consider manual deletion of coverage.json if orphaned" + ] + }, + "size_analysis": { + "total_root_file_size_bytes": 152791, + "total_root_file_size_human": "149 KB", + "largest_files": [ + {"file": "CHANGELOG.md", "size": "27 KB", "keep": true}, + {"file": ".coverage", "size": "52 KB", "gitignored": true}, + {"file": "coverage.json", "size": "34 KB", "should_delete": true}, + {"file": "ST-001-AUTO-ACTIVATION-ANALYSIS.md", "size": "21 KB", "should_move": true}, + {"file": "README.md", "size": "13 KB", "keep": true} + ], + "space_savings_potential": "~85 KB if generated artifacts removed (coverage.json 34KB + htmlcov/ 456KB cleanup + verification 9KB)" + } +} diff --git a/IMPLEMENTATION_SUMMARY.md b/docs/architecture/hooks-system-implementation.md similarity index 100% rename from IMPLEMENTATION_SUMMARY.md rename to docs/architecture/hooks-system-implementation.md diff --git a/ST-001-AUTO-ACTIVATION-ANALYSIS.md b/docs/design-decisions/auto-activation-mechanism-analysis.md similarity index 100% rename from ST-001-AUTO-ACTIVATION-ANALYSIS.md rename to docs/design-decisions/auto-activation-mechanism-analysis.md diff --git a/SHOWCASE_ANALYSIS_SUMMARY.md b/docs/research/showcase-repository-analysis-2025-11-02.md similarity index 100% rename from SHOWCASE_ANALYSIS_SUMMARY.md rename to docs/research/showcase-repository-analysis-2025-11-02.md diff --git a/mcp_config.json b/mcp_config.json deleted file mode 100644 index 6776cb0a..00000000 --- a/mcp_config.json +++ /dev/null @@ -1,78 +0,0 @@ -{ - "mcp_servers": { - "claude-reviewer": { - "enabled": true, - "description": "Professional AI code review", - "config": { - "auto_review": true, - "focus_areas": ["security", "performance", "testing"], - "severity_threshold": "medium" - } - }, - "sequential-thinking": { - "enabled": true, - "description": "Chain-of-thought reasoning", - "config": { - "max_thoughts": 10, - "branch_exploration": true, - "hypothesis_verification": true - } - }, - "cipher": { - "enabled": true, - "description": "Advanced knowledge and reasoning memory system", - "config": { - "auto_store": true, - "retrieval_limit": 5, - "similarity_threshold": 0.85, - "enable_reasoning_patterns": true, - "use_llm_decisions": false, - "confidence_threshold": 0.7 - } - }, - "codex-bridge": { - "enabled": true, - "description": "AI code generation", - "config": { - "format": "json", - "timeout": 60, - "batch_size": 5 - } - }, - "context7": { - "enabled": true, - "description": "Up-to-date library documentation", - "config": { - "tokens": 5000, - "auto_resolve": true, - "cache_duration": 3600 - } - }, - "deepwiki": { - "enabled": true, - "description": "GitHub repository intelligence", - "config": { - "auto_structure": true, - "max_depth": 3, - "cache_repos": true - } - } - }, - "agent_mcp_mappings": { - "task-decomposer": ["cipher", "sequential-thinking", "deepwiki", "context7"], - "actor": ["cipher", "codex-bridge", "context7", "deepwiki"], - "monitor": ["claude-reviewer", "cipher", "sequential-thinking", "context7", "deepwiki"], - "predictor": ["cipher", "codex-bridge", "deepwiki", "context7"], - "evaluator": ["sequential-thinking", "claude-reviewer", "cipher", "context7", "deepwiki"], - "reflector": ["cipher", "sequential-thinking", "context7", "deepwiki"], - "curator": ["cipher", "context7", "deepwiki"], - "documentation-reviewer": ["cipher", "context7", "deepwiki"] - }, - "workflow_settings": { - "always_retrieve_knowledge": true, - "store_successful_patterns": true, - "use_professional_review": true, - "enable_sequential_thinking": true, - "knowledge_cache_ttl": 3600 - } -} diff --git a/run_semantic_tests.sh b/scripts/run_semantic_tests.sh similarity index 63% rename from run_semantic_tests.sh rename to scripts/run_semantic_tests.sh index 0673793d..86a47367 100755 --- a/run_semantic_tests.sh +++ b/scripts/run_semantic_tests.sh @@ -4,5 +4,5 @@ export TRANSFORMERS_NO_TF=1 export TF_USE_LEGACY_KERAS=1 export TF_CPP_MIN_LOG_LEVEL=3 -# Run the test script -python test_semantic_integration.py +# Run the test script from project root +python tests/integration/test_semantic_integration.py diff --git a/tests/integration/conftest.py b/tests/integration/conftest.py new file mode 100644 index 00000000..63a9eba2 --- /dev/null +++ b/tests/integration/conftest.py @@ -0,0 +1,36 @@ +"""Pytest fixtures for integration tests.""" +import os +import pytest +from pathlib import Path +import tempfile +import shutil + +# Set environment variables before any imports +os.environ['TRANSFORMERS_NO_TF'] = '1' +os.environ['TF_USE_LEGACY_KERAS'] = '1' +os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' + +from mapify_cli.playbook_manager import PlaybookManager, SEMANTIC_SEARCH_AVAILABLE + + +@pytest.fixture(scope="module") +def manager(tmp_path_factory): + """Create PlaybookManager with semantic search for integration tests.""" + if not SEMANTIC_SEARCH_AVAILABLE: + pytest.skip("sentence-transformers not installed") + + # Create temporary directory for test playbook + test_dir = tmp_path_factory.mktemp("semantic_test") + playbook_path = test_dir / "playbook_test.json" + + # Initialize manager + manager = PlaybookManager( + playbook_path=str(playbook_path), + use_semantic_search=True + ) + + yield manager + + # Cleanup + if playbook_path.exists(): + playbook_path.unlink() diff --git a/test_semantic_integration.py b/tests/integration/test_semantic_integration.py similarity index 92% rename from test_semantic_integration.py rename to tests/integration/test_semantic_integration.py index 48c7306a..7a89a2b8 100755 --- a/test_semantic_integration.py +++ b/tests/integration/test_semantic_integration.py @@ -20,37 +20,24 @@ from pathlib import Path # Add src to path for imports -sys.path.insert(0, str(Path(__file__).parent / "src")) +project_root = Path(__file__).parent.parent.parent +sys.path.insert(0, str(project_root / "src")) from mapify_cli.playbook_manager import PlaybookManager, SEMANTIC_SEARCH_AVAILABLE -def test_initialization(): +def test_initialization(manager): """Test PlaybookManager initialization with semantic search.""" print("\n" + "="*70) print("TEST 1: PlaybookManager Initialization") print("="*70) - if not SEMANTIC_SEARCH_AVAILABLE: - print("❌ FAILED: sentence-transformers not installed") - print(" Install with: pip install -r requirements-semantic.txt") - return False - - manager = PlaybookManager( - playbook_path=".claude/playbook_test.json", - use_semantic_search=True - ) - - if manager.semantic_engine is None: - print("❌ FAILED: Semantic engine not initialized") - return False + assert manager.semantic_engine is not None, "Semantic engine not initialized" print("✓ PlaybookManager initialized with semantic search") print(f" Model: {manager.semantic_engine.model_name}") print(f" Cache dir: {manager.semantic_engine.cache_dir}") - return manager - def test_add_bullets(manager): """Test adding bullets via delta operations."""