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
@@ -0,0 +1,43 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ module Principles
5
+ # What this tool prints, from plain values a controller hands it. views/CLAUDE.md owns the boundary.
6
+ module Views
7
+ # A member's lines at its last full audit and now, as AcknowledgedSinceLastAudit prints them, beside the member's
8
+ # text printed whole, as its start-audit --part prints it: each side now names where it starts in the text and
9
+ # how many of its lines it spans, so the part carries each line now once.
10
+ class MemberLinesBesideText
11
+ #: (Hash[String, untyped]) -> void
12
+ def initialize(member_lines)
13
+ @member_lines = member_lines
14
+ freeze
15
+ end
16
+
17
+ # The lines as printed, each side now that lists its lines pointing at the text instead.
18
+ #: () -> Hash[String, untyped]
19
+ def shown
20
+ lines = @member_lines
21
+ return lines.merge("now" => in_text(1, lines.fetch("now"))) if lines["now"].is_a?(Array)
22
+ return lines.merge("changed_region" => region(lines.fetch("changed_region"))) if lines["changed_region"]
23
+ return lines.merge("changed_regions" => lines.fetch("changed_regions").map { region(it) }) if
24
+ lines["changed_regions"]
25
+
26
+ lines
27
+ end
28
+
29
+ private
30
+
31
+ # A changed region, its side now pointing at the text when it lists its lines.
32
+ #: (Hash[String, untyped]) -> Hash[String, untyped]
33
+ def region(changed)
34
+ now = changed.fetch("now")
35
+ now["lines"] ? changed.merge("now" => in_text(now.fetch("from_line"), now.fetch("lines"))) : changed
36
+ end
37
+
38
+ # Where lines start in the text, and how many they are.
39
+ #: (Integer, Array[String]) -> Hash[String, Integer]
40
+ def in_text(from_line, lines) = { "from_line" => from_line, "lines_in_text" => lines.length }
41
+ end
42
+ end
43
+ end
@@ -31,7 +31,7 @@ module Principles
31
31
  end
32
32
 
33
33
  # member, as show-principle prints it, with its repairs as repair_with when moves, its moves, are given, as the
34
- # controller gives them for a member an audit would refuse (#272).
34
+ # controller gives them for a member an audit would refuse.
35
35
  #: (String, Hash[String, untyped], Array[Hash[String, untyped]]?) -> Hash[String, untyped]
36
36
  def beside(id, member, moves)
37
37
  return member unless moves
@@ -44,7 +44,8 @@ module Principles
44
44
  #: (String, String, Hash[String, untyped]) -> String
45
45
  def move(id, member_id, move)
46
46
  kept = move.fetch("keep").flat_map { |field, value| [FLAGS.fetch(field), value] }
47
- usage = move.fetch("fill").map { "#{FLAGS.fetch(it)} #{PLACEHOLDERS.fetch(it)}" }.join(" ")
47
+ fill = move.fetch("fill")
48
+ usage = fill.map { "#{FLAGS.fetch(it)} #{PLACEHOLDERS.fetch(it)}" }.join(" ") unless fill.empty?
48
49
  @invocation.in_project("move-member", id, member_id, options: kept, usage: usage)
49
50
  end
50
51
  end
@@ -9,7 +9,7 @@ module Principles
9
9
  # One changed member as a line of tab-separated fields, each written through VisibleText: its principle, id,
10
10
  # newest commit that changed it (or "uncommitted"), that commit's subject, and what it was compared with:
11
11
  # "audit" or "mapping_commit", then "waiting_on_an_upgrade" for one compared with hashes a later copy wrote.
12
- # The after-commit hook prints it (D73), and list-member-problems --short its short form, without the subject.
12
+ # The after-commit hook prints it, and list-member-problems --short its short form, without the subject.
13
13
  class MemberRow
14
14
  # member is one entry of list-member-problems' "members", with its "history".
15
15
  #: (Hash[String, untyped]) -> void
@@ -26,7 +26,7 @@ module Principles
26
26
  end
27
27
 
28
28
  # The row without the commit's subject, which repeats on every row one commit changed and which
29
- # list-member-problems' JSON keeps (#1263).
29
+ # list-member-problems' JSON keeps.
30
30
  #: () -> String
31
31
  def short = joined([*head, *tail])
32
32
 
@@ -13,23 +13,26 @@ module Principles
13
13
  # What this tool prints, from plain values a controller hands it. views/CLAUDE.md owns the boundary.
14
14
  module Views
15
15
  # list-member-problems --commits-after COMMIT --hook-event EVENT: the whole JSON the plugin's after-commit hook
16
- # prints for Claude Code, which puts its additionalContext beside the Bash call's result (D73), or nothing at all.
16
+ # prints for Claude Code, which puts its additionalContext beside the Bash call's result, or nothing at all.
17
17
  # Claude Code asks for that text to state facts, not to give orders, so it says what the commits changed,
18
- # which command shows more and which skill to start from (#986). It names that skill as a user invokes it,
19
- # /principles, in Claude Code, the only host whose hook prints this JSON.
18
+ # which command shows more and, under the plugin, which skill to start from. It names that skill as a user
19
+ # invokes it in Claude Code, /principles, the only host the plugin installs it for.
20
20
  class MembersACommitChanged
21
21
  NOTHING = Lines.new(stdout: "", stderr: "", status: 0).freeze #: Lines
22
22
 
23
- #: (Invocation) -> void
24
- def initialize(invocation)
23
+ # skill says whether this session has the principles skill, which only the plugin installs; without it the
24
+ # command the report names is where to start.
25
+ #: (Invocation, skill: bool) -> void
26
+ def initialize(invocation, skill:)
25
27
  @invocation = invocation
28
+ @skill = skill
26
29
  freeze
27
30
  end
28
31
 
29
32
  # changed is each member the commits changed, as list-member-problems lists it; others is how many other changed
30
33
  # members it still lists. Those it marks waiting_on_an_upgrade are named apart, with the waits that say why, and
31
- # no audit to run (D85 V8, #1066); the others still listed are counted beside them too, since this copy may
32
- # audit those (#1077).
34
+ # no audit to run; the others still listed are counted beside them too, since this copy may
35
+ # audit those.
33
36
  #: (String, Array[Hash[String, untyped]], others: Integer, ?waits: Array[RecordWaitingOnAnUpgrade]) -> Lines
34
37
  def changed(event, changed, others:, waits: [])
35
38
  waiting, auditable = changed.partition { |member| member["waiting_on_an_upgrade"] }
@@ -47,12 +50,12 @@ module Principles
47
50
 
48
51
  private
49
52
 
50
- # The members to audit, as rows, then what shows more and the skill to start from.
53
+ # The members to audit, as rows, then what shows more and, in a session that has it, the skill to start from.
51
54
  #: (Array[Hash[String, untyped]], Integer) -> Array[String]
52
55
  def to_audit(changed, others)
53
56
  [Prompts.text("report-after-a-commit/the-commits-changed-these-members"), *rows(changed),
54
57
  *still_listed(others), Prompts.text("report-after-a-commit/this-command-shows-each-one"), command,
55
- Prompts.text("report-after-a-commit/the-principles-skill-is-where-to-start")]
58
+ *(Prompts.text("report-after-a-commit/the-principles-skill-is-where-to-start") if @skill)]
56
59
  end
57
60
 
58
61
  # The other changed members still listed, and the command that shows each, or nothing when none is.
@@ -86,7 +89,7 @@ module Principles
86
89
  def command = @invocation.in_project("list-member-problems")
87
90
 
88
91
  # The hook's JSON. Each field from a project file or commit is written through VisibleText already, so an
89
- # invisible character reaches the model as \uXXXX, not hidden in the text it reads (#227).
92
+ # invisible character reaches the model as \uXXXX, not hidden in the text it reads.
90
93
  #: (String, Array[String]) -> Lines
91
94
  def reported(event, lines)
92
95
  output = { "hookSpecificOutput" => { "hookEventName" => event, "additionalContext" => lines.join("\n") } }
@@ -7,7 +7,7 @@ module Principles
7
7
  # What this tool prints, from plain values a controller hands it. views/CLAUDE.md owns the boundary.
8
8
  module Views
9
9
  # One principle's members with no baseline, as list-member-problems' next_action says what gives them one:
10
- # outside git a completed audit, and in git committing the files that hold them (#564).
10
+ # outside git a completed audit, and in git committing the files that hold them.
11
11
  class MembersWithNoBaseline
12
12
  # because is "outside_git" or "not_committed"; audit is the start-audit command to run outside git, and
13
13
  # files the map and member files to commit in git.
@@ -27,7 +27,7 @@ module Principles
27
27
  "#{one? ? "it" : "they"} changed is not yet known.#{remedy}"
28
28
  end
29
29
 
30
- # Whether its remedy names the audit command, as it does unless committing files gives the baseline (#1279).
30
+ # Whether its remedy names the audit command, as it does unless committing files gives the baseline.
31
31
  #: () -> bool
32
32
  def names_a_command? = !committing?
33
33
 
@@ -40,7 +40,7 @@ module Principles
40
40
  def committing? = @because == "not_committed" && !@files.empty?
41
41
 
42
42
  # What gives the members a baseline: a completed audit outside git, or in git committing the files that
43
- # differ from HEAD, or an audit again when none does, since every file is committed already (#710 X3). The
43
+ # differ from HEAD, or an audit again when none does, since every file is committed already. The
44
44
  # audit command starts a line of its own, after its purpose.
45
45
  #: () -> String
46
46
  def remedy
@@ -7,7 +7,7 @@ module Principles
7
7
  # What this tool prints, from plain values a controller hands it. views/CLAUDE.md owns the boundary.
8
8
  module Views
9
9
  # The passage setup proposes for every entry file, as the agent pastes it, its lines kept: one or two lines,
10
- # worded for a reader who may not have principles installed (D68, D71).
10
+ # worded for a reader who may not have principles installed.
11
11
  class MetaPrinciplePassage
12
12
  #: (heading: String) -> void
13
13
  def initialize(heading:)
@@ -5,18 +5,19 @@ require_relative "invocation"
5
5
  require_relative "meta_principle_passage"
6
6
  require_relative "printed_principle"
7
7
  require_relative "first_audit"
8
+ require_relative "report_hooks_offer"
8
9
 
9
10
  module Principles
10
11
  # What this tool prints, from plain values a controller hands it. views/CLAUDE.md owns the boundary.
11
12
  module Views
12
13
  # What show-meta-principle-passage prints: the map its printed add-member writes, the facts of the project's entry
13
14
  # files, the one passage any of them would take, and the commands that map the passage once the agent has placed
14
- # it with the user (D68, D71, D74).
15
+ # it with the user.
15
16
  class MetaPrincipleResult
16
17
  # How the printed add-member commands map the passage: heading is the passage's heading, which they name as
17
18
  # its member's section, beside role, the role they give that member; step_role is the role they give a
18
19
  # passage the project has that carries one of the passage's steps, and place_role the one they give any other
19
- # place that keeps the principles held, such as a timer or a settings line (D75).
20
+ # place that keeps the principles held, such as a timer or a settings line.
20
21
  class PassageMapping
21
22
  #: String
22
23
  attr_reader :heading, :role, :step_role, :place_role
@@ -70,11 +71,15 @@ module Principles
70
71
  # The passage's estimated size, which loads in every session that loads the entry file it goes in.
71
72
  #: () -> Integer
72
73
  def estimated_tokens = @fields.fetch("passage").fetch("estimated_tokens")
74
+
75
+ # Whether the plugin's hooks report in this session, so its hook entries need no offer.
76
+ #: () -> bool
77
+ def hooks_run? = @fields.fetch("session_start_hook_in_this_session")
73
78
  end
74
79
 
75
80
  # The map as the project holds it: already_mapped says the map was there before this run, and
76
81
  # members_in_entry_files names its members already in an entry file, by id and path; set_up says the map has a
77
- # member, so the question asks which keeping step each lacks in place of asking to place the passage (D75).
82
+ # member, so the question asks which keeping step each lacks in place of asking to place the passage.
78
83
  class MapInProject
79
84
  #: bool
80
85
  attr_reader :set_up
@@ -91,12 +96,14 @@ module Principles
91
96
  def to_h = @fields
92
97
  end
93
98
 
94
- # existing_principles lists the project's other principles as list-principles lists them.
99
+ # existing_principles lists the project's other principles as list-principles lists them. Outside the plugin,
100
+ # it offers the hook entries that report changed members between audits, as a completed audit does.
95
101
  #: (PrintedPrinciple, Placement, MapInProject, existing_principles: Array[Hash[String, untyped]])
96
102
  #| -> Hash[String, untyped]
97
103
  def proposal(principle, placement, map_in_project, existing_principles:)
104
+ hook_setup = placement.hooks_run? ? {} : { "hook_setup" => ReportHooksOffer.new(@invocation).to_s }
98
105
  { "status" => "question", "principle_id" => principle.id, "map_file" => principle.file,
99
- "map" => principle.map, **map_in_project.to_h, **placement.to_h,
106
+ "map" => principle.map, **map_in_project.to_h, **placement.to_h, **hook_setup,
100
107
  "existing_principles" => existing_principles,
101
108
  "question" => map_in_project.set_up ? steps_lacking(principle, placement) : question(principle.id),
102
109
  "answer_with" => add_member(principle.id), "next_action" => next_action(principle.id, existing_principles) }
@@ -8,17 +8,17 @@ 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
10
  # The check_result a one-member audit's template starts with for a checked member, whose check is the one the last
11
- # audit ran, since any other is refused at its start (#1071), and the instruction its request gives beside it. It
11
+ # audit ran, since any other is refused at its start, and the instruction its request gives beside it. It
12
12
  # asks for a passing run alone, since one that fails or cannot run is refused as a full audit's to judge, so it
13
- # prints no not_run_reason and says nothing of how often full audits run it (#1112). Its exit_status holds a short
13
+ # prints no not_run_reason and says nothing of how often full audits run it. Its exit_status holds a short
14
14
  # placeholder where the integer goes, and what to do, with what the check hides and the line its last review rested
15
- # on, is the instruction's (#1170).
15
+ # on, is the instruction's.
16
16
  class OneMemberCheckResultTemplate
17
17
  # The template for the checked member a request lists as entry, with how its check stands to the last audit's
18
18
  # and any hidden characters in it; nil for a member without a check. exit_status is the placeholder it prints
19
19
  # there, its one field: the answer reads the command as the request printed it and keeps the line the last
20
- # review rested on, so neither is printed to fill (#1166, #1170). own_listing says the check is this tool's own
21
- # list-member-problems, which exits 3 while it lists the member (#1276).
20
+ # review rested on, so neither is printed to fill. own_listing says the check is this tool's own
21
+ # list-member-problems, which exits 3 while it lists the member.
22
22
  #: (Hash[String, untyped], exit_status: String, ?own_listing: bool) -> OneMemberCheckResultTemplate?
23
23
  def self.for(entry, exit_status:, own_listing: false)
24
24
  return unless entry["check"]
@@ -36,7 +36,7 @@ module Principles
36
36
  end
37
37
 
38
38
  # The check_result to fill, with an empty listed_members slot for this tool's own list-member-problems, whose
39
- # instruction says what goes there (#1278).
39
+ # instruction says what goes there.
40
40
  #: () -> Hash[String, untyped]
41
41
  def to_h = { "exit_status" => @exit_status, **(@own_listing ? { "listed_members" => [] } : {}) }
42
42
 
@@ -49,7 +49,7 @@ module Principles
49
49
 
50
50
  private
51
51
 
52
- # What to report for this tool's own list-member-problems, which exits 3 while it lists the member (#1276).
52
+ # What to report for this tool's own list-member-problems, which exits 3 while it lists the member.
53
53
  #: () -> String?
54
54
  def own_listing
55
55
  Prompts.text("acknowledge-a-change/report-the-exit-status-its-own-listing-gives") if @own_listing
@@ -8,8 +8,11 @@ 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
10
  # How a full audit shows the findings other principles leave open on members sharing its members' lines: each
11
- # once, which mapped_elsewhere names by id, with what to do with them (#772, D62).
11
+ # once, which mapped_elsewhere names by id, with what to do with them.
12
12
  class OpenFindingsElsewhereResult
13
+ # The part this lists, by the name the request prints it under and start-audit --part takes.
14
+ PART = "open_findings_elsewhere" #: String
15
+
13
16
  # findings are each such finding, with its principle, id, problem and action.
14
17
  #: (Array[Hash[String, untyped]]) -> void
15
18
  def initialize(findings)
@@ -25,7 +28,7 @@ module Principles
25
28
 
26
29
  text = Prompts.text("assess-every-member/name-another-principles-open-finding-rather-than-raise-it")
27
30
  instruction = Instruction.of_paragraphs("open_findings_elsewhere_instruction", text) { true }
28
- RequestPart.new(shown: { "open_findings_elsewhere" => @findings }, slots: {}, instructions: [instruction])
31
+ RequestPart.new(shown: { PART => @findings }, slots: {}, instructions: [instruction])
29
32
  end
30
33
  end
31
34
  end
@@ -10,15 +10,15 @@ module Principles
10
10
  # What this tool prints, from plain values a controller hands it. views/CLAUDE.md owns the boundary.
11
11
  module Views
12
12
  # list-open-findings --short: the one line a session-start hook puts into the agent's context while any
13
- # finding is open, and nothing when none is (D47). It says how many wait, how long the oldest has, what that
14
- # one waits on, and the command that lists them all, worded as something to act on.
13
+ # finding is open that someone should raise, and nothing when none is. It states the facts the agent judges
14
+ # from, how many wait on someone named or on no one, whom the oldest of the former waits on and git's user
15
+ # name, then says to raise each that waits on its user, and why, with the command that lists them all.
15
16
  class OpenFindingsLine
16
17
  # A waits_on longer than this is cut, so the line stays one short line.
17
18
  WAITS_ON_LIMIT = 80
18
19
 
19
20
  # The session's start the line is worded for, as Claude Code's SessionStart hook names it: startup, resume,
20
- # clear or compact. It says what the context holds already, and so when to raise the findings and when the
21
- # line comes back.
21
+ # clear or compact. It says what the context holds already, and so which reply raises the findings.
22
22
  class SessionStart
23
23
  #: (String) -> void
24
24
  def initialize(source)
@@ -26,31 +26,14 @@ module Principles
26
26
  freeze
27
27
  end
28
28
 
29
- # A resumed conversation already holds the line printed when its context began (#1078).
29
+ # A resumed conversation already holds the line printed when its context began.
30
30
  #: () -> bool
31
31
  def resumed? = @source == "resume"
32
32
 
33
- # When to raise the findings: before the user's first task at startup, and at the next pause once the
34
- # session is under way, after /clear or a compaction (#717).
33
+ # The reply that raises the findings: the first at startup, and the next once the session is under way,
34
+ # after /clear or a compaction.
35
35
  #: () -> String
36
- def raise_when
37
- return Prompts.text("start-a-session/raise-them-before-the-first-task") if startup?
38
-
39
- Prompts.text("start-a-session/raise-them-at-the-next-pause")
40
- end
41
-
42
- # When the line comes back: at each session start, and after each clear or compaction too (#741).
43
- #: () -> String
44
- def returns
45
- return Prompts.text("start-a-session/it-returns-at-each-session-start") if startup?
46
-
47
- Prompts.text("start-a-session/it-returns-after-each-clear-or-compaction-too")
48
- end
49
-
50
- private
51
-
52
- #: () -> bool
53
- def startup? = @source == "startup"
36
+ def reply = @source == "startup" ? "first" : "next"
54
37
  end
55
38
 
56
39
  #: (Invocation) -> void
@@ -60,40 +43,83 @@ module Principles
60
43
  end
61
44
 
62
45
  # waiting is nil when no finding is open, or the count of open findings with the oldest one's principle,
63
- # finding_id, days_open and, when it says, waits_on. not_found is each open finding, by principle and
64
- # finding_id, whose write-up can no longer be found where its recorded_at points (#694). source is the
65
- # session's start: startup, resume, clear or compact.
66
- #: (Hash[String, untyped]?, ?Array[Hash[String, untyped]], ?source: String) -> Lines
67
- def short(waiting, not_found = [], source: "startup")
46
+ # finding_id, days_open, how many wait on someone named and the oldest of those, or nil. not_found is each
47
+ # open finding, by principle and finding_id, whose write-up can no longer be found where its recorded_at
48
+ # points. source is the session's start: startup, resume, clear or compact. user_name is git's, or nil.
49
+ #: (Hash[String, untyped]?, ?Array[Hash[String, untyped]], ?source: String, ?user_name: String?) -> Lines
50
+ def short(waiting, not_found = [], source: "startup", user_name: nil)
51
+ Lines.new(stdout: lines(waiting, not_found, source:, user_name:).map { "#{it}\n" }.join, stderr: "", status: 0)
52
+ end
53
+
54
+ # short's line, as a list of none or one, which report-at-session-start prints among its own.
55
+ #: (Hash[String, untyped]?, ?Array[Hash[String, untyped]], ?source: String, ?user_name: String?) -> Array[String]
56
+ def lines(waiting, not_found = [], source: "startup", user_name: nil)
68
57
  start = SessionStart.new(source)
69
- Lines.new(stdout: waiting ? "#{line(waiting, not_found, start)}\n" : "", stderr: "", status: 0)
58
+ return [] unless waiting
59
+ return [resumed("#{how_long(waiting)} (#{oldest(waiting)})", not_found)] if start.resumed?
60
+ return [] if waiting.fetch("to_raise").zero?
61
+
62
+ [whole(waiting, not_found, start, user_name)]
70
63
  end
71
64
 
72
65
  private
73
66
 
74
- #: (Hash[String, untyped], Array[Hash[String, untyped]], SessionStart) -> String
75
- def line(waiting, not_found, start)
76
- return resumed("#{how_long(waiting)} (#{oldest(waiting)})", not_found) if start.resumed?
67
+ # The line with what to do about the findings, for a context that does not hold it yet: the facts, then the
68
+ # reply that raises them and why, then the command listing them all, which one finding's own need replaces.
69
+ #: (Hash[String, untyped], Array[Hash[String, untyped]], SessionStart, String?) -> String
70
+ def whole(waiting, not_found, start, user_name)
71
+ named = waiting.fetch("waiting_on_someone_named")
72
+ alone = waiting.fetch("to_raise") == 1 && named == 1
73
+ Prompts.text("start-a-session/act-on-the-open-findings",
74
+ facts: "#{waiting_on_someone(waiting)}#{no_one_named(waiting)}#{write_ups(not_found)}" \
75
+ "#{git_user(user_name) unless named.zero?}",
76
+ raise: raise_which(alone, waiting), reply: start.reply, command: alone ? "" : " All: #{all}")
77
+ end
78
+
79
+ # The command listing every open finding, a line each.
80
+ #: () -> String
81
+ def all = @invocation.in_project("list-open-findings", options: ["--lines"])
82
+
83
+ # Which findings the agent raises: the one, if it waits on its user, or each that does, with those waiting on
84
+ # no one, or each when none names anyone.
85
+ #: (bool, Hash[String, untyped]) -> String
86
+ def raise_which(alone, waiting)
87
+ return "If it waits on your user, raise it" if alone
88
+ return "Raise each" if waiting.fetch("waiting_on_someone_named").zero?
77
89
 
78
- whole(waiting, not_found, start)
90
+ "Raise each that waits on your user#{" or on no one" if waiting.fetch("waiting_on_no_one_named").positive?}"
79
91
  end
80
92
 
81
- # The line with what to do about the findings, for a context that does not hold it yet.
82
- #: (Hash[String, untyped], Array[Hash[String, untyped]], SessionStart) -> String
83
- def whole(waiting, not_found, start)
84
- count = waiting.fetch("count")
85
- them, each = pronouns(count)
86
- Prompts.text("start-a-session/act-on-the-open-findings",
87
- when: start.raise_when, returns: start.returns,
88
- findings: "#{how_long(waiting)} (#{named(waiting)})",
89
- without_waits_on: without_waits_on(count, waiting.fetch("without_waits_on", 0)),
90
- write_ups: write_ups(not_found),
91
- them: them, each: each,
92
- command: @invocation.in_project("list-open-findings", options: ["--lines"]))
93
+ # The sentence naming the oldest finding that waits on someone named, and whom, counting them when several do.
94
+ #: (Hash[String, untyped]) -> String
95
+ def waiting_on_someone(waiting)
96
+ oldest = waiting["oldest_waiting_on_someone"] or return ""
97
+ need = need(oldest.fetch("waits_on"))
98
+ need = "#{need}." unless need.end_with?(".")
99
+ named = waiting.fetch("waiting_on_someone_named")
100
+ return "Open finding #{oldest(oldest)} waits on: #{need}" if named == 1
101
+
102
+ "#{counted(named)} on someone; the oldest, #{oldest(oldest)}, waits on: " \
103
+ "#{need}"
104
+ end
105
+
106
+ # The sentence counting the findings deferred with no waits_on, after any naming someone.
107
+ #: (Hash[String, untyped]) -> String
108
+ def no_one_named(waiting)
109
+ unnamed = waiting.fetch("waiting_on_no_one_named")
110
+ return "" if unnamed.zero?
111
+ return " #{unnamed} #{unnamed == 1 ? "waits" : "wait"} on no one named." \
112
+ if waiting.fetch("waiting_on_someone_named").positive?
113
+
114
+ "#{counted(unnamed)} on no one named."
93
115
  end
94
116
 
117
+ # How many open findings wait, as the subject of the sentence saying on whom.
118
+ #: (Integer) -> String
119
+ def counted(count) = count == 1 ? "1 open finding waits" : "#{count} open findings wait"
120
+
95
121
  # A resumed session's line: its conversation already holds the line printed when that context began, so this
96
- # one gives the facts and where the instructions are, not the instructions again (#1078).
122
+ # one gives the facts and where the instructions are, not the instructions again.
97
123
  #: (String, Array[Hash[String, untyped]]) -> String
98
124
  def resumed(findings, not_found)
99
125
  Prompts.text("start-a-session/see-the-earlier-line",
@@ -101,20 +127,12 @@ module Principles
101
127
  command: @invocation.in_project("list-open-findings", options: ["--short"]))
102
128
  end
103
129
 
104
- # How many of several open findings record no waits_on, since the line names only the oldest's (#736). One
105
- # open finding's own name already shows whether it does, so its line says nothing more.
106
- #: (Integer, Integer) -> String
107
- def without_waits_on(count, without)
108
- return "" if count == 1 || without.zero?
109
- return " All #{count} have no waits_on." if without == count
130
+ # git's user name as a fact, for the agent to judge whether the person a finding waits on is its user.
131
+ #: (String?) -> String
132
+ def git_user(name)
133
+ return " git has no user.name set." unless name
110
134
 
111
- " #{without} #{without == 1 ? "has" : "have"} no waits_on."
112
- end
113
-
114
- # The words the line refers to the findings by, all of them and each one, singular or plural together.
115
- #: (Integer) -> [String, String]
116
- def pronouns(count)
117
- count == 1 ? %w[it it] : %w[them each]
135
+ " git's user.name is #{VisibleText.new(name)}."
118
136
  end
119
137
 
120
138
  # The sentence naming the write-ups that can no longer be found, the first by its principle and id, or
@@ -132,10 +150,10 @@ module Principles
132
150
 
133
151
  # How many findings are open and how long the oldest has waited.
134
152
  #: (Hash[String, untyped]) -> String
135
- def how_long(waiting) = "#{counted(waiting.fetch("count"))}#{waited(waiting)}"
153
+ def how_long(waiting) = "#{still_open(waiting.fetch("count"))}#{waited(waiting)}"
136
154
 
137
155
  #: (Integer) -> String
138
- def counted(count)
156
+ def still_open(count)
139
157
  count == 1 ? "1 audit finding is still open, " : "#{count} audit findings are still open, the oldest "
140
158
  end
141
159
 
@@ -147,17 +165,15 @@ module Principles
147
165
  "for #{days} #{days == 1 ? "day" : "days"}"
148
166
  end
149
167
 
150
- # The oldest finding's principle and id, and what it waits on, cut when long. The id and waits_on are free
151
- # text, so each is cut by characters first and then escaped, which may run past the limit to show them (#227).
152
- #: (Hash[String, untyped]) -> String
153
- def named(waiting)
154
- named = oldest(waiting)
155
- waits_on = waiting["waits_on"] or return named
168
+ # A finding's waits_on, cut when long. It is free text, so it is cut by characters first and then escaped,
169
+ # which may run past the limit to show it.
170
+ #: (String) -> String
171
+ def need(waits_on)
156
172
  waits_on = closed("#{whole_words(waits_on[0, WAITS_ON_LIMIT - 3].to_s)}...") if waits_on.length > WAITS_ON_LIMIT
157
- "#{named}, waits on: #{VisibleText.new(waits_on)}"
173
+ VisibleText.new(waits_on).to_s
158
174
  end
159
175
 
160
- # A cut waits_on up to its last whole word, so it never ends in part of one (#1078), or as cut when it is one
176
+ # A cut waits_on up to its last whole word, so it never ends in part of one, or as cut when it is one
161
177
  # word, which has no boundary to cut at.
162
178
  #: (String) -> String
163
179
  def whole_words(cut)
@@ -165,12 +181,12 @@ module Principles
165
181
  cut[0, boundary].to_s
166
182
  end
167
183
 
168
- # The oldest finding's principle and id, which is free text and so escaped (#227).
184
+ # The oldest finding's principle and id, which is free text and so escaped.
169
185
  #: (Hash[String, untyped]) -> String
170
186
  def oldest(waiting) = "#{waiting.fetch("principle")} #{VisibleText.new(waiting.fetch("finding_id"))}"
171
187
 
172
188
  # A cut waits_on with a ")" for each "(" the cut left open, so the line's own parenthesis still reads as
173
- # closing the finding's name (#685).
189
+ # closing the finding's name.
174
190
  #: (String) -> String
175
191
  def closed(cut)
176
192
  cut + (")" * [cut.count("(") - cut.count(")"), 0].max)
@@ -9,8 +9,11 @@ module Principles
9
9
  # What this tool prints, from plain values a controller hands it. views/CLAUDE.md owns the boundary.
10
10
  module Views
11
11
  # How the meta-principle's full audit states, as a fact, each other principle with members no audit has judged
12
- # as they are now, which a check on its passage once reported, beside the release since its last audit (D71).
12
+ # as they are now, which a check on its passage once reported, beside the release since its last audit.
13
13
  class OtherPrinciplesUnjudgedResult
14
+ # The part this lists, by the name the request prints it under and start-audit --part takes.
15
+ PART = "other_principles_with_unjudged_changes" #: String
16
+
14
17
  # principles holds each other principle with such members, by id with their states; empty when there are none.
15
18
  #: (Array[PrincipleWithChangedMembers]) -> void
16
19
  def initialize(principles)
@@ -23,8 +26,8 @@ module Principles
23
26
  #: () -> RequestPart
24
27
  def part
25
28
  why = Prompts.text("assess-every-member/judge-the-keeping-against-the-other-principles")
26
- RequestPart.new(shown: { "other_principles_with_unjudged_changes" => { "principles" => @principles.map(&:to_h),
27
- "why" => why } },
29
+ RequestPart.new(shown: { PART => { "principles" => @principles.map(&:to_h),
30
+ "why" => why } },
28
31
  slots: {})
29
32
  end
30
33
  end
@@ -8,8 +8,11 @@ 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
10
  # How a full audit's request names the files outside the map that differ from the base commit, which a check and
11
- # the answer's evidence read as they are now (#409, #426).
11
+ # the answer's evidence read as they are now.
12
12
  class OutsideTheMapResult
13
+ # The part this lists, by the name the request prints it under and start-audit --part takes.
14
+ PART = "uncommitted_files_outside_the_map" #: String
15
+
13
16
  # outside names the files outside, as paths and any count not_named; nil when there are none or no base commit.
14
17
  #: (Hash[String, untyped]?) -> void
15
18
  def initialize(outside)
@@ -24,7 +27,7 @@ module Principles
24
27
  outside = @outside or return
25
28
 
26
29
  why = Prompts.text("assess-every-member/uncommitted-files-outside-the-map")
27
- RequestPart.new(shown: { "uncommitted_files_outside_the_map" => outside.merge("why" => why) }, slots: {})
30
+ RequestPart.new(shown: { PART => outside.merge("why" => why) }, slots: {})
28
31
  end
29
32
  end
30
33
  end