principles 0.0.5 → 0.0.7
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/lib/principles/after_commit_hook_options.rb +4 -1
- data/lib/principles/cli.rb +9 -0
- data/lib/principles/command_line.rb +31 -30
- data/lib/principles/command_routes.rb +9 -3
- data/lib/principles/controllers/acknowledgement.rb +82 -95
- data/lib/principles/controllers/answer.rb +14 -11
- data/lib/principles/controllers/assessment.rb +27 -24
- data/lib/principles/controllers/audit.rb +24 -4
- data/lib/principles/controllers/audit_completion.rb +10 -4
- data/lib/principles/controllers/command.rb +2 -2
- data/lib/principles/controllers/correction.rb +16 -7
- data/lib/principles/controllers/full_audit_request.rb +8 -3
- data/lib/principles/controllers/guidance_search_paths.rb +31 -0
- data/lib/principles/controllers/inventory.rb +3 -22
- data/lib/principles/controllers/mapping.rb +9 -1
- data/lib/principles/controllers/member_acknowledgement.rb +137 -0
- data/lib/principles/controllers/member_addition.rb +65 -0
- data/lib/principles/controllers/member_entries.rb +6 -24
- data/lib/principles/controllers/member_problems_report.rb +33 -25
- data/lib/principles/controllers/members_to_assess.rb +1 -1
- data/lib/principles/controllers/meta_principle_setup.rb +1 -1
- data/lib/principles/controllers/repoint.rb +5 -2
- data/lib/principles/controllers/survey.rb +60 -0
- data/lib/principles/data/audit_files.rb +4 -0
- data/lib/principles/data/candidate_files_found.rb +48 -13
- data/lib/principles/data/command-steps.json +86 -25
- data/lib/principles/data/committed_tree.rb +84 -0
- data/lib/principles/data/first_parent_log.rb +48 -0
- data/lib/principles/data/first_parent_range.rb +122 -0
- data/lib/principles/data/git_command.rb +37 -0
- data/lib/principles/data/guidance_search_paths_file.rb +107 -0
- data/lib/principles/data/map_files.rb +35 -10
- data/lib/principles/data/principles_directory.rb +40 -0
- data/lib/principles/data/principles_subfolder.rb +39 -16
- data/lib/principles/data/project_files.rb +11 -3
- data/lib/principles/data/repository.rb +55 -29
- data/lib/principles/data/requested_candidate_files.rb +43 -0
- data/lib/principles/data/running_version.rb +3 -5
- data/lib/principles/data/schemas/acknowledgement-answer.schema.json +6 -6
- data/lib/principles/data/schemas/acknowledgements-answer.schema.json +88 -0
- data/lib/principles/data/schemas/answer-guide.schema.json +255 -63
- data/lib/principles/data/schemas/assessment-answer.schema.json +15 -1
- 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 +12 -54
- data/lib/principles/data/schemas/guidance-search-paths.schema.json +13 -0
- data/lib/principles/data/schemas/member-map-history.schema.json +20 -0
- data/lib/principles/data/verified_head.rb +162 -0
- data/lib/principles/invocation_options.rb +5 -4
- data/lib/principles/list_open_findings_options.rb +23 -0
- data/lib/principles/models/acknowledged_check.rb +94 -0
- data/lib/principles/models/acknowledgement.rb +40 -36
- data/lib/principles/models/acknowledgement_left_as_printed.rb +72 -0
- data/lib/principles/models/acknowledgements.rb +99 -0
- data/lib/principles/models/answered_time.rb +9 -0
- data/lib/principles/models/assessment_report.rb +13 -13
- data/lib/principles/models/audit.rb +17 -4
- data/lib/principles/models/audit_entry_protecting_map.rb +28 -0
- data/lib/principles/models/audit_record.rb +9 -0
- data/lib/principles/models/audit_records.rb +34 -8
- data/lib/principles/models/candidate_files.rb +17 -6
- data/lib/principles/models/candidate_inventory.rb +51 -7
- data/lib/principles/models/captured_head.rb +72 -0
- data/lib/principles/models/check_since_last_audit.rb +4 -8
- data/lib/principles/models/correction_basis.rb +14 -5
- data/lib/principles/models/declared_map_changes.rb +25 -9
- data/lib/principles/models/declared_member_removals.rb +75 -0
- data/lib/principles/models/disposition.rb +4 -2
- data/lib/principles/models/fix_only_fields.rb +12 -0
- data/lib/principles/models/guidance_search_path.rb +26 -0
- data/lib/principles/models/guidance_search_paths.rb +57 -0
- data/lib/principles/models/line_span.rb +6 -0
- data/lib/principles/models/list_member_problems_check.rb +80 -0
- data/lib/principles/models/listed_members.rb +49 -0
- data/lib/principles/models/loaded_files.rb +1 -2
- data/lib/principles/models/loading_decision.rb +17 -8
- data/lib/principles/models/loading_scope.rb +61 -0
- data/lib/principles/models/loads_to_check.rb +0 -1
- data/lib/principles/models/locator.rb +6 -0
- data/lib/principles/models/mapped_principles.rb +39 -37
- data/lib/principles/models/member_assessments.rb +11 -2
- data/lib/principles/models/member_file.rb +20 -71
- data/lib/principles/models/member_history.rb +7 -5
- data/lib/principles/models/member_loading_scopes.rb +49 -0
- data/lib/principles/models/member_loads.rb +4 -0
- data/lib/principles/models/member_mapping_run.rb +30 -0
- data/lib/principles/models/member_moves.rb +4 -0
- data/lib/principles/models/member_problems.rb +57 -29
- data/lib/principles/models/member_region.rb +129 -0
- data/lib/principles/models/member_repair_moves.rb +9 -11
- data/lib/principles/models/member_sighting.rb +5 -8
- data/lib/principles/models/member_snapshots.rb +14 -1
- data/lib/principles/models/members_in_consecutive_sections.rb +56 -0
- data/lib/principles/models/meta_principle.rb +14 -0
- data/lib/principles/models/missing_files.rb +2 -2
- data/lib/principles/models/other_templates_placeholders.rb +1 -1
- data/lib/principles/models/outline_budget.rb +29 -14
- data/lib/principles/models/principle.rb +14 -7
- data/lib/principles/models/principle_file_revision.rb +48 -0
- data/lib/principles/models/principle_history.rb +46 -19
- data/lib/principles/models/principle_lineage.rb +118 -0
- data/lib/principles/models/principle_map_revision.rb +39 -0
- data/lib/principles/models/principle_mapping_history.rb +132 -0
- data/lib/principles/models/principle_members.rb +14 -0
- data/lib/principles/models/principle_predecessor.rb +45 -0
- data/lib/principles/models/principle_publication.rb +177 -0
- data/lib/principles/models/principle_revision.rb +104 -0
- data/lib/principles/models/problem_report.rb +36 -9
- data/lib/principles/models/project.rb +47 -30
- data/lib/principles/models/project_history.rb +45 -25
- data/lib/principles/models/record_format.rb +6 -0
- data/lib/principles/models/reported_check.rb +16 -12
- data/lib/principles/models/request_id.rb +1 -1
- data/lib/principles/models/sent_answer.rb +35 -5
- data/lib/principles/models/survey_search_paths.rb +26 -0
- data/lib/principles/models/uncommitted_files.rb +50 -0
- data/lib/principles/models/unknown_principle.rb +29 -0
- data/lib/principles/positional_arguments.rb +38 -0
- data/lib/principles/session_start_options.rb +3 -3
- data/lib/principles/start_audit_options.rb +10 -2
- data/lib/principles/version.rb +2 -2
- data/lib/principles/views/acknowledgement_result.rb +54 -16
- data/lib/principles/views/added_member.rb +41 -0
- data/lib/principles/views/answered_request.rb +21 -0
- data/lib/principles/views/assessed_members.rb +26 -5
- data/lib/principles/views/assessment_request.rb +24 -4
- data/lib/principles/views/audit_result.rb +30 -27
- data/lib/principles/views/candidate_files_result.rb +56 -12
- data/lib/principles/views/candidate_outlines_result.rb +25 -0
- data/lib/principles/views/check_result_template.rb +18 -17
- data/lib/principles/views/consecutive_sections_elsewhere.rb +27 -0
- data/lib/principles/views/correction_request.rb +38 -10
- data/lib/principles/views/findings_result.rb +21 -0
- data/lib/principles/views/guidance_search_paths_result.rb +26 -0
- data/lib/principles/views/invocation.rb +19 -4
- data/lib/principles/views/json_with_entries_on_lines.rb +12 -4
- data/lib/principles/views/loads_to_check_result.rb +3 -2
- data/lib/principles/views/map_added_to.rb +56 -2
- data/lib/principles/views/map_result.rb +22 -42
- data/lib/principles/views/maps_needing_members_or_audit.rb +47 -0
- data/lib/principles/views/member_change_since_baseline.rb +2 -1
- data/lib/principles/views/member_repairs.rb +2 -1
- data/lib/principles/views/member_row.rb +61 -0
- data/lib/principles/views/members_a_commit_changed.rb +2 -1
- data/lib/principles/views/members_with_no_baseline.rb +8 -1
- data/lib/principles/views/new_loading_scope.rb +31 -0
- data/lib/principles/views/one_member_check_result_template.rb +37 -21
- data/lib/principles/views/open_findings_line.rb +2 -1
- data/lib/principles/views/principle_read_result.rb +4 -1
- data/lib/principles/views/principles_with_no_completed_audit.rb +9 -3
- data/lib/principles/views/problem_lines.rb +50 -45
- data/lib/principles/views/problem_result.rb +59 -25
- data/lib/principles/views/prompts/acknowledge-a-change/report-the-exit-status-its-own-listing-gives.md +3 -0
- data/lib/principles/views/prompts/acknowledge-a-change/run-the-check-and-report-it-passing.md +3 -3
- data/lib/principles/views/prompts/acknowledge-a-change/say-whether-each-change-keeps-its-meaning.md +8 -0
- data/lib/principles/views/prompts/acknowledge-a-change/say-whether-the-change-keeps-the-meaning.md +6 -6
- data/lib/principles/views/prompts/assess-every-member/answer-guide.json +67 -43
- data/lib/principles/views/prompts/assess-every-member/decide-each-member-loading.md +2 -1
- data/lib/principles/views/prompts/assess-every-member/run-the-check-then-report-it.md +2 -2
- data/lib/principles/views/prompts/assess-every-member/run-the-reviewed-check-and-say-what-its-review-rested-on.md +5 -3
- 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 +12 -0
- data/lib/principles/views/prompts/dispose-of-each-finding/retain-assessment-and-correction.md +4 -0
- data/lib/principles/views/prompts/find-a-principle-to-map/ask-about-other-guidance-search-paths.md +6 -0
- data/lib/principles/views/prompts/find-a-principle-to-map/choose-an-existing-or-new-principle.md +2 -0
- data/lib/principles/views/prompts/find-a-principle-to-map/choose-one-principle.md +4 -2
- data/lib/principles/views/prompts/find-a-principle-to-map/compare-with-mapped-principles.md +11 -0
- data/lib/principles/views/prompts/find-a-principle-to-map/read-left-out-files.md +2 -2
- data/lib/principles/views/prompts/find-a-principle-to-map/survey-a-later-range.md +3 -0
- data/lib/principles/views/prompts/find-a-principle-to-map/what-each-command-writes.md +4 -4
- data/lib/principles/views/prompts/find-a-principle-to-map/where-the-inventory-looks.md +5 -4
- data/lib/principles/views/prompts/learn-what-a-command-does/add-guidance-search-path.md +17 -0
- data/lib/principles/views/prompts/learn-what-a-command-does/add-member.md +35 -6
- data/lib/principles/views/prompts/learn-what-a-command-does/create-principle.md +16 -0
- data/lib/principles/views/prompts/learn-what-a-command-does/every-command-and-how-they-chain.md +1 -2
- data/lib/principles/views/prompts/learn-what-a-command-does/list-candidate-files.md +37 -4
- data/lib/principles/views/prompts/learn-what-a-command-does/list-member-problems.md +20 -19
- data/lib/principles/views/prompts/learn-what-a-command-does/list-open-findings.md +65 -61
- data/lib/principles/views/prompts/learn-what-a-command-does/move-member.md +5 -0
- data/lib/principles/views/prompts/learn-what-a-command-does/remove-guidance-search-path.md +13 -0
- data/lib/principles/views/prompts/learn-what-a-command-does/remove-principle.md +25 -0
- data/lib/principles/views/prompts/learn-what-a-command-does/show-answer-check.md +33 -7
- data/lib/principles/views/prompts/learn-what-a-command-does/show-candidate-outlines.md +21 -0
- data/lib/principles/views/prompts/learn-what-a-command-does/start-audit.md +10 -10
- data/lib/principles/views/prompts/learn-what-a-command-does/submit-answer.md +51 -54
- data/lib/principles/views/prompts/read-requested-outlines/continue-the-survey.md +7 -0
- data/lib/principles/views/prompts/start-a-session/act-on-the-open-findings.md +1 -1
- data/lib/principles/views/prompts/start-a-session/every-loaded-line-costs-every-session.md +1 -0
- data/lib/principles/views/prompts/start-a-session/start-with-the-principles-skill.md +1 -0
- metadata +67 -4
- data/lib/principles/models/candidate_listing.rb +0 -41
|
@@ -24,7 +24,7 @@ module Principles
|
|
|
24
24
|
naming_the_executable do
|
|
25
25
|
case command
|
|
26
26
|
when "show-audit" then shown_audit(required_id(id))
|
|
27
|
-
when "list-open-findings" then
|
|
27
|
+
when "list-open-findings" then listed_open_findings(id, options)
|
|
28
28
|
else unknown(command)
|
|
29
29
|
end
|
|
30
30
|
end
|
|
@@ -65,13 +65,33 @@ module Principles
|
|
|
65
65
|
@audit_records.fetch(id).shown.merge(waiting_beside(id), "wrote" => [])
|
|
66
66
|
end
|
|
67
67
|
|
|
68
|
-
# A one-member audit of
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
# A one-member audit of the member member_ids names (D33), or of several members in one request (#1169), or its
|
|
69
|
+
# answer alone to fill (#773).
|
|
70
|
+
#: (String, Array[String], to_fill: bool) -> Hash[String, untyped]
|
|
71
|
+
def acknowledge(id, member_ids, to_fill:)
|
|
71
72
|
acknowledgement = handed(Acknowledgement)
|
|
73
|
+
member_id = member_ids.first.to_s
|
|
74
|
+
return acknowledgement.several(id, member_ids, to_fill:) if member_ids.size > 1
|
|
75
|
+
|
|
72
76
|
to_fill ? acknowledgement.to_fill(id, member_id) : acknowledgement.start(id, member_id)
|
|
73
77
|
end
|
|
74
78
|
|
|
79
|
+
# The open findings in the form the options ask for: the session-start hook's one line with --short, a line each
|
|
80
|
+
# with --lines (#1156), or the full list.
|
|
81
|
+
#: (String?, Hash[String, untyped]) -> untyped
|
|
82
|
+
def listed_open_findings(id, options)
|
|
83
|
+
return open_findings_line(id, options) if options["short"]
|
|
84
|
+
return open_findings_lines(id) if options["lines"]
|
|
85
|
+
|
|
86
|
+
open_findings(id)
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
# Each open finding on a line, with whom it waits on (#1156).
|
|
90
|
+
#: (String?) -> Views::Lines
|
|
91
|
+
def open_findings_lines(id)
|
|
92
|
+
Views::FindingsResult.new(invocation).lines(open_records(id).flat_map(&:left_open).map(&:listed))
|
|
93
|
+
end
|
|
94
|
+
|
|
75
95
|
# The findings the last completed audit of map id, or of every map, deferred or accepted (#292, D35). Across
|
|
76
96
|
# every map, it names each principle whose record a later copy wrote, so a list left without one that cannot be
|
|
77
97
|
# read does not look whole (D85, V8).
|
|
@@ -8,6 +8,8 @@ require_relative "../models/commits_since_base"
|
|
|
8
8
|
require_relative "../models/other_principles"
|
|
9
9
|
require_relative "../views/prior_finding_decisions_result"
|
|
10
10
|
|
|
11
|
+
require_relative "../views/answered_request"
|
|
12
|
+
|
|
11
13
|
module Principles
|
|
12
14
|
# Each runs one command: reads models, applies their rules and prints through a view.
|
|
13
15
|
# controllers/CLAUDE.md owns the boundary.
|
|
@@ -18,13 +20,16 @@ module Principles
|
|
|
18
20
|
class AuditCompletion < Command
|
|
19
21
|
# map_changes are the changes a correction declared to the map, which name the map file to commit (D40).
|
|
20
22
|
# replacing is the revision of the last completed record when the request that completes the audit was
|
|
21
|
-
# printed, which refuses to replace a record changed since (#646).
|
|
23
|
+
# printed, which refuses to replace a record changed since (#646). read_back_from is the record a correction
|
|
24
|
+
# read the audit's assessment back from, which, when completed, only an identical retry completes again (D24,
|
|
25
|
+
# D87).
|
|
22
26
|
#: (Models::Project, tool: RunningTool, ?map_changes: Models::DeclaredMapChanges?,
|
|
23
|
-
#| ?replacing: Models::LastCompletedRevision?) -> void
|
|
24
|
-
def initialize(project, tool:, map_changes: nil, replacing: nil)
|
|
27
|
+
#| ?replacing: Models::LastCompletedRevision?, ?read_back_from: Models::AuditRecord?) -> void
|
|
28
|
+
def initialize(project, tool:, map_changes: nil, replacing: nil, read_back_from: nil)
|
|
25
29
|
super(project, tool: tool)
|
|
26
30
|
@map_changes = map_changes #: Models::DeclaredMapChanges?
|
|
27
31
|
@replacing = replacing #: Models::LastCompletedRevision?
|
|
32
|
+
@read_back_from = read_back_from #: Models::AuditRecord?
|
|
28
33
|
end
|
|
29
34
|
|
|
30
35
|
# The completed result, and the record change it makes, not yet written.
|
|
@@ -35,7 +40,8 @@ module Principles
|
|
|
35
40
|
written = record(start, audit.outcomes(findings, dispositions, decided), "completed", audit.now)
|
|
36
41
|
changes = @audit_records.changes(written)
|
|
37
42
|
@replacing&.confirm_writable(audit.id, @audit_records.find(audit.id), changes)
|
|
38
|
-
|
|
43
|
+
audit.confirm_read_back(@read_back_from, changes)
|
|
44
|
+
[Views::AnsweredRequest.new(completion_result(start, audit, dispositions, decided, written)), changes]
|
|
39
45
|
end
|
|
40
46
|
|
|
41
47
|
# The record an audit writes, made now, saying what its assessments answered, with each assessment carried
|
|
@@ -53,10 +53,10 @@ module Principles
|
|
|
53
53
|
|
|
54
54
|
private
|
|
55
55
|
|
|
56
|
-
# The history
|
|
56
|
+
# The command's shared history view for principle_id's map.
|
|
57
57
|
#: (String) -> Models::PrincipleHistory
|
|
58
58
|
def principle_history(principle_id)
|
|
59
|
-
|
|
59
|
+
@project.principle_history(principle_id)
|
|
60
60
|
end
|
|
61
61
|
|
|
62
62
|
# Saves the map, and nothing else, then prints the result the block builds from the map as written.
|
|
@@ -59,11 +59,15 @@ module Principles
|
|
|
59
59
|
moves = Models::MemberMoves.new(response["moved_members"])
|
|
60
60
|
before = moves.hashes(confirmed_start(request_id, basis, audit, changes))
|
|
61
61
|
findings = moves.findings(basis.findings)
|
|
62
|
-
start =
|
|
63
|
-
completion(changes, basis).completed(start, audit, dispositions(response, findings, start, audit),
|
|
64
|
-
|
|
62
|
+
start = resumed(audit, basis, before, moves)
|
|
63
|
+
completion(changes, basis, audit).completed(start, audit, dispositions(response, findings, start, audit),
|
|
64
|
+
findings, basis.prior_decided.moved(moves))
|
|
65
65
|
end
|
|
66
66
|
|
|
67
|
+
# What the audit a correction resumes began from, its assessment read back from the record it left (D87).
|
|
68
|
+
#: (Models::Audit, Models::CorrectionBasis, Hash[String, String], Models::MemberMoves) -> Models::AuditStart
|
|
69
|
+
def resumed(audit, basis, before, moves) = audit.resumed(basis, before, moves, @audit_records.find(audit.id))
|
|
70
|
+
|
|
67
71
|
# The packaged answer guide, which the correction request prints, is the one owner of its samples, the text
|
|
68
72
|
# the agent saw, so its sample for each action is handed to the model, which refuses a field given back as
|
|
69
73
|
# its sample (#789). Should the tool be upgraded between request and answer, that answer is checked only
|
|
@@ -97,12 +101,17 @@ module Principles
|
|
|
97
101
|
map = started_from(basis, audit, changes)
|
|
98
102
|
base = basis.base_commit
|
|
99
103
|
found = base ? committed(base, map) : @audit_records.find(audit.id)&.base_members
|
|
100
|
-
audit.confirmed_start(request_id, basis, found)
|
|
104
|
+
checked = audit.confirmed_start(request_id, basis, found)
|
|
105
|
+
principle_history(audit.id).confirm_current_id_since(base)
|
|
106
|
+
checked
|
|
101
107
|
end
|
|
102
108
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
109
|
+
# The completion of a correction, which read its assessment back from the audit's record: the open one or, for
|
|
110
|
+
# an identical retry, the completed one (D87).
|
|
111
|
+
#: (Models::DeclaredMapChanges, Models::CorrectionBasis, Models::Audit) -> AuditCompletion
|
|
112
|
+
def completion(map_changes, basis, audit)
|
|
113
|
+
handed(AuditCompletion, map_changes: map_changes, replacing: basis.printed_after,
|
|
114
|
+
read_back_from: @audit_records.find(audit.id))
|
|
106
115
|
end
|
|
107
116
|
end
|
|
108
117
|
end
|
|
@@ -45,7 +45,7 @@ module Principles
|
|
|
45
45
|
# The request as start-audit prints it, with a notice when the last audit's record was left uncommitted.
|
|
46
46
|
#: () -> Hash[String, untyped]
|
|
47
47
|
def printed
|
|
48
|
-
audit_result.
|
|
48
|
+
audit_result.request(with_record_notice(audit_result.assessment_request(asked))).merge("wrote" => [])
|
|
49
49
|
end
|
|
50
50
|
|
|
51
51
|
# The answer alone, as start-audit --as template prints it, to fill and submit under the request's id (D81).
|
|
@@ -172,12 +172,17 @@ module Principles
|
|
|
172
172
|
[@principles.file(@id), *map.members.map(&:path)]
|
|
173
173
|
end
|
|
174
174
|
|
|
175
|
-
# The request, with a notice when the last audit's record was left uncommitted
|
|
175
|
+
# The request, with a notice when the last audit's record was left uncommitted: a completed one to commit, or an
|
|
176
|
+
# open one, which its correction completes, never to commit (D87).
|
|
176
177
|
#: (Hash[String, untyped]) -> Hash[String, untyped]
|
|
177
178
|
def with_record_notice(output)
|
|
178
179
|
return output unless @base && uncommitted_record?
|
|
179
180
|
|
|
180
|
-
|
|
181
|
+
file = @audit_records.file(@id)
|
|
182
|
+
record = @audit_records.find(@id)
|
|
183
|
+
left_open = record && !record.completed?
|
|
184
|
+
notice = left_open ? audit_result.open_record_notice(file) : audit_result.uncommitted_record_notice(file)
|
|
185
|
+
output.merge("notice" => notice)
|
|
181
186
|
end
|
|
182
187
|
|
|
183
188
|
# Whether the last audit's record exists but differs from the last commit, so it may be left behind.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# typed: strict
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require_relative "command"
|
|
5
|
+
require_relative "../views/guidance_search_paths_result"
|
|
6
|
+
|
|
7
|
+
module Principles
|
|
8
|
+
# Each runs one command: reads models, applies their rules and prints through a view.
|
|
9
|
+
# controllers/CLAUDE.md owns the boundary.
|
|
10
|
+
module Controllers
|
|
11
|
+
# The writes to the project's recorded guidance search paths, separate from member maps and audits.
|
|
12
|
+
class GuidanceSearchPaths < Command
|
|
13
|
+
COMMANDS = { "add-guidance-search-path" => :adding, "remove-guidance-search-path" => :removing }
|
|
14
|
+
.freeze #: Hash[String, Symbol]
|
|
15
|
+
|
|
16
|
+
#: (String, String?, Hash[String, untyped]) -> untyped
|
|
17
|
+
def call(command, _id, options)
|
|
18
|
+
naming_the_executable do
|
|
19
|
+
operation = COMMANDS[command] or unknown(command)
|
|
20
|
+
current = @project.guidance_search_paths
|
|
21
|
+
updated = current.public_send(operation, options.fetch("glob"))
|
|
22
|
+
unchanged = updated.same_as?(current)
|
|
23
|
+
wrote = unchanged ? [] : [updated.save]
|
|
24
|
+
Views::GuidanceSearchPathsResult.new(invocation)
|
|
25
|
+
.result(status: unchanged ? "unchanged" : "guidance_search_paths_updated",
|
|
26
|
+
globs: updated.globs, wrote:)
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -4,22 +4,19 @@
|
|
|
4
4
|
require_relative "command"
|
|
5
5
|
require_relative "../models/member_state"
|
|
6
6
|
require_relative "../models/meta_principle"
|
|
7
|
-
require_relative "../views/candidate_files_result"
|
|
8
|
-
require_relative "../views/json_with_entries_on_lines"
|
|
9
7
|
require_relative "../views/principle_read_result"
|
|
10
8
|
|
|
11
9
|
module Principles
|
|
12
10
|
# Each runs one command: reads models, applies their rules and prints through a view.
|
|
13
11
|
# controllers/CLAUDE.md owns the boundary.
|
|
14
12
|
module Controllers
|
|
15
|
-
# The reads that show what a project
|
|
16
|
-
#
|
|
13
|
+
# The reads that show what a project has mapped: its principles, and each member and how fresh it is against the
|
|
14
|
+
# last audit. None changes anything on disk. Survey runs the survey of candidate files (#1015).
|
|
17
15
|
class Inventory < Command
|
|
18
16
|
#: (String, String?, Hash[String, untyped]) -> untyped
|
|
19
17
|
def call(command, id, _options)
|
|
20
18
|
naming_the_executable do
|
|
21
19
|
case command
|
|
22
|
-
when "list-candidate-files" then list_candidate_files
|
|
23
20
|
when "list-principles" then listing.merge("wrote" => [])
|
|
24
21
|
when "show-principle" then members(required_id(id)).merge("wrote" => [])
|
|
25
22
|
else unknown(command)
|
|
@@ -34,22 +31,6 @@ module Principles
|
|
|
34
31
|
|
|
35
32
|
private
|
|
36
33
|
|
|
37
|
-
#: () -> untyped
|
|
38
|
-
def list_candidate_files
|
|
39
|
-
found = @project.candidate_files.within_budget { |inventory| candidate_files_result(inventory).text.bytesize }
|
|
40
|
-
candidate_files_result(found)
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
# list-candidate-files' result for one inventory, as it prints.
|
|
44
|
-
#: (Models::CandidateInventory) -> Views::JsonWithEntriesOnLines
|
|
45
|
-
def candidate_files_result(found)
|
|
46
|
-
listed = Views::CandidateFilesResult::Found.new(inventory: found.to_h, untracked: found.untracked,
|
|
47
|
-
owner_asks: found.owner_asks)
|
|
48
|
-
question = Views::CandidateFilesResult.new(invocation).question(listed, existing_maps: @principles.ids,
|
|
49
|
-
map_file: @principles.file("ID"))
|
|
50
|
-
Views::JsonWithEntriesOnLines.new(question.merge("wrote" => []), under: "inventory", key: "files")
|
|
51
|
-
end
|
|
52
|
-
|
|
53
34
|
#: (String) -> untyped
|
|
54
35
|
def members(id)
|
|
55
36
|
principle = @principles.find(id)
|
|
@@ -129,7 +110,7 @@ module Principles
|
|
|
129
110
|
#: (String) -> Hash[String, untyped]
|
|
130
111
|
def entry(id)
|
|
131
112
|
map = @principles.find(id)
|
|
132
|
-
row =
|
|
113
|
+
row = map.description_with_id.merge("members_by_freshness" => members_by_freshness(map))
|
|
133
114
|
row = row.merge(read_result.no_members(@principles.file(id))) if map.unstarted?
|
|
134
115
|
row.merge(waiting_on_an_upgrade(id)&.marker || {})
|
|
135
116
|
rescue Error => e
|
|
@@ -15,7 +15,7 @@ module Principles
|
|
|
15
15
|
# Each command and the method that runs it.
|
|
16
16
|
COMMANDS = {
|
|
17
17
|
"create-principle" => :create_principle, "change-description" => :change_description,
|
|
18
|
-
"change-activation" => :change_activation
|
|
18
|
+
"change-activation" => :change_activation, "remove-principle" => :remove_principle
|
|
19
19
|
}.freeze #: Hash[String, Symbol]
|
|
20
20
|
|
|
21
21
|
#: (String, String?, Hash[String, untyped]) -> untyped
|
|
@@ -28,6 +28,14 @@ module Principles
|
|
|
28
28
|
|
|
29
29
|
private
|
|
30
30
|
|
|
31
|
+
#: (String, Hash[String, untyped]) -> Hash[String, untyped]
|
|
32
|
+
def remove_principle(id, options)
|
|
33
|
+
map = @principles.find(id)
|
|
34
|
+
@audit_records.refuse_map_removal(id, confirmed: options["confirm"] == true)
|
|
35
|
+
file = @principles.remove(map)
|
|
36
|
+
map_result.removed(id, file: file)
|
|
37
|
+
end
|
|
38
|
+
|
|
31
39
|
#: (String, Hash[String, untyped]) -> untyped
|
|
32
40
|
def create_principle(id, options)
|
|
33
41
|
map = @principles.create(id) { text(options["description"], "--description") }
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
# typed: strict
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require "json"
|
|
5
|
+
require_relative "command"
|
|
6
|
+
require_relative "../models/acknowledgement"
|
|
7
|
+
require_relative "../models/check_since_last_audit"
|
|
8
|
+
require_relative "../models/list_member_problems_check"
|
|
9
|
+
require_relative "../models/listed_members"
|
|
10
|
+
require_relative "../models/member"
|
|
11
|
+
require_relative "../views/member_change_since_baseline"
|
|
12
|
+
require_relative "../views/one_member_check_result_template"
|
|
13
|
+
|
|
14
|
+
module Principles
|
|
15
|
+
# Each runs one command: reads models, applies their rules and prints through a view.
|
|
16
|
+
# controllers/CLAUDE.md owns the boundary.
|
|
17
|
+
module Controllers
|
|
18
|
+
# One member's acknowledgement as a one-member audit asks and answers it (D33), which Acknowledgement hands over:
|
|
19
|
+
# the member's change since its baseline as the request shows it, the context beside it and the placeholders its
|
|
20
|
+
# template prints, and the record with the acknowledgement in it once the answer holds.
|
|
21
|
+
class MemberAcknowledgement < Command
|
|
22
|
+
# The text the template prints in each field the agent writes: its judgement's placeholders, meaning_kept's
|
|
23
|
+
# chosen by whether the change's first_changed_lines is a pure insertion (#1142), and check_result's for a
|
|
24
|
+
# checked member. The quotes the answer reads as first_changed_lines when left out are not printed (#1170).
|
|
25
|
+
#: (Hash[String, untyped]?, ?Views::MemberChangeSinceBaseline?) -> Hash[String, untyped]
|
|
26
|
+
def self.placeholders(check_result, change = nil)
|
|
27
|
+
quotes = change&.first_changed_lines.to_h
|
|
28
|
+
{ **Models::Acknowledgement.placeholders_beside(quotes),
|
|
29
|
+
**(check_result ? { "check_result" => check_result } : {}) }
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
#: Models::Acknowledgement
|
|
33
|
+
attr_reader :acknowledgement
|
|
34
|
+
#: Models::Member
|
|
35
|
+
attr_reader :member
|
|
36
|
+
|
|
37
|
+
# principle_id's member member_id, refused as a near miss or an unknown id, judged against the principle's
|
|
38
|
+
# record from the commit its map and file were last committed at.
|
|
39
|
+
#: (Models::Project, tool: RunningTool, principle_id: String, member_id: String) -> void
|
|
40
|
+
def initialize(project, tool:, principle_id:, member_id:)
|
|
41
|
+
super(project, tool: tool)
|
|
42
|
+
@id = principle_id
|
|
43
|
+
@member = Models::Member.new(@principles.find(principle_id).member(member_id)) #: Models::Member
|
|
44
|
+
@base = @history.base_commit(principle_id, [@principles.file(principle_id), @member.path]) #: String?
|
|
45
|
+
@acknowledgement = Models::Acknowledgement.new(
|
|
46
|
+
principle_id:, member: @member, record: @audit_records.find(principle_id), base: @base,
|
|
47
|
+
now_sha256: @project.locate(@member.locator).fetch("sha256")
|
|
48
|
+
) #: Models::Acknowledgement
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# The member's part of its request: its change since its baseline, as the request shows it, the context
|
|
52
|
+
# beside it, its findings left open and how to run and report its check, and the placeholders its template
|
|
53
|
+
# prints.
|
|
54
|
+
#: () -> Hash[Symbol, untyped]
|
|
55
|
+
def asked
|
|
56
|
+
baseline, lines = since_baseline
|
|
57
|
+
check = check_template
|
|
58
|
+
change = Views::MemberChangeSinceBaseline.new(
|
|
59
|
+
member: shown(baseline), member_lines: lines.shown(taken: bytes_of(check)),
|
|
60
|
+
first_changed_lines: @acknowledgement.first_changed_lines(lines), commits: commits(baseline),
|
|
61
|
+
paths: @acknowledgement.paths_since(baseline)
|
|
62
|
+
)
|
|
63
|
+
{ change:, context: { **@acknowledgement.open_findings, **instruction_for(check) },
|
|
64
|
+
placeholders: MemberAcknowledgement.placeholders(check&.to_h, change) }
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# The record with the acknowledgement in it, once its quotes are found at the baseline and now, made to into
|
|
68
|
+
# when another member's acknowledgement in the same answer has already changed the record (#1169).
|
|
69
|
+
# acknowledging is the ids of every member the answer acknowledges, which its check may list: this member
|
|
70
|
+
# alone unless the answer is to several (#1276).
|
|
71
|
+
#: (untyped, at: String, ?acknowledging: Array[String], ?into: Models::AuditRecord?) -> Models::AuditRecord
|
|
72
|
+
def accepted(response, at:, acknowledging: [@member.id], into: nil)
|
|
73
|
+
_baseline, lines = since_baseline
|
|
74
|
+
@acknowledgement.accepted(response, lines, at:, into:, listed: listed(acknowledging))
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
private
|
|
78
|
+
|
|
79
|
+
# What the member's check lists now beside the members the answer acknowledges, when the check is this
|
|
80
|
+
# tool's own list-member-problems --short; nil for any other check (#1276).
|
|
81
|
+
#: (Array[String]) -> Models::ListedMembers?
|
|
82
|
+
def listed(acknowledging)
|
|
83
|
+
own_listing&.listed(@project, principle_id: @id, acknowledging:)
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# The request's check_instruction for a checked member, how to run and report its check; none without one (#1170).
|
|
87
|
+
#: (Views::OneMemberCheckResultTemplate?) -> Hash[String, String]
|
|
88
|
+
def instruction_for(check) = check ? { "check_instruction" => check.instruction } : {}
|
|
89
|
+
|
|
90
|
+
# The bytes the check's template and instruction take as the request prints them, which the member's lines
|
|
91
|
+
# give up (#1119).
|
|
92
|
+
#: (Views::OneMemberCheckResultTemplate?) -> Integer
|
|
93
|
+
def bytes_of(check) = check ? JSON.pretty_generate(check.to_h).bytesize + check.instruction.bytesize : 0
|
|
94
|
+
|
|
95
|
+
# The check_result a checked member's answer fills, for the check the last audit ran, which a one-member audit
|
|
96
|
+
# requires (D30, D63, #1071), asking for a passing run alone (#1112); nil for a member without a check.
|
|
97
|
+
#: () -> Views::OneMemberCheckResultTemplate?
|
|
98
|
+
def check_template
|
|
99
|
+
checks = Models::CheckSinceLastAudit.new(principle_history: principle_history(@id),
|
|
100
|
+
record: @audit_records.find(@id))
|
|
101
|
+
Views::OneMemberCheckResultTemplate.for(checks.entry(@member),
|
|
102
|
+
exit_status: Models::Acknowledgement::EXIT_STATUS_PLACEHOLDER,
|
|
103
|
+
own_listing: !own_listing.nil?)
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
# The member's check read as this tool's own list-member-problems --short; nil for any other (#1276).
|
|
107
|
+
#: () -> Models::ListMemberProblemsCheck?
|
|
108
|
+
def own_listing = Models::ListMemberProblemsCheck.of(@member.check.to_s)
|
|
109
|
+
|
|
110
|
+
# The member as the request shows it, with where it was at its baseline when it has moved since (#547).
|
|
111
|
+
#: (Models::Placement) -> Hash[String, untyped]
|
|
112
|
+
def shown(baseline)
|
|
113
|
+
moved_from = @acknowledgement.moved_from(baseline)
|
|
114
|
+
{ "id" => @member.id, "role" => @member.role, **(@member.check ? { "check" => @member.check } : {}),
|
|
115
|
+
"evidence" => [@member.reference],
|
|
116
|
+
**(moved_from ? { "evidence_at_baseline" => [moved_from] } : {}) }
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
# The commits the request names: the baseline's, HEAD, and the audit's base when the baseline is later (#550).
|
|
120
|
+
#: (Models::Placement) -> Hash[String, String]
|
|
121
|
+
def commits(baseline)
|
|
122
|
+
audit_base = @acknowledgement.audit_base(baseline)
|
|
123
|
+
{ "baseline" => baseline.commit, "base" => @base.to_s, **(audit_base ? { "audit_base" => audit_base } : {}) }
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
# The member's baseline, the oldest commit from the one it was last judged at that holds the text the audit
|
|
127
|
+
# record vouches for, placed as that commit's map placed it or as it is placed now (#547, #550), and its own
|
|
128
|
+
# lines there and now, which the answer's quotes are checked against (#379).
|
|
129
|
+
#: () -> [Models::Placement, Models::MemberLines]
|
|
130
|
+
def since_baseline
|
|
131
|
+
baseline = @acknowledgement.baseline(@acknowledgement.placements_in(@project))
|
|
132
|
+
lines = @project.member_lines(@member.locator, since: baseline.commit, then_locator: baseline.locator)
|
|
133
|
+
[baseline, @acknowledgement.compared(lines)]
|
|
134
|
+
end
|
|
135
|
+
end
|
|
136
|
+
end
|
|
137
|
+
end
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# typed: strict
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require_relative "command"
|
|
5
|
+
require_relative "../models/member"
|
|
6
|
+
require_relative "../models/members_in_consecutive_sections"
|
|
7
|
+
require_relative "../models/member_loading_scopes"
|
|
8
|
+
require_relative "../views/map_added_to"
|
|
9
|
+
require_relative "../views/consecutive_sections_elsewhere"
|
|
10
|
+
require_relative "../views/new_loading_scope"
|
|
11
|
+
|
|
12
|
+
module Principles
|
|
13
|
+
module Controllers
|
|
14
|
+
# A located new member and its before-save map, with reminder facts captured before the map is written.
|
|
15
|
+
class MemberAddition < Command
|
|
16
|
+
#: (Models::Project, tool: RunningTool, map: Models::Principle, member: Hash[String, untyped]) -> void
|
|
17
|
+
def initialize(project, tool:, map:, member:)
|
|
18
|
+
super(project, tool: tool)
|
|
19
|
+
@map = map
|
|
20
|
+
@member = Models::Member.new(member) #: Models::Member
|
|
21
|
+
@joined = joined #: Views::MapAddedTo
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# Locate and report the added member after the caller saved exactly its new map.
|
|
25
|
+
#: (Views::PrintedPrinciple, added_to: Models::Principle) -> Hash[String, untyped]
|
|
26
|
+
def printed(principle, added_to:)
|
|
27
|
+
added = located_member
|
|
28
|
+
shared = lines_shared(@member, @map)
|
|
29
|
+
joined = joined_for(added_to)
|
|
30
|
+
sections = Models::MembersInConsecutiveSections.new(@project, @member).elsewhere(except: @map.id)
|
|
31
|
+
consecutive = Views::ConsecutiveSectionsElsewhere.new(sections)
|
|
32
|
+
map_result.member_added(principle, added: added, shared: shared, joined: joined, consecutive: consecutive)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
private
|
|
36
|
+
|
|
37
|
+
# The updated map's after-save context, keeping the reminder facts captured before the write.
|
|
38
|
+
#: (Models::Principle) -> Views::MapAddedTo
|
|
39
|
+
def joined_for(added_to)
|
|
40
|
+
no_completed = @audit_records.known_no_completed_audit?(@map.id)
|
|
41
|
+
joined = @joined.with_completeness_question(
|
|
42
|
+
asks: added_to.members.asks_about_completeness?(no_completed_audit: no_completed)
|
|
43
|
+
)
|
|
44
|
+
scopes = Models::MemberLoadingScopes.new(@project.member_loads(added_to.members))
|
|
45
|
+
joined.with_loading_scope(Views::NewLoadingScope.new(scopes.introduced_by(@member.id)))
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# The new member's id, current lines and stored check, located only after its map was saved.
|
|
49
|
+
#: () -> Hash[String, untyped]
|
|
50
|
+
def located_member
|
|
51
|
+
{ "id" => @member.id }.merge(snapshot(@member.locator).slice("first_line", "last_line"))
|
|
52
|
+
.merge(@member.to_h.slice("check"))
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# The history must inspect the old map before the write, so a batch repeats its reminders only once.
|
|
56
|
+
#: () -> Views::MapAddedTo
|
|
57
|
+
def joined
|
|
58
|
+
history = principle_history(@map.id)
|
|
59
|
+
Views::MapAddedTo.new(keeps_others_held: @map.keeps_others_held?,
|
|
60
|
+
correction_may_be_open: history.startable_at_head?,
|
|
61
|
+
reminded: history.first_add_since_commit?(@map))
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
4
|
require_relative "command"
|
|
5
|
+
require_relative "member_addition"
|
|
5
6
|
|
|
6
7
|
module Principles
|
|
7
8
|
# Each runs one command: reads models, applies their rules and prints through a view.
|
|
@@ -48,33 +49,14 @@ module Principles
|
|
|
48
49
|
started = !@principles.mapped?(id)
|
|
49
50
|
map = @principles.addable(id)
|
|
50
51
|
member = located(options, { "path" => text(options["path"], "PATH") }).merge(played(options))
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
addition = handed(MemberAddition, map: map, member: member)
|
|
53
|
+
updated = map.adding(member)
|
|
54
|
+
write_map(updated) do |printed|
|
|
55
|
+
added = addition.printed(printed, added_to: updated)
|
|
54
56
|
started ? added.merge(map_result.map_created(printed)) : added
|
|
55
57
|
end
|
|
56
58
|
end
|
|
57
59
|
|
|
58
|
-
# What add-member reports of the member it added to map: its id, lines and check, and the members, in
|
|
59
|
-
# this map or another, that share a line with it, so the agent sees an edit there shows on each (#383), and,
|
|
60
|
-
# when a correction may be open on map, how a fix claims the member (D72, #1023).
|
|
61
|
-
#: (Views::PrintedPrinciple, Models::Principle, Hash[String, untyped], Views::MapAddedTo) -> Hash[String, untyped]
|
|
62
|
-
def member_added(printed, map, member, joined)
|
|
63
|
-
added = Models::Member.new(member)
|
|
64
|
-
map_result.member_added(printed, added: span(member).merge(member.slice("check")),
|
|
65
|
-
shared: lines_shared(added, map), joined: joined)
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
# What add-member says of map, read before the member joins it and the map is saved, so the history can say
|
|
69
|
-
# whether this is the first add-member since the map was last committed (#1025).
|
|
70
|
-
#: (Models::Principle) -> Views::MapAddedTo
|
|
71
|
-
def joined(map)
|
|
72
|
-
history = principle_history(map.id)
|
|
73
|
-
Views::MapAddedTo.new(keeps_others_held: map.keeps_others_held?,
|
|
74
|
-
correction_may_be_open: history.startable_at_head?,
|
|
75
|
-
reminded: history.first_add_since_commit?(map))
|
|
76
|
-
end
|
|
77
|
-
|
|
78
60
|
# The part a new member plays, and the check that enforces it when one is named (D30).
|
|
79
61
|
#: (Hash[String, untyped]) -> Hash[String, untyped]
|
|
80
62
|
def played(options)
|
|
@@ -153,7 +135,7 @@ module Principles
|
|
|
153
135
|
LOCATION_OPTIONS.each { |key, flag| member[key] = text(options[key], flag) if options[key] }
|
|
154
136
|
place = Models::Member.new(member)
|
|
155
137
|
place.check_location
|
|
156
|
-
|
|
138
|
+
@project.locate_for_authoring(place.locator)
|
|
157
139
|
member
|
|
158
140
|
end
|
|
159
141
|
end
|
|
@@ -34,46 +34,54 @@ module Principles
|
|
|
34
34
|
.printed(after: options.fetch("commits_after"), event: event)
|
|
35
35
|
end
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
return report.merge("wrote" => []) unless options["short"]
|
|
37
|
+
return checked_report(id).merge("wrote" => []) unless options["short"]
|
|
39
38
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
short(id, session_start: options["session_start"])
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# list-member-problems --short's lines for map id, or every map, and the exit status they end with; with
|
|
43
|
+
# --session-start, a count and command per principle in place of the rows (#1261).
|
|
44
|
+
# session_start is the source --session-start names, or nil without it.
|
|
45
|
+
#: (String?, session_start: String?) -> Views::Lines
|
|
46
|
+
def short(id, session_start:)
|
|
47
|
+
# Its stderr names the project once, so its commands leave it out (#1263).
|
|
48
|
+
problems, (report, names_a_command) = checked(id, invocation.without_project)
|
|
49
|
+
view = Views::ProblemLines.new(invocation)
|
|
50
|
+
lines = view.short(report, nothing_changed: Views::ProblemResult::NOTHING_CHANGED,
|
|
51
|
+
assessed_change: problems.assessed_change?,
|
|
52
|
+
never_assessed: problems.never_assessed, names_a_command:)
|
|
53
|
+
return lines unless session_start
|
|
54
|
+
|
|
55
|
+
view.at_session_start(lines, changed: problems.assessed_changes, source: session_start)
|
|
43
56
|
end
|
|
44
57
|
|
|
45
58
|
# list-member-problems' JSON result for map id, or every map, without the files it wrote.
|
|
46
59
|
#: (String?) -> Hash[String, untyped]
|
|
47
|
-
def checked_report(id) = checked(id).last
|
|
60
|
+
def checked_report(id) = checked(id).last.first
|
|
48
61
|
|
|
49
|
-
# The problems of map id, or every map, and list-member-problems' JSON result for them,
|
|
50
|
-
# whose record a later copy wrote as waiting on an upgrade,
|
|
51
|
-
|
|
52
|
-
|
|
62
|
+
# The problems of map id, or every map, and list-member-problems' JSON result for them, with whether its
|
|
63
|
+
# next_action names a command, naming each principle whose record a later copy wrote as waiting on an upgrade,
|
|
64
|
+
# its members compared read-only (D85 V8, #1066). printing is the invocation its commands name.
|
|
65
|
+
#: (String?, ?Views::Invocation) -> [Models::ProblemReport, [Hash[String, untyped], bool]]
|
|
66
|
+
def checked(id, printing = invocation)
|
|
53
67
|
waiting = (id ? [id] : @principles.ids).filter_map { waiting_on_an_upgrade(it) }
|
|
54
|
-
problems = Models::ProblemReport.
|
|
55
|
-
[problems, member_problems(problems, waiting)]
|
|
68
|
+
problems = Models::ProblemReport.for(@project, id)
|
|
69
|
+
[problems, member_problems(problems, waiting, printing)]
|
|
56
70
|
end
|
|
57
71
|
|
|
58
72
|
# The result for problems, every member of map id or of every map that is broken or whose own text changed
|
|
59
73
|
# (#187), and each principle waiting on an upgrade.
|
|
60
|
-
#: (Models::ProblemReport, Array[Views::RecordWaitingOnAnUpgrade])
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
74
|
+
#: (Models::ProblemReport, Array[Views::RecordWaitingOnAnUpgrade], Views::Invocation)
|
|
75
|
+
#| -> [Hash[String, untyped], bool]
|
|
76
|
+
def member_problems(problems, waiting, printing)
|
|
77
|
+
report = problems.checked do |map_id, member, baseline, now, mapping|
|
|
78
|
+
@project.principle_history(map_id, mapping: mapping).member_history(member, baseline: baseline, now: now)
|
|
64
79
|
end
|
|
65
|
-
Views::ProblemResult.new(
|
|
80
|
+
Views::ProblemResult.new(printing)
|
|
81
|
+
.checked_naming_commands(report, not_read: @project.unread_older_files,
|
|
66
82
|
no_baseline_files: problems.files_to_commit(@principles),
|
|
67
83
|
acknowledgeable: problems.acknowledgeable, waiting:)
|
|
68
84
|
end
|
|
69
|
-
|
|
70
|
-
# Map id's members against their baselines, or every map's, listing a map it cannot read among them.
|
|
71
|
-
#: (String?) -> Array[Models::MemberProblems]
|
|
72
|
-
def problems_of(id)
|
|
73
|
-
return [Models::MemberProblems.for(@project, id)] if id
|
|
74
|
-
|
|
75
|
-
@principles.ids.map { Models::MemberProblems.for(@project, it, listing_all: true) }
|
|
76
|
-
end
|
|
77
85
|
end
|
|
78
86
|
end
|
|
79
87
|
end
|
|
@@ -39,7 +39,7 @@ module Principles
|
|
|
39
39
|
@principle_id = principle_id
|
|
40
40
|
@record = @audit_records.find(principle_id) #: Models::AuditRecord?
|
|
41
41
|
@completed = @record&.last_completed #: Models::AuditRecord?
|
|
42
|
-
@checks = Models::CheckSinceLastAudit.new(
|
|
42
|
+
@checks = Models::CheckSinceLastAudit.new(principle_history: principle_history(principle_id),
|
|
43
43
|
record: @record) #: Models::CheckSinceLastAudit
|
|
44
44
|
end
|
|
45
45
|
|
|
@@ -43,7 +43,7 @@ module Principles
|
|
|
43
43
|
#: (Models::Principle) -> Views::MetaPrincipleResult::MapInProject
|
|
44
44
|
def map_in_project(map)
|
|
45
45
|
Views::MetaPrincipleResult::MapInProject.new(
|
|
46
|
-
already_mapped: @principles.mapped?(map.id), members_in_entry_files: map.members_in(Models::EntryFiles::PATHS),
|
|
46
|
+
already_mapped: @principles.mapped?(map.id), members_in_entry_files: map.members.members_in(Models::EntryFiles::PATHS),
|
|
47
47
|
set_up: @principles.set_up?
|
|
48
48
|
)
|
|
49
49
|
end
|