codedoctor 0.1.3__tar.gz → 0.1.5__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 (143) hide show
  1. {codedoctor-0.1.3 → codedoctor-0.1.5}/.pre-commit-config.yaml +29 -29
  2. {codedoctor-0.1.3 → codedoctor-0.1.5}/CHANGELOG.md +33 -0
  3. {codedoctor-0.1.3 → codedoctor-0.1.5}/PKG-INFO +59 -18
  4. {codedoctor-0.1.3 → codedoctor-0.1.5}/README.md +58 -17
  5. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/affected/affected.py +3 -0
  6. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/affected/affected_test.py +29 -0
  7. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/affected/backbone.py +5 -2
  8. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/affected/backbone_test.py +12 -2
  9. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/affected/codegraph_sync.py +6 -17
  10. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/affected/codegraph_sync_test.py +17 -37
  11. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/assert_isinstance/unnecessary_assert_isinstance.py +14 -14
  12. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/assert_isinstance/unnecessary_assert_isinstance_test.py +7 -7
  13. codedoctor-0.1.5/codedoctor/cli.py +128 -0
  14. codedoctor-0.1.5/codedoctor/cli_test.py +283 -0
  15. codedoctor-0.1.5/codedoctor/codegraph.py +116 -0
  16. codedoctor-0.1.5/codedoctor/codegraph_test.py +224 -0
  17. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/gate/gate_test.py +21 -2
  18. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/install.py +171 -97
  19. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/install_hooks.yaml +29 -29
  20. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/install_test.py +340 -45
  21. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/lib/kernel_pins.py +2 -1
  22. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/lib/kernel_pins_test.py +4 -0
  23. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/lib/pyproject_flags.py +9 -6
  24. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/lib/pyproject_flags_test.py +38 -0
  25. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/lib/sidecars_test.py +22 -9
  26. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/lib/testing/resources.py +5 -6
  27. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/lint/__main__.py +2 -2
  28. codedoctor-0.1.3/codedoctor/lint/houselint.py → codedoctor-0.1.5/codedoctor/lint/checker.py +73 -68
  29. codedoctor-0.1.3/codedoctor/lint/houselint_test.py → codedoctor-0.1.5/codedoctor/lint/checker_test.py +246 -228
  30. codedoctor-0.1.3/codedoctor/lint/houselint_types.py → codedoctor-0.1.5/codedoctor/lint/custom_types.py +1 -1
  31. codedoctor-0.1.3/codedoctor/lint/houselint_types_test.py → codedoctor-0.1.5/codedoctor/lint/custom_types_test.py +2 -2
  32. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/lint/house_ignore.py +10 -10
  33. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/lint/house_ignore_test.py +5 -5
  34. codedoctor-0.1.3/codedoctor/lint/houselint_rules.py → codedoctor-0.1.5/codedoctor/lint/rules.py +31 -12
  35. codedoctor-0.1.3/codedoctor/lint/houselint_rules_test.py → codedoctor-0.1.5/codedoctor/lint/rules_test.py +385 -192
  36. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/mutation/mutated.py +234 -138
  37. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/mutation/mutated_test.py +398 -37
  38. codedoctor-0.1.5/codedoctor/policy.py +261 -0
  39. codedoctor-0.1.5/codedoctor/policy_test.py +240 -0
  40. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/testing/testing.py +44 -16
  41. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/testing/testing_test.py +78 -5
  42. {codedoctor-0.1.3 → codedoctor-0.1.5}/pyproject.toml +5 -6
  43. {codedoctor-0.1.3 → codedoctor-0.1.5}/tests/lib/testing/resources_test.py +1 -1
  44. {codedoctor-0.1.3 → codedoctor-0.1.5}/uv.lock +3 -3
  45. codedoctor-0.1.3/codedoctor/cli.py +0 -52
  46. codedoctor-0.1.3/codedoctor/cli_test.py +0 -135
  47. {codedoctor-0.1.3 → codedoctor-0.1.5}/.gitignore +0 -0
  48. {codedoctor-0.1.3 → codedoctor-0.1.5}/.python-version +0 -0
  49. {codedoctor-0.1.3 → codedoctor-0.1.5}/AI_POLICY.md +0 -0
  50. {codedoctor-0.1.3 → codedoctor-0.1.5}/CODE_OF_CONDUCT.md +0 -0
  51. {codedoctor-0.1.3 → codedoctor-0.1.5}/CONTRIBUTING.md +0 -0
  52. {codedoctor-0.1.3 → codedoctor-0.1.5}/LICENSE +0 -0
  53. {codedoctor-0.1.3 → codedoctor-0.1.5}/RELEASING.md +0 -0
  54. {codedoctor-0.1.3 → codedoctor-0.1.5}/SECURITY.md +0 -0
  55. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/__init__.py +0 -0
  56. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/__main__.py +0 -0
  57. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/affected/__init__.py +0 -0
  58. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/affected/__main__.py +0 -0
  59. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/assert_isinstance/__init__.py +0 -0
  60. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/assert_isinstance/__main__.py +0 -0
  61. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/coverage_floor/__init__.py +0 -0
  62. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/coverage_floor/__main__.py +0 -0
  63. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/coverage_floor/coverage_floor.py +0 -0
  64. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/coverage_floor/coverage_floor_test.py +0 -0
  65. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/export_leaks/__init__.py +0 -0
  66. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/export_leaks/__main__.py +0 -0
  67. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/export_leaks/check_export_leaks.py +0 -0
  68. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/export_leaks/check_export_leaks_test.py +0 -0
  69. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/export_leaks/check_pr_text.py +0 -0
  70. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/export_leaks/check_pr_text_test.py +0 -0
  71. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/gate/__init__.py +0 -0
  72. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/gate/__main__.py +0 -0
  73. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/gate/fakes.py +0 -0
  74. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/gate/fakes_test.py +0 -0
  75. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/gate/gate.py +0 -0
  76. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/gate/spool.py +0 -0
  77. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/gate/spool_test.py +0 -0
  78. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/lib/__init__.py +0 -0
  79. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/lib/files/__init__.py +0 -0
  80. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/lib/files/glob.py +0 -0
  81. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/lib/files/glob_test.py +0 -0
  82. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/lib/files/grep.py +0 -0
  83. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/lib/files/grep_test.py +0 -0
  84. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/lib/files/owner_only.py +0 -0
  85. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/lib/files/owner_only_test.py +0 -0
  86. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/lib/files/source_version.py +0 -0
  87. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/lib/files/source_version_test.py +0 -0
  88. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/lib/files/tempclaim.py +0 -0
  89. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/lib/files/tempclaim_test.py +0 -0
  90. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/lib/files/walk.py +0 -0
  91. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/lib/files/walk_test.py +0 -0
  92. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/lib/sidecars.py +0 -0
  93. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/lib/testing/__init__.py +0 -0
  94. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/lib/testing/basetemp.py +0 -0
  95. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/lib/testing/checks.py +0 -0
  96. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/lib/testing/checks_test.py +0 -0
  97. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/lib/testing/runner.py +0 -0
  98. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/lib/testing/runner_test.py +0 -0
  99. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/lib/testing/wheel.py +0 -0
  100. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/lib/userdirs.py +0 -0
  101. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/lib/worker_count.py +0 -0
  102. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/lib/worker_count_test.py +0 -0
  103. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/lint/__init__.py +0 -0
  104. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/mutation/__init__.py +0 -0
  105. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/mutation/__main__.py +0 -0
  106. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/mutation/mutmut_dynamo.py +0 -0
  107. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/mutation/mutmut_dynamo_test.py +0 -0
  108. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/mutation/mutmut_kill_guard.py +0 -0
  109. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/mutation/mutmut_kill_guard_test.py +0 -0
  110. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/mutation/mutmut_outcome.py +0 -0
  111. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/mutation/mutmut_outcome_test.py +0 -0
  112. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/mutation/mutmut_param_ids.py +0 -0
  113. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/mutation/mutmut_param_ids_test.py +0 -0
  114. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/nbstripout/__init__.py +0 -0
  115. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/nbstripout/__main__.py +0 -0
  116. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/nbstripout/nbstripout_hook.py +0 -0
  117. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/nbstripout/nbstripout_hook_test.py +0 -0
  118. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/py.typed +0 -0
  119. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/testing/__init__.py +0 -0
  120. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/testing/__main__.py +0 -0
  121. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/testing/coverage_summary.py +0 -0
  122. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/testing/coverage_summary_test.py +0 -0
  123. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/testing/listing.py +0 -0
  124. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/testing/listing_test.py +0 -0
  125. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/testing/outcomes.py +0 -0
  126. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/testing/outcomes_test.py +0 -0
  127. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/testing/tiers.py +0 -0
  128. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/testing/tiers_test.py +0 -0
  129. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/typecheck/__init__.py +0 -0
  130. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/typecheck/__main__.py +0 -0
  131. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/typecheck/scope.py +0 -0
  132. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/typecheck/scope_test.py +0 -0
  133. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/typecheck/typecheck.py +0 -0
  134. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/typecheck/typecheck_test.py +0 -0
  135. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/yamlcheck/__init__.py +0 -0
  136. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/yamlcheck/__main__.py +0 -0
  137. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/yamlcheck/checker.py +0 -0
  138. {codedoctor-0.1.3 → codedoctor-0.1.5}/codedoctor/yamlcheck/checker_test.py +0 -0
  139. {codedoctor-0.1.3 → codedoctor-0.1.5}/conftest.py +0 -0
  140. {codedoctor-0.1.3 → codedoctor-0.1.5}/tests/lib/testing/basetemp_test.py +0 -0
  141. {codedoctor-0.1.3 → codedoctor-0.1.5}/tests/lib/testing/wheel_test.py +0 -0
  142. {codedoctor-0.1.3 → codedoctor-0.1.5}/tests/lib/userdirs_test.py +0 -0
  143. {codedoctor-0.1.3 → codedoctor-0.1.5}/typings/.gitkeep +0 -0
@@ -176,7 +176,7 @@ repos:
176
176
  name: check-yaml
177
177
  stages: [pre-commit]
178
178
  language: system
179
- entry: uv --quiet run --frozen --group pre-commit python -m codedoctor.yamlcheck
179
+ entry: uv --quiet run --frozen --group pre-commit python -m codedoctor yamlcheck
180
180
 
181
181
  - id: check-toml
182
182
  name: check-toml
@@ -251,7 +251,7 @@ repos:
251
251
  language: system
252
252
  stages: [pre-commit]
253
253
  types: [jupyter]
254
- entry: uv --quiet run --frozen --group pre-commit python -m codedoctor.nbstripout
254
+ entry: uv --quiet run --frozen --group pre-commit python -m codedoctor nbstripout
255
255
  args:
256
256
  - --drop-empty-cells
257
257
  - --extra-keys
@@ -273,7 +273,7 @@ repos:
273
273
  |(.*/)?third_party/
274
274
  )
275
275
 
276
- # Writes each notebook's paired `.py`, so it runs before houselint and
276
+ # Writes each notebook's paired `.py`, so it runs before codedoctor lint and
277
277
  # ruff, which then lint and format that output in the same pass.
278
278
  - id: jupytext-sync
279
279
  name: jupytext-sync
@@ -296,7 +296,7 @@ repos:
296
296
  # exactly once between them, so a hook per rule buys nothing and costs
297
297
  # an interpreter startup each (measured, 120 files, 3 rules: 0.81s ->
298
298
  # 0.45s). Which rules run, fix, and skip which paths lives in
299
- # `[tool.houselint]` of pyproject.toml, so a bare `houselint.py
299
+ # `[tool.codedoctor.lint]` of pyproject.toml, so a bare `codedoctor lint
300
300
  # FILES` behaves exactly as this hook does.
301
301
  #
302
302
  # `require_serial: true`: pre-commit's own partitioning would fork
@@ -307,13 +307,13 @@ repos:
307
307
  # commit stays serial. Measured on the 128-thread server, best of 3: 5 files 0.16s
308
308
  # serial vs 0.30s pooled; 50 files 0.92s vs 0.50s; the full tree (4094
309
309
  # files) 21.8s serial vs 1.46s at 24 workers.
310
- - id: houselint
311
- name: houselint
310
+ - id: codedoctor-lint
311
+ name: codedoctor lint
312
312
  language: system
313
313
  stages: [pre-commit]
314
314
  require_serial: true
315
315
  types_or: [python, jupyter]
316
- entry: uv --quiet run --frozen --group pre-commit python -m codedoctor.lint
316
+ entry: uv --quiet run --frozen --group pre-commit python -m codedoctor lint
317
317
 
318
318
  - id: codespell
319
319
  name: codespell
@@ -381,7 +381,7 @@ repos:
381
381
  language: system
382
382
  stages: [commit-msg]
383
383
  always_run: true
384
- entry: uv --quiet run --frozen --group pre-commit python -m codedoctor.export_leaks.check_pr_text
384
+ entry: uv --quiet run --frozen --group pre-commit python -m codedoctor check-pr-text
385
385
 
386
386
  - repo: local
387
387
  hooks:
@@ -478,7 +478,7 @@ repos:
478
478
  types: [python]
479
479
  pass_filenames: false
480
480
  entry: >-
481
- uv --quiet run --frozen --group pre-commit python -m codedoctor.affected.codegraph_sync
481
+ uv --quiet run --frozen --group pre-commit python -m codedoctor codegraph-sync
482
482
  --caches /opt/scratch/caches/codegraph
483
483
 
484
484
  # No official ty hook yet (https://github.com/astral-sh/ty/issues/269).
@@ -500,7 +500,7 @@ repos:
500
500
  stages: [pre-commit]
501
501
  require_serial: true
502
502
  types_or: [python, pyi]
503
- entry: uv --quiet run --frozen --group pre-commit python -m codedoctor.gate spool ty-check
503
+ entry: uv --quiet run --frozen --group pre-commit python -m codedoctor gate spool ty-check
504
504
 
505
505
  - id: ty-check
506
506
  name: ty-check
@@ -512,7 +512,7 @@ repos:
512
512
  # See `superseded-at-pre-push` at the head of the Pre-Push Gates section.
513
513
  alias: superseded-at-pre-push
514
514
  types_or: [python, pyi]
515
- entry: uv --quiet run --frozen --group pre-commit python -m codedoctor.typecheck ty-check
515
+ entry: uv --quiet run --frozen --group pre-commit python -m codedoctor typecheck ty-check
516
516
  # Resolved affected:N scopes read the index maintained above.
517
517
  args: [--dependents, codedoctor.affected]
518
518
 
@@ -524,7 +524,7 @@ repos:
524
524
  stages: [pre-commit]
525
525
  require_serial: true
526
526
  types_or: [python, pyi]
527
- entry: uv --quiet run --frozen --group pre-commit python -m codedoctor.gate spool pyrefly-check
527
+ entry: uv --quiet run --frozen --group pre-commit python -m codedoctor gate spool pyrefly-check
528
528
 
529
529
  - id: pyrefly-check
530
530
  name: pyrefly-check
@@ -536,7 +536,7 @@ repos:
536
536
  # See `superseded-at-pre-push` at the head of the Pre-Push Gates section.
537
537
  alias: superseded-at-pre-push
538
538
  types_or: [python, pyi]
539
- entry: uv --quiet run --frozen --group pre-commit python -m codedoctor.typecheck pyrefly-check
539
+ entry: uv --quiet run --frozen --group pre-commit python -m codedoctor typecheck pyrefly-check
540
540
  # Widens on its own only when `ty-check` was skipped. The fixer is one
541
541
  # pyrefly run that also deletes each unnecessary `assert isinstance`.
542
542
  args:
@@ -555,7 +555,7 @@ repos:
555
555
  stages: [pre-commit]
556
556
  require_serial: true
557
557
  types_or: [python, pyi]
558
- entry: uv --quiet run --frozen --group pre-commit python -m codedoctor.gate spool basedpyright
558
+ entry: uv --quiet run --frozen --group pre-commit python -m codedoctor gate spool basedpyright
559
559
  exclude: |
560
560
  (?x)^(
561
561
  typings/
@@ -577,7 +577,7 @@ repos:
577
577
  types_or: [python, pyi]
578
578
  entry: >-
579
579
  env NODE_OPTIONS=--max-old-space-size=2048
580
- uv --quiet run --frozen --group pre-commit python -m codedoctor.typecheck
580
+ uv --quiet run --frozen --group pre-commit python -m codedoctor typecheck
581
581
  basedpyright
582
582
  # Widens as `ty-check` does; the fixer is one basedpyright run that
583
583
  # also deletes each unnecessary `assert isinstance`.
@@ -606,7 +606,7 @@ repos:
606
606
  language: system
607
607
  stages: [pre-commit]
608
608
  require_serial: true
609
- entry: uv --quiet run --frozen --group pre-commit python -m codedoctor.gate spool check-export-leaks
609
+ entry: uv --quiet run --frozen --group pre-commit python -m codedoctor gate spool check-export-leaks
610
610
 
611
611
  - id: check-export-leaks
612
612
  name: check-export-leaks
@@ -614,7 +614,7 @@ repos:
614
614
  stages: [pre-commit]
615
615
  require_serial: true
616
616
  pass_filenames: false
617
- entry: uv --quiet run --frozen --group pre-commit python -m codedoctor.gate run check-export-leaks -- codedoctor.export_leaks
617
+ entry: uv --quiet run --frozen --group pre-commit python -m codedoctor gate run check-export-leaks -- codedoctor.export_leaks
618
618
 
619
619
  # Runs the tests PAIRED with each changed file (`x_test.py`, `test_x.py`,
620
620
  # beside it or under `tests/`), then applies `fail_under` to the changed
@@ -645,7 +645,7 @@ repos:
645
645
  stages: [pre-commit]
646
646
  require_serial: true
647
647
  types: [python]
648
- entry: uv --quiet run --frozen --group pre-commit python -m codedoctor.gate spool pytest
648
+ entry: uv --quiet run --frozen --group pre-commit python -m codedoctor gate spool pytest
649
649
 
650
650
  - id: pytest
651
651
  name: pytest
@@ -659,7 +659,7 @@ repos:
659
659
  # See `superseded-at-pre-push` at the head of the Pre-Push Gates section.
660
660
  alias: superseded-at-pre-push
661
661
  types: [python]
662
- entry: uv --quiet run --frozen --group pre-commit python -m codedoctor.testing pytest
662
+ entry: uv --quiet run --frozen --group pre-commit python -m codedoctor testing pytest
663
663
  args: [--dependents, codedoctor.affected]
664
664
 
665
665
  # Disable with SKIP=mutation. Findings fail the hook. Over 741 commits,
@@ -679,7 +679,7 @@ repos:
679
679
  |(.*/)?\.export/typings/
680
680
  |(.*/)?third_party/
681
681
  )
682
- entry: uv --quiet run --frozen --group pre-commit python -m codedoctor.gate spool mutation
682
+ entry: uv --quiet run --frozen --group pre-commit python -m codedoctor gate spool mutation
683
683
 
684
684
  - id: mutation
685
685
  name: mutation
@@ -693,7 +693,7 @@ repos:
693
693
  types: [python]
694
694
  exclude: *mutation-exclude
695
695
  entry: >-
696
- uv --quiet run --frozen --group pre-commit python -m codedoctor.gate
696
+ uv --quiet run --frozen --group pre-commit python -m codedoctor gate
697
697
  run mutation -- codedoctor.mutation
698
698
  --function-sample-rate 0.05 --max-functions-sampled 4 --timeout-sec 900
699
699
  --explain --prefer-changed-in-pre-commit
@@ -712,7 +712,7 @@ repos:
712
712
  stages: [pre-commit]
713
713
  require_serial: true
714
714
  types: [python]
715
- entry: uv --quiet run --frozen --group pre-commit python -m codedoctor.gate spool coverage-floor
715
+ entry: uv --quiet run --frozen --group pre-commit python -m codedoctor gate spool coverage-floor
716
716
 
717
717
  - id: coverage-floor
718
718
  name: coverage-floor
@@ -722,7 +722,7 @@ repos:
722
722
  types: [python]
723
723
  require_serial: true
724
724
  pass_filenames: false
725
- entry: uv --quiet run --frozen --group pre-commit python -m codedoctor.testing coverage-floor
725
+ entry: uv --quiet run --frozen --group pre-commit python -m codedoctor testing coverage-floor
726
726
 
727
727
  # === Pre-Push Gates =========================================================
728
728
  #
@@ -765,7 +765,7 @@ repos:
765
765
  stages: [manual]
766
766
  entry: >-
767
767
  env NODE_OPTIONS=--max-old-space-size=2048
768
- uv --quiet run --frozen --group pre-commit python -m codedoctor.gate
768
+ uv --quiet run --frozen --group pre-commit python -m codedoctor gate
769
769
  threaded basedpyright-global -- basedpyright --threads={workers}
770
770
 
771
771
  - id: pyrefly-check-global
@@ -775,7 +775,7 @@ repos:
775
775
  pass_filenames: false
776
776
  stages: [pre-push]
777
777
  entry: >-
778
- uv --quiet run --frozen --group pre-commit python -m codedoctor.gate
778
+ uv --quiet run --frozen --group pre-commit python -m codedoctor gate
779
779
  threaded pyrefly-check-global -- pyrefly check --threads={workers}
780
780
 
781
781
  - id: pytest-global
@@ -785,7 +785,7 @@ repos:
785
785
  pass_filenames: false
786
786
  stages: [pre-push]
787
787
  verbose: true
788
- entry: uv --quiet run --frozen --group pre-commit python -m codedoctor.testing tier pytest-global
788
+ entry: uv --quiet run --frozen --group pre-commit python -m codedoctor testing tier pytest-global
789
789
  args: [--plugin, codedoctor.testing.listing]
790
790
 
791
791
  - id: pytest-slow-global
@@ -795,7 +795,7 @@ repos:
795
795
  pass_filenames: false
796
796
  stages: [pre-push]
797
797
  verbose: true
798
- entry: uv --quiet run --frozen --group pre-commit python -m codedoctor.testing tier pytest-slow-global
798
+ entry: uv --quiet run --frozen --group pre-commit python -m codedoctor testing tier pytest-slow-global
799
799
  args: [--plugin, codedoctor.testing.listing]
800
800
 
801
801
  - id: pytest-ci-smoke-global
@@ -805,7 +805,7 @@ repos:
805
805
  pass_filenames: false
806
806
  stages: [pre-push]
807
807
  verbose: true
808
- entry: uv --quiet run --frozen --group pre-commit python -m codedoctor.testing tier pytest-ci-smoke-global
808
+ entry: uv --quiet run --frozen --group pre-commit python -m codedoctor testing tier pytest-ci-smoke-global
809
809
  args: [--plugin, codedoctor.testing.listing]
810
810
 
811
811
  - id: pytest-integration-global
@@ -815,7 +815,7 @@ repos:
815
815
  pass_filenames: false
816
816
  stages: [pre-push]
817
817
  verbose: true
818
- entry: uv --quiet run --frozen --group pre-commit python -m codedoctor.testing tier pytest-integration-global
818
+ entry: uv --quiet run --frozen --group pre-commit python -m codedoctor testing tier pytest-integration-global
819
819
  args: [--plugin, codedoctor.testing.listing]
820
820
 
821
821
 
@@ -3,6 +3,39 @@
3
3
  All notable codedoctor changes are documented here. This project follows
4
4
  [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
5
5
 
6
+ ## 0.1.5 - 2026-11-08
7
+
8
+ ### Changed
9
+
10
+ - Run every stage through `codedoctor <stage>`.
11
+ - Rename houselint to `codedoctor lint` and migrate its configuration.
12
+ - Require `codedoctor install --notebooks` to add notebook tooling.
13
+ - Install only the pre-commit Git hook by default; pre-push remains opt-in.
14
+ - Let OpenBLAS detect the host's usable CPU instructions.
15
+
16
+ ### Fixed
17
+
18
+ - Preserve long hook commands, block scalars, arguments, and YAML aliases
19
+ during command migration.
20
+ - Cover projects with dynamic names when generating checker policy.
21
+
22
+ ## 0.1.4 - 2026-11-07
23
+
24
+ ### Changed
25
+
26
+ - Provision pinned, checksummed CodeGraph and skip indexing when unavailable.
27
+ - Generate checker policy from packaged defaults, preserving project overrides.
28
+ - Check for stale generated configuration.
29
+ - Require explicit project settings for user-directory lint rules.
30
+ - Apply coverage floors to sources owned by changed tests.
31
+
32
+ ### Fixed
33
+
34
+ - Preserve leading whitespace in hook configuration.
35
+ - Prove integer bounds for NumPy `arange` defaults.
36
+ - Restrict mutation's vendored-tree filter to stub directories.
37
+ - Fix mutant import shadowing.
38
+
6
39
  ## 0.1.3 - 2026-11-07
7
40
 
8
41
  ### Changed
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: codedoctor
3
- Version: 0.1.3
3
+ Version: 0.1.5
4
4
  Summary: Pre-commit gates that run each heavy check once, sized to the machine.
5
5
  Project-URL: Homepage, https://www.rekursiv.ai
6
6
  Project-URL: Repository, https://github.com/rekursiv-ai/codedoctor
@@ -89,16 +89,33 @@ uv run --group pre-commit pre-commit run --all-files
89
89
  ## Repository setup
90
90
 
91
91
  `codedoctor install` adds a locked `pre-commit` dependency group and installs
92
- pre-commit and pre-push Git hooks. It creates missing configuration and preserves
93
- existing hooks, comments, lint rules, and the project's Python support range.
92
+ the pre-commit Git hook. It creates missing configuration and preserves
93
+ existing hooks, comments, hook arguments, and the project's Python support range.
94
94
  Running it again does not duplicate hooks.
95
+ Notebook tooling is opt-in: `codedoctor install --notebooks` adds the notebook
96
+ extra and the `nbstripout` and `jupytext-sync` hooks. Default installs add
97
+ neither. Existing hooks are preserved, including previously added notebook
98
+ hooks.
99
+
100
+ The installer writes Ruff, ty, basedpyright, and pyrefly settings from the
101
+ package's bundled policy into `pyproject.toml`. It also configures pytest,
102
+ coverage floors, and mutation source selection. That policy comes from Loop's
103
+ canonical configuration, with checkout-specific paths removed. Existing project
104
+ settings remain overrides; installation reports their names.
105
+
106
+ Codedoctor is development tooling, not an application dependency. Applications
107
+ can use their own user-directory helpers or inline XDG handling. The installer
108
+ uses the project name for `userdirs-namespace.namespace`; set it explicitly in
109
+ `[tool.codedoctor.lint]` to choose another namespace. `xdg-literal.helper` is unset
110
+ unless the project requires a shared helper.
95
111
 
96
112
  Setup uses the same hook configuration as this repository, without its
97
113
  package-export and Rust-only checks. Commits autofix whitespace, spelling,
98
- notebooks, house lint, and Ruff formatting; check types with ty, pyrefly, and
114
+ Codedoctor lint, and Ruff formatting; check types with ty, pyrefly, and
99
115
  basedpyright; and run paired tests, coverage checks, and sampled mutation tests.
100
- Pushes run repository-wide type checks and the fast, slow, smoke, and integration
101
- test tiers. Dependency-graph setup precedes affected-file checks.
116
+ Pre-push checks are opt-in: install them with `pre-commit install --hook-type
117
+ pre-push` to run repository-wide type checks and all test tiers.
118
+ Dependency-graph setup precedes affected-file checks.
102
119
 
103
120
  Tests may use either `test_*.py` or `*_test.py`; existing discovery settings and
104
121
  coverage thresholds are preserved. Hooks that rewrite files abort that attempt;
@@ -120,6 +137,26 @@ Codedoctor requires Python 3.12 or newer. For projects supporting older Python,
120
137
  use the `uvx` route: its tools live in a Python 3.12+ dependency group without
121
138
  raising the application's runtime floor. Git and uv must already be installed.
122
139
 
140
+ ## Policy updates
141
+
142
+ Policy changes reach projects through a new Codedoctor release. Upgrade the
143
+ locked dependency, then reinstall:
144
+
145
+ ```bash
146
+ uv lock --upgrade-package codedoctor
147
+ uv run --group pre-commit codedoctor install
148
+ uv run --group pre-commit codedoctor check
149
+ ```
150
+
151
+ `[tool.codedoctor.managed]` records the last generated defaults. Reinstallation
152
+ updates unchanged managed settings and adds new defaults. It preserves project
153
+ overrides and deliberately deleted settings. Lists are replaced as whole values;
154
+ a customized list remains an override. Do not edit the recorded baseline.
155
+
156
+ `codedoctor check` exits nonzero when the installed package would refresh the
157
+ project configuration. It does not write files or install dependencies. Preserved
158
+ overrides do not make configuration stale.
159
+
123
160
  pre-commit calls a hook once per chunk of file names, so `--all-files` starts a
124
161
  type checker or pytest several times over. Each heavy gate here is two hooks: a
125
162
  `-spool` twin collects every chunk, then the gate runs once over all of them,
@@ -139,14 +176,14 @@ repos:
139
176
  language: system
140
177
  require_serial: true
141
178
  types_or: [python, pyi]
142
- entry: uv run python -m codedoctor.gate spool ty-check
179
+ entry: uv run codedoctor gate spool ty-check
143
180
  - id: ty-check
144
181
  name: ty-check
145
182
  language: system
146
183
  require_serial: true
147
184
  pass_filenames: false
148
185
  types_or: [python, pyi]
149
- entry: uv run python -m codedoctor.typecheck ty-check
186
+ entry: uv run codedoctor typecheck ty-check
150
187
  ```
151
188
 
152
189
  This repository's own [`.pre-commit-config.yaml`](.pre-commit-config.yaml) wires
@@ -154,17 +191,21 @@ every gate and is the fullest example.
154
191
 
155
192
  ## Gates
156
193
 
157
- | Module | Runs |
194
+ | Command | Runs |
158
195
  |---|---|
159
- | `codedoctor.gate` | `spool`, `run` and `threaded`: the shared machinery |
160
- | `codedoctor.typecheck` | `ty-check`, `pyrefly-check`, `basedpyright` |
161
- | `codedoctor.testing` | the tests paired with each changed file, whole-suite tiers, and the pytest plugin that selects and records node ids |
162
- | `codedoctor.coverage_floor` | each changed source's coverage by its own tests, read from the `pytest` gate's run |
163
- | `codedoctor.mutation` | mutation testing of the changed functions (`codedoctor[mutation]`) |
164
- | `codedoctor.lint` | `houselint`, AST rules configured in `[tool.houselint]` |
165
- | `codedoctor.assert_isinstance` | deletes each `assert isinstance` a checker proves redundant |
166
- | `codedoctor.affected` | the tests and files a change reaches, from a CodeGraph index |
167
- | `codedoctor.nbstripout` | notebook output stripping |
196
+ | `codedoctor gate` | `spool`, `run` and `threaded`: the shared machinery |
197
+ | `codedoctor typecheck` | `ty-check`, `pyrefly-check`, `basedpyright` |
198
+ | `codedoctor testing` | paired tests and whole-suite tiers |
199
+ | `codedoctor coverage-floor` | per-source coverage from the pytest gate |
200
+ | `codedoctor mutation` | changed-function mutation tests (`codedoctor[mutation]`) |
201
+ | `codedoctor lint` | AST rules configured in `[tool.codedoctor.lint]` |
202
+ | `codedoctor assert-isinstance` | redundant `assert isinstance` removal |
203
+ | `codedoctor affected` | files and tests reached through CodeGraph |
204
+ | `codedoctor nbstripout` | notebook output stripping |
205
+ | `codedoctor yamlcheck` | YAML validation, including Compose tags |
206
+ | `codedoctor export-leaks` | exported-package leak checks |
207
+ | `codedoctor codegraph-sync` | dependency-graph refresh |
208
+ | `codedoctor check-pr-text` | pull-request text validation |
168
209
 
169
210
  Worker counts: `WORKERS_<HOOK_ID>` wins, then `WORKERS_DEFAULT`, then a count
170
211
  derived from the machine's cores and free memory.
@@ -21,16 +21,33 @@ uv run --group pre-commit pre-commit run --all-files
21
21
  ## Repository setup
22
22
 
23
23
  `codedoctor install` adds a locked `pre-commit` dependency group and installs
24
- pre-commit and pre-push Git hooks. It creates missing configuration and preserves
25
- existing hooks, comments, lint rules, and the project's Python support range.
24
+ the pre-commit Git hook. It creates missing configuration and preserves
25
+ existing hooks, comments, hook arguments, and the project's Python support range.
26
26
  Running it again does not duplicate hooks.
27
+ Notebook tooling is opt-in: `codedoctor install --notebooks` adds the notebook
28
+ extra and the `nbstripout` and `jupytext-sync` hooks. Default installs add
29
+ neither. Existing hooks are preserved, including previously added notebook
30
+ hooks.
31
+
32
+ The installer writes Ruff, ty, basedpyright, and pyrefly settings from the
33
+ package's bundled policy into `pyproject.toml`. It also configures pytest,
34
+ coverage floors, and mutation source selection. That policy comes from Loop's
35
+ canonical configuration, with checkout-specific paths removed. Existing project
36
+ settings remain overrides; installation reports their names.
37
+
38
+ Codedoctor is development tooling, not an application dependency. Applications
39
+ can use their own user-directory helpers or inline XDG handling. The installer
40
+ uses the project name for `userdirs-namespace.namespace`; set it explicitly in
41
+ `[tool.codedoctor.lint]` to choose another namespace. `xdg-literal.helper` is unset
42
+ unless the project requires a shared helper.
27
43
 
28
44
  Setup uses the same hook configuration as this repository, without its
29
45
  package-export and Rust-only checks. Commits autofix whitespace, spelling,
30
- notebooks, house lint, and Ruff formatting; check types with ty, pyrefly, and
46
+ Codedoctor lint, and Ruff formatting; check types with ty, pyrefly, and
31
47
  basedpyright; and run paired tests, coverage checks, and sampled mutation tests.
32
- Pushes run repository-wide type checks and the fast, slow, smoke, and integration
33
- test tiers. Dependency-graph setup precedes affected-file checks.
48
+ Pre-push checks are opt-in: install them with `pre-commit install --hook-type
49
+ pre-push` to run repository-wide type checks and all test tiers.
50
+ Dependency-graph setup precedes affected-file checks.
34
51
 
35
52
  Tests may use either `test_*.py` or `*_test.py`; existing discovery settings and
36
53
  coverage thresholds are preserved. Hooks that rewrite files abort that attempt;
@@ -52,6 +69,26 @@ Codedoctor requires Python 3.12 or newer. For projects supporting older Python,
52
69
  use the `uvx` route: its tools live in a Python 3.12+ dependency group without
53
70
  raising the application's runtime floor. Git and uv must already be installed.
54
71
 
72
+ ## Policy updates
73
+
74
+ Policy changes reach projects through a new Codedoctor release. Upgrade the
75
+ locked dependency, then reinstall:
76
+
77
+ ```bash
78
+ uv lock --upgrade-package codedoctor
79
+ uv run --group pre-commit codedoctor install
80
+ uv run --group pre-commit codedoctor check
81
+ ```
82
+
83
+ `[tool.codedoctor.managed]` records the last generated defaults. Reinstallation
84
+ updates unchanged managed settings and adds new defaults. It preserves project
85
+ overrides and deliberately deleted settings. Lists are replaced as whole values;
86
+ a customized list remains an override. Do not edit the recorded baseline.
87
+
88
+ `codedoctor check` exits nonzero when the installed package would refresh the
89
+ project configuration. It does not write files or install dependencies. Preserved
90
+ overrides do not make configuration stale.
91
+
55
92
  pre-commit calls a hook once per chunk of file names, so `--all-files` starts a
56
93
  type checker or pytest several times over. Each heavy gate here is two hooks: a
57
94
  `-spool` twin collects every chunk, then the gate runs once over all of them,
@@ -71,14 +108,14 @@ repos:
71
108
  language: system
72
109
  require_serial: true
73
110
  types_or: [python, pyi]
74
- entry: uv run python -m codedoctor.gate spool ty-check
111
+ entry: uv run codedoctor gate spool ty-check
75
112
  - id: ty-check
76
113
  name: ty-check
77
114
  language: system
78
115
  require_serial: true
79
116
  pass_filenames: false
80
117
  types_or: [python, pyi]
81
- entry: uv run python -m codedoctor.typecheck ty-check
118
+ entry: uv run codedoctor typecheck ty-check
82
119
  ```
83
120
 
84
121
  This repository's own [`.pre-commit-config.yaml`](.pre-commit-config.yaml) wires
@@ -86,17 +123,21 @@ every gate and is the fullest example.
86
123
 
87
124
  ## Gates
88
125
 
89
- | Module | Runs |
126
+ | Command | Runs |
90
127
  |---|---|
91
- | `codedoctor.gate` | `spool`, `run` and `threaded`: the shared machinery |
92
- | `codedoctor.typecheck` | `ty-check`, `pyrefly-check`, `basedpyright` |
93
- | `codedoctor.testing` | the tests paired with each changed file, whole-suite tiers, and the pytest plugin that selects and records node ids |
94
- | `codedoctor.coverage_floor` | each changed source's coverage by its own tests, read from the `pytest` gate's run |
95
- | `codedoctor.mutation` | mutation testing of the changed functions (`codedoctor[mutation]`) |
96
- | `codedoctor.lint` | `houselint`, AST rules configured in `[tool.houselint]` |
97
- | `codedoctor.assert_isinstance` | deletes each `assert isinstance` a checker proves redundant |
98
- | `codedoctor.affected` | the tests and files a change reaches, from a CodeGraph index |
99
- | `codedoctor.nbstripout` | notebook output stripping |
128
+ | `codedoctor gate` | `spool`, `run` and `threaded`: the shared machinery |
129
+ | `codedoctor typecheck` | `ty-check`, `pyrefly-check`, `basedpyright` |
130
+ | `codedoctor testing` | paired tests and whole-suite tiers |
131
+ | `codedoctor coverage-floor` | per-source coverage from the pytest gate |
132
+ | `codedoctor mutation` | changed-function mutation tests (`codedoctor[mutation]`) |
133
+ | `codedoctor lint` | AST rules configured in `[tool.codedoctor.lint]` |
134
+ | `codedoctor assert-isinstance` | redundant `assert isinstance` removal |
135
+ | `codedoctor affected` | files and tests reached through CodeGraph |
136
+ | `codedoctor nbstripout` | notebook output stripping |
137
+ | `codedoctor yamlcheck` | YAML validation, including Compose tags |
138
+ | `codedoctor export-leaks` | exported-package leak checks |
139
+ | `codedoctor codegraph-sync` | dependency-graph refresh |
140
+ | `codedoctor check-pr-text` | pull-request text validation |
100
141
 
101
142
  Worker counts: `WORKERS_<HOOK_ID>` wins, then `WORKERS_DEFAULT`, then a count
102
143
  derived from the machine's cores and free memory.
@@ -35,6 +35,7 @@ import tomllib
35
35
 
36
36
  from treekle import ReadError, from_plain
37
37
 
38
+ from codedoctor import codegraph
38
39
  from codedoctor.affected import backbone
39
40
  from codedoctor.gate.gate import skipped
40
41
  from codedoctor.lib import sidecars
@@ -83,6 +84,8 @@ def main() -> int:
83
84
  )
84
85
  if database is None:
85
86
  database = Path.cwd() / ".codegraph" / "codegraph.db"
87
+ if depth > 0 and not saturated and codegraph.executable() is None:
88
+ depth = 0
86
89
  if depth > 0 and not saturated:
87
90
  problem = backbone.sync_worktree(
88
91
  Path.cwd(),
@@ -19,6 +19,7 @@ import threading
19
19
 
20
20
  import pytest
21
21
 
22
+ from codedoctor import codegraph
22
23
  from codedoctor.affected import affected, backbone
23
24
  from codedoctor.affected.affected import collection_patterns, harvest
24
25
 
@@ -42,6 +43,7 @@ def in_tmp_path(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
42
43
  passes here, and only diverges once the two configs do.
43
44
  """
44
45
  monkeypatch.chdir(tmp_path)
46
+ monkeypatch.setattr(codegraph, "executable", lambda: "codegraph")
45
47
  monkeypatch.setattr(
46
48
  backbone,
47
49
  "sync_worktree",
@@ -2182,6 +2184,31 @@ def test_the_rebuilds_index_output_never_reaches_the_selection(
2182
2184
  assert "Initializing CodeGraph" in err
2183
2185
 
2184
2186
 
2187
+ @pytest.mark.parametrize("emit", ["files", "nodeids"])
2188
+ def test_a_missing_cli_selects_without_indexing_or_diagnostics(
2189
+ tmp_path: Path,
2190
+ monkeypatch: pytest.MonkeyPatch,
2191
+ capsys: pytest.CaptureFixture[str],
2192
+ emit: str,
2193
+ ) -> None:
2194
+ (tmp_path / "lib.py").touch()
2195
+ (tmp_path / "lib_test.py").touch()
2196
+ monkeypatch.delenv("SKIP", raising=False)
2197
+ monkeypatch.setattr(codegraph, "executable", lambda: None)
2198
+ sync = Mock(side_effect=AssertionError("missing CodeGraph was invoked"))
2199
+ monkeypatch.setattr(backbone, "sync_worktree", sync)
2200
+ monkeypatch.setattr(
2201
+ sys,
2202
+ "argv",
2203
+ ["affected", "--no-universe", "--depth", "2", "--emit", emit, "--", "lib.py"],
2204
+ )
2205
+
2206
+ assert affected.main() == 0
2207
+ expected = "lib.py\n" if emit == "files" else "lib_test.py\n"
2208
+ assert capsys.readouterr() == (expected, "")
2209
+ sync.assert_not_called()
2210
+
2211
+
2185
2212
  def test_a_missing_index_cli_exits_127_like_a_shell(
2186
2213
  tmp_path: Path,
2187
2214
  capfd: pytest.CaptureFixture[str],
@@ -3058,10 +3085,12 @@ def test_an_explicit_database_is_read_alone(
3058
3085
  """`--database` names an index to walk as it stands, with no overlay."""
3059
3086
  calls = _recorded_harvest(monkeypatch)
3060
3087
  monkeypatch.delenv("SKIP", raising=False)
3088
+ monkeypatch.setattr(codegraph, "executable", lambda: None)
3061
3089
  monkeypatch.setattr(sys, "argv", ["affected", "--database", "x.db", "--", "x.py"])
3062
3090
 
3063
3091
  assert affected.main() == 0
3064
3092
  assert (calls[0]["database"], calls[0]["overlay"]) == (Path("x.db"), None)
3093
+ assert calls[0]["depth"] == 1
3065
3094
 
3066
3095
 
3067
3096
  if __name__ == "__main__":
@@ -27,6 +27,8 @@ import shutil
27
27
  import sqlite3
28
28
  import tempfile
29
29
 
30
+ from codedoctor import codegraph
31
+
30
32
 
31
33
  if TYPE_CHECKING:
32
34
  from collections.abc import Callable, Sequence
@@ -291,10 +293,11 @@ def index_tree(tree: Path, *, run: Callable[[Sequence[str]], int]) -> int:
291
293
  status: The CLI's exit code.
292
294
 
293
295
  """
296
+ binary = codegraph.executable() or "codegraph"
294
297
  return run(
295
- ["codegraph", "sync", "--quiet", str(tree)]
298
+ [binary, "sync", "--quiet", str(tree)]
296
299
  if (tree / ".codegraph" / "codegraph.db").is_file()
297
- else ["codegraph", "init", "--yes", str(tree)],
300
+ else [binary, "init", "--yes", str(tree)],
298
301
  )
299
302
 
300
303