principles 0.0.6 → 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/cli.rb +9 -0
- data/lib/principles/command_line.rb +22 -5
- data/lib/principles/command_routes.rb +2 -2
- data/lib/principles/controllers/acknowledgement.rb +79 -102
- data/lib/principles/controllers/answer.rb +7 -6
- data/lib/principles/controllers/assessment.rb +13 -21
- data/lib/principles/controllers/audit.rb +24 -4
- data/lib/principles/controllers/audit_completion.rb +7 -3
- data/lib/principles/controllers/correction.rb +13 -6
- data/lib/principles/controllers/full_audit_request.rb +7 -2
- data/lib/principles/controllers/member_acknowledgement.rb +137 -0
- data/lib/principles/controllers/member_problems_report.rb +31 -23
- data/lib/principles/data/command-steps.json +9 -9
- data/lib/principles/data/schemas/acknowledgement-answer.schema.json +3 -2
- data/lib/principles/data/schemas/acknowledgements-answer.schema.json +88 -0
- 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.schema.json +6 -54
- 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 +18 -36
- data/lib/principles/models/acknowledgement_left_as_printed.rb +25 -4
- 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_record.rb +5 -0
- data/lib/principles/models/correction_basis.rb +14 -5
- data/lib/principles/models/list_member_problems_check.rb +80 -0
- data/lib/principles/models/listed_members.rb +49 -0
- data/lib/principles/models/loading_decision.rb +17 -8
- data/lib/principles/models/loads_to_check.rb +0 -1
- data/lib/principles/models/member_assessments.rb +11 -2
- data/lib/principles/models/member_problems.rb +9 -5
- data/lib/principles/models/member_sighting.rb +5 -8
- data/lib/principles/models/problem_report.rb +19 -4
- data/lib/principles/models/project.rb +5 -4
- data/lib/principles/models/reported_check.rb +14 -11
- data/lib/principles/models/request_id.rb +1 -1
- data/lib/principles/models/sent_answer.rb +29 -9
- data/lib/principles/positional_arguments.rb +3 -2
- 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 +46 -12
- data/lib/principles/views/assessed_members.rb +26 -5
- data/lib/principles/views/assessment_request.rb +22 -3
- data/lib/principles/views/audit_result.rb +9 -1
- data/lib/principles/views/check_result_template.rb +18 -17
- data/lib/principles/views/correction_request.rb +6 -9
- data/lib/principles/views/findings_result.rb +21 -0
- data/lib/principles/views/invocation.rb +19 -4
- data/lib/principles/views/loads_to_check_result.rb +3 -2
- 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/one_member_check_result_template.rb +21 -9
- data/lib/principles/views/open_findings_line.rb +2 -1
- data/lib/principles/views/problem_lines.rb +48 -45
- data/lib/principles/views/problem_result.rb +55 -26
- 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/say-whether-each-change-keeps-its-meaning.md +8 -0
- 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/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-member-problems.md +15 -15
- 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/show-answer-check.md +7 -7
- data/lib/principles/views/prompts/learn-what-a-command-does/start-audit.md +8 -8
- data/lib/principles/views/prompts/learn-what-a-command-does/submit-answer.md +37 -37
- 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 +13 -1
|
@@ -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
|
|
@@ -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
|
-
|
|
74
|
+
#: (Models::ProblemReport, Array[Views::RecordWaitingOnAnUpgrade], Views::Invocation)
|
|
75
|
+
#| -> [Hash[String, untyped], bool]
|
|
76
|
+
def member_problems(problems, waiting, printing)
|
|
62
77
|
report = problems.checked do |map_id, member, baseline, now, mapping|
|
|
63
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
|
|
@@ -70,12 +70,12 @@
|
|
|
70
70
|
]
|
|
71
71
|
},
|
|
72
72
|
{
|
|
73
|
-
"name": "list-member-problems", "usage": "list-member-problems [ID] [--short | --commits-after COMMIT --hook-event EVENT]", "group": "read", "options": ["short", "commits-after", "hook-event"],
|
|
73
|
+
"name": "list-member-problems", "usage": "list-member-problems [ID] [--short | --commits-after COMMIT --hook-event EVENT]", "group": "read", "options": ["short", "session-start", "commits-after", "hook-event"],
|
|
74
74
|
"summary": "Members whose reference is broken, or whose own text changed since their baseline.",
|
|
75
75
|
"help": "learn-what-a-command-does/list-member-problems",
|
|
76
76
|
"steps": [
|
|
77
77
|
{ "id": "compare-members-with-their-baselines", "actor": "cli",
|
|
78
|
-
"does": "Finds each member of map ID, or of every map, and compares its own text with the last audit's hash for it, or else with its text at the commit that mapped it where it is. Refuses while any member cannot be found or read, or a map cannot be read, so a gate can stop on the exit status; otherwise lists each changed member with what it was compared with, and counts every state. With --short, prints one tab-separated line per changed member
|
|
78
|
+
"does": "Finds each member of map ID, or of every map, and compares its own text with the last audit's hash for it, or else with its text at the commit that mapped it where it is. Refuses while any member cannot be found or read, or a map cannot be read, so a gate can stop on the exit status; otherwise lists each changed member with what it was compared with, and counts every state. With --short, prints one tab-separated line per changed member, then one per principle counting its members no audit has assessed, and exits 3 when it prints any line.",
|
|
79
79
|
"refuses": ["broken_members"], "refuses_like": ["read-map", "read-audit"] },
|
|
80
80
|
{ "id": "repair-or-audit", "actor": "agent",
|
|
81
81
|
"does": "For a refusal, say whether each listed member moved or is gone, and repair it. For a changed member, audit its principle when the change was meant to alter the principle.",
|
|
@@ -104,12 +104,12 @@
|
|
|
104
104
|
]
|
|
105
105
|
},
|
|
106
106
|
{
|
|
107
|
-
"name": "list-open-findings", "usage": "list-open-findings [ID] [--short [--session-start SOURCE]]", "group": "read", "options": ["short", "session-start"],
|
|
107
|
+
"name": "list-open-findings", "usage": "list-open-findings [ID] [--lines | --short [--session-start SOURCE]]", "group": "read", "options": ["short", "session-start", "lines"],
|
|
108
108
|
"summary": "The findings the last audit of each principle deferred or accepted, and where each is written up.",
|
|
109
109
|
"help": "learn-what-a-command-does/list-open-findings",
|
|
110
110
|
"steps": [
|
|
111
111
|
{ "id": "read-open-findings", "actor": "cli",
|
|
112
|
-
"does": "Reads the last audit record of principle ID, or of every principle, and lists each deferred or accepted finding with its action, its members, its recorded_at pointer and when the audit was made. Says that an earlier audit's open findings are only in git. With --short, prints one line saying how many are open, how long the oldest has waited and what it waits on, and nothing when none is open; --session-start clear or compact words it for a context just cleared or compacted, and resume shortens it to the facts, since a resumed conversation holds the whole line already.",
|
|
112
|
+
"does": "Reads the last audit record of principle ID, or of every principle, and lists each deferred or accepted finding with its action, its members, its recorded_at pointer and when the audit was made. Says that an earlier audit's open findings are only in git. With --lines, prints each open finding on a line with its principle, id and waits_on. With --short, prints one line saying how many are open, how long the oldest has waited and what it waits on, and nothing when none is open; --session-start clear or compact words it for a context just cleared or compacted, and resume shortens it to the facts, since a resumed conversation holds the whole line already.",
|
|
113
113
|
"refuses_like": ["read-map", "read-audit"] },
|
|
114
114
|
{ "id": "follow-up-each-finding", "actor": "agent",
|
|
115
115
|
"does": "Read each finding where its recorded_at points, and decide each one at its principle's next full audit.",
|
|
@@ -118,7 +118,7 @@
|
|
|
118
118
|
]
|
|
119
119
|
},
|
|
120
120
|
{
|
|
121
|
-
"name": "show-answer-check", "usage": "show-answer-check REQUEST_ID --file FILE|-", "group": "read", "options": ["file"], "requires": ["file"],
|
|
121
|
+
"name": "show-answer-check", "usage": "show-answer-check [REQUEST_ID] --file FILE|-", "group": "read", "options": ["file"], "requires": ["file"],
|
|
122
122
|
"summary": "Check an answer without submitting it.",
|
|
123
123
|
"help": "learn-what-a-command-does/show-answer-check",
|
|
124
124
|
"steps": [
|
|
@@ -259,7 +259,7 @@
|
|
|
259
259
|
]
|
|
260
260
|
},
|
|
261
261
|
{
|
|
262
|
-
"name": "start-audit", "usage": "start-audit ID [--member MEMBER | --write-ups] [--as template | --instruction FIELD]", "group": "write-audit-record", "options": ["member", "write-ups", "as", "instruction"],
|
|
262
|
+
"name": "start-audit", "usage": "start-audit ID [--member MEMBER ... | --write-ups] [--as template | --instruction FIELD]", "group": "write-audit-record", "options": ["member", "write-ups", "as", "instruction"],
|
|
263
263
|
"summary": "Ask for an assessment of every member and the set.",
|
|
264
264
|
"help": "learn-what-a-command-does/start-audit",
|
|
265
265
|
"steps": [
|
|
@@ -270,7 +270,7 @@
|
|
|
270
270
|
{ "to": "start-acknowledgement", "when": "you passed --member" },
|
|
271
271
|
{ "to": "start-repointing", "when": "you passed --write-ups" }] },
|
|
272
272
|
{ "id": "assess-every-member", "actor": "agent",
|
|
273
|
-
"does": "Assess each member not carried forward, and any carried one whose sighting is too old to stand behind, the set as a whole and one decision you made recently under it, with a finding for each problem. Decide each prior finding and member to check against the activation
|
|
273
|
+
"does": "Assess each member not carried forward, and any carried one whose sighting is too old to stand behind, the set as a whole and one decision you made recently under it, with a finding for each problem. Run each check, carried_checks_to_run's too, per check_instructions. Decide each prior finding and listed member to check against the activation.",
|
|
274
274
|
"prompt": "assess-every-member/assess-each-member-and-the-set",
|
|
275
275
|
"checks": "every member is assessed or carried forward once, a marker only where the request carries the member, and each piece of evidence resolves to project text that has not changed since the request.",
|
|
276
276
|
"cannot_check": "whether your assessment is true, a member reached your context, or your findings are the right ones.",
|
|
@@ -290,12 +290,12 @@
|
|
|
290
290
|
]
|
|
291
291
|
},
|
|
292
292
|
{
|
|
293
|
-
"name": "submit-answer", "usage": "submit-answer REQUEST_ID --file FILE|-", "group": "write-audit-record", "options": ["file"], "requires": ["file"],
|
|
293
|
+
"name": "submit-answer", "usage": "submit-answer [REQUEST_ID] --file FILE|-", "group": "write-audit-record", "options": ["file"], "requires": ["file"],
|
|
294
294
|
"summary": "Give the answer a request asked for.",
|
|
295
295
|
"help": "learn-what-a-command-does/submit-answer",
|
|
296
296
|
"steps": [
|
|
297
297
|
{ "id": "match-request", "actor": "cli",
|
|
298
|
-
"does": "Reads FILE, or stdin for -, and
|
|
298
|
+
"does": "Reads FILE, or stdin for -, and takes its request_id, an id this tool prints, as the request; REQUEST_ID, when given, must match.",
|
|
299
299
|
"refuses": ["unparseable_json", "unreadable_file", "request_mismatch", "unknown_request"], "refuses_like": ["rewrite-audit"],
|
|
300
300
|
"next": [{ "to": "acknowledge-the-change", "when": "the request was a one-member audit" },
|
|
301
301
|
{ "to": "record-the-repoints", "when": "the request was a repoint of write-ups" },
|
|
@@ -27,11 +27,12 @@
|
|
|
27
27
|
"x-unread-field-advice": {
|
|
28
28
|
"not_run_reason": "a check that cannot be run here needs a full audit: start one instead"
|
|
29
29
|
},
|
|
30
|
-
"description": "The result of the member's check, which the answer reports when the member has one: the command as the map names it, or left out to read as the request printed it (#1166), and its exit_status, which must be 0, since a check that fails or cannot be run is a full audit's to judge, with review_basis when a new line says what its review rested on (D30, D63, #1115). Models::ReportedCheck checks it.",
|
|
30
|
+
"description": "The result of the member's check, which the answer reports when the member has one: the command as the map names it, or left out to read as the request printed it (#1166), and its exit_status, which must be 0, since a check that fails or cannot be run is a full audit's to judge, with review_basis when a new line says what its review rested on (D30, D63, #1115); for this tool's own list-member-problems --short, which exits 3 while it lists the member, 3 with the member ids it lists under listed_members, each one this answer acknowledges (#1276). Models::ReportedCheck checks it.",
|
|
31
31
|
"properties": {
|
|
32
32
|
"command": { "type": "string" },
|
|
33
33
|
"exit_status": { "type": ["integer", "string"] },
|
|
34
|
-
"review_basis": { "type": "string" }
|
|
34
|
+
"review_basis": { "type": "string" },
|
|
35
|
+
"listed_members": { "type": "array", "items": { "type": "string" } }
|
|
35
36
|
}
|
|
36
37
|
}
|
|
37
38
|
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "acknowledgements-answer.schema.json",
|
|
4
|
+
"title": "Acknowledgements answer",
|
|
5
|
+
"description": "What an agent answers a request to acknowledge several members of one principle with (#1169): the request's id, its basis naming each member, and under members one entry per member, keyed by its id, holding what a one-member answer holds beside its head. Fields this tool does not read are refused (D29). Models::Acknowledgements refuses an answer whose members differ from its basis, and each entry is checked as Models::Acknowledgement checks a one-member answer.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"required": [
|
|
9
|
+
"request_id",
|
|
10
|
+
"basis",
|
|
11
|
+
"members"
|
|
12
|
+
],
|
|
13
|
+
"properties": {
|
|
14
|
+
"request_id": {
|
|
15
|
+
"type": "string"
|
|
16
|
+
},
|
|
17
|
+
"basis": {
|
|
18
|
+
"type": "object",
|
|
19
|
+
"additionalProperties": false,
|
|
20
|
+
"required": [
|
|
21
|
+
"member_ids"
|
|
22
|
+
],
|
|
23
|
+
"properties": {
|
|
24
|
+
"member_ids": {
|
|
25
|
+
"type": "array",
|
|
26
|
+
"items": {
|
|
27
|
+
"type": "string"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"members": {
|
|
33
|
+
"type": "object",
|
|
34
|
+
"additionalProperties": {
|
|
35
|
+
"type": "object",
|
|
36
|
+
"additionalProperties": false,
|
|
37
|
+
"description": "One member's judgement, read as a one-member answer's fields beside its request_id and basis are read (acknowledgement-answer.schema.json).",
|
|
38
|
+
"required": [
|
|
39
|
+
"meaning_kept",
|
|
40
|
+
"reason"
|
|
41
|
+
],
|
|
42
|
+
"properties": {
|
|
43
|
+
"meaning_kept": {
|
|
44
|
+
"type": "boolean"
|
|
45
|
+
},
|
|
46
|
+
"reason": {
|
|
47
|
+
"type": "string",
|
|
48
|
+
"minLength": 1
|
|
49
|
+
},
|
|
50
|
+
"old_line": {
|
|
51
|
+
"type": "string"
|
|
52
|
+
},
|
|
53
|
+
"new_line": {
|
|
54
|
+
"type": "string"
|
|
55
|
+
},
|
|
56
|
+
"check_result": {
|
|
57
|
+
"type": "object",
|
|
58
|
+
"additionalProperties": false,
|
|
59
|
+
"x-unread-field-advice": {
|
|
60
|
+
"not_run_reason": "a check that cannot be run here needs a full audit: start one instead"
|
|
61
|
+
},
|
|
62
|
+
"description": "The result of the member's check, which the answer reports when the member has one: the command as the map names it, or left out to read as the request printed it (#1166), and its exit_status, which must be 0, since a check that fails or cannot be run is a full audit's to judge, with review_basis when a new line says what its review rested on (D30, D63, #1115); for this tool's own list-member-problems --short, which exits 3 while it lists the member, 3 with the member ids it lists under listed_members, each one this answer acknowledges (#1276). Models::ReportedCheck checks it.",
|
|
63
|
+
"properties": {
|
|
64
|
+
"command": {
|
|
65
|
+
"type": "string"
|
|
66
|
+
},
|
|
67
|
+
"exit_status": {
|
|
68
|
+
"type": [
|
|
69
|
+
"integer",
|
|
70
|
+
"string"
|
|
71
|
+
]
|
|
72
|
+
},
|
|
73
|
+
"review_basis": {
|
|
74
|
+
"type": "string"
|
|
75
|
+
},
|
|
76
|
+
"listed_members": {
|
|
77
|
+
"type": "array",
|
|
78
|
+
"items": {
|
|
79
|
+
"type": "string"
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"observed_at": {
|
|
72
72
|
"type": ["string", "null"],
|
|
73
73
|
"minLength": 1,
|
|
74
|
-
"description": "On an observed delivery only, when the agent saw what observation describes, if that was before this audit; omitted or null, it is this audit's time, so the agent never types a clock time (#716). Models::MemberSighting refuses it on not_observed, one not a
|
|
74
|
+
"description": "On an observed delivery only, when the agent saw what observation describes, if that was before this audit; omitted or null, it is this audit's time, so the agent never types a clock time (#716). Models::MemberSighting refuses it on not_observed, one not a time to the second as audited_at is, such as 2026-11-01T09:30:00Z, whose UTC offset, such as +05:30, it reads as the same instant in UTC (#1187), and one after the answer (#699), and refuses an observation repeated word for word from the last full audit as observation_repeats_last_audit unless it is that audit's date or null (#680, #716)."
|
|
75
75
|
},
|
|
76
76
|
"evidence": {
|
|
77
77
|
"type": "array",
|
|
@@ -130,6 +130,20 @@
|
|
|
130
130
|
"type": "string",
|
|
131
131
|
"description": "The note start-audit --as template prints at its head saying how a field left as printed is read, which an answer may send back and Models::AssessmentAnswer ignores, whatever it holds (#1043, D88)."
|
|
132
132
|
},
|
|
133
|
+
"carried_checks_to_run": {
|
|
134
|
+
"type": "array",
|
|
135
|
+
"items": {
|
|
136
|
+
"type": "string"
|
|
137
|
+
},
|
|
138
|
+
"description": "The carried members whose check start-audit --as template still asks to run, which an answer may send back and Models::AssessmentAnswer ignores (D12, D19)."
|
|
139
|
+
},
|
|
140
|
+
"check_instructions": {
|
|
141
|
+
"type": "object",
|
|
142
|
+
"additionalProperties": {
|
|
143
|
+
"type": "string"
|
|
144
|
+
},
|
|
145
|
+
"description": "How to run and report each checked member's check, by member id, which start-audit --as template prints at its head, and an answer may send back and Models::AssessmentAnswer ignores (#1191)."
|
|
146
|
+
},
|
|
133
147
|
"collective_assessment": {
|
|
134
148
|
"type": "string"
|
|
135
149
|
},
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"usage": { "$ref": "#/$defs/prose" },
|
|
73
73
|
"group": { "$ref": "#/$defs/slug" },
|
|
74
74
|
"options": { "type": "array", "uniqueItems": true,
|
|
75
|
-
"items": { "enum": ["description", "path", "section", "starting-at", "ending-at", "query", "role", "check", "file", "short", "session-start", "commits-after", "hook-event", "member", "when-files", "when-invoked", "always", "write-ups", "as", "instruction", "also", "confirm"] } },
|
|
75
|
+
"items": { "enum": ["description", "path", "section", "starting-at", "ending-at", "query", "role", "check", "file", "short", "session-start", "commits-after", "hook-event", "member", "when-files", "when-invoked", "always", "write-ups", "as", "instruction", "also", "confirm", "lines"] } },
|
|
76
76
|
"requires": { "type": "array", "uniqueItems": true, "items": { "enum": ["file"] } },
|
|
77
77
|
"summary": { "$ref": "#/$defs/prose" },
|
|
78
78
|
"help": { "type": "string", "pattern": "^[a-z]+(-[a-z]+)+/[a-z]+(-[a-z]+)+$" },
|
|
@@ -21,7 +21,8 @@
|
|
|
21
21
|
"base_commit",
|
|
22
22
|
"map_version",
|
|
23
23
|
"last_completed_revision",
|
|
24
|
-
"findings"
|
|
24
|
+
"findings",
|
|
25
|
+
"assessment_report_sha256"
|
|
25
26
|
],
|
|
26
27
|
"properties": {
|
|
27
28
|
"last_completed_revision": {
|
|
@@ -101,59 +102,10 @@
|
|
|
101
102
|
"items": { "type": "string" },
|
|
102
103
|
"description": "The paths the assessment's recent decision cites as evidence, which the record does not keep, carried so the completed audit asks to commit those that differ from HEAD (#860). Copy it as the template gives it."
|
|
103
104
|
},
|
|
104
|
-
"
|
|
105
|
-
"type": "
|
|
106
|
-
"
|
|
107
|
-
"
|
|
108
|
-
"type": "object",
|
|
109
|
-
"additionalProperties": false,
|
|
110
|
-
"properties": {
|
|
111
|
-
"check_result": {
|
|
112
|
-
"type": "object",
|
|
113
|
-
"additionalProperties": false,
|
|
114
|
-
"required": [
|
|
115
|
-
"command"
|
|
116
|
-
],
|
|
117
|
-
"properties": {
|
|
118
|
-
"command": {
|
|
119
|
-
"type": "string"
|
|
120
|
-
},
|
|
121
|
-
"exit_status": {
|
|
122
|
-
"type": "integer"
|
|
123
|
-
},
|
|
124
|
-
"not_run_reason": {
|
|
125
|
-
"type": "string"
|
|
126
|
-
},
|
|
127
|
-
"review_basis": {
|
|
128
|
-
"type": "string"
|
|
129
|
-
},
|
|
130
|
-
"review_basis_since": {
|
|
131
|
-
"type": "string"
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
},
|
|
135
|
-
"loading_accepted": {
|
|
136
|
-
"type": "object",
|
|
137
|
-
"additionalProperties": false,
|
|
138
|
-
"required": [
|
|
139
|
-
"reason",
|
|
140
|
-
"loads"
|
|
141
|
-
],
|
|
142
|
-
"properties": {
|
|
143
|
-
"reason": {
|
|
144
|
-
"type": "string"
|
|
145
|
-
},
|
|
146
|
-
"loads": {
|
|
147
|
-
"type": "object"
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
},
|
|
151
|
-
"assessment": {
|
|
152
|
-
"type": "object",
|
|
153
|
-
"description": "The member's assessment as the assessment gave it, with the grounds it was judged on, which the completed record keeps (D49)."
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
105
|
+
"assessment_report_sha256": {
|
|
106
|
+
"type": "string",
|
|
107
|
+
"pattern": "\\A[0-9a-f]{64}\\z",
|
|
108
|
+
"description": "A digest of the assessment the open audit record keeps, which the correction reads back from that record, so it is refused once the record changed or was discarded (D87). Copy it as the template gives it."
|
|
157
109
|
},
|
|
158
110
|
"prior_findings": {
|
|
159
111
|
"type": "object",
|
|
@@ -9,11 +9,12 @@ module Principles
|
|
|
9
9
|
class InvocationOptions
|
|
10
10
|
# The options that take a value; --help, -h and --version take none.
|
|
11
11
|
VALUE_OPTIONS = %w[project file description path section starting-at ending-at query role
|
|
12
|
-
check
|
|
12
|
+
check session-start commits-after hook-event as instruction].freeze #: Array[String]
|
|
13
13
|
# The options that take no value, as list-member-problems --short (#291).
|
|
14
|
-
FLAG_OPTIONS = %w[short when-invoked always write-ups confirm].freeze #: Array[String]
|
|
15
|
-
# The options that may be given more than once, each value kept in order, as change-activation --when-files
|
|
16
|
-
|
|
14
|
+
FLAG_OPTIONS = %w[short lines when-invoked always write-ups confirm].freeze #: Array[String]
|
|
15
|
+
# The options that may be given more than once, each value kept in order, as change-activation --when-files and
|
|
16
|
+
# start-audit --member (#1169).
|
|
17
|
+
LIST_OPTIONS = %w[when-files also member].freeze #: Array[String]
|
|
17
18
|
# The words that name an option taking the next word as its value.
|
|
18
19
|
VALUE_WORDS = (VALUE_OPTIONS + LIST_OPTIONS).map { |name| "--#{name}" }.freeze #: Array[String]
|
|
19
20
|
# Every word the parser reads as an option, which an option taking a value refuses as its value (#750).
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# typed: strict
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require_relative "invocation_options"
|
|
5
|
+
|
|
6
|
+
module Principles
|
|
7
|
+
# The options choosing which form list-open-findings prints, --lines or --short (#1156), and what is wrong with them
|
|
8
|
+
# as given, which CommandLine refuses as a usage error.
|
|
9
|
+
class ListOpenFindingsOptions
|
|
10
|
+
#: (InvocationOptions) -> void
|
|
11
|
+
def initialize(options)
|
|
12
|
+
@lines = !options.value("lines").nil? #: bool
|
|
13
|
+
@short = !options.value("short").nil? #: bool
|
|
14
|
+
freeze
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# What is wrong with the options as given, or nil when they fit.
|
|
18
|
+
#: () -> String?
|
|
19
|
+
def fault
|
|
20
|
+
"--lines and --short each print a different form of the list; give one" if @lines && @short
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|