{ "project": "orchestrator", "path": ".", "timestamp": "2026-01-09T00:35:40.789327", "analysis": { "directory": ".", "file_count": 10, "files": { "daemon.py": { "path": "daemon.py", "metrics": { "total_lines": 293, "code_lines": 224, "comment_lines": 15, "blank_lines": 54, "functions": 14, "classes": 2, "imports": 20, "cyclomatic_complexity": 24 }, "components": [ { "name": "Task", "type": "class", "path": "daemon.py", "line_number": 53, "docstring": null, "metrics": null, "dependencies": [], "children": [] }, { "name": "__post_init__", "type": "function", "path": "daemon.py", "line_number": 64, "docstring": null, "metrics": null, "dependencies": [], "children": [] }, { "name": "OrchestratorDaemon", "type": "class", "path": "daemon.py", "line_number": 68, "docstring": null, "metrics": null, "dependencies": [], "children": [] }, { "name": "__init__", "type": "function", "path": "daemon.py", "line_number": 69, "docstring": null, "metrics": null, "dependencies": [], "children": [] }, { "name": "_load_config", "type": "function", "path": "daemon.py", "line_number": 77, "docstring": "Load configuration from file", "metrics": null, "dependencies": [], "children": [] }, { "name": "_save_pid", "type": "function", "path": "daemon.py", "line_number": 84, "docstring": "Save PID file", "metrics": null, "dependencies": [], "children": [] }, { "name": "_remove_pid", "type": "function", "path": "daemon.py", "line_number": 89, "docstring": "Remove PID file", "metrics": null, "dependencies": [], "children": [] }, { "name": "detect_project", "type": "function", "path": "daemon.py", "line_number": 94, "docstring": "Detect which project a prompt relates to", "metrics": null, "dependencies": [], "children": [] }, { "name": "run_subagent", "type": "function", "path": "daemon.py", "line_number": 110, "docstring": "Execute a task using Claude subagent", "metrics": null, "dependencies": [], "children": [] }, { "name": "process_task", "type": "function", "path": "daemon.py", "line_number": 147, "docstring": "Process a single task", "metrics": null, "dependencies": [], "children": [] }, { "name": "worker_loop", "type": "function", "path": "daemon.py", "line_number": 174, "docstring": "Main worker loop processing tasks", "metrics": null, "dependencies": [], "children": [] }, { "name": "submit_task", "type": "function", "path": "daemon.py", "line_number": 185, "docstring": "Submit a new task to the queue", "metrics": null, "dependencies": [], "children": [] }, { "name": "get_status", "type": "function", "path": "daemon.py", "line_number": 209, "docstring": "Get daemon status", "metrics": null, "dependencies": [], "children": [] }, { "name": "handle_signal", "type": "function", "path": "daemon.py", "line_number": 221, "docstring": "Handle shutdown signals", "metrics": null, "dependencies": [], "children": [] }, { "name": "run", "type": "function", "path": "daemon.py", "line_number": 226, "docstring": "Run the daemon", "metrics": null, "dependencies": [], "children": [] }, { "name": "main", "type": "function", "path": "daemon.py", "line_number": 257, "docstring": null, "metrics": null, "dependencies": [], "children": [] } ], "imports": [ [ "json", "" ], [ "os", "" ], [ "sys", "" ], [ "time", "" ], [ "logging", "" ], [ "signal", "" ], [ "subprocess", "" ], [ "Path", "pathlib" ], [ "datetime", "datetime" ], [ "Optional", "typing" ], [ "Dict", "typing" ], [ "Any", "typing" ], [ "dataclass", "dataclasses" ], [ "asdict", "dataclasses" ], [ "Queue", "queue" ], [ "Empty", "queue" ], [ "Thread", "threading" ], [ "Event", "threading" ], [ "socket", "" ], [ "argparse", "" ] ], "patterns": [ { "name": "dataclass", "class": "Task", "line": 53 } ] }, "orchestrator.py": { "path": "orchestrator.py", "metrics": { "total_lines": 247, "code_lines": 198, "comment_lines": 11, "blank_lines": 38, "functions": 10, "classes": 2, "imports": 11, "cyclomatic_complexity": 31 }, "components": [ { "name": "ProjectConfig", "type": "class", "path": "orchestrator.py", "line_number": 32, "docstring": null, "metrics": null, "dependencies": [], "children": [] }, { "name": "Orchestrator", "type": "class", "path": "orchestrator.py", "line_number": 39, "docstring": null, "metrics": null, "dependencies": [], "children": [] }, { "name": "__init__", "type": "function", "path": "orchestrator.py", "line_number": 40, "docstring": null, "metrics": null, "dependencies": [], "children": [] }, { "name": "_load_config", "type": "function", "path": "orchestrator.py", "line_number": 45, "docstring": "Load orchestrator configuration", "metrics": null, "dependencies": [], "children": [] }, { "name": "_parse_projects", "type": "function", "path": "orchestrator.py", "line_number": 52, "docstring": "Parse project configurations", "metrics": null, "dependencies": [], "children": [] }, { "name": "detect_project", "type": "function", "path": "orchestrator.py", "line_number": 63, "docstring": "Detect which project a prompt relates to", "metrics": null, "dependencies": [], "children": [] }, { "name": "run_subagent", "type": "function", "path": "orchestrator.py", "line_number": 95, "docstring": "Run a subagent for a specific project", "metrics": null, "dependencies": [], "children": [] }, { "name": "route_request", "type": "function", "path": "orchestrator.py", "line_number": 147, "docstring": "Route a request to the appropriate subagent", "metrics": null, "dependencies": [], "children": [] }, { "name": "_run_general", "type": "function", "path": "orchestrator.py", "line_number": 159, "docstring": "Run a general task not specific to any project", "metrics": null, "dependencies": [], "children": [] }, { "name": "health_check_all", "type": "function", "path": "orchestrator.py", "line_number": 179, "docstring": "Run health checks across all projects", "metrics": null, "dependencies": [], "children": [] }, { "name": "list_projects", "type": "function", "path": "orchestrator.py", "line_number": 191, "docstring": "List all configured projects", "metrics": null, "dependencies": [], "children": [] }, { "name": "main", "type": "function", "path": "orchestrator.py", "line_number": 201, "docstring": null, "metrics": null, "dependencies": [], "children": [] } ], "imports": [ [ "json", "" ], [ "subprocess", "" ], [ "sys", "" ], [ "os", "" ], [ "Path", "pathlib" ], [ "Optional", "typing" ], [ "Dict", "typing" ], [ "Any", "typing" ], [ "dataclass", "dataclasses" ], [ "datetime", "datetime" ], [ "argparse", "" ] ], "patterns": [ { "name": "dataclass", "class": "ProjectConfig", "line": 32 } ] }, "lib/qa_validator.py": { "path": "lib/qa_validator.py", "metrics": { "total_lines": 388, "code_lines": 287, "comment_lines": 19, "blank_lines": 82, "functions": 14, "classes": 1, "imports": 13, "cyclomatic_complexity": 41 }, "components": [ { "name": "QAValidator", "type": "class", "path": "lib/qa_validator.py", "line_number": 30, "docstring": "Validates code-documentation synchronization.", "metrics": null, "dependencies": [], "children": [] }, { "name": "__init__", "type": "function", "path": "lib/qa_validator.py", "line_number": 33, "docstring": null, "metrics": null, "dependencies": [], "children": [] }, { "name": "_add_issue", "type": "function", "path": "lib/qa_validator.py", "line_number": 38, "docstring": null, "metrics": null, "dependencies": [], "children": [] }, { "name": "_add_warning", "type": "function", "path": "lib/qa_validator.py", "line_number": 46, "docstring": null, "metrics": null, "dependencies": [], "children": [] }, { "name": "_add_info", "type": "function", "path": "lib/qa_validator.py", "line_number": 54, "docstring": null, "metrics": null, "dependencies": [], "children": [] }, { "name": "extract_routes", "type": "function", "path": "lib/qa_validator.py", "line_number": 64, "docstring": "Extract all route_* functions from luzia script.", "metrics": null, "dependencies": [], "children": [] }, { "name": "extract_router_patterns", "type": "function", "path": "lib/qa_validator.py", "line_number": 92, "docstring": "Extract registered routes from Router class.", "metrics": null, "dependencies": [], "children": [] }, { "name": "validate_routes", "type": "function", "path": "lib/qa_validator.py", "line_number": 113, "docstring": "Validate all route functions are registered.", "metrics": null, "dependencies": [], "children": [] }, { "name": "validate_command_docs", "type": "function", "path": "lib/qa_validator.py", "line_number": 135, "docstring": "Validate all commands are documented in KG.", "metrics": null, "dependencies": [], "children": [] }, { "name": "validate_project_docs", "type": "function", "path": "lib/qa_validator.py", "line_number": 157, "docstring": "Validate all projects in config are documented.", "metrics": null, "dependencies": [], "children": [] }, { "name": "validate_python_syntax", "type": "function", "path": "lib/qa_validator.py", "line_number": 191, "docstring": "Validate Python syntax of luzia script.", "metrics": null, "dependencies": [], "children": [] }, { "name": "validate_all", "type": "function", "path": "lib/qa_validator.py", "line_number": 208, "docstring": "Run all validations.", "metrics": null, "dependencies": [], "children": [] }, { "name": "sync_routes_to_kg", "type": "function", "path": "lib/qa_validator.py", "line_number": 237, "docstring": "Sync route functions to sysadmin KG.", "metrics": null, "dependencies": [], "children": [] }, { "name": "sync_projects_to_kg", "type": "function", "path": "lib/qa_validator.py", "line_number": 274, "docstring": "Sync projects from config to KG.", "metrics": null, "dependencies": [], "children": [] }, { "name": "run_qa", "type": "function", "path": "lib/qa_validator.py", "line_number": 316, "docstring": "Run QA validation and optionally sync.", "metrics": null, "dependencies": [], "children": [] } ], "imports": [ [ "ast", "" ], [ "json", "" ], [ "re", "" ], [ "Path", "pathlib" ], [ "Dict", "typing" ], [ "List", "typing" ], [ "Tuple", "typing" ], [ "Any", "typing" ], [ "datetime", "datetime" ], [ "sys", "" ], [ "KnowledgeGraph", "knowledge_graph" ], [ "KG_PATHS", "knowledge_graph" ], [ "argparse", "" ] ], "patterns": [] }, "lib/watchdog.py": { "path": "lib/watchdog.py", "metrics": { "total_lines": 435, "code_lines": 335, "comment_lines": 29, "blank_lines": 71, "functions": 13, "classes": 1, "imports": 14, "cyclomatic_complexity": 45 }, "components": [ { "name": "validate_project_name", "type": "function", "path": "lib/watchdog.py", "line_number": 32, "docstring": "Validate project name to prevent path traversal attacks.\n\nRules:\n- Must be alphanumeric with hyphens/underscores only\n- Cannot contain path separators or dots\n- Must be 1-32 characters\n- Cannot start with hyphen or underscore", "metrics": null, "dependencies": [], "children": [] }, { "name": "ConductorWatchdog", "type": "class", "path": "lib/watchdog.py", "line_number": 53, "docstring": "Monitor conductor tasks for stalls and liveness.", "metrics": null, "dependencies": [], "children": [] }, { "name": "__init__", "type": "function", "path": "lib/watchdog.py", "line_number": 60, "docstring": null, "metrics": null, "dependencies": [], "children": [] }, { "name": "_load_stall_timeout", "type": "function", "path": "lib/watchdog.py", "line_number": 63, "docstring": "Load stall timeout from queue config.", "metrics": null, "dependencies": [], "children": [] }, { "name": "_get_project_users", "type": "function", "path": "lib/watchdog.py", "line_number": 73, "docstring": "Get list of project users (non-system users with home dirs).", "metrics": null, "dependencies": [], "children": [] }, { "name": "get_conductor_base", "type": "function", "path": "lib/watchdog.py", "line_number": 91, "docstring": "Get conductor base directory for a project.", "metrics": null, "dependencies": [], "children": [] }, { "name": "read_task_state", "type": "function", "path": "lib/watchdog.py", "line_number": 97, "docstring": "Read complete task state from conductor directory.", "metrics": null, "dependencies": [], "children": [] }, { "name": "_extract_progress_summary", "type": "function", "path": "lib/watchdog.py", "line_number": 146, "docstring": "Extract last milestone or current status from progress.md.", "metrics": null, "dependencies": [], "children": [] }, { "name": "scan_project", "type": "function", "path": "lib/watchdog.py", "line_number": 165, "docstring": "Scan all active tasks for a project.", "metrics": null, "dependencies": [], "children": [] }, { "name": "scan_all_projects", "type": "function", "path": "lib/watchdog.py", "line_number": 182, "docstring": "Scan all projects for stalled tasks.\n\nReturns: List of (task_id, project, stall_reason)", "metrics": null, "dependencies": [], "children": [] }, { "name": "get_all_active_tasks", "type": "function", "path": "lib/watchdog.py", "line_number": 199, "docstring": "Get all active tasks across all projects.", "metrics": null, "dependencies": [], "children": [] }, { "name": "escalate", "type": "function", "path": "lib/watchdog.py", "line_number": 208, "docstring": "Escalate stalled task via assistant-channel.\n\nReturns True if escalation was sent.", "metrics": null, "dependencies": [], "children": [] }, { "name": "archive_task", "type": "function", "path": "lib/watchdog.py", "line_number": 294, "docstring": "Move task from active to completed or failed.\n\nArgs:\n project: Project name\n task_id: Task ID\n status: 'completed' or 'failed'\n\nReturns True if archived successfully.", "metrics": null, "dependencies": [], "children": [] }, { "name": "update_heartbeat", "type": "function", "path": "lib/watchdog.py", "line_number": 345, "docstring": "Update heartbeat for a task (called by running agent).", "metrics": null, "dependencies": [], "children": [] } ], "imports": [ [ "json", "" ], [ "os", "" ], [ "re", "" ], [ "shutil", "" ], [ "time", "" ], [ "datetime", "datetime" ], [ "Path", "pathlib" ], [ "Dict", "typing" ], [ "List", "typing" ], [ "Optional", "typing" ], [ "Tuple", "typing" ], [ "Any", "typing" ], [ "subprocess", "" ], [ "sys", "" ] ], "patterns": [] }, "lib/doc_sync.py": { "path": "lib/doc_sync.py", "metrics": { "total_lines": 379, "code_lines": 284, "comment_lines": 21, "blank_lines": 74, "functions": 15, "classes": 2, "imports": 13, "cyclomatic_complexity": 54 }, "components": [ { "name": "MarkdownParser", "type": "class", "path": "lib/doc_sync.py", "line_number": 31, "docstring": "Parse markdown files into structured entities.", "metrics": null, "dependencies": [], "children": [] }, { "name": "__init__", "type": "function", "path": "lib/doc_sync.py", "line_number": 34, "docstring": null, "metrics": null, "dependencies": [], "children": [] }, { "name": "parse", "type": "function", "path": "lib/doc_sync.py", "line_number": 40, "docstring": "Parse the markdown file.", "metrics": null, "dependencies": [], "children": [] }, { "name": "_sanitize_name", "type": "function", "path": "lib/doc_sync.py", "line_number": 71, "docstring": "Convert name to KG-safe format.", "metrics": null, "dependencies": [], "children": [] }, { "name": "_infer_type", "type": "function", "path": "lib/doc_sync.py", "line_number": 78, "docstring": "Infer entity type from title/content.", "metrics": null, "dependencies": [], "children": [] }, { "name": "_extract_sections", "type": "function", "path": "lib/doc_sync.py", "line_number": 105, "docstring": "Extract sections (H2, H3 headers).", "metrics": null, "dependencies": [], "children": [] }, { "name": "_extract_code_blocks", "type": "function", "path": "lib/doc_sync.py", "line_number": 121, "docstring": "Extract code blocks with language.", "metrics": null, "dependencies": [], "children": [] }, { "name": "_extract_links", "type": "function", "path": "lib/doc_sync.py", "line_number": 137, "docstring": "Extract markdown links as relations.", "metrics": null, "dependencies": [], "children": [] }, { "name": "DocSync", "type": "class", "path": "lib/doc_sync.py", "line_number": 152, "docstring": "Sync documentation files to knowledge graphs.", "metrics": null, "dependencies": [], "children": [] }, { "name": "__init__", "type": "function", "path": "lib/doc_sync.py", "line_number": 155, "docstring": null, "metrics": null, "dependencies": [], "children": [] }, { "name": "migrate_docs_dir", "type": "function", "path": "lib/doc_sync.py", "line_number": 163, "docstring": "Migrate /opt/server-agents/docs/*.md to KG.", "metrics": null, "dependencies": [], "children": [] }, { "name": "migrate_project_docs", "type": "function", "path": "lib/doc_sync.py", "line_number": 188, "docstring": "Migrate /home/*/CLAUDE.md to projects KG.", "metrics": null, "dependencies": [], "children": [] }, { "name": "_process_md_file", "type": "function", "path": "lib/doc_sync.py", "line_number": 207, "docstring": "Process a single .md file.", "metrics": null, "dependencies": [], "children": [] }, { "name": "_process_claude_md", "type": "function", "path": "lib/doc_sync.py", "line_number": 233, "docstring": "Process a project CLAUDE.md file.", "metrics": null, "dependencies": [], "children": [] }, { "name": "_archive_files", "type": "function", "path": "lib/doc_sync.py", "line_number": 270, "docstring": "Archive migrated files.", "metrics": null, "dependencies": [], "children": [] }, { "name": "categorize_md_file", "type": "function", "path": "lib/doc_sync.py", "line_number": 282, "docstring": "Determine which KG domain a file belongs to.", "metrics": null, "dependencies": [], "children": [] }, { "name": "run_migration", "type": "function", "path": "lib/doc_sync.py", "line_number": 305, "docstring": "Run full documentation migration.", "metrics": null, "dependencies": [], "children": [] } ], "imports": [ [ "json", "" ], [ "re", "" ], [ "shutil", "" ], [ "Path", "pathlib" ], [ "Dict", "typing" ], [ "List", "typing" ], [ "Tuple", "typing" ], [ "Optional", "typing" ], [ "datetime", "datetime" ], [ "sys", "" ], [ "KnowledgeGraph", "knowledge_graph" ], [ "ENTITY_TYPES", "knowledge_graph" ], [ "argparse", "" ] ], "patterns": [] }, "lib/docker_bridge.py": { "path": "lib/docker_bridge.py", "metrics": { "total_lines": 380, "code_lines": 307, "comment_lines": 15, "blank_lines": 58, "functions": 16, "classes": 1, "imports": 11, "cyclomatic_complexity": 32 }, "components": [ { "name": "DockerBridge", "type": "class", "path": "lib/docker_bridge.py", "line_number": 27, "docstring": "Manages lazy-loaded Docker containers for Project Agents.\nExecutes tools inside containers while preserving user ownership.", "metrics": null, "dependencies": [], "children": [] }, { "name": "__init__", "type": "function", "path": "lib/docker_bridge.py", "line_number": 33, "docstring": null, "metrics": null, "dependencies": [], "children": [] }, { "name": "_get_uid", "type": "function", "path": "lib/docker_bridge.py", "line_number": 50, "docstring": "Get UID for the project user to ensure correct file ownership", "metrics": null, "dependencies": [], "children": [] }, { "name": "_get_gid", "type": "function", "path": "lib/docker_bridge.py", "line_number": 64, "docstring": "Get GID for the project user", "metrics": null, "dependencies": [], "children": [] }, { "name": "_is_running", "type": "function", "path": "lib/docker_bridge.py", "line_number": 78, "docstring": "Check if the container is currently running", "metrics": null, "dependencies": [], "children": [] }, { "name": "_update_activity", "type": "function", "path": "lib/docker_bridge.py", "line_number": 87, "docstring": "Update last activity timestamp for idle tracking", "metrics": null, "dependencies": [], "children": [] }, { "name": "ensure_running", "type": "function", "path": "lib/docker_bridge.py", "line_number": 91, "docstring": "Start container if not running (Lazy Loading). Returns True if started.", "metrics": null, "dependencies": [], "children": [] }, { "name": "execute", "type": "function", "path": "lib/docker_bridge.py", "line_number": 154, "docstring": "Run a bash command inside the container.\n\nReturns dict with:\n - success: bool\n - output: str (stdout)\n - error: str (stderr if any)\n - exit_code: int", "metrics": null, "dependencies": [], "children": [] }, { "name": "write_file", "type": "function", "path": "lib/docker_bridge.py", "line_number": 192, "docstring": "Write file inside container using 'tee'.\nFile is owned by the container user (project user).\n\nArgs:\n path: Relative path from /workspace (project home)\n content: File content to write", "metrics": null, "dependencies": [], "children": [] }, { "name": "read_file", "type": "function", "path": "lib/docker_bridge.py", "line_number": 236, "docstring": "Read file from container", "metrics": null, "dependencies": [], "children": [] }, { "name": "list_files", "type": "function", "path": "lib/docker_bridge.py", "line_number": 249, "docstring": "List files matching pattern", "metrics": null, "dependencies": [], "children": [] }, { "name": "grep", "type": "function", "path": "lib/docker_bridge.py", "line_number": 257, "docstring": "Search for pattern in files", "metrics": null, "dependencies": [], "children": [] }, { "name": "stop", "type": "function", "path": "lib/docker_bridge.py", "line_number": 268, "docstring": "Stop the container", "metrics": null, "dependencies": [], "children": [] }, { "name": "remove", "type": "function", "path": "lib/docker_bridge.py", "line_number": 275, "docstring": "Stop and remove the container", "metrics": null, "dependencies": [], "children": [] }, { "name": "status", "type": "function", "path": "lib/docker_bridge.py", "line_number": 282, "docstring": "Get container status", "metrics": null, "dependencies": [], "children": [] }, { "name": "cleanup_idle_containers", "type": "function", "path": "lib/docker_bridge.py", "line_number": 312, "docstring": "Stop containers that have been idle for too long", "metrics": null, "dependencies": [], "children": [] }, { "name": "list_project_containers", "type": "function", "path": "lib/docker_bridge.py", "line_number": 355, "docstring": "List all luzia project containers", "metrics": null, "dependencies": [], "children": [] } ], "imports": [ [ "subprocess", "" ], [ "time", "" ], [ "os", "" ], [ "json", "" ], [ "logging", "" ], [ "Optional", "typing" ], [ "Dict", "typing" ], [ "Any", "typing" ], [ "Path", "pathlib" ], [ "datetime", "datetime" ], [ "timedelta", "datetime" ] ], "patterns": [] }, "lib/__init__.py": { "path": "lib/__init__.py", "metrics": { "total_lines": 5, "code_lines": 2, "comment_lines": 1, "blank_lines": 2, "functions": 0, "classes": 0, "imports": 3, "cyclomatic_complexity": 1 }, "components": [], "imports": [ [ "DockerBridge", "docker_bridge" ], [ "cleanup_idle_containers", "docker_bridge" ], [ "list_project_containers", "docker_bridge" ] ], "patterns": [] }, "lib/structural_analysis.py": { "path": "lib/structural_analysis.py", "metrics": { "total_lines": 621, "code_lines": 508, "comment_lines": 2, "blank_lines": 111, "functions": 26, "classes": 5, "imports": 17, "cyclomatic_complexity": 58 }, "components": [ { "name": "CodeMetrics", "type": "class", "path": "lib/structural_analysis.py", "line_number": 35, "docstring": "Code complexity metrics.", "metrics": null, "dependencies": [], "children": [] }, { "name": "ComponentInfo", "type": "class", "path": "lib/structural_analysis.py", "line_number": 48, "docstring": "Information about a code component.", "metrics": null, "dependencies": [], "children": [] }, { "name": "__post_init__", "type": "function", "path": "lib/structural_analysis.py", "line_number": 59, "docstring": null, "metrics": null, "dependencies": [], "children": [] }, { "name": "to_dict", "type": "function", "path": "lib/structural_analysis.py", "line_number": 65, "docstring": "Convert to dictionary for JSON serialization.", "metrics": null, "dependencies": [], "children": [] }, { "name": "CodeStructureAnalyzer", "type": "class", "path": "lib/structural_analysis.py", "line_number": 73, "docstring": "Analyzes Python code structure using AST.", "metrics": null, "dependencies": [], "children": [] }, { "name": "__init__", "type": "function", "path": "lib/structural_analysis.py", "line_number": 76, "docstring": null, "metrics": null, "dependencies": [], "children": [] }, { "name": "analyze_file", "type": "function", "path": "lib/structural_analysis.py", "line_number": 83, "docstring": "Analyze a single Python file.", "metrics": null, "dependencies": [], "children": [] }, { "name": "analyze_directory", "type": "function", "path": "lib/structural_analysis.py", "line_number": 132, "docstring": "Analyze all Python files in a directory.", "metrics": null, "dependencies": [], "children": [] }, { "name": "build_dependency_graph", "type": "function", "path": "lib/structural_analysis.py", "line_number": 173, "docstring": "Build module dependency graph.", "metrics": null, "dependencies": [], "children": [] }, { "name": "detect_patterns", "type": "function", "path": "lib/structural_analysis.py", "line_number": 186, "docstring": "Detect common code patterns.", "metrics": null, "dependencies": [], "children": [] }, { "name": "ASTAnalyzer", "type": "class", "path": "lib/structural_analysis.py", "line_number": 200, "docstring": "AST visitor for code structure analysis.", "metrics": null, "dependencies": [], "children": [] }, { "name": "__init__", "type": "function", "path": "lib/structural_analysis.py", "line_number": 203, "docstring": null, "metrics": null, "dependencies": [], "children": [] }, { "name": "visit_Import", "type": "function", "path": "lib/structural_analysis.py", "line_number": 213, "docstring": "Handle import statements.", "metrics": null, "dependencies": [], "children": [] }, { "name": "visit_ImportFrom", "type": "function", "path": "lib/structural_analysis.py", "line_number": 219, "docstring": "Handle from...import statements.", "metrics": null, "dependencies": [], "children": [] }, { "name": "visit_ClassDef", "type": "function", "path": "lib/structural_analysis.py", "line_number": 226, "docstring": "Handle class definitions.", "metrics": null, "dependencies": [], "children": [] }, { "name": "visit_FunctionDef", "type": "function", "path": "lib/structural_analysis.py", "line_number": 246, "docstring": "Handle function definitions.", "metrics": null, "dependencies": [], "children": [] }, { "name": "visit_AsyncFunctionDef", "type": "function", "path": "lib/structural_analysis.py", "line_number": 268, "docstring": "Handle async function definitions.", "metrics": null, "dependencies": [], "children": [] }, { "name": "_detect_class_patterns", "type": "function", "path": "lib/structural_analysis.py", "line_number": 272, "docstring": "Detect design patterns in classes.", "metrics": null, "dependencies": [], "children": [] }, { "name": "_calculate_complexity", "type": "function", "path": "lib/structural_analysis.py", "line_number": 290, "docstring": "Calculate cyclomatic complexity for a function.", "metrics": null, "dependencies": [], "children": [] }, { "name": "StructuralAnalysisReport", "type": "class", "path": "lib/structural_analysis.py", "line_number": 301, "docstring": "Generates and manages structural analysis reports.", "metrics": null, "dependencies": [], "children": [] }, { "name": "__init__", "type": "function", "path": "lib/structural_analysis.py", "line_number": 304, "docstring": null, "metrics": null, "dependencies": [], "children": [] }, { "name": "generate_report", "type": "function", "path": "lib/structural_analysis.py", "line_number": 310, "docstring": "Generate comprehensive structural analysis report.", "metrics": null, "dependencies": [], "children": [] }, { "name": "_generate_insights", "type": "function", "path": "lib/structural_analysis.py", "line_number": 328, "docstring": "Generate insights from analysis data.", "metrics": null, "dependencies": [], "children": [] }, { "name": "_assess_complexity", "type": "function", "path": "lib/structural_analysis.py", "line_number": 341, "docstring": "Assess code complexity.", "metrics": null, "dependencies": [], "children": [] }, { "name": "_calculate_quality_metrics", "type": "function", "path": "lib/structural_analysis.py", "line_number": 362, "docstring": "Calculate code quality metrics.", "metrics": null, "dependencies": [], "children": [] }, { "name": "_identify_hotspots", "type": "function", "path": "lib/structural_analysis.py", "line_number": 381, "docstring": "Identify complex modules (hotspots).", "metrics": null, "dependencies": [], "children": [] }, { "name": "_generate_recommendations", "type": "function", "path": "lib/structural_analysis.py", "line_number": 403, "docstring": "Generate improvement recommendations.", "metrics": null, "dependencies": [], "children": [] }, { "name": "save_report", "type": "function", "path": "lib/structural_analysis.py", "line_number": 423, "docstring": "Save report to JSON file.", "metrics": null, "dependencies": [], "children": [] }, { "name": "save_to_knowledge_graph", "type": "function", "path": "lib/structural_analysis.py", "line_number": 434, "docstring": "Save analysis to shared knowledge graph.", "metrics": null, "dependencies": [], "children": [] }, { "name": "print_summary", "type": "function", "path": "lib/structural_analysis.py", "line_number": 525, "docstring": "Print human-readable summary.", "metrics": null, "dependencies": [], "children": [] }, { "name": "analyze_project", "type": "function", "path": "lib/structural_analysis.py", "line_number": 572, "docstring": "Convenience function to analyze a project.", "metrics": null, "dependencies": [], "children": [] } ], "imports": [ [ "ast", "" ], [ "json", "" ], [ "re", "" ], [ "Path", "pathlib" ], [ "Dict", "typing" ], [ "List", "typing" ], [ "Set", "typing" ], [ "Tuple", "typing" ], [ "Any", "typing" ], [ "Optional", "typing" ], [ "dataclass", "dataclasses" ], [ "asdict", "dataclasses" ], [ "datetime", "datetime" ], [ "sys", "" ], [ "KnowledgeGraph", "knowledge_graph" ], [ "RELATION_TYPES", "knowledge_graph" ], [ "argparse", "" ] ], "patterns": [ { "name": "dataclass", "class": "CodeMetrics", "line": 35 }, { "name": "dataclass", "class": "ComponentInfo", "line": 48 } ] }, "lib/queue_controller.py": { "path": "lib/queue_controller.py", "metrics": { "total_lines": 653, "code_lines": 487, "comment_lines": 60, "blank_lines": 106, "functions": 20, "classes": 1, "imports": 17, "cyclomatic_complexity": 67 }, "components": [ { "name": "validate_project_name", "type": "function", "path": "lib/queue_controller.py", "line_number": 34, "docstring": "Validate project name to prevent path traversal attacks.\n\nRules:\n- Must be alphanumeric with hyphens/underscores only\n- Cannot contain path separators or dots\n- Must be 1-32 characters\n- Cannot start with hyphen or underscore", "metrics": null, "dependencies": [], "children": [] }, { "name": "QueueController", "type": "class", "path": "lib/queue_controller.py", "line_number": 55, "docstring": "Load-aware task queue controller with fair share scheduling.", "metrics": null, "dependencies": [], "children": [] }, { "name": "__init__", "type": "function", "path": "lib/queue_controller.py", "line_number": 62, "docstring": null, "metrics": null, "dependencies": [], "children": [] }, { "name": "_ensure_dirs", "type": "function", "path": "lib/queue_controller.py", "line_number": 66, "docstring": "Create queue directory structure if needed.", "metrics": null, "dependencies": [], "children": [] }, { "name": "_load_config", "type": "function", "path": "lib/queue_controller.py", "line_number": 71, "docstring": "Load queue configuration.", "metrics": null, "dependencies": [], "children": [] }, { "name": "_atomic_write_json", "type": "function", "path": "lib/queue_controller.py", "line_number": 85, "docstring": "Write JSON atomically: write to .tmp, fsync, rename.", "metrics": null, "dependencies": [], "children": [] }, { "name": "_read_json_safe", "type": "function", "path": "lib/queue_controller.py", "line_number": 94, "docstring": "Read JSON with fallback to default on error.", "metrics": null, "dependencies": [], "children": [] }, { "name": "_read_capacity", "type": "function", "path": "lib/queue_controller.py", "line_number": 105, "docstring": "Read capacity.json with file locking.", "metrics": null, "dependencies": [], "children": [] }, { "name": "_update_capacity", "type": "function", "path": "lib/queue_controller.py", "line_number": 117, "docstring": "Update capacity.json atomically with exclusive lock.", "metrics": null, "dependencies": [], "children": [] }, { "name": "_init_capacity", "type": "function", "path": "lib/queue_controller.py", "line_number": 160, "docstring": "Initialize capacity.json with system info.", "metrics": null, "dependencies": [], "children": [] }, { "name": "_get_memory_info", "type": "function", "path": "lib/queue_controller.py", "line_number": 185, "docstring": "Get memory info from /proc/meminfo.", "metrics": null, "dependencies": [], "children": [] }, { "name": "enqueue", "type": "function", "path": "lib/queue_controller.py", "line_number": 212, "docstring": "Add task to queue.\n\nArgs:\n project: Project name\n prompt: Task prompt\n priority: 1-10 (1-3 = high, 4-10 = normal)\n skill_match: Matched skill name (optional)\n enqueued_by: User who enqueued (optional)\n\nReturns:\n Tuple of (task_id, queue_position)\n\nRaises:\n ValueError: If project name is invalid", "metrics": null, "dependencies": [], "children": [] }, { "name": "_get_queue_position", "type": "function", "path": "lib/queue_controller.py", "line_number": 263, "docstring": "Get queue position for a task.", "metrics": null, "dependencies": [], "children": [] }, { "name": "_has_capacity", "type": "function", "path": "lib/queue_controller.py", "line_number": 285, "docstring": "Check if system has capacity for new task.", "metrics": null, "dependencies": [], "children": [] }, { "name": "_get_pending_tasks", "type": "function", "path": "lib/queue_controller.py", "line_number": 298, "docstring": "Get all pending tasks sorted by priority and timestamp.", "metrics": null, "dependencies": [], "children": [] }, { "name": "_select_next_task", "type": "function", "path": "lib/queue_controller.py", "line_number": 318, "docstring": "Fair share task selection across projects.", "metrics": null, "dependencies": [], "children": [] }, { "name": "_dispatch", "type": "function", "path": "lib/queue_controller.py", "line_number": 349, "docstring": "Dispatch task to conductor and spawn container.\n\nUses atomic task claiming to prevent race conditions:\n1. Try to rename task file to .dispatching (atomic claim)\n2. If rename fails, another controller claimed it\n3. Only proceed with dispatch if claim succeeded\n\nReturns True if dispatch succeeded.", "metrics": null, "dependencies": [], "children": [] }, { "name": "_spawn_agent", "type": "function", "path": "lib/queue_controller.py", "line_number": 466, "docstring": "Spawn Claude agent for the task using luzia infrastructure.\n\nReturns job_id if successful, None otherwise.", "metrics": null, "dependencies": [], "children": [] }, { "name": "run_loop", "type": "function", "path": "lib/queue_controller.py", "line_number": 536, "docstring": "Main daemon loop - poll and dispatch.", "metrics": null, "dependencies": [], "children": [] }, { "name": "get_queue_status", "type": "function", "path": "lib/queue_controller.py", "line_number": 571, "docstring": "Get queue status for display.", "metrics": null, "dependencies": [], "children": [] }, { "name": "clear_queue", "type": "function", "path": "lib/queue_controller.py", "line_number": 607, "docstring": "Clear pending tasks. Returns count of cleared tasks.", "metrics": null, "dependencies": [], "children": [] } ], "imports": [ [ "fcntl", "" ], [ "json", "" ], [ "os", "" ], [ "re", "" ], [ "subprocess", "" ], [ "time", "" ], [ "uuid", "" ], [ "datetime", "datetime" ], [ "Path", "pathlib" ], [ "Dict", "typing" ], [ "List", "typing" ], [ "Optional", "typing" ], [ "Tuple", "typing" ], [ "Any", "typing" ], [ "sys", "" ], [ "subprocess", "" ], [ "sys", "" ] ], "patterns": [] }, "lib/knowledge_graph.py": { "path": "lib/knowledge_graph.py", "metrics": { "total_lines": 643, "code_lines": 483, "comment_lines": 33, "blank_lines": 127, "functions": 21, "classes": 1, "imports": 14, "cyclomatic_complexity": 32 }, "components": [ { "name": "get_current_user", "type": "function", "path": "lib/knowledge_graph.py", "line_number": 65, "docstring": "Get current username.", "metrics": null, "dependencies": [], "children": [] }, { "name": "get_user_groups", "type": "function", "path": "lib/knowledge_graph.py", "line_number": 70, "docstring": "Get groups for a user.", "metrics": null, "dependencies": [], "children": [] }, { "name": "check_permission", "type": "function", "path": "lib/knowledge_graph.py", "line_number": 86, "docstring": "Check if current user has permission for action on domain.\n\nArgs:\n domain: KG domain (sysadmin, users, projects, research)\n action: \"read\" or \"write\"\n\nReturns:\n True if permitted, False otherwise", "metrics": null, "dependencies": [], "children": [] }, { "name": "KnowledgeGraph", "type": "class", "path": "lib/knowledge_graph.py", "line_number": 124, "docstring": "Knowledge graph operations for a single domain.", "metrics": null, "dependencies": [], "children": [] }, { "name": "__init__", "type": "function", "path": "lib/knowledge_graph.py", "line_number": 127, "docstring": null, "metrics": null, "dependencies": [], "children": [] }, { "name": "_check_read", "type": "function", "path": "lib/knowledge_graph.py", "line_number": 136, "docstring": "Check read permission.", "metrics": null, "dependencies": [], "children": [] }, { "name": "_check_write", "type": "function", "path": "lib/knowledge_graph.py", "line_number": 144, "docstring": "Check write permission.", "metrics": null, "dependencies": [], "children": [] }, { "name": "_ensure_schema", "type": "function", "path": "lib/knowledge_graph.py", "line_number": 152, "docstring": "Create tables if they don't exist.", "metrics": null, "dependencies": [], "children": [] }, { "name": "_connect", "type": "function", "path": "lib/knowledge_graph.py", "line_number": 244, "docstring": null, "metrics": null, "dependencies": [], "children": [] }, { "name": "add_entity", "type": "function", "path": "lib/knowledge_graph.py", "line_number": 251, "docstring": "Add or update an entity.", "metrics": null, "dependencies": [], "children": [] }, { "name": "get_entity", "type": "function", "path": "lib/knowledge_graph.py", "line_number": 288, "docstring": "Get entity by name.", "metrics": null, "dependencies": [], "children": [] }, { "name": "get_entity_by_id", "type": "function", "path": "lib/knowledge_graph.py", "line_number": 314, "docstring": "Get entity by ID.", "metrics": null, "dependencies": [], "children": [] }, { "name": "list_entities", "type": "function", "path": "lib/knowledge_graph.py", "line_number": 330, "docstring": "List entities, optionally filtered by type.", "metrics": null, "dependencies": [], "children": [] }, { "name": "delete_entity", "type": "function", "path": "lib/knowledge_graph.py", "line_number": 352, "docstring": "Delete entity and its relations/observations.", "metrics": null, "dependencies": [], "children": [] }, { "name": "search", "type": "function", "path": "lib/knowledge_graph.py", "line_number": 384, "docstring": "Full-text search across entities.", "metrics": null, "dependencies": [], "children": [] }, { "name": "add_relation", "type": "function", "path": "lib/knowledge_graph.py", "line_number": 407, "docstring": "Add relation between entities.", "metrics": null, "dependencies": [], "children": [] }, { "name": "get_relations", "type": "function", "path": "lib/knowledge_graph.py", "line_number": 440, "docstring": "Get relations for an entity.", "metrics": null, "dependencies": [], "children": [] }, { "name": "add_observation", "type": "function", "path": "lib/knowledge_graph.py", "line_number": 486, "docstring": "Add observation to an entity.", "metrics": null, "dependencies": [], "children": [] }, { "name": "get_observations", "type": "function", "path": "lib/knowledge_graph.py", "line_number": 511, "docstring": "Get observations for an entity.", "metrics": null, "dependencies": [], "children": [] }, { "name": "stats", "type": "function", "path": "lib/knowledge_graph.py", "line_number": 536, "docstring": "Get KG statistics.", "metrics": null, "dependencies": [], "children": [] }, { "name": "search_all", "type": "function", "path": "lib/knowledge_graph.py", "line_number": 566, "docstring": "Search across all knowledge graphs.", "metrics": null, "dependencies": [], "children": [] }, { "name": "get_all_stats", "type": "function", "path": "lib/knowledge_graph.py", "line_number": 578, "docstring": "Get stats from all knowledge graphs.", "metrics": null, "dependencies": [], "children": [] } ], "imports": [ [ "json", "" ], [ "sqlite3", "" ], [ "uuid", "" ], [ "time", "" ], [ "os", "" ], [ "grp", "" ], [ "pwd", "" ], [ "Path", "pathlib" ], [ "Optional", "typing" ], [ "Dict", "typing" ], [ "List", "typing" ], [ "Any", "typing" ], [ "datetime", "datetime" ], [ "sys", "" ] ], "patterns": [] } }, "summary": { "total_lines": 4044, "code_lines": 3115, "comment_lines": 206, "blank_lines": 723, "functions": 149, "classes": 16, "imports": 133, "cyclomatic_complexity": 0 } }, "dependency_graph": {}, "patterns": { "singleton": [], "factory": [], "observer": [], "adapter": [], "decorator": [], "context_manager": [], "dataclass": [] }, "insights": { "complexity_assessment": { "level": "low", "cyclomatic_complexity": 0, "functions": 149, "average_complexity_per_function": 0.0, "assessment": "Average cyclomatic complexity of 0.0 per function" }, "code_quality_metrics": { "code_ratio": 77.03, "comment_ratio": 6.61, "blank_ratio": 17.88, "total_lines": 4044, "assessment": "Needs more documentation" }, "hotspots": [], "recommendations": [ "Increase code documentation - aim for 10%+ comment ratio" ] } }