principles 0.0.10 → 0.1.0

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 (191) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +42 -0
  3. data/README.md +0 -2
  4. data/lib/principles/controllers/acknowledgement.rb +11 -4
  5. data/lib/principles/controllers/acknowledgements.rb +4 -4
  6. data/lib/principles/controllers/answer.rb +2 -2
  7. data/lib/principles/controllers/assessment.rb +20 -4
  8. data/lib/principles/controllers/audit.rb +16 -5
  9. data/lib/principles/controllers/broken_member_repairs.rb +60 -0
  10. data/lib/principles/controllers/command.rb +8 -30
  11. data/lib/principles/controllers/correction.rb +7 -5
  12. data/lib/principles/controllers/full_audit_request.rb +44 -22
  13. data/lib/principles/controllers/guidance_search_paths.rb +1 -1
  14. data/lib/principles/controllers/inventory.rb +3 -3
  15. data/lib/principles/controllers/member_acknowledgement.rb +5 -5
  16. data/lib/principles/controllers/member_addition.rb +5 -2
  17. data/lib/principles/controllers/member_entries.rb +1 -1
  18. data/lib/principles/controllers/member_problems_report.rb +11 -7
  19. data/lib/principles/controllers/members_to_assess.rb +1 -1
  20. data/lib/principles/controllers/meta_principle_setup.rb +4 -3
  21. data/lib/principles/controllers/open_correction.rb +3 -3
  22. data/lib/principles/controllers/open_finding_decisions.rb +66 -0
  23. data/lib/principles/controllers/running_tool.rb +22 -5
  24. data/lib/principles/controllers/survey.rb +3 -2
  25. data/lib/principles/data/candidate_files_found.rb +6 -4
  26. data/lib/principles/data/command-steps.json +20 -20
  27. data/lib/principles/data/json_text.rb +5 -1
  28. data/lib/principles/data/parser_message.rb +61 -0
  29. data/lib/principles/data/project_files.rb +4 -2
  30. data/lib/principles/data/repository.rb +4 -4
  31. data/lib/principles/data/running_version.rb +1 -1
  32. data/lib/principles/data/schemas/audit-record.schema.json +15 -0
  33. data/lib/principles/data/schemas/command-steps.schema.json +1 -1
  34. data/lib/principles/data/schemas/{repointing-answer.schema.json → deciding-answer.schema.json} +12 -6
  35. data/lib/principles/invocation_options.rb +4 -4
  36. data/lib/principles/launch.rb +5 -3
  37. data/lib/principles/models/acknowledgement.rb +1 -27
  38. data/lib/principles/models/acknowledgement_left_as_printed.rb +2 -1
  39. data/lib/principles/models/acknowledgement_placeholders.rb +48 -0
  40. data/lib/principles/models/after_commit_input.rb +1 -0
  41. data/lib/principles/models/assessment_answer.rb +2 -2
  42. data/lib/principles/models/assessment_basis.rb +1 -1
  43. data/lib/principles/models/assessment_left_as_printed.rb +1 -1
  44. data/lib/principles/models/audit.rb +24 -4
  45. data/lib/principles/models/audit_entry_protecting_map.rb +1 -0
  46. data/lib/principles/models/audit_record.rb +5 -14
  47. data/lib/principles/models/audit_records.rb +2 -2
  48. data/lib/principles/models/audited_member_lines.rb +1 -1
  49. data/lib/principles/models/candidate_files.rb +1 -1
  50. data/lib/principles/models/candidate_inventory.rb +20 -10
  51. data/lib/principles/models/candidate_outline.rb +1 -1
  52. data/lib/principles/models/changed_regions.rb +1 -1
  53. data/lib/principles/models/command_steps.rb +1 -2
  54. data/lib/principles/models/correction_basis.rb +1 -1
  55. data/lib/principles/models/declared_map_changes.rb +1 -2
  56. data/lib/principles/models/disposition.rb +12 -76
  57. data/lib/principles/models/disposition_placeholders.rb +48 -0
  58. data/lib/principles/models/disposition_text_field.rb +41 -0
  59. data/lib/principles/models/evidence_item.rb +1 -1
  60. data/lib/principles/models/finding_decision.rb +84 -0
  61. data/lib/principles/models/finding_write_ups.rb +2 -1
  62. data/lib/principles/models/first_full_audit.rb +1 -0
  63. data/lib/principles/models/fix_only_fields.rb +4 -3
  64. data/lib/principles/models/frontmatter_fields.rb +1 -1
  65. data/lib/principles/models/guidance_search_path.rb +1 -1
  66. data/lib/principles/models/guidance_search_paths.rb +5 -1
  67. data/lib/principles/models/head_moves.rb +1 -0
  68. data/lib/principles/models/ignored_candidates.rb +1 -1
  69. data/lib/principles/models/instruction_named.rb +1 -1
  70. data/lib/principles/models/json_path_query.rb +1 -1
  71. data/lib/principles/models/json_path_selectors.rb +1 -1
  72. data/lib/principles/models/json_path_string.rb +1 -1
  73. data/lib/principles/models/last_completed_revision.rb +1 -1
  74. data/lib/principles/models/line_diff.rb +1 -1
  75. data/lib/principles/models/line_span.rb +1 -1
  76. data/lib/principles/models/loading_scope.rb +1 -0
  77. data/lib/principles/models/located_text.rb +20 -12
  78. data/lib/principles/models/map_change.rb +66 -0
  79. data/lib/principles/models/mapped_principles.rb +4 -0
  80. data/lib/principles/models/markdown_file.rb +22 -1
  81. data/lib/principles/models/member.rb +1 -1
  82. data/lib/principles/models/member_assessments.rb +11 -4
  83. data/lib/principles/models/member_elsewhere.rb +1 -1
  84. data/lib/principles/models/member_file.rb +15 -13
  85. data/lib/principles/models/member_hashes_as_written.rb +2 -2
  86. data/lib/principles/models/member_history.rb +1 -1
  87. data/lib/principles/models/member_lines.rb +1 -1
  88. data/lib/principles/models/member_loading_scopes.rb +1 -0
  89. data/lib/principles/models/member_mapping_run.rb +4 -4
  90. data/lib/principles/models/member_moves.rb +1 -2
  91. data/lib/principles/models/member_problems.rb +5 -1
  92. data/lib/principles/models/member_region.rb +1 -1
  93. data/lib/principles/models/member_repair_moves.rb +20 -4
  94. data/lib/principles/models/member_snapshots.rb +10 -10
  95. data/lib/principles/models/members_elsewhere.rb +1 -1
  96. data/lib/principles/models/members_in_consecutive_sections.rb +1 -0
  97. data/lib/principles/models/members_sharing_lines.rb +2 -2
  98. data/lib/principles/models/misspelt_member_id.rb +10 -4
  99. data/lib/principles/models/named_placeholder.rb +32 -0
  100. data/lib/principles/models/open_finding.rb +4 -3
  101. data/lib/principles/models/open_findings_decision.rb +124 -0
  102. data/lib/principles/models/open_findings_elsewhere.rb +1 -1
  103. data/lib/principles/models/other_templates_placeholders.rb +26 -6
  104. data/lib/principles/models/outline_budget.rb +1 -1
  105. data/lib/principles/models/outline_group.rb +1 -1
  106. data/lib/principles/models/outline_section.rb +1 -1
  107. data/lib/principles/models/part_named.rb +1 -1
  108. data/lib/principles/models/plain_text_file.rb +1 -1
  109. data/lib/principles/models/principle_history.rb +5 -4
  110. data/lib/principles/models/principle_members.rb +1 -1
  111. data/lib/principles/models/problem_report.rb +13 -1
  112. data/lib/principles/models/project.rb +15 -16
  113. data/lib/principles/models/project_at_commit.rb +60 -0
  114. data/lib/principles/models/project_history.rb +10 -52
  115. data/lib/principles/models/prose_line.rb +36 -0
  116. data/lib/principles/models/record_format.rb +17 -4
  117. data/lib/principles/models/recorded_finding.rb +47 -7
  118. data/lib/principles/models/recorded_findings.rb +7 -7
  119. data/lib/principles/models/recorded_hashes.rb +1 -1
  120. data/lib/principles/models/recorded_members.rb +6 -8
  121. data/lib/principles/models/report_hooks.rb +1 -0
  122. data/lib/principles/models/request_id.rb +2 -2
  123. data/lib/principles/models/sent_answer.rb +5 -3
  124. data/lib/principles/models/session_start_input.rb +1 -0
  125. data/lib/principles/models/stale_request.rb +22 -8
  126. data/lib/principles/models/submitted_answer.rb +1 -1
  127. data/lib/principles/models/survey_search_paths.rb +13 -5
  128. data/lib/principles/models/template_placeholders.rb +22 -7
  129. data/lib/principles/models/text_size.rb +11 -3
  130. data/lib/principles/models/text_within.rb +1 -1
  131. data/lib/principles/models/unchecked_members.rb +1 -0
  132. data/lib/principles/models/uncommitted_outside_the_map.rb +1 -1
  133. data/lib/principles/models/unfinished_field.rb +34 -0
  134. data/lib/principles/models/unknown_principle.rb +1 -0
  135. data/lib/principles/models/write_up_opening.rb +5 -31
  136. data/lib/principles/models/write_up_pointer.rb +2 -1
  137. data/lib/principles/start_audit_options.rb +35 -20
  138. data/lib/principles/version.rb +2 -2
  139. data/lib/principles/views/acknowledged_result.rb +59 -0
  140. data/lib/principles/views/acknowledgement_result.rb +44 -51
  141. data/lib/principles/views/added_member.rb +10 -1
  142. data/lib/principles/views/answer_in_a_file.rb +65 -0
  143. data/lib/principles/views/assessed_members.rb +4 -2
  144. data/lib/principles/views/assessment_answer_guide.rb +59 -0
  145. data/lib/principles/views/assessment_request.rb +2 -26
  146. data/lib/principles/views/audit_result.rb +18 -7
  147. data/lib/principles/views/candidate_files_result.rb +9 -4
  148. data/lib/principles/views/context_parts.rb +41 -10
  149. data/lib/principles/views/correction_request.rb +27 -18
  150. data/lib/principles/views/first_audit_brief.rb +2 -1
  151. data/lib/principles/views/guidance_search_paths_result.rb +13 -6
  152. data/lib/principles/views/invocation.rb +14 -4
  153. data/lib/principles/views/json_on_one_line.rb +18 -0
  154. data/lib/principles/views/member_repairs.rb +21 -5
  155. data/lib/principles/views/meta_principle_result.rb +26 -5
  156. data/lib/principles/views/open_findings_decision_result.rb +60 -0
  157. data/lib/principles/views/parts_index_result.rb +8 -6
  158. data/lib/principles/views/principle_read_result.rb +2 -2
  159. data/lib/principles/views/problem_facts.rb +46 -0
  160. data/lib/principles/views/problem_lines.rb +8 -3
  161. data/lib/principles/views/problem_result.rb +53 -31
  162. data/lib/principles/views/prompts/answer-any-judgement-request/fill-the-answer-in-a-file.md +6 -0
  163. data/lib/principles/views/prompts/assess-every-member/read-the-request-in-parts.md +2 -1
  164. data/lib/principles/views/prompts/decide-open-findings/give-only-what-changed-of-each.md +6 -0
  165. data/lib/principles/views/prompts/dispose-of-each-finding/answer-guide.json +1 -1
  166. data/lib/principles/views/prompts/dispose-of-each-finding/confirm-each-deferral-written-up-nowhere.md +2 -1
  167. data/lib/principles/views/prompts/dispose-of-each-finding/fix-or-record-each-finding.md +2 -2
  168. data/lib/principles/views/prompts/find-a-principle-to-map/where-a-survey-with-only-looks.md +4 -0
  169. data/lib/principles/views/prompts/learn-what-a-command-does/add-guidance-search-path.md +2 -1
  170. data/lib/principles/views/prompts/learn-what-a-command-does/add-member.md +1 -0
  171. data/lib/principles/views/prompts/learn-what-a-command-does/change-member-check.md +4 -3
  172. data/lib/principles/views/prompts/learn-what-a-command-does/change-member-role.md +4 -3
  173. data/lib/principles/views/prompts/learn-what-a-command-does/list-candidate-files.md +12 -12
  174. data/lib/principles/views/prompts/learn-what-a-command-does/list-member-problems.md +7 -8
  175. data/lib/principles/views/prompts/learn-what-a-command-does/list-open-findings.md +11 -12
  176. data/lib/principles/views/prompts/learn-what-a-command-does/move-member.md +4 -3
  177. data/lib/principles/views/prompts/learn-what-a-command-does/remove-member-check.md +4 -3
  178. data/lib/principles/views/prompts/learn-what-a-command-does/remove-member.md +4 -3
  179. data/lib/principles/views/prompts/learn-what-a-command-does/report-at-session-start.md +13 -12
  180. data/lib/principles/views/prompts/learn-what-a-command-does/show-answer-check.md +2 -2
  181. data/lib/principles/views/prompts/learn-what-a-command-does/show-open-correction.md +2 -2
  182. data/lib/principles/views/prompts/learn-what-a-command-does/start-audit.md +12 -12
  183. data/lib/principles/views/prompts/run-a-first-audit-in-the-background/follow-the-brief.md +1 -1
  184. data/lib/principles/views/prompts/start-a-session/act-on-the-changed-principles.md +2 -0
  185. data/lib/principles/views/prompts.rb +7 -4
  186. metadata +26 -8
  187. data/lib/principles/controllers/repoint.rb +0 -67
  188. data/lib/principles/models/repoint.rb +0 -125
  189. data/lib/principles/models/write_up_repoint.rb +0 -38
  190. data/lib/principles/views/prompts/repoint-write-ups/point-each-moved-write-up-at-its-new-place.md +0 -10
  191. data/lib/principles/views/repoint_result.rb +0 -80
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cc95d7d905593eee8514b36fd6cbc6a80629a6f210542a232dada441890cf454
4
- data.tar.gz: 964984c9b9d5a44d53c65ce0b92924d960eca08db17a93897abbe17db71b7482
3
+ metadata.gz: 8cf6524aebb33da2c9c9efedba5e43ff14d0514edac930543d9667d696c91819
4
+ data.tar.gz: 9692a2e6b1b4aa14d6c6e1eba9929b31e1a9a17678d4e1799152e5a5112c5e28
5
5
  SHA512:
6
- metadata.gz: 4534da22b02e7aa9a8e961268a1710f430c27bca7a8613b4d4fd1a8c337705f1a41967dbc3abb976535ae58891f66211ebea1b18e27fab015c88b6f5d35cb1df
7
- data.tar.gz: 7b17bd8475e8158b80a9c4af83ff94de2022bd2525901096ea7ae16163c2f811fb1441c1591ea33415fce5f7ef8a8e763900f61a63443158b3bc21ddfb69d4d2
6
+ metadata.gz: '0399642f807523558f0835997880cc62dacaf348ad14af9538d4ef4ebb24def915c49d56022577daa26523dd0fc9cbc5453be7e2f45ce39ad245582e84773079'
7
+ data.tar.gz: ae8d5ba7d7d74c13ccb5f7eb0c604ac4aa48b978121922aa31f28176eaa82be2dd63c450cae37b0a745ee309e6bdda96662a4926d0d86a44af6732ee630f4120
data/CHANGELOG.md CHANGED
@@ -13,6 +13,48 @@ The agent's mechanics are the means, never the lead: do not open with "An agent
13
13
 
14
14
  ## Unreleased
15
15
 
16
+ ## [0.1.0] - 2026-11-23
17
+
18
+ ### Added
19
+
20
+ - **Changing whom an open finding waits on, its action or where it is written up costs one short request and answer, not a full audit.** `principles start-audit ID --open-findings` lists the principle's open findings, and with `--as template` prints an answer naming each by id alone, headed by each field a decision may give and what it means, including that a deferred finding may be left waiting on no one named and that the note itself may be kept or deleted, so filling it needs no search through the request and no guess; give only what changed of each, with a one-line reason, and `principles submit-answer` keeps each change beside its finding. On a principle with two open findings the request is about 5 KB, where its full audit's is about 28 KB.
21
+ - **A survey can read just the guidance a new search path adds.** `principles list-candidate-files --only GLOB`, repeated for more globs, lists only the files those globs match, leaving out the files hosts load by convention and the recorded search paths, so a second survey costs what the new files cost rather than the whole project again. `principles add-guidance-search-path` now prints that narrower survey for the glob it added. On a project of 25 guidance files with three new paths holding 17 more, one `--only` survey of the three costs about 11.6 KB, where surveying the whole project again cost about 27.6 KB. The survey's help now says each outline is a flat list of lines, headings and their list items, so reading one needs no guess at nested keys.
22
+
23
+ ### Changed
24
+
25
+ - **An acknowledgement request says what it asks before the members' text, so the agent finds its question without reading it all or scripting it.** `principles start-audit ID --member A`, for one member or several, of one principle or several, now prints its question at the head of its context, before each member's change. On a three-member request of about 8.3 KB, the question starts at byte 169, where it started at byte 5,690.
26
+ - **A full audit answer refused because its map changed says what changed, so the agent no longer guesses which of five causes to undo.** When the map was changed and committed after `principles start-audit ID` printed the request, `principles submit-answer` names each change, such as a member's role as it was and is now, where it listed every input a request depends on. Its repair keeps the answer: copy the new request's id and basis into it and judge again only the members whose entry changed, or change the map back and submit it unchanged, where it said to start over.
27
+ - **A full audit's request says how large each of its parts is, so the agent chooses what to read without a script.** `principles start-audit ID` now opens with each part's name, as `--part` takes it, and its bytes, the sizes `--part index` lists. On a principle of 15 members that adds about 1.6 KB to a 37 KB request.
28
+ - **A full audit's guide to the answer's shapes reads without a script.** `principles start-audit ID`, and its `--part answer_guide` and `--instruction answer_guide`, now print each example the agent copies into its answer compact on a line of its own, where it ran several levels deep with no indentation to show where each one ended. The guide prints in about half the lines, with the same fields.
29
+ - **Breaking:** **The refusal of a decision on open findings now says what it refuses.** `principles start-audit ID --open-findings`, and `submit-answer` for its answer, refuse a principle with no completed audit, or with one left open, as `cannot_decide_open_findings` where `--write-ups` refused it as `cannot_repoint`; an agent or script matching on `cannot_repoint` should match the new code.
30
+ - **Breaking:** **An audit record that holds a decision on open findings is read only by this release or later.** Such a record is written in format 3, which 0.0.11 and earlier refuse to rewrite rather than drop the change, so everyone sharing a project's `.principles/` should upgrade together.
31
+
32
+ ### Removed
33
+
34
+ - **Breaking:** **The old way to repoint a moved write-up is gone, and its refusal names the new one.** `principles start-audit ID --write-ups` is refused, printing the `start-audit ID --open-findings` command to run instead, which points a moved write-up again as it did and changes a finding's wait and action too.
35
+
36
+ ### Fixed
37
+
38
+ - **An agent that edits a mapped rule is told to commit it before auditing, not sent into a refusal.** When a member's file, or its map, differs from the last commit, `principles list-member-problems`, with or without `--short`, now opens its next step with the files to commit, since `start-audit` audits only committed text and refused them until then.
39
+ - **An answer saved from one shell is no longer missing when another submits it.** Every step that says to save an answer to fill, from `principles start-audit ID`, `show-answer-check` and `show-first-audit-brief ID`, now names one file by its full path in the temporary folder that run of `principles` was given, in both the save and the `submit-answer` command, where it said "under $TMPDIR", which a sandboxed and an unsandboxed shell in Claude Code read as different folders. A path printed by a sandboxed run works from both shells; one printed by an unsandboxed run is outside the sandbox, so a sandboxed shell is refused writing there, rather than finding the file missing later.
40
+ - **A first map no longer takes one line of a wrapped list item for the whole without saying so.** When `principles add-member` is given `--starting-at` with no `--ending-at` in a Markdown file, and the paragraph or list item that line is in runs on, its result names the item's last line and asks whether the member is all of it, where it mapped the first line silently and the shortfall showed only later in `show-principle`'s line numbers.
41
+ - **A full audit sees each change made to an open finding since the last one before it decides the finding.** `principles start-audit ID` now lists, beside each prior finding, every change made since its record, to its wait, action or write-up, with its old value and why, where the auditor saw only the new write-up pointer and the record then dropped the move unread.
42
+ - **An audit asking for several parts that turn out empty learns which ones they were.** `principles start-audit ID --part A --part B` now names each empty part in its `part_empty` line, in the order given, where two empty parts printed one unnamed `part_empty` line and the agent had to rerun each part alone to find out which.
43
+ - **An audit reading several members at once gets every one it names, not just the last.** `principles start-audit ID --part members/A --part members/B` now prints each member named in one `members` list, in the order given, where it printed only the last one and dropped the others without a word.
44
+ - **A broken answer file costs a short refusal, not the rest of the file echoed back.** When `principles submit-answer` or `show-answer-check` cannot parse an answer, such as one holding a raw line break in a string, its `unparseable_json` message now quotes the first 60 characters from where the parser stopped, with any line break written as `\n`, and counts the bytes left out, instead of the whole rest of the file: about 1.4 KB for one answer. It names the line and column where the json Ruby runs gives them; Ruby 3.4's own json does not.
45
+ - **A write-up kept outside the project, such as a tracker comment, now stays findable from the audit record.** When an audit asks for each finding to be fixed or recorded, it now says the record keeps each disposition's reason, which `principles list-open-findings` prints, and to give an outside write-up's link there, where it said the reason was not kept, so an agent left the pointer empty and the link was lost.
46
+
47
+ ## [0.0.11] - 2026-11-22
48
+
49
+ ### Changed
50
+
51
+ - **An audit reads the parts of a request it needs in one call, with no script to stitch them together.** `principles start-audit ID --part A --part B` prints each part named, in the order given, under the request's one `request_id`, instead of one call per part, and beside `--as template` each member's slot named in one `member_assessments`. `--part response_template`, the bare answer to save as it stands, is refused beside another part.
52
+ - **Checking a principle's changed members reads only what decides the next step, with no script to pull the fields out.** `principles list-member-problems [ID]` now gives each changed member's id, state, baseline and the command that clears it without the list of commits that changed it, one entry per commit; `--history` adds that list back when your agent needs it.
53
+ - **A session start costs the same whether one principle's audited rules changed or several did.** When more than one principle has changed audited members, `principles report-at-session-start` prints one line counting them, with `principles list-member-problems --short` to list them, instead of a line per principle: 208 bytes for any number of principles, where four printed 747. A single principle's line is as before.
54
+ - **A member named by its heading or passage alone is one command away from the right id, not a trip through `show-principle`.** When `change-member-role`, `change-member-check`, `remove-member-check`, `move-member` or `remove-member` is given text that exactly one mapped member's id ends with, after its `#` or `@`, the refusal names that id and starts its repair with the same command run on it. Nothing runs on the guess itself.
55
+ - **Your agent fills a full audit's answer with its own file editor, with no script to unwrap or escape it.** `principles start-audit ID --part response_template` now prints the answer bare, ready to save and submit as it stands, and the request and its `--part index` say to save it to a file outside the project, fill it there with the agent's file-edit tool rather than a shell heredoc, and submit that file, naming the only three characters JSON escapes. The line adds about 420 bytes to each full-audit request. A correction's next step says the same of its dispositions, saved from `show-open-correction`, and an acknowledgement request, for one member, several or members across principles, now has a next step too, saving the answer `--as template` prints, and its refusals send the agent back to that saved answer rather than to the request.
56
+ - **Each member's slot in a full audit's answer is its own, so a file editor's one-match replace fills one slot at a time.** Every judged member's assessment placeholder now names its member, and an answer that leaves any member's placeholder in a slot, its own or one pasted from another, is refused as left as printed. A correction's dispositions do the same, each one's action, reason and reassessment placeholders naming its finding, and so does each member's entry in an acknowledgement's answer.
57
+
16
58
  ## [0.0.10] - 2026-11-21
17
59
 
18
60
  ### Changed
data/README.md CHANGED
@@ -1,5 +1,3 @@
1
- ![Six pocket compasses on white paper, every needle pointing the same way but one small red needle that has swung off course](https://raw.githubusercontent.com/realfastAI/principles/main/images/banner.webp)
2
-
3
1
  # Harness Principles
4
2
 
5
3
  <p>Built with ❤️ at&nbsp;<a href="https://realfast.ai"><picture><source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/realfastAI/principles/main/images/realfast-logo-white.svg"><img src="https://raw.githubusercontent.com/realfastAI/principles/main/images/realfast-logo-ink.svg" alt="realfast" height="15"></picture></a></p>
@@ -6,7 +6,9 @@ require_relative "answer_phase"
6
6
  require_relative "../prose_list"
7
7
  require_relative "member_acknowledgement"
8
8
  require_relative "../models/acknowledgement"
9
+ require_relative "../models/acknowledgement_placeholders"
9
10
  require_relative "../models/reported_check"
11
+ require_relative "../views/acknowledged_result"
10
12
  require_relative "../views/acknowledgement_result"
11
13
 
12
14
  module Principles
@@ -41,7 +43,7 @@ module Principles
41
43
  def answered(submitted)
42
44
  id = submitted.request_id.principle_id
43
45
  member = answering(submitted)
44
- [view.acknowledged(principle_id: id, member_id: member.member.id, file: @audit_records.file(id)),
46
+ [accepted_view.acknowledged(principle_id: id, member_id: member.member.id, file: @audit_records.file(id)),
45
47
  [accepted(member, submitted.response)]]
46
48
  end
47
49
 
@@ -63,7 +65,7 @@ module Principles
63
65
 
64
66
  # The fields an answer may leave as its template printed them, read before its shape.
65
67
  #: () -> Models::AcknowledgementLeftAsPrinted
66
- def left_as_printed = Models::Acknowledgement::LEFT_AS_PRINTED
68
+ def left_as_printed = Models::AcknowledgementPlaceholders::LEFT_AS_PRINTED
67
69
 
68
70
  # The placeholders a one-member audit's template prints, which its answer may leave as printed: its own, and
69
71
  # check_result's for a check the last audit ran, the only check it acknowledges. The member is in the
@@ -71,8 +73,9 @@ module Principles
71
73
  # @override
72
74
  #: (Models::RequestId) -> Hash[String, untyped]?
73
75
  def printed_placeholders(_request_id)
74
- MemberAcknowledgement.placeholders(Models::ReportedCheck::UNCHANGED_PLACEHOLDERS.to_h
75
- .merge("exit_status" => Models::Acknowledgement::EXIT_STATUS_PLACEHOLDER))
76
+ exit_status = Models::AcknowledgementPlaceholders::EXIT_STATUS_PLACEHOLDER
77
+ unchanged = Models::ReportedCheck::UNCHANGED_PLACEHOLDERS.to_h
78
+ MemberAcknowledgement.placeholders(unchanged.merge("exit_status" => exit_status))
76
79
  end
77
80
 
78
81
  # The one-member audit of principle id's member, as a refusal naming a near miss leads its repair with.
@@ -109,6 +112,10 @@ module Principles
109
112
  def view
110
113
  Views::AcknowledgementResult.new(invocation)
111
114
  end
115
+
116
+ # The view of an accepted answer.
117
+ #: () -> Views::AcknowledgedResult
118
+ def accepted_view = Views::AcknowledgedResult.new(invocation)
112
119
  end
113
120
  end
114
121
  end
@@ -51,8 +51,8 @@ module Principles
51
51
 
52
52
  id = submitted.request_id.principle_id
53
53
  several, members = answering_several(submitted)
54
- [view.several_acknowledged(principle_id: id, member_ids: members.map { it.member.id },
55
- file: @audit_records.file(id)),
54
+ [accepted_view.several_acknowledged(principle_id: id, member_ids: members.map { it.member.id },
55
+ file: @audit_records.file(id)),
56
56
  [all_accepted(several, members, submitted.response)]]
57
57
  end
58
58
 
@@ -72,8 +72,8 @@ module Principles
72
72
  records = across.accepted(submitted.response) do |id, several, answer|
73
73
  all_accepted(several, by_principle.fetch(id), answer, acknowledging: across.acknowledging)
74
74
  end
75
- [view.across_acknowledged(member_ids: across.member_ids,
76
- files: by_principle.keys.to_h { [it, @audit_records.file(it)] }), records]
75
+ files = by_principle.keys.to_h { [it, @audit_records.file(it)] }
76
+ [accepted_view.across_acknowledged(member_ids: across.member_ids, files:), records]
77
77
  end
78
78
 
79
79
  # The members each principle basis names maps, refused when a later copy wrote any of their records, or as stale
@@ -8,7 +8,7 @@ require_relative "../models/submitted_answer"
8
8
  require_relative "acknowledgement"
9
9
  require_relative "acknowledgements"
10
10
  require_relative "correction"
11
- require_relative "repoint"
11
+ require_relative "open_finding_decisions"
12
12
  require_relative "assessment"
13
13
 
14
14
  module Principles
@@ -22,7 +22,7 @@ module Principles
22
22
  # The controller that answers for each phase a request id may name.
23
23
  PHASE_CONTROLLERS = {
24
24
  "assessment" => Assessment, "correction" => Correction, "acknowledgement" => Acknowledgement,
25
- "acknowledgements" => Acknowledgements, "repointing" => Repoint
25
+ "acknowledgements" => Acknowledgements, "deciding" => OpenFindingDecisions
26
26
  }.freeze #: Hash[String, Class[AnswerPhase]]
27
27
 
28
28
  #: (String, String?, Hash[String, untyped]) -> untyped
@@ -41,9 +41,7 @@ module Principles
41
41
  def checked_request(request_id, head)
42
42
  audit = audit_now(request_id.principle_id)
43
43
  basis = Models::AssessmentBasis.new(head.fetch("basis"))
44
- prior = audit.check_assessment_request(request_id, basis: basis, committed: committed(basis.base, audit.map),
45
- record: @audit_records.find(audit.id),
46
- loads: loads_to_check(audit))
44
+ prior = prior_unless_stale(request_id, audit, basis)
47
45
  principle_history(audit.id).confirm_current_id_since(basis.base)
48
46
  prior
49
47
  end
@@ -80,6 +78,24 @@ module Principles
80
78
 
81
79
  private
82
80
 
81
+ # The prior findings the request request_id names listed, printed with basis, refused unless audit, the map and
82
+ # members as they are now, still gives that request; a refusal names how the map changed since basis's commit,
83
+ # when that explains it.
84
+ #: (Models::RequestId, Models::Audit, Models::AssessmentBasis) -> Models::PriorFindings
85
+ def prior_unless_stale(request_id, audit, basis)
86
+ audit.check_assessment_request(request_id, basis: basis, committed: committed(basis.base, audit.map),
87
+ record: @audit_records.find(audit.id),
88
+ loads: loads_to_check(audit)) { map_at(audit.id, basis.base) }
89
+ end
90
+
91
+ # The map of principle_id as commit holds it, nil outside git or where it cannot be read there.
92
+ #: (String, String?) -> Models::Principle?
93
+ def map_at(principle_id, commit)
94
+ commit && principle_history(principle_id).map_at(commit)
95
+ rescue Error
96
+ nil
97
+ end
98
+
83
99
  # The placeholders a full audit's template printed, as start-audit --as template prints it now.
84
100
  #: (Models::RequestId) -> Hash[String, untyped]?
85
101
  def printed_placeholders(request_id)
@@ -140,7 +156,7 @@ module Principles
140
156
  def request_to_correct(basis, audit, findings)
141
157
  head = Views::AnswerHead.new(request_id: basis.request_id(audit.id, audit.now).to_s, basis: basis.to_h)
142
158
  Views::CorrectionRequest.new(head: head, principle_id: audit.id, findings: findings,
143
- placeholders: Models::Disposition::TEMPLATE_PLACEHOLDERS)
159
+ placeholders: Models::DispositionPlaceholders::TEMPLATE_PLACEHOLDERS)
144
160
  end
145
161
 
146
162
  # The open record that keeps the assessment, and outside git what the audit began from, and the last completed
@@ -9,7 +9,7 @@ require_relative "../views/open_findings_line"
9
9
  require_relative "acknowledgement"
10
10
  require_relative "acknowledgements"
11
11
  require_relative "full_audit_request"
12
- require_relative "repoint"
12
+ require_relative "open_finding_decisions"
13
13
 
14
14
  module Principles
15
15
  # Each runs one command: reads models, applies their rules and prints through a view.
@@ -45,19 +45,29 @@ module Principles
45
45
 
46
46
  private
47
47
 
48
- # The audit start-audit's options ask for: a one-member audit with --member, a repoint of the open
49
- # findings' write-ups with --write-ups, else a full audit; a full or one-member audit's answer alone with
48
+ # The audit start-audit's options ask for: a one-member audit with --member, a decision on the open
49
+ # findings with --open-findings, else a full audit, refusing --write-ups; an audit's answer alone with
50
50
  # --as template.
51
51
  #: (String, Hash[String, untyped]) -> Hash[String, untyped]
52
52
  def started_audit(id, options)
53
+ refuse_write_ups(id) if options["write_ups"]
53
54
  naming_the_executable { @audit_records.refuse_newer(id, version: @tool.version) }
54
55
  ids = [id, *options.fetch("other_ids", [])]
55
56
  return acknowledge(ids, options.fetch("member"), to_fill: options["as"] == "template") if options["member"]
56
- return handed(Repoint).start(id) if options["write_ups"]
57
+ return handed(OpenFindingDecisions).decide(id, to_fill: options["as"] == "template") if options["open_findings"]
57
58
 
58
59
  full_audit(id, options)
59
60
  end
60
61
 
62
+ # Refuses --write-ups, which --open-findings replaced for one release, printing the request for principle id
63
+ # that replaces it (013 R12).
64
+ #: (String) -> bot
65
+ def refuse_write_ups(id)
66
+ raise Error.new("replaced_option",
67
+ "--write-ups is replaced by --open-findings, which also changes a finding's wait and action",
68
+ "Run instead: #{invocation.in_project("start-audit", id, usage: "--open-findings")}")
69
+ end
70
+
61
71
  # A full audit's request, or with --as template its answer alone, or with --instruction one instruction field
62
72
  # of it, or with --part one other part of it, or one member's slot of the answer beside --as template.
63
73
  #: (String, Hash[String, untyped]) -> Hash[String, untyped]
@@ -74,7 +84,8 @@ module Principles
74
84
  # The part of the request --part names, or beside --as template the member's slot of the answer it names.
75
85
  #: (FullAuditRequest, Hash[String, untyped]) -> Hash[String, untyped]
76
86
  def full_part(full, options)
77
- options["as"] ? full.slot_to_fill(options.fetch("part")) : full.part(options.fetch("part"))
87
+ parts = options.fetch("part")
88
+ options["as"] ? full.slot_to_fill(parts) : full.part(parts)
78
89
  end
79
90
 
80
91
  # id's committed record. With none, an id no map has is refused as show-principle refuses it, since
@@ -0,0 +1,60 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ require_relative "../error"
5
+ require_relative "../models/mapped_principles"
6
+ require_relative "../models/member_repair_moves"
7
+ require_relative "../views/invocation"
8
+ require_relative "../views/member_repairs"
9
+
10
+ module Principles
11
+ # Each runs one command: reads models, applies their rules and prints through a view.
12
+ # controllers/CLAUDE.md owns the boundary.
13
+ module Controllers
14
+ # The repairs this tool prints for members it cannot find, in the project's maps: the moves
15
+ # Models::MemberRepairMoves gives for each, printed by Views::MemberRepairs, beside a broken_members refusal or a
16
+ # member show-principle shows.
17
+ class BrokenMemberRepairs
18
+ #: (Models::MappedPrinciples, Views::Invocation) -> void
19
+ def initialize(principles, invocation)
20
+ @principles = principles
21
+ @repairs = Views::MemberRepairs.new(invocation) #: Views::MemberRepairs
22
+ freeze
23
+ end
24
+
25
+ # A broken_members refusal, with each member's own repair commands beside it as repair_with, since a
26
+ # model's repair can only name placeholders. Any other refusal is returned as it is.
27
+ #: (Error) -> Error
28
+ def beside(error)
29
+ return error unless error.payload["code"] == "broken_members"
30
+
31
+ members = error.payload.fetch("members").map do |entry|
32
+ repaired({ "principle" => error.payload["principle"] }.compact.merge(entry))
33
+ end
34
+ error.including("members" => members)
35
+ end
36
+
37
+ # The moves that may repair member, which a refusal with code says this tool cannot find; tracked_as is the
38
+ # spelling git tracks its path under, when the refusal names one.
39
+ #: (Hash[String, untyped], code: String?, tracked_as: String?) -> Array[Views::MemberRepairs::Move]
40
+ def moves(member, code:, tracked_as:)
41
+ Models::MemberRepairMoves.new(member, code:, tracked_as:).to_a
42
+ .map { Views::MemberRepairs::Move.new(keep: it.keep, fill: it.fill) }
43
+ end
44
+
45
+ private
46
+
47
+ # entry with repair_with, when it names a member its map still lists.
48
+ #: (Hash[String, untyped]) -> Hash[String, untyped]
49
+ def repaired(entry)
50
+ principle = entry["principle"] or return entry
51
+ id = entry["id"] or return entry
52
+ member = @principles.find(principle).member(id)
53
+ moves = moves(member, code: entry["code"], tracked_as: entry["tracked_as"])
54
+ entry.merge("repair_with" => @repairs.commands(principle, id, moves))
55
+ rescue Error
56
+ entry
57
+ end
58
+ end
59
+ end
60
+ end
@@ -8,7 +8,6 @@ require_relative "../models/audit"
8
8
  require_relative "../models/carried_assessments"
9
9
  require_relative "../models/member"
10
10
  require_relative "../models/member_grounds"
11
- require_relative "../models/member_repair_moves"
12
11
  require_relative "../models/principle_history"
13
12
  require_relative "../models/members_sharing_lines"
14
13
  require_relative "../models/project"
@@ -17,8 +16,8 @@ require_relative "../models/record_judged_against"
17
16
  require_relative "../views/audit_result"
18
17
  require_relative "../views/lines_shared_with_member"
19
18
  require_relative "../views/map_result"
20
- require_relative "../views/member_repairs"
21
19
  require_relative "../views/record_waiting_on_an_upgrade"
20
+ require_relative "broken_member_repairs"
22
21
  require_relative "running_tool"
23
22
 
24
23
  module Principles
@@ -76,33 +75,12 @@ module Principles
76
75
  refusal = (rerun ? e.rerun_with_near_miss(&rerun) : e).printing_commands do |command|
77
76
  invocation.listed_in_project(command.command, command.values, options: command.options, usage: command.usage)
78
77
  end
79
- raise with_member_repairs(refusal).naming(invocation.prefix)
78
+ raise broken_member_repairs.beside(refusal).naming(invocation.prefix)
80
79
  end
81
80
 
82
- # A broken_members refusal, with each member's own repair commands beside it as repair_with, since a
83
- # model's repair can only name placeholders. Any other refusal is returned as it is.
84
- #: (Error) -> Error
85
- def with_member_repairs(error)
86
- return error unless error.payload["code"] == "broken_members"
87
-
88
- repairs = Views::MemberRepairs.new(invocation)
89
- members = error.payload.fetch("members").map do |entry|
90
- repaired({ "principle" => error.payload["principle"] }.compact.merge(entry), repairs)
91
- end
92
- error.including("members" => members)
93
- end
94
-
95
- # entry with repair_with, when it names a member its map still lists.
96
- #: (Hash[String, untyped], Views::MemberRepairs) -> Hash[String, untyped]
97
- def repaired(entry, repairs)
98
- principle = entry["principle"] or return entry
99
- id = entry["id"] or return entry
100
- member = @principles.find(principle).member(id)
101
- moves = Models::MemberRepairMoves.new(member, code: entry["code"], tracked_as: entry["tracked_as"]).to_a
102
- entry.merge("repair_with" => repairs.commands(principle, id, moves))
103
- rescue Error
104
- entry
105
- end
81
+ # The repairs this tool prints for members it cannot find, in this project's maps.
82
+ #: () -> BrokenMemberRepairs
83
+ def broken_member_repairs = BrokenMemberRepairs.new(@principles, invocation)
106
84
 
107
85
  #: (String) -> bot
108
86
  def unknown(command)
@@ -166,7 +144,7 @@ module Principles
166
144
 
167
145
  # Each member's hash at base, or nil outside git.
168
146
  #: (String?, Models::Principle) -> Hash[String, String]?
169
- def committed(base, map) = base ? @history.hashes_at(base, map.members) : nil
147
+ def committed(base, map) = base ? @history.at(base).hashes(map.members) : nil
170
148
 
171
149
  # When each of the map's members loads, by id, which a full audit's request lists against the activation and
172
150
  # show-principle prints, from the project's hooks as hooks read them.
@@ -201,9 +179,9 @@ module Principles
201
179
  end
202
180
 
203
181
  # Where a member is in its file now, and the hash of what it says there.
204
- #: (Models::Locator) -> Hash[String, untyped]
182
+ #: (Models::Locator) -> Models::LocatedText
205
183
  def snapshot(locator)
206
- @project.locate(locator)
184
+ @project.located_text(locator)
207
185
  end
208
186
 
209
187
  # The members sharing a line with member where it is now, in map and in the other maps, as add-member and
@@ -7,7 +7,7 @@ require_relative "../models/correction_answer"
7
7
  require_relative "../models/declared_map_changes"
8
8
  require_relative "../models/finding_write_ups"
9
9
  require_relative "../models/request_id"
10
- require_relative "../views/prompts"
10
+ require_relative "../views/correction_request"
11
11
  require_relative "audit_completion"
12
12
 
13
13
  module Principles
@@ -57,7 +57,7 @@ module Principles
57
57
 
58
58
  # The placeholders a correction's template printed, its dispositions'.
59
59
  #: (Models::RequestId) -> Hash[String, untyped]?
60
- def printed_placeholders(_request_id) = Models::Disposition::TEMPLATE_PLACEHOLDERS
60
+ def printed_placeholders(_request_id) = Models::DispositionPlaceholders::TEMPLATE_PLACEHOLDERS
61
61
 
62
62
  # The result of judging a correction answer: its basis, moves and dispositions checked, and the audit completed.
63
63
  #: (Models::RequestId, untyped, Models::Audit) -> [untyped, Array[Models::AuditRecord]]
@@ -77,12 +77,14 @@ module Principles
77
77
  def resumed(audit, basis, before, moves) = audit.resumed(basis, before, moves, @audit_records.find(audit.id))
78
78
 
79
79
  # The packaged answer guide, which the correction request prints, is the one owner of its samples, the text
80
- # the agent saw, so its sample for each action is handed to the model, which refuses a field given back as
81
- # its sample. Should the tool be upgraded between request and answer, that answer is checked only
80
+ # the agent saw, but for the deferred sample's reason, which is the template's reason placeholder that
81
+ # Models::Disposition owns. Its sample for each action is handed to the model, which refuses a field given back
82
+ # as its sample. Should the tool be upgraded between request and answer, that answer is checked only
82
83
  # against the new guide's samples.
83
84
  #: (untyped, Array[untyped], Models::AuditStart, Models::Audit) -> Array[Models::Disposition]
84
85
  def dispositions(response, findings, start, audit)
85
- samples = Views::Prompts.data("dispose-of-each-finding/answer-guide").fetch("disposition")
86
+ samples = Views::CorrectionRequest.answer_guide(Models::DispositionPlaceholders::PLACEHOLDERS.fetch("reason"))
87
+ .fetch("disposition")
86
88
  Models::CorrectionAnswer.new(response, findings, samples:) { |locator| snapshot(locator) }
87
89
  .dispositions(changed: start.changed(now: audit.now))
88
90
  end
@@ -34,10 +34,14 @@ module Principles
34
34
  @listing = listing #: MembersToAssess::Listing
35
35
  end
36
36
 
37
- # The request as start-audit prints it, with a notice when the last audit's record was left uncommitted.
37
+ # The request as start-audit prints it, with each part's bytes as --part prints it, and a notice when the last
38
+ # audit's record was left uncommitted.
38
39
  #: () -> Hash[String, untyped]
39
40
  def printed
40
- audit_result.request(with_record_notice(audit_result.assessment_request(asked))).merge("wrote" => [])
41
+ request = asked
42
+ part_bytes = request_parts(request).part_bytes
43
+ audit_result.request(with_record_notice(audit_result.assessment_request(request, part_bytes:)))
44
+ .merge("wrote" => [])
41
45
  end
42
46
 
43
47
  # The answer alone, as start-audit --as template prints it, to fill and submit under the request's id.
@@ -55,31 +59,51 @@ module Principles
55
59
  { "request_id" => request.request_id, named => request.whole_instruction(named), "wrote" => [] }
56
60
  end
57
61
 
58
- # The part of this request --part names, printed alone under the request's id, so the agent need not read the
59
- # whole request for it, the index with how to answer it, and one it leaves out for listing nothing as empty;
60
- # refused when the request has no part by that name.
61
- #: (String) -> Hash[String, untyped]
62
- def part(name)
62
+ # The parts of this request each --part names, in the order given, printed together under the request's one
63
+ # id, each member's in one members list, so the agent need not read the whole request for them, the index with
64
+ # how to answer it, and one it leaves out for listing nothing as empty; the answer to fill bare, given alone, to
65
+ # save as it stands; refused when the request has no part by one of the names.
66
+ #: (Array[String]) -> Hash[String, untyped]
67
+ def part(names)
63
68
  request = asked
64
- parts = request.context_parts(texts: member_texts, optional: PartsToRead::OPTIONAL)
65
- named = Models::PartNamed.new(name, principle_id: @id, printed: parts.printable, empty: parts.left_out).part
66
- shown = { "request_id" => request.request_id, **parts.shown(named) }
67
- shown = Views::PartsIndexResult.new(invocation).printed(shown, request) if named == Views::ContextParts::INDEX
68
- shown.merge("wrote" => [])
69
+ parts = request_parts(request)
70
+ named = names.map { named_in(parts, it) }
71
+ return parts.shown(Views::ContextParts::TEMPLATE) if named == [Views::ContextParts::TEMPLATE]
72
+
73
+ shown = { "request_id" => request.request_id }.merge(parts.shown_together(named))
74
+ answering(request, shown, named).merge("wrote" => [])
69
75
  end
70
76
 
71
- # The slot of the answer to fill that --part names beside --as template, a member's as members/ID, printed alone
72
- # under the request's id; refused when the template has no slot by that name.
73
- #: (String) -> Hash[String, untyped]
74
- def slot_to_fill(name)
77
+ # The slots of the answer to fill that each --part names beside --as template, a member's as members/ID, in the
78
+ # order given, printed together under the request's id; refused when the template has no slot by one name.
79
+ #: (Array[String]) -> Hash[String, untyped]
80
+ def slot_to_fill(names)
75
81
  request = asked
76
82
  slots = request.slots_to_fill
77
- named = Models::PartNamed.new(name, principle_id: @id, printed: slots.keys, template: true).part
78
- { "request_id" => request.request_id, "member_assessments" => [slots.fetch(named)], "wrote" => [] }
83
+ named = names.map { Models::PartNamed.new(it, principle_id: @id, printed: slots.keys, template: true).part }
84
+ { "request_id" => request.request_id, "member_assessments" => named.map { slots.fetch(it) }, "wrote" => [] }
79
85
  end
80
86
 
81
87
  private
82
88
 
89
+ # The parts of request that --part prints, each member's with its text now.
90
+ #: (Views::AssessmentRequest) -> Views::ContextParts
91
+ def request_parts(request) = request.context_parts(texts: member_texts, optional: PartsToRead::OPTIONAL)
92
+
93
+ # The part name names in parts, refused when the request neither prints it nor leaves it out as empty.
94
+ #: (Views::ContextParts, String) -> String
95
+ def named_in(parts, name)
96
+ Models::PartNamed.new(name, principle_id: @id, printed: parts.printable, empty: parts.left_out).part
97
+ end
98
+
99
+ # shown, the parts named printed from request, with how to answer the request when the index is among them.
100
+ #: (Views::AssessmentRequest, Hash[String, untyped], Array[String]) -> Hash[String, untyped]
101
+ def answering(request, shown, named)
102
+ return shown unless named.include?(Views::ContextParts::INDEX)
103
+
104
+ Views::PartsIndexResult.new(invocation).printed(shown, request)
105
+ end
106
+
83
107
  # The request and what it asks, listing the findings the last completed audit left to decide, under an id that
84
108
  # digests them and the revision of that audit's record, but not the findings other principles leave
85
109
  # open on members sharing these lines.
@@ -116,7 +140,7 @@ module Principles
116
140
  Views::AssessedMembers.new(@listing.members,
117
141
  reviewed_check_placeholders: Models::ReportedCheck::PLACEHOLDERS.to_h,
118
142
  unchanged_check_placeholders: Models::ReportedCheck::UNCHANGED_PLACEHOLDERS.to_h,
119
- assessment_placeholder: Models::MemberAssessments::PLACEHOLDER)
143
+ assessment_placeholder: Models::MemberAssessments::NAMED_PLACEHOLDER)
120
144
  end
121
145
 
122
146
  # Each member's lines now, by id, without their line endings, so its part carries the text it is judged on.
@@ -127,9 +151,7 @@ module Principles
127
151
 
128
152
  # The map's file and every member's file, which the base commit is judged over.
129
153
  #: (Models::Principle) -> Array[String]
130
- def audited_files(map)
131
- [@principles.file(@id), *map.members.map(&:path)]
132
- end
154
+ def audited_files(map) = @principles.audited_files(@id, map.members)
133
155
 
134
156
  # The request, with a notice when the last audit's record was left uncommitted: a completed one to commit, or an
135
157
  # open one, which its correction completes, never to commit.
@@ -23,7 +23,7 @@ module Principles
23
23
  wrote = unchanged ? [] : [updated.save]
24
24
  Views::GuidanceSearchPathsResult.new(invocation)
25
25
  .result(status: unchanged ? "unchanged" : "guidance_search_paths_updated",
26
- globs: updated.globs, wrote:)
26
+ globs: updated.globs, wrote:, added: updated.added_since(current))
27
27
  end
28
28
  end
29
29
  end
@@ -65,14 +65,14 @@ module Principles
65
65
 
66
66
  # The moves that may repair each shown member whose reference is broken, so an audit would refuse it, by id in the
67
67
  # map's order.
68
- #: (Models::Principle, Array[Hash[String, untyped]]) -> Hash[String, Array[Hash[String, untyped]]]
68
+ #: (Models::Principle, Array[Hash[String, untyped]]) -> Hash[String, Array[Views::MemberRepairs::Move]]
69
69
  def repairs(principle, members)
70
+ broken = broken_member_repairs
70
71
  members.select { |member| Models::MemberState.new(member.fetch("id"), member.fetch("freshness")).broken? }
71
72
  .to_h do |member|
72
73
  id = member.fetch("id")
73
74
  error = member.fetch("error", {})
74
- [id, Models::MemberRepairMoves.new(principle.member(id), code: error["code"],
75
- tracked_as: error["tracked_as"]).to_a]
75
+ [id, broken.moves(principle.member(id), code: error["code"], tracked_as: error["tracked_as"])]
76
76
  end
77
77
  end
78
78
 
@@ -3,6 +3,7 @@
3
3
 
4
4
  require_relative "command"
5
5
  require_relative "../models/acknowledgement"
6
+ require_relative "../models/acknowledgement_placeholders"
6
7
  require_relative "../models/check_since_last_audit"
7
8
  require_relative "../models/list_member_problems_check"
8
9
  require_relative "../models/listed_members"
@@ -26,7 +27,7 @@ module Principles
26
27
  #: (Hash[String, untyped]?, ?Views::MemberChangeSinceBaseline?) -> Hash[String, untyped]
27
28
  def self.placeholders(check_result, change = nil)
28
29
  quotes = change&.first_changed_lines.to_h
29
- { **Models::Acknowledgement.placeholders_beside(quotes),
30
+ { **Models::AcknowledgementPlaceholders.beside(quotes),
30
31
  **(check_result ? { "check_result" => check_result } : {}) }
31
32
  end
32
33
 
@@ -45,7 +46,7 @@ module Principles
45
46
  @base = @history.base_commit(principle_id, [@principles.file(principle_id), @member.path]) #: String?
46
47
  @acknowledgement = Models::Acknowledgement.new(
47
48
  principle_id:, member: @member, record: @audit_records.find(principle_id), base: @base,
48
- now_sha256: @project.locate(@member.locator).fetch("sha256")
49
+ now_sha256: @project.located_text(@member.locator).sha256
49
50
  ) #: Models::Acknowledgement
50
51
  end
51
52
 
@@ -100,9 +101,8 @@ module Principles
100
101
  def check_template
101
102
  checks = Models::CheckSinceLastAudit.new(principle_history: principle_history(@id),
102
103
  record: @audit_records.find(@id))
103
- Views::OneMemberCheckResultTemplate.for(checks.entry(@member),
104
- exit_status: Models::Acknowledgement::EXIT_STATUS_PLACEHOLDER,
105
- own_listing: !own_listing.nil?)
104
+ exit_status = Models::AcknowledgementPlaceholders::EXIT_STATUS_PLACEHOLDER
105
+ Views::OneMemberCheckResultTemplate.for(checks.entry(@member), exit_status:, own_listing: !own_listing.nil?)
106
106
  end
107
107
 
108
108
  # The member's check read as this tool's own list-member-problems --short; nil for any other.