principles 0.1.2 → 0.1.4

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 (247) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +132 -0
  3. data/README.md +10 -6
  4. data/lib/principles/command_line.rb +15 -6
  5. data/lib/principles/command_routes.rb +11 -1
  6. data/lib/principles/controllers/acknowledgement.rb +19 -4
  7. data/lib/principles/controllers/acknowledgements.rb +43 -12
  8. data/lib/principles/controllers/after_commit_report.rb +15 -2
  9. data/lib/principles/controllers/assessment.rb +7 -3
  10. data/lib/principles/controllers/audit.rb +17 -8
  11. data/lib/principles/controllers/audit_completion.rb +34 -9
  12. data/lib/principles/controllers/carrier_practices.rb +26 -0
  13. data/lib/principles/controllers/command.rb +31 -3
  14. data/lib/principles/controllers/correction.rb +15 -5
  15. data/lib/principles/controllers/full_audit_request.rb +38 -42
  16. data/lib/principles/controllers/inventory.rb +77 -71
  17. data/lib/principles/controllers/last_record_notice_beside.rb +51 -0
  18. data/lib/principles/controllers/member_acknowledgement.rb +21 -11
  19. data/lib/principles/controllers/member_addition.rb +19 -4
  20. data/lib/principles/controllers/member_entries.rb +25 -6
  21. data/lib/principles/controllers/member_problems_report.rb +26 -6
  22. data/lib/principles/controllers/members_a_commit_changed.rb +14 -5
  23. data/lib/principles/controllers/members_in_logged_requests.rb +52 -0
  24. data/lib/principles/controllers/members_to_assess.rb +24 -7
  25. data/lib/principles/controllers/meta_principle_setup.rb +2 -2
  26. data/lib/principles/controllers/open_correction.rb +3 -2
  27. data/lib/principles/controllers/parts_to_read.rb +46 -5
  28. data/lib/principles/controllers/plugin_member_addition.rb +48 -0
  29. data/lib/principles/controllers/principle_listing.rb +84 -0
  30. data/lib/principles/controllers/request_logging.rb +52 -0
  31. data/lib/principles/controllers/running_tool.rb +45 -17
  32. data/lib/principles/data/branches_bringing_in.rb +52 -0
  33. data/lib/principles/data/changes_since.rb +56 -0
  34. data/lib/principles/data/claude_code_home.rb +58 -0
  35. data/lib/principles/data/command-steps.json +91 -15
  36. data/lib/principles/data/decoded_leaf.rb +63 -0
  37. data/lib/principles/data/head_reflog.rb +13 -2
  38. data/lib/principles/data/kept_line.rb +32 -0
  39. data/lib/principles/data/known_marketplaces.rb +50 -0
  40. data/lib/principles/data/logged_request_matches.rb +138 -0
  41. data/lib/principles/data/logged_request_scan.rb +120 -0
  42. data/lib/principles/data/map_files.rb +18 -4
  43. data/lib/principles/data/plugin_folder.rb +85 -0
  44. data/lib/principles/data/plugin_registry.rb +73 -0
  45. data/lib/principles/data/principles_store.rb +49 -0
  46. data/lib/principles/data/ran.rb +25 -0
  47. data/lib/principles/data/raw_request_filter.rb +61 -0
  48. data/lib/principles/data/repository.rb +34 -27
  49. data/lib/principles/data/request_logging_folder.rb +167 -0
  50. data/lib/principles/data/running_version.rb +1 -1
  51. data/lib/principles/data/schemas/acknowledgement-answer.schema.json +16 -1
  52. data/lib/principles/data/schemas/acknowledgements-answer.schema.json +16 -1
  53. data/lib/principles/data/schemas/assessment-answer.schema.json +8 -0
  54. data/lib/principles/data/schemas/command-steps.schema.json +1 -1
  55. data/lib/principles/data/schemas/correction-answer-guide.schema.json +2 -1
  56. data/lib/principles/data/schemas/correction-answer.schema.json +14 -0
  57. data/lib/principles/data/schemas/member-map.schema.json +10 -1
  58. data/lib/principles/data/string_counts.rb +39 -0
  59. data/lib/principles/data/tools_on_path.rb +25 -0
  60. data/lib/principles/invocation_options.rb +4 -2
  61. data/lib/principles/launch.rb +14 -4
  62. data/lib/principles/models/acknowledged_check.rb +11 -1
  63. data/lib/principles/models/acknowledgement.rb +15 -0
  64. data/lib/principles/models/acknowledgement_placeholders.rb +43 -18
  65. data/lib/principles/models/acknowledgement_refusal.rb +20 -11
  66. data/lib/principles/models/acknowledgements_to_offer.rb +86 -0
  67. data/lib/principles/models/after_commit_input.rb +5 -0
  68. data/lib/principles/models/answer_fields.rb +3 -0
  69. data/lib/principles/models/assessment_basis.rb +10 -3
  70. data/lib/principles/models/audit.rb +10 -10
  71. data/lib/principles/models/audit_record.rb +10 -0
  72. data/lib/principles/models/audit_records.rb +4 -3
  73. data/lib/principles/models/audit_start.rb +9 -0
  74. data/lib/principles/models/authored_locator.rb +33 -0
  75. data/lib/principles/models/candidate_files.rb +23 -3
  76. data/lib/principles/models/candidate_outline.rb +18 -125
  77. data/lib/principles/models/captured_sessions.rb +128 -0
  78. data/lib/principles/models/carrier_kind.rb +79 -0
  79. data/lib/principles/models/cited_files.rb +12 -3
  80. data/lib/principles/models/decided_prior_findings.rb +5 -0
  81. data/lib/principles/models/disposition.rb +38 -7
  82. data/lib/principles/models/disposition_placeholders.rb +27 -7
  83. data/lib/principles/models/disposition_text_field.rb +4 -0
  84. data/lib/principles/models/feature.rb +53 -0
  85. data/lib/principles/models/finding_outcomes.rb +55 -0
  86. data/lib/principles/models/findings_left_open.rb +9 -11
  87. data/lib/principles/models/head_moves.rb +27 -10
  88. data/lib/principles/models/installed_component.rb +55 -0
  89. data/lib/principles/models/installed_plugins.rb +174 -0
  90. data/lib/principles/models/kept_sessions.rb +34 -0
  91. data/lib/principles/models/locator.rb +8 -0
  92. data/lib/principles/models/logged_request_reach.rb +44 -0
  93. data/lib/principles/models/logged_request_scan_completeness.rb +43 -0
  94. data/lib/principles/models/mapped_baseline.rb +46 -0
  95. data/lib/principles/models/maps_holding_file_whole.rb +42 -0
  96. data/lib/principles/models/markdown_text.rb +143 -0
  97. data/lib/principles/models/member.rb +14 -1
  98. data/lib/principles/models/member_entry.rb +56 -0
  99. data/lib/principles/models/member_lines.rb +11 -0
  100. data/lib/principles/models/member_loads.rb +17 -2
  101. data/lib/principles/models/member_problems.rb +45 -42
  102. data/lib/principles/models/member_reach.rb +36 -0
  103. data/lib/principles/models/member_snapshots.rb +23 -4
  104. data/lib/principles/models/member_text_as_sent.rb +31 -0
  105. data/lib/principles/models/member_texts.rb +45 -0
  106. data/lib/principles/models/members_in_logged_requests.rb +240 -0
  107. data/lib/principles/models/missing_files.rb +41 -16
  108. data/lib/principles/models/named_placeholder.rb +17 -7
  109. data/lib/principles/models/nearly_matching_maps.rb +56 -0
  110. data/lib/principles/models/open_correction.rb +5 -0
  111. data/lib/principles/models/open_finding.rb +4 -3
  112. data/lib/principles/models/outline_budget.rb +10 -1
  113. data/lib/principles/models/outline_item.rb +25 -0
  114. data/lib/principles/models/outline_section.rb +15 -4
  115. data/lib/principles/models/part_named.rb +16 -2
  116. data/lib/principles/models/plugin_component.rb +37 -0
  117. data/lib/principles/models/plugin_install.rb +33 -0
  118. data/lib/principles/models/plugin_name.rb +23 -0
  119. data/lib/principles/models/plugin_reference.rb +53 -0
  120. data/lib/principles/models/principle_members.rb +15 -0
  121. data/lib/principles/models/prior_finding_decision.rb +1 -1
  122. data/lib/principles/models/prior_finding_outcomes.rb +12 -1
  123. data/lib/principles/models/problem_report.rb +14 -25
  124. data/lib/principles/models/project.rb +35 -29
  125. data/lib/principles/models/project_history.rb +23 -0
  126. data/lib/principles/models/recorded_members.rb +7 -0
  127. data/lib/principles/models/request_logging.rb +196 -0
  128. data/lib/principles/models/runs_from.rb +0 -5
  129. data/lib/principles/models/script_comments.rb +58 -0
  130. data/lib/principles/models/stale_request.rb +9 -0
  131. data/lib/principles/models/template_placeholders.rb +10 -9
  132. data/lib/principles/models/unfixed_part.rb +82 -0
  133. data/lib/principles/models/unresolved_plugin_members.rb +35 -0
  134. data/lib/principles/models/whole_file_member_read.rb +48 -0
  135. data/lib/principles/models/without_prose.rb +20 -0
  136. data/lib/principles/models/workflow_jobs.rb +92 -0
  137. data/lib/principles/show_members_in_logged_requests_options.rb +27 -0
  138. data/lib/principles/show_principle_options.rb +32 -0
  139. data/lib/principles/version.rb +2 -2
  140. data/lib/principles/views/acknowledged_result.rb +31 -12
  141. data/lib/principles/views/acknowledgement_result.rb +41 -29
  142. data/lib/principles/views/acknowledgement_template_alone.rb +55 -0
  143. data/lib/principles/views/acknowledgements_offered.rb +54 -0
  144. data/lib/principles/views/added_member.rb +22 -6
  145. data/lib/principles/views/answer_in_a_file.rb +16 -16
  146. data/lib/principles/views/assessed_members.rb +18 -7
  147. data/lib/principles/views/assessment_request.rb +8 -3
  148. data/lib/principles/views/audit_changes.rb +14 -8
  149. data/lib/principles/views/audit_findings.rb +34 -0
  150. data/lib/principles/views/audit_result.rb +14 -19
  151. data/lib/principles/views/carrier_checks.rb +40 -0
  152. data/lib/principles/views/carrier_practices_page.rb +49 -0
  153. data/lib/principles/views/completed_audit_findings.rb +33 -0
  154. data/lib/principles/views/completed_audit_next_step.rb +12 -4
  155. data/lib/principles/views/consecutive_sections_elsewhere.rb +4 -0
  156. data/lib/principles/views/context_parts.rb +129 -25
  157. data/lib/principles/views/correction_request.rb +22 -17
  158. data/lib/principles/views/disposition_template.rb +35 -0
  159. data/lib/principles/views/first_audit.rb +29 -15
  160. data/lib/principles/views/first_audit_brief.rb +0 -1
  161. data/lib/principles/views/first_audit_line.rb +4 -5
  162. data/lib/principles/views/invocation.rb +16 -6
  163. data/lib/principles/views/last_record_notice.rb +41 -0
  164. data/lib/principles/views/lines_shared_with_member.rb +16 -22
  165. data/lib/principles/views/logged_request_status_meanings.rb +29 -0
  166. data/lib/principles/views/logged_requests_evidence.rb +69 -0
  167. data/lib/principles/views/map_added_to.rb +14 -12
  168. data/lib/principles/views/map_result.rb +39 -17
  169. data/lib/principles/views/member_change_since_baseline.rb +4 -0
  170. data/lib/principles/views/member_row.rb +13 -4
  171. data/lib/principles/views/member_sets_overlap.rb +31 -0
  172. data/lib/principles/views/members_a_commit_changed.rb +42 -25
  173. data/lib/principles/views/members_changed_during_audit.rb +27 -0
  174. data/lib/principles/views/members_in_logged_requests_result.rb +68 -0
  175. data/lib/principles/views/members_too_short_to_scan.rb +45 -0
  176. data/lib/principles/views/members_with_no_baseline.rb +6 -6
  177. data/lib/principles/views/meta_principle_result.rb +14 -2
  178. data/lib/principles/views/open_findings_line.rb +31 -92
  179. data/lib/principles/views/parts_index_result.rb +9 -5
  180. data/lib/principles/views/principle_read_result.rb +52 -11
  181. data/lib/principles/views/prior_findings_result.rb +9 -1
  182. data/lib/principles/views/problem_facts.rb +5 -3
  183. data/lib/principles/views/problem_lines.rb +32 -6
  184. data/lib/principles/views/problem_result.rb +7 -15
  185. data/lib/principles/views/prompts/answer-any-judgement-request/fill-the-answer-in-a-file.md +1 -1
  186. data/lib/principles/views/prompts/assess-every-member/claim-an-earlier-first-raised-at.md +6 -6
  187. data/lib/principles/views/prompts/assess-every-member/read-a-compact-carried-member.md +9 -8
  188. data/lib/principles/views/prompts/assess-every-member/read-a-flagged-member-s-text-whole.md +3 -0
  189. data/lib/principles/views/prompts/assess-every-member/read-a-judged-member-s-text-whole.md +3 -0
  190. data/lib/principles/views/prompts/assess-every-member/turn-on-request-logging-to-see-what-reaches-context.md +2 -0
  191. data/lib/principles/views/prompts/assess-every-member/weigh-what-reached-the-context.md +7 -0
  192. data/lib/principles/views/prompts/dispose-of-each-finding/answer-guide.json +1 -0
  193. data/lib/principles/views/prompts/dispose-of-each-finding/fix-or-record-each-finding.md +5 -0
  194. data/lib/principles/views/prompts/dispose-of-each-finding/retain-assessment-and-correction.md +1 -1
  195. data/lib/principles/views/prompts/find-a-principle-to-map/read-a-cut-section-back.md +1 -1
  196. data/lib/principles/views/prompts/follow-each-carriers-best-practices/practices-for-hook-configuration.md +41 -0
  197. data/lib/principles/views/prompts/follow-each-carriers-best-practices/practices-for-hook-scripts.md +35 -0
  198. data/lib/principles/views/prompts/follow-each-carriers-best-practices/practices-for-instruction-files.md +37 -0
  199. data/lib/principles/views/prompts/follow-each-carriers-best-practices/practices-for-other-text-an-agent-reads.md +38 -0
  200. data/lib/principles/views/prompts/follow-each-carriers-best-practices/practices-for-rule-files.md +34 -0
  201. data/lib/principles/views/prompts/follow-each-carriers-best-practices/practices-for-skills.md +35 -0
  202. data/lib/principles/views/prompts/follow-each-carriers-best-practices/practices-for-subagent-definitions.md +35 -0
  203. data/lib/principles/views/prompts/learn-what-a-command-does/add-member.md +50 -51
  204. data/lib/principles/views/prompts/learn-what-a-command-does/change-member-role.md +2 -1
  205. data/lib/principles/views/prompts/learn-what-a-command-does/list-candidate-files.md +1 -1
  206. data/lib/principles/views/prompts/learn-what-a-command-does/list-member-problems.md +32 -32
  207. data/lib/principles/views/prompts/learn-what-a-command-does/list-open-findings.md +10 -11
  208. data/lib/principles/views/prompts/learn-what-a-command-does/move-member.md +7 -6
  209. data/lib/principles/views/prompts/learn-what-a-command-does/remove-logged-requests.md +16 -0
  210. data/lib/principles/views/prompts/learn-what-a-command-does/remove-member.md +2 -1
  211. data/lib/principles/views/prompts/learn-what-a-command-does/report-at-session-start.md +2 -2
  212. data/lib/principles/views/prompts/learn-what-a-command-does/show-answer-check.md +3 -3
  213. data/lib/principles/views/prompts/learn-what-a-command-does/show-audit.md +7 -0
  214. data/lib/principles/views/prompts/learn-what-a-command-does/show-candidate-outlines.md +8 -2
  215. data/lib/principles/views/prompts/learn-what-a-command-does/show-carrier-practices.md +13 -0
  216. data/lib/principles/views/prompts/learn-what-a-command-does/show-logged-requests.md +20 -0
  217. data/lib/principles/views/prompts/learn-what-a-command-does/show-members-in-logged-requests.md +48 -0
  218. data/lib/principles/views/prompts/learn-what-a-command-does/show-open-correction.md +1 -1
  219. data/lib/principles/views/prompts/learn-what-a-command-does/show-principle.md +14 -14
  220. data/lib/principles/views/prompts/learn-what-a-command-does/start-audit.md +27 -27
  221. data/lib/principles/views/prompts/learn-what-a-command-does/submit-answer.md +11 -11
  222. data/lib/principles/views/prompts/learn-what-a-command-does/turn-off-request-logging.md +10 -0
  223. data/lib/principles/views/prompts/learn-what-a-command-does/turn-on-request-logging.md +32 -0
  224. data/lib/principles/views/prompts/read-requested-outlines/continue-the-survey.md +3 -2
  225. data/lib/principles/views/prompts/read-what-reached-the-context/explain-request-logging-to-the-user.md +11 -0
  226. data/lib/principles/views/prompts/read-what-reached-the-context/see-whether-members-reach-the-agent.md +2 -0
  227. data/lib/principles/views/prompts/read-what-reached-the-context/what-absent-means.md +2 -0
  228. data/lib/principles/views/prompts/read-what-reached-the-context/what-not-a-carrier-means.md +2 -0
  229. data/lib/principles/views/prompts/read-what-reached-the-context/what-present-but-not-loaded-means.md +2 -0
  230. data/lib/principles/views/prompts/read-what-reached-the-context/what-present-means.md +1 -0
  231. data/lib/principles/views/prompts/read-what-reached-the-context/what-unmeasurable-means.md +2 -0
  232. data/lib/principles/views/prompts/report-after-a-commit/plugin-members-are-still-listed.md +1 -0
  233. data/lib/principles/views/prompts/report-after-a-commit/the-commits-changed-these-members-waiting-on-an-upgrade.md +2 -2
  234. data/lib/principles/views/prompts/report-after-a-commit/the-commits-changed-these-members.md +2 -2
  235. data/lib/principles/views/prompts/report-after-a-commit/this-command-shows-what-each-needs-before-the-next-commit.md +1 -0
  236. data/lib/principles/views/prompts/run-a-first-audit-in-the-background/follow-the-brief.md +1 -1
  237. data/lib/principles/views/prompts/set-principles-up/entry-file-passage.md +1 -1
  238. data/lib/principles/views/prompts/start-a-session/act-on-the-open-findings.md +2 -1
  239. data/lib/principles/views/prompts/start-a-session/hand-the-first-audit-to-a-subagent.md +2 -3
  240. data/lib/principles/views/prompts/start-a-session/raise-the-open-findings-waiting-on-no-one.md +1 -0
  241. data/lib/principles/views/request_logging_result.rb +62 -0
  242. data/lib/principles/views/request_part.rb +10 -4
  243. data/lib/principles/views/request_parts.rb +9 -0
  244. data/lib/principles/views/whole_file_elsewhere.rb +30 -0
  245. metadata +101 -4
  246. data/lib/principles/views/prompts/report-after-a-commit/the-principles-skill-is-where-to-start.md +0 -1
  247. data/lib/principles/views/prompts/report-after-a-commit/this-command-shows-each-one.md +0 -1
@@ -16,7 +16,8 @@ module Principles
16
16
  attr_reader :project
17
17
 
18
18
  # named says whether each command names the project; without_project leaves it out. temp_directory is the
19
- # temporary folder the running tool was given, where a printed next step saves an answer.
19
+ # folder a printed next step saves an answer in: the project's ignored tmp/ when it has one, else the temporary
20
+ # folder the running tool was given.
20
21
  #: (executable: String, project: String, temp_directory: String, ?named: bool) -> void
21
22
  def initialize(executable:, project:, temp_directory:, named: true)
22
23
  @executable = executable
@@ -59,11 +60,20 @@ module Principles
59
60
  in_project("submit-answer", request_id, options: ["--file", file])
60
61
  end
61
62
 
62
- # The file to save the answer name names in, a request id or a principle id, by its full path in the temporary
63
- # folder, so every shell that runs the printed commands names the same file: a sandboxed and an unsandboxed one
64
- # read $TMPDIR as different folders.
65
- #: (String) -> String
66
- def answer_file(name) = "#{@temp_directory.chomp("/")}/principles-#{name}-answer.json"
63
+ # The file to save an answer for principle_id in, by its full path in temp_directory, so every shell that runs
64
+ # the printed commands names the same file: a sandboxed and an unsandboxed one read $TMPDIR as different
65
+ # folders. An answer to a request in phase is named by the request's principle and phase alone, not its id, so a
66
+ # request printed again after HEAD moved, with a new id, names the file the first one saved to.
67
+ #: (String, ?String?) -> String
68
+ def answer_file(principle_id, phase = nil)
69
+ "#{@temp_directory.chomp("/")}/#{self.class.answer_name(principle_id, phase)}"
70
+ end
71
+
72
+ # The name of the file an answer for principle_id in phase is saved in, the one owner of its shape.
73
+ #: (String, ?String?) -> String
74
+ def self.answer_name(principle_id, phase = nil)
75
+ "principles-#{[principle_id, phase].compact.join(".")}-answer.json"
76
+ end
67
77
 
68
78
  # The same command, its values given as one list, as a refusal's repair command holds them.
69
79
  #: (String, Array[String], ?options: Array[String], ?usage: String?) -> String
@@ -0,0 +1,41 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ require_relative "invocation"
5
+
6
+ module Principles
7
+ # What this tool prints, from plain values a controller hands it. views/CLAUDE.md owns the boundary.
8
+ module Views
9
+ # The notice start-audit adds about the principle's last audit record, beside a full audit's request: a record
10
+ # left uncommitted, or one holding an open audit.
11
+ class LastRecordNotice
12
+ #: (Invocation) -> void
13
+ def initialize(invocation)
14
+ @invocation = invocation
15
+ freeze
16
+ end
17
+
18
+ # The notice start-audit adds when the last audit's record is not committed.
19
+ #: (String) -> String
20
+ def uncommitted(file)
21
+ "The last audit's record, #{file}, is not committed. Commit it, so the project keeps it."
22
+ end
23
+
24
+ # The notice start-audit adds, in git, when the last audit's record is open: its correction completes it, so it
25
+ # is never committed.
26
+ #: (String) -> String
27
+ def open(file)
28
+ "The last audit's record, #{file}, holds an open audit, waiting on its correction. Do not commit it: submit " \
29
+ "that correction, or answer this request, which replaces it, or discard it with `git restore #{file}`."
30
+ end
31
+
32
+ # The notice start-audit adds while principle_id's last audit is open and keeps its correction: the command that
33
+ # prints that correction again, to resume it.
34
+ #: (String) -> String
35
+ def resume(principle_id)
36
+ "The last audit of #{principle_id} is open, waiting on its correction. To resume it, print that correction " \
37
+ "again: #{@invocation.in_project("show-open-correction", principle_id)}"
38
+ end
39
+ end
40
+ end
41
+ end
@@ -19,6 +19,11 @@ module Principles
19
19
  TEXT_CHECK = "Lines are not text: where two share a first or last line, a passage can start or end partway " \
20
20
  "through it, so check the text there before deciding which edit reaches which member. " #: String
21
21
 
22
+ # What an edit to this member reaches when one of them spans all of its lines.
23
+ SPANNING = "Every edit to this member's text is an edit to each marked spans_these_lines too. " #: String
24
+ # What an edit to one of them reaches when it lies within this member's lines.
25
+ WITHIN = "Every edit to the text of each marked within_these_lines is an edit to this member's too. " #: String
26
+
22
27
  # text_check says whether a member holding another's lines is not a whole file, so the text needs checking.
23
28
  #: (?overlaps: Array[String], ?same_lines_as: Array[String], ?mapped_elsewhere: Array[Hash[String, untyped]],
24
29
  #| ?text_check: bool) -> void
@@ -60,33 +65,22 @@ module Principles
60
65
  "share changes each. #{spans_note}Check that this member's role fits beside the roles they give it there. "
61
66
  end
62
67
 
63
- # Which of them span all of this member's lines and which lie within them, so the agent can work out which
64
- # member an edit reaches. Lines are not text, so the agent checks where they share a first or last line.
68
+ # What an edit reaches where some of them are marked spans_these_lines or within_these_lines, said once by the
69
+ # mark, since mapped_elsewhere names each; one sentence per entry made a whole-file member's result 9.4 KB.
70
+ # Lines are not text, so the agent checks where they share a first or last line.
65
71
  #: () -> String
66
72
  def spans_note
67
- spans = @mapped_elsewhere.filter_map do |each|
68
- if each["spans_these_lines"] then spanning(each)
69
- elsif each["within_these_lines"] then within(each)
70
- end
71
- end
72
- "#{spans.join}#{TEXT_CHECK if @text_check && spans.any?}"
73
- end
73
+ spans = marked?("spans_these_lines")
74
+ within = marked?("within_these_lines")
75
+ return "" unless spans || within
74
76
 
75
- # One that spans all of this member's lines: an edit to this member reaches it, and one outside them only it.
76
- #: (Hash[String, untyped]) -> String
77
- def spanning(each)
78
- id = "`#{each.fetch("member_id")}`"
79
- "#{id} in #{each.fetch("principle_id")} spans all of this member's lines, so every edit to this member's " \
80
- "text is an edit to it too, and an edit outside the shared lines reaches only #{id}. "
77
+ "#{SPANNING if spans}#{WITHIN if within}An edit outside the shared lines reaches only the member it is in. " \
78
+ "#{TEXT_CHECK if @text_check}"
81
79
  end
82
80
 
83
- # One within this member's lines: an edit to it reaches this member, and one outside them only this member.
84
- #: (Hash[String, untyped]) -> String
85
- def within(each)
86
- "`#{each.fetch("member_id")}` in #{each.fetch("principle_id")} lies within this member's lines, so every " \
87
- "edit to its text is an edit to this member's too, and an edit outside the shared lines reaches only " \
88
- "this member. "
89
- end
81
+ # Whether any of them carries this mark.
82
+ #: (String) -> bool
83
+ def marked?(mark) = @mapped_elsewhere.any? { |each| each[mark] }
90
84
 
91
85
  # Equal lines are not equal text, as a passage can end within its last line, so the agent decides.
92
86
  #: () -> String
@@ -0,0 +1,29 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ require_relative "prompts"
5
+
6
+ module Principles
7
+ # What this tool prints, from plain values a controller hands it. views/CLAUDE.md owns the boundary.
8
+ module Views
9
+ # What each status a member can have in the logged requests means, in one line each, printed once beside the
10
+ # members that carry them, so the agent reads a status without guessing. not_a_carrier comes first, since a first
11
+ # reader most often mistakes it for a gap.
12
+ class LoggedRequestStatusMeanings
13
+ #: () -> void
14
+ def initialize
15
+ freeze
16
+ end
17
+
18
+ # Each status, with its one-line meaning.
19
+ #: () -> Hash[String, String]
20
+ def to_h
21
+ { "not_a_carrier" => Prompts.text("read-what-reached-the-context/what-not-a-carrier-means"),
22
+ "present" => Prompts.text("read-what-reached-the-context/what-present-means"),
23
+ "present_but_not_loaded" => Prompts.text("read-what-reached-the-context/what-present-but-not-loaded-means"),
24
+ "absent" => Prompts.text("read-what-reached-the-context/what-absent-means"),
25
+ "unmeasurable" => Prompts.text("read-what-reached-the-context/what-unmeasurable-means") }
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,69 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ require_relative "invocation"
5
+ require_relative "logged_request_status_meanings"
6
+ require_relative "prompts"
7
+ require_relative "request_part"
8
+
9
+ module Principles
10
+ # What this tool prints, from plain values a controller hands it. views/CLAUDE.md owns the boundary.
11
+ module Views
12
+ # What a full audit's request prints from the logged requests, so the agent judging each
13
+ # member sees whether its text reached the agent's context: here, while none is captured, the one line saying how
14
+ # to capture them; while git might commit them or a tool the scan runs is missing, why none is read; and else how
15
+ # far each judged member's text reached them.
16
+ class LoggedRequestsEvidence
17
+ # The part this prints, by the name the request prints it under and start-audit --part takes.
18
+ PART = "logged_requests" #: String
19
+
20
+ #: (Invocation) -> void
21
+ def initialize(invocation)
22
+ @invocation = invocation
23
+ freeze
24
+ end
25
+
26
+ # The request's part saying that no request is captured, and the command that turns capture on.
27
+ #: () -> RequestPart
28
+ def none_captured
29
+ turn_on = @invocation.in_project("turn-on-request-logging")
30
+ fact = Prompts.text("assess-every-member/turn-on-request-logging-to-see-what-reaches-context", turn_on:)
31
+ RequestPart.new(shown: { PART => { "fact" => fact } }, slots: {})
32
+ end
33
+
34
+ # The request's part saying how far each judged member's text reached the captured requests, as reach gives it,
35
+ # with the command that shows where in the requests one member was seen, its key as KEY, what each status
36
+ # means, and the question that asks the agent to weigh it.
37
+ #: (Hash[String, untyped]) -> RequestPart
38
+ def reached(reach)
39
+ detail = @invocation.in_project("show-members-in-logged-requests", options: ["--member", "KEY"])
40
+ weigh = Prompts.text("assess-every-member/weigh-what-reached-the-context")
41
+ shown = reach.merge("detail_with" => detail, "status_meanings" => LoggedRequestStatusMeanings.new.to_h,
42
+ "weigh" => weigh)
43
+ RequestPart.new(shown: { PART => shown }, slots: {})
44
+ end
45
+
46
+ # The request's part, by its name alone, for a read of the request that prints none of it, so the captured
47
+ # requests go unscanned, with why the index gives no bytes for it; it adds no slot to the answer.
48
+ #: () -> RequestPart
49
+ def not_scanned = NotScanned.new(shown: { PART => {} }, slots: {})
50
+
51
+ # The part a read left unscanned, which the index gives no bytes for, since sizing it would wait on the scan.
52
+ class NotScanned < RequestPart
53
+ # Why the index gives no bytes for this part.
54
+ #: () -> String
55
+ def bytes_unknown
56
+ "Reading this part scans the logged requests, so the index does not size it; read it with part_command."
57
+ end
58
+ end
59
+
60
+ # The request's part saying why no logged request is read, from the refusal a read of them gives: its message
61
+ # as the fact, and its repair.
62
+ #: (Hash[String, untyped]) -> RequestPart
63
+ def unread(refusal)
64
+ RequestPart.new(shown: { PART => { "fact" => refusal.fetch("message"), "repair" => refusal.fetch("repair") } },
65
+ slots: {})
66
+ end
67
+ end
68
+ end
69
+ end
@@ -8,16 +8,18 @@ module Principles
8
8
  # What this tool prints, from plain values a controller hands it. views/CLAUDE.md owns the boundary.
9
9
  module Views
10
10
  # What add-member's result needs to know of the map a member joined, beyond the map itself: whether its
11
- # principle keeps the others held, which changes the step after mapping, and whether a full audit's
12
- # correction may be open on it, so that the member may fix one of its findings, and whether to repeat
13
- # what to do after mapping: with a principle's first member, or in git the first since the map's last commit, so
14
- # members mapped in one sitting do not each repeat it.
11
+ # principle keeps the others held, and which mapped principles it holds, which changes the step after mapping,
12
+ # whether a full audit's correction may be open on it, so that the member may fix one of its findings, and
13
+ # whether to repeat what to do after mapping: with a principle's first member, or in git the first since the
14
+ # map's last commit, so members mapped in one sitting do not each repeat it.
15
15
  class MapAddedTo
16
16
  COMPLETENESS_QUESTION = "Is every carrier of the same rule mapped, and should any member belong to another " \
17
17
  "principle? "
18
18
 
19
- #: bool
20
- attr_reader :keeps_others_held
19
+ # The ids of the other mapped principles this map keeps held: nil for a map that keeps none held, and empty
20
+ # for the keeping principle's map while no other principle is mapped.
21
+ #: Array[String]?
22
+ attr_reader :keeps_held
21
23
 
22
24
  #: bool
23
25
  attr_reader :correction_may_be_open
@@ -25,11 +27,11 @@ module Principles
25
27
  #: bool
26
28
  attr_reader :reminded
27
29
 
28
- #: (?keeps_others_held: bool, ?correction_may_be_open: bool, ?reminded: bool,
30
+ #: (?keeps_held: Array[String]?, ?correction_may_be_open: bool, ?reminded: bool,
29
31
  #| ?asks_about_completeness: bool, ?new_scope: NewLoadingScope) -> void
30
- def initialize(keeps_others_held: false, correction_may_be_open: false, reminded: true,
32
+ def initialize(keeps_held: nil, correction_may_be_open: false, reminded: true,
31
33
  asks_about_completeness: false, new_scope: NewLoadingScope.new)
32
- @keeps_others_held = keeps_others_held
34
+ @keeps_held = keeps_held
33
35
  @correction_may_be_open = correction_may_be_open
34
36
  @reminded = reminded
35
37
  @asks_about_completeness = asks_about_completeness
@@ -40,14 +42,14 @@ module Principles
40
42
  # This immutable reminder context with the model's decision to ask about coverage, not a completeness verdict.
41
43
  #: (asks: bool) -> MapAddedTo
42
44
  def with_completeness_question(asks:)
43
- MapAddedTo.new(keeps_others_held: @keeps_others_held, correction_may_be_open: @correction_may_be_open,
45
+ MapAddedTo.new(keeps_held: @keeps_held, correction_may_be_open: @correction_may_be_open,
44
46
  reminded: @reminded, asks_about_completeness: asks, new_scope: @new_scope)
45
47
  end
46
48
 
47
49
  # This immutable addition context with the model's new-scope facts, preserving its original reminder flags.
48
50
  #: (NewLoadingScope) -> MapAddedTo
49
51
  def with_loading_scope(scope)
50
- MapAddedTo.new(keeps_others_held: @keeps_others_held, correction_may_be_open: @correction_may_be_open,
52
+ MapAddedTo.new(keeps_held: @keeps_held, correction_may_be_open: @correction_may_be_open,
51
53
  reminded: @reminded, asks_about_completeness: @asks_about_completeness, new_scope: scope)
52
54
  end
53
55
 
@@ -78,7 +80,7 @@ module Principles
78
80
  "Commit #{principle.file} as it changes, so the project's history shows each change; in git, start-audit " \
79
81
  "refuses a map that is not committed.\n" \
80
82
  "To see the map so far: #{invocation.in_project("show-principle", principle.id)}\n" \
81
- "#{FirstAudit.new(invocation, in_git:).after_mapping(principle.id, keeps_others_held: @keeps_others_held)}"
83
+ "#{FirstAudit.new(invocation, in_git:).after_mapping(principle.id, keeps_held: @keeps_held)}"
82
84
  end
83
85
  end
84
86
  end
@@ -77,17 +77,28 @@ module Principles
77
77
  # shared says which members share a line with the new one; added lists them only when there are some, as it
78
78
  # carries a check only when one is named. joined is what the result says of the map the member joined.
79
79
  #: (PrintedPrinciple, added: Hash[String, untyped], ?shared: LinesSharedWithMember, ?joined: MapAddedTo,
80
- #| ?consecutive: ConsecutiveSectionsElsewhere)
80
+ #| ?other_maps: Array[ConsecutiveSectionsElsewhere | WholeFileElsewhere | MemberSetsOverlap])
81
81
  #| -> Hash[String, untyped]
82
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)
83
+ other_maps: [])
84
+ member = AddedMember.new(added, shared: shared, other_maps: other_maps)
85
85
  after = joined.after_member(principle, member: member.id, invocation: @invocation, in_git: @in_git)
86
86
  question(principle, "#{member.opening}#{after}".rstrip,
87
87
  add_member_command(principle.id), shown: { "member_count" => principle.members.length })
88
88
  .merge("added" => member.to_h.merge(joined.added_facts))
89
89
  end
90
90
 
91
+ # add-member --plugin: the member read from an installed plugin, with where it comes from, and that it is
92
+ # read-only and how a finding on it is handled.
93
+ #: (PrintedPrinciple, added: Hash[String, untyped]) -> Hash[String, untyped]
94
+ def plugin_member_added(principle, added:)
95
+ question(principle, "Added #{added.fetch("id")}, read-only: principles never edits a plugin's files, which " \
96
+ "the plugin's next update replaces, so a finding on it is fixed in the project's own " \
97
+ "files, deferred upstream or accepted. Add the next member the same way.",
98
+ add_member_command(principle.id), shown: { "member_count" => principle.members.length })
99
+ .merge("added" => added)
100
+ end
101
+
91
102
  # add-member's report of the map it started, with the description and activation it wrote, which the agent
92
103
  # never typed.
93
104
  #: (PrintedPrinciple) -> Hash[String, untyped]
@@ -95,14 +106,15 @@ module Principles
95
106
  { "map_created" => { "description" => principle.description, "activation" => principle.activation } }
96
107
  end
97
108
 
98
- # move-member: the member's old id, and its new id with the lines it now spans.
109
+ # move-member: the member's old id, and its new id, place and the lines it now spans, not its role or the map,
110
+ # which cost 7.6 KB on a 17-member principle for one member moved.
99
111
  #: (PrintedPrinciple, from: String, moved: Hash[String, untyped]) -> Hash[String, untyped]
100
112
  def member_moved(principle, from:, moved:)
101
113
  id = moved.fetch("id")
102
114
  question(principle, "#{id} now spans lines #{moved.fetch("first_line")} to #{moved.fetch("last_line")}" \
103
115
  "#{" (moved from #{from})" unless from == id}; if that is not the passage you meant, " \
104
- "move it again. Check the other members, then start the audit.", start_audit(principle.id))
105
- .merge("moved" => moved)
116
+ "move it again. Check the other members, then start the audit.", start_audit(principle.id),
117
+ shown: { "member" => moved })
106
118
  end
107
119
 
108
120
  # change-member-check: the stored command is the member's check in the map printed beside this, so the
@@ -113,31 +125,41 @@ module Principles
113
125
  done = "#{member} is now enforced by the check named in its map entry. The next audit marks it new or " \
114
126
  "changed and asks for a review before it runs; nothing runs it automatically: " \
115
127
  "you run it when an audit asks for its result."
116
- return member_replaced(principle, member: member, done: done) if hidden.empty?
128
+ return member_replaced(principle, done: done) if hidden.empty?
117
129
 
118
- member_replaced(principle, member: member,
119
- done: "#{done} The check holds characters that print escaped or not at all, " \
130
+ member_replaced(principle, done: "#{done} The check holds characters that print escaped or not at all, " \
120
131
  "which check_hidden_characters names; make sure each is meant.")
121
132
  .merge("check_hidden_characters" => hidden)
122
133
  end
123
134
 
124
135
  # change-member-role, change-member-check and remove-member-check: done says what changed. This tool cannot
125
136
  # tell in git whether a full audit's correction is open, so the next step names both cases, and
126
- # the other case by what the agent holds: a correction request (one user on 8e5b3f9).
127
- #: (PrintedPrinciple, member: String, done: String) -> Hash[String, untyped]
128
- def member_replaced(principle, member:, done:)
137
+ # the other case by what the agent holds: a correction request (one user on 8e5b3f9), which already
138
+ # prints its submit-answer command with its request id, so this does not repeat it.
139
+ # shown is what it prints of the map, as question takes it.
140
+ #: (PrintedPrinciple, done: String, ?shown: Hash[String, untyped]) -> Hash[String, untyped]
141
+ def member_replaced(principle, done:, shown: { "map" => principle.map })
129
142
  question(principle, "#{done} Check the other members, then start the audit.\nIf you hold a correction " \
130
- "request from submit-answer (phase correction), list #{member} in the " \
131
- "changed_map_entries of the fixed disposition this change fixes, and submit it instead: " \
132
- "#{@invocation.submit_answer("REQUEST_ID")}",
133
- start_audit(principle.id))
143
+ "request instead, list this member in the changed_map_entries of the fixed disposition " \
144
+ "this change fixes, and submit that request's answer.",
145
+ start_audit(principle.id), shown: shown)
146
+ end
147
+
148
+ # change-member-role: the member's id and its new role, the one part that changed, never the whole map, which
149
+ # cost 7.9 KB on a 17-member principle.
150
+ #: (PrintedPrinciple, member: String, role: String) -> Hash[String, untyped]
151
+ def role_changed(principle, member:, role:)
152
+ member_replaced(principle, done: "Changed its role.", shown: { "member" => { "id" => member, "role" => role } })
134
153
  end
135
154
 
155
+ # remove-member: the id removed and how many members are left, never the whole map left, which cost 7.9 KB on
156
+ # a 17-member principle; show-principle lists them.
136
157
  #: (PrintedPrinciple, removed: String) -> Hash[String, untyped]
137
158
  def member_removed(principle, removed:)
159
+ left = principle.map.fetch("members").size
138
160
  question(principle, "Removed #{removed}. Add or remove members until the map is right.\n" \
139
161
  "#{FirstAudit.new(@invocation, in_git: @in_git).after_mapping(principle.id)}",
140
- add_member_command(principle.id))
162
+ add_member_command(principle.id), shown: { "member_removed" => removed, "members_left" => left })
141
163
  end
142
164
 
143
165
  private
@@ -34,6 +34,10 @@ module Principles
34
34
  @member.fetch("id")
35
35
  end
36
36
 
37
+ # The member's role as its map names it.
38
+ #: () -> String
39
+ def role = @member.fetch("role")
40
+
37
41
  #: () -> String
38
42
  def base_commit
39
43
  @commits.fetch("base")
@@ -7,8 +7,9 @@ module Principles
7
7
  # What this tool prints, from plain values a controller hands it. views/CLAUDE.md owns the boundary.
8
8
  module Views
9
9
  # One changed member as a line of tab-separated fields, each written through VisibleText: its principle, id,
10
- # newest commit that changed it (or "uncommitted"), that commit's subject, and what it was compared with:
11
- # "audit" or "mapping_commit", then "waiting_on_an_upgrade" for one compared with hashes a later copy wrote.
10
+ # newest commit that changed it (or "uncommitted", or a plugin's "version:" installed), that commit's subject, and
11
+ # what it was compared with: "audit", "mapping_commit" or "pinned", then "waiting_on_an_upgrade" for one compared
12
+ # with hashes a later copy wrote.
12
13
  # The after-commit hook prints it, and list-member-problems --short its short form, without the subject.
13
14
  class MemberRow
14
15
  # member is one entry of list-member-problems' "members", with its "history".
@@ -32,11 +33,19 @@ module Principles
32
33
 
33
34
  private
34
35
 
35
- # The principle, id and newest commit that changed the member, or "uncommitted".
36
+ # The principle, id and newest commit that changed the member, or "uncommitted", or for a plugin's member, which
37
+ # no commit changes, the version installed now.
36
38
  #: () -> Array[String]
37
39
  def head
38
40
  newest = @member.fetch("history", {}).fetch("commits", []).first
39
- [@member.fetch("principle"), @member.fetch("id"), newest ? newest.fetch("commit") : "uncommitted"]
41
+ [@member.fetch("principle"), @member.fetch("id"), newest ? newest.fetch("commit") : changed_in]
42
+ end
43
+
44
+ # Where a member no commit changed is changed now: a plugin's version installed, or else uncommitted text.
45
+ #: () -> String
46
+ def changed_in
47
+ version = @member.dig("source", "version")
48
+ version ? "version:#{version}" : "uncommitted"
40
49
  end
41
50
 
42
51
  # What the member was compared with, and whether its audit waits on an upgrade.
@@ -0,0 +1,31 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ module Principles
5
+ module Views
6
+ # The other maps whose member set nearly matches the one a member just joined, which ask the agent AddedMember's
7
+ # scope-or-join question.
8
+ class MemberSetsOverlap
9
+ #: (?Array[Hash[String, untyped]]) -> void
10
+ def initialize(facts = [])
11
+ @facts = facts
12
+ freeze
13
+ end
14
+
15
+ #: () -> Hash[String, untyped]
16
+ def to_h = @facts.empty? ? {} : { "member_sets_overlap" => @facts }
17
+
18
+ #: () -> String
19
+ def note
20
+ return "" if @facts.empty?
21
+
22
+ "This map's member set nearly matches another's (member_sets_overlap): by member id, they share at least " \
23
+ "two members and at least two thirds of the members either holds. "
24
+ end
25
+
26
+ # Whether it asks AddedMember's scope-or-join question: when a member set nearly matches.
27
+ #: () -> bool
28
+ def asks_scope_or_join? = @facts.any?
29
+ end
30
+ end
31
+ end
@@ -14,18 +14,38 @@ module Principles
14
14
  module Views
15
15
  # list-member-problems --commits-after COMMIT --hook-event EVENT: the whole JSON the plugin's after-commit hook
16
16
  # prints for Claude Code, which puts its additionalContext beside the Bash call's result, or nothing at all.
17
- # Claude Code asks for that text to state facts, not to give orders, so it says what the commits changed,
18
- # which command shows more and, under the plugin, which skill to start from. It names that skill as a user
19
- # invokes it in Claude Code, /principles, the only host the plugin installs it for.
17
+ # Claude Code's hooks page asks that additionalContext be "factual statements rather than imperative system
18
+ # instructions", since imperative text can be surfaced to the user as a suspected injection (the
19
+ # after-commit hook review, R7). So it states what the commits changed, then the one command that shows what
20
+ # each needs before the next commit: a second pointer, the plugin's skill, left the agent choosing.
20
21
  class MembersACommitChanged
21
22
  NOTHING = Lines.new(stdout: "", stderr: "", status: 0).freeze #: Lines
22
23
 
23
- # skill says whether this session has the principles skill, which only the plugin installs; without it the
24
- # command the report names is where to start.
25
- #: (Invocation, skill: bool) -> void
26
- def initialize(invocation, skill:)
24
+ # How many other changed members list-member-problems still lists: those earlier commits changed, and those in
25
+ # an installed plugin, which no commit changes.
26
+ StillListed = Struct.new(:from_commits, :in_plugins) do
27
+ #: () -> bool
28
+ def none? = from_commits.zero? && in_plugins.zero?
29
+
30
+ # A line for each kind still listed, or none.
31
+ #: () -> Array[String]
32
+ def lines
33
+ commits = Prompts.text("report-after-a-commit/others-are-still-listed",
34
+ count: from_commits.to_s, members: members(from_commits))
35
+ plugins = Prompts.text("report-after-a-commit/plugin-members-are-still-listed",
36
+ count: in_plugins.to_s, members: members(in_plugins))
37
+ [*(commits unless from_commits.zero?), *(plugins unless in_plugins.zero?)]
38
+ end
39
+
40
+ private
41
+
42
+ #: (Integer) -> String
43
+ def members(count) = count == 1 ? "member is" : "members are"
44
+ end
45
+
46
+ #: (Invocation) -> void
47
+ def initialize(invocation)
27
48
  @invocation = invocation
28
- @skill = skill
29
49
  freeze
30
50
  end
31
51
 
@@ -33,7 +53,7 @@ module Principles
33
53
  # members it still lists. Those it marks waiting_on_an_upgrade are named apart, with the waits that say why, and
34
54
  # no audit to run; the others still listed are counted beside them too, since this copy may
35
55
  # audit those.
36
- #: (String, Array[Hash[String, untyped]], others: Integer, ?waits: Array[RecordWaitingOnAnUpgrade]) -> Lines
56
+ #: (String, Array[Hash[String, untyped]], others: StillListed, ?waits: Array[RecordWaitingOnAnUpgrade]) -> Lines
37
57
  def changed(event, changed, others:, waits: [])
38
58
  waiting, auditable = changed.partition { |member| member["waiting_on_an_upgrade"] }
39
59
  reported(event, [*(to_audit(auditable, others) unless auditable.empty?),
@@ -50,20 +70,26 @@ module Principles
50
70
 
51
71
  private
52
72
 
53
- # The members to audit, as rows, then what shows more and, in a session that has it, the skill to start from.
54
- #: (Array[Hash[String, untyped]], Integer) -> Array[String]
73
+ # The members to audit, as rows, then the command that shows what each needs before the next commit.
74
+ #: (Array[Hash[String, untyped]], StillListed) -> Array[String]
55
75
  def to_audit(changed, others)
56
76
  [Prompts.text("report-after-a-commit/the-commits-changed-these-members"), *rows(changed),
57
- *still_listed(others), Prompts.text("report-after-a-commit/this-command-shows-each-one"), command,
58
- *(Prompts.text("report-after-a-commit/the-principles-skill-is-where-to-start") if @skill)]
77
+ *others.lines, before_the_next_commit]
59
78
  end
60
79
 
61
80
  # The other changed members still listed, and the command that shows each, or nothing when none is.
62
- #: (Integer) -> Array[String]
81
+ #: (StillListed) -> Array[String]
63
82
  def listed_beside_the_waiting(others)
64
- return [] if others.zero?
83
+ return [] if others.none?
65
84
 
66
- [*still_listed(others), Prompts.text("report-after-a-commit/this-command-shows-each-one"), command]
85
+ [*others.lines, before_the_next_commit]
86
+ end
87
+
88
+ # The one command that shows what each member needs before the next commit, list-member-problems --short.
89
+ #: () -> String
90
+ def before_the_next_commit
91
+ Prompts.text("report-after-a-commit/this-command-shows-what-each-needs-before-the-next-commit",
92
+ command: @invocation.in_project("list-member-problems", options: ["--short"]))
67
93
  end
68
94
 
69
95
  # The members whose audits wait on an upgrade, as rows, then each wait's line, which says how to update.
@@ -76,15 +102,6 @@ module Principles
76
102
  #: (Array[Hash[String, untyped]]) -> Array[String]
77
103
  def rows(members) = members.map { MemberRow.new(it).to_s }
78
104
 
79
- # The line saying how many other changed members list-member-problems still lists, or none when it lists none.
80
- #: (Integer) -> Array[String]
81
- def still_listed(others)
82
- return [] if others.zero?
83
-
84
- [Prompts.text("report-after-a-commit/others-are-still-listed",
85
- count: others.to_s, members: others == 1 ? "member is" : "members are")]
86
- end
87
-
88
105
  #: () -> String
89
106
  def command = @invocation.in_project("list-member-problems")
90
107
 
@@ -0,0 +1,27 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ module Principles
5
+ # What this tool prints, from plain values a controller hands it. views/CLAUDE.md owns the boundary.
6
+ module Views
7
+ # The audited principle's members that changed during a completed audit, as its result names them: each member
8
+ # added to the map during the audit, which no assessment read, so the next full audit assesses it (T69), and
9
+ # each member whose text changed, after which the next step asks for the principle's audit again.
10
+ class MembersChangedDuringAudit
11
+ #: (?added: Array[String], ?changed: Array[String]) -> void
12
+ def initialize(added: [], changed: [])
13
+ @added = added
14
+ @changed = changed
15
+ freeze
16
+ end
17
+
18
+ # Whether any member's text changed during the audit; when none did, nothing asks for a second audit.
19
+ #: () -> bool
20
+ def any? = @changed.any?
21
+
22
+ # The fields as printed: the members added, only when there are some.
23
+ #: () -> Hash[String, untyped]
24
+ def to_h = @added.empty? ? {} : { "members_added_awaiting_assessment" => @added }
25
+ end
26
+ end
27
+ end