principles 0.0.6 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (338) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +383 -0
  3. data/LICENSE +202 -0
  4. data/NOTICE +4 -0
  5. data/README.md +111 -0
  6. data/exe/principles +20 -0
  7. data/lib/principles/after_commit_hook_options.rb +2 -2
  8. data/lib/principles/cli.rb +58 -41
  9. data/lib/principles/command_line.rb +37 -14
  10. data/lib/principles/command_routes.rb +21 -7
  11. data/lib/principles/controllers/acknowledgement.rb +50 -118
  12. data/lib/principles/controllers/acknowledgements.rb +154 -0
  13. data/lib/principles/controllers/after_commit_report.rb +44 -0
  14. data/lib/principles/controllers/answer.rb +52 -21
  15. data/lib/principles/controllers/answer_phase.rb +20 -3
  16. data/lib/principles/controllers/assessment.rb +41 -28
  17. data/lib/principles/controllers/audit.rb +59 -15
  18. data/lib/principles/controllers/audit_completion.rb +25 -12
  19. data/lib/principles/controllers/command.rb +13 -12
  20. data/lib/principles/controllers/correction.rb +26 -11
  21. data/lib/principles/controllers/first_audit_brief.rb +40 -0
  22. data/lib/principles/controllers/full_audit_request.rb +47 -83
  23. data/lib/principles/controllers/hook_setup.rb +49 -0
  24. data/lib/principles/controllers/inventory.rb +10 -8
  25. data/lib/principles/controllers/mapping.rb +2 -2
  26. data/lib/principles/controllers/member_acknowledgement.rb +148 -0
  27. data/lib/principles/controllers/member_entries.rb +4 -4
  28. data/lib/principles/controllers/member_problems_report.rb +84 -30
  29. data/lib/principles/controllers/members_a_commit_changed.rb +3 -3
  30. data/lib/principles/controllers/members_to_assess.rb +23 -20
  31. data/lib/principles/controllers/meta_principle_setup.rb +5 -6
  32. data/lib/principles/controllers/open_correction.rb +42 -0
  33. data/lib/principles/controllers/parts_to_read.rb +117 -0
  34. data/lib/principles/controllers/repoint.rb +1 -1
  35. data/lib/principles/controllers/running_tool.rb +56 -6
  36. data/lib/principles/controllers/session_start_report.rb +62 -0
  37. data/lib/principles/controllers/survey.rb +2 -2
  38. data/lib/principles/data/audit_files.rb +7 -7
  39. data/lib/principles/data/bounded_file.rb +1 -1
  40. data/lib/principles/data/candidate_files_found.rb +6 -3
  41. data/lib/principles/data/command-steps.json +67 -12
  42. data/lib/principles/data/expected_type.rb +3 -3
  43. data/lib/principles/data/first_parent_log.rb +1 -1
  44. data/lib/principles/data/head_reflog.rb +74 -0
  45. data/lib/principles/data/hook_input.rb +59 -0
  46. data/lib/principles/data/ignored_by_git.rb +2 -2
  47. data/lib/principles/data/known_fields.rb +1 -1
  48. data/lib/principles/data/linked_path.rb +1 -1
  49. data/lib/principles/data/map_files.rb +2 -2
  50. data/lib/principles/data/principles_on_path.rb +83 -0
  51. data/lib/principles/data/principles_subfolder.rb +1 -1
  52. data/lib/principles/data/project_files.rb +10 -3
  53. data/lib/principles/data/repository.rb +14 -7
  54. data/lib/principles/data/running_version.rb +10 -8
  55. data/lib/principles/data/schema_check.rb +5 -5
  56. data/lib/principles/data/schemas/acknowledgement-answer.schema.json +86 -20
  57. data/lib/principles/data/schemas/acknowledgements-answer.schema.json +95 -0
  58. data/lib/principles/data/schemas/assessment-answer.schema.json +55 -20
  59. data/lib/principles/data/schemas/audit-record.schema.json +29 -20
  60. data/lib/principles/data/schemas/command-steps.schema.json +1 -1
  61. data/lib/principles/data/schemas/correction-answer-guide.schema.json +1 -1
  62. data/lib/principles/data/schemas/correction-answer.schema.json +14 -62
  63. data/lib/principles/data/schemas/member-map.schema.json +3 -3
  64. data/lib/principles/data/schemas/repointing-answer.schema.json +1 -1
  65. data/lib/principles/error.rb +4 -4
  66. data/lib/principles/failure_refusal.rb +57 -0
  67. data/lib/principles/invocation_options.rb +7 -6
  68. data/lib/principles/launch.rb +49 -0
  69. data/lib/principles/list_open_findings_options.rb +23 -0
  70. data/lib/principles/models/accepted_loading.rb +2 -2
  71. data/lib/principles/models/acknowledged_check.rb +106 -0
  72. data/lib/principles/models/acknowledgement.rb +51 -53
  73. data/lib/principles/models/acknowledgement_left_as_printed.rb +18 -5
  74. data/lib/principles/models/acknowledgement_refusal.rb +25 -10
  75. data/lib/principles/models/acknowledgements.rb +115 -0
  76. data/lib/principles/models/acknowledgements_across.rb +68 -0
  77. data/lib/principles/models/activation.rb +2 -2
  78. data/lib/principles/models/after_commit_input.rb +115 -0
  79. data/lib/principles/models/agent_loads.rb +1 -1
  80. data/lib/principles/models/answer_fields.rb +2 -2
  81. data/lib/principles/models/answer_place.rb +3 -3
  82. data/lib/principles/models/answer_text.rb +2 -2
  83. data/lib/principles/models/answered_time.rb +12 -3
  84. data/lib/principles/models/assessment_answer.rb +10 -10
  85. data/lib/principles/models/assessment_basis.rb +2 -2
  86. data/lib/principles/models/assessment_left_as_printed.rb +1 -1
  87. data/lib/principles/models/assessment_report.rb +14 -15
  88. data/lib/principles/models/audit.rb +46 -34
  89. data/lib/principles/models/audit_record.rb +58 -27
  90. data/lib/principles/models/audit_records.rb +13 -13
  91. data/lib/principles/models/audit_start.rb +3 -3
  92. data/lib/principles/models/audited_member_lines.rb +1 -1
  93. data/lib/principles/models/candidate_files.rb +18 -10
  94. data/lib/principles/models/candidate_inventory.rb +6 -6
  95. data/lib/principles/models/candidate_outline.rb +9 -9
  96. data/lib/principles/models/carried_assessments.rb +18 -3
  97. data/lib/principles/models/carried_member.rb +5 -5
  98. data/lib/principles/models/changed_regions.rb +92 -0
  99. data/lib/principles/models/check_result_guide.rb +50 -0
  100. data/lib/principles/models/check_since_last_audit.rb +5 -4
  101. data/lib/principles/models/cited_files.rb +4 -4
  102. data/lib/principles/models/command_steps.rb +3 -3
  103. data/lib/principles/models/commits_brought_in.rb +1 -1
  104. data/lib/principles/models/commits_since_base.rb +1 -1
  105. data/lib/principles/models/correction_answer.rb +2 -2
  106. data/lib/principles/models/correction_basis.rb +19 -10
  107. data/lib/principles/models/dated_line.rb +1 -2
  108. data/lib/principles/models/decided_prior_findings.rb +6 -6
  109. data/lib/principles/models/declared_map_changes.rb +5 -5
  110. data/lib/principles/models/disposition.rb +21 -21
  111. data/lib/principles/models/entry_file.rb +1 -1
  112. data/lib/principles/models/entry_files.rb +1 -1
  113. data/lib/principles/models/evidence_item.rb +1 -1
  114. data/lib/principles/models/evidence_lines_since.rb +2 -2
  115. data/lib/principles/models/evidence_replacements.rb +3 -3
  116. data/lib/principles/models/finding_write_ups.rb +12 -5
  117. data/lib/principles/models/findings_left_open.rb +4 -4
  118. data/lib/principles/models/first_full_audit.rb +32 -0
  119. data/lib/principles/models/first_raised_claim.rb +1 -1
  120. data/lib/principles/models/fix_only_fields.rb +1 -1
  121. data/lib/principles/models/head_moves.rb +66 -0
  122. data/lib/principles/models/hook_commands.rb +49 -4
  123. data/lib/principles/models/ignored_candidates.rb +1 -1
  124. data/lib/principles/models/instruction_named.rb +2 -3
  125. data/lib/principles/models/json_digest.rb +2 -2
  126. data/lib/principles/models/json_path_query.rb +1 -1
  127. data/lib/principles/models/kept_prior_finding.rb +9 -9
  128. data/lib/principles/models/last_completed_revision.rb +4 -5
  129. data/lib/principles/models/left_as_printed.rb +2 -2
  130. data/lib/principles/models/line_diff.rb +113 -0
  131. data/lib/principles/models/line_span.rb +1 -1
  132. data/lib/principles/models/list_member_problems_check.rb +80 -0
  133. data/lib/principles/models/listed_members.rb +47 -0
  134. data/lib/principles/models/loaded_files.rb +4 -5
  135. data/lib/principles/models/loading_decision.rb +19 -10
  136. data/lib/principles/models/loading_facts.rb +1 -1
  137. data/lib/principles/models/loads_to_check.rb +1 -2
  138. data/lib/principles/models/located_text.rb +1 -1
  139. data/lib/principles/models/mapped_principles.rb +2 -2
  140. data/lib/principles/models/member.rb +31 -4
  141. data/lib/principles/models/member_assessments.rb +17 -8
  142. data/lib/principles/models/member_elsewhere.rb +4 -4
  143. data/lib/principles/models/member_file.rb +4 -4
  144. data/lib/principles/models/member_grounds.rb +1 -1
  145. data/lib/principles/models/member_hashes_as_written.rb +1 -1
  146. data/lib/principles/models/member_lines.rb +29 -61
  147. data/lib/principles/models/member_loads.rb +2 -2
  148. data/lib/principles/models/member_moves.rb +1 -1
  149. data/lib/principles/models/member_problems.rb +21 -18
  150. data/lib/principles/models/member_repair_moves.rb +15 -9
  151. data/lib/principles/models/member_sighting.rb +12 -15
  152. data/lib/principles/models/member_snapshots.rb +1 -1
  153. data/lib/principles/models/member_state.rb +1 -1
  154. data/lib/principles/models/members_across_principles.rb +77 -0
  155. data/lib/principles/models/members_elsewhere.rb +2 -2
  156. data/lib/principles/models/members_sharing_lines.rb +7 -7
  157. data/lib/principles/models/meta_principle.rb +11 -4
  158. data/lib/principles/models/missing_files.rb +3 -3
  159. data/lib/principles/models/new_findings.rb +4 -4
  160. data/lib/principles/models/open_correction.rb +57 -0
  161. data/lib/principles/models/open_finding.rb +36 -31
  162. data/lib/principles/models/open_findings_elsewhere.rb +2 -2
  163. data/lib/principles/models/other_principles.rb +2 -2
  164. data/lib/principles/models/other_templates_placeholders.rb +17 -16
  165. data/lib/principles/models/outline_budget.rb +7 -7
  166. data/lib/principles/models/outline_group.rb +1 -1
  167. data/lib/principles/models/outline_section.rb +2 -2
  168. data/lib/principles/models/part_named.rb +41 -0
  169. data/lib/principles/models/placement.rb +2 -2
  170. data/lib/principles/models/principle.rb +13 -13
  171. data/lib/principles/models/principle_history.rb +8 -8
  172. data/lib/principles/models/principle_members.rb +14 -7
  173. data/lib/principles/models/principles_folder_move.rb +1 -1
  174. data/lib/principles/models/principles_on_path.rb +29 -0
  175. data/lib/principles/models/principles_package.rb +3 -3
  176. data/lib/principles/models/prior_decision_fields.rb +8 -8
  177. data/lib/principles/models/prior_finding_decision.rb +8 -8
  178. data/lib/principles/models/prior_finding_outcomes.rb +1 -1
  179. data/lib/principles/models/prior_findings.rb +5 -5
  180. data/lib/principles/models/problem_report.rb +42 -9
  181. data/lib/principles/models/project.rb +29 -20
  182. data/lib/principles/models/project_history.rb +18 -12
  183. data/lib/principles/models/quoted_change.rb +8 -8
  184. data/lib/principles/models/recent_decision.rb +3 -3
  185. data/lib/principles/models/record_format.rb +16 -10
  186. data/lib/principles/models/record_judged_against.rb +4 -4
  187. data/lib/principles/models/recorded_entry.rb +17 -8
  188. data/lib/principles/models/recorded_finding.rb +9 -9
  189. data/lib/principles/models/recorded_findings.rb +2 -2
  190. data/lib/principles/models/recorded_hashes.rb +2 -2
  191. data/lib/principles/models/recorded_members.rb +13 -13
  192. data/lib/principles/models/refusal_before_shape.rb +2 -2
  193. data/lib/principles/models/repoint.rb +3 -3
  194. data/lib/principles/models/report_hooks.rb +69 -0
  195. data/lib/principles/models/reported_check.rb +42 -36
  196. data/lib/principles/models/request_id.rb +19 -7
  197. data/lib/principles/models/runs_from.rb +7 -2
  198. data/lib/principles/models/sent_answer.rb +38 -16
  199. data/lib/principles/models/sent_prior_decisions.rb +1 -1
  200. data/lib/principles/models/session_start_input.rb +37 -0
  201. data/lib/principles/models/shape_problems_beside.rb +1 -1
  202. data/lib/principles/models/skill_loads.rb +1 -1
  203. data/lib/principles/models/stale_request.rb +59 -0
  204. data/lib/principles/models/still_holds_restatement.rb +6 -6
  205. data/lib/principles/models/submitted_answer.rb +1 -1
  206. data/lib/principles/models/template_placeholders.rb +6 -6
  207. data/lib/principles/models/text_within.rb +1 -1
  208. data/lib/principles/models/tracked_paths.rb +38 -0
  209. data/lib/principles/models/unchecked_members.rb +2 -2
  210. data/lib/principles/models/uncommitted_files.rb +1 -1
  211. data/lib/principles/models/uncommitted_outside_the_map.rb +2 -2
  212. data/lib/principles/models/waits_on.rb +1 -1
  213. data/lib/principles/models/write_up_opening.rb +5 -5
  214. data/lib/principles/models/write_up_pointer.rb +3 -3
  215. data/lib/principles/models/write_up_repoint.rb +2 -3
  216. data/lib/principles/positional_arguments.rb +15 -7
  217. data/lib/principles/prose_list.rb +1 -1
  218. data/lib/principles/session_start_options.rb +3 -3
  219. data/lib/principles/start_audit_options.rb +54 -12
  220. data/lib/principles/supported_ruby.rb +24 -7
  221. data/lib/principles/version.rb +2 -2
  222. data/lib/principles/views/acknowledged_since_last_audit.rb +2 -2
  223. data/lib/principles/views/acknowledgement_result.rb +137 -17
  224. data/lib/principles/views/activation_in_hand.rb +1 -1
  225. data/lib/principles/views/answered_request.rb +6 -2
  226. data/lib/principles/views/assessed_members.rb +68 -38
  227. data/lib/principles/views/assessment_request.rb +43 -21
  228. data/lib/principles/views/audit_changes.rb +4 -4
  229. data/lib/principles/views/audit_commit.rb +5 -4
  230. data/lib/principles/views/audit_result.rb +100 -53
  231. data/lib/principles/views/candidate_files_result.rb +7 -6
  232. data/lib/principles/views/check_notes.rb +29 -6
  233. data/lib/principles/views/check_result_template.rb +51 -39
  234. data/lib/principles/views/completed_audit_next_step.rb +44 -0
  235. data/lib/principles/views/context_parts.rb +112 -0
  236. data/lib/principles/views/correction_request.rb +49 -33
  237. data/lib/principles/views/diff_since_last_audit.rb +8 -6
  238. data/lib/principles/views/findings_result.rb +33 -1
  239. data/lib/principles/views/first_audit_brief.rb +51 -0
  240. data/lib/principles/views/first_audit_line.rb +45 -0
  241. data/lib/principles/views/help.rb +4 -4
  242. data/lib/principles/views/hook_setup_result.rb +91 -0
  243. data/lib/principles/views/instruction.rb +3 -3
  244. data/lib/principles/views/invocation.rb +32 -9
  245. data/lib/principles/views/json_with_entries_on_lines.rb +6 -35
  246. data/lib/principles/views/landed_since_base.rb +1 -1
  247. data/lib/principles/views/line_history_since_last_audit.rb +35 -0
  248. data/lib/principles/views/lines_shared_with_member.rb +6 -6
  249. data/lib/principles/views/loads_to_check_result.rb +11 -7
  250. data/lib/principles/views/map_added_to.rb +3 -3
  251. data/lib/principles/views/map_result.rb +9 -9
  252. data/lib/principles/views/member_change_since_baseline.rb +44 -23
  253. data/lib/principles/views/member_lines_beside_text.rb +43 -0
  254. data/lib/principles/views/member_repairs.rb +3 -2
  255. data/lib/principles/views/member_row.rb +61 -0
  256. data/lib/principles/views/members_a_commit_changed.rb +15 -11
  257. data/lib/principles/views/members_with_no_baseline.rb +10 -3
  258. data/lib/principles/views/meta_principle_passage.rb +1 -1
  259. data/lib/principles/views/meta_principle_result.rb +12 -5
  260. data/lib/principles/views/one_member_check_result_template.rb +24 -12
  261. data/lib/principles/views/open_findings_elsewhere_result.rb +5 -2
  262. data/lib/principles/views/open_findings_line.rb +26 -36
  263. data/lib/principles/views/other_principles_unjudged_result.rb +6 -3
  264. data/lib/principles/views/outside_the_map_result.rb +5 -2
  265. data/lib/principles/views/package_since_last_audit_result.rb +29 -6
  266. data/lib/principles/views/parts_index_result.rb +60 -0
  267. data/lib/principles/views/principle_read_result.rb +5 -6
  268. data/lib/principles/views/principle_with_changed_members.rb +1 -1
  269. data/lib/principles/views/principles_with_no_completed_audit.rb +1 -2
  270. data/lib/principles/views/printed_json.rb +51 -0
  271. data/lib/principles/views/printed_principle.rb +1 -1
  272. data/lib/principles/views/prior_finding_decisions_result.rb +4 -4
  273. data/lib/principles/views/prior_findings_result.rb +17 -14
  274. data/lib/principles/views/problem_lines.rb +70 -45
  275. data/lib/principles/views/problem_result.rb +75 -43
  276. data/lib/principles/views/prompts/acknowledge-a-change/judge-each-member-once-for-every-principle.md +2 -0
  277. data/lib/principles/views/prompts/acknowledge-a-change/read-the-deferred-findings-it-keeps.md +1 -0
  278. data/lib/principles/views/prompts/acknowledge-a-change/report-the-exit-status-its-own-listing-gives.md +3 -0
  279. data/lib/principles/views/prompts/acknowledge-a-change/resolve-them-in-a-full-audit.md +1 -0
  280. data/lib/principles/views/prompts/acknowledge-a-change/say-whether-each-change-keeps-its-meaning.md +8 -0
  281. data/lib/principles/views/prompts/acknowledge-a-change/say-whether-the-change-keeps-the-meaning.md +3 -3
  282. data/lib/principles/views/prompts/assess-every-member/confirm-each-write-up-pointer-the-answer-drops.md +2 -0
  283. data/lib/principles/views/prompts/assess-every-member/decide-each-member-loading.md +2 -1
  284. data/lib/principles/views/prompts/assess-every-member/have-a-changed-check-reviewed-before-running-it.md +1 -1
  285. data/lib/principles/views/prompts/assess-every-member/have-a-new-check-reviewed-before-running-it.md +1 -1
  286. data/lib/principles/views/prompts/assess-every-member/judge-a-carried-assessment-citing-a-decided-finding.md +3 -0
  287. data/lib/principles/views/prompts/assess-every-member/judge-a-submitted-carried-assessment-citing-a-decided-finding.md +5 -0
  288. data/lib/principles/views/prompts/assess-every-member/judge-the-keeping-under-the-release-since-the-last-audit.md +1 -1
  289. data/lib/principles/views/prompts/assess-every-member/keep-the-printed-review-basis-or-replace-it.md +1 -0
  290. data/lib/principles/views/prompts/assess-every-member/name-the-commit-that-made-the-check.md +1 -0
  291. data/lib/principles/views/prompts/assess-every-member/read-a-trimmed-instruction-whole.md +1 -1
  292. data/lib/principles/views/prompts/assess-every-member/read-the-request-in-parts.md +1 -0
  293. data/lib/principles/views/prompts/assess-every-member/run-the-check-then-report-it.md +2 -2
  294. data/lib/principles/views/prompts/assess-every-member/run-the-reviewed-check-and-say-what-its-review-rested-on.md +5 -3
  295. data/lib/principles/views/prompts/assess-every-member/why-each-member-is-judged-again.md +3 -2
  296. data/lib/principles/views/prompts/dispose-of-each-finding/answer-guide.json +1 -1
  297. data/lib/principles/views/prompts/dispose-of-each-finding/confirm-each-deferral-written-up-nowhere.md +2 -0
  298. data/lib/principles/views/prompts/dispose-of-each-finding/retain-assessment-and-correction.md +4 -4
  299. data/lib/principles/views/prompts/find-a-principle-to-map/where-the-inventory-looks.md +2 -2
  300. data/lib/principles/views/prompts/learn-what-a-command-does/every-command-and-how-they-chain.md +1 -2
  301. data/lib/principles/views/prompts/learn-what-a-command-does/list-candidate-files.md +4 -3
  302. data/lib/principles/views/prompts/learn-what-a-command-does/list-member-problems.md +16 -16
  303. data/lib/principles/views/prompts/learn-what-a-command-does/list-open-findings.md +65 -61
  304. data/lib/principles/views/prompts/learn-what-a-command-does/report-after-commit.md +14 -0
  305. data/lib/principles/views/prompts/learn-what-a-command-does/report-at-session-start.md +26 -0
  306. data/lib/principles/views/prompts/learn-what-a-command-does/show-answer-check.md +22 -20
  307. data/lib/principles/views/prompts/learn-what-a-command-does/show-first-audit-brief.md +19 -0
  308. data/lib/principles/views/prompts/learn-what-a-command-does/show-hook-setup.md +13 -0
  309. data/lib/principles/views/prompts/learn-what-a-command-does/show-meta-principle-passage.md +3 -1
  310. data/lib/principles/views/prompts/learn-what-a-command-does/show-open-correction.md +12 -0
  311. data/lib/principles/views/prompts/learn-what-a-command-does/start-audit.md +27 -28
  312. data/lib/principles/views/prompts/learn-what-a-command-does/submit-answer.md +39 -38
  313. data/lib/principles/views/prompts/report-the-completed-audit/commit-only-what-the-audit-changed.md +2 -2
  314. data/lib/principles/views/prompts/run-a-first-audit-in-the-background/follow-the-brief.md +18 -0
  315. data/lib/principles/views/prompts/set-principles-up/offer-the-report-hooks.md +2 -0
  316. data/lib/principles/views/prompts/set-principles-up/wire-the-report-hooks-with-the-user.md +8 -0
  317. data/lib/principles/views/prompts/start-a-session/act-on-the-open-findings.md +3 -4
  318. data/lib/principles/views/prompts/start-a-session/every-loaded-line-costs-every-session.md +1 -0
  319. data/lib/principles/views/prompts/start-a-session/hand-the-first-audit-to-a-subagent.md +3 -0
  320. data/lib/principles/views/prompts/start-a-session/run-each-command-above.md +1 -0
  321. data/lib/principles/views/prompts/start-a-session/start-no-second-first-audit.md +2 -0
  322. data/lib/principles/views/prompts/start-a-session/start-with-the-principles-skill.md +1 -0
  323. data/lib/principles/views/prompts.rb +1 -1
  324. data/lib/principles/views/read_the_change.rb +36 -0
  325. data/lib/principles/views/record_waiting_on_an_upgrade.rb +2 -2
  326. data/lib/principles/views/repoint_result.rb +1 -1
  327. data/lib/principles/views/report_hooks_offer.rb +25 -0
  328. data/lib/principles/views/request_part.rb +5 -5
  329. data/lib/principles/views/request_parts.rb +1 -1
  330. data/lib/principles/views/session_start_report.rb +46 -0
  331. data/lib/principles/views/shell_word.rb +1 -1
  332. data/lib/principles/views/trimmed_instructions_note.rb +30 -0
  333. data/lib/principles/views/visible_text.rb +1 -1
  334. data/lib/principles/views/workflow_diagram.rb +1 -1
  335. data/principles.gemspec +44 -0
  336. metadata +95 -14
  337. data/lib/principles/views/prompts/start-a-session/it-returns-after-each-clear-or-compaction-too.md +0 -1
  338. data/lib/principles/views/prompts/start-a-session/it-returns-at-each-session-start.md +0 -1
@@ -5,11 +5,12 @@ require_relative "invocation"
5
5
  require_relative "answered_request"
6
6
  require_relative "member_change_since_baseline"
7
7
  require_relative "prompts"
8
+ require_relative "../prose_list"
8
9
 
9
10
  module Principles
10
11
  # What this tool prints, from plain values a controller hands it. views/CLAUDE.md owns the boundary.
11
12
  module Views
12
- # A one-member audit's request and its result (D33).
13
+ # A one-member audit's request and its result.
13
14
  class AcknowledgementResult
14
15
  #: (Invocation) -> void
15
16
  def initialize(invocation)
@@ -17,40 +18,159 @@ module Principles
17
18
  freeze
18
19
  end
19
20
 
20
- # change is the member's change since its baseline; context, what the request's context shows beside it, such
21
- # as the record's findings on the member; placeholders, the text the template prints in each field the agent
22
- # writes. What the agent judges is under context, the question last, as in a full audit's request (D60).
23
- #: (request_id: String, principle_id: String, change: MemberChangeSinceBaseline,
24
- #| context: Hash[String, untyped], placeholders: Hash[String, untyped]) -> Hash[String, untyped]
25
- def request(request_id:, principle_id:, change:, context:, placeholders:)
21
+ # asked is what the request asks of its member: under :change its change since its baseline; under :context
22
+ # what the request's context shows beside it, such as the record's findings on the member; and under
23
+ # :placeholders the text the template prints in each field the agent writes. What the agent judges is under
24
+ # context, the question last, as in a full audit's request.
25
+ #: (request_id: String, principle_id: String, asked: Hash[Symbol, untyped]) -> Hash[String, untyped]
26
+ def request(request_id:, principle_id:, asked:)
26
27
  { "status" => "agent_judgement_required", "request_id" => request_id, "phase" => "acknowledgement",
27
- "context" => { "principle_id" => principle_id, **change.to_h, **context,
28
+ "context" => { "principle_id" => principle_id, **asked.fetch(:change).to_h, **asked.fetch(:context),
28
29
  "question" => Prompts.text("acknowledge-a-change/say-whether-the-change-keeps-the-meaning") },
29
- "response_template" => answer_to_fill(request_id:, change:, placeholders:),
30
+ "response_template" => answer_to_fill(request_id:, asked:),
30
31
  "answer_with" => @invocation.submit_answer(request_id) }
31
32
  end
32
33
 
33
34
  # The answer to the request request_id names, to fill: the request prints it as response_template, and
34
- # start-audit --member --as template prints it alone, each field the agent writes holding its placeholder (#773),
35
- # and only those: the fields the answer may add, the question names (#1170).
36
- #: (request_id: String, change: MemberChangeSinceBaseline, placeholders: Hash[String, untyped])
37
- #| -> Hash[String, untyped]
38
- def answer_to_fill(request_id:, change:, placeholders:)
39
- { "request_id" => request_id, "basis" => { "member_id" => change.member_id }, **placeholders }
35
+ # start-audit --member --as template prints it alone, each field the agent writes holding its placeholder,
36
+ # and only those: the fields the answer may add, the question names, under members by the member's id,
37
+ # as several members' are, and its basis names it under member_ids, as theirs do.
38
+ #: (request_id: String, asked: Hash[Symbol, untyped]) -> Hash[String, untyped]
39
+ def answer_to_fill(request_id:, asked:)
40
+ member_id = asked.fetch(:change).member_id
41
+ { "request_id" => request_id, "basis" => { "member_ids" => [member_id] },
42
+ "members" => { member_id => asked.fetch(:placeholders) } }
43
+ end
44
+
45
+ # The request for several members' acknowledgements in one answer: each of members holds a member's
46
+ # change, the context its own request shows beside it and the placeholders its template prints, as one member's
47
+ # request holds them, under context.members and the template's members in the order the agent named them.
48
+ #: (request_id: String, principle_id: String, members: Array[Hash[Symbol, untyped]]) -> Hash[String, untyped]
49
+ def several_request(request_id:, principle_id:, members:)
50
+ { "status" => "agent_judgement_required", "request_id" => request_id, "phase" => "acknowledgements",
51
+ "context" => { "principle_id" => principle_id,
52
+ "members" => shown(members),
53
+ "question" => Prompts.text("acknowledge-a-change/say-whether-each-change-keeps-its-meaning") },
54
+ "response_template" => several_to_fill(request_id:, members:),
55
+ "answer_with" => @invocation.submit_answer(request_id) }
56
+ end
57
+
58
+ # The answer to the request for several members request_id names, to fill: its basis names each member, and
59
+ # its members hold each one's placeholders under its id, as start-audit --as template prints it alone.
60
+ #: (request_id: String, members: Array[Hash[Symbol, untyped]]) -> Hash[String, untyped]
61
+ def several_to_fill(request_id:, members:)
62
+ { "request_id" => request_id, "basis" => { "member_ids" => members.map { it.fetch(:change).member_id } },
63
+ "members" => members.to_h { [it.fetch(:change).member_id, it.fetch(:placeholders)] } }
64
+ end
65
+
66
+ # The request for the members several principles map in one answer: under context.principles, each
67
+ # principle's members as its own request for several shows them, and in the template one entry per member,
68
+ # judged once for every principle that maps it. keeping_deferred names each principle whose members keep a
69
+ # deferred finding, which the request says only a full audit resolves.
70
+ #: (request_id: String, principles: Hash[String, Array[Hash[Symbol, untyped]]],
71
+ #| ?keeping_deferred: Array[String]) -> Hash[String, untyped]
72
+ def across_request(request_id:, principles:, keeping_deferred: [])
73
+ { "status" => "agent_judgement_required", "request_id" => request_id, "phase" => "acknowledgements",
74
+ "context" => { "principles" => shown_once(principles),
75
+ **deferred_findings_kept(keeping_deferred), "question" => across_question },
76
+ "response_template" => across_to_fill(request_id:, principles:),
77
+ "answer_with" => @invocation.submit_answer(request_id) }
78
+ end
79
+
80
+ # The answer to the request for the members several principles map, to fill: its basis names each principle and
81
+ # each member, and its members hold one entry per member, with every field any principle's template prints for
82
+ # it, so check_result is there when any principle checks it, and the first principle's text where two
83
+ # print the same field.
84
+ #: (request_id: String, principles: Hash[String, Array[Hash[Symbol, untyped]]]) -> Hash[String, untyped]
85
+ def across_to_fill(request_id:, principles:)
86
+ entries = principles.values.flatten.each_with_object({}) do |asked, by_member|
87
+ id = asked.fetch(:change).member_id
88
+ by_member[id] = asked.fetch(:placeholders).merge(by_member.fetch(id, {}))
89
+ end
90
+ { "request_id" => request_id, "basis" => { "principle_ids" => principles.keys, "member_ids" => entries.keys },
91
+ "members" => entries }
92
+ end
93
+
94
+ # The acknowledgement of each of member_ids was accepted, and file holds them all.
95
+ #: (principle_id: String, member_ids: Array[String], file: String) -> AnsweredRequest
96
+ def several_acknowledged(principle_id:, member_ids:, file:)
97
+ AnsweredRequest.new(
98
+ "status" => "acknowledged", "principle_id" => principle_id, "member_ids" => member_ids,
99
+ "files_to_commit" => [file],
100
+ "next_action" => "Commit #{file}. #{ProseList.new(member_ids)} read as judged until each is edited again.\n" \
101
+ "This no longer lists them: " \
102
+ "#{@invocation.in_project("list-member-problems", principle_id, usage: "--short")}"
103
+ )
104
+ end
105
+
106
+ # The acknowledgement of each of member_ids was accepted for every principle that maps it, each principle's in its
107
+ # file, under its id in files.
108
+ #: (member_ids: Array[String], files: Hash[String, String]) -> AnsweredRequest
109
+ def across_acknowledged(member_ids:, files:)
110
+ AnsweredRequest.new(
111
+ "status" => "acknowledged", "principle_ids" => files.keys, "member_ids" => member_ids,
112
+ "files_to_commit" => files.values,
113
+ "next_action" => "Commit #{ProseList.new(files.values)}. #{ProseList.new(member_ids)} read as judged until " \
114
+ "each is edited again.\nThis no longer lists them: " \
115
+ "#{@invocation.in_project("list-member-problems", usage: "--short")}"
116
+ )
40
117
  end
41
118
 
42
119
  # The acknowledgement was accepted and file holds it.
43
120
  #: (principle_id: String, member_id: String, file: String) -> AnsweredRequest
44
121
  def acknowledged(principle_id:, member_id:, file:)
45
122
  fields = {
46
- "status" => "acknowledged", "principle_id" => principle_id, "member_id" => member_id,
123
+ "status" => "acknowledged", "principle_id" => principle_id, "member_ids" => [member_id],
47
124
  "files_to_commit" => [file],
48
125
  "next_action" => "Commit #{file}. #{member_id} reads as judged until it is edited again.\n" \
49
- "After committing, this no longer lists it: " \
126
+ "This no longer lists it: " \
50
127
  "#{@invocation.in_project("list-member-problems", principle_id, usage: "--short")}"
51
128
  }
52
129
  AnsweredRequest.new(fields)
53
130
  end
131
+
132
+ private
133
+
134
+ # Where to read the deferred findings an acknowledgement across principles keeps, and the full audit of each
135
+ # principle in ids that resolves them, one command to a line; nothing when ids is empty.
136
+ #: (Array[String]) -> Hash[String, String]
137
+ def deferred_findings_kept(ids)
138
+ return {} if ids.empty?
139
+
140
+ read = Prompts.text("acknowledge-a-change/read-the-deferred-findings-it-keeps",
141
+ list_open_findings: @invocation.in_project("list-open-findings", options: ["--lines"]))
142
+ audits = ids.map do |id|
143
+ Prompts.text("acknowledge-a-change/resolve-them-in-a-full-audit",
144
+ principle_id: id, start_audit: @invocation.in_project("start-audit", id))
145
+ end
146
+ { "deferred_findings_kept" => [read, *audits].join("\n") }
147
+ end
148
+
149
+ # The question a request across principles asks: judge each member once, then as several members are judged.
150
+ #: () -> String
151
+ def across_question
152
+ once = Prompts.text("acknowledge-a-change/judge-each-member-once-for-every-principle")
153
+ "#{once} #{Prompts.text("acknowledge-a-change/say-whether-each-change-keeps-its-meaning")}"
154
+ end
155
+
156
+ # Each principle's members as shown, a member an earlier principle already shows with the same change naming that
157
+ # principle under change_shown_under in place of the change, so its lines print once.
158
+ #: (Hash[String, Array[Hash[Symbol, untyped]]]) -> Hash[String, Hash[String, untyped]]
159
+ def shown_once(principles)
160
+ first = {} #: Hash[String, [String, MemberChangeSinceBaseline]]
161
+ principles.to_h do |principle_id, members|
162
+ [principle_id, { "members" => members.map do |asked|
163
+ change = asked.fetch(:change)
164
+ earlier, shown = first[change.member_id] ||= [principle_id, change]
165
+ repeated = earlier != principle_id && shown.same_change_as?(change)
166
+ { **(repeated ? change.shown_under(earlier) : change.to_h), **asked.fetch(:context) }
167
+ end }]
168
+ end
169
+ end
170
+
171
+ # Each member's change and the context beside it, as its own request shows them.
172
+ #: (Array[Hash[Symbol, untyped]]) -> Array[Hash[String, untyped]]
173
+ def shown(members) = members.map { { **it.fetch(:change).to_h, **it.fetch(:context) } }
54
174
  end
55
175
  end
56
176
  end
@@ -4,7 +4,7 @@
4
4
  module Principles
5
5
  # What this tool prints, from plain values a controller hands it. views/CLAUDE.md owns the boundary.
6
6
  module Views
7
- # How this tool says when a principle's work is in hand, from the activation its map stores (D38): the phrase
7
+ # How this tool says when a principle's work is in hand, from the activation its map stores: the phrase
8
8
  # change-activation's question carries, and that later results will share.
9
9
  class ActivationInHand
10
10
  # How the question words each value of Models::Activation#full_audit_lists.
@@ -11,11 +11,15 @@ module Principles
11
11
  freeze
12
12
  end
13
13
 
14
- #: (AuditResult, String, String) -> Hash[String, untyped]
15
- def presented_with(_view, _source_request_id, _answer_file) = @fields
14
+ #: (AuditResult) -> Hash[String, untyped]
15
+ def presented_with(_view) = @fields
16
16
 
17
17
  #: (Hash[String, untyped], Invocation, String) -> Hash[String, untyped]
18
18
  def with_correction_to_fill(acceptable, _invocation, _answer_file) = acceptable
19
+
20
+ # No correction follows a terminal answer, so there is none to fill.
21
+ #: () -> nil
22
+ def correction_to_fill = nil
19
23
  end
20
24
  end
21
25
  end
@@ -7,7 +7,7 @@ module Principles
7
7
  # What this tool prints, from plain values a controller hands it. views/CLAUDE.md owns the boundary.
8
8
  module Views
9
9
  # The members an assessment request lists, each a plain entry of id, role, first_line, last_line, the evidence
10
- # that locates it and, for a member with a check, the check whose result the template asks for (D30): what the
10
+ # that locates it and, for a member with a check, the check whose result the template asks for: what the
11
11
  # request shows of each, the template entry each starts with, and what they carry that the request explains.
12
12
  class AssessedMembers
13
13
  # What the request shows of each member.
@@ -16,25 +16,20 @@ module Principles
16
16
  mapped_elsewhere].freeze #: Array[String]
17
17
 
18
18
  # reviewed_check_placeholders is the text a checked member's template prints in each field it may leave as
19
- # printed to give none, for a check reviewed before it runs (#993); unchanged_check_placeholders, for one the
20
- # last audit ran (#1010).
21
- # assessment_placeholder is the text a fresh member's assessment prints, which an answer may not send back
22
- # (#991). sighting_placeholders is the text the template printed alone gives observation and observed_at beside
23
- # delivery, which a delivery not observed leaves as printed (#1010).
19
+ # printed to give none, for a check reviewed before it runs; unchanged_check_placeholders, for one the
20
+ # last audit ran.
21
+ # assessment_placeholder is the text a fresh member's assessment prints, which an answer may not send back.
24
22
  #: (Array[Hash[String, untyped]], reviewed_check_placeholders: Hash[String, String],
25
- #| unchanged_check_placeholders: Hash[String, String], assessment_placeholder: String,
26
- #| sighting_placeholders: Hash[String, String]) -> void
27
- def initialize(members, reviewed_check_placeholders:, unchanged_check_placeholders:, assessment_placeholder:,
28
- sighting_placeholders:)
23
+ #| unchanged_check_placeholders: Hash[String, String], assessment_placeholder: String) -> void
24
+ def initialize(members, reviewed_check_placeholders:, unchanged_check_placeholders:, assessment_placeholder:)
29
25
  @assessment_placeholder = assessment_placeholder
30
- @sighting_placeholders = sighting_placeholders
31
26
  @members = members
32
27
  @reviewed_check_placeholders = reviewed_check_placeholders
33
28
  @unchanged_check_placeholders = unchanged_check_placeholders
34
29
  freeze
35
30
  end
36
31
 
37
- # What the request shows of a carried member no flag fires on (D93): what names it and its check, whose result
32
+ # What the request shows of a carried member no flag fires on: what names it and its check, whose result
38
33
  # the template still asks for, and of its carried assessment only its dates and flags.
39
34
  COMPACT = %w[id role check check_since_last_audit check_hidden_characters carried_forward].freeze #: Array[String]
40
35
  # What a compact member shows of its carried assessment.
@@ -42,65 +37,86 @@ module Principles
42
37
  file_changed_outside_member].freeze #: Array[String]
43
38
 
44
39
  # Each member as the request's context shows it, its fields in SHOWN's order; a carried member no flag fires on
45
- # compactly, as COMPACT and CARRIED_COMPACTLY say, its stored assessment one show-audit away (D93).
40
+ # compactly, as COMPACT and CARRIED_COMPACTLY say, its stored assessment one show-audit away.
46
41
  #: () -> Array[Hash[String, untyped]]
47
42
  def shown
48
43
  @members.map do |member|
49
- next fields(member, SHOWN) unless compact?(member)
44
+ next fields(member, SHOWN).merge(instruction(member)) unless compact?(member)
50
45
 
51
- fields(member, COMPACT).merge("carried_forward" => member.fetch("carried_forward").slice(*CARRIED_COMPACTLY))
46
+ fields(member, COMPACT).merge(instruction(member),
47
+ "carried_forward" => member.fetch("carried_forward").slice(*CARRIED_COMPACTLY))
52
48
  end
53
49
  end
54
50
 
55
- # Each member's template entry: a fresh assessment to fill in, or, for a member whose last assessment is
56
- # carried forward, the marker that keeps it (D49); either with its check's result when it has a check.
57
- #: () -> Array[Hash[String, untyped]]
58
- def templates = @members.map { |member| template(member) }
51
+ # What the template printed alone says of the checks before its members, since it has no context to show it in:
52
+ # the carried members whose template entry in templates still asks for a check_result, under
53
+ # carried_checks_to_run, named before the members so a reader skipping carried markers still runs each, and how
54
+ # to run and report the checks of each standing under shared_check_instructions, and each checked member's own
55
+ # lines by id under check_instructions; each only when it lists any.
56
+ #: (Array[Hash[String, untyped]]) -> Hash[String, untyped]
57
+ def checks_to_fill(templates)
58
+ carried = carried_checked(templates)
59
+ instructions = @members.to_h { [it.fetch("id"), check_template(it)&.own_instruction] }.compact
60
+ { "carried_checks_to_run" => carried, **shared_check_instructions, "check_instructions" => instructions }
61
+ .reject { _2.empty? }
62
+ end
59
63
 
60
- # Each member's template entry as the template printed alone gives it: a fresh assessment also prints
61
- # observation and observed_at after delivery, so reporting a sighting fills them (#1010).
62
- #: () -> Array[Hash[String, untyped]]
63
- def templates_to_fill
64
- templates.map do |entry|
65
- next entry unless entry.key?("delivery")
64
+ # The id of each carried member whose entry in templates still asks for a check_result.
65
+ #: (Array[Hash[String, untyped]]) -> Array[String]
66
+ def carried_checked(templates)
67
+ templates.select { it["carried_forward"] && it.key?("check_result") }.map { it.fetch("member_id") }
68
+ end
66
69
 
67
- entry.flat_map { |field, value| [[field, value], *(@sighting_placeholders if field == "delivery")] }.to_h
68
- end
70
+ # How to run and report the checks of each standing, once, with the ids of the members it is for, under
71
+ # shared_check_instructions, whose own lines check_instructions adds; nothing when none has a check.
72
+ #: () -> Hash[String, Array[Hash[String, untyped]]]
73
+ def shared_check_instructions
74
+ checks = @members.filter_map { |member| check_template(member)&.then { [member.fetch("id"), it] } }
75
+ return {} if checks.empty?
76
+
77
+ { "shared_check_instructions" => checks.group_by { |_, template| template.status }.map do |_, grouped|
78
+ { "member_ids" => grouped.map(&:first), "instruction" => grouped.fetch(0).last.shared_instruction }
79
+ end }
69
80
  end
70
81
 
71
- # Whether any member has a check, whose result's shapes the answer guide then shows (D30).
82
+ # Each member's template entry: a fresh assessment to fill in, or, for a member whose last assessment is
83
+ # carried forward, the marker that keeps it; either with its check's result when it has a check.
84
+ #: () -> Array[Hash[String, untyped]]
85
+ def templates = @members.map { |member| template(member) }
86
+
87
+ # Whether any member has a check, whose result's shapes the answer guide then shows.
72
88
  #: () -> bool
73
89
  def checked? = @members.any? { |member| member["check"] }
74
90
 
75
- # Whether any member's check is new or changed, so no audit ran it as it is now, to review before it runs (D63).
91
+ # Whether any member's check is new or changed, so no audit ran it as it is now, to review before it runs.
76
92
  #: () -> bool
77
93
  def check_to_review?
78
94
  @members.any? { |member| member["check"] && member.dig("check_since_last_audit", "status") != "unchanged" }
79
95
  end
80
96
 
81
- # Whether the request carries any member's last assessment forward (D49).
97
+ # Whether the request carries any member's last assessment forward.
82
98
  #: () -> bool
83
99
  def carried_forward? = @members.any? { |member| member["carried_forward"] }
84
100
 
85
- # Whether any member is judged afresh, whose template then gives a delivery (#983).
101
+ # Whether any member is judged afresh, whose template then gives a delivery.
86
102
  #: () -> bool
87
103
  def judged_afresh? = @members.any? { |member| !member["carried_forward"] }
88
104
 
89
- # Whether a carried member no flag fires on prints compactly, with no assessment (D93).
105
+ # Whether a carried member no flag fires on prints compactly, with no assessment.
90
106
  #: () -> bool
91
107
  def carried_compactly? = @members.any? { |member| compact?(member) }
92
108
 
93
- # Each reason a member is judged afresh, once (D61).
109
+ # Each reason a member is judged afresh, once.
94
110
  #: () -> Array[String]
95
111
  def judge_because = @members.filter_map { |member| member["judge_because"] }.uniq
96
112
 
97
- # Each entry naming another principle's role for a member's lines (#719).
113
+ # Each entry naming another principle's role for a member's lines.
98
114
  #: () -> Array[Hash[String, untyped]]
99
115
  def mapped_elsewhere = shown.flat_map { |member| member["mapped_elsewhere"] || [] }
100
116
 
101
117
  private
102
118
 
103
- # Whether member is carried with no flag firing on it, so it prints compactly (D93).
119
+ # Whether member is carried with no flag firing on it, so it prints compactly.
104
120
  #: (Hash[String, untyped]) -> bool
105
121
  def compact?(member) = member["carried_forward"] && !member["flagged"]
106
122
 
@@ -111,9 +127,23 @@ module Principles
111
127
  #: (Hash[String, untyped]) -> Hash[String, untyped]
112
128
  def template(member)
113
129
  assessed = member["carried_forward"] ? carried(member) : fresh(member)
114
- template = CheckResultTemplate.for(member, reviewed_placeholders: @reviewed_check_placeholders,
115
- unchanged_placeholders: @unchanged_check_placeholders)
116
- template ? assessed.merge("check_result" => template) : assessed
130
+ template = check_template(member)
131
+ template ? assessed.merge("check_result" => template.to_h) : assessed
132
+ end
133
+
134
+ # The check_result template of a checked member, with its instruction; nil for one without a check.
135
+ #: (Hash[String, untyped]) -> CheckResultTemplate?
136
+ def check_template(member)
137
+ CheckResultTemplate.for(member, reviewed_placeholders: @reviewed_check_placeholders,
138
+ unchanged_placeholders: @unchanged_check_placeholders)
139
+ end
140
+
141
+ # The member's own check_instruction, as the request's context shows it beside the member; none without a check
142
+ # or without lines of its own beside shared_check_instructions.
143
+ #: (Hash[String, untyped]) -> Hash[String, String]
144
+ def instruction(member)
145
+ own = check_template(member)&.own_instruction or return {}
146
+ { "check_instruction" => own }
117
147
  end
118
148
 
119
149
  #: (Hash[String, untyped]) -> Hash[String, untyped]
@@ -3,6 +3,7 @@
3
3
 
4
4
  require_relative "answer_head"
5
5
  require_relative "assessed_members"
6
+ require_relative "context_parts"
6
7
  require_relative "instruction"
7
8
  require_relative "prompts"
8
9
  require_relative "request_parts"
@@ -19,11 +20,11 @@ module Principles
19
20
  "as copy_from says."
20
21
  }.freeze #: Hash[String, String]
21
22
  # How mapped_elsewhere_instruction's paragraph on open findings elsewhere begins, which prints only when an
22
- # entry names one (#808).
23
+ # entry names one.
23
24
  OPEN_FINDINGS_ELSEWHERE = "Where an entry names `open_finding_ids`" #: String
24
25
 
25
- # The question every member's assessment answers, which a completed record digests with the description (D49):
26
- # the whole question, what observed means too, however much of it a request prints (#983).
26
+ # The question every member's assessment answers, which a completed record digests with the description:
27
+ # the whole question, what observed means too, however much of it a request prints.
27
28
  #: () -> String
28
29
  def self.question = question_paragraphs.join(" ")
29
30
 
@@ -37,10 +38,10 @@ module Principles
37
38
  # principle is the principle_id and description it names. head is what the answer hands back unchanged: the
38
39
  # request's id and its basis, the base commit and the last completed record's revision. parts are what the
39
40
  # agent reads beside the members before the question, such as the files outside the map that differ from the
40
- # base commit (#409), each with any slots it adds to the template (D60). placeholders is what the answer's own
41
- # fields print, by field, which their models own: collective_assessment's, which an answer may not send back
42
- # (#991), and recent_decision's, each field of both its forms, in the template alone, which the agent fills one
43
- # of (#994).
41
+ # base commit, each with any slots it adds to the template. placeholders is what the answer's own
42
+ # fields print, by field, which their models own: collective_assessment's, which an answer may not send back,
43
+ # and recent_decision's, each field of both its forms, in the template alone, which the agent fills one
44
+ # of.
44
45
  #: (principle: Hash[String, untyped], members: AssessedMembers, head: AnswerHead,
45
46
  #| placeholders: Hash[String, untyped], ?parts: Array[RequestPart]) -> void
46
47
  def initialize(principle:, members:, head:, placeholders:, parts: [])
@@ -59,15 +60,23 @@ module Principles
59
60
  # What the agent assesses, its other parts, the question and a guide to the answer's shapes.
60
61
  #: () -> Hash[String, untyped]
61
62
  def context
62
- listed = @principle.merge("members" => @members.shown)
63
+ listed = @principle.merge("members" => @members.shown, **@members.shared_check_instructions)
63
64
  @parts.shown_after(listed).merge(asked)
64
65
  end
65
66
 
66
67
  # The fields the request prints an instruction under, in the order it prints them: the question, the answer
67
- # guide and each field named for an instruction (D81 step 2).
68
+ # guide and each field named for an instruction.
68
69
  #: () -> Array[String]
69
70
  def instruction_fields = printed_instructions.map(&:field)
70
71
 
72
+ # The parts of the context start-audit --part prints alone, each member's with its lines now, by id, from texts,
73
+ # and each instruction field and the answer to fill as the request prints them; optional names each part the
74
+ # context lists only when it holds something.
75
+ #: (?texts: Hash[String, Array[String]], ?optional: Array[String]) -> ContextParts
76
+ def context_parts(texts: {}, optional: [])
77
+ ContextParts.new(context, instruction_fields:, template:, texts:, optional:)
78
+ end
79
+
71
80
  # The principle the request audits.
72
81
  #: () -> String
73
82
  def principle_id = @principle.fetch("principle_id")
@@ -87,13 +96,26 @@ module Principles
87
96
  end
88
97
 
89
98
  # The answer to fill in as printed alone, with no request beside it: each placeholder says what its field
90
- # takes, and points at nothing left unprinted (D81 step 1), after one note saying how a field left as printed is
91
- # read (#1043, D88).
99
+ # takes, and points at nothing left unprinted, after one note saying how a field left as printed is
100
+ # read, and the carried members whose check it still asks to run, named before the members so a
101
+ # reader skipping carried markers still runs each.
92
102
  #: () -> Hash[String, untyped]
93
103
  def template_to_fill
94
- filled = assessed(@placeholders.fetch("recent_decision"), @members.templates_to_fill)
104
+ members = @members.templates
105
+ filled = assessed(@placeholders.fetch("recent_decision"), members)
95
106
  @head.leading(@parts.filled_after({ "left_as_printed_rule" => @placeholders.fetch("left_as_printed_rule"),
96
- **filled, "findings" => [@placeholders.fetch("new_finding")] }))
107
+ **@members.checks_to_fill(members), **filled,
108
+ "findings" => [@placeholders.fetch("new_finding")] }))
109
+ end
110
+
111
+ # Whether a carried member's entry in the answer to fill prints a check_result slot to fill.
112
+ #: () -> bool
113
+ def carried_check_to_fill? = @members.carried_checked(@members.templates).any?
114
+
115
+ # Each member's slot of the answer printed alone, as template_to_fill prints it, by its part name, members/ID.
116
+ #: () -> Hash[String, Hash[String, untyped]]
117
+ def slots_to_fill
118
+ @members.templates.to_h { ["#{ContextParts::MEMBER}#{it.fetch("member_id")}", it] }
97
119
  end
98
120
 
99
121
  private
@@ -123,7 +145,7 @@ module Principles
123
145
  carried_forward_instruction, mapped_elsewhere_instruction, answer_guide]
124
146
  end
125
147
 
126
- # The question, defining observed only when a member is judged afresh, whose delivery it guides (#983).
148
+ # The question, defining observed only when a member is judged afresh, whose delivery it guides.
127
149
  #: () -> Instruction
128
150
  def question
129
151
  assess, observed = AssessmentRequest.question_paragraphs
@@ -131,7 +153,7 @@ module Principles
131
153
  end
132
154
 
133
155
  # Why each member with judge_because is judged afresh, explaining only the values the members carry, so the
134
- # agent meets each value's meaning where it meets the value (D61); nothing when no member gives one.
156
+ # agent meets each value's meaning where it meets the value; nothing when no member gives one.
135
157
  #: () -> Instruction
136
158
  def judge_because_instruction
137
159
  reasons = @members.judge_because
@@ -142,8 +164,8 @@ module Principles
142
164
  end
143
165
 
144
166
  # How to judge the roles other principles give a member's lines, printed only when a member shares lines with
145
- # another principle's (#719, D61), and, when an entry names findings open on its member, where to read how to
146
- # treat them, which prints apart, before the question (#808).
167
+ # another principle's, and, when an entry names findings open on its member, where to read how to
168
+ # treat them, which prints apart, before the question.
147
169
  #: () -> Instruction
148
170
  def mapped_elsewhere_instruction
149
171
  entries = @members.mapped_elsewhere
@@ -155,9 +177,9 @@ module Principles
155
177
  end
156
178
 
157
179
  # The answer guide, showing check_result's fields only when a member has a check, so an audit
158
- # with no checks costs no more context than before (D30), and delivery's shapes only when a member is judged
159
- # afresh, since a carried member's marker gives none (#983). check_result's limits say how to review a check
160
- # before running it only when a check is new or changed, as that check's own template says too (#983).
180
+ # with no checks costs no more context than before, and delivery's shapes only when a member is judged
181
+ # afresh, since a carried member's marker gives none. check_result's limits say how to review a check
182
+ # before running it only when a check is new or changed, as that check's own template says too.
161
183
  #: () -> GuideInstruction
162
184
  def answer_guide
163
185
  guide = Prompts.data("assess-every-member/answer-guide")
@@ -180,7 +202,7 @@ module Principles
180
202
  end
181
203
 
182
204
  # How to answer when the request carries some members' last assessments forward; nothing when it carries none.
183
- # What a compact carried member shows, and what prints one whole, only when one prints compactly (#983).
205
+ # What a compact carried member shows, and what prints one whole, only when one prints compactly.
184
206
  #: () -> Instruction
185
207
  def carried_forward_instruction
186
208
  carry = Prompts.text("assess-every-member/judge-the-set-with-carried-assessments")
@@ -10,8 +10,8 @@ module Principles
10
10
  # What this tool prints, from plain values a controller hands it. views/CLAUDE.md owns the boundary.
11
11
  module Views
12
12
  # What a completed audit changed in the project, as its result prints it: the files to commit, in git what
13
- # landed since the base commit, as LandedSinceBase prints it, each other principle whose members its fixes changed
14
- # (#410), each file the record cites that no longer exists (#861), and each member added to the map during the
13
+ # landed since the base commit, as LandedSinceBase prints it, each other principle whose members its fixes changed,
14
+ # each file the record cites that no longer exists, and each member added to the map during the
15
15
  # audit, which no assessment read, so the next full audit assesses it (T69).
16
16
  class AuditChanges
17
17
  #: (files_to_commit: Array[String], ?landed: LandedSinceBase?,
@@ -46,7 +46,7 @@ module Principles
46
46
  end
47
47
 
48
48
  # Refuses, staging nothing, while a merge is unfinished, whose commit would otherwise take in these files
49
- # (758f12b, #811), saying why on stderr, the one place the stop is explained (#828). It fails with false, not
49
+ # (758f12b), saying why on stderr, the one place the stop is explained. It fails with false, not
50
50
  # exit, so a shell running it outside the printed subshell survives; the braces keep a failed cd from reading
51
51
  # as a merge. The message is in single quotes, so it holds no apostrophe.
52
52
  NO_MERGE_UNFINISHED = '{ test ! -e "$(git rev-parse --git-path MERGE_HEAD)" || ' \
@@ -55,7 +55,7 @@ module Principles
55
55
 
56
56
  # In git, the command that commits the files to commit and nothing else staged, with subject, run from
57
57
  # project, where those paths are relative. Each path is quoted for the shell and read by git as written, since
58
- # project files anyone may have written name them (#227, #811). nil outside git, where it could not run.
58
+ # project files anyone may have written name them. nil outside git, where it could not run.
59
59
  #: (String, String) -> String?
60
60
  def commit_with(subject, project)
61
61
  return unless @landed
@@ -19,7 +19,7 @@ module Principles
19
19
  end
20
20
 
21
21
  # The command, and beside it what replacing its default subject asks, since an agent reading commit_with
22
- # alone would otherwise run the default (#853).
22
+ # alone would otherwise run the default.
23
23
  #: () -> Hash[String, String]
24
24
  def fields
25
25
  { "commit_with" => @command,
@@ -27,12 +27,13 @@ module Principles
27
27
  subject: @subject) }
28
28
  end
29
29
 
30
- # The step that commits the files, the command ending its line (#811), up to the report that follows; its
31
- # wording is its prompt's. Why the command stops during a merge is its own to say, on stderr (#828).
30
+ # The step that commits the files with commit_with's command, which it names rather than prints a second time,
31
+ # up to the report that follows; its wording is its prompt's. Why the command stops during a
32
+ # merge is its own to say, on stderr.
32
33
  #: () -> String
33
34
  def next_step
34
35
  commit = Prompts.text("report-the-completed-audit/commit-only-what-the-audit-changed",
35
- files: ProseList.new(@files_to_commit).to_s, command: @command)
36
+ files: ProseList.new(@files_to_commit).to_s)
36
37
  "#{commit}\nThen"
37
38
  end
38
39