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
|
@@ -7,15 +7,15 @@ 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 add-member's result says of the members sharing a line with the member it added, show-principle
|
|
10
|
-
# beside each member it shows
|
|
10
|
+
# beside each member it shows, and a full audit's request beside each member, of other maps only:
|
|
11
11
|
# those in its map (overlaps), those of them spanning exactly its lines
|
|
12
|
-
# (same_lines_as
|
|
12
|
+
# (same_lines_as), and those in other maps, with their roles there and same_lines when they span exactly
|
|
13
13
|
# its lines, spans_these_lines when their lines include all of its and within_these_lines when its lines
|
|
14
|
-
# include theirs (mapped_elsewhere
|
|
14
|
+
# include theirs (mapped_elsewhere). Each field is printed only when there are some; add-member
|
|
15
15
|
# also prints the sentences that say what it means for the agent.
|
|
16
16
|
class LinesSharedWithMember
|
|
17
17
|
# Why the agent checks the text where the lines meet, unless each member holding another's lines is a whole
|
|
18
|
-
# file, which holds every line's text
|
|
18
|
+
# file, which holds every line's text.
|
|
19
19
|
TEXT_CHECK = "Lines are not text: where two share a first or last line, a passage can start or end partway " \
|
|
20
20
|
"through it, so check the text there before deciding which edit reaches which member. " #: String
|
|
21
21
|
|
|
@@ -61,7 +61,7 @@ module Principles
|
|
|
61
61
|
end
|
|
62
62
|
|
|
63
63
|
# Which of them span all of this member's lines and which lie within them, so the agent can work out which
|
|
64
|
-
# member an edit reaches
|
|
64
|
+
# member an edit reaches. Lines are not text, so the agent checks where they share a first or last line.
|
|
65
65
|
#: () -> String
|
|
66
66
|
def spans_note
|
|
67
67
|
spans = @mapped_elsewhere.filter_map do |each|
|
|
@@ -99,7 +99,7 @@ module Principles
|
|
|
99
99
|
"meant, say why in this member's role. "
|
|
100
100
|
end
|
|
101
101
|
|
|
102
|
-
# Each member spanning exactly these lines, by id, with its principle when it is in another
|
|
102
|
+
# Each member spanning exactly these lines, by id, with its principle when it is in another.
|
|
103
103
|
#: () -> Array[String]
|
|
104
104
|
def same_lines_named
|
|
105
105
|
elsewhere = @mapped_elsewhere.select { |each| each["same_lines"] }
|
|
@@ -8,14 +8,18 @@ require_relative "request_part"
|
|
|
8
8
|
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
|
-
# How a full audit's request shows the members to check against the principle's activation
|
|
11
|
+
# How a full audit's request shows the members to check against the principle's activation.
|
|
12
12
|
class LoadsToCheckResult
|
|
13
|
-
#
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
# The part this lists, by the name the request prints it under and start-audit --part takes.
|
|
14
|
+
PART = "loads_to_check_against_activation" #: String
|
|
15
|
+
|
|
16
|
+
# What a decision may be, as the answer printed alone says where it is written.
|
|
17
|
+
DECISION = "accepted, with reason saying why the member loads as it does; kept, with no reason, where " \
|
|
18
|
+
"last_accepted.since_accepted is unchanged; if the activation is wrong instead, change it and " \
|
|
19
|
+
"start the audit again" #: String
|
|
16
20
|
|
|
17
21
|
# listed is the members to check, nil when there are none, and id the principle they belong to; placeholders
|
|
18
|
-
# is the text the template alone prints in each field of a decision beside it, which left is not given
|
|
22
|
+
# is the text the template alone prints in each field of a decision beside it, which left is not given.
|
|
19
23
|
#: (Invocation, Hash[String, untyped]?, String, placeholders: Hash[String, String]) -> void
|
|
20
24
|
def initialize(invocation, listed, id, placeholders:)
|
|
21
25
|
@placeholders = placeholders
|
|
@@ -32,7 +36,7 @@ module Principles
|
|
|
32
36
|
listed = @listed or return
|
|
33
37
|
|
|
34
38
|
decisions = listed.fetch("rows").map { |row| { "member_id" => row.fetch("member_id"), "decision" => nil } }
|
|
35
|
-
RequestPart.new(shown: {
|
|
39
|
+
RequestPart.new(shown: { PART => listed },
|
|
36
40
|
instructions: [Instruction.of_paragraphs("loads_to_check_instruction", instruction) { true }],
|
|
37
41
|
slots: { "loading_decisions" => decisions },
|
|
38
42
|
help: { "loading_decisions" => { "decision" => DECISION, **@placeholders } })
|
|
@@ -41,7 +45,7 @@ module Principles
|
|
|
41
45
|
private
|
|
42
46
|
|
|
43
47
|
# How to decide each listed member, naming the activation change for a principle whose work is in hand in
|
|
44
|
-
# every session
|
|
48
|
+
# every session.
|
|
45
49
|
#: () -> String
|
|
46
50
|
def instruction
|
|
47
51
|
always = @invocation.in_project("change-activation", @id, options: ["--always"])
|
|
@@ -8,10 +8,10 @@ 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
|
# What add-member's result needs to know of the map a member joined, beyond the map itself: whether its
|
|
11
|
-
# principle keeps the others held, which changes the step after mapping
|
|
12
|
-
# correction may be open on it, so that the member may fix one of its findings
|
|
11
|
+
# principle keeps the others held, which changes the step after mapping, and whether a full audit's
|
|
12
|
+
# correction may be open on it, so that the member may fix one of its findings, and whether to repeat
|
|
13
13
|
# what to do after mapping: with a principle's first member, or in git the first since the map's last commit, so
|
|
14
|
-
# members mapped in one sitting do not each repeat it
|
|
14
|
+
# members mapped in one sitting do not each repeat it.
|
|
15
15
|
class MapAddedTo
|
|
16
16
|
COMPLETENESS_QUESTION = "Is every carrier of the same rule mapped, and should any member belong to another " \
|
|
17
17
|
"principle? "
|
|
@@ -29,7 +29,7 @@ module Principles
|
|
|
29
29
|
"material the members govern."
|
|
30
30
|
|
|
31
31
|
# in_git says whether the project is in git, where a committed map is each member's baseline until its first
|
|
32
|
-
# full audit
|
|
32
|
+
# full audit.
|
|
33
33
|
#: (Invocation, in_git: bool) -> void
|
|
34
34
|
def initialize(invocation, in_git:)
|
|
35
35
|
@invocation = invocation
|
|
@@ -59,14 +59,14 @@ module Principles
|
|
|
59
59
|
end
|
|
60
60
|
|
|
61
61
|
# What this tool recorded of when the work is in hand, and what a full audit lists against it, as
|
|
62
|
-
# Models::Activation#full_audit_lists names it
|
|
62
|
+
# Models::Activation#full_audit_lists names it.
|
|
63
63
|
#: (PrintedPrinciple, lists: String) -> Hash[String, untyped]
|
|
64
64
|
def activation_changed(principle, lists:)
|
|
65
65
|
question(principle, ActivationInHand.new(principle.activation || {}).recorded(principle.id, lists),
|
|
66
66
|
start_audit(principle.id), shown: { "activation" => principle.activation })
|
|
67
67
|
end
|
|
68
68
|
|
|
69
|
-
# change-activation when the map already held that activation, so it wrote nothing
|
|
69
|
+
# change-activation when the map already held that activation, so it wrote nothing.
|
|
70
70
|
#: (PrintedPrinciple) -> Hash[String, untyped]
|
|
71
71
|
def activation_unchanged(principle)
|
|
72
72
|
question(principle, ActivationInHand.new(principle.activation || {}).unchanged(principle.id),
|
|
@@ -89,7 +89,7 @@ module Principles
|
|
|
89
89
|
end
|
|
90
90
|
|
|
91
91
|
# add-member's report of the map it started, with the description and activation it wrote, which the agent
|
|
92
|
-
# never typed
|
|
92
|
+
# never typed.
|
|
93
93
|
#: (PrintedPrinciple) -> Hash[String, untyped]
|
|
94
94
|
def map_created(principle)
|
|
95
95
|
{ "map_created" => { "description" => principle.description, "activation" => principle.activation } }
|
|
@@ -106,8 +106,8 @@ module Principles
|
|
|
106
106
|
end
|
|
107
107
|
|
|
108
108
|
# change-member-check: the stored command is the member's check in the map printed beside this, so the
|
|
109
|
-
# agent can see it byte for byte; the question names that field rather than quoting project text
|
|
110
|
-
# hidden names each character in the check that prints escaped or not at all
|
|
109
|
+
# agent can see it byte for byte; the question names that field rather than quoting project text.
|
|
110
|
+
# hidden names each character in the check that prints escaped or not at all.
|
|
111
111
|
#: (PrintedPrinciple, member: String, hidden: Array[String]) -> Hash[String, untyped]
|
|
112
112
|
def check_changed(principle, member:, hidden:)
|
|
113
113
|
done = "#{member} is now enforced by the check named in its map entry. The next audit marks it new or " \
|
|
@@ -122,8 +122,8 @@ module Principles
|
|
|
122
122
|
end
|
|
123
123
|
|
|
124
124
|
# change-member-role, change-member-check and remove-member-check: done says what changed. This tool cannot
|
|
125
|
-
# tell in git whether a full audit's correction is open, so the next step names both cases
|
|
126
|
-
# the other case by what the agent holds: a correction request (
|
|
125
|
+
# tell in git whether a full audit's correction is open, so the next step names both cases, and
|
|
126
|
+
# the other case by what the agent holds: a correction request (one user on 8e5b3f9).
|
|
127
127
|
#: (PrintedPrinciple, member: String, done: String) -> Hash[String, untyped]
|
|
128
128
|
def member_replaced(principle, member:, done:)
|
|
129
129
|
question(principle, "#{done} Check the other members, then start the audit.\nIf you hold a correction " \
|
|
@@ -143,7 +143,7 @@ module Principles
|
|
|
143
143
|
private
|
|
144
144
|
|
|
145
145
|
# shown is what the result prints of the map: the whole map unless the caller names less, as add-member
|
|
146
|
-
# does
|
|
146
|
+
# does.
|
|
147
147
|
#: (PrintedPrinciple, String, String, ?shown: Hash[String, untyped]) -> Hash[String, untyped]
|
|
148
148
|
def question(principle, text, answer_with, shown: { "map" => principle.map })
|
|
149
149
|
{ "status" => "question", "principle_id" => principle.id, "map_file" => principle.file, **shown,
|
|
@@ -1,32 +1,31 @@
|
|
|
1
1
|
# typed: strict
|
|
2
2
|
# frozen_string_literal: true
|
|
3
3
|
|
|
4
|
-
require_relative "
|
|
4
|
+
require_relative "read_the_change"
|
|
5
5
|
|
|
6
6
|
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
|
# One member's change since its baseline, as a one-member audit's request shows it: the member's id, role and
|
|
10
10
|
# evidence, the commit its baseline text is at, the commit the audit is based on, the member's own lines at
|
|
11
|
-
# each
|
|
11
|
+
# each, and the command that shows its change between them.
|
|
12
12
|
class MemberChangeSinceBaseline
|
|
13
13
|
# member holds the member's id, role and evidence; commits holds "base", HEAD, and "baseline", the commit
|
|
14
14
|
# the member's baseline text is at, and "audit_base" when the baseline is later than the audit's base;
|
|
15
|
-
# member_lines holds its own lines at each, or their counts when too long;
|
|
16
|
-
#
|
|
15
|
+
# member_lines holds its own lines at each, or their counts when too long; first_changed_lines the first line
|
|
16
|
+
# on each side the other lacks; read_the_change the command that shows the change from baseline to base.
|
|
17
17
|
#: (member: Hash[String, untyped], commits: Hash[String, String], member_lines: Hash[String, untyped],
|
|
18
|
-
#| first_changed_lines: Hash[String, String],
|
|
19
|
-
def initialize(member:, commits:, member_lines:, first_changed_lines:,
|
|
18
|
+
#| first_changed_lines: Hash[String, String], read_the_change: ReadTheChange) -> void
|
|
19
|
+
def initialize(member:, commits:, member_lines:, first_changed_lines:, read_the_change:)
|
|
20
20
|
@member = member
|
|
21
21
|
@commits = commits
|
|
22
22
|
@member_lines = member_lines
|
|
23
23
|
@first_changed_lines = first_changed_lines
|
|
24
|
-
@
|
|
24
|
+
@read_the_change = read_the_change
|
|
25
25
|
freeze
|
|
26
26
|
end
|
|
27
27
|
|
|
28
|
-
# The first line on each side the other lacks, which an answer leaving its quotes out reads them as
|
|
29
|
-
# #1166).
|
|
28
|
+
# The first line on each side the other lacks, which an answer leaving its quotes out reads them as.
|
|
30
29
|
#: Hash[String, String]
|
|
31
30
|
attr_reader :first_changed_lines
|
|
32
31
|
|
|
@@ -40,36 +39,58 @@ module Principles
|
|
|
40
39
|
@commits.fetch("base")
|
|
41
40
|
end
|
|
42
41
|
|
|
42
|
+
# Whether other prints the same change as this one: the same lines and first changed lines, as one
|
|
43
|
+
# member mapped by two principles does from baselines holding the same text, whatever commit each is at.
|
|
44
|
+
#: (MemberChangeSinceBaseline) -> bool
|
|
45
|
+
def same_change_as?(other) = other.change == change
|
|
46
|
+
|
|
47
|
+
# The fields as the request prints them, but the change, which another principle's entry prints under
|
|
48
|
+
# principle_id.
|
|
49
|
+
#: (String) -> Hash[String, untyped]
|
|
50
|
+
def shown_under(principle_id)
|
|
51
|
+
shown = change
|
|
52
|
+
to_h.reject { |field, _| shown.key?(field) }.merge("change_shown_under" => principle_id)
|
|
53
|
+
end
|
|
54
|
+
|
|
43
55
|
# The fields as the request prints them. Lines left out for their length point at read_the_change instead,
|
|
44
|
-
# so the request is never silently partial
|
|
56
|
+
# so the request is never silently partial.
|
|
45
57
|
#: () -> Hash[String, untyped]
|
|
46
58
|
def to_h
|
|
47
|
-
read = read_the_change
|
|
59
|
+
read = @read_the_change.to_s
|
|
48
60
|
lines = @member_lines.key?("omitted") ? @member_lines.merge("read_instead" => read) : with_read_instead(read)
|
|
49
61
|
{ "member" => @member, "baseline_commit" => @commits.fetch("baseline"), "base_commit" => base_commit,
|
|
50
62
|
**@commits.slice("audit_base").transform_keys { "audit_base_commit" },
|
|
51
63
|
"member_lines" => lines, "first_changed_lines" => @first_changed_lines, "read_the_change" => read }
|
|
52
64
|
end
|
|
53
65
|
|
|
66
|
+
protected
|
|
67
|
+
|
|
68
|
+
# The fields that print the change itself, as the request prints them, which a request across principles
|
|
69
|
+
# prints once for a shared member.
|
|
70
|
+
#: () -> Hash[String, untyped]
|
|
71
|
+
def change = to_h.slice("member_lines", "first_changed_lines")
|
|
72
|
+
|
|
54
73
|
private
|
|
55
74
|
|
|
56
|
-
# The member's lines, each side of their changed region
|
|
75
|
+
# The member's lines, each side of their changed region, or of each of their changed regions, left out pointing
|
|
76
|
+
# at read, as the whole lines do.
|
|
57
77
|
#: (String) -> Hash[String, untyped]
|
|
58
78
|
def with_read_instead(read)
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
79
|
+
@member_lines.to_h do |key, value|
|
|
80
|
+
case key
|
|
81
|
+
when "changed_region" then [key, region_reading(value, read)]
|
|
82
|
+
when "changed_regions" then [key, value.map { region_reading(it, read) }]
|
|
83
|
+
else [key, value]
|
|
84
|
+
end
|
|
64
85
|
end
|
|
65
|
-
@member_lines.merge("changed_region" => sides)
|
|
66
86
|
end
|
|
67
87
|
|
|
68
|
-
#
|
|
69
|
-
#: () -> String
|
|
70
|
-
def
|
|
71
|
-
|
|
72
|
-
|
|
88
|
+
# region with each side left out pointing at read.
|
|
89
|
+
#: (Hash[String, untyped], String) -> Hash[String, untyped]
|
|
90
|
+
def region_reading(region, read)
|
|
91
|
+
region.transform_values do |side|
|
|
92
|
+
side.is_a?(Hash) && side.key?("omitted") ? side.merge("read_instead" => read) : side
|
|
93
|
+
end
|
|
73
94
|
end
|
|
74
95
|
end
|
|
75
96
|
end
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# typed: strict
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
module Principles
|
|
5
|
+
# What this tool prints, from plain values a controller hands it. views/CLAUDE.md owns the boundary.
|
|
6
|
+
module Views
|
|
7
|
+
# A member's lines at its last full audit and now, as AcknowledgedSinceLastAudit prints them, beside the member's
|
|
8
|
+
# text printed whole, as its start-audit --part prints it: each side now names where it starts in the text and
|
|
9
|
+
# how many of its lines it spans, so the part carries each line now once.
|
|
10
|
+
class MemberLinesBesideText
|
|
11
|
+
#: (Hash[String, untyped]) -> void
|
|
12
|
+
def initialize(member_lines)
|
|
13
|
+
@member_lines = member_lines
|
|
14
|
+
freeze
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# The lines as printed, each side now that lists its lines pointing at the text instead.
|
|
18
|
+
#: () -> Hash[String, untyped]
|
|
19
|
+
def shown
|
|
20
|
+
lines = @member_lines
|
|
21
|
+
return lines.merge("now" => in_text(1, lines.fetch("now"))) if lines["now"].is_a?(Array)
|
|
22
|
+
return lines.merge("changed_region" => region(lines.fetch("changed_region"))) if lines["changed_region"]
|
|
23
|
+
return lines.merge("changed_regions" => lines.fetch("changed_regions").map { region(it) }) if
|
|
24
|
+
lines["changed_regions"]
|
|
25
|
+
|
|
26
|
+
lines
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
private
|
|
30
|
+
|
|
31
|
+
# A changed region, its side now pointing at the text when it lists its lines.
|
|
32
|
+
#: (Hash[String, untyped]) -> Hash[String, untyped]
|
|
33
|
+
def region(changed)
|
|
34
|
+
now = changed.fetch("now")
|
|
35
|
+
now["lines"] ? changed.merge("now" => in_text(now.fetch("from_line"), now.fetch("lines"))) : changed
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# Where lines start in the text, and how many they are.
|
|
39
|
+
#: (Integer, Array[String]) -> Hash[String, Integer]
|
|
40
|
+
def in_text(from_line, lines) = { "from_line" => from_line, "lines_in_text" => lines.length }
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
@@ -31,7 +31,7 @@ module Principles
|
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
# member, as show-principle prints it, with its repairs as repair_with when moves, its moves, are given, as the
|
|
34
|
-
# controller gives them for a member an audit would refuse
|
|
34
|
+
# controller gives them for a member an audit would refuse.
|
|
35
35
|
#: (String, Hash[String, untyped], Array[Hash[String, untyped]]?) -> Hash[String, untyped]
|
|
36
36
|
def beside(id, member, moves)
|
|
37
37
|
return member unless moves
|
|
@@ -44,7 +44,8 @@ module Principles
|
|
|
44
44
|
#: (String, String, Hash[String, untyped]) -> String
|
|
45
45
|
def move(id, member_id, move)
|
|
46
46
|
kept = move.fetch("keep").flat_map { |field, value| [FLAGS.fetch(field), value] }
|
|
47
|
-
|
|
47
|
+
fill = move.fetch("fill")
|
|
48
|
+
usage = fill.map { "#{FLAGS.fetch(it)} #{PLACEHOLDERS.fetch(it)}" }.join(" ") unless fill.empty?
|
|
48
49
|
@invocation.in_project("move-member", id, member_id, options: kept, usage: usage)
|
|
49
50
|
end
|
|
50
51
|
end
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# typed: strict
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require_relative "visible_text"
|
|
5
|
+
|
|
6
|
+
module Principles
|
|
7
|
+
# What this tool prints, from plain values a controller hands it. views/CLAUDE.md owns the boundary.
|
|
8
|
+
module Views
|
|
9
|
+
# One changed member as a line of tab-separated fields, each written through VisibleText: its principle, id,
|
|
10
|
+
# newest commit that changed it (or "uncommitted"), that commit's subject, and what it was compared with:
|
|
11
|
+
# "audit" or "mapping_commit", then "waiting_on_an_upgrade" for one compared with hashes a later copy wrote.
|
|
12
|
+
# The after-commit hook prints it, and list-member-problems --short its short form, without the subject.
|
|
13
|
+
class MemberRow
|
|
14
|
+
# member is one entry of list-member-problems' "members", with its "history".
|
|
15
|
+
#: (Hash[String, untyped]) -> void
|
|
16
|
+
def initialize(member)
|
|
17
|
+
@member = member
|
|
18
|
+
freeze
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
#: () -> String
|
|
22
|
+
def to_s
|
|
23
|
+
history = @member.fetch("history", {})
|
|
24
|
+
newest = history.fetch("commits", []).first
|
|
25
|
+
joined([*head, newest ? described(newest, history) : "not committed yet", *tail])
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# The row without the commit's subject, which repeats on every row one commit changed and which
|
|
29
|
+
# list-member-problems' JSON keeps.
|
|
30
|
+
#: () -> String
|
|
31
|
+
def short = joined([*head, *tail])
|
|
32
|
+
|
|
33
|
+
private
|
|
34
|
+
|
|
35
|
+
# The principle, id and newest commit that changed the member, or "uncommitted".
|
|
36
|
+
#: () -> Array[String]
|
|
37
|
+
def head
|
|
38
|
+
newest = @member.fetch("history", {}).fetch("commits", []).first
|
|
39
|
+
[@member.fetch("principle"), @member.fetch("id"), newest ? newest.fetch("commit") : "uncommitted"]
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# What the member was compared with, and whether its audit waits on an upgrade.
|
|
43
|
+
#: () -> Array[String]
|
|
44
|
+
def tail = [@member.dig("since", "baseline").to_s, *("waiting_on_an_upgrade" if @member["waiting_on_an_upgrade"])]
|
|
45
|
+
|
|
46
|
+
#: (Array[String]) -> String
|
|
47
|
+
def joined(fields) = fields.map { |field| VisibleText.new(field).to_s }.join("\t")
|
|
48
|
+
|
|
49
|
+
# The newest commit's subject, with how many earlier commits changed the member, and whether it changed
|
|
50
|
+
# again on disk.
|
|
51
|
+
#: (Hash[String, untyped], Hash[String, untyped]) -> String
|
|
52
|
+
def described(newest, history)
|
|
53
|
+
earlier = history.fetch("commits").length - 1
|
|
54
|
+
more = history.dig("stopped_at", "reason") == "limit" ? " or more" : ""
|
|
55
|
+
notes = [("+#{earlier}#{more} earlier" if earlier.positive?),
|
|
56
|
+
("also uncommitted" if history["uncommitted"])].compact
|
|
57
|
+
notes.empty? ? newest.fetch("subject") : "#{newest.fetch("subject")} (#{notes.join("; ")})"
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
require "json"
|
|
5
5
|
require_relative "invocation"
|
|
6
|
+
require_relative "member_row"
|
|
6
7
|
require_relative "problem_lines"
|
|
7
8
|
require_relative "prompts"
|
|
8
9
|
require_relative "record_waiting_on_an_upgrade"
|
|
@@ -12,23 +13,26 @@ module Principles
|
|
|
12
13
|
# What this tool prints, from plain values a controller hands it. views/CLAUDE.md owns the boundary.
|
|
13
14
|
module Views
|
|
14
15
|
# list-member-problems --commits-after COMMIT --hook-event EVENT: the whole JSON the plugin's after-commit hook
|
|
15
|
-
# prints for Claude Code, which puts its additionalContext beside the Bash call's result
|
|
16
|
+
# prints for Claude Code, which puts its additionalContext beside the Bash call's result, or nothing at all.
|
|
16
17
|
# Claude Code asks for that text to state facts, not to give orders, so it says what the commits changed,
|
|
17
|
-
# which command shows more and which skill to start from
|
|
18
|
-
#
|
|
18
|
+
# which command shows more and, under the plugin, which skill to start from. It names that skill as a user
|
|
19
|
+
# invokes it in Claude Code, /principles, the only host the plugin installs it for.
|
|
19
20
|
class MembersACommitChanged
|
|
20
21
|
NOTHING = Lines.new(stdout: "", stderr: "", status: 0).freeze #: Lines
|
|
21
22
|
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
# skill says whether this session has the principles skill, which only the plugin installs; without it the
|
|
24
|
+
# command the report names is where to start.
|
|
25
|
+
#: (Invocation, skill: bool) -> void
|
|
26
|
+
def initialize(invocation, skill:)
|
|
24
27
|
@invocation = invocation
|
|
28
|
+
@skill = skill
|
|
25
29
|
freeze
|
|
26
30
|
end
|
|
27
31
|
|
|
28
32
|
# changed is each member the commits changed, as list-member-problems lists it; others is how many other changed
|
|
29
33
|
# members it still lists. Those it marks waiting_on_an_upgrade are named apart, with the waits that say why, and
|
|
30
|
-
# no audit to run
|
|
31
|
-
# audit those
|
|
34
|
+
# no audit to run; the others still listed are counted beside them too, since this copy may
|
|
35
|
+
# audit those.
|
|
32
36
|
#: (String, Array[Hash[String, untyped]], others: Integer, ?waits: Array[RecordWaitingOnAnUpgrade]) -> Lines
|
|
33
37
|
def changed(event, changed, others:, waits: [])
|
|
34
38
|
waiting, auditable = changed.partition { |member| member["waiting_on_an_upgrade"] }
|
|
@@ -46,12 +50,12 @@ module Principles
|
|
|
46
50
|
|
|
47
51
|
private
|
|
48
52
|
|
|
49
|
-
# The members to audit, as rows, then what shows more and the skill to start from.
|
|
53
|
+
# The members to audit, as rows, then what shows more and, in a session that has it, the skill to start from.
|
|
50
54
|
#: (Array[Hash[String, untyped]], Integer) -> Array[String]
|
|
51
55
|
def to_audit(changed, others)
|
|
52
56
|
[Prompts.text("report-after-a-commit/the-commits-changed-these-members"), *rows(changed),
|
|
53
57
|
*still_listed(others), Prompts.text("report-after-a-commit/this-command-shows-each-one"), command,
|
|
54
|
-
Prompts.text("report-after-a-commit/the-principles-skill-is-where-to-start")]
|
|
58
|
+
*(Prompts.text("report-after-a-commit/the-principles-skill-is-where-to-start") if @skill)]
|
|
55
59
|
end
|
|
56
60
|
|
|
57
61
|
# The other changed members still listed, and the command that shows each, or nothing when none is.
|
|
@@ -70,7 +74,7 @@ module Principles
|
|
|
70
74
|
end
|
|
71
75
|
|
|
72
76
|
#: (Array[Hash[String, untyped]]) -> Array[String]
|
|
73
|
-
def rows(members) = members.map {
|
|
77
|
+
def rows(members) = members.map { MemberRow.new(it).to_s }
|
|
74
78
|
|
|
75
79
|
# The line saying how many other changed members list-member-problems still lists, or none when it lists none.
|
|
76
80
|
#: (Integer) -> Array[String]
|
|
@@ -85,7 +89,7 @@ module Principles
|
|
|
85
89
|
def command = @invocation.in_project("list-member-problems")
|
|
86
90
|
|
|
87
91
|
# The hook's JSON. Each field from a project file or commit is written through VisibleText already, so an
|
|
88
|
-
# invisible character reaches the model as \uXXXX, not hidden in the text it reads
|
|
92
|
+
# invisible character reaches the model as \uXXXX, not hidden in the text it reads.
|
|
89
93
|
#: (String, Array[String]) -> Lines
|
|
90
94
|
def reported(event, lines)
|
|
91
95
|
output = { "hookSpecificOutput" => { "hookEventName" => event, "additionalContext" => lines.join("\n") } }
|
|
@@ -7,7 +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
|
# One principle's members with no baseline, as list-member-problems' next_action says what gives them one:
|
|
10
|
-
# outside git a completed audit, and in git committing the files that hold them
|
|
10
|
+
# outside git a completed audit, and in git committing the files that hold them.
|
|
11
11
|
class MembersWithNoBaseline
|
|
12
12
|
# because is "outside_git" or "not_committed"; audit is the start-audit command to run outside git, and
|
|
13
13
|
# files the map and member files to commit in git.
|
|
@@ -27,17 +27,24 @@ module Principles
|
|
|
27
27
|
"#{one? ? "it" : "they"} changed is not yet known.#{remedy}"
|
|
28
28
|
end
|
|
29
29
|
|
|
30
|
+
# Whether its remedy names the audit command, as it does unless committing files gives the baseline.
|
|
31
|
+
#: () -> bool
|
|
32
|
+
def names_a_command? = !committing?
|
|
33
|
+
|
|
30
34
|
private
|
|
31
35
|
|
|
32
36
|
#: () -> bool
|
|
33
37
|
def one? = @count == 1
|
|
34
38
|
|
|
39
|
+
#: () -> bool
|
|
40
|
+
def committing? = @because == "not_committed" && !@files.empty?
|
|
41
|
+
|
|
35
42
|
# What gives the members a baseline: a completed audit outside git, or in git committing the files that
|
|
36
|
-
# differ from HEAD, or an audit again when none does, since every file is committed already
|
|
43
|
+
# differ from HEAD, or an audit again when none does, since every file is committed already. The
|
|
37
44
|
# audit command starts a line of its own, after its purpose.
|
|
38
45
|
#: () -> String
|
|
39
46
|
def remedy
|
|
40
|
-
return " Committing #{ProseList.new(@files)} #{gives}." if
|
|
47
|
+
return " Committing #{ProseList.new(@files)} #{gives}." if committing?
|
|
41
48
|
|
|
42
49
|
"#{all_committed if @because == "not_committed"}\nA completed audit #{gives}: #{@audit}"
|
|
43
50
|
end
|
|
@@ -7,7 +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 passage setup proposes for every entry file, as the agent pastes it, its lines kept: one or two lines,
|
|
10
|
-
# worded for a reader who may not have principles installed
|
|
10
|
+
# worded for a reader who may not have principles installed.
|
|
11
11
|
class MetaPrinciplePassage
|
|
12
12
|
#: (heading: String) -> void
|
|
13
13
|
def initialize(heading:)
|
|
@@ -5,18 +5,19 @@ require_relative "invocation"
|
|
|
5
5
|
require_relative "meta_principle_passage"
|
|
6
6
|
require_relative "printed_principle"
|
|
7
7
|
require_relative "first_audit"
|
|
8
|
+
require_relative "report_hooks_offer"
|
|
8
9
|
|
|
9
10
|
module Principles
|
|
10
11
|
# What this tool prints, from plain values a controller hands it. views/CLAUDE.md owns the boundary.
|
|
11
12
|
module Views
|
|
12
13
|
# What show-meta-principle-passage prints: the map its printed add-member writes, the facts of the project's entry
|
|
13
14
|
# files, the one passage any of them would take, and the commands that map the passage once the agent has placed
|
|
14
|
-
# it with the user
|
|
15
|
+
# it with the user.
|
|
15
16
|
class MetaPrincipleResult
|
|
16
17
|
# How the printed add-member commands map the passage: heading is the passage's heading, which they name as
|
|
17
18
|
# its member's section, beside role, the role they give that member; step_role is the role they give a
|
|
18
19
|
# passage the project has that carries one of the passage's steps, and place_role the one they give any other
|
|
19
|
-
# place that keeps the principles held, such as a timer or a settings line
|
|
20
|
+
# place that keeps the principles held, such as a timer or a settings line.
|
|
20
21
|
class PassageMapping
|
|
21
22
|
#: String
|
|
22
23
|
attr_reader :heading, :role, :step_role, :place_role
|
|
@@ -70,11 +71,15 @@ module Principles
|
|
|
70
71
|
# The passage's estimated size, which loads in every session that loads the entry file it goes in.
|
|
71
72
|
#: () -> Integer
|
|
72
73
|
def estimated_tokens = @fields.fetch("passage").fetch("estimated_tokens")
|
|
74
|
+
|
|
75
|
+
# Whether the plugin's hooks report in this session, so its hook entries need no offer.
|
|
76
|
+
#: () -> bool
|
|
77
|
+
def hooks_run? = @fields.fetch("session_start_hook_in_this_session")
|
|
73
78
|
end
|
|
74
79
|
|
|
75
80
|
# The map as the project holds it: already_mapped says the map was there before this run, and
|
|
76
81
|
# members_in_entry_files names its members already in an entry file, by id and path; set_up says the map has a
|
|
77
|
-
# member, so the question asks which keeping step each lacks in place of asking to place the passage
|
|
82
|
+
# member, so the question asks which keeping step each lacks in place of asking to place the passage.
|
|
78
83
|
class MapInProject
|
|
79
84
|
#: bool
|
|
80
85
|
attr_reader :set_up
|
|
@@ -91,12 +96,14 @@ module Principles
|
|
|
91
96
|
def to_h = @fields
|
|
92
97
|
end
|
|
93
98
|
|
|
94
|
-
# existing_principles lists the project's other principles as list-principles lists them.
|
|
99
|
+
# existing_principles lists the project's other principles as list-principles lists them. Outside the plugin,
|
|
100
|
+
# it offers the hook entries that report changed members between audits, as a completed audit does.
|
|
95
101
|
#: (PrintedPrinciple, Placement, MapInProject, existing_principles: Array[Hash[String, untyped]])
|
|
96
102
|
#| -> Hash[String, untyped]
|
|
97
103
|
def proposal(principle, placement, map_in_project, existing_principles:)
|
|
104
|
+
hook_setup = placement.hooks_run? ? {} : { "hook_setup" => ReportHooksOffer.new(@invocation).to_s }
|
|
98
105
|
{ "status" => "question", "principle_id" => principle.id, "map_file" => principle.file,
|
|
99
|
-
"map" => principle.map, **map_in_project.to_h, **placement.to_h,
|
|
106
|
+
"map" => principle.map, **map_in_project.to_h, **placement.to_h, **hook_setup,
|
|
100
107
|
"existing_principles" => existing_principles,
|
|
101
108
|
"question" => map_in_project.set_up ? steps_lacking(principle, placement) : question(principle.id),
|
|
102
109
|
"answer_with" => add_member(principle.id), "next_action" => next_action(principle.id, existing_principles) }
|