apatch 0.8.42__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 (530) hide show
  1. apatch-0.8.42/LICENSE +21 -0
  2. apatch-0.8.42/PKG-INFO +432 -0
  3. apatch-0.8.42/README.md +383 -0
  4. apatch-0.8.42/apatch/__init__.py +30 -0
  5. apatch-0.8.42/apatch/agent_guidance.py +903 -0
  6. apatch-0.8.42/apatch/agent_playbooks.py +317 -0
  7. apatch-0.8.42/apatch/apatch_paths.py +125 -0
  8. apatch-0.8.42/apatch/apply_session.py +706 -0
  9. apatch-0.8.42/apatch/arch_check.py +173 -0
  10. apatch-0.8.42/apatch/arch_rules.py +31 -0
  11. apatch-0.8.42/apatch/artifact.py +175 -0
  12. apatch-0.8.42/apatch/artifact_governance.py +1527 -0
  13. apatch-0.8.42/apatch/ast_window.py +58 -0
  14. apatch-0.8.42/apatch/auto_wire.py +370 -0
  15. apatch-0.8.42/apatch/avatar_compiler.py +109 -0
  16. apatch-0.8.42/apatch/avatar_delivery.py +782 -0
  17. apatch-0.8.42/apatch/avatar_evidence.py +224 -0
  18. apatch-0.8.42/apatch/avatar_runtime_config.py +150 -0
  19. apatch-0.8.42/apatch/backup.py +330 -0
  20. apatch-0.8.42/apatch/barrel_export.py +98 -0
  21. apatch-0.8.42/apatch/boundary_ast.py +376 -0
  22. apatch-0.8.42/apatch/boundary_ranker.py +247 -0
  23. apatch-0.8.42/apatch/boundary_scope.py +95 -0
  24. apatch-0.8.42/apatch/build_diagnose.py +296 -0
  25. apatch-0.8.42/apatch/capability.py +175 -0
  26. apatch-0.8.42/apatch/change_budget.py +108 -0
  27. apatch-0.8.42/apatch/cli.py +4968 -0
  28. apatch-0.8.42/apatch/cli_concept.py +334 -0
  29. apatch-0.8.42/apatch/cli_conformance.py +151 -0
  30. apatch-0.8.42/apatch/cli_extension.py +156 -0
  31. apatch-0.8.42/apatch/cli_status.py +191 -0
  32. apatch-0.8.42/apatch/codex_approval.py +361 -0
  33. apatch-0.8.42/apatch/concept_clarify.py +59 -0
  34. apatch-0.8.42/apatch/concept_compile.py +323 -0
  35. apatch-0.8.42/apatch/concept_crud.py +143 -0
  36. apatch-0.8.42/apatch/concept_merge.py +134 -0
  37. apatch-0.8.42/apatch/concept_verify.py +82 -0
  38. apatch-0.8.42/apatch/conformance.py +731 -0
  39. apatch-0.8.42/apatch/console/__init__.py +5 -0
  40. apatch-0.8.42/apatch/console/mvp.py +285 -0
  41. apatch-0.8.42/apatch/console/state.py +34 -0
  42. apatch-0.8.42/apatch/consumer_profiles.py +276 -0
  43. apatch-0.8.42/apatch/contribution.py +527 -0
  44. apatch-0.8.42/apatch/contribution_delivery.py +604 -0
  45. apatch-0.8.42/apatch/contribution_export.py +600 -0
  46. apatch-0.8.42/apatch/converters/__init__.py +1 -0
  47. apatch-0.8.42/apatch/converters/registry.py +19 -0
  48. apatch-0.8.42/apatch/converters/ts_module.py +944 -0
  49. apatch-0.8.42/apatch/dangling_refs.py +68 -0
  50. apatch-0.8.42/apatch/db_check.py +70 -0
  51. apatch-0.8.42/apatch/db_profiles.py +58 -0
  52. apatch-0.8.42/apatch/db_revision.py +74 -0
  53. apatch-0.8.42/apatch/db_run.py +192 -0
  54. apatch-0.8.42/apatch/db_safety.py +81 -0
  55. apatch-0.8.42/apatch/diagnostics/__init__.py +12 -0
  56. apatch-0.8.42/apatch/diagnostics/adapters/__init__.py +1 -0
  57. apatch-0.8.42/apatch/diagnostics/adapters/clang.py +56 -0
  58. apatch-0.8.42/apatch/diagnostics/adapters/pytest.py +36 -0
  59. apatch-0.8.42/apatch/diagnostics/adapters/spec.py +29 -0
  60. apatch-0.8.42/apatch/diagnostics/adapters/trust.py +47 -0
  61. apatch-0.8.42/apatch/diagnostics/artifacts.py +34 -0
  62. apatch-0.8.42/apatch/diagnostics/collect.py +141 -0
  63. apatch-0.8.42/apatch/diagnostics/edges.py +198 -0
  64. apatch-0.8.42/apatch/diagnostics/schema.py +45 -0
  65. apatch-0.8.42/apatch/discovery.py +101 -0
  66. apatch-0.8.42/apatch/doc_outline.py +136 -0
  67. apatch-0.8.42/apatch/doctor.py +945 -0
  68. apatch-0.8.42/apatch/edge_lockstep.py +146 -0
  69. apatch-0.8.42/apatch/enforcement.py +656 -0
  70. apatch-0.8.42/apatch/enforcement_messages.py +111 -0
  71. apatch-0.8.42/apatch/episode.py +581 -0
  72. apatch-0.8.42/apatch/extensions/__init__.py +41 -0
  73. apatch-0.8.42/apatch/extensions/authoring.py +218 -0
  74. apatch-0.8.42/apatch/extensions/catalog.py +197 -0
  75. apatch-0.8.42/apatch/extensions/host.py +69 -0
  76. apatch-0.8.42/apatch/extensions/runner.py +388 -0
  77. apatch-0.8.42/apatch/extensions/schema.py +685 -0
  78. apatch-0.8.42/apatch/extensions/schemas/lock-v1.json +81 -0
  79. apatch-0.8.42/apatch/extensions/schemas/manifest-v1.json +217 -0
  80. apatch-0.8.42/apatch/extensions/schemas/request-v1.json +47 -0
  81. apatch-0.8.42/apatch/extensions/schemas/response-v1.json +44 -0
  82. apatch-0.8.42/apatch/failure_taxonomy.py +341 -0
  83. apatch-0.8.42/apatch/feedback_status.py +7 -0
  84. apatch-0.8.42/apatch/file_modes.py +50 -0
  85. apatch-0.8.42/apatch/gc.py +97 -0
  86. apatch-0.8.42/apatch/generate.py +783 -0
  87. apatch-0.8.42/apatch/git_commit.py +469 -0
  88. apatch-0.8.42/apatch/git_util.py +105 -0
  89. apatch-0.8.42/apatch/governed_work.py +1473 -0
  90. apatch-0.8.42/apatch/governed_work_delivery.py +1122 -0
  91. apatch-0.8.42/apatch/governed_work_mcp.py +357 -0
  92. apatch-0.8.42/apatch/governed_work_transport.py +151 -0
  93. apatch-0.8.42/apatch/graph_execute.py +455 -0
  94. apatch-0.8.42/apatch/impact.py +105 -0
  95. apatch-0.8.42/apatch/import_graph.py +212 -0
  96. apatch-0.8.42/apatch/import_paths.py +90 -0
  97. apatch-0.8.42/apatch/imports_resolver.py +785 -0
  98. apatch-0.8.42/apatch/inclusion.py +400 -0
  99. apatch-0.8.42/apatch/ingestor.py +517 -0
  100. apatch-0.8.42/apatch/json_mapping.py +313 -0
  101. apatch-0.8.42/apatch/knowledge_graph.py +245 -0
  102. apatch-0.8.42/apatch/lane.py +179 -0
  103. apatch-0.8.42/apatch/lane_context.py +231 -0
  104. apatch-0.8.42/apatch/layout_migrate.py +98 -0
  105. apatch-0.8.42/apatch/ledger_actor.py +33 -0
  106. apatch-0.8.42/apatch/manifest_bundle.py +104 -0
  107. apatch-0.8.42/apatch/manifest_validator.py +114 -0
  108. apatch-0.8.42/apatch/match_session.py +29 -0
  109. apatch-0.8.42/apatch/matcher.py +629 -0
  110. apatch-0.8.42/apatch/mcp/__init__.py +1 -0
  111. apatch-0.8.42/apatch/mcp/__main__.py +6 -0
  112. apatch-0.8.42/apatch/mcp/bound_workspace.py +103 -0
  113. apatch-0.8.42/apatch/mcp/hygiene.py +125 -0
  114. apatch-0.8.42/apatch/mcp/launcher.py +45 -0
  115. apatch-0.8.42/apatch/mcp/lifecycle.py +142 -0
  116. apatch-0.8.42/apatch/mcp/profiles.py +107 -0
  117. apatch-0.8.42/apatch/mcp/resources.py +115 -0
  118. apatch-0.8.42/apatch/mcp/sanitize.py +86 -0
  119. apatch-0.8.42/apatch/mcp/server.py +4182 -0
  120. apatch-0.8.42/apatch/mcp/stdio_guard.py +98 -0
  121. apatch-0.8.42/apatch/mcp/workspace_launcher.py +102 -0
  122. apatch-0.8.42/apatch/mcp/workspace_registry.py +363 -0
  123. apatch-0.8.42/apatch/mcp_health.py +775 -0
  124. apatch-0.8.42/apatch/native_converter.py +332 -0
  125. apatch-0.8.42/apatch/native_refs.py +128 -0
  126. apatch-0.8.42/apatch/orchestrate.py +87 -0
  127. apatch-0.8.42/apatch/outcome_delivery.py +401 -0
  128. apatch-0.8.42/apatch/path_index.py +265 -0
  129. apatch-0.8.42/apatch/path_leases.py +559 -0
  130. apatch-0.8.42/apatch/pipeline_run.py +225 -0
  131. apatch-0.8.42/apatch/plan_adherence.py +134 -0
  132. apatch-0.8.42/apatch/plan_worker.py +88 -0
  133. apatch-0.8.42/apatch/platform_client.py +151 -0
  134. apatch-0.8.42/apatch/policy_lock.py +245 -0
  135. apatch-0.8.42/apatch/probe.py +337 -0
  136. apatch-0.8.42/apatch/project_index.py +233 -0
  137. apatch-0.8.42/apatch/project_status.py +289 -0
  138. apatch-0.8.42/apatch/reality.py +179 -0
  139. apatch-0.8.42/apatch/refactor_run.py +205 -0
  140. apatch-0.8.42/apatch/remote/__init__.py +18 -0
  141. apatch-0.8.42/apatch/remote/doctor.py +87 -0
  142. apatch-0.8.42/apatch/remote/errors.py +57 -0
  143. apatch-0.8.42/apatch/remote/handoff.py +669 -0
  144. apatch-0.8.42/apatch/remote/onboarding.py +197 -0
  145. apatch-0.8.42/apatch/remote/orchestrator.py +1187 -0
  146. apatch-0.8.42/apatch/remote/policy.py +233 -0
  147. apatch-0.8.42/apatch/remote/services.py +524 -0
  148. apatch-0.8.42/apatch/remote/ssh.py +318 -0
  149. apatch-0.8.42/apatch/remote/target.py +202 -0
  150. apatch-0.8.42/apatch/remote/transport.py +66 -0
  151. apatch-0.8.42/apatch/remote/verify.py +122 -0
  152. apatch-0.8.42/apatch/remote/worker.py +816 -0
  153. apatch-0.8.42/apatch/repair_map.py +7 -0
  154. apatch-0.8.42/apatch/replay.py +134 -0
  155. apatch-0.8.42/apatch/report_render.py +325 -0
  156. apatch-0.8.42/apatch/resolver.py +109 -0
  157. apatch-0.8.42/apatch/rfp_coverage.py +733 -0
  158. apatch-0.8.42/apatch/runtime/__init__.py +35 -0
  159. apatch-0.8.42/apatch/runtime/atomic_io.py +83 -0
  160. apatch-0.8.42/apatch/runtime/attestation.py +96 -0
  161. apatch-0.8.42/apatch/runtime/domain.py +52 -0
  162. apatch-0.8.42/apatch/runtime/errors.py +100 -0
  163. apatch-0.8.42/apatch/runtime/events.py +149 -0
  164. apatch-0.8.42/apatch/runtime/finalization.py +270 -0
  165. apatch-0.8.42/apatch/runtime/hints.py +99 -0
  166. apatch-0.8.42/apatch/runtime/models.py +48 -0
  167. apatch-0.8.42/apatch/runtime/namespace.py +81 -0
  168. apatch-0.8.42/apatch/runtime/reconcile.py +175 -0
  169. apatch-0.8.42/apatch/runtime/recovery.py +85 -0
  170. apatch-0.8.42/apatch/runtime/request_journal.py +376 -0
  171. apatch-0.8.42/apatch/runtime/runtime.py +1251 -0
  172. apatch-0.8.42/apatch/runtime/session.py +478 -0
  173. apatch-0.8.42/apatch/runtime/session_binding.py +403 -0
  174. apatch-0.8.42/apatch/runtime/state_machine.py +143 -0
  175. apatch-0.8.42/apatch/runtime/verification.py +48 -0
  176. apatch-0.8.42/apatch/sandbox.py +1050 -0
  177. apatch-0.8.42/apatch/sandbox_watch.py +523 -0
  178. apatch-0.8.42/apatch/scale_config.py +33 -0
  179. apatch-0.8.42/apatch/scip_ingest.py +294 -0
  180. apatch-0.8.42/apatch/scip_producer.py +171 -0
  181. apatch-0.8.42/apatch/sdd_integrity.py +1439 -0
  182. apatch-0.8.42/apatch/semantic_parser.py +241 -0
  183. apatch-0.8.42/apatch/semantic_verify.py +235 -0
  184. apatch-0.8.42/apatch/service_secret.py +119 -0
  185. apatch-0.8.42/apatch/session_state.py +788 -0
  186. apatch-0.8.42/apatch/session_status.py +139 -0
  187. apatch-0.8.42/apatch/shared_maintenance.py +471 -0
  188. apatch-0.8.42/apatch/simulate.py +386 -0
  189. apatch-0.8.42/apatch/slug_close.py +7 -0
  190. apatch-0.8.42/apatch/slug_cockpit.py +7 -0
  191. apatch-0.8.42/apatch/slug_feedback_lint.py +7 -0
  192. apatch-0.8.42/apatch/slug_intake.py +7 -0
  193. apatch-0.8.42/apatch/slug_ratify.py +7 -0
  194. apatch-0.8.42/apatch/spec.py +1023 -0
  195. apatch-0.8.42/apatch/spec_contract_resolver.py +120 -0
  196. apatch-0.8.42/apatch/spec_coverage.py +403 -0
  197. apatch-0.8.42/apatch/spec_cross_verify.py +259 -0
  198. apatch-0.8.42/apatch/spec_executor.py +786 -0
  199. apatch-0.8.42/apatch/spec_interference.py +970 -0
  200. apatch-0.8.42/apatch/spec_interference_l0.py +206 -0
  201. apatch-0.8.42/apatch/spec_needles_scaffold.py +329 -0
  202. apatch-0.8.42/apatch/spec_ownership.py +594 -0
  203. apatch-0.8.42/apatch/spec_plan.py +502 -0
  204. apatch-0.8.42/apatch/spec_rebind.py +293 -0
  205. apatch-0.8.42/apatch/spec_registry.py +66 -0
  206. apatch-0.8.42/apatch/spec_run.py +1513 -0
  207. apatch-0.8.42/apatch/spec_run_multi.py +470 -0
  208. apatch-0.8.42/apatch/strip.py +491 -0
  209. apatch-0.8.42/apatch/strip_cache.py +38 -0
  210. apatch-0.8.42/apatch/strip_pipeline.py +866 -0
  211. apatch-0.8.42/apatch/symbol_anchor.py +145 -0
  212. apatch-0.8.42/apatch/symbol_index.py +64 -0
  213. apatch-0.8.42/apatch/taxonomy_delivery.py +380 -0
  214. apatch-0.8.42/apatch/timesheet.py +251 -0
  215. apatch-0.8.42/apatch/tool_paths.py +388 -0
  216. apatch-0.8.42/apatch/toolchain.py +225 -0
  217. apatch-0.8.42/apatch/traceability.py +263 -0
  218. apatch-0.8.42/apatch/trust_identity.py +642 -0
  219. apatch-0.8.42/apatch/trustchain_helper.py +1142 -0
  220. apatch-0.8.42/apatch/tui.py +737 -0
  221. apatch-0.8.42/apatch/ux_audit.py +122 -0
  222. apatch-0.8.42/apatch/verify_baseline.py +171 -0
  223. apatch-0.8.42/apatch/verify_jobs.py +516 -0
  224. apatch-0.8.42/apatch/verify_worker.py +24 -0
  225. apatch-0.8.42/apatch/warn_filters.py +25 -0
  226. apatch-0.8.42/apatch/wiring_profiles.py +249 -0
  227. apatch-0.8.42/apatch/work_asset_lifecycle.py +290 -0
  228. apatch-0.8.42/apatch/work_asset_suggest.py +192 -0
  229. apatch-0.8.42/apatch/work_assets.py +623 -0
  230. apatch-0.8.42/apatch/workflows.py +1774 -0
  231. apatch-0.8.42/apatch/workspace_identity.py +70 -0
  232. apatch-0.8.42/apatch/worktree_lane.py +238 -0
  233. apatch-0.8.42/apatch.egg-info/PKG-INFO +432 -0
  234. apatch-0.8.42/apatch.egg-info/SOURCES.txt +528 -0
  235. apatch-0.8.42/apatch.egg-info/dependency_links.txt +1 -0
  236. apatch-0.8.42/apatch.egg-info/entry_points.txt +5 -0
  237. apatch-0.8.42/apatch.egg-info/requires.txt +37 -0
  238. apatch-0.8.42/apatch.egg-info/top_level.txt +2 -0
  239. apatch-0.8.42/apatch_search_workflows/__init__.py +11 -0
  240. apatch-0.8.42/apatch_search_workflows/feedback_status.py +114 -0
  241. apatch-0.8.42/apatch_search_workflows/repair_map.py +136 -0
  242. apatch-0.8.42/apatch_search_workflows/slug_close.py +869 -0
  243. apatch-0.8.42/apatch_search_workflows/slug_cockpit.py +773 -0
  244. apatch-0.8.42/apatch_search_workflows/slug_feedback_lint.py +350 -0
  245. apatch-0.8.42/apatch_search_workflows/slug_intake.py +798 -0
  246. apatch-0.8.42/apatch_search_workflows/slug_ratify.py +533 -0
  247. apatch-0.8.42/pyproject.toml +93 -0
  248. apatch-0.8.42/setup.cfg +4 -0
  249. apatch-0.8.42/tests/test_add_file_trailing_newline.py +46 -0
  250. apatch-0.8.42/tests/test_agent_guidance.py +170 -0
  251. apatch-0.8.42/tests/test_agent_playbooks.py +89 -0
  252. apatch-0.8.42/tests/test_agent_ux_phase2.py +78 -0
  253. apatch-0.8.42/tests/test_agent_ux_recovery.py +166 -0
  254. apatch-0.8.42/tests/test_agents_template.py +73 -0
  255. apatch-0.8.42/tests/test_apatch_reliability_fixes.py +56 -0
  256. apatch-0.8.42/tests/test_apply_baseline.py +87 -0
  257. apatch-0.8.42/tests/test_apply_deferred_last_chunk.py +96 -0
  258. apatch-0.8.42/tests/test_apply_idempotent.py +49 -0
  259. apatch-0.8.42/tests/test_apply_resume.py +57 -0
  260. apatch-0.8.42/tests/test_apply_session.py +284 -0
  261. apatch-0.8.42/tests/test_apply_session_dropped_steps.py +121 -0
  262. apatch-0.8.42/tests/test_apply_session_reset_verifying.py +107 -0
  263. apatch-0.8.42/tests/test_artifact.py +343 -0
  264. apatch-0.8.42/tests/test_artifact_governance.py +266 -0
  265. apatch-0.8.42/tests/test_auto_wire.py +363 -0
  266. apatch-0.8.42/tests/test_avatar_attestation_receipt.py +175 -0
  267. apatch-0.8.42/tests/test_avatar_compiler.py +90 -0
  268. apatch-0.8.42/tests/test_avatar_concepts.py +54 -0
  269. apatch-0.8.42/tests/test_avatar_contract_optional.py +87 -0
  270. apatch-0.8.42/tests/test_avatar_delivery.py +583 -0
  271. apatch-0.8.42/tests/test_avatar_docs_contract.py +55 -0
  272. apatch-0.8.42/tests/test_avatar_evidence.py +176 -0
  273. apatch-0.8.42/tests/test_avatar_runtime_config.py +105 -0
  274. apatch-0.8.42/tests/test_avatar_scope.py +32 -0
  275. apatch-0.8.42/tests/test_batch_needle_overlap.py +116 -0
  276. apatch-0.8.42/tests/test_boundary_assessment.py +102 -0
  277. apatch-0.8.42/tests/test_boundary_ast.py +103 -0
  278. apatch-0.8.42/tests/test_boundary_scope.py +42 -0
  279. apatch-0.8.42/tests/test_brand_fallback.py +122 -0
  280. apatch-0.8.42/tests/test_build_diagnose.py +148 -0
  281. apatch-0.8.42/tests/test_capability.py +143 -0
  282. apatch-0.8.42/tests/test_chain_ledger.py +22 -0
  283. apatch-0.8.42/tests/test_cli_commit_attested.py +50 -0
  284. apatch-0.8.42/tests/test_cli_status.py +82 -0
  285. apatch-0.8.42/tests/test_codex_approval.py +136 -0
  286. apatch-0.8.42/tests/test_commit_attested.py +215 -0
  287. apatch-0.8.42/tests/test_concept_c4.py +58 -0
  288. apatch-0.8.42/tests/test_concept_clarify.py +63 -0
  289. apatch-0.8.42/tests/test_concept_cli.py +45 -0
  290. apatch-0.8.42/tests/test_concept_compile.py +82 -0
  291. apatch-0.8.42/tests/test_concept_coverage.py +45 -0
  292. apatch-0.8.42/tests/test_concept_crud.py +96 -0
  293. apatch-0.8.42/tests/test_concept_dedup.py +77 -0
  294. apatch-0.8.42/tests/test_concept_merge.py +92 -0
  295. apatch-0.8.42/tests/test_concept_readable.py +41 -0
  296. apatch-0.8.42/tests/test_concept_render.py +41 -0
  297. apatch-0.8.42/tests/test_concept_status.py +45 -0
  298. apatch-0.8.42/tests/test_concept_verify.py +52 -0
  299. apatch-0.8.42/tests/test_concept_wiki.py +44 -0
  300. apatch-0.8.42/tests/test_conformance.py +579 -0
  301. apatch-0.8.42/tests/test_console_g5.py +8 -0
  302. apatch-0.8.42/tests/test_consumer_profile_roaming.py +11 -0
  303. apatch-0.8.42/tests/test_contract_edges.py +148 -0
  304. apatch-0.8.42/tests/test_contribution_delivery.py +341 -0
  305. apatch-0.8.42/tests/test_contribution_event.py +330 -0
  306. apatch-0.8.42/tests/test_contribution_export.py +477 -0
  307. apatch-0.8.42/tests/test_contribution_timesheet.py +21 -0
  308. apatch-0.8.42/tests/test_dangling_refs.py +8 -0
  309. apatch-0.8.42/tests/test_design_partner_playbook.py +70 -0
  310. apatch-0.8.42/tests/test_diagnostic_graph.py +194 -0
  311. apatch-0.8.42/tests/test_discovery.py +75 -0
  312. apatch-0.8.42/tests/test_distribution.py +140 -0
  313. apatch-0.8.42/tests/test_doc_outline.py +110 -0
  314. apatch-0.8.42/tests/test_docs_in_sync.py +95 -0
  315. apatch-0.8.42/tests/test_doctor.py +184 -0
  316. apatch-0.8.42/tests/test_edge_lockstep.py +86 -0
  317. apatch-0.8.42/tests/test_enforcement.py +58 -0
  318. apatch-0.8.42/tests/test_enforcement_messages.py +21 -0
  319. apatch-0.8.42/tests/test_episode.py +304 -0
  320. apatch-0.8.42/tests/test_extensions.py +720 -0
  321. apatch-0.8.42/tests/test_failure_taxonomy.py +51 -0
  322. apatch-0.8.42/tests/test_failure_taxonomy_v2.py +100 -0
  323. apatch-0.8.42/tests/test_falsify.py +45 -0
  324. apatch-0.8.42/tests/test_features.py +258 -0
  325. apatch-0.8.42/tests/test_feedback_status.py +61 -0
  326. apatch-0.8.42/tests/test_file_modes.py +11 -0
  327. apatch-0.8.42/tests/test_filters.py +68 -0
  328. apatch-0.8.42/tests/test_gc_cli.py +455 -0
  329. apatch-0.8.42/tests/test_gc_reconcile.py +72 -0
  330. apatch-0.8.42/tests/test_generate.py +25 -0
  331. apatch-0.8.42/tests/test_generate_batch.py +317 -0
  332. apatch-0.8.42/tests/test_generate_batch_defaults.py +30 -0
  333. apatch-0.8.42/tests/test_git_worktree_roots.py +54 -0
  334. apatch-0.8.42/tests/test_glob_root_match.py +26 -0
  335. apatch-0.8.42/tests/test_governed_mode.py +221 -0
  336. apatch-0.8.42/tests/test_governed_rollback_isolation.py +186 -0
  337. apatch-0.8.42/tests/test_governed_work_binding.py +180 -0
  338. apatch-0.8.42/tests/test_governed_work_change.py +102 -0
  339. apatch-0.8.42/tests/test_governed_work_compatibility.py +191 -0
  340. apatch-0.8.42/tests/test_governed_work_delivery.py +601 -0
  341. apatch-0.8.42/tests/test_governed_work_e2e.py +358 -0
  342. apatch-0.8.42/tests/test_governed_work_evidence.py +377 -0
  343. apatch-0.8.42/tests/test_governed_work_mcp.py +213 -0
  344. apatch-0.8.42/tests/test_governed_work_transport.py +166 -0
  345. apatch-0.8.42/tests/test_graph_execute.py +79 -0
  346. apatch-0.8.42/tests/test_hook_sales_funnel.py +52 -0
  347. apatch-0.8.42/tests/test_hygiene1_helpers.py +35 -0
  348. apatch-0.8.42/tests/test_imports_resolver.py +188 -0
  349. apatch-0.8.42/tests/test_inclusion.py +248 -0
  350. apatch-0.8.42/tests/test_ingestor.py +244 -0
  351. apatch-0.8.42/tests/test_iter_matching_root.py +45 -0
  352. apatch-0.8.42/tests/test_kms_backend.py +149 -0
  353. apatch-0.8.42/tests/test_knowledge_graph.py +181 -0
  354. apatch-0.8.42/tests/test_lane_apply_session.py +24 -0
  355. apatch-0.8.42/tests/test_lane_auto.py +48 -0
  356. apatch-0.8.42/tests/test_lane_context.py +62 -0
  357. apatch-0.8.42/tests/test_lane_resolve.py +34 -0
  358. apatch-0.8.42/tests/test_layout_paths.py +110 -0
  359. apatch-0.8.42/tests/test_ledger_actor.py +138 -0
  360. apatch-0.8.42/tests/test_ledger_hot_path.py +320 -0
  361. apatch-0.8.42/tests/test_manifest_validator.py +63 -0
  362. apatch-0.8.42/tests/test_matcher.py +355 -0
  363. apatch-0.8.42/tests/test_matcher_fuzz_rtg.py +309 -0
  364. apatch-0.8.42/tests/test_mcp.py +621 -0
  365. apatch-0.8.42/tests/test_mcp_bound_workspace.py +71 -0
  366. apatch-0.8.42/tests/test_mcp_config_discovery.py +80 -0
  367. apatch-0.8.42/tests/test_mcp_health.py +190 -0
  368. apatch-0.8.42/tests/test_mcp_lifecycle.py +136 -0
  369. apatch-0.8.42/tests/test_mcp_needles_path.py +48 -0
  370. apatch-0.8.42/tests/test_mcp_profiles.py +102 -0
  371. apatch-0.8.42/tests/test_mcp_rfp004_lifecycle.py +157 -0
  372. apatch-0.8.42/tests/test_mcp_sanitize.py +41 -0
  373. apatch-0.8.42/tests/test_mcp_scale_l1.py +79 -0
  374. apatch-0.8.42/tests/test_mcp_stateful_contract.py +24 -0
  375. apatch-0.8.42/tests/test_mcp_stdio_encoding.py +94 -0
  376. apatch-0.8.42/tests/test_mcp_stdio_live.py +198 -0
  377. apatch-0.8.42/tests/test_mcp_workspace_roaming.py +36 -0
  378. apatch-0.8.42/tests/test_native_refs.py +68 -0
  379. apatch-0.8.42/tests/test_needles_hint.py +83 -0
  380. apatch-0.8.42/tests/test_noop_attest_cli.py +29 -0
  381. apatch-0.8.42/tests/test_orchestrate.py +39 -0
  382. apatch-0.8.42/tests/test_orchestration_p4.py +97 -0
  383. apatch-0.8.42/tests/test_orchestration_r39_r52.py +123 -0
  384. apatch-0.8.42/tests/test_orchestration_r41_r46.py +200 -0
  385. apatch-0.8.42/tests/test_orchestration_r43_r49.py +145 -0
  386. apatch-0.8.42/tests/test_orchestration_r47_r48.py +119 -0
  387. apatch-0.8.42/tests/test_outcome_delivery.py +474 -0
  388. apatch-0.8.42/tests/test_partner_smoke_ud7.py +2 -0
  389. apatch-0.8.42/tests/test_path_index.py +111 -0
  390. apatch-0.8.42/tests/test_path_lease_integration.py +134 -0
  391. apatch-0.8.42/tests/test_path_lease_spec_e2e.py +108 -0
  392. apatch-0.8.42/tests/test_path_lease_trustchain.py +84 -0
  393. apatch-0.8.42/tests/test_path_leases.py +219 -0
  394. apatch-0.8.42/tests/test_path_leases_load.py +43 -0
  395. apatch-0.8.42/tests/test_plan.py +59 -0
  396. apatch-0.8.42/tests/test_plan_adherence.py +126 -0
  397. apatch-0.8.42/tests/test_platform_bridge.py +31 -0
  398. apatch-0.8.42/tests/test_policy_lock.py +174 -0
  399. apatch-0.8.42/tests/test_policy_snapshot.py +53 -0
  400. apatch-0.8.42/tests/test_probe.py +212 -0
  401. apatch-0.8.42/tests/test_product_taxonomy.py +20 -0
  402. apatch-0.8.42/tests/test_project_status.py +84 -0
  403. apatch-0.8.42/tests/test_project_status_compact.py +58 -0
  404. apatch-0.8.42/tests/test_readme_quickstart.py +30 -0
  405. apatch-0.8.42/tests/test_reality.py +67 -0
  406. apatch-0.8.42/tests/test_reality_status_not_failure.py +36 -0
  407. apatch-0.8.42/tests/test_rebind_evidence_integrity.py +142 -0
  408. apatch-0.8.42/tests/test_recommendations_r20.py +215 -0
  409. apatch-0.8.42/tests/test_recommendations_r31.py +178 -0
  410. apatch-0.8.42/tests/test_recommendations_r36.py +243 -0
  411. apatch-0.8.42/tests/test_recovery_guidance.py +12 -0
  412. apatch-0.8.42/tests/test_remote_command_kind.py +82 -0
  413. apatch-0.8.42/tests/test_remote_exec.py +85 -0
  414. apatch-0.8.42/tests/test_remote_finalization.py +218 -0
  415. apatch-0.8.42/tests/test_remote_mcp_routing.py +2061 -0
  416. apatch-0.8.42/tests/test_remote_onboarding.py +602 -0
  417. apatch-0.8.42/tests/test_remote_opacity.py +147 -0
  418. apatch-0.8.42/tests/test_remote_ssh_transport.py +290 -0
  419. apatch-0.8.42/tests/test_remote_target.py +268 -0
  420. apatch-0.8.42/tests/test_remote_verify.py +177 -0
  421. apatch-0.8.42/tests/test_remote_worker_protocol.py +737 -0
  422. apatch-0.8.42/tests/test_repair_map.py +123 -0
  423. apatch-0.8.42/tests/test_replay.py +49 -0
  424. apatch-0.8.42/tests/test_report.py +127 -0
  425. apatch-0.8.42/tests/test_request_journal.py +125 -0
  426. apatch-0.8.42/tests/test_resume_lifecycle.py +113 -0
  427. apatch-0.8.42/tests/test_reversibles_policy.py +37 -0
  428. apatch-0.8.42/tests/test_rfp004_final.py +233 -0
  429. apatch-0.8.42/tests/test_rfp_coverage.py +129 -0
  430. apatch-0.8.42/tests/test_rfp_scaffold.py +96 -0
  431. apatch-0.8.42/tests/test_rollback_safety.py +21 -0
  432. apatch-0.8.42/tests/test_runtime_e2_completion.py +138 -0
  433. apatch-0.8.42/tests/test_runtime_namespace.py +40 -0
  434. apatch-0.8.42/tests/test_runtime_rfp004.py +127 -0
  435. apatch-0.8.42/tests/test_runtime_state_machine.py +69 -0
  436. apatch-0.8.42/tests/test_runtime_transition_noop.py +50 -0
  437. apatch-0.8.42/tests/test_sandbox.py +437 -0
  438. apatch-0.8.42/tests/test_sandbox_ci_gate.py +224 -0
  439. apatch-0.8.42/tests/test_sandbox_watch.py +168 -0
  440. apatch-0.8.42/tests/test_scale_enterprise.py +399 -0
  441. apatch-0.8.42/tests/test_scale_features.py +67 -0
  442. apatch-0.8.42/tests/test_scale_perf.py +308 -0
  443. apatch-0.8.42/tests/test_scip_impact.py +129 -0
  444. apatch-0.8.42/tests/test_scip_phase2.py +91 -0
  445. apatch-0.8.42/tests/test_sdd_integrity.py +412 -0
  446. apatch-0.8.42/tests/test_sdd_integrity_amendment_a2.py +60 -0
  447. apatch-0.8.42/tests/test_sdd_integrity_contract.py +52 -0
  448. apatch-0.8.42/tests/test_sdd_mandatory_profile.py +146 -0
  449. apatch-0.8.42/tests/test_sdd_session_isolation.py +91 -0
  450. apatch-0.8.42/tests/test_sdd_verifier_closure.py +272 -0
  451. apatch-0.8.42/tests/test_search_workflows_compatibility.py +139 -0
  452. apatch-0.8.42/tests/test_semantic.py +159 -0
  453. apatch-0.8.42/tests/test_semantic_verify_consumer.py +56 -0
  454. apatch-0.8.42/tests/test_service_secret.py +163 -0
  455. apatch-0.8.42/tests/test_session_finalization.py +118 -0
  456. apatch-0.8.42/tests/test_session_hygiene.py +235 -0
  457. apatch-0.8.42/tests/test_session_recover_one_call.py +162 -0
  458. apatch-0.8.42/tests/test_session_recovery.py +151 -0
  459. apatch-0.8.42/tests/test_session_recovery_mcp.py +227 -0
  460. apatch-0.8.42/tests/test_session_state.py +136 -0
  461. apatch-0.8.42/tests/test_shared_maintenance_rollback_state.py +80 -0
  462. apatch-0.8.42/tests/test_simulate.py +69 -0
  463. apatch-0.8.42/tests/test_single_intake.py +372 -0
  464. apatch-0.8.42/tests/test_slug_close.py +397 -0
  465. apatch-0.8.42/tests/test_slug_cockpit.py +499 -0
  466. apatch-0.8.42/tests/test_slug_feedback_lint.py +261 -0
  467. apatch-0.8.42/tests/test_slug_intake.py +220 -0
  468. apatch-0.8.42/tests/test_slug_ratify.py +409 -0
  469. apatch-0.8.42/tests/test_spec.py +412 -0
  470. apatch-0.8.42/tests/test_spec_coverage.py +378 -0
  471. apatch-0.8.42/tests/test_spec_cross_verify.py +212 -0
  472. apatch-0.8.42/tests/test_spec_executor.py +563 -0
  473. apatch-0.8.42/tests/test_spec_interference.py +242 -0
  474. apatch-0.8.42/tests/test_spec_interference_l0.py +90 -0
  475. apatch-0.8.42/tests/test_spec_interference_mcp_strategy.py +65 -0
  476. apatch-0.8.42/tests/test_spec_interference_mvcc.py +118 -0
  477. apatch-0.8.42/tests/test_spec_interference_options.py +107 -0
  478. apatch-0.8.42/tests/test_spec_interference_taxonomy.py +54 -0
  479. apatch-0.8.42/tests/test_spec_needles_scaffold.py +164 -0
  480. apatch-0.8.42/tests/test_spec_owned_mutation_gate.py +688 -0
  481. apatch-0.8.42/tests/test_spec_plan.py +284 -0
  482. apatch-0.8.42/tests/test_spec_rebind.py +218 -0
  483. apatch-0.8.42/tests/test_spec_registry.py +51 -0
  484. apatch-0.8.42/tests/test_spec_run.py +726 -0
  485. apatch-0.8.42/tests/test_spec_run_allow_partial.py +71 -0
  486. apatch-0.8.42/tests/test_spec_run_interference_gate.py +66 -0
  487. apatch-0.8.42/tests/test_spec_run_multi.py +564 -0
  488. apatch-0.8.42/tests/test_spec_schedule.py +83 -0
  489. apatch-0.8.42/tests/test_status_blocked.py +111 -0
  490. apatch-0.8.42/tests/test_strip.py +1156 -0
  491. apatch-0.8.42/tests/test_strip_cache.py +77 -0
  492. apatch-0.8.42/tests/test_strip_cli_flags.py +73 -0
  493. apatch-0.8.42/tests/test_strip_frontend_e2e.py +122 -0
  494. apatch-0.8.42/tests/test_strip_import_parse.py +25 -0
  495. apatch-0.8.42/tests/test_strip_lifecycle_imports.py +157 -0
  496. apatch-0.8.42/tests/test_strip_overlap.py +39 -0
  497. apatch-0.8.42/tests/test_strip_pipeline.py +63 -0
  498. apatch-0.8.42/tests/test_strip_rollback.py +70 -0
  499. apatch-0.8.42/tests/test_strip_verify_argv.py +17 -0
  500. apatch-0.8.42/tests/test_symbol_anchor.py +162 -0
  501. apatch-0.8.42/tests/test_tab_entry_strip.py +85 -0
  502. apatch-0.8.42/tests/test_taxonomy_delivery.py +337 -0
  503. apatch-0.8.42/tests/test_timesheet.py +126 -0
  504. apatch-0.8.42/tests/test_timesheet_mcp.py +38 -0
  505. apatch-0.8.42/tests/test_tool_paths.py +108 -0
  506. apatch-0.8.42/tests/test_toolchain_perf.py +74 -0
  507. apatch-0.8.42/tests/test_transactional_sessions.py +466 -0
  508. apatch-0.8.42/tests/test_trust_anchor.py +273 -0
  509. apatch-0.8.42/tests/test_trustchain.py +101 -0
  510. apatch-0.8.42/tests/test_trustchain_integration.py +144 -0
  511. apatch-0.8.42/tests/test_ts_module.py +535 -0
  512. apatch-0.8.42/tests/test_tui.py +150 -0
  513. apatch-0.8.42/tests/test_ux_specialist.py +114 -0
  514. apatch-0.8.42/tests/test_verify_async.py +282 -0
  515. apatch-0.8.42/tests/test_verify_baseline.py +121 -0
  516. apatch-0.8.42/tests/test_verify_output.py +41 -0
  517. apatch-0.8.42/tests/test_version.py +71 -0
  518. apatch-0.8.42/tests/test_warn_filters.py +32 -0
  519. apatch-0.8.42/tests/test_wiring_routes.py +29 -0
  520. apatch-0.8.42/tests/test_work_asset_export_contract.py +167 -0
  521. apatch-0.8.42/tests/test_work_asset_lifecycle.py +312 -0
  522. apatch-0.8.42/tests/test_work_asset_suggest.py +278 -0
  523. apatch-0.8.42/tests/test_work_assets.py +235 -0
  524. apatch-0.8.42/tests/test_workflows.py +189 -0
  525. apatch-0.8.42/tests/test_workspace_cli.py +48 -0
  526. apatch-0.8.42/tests/test_workspace_identity.py +176 -0
  527. apatch-0.8.42/tests/test_workspace_launcher.py +123 -0
  528. apatch-0.8.42/tests/test_workspace_registry.py +97 -0
  529. apatch-0.8.42/tests/test_worktree_lane.py +42 -0
  530. apatch-0.8.42/tests/test_writer_protocol_preflight.py +106 -0
apatch-0.8.42/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ed Cherednik
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
apatch-0.8.42/PKG-INFO ADDED
@@ -0,0 +1,432 @@
1
+ Metadata-Version: 2.4
2
+ Name: apatch
3
+ Version: 0.8.42
4
+ Summary: Agent Patch & Trace Analyzer (apatch) - AST-Fuzzy matching & interactive agent patch reviewer
5
+ Author: Ed Cherednik
6
+ License-Expression: MIT
7
+ Keywords: ast,tree-sitter,patch,diff,llm,agent,refactor
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3.10
10
+ Classifier: Programming Language :: Python :: 3.11
11
+ Classifier: Programming Language :: Python :: 3.12
12
+ Classifier: Programming Language :: Python :: 3.13
13
+ Classifier: Programming Language :: Python :: 3.14
14
+ Classifier: Operating System :: MacOS
15
+ Classifier: Operating System :: POSIX :: Linux
16
+ Requires-Python: >=3.10
17
+ Description-Content-Type: text/markdown
18
+ License-File: LICENSE
19
+ Requires-Dist: click>=8.0.0
20
+ Requires-Dist: rich>=13.0.0
21
+ Requires-Dist: tree-sitter>=0.21.0
22
+ Requires-Dist: tree-sitter-cpp>=0.21.0
23
+ Requires-Dist: tree-sitter-python>=0.21.0
24
+ Requires-Dist: tree-sitter-javascript>=0.21.0
25
+ Requires-Dist: tree-sitter-typescript>=0.21.0
26
+ Requires-Dist: tree-sitter-rust>=0.21.0
27
+ Requires-Dist: tree-sitter-go>=0.21.0
28
+ Provides-Extra: trustchain
29
+ Requires-Dist: trustchain; extra == "trustchain"
30
+ Provides-Extra: yaml
31
+ Requires-Dist: pyyaml>=6.0; extra == "yaml"
32
+ Provides-Extra: languages
33
+ Requires-Dist: tree-sitter-java>=0.21.0; extra == "languages"
34
+ Requires-Dist: tree-sitter-c-sharp>=0.21.0; extra == "languages"
35
+ Requires-Dist: tree-sitter-ruby>=0.21.0; extra == "languages"
36
+ Requires-Dist: tree-sitter-php>=0.22.0; extra == "languages"
37
+ Provides-Extra: dev
38
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
39
+ Requires-Dist: pytest-asyncio; extra == "dev"
40
+ Requires-Dist: build>=1.2.0; extra == "dev"
41
+ Requires-Dist: wheel>=0.43; extra == "dev"
42
+ Requires-Dist: tomli>=2.0; python_version < "3.11" and extra == "dev"
43
+ Provides-Extra: platform
44
+ Requires-Dist: httpx>=0.27.0; extra == "platform"
45
+ Requires-Dist: cryptography>=42.0.0; extra == "platform"
46
+ Provides-Extra: mcp
47
+ Requires-Dist: mcp<2.0.0,>=1.0.0; extra == "mcp"
48
+ Dynamic: license-file
49
+
50
+ # apatch — Agent Patch & Trace Analyzer 🚀🛡️
51
+
52
+ ИИ-агент сломал файл на 7-м шаге из 10? `apatch` применит ровно нужные шаги из лога — даже если файл с тех пор изменился.
53
+
54
+ `apatch` — это специализированный инструмент для надежного применения правок кода и документации ИИ-агентов (Cursor, Claude Code, Antigravity, Gemini), безопасного декомпозирования монолитов и ведения транзакционных баз знаний без context drift.
55
+
56
+ ---
57
+
58
+ ## Что это решает? (Проблема Context Drift)
59
+
60
+ Представьте классическую ситуацию: вы работаете с ИИ-агентом. Он предлагает вам изменение в файле кода или документации. Но пока вы обсуждали детали или запускали тесты, в файл были внесены косметические изменения, добавлены комментарии, изменены отступы или перефразированы абзацы. Контекст «уплыл» (**context drift**).
61
+
62
+ Обычный инструмент замены (`str_replace` или `git apply`) выбросит ошибку `«Строка не найдена»`.
63
+
64
+ `apatch` решает эту проблему с помощью **многоуровневых алгоритмов сопоставления и стабильного непозиционного анкерования (Semantic ID Anchoring)**, позволяя хирургически применять изменения даже в уплывший контекст исходного кода и документации.
65
+
66
+ ---
67
+
68
+ ## Главные фичи «из коробки»
69
+
70
+ ### 💻 Для кода
71
+ * **Транзакционный Matcher кода:**
72
+ * **Level 1 (Exact):** Буквальное посимвольное совпадение.
73
+ * **Level 2 (Whitespace-Fuzzy):** Нечувствительный к пробелам, табам и пустым строкам поиск.
74
+ * **Level 3 (AST-Fuzzy):** Синтаксическое сопоставление через грамматики **tree-sitter**. Находит узел по имени (метод класса в C++ или Python), при нескольких одноимённых узлах **дизамбигуирует** по охватывающему классу и схожести тела, и **заменяет только тело функции**, сохраняя сигнатуру родительского файла нетронутой. Если предложенная правка меняла сигнатуру — выводится предупреждение (тело-only замена). Из коробки: C++, Python, JavaScript, TypeScript, Rust, Go; опционально (extra `languages`): Java, C#, Ruby, PHP, Kotlin, Swift.
75
+ * **Умная декомпозиция и дедупликация (`apatch strip`):**
76
+ * Вырезает логические блоки кода во внешние файлы с авторазрешением коллизий имен.
77
+ * Генерирует отчет связей `extraction_report.json`.
78
+ * **Автоматически минимизирует зависимости:** оставляет в `parent_imports` только те заголовки/импорты, которые реально используются в вырезанном коде, и очищает `accessed_external_members` от шума STL-контейнеров (типа `size()`, `empty()`).
79
+
80
+ ### 📝 Для документов (Markdown)
81
+ * **Непозиционный Matcher Документов:**
82
+ * **Semantic ID Anchor:** Автоматически находит стабильный тег якоря `<!-- @sid:claim_N -->` и полностью заменяет ассоциированный с ним логический блок, делая правки абсолютно устойчивыми к перефразированию, расширению или перемещению текста внутри файла.
83
+ * **Jaccard Similarity Fallback:** Нечеткое сопоставление абзацев на основе пересечения слов (коэффициент Жаккара) при отсутствии маркерных тегов разметки.
84
+ * **Авторазметка и компиляция (`apatch compile`):** Автоматическая генерация стабильных семантических якорей и построение локальных графов знаний `knowledge_map.json` без внешних SaaS-зависимостей.
85
+
86
+ ### 🛡️ Для всего (Общие механизмы)
87
+ * **Парсинг логов ИИ-агентов (Ingestor):** Автоматически выгружает кандидатов на правки из сырых `.jsonl` логов Cursor, Anthropic, Antigravity и стандартного Gemini API; распознаёт вложенные **unified-diff** и envelope **`apply_patch` (V4A)** в полях `diff` / `input` / `patch`.
88
+ * **Обнаружение транскриптов (`apatch scan`):** Ищет свежие `.jsonl` в `~/.cursor`, `~/.claude`, `~/.gemini` и текущей папке — не нужно вручную копировать путь из IDE.
89
+ * **Сухой прогон (`apatch plan`):** Показывает, как каждая правка ляжет на диск (путь, стратегия, **confidence**, предупреждения) без записи файлов.
90
+ * **Умные пути (`apatch.resolver`):** Общий модуль `resolve_smart_path` — каскад из 4 уровней (exact → relative → strip prefix → recursive basename) с защитой от path traversal; одинаковая логика для `scan`, `plan` и `apply`. Session-scoped **`PathIndex`** (git ls-files или один pruned walk) ускоряет batch `plan`/`apply` на больших деревьях — см. [ADR-001](./docs/adr/ADR-001_Enterprise_Scale_Gaps.md). Опционально: `APATCH_PATH_BACKEND=fd|watchman|git|walk`.
91
+ * **Enterprise scale:** `APATCH_AST_WINDOW_BYTES` / `APATCH_AST_FULL_PARSE_MAX` — windowed AST на больших файлах; `apatch plan --json --workers N` — параллельный dry-run.
92
+ * **Транзакции шагов (Step-Level Transactions):** Полная атомарность многофайловых шагов рефакторинга. Перед началом шага бэкапятся все файлы. В случае падения сборки или тестов выполняется **автоматический откат всего шага**.
93
+ * **Интеграция с крипто-реестром TrustChain:** Автоматическая фиксация каждого успешного шага в неизменяемом журнале.
94
+ * **Символьная привязка аттестаций (RFP-032):** дрейф требования считается по границам символов (функции/классы, tree-sitter), а не по хэшу всего файла — правка одной функции не роняет требования, завязанные на другие символы того же файла (`apatch/symbol_anchor.py`). Слепое пятно — кросс-файловые ссылки — закрывает RFP-033 (ниже).
95
+ * **Непрерывный конформанс (RFP-035):** стоячий contract-gate — `apatch conformance gate` классифицирует **весь** контракт разом (`conformant / drifted / stale / unproven`) и ловит спеки, аттестованные однажды и тихо протухшие. Блокирует только на **живом красном verify** (`drifted`), не на несвежей подписи (`stale`) — без ложных тревог. Opt-in (`.apatch/conformance.json`), scoped-прогоны (`--spec SPEC-X`), статический enrollment без рекурсии (`--no-live`), baseline-aware, ledger-free блокировка в CI (`--ci-safe`); что блокировать — выбор проекта. Доменный ярлык вроде `conformance: true` и само наличие SPEC не являются enrollment или доказательством: registration, live bucket и evidence qualification отчётно разделяются. См. [docs/conformance.md](./docs/conformance.md).
96
+ * **Дифференциальный probe — `apatch probe` (RFP-005):** один примитив «возмути → пере-измерь → суди дельту против полярности», под который сведены три проверки качества гейта. `probe falsify` портит файлы, что охраняет требование, — verify **обязан** покраснеть (иначе это **ложный гейт**, не тестирующий охраняемое); `probe regress` — ни одного нового падения против записанного корпуса (baseline-aware); `probe ratify` — аттестованный гейт **всё ещё** зелёный (красный сейчас = протухшая аттестация). Универсально (`--verify` — любая shell-команда). См. [docs/probe.md](./docs/probe.md).
97
+ * **Реестр реальности — `apatch reality` (RFP-005):** инверсия источника истины — append-only леждер наблюдаемых фактов, которые проект обязан закрыть (`.apatch/reality.jsonl`); требования спеки их **дискорджат** (`## Rk … (discharges: REC-…)`). `apatch reality status` считает покрытие как «наблюдаемая реальность, закрытая зелёным гейтом», а `uncovered` — выводимый долг, не ручной ярлык. См. [docs/reality.md](./docs/reality.md).
98
+ * **Скаффолд спеки из контракта — `apatch spec scaffold --from-contract` (RFP-023):** authoring-инверсия проверки покрытия — из `## Acceptance`-таблицы RFP генерит скелет SPEC.md (по требованию на строку + traceability-гейт), **contract-complete by construction** (0 gaps). Заполняешь `(verify:)`, а не пишешь чеклист руками. Также MCP `apatch_spec_scaffold`.
99
+ * **Кросс-файловый refactor-impact — `apatch scip impact` (RFP-033):** при рефакторинге символа показывает, какие **аттестованные** требования ссылаются на него из других файлов — слепое пятно символьных якорей. Граф ссылок строится **нативно из Python AST, без внешних зависимостей** (`.scip`-индекс точнее, если есть). Advisory — никогда не блок и не stale. Также MCP `apatch_scip`.
100
+ * **Transparency anchor — governance, проверяемый в CI (A35-E):** локальный ledger доказывает governance только на машине, где он шёл; CI его не видит. Каждая governed-операция анкорится во **внешний append-only лог** (`trust-chain.ai`), op_id попадает в runtime `.apatch/inclusion.jsonl`, а проверенный subset публикуется в source-controlled `manifests/apatch-inclusion.jsonl`. CI-job `transparency-anchor` проверяет этот manifest против публичного Merkle-корня — без приватных зависимостей. Это первый гейт, который реально доказывает governance в CI (а не «обещает»). Сертификат агента авто-продлевается. См. [docs/transparency-anchor.md](./docs/transparency-anchor.md).
101
+ * **Нормализация кодировок и переносов строк:** Автоматическое определение переносов строк (CRLF vs LF) и автодетект кодировок (UTF-8, CP1251, CP1252) при дисковых операциях с сохранением оригинальных параметров файлов.
102
+
103
+ ---
104
+
105
+ ## 🛡️ Что такое TrustChain и как это работает?
106
+
107
+ **TrustChain** — это локальный криптографический фреймворк сквозного аудита разработки (разработка *Ed Cherednik*).
108
+
109
+ > [!IMPORTANT]
110
+ > **TrustChain — это НЕ блокчейн.** У него нет распределенного консенсуса, майнеров, токенов или сети. Это локальный **подписанный хэш-чейн реестр (ledger)**, гарантирующий целостность и неизменяемость истории операций с помощью криптографии Ed25519.
111
+
112
+ ### Встроенный bootstrap без внешних зависимостей (Zero-Dependency)
113
+ Для работы криптографического аудита в `apatch` **вам не требуется отдельно устанавливать TrustChain**.
114
+ `apatch` имеет встроенный Python-модуль резервного копирования и генерации структуры хэш-чейна:
115
+ * Если в вашей системе **нет утилиты `tc`**, `apatch` автоматически инициализирует криптографический реестр во временных файлах структуры `.trustchain/` (папки `objects/`, `refs/`, `HEAD`, `config.json`), подписывая транзакции штатными средствами Python.
116
+ * Если **CLI `tc` установлен в вашей системе**, `apatch` автоматически интегрируется с ним, вызывая глобальные команды `tc checkpoint` и `tc commit`.
117
+
118
+ ### Автоинициализация
119
+ Вам не нужно вручную инициализировать аудит в каждом проекте. При первом запуске `apatch` автоматически ищет папку `.trustchain/` вверх по дереву папок. Если она не найдена — утилита **сама выполнит `tc init`** в корне вашего репозитория.
120
+
121
+ ### Режимы: audit vs enforce
122
+
123
+ Проверка: `apatch doctor --json` → поле `trustchain.mode`:
124
+
125
+ | `mode` | Когда | Поведение |
126
+ |--------|-------|-----------|
127
+ | `audit_pending` | Нет `.trustchain/` | Ledger создастся при первом apply/strip |
128
+ | `audit` | Ledger есть, enforcement выкл | Checkpoint + commit; провал подписи **не** откатывает apply |
129
+ | `enforce` | `.apatch/enforcement.json` | Пошаговая нотаризация, rollback, `no_trustchain` запрещён |
130
+
131
+ Включить strict: `apatch init-consumer --with-enforcement`.
132
+
133
+
134
+ ---
135
+
136
+ ## Быстрый старт: executable specs (~10 мин)
137
+
138
+ Один **data layer** (`project_status_workspace`, MCP `apatch_project_status`) — три представления для разных ролей ([RFP-020](docs/RFP-020-three-views.md)):
139
+
140
+ | Роль | Вопрос | Команда |
141
+ |------|--------|---------|
142
+ | Developer | Что сломано / заблокировано? | `apatch status` · `--json` |
143
+ | Architect | Где конфликты спек? | `apatch report --html` |
144
+ | Manager | Мы в графике? | `apatch report --format md` |
145
+
146
+ ```bash
147
+ # 1. Scaffold consumer (sandbox + enforcement — для governed apply)
148
+ apatch init-consumer --target-dir . --with-sandbox --with-enforcement
149
+
150
+ # 2. Диагностика окружения
151
+ apatch doctor
152
+
153
+ # 3. Executable spec: lint → dry-run → run (inline requirements или manifest)
154
+ apatch spec lint --spec SPEC-YOUR-1
155
+ apatch spec run --spec SPEC-YOUR-1 --dry-run
156
+ # apatch spec run --spec SPEC-YOUR-1 # resume / MCP: apatch_spec_run
157
+
158
+ # 4. Три представления одного DTO
159
+ apatch status
160
+ apatch spec list
161
+ apatch report --html --out .apatch/report.html
162
+ apatch report --format md --locale ru --out -
163
+ ```
164
+
165
+ TrustChain фиксирует **кто / когда / что** attested — substrate для attribution ([RFP-020 §3](docs/RFP-020-three-views.md)).
166
+ Плейбук агента: [docs/AGENTS.template.md](./docs/AGENTS.template.md) · индекс спек: [docs/specs/README.md](./docs/specs/README.md).
167
+
168
+ ---
169
+
170
+ ## Документация
171
+
172
+ Полная навигация по ролям (пользователь / агент / разработчик): **[docs/README.md](./docs/README.md)**
173
+
174
+ | Нужно | Документ |
175
+ |-------|----------|
176
+ | Консоль — что делать (`i/l/p/a/v`) | [docs/console-guide.md](./docs/console-guide.md) |
177
+ | Руководитель / ИБ — без кода | [docs/for-leaders.md](./docs/for-leaders.md) |
178
+ | Доменная модель (Session / Invariant) | [docs/domain.md](./docs/domain.md) |
179
+ | Грамматика команд | [docs/grammar.md](./docs/grammar.md) |
180
+ | Security one-pager (enterprise) | [docs/security-one-pager.md](./docs/security-one-pager.md) |
181
+ | Рецепты CLI | [docs/cookbook.md](./docs/cookbook.md) |
182
+ | Непрерывный конформанс (contract-gate) | [docs/conformance.md](./docs/conformance.md) |
183
+ | Transparency anchor — governance проверяемый в CI (A35-E) | [docs/transparency-anchor.md](./docs/transparency-anchor.md) |
184
+ | ИИ-агент в проекте | [docs/AGENTS.template.md](./docs/AGENTS.template.md) |
185
+ | MCP (15 default / 123 full) · [CHANGELOG](CHANGELOG.md) | [docs/mcp_setup.md](./docs/mcp_setup.md) · [runtime invariants](docs/governed-runtime-invariants.md) · [RFP-020 three views](docs/RFP-020-three-views.md) · [specs index](docs/specs/README.md) |
186
+ | Локальный MCP roaming по sibling-репозиториям | [safe local workspace roaming](./docs/mcp_setup.md#safe-local-workspace-roaming) · [agent onboarding](./docs/agent-onboarding.md#0-resolve-the-workspace-contract) |
187
+ | WorkAssets / Наработки | [for engineers](./docs/work-assets-engineering-guide.md) · [for directors](./docs/work-assets-director-brief.md) · [overview](./docs/work-assets.md) · [privacy/IP](./docs/work-assets-privacy-ip.md) · [data access](./docs/work-assets-data-access.md) · [portability](./docs/work-assets-portability-policy.md) · [consent/retention](./docs/work-assets-consent-retention.md) |
188
+ | TrustChain collaborative work | [onboarding and operations](./docs/governed-work-trustchain.md) · [RFP-043](./docs/RFP-043-trustchain-governed-work-bindings.md) · [executable SPEC](./docs/specs/SPEC-GOVERNED-WORK-BINDINGS-1.md) |
189
+ | Write sandbox | [docs/sandbox.md](./docs/sandbox.md) |
190
+ | Оркестрация (arch, db, pipeline) | [docs/orchestration.md](./docs/orchestration.md) |
191
+ | Strip / декомпозиция | [docs/strip_guide.md](./docs/strip_guide.md) |
192
+ | Профили стека | [docs/profiles/](./docs/profiles/) |
193
+
194
+ ---
195
+
196
+ ## Установка
197
+
198
+ ### Системные требования
199
+ - **Python:** 3.9–3.13 рекомендуется; 3.14 поддерживается, но при установленном пакете `trustchain` + `langchain-core` возможны предупреждения от LangChain (Pydantic v1). apatch их подавляет; долгосрочно — lazy-import в `trustchain.integrations`.
200
+ - **ОС:** macOS или Linux.
201
+
202
+ ### Установка в виртуальном окружении:
203
+ ```bash
204
+ # Создать и активировать окружение
205
+ python3 -m venv .venv
206
+ source .venv/bin/activate
207
+
208
+ # Базовая установка (C++, Python, JS/TS, Rust, Go — в core)
209
+ pip install -e .
210
+
211
+ # Опциональные extras (по необходимости)
212
+ pip install -e ".[dev]" # pytest для разработки
213
+ pip install -e ".[yaml]" # YAML-манифесты для strip/phase
214
+ pip install -e ".[languages]" # Java, C#, Ruby, PHP — AST-fuzzy (ленивая загрузка)
215
+ pip install -e ".[trustchain]" # полный CLI tc (без него apatch всё равно bootstrap'ит .trustchain/)
216
+ ```
217
+
218
+ | Extra | Назначение |
219
+ | :--- | :--- |
220
+ | *(core)* | `click`, `rich`, tree-sitter: cpp, python, javascript, typescript, rust, go |
221
+ | `dev` | `pytest`, `pytest-asyncio` |
222
+ | `yaml` | `pyyaml` — манифесты `strip` / `phase run` и structure-aware match для `*.yaml` mappings |
223
+ | `languages` | `tree-sitter-java`, `tree-sitter-c-sharp`, `tree-sitter-ruby`, `tree-sitter-php` |
224
+ | `trustchain` | пакет `trustchain` + CLI `tc` (опционально; встроенный fallback есть) |
225
+
226
+ ## Replay транскриптов IDE
227
+
228
+ > **Вторичный путь** — когда нет governed SPEC. Для продуктового workflow начните с [быстрого старта executable specs](#быстрый-старт-executable-specs-10-м) выше.
229
+
230
+ ### Типовой workflow (scan → plan → apply)
231
+ #### 1. Найти транскрипты агентов на машине
232
+ ```bash
233
+ apatch scan # авто-поиск .jsonl: Cursor / Claude / Gemini / текущая папка
234
+ apatch scan --path ./logs --json --no-count # быстрее: без подсчёта кандидатов
235
+ ```
236
+ *Печатает таблицу свежих логов (mtime, источник, путь, число кандидатов). `--limit N`, `--no-cwd`, `--path` — доп. каталоги.*
237
+
238
+ #### 2. Просмотр кандидатов из лога
239
+ ```bash
240
+ apatch view --logs transcript.jsonl
241
+ apatch view --logs transcript.jsonl --json --tool StrReplace
242
+ ```
243
+ *Список шагов: файл, действие, размеры old/new. Фильтры: `--tool`, `--filter`, `--steps`, `--range`.*
244
+
245
+ #### 3. Сухой прогон: как лягут правки (без записи)
246
+ ```bash
247
+ apatch plan --logs transcript.jsonl --target-dir . --diff
248
+ apatch plan --logs transcript.jsonl --target-dir . --json
249
+ ```
250
+ *Для каждого кандидата: `resolved_path`, `strategy`, `confidence` (0..1), `would_apply`, `warnings`, опционально `diff`. Те же фильтры, что у `view`/`apply`. Для Elastic/OpenSearch mappings при drift по whitespace или порядку ключей `strategy` будет `json-semantic` (JSON и YAML).*
251
+
252
+ #### 4. Интерактивное применение правок (TUI с diff-просмотром)
253
+ ```bash
254
+ apatch apply --logs transcript.jsonl --target-dir .
255
+ ```
256
+ В процессе применения:
257
+ * `[A] Apply` — применить правку (в TUI видны strategy, confidence и предупреждения AST-fuzzy).
258
+ * `[S] Skip` — пропустить шаг.
259
+ * `[E] Edit` — открыть фрагмент в `$EDITOR`, скорректировать и применить.
260
+
261
+ #### 5. Programmatic batch refactoring (JSONL как вход)
262
+
263
+ `apatch apply` принимает **любой** JSONL с полями `TargetContent` / `ReplacementContent` — не только транскрипты Cursor/Claude. Это полноценный **транзакционный batch-движок** для программируемых рефакторингов.
264
+
265
+ ```bash
266
+ # Сгенерировать JSONL (скриптом или вручную)
267
+ python3 -c '
268
+ import json
269
+ p = {"step_index": 1, "tool_calls": [{"name": "replace_file_content", "arguments": {
270
+ "TargetFile": "app/models.py",
271
+ "TargetContent": "old_pattern",
272
+ "ReplacementContent": "new_pattern",
273
+ "AllowMultiple": True
274
+ }}]}
275
+ print(json.dumps(p))
276
+ ' > patches.jsonl
277
+
278
+ apatch plan --logs patches.jsonl --target-dir . --diff
279
+ apatch apply --logs patches.jsonl --target-dir . --all -y \
280
+ --verify "pytest" --verify-deferred --report report.json
281
+ ```
282
+
283
+ - `AllowMultiple: true` в JSONL **или** CLI `--all` — замена каждого вхождения (token-rename / pattern replace).
284
+ - Альтернатива (replace по glob): `apatch generate --find ... --replace ... --glob '**/*.py' --out patches.jsonl`
285
+ - **Новые файлы + правки + права файла:** `apatch generate-batch --needles needles.json --out patches.jsonl` — `action`: `create` | `replace` | `delete` | `rename` | `chmod` ([cookbook](./docs/cookbook.md))
286
+
287
+ Готовые рецепты: **[docs/cookbook.md](./docs/cookbook.md)**.
288
+
289
+ #### 5b. Оркестрация изменений (архитектура, БД, impact)
290
+
291
+ ```bash
292
+ apatch impact UserModel --json # что затронет правка
293
+ apatch arch check --json # manifests/arch-rules.yaml
294
+ apatch db check --profile sqlalchemy --json # модели без миграции?
295
+ apatch db revision --profile sqlalchemy -m "msg" --dry-run
296
+ apatch db safety --profile sqlalchemy --json
297
+ apatch db run --manifest manifests/db-refactor.json --dry-run
298
+
299
+ apatch apply --logs patches.jsonl -y --budget medium # лимит объёма правок (R49)
300
+ apatch refactor run --manifest manifests/refactor-bundle.example.json --dry-run
301
+ apatch verify semantic --json # routes/OpenAPI не исчезли
302
+ apatch pipeline run --manifest manifests/engineering-pipeline.example.json --dry-run
303
+ apatch index build && apatch index query UserModel
304
+ apatch trustchain history --query ADR-000
305
+ apatch init-consumer --with-arch-rules # arch rules + pipeline template in manifests/
306
+ ```
307
+
308
+ Оркестрация: **[docs/orchestration.md](./docs/orchestration.md)**.
309
+
310
+ #### 6. Автопилот с верификацией сборки/тестов
311
+ ```bash
312
+ apatch apply --logs transcript.jsonl --target-dir . --yes --verify "pytest"
313
+
314
+ # Безопасный batch: применять только дрейфанувшие правки и только при высокой уверенности,
315
+ # с машинно-читаемым отчётом сессии
316
+ apatch apply --logs transcript.jsonl --target-dir . --yes \
317
+ --only-drifted --min-confidence 0.85 --report apatch_report.json
318
+ ```
319
+ *Если на каком-то шаге тесты упадут, `apatch` мгновенно выполнит атомарный откат этого шага. `--only-drifted` пропускает точные совпадения (там помощь не нужна), `--min-confidence` не даёт автопилоту молча применять низкоуверенные fuzzy-совпадения, а `--report` пишет JSON с тем, что и какой стратегией применилось.*
320
+
321
+ > [!WARNING]
322
+ > `--verify` и `--post-hook` выполняют переданную строку через **системный shell** (`shell=True`), а `[E] Edit` запускает `$EDITOR`. Запускайте только доверенные команды.
323
+ >
324
+ > **Verify gotchas:** сложный inline Python с кавычками или glob `**` часто ломается из-за shell-escaping — verify падает, apatch откатывает шаг, хотя патчи были корректны. Предпочитайте отдельный скрипт: `--verify "npm run build"`, `--verify "./scripts/check.sh"`, `--verify "pytest"`. При падении verify apatch печатает полный stdout/stderr.
325
+
326
+ #### 7. Восстановление исходного состояния
327
+ ```bash
328
+ apatch rollback --target-dir .
329
+ ```
330
+ Откатывает **файлы на диске** из `.apatch/backups/` и (если активен TrustChain) сбрасывает `HEAD` к checkpoint последней strip/apply-сессии.
331
+
332
+ #### 8. Разметка документации (`compile`)
333
+ ```bash
334
+ apatch compile doc.md --out-dir ./extracted
335
+ ```
336
+ *Разбивает Markdown на логические блоки, инжектирует `<!-- @sid:claim_N -->`, генерирует `knowledge_map.json`.*
337
+
338
+ #### 9. Декомпозиция монолита (`strip` / `phase run`)
339
+ ```bash
340
+ # Пакетное вырезание + конвертация в native_eval_*.cpp
341
+ apatch phase run \
342
+ --manifest manifests/eval_visitor_strips_phase12.json \
343
+ --file src/frontend/interpreter/eval_visitor.cpp \
344
+ --native-out-dir src/frontend/interpreter \
345
+ --out-dir extracted \
346
+ --verify "cmake --build build --target olang_interpreter_core"
347
+
348
+ # STRICT: при blockers конвертера — exit 1 + откат исходника и артефактов
349
+ apatch strip --file eval_visitor.cpp --manifest manifests/phase.json \
350
+ --native-out-dir interpreter/ --out-dir extracted --to-native auto --strict
351
+ ```
352
+ Checkpoint apatch = **тот же** `apatch_strip_<timestamp>` в `.apatch/backups/` + TrustChain ref + подпись SHA-256 файлов в ledger. Откат checkpoint всегда восстанавливает диск и HEAD.
353
+
354
+ > [!NOTE]
355
+ > Само вырезание блоков (`strip`) и генерация отчётов — общего назначения. А конвертер `--to-native` (модуль `apatch.native_converter`) **специфичен для рантайма O-Lang / Ed Organism** (он генерирует `register_native(...)` под `Interpreter::Value` и т.п.). Для других C++ кодовых баз используйте `strip` для извлечения, а интеграцию пишите под свой проект.
356
+
357
+ Подробнее: [docs/strip_guide.md](./docs/strip_guide.md).
358
+
359
+ ### Машинный вывод (`--json`) для агентов и CI
360
+
361
+ | Команда | Формат |
362
+ | :--- | :--- |
363
+ | `scan --json` | `[{path, source, mtime, modified, size, candidate_count}, ...]` |
364
+ | `view --json` | `[{step_index, tool_name, target_file, action_type, source_format, old_len, new_len, replace_all}, ...]` |
365
+ | `plan --json` | `[{step_index, resolved_path, strategy, confidence, would_apply, warnings, diff}, ...]` |
366
+ | `apply --report FILE` | `{target_dir, dry_run, checkpoint, applied, skipped, entries:[{outcome, strategy, confidence, warnings, ...}]}` |
367
+
368
+ **Шкала confidence:** `exact`/`create`/`delete` → `1.0`; `whitespace-fuzzy` → `0.85`; `semantic-sid` → `0.95`; `document-fuzzy` → `0.7`; `ast-fuzzy` → схожесть тел (или fallback `0.6`–`0.8`); `failed` → `0.0`.
369
+
370
+ Типовая цепочка для автономного агента:
371
+ ```bash
372
+ apatch scan --json --limit 5 | jq '.[0].path' -r # взять свежий лог
373
+ apatch plan --logs "$(…)" --target-dir . --json # оценить риск
374
+ apatch apply --logs "$(…)" --target-dir . --yes \
375
+ --only-drifted --min-confidence 0.85 --report /tmp/apatch_report.json
376
+ ```
377
+
378
+ ---
379
+
380
+ ## Лицензия
381
+
382
+ **APatch Studio** — один продукт с двумя планируемыми редакциями:
383
+ **APatch Studio OSS** и **APatch Studio Pro**. Сейчас ни одна из них публично не
384
+ выпущена: текущий репозиторий и runtime 0.8.36 остаются private/unreleased.
385
+
386
+ [LICENSE](./LICENSE) и package metadata фиксируют выбранные MIT-условия для
387
+ будущего публичного артефакта APatch Studio OSS, но сами по себе не являются
388
+ публикацией. APatch Studio Pro будет распространяться на коммерческих условиях;
389
+ Pro-only services, managed infrastructure and separately identified assets не
390
+ получают MIT-лицензию автоматически.
391
+
392
+ Personal / Workspace extensions сохраняют выбранные их авторами условия из
393
+ manifest; использование стабильного out-of-process контракта не передаёт APatch
394
+ право собственности, публикации или обучения на их коде и данных. Core, MCP,
395
+ CLI, Companion и remote broker являются компонентами APatch Studio, а не
396
+ отдельными продуктами. Каноническая граница редакций зафиксирована в
397
+ [product matrix](./docs/product-matrix.md).
398
+
399
+ При будущем публичном релизе MIT будет относиться только к first-party software,
400
+ явно включённому в release artifact APatch Studio OSS. Отдельно обозначенные
401
+ внешние материалы, включая `docs/ct_ckba_036_2017`, не входят в Python
402
+ wheel/sdist и не получают MIT-лицензию автоматически; их происхождение и право
403
+ распространения должны быть оформлены до включения в публичный release artifact.
404
+
405
+ ---
406
+
407
+ ## Тесты
408
+
409
+ Проект содержит **299+ интеграционных тестов**, написанных без использования моков — все проверки работают с реальным синтаксическим деревом tree-sitter, файловой системой, Markdown CST-парсерами и живыми криптографическими цепочками.
410
+
411
+ ```bash
412
+ pip install -e ".[dev]"
413
+ python -m pytest tests/
414
+ ```
415
+
416
+ | Тестовый модуль | Что проверяет |
417
+ | :--- | :--- |
418
+ | `test_discovery.py` | `scan`: поиск `.jsonl`, подсчёт кандидатов, `--json`, изолированный `HOME` (без сканирования реального `~/.cursor`). |
419
+ | `test_plan.py` | `plan --json`: exact/fail, `would_apply`, отсутствие записи на диск. |
420
+ | `test_filters.py` | `--only-drifted`, `--min-confidence`, `--report` через TUI batch-режим. |
421
+ | `test_ingestor.py` | Парсинг логов Cursor/Gemini/Anthropic, **unified-diff** и **apply_patch (V4A)** envelope. |
422
+ | `test_features.py` | Пошаговые транзакции, автодетект CP1251 и CRLF, `--verify` / `--verify-deferred`, `CREATE`/`DELETE`. |
423
+ | `test_matcher.py` | Exact / whitespace-fuzzy / AST-fuzzy, дизамбигуация overload, `MatchResult.evaluate`, предупреждение о смене сигнатуры, Java (если установлен `languages`). |
424
+ | `test_semantic.py` | Markdown SID-якоря, `semantic-sid`, Jaccard `document-fuzzy`, `compile` CLI. |
425
+ | `test_strip.py` | Вырезание блоков, `parent_imports`, `extraction_report.json`, манифесты, native-конвертер. |
426
+ | `test_strip_rollback.py` | Транзакционный откат strip + TrustChain HEAD. |
427
+ | `test_trustchain.py` | Чекпоинты, signed коммиты, автоинициализация `.trustchain/`. |
428
+ | `test_tui.py` | TUI, ручное редактирование, path traversal. |
429
+
430
+ ---
431
+
432
+ *Разработано Ed Cherednik, 2026.*