principles 0.0.5 → 0.0.6
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/command_line.rb +12 -28
- data/lib/principles/command_routes.rb +7 -1
- data/lib/principles/controllers/acknowledgement.rb +36 -26
- data/lib/principles/controllers/answer.rb +7 -5
- data/lib/principles/controllers/assessment.rb +14 -3
- data/lib/principles/controllers/audit_completion.rb +3 -1
- data/lib/principles/controllers/command.rb +2 -2
- data/lib/principles/controllers/correction.rb +3 -1
- data/lib/principles/controllers/full_audit_request.rb +1 -1
- 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_addition.rb +65 -0
- data/lib/principles/controllers/member_entries.rb +6 -24
- data/lib/principles/controllers/member_problems_report.rb +2 -2
- 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 +77 -16
- 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 +4 -5
- data/lib/principles/data/schemas/answer-guide.schema.json +255 -63
- 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 +6 -0
- 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 +2 -2
- data/lib/principles/models/acknowledgement.rb +28 -6
- data/lib/principles/models/acknowledgement_left_as_printed.rb +51 -0
- data/lib/principles/models/audit_entry_protecting_map.rb +28 -0
- data/lib/principles/models/audit_record.rb +4 -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/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/loaded_files.rb +1 -2
- data/lib/principles/models/loading_scope.rb +61 -0
- data/lib/principles/models/locator.rb +6 -0
- data/lib/principles/models/mapped_principles.rb +39 -37
- 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 +48 -24
- data/lib/principles/models/member_region.rb +129 -0
- data/lib/principles/models/member_repair_moves.rb +9 -11
- 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 +17 -5
- data/lib/principles/models/project.rb +43 -27
- 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 +2 -1
- data/lib/principles/models/sent_answer.rb +10 -0
- 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 +37 -0
- data/lib/principles/version.rb +2 -2
- data/lib/principles/views/acknowledgement_result.rb +16 -12
- data/lib/principles/views/added_member.rb +41 -0
- data/lib/principles/views/answered_request.rb +21 -0
- data/lib/principles/views/assessment_request.rb +2 -1
- data/lib/principles/views/audit_result.rb +21 -26
- data/lib/principles/views/candidate_files_result.rb +56 -12
- data/lib/principles/views/candidate_outlines_result.rb +25 -0
- data/lib/principles/views/consecutive_sections_elsewhere.rb +27 -0
- data/lib/principles/views/correction_request.rb +32 -1
- data/lib/principles/views/guidance_search_paths_result.rb +26 -0
- data/lib/principles/views/json_with_entries_on_lines.rb +12 -4
- 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/new_loading_scope.rb +31 -0
- data/lib/principles/views/one_member_check_result_template.rb +25 -21
- 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 +3 -1
- data/lib/principles/views/problem_result.rb +8 -3
- 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-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/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/list-candidate-files.md +37 -4
- data/lib/principles/views/prompts/learn-what-a-command-does/list-member-problems.md +5 -4
- 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 +26 -0
- 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 +2 -2
- 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
- metadata +55 -4
- data/lib/principles/models/candidate_listing.rb +0 -41
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# typed: strict
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require_relative "invocation"
|
|
5
|
+
|
|
6
|
+
module Principles
|
|
7
|
+
# What this tool prints, from plain values a controller hands it. views/CLAUDE.md owns the boundary.
|
|
8
|
+
module Views
|
|
9
|
+
# The recorded list and an immediate read-only survey after a guidance-search-path write.
|
|
10
|
+
class GuidanceSearchPathsResult
|
|
11
|
+
#: (Invocation) -> void
|
|
12
|
+
def initialize(invocation)
|
|
13
|
+
@invocation = invocation
|
|
14
|
+
freeze
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
#: (status: String, globs: Array[String], wrote: Array[String]) -> Hash[String, untyped]
|
|
18
|
+
def result(status:, globs:, wrote:)
|
|
19
|
+
survey = @invocation.in_project("list-candidate-files")
|
|
20
|
+
{ "status" => status, "recorded_guidance_search_paths" => globs, "wrote" => wrote,
|
|
21
|
+
"next_action" => "Commit changed configuration.\n" \
|
|
22
|
+
"Survey again using the saved search paths: #{survey}" }
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -11,8 +11,8 @@ module Principles
|
|
|
11
11
|
# line of 36 KB is the worst shape to read by lines (#1155). It is the first case of ticket 007's decision on the
|
|
12
12
|
# output format; every other result prints pretty.
|
|
13
13
|
class JsonWithEntriesOnLines
|
|
14
|
-
# Stands in for the array while the rest prints pretty.
|
|
15
|
-
#
|
|
14
|
+
# Stands in for the array while the rest prints pretty. Replacement targets its root object and direct key,
|
|
15
|
+
# so an identical project string elsewhere stays untouched regardless of the result's field order.
|
|
16
16
|
MARKER = "\u0000entries on lines of their own\u0000"
|
|
17
17
|
|
|
18
18
|
# The array is result[under][key].
|
|
@@ -32,12 +32,20 @@ module Principles
|
|
|
32
32
|
#: () -> String
|
|
33
33
|
def text
|
|
34
34
|
marked = JSON.pretty_generate(@result.merge(@under => @result.fetch(@under).merge(@key => MARKER)))
|
|
35
|
-
|
|
36
|
-
marked.sub(place) { "#{Regexp.last_match(1)}#{Regexp.last_match(2)}#{lines(Regexp.last_match(1).to_s)}" }
|
|
35
|
+
marked.sub(array_place) { "#{Regexp.last_match(1)}#{lines(" ")}" }
|
|
37
36
|
end
|
|
38
37
|
|
|
39
38
|
private
|
|
40
39
|
|
|
40
|
+
# The designated array placeholder at its known depth in JSON.pretty_generate's two-space layout.
|
|
41
|
+
#: () -> Regexp
|
|
42
|
+
def array_place
|
|
43
|
+
parent = Regexp.escape(JSON.generate(@under))
|
|
44
|
+
child = Regexp.escape(JSON.generate(@key))
|
|
45
|
+
marker = Regexp.escape(JSON.generate(MARKER))
|
|
46
|
+
/(^ #{parent}: \{.*?^ #{child}: )#{marker}/m
|
|
47
|
+
end
|
|
48
|
+
|
|
41
49
|
# The array's entries, each compact on its own line, one step in from indent.
|
|
42
50
|
#: (String) -> String
|
|
43
51
|
def lines(indent)
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
# typed: strict
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
|
+
require_relative "first_audit"
|
|
5
|
+
require_relative "new_loading_scope"
|
|
6
|
+
|
|
4
7
|
module Principles
|
|
5
8
|
# What this tool prints, from plain values a controller hands it. views/CLAUDE.md owns the boundary.
|
|
6
9
|
module Views
|
|
@@ -10,6 +13,9 @@ module Principles
|
|
|
10
13
|
# what to do after mapping: with a principle's first member, or in git the first since the map's last commit, so
|
|
11
14
|
# members mapped in one sitting do not each repeat it (#1025).
|
|
12
15
|
class MapAddedTo
|
|
16
|
+
COMPLETENESS_QUESTION = "Is every carrier of the same rule mapped, and should any member belong to another " \
|
|
17
|
+
"principle? "
|
|
18
|
+
|
|
13
19
|
#: bool
|
|
14
20
|
attr_reader :keeps_others_held
|
|
15
21
|
|
|
@@ -19,13 +25,61 @@ module Principles
|
|
|
19
25
|
#: bool
|
|
20
26
|
attr_reader :reminded
|
|
21
27
|
|
|
22
|
-
#: (?keeps_others_held: bool, ?correction_may_be_open: bool, ?reminded: bool
|
|
23
|
-
|
|
28
|
+
#: (?keeps_others_held: bool, ?correction_may_be_open: bool, ?reminded: bool,
|
|
29
|
+
#| ?asks_about_completeness: bool, ?new_scope: NewLoadingScope) -> void
|
|
30
|
+
def initialize(keeps_others_held: false, correction_may_be_open: false, reminded: true,
|
|
31
|
+
asks_about_completeness: false, new_scope: NewLoadingScope.new)
|
|
24
32
|
@keeps_others_held = keeps_others_held
|
|
25
33
|
@correction_may_be_open = correction_may_be_open
|
|
26
34
|
@reminded = reminded
|
|
35
|
+
@asks_about_completeness = asks_about_completeness
|
|
36
|
+
@new_scope = new_scope
|
|
27
37
|
freeze
|
|
28
38
|
end
|
|
39
|
+
|
|
40
|
+
# This immutable reminder context with the model's decision to ask about coverage, not a completeness verdict.
|
|
41
|
+
#: (asks: bool) -> MapAddedTo
|
|
42
|
+
def with_completeness_question(asks:)
|
|
43
|
+
MapAddedTo.new(keeps_others_held: @keeps_others_held, correction_may_be_open: @correction_may_be_open,
|
|
44
|
+
reminded: @reminded, asks_about_completeness: asks, new_scope: @new_scope)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# This immutable addition context with the model's new-scope facts, preserving its original reminder flags.
|
|
48
|
+
#: (NewLoadingScope) -> MapAddedTo
|
|
49
|
+
def with_loading_scope(scope)
|
|
50
|
+
MapAddedTo.new(keeps_others_held: @keeps_others_held, correction_may_be_open: @correction_may_be_open,
|
|
51
|
+
reminded: @reminded, asks_about_completeness: @asks_about_completeness, new_scope: scope)
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
#: () -> Hash[String, untyped]
|
|
55
|
+
def added_facts = @new_scope.to_h
|
|
56
|
+
|
|
57
|
+
# The guidance after adding member, from this map's before-save reminder and correction facts.
|
|
58
|
+
#: (PrintedPrinciple, member: String, invocation: Invocation, in_git: bool) -> String
|
|
59
|
+
def after_member(principle, member:, invocation:, in_git:)
|
|
60
|
+
"#{@new_scope.note}#{COMPLETENESS_QUESTION if @asks_about_completeness && @reminded}" \
|
|
61
|
+
"#{claimed_by_a_fix(member, invocation) if @correction_may_be_open && @reminded}" \
|
|
62
|
+
"#{after_adding(principle, invocation, in_git:) if @reminded}"
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
private
|
|
66
|
+
|
|
67
|
+
# How an added member joins an open correction, ending its command's line.
|
|
68
|
+
#: (String, Invocation) -> String
|
|
69
|
+
def claimed_by_a_fix(member, invocation)
|
|
70
|
+
"If you hold a correction request from submit-answer (phase correction) and this member fixes one of its " \
|
|
71
|
+
"findings, name #{member} in the changed_members of the fixed disposition; the next full audit assesses " \
|
|
72
|
+
"it.\nTo submit the correction instead: #{invocation.submit_answer("REQUEST_ID")}\n"
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
# Commit/inspection guidance and the first audit's place, once the map lists every member.
|
|
76
|
+
#: (PrintedPrinciple, Invocation, in_git: bool) -> String
|
|
77
|
+
def after_adding(principle, invocation, in_git:)
|
|
78
|
+
"Commit #{principle.file} as it changes, so the project's history shows each change; in git, start-audit " \
|
|
79
|
+
"refuses a map that is not committed.\n" \
|
|
80
|
+
"To see the map so far: #{invocation.in_project("show-principle", principle.id)}\n" \
|
|
81
|
+
"#{FirstAudit.new(invocation, in_git:).after_mapping(principle.id, keeps_others_held: @keeps_others_held)}"
|
|
82
|
+
end
|
|
29
83
|
end
|
|
30
84
|
end
|
|
31
85
|
end
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
require_relative "invocation"
|
|
5
5
|
require_relative "printed_principle"
|
|
6
6
|
require_relative "lines_shared_with_member"
|
|
7
|
+
require_relative "consecutive_sections_elsewhere"
|
|
8
|
+
require_relative "added_member"
|
|
7
9
|
require_relative "map_added_to"
|
|
8
10
|
require_relative "activation_in_hand"
|
|
9
11
|
require_relative "first_audit"
|
|
@@ -17,7 +19,7 @@ module Principles
|
|
|
17
19
|
class MapResult
|
|
18
20
|
# The placeholders each printed command leaves for the agent to fill.
|
|
19
21
|
ADD_MEMBER_USAGE = "PATH [--section \"Exact heading text\"] [--starting-at \"text that occurs once\" " \
|
|
20
|
-
"[--ending-at \"text
|
|
22
|
+
"[--ending-at \"text occurring once after the opening\"]] [--query '$.description'] " \
|
|
21
23
|
"--role \"The part it plays\""
|
|
22
24
|
|
|
23
25
|
CREATED = "Which files or Markdown sections reinforce this principle? Add each one with the part it plays, " \
|
|
@@ -40,6 +42,17 @@ module Principles
|
|
|
40
42
|
question(principle, CREATED, add_member_command(principle.id))
|
|
41
43
|
end
|
|
42
44
|
|
|
45
|
+
# Removal changes an entry rather than writing a file; an untracked deleted map needs no git commit.
|
|
46
|
+
#: (String, file: String) -> Hash[String, untyped]
|
|
47
|
+
def removed(id, file:)
|
|
48
|
+
commit = @in_git ? "If this map was tracked, commit its removal.\n" : ""
|
|
49
|
+
{ "status" => "removed", "principle_id" => id, "wrote" => [], "removed" => [file],
|
|
50
|
+
"next_action" => "This map is inactive in routine reports. Any retained findings remain unresolved.\n" \
|
|
51
|
+
"Inspect a readable retained record, if one exists: " \
|
|
52
|
+
"#{@invocation.in_project("show-audit", id)}\n" \
|
|
53
|
+
"#{commit}Inspect the remaining maps: #{@invocation.in_project("list-principles")}" }
|
|
54
|
+
end
|
|
55
|
+
|
|
43
56
|
#: (PrintedPrinciple) -> Hash[String, untyped]
|
|
44
57
|
def description_changed(principle)
|
|
45
58
|
question(principle, "Changed the description of #{principle.id}.", start_audit(principle.id))
|
|
@@ -63,14 +76,16 @@ module Principles
|
|
|
63
76
|
|
|
64
77
|
# shared says which members share a line with the new one; added lists them only when there are some, as it
|
|
65
78
|
# carries a check only when one is named. joined is what the result says of the map the member joined.
|
|
66
|
-
#: (PrintedPrinciple, added: Hash[String, untyped], ?shared: LinesSharedWithMember, ?joined: MapAddedTo
|
|
79
|
+
#: (PrintedPrinciple, added: Hash[String, untyped], ?shared: LinesSharedWithMember, ?joined: MapAddedTo,
|
|
80
|
+
#| ?consecutive: ConsecutiveSectionsElsewhere)
|
|
67
81
|
#| -> Hash[String, untyped]
|
|
68
|
-
def member_added(principle, added:, shared: LinesSharedWithMember.new, joined: MapAddedTo.new
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
82
|
+
def member_added(principle, added:, shared: LinesSharedWithMember.new, joined: MapAddedTo.new,
|
|
83
|
+
consecutive: ConsecutiveSectionsElsewhere.new)
|
|
84
|
+
member = AddedMember.new(added, shared: shared, consecutive: consecutive)
|
|
85
|
+
after = joined.after_member(principle, member: member.id, invocation: @invocation, in_git: @in_git)
|
|
86
|
+
question(principle, "#{member.opening}#{after}".rstrip,
|
|
72
87
|
add_member_command(principle.id), shown: { "member_count" => principle.members.length })
|
|
73
|
-
.merge("added" =>
|
|
88
|
+
.merge("added" => member.to_h.merge(joined.added_facts))
|
|
74
89
|
end
|
|
75
90
|
|
|
76
91
|
# add-member's report of the map it started, with the description and activation it wrote, which the agent
|
|
@@ -127,41 +142,6 @@ module Principles
|
|
|
127
142
|
|
|
128
143
|
private
|
|
129
144
|
|
|
130
|
-
# What add-member's question says after the member it added, id, as joined says of the map: how a fix claims
|
|
131
|
-
# it while a correction may be open, then what to do after mapping, each only when joined says to remind, once
|
|
132
|
-
# per sitting (#1025, #1057).
|
|
133
|
-
#: (PrintedPrinciple, String, MapAddedTo) -> String
|
|
134
|
-
def after_the_member(principle, id, joined)
|
|
135
|
-
"#{claimed_by_a_fix(id) if joined.correction_may_be_open && joined.reminded}" \
|
|
136
|
-
"#{after_adding(principle, keeps_others_held: joined.keeps_others_held) if joined.reminded}"
|
|
137
|
-
end
|
|
138
|
-
|
|
139
|
-
# How a member added while a correction is open joins it: a fix claims it, and the next full audit assesses it
|
|
140
|
-
# (D72). It ends its own line, since it ends with a command.
|
|
141
|
-
#: (String) -> String
|
|
142
|
-
def claimed_by_a_fix(member)
|
|
143
|
-
"If you hold a correction request from submit-answer (phase correction) and this member fixes one of its " \
|
|
144
|
-
"findings, name #{member} in the changed_members of the fixed disposition; the next full audit assesses " \
|
|
145
|
-
"it.\nTo submit the correction instead: #{@invocation.submit_answer("REQUEST_ID")}\n"
|
|
146
|
-
end
|
|
147
|
-
|
|
148
|
-
# What add-member says after the member it added: to commit the map as it changes, how to see it, and the full
|
|
149
|
-
# audit's place once it lists every member.
|
|
150
|
-
#: (PrintedPrinciple, keeps_others_held: bool) -> String
|
|
151
|
-
def after_adding(principle, keeps_others_held:)
|
|
152
|
-
"Commit #{principle.file} as it changes, so the project's history shows each change; in git, start-audit " \
|
|
153
|
-
"refuses a map that is not committed.\n" \
|
|
154
|
-
"To see the map so far: #{@invocation.in_project("show-principle", principle.id)}\n" \
|
|
155
|
-
"#{FirstAudit.new(@invocation, in_git: @in_git).after_mapping(principle.id, keeps_others_held:)}"
|
|
156
|
-
end
|
|
157
|
-
|
|
158
|
-
# The lines a member spans, said so that a passage cut short shows; it ends with a space.
|
|
159
|
-
#: (Hash[String, untyped]) -> String
|
|
160
|
-
def span(member)
|
|
161
|
-
"#{member.fetch("id")} spans lines #{member.fetch("first_line")} to #{member.fetch("last_line")}; " \
|
|
162
|
-
"if that is not the passage you meant, move it with move-member. "
|
|
163
|
-
end
|
|
164
|
-
|
|
165
145
|
# shown is what the result prints of the map: the whole map unless the caller names less, as add-member
|
|
166
146
|
# does (#400).
|
|
167
147
|
#: (PrintedPrinciple, String, String, ?shown: Hash[String, untyped]) -> Hash[String, untyped]
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# typed: strict
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require_relative "invocation"
|
|
5
|
+
require_relative "principles_with_no_completed_audit"
|
|
6
|
+
|
|
7
|
+
module Principles
|
|
8
|
+
module Views
|
|
9
|
+
# Mapping facts that precede baseline instructions, and their next steps once those instructions are met.
|
|
10
|
+
class MapsNeedingMembersOrAudit
|
|
11
|
+
#: (Invocation, report: Hash[String, untyped], files_to_commit: Hash[String, Array[String]],
|
|
12
|
+
#| ?waiting: Array[String]) -> void
|
|
13
|
+
def initialize(invocation, report:, files_to_commit:, waiting: [])
|
|
14
|
+
@invocation = invocation
|
|
15
|
+
awaiting = report.fetch("awaiting_first_audit", [])
|
|
16
|
+
@ids = report.fetch("no_completed_audit", []) - awaiting - waiting #: Array[String]
|
|
17
|
+
@empty = report.fetch("empty_maps", []) - waiting #: Array[String]
|
|
18
|
+
@files = files_to_commit
|
|
19
|
+
freeze
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
#: () -> String?
|
|
23
|
+
def notice
|
|
24
|
+
PrinciplesWithNoCompletedAudit.new(ids: @ids, audits: []).notice unless @ids.empty?
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
#: () -> Array[String]
|
|
28
|
+
def actions
|
|
29
|
+
[*@empty.map { |id| empty_map(id) }, *(@ids - @empty).map { |id| first_audit(id) }]
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
private
|
|
33
|
+
|
|
34
|
+
#: (String) -> String
|
|
35
|
+
def empty_map(id)
|
|
36
|
+
"#{id} has no members. Add its first member: " \
|
|
37
|
+
"#{@invocation.in_project("add-member", id, usage: "PATH --role ROLE")}"
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
#: (String) -> String
|
|
41
|
+
def first_audit(id)
|
|
42
|
+
after = @files.fetch(id, []).empty? ? "To" : "After committing the required files,"
|
|
43
|
+
"#{after} start #{id}'s first full audit: #{@invocation.in_project("start-audit", id)}"
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
@@ -25,7 +25,8 @@ module Principles
|
|
|
25
25
|
freeze
|
|
26
26
|
end
|
|
27
27
|
|
|
28
|
-
# The first line on each side the other lacks, which
|
|
28
|
+
# The first line on each side the other lacks, which an answer leaving its quotes out reads them as (#1111,
|
|
29
|
+
# #1166).
|
|
29
30
|
#: Hash[String, String]
|
|
30
31
|
attr_reader :first_changed_lines
|
|
31
32
|
|
|
@@ -13,7 +13,8 @@ module Principles
|
|
|
13
13
|
FLAGS = { "section" => "--section", "starting_at" => "--starting-at", "ending_at" => "--ending-at",
|
|
14
14
|
"query" => "--query", "path" => "--path" }.freeze #: Hash[String, String]
|
|
15
15
|
# The placeholder the agent fills in for each field a move leaves to it.
|
|
16
|
-
PLACEHOLDERS = { "section" => "HEADING", "starting_at" => "NEW_OPENING_TEXT",
|
|
16
|
+
PLACEHOLDERS = { "section" => "HEADING", "starting_at" => "NEW_OPENING_TEXT",
|
|
17
|
+
"ending_at" => "NEW_ENDING_TEXT", "query" => "QUERY",
|
|
17
18
|
"path" => "NEW_PATH" }.freeze #: Hash[String, String]
|
|
18
19
|
|
|
19
20
|
#: (Invocation) -> void
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# typed: strict
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
module Principles
|
|
5
|
+
module Views
|
|
6
|
+
# A new known scope's literal facts and the availability question, from plain values only.
|
|
7
|
+
class NewLoadingScope
|
|
8
|
+
UNKNOWN_LIMIT = "Unknown scopes in not_compared remain limitations. "
|
|
9
|
+
|
|
10
|
+
#: (?Hash[String, untyped]) -> void
|
|
11
|
+
def initialize(facts = {})
|
|
12
|
+
@facts = facts
|
|
13
|
+
freeze
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
#: () -> Hash[String, untyped]
|
|
17
|
+
def to_h = @facts.empty? ? {} : { "new_loading_scope" => @facts }
|
|
18
|
+
|
|
19
|
+
#: () -> String
|
|
20
|
+
def note
|
|
21
|
+
return "" if @facts.empty?
|
|
22
|
+
|
|
23
|
+
"Claude Code loading derivation, assuming a session at the project root, gives this member a known " \
|
|
24
|
+
"scope not already represented (new_loading_scope). Will each carrier be available where this principle " \
|
|
25
|
+
"applies, or should one link to another carrier? These are predictions, not observed delivery; " \
|
|
26
|
+
"literal paths do not establish glob coverage. " \
|
|
27
|
+
"#{UNKNOWN_LIMIT if @facts.fetch("not_compared", []).any?}"
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -8,35 +8,39 @@ module Principles
|
|
|
8
8
|
# What this tool prints, from plain values a controller hands it. views/CLAUDE.md owns the boundary.
|
|
9
9
|
module Views
|
|
10
10
|
# The check_result a one-member audit's template starts with for a checked member, whose check is the one the last
|
|
11
|
-
# audit ran, since any other is refused at its start (#1071)
|
|
12
|
-
# or cannot run is refused as a full audit's to judge, so it
|
|
13
|
-
# full audits run it (#1112).
|
|
11
|
+
# audit ran, since any other is refused at its start (#1071), and the instruction its request gives beside it. It
|
|
12
|
+
# asks for a passing run alone, since one that fails or cannot run is refused as a full audit's to judge, so it
|
|
13
|
+
# prints no not_run_reason and says nothing of how often full audits run it (#1112). Its exit_status holds a short
|
|
14
|
+
# placeholder where the integer goes, and what to do, with what the check hides and the line its last review rested
|
|
15
|
+
# on, is the instruction's (#1170).
|
|
14
16
|
class OneMemberCheckResultTemplate
|
|
15
|
-
# The template for the checked member a request lists as entry, with its check
|
|
16
|
-
#
|
|
17
|
-
# there,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
# The template for the checked member a request lists as entry, with how its check stands to the last audit's
|
|
18
|
+
# and any hidden characters in it; nil for a member without a check. exit_status is the placeholder it prints
|
|
19
|
+
# there, its one field: the answer reads the command as the request printed it and keeps the line the last
|
|
20
|
+
# review rested on, so neither is printed to fill (#1166, #1170).
|
|
21
|
+
#: (Hash[String, untyped], exit_status: String) -> OneMemberCheckResultTemplate?
|
|
22
|
+
def self.for(entry, exit_status:)
|
|
23
|
+
return unless entry["check"]
|
|
24
|
+
|
|
25
|
+
new(CheckNotes.new(entry["check_since_last_audit"], entry.fetch("check_hidden_characters", [])), exit_status:)
|
|
23
26
|
end
|
|
24
27
|
|
|
25
|
-
#: (
|
|
26
|
-
def initialize(
|
|
27
|
-
@check = check
|
|
28
|
+
#: (CheckNotes, exit_status: String) -> void
|
|
29
|
+
def initialize(notes, exit_status:)
|
|
28
30
|
@notes = notes
|
|
29
|
-
@
|
|
31
|
+
@exit_status = exit_status
|
|
30
32
|
freeze
|
|
31
33
|
end
|
|
32
34
|
|
|
35
|
+
# The check_result to fill.
|
|
33
36
|
#: () -> Hash[String, untyped]
|
|
34
|
-
def to_h
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
def to_h = { "exit_status" => @exit_status }
|
|
38
|
+
|
|
39
|
+
# What to do before filling exit_status, which the request gives as context.check_instruction.
|
|
40
|
+
#: () -> String
|
|
41
|
+
def instruction
|
|
42
|
+
[@notes.hidden_characters, Prompts.text("acknowledge-a-change/run-the-check-and-report-it-passing"),
|
|
43
|
+
*@notes.kept_review].compact.join(" ")
|
|
40
44
|
end
|
|
41
45
|
end
|
|
42
46
|
end
|
|
@@ -63,7 +63,10 @@ module Principles
|
|
|
63
63
|
|
|
64
64
|
audit = "To audit it: #{@invocation.in_project("start-audit", usage: "ID")}" if one_to_audit
|
|
65
65
|
waits = waited_on(waiting) unless waiting.empty?
|
|
66
|
-
["To see a principle's members: #{@invocation.in_project("show-principle", usage: "ID")}", audit,
|
|
66
|
+
["To see a principle's members: #{@invocation.in_project("show-principle", usage: "ID")}", audit,
|
|
67
|
+
"To survey this project: #{@invocation.in_project("list-candidate-files")}",
|
|
68
|
+
"To survey the principles a change carries: " \
|
|
69
|
+
"#{@invocation.in_project("list-candidate-files", usage: "--commits-after REV")}", waits].compact
|
|
67
70
|
end
|
|
68
71
|
|
|
69
72
|
# The principles whose audits wait on an upgrade, and how to update, once for each way the records name.
|
|
@@ -18,12 +18,18 @@ module Principles
|
|
|
18
18
|
freeze
|
|
19
19
|
end
|
|
20
20
|
|
|
21
|
+
# The lack of a completed audit, independent of whether the map is committed or has members yet.
|
|
21
22
|
#: () -> String
|
|
22
|
-
def
|
|
23
|
+
def notice
|
|
23
24
|
one = @ids.length == 1
|
|
24
25
|
carry = one ? "its members carry it" : "their members carry them"
|
|
25
|
-
"No full audit has completed for #{ProseList.new(@ids)}
|
|
26
|
-
"
|
|
26
|
+
"No full audit has completed for #{ProseList.new(@ids)} (#{@ids.length} principle#{"s" unless one}), " \
|
|
27
|
+
"so whether #{carry} is unknown."
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
#: () -> String
|
|
31
|
+
def to_s
|
|
32
|
+
"#{notice} To start #{@ids.length == 1 ? "one" : "each"}:\n#{@audits.join("\n")}"
|
|
27
33
|
end
|
|
28
34
|
end
|
|
29
35
|
end
|
|
@@ -78,7 +78,9 @@ module Principles
|
|
|
78
78
|
# principle waiting on an upgrade, whose members are not counted, so they leave counts empty (D85, V8).
|
|
79
79
|
#: (Hash[String, untyped], String) -> Array[String]
|
|
80
80
|
def notes(report, nothing_changed)
|
|
81
|
-
|
|
81
|
+
no_maps = report.fetch("counts").empty? && !report.key?("empty_maps") &&
|
|
82
|
+
!report.key?("records_waiting_on_an_upgrade")
|
|
83
|
+
[(NO_MAPS if no_maps),
|
|
82
84
|
(report.fetch("next_action") unless report.fetch("next_action") == nothing_changed),
|
|
83
85
|
("Details: #{@invocation.in_project("list-member-problems")}" unless report.fetch("members").empty?)].compact
|
|
84
86
|
end
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
require_relative "invocation"
|
|
5
5
|
require_relative "members_with_no_baseline"
|
|
6
|
+
require_relative "maps_needing_members_or_audit"
|
|
6
7
|
require_relative "principles_with_no_completed_audit"
|
|
7
8
|
require_relative "record_waiting_on_an_upgrade"
|
|
8
9
|
|
|
@@ -45,8 +46,11 @@ module Principles
|
|
|
45
46
|
#| acknowledgeable: Hash[String, Array[String]], waiting: Array[RecordWaitingOnAnUpgrade]) -> String
|
|
46
47
|
def next_action(report, no_baseline_files:, acknowledgeable:, waiting:)
|
|
47
48
|
waits = waiting.map(&:principle)
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
mapping = MapsNeedingMembersOrAudit.new(@invocation, report: report, files_to_commit: no_baseline_files,
|
|
50
|
+
waiting: waits)
|
|
51
|
+
action = [changed_action(report, acknowledgeable, waits), unaudited_action(report, waits), mapping.notice,
|
|
52
|
+
*no_baseline_actions(report, no_baseline_files).map(&:to_s), *mapping.actions,
|
|
53
|
+
*waiting.map(&:to_s)].compact.join("\n")
|
|
50
54
|
action.empty? ? NOTHING_CHANGED : action
|
|
51
55
|
end
|
|
52
56
|
|
|
@@ -64,7 +68,8 @@ module Principles
|
|
|
64
68
|
next "Audit #{id} in full to judge its changed members: #{full}" if members.empty?
|
|
65
69
|
|
|
66
70
|
[*members.flat_map { |member| acknowledge_lines(id, member) },
|
|
67
|
-
"When a change alters what a member of #{id} says, or
|
|
71
|
+
"When a change alters what a member of #{id} says, or its check is new, changed or does not pass, " \
|
|
72
|
+
"audit it in full: #{full}"]
|
|
68
73
|
end
|
|
69
74
|
audits.empty? ? nil : audits.join("\n")
|
|
70
75
|
end
|
data/lib/principles/views/prompts/acknowledge-a-change/run-the-check-and-report-it-passing.md
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
Run the command in the project, then
|
|
2
|
-
keeps only a passing run: a check that fails or cannot be run here is a
|
|
3
|
-
audit instead of answering this one.
|
|
1
|
+
Run the member's check, the command member.check names, in the project, then give its exit status, an integer, as
|
|
2
|
+
check_result.exit_status. An acknowledgement keeps only a passing run: a check that fails or cannot be run here is a
|
|
3
|
+
full audit's to judge, so start that audit instead of answering this one.
|
data/lib/principles/views/prompts/acknowledge-a-change/say-whether-the-change-keeps-the-meaning.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Read the change in member_lines, or by running read_the_change. Answer `meaning_kept: true` only when the member
|
|
2
|
-
says the same thing. A member still says the same thing after a fixed typo, a reworded sentence or a
|
|
3
|
-
citation; an added, dropped, reversed, narrowed or widened rule changes what it says. When it changed, or
|
|
4
|
-
unsure, run a full audit instead. Give a one-line `reason` in your own words
|
|
5
|
-
`first_changed_lines
|
|
6
|
-
characters
|
|
1
|
+
Read the change in member_lines, or by running read_the_change. Answer `meaning_kept: true` only when the member
|
|
2
|
+
still says the same thing. A member still says the same thing after a fixed typo, a reworded sentence or a
|
|
3
|
+
renumbered citation; an added, dropped, reversed, narrowed or widened rule changes what it says. When it changed, or
|
|
4
|
+
you are unsure, run a full audit instead. Give a one-line `reason` in your own words, and fill the template; quotes
|
|
5
|
+
left out read as `first_changed_lines`. Optional: `old_line` and `new_line`, another changed line per side or 30
|
|
6
|
+
characters including the edit; `basis.base_commit`; a check's `check_result.command` and `check_result.review_basis`.
|