principles 0.0.7 → 0.0.9

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 (334) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +409 -0
  3. data/LICENSE +202 -0
  4. data/NOTICE +4 -0
  5. data/README.md +145 -0
  6. data/exe/principles +20 -0
  7. data/lib/principles/after_commit_hook_options.rb +2 -2
  8. data/lib/principles/cli.rb +50 -42
  9. data/lib/principles/command_line.rb +22 -16
  10. data/lib/principles/command_routes.rb +20 -6
  11. data/lib/principles/controllers/acknowledgement.rb +29 -74
  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 +48 -18
  15. data/lib/principles/controllers/answer_phase.rb +20 -3
  16. data/lib/principles/controllers/assessment.rb +32 -11
  17. data/lib/principles/controllers/audit.rb +46 -20
  18. data/lib/principles/controllers/audit_completion.rb +21 -12
  19. data/lib/principles/controllers/command.rb +13 -12
  20. data/lib/principles/controllers/correction.rb +15 -7
  21. data/lib/principles/controllers/first_audit_brief.rb +40 -0
  22. data/lib/principles/controllers/full_audit_request.rb +41 -82
  23. data/lib/principles/controllers/hook_setup.rb +49 -0
  24. data/lib/principles/controllers/inventory.rb +25 -13
  25. data/lib/principles/controllers/mapping.rb +2 -2
  26. data/lib/principles/controllers/member_acknowledgement.rb +32 -21
  27. data/lib/principles/controllers/member_entries.rb +4 -4
  28. data/lib/principles/controllers/member_problems_report.rb +62 -16
  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 +64 -9
  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 +21 -7
  54. data/lib/principles/data/running_version.rb +11 -9
  55. data/lib/principles/data/schema_check.rb +5 -5
  56. data/lib/principles/data/schemas/acknowledgement-answer.schema.json +86 -21
  57. data/lib/principles/data/schemas/acknowledgements-answer.schema.json +9 -2
  58. data/lib/principles/data/schemas/assessment-answer.schema.json +43 -22
  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 +9 -9
  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 +5 -5
  68. data/lib/principles/launch.rb +49 -0
  69. data/lib/principles/list_open_findings_options.rb +1 -1
  70. data/lib/principles/models/accepted_loading.rb +2 -2
  71. data/lib/principles/models/acknowledged_check.rb +23 -11
  72. data/lib/principles/models/acknowledgement.rb +34 -18
  73. data/lib/principles/models/acknowledgement_left_as_printed.rb +7 -15
  74. data/lib/principles/models/acknowledgement_refusal.rb +25 -10
  75. data/lib/principles/models/acknowledgements.rb +45 -29
  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 +4 -4
  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 +6 -7
  88. data/lib/principles/models/audit.rb +33 -34
  89. data/lib/principles/models/audit_record.rb +54 -28
  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 +7 -7
  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 +10 -6
  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 +4 -4
  133. data/lib/principles/models/listed_members.rb +7 -9
  134. data/lib/principles/models/loaded_files.rb +4 -5
  135. data/lib/principles/models/loading_decision.rb +3 -3
  136. data/lib/principles/models/loading_facts.rb +1 -1
  137. data/lib/principles/models/loads_to_check.rb +1 -1
  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 +8 -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 +14 -15
  150. data/lib/principles/models/member_repair_moves.rb +15 -9
  151. data/lib/principles/models/member_sighting.rb +10 -10
  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 +45 -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 +26 -8
  181. data/lib/principles/models/project.rb +31 -19
  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 +34 -31
  196. data/lib/principles/models/request_id.rb +18 -6
  197. data/lib/principles/models/runs_from.rb +7 -2
  198. data/lib/principles/models/sent_answer.rb +14 -12
  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 +13 -6
  217. data/lib/principles/prose_list.rb +1 -1
  218. data/lib/principles/session_start_options.rb +1 -1
  219. data/lib/principles/start_audit_options.rb +46 -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 +97 -11
  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 +50 -41
  227. data/lib/principles/views/assessment_request.rb +39 -36
  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 +92 -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 +45 -34
  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 +44 -25
  237. data/lib/principles/views/diff_since_last_audit.rb +8 -6
  238. data/lib/principles/views/findings_result.rb +28 -6
  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 +14 -6
  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 +8 -5
  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 +2 -2
  256. data/lib/principles/views/members_a_commit_changed.rb +13 -10
  257. data/lib/principles/views/members_with_no_baseline.rb +3 -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 +7 -7
  261. data/lib/principles/views/open_findings_elsewhere_result.rb +5 -2
  262. data/lib/principles/views/open_findings_line.rb +89 -73
  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 +16 -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 +37 -17
  275. data/lib/principles/views/problem_result.rb +40 -37
  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/resolve-them-in-a-full-audit.md +1 -0
  279. data/lib/principles/views/prompts/acknowledge-a-change/say-whether-the-change-keeps-the-meaning.md +3 -3
  280. data/lib/principles/views/prompts/assess-every-member/confirm-each-write-up-pointer-the-answer-drops.md +2 -0
  281. data/lib/principles/views/prompts/assess-every-member/have-a-changed-check-reviewed-before-running-it.md +1 -1
  282. data/lib/principles/views/prompts/assess-every-member/have-a-new-check-reviewed-before-running-it.md +1 -1
  283. data/lib/principles/views/prompts/assess-every-member/judge-a-carried-assessment-citing-a-decided-finding.md +3 -0
  284. data/lib/principles/views/prompts/assess-every-member/judge-a-submitted-carried-assessment-citing-a-decided-finding.md +5 -0
  285. data/lib/principles/views/prompts/assess-every-member/judge-the-keeping-under-the-release-since-the-last-audit.md +1 -1
  286. data/lib/principles/views/prompts/assess-every-member/keep-the-printed-review-basis-or-replace-it.md +1 -0
  287. data/lib/principles/views/prompts/assess-every-member/name-the-commit-that-made-the-check.md +1 -0
  288. data/lib/principles/views/prompts/assess-every-member/read-a-trimmed-instruction-whole.md +1 -1
  289. data/lib/principles/views/prompts/assess-every-member/read-the-request-in-parts.md +1 -0
  290. data/lib/principles/views/prompts/assess-every-member/why-each-member-is-judged-again.md +3 -2
  291. data/lib/principles/views/prompts/dispose-of-each-finding/answer-guide.json +1 -1
  292. data/lib/principles/views/prompts/dispose-of-each-finding/confirm-each-deferral-written-up-nowhere.md +2 -0
  293. data/lib/principles/views/prompts/dispose-of-each-finding/retain-assessment-and-correction.md +4 -4
  294. data/lib/principles/views/prompts/find-a-principle-to-map/where-the-inventory-looks.md +2 -2
  295. data/lib/principles/views/prompts/learn-what-a-command-does/list-candidate-files.md +4 -3
  296. data/lib/principles/views/prompts/learn-what-a-command-does/list-member-problems.md +6 -6
  297. data/lib/principles/views/prompts/learn-what-a-command-does/list-open-findings.md +14 -14
  298. data/lib/principles/views/prompts/learn-what-a-command-does/list-principles.md +3 -0
  299. data/lib/principles/views/prompts/learn-what-a-command-does/report-after-commit.md +14 -0
  300. data/lib/principles/views/prompts/learn-what-a-command-does/report-at-session-start.md +26 -0
  301. data/lib/principles/views/prompts/learn-what-a-command-does/show-answer-check.md +20 -18
  302. data/lib/principles/views/prompts/learn-what-a-command-does/show-first-audit-brief.md +19 -0
  303. data/lib/principles/views/prompts/learn-what-a-command-does/show-hook-setup.md +13 -0
  304. data/lib/principles/views/prompts/learn-what-a-command-does/show-meta-principle-passage.md +3 -1
  305. data/lib/principles/views/prompts/learn-what-a-command-does/show-open-correction.md +12 -0
  306. data/lib/principles/views/prompts/learn-what-a-command-does/start-audit.md +21 -22
  307. data/lib/principles/views/prompts/learn-what-a-command-does/submit-answer.md +5 -4
  308. data/lib/principles/views/prompts/report-the-completed-audit/commit-only-what-the-audit-changed.md +2 -2
  309. data/lib/principles/views/prompts/run-a-first-audit-in-the-background/follow-the-brief.md +18 -0
  310. data/lib/principles/views/prompts/set-principles-up/offer-the-report-hooks.md +2 -0
  311. data/lib/principles/views/prompts/set-principles-up/wire-the-report-hooks-with-the-user.md +8 -0
  312. data/lib/principles/views/prompts/start-a-session/act-on-the-open-findings.md +1 -5
  313. data/lib/principles/views/prompts/start-a-session/hand-the-first-audit-to-a-subagent.md +3 -0
  314. data/lib/principles/views/prompts/start-a-session/run-each-command-above.md +1 -0
  315. data/lib/principles/views/prompts/start-a-session/start-no-second-first-audit.md +2 -0
  316. data/lib/principles/views/prompts.rb +1 -1
  317. data/lib/principles/views/read_the_change.rb +36 -0
  318. data/lib/principles/views/record_waiting_on_an_upgrade.rb +2 -2
  319. data/lib/principles/views/repoint_result.rb +1 -1
  320. data/lib/principles/views/report_hooks_offer.rb +25 -0
  321. data/lib/principles/views/request_part.rb +5 -5
  322. data/lib/principles/views/request_parts.rb +1 -1
  323. data/lib/principles/views/session_start_report.rb +46 -0
  324. data/lib/principles/views/shell_word.rb +1 -1
  325. data/lib/principles/views/trimmed_instructions_note.rb +30 -0
  326. data/lib/principles/views/visible_text.rb +1 -1
  327. data/lib/principles/views/workflow_diagram.rb +1 -1
  328. data/principles.gemspec +44 -0
  329. metadata +84 -18
  330. data/lib/principles/views/prompts/start-a-session/every-loaded-line-costs-every-session.md +0 -1
  331. data/lib/principles/views/prompts/start-a-session/it-returns-after-each-clear-or-compaction-too.md +0 -1
  332. data/lib/principles/views/prompts/start-a-session/it-returns-at-each-session-start.md +0 -1
  333. data/lib/principles/views/prompts/start-a-session/raise-them-at-the-next-pause.md +0 -1
  334. data/lib/principles/views/prompts/start-a-session/raise-them-before-the-first-task.md +0 -1
@@ -1,6 +1,7 @@
1
1
  # typed: strict
2
2
  # frozen_string_literal: true
3
3
 
4
+ require_relative "../prose_list"
4
5
  require_relative "invocation"
5
6
  require_relative "prompts"
6
7
  require_relative "request_part"
@@ -9,16 +10,26 @@ module Principles
9
10
  # What this tool prints, from plain values a controller hands it. views/CLAUDE.md owns the boundary.
10
11
  module Views
11
12
  # How the meta-principle's full audit states the release of principles its last completed audit ran under beside
12
- # the one running now, as facts for the agent to judge (D68).
13
+ # the one running now, as facts for the agent to judge.
13
14
  class PackageSinceLastAuditResult
15
+ # The part this lists, by the name the request prints it under and start-audit --part takes.
16
+ PART = "package_since_last_audit" #: String
17
+
18
+ # How the why names each part of principles an upgrade can change, in the order it names them, whatever order
19
+ # the map holds them in.
20
+ PARTS = { "hook" => "the session-start hook", "skill" => "the skill",
21
+ "passage" => "the passage" }.freeze #: Hash[String, String]
22
+
14
23
  # at_last_audit is the version the last completed audit ran under, or nil when none recorded one; now is the
15
24
  # version running now; passage_changed says whether the passage setup proposes changed since, or is nil with
16
- # nothing to compare. invocation names the setup command the instruction prints.
17
- #: (Invocation, at_last_audit: String?, now: String, passage_changed: bool?) -> void
18
- def initialize(invocation, at_last_audit:, now:, passage_changed:)
25
+ # nothing to compare. mapped is which of PARTS' keys the map holds. invocation names the setup command the
26
+ # instruction prints.
27
+ #: (Invocation, at_last_audit: String?, now: String, passage_changed: bool?, mapped: Array[String]) -> void
28
+ def initialize(invocation, at_last_audit:, now:, passage_changed:, mapped:)
19
29
  @invocation = invocation
20
30
  @since = { "version_at_last_audit" => at_last_audit, "version_now" => now,
21
31
  "passage_changed" => passage_changed }.freeze #: Hash[String, untyped]
32
+ @mapped = mapped
22
33
  freeze
23
34
  end
24
35
 
@@ -26,8 +37,20 @@ module Principles
26
37
  #: () -> RequestPart
27
38
  def part
28
39
  why = Prompts.text("assess-every-member/judge-the-keeping-under-the-release-since-the-last-audit",
29
- setup: @invocation.in_project("show-meta-principle-passage"))
30
- RequestPart.new(shown: { "package_since_last_audit" => @since.merge("why" => why) }, slots: {})
40
+ mapped: mapped, setup: @invocation.in_project("show-meta-principle-passage"))
41
+ RequestPart.new(shown: { PART => @since.merge("why" => why) }, slots: {})
42
+ end
43
+
44
+ private
45
+
46
+ # Which of the parts the project maps, as the why's clause after naming all three.
47
+ #: () -> String
48
+ def mapped
49
+ return "none of which this project maps" if @mapped.empty?
50
+ return "all of which this project maps" if @mapped.length == PARTS.length
51
+
52
+ named = PARTS.filter_map { |part, words| words if @mapped.include?(part) }
53
+ "of which this project maps only #{ProseList.new(named)}"
31
54
  end
32
55
  end
33
56
  end
@@ -0,0 +1,60 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ require_relative "assessment_request"
5
+ require_relative "context_parts"
6
+ require_relative "invocation"
7
+ require_relative "shell_word"
8
+ require_relative "trimmed_instructions_note"
9
+
10
+ module Principles
11
+ # What this tool prints, from plain values a controller hands it. views/CLAUDE.md owns the boundary.
12
+ module Views
13
+ # start-audit --part index: a full audit's parts with how to answer the request from them, so an agent reading the
14
+ # request in parts need not read it whole to learn how to answer it.
15
+ class PartsIndexResult
16
+ #: (Invocation) -> void
17
+ def initialize(invocation)
18
+ @invocation = invocation
19
+ freeze
20
+ end
21
+
22
+ # The index of request, with the note naming the instructions it prints only in part, the command that submits
23
+ # its answer and, as the next step, reading each part, where skipping a carried member's is the agent's choice,
24
+ # then the one printing that answer to fill, which is too large to carry here, keeping each carried entry.
25
+ #: (Hash[String, untyped], AssessmentRequest) -> Hash[String, untyped]
26
+ def printed(index, request)
27
+ to_fill = @invocation.in_project("start-audit", request.principle_id,
28
+ options: ["--part", ContextParts::TEMPLATE])
29
+ read = "Run part_command with each part as printed; skipping a member marked carries_forward is fine, " \
30
+ "unless you judge it again. --as template prints the same answer long, with each slot's help. " \
31
+ "Then fill in the answer this command prints"
32
+ listed(index, request.principle_id)
33
+ .merge(TrimmedInstructionsNote.new(request.trimmed_instruction_fields).to_h)
34
+ .merge("answer_with" => @invocation.submit_answer(index.fetch("request_id")),
35
+ "next_action" => "#{read}, #{carried(request)}, and submit it with answer_with: #{to_fill}")
36
+ end
37
+
38
+ private
39
+
40
+ # How to fill each carried member's entry: as printed, but for any check_result slot one prints.
41
+ #: (AssessmentRequest) -> String
42
+ def carried(request)
43
+ kept = "leaving each carries_forward entry as printed"
44
+ request.carried_check_to_fill? ? "#{kept} but for filling the check_result slot it prints" : kept
45
+ end
46
+
47
+ # The index under its request id, after the command that prints a part named after it, each entry's part as a
48
+ # shell reads it, quoted where a shell would split or expand it, so it runs as printed; the answer's template
49
+ # names each member by its id unquoted. One command rather than one an entry, since an entry's would repeat it
50
+ # and cost more than reading the whole request.
51
+ #: (Hash[String, untyped], String) -> Hash[String, untyped]
52
+ def listed(index, principle_id)
53
+ entries = index.fetch("index").map { it.merge("part" => ShellWord.new(it.fetch("part")).to_s) }
54
+ { "request_id" => index.fetch("request_id"),
55
+ "part_command" => @invocation.in_project("start-audit", principle_id, options: ["--part"]),
56
+ "index" => entries }
57
+ end
58
+ end
59
+ end
60
+ end
@@ -1,6 +1,7 @@
1
1
  # typed: strict
2
2
  # frozen_string_literal: true
3
3
 
4
+ require_relative "findings_result"
4
5
  require_relative "invocation"
5
6
  require_relative "printed_principle"
6
7
  require_relative "member_repairs"
@@ -21,9 +22,9 @@ module Principles
21
22
  end
22
23
 
23
24
  # show-principle: each member with where its text is now and its freshness, and each member repairs names, those
24
- # an audit would refuse, with its repair_with commands, from the moves repairs gives it (#272).
25
- # hook_settings_not_read names each project settings file whose hooks this tool could not read (#491).
26
- # loaded_files lists each file the members load once, with the total of those loading at session start (#483).
25
+ # an audit would refuse, with its repair_with commands, from the moves repairs gives it.
26
+ # hook_settings_not_read names each project settings file whose hooks this tool could not read.
27
+ # loaded_files lists each file the members load once, with the total of those loading at session start.
27
28
  #: (PrintedPrinciple, repairs: Hash[String, Array[Hash[String, untyped]]],
28
29
  #| ?hook_settings_not_read: Array[Hash[String, String]], ?loaded_files: Hash[String, untyped])
29
30
  #| -> Hash[String, untyped]
@@ -36,15 +37,24 @@ module Principles
36
37
 
37
38
  # list-principles: each entry is { "id", "description", "members_by_freshness" }. waiting is each principle whose
38
39
  # audits wait on an upgrade, which it names, with how to update said once, and an audit is offered only when one
39
- # is left to audit (#1067, #1081).
40
+ # is left to audit.
40
41
  #: (Array[Hash[String, untyped]], ?waiting: Array[RecordWaitingOnAnUpgrade], ?one_to_audit: bool)
41
42
  #| -> Hash[String, untyped]
42
43
  def listing(entries, waiting: [], one_to_audit: true)
43
44
  { "principles" => entries, "next_action" => listed_next_action(entries, waiting, one_to_audit).join("\n") }
44
45
  end
45
46
 
46
- # list-principles' note on the meta-principle's map, kept in file, when it has no members, with the two ways on
47
- # (#931).
47
+ # Each of list-principles' entries with its principle's open findings, a line each, for --open-findings. open
48
+ # maps each principle id to its findings' plain fields, as list-open-findings --lines takes them.
49
+ #: (Array[Hash[String, untyped]], Hash[String, Array[Hash[String, untyped]]]) -> Array[Hash[String, untyped]]
50
+ def with_open_findings(entries, open)
51
+ findings = FindingsResult.new(@invocation)
52
+ entries.map do |entry|
53
+ entry.merge("open_findings" => open.fetch(entry.fetch("id"), []).map { findings.summary(it) })
54
+ end
55
+ end
56
+
57
+ # list-principles' note on the meta-principle's map, kept in file, when it has no members, with the two ways on.
48
58
  #: (String) -> Hash[String, String]
49
59
  def no_members(file)
50
60
  setup = @invocation.in_project("show-meta-principle-passage")
@@ -5,7 +5,7 @@ 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
7
  # One other principle whose members a completed audit's fixes changed or broke, as its result names it under
8
- # other_principles_with_changed_members, to re-audit by its id (#410, #823).
8
+ # other_principles_with_changed_members, to re-audit by its id.
9
9
  class PrincipleWithChangedMembers
10
10
  #: (principle_id: String, members: Array[Hash[String, untyped]]) -> void
11
11
  def initialize(principle_id:, members:)
@@ -7,8 +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 principles no full audit has completed, as list-member-problems' next_action names them in one line, then
10
- # each one's audit to start on a line of its own, filled and shell-quoted so the agent types no id (D58, #731,
11
- # #755).
10
+ # each one's audit to start on a line of its own, filled and shell-quoted so the agent types no id.
12
11
  class PrinciplesWithNoCompletedAudit
13
12
  # audits holds each principle's start-audit command, in the order of ids.
14
13
  #: (ids: Array[String], audits: Array[String]) -> void
@@ -0,0 +1,51 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ require "json"
5
+
6
+ module Principles
7
+ module Views
8
+ # How a JSON result prints on stdout, and so how many bytes it takes there. Whatever sizes a result for the agent
9
+ # measures it here, so a size it reports is the size it prints. A result prints a field a line, so grep, sed -n
10
+ # and a diff read it as precisely as when it was indented, but unindented and with no space after the colon,
11
+ # since indentation was most of what printing it compact would save, and one grep pattern then fits every output.
12
+ module PrintedJson
13
+ INDENT = ""
14
+ SPACE = ""
15
+
16
+ # value as printed, one field a line.
17
+ #: (untyped) -> String
18
+ def self.text(value) = JSON.pretty_generate(value, indent: INDENT, space: SPACE)
19
+
20
+ # The bytes value prints as.
21
+ #: (untyped) -> Integer
22
+ def self.bytes(value) = text(value).bytesize
23
+
24
+ # value as printed, but for the array at path, each of whose entries prints compact on a line of its own. Each
25
+ # object on the way to it prints a field a line, and every other field as text prints it, depth objects in.
26
+ #: (untyped, Array[String], ?Integer) -> String
27
+ def self.with_entries_on_lines(value, path, depth = 0)
28
+ return entry_lines(value, depth) if path.empty?
29
+
30
+ fields = value.map do |name, field|
31
+ shown = name == path.first ? with_entries_on_lines(field, path.drop(1), depth + 1) : nested(field, depth + 1)
32
+ "#{INDENT * (depth + 1)}#{JSON.generate(name)}:#{SPACE}#{shown}"
33
+ end
34
+ "{\n#{fields.join(",\n")}\n#{INDENT * depth}}"
35
+ end
36
+
37
+ # field as text prints it, depth objects in.
38
+ #: (untyped, Integer) -> String
39
+ def self.nested(field, depth) = JSON.pretty_generate(field, indent: INDENT, space: SPACE, depth:)
40
+
41
+ # entries a compact line each, one step in from depth.
42
+ #: (Array[untyped], Integer) -> String
43
+ def self.entry_lines(entries, depth)
44
+ return "[]" if entries.empty?
45
+
46
+ "[\n#{entries.map { "#{INDENT * (depth + 1)}#{JSON.generate(it)}" }.join(",\n")}\n#{INDENT * depth}]"
47
+ end
48
+ private_class_method :nested, :entry_lines
49
+ end
50
+ end
51
+ end
@@ -18,7 +18,7 @@ module Principles
18
18
  #: Hash[String, untyped]?
19
19
  attr_reader :activation
20
20
 
21
- # activation is when the agent said the principle's work is in hand, or nil when it has not said (D38).
21
+ # activation is when the agent said the principle's work is in hand, or nil when it has not said.
22
22
  #: (id: String, file: String, description: String?, members: Array[Hash[String, untyped]],
23
23
  #| ?activation: Hash[String, untyped]?) -> void
24
24
  def initialize(id:, file:, description:, members:, activation: nil)
@@ -4,13 +4,13 @@
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 a completed full audit's result says what it decided about each prior finding (D35).
7
+ # How a completed full audit's result says what it decided about each prior finding.
8
8
  class PriorFindingDecisionsResult
9
9
  # kept_ids are the prior findings it kept and closed those it closed; changed is what the decisions changed of
10
10
  # the findings kept, each list by the name the result gives it after prior_findings_: pointers_dropped, any
11
- # pointer a decision dropped (#374), waits_on_dropped, any waits_on it dropped, with null or by accepting it
12
- # (D52), evidence_replaced, each kept evidence item a decision gave a new place, as it was and is now (D70), and
13
- # problems_restated, each problem a decision restated, as it was and is now (D82).
11
+ # pointer a decision dropped, waits_on_dropped, any waits_on it dropped, with null or by accepting it,
12
+ # evidence_replaced, each kept evidence item a decision gave a new place, as it was and is now, and
13
+ # problems_restated, each problem a decision restated, as it was and is now.
14
14
  #: (kept_ids: Array[String], closed: Array[Hash[String, untyped]],
15
15
  #| changed: Hash[String, Array[Hash[String, untyped]]]) -> void
16
16
  def initialize(kept_ids:, closed:, changed:)
@@ -7,12 +7,15 @@ require_relative "request_part"
7
7
  module Principles
8
8
  # What this tool prints, from plain values a controller hands it. views/CLAUDE.md owns the boundary.
9
9
  module Views
10
- # How the next full audit shows the findings the last one deferred or accepted, for it to decide (D35).
10
+ # How the next full audit shows the findings the last one deferred or accepted, for it to decide.
11
11
  class PriorFindingsResult
12
+ # The part this lists, by the name the request prints it under and start-audit --part takes.
13
+ PART = "prior_findings" #: String
14
+
12
15
  # prior is each finding the last audit deferred or accepted, as the request lists it; last_audited_commit is the
13
- # commit each evidence item's changed_since_last_audit compares against, or nil when none says (#858).
14
- # placeholders is the text the answer printed alone gives the decision, naming what it may be (#746), and each
15
- # field a decision may give, which an answer leaves as printed to give none (#994).
16
+ # commit each evidence item's changed_since_last_audit compares against, or nil when none says.
17
+ # placeholders is the text the answer printed alone gives the decision, naming what it may be, and each
18
+ # field a decision may give, which an answer leaves as printed to give none.
16
19
  #: (Array[Hash[String, untyped]], placeholders: Hash[String, untyped], ?last_audited_commit: String?) -> void
17
20
  def initialize(prior, placeholders:, last_audited_commit: nil)
18
21
  @prior = prior
@@ -27,7 +30,7 @@ module Principles
27
30
  def part
28
31
  return if @prior.empty?
29
32
 
30
- RequestPart.new(shown: { "prior_findings" => @prior.map { |finding| shown(finding) } },
33
+ RequestPart.new(shown: { PART => @prior.map { |finding| shown(finding) } },
31
34
  instructions: [Instruction.new("prior_findings_instruction", instruction)],
32
35
  slots: { "prior_finding_decisions" => @prior.map { |finding| decision(finding) } },
33
36
  help: { "prior_finding_decisions" => @placeholders })
@@ -36,7 +39,7 @@ module Principles
36
39
  private
37
40
 
38
41
  # finding as the request lists it, asking beside it, when it is marked evidence_not_kept, for the evidence its
39
- # record lacks, where the agent deciding it reads (#872).
42
+ # record lacks, where the agent deciding it reads.
40
43
  #: (Hash[String, untyped]) -> Hash[String, untyped]
41
44
  def shown(finding)
42
45
  return finding unless evidence_not_kept?(finding)
@@ -45,17 +48,17 @@ module Principles
45
48
  end
46
49
 
47
50
  # The decision to fill in on finding, with an empty problem_evidence list when it is marked evidence_not_kept,
48
- # so an agent filling the template alone sees the field its record lacks (#838).
51
+ # so an agent filling the template alone sees the field its record lacks.
49
52
  #: (Hash[String, untyped]) -> Hash[String, untyped]
50
53
  def decision(finding)
51
54
  decision = { "finding_id" => finding.fetch("finding_id"), "decision" => nil }
52
55
  evidence_not_kept?(finding) ? decision.merge("problem_evidence" => []) : decision
53
56
  end
54
57
 
55
- # How to decide the prior findings, naming each one's id, so a new finding is given another (#420), each
56
- # paragraph with whether its case holds: how to keep what a deferral waits on holds only when one carries waits_on
57
- # (#983), how to claim an earlier first_raised_at never, since no fact marks a finding dated late, so it is read
58
- # whole (#983), and how to give the evidence a finding's record lacks only when one is marked so (D61, D64).
58
+ # How to decide the prior findings, naming each one's id, so a new finding is given another, each paragraph with
59
+ # whether its case holds: how to keep what a deferral waits on holds only when one carries waits_on, how to
60
+ # claim an earlier first_raised_at never, since no fact marks a finding dated late, so it is read whole, and how
61
+ # to give the evidence a finding's record lacks only when one is marked so.
59
62
  #: () -> Array[[String, bool]]
60
63
  def instruction
61
64
  ids = @prior.map { |finding| finding.fetch("finding_id") }.join(", ")
@@ -67,7 +70,7 @@ module Principles
67
70
  end
68
71
 
69
72
  # How to read each evidence item's changed_since_last_audit, naming the commit it compares against, holding only
70
- # when an item carries it (#858, D61); none when no commit is named to compare against.
73
+ # when an item carries it; none when no commit is named to compare against.
71
74
  #: () -> Array[[String, bool]]
72
75
  def evidence_since
73
76
  return [] unless @last_audited_commit
@@ -77,14 +80,14 @@ module Principles
77
80
  commit: @last_audited_commit), said]]
78
81
  end
79
82
 
80
- # Whether any prior finding carries a waits_on line (D52).
83
+ # Whether any prior finding carries a waits_on line.
81
84
  #: () -> bool
82
85
  def waits_on? = @prior.any? { |finding| finding["waits_on"] }
83
86
 
84
87
  #: () -> bool
85
88
  def marked_evidence_not_kept? = @prior.any? { |finding| evidence_not_kept?(finding) }
86
89
 
87
- # Whether finding is marked as one whose record keeps no evidence (D64).
90
+ # Whether finding is marked as one whose record keeps no evidence.
88
91
  #: (Hash[String, untyped]) -> bool
89
92
  def evidence_not_kept?(finding) = finding["evidence_not_kept"] == true
90
93
  end
@@ -13,8 +13,8 @@ module Principles
13
13
  Lines = Struct.new(:stdout, :stderr, :status, keyword_init: true)
14
14
 
15
15
  # list-member-problems --short, for a commit hook or heartbeat that acts on an exit status and short lines
16
- # alone (#291): one tab-separated line per changed member on stdout, then one per principle counting its members
17
- # no audit has assessed (#1254), exit 3 when there is any line to act on, and on stderr what to do next and
16
+ # alone: one tab-separated line per changed member on stdout, then one per principle counting its members
17
+ # no audit has assessed, exit 3 when there is any line to act on, and on stderr what to do next and
18
18
  # anything an empty stdout would hide.
19
19
  class ProblemLines
20
20
  # The exit status that says a member's own text changed since an audit or acknowledgement assessed it, or that
@@ -32,7 +32,7 @@ module Principles
32
32
  # report is list-member-problems' JSON result: its "members", "counts" and "next_action".
33
33
  # assessed_change says whether a member an audit assessed changed, and never_assessed counts, by principle,
34
34
  # the members no audit has assessed; the model decides both, so the status follows from them alone.
35
- # names_a_command says whether next_action names one, as ProblemResult says (#1279).
35
+ # names_a_command says whether next_action names one, as ProblemResult says.
36
36
  #: (Hash[String, untyped], nothing_changed: String, assessed_change: bool,
37
37
  #| never_assessed: Hash[String, Integer], names_a_command: bool) -> Lines
38
38
  def short(report, nothing_changed:, assessed_change:, never_assessed:, names_a_command:)
@@ -43,22 +43,37 @@ module Principles
43
43
  status: assessed_change || !never_assessed.empty? ? CHANGED : 0)
44
44
  end
45
45
 
46
- # short's lines for a session-start hook (#1261): on stdout, first the context universal, unless source is
47
- # resume, whose conversation holds it already (#1260), then one line for each principle with a changed member an
46
+ # short's lines for a session-start hook: on stdout, one line for each principle with a changed member an
48
47
  # audit or acknowledgement assessed, counting them, with the command that lists them, from changed, in place of
49
- # the rows and never-assessed counts, which an always-loaded carrier cannot afford, then the principles skill as
50
- # where to start, which the hook printed before (#986, #1260); stderr and the status kept. Its command leaves
48
+ # the rows and never-assessed counts, which an always-loaded carrier cannot afford, then where to start, as
49
+ # session_start_lines says; stderr and the status kept. Its command leaves
51
50
  # out --project, as the hook's own commands do, since a session runs in its project.
52
- #: (Lines, changed: Hash[String, Integer], source: String) -> Lines
53
- def at_session_start(short, changed:, source:)
54
- counts = changed.map { |id, count| changed_line(id, count) }
55
- stdout = [*(Prompts.text("start-a-session/every-loaded-line-costs-every-session") unless source == "resume"),
56
- *counts, *(Prompts.text("start-a-session/start-with-the-principles-skill") unless counts.empty?)]
51
+ #: (Lines, changed: Hash[String, Integer], skill: bool) -> Lines
52
+ def at_session_start(short, changed:, skill:)
53
+ stdout = session_start_lines(changed:, skill:)
57
54
  Lines.new(stdout: stdout.map { "#{it}\n" }.join, stderr: short.stderr, status: short.status)
58
55
  end
59
56
 
57
+ # at_session_start's stdout, a line each: each principle's count of changed audited members with the command
58
+ # that lists them, then, when any is, where to start: the principles skill when skill says this session has
59
+ # it, as the plugin installs it, else those commands.
60
+ #: (changed: Hash[String, Integer], skill: bool) -> Array[String]
61
+ def session_start_lines(changed:, skill:)
62
+ counts = changed.map { |id, count| changed_line(id, count) }
63
+ [*counts, *(where_to_start(skill) unless counts.empty?)]
64
+ end
65
+
60
66
  private
61
67
 
68
+ # Where the agent starts with the changed members the count lines name: the principles skill, or without it the
69
+ # commands those lines print.
70
+ #: (bool) -> String
71
+ def where_to_start(skill)
72
+ return Prompts.text("start-a-session/start-with-the-principles-skill") if skill
73
+
74
+ Prompts.text("start-a-session/run-each-command-above")
75
+ end
76
+
62
77
  # The session-start line counting principle id's changed audited members, with the command that lists them.
63
78
  #: (String, Integer) -> String
64
79
  def changed_line(id, count)
@@ -67,13 +82,13 @@ module Principles
67
82
  end
68
83
 
69
84
  # The line counting principle id's members no audit has assessed, which a reader tells from a member's row by
70
- # its two fields (#1254).
85
+ # its two fields.
71
86
  #: (String, Integer) -> String
72
87
  def counted(id, count) = "#{VisibleText.new(id)}\t#{count} never assessed"
73
88
 
74
89
  # What the agent does next, and what an empty stdout would otherwise hide: no maps, or, in next_action,
75
- # each principle's members with no baseline to compare with and what gives them one (#564), and each
76
- # principle waiting on an upgrade, whose members are not counted, so they leave counts empty (D85, V8).
90
+ # each principle's members with no baseline to compare with and what gives them one, and each
91
+ # principle waiting on an upgrade, whose members are not counted, so they leave counts empty.
77
92
  #: (Hash[String, untyped], String, bool) -> Array[String]
78
93
  def notes(report, nothing_changed, names_a_command)
79
94
  no_maps = report.fetch("counts").empty? && !report.key?("empty_maps") &&
@@ -84,9 +99,14 @@ module Principles
84
99
  end
85
100
 
86
101
  # The project once, before the first command stderr prints, where they run since they leave out --project,
87
- # and how to see the details rows leave out, such as each commit's subject (#1263).
102
+ # and how to see the details rows leave out, such as each commit's subject; only the latter when each
103
+ # command names --project already.
88
104
  #: () -> String
89
- def project_line = "In #{@invocation.project_word} (details: drop --short):"
105
+ def project_line
106
+ return "Details: drop --short." if @invocation.named?
107
+
108
+ "In #{@invocation.project_word} (details: drop --short):"
109
+ end
90
110
  end
91
111
  end
92
112
  end
@@ -18,9 +18,9 @@ module Principles
18
18
  OLDER_STATE = "An older version of this tool kept audit runs in this file. This version does not read " \
19
19
  "it, so an audit recorded only there is not a baseline. Start a new audit to make one."
20
20
 
21
- # The lead before the acknowledgements, which leaves the agent to judge each change (#1263).
22
- ACKNOWLEDGE_LEAD = "Acknowledge members that still say the same thing; if one's meaning changed, or its check " \
23
- "is new, changed or fails, run start-audit ID:"
21
+ # The lead before the acknowledgements, which leaves the agent to judge each change.
22
+ ACKNOWLEDGE_LEAD = "Acknowledge members that still say the same thing with start-audit --member below; if " \
23
+ "one's meaning changed, or its check is new, changed or fails, run start-audit ID:"
24
24
 
25
25
  #: (Invocation) -> void
26
26
  def initialize(invocation)
@@ -30,19 +30,20 @@ module Principles
30
30
 
31
31
  # report holds "members", the changed members, and "counts"; not_read names older files left unread;
32
32
  # no_baseline_files names, by principle, the files to commit so its members with no baseline gain one.
33
- # acknowledgeable names, by principle, the changed members a one-member audit may judge (#626, D56).
34
- # waiting names each principle whose record a later copy wrote, whose members are not checked (D85, V8).
33
+ # acknowledgeable names, by the principles that acknowledge them together, the changed members a one-member
34
+ # audit may judge.
35
+ # waiting names each principle whose record a later copy wrote, whose members are not checked.
35
36
  #: (Hash[String, untyped], ?not_read: Array[String], ?no_baseline_files: Hash[String, Array[String]],
36
- #| ?acknowledgeable: Hash[String, Array[String]], ?waiting: Array[RecordWaitingOnAnUpgrade])
37
+ #| ?acknowledgeable: Hash[Array[String], Array[String]], ?waiting: Array[RecordWaitingOnAnUpgrade])
37
38
  #| -> Hash[String, untyped]
38
39
  def checked(report, not_read: [], no_baseline_files: {}, acknowledgeable: {}, waiting: [])
39
40
  checked_naming_commands(report, not_read:, no_baseline_files:, acknowledgeable:, waiting:).first
40
41
  end
41
42
 
42
- # The same result, and whether its next_action names a command, before which --short names the project once
43
- # (#1263), so no view reads the action's text to find one (#1279).
43
+ # The same result, and whether its next_action names a command, before which --short names the project once,
44
+ # so no view reads the action's text to find one.
44
45
  #: (Hash[String, untyped], ?not_read: Array[String], ?no_baseline_files: Hash[String, Array[String]],
45
- #| ?acknowledgeable: Hash[String, Array[String]], ?waiting: Array[RecordWaitingOnAnUpgrade])
46
+ #| ?acknowledgeable: Hash[Array[String], Array[String]], ?waiting: Array[RecordWaitingOnAnUpgrade])
46
47
  #| -> [Hash[String, untyped], bool]
47
48
  def checked_naming_commands(report, not_read: [], no_baseline_files: {}, acknowledgeable: {}, waiting: [])
48
49
  unless not_read.empty?
@@ -53,13 +54,25 @@ module Principles
53
54
  [report.merge("next_action" => action), commands]
54
55
  end
55
56
 
57
+ # For each principle with members no baseline holds, what gives them one: outside git a completed audit,
58
+ # and in git committing the files no_baseline_files names.
59
+ #: (Hash[String, untyped], Hash[String, Array[String]]) -> Array[MembersWithNoBaseline]
60
+ def no_baseline_actions(report, no_baseline_files)
61
+ report.fetch("no_baseline_because", {}).map do |id, because|
62
+ MembersWithNoBaseline.new(id: id, count: report.fetch("compared_with").fetch(id).fetch("no_baseline"),
63
+ because: because, audit: @invocation.in_project("start-audit", id),
64
+ files: no_baseline_files.fetch(id, []))
65
+ end
66
+ end
67
+
56
68
  private
57
69
 
58
70
  # What to do next for report, each kind of action on lines of its own, or NOTHING_CHANGED when none applies,
59
71
  # and whether it names a command: every changed, unaudited and mapping action does, a no-baseline one as it
60
72
  # says, and neither the mapping notice nor a waiting principle's update sentence does.
61
73
  #: (Hash[String, untyped], no_baseline_files: Hash[String, Array[String]],
62
- #| acknowledgeable: Hash[String, Array[String]], waiting: Array[RecordWaitingOnAnUpgrade]) -> [String, bool]
74
+ #| acknowledgeable: Hash[Array[String], Array[String]], waiting: Array[RecordWaitingOnAnUpgrade])
75
+ #| -> [String, bool]
63
76
  def next_action(report, no_baseline_files:, acknowledgeable:, waiting:)
64
77
  waits = waiting.map(&:principle)
65
78
  mapping = MapsNeedingMembersOrAudit.new(@invocation, report: report, files_to_commit: no_baseline_files,
@@ -77,29 +90,30 @@ module Principles
77
90
  !commanding.empty? || no_baseline.any?(&:names_a_command?) || !mapping.actions.empty?
78
91
  end
79
92
 
80
- # For each principle with a changed member, its audits, each command ending its own line (#568): where
81
- # acknowledgeable names members a one-member audit may judge, one acknowledgement for all of them (#1169,
82
- # #1263), filled and shell-quoted so the agent types no id (#626, D56), after one lead saying when to audit in
83
- # full instead; the full audit for a principle with a changed member no acknowledgement may judge, with no
84
- # condition, as nothing else applies to it (#633). None for a principle in waits, whose audits wait on an
85
- # upgrade (#1066).
86
- #: (Hash[String, untyped], Hash[String, Array[String]], Array[String]) -> String?
93
+ # For each principle with a changed member, its audits, each command ending its own line: where acknowledgeable
94
+ # names members a one-member audit may judge, one acknowledgement for all of them, filled and shell-quoted so
95
+ # the agent types no id, after one lead saying when to audit in full instead; the full audit for a principle
96
+ # with a changed member no acknowledgement may judge, with no condition, as nothing else applies to it. None for
97
+ # a principle in waits, whose audits wait on an upgrade.
98
+ #: (Hash[String, untyped], Hash[Array[String], Array[String]], Array[String]) -> String?
87
99
  def changed_action(report, acknowledgeable, waits)
88
100
  changed = report.fetch("members").group_by { it.fetch("principle") }.except(*waits)
89
- acknowledging = changed.keys.filter_map { |id| acknowledge_line(id, acknowledgeable.fetch(id, [])) }
90
- full = changed.filter_map { |id, members| full_audit_line(id, members, acknowledgeable.fetch(id, [])) }
101
+ acknowledging = acknowledgeable.map { |ids, members| acknowledge_line(ids, members) }
102
+ full = changed.filter_map { |id, members| full_audit_line(id, members, acknowledged_in(acknowledgeable, id)) }
91
103
  lines = [*(ACKNOWLEDGE_LEAD unless acknowledging.empty?), *acknowledging, *full]
92
104
  lines.empty? ? nil : lines.join("\n")
93
105
  end
94
106
 
95
- # The one-member audit acknowledging every member of principle id in members, or nil when there is none.
96
- #: (String, Array[String]) -> String?
97
- def acknowledge_line(id, members)
98
- return if members.empty?
99
-
100
- @invocation.in_project("start-audit", id, options: members.flat_map { ["--member", it] })
107
+ # The acknowledgement of every member in members by the principles ids names, each of those it maps.
108
+ #: (Array[String], Array[String]) -> String
109
+ def acknowledge_line(ids, members)
110
+ @invocation.listed_in_project("start-audit", ids, options: members.flat_map { ["--member", it] })
101
111
  end
102
112
 
113
+ # The members an acknowledgement in acknowledgeable takes in for principle id.
114
+ #: (Hash[Array[String], Array[String]], String) -> Array[String]
115
+ def acknowledged_in(acknowledgeable, id) = acknowledgeable.select { |ids, _| ids.include?(id) }.values.flatten
116
+
103
117
  # The full audit of principle id, for its changed members no acknowledgement may judge, or nil when the
104
118
  # acknowledgement takes in every one.
105
119
  #: (String, Array[Hash[String, untyped]], Array[String]) -> String?
@@ -112,7 +126,7 @@ module Principles
112
126
 
113
127
  # Members compared only with the commit that mapped them have never been assessed, so neither "changed" nor
114
128
  # "unchanged" says whether they carry their principle: those added to an audited principle by principle, and
115
- # every principle awaiting its first full audit in one line (D58, #731), but those in waits (#1066).
129
+ # every principle awaiting its first full audit in one line, but those in waits.
116
130
  #: (Hash[String, untyped], Array[String]) -> String?
117
131
  def unaudited_action(report, waits)
118
132
  awaiting = report.fetch("awaiting_first_audit", [])
@@ -139,17 +153,6 @@ module Principles
139
153
  ["No audit has assessed these yet, so whether they carry their principle is unknown, changed or not:",
140
154
  *unseen].join("\n")
141
155
  end
142
-
143
- # For each principle with members no baseline holds, what gives them one: outside git a completed audit,
144
- # and in git committing the files no_baseline_files names.
145
- #: (Hash[String, untyped], Hash[String, Array[String]]) -> Array[MembersWithNoBaseline]
146
- def no_baseline_actions(report, no_baseline_files)
147
- report.fetch("no_baseline_because", {}).map do |id, because|
148
- MembersWithNoBaseline.new(id: id, count: report.fetch("compared_with").fetch(id).fetch("no_baseline"),
149
- because: because, audit: @invocation.in_project("start-audit", id),
150
- files: no_baseline_files.fetch(id, []))
151
- end
152
- end
153
156
  end
154
157
  end
155
158
  end
@@ -0,0 +1,2 @@
1
+ Each member is mapped by every principle in `principles` that lists it, each with its own role, baseline and
2
+ context. Judge each member once, against every principle that lists it.
@@ -0,0 +1 @@
1
+ To read the deferred findings this acknowledgement keeps, which only a full audit resolves: %{list_open_findings}
@@ -0,0 +1 @@
1
+ To resolve those %{principle_id} keeps, audit it in full: %{start_audit}
@@ -1,6 +1,6 @@
1
1
  Read the change in member_lines, or by running read_the_change. Answer `meaning_kept: true` only when the member
2
2
  still says the same thing. A member still says the same thing after a fixed typo, a reworded sentence or a
3
3
  renumbered citation; an added, dropped, reversed, narrowed or widened rule changes what it says. When it changed, or
4
- you are unsure, run a full audit instead. Give a one-line `reason` in your own words, and fill the template; quotes
5
- left out read as `first_changed_lines`. Optional: `old_line` and `new_line`, another changed line per side or 30
6
- characters including the edit; `basis.base_commit`; a check's `check_result.command` and `check_result.review_basis`.
4
+ you are unsure, run a full audit instead. Give a one-line `reason` in your own words, and fill its `members` entry;
5
+ quotes left out read as `first_changed_lines`. Optional: `old_line` and `new_line`, another changed line per side or
6
+ 30 characters including the edit; `basis.base_commit`; a check's `check_result.command` and `check_result.review_basis`.
@@ -0,0 +1,2 @@
1
+ This answer's null `recorded_at` drops the write-up pointer each finding under `prior_findings_pointers_dropped`
2
+ has, shown there. If a drop is not meant, leave that `recorded_at` as printed, which keeps it, and check again.