principles 0.0.10 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +42 -0
- data/README.md +0 -2
- data/lib/principles/controllers/acknowledgement.rb +11 -4
- data/lib/principles/controllers/acknowledgements.rb +4 -4
- data/lib/principles/controllers/answer.rb +2 -2
- data/lib/principles/controllers/assessment.rb +20 -4
- data/lib/principles/controllers/audit.rb +16 -5
- data/lib/principles/controllers/broken_member_repairs.rb +60 -0
- data/lib/principles/controllers/command.rb +8 -30
- data/lib/principles/controllers/correction.rb +7 -5
- data/lib/principles/controllers/full_audit_request.rb +44 -22
- data/lib/principles/controllers/guidance_search_paths.rb +1 -1
- data/lib/principles/controllers/inventory.rb +3 -3
- data/lib/principles/controllers/member_acknowledgement.rb +5 -5
- data/lib/principles/controllers/member_addition.rb +5 -2
- data/lib/principles/controllers/member_entries.rb +1 -1
- data/lib/principles/controllers/member_problems_report.rb +11 -7
- data/lib/principles/controllers/members_to_assess.rb +1 -1
- data/lib/principles/controllers/meta_principle_setup.rb +4 -3
- data/lib/principles/controllers/open_correction.rb +3 -3
- data/lib/principles/controllers/open_finding_decisions.rb +66 -0
- data/lib/principles/controllers/running_tool.rb +22 -5
- data/lib/principles/controllers/survey.rb +3 -2
- data/lib/principles/data/candidate_files_found.rb +6 -4
- data/lib/principles/data/command-steps.json +20 -20
- data/lib/principles/data/json_text.rb +5 -1
- data/lib/principles/data/parser_message.rb +61 -0
- data/lib/principles/data/project_files.rb +4 -2
- data/lib/principles/data/repository.rb +4 -4
- data/lib/principles/data/running_version.rb +1 -1
- data/lib/principles/data/schemas/audit-record.schema.json +15 -0
- data/lib/principles/data/schemas/command-steps.schema.json +1 -1
- data/lib/principles/data/schemas/{repointing-answer.schema.json → deciding-answer.schema.json} +12 -6
- data/lib/principles/invocation_options.rb +4 -4
- data/lib/principles/launch.rb +5 -3
- data/lib/principles/models/acknowledgement.rb +1 -27
- data/lib/principles/models/acknowledgement_left_as_printed.rb +2 -1
- data/lib/principles/models/acknowledgement_placeholders.rb +48 -0
- data/lib/principles/models/after_commit_input.rb +1 -0
- data/lib/principles/models/assessment_answer.rb +2 -2
- data/lib/principles/models/assessment_basis.rb +1 -1
- data/lib/principles/models/assessment_left_as_printed.rb +1 -1
- data/lib/principles/models/audit.rb +24 -4
- data/lib/principles/models/audit_entry_protecting_map.rb +1 -0
- data/lib/principles/models/audit_record.rb +5 -14
- data/lib/principles/models/audit_records.rb +2 -2
- data/lib/principles/models/audited_member_lines.rb +1 -1
- data/lib/principles/models/candidate_files.rb +1 -1
- data/lib/principles/models/candidate_inventory.rb +20 -10
- data/lib/principles/models/candidate_outline.rb +1 -1
- data/lib/principles/models/changed_regions.rb +1 -1
- data/lib/principles/models/command_steps.rb +1 -2
- data/lib/principles/models/correction_basis.rb +1 -1
- data/lib/principles/models/declared_map_changes.rb +1 -2
- data/lib/principles/models/disposition.rb +12 -76
- data/lib/principles/models/disposition_placeholders.rb +48 -0
- data/lib/principles/models/disposition_text_field.rb +41 -0
- data/lib/principles/models/evidence_item.rb +1 -1
- data/lib/principles/models/finding_decision.rb +84 -0
- data/lib/principles/models/finding_write_ups.rb +2 -1
- data/lib/principles/models/first_full_audit.rb +1 -0
- data/lib/principles/models/fix_only_fields.rb +4 -3
- data/lib/principles/models/frontmatter_fields.rb +1 -1
- data/lib/principles/models/guidance_search_path.rb +1 -1
- data/lib/principles/models/guidance_search_paths.rb +5 -1
- data/lib/principles/models/head_moves.rb +1 -0
- data/lib/principles/models/ignored_candidates.rb +1 -1
- data/lib/principles/models/instruction_named.rb +1 -1
- data/lib/principles/models/json_path_query.rb +1 -1
- data/lib/principles/models/json_path_selectors.rb +1 -1
- data/lib/principles/models/json_path_string.rb +1 -1
- data/lib/principles/models/last_completed_revision.rb +1 -1
- data/lib/principles/models/line_diff.rb +1 -1
- data/lib/principles/models/line_span.rb +1 -1
- data/lib/principles/models/loading_scope.rb +1 -0
- data/lib/principles/models/located_text.rb +20 -12
- data/lib/principles/models/map_change.rb +66 -0
- data/lib/principles/models/mapped_principles.rb +4 -0
- data/lib/principles/models/markdown_file.rb +22 -1
- data/lib/principles/models/member.rb +1 -1
- data/lib/principles/models/member_assessments.rb +11 -4
- data/lib/principles/models/member_elsewhere.rb +1 -1
- data/lib/principles/models/member_file.rb +15 -13
- data/lib/principles/models/member_hashes_as_written.rb +2 -2
- data/lib/principles/models/member_history.rb +1 -1
- data/lib/principles/models/member_lines.rb +1 -1
- data/lib/principles/models/member_loading_scopes.rb +1 -0
- data/lib/principles/models/member_mapping_run.rb +4 -4
- data/lib/principles/models/member_moves.rb +1 -2
- data/lib/principles/models/member_problems.rb +5 -1
- data/lib/principles/models/member_region.rb +1 -1
- data/lib/principles/models/member_repair_moves.rb +20 -4
- data/lib/principles/models/member_snapshots.rb +10 -10
- data/lib/principles/models/members_elsewhere.rb +1 -1
- data/lib/principles/models/members_in_consecutive_sections.rb +1 -0
- data/lib/principles/models/members_sharing_lines.rb +2 -2
- data/lib/principles/models/misspelt_member_id.rb +10 -4
- data/lib/principles/models/named_placeholder.rb +32 -0
- data/lib/principles/models/open_finding.rb +4 -3
- data/lib/principles/models/open_findings_decision.rb +124 -0
- data/lib/principles/models/open_findings_elsewhere.rb +1 -1
- data/lib/principles/models/other_templates_placeholders.rb +26 -6
- data/lib/principles/models/outline_budget.rb +1 -1
- data/lib/principles/models/outline_group.rb +1 -1
- data/lib/principles/models/outline_section.rb +1 -1
- data/lib/principles/models/part_named.rb +1 -1
- data/lib/principles/models/plain_text_file.rb +1 -1
- data/lib/principles/models/principle_history.rb +5 -4
- data/lib/principles/models/principle_members.rb +1 -1
- data/lib/principles/models/problem_report.rb +13 -1
- data/lib/principles/models/project.rb +15 -16
- data/lib/principles/models/project_at_commit.rb +60 -0
- data/lib/principles/models/project_history.rb +10 -52
- data/lib/principles/models/prose_line.rb +36 -0
- data/lib/principles/models/record_format.rb +17 -4
- data/lib/principles/models/recorded_finding.rb +47 -7
- data/lib/principles/models/recorded_findings.rb +7 -7
- data/lib/principles/models/recorded_hashes.rb +1 -1
- data/lib/principles/models/recorded_members.rb +6 -8
- data/lib/principles/models/report_hooks.rb +1 -0
- data/lib/principles/models/request_id.rb +2 -2
- data/lib/principles/models/sent_answer.rb +5 -3
- data/lib/principles/models/session_start_input.rb +1 -0
- data/lib/principles/models/stale_request.rb +22 -8
- data/lib/principles/models/submitted_answer.rb +1 -1
- data/lib/principles/models/survey_search_paths.rb +13 -5
- data/lib/principles/models/template_placeholders.rb +22 -7
- data/lib/principles/models/text_size.rb +11 -3
- data/lib/principles/models/text_within.rb +1 -1
- data/lib/principles/models/unchecked_members.rb +1 -0
- data/lib/principles/models/uncommitted_outside_the_map.rb +1 -1
- data/lib/principles/models/unfinished_field.rb +34 -0
- data/lib/principles/models/unknown_principle.rb +1 -0
- data/lib/principles/models/write_up_opening.rb +5 -31
- data/lib/principles/models/write_up_pointer.rb +2 -1
- data/lib/principles/start_audit_options.rb +35 -20
- data/lib/principles/version.rb +2 -2
- data/lib/principles/views/acknowledged_result.rb +59 -0
- data/lib/principles/views/acknowledgement_result.rb +44 -51
- data/lib/principles/views/added_member.rb +10 -1
- data/lib/principles/views/answer_in_a_file.rb +65 -0
- data/lib/principles/views/assessed_members.rb +4 -2
- data/lib/principles/views/assessment_answer_guide.rb +59 -0
- data/lib/principles/views/assessment_request.rb +2 -26
- data/lib/principles/views/audit_result.rb +18 -7
- data/lib/principles/views/candidate_files_result.rb +9 -4
- data/lib/principles/views/context_parts.rb +41 -10
- data/lib/principles/views/correction_request.rb +27 -18
- data/lib/principles/views/first_audit_brief.rb +2 -1
- data/lib/principles/views/guidance_search_paths_result.rb +13 -6
- data/lib/principles/views/invocation.rb +14 -4
- data/lib/principles/views/json_on_one_line.rb +18 -0
- data/lib/principles/views/member_repairs.rb +21 -5
- data/lib/principles/views/meta_principle_result.rb +26 -5
- data/lib/principles/views/open_findings_decision_result.rb +60 -0
- data/lib/principles/views/parts_index_result.rb +8 -6
- data/lib/principles/views/principle_read_result.rb +2 -2
- data/lib/principles/views/problem_facts.rb +46 -0
- data/lib/principles/views/problem_lines.rb +8 -3
- data/lib/principles/views/problem_result.rb +53 -31
- data/lib/principles/views/prompts/answer-any-judgement-request/fill-the-answer-in-a-file.md +6 -0
- data/lib/principles/views/prompts/assess-every-member/read-the-request-in-parts.md +2 -1
- data/lib/principles/views/prompts/decide-open-findings/give-only-what-changed-of-each.md +6 -0
- data/lib/principles/views/prompts/dispose-of-each-finding/answer-guide.json +1 -1
- data/lib/principles/views/prompts/dispose-of-each-finding/confirm-each-deferral-written-up-nowhere.md +2 -1
- data/lib/principles/views/prompts/dispose-of-each-finding/fix-or-record-each-finding.md +2 -2
- data/lib/principles/views/prompts/find-a-principle-to-map/where-a-survey-with-only-looks.md +4 -0
- data/lib/principles/views/prompts/learn-what-a-command-does/add-guidance-search-path.md +2 -1
- data/lib/principles/views/prompts/learn-what-a-command-does/add-member.md +1 -0
- data/lib/principles/views/prompts/learn-what-a-command-does/change-member-check.md +4 -3
- data/lib/principles/views/prompts/learn-what-a-command-does/change-member-role.md +4 -3
- data/lib/principles/views/prompts/learn-what-a-command-does/list-candidate-files.md +12 -12
- data/lib/principles/views/prompts/learn-what-a-command-does/list-member-problems.md +7 -8
- data/lib/principles/views/prompts/learn-what-a-command-does/list-open-findings.md +11 -12
- data/lib/principles/views/prompts/learn-what-a-command-does/move-member.md +4 -3
- data/lib/principles/views/prompts/learn-what-a-command-does/remove-member-check.md +4 -3
- data/lib/principles/views/prompts/learn-what-a-command-does/remove-member.md +4 -3
- data/lib/principles/views/prompts/learn-what-a-command-does/report-at-session-start.md +13 -12
- data/lib/principles/views/prompts/learn-what-a-command-does/show-answer-check.md +2 -2
- data/lib/principles/views/prompts/learn-what-a-command-does/show-open-correction.md +2 -2
- data/lib/principles/views/prompts/learn-what-a-command-does/start-audit.md +12 -12
- data/lib/principles/views/prompts/run-a-first-audit-in-the-background/follow-the-brief.md +1 -1
- data/lib/principles/views/prompts/start-a-session/act-on-the-changed-principles.md +2 -0
- data/lib/principles/views/prompts.rb +7 -4
- metadata +26 -8
- data/lib/principles/controllers/repoint.rb +0 -67
- data/lib/principles/models/repoint.rb +0 -125
- data/lib/principles/models/write_up_repoint.rb +0 -38
- data/lib/principles/views/prompts/repoint-write-ups/point-each-moved-write-up-at-its-new-place.md +0 -10
- data/lib/principles/views/repoint_result.rb +0 -80
|
@@ -45,10 +45,13 @@ module Principles
|
|
|
45
45
|
joined.with_loading_scope(Views::NewLoadingScope.new(scopes.introduced_by(@member.id)))
|
|
46
46
|
end
|
|
47
47
|
|
|
48
|
-
# The new member's id, current lines
|
|
48
|
+
# The new member's id, current lines, the line its paragraph or list item runs on to when it maps only the
|
|
49
|
+
# first, and its stored check, located only after its map was saved.
|
|
49
50
|
#: () -> Hash[String, untyped]
|
|
50
51
|
def located_member
|
|
51
|
-
|
|
52
|
+
continues = @project.continues_to(@member.locator)
|
|
53
|
+
{ "id" => @member.id }.merge(snapshot(@member.locator).lines)
|
|
54
|
+
.merge(continues ? { "continues_to_line" => continues } : {})
|
|
52
55
|
.merge(@member.to_h.slice("check"))
|
|
53
56
|
end
|
|
54
57
|
|
|
@@ -68,7 +68,7 @@ module Principles
|
|
|
68
68
|
#: (Hash[String, untyped]) -> Hash[String, untyped]
|
|
69
69
|
def span(member)
|
|
70
70
|
{ "id" => Models::Member.new(member).id }
|
|
71
|
-
.merge(snapshot(Models::Member.new(member).locator).
|
|
71
|
+
.merge(snapshot(Models::Member.new(member).locator).lines)
|
|
72
72
|
end
|
|
73
73
|
|
|
74
74
|
# Points an existing member at a new place (a narrower passage, a renamed heading, an anchor that was
|
|
@@ -56,7 +56,10 @@ module Principles
|
|
|
56
56
|
.printed(after: options.fetch("commits_after"), event: event)
|
|
57
57
|
end
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
unless options["short"]
|
|
60
|
+
return Views::ProblemResult.new(invocation).listed(checked_report(id), history: options.key?("history"))
|
|
61
|
+
.merge("wrote" => [])
|
|
62
|
+
end
|
|
60
63
|
|
|
61
64
|
short(id, session_start: options["session_start"], named: options.key?("project"))
|
|
62
65
|
end
|
|
@@ -115,12 +118,13 @@ module Principles
|
|
|
115
118
|
report = problems.checked do |map_id, member, baseline, now, mapping|
|
|
116
119
|
@project.principle_history(map_id, mapping: mapping).member_history(member, baseline: baseline, now: now)
|
|
117
120
|
end
|
|
118
|
-
Views::
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
121
|
+
facts = Views::ProblemFacts.new(not_read: @project.unread_older_files,
|
|
122
|
+
no_baseline_files: problems.files_to_commit(@principles),
|
|
123
|
+
audit_files: problems.audit_files_to_commit(@principles),
|
|
124
|
+
acknowledgeable: problems.acknowledgeable_together(
|
|
125
|
+
except: waiting.map(&:principle)
|
|
126
|
+
), waiting:)
|
|
127
|
+
Views::ProblemResult.new(printing).checked_naming_commands(report, facts)
|
|
124
128
|
end
|
|
125
129
|
end
|
|
126
130
|
end
|
|
@@ -124,7 +124,7 @@ module Principles
|
|
|
124
124
|
# Whether the evidence at locator no longer hashes to sha, or can no longer be found.
|
|
125
125
|
#: (Models::Locator, String) -> bool
|
|
126
126
|
def evidence_changed?(locator, sha)
|
|
127
|
-
snapshot(locator).
|
|
127
|
+
snapshot(locator).sha256 != sha
|
|
128
128
|
rescue Error
|
|
129
129
|
true
|
|
130
130
|
end
|
|
@@ -80,11 +80,12 @@ module Principles
|
|
|
80
80
|
|
|
81
81
|
# The passage's text, as the agent pastes it, with its size, which loads in every session (F9), and what it
|
|
82
82
|
# presumes of a teammate without principles.
|
|
83
|
-
#: (Views::MetaPrincipleResult) ->
|
|
83
|
+
#: (Views::MetaPrincipleResult) -> Views::MetaPrincipleResult::Passage
|
|
84
84
|
def passage(view)
|
|
85
85
|
text = view.passage
|
|
86
|
-
size = Models::TextSize.new(text)
|
|
87
|
-
|
|
86
|
+
size = Models::TextSize.new(text)
|
|
87
|
+
Views::MetaPrincipleResult::Passage.new(text: text, bytes: size.bytes, estimated_tokens: size.estimated_tokens,
|
|
88
|
+
presumes: view.presumes(size.estimated_tokens))
|
|
88
89
|
end
|
|
89
90
|
end
|
|
90
91
|
end
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
4
|
require_relative "command"
|
|
5
|
-
require_relative "../models/
|
|
5
|
+
require_relative "../models/disposition_placeholders"
|
|
6
6
|
require_relative "../models/open_correction"
|
|
7
7
|
require_relative "../views/answer_head"
|
|
8
8
|
require_relative "../views/correction_request"
|
|
@@ -34,8 +34,8 @@ module Principles
|
|
|
34
34
|
kept = Models::OpenCorrection.kept(principle_id, @audit_records.find(principle_id),
|
|
35
35
|
file: @audit_records.file(principle_id))
|
|
36
36
|
head = Views::AnswerHead.new(request_id: kept.request_id, basis: kept.basis)
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
placeholders = Models::DispositionPlaceholders::TEMPLATE_PLACEHOLDERS
|
|
38
|
+
Views::CorrectionRequest.new(head:, principle_id:, findings: kept.findings, placeholders:).correction_to_fill
|
|
39
39
|
end
|
|
40
40
|
end
|
|
41
41
|
end
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# typed: strict
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require "time"
|
|
5
|
+
require_relative "answer_phase"
|
|
6
|
+
require_relative "../models/finding_write_ups"
|
|
7
|
+
require_relative "../models/open_findings_decision"
|
|
8
|
+
require_relative "../views/answered_request"
|
|
9
|
+
require_relative "../views/open_findings_decision_result"
|
|
10
|
+
|
|
11
|
+
module Principles
|
|
12
|
+
# Each runs one command: reads models, applies their rules and prints through a view.
|
|
13
|
+
# controllers/CLAUDE.md owns the boundary.
|
|
14
|
+
module Controllers
|
|
15
|
+
# A decision on a principle's open findings between full audits: start-audit ID --open-findings lists each open
|
|
16
|
+
# finding with where its write-up is now, and submit-answer makes each change the answer gives in the last
|
|
17
|
+
# completed record, keeping it beside its finding.
|
|
18
|
+
class OpenFindingDecisions < AnswerPhase
|
|
19
|
+
# The request start-audit id --open-findings prints, for a decision on any of the principle's open findings, or
|
|
20
|
+
# with to_fill its answer alone.
|
|
21
|
+
#: (String, to_fill: bool) -> Hash[String, untyped]
|
|
22
|
+
def decide(id, to_fill:)
|
|
23
|
+
naming_the_executable do
|
|
24
|
+
record = @audit_records.find(id)
|
|
25
|
+
decisions = decisions_of(id, record)
|
|
26
|
+
request = view.decision_request(request_id: decisions.request_id.to_s, principle_id: id,
|
|
27
|
+
revision: decisions.revision, fields: Models::FindingDecision::FIELDS,
|
|
28
|
+
findings: Models::FindingWriteUps.of(@project, [record].compact).listed)
|
|
29
|
+
to_fill ? request.fetch("response_template") : request.merge("wrote" => [])
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# The result of answering, and the record it changes, not yet written, which is refused once the last completed
|
|
34
|
+
# record changed after the request was printed, unless it writes nothing.
|
|
35
|
+
# @override
|
|
36
|
+
#: (Models::SubmittedAnswer) -> [Views::AnsweredRequest, Array[Models::AuditRecord]]
|
|
37
|
+
def answered(submitted)
|
|
38
|
+
id = submitted.request_id.principle_id
|
|
39
|
+
decisions = decisions_of(id, @audit_records.find(id))
|
|
40
|
+
decided = decisions.decided(submitted.response, at: Time.now.utc.iso8601) { |locator| snapshot(locator) }
|
|
41
|
+
changes = decisions.confirmed_writable(decided, submitted.response, records: @audit_records)
|
|
42
|
+
[Views::AnsweredRequest.new(result(id, decisions.changed_ids(decided))), changes]
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
private
|
|
46
|
+
|
|
47
|
+
# The decision on principle id's open findings, as its record holds them.
|
|
48
|
+
#: (String, Models::AuditRecord?) -> Models::OpenFindingsDecision
|
|
49
|
+
def decisions_of(id, record)
|
|
50
|
+
Models::OpenFindingsDecision.new(principle_id: id, record: record, history: @history)
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# The result naming the findings of principle id that the decisions changed, the record to commit, and each
|
|
54
|
+
# other principle's open finding whose write-up cannot be found (T16).
|
|
55
|
+
#: (String, Array[String]) -> Hash[String, untyped]
|
|
56
|
+
def result(id, changed)
|
|
57
|
+
others = @audit_records.of(@principles.ids - [id])
|
|
58
|
+
view.decided(principle_id: id, file: @audit_records.file(id), changed:,
|
|
59
|
+
not_found_elsewhere: Models::FindingWriteUps.of(@project, others).not_found)
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
#: () -> Views::OpenFindingsDecisionResult
|
|
63
|
+
def view = Views::OpenFindingsDecisionResult.new(invocation)
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
@@ -19,21 +19,37 @@ module Principles
|
|
|
19
19
|
# entry point gives itself for the same reason.
|
|
20
20
|
ON_PATH = Models::RunsFrom::PLUGIN_EXECUTABLE
|
|
21
21
|
|
|
22
|
+
# The folders the process was given, as Launch reads them: cwd, the one this run was started in, by its real
|
|
23
|
+
# path, or nil when it is gone; temp_directory, its temporary folder, where a printed next step saves an answer.
|
|
24
|
+
class Folders
|
|
25
|
+
#: String?
|
|
26
|
+
attr_reader :cwd
|
|
27
|
+
#: String
|
|
28
|
+
attr_reader :temp_directory
|
|
29
|
+
|
|
30
|
+
#: (temp_directory: String, ?cwd: String?) -> void
|
|
31
|
+
def initialize(temp_directory:, cwd: nil)
|
|
32
|
+
@cwd = cwd
|
|
33
|
+
@temp_directory = temp_directory
|
|
34
|
+
freeze
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
22
38
|
# version gives the version running, read only when a command needs it, since in a checkout reading it
|
|
23
39
|
# asks git; other_on_path gives the path and printed version of another principles earlier on PATH than this
|
|
24
40
|
# one, and which of the commands it is asked about that copy does not run, or nil, read only when a command
|
|
25
41
|
# needs it, since reading it starts that copy; launched_on_path says
|
|
26
42
|
# whether this run was launched as the first principles on PATH, as a RubyGems binstub is, so a bare
|
|
27
|
-
# principles runs this same copy;
|
|
43
|
+
# principles runs this same copy; folders are the folders the process was given.
|
|
28
44
|
#: (executable: String, version: ^() -> String,
|
|
29
45
|
#| ?other_on_path: ^(Array[String]) -> [String, String, Array[String]]?, ?launched_on_path: ^() -> bool,
|
|
30
|
-
#|
|
|
31
|
-
def initialize(executable:, version:, other_on_path: ->(_) {}, launched_on_path: -> { false }
|
|
46
|
+
#| folders: Folders) -> void
|
|
47
|
+
def initialize(executable:, version:, folders:, other_on_path: ->(_) {}, launched_on_path: -> { false })
|
|
32
48
|
@executable = executable
|
|
33
49
|
@version = version
|
|
34
50
|
@other_on_path = other_on_path
|
|
35
51
|
@launched_on_path = launched_on_path
|
|
36
|
-
@
|
|
52
|
+
@folders = folders
|
|
37
53
|
freeze
|
|
38
54
|
end
|
|
39
55
|
|
|
@@ -59,7 +75,8 @@ module Principles
|
|
|
59
75
|
# be run from elsewhere.
|
|
60
76
|
#: (String) -> Views::Invocation
|
|
61
77
|
def invocation(root)
|
|
62
|
-
Views::Invocation.new(executable: executable, project: root,
|
|
78
|
+
Views::Invocation.new(executable: executable, project: root, temp_directory: @folders.temp_directory,
|
|
79
|
+
named: !bare_from_path? || root != @folders.cwd)
|
|
63
80
|
end
|
|
64
81
|
|
|
65
82
|
# Another principles earlier on PATH than this one, which a bare principles command runs in its place, asked
|
|
@@ -40,7 +40,8 @@ module Principles
|
|
|
40
40
|
after = options["commits_after"]
|
|
41
41
|
mapped = @principles.descriptions
|
|
42
42
|
commit = @history.commit_named(after) if after
|
|
43
|
-
|
|
43
|
+
selected = { also: options.fetch("also", []), only: options.fetch("only", []) }
|
|
44
|
+
found = @project.candidate_files(after: commit, **selected)
|
|
44
45
|
.within_budget { |inventory| candidate_files_result(inventory, mapped).text.bytesize }
|
|
45
46
|
candidate_files_result(found, mapped)
|
|
46
47
|
end
|
|
@@ -49,7 +50,7 @@ module Principles
|
|
|
49
50
|
#: (Models::CandidateInventory, Array[Hash[String, untyped]]) -> Views::JsonWithEntriesOnLines
|
|
50
51
|
def candidate_files_result(found, mapped)
|
|
51
52
|
listed = Views::CandidateFilesResult::Found.new(inventory: found.to_h, untracked: found.untracked,
|
|
52
|
-
owner_asks: found.owner_asks)
|
|
53
|
+
owner_asks: found.owner_asks, conventional: found.conventional?)
|
|
53
54
|
question = Views::CandidateFilesResult.new(invocation).question(listed, existing_maps: @principles.ids,
|
|
54
55
|
map_file: @principles.file("ID"),
|
|
55
56
|
mapped_principles: mapped)
|
|
@@ -35,12 +35,14 @@ module Principles
|
|
|
35
35
|
leads_to == path ? entry : entry.merge("symlink_to" => leads_to)
|
|
36
36
|
end
|
|
37
37
|
|
|
38
|
-
# also names more files to list, inside the project, beside those hosts load by convention
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
# also names more files to list, inside the project, beside those hosts load by convention; without
|
|
39
|
+
# conventional, only also and the matches of matching are listed.
|
|
40
|
+
#: (ProjectFiles, ?also: Array[String], ?matching: Array[String], ?conventional: bool) -> void
|
|
41
|
+
def initialize(files, also: [], matching: [], conventional: true)
|
|
41
42
|
@files = files
|
|
42
43
|
@also = also
|
|
43
44
|
@matching = matching
|
|
45
|
+
@conventional = conventional
|
|
44
46
|
end
|
|
45
47
|
|
|
46
48
|
#: () -> Hash[String, untyped]
|
|
@@ -135,7 +137,7 @@ module Principles
|
|
|
135
137
|
|
|
136
138
|
#: (String) -> bool
|
|
137
139
|
def candidate?(relative)
|
|
138
|
-
CANDIDATE_NAMES.include?(File.basename(relative)) || relative.match?(CANDIDATE_PATH) ||
|
|
140
|
+
(@conventional && (CANDIDATE_NAMES.include?(File.basename(relative)) || relative.match?(CANDIDATE_PATH))) ||
|
|
139
141
|
@matching.any? { |glob| matches?(glob, relative) }
|
|
140
142
|
end
|
|
141
143
|
end
|
|
@@ -22,12 +22,12 @@
|
|
|
22
22
|
},
|
|
23
23
|
"commands": [
|
|
24
24
|
{
|
|
25
|
-
"name": "list-candidate-files", "usage": "list-candidate-files [--commits-after REV] [--also GLOB]...", "group": "read", "options": ["commits-after", "also"],
|
|
25
|
+
"name": "list-candidate-files", "usage": "list-candidate-files [--commits-after REV] [--also GLOB]... [--only GLOB]...", "group": "read", "options": ["commits-after", "also", "only"],
|
|
26
26
|
"summary": "Ask what in this project looks like a principle.",
|
|
27
27
|
"help": "learn-what-a-command-does/list-candidate-files",
|
|
28
28
|
"steps": [
|
|
29
29
|
{ "id": "list-instruction-files", "actor": "cli",
|
|
30
|
-
"does": "Lists the instruction files agent hosts load by convention, naming git-ignored ones unread rather than listing them, each folder git ignores counted once, leaving out folders that hold their own git repository, and names any under a fixtures, examples or samples folder and, in git, any git does not track. With --commits-after, lists the files the commits after it changed first, marked, Markdown outside those places included, and refuses outside git and a revision git cannot resolve to a commit. Repeated --also root-relative globs include explicitly selected guidance, including skill references and named non-Markdown files; additional_search_paths reports each match count within traversal boundaries. No location is saved.",
|
|
30
|
+
"does": "Lists the instruction files agent hosts load by convention, naming git-ignored ones unread rather than listing them, each folder git ignores counted once, leaving out folders that hold their own git repository, and names any under a fixtures, examples or samples folder and, in git, any git does not track. With --commits-after, lists the files the commits after it changed first, marked, Markdown outside those places included, and refuses outside git and a revision git cannot resolve to a commit. Repeated --also root-relative globs include explicitly selected guidance, including skill references and named non-Markdown files; additional_search_paths reports each match count within traversal boundaries. Repeated --only globs list just their matches. No location is saved.",
|
|
31
31
|
"refuses": ["range_needs_git", "unknown_revision", "invalid_guidance_search_path"] },
|
|
32
32
|
{ "id": "choose-one-principle", "actor": "agent",
|
|
33
33
|
"does": "Show the user a table of the principles several listed files reinforce, asking nothing before it, then, when maps exist, compare each rule with the descriptions in mapped_principles before choosing whether to extend an existing map or create a distinct one. Decide whether each file named in possibly_test_data is guidance or a sample. After the table, ask where else the repository keeps guidance; --also includes it in a read-only survey without recording it.",
|
|
@@ -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", "session-start", "commits-after", "hook-event"],
|
|
73
|
+
"name": "list-member-problems", "usage": "list-member-problems [ID] [--history | --short | --commits-after COMMIT --hook-event EVENT]", "group": "read", "options": ["history", "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, then one per principle counting its members no audit has assessed, and exits 3 when it prints any line.",
|
|
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 with --history the commits that changed it, 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.",
|
|
@@ -132,7 +132,7 @@
|
|
|
132
132
|
"help": "learn-what-a-command-does/report-at-session-start",
|
|
133
133
|
"steps": [
|
|
134
134
|
{ "id": "report-at-session-start", "actor": "cli",
|
|
135
|
-
"does": "Reads the SessionStart hook's JSON on stdin and always exits 0, since the host adds a SessionStart hook's output to the context only then. Prints nothing in a project with no maps. Otherwise prints, each line marked principles:,
|
|
135
|
+
"does": "Reads the SessionStart hook's JSON on stdin and always exits 0, since the host adds a SessionStart hook's output to the context only then. Prints nothing in a project with no maps. Otherwise prints, each line marked principles:, for one principle whose members an audit assessed changed since, a line with its count, that its audit no longer covers them, and the list-member-problems ID command to run before the user's task, which offers acknowledging them or auditing again, or for several, one line counting them with the list-member-problems --short command that lists them, then, in git, what gives each principle's members with no baseline one, then each principle whose audit record a later release wrote, whose audits wait on an upgrade, then, while any principle awaits its first full audit, one line counting them that asks for one background subagent to follow show-first-audit-brief, or to offer the audit at the next pause if none can be started, and at resume and compact only the count, asking for no second subagent, then, while any audit finding is left open, the one line list-open-findings --short prints, worded for the session's start. When list-member-problems refuses, prints instead its code and the command that shows its repair; input it cannot read is read as a startup." }
|
|
136
136
|
]
|
|
137
137
|
},
|
|
138
138
|
{
|
|
@@ -314,16 +314,16 @@
|
|
|
314
314
|
]
|
|
315
315
|
},
|
|
316
316
|
{
|
|
317
|
-
"name": "start-audit", "usage": "start-audit ID [ID ...] [--member MEMBER ... | --
|
|
317
|
+
"name": "start-audit", "usage": "start-audit ID [ID ...] [--member MEMBER ... | --open-findings] [--as template [--part members/ID ...] | --instruction FIELD | --part PART ...]", "group": "write-audit-record", "options": ["member", "write-ups", "open-findings", "as", "instruction", "part"],
|
|
318
318
|
"summary": "Ask for an assessment of every member and the set.",
|
|
319
319
|
"help": "learn-what-a-command-does/start-audit",
|
|
320
320
|
"steps": [
|
|
321
321
|
{ "id": "snapshot-members", "actor": "cli",
|
|
322
|
-
"does": "Refuses an empty map or, in git, an uncommitted map or member file; bases the audit on HEAD. Fill --as template's output with your own judgement
|
|
323
|
-
"refuses": ["map_has_no_members", "uncommitted_files", "unknown_instruction", "unknown_part"], "refuses_like": ["read-map", "locate-text", "rewrite-audit"],
|
|
324
|
-
"next": [{ "to": "assess-every-member", "when": "you passed
|
|
322
|
+
"does": "Refuses an empty map or, in git, an uncommitted map or member file; bases the audit on HEAD. Fill --as template's output with your own judgement; its left_as_printed_rule says how a field left as printed is read.",
|
|
323
|
+
"refuses": ["map_has_no_members", "uncommitted_files", "unknown_instruction", "unknown_part", "replaced_option"], "refuses_like": ["read-map", "locate-text", "rewrite-audit"],
|
|
324
|
+
"next": [{ "to": "assess-every-member", "when": "you passed no --member or --open-findings" },
|
|
325
325
|
{ "to": "start-acknowledgement", "when": "you passed --member" },
|
|
326
|
-
{ "to": "start-
|
|
326
|
+
{ "to": "start-deciding-open-findings", "when": "you passed --open-findings" }] },
|
|
327
327
|
{ "id": "assess-every-member", "actor": "agent",
|
|
328
328
|
"does": "Assess each member not carried, and any carried one whose sighting is too old to rely on, the set as a whole and one recent decision under it, a finding per problem. Run each check, carried_checks_to_run's too, per shared_check_instructions and check_instructions. Decide each prior finding and listed member to check against the activation.",
|
|
329
329
|
"prompt": "assess-every-member/assess-each-member-and-the-set",
|
|
@@ -339,9 +339,9 @@
|
|
|
339
339
|
"checks": "the meaning is said to be kept, the reason is one line, and both quotes are the member's.",
|
|
340
340
|
"cannot_check": "whether the change keeps the meaning, or whether you read it.",
|
|
341
341
|
"answer_with": "submit-answer" },
|
|
342
|
-
{ "id": "start-
|
|
343
|
-
"does": "With --
|
|
344
|
-
"refuses": ["
|
|
342
|
+
{ "id": "start-deciding-open-findings", "actor": "cli",
|
|
343
|
+
"does": "With --open-findings, lists each finding the last completed audit left open, as list-open-findings does, and asks what changed of any: its wait, action or write-up; --as template prints the answer alone.",
|
|
344
|
+
"refuses": ["cannot_decide_open_findings"] }
|
|
345
345
|
]
|
|
346
346
|
},
|
|
347
347
|
{
|
|
@@ -353,7 +353,7 @@
|
|
|
353
353
|
"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.",
|
|
354
354
|
"refuses": ["unparseable_json", "unreadable_file", "request_mismatch", "unknown_request"], "refuses_like": ["rewrite-audit"],
|
|
355
355
|
"next": [{ "to": "acknowledge-the-change", "when": "the request was a one-member audit" },
|
|
356
|
-
{ "to": "record-the-
|
|
356
|
+
{ "to": "record-the-decisions", "when": "the request was a decision on open findings" },
|
|
357
357
|
{ "to": "recheck-members", "when": "the request was an assessment or a correction" }] },
|
|
358
358
|
{ "id": "acknowledge-the-change", "actor": "cli",
|
|
359
359
|
"does": "For a one-member audit, checks the answer's kept meaning, one-line reason, quotes then and now and any check result, then moves the member's hash and check result in the audit record beside the acknowledgement.",
|
|
@@ -362,12 +362,12 @@
|
|
|
362
362
|
"does": "Commit the audit record, then check that list-member-problems --short no longer reports the member.",
|
|
363
363
|
"cannot_check": "that you committed, or that the change keeps the meaning.",
|
|
364
364
|
"answer_with": "list-member-problems" },
|
|
365
|
-
{ "id": "record-the-
|
|
366
|
-
"does": "
|
|
367
|
-
"refuses": ["
|
|
368
|
-
{ "id": "commit-the-
|
|
369
|
-
"does": "Commit the audit record, then check
|
|
370
|
-
"cannot_check": "that you committed, or that
|
|
365
|
+
{ "id": "record-the-decisions", "actor": "cli",
|
|
366
|
+
"does": "Makes each change a decision gives in the last completed record, a write-up once found, keeping the old value, when and why; names lost write-ups elsewhere; refused once that record changed, unless it writes nothing.",
|
|
367
|
+
"refuses": ["cannot_decide_open_findings", "audit_completed_since_request", "unknown_finding", "duplicate_finding", "invalid_answer", "uncommitted_files"], "refuses_like": ["locate-text"] },
|
|
368
|
+
{ "id": "commit-the-decisions", "actor": "agent",
|
|
369
|
+
"does": "Commit the audit record, then check each change as list-open-findings --lines states it.",
|
|
370
|
+
"cannot_check": "that you committed, or that each change is right.",
|
|
371
371
|
"answer_with": "list-open-findings" },
|
|
372
372
|
{ "id": "recheck-members", "actor": "cli",
|
|
373
373
|
"does": "Re-reads the map and every member's text, and the record outside git.",
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
4
|
require "json"
|
|
5
|
+
require_relative "parser_message"
|
|
5
6
|
|
|
6
7
|
module Principles
|
|
7
8
|
# Every file and process this tool reads or writes. data/CLAUDE.md owns the boundary.
|
|
@@ -36,10 +37,13 @@ module Principles
|
|
|
36
37
|
freeze
|
|
37
38
|
end
|
|
38
39
|
|
|
39
|
-
# The parsed value, made only of plain hashes and arrays; raises JSON::ParserError on a duplicate key
|
|
40
|
+
# The parsed value, made only of plain hashes and arrays; raises JSON::ParserError on a duplicate key, and on
|
|
41
|
+
# text it cannot parse with the parser's message, the rest of the input it quotes cut to an excerpt.
|
|
40
42
|
#: () -> untyped
|
|
41
43
|
def parsed
|
|
42
44
|
plain(JSON.parse(@text, object_class: UniqueKeys))
|
|
45
|
+
rescue JSON::ParserError => e
|
|
46
|
+
raise JSON::ParserError, ParserMessage.new(@text, e.message).to_s
|
|
43
47
|
end
|
|
44
48
|
|
|
45
49
|
private
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# typed: strict
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
module Principles
|
|
5
|
+
# Every file and process this tool reads or writes. data/CLAUDE.md owns the boundary.
|
|
6
|
+
module Data
|
|
7
|
+
# The json parser's message about text it could not parse, with the rest of the input it quotes from where it
|
|
8
|
+
# stopped cut to an excerpt, since a raw line break early in a long answer echoed the whole rest of the file.
|
|
9
|
+
# json 2.9.1, Ruby 3.4's own, quotes that rest with no line or column; later versions give both after it. A
|
|
10
|
+
# message quoting none of the input is kept as it is.
|
|
11
|
+
class ParserMessage
|
|
12
|
+
# The characters of the rest of the input the message keeps.
|
|
13
|
+
EXCERPT = 60 #: Integer
|
|
14
|
+
|
|
15
|
+
# How each json version's message ends just before the rest of the input it quotes: json 2.9.1's
|
|
16
|
+
# "unexpected token at '", and a later version's reason and colon. A message ending as the input does but
|
|
17
|
+
# after neither quotes none of it.
|
|
18
|
+
LEADS = ["at '", ": "].freeze #: Array[String]
|
|
19
|
+
|
|
20
|
+
# Where a later json says it stopped, after the rest of the input.
|
|
21
|
+
POSITION = / at line \d+ column \d+\z/ #: Regexp
|
|
22
|
+
|
|
23
|
+
#: (String, String) -> void
|
|
24
|
+
def initialize(text, message)
|
|
25
|
+
@text = text
|
|
26
|
+
@message = message
|
|
27
|
+
freeze
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
#: () -> String
|
|
31
|
+
def to_s
|
|
32
|
+
position = @message[POSITION].to_s
|
|
33
|
+
quoted = @message.delete_suffix(position)
|
|
34
|
+
quoted = quoted.delete_suffix("'") if quoted.end_with?("'") && !@text.end_with?("'")
|
|
35
|
+
rest = common_suffix(quoted)
|
|
36
|
+
lead = quoted.delete_suffix(rest)
|
|
37
|
+
return @message if rest.empty? || LEADS.none? { lead.end_with?(it) }
|
|
38
|
+
|
|
39
|
+
"#{lead.delete_suffix("'")}#{excerpt(rest)}#{position}"
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
private
|
|
43
|
+
|
|
44
|
+
# The longest end that quoted shares with the text: the rest of the input it quotes.
|
|
45
|
+
#: (String) -> String
|
|
46
|
+
def common_suffix(quoted)
|
|
47
|
+
length = 0
|
|
48
|
+
length += 1 while length < quoted.length && length < @text.length && quoted[-1 - length] == @text[-1 - length]
|
|
49
|
+
quoted[quoted.length - length, length].to_s
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# rest's first characters, written so a line break or control character shows, and how many bytes follow.
|
|
53
|
+
#: (String) -> String
|
|
54
|
+
def excerpt(rest)
|
|
55
|
+
kept = rest[0, EXCERPT].to_s
|
|
56
|
+
left = rest.bytesize - kept.bytesize
|
|
57
|
+
left.positive? ? "#{kept.inspect} and #{left} more bytes" : kept.inspect
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
@@ -87,8 +87,10 @@ module Principles
|
|
|
87
87
|
end
|
|
88
88
|
|
|
89
89
|
# The instruction files hosts load by convention, as CandidateFilesFound lists them, and the files also names.
|
|
90
|
-
#: (?also: Array[String], ?matching: Array[String]) -> Hash[String, untyped]
|
|
91
|
-
def inventory(also: [], matching: []
|
|
90
|
+
#: (?also: Array[String], ?matching: Array[String], ?conventional: bool) -> Hash[String, untyped]
|
|
91
|
+
def inventory(also: [], matching: [], conventional: true)
|
|
92
|
+
CandidateFilesFound.new(self, also:, matching:, conventional:).to_h
|
|
93
|
+
end
|
|
92
94
|
|
|
93
95
|
# Literal outline requests never walk the project or load saved search paths.
|
|
94
96
|
#: (Array[String]) -> Hash[String, untyped]
|
|
@@ -112,17 +112,17 @@ module Principles
|
|
|
112
112
|
# Which of paths, relative to the project, git does not track and does not ignore. Before the first
|
|
113
113
|
# commit, every path not staged is one.
|
|
114
114
|
#: (Array[String]) -> Array[String]
|
|
115
|
-
def
|
|
115
|
+
def untracked_excluding_ignored(paths)
|
|
116
116
|
return [] if paths.empty?
|
|
117
117
|
|
|
118
118
|
output, = git(["ls-files", "--others", "--exclude-standard", "-z", "--", *paths])
|
|
119
119
|
output.split("\0").sort
|
|
120
120
|
end
|
|
121
121
|
|
|
122
|
-
# Which of paths, relative to the project, git does not track, ignored or not. Unlike
|
|
123
|
-
# ignored file too, since git holds it no more than an untracked one.
|
|
122
|
+
# Which of paths, relative to the project, git does not track, ignored or not. Unlike
|
|
123
|
+
# untracked_excluding_ignored, it names an ignored file too, since git holds it no more than an untracked one.
|
|
124
124
|
#: (Array[String]) -> Array[String]
|
|
125
|
-
def
|
|
125
|
+
def untracked_including_ignored(paths)
|
|
126
126
|
return [] if paths.empty?
|
|
127
127
|
|
|
128
128
|
output, = git(["ls-files", "--others", "-z", "--", *paths])
|
|
@@ -12,7 +12,7 @@ module Principles
|
|
|
12
12
|
class RunningVersion
|
|
13
13
|
# git archive writes the short sha of the commit it archives here, since .gitattributes marks this file
|
|
14
14
|
# export-subst; a checkout keeps the placeholder as written.
|
|
15
|
-
ARCHIVED_COMMIT = "
|
|
15
|
+
ARCHIVED_COMMIT = "53dd20cf" #: String
|
|
16
16
|
|
|
17
17
|
#: (?String, release: String, ?built: String?, ?archived_commit: String) -> void
|
|
18
18
|
def initialize(checkout = File.expand_path("../../..", __dir__), release:, built: nil,
|
|
@@ -277,6 +277,21 @@
|
|
|
277
277
|
"query": { "type": "string" }
|
|
278
278
|
}
|
|
279
279
|
},
|
|
280
|
+
"changed_since_audit": {
|
|
281
|
+
"type": "array",
|
|
282
|
+
"description": "Each change a decision on this open finding made since the full audit that kept it: the field, its value before and after, when and why. Only principles writes it.",
|
|
283
|
+
"items": {
|
|
284
|
+
"type": "object",
|
|
285
|
+
"required": ["field", "from", "to", "at", "reason"],
|
|
286
|
+
"properties": {
|
|
287
|
+
"field": { "type": "string", "enum": ["waits_on", "action", "recorded_at"] },
|
|
288
|
+
"from": {},
|
|
289
|
+
"to": {},
|
|
290
|
+
"at": { "type": "string", "minLength": 1 },
|
|
291
|
+
"reason": { "type": "string", "minLength": 1 }
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
},
|
|
280
295
|
"repointed": {
|
|
281
296
|
"type": "array",
|
|
282
297
|
"description": "Each repoint of recorded_at since the full audit that kept this finding: where it pointed, where it points, when and why. Only principles writes it.",
|
|
@@ -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", "part", "also", "confirm", "lines", "open-findings"] } },
|
|
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", "part", "also", "only", "confirm", "lines", "open-findings", "history"] } },
|
|
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]+)+$" },
|
data/lib/principles/data/schemas/{repointing-answer.schema.json → deciding-answer.schema.json}
RENAMED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"$id": "
|
|
4
|
-
"title": "
|
|
5
|
-
"description": "What an agent answers
|
|
3
|
+
"$id": "deciding-answer.schema.json",
|
|
4
|
+
"title": "Deciding answer",
|
|
5
|
+
"description": "What an agent answers start-audit ID --open-findings with: the request's id and basis, then a decision per open finding it names, giving only the fields that change and a one-line reason. A field left out keeps its value. Fields this tool does not read are refused. Models::FindingDecision checks each decision.",
|
|
6
6
|
"type": "object",
|
|
7
7
|
"additionalProperties": false,
|
|
8
|
-
"required": ["request_id", "basis", "
|
|
8
|
+
"required": ["request_id", "basis", "decisions"],
|
|
9
9
|
"properties": {
|
|
10
10
|
"request_id": { "type": "string" },
|
|
11
11
|
"basis": {
|
|
@@ -16,14 +16,20 @@
|
|
|
16
16
|
"revision": { "type": ["string", "null"] }
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
|
-
"
|
|
19
|
+
"decision_fields": {
|
|
20
|
+
"type": "object",
|
|
21
|
+
"description": "The note start-audit ID --open-findings --as template prints at its head naming each field a decision may give and what it means, which an answer may send back and Models::OpenFindingsDecision ignores, whatever it holds."
|
|
22
|
+
},
|
|
23
|
+
"decisions": {
|
|
20
24
|
"type": "array",
|
|
21
25
|
"items": {
|
|
22
26
|
"type": "object",
|
|
23
27
|
"additionalProperties": false,
|
|
24
|
-
"required": ["finding_id"
|
|
28
|
+
"required": ["finding_id"],
|
|
25
29
|
"properties": {
|
|
26
30
|
"finding_id": { "type": "string", "minLength": 1 },
|
|
31
|
+
"action": { "type": "string" },
|
|
32
|
+
"waits_on": { "type": ["string", "null"] },
|
|
27
33
|
"recorded_at": {
|
|
28
34
|
"type": ["object", "null"],
|
|
29
35
|
"required": ["path"],
|
|
@@ -9,12 +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 session-start commits-after hook-event as instruction
|
|
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.
|
|
14
|
-
FLAG_OPTIONS = %w[short lines when-invoked always write-ups confirm open-findings].freeze #: Array[String]
|
|
14
|
+
FLAG_OPTIONS = %w[short lines when-invoked always write-ups confirm open-findings history].freeze #: Array[String]
|
|
15
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.
|
|
17
|
-
LIST_OPTIONS = %w[when-files also member].freeze #: Array[String]
|
|
16
|
+
# start-audit --member and --part.
|
|
17
|
+
LIST_OPTIONS = %w[when-files also only member part].freeze #: Array[String]
|
|
18
18
|
# The words that name an option taking the next word as its value.
|
|
19
19
|
VALUE_WORDS = (VALUE_OPTIONS + LIST_OPTIONS).map { |name| "--#{name}" }.freeze #: Array[String]
|
|
20
20
|
# Every word the parser reads as an option, which an option taking a value refuses as its value.
|