cohzen 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) hide show
  1. cohzen-0.2.0/.github/ISSUE_TEMPLATE/bug_report.md +34 -0
  2. cohzen-0.2.0/.github/ISSUE_TEMPLATE/config.yml +1 -0
  3. cohzen-0.2.0/.github/ISSUE_TEMPLATE/feature_request.md +26 -0
  4. cohzen-0.2.0/.github/pull_request_template.md +21 -0
  5. cohzen-0.2.0/.github/workflows/release.yml +43 -0
  6. cohzen-0.2.0/.github/workflows/tests.yml +38 -0
  7. cohzen-0.2.0/.gitignore +54 -0
  8. cohzen-0.2.0/ARCHITECTURE.md +86 -0
  9. cohzen-0.2.0/CHANGELOG.md +47 -0
  10. cohzen-0.2.0/CONTRIBUTING.md +177 -0
  11. cohzen-0.2.0/LICENSE +21 -0
  12. cohzen-0.2.0/PKG-INFO +295 -0
  13. cohzen-0.2.0/README.md +268 -0
  14. cohzen-0.2.0/docs/architecture.md +63 -0
  15. cohzen-0.2.0/docs/development.md +65 -0
  16. cohzen-0.2.0/docs/manifest.md +78 -0
  17. cohzen-0.2.0/docs/supported-frameworks.md +53 -0
  18. cohzen-0.2.0/examples/customer-flow/README.md +90 -0
  19. cohzen-0.2.0/examples/customer-flow/app.py +120 -0
  20. cohzen-0.2.0/examples/customer-flow/sitecustomize.py +6 -0
  21. cohzen-0.2.0/examples/langgraph-basic/README.md +12 -0
  22. cohzen-0.2.0/examples/langgraph-basic/app.py +29 -0
  23. cohzen-0.2.0/examples/langgraph-routing/README.md +17 -0
  24. cohzen-0.2.0/examples/langgraph-routing/supervisor.py +48 -0
  25. cohzen-0.2.0/examples/langgraph-tools/README.md +17 -0
  26. cohzen-0.2.0/examples/langgraph-tools/agent_tools.py +39 -0
  27. cohzen-0.2.0/examples/researcher-flow/README.md +127 -0
  28. cohzen-0.2.0/examples/researcher-flow/app.py +274 -0
  29. cohzen-0.2.0/examples/researcher-flow/sitecustomize.py +6 -0
  30. cohzen-0.2.0/examples/search-summary/README.md +50 -0
  31. cohzen-0.2.0/examples/search-summary/app.py +151 -0
  32. cohzen-0.2.0/examples/search-summary/sitecustomize.py +6 -0
  33. cohzen-0.2.0/nb.ipynb +788 -0
  34. cohzen-0.2.0/pyproject.toml +49 -0
  35. cohzen-0.2.0/src/cz/__init__.py +28 -0
  36. cohzen-0.2.0/src/cz/audit/__init__.py +21 -0
  37. cohzen-0.2.0/src/cz/audit/agentops/__init__.py +5 -0
  38. cohzen-0.2.0/src/cz/audit/agentops/detector.py +34 -0
  39. cohzen-0.2.0/src/cz/audit/arize_phoenix/__init__.py +5 -0
  40. cohzen-0.2.0/src/cz/audit/arize_phoenix/detector.py +34 -0
  41. cohzen-0.2.0/src/cz/audit/base.py +37 -0
  42. cohzen-0.2.0/src/cz/audit/engine.py +65 -0
  43. cohzen-0.2.0/src/cz/audit/langfuse/__init__.py +5 -0
  44. cohzen-0.2.0/src/cz/audit/langfuse/detector.py +34 -0
  45. cohzen-0.2.0/src/cz/audit/langsmith/__init__.py +5 -0
  46. cohzen-0.2.0/src/cz/audit/langsmith/detector.py +34 -0
  47. cohzen-0.2.0/src/cz/audit/opentelemetry/__init__.py +5 -0
  48. cohzen-0.2.0/src/cz/audit/opentelemetry/detector.py +44 -0
  49. cohzen-0.2.0/src/cz/audit/registry.py +192 -0
  50. cohzen-0.2.0/src/cz/audit/traceloop/__init__.py +5 -0
  51. cohzen-0.2.0/src/cz/audit/traceloop/detector.py +34 -0
  52. cohzen-0.2.0/src/cz/audit/wandb/__init__.py +5 -0
  53. cohzen-0.2.0/src/cz/audit/wandb/detector.py +34 -0
  54. cohzen-0.2.0/src/cz/cli/__init__.py +5 -0
  55. cohzen-0.2.0/src/cz/cli/main.py +757 -0
  56. cohzen-0.2.0/src/cz/detectors/__init__.py +18 -0
  57. cohzen-0.2.0/src/cz/detectors/base.py +70 -0
  58. cohzen-0.2.0/src/cz/detectors/langgraph/__init__.py +5 -0
  59. cohzen-0.2.0/src/cz/detectors/langgraph/scanner.py +345 -0
  60. cohzen-0.2.0/src/cz/detectors/llm/__init__.py +6 -0
  61. cohzen-0.2.0/src/cz/detectors/llm/anthropic/__init__.py +5 -0
  62. cohzen-0.2.0/src/cz/detectors/llm/anthropic/detector.py +46 -0
  63. cohzen-0.2.0/src/cz/detectors/llm/base.py +26 -0
  64. cohzen-0.2.0/src/cz/detectors/llm/google/__init__.py +5 -0
  65. cohzen-0.2.0/src/cz/detectors/llm/google/detector.py +47 -0
  66. cohzen-0.2.0/src/cz/detectors/llm/grok/__init__.py +5 -0
  67. cohzen-0.2.0/src/cz/detectors/llm/grok/detector.py +46 -0
  68. cohzen-0.2.0/src/cz/detectors/llm/groq/__init__.py +5 -0
  69. cohzen-0.2.0/src/cz/detectors/llm/groq/detector.py +47 -0
  70. cohzen-0.2.0/src/cz/detectors/llm/langchain/__init__.py +5 -0
  71. cohzen-0.2.0/src/cz/detectors/llm/langchain/detector.py +58 -0
  72. cohzen-0.2.0/src/cz/detectors/llm/litellm/__init__.py +5 -0
  73. cohzen-0.2.0/src/cz/detectors/llm/litellm/detector.py +46 -0
  74. cohzen-0.2.0/src/cz/detectors/llm/openai/__init__.py +5 -0
  75. cohzen-0.2.0/src/cz/detectors/llm/openai/detector.py +46 -0
  76. cohzen-0.2.0/src/cz/detectors/llm/registry.py +50 -0
  77. cohzen-0.2.0/src/cz/detectors/registry.py +29 -0
  78. cohzen-0.2.0/src/cz/detectors/tools/__init__.py +5 -0
  79. cohzen-0.2.0/src/cz/detectors/tools/detector.py +46 -0
  80. cohzen-0.2.0/src/cz/execution/__init__.py +45 -0
  81. cohzen-0.2.0/src/cz/execution/callbacks.py +466 -0
  82. cohzen-0.2.0/src/cz/execution/context.py +260 -0
  83. cohzen-0.2.0/src/cz/execution/debugger.py +520 -0
  84. cohzen-0.2.0/src/cz/execution/instrumentation.py +456 -0
  85. cohzen-0.2.0/src/cz/execution/manifest_matcher.py +87 -0
  86. cohzen-0.2.0/src/cz/execution/models.py +67 -0
  87. cohzen-0.2.0/src/cz/execution/processor.py +79 -0
  88. cohzen-0.2.0/src/cz/execution/serializer.py +157 -0
  89. cohzen-0.2.0/src/cz/execution/sqlite.py +422 -0
  90. cohzen-0.2.0/src/cz/execution/store.py +67 -0
  91. cohzen-0.2.0/src/cz/formatters/__init__.py +9 -0
  92. cohzen-0.2.0/src/cz/formatters/console.py +616 -0
  93. cohzen-0.2.0/src/cz/formatters/execution_fmt.py +452 -0
  94. cohzen-0.2.0/src/cz/formatters/json_fmt.py +16 -0
  95. cohzen-0.2.0/src/cz/formatters/mermaid.py +220 -0
  96. cohzen-0.2.0/src/cz/formatters/viewer.py +741 -0
  97. cohzen-0.2.0/src/cz/manifest/__init__.py +29 -0
  98. cohzen-0.2.0/src/cz/manifest/schema.py +157 -0
  99. cohzen-0.2.0/src/cz/scanner/__init__.py +40 -0
  100. cohzen-0.2.0/src/cz/scanner/engine.py +214 -0
  101. cohzen-0.2.0/src/cz/scanner/models.py +447 -0
  102. cohzen-0.2.0/src/cz/scanner/utils.py +80 -0
  103. cohzen-0.2.0/src/cz/scanner/visitor.py +352 -0
  104. cohzen-0.2.0/tests/__init__.py +1 -0
  105. cohzen-0.2.0/tests/fixtures/real_world/01_single_file.py +27 -0
  106. cohzen-0.2.0/tests/fixtures/real_world/02_graph_split_across_modules/graph.py +13 -0
  107. cohzen-0.2.0/tests/fixtures/real_world/02_graph_split_across_modules/nodes.py +13 -0
  108. cohzen-0.2.0/tests/fixtures/real_world/02_graph_split_across_modules/state.py +6 -0
  109. cohzen-0.2.0/tests/fixtures/real_world/03_multiple_graphs/ingestion_pipeline.py +21 -0
  110. cohzen-0.2.0/tests/fixtures/real_world/03_multiple_graphs/query_pipeline.py +21 -0
  111. cohzen-0.2.0/tests/fixtures/real_world/04_imported_nodes/app.py +13 -0
  112. cohzen-0.2.0/tests/fixtures/real_world/05_imported_tools/app.py +24 -0
  113. cohzen-0.2.0/tests/fixtures/real_world/06_factory_created_graph/factory.py +22 -0
  114. cohzen-0.2.0/tests/fixtures/real_world/07_conditional_routing/router_graph.py +39 -0
  115. cohzen-0.2.0/tests/fixtures/real_world/08_toolnode_and_bind_tools/combo.py +28 -0
  116. cohzen-0.2.0/tests/fixtures/real_world/09_subgraphs/nested.py +27 -0
  117. cohzen-0.2.0/tests/fixtures/real_world/10_dynamic_or_partially_unresolvable/dynamic_app.py +26 -0
  118. cohzen-0.2.0/tests/fixtures/sample_graphs/.env.example +4 -0
  119. cohzen-0.2.0/tests/fixtures/sample_graphs/agent_with_tools_and_tracing.py +67 -0
  120. cohzen-0.2.0/tests/fixtures/sample_graphs/multi_agent_router.py +45 -0
  121. cohzen-0.2.0/tests/fixtures/sample_graphs/requirements.txt +4 -0
  122. cohzen-0.2.0/tests/fixtures/sample_graphs/simple_graph.py +27 -0
  123. cohzen-0.2.0/tests/test_agents_and_llms.py +111 -0
  124. cohzen-0.2.0/tests/test_callbacks_and_instrumentation.py +135 -0
  125. cohzen-0.2.0/tests/test_cli_and_formatters.py +217 -0
  126. cohzen-0.2.0/tests/test_cli_v02.py +159 -0
  127. cohzen-0.2.0/tests/test_debugger.py +80 -0
  128. cohzen-0.2.0/tests/test_engine_and_ignores.py +103 -0
  129. cohzen-0.2.0/tests/test_execution_context.py +141 -0
  130. cohzen-0.2.0/tests/test_execution_models.py +74 -0
  131. cohzen-0.2.0/tests/test_execution_processor.py +47 -0
  132. cohzen-0.2.0/tests/test_execution_store_sqlite.py +157 -0
  133. cohzen-0.2.0/tests/test_framework_registry.py +60 -0
  134. cohzen-0.2.0/tests/test_graphs_and_compilation.py +120 -0
  135. cohzen-0.2.0/tests/test_llm_providers.py +95 -0
  136. cohzen-0.2.0/tests/test_manifest_matcher.py +50 -0
  137. cohzen-0.2.0/tests/test_observability_audit.py +114 -0
  138. cohzen-0.2.0/tests/test_observability_providers.py +46 -0
  139. cohzen-0.2.0/tests/test_real_world_fixtures.py +191 -0
  140. cohzen-0.2.0/tests/test_routing_and_edges.py +110 -0
  141. cohzen-0.2.0/tests/test_scanner.py +186 -0
  142. cohzen-0.2.0/tests/test_serializer.py +76 -0
  143. cohzen-0.2.0/tests/test_tools_and_nodes.py +91 -0
  144. cohzen-0.2.0/tests/test_waterfall_and_tree.py +75 -0
  145. cohzen-0.2.0/uv.lock +533 -0
@@ -0,0 +1,34 @@
1
+ ---
2
+ name: Bug report
3
+ about: Create a report to help us improve Cohzen
4
+ title: "[BUG] "
5
+ labels: bug
6
+ assignees: ''
7
+ ---
8
+
9
+ **Describe the bug**
10
+ A clear and concise description of what the bug is.
11
+
12
+ **To Reproduce**
13
+ Steps to reproduce the behavior:
14
+ 1. Run command: `cz scan <path>`
15
+ 2. Target codebase structure:
16
+ 3. See error output:
17
+
18
+ **Expected behavior**
19
+ A clear and concise description of what you expected to happen.
20
+
21
+ **Code Snippet / LangGraph Architecture**
22
+ If applicable, add the Python snippet causing the issue (e.g. `StateGraph`, `add_node`, `ToolNode`, custom routing):
23
+ ```python
24
+ # Paste snippet here
25
+ ```
26
+
27
+ **Environment (please complete the following information):**
28
+ - OS: [e.g. macOS, Ubuntu, Windows]
29
+ - Python Version: [e.g. 3.10.12, 3.11.8, 3.12.2]
30
+ - Cohzen Version: [e.g. `cz version` output]
31
+ - LangGraph Version: [e.g. 0.2.x]
32
+
33
+ **Additional context**
34
+ Add any other context about the problem here.
@@ -0,0 +1 @@
1
+ blank_issues_enabled: false
@@ -0,0 +1,26 @@
1
+ ---
2
+ name: Feature request
3
+ about: Suggest an idea or architectural detector for Cohzen
4
+ title: "[FEATURE] "
5
+ labels: enhancement
6
+ assignees: ''
7
+ ---
8
+
9
+ **Is your feature request related to a problem? Please describe.**
10
+ A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
11
+
12
+ **Describe the solution you'd like**
13
+ A clear and concise description of what detector, manifest field, or command enhancement you want to happen.
14
+
15
+ **Describe alternatives you've considered**
16
+ A clear and concise description of any alternative solutions or features you've considered.
17
+
18
+ **Supported Agent Framework / Pattern**
19
+ - Framework: [e.g. LangGraph, CrewAI, AutoGen, LlamaIndex Workflows]
20
+ - Code Pattern Example:
21
+ ```python
22
+ # Example graph or agent construction pattern
23
+ ```
24
+
25
+ **Additional context**
26
+ Add any other context, screenshots, or manifest examples here.
@@ -0,0 +1,21 @@
1
+ ## Description
2
+ Briefly describe the change, rationale, and problem it solves.
3
+
4
+ ## Type of Change
5
+ - [ ] Bug fix (non-breaking change which fixes an issue)
6
+ - [ ] New feature (non-breaking change which adds architectural detection capability)
7
+ - [ ] Manifest schema update (versioned contract change)
8
+ - [ ] Documentation update
9
+ - [ ] Refactoring / performance optimization
10
+
11
+ ## How Has This Been Tested?
12
+ - [ ] Added unit test in `tests/`
13
+ - [ ] Added/verified real-world fixture in `tests/fixtures/`
14
+ - [ ] Full pytest suite passed (`pytest tests/ -v`)
15
+ - [ ] CLI smoke test verified (`cz scan ...`)
16
+
17
+ ## Checklist
18
+ - [ ] My code adheres to the project style guidelines
19
+ - [ ] I have updated documentation accordingly (`docs/` and `README.md`)
20
+ - [ ] All new and existing tests passed with zero regressions
21
+ - [ ] Analysis remains 100% static AST parsing with zero runtime code execution
@@ -0,0 +1,43 @@
1
+ name: Release & Publish
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*.*.*"
7
+
8
+ jobs:
9
+ build-and-publish:
10
+ runs-on: ubuntu-latest
11
+ permissions:
12
+ contents: write
13
+ id-token: write
14
+
15
+ steps:
16
+ - name: Check out repository
17
+ uses: actions/checkout@v4
18
+
19
+ - name: Set up Python
20
+ uses: actions/setup-python@v5
21
+ with:
22
+ python-version: "3.11"
23
+
24
+ - name: Install build tools
25
+ run: |
26
+ python -m pip install --upgrade pip build hatchling
27
+
28
+ - name: Build sdist and wheel
29
+ run: |
30
+ python -m build
31
+
32
+ - name: Create GitHub Release
33
+ uses: softprops/action-gh-release@v2
34
+ with:
35
+ files: dist/*
36
+ generate_release_notes: true
37
+ env:
38
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39
+
40
+ - name: Publish to PyPI
41
+ uses: pypa/gh-action-pypi-publish@release/v1
42
+ with:
43
+ password: ${{ secrets.PYPI_API_TOKEN }}
@@ -0,0 +1,38 @@
1
+ name: Tests
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ python-version: ["3.10", "3.11", "3.12"]
15
+
16
+ steps:
17
+ - name: Check out repository
18
+ uses: actions/checkout@v4
19
+
20
+ - name: Set up Python ${{ matrix.python-version }}
21
+ uses: actions/setup-python@v5
22
+ with:
23
+ python-version: ${{ matrix.python-version }}
24
+
25
+ - name: Install dependencies
26
+ run: |
27
+ python -m pip install --upgrade pip
28
+ pip install -e ".[dev]"
29
+
30
+ - name: Run test suite with pytest & coverage
31
+ run: |
32
+ pytest --cov=cz --cov-report=xml --cov-report=term-missing tests/
33
+
34
+ - name: Verify CLI smoke test
35
+ run: |
36
+ cz --help
37
+ cz version
38
+ cz scan examples/langgraph-basic
@@ -0,0 +1,54 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ # Legacy distutils build artifact
27
+ /MANIFEST
28
+
29
+ # Virtual environments
30
+ .env
31
+ .env.local
32
+ .venv
33
+ env/
34
+ venv/
35
+ ENV/
36
+ env.bak/
37
+ venv.bak/
38
+
39
+ # Testing and coverage
40
+ .pytest_cache/
41
+ .coverage
42
+ .coverage.*
43
+ coverage.xml
44
+ htmlcov/
45
+
46
+ # IDE files
47
+ .vscode/
48
+ .idea/
49
+ *.swp
50
+ *.swo
51
+ .DS_Store
52
+
53
+ # Cohzen telemetry and local runtime data
54
+ .cohzen/
@@ -0,0 +1,86 @@
1
+ # `cz` Architecture & Design Decisions
2
+
3
+ This document details the modular, extensible architecture of the `cz` CLI package.
4
+
5
+ ---
6
+
7
+ ## 1. Architectural Philosophy
8
+
9
+ `cz` is designed as an extensible, multi-framework static scanner for AI agentic applications. To ensure maintainability, testability, and zero cross-contamination, the codebase is partitioned into isolated domain plugins:
10
+
11
+ ```
12
+ ┌────────────────────────────────────────────────────────┐
13
+ │ cz CLI │
14
+ └───────────────────────────┬────────────────────────────┘
15
+ │
16
+ ┌───────────────────────────▼────────────────────────────┐
17
+ │ Master Engine │
18
+ │ - Directory walker (respects .git, venv, node_modules)│
19
+ │ - Orchestrates Registries │
20
+ └─────────────┬─────────────┬─────────────┬──────────────┘
21
+ │ │ │
22
+ ▼ ▼ ▼
23
+ ┌──────────────────┐ ┌──────────────┐ ┌──────────────────┐
24
+ │FrameworkRegistry │ │ LLMRegistry │ │ObservabilityReg. │
25
+ │- langgraph/ │ │- openai/ │ │- langsmith/ │
26
+ │- (future crewai) │ │- anthropic/ │ │- langfuse/ │
27
+ │- (future adk) │ │- google/ │ │- opentelemetry/ │
28
+ │ │ │- groq/ │ │- arize_phoenix/ │
29
+ │ │ │- grok/ │ │- traceloop/ │
30
+ │ │ │- langchain/ │ │- agentops/ │
31
+ │ │ │- litellm/ │ │- wandb/ │
32
+ └──────────────────┘ └──────────────┘ └──────────────────┘
33
+ ```
34
+
35
+ ---
36
+
37
+ ## 2. Domain Registries
38
+
39
+ ### A. Frameworks (`src/cz/frameworks/`)
40
+ - Protocol: `BaseFrameworkScanner` (defines `visit_assign`, `visit_call`, `visit_return`, `get_graphs`).
41
+ - Primary Implementation: `src/cz/frameworks/langgraph/`
42
+ - `scanner.py`: Extracts `StateGraph`, `Graph`, `MessageGraph`, nodes, direct edges, conditional edges, `ToolNode`, and `.compile()`.
43
+ - `models.py`: LangGraph-specific models and aliases.
44
+ - Extensibility: Adding a new framework (e.g. CrewAI or Google ADK) requires only creating a folder in `src/cz/frameworks/` and implementing `BaseFrameworkScanner`.
45
+
46
+ ### B. LLM Provider Detectors (`src/cz/llms/`)
47
+ - Protocol: `BaseLLMDetector` (defines `detect_call` and `detect_tools_bound`).
48
+ - Each provider lives in its own folder:
49
+ - `openai/`: Detects `client.chat.completions.create`, models, and `tools=[...]`.
50
+ - `anthropic/`: Detects `client.messages.create`, models, and `tools=[...]`.
51
+ - `google/`: Detects `generate_content`, `generate_text`, models, and `tools=[...]`.
52
+ - `groq/`: Detects Groq client completions, models, and `tools=[...]`.
53
+ - `grok/`: Detects xAI Grok completions.
54
+ - `langchain/`: Detects `.invoke()`, `.ainvoke()`, `.stream()`, and `model.bind_tools(tools)`.
55
+ - `litellm/`: Detects `completion()`, `acompletion()`, models, and `tools=[...]`.
56
+
57
+ ### C. Observability Providers (`src/cz/observability/`)
58
+ - Protocol: `BaseObservabilityDetector` (defines `check_manifest`, `get_known_env_vars`, `get_known_decorators`).
59
+ - Each tool lives in its own folder:
60
+ - `langsmith/`
61
+ - `langfuse/`
62
+ - `opentelemetry/`
63
+ - `arize_phoenix/`
64
+ - `traceloop/`
65
+ - `agentops/`
66
+ - `wandb/`
67
+ - The `ObservabilityRegistry` computes coverage metrics and generates gap analysis.
68
+
69
+ ---
70
+
71
+ ## 3. How to Extend
72
+
73
+ ### Adding a New LLM Provider
74
+ 1. Create `src/cz/llms/<provider_name>/detector.py`.
75
+ 2. Implement `detect_call(call, file_path, lineno)` returning `Optional[LLMCallSite]`.
76
+ 3. Register the detector in `src/cz/llms/registry.py`.
77
+
78
+ ### Adding a New Observability Tool
79
+ 1. Create `src/cz/observability/<tool_name>/detector.py`.
80
+ 2. Define `provider_id`, `display_name`, `check_manifest`, `get_known_env_vars`, and `get_known_decorators`.
81
+ 3. Register the detector in `src/cz/observability/registry.py`.
82
+
83
+ ### Adding a New Agentic Framework
84
+ 1. Create `src/cz/frameworks/<framework_name>/scanner.py`.
85
+ 2. Implement `BaseFrameworkScanner`.
86
+ 3. Register in `src/cz/frameworks/registry.py`.
@@ -0,0 +1,47 @@
1
+ # Changelog
2
+
3
+ All notable changes to **Cohzen (`cz`)** will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ---
9
+
10
+ ## [0.2.0] - 2026-10-02
11
+
12
+ ### Added
13
+ - **Runtime Execution Tracking & Observability (`cz init`, `cz runs`, `cz run <id>`)**:
14
+ - Transparent LangChain / LangGraph execution tracing with zero code changes via `CohzenCallbackHandler`.
15
+ - SQLite persistent telemetry store `.cohzen/executions.db` recording run states, tokens, latency, and spans.
16
+ - Interactive terminal run viewers, detailed JSON payloads, and execution waterfall timeline graphs (`cz waterfall`).
17
+ - **Isolated Node Debugger (`cz node run`, `cz node list`, `cz debug`)**:
18
+ - Test and run individual LangGraph nodes directly in isolation without compiling or running the entire graph.
19
+ - State replay from previous executions using `--from-run <id>`.
20
+ - Smart state hydration reconstructing Pydantic models, dual-access state dicts, and LangChain message objects.
21
+ - **Interactive Browser Telemetry Viewer**:
22
+ - Visual Gantt waterfall and execution trace inspection in browser (`cz run <id> --view`).
23
+
24
+ ---
25
+
26
+ ## [0.1.0] - 2024-09-19
27
+
28
+ ### Added
29
+ - **100% Static LangGraph Architecture Reconstruction**: Statically analyzes LangGraph workflows directly from Python AST without executing any runtime code.
30
+ - **Immutable System Manifest (`CohzenManifest` v0.1.0)**:
31
+ - Canonical normalized schema representing graphs, nodes, edges, tools, and models.
32
+ - Granular source location tracking (`file`, `line_start`, `line_end`).
33
+ - Graceful degradation resolution states (`resolved`, `partially_resolved`, `unresolved`).
34
+ - Analysis limitations & completeness metadata (`unresolved_symbols`, `dynamic_constructions`, `warnings`).
35
+ - **Comprehensive Detector Suite**:
36
+ - LangGraph: `StateGraph`, `MessageGraph`, `Graph`, `add_node`, `add_edge`, `add_conditional_edges`, `compile()`, checkpointer resolution, interrupt points.
37
+ - LLM Providers: OpenAI, Anthropic, Google Gemini, Groq, xAI Grok, LiteLLM, LangChain client calls & `bind_tools`.
38
+ - Tools: `@tool` function inspection, line spans, docstrings, `ToolNode` parameter extraction.
39
+ - Observability Telemetry: Tracing decorator inspection (`@traceable`, `@observe`), manifest detection (`pyproject.toml`, `requirements.txt`), `.env` configuration audits.
40
+ - **First-Class Inline Lambda Support**: Automatically parses inline lambda handlers and routers into resolved nodes with body-level LLM inspection.
41
+ - **External Dependency Highlighting**: Explicitly identifies node and tool handlers imported from external packages (`external_package`) without conflating them with errors.
42
+ - **CLI Commands**:
43
+ - `cz scan [path]`: Interactive terminal dashboard, `--json` manifest, `--mermaid` diagram export.
44
+ - `cz audit [path]`: Observability and telemetry gap audit report with tool attribution.
45
+ - `cz view [path]`: Standalone interactive HTML browser visualizer.
46
+ - `cz version`: Version details.
47
+ - **Production Test Suite**: 56 unit, integration, and real-world fixture tests covering diverse patterns (monolithic graphs, split modules, multiple graphs, subgraphs, factory builders, conditional routing, ToolNodes).
@@ -0,0 +1,177 @@
1
+ # Contributing to Cohzen
2
+
3
+ Thank you for your interest in contributing to **Cohzen**! We welcome contributions from the community to make static agentic architecture discovery fast, accurate, and developer-friendly.
4
+
5
+ ---
6
+
7
+ ## Code of Conduct
8
+
9
+ Please be respectful, collaborative, and constructive when interacting with maintainers and other contributors.
10
+
11
+ ---
12
+
13
+ ## Development Setup
14
+
15
+ Cohzen requires **Python 3.10+**.
16
+
17
+ 1. **Clone the repository**:
18
+ ```bash
19
+ git clone https://github.com/cohzen-ai/cohzen.git
20
+ cd cohzen
21
+ ```
22
+
23
+ 2. **Create and activate a virtual environment**:
24
+ ```bash
25
+ python3 -m venv .venv
26
+ source .venv/bin/activate
27
+ ```
28
+
29
+ 3. **Install in editable mode with development dependencies**:
30
+ ```bash
31
+ pip install -e ".[dev]"
32
+ ```
33
+
34
+ 4. **Verify the installation**:
35
+ ```bash
36
+ cz version
37
+ pytest tests/ -v
38
+ ```
39
+
40
+ ---
41
+
42
+ ## Repository Structure
43
+
44
+ ```text
45
+ cohzen/
46
+ ├── .github/ # CI/CD workflows & community templates
47
+ │ ├── workflows/
48
+ │ │ ├── tests.yml # Multi-Python (3.10, 3.11, 3.12) test matrix
49
+ │ │ └── release.yml # Automated PyPI release workflow
50
+ │ ├── ISSUE_TEMPLATE/
51
+ │ │ ├── bug_report.md # Bug report template
52
+ │ │ └── feature_request.md # Feature/detector request template
53
+ │ └── pull_request_template.md # PR checklist and guidelines
54
+ │
55
+ ├── docs/ # Comprehensive technical documentation
56
+ │ ├── architecture.md # Static AST engine & pipeline architecture
57
+ │ ├── manifest.md # CohzenManifest v0.1 JSON specification
58
+ │ ├── supported-frameworks.md # Framework & LLM detector matrix
59
+ │ └── development.md # Contributor development workflow
60
+ │
61
+ ├── examples/ # Runnable standalone LangGraph examples
62
+ │ ├── langgraph-basic/ # ProcessState pipeline with MemorySaver
63
+ │ ├── langgraph-tools/ # MessagesState agent with ToolNode & lambda routing
64
+ │ └── langgraph-routing/ # Supervisor team with conditional routing & interrupts
65
+ │
66
+ ├── src/cz/ # Core codebase
67
+ │ ├── cli/ # Typer-based CLI application (`main.py`)
68
+ │ │ ├── __init__.py
69
+ │ │ └── main.py # Commands: cz scan, cz audit, cz view, cz version
70
+ │ │
71
+ │ ├── scanner/ # AST analysis engine, visitor, and data models
72
+ │ │ ├── __init__.py
73
+ │ │ ├── engine.py # Repository scan orchestrator (scan_repository, scan_file)
74
+ │ │ ├── visitor.py # AST visitor & symbol resolver (scan_python_file)
75
+ │ │ ├── utils.py # AST string & expression extractors
76
+ │ │ └── models.py # ScanResult, GraphInfo, NodeInfo, ToolDef, etc.
77
+ │ │
78
+ │ ├── manifest/ # Immutable Cohzen Manifest v0.1 Contract
79
+ │ │ ├── __init__.py
80
+ │ │ ├── schema.py # CohzenManifest, GraphDef, NodeDef, ToolDef, ModelDef
81
+ │ │ └── builder.py # Deterministic Manifest compilation
82
+ │ │
83
+ │ ├── detectors/ # Static pattern detectors
84
+ │ │ ├── __init__.py
85
+ │ │ ├── base.py # BaseFrameworkScanner, BaseLLMDetector, BaseToolDetector
86
+ │ │ ├── registry.py # FrameworkRegistry
87
+ │ │ ├── langgraph/ # LangGraph framework detector (StateGraph, nodes, edges)
88
+ │ │ ├── llm/ # Frozen v0.1 LLM provider detectors
89
+ │ │ │ ├── base.py
90
+ │ │ │ ├── registry.py # LLMRegistry
91
+ │ │ │ ├── openai/
92
+ │ │ │ ├── anthropic/
93
+ │ │ │ ├── google/
94
+ │ │ │ ├── groq/
95
+ │ │ │ ├── grok/
96
+ │ │ │ ├── langchain/
97
+ │ │ │ └── litellm/
98
+ │ │ └── tools/ # Tool detector (@tool decorators, line spans)
99
+ │ │ ├── __init__.py
100
+ │ │ └── detector.py
101
+ │ │
102
+ │ ├── audit/ # Observability & telemetry governance engine
103
+ │ │ ├── __init__.py
104
+ │ │ ├── engine.py # Audit orchestrator (audit_repository, scan_manifest_files)
105
+ │ │ ├── registry.py # Observability detector registry
106
+ │ │ ├── base.py # BaseObservabilityDetector protocol
107
+ │ │ ├── langsmith/
108
+ │ │ ├── langfuse/
109
+ │ │ ├── opentelemetry/
110
+ │ │ ├── arize_phoenix/
111
+ │ │ ├── traceloop/
112
+ │ │ ├── agentops/
113
+ │ │ └── wandb/
114
+ │ │
115
+ │ └── formatters/ # Output presentation & visualization
116
+ │ ├── __init__.py
117
+ │ ├── console.py # Rich terminal architecture & audit flow reports
118
+ │ ├── mermaid.py # LangGraph-compatible Mermaid flowchart
119
+ │ ├── json_fmt.py # Cohzen Manifest JSON serializer
120
+ │ └── viewer.py # Interactive dark-mode HTML browser visualizer
121
+ │
122
+ ├── tests/ # Test suites & fixtures
123
+ │ ├── fixtures/ # Real-world & sample test fixtures
124
+ │ │ ├── real_world/ # 10 production-pattern test projects (01 to 10)
125
+ │ │ └── sample_graphs/ # Specialized graph variations
126
+ │ ├── test_scanner.py
127
+ │ ├── test_cli_and_formatters.py
128
+ │ ├── test_real_world_fixtures.py
129
+ │ ├── test_graphs_and_compilation.py
130
+ │ ├── test_routing_and_edges.py
131
+ │ ├── test_tools_and_nodes.py
132
+ │ ├── test_agents_and_llms.py
133
+ │ ├── test_llm_providers.py
134
+ │ ├── test_observability_audit.py
135
+ │ ├── test_observability_providers.py
136
+ │ ├── test_framework_registry.py
137
+ │ └── test_engine_and_ignores.py
138
+ │
139
+ ├── .gitignore # Git ignore rules
140
+ ├── pyproject.toml # Build configuration & entrypoint (cz = "cz.cli.main:app")
141
+ ├── LICENSE # MIT License
142
+ ├── README.md # Project documentation & overview
143
+ ├── CHANGELOG.md # Version release notes
144
+ └── CONTRIBUTING.md # Contributor guide
145
+ ```
146
+
147
+ ---
148
+
149
+ ## Core Guiding Principles
150
+
151
+ When making changes to Cohzen:
152
+ 1. **Zero Runtime Execution**: Cohzen is strictly a **static AST analysis tool**. Never import or execute scanned target user code (`importlib`, `exec()`, `eval()`).
153
+ 2. **Immutable Contract**: The `CohzenManifest` (`v0.1.0`) is the single source of truth. Formats (`console`, `mermaid`, `json`, `view`) must consume discovered facts from this manifest.
154
+ 3. **Graceful Degradation**: Real-world Python can be dynamic or external. Degrade gracefully (`resolved` -> `partially_resolved` -> `unresolved`) with honest static limitations rather than crashing or guessing.
155
+
156
+ ---
157
+
158
+ ## Running Tests
159
+
160
+ Run the complete test suite:
161
+ ```bash
162
+ pytest tests/ -v
163
+ ```
164
+
165
+ Generate a test coverage report:
166
+ ```bash
167
+ pytest --cov=cz --cov-report=term-missing tests/
168
+ ```
169
+
170
+ ---
171
+
172
+ ## Pull Request Guidelines
173
+
174
+ 1. **Branch naming**: `feature/your-feature-name` or `fix/your-bug-fix`.
175
+ 2. **Include tests**: Add unit tests or real-world fixtures under `tests/` demonstrating your fix or new detection pattern.
176
+ 3. **Documentation**: Update relevant guides in `docs/` or `README.md` if CLI flags or manifest schemas change.
177
+ 4. **Clean Git history**: Ensure commits are logical and well-described.
cohzen-0.2.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Cohzen
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.