codegraph-engine 2.1.7__tar.gz → 2.1.8__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 (160) hide show
  1. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/PKG-INFO +44 -19
  2. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/README.md +43 -18
  3. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/pyproject.toml +3 -2
  4. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/__init__.py +1 -1
  5. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/cli.py +124 -47
  6. codegraph_engine-2.1.8/src/codegraph/cli_output.py +190 -0
  7. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/context.py +116 -3
  8. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/indexing/indexer.py +7 -3
  9. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/installer.py +72 -22
  10. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/mcp/server.py +89 -5
  11. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/mcp_diagnostics.py +5 -2
  12. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/monorepo.py +1 -1
  13. codegraph_engine-2.1.8/src/codegraph/process_lifecycle.py +1115 -0
  14. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph_engine.egg-info/PKG-INFO +44 -19
  15. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph_engine.egg-info/SOURCES.txt +4 -1
  16. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/tests/test_platform_resources.py +3 -1
  17. codegraph_engine-2.1.8/tests/test_windows_and_process_lifecycle.py +678 -0
  18. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/LICENSE +0 -0
  19. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/setup.cfg +0 -0
  20. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/agent.py +0 -0
  21. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/agent_brain.py +0 -0
  22. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/agent_capabilities.py +0 -0
  23. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/agent_rules.py +0 -0
  24. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/architecture.py +0 -0
  25. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/audit.py +0 -0
  26. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/binding_resolver.py +0 -0
  27. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/cache.py +0 -0
  28. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/config.py +0 -0
  29. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/constraints.py +0 -0
  30. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/database/__init__.py +0 -0
  31. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/database/extractor.py +0 -0
  32. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/database/interrogation.py +0 -0
  33. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/database/models.py +0 -0
  34. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/epistemic.py +0 -0
  35. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/errors.py +0 -0
  36. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/evidence/__init__.py +0 -0
  37. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/evidence/citations.py +0 -0
  38. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/evidence_contract.py +0 -0
  39. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/frameworks.py +0 -0
  40. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/freshness.py +0 -0
  41. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/git.py +0 -0
  42. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/graph/__init__.py +0 -0
  43. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/graph/models.py +0 -0
  44. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/graph/traversal.py +0 -0
  45. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/indexing/__init__.py +0 -0
  46. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/indexing/classifier.py +0 -0
  47. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/indexing/models.py +0 -0
  48. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/indexing/parser.py +0 -0
  49. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/indexing/scanner.py +0 -0
  50. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/indexing/telemetry.py +0 -0
  51. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/indexing/test_framework.py +0 -0
  52. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/interrogation.py +0 -0
  53. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/llm/__init__.py +0 -0
  54. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/llm/base.py +0 -0
  55. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/llm/context.py +0 -0
  56. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/mcp/__init__.py +0 -0
  57. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/memory/__init__.py +0 -0
  58. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/memory/store.py +0 -0
  59. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/models.py +0 -0
  60. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/observability.py +0 -0
  61. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/optimizer.py +0 -0
  62. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/planner.py +0 -0
  63. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/py.typed +0 -0
  64. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/query_expansion.py +0 -0
  65. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/ranking.py +0 -0
  66. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/resolver.py +0 -0
  67. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/resources/__init__.py +0 -0
  68. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/resources/cache.py +0 -0
  69. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/resources/coalescer.py +0 -0
  70. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/resources/debouncer.py +0 -0
  71. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/resources/governor.py +0 -0
  72. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/resources/monitor.py +0 -0
  73. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/resources/policy.py +0 -0
  74. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/retrieval_policy.py +0 -0
  75. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/route_composer.py +0 -0
  76. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/runtime/__init__.py +0 -0
  77. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/runtime/ingestor.py +0 -0
  78. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/runtime/models.py +0 -0
  79. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/runtime/reconciliation.py +0 -0
  80. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/search/__init__.py +0 -0
  81. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/search/hybrid.py +0 -0
  82. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/search/semantic.py +0 -0
  83. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/security/__init__.py +0 -0
  84. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/security/paths.py +0 -0
  85. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/security/redaction.py +0 -0
  86. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/semantic_decorators.py +0 -0
  87. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/target_resolver.py +0 -0
  88. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/task.py +0 -0
  89. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph/tool_selection_eval.py +0 -0
  90. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph_engine.egg-info/dependency_links.txt +0 -0
  91. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph_engine.egg-info/entry_points.txt +0 -0
  92. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph_engine.egg-info/requires.txt +0 -0
  93. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/src/codegraph_engine.egg-info/top_level.txt +0 -0
  94. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/tests/test_active_coding_protection.py +0 -0
  95. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/tests/test_adaptive_planning.py +0 -0
  96. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/tests/test_adversarial_edge_cases.py +0 -0
  97. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/tests/test_agent_ux_hardening.py +0 -0
  98. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/tests/test_agent_ux_text_search_file_inspection.py +0 -0
  99. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/tests/test_artifact_classification.py +0 -0
  100. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/tests/test_artifact_retrieval_policy.py +0 -0
  101. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/tests/test_benchmark_infra.py +0 -0
  102. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/tests/test_bounded_caches.py +0 -0
  103. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/tests/test_change_impact.py +0 -0
  104. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/tests/test_cli_doctor_privacy.py +0 -0
  105. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/tests/test_conservative_binding.py +0 -0
  106. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/tests/test_context_budget.py +0 -0
  107. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/tests/test_context_cache.py +0 -0
  108. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/tests/test_context_compiler_v2.py +0 -0
  109. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/tests/test_core.py +0 -0
  110. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/tests/test_database_integrity.py +0 -0
  111. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/tests/test_database_runtime_intelligence_and_security.py +0 -0
  112. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/tests/test_debouncer.py +0 -0
  113. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/tests/test_dependency_injection.py +0 -0
  114. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/tests/test_determinism_and_soak.py +0 -0
  115. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/tests/test_developer_audit.py +0 -0
  116. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/tests/test_epistemic_relationships.py +0 -0
  117. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/tests/test_evaluation_framework.py +0 -0
  118. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/tests/test_framework_analyzers.py +0 -0
  119. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/tests/test_framework_routes_persistence.py +0 -0
  120. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/tests/test_git_intelligence.py +0 -0
  121. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/tests/test_hardening.py +0 -0
  122. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/tests/test_interrogation_contracts.py +0 -0
  123. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/tests/test_latency_modes_and_parallel.py +0 -0
  124. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/tests/test_mcp_integration.py +0 -0
  125. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/tests/test_monorepo_packages.py +0 -0
  126. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/tests/test_package_boundaries.py +0 -0
  127. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/tests/test_phase10_context_optimization.py +0 -0
  128. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/tests/test_phase11_agent_integration.py +0 -0
  129. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/tests/test_phase12_hardening.py +0 -0
  130. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/tests/test_phase13_agent_brain_and_rc.py +0 -0
  131. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/tests/test_phase2.py +0 -0
  132. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/tests/test_ranking_engine.py +0 -0
  133. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/tests/test_reference_resolution.py +0 -0
  134. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/tests/test_registries_and_dispatch.py +0 -0
  135. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/tests/test_request_coalescer.py +0 -0
  136. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/tests/test_resource_governor.py +0 -0
  137. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/tests/test_retrieval_planner.py +0 -0
  138. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/tests/test_route_composition.py +0 -0
  139. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/tests/test_scanner_security.py +0 -0
  140. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/tests/test_semantic_decorators.py +0 -0
  141. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/tests/test_single_pass_parser.py +0 -0
  142. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/tests/test_symbol_identity.py +0 -0
  143. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/tests/test_task_ambiguity.py +0 -0
  144. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/tests/test_task_mcp_tools.py +0 -0
  145. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/tests/test_task_normalization.py +0 -0
  146. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/tests/test_task_spec.py +0 -0
  147. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/tests/test_test_intelligence.py +0 -0
  148. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/tests/test_v211_factory_resolution.py +0 -0
  149. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/tests/test_v211_features.py +0 -0
  150. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/tests/test_v211_imports_dependents_cli.py +0 -0
  151. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/tests/test_v211_recursive_frameworks.py +0 -0
  152. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/tests/test_v215_external_feedback.py +0 -0
  153. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/tests/test_v216_installer.py +0 -0
  154. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/tests/test_v217_large_repo_indexing.py +0 -0
  155. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/tests/test_v21_diagnostics.py +0 -0
  156. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/tests/test_v21_hard_exclusions.py +0 -0
  157. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/tests/test_v21_query_expansion.py +0 -0
  158. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/tests/test_v21_retrieval_policy.py +0 -0
  159. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/tests/test_v21_target_resolver.py +0 -0
  160. {codegraph_engine-2.1.7 → codegraph_engine-2.1.8}/tests/test_verify_evidence.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: codegraph-engine
3
- Version: 2.1.7
3
+ Version: 2.1.8
4
4
  Summary: Deep deterministic repository intelligence for AI coding agents (code, dependencies, databases, and runtime observations)
5
5
  Author: CodeGraph contributors
6
6
  License-Expression: MIT
@@ -35,23 +35,24 @@ Dynamic: license-file
35
35
  <img src="docs/assets/codegraph_logo.jpg" alt="CodeGraph MCP — Deep Deterministic Repository Intelligence for AI Coding Agents" width="500" />
36
36
  </p>
37
37
 
38
- <h1 align="center">CodeGraph Engine (v2.1.7)</h1>
38
+ <h1 align="center">CodeGraph Engine (v2.1.8)</h1>
39
39
 
40
40
  <p align="center">
41
41
  <strong>Deep deterministic repository intelligence for AI coding agents.</strong>
42
42
  </p>
43
43
 
44
44
  <p align="center">
45
- <a href="https://github.com/raghurammrsd/CODE_GRAPH_MCP"><img src="https://img.shields.io/badge/package-codegraph--engine%20v2.1.7-blue.svg" alt="Package: codegraph-engine v2.1.7" /></a>
45
+ <a href="https://pypi.org/project/codegraph-engine/2.1.8/"><img src="https://img.shields.io/badge/pypi-codegraph--engine%20v2.1.8-blue.svg" alt="PyPI: codegraph-engine v2.1.8" /></a>
46
46
  <a href="pyproject.toml"><img src="https://img.shields.io/badge/python-3.12%20%7C%203.13-3776AB.svg" alt="Python 3.12 | 3.13" /></a>
47
47
  <a href="src/codegraph/mcp/server.py"><img src="https://img.shields.io/badge/MCP-14%20default%20%7C%2056%20full%20tools-2ea043.svg" alt="MCP Tools: 14 default | 56 full" /></a>
48
- <a href="tests/"><img src="https://img.shields.io/badge/pytest-842%20passed-brightgreen.svg" alt="Tests: 842 passed" /></a>
48
+ <a href="tests/"><img src="https://img.shields.io/badge/pytest-853%20passed-brightgreen.svg" alt="Tests: 853 passed" /></a>
49
49
  <a href="pyproject.toml"><img src="https://img.shields.io/badge/ruff-0%20errors-success.svg" alt="Ruff: 0 errors" /></a>
50
- <a href="src/codegraph/"><img src="https://img.shields.io/badge/mypy-0%20issues%20(77%20files)-blue.svg" alt="Mypy: strict" /></a>
50
+ <a href="src/codegraph/"><img src="https://img.shields.io/badge/mypy-0%20issues%20(79%20files)-blue.svg" alt="Mypy: strict" /></a>
51
51
  <a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT" /></a>
52
52
  </p>
53
53
 
54
54
  <p align="center">
55
+ <a href="https://pypi.org/project/codegraph-engine/2.1.8/"><strong>PyPI (v2.1.8)</strong></a> •
55
56
  <a href="#2-quickstart-30-second-setup"><strong>Quickstart</strong></a> •
56
57
  <a href="#1-built-for-aiml-and-backend-heavy-repositories"><strong>Built For</strong></a> •
57
58
  <a href="#5-database-intelligence"><strong>Database Intelligence</strong></a> •
@@ -147,18 +148,31 @@ codegraph status
147
148
  codegraph doctor
148
149
  ```
149
150
 
150
- ### Managing Installation & Project Index Lifecycle
151
+ > **Dynamic Index Hot-Reloading:** If your AI coding agent launches `codegraph mcp serve` before you run `codegraph init`, you do **not** need to restart your IDE or MCP session. As soon as `codegraph init` or `codegraph index` creates or updates `.codegraph.sqlite3`, the running MCP server automatically detects the updated database on the next tool call and refreshes its in-memory graph cache (`get_repository_status(reload=True, reindex=True)` can also be invoked directly by the agent).
151
152
 
152
- CodeGraph cleanly separates agent configuration from project index files:
153
+ ### Managing Installation, Process & Project Index Lifecycle
154
+
155
+ CodeGraph cleanly separates agent configuration, process lifecycle, and project index files:
153
156
 
154
157
  | Command | Scope | What It Does |
155
158
  | :--- | :--- | :--- |
156
- | `codegraph install` | Agent configuration | Configures MCP server + marker-managed rules/skills for selected AI agents. |
157
- | `codegraph init` | Project repository | Initializes `.codegraph.sqlite3` and indexes the current repository. |
159
+ | `codegraph install` | Agent configuration | Configures MCP server + marker-managed rules/skills for selected AI agents (ASCII-safe on Windows `cp1252`). |
160
+ | `codegraph init` | Project repository | Initializes `.codegraph.sqlite3` and indexes the current repository (hot-reloaded automatically by running MCP servers). |
158
161
  | `codegraph index` | Project repository | Incrementally indexes modified files (`--verbose`, `--quiet`, `--json`). |
159
- | `codegraph uninstall` | Agent configuration | Removes only CodeGraph-managed MCP entries and instruction blocks (preserves user config and project index). |
162
+ | `codegraph stop` | Process lifecycle | Safely stops running CodeGraph-owned MCP background processes (`--all`, `--repo`, `--json`) and releases file locks. |
163
+ | `codegraph doctor --processes` | Process lifecycle | Lists active CodeGraph MCP processes, parent PIDs, orphan status, and cleans stale PID files. |
164
+ | `codegraph uninstall` | Agent configuration | Stops active workspace MCP processes and removes CodeGraph-managed MCP entries and instruction blocks. |
160
165
  | `codegraph uninit` | Project repository | Removes only `.codegraph.sqlite3` and `.codegraph/` in the project (never touches source code or Git history). |
161
166
 
167
+ ### Safe Upgrading on Windows (`WinError 32` Prevention)
168
+
169
+ On Windows, running `pip install --upgrade codegraph-engine` while an IDE or agent still holds `codegraph.exe` open can trigger `WinError 32`. Before upgrading on Windows, run:
170
+
171
+ ```bash
172
+ codegraph stop --all
173
+ pip install --upgrade "codegraph-engine[mcp]"
174
+ ```
175
+
162
176
  ---
163
177
 
164
178
  ## 3. Core Workflow & Architecture
@@ -419,20 +433,23 @@ Rather than claiming a single universal token reduction percentage across all po
419
433
  | **Compression at `budget = 200 tokens`** | `85.6%` reduction | [`benchmarks/baselines/context_baseline.json`](benchmarks/baselines/context_baseline.json) |
420
434
  | **Compression at `budget = 600 tokens`** | `56.3%` reduction | [`benchmarks/baselines/context_baseline.json`](benchmarks/baselines/context_baseline.json) |
421
435
  | **Cold vs. Warm `get_context` Latency (`p50`)** | `20.0 ms` cold → `0.67 ms` warm (`30.0x`) | [`benchmarks/baselines/context_baseline.json`](benchmarks/baselines/context_baseline.json) |
436
+ | **Single-Tool Query Latency (Indexed SQLite)** | `1 ms – 15 ms` | Local SQLite B-tree / FTS5 lookup |
422
437
  | **FACT / UNKNOWN / AMBIGUITY Correctness** | `100.0%` / `98.0%` / `100.0%` | [`benchmarks/baselines/v2_0_verified.json`](benchmarks/baselines/v2_0_verified.json) |
423
438
 
424
439
  ### Results from the 32-Task Internal Evaluation ([`src/codegraph/tool_selection_eval.py`](src/codegraph/tool_selection_eval.py))
425
440
 
426
- The table below reports results from the **32-task internal evaluation harness** (`run_tool_selection_ab_benchmark()`) comparing Mode A (unassisted exploration without CodeGraph routing rules) against Mode B (CodeGraph MCP + agent routing rules) on the same 32 tasks:
441
+ The table below reports results from the **32-task internal evaluation harness** (`run_tool_selection_ab_benchmark()`) comparing Mode A (unassisted `grep` + full-file reading without CodeGraph routing rules) against Mode B (CodeGraph MCP + agent routing rules) on the same 32 tasks:
427
442
 
428
- | Metric (32-Task Internal Evaluation) | Mode A (Baseline) | Mode B (CodeGraph MCP) | Delta |
443
+ | Metric (32-Task Internal Evaluation) | Mode A (Without CodeGraph) | Mode B (With CodeGraph MCP) | Measured Improvement |
429
444
  | :--- | ---: | ---: | :--- |
430
- | **Total Tool Calls** | `164` | `71` | `-93 calls (-56.7%)` |
431
- | **Direct Full-File Reads** | `161` | `7` | `-154 file reads (-95.7%)` |
432
- | **First-Tool Selection Accuracy** | `9.38%` | `100.0%` | `+90.62%` |
433
- | **Unsupported Claims** | `11 (34.38%)` | `0 (0.00%)` | `-11 claims` |
434
- | **Task Accuracy** | `59.84%` | `100.0%` | `+40.16%` |
435
- | **12-Prompt Natural-Language Routing Eval** | — | `12 / 12 (100.0%)` | `12/12 on this evaluation set` |
445
+ | **Total Tool Calls (32 Tasks)** | `164 calls` (`~5.1 / task`) | `71 calls` (`~2.2 / task`) | **`-93 calls (-56.7% fewer tool calls)`** |
446
+ | **Direct Full-File Reads** | `161 full-file reads` | `7 bounded slice reads` | **`-154 file reads (-95.7% fewer file reads)`** |
447
+ | **Context Tokens per Task** | `3,000 – 12,000+ tokens` (full files) | `~542 tokens` avg (`get_context`) | **`65.0% – 85.6% token reduction`** |
448
+ | **Query Latency (`p50`)** | Hundreds of ms (multi-step `grep` + reads) | `20.0 ms` cold / `0.67 ms` warm (`30.0x`) | **Sub-20ms indexed lookup** |
449
+ | **First-Tool Selection Accuracy** | `9.38%` | `100.0%` | **`+90.62%`** |
450
+ | **Unsupported Claims (Hallucinated Edges)** | `11 (34.38%)` | `0 (0.00%)` | **`-11 claims (0% unsupported)`** |
451
+ | **Task Accuracy** | `59.84%` | `100.0%` | **`+40.16%`** |
452
+ | **12-Prompt Natural-Language Routing Eval** | — | `12 / 12 (100.0%)` | **`12/12 on this evaluation set`** |
436
453
 
437
454
  ![CodeGraph — Measured Context & Exploration Efficiency](docs/assets/performance_comparison.svg)
438
455
 
@@ -540,6 +557,12 @@ codegraph index . --verbose # Incremental index w
540
557
  codegraph index . --json # Output structured JSON phase telemetry
541
558
  codegraph uninit --dry-run # Preview removal of .codegraph.sqlite3
542
559
 
560
+ # Process Lifecycle & Upgrade Lock Safety
561
+ codegraph stop # Safely stop CodeGraph MCP server for current repo
562
+ codegraph stop --all # Stop all CodeGraph-owned MCP processes across repos
563
+ codegraph stop --repo /path/to/repo --json # Stop MCP processes for a specific repo (JSON output)
564
+ codegraph doctor --processes # Inspect active MCP processes, parent PIDs, & stale locks
565
+
543
566
  # Health, Integrity & Privacy Diagnostics
544
567
  codegraph status . # Show index freshness and graph counts
545
568
  codegraph doctor . --database --resources # Verify SQLite integrity, FKs, FTS, and memory
@@ -567,8 +590,10 @@ codegraph memory list -r . # Inspect repository-
567
590
  codegraph benchmark -r . # Run deterministic benchmark suite
568
591
 
569
592
  # MCP Server Subcommands
570
- codegraph mcp serve . # Start stdio MCP server
593
+ codegraph mcp serve . # Start stdio MCP server (with parent/EOF lifecycle guard)
571
594
  codegraph mcp serve . --profile full # Start stdio MCP server with all 56 tools
595
+ codegraph mcp stop # Alias for codegraph stop
596
+ codegraph mcp kill # Alias for codegraph stop (1s graceful timeout)
572
597
  codegraph mcp doctor . # End-to-end MCP startup & query check
573
598
  codegraph mcp config-check . # Read-only MCP config validation
574
599
  codegraph mcp capabilities # Print machine-readable capability manifest
@@ -2,23 +2,24 @@
2
2
  <img src="docs/assets/codegraph_logo.jpg" alt="CodeGraph MCP — Deep Deterministic Repository Intelligence for AI Coding Agents" width="500" />
3
3
  </p>
4
4
 
5
- <h1 align="center">CodeGraph Engine (v2.1.7)</h1>
5
+ <h1 align="center">CodeGraph Engine (v2.1.8)</h1>
6
6
 
7
7
  <p align="center">
8
8
  <strong>Deep deterministic repository intelligence for AI coding agents.</strong>
9
9
  </p>
10
10
 
11
11
  <p align="center">
12
- <a href="https://github.com/raghurammrsd/CODE_GRAPH_MCP"><img src="https://img.shields.io/badge/package-codegraph--engine%20v2.1.7-blue.svg" alt="Package: codegraph-engine v2.1.7" /></a>
12
+ <a href="https://pypi.org/project/codegraph-engine/2.1.8/"><img src="https://img.shields.io/badge/pypi-codegraph--engine%20v2.1.8-blue.svg" alt="PyPI: codegraph-engine v2.1.8" /></a>
13
13
  <a href="pyproject.toml"><img src="https://img.shields.io/badge/python-3.12%20%7C%203.13-3776AB.svg" alt="Python 3.12 | 3.13" /></a>
14
14
  <a href="src/codegraph/mcp/server.py"><img src="https://img.shields.io/badge/MCP-14%20default%20%7C%2056%20full%20tools-2ea043.svg" alt="MCP Tools: 14 default | 56 full" /></a>
15
- <a href="tests/"><img src="https://img.shields.io/badge/pytest-842%20passed-brightgreen.svg" alt="Tests: 842 passed" /></a>
15
+ <a href="tests/"><img src="https://img.shields.io/badge/pytest-853%20passed-brightgreen.svg" alt="Tests: 853 passed" /></a>
16
16
  <a href="pyproject.toml"><img src="https://img.shields.io/badge/ruff-0%20errors-success.svg" alt="Ruff: 0 errors" /></a>
17
- <a href="src/codegraph/"><img src="https://img.shields.io/badge/mypy-0%20issues%20(77%20files)-blue.svg" alt="Mypy: strict" /></a>
17
+ <a href="src/codegraph/"><img src="https://img.shields.io/badge/mypy-0%20issues%20(79%20files)-blue.svg" alt="Mypy: strict" /></a>
18
18
  <a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT" /></a>
19
19
  </p>
20
20
 
21
21
  <p align="center">
22
+ <a href="https://pypi.org/project/codegraph-engine/2.1.8/"><strong>PyPI (v2.1.8)</strong></a> •
22
23
  <a href="#2-quickstart-30-second-setup"><strong>Quickstart</strong></a> •
23
24
  <a href="#1-built-for-aiml-and-backend-heavy-repositories"><strong>Built For</strong></a> •
24
25
  <a href="#5-database-intelligence"><strong>Database Intelligence</strong></a> •
@@ -114,18 +115,31 @@ codegraph status
114
115
  codegraph doctor
115
116
  ```
116
117
 
117
- ### Managing Installation & Project Index Lifecycle
118
+ > **Dynamic Index Hot-Reloading:** If your AI coding agent launches `codegraph mcp serve` before you run `codegraph init`, you do **not** need to restart your IDE or MCP session. As soon as `codegraph init` or `codegraph index` creates or updates `.codegraph.sqlite3`, the running MCP server automatically detects the updated database on the next tool call and refreshes its in-memory graph cache (`get_repository_status(reload=True, reindex=True)` can also be invoked directly by the agent).
118
119
 
119
- CodeGraph cleanly separates agent configuration from project index files:
120
+ ### Managing Installation, Process & Project Index Lifecycle
121
+
122
+ CodeGraph cleanly separates agent configuration, process lifecycle, and project index files:
120
123
 
121
124
  | Command | Scope | What It Does |
122
125
  | :--- | :--- | :--- |
123
- | `codegraph install` | Agent configuration | Configures MCP server + marker-managed rules/skills for selected AI agents. |
124
- | `codegraph init` | Project repository | Initializes `.codegraph.sqlite3` and indexes the current repository. |
126
+ | `codegraph install` | Agent configuration | Configures MCP server + marker-managed rules/skills for selected AI agents (ASCII-safe on Windows `cp1252`). |
127
+ | `codegraph init` | Project repository | Initializes `.codegraph.sqlite3` and indexes the current repository (hot-reloaded automatically by running MCP servers). |
125
128
  | `codegraph index` | Project repository | Incrementally indexes modified files (`--verbose`, `--quiet`, `--json`). |
126
- | `codegraph uninstall` | Agent configuration | Removes only CodeGraph-managed MCP entries and instruction blocks (preserves user config and project index). |
129
+ | `codegraph stop` | Process lifecycle | Safely stops running CodeGraph-owned MCP background processes (`--all`, `--repo`, `--json`) and releases file locks. |
130
+ | `codegraph doctor --processes` | Process lifecycle | Lists active CodeGraph MCP processes, parent PIDs, orphan status, and cleans stale PID files. |
131
+ | `codegraph uninstall` | Agent configuration | Stops active workspace MCP processes and removes CodeGraph-managed MCP entries and instruction blocks. |
127
132
  | `codegraph uninit` | Project repository | Removes only `.codegraph.sqlite3` and `.codegraph/` in the project (never touches source code or Git history). |
128
133
 
134
+ ### Safe Upgrading on Windows (`WinError 32` Prevention)
135
+
136
+ On Windows, running `pip install --upgrade codegraph-engine` while an IDE or agent still holds `codegraph.exe` open can trigger `WinError 32`. Before upgrading on Windows, run:
137
+
138
+ ```bash
139
+ codegraph stop --all
140
+ pip install --upgrade "codegraph-engine[mcp]"
141
+ ```
142
+
129
143
  ---
130
144
 
131
145
  ## 3. Core Workflow & Architecture
@@ -386,20 +400,23 @@ Rather than claiming a single universal token reduction percentage across all po
386
400
  | **Compression at `budget = 200 tokens`** | `85.6%` reduction | [`benchmarks/baselines/context_baseline.json`](benchmarks/baselines/context_baseline.json) |
387
401
  | **Compression at `budget = 600 tokens`** | `56.3%` reduction | [`benchmarks/baselines/context_baseline.json`](benchmarks/baselines/context_baseline.json) |
388
402
  | **Cold vs. Warm `get_context` Latency (`p50`)** | `20.0 ms` cold → `0.67 ms` warm (`30.0x`) | [`benchmarks/baselines/context_baseline.json`](benchmarks/baselines/context_baseline.json) |
403
+ | **Single-Tool Query Latency (Indexed SQLite)** | `1 ms – 15 ms` | Local SQLite B-tree / FTS5 lookup |
389
404
  | **FACT / UNKNOWN / AMBIGUITY Correctness** | `100.0%` / `98.0%` / `100.0%` | [`benchmarks/baselines/v2_0_verified.json`](benchmarks/baselines/v2_0_verified.json) |
390
405
 
391
406
  ### Results from the 32-Task Internal Evaluation ([`src/codegraph/tool_selection_eval.py`](src/codegraph/tool_selection_eval.py))
392
407
 
393
- The table below reports results from the **32-task internal evaluation harness** (`run_tool_selection_ab_benchmark()`) comparing Mode A (unassisted exploration without CodeGraph routing rules) against Mode B (CodeGraph MCP + agent routing rules) on the same 32 tasks:
408
+ The table below reports results from the **32-task internal evaluation harness** (`run_tool_selection_ab_benchmark()`) comparing Mode A (unassisted `grep` + full-file reading without CodeGraph routing rules) against Mode B (CodeGraph MCP + agent routing rules) on the same 32 tasks:
394
409
 
395
- | Metric (32-Task Internal Evaluation) | Mode A (Baseline) | Mode B (CodeGraph MCP) | Delta |
410
+ | Metric (32-Task Internal Evaluation) | Mode A (Without CodeGraph) | Mode B (With CodeGraph MCP) | Measured Improvement |
396
411
  | :--- | ---: | ---: | :--- |
397
- | **Total Tool Calls** | `164` | `71` | `-93 calls (-56.7%)` |
398
- | **Direct Full-File Reads** | `161` | `7` | `-154 file reads (-95.7%)` |
399
- | **First-Tool Selection Accuracy** | `9.38%` | `100.0%` | `+90.62%` |
400
- | **Unsupported Claims** | `11 (34.38%)` | `0 (0.00%)` | `-11 claims` |
401
- | **Task Accuracy** | `59.84%` | `100.0%` | `+40.16%` |
402
- | **12-Prompt Natural-Language Routing Eval** | — | `12 / 12 (100.0%)` | `12/12 on this evaluation set` |
412
+ | **Total Tool Calls (32 Tasks)** | `164 calls` (`~5.1 / task`) | `71 calls` (`~2.2 / task`) | **`-93 calls (-56.7% fewer tool calls)`** |
413
+ | **Direct Full-File Reads** | `161 full-file reads` | `7 bounded slice reads` | **`-154 file reads (-95.7% fewer file reads)`** |
414
+ | **Context Tokens per Task** | `3,000 – 12,000+ tokens` (full files) | `~542 tokens` avg (`get_context`) | **`65.0% – 85.6% token reduction`** |
415
+ | **Query Latency (`p50`)** | Hundreds of ms (multi-step `grep` + reads) | `20.0 ms` cold / `0.67 ms` warm (`30.0x`) | **Sub-20ms indexed lookup** |
416
+ | **First-Tool Selection Accuracy** | `9.38%` | `100.0%` | **`+90.62%`** |
417
+ | **Unsupported Claims (Hallucinated Edges)** | `11 (34.38%)` | `0 (0.00%)` | **`-11 claims (0% unsupported)`** |
418
+ | **Task Accuracy** | `59.84%` | `100.0%` | **`+40.16%`** |
419
+ | **12-Prompt Natural-Language Routing Eval** | — | `12 / 12 (100.0%)` | **`12/12 on this evaluation set`** |
403
420
 
404
421
  ![CodeGraph — Measured Context & Exploration Efficiency](docs/assets/performance_comparison.svg)
405
422
 
@@ -507,6 +524,12 @@ codegraph index . --verbose # Incremental index w
507
524
  codegraph index . --json # Output structured JSON phase telemetry
508
525
  codegraph uninit --dry-run # Preview removal of .codegraph.sqlite3
509
526
 
527
+ # Process Lifecycle & Upgrade Lock Safety
528
+ codegraph stop # Safely stop CodeGraph MCP server for current repo
529
+ codegraph stop --all # Stop all CodeGraph-owned MCP processes across repos
530
+ codegraph stop --repo /path/to/repo --json # Stop MCP processes for a specific repo (JSON output)
531
+ codegraph doctor --processes # Inspect active MCP processes, parent PIDs, & stale locks
532
+
510
533
  # Health, Integrity & Privacy Diagnostics
511
534
  codegraph status . # Show index freshness and graph counts
512
535
  codegraph doctor . --database --resources # Verify SQLite integrity, FKs, FTS, and memory
@@ -534,8 +557,10 @@ codegraph memory list -r . # Inspect repository-
534
557
  codegraph benchmark -r . # Run deterministic benchmark suite
535
558
 
536
559
  # MCP Server Subcommands
537
- codegraph mcp serve . # Start stdio MCP server
560
+ codegraph mcp serve . # Start stdio MCP server (with parent/EOF lifecycle guard)
538
561
  codegraph mcp serve . --profile full # Start stdio MCP server with all 56 tools
562
+ codegraph mcp stop # Alias for codegraph stop
563
+ codegraph mcp kill # Alias for codegraph stop (1s graceful timeout)
539
564
  codegraph mcp doctor . # End-to-end MCP startup & query check
540
565
  codegraph mcp config-check . # Read-only MCP config validation
541
566
  codegraph mcp capabilities # Print machine-readable capability manifest
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "codegraph-engine"
7
- version = "2.1.7"
7
+ version = "2.1.8"
8
8
  description = "Deep deterministic repository intelligence for AI coding agents (code, dependencies, databases, and runtime observations)"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.12"
@@ -61,6 +61,7 @@ disable_error_code = ["untyped-decorator"]
61
61
  ignore_missing_imports = true
62
62
 
63
63
  [[tool.mypy.overrides]]
64
- module = ["psutil.*", "psutil"]
64
+ module = ["psutil.*", "psutil", "yaml.*", "yaml"]
65
65
  ignore_missing_imports = true
66
+ disable_error_code = ["import-untyped"]
66
67
 
@@ -1,6 +1,6 @@
1
1
  """CodeGraph MCP: local, evidence-backed codebase intelligence."""
2
2
 
3
- __version__ = "2.1.7"
3
+ __version__ = "2.1.8"
4
4
  from codegraph.errors import (
5
5
  CodeGraphError,
6
6
  ErrorCode,
@@ -9,6 +9,7 @@ import typer
9
9
 
10
10
  from codegraph import __version__
11
11
  from codegraph.architecture import get_architecture
12
+ from codegraph.cli_output import cli_echo
12
13
  from codegraph.config import Settings
13
14
  from codegraph.context import get_context
14
15
  from codegraph.errors import ErrorCode, SecurityError
@@ -605,8 +606,10 @@ def serve(
605
606
  """Run the stdio MCP server (requires the optional mcp extra)."""
606
607
  repo = _resolve_repo(path, repository)
607
608
  from codegraph.mcp import create_server
609
+ from codegraph.process_lifecycle import run_mcp_stdio_server
608
610
 
609
- create_server(repo, profile=profile).run()
611
+ server = create_server(repo, profile=profile)
612
+ run_mcp_stdio_server(server, repo, profile=profile)
610
613
 
611
614
 
612
615
  mcp_app = typer.Typer(help="MCP server commands.")
@@ -622,8 +625,70 @@ def mcp_serve(
622
625
  """Run the stdio MCP server (requires the optional mcp extra)."""
623
626
  repo = _resolve_repo(path, repository)
624
627
  from codegraph.mcp import create_server
628
+ from codegraph.process_lifecycle import run_mcp_stdio_server
625
629
 
626
- create_server(repo, profile=profile).run()
630
+ server = create_server(repo, profile=profile)
631
+ run_mcp_stdio_server(server, repo, profile=profile)
632
+
633
+
634
+ def _execute_stop(
635
+ path: Path | None,
636
+ repository: Path | None,
637
+ all_processes: bool,
638
+ timeout: float,
639
+ json_output: bool,
640
+ ) -> None:
641
+ from codegraph.process_lifecycle import stop_codegraph_processes
642
+
643
+ target_repo: Path | None = None
644
+ if not all_processes:
645
+ target_repo = _resolve_repo(path, repository)
646
+
647
+ res = stop_codegraph_processes(
648
+ repository=target_repo,
649
+ stop_all=all_processes,
650
+ timeout_sec=timeout,
651
+ )
652
+ if json_output:
653
+ cli_echo(json.dumps(res.as_dict(), indent=2), json_mode=True)
654
+ else:
655
+ cli_echo(res.format_human())
656
+
657
+
658
+ @app.command("stop")
659
+ def stop_cmd(
660
+ path: Annotated[Path | None, typer.Argument(help="Repository path (default: current directory)")] = None,
661
+ repository: Annotated[Path | None, typer.Option("--repository", "-r", "--repo", help="Repository path")] = None,
662
+ all_processes: Annotated[bool, typer.Option("--all", "-a", help="Stop all CodeGraph-owned MCP processes across all repositories")] = False,
663
+ timeout: Annotated[float, typer.Option("--timeout", help="Graceful shutdown timeout in seconds before force-kill")] = 3.0,
664
+ json_output: Annotated[bool, typer.Option("--json", help="Output deterministic machine-readable JSON")] = False,
665
+ ) -> None:
666
+ """Safely stop running CodeGraph MCP background processes and release file locks."""
667
+ _execute_stop(path, repository, all_processes, timeout, json_output)
668
+
669
+
670
+ @mcp_app.command("stop")
671
+ def mcp_stop_cmd(
672
+ path: Annotated[Path | None, typer.Argument(help="Repository path (default: current directory)")] = None,
673
+ repository: Annotated[Path | None, typer.Option("--repository", "-r", "--repo", help="Repository path")] = None,
674
+ all_processes: Annotated[bool, typer.Option("--all", "-a", help="Stop all CodeGraph-owned MCP processes across all repositories")] = False,
675
+ timeout: Annotated[float, typer.Option("--timeout", help="Graceful shutdown timeout in seconds before force-kill")] = 3.0,
676
+ json_output: Annotated[bool, typer.Option("--json", help="Output deterministic machine-readable JSON")] = False,
677
+ ) -> None:
678
+ """Safely stop running CodeGraph MCP background processes and release file locks."""
679
+ _execute_stop(path, repository, all_processes, timeout, json_output)
680
+
681
+
682
+ @mcp_app.command("kill")
683
+ def mcp_kill_cmd(
684
+ path: Annotated[Path | None, typer.Argument(help="Repository path (default: current directory)")] = None,
685
+ repository: Annotated[Path | None, typer.Option("--repository", "-r", "--repo", help="Repository path")] = None,
686
+ all_processes: Annotated[bool, typer.Option("--all", "-a", help="Stop all CodeGraph-owned MCP processes across all repositories")] = False,
687
+ timeout: Annotated[float, typer.Option("--timeout", help="Graceful shutdown timeout in seconds before force-kill")] = 1.0,
688
+ json_output: Annotated[bool, typer.Option("--json", help="Output deterministic machine-readable JSON")] = False,
689
+ ) -> None:
690
+ """Alias for `codegraph stop` to terminate CodeGraph MCP processes and release locks."""
691
+ _execute_stop(path, repository, all_processes, timeout, json_output)
627
692
 
628
693
 
629
694
  @mcp_app.command("doctor")
@@ -636,9 +701,9 @@ def mcp_doctor(
636
701
 
637
702
  report = run_mcp_doctor(profile=profile)
638
703
  if json_output:
639
- typer.echo(json.dumps(report.as_dict(), indent=2))
704
+ cli_echo(json.dumps(report.as_dict(), indent=2), json_mode=True)
640
705
  else:
641
- typer.echo(report.format_human())
706
+ cli_echo(report.format_human())
642
707
  if not report.healthy:
643
708
  raise typer.Exit(code=1)
644
709
 
@@ -656,9 +721,9 @@ def mcp_config_check(
656
721
  ws = (path or Path.cwd()).resolve()
657
722
  rep = check_mcp_configuration(workspace_dir=ws, config_file=config_file, include_example=include_example)
658
723
  if json_output:
659
- typer.echo(json.dumps(rep.as_dict(), indent=2))
724
+ cli_echo(json.dumps(rep.as_dict(), indent=2), json_mode=True)
660
725
  else:
661
- typer.echo(f"{rep.status.value}: {rep.message}")
726
+ cli_echo(f"{rep.status.value}: {rep.message}")
662
727
 
663
728
 
664
729
  @mcp_app.command("capabilities")
@@ -666,7 +731,7 @@ def mcp_capabilities() -> None:
666
731
  """Output the deterministic machine-readable CodeGraph capability manifest."""
667
732
  from codegraph.agent_capabilities import get_capability_manifest
668
733
 
669
- typer.echo(json.dumps(get_capability_manifest(), indent=2))
734
+ cli_echo(json.dumps(get_capability_manifest(), indent=2), json_mode=True)
670
735
 
671
736
 
672
737
  @mcp_app.command("rules")
@@ -676,7 +741,7 @@ def mcp_rules(
676
741
  """Render deterministic CodeGraph agent rules for the specified agent."""
677
742
  from codegraph.agent_rules import render_agent_rules
678
743
 
679
- typer.echo(render_agent_rules(agent=agent), nl=False)
744
+ cli_echo(render_agent_rules(agent=agent), nl=False)
680
745
 
681
746
 
682
747
  @app.command()
@@ -685,9 +750,20 @@ def doctor(
685
750
  repository: Annotated[Path | None, typer.Option("--repository", "-r", "--repo", help="Repository path")] = None,
686
751
  resources: Annotated[bool, typer.Option("--resources")] = False,
687
752
  database: Annotated[bool, typer.Option("--database", help="Run comprehensive database integrity and schema checks")] = False,
753
+ processes: Annotated[bool, typer.Option("--processes", help="Inspect active CodeGraph processes, parent state, and stale PID files")] = False,
688
754
  json_output: Annotated[bool, typer.Option("--json")] = False,
689
755
  ) -> None:
690
- """Check repository and index readiness, database integrity, and freshness."""
756
+ """Check repository and index readiness, database integrity, process lifecycle, and freshness."""
757
+ if processes:
758
+ from codegraph.process_lifecycle import discover_codegraph_processes
759
+
760
+ discovery = discover_codegraph_processes(clean_stale=True)
761
+ if json_output:
762
+ cli_echo(json.dumps(discovery.as_dict(), indent=2), json_mode=True)
763
+ else:
764
+ cli_echo(discovery.format_human())
765
+ return
766
+
691
767
  repo = _resolve_repo(path, repository)
692
768
  indexer_inst = _indexer(repo)
693
769
  db = repo / ".codegraph.sqlite3"
@@ -1007,7 +1083,7 @@ def install(
1007
1083
 
1008
1084
  rules_txt = render_agent_rules(canon)
1009
1085
  if json_output:
1010
- typer.echo(
1086
+ cli_echo(
1011
1087
  json.dumps(
1012
1088
  {
1013
1089
  "status": "ok",
@@ -1016,21 +1092,22 @@ def install(
1016
1092
  "instructions_block": format_marker_block(rules_txt),
1017
1093
  },
1018
1094
  indent=2,
1019
- )
1095
+ ),
1096
+ json_mode=True,
1020
1097
  )
1021
1098
  else:
1022
- typer.echo(f"# MCP Configuration ({canon})\n")
1023
- typer.echo(json.dumps(snippet, indent=2))
1024
- typer.echo(f"\n# Instructions Block ({canon})\n")
1025
- typer.echo(format_marker_block(rules_txt), nl=False)
1099
+ cli_echo(f"# MCP Configuration ({canon})\n")
1100
+ cli_echo(json.dumps(snippet, indent=2), json_mode=True)
1101
+ cli_echo(f"\n# Instructions Block ({canon})\n")
1102
+ cli_echo(format_marker_block(rules_txt), nl=False)
1026
1103
  return
1027
1104
  except CodeGraphError as exc:
1028
1105
  if json_output:
1029
- typer.echo(json.dumps(exc.to_response(), indent=2))
1106
+ cli_echo(json.dumps(exc.to_response(), indent=2), json_mode=True)
1030
1107
  else:
1031
- typer.echo(f"Error [{exc.code}]: {exc.message}")
1108
+ cli_echo(f"Error [{exc.code}]: {exc.message}")
1032
1109
  if exc.next_action and exc.next_action.get("command"):
1033
- typer.echo(f"\nTry:\n {exc.next_action['command']}")
1110
+ cli_echo(f"\nTry:\n {exc.next_action['command']}")
1034
1111
  raise typer.Exit(code=1) from exc
1035
1112
 
1036
1113
  ws = _resolve_repo(path, repository)
@@ -1040,15 +1117,15 @@ def install(
1040
1117
 
1041
1118
  assert isinstance(preview_rep, InstallerReport)
1042
1119
  if not json_output:
1043
- typer.echo(preview_rep.format_preview_human())
1044
- typer.echo("")
1045
- typer.echo("Continue? [y/N] ", nl=False)
1120
+ cli_echo(preview_rep.format_preview_human())
1121
+ cli_echo("")
1122
+ cli_echo("Continue? [y/N] ", nl=False)
1046
1123
  try:
1047
1124
  ans = input().strip().lower()
1048
1125
  except EOFError:
1049
1126
  ans = ""
1050
1127
  if not json_output:
1051
- typer.echo("")
1128
+ cli_echo("")
1052
1129
  return ans in ("y", "yes")
1053
1130
 
1054
1131
  try:
@@ -1062,22 +1139,22 @@ def install(
1062
1139
  )
1063
1140
  except CodeGraphError as exc:
1064
1141
  if json_output:
1065
- typer.echo(json.dumps(exc.to_response(), indent=2))
1142
+ cli_echo(json.dumps(exc.to_response(), indent=2), json_mode=True)
1066
1143
  else:
1067
- typer.echo(f"Error [{exc.code}]: {exc.message}")
1144
+ cli_echo(f"Error [{exc.code}]: {exc.message}")
1068
1145
  if exc.next_action and exc.next_action.get("reason"):
1069
- typer.echo(f"\nExpected:\n {exc.next_action['reason']}")
1146
+ cli_echo(f"\nExpected:\n {exc.next_action['reason']}")
1070
1147
  if exc.next_action and exc.next_action.get("command"):
1071
- typer.echo(f"\nTry:\n {exc.next_action['command']}")
1148
+ cli_echo(f"\nTry:\n {exc.next_action['command']}")
1072
1149
  raise typer.Exit(code=1) from exc
1073
1150
 
1074
1151
  if json_output:
1075
- typer.echo(json.dumps(report.as_dict(), indent=2))
1152
+ cli_echo(json.dumps(report.as_dict(), indent=2), json_mode=True)
1076
1153
  else:
1077
1154
  if yes and not dry_run:
1078
- typer.echo(report.format_preview_human())
1079
- typer.echo("")
1080
- typer.echo(report.format_human())
1155
+ cli_echo(report.format_preview_human())
1156
+ cli_echo("")
1157
+ cli_echo(report.format_human())
1081
1158
 
1082
1159
  if report.status == "error":
1083
1160
  raise typer.Exit(code=1)
@@ -1107,17 +1184,17 @@ def uninstall(
1107
1184
 
1108
1185
  def _confirm_uninstall(preview_rep: InstallerReport) -> bool:
1109
1186
  if not json_output:
1110
- typer.echo("CodeGraph Uninstaller\n")
1187
+ cli_echo("CodeGraph Uninstaller\n")
1111
1188
  for c in preview_rep.changes:
1112
1189
  if c.action in ("remove", "modify"):
1113
- typer.echo(f" - {c.display_path} ({c.action})")
1114
- typer.echo("\nContinue? [y/N] ", nl=False)
1190
+ cli_echo(f" - {c.display_path} ({c.action})")
1191
+ cli_echo("\nContinue? [y/N] ", nl=False)
1115
1192
  try:
1116
1193
  ans = input().strip().lower()
1117
1194
  except EOFError:
1118
1195
  ans = ""
1119
1196
  if not json_output:
1120
- typer.echo("")
1197
+ cli_echo("")
1121
1198
  return ans in ("y", "yes")
1122
1199
 
1123
1200
  try:
@@ -1130,17 +1207,17 @@ def uninstall(
1130
1207
  )
1131
1208
  except CodeGraphError as exc:
1132
1209
  if json_output:
1133
- typer.echo(json.dumps(exc.to_response(), indent=2))
1210
+ cli_echo(json.dumps(exc.to_response(), indent=2), json_mode=True)
1134
1211
  else:
1135
- typer.echo(f"Error [{exc.code}]: {exc.message}")
1212
+ cli_echo(f"Error [{exc.code}]: {exc.message}")
1136
1213
  if exc.next_action and exc.next_action.get("command"):
1137
- typer.echo(f"\nTry:\n {exc.next_action['command']}")
1214
+ cli_echo(f"\nTry:\n {exc.next_action['command']}")
1138
1215
  raise typer.Exit(code=1) from exc
1139
1216
 
1140
1217
  if json_output:
1141
- typer.echo(json.dumps(report.as_dict(), indent=2))
1218
+ cli_echo(json.dumps(report.as_dict(), indent=2), json_mode=True)
1142
1219
  else:
1143
- typer.echo(report.format_human())
1220
+ cli_echo(report.format_human())
1144
1221
 
1145
1222
 
1146
1223
  @app.command()
@@ -1159,16 +1236,16 @@ def uninit(
1159
1236
 
1160
1237
  def _confirm_uninit(preview_rep: InstallerReport) -> bool:
1161
1238
  if not json_output:
1162
- typer.echo("Remove CodeGraph project index files?\n")
1239
+ cli_echo("Remove CodeGraph project index files?\n")
1163
1240
  for c in preview_rep.changes:
1164
- typer.echo(f" - {c.display_path}")
1165
- typer.echo("\nContinue? [y/N] ", nl=False)
1241
+ cli_echo(f" - {c.display_path}")
1242
+ cli_echo("\nContinue? [y/N] ", nl=False)
1166
1243
  try:
1167
1244
  ans = input().strip().lower()
1168
1245
  except EOFError:
1169
1246
  ans = ""
1170
1247
  if not json_output:
1171
- typer.echo("")
1248
+ cli_echo("")
1172
1249
  return ans in ("y", "yes")
1173
1250
 
1174
1251
  try:
@@ -1179,15 +1256,15 @@ def uninit(
1179
1256
  )
1180
1257
  except CodeGraphError as exc:
1181
1258
  if json_output:
1182
- typer.echo(json.dumps(exc.to_response(), indent=2))
1259
+ cli_echo(json.dumps(exc.to_response(), indent=2), json_mode=True)
1183
1260
  else:
1184
- typer.echo(f"Error [{exc.code}]: {exc.message}")
1261
+ cli_echo(f"Error [{exc.code}]: {exc.message}")
1185
1262
  raise typer.Exit(code=1) from exc
1186
1263
 
1187
1264
  if json_output:
1188
- typer.echo(json.dumps(report.as_dict(), indent=2))
1265
+ cli_echo(json.dumps(report.as_dict(), indent=2), json_mode=True)
1189
1266
  else:
1190
- typer.echo(report.format_human())
1267
+ cli_echo(report.format_human())
1191
1268
 
1192
1269
 
1193
1270
  if __name__ == "__main__":