graphite-code 1.9.0__tar.gz → 1.9.1__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 (338) hide show
  1. {graphite_code-1.9.0 → graphite_code-1.9.1}/CHANGELOG.md +61 -1
  2. {graphite_code-1.9.0 → graphite_code-1.9.1}/PKG-INFO +2 -2
  3. {graphite_code-1.9.0 → graphite_code-1.9.1}/README.md +1 -1
  4. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/__init__.py +1 -1
  5. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/agent_hooks.py +201 -11
  6. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/cli.py +30 -3
  7. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_agent_hooks.py +225 -0
  8. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_search.py +75 -0
  9. {graphite_code-1.9.0 → graphite_code-1.9.1}/.gitignore +0 -0
  10. {graphite_code-1.9.0 → graphite_code-1.9.1}/.mcp.json +0 -0
  11. {graphite_code-1.9.0 → graphite_code-1.9.1}/ARCHITECTURE.md +0 -0
  12. {graphite_code-1.9.0 → graphite_code-1.9.1}/CONTRIBUTING.md +0 -0
  13. {graphite_code-1.9.0 → graphite_code-1.9.1}/LICENSE +0 -0
  14. {graphite_code-1.9.0 → graphite_code-1.9.1}/RELEASING.md +0 -0
  15. {graphite_code-1.9.0 → graphite_code-1.9.1}/SECURITY.md +0 -0
  16. {graphite_code-1.9.0 → graphite_code-1.9.1}/benchmarks/__init__.py +0 -0
  17. {graphite_code-1.9.0 → graphite_code-1.9.1}/benchmarks/build_benchmark.py +0 -0
  18. {graphite_code-1.9.0 → graphite_code-1.9.1}/benchmarks/realty_router/README.md +0 -0
  19. {graphite_code-1.9.0 → graphite_code-1.9.1}/benchmarks/realty_router/__init__.py +0 -0
  20. {graphite_code-1.9.0 → graphite_code-1.9.1}/benchmarks/realty_router/evaluate.py +0 -0
  21. {graphite_code-1.9.0 → graphite_code-1.9.1}/benchmarks/realty_router/tasks.json +0 -0
  22. {graphite_code-1.9.0 → graphite_code-1.9.1}/benchmarks/synthetic_repo.py +0 -0
  23. {graphite_code-1.9.0 → graphite_code-1.9.1}/pyproject.toml +0 -0
  24. {graphite_code-1.9.0 → graphite_code-1.9.1}/scripts/__init__.py +0 -0
  25. {graphite_code-1.9.0 → graphite_code-1.9.1}/scripts/compare_dist.py +0 -0
  26. {graphite_code-1.9.0 → graphite_code-1.9.1}/scripts/gen_cli_reference.py +0 -0
  27. {graphite_code-1.9.0 → graphite_code-1.9.1}/scripts/mutation_tests.py +0 -0
  28. {graphite_code-1.9.0 → graphite_code-1.9.1}/scripts/pyscopeoracle.py +0 -0
  29. {graphite_code-1.9.0 → graphite_code-1.9.1}/scripts/sqloracle.py +0 -0
  30. {graphite_code-1.9.0 → graphite_code-1.9.1}/scripts/verify_artifact.py +0 -0
  31. {graphite_code-1.9.0 → graphite_code-1.9.1}/scripts/verify_published_release.py +0 -0
  32. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/__main__.py +0 -0
  33. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/_cleanup_worker.py +0 -0
  34. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/_win32_ctypes.py +0 -0
  35. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/activation.py +0 -0
  36. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/agent_settings.py +0 -0
  37. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/analyze.py +0 -0
  38. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/answer_contract.py +0 -0
  39. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/bootstrap.py +0 -0
  40. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/buildlock.py +0 -0
  41. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/cache.py +0 -0
  42. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/channel.py +0 -0
  43. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/cluster.py +0 -0
  44. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/config.py +0 -0
  45. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/context.py +0 -0
  46. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/daemon.py +0 -0
  47. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/daemon_health.py +0 -0
  48. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/daemon_launch.py +0 -0
  49. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/debt.py +0 -0
  50. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/dependency_install.py +0 -0
  51. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/detach.py +0 -0
  52. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/doctor.py +0 -0
  53. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/doctor_probes.py +0 -0
  54. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/engine_identity.py +0 -0
  55. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/export/__init__.py +0 -0
  56. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/export/html.py +0 -0
  57. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/export/json.py +0 -0
  58. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/export/md.py +0 -0
  59. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/extract/__init__.py +0 -0
  60. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/extract/ast.py +0 -0
  61. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/extract/pyscope.py +0 -0
  62. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/freshness.py +0 -0
  63. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/git.py +0 -0
  64. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/graph.py +0 -0
  65. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/graph_io.py +0 -0
  66. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/health.py +0 -0
  67. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/hook_entry.py +0 -0
  68. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/hookinstall.py +0 -0
  69. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/hookshim.py +0 -0
  70. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/incident_ledger.py +0 -0
  71. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/ingest.py +0 -0
  72. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/init.py +0 -0
  73. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/io.py +0 -0
  74. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/launchd_agent.py +0 -0
  75. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/listing.py +0 -0
  76. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/llm.py +0 -0
  77. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/llm_probe.py +0 -0
  78. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/mcp.py +0 -0
  79. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/mcp_server.py +0 -0
  80. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/natural_query.py +0 -0
  81. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/overlays.py +0 -0
  82. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/ownership.py +0 -0
  83. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/probe_process.py +0 -0
  84. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/probe_workspace.py +0 -0
  85. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/process_contracts.py +0 -0
  86. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/programs.py +0 -0
  87. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/provider_observer.py +0 -0
  88. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/py.typed +0 -0
  89. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/query.py +0 -0
  90. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/query_plan.py +0 -0
  91. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/replacement_audit.py +0 -0
  92. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/resolve.py +0 -0
  93. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/review.py +0 -0
  94. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/routing/__init__.py +0 -0
  95. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/routing/approval.py +0 -0
  96. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/routing/classifier.py +0 -0
  97. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/routing/claude_executor.py +0 -0
  98. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/routing/claude_probe.py +0 -0
  99. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/routing/cli_identity.py +0 -0
  100. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/routing/codex_executor.py +0 -0
  101. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/routing/codex_probe.py +0 -0
  102. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/routing/context_builder.py +0 -0
  103. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/routing/contracts.py +0 -0
  104. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/routing/diff_policy.py +0 -0
  105. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/routing/edit_apply.py +0 -0
  106. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/routing/effort.py +0 -0
  107. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/routing/lifecycle.py +0 -0
  108. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/routing/lifecycle_operator.py +0 -0
  109. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/routing/lifecycle_service.py +0 -0
  110. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/routing/lifecycle_storage.py +0 -0
  111. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/routing/ollama_executor.py +0 -0
  112. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/routing/ollama_probe.py +0 -0
  113. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/routing/openrouter_executor.py +0 -0
  114. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/routing/openrouter_probe.py +0 -0
  115. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/routing/policy.py +0 -0
  116. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/routing/probe_runner.py +0 -0
  117. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/routing/process_runner.py +0 -0
  118. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/routing/profiles.py +0 -0
  119. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/routing/prompt.py +0 -0
  120. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/routing/registry.py +0 -0
  121. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/routing/route_pool.py +0 -0
  122. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/routing/route_pool_execution.py +0 -0
  123. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/routing/schema_validation.py +0 -0
  124. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/routing/service.py +0 -0
  125. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/routing/settings.py +0 -0
  126. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/routing/shadow.py +0 -0
  127. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/routing/storage.py +0 -0
  128. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/routing/telemetry.py +0 -0
  129. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/routing/worktree.py +0 -0
  130. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/routing/zai_edit.py +0 -0
  131. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/routing/zai_executor.py +0 -0
  132. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/routing/zai_probe.py +0 -0
  133. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/savings.py +0 -0
  134. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/systemd_unit.py +0 -0
  135. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/ts_bridge.py +0 -0
  136. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/ts_resolver.mjs +0 -0
  137. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/typescript_activation.py +0 -0
  138. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/usage_ledger.py +0 -0
  139. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/validation.py +0 -0
  140. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/watch.py +0 -0
  141. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/windows_job.py +0 -0
  142. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/windows_startup.py +0 -0
  143. {graphite_code-1.9.0 → graphite_code-1.9.1}/src/graphite/windows_task.py +0 -0
  144. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/conftest.py +0 -0
  145. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/data/sqloracle/blindspots.py.txt +0 -0
  146. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/data/sqloracle/round69.py.txt +0 -0
  147. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/fake_clis/fake_cli.py +0 -0
  148. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/fixtures/provider_lifecycle_schema_v1.sql +0 -0
  149. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/fixtures/routing_schema_v2_ca77600.sql +0 -0
  150. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/fixtures/routing_schema_v3_94eb333.sql +0 -0
  151. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/fixtures/routing_schema_v4_lifecycle_migration.sql +0 -0
  152. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test__win32_ctypes.py +0 -0
  153. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_activation.py +0 -0
  154. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_activation_backstop.py +0 -0
  155. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_agent_hook_activation.py +0 -0
  156. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_agent_hooks_session_books.py +0 -0
  157. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_agent_hooks_session_tagging.py +0 -0
  158. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_agent_settings.py +0 -0
  159. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_answer_contract.py +0 -0
  160. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_arrow_and_constructor_binding.py +0 -0
  161. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_ast_make_id_length.py +0 -0
  162. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_ast_name_a_module_only_imports.py +0 -0
  163. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_ast_source_lines.py +0 -0
  164. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_ast_super_over_a_builtin_base.py +0 -0
  165. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_atomic_write.py +0 -0
  166. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_bootstrap.py +0 -0
  167. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_build_detach.py +0 -0
  168. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_buildlock.py +0 -0
  169. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_cache_engine_identity.py +0 -0
  170. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_cache_entry_pruning.py +0 -0
  171. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_cache_file_identity.py +0 -0
  172. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_cache_file_set.py +0 -0
  173. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_cache_pruning.py +0 -0
  174. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_call_graph.py +0 -0
  175. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_case_ambiguous_answer.py +0 -0
  176. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_channel_attribution.py +0 -0
  177. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_channel_cli.py +0 -0
  178. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_channel_core.py +0 -0
  179. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_channel_kind.py +0 -0
  180. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_channel_lock.py +0 -0
  181. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_channel_log_integrity.py +0 -0
  182. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_channel_mcp.py +0 -0
  183. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_channel_register.py +0 -0
  184. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_channel_report.py +0 -0
  185. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_channel_status.py +0 -0
  186. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_class_field_arrow_binding.py +0 -0
  187. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_cli_below_repository_root.py +0 -0
  188. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_cli_build_missing_path.py +0 -0
  189. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_cli_channel.py +0 -0
  190. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_cli_channel_attribution.py +0 -0
  191. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_cli_doctor_below_root.py +0 -0
  192. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_cli_reference.py +0 -0
  193. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_cli_usage.py +0 -0
  194. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_cli_version.py +0 -0
  195. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_cluster.py +0 -0
  196. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_compare_dist.py +0 -0
  197. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_configuration_reference.py +0 -0
  198. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_context.py +0 -0
  199. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_context_builder.py +0 -0
  200. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_cwd_relative_config.py +0 -0
  201. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_cycle_search.py +0 -0
  202. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_daemon.py +0 -0
  203. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_daemon_activation.py +0 -0
  204. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_daemon_build_lock.py +0 -0
  205. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_daemon_child_lock.py +0 -0
  206. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_daemon_engine_staleness.py +0 -0
  207. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_daemon_health.py +0 -0
  208. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_daemon_health_activation.py +0 -0
  209. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_daemon_launch.py +0 -0
  210. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_daemon_service_cli.py +0 -0
  211. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_daemon_snapshot_failure.py +0 -0
  212. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_debt.py +0 -0
  213. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_dependency_install.py +0 -0
  214. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_destructured_binding.py +0 -0
  215. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_determinism.py +0 -0
  216. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_dispatch_evidence.py +0 -0
  217. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_doctor.py +0 -0
  218. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_doctor_agent_hooks.py +0 -0
  219. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_doctor_hooks.py +0 -0
  220. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_doctor_managed_docs.py +0 -0
  221. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_doctor_probes.py +0 -0
  222. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_documentation.py +0 -0
  223. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_edit_apply.py +0 -0
  224. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_engine_identity.py +0 -0
  225. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_exit_codes_reference.py +0 -0
  226. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_external_calls.py +0 -0
  227. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_file_node_id_collision.py +0 -0
  228. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_git_security.py +0 -0
  229. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_go_rust.py +0 -0
  230. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_graph_io.py +0 -0
  231. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_graph_provider_isolation.py +0 -0
  232. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_hardening.py +0 -0
  233. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_health.py +0 -0
  234. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_hook_entry.py +0 -0
  235. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_hook_template.py +0 -0
  236. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_hookinstall.py +0 -0
  237. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_hookshim.py +0 -0
  238. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_html_security.py +0 -0
  239. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_incident_ledger.py +0 -0
  240. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_init.py +0 -0
  241. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_init_activation_doctrine.py +0 -0
  242. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_init_hooks.py +0 -0
  243. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_init_validation_exit.py +0 -0
  244. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_launchd_agent.py +0 -0
  245. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_lifecycle_operator.py +0 -0
  246. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_listing.py +0 -0
  247. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_listing_surfaces.py +0 -0
  248. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_llm.py +0 -0
  249. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_llm_probe.py +0 -0
  250. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_mcp.py +0 -0
  251. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_mcp_server.py +0 -0
  252. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_mcp_server_channel_attribution.py +0 -0
  253. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_member_call_receiver.py +0 -0
  254. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_method_dispatch_scope.py +0 -0
  255. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_monorepo.py +0 -0
  256. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_mutation_tests.py +0 -0
  257. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_natural_query.py +0 -0
  258. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_no_path_is_graded.py +0 -0
  259. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_node_identity.py +0 -0
  260. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_ollama_executor.py +0 -0
  261. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_overlays.py +0 -0
  262. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_path_leak_fixture.py +0 -0
  263. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_probe_diagnostics.py +0 -0
  264. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_probe_process.py +0 -0
  265. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_probe_workspace.py +0 -0
  266. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_process_contracts.py +0 -0
  267. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_programs.py +0 -0
  268. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_provider_claude_probe.py +0 -0
  269. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_provider_codex_probe.py +0 -0
  270. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_provider_lifecycle.py +0 -0
  271. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_provider_lifecycle_service.py +0 -0
  272. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_provider_lifecycle_storage.py +0 -0
  273. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_provider_observer.py +0 -0
  274. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_provider_ollama_probe.py +0 -0
  275. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_provider_openrouter_probe.py +0 -0
  276. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_provider_probe_runner.py +0 -0
  277. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_public_surface.py +0 -0
  278. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_published_schemas.py +0 -0
  279. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_pyscope.py +0 -0
  280. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_pyscopeoracle.py +0 -0
  281. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_python_builtin_named_symbols.py +0 -0
  282. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_python_import_bindings.py +0 -0
  283. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_python_inherits_edge.py +0 -0
  284. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_python_local_alias_call.py +0 -0
  285. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_python_reexport_follow.py +0 -0
  286. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_python_resolver.py +0 -0
  287. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_python_scope_identity.py +0 -0
  288. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_query_plan.py +0 -0
  289. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_reliability.py +0 -0
  290. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_replacement_audit.py +0 -0
  291. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_repository_root_ownership.py +0 -0
  292. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_resolve.py +0 -0
  293. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_resolve_python_reexports_of.py +0 -0
  294. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_review.py +0 -0
  295. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_route_pool.py +0 -0
  296. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_route_pool_execution.py +0 -0
  297. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_routing_approval.py +0 -0
  298. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_routing_benchmark.py +0 -0
  299. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_routing_classifier.py +0 -0
  300. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_routing_claude_executor.py +0 -0
  301. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_routing_cli.py +0 -0
  302. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_routing_cli_contracts.py +0 -0
  303. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_routing_cli_recovery.py +0 -0
  304. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_routing_codex_executor.py +0 -0
  305. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_routing_context.py +0 -0
  306. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_routing_contracts.py +0 -0
  307. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_routing_diff_policy.py +0 -0
  308. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_routing_executor.py +0 -0
  309. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_routing_openrouter_executor.py +0 -0
  310. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_routing_policy.py +0 -0
  311. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_routing_process_runner.py +0 -0
  312. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_routing_profiles.py +0 -0
  313. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_routing_registry.py +0 -0
  314. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_routing_schema_validation.py +0 -0
  315. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_routing_security.py +0 -0
  316. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_routing_service.py +0 -0
  317. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_routing_shadow.py +0 -0
  318. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_routing_storage.py +0 -0
  319. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_routing_telemetry.py +0 -0
  320. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_routing_worktree.py +0 -0
  321. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_routing_zai_executor.py +0 -0
  322. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_routing_zai_probe.py +0 -0
  323. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_savings.py +0 -0
  324. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_self_super_dispatch.py +0 -0
  325. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_smoke.py +0 -0
  326. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_sqloracle.py +0 -0
  327. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_synthetic_repo.py +0 -0
  328. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_systemd_unit.py +0 -0
  329. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_ts_bridge.py +0 -0
  330. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_typescript_activation.py +0 -0
  331. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_typescript_resolver.py +0 -0
  332. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_usage_ledger.py +0 -0
  333. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_verify_artifact.py +0 -0
  334. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_verify_published_release.py +0 -0
  335. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_watch.py +0 -0
  336. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_windows_startup.py +0 -0
  337. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_windows_task.py +0 -0
  338. {graphite_code-1.9.0 → graphite_code-1.9.1}/tests/test_zai_edit.py +0 -0
@@ -13,7 +13,67 @@ machine-checkable identity; the version is for humans.
13
13
 
14
14
  [Keep a Changelog]: https://keepachangelog.com/en/1.1.0/
15
15
 
16
- ## [Unreleased]
16
+ ## [1.9.1] — 2026-11-03
17
+
18
+ A patch release: three fixes, and no change to any command, option, exit code
19
+ or entry point. The wording of human-readable output is not a stable surface
20
+ (`docs/compatibility.md`), and the agent hook's stable contract is that it
21
+ always exits 0 — neither moves. The graph the release changes was measured
22
+ against the 1.9.0 tree: every node id survives, none is removed, and no edge
23
+ triple is lost.
24
+
25
+ ### Fixed
26
+
27
+ **`graphite search` says how many matches there are, and how to see them.**
28
+ The text form printed `20 match(es) for: X (truncated)`, which reads as the
29
+ total: an agent that reads it that way believes the graph fell short and
30
+ falls back to searching files one at a time — the outcome the graph-first
31
+ rule exists to prevent. The full answer was one flag away and nothing in the
32
+ output or the help said so. The line now reads `20 of 3499 match(es) for: X
33
+ (truncated; pass --limit 3499 to see all)`, and where `--limit` is capped it
34
+ says the cap instead of naming a number above it. `--limit`'s help states
35
+ its default. The JSON form already carried both figures and is unchanged.
36
+
37
+ **A search for a phrase is no longer refused for a word the repo happens to
38
+ name.** The strict agent hook refused `email you` because `email` is a
39
+ method in that repository's graph, and refused `the parser tree` and
40
+ `version path` for the same reason — while `Send Test Email` passed. Whether
41
+ a prose search was allowed depended on where the word fell in the sentence,
42
+ because the comparison is case-exact.
43
+
44
+ A literal space inside a pattern is part of the text the search must match,
45
+ so the word beside it cannot be the bare symbol the search is looking for.
46
+ That is the rule the gate already applied to a piece of a path, a file's
47
+ name and a hyphenated option, and a required space is that kind of joining
48
+ character. A phrase is now searched as text, on all three routes — the Grep
49
+ tool, a shell search and PowerShell — and the graph-first reminder still
50
+ reaches the agent.
51
+
52
+ Two conditions keep this from becoming a way past the gate: the space must
53
+ be **required** (a quantifier or an escape after it may make the space
54
+ absent — `?`, `*`, `{0}`, and BRE's escaped `\?` — and an absent space can
55
+ still find the bare name; where the engine's dialect cannot be read, the
56
+ term is judged rather than excused) and it must be **interior** (text on both
57
+ sides, within the same branch and group, so a space at the edge of either —
58
+ leading, trailing, or against an alternation, a group or an anchor — cannot
59
+ be added to any pattern to smuggle a bare symbol through). A regex escape is
60
+ not a space: `^\s*def\s+name\b` still names the symbol and is still refused,
61
+ and a bare identifier is still refused.
62
+
63
+ **A qualified member the graph cannot answer for is no longer refused.** The
64
+ strict agent hook refused `RUNTIME\.put\(` because `put` is a
65
+ property of a test mock's object literal — a node nothing calls, so the
66
+ route the refusal offers (`callers put`) answers with an empty list. The
67
+ member was a call on something the graph does not model, and the graph had
68
+ nothing to say about it.
69
+
70
+ A member is now exempt from being a refusal when **both** hold: the receiver
71
+ is not something this repo defines, and nothing in this repo calls anything
72
+ of that name. Both are needed — the receiver alone would excuse
73
+ `self.check(`, where the graph does know who calls the method, and the
74
+ callers alone would excuse `graph.jsonify`, where the receiver is a symbol
75
+ this repo defines. A bare word is still refused, including one nothing
76
+ calls.
17
77
 
18
78
  ## [1.9.0] — 2026-10-31
19
79
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: graphite-code
3
- Version: 1.9.0
3
+ Version: 1.9.1
4
4
  Summary: Local-first, zero-LLM knowledge graph extraction for codebases.
5
5
  Project-URL: Homepage, https://github.com/jared0565/graphite
6
6
  Project-URL: Repository, https://github.com/jared0565/graphite
@@ -49,7 +49,7 @@ Description-Content-Type: text/markdown
49
49
 
50
50
  Local-first, deterministic knowledge graph extraction for codebases — zero-LLM, daemon-maintained, agent-agnostic.
51
51
 
52
- **Status: 1.9.0, production/stable.** Published on PyPI as
52
+ **Status: 1.9.1, production/stable.** Published on PyPI as
53
53
  [`graphite-code`](https://pypi.org/project/graphite-code/) with PEP 740
54
54
  attestations; supported on Windows, Linux and macOS with Python 3.11–3.14
55
55
  (every cell gates CI). What 1.x promises — CLI, JSON outputs, `graph.json`,
@@ -2,7 +2,7 @@
2
2
 
3
3
  Local-first, deterministic knowledge graph extraction for codebases — zero-LLM, daemon-maintained, agent-agnostic.
4
4
 
5
- **Status: 1.9.0, production/stable.** Published on PyPI as
5
+ **Status: 1.9.1, production/stable.** Published on PyPI as
6
6
  [`graphite-code`](https://pypi.org/project/graphite-code/) with PEP 740
7
7
  attestations; supported on Windows, Linux and macOS with Python 3.11–3.14
8
8
  (every cell gates CI). What 1.x promises — CLI, JSON outputs, `graph.json`,
@@ -38,4 +38,4 @@ __all__ = ["__version__"]
38
38
  #: Coarse and hand-maintained by construction. It is a release label, not
39
39
  #: evidence that a given fix is present -- to answer that, survey for the marker
40
40
  #: the fix introduced, or compare `graphite --version` fingerprints.
41
- __version__ = "1.9.0"
41
+ __version__ = "1.9.1"
@@ -19,10 +19,12 @@ from . import usage_ledger
19
19
  from .activation import mark_active
20
20
  from .config import Config
21
21
  from .freshness import check_graph_freshness
22
+ from .graph import edge_relations
22
23
  from .graph_io import load_validated_graph_bundle
23
24
  from .health import _edge_language, is_placeholder, persisted_resolution
24
25
  from .incident_ledger import record_incident, repo_ledger_dir
25
26
  from .ingest import enclosing_git_root, repository_root
27
+ from .query import _CALL_RELATIONS
26
28
 
27
29
  SESSION_CONTRACT = (
28
30
  "graphite-first: this repo uses a shared code graph. For cross-file questions "
@@ -236,27 +238,137 @@ def _without_fused_escapes(pattern: str) -> str:
236
238
  return _FUSED_ESCAPE_RE.sub(lambda found: found.group() if found.group() == "\\\\" else " ", pattern)
237
239
 
238
240
 
239
- def _pattern_tokens(pattern: str, fold_case: bool) -> list[str]:
241
+ # A run of literal whitespace in a pattern. Tab counts: a pattern may be
242
+ # written with one.
243
+ _WHITESPACE_RUN_RE = re.compile(r"[ \t]+")
244
+ # The characters that end a branch, a group, a character class, a repetition
245
+ # or an anchor's span. A run next to one of them sits at the edge of what the
246
+ # pattern matches rather than inside a phrase, so it is not a joining
247
+ # character: `dependents |zzqx` is the first branch `dependents ` and
248
+ # `zzqx| dependents` is the second branch ` dependents`, and both are the
249
+ # bare name with a space at the edge of it.
250
+ _BOUNDARY_CHARS = frozenset("|()[]{}^$")
251
+ # A quantifier or an escape after a space. The space may be absent -- `?`,
252
+ # `*` and `{0` in ERE, `\\?` and `\\{0,1\\}` in BRE -- or the construct is one
253
+ # this hook cannot parse, and a parse it does not understand fails closed.
254
+ # Either way the space is not something the matched text must carry, so the
255
+ # bare name is still what the search may be looking for.
256
+ _QUANTIFIER_OR_ESCAPE_AFTER = frozenset("?*+{\\")
257
+
258
+
259
+ def _required_interior_whitespace(pattern: str) -> list[tuple[int, int]]:
260
+ """Spans of whitespace a matched text must carry, with text on both sides.
261
+
262
+ A literal space inside a pattern is part of the text the search must
263
+ match: `email you` finds the phrase, not the bare word. The rule that
264
+ already skips a piece of a path, a file's name or a hyphenated option is
265
+ the same one -- a fragment of a longer literal is not judged alone -- and
266
+ a required space beside a word is that kind of joining character. So a
267
+ prose search is not refused for a word the repo happens to call `email`
268
+ (round 331), and the refusal no longer depends on where the word falls
269
+ in the sentence.
270
+
271
+ Two conditions keep this from becoming a way past the gate:
272
+
273
+ - the space must be REQUIRED. A quantifier or an escape after it may make
274
+ the space absent, and an absent space can still find the bare name.
275
+ - it must be INTERIOR: text on both sides, within the same branch and
276
+ group. A space at the edge of either -- leading, trailing, or against
277
+ an alternation, a group or an anchor -- would let any pattern smuggle a
278
+ bare symbol past the gate by adding one space, so it is not treated as
279
+ a joining character.
280
+
281
+ The engine's dialect is not read, and where it would matter the space is
282
+ judged rather than excused: a bare `?` is a quantifier in ERE and a
283
+ literal character in BRE, and the hook cannot tell which it is looking
284
+ at, so `email ?you` is judged in both. That refuses a search the pattern
285
+ may have allowed, and refusing is the safe direction.
286
+
287
+ A regex escape is not a space. `\\s` is an operator, so
288
+ `^\\s*def\\s+dependents\\b` still names the symbol and is still judged,
289
+ and the name beside an escape is judged exactly as it was.
290
+ """
291
+ spans: list[tuple[int, int]] = []
292
+ for found in _WHITESPACE_RUN_RE.finditer(pattern):
293
+ start, end = found.start(), found.end()
294
+ before = pattern[start - 1] if start else ""
295
+ after = pattern[end] if end < len(pattern) else ""
296
+ if not before or not after:
297
+ continue # at the edge of the pattern
298
+ if before in _BOUNDARY_CHARS or after in _BOUNDARY_CHARS:
299
+ continue # at the edge of a branch, a group or an anchor
300
+ if after in _QUANTIFIER_OR_ESCAPE_AFTER:
301
+ continue # the space may be absent, or the parse is unknown
302
+ spans.append((start, end))
303
+ return spans
304
+
305
+
306
+ def _beside_a_required_space(start: int, end: int, spaces: list[tuple[int, int]]) -> bool:
307
+ """Whether the token at `start:end` sits against a required interior space."""
308
+ return any(run_end == start or run_start == end for run_start, run_end in spaces)
309
+
310
+
311
+ def _receiver_of(pattern: str, start: int) -> str | None:
312
+ """The identifier the word at `start` is qualified by, or None.
313
+
314
+ `env.put(` and `env\\.put(` both qualify `put` by `env`. A word that is
315
+ not behind a dot is qualified by nothing.
316
+ """
317
+ index = start - 1
318
+ if index < 0:
319
+ return None
320
+ if pattern[index] == "\\":
321
+ index -= 1
322
+ if index < 0 or pattern[index] != ".":
323
+ return None
324
+ index -= 1 # past the dot
325
+ if index >= 0 and pattern[index] == "\\":
326
+ index -= 1 # and past the backslash of an escaped dot
327
+ end = index + 1
328
+ while index >= 0 and (pattern[index].isalnum() or pattern[index] == "_"):
329
+ index -= 1
330
+ if index + 1 == end:
331
+ return None # nothing before the dot
332
+ return pattern[index + 1:end]
333
+
334
+
335
+ def _pattern_tokens(pattern: str, fold_case: bool) -> list[tuple[str, str | None]]:
240
336
  """Identifier-like tokens from a grep pattern, deduplicated, capped.
241
337
 
242
338
  Two spellings of one word are one token only when the search folds case.
243
339
  Otherwise `Done|done` would keep `Done` alone and never check `done`.
340
+
341
+ Each token carries the identifier it is qualified by, or None when the
342
+ word appears without one. A word that appears bare anywhere in the
343
+ pattern is never a qualified member: `install|env.install(` is a search
344
+ for the bare name as well.
244
345
  """
245
- seen: set[str] = set()
246
- tokens: list[str] = []
346
+ seen: dict[str, str] = {}
347
+ receivers: dict[str, str | None] = {}
348
+ # The spaces are read from the pattern as written: `_without_fused_escapes`
349
+ # blanks an escape into spaces of its own, and a blanked escape is an
350
+ # operator, not a space the matched text must carry.
351
+ spaces = _required_interior_whitespace(pattern)
247
352
  pattern = _without_fused_escapes(pattern)
248
353
  for found in _IDENTIFIER_RE.finditer(pattern):
249
354
  if _is_literal_fragment(pattern, found.start(), found.end()):
250
355
  continue
356
+ if _beside_a_required_space(found.start(), found.end(), spaces):
357
+ continue
251
358
  token = found.group()
252
359
  key = token.lower() if fold_case else token
360
+ receiver = _receiver_of(pattern, found.start())
253
361
  if key in seen:
362
+ # Qualified somewhere and bare somewhere else is a search for the
363
+ # bare name too, so the word is not a qualified member.
364
+ if receivers[key] != receiver:
365
+ receivers[key] = None
254
366
  continue
255
- seen.add(key)
256
- tokens.append(token)
257
- if len(tokens) >= _MAX_TOKENS_CHECKED:
367
+ seen[key] = token
368
+ receivers[key] = receiver
369
+ if len(seen) >= _MAX_TOKENS_CHECKED:
258
370
  break
259
- return tokens
371
+ return [(seen[key], receivers[key]) for key in seen]
260
372
 
261
373
 
262
374
  def _hook_graph(root: Path) -> Any | None:
@@ -268,7 +380,74 @@ def _hook_graph(root: Path) -> Any | None:
268
380
  return graph
269
381
 
270
382
 
271
- def _graph_symbol(graph: Any, tokens: list[str], fold_case: bool) -> tuple[str, str] | None:
383
+ def _defines(graph: Any, word: str, fold_case: bool) -> bool:
384
+ """Whether this repo defines something by this word.
385
+
386
+ A placeholder does not count: `json` is in the graph because a file
387
+ imports it, not because the repo defines it.
388
+ """
389
+ key = word.lower() if fold_case else word
390
+ for node_id, data in graph.nodes(data=True):
391
+ if is_placeholder(data):
392
+ continue
393
+ for candidate in (node_id, str(data.get("name", ""))):
394
+ candidate_key = candidate.lower() if fold_case else candidate
395
+ if candidate_key and candidate_key == key:
396
+ return True
397
+ return False
398
+
399
+
400
+ def _has_callers(graph: Any, node_id: str) -> bool:
401
+ """Whether the graph's own `callers` listing for this node is non-empty.
402
+
403
+ The same relations `query "callers"` counts: an inbound edge whose
404
+ relations include a call or a reference. Nesting (`contains`) is not a
405
+ call -- a nested function is contained by its parent, not called by it.
406
+ """
407
+ return any(
408
+ any(relation in _CALL_RELATIONS for relation in edge_relations(graph[source][node_id]))
409
+ for source in graph.predecessors(node_id)
410
+ )
411
+
412
+
413
+ def _exempt_member(graph: Any, word: str, receiver: str | None, fold_case: bool) -> bool:
414
+ """Whether a qualified member is something the graph cannot answer for.
415
+
416
+ The receiver is not something this repo defines, so the member is a call
417
+ on something the graph does not model -- a runtime binding, or a test
418
+ double's namesake. And nothing in this repo calls anything of that name,
419
+ so the route the refusal offers (`callers <word>`) would resolve the word
420
+ to a node with no callers and answer with an empty list (round 332).
421
+
422
+ Both conditions are needed, and each of them alone would undo a decision
423
+ this gate already made:
424
+
425
+ - the receiver alone would excuse `self.check(`, where the graph does
426
+ know who calls the method;
427
+ - the callers alone would excuse `graph.jsonify`, where the receiver is
428
+ a symbol this repo defines.
429
+ """
430
+ if receiver is None:
431
+ return False
432
+ if _defines(graph, receiver, fold_case):
433
+ return False
434
+ key = word.lower() if fold_case else word
435
+ for node_id, data in graph.nodes(data=True):
436
+ if is_placeholder(data):
437
+ continue
438
+ name = str(data.get("name", ""))
439
+ name_key = name.lower() if fold_case else name
440
+ id_key = node_id.lower() if fold_case else node_id
441
+ if name_key != key and id_key != key:
442
+ continue
443
+ if _has_callers(graph, node_id):
444
+ return False
445
+ return True
446
+
447
+
448
+ def _graph_symbol(
449
+ graph: Any, tokens: list[tuple[str, str | None]], fold_case: bool
450
+ ) -> tuple[str, str] | None:
272
451
  """First token that IS something this repo defines (exact id or name), else None.
273
452
 
274
453
  A placeholder does not count. `json` is in the graph because a file imports
@@ -278,15 +457,26 @@ def _graph_symbol(graph: Any, tokens: list[str], fold_case: bool) -> tuple[str,
278
457
 
279
458
  Case is compared the way the search compares it. A case-exact search for
280
459
  `DONE` cannot find a function `done`, so it is not a search for one.
460
+
461
+ A qualified member the graph cannot answer for is not a symbol this
462
+ search is about, and does not refuse it (round 332).
281
463
  """
282
- wanted = {(token.lower() if fold_case else token): token for token in tokens}
464
+ wanted = {(token.lower() if fold_case else token): token for token, _ in tokens}
465
+ receivers = {(token.lower() if fold_case else token): receiver for token, receiver in tokens}
466
+ exempt: set[str] = set()
283
467
  for node_id, data in graph.nodes(data=True):
284
468
  if is_placeholder(data):
285
469
  continue
286
470
  for candidate in (node_id, str(data.get("name", ""))):
287
471
  key = candidate.lower() if fold_case else candidate
288
- if key and key in wanted:
289
- return node_id, wanted[key]
472
+ if not (key and key in wanted):
473
+ continue
474
+ if key in exempt:
475
+ continue
476
+ if _exempt_member(graph, key, receivers.get(key), fold_case):
477
+ exempt.add(key)
478
+ continue
479
+ return node_id, wanted[key]
290
480
  return None
291
481
 
292
482
 
@@ -1415,6 +1415,29 @@ def cmd_query(args: argparse.Namespace) -> int:
1415
1415
  return 0
1416
1416
 
1417
1417
 
1418
+ def _search_summary(result: dict[str, Any]) -> str:
1419
+ """The one line that says what was shown, how much exists, and how to see it.
1420
+
1421
+ `20 match(es)` reads as the total, and an agent that reads it that way
1422
+ believes the graph fell short and falls back to searching files one at a
1423
+ time -- the outcome the graph-first rule exists to prevent. The full
1424
+ answer was one flag away, so the line now says so (round 330). The JSON
1425
+ form already carried both figures and is unchanged.
1426
+ """
1427
+ count = result["count"]
1428
+ query = result["query"]
1429
+ if not result.get("truncated"):
1430
+ return f"[graphite] {count} match(es) for: {query}"
1431
+ total = result["total_matches"]
1432
+ if total <= MAX_SEARCH_LIMIT:
1433
+ way_out = f"pass --limit {total} to see all"
1434
+ else:
1435
+ # `--limit` is capped, so naming a number above the cap would be a
1436
+ # false instruction. Say the cap instead.
1437
+ way_out = f"--limit caps at {MAX_SEARCH_LIMIT}"
1438
+ return f"[graphite] {count} of {total} match(es) for: {query} (truncated; {way_out})"
1439
+
1440
+
1418
1441
  def cmd_search(args: argparse.Namespace) -> int:
1419
1442
  started = time.perf_counter()
1420
1443
  g = _load_cli_graph(args)
@@ -1426,8 +1449,7 @@ def cmd_search(args: argparse.Namespace) -> int:
1426
1449
  elif not result["results"]:
1427
1450
  print(f"[graphite] no matches for: {result['query']}")
1428
1451
  else:
1429
- suffix = " (truncated)" if result["truncated"] else ""
1430
- print(f"[graphite] {result['count']} match(es) for: {result['query']}{suffix}")
1452
+ print(_search_summary(result))
1431
1453
  for item in result["results"]:
1432
1454
  location = f" ({item['source_file']})" if item["source_file"] else ""
1433
1455
  print(f" - {item['id']} [{item['kind']}, {item['match_type']}]{location}")
@@ -3362,7 +3384,12 @@ def build_parser() -> argparse.ArgumentParser:
3362
3384
  default=_DEFAULT_GRAPH_JSON,
3363
3385
  help="Path to graph.json",
3364
3386
  )
3365
- p_search.add_argument("--limit", type=int, default=DEFAULT_SEARCH_LIMIT, help="Maximum results")
3387
+ p_search.add_argument(
3388
+ "--limit",
3389
+ type=int,
3390
+ default=DEFAULT_SEARCH_LIMIT,
3391
+ help=f"Maximum results (default: {DEFAULT_SEARCH_LIMIT})",
3392
+ )
3366
3393
  p_search.add_argument("--json", action="store_true", help="Emit machine-readable JSON")
3367
3394
  p_search.set_defaults(func=cmd_search)
3368
3395
 
@@ -1121,6 +1121,231 @@ def test_a_fragment_of_a_literal_is_not_judged_alone(
1121
1121
  assert _decision(out) == expected, pattern
1122
1122
 
1123
1123
 
1124
+ # --------------------------------- a phrase is literal text, not a symbol (331) --
1125
+ # The gate refused a search for a PHRASE because one of its words happened to
1126
+ # be a name this repo defines. `the parser tree` is a search for that phrase;
1127
+ # it cannot find the function `parser`. Whether it was refused depended on
1128
+ # where the word fell in the sentence: `Send Test Email` passed and `email
1129
+ # you` did not, because the comparison is case-exact (round 331).
1130
+ #
1131
+ # The rule that already skips a piece of a path, a file's name or a hyphenated
1132
+ # option is the same one: a fragment of a longer literal is not judged alone.
1133
+ # A required space beside a word is that kind of joining character. Each arm
1134
+ # below has its own deny control, so an arm that starts to allow by removing
1135
+ # the rule, instead of repairing it, turns a control red.
1136
+
1137
+
1138
+ @pytest.mark.parametrize(
1139
+ ("pattern", "expected"),
1140
+ [
1141
+ # the deny control: the bare name is the search
1142
+ ("dependents", "deny"),
1143
+ # prose that contains a name this repo defines
1144
+ ("the dependents call", "allow"),
1145
+ ("dependents and check", "allow"),
1146
+ ("check the round", "allow"),
1147
+ ("round one message", "allow"),
1148
+ ("out of the graph", "allow"),
1149
+ # a code-shaped search is a phrase too. The reporter's rule is that a
1150
+ # word inside a pattern carrying whitespace is a fragment of a longer
1151
+ # literal, and this is that. The bare name and the escape form are
1152
+ # still refused, so the nudge survives in its strongest forms; what
1153
+ # is given up is the nudge for a search written `def <name>`.
1154
+ ("def dependents", "allow"),
1155
+ # a space that is not interior does not join: it cannot be added to
1156
+ # any pattern to smuggle a bare name past the gate
1157
+ ("dependents ", "deny"),
1158
+ (" dependents", "deny"),
1159
+ # a space at the edge of a branch, a group or an anchor is the same
1160
+ # space at the edge of the search: `dependents |zzqx` is the first
1161
+ # branch `dependents `, and `zzqx| dependents` is the second branch
1162
+ # ` dependents`
1163
+ ("dependents |zzqx", "deny"),
1164
+ ("zzqx| dependents", "deny"),
1165
+ ("(dependents )", "deny"),
1166
+ ("( dependents)", "deny"),
1167
+ ("^dependents $", "deny"),
1168
+ # a space that may be absent is not a joining character either
1169
+ ("dependents ?x", "deny"),
1170
+ ("dependents *x", "deny"),
1171
+ ("dependents +x", "deny"),
1172
+ ("dependents {0,2}x", "deny"),
1173
+ # a quantifier this hook cannot parse, in the dialect that has it:
1174
+ # BRE writes the optional `?` escaped, and ERE accepts `{,n}`
1175
+ ("dependents \\?(", "deny"),
1176
+ ("dependents \\{0,1\\}x", "deny"),
1177
+ ("dependents {,1}x", "deny"),
1178
+ # an escape is an operator, not a space the matched text must carry
1179
+ ("dependents\\sx", "deny"),
1180
+ ("\\bdependents\\b", "deny"),
1181
+ ("^\\s*def\\s+dependents\\b", "deny"),
1182
+ # one branch is judged on its own: the other is a phrase
1183
+ ("dependents|the check", "deny"),
1184
+ ("zzqx|the check", "allow"),
1185
+ # a call is not a phrase
1186
+ ("dependents(", "deny"),
1187
+ ],
1188
+ )
1189
+ def test_a_phrase_is_not_judged_for_the_name_it_contains(
1190
+ literal_repo: Path, pattern: str, expected: str
1191
+ ) -> None:
1192
+ """A space the matched text must carry makes the word beside it a fragment
1193
+ of a longer literal, so the search is for the phrase and not for the name."""
1194
+ out = handle_pre_tool_use(_grep_payload(literal_repo, pattern, path="src/"), "strict")
1195
+
1196
+ assert _decision(out) == expected, pattern
1197
+
1198
+
1199
+ @pytest.mark.parametrize(
1200
+ ("command", "expected"),
1201
+ [
1202
+ ("grep -rn 'the dependents call' src/", "allow"),
1203
+ ("grep -rnE 'dependents and check' src/", "allow"),
1204
+ ("grep -rn 'dependents' src/", "deny"),
1205
+ ("rg 'the dependents call' src/", "allow"),
1206
+ ("rg 'dependents' src/", "deny"),
1207
+ # the edge of a branch and the edge of a group, on the shell route
1208
+ ("grep -rn 'dependents |zzqx' src/", "deny"),
1209
+ ("grep -rn 'zzqx| dependents' src/", "deny"),
1210
+ ("grep -rnE '(dependents )' src/", "deny"),
1211
+ # BRE writes the optional quantifier escaped, and ERE accepts `{,n}`.
1212
+ # Plain `grep` is BRE, so `\\?` there makes the space optional and the
1213
+ # pattern still matches the bare name.
1214
+ ("grep -rn 'dependents \\?(' src/", "deny"),
1215
+ ("grep -rn 'dependents \\{0,1\\}(' src/", "deny"),
1216
+ ("grep -rnE 'dependents {,1}(' src/", "deny"),
1217
+ ],
1218
+ )
1219
+ def test_a_phrase_is_not_judged_in_a_shell_search_either(
1220
+ literal_repo: Path, command: str, expected: str
1221
+ ) -> None:
1222
+ """The shell route reads the same pattern and must reach the same verdict."""
1223
+ out = handle_pre_tool_use(_bash_payload(literal_repo, command), "strict")
1224
+
1225
+ assert _decision(out) == expected, command
1226
+
1227
+
1228
+ @pytest.mark.parametrize(
1229
+ ("command", "expected"),
1230
+ [
1231
+ ("Select-String -Pattern 'the dependents call' -Path src/", "allow"),
1232
+ ("Select-String -Pattern 'dependents' -Path src/", "deny"),
1233
+ ],
1234
+ )
1235
+ def test_a_phrase_is_not_judged_in_a_powershell_search_either(
1236
+ literal_repo: Path, command: str, expected: str
1237
+ ) -> None:
1238
+ """PowerShell is a third route, and it reads the same pattern."""
1239
+ out = handle_pre_tool_use(_ps_payload(literal_repo, command), "strict")
1240
+
1241
+ assert _decision(out) == expected, command
1242
+
1243
+
1244
+ @pytest.mark.parametrize(
1245
+ "command",
1246
+ [
1247
+ "grep -rn 'the dependents call' src/ ; grep -rn dependents src/",
1248
+ "grep -rn 'the dependents call' src/ && grep -rn check src/",
1249
+ ],
1250
+ )
1251
+ def test_a_phrase_does_not_excuse_another_search_in_the_same_command(
1252
+ literal_repo: Path, command: str
1253
+ ) -> None:
1254
+ """One refused search refuses the command. A phrase beside it changes
1255
+ nothing."""
1256
+ out = handle_pre_tool_use(_bash_payload(literal_repo, command), "strict")
1257
+
1258
+ assert _decision(out) == "deny", command
1259
+
1260
+
1261
+ def test_a_phrase_search_still_reports_the_graph_first_reminder(literal_repo: Path) -> None:
1262
+ """A phrase is allowed, and the advisory still reaches the agent: the graph
1263
+ is the way to answer a relationship question, and this search is not one."""
1264
+ out = handle_pre_tool_use(_grep_payload(literal_repo, "the dependents call", path="src/"), "strict")
1265
+
1266
+ hook = out["hookSpecificOutput"]
1267
+ assert "permissionDecision" not in hook
1268
+ assert "graph-first" in hook["additionalContext"]
1269
+
1270
+
1271
+ # ------------------------- a qualified member the graph cannot answer for (332) --
1272
+ # The gate refused `CLIENT_SETTINGS\.put\(` because `put` is a property of a
1273
+ # test mock's object literal -- a node nothing calls, so the route the refusal
1274
+ # offers (`callers put`) answers with an empty list. The member was a call on
1275
+ # something the graph does not model, and the graph had nothing to say about
1276
+ # it.
1277
+ #
1278
+ # A member is exempt only when BOTH hold: the receiver is not something this
1279
+ # repo defines, and nothing in this repo calls anything of that name. Either
1280
+ # alone would undo an arm the table above already pins.
1281
+
1282
+
1283
+ @pytest.mark.parametrize(
1284
+ ("pattern", "expected"),
1285
+ [
1286
+ # the member has callers: the graph knows who calls it
1287
+ ("env\\.run\\(", "deny"),
1288
+ ("env\\.check\\(", "deny"),
1289
+ # the member has none, and the receiver is not a symbol of this repo:
1290
+ # the graph has no relationship to offer for it
1291
+ ("env\\.graph\\(", "allow"),
1292
+ ("env\\.round\\(", "allow"),
1293
+ # the receiver IS a symbol of this repo, so the dotted name is a
1294
+ # search for a member of something the graph does model
1295
+ ("round\\.out\\(", "deny"),
1296
+ ("dependents\\.attr\\(", "deny"),
1297
+ ("graph\\.jsonify", "deny"),
1298
+ # a bare word is still refused, including one nothing calls
1299
+ ("graph", "deny"),
1300
+ ("round", "deny"),
1301
+ # a word that appears bare somewhere is a search for the bare name too
1302
+ ("graph|env\\.graph\\(", "deny"),
1303
+ ],
1304
+ )
1305
+ def test_a_qualified_member_the_graph_cannot_answer_for_is_not_refused(
1306
+ literal_repo: Path, pattern: str, expected: str
1307
+ ) -> None:
1308
+ """A member of something this repo does not define, that nothing here
1309
+ calls, is not a symbol this search is about."""
1310
+ out = handle_pre_tool_use(_grep_payload(literal_repo, pattern, path="src/"), "strict")
1311
+
1312
+ assert _decision(out) == expected, pattern
1313
+
1314
+
1315
+ @pytest.mark.parametrize(
1316
+ ("command", "expected"),
1317
+ [
1318
+ ("grep -rn 'env\\.run\\(' src/", "deny"),
1319
+ ("grep -rn 'env\\.graph\\(' src/", "allow"),
1320
+ ("grep -rnE 'env\\.round\\(' src/", "allow"),
1321
+ ("grep -rnE 'round\\.out\\(' src/", "deny"),
1322
+ ],
1323
+ )
1324
+ def test_a_qualified_member_is_judged_the_same_on_the_shell_route(
1325
+ literal_repo: Path, command: str, expected: str
1326
+ ) -> None:
1327
+ """The shell route reads the same pattern and must reach the same verdict."""
1328
+ out = handle_pre_tool_use(_bash_payload(literal_repo, command), "strict")
1329
+
1330
+ assert _decision(out) == expected, command
1331
+
1332
+
1333
+ @pytest.mark.parametrize(
1334
+ ("command", "expected"),
1335
+ [
1336
+ ("Select-String -Pattern 'env\\.run\\(' -Path src/", "deny"),
1337
+ ("Select-String -Pattern 'env\\.graph\\(' -Path src/", "allow"),
1338
+ ],
1339
+ )
1340
+ def test_a_qualified_member_is_judged_the_same_on_the_powershell_route(
1341
+ literal_repo: Path, command: str, expected: str
1342
+ ) -> None:
1343
+ """PowerShell is a third route, and it reads the same pattern."""
1344
+ out = handle_pre_tool_use(_ps_payload(literal_repo, command), "strict")
1345
+
1346
+ assert _decision(out) == expected, command
1347
+
1348
+
1124
1349
  # ------------------------------------------- options the command line does not show --
1125
1350
  # Measured: `GREP_OPTIONS=-i grep ledger` finds `class Ledger:` with the grep
1126
1351
  # Git Bash ships, and `rg ledger` finds it once `RIPGREP_CONFIG_PATH` names a