principles 0.1.3 → 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 +120 -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 +29 -2
- 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_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 +39 -13
- 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 +29 -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 +5 -0
- 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 +37 -6
- data/lib/principles/models/disposition_placeholders.rb +12 -0
- 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/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 +19 -5
- 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/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 +18 -13
- 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 +15 -15
- 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 +21 -16
- data/lib/principles/views/disposition_template.rb +35 -0
- data/lib/principles/views/first_audit.rb +29 -15
- data/lib/principles/views/first_audit_line.rb +4 -5
- data/lib/principles/views/invocation.rb +14 -5
- 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/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/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-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-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 +10 -10
- 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/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
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
require_relative "answer_head"
|
|
5
5
|
require_relative "answer_in_a_file"
|
|
6
|
+
require_relative "disposition_template"
|
|
6
7
|
require_relative "invocation"
|
|
7
8
|
require_relative "prompts"
|
|
8
9
|
require_relative "shell_word"
|
|
@@ -14,14 +15,16 @@ module Principles
|
|
|
14
15
|
# every disposition's shape, and what submitting the assessment stored.
|
|
15
16
|
class CorrectionRequest
|
|
16
17
|
# head is what the answer hands back unchanged, the request's id and the basis the correction depends on;
|
|
17
|
-
#
|
|
18
|
-
#
|
|
19
|
-
#: (head: AnswerHead, principle_id: String, findings: Array[untyped],
|
|
20
|
-
|
|
18
|
+
# disposition is what the template starts each finding's disposition with; carrier_checks is the check for each
|
|
19
|
+
# carrier kind the findings' members are in, as CarrierChecks prints them.
|
|
20
|
+
#: (head: AnswerHead, principle_id: String, findings: Array[untyped], disposition: DispositionTemplate,
|
|
21
|
+
#| ?carrier_checks: Hash[String, untyped]) -> void
|
|
22
|
+
def initialize(head:, principle_id:, findings:, disposition:, carrier_checks: {})
|
|
21
23
|
@head = head
|
|
24
|
+
@carrier_checks = carrier_checks
|
|
22
25
|
@principle_id = principle_id
|
|
23
26
|
@findings = findings
|
|
24
|
-
@
|
|
27
|
+
@disposition = disposition
|
|
25
28
|
freeze
|
|
26
29
|
end
|
|
27
30
|
|
|
@@ -29,12 +32,14 @@ module Principles
|
|
|
29
32
|
#: () -> String
|
|
30
33
|
def request_id = @head.request_id
|
|
31
34
|
|
|
32
|
-
# The findings to dispose of, the question and a guide to every
|
|
35
|
+
# The findings to dispose of, the check for each carrier their members are in, the question and a guide to every
|
|
36
|
+
# disposition's shape.
|
|
33
37
|
#: () -> Hash[String, untyped]
|
|
34
38
|
def context
|
|
35
39
|
{ "principle_id" => @principle_id, "findings" => @findings,
|
|
40
|
+
**({ "carrier_checks" => @carrier_checks } unless @carrier_checks.empty?),
|
|
36
41
|
"question" => Prompts.text("dispose-of-each-finding/fix-or-record-each-finding"),
|
|
37
|
-
"answer_guide" => self.class.answer_guide(@
|
|
42
|
+
"answer_guide" => self.class.answer_guide(@disposition.reason) }
|
|
38
43
|
end
|
|
39
44
|
|
|
40
45
|
# The guide to every disposition's shape, whose deferred sample's reason is reason_placeholder, the template's,
|
|
@@ -50,13 +55,7 @@ module Principles
|
|
|
50
55
|
# both print one template.
|
|
51
56
|
#: () -> Hash[String, untyped]
|
|
52
57
|
def template
|
|
53
|
-
@head.leading("dispositions" => @findings.map
|
|
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" => [],
|
|
57
|
-
"evidence" => [],
|
|
58
|
-
"reassessment" => nil, "recorded_at" => nil, "waits_on" => nil }
|
|
59
|
-
end)
|
|
58
|
+
@head.leading("dispositions" => @findings.map { @disposition.for(it) })
|
|
60
59
|
end
|
|
61
60
|
|
|
62
61
|
# The correction's answer alone, as show-answer-check --as template prints it.
|
|
@@ -74,7 +73,7 @@ module Principles
|
|
|
74
73
|
#: (Hash[String, untyped], Invocation, String) -> Hash[String, untyped]
|
|
75
74
|
def with_correction_to_fill(acceptable, invocation, answer_file)
|
|
76
75
|
assessment_id = acceptable.fetch("request_id")
|
|
77
|
-
file = invocation
|
|
76
|
+
file = correction_file(invocation)
|
|
78
77
|
save = "Once this answer is submitted with the last line's command, save the correction's answer it leads " \
|
|
79
78
|
"to in a file kept out of git, at this full path, the same from every shell, from this command's " \
|
|
80
79
|
"output: #{alone(assessment_id, answer_file, invocation)} > #{ShellWord.new(file)}\nFill only its " \
|
|
@@ -86,7 +85,13 @@ module Principles
|
|
|
86
85
|
# How to fill the correction by hand: save its answer alone, which show-open-correction prints bare from the
|
|
87
86
|
# open record, to a file, fill only its dispositions there with a file-edit tool, and submit that file.
|
|
88
87
|
#: (Invocation) -> String
|
|
89
|
-
def to_fill_by_hand(invocation)
|
|
88
|
+
def to_fill_by_hand(invocation)
|
|
89
|
+
AnswerInAFile.new(invocation).correction(@principle_id, request_id:, file: correction_file(invocation))
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# The file the correction's answer is saved in, named by its principle and phase.
|
|
93
|
+
#: (Invocation) -> String
|
|
94
|
+
def correction_file(invocation) = invocation.answer_file(@principle_id, "correction")
|
|
90
95
|
|
|
91
96
|
# What to keep while the correction is open, and the read-only command that prints its answer again from the
|
|
92
97
|
# open record, in git or outside it.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# typed: strict
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
module Principles
|
|
5
|
+
# What this tool prints, from plain values a controller hands it. views/CLAUDE.md owns the boundary.
|
|
6
|
+
module Views
|
|
7
|
+
# The disposition a correction's template starts each finding with: the text it leaves in each field the agent
|
|
8
|
+
# writes, with %<id>s where it names its finding, and the fields a finding starts from in place of null, as a
|
|
9
|
+
# deferral raised again carries its recorded_at and waits_on.
|
|
10
|
+
class DispositionTemplate
|
|
11
|
+
# placeholders is the text left in each field the agent writes; filled is, by finding id, the fields a
|
|
12
|
+
# disposition starts from in place of null.
|
|
13
|
+
#: (Hash[String, String], ?Hash[String, Hash[String, untyped]]) -> void
|
|
14
|
+
def initialize(placeholders, filled = {})
|
|
15
|
+
@placeholders = placeholders
|
|
16
|
+
@filled = filled
|
|
17
|
+
freeze
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# The reason placeholder, with its %<id>s slot unfilled.
|
|
21
|
+
#: () -> String
|
|
22
|
+
def reason = @placeholders.fetch("reason")
|
|
23
|
+
|
|
24
|
+
# The disposition finding starts with.
|
|
25
|
+
#: (Hash[String, untyped]) -> Hash[String, untyped]
|
|
26
|
+
def for(finding)
|
|
27
|
+
named = @placeholders.transform_values { format(it, id: finding["id"]) }
|
|
28
|
+
{ "finding_id" => finding["id"], "action" => named.fetch("action"),
|
|
29
|
+
"reason" => named.fetch("reason"), "changed_members" => [], "changed_map_entries" => [],
|
|
30
|
+
"removed_members" => [], "evidence" => [],
|
|
31
|
+
"reassessment" => nil, "recorded_at" => nil, "waits_on" => nil }.merge(@filled.fetch(finding["id"], {}))
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -18,9 +18,9 @@ module Principles
|
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
# The step after adding members, since the next add-member remains the command to answer with.
|
|
21
|
-
#: (String, ?
|
|
22
|
-
def after_mapping(id,
|
|
23
|
-
return after_keeping_mapping(id) if
|
|
21
|
+
#: (String, ?keeps_held: Array[String]?) -> String
|
|
22
|
+
def after_mapping(id, keeps_held: nil)
|
|
23
|
+
return after_keeping_mapping(id, keeps_held) if keeps_held
|
|
24
24
|
|
|
25
25
|
if @in_git
|
|
26
26
|
return "When the map lists every member, commit it: list-member-problems then reports any change to a " \
|
|
@@ -41,27 +41,41 @@ module Principles
|
|
|
41
41
|
"To find the first of them: #{@invocation.in_project("list-candidate-files")}"
|
|
42
42
|
end
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
"existing_principles.\n" \
|
|
46
|
-
"To start it: #{@invocation.in_project("start-audit", id)}"
|
|
44
|
+
keeping_audit(id, principles: "the principles under existing_principles")
|
|
47
45
|
end
|
|
48
46
|
|
|
49
47
|
private
|
|
50
48
|
|
|
51
|
-
#
|
|
52
|
-
#: (String) -> String
|
|
53
|
-
def
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
49
|
+
# The keeping audit, for the principles it keeps held, as the command that printed them names them.
|
|
50
|
+
#: (String, principles: String) -> String
|
|
51
|
+
def keeping_audit(id, principles:)
|
|
52
|
+
"This principle's first full audit judges whether the keeping works for #{principles}.\n" \
|
|
53
|
+
"To start it: #{start_audit(id)}"
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Adding the keeping passage retains setup's first-own-principle prerequisite while it holds none.
|
|
57
|
+
#: (String, Array[String]) -> String
|
|
58
|
+
def after_keeping_mapping(id, keeps_held)
|
|
59
|
+
if keeps_held.any?
|
|
60
|
+
return "#{keeping_baseline}\n#{keeping_audit(id, principles: "the principles list-principles lists")}"
|
|
61
|
+
end
|
|
62
|
+
|
|
59
63
|
Prompts.text("set-principles-up/first-keeping-audit-after-own-principle",
|
|
60
|
-
baseline:
|
|
64
|
+
baseline: keeping_baseline,
|
|
61
65
|
find: @invocation.in_project("list-candidate-files"),
|
|
62
66
|
audit: start_audit(id))
|
|
63
67
|
end
|
|
64
68
|
|
|
69
|
+
# What gives the keeping map's members their baseline until its first full audit.
|
|
70
|
+
#: () -> String
|
|
71
|
+
def keeping_baseline
|
|
72
|
+
if @in_git
|
|
73
|
+
"When the map lists every member, commit it: that commit is the members' baseline until an audit."
|
|
74
|
+
else
|
|
75
|
+
"Outside git, the first full audit gives each member its baseline."
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
|
|
65
79
|
#: (String) -> String
|
|
66
80
|
def start_audit(id)
|
|
67
81
|
@invocation.in_project("start-audit", id)
|
|
@@ -24,7 +24,7 @@ module Principles
|
|
|
24
24
|
return [] if count.zero?
|
|
25
25
|
|
|
26
26
|
counted = count == 1 ? "1 principle has" : "#{count} principles have"
|
|
27
|
-
[%w[resume compact].include?(source) ? started_already(counted, count) : asked(counted
|
|
27
|
+
[%w[resume compact].include?(source) ? started_already(counted, count) : asked(counted)]
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
private
|
|
@@ -34,11 +34,10 @@ module Principles
|
|
|
34
34
|
Prompts.text("start-a-session/start-no-second-first-audit", counted:, them: count == 1 ? "it" : "one")
|
|
35
35
|
end
|
|
36
36
|
|
|
37
|
-
#: (String
|
|
38
|
-
def asked(counted
|
|
37
|
+
#: (String) -> String
|
|
38
|
+
def asked(counted)
|
|
39
39
|
Prompts.text("start-a-session/hand-the-first-audit-to-a-subagent",
|
|
40
|
-
counted:,
|
|
41
|
-
command: @invocation.in_project("show-first-audit-brief"))
|
|
40
|
+
counted:, command: @invocation.in_project("show-first-audit-brief"))
|
|
42
41
|
end
|
|
43
42
|
end
|
|
44
43
|
end
|
|
@@ -60,11 +60,20 @@ module Principles
|
|
|
60
60
|
in_project("submit-answer", request_id, options: ["--file", file])
|
|
61
61
|
end
|
|
62
62
|
|
|
63
|
-
# The file to save
|
|
64
|
-
#
|
|
65
|
-
#
|
|
66
|
-
|
|
67
|
-
|
|
63
|
+
# The file to save an answer for principle_id in, by its full path in temp_directory, so every shell that runs
|
|
64
|
+
# the printed commands names the same file: a sandboxed and an unsandboxed one read $TMPDIR as different
|
|
65
|
+
# folders. An answer to a request in phase is named by the request's principle and phase alone, not its id, so a
|
|
66
|
+
# request printed again after HEAD moved, with a new id, names the file the first one saved to.
|
|
67
|
+
#: (String, ?String?) -> String
|
|
68
|
+
def answer_file(principle_id, phase = nil)
|
|
69
|
+
"#{@temp_directory.chomp("/")}/#{self.class.answer_name(principle_id, phase)}"
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# The name of the file an answer for principle_id in phase is saved in, the one owner of its shape.
|
|
73
|
+
#: (String, ?String?) -> String
|
|
74
|
+
def self.answer_name(principle_id, phase = nil)
|
|
75
|
+
"principles-#{[principle_id, phase].compact.join(".")}-answer.json"
|
|
76
|
+
end
|
|
68
77
|
|
|
69
78
|
# The same command, its values given as one list, as a refusal's repair command holds them.
|
|
70
79
|
#: (String, Array[String], ?options: Array[String], ?usage: String?) -> String
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# typed: strict
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require_relative "invocation"
|
|
5
|
+
|
|
6
|
+
module Principles
|
|
7
|
+
# What this tool prints, from plain values a controller hands it. views/CLAUDE.md owns the boundary.
|
|
8
|
+
module Views
|
|
9
|
+
# The notice start-audit adds about the principle's last audit record, beside a full audit's request: a record
|
|
10
|
+
# left uncommitted, or one holding an open audit.
|
|
11
|
+
class LastRecordNotice
|
|
12
|
+
#: (Invocation) -> void
|
|
13
|
+
def initialize(invocation)
|
|
14
|
+
@invocation = invocation
|
|
15
|
+
freeze
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# The notice start-audit adds when the last audit's record is not committed.
|
|
19
|
+
#: (String) -> String
|
|
20
|
+
def uncommitted(file)
|
|
21
|
+
"The last audit's record, #{file}, is not committed. Commit it, so the project keeps it."
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# The notice start-audit adds, in git, when the last audit's record is open: its correction completes it, so it
|
|
25
|
+
# is never committed.
|
|
26
|
+
#: (String) -> String
|
|
27
|
+
def open(file)
|
|
28
|
+
"The last audit's record, #{file}, holds an open audit, waiting on its correction. Do not commit it: submit " \
|
|
29
|
+
"that correction, or answer this request, which replaces it, or discard it with `git restore #{file}`."
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# The notice start-audit adds while principle_id's last audit is open and keeps its correction: the command that
|
|
33
|
+
# prints that correction again, to resume it.
|
|
34
|
+
#: (String) -> String
|
|
35
|
+
def resume(principle_id)
|
|
36
|
+
"The last audit of #{principle_id} is open, waiting on its correction. To resume it, print that correction " \
|
|
37
|
+
"again: #{@invocation.in_project("show-open-correction", principle_id)}"
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
@@ -19,6 +19,11 @@ module Principles
|
|
|
19
19
|
TEXT_CHECK = "Lines are not text: where two share a first or last line, a passage can start or end partway " \
|
|
20
20
|
"through it, so check the text there before deciding which edit reaches which member. " #: String
|
|
21
21
|
|
|
22
|
+
# What an edit to this member reaches when one of them spans all of its lines.
|
|
23
|
+
SPANNING = "Every edit to this member's text is an edit to each marked spans_these_lines too. " #: String
|
|
24
|
+
# What an edit to one of them reaches when it lies within this member's lines.
|
|
25
|
+
WITHIN = "Every edit to the text of each marked within_these_lines is an edit to this member's too. " #: String
|
|
26
|
+
|
|
22
27
|
# text_check says whether a member holding another's lines is not a whole file, so the text needs checking.
|
|
23
28
|
#: (?overlaps: Array[String], ?same_lines_as: Array[String], ?mapped_elsewhere: Array[Hash[String, untyped]],
|
|
24
29
|
#| ?text_check: bool) -> void
|
|
@@ -60,33 +65,22 @@ module Principles
|
|
|
60
65
|
"share changes each. #{spans_note}Check that this member's role fits beside the roles they give it there. "
|
|
61
66
|
end
|
|
62
67
|
|
|
63
|
-
#
|
|
64
|
-
#
|
|
68
|
+
# What an edit reaches where some of them are marked spans_these_lines or within_these_lines, said once by the
|
|
69
|
+
# mark, since mapped_elsewhere names each; one sentence per entry made a whole-file member's result 9.4 KB.
|
|
70
|
+
# Lines are not text, so the agent checks where they share a first or last line.
|
|
65
71
|
#: () -> String
|
|
66
72
|
def spans_note
|
|
67
|
-
spans =
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
end
|
|
71
|
-
end
|
|
72
|
-
"#{spans.join}#{TEXT_CHECK if @text_check && spans.any?}"
|
|
73
|
-
end
|
|
73
|
+
spans = marked?("spans_these_lines")
|
|
74
|
+
within = marked?("within_these_lines")
|
|
75
|
+
return "" unless spans || within
|
|
74
76
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
def spanning(each)
|
|
78
|
-
id = "`#{each.fetch("member_id")}`"
|
|
79
|
-
"#{id} in #{each.fetch("principle_id")} spans all of this member's lines, so every edit to this member's " \
|
|
80
|
-
"text is an edit to it too, and an edit outside the shared lines reaches only #{id}. "
|
|
77
|
+
"#{SPANNING if spans}#{WITHIN if within}An edit outside the shared lines reaches only the member it is in. " \
|
|
78
|
+
"#{TEXT_CHECK if @text_check}"
|
|
81
79
|
end
|
|
82
80
|
|
|
83
|
-
#
|
|
84
|
-
#: (
|
|
85
|
-
def
|
|
86
|
-
"`#{each.fetch("member_id")}` in #{each.fetch("principle_id")} lies within this member's lines, so every " \
|
|
87
|
-
"edit to its text is an edit to this member's too, and an edit outside the shared lines reaches only " \
|
|
88
|
-
"this member. "
|
|
89
|
-
end
|
|
81
|
+
# Whether any of them carries this mark.
|
|
82
|
+
#: (String) -> bool
|
|
83
|
+
def marked?(mark) = @mapped_elsewhere.any? { |each| each[mark] }
|
|
90
84
|
|
|
91
85
|
# Equal lines are not equal text, as a passage can end within its last line, so the agent decides.
|
|
92
86
|
#: () -> String
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# typed: strict
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require_relative "prompts"
|
|
5
|
+
|
|
6
|
+
module Principles
|
|
7
|
+
# What this tool prints, from plain values a controller hands it. views/CLAUDE.md owns the boundary.
|
|
8
|
+
module Views
|
|
9
|
+
# What each status a member can have in the logged requests means, in one line each, printed once beside the
|
|
10
|
+
# members that carry them, so the agent reads a status without guessing. not_a_carrier comes first, since a first
|
|
11
|
+
# reader most often mistakes it for a gap.
|
|
12
|
+
class LoggedRequestStatusMeanings
|
|
13
|
+
#: () -> void
|
|
14
|
+
def initialize
|
|
15
|
+
freeze
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# Each status, with its one-line meaning.
|
|
19
|
+
#: () -> Hash[String, String]
|
|
20
|
+
def to_h
|
|
21
|
+
{ "not_a_carrier" => Prompts.text("read-what-reached-the-context/what-not-a-carrier-means"),
|
|
22
|
+
"present" => Prompts.text("read-what-reached-the-context/what-present-means"),
|
|
23
|
+
"present_but_not_loaded" => Prompts.text("read-what-reached-the-context/what-present-but-not-loaded-means"),
|
|
24
|
+
"absent" => Prompts.text("read-what-reached-the-context/what-absent-means"),
|
|
25
|
+
"unmeasurable" => Prompts.text("read-what-reached-the-context/what-unmeasurable-means") }
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# typed: strict
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require_relative "invocation"
|
|
5
|
+
require_relative "logged_request_status_meanings"
|
|
6
|
+
require_relative "prompts"
|
|
7
|
+
require_relative "request_part"
|
|
8
|
+
|
|
9
|
+
module Principles
|
|
10
|
+
# What this tool prints, from plain values a controller hands it. views/CLAUDE.md owns the boundary.
|
|
11
|
+
module Views
|
|
12
|
+
# What a full audit's request prints from the logged requests, so the agent judging each
|
|
13
|
+
# member sees whether its text reached the agent's context: here, while none is captured, the one line saying how
|
|
14
|
+
# to capture them; while git might commit them or a tool the scan runs is missing, why none is read; and else how
|
|
15
|
+
# far each judged member's text reached them.
|
|
16
|
+
class LoggedRequestsEvidence
|
|
17
|
+
# The part this prints, by the name the request prints it under and start-audit --part takes.
|
|
18
|
+
PART = "logged_requests" #: String
|
|
19
|
+
|
|
20
|
+
#: (Invocation) -> void
|
|
21
|
+
def initialize(invocation)
|
|
22
|
+
@invocation = invocation
|
|
23
|
+
freeze
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# The request's part saying that no request is captured, and the command that turns capture on.
|
|
27
|
+
#: () -> RequestPart
|
|
28
|
+
def none_captured
|
|
29
|
+
turn_on = @invocation.in_project("turn-on-request-logging")
|
|
30
|
+
fact = Prompts.text("assess-every-member/turn-on-request-logging-to-see-what-reaches-context", turn_on:)
|
|
31
|
+
RequestPart.new(shown: { PART => { "fact" => fact } }, slots: {})
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# The request's part saying how far each judged member's text reached the captured requests, as reach gives it,
|
|
35
|
+
# with the command that shows where in the requests one member was seen, its key as KEY, what each status
|
|
36
|
+
# means, and the question that asks the agent to weigh it.
|
|
37
|
+
#: (Hash[String, untyped]) -> RequestPart
|
|
38
|
+
def reached(reach)
|
|
39
|
+
detail = @invocation.in_project("show-members-in-logged-requests", options: ["--member", "KEY"])
|
|
40
|
+
weigh = Prompts.text("assess-every-member/weigh-what-reached-the-context")
|
|
41
|
+
shown = reach.merge("detail_with" => detail, "status_meanings" => LoggedRequestStatusMeanings.new.to_h,
|
|
42
|
+
"weigh" => weigh)
|
|
43
|
+
RequestPart.new(shown: { PART => shown }, slots: {})
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# The request's part, by its name alone, for a read of the request that prints none of it, so the captured
|
|
47
|
+
# requests go unscanned, with why the index gives no bytes for it; it adds no slot to the answer.
|
|
48
|
+
#: () -> RequestPart
|
|
49
|
+
def not_scanned = NotScanned.new(shown: { PART => {} }, slots: {})
|
|
50
|
+
|
|
51
|
+
# The part a read left unscanned, which the index gives no bytes for, since sizing it would wait on the scan.
|
|
52
|
+
class NotScanned < RequestPart
|
|
53
|
+
# Why the index gives no bytes for this part.
|
|
54
|
+
#: () -> String
|
|
55
|
+
def bytes_unknown
|
|
56
|
+
"Reading this part scans the logged requests, so the index does not size it; read it with part_command."
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# The request's part saying why no logged request is read, from the refusal a read of them gives: its message
|
|
61
|
+
# as the fact, and its repair.
|
|
62
|
+
#: (Hash[String, untyped]) -> RequestPart
|
|
63
|
+
def unread(refusal)
|
|
64
|
+
RequestPart.new(shown: { PART => { "fact" => refusal.fetch("message"), "repair" => refusal.fetch("repair") } },
|
|
65
|
+
slots: {})
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
@@ -8,16 +8,18 @@ module Principles
|
|
|
8
8
|
# What this tool prints, from plain values a controller hands it. views/CLAUDE.md owns the boundary.
|
|
9
9
|
module Views
|
|
10
10
|
# What add-member's result needs to know of the map a member joined, beyond the map itself: whether its
|
|
11
|
-
# principle keeps the others held, which changes the step after mapping,
|
|
12
|
-
# correction may be open on it, so that the member may fix one of its findings, and
|
|
13
|
-
# what to do after mapping: with a principle's first member, or in git the first since the
|
|
14
|
-
# members mapped in one sitting do not each repeat it.
|
|
11
|
+
# principle keeps the others held, and which mapped principles it holds, which changes the step after mapping,
|
|
12
|
+
# whether a full audit's correction may be open on it, so that the member may fix one of its findings, and
|
|
13
|
+
# whether to repeat what to do after mapping: with a principle's first member, or in git the first since the
|
|
14
|
+
# map's last commit, so members mapped in one sitting do not each repeat it.
|
|
15
15
|
class MapAddedTo
|
|
16
16
|
COMPLETENESS_QUESTION = "Is every carrier of the same rule mapped, and should any member belong to another " \
|
|
17
17
|
"principle? "
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
# The ids of the other mapped principles this map keeps held: nil for a map that keeps none held, and empty
|
|
20
|
+
# for the keeping principle's map while no other principle is mapped.
|
|
21
|
+
#: Array[String]?
|
|
22
|
+
attr_reader :keeps_held
|
|
21
23
|
|
|
22
24
|
#: bool
|
|
23
25
|
attr_reader :correction_may_be_open
|
|
@@ -25,11 +27,11 @@ module Principles
|
|
|
25
27
|
#: bool
|
|
26
28
|
attr_reader :reminded
|
|
27
29
|
|
|
28
|
-
#: (?
|
|
30
|
+
#: (?keeps_held: Array[String]?, ?correction_may_be_open: bool, ?reminded: bool,
|
|
29
31
|
#| ?asks_about_completeness: bool, ?new_scope: NewLoadingScope) -> void
|
|
30
|
-
def initialize(
|
|
32
|
+
def initialize(keeps_held: nil, correction_may_be_open: false, reminded: true,
|
|
31
33
|
asks_about_completeness: false, new_scope: NewLoadingScope.new)
|
|
32
|
-
@
|
|
34
|
+
@keeps_held = keeps_held
|
|
33
35
|
@correction_may_be_open = correction_may_be_open
|
|
34
36
|
@reminded = reminded
|
|
35
37
|
@asks_about_completeness = asks_about_completeness
|
|
@@ -40,14 +42,14 @@ module Principles
|
|
|
40
42
|
# This immutable reminder context with the model's decision to ask about coverage, not a completeness verdict.
|
|
41
43
|
#: (asks: bool) -> MapAddedTo
|
|
42
44
|
def with_completeness_question(asks:)
|
|
43
|
-
MapAddedTo.new(
|
|
45
|
+
MapAddedTo.new(keeps_held: @keeps_held, correction_may_be_open: @correction_may_be_open,
|
|
44
46
|
reminded: @reminded, asks_about_completeness: asks, new_scope: @new_scope)
|
|
45
47
|
end
|
|
46
48
|
|
|
47
49
|
# This immutable addition context with the model's new-scope facts, preserving its original reminder flags.
|
|
48
50
|
#: (NewLoadingScope) -> MapAddedTo
|
|
49
51
|
def with_loading_scope(scope)
|
|
50
|
-
MapAddedTo.new(
|
|
52
|
+
MapAddedTo.new(keeps_held: @keeps_held, correction_may_be_open: @correction_may_be_open,
|
|
51
53
|
reminded: @reminded, asks_about_completeness: @asks_about_completeness, new_scope: scope)
|
|
52
54
|
end
|
|
53
55
|
|
|
@@ -78,7 +80,7 @@ module Principles
|
|
|
78
80
|
"Commit #{principle.file} as it changes, so the project's history shows each change; in git, start-audit " \
|
|
79
81
|
"refuses a map that is not committed.\n" \
|
|
80
82
|
"To see the map so far: #{invocation.in_project("show-principle", principle.id)}\n" \
|
|
81
|
-
"#{FirstAudit.new(invocation, in_git:).after_mapping(principle.id,
|
|
83
|
+
"#{FirstAudit.new(invocation, in_git:).after_mapping(principle.id, keeps_held: @keeps_held)}"
|
|
82
84
|
end
|
|
83
85
|
end
|
|
84
86
|
end
|
|
@@ -77,17 +77,28 @@ module Principles
|
|
|
77
77
|
# shared says which members share a line with the new one; added lists them only when there are some, as it
|
|
78
78
|
# carries a check only when one is named. joined is what the result says of the map the member joined.
|
|
79
79
|
#: (PrintedPrinciple, added: Hash[String, untyped], ?shared: LinesSharedWithMember, ?joined: MapAddedTo,
|
|
80
|
-
#| ?
|
|
80
|
+
#| ?other_maps: Array[ConsecutiveSectionsElsewhere | WholeFileElsewhere | MemberSetsOverlap])
|
|
81
81
|
#| -> Hash[String, untyped]
|
|
82
82
|
def member_added(principle, added:, shared: LinesSharedWithMember.new, joined: MapAddedTo.new,
|
|
83
|
-
|
|
84
|
-
member = AddedMember.new(added, shared: shared,
|
|
83
|
+
other_maps: [])
|
|
84
|
+
member = AddedMember.new(added, shared: shared, other_maps: other_maps)
|
|
85
85
|
after = joined.after_member(principle, member: member.id, invocation: @invocation, in_git: @in_git)
|
|
86
86
|
question(principle, "#{member.opening}#{after}".rstrip,
|
|
87
87
|
add_member_command(principle.id), shown: { "member_count" => principle.members.length })
|
|
88
88
|
.merge("added" => member.to_h.merge(joined.added_facts))
|
|
89
89
|
end
|
|
90
90
|
|
|
91
|
+
# add-member --plugin: the member read from an installed plugin, with where it comes from, and that it is
|
|
92
|
+
# read-only and how a finding on it is handled.
|
|
93
|
+
#: (PrintedPrinciple, added: Hash[String, untyped]) -> Hash[String, untyped]
|
|
94
|
+
def plugin_member_added(principle, added:)
|
|
95
|
+
question(principle, "Added #{added.fetch("id")}, read-only: principles never edits a plugin's files, which " \
|
|
96
|
+
"the plugin's next update replaces, so a finding on it is fixed in the project's own " \
|
|
97
|
+
"files, deferred upstream or accepted. Add the next member the same way.",
|
|
98
|
+
add_member_command(principle.id), shown: { "member_count" => principle.members.length })
|
|
99
|
+
.merge("added" => added)
|
|
100
|
+
end
|
|
101
|
+
|
|
91
102
|
# add-member's report of the map it started, with the description and activation it wrote, which the agent
|
|
92
103
|
# never typed.
|
|
93
104
|
#: (PrintedPrinciple) -> Hash[String, untyped]
|
|
@@ -95,14 +106,15 @@ module Principles
|
|
|
95
106
|
{ "map_created" => { "description" => principle.description, "activation" => principle.activation } }
|
|
96
107
|
end
|
|
97
108
|
|
|
98
|
-
# move-member: the member's old id, and its new id
|
|
109
|
+
# move-member: the member's old id, and its new id, place and the lines it now spans, not its role or the map,
|
|
110
|
+
# which cost 7.6 KB on a 17-member principle for one member moved.
|
|
99
111
|
#: (PrintedPrinciple, from: String, moved: Hash[String, untyped]) -> Hash[String, untyped]
|
|
100
112
|
def member_moved(principle, from:, moved:)
|
|
101
113
|
id = moved.fetch("id")
|
|
102
114
|
question(principle, "#{id} now spans lines #{moved.fetch("first_line")} to #{moved.fetch("last_line")}" \
|
|
103
115
|
"#{" (moved from #{from})" unless from == id}; if that is not the passage you meant, " \
|
|
104
|
-
"move it again. Check the other members, then start the audit.", start_audit(principle.id)
|
|
105
|
-
|
|
116
|
+
"move it again. Check the other members, then start the audit.", start_audit(principle.id),
|
|
117
|
+
shown: { "member" => moved })
|
|
106
118
|
end
|
|
107
119
|
|
|
108
120
|
# change-member-check: the stored command is the member's check in the map printed beside this, so the
|
|
@@ -113,31 +125,41 @@ module Principles
|
|
|
113
125
|
done = "#{member} is now enforced by the check named in its map entry. The next audit marks it new or " \
|
|
114
126
|
"changed and asks for a review before it runs; nothing runs it automatically: " \
|
|
115
127
|
"you run it when an audit asks for its result."
|
|
116
|
-
return member_replaced(principle,
|
|
128
|
+
return member_replaced(principle, done: done) if hidden.empty?
|
|
117
129
|
|
|
118
|
-
member_replaced(principle,
|
|
119
|
-
done: "#{done} The check holds characters that print escaped or not at all, " \
|
|
130
|
+
member_replaced(principle, done: "#{done} The check holds characters that print escaped or not at all, " \
|
|
120
131
|
"which check_hidden_characters names; make sure each is meant.")
|
|
121
132
|
.merge("check_hidden_characters" => hidden)
|
|
122
133
|
end
|
|
123
134
|
|
|
124
135
|
# change-member-role, change-member-check and remove-member-check: done says what changed. This tool cannot
|
|
125
136
|
# tell in git whether a full audit's correction is open, so the next step names both cases, and
|
|
126
|
-
# the other case by what the agent holds: a correction request (one user on 8e5b3f9)
|
|
127
|
-
|
|
128
|
-
|
|
137
|
+
# the other case by what the agent holds: a correction request (one user on 8e5b3f9), which already
|
|
138
|
+
# prints its submit-answer command with its request id, so this does not repeat it.
|
|
139
|
+
# shown is what it prints of the map, as question takes it.
|
|
140
|
+
#: (PrintedPrinciple, done: String, ?shown: Hash[String, untyped]) -> Hash[String, untyped]
|
|
141
|
+
def member_replaced(principle, done:, shown: { "map" => principle.map })
|
|
129
142
|
question(principle, "#{done} Check the other members, then start the audit.\nIf you hold a correction " \
|
|
130
|
-
"request
|
|
131
|
-
"
|
|
132
|
-
|
|
133
|
-
|
|
143
|
+
"request instead, list this member in the changed_map_entries of the fixed disposition " \
|
|
144
|
+
"this change fixes, and submit that request's answer.",
|
|
145
|
+
start_audit(principle.id), shown: shown)
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
# change-member-role: the member's id and its new role, the one part that changed, never the whole map, which
|
|
149
|
+
# cost 7.9 KB on a 17-member principle.
|
|
150
|
+
#: (PrintedPrinciple, member: String, role: String) -> Hash[String, untyped]
|
|
151
|
+
def role_changed(principle, member:, role:)
|
|
152
|
+
member_replaced(principle, done: "Changed its role.", shown: { "member" => { "id" => member, "role" => role } })
|
|
134
153
|
end
|
|
135
154
|
|
|
155
|
+
# remove-member: the id removed and how many members are left, never the whole map left, which cost 7.9 KB on
|
|
156
|
+
# a 17-member principle; show-principle lists them.
|
|
136
157
|
#: (PrintedPrinciple, removed: String) -> Hash[String, untyped]
|
|
137
158
|
def member_removed(principle, removed:)
|
|
159
|
+
left = principle.map.fetch("members").size
|
|
138
160
|
question(principle, "Removed #{removed}. Add or remove members until the map is right.\n" \
|
|
139
161
|
"#{FirstAudit.new(@invocation, in_git: @in_git).after_mapping(principle.id)}",
|
|
140
|
-
add_member_command(principle.id))
|
|
162
|
+
add_member_command(principle.id), shown: { "member_removed" => removed, "members_left" => left })
|
|
141
163
|
end
|
|
142
164
|
|
|
143
165
|
private
|