principles 0.0.7 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (331) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +383 -0
  3. data/LICENSE +202 -0
  4. data/NOTICE +4 -0
  5. data/README.md +111 -0
  6. data/exe/principles +20 -0
  7. data/lib/principles/after_commit_hook_options.rb +2 -2
  8. data/lib/principles/cli.rb +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 +43 -19
  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 +10 -8
  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 +61 -6
  42. data/lib/principles/data/expected_type.rb +3 -3
  43. data/lib/principles/data/first_parent_log.rb +1 -1
  44. data/lib/principles/data/head_reflog.rb +74 -0
  45. data/lib/principles/data/hook_input.rb +59 -0
  46. data/lib/principles/data/ignored_by_git.rb +2 -2
  47. data/lib/principles/data/known_fields.rb +1 -1
  48. data/lib/principles/data/linked_path.rb +1 -1
  49. data/lib/principles/data/map_files.rb +2 -2
  50. data/lib/principles/data/principles_on_path.rb +83 -0
  51. data/lib/principles/data/principles_subfolder.rb +1 -1
  52. data/lib/principles/data/project_files.rb +10 -3
  53. data/lib/principles/data/repository.rb +14 -7
  54. data/lib/principles/data/running_version.rb +10 -8
  55. data/lib/principles/data/schema_check.rb +5 -5
  56. data/lib/principles/data/schemas/acknowledgement-answer.schema.json +86 -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 +4 -4
  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 +4 -4
  118. data/lib/principles/models/first_full_audit.rb +32 -0
  119. data/lib/principles/models/first_raised_claim.rb +1 -1
  120. data/lib/principles/models/fix_only_fields.rb +1 -1
  121. data/lib/principles/models/head_moves.rb +66 -0
  122. data/lib/principles/models/hook_commands.rb +49 -4
  123. data/lib/principles/models/ignored_candidates.rb +1 -1
  124. data/lib/principles/models/instruction_named.rb +2 -3
  125. data/lib/principles/models/json_digest.rb +2 -2
  126. data/lib/principles/models/json_path_query.rb +1 -1
  127. data/lib/principles/models/kept_prior_finding.rb +9 -9
  128. data/lib/principles/models/last_completed_revision.rb +4 -5
  129. data/lib/principles/models/left_as_printed.rb +2 -2
  130. data/lib/principles/models/line_diff.rb +113 -0
  131. data/lib/principles/models/line_span.rb +1 -1
  132. data/lib/principles/models/list_member_problems_check.rb +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 +36 -31
  162. data/lib/principles/models/open_findings_elsewhere.rb +2 -2
  163. data/lib/principles/models/other_principles.rb +2 -2
  164. data/lib/principles/models/other_templates_placeholders.rb +17 -16
  165. data/lib/principles/models/outline_budget.rb +7 -7
  166. data/lib/principles/models/outline_group.rb +1 -1
  167. data/lib/principles/models/outline_section.rb +2 -2
  168. data/lib/principles/models/part_named.rb +41 -0
  169. data/lib/principles/models/placement.rb +2 -2
  170. data/lib/principles/models/principle.rb +13 -13
  171. data/lib/principles/models/principle_history.rb +8 -8
  172. data/lib/principles/models/principle_members.rb +14 -7
  173. data/lib/principles/models/principles_folder_move.rb +1 -1
  174. data/lib/principles/models/principles_on_path.rb +29 -0
  175. data/lib/principles/models/principles_package.rb +3 -3
  176. data/lib/principles/models/prior_decision_fields.rb +8 -8
  177. data/lib/principles/models/prior_finding_decision.rb +8 -8
  178. data/lib/principles/models/prior_finding_outcomes.rb +1 -1
  179. data/lib/principles/models/prior_findings.rb +5 -5
  180. data/lib/principles/models/problem_report.rb +26 -8
  181. data/lib/principles/models/project.rb +27 -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 +17 -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 +25 -36
  263. data/lib/principles/views/other_principles_unjudged_result.rb +6 -3
  264. data/lib/principles/views/outside_the_map_result.rb +5 -2
  265. data/lib/principles/views/package_since_last_audit_result.rb +29 -6
  266. data/lib/principles/views/parts_index_result.rb +60 -0
  267. data/lib/principles/views/principle_read_result.rb +5 -6
  268. data/lib/principles/views/principle_with_changed_members.rb +1 -1
  269. data/lib/principles/views/principles_with_no_completed_audit.rb +1 -2
  270. data/lib/principles/views/printed_json.rb +51 -0
  271. data/lib/principles/views/printed_principle.rb +1 -1
  272. data/lib/principles/views/prior_finding_decisions_result.rb +4 -4
  273. data/lib/principles/views/prior_findings_result.rb +17 -14
  274. data/lib/principles/views/problem_lines.rb +39 -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 +11 -11
  298. data/lib/principles/views/prompts/learn-what-a-command-does/report-after-commit.md +14 -0
  299. data/lib/principles/views/prompts/learn-what-a-command-does/report-at-session-start.md +26 -0
  300. data/lib/principles/views/prompts/learn-what-a-command-does/show-answer-check.md +20 -18
  301. data/lib/principles/views/prompts/learn-what-a-command-does/show-first-audit-brief.md +19 -0
  302. data/lib/principles/views/prompts/learn-what-a-command-does/show-hook-setup.md +13 -0
  303. data/lib/principles/views/prompts/learn-what-a-command-does/show-meta-principle-passage.md +3 -1
  304. data/lib/principles/views/prompts/learn-what-a-command-does/show-open-correction.md +12 -0
  305. data/lib/principles/views/prompts/learn-what-a-command-does/start-audit.md +21 -22
  306. data/lib/principles/views/prompts/learn-what-a-command-does/submit-answer.md +5 -4
  307. data/lib/principles/views/prompts/report-the-completed-audit/commit-only-what-the-audit-changed.md +2 -2
  308. data/lib/principles/views/prompts/run-a-first-audit-in-the-background/follow-the-brief.md +18 -0
  309. data/lib/principles/views/prompts/set-principles-up/offer-the-report-hooks.md +2 -0
  310. data/lib/principles/views/prompts/set-principles-up/wire-the-report-hooks-with-the-user.md +8 -0
  311. data/lib/principles/views/prompts/start-a-session/act-on-the-open-findings.md +3 -4
  312. data/lib/principles/views/prompts/start-a-session/every-loaded-line-costs-every-session.md +1 -1
  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 +83 -14
  330. data/lib/principles/views/prompts/start-a-session/it-returns-after-each-clear-or-compaction-too.md +0 -1
  331. data/lib/principles/views/prompts/start-a-session/it-returns-at-each-session-start.md +0 -1
@@ -3,23 +3,15 @@
3
3
 
4
4
  require_relative "command"
5
5
  require_relative "../models/audit"
6
- require_relative "../models/evidence_lines_since"
7
6
  require_relative "../models/instruction_named"
8
- require_relative "../models/loading_decision"
9
7
  require_relative "../models/meta_principle"
10
- require_relative "../models/other_principles"
11
- require_relative "../models/prior_decision_fields"
8
+ require_relative "../models/part_named"
12
9
  require_relative "../models/recent_decision"
13
10
  require_relative "../models/reported_check"
14
- require_relative "../models/uncommitted_outside_the_map"
15
11
  require_relative "../views/assessment_request"
16
- require_relative "../views/loads_to_check_result"
17
- require_relative "../views/open_findings_elsewhere_result"
18
- require_relative "../views/other_principles_unjudged_result"
19
- require_relative "../views/outside_the_map_result"
20
- require_relative "../views/package_since_last_audit_result"
21
- require_relative "../views/prior_findings_result"
12
+ require_relative "../views/parts_index_result"
22
13
  require_relative "members_to_assess"
14
+ require_relative "parts_to_read"
23
15
 
24
16
  module Principles
25
17
  # Each runs one command: reads models, applies their rules and prints through a view.
@@ -27,7 +19,7 @@ module Principles
27
19
  module Controllers
28
20
  # The request a full audit of one principle asks as the project stands, which Audit hands over for start-audit:
29
21
  # the commit it is based on, its id and what it asks. Starting writes nothing: the request id is a digest of what
30
- # the request depends on, so Answer checks the answer against the project as it is then (D25).
22
+ # the request depends on, so Answer checks the answer against the project as it is then.
31
23
  class FullAuditRequest < Command
32
24
  # principle_id names the principle whose full audit is asked for; its map is refused unless it can be audited.
33
25
  #: (Models::Project, tool: RunningTool, principle_id: String) -> void
@@ -48,14 +40,14 @@ module Principles
48
40
  audit_result.request(with_record_notice(audit_result.assessment_request(asked))).merge("wrote" => [])
49
41
  end
50
42
 
51
- # The answer alone, as start-audit --as template prints it, to fill and submit under the request's id (D81).
43
+ # The answer alone, as start-audit --as template prints it, to fill and submit under the request's id.
52
44
  #: () -> Hash[String, untyped]
53
45
  def to_fill
54
46
  audit_result.answer_to_fill(asked)
55
47
  end
56
48
 
57
49
  # The instruction field this request prints, read on its own and whole, with the paragraphs for cases the
58
- # request does not hold (D81 step 2); refused when it prints none by that name.
50
+ # request does not hold; refused when it prints none by that name.
59
51
  #: (String) -> Hash[String, untyped]
60
52
  def instruction(field)
61
53
  request = asked
@@ -63,11 +55,34 @@ module Principles
63
55
  { "request_id" => request.request_id, named => request.whole_instruction(named), "wrote" => [] }
64
56
  end
65
57
 
58
+ # The part of this request --part names, printed alone under the request's id, so the agent need not read the
59
+ # whole request for it, the index with how to answer it, and one it leaves out for listing nothing as empty;
60
+ # refused when the request has no part by that name.
61
+ #: (String) -> Hash[String, untyped]
62
+ def part(name)
63
+ request = asked
64
+ parts = request.context_parts(texts: member_texts, optional: PartsToRead::OPTIONAL)
65
+ named = Models::PartNamed.new(name, principle_id: @id, printed: parts.printable, empty: parts.left_out).part
66
+ shown = { "request_id" => request.request_id, **parts.shown(named) }
67
+ shown = Views::PartsIndexResult.new(invocation).printed(shown, request) if named == Views::ContextParts::INDEX
68
+ shown.merge("wrote" => [])
69
+ end
70
+
71
+ # The slot of the answer to fill that --part names beside --as template, a member's as members/ID, printed alone
72
+ # under the request's id; refused when the template has no slot by that name.
73
+ #: (String) -> Hash[String, untyped]
74
+ def slot_to_fill(name)
75
+ request = asked
76
+ slots = request.slots_to_fill
77
+ named = Models::PartNamed.new(name, principle_id: @id, printed: slots.keys, template: true).part
78
+ { "request_id" => request.request_id, "member_assessments" => [slots.fetch(named)], "wrote" => [] }
79
+ end
80
+
66
81
  private
67
82
 
68
83
  # The request and what it asks, listing the findings the last completed audit left to decide, under an id that
69
- # digests them (D35) and the revision of that audit's record (#653), but not the findings other principles leave
70
- # open on members sharing these lines (D62).
84
+ # digests them and the revision of that audit's record, but not the findings other principles leave
85
+ # open on members sharing these lines.
71
86
  #: () -> Views::AssessmentRequest
72
87
  def asked
73
88
  record = @audit_records.find(@id)
@@ -76,10 +91,11 @@ module Principles
76
91
  basis = Models::AssessmentBasis.printed(@base, record)
77
92
  head = Views::AnswerHead.new(request_id: @audit.assessment_id(basis, prior.digested, loads).to_s,
78
93
  basis: basis.to_h)
79
- request_to_assess(head, parts_to_read(prior, loads))
94
+ request_to_assess(head, handed(PartsToRead, audit: @audit, listing: @listing,
95
+ audited_files: audited_files(@audit.map)).listed(prior, loads))
80
96
  end
81
97
 
82
- # What the agent assesses: the members, with what else it reads beside them (D60).
98
+ # What the agent assesses: the members, with what else it reads beside them.
83
99
  #: (Views::AnswerHead, Array[Views::RequestPart]) -> Views::AssessmentRequest
84
100
  def request_to_assess(head, parts)
85
101
  Views::AssessmentRequest.new(principle: { "principle_id" => @id, "description" => @audit.map.description },
@@ -94,76 +110,19 @@ module Principles
94
110
  end
95
111
 
96
112
  # The members the request lists, each checked one's template printing the placeholders an answer leaves as
97
- # printed to give none (#993).
113
+ # printed to give none.
98
114
  #: () -> Views::AssessedMembers
99
115
  def assessed_members
100
116
  Views::AssessedMembers.new(@listing.members,
101
117
  reviewed_check_placeholders: Models::ReportedCheck::PLACEHOLDERS.to_h,
102
118
  unchanged_check_placeholders: Models::ReportedCheck::UNCHANGED_PLACEHOLDERS.to_h,
103
- assessment_placeholder: Models::MemberAssessments::PLACEHOLDER,
104
- sighting_placeholders: Models::MemberAssessments::SIGHTING.to_h)
105
- end
106
-
107
- # The part listing the members to check against the activation, each decision's template printing the
108
- # placeholders an answer leaves as printed to give none (#994); nil when none is listed.
109
- #: (Hash[String, untyped]?) -> Views::RequestPart?
110
- def loads_part(loads)
111
- Views::LoadsToCheckResult.new(invocation, loads, @id, placeholders: Models::LoadingDecision::PLACEHOLDERS.to_h)
112
- .part
113
- end
114
-
115
- # What the agent reads beside the members, in order (D60): the files outside the map that differ from the
116
- # base commit, which a check and the answer's evidence read as they are now (#409); the prior findings
117
- # (D35); the findings other principles leave open on members sharing these lines (D62); and the members to
118
- # check against the activation (#355); each when it lists any; and, on the meta-principle's audit, the release
119
- # since its last audit (D68) and the other principles with members no audit has judged (D71).
120
- #: (Models::PriorFindings, Hash[String, untyped]?) -> Array[Views::RequestPart]
121
- def parts_to_read(prior, loads)
122
- map = @audit.map
123
- [outside_the_map, prior_findings_part(prior),
124
- Views::OpenFindingsElsewhereResult.new(@listing.open_findings_elsewhere).part,
125
- loads_part(loads), package_since_last_audit(map),
126
- other_principles_unjudged(map)].compact
127
- end
128
-
129
- # The part listing each other principle with members no audit has judged as they are now, as
130
- # list-member-problems reports them, for the principle whose audit states them; nil for any other (D71).
131
- #: (Models::Principle) -> Views::RequestPart?
132
- def other_principles_unjudged(map)
133
- return unless map.keeps_others_held?
134
-
135
- listed = Models::OtherPrinciples.of(@project, but: map.id).unjudged.map do |other, members|
136
- Views::PrincipleWithChangedMembers.new(principle_id: other, members: members)
137
- end
138
- Views::OtherPrinciplesUnjudgedResult.new(listed).part
139
- end
140
-
141
- # The part stating the release of principles the last completed audit ran under beside the one now, and
142
- # whether the passage changed since, for a principle whose audit keeps one; nil for any other (D68).
143
- #: (Models::Principle) -> Views::RequestPart?
144
- def package_since_last_audit(map)
145
- now = @tool.release_kept_by(map) or return
146
- last = @audit_records.find(map.id)&.last_completed&.package
147
- Views::PackageSinceLastAuditResult.new(invocation, at_last_audit: last&.version, now: now.version,
148
- passage_changed: last && now.passage_changed_since?(last))
149
- .part
150
- end
151
-
152
- # The part listing the prior findings, in git with each evidence item saying whether its text changed since the
153
- # commit the audit that left them open was based on, and whether it is found now (#858, #877); nil when there are
154
- # none.
155
- #: (Models::PriorFindings) -> Views::RequestPart?
156
- def prior_findings_part(prior)
157
- shown = prior.shown { |item, base| Models::EvidenceLinesSince.of(item, since: base, project: @project).facts }
158
- Views::PriorFindingsResult.new(shown, placeholders: Models::PriorDecisionFields::TEMPLATE_PLACEHOLDERS,
159
- last_audited_commit: prior.last_audited_commit).part
119
+ assessment_placeholder: Models::MemberAssessments::PLACEHOLDER)
160
120
  end
161
121
 
162
- # The part naming the files outside the map that differ from the base commit, or nil when none do.
163
- #: () -> Views::RequestPart?
164
- def outside_the_map
165
- outside = @history.uncommitted_outside(audited_files(@audit.map))
166
- Views::OutsideTheMapResult.new(outside && Models::UncommittedOutsideTheMap.new(outside).shown).part
122
+ # Each member's lines now, by id, without their line endings, so its part carries the text it is judged on.
123
+ #: () -> Hash[String, Array[String]]
124
+ def member_texts
125
+ @audit.map.members.to_h { [it.id, @project.member_file(it.path).lines_of(it.locator).map(&:chomp)] }
167
126
  end
168
127
 
169
128
  # The map's file and every member's file, which the base commit is judged over.
@@ -173,7 +132,7 @@ module Principles
173
132
  end
174
133
 
175
134
  # The request, with a notice when the last audit's record was left uncommitted: a completed one to commit, or an
176
- # open one, which its correction completes, never to commit (D87).
135
+ # open one, which its correction completes, never to commit.
177
136
  #: (Hash[String, untyped]) -> Hash[String, untyped]
178
137
  def with_record_notice(output)
179
138
  return output unless @base && uncommitted_record?
@@ -0,0 +1,49 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ require_relative "command"
5
+ require_relative "../models/report_hooks"
6
+ require_relative "../views/hook_setup_result"
7
+
8
+ module Principles
9
+ # Each runs one command: reads models, applies their rules and prints through a view.
10
+ # controllers/CLAUDE.md owns the boundary.
11
+ module Controllers
12
+ # show-hook-setup: the hook entries that run report-at-session-start and report-after-commit for a user without
13
+ # the principles plugin, on each host. It writes nothing, since the user's settings are theirs: the agent writes
14
+ # the entries once the user agrees.
15
+ class HookSetup < Command
16
+ #: (String, String?, Hash[String, untyped]) -> untyped
17
+ def call(command, _id, _options)
18
+ naming_the_executable do
19
+ unknown(command) unless command == "show-hook-setup"
20
+
21
+ Views::HookSetupResult.new(hosts, principles_on_path: principles_on_path).result
22
+ end
23
+ end
24
+
25
+ private
26
+
27
+ # What PATH says of the principles each entry runs, when it is not this copy: another version first on PATH, or
28
+ # none there that prints a version; nil when a bare principles runs this copy or one of its version.
29
+ #: () -> String?
30
+ def principles_on_path
31
+ other = @tool.other_on_path(asking: Models::ReportHooks::COMMANDS)
32
+ return (Views::HookSetupResult::NONE_ON_PATH unless @tool.launched_on_path?) unless other
33
+
34
+ running = @tool.version
35
+ Views::HookSetupResult.other_on_path(other.path, other.version, running, lacking: other.lacking) if
36
+ other.shadows?(running)
37
+ end
38
+
39
+ # Each host's hooks, as plain values.
40
+ #: () -> Array[Hash[String, untyped]]
41
+ def hosts
42
+ Models::ReportHooks::HOSTS.map do |host|
43
+ { "host" => host.name, "file" => host.file, "offered" => host.offered_in(@project),
44
+ "hooks" => host.hooks.map { { "event" => it.event, "matcher" => it.matcher, "command" => it.command } } }
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
@@ -11,7 +11,7 @@ module Principles
11
11
  # controllers/CLAUDE.md owns the boundary.
12
12
  module Controllers
13
13
  # The reads that show what a project has mapped: its principles, and each member and how fresh it is against the
14
- # last audit. None changes anything on disk. Survey runs the survey of candidate files (#1015).
14
+ # last audit. None changes anything on disk. Survey runs the survey of candidate files.
15
15
  class Inventory < Command
16
16
  #: (String, String?, Hash[String, untyped]) -> untyped
17
17
  def call(command, id, _options)
@@ -54,7 +54,7 @@ module Principles
54
54
  end
55
55
  end
56
56
 
57
- # What show-principle prints of one member: where it is now, its freshness and when its file loads (D38).
57
+ # What show-principle prints of one member: where it is now, its freshness and when its file loads.
58
58
  # The span sits beside the id too, as in add-member's and move-member's results (alpha friction).
59
59
  #: (Hash[String, untyped], Models::AuditRecord?, Models::MemberLoads) -> Hash[String, untyped]
60
60
  def shown_member(member, audit, loads)
@@ -70,12 +70,14 @@ module Principles
70
70
  members.select { |member| Models::MemberState.new(member.fetch("id"), member.fetch("freshness")).broken? }
71
71
  .to_h do |member|
72
72
  id = member.fetch("id")
73
- [id, Models::MemberRepairMoves.new(principle.member(id), code: member.dig("error", "code")).to_a]
73
+ error = member.fetch("error", {})
74
+ [id, Models::MemberRepairMoves.new(principle.member(id), code: error["code"],
75
+ tracked_as: error["tracked_as"]).to_a]
74
76
  end
75
77
  end
76
78
 
77
79
  # The members sharing a line with this one, in its map and in others, as add-member names them, so a member
78
- # whose lines others hold too does not look as if its member_bytes were its alone (#541). A member this tool
80
+ # whose lines others hold too does not look as if its member_bytes were its alone. A member this tool
79
81
  # cannot find now shares nothing it can name.
80
82
  #: (Hash[String, untyped], map: Models::Principle) -> Hash[String, untyped]
81
83
  def shared(member, map:)
@@ -97,7 +99,7 @@ module Principles
97
99
  end
98
100
 
99
101
  # Its next_action offers an audit while one principle's audits do not wait on an upgrade; a map listed with its
100
- # refusal counts, since repairing it leaves it to audit (#1067).
102
+ # refusal counts, since repairing it leaves it to audit.
101
103
  #: () -> untyped
102
104
  def listing
103
105
  ids = @principles.ids
@@ -105,8 +107,8 @@ module Principles
105
107
  read_result.listing(rows(ids), waiting: waiting, one_to_audit: waiting.size < ids.size)
106
108
  end
107
109
 
108
- # One map's row; a map this tool cannot read is listed with its refusal, so the others still show (D29), and one
109
- # whose record a later copy wrote says its audits wait on an upgrade, as show-audit does (#1067).
110
+ # One map's row; a map this tool cannot read is listed with its refusal, so the others still show, and one
111
+ # whose record a later copy wrote says its audits wait on an upgrade, as show-audit does.
110
112
  #: (String) -> Hash[String, untyped]
111
113
  def entry(id)
112
114
  map = @principles.find(id)
@@ -118,7 +120,7 @@ module Principles
118
120
  end
119
121
 
120
122
  # How many of map's members are in each freshness state, against its principle's last audit, or the hashes a
121
- # record a later copy wrote holds, read-only, when this copy cannot read the rest of it (#1067).
123
+ # record a later copy wrote holds, read-only, when this copy cannot read the rest of it.
122
124
  #: (Models::Principle) -> Hash[String, Integer]
123
125
  def members_by_freshness(map)
124
126
  hashes = @audit_records.hashes_to_compare(map.id)
@@ -9,7 +9,7 @@ module Principles
9
9
  # controllers/CLAUDE.md owns the boundary.
10
10
  module Controllers
11
11
  # The writes to what a principle declares as a whole in its committed map: that it exists, its
12
- # description, and when its work is in hand (D38). This tool asks, the agent answers, and this tool writes
12
+ # description, and when its work is in hand. This tool asks, the agent answers, and this tool writes
13
13
  # the map and nothing else. MemberEntries writes each member's entry.
14
14
  class Mapping < Command
15
15
  # Each command and the method that runs it.
@@ -48,7 +48,7 @@ module Principles
48
48
  write_map(map) { |printed| map_result.description_changed(printed) }
49
49
  end
50
50
 
51
- # Records when the principle's work is in hand, as the agent judged it (D38).
51
+ # Records when the principle's work is in hand, as the agent judged it.
52
52
  #: (String, Hash[String, untyped]) -> untyped
53
53
  def change_activation(id, options)
54
54
  activation = Models::Activation.declared(when_files: options["when_files"],
@@ -1,7 +1,6 @@
1
1
  # typed: strict
2
2
  # frozen_string_literal: true
3
3
 
4
- require "json"
5
4
  require_relative "command"
6
5
  require_relative "../models/acknowledgement"
7
6
  require_relative "../models/check_since_last_audit"
@@ -9,19 +8,21 @@ require_relative "../models/list_member_problems_check"
9
8
  require_relative "../models/listed_members"
10
9
  require_relative "../models/member"
11
10
  require_relative "../views/member_change_since_baseline"
11
+ require_relative "../views/printed_json"
12
12
  require_relative "../views/one_member_check_result_template"
13
+ require_relative "../views/read_the_change"
13
14
 
14
15
  module Principles
15
16
  # Each runs one command: reads models, applies their rules and prints through a view.
16
17
  # controllers/CLAUDE.md owns the boundary.
17
18
  module Controllers
18
- # One member's acknowledgement as a one-member audit asks and answers it (D33), which Acknowledgement hands over:
19
+ # One member's acknowledgement as a one-member audit asks and answers it, which Acknowledgement hands over:
19
20
  # the member's change since its baseline as the request shows it, the context beside it and the placeholders its
20
21
  # template prints, and the record with the acknowledgement in it once the answer holds.
21
22
  class MemberAcknowledgement < Command
22
23
  # The text the template prints in each field the agent writes: its judgement's placeholders, meaning_kept's
23
- # chosen by whether the change's first_changed_lines is a pure insertion (#1142), and check_result's for a
24
- # checked member. The quotes the answer reads as first_changed_lines when left out are not printed (#1170).
24
+ # chosen by whether the change's first_changed_lines is a pure insertion, and check_result's for a
25
+ # checked member. The quotes the answer reads as first_changed_lines when left out are not printed.
25
26
  #: (Hash[String, untyped]?, ?Views::MemberChangeSinceBaseline?) -> Hash[String, untyped]
26
27
  def self.placeholders(check_result, change = nil)
27
28
  quotes = change&.first_changed_lines.to_h
@@ -58,18 +59,19 @@ module Principles
58
59
  change = Views::MemberChangeSinceBaseline.new(
59
60
  member: shown(baseline), member_lines: lines.shown(taken: bytes_of(check)),
60
61
  first_changed_lines: @acknowledgement.first_changed_lines(lines), commits: commits(baseline),
61
- paths: @acknowledgement.paths_since(baseline)
62
+ read_the_change: read_the_change(baseline)
62
63
  )
63
64
  { change:, context: { **@acknowledgement.open_findings, **instruction_for(check) },
64
65
  placeholders: MemberAcknowledgement.placeholders(check&.to_h, change) }
65
66
  end
66
67
 
67
68
  # The record with the acknowledgement in it, once its quotes are found at the baseline and now, made to into
68
- # when another member's acknowledgement in the same answer has already changed the record (#1169).
69
- # acknowledging is the ids of every member the answer acknowledges, which its check may list: this member
70
- # alone unless the answer is to several (#1276).
71
- #: (untyped, at: String, ?acknowledging: Array[String], ?into: Models::AuditRecord?) -> Models::AuditRecord
72
- def accepted(response, at:, acknowledging: [@member.id], into: nil)
69
+ # when another member's acknowledgement in the same answer has already changed the record.
70
+ # acknowledging is every member the answer acknowledges, which its check may list, each as its principle id and
71
+ # member id: this member alone unless the answer is to several, of one principle or several.
72
+ #: (untyped, at: String, ?acknowledging: Array[[String, String]], ?into: Models::AuditRecord?)
73
+ #| -> Models::AuditRecord
74
+ def accepted(response, at:, acknowledging: [[@id, @member.id]], into: nil)
73
75
  _baseline, lines = since_baseline
74
76
  @acknowledgement.accepted(response, lines, at:, into:, listed: listed(acknowledging))
75
77
  end
@@ -77,23 +79,23 @@ module Principles
77
79
  private
78
80
 
79
81
  # What the member's check lists now beside the members the answer acknowledges, when the check is this
80
- # tool's own list-member-problems --short; nil for any other check (#1276).
81
- #: (Array[String]) -> Models::ListedMembers?
82
+ # tool's own list-member-problems --short; nil for any other check.
83
+ #: (Array[[String, String]]) -> Models::ListedMembers?
82
84
  def listed(acknowledging)
83
85
  own_listing&.listed(@project, principle_id: @id, acknowledging:)
84
86
  end
85
87
 
86
- # The request's check_instruction for a checked member, how to run and report its check; none without one (#1170).
88
+ # The request's check_instruction for a checked member, how to run and report its check; none without one.
87
89
  #: (Views::OneMemberCheckResultTemplate?) -> Hash[String, String]
88
90
  def instruction_for(check) = check ? { "check_instruction" => check.instruction } : {}
89
91
 
90
92
  # The bytes the check's template and instruction take as the request prints them, which the member's lines
91
- # give up (#1119).
93
+ # give up.
92
94
  #: (Views::OneMemberCheckResultTemplate?) -> Integer
93
- def bytes_of(check) = check ? JSON.pretty_generate(check.to_h).bytesize + check.instruction.bytesize : 0
95
+ def bytes_of(check) = check ? Views::PrintedJson.bytes(check.to_h) + check.instruction.bytesize : 0
94
96
 
95
97
  # The check_result a checked member's answer fills, for the check the last audit ran, which a one-member audit
96
- # requires (D30, D63, #1071), asking for a passing run alone (#1112); nil for a member without a check.
98
+ # requires, asking for a passing run alone; nil for a member without a check.
97
99
  #: () -> Views::OneMemberCheckResultTemplate?
98
100
  def check_template
99
101
  checks = Models::CheckSinceLastAudit.new(principle_history: principle_history(@id),
@@ -103,11 +105,20 @@ module Principles
103
105
  own_listing: !own_listing.nil?)
104
106
  end
105
107
 
106
- # The member's check read as this tool's own list-member-problems --short; nil for any other (#1276).
108
+ # The member's check read as this tool's own list-member-problems --short; nil for any other.
107
109
  #: () -> Models::ListMemberProblemsCheck?
108
110
  def own_listing = Models::ListMemberProblemsCheck.of(@member.check.to_s)
109
111
 
110
- # The member as the request shows it, with where it was at its baseline when it has moved since (#547).
112
+ # The command that shows the member's change from its baseline to the base commit: the history of its own lines
113
+ # where it is now, which the base commit holds, when Member#traced_lines says so, else its file's diff.
114
+ #: (Models::Placement) -> Views::ReadTheChange
115
+ def read_the_change(baseline)
116
+ paths = @acknowledgement.paths_since(baseline)
117
+ lines = @member.traced_lines(paths, @project.located_text(@member.locator).lines)
118
+ Views::ReadTheChange.new(since: baseline.commit, to: @base.to_s, paths:, lines:)
119
+ end
120
+
121
+ # The member as the request shows it, with where it was at its baseline when it has moved since.
111
122
  #: (Models::Placement) -> Hash[String, untyped]
112
123
  def shown(baseline)
113
124
  moved_from = @acknowledgement.moved_from(baseline)
@@ -116,7 +127,7 @@ module Principles
116
127
  **(moved_from ? { "evidence_at_baseline" => [moved_from] } : {}) }
117
128
  end
118
129
 
119
- # The commits the request names: the baseline's, HEAD, and the audit's base when the baseline is later (#550).
130
+ # The commits the request names: the baseline's, HEAD, and the audit's base when the baseline is later.
120
131
  #: (Models::Placement) -> Hash[String, String]
121
132
  def commits(baseline)
122
133
  audit_base = @acknowledgement.audit_base(baseline)
@@ -124,8 +135,8 @@ module Principles
124
135
  end
125
136
 
126
137
  # The member's baseline, the oldest commit from the one it was last judged at that holds the text the audit
127
- # record vouches for, placed as that commit's map placed it or as it is placed now (#547, #550), and its own
128
- # lines there and now, which the answer's quotes are checked against (#379).
138
+ # record vouches for, placed as that commit's map placed it or as it is placed now, and its own
139
+ # lines there and now, which the answer's quotes are checked against.
129
140
  #: () -> [Models::Placement, Models::MemberLines]
130
141
  def since_baseline
131
142
  baseline = @acknowledgement.baseline(@acknowledgement.placements_in(@project))
@@ -35,7 +35,7 @@ module Principles
35
35
 
36
36
  # command as the agent ran it on principle id, with member in place of the member id it gave, and its options
37
37
  # as given, each quoted for a shell and named as the agent typed it: a location by LOCATION_OPTIONS, any other,
38
- # such as --path or --role, by its own one-word name (D56).
38
+ # such as --path or --role, by its own one-word name.
39
39
  #: (String, String, String, Hash[String, untyped]) -> String
40
40
  def rerun(command, id, member, options)
41
41
  flags = options.except("project", "member").flat_map do |name, value|
@@ -57,7 +57,7 @@ module Principles
57
57
  end
58
58
  end
59
59
 
60
- # The part a new member plays, and the check that enforces it when one is named (D30).
60
+ # The part a new member plays, and the check that enforces it when one is named.
61
61
  #: (Hash[String, untyped]) -> Hash[String, untyped]
62
62
  def played(options)
63
63
  role = { "role" => text(options["role"], "--role") }
@@ -73,7 +73,7 @@ module Principles
73
73
 
74
74
  # Points an existing member at a new place (a narrower passage, a renamed heading, an anchor that was
75
75
  # lost, or with --path a file that was renamed) without taking it out of the map, so it keeps its key and
76
- # its audit (#268).
76
+ # its audit.
77
77
  #: (String, Hash[String, untyped]) -> untyped
78
78
  def move_member(id, options)
79
79
  map = @principles.find(id)
@@ -100,7 +100,7 @@ module Principles
100
100
  end
101
101
  end
102
102
 
103
- # Names the command that enforces a member, which the audit asks the agent to run (D30).
103
+ # Names the command that enforces a member, which the audit asks the agent to run.
104
104
  #: (String, Hash[String, untyped]) -> untyped
105
105
  def change_member_check(id, options)
106
106
  map = @principles.find(id)
@@ -8,6 +8,7 @@ require_relative "../models/problem_report"
8
8
  require_relative "../views/record_waiting_on_an_upgrade"
9
9
  require_relative "../views/problem_result"
10
10
  require_relative "../views/problem_lines"
11
+ require_relative "../views/first_audit_line"
11
12
 
12
13
  module Principles
13
14
  # Each runs one command: reads models, applies their rules and prints through a view.
@@ -23,10 +24,37 @@ module Principles
23
24
  end
24
25
  end
25
26
 
27
+ # What report-at-session-start prints of every map's members, a line each, refused as list-member-problems
28
+ # refuses: the lines --short --session-start SOURCE prints on stdout, then, in git, what gives each principle's
29
+ # members with no baseline one, then each principle whose audits wait on an upgrade, whose members are not
30
+ # counted. Outside git only an audit gives a baseline, so that line would repeat at every session.
31
+ #: (String) -> Array[String]
32
+ def session_start_lines(source)
33
+ printing = invocation.without_project
34
+ problems, (report,) = checked(nil, printing)
35
+ lines = Views::ProblemLines.new(printing)
36
+ .session_start_lines(changed: problems.assessed_changes, source:, skill: skill?)
37
+ lines + not_checked_lines(problems, report, printing, source)
38
+ end
39
+
26
40
  private
27
41
 
28
- # list-member-problems' JSON result, or with --short its lines for a trigger (#291), or with --hook-event the
29
- # after-commit hook's JSON, which MembersACommitChanged prints (D73).
42
+ # The session-start lines on members this check cannot judge yet, after those counting the changed ones: what
43
+ # gives members with no baseline one, then each principle whose audits wait on an upgrade, then, worded for the
44
+ # session's source, the line asking for one subagent to run a first full audit while any principle awaits one.
45
+ #: (Models::ProblemReport, Hash[String, untyped], Views::Invocation, String) -> Array[String]
46
+ def not_checked_lines(problems, report, printing, source)
47
+ no_baseline_lines(problems, report, printing) + waiting(nil).map(&:to_s) +
48
+ Views::FirstAuditLine.new(printing).lines(problems.awaiting_first_audit.length, source)
49
+ end
50
+
51
+ # Whether this session has the principles skill, which only the plugin installs, for the lines naming where
52
+ # to start.
53
+ #: () -> bool
54
+ def skill? = @tool.runs_from.principles_skill_in_this_session?
55
+
56
+ # list-member-problems' JSON result, or with --short its lines for a trigger, or with --hook-event the
57
+ # after-commit hook's JSON, which MembersACommitChanged prints.
30
58
  #: (String?, Hash[String, untyped]) -> untyped
31
59
  def printed(id, options)
32
60
  if (event = options["hook_event"])
@@ -36,23 +64,25 @@ module Principles
36
64
 
37
65
  return checked_report(id).merge("wrote" => []) unless options["short"]
38
66
 
39
- short(id, session_start: options["session_start"])
67
+ short(id, session_start: options["session_start"], named: options.key?("project"))
40
68
  end
41
69
 
42
70
  # list-member-problems --short's lines for map id, or every map, and the exit status they end with; with
43
- # --session-start, a count and command per principle in place of the rows (#1261).
44
- # session_start is the source --session-start names, or nil without it.
45
- #: (String?, session_start: String?) -> Views::Lines
46
- def short(id, session_start:)
47
- # Its stderr names the project once, so its commands leave it out (#1263).
48
- problems, (report, names_a_command) = checked(id, invocation.without_project)
49
- view = Views::ProblemLines.new(invocation)
71
+ # --session-start, a count and command per principle in place of the rows.
72
+ # session_start is the source --session-start names, or nil without it. named says whether the run was given
73
+ # --project, which its commands then name; else its stderr names the project once and they leave it
74
+ # out.
75
+ #: (String?, session_start: String?, named: bool) -> Views::Lines
76
+ def short(id, session_start:, named:)
77
+ printing = named ? invocation : invocation.without_project
78
+ problems, (report, names_a_command) = checked(id, printing)
79
+ view = Views::ProblemLines.new(printing)
50
80
  lines = view.short(report, nothing_changed: Views::ProblemResult::NOTHING_CHANGED,
51
81
  assessed_change: problems.assessed_change?,
52
82
  never_assessed: problems.never_assessed, names_a_command:)
53
83
  return lines unless session_start
54
84
 
55
- view.at_session_start(lines, changed: problems.assessed_changes, source: session_start)
85
+ view.at_session_start(lines, changed: problems.assessed_changes, source: session_start, skill: skill?)
56
86
  end
57
87
 
58
88
  # list-member-problems' JSON result for map id, or every map, without the files it wrote.
@@ -61,16 +91,30 @@ module Principles
61
91
 
62
92
  # The problems of map id, or every map, and list-member-problems' JSON result for them, with whether its
63
93
  # next_action names a command, naming each principle whose record a later copy wrote as waiting on an upgrade,
64
- # its members compared read-only (D85 V8, #1066). printing is the invocation its commands name.
94
+ # its members compared read-only. printing is the invocation its commands name.
65
95
  #: (String?, ?Views::Invocation) -> [Models::ProblemReport, [Hash[String, untyped], bool]]
66
96
  def checked(id, printing = invocation)
67
- waiting = (id ? [id] : @principles.ids).filter_map { waiting_on_an_upgrade(it) }
97
+ waiting = waiting(id)
68
98
  problems = Models::ProblemReport.for(@project, id)
69
99
  [problems, member_problems(problems, waiting, printing)]
70
100
  end
71
101
 
72
- # The result for problems, every member of map id or of every map that is broken or whose own text changed
73
- # (#187), and each principle waiting on an upgrade.
102
+ # Each principle, map id's or every map's, whose record a later copy wrote, so its audits wait on an upgrade.
103
+ #: (String?) -> Array[Views::RecordWaitingOnAnUpgrade]
104
+ def waiting(id) = (id ? [id] : @principles.ids).filter_map { waiting_on_an_upgrade(it) }
105
+
106
+ # In git, what gives each principle's members with no baseline one, from problems and report, its result; none
107
+ # outside git.
108
+ #: (Models::ProblemReport, Hash[String, untyped], Views::Invocation) -> Array[String]
109
+ def no_baseline_lines(problems, report, printing)
110
+ return [] unless @history.inside_git?
111
+
112
+ Views::ProblemResult.new(printing).no_baseline_actions(report, problems.files_to_commit(@principles))
113
+ .map(&:to_s)
114
+ end
115
+
116
+ # The result for problems, every member of map id or of every map that is broken or whose own text changed,
117
+ # and each principle waiting on an upgrade.
74
118
  #: (Models::ProblemReport, Array[Views::RecordWaitingOnAnUpgrade], Views::Invocation)
75
119
  #| -> [Hash[String, untyped], bool]
76
120
  def member_problems(problems, waiting, printing)
@@ -80,7 +124,9 @@ module Principles
80
124
  Views::ProblemResult.new(printing)
81
125
  .checked_naming_commands(report, not_read: @project.unread_older_files,
82
126
  no_baseline_files: problems.files_to_commit(@principles),
83
- acknowledgeable: problems.acknowledgeable, waiting:)
127
+ acknowledgeable: problems.acknowledgeable_together(
128
+ except: waiting.map(&:principle)
129
+ ), waiting:)
84
130
  end
85
131
  end
86
132
  end