{
  "complexity": {
    "Functions": [
      {
        "Name": "CANIFAGraph._should_continue",
        "FilePath": "agent\\graph.py",
        "StartLine": 91,
        "StartColumn": 4,
        "EndLine": 107,
        "Metrics": {
          "Complexity": 5,
          "Nodes": 15,
          "Edges": 20,
          "NestingDepth": 1,
          "IfStatements": 4,
          "LoopStatements": 2,
          "ExceptionHandlers": 0,
          "SwitchCases": 0
        },
        "RiskLevel": "low"
      },
      {
        "Name": "CANIFAGraph._agent_node",
        "FilePath": "agent\\graph.py",
        "StartLine": 54,
        "StartColumn": 4,
        "EndLine": 89,
        "Metrics": {
          "Complexity": 5,
          "Nodes": 11,
          "Edges": 16,
          "NestingDepth": 4,
          "IfStatements": 4,
          "LoopStatements": 1,
          "ExceptionHandlers": 0,
          "SwitchCases": 0
        },
        "RiskLevel": "low"
      }
    ],
    "Summary": {
      "TotalFunctions": 2,
      "AverageComplexity": 5,
      "MaxComplexity": 5,
      "MinComplexity": 5,
      "FilesAnalyzed": 12,
      "LowRiskFunctions": 2,
      "MediumRiskFunctions": 0,
      "HighRiskFunctions": 0,
      "ComplexityDistribution": {
        "2-5": 2
      }
    },
    "Warnings": null,
    "Errors": null,
    "GeneratedAt": "2025-12-23T10:32:02+07:00",
    "Version": "1.5.5",
    "Config": {
      "exclude_patterns": [
        "test_*.py",
        "*_test.py"
      ],
      "include_patterns": [
        "**/*.py"
      ],
      "low_threshold": 9,
      "max_complexity": 0,
      "medium_threshold": 19,
      "min_complexity": 5,
      "output_format": "json",
      "recursive": false,
      "show_details": false,
      "sort_by": "complexity"
    }
  },
  "dead_code": {
    "files": null,
    "summary": {
      "total_files": 12,
      "total_functions": 0,
      "total_findings": 0,
      "files_with_dead_code": 0,
      "functions_with_dead_code": 0,
      "critical_findings": 0,
      "warning_findings": 0,
      "info_findings": 0,
      "findings_by_reason": {},
      "total_blocks": 0,
      "dead_blocks": 0,
      "overall_dead_ratio": 0
    },
    "warnings": null,
    "errors": null,
    "generated_at": "2025-12-23T10:32:02+07:00",
    "version": "1.5.5",
    "config": {
      "context_lines": 3,
      "detect_after_break": true,
      "detect_after_continue": true,
      "detect_after_raise": true,
      "detect_after_return": true,
      "detect_unreachable_branches": true,
      "exclude_patterns": [
        "test_*.py",
        "*_test.py"
      ],
      "ignore_patterns": [],
      "include_patterns": [
        "**/*.py"
      ],
      "min_severity": "warning",
      "show_context": false,
      "sort_by": "severity"
    }
  },
  "clone": {
    "clones": [
      {
        "id": 1,
        "type": 0,
        "location": {
          "file_path": "agent\\controller.py",
          "start_line": 26,
          "end_line": 76,
          "start_col": 0,
          "end_col": 83
        },
        "hash": "",
        "size": 20,
        "line_count": 51,
        "complexity": 0
      },
      {
        "id": 2,
        "type": 0,
        "location": {
          "file_path": "agent\\controller.py",
          "start_line": 42,
          "end_line": 76,
          "start_col": 4,
          "end_col": 83
        },
        "hash": "",
        "size": 12,
        "line_count": 35,
        "complexity": 0
      },
      {
        "id": 3,
        "type": 0,
        "location": {
          "file_path": "agent\\graph.py",
          "start_line": 28,
          "end_line": 144,
          "start_col": 0,
          "end_col": 27
        },
        "hash": "",
        "size": 66,
        "line_count": 117,
        "complexity": 0
      },
      {
        "id": 4,
        "type": 0,
        "location": {
          "file_path": "agent\\graph.py",
          "start_line": 34,
          "end_line": 52,
          "start_col": 4,
          "end_col": 36
        },
        "hash": "",
        "size": 14,
        "line_count": 19,
        "complexity": 0
      },
      {
        "id": 5,
        "type": 0,
        "location": {
          "file_path": "agent\\graph.py",
          "start_line": 54,
          "end_line": 89,
          "start_col": 4,
          "end_col": 39
        },
        "hash": "",
        "size": 19,
        "line_count": 36,
        "complexity": 0
      },
      {
        "id": 6,
        "type": 0,
        "location": {
          "file_path": "agent\\graph.py",
          "start_line": 70,
          "end_line": 83,
          "start_col": 8,
          "end_col": 25
        },
        "hash": "",
        "size": 10,
        "line_count": 14,
        "complexity": 0
      },
      {
        "id": 7,
        "type": 0,
        "location": {
          "file_path": "agent\\graph.py",
          "start_line": 91,
          "end_line": 107,
          "start_col": 4,
          "end_col": 31
        },
        "hash": "",
        "size": 13,
        "line_count": 17,
        "complexity": 0
      },
      {
        "id": 8,
        "type": 0,
        "location": {
          "file_path": "agent\\graph.py",
          "start_line": 109,
          "end_line": 140,
          "start_col": 4,
          "end_col": 35
        },
        "hash": "",
        "size": 16,
        "line_count": 32,
        "complexity": 0
      },
      {
        "id": 9,
        "type": 0,
        "location": {
          "file_path": "agent\\memory.py",
          "start_line": 10,
          "end_line": 94,
          "start_col": 0,
          "end_col": 47
        },
        "hash": "",
        "size": 12,
        "line_count": 85,
        "complexity": 0
      },
      {
        "id": 10,
        "type": 0,
        "location": {
          "file_path": "agent\\models.py",
          "start_line": 10,
          "end_line": 17,
          "start_col": 0,
          "end_col": 35
        },
        "hash": "",
        "size": 28,
        "line_count": 8,
        "complexity": 0
      },
      {
        "id": 11,
        "type": 0,
        "location": {
          "file_path": "agent\\models.py",
          "start_line": 20,
          "end_line": 28,
          "start_col": 0,
          "end_col": 25
        },
        "hash": "",
        "size": 66,
        "line_count": 9,
        "complexity": 0
      },
      {
        "id": 12,
        "type": 0,
        "location": {
          "file_path": "agent\\models.py",
          "start_line": 31,
          "end_line": 43,
          "start_col": 0,
          "end_col": 64
        },
        "hash": "",
        "size": 12,
        "line_count": 13,
        "complexity": 0
      },
      {
        "id": 13,
        "type": 0,
        "location": {
          "file_path": "agent\\models.py",
          "start_line": 34,
          "end_line": 43,
          "start_col": 4,
          "end_col": 64
        },
        "hash": "",
        "size": 10,
        "line_count": 10,
        "complexity": 0
      },
      {
        "id": 14,
        "type": 0,
        "location": {
          "file_path": "agent\\tools\\data_retrieval_tool.py",
          "start_line": 28,
          "end_line": 52,
          "start_col": 0,
          "end_col": 129
        },
        "hash": "",
        "size": 53,
        "line_count": 25,
        "complexity": 0
      },
      {
        "id": 15,
        "type": 0,
        "location": {
          "file_path": "agent\\tools\\data_retrieval_tool.py",
          "start_line": 56,
          "end_line": 119,
          "start_col": 0,
          "end_col": 65
        },
        "hash": "",
        "size": 12,
        "line_count": 64,
        "complexity": 0
      },
      {
        "id": 16,
        "type": 0,
        "location": {
          "file_path": "agent\\tools\\data_retrieval_tool.py",
          "start_line": 78,
          "end_line": 119,
          "start_col": 4,
          "end_col": 65
        },
        "hash": "",
        "size": 10,
        "line_count": 42,
        "complexity": 0
      },
      {
        "id": 17,
        "type": 0,
        "location": {
          "file_path": "agent\\tools\\product_search_helpers.py",
          "start_line": 22,
          "end_line": 31,
          "start_col": 0,
          "end_col": 18
        },
        "hash": "",
        "size": 10,
        "line_count": 10,
        "complexity": 0
      },
      {
        "id": 18,
        "type": 0,
        "location": {
          "file_path": "agent\\tools\\product_search_helpers.py",
          "start_line": 55,
          "end_line": 69,
          "start_col": 0,
          "end_col": 18
        },
        "hash": "",
        "size": 12,
        "line_count": 15,
        "complexity": 0
      },
      {
        "id": 19,
        "type": 0,
        "location": {
          "file_path": "agent\\tools\\product_search_helpers.py",
          "start_line": 72,
          "end_line": 188,
          "start_col": 0,
          "end_col": 14
        },
        "hash": "",
        "size": 19,
        "line_count": 117,
        "complexity": 0
      },
      {
        "id": 20,
        "type": 0,
        "location": {
          "file_path": "agent\\tools\\product_search_helpers.py",
          "start_line": 90,
          "end_line": 185,
          "start_col": 4,
          "end_col": 26
        },
        "hash": "",
        "size": 10,
        "line_count": 96,
        "complexity": 0
      }
    ],
    "clone_pairs": [
      {
        "id": 2,
        "clone1": {
          "id": 0,
          "type": 0,
          "location": {
            "file_path": "agent\\graph.py",
            "start_line": 34,
            "end_line": 52,
            "start_col": 4,
            "end_col": 36
          },
          "hash": "",
          "size": 14,
          "line_count": 19,
          "complexity": 0
        },
        "clone2": {
          "id": 0,
          "type": 0,
          "location": {
            "file_path": "agent\\graph.py",
            "start_line": 54,
            "end_line": 89,
            "start_col": 4,
            "end_col": 39
          },
          "hash": "",
          "size": 19,
          "line_count": 36,
          "complexity": 0
        },
        "similarity": 0.9105263157894736,
        "distance": 1.7,
        "type": 3,
        "confidence": 0.9
      }
    ],
    "clone_groups": [
      {
        "id": 0,
        "clones": [
          {
            "id": 0,
            "type": 0,
            "location": {
              "file_path": "agent\\graph.py",
              "start_line": 34,
              "end_line": 52,
              "start_col": 4,
              "end_col": 36
            },
            "hash": "",
            "size": 14,
            "line_count": 19,
            "complexity": 0
          },
          {
            "id": 0,
            "type": 0,
            "location": {
              "file_path": "agent\\graph.py",
              "start_line": 54,
              "end_line": 89,
              "start_col": 4,
              "end_col": 39
            },
            "hash": "",
            "size": 19,
            "line_count": 36,
            "complexity": 0
          },
          {
            "id": 0,
            "type": 0,
            "location": {
              "file_path": "agent\\models.py",
              "start_line": 34,
              "end_line": 43,
              "start_col": 4,
              "end_col": 64
            },
            "hash": "",
            "size": 10,
            "line_count": 10,
            "complexity": 0
          }
        ],
        "type": 3,
        "similarity": 0.9552631578947368,
        "size": 3
      }
    ],
    "statistics": {
      "total_fragments": 20,
      "total_clones": 20,
      "total_clone_pairs": 1,
      "total_clone_groups": 1,
      "clones_by_type": {
        "Type-3": 1
      },
      "average_similarity": 0.9105263157894736,
      "lines_analyzed": 1216,
      "nodes_analyzed": 925,
      "files_analyzed": 12
    },
    "request": {
      "paths": [
        "agent\\__init__.py",
        "agent\\controller.py",
        "agent\\graph.py",
        "agent\\memory.py",
        "agent\\models.py",
        "agent\\nodes\\__init__.py",
        "agent\\prompt.py",
        "agent\\tools\\__init__.py",
        "agent\\tools\\customer_info_tool.py",
        "agent\\tools\\data_retrieval_tool.py",
        "agent\\tools\\get_tools.py",
        "agent\\tools\\product_search_helpers.py"
      ],
      "recursive": false,
      "include_patterns": [
        "**/*.py"
      ],
      "exclude_patterns": [
        "test_*.py",
        "*_test.py"
      ],
      "min_lines": 5,
      "min_nodes": 10,
      "similarity_threshold": 0.9,
      "max_edit_distance": 0,
      "ignore_literals": false,
      "ignore_identifiers": false,
      "skip_docstrings": false,
      "type1_threshold": 0.98,
      "type2_threshold": 0.95,
      "type3_threshold": 0.8,
      "type4_threshold": 0.75,
      "enable_dfa": true,
      "output_format": "json",
      "output_path": "",
      "no_open": false,
      "show_details": false,
      "show_content": false,
      "sort_by": "",
      "group_clones": true,
      "group_mode": "connected",
      "group_threshold": 0.8,
      "k_core_k": 0,
      "min_similarity": 0,
      "max_similarity": 1,
      "clone_types": [
        1,
        3,
        4
      ],
      "config_path": "",
      "timeout": 0,
      "lsh_enabled": "auto",
      "lsh_auto_threshold": 500,
      "lsh_similarity_threshold": 0.5,
      "lsh_bands": 32,
      "lsh_rows": 4,
      "lsh_hashes": 128
    },
    "duration_ms": 91,
    "success": true
  },
  "cbo": {
    "Classes": [
      {
        "Name": "AgentState",
        "FilePath": "agent\\models.py",
        "StartLine": 20,
        "EndLine": 28,
        "Metrics": {
          "CouplingCount": 3,
          "InheritanceDependencies": 1,
          "TypeHintDependencies": 3,
          "InstantiationDependencies": 0,
          "AttributeAccessDependencies": 0,
          "ImportDependencies": 0,
          "DependentClasses": [
            "BaseMessage",
            "add_messages",
            "TypedDict"
          ]
        },
        "RiskLevel": "low",
        "IsAbstract": false,
        "BaseClasses": [
          "TypedDict"
        ]
      },
      {
        "Name": "CANIFAGraph",
        "FilePath": "agent\\graph.py",
        "StartLine": 28,
        "EndLine": 144,
        "Metrics": {
          "CouplingCount": 1,
          "InheritanceDependencies": 0,
          "TypeHintDependencies": 1,
          "InstantiationDependencies": 0,
          "AttributeAccessDependencies": 0,
          "ImportDependencies": 0,
          "DependentClasses": [
            "BaseChatModel"
          ]
        },
        "RiskLevel": "low",
        "IsAbstract": false,
        "BaseClasses": []
      },
      {
        "Name": "QueryRequest",
        "FilePath": "agent\\models.py",
        "StartLine": 10,
        "EndLine": 17,
        "Metrics": {
          "CouplingCount": 1,
          "InheritanceDependencies": 1,
          "TypeHintDependencies": 0,
          "InstantiationDependencies": 0,
          "AttributeAccessDependencies": 0,
          "ImportDependencies": 0,
          "DependentClasses": [
            "BaseModel"
          ]
        },
        "RiskLevel": "low",
        "IsAbstract": false,
        "BaseClasses": [
          "BaseModel"
        ]
      },
      {
        "Name": "SearchParams",
        "FilePath": "agent\\tools\\data_retrieval_tool.py",
        "StartLine": 28,
        "EndLine": 52,
        "Metrics": {
          "CouplingCount": 1,
          "InheritanceDependencies": 1,
          "TypeHintDependencies": 0,
          "InstantiationDependencies": 0,
          "AttributeAccessDependencies": 0,
          "ImportDependencies": 0,
          "DependentClasses": [
            "BaseModel"
          ]
        },
        "RiskLevel": "low",
        "IsAbstract": false,
        "BaseClasses": [
          "BaseModel"
        ]
      }
    ],
    "Summary": {
      "TotalClasses": 4,
      "AverageCBO": 1.5,
      "MaxCBO": 3,
      "MinCBO": 1,
      "ClassesAnalyzed": 4,
      "FilesAnalyzed": 12,
      "LowRiskClasses": 4,
      "MediumRiskClasses": 0,
      "HighRiskClasses": 0,
      "CBODistribution": {
        "1-5": 4
      },
      "MostCoupledClasses": [
        {
          "Name": "AgentState",
          "FilePath": "agent\\models.py",
          "StartLine": 20,
          "EndLine": 28,
          "Metrics": {
            "CouplingCount": 3,
            "InheritanceDependencies": 1,
            "TypeHintDependencies": 3,
            "InstantiationDependencies": 0,
            "AttributeAccessDependencies": 0,
            "ImportDependencies": 0,
            "DependentClasses": [
              "BaseMessage",
              "add_messages",
              "TypedDict"
            ]
          },
          "RiskLevel": "low",
          "IsAbstract": false,
          "BaseClasses": [
            "TypedDict"
          ]
        },
        {
          "Name": "CANIFAGraph",
          "FilePath": "agent\\graph.py",
          "StartLine": 28,
          "EndLine": 144,
          "Metrics": {
            "CouplingCount": 1,
            "InheritanceDependencies": 0,
            "TypeHintDependencies": 1,
            "InstantiationDependencies": 0,
            "AttributeAccessDependencies": 0,
            "ImportDependencies": 0,
            "DependentClasses": [
              "BaseChatModel"
            ]
          },
          "RiskLevel": "low",
          "IsAbstract": false,
          "BaseClasses": []
        },
        {
          "Name": "QueryRequest",
          "FilePath": "agent\\models.py",
          "StartLine": 10,
          "EndLine": 17,
          "Metrics": {
            "CouplingCount": 1,
            "InheritanceDependencies": 1,
            "TypeHintDependencies": 0,
            "InstantiationDependencies": 0,
            "AttributeAccessDependencies": 0,
            "ImportDependencies": 0,
            "DependentClasses": [
              "BaseModel"
            ]
          },
          "RiskLevel": "low",
          "IsAbstract": false,
          "BaseClasses": [
            "BaseModel"
          ]
        },
        {
          "Name": "SearchParams",
          "FilePath": "agent\\tools\\data_retrieval_tool.py",
          "StartLine": 28,
          "EndLine": 52,
          "Metrics": {
            "CouplingCount": 1,
            "InheritanceDependencies": 1,
            "TypeHintDependencies": 0,
            "InstantiationDependencies": 0,
            "AttributeAccessDependencies": 0,
            "ImportDependencies": 0,
            "DependentClasses": [
              "BaseModel"
            ]
          },
          "RiskLevel": "low",
          "IsAbstract": false,
          "BaseClasses": [
            "BaseModel"
          ]
        }
      ],
      "MostDependedUponClasses": null
    },
    "Warnings": [
      "[agent\\__init__.py] No classes found in file",
      "[agent\\controller.py] No classes found in file",
      "[agent\\nodes\\__init__.py] No classes found in file",
      "[agent\\prompt.py] No classes found in file",
      "[agent\\tools\\__init__.py] No classes found in file",
      "[agent\\tools\\customer_info_tool.py] No classes found in file",
      "[agent\\tools\\get_tools.py] No classes found in file",
      "[agent\\tools\\product_search_helpers.py] No classes found in file"
    ],
    "Errors": null,
    "GeneratedAt": "2025-12-23T10:32:02+07:00",
    "Version": "1.5.5",
    "Config": {
      "includeBuiltins": false,
      "includeImports": true,
      "lowThreshold": 3,
      "maxCBO": 0,
      "mediumThreshold": 7,
      "minCBO": 0,
      "outputFormat": "json",
      "showZeros": false,
      "sortBy": "coupling"
    }
  },
  "system": {
    "DependencyAnalysis": {
      "TotalModules": 12,
      "TotalDependencies": 10,
      "RootModules": [
        "agent",
        "agent.memory",
        "agent.models",
        "agent.prompt",
        "agent.tools",
        "agent.tools.customer_info_tool",
        "agent.tools.product_search_helpers"
      ],
      "LeafModules": [
        "agent.controller",
        "agent.nodes",
        "agent.tools"
      ],
      "ModuleMetrics": {
        "agent": {
          "ModuleName": "agent",
          "Package": "",
          "FilePath": "D:\\cnf\\chatbot_canifa\\backend\\agent\\__init__.py",
          "IsPackage": true,
          "LinesOfCode": 16,
          "FunctionCount": 0,
          "ClassCount": 0,
          "PublicInterface": null,
          "AfferentCoupling": 1,
          "EfferentCoupling": 0,
          "Instability": 0,
          "Abstractness": 0,
          "Distance": 1,
          "Maintainability": 0,
          "TechnicalDebt": 0,
          "RiskLevel": "high",
          "DirectDependencies": null,
          "TransitiveDependencies": null,
          "Dependents": [
            "agent.nodes"
          ]
        },
        "agent.controller": {
          "ModuleName": "agent.controller",
          "Package": "agent",
          "FilePath": "D:\\cnf\\chatbot_canifa\\backend\\agent\\controller.py",
          "IsPackage": false,
          "LinesOfCode": 127,
          "FunctionCount": 4,
          "ClassCount": 0,
          "PublicInterface": [
            "chat_controller"
          ],
          "AfferentCoupling": 0,
          "EfferentCoupling": 4,
          "Instability": 1,
          "Abstractness": 0,
          "Distance": 0,
          "Maintainability": 0,
          "TechnicalDebt": 0,
          "RiskLevel": "low",
          "DirectDependencies": [
            "agent.graph",
            "agent.memory",
            "agent.models",
            "agent.tools.get_tools"
          ],
          "TransitiveDependencies": [
            "agent.graph",
            "agent.memory",
            "agent.models",
            "agent.prompt",
            "agent.tools.customer_info_tool",
            "agent.tools.data_retrieval_tool",
            "agent.tools.get_tools",
            "agent.tools.product_search_helpers"
          ],
          "Dependents": null
        },
        "agent.graph": {
          "ModuleName": "agent.graph",
          "Package": "agent",
          "FilePath": "D:\\cnf\\chatbot_canifa\\backend\\agent\\graph.py",
          "IsPackage": false,
          "LinesOfCode": 176,
          "FunctionCount": 8,
          "ClassCount": 1,
          "PublicInterface": [
            "CANIFAGraph",
            "build",
            "graph",
            "build_graph",
            "get_graph_manager",
            "reset_graph"
          ],
          "AfferentCoupling": 1,
          "EfferentCoupling": 2,
          "Instability": 0.6666666666666666,
          "Abstractness": 0,
          "Distance": 0.33333333333333337,
          "Maintainability": 0,
          "TechnicalDebt": 0,
          "RiskLevel": "low",
          "DirectDependencies": [
            "agent.models",
            "agent.prompt"
          ],
          "TransitiveDependencies": [
            "agent.models",
            "agent.prompt"
          ],
          "Dependents": [
            "agent.controller"
          ]
        },
        "agent.memory": {
          "ModuleName": "agent.memory",
          "Package": "agent",
          "FilePath": "D:\\cnf\\chatbot_canifa\\backend\\agent\\memory.py",
          "IsPackage": false,
          "LinesOfCode": 106,
          "FunctionCount": 5,
          "ClassCount": 1,
          "PublicInterface": [
            "SimpleMemoryManager",
            "save_messages",
            "load_messages",
            "get_memory_manager"
          ],
          "AfferentCoupling": 1,
          "EfferentCoupling": 0,
          "Instability": 0,
          "Abstractness": 0,
          "Distance": 1,
          "Maintainability": 0,
          "TechnicalDebt": 0,
          "RiskLevel": "high",
          "DirectDependencies": null,
          "TransitiveDependencies": null,
          "Dependents": [
            "agent.controller"
          ]
        },
        "agent.models": {
          "ModuleName": "agent.models",
          "Package": "agent",
          "FilePath": "D:\\cnf\\chatbot_canifa\\backend\\agent\\models.py",
          "IsPackage": false,
          "LinesOfCode": 59,
          "FunctionCount": 2,
          "ClassCount": 3,
          "PublicInterface": [
            "QueryRequest",
            "AgentState",
            "AgentConfig",
            "get_config"
          ],
          "AfferentCoupling": 2,
          "EfferentCoupling": 0,
          "Instability": 0,
          "Abstractness": 0,
          "Distance": 1,
          "Maintainability": 0,
          "TechnicalDebt": 0,
          "RiskLevel": "high",
          "DirectDependencies": null,
          "TransitiveDependencies": null,
          "Dependents": [
            "agent.controller",
            "agent.graph"
          ]
        },
        "agent.nodes": {
          "ModuleName": "agent.nodes",
          "Package": "agent",
          "FilePath": "D:\\cnf\\chatbot_canifa\\backend\\agent\\nodes\\__init__.py",
          "IsPackage": true,
          "LinesOfCode": 8,
          "FunctionCount": 0,
          "ClassCount": 0,
          "PublicInterface": null,
          "AfferentCoupling": 0,
          "EfferentCoupling": 1,
          "Instability": 1,
          "Abstractness": 0,
          "Distance": 0,
          "Maintainability": 0,
          "TechnicalDebt": 0,
          "RiskLevel": "low",
          "DirectDependencies": [
            "agent"
          ],
          "TransitiveDependencies": [
            "agent"
          ],
          "Dependents": null
        },
        "agent.prompt": {
          "ModuleName": "agent.prompt",
          "Package": "agent",
          "FilePath": "D:\\cnf\\chatbot_canifa\\backend\\agent\\prompt.py",
          "IsPackage": false,
          "LinesOfCode": 260,
          "FunctionCount": 1,
          "ClassCount": 0,
          "PublicInterface": [
            "get_system_prompt"
          ],
          "AfferentCoupling": 1,
          "EfferentCoupling": 0,
          "Instability": 0,
          "Abstractness": 0,
          "Distance": 1,
          "Maintainability": 0,
          "TechnicalDebt": 0,
          "RiskLevel": "high",
          "DirectDependencies": null,
          "TransitiveDependencies": null,
          "Dependents": [
            "agent.graph"
          ]
        },
        "agent.tools": {
          "ModuleName": "agent.tools",
          "Package": "agent",
          "FilePath": "D:\\cnf\\chatbot_canifa\\backend\\agent\\tools\\__init__.py",
          "IsPackage": true,
          "LinesOfCode": 10,
          "FunctionCount": 0,
          "ClassCount": 0,
          "PublicInterface": null,
          "AfferentCoupling": 0,
          "EfferentCoupling": 0,
          "Instability": 0,
          "Abstractness": 0,
          "Distance": 1,
          "Maintainability": 0,
          "TechnicalDebt": 0,
          "RiskLevel": "high",
          "DirectDependencies": null,
          "TransitiveDependencies": null,
          "Dependents": null
        },
        "agent.tools.customer_info_tool": {
          "ModuleName": "agent.tools.customer_info_tool",
          "Package": "agent",
          "FilePath": "D:\\cnf\\chatbot_canifa\\backend\\agent\\tools\\customer_info_tool.py",
          "IsPackage": false,
          "LinesOfCode": 59,
          "FunctionCount": 1,
          "ClassCount": 0,
          "PublicInterface": [
            "collect_customer_info"
          ],
          "AfferentCoupling": 1,
          "EfferentCoupling": 0,
          "Instability": 0,
          "Abstractness": 0,
          "Distance": 1,
          "Maintainability": 0,
          "TechnicalDebt": 0,
          "RiskLevel": "high",
          "DirectDependencies": null,
          "TransitiveDependencies": null,
          "Dependents": [
            "agent.tools.get_tools"
          ]
        },
        "agent.tools.data_retrieval_tool": {
          "ModuleName": "agent.tools.data_retrieval_tool",
          "Package": "agent",
          "FilePath": "D:\\cnf\\chatbot_canifa\\backend\\agent\\tools\\data_retrieval_tool.py",
          "IsPackage": false,
          "LinesOfCode": 181,
          "FunctionCount": 5,
          "ClassCount": 2,
          "PublicInterface": [
            "DecimalEncoder",
            "default",
            "SearchParams",
            "data_retrieval_tool"
          ],
          "AfferentCoupling": 1,
          "EfferentCoupling": 1,
          "Instability": 0.5,
          "Abstractness": 0,
          "Distance": 0.5,
          "Maintainability": 0,
          "TechnicalDebt": 0,
          "RiskLevel": "medium",
          "DirectDependencies": [
            "agent.tools.product_search_helpers"
          ],
          "TransitiveDependencies": [
            "agent.tools.product_search_helpers"
          ],
          "Dependents": [
            "agent.tools.get_tools"
          ]
        },
        "agent.tools.get_tools": {
          "ModuleName": "agent.tools.get_tools",
          "Package": "agent",
          "FilePath": "D:\\cnf\\chatbot_canifa\\backend\\agent\\tools\\get_tools.py",
          "IsPackage": false,
          "LinesOfCode": 25,
          "FunctionCount": 3,
          "ClassCount": 0,
          "PublicInterface": [
            "get_retrieval_tools",
            "get_collection_tools",
            "get_all_tools"
          ],
          "AfferentCoupling": 1,
          "EfferentCoupling": 2,
          "Instability": 0.6666666666666666,
          "Abstractness": 0,
          "Distance": 0.33333333333333337,
          "Maintainability": 0,
          "TechnicalDebt": 0,
          "RiskLevel": "low",
          "DirectDependencies": [
            "agent.tools.customer_info_tool",
            "agent.tools.data_retrieval_tool"
          ],
          "TransitiveDependencies": [
            "agent.tools.customer_info_tool",
            "agent.tools.data_retrieval_tool",
            "agent.tools.product_search_helpers"
          ],
          "Dependents": [
            "agent.controller"
          ]
        },
        "agent.tools.product_search_helpers": {
          "ModuleName": "agent.tools.product_search_helpers",
          "Package": "agent",
          "FilePath": "D:\\cnf\\chatbot_canifa\\backend\\agent\\tools\\product_search_helpers.py",
          "IsPackage": false,
          "LinesOfCode": 189,
          "FunctionCount": 6,
          "ClassCount": 0,
          "PublicInterface": [
            "build_starrocks_query"
          ],
          "AfferentCoupling": 1,
          "EfferentCoupling": 0,
          "Instability": 0,
          "Abstractness": 0,
          "Distance": 1,
          "Maintainability": 0,
          "TechnicalDebt": 0,
          "RiskLevel": "high",
          "DirectDependencies": null,
          "TransitiveDependencies": null,
          "Dependents": [
            "agent.tools.data_retrieval_tool"
          ]
        }
      },
      "DependencyMatrix": {
        "agent": {},
        "agent.controller": {
          "agent.graph": true,
          "agent.memory": true,
          "agent.models": true,
          "agent.tools.get_tools": true
        },
        "agent.graph": {
          "agent.models": true,
          "agent.prompt": true
        },
        "agent.memory": {},
        "agent.models": {},
        "agent.nodes": {
          "agent": true
        },
        "agent.prompt": {},
        "agent.tools": {},
        "agent.tools.customer_info_tool": {},
        "agent.tools.data_retrieval_tool": {
          "agent.tools.product_search_helpers": true
        },
        "agent.tools.get_tools": {
          "agent.tools.customer_info_tool": true,
          "agent.tools.data_retrieval_tool": true
        },
        "agent.tools.product_search_helpers": {}
      },
      "CircularDependencies": {
        "HasCircularDependencies": false,
        "TotalCycles": 0,
        "TotalModulesInCycles": 0,
        "CircularDependencies": null,
        "CycleBreakingSuggestions": null,
        "CoreInfrastructure": null
      },
      "CouplingAnalysis": {
        "AverageCoupling": 1.6666666666666667,
        "CouplingDistribution": null,
        "HighlyCoupledModules": [
          "agent.prompt",
          "agent.tools",
          "agent.tools.customer_info_tool",
          "agent",
          "agent.tools.product_search_helpers",
          "agent.memory",
          "agent.models"
        ],
        "LooselyCoupledModules": null,
        "AverageInstability": 0.3194444444444444,
        "StableModules": null,
        "InstableModules": null,
        "MainSequenceDeviation": 0.6805555555555557,
        "ZoneOfPain": [
          "agent.prompt",
          "agent.tools",
          "agent.tools.customer_info_tool"
        ],
        "ZoneOfUselessness": [],
        "MainSequence": null
      },
      "LongestChains": [
        {
          "From": "agent.controller",
          "To": "agent.tools.product_search_helpers",
          "Path": [
            "agent.controller",
            "agent.tools.get_tools",
            "agent.tools.data_retrieval_tool",
            "agent.tools.product_search_helpers"
          ],
          "Length": 4
        },
        {
          "From": "agent.controller",
          "To": "agent.models",
          "Path": [
            "agent.controller",
            "agent.graph",
            "agent.models"
          ],
          "Length": 3
        },
        {
          "From": "agent.controller",
          "To": "agent.tools.customer_info_tool",
          "Path": [
            "agent.controller",
            "agent.tools.get_tools",
            "agent.tools.customer_info_tool"
          ],
          "Length": 3
        },
        {
          "From": "agent.controller",
          "To": "agent.tools.data_retrieval_tool",
          "Path": [
            "agent.controller",
            "agent.tools.get_tools",
            "agent.tools.data_retrieval_tool"
          ],
          "Length": 3
        },
        {
          "From": "agent.controller",
          "To": "agent.prompt",
          "Path": [
            "agent.controller",
            "agent.graph",
            "agent.prompt"
          ],
          "Length": 3
        },
        {
          "From": "agent.tools.get_tools",
          "To": "agent.tools.product_search_helpers",
          "Path": [
            "agent.tools.get_tools",
            "agent.tools.data_retrieval_tool",
            "agent.tools.product_search_helpers"
          ],
          "Length": 3
        },
        {
          "From": "agent.controller",
          "To": "agent.memory",
          "Path": [
            "agent.controller",
            "agent.memory"
          ],
          "Length": 2
        },
        {
          "From": "agent.controller",
          "To": "agent.graph",
          "Path": [
            "agent.controller",
            "agent.graph"
          ],
          "Length": 2
        },
        {
          "From": "agent.controller",
          "To": "agent.models",
          "Path": [
            "agent.controller",
            "agent.models"
          ],
          "Length": 2
        },
        {
          "From": "agent.controller",
          "To": "agent.tools.get_tools",
          "Path": [
            "agent.controller",
            "agent.tools.get_tools"
          ],
          "Length": 2
        }
      ],
      "MaxDepth": 3
    },
    "ArchitectureAnalysis": {
      "ComplianceScore": 0.09999999999999998,
      "TotalViolations": 9,
      "TotalRules": 10,
      "LayerAnalysis": {
        "LayersAnalyzed": 2,
        "LayerViolations": [
          {
            "FromModule": "agent.controller",
            "ToModule": "agent.graph",
            "FromLayer": "presentation",
            "ToLayer": "unknown",
            "Rule": "strict_mode",
            "Severity": "warning",
            "Description": "Dependency involves unknown layer(s)",
            "Suggestion": "Assign modules to defined layers or relax strict_mode"
          },
          {
            "FromModule": "agent.controller",
            "ToModule": "agent.memory",
            "FromLayer": "presentation",
            "ToLayer": "unknown",
            "Rule": "strict_mode",
            "Severity": "warning",
            "Description": "Dependency involves unknown layer(s)",
            "Suggestion": "Assign modules to defined layers or relax strict_mode"
          },
          {
            "FromModule": "agent.controller",
            "ToModule": "agent.tools.get_tools",
            "FromLayer": "presentation",
            "ToLayer": "unknown",
            "Rule": "strict_mode",
            "Severity": "warning",
            "Description": "Dependency involves unknown layer(s)",
            "Suggestion": "Assign modules to defined layers or relax strict_mode"
          },
          {
            "FromModule": "agent.graph",
            "ToModule": "agent.models",
            "FromLayer": "unknown",
            "ToLayer": "domain",
            "Rule": "strict_mode",
            "Severity": "warning",
            "Description": "Dependency involves unknown layer(s)",
            "Suggestion": "Assign modules to defined layers or relax strict_mode"
          },
          {
            "FromModule": "agent.graph",
            "ToModule": "agent.prompt",
            "FromLayer": "unknown",
            "ToLayer": "unknown",
            "Rule": "strict_mode",
            "Severity": "warning",
            "Description": "Dependency involves unknown layer(s)",
            "Suggestion": "Assign modules to defined layers or relax strict_mode"
          },
          {
            "FromModule": "agent.nodes",
            "ToModule": "agent",
            "FromLayer": "unknown",
            "ToLayer": "unknown",
            "Rule": "strict_mode",
            "Severity": "warning",
            "Description": "Dependency involves unknown layer(s)",
            "Suggestion": "Assign modules to defined layers or relax strict_mode"
          },
          {
            "FromModule": "agent.tools.data_retrieval_tool",
            "ToModule": "agent.tools.product_search_helpers",
            "FromLayer": "unknown",
            "ToLayer": "unknown",
            "Rule": "strict_mode",
            "Severity": "warning",
            "Description": "Dependency involves unknown layer(s)",
            "Suggestion": "Assign modules to defined layers or relax strict_mode"
          },
          {
            "FromModule": "agent.tools.get_tools",
            "ToModule": "agent.tools.customer_info_tool",
            "FromLayer": "unknown",
            "ToLayer": "unknown",
            "Rule": "strict_mode",
            "Severity": "warning",
            "Description": "Dependency involves unknown layer(s)",
            "Suggestion": "Assign modules to defined layers or relax strict_mode"
          },
          {
            "FromModule": "agent.tools.get_tools",
            "ToModule": "agent.tools.data_retrieval_tool",
            "FromLayer": "unknown",
            "ToLayer": "unknown",
            "Rule": "strict_mode",
            "Severity": "warning",
            "Description": "Dependency involves unknown layer(s)",
            "Suggestion": "Assign modules to defined layers or relax strict_mode"
          }
        ],
        "LayerCoupling": {
          "presentation": {
            "domain": 1,
            "unknown": 3
          },
          "unknown": {
            "domain": 1,
            "unknown": 5
          }
        },
        "LayerCohesion": {
          "presentation": 0,
          "unknown": 0.8333333333333334
        },
        "ProblematicLayers": [
          "presentation"
        ]
      },
      "CohesionAnalysis": null,
      "ResponsibilityAnalysis": null,
      "Violations": [
        {
          "Type": "layer",
          "Severity": "warning",
          "Module": "agent.controller",
          "Target": "agent.graph",
          "Rule": "strict_mode",
          "Description": "Dependency involves unknown layer(s)",
          "Suggestion": "Assign modules to defined layers or relax strict_mode",
          "Location": null
        },
        {
          "Type": "layer",
          "Severity": "warning",
          "Module": "agent.controller",
          "Target": "agent.memory",
          "Rule": "strict_mode",
          "Description": "Dependency involves unknown layer(s)",
          "Suggestion": "Assign modules to defined layers or relax strict_mode",
          "Location": null
        },
        {
          "Type": "layer",
          "Severity": "warning",
          "Module": "agent.controller",
          "Target": "agent.tools.get_tools",
          "Rule": "strict_mode",
          "Description": "Dependency involves unknown layer(s)",
          "Suggestion": "Assign modules to defined layers or relax strict_mode",
          "Location": null
        },
        {
          "Type": "layer",
          "Severity": "warning",
          "Module": "agent.graph",
          "Target": "agent.models",
          "Rule": "strict_mode",
          "Description": "Dependency involves unknown layer(s)",
          "Suggestion": "Assign modules to defined layers or relax strict_mode",
          "Location": null
        },
        {
          "Type": "layer",
          "Severity": "warning",
          "Module": "agent.graph",
          "Target": "agent.prompt",
          "Rule": "strict_mode",
          "Description": "Dependency involves unknown layer(s)",
          "Suggestion": "Assign modules to defined layers or relax strict_mode",
          "Location": null
        },
        {
          "Type": "layer",
          "Severity": "warning",
          "Module": "agent.nodes",
          "Target": "agent",
          "Rule": "strict_mode",
          "Description": "Dependency involves unknown layer(s)",
          "Suggestion": "Assign modules to defined layers or relax strict_mode",
          "Location": null
        },
        {
          "Type": "layer",
          "Severity": "warning",
          "Module": "agent.tools.data_retrieval_tool",
          "Target": "agent.tools.product_search_helpers",
          "Rule": "strict_mode",
          "Description": "Dependency involves unknown layer(s)",
          "Suggestion": "Assign modules to defined layers or relax strict_mode",
          "Location": null
        },
        {
          "Type": "layer",
          "Severity": "warning",
          "Module": "agent.tools.get_tools",
          "Target": "agent.tools.customer_info_tool",
          "Rule": "strict_mode",
          "Description": "Dependency involves unknown layer(s)",
          "Suggestion": "Assign modules to defined layers or relax strict_mode",
          "Location": null
        },
        {
          "Type": "layer",
          "Severity": "warning",
          "Module": "agent.tools.get_tools",
          "Target": "agent.tools.data_retrieval_tool",
          "Rule": "strict_mode",
          "Description": "Dependency involves unknown layer(s)",
          "Suggestion": "Assign modules to defined layers or relax strict_mode",
          "Location": null
        }
      ],
      "SeverityBreakdown": {
        "warning": 9
      },
      "Recommendations": [
        {
          "Type": "restructure",
          "Priority": "critical",
          "Title": "Major Architecture Restructuring Required",
          "Description": "With 10.0% compliance, your architecture has significant structural issues",
          "Benefits": [
            "Improved maintainability and testability",
            "Clear separation of concerns",
            "Reduced coupling between layers"
          ],
          "Effort": "large",
          "Modules": null,
          "Steps": [
            "Identify and document current architecture patterns",
            "Define clear layer boundaries and responsibilities",
            "Create interfaces to decouple layers",
            "Gradually refactor violations starting with critical ones"
          ]
        },
        {
          "Type": "restructure",
          "Priority": "medium",
          "Title": "Improve Cohesion in presentation Layer",
          "Description": "Layer 'presentation' has low cohesion (0.00), indicating mixed responsibilities",
          "Benefits": [
            "Better separation of concerns",
            "Increased code reusability",
            "Easier to understand and maintain"
          ],
          "Effort": "medium",
          "Modules": null,
          "Steps": [
            "Review the responsibilities of modules in this layer",
            "Group related functionality together",
            "Consider splitting the layer if it has multiple distinct responsibilities"
          ]
        },
        {
          "Type": "interface",
          "Priority": "low",
          "Title": "Introduce Dependency Injection",
          "Description": "Use dependency injection to reduce coupling between layers",
          "Benefits": [
            "Better testability with mock dependencies",
            "Reduced coupling between components",
            "More flexible and maintainable code"
          ],
          "Effort": "medium",
          "Modules": null,
          "Steps": [
            "Identify tightly coupled components",
            "Create interfaces for dependencies",
            "Inject dependencies rather than creating them directly"
          ]
        }
      ],
      "RefactoringTargets": [
        "agent.controller",
        "agent.graph",
        "agent.tools.get_tools",
        "agent.nodes",
        "agent.tools.data_retrieval_tool"
      ]
    },
    "Summary": {
      "TotalModules": 0,
      "TotalPackages": 0,
      "TotalDependencies": 0,
      "ProjectRoot": "",
      "OverallQualityScore": 0,
      "MaintainabilityScore": 0,
      "ArchitectureScore": 0,
      "ModularityScore": 0,
      "TechnicalDebtHours": 0,
      "AverageCoupling": 0,
      "AverageInstability": 0,
      "CyclicDependencies": 0,
      "ArchitectureViolations": 0,
      "HighRiskModules": 0,
      "CriticalIssues": 0,
      "RefactoringCandidates": 0,
      "ArchitectureImprovements": 0
    },
    "Issues": null,
    "Recommendations": null,
    "Warnings": null,
    "Errors": null,
    "GeneratedAt": "2025-12-23T10:32:02.0572798+07:00",
    "Duration": 55,
    "Version": "1.5.5",
    "Config": null
  },
  "summary": {
    "total_files": 12,
    "analyzed_files": 12,
    "skipped_files": 0,
    "complexity_enabled": true,
    "dead_code_enabled": true,
    "clone_enabled": true,
    "cbo_enabled": true,
    "deps_enabled": true,
    "arch_enabled": true,
    "deps_total_modules": 12,
    "deps_modules_in_cycles": 0,
    "deps_max_depth": 3,
    "deps_main_sequence_deviation": 0.6805555555555557,
    "arch_compliance": 0.09999999999999998,
    "total_functions": 2,
    "average_complexity": 5,
    "high_complexity_count": 0,
    "dead_code_count": 0,
    "critical_dead_code": 0,
    "warning_dead_code": 0,
    "info_dead_code": 0,
    "total_clones": 20,
    "clone_pairs": 1,
    "clone_groups": 1,
    "code_duplication_percentage": 10,
    "cbo_classes": 4,
    "high_coupling_classes": 0,
    "medium_coupling_classes": 0,
    "average_coupling": 1.5,
    "health_score": 62,
    "grade": "C",
    "complexity_score": 75,
    "dead_code_score": 100,
    "duplication_score": 0,
    "coupling_score": 100,
    "dependency_score": 85,
    "architecture_score": 10
  },
  "generated_at": "2025-12-23T10:32:02.0958517+07:00",
  "duration_ms": 96,
  "version": "1.5.5"
}
