principles 0.0.7 → 0.0.8
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 +383 -0
- data/LICENSE +202 -0
- data/NOTICE +4 -0
- data/README.md +111 -0
- data/exe/principles +20 -0
- data/lib/principles/after_commit_hook_options.rb +2 -2
- data/lib/principles/cli.rb +50 -42
- data/lib/principles/command_line.rb +22 -16
- data/lib/principles/command_routes.rb +20 -6
- data/lib/principles/controllers/acknowledgement.rb +29 -74
- data/lib/principles/controllers/acknowledgements.rb +154 -0
- data/lib/principles/controllers/after_commit_report.rb +44 -0
- data/lib/principles/controllers/answer.rb +48 -18
- data/lib/principles/controllers/answer_phase.rb +20 -3
- data/lib/principles/controllers/assessment.rb +32 -11
- data/lib/principles/controllers/audit.rb +43 -19
- data/lib/principles/controllers/audit_completion.rb +21 -12
- data/lib/principles/controllers/command.rb +13 -12
- data/lib/principles/controllers/correction.rb +15 -7
- data/lib/principles/controllers/first_audit_brief.rb +40 -0
- data/lib/principles/controllers/full_audit_request.rb +41 -82
- data/lib/principles/controllers/hook_setup.rb +49 -0
- data/lib/principles/controllers/inventory.rb +10 -8
- data/lib/principles/controllers/mapping.rb +2 -2
- data/lib/principles/controllers/member_acknowledgement.rb +32 -21
- data/lib/principles/controllers/member_entries.rb +4 -4
- data/lib/principles/controllers/member_problems_report.rb +62 -16
- data/lib/principles/controllers/members_a_commit_changed.rb +3 -3
- data/lib/principles/controllers/members_to_assess.rb +23 -20
- data/lib/principles/controllers/meta_principle_setup.rb +5 -6
- data/lib/principles/controllers/open_correction.rb +42 -0
- data/lib/principles/controllers/parts_to_read.rb +117 -0
- data/lib/principles/controllers/repoint.rb +1 -1
- data/lib/principles/controllers/running_tool.rb +56 -6
- data/lib/principles/controllers/session_start_report.rb +62 -0
- data/lib/principles/controllers/survey.rb +2 -2
- data/lib/principles/data/audit_files.rb +7 -7
- data/lib/principles/data/bounded_file.rb +1 -1
- data/lib/principles/data/candidate_files_found.rb +6 -3
- data/lib/principles/data/command-steps.json +61 -6
- data/lib/principles/data/expected_type.rb +3 -3
- data/lib/principles/data/first_parent_log.rb +1 -1
- data/lib/principles/data/head_reflog.rb +74 -0
- data/lib/principles/data/hook_input.rb +59 -0
- data/lib/principles/data/ignored_by_git.rb +2 -2
- data/lib/principles/data/known_fields.rb +1 -1
- data/lib/principles/data/linked_path.rb +1 -1
- data/lib/principles/data/map_files.rb +2 -2
- data/lib/principles/data/principles_on_path.rb +83 -0
- data/lib/principles/data/principles_subfolder.rb +1 -1
- data/lib/principles/data/project_files.rb +10 -3
- data/lib/principles/data/repository.rb +14 -7
- data/lib/principles/data/running_version.rb +10 -8
- data/lib/principles/data/schema_check.rb +5 -5
- data/lib/principles/data/schemas/acknowledgement-answer.schema.json +86 -21
- data/lib/principles/data/schemas/acknowledgements-answer.schema.json +9 -2
- data/lib/principles/data/schemas/assessment-answer.schema.json +43 -22
- data/lib/principles/data/schemas/audit-record.schema.json +29 -20
- data/lib/principles/data/schemas/command-steps.schema.json +1 -1
- data/lib/principles/data/schemas/correction-answer-guide.schema.json +1 -1
- data/lib/principles/data/schemas/correction-answer.schema.json +9 -9
- data/lib/principles/data/schemas/member-map.schema.json +3 -3
- data/lib/principles/data/schemas/repointing-answer.schema.json +1 -1
- data/lib/principles/error.rb +4 -4
- data/lib/principles/failure_refusal.rb +57 -0
- data/lib/principles/invocation_options.rb +4 -4
- data/lib/principles/launch.rb +49 -0
- data/lib/principles/list_open_findings_options.rb +1 -1
- data/lib/principles/models/accepted_loading.rb +2 -2
- data/lib/principles/models/acknowledged_check.rb +23 -11
- data/lib/principles/models/acknowledgement.rb +34 -18
- data/lib/principles/models/acknowledgement_left_as_printed.rb +7 -15
- data/lib/principles/models/acknowledgement_refusal.rb +25 -10
- data/lib/principles/models/acknowledgements.rb +45 -29
- data/lib/principles/models/acknowledgements_across.rb +68 -0
- data/lib/principles/models/activation.rb +2 -2
- data/lib/principles/models/after_commit_input.rb +115 -0
- data/lib/principles/models/agent_loads.rb +1 -1
- data/lib/principles/models/answer_fields.rb +2 -2
- data/lib/principles/models/answer_place.rb +3 -3
- data/lib/principles/models/answer_text.rb +2 -2
- data/lib/principles/models/answered_time.rb +4 -4
- data/lib/principles/models/assessment_answer.rb +10 -10
- data/lib/principles/models/assessment_basis.rb +2 -2
- data/lib/principles/models/assessment_left_as_printed.rb +1 -1
- data/lib/principles/models/assessment_report.rb +6 -7
- data/lib/principles/models/audit.rb +33 -34
- data/lib/principles/models/audit_record.rb +54 -28
- data/lib/principles/models/audit_records.rb +13 -13
- data/lib/principles/models/audit_start.rb +3 -3
- data/lib/principles/models/audited_member_lines.rb +1 -1
- data/lib/principles/models/candidate_files.rb +18 -10
- data/lib/principles/models/candidate_inventory.rb +6 -6
- data/lib/principles/models/candidate_outline.rb +9 -9
- data/lib/principles/models/carried_assessments.rb +18 -3
- data/lib/principles/models/carried_member.rb +5 -5
- data/lib/principles/models/changed_regions.rb +92 -0
- data/lib/principles/models/check_result_guide.rb +50 -0
- data/lib/principles/models/check_since_last_audit.rb +5 -4
- data/lib/principles/models/cited_files.rb +4 -4
- data/lib/principles/models/command_steps.rb +3 -3
- data/lib/principles/models/commits_brought_in.rb +1 -1
- data/lib/principles/models/commits_since_base.rb +1 -1
- data/lib/principles/models/correction_answer.rb +2 -2
- data/lib/principles/models/correction_basis.rb +7 -7
- data/lib/principles/models/dated_line.rb +1 -2
- data/lib/principles/models/decided_prior_findings.rb +6 -6
- data/lib/principles/models/declared_map_changes.rb +5 -5
- data/lib/principles/models/disposition.rb +21 -21
- data/lib/principles/models/entry_file.rb +1 -1
- data/lib/principles/models/entry_files.rb +1 -1
- data/lib/principles/models/evidence_item.rb +1 -1
- data/lib/principles/models/evidence_lines_since.rb +2 -2
- data/lib/principles/models/evidence_replacements.rb +3 -3
- data/lib/principles/models/finding_write_ups.rb +12 -5
- data/lib/principles/models/findings_left_open.rb +4 -4
- data/lib/principles/models/first_full_audit.rb +32 -0
- data/lib/principles/models/first_raised_claim.rb +1 -1
- data/lib/principles/models/fix_only_fields.rb +1 -1
- data/lib/principles/models/head_moves.rb +66 -0
- data/lib/principles/models/hook_commands.rb +49 -4
- data/lib/principles/models/ignored_candidates.rb +1 -1
- data/lib/principles/models/instruction_named.rb +2 -3
- data/lib/principles/models/json_digest.rb +2 -2
- data/lib/principles/models/json_path_query.rb +1 -1
- data/lib/principles/models/kept_prior_finding.rb +9 -9
- data/lib/principles/models/last_completed_revision.rb +4 -5
- data/lib/principles/models/left_as_printed.rb +2 -2
- data/lib/principles/models/line_diff.rb +113 -0
- data/lib/principles/models/line_span.rb +1 -1
- data/lib/principles/models/list_member_problems_check.rb +4 -4
- data/lib/principles/models/listed_members.rb +7 -9
- data/lib/principles/models/loaded_files.rb +4 -5
- data/lib/principles/models/loading_decision.rb +3 -3
- data/lib/principles/models/loading_facts.rb +1 -1
- data/lib/principles/models/loads_to_check.rb +1 -1
- data/lib/principles/models/located_text.rb +1 -1
- data/lib/principles/models/mapped_principles.rb +2 -2
- data/lib/principles/models/member.rb +31 -4
- data/lib/principles/models/member_assessments.rb +8 -8
- data/lib/principles/models/member_elsewhere.rb +4 -4
- data/lib/principles/models/member_file.rb +4 -4
- data/lib/principles/models/member_grounds.rb +1 -1
- data/lib/principles/models/member_hashes_as_written.rb +1 -1
- data/lib/principles/models/member_lines.rb +29 -61
- data/lib/principles/models/member_loads.rb +2 -2
- data/lib/principles/models/member_moves.rb +1 -1
- data/lib/principles/models/member_problems.rb +14 -15
- data/lib/principles/models/member_repair_moves.rb +15 -9
- data/lib/principles/models/member_sighting.rb +10 -10
- data/lib/principles/models/member_snapshots.rb +1 -1
- data/lib/principles/models/member_state.rb +1 -1
- data/lib/principles/models/members_across_principles.rb +77 -0
- data/lib/principles/models/members_elsewhere.rb +2 -2
- data/lib/principles/models/members_sharing_lines.rb +7 -7
- data/lib/principles/models/meta_principle.rb +11 -4
- data/lib/principles/models/missing_files.rb +3 -3
- data/lib/principles/models/new_findings.rb +4 -4
- data/lib/principles/models/open_correction.rb +57 -0
- data/lib/principles/models/open_finding.rb +36 -31
- data/lib/principles/models/open_findings_elsewhere.rb +2 -2
- data/lib/principles/models/other_principles.rb +2 -2
- data/lib/principles/models/other_templates_placeholders.rb +17 -16
- data/lib/principles/models/outline_budget.rb +7 -7
- data/lib/principles/models/outline_group.rb +1 -1
- data/lib/principles/models/outline_section.rb +2 -2
- data/lib/principles/models/part_named.rb +41 -0
- data/lib/principles/models/placement.rb +2 -2
- data/lib/principles/models/principle.rb +13 -13
- data/lib/principles/models/principle_history.rb +8 -8
- data/lib/principles/models/principle_members.rb +14 -7
- data/lib/principles/models/principles_folder_move.rb +1 -1
- data/lib/principles/models/principles_on_path.rb +29 -0
- data/lib/principles/models/principles_package.rb +3 -3
- data/lib/principles/models/prior_decision_fields.rb +8 -8
- data/lib/principles/models/prior_finding_decision.rb +8 -8
- data/lib/principles/models/prior_finding_outcomes.rb +1 -1
- data/lib/principles/models/prior_findings.rb +5 -5
- data/lib/principles/models/problem_report.rb +26 -8
- data/lib/principles/models/project.rb +27 -19
- data/lib/principles/models/project_history.rb +18 -12
- data/lib/principles/models/quoted_change.rb +8 -8
- data/lib/principles/models/recent_decision.rb +3 -3
- data/lib/principles/models/record_format.rb +16 -10
- data/lib/principles/models/record_judged_against.rb +4 -4
- data/lib/principles/models/recorded_entry.rb +17 -8
- data/lib/principles/models/recorded_finding.rb +9 -9
- data/lib/principles/models/recorded_findings.rb +2 -2
- data/lib/principles/models/recorded_hashes.rb +2 -2
- data/lib/principles/models/recorded_members.rb +13 -13
- data/lib/principles/models/refusal_before_shape.rb +2 -2
- data/lib/principles/models/repoint.rb +3 -3
- data/lib/principles/models/report_hooks.rb +69 -0
- data/lib/principles/models/reported_check.rb +34 -31
- data/lib/principles/models/request_id.rb +18 -6
- data/lib/principles/models/runs_from.rb +7 -2
- data/lib/principles/models/sent_answer.rb +14 -12
- data/lib/principles/models/sent_prior_decisions.rb +1 -1
- data/lib/principles/models/session_start_input.rb +37 -0
- data/lib/principles/models/shape_problems_beside.rb +1 -1
- data/lib/principles/models/skill_loads.rb +1 -1
- data/lib/principles/models/stale_request.rb +59 -0
- data/lib/principles/models/still_holds_restatement.rb +6 -6
- data/lib/principles/models/submitted_answer.rb +1 -1
- data/lib/principles/models/template_placeholders.rb +6 -6
- data/lib/principles/models/text_within.rb +1 -1
- data/lib/principles/models/tracked_paths.rb +38 -0
- data/lib/principles/models/unchecked_members.rb +2 -2
- data/lib/principles/models/uncommitted_files.rb +1 -1
- data/lib/principles/models/uncommitted_outside_the_map.rb +2 -2
- data/lib/principles/models/waits_on.rb +1 -1
- data/lib/principles/models/write_up_opening.rb +5 -5
- data/lib/principles/models/write_up_pointer.rb +3 -3
- data/lib/principles/models/write_up_repoint.rb +2 -3
- data/lib/principles/positional_arguments.rb +13 -6
- data/lib/principles/prose_list.rb +1 -1
- data/lib/principles/session_start_options.rb +1 -1
- data/lib/principles/start_audit_options.rb +46 -12
- data/lib/principles/supported_ruby.rb +24 -7
- data/lib/principles/version.rb +2 -2
- data/lib/principles/views/acknowledged_since_last_audit.rb +2 -2
- data/lib/principles/views/acknowledgement_result.rb +97 -11
- data/lib/principles/views/activation_in_hand.rb +1 -1
- data/lib/principles/views/answered_request.rb +6 -2
- data/lib/principles/views/assessed_members.rb +50 -41
- data/lib/principles/views/assessment_request.rb +39 -36
- data/lib/principles/views/audit_changes.rb +4 -4
- data/lib/principles/views/audit_commit.rb +5 -4
- data/lib/principles/views/audit_result.rb +92 -53
- data/lib/principles/views/candidate_files_result.rb +7 -6
- data/lib/principles/views/check_notes.rb +29 -6
- data/lib/principles/views/check_result_template.rb +45 -34
- data/lib/principles/views/completed_audit_next_step.rb +44 -0
- data/lib/principles/views/context_parts.rb +112 -0
- data/lib/principles/views/correction_request.rb +44 -25
- data/lib/principles/views/diff_since_last_audit.rb +8 -6
- data/lib/principles/views/findings_result.rb +17 -6
- data/lib/principles/views/first_audit_brief.rb +51 -0
- data/lib/principles/views/first_audit_line.rb +45 -0
- data/lib/principles/views/help.rb +4 -4
- data/lib/principles/views/hook_setup_result.rb +91 -0
- data/lib/principles/views/instruction.rb +3 -3
- data/lib/principles/views/invocation.rb +14 -6
- data/lib/principles/views/json_with_entries_on_lines.rb +6 -35
- data/lib/principles/views/landed_since_base.rb +1 -1
- data/lib/principles/views/line_history_since_last_audit.rb +35 -0
- data/lib/principles/views/lines_shared_with_member.rb +6 -6
- data/lib/principles/views/loads_to_check_result.rb +8 -5
- data/lib/principles/views/map_added_to.rb +3 -3
- data/lib/principles/views/map_result.rb +9 -9
- data/lib/principles/views/member_change_since_baseline.rb +44 -23
- data/lib/principles/views/member_lines_beside_text.rb +43 -0
- data/lib/principles/views/member_repairs.rb +3 -2
- data/lib/principles/views/member_row.rb +2 -2
- data/lib/principles/views/members_a_commit_changed.rb +13 -10
- data/lib/principles/views/members_with_no_baseline.rb +3 -3
- data/lib/principles/views/meta_principle_passage.rb +1 -1
- data/lib/principles/views/meta_principle_result.rb +12 -5
- data/lib/principles/views/one_member_check_result_template.rb +7 -7
- data/lib/principles/views/open_findings_elsewhere_result.rb +5 -2
- data/lib/principles/views/open_findings_line.rb +25 -36
- data/lib/principles/views/other_principles_unjudged_result.rb +6 -3
- data/lib/principles/views/outside_the_map_result.rb +5 -2
- data/lib/principles/views/package_since_last_audit_result.rb +29 -6
- data/lib/principles/views/parts_index_result.rb +60 -0
- data/lib/principles/views/principle_read_result.rb +5 -6
- data/lib/principles/views/principle_with_changed_members.rb +1 -1
- data/lib/principles/views/principles_with_no_completed_audit.rb +1 -2
- data/lib/principles/views/printed_json.rb +51 -0
- data/lib/principles/views/printed_principle.rb +1 -1
- data/lib/principles/views/prior_finding_decisions_result.rb +4 -4
- data/lib/principles/views/prior_findings_result.rb +17 -14
- data/lib/principles/views/problem_lines.rb +39 -17
- data/lib/principles/views/problem_result.rb +40 -37
- data/lib/principles/views/prompts/acknowledge-a-change/judge-each-member-once-for-every-principle.md +2 -0
- data/lib/principles/views/prompts/acknowledge-a-change/read-the-deferred-findings-it-keeps.md +1 -0
- data/lib/principles/views/prompts/acknowledge-a-change/resolve-them-in-a-full-audit.md +1 -0
- data/lib/principles/views/prompts/acknowledge-a-change/say-whether-the-change-keeps-the-meaning.md +3 -3
- data/lib/principles/views/prompts/assess-every-member/confirm-each-write-up-pointer-the-answer-drops.md +2 -0
- data/lib/principles/views/prompts/assess-every-member/have-a-changed-check-reviewed-before-running-it.md +1 -1
- data/lib/principles/views/prompts/assess-every-member/have-a-new-check-reviewed-before-running-it.md +1 -1
- data/lib/principles/views/prompts/assess-every-member/judge-a-carried-assessment-citing-a-decided-finding.md +3 -0
- data/lib/principles/views/prompts/assess-every-member/judge-a-submitted-carried-assessment-citing-a-decided-finding.md +5 -0
- data/lib/principles/views/prompts/assess-every-member/judge-the-keeping-under-the-release-since-the-last-audit.md +1 -1
- data/lib/principles/views/prompts/assess-every-member/keep-the-printed-review-basis-or-replace-it.md +1 -0
- data/lib/principles/views/prompts/assess-every-member/name-the-commit-that-made-the-check.md +1 -0
- data/lib/principles/views/prompts/assess-every-member/read-a-trimmed-instruction-whole.md +1 -1
- data/lib/principles/views/prompts/assess-every-member/read-the-request-in-parts.md +1 -0
- data/lib/principles/views/prompts/assess-every-member/why-each-member-is-judged-again.md +3 -2
- 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 -0
- data/lib/principles/views/prompts/dispose-of-each-finding/retain-assessment-and-correction.md +4 -4
- data/lib/principles/views/prompts/find-a-principle-to-map/where-the-inventory-looks.md +2 -2
- data/lib/principles/views/prompts/learn-what-a-command-does/list-candidate-files.md +4 -3
- data/lib/principles/views/prompts/learn-what-a-command-does/list-member-problems.md +6 -6
- data/lib/principles/views/prompts/learn-what-a-command-does/list-open-findings.md +11 -11
- data/lib/principles/views/prompts/learn-what-a-command-does/report-after-commit.md +14 -0
- data/lib/principles/views/prompts/learn-what-a-command-does/report-at-session-start.md +26 -0
- data/lib/principles/views/prompts/learn-what-a-command-does/show-answer-check.md +20 -18
- data/lib/principles/views/prompts/learn-what-a-command-does/show-first-audit-brief.md +19 -0
- data/lib/principles/views/prompts/learn-what-a-command-does/show-hook-setup.md +13 -0
- data/lib/principles/views/prompts/learn-what-a-command-does/show-meta-principle-passage.md +3 -1
- data/lib/principles/views/prompts/learn-what-a-command-does/show-open-correction.md +12 -0
- data/lib/principles/views/prompts/learn-what-a-command-does/start-audit.md +21 -22
- data/lib/principles/views/prompts/learn-what-a-command-does/submit-answer.md +5 -4
- data/lib/principles/views/prompts/report-the-completed-audit/commit-only-what-the-audit-changed.md +2 -2
- data/lib/principles/views/prompts/run-a-first-audit-in-the-background/follow-the-brief.md +18 -0
- data/lib/principles/views/prompts/set-principles-up/offer-the-report-hooks.md +2 -0
- data/lib/principles/views/prompts/set-principles-up/wire-the-report-hooks-with-the-user.md +8 -0
- data/lib/principles/views/prompts/start-a-session/act-on-the-open-findings.md +3 -4
- data/lib/principles/views/prompts/start-a-session/every-loaded-line-costs-every-session.md +1 -1
- data/lib/principles/views/prompts/start-a-session/hand-the-first-audit-to-a-subagent.md +3 -0
- data/lib/principles/views/prompts/start-a-session/run-each-command-above.md +1 -0
- data/lib/principles/views/prompts/start-a-session/start-no-second-first-audit.md +2 -0
- data/lib/principles/views/prompts.rb +1 -1
- data/lib/principles/views/read_the_change.rb +36 -0
- data/lib/principles/views/record_waiting_on_an_upgrade.rb +2 -2
- data/lib/principles/views/repoint_result.rb +1 -1
- data/lib/principles/views/report_hooks_offer.rb +25 -0
- data/lib/principles/views/request_part.rb +5 -5
- data/lib/principles/views/request_parts.rb +1 -1
- data/lib/principles/views/session_start_report.rb +46 -0
- data/lib/principles/views/shell_word.rb +1 -1
- data/lib/principles/views/trimmed_instructions_note.rb +30 -0
- data/lib/principles/views/visible_text.rb +1 -1
- data/lib/principles/views/workflow_diagram.rb +1 -1
- data/principles.gemspec +44 -0
- metadata +83 -14
- data/lib/principles/views/prompts/start-a-session/it-returns-after-each-clear-or-compaction-too.md +0 -1
- data/lib/principles/views/prompts/start-a-session/it-returns-at-each-session-start.md +0 -1
|
@@ -11,24 +11,25 @@ module Principles
|
|
|
11
11
|
# principle several of them reinforce, asked before anything is mapped.
|
|
12
12
|
class CandidateFilesResult
|
|
13
13
|
# What the search for candidates found, as plain values: the inventory, the files git does not track, nil
|
|
14
|
-
# outside git, where nothing checked them
|
|
15
|
-
# name in it
|
|
14
|
+
# outside git, where nothing checked them, and the lists to ask the owner about, each with the paths to
|
|
15
|
+
# name in it.
|
|
16
16
|
class Found
|
|
17
17
|
# What each listed file prints: where it is, how big, where a link leads, and what the survey reads of it.
|
|
18
|
-
PRINTED_FILE_FIELDS = %w[path characters symlink_to changed_in_range description opening_line
|
|
18
|
+
PRINTED_FILE_FIELDS = %w[path characters symlink_to changed_in_range skill_file_spelt description opening_line
|
|
19
|
+
outline].freeze
|
|
19
20
|
|
|
20
21
|
#: Hash[String, Array[String]]
|
|
21
22
|
attr_reader :owner_asks
|
|
22
23
|
|
|
23
|
-
# Whether the inventory names files whose list items were cut to keep the result short
|
|
24
|
+
# Whether the inventory names files whose list items were cut to keep the result short.
|
|
24
25
|
#: () -> bool
|
|
25
26
|
def cut? = @inventory.key?("outlines_cut")
|
|
26
27
|
|
|
27
|
-
# Whether the inventory names files that print their path and size alone, their outlines left out
|
|
28
|
+
# Whether the inventory names files that print their path and size alone, their outlines left out.
|
|
28
29
|
#: () -> bool
|
|
29
30
|
def left_out? = @inventory.key?("outlines_left_out")
|
|
30
31
|
|
|
31
|
-
# What the outlines of the files a range changed print, when every cut left them past the budget
|
|
32
|
+
# What the outlines of the files a range changed print, when every cut left them past the budget.
|
|
32
33
|
#: () -> Integer?
|
|
33
34
|
def range_outlines_bytes = @inventory["range_outlines_bytes"]
|
|
34
35
|
|
|
@@ -7,9 +7,12 @@ module Principles
|
|
|
7
7
|
# What this tool prints, from plain values a controller hands it. views/CLAUDE.md owns the boundary.
|
|
8
8
|
module Views
|
|
9
9
|
# What a checked member's exit_status placeholder says of its check beside what to do, in a full audit's template
|
|
10
|
-
# and a one-member audit's alike: any hidden character the command holds
|
|
11
|
-
# review rested on, which a run keeps unless a new one is given
|
|
10
|
+
# and a one-member audit's alike: any hidden character the command holds, and the line the last audit's
|
|
11
|
+
# review rested on, which a run keeps unless a new one is given.
|
|
12
12
|
class CheckNotes
|
|
13
|
+
# Since when a line an audit still open kept was given, which that audit dates as it completes.
|
|
14
|
+
OPEN_SINCE = "this audit's open assessment" #: String
|
|
15
|
+
|
|
13
16
|
# since_last_audit is how the check stands to the last audit's, with the review line that audit kept, if any;
|
|
14
17
|
# hidden_characters names each hidden character in the command.
|
|
15
18
|
#: (Hash[String, untyped]?, Array[String]) -> void
|
|
@@ -28,17 +31,37 @@ module Principles
|
|
|
28
31
|
characters: @hidden_characters.join("; "))
|
|
29
32
|
end
|
|
30
33
|
|
|
34
|
+
# The line the last audit's review rested on, which a full audit's template prints as review_basis's value to
|
|
35
|
+
# keep or replace; nil when that audit kept none.
|
|
36
|
+
#: () -> String?
|
|
37
|
+
def kept_basis = @since_last_audit&.fetch("review_basis", nil)
|
|
38
|
+
|
|
39
|
+
# That review_basis holds the line the last audit's review rested on, with since when, kept as printed unless
|
|
40
|
+
# replaced, for a template that prints it; nothing when that audit kept none.
|
|
41
|
+
#: () -> Array[String]
|
|
42
|
+
def printed_review
|
|
43
|
+
return [] unless kept_basis
|
|
44
|
+
|
|
45
|
+
[Prompts.text("assess-every-member/keep-the-printed-review-basis-or-replace-it", since: since)]
|
|
46
|
+
end
|
|
47
|
+
|
|
31
48
|
# That a run keeps the line the last audit's review rested on, quoted with since when, unless a new one is
|
|
32
|
-
# given, so whether it still holds can be judged from the template
|
|
33
|
-
# so there is nothing to say
|
|
49
|
+
# given, so whether it still holds can be judged from the template; an older record kept none,
|
|
50
|
+
# so there is nothing to say.
|
|
34
51
|
#: () -> Array[String]
|
|
35
52
|
def kept_review
|
|
36
53
|
return [] unless @since_last_audit&.key?("review_basis")
|
|
37
54
|
|
|
38
55
|
[Prompts.text("assess-every-member/keep-the-last-review-basis-unless-you-give-a-new-one",
|
|
39
|
-
since: @since_last_audit.fetch("
|
|
40
|
-
basis: @since_last_audit.fetch("review_basis"))]
|
|
56
|
+
since: since, basis: @since_last_audit.fetch("review_basis"))]
|
|
41
57
|
end
|
|
58
|
+
|
|
59
|
+
private
|
|
60
|
+
|
|
61
|
+
# Since when the kept line was first kept: its date, or, while the audit that kept it is still open and so has
|
|
62
|
+
# not dated it, that audit's assessment.
|
|
63
|
+
#: () -> String
|
|
64
|
+
def since = @since_last_audit&.fetch("review_basis_since", nil) || OPEN_SINCE
|
|
42
65
|
end
|
|
43
66
|
end
|
|
44
67
|
end
|
|
@@ -9,9 +9,9 @@ module Principles
|
|
|
9
9
|
module Views
|
|
10
10
|
# The check_result a checked member's assessment template starts with: its command, a short exit_status
|
|
11
11
|
# placeholder where the run's status goes, and not_run_reason, the alternative, as a placeholder an answer leaves
|
|
12
|
-
# as printed when it reports a run
|
|
13
|
-
# no audit has run, or one changed since, is reviewed before it runs
|
|
14
|
-
#
|
|
12
|
+
# as printed when it reports a run, with its instruction, what to do before replacing it. A check
|
|
13
|
+
# no audit has run, or one changed since, is reviewed before it runs, so it also gives review_basis to fill,
|
|
14
|
+
# and any hidden character it holds is named where that decision is made.
|
|
15
15
|
class CheckResultTemplate
|
|
16
16
|
# The template for the checked member a request lists as entry, with its check, how that stands to the last
|
|
17
17
|
# audit's and any hidden characters in it; nil for a member without a check.
|
|
@@ -25,57 +25,68 @@ module Principles
|
|
|
25
25
|
|
|
26
26
|
# reviewed_placeholders gives the text of exit_status, and of not_run_reason and review_basis, which an answer
|
|
27
27
|
# leaves as printed to give neither, for a check reviewed before it runs; unchanged_placeholders gives it for one
|
|
28
|
-
# the last audit ran, whose review_basis left as printed keeps the line that audit kept
|
|
28
|
+
# the last audit ran, whose review_basis left as printed keeps the line that audit kept.
|
|
29
29
|
#: (String, Hash[String, untyped]?, ?Array[String], reviewed_placeholders: Hash[String, String],
|
|
30
30
|
#| unchanged_placeholders: Hash[String, String]) -> void
|
|
31
31
|
def initialize(check, since_last_audit, hidden_characters = [], reviewed_placeholders:, unchanged_placeholders:)
|
|
32
32
|
@check = check
|
|
33
33
|
@since_last_audit = since_last_audit
|
|
34
34
|
@notes = CheckNotes.new(since_last_audit, hidden_characters) #: CheckNotes
|
|
35
|
-
unchanged = since_last_audit&.fetch("status") == "unchanged"
|
|
36
|
-
@placeholders = unchanged ? unchanged_placeholders : reviewed_placeholders #: Hash[String, String]
|
|
35
|
+
@unchanged = since_last_audit&.fetch("status") == "unchanged" #: bool
|
|
36
|
+
@placeholders = @unchanged ? unchanged_placeholders : reviewed_placeholders #: Hash[String, String]
|
|
37
37
|
freeze
|
|
38
38
|
end
|
|
39
39
|
|
|
40
|
+
# The check_result to fill. An unchanged check's gives its optional fields as values to edit, not instructions:
|
|
41
|
+
# no not_run_reason, and the line its last review rested on.
|
|
40
42
|
#: () -> Hash[String, untyped]
|
|
41
43
|
def to_h
|
|
42
44
|
{ "command" => @check, "exit_status" => @placeholders.fetch("exit_status"),
|
|
43
|
-
"not_run_reason" => @placeholders
|
|
44
|
-
"review_basis" => @placeholders.fetch("review_basis") }
|
|
45
|
+
**(@unchanged ? { "not_run_reason" => nil, "review_basis" => @notes.kept_basis } : placeholders) }
|
|
45
46
|
end
|
|
46
47
|
|
|
47
|
-
#
|
|
48
|
-
#
|
|
48
|
+
# How the check stands to the last audit's: unchanged, changed or new, which sets the text it shares with every
|
|
49
|
+
# other check standing so.
|
|
49
50
|
#: () -> String
|
|
50
|
-
def
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
def status = @since_last_audit&.fetch("status", nil) || "new"
|
|
52
|
+
|
|
53
|
+
# What to do before replacing exit_status that every check of its status shares, ending with that a named check
|
|
54
|
+
# runs at every full audit, which a request prints once for the members it is for.
|
|
55
|
+
#: () -> String
|
|
56
|
+
def shared_instruction
|
|
57
|
+
steps = case status
|
|
58
|
+
when "unchanged" then [Prompts.text("assess-every-member/run-the-check-then-report-it")]
|
|
59
|
+
when "changed"
|
|
60
|
+
[Prompts.text("assess-every-member/have-a-changed-check-reviewed-before-running-it"), run_reviewed]
|
|
61
|
+
else [Prompts.text("assess-every-member/have-a-new-check-reviewed-before-running-it"), run_reviewed]
|
|
62
|
+
end
|
|
63
|
+
[*steps, Prompts.text("assess-every-member/run-a-named-check-at-every-full-audit")].join(" ")
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# This member's own lines beside the shared instruction: what the check hides, the commit that set or changed
|
|
67
|
+
# it, and the line its last review rested on; nil when it has none.
|
|
68
|
+
#: () -> String?
|
|
69
|
+
def own_instruction
|
|
70
|
+
lines = [@notes.hidden_characters, commit_line, *(@notes.printed_review if status == "unchanged")].compact
|
|
71
|
+
lines.join(" ") unless lines.empty?
|
|
53
72
|
end
|
|
54
73
|
|
|
55
74
|
private
|
|
56
75
|
|
|
57
|
-
#
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
[Prompts.text("assess-every-member/have-a-new-check-reviewed-before-running-it",
|
|
69
|
-
set_in: commit_clause("; commit %s set it")), run_reviewed]
|
|
70
|
-
end
|
|
71
|
-
end
|
|
76
|
+
# The optional fields' placeholders, for a check reviewed before it runs.
|
|
77
|
+
#: () -> Hash[String, String]
|
|
78
|
+
def placeholders = @placeholders.slice("not_run_reason", "review_basis")
|
|
79
|
+
|
|
80
|
+
# The commit that made a new or changed check what it is now, stated where the run is asked, since the template
|
|
81
|
+
# printed alone has no context beside it; nil outside git, when no commit holds it, or for an unchanged
|
|
82
|
+
# check.
|
|
83
|
+
#: () -> String?
|
|
84
|
+
def commit_line
|
|
85
|
+
commit = @since_last_audit&.fetch("changed_in", nil) or return
|
|
86
|
+
return if status == "unchanged"
|
|
72
87
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
#: (String) -> String
|
|
76
|
-
def commit_clause(format)
|
|
77
|
-
commit = @since_last_audit&.fetch("changed_in", nil)
|
|
78
|
-
commit ? format(format, commit) : ""
|
|
88
|
+
Prompts.text("assess-every-member/name-the-commit-that-made-the-check",
|
|
89
|
+
commit:, verb: status == "changed" ? "changed" : "set")
|
|
79
90
|
end
|
|
80
91
|
|
|
81
92
|
# Run a reviewed check, then report it with what its review rested on.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# typed: strict
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require_relative "audit_changes"
|
|
5
|
+
require_relative "audit_commit"
|
|
6
|
+
require_relative "invocation"
|
|
7
|
+
require_relative "principle_with_changed_members"
|
|
8
|
+
|
|
9
|
+
module Principles
|
|
10
|
+
# What this tool prints, from plain values a controller hands it. views/CLAUDE.md owns the boundary.
|
|
11
|
+
module Views
|
|
12
|
+
# A completed audit's next step, from what it changed and how to commit it: commit and report, re-audit each other
|
|
13
|
+
# principle its fixes changed, and audit this principle again after its members change.
|
|
14
|
+
class CompletedAuditNextStep
|
|
15
|
+
#: (Invocation) -> void
|
|
16
|
+
def initialize(invocation)
|
|
17
|
+
@invocation = invocation
|
|
18
|
+
freeze
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# The next step after principle id's audit completed with changes, committed as commit says.
|
|
22
|
+
#: (String, AuditChanges, AuditCommit | AuditCommit::ByHand) -> String
|
|
23
|
+
def to_s(id, changes, commit)
|
|
24
|
+
"#{commit.next_step} report the outcome to the project's owner.\n" \
|
|
25
|
+
"#{others_changed(changes.other_changed)}" \
|
|
26
|
+
"After members change, audit this principle again: #{@invocation.in_project("start-audit", id)}"
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
private
|
|
30
|
+
|
|
31
|
+
# The other principles whose members this audit's fixes changed, each to re-audit, or one member's edit
|
|
32
|
+
# to acknowledge; the agent judges which. Nothing when there are none.
|
|
33
|
+
#: (Array[PrincipleWithChangedMembers]) -> String
|
|
34
|
+
def others_changed(others)
|
|
35
|
+
return "" if others.empty?
|
|
36
|
+
|
|
37
|
+
commands = others.map { |each| "#{@invocation.in_project("start-audit", each.principle_id)}\n" }
|
|
38
|
+
"This audit's fixes also changed or broke members of other principles, listed under " \
|
|
39
|
+
"other_principles_with_changed_members. Repair a broken one from show-principle's repair_with. To " \
|
|
40
|
+
"acknowledge one member's edit instead, add --member MEMBER to its audit. Re-audit each:\n#{commands.join}"
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# typed: strict
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require_relative "member_lines_beside_text"
|
|
5
|
+
require_relative "printed_json"
|
|
6
|
+
|
|
7
|
+
module Principles
|
|
8
|
+
# What this tool prints, from plain values a controller hands it. views/CLAUDE.md owns the boundary.
|
|
9
|
+
module Views
|
|
10
|
+
# The parts of a full audit's request that start-audit --part prints alone, by name, from the request's context:
|
|
11
|
+
# each key but the members and the instruction fields, each member alone, and each instruction field as the
|
|
12
|
+
# request prints it, in part where it trims one, which --instruction prints whole; and the index of them all.
|
|
13
|
+
class ContextParts
|
|
14
|
+
# What starts a member's part name, keeping member ids apart from the context's keys.
|
|
15
|
+
MEMBER = "members/" #: String
|
|
16
|
+
|
|
17
|
+
# The part that lists every other part, so the agent sizes its reads before it makes them.
|
|
18
|
+
INDEX = "index" #: String
|
|
19
|
+
|
|
20
|
+
# The part holding the answer to fill, as the request prints it beside its context.
|
|
21
|
+
TEMPLATE = "response_template" #: String
|
|
22
|
+
|
|
23
|
+
# What --part prints for an optional part the request leaves out, holding nothing for it.
|
|
24
|
+
EMPTY = { "part_empty" => "Nothing to list for this request; " \
|
|
25
|
+
"the answer needs nothing for it." }.freeze #: Hash[String, String]
|
|
26
|
+
|
|
27
|
+
# instruction_fields is each field the context prints an instruction under, in order. template is the answer to
|
|
28
|
+
# fill, as the request prints it. texts is each member's lines now, by id, one string each, which its part
|
|
29
|
+
# prints and the whole request does not. optional names each part the context lists only when it holds something.
|
|
30
|
+
#: (Hash[String, untyped], instruction_fields: Array[String], template: Hash[String, untyped],
|
|
31
|
+
#| ?texts: Hash[String, Array[String]], ?optional: Array[String]) -> void
|
|
32
|
+
def initialize(context, instruction_fields:, template:, texts: {}, optional: [])
|
|
33
|
+
@context = context
|
|
34
|
+
@instruction_fields = instruction_fields
|
|
35
|
+
@template = template
|
|
36
|
+
@texts = texts
|
|
37
|
+
@optional = optional
|
|
38
|
+
freeze
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# Each part's name, in the order the context prints it, then each member's as members/ID, in the request's order,
|
|
42
|
+
# then each instruction field, in the order the context prints them, and last the answer to fill.
|
|
43
|
+
#: () -> Array[String]
|
|
44
|
+
def names
|
|
45
|
+
[*(@context.keys - ["members", *@instruction_fields]), *members.map { "#{MEMBER}#{it.fetch("id")}" },
|
|
46
|
+
*@instruction_fields, TEMPLATE]
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# Each name --part prints: the index, then each part it lists.
|
|
50
|
+
#: () -> Array[String]
|
|
51
|
+
def printable = [INDEX, *names]
|
|
52
|
+
|
|
53
|
+
# Each optional part the context leaves out, holding nothing for this request, which --part prints as empty.
|
|
54
|
+
#: () -> Array[String]
|
|
55
|
+
def left_out = @optional - @context.keys
|
|
56
|
+
|
|
57
|
+
# The part name, under its key, as the context prints it; a member's entry alone under members, with its text
|
|
58
|
+
# when given, its id read after the one prefix, so an id with a slash, or starting members/, is read whole.
|
|
59
|
+
#: (String) -> Hash[String, untyped]
|
|
60
|
+
def shown(name)
|
|
61
|
+
return { INDEX => index } if name == INDEX
|
|
62
|
+
return EMPTY if left_out.include?(name)
|
|
63
|
+
return { TEMPLATE => @template } if name == TEMPLATE
|
|
64
|
+
return { name => @context.fetch(name) } unless name.start_with?(MEMBER)
|
|
65
|
+
|
|
66
|
+
id = name.delete_prefix(MEMBER)
|
|
67
|
+
{ "members" => members.select { it.fetch("id") == id }.map { with_text(it) } }
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
private
|
|
71
|
+
|
|
72
|
+
# Each part with the bytes --part prints of its value, and each member with whether this audit judges it, and
|
|
73
|
+
# why when the request says, or carries its last assessment forward.
|
|
74
|
+
#: () -> Array[Hash[String, untyped]]
|
|
75
|
+
def index
|
|
76
|
+
names.map do |name|
|
|
77
|
+
part = shown(name)
|
|
78
|
+
entry = { "part" => name, "bytes" => bytes(part) }
|
|
79
|
+
name.start_with?(MEMBER) ? entry.merge(judged(part.fetch("members").fetch(0))) : entry
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
# How many bytes value prints as, as this tool prints a result.
|
|
84
|
+
#: (Hash[String, untyped]) -> Integer
|
|
85
|
+
def bytes(value) = PrintedJson.bytes(value)
|
|
86
|
+
|
|
87
|
+
# member as the request lists it, with its text when given, and then its acknowledged lines now pointing at
|
|
88
|
+
# that text, so the part prints each line now once.
|
|
89
|
+
#: (Hash[String, untyped]) -> Hash[String, untyped]
|
|
90
|
+
def with_text(member)
|
|
91
|
+
text = @texts[member.fetch("id")] or return member
|
|
92
|
+
since = member["acknowledged_since_last_audit"]
|
|
93
|
+
return member.merge("text" => text) unless since
|
|
94
|
+
|
|
95
|
+
lines = MemberLinesBesideText.new(since.fetch("member_lines")).shown
|
|
96
|
+
member.merge("acknowledged_since_last_audit" => since.merge("member_lines" => lines), "text" => text)
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
# What this audit does with member: carries its last assessment forward, or judges it, with why when given.
|
|
100
|
+
#: (Hash[String, untyped]) -> Hash[String, untyped]
|
|
101
|
+
def judged(member)
|
|
102
|
+
return { "this_audit" => "carries_forward" } if member["carried_forward"]
|
|
103
|
+
|
|
104
|
+
{ "this_audit" => "judges", **member.slice("judge_because") }
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
# The members the request lists, each as it prints it.
|
|
108
|
+
#: () -> Array[Hash[String, untyped]]
|
|
109
|
+
def members = @context.fetch("members")
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
end
|
|
@@ -9,10 +9,10 @@ module Principles
|
|
|
9
9
|
# What this tool prints, from plain values a controller hands it. views/CLAUDE.md owns the boundary.
|
|
10
10
|
module Views
|
|
11
11
|
# The correction request that follows an assessment with findings: one disposition for each, with a guide to
|
|
12
|
-
# every disposition's shape
|
|
12
|
+
# every disposition's shape, and what submitting the assessment stored.
|
|
13
13
|
class CorrectionRequest
|
|
14
14
|
# head is what the answer hands back unchanged, the request's id and the basis the correction depends on;
|
|
15
|
-
# placeholders is the text the template leaves in each field the agent writes
|
|
15
|
+
# placeholders is the text the template leaves in each field the agent writes.
|
|
16
16
|
#: (head: AnswerHead, principle_id: String, findings: Array[untyped], placeholders: Hash[String, String]) -> void
|
|
17
17
|
def initialize(head:, principle_id:, findings:, placeholders:)
|
|
18
18
|
@head = head
|
|
@@ -34,9 +34,9 @@ module Principles
|
|
|
34
34
|
"answer_guide" => Prompts.data("dispose-of-each-finding/answer-guide") }
|
|
35
35
|
end
|
|
36
36
|
|
|
37
|
-
# The answer to fill in, as
|
|
38
|
-
# each finding, each action the placeholder that says what it may be and what each adds, so
|
|
39
|
-
#
|
|
37
|
+
# The answer to fill in, as show-open-correction and show-answer-check --as template print it alone: one
|
|
38
|
+
# disposition for each finding, each action the placeholder that says what it may be and what each adds, so
|
|
39
|
+
# both print one template.
|
|
40
40
|
#: () -> Hash[String, untyped]
|
|
41
41
|
def template
|
|
42
42
|
@head.leading("dispositions" => @findings.map do |finding|
|
|
@@ -47,38 +47,57 @@ module Principles
|
|
|
47
47
|
end)
|
|
48
48
|
end
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
# The correction's answer alone, as show-answer-check --as template prints it.
|
|
51
|
+
#: () -> Hash[String, untyped]
|
|
52
|
+
def correction_to_fill = template
|
|
53
|
+
|
|
54
|
+
#: (AuditResult) -> Hash[String, untyped]
|
|
55
|
+
def presented_with(view)
|
|
56
|
+
view.request(view.correction_request(self))
|
|
53
57
|
end
|
|
54
58
|
|
|
55
|
-
#
|
|
59
|
+
# How to save and fill the correction's answer after submitting the checked assessment, naming the command that
|
|
60
|
+
# prints it alone rather than printing it here; keep its submit last.
|
|
56
61
|
#: (Hash[String, untyped], Invocation, String) -> Hash[String, untyped]
|
|
57
62
|
def with_correction_to_fill(acceptable, invocation, answer_file)
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
"
|
|
61
|
-
|
|
62
|
-
|
|
63
|
+
assessment_id = acceptable.fetch("request_id")
|
|
64
|
+
save = "Once this answer is submitted with the last line's command, save the correction's answer it leads " \
|
|
65
|
+
"to in a file outside the project, such as under $TMPDIR, from this command's output: " \
|
|
66
|
+
"#{alone(assessment_id, answer_file, invocation)}\nFill only its dispositions, and submit it: " \
|
|
67
|
+
"#{invocation.submit_answer(request_id)}"
|
|
68
|
+
acceptable.merge("correction_recovery" => recovery(invocation),
|
|
63
69
|
"next_action" => "#{save}\n#{acceptable.fetch("next_action")}")
|
|
64
70
|
end
|
|
65
71
|
|
|
66
|
-
#
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
72
|
+
# How to fill the correction by hand: save its answer alone, which show-open-correction prints from the open
|
|
73
|
+
# record, to a file, fill only its dispositions there, and submit that file.
|
|
74
|
+
#: (Invocation) -> String
|
|
75
|
+
def to_fill_by_hand(invocation)
|
|
76
|
+
"Save the correction's answer alone in a file outside the project, such as under $TMPDIR, from this " \
|
|
77
|
+
"command's output, which prints it again from the open record whenever you need it: " \
|
|
78
|
+
"#{invocation.in_project("show-open-correction", @principle_id)}\nEdit only its dispositions in that " \
|
|
79
|
+
"file, then submit it: #{invocation.submit_answer(request_id)}"
|
|
80
|
+
end
|
|
71
81
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
82
|
+
# What to keep while the correction is open, and the read-only command that prints its answer again from the
|
|
83
|
+
# open record, in git or outside it.
|
|
84
|
+
#: (Invocation) -> String
|
|
85
|
+
def recovery(invocation)
|
|
86
|
+
"#{Prompts.text("dispose-of-each-finding/retain-assessment-and-correction")}\n" \
|
|
87
|
+
"#{invocation.in_project("show-open-correction", @principle_id)}"
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
# The read-only command that prints the correction's answer alone, checking the assessment request
|
|
91
|
+
# assessment_request_id from assessment_file again.
|
|
92
|
+
#: (String, String, Invocation) -> String
|
|
93
|
+
def alone(assessment_request_id, assessment_file, invocation)
|
|
94
|
+
invocation.in_project("show-answer-check", assessment_request_id,
|
|
95
|
+
options: ["--file", assessment_file, "--as", "template"])
|
|
77
96
|
end
|
|
78
97
|
|
|
79
98
|
# What submitting the assessment stored, and what submitting it again would do, so an assessment submitted
|
|
80
99
|
# twice plainly replaced nothing: the open record, which keeps the assessment and, outside git, what the audit
|
|
81
|
-
# began from, and which in git is never committed, since the correction completes it
|
|
100
|
+
# began from, and which in git is never committed, since the correction completes it.
|
|
82
101
|
#: () -> String
|
|
83
102
|
def stored
|
|
84
103
|
kept = "This audit's open record, listed under wrote when it was first written, keeps your assessment"
|
|
@@ -8,20 +8,22 @@ module Principles
|
|
|
8
8
|
module Views
|
|
9
9
|
# The command that shows the edits to a member's file since the last full audit's base commit, to the files as
|
|
10
10
|
# they are now, which the audit judges. Each word is quoted for the shell, and each path read by git as written,
|
|
11
|
-
# not as a pattern
|
|
12
|
-
# edit, not a new file
|
|
11
|
+
# not as a pattern. Renames are followed, so over a moved file's path then and now the diff shows the
|
|
12
|
+
# edit, not a new file.
|
|
13
13
|
class DiffSinceLastAudit
|
|
14
|
-
# last_audited_commit is the last full audit's base commit; paths are the member's file then and now, once each
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
# last_audited_commit is the last full audit's base commit; paths are the member's file then and now, once each;
|
|
15
|
+
# to is the commit the diff ends at, or nil for the files as they are now.
|
|
16
|
+
#: (last_audited_commit: String, paths: Array[String], ?to: String?) -> void
|
|
17
|
+
def initialize(last_audited_commit:, paths:, to: nil)
|
|
17
18
|
@last_audited_commit = last_audited_commit
|
|
18
19
|
@paths = paths
|
|
20
|
+
@to = to
|
|
19
21
|
freeze
|
|
20
22
|
end
|
|
21
23
|
|
|
22
24
|
#: () -> String
|
|
23
25
|
def to_s
|
|
24
|
-
words = [@last_audited_commit, "--", *@paths].map { |word| ShellWord.new(word).to_s }
|
|
26
|
+
words = [@last_audited_commit, *@to, "--", *@paths].map { |word| ShellWord.new(word).to_s }
|
|
25
27
|
"git --literal-pathspecs diff -M #{words.join(" ")}"
|
|
26
28
|
end
|
|
27
29
|
end
|
|
@@ -9,7 +9,7 @@ module Principles
|
|
|
9
9
|
# What this tool prints, from plain values a controller hands it. views/CLAUDE.md owns the boundary.
|
|
10
10
|
module Views
|
|
11
11
|
# list-open-findings' result: each finding the last completed audit of a principle deferred or accepted, what that
|
|
12
|
-
# covers, and what to do next
|
|
12
|
+
# covers, and what to do next.
|
|
13
13
|
class FindingsResult
|
|
14
14
|
SCOPE = "Each principle's last completed audit only, as .principles/audits/ID.json holds it. The next full " \
|
|
15
15
|
"audit decides each: one that still holds stays in the record, and one it closes is then only in git: " \
|
|
@@ -29,9 +29,10 @@ module Principles
|
|
|
29
29
|
{ "findings" => findings, "scope" => SCOPE, "next_action" => next_action(findings) }
|
|
30
30
|
end
|
|
31
31
|
|
|
32
|
-
# list-open-findings --lines: each finding on a line, its principle, id
|
|
33
|
-
#
|
|
34
|
-
# spaces, so each finding stays on its
|
|
32
|
+
# list-open-findings --lines: each finding on a line, its principle, id, whom it waits on and the whole days it
|
|
33
|
+
# has been open, so the agent can see which to raise, and how long each has waited, without a script over the
|
|
34
|
+
# list. Free text is escaped, and its line breaks read as spaces, so each finding stays on its
|
|
35
|
+
# own line. findings holds each one's principle, finding_id, action, days_open and any waits_on.
|
|
35
36
|
#: (Array[Hash[String, untyped]]) -> Lines
|
|
36
37
|
def lines(findings)
|
|
37
38
|
text = findings.map { |finding| "#{line(finding)}\n" }.join
|
|
@@ -42,9 +43,19 @@ module Principles
|
|
|
42
43
|
|
|
43
44
|
#: (Hash[String, untyped]) -> String
|
|
44
45
|
def line(finding)
|
|
46
|
+
waits = waited_on(finding)
|
|
47
|
+
days = finding.fetch("days_open")
|
|
48
|
+
"#{finding.fetch("principle")}\t#{one_line(finding.fetch("finding_id"))}\t#{waits}\topen #{days} " \
|
|
49
|
+
"day#{"s" unless days == 1}"
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# Whom finding waits on, or that it is accepted, and so by design waits on no one.
|
|
53
|
+
#: (Hash[String, untyped]) -> String
|
|
54
|
+
def waited_on(finding)
|
|
55
|
+
return "accepted" if finding["action"] == "accepted"
|
|
56
|
+
|
|
45
57
|
waits_on = finding["waits_on"]
|
|
46
|
-
|
|
47
|
-
"#{finding.fetch("principle")}\t#{one_line(finding.fetch("finding_id"))}\t#{waits}"
|
|
58
|
+
waits_on ? "waits on: #{one_line(waits_on)}" : "waits on no one named"
|
|
48
59
|
end
|
|
49
60
|
|
|
50
61
|
#: (String) -> String
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# typed: strict
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require_relative "invocation"
|
|
5
|
+
require_relative "prompts"
|
|
6
|
+
|
|
7
|
+
module Principles
|
|
8
|
+
# What this tool prints, from plain values a controller hands it. views/CLAUDE.md owns the boundary.
|
|
9
|
+
module Views
|
|
10
|
+
# show-first-audit-brief's result: the instructions one background subagent follows to run a principle's first
|
|
11
|
+
# full audit, each command filled for that principle, so the subagent types no id.
|
|
12
|
+
class FirstAuditBrief
|
|
13
|
+
# What the list asks, which the commands, one a line, follow.
|
|
14
|
+
PICK_ONE = "Leave out any your instructions or memory say to skip, and follow the brief of one, which its " \
|
|
15
|
+
"command prints:"
|
|
16
|
+
|
|
17
|
+
#: (Invocation) -> void
|
|
18
|
+
def initialize(invocation)
|
|
19
|
+
@invocation = invocation
|
|
20
|
+
freeze
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# The brief for principle id.
|
|
24
|
+
#: (String) -> Hash[String, untyped]
|
|
25
|
+
def result(id)
|
|
26
|
+
{ "principle" => id,
|
|
27
|
+
"brief" => Prompts.text("run-a-first-audit-in-the-background/follow-the-brief",
|
|
28
|
+
id: id,
|
|
29
|
+
index: @invocation.in_project("start-audit", id, options: ["--part", "index"]),
|
|
30
|
+
template: @invocation.in_project("start-audit", id, options: ["--as", "template"])),
|
|
31
|
+
"wrote" => [] }
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# The principles awaiting a first full audit, ids, as list-member-problems names them, with each one's brief
|
|
35
|
+
# command on a line of its own, for the subagent to pick one from.
|
|
36
|
+
#: (Array[String]) -> Hash[String, untyped]
|
|
37
|
+
def awaiting(ids)
|
|
38
|
+
{ "awaiting_first_audit" => ids, "next_action" => pick_one(ids), "wrote" => [] }
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
private
|
|
42
|
+
|
|
43
|
+
#: (Array[String]) -> String
|
|
44
|
+
def pick_one(ids)
|
|
45
|
+
return "Every mapped principle has had a full audit, so there is no first audit to run." if ids.empty?
|
|
46
|
+
|
|
47
|
+
[PICK_ONE, *ids.map { @invocation.in_project("show-first-audit-brief", it) }].join("\n")
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# typed: strict
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require_relative "invocation"
|
|
5
|
+
require_relative "prompts"
|
|
6
|
+
|
|
7
|
+
module Principles
|
|
8
|
+
# What this tool prints, from plain values a controller hands it. views/CLAUDE.md owns the boundary.
|
|
9
|
+
module Views
|
|
10
|
+
# The session-start line asking for one background subagent to run a first full audit, while any principle
|
|
11
|
+
# awaits one. It counts them and names none, so its length stays fixed however many there are.
|
|
12
|
+
class FirstAuditLine
|
|
13
|
+
#: (Invocation) -> void
|
|
14
|
+
def initialize(invocation)
|
|
15
|
+
@invocation = invocation
|
|
16
|
+
freeze
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# The line, as a list of none or one, for count principles awaiting a first full audit, at the session's start
|
|
20
|
+
# from source: startup, resume, clear or compact. A resumed or compacted session may have a subagent running
|
|
21
|
+
# already from the line its context began with, so its line gives the count alone and asks for none.
|
|
22
|
+
#: (Integer, String) -> Array[String]
|
|
23
|
+
def lines(count, source)
|
|
24
|
+
return [] if count.zero?
|
|
25
|
+
|
|
26
|
+
counted = count == 1 ? "1 principle has" : "#{count} principles have"
|
|
27
|
+
[%w[resume compact].include?(source) ? started_already(counted, count) : asked(counted, count)]
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
private
|
|
31
|
+
|
|
32
|
+
#: (String, Integer) -> String
|
|
33
|
+
def started_already(counted, count)
|
|
34
|
+
Prompts.text("start-a-session/start-no-second-first-audit", counted:, them: count == 1 ? "it" : "one")
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
#: (String, Integer) -> String
|
|
38
|
+
def asked(counted, count)
|
|
39
|
+
Prompts.text("start-a-session/hand-the-first-audit-to-a-subagent",
|
|
40
|
+
counted:, them: count == 1 ? "it" : "them",
|
|
41
|
+
command: @invocation.in_project("show-first-audit-brief"))
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|