principles 0.0.4 → 0.0.6

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 (227) hide show
  1. checksums.yaml +4 -4
  2. data/lib/principles/after_commit_hook_options.rb +4 -1
  3. data/lib/principles/cli.rb +3 -1
  4. data/lib/principles/command_line.rb +38 -26
  5. data/lib/principles/command_routes.rb +11 -4
  6. data/lib/principles/controllers/acknowledgement.rb +93 -17
  7. data/lib/principles/controllers/answer.rb +45 -76
  8. data/lib/principles/controllers/answer_phase.rb +54 -0
  9. data/lib/principles/controllers/assessment.rb +46 -11
  10. data/lib/principles/controllers/audit.rb +17 -6
  11. data/lib/principles/controllers/audit_completion.rb +9 -5
  12. data/lib/principles/controllers/command.rb +5 -4
  13. data/lib/principles/controllers/correction.rb +22 -10
  14. data/lib/principles/controllers/full_audit_request.rb +11 -1
  15. data/lib/principles/controllers/guidance_search_paths.rb +31 -0
  16. data/lib/principles/controllers/inventory.rb +15 -29
  17. data/lib/principles/controllers/mapping.rb +9 -1
  18. data/lib/principles/controllers/member_addition.rb +65 -0
  19. data/lib/principles/controllers/member_entries.rb +6 -24
  20. data/lib/principles/controllers/member_problems_report.rb +13 -6
  21. data/lib/principles/controllers/members_a_commit_changed.rb +2 -1
  22. data/lib/principles/controllers/members_to_assess.rb +21 -13
  23. data/lib/principles/controllers/meta_principle_setup.rb +1 -1
  24. data/lib/principles/controllers/repoint.rb +22 -23
  25. data/lib/principles/controllers/survey.rb +60 -0
  26. data/lib/principles/data/audit_files.rb +4 -0
  27. data/lib/principles/data/bounded_file.rb +9 -4
  28. data/lib/principles/data/candidate_files_found.rb +48 -13
  29. data/lib/principles/data/command-steps.json +85 -24
  30. data/lib/principles/data/committed_tree.rb +84 -0
  31. data/lib/principles/data/first_parent_log.rb +48 -0
  32. data/lib/principles/data/first_parent_range.rb +122 -0
  33. data/lib/principles/data/git_command.rb +37 -0
  34. data/lib/principles/data/guidance_search_paths_file.rb +107 -0
  35. data/lib/principles/data/map_files.rb +35 -10
  36. data/lib/principles/data/principles_directory.rb +40 -0
  37. data/lib/principles/data/principles_subfolder.rb +39 -16
  38. data/lib/principles/data/project_files.rb +22 -11
  39. data/lib/principles/data/repository.rb +55 -29
  40. data/lib/principles/data/requested_candidate_files.rb +43 -0
  41. data/lib/principles/data/running_version.rb +3 -5
  42. data/lib/principles/data/schema_check.rb +16 -6
  43. data/lib/principles/data/schemas/acknowledgement-answer.schema.json +18 -5
  44. data/lib/principles/data/schemas/answer-guide.schema.json +255 -68
  45. data/lib/principles/data/schemas/audit-record.schema.json +10 -1
  46. data/lib/principles/data/schemas/command-steps.schema.json +2 -1
  47. data/lib/principles/data/schemas/correction-answer-guide.schema.json +2 -1
  48. data/lib/principles/data/schemas/correction-answer.schema.json +6 -0
  49. data/lib/principles/data/schemas/guidance-search-paths.schema.json +13 -0
  50. data/lib/principles/data/schemas/member-map-history.schema.json +20 -0
  51. data/lib/principles/data/verified_head.rb +162 -0
  52. data/lib/principles/invocation_options.rb +3 -3
  53. data/lib/principles/models/acknowledgement.rb +95 -84
  54. data/lib/principles/models/acknowledgement_left_as_printed.rb +51 -0
  55. data/lib/principles/models/acknowledgement_refusal.rb +90 -0
  56. data/lib/principles/models/answer_place.rb +4 -0
  57. data/lib/principles/models/assessment_answer.rb +0 -45
  58. data/lib/principles/models/assessment_left_as_printed.rb +81 -0
  59. data/lib/principles/models/audit_entry_protecting_map.rb +28 -0
  60. data/lib/principles/models/audit_record.rb +12 -16
  61. data/lib/principles/models/audit_records.rb +52 -23
  62. data/lib/principles/models/candidate_files.rb +44 -10
  63. data/lib/principles/models/candidate_inventory.rb +69 -8
  64. data/lib/principles/models/candidate_outline.rb +195 -0
  65. data/lib/principles/models/captured_head.rb +72 -0
  66. data/lib/principles/models/carried_member.rb +42 -0
  67. data/lib/principles/models/check_since_last_audit.rb +20 -11
  68. data/lib/principles/models/command_steps.rb +17 -1
  69. data/lib/principles/models/declared_map_changes.rb +29 -12
  70. data/lib/principles/models/declared_member_removals.rb +75 -0
  71. data/lib/principles/models/disposition.rb +4 -2
  72. data/lib/principles/models/fix_only_fields.rb +12 -0
  73. data/lib/principles/models/frontmatter_fields.rb +9 -8
  74. data/lib/principles/models/guidance_search_path.rb +26 -0
  75. data/lib/principles/models/guidance_search_paths.rb +57 -0
  76. data/lib/principles/models/instruction_named.rb +35 -0
  77. data/lib/principles/models/left_as_printed.rb +39 -0
  78. data/lib/principles/models/line_span.rb +6 -0
  79. data/lib/principles/models/loaded_files.rb +1 -2
  80. data/lib/principles/models/loading_scope.rb +61 -0
  81. data/lib/principles/models/locator.rb +6 -0
  82. data/lib/principles/models/mapped_principles.rb +39 -37
  83. data/lib/principles/models/member_assessments.rb +9 -31
  84. data/lib/principles/models/member_file.rb +20 -47
  85. data/lib/principles/models/member_hashes_as_written.rb +10 -6
  86. data/lib/principles/models/member_history.rb +7 -5
  87. data/lib/principles/models/member_lines.rb +63 -15
  88. data/lib/principles/models/member_loading_scopes.rb +49 -0
  89. data/lib/principles/models/member_loads.rb +4 -0
  90. data/lib/principles/models/member_mapping_run.rb +30 -0
  91. data/lib/principles/models/member_moves.rb +4 -0
  92. data/lib/principles/models/member_problems.rb +63 -33
  93. data/lib/principles/models/member_region.rb +129 -0
  94. data/lib/principles/models/member_repair_moves.rb +52 -0
  95. data/lib/principles/models/member_snapshots.rb +14 -1
  96. data/lib/principles/models/members_in_consecutive_sections.rb +56 -0
  97. data/lib/principles/models/meta_principle.rb +14 -0
  98. data/lib/principles/models/missing_files.rb +2 -2
  99. data/lib/principles/models/open_findings_elsewhere.rb +4 -0
  100. data/lib/principles/models/other_templates_placeholders.rb +81 -42
  101. data/lib/principles/models/outline_budget.rb +142 -0
  102. data/lib/principles/models/outline_group.rb +31 -0
  103. data/lib/principles/models/outline_section.rb +56 -0
  104. data/lib/principles/models/principle.rb +14 -7
  105. data/lib/principles/models/principle_file_revision.rb +48 -0
  106. data/lib/principles/models/principle_history.rb +46 -19
  107. data/lib/principles/models/principle_lineage.rb +118 -0
  108. data/lib/principles/models/principle_map_revision.rb +39 -0
  109. data/lib/principles/models/principle_mapping_history.rb +132 -0
  110. data/lib/principles/models/principle_members.rb +25 -0
  111. data/lib/principles/models/principle_predecessor.rb +45 -0
  112. data/lib/principles/models/principle_publication.rb +177 -0
  113. data/lib/principles/models/principle_revision.rb +104 -0
  114. data/lib/principles/models/prior_decision_fields.rb +3 -2
  115. data/lib/principles/models/prior_finding_decision.rb +14 -4
  116. data/lib/principles/models/problem_report.rb +17 -5
  117. data/lib/principles/models/project.rb +46 -39
  118. data/lib/principles/models/project_history.rb +45 -25
  119. data/lib/principles/models/quoted_change.rb +137 -0
  120. data/lib/principles/models/record_format.rb +12 -2
  121. data/lib/principles/models/recorded_entry.rb +6 -0
  122. data/lib/principles/models/recorded_hashes.rb +7 -3
  123. data/lib/principles/models/recorded_members.rb +27 -15
  124. data/lib/principles/models/refusal_before_shape.rb +21 -0
  125. data/lib/principles/models/repoint.rb +13 -0
  126. data/lib/principles/models/reported_check.rb +5 -14
  127. data/lib/principles/models/sent_answer.rb +61 -0
  128. data/lib/principles/models/shape_problems_beside.rb +40 -0
  129. data/lib/principles/models/submitted_answer.rb +34 -0
  130. data/lib/principles/models/survey_search_paths.rb +26 -0
  131. data/lib/principles/models/template_placeholders.rb +34 -4
  132. data/lib/principles/models/text_within.rb +55 -0
  133. data/lib/principles/models/unchecked_members.rb +76 -0
  134. data/lib/principles/models/uncommitted_files.rb +50 -0
  135. data/lib/principles/models/unknown_principle.rb +29 -0
  136. data/lib/principles/models/write_up_opening.rb +21 -4
  137. data/lib/principles/positional_arguments.rb +37 -0
  138. data/lib/principles/session_start_options.rb +2 -2
  139. data/lib/principles/start_audit_options.rb +19 -4
  140. data/lib/principles/version.rb +2 -2
  141. data/lib/principles/views/acknowledgement_result.rb +23 -11
  142. data/lib/principles/views/added_member.rb +41 -0
  143. data/lib/principles/views/answered_request.rb +21 -0
  144. data/lib/principles/views/assessed_members.rb +43 -10
  145. data/lib/principles/views/assessment_request.rb +91 -31
  146. data/lib/principles/views/audit_result.rb +40 -28
  147. data/lib/principles/views/candidate_files_result.rb +85 -19
  148. data/lib/principles/views/candidate_outlines_result.rb +25 -0
  149. data/lib/principles/views/check_notes.rb +44 -0
  150. data/lib/principles/views/check_result_template.rb +14 -23
  151. data/lib/principles/views/consecutive_sections_elsewhere.rb +27 -0
  152. data/lib/principles/views/correction_request.rb +32 -1
  153. data/lib/principles/views/guidance_search_paths_result.rb +26 -0
  154. data/lib/principles/views/instruction.rb +74 -0
  155. data/lib/principles/views/json_with_entries_on_lines.rb +59 -0
  156. data/lib/principles/views/loads_to_check_result.rb +2 -2
  157. data/lib/principles/views/map_added_to.rb +56 -2
  158. data/lib/principles/views/map_result.rb +23 -43
  159. data/lib/principles/views/maps_needing_members_or_audit.rb +47 -0
  160. data/lib/principles/views/member_change_since_baseline.rb +23 -5
  161. data/lib/principles/views/member_repairs.rb +22 -52
  162. data/lib/principles/views/members_a_commit_changed.rb +16 -6
  163. data/lib/principles/views/new_loading_scope.rb +31 -0
  164. data/lib/principles/views/one_member_check_result_template.rb +47 -0
  165. data/lib/principles/views/open_findings_elsewhere_result.rb +3 -3
  166. data/lib/principles/views/open_findings_line.rb +77 -23
  167. data/lib/principles/views/principle_read_result.rb +24 -29
  168. data/lib/principles/views/principles_with_no_completed_audit.rb +9 -3
  169. data/lib/principles/views/prior_findings_result.rb +23 -15
  170. data/lib/principles/views/problem_lines.rb +3 -1
  171. data/lib/principles/views/problem_result.rb +8 -3
  172. data/lib/principles/views/prompts/acknowledge-a-change/run-the-check-and-report-it-passing.md +3 -0
  173. data/lib/principles/views/prompts/acknowledge-a-change/say-whether-the-change-keeps-the-meaning.md +6 -12
  174. data/lib/principles/views/prompts/assess-every-member/answer-guide.json +67 -48
  175. data/lib/principles/views/prompts/assess-every-member/assess-each-member-and-the-set.md +0 -4
  176. data/lib/principles/views/prompts/assess-every-member/claim-an-earlier-first-raised-at.md +7 -0
  177. data/lib/principles/views/prompts/assess-every-member/decide-each-prior-finding.md +4 -16
  178. data/lib/principles/views/prompts/assess-every-member/judge-the-set-with-carried-assessments.md +5 -10
  179. data/lib/principles/views/prompts/assess-every-member/keep-or-change-what-a-deferral-waits-on.md +4 -0
  180. data/lib/principles/views/prompts/assess-every-member/read-a-compact-carried-member.md +8 -0
  181. data/lib/principles/views/prompts/assess-every-member/read-a-trimmed-instruction-whole.md +1 -0
  182. data/lib/principles/views/prompts/assess-every-member/review-a-new-or-changed-check-before-running-it.md +9 -0
  183. data/lib/principles/views/prompts/assess-every-member/say-what-observed-means.md +4 -0
  184. data/lib/principles/views/prompts/dispose-of-each-finding/answer-guide.json +1 -0
  185. data/lib/principles/views/prompts/dispose-of-each-finding/fix-or-record-each-finding.md +16 -3
  186. data/lib/principles/views/prompts/dispose-of-each-finding/retain-assessment-and-correction.md +4 -0
  187. data/lib/principles/views/prompts/find-a-principle-to-map/ask-about-other-guidance-search-paths.md +6 -0
  188. data/lib/principles/views/prompts/find-a-principle-to-map/ask-the-owner-after-the-table.md +1 -0
  189. data/lib/principles/views/prompts/find-a-principle-to-map/ask-which-principle-to-map.md +2 -0
  190. data/lib/principles/views/prompts/find-a-principle-to-map/choose-an-existing-or-new-principle.md +2 -0
  191. data/lib/principles/views/prompts/find-a-principle-to-map/choose-one-principle.md +11 -5
  192. data/lib/principles/views/prompts/find-a-principle-to-map/compare-with-mapped-principles.md +11 -0
  193. data/lib/principles/views/prompts/find-a-principle-to-map/leave-test-data-out-of-the-survey.md +1 -0
  194. data/lib/principles/views/prompts/find-a-principle-to-map/read-a-cut-section-back.md +3 -0
  195. data/lib/principles/views/prompts/find-a-principle-to-map/read-left-out-files.md +3 -0
  196. data/lib/principles/views/prompts/find-a-principle-to-map/survey-a-later-range.md +3 -0
  197. data/lib/principles/views/prompts/find-a-principle-to-map/what-each-command-writes.md +4 -4
  198. data/lib/principles/views/prompts/find-a-principle-to-map/where-the-inventory-looks.md +5 -4
  199. data/lib/principles/views/prompts/learn-what-a-command-does/add-guidance-search-path.md +17 -0
  200. data/lib/principles/views/prompts/learn-what-a-command-does/add-member.md +35 -6
  201. data/lib/principles/views/prompts/learn-what-a-command-does/create-principle.md +16 -0
  202. data/lib/principles/views/prompts/learn-what-a-command-does/list-candidate-files.md +55 -7
  203. data/lib/principles/views/prompts/learn-what-a-command-does/list-member-problems.md +9 -8
  204. data/lib/principles/views/prompts/learn-what-a-command-does/list-open-findings.md +10 -11
  205. data/lib/principles/views/prompts/learn-what-a-command-does/list-principles.md +1 -2
  206. data/lib/principles/views/prompts/learn-what-a-command-does/move-member.md +5 -0
  207. data/lib/principles/views/prompts/learn-what-a-command-does/remove-guidance-search-path.md +13 -0
  208. data/lib/principles/views/prompts/learn-what-a-command-does/remove-principle.md +25 -0
  209. data/lib/principles/views/prompts/learn-what-a-command-does/show-answer-check.md +27 -1
  210. data/lib/principles/views/prompts/learn-what-a-command-does/show-candidate-outlines.md +21 -0
  211. data/lib/principles/views/prompts/learn-what-a-command-does/show-meta-principle-passage.md +5 -5
  212. data/lib/principles/views/prompts/learn-what-a-command-does/start-audit.md +24 -24
  213. data/lib/principles/views/prompts/learn-what-a-command-does/submit-answer.md +51 -54
  214. data/lib/principles/views/prompts/read-requested-outlines/continue-the-survey.md +7 -0
  215. data/lib/principles/views/prompts/report-after-a-commit/the-principles-skill-is-where-to-start.md +1 -0
  216. data/lib/principles/views/prompts/set-principles-up/keep-them-held-between-audits.md +2 -0
  217. data/lib/principles/views/prompts/set-principles-up/name-the-step-each-member-lacks.md +2 -0
  218. data/lib/principles/views/prompts/set-principles-up/place-the-passage-with-the-user.md +9 -6
  219. data/lib/principles/views/prompts/start-a-session/see-the-earlier-line.md +2 -0
  220. data/lib/principles/views/record_waiting_on_an_upgrade.rb +3 -3
  221. data/lib/principles/views/request_part.rb +16 -8
  222. data/lib/principles/views/request_parts.rb +4 -0
  223. metadata +92 -7
  224. data/lib/principles/models/candidate_listing.rb +0 -32
  225. data/lib/principles/views/prompts/find-a-principle-to-map/ask-the-owner-before-mapping.md +0 -1
  226. data/lib/principles/views/prompts/report-after-a-commit/the-map-and-audit-skill-says-how-to-audit-these-members.md +0 -1
  227. data/lib/principles/views/prompts/set-principles-up/set-up-first.md +0 -2
@@ -4,6 +4,8 @@
4
4
  require_relative "invocation"
5
5
  require_relative "printed_principle"
6
6
  require_relative "lines_shared_with_member"
7
+ require_relative "consecutive_sections_elsewhere"
8
+ require_relative "added_member"
7
9
  require_relative "map_added_to"
8
10
  require_relative "activation_in_hand"
9
11
  require_relative "first_audit"
@@ -17,7 +19,7 @@ module Principles
17
19
  class MapResult
18
20
  # The placeholders each printed command leaves for the agent to fill.
19
21
  ADD_MEMBER_USAGE = "PATH [--section \"Exact heading text\"] [--starting-at \"text that occurs once\" " \
20
- "[--ending-at \"text that closes the passage\"]] [--query '$.description'] " \
22
+ "[--ending-at \"text occurring once after the opening\"]] [--query '$.description'] " \
21
23
  "--role \"The part it plays\""
22
24
 
23
25
  CREATED = "Which files or Markdown sections reinforce this principle? Add each one with the part it plays, " \
@@ -40,6 +42,17 @@ module Principles
40
42
  question(principle, CREATED, add_member_command(principle.id))
41
43
  end
42
44
 
45
+ # Removal changes an entry rather than writing a file; an untracked deleted map needs no git commit.
46
+ #: (String, file: String) -> Hash[String, untyped]
47
+ def removed(id, file:)
48
+ commit = @in_git ? "If this map was tracked, commit its removal.\n" : ""
49
+ { "status" => "removed", "principle_id" => id, "wrote" => [], "removed" => [file],
50
+ "next_action" => "This map is inactive in routine reports. Any retained findings remain unresolved.\n" \
51
+ "Inspect a readable retained record, if one exists: " \
52
+ "#{@invocation.in_project("show-audit", id)}\n" \
53
+ "#{commit}Inspect the remaining maps: #{@invocation.in_project("list-principles")}" }
54
+ end
55
+
43
56
  #: (PrintedPrinciple) -> Hash[String, untyped]
44
57
  def description_changed(principle)
45
58
  question(principle, "Changed the description of #{principle.id}.", start_audit(principle.id))
@@ -63,14 +76,16 @@ module Principles
63
76
 
64
77
  # shared says which members share a line with the new one; added lists them only when there are some, as it
65
78
  # carries a check only when one is named. joined is what the result says of the map the member joined.
66
- #: (PrintedPrinciple, added: Hash[String, untyped], ?shared: LinesSharedWithMember, ?joined: MapAddedTo)
79
+ #: (PrintedPrinciple, added: Hash[String, untyped], ?shared: LinesSharedWithMember, ?joined: MapAddedTo,
80
+ #| ?consecutive: ConsecutiveSectionsElsewhere)
67
81
  #| -> Hash[String, untyped]
68
- def member_added(principle, added:, shared: LinesSharedWithMember.new, joined: MapAddedTo.new)
69
- added = added.merge(shared.to_h)
70
- question(principle, "#{span(added)}#{shared.note}Add the next member the same way. " \
71
- "#{after_the_member(principle, added.fetch("id"), joined)}".rstrip,
82
+ def member_added(principle, added:, shared: LinesSharedWithMember.new, joined: MapAddedTo.new,
83
+ consecutive: ConsecutiveSectionsElsewhere.new)
84
+ member = AddedMember.new(added, shared: shared, consecutive: consecutive)
85
+ after = joined.after_member(principle, member: member.id, invocation: @invocation, in_git: @in_git)
86
+ question(principle, "#{member.opening}#{after}".rstrip,
72
87
  add_member_command(principle.id), shown: { "member_count" => principle.members.length })
73
- .merge("added" => added)
88
+ .merge("added" => member.to_h.merge(joined.added_facts))
74
89
  end
75
90
 
76
91
  # add-member's report of the map it started, with the description and activation it wrote, which the agent
@@ -114,7 +129,7 @@ module Principles
114
129
  question(principle, "#{done} Check the other members, then start the audit.\nIf you hold a correction " \
115
130
  "request from submit-answer (phase correction), list #{member} in the " \
116
131
  "changed_map_entries of the fixed disposition this change fixes, and submit it instead: " \
117
- "#{@invocation.submit_answer("REQUEST")}",
132
+ "#{@invocation.submit_answer("REQUEST_ID")}",
118
133
  start_audit(principle.id))
119
134
  end
120
135
 
@@ -127,41 +142,6 @@ module Principles
127
142
 
128
143
  private
129
144
 
130
- # What add-member's question says after the member it added, id, as joined says of the map: how a fix claims
131
- # it while a correction may be open, then what to do after mapping, each only when joined says to remind, once
132
- # per sitting (#1025, #1057).
133
- #: (PrintedPrinciple, String, MapAddedTo) -> String
134
- def after_the_member(principle, id, joined)
135
- "#{claimed_by_a_fix(id) if joined.correction_may_be_open && joined.reminded}" \
136
- "#{after_adding(principle, keeps_others_held: joined.keeps_others_held) if joined.reminded}"
137
- end
138
-
139
- # How a member added while a correction is open joins it: a fix claims it, and the next full audit assesses it
140
- # (D72). It ends its own line, since it ends with a command.
141
- #: (String) -> String
142
- def claimed_by_a_fix(member)
143
- "If you hold a correction request from submit-answer (phase correction) and this member fixes one of its " \
144
- "findings, name #{member} in the changed_members of the fixed disposition; the next full audit assesses " \
145
- "it.\nTo submit the correction instead: #{@invocation.submit_answer("REQUEST")}\n"
146
- end
147
-
148
- # What add-member says after the member it added: to commit the map as it changes, how to see it, and the full
149
- # audit's place once it lists every member.
150
- #: (PrintedPrinciple, keeps_others_held: bool) -> String
151
- def after_adding(principle, keeps_others_held:)
152
- "Commit #{principle.file} as it changes, so the project's history shows each change; in git, start-audit " \
153
- "refuses a map that is not committed.\n" \
154
- "To see the map so far: #{@invocation.in_project("show-principle", principle.id)}\n" \
155
- "#{FirstAudit.new(@invocation, in_git: @in_git).after_mapping(principle.id, keeps_others_held:)}"
156
- end
157
-
158
- # The lines a member spans, said so that a passage cut short shows; it ends with a space.
159
- #: (Hash[String, untyped]) -> String
160
- def span(member)
161
- "#{member.fetch("id")} spans lines #{member.fetch("first_line")} to #{member.fetch("last_line")}; " \
162
- "if that is not the passage you meant, move it with move-member. "
163
- end
164
-
165
145
  # shown is what the result prints of the map: the whole map unless the caller names less, as add-member
166
146
  # does (#400).
167
147
  #: (PrintedPrinciple, String, String, ?shown: Hash[String, untyped]) -> Hash[String, untyped]
@@ -0,0 +1,47 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ require_relative "invocation"
5
+ require_relative "principles_with_no_completed_audit"
6
+
7
+ module Principles
8
+ module Views
9
+ # Mapping facts that precede baseline instructions, and their next steps once those instructions are met.
10
+ class MapsNeedingMembersOrAudit
11
+ #: (Invocation, report: Hash[String, untyped], files_to_commit: Hash[String, Array[String]],
12
+ #| ?waiting: Array[String]) -> void
13
+ def initialize(invocation, report:, files_to_commit:, waiting: [])
14
+ @invocation = invocation
15
+ awaiting = report.fetch("awaiting_first_audit", [])
16
+ @ids = report.fetch("no_completed_audit", []) - awaiting - waiting #: Array[String]
17
+ @empty = report.fetch("empty_maps", []) - waiting #: Array[String]
18
+ @files = files_to_commit
19
+ freeze
20
+ end
21
+
22
+ #: () -> String?
23
+ def notice
24
+ PrinciplesWithNoCompletedAudit.new(ids: @ids, audits: []).notice unless @ids.empty?
25
+ end
26
+
27
+ #: () -> Array[String]
28
+ def actions
29
+ [*@empty.map { |id| empty_map(id) }, *(@ids - @empty).map { |id| first_audit(id) }]
30
+ end
31
+
32
+ private
33
+
34
+ #: (String) -> String
35
+ def empty_map(id)
36
+ "#{id} has no members. Add its first member: " \
37
+ "#{@invocation.in_project("add-member", id, usage: "PATH --role ROLE")}"
38
+ end
39
+
40
+ #: (String) -> String
41
+ def first_audit(id)
42
+ after = @files.fetch(id, []).empty? ? "To" : "After committing the required files,"
43
+ "#{after} start #{id}'s first full audit: #{@invocation.in_project("start-audit", id)}"
44
+ end
45
+ end
46
+ end
47
+ end
@@ -13,17 +13,23 @@ module Principles
13
13
  # member holds the member's id, role and evidence; commits holds "base", HEAD, and "baseline", the commit
14
14
  # the member's baseline text is at, and "audit_base" when the baseline is later than the audit's base;
15
15
  # member_lines holds its own lines at each, or their counts when too long; paths holds the paths the change
16
- # spans, its path at the baseline first.
16
+ # spans, its path at the baseline first; first_changed_lines the first line on each side the other lacks.
17
17
  #: (member: Hash[String, untyped], commits: Hash[String, String], member_lines: Hash[String, untyped],
18
- #| paths: Array[String]) -> void
19
- def initialize(member:, commits:, member_lines:, paths:)
18
+ #| first_changed_lines: Hash[String, String], paths: Array[String]) -> void
19
+ def initialize(member:, commits:, member_lines:, first_changed_lines:, paths:)
20
20
  @member = member
21
21
  @commits = commits
22
22
  @member_lines = member_lines
23
+ @first_changed_lines = first_changed_lines
23
24
  @paths = paths
24
25
  freeze
25
26
  end
26
27
 
28
+ # The first line on each side the other lacks, which an answer leaving its quotes out reads them as (#1111,
29
+ # #1166).
30
+ #: Hash[String, String]
31
+ attr_reader :first_changed_lines
32
+
27
33
  #: () -> String
28
34
  def member_id
29
35
  @member.fetch("id")
@@ -39,14 +45,26 @@ module Principles
39
45
  #: () -> Hash[String, untyped]
40
46
  def to_h
41
47
  read = read_the_change
42
- lines = @member_lines.key?("omitted") ? @member_lines.merge("read_instead" => read) : @member_lines
48
+ lines = @member_lines.key?("omitted") ? @member_lines.merge("read_instead" => read) : with_read_instead(read)
43
49
  { "member" => @member, "baseline_commit" => @commits.fetch("baseline"), "base_commit" => base_commit,
44
50
  **@commits.slice("audit_base").transform_keys { "audit_base_commit" },
45
- "member_lines" => lines, "read_the_change" => read }
51
+ "member_lines" => lines, "first_changed_lines" => @first_changed_lines, "read_the_change" => read }
46
52
  end
47
53
 
48
54
  private
49
55
 
56
+ # The member's lines, each side of their changed region left out pointing at read, as the whole lines do (#1103).
57
+ #: (String) -> Hash[String, untyped]
58
+ def with_read_instead(read)
59
+ region = @member_lines["changed_region"]
60
+ return @member_lines unless region
61
+
62
+ sides = region.transform_values do |side|
63
+ side.is_a?(Hash) && side.key?("omitted") ? side.merge("read_instead" => read) : side
64
+ end
65
+ @member_lines.merge("changed_region" => sides)
66
+ end
67
+
50
68
  # Each word quoted for the shell, and every path read by git as written, not as a pattern (#558).
51
69
  #: () -> String
52
70
  def read_the_change
@@ -6,15 +6,16 @@ require_relative "invocation"
6
6
  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
- # The commands that repair a member this tool cannot find: move it, or remove it. A member whose file is
10
- # gone is moved to the path the agent finds, keeping its own section, passage or query, so a rename keeps
11
- # its audit (#268). A member whose place in its file is gone is moved within it, or to another file its text
12
- # moved into (#378); a passage keeps its anchors, so a move cannot silently widen it to its whole new
13
- # section (#251). Which fits is the agent's to judge.
9
+ # The commands that repair a member this tool cannot find: each move Models::MemberRepairMoves gives, then
10
+ # remove it. Which fits is the agent's to judge.
14
11
  class MemberRepairs
15
12
  # The flag that names each locator field in a printed command.
16
13
  FLAGS = { "section" => "--section", "starting_at" => "--starting-at", "ending_at" => "--ending-at",
17
- "query" => "--query" }.freeze #: Hash[String, String]
14
+ "query" => "--query", "path" => "--path" }.freeze #: Hash[String, String]
15
+ # The placeholder the agent fills in for each field a move leaves to it.
16
+ PLACEHOLDERS = { "section" => "HEADING", "starting_at" => "NEW_OPENING_TEXT",
17
+ "ending_at" => "NEW_ENDING_TEXT", "query" => "QUERY",
18
+ "path" => "NEW_PATH" }.freeze #: Hash[String, String]
18
19
 
19
20
  #: (Invocation) -> void
20
21
  def initialize(invocation)
@@ -22,60 +23,29 @@ module Principles
22
23
  freeze
23
24
  end
24
25
 
25
- # The repairs for member, a printed member with its "id", its locator fields and the code of the refusal
26
- # that says why it cannot be found, as "code" or show-principle's "error", of principle id. Each is
27
- # copyable as it is: move-member, with NEW_PATH, HEADING or QUERY to fill in, then, for a section or
28
- # passage lost from a file that is still there, the same move into another file, then remove-member.
29
- #: (String, Hash[String, untyped]) -> Array[String]
30
- def commands(id, member)
31
- member_id = member.fetch("id")
32
- [move(id, member_id, member), *move_elsewhere(id, member_id, member),
33
- @invocation.in_project("remove-member", id, member_id)]
26
+ # The repairs for member_id of principle id: each of moves, as Models::MemberRepairMoves gives them, the locator
27
+ # fields it keeps and those to fill in, as a copyable move-member, then remove-member.
28
+ #: (String, String, Array[Hash[String, untyped]]) -> Array[String]
29
+ def commands(id, member_id, moves)
30
+ [*moves.map { move(id, member_id, it) }, @invocation.in_project("remove-member", id, member_id)]
34
31
  end
35
32
 
36
- # member, as show-principle prints it, with its repairs as repair_with when broken, which the controller says
37
- # of a member an audit would refuse (#272).
38
- #: (String, Hash[String, untyped], broken: bool) -> Hash[String, untyped]
39
- def beside(id, member, broken:)
40
- return member unless broken
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).
35
+ #: (String, Hash[String, untyped], Array[Hash[String, untyped]]?) -> Hash[String, untyped]
36
+ def beside(id, member, moves)
37
+ return member unless moves
41
38
 
42
- member.merge("repair_with" => commands(id, member))
39
+ member.merge("repair_with" => commands(id, member.fetch("id"), moves))
43
40
  end
44
41
 
45
42
  private
46
43
 
47
44
  #: (String, String, Hash[String, untyped]) -> String
48
- def move(id, member_id, member)
49
- if file_unreadable?(member)
50
- kept = flags(member, FLAGS.keys)
51
- return @invocation.in_project("move-member", id, member_id, options: kept, usage: "--path NEW_PATH")
52
- end
53
- return @invocation.in_project("move-member", id, member_id, usage: "--query QUERY") if member["query"]
54
-
55
- @invocation.in_project("move-member", id, member_id, options: flags(member, %w[starting_at ending_at]),
56
- usage: "--section HEADING")
57
- end
58
-
59
- # A section or passage lost from a file that is still there may have moved into another file (#378).
60
- #: (String, String, Hash[String, untyped]) -> Array[String]
61
- def move_elsewhere(id, member_id, member)
62
- return [] if member["query"] || file_unreadable?(member)
63
-
64
- anchors = flags(member, %w[starting_at ending_at])
65
- [@invocation.in_project("move-member", id, member_id, options: anchors,
66
- usage: "--path NEW_PATH --section HEADING")]
67
- end
68
-
69
- # Whether member's file cannot be read, by the refusal it carries.
70
- #: (Hash[String, untyped]) -> bool
71
- def file_unreadable?(member)
72
- (member["code"] || member.dig("error", "code")) == "unreadable_file"
73
- end
74
-
75
- # The flags, with their values, of the locator fields named in keys that member has.
76
- #: (Hash[String, untyped], Array[String]) -> Array[String]
77
- def flags(member, keys)
78
- keys.select { |key| member[key] }.flat_map { |key| [FLAGS.fetch(key), member.fetch(key)] }
45
+ def move(id, member_id, move)
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(" ")
48
+ @invocation.in_project("move-member", id, member_id, options: kept, usage: usage)
79
49
  end
80
50
  end
81
51
  end
@@ -14,8 +14,8 @@ module Principles
14
14
  # list-member-problems --commits-after COMMIT --hook-event EVENT: the whole JSON the plugin's after-commit hook
15
15
  # prints for Claude Code, which puts its additionalContext beside the Bash call's result (D73), or nothing at all.
16
16
  # Claude Code asks for that text to state facts, not to give orders, so it says what the commits changed,
17
- # which command shows more and which skill says how to audit them (#986). It names that skill as Claude Code
18
- # lists a plugin's skill, principles:map-and-audit, which holds since only that host's hook prints this JSON.
17
+ # which command shows more and which skill to start from (#986). It names that skill as a user invokes it,
18
+ # /principles, in Claude Code, the only host whose hook prints this JSON.
19
19
  class MembersACommitChanged
20
20
  NOTHING = Lines.new(stdout: "", stderr: "", status: 0).freeze #: Lines
21
21
 
@@ -27,12 +27,14 @@ module Principles
27
27
 
28
28
  # changed is each member the commits changed, as list-member-problems lists it; others is how many other changed
29
29
  # members it still lists. Those it marks waiting_on_an_upgrade are named apart, with the waits that say why, and
30
- # no audit to run (D85 V8, #1066).
30
+ # no audit to run (D85 V8, #1066); the others still listed are counted beside them too, since this copy may
31
+ # audit those (#1077).
31
32
  #: (String, Array[Hash[String, untyped]], others: Integer, ?waits: Array[RecordWaitingOnAnUpgrade]) -> Lines
32
33
  def changed(event, changed, others:, waits: [])
33
34
  waiting, auditable = changed.partition { |member| member["waiting_on_an_upgrade"] }
34
35
  reported(event, [*(to_audit(auditable, others) unless auditable.empty?),
35
- *(waiting_lines(waiting, waits) unless waiting.empty?)])
36
+ *(waiting_lines(waiting, waits) unless waiting.empty?),
37
+ *(listed_beside_the_waiting(others) if auditable.empty?)])
36
38
  end
37
39
 
38
40
  # A refusal with code, which the commits could have caused.
@@ -44,12 +46,20 @@ module Principles
44
46
 
45
47
  private
46
48
 
47
- # The members to audit, as rows, then what shows more and the skill that says how to audit them.
49
+ # The members to audit, as rows, then what shows more and the skill to start from.
48
50
  #: (Array[Hash[String, untyped]], Integer) -> Array[String]
49
51
  def to_audit(changed, others)
50
52
  [Prompts.text("report-after-a-commit/the-commits-changed-these-members"), *rows(changed),
51
53
  *still_listed(others), Prompts.text("report-after-a-commit/this-command-shows-each-one"), command,
52
- Prompts.text("report-after-a-commit/the-map-and-audit-skill-says-how-to-audit-these-members")]
54
+ Prompts.text("report-after-a-commit/the-principles-skill-is-where-to-start")]
55
+ end
56
+
57
+ # The other changed members still listed, and the command that shows each, or nothing when none is.
58
+ #: (Integer) -> Array[String]
59
+ def listed_beside_the_waiting(others)
60
+ return [] if others.zero?
61
+
62
+ [*still_listed(others), Prompts.text("report-after-a-commit/this-command-shows-each-one"), command]
53
63
  end
54
64
 
55
65
  # The members whose audits wait on an upgrade, as rows, then each wait's line, which says how to update.
@@ -0,0 +1,31 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ module Principles
5
+ module Views
6
+ # A new known scope's literal facts and the availability question, from plain values only.
7
+ class NewLoadingScope
8
+ UNKNOWN_LIMIT = "Unknown scopes in not_compared remain limitations. "
9
+
10
+ #: (?Hash[String, untyped]) -> void
11
+ def initialize(facts = {})
12
+ @facts = facts
13
+ freeze
14
+ end
15
+
16
+ #: () -> Hash[String, untyped]
17
+ def to_h = @facts.empty? ? {} : { "new_loading_scope" => @facts }
18
+
19
+ #: () -> String
20
+ def note
21
+ return "" if @facts.empty?
22
+
23
+ "Claude Code loading derivation, assuming a session at the project root, gives this member a known " \
24
+ "scope not already represented (new_loading_scope). Will each carrier be available where this principle " \
25
+ "applies, or should one link to another carrier? These are predictions, not observed delivery; " \
26
+ "literal paths do not establish glob coverage. " \
27
+ "#{UNKNOWN_LIMIT if @facts.fetch("not_compared", []).any?}"
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,47 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ require_relative "check_notes"
5
+ require_relative "prompts"
6
+
7
+ module Principles
8
+ # What this tool prints, from plain values a controller hands it. views/CLAUDE.md owns the boundary.
9
+ module Views
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
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
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).
16
+ class OneMemberCheckResultTemplate
17
+ # The template for the checked member a request lists as entry, with how its check stands to the last audit's
18
+ # and any hidden characters in it; nil for a member without a check. exit_status is the placeholder it prints
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).
21
+ #: (Hash[String, untyped], exit_status: String) -> OneMemberCheckResultTemplate?
22
+ def self.for(entry, exit_status:)
23
+ return unless entry["check"]
24
+
25
+ new(CheckNotes.new(entry["check_since_last_audit"], entry.fetch("check_hidden_characters", [])), exit_status:)
26
+ end
27
+
28
+ #: (CheckNotes, exit_status: String) -> void
29
+ def initialize(notes, exit_status:)
30
+ @notes = notes
31
+ @exit_status = exit_status
32
+ freeze
33
+ end
34
+
35
+ # The check_result to fill.
36
+ #: () -> Hash[String, untyped]
37
+ def to_h = { "exit_status" => @exit_status }
38
+
39
+ # What to do before filling exit_status, which the request gives as context.check_instruction.
40
+ #: () -> String
41
+ def instruction
42
+ [@notes.hidden_characters, Prompts.text("acknowledge-a-change/run-the-check-and-report-it-passing"),
43
+ *@notes.kept_review].compact.join(" ")
44
+ end
45
+ end
46
+ end
47
+ end
@@ -23,9 +23,9 @@ module Principles
23
23
  def part
24
24
  return if @findings.empty?
25
25
 
26
- instruction = Prompts.text("assess-every-member/name-another-principles-open-finding-rather-than-raise-it")
27
- RequestPart.new(shown: { "open_findings_elsewhere" => @findings,
28
- "open_findings_elsewhere_instruction" => instruction }, slots: {})
26
+ text = Prompts.text("assess-every-member/name-another-principles-open-finding-rather-than-raise-it")
27
+ instruction = Instruction.of_paragraphs("open_findings_elsewhere_instruction", text) { true }
28
+ RequestPart.new(shown: { "open_findings_elsewhere" => @findings }, slots: {}, instructions: [instruction])
29
29
  end
30
30
  end
31
31
  end
@@ -16,6 +16,43 @@ module Principles
16
16
  # A waits_on longer than this is cut, so the line stays one short line.
17
17
  WAITS_ON_LIMIT = 80
18
18
 
19
+ # 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.
22
+ class SessionStart
23
+ #: (String) -> void
24
+ def initialize(source)
25
+ @source = source
26
+ freeze
27
+ end
28
+
29
+ # A resumed conversation already holds the line printed when its context began (#1078).
30
+ #: () -> bool
31
+ def resumed? = @source == "resume"
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).
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"
54
+ end
55
+
19
56
  #: (Invocation) -> void
20
57
  def initialize(invocation)
21
58
  @invocation = invocation
@@ -25,41 +62,42 @@ module Principles
25
62
  # waiting is nil when no finding is open, or the count of open findings with the oldest one's principle,
26
63
  # finding_id, days_open and, when it says, waits_on. not_found is each open finding, by principle and
27
64
  # finding_id, whose write-up can no longer be found where its recorded_at points (#694). source is the
28
- # session's start: startup, clear or compact.
65
+ # session's start: startup, resume, clear or compact.
29
66
  #: (Hash[String, untyped]?, ?Array[Hash[String, untyped]], ?source: String) -> Lines
30
67
  def short(waiting, not_found = [], source: "startup")
31
- Lines.new(stdout: waiting ? "#{line(waiting, not_found, source)}\n" : "", stderr: "", status: 0)
68
+ start = SessionStart.new(source)
69
+ Lines.new(stdout: waiting ? "#{line(waiting, not_found, start)}\n" : "", stderr: "", status: 0)
32
70
  end
33
71
 
34
72
  private
35
73
 
36
- #: (Hash[String, untyped], Array[Hash[String, untyped]], String) -> String
37
- def line(waiting, not_found, source)
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?
77
+
78
+ whole(waiting, not_found, start)
79
+ end
80
+
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)
38
84
  count = waiting.fetch("count")
39
85
  them, each = pronouns(count)
40
86
  Prompts.text("start-a-session/act-on-the-open-findings",
41
- when: raise_when(source), returns: returns(source),
42
- findings: "#{counted(count)}#{waited(waiting)} (#{named(waiting)})",
87
+ when: start.raise_when, returns: start.returns,
88
+ findings: "#{how_long(waiting)} (#{named(waiting)})",
43
89
  without_waits_on: without_waits_on(count, waiting.fetch("without_waits_on", 0)),
44
90
  write_ups: write_ups(not_found),
45
91
  them: them, each: each, command: @invocation.in_project("list-open-findings"))
46
92
  end
47
93
 
48
- # When to raise the findings: before the user's first task at startup, and at the next pause once the session is
49
- # under way, after /clear or a compaction (#717).
50
- #: (String) -> String
51
- def raise_when(source)
52
- return Prompts.text("start-a-session/raise-them-before-the-first-task") if source == "startup"
53
-
54
- Prompts.text("start-a-session/raise-them-at-the-next-pause")
55
- end
56
-
57
- # When the line comes back: at each session start, and after each clear or compaction too (#741).
58
- #: (String) -> String
59
- def returns(source)
60
- return Prompts.text("start-a-session/it-returns-at-each-session-start") if source == "startup"
61
-
62
- Prompts.text("start-a-session/it-returns-after-each-clear-or-compaction-too")
94
+ # A resumed session's line: its conversation already holds the line printed when that context began, so this
95
+ # one gives the facts and where the instructions are, not the instructions again (#1078).
96
+ #: (String, Array[Hash[String, untyped]]) -> String
97
+ def resumed(findings, not_found)
98
+ Prompts.text("start-a-session/see-the-earlier-line",
99
+ findings: findings, write_ups: write_ups(not_found),
100
+ command: @invocation.in_project("list-open-findings", options: ["--short"]))
63
101
  end
64
102
 
65
103
  # How many of several open findings record no waits_on, since the line names only the oldest's (#736). One
@@ -91,6 +129,10 @@ module Principles
91
129
  "recorded_at points, and the list says why."
92
130
  end
93
131
 
132
+ # How many findings are open and how long the oldest has waited.
133
+ #: (Hash[String, untyped]) -> String
134
+ def how_long(waiting) = "#{counted(waiting.fetch("count"))}#{waited(waiting)}"
135
+
94
136
  #: (Integer) -> String
95
137
  def counted(count)
96
138
  count == 1 ? "1 audit finding is still open, " : "#{count} audit findings are still open, the oldest "
@@ -108,12 +150,24 @@ module Principles
108
150
  # text, so each is cut by characters first and then escaped, which may run past the limit to show them (#227).
109
151
  #: (Hash[String, untyped]) -> String
110
152
  def named(waiting)
111
- named = "#{waiting.fetch("principle")} #{VisibleText.new(waiting.fetch("finding_id"))}"
153
+ named = oldest(waiting)
112
154
  waits_on = waiting["waits_on"] or return named
113
- waits_on = closed("#{waits_on[0, WAITS_ON_LIMIT - 3]}...") if waits_on.length > WAITS_ON_LIMIT
155
+ waits_on = closed("#{whole_words(waits_on[0, WAITS_ON_LIMIT - 3].to_s)}...") if waits_on.length > WAITS_ON_LIMIT
114
156
  "#{named}, waits on: #{VisibleText.new(waits_on)}"
115
157
  end
116
158
 
159
+ # 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
160
+ # word, which has no boundary to cut at.
161
+ #: (String) -> String
162
+ def whole_words(cut)
163
+ boundary = cut.rindex(" ") or return cut
164
+ cut[0, boundary].to_s
165
+ end
166
+
167
+ # The oldest finding's principle and id, which is free text and so escaped (#227).
168
+ #: (Hash[String, untyped]) -> String
169
+ def oldest(waiting) = "#{waiting.fetch("principle")} #{VisibleText.new(waiting.fetch("finding_id"))}"
170
+
117
171
  # A cut waits_on with a ")" for each "(" the cut left open, so the line's own parenthesis still reads as
118
172
  # closing the finding's name (#685).
119
173
  #: (String) -> String