principles 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +132 -0
- data/README.md +10 -6
- data/lib/principles/command_line.rb +15 -6
- data/lib/principles/command_routes.rb +11 -1
- data/lib/principles/controllers/acknowledgement.rb +19 -4
- data/lib/principles/controllers/acknowledgements.rb +43 -12
- data/lib/principles/controllers/after_commit_report.rb +15 -2
- data/lib/principles/controllers/assessment.rb +7 -3
- data/lib/principles/controllers/audit.rb +17 -8
- data/lib/principles/controllers/audit_completion.rb +34 -9
- data/lib/principles/controllers/carrier_practices.rb +26 -0
- data/lib/principles/controllers/command.rb +31 -3
- data/lib/principles/controllers/correction.rb +15 -5
- data/lib/principles/controllers/full_audit_request.rb +38 -42
- data/lib/principles/controllers/inventory.rb +77 -71
- data/lib/principles/controllers/last_record_notice_beside.rb +51 -0
- data/lib/principles/controllers/member_acknowledgement.rb +21 -11
- data/lib/principles/controllers/member_addition.rb +19 -4
- data/lib/principles/controllers/member_entries.rb +25 -6
- data/lib/principles/controllers/member_problems_report.rb +26 -6
- data/lib/principles/controllers/members_a_commit_changed.rb +14 -5
- data/lib/principles/controllers/members_in_logged_requests.rb +52 -0
- data/lib/principles/controllers/members_to_assess.rb +24 -7
- data/lib/principles/controllers/meta_principle_setup.rb +2 -2
- data/lib/principles/controllers/open_correction.rb +3 -2
- data/lib/principles/controllers/parts_to_read.rb +46 -5
- data/lib/principles/controllers/plugin_member_addition.rb +48 -0
- data/lib/principles/controllers/principle_listing.rb +84 -0
- data/lib/principles/controllers/request_logging.rb +52 -0
- data/lib/principles/controllers/running_tool.rb +45 -17
- data/lib/principles/data/branches_bringing_in.rb +52 -0
- data/lib/principles/data/changes_since.rb +56 -0
- data/lib/principles/data/claude_code_home.rb +58 -0
- data/lib/principles/data/command-steps.json +91 -15
- data/lib/principles/data/decoded_leaf.rb +63 -0
- data/lib/principles/data/head_reflog.rb +13 -2
- data/lib/principles/data/kept_line.rb +32 -0
- data/lib/principles/data/known_marketplaces.rb +50 -0
- data/lib/principles/data/logged_request_matches.rb +138 -0
- data/lib/principles/data/logged_request_scan.rb +120 -0
- data/lib/principles/data/map_files.rb +18 -4
- data/lib/principles/data/plugin_folder.rb +85 -0
- data/lib/principles/data/plugin_registry.rb +73 -0
- data/lib/principles/data/principles_store.rb +49 -0
- data/lib/principles/data/ran.rb +25 -0
- data/lib/principles/data/raw_request_filter.rb +61 -0
- data/lib/principles/data/repository.rb +34 -27
- data/lib/principles/data/request_logging_folder.rb +167 -0
- data/lib/principles/data/running_version.rb +1 -1
- data/lib/principles/data/schemas/acknowledgement-answer.schema.json +16 -1
- data/lib/principles/data/schemas/acknowledgements-answer.schema.json +16 -1
- data/lib/principles/data/schemas/assessment-answer.schema.json +8 -0
- data/lib/principles/data/schemas/command-steps.schema.json +1 -1
- data/lib/principles/data/schemas/correction-answer-guide.schema.json +2 -1
- data/lib/principles/data/schemas/correction-answer.schema.json +14 -0
- data/lib/principles/data/schemas/member-map.schema.json +10 -1
- data/lib/principles/data/string_counts.rb +39 -0
- data/lib/principles/data/tools_on_path.rb +25 -0
- data/lib/principles/invocation_options.rb +4 -2
- data/lib/principles/launch.rb +14 -4
- data/lib/principles/models/acknowledged_check.rb +11 -1
- data/lib/principles/models/acknowledgement.rb +15 -0
- data/lib/principles/models/acknowledgement_placeholders.rb +43 -18
- data/lib/principles/models/acknowledgement_refusal.rb +20 -11
- data/lib/principles/models/acknowledgements_to_offer.rb +86 -0
- data/lib/principles/models/after_commit_input.rb +5 -0
- data/lib/principles/models/answer_fields.rb +3 -0
- data/lib/principles/models/assessment_basis.rb +10 -3
- data/lib/principles/models/audit.rb +10 -10
- data/lib/principles/models/audit_record.rb +10 -0
- data/lib/principles/models/audit_records.rb +4 -3
- data/lib/principles/models/audit_start.rb +9 -0
- data/lib/principles/models/authored_locator.rb +33 -0
- data/lib/principles/models/candidate_files.rb +23 -3
- data/lib/principles/models/candidate_outline.rb +18 -125
- data/lib/principles/models/captured_sessions.rb +128 -0
- data/lib/principles/models/carrier_kind.rb +79 -0
- data/lib/principles/models/cited_files.rb +12 -3
- data/lib/principles/models/decided_prior_findings.rb +5 -0
- data/lib/principles/models/disposition.rb +38 -7
- data/lib/principles/models/disposition_placeholders.rb +27 -7
- data/lib/principles/models/disposition_text_field.rb +4 -0
- data/lib/principles/models/feature.rb +53 -0
- data/lib/principles/models/finding_outcomes.rb +55 -0
- data/lib/principles/models/findings_left_open.rb +9 -11
- data/lib/principles/models/head_moves.rb +27 -10
- data/lib/principles/models/installed_component.rb +55 -0
- data/lib/principles/models/installed_plugins.rb +174 -0
- data/lib/principles/models/kept_sessions.rb +34 -0
- data/lib/principles/models/locator.rb +8 -0
- data/lib/principles/models/logged_request_reach.rb +44 -0
- data/lib/principles/models/logged_request_scan_completeness.rb +43 -0
- data/lib/principles/models/mapped_baseline.rb +46 -0
- data/lib/principles/models/maps_holding_file_whole.rb +42 -0
- data/lib/principles/models/markdown_text.rb +143 -0
- data/lib/principles/models/member.rb +14 -1
- data/lib/principles/models/member_entry.rb +56 -0
- data/lib/principles/models/member_lines.rb +11 -0
- data/lib/principles/models/member_loads.rb +17 -2
- data/lib/principles/models/member_problems.rb +45 -42
- data/lib/principles/models/member_reach.rb +36 -0
- data/lib/principles/models/member_snapshots.rb +23 -4
- data/lib/principles/models/member_text_as_sent.rb +31 -0
- data/lib/principles/models/member_texts.rb +45 -0
- data/lib/principles/models/members_in_logged_requests.rb +240 -0
- data/lib/principles/models/missing_files.rb +41 -16
- data/lib/principles/models/named_placeholder.rb +17 -7
- data/lib/principles/models/nearly_matching_maps.rb +56 -0
- data/lib/principles/models/open_correction.rb +5 -0
- data/lib/principles/models/open_finding.rb +4 -3
- data/lib/principles/models/outline_budget.rb +10 -1
- data/lib/principles/models/outline_item.rb +25 -0
- data/lib/principles/models/outline_section.rb +15 -4
- data/lib/principles/models/part_named.rb +16 -2
- data/lib/principles/models/plugin_component.rb +37 -0
- data/lib/principles/models/plugin_install.rb +33 -0
- data/lib/principles/models/plugin_name.rb +23 -0
- data/lib/principles/models/plugin_reference.rb +53 -0
- data/lib/principles/models/principle_members.rb +15 -0
- data/lib/principles/models/prior_finding_decision.rb +1 -1
- data/lib/principles/models/prior_finding_outcomes.rb +12 -1
- data/lib/principles/models/problem_report.rb +14 -25
- data/lib/principles/models/project.rb +35 -29
- data/lib/principles/models/project_history.rb +23 -0
- data/lib/principles/models/recorded_members.rb +7 -0
- data/lib/principles/models/request_logging.rb +196 -0
- data/lib/principles/models/runs_from.rb +0 -5
- data/lib/principles/models/script_comments.rb +58 -0
- data/lib/principles/models/stale_request.rb +9 -0
- data/lib/principles/models/template_placeholders.rb +10 -9
- data/lib/principles/models/unfixed_part.rb +82 -0
- data/lib/principles/models/unresolved_plugin_members.rb +35 -0
- data/lib/principles/models/whole_file_member_read.rb +48 -0
- data/lib/principles/models/without_prose.rb +20 -0
- data/lib/principles/models/workflow_jobs.rb +92 -0
- data/lib/principles/show_members_in_logged_requests_options.rb +27 -0
- data/lib/principles/show_principle_options.rb +32 -0
- data/lib/principles/version.rb +2 -2
- data/lib/principles/views/acknowledged_result.rb +31 -12
- data/lib/principles/views/acknowledgement_result.rb +41 -29
- data/lib/principles/views/acknowledgement_template_alone.rb +55 -0
- data/lib/principles/views/acknowledgements_offered.rb +54 -0
- data/lib/principles/views/added_member.rb +22 -6
- data/lib/principles/views/answer_in_a_file.rb +16 -16
- data/lib/principles/views/assessed_members.rb +18 -7
- data/lib/principles/views/assessment_request.rb +8 -3
- data/lib/principles/views/audit_changes.rb +14 -8
- data/lib/principles/views/audit_findings.rb +34 -0
- data/lib/principles/views/audit_result.rb +14 -19
- data/lib/principles/views/carrier_checks.rb +40 -0
- data/lib/principles/views/carrier_practices_page.rb +49 -0
- data/lib/principles/views/completed_audit_findings.rb +33 -0
- data/lib/principles/views/completed_audit_next_step.rb +12 -4
- data/lib/principles/views/consecutive_sections_elsewhere.rb +4 -0
- data/lib/principles/views/context_parts.rb +129 -25
- data/lib/principles/views/correction_request.rb +22 -17
- data/lib/principles/views/disposition_template.rb +35 -0
- data/lib/principles/views/first_audit.rb +29 -15
- data/lib/principles/views/first_audit_brief.rb +0 -1
- data/lib/principles/views/first_audit_line.rb +4 -5
- data/lib/principles/views/invocation.rb +16 -6
- data/lib/principles/views/last_record_notice.rb +41 -0
- data/lib/principles/views/lines_shared_with_member.rb +16 -22
- data/lib/principles/views/logged_request_status_meanings.rb +29 -0
- data/lib/principles/views/logged_requests_evidence.rb +69 -0
- data/lib/principles/views/map_added_to.rb +14 -12
- data/lib/principles/views/map_result.rb +39 -17
- data/lib/principles/views/member_change_since_baseline.rb +4 -0
- data/lib/principles/views/member_row.rb +13 -4
- data/lib/principles/views/member_sets_overlap.rb +31 -0
- data/lib/principles/views/members_a_commit_changed.rb +42 -25
- data/lib/principles/views/members_changed_during_audit.rb +27 -0
- data/lib/principles/views/members_in_logged_requests_result.rb +68 -0
- data/lib/principles/views/members_too_short_to_scan.rb +45 -0
- data/lib/principles/views/members_with_no_baseline.rb +6 -6
- data/lib/principles/views/meta_principle_result.rb +14 -2
- data/lib/principles/views/open_findings_line.rb +31 -92
- data/lib/principles/views/parts_index_result.rb +9 -5
- data/lib/principles/views/principle_read_result.rb +52 -11
- data/lib/principles/views/prior_findings_result.rb +9 -1
- data/lib/principles/views/problem_facts.rb +5 -3
- data/lib/principles/views/problem_lines.rb +32 -6
- data/lib/principles/views/problem_result.rb +7 -15
- data/lib/principles/views/prompts/answer-any-judgement-request/fill-the-answer-in-a-file.md +1 -1
- data/lib/principles/views/prompts/assess-every-member/claim-an-earlier-first-raised-at.md +6 -6
- data/lib/principles/views/prompts/assess-every-member/read-a-compact-carried-member.md +9 -8
- data/lib/principles/views/prompts/assess-every-member/read-a-flagged-member-s-text-whole.md +3 -0
- data/lib/principles/views/prompts/assess-every-member/read-a-judged-member-s-text-whole.md +3 -0
- data/lib/principles/views/prompts/assess-every-member/turn-on-request-logging-to-see-what-reaches-context.md +2 -0
- data/lib/principles/views/prompts/assess-every-member/weigh-what-reached-the-context.md +7 -0
- data/lib/principles/views/prompts/dispose-of-each-finding/answer-guide.json +1 -0
- data/lib/principles/views/prompts/dispose-of-each-finding/fix-or-record-each-finding.md +5 -0
- data/lib/principles/views/prompts/dispose-of-each-finding/retain-assessment-and-correction.md +1 -1
- data/lib/principles/views/prompts/find-a-principle-to-map/read-a-cut-section-back.md +1 -1
- data/lib/principles/views/prompts/follow-each-carriers-best-practices/practices-for-hook-configuration.md +41 -0
- data/lib/principles/views/prompts/follow-each-carriers-best-practices/practices-for-hook-scripts.md +35 -0
- data/lib/principles/views/prompts/follow-each-carriers-best-practices/practices-for-instruction-files.md +37 -0
- data/lib/principles/views/prompts/follow-each-carriers-best-practices/practices-for-other-text-an-agent-reads.md +38 -0
- data/lib/principles/views/prompts/follow-each-carriers-best-practices/practices-for-rule-files.md +34 -0
- data/lib/principles/views/prompts/follow-each-carriers-best-practices/practices-for-skills.md +35 -0
- data/lib/principles/views/prompts/follow-each-carriers-best-practices/practices-for-subagent-definitions.md +35 -0
- data/lib/principles/views/prompts/learn-what-a-command-does/add-member.md +50 -51
- data/lib/principles/views/prompts/learn-what-a-command-does/change-member-role.md +2 -1
- data/lib/principles/views/prompts/learn-what-a-command-does/list-candidate-files.md +1 -1
- data/lib/principles/views/prompts/learn-what-a-command-does/list-member-problems.md +32 -32
- data/lib/principles/views/prompts/learn-what-a-command-does/list-open-findings.md +10 -11
- data/lib/principles/views/prompts/learn-what-a-command-does/move-member.md +7 -6
- data/lib/principles/views/prompts/learn-what-a-command-does/remove-logged-requests.md +16 -0
- data/lib/principles/views/prompts/learn-what-a-command-does/remove-member.md +2 -1
- data/lib/principles/views/prompts/learn-what-a-command-does/report-at-session-start.md +2 -2
- data/lib/principles/views/prompts/learn-what-a-command-does/show-answer-check.md +3 -3
- data/lib/principles/views/prompts/learn-what-a-command-does/show-audit.md +7 -0
- data/lib/principles/views/prompts/learn-what-a-command-does/show-candidate-outlines.md +8 -2
- data/lib/principles/views/prompts/learn-what-a-command-does/show-carrier-practices.md +13 -0
- data/lib/principles/views/prompts/learn-what-a-command-does/show-logged-requests.md +20 -0
- data/lib/principles/views/prompts/learn-what-a-command-does/show-members-in-logged-requests.md +48 -0
- data/lib/principles/views/prompts/learn-what-a-command-does/show-open-correction.md +1 -1
- data/lib/principles/views/prompts/learn-what-a-command-does/show-principle.md +14 -14
- data/lib/principles/views/prompts/learn-what-a-command-does/start-audit.md +27 -27
- data/lib/principles/views/prompts/learn-what-a-command-does/submit-answer.md +11 -11
- data/lib/principles/views/prompts/learn-what-a-command-does/turn-off-request-logging.md +10 -0
- data/lib/principles/views/prompts/learn-what-a-command-does/turn-on-request-logging.md +32 -0
- data/lib/principles/views/prompts/read-requested-outlines/continue-the-survey.md +3 -2
- data/lib/principles/views/prompts/read-what-reached-the-context/explain-request-logging-to-the-user.md +11 -0
- data/lib/principles/views/prompts/read-what-reached-the-context/see-whether-members-reach-the-agent.md +2 -0
- data/lib/principles/views/prompts/read-what-reached-the-context/what-absent-means.md +2 -0
- data/lib/principles/views/prompts/read-what-reached-the-context/what-not-a-carrier-means.md +2 -0
- data/lib/principles/views/prompts/read-what-reached-the-context/what-present-but-not-loaded-means.md +2 -0
- data/lib/principles/views/prompts/read-what-reached-the-context/what-present-means.md +1 -0
- data/lib/principles/views/prompts/read-what-reached-the-context/what-unmeasurable-means.md +2 -0
- data/lib/principles/views/prompts/report-after-a-commit/plugin-members-are-still-listed.md +1 -0
- data/lib/principles/views/prompts/report-after-a-commit/the-commits-changed-these-members-waiting-on-an-upgrade.md +2 -2
- data/lib/principles/views/prompts/report-after-a-commit/the-commits-changed-these-members.md +2 -2
- data/lib/principles/views/prompts/report-after-a-commit/this-command-shows-what-each-needs-before-the-next-commit.md +1 -0
- data/lib/principles/views/prompts/run-a-first-audit-in-the-background/follow-the-brief.md +1 -1
- data/lib/principles/views/prompts/set-principles-up/entry-file-passage.md +1 -1
- data/lib/principles/views/prompts/start-a-session/act-on-the-open-findings.md +2 -1
- data/lib/principles/views/prompts/start-a-session/hand-the-first-audit-to-a-subagent.md +2 -3
- data/lib/principles/views/prompts/start-a-session/raise-the-open-findings-waiting-on-no-one.md +1 -0
- data/lib/principles/views/request_logging_result.rb +62 -0
- data/lib/principles/views/request_part.rb +10 -4
- data/lib/principles/views/request_parts.rb +9 -0
- data/lib/principles/views/whole_file_elsewhere.rb +30 -0
- metadata +101 -4
- data/lib/principles/views/prompts/report-after-a-commit/the-principles-skill-is-where-to-start.md +0 -1
- data/lib/principles/views/prompts/report-after-a-commit/this-command-shows-each-one.md +0 -1
|
@@ -11,7 +11,7 @@ module Principles
|
|
|
11
11
|
module Views
|
|
12
12
|
# A one-member audit's request and its result.
|
|
13
13
|
class AcknowledgementResult
|
|
14
|
-
# Where a placeholder names the
|
|
14
|
+
# Where a placeholder names the entry it prints in, by its position in the template's members, 1 the first.
|
|
15
15
|
SLOT = "%<id>s" #: String
|
|
16
16
|
|
|
17
17
|
#: (Invocation) -> void
|
|
@@ -24,15 +24,17 @@ module Principles
|
|
|
24
24
|
# what the request's context shows beside it, such as the record's findings on the member; and under
|
|
25
25
|
# :placeholders the text the template prints in each field the agent writes. What the agent judges is under
|
|
26
26
|
# context, the question first, so an agent reading the request's head finds what it is asked before the text.
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
# answer_file is the file its next_action saves the answer in, as in each request below.
|
|
28
|
+
#: (request_id: String, principle_id: String, asked: Hash[Symbol, untyped], answer_file: String)
|
|
29
|
+
#| -> Hash[String, untyped]
|
|
30
|
+
def request(request_id:, principle_id:, asked:, answer_file:)
|
|
29
31
|
{ "status" => "agent_judgement_required", "request_id" => request_id, "phase" => "acknowledgement",
|
|
30
32
|
"context" => { "principle_id" => principle_id,
|
|
31
33
|
"question" => Prompts.text("acknowledge-a-change/say-whether-the-change-keeps-the-meaning"),
|
|
32
34
|
**asked.fetch(:change).to_h, **asked.fetch(:context) },
|
|
33
35
|
"response_template" => answer_to_fill(request_id:, asked:),
|
|
34
36
|
"answer_with" => @invocation.submit_answer(request_id),
|
|
35
|
-
"next_action" => to_fill([principle_id], [asked.fetch(:change).member_id], request_id:) }
|
|
37
|
+
"next_action" => to_fill([principle_id], [asked.fetch(:change).member_id], request_id:, file: answer_file) }
|
|
36
38
|
end
|
|
37
39
|
|
|
38
40
|
# The answer to the request request_id names, to fill: the request prints it as response_template, and
|
|
@@ -43,22 +45,24 @@ module Principles
|
|
|
43
45
|
def answer_to_fill(request_id:, asked:)
|
|
44
46
|
member_id = asked.fetch(:change).member_id
|
|
45
47
|
{ "request_id" => request_id, "basis" => { "member_ids" => [member_id] },
|
|
46
|
-
"members" => { member_id => named(asked.fetch(:placeholders),
|
|
48
|
+
"members" => { member_id => named(asked.fetch(:placeholders), 1) } }
|
|
47
49
|
end
|
|
48
50
|
|
|
49
51
|
# The request for several members' acknowledgements in one answer: each of members holds a member's
|
|
50
52
|
# change, the context its own request shows beside it and the placeholders its template prints, as one member's
|
|
51
53
|
# request holds them, under context.members and the template's members in the order the agent named them. The
|
|
52
54
|
# question leads the context, so an agent reading the request's head finds what it is asked before the members.
|
|
53
|
-
#: (request_id: String, principle_id: String, members: Array[Hash[Symbol, untyped]]
|
|
54
|
-
|
|
55
|
+
#: (request_id: String, principle_id: String, members: Array[Hash[Symbol, untyped]], answer_file: String)
|
|
56
|
+
#| -> Hash[String, untyped]
|
|
57
|
+
def several_request(request_id:, principle_id:, members:, answer_file:)
|
|
55
58
|
{ "status" => "agent_judgement_required", "request_id" => request_id, "phase" => "acknowledgements",
|
|
56
59
|
"context" => { "principle_id" => principle_id,
|
|
57
60
|
"question" => Prompts.text("acknowledge-a-change/say-whether-each-change-keeps-its-meaning"),
|
|
58
61
|
"members" => shown(members) },
|
|
59
62
|
"response_template" => several_to_fill(request_id:, members:),
|
|
60
63
|
"answer_with" => @invocation.submit_answer(request_id),
|
|
61
|
-
"next_action" => to_fill([principle_id], members.map { it.fetch(:change).member_id },
|
|
64
|
+
"next_action" => to_fill([principle_id], members.map { it.fetch(:change).member_id },
|
|
65
|
+
request_id:, file: answer_file) }
|
|
62
66
|
end
|
|
63
67
|
|
|
64
68
|
# The answer to the request for several members request_id names, to fill: its basis names each member, and
|
|
@@ -66,7 +70,7 @@ module Principles
|
|
|
66
70
|
#: (request_id: String, members: Array[Hash[Symbol, untyped]]) -> Hash[String, untyped]
|
|
67
71
|
def several_to_fill(request_id:, members:)
|
|
68
72
|
{ "request_id" => request_id, "basis" => { "member_ids" => members.map { it.fetch(:change).member_id } },
|
|
69
|
-
"members" => members.to_h { named_entry(
|
|
73
|
+
"members" => members.each_with_index.to_h { |asked, index| named_entry(asked, index + 1) } }
|
|
70
74
|
end
|
|
71
75
|
|
|
72
76
|
# The request for the members several principles map in one answer: under context.principles, each
|
|
@@ -74,15 +78,16 @@ module Principles
|
|
|
74
78
|
# judged once for every principle that maps it. keeping_deferred names each principle whose members keep a
|
|
75
79
|
# deferred finding, which the request says only a full audit resolves. The question leads the context, as in
|
|
76
80
|
# one principle's requests.
|
|
77
|
-
#: (request_id: String, principles: Hash[String, Array[Hash[Symbol, untyped]]],
|
|
81
|
+
#: (request_id: String, principles: Hash[String, Array[Hash[Symbol, untyped]]], answer_file: String,
|
|
78
82
|
#| ?keeping_deferred: Array[String]) -> Hash[String, untyped]
|
|
79
|
-
def across_request(request_id:, principles:, keeping_deferred: [])
|
|
83
|
+
def across_request(request_id:, principles:, answer_file:, keeping_deferred: [])
|
|
80
84
|
{ "status" => "agent_judgement_required", "request_id" => request_id, "phase" => "acknowledgements",
|
|
81
85
|
"context" => { "question" => across_question, "principles" => shown_once(principles),
|
|
82
86
|
**deferred_findings_kept(keeping_deferred) },
|
|
83
87
|
"response_template" => across_to_fill(request_id:, principles:),
|
|
84
88
|
"answer_with" => @invocation.submit_answer(request_id),
|
|
85
|
-
"next_action" => to_fill(principles.keys.uniq.sort, across_member_ids(principles),
|
|
89
|
+
"next_action" => to_fill(principles.keys.uniq.sort, across_member_ids(principles),
|
|
90
|
+
request_id:, file: answer_file) }
|
|
86
91
|
end
|
|
87
92
|
|
|
88
93
|
# The answer to the request for the members several principles map, to fill: its basis names each principle and
|
|
@@ -91,33 +96,40 @@ module Principles
|
|
|
91
96
|
# print the same field.
|
|
92
97
|
#: (request_id: String, principles: Hash[String, Array[Hash[Symbol, untyped]]]) -> Hash[String, untyped]
|
|
93
98
|
def across_to_fill(request_id:, principles:)
|
|
94
|
-
entries = principles
|
|
95
|
-
id = asked.fetch(:change).member_id
|
|
96
|
-
by_member[id] = named(asked.fetch(:placeholders), id).merge(by_member.fetch(id, {}))
|
|
97
|
-
end
|
|
99
|
+
entries = across_entries(principles)
|
|
98
100
|
{ "request_id" => request_id, "basis" => { "principle_ids" => principles.keys, "member_ids" => entries.keys },
|
|
99
101
|
"members" => entries }
|
|
100
102
|
end
|
|
101
103
|
|
|
102
104
|
private
|
|
103
105
|
|
|
104
|
-
#
|
|
105
|
-
#
|
|
106
|
-
#: (Hash[String, untyped]
|
|
107
|
-
def
|
|
106
|
+
# One entry per member the principles' requests ask about, by its id, with every field any principle's template
|
|
107
|
+
# prints for it, the first principle's text where two print the same field, its placeholders naming its position.
|
|
108
|
+
#: (Hash[String, Array[Hash[Symbol, untyped]]]) -> Hash[String, Hash[String, untyped]]
|
|
109
|
+
def across_entries(principles)
|
|
110
|
+
ids = across_member_ids(principles)
|
|
111
|
+
principles.values.flatten.each_with_object({}) do |asked, by_member|
|
|
112
|
+
id = asked.fetch(:change).member_id
|
|
113
|
+
by_member[id] = named(asked.fetch(:placeholders), ids.index(id).to_i + 1).merge(by_member.fetch(id, {}))
|
|
114
|
+
end
|
|
115
|
+
end
|
|
108
116
|
|
|
109
|
-
#
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
117
|
+
# placeholders with each one's SLOT naming the entry's position, as its entry in the template prints them; any
|
|
118
|
+
# other text, a percent sign included, as it is.
|
|
119
|
+
#: (Hash[String, untyped], Integer) -> Hash[String, untyped]
|
|
120
|
+
def named(placeholders, position)
|
|
121
|
+
placeholders.transform_values { it.is_a?(String) ? it.gsub(SLOT, position.to_s) : it }
|
|
114
122
|
end
|
|
115
123
|
|
|
124
|
+
# The template's entry for the member asked asks about, by its id, its placeholders naming its position.
|
|
125
|
+
#: (Hash[Symbol, untyped], Integer) -> [String, Hash[String, untyped]]
|
|
126
|
+
def named_entry(asked, position) = [asked.fetch(:change).member_id, named(asked.fetch(:placeholders), position)]
|
|
127
|
+
|
|
116
128
|
# How to fill the answer to request_id, acknowledging member_ids of principle_ids: saved bare from
|
|
117
|
-
# start-audit --as template to
|
|
118
|
-
#: (Array[String], Array[String], request_id: String) -> String
|
|
119
|
-
def to_fill(principle_ids, member_ids, request_id:)
|
|
120
|
-
AnswerInAFile.new(@invocation).acknowledgement(principle_ids, member_ids, request_id:)
|
|
129
|
+
# start-audit --as template to file, which the agent edits.
|
|
130
|
+
#: (Array[String], Array[String], request_id: String, file: String) -> String
|
|
131
|
+
def to_fill(principle_ids, member_ids, request_id:, file:)
|
|
132
|
+
AnswerInAFile.new(@invocation).acknowledgement(principle_ids, member_ids, request_id:, file:)
|
|
121
133
|
end
|
|
122
134
|
|
|
123
135
|
# Each member the principles' requests ask about, once, in the order they ask.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# typed: strict
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require_relative "invocation"
|
|
5
|
+
require_relative "member_change_since_baseline"
|
|
6
|
+
|
|
7
|
+
module Principles
|
|
8
|
+
# What this tool prints, from plain values a controller hands it. views/CLAUDE.md owns the boundary.
|
|
9
|
+
module Views
|
|
10
|
+
# An acknowledgement's answer to fill as start-audit --member --as template prints it alone, where no request
|
|
11
|
+
# stands beside it: the answer its request prints as response_template, with what that request shows beside it
|
|
12
|
+
# for the agent to read, each member's role before its own fields and answer_with, the command that submits the
|
|
13
|
+
# file the request's next_action saves it in. The answer reads neither.
|
|
14
|
+
class AcknowledgementTemplateAlone
|
|
15
|
+
#: (Invocation) -> void
|
|
16
|
+
def initialize(invocation)
|
|
17
|
+
@invocation = invocation
|
|
18
|
+
freeze
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# answer, whose members asked asks about, each as its member's part of the request holds it, with each role,
|
|
22
|
+
# submitted from answer_file, the file the request's next_action saves it in.
|
|
23
|
+
#: (Hash[String, untyped], Array[Hash[Symbol, untyped]], answer_file: String) -> Hash[String, untyped]
|
|
24
|
+
def of(answer, asked, answer_file:)
|
|
25
|
+
changes = asked.map { it.fetch(:change) } #: Array[MemberChangeSinceBaseline]
|
|
26
|
+
printed(answer, changes.to_h { [it.member_id, { "role" => it.role }] }, answer_file)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# answer for the members several principles map, each principles' members as their part of the request holds
|
|
30
|
+
# them: as of gives it, but with each member's roles, by the principle mapping it with each.
|
|
31
|
+
#: (Hash[String, untyped], Hash[String, Array[Hash[Symbol, untyped]]], answer_file: String)
|
|
32
|
+
#| -> Hash[String, untyped]
|
|
33
|
+
def across(answer, principles, answer_file:)
|
|
34
|
+
roles = {} #: Hash[String, Hash[String, String]]
|
|
35
|
+
principles.each do |principle_id, asked|
|
|
36
|
+
asked.each do |member|
|
|
37
|
+
change = member.fetch(:change) #: MemberChangeSinceBaseline
|
|
38
|
+
(roles[change.member_id] ||= {})[principle_id] = change.role
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
printed(answer, roles.transform_values { { "roles" => it } }, answer_file)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
private
|
|
45
|
+
|
|
46
|
+
# answer with each member's read_only fields before its own, and answer_with, submitting answer_file, after them.
|
|
47
|
+
#: (Hash[String, untyped], Hash[String, Hash[String, untyped]], String) -> Hash[String, untyped]
|
|
48
|
+
def printed(answer, read_only, answer_file)
|
|
49
|
+
members = answer.fetch("members").to_h { |id, entry| [id, { **read_only.fetch(id), **entry }] }
|
|
50
|
+
submit = @invocation.submit_answer(answer.fetch("request_id"), file: answer_file)
|
|
51
|
+
{ **answer, "members" => members, "answer_with" => submit }
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# typed: strict
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require_relative "invocation"
|
|
5
|
+
require_relative "problem_lines"
|
|
6
|
+
require_relative "shell_word"
|
|
7
|
+
require_relative "../prose_list"
|
|
8
|
+
|
|
9
|
+
module Principles
|
|
10
|
+
# What this tool prints, from plain values a controller hands it. views/CLAUDE.md owns the boundary.
|
|
11
|
+
module Views
|
|
12
|
+
# The one-member audits list-member-problems offers: by the principles that acknowledge them together, in the
|
|
13
|
+
# order the model gives, the changed members each acknowledgement takes in, one command for each set, and those
|
|
14
|
+
# whose check is this tool's own list-member-problems --short, which the model puts last.
|
|
15
|
+
class AcknowledgementsOffered
|
|
16
|
+
# groups gives, for each set of principle ids, the members they acknowledge together; last, the members whose
|
|
17
|
+
# check is this tool's own --short.
|
|
18
|
+
#: (Hash[Array[String], Array[String]], ?last: Array[String]) -> void
|
|
19
|
+
def initialize(groups, last: [])
|
|
20
|
+
@groups = groups
|
|
21
|
+
@last = last
|
|
22
|
+
freeze
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
NONE = new({}) #: AcknowledgementsOffered
|
|
26
|
+
|
|
27
|
+
# The members an acknowledgement takes in for principle id.
|
|
28
|
+
#: (String) -> Array[String]
|
|
29
|
+
def members_of(id) = @groups.select { |ids, _| ids.include?(id) }.values.flatten
|
|
30
|
+
|
|
31
|
+
# Each acknowledgement's command, filled and shell-quoted so the agent types no id, through invocation; a set
|
|
32
|
+
# holding a member in last after a line asking to acknowledge it last, since its check exits as --short does
|
|
33
|
+
# while it lists a member the answer leaves out.
|
|
34
|
+
#: (Invocation) -> Array[String]
|
|
35
|
+
def lines(invocation)
|
|
36
|
+
@groups.flat_map do |ids, members|
|
|
37
|
+
line = invocation.listed_in_project("start-audit", ids, options: members.flat_map { ["--member", it] })
|
|
38
|
+
own = members & @last
|
|
39
|
+
own.empty? ? [line] : [last_line(own), line]
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
private
|
|
44
|
+
|
|
45
|
+
# The line asking to acknowledge own, members whose check is this tool's own --short, after the others.
|
|
46
|
+
#: (Array[String]) -> String
|
|
47
|
+
def last_line(own)
|
|
48
|
+
"Acknowledge #{ProseList.new(own.map { ShellWord.new(it).to_s })} last: its check, list-member-problems " \
|
|
49
|
+
"--short, exits #{ProblemLines::CHANGED} while it lists a member this acknowledgement leaves out, so first " \
|
|
50
|
+
"acknowledge or audit, and commit, each member listed that it leaves out."
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
@@ -3,16 +3,28 @@
|
|
|
3
3
|
|
|
4
4
|
require_relative "lines_shared_with_member"
|
|
5
5
|
require_relative "consecutive_sections_elsewhere"
|
|
6
|
+
require_relative "whole_file_elsewhere"
|
|
7
|
+
require_relative "member_sets_overlap"
|
|
6
8
|
|
|
7
9
|
module Principles
|
|
8
10
|
module Views
|
|
9
|
-
# The member just added: its id, current lines and check, beside its shared
|
|
11
|
+
# The member just added: its id, current lines and check, beside its shared-line facts and the facts of other
|
|
12
|
+
# maps it asks the agent to judge, each printed only when it has some.
|
|
10
13
|
class AddedMember
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
# What the agent decides when other principles hold the new member's file whole or a nearly matching member set,
|
|
15
|
+
# asked once however many of those cues fire.
|
|
16
|
+
SCOPE_OR_JOIN = "Should each hold only the passages that carry it (move-member with " \
|
|
17
|
+
"--section or --starting-at), or are they one principle (join the maps: add one map's " \
|
|
18
|
+
"members to the other, then remove-principle)? " #: String
|
|
19
|
+
|
|
20
|
+
#: (Hash[String, untyped], shared: LinesSharedWithMember,
|
|
21
|
+
#| other_maps: Array[ConsecutiveSectionsElsewhere | WholeFileElsewhere | MemberSetsOverlap])
|
|
22
|
+
#| -> void
|
|
23
|
+
def initialize(added, shared:, other_maps:)
|
|
24
|
+
facts = other_maps.reduce(added.merge(shared.to_h)) { |merged, each| merged.merge(each.to_h) }
|
|
25
|
+
@added = facts #: Hash[String, untyped]
|
|
14
26
|
@shared = shared
|
|
15
|
-
@
|
|
27
|
+
@other_maps = other_maps
|
|
16
28
|
freeze
|
|
17
29
|
end
|
|
18
30
|
|
|
@@ -25,11 +37,15 @@ module Principles
|
|
|
25
37
|
# The same location/remapping opening precedes the map's own after-add guidance.
|
|
26
38
|
#: () -> String
|
|
27
39
|
def opening
|
|
28
|
-
"#{span}#{@shared.note}#{@
|
|
40
|
+
"#{span}#{@shared.note}#{@other_maps.map(&:note).join}#{SCOPE_OR_JOIN if scope_or_join?}" \
|
|
41
|
+
"Add the next member the same way. "
|
|
29
42
|
end
|
|
30
43
|
|
|
31
44
|
private
|
|
32
45
|
|
|
46
|
+
#: () -> bool
|
|
47
|
+
def scope_or_join? = @other_maps.any?(&:asks_scope_or_join?)
|
|
48
|
+
|
|
33
49
|
# The lines a member spans, said so that a passage cut short shows; it ends with a space.
|
|
34
50
|
#: () -> String
|
|
35
51
|
def span
|
|
@@ -9,7 +9,7 @@ require_relative "shell_word"
|
|
|
9
9
|
module Principles
|
|
10
10
|
# What this tool prints, from plain values a controller hands it. views/CLAUDE.md owns the boundary.
|
|
11
11
|
module Views
|
|
12
|
-
# How to fill an answer this tool prints bare: save it to a file
|
|
12
|
+
# How to fill an answer this tool prints bare: save it to a file kept out of git, named in full, fill it
|
|
13
13
|
# there with the agent's own file-edit tool, and submit that file, with the three characters JSON escapes.
|
|
14
14
|
# Filling a template in a shell heredoc took a script, since prose full of quotes needed escaping for the shell
|
|
15
15
|
# and for JSON.
|
|
@@ -24,16 +24,16 @@ module Principles
|
|
|
24
24
|
#: (String, request_id: String) -> String
|
|
25
25
|
def assessment(principle_id, request_id:)
|
|
26
26
|
line(@invocation.in_project("start-audit", principle_id, options: ["--part", ContextParts::TEMPLATE]),
|
|
27
|
-
request_id:)
|
|
27
|
+
request_id:, file: @invocation.answer_file(principle_id, "assessment"))
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
# The line for acknowledging member_ids of principle_ids, whose answer start-audit --member --as template prints
|
|
31
|
-
# bare.
|
|
32
|
-
#: (Array[String], Array[String], request_id: String) -> String
|
|
33
|
-
def acknowledgement(principle_ids, member_ids, request_id:)
|
|
31
|
+
# bare, to save in file.
|
|
32
|
+
#: (Array[String], Array[String], request_id: String, file: String) -> String
|
|
33
|
+
def acknowledgement(principle_ids, member_ids, request_id:, file:)
|
|
34
34
|
named = member_ids.flat_map { ["--member", it] }
|
|
35
35
|
line(@invocation.listed_in_project("start-audit", principle_ids, options: [*named, "--as", "template"]),
|
|
36
|
-
request_id:)
|
|
36
|
+
request_id:, file:)
|
|
37
37
|
end
|
|
38
38
|
|
|
39
39
|
# The line for a decision on principle_id's open findings, whose answer start-audit --open-findings --as template
|
|
@@ -41,21 +41,21 @@ module Principles
|
|
|
41
41
|
#: (String, request_id: String) -> String
|
|
42
42
|
def open_findings(principle_id, request_id:)
|
|
43
43
|
line(@invocation.in_project("start-audit", principle_id, options: %w[--open-findings --as template]),
|
|
44
|
-
request_id:)
|
|
44
|
+
request_id:, file: @invocation.answer_file(principle_id, "deciding"))
|
|
45
45
|
end
|
|
46
46
|
|
|
47
47
|
# The line for an open correction, whose answer show-open-correction prints bare, of which only the
|
|
48
|
-
# dispositions are the agent's to fill.
|
|
49
|
-
#: (String, request_id: String) -> String
|
|
50
|
-
def correction(principle_id, request_id:)
|
|
51
|
-
line(@invocation.in_project("show-open-correction", principle_id), request_id:,
|
|
48
|
+
# dispositions are the agent's to fill, to save in file.
|
|
49
|
+
#: (String, request_id: String, file: String) -> String
|
|
50
|
+
def correction(principle_id, request_id:, file:)
|
|
51
|
+
line(@invocation.in_project("show-open-correction", principle_id), request_id:, file:,
|
|
52
|
+
what: "only its dispositions")
|
|
52
53
|
end
|
|
53
54
|
|
|
54
|
-
# The line for the answer request_id names, which the printed command save prints bare; what is
|
|
55
|
-
# the agent fills.
|
|
56
|
-
#: (String, request_id: String, ?what: String) -> String
|
|
57
|
-
def line(save, request_id:, what: "it")
|
|
58
|
-
file = @invocation.answer_file(request_id)
|
|
55
|
+
# The line for the answer request_id names, saved in file, which the printed command save prints bare; what is
|
|
56
|
+
# the part of it the agent fills.
|
|
57
|
+
#: (String, request_id: String, file: String, ?what: String) -> String
|
|
58
|
+
def line(save, request_id:, file:, what: "it")
|
|
59
59
|
Prompts.text("answer-any-judgement-request/fill-the-answer-in-a-file",
|
|
60
60
|
save: "#{save} > #{ShellWord.new(file)}", what:,
|
|
61
61
|
answer_with: @invocation.submit_answer(request_id, file:))
|
|
@@ -11,19 +11,23 @@ module Principles
|
|
|
11
11
|
# request shows of each, the template entry each starts with, and what they carry that the request explains.
|
|
12
12
|
class AssessedMembers
|
|
13
13
|
# What the request shows of each member.
|
|
14
|
-
SHOWN = %w[id role first_line last_line check check_since_last_audit check_hidden_characters
|
|
14
|
+
SHOWN = %w[id role first_line last_line source check check_since_last_audit check_hidden_characters
|
|
15
15
|
acknowledged_since_last_audit carried_forward open_finding_ids judge_because moved_from read_the_change
|
|
16
|
-
mapped_elsewhere].freeze #: Array[String]
|
|
16
|
+
changed_lines mapped_elsewhere].freeze #: Array[String]
|
|
17
17
|
|
|
18
18
|
# reviewed_check_placeholders is the text a checked member's template prints in each field it may leave as
|
|
19
19
|
# printed to give none, for a check reviewed before it runs; unchanged_check_placeholders, for one the
|
|
20
20
|
# last audit ran.
|
|
21
21
|
# assessment_placeholder is the text a fresh member's assessment prints, which an answer may not send back, its
|
|
22
22
|
# %<id>s filled with the member's id, so each slot's is its own and one edit fills one slot.
|
|
23
|
+
# carrier_checks is the check for each carrier kind the members are in, as CarrierChecks prints them.
|
|
23
24
|
#: (Array[Hash[String, untyped]], reviewed_check_placeholders: Hash[String, String],
|
|
24
|
-
#| unchanged_check_placeholders: Hash[String, String], assessment_placeholder: String
|
|
25
|
-
|
|
25
|
+
#| unchanged_check_placeholders: Hash[String, String], assessment_placeholder: String,
|
|
26
|
+
#| ?carrier_checks: Hash[String, untyped]) -> void
|
|
27
|
+
def initialize(members, reviewed_check_placeholders:, unchanged_check_placeholders:, assessment_placeholder:,
|
|
28
|
+
carrier_checks: {})
|
|
26
29
|
@assessment_placeholder = assessment_placeholder
|
|
30
|
+
@carrier_checks = carrier_checks
|
|
27
31
|
@members = members
|
|
28
32
|
@reviewed_check_placeholders = reviewed_check_placeholders
|
|
29
33
|
@unchanged_check_placeholders = unchanged_check_placeholders
|
|
@@ -32,7 +36,8 @@ module Principles
|
|
|
32
36
|
|
|
33
37
|
# What the request shows of a carried member no flag fires on: what names it and its check, whose result
|
|
34
38
|
# the template still asks for, and of its carried assessment only its dates and flags.
|
|
35
|
-
COMPACT = %w[id role check check_since_last_audit check_hidden_characters
|
|
39
|
+
COMPACT = %w[id role source check check_since_last_audit check_hidden_characters
|
|
40
|
+
carried_forward].freeze #: Array[String]
|
|
36
41
|
# What a compact member shows of its carried assessment.
|
|
37
42
|
CARRIED_COMPACTLY = %w[assessed_at observed_at observed_at_from_assessed_at evidence_changed
|
|
38
43
|
file_changed_outside_member].freeze #: Array[String]
|
|
@@ -49,6 +54,11 @@ module Principles
|
|
|
49
54
|
end
|
|
50
55
|
end
|
|
51
56
|
|
|
57
|
+
# The check for each carrier kind the members are in, under carrier_checks, which the request prints beside
|
|
58
|
+
# them, outside the question a record digests; nothing when there are none.
|
|
59
|
+
#: () -> Hash[String, Hash[String, untyped]]
|
|
60
|
+
def carrier_checks = @carrier_checks.empty? ? {} : { "carrier_checks" => @carrier_checks }
|
|
61
|
+
|
|
52
62
|
# What the template printed alone says of the checks before its members, since it has no context to show it in:
|
|
53
63
|
# the carried members whose template entry in templates still asks for a check_result, under
|
|
54
64
|
# carried_checks_to_run, named before the members so a reader skipping carried markers still runs each, and how
|
|
@@ -70,7 +80,7 @@ module Principles
|
|
|
70
80
|
|
|
71
81
|
# How to run and report the checks of each standing, once, with the ids of the members it is for, under
|
|
72
82
|
# shared_check_instructions, whose own lines check_instructions adds; nothing when none has a check.
|
|
73
|
-
#: () -> Hash[String,
|
|
83
|
+
#: () -> Hash[String, Hash[String, untyped]]
|
|
74
84
|
def shared_check_instructions
|
|
75
85
|
checks = @members.filter_map { |member| check_template(member)&.then { [member.fetch("id"), it] } }
|
|
76
86
|
return {} if checks.empty?
|
|
@@ -150,10 +160,11 @@ module Principles
|
|
|
150
160
|
#: (Hash[String, untyped]) -> Hash[String, untyped]
|
|
151
161
|
def carried(member) = { "member_id" => member.fetch("id"), "carried_forward" => true }
|
|
152
162
|
|
|
163
|
+
# A fresh member's slot, naming why it is judged afresh, so the template printed alone says so too.
|
|
153
164
|
#: (Hash[String, untyped]) -> Hash[String, untyped]
|
|
154
165
|
def fresh(member)
|
|
155
166
|
id = member.fetch("id")
|
|
156
|
-
{ "member_id" => id, "assessment" => format(@assessment_placeholder, id:),
|
|
167
|
+
{ "member_id" => id, **member.slice("judge_because"), "assessment" => format(@assessment_placeholder, id:),
|
|
157
168
|
"delivery" => "not_observed", "evidence" => member.fetch("evidence") }
|
|
158
169
|
end
|
|
159
170
|
end
|
|
@@ -62,7 +62,8 @@ module Principles
|
|
|
62
62
|
# What the agent assesses, its other parts, the question and a guide to the answer's shapes.
|
|
63
63
|
#: () -> Hash[String, untyped]
|
|
64
64
|
def context
|
|
65
|
-
listed = @principle.merge("members" => @members.shown, **@members.shared_check_instructions
|
|
65
|
+
listed = @principle.merge("members" => @members.shown, **@members.shared_check_instructions,
|
|
66
|
+
**@members.carrier_checks)
|
|
66
67
|
@parts.shown_after(listed).merge(asked)
|
|
67
68
|
end
|
|
68
69
|
|
|
@@ -74,11 +75,15 @@ module Principles
|
|
|
74
75
|
# The parts of the context start-audit --part prints alone, each member's with its lines now, by id, from texts,
|
|
75
76
|
# and each instruction field and the answer to fill as the request prints them; optional names each part the
|
|
76
77
|
# context lists only when it holds something.
|
|
77
|
-
#: (?texts:
|
|
78
|
-
def context_parts(texts: {}, optional: [])
|
|
78
|
+
#: (?texts: ContextParts::MemberTexts, ?optional: Array[String]) -> ContextParts
|
|
79
|
+
def context_parts(texts: ContextParts::MemberTexts.new({}), optional: [])
|
|
79
80
|
ContextParts.new(context, instruction_fields:, template:, texts:, optional:)
|
|
80
81
|
end
|
|
81
82
|
|
|
83
|
+
# Why the index gives no bytes, by the name of each part this read left unfilled.
|
|
84
|
+
#: () -> Hash[String, String]
|
|
85
|
+
def bytes_unknown = @parts.bytes_unknown
|
|
86
|
+
|
|
82
87
|
# The principle the request audits.
|
|
83
88
|
#: () -> String
|
|
84
89
|
def principle_id = @principle.fetch("principle_id")
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
require_relative "audit_commit"
|
|
5
5
|
require_relative "landed_since_base"
|
|
6
|
+
require_relative "members_changed_during_audit"
|
|
6
7
|
require_relative "principle_with_changed_members"
|
|
7
8
|
require_relative "shell_word"
|
|
8
9
|
|
|
@@ -11,15 +12,16 @@ module Principles
|
|
|
11
12
|
module Views
|
|
12
13
|
# What a completed audit changed in the project, as its result prints it: the files to commit, in git what
|
|
13
14
|
# landed since the base commit, as LandedSinceBase prints it, each other principle whose members its fixes changed,
|
|
14
|
-
# each file the record cites that no longer exists, and
|
|
15
|
-
# audit,
|
|
15
|
+
# each file the record cites that no longer exists, and the audited principle's members that changed during the
|
|
16
|
+
# audit, as MembersChangedDuringAudit prints them.
|
|
16
17
|
class AuditChanges
|
|
17
18
|
#: (files_to_commit: Array[String], ?landed: LandedSinceBase?,
|
|
18
19
|
#| ?other_changed: Array[PrincipleWithChangedMembers], ?cited_files_missing: Array[String],
|
|
19
|
-
#| ?
|
|
20
|
-
def initialize(files_to_commit:, landed: nil, other_changed: [], cited_files_missing: [],
|
|
20
|
+
#| ?members_changed: MembersChangedDuringAudit) -> void
|
|
21
|
+
def initialize(files_to_commit:, landed: nil, other_changed: [], cited_files_missing: [],
|
|
22
|
+
members_changed: MembersChangedDuringAudit.new)
|
|
21
23
|
@files_to_commit = files_to_commit
|
|
22
|
-
@
|
|
24
|
+
@members_changed = members_changed
|
|
23
25
|
@landed = landed
|
|
24
26
|
@other_changed = other_changed
|
|
25
27
|
@cited_files_missing = cited_files_missing
|
|
@@ -33,12 +35,16 @@ module Principles
|
|
|
33
35
|
#: Array[PrincipleWithChangedMembers]
|
|
34
36
|
attr_reader :other_changed
|
|
35
37
|
|
|
36
|
-
# The
|
|
37
|
-
|
|
38
|
+
# The audited principle's members that changed during the audit, which the next step asks to audit again.
|
|
39
|
+
#: MembersChangedDuringAudit
|
|
40
|
+
attr_reader :members_changed
|
|
41
|
+
|
|
42
|
+
# The fields as printed; the members changed during the audit and the cited files missing, what landed since
|
|
43
|
+
# the base only in git, where it is given, and the other principles, each only when there are some.
|
|
38
44
|
#: () -> Hash[String, untyped]
|
|
39
45
|
def to_h
|
|
40
46
|
printed = { "files_to_commit" => @files_to_commit } #: Hash[String, untyped]
|
|
41
|
-
printed = printed.merge(
|
|
47
|
+
printed = printed.merge(@members_changed.to_h)
|
|
42
48
|
printed = printed.merge("cited_files_missing" => @cited_files_missing) unless @cited_files_missing.empty?
|
|
43
49
|
printed = printed.merge(@landed.to_h) if @landed
|
|
44
50
|
others = @other_changed.map(&:to_h)
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# typed: strict
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
module Principles
|
|
5
|
+
# What this tool prints, from plain values a controller hands it. views/CLAUDE.md owns the boundary.
|
|
6
|
+
module Views
|
|
7
|
+
# show-audit --findings: only the findings of an audit record, and of the last completed record an open one
|
|
8
|
+
# keeps, each placed by its status, base_commit and audited_at, for an agent that needs what the last audit found
|
|
9
|
+
# without every member it judged.
|
|
10
|
+
class AuditFindings
|
|
11
|
+
# record is the record as show-audit prints it whole; kept, the last completed record an open one keeps, as
|
|
12
|
+
# printed whole, or nil.
|
|
13
|
+
#: (Hash[String, untyped], Hash[String, untyped]?) -> void
|
|
14
|
+
def initialize(record, kept)
|
|
15
|
+
@record = record
|
|
16
|
+
@kept = kept
|
|
17
|
+
freeze
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
#: () -> Hash[String, untyped]
|
|
21
|
+
def to_h
|
|
22
|
+
shown = { "principle_id" => @record.fetch("principle_id"), **placing(@record) }
|
|
23
|
+
@kept ? shown.merge("last_completed" => placing(@kept)) : shown
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
private
|
|
27
|
+
|
|
28
|
+
# record's findings, with its status, the commit it began from, whose text its evidence was read in, and
|
|
29
|
+
# audited_at, which place them.
|
|
30
|
+
#: (Hash[String, untyped]) -> Hash[String, untyped]
|
|
31
|
+
def placing(record) = record.slice("status", "base_commit", "audited_at", "findings")
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -5,6 +5,7 @@ require_relative "assessment_request"
|
|
|
5
5
|
require_relative "answer_in_a_file"
|
|
6
6
|
require_relative "answered_request"
|
|
7
7
|
require_relative "audit_changes"
|
|
8
|
+
require_relative "completed_audit_findings"
|
|
8
9
|
require_relative "completed_audit_next_step"
|
|
9
10
|
require_relative "correction_request"
|
|
10
11
|
require_relative "invocation"
|
|
@@ -121,18 +122,17 @@ module Principles
|
|
|
121
122
|
"next_action" => request.to_fill_by_hand(@invocation))
|
|
122
123
|
end
|
|
123
124
|
|
|
124
|
-
# A completed audit: its
|
|
125
|
+
# A completed audit: its findings by what became of them, the files to commit and, in git, each changed
|
|
125
126
|
# member's commits since the base commit and the command that commits those files alone, each prior
|
|
126
127
|
# finding's decision, and the next step. The command's subject states only what the audit did, which the
|
|
127
128
|
# agent rewords to its project's convention.
|
|
128
|
-
#: (principle_id: String,
|
|
129
|
+
#: (principle_id: String, findings: CompletedAuditFindings, changes: AuditChanges,
|
|
129
130
|
#| decisions: PriorFindingDecisionsResult) -> Hash[String, untyped]
|
|
130
|
-
def completion(principle_id:,
|
|
131
|
+
def completion(principle_id:, findings:, changes:, decisions:)
|
|
131
132
|
changed = changes.to_h
|
|
132
|
-
commit = changes.commit(
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
"open_findings" => open, "files_to_commit" => changes.files_to_commit,
|
|
133
|
+
commit = changes.commit(findings.subject(principle_id), @invocation.project)
|
|
134
|
+
output = { "status" => "audit_completed", "principle_id" => principle_id, **findings.to_h,
|
|
135
|
+
"files_to_commit" => changes.files_to_commit,
|
|
136
136
|
"limits" => Prompts.text("report-the-completed-audit/what-completion-means"),
|
|
137
137
|
**changed.except("files_to_commit"), **commit.fields }
|
|
138
138
|
next_action = CompletedAuditNextStep.new(@invocation).to_s(principle_id, changes, commit)
|
|
@@ -150,18 +150,13 @@ module Principles
|
|
|
150
150
|
completed.merge("next_action" => [completed.fetch("next_action"), *offers].join("\n"))
|
|
151
151
|
end
|
|
152
152
|
|
|
153
|
-
#
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
# is never committed.
|
|
161
|
-
#: (String) -> String
|
|
162
|
-
def open_record_notice(file)
|
|
163
|
-
"The last audit's record, #{file}, holds an open audit, waiting on its correction. Do not commit it: submit " \
|
|
164
|
-
"that correction, or answer this request, which replaces it, or discard it with `git restore #{file}`."
|
|
153
|
+
# completed, a completed first full audit's result, with the line after its next_action that names the command
|
|
154
|
+
# turning request logging on.
|
|
155
|
+
#: (Hash[String, untyped]) -> Hash[String, untyped]
|
|
156
|
+
def offering_request_logging(completed)
|
|
157
|
+
line = Prompts.text("read-what-reached-the-context/see-whether-members-reach-the-agent",
|
|
158
|
+
command: @invocation.in_project("turn-on-request-logging"))
|
|
159
|
+
completed.merge("next_action" => [completed.fetch("next_action"), line].join("\n"))
|
|
165
160
|
end
|
|
166
161
|
|
|
167
162
|
# Wraps a known judgement request with this run's project and answer command.
|