principles 0.1.3 → 0.1.5

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 (312) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +151 -1
  3. data/README.md +10 -6
  4. data/exe/principles +1 -1
  5. data/lib/principles/cli.rb +9 -10
  6. data/lib/principles/command_line.rb +15 -6
  7. data/lib/principles/command_routes.rb +18 -2
  8. data/lib/principles/controllers/acknowledgement.rb +19 -4
  9. data/lib/principles/controllers/acknowledgements.rb +43 -12
  10. data/lib/principles/controllers/after_commit_report.rb +15 -2
  11. data/lib/principles/controllers/assessment.rb +7 -3
  12. data/lib/principles/controllers/audit.rb +17 -8
  13. data/lib/principles/controllers/audit_completion.rb +34 -9
  14. data/lib/principles/controllers/carrier_edit_report.rb +40 -0
  15. data/lib/principles/controllers/carrier_practices.rb +26 -0
  16. data/lib/principles/controllers/command.rb +36 -5
  17. data/lib/principles/controllers/context_budget.rb +61 -0
  18. data/lib/principles/controllers/correction.rb +15 -5
  19. data/lib/principles/controllers/full_audit_request.rb +38 -42
  20. data/lib/principles/controllers/inventory.rb +78 -71
  21. data/lib/principles/controllers/last_record_notice_beside.rb +51 -0
  22. data/lib/principles/controllers/member_addition.rb +20 -5
  23. data/lib/principles/controllers/member_entries.rb +50 -39
  24. data/lib/principles/controllers/member_entry_changes.rb +71 -0
  25. data/lib/principles/controllers/member_problems_report.rb +26 -6
  26. data/lib/principles/controllers/members_a_commit_changed.rb +14 -5
  27. data/lib/principles/controllers/members_in_logged_requests.rb +52 -0
  28. data/lib/principles/controllers/members_to_assess.rb +35 -8
  29. data/lib/principles/controllers/meta_principle_setup.rb +12 -4
  30. data/lib/principles/controllers/open_correction.rb +3 -2
  31. data/lib/principles/controllers/parts_to_read.rb +48 -6
  32. data/lib/principles/controllers/plugin_member_addition.rb +48 -0
  33. data/lib/principles/controllers/principle_listing.rb +84 -0
  34. data/lib/principles/controllers/request_logging.rb +65 -0
  35. data/lib/principles/controllers/running_tool.rb +55 -15
  36. data/lib/principles/controllers/session_start_report.rb +26 -2
  37. data/lib/principles/data/branches_bringing_in.rb +52 -0
  38. data/lib/principles/data/captured_requests.rb +118 -0
  39. data/lib/principles/data/carrier_page_markers.rb +38 -0
  40. data/lib/principles/data/changes_since.rb +56 -0
  41. data/lib/principles/data/claude_code_home.rb +75 -0
  42. data/lib/principles/data/command-steps.json +139 -23
  43. data/lib/principles/data/decoded_leaf.rb +63 -0
  44. data/lib/principles/data/head_reflog.rb +13 -2
  45. data/lib/principles/data/kept_line.rb +39 -0
  46. data/lib/principles/data/known_marketplaces.rb +50 -0
  47. data/lib/principles/data/logged_request_matches.rb +144 -0
  48. data/lib/principles/data/logged_request_scan.rb +188 -0
  49. data/lib/principles/data/map_files.rb +18 -4
  50. data/lib/principles/data/plugin_folder.rb +85 -0
  51. data/lib/principles/data/plugin_registry.rb +73 -0
  52. data/lib/principles/data/principles_store.rb +49 -0
  53. data/lib/principles/data/project_files.rb +15 -0
  54. data/lib/principles/data/ran.rb +25 -0
  55. data/lib/principles/data/raw_request_filter.rb +61 -0
  56. data/lib/principles/data/repository.rb +29 -27
  57. data/lib/principles/data/request_logging_folder.rb +135 -0
  58. data/lib/principles/data/request_shape.rb +33 -0
  59. data/lib/principles/data/running_version.rb +1 -1
  60. data/lib/principles/data/schemas/acknowledgement-answer.schema.json +16 -1
  61. data/lib/principles/data/schemas/acknowledgements-answer.schema.json +16 -1
  62. data/lib/principles/data/schemas/assessment-answer.schema.json +8 -0
  63. data/lib/principles/data/schemas/command-steps.schema.json +1 -1
  64. data/lib/principles/data/schemas/correction-answer-guide.schema.json +2 -1
  65. data/lib/principles/data/schemas/correction-answer.schema.json +14 -0
  66. data/lib/principles/data/schemas/member-map.schema.json +12 -1
  67. data/lib/principles/data/settings_env_keys.rb +26 -0
  68. data/lib/principles/data/string_counts.rb +39 -0
  69. data/lib/principles/data/tools_on_path.rb +25 -0
  70. data/lib/principles/data/user_request_logging_folder.rb +73 -0
  71. data/lib/principles/invocation_options.rb +5 -3
  72. data/lib/principles/launch.rb +29 -10
  73. data/lib/principles/models/acknowledged_check.rb +11 -1
  74. data/lib/principles/models/acknowledgement.rb +5 -0
  75. data/lib/principles/models/acknowledgement_refusal.rb +20 -11
  76. data/lib/principles/models/acknowledgements_to_offer.rb +86 -0
  77. data/lib/principles/models/after_commit_input.rb +5 -0
  78. data/lib/principles/models/answer_fields.rb +3 -0
  79. data/lib/principles/models/assessment_basis.rb +10 -3
  80. data/lib/principles/models/audit.rb +10 -10
  81. data/lib/principles/models/audit_record.rb +10 -0
  82. data/lib/principles/models/audit_records.rb +4 -3
  83. data/lib/principles/models/audit_start.rb +9 -0
  84. data/lib/principles/models/authored_locator.rb +33 -0
  85. data/lib/principles/models/candidate_files.rb +23 -3
  86. data/lib/principles/models/candidate_outline.rb +18 -125
  87. data/lib/principles/models/captured_sessions.rb +166 -0
  88. data/lib/principles/models/carrier_edit_input.rb +56 -0
  89. data/lib/principles/models/carrier_kind.rb +79 -0
  90. data/lib/principles/models/carrier_pages_shown.rb +28 -0
  91. data/lib/principles/models/carved_message_bytes.rb +115 -0
  92. data/lib/principles/models/cited_files.rb +12 -3
  93. data/lib/principles/models/context_parts.rb +59 -0
  94. data/lib/principles/models/decided_prior_findings.rb +5 -0
  95. data/lib/principles/models/declared_map_changes.rb +22 -13
  96. data/lib/principles/models/disposition.rb +37 -6
  97. data/lib/principles/models/disposition_placeholders.rb +12 -0
  98. data/lib/principles/models/disposition_text_field.rb +4 -0
  99. data/lib/principles/models/dropped_thinking.rb +73 -0
  100. data/lib/principles/models/feature.rb +54 -0
  101. data/lib/principles/models/finding_outcomes.rb +55 -0
  102. data/lib/principles/models/findings_left_open.rb +9 -11
  103. data/lib/principles/models/head_moves.rb +27 -10
  104. data/lib/principles/models/installed_component.rb +55 -0
  105. data/lib/principles/models/installed_plugins.rb +174 -0
  106. data/lib/principles/models/kept_sessions.rb +34 -0
  107. data/lib/principles/models/locator.rb +8 -0
  108. data/lib/principles/models/logged_request_reach.rb +52 -0
  109. data/lib/principles/models/logged_request_scan_completeness.rb +43 -0
  110. data/lib/principles/models/map_format_raise.rb +28 -0
  111. data/lib/principles/models/mapped_baseline.rb +46 -0
  112. data/lib/principles/models/mapped_principles.rb +2 -1
  113. data/lib/principles/models/maps_holding_file_whole.rb +42 -0
  114. data/lib/principles/models/markdown_text.rb +143 -0
  115. data/lib/principles/models/member.rb +19 -1
  116. data/lib/principles/models/member_entry.rb +56 -0
  117. data/lib/principles/models/member_justification.rb +52 -0
  118. data/lib/principles/models/member_lines.rb +11 -0
  119. data/lib/principles/models/member_loads.rb +17 -2
  120. data/lib/principles/models/member_problems.rb +46 -42
  121. data/lib/principles/models/member_reach.rb +59 -0
  122. data/lib/principles/models/member_snapshots.rb +34 -4
  123. data/lib/principles/models/member_text_as_sent.rb +31 -0
  124. data/lib/principles/models/member_texts.rb +45 -0
  125. data/lib/principles/models/members_by_part.rb +67 -0
  126. data/lib/principles/models/members_in_logged_requests.rb +279 -0
  127. data/lib/principles/models/meta_principle.rb +4 -4
  128. data/lib/principles/models/missing_files.rb +41 -16
  129. data/lib/principles/models/nearly_matching_maps.rb +56 -0
  130. data/lib/principles/models/open_correction.rb +5 -0
  131. data/lib/principles/models/open_finding.rb +4 -3
  132. data/lib/principles/models/outline_budget.rb +10 -1
  133. data/lib/principles/models/outline_item.rb +25 -0
  134. data/lib/principles/models/outline_section.rb +15 -4
  135. data/lib/principles/models/part_named.rb +16 -2
  136. data/lib/principles/models/part_token_estimates.rb +60 -0
  137. data/lib/principles/models/plugin_component.rb +37 -0
  138. data/lib/principles/models/plugin_enabled_in_project_settings.rb +61 -0
  139. data/lib/principles/models/plugin_install.rb +33 -0
  140. data/lib/principles/models/plugin_name.rb +23 -0
  141. data/lib/principles/models/plugin_reference.rb +53 -0
  142. data/lib/principles/models/principle.rb +7 -4
  143. data/lib/principles/models/principle_members.rb +22 -0
  144. data/lib/principles/models/prior_finding_decision.rb +1 -1
  145. data/lib/principles/models/prior_finding_outcomes.rb +12 -1
  146. data/lib/principles/models/problem_report.rb +14 -25
  147. data/lib/principles/models/project.rb +51 -56
  148. data/lib/principles/models/project_harness.rb +48 -0
  149. data/lib/principles/models/project_history.rb +19 -5
  150. data/lib/principles/models/recorded_members.rb +7 -0
  151. data/lib/principles/models/report_hooks.rb +9 -4
  152. data/lib/principles/models/request_channel.rb +62 -0
  153. data/lib/principles/models/request_kind.rb +62 -0
  154. data/lib/principles/models/request_logging.rb +231 -0
  155. data/lib/principles/models/request_logging_guard.rb +84 -0
  156. data/lib/principles/models/request_time.rb +46 -0
  157. data/lib/principles/models/runs_from.rb +0 -5
  158. data/lib/principles/models/script_comments.rb +58 -0
  159. data/lib/principles/models/session_registry.rb +61 -0
  160. data/lib/principles/models/session_start_input.rb +11 -2
  161. data/lib/principles/models/session_trend.rb +36 -0
  162. data/lib/principles/models/stale_request.rb +9 -0
  163. data/lib/principles/models/turn_opening.rb +83 -0
  164. data/lib/principles/models/turn_position.rb +43 -0
  165. data/lib/principles/models/unfixed_part.rb +82 -0
  166. data/lib/principles/models/unresolved_plugin_members.rb +35 -0
  167. data/lib/principles/models/user_logged_requests.rb +90 -0
  168. data/lib/principles/models/user_settings_entries.rb +49 -0
  169. data/lib/principles/models/whole_file_member_read.rb +48 -0
  170. data/lib/principles/models/without_prose.rb +20 -0
  171. data/lib/principles/models/workflow_jobs.rb +92 -0
  172. data/lib/principles/show_members_in_logged_requests_options.rb +27 -0
  173. data/lib/principles/show_principle_options.rb +32 -0
  174. data/lib/principles/version.rb +2 -2
  175. data/lib/principles/views/acknowledged_result.rb +31 -12
  176. data/lib/principles/views/acknowledgement_result.rb +18 -13
  177. data/lib/principles/views/acknowledgement_template_alone.rb +55 -0
  178. data/lib/principles/views/acknowledgements_offered.rb +54 -0
  179. data/lib/principles/views/added_member.rb +22 -6
  180. data/lib/principles/views/answer_in_a_file.rb +15 -15
  181. data/lib/principles/views/assessed_members.rb +19 -8
  182. data/lib/principles/views/assessment_request.rb +14 -6
  183. data/lib/principles/views/audit_changes.rb +14 -8
  184. data/lib/principles/views/audit_findings.rb +34 -0
  185. data/lib/principles/views/audit_result.rb +26 -24
  186. data/lib/principles/views/candidate_files_result.rb +1 -1
  187. data/lib/principles/views/carrier_checks.rb +40 -0
  188. data/lib/principles/views/carrier_edit_denial.rb +36 -0
  189. data/lib/principles/views/carrier_practices_page.rb +49 -0
  190. data/lib/principles/views/completed_audit_findings.rb +33 -0
  191. data/lib/principles/views/completed_audit_next_step.rb +12 -4
  192. data/lib/principles/views/consecutive_sections_elsewhere.rb +4 -0
  193. data/lib/principles/views/context_budget_result.rb +99 -0
  194. data/lib/principles/views/context_parts.rb +129 -25
  195. data/lib/principles/views/correction_request.rb +32 -17
  196. data/lib/principles/views/disposition_template.rb +35 -0
  197. data/lib/principles/views/first_audit.rb +29 -15
  198. data/lib/principles/views/first_audit_line.rb +4 -5
  199. data/lib/principles/views/hook_setup_result.rb +3 -1
  200. data/lib/principles/views/invocation.rb +14 -5
  201. data/lib/principles/views/last_record_notice.rb +41 -0
  202. data/lib/principles/views/lines_shared_with_member.rb +16 -22
  203. data/lib/principles/views/logged_request_status_meanings.rb +29 -0
  204. data/lib/principles/views/logged_requests_evidence.rb +84 -0
  205. data/lib/principles/views/map_added_to.rb +14 -12
  206. data/lib/principles/views/map_format_raised.rb +28 -0
  207. data/lib/principles/views/map_result.rb +41 -18
  208. data/lib/principles/views/maps_needing_members_or_audit.rb +1 -1
  209. data/lib/principles/views/member_change_since_baseline.rb +4 -0
  210. data/lib/principles/views/member_row.rb +13 -4
  211. data/lib/principles/views/member_sets_overlap.rb +31 -0
  212. data/lib/principles/views/members_a_commit_changed.rb +42 -25
  213. data/lib/principles/views/members_changed_during_audit.rb +27 -0
  214. data/lib/principles/views/members_in_logged_requests_result.rb +123 -0
  215. data/lib/principles/views/members_too_short_to_scan.rb +45 -0
  216. data/lib/principles/views/members_with_no_baseline.rb +6 -6
  217. data/lib/principles/views/meta_principle_result.rb +52 -15
  218. data/lib/principles/views/open_findings_line.rb +31 -92
  219. data/lib/principles/views/parts_index_result.rb +9 -5
  220. data/lib/principles/views/principle_read_result.rb +52 -11
  221. data/lib/principles/views/prior_findings_result.rb +9 -1
  222. data/lib/principles/views/problem_facts.rb +5 -3
  223. data/lib/principles/views/problem_lines.rb +54 -6
  224. data/lib/principles/views/problem_result.rb +7 -15
  225. data/lib/principles/views/prompts/assess-every-member/ask-whether-a-member-seen-only-as-read-is-loaded.md +3 -0
  226. data/lib/principles/views/prompts/assess-every-member/ask-whether-each-reason-holds.md +2 -0
  227. data/lib/principles/views/prompts/assess-every-member/claim-an-earlier-first-raised-at.md +6 -6
  228. data/lib/principles/views/prompts/assess-every-member/judge-the-keeping-against-the-other-principles.md +2 -0
  229. data/lib/principles/views/prompts/assess-every-member/read-a-compact-carried-member.md +9 -8
  230. data/lib/principles/views/prompts/assess-every-member/read-a-flagged-member-s-text-whole.md +3 -0
  231. data/lib/principles/views/prompts/assess-every-member/read-a-judged-member-s-text-whole.md +3 -0
  232. data/lib/principles/views/prompts/assess-every-member/turn-on-request-logging-to-see-what-reaches-context.md +2 -0
  233. data/lib/principles/views/prompts/assess-every-member/weigh-what-reached-the-context.md +7 -0
  234. data/lib/principles/views/prompts/dispose-of-each-finding/answer-guide.json +1 -0
  235. data/lib/principles/views/prompts/dispose-of-each-finding/fix-or-record-each-finding.md +6 -1
  236. data/lib/principles/views/prompts/dispose-of-each-finding/read-the-carrier-page-before-fixing.md +1 -0
  237. data/lib/principles/views/prompts/edit-a-carrier/read-the-page-before-the-first-edit.md +2 -0
  238. data/lib/principles/views/prompts/find-a-principle-to-map/read-a-cut-section-back.md +1 -1
  239. data/lib/principles/views/prompts/follow-each-carriers-best-practices/practices-for-hook-configuration.md +41 -0
  240. data/lib/principles/views/prompts/follow-each-carriers-best-practices/practices-for-hook-scripts.md +35 -0
  241. data/lib/principles/views/prompts/follow-each-carriers-best-practices/practices-for-instruction-files.md +37 -0
  242. data/lib/principles/views/prompts/follow-each-carriers-best-practices/practices-for-other-text-an-agent-reads.md +38 -0
  243. data/lib/principles/views/prompts/follow-each-carriers-best-practices/practices-for-rule-files.md +34 -0
  244. data/lib/principles/views/prompts/follow-each-carriers-best-practices/practices-for-skills.md +35 -0
  245. data/lib/principles/views/prompts/follow-each-carriers-best-practices/practices-for-subagent-definitions.md +35 -0
  246. data/lib/principles/views/prompts/learn-what-a-command-does/add-member.md +49 -51
  247. data/lib/principles/views/prompts/learn-what-a-command-does/change-member-name.md +12 -0
  248. data/lib/principles/views/prompts/learn-what-a-command-does/change-member-reason.md +12 -0
  249. data/lib/principles/views/prompts/learn-what-a-command-does/change-member-role.md +2 -1
  250. data/lib/principles/views/prompts/learn-what-a-command-does/every-command-and-how-they-chain.md +1 -1
  251. data/lib/principles/views/prompts/learn-what-a-command-does/list-candidate-files.md +1 -1
  252. data/lib/principles/views/prompts/learn-what-a-command-does/list-member-problems.md +32 -32
  253. data/lib/principles/views/prompts/learn-what-a-command-does/list-open-findings.md +10 -11
  254. data/lib/principles/views/prompts/learn-what-a-command-does/move-member.md +7 -6
  255. data/lib/principles/views/prompts/learn-what-a-command-does/remove-logged-requests.md +22 -0
  256. data/lib/principles/views/prompts/learn-what-a-command-does/remove-member.md +2 -1
  257. data/lib/principles/views/prompts/learn-what-a-command-does/report-at-session-start.md +8 -4
  258. data/lib/principles/views/prompts/learn-what-a-command-does/report-before-carrier-edit.md +13 -0
  259. data/lib/principles/views/prompts/learn-what-a-command-does/show-audit.md +7 -0
  260. data/lib/principles/views/prompts/learn-what-a-command-does/show-candidate-outlines.md +8 -2
  261. data/lib/principles/views/prompts/learn-what-a-command-does/show-carrier-practices.md +13 -0
  262. data/lib/principles/views/prompts/learn-what-a-command-does/show-context-budget.md +69 -0
  263. data/lib/principles/views/prompts/learn-what-a-command-does/show-hook-setup.md +4 -4
  264. data/lib/principles/views/prompts/learn-what-a-command-does/show-logged-requests.md +22 -0
  265. data/lib/principles/views/prompts/learn-what-a-command-does/show-members-in-logged-requests.md +62 -0
  266. data/lib/principles/views/prompts/learn-what-a-command-does/show-meta-principle-passage.md +13 -10
  267. data/lib/principles/views/prompts/learn-what-a-command-does/show-principle.md +16 -16
  268. data/lib/principles/views/prompts/learn-what-a-command-does/start-audit.md +27 -27
  269. data/lib/principles/views/prompts/learn-what-a-command-does/submit-answer.md +17 -17
  270. data/lib/principles/views/prompts/learn-what-a-command-does/turn-off-request-logging.md +18 -0
  271. data/lib/principles/views/prompts/learn-what-a-command-does/turn-on-request-logging.md +44 -0
  272. data/lib/principles/views/prompts/read-requested-outlines/continue-the-survey.md +3 -2
  273. data/lib/principles/views/prompts/read-what-reached-the-context/explain-request-logging-to-the-user.md +11 -0
  274. data/lib/principles/views/prompts/read-what-reached-the-context/explain-user-request-logging-to-the-user.md +10 -0
  275. data/lib/principles/views/prompts/read-what-reached-the-context/see-whether-members-reach-the-agent.md +2 -0
  276. data/lib/principles/views/prompts/read-what-reached-the-context/what-a-thread-continuation-holds.md +3 -0
  277. data/lib/principles/views/prompts/read-what-reached-the-context/what-absent-means.md +2 -0
  278. data/lib/principles/views/prompts/read-what-reached-the-context/what-each-context-budget-line-says.md +4 -0
  279. data/lib/principles/views/prompts/read-what-reached-the-context/what-each-member-line-says.md +2 -0
  280. data/lib/principles/views/prompts/read-what-reached-the-context/what-not-a-carrier-means.md +2 -0
  281. data/lib/principles/views/prompts/read-what-reached-the-context/what-present-but-not-loaded-means.md +2 -0
  282. data/lib/principles/views/prompts/read-what-reached-the-context/what-present-means.md +1 -0
  283. data/lib/principles/views/prompts/read-what-reached-the-context/what-unmeasurable-means.md +2 -0
  284. data/lib/principles/views/prompts/report-after-a-commit/a-row-ending-audit-asks-to-acknowledge-or-audit-again.md +1 -0
  285. data/lib/principles/views/prompts/report-after-a-commit/a-row-ending-mapping-commit-asks-for-an-audit.md +1 -0
  286. data/lib/principles/views/prompts/report-after-a-commit/a-row-ending-pinned-asks-for-an-audit.md +1 -0
  287. data/lib/principles/views/prompts/report-after-a-commit/plugin-members-are-still-listed.md +1 -0
  288. data/lib/principles/views/prompts/report-after-a-commit/the-commits-changed-these-members-waiting-on-an-upgrade.md +2 -2
  289. data/lib/principles/views/prompts/report-after-a-commit/the-commits-changed-these-members.md +2 -2
  290. data/lib/principles/views/prompts/report-after-a-commit/this-command-shows-what-each-needs-before-the-next-commit.md +1 -0
  291. data/lib/principles/views/prompts/run-a-first-audit-in-the-background/follow-the-brief.md +1 -0
  292. data/lib/principles/views/prompts/set-principles-up/ask-to-set-principles-up-after-an-audit.md +1 -0
  293. data/lib/principles/views/prompts/set-principles-up/entry-file-passage.md +1 -1
  294. data/lib/principles/views/prompts/set-principles-up/map-the-enabling-line-at-no-edit.md +3 -0
  295. data/lib/principles/views/prompts/set-principles-up/name-the-step-each-member-lacks.md +2 -2
  296. data/lib/principles/views/prompts/set-principles-up/place-the-passage-with-the-user.md +4 -2
  297. data/lib/principles/views/prompts/set-principles-up/what-the-passage-presumes.md +1 -1
  298. data/lib/principles/views/prompts/set-principles-up/why-set-principles-up.md +1 -0
  299. data/lib/principles/views/prompts/start-a-session/act-on-the-open-findings.md +2 -1
  300. data/lib/principles/views/prompts/start-a-session/ask-to-set-principles-up.md +2 -0
  301. data/lib/principles/views/prompts/start-a-session/hand-the-first-audit-to-a-subagent.md +2 -3
  302. data/lib/principles/views/prompts/start-a-session/name-the-principles-nothing-checks.md +1 -0
  303. data/lib/principles/views/prompts/start-a-session/raise-the-open-findings-waiting-on-no-one.md +1 -0
  304. data/lib/principles/views/request_logging_result.rb +108 -0
  305. data/lib/principles/views/request_part.rb +10 -4
  306. data/lib/principles/views/request_parts.rb +9 -0
  307. data/lib/principles/views/set_up_offer_line.rb +43 -0
  308. data/lib/principles/views/whole_file_elsewhere.rb +30 -0
  309. metadata +154 -5
  310. data/lib/principles/views/prompts/report-after-a-commit/the-principles-skill-is-where-to-start.md +0 -1
  311. data/lib/principles/views/prompts/report-after-a-commit/this-command-shows-each-one.md +0 -1
  312. data/lib/principles/views/prompts/set-principles-up/keep-them-held-between-audits.md +0 -2
@@ -4,6 +4,7 @@
4
4
  require_relative "command"
5
5
  require_relative "../models/findings_left_open"
6
6
  require_relative "../models/finding_write_ups"
7
+ require_relative "../views/audit_findings"
7
8
  require_relative "../views/findings_result"
8
9
  require_relative "../views/open_findings_line"
9
10
  require_relative "acknowledgement"
@@ -24,7 +25,7 @@ module Principles
24
25
 
25
26
  naming_the_executable do
26
27
  case command
27
- when "show-audit" then shown_audit(required_id(id))
28
+ when "show-audit" then shown_audit(required_id(id), findings: options["findings"])
28
29
  when "list-open-findings" then listed_open_findings(id, options)
29
30
  else unknown(command)
30
31
  end
@@ -40,7 +41,7 @@ module Principles
40
41
  waiting = Models::FindingsLeftOpen.of(records).waiting_at(Time.now.utc)
41
42
  not_found = Models::FindingWriteUps.of(@project, records).not_found
42
43
  Views::OpenFindingsLine.new(invocation.without_project)
43
- .lines(waiting, not_found, source:, user_name: @project.git_user_name)
44
+ .lines(waiting, not_found, source:)
44
45
  end
45
46
 
46
47
  private
@@ -90,11 +91,20 @@ module Principles
90
91
 
91
92
  # id's committed record. With none, an id no map has is refused as show-principle refuses it, since
92
93
  # starting its audit would be refused too; a record kept after its map was removed still shows. One a
93
- # later copy wrote says its audits wait on an upgrade.
94
- #: (String) -> Hash[String, untyped]
95
- def shown_audit(id)
94
+ # later copy wrote says its audits wait on an upgrade. With --findings, only its findings and those of the
95
+ # last completed audit it keeps.
96
+ #: (String, findings: bool?) -> Hash[String, untyped]
97
+ def shown_audit(id, findings:)
96
98
  @principles.find(id) unless @audit_records.exist?(id)
97
- @audit_records.fetch(id).shown.merge(waiting_beside(id), "wrote" => [])
99
+ record = @audit_records.fetch(id)
100
+ (findings ? findings_of(record) : record.shown).merge(waiting_beside(id), "wrote" => [])
101
+ end
102
+
103
+ # The findings of record, and of the last completed record it keeps while open.
104
+ #: (Models::AuditRecord) -> Hash[String, untyped]
105
+ def findings_of(record)
106
+ kept = record.open? ? record.last_completed&.shown : nil
107
+ Views::AuditFindings.new(record.shown, kept).to_h
98
108
  end
99
109
 
100
110
  # A one-member audit of the member --member names, or of several members in one request, or of the
@@ -148,8 +158,7 @@ module Principles
148
158
  records = open_records(id)
149
159
  waiting = Models::FindingsLeftOpen.of(records).waiting_at(Time.now.utc)
150
160
  Views::OpenFindingsLine.new(invocation).short(waiting, Models::FindingWriteUps.of(@project, records).not_found,
151
- source: options["session_start"] || "startup",
152
- user_name: @project.git_user_name)
161
+ source: options["session_start"] || "startup")
153
162
  end
154
163
 
155
164
  # The records whose open findings list-open-findings reads: id's, refused when a later copy wrote it in a
@@ -6,6 +6,8 @@ require_relative "command"
6
6
  require_relative "../models/audit"
7
7
  require_relative "../models/commits_since_base"
8
8
  require_relative "../models/other_principles"
9
+ require_relative "../views/completed_audit_findings"
10
+ require_relative "../views/members_changed_during_audit"
9
11
  require_relative "../views/prior_finding_decisions_result"
10
12
 
11
13
  require_relative "../views/answered_request"
@@ -58,18 +60,30 @@ module Principles
58
60
 
59
61
  private
60
62
 
61
- # What the completed audit prints: its resolved and open findings, as the record it writes holds them, so they
62
- # agree with list-open-findings; what it changed; each prior finding's decision; and, while
63
+ # What the completed audit prints: its resolved, deferred and accepted findings, as the record it writes holds
64
+ # them, so they agree with list-open-findings; what it changed; each prior finding's decision; and, while
63
65
  # principles is not set up, the offer to set it up.
64
66
  #: (Models::AuditStart, Models::Audit, Array[Models::Disposition], Models::DecidedPriorFindings,
65
67
  #| Models::AuditRecord) -> untyped
66
68
  def completion_result(start, audit, dispositions, decided, written)
67
69
  decisions = Views::PriorFindingDecisionsResult.new(kept_ids: decided.kept_ids, closed: decided.closed,
68
70
  changed: decided.changed)
69
- completed = audit_result.completion(principle_id: audit.id, resolved: written.resolved_ids(decided),
70
- open: written.open_ids,
71
+ findings = Views::CompletedAuditFindings.new(resolved: written.resolved_ids(decided),
72
+ deferred: written.left_open_ids("deferred"),
73
+ accepted: written.left_open_ids("accepted"))
74
+ completed = audit_result.completion(principle_id: audit.id, findings: findings,
71
75
  changes: changes(start, audit, dispositions, written), decisions: decisions)
72
- offering_set_up(completed)
76
+ offering_set_up(offering_request_logging(completed, written))
77
+ end
78
+
79
+ # completed, naming turn-on-request-logging when written is the project's first full audit and requests are not
80
+ # logged here, since logged requests show whether members reach the agent at all.
81
+ #: (Hash[String, untyped], Models::AuditRecord) -> Hash[String, untyped]
82
+ def offering_request_logging(completed, written)
83
+ return completed if @project.request_logging.in_use?
84
+ return completed if @audit_records.of(@principles.ids).any? { it.completed_other_than?(written) }
85
+
86
+ audit_result.offering_request_logging(completed)
73
87
  end
74
88
 
75
89
  # completed, with the offer to set principles up while it is not, and outside the plugin, whose hooks report
@@ -88,11 +102,22 @@ module Principles
88
102
  def changes(start, audit, dispositions, written)
89
103
  changed = audit.changed_files(dispositions)
90
104
  added = start.added(now: audit.now)
91
- map = @map_changes&.files_to_commit(@principles.file(audit.id), added: added) || []
92
- files = @audit_records.files_to_commit(written, changed + map, start.reported)
93
- Views::AuditChanges.new(files_to_commit: files, landed: landed_since_base(start, audit), added: added,
105
+ missing = @audit_records.cited_files_missing(written, @project.installed_plugins)
106
+ Views::AuditChanges.new(files_to_commit: files_to_commit(start, audit, written, changed, added),
107
+ landed: landed_since_base(start, audit),
108
+ members_changed: Views::MembersChangedDuringAudit.new(
109
+ added: added, changed: start.changed(now: audit.now)
110
+ ),
94
111
  other_changed: other_changed(audit, changed),
95
- cited_files_missing: @audit_records.cited_files_missing(written))
112
+ cited_files_missing: missing)
113
+ end
114
+
115
+ # The files the completed audit commits: its record, the files its fixes changed, which are changed, and the
116
+ # map when its correction added members to it, which are added.
117
+ #: (Models::AuditStart, Models::Audit, Models::AuditRecord, Array[String], Array[String]) -> Array[String]
118
+ def files_to_commit(start, audit, written, changed, added)
119
+ map = @map_changes&.files_to_commit(@principles.file(audit.id), added: added) || []
120
+ @audit_records.files_to_commit(written, changed + map, start.reported)
96
121
  end
97
122
 
98
123
  # Each other principle with a member in paths, the files this audit's fixes changed, whose own text now
@@ -0,0 +1,40 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ require_relative "command"
5
+ require_relative "../models/carrier_edit_input"
6
+ require_relative "../models/carrier_pages_shown"
7
+ require_relative "../views/carrier_edit_denial"
8
+
9
+ module Principles
10
+ # Each runs one command: reads models, applies their rules and prints through a view.
11
+ # controllers/CLAUDE.md owns the boundary.
12
+ module Controllers
13
+ # report-before-carrier-edit, which a PreToolUse hook on Edit and Write runs: the first edit of each carrier kind
14
+ # in a session is denied once, its reason naming that kind's practices page, and every other call goes through
15
+ # with nothing printed. It exits 0 whatever it reads.
16
+ class CarrierEditReport < Command
17
+ #: (String, String?, Hash[String, untyped]) -> untyped
18
+ def call(command, _id, options)
19
+ naming_the_executable do
20
+ unknown(command) unless command == "report-before-carrier-edit"
21
+
22
+ reported(Models::CarrierEditInput.new(options["stdin"].to_s, @project))
23
+ end
24
+ end
25
+
26
+ private
27
+
28
+ #: (Models::CarrierEditInput) -> Views::Lines
29
+ def reported(input)
30
+ view = Views::CarrierEditDenial.new(invocation.without_project)
31
+ kind = input.kind
32
+ session = input.session
33
+ return Views::CarrierEditDenial::NOTHING unless kind && session
34
+
35
+ shown = Models::CarrierPagesShown.new(@tool.temp_directory)
36
+ shown.point_now?(session, kind) ? view.denied(kind) : Views::CarrierEditDenial::NOTHING
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,26 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ require_relative "command"
5
+ require_relative "../models/carrier_kind"
6
+ require_relative "../views/carrier_practices_page"
7
+
8
+ module Principles
9
+ # Each runs one command: reads models, applies their rules and prints through a view.
10
+ # controllers/CLAUDE.md owns the boundary.
11
+ module Controllers
12
+ # show-carrier-practices KIND: the page of one carrier kind's practices, for an agent judging or editing a member
13
+ # of that kind to read beyond the check a request prints. It writes nothing.
14
+ class CarrierPractices < Command
15
+ #: (String, String?, Hash[String, untyped]) -> untyped
16
+ def call(command, _id, options)
17
+ naming_the_executable do
18
+ unknown(command) unless command == "show-carrier-practices"
19
+
20
+ named = Models::CarrierKind.named(options.fetch("kind"))
21
+ Views::CarrierPracticesPage.of(named).result(named)
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -6,6 +6,7 @@ require_relative "../error"
6
6
  require_relative "../models/answer_text"
7
7
  require_relative "../models/audit"
8
8
  require_relative "../models/carried_assessments"
9
+ require_relative "../models/map_format_raise"
9
10
  require_relative "../models/member"
10
11
  require_relative "../models/member_grounds"
11
12
  require_relative "../models/principle_history"
@@ -14,7 +15,10 @@ require_relative "../models/project"
14
15
  require_relative "../models/record_format"
15
16
  require_relative "../models/record_judged_against"
16
17
  require_relative "../views/audit_result"
18
+ require_relative "../views/invocation"
17
19
  require_relative "../views/lines_shared_with_member"
20
+ require_relative "../views/map_format_raised"
21
+ require_relative "../views/carrier_checks"
18
22
  require_relative "../views/map_result"
19
23
  require_relative "../views/record_waiting_on_an_upgrade"
20
24
  require_relative "broken_member_repairs"
@@ -58,11 +62,13 @@ module Principles
58
62
  @project.principle_history(principle_id)
59
63
  end
60
64
 
61
- # Saves the map, and nothing else, then prints the result the block builds from the map as written.
65
+ # Saves the map, and nothing else, then prints the result the block builds from the map as written, saying
66
+ # when the write raised the map to a format some earlier release cannot read.
62
67
  #: (Models::Principle) { (Views::PrintedPrinciple) -> Hash[String, untyped] } -> untyped
63
68
  def write_map(map, &)
69
+ raised = Views::MapFormatRaised.new(map.id, **Models::MapFormatRaise.new(@principles, map).to_h)
64
70
  wrote = @principles.save(map)
65
- yield(printed_principle(map)).merge("wrote" => [wrote])
71
+ yield(printed_principle(map)).merge("wrote" => [wrote]).merge(raised.to_h)
66
72
  end
67
73
 
68
74
  # Runs the block, putting the running executable into any refusal a model raised, followed by this project,
@@ -88,6 +94,13 @@ module Principles
88
94
  "To see every command: #{@tool.executable} --help")
89
95
  end
90
96
 
97
+ # Where member is now and whether it changed since the record holding hashes assessed it.
98
+ #: (Hash[String, untyped], Models::RecordedHashes) -> Hash[String, untyped]
99
+ def fresh(member, hashes)
100
+ found = Models::Member.new(member)
101
+ @project.freshness(found.locator) { |sha| hashes.freshness(found.key, sha) }
102
+ end
103
+
91
104
  # The controller this one hands part of its command to, over the same project and naming the same executable.
92
105
  #: [C < Command] (Class[C], **untyped) -> C
93
106
  def handed(controller, **)
@@ -98,7 +111,8 @@ module Principles
98
111
  # each run and never stored.
99
112
  #: () -> Views::Invocation
100
113
  def invocation
101
- @tool.invocation(@project.root, answer_folder: @history.ignored_tmp_folder)
114
+ answer_folder = @history.ignored_tmp_folder(Views::Invocation.answer_name("ID", "phase"))
115
+ @tool.invocation(@project.root, answer_folder:)
102
116
  end
103
117
 
104
118
  # Principle id as waiting on an upgrade, when a later copy wrote its record.
@@ -145,12 +159,29 @@ module Principles
145
159
 
146
160
  # Each member's hash at base, or nil outside git.
147
161
  #: (String?, Models::Principle) -> Hash[String, String]?
148
- def committed(base, map) = base ? @history.at(base).hashes(map.members) : nil
162
+ def committed(base, map) = base ? @history.at(base).hashes(map.members.in_project) : nil
163
+
164
+ # basis, its assessment id digesting the last commit that changed the map's file or a member's file at its base,
165
+ # so a commit elsewhere leaves the id as it was.
166
+ #: (Models::AssessmentBasis, Models::Principle) -> Models::AssessmentBasis
167
+ def audited_basis(basis, map)
168
+ base = basis.base or return basis
169
+ basis.audited_at(@history.last_change(@principles.audited_files(map.id, map.members.in_project), at: base))
170
+ end
149
171
 
150
172
  # When each of the map's members loads, by id, which a full audit's request lists against the activation and
151
173
  # show-principle prints, from the project's hooks as hooks read them.
152
174
  #: (Models::Principle, ?Models::HookCommands) -> Hash[String, Models::MemberLoads]
153
- def member_loads(map, hooks = @project.hook_commands) = @project.member_loads(map.members, hooks)
175
+ def member_loads(map, hooks = @project.harness.hook_commands) = @project.harness.member_loads(map.members, hooks)
176
+
177
+ # The check for each carrier kind the map's members are in, or only those ids names, in the order given, once
178
+ # each, for a request where the agent judges or edits them.
179
+ #: (Models::Principle, ?Array[String]?) -> Hash[String, untyped]
180
+ def carrier_checks(map, ids = nil)
181
+ kinds = member_loads(map).transform_values { it.carrier_kind.name }
182
+ named = ids&.filter_map { |id| [id, kinds.fetch(id)] if kinds.key?(id) }&.to_h
183
+ Views::CarrierChecks.new(named || kinds, invocation).to_h
184
+ end
154
185
 
155
186
  # The members a full audit lists to check against its activation, each with the decision its last completed
156
187
  # audit, whose record is given or read now, accepted on the member's loading.
@@ -0,0 +1,61 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ require_relative "command"
5
+ require_relative "../models/members_in_logged_requests"
6
+ require_relative "../models/members_by_part"
7
+ require_relative "../models/session_trend"
8
+ require_relative "../views/context_budget_result"
9
+
10
+ module Principles
11
+ # Each runs one command: reads models, applies their rules and prints through a view.
12
+ # controllers/CLAUDE.md owns the boundary.
13
+ module Controllers
14
+ # show-context-budget: for each turn the agent opened, as the host captured its request under
15
+ # .principles/request-logging/requests/, how much of the context the host loaded before the work started, in
16
+ # bytes beside the host's own token count. It writes nothing.
17
+ class ContextBudget < Command
18
+ # CommandRoutes routes only show-context-budget here.
19
+ #: (String, String?, Hash[String, untyped]) -> untyped
20
+ def call(command, _id, options)
21
+ naming_the_executable do
22
+ @tool.feature(command).refuse_while_off
23
+ session = options["session"]
24
+ sessions = measured(only(turn_openings, session), listing: !session.nil?)
25
+ view = Views::ContextBudgetResult.new
26
+ options["short"] ? view.short(sessions) : view.result(sessions)
27
+ end
28
+ end
29
+
30
+ private
31
+
32
+ # Each captured turn opening, by session, with the bytes of mapped members' text each sent.
33
+ #: () -> Array[[String?, Array[Models::TurnOpening]]]
34
+ def turn_openings = @project.request_logging.turn_openings(Models::MembersInLoggedRequests.mapped_in(@project))
35
+
36
+ # Each session as plain values: its id, its trend, its last turn opening with the members it sent, the members
37
+ # its turn openings sent all told, and, when listing, each turn opening with the members it sent.
38
+ #: (Array[[String?, Array[Models::TurnOpening]]], listing: bool) -> Array[Views::ContextBudgetResult::session]
39
+ def measured(openings, listing:)
40
+ openings.map do |session, opened|
41
+ [session, Models::SessionTrend.new(opened).to_h, opened.fetch(-1).with_members,
42
+ Models::MembersByPart.together(opened.map(&:members)).to_a, (opened.map(&:with_members) if listing)]
43
+ end
44
+ end
45
+
46
+ # openings, by session, only session's where one is named; refused as unknown_session, naming the sessions
47
+ # there are, where none is that session, since an empty list would read as a session with no turns.
48
+ #: (Array[[String?, Array[Models::TurnOpening]]], String?) -> Array[[String?, Array[Models::TurnOpening]]]
49
+ def only(openings, session)
50
+ return openings unless session
51
+
52
+ held = openings.select { |id, _| id == session }
53
+ return held unless held.empty?
54
+
55
+ refusal = Error.new("unknown_session", "No logged turn opening was sent in session #{session}",
56
+ "Give --session one of the sessions listed, or leave it out to show every session.")
57
+ raise refusal.including("sessions" => openings.filter_map(&:first))
58
+ end
59
+ end
60
+ end
61
+ end
@@ -85,6 +85,7 @@ module Principles
85
85
  def dispositions(response, findings, start, audit)
86
86
  samples = Views::CorrectionRequest.answer_guide(Models::DispositionPlaceholders::PLACEHOLDERS.fetch("reason"))
87
87
  .fetch("disposition")
88
+ start.check_plugin_members_unchanged(now: audit.now)
88
89
  Models::CorrectionAnswer.new(response, findings, samples:) { |locator| snapshot(locator) }
89
90
  .dispositions(changed: start.changed(now: audit.now))
90
91
  end
@@ -103,19 +104,28 @@ module Principles
103
104
  principle_history(id).map_at(base)
104
105
  end
105
106
 
106
- # Each member's hash when the audit began, checked against the request id: from the map it started from at the
107
- # base commit in git, after the declared changes are checked against that map, or from the open record outside
108
- # git.
107
+ # Each member's hash when the audit began, checked against the request id, from the map it started from, after
108
+ # the declared changes are checked against that map.
109
109
  #: (Models::RequestId, Models::CorrectionBasis, Models::Audit, Models::DeclaredMapChanges) -> Hash[String, String]
110
110
  def confirmed_start(request_id, basis, audit, changes)
111
- map = started_from(basis, audit, changes)
112
111
  base = basis.base_commit
113
- found = base ? committed(base, map) : @audit_records.find(audit.id)&.base_members
112
+ found = hashes_started_with(base, started_from(basis, audit, changes))
114
113
  checked = audit.confirmed_start(request_id, basis, found)
115
114
  principle_history(audit.id).confirm_current_id_since(base)
116
115
  checked
117
116
  end
118
117
 
118
+ # Each member's hash when the audit of map began: at the base commit in git, beside each plugin member's from
119
+ # the open record, since no commit holds a plugin's file; or all from the open record outside git; nil when
120
+ # they cannot be found.
121
+ #: (String?, Models::Principle) -> Hash[String, String]?
122
+ def hashes_started_with(base, map)
123
+ record = @audit_records.find(map.id)
124
+ return record&.base_members unless base
125
+
126
+ committed(base, map)&.merge(record&.members&.plugin_hashes(map.members) || {})
127
+ end
128
+
119
129
  # The completion of a correction, which read its assessment back from the audit's record: the open one or, for
120
130
  # an identical retry, the completed one.
121
131
  #: (Models::DeclaredMapChanges, Models::CorrectionBasis, Models::Audit) -> AuditCompletion
@@ -4,12 +4,14 @@
4
4
  require_relative "command"
5
5
  require_relative "../models/audit"
6
6
  require_relative "../models/instruction_named"
7
+ require_relative "../models/member_texts"
7
8
  require_relative "../models/meta_principle"
8
9
  require_relative "../models/part_named"
9
10
  require_relative "../models/recent_decision"
10
11
  require_relative "../models/reported_check"
11
12
  require_relative "../views/assessment_request"
12
13
  require_relative "../views/parts_index_result"
14
+ require_relative "last_record_notice_beside"
13
15
  require_relative "members_to_assess"
14
16
  require_relative "parts_to_read"
15
17
 
@@ -21,6 +23,10 @@ module Principles
21
23
  # the commit it is based on, its id and what it asks. Starting writes nothing: the request id is a digest of what
22
24
  # the request depends on, so Answer checks the answer against the project as it is then.
23
25
  class FullAuditRequest < Command
26
+ # The parts --part prints from the scan of the captured requests: its own alone, since the index, read first to
27
+ # size the reads after it, leaves that part unsized rather than wait on the scan.
28
+ SCANNED = [Views::LoggedRequestsEvidence::PART].freeze #: Array[String]
29
+
24
30
  # principle_id names the principle whose full audit is asked for; its map is refused unless it can be audited.
25
31
  #: (Models::Project, tool: RunningTool, principle_id: String) -> void
26
32
  def initialize(project, tool:, principle_id:)
@@ -40,21 +46,21 @@ module Principles
40
46
  def printed
41
47
  request = asked
42
48
  part_bytes = request_parts(request).part_bytes
43
- audit_result.request(with_record_notice(audit_result.assessment_request(request, part_bytes:)))
44
- .merge("wrote" => [])
49
+ noticed = handed(LastRecordNoticeBeside, principle_id: @id, base: @base)
50
+ audit_result.request(noticed.beside(audit_result.assessment_request(request, part_bytes:))).merge("wrote" => [])
45
51
  end
46
52
 
47
53
  # The answer alone, as start-audit --as template prints it, to fill and submit under the request's id.
48
54
  #: () -> Hash[String, untyped]
49
55
  def to_fill
50
- audit_result.answer_to_fill(asked)
56
+ audit_result.answer_to_fill(asked(scanned: false))
51
57
  end
52
58
 
53
59
  # The instruction field this request prints, read on its own and whole, with the paragraphs for cases the
54
60
  # request does not hold; refused when it prints none by that name.
55
61
  #: (String) -> Hash[String, untyped]
56
62
  def instruction(field)
57
- request = asked
63
+ request = asked(scanned: false)
58
64
  named = Models::InstructionNamed.new(field, principle_id: @id, printed: request.instruction_fields).field
59
65
  { "request_id" => request.request_id, named => request.whole_instruction(named), "wrote" => [] }
60
66
  end
@@ -65,7 +71,7 @@ module Principles
65
71
  # save as it stands; refused when the request has no part by one of the names.
66
72
  #: (Array[String]) -> Hash[String, untyped]
67
73
  def part(names)
68
- request = asked
74
+ request = asked(scanned: names.intersect?(SCANNED))
69
75
  parts = request_parts(request)
70
76
  named = names.map { named_in(parts, it) }
71
77
  return parts.shown(Views::ContextParts::TEMPLATE) if named == [Views::ContextParts::TEMPLATE]
@@ -78,7 +84,7 @@ module Principles
78
84
  # order given, printed together under the request's id; refused when the template has no slot by one name.
79
85
  #: (Array[String]) -> Hash[String, untyped]
80
86
  def slot_to_fill(names)
81
- request = asked
87
+ request = asked(scanned: false)
82
88
  slots = request.slots_to_fill
83
89
  named = names.map { Models::PartNamed.new(it, principle_id: @id, printed: slots.keys, template: true).part }
84
90
  { "request_id" => request.request_id, "member_assessments" => named.map { slots.fetch(it) }, "wrote" => [] }
@@ -86,9 +92,16 @@ module Principles
86
92
 
87
93
  private
88
94
 
89
- # The parts of request that --part prints, each member's with its text now.
95
+ # The parts of request that --part prints, each member's with its text now, or with that text in a part of its
96
+ # own where MemberTexts says.
90
97
  #: (Views::AssessmentRequest) -> Views::ContextParts
91
- def request_parts(request) = request.context_parts(texts: member_texts, optional: PartsToRead::OPTIONAL)
98
+ def request_parts(request)
99
+ read = Models::MemberTexts.new(@project, @audit.map, listed: @listing.members)
100
+ apart = Views::ContextParts::TextsApart.new(read.apart_ids, invocation, principle_id: @id,
101
+ read_whole: read.read_whole)
102
+ texts = Views::ContextParts::MemberTexts.new(read.lines, apart:)
103
+ request.context_parts(texts:, optional: PartsToRead::OPTIONAL)
104
+ end
92
105
 
93
106
  # The part name names in parts, refused when the request neither prints it nor leaves it out as empty.
94
107
  #: (Views::ContextParts, String) -> String
@@ -106,17 +119,24 @@ module Principles
106
119
 
107
120
  # The request and what it asks, listing the findings the last completed audit left to decide, under an id that
108
121
  # digests them and the revision of that audit's record, but not the findings other principles leave
109
- # open on members sharing these lines.
110
- #: () -> Views::AssessmentRequest
111
- def asked
122
+ # open on members sharing these lines. Unless scanned, its logged_requests part holds nothing, for a read that
123
+ # prints none of it, since scanning the captured requests is slow.
124
+ #: (?scanned: bool) -> Views::AssessmentRequest
125
+ def asked(scanned: true)
112
126
  record = @audit_records.find(@id)
113
127
  prior = @audit.prior_findings(record)
114
128
  loads = loads_to_check(@audit).listed
115
- basis = Models::AssessmentBasis.printed(@base, record)
116
- head = Views::AnswerHead.new(request_id: @audit.assessment_id(basis, prior.digested, loads).to_s,
117
- basis: basis.to_h)
118
- request_to_assess(head, handed(PartsToRead, audit: @audit, listing: @listing,
119
- audited_files: audited_files(@audit.map)).listed(prior, loads))
129
+ request_to_assess(answer_head(record, prior, loads),
130
+ handed(PartsToRead, audit: @audit, listing: @listing,
131
+ audited_files: audited_files(@audit.map)).listed(prior, loads, scanned:))
132
+ end
133
+
134
+ # The head of the answer: the request's id, digesting prior, the findings the last completed audit left to
135
+ # decide, and loads, what the request lists to check against the activation, with the basis it was printed on.
136
+ #: (Models::AuditRecord?, Models::PriorFindings, Hash[String, untyped]?) -> Views::AnswerHead
137
+ def answer_head(record, prior, loads)
138
+ basis = audited_basis(Models::AssessmentBasis.printed(@base, record), @audit.map)
139
+ Views::AnswerHead.new(request_id: @audit.assessment_id(basis, prior.digested, loads).to_s, basis: basis.to_h)
120
140
  end
121
141
 
122
142
  # What the agent assesses: the members, with what else it reads beside them.
@@ -140,37 +160,13 @@ module Principles
140
160
  Views::AssessedMembers.new(@listing.members,
141
161
  reviewed_check_placeholders: Models::ReportedCheck::PLACEHOLDERS.to_h,
142
162
  unchanged_check_placeholders: Models::ReportedCheck::UNCHANGED_PLACEHOLDERS.to_h,
143
- assessment_placeholder: Models::MemberAssessments::NAMED_PLACEHOLDER)
144
- end
145
-
146
- # Each member's lines now, by id, without their line endings, so its part carries the text it is judged on.
147
- #: () -> Hash[String, Array[String]]
148
- def member_texts
149
- @audit.map.members.to_h { [it.id, @project.member_file(it.path).lines_of(it.locator).map(&:chomp)] }
163
+ assessment_placeholder: Models::MemberAssessments::NAMED_PLACEHOLDER,
164
+ carrier_checks: carrier_checks(@audit.map))
150
165
  end
151
166
 
152
167
  # The map's file and every member's file, which the base commit is judged over.
153
168
  #: (Models::Principle) -> Array[String]
154
169
  def audited_files(map) = @principles.audited_files(@id, map.members)
155
-
156
- # The request, with a notice when the last audit's record was left uncommitted: a completed one to commit, or an
157
- # open one, which its correction completes, never to commit.
158
- #: (Hash[String, untyped]) -> Hash[String, untyped]
159
- def with_record_notice(output)
160
- return output unless @base && uncommitted_record?
161
-
162
- file = @audit_records.file(@id)
163
- record = @audit_records.find(@id)
164
- left_open = record && !record.completed?
165
- notice = left_open ? audit_result.open_record_notice(file) : audit_result.uncommitted_record_notice(file)
166
- output.merge("notice" => notice)
167
- end
168
-
169
- # Whether the last audit's record exists but differs from the last commit, so it may be left behind.
170
- #: () -> bool
171
- def uncommitted_record?
172
- @audit_records.exist?(@id) && @history.uncommitted([@audit_records.file(@id)]).any?
173
- end
174
170
  end
175
171
  end
176
172
  end