sourcecode 1.24.0__tar.gz → 1.27.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (189) hide show
  1. {sourcecode-1.24.0 → sourcecode-1.27.0}/PKG-INFO +56 -11
  2. {sourcecode-1.24.0 → sourcecode-1.27.0}/README.md +55 -10
  3. {sourcecode-1.24.0 → sourcecode-1.27.0}/pyproject.toml +1 -1
  4. {sourcecode-1.24.0 → sourcecode-1.27.0}/src/sourcecode/__init__.py +1 -1
  5. {sourcecode-1.24.0 → sourcecode-1.27.0}/src/sourcecode/cli.py +22 -0
  6. {sourcecode-1.24.0 → sourcecode-1.27.0}/src/sourcecode/prepare_context.py +196 -4
  7. {sourcecode-1.24.0 → sourcecode-1.27.0}/src/sourcecode/serializer.py +68 -77
  8. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/test_block5_quality.py +40 -42
  9. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/test_pipeline_integrity.py +10 -9
  10. {sourcecode-1.24.0 → sourcecode-1.27.0}/.agents/skills/source-command-gsd-join-discord/SKILL.md +0 -0
  11. {sourcecode-1.24.0 → sourcecode-1.27.0}/.agents/skills/source-command-gsd-review-backlog/SKILL.md +0 -0
  12. {sourcecode-1.24.0 → sourcecode-1.27.0}/.agents/skills/source-command-gsd-workstreams/SKILL.md +0 -0
  13. {sourcecode-1.24.0 → sourcecode-1.27.0}/.continue-here.md +0 -0
  14. {sourcecode-1.24.0 → sourcecode-1.27.0}/.github/workflows/build-windows.yml +0 -0
  15. {sourcecode-1.24.0 → sourcecode-1.27.0}/.gitignore +0 -0
  16. {sourcecode-1.24.0 → sourcecode-1.27.0}/.ruff.toml +0 -0
  17. {sourcecode-1.24.0 → sourcecode-1.27.0}/CONTRIBUTING.md +0 -0
  18. {sourcecode-1.24.0 → sourcecode-1.27.0}/LICENSE +0 -0
  19. {sourcecode-1.24.0 → sourcecode-1.27.0}/SECURITY.md +0 -0
  20. {sourcecode-1.24.0 → sourcecode-1.27.0}/docs/privacy.md +0 -0
  21. {sourcecode-1.24.0 → sourcecode-1.27.0}/docs/schema.md +0 -0
  22. {sourcecode-1.24.0 → sourcecode-1.27.0}/raw +0 -0
  23. {sourcecode-1.24.0 → sourcecode-1.27.0}/run_cli.py +0 -0
  24. {sourcecode-1.24.0 → sourcecode-1.27.0}/src/sourcecode/adaptive_scanner.py +0 -0
  25. {sourcecode-1.24.0 → sourcecode-1.27.0}/src/sourcecode/architecture_analyzer.py +0 -0
  26. {sourcecode-1.24.0 → sourcecode-1.27.0}/src/sourcecode/architecture_summary.py +0 -0
  27. {sourcecode-1.24.0 → sourcecode-1.27.0}/src/sourcecode/ast_extractor.py +0 -0
  28. {sourcecode-1.24.0 → sourcecode-1.27.0}/src/sourcecode/classifier.py +0 -0
  29. {sourcecode-1.24.0 → sourcecode-1.27.0}/src/sourcecode/code_notes_analyzer.py +0 -0
  30. {sourcecode-1.24.0 → sourcecode-1.27.0}/src/sourcecode/confidence_analyzer.py +0 -0
  31. {sourcecode-1.24.0 → sourcecode-1.27.0}/src/sourcecode/context_scorer.py +0 -0
  32. {sourcecode-1.24.0 → sourcecode-1.27.0}/src/sourcecode/context_summarizer.py +0 -0
  33. {sourcecode-1.24.0 → sourcecode-1.27.0}/src/sourcecode/contract_model.py +0 -0
  34. {sourcecode-1.24.0 → sourcecode-1.27.0}/src/sourcecode/contract_pipeline.py +0 -0
  35. {sourcecode-1.24.0 → sourcecode-1.27.0}/src/sourcecode/coverage_parser.py +0 -0
  36. {sourcecode-1.24.0 → sourcecode-1.27.0}/src/sourcecode/dependency_analyzer.py +0 -0
  37. {sourcecode-1.24.0 → sourcecode-1.27.0}/src/sourcecode/detectors/__init__.py +0 -0
  38. {sourcecode-1.24.0 → sourcecode-1.27.0}/src/sourcecode/detectors/base.py +0 -0
  39. {sourcecode-1.24.0 → sourcecode-1.27.0}/src/sourcecode/detectors/csproj_parser.py +0 -0
  40. {sourcecode-1.24.0 → sourcecode-1.27.0}/src/sourcecode/detectors/dart.py +0 -0
  41. {sourcecode-1.24.0 → sourcecode-1.27.0}/src/sourcecode/detectors/dotnet.py +0 -0
  42. {sourcecode-1.24.0 → sourcecode-1.27.0}/src/sourcecode/detectors/elixir.py +0 -0
  43. {sourcecode-1.24.0 → sourcecode-1.27.0}/src/sourcecode/detectors/go.py +0 -0
  44. {sourcecode-1.24.0 → sourcecode-1.27.0}/src/sourcecode/detectors/heuristic.py +0 -0
  45. {sourcecode-1.24.0 → sourcecode-1.27.0}/src/sourcecode/detectors/hybrid.py +0 -0
  46. {sourcecode-1.24.0 → sourcecode-1.27.0}/src/sourcecode/detectors/java.py +0 -0
  47. {sourcecode-1.24.0 → sourcecode-1.27.0}/src/sourcecode/detectors/jvm_ext.py +0 -0
  48. {sourcecode-1.24.0 → sourcecode-1.27.0}/src/sourcecode/detectors/nodejs.py +0 -0
  49. {sourcecode-1.24.0 → sourcecode-1.27.0}/src/sourcecode/detectors/parsers.py +0 -0
  50. {sourcecode-1.24.0 → sourcecode-1.27.0}/src/sourcecode/detectors/php.py +0 -0
  51. {sourcecode-1.24.0 → sourcecode-1.27.0}/src/sourcecode/detectors/project.py +0 -0
  52. {sourcecode-1.24.0 → sourcecode-1.27.0}/src/sourcecode/detectors/python.py +0 -0
  53. {sourcecode-1.24.0 → sourcecode-1.27.0}/src/sourcecode/detectors/ruby.py +0 -0
  54. {sourcecode-1.24.0 → sourcecode-1.27.0}/src/sourcecode/detectors/rust.py +0 -0
  55. {sourcecode-1.24.0 → sourcecode-1.27.0}/src/sourcecode/detectors/systems.py +0 -0
  56. {sourcecode-1.24.0 → sourcecode-1.27.0}/src/sourcecode/detectors/terraform.py +0 -0
  57. {sourcecode-1.24.0 → sourcecode-1.27.0}/src/sourcecode/detectors/tooling.py +0 -0
  58. {sourcecode-1.24.0 → sourcecode-1.27.0}/src/sourcecode/doc_analyzer.py +0 -0
  59. {sourcecode-1.24.0 → sourcecode-1.27.0}/src/sourcecode/entrypoint_classifier.py +0 -0
  60. {sourcecode-1.24.0 → sourcecode-1.27.0}/src/sourcecode/env_analyzer.py +0 -0
  61. {sourcecode-1.24.0 → sourcecode-1.27.0}/src/sourcecode/file_classifier.py +0 -0
  62. {sourcecode-1.24.0 → sourcecode-1.27.0}/src/sourcecode/git_analyzer.py +0 -0
  63. {sourcecode-1.24.0 → sourcecode-1.27.0}/src/sourcecode/graph_analyzer.py +0 -0
  64. {sourcecode-1.24.0 → sourcecode-1.27.0}/src/sourcecode/metrics_analyzer.py +0 -0
  65. {sourcecode-1.24.0 → sourcecode-1.27.0}/src/sourcecode/progress.py +0 -0
  66. {sourcecode-1.24.0 → sourcecode-1.27.0}/src/sourcecode/ranking_engine.py +0 -0
  67. {sourcecode-1.24.0 → sourcecode-1.27.0}/src/sourcecode/redactor.py +0 -0
  68. {sourcecode-1.24.0 → sourcecode-1.27.0}/src/sourcecode/relevance_scorer.py +0 -0
  69. {sourcecode-1.24.0 → sourcecode-1.27.0}/src/sourcecode/repo_classifier.py +0 -0
  70. {sourcecode-1.24.0 → sourcecode-1.27.0}/src/sourcecode/runtime_classifier.py +0 -0
  71. {sourcecode-1.24.0 → sourcecode-1.27.0}/src/sourcecode/scanner.py +0 -0
  72. {sourcecode-1.24.0 → sourcecode-1.27.0}/src/sourcecode/schema.py +0 -0
  73. {sourcecode-1.24.0 → sourcecode-1.27.0}/src/sourcecode/semantic_analyzer.py +0 -0
  74. {sourcecode-1.24.0 → sourcecode-1.27.0}/src/sourcecode/summarizer.py +0 -0
  75. {sourcecode-1.24.0 → sourcecode-1.27.0}/src/sourcecode/telemetry/__init__.py +0 -0
  76. {sourcecode-1.24.0 → sourcecode-1.27.0}/src/sourcecode/telemetry/config.py +0 -0
  77. {sourcecode-1.24.0 → sourcecode-1.27.0}/src/sourcecode/telemetry/consent.py +0 -0
  78. {sourcecode-1.24.0 → sourcecode-1.27.0}/src/sourcecode/telemetry/events.py +0 -0
  79. {sourcecode-1.24.0 → sourcecode-1.27.0}/src/sourcecode/telemetry/filters.py +0 -0
  80. {sourcecode-1.24.0 → sourcecode-1.27.0}/src/sourcecode/telemetry/transport.py +0 -0
  81. {sourcecode-1.24.0 → sourcecode-1.27.0}/src/sourcecode/tree_utils.py +0 -0
  82. {sourcecode-1.24.0 → sourcecode-1.27.0}/src/sourcecode/workspace.py +0 -0
  83. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/__init__.py +0 -0
  84. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/conftest.py +0 -0
  85. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/fixtures/coverage.xml +0 -0
  86. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/fixtures/fastapi_app/pyproject.toml +0 -0
  87. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/fixtures/fastapi_app/src/main.py +0 -0
  88. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/fixtures/go_service/cmd/api/main.go +0 -0
  89. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/fixtures/go_service/go.mod +0 -0
  90. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/fixtures/jacoco.xml +0 -0
  91. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/fixtures/latin1_sample.java +0 -0
  92. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/fixtures/latin1_sample_iso.java +0 -0
  93. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/fixtures/lcov.info +0 -0
  94. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/fixtures/nextjs_app/app/page.tsx +0 -0
  95. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/fixtures/nextjs_app/package.json +0 -0
  96. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/fixtures/nextjs_app/pnpm-lock.yaml +0 -0
  97. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/fixtures/pnpm_monorepo/apps/web/app/page.tsx +0 -0
  98. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/fixtures/pnpm_monorepo/apps/web/package.json +0 -0
  99. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/fixtures/pnpm_monorepo/packages/api/main.py +0 -0
  100. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/fixtures/pnpm_monorepo/packages/api/pyproject.toml +0 -0
  101. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/fixtures/pnpm_monorepo/pnpm-workspace.yaml +0 -0
  102. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/fixtures/spring_boot_minimal/pom.xml +0 -0
  103. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/fixtures/spring_boot_minimal/src/main/java/com/example/ddd/ausente/application/service/FindAusenteService.java +0 -0
  104. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/fixtures/spring_boot_minimal/src/main/java/com/example/ddd/ausente/domain/entities/Ausente.java +0 -0
  105. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/fixtures/spring_boot_minimal/src/main/java/com/example/ddd/ausente/infrastructure/rest/AusenteRestController.java +0 -0
  106. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/fixtures/spring_boot_minimal/src/main/java/com/example/ddd/autocoberturas/application/service/FindAutocoberturasService.java +0 -0
  107. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/fixtures/spring_boot_minimal/src/main/java/com/example/ddd/autocoberturas/domain/entities/Autocoberturas.java +0 -0
  108. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/fixtures/spring_boot_minimal/src/main/java/com/example/ddd/autocoberturas/infrastructure/rest/AutocoberturasRestController.java +0 -0
  109. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/fixtures/spring_boot_minimal/src/main/java/com/example/ddd/calendarioTrabajador/application/service/FindCalendarioTrabajadorService.java +0 -0
  110. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/fixtures/spring_boot_minimal/src/main/java/com/example/ddd/calendarioTrabajador/domain/entities/CalendarioTrabajador.java +0 -0
  111. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/fixtures/spring_boot_minimal/src/main/java/com/example/ddd/calendarioTrabajador/infrastructure/rest/CalendarioTrabajadorRestController.java +0 -0
  112. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/fixtures/spring_boot_minimal/src/main/java/com/example/ddd/departamento/application/service/FindDepartamentoService.java +0 -0
  113. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/fixtures/spring_boot_minimal/src/main/java/com/example/ddd/departamento/domain/entities/Departamento.java +0 -0
  114. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/fixtures/spring_boot_minimal/src/main/java/com/example/ddd/departamento/infrastructure/rest/DepartamentoRestController.java +0 -0
  115. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/fixtures/spring_boot_minimal/src/main/java/com/example/ddd/empleado/application/service/FindEmpleadoService.java +0 -0
  116. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/fixtures/spring_boot_minimal/src/main/java/com/example/ddd/empleado/domain/entities/Empleado.java +0 -0
  117. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/fixtures/spring_boot_minimal/src/main/java/com/example/ddd/empleado/infrastructure/rest/EmpleadoRestController.java +0 -0
  118. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/fixtures/spring_boot_minimal/src/main/java/com/example/demo/DemoApplication.java +0 -0
  119. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/fixtures/spring_boot_minimal/src/main/java/com/example/demo/config/FilterConfig.java +0 -0
  120. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/fixtures/spring_boot_minimal/src/main/java/com/example/demo/domain/Health.java +0 -0
  121. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/fixtures/spring_boot_minimal/src/main/java/com/example/demo/mapper/HealthMapper.java +0 -0
  122. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/fixtures/spring_boot_minimal/src/main/java/com/example/demo/repository/HealthRepository.java +0 -0
  123. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/fixtures/spring_boot_minimal/src/main/java/com/example/demo/service/HealthService.java +0 -0
  124. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/fixtures/spring_boot_minimal/src/main/java/com/example/demo/web/HealthRestController.java +0 -0
  125. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/fixtures/spring_boot_minimal/src/main/java/com/example/demo/web/NominaRestController.java +0 -0
  126. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/fixtures/spring_boot_minimal/src/main/resources/application-dev.yml +0 -0
  127. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/fixtures/spring_boot_minimal/src/main/resources/application.yml +0 -0
  128. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/fixtures/spring_boot_minimal/src/main/resources/mapper/HealthMapper.xml +0 -0
  129. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/test_architecture_analyzer.py +0 -0
  130. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/test_architecture_summary.py +0 -0
  131. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/test_ast_extractor.py +0 -0
  132. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/test_block1_reliability.py +0 -0
  133. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/test_block2_coverage.py +0 -0
  134. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/test_bug_fixes_v16.py +0 -0
  135. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/test_classifier.py +0 -0
  136. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/test_cli.py +0 -0
  137. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/test_code_notes_analyzer.py +0 -0
  138. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/test_context_scorer.py +0 -0
  139. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/test_contract_pipeline.py +0 -0
  140. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/test_coverage_parser.py +0 -0
  141. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/test_cross_consistency.py +0 -0
  142. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/test_dependency_analyzer_node_python.py +0 -0
  143. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/test_dependency_analyzer_polyglot.py +0 -0
  144. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/test_dependency_schema.py +0 -0
  145. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/test_detector_dotnet.py +0 -0
  146. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/test_detector_go_rust_java.py +0 -0
  147. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/test_detector_nodejs.py +0 -0
  148. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/test_detector_php_ruby_dart.py +0 -0
  149. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/test_detector_python.py +0 -0
  150. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/test_detector_universal_managed.py +0 -0
  151. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/test_detector_universal_systems.py +0 -0
  152. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/test_detectors_base.py +0 -0
  153. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/test_doc_analyzer_jsdom.py +0 -0
  154. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/test_doc_analyzer_python.py +0 -0
  155. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/test_encoding_regression.py +0 -0
  156. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/test_graph_analyzer_polyglot.py +0 -0
  157. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/test_graph_analyzer_python_node.py +0 -0
  158. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/test_graph_schema.py +0 -0
  159. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/test_hybrid_inference.py +0 -0
  160. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/test_integration.py +0 -0
  161. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/test_integration_dependencies.py +0 -0
  162. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/test_integration_detection.py +0 -0
  163. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/test_integration_docs.py +0 -0
  164. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/test_integration_graph_modules.py +0 -0
  165. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/test_integration_lqn.py +0 -0
  166. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/test_integration_metrics.py +0 -0
  167. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/test_integration_multistack.py +0 -0
  168. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/test_integration_semantics.py +0 -0
  169. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/test_integration_universal.py +0 -0
  170. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/test_java_spring_integration.py +0 -0
  171. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/test_metrics_analyzer.py +0 -0
  172. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/test_packaging.py +0 -0
  173. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/test_phase1_improvements.py +0 -0
  174. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/test_real_projects.py +0 -0
  175. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/test_redactor.py +0 -0
  176. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/test_scanner.py +0 -0
  177. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/test_schema.py +0 -0
  178. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/test_schema_normalization.py +0 -0
  179. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/test_semantic_analyzer_node.py +0 -0
  180. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/test_semantic_analyzer_python.py +0 -0
  181. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/test_semantic_import_resolution.py +0 -0
  182. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/test_semantic_schema.py +0 -0
  183. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/test_signal_hierarchy.py +0 -0
  184. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/test_summarizer.py +0 -0
  185. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/test_surface_honesty.py +0 -0
  186. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/test_task_differentiation.py +0 -0
  187. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/test_telemetry.py +0 -0
  188. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/test_v1_10_regressions.py +0 -0
  189. {sourcecode-1.24.0 → sourcecode-1.27.0}/tests/test_workspace_analyzer.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sourcecode
3
- Version: 1.24.0
3
+ Version: 1.27.0
4
4
  Summary: Deterministic codebase context for AI coding agents
5
5
  License: Apache License
6
6
  Version 2.0, January 2004
@@ -221,7 +221,7 @@ Description-Content-Type: text/markdown
221
221
 
222
222
  **Compressed AI-ready context for Java/Spring enterprise codebases.**
223
223
 
224
- ![Version](https://img.shields.io/badge/version-1.24.0-blue)
224
+ ![Version](https://img.shields.io/badge/version-1.27.0-blue)
225
225
  ![Python](https://img.shields.io/badge/python-3.10%2B-green)
226
226
 
227
227
  ---
@@ -255,7 +255,7 @@ pipx install sourcecode
255
255
 
256
256
  ```bash
257
257
  sourcecode version
258
- # sourcecode 1.24.0
258
+ # sourcecode 1.27.0
259
259
  ```
260
260
 
261
261
  ---
@@ -263,7 +263,7 @@ sourcecode version
263
263
  ## Quickstart
264
264
 
265
265
  ```bash
266
- # High-signal summary (~600-800 tokens) — recommended starting point
266
+ # High-signal summary (1000–3000 tokens depending on repo size) — recommended starting point
267
267
  sourcecode --compact
268
268
 
269
269
  # Add git hotspots and uncommitted file count
@@ -311,8 +311,9 @@ Example output for a Spring Boot project (`--compact`):
311
311
 
312
312
  | Flag | Alias | Default | Description |
313
313
  |------|-------|---------|-------------|
314
- | `--compact` | | off | **Recommended.** ~600-800 token summary: stack, entry points, dependencies, risk flags, confidence, gaps. Optimized for agent context windows. |
314
+ | `--compact` | | off | High-signal summary (1000–3000 tokens): stacks, entry points, dependencies, risk flags, confidence, gaps. Includes `security_surface`, `mybatis`, and `transactional_boundaries` for Java projects. |
315
315
  | `--agent` | | off | Structured noise-free JSON for AI agents: identity, entry points, dependencies, confidence, gaps. Auto-enables dependency, env-var, and code-notes analysis. |
316
+ | `--full` | | off | Remove truncation limits on `transactional_boundaries`, `mybatis.dto_mappers`, and other capped lists. |
316
317
  | `--git-context` | `-g` | off | Include git activity: recent commits, change hotspots, and uncommitted changes. |
317
318
  | `--changed-only` | | off | Limit output to git-modified files (staged, unstaged, untracked). Forces compact output. |
318
319
  | `--depth` | | `4` | File tree traversal depth (1–20). Java/Maven projects auto-adjust to 12. |
@@ -342,16 +343,18 @@ sourcecode prepare-context TASK [PATH] [OPTIONS]
342
343
  | `refactor` | Structural problems, improvement opportunities, high-annotation files | Code quality review |
343
344
  | `generate-tests` | Source files without test pairs, coverage gap analysis | Writing missing tests |
344
345
  | `review-pr` | Uncommitted/changed files + architectural impact | Pre-merge review |
345
- | `delta` | Only files changed in a git range (`--since`), affected entry points | Incremental CI context |
346
+ | `delta` | Changed files with multi-hop impact analysis, structural import graph, system-level impact summary | Incremental CI/review context |
346
347
 
347
348
  ### Options
348
349
 
349
350
  | Option | Description |
350
351
  |--------|-------------|
351
352
  | `--since REF` | Git ref for `delta` task (e.g. `HEAD~3`, `main`, `v1.2.0`). Required for `delta`; ignored for other tasks. |
353
+ | `--symptom TEXT` | *(fix-bug only)* Keyword hint for the bug — boosts matching files and surfaces related code notes. |
352
354
  | `--llm-prompt` | Append a ready-to-use LLM prompt to the output. |
353
355
  | `--dry-run` | Show what would be analyzed without running it. |
354
356
  | `--copy` / `-c` | Copy output to clipboard after a successful run. |
357
+ | `--output` / `-o` | Write output to a file. |
355
358
  | `--task-help` | List all tasks with descriptions and exit. |
356
359
 
357
360
  ### Examples
@@ -360,11 +363,8 @@ sourcecode prepare-context TASK [PATH] [OPTIONS]
360
363
  # Explain the current repo
361
364
  sourcecode prepare-context explain
362
365
 
363
- # Analyze a specific repo path
364
- sourcecode prepare-context explain /path/to/repo
365
-
366
- # Focus on bug-prone files
367
- sourcecode prepare-context fix-bug
366
+ # Focus on bug-prone files, with a symptom hint
367
+ sourcecode prepare-context fix-bug --symptom "NullPointerException in OrderService"
368
368
 
369
369
  # Incremental context: files changed since branch diverged from main
370
370
  sourcecode prepare-context delta . --since main
@@ -378,6 +378,51 @@ sourcecode prepare-context --task-help
378
378
 
379
379
  ---
380
380
 
381
+ ## `delta` — incremental impact analysis
382
+
383
+ The `delta` task is the recommended mode for CI pipelines and PR reviews. It goes beyond listing changed files: it builds a structural import graph and propagates impact transitively up to 3 hops.
384
+
385
+ ```bash
386
+ sourcecode prepare-context delta [PATH] --since REF
387
+ ```
388
+
389
+ **Output fields:**
390
+
391
+ | Field | Description |
392
+ |-------|-------------|
393
+ | `changed_files` | Files modified in the git range |
394
+ | `relevant_files` | Changed files + files pulled in by the import graph (scored by artifact type and hop distance) |
395
+ | `impact_summary` | Human-readable summary: artifact types changed and active risk areas |
396
+ | `affected_modules` | DDD domain modules touched by the change |
397
+ | `risk_areas` | Per-area severity breakdown (`security`, `api`, `persistence`, etc.) |
398
+ | `change_type` | Closed taxonomy: `behavioral_change`, `structural_change`, `configuration_change`, `dependency_change`, `security_change` |
399
+ | `system_impact` | Subsystems affected, behavioral changes, runtime impact notes |
400
+ | `dependency_graph_summary` | Verified structural import edges (hop 1–3) and `propagation_depth`. **Only real imports — no heuristics, no test files.** |
401
+ | `impact_score_per_file` | Per-file numeric impact score (0–1) |
402
+ | `since` | The git ref used |
403
+ | `gaps` | What the analysis could not determine |
404
+
405
+ **How the import graph works:**
406
+
407
+ 1. Each changed file is classified by artifact type (`controller`, `service`, `repository`, `security`, `spring_config`, etc.).
408
+ 2. A BFS traversal walks the import graph **repo-wide** (not restricted to the same module), up to 3 hops deep.
409
+ 3. `dependency_graph_summary.edges` only contains verified `import` / `@Autowired` / constructor-injection relationships. Test files and heuristic proximity matches are excluded from edges (they appear in `relevant_files` only if they have real imports of changed files).
410
+ 4. Score decays 30% per hop: a directly-changed `SecurityConfig.java` scores 0.90; its direct importer scores 0.63; a transitive importer scores 0.44.
411
+
412
+ ```bash
413
+ # Changed service → controller → facade (3 hops)
414
+ sourcecode prepare-context delta . --since main
415
+
416
+ # Output includes:
417
+ # dependency_graph_summary.edges:
418
+ # hop-1: OrderService.java → OrderRepository.java
419
+ # hop-2: OrderRepository.java → OrderController.java
420
+ # hop-3: OrderController.java → OrderFacade.java
421
+ # propagation_depth: 3
422
+ ```
423
+
424
+ ---
425
+
381
426
  ## Output schema
382
427
 
383
428
  All outputs include a `confidence_summary` block with `overall`, `stack`, and `entry_points` confidence levels (`high` / `medium` / `low`), plus an `analysis_gaps` list describing what could not be analyzed and why.
@@ -2,7 +2,7 @@
2
2
 
3
3
  **Compressed AI-ready context for Java/Spring enterprise codebases.**
4
4
 
5
- ![Version](https://img.shields.io/badge/version-1.24.0-blue)
5
+ ![Version](https://img.shields.io/badge/version-1.27.0-blue)
6
6
  ![Python](https://img.shields.io/badge/python-3.10%2B-green)
7
7
 
8
8
  ---
@@ -36,7 +36,7 @@ pipx install sourcecode
36
36
 
37
37
  ```bash
38
38
  sourcecode version
39
- # sourcecode 1.24.0
39
+ # sourcecode 1.27.0
40
40
  ```
41
41
 
42
42
  ---
@@ -44,7 +44,7 @@ sourcecode version
44
44
  ## Quickstart
45
45
 
46
46
  ```bash
47
- # High-signal summary (~600-800 tokens) — recommended starting point
47
+ # High-signal summary (1000–3000 tokens depending on repo size) — recommended starting point
48
48
  sourcecode --compact
49
49
 
50
50
  # Add git hotspots and uncommitted file count
@@ -92,8 +92,9 @@ Example output for a Spring Boot project (`--compact`):
92
92
 
93
93
  | Flag | Alias | Default | Description |
94
94
  |------|-------|---------|-------------|
95
- | `--compact` | | off | **Recommended.** ~600-800 token summary: stack, entry points, dependencies, risk flags, confidence, gaps. Optimized for agent context windows. |
95
+ | `--compact` | | off | High-signal summary (1000–3000 tokens): stacks, entry points, dependencies, risk flags, confidence, gaps. Includes `security_surface`, `mybatis`, and `transactional_boundaries` for Java projects. |
96
96
  | `--agent` | | off | Structured noise-free JSON for AI agents: identity, entry points, dependencies, confidence, gaps. Auto-enables dependency, env-var, and code-notes analysis. |
97
+ | `--full` | | off | Remove truncation limits on `transactional_boundaries`, `mybatis.dto_mappers`, and other capped lists. |
97
98
  | `--git-context` | `-g` | off | Include git activity: recent commits, change hotspots, and uncommitted changes. |
98
99
  | `--changed-only` | | off | Limit output to git-modified files (staged, unstaged, untracked). Forces compact output. |
99
100
  | `--depth` | | `4` | File tree traversal depth (1–20). Java/Maven projects auto-adjust to 12. |
@@ -123,16 +124,18 @@ sourcecode prepare-context TASK [PATH] [OPTIONS]
123
124
  | `refactor` | Structural problems, improvement opportunities, high-annotation files | Code quality review |
124
125
  | `generate-tests` | Source files without test pairs, coverage gap analysis | Writing missing tests |
125
126
  | `review-pr` | Uncommitted/changed files + architectural impact | Pre-merge review |
126
- | `delta` | Only files changed in a git range (`--since`), affected entry points | Incremental CI context |
127
+ | `delta` | Changed files with multi-hop impact analysis, structural import graph, system-level impact summary | Incremental CI/review context |
127
128
 
128
129
  ### Options
129
130
 
130
131
  | Option | Description |
131
132
  |--------|-------------|
132
133
  | `--since REF` | Git ref for `delta` task (e.g. `HEAD~3`, `main`, `v1.2.0`). Required for `delta`; ignored for other tasks. |
134
+ | `--symptom TEXT` | *(fix-bug only)* Keyword hint for the bug — boosts matching files and surfaces related code notes. |
133
135
  | `--llm-prompt` | Append a ready-to-use LLM prompt to the output. |
134
136
  | `--dry-run` | Show what would be analyzed without running it. |
135
137
  | `--copy` / `-c` | Copy output to clipboard after a successful run. |
138
+ | `--output` / `-o` | Write output to a file. |
136
139
  | `--task-help` | List all tasks with descriptions and exit. |
137
140
 
138
141
  ### Examples
@@ -141,11 +144,8 @@ sourcecode prepare-context TASK [PATH] [OPTIONS]
141
144
  # Explain the current repo
142
145
  sourcecode prepare-context explain
143
146
 
144
- # Analyze a specific repo path
145
- sourcecode prepare-context explain /path/to/repo
146
-
147
- # Focus on bug-prone files
148
- sourcecode prepare-context fix-bug
147
+ # Focus on bug-prone files, with a symptom hint
148
+ sourcecode prepare-context fix-bug --symptom "NullPointerException in OrderService"
149
149
 
150
150
  # Incremental context: files changed since branch diverged from main
151
151
  sourcecode prepare-context delta . --since main
@@ -159,6 +159,51 @@ sourcecode prepare-context --task-help
159
159
 
160
160
  ---
161
161
 
162
+ ## `delta` — incremental impact analysis
163
+
164
+ The `delta` task is the recommended mode for CI pipelines and PR reviews. It goes beyond listing changed files: it builds a structural import graph and propagates impact transitively up to 3 hops.
165
+
166
+ ```bash
167
+ sourcecode prepare-context delta [PATH] --since REF
168
+ ```
169
+
170
+ **Output fields:**
171
+
172
+ | Field | Description |
173
+ |-------|-------------|
174
+ | `changed_files` | Files modified in the git range |
175
+ | `relevant_files` | Changed files + files pulled in by the import graph (scored by artifact type and hop distance) |
176
+ | `impact_summary` | Human-readable summary: artifact types changed and active risk areas |
177
+ | `affected_modules` | DDD domain modules touched by the change |
178
+ | `risk_areas` | Per-area severity breakdown (`security`, `api`, `persistence`, etc.) |
179
+ | `change_type` | Closed taxonomy: `behavioral_change`, `structural_change`, `configuration_change`, `dependency_change`, `security_change` |
180
+ | `system_impact` | Subsystems affected, behavioral changes, runtime impact notes |
181
+ | `dependency_graph_summary` | Verified structural import edges (hop 1–3) and `propagation_depth`. **Only real imports — no heuristics, no test files.** |
182
+ | `impact_score_per_file` | Per-file numeric impact score (0–1) |
183
+ | `since` | The git ref used |
184
+ | `gaps` | What the analysis could not determine |
185
+
186
+ **How the import graph works:**
187
+
188
+ 1. Each changed file is classified by artifact type (`controller`, `service`, `repository`, `security`, `spring_config`, etc.).
189
+ 2. A BFS traversal walks the import graph **repo-wide** (not restricted to the same module), up to 3 hops deep.
190
+ 3. `dependency_graph_summary.edges` only contains verified `import` / `@Autowired` / constructor-injection relationships. Test files and heuristic proximity matches are excluded from edges (they appear in `relevant_files` only if they have real imports of changed files).
191
+ 4. Score decays 30% per hop: a directly-changed `SecurityConfig.java` scores 0.90; its direct importer scores 0.63; a transitive importer scores 0.44.
192
+
193
+ ```bash
194
+ # Changed service → controller → facade (3 hops)
195
+ sourcecode prepare-context delta . --since main
196
+
197
+ # Output includes:
198
+ # dependency_graph_summary.edges:
199
+ # hop-1: OrderService.java → OrderRepository.java
200
+ # hop-2: OrderRepository.java → OrderController.java
201
+ # hop-3: OrderController.java → OrderFacade.java
202
+ # propagation_depth: 3
203
+ ```
204
+
205
+ ---
206
+
162
207
  ## Output schema
163
208
 
164
209
  All outputs include a `confidence_summary` block with `overall`, `stack`, and `entry_points` confidence levels (`high` / `medium` / `low`), plus an `analysis_gaps` list describing what could not be analyzed and why.
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "sourcecode"
7
- version = "1.24.0"
7
+ version = "1.27.0"
8
8
  description = "Deterministic codebase context for AI coding agents"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9"
@@ -1,3 +1,3 @@
1
1
  """sourcecode — Deterministic codebase context maps for AI coding agents."""
2
2
 
3
- __version__ = "1.24.0"
3
+ __version__ = "1.27.0"
@@ -1773,6 +1773,28 @@ def prepare_context_cmd(
1773
1773
  out["affected_entry_points"] = output.affected_entry_points
1774
1774
  # Delta-specific impact fields
1775
1775
  if task == "delta":
1776
+ if output.error_code:
1777
+ # Hard error — emit structured error JSON and exit, skip normal delta fields
1778
+ _err_out: dict[str, Any] = {
1779
+ "task": output.task,
1780
+ "ci_decision": output.ci_decision or "git_ref_error",
1781
+ "error": output.error_code,
1782
+ "since": output.since,
1783
+ "message": output.error_message,
1784
+ }
1785
+ if output.error_hints:
1786
+ _err_out["hint"] = output.error_hints
1787
+ _err_json = json.dumps(_err_out, indent=2, ensure_ascii=False)
1788
+ if output_path is not None:
1789
+ output_path.write_text(_err_json, encoding="utf-8")
1790
+ else:
1791
+ import sys as _sys
1792
+ _sys.stdout.buffer.write(_err_json.encode("utf-8"))
1793
+ _sys.stdout.buffer.write(b"\n")
1794
+ _sys.stdout.buffer.flush()
1795
+ raise typer.Exit(code=1)
1796
+ if output.ci_decision:
1797
+ out["ci_decision"] = output.ci_decision
1776
1798
  if output.since:
1777
1799
  out["since"] = output.since
1778
1800
  if output.impact_summary:
@@ -333,6 +333,16 @@ class TaskOutput:
333
333
  change_type: list[str] = field(default_factory=list)
334
334
  dependency_graph_summary: dict = field(default_factory=dict)
335
335
  impact_score_per_file: dict = field(default_factory=dict)
336
+ # error state (git ref not found, etc.)
337
+ error_code: Optional[str] = None
338
+ error_message: Optional[str] = None
339
+ error_hints: list[str] = field(default_factory=list)
340
+ # CI decision state machine — machine-decidable signal
341
+ ci_decision: Optional[str] = None # "no_changes" | "analysis_success" | "git_ref_error"
342
+ # git baseline resolution metadata
343
+ resolved_since_ref: Optional[str] = None # actual ref/hash used for the diff
344
+ resolution_path: Optional[str] = None # "exact_local_ref"|"remote_tracking_ref"|"symbolic_ref"|"head_minus_1_fallback"|"uncommitted_changes"|"unresolvable"
345
+ diff_validation_status: Optional[str] = None # "valid_non_empty"|"valid_empty"|"invalid_ref"
336
346
 
337
347
 
338
348
  # ─────────────────────────────────────────────────────────────────────────────
@@ -618,7 +628,35 @@ class TaskContextBuilder:
618
628
  _delta_files: Optional[set[str]] = None
619
629
  if task_name == "delta":
620
630
  _delta_raw = self._get_git_changed_files(since=since)
621
- if _delta_raw:
631
+ if _delta_raw is None:
632
+ # Explicit --since ref couldn't be resolved — hard error, no fallback
633
+ _avail_branches, _suggested = self._get_available_refs(since or "")
634
+ _hints: list[str] = []
635
+ if _suggested:
636
+ _hints.append(f"Did you mean '{_suggested}'?")
637
+ if _avail_branches:
638
+ _hints.append(f"Available refs: {', '.join(_avail_branches[:8])}")
639
+ return TaskOutput(
640
+ task="delta",
641
+ goal="Produce incremental context for changed files — avoids re-reading the full repo.",
642
+ project_summary=None,
643
+ architecture_summary=None,
644
+ relevant_files=[],
645
+ suspected_areas=[],
646
+ improvement_opportunities=[],
647
+ test_gaps=[],
648
+ key_dependencies=[],
649
+ code_notes_summary=None,
650
+ limitations=[],
651
+ confidence="low",
652
+ since=since,
653
+ error_code="git_ref_not_found",
654
+ error_message=f"Git reference '{since}' does not exist in this repository.",
655
+ error_hints=_hints,
656
+ gaps=[f"Cannot compute delta: git ref '{since}' not found."] + _hints,
657
+ ci_decision="git_ref_error",
658
+ )
659
+ elif _delta_raw:
622
660
  _delta_files = set(_delta_raw)
623
661
 
624
662
  # ── 5c. review-pr suspected_areas (needs git uncommitted_files) ──────
@@ -906,6 +944,11 @@ class TaskContextBuilder:
906
944
  change_type=_delta_change_type,
907
945
  dependency_graph_summary=_delta_dep_graph_summary,
908
946
  impact_score_per_file=_delta_impact_score_per_file,
947
+ ci_decision=(
948
+ "no_changes" if task_name == "delta" and not changed_files
949
+ else "analysis_success" if task_name == "delta"
950
+ else None
951
+ ),
909
952
  )
910
953
 
911
954
  def render_prompt(self, output: TaskOutput) -> str:
@@ -2087,9 +2130,131 @@ class TaskContextBuilder:
2087
2130
  impact_score_per_file,
2088
2131
  )
2089
2132
 
2090
- def _get_git_changed_files(self, since: Optional[str] = None) -> list[str]:
2133
+ def _resolve_git_baseline(self, since: Optional[str]) -> dict[str, Any]:
2134
+ """Resolve git baseline for delta diff using a 4-stage fallback chain.
2135
+
2136
+ Resolution order when `since` is provided:
2137
+ 1. exact local ref (git rev-parse --verify <since>)
2138
+ 2. remote-tracking ref (origin/<since>)
2139
+ 3. symbolic ref (git symbolic-ref refs/remotes/origin/HEAD)
2140
+ 4. HEAD~1 fallback
2141
+
2142
+ When `since` is None:
2143
+ 1. uncommitted changes (git diff --name-only --relative)
2144
+ 2. HEAD~1 fallback
2145
+
2146
+ Returns dict with keys:
2147
+ files: list[str] — changed paths (empty = confirmed no changes)
2148
+ resolved_ref: str — ref actually used for the diff
2149
+ resolution_path: str — which strategy resolved it
2150
+ diff_validation_status: str — "valid_non_empty"|"valid_empty"|"invalid_ref"
2151
+ error: bool — True only when ALL strategies failed
2152
+ """
2153
+ import subprocess
2154
+
2155
+ def _run(*args: str, timeout: int = 5) -> tuple[bool, str]:
2156
+ try:
2157
+ r = subprocess.run(
2158
+ ["git", *args], cwd=str(self.root),
2159
+ capture_output=True, text=True,
2160
+ encoding="utf-8", errors="replace", timeout=timeout,
2161
+ )
2162
+ return r.returncode == 0, (r.stdout or "").strip()
2163
+ except (subprocess.TimeoutExpired, FileNotFoundError):
2164
+ return False, ""
2165
+
2166
+ def _verify(ref: str) -> bool:
2167
+ ok, _ = _run("rev-parse", "--verify", ref)
2168
+ return ok
2169
+
2170
+ def _diff(ref: str) -> Optional[list[str]]:
2171
+ ok, out = _run("diff", "--name-only", "--relative", ref, "HEAD", timeout=10)
2172
+ if not ok:
2173
+ return None
2174
+ return [line.strip() for line in out.splitlines() if line.strip()]
2175
+
2176
+ def _make(files: list[str], ref: str, path: str) -> dict[str, Any]:
2177
+ return {
2178
+ "files": files,
2179
+ "resolved_ref": ref,
2180
+ "resolution_path": path,
2181
+ "diff_validation_status": "valid_non_empty" if files else "valid_empty",
2182
+ "error": False,
2183
+ }
2184
+
2185
+ if since:
2186
+ # Stage 1: exact local ref
2187
+ if _verify(since):
2188
+ files = _diff(since)
2189
+ if files is not None:
2190
+ return _make(files, since, "exact_local_ref")
2191
+
2192
+ # Stage 2: remote-tracking ref (origin/<since>)
2193
+ remote_ref = f"origin/{since}"
2194
+ if _verify(remote_ref):
2195
+ files = _diff(remote_ref)
2196
+ if files is not None:
2197
+ return _make(files, remote_ref, "remote_tracking_ref")
2198
+
2199
+ # Stage 3: symbolic ref (origin/HEAD → e.g. origin/main)
2200
+ ok, symref = _run("symbolic-ref", "refs/remotes/origin/HEAD")
2201
+ if ok and symref:
2202
+ short = symref.removeprefix("refs/remotes/")
2203
+ if _verify(short):
2204
+ files = _diff(short)
2205
+ if files is not None:
2206
+ return _make(files, short, "symbolic_ref")
2207
+
2208
+ # Stage 4: HEAD~1 fallback — original ref was invalid
2209
+ if _verify("HEAD~1"):
2210
+ files = _diff("HEAD~1")
2211
+ if files is not None:
2212
+ return {
2213
+ "files": files,
2214
+ "resolved_ref": "HEAD~1",
2215
+ "resolution_path": "head_minus_1_fallback",
2216
+ "diff_validation_status": "invalid_ref", # original ref unresolved
2217
+ "error": False,
2218
+ }
2219
+
2220
+ # All stages failed
2221
+ return {
2222
+ "files": [],
2223
+ "resolved_ref": since,
2224
+ "resolution_path": "unresolvable",
2225
+ "diff_validation_status": "invalid_ref",
2226
+ "error": True,
2227
+ }
2228
+
2229
+ else:
2230
+ # No since: uncommitted changes first
2231
+ ok, out = _run("diff", "--name-only", "--relative", timeout=10)
2232
+ if ok:
2233
+ files = [line.strip() for line in out.splitlines() if line.strip()]
2234
+ if files:
2235
+ return _make(files, "HEAD", "uncommitted_changes")
2236
+
2237
+ # HEAD~1 fallback
2238
+ if _verify("HEAD~1"):
2239
+ files = _diff("HEAD~1")
2240
+ if files is not None:
2241
+ return _make(files or [], "HEAD~1", "head_minus_1_fallback")
2242
+
2243
+ return {
2244
+ "files": [],
2245
+ "resolved_ref": "HEAD",
2246
+ "resolution_path": "unresolvable",
2247
+ "diff_validation_status": "invalid_ref",
2248
+ "error": True,
2249
+ }
2250
+
2251
+ def _get_git_changed_files(self, since: Optional[str] = None) -> Optional[list[str]]:
2091
2252
  """Get files changed since a git ref (default: HEAD~1) relative to self.root.
2092
2253
 
2254
+ Returns None when `since` is explicitly provided but cannot be resolved —
2255
+ this is an error state, not "no changes". Callers must distinguish None
2256
+ (ref invalid) from [] (ref valid, no changes).
2257
+
2093
2258
  Uses --relative so paths are relative to cwd (self.root), not the git repo
2094
2259
  root. This is critical for monorepos where self.root is a subpath of the
2095
2260
  git root and git diff would otherwise return prefixed paths that don't match
@@ -2112,9 +2277,13 @@ class TaskContextBuilder:
2112
2277
  line.strip() for line in (result.stdout or "").splitlines()
2113
2278
  if line.strip()
2114
2279
  ]
2280
+ # Non-zero exit with explicit ref = ref doesn't exist — no silent fallback
2281
+ if since:
2282
+ return None
2115
2283
  except (subprocess.TimeoutExpired, FileNotFoundError):
2116
- pass
2117
- # Fallback: uncommitted changes
2284
+ if since:
2285
+ return None
2286
+ # No explicit since: fall back to uncommitted changes
2118
2287
  try:
2119
2288
  result = subprocess.run(
2120
2289
  ["git", "diff", "--name-only", "--relative"],
@@ -2130,3 +2299,26 @@ class TaskContextBuilder:
2130
2299
  except (subprocess.TimeoutExpired, FileNotFoundError):
2131
2300
  pass
2132
2301
  return []
2302
+
2303
+ def _get_available_refs(self, invalid_ref: str) -> tuple[list[str], Optional[str]]:
2304
+ """Return (available_branch_names, suggested_alternative) for error hints."""
2305
+ import subprocess
2306
+ branches: list[str] = []
2307
+ suggested: Optional[str] = None
2308
+ try:
2309
+ r = subprocess.run(
2310
+ ["git", "branch", "-a", "--format=%(refname:short)"],
2311
+ cwd=str(self.root),
2312
+ capture_output=True, text=True, timeout=5,
2313
+ )
2314
+ if r.returncode == 0:
2315
+ all_refs = [b.strip() for b in r.stdout.splitlines() if b.strip()]
2316
+ branches = [b for b in all_refs if "HEAD" not in b][:10]
2317
+ ref_lower = invalid_ref.lower()
2318
+ if ref_lower == "master" and any(b.rstrip("/").endswith("main") for b in all_refs):
2319
+ suggested = "main"
2320
+ elif ref_lower == "main" and any(b.rstrip("/").endswith("master") for b in all_refs):
2321
+ suggested = "master"
2322
+ except (subprocess.TimeoutExpired, FileNotFoundError):
2323
+ pass
2324
+ return branches, suggested