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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +42 -0
- data/README.md +0 -2
- data/lib/principles/controllers/acknowledgement.rb +11 -4
- data/lib/principles/controllers/acknowledgements.rb +4 -4
- data/lib/principles/controllers/answer.rb +2 -2
- data/lib/principles/controllers/assessment.rb +20 -4
- data/lib/principles/controllers/audit.rb +16 -5
- data/lib/principles/controllers/broken_member_repairs.rb +60 -0
- data/lib/principles/controllers/command.rb +8 -30
- data/lib/principles/controllers/correction.rb +7 -5
- data/lib/principles/controllers/full_audit_request.rb +44 -22
- data/lib/principles/controllers/guidance_search_paths.rb +1 -1
- data/lib/principles/controllers/inventory.rb +3 -3
- data/lib/principles/controllers/member_acknowledgement.rb +5 -5
- data/lib/principles/controllers/member_addition.rb +5 -2
- data/lib/principles/controllers/member_entries.rb +1 -1
- data/lib/principles/controllers/member_problems_report.rb +11 -7
- data/lib/principles/controllers/members_to_assess.rb +1 -1
- data/lib/principles/controllers/meta_principle_setup.rb +4 -3
- data/lib/principles/controllers/open_correction.rb +3 -3
- data/lib/principles/controllers/open_finding_decisions.rb +66 -0
- data/lib/principles/controllers/running_tool.rb +22 -5
- data/lib/principles/controllers/survey.rb +3 -2
- data/lib/principles/data/candidate_files_found.rb +6 -4
- data/lib/principles/data/command-steps.json +20 -20
- data/lib/principles/data/json_text.rb +5 -1
- data/lib/principles/data/parser_message.rb +61 -0
- data/lib/principles/data/project_files.rb +4 -2
- data/lib/principles/data/repository.rb +4 -4
- data/lib/principles/data/running_version.rb +1 -1
- data/lib/principles/data/schemas/audit-record.schema.json +15 -0
- data/lib/principles/data/schemas/command-steps.schema.json +1 -1
- data/lib/principles/data/schemas/{repointing-answer.schema.json → deciding-answer.schema.json} +12 -6
- data/lib/principles/invocation_options.rb +4 -4
- data/lib/principles/launch.rb +5 -3
- data/lib/principles/models/acknowledgement.rb +1 -27
- data/lib/principles/models/acknowledgement_left_as_printed.rb +2 -1
- data/lib/principles/models/acknowledgement_placeholders.rb +48 -0
- data/lib/principles/models/after_commit_input.rb +1 -0
- data/lib/principles/models/assessment_answer.rb +2 -2
- data/lib/principles/models/assessment_basis.rb +1 -1
- data/lib/principles/models/assessment_left_as_printed.rb +1 -1
- data/lib/principles/models/audit.rb +24 -4
- data/lib/principles/models/audit_entry_protecting_map.rb +1 -0
- data/lib/principles/models/audit_record.rb +5 -14
- data/lib/principles/models/audit_records.rb +2 -2
- data/lib/principles/models/audited_member_lines.rb +1 -1
- data/lib/principles/models/candidate_files.rb +1 -1
- data/lib/principles/models/candidate_inventory.rb +20 -10
- data/lib/principles/models/candidate_outline.rb +1 -1
- data/lib/principles/models/changed_regions.rb +1 -1
- data/lib/principles/models/command_steps.rb +1 -2
- data/lib/principles/models/correction_basis.rb +1 -1
- data/lib/principles/models/declared_map_changes.rb +1 -2
- data/lib/principles/models/disposition.rb +12 -76
- data/lib/principles/models/disposition_placeholders.rb +48 -0
- data/lib/principles/models/disposition_text_field.rb +41 -0
- data/lib/principles/models/evidence_item.rb +1 -1
- data/lib/principles/models/finding_decision.rb +84 -0
- data/lib/principles/models/finding_write_ups.rb +2 -1
- data/lib/principles/models/first_full_audit.rb +1 -0
- data/lib/principles/models/fix_only_fields.rb +4 -3
- data/lib/principles/models/frontmatter_fields.rb +1 -1
- data/lib/principles/models/guidance_search_path.rb +1 -1
- data/lib/principles/models/guidance_search_paths.rb +5 -1
- data/lib/principles/models/head_moves.rb +1 -0
- data/lib/principles/models/ignored_candidates.rb +1 -1
- data/lib/principles/models/instruction_named.rb +1 -1
- data/lib/principles/models/json_path_query.rb +1 -1
- data/lib/principles/models/json_path_selectors.rb +1 -1
- data/lib/principles/models/json_path_string.rb +1 -1
- data/lib/principles/models/last_completed_revision.rb +1 -1
- data/lib/principles/models/line_diff.rb +1 -1
- data/lib/principles/models/line_span.rb +1 -1
- data/lib/principles/models/loading_scope.rb +1 -0
- data/lib/principles/models/located_text.rb +20 -12
- data/lib/principles/models/map_change.rb +66 -0
- data/lib/principles/models/mapped_principles.rb +4 -0
- data/lib/principles/models/markdown_file.rb +22 -1
- data/lib/principles/models/member.rb +1 -1
- data/lib/principles/models/member_assessments.rb +11 -4
- data/lib/principles/models/member_elsewhere.rb +1 -1
- data/lib/principles/models/member_file.rb +15 -13
- data/lib/principles/models/member_hashes_as_written.rb +2 -2
- data/lib/principles/models/member_history.rb +1 -1
- data/lib/principles/models/member_lines.rb +1 -1
- data/lib/principles/models/member_loading_scopes.rb +1 -0
- data/lib/principles/models/member_mapping_run.rb +4 -4
- data/lib/principles/models/member_moves.rb +1 -2
- data/lib/principles/models/member_problems.rb +5 -1
- data/lib/principles/models/member_region.rb +1 -1
- data/lib/principles/models/member_repair_moves.rb +20 -4
- data/lib/principles/models/member_snapshots.rb +10 -10
- data/lib/principles/models/members_elsewhere.rb +1 -1
- data/lib/principles/models/members_in_consecutive_sections.rb +1 -0
- data/lib/principles/models/members_sharing_lines.rb +2 -2
- data/lib/principles/models/misspelt_member_id.rb +10 -4
- data/lib/principles/models/named_placeholder.rb +32 -0
- data/lib/principles/models/open_finding.rb +4 -3
- data/lib/principles/models/open_findings_decision.rb +124 -0
- data/lib/principles/models/open_findings_elsewhere.rb +1 -1
- data/lib/principles/models/other_templates_placeholders.rb +26 -6
- data/lib/principles/models/outline_budget.rb +1 -1
- data/lib/principles/models/outline_group.rb +1 -1
- data/lib/principles/models/outline_section.rb +1 -1
- data/lib/principles/models/part_named.rb +1 -1
- data/lib/principles/models/plain_text_file.rb +1 -1
- data/lib/principles/models/principle_history.rb +5 -4
- data/lib/principles/models/principle_members.rb +1 -1
- data/lib/principles/models/problem_report.rb +13 -1
- data/lib/principles/models/project.rb +15 -16
- data/lib/principles/models/project_at_commit.rb +60 -0
- data/lib/principles/models/project_history.rb +10 -52
- data/lib/principles/models/prose_line.rb +36 -0
- data/lib/principles/models/record_format.rb +17 -4
- data/lib/principles/models/recorded_finding.rb +47 -7
- data/lib/principles/models/recorded_findings.rb +7 -7
- data/lib/principles/models/recorded_hashes.rb +1 -1
- data/lib/principles/models/recorded_members.rb +6 -8
- data/lib/principles/models/report_hooks.rb +1 -0
- data/lib/principles/models/request_id.rb +2 -2
- data/lib/principles/models/sent_answer.rb +5 -3
- data/lib/principles/models/session_start_input.rb +1 -0
- data/lib/principles/models/stale_request.rb +22 -8
- data/lib/principles/models/submitted_answer.rb +1 -1
- data/lib/principles/models/survey_search_paths.rb +13 -5
- data/lib/principles/models/template_placeholders.rb +22 -7
- data/lib/principles/models/text_size.rb +11 -3
- data/lib/principles/models/text_within.rb +1 -1
- data/lib/principles/models/unchecked_members.rb +1 -0
- data/lib/principles/models/uncommitted_outside_the_map.rb +1 -1
- data/lib/principles/models/unfinished_field.rb +34 -0
- data/lib/principles/models/unknown_principle.rb +1 -0
- data/lib/principles/models/write_up_opening.rb +5 -31
- data/lib/principles/models/write_up_pointer.rb +2 -1
- data/lib/principles/start_audit_options.rb +35 -20
- data/lib/principles/version.rb +2 -2
- data/lib/principles/views/acknowledged_result.rb +59 -0
- data/lib/principles/views/acknowledgement_result.rb +44 -51
- data/lib/principles/views/added_member.rb +10 -1
- data/lib/principles/views/answer_in_a_file.rb +65 -0
- data/lib/principles/views/assessed_members.rb +4 -2
- data/lib/principles/views/assessment_answer_guide.rb +59 -0
- data/lib/principles/views/assessment_request.rb +2 -26
- data/lib/principles/views/audit_result.rb +18 -7
- data/lib/principles/views/candidate_files_result.rb +9 -4
- data/lib/principles/views/context_parts.rb +41 -10
- data/lib/principles/views/correction_request.rb +27 -18
- data/lib/principles/views/first_audit_brief.rb +2 -1
- data/lib/principles/views/guidance_search_paths_result.rb +13 -6
- data/lib/principles/views/invocation.rb +14 -4
- data/lib/principles/views/json_on_one_line.rb +18 -0
- data/lib/principles/views/member_repairs.rb +21 -5
- data/lib/principles/views/meta_principle_result.rb +26 -5
- data/lib/principles/views/open_findings_decision_result.rb +60 -0
- data/lib/principles/views/parts_index_result.rb +8 -6
- data/lib/principles/views/principle_read_result.rb +2 -2
- data/lib/principles/views/problem_facts.rb +46 -0
- data/lib/principles/views/problem_lines.rb +8 -3
- data/lib/principles/views/problem_result.rb +53 -31
- data/lib/principles/views/prompts/answer-any-judgement-request/fill-the-answer-in-a-file.md +6 -0
- data/lib/principles/views/prompts/assess-every-member/read-the-request-in-parts.md +2 -1
- data/lib/principles/views/prompts/decide-open-findings/give-only-what-changed-of-each.md +6 -0
- data/lib/principles/views/prompts/dispose-of-each-finding/answer-guide.json +1 -1
- data/lib/principles/views/prompts/dispose-of-each-finding/confirm-each-deferral-written-up-nowhere.md +2 -1
- data/lib/principles/views/prompts/dispose-of-each-finding/fix-or-record-each-finding.md +2 -2
- data/lib/principles/views/prompts/find-a-principle-to-map/where-a-survey-with-only-looks.md +4 -0
- data/lib/principles/views/prompts/learn-what-a-command-does/add-guidance-search-path.md +2 -1
- data/lib/principles/views/prompts/learn-what-a-command-does/add-member.md +1 -0
- data/lib/principles/views/prompts/learn-what-a-command-does/change-member-check.md +4 -3
- data/lib/principles/views/prompts/learn-what-a-command-does/change-member-role.md +4 -3
- data/lib/principles/views/prompts/learn-what-a-command-does/list-candidate-files.md +12 -12
- data/lib/principles/views/prompts/learn-what-a-command-does/list-member-problems.md +7 -8
- data/lib/principles/views/prompts/learn-what-a-command-does/list-open-findings.md +11 -12
- data/lib/principles/views/prompts/learn-what-a-command-does/move-member.md +4 -3
- data/lib/principles/views/prompts/learn-what-a-command-does/remove-member-check.md +4 -3
- data/lib/principles/views/prompts/learn-what-a-command-does/remove-member.md +4 -3
- data/lib/principles/views/prompts/learn-what-a-command-does/report-at-session-start.md +13 -12
- data/lib/principles/views/prompts/learn-what-a-command-does/show-answer-check.md +2 -2
- data/lib/principles/views/prompts/learn-what-a-command-does/show-open-correction.md +2 -2
- data/lib/principles/views/prompts/learn-what-a-command-does/start-audit.md +12 -12
- data/lib/principles/views/prompts/run-a-first-audit-in-the-background/follow-the-brief.md +1 -1
- data/lib/principles/views/prompts/start-a-session/act-on-the-changed-principles.md +2 -0
- data/lib/principles/views/prompts.rb +7 -4
- metadata +26 -8
- data/lib/principles/controllers/repoint.rb +0 -67
- data/lib/principles/models/repoint.rb +0 -125
- data/lib/principles/models/write_up_repoint.rb +0 -38
- data/lib/principles/views/prompts/repoint-write-ups/point-each-moved-write-up-at-its-new-place.md +0 -10
- data/lib/principles/views/repoint_result.rb +0 -80
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
4
|
require_relative "answer_head"
|
|
5
|
+
require_relative "answer_in_a_file"
|
|
5
6
|
require_relative "invocation"
|
|
6
7
|
require_relative "prompts"
|
|
8
|
+
require_relative "shell_word"
|
|
7
9
|
|
|
8
10
|
module Principles
|
|
9
11
|
# What this tool prints, from plain values a controller hands it. views/CLAUDE.md owns the boundary.
|
|
@@ -12,7 +14,8 @@ module Principles
|
|
|
12
14
|
# every disposition's shape, and what submitting the assessment stored.
|
|
13
15
|
class CorrectionRequest
|
|
14
16
|
# head is what the answer hands back unchanged, the request's id and the basis the correction depends on;
|
|
15
|
-
# placeholders is the text the template leaves in each field the agent writes
|
|
17
|
+
# placeholders is the text the template leaves in each field the agent writes, with %<id>s where each
|
|
18
|
+
# disposition names its finding.
|
|
16
19
|
#: (head: AnswerHead, principle_id: String, findings: Array[untyped], placeholders: Hash[String, String]) -> void
|
|
17
20
|
def initialize(head:, principle_id:, findings:, placeholders:)
|
|
18
21
|
@head = head
|
|
@@ -31,7 +34,15 @@ module Principles
|
|
|
31
34
|
def context
|
|
32
35
|
{ "principle_id" => @principle_id, "findings" => @findings,
|
|
33
36
|
"question" => Prompts.text("dispose-of-each-finding/fix-or-record-each-finding"),
|
|
34
|
-
"answer_guide" =>
|
|
37
|
+
"answer_guide" => self.class.answer_guide(@placeholders.fetch("reason")) }
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# The guide to every disposition's shape, whose deferred sample's reason is reason_placeholder, the template's,
|
|
41
|
+
# its slot filled for no one finding, as the guide speaks of any.
|
|
42
|
+
#: (String) -> Hash[String, untyped]
|
|
43
|
+
def self.answer_guide(reason_placeholder)
|
|
44
|
+
Prompts.data("dispose-of-each-finding/answer-guide",
|
|
45
|
+
reason_placeholder: format(reason_placeholder, id: "this finding"))
|
|
35
46
|
end
|
|
36
47
|
|
|
37
48
|
# The answer to fill in, as show-open-correction and show-answer-check --as template print it alone: one
|
|
@@ -40,10 +51,11 @@ module Principles
|
|
|
40
51
|
#: () -> Hash[String, untyped]
|
|
41
52
|
def template
|
|
42
53
|
@head.leading("dispositions" => @findings.map do |finding|
|
|
43
|
-
{
|
|
44
|
-
|
|
54
|
+
named = @placeholders.transform_values { format(it, id: finding["id"]) }
|
|
55
|
+
{ "finding_id" => finding["id"], "action" => named.fetch("action"),
|
|
56
|
+
"reason" => named.fetch("reason"), "changed_members" => [], "removed_members" => [],
|
|
45
57
|
"evidence" => [],
|
|
46
|
-
"reassessment" =>
|
|
58
|
+
"reassessment" => named.fetch("reassessment"), "recorded_at" => nil, "waits_on" => nil }
|
|
47
59
|
end)
|
|
48
60
|
end
|
|
49
61
|
|
|
@@ -56,28 +68,25 @@ module Principles
|
|
|
56
68
|
view.request(view.correction_request(self))
|
|
57
69
|
end
|
|
58
70
|
|
|
59
|
-
# How to save and fill the correction's answer after submitting the checked assessment,
|
|
60
|
-
# prints it alone rather than printing it here; keep its
|
|
71
|
+
# How to save and fill the correction's answer after submitting the checked assessment, to the file named in full
|
|
72
|
+
# that its submit names too, naming the command that prints it alone rather than printing it here; keep its
|
|
73
|
+
# submit last.
|
|
61
74
|
#: (Hash[String, untyped], Invocation, String) -> Hash[String, untyped]
|
|
62
75
|
def with_correction_to_fill(acceptable, invocation, answer_file)
|
|
63
76
|
assessment_id = acceptable.fetch("request_id")
|
|
77
|
+
file = invocation.answer_file(request_id)
|
|
64
78
|
save = "Once this answer is submitted with the last line's command, save the correction's answer it leads " \
|
|
65
|
-
"to in a file outside the project,
|
|
66
|
-
"#{alone(assessment_id, answer_file, invocation)}\nFill only its
|
|
67
|
-
"#{invocation.submit_answer(request_id)}"
|
|
79
|
+
"to in a file outside the project, at this full path, the same from every shell, from this command's " \
|
|
80
|
+
"output: #{alone(assessment_id, answer_file, invocation)} > #{ShellWord.new(file)}\nFill only its " \
|
|
81
|
+
"dispositions, and submit it: #{invocation.submit_answer(request_id, file:)}"
|
|
68
82
|
acceptable.merge("correction_recovery" => recovery(invocation),
|
|
69
83
|
"next_action" => "#{save}\n#{acceptable.fetch("next_action")}")
|
|
70
84
|
end
|
|
71
85
|
|
|
72
|
-
# How to fill the correction by hand: save its answer alone, which show-open-correction prints from the
|
|
73
|
-
# record, to a file, fill only its dispositions there, and submit that file.
|
|
86
|
+
# How to fill the correction by hand: save its answer alone, which show-open-correction prints bare from the
|
|
87
|
+
# open record, to a file, fill only its dispositions there with a file-edit tool, and submit that file.
|
|
74
88
|
#: (Invocation) -> String
|
|
75
|
-
def to_fill_by_hand(invocation)
|
|
76
|
-
"Save the correction's answer alone in a file outside the project, such as under $TMPDIR, from this " \
|
|
77
|
-
"command's output, which prints it again from the open record whenever you need it: " \
|
|
78
|
-
"#{invocation.in_project("show-open-correction", @principle_id)}\nEdit only its dispositions in that " \
|
|
79
|
-
"file, then submit it: #{invocation.submit_answer(request_id)}"
|
|
80
|
-
end
|
|
89
|
+
def to_fill_by_hand(invocation) = AnswerInAFile.new(invocation).correction(@principle_id, request_id:)
|
|
81
90
|
|
|
82
91
|
# What to keep while the correction is open, and the read-only command that prints its answer again from the
|
|
83
92
|
# open record, in git or outside it.
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
require_relative "invocation"
|
|
5
5
|
require_relative "prompts"
|
|
6
|
+
require_relative "shell_word"
|
|
6
7
|
|
|
7
8
|
module Principles
|
|
8
9
|
# What this tool prints, from plain values a controller hands it. views/CLAUDE.md owns the boundary.
|
|
@@ -25,7 +26,7 @@ module Principles
|
|
|
25
26
|
def result(id)
|
|
26
27
|
{ "principle" => id,
|
|
27
28
|
"brief" => Prompts.text("run-a-first-audit-in-the-background/follow-the-brief",
|
|
28
|
-
id: id,
|
|
29
|
+
id: id, answer_file: ShellWord.new(@invocation.answer_file(id)).to_s,
|
|
29
30
|
index: @invocation.in_project("start-audit", id, options: ["--part", "index"]),
|
|
30
31
|
template: @invocation.in_project("start-audit", id, options: ["--as", "template"])),
|
|
31
32
|
"wrote" => [] }
|
|
@@ -6,7 +6,8 @@ require_relative "invocation"
|
|
|
6
6
|
module Principles
|
|
7
7
|
# What this tool prints, from plain values a controller hands it. views/CLAUDE.md owns the boundary.
|
|
8
8
|
module Views
|
|
9
|
-
# The recorded list and an immediate read-only survey after a guidance-search-path write
|
|
9
|
+
# The recorded list and an immediate read-only survey after a guidance-search-path write: after an addition,
|
|
10
|
+
# of just the files the added glob matches, since the rest were surveyed before it.
|
|
10
11
|
class GuidanceSearchPathsResult
|
|
11
12
|
#: (Invocation) -> void
|
|
12
13
|
def initialize(invocation)
|
|
@@ -14,12 +15,18 @@ module Principles
|
|
|
14
15
|
freeze
|
|
15
16
|
end
|
|
16
17
|
|
|
17
|
-
#: (status: String, globs: Array[String], wrote: Array[String]) -> Hash[String, untyped]
|
|
18
|
-
def result(status:, globs:, wrote:)
|
|
19
|
-
survey = @invocation.in_project("list-candidate-files")
|
|
18
|
+
#: (status: String, globs: Array[String], wrote: Array[String], added: String?) -> Hash[String, untyped]
|
|
19
|
+
def result(status:, globs:, wrote:, added:)
|
|
20
20
|
{ "status" => status, "recorded_guidance_search_paths" => globs, "wrote" => wrote,
|
|
21
|
-
"next_action" => "Commit changed configuration.\n"
|
|
22
|
-
|
|
21
|
+
"next_action" => "Commit changed configuration.\n#{survey(added)}" }
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
private
|
|
25
|
+
|
|
26
|
+
#: (String?) -> String
|
|
27
|
+
def survey(added)
|
|
28
|
+
survey = @invocation.in_project("list-candidate-files", options: added ? ["--only", added] : [])
|
|
29
|
+
added ? "Survey just the files it matches: #{survey}" : "Survey again using the saved search paths: #{survey}"
|
|
23
30
|
end
|
|
24
31
|
end
|
|
25
32
|
end
|
|
@@ -15,11 +15,13 @@ module Principles
|
|
|
15
15
|
#: String
|
|
16
16
|
attr_reader :project
|
|
17
17
|
|
|
18
|
-
# named says whether each command names the project; without_project leaves it out.
|
|
19
|
-
|
|
20
|
-
|
|
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.
|
|
20
|
+
#: (executable: String, project: String, temp_directory: String, ?named: bool) -> void
|
|
21
|
+
def initialize(executable:, project:, temp_directory:, named: true)
|
|
21
22
|
@executable = executable
|
|
22
23
|
@project = project
|
|
24
|
+
@temp_directory = temp_directory
|
|
23
25
|
@named = named
|
|
24
26
|
freeze
|
|
25
27
|
end
|
|
@@ -27,7 +29,9 @@ module Principles
|
|
|
27
29
|
# The same invocation, its commands leaving out --project, for output that names the project once and whose
|
|
28
30
|
# commands run from there, as list-member-problems --short's stderr does.
|
|
29
31
|
#: () -> Invocation
|
|
30
|
-
def without_project
|
|
32
|
+
def without_project
|
|
33
|
+
Invocation.new(executable: @executable, project: @project, temp_directory: @temp_directory, named: false)
|
|
34
|
+
end
|
|
31
35
|
|
|
32
36
|
# Whether each command names the project.
|
|
33
37
|
#: () -> bool
|
|
@@ -55,6 +59,12 @@ module Principles
|
|
|
55
59
|
in_project("submit-answer", request_id, options: ["--file", file])
|
|
56
60
|
end
|
|
57
61
|
|
|
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"
|
|
67
|
+
|
|
58
68
|
# The same command, its values given as one list, as a refusal's repair command holds them.
|
|
59
69
|
#: (String, Array[String], ?options: Array[String], ?usage: String?) -> String
|
|
60
70
|
def listed_in_project(command, values, options: [], usage: nil)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# typed: strict
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require "json"
|
|
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
|
+
# An object that prints compact on one line inside a result printed a field a line, and reads as the hash it holds
|
|
10
|
+
# everywhere else. An answer guide's example is one: the agent copies it whole into its answer, and printed a field
|
|
11
|
+
# a line and unindented it ran several levels deep, where a key after closing brackets could not be placed.
|
|
12
|
+
class JsonOnOneLine < Hash
|
|
13
|
+
# The object compact, whatever layout the result around it prints in.
|
|
14
|
+
#: (*untyped) -> String
|
|
15
|
+
def to_json(*) = JSON.generate(to_h)
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -17,6 +17,22 @@ module Principles
|
|
|
17
17
|
"ending_at" => "NEW_ENDING_TEXT", "query" => "QUERY",
|
|
18
18
|
"path" => "NEW_PATH" }.freeze #: Hash[String, String]
|
|
19
19
|
|
|
20
|
+
# One move that may repair the member: the locator fields it keeps, by name, and those the agent fills in.
|
|
21
|
+
class Move
|
|
22
|
+
#: Hash[String, String]
|
|
23
|
+
attr_reader :keep
|
|
24
|
+
|
|
25
|
+
#: Array[String]
|
|
26
|
+
attr_reader :fill
|
|
27
|
+
|
|
28
|
+
#: (keep: Hash[String, String], fill: Array[String]) -> void
|
|
29
|
+
def initialize(keep:, fill:)
|
|
30
|
+
@keep = keep
|
|
31
|
+
@fill = fill
|
|
32
|
+
freeze
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
20
36
|
#: (Invocation) -> void
|
|
21
37
|
def initialize(invocation)
|
|
22
38
|
@invocation = invocation
|
|
@@ -25,14 +41,14 @@ module Principles
|
|
|
25
41
|
|
|
26
42
|
# The repairs for member_id of principle id: each of moves, as Models::MemberRepairMoves gives them, the locator
|
|
27
43
|
# fields it keeps and those to fill in, as a copyable move-member, then remove-member.
|
|
28
|
-
#: (String, String, Array[
|
|
44
|
+
#: (String, String, Array[Move]) -> Array[String]
|
|
29
45
|
def commands(id, member_id, moves)
|
|
30
46
|
[*moves.map { move(id, member_id, it) }, @invocation.in_project("remove-member", id, member_id)]
|
|
31
47
|
end
|
|
32
48
|
|
|
33
49
|
# member, as show-principle prints it, with its repairs as repair_with when moves, its moves, are given, as the
|
|
34
50
|
# controller gives them for a member an audit would refuse.
|
|
35
|
-
#: (String, Hash[String, untyped], Array[
|
|
51
|
+
#: (String, Hash[String, untyped], Array[Move]?) -> Hash[String, untyped]
|
|
36
52
|
def beside(id, member, moves)
|
|
37
53
|
return member unless moves
|
|
38
54
|
|
|
@@ -41,10 +57,10 @@ module Principles
|
|
|
41
57
|
|
|
42
58
|
private
|
|
43
59
|
|
|
44
|
-
#: (String, String,
|
|
60
|
+
#: (String, String, Move) -> String
|
|
45
61
|
def move(id, member_id, move)
|
|
46
|
-
kept = move.
|
|
47
|
-
fill = move.
|
|
62
|
+
kept = move.keep.flat_map { |field, value| [FLAGS.fetch(field), value] }
|
|
63
|
+
fill = move.fill
|
|
48
64
|
usage = fill.map { "#{FLAGS.fetch(it)} #{PLACEHOLDERS.fetch(it)}" }.join(" ") unless fill.empty?
|
|
49
65
|
@invocation.in_project("move-member", id, member_id, options: kept, usage: usage)
|
|
50
66
|
end
|
|
@@ -52,16 +52,37 @@ module Principles
|
|
|
52
52
|
Prompts.text("set-principles-up/what-the-passage-presumes", estimated_tokens: estimated_tokens.to_s)
|
|
53
53
|
end
|
|
54
54
|
|
|
55
|
+
# The passage as the agent pastes it: its text, its size in bytes and estimated tokens, which loads in every
|
|
56
|
+
# session that loads the entry file it goes in, and what it presumes of a teammate without principles.
|
|
57
|
+
class Passage
|
|
58
|
+
#: Integer
|
|
59
|
+
attr_reader :estimated_tokens
|
|
60
|
+
|
|
61
|
+
#: (text: String, bytes: Integer, estimated_tokens: Integer, presumes: String) -> void
|
|
62
|
+
def initialize(text:, bytes:, estimated_tokens:, presumes:)
|
|
63
|
+
@text = text
|
|
64
|
+
@bytes = bytes
|
|
65
|
+
@estimated_tokens = estimated_tokens
|
|
66
|
+
@presumes = presumes
|
|
67
|
+
freeze
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
#: () -> Hash[String, untyped]
|
|
71
|
+
def to_h
|
|
72
|
+
{ "text" => @text, "bytes" => @bytes, "estimated_tokens" => @estimated_tokens, "presumes" => @presumes }
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
|
|
55
76
|
# Where the passage can go, as the agent places it from: how this run was started and whether the plugin's
|
|
56
|
-
# session-start hook runs in this session, each root entry file's facts, and the passage
|
|
57
|
-
# and what it presumes of a teammate without principles.
|
|
77
|
+
# session-start hook runs in this session, each root entry file's facts, and the passage.
|
|
58
78
|
class Placement
|
|
59
79
|
#: (runs_from: String, session_start_hook_in_this_session: bool, entry_files: Array[Hash[String, untyped]],
|
|
60
|
-
#| passage:
|
|
80
|
+
#| passage: Passage) -> void
|
|
61
81
|
def initialize(runs_from:, session_start_hook_in_this_session:, entry_files:, passage:)
|
|
62
82
|
@fields = { "runs_from" => runs_from,
|
|
63
83
|
"session_start_hook_in_this_session" => session_start_hook_in_this_session,
|
|
64
|
-
"entry_files" => entry_files, "passage" => passage }.freeze #: Hash[String, untyped]
|
|
84
|
+
"entry_files" => entry_files, "passage" => passage.to_h }.freeze #: Hash[String, untyped]
|
|
85
|
+
@passage = passage
|
|
65
86
|
freeze
|
|
66
87
|
end
|
|
67
88
|
|
|
@@ -70,7 +91,7 @@ module Principles
|
|
|
70
91
|
|
|
71
92
|
# The passage's estimated size, which loads in every session that loads the entry file it goes in.
|
|
72
93
|
#: () -> Integer
|
|
73
|
-
def estimated_tokens = @
|
|
94
|
+
def estimated_tokens = @passage.estimated_tokens
|
|
74
95
|
|
|
75
96
|
# Whether the plugin's hooks report in this session, so its hook entries need no offer.
|
|
76
97
|
#: () -> bool
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# typed: strict
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require_relative "answer_in_a_file"
|
|
5
|
+
require_relative "invocation"
|
|
6
|
+
require_relative "prompts"
|
|
7
|
+
|
|
8
|
+
module Principles
|
|
9
|
+
# What this tool prints, from plain values a controller hands it. views/CLAUDE.md owns the boundary.
|
|
10
|
+
module Views
|
|
11
|
+
# A decision on a principle's open findings between full audits: its request and its result.
|
|
12
|
+
class OpenFindingsDecisionResult
|
|
13
|
+
#: (Invocation) -> void
|
|
14
|
+
def initialize(invocation)
|
|
15
|
+
@invocation = invocation
|
|
16
|
+
freeze
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# The request for a decision on any of findings, the open findings, each with its recorded_at and what
|
|
20
|
+
# list-open-findings says of its write-up, whose template names each finding alone, so one left as printed
|
|
21
|
+
# changes nothing, under fields, each field a decision may give with its meaning, printed at its head.
|
|
22
|
+
#: (request_id: String, principle_id: String, revision: String?, findings: Array[Hash[String, untyped]],
|
|
23
|
+
#| fields: Hash[String, String]) -> Hash[String, untyped]
|
|
24
|
+
def decision_request(request_id:, principle_id:, revision:, findings:, fields:)
|
|
25
|
+
decisions = findings.map { |finding| { "finding_id" => finding["finding_id"] } }
|
|
26
|
+
{ "status" => "agent_judgement_required", "request_id" => request_id, "phase" => "deciding",
|
|
27
|
+
"context" => { "principle_id" => principle_id, "findings" => findings,
|
|
28
|
+
"question" => Prompts.text("decide-open-findings/give-only-what-changed-of-each") },
|
|
29
|
+
"response_template" => { "request_id" => request_id, "basis" => { "revision" => revision },
|
|
30
|
+
"decision_fields" => fields, "decisions" => decisions },
|
|
31
|
+
"answer_with" => @invocation.submit_answer(request_id),
|
|
32
|
+
"next_action" => AnswerInAFile.new(@invocation).open_findings(principle_id, request_id:) }
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# The decisions were accepted, changing the findings changed names, and file holds them; not_found_elsewhere
|
|
36
|
+
# is each other principle's open finding whose write-up cannot be found, as its principle and finding_id (T16).
|
|
37
|
+
#: (principle_id: String, file: String, changed: Array[String], not_found_elsewhere: Array[Hash[String, String]])
|
|
38
|
+
#| -> Hash[String, untyped]
|
|
39
|
+
def decided(principle_id:, file:, changed:, not_found_elsewhere:)
|
|
40
|
+
{ "status" => "open_findings_decided", "principle_id" => principle_id, "changed" => changed,
|
|
41
|
+
"other_write_ups_not_found" => not_found_elsewhere, "files_to_commit" => [file],
|
|
42
|
+
"next_action" => "Commit #{file}. Then check each change as the session-start line will state it: " \
|
|
43
|
+
"#{@invocation.in_project("list-open-findings", principle_id, usage: "--lines")}" \
|
|
44
|
+
"#{elsewhere(not_found_elsewhere.map { it.fetch("principle") }.uniq)}" }
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
private
|
|
48
|
+
|
|
49
|
+
# The request that decides each other principle's open findings, one per line, or nothing when there is none.
|
|
50
|
+
#: (Array[String]) -> String
|
|
51
|
+
def elsewhere(principle_ids)
|
|
52
|
+
return "" if principle_ids.empty?
|
|
53
|
+
|
|
54
|
+
commands = principle_ids.map { |id| "#{@invocation.in_project("start-audit", id, usage: "--open-findings")}\n" }
|
|
55
|
+
"\nWrite-ups of other principles cannot be found either, listed under other_write_ups_not_found. " \
|
|
56
|
+
"Check each, and point it at its write-up with its own request:\n#{commands.join}"
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
require_relative "assessment_request"
|
|
5
5
|
require_relative "context_parts"
|
|
6
6
|
require_relative "invocation"
|
|
7
|
+
require_relative "answer_in_a_file"
|
|
7
8
|
require_relative "shell_word"
|
|
8
9
|
require_relative "trimmed_instructions_note"
|
|
9
10
|
|
|
@@ -21,18 +22,19 @@ module Principles
|
|
|
21
22
|
|
|
22
23
|
# The index of request, with the note naming the instructions it prints only in part, the command that submits
|
|
23
24
|
# its answer and, as the next step, reading each part, where skipping a carried member's is the agent's choice,
|
|
24
|
-
# then the
|
|
25
|
+
# then filling the answer the template part prints bare, which is too large to carry here, keeping each carried
|
|
26
|
+
# entry, in a file the agent edits with its own tool, since escaping prose for a shell took a script.
|
|
25
27
|
#: (Hash[String, untyped], AssessmentRequest) -> Hash[String, untyped]
|
|
26
28
|
def printed(index, request)
|
|
27
|
-
|
|
28
|
-
options: ["--part", ContextParts::TEMPLATE])
|
|
29
|
+
request_id = index.fetch("request_id")
|
|
29
30
|
read = "Run part_command with each part as printed; skipping a member marked carries_forward is fine, " \
|
|
30
31
|
"unless you judge it again. --as template prints the same answer long, with each slot's help. " \
|
|
31
|
-
"Then fill in the answer
|
|
32
|
+
"Then fill in the answer the response_template part prints"
|
|
33
|
+
fill = AnswerInAFile.new(@invocation).assessment(request.principle_id, request_id:)
|
|
32
34
|
listed(index, request.principle_id)
|
|
33
35
|
.merge(TrimmedInstructionsNote.new(request.trimmed_instruction_fields).to_h)
|
|
34
|
-
.merge("answer_with" => @invocation.submit_answer(
|
|
35
|
-
"next_action" => "#{read}, #{carried(request)}
|
|
36
|
+
.merge("answer_with" => @invocation.submit_answer(request_id),
|
|
37
|
+
"next_action" => "#{read}, #{carried(request)}. #{fill}")
|
|
36
38
|
end
|
|
37
39
|
|
|
38
40
|
private
|
|
@@ -25,7 +25,7 @@ module Principles
|
|
|
25
25
|
# an audit would refuse, with its repair_with commands, from the moves repairs gives it.
|
|
26
26
|
# hook_settings_not_read names each project settings file whose hooks this tool could not read.
|
|
27
27
|
# loaded_files lists each file the members load once, with the total of those loading at session start.
|
|
28
|
-
#: (PrintedPrinciple, repairs: Hash[String, Array[
|
|
28
|
+
#: (PrintedPrinciple, repairs: Hash[String, Array[MemberRepairs::Move]],
|
|
29
29
|
#| ?hook_settings_not_read: Array[Hash[String, String]], ?loaded_files: Hash[String, untyped])
|
|
30
30
|
#| -> Hash[String, untyped]
|
|
31
31
|
def shown(principle, repairs:, hook_settings_not_read: [], loaded_files: {})
|
|
@@ -87,7 +87,7 @@ module Principles
|
|
|
87
87
|
end
|
|
88
88
|
|
|
89
89
|
# member, with its repairs when repairs names it.
|
|
90
|
-
#: (String, Hash[String, untyped], Hash[String, Array[
|
|
90
|
+
#: (String, Hash[String, untyped], Hash[String, Array[MemberRepairs::Move]]) -> Hash[String, untyped]
|
|
91
91
|
def repaired(id, member, repairs)
|
|
92
92
|
MemberRepairs.new(@invocation).beside(id, member, repairs[member.fetch("id")])
|
|
93
93
|
end
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# typed: strict
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require_relative "record_waiting_on_an_upgrade"
|
|
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 list-member-problems' result says beside the report the models check, as plain values: the older files
|
|
10
|
+
# left unread, by principle the files to commit so its members with no baseline gain one, and those an audit of
|
|
11
|
+
# it refuses until they are committed, by the principles that acknowledge them together the changed members a
|
|
12
|
+
# one-member audit may judge, and each principle whose record a later copy wrote, whose members are not checked.
|
|
13
|
+
class ProblemFacts
|
|
14
|
+
#: Array[String]
|
|
15
|
+
attr_reader :not_read
|
|
16
|
+
|
|
17
|
+
#: Hash[String, Array[String]]
|
|
18
|
+
attr_reader :no_baseline_files
|
|
19
|
+
|
|
20
|
+
#: Hash[String, Array[String]]
|
|
21
|
+
attr_reader :audit_files
|
|
22
|
+
|
|
23
|
+
#: Hash[Array[String], Array[String]]
|
|
24
|
+
attr_reader :acknowledgeable
|
|
25
|
+
|
|
26
|
+
#: Array[RecordWaitingOnAnUpgrade]
|
|
27
|
+
attr_reader :waiting
|
|
28
|
+
|
|
29
|
+
#: (?not_read: Array[String], ?no_baseline_files: Hash[String, Array[String]],
|
|
30
|
+
#| ?audit_files: Hash[String, Array[String]], ?acknowledgeable: Hash[Array[String], Array[String]],
|
|
31
|
+
#| ?waiting: Array[RecordWaitingOnAnUpgrade]) -> void
|
|
32
|
+
def initialize(not_read: [], no_baseline_files: {}, audit_files: {}, acknowledgeable: {}, waiting: [])
|
|
33
|
+
@not_read = not_read
|
|
34
|
+
@no_baseline_files = no_baseline_files
|
|
35
|
+
@audit_files = audit_files
|
|
36
|
+
@acknowledgeable = acknowledgeable
|
|
37
|
+
@waiting = waiting
|
|
38
|
+
freeze
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# The principles waiting on an upgrade, by id.
|
|
42
|
+
#: () -> Array[String]
|
|
43
|
+
def waits = @waiting.map(&:principle)
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
@@ -52,12 +52,17 @@ module Principles
|
|
|
52
52
|
status: short.status)
|
|
53
53
|
end
|
|
54
54
|
|
|
55
|
-
# at_session_start's stdout
|
|
55
|
+
# at_session_start's stdout: for one principle with changed audited members, a line saying how many, why that
|
|
56
56
|
# matters, to act before the user's task, and the command whose output offers acknowledging them or auditing
|
|
57
|
-
# again
|
|
57
|
+
# again; for several, one line counting them, whose command lists each, so the line does not grow with their
|
|
58
|
+
# count. Its command leaves out --project, as the hook's own commands do, since a session runs in its project.
|
|
58
59
|
#: (changed: Hash[String, Integer]) -> Array[String]
|
|
59
60
|
def session_start_lines(changed:)
|
|
60
|
-
changed.map { |id, count| changed_line(id, count) }
|
|
61
|
+
return changed.map { |id, count| changed_line(id, count) } if changed.size <= 1
|
|
62
|
+
|
|
63
|
+
[Prompts.text("start-a-session/act-on-the-changed-principles",
|
|
64
|
+
count: changed.size.to_s,
|
|
65
|
+
command: @invocation.without_project.in_project("list-member-problems", options: ["--short"]))]
|
|
61
66
|
end
|
|
62
67
|
|
|
63
68
|
private
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
# typed: strict
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
|
+
require_relative "../prose_list"
|
|
4
5
|
require_relative "invocation"
|
|
5
6
|
require_relative "members_with_no_baseline"
|
|
6
7
|
require_relative "maps_needing_members_or_audit"
|
|
7
8
|
require_relative "principles_with_no_completed_audit"
|
|
9
|
+
require_relative "problem_facts"
|
|
8
10
|
require_relative "record_waiting_on_an_upgrade"
|
|
9
11
|
|
|
10
12
|
module Principles
|
|
@@ -28,32 +30,35 @@ module Principles
|
|
|
28
30
|
freeze
|
|
29
31
|
end
|
|
30
32
|
|
|
31
|
-
# report holds "members", the changed members, and "counts";
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
# waiting names each principle whose record a later copy wrote, whose members are not checked.
|
|
36
|
-
#: (Hash[String, untyped], ?not_read: Array[String], ?no_baseline_files: Hash[String, Array[String]],
|
|
37
|
-
#| ?acknowledgeable: Hash[Array[String], Array[String]], ?waiting: Array[RecordWaitingOnAnUpgrade])
|
|
38
|
-
#| -> Hash[String, untyped]
|
|
39
|
-
def checked(report, not_read: [], no_baseline_files: {}, acknowledgeable: {}, waiting: [])
|
|
40
|
-
checked_naming_commands(report, not_read:, no_baseline_files:, acknowledgeable:, waiting:).first
|
|
33
|
+
# report holds "members", the changed members, and "counts"; facts what the result says beside it.
|
|
34
|
+
#: (Hash[String, untyped], ?ProblemFacts) -> Hash[String, untyped]
|
|
35
|
+
def checked(report, facts = ProblemFacts.new)
|
|
36
|
+
checked_naming_commands(report, facts).first
|
|
41
37
|
end
|
|
42
38
|
|
|
43
39
|
# The same result, and whether its next_action names a command, before which --short names the project once,
|
|
44
40
|
# so no view reads the action's text to find one.
|
|
45
|
-
#: (Hash[String, untyped], ?
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
unless not_read.empty?
|
|
50
|
-
report = report.merge("not_read" => not_read.map { |file| { "file" => file, "because" => OLDER_STATE } })
|
|
41
|
+
#: (Hash[String, untyped], ?ProblemFacts) -> [Hash[String, untyped], bool]
|
|
42
|
+
def checked_naming_commands(report, facts = ProblemFacts.new)
|
|
43
|
+
unless facts.not_read.empty?
|
|
44
|
+
report = report.merge("not_read" => facts.not_read.map { { "file" => it, "because" => OLDER_STATE } })
|
|
51
45
|
end
|
|
52
|
-
report = report.merge("records_waiting_on_an_upgrade" => waiting.map(&:to_h)) unless waiting.empty?
|
|
53
|
-
action, commands = next_action(report,
|
|
46
|
+
report = report.merge("records_waiting_on_an_upgrade" => facts.waiting.map(&:to_h)) unless facts.waiting.empty?
|
|
47
|
+
action, commands = next_action(report, facts)
|
|
54
48
|
[report.merge("next_action" => action), commands]
|
|
55
49
|
end
|
|
56
50
|
|
|
51
|
+
# report, with each member's history leaving out its commits unless history, which an agent asks for with
|
|
52
|
+
# --history: the rest says what changed and what clears it.
|
|
53
|
+
#: (Hash[String, untyped], history: bool) -> Hash[String, untyped]
|
|
54
|
+
def listed(report, history:)
|
|
55
|
+
return report if history || !report.key?("members")
|
|
56
|
+
|
|
57
|
+
report.merge("members" => report.fetch("members").map do |member|
|
|
58
|
+
member.key?("history") ? member.merge("history" => member.fetch("history").except("commits")) : member
|
|
59
|
+
end)
|
|
60
|
+
end
|
|
61
|
+
|
|
57
62
|
# For each principle with members no baseline holds, what gives them one: outside git a completed audit,
|
|
58
63
|
# and in git committing the files no_baseline_files names.
|
|
59
64
|
#: (Hash[String, untyped], Hash[String, Array[String]]) -> Array[MembersWithNoBaseline]
|
|
@@ -67,23 +72,40 @@ module Principles
|
|
|
67
72
|
|
|
68
73
|
private
|
|
69
74
|
|
|
70
|
-
# What to do next for report, each kind of action on lines of its own, or NOTHING_CHANGED when
|
|
71
|
-
# and whether it names a command: every changed, unaudited and mapping action does, a no-baseline
|
|
72
|
-
# says, and neither the mapping notice nor a waiting principle's update sentence does.
|
|
73
|
-
#: (Hash[String, untyped],
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
waiting: waits)
|
|
80
|
-
commanding = [changed_action(report, acknowledgeable, waits), unaudited_action(report, waits)].compact
|
|
81
|
-
no_baseline = no_baseline_actions(report, no_baseline_files)
|
|
75
|
+
# What to do next for report, given facts, each kind of action on lines of its own, or NOTHING_CHANGED when
|
|
76
|
+
# none applies, and whether it names a command: every changed, unaudited and mapping action does, a no-baseline
|
|
77
|
+
# one as it says, and neither the mapping notice nor a waiting principle's update sentence does.
|
|
78
|
+
#: (Hash[String, untyped], ProblemFacts) -> [String, bool]
|
|
79
|
+
def next_action(report, facts)
|
|
80
|
+
mapping = MapsNeedingMembersOrAudit.new(@invocation, report: report, files_to_commit: facts.no_baseline_files,
|
|
81
|
+
waiting: facts.waits)
|
|
82
|
+
commanding = commanding_actions(report, facts)
|
|
83
|
+
no_baseline = no_baseline_actions(report, facts.no_baseline_files)
|
|
82
84
|
action = [*commanding, mapping.notice, *no_baseline.map(&:to_s), *mapping.actions,
|
|
83
|
-
*waiting.map(&:to_s)].compact.join("\n")
|
|
85
|
+
*facts.waiting.map(&:to_s)].compact.join("\n")
|
|
84
86
|
[action.empty? ? NOTHING_CHANGED : action, names_a_command?(commanding, no_baseline, mapping)]
|
|
85
87
|
end
|
|
86
88
|
|
|
89
|
+
# The actions for report that name a command each, given facts: the audits of changed members, after the
|
|
90
|
+
# files to commit before them, then the audits of members no audit has assessed.
|
|
91
|
+
#: (Hash[String, untyped], ProblemFacts) -> Array[String]
|
|
92
|
+
def commanding_actions(report, facts)
|
|
93
|
+
[commit_first(report, facts), changed_action(report, facts.acknowledgeable, facts.waits),
|
|
94
|
+
unaudited_action(report, facts.waits)].compact
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
# The line asking to commit, before the audits of report's changed members, the files facts names an audit of
|
|
98
|
+
# their principles refusing, but for principles waiting on an upgrade, whose audits wait.
|
|
99
|
+
#: (Hash[String, untyped], ProblemFacts) -> String?
|
|
100
|
+
def commit_first(report, facts)
|
|
101
|
+
audited = report.fetch("members").map { it.fetch("principle") }
|
|
102
|
+
files = facts.audit_files.slice(*audited).except(*facts.waits).values.flatten.uniq
|
|
103
|
+
return if files.empty?
|
|
104
|
+
|
|
105
|
+
"Commit #{ProseList.new(files)} first: an audit judges committed text, and start-audit refuses a file " \
|
|
106
|
+
"that differs from the last commit."
|
|
107
|
+
end
|
|
108
|
+
|
|
87
109
|
# Whether any of the actions that may name a command does.
|
|
88
110
|
#: (Array[String], Array[MembersWithNoBaseline], MapsNeedingMembersOrAudit) -> bool
|
|
89
111
|
def names_a_command?(commanding, no_baseline, mapping)
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
Save the answer alone in a file outside the project, at this full path, the same from every shell: %{save}
|
|
2
|
+
|
|
3
|
+
Fill %{what} with your own file-edit tool, not a shell heredoc; JSON escapes only a double quote, a backslash and a line
|
|
4
|
+
break, as \", \\ and \n, never an apostrophe.
|
|
5
|
+
|
|
6
|
+
Submit that file: %{answer_with}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
`part_bytes` sizes each part below; print one alone with `--part NAME`, or list them with whether this audit judges
|
|
2
|
+
each member and how to answer: %{index}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
Each open finding in `findings` is as list-open-findings prints it. For each finding you decide, add to its entry in
|
|
2
|
+
`decisions` only the fields that change, as the template's `decision_fields` names them, each with a one-line
|
|
3
|
+
`reason`. A field left out keeps its value, so an entry left as printed changes nothing. Closing a finding as resolved
|
|
4
|
+
or withdrawn judges the problem against the text now, which is a full audit's work: record an owner's ruling that there
|
|
5
|
+
is no problem as `accepted`, with that reason, for the next full audit to withdraw. That audit sees each change under
|
|
6
|
+
`changed_since_audit`. Do not edit the audit record by hand: nothing would check the change.
|