principles 0.0.6 → 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 +58 -41
- data/lib/principles/command_line.rb +37 -14
- data/lib/principles/command_routes.rb +21 -7
- data/lib/principles/controllers/acknowledgement.rb +50 -118
- data/lib/principles/controllers/acknowledgements.rb +154 -0
- data/lib/principles/controllers/after_commit_report.rb +44 -0
- data/lib/principles/controllers/answer.rb +52 -21
- data/lib/principles/controllers/answer_phase.rb +20 -3
- data/lib/principles/controllers/assessment.rb +41 -28
- data/lib/principles/controllers/audit.rb +59 -15
- data/lib/principles/controllers/audit_completion.rb +25 -12
- data/lib/principles/controllers/command.rb +13 -12
- data/lib/principles/controllers/correction.rb +26 -11
- data/lib/principles/controllers/first_audit_brief.rb +40 -0
- data/lib/principles/controllers/full_audit_request.rb +47 -83
- 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 +148 -0
- data/lib/principles/controllers/member_entries.rb +4 -4
- data/lib/principles/controllers/member_problems_report.rb +84 -30
- 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 +67 -12
- 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 -20
- data/lib/principles/data/schemas/acknowledgements-answer.schema.json +95 -0
- data/lib/principles/data/schemas/assessment-answer.schema.json +55 -20
- 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 +14 -62
- 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 +7 -6
- data/lib/principles/launch.rb +49 -0
- data/lib/principles/list_open_findings_options.rb +23 -0
- data/lib/principles/models/accepted_loading.rb +2 -2
- data/lib/principles/models/acknowledged_check.rb +106 -0
- data/lib/principles/models/acknowledgement.rb +51 -53
- data/lib/principles/models/acknowledgement_left_as_printed.rb +18 -5
- data/lib/principles/models/acknowledgement_refusal.rb +25 -10
- data/lib/principles/models/acknowledgements.rb +115 -0
- 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 +12 -3
- 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 +14 -15
- data/lib/principles/models/audit.rb +46 -34
- data/lib/principles/models/audit_record.rb +58 -27
- 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 +19 -10
- 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 +80 -0
- data/lib/principles/models/listed_members.rb +47 -0
- data/lib/principles/models/loaded_files.rb +4 -5
- data/lib/principles/models/loading_decision.rb +19 -10
- data/lib/principles/models/loading_facts.rb +1 -1
- data/lib/principles/models/loads_to_check.rb +1 -2
- 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 +17 -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 +21 -18
- data/lib/principles/models/member_repair_moves.rb +15 -9
- data/lib/principles/models/member_sighting.rb +12 -15
- 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 +42 -9
- data/lib/principles/models/project.rb +29 -20
- 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 +42 -36
- data/lib/principles/models/request_id.rb +19 -7
- data/lib/principles/models/runs_from.rb +7 -2
- data/lib/principles/models/sent_answer.rb +38 -16
- 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 +15 -7
- data/lib/principles/prose_list.rb +1 -1
- data/lib/principles/session_start_options.rb +3 -3
- data/lib/principles/start_audit_options.rb +54 -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 +137 -17
- 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 +68 -38
- data/lib/principles/views/assessment_request.rb +43 -21
- 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 +100 -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 +51 -39
- 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 +49 -33
- data/lib/principles/views/diff_since_last_audit.rb +8 -6
- data/lib/principles/views/findings_result.rb +33 -1
- 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 +32 -9
- 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 +11 -7
- 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 +61 -0
- data/lib/principles/views/members_a_commit_changed.rb +15 -11
- data/lib/principles/views/members_with_no_baseline.rb +10 -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 +24 -12
- data/lib/principles/views/open_findings_elsewhere_result.rb +5 -2
- data/lib/principles/views/open_findings_line.rb +26 -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 +70 -45
- data/lib/principles/views/problem_result.rb +75 -43
- 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/report-the-exit-status-its-own-listing-gives.md +3 -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-each-change-keeps-its-meaning.md +8 -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/decide-each-member-loading.md +2 -1
- 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/run-the-check-then-report-it.md +2 -2
- data/lib/principles/views/prompts/assess-every-member/run-the-reviewed-check-and-say-what-its-review-rested-on.md +5 -3
- data/lib/principles/views/prompts/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/every-command-and-how-they-chain.md +1 -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 +16 -16
- data/lib/principles/views/prompts/learn-what-a-command-does/list-open-findings.md +65 -61
- data/lib/principles/views/prompts/learn-what-a-command-does/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 +22 -20
- 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 +27 -28
- data/lib/principles/views/prompts/learn-what-a-command-does/submit-answer.md +39 -38
- 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 -0
- 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/start-a-session/start-with-the-principles-skill.md +1 -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 +95 -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
|
@@ -8,39 +8,51 @@ 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
|
|
11
|
+
# audit ran, since any other is refused at its start, and the instruction its request gives beside it. It
|
|
12
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
|
|
13
|
+
# prints no not_run_reason and says nothing of how often full audits run it. Its exit_status holds a short
|
|
14
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
|
|
15
|
+
# on, is the instruction's.
|
|
16
16
|
class OneMemberCheckResultTemplate
|
|
17
17
|
# The template for the checked member a request lists as entry, with how its check stands to the last audit's
|
|
18
18
|
# and any hidden characters in it; nil for a member without a check. exit_status is the placeholder it prints
|
|
19
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
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
# review rested on, so neither is printed to fill. own_listing says the check is this tool's own
|
|
21
|
+
# list-member-problems, which exits 3 while it lists the member.
|
|
22
|
+
#: (Hash[String, untyped], exit_status: String, ?own_listing: bool) -> OneMemberCheckResultTemplate?
|
|
23
|
+
def self.for(entry, exit_status:, own_listing: false)
|
|
23
24
|
return unless entry["check"]
|
|
24
25
|
|
|
25
|
-
new(CheckNotes.new(entry["check_since_last_audit"], entry.fetch("check_hidden_characters", [])), exit_status
|
|
26
|
+
new(CheckNotes.new(entry["check_since_last_audit"], entry.fetch("check_hidden_characters", [])), exit_status:,
|
|
27
|
+
own_listing:)
|
|
26
28
|
end
|
|
27
29
|
|
|
28
|
-
#: (CheckNotes, exit_status: String) -> void
|
|
29
|
-
def initialize(notes, exit_status:)
|
|
30
|
+
#: (CheckNotes, exit_status: String, ?own_listing: bool) -> void
|
|
31
|
+
def initialize(notes, exit_status:, own_listing: false)
|
|
30
32
|
@notes = notes
|
|
31
33
|
@exit_status = exit_status
|
|
34
|
+
@own_listing = own_listing
|
|
32
35
|
freeze
|
|
33
36
|
end
|
|
34
37
|
|
|
35
|
-
# The check_result to fill
|
|
38
|
+
# The check_result to fill, with an empty listed_members slot for this tool's own list-member-problems, whose
|
|
39
|
+
# instruction says what goes there.
|
|
36
40
|
#: () -> Hash[String, untyped]
|
|
37
|
-
def to_h = { "exit_status" => @exit_status }
|
|
41
|
+
def to_h = { "exit_status" => @exit_status, **(@own_listing ? { "listed_members" => [] } : {}) }
|
|
38
42
|
|
|
39
43
|
# What to do before filling exit_status, which the request gives as context.check_instruction.
|
|
40
44
|
#: () -> String
|
|
41
45
|
def instruction
|
|
42
46
|
[@notes.hidden_characters, Prompts.text("acknowledge-a-change/run-the-check-and-report-it-passing"),
|
|
43
|
-
*@notes.kept_review].compact.join(" ")
|
|
47
|
+
*@notes.kept_review, own_listing].compact.join(" ")
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
private
|
|
51
|
+
|
|
52
|
+
# What to report for this tool's own list-member-problems, which exits 3 while it lists the member.
|
|
53
|
+
#: () -> String?
|
|
54
|
+
def own_listing
|
|
55
|
+
Prompts.text("acknowledge-a-change/report-the-exit-status-its-own-listing-gives") if @own_listing
|
|
44
56
|
end
|
|
45
57
|
end
|
|
46
58
|
end
|
|
@@ -8,8 +8,11 @@ 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
|
# How a full audit shows the findings other principles leave open on members sharing its members' lines: each
|
|
11
|
-
# once, which mapped_elsewhere names by id, with what to do with them
|
|
11
|
+
# once, which mapped_elsewhere names by id, with what to do with them.
|
|
12
12
|
class OpenFindingsElsewhereResult
|
|
13
|
+
# The part this lists, by the name the request prints it under and start-audit --part takes.
|
|
14
|
+
PART = "open_findings_elsewhere" #: String
|
|
15
|
+
|
|
13
16
|
# findings are each such finding, with its principle, id, problem and action.
|
|
14
17
|
#: (Array[Hash[String, untyped]]) -> void
|
|
15
18
|
def initialize(findings)
|
|
@@ -25,7 +28,7 @@ module Principles
|
|
|
25
28
|
|
|
26
29
|
text = Prompts.text("assess-every-member/name-another-principles-open-finding-rather-than-raise-it")
|
|
27
30
|
instruction = Instruction.of_paragraphs("open_findings_elsewhere_instruction", text) { true }
|
|
28
|
-
RequestPart.new(shown: {
|
|
31
|
+
RequestPart.new(shown: { PART => @findings }, slots: {}, instructions: [instruction])
|
|
29
32
|
end
|
|
30
33
|
end
|
|
31
34
|
end
|
|
@@ -10,15 +10,14 @@ module Principles
|
|
|
10
10
|
# What this tool prints, from plain values a controller hands it. views/CLAUDE.md owns the boundary.
|
|
11
11
|
module Views
|
|
12
12
|
# list-open-findings --short: the one line a session-start hook puts into the agent's context while any
|
|
13
|
-
# finding is open, and nothing when none is
|
|
13
|
+
# finding is open, and nothing when none is. It says how many wait, how long the oldest has, what that
|
|
14
14
|
# one waits on, and the command that lists them all, worded as something to act on.
|
|
15
15
|
class OpenFindingsLine
|
|
16
16
|
# A waits_on longer than this is cut, so the line stays one short line.
|
|
17
17
|
WAITS_ON_LIMIT = 80
|
|
18
18
|
|
|
19
19
|
# The session's start the line is worded for, as Claude Code's SessionStart hook names it: startup, resume,
|
|
20
|
-
# clear or compact. It says what the context holds already, and so when to raise the findings
|
|
21
|
-
# line comes back.
|
|
20
|
+
# clear or compact. It says what the context holds already, and so when to raise the findings.
|
|
22
21
|
class SessionStart
|
|
23
22
|
#: (String) -> void
|
|
24
23
|
def initialize(source)
|
|
@@ -26,12 +25,12 @@ module Principles
|
|
|
26
25
|
freeze
|
|
27
26
|
end
|
|
28
27
|
|
|
29
|
-
# A resumed conversation already holds the line printed when its context began
|
|
28
|
+
# A resumed conversation already holds the line printed when its context began.
|
|
30
29
|
#: () -> bool
|
|
31
30
|
def resumed? = @source == "resume"
|
|
32
31
|
|
|
33
32
|
# When to raise the findings: before the user's first task at startup, and at the next pause once the
|
|
34
|
-
# session is under way, after /clear or a compaction
|
|
33
|
+
# session is under way, after /clear or a compaction.
|
|
35
34
|
#: () -> String
|
|
36
35
|
def raise_when
|
|
37
36
|
return Prompts.text("start-a-session/raise-them-before-the-first-task") if startup?
|
|
@@ -39,14 +38,6 @@ module Principles
|
|
|
39
38
|
Prompts.text("start-a-session/raise-them-at-the-next-pause")
|
|
40
39
|
end
|
|
41
40
|
|
|
42
|
-
# When the line comes back: at each session start, and after each clear or compaction too (#741).
|
|
43
|
-
#: () -> String
|
|
44
|
-
def returns
|
|
45
|
-
return Prompts.text("start-a-session/it-returns-at-each-session-start") if startup?
|
|
46
|
-
|
|
47
|
-
Prompts.text("start-a-session/it-returns-after-each-clear-or-compaction-too")
|
|
48
|
-
end
|
|
49
|
-
|
|
50
41
|
private
|
|
51
42
|
|
|
52
43
|
#: () -> bool
|
|
@@ -61,12 +52,17 @@ module Principles
|
|
|
61
52
|
|
|
62
53
|
# waiting is nil when no finding is open, or the count of open findings with the oldest one's principle,
|
|
63
54
|
# finding_id, days_open and, when it says, waits_on. not_found is each open finding, by principle and
|
|
64
|
-
# finding_id, whose write-up can no longer be found where its recorded_at points
|
|
55
|
+
# finding_id, whose write-up can no longer be found where its recorded_at points. source is the
|
|
65
56
|
# session's start: startup, resume, clear or compact.
|
|
66
57
|
#: (Hash[String, untyped]?, ?Array[Hash[String, untyped]], ?source: String) -> Lines
|
|
67
58
|
def short(waiting, not_found = [], source: "startup")
|
|
68
|
-
|
|
69
|
-
|
|
59
|
+
Lines.new(stdout: lines(waiting, not_found, source:).map { "#{it}\n" }.join, stderr: "", status: 0)
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# short's line, as a list of none or one, which report-at-session-start prints among its own.
|
|
63
|
+
#: (Hash[String, untyped]?, ?Array[Hash[String, untyped]], ?source: String) -> Array[String]
|
|
64
|
+
def lines(waiting, not_found = [], source: "startup")
|
|
65
|
+
waiting ? [line(waiting, not_found, SessionStart.new(source))] : []
|
|
70
66
|
end
|
|
71
67
|
|
|
72
68
|
private
|
|
@@ -82,17 +78,17 @@ module Principles
|
|
|
82
78
|
#: (Hash[String, untyped], Array[Hash[String, untyped]], SessionStart) -> String
|
|
83
79
|
def whole(waiting, not_found, start)
|
|
84
80
|
count = waiting.fetch("count")
|
|
85
|
-
them, each = pronouns(count)
|
|
86
81
|
Prompts.text("start-a-session/act-on-the-open-findings",
|
|
87
|
-
when: start.raise_when,
|
|
82
|
+
when: start.raise_when,
|
|
88
83
|
findings: "#{how_long(waiting)} (#{named(waiting)})",
|
|
89
|
-
|
|
84
|
+
no_one_named: no_one_named(count, waiting.fetch("waiting_on_no_one_named", 0)),
|
|
90
85
|
write_ups: write_ups(not_found),
|
|
91
|
-
|
|
86
|
+
each: count == 1 ? "it" : "each",
|
|
87
|
+
command: @invocation.in_project("list-open-findings", options: ["--lines"]))
|
|
92
88
|
end
|
|
93
89
|
|
|
94
90
|
# A resumed session's line: its conversation already holds the line printed when that context began, so this
|
|
95
|
-
# one gives the facts and where the instructions are, not the instructions again
|
|
91
|
+
# one gives the facts and where the instructions are, not the instructions again.
|
|
96
92
|
#: (String, Array[Hash[String, untyped]]) -> String
|
|
97
93
|
def resumed(findings, not_found)
|
|
98
94
|
Prompts.text("start-a-session/see-the-earlier-line",
|
|
@@ -100,20 +96,14 @@ module Principles
|
|
|
100
96
|
command: @invocation.in_project("list-open-findings", options: ["--short"]))
|
|
101
97
|
end
|
|
102
98
|
|
|
103
|
-
# How many of several open findings
|
|
99
|
+
# How many of several open findings are deferred with no waits_on, since the line names only the oldest's. One
|
|
104
100
|
# open finding's own name already shows whether it does, so its line says nothing more.
|
|
105
101
|
#: (Integer, Integer) -> String
|
|
106
|
-
def
|
|
107
|
-
return "" if count == 1 ||
|
|
108
|
-
return " All #{count} have no waits_on." if
|
|
109
|
-
|
|
110
|
-
" #{without} #{without == 1 ? "has" : "have"} no waits_on."
|
|
111
|
-
end
|
|
102
|
+
def no_one_named(count, unnamed)
|
|
103
|
+
return "" if count == 1 || unnamed.zero?
|
|
104
|
+
return " All #{count} have no waits_on." if unnamed == count
|
|
112
105
|
|
|
113
|
-
|
|
114
|
-
#: (Integer) -> [String, String]
|
|
115
|
-
def pronouns(count)
|
|
116
|
-
count == 1 ? %w[it it] : %w[them each]
|
|
106
|
+
" #{unnamed} #{unnamed == 1 ? "has" : "have"} no waits_on."
|
|
117
107
|
end
|
|
118
108
|
|
|
119
109
|
# The sentence naming the write-ups that can no longer be found, the first by its principle and id, or
|
|
@@ -147,7 +137,7 @@ module Principles
|
|
|
147
137
|
end
|
|
148
138
|
|
|
149
139
|
# The oldest finding's principle and id, and what it waits on, cut when long. The id and waits_on are free
|
|
150
|
-
# text, so each is cut by characters first and then escaped, which may run past the limit to show them
|
|
140
|
+
# text, so each is cut by characters first and then escaped, which may run past the limit to show them.
|
|
151
141
|
#: (Hash[String, untyped]) -> String
|
|
152
142
|
def named(waiting)
|
|
153
143
|
named = oldest(waiting)
|
|
@@ -156,7 +146,7 @@ module Principles
|
|
|
156
146
|
"#{named}, waits on: #{VisibleText.new(waits_on)}"
|
|
157
147
|
end
|
|
158
148
|
|
|
159
|
-
# A cut waits_on up to its last whole word, so it never ends in part of one
|
|
149
|
+
# A cut waits_on up to its last whole word, so it never ends in part of one, or as cut when it is one
|
|
160
150
|
# word, which has no boundary to cut at.
|
|
161
151
|
#: (String) -> String
|
|
162
152
|
def whole_words(cut)
|
|
@@ -164,12 +154,12 @@ module Principles
|
|
|
164
154
|
cut[0, boundary].to_s
|
|
165
155
|
end
|
|
166
156
|
|
|
167
|
-
# The oldest finding's principle and id, which is free text and so escaped
|
|
157
|
+
# The oldest finding's principle and id, which is free text and so escaped.
|
|
168
158
|
#: (Hash[String, untyped]) -> String
|
|
169
159
|
def oldest(waiting) = "#{waiting.fetch("principle")} #{VisibleText.new(waiting.fetch("finding_id"))}"
|
|
170
160
|
|
|
171
161
|
# A cut waits_on with a ")" for each "(" the cut left open, so the line's own parenthesis still reads as
|
|
172
|
-
# closing the finding's name
|
|
162
|
+
# closing the finding's name.
|
|
173
163
|
#: (String) -> String
|
|
174
164
|
def closed(cut)
|
|
175
165
|
cut + (")" * [cut.count("(") - cut.count(")"), 0].max)
|
|
@@ -9,8 +9,11 @@ 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
|
# How the meta-principle's full audit states, as a fact, each other principle with members no audit has judged
|
|
12
|
-
# as they are now, which a check on its passage once reported, beside the release since its last audit
|
|
12
|
+
# as they are now, which a check on its passage once reported, beside the release since its last audit.
|
|
13
13
|
class OtherPrinciplesUnjudgedResult
|
|
14
|
+
# The part this lists, by the name the request prints it under and start-audit --part takes.
|
|
15
|
+
PART = "other_principles_with_unjudged_changes" #: String
|
|
16
|
+
|
|
14
17
|
# principles holds each other principle with such members, by id with their states; empty when there are none.
|
|
15
18
|
#: (Array[PrincipleWithChangedMembers]) -> void
|
|
16
19
|
def initialize(principles)
|
|
@@ -23,8 +26,8 @@ module Principles
|
|
|
23
26
|
#: () -> RequestPart
|
|
24
27
|
def part
|
|
25
28
|
why = Prompts.text("assess-every-member/judge-the-keeping-against-the-other-principles")
|
|
26
|
-
RequestPart.new(shown: {
|
|
27
|
-
|
|
29
|
+
RequestPart.new(shown: { PART => { "principles" => @principles.map(&:to_h),
|
|
30
|
+
"why" => why } },
|
|
28
31
|
slots: {})
|
|
29
32
|
end
|
|
30
33
|
end
|
|
@@ -8,8 +8,11 @@ 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
|
# How a full audit's request names the files outside the map that differ from the base commit, which a check and
|
|
11
|
-
# the answer's evidence read as they are now
|
|
11
|
+
# the answer's evidence read as they are now.
|
|
12
12
|
class OutsideTheMapResult
|
|
13
|
+
# The part this lists, by the name the request prints it under and start-audit --part takes.
|
|
14
|
+
PART = "uncommitted_files_outside_the_map" #: String
|
|
15
|
+
|
|
13
16
|
# outside names the files outside, as paths and any count not_named; nil when there are none or no base commit.
|
|
14
17
|
#: (Hash[String, untyped]?) -> void
|
|
15
18
|
def initialize(outside)
|
|
@@ -24,7 +27,7 @@ module Principles
|
|
|
24
27
|
outside = @outside or return
|
|
25
28
|
|
|
26
29
|
why = Prompts.text("assess-every-member/uncommitted-files-outside-the-map")
|
|
27
|
-
RequestPart.new(shown: {
|
|
30
|
+
RequestPart.new(shown: { PART => outside.merge("why" => why) }, slots: {})
|
|
28
31
|
end
|
|
29
32
|
end
|
|
30
33
|
end
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# typed: strict
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
|
+
require_relative "../prose_list"
|
|
4
5
|
require_relative "invocation"
|
|
5
6
|
require_relative "prompts"
|
|
6
7
|
require_relative "request_part"
|
|
@@ -9,16 +10,26 @@ module Principles
|
|
|
9
10
|
# What this tool prints, from plain values a controller hands it. views/CLAUDE.md owns the boundary.
|
|
10
11
|
module Views
|
|
11
12
|
# How the meta-principle's full audit states the release of principles its last completed audit ran under beside
|
|
12
|
-
# the one running now, as facts for the agent to judge
|
|
13
|
+
# the one running now, as facts for the agent to judge.
|
|
13
14
|
class PackageSinceLastAuditResult
|
|
15
|
+
# The part this lists, by the name the request prints it under and start-audit --part takes.
|
|
16
|
+
PART = "package_since_last_audit" #: String
|
|
17
|
+
|
|
18
|
+
# How the why names each part of principles an upgrade can change, in the order it names them, whatever order
|
|
19
|
+
# the map holds them in.
|
|
20
|
+
PARTS = { "hook" => "the session-start hook", "skill" => "the skill",
|
|
21
|
+
"passage" => "the passage" }.freeze #: Hash[String, String]
|
|
22
|
+
|
|
14
23
|
# at_last_audit is the version the last completed audit ran under, or nil when none recorded one; now is the
|
|
15
24
|
# version running now; passage_changed says whether the passage setup proposes changed since, or is nil with
|
|
16
|
-
# nothing to compare. invocation names the setup command the
|
|
17
|
-
|
|
18
|
-
|
|
25
|
+
# nothing to compare. mapped is which of PARTS' keys the map holds. invocation names the setup command the
|
|
26
|
+
# instruction prints.
|
|
27
|
+
#: (Invocation, at_last_audit: String?, now: String, passage_changed: bool?, mapped: Array[String]) -> void
|
|
28
|
+
def initialize(invocation, at_last_audit:, now:, passage_changed:, mapped:)
|
|
19
29
|
@invocation = invocation
|
|
20
30
|
@since = { "version_at_last_audit" => at_last_audit, "version_now" => now,
|
|
21
31
|
"passage_changed" => passage_changed }.freeze #: Hash[String, untyped]
|
|
32
|
+
@mapped = mapped
|
|
22
33
|
freeze
|
|
23
34
|
end
|
|
24
35
|
|
|
@@ -26,8 +37,20 @@ module Principles
|
|
|
26
37
|
#: () -> RequestPart
|
|
27
38
|
def part
|
|
28
39
|
why = Prompts.text("assess-every-member/judge-the-keeping-under-the-release-since-the-last-audit",
|
|
29
|
-
setup: @invocation.in_project("show-meta-principle-passage"))
|
|
30
|
-
RequestPart.new(shown: {
|
|
40
|
+
mapped: mapped, setup: @invocation.in_project("show-meta-principle-passage"))
|
|
41
|
+
RequestPart.new(shown: { PART => @since.merge("why" => why) }, slots: {})
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
private
|
|
45
|
+
|
|
46
|
+
# Which of the parts the project maps, as the why's clause after naming all three.
|
|
47
|
+
#: () -> String
|
|
48
|
+
def mapped
|
|
49
|
+
return "none of which this project maps" if @mapped.empty?
|
|
50
|
+
return "all of which this project maps" if @mapped.length == PARTS.length
|
|
51
|
+
|
|
52
|
+
named = PARTS.filter_map { |part, words| words if @mapped.include?(part) }
|
|
53
|
+
"of which this project maps only #{ProseList.new(named)}"
|
|
31
54
|
end
|
|
32
55
|
end
|
|
33
56
|
end
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# typed: strict
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require_relative "assessment_request"
|
|
5
|
+
require_relative "context_parts"
|
|
6
|
+
require_relative "invocation"
|
|
7
|
+
require_relative "shell_word"
|
|
8
|
+
require_relative "trimmed_instructions_note"
|
|
9
|
+
|
|
10
|
+
module Principles
|
|
11
|
+
# What this tool prints, from plain values a controller hands it. views/CLAUDE.md owns the boundary.
|
|
12
|
+
module Views
|
|
13
|
+
# start-audit --part index: a full audit's parts with how to answer the request from them, so an agent reading the
|
|
14
|
+
# request in parts need not read it whole to learn how to answer it.
|
|
15
|
+
class PartsIndexResult
|
|
16
|
+
#: (Invocation) -> void
|
|
17
|
+
def initialize(invocation)
|
|
18
|
+
@invocation = invocation
|
|
19
|
+
freeze
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# The index of request, with the note naming the instructions it prints only in part, the command that submits
|
|
23
|
+
# its answer and, as the next step, reading each part, where skipping a carried member's is the agent's choice,
|
|
24
|
+
# then the one printing that answer to fill, which is too large to carry here, keeping each carried entry.
|
|
25
|
+
#: (Hash[String, untyped], AssessmentRequest) -> Hash[String, untyped]
|
|
26
|
+
def printed(index, request)
|
|
27
|
+
to_fill = @invocation.in_project("start-audit", request.principle_id,
|
|
28
|
+
options: ["--part", ContextParts::TEMPLATE])
|
|
29
|
+
read = "Run part_command with each part as printed; skipping a member marked carries_forward is fine, " \
|
|
30
|
+
"unless you judge it again. --as template prints the same answer long, with each slot's help. " \
|
|
31
|
+
"Then fill in the answer this command prints"
|
|
32
|
+
listed(index, request.principle_id)
|
|
33
|
+
.merge(TrimmedInstructionsNote.new(request.trimmed_instruction_fields).to_h)
|
|
34
|
+
.merge("answer_with" => @invocation.submit_answer(index.fetch("request_id")),
|
|
35
|
+
"next_action" => "#{read}, #{carried(request)}, and submit it with answer_with: #{to_fill}")
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
private
|
|
39
|
+
|
|
40
|
+
# How to fill each carried member's entry: as printed, but for any check_result slot one prints.
|
|
41
|
+
#: (AssessmentRequest) -> String
|
|
42
|
+
def carried(request)
|
|
43
|
+
kept = "leaving each carries_forward entry as printed"
|
|
44
|
+
request.carried_check_to_fill? ? "#{kept} but for filling the check_result slot it prints" : kept
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# The index under its request id, after the command that prints a part named after it, each entry's part as a
|
|
48
|
+
# shell reads it, quoted where a shell would split or expand it, so it runs as printed; the answer's template
|
|
49
|
+
# names each member by its id unquoted. One command rather than one an entry, since an entry's would repeat it
|
|
50
|
+
# and cost more than reading the whole request.
|
|
51
|
+
#: (Hash[String, untyped], String) -> Hash[String, untyped]
|
|
52
|
+
def listed(index, principle_id)
|
|
53
|
+
entries = index.fetch("index").map { it.merge("part" => ShellWord.new(it.fetch("part")).to_s) }
|
|
54
|
+
{ "request_id" => index.fetch("request_id"),
|
|
55
|
+
"part_command" => @invocation.in_project("start-audit", principle_id, options: ["--part"]),
|
|
56
|
+
"index" => entries }
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
@@ -21,9 +21,9 @@ module Principles
|
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
# show-principle: each member with where its text is now and its freshness, and each member repairs names, those
|
|
24
|
-
# an audit would refuse, with its repair_with commands, from the moves repairs gives it
|
|
25
|
-
# hook_settings_not_read names each project settings file whose hooks this tool could not read
|
|
26
|
-
# loaded_files lists each file the members load once, with the total of those loading at session start
|
|
24
|
+
# an audit would refuse, with its repair_with commands, from the moves repairs gives it.
|
|
25
|
+
# hook_settings_not_read names each project settings file whose hooks this tool could not read.
|
|
26
|
+
# loaded_files lists each file the members load once, with the total of those loading at session start.
|
|
27
27
|
#: (PrintedPrinciple, repairs: Hash[String, Array[Hash[String, untyped]]],
|
|
28
28
|
#| ?hook_settings_not_read: Array[Hash[String, String]], ?loaded_files: Hash[String, untyped])
|
|
29
29
|
#| -> Hash[String, untyped]
|
|
@@ -36,15 +36,14 @@ module Principles
|
|
|
36
36
|
|
|
37
37
|
# list-principles: each entry is { "id", "description", "members_by_freshness" }. waiting is each principle whose
|
|
38
38
|
# audits wait on an upgrade, which it names, with how to update said once, and an audit is offered only when one
|
|
39
|
-
# is left to audit
|
|
39
|
+
# is left to audit.
|
|
40
40
|
#: (Array[Hash[String, untyped]], ?waiting: Array[RecordWaitingOnAnUpgrade], ?one_to_audit: bool)
|
|
41
41
|
#| -> Hash[String, untyped]
|
|
42
42
|
def listing(entries, waiting: [], one_to_audit: true)
|
|
43
43
|
{ "principles" => entries, "next_action" => listed_next_action(entries, waiting, one_to_audit).join("\n") }
|
|
44
44
|
end
|
|
45
45
|
|
|
46
|
-
# list-principles' note on the meta-principle's map, kept in file, when it has no members, with the two ways on
|
|
47
|
-
# (#931).
|
|
46
|
+
# list-principles' note on the meta-principle's map, kept in file, when it has no members, with the two ways on.
|
|
48
47
|
#: (String) -> Hash[String, String]
|
|
49
48
|
def no_members(file)
|
|
50
49
|
setup = @invocation.in_project("show-meta-principle-passage")
|
|
@@ -5,7 +5,7 @@ module Principles
|
|
|
5
5
|
# What this tool prints, from plain values a controller hands it. views/CLAUDE.md owns the boundary.
|
|
6
6
|
module Views
|
|
7
7
|
# One other principle whose members a completed audit's fixes changed or broke, as its result names it under
|
|
8
|
-
# other_principles_with_changed_members, to re-audit by its id
|
|
8
|
+
# other_principles_with_changed_members, to re-audit by its id.
|
|
9
9
|
class PrincipleWithChangedMembers
|
|
10
10
|
#: (principle_id: String, members: Array[Hash[String, untyped]]) -> void
|
|
11
11
|
def initialize(principle_id:, members:)
|
|
@@ -7,8 +7,7 @@ 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
|
# The principles no full audit has completed, as list-member-problems' next_action names them in one line, then
|
|
10
|
-
# each one's audit to start on a line of its own, filled and shell-quoted so the agent types no id
|
|
11
|
-
# #755).
|
|
10
|
+
# each one's audit to start on a line of its own, filled and shell-quoted so the agent types no id.
|
|
12
11
|
class PrinciplesWithNoCompletedAudit
|
|
13
12
|
# audits holds each principle's start-audit command, in the order of ids.
|
|
14
13
|
#: (ids: Array[String], audits: Array[String]) -> void
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# typed: strict
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require "json"
|
|
5
|
+
|
|
6
|
+
module Principles
|
|
7
|
+
module Views
|
|
8
|
+
# How a JSON result prints on stdout, and so how many bytes it takes there. Whatever sizes a result for the agent
|
|
9
|
+
# measures it here, so a size it reports is the size it prints. A result prints a field a line, so grep, sed -n
|
|
10
|
+
# and a diff read it as precisely as when it was indented, but unindented and with no space after the colon,
|
|
11
|
+
# since indentation was most of what printing it compact would save, and one grep pattern then fits every output.
|
|
12
|
+
module PrintedJson
|
|
13
|
+
INDENT = ""
|
|
14
|
+
SPACE = ""
|
|
15
|
+
|
|
16
|
+
# value as printed, one field a line.
|
|
17
|
+
#: (untyped) -> String
|
|
18
|
+
def self.text(value) = JSON.pretty_generate(value, indent: INDENT, space: SPACE)
|
|
19
|
+
|
|
20
|
+
# The bytes value prints as.
|
|
21
|
+
#: (untyped) -> Integer
|
|
22
|
+
def self.bytes(value) = text(value).bytesize
|
|
23
|
+
|
|
24
|
+
# value as printed, but for the array at path, each of whose entries prints compact on a line of its own. Each
|
|
25
|
+
# object on the way to it prints a field a line, and every other field as text prints it, depth objects in.
|
|
26
|
+
#: (untyped, Array[String], ?Integer) -> String
|
|
27
|
+
def self.with_entries_on_lines(value, path, depth = 0)
|
|
28
|
+
return entry_lines(value, depth) if path.empty?
|
|
29
|
+
|
|
30
|
+
fields = value.map do |name, field|
|
|
31
|
+
shown = name == path.first ? with_entries_on_lines(field, path.drop(1), depth + 1) : nested(field, depth + 1)
|
|
32
|
+
"#{INDENT * (depth + 1)}#{JSON.generate(name)}:#{SPACE}#{shown}"
|
|
33
|
+
end
|
|
34
|
+
"{\n#{fields.join(",\n")}\n#{INDENT * depth}}"
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# field as text prints it, depth objects in.
|
|
38
|
+
#: (untyped, Integer) -> String
|
|
39
|
+
def self.nested(field, depth) = JSON.pretty_generate(field, indent: INDENT, space: SPACE, depth:)
|
|
40
|
+
|
|
41
|
+
# entries a compact line each, one step in from depth.
|
|
42
|
+
#: (Array[untyped], Integer) -> String
|
|
43
|
+
def self.entry_lines(entries, depth)
|
|
44
|
+
return "[]" if entries.empty?
|
|
45
|
+
|
|
46
|
+
"[\n#{entries.map { "#{INDENT * (depth + 1)}#{JSON.generate(it)}" }.join(",\n")}\n#{INDENT * depth}]"
|
|
47
|
+
end
|
|
48
|
+
private_class_method :nested, :entry_lines
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
@@ -18,7 +18,7 @@ module Principles
|
|
|
18
18
|
#: Hash[String, untyped]?
|
|
19
19
|
attr_reader :activation
|
|
20
20
|
|
|
21
|
-
# activation is when the agent said the principle's work is in hand, or nil when it has not said
|
|
21
|
+
# activation is when the agent said the principle's work is in hand, or nil when it has not said.
|
|
22
22
|
#: (id: String, file: String, description: String?, members: Array[Hash[String, untyped]],
|
|
23
23
|
#| ?activation: Hash[String, untyped]?) -> void
|
|
24
24
|
def initialize(id:, file:, description:, members:, activation: nil)
|
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
module Principles
|
|
5
5
|
# What this tool prints, from plain values a controller hands it. views/CLAUDE.md owns the boundary.
|
|
6
6
|
module Views
|
|
7
|
-
# How a completed full audit's result says what it decided about each prior finding
|
|
7
|
+
# How a completed full audit's result says what it decided about each prior finding.
|
|
8
8
|
class PriorFindingDecisionsResult
|
|
9
9
|
# kept_ids are the prior findings it kept and closed those it closed; changed is what the decisions changed of
|
|
10
10
|
# the findings kept, each list by the name the result gives it after prior_findings_: pointers_dropped, any
|
|
11
|
-
# pointer a decision dropped
|
|
12
|
-
#
|
|
13
|
-
# problems_restated, each problem a decision restated, as it was and is now
|
|
11
|
+
# pointer a decision dropped, waits_on_dropped, any waits_on it dropped, with null or by accepting it,
|
|
12
|
+
# evidence_replaced, each kept evidence item a decision gave a new place, as it was and is now, and
|
|
13
|
+
# problems_restated, each problem a decision restated, as it was and is now.
|
|
14
14
|
#: (kept_ids: Array[String], closed: Array[Hash[String, untyped]],
|
|
15
15
|
#| changed: Hash[String, Array[Hash[String, untyped]]]) -> void
|
|
16
16
|
def initialize(kept_ids:, closed:, changed:)
|
|
@@ -7,12 +7,15 @@ require_relative "request_part"
|
|
|
7
7
|
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
|
-
# How the next full audit shows the findings the last one deferred or accepted, for it to decide
|
|
10
|
+
# How the next full audit shows the findings the last one deferred or accepted, for it to decide.
|
|
11
11
|
class PriorFindingsResult
|
|
12
|
+
# The part this lists, by the name the request prints it under and start-audit --part takes.
|
|
13
|
+
PART = "prior_findings" #: String
|
|
14
|
+
|
|
12
15
|
# prior is each finding the last audit deferred or accepted, as the request lists it; last_audited_commit is the
|
|
13
|
-
# commit each evidence item's changed_since_last_audit compares against, or nil when none says
|
|
14
|
-
# placeholders is the text the answer printed alone gives the decision, naming what it may be
|
|
15
|
-
# field a decision may give, which an answer leaves as printed to give none
|
|
16
|
+
# commit each evidence item's changed_since_last_audit compares against, or nil when none says.
|
|
17
|
+
# placeholders is the text the answer printed alone gives the decision, naming what it may be, and each
|
|
18
|
+
# field a decision may give, which an answer leaves as printed to give none.
|
|
16
19
|
#: (Array[Hash[String, untyped]], placeholders: Hash[String, untyped], ?last_audited_commit: String?) -> void
|
|
17
20
|
def initialize(prior, placeholders:, last_audited_commit: nil)
|
|
18
21
|
@prior = prior
|
|
@@ -27,7 +30,7 @@ module Principles
|
|
|
27
30
|
def part
|
|
28
31
|
return if @prior.empty?
|
|
29
32
|
|
|
30
|
-
RequestPart.new(shown: {
|
|
33
|
+
RequestPart.new(shown: { PART => @prior.map { |finding| shown(finding) } },
|
|
31
34
|
instructions: [Instruction.new("prior_findings_instruction", instruction)],
|
|
32
35
|
slots: { "prior_finding_decisions" => @prior.map { |finding| decision(finding) } },
|
|
33
36
|
help: { "prior_finding_decisions" => @placeholders })
|
|
@@ -36,7 +39,7 @@ module Principles
|
|
|
36
39
|
private
|
|
37
40
|
|
|
38
41
|
# finding as the request lists it, asking beside it, when it is marked evidence_not_kept, for the evidence its
|
|
39
|
-
# record lacks, where the agent deciding it reads
|
|
42
|
+
# record lacks, where the agent deciding it reads.
|
|
40
43
|
#: (Hash[String, untyped]) -> Hash[String, untyped]
|
|
41
44
|
def shown(finding)
|
|
42
45
|
return finding unless evidence_not_kept?(finding)
|
|
@@ -45,17 +48,17 @@ module Principles
|
|
|
45
48
|
end
|
|
46
49
|
|
|
47
50
|
# The decision to fill in on finding, with an empty problem_evidence list when it is marked evidence_not_kept,
|
|
48
|
-
# so an agent filling the template alone sees the field its record lacks
|
|
51
|
+
# so an agent filling the template alone sees the field its record lacks.
|
|
49
52
|
#: (Hash[String, untyped]) -> Hash[String, untyped]
|
|
50
53
|
def decision(finding)
|
|
51
54
|
decision = { "finding_id" => finding.fetch("finding_id"), "decision" => nil }
|
|
52
55
|
evidence_not_kept?(finding) ? decision.merge("problem_evidence" => []) : decision
|
|
53
56
|
end
|
|
54
57
|
|
|
55
|
-
# How to decide the prior findings, naming each one's id, so a new finding is given another
|
|
56
|
-
#
|
|
57
|
-
#
|
|
58
|
-
#
|
|
58
|
+
# How to decide the prior findings, naming each one's id, so a new finding is given another, each paragraph with
|
|
59
|
+
# whether its case holds: how to keep what a deferral waits on holds only when one carries waits_on, how to
|
|
60
|
+
# claim an earlier first_raised_at never, since no fact marks a finding dated late, so it is read whole, and how
|
|
61
|
+
# to give the evidence a finding's record lacks only when one is marked so.
|
|
59
62
|
#: () -> Array[[String, bool]]
|
|
60
63
|
def instruction
|
|
61
64
|
ids = @prior.map { |finding| finding.fetch("finding_id") }.join(", ")
|
|
@@ -67,7 +70,7 @@ module Principles
|
|
|
67
70
|
end
|
|
68
71
|
|
|
69
72
|
# How to read each evidence item's changed_since_last_audit, naming the commit it compares against, holding only
|
|
70
|
-
# when an item carries it
|
|
73
|
+
# when an item carries it; none when no commit is named to compare against.
|
|
71
74
|
#: () -> Array[[String, bool]]
|
|
72
75
|
def evidence_since
|
|
73
76
|
return [] unless @last_audited_commit
|
|
@@ -77,14 +80,14 @@ module Principles
|
|
|
77
80
|
commit: @last_audited_commit), said]]
|
|
78
81
|
end
|
|
79
82
|
|
|
80
|
-
# Whether any prior finding carries a waits_on line
|
|
83
|
+
# Whether any prior finding carries a waits_on line.
|
|
81
84
|
#: () -> bool
|
|
82
85
|
def waits_on? = @prior.any? { |finding| finding["waits_on"] }
|
|
83
86
|
|
|
84
87
|
#: () -> bool
|
|
85
88
|
def marked_evidence_not_kept? = @prior.any? { |finding| evidence_not_kept?(finding) }
|
|
86
89
|
|
|
87
|
-
# Whether finding is marked as one whose record keeps no evidence
|
|
90
|
+
# Whether finding is marked as one whose record keeps no evidence.
|
|
88
91
|
#: (Hash[String, untyped]) -> bool
|
|
89
92
|
def evidence_not_kept?(finding) = finding["evidence_not_kept"] == true
|
|
90
93
|
end
|