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
@@ -8,6 +8,7 @@ require_relative "../models/problem_report"
8
8
  require_relative "../views/record_waiting_on_an_upgrade"
9
9
  require_relative "../views/problem_result"
10
10
  require_relative "../views/problem_lines"
11
+ require_relative "../views/first_audit_line"
11
12
 
12
13
  module Principles
13
14
  # Each runs one command: reads models, applies their rules and prints through a view.
@@ -23,10 +24,37 @@ module Principles
23
24
  end
24
25
  end
25
26
 
27
+ # What report-at-session-start prints of every map's members, a line each, refused as list-member-problems
28
+ # refuses: the lines --short --session-start SOURCE prints on stdout, then, in git, what gives each principle's
29
+ # members with no baseline one, then each principle whose audits wait on an upgrade, whose members are not
30
+ # counted. Outside git only an audit gives a baseline, so that line would repeat at every session.
31
+ #: (String) -> Array[String]
32
+ def session_start_lines(source)
33
+ printing = invocation.without_project
34
+ problems, (report,) = checked(nil, printing)
35
+ lines = Views::ProblemLines.new(printing)
36
+ .session_start_lines(changed: problems.assessed_changes, source:, skill: skill?)
37
+ lines + not_checked_lines(problems, report, printing, source)
38
+ end
39
+
26
40
  private
27
41
 
28
- # list-member-problems' JSON result, or with --short its lines for a trigger (#291), or with --hook-event the
29
- # after-commit hook's JSON, which MembersACommitChanged prints (D73).
42
+ # The session-start lines on members this check cannot judge yet, after those counting the changed ones: what
43
+ # gives members with no baseline one, then each principle whose audits wait on an upgrade, then, worded for the
44
+ # session's source, the line asking for one subagent to run a first full audit while any principle awaits one.
45
+ #: (Models::ProblemReport, Hash[String, untyped], Views::Invocation, String) -> Array[String]
46
+ def not_checked_lines(problems, report, printing, source)
47
+ no_baseline_lines(problems, report, printing) + waiting(nil).map(&:to_s) +
48
+ Views::FirstAuditLine.new(printing).lines(problems.awaiting_first_audit.length, source)
49
+ end
50
+
51
+ # Whether this session has the principles skill, which only the plugin installs, for the lines naming where
52
+ # to start.
53
+ #: () -> bool
54
+ def skill? = @tool.runs_from.principles_skill_in_this_session?
55
+
56
+ # list-member-problems' JSON result, or with --short its lines for a trigger, or with --hook-event the
57
+ # after-commit hook's JSON, which MembersACommitChanged prints.
30
58
  #: (String?, Hash[String, untyped]) -> untyped
31
59
  def printed(id, options)
32
60
  if (event = options["hook_event"])
@@ -34,45 +62,71 @@ module Principles
34
62
  .printed(after: options.fetch("commits_after"), event: event)
35
63
  end
36
64
 
37
- problems, report = checked(id)
38
- return report.merge("wrote" => []) unless options["short"]
65
+ return checked_report(id).merge("wrote" => []) unless options["short"]
66
+
67
+ short(id, session_start: options["session_start"], named: options.key?("project"))
68
+ end
69
+
70
+ # list-member-problems --short's lines for map id, or every map, and the exit status they end with; with
71
+ # --session-start, a count and command per principle in place of the rows.
72
+ # session_start is the source --session-start names, or nil without it. named says whether the run was given
73
+ # --project, which its commands then name; else its stderr names the project once and they leave it
74
+ # out.
75
+ #: (String?, session_start: String?, named: bool) -> Views::Lines
76
+ def short(id, session_start:, named:)
77
+ printing = named ? invocation : invocation.without_project
78
+ problems, (report, names_a_command) = checked(id, printing)
79
+ view = Views::ProblemLines.new(printing)
80
+ lines = view.short(report, nothing_changed: Views::ProblemResult::NOTHING_CHANGED,
81
+ assessed_change: problems.assessed_change?,
82
+ never_assessed: problems.never_assessed, names_a_command:)
83
+ return lines unless session_start
39
84
 
40
- Views::ProblemLines.new(invocation).short(report, nothing_changed: Views::ProblemResult::NOTHING_CHANGED,
41
- assessed_change: problems.assessed_change?,
42
- unassessed_change: problems.unassessed_change?)
85
+ view.at_session_start(lines, changed: problems.assessed_changes, source: session_start, skill: skill?)
43
86
  end
44
87
 
45
88
  # list-member-problems' JSON result for map id, or every map, without the files it wrote.
46
89
  #: (String?) -> Hash[String, untyped]
47
- def checked_report(id) = checked(id).last
48
-
49
- # The problems of map id, or every map, and list-member-problems' JSON result for them, naming each principle
50
- # whose record a later copy wrote as waiting on an upgrade, its members compared read-only (D85 V8, #1066).
51
- #: (String?) -> [Models::ProblemReport, Hash[String, untyped]]
52
- def checked(id)
53
- waiting = (id ? [id] : @principles.ids).filter_map { waiting_on_an_upgrade(it) }
54
- problems = Models::ProblemReport.new(problems_of(id), history: @history)
55
- [problems, member_problems(problems, waiting)]
90
+ def checked_report(id) = checked(id).last.first
91
+
92
+ # The problems of map id, or every map, and list-member-problems' JSON result for them, with whether its
93
+ # next_action names a command, naming each principle whose record a later copy wrote as waiting on an upgrade,
94
+ # its members compared read-only. printing is the invocation its commands name.
95
+ #: (String?, ?Views::Invocation) -> [Models::ProblemReport, [Hash[String, untyped], bool]]
96
+ def checked(id, printing = invocation)
97
+ waiting = waiting(id)
98
+ problems = Models::ProblemReport.for(@project, id)
99
+ [problems, member_problems(problems, waiting, printing)]
100
+ end
101
+
102
+ # Each principle, map id's or every map's, whose record a later copy wrote, so its audits wait on an upgrade.
103
+ #: (String?) -> Array[Views::RecordWaitingOnAnUpgrade]
104
+ def waiting(id) = (id ? [id] : @principles.ids).filter_map { waiting_on_an_upgrade(it) }
105
+
106
+ # In git, what gives each principle's members with no baseline one, from problems and report, its result; none
107
+ # outside git.
108
+ #: (Models::ProblemReport, Hash[String, untyped], Views::Invocation) -> Array[String]
109
+ def no_baseline_lines(problems, report, printing)
110
+ return [] unless @history.inside_git?
111
+
112
+ Views::ProblemResult.new(printing).no_baseline_actions(report, problems.files_to_commit(@principles))
113
+ .map(&:to_s)
56
114
  end
57
115
 
58
- # The result for problems, every member of map id or of every map that is broken or whose own text changed
59
- # (#187), and each principle waiting on an upgrade.
60
- #: (Models::ProblemReport, Array[Views::RecordWaitingOnAnUpgrade]) -> untyped
61
- def member_problems(problems, waiting)
116
+ # The result for problems, every member of map id or of every map that is broken or whose own text changed,
117
+ # and each principle waiting on an upgrade.
118
+ #: (Models::ProblemReport, Array[Views::RecordWaitingOnAnUpgrade], Views::Invocation)
119
+ #| -> [Hash[String, untyped], bool]
120
+ def member_problems(problems, waiting, printing)
62
121
  report = problems.checked do |map_id, member, baseline, now, mapping|
63
122
  @project.principle_history(map_id, mapping: mapping).member_history(member, baseline: baseline, now: now)
64
123
  end
65
- Views::ProblemResult.new(invocation).checked(report, not_read: @project.unread_older_files,
124
+ Views::ProblemResult.new(printing)
125
+ .checked_naming_commands(report, not_read: @project.unread_older_files,
66
126
  no_baseline_files: problems.files_to_commit(@principles),
67
- acknowledgeable: problems.acknowledgeable, waiting:)
68
- end
69
-
70
- # Map id's members against their baselines, or every map's, listing a map it cannot read among them.
71
- #: (String?) -> Array[Models::MemberProblems]
72
- def problems_of(id)
73
- return [Models::MemberProblems.for(@project, id)] if id
74
-
75
- @principles.ids.map { Models::MemberProblems.for(@project, it, listing_all: true) }
127
+ acknowledgeable: problems.acknowledgeable_together(
128
+ except: waiting.map(&:principle)
129
+ ), waiting:)
76
130
  end
77
131
  end
78
132
  end
@@ -9,7 +9,7 @@ module Principles
9
9
  # controllers/CLAUDE.md owns the boundary.
10
10
  module Controllers
11
11
  # list-member-problems --commits-after COMMIT --hook-event EVENT, which the plugin's after-commit hook runs once a
12
- # Bash call moved HEAD (D73): the members the commits after COMMIT changed, as the hook's JSON, or nothing. It
12
+ # Bash call moved HEAD: the members the commits after COMMIT changed, as the hook's JSON, or nothing. It
13
13
  # exits 0 whatever it finds, since the host shows the user an error for any other status, and reports a refusal
14
14
  # only when those commits could have caused it, so a broken setup does not repeat at every commit (review R8).
15
15
  class MembersACommitChanged < Command
@@ -38,7 +38,7 @@ module Principles
38
38
  private
39
39
 
40
40
  # The hook's output naming changed, the members the commits changed, beside others still listed, with the wait
41
- # of each of their principles whose record a later copy wrote, which says why their audits wait (D85 V8, #1066).
41
+ # of each of their principles whose record a later copy wrote, which says why their audits wait.
42
42
  #: (String, Array[Hash[String, untyped]], others: Integer) -> Views::Lines
43
43
  def changed_lines(event, changed, others:)
44
44
  waits = changed.map { it.fetch("principle") }.uniq.filter_map { waiting_on_an_upgrade(it) }
@@ -46,7 +46,7 @@ module Principles
46
46
  end
47
47
 
48
48
  #: () -> Views::MembersACommitChanged
49
- def view = Views::MembersACommitChanged.new(invocation)
49
+ def view = Views::MembersACommitChanged.new(invocation, skill: @tool.runs_from.principles_skill_in_this_session?)
50
50
  end
51
51
  end
52
52
  end
@@ -6,7 +6,7 @@ require_relative "../models/carried_member"
6
6
  require_relative "../models/check_since_last_audit"
7
7
  require_relative "../models/open_findings_elsewhere"
8
8
  require_relative "../views/acknowledged_since_last_audit"
9
- require_relative "../views/diff_since_last_audit"
9
+ require_relative "../views/read_the_change"
10
10
 
11
11
  module Principles
12
12
  # Each runs one command: reads models, applies their rules and prints through a view.
@@ -16,7 +16,7 @@ module Principles
16
16
  # it, beside what the principle's audit record says of it since the last full audit.
17
17
  class MembersToAssess < Command
18
18
  # The members a full audit's request lists, each as the agent assesses it, and the findings other principles
19
- # leave open on members sharing their lines, each once, which each member's mapped_elsewhere names by id (D62).
19
+ # leave open on members sharing their lines, each once, which each member's mapped_elsewhere names by id.
20
20
  class Listing
21
21
  #: Array[Hash[String, untyped]]
22
22
  attr_reader :members
@@ -46,8 +46,8 @@ module Principles
46
46
  # Each member of audit's map as the assessment request shows it, located as current has it: id, role, lines,
47
47
  # the evidence that locates it and the check that enforces it, if any, with whether the last audit already had
48
48
  # it run, the edits to it acknowledged since that audit, its last assessment carried forward by audit, or why
49
- # it is judged again (D49) with the command that shows its file's edits since that audit (#771), and the other
50
- # principles' members sharing its lines (#719), beside the findings their principles leave open on them (D62).
49
+ # it is judged again with the command that shows its file's edits since that audit, and the other
50
+ # principles' members sharing its lines, beside the findings their principles leave open on them.
51
51
  #: (Models::Audit, Models::MemberSnapshots) -> Listing
52
52
  def listed(audit, current)
53
53
  map = audit.map
@@ -68,18 +68,18 @@ module Principles
68
68
  member = Models::Member.new(fields)
69
69
  judged = carried(member, carried, elsewhere)
70
70
  located(member, current).merge(checked(member), acknowledged(fields), judged,
71
- changed_since(fields, judged), shared_lines(member, elsewhere))
71
+ changed_since(fields, judged, current), shared_lines(member, elsewhere))
72
72
  end
73
73
 
74
74
  # Each finding elsewhere names, once, with each evidence item's lines beside this audit's members, where current
75
- # locates them; the project locates each item now (D64).
75
+ # locates them; the project locates each item now.
76
76
  #: (Models::OpenFindingsElsewhere, Models::MemberSnapshots) -> Array[Hash[String, untyped]]
77
77
  def elsewhere_listed(elsewhere, current)
78
78
  elsewhere.listed(current.audited_lines) { |locator| @project.located_text(locator) }
79
79
  end
80
80
 
81
81
  # The other principles' members sharing a line with each member of map where current locates it, with the
82
- # findings their records leave open on them, each record read once (#772, D62). The request id hashes this
82
+ # findings their records leave open on them, each record read once. The request id hashes this
83
83
  # principle's members, not other maps or their records: another principle changing after the request is its
84
84
  # own audit to judge, and does not make this one stale.
85
85
  #: (Models::Principle, Models::MemberSnapshots) -> Models::OpenFindingsElsewhere
@@ -91,8 +91,8 @@ module Principles
91
91
  end
92
92
 
93
93
  # The other principles' members sharing a line with member, each with its role there, so a contradiction
94
- # between the two maps shows in this audit (#719), naming the findings that principle leaves open on it, so one
95
- # problem is not raised under both (#772, D62); nothing when there are none.
94
+ # between the two maps shows in this audit, naming the findings that principle leaves open on it, so one
95
+ # problem is not raised under both; nothing when there are none.
96
96
  #: (Models::Member, Models::OpenFindingsElsewhere) -> Hash[String, untyped]
97
97
  def shared_lines(member, elsewhere)
98
98
  Views::LinesSharedWithMember.new(mapped_elsewhere: elsewhere.beside(member.id)).to_h
@@ -100,9 +100,9 @@ module Principles
100
100
 
101
101
  # The member's last assessment carried forward, with whether any evidence it cited changed since and, in git,
102
102
  # whether its file changed since the last full audit's base commit, outside the member, whose own text did not;
103
- # or why it is judged again. These are facts: the agent may re-judge any carried member (D49). flagged says
103
+ # or why it is judged again. These are facts: the agent may re-judge any carried member. flagged says
104
104
  # whether any fires, or another principle leaves a finding open on its lines, so the request prints the member
105
- # whole rather than compactly (D93).
105
+ # whole rather than compactly.
106
106
  #: (Models::Member, Models::CarriedAssessments, Models::OpenFindingsElsewhere) -> Hash[String, untyped]
107
107
  def carried(member, carried, elsewhere)
108
108
  shown = carried.shown(member.id) { |locator, sha| evidence_changed?(locator, sha) }
@@ -136,20 +136,23 @@ module Principles
136
136
  .merge(current.of(member.id).lines)
137
137
  end
138
138
 
139
- # The command that shows the edits to a member judged again to its file since the last full audit's base
140
- # commit, over its path then and now (#557, #771); nothing for a member carried forward, or with no such
141
- # commit, as outside git or before any full audit.
142
- #: (Hash[String, untyped], Hash[String, untyped]) -> Hash[String, untyped]
143
- def changed_since(fields, judged)
139
+ # The command that shows the edits to a member judged again since the last full audit's base commit: to its
140
+ # own lines, where current locates them, for part of a file at the same path then and now; else to its file,
141
+ # over its path then and now. Nothing for a member carried forward, or with no such commit, as outside git or
142
+ # before any full audit.
143
+ #: (Hash[String, untyped], Hash[String, untyped], Models::MemberSnapshots) -> Hash[String, untyped]
144
+ def changed_since(fields, judged, current)
144
145
  base = @completed&.base_commit
145
146
  return {} unless judged["judge_because"] && base
146
147
 
147
- paths = principle_history(@principle_id).paths_from(base, Models::Member.new(fields).key, fields)
148
- { "read_the_change" => Views::DiffSinceLastAudit.new(last_audited_commit: base, paths: paths).to_s }
148
+ member = Models::Member.new(fields)
149
+ paths = principle_history(@principle_id).paths_from(base, member.key, fields)
150
+ lines = member.traced_lines(paths, current.of(member.id).lines)
151
+ { "read_the_change" => Views::ReadTheChange.new(since: base, paths:, lines:).to_s }
149
152
  end
150
153
 
151
- # The edits to member acknowledged since the last full audit, which this audit judges together (D33, #312), with
152
- # its lines then and now; its read_the_change shows the whole change (#771).
154
+ # The edits to member acknowledged since the last full audit, which this audit judges together, with
155
+ # its lines then and now; its read_the_change shows the whole change.
153
156
  #: (Hash[String, untyped]) -> Hash[String, untyped]
154
157
  def acknowledged(fields)
155
158
  last = @completed or return {}
@@ -4,7 +4,6 @@
4
4
  require_relative "command"
5
5
  require_relative "inventory"
6
6
  require_relative "../models/entry_files"
7
- require_relative "../models/runs_from"
8
7
  require_relative "../models/meta_principle"
9
8
  require_relative "../models/text_size"
10
9
  require_relative "../views/meta_principle_result"
@@ -14,7 +13,7 @@ module Principles
14
13
  # controllers/CLAUDE.md owns the boundary.
15
14
  module Controllers
16
15
  # Setting principles up: shows the map of the principle that keeps every other one held, and proposes its passage
17
- # for the agent to place with the user, since this tool writes none of the project's guidance (D67, D68); the
16
+ # for the agent to place with the user, since this tool writes none of the project's guidance; the
18
17
  # add-member it prints writes the map (T74). It takes no id, since the principle is the product's own.
19
18
  class MetaPrincipleSetup < Command
20
19
  #: (String, String?, Hash[String, untyped]) -> untyped
@@ -39,7 +38,7 @@ module Principles
39
38
  end
40
39
 
41
40
  # map as the project holds it: whether it was there before this run, its members already in an entry file, and
42
- # whether principles is set up, its map having a member (D75).
41
+ # whether principles is set up, its map having a member.
43
42
  #: (Models::Principle) -> Views::MetaPrincipleResult::MapInProject
44
43
  def map_in_project(map)
45
44
  Views::MetaPrincipleResult::MapInProject.new(
@@ -56,7 +55,7 @@ module Principles
56
55
  # entry files, and the passage.
57
56
  #: (Views::MetaPrincipleResult) -> Views::MetaPrincipleResult::Placement
58
57
  def placement(view)
59
- runs_from = Models::RunsFrom.new(@tool.executable)
58
+ runs_from = @tool.runs_from
60
59
  Views::MetaPrincipleResult::Placement.new(
61
60
  runs_from: runs_from.to_s, session_start_hook_in_this_session: runs_from.session_start_hook_in_this_session?,
62
61
  entry_files: @project.entry_files.to_a, passage: passage(view)
@@ -70,7 +69,7 @@ module Principles
70
69
  end
71
70
 
72
71
  # The passage member's heading and role, the role of a passage the project has that carries one of its steps,
73
- # and the role of any other place that keeps the principles held (D75).
72
+ # and the role of any other place that keeps the principles held.
74
73
  #: () -> Views::MetaPrincipleResult::PassageMapping
75
74
  def passage_mapping
76
75
  Views::MetaPrincipleResult::PassageMapping.new(heading: Models::MetaPrinciple::PASSAGE_HEADING,
@@ -80,7 +79,7 @@ module Principles
80
79
  end
81
80
 
82
81
  # The passage's text, as the agent pastes it, with its size, which loads in every session (F9), and what it
83
- # presumes of a teammate without principles (D71).
82
+ # presumes of a teammate without principles.
84
83
  #: (Views::MetaPrincipleResult) -> Hash[String, untyped]
85
84
  def passage(view)
86
85
  text = view.passage
@@ -0,0 +1,42 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ require_relative "command"
5
+ require_relative "../models/disposition"
6
+ require_relative "../models/open_correction"
7
+ require_relative "../views/answer_head"
8
+ require_relative "../views/correction_request"
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-open-correction: the answer to fill for the correction a full audit's assessment with findings opened,
15
+ # printed from the open record that keeps it, which submit-answer names rather than prints, and whenever the
16
+ # agent loses it, without submitting the assessment again.
17
+ class OpenCorrection < Command
18
+ #: (String, String?, Hash[String, untyped]) -> untyped
19
+ def call(command, id, _options)
20
+ naming_the_executable do
21
+ unknown(command) unless command == "show-open-correction"
22
+
23
+ principle_id = required_id(id)
24
+ @principles.find(principle_id)
25
+ correction_to_fill(principle_id)
26
+ end
27
+ end
28
+
29
+ private
30
+
31
+ # The open correction's answer alone, as show-answer-check --as template prints it before the submit.
32
+ #: (String) -> Hash[String, untyped]
33
+ def correction_to_fill(principle_id)
34
+ kept = Models::OpenCorrection.kept(principle_id, @audit_records.find(principle_id),
35
+ file: @audit_records.file(principle_id))
36
+ head = Views::AnswerHead.new(request_id: kept.request_id, basis: kept.basis)
37
+ Views::CorrectionRequest.new(head:, principle_id:, findings: kept.findings,
38
+ placeholders: Models::Disposition::TEMPLATE_PLACEHOLDERS).correction_to_fill
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,117 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ require_relative "command"
5
+ require_relative "../models/evidence_lines_since"
6
+ require_relative "../models/loading_decision"
7
+ require_relative "../models/other_principles"
8
+ require_relative "../models/prior_decision_fields"
9
+ require_relative "../models/uncommitted_outside_the_map"
10
+ require_relative "../views/loads_to_check_result"
11
+ require_relative "../views/open_findings_elsewhere_result"
12
+ require_relative "../views/other_principles_unjudged_result"
13
+ require_relative "../views/outside_the_map_result"
14
+ require_relative "../views/package_since_last_audit_result"
15
+ require_relative "../views/prior_findings_result"
16
+ require_relative "members_to_assess"
17
+
18
+ module Principles
19
+ # Each runs one command: reads models, applies their rules and prints through a view.
20
+ # controllers/CLAUDE.md owns the boundary.
21
+ module Controllers
22
+ # The parts a full audit's request lists beside its members, which FullAuditRequest hands over: each a list the
23
+ # agent reads, with its instruction and its slots in the answer.
24
+ class PartsToRead < Command
25
+ # Each part listed only when it holds something, which start-audit --part answers as empty when it is left out.
26
+ OPTIONAL = [Views::OutsideTheMapResult::PART, Views::PriorFindingsResult::PART,
27
+ Views::OpenFindingsElsewhereResult::PART, Views::LoadsToCheckResult::PART,
28
+ Views::PackageSinceLastAuditResult::PART,
29
+ Views::OtherPrinciplesUnjudgedResult::PART].freeze #: Array[String]
30
+
31
+ # audit is the audit asked of the principle's map, listing the members its request lists and audited_files the
32
+ # files its base commit is judged over.
33
+ #: (Models::Project, tool: RunningTool, audit: Models::Audit, listing: MembersToAssess::Listing,
34
+ #| audited_files: Array[String]) -> void
35
+ def initialize(project, tool:, audit:, listing:, audited_files:)
36
+ super(project, tool: tool)
37
+ @id = audit.map.id #: String
38
+ @audit = audit
39
+ @listing = listing
40
+ @audited_files = audited_files
41
+ end
42
+
43
+ # What the agent reads beside the members, in order: the files outside the map that differ from the
44
+ # base commit, which a check and the answer's evidence read as they are now; the prior findings;
45
+ # the findings other principles leave open on members sharing these lines; and the members to
46
+ # check against the activation; each when it lists any; and, on the meta-principle's audit, the release
47
+ # since its last audit and the other principles with members no audit has judged.
48
+ #: (Models::PriorFindings, Hash[String, untyped]?) -> Array[Views::RequestPart]
49
+ def listed(prior, loads)
50
+ map = @audit.map
51
+ [outside_the_map, prior_findings_part(prior),
52
+ Views::OpenFindingsElsewhereResult.new(@listing.open_findings_elsewhere).part,
53
+ loads_part(loads), package_since_last_audit(map),
54
+ other_principles_unjudged(map)].compact
55
+ end
56
+
57
+ private
58
+
59
+ # The part listing the members to check against the activation, each decision's template printing the
60
+ # placeholders an answer leaves as printed to give none; nil when none is listed.
61
+ #: (Hash[String, untyped]?) -> Views::RequestPart?
62
+ def loads_part(loads)
63
+ Views::LoadsToCheckResult.new(invocation, loads, @id, placeholders: Models::LoadingDecision::PLACEHOLDERS.to_h)
64
+ .part
65
+ end
66
+
67
+ # The part listing each other principle with members no audit has judged as they are now, as
68
+ # list-member-problems reports them, for the principle whose audit states them; nil for any other.
69
+ #: (Models::Principle) -> Views::RequestPart?
70
+ def other_principles_unjudged(map)
71
+ return unless map.keeps_others_held?
72
+
73
+ listed = Models::OtherPrinciples.of(@project, but: map.id).unjudged.map do |other, members|
74
+ Views::PrincipleWithChangedMembers.new(principle_id: other, members: members)
75
+ end
76
+ Views::OtherPrinciplesUnjudgedResult.new(listed).part
77
+ end
78
+
79
+ # The part stating the release of principles the last completed audit ran under beside the one now, and
80
+ # whether the passage changed since, for a principle whose audit keeps one; nil for any other.
81
+ #: (Models::Principle) -> Views::RequestPart?
82
+ def package_since_last_audit(map)
83
+ now = @tool.release_kept_by(map) or return
84
+ last = @audit_records.find(map.id)&.last_completed&.package
85
+ Views::PackageSinceLastAuditResult.new(invocation, at_last_audit: last&.version, now: now.version,
86
+ passage_changed: last && now.passage_changed_since?(last),
87
+ mapped: package_parts_mapped(map))
88
+ .part
89
+ end
90
+
91
+ # Each part of principles an upgrade can change that map's members are, from the hooks every host reads and,
92
+ # where a member's part asks, its text now.
93
+ #: (Models::Principle) -> Array[String]
94
+ def package_parts_mapped(map)
95
+ hooks = @project.hook_commands(Models::HookCommands::ON_EVERY_HOST)
96
+ map.members.package_parts(hooks) { |member| @project.member_text(member.locator) }
97
+ end
98
+
99
+ # The part listing the prior findings, in git with each evidence item saying whether its text changed since the
100
+ # commit the audit that left them open was based on, and whether it is found now; nil when there are
101
+ # none.
102
+ #: (Models::PriorFindings) -> Views::RequestPart?
103
+ def prior_findings_part(prior)
104
+ shown = prior.shown { |item, base| Models::EvidenceLinesSince.of(item, since: base, project: @project).facts }
105
+ Views::PriorFindingsResult.new(shown, placeholders: Models::PriorDecisionFields::TEMPLATE_PLACEHOLDERS,
106
+ last_audited_commit: prior.last_audited_commit).part
107
+ end
108
+
109
+ # The part naming the files outside the map that differ from the base commit, or nil when none do.
110
+ #: () -> Views::RequestPart?
111
+ def outside_the_map
112
+ outside = @history.uncommitted_outside(@audited_files)
113
+ Views::OutsideTheMapResult.new(outside && Models::UncommittedOutsideTheMap.new(outside).shown).part
114
+ end
115
+ end
116
+ end
117
+ end
@@ -13,7 +13,7 @@ module Principles
13
13
  # Each runs one command: reads models, applies their rules and prints through a view.
14
14
  # controllers/CLAUDE.md owns the boundary.
15
15
  module Controllers
16
- # A repoint of a principle's open findings' write-ups (D59): start-audit ID --write-ups lists each open finding
16
+ # A repoint of a principle's open findings' write-ups: start-audit ID --write-ups lists each open finding
17
17
  # with where its write-up is now, and submit-answer points the recorded_at the agent gives in the audit record.
18
18
  class Repoint < AnswerPhase
19
19
  # The request for principle id's open findings.
@@ -3,6 +3,9 @@
3
3
 
4
4
  require_relative "../models/meta_principle"
5
5
  require_relative "../models/principles_package"
6
+ require_relative "../models/principles_on_path"
7
+ require_relative "../models/runs_from"
8
+ require_relative "../views/invocation"
6
9
  require_relative "../views/meta_principle_passage"
7
10
 
8
11
  module Principles
@@ -12,23 +15,63 @@ module Principles
12
15
  # This run of the tool, as its entry point was invoked: the executable every printed command names, and the
13
16
  # version running, which only the command line can read; and so the release of principles it comes from.
14
17
  class RunningTool
15
- #: String
16
- attr_reader :executable
18
+ # The command a printed command names when a bare principles runs this same copy, the name the plugin's
19
+ # entry point gives itself for the same reason.
20
+ ON_PATH = Models::RunsFrom::PLUGIN_EXECUTABLE
17
21
 
18
22
  # version gives the version running, read only when a command needs it, since in a checkout reading it
19
- # asks git.
20
- #: (executable: String, version: ^() -> String) -> void
21
- def initialize(executable:, version:)
23
+ # asks git; other_on_path gives the path and printed version of another principles earlier on PATH than this
24
+ # one, and which of the commands it is asked about that copy does not run, or nil, read only when a command
25
+ # needs it, since reading it starts that copy; launched_on_path says
26
+ # whether this run was launched as the first principles on PATH, as a RubyGems binstub is, so a bare
27
+ # principles runs this same copy; cwd is the folder this run was started in, by its real path, or nil.
28
+ #: (executable: String, version: ^() -> String,
29
+ #| ?other_on_path: ^(Array[String]) -> [String, String, Array[String]]?, ?launched_on_path: ^() -> bool,
30
+ #| ?cwd: String?) -> void
31
+ def initialize(executable:, version:, other_on_path: ->(_) {}, launched_on_path: -> { false }, cwd: nil)
22
32
  @executable = executable
23
33
  @version = version
34
+ @other_on_path = other_on_path
35
+ @launched_on_path = launched_on_path
36
+ @cwd = cwd
24
37
  freeze
25
38
  end
26
39
 
40
+ # The executable every printed command names: the bare principles when that runs this copy, else the entry
41
+ # point's own.
42
+ #: () -> String
43
+ def executable = bare_from_path? ? ON_PATH : @executable
44
+
27
45
  #: () -> String
28
46
  def version = @version.call
29
47
 
48
+ # Whether this run was launched as the first principles on PATH, so a bare principles runs this same copy.
49
+ #: () -> bool
50
+ def launched_on_path? = @launched_on_path.call
51
+
52
+ # Where this run comes from, by the entry point it was invoked through, whatever its commands are printed as.
53
+ #: () -> Models::RunsFrom
54
+ def runs_from = Models::RunsFrom.new(@executable)
55
+
56
+ # The executable and project that this run's printed commands name, for the project at root. A command line run
57
+ # printed as the bare principles, from root itself, leaves out --project, since a command copied from its
58
+ # output runs there too; any other run names the project, as the plugin's hooks and a checkout's commands may
59
+ # be run from elsewhere.
60
+ #: (String) -> Views::Invocation
61
+ def invocation(root)
62
+ Views::Invocation.new(executable: executable, project: root, named: !bare_from_path? || root != @cwd)
63
+ end
64
+
65
+ # Another principles earlier on PATH than this one, which a bare principles command runs in its place, asked
66
+ # whether it runs each command of asking, or nil.
67
+ #: (?asking: Array[String]) -> Models::PrinciplesOnPath?
68
+ def other_on_path(asking: [])
69
+ path, version, lacking = @other_on_path.call(asking)
70
+ path && version ? Models::PrinciplesOnPath.new(path, version, lacking: lacking || []) : nil
71
+ end
72
+
30
73
  # The release of principles this run comes from, as the audit of map's principle keeps it: the version running
31
- # and the passage as setup prints it, which only a view holds; nil for a principle whose audit keeps none (D68).
74
+ # and the passage as setup prints it, which only a view holds; nil for a principle whose audit keeps none.
32
75
  #: (Models::Principle) -> Models::PrinciplesPackage?
33
76
  def release_kept_by(map)
34
77
  return unless map.keeps_package?
@@ -36,6 +79,13 @@ module Principles
36
79
  passage = Views::MetaPrinciplePassage.new(heading: Models::MetaPrinciple::PASSAGE_HEADING).text
37
80
  Models::PrinciplesPackage.of(version: version, passage: passage)
38
81
  end
82
+
83
+ private
84
+
85
+ # Whether a command line run, not the plugin's, was launched as the first principles on PATH, so its commands
86
+ # are printed as the bare principles.
87
+ #: () -> bool
88
+ def bare_from_path? = @executable != ON_PATH && launched_on_path?
39
89
  end
40
90
  end
41
91
  end