principles 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +383 -0
- data/LICENSE +202 -0
- data/NOTICE +4 -0
- data/README.md +111 -0
- data/exe/principles +20 -0
- data/lib/principles/after_commit_hook_options.rb +2 -2
- data/lib/principles/cli.rb +50 -42
- data/lib/principles/command_line.rb +22 -16
- data/lib/principles/command_routes.rb +20 -6
- data/lib/principles/controllers/acknowledgement.rb +29 -74
- data/lib/principles/controllers/acknowledgements.rb +154 -0
- data/lib/principles/controllers/after_commit_report.rb +44 -0
- data/lib/principles/controllers/answer.rb +48 -18
- data/lib/principles/controllers/answer_phase.rb +20 -3
- data/lib/principles/controllers/assessment.rb +32 -11
- data/lib/principles/controllers/audit.rb +43 -19
- data/lib/principles/controllers/audit_completion.rb +21 -12
- data/lib/principles/controllers/command.rb +13 -12
- data/lib/principles/controllers/correction.rb +15 -7
- data/lib/principles/controllers/first_audit_brief.rb +40 -0
- data/lib/principles/controllers/full_audit_request.rb +41 -82
- data/lib/principles/controllers/hook_setup.rb +49 -0
- data/lib/principles/controllers/inventory.rb +10 -8
- data/lib/principles/controllers/mapping.rb +2 -2
- data/lib/principles/controllers/member_acknowledgement.rb +32 -21
- data/lib/principles/controllers/member_entries.rb +4 -4
- data/lib/principles/controllers/member_problems_report.rb +62 -16
- data/lib/principles/controllers/members_a_commit_changed.rb +3 -3
- data/lib/principles/controllers/members_to_assess.rb +23 -20
- data/lib/principles/controllers/meta_principle_setup.rb +5 -6
- data/lib/principles/controllers/open_correction.rb +42 -0
- data/lib/principles/controllers/parts_to_read.rb +117 -0
- data/lib/principles/controllers/repoint.rb +1 -1
- data/lib/principles/controllers/running_tool.rb +56 -6
- data/lib/principles/controllers/session_start_report.rb +62 -0
- data/lib/principles/controllers/survey.rb +2 -2
- data/lib/principles/data/audit_files.rb +7 -7
- data/lib/principles/data/bounded_file.rb +1 -1
- data/lib/principles/data/candidate_files_found.rb +6 -3
- data/lib/principles/data/command-steps.json +61 -6
- data/lib/principles/data/expected_type.rb +3 -3
- data/lib/principles/data/first_parent_log.rb +1 -1
- data/lib/principles/data/head_reflog.rb +74 -0
- data/lib/principles/data/hook_input.rb +59 -0
- data/lib/principles/data/ignored_by_git.rb +2 -2
- data/lib/principles/data/known_fields.rb +1 -1
- data/lib/principles/data/linked_path.rb +1 -1
- data/lib/principles/data/map_files.rb +2 -2
- data/lib/principles/data/principles_on_path.rb +83 -0
- data/lib/principles/data/principles_subfolder.rb +1 -1
- data/lib/principles/data/project_files.rb +10 -3
- data/lib/principles/data/repository.rb +14 -7
- data/lib/principles/data/running_version.rb +10 -8
- data/lib/principles/data/schema_check.rb +5 -5
- data/lib/principles/data/schemas/acknowledgement-answer.schema.json +86 -21
- data/lib/principles/data/schemas/acknowledgements-answer.schema.json +9 -2
- data/lib/principles/data/schemas/assessment-answer.schema.json +43 -22
- data/lib/principles/data/schemas/audit-record.schema.json +29 -20
- data/lib/principles/data/schemas/command-steps.schema.json +1 -1
- data/lib/principles/data/schemas/correction-answer-guide.schema.json +1 -1
- data/lib/principles/data/schemas/correction-answer.schema.json +9 -9
- data/lib/principles/data/schemas/member-map.schema.json +3 -3
- data/lib/principles/data/schemas/repointing-answer.schema.json +1 -1
- data/lib/principles/error.rb +4 -4
- data/lib/principles/failure_refusal.rb +57 -0
- data/lib/principles/invocation_options.rb +4 -4
- data/lib/principles/launch.rb +49 -0
- data/lib/principles/list_open_findings_options.rb +1 -1
- data/lib/principles/models/accepted_loading.rb +2 -2
- data/lib/principles/models/acknowledged_check.rb +23 -11
- data/lib/principles/models/acknowledgement.rb +34 -18
- data/lib/principles/models/acknowledgement_left_as_printed.rb +7 -15
- data/lib/principles/models/acknowledgement_refusal.rb +25 -10
- data/lib/principles/models/acknowledgements.rb +45 -29
- data/lib/principles/models/acknowledgements_across.rb +68 -0
- data/lib/principles/models/activation.rb +2 -2
- data/lib/principles/models/after_commit_input.rb +115 -0
- data/lib/principles/models/agent_loads.rb +1 -1
- data/lib/principles/models/answer_fields.rb +2 -2
- data/lib/principles/models/answer_place.rb +3 -3
- data/lib/principles/models/answer_text.rb +2 -2
- data/lib/principles/models/answered_time.rb +4 -4
- data/lib/principles/models/assessment_answer.rb +10 -10
- data/lib/principles/models/assessment_basis.rb +2 -2
- data/lib/principles/models/assessment_left_as_printed.rb +1 -1
- data/lib/principles/models/assessment_report.rb +6 -7
- data/lib/principles/models/audit.rb +33 -34
- data/lib/principles/models/audit_record.rb +54 -28
- data/lib/principles/models/audit_records.rb +13 -13
- data/lib/principles/models/audit_start.rb +3 -3
- data/lib/principles/models/audited_member_lines.rb +1 -1
- data/lib/principles/models/candidate_files.rb +18 -10
- data/lib/principles/models/candidate_inventory.rb +6 -6
- data/lib/principles/models/candidate_outline.rb +9 -9
- data/lib/principles/models/carried_assessments.rb +18 -3
- data/lib/principles/models/carried_member.rb +5 -5
- data/lib/principles/models/changed_regions.rb +92 -0
- data/lib/principles/models/check_result_guide.rb +50 -0
- data/lib/principles/models/check_since_last_audit.rb +5 -4
- data/lib/principles/models/cited_files.rb +4 -4
- data/lib/principles/models/command_steps.rb +3 -3
- data/lib/principles/models/commits_brought_in.rb +1 -1
- data/lib/principles/models/commits_since_base.rb +1 -1
- data/lib/principles/models/correction_answer.rb +2 -2
- data/lib/principles/models/correction_basis.rb +7 -7
- data/lib/principles/models/dated_line.rb +1 -2
- data/lib/principles/models/decided_prior_findings.rb +6 -6
- data/lib/principles/models/declared_map_changes.rb +5 -5
- data/lib/principles/models/disposition.rb +21 -21
- data/lib/principles/models/entry_file.rb +1 -1
- data/lib/principles/models/entry_files.rb +1 -1
- data/lib/principles/models/evidence_item.rb +1 -1
- data/lib/principles/models/evidence_lines_since.rb +2 -2
- data/lib/principles/models/evidence_replacements.rb +3 -3
- data/lib/principles/models/finding_write_ups.rb +12 -5
- data/lib/principles/models/findings_left_open.rb +4 -4
- data/lib/principles/models/first_full_audit.rb +32 -0
- data/lib/principles/models/first_raised_claim.rb +1 -1
- data/lib/principles/models/fix_only_fields.rb +1 -1
- data/lib/principles/models/head_moves.rb +66 -0
- data/lib/principles/models/hook_commands.rb +49 -4
- data/lib/principles/models/ignored_candidates.rb +1 -1
- data/lib/principles/models/instruction_named.rb +2 -3
- data/lib/principles/models/json_digest.rb +2 -2
- data/lib/principles/models/json_path_query.rb +1 -1
- data/lib/principles/models/kept_prior_finding.rb +9 -9
- data/lib/principles/models/last_completed_revision.rb +4 -5
- data/lib/principles/models/left_as_printed.rb +2 -2
- data/lib/principles/models/line_diff.rb +113 -0
- data/lib/principles/models/line_span.rb +1 -1
- data/lib/principles/models/list_member_problems_check.rb +4 -4
- data/lib/principles/models/listed_members.rb +7 -9
- data/lib/principles/models/loaded_files.rb +4 -5
- data/lib/principles/models/loading_decision.rb +3 -3
- data/lib/principles/models/loading_facts.rb +1 -1
- data/lib/principles/models/loads_to_check.rb +1 -1
- data/lib/principles/models/located_text.rb +1 -1
- data/lib/principles/models/mapped_principles.rb +2 -2
- data/lib/principles/models/member.rb +31 -4
- data/lib/principles/models/member_assessments.rb +8 -8
- data/lib/principles/models/member_elsewhere.rb +4 -4
- data/lib/principles/models/member_file.rb +4 -4
- data/lib/principles/models/member_grounds.rb +1 -1
- data/lib/principles/models/member_hashes_as_written.rb +1 -1
- data/lib/principles/models/member_lines.rb +29 -61
- data/lib/principles/models/member_loads.rb +2 -2
- data/lib/principles/models/member_moves.rb +1 -1
- data/lib/principles/models/member_problems.rb +14 -15
- data/lib/principles/models/member_repair_moves.rb +15 -9
- data/lib/principles/models/member_sighting.rb +10 -10
- data/lib/principles/models/member_snapshots.rb +1 -1
- data/lib/principles/models/member_state.rb +1 -1
- data/lib/principles/models/members_across_principles.rb +77 -0
- data/lib/principles/models/members_elsewhere.rb +2 -2
- data/lib/principles/models/members_sharing_lines.rb +7 -7
- data/lib/principles/models/meta_principle.rb +11 -4
- data/lib/principles/models/missing_files.rb +3 -3
- data/lib/principles/models/new_findings.rb +4 -4
- data/lib/principles/models/open_correction.rb +57 -0
- data/lib/principles/models/open_finding.rb +36 -31
- data/lib/principles/models/open_findings_elsewhere.rb +2 -2
- data/lib/principles/models/other_principles.rb +2 -2
- data/lib/principles/models/other_templates_placeholders.rb +17 -16
- data/lib/principles/models/outline_budget.rb +7 -7
- data/lib/principles/models/outline_group.rb +1 -1
- data/lib/principles/models/outline_section.rb +2 -2
- data/lib/principles/models/part_named.rb +41 -0
- data/lib/principles/models/placement.rb +2 -2
- data/lib/principles/models/principle.rb +13 -13
- data/lib/principles/models/principle_history.rb +8 -8
- data/lib/principles/models/principle_members.rb +14 -7
- data/lib/principles/models/principles_folder_move.rb +1 -1
- data/lib/principles/models/principles_on_path.rb +29 -0
- data/lib/principles/models/principles_package.rb +3 -3
- data/lib/principles/models/prior_decision_fields.rb +8 -8
- data/lib/principles/models/prior_finding_decision.rb +8 -8
- data/lib/principles/models/prior_finding_outcomes.rb +1 -1
- data/lib/principles/models/prior_findings.rb +5 -5
- data/lib/principles/models/problem_report.rb +26 -8
- data/lib/principles/models/project.rb +27 -19
- data/lib/principles/models/project_history.rb +18 -12
- data/lib/principles/models/quoted_change.rb +8 -8
- data/lib/principles/models/recent_decision.rb +3 -3
- data/lib/principles/models/record_format.rb +16 -10
- data/lib/principles/models/record_judged_against.rb +4 -4
- data/lib/principles/models/recorded_entry.rb +17 -8
- data/lib/principles/models/recorded_finding.rb +9 -9
- data/lib/principles/models/recorded_findings.rb +2 -2
- data/lib/principles/models/recorded_hashes.rb +2 -2
- data/lib/principles/models/recorded_members.rb +13 -13
- data/lib/principles/models/refusal_before_shape.rb +2 -2
- data/lib/principles/models/repoint.rb +3 -3
- data/lib/principles/models/report_hooks.rb +69 -0
- data/lib/principles/models/reported_check.rb +34 -31
- data/lib/principles/models/request_id.rb +18 -6
- data/lib/principles/models/runs_from.rb +7 -2
- data/lib/principles/models/sent_answer.rb +14 -12
- data/lib/principles/models/sent_prior_decisions.rb +1 -1
- data/lib/principles/models/session_start_input.rb +37 -0
- data/lib/principles/models/shape_problems_beside.rb +1 -1
- data/lib/principles/models/skill_loads.rb +1 -1
- data/lib/principles/models/stale_request.rb +59 -0
- data/lib/principles/models/still_holds_restatement.rb +6 -6
- data/lib/principles/models/submitted_answer.rb +1 -1
- data/lib/principles/models/template_placeholders.rb +6 -6
- data/lib/principles/models/text_within.rb +1 -1
- data/lib/principles/models/tracked_paths.rb +38 -0
- data/lib/principles/models/unchecked_members.rb +2 -2
- data/lib/principles/models/uncommitted_files.rb +1 -1
- data/lib/principles/models/uncommitted_outside_the_map.rb +2 -2
- data/lib/principles/models/waits_on.rb +1 -1
- data/lib/principles/models/write_up_opening.rb +5 -5
- data/lib/principles/models/write_up_pointer.rb +3 -3
- data/lib/principles/models/write_up_repoint.rb +2 -3
- data/lib/principles/positional_arguments.rb +13 -6
- data/lib/principles/prose_list.rb +1 -1
- data/lib/principles/session_start_options.rb +1 -1
- data/lib/principles/start_audit_options.rb +46 -12
- data/lib/principles/supported_ruby.rb +24 -7
- data/lib/principles/version.rb +2 -2
- data/lib/principles/views/acknowledged_since_last_audit.rb +2 -2
- data/lib/principles/views/acknowledgement_result.rb +97 -11
- data/lib/principles/views/activation_in_hand.rb +1 -1
- data/lib/principles/views/answered_request.rb +6 -2
- data/lib/principles/views/assessed_members.rb +50 -41
- data/lib/principles/views/assessment_request.rb +39 -36
- data/lib/principles/views/audit_changes.rb +4 -4
- data/lib/principles/views/audit_commit.rb +5 -4
- data/lib/principles/views/audit_result.rb +92 -53
- data/lib/principles/views/candidate_files_result.rb +7 -6
- data/lib/principles/views/check_notes.rb +29 -6
- data/lib/principles/views/check_result_template.rb +45 -34
- data/lib/principles/views/completed_audit_next_step.rb +44 -0
- data/lib/principles/views/context_parts.rb +112 -0
- data/lib/principles/views/correction_request.rb +44 -25
- data/lib/principles/views/diff_since_last_audit.rb +8 -6
- data/lib/principles/views/findings_result.rb +17 -6
- data/lib/principles/views/first_audit_brief.rb +51 -0
- data/lib/principles/views/first_audit_line.rb +45 -0
- data/lib/principles/views/help.rb +4 -4
- data/lib/principles/views/hook_setup_result.rb +91 -0
- data/lib/principles/views/instruction.rb +3 -3
- data/lib/principles/views/invocation.rb +14 -6
- data/lib/principles/views/json_with_entries_on_lines.rb +6 -35
- data/lib/principles/views/landed_since_base.rb +1 -1
- data/lib/principles/views/line_history_since_last_audit.rb +35 -0
- data/lib/principles/views/lines_shared_with_member.rb +6 -6
- data/lib/principles/views/loads_to_check_result.rb +8 -5
- data/lib/principles/views/map_added_to.rb +3 -3
- data/lib/principles/views/map_result.rb +9 -9
- data/lib/principles/views/member_change_since_baseline.rb +44 -23
- data/lib/principles/views/member_lines_beside_text.rb +43 -0
- data/lib/principles/views/member_repairs.rb +3 -2
- data/lib/principles/views/member_row.rb +2 -2
- data/lib/principles/views/members_a_commit_changed.rb +13 -10
- data/lib/principles/views/members_with_no_baseline.rb +3 -3
- data/lib/principles/views/meta_principle_passage.rb +1 -1
- data/lib/principles/views/meta_principle_result.rb +12 -5
- data/lib/principles/views/one_member_check_result_template.rb +7 -7
- data/lib/principles/views/open_findings_elsewhere_result.rb +5 -2
- data/lib/principles/views/open_findings_line.rb +25 -36
- data/lib/principles/views/other_principles_unjudged_result.rb +6 -3
- data/lib/principles/views/outside_the_map_result.rb +5 -2
- data/lib/principles/views/package_since_last_audit_result.rb +29 -6
- data/lib/principles/views/parts_index_result.rb +60 -0
- data/lib/principles/views/principle_read_result.rb +5 -6
- data/lib/principles/views/principle_with_changed_members.rb +1 -1
- data/lib/principles/views/principles_with_no_completed_audit.rb +1 -2
- data/lib/principles/views/printed_json.rb +51 -0
- data/lib/principles/views/printed_principle.rb +1 -1
- data/lib/principles/views/prior_finding_decisions_result.rb +4 -4
- data/lib/principles/views/prior_findings_result.rb +17 -14
- data/lib/principles/views/problem_lines.rb +39 -17
- data/lib/principles/views/problem_result.rb +40 -37
- data/lib/principles/views/prompts/acknowledge-a-change/judge-each-member-once-for-every-principle.md +2 -0
- data/lib/principles/views/prompts/acknowledge-a-change/read-the-deferred-findings-it-keeps.md +1 -0
- data/lib/principles/views/prompts/acknowledge-a-change/resolve-them-in-a-full-audit.md +1 -0
- data/lib/principles/views/prompts/acknowledge-a-change/say-whether-the-change-keeps-the-meaning.md +3 -3
- data/lib/principles/views/prompts/assess-every-member/confirm-each-write-up-pointer-the-answer-drops.md +2 -0
- data/lib/principles/views/prompts/assess-every-member/have-a-changed-check-reviewed-before-running-it.md +1 -1
- data/lib/principles/views/prompts/assess-every-member/have-a-new-check-reviewed-before-running-it.md +1 -1
- data/lib/principles/views/prompts/assess-every-member/judge-a-carried-assessment-citing-a-decided-finding.md +3 -0
- data/lib/principles/views/prompts/assess-every-member/judge-a-submitted-carried-assessment-citing-a-decided-finding.md +5 -0
- data/lib/principles/views/prompts/assess-every-member/judge-the-keeping-under-the-release-since-the-last-audit.md +1 -1
- data/lib/principles/views/prompts/assess-every-member/keep-the-printed-review-basis-or-replace-it.md +1 -0
- data/lib/principles/views/prompts/assess-every-member/name-the-commit-that-made-the-check.md +1 -0
- data/lib/principles/views/prompts/assess-every-member/read-a-trimmed-instruction-whole.md +1 -1
- data/lib/principles/views/prompts/assess-every-member/read-the-request-in-parts.md +1 -0
- data/lib/principles/views/prompts/assess-every-member/why-each-member-is-judged-again.md +3 -2
- data/lib/principles/views/prompts/dispose-of-each-finding/answer-guide.json +1 -1
- data/lib/principles/views/prompts/dispose-of-each-finding/confirm-each-deferral-written-up-nowhere.md +2 -0
- data/lib/principles/views/prompts/dispose-of-each-finding/retain-assessment-and-correction.md +4 -4
- data/lib/principles/views/prompts/find-a-principle-to-map/where-the-inventory-looks.md +2 -2
- data/lib/principles/views/prompts/learn-what-a-command-does/list-candidate-files.md +4 -3
- data/lib/principles/views/prompts/learn-what-a-command-does/list-member-problems.md +6 -6
- data/lib/principles/views/prompts/learn-what-a-command-does/list-open-findings.md +11 -11
- data/lib/principles/views/prompts/learn-what-a-command-does/report-after-commit.md +14 -0
- data/lib/principles/views/prompts/learn-what-a-command-does/report-at-session-start.md +26 -0
- data/lib/principles/views/prompts/learn-what-a-command-does/show-answer-check.md +20 -18
- data/lib/principles/views/prompts/learn-what-a-command-does/show-first-audit-brief.md +19 -0
- data/lib/principles/views/prompts/learn-what-a-command-does/show-hook-setup.md +13 -0
- data/lib/principles/views/prompts/learn-what-a-command-does/show-meta-principle-passage.md +3 -1
- data/lib/principles/views/prompts/learn-what-a-command-does/show-open-correction.md +12 -0
- data/lib/principles/views/prompts/learn-what-a-command-does/start-audit.md +21 -22
- data/lib/principles/views/prompts/learn-what-a-command-does/submit-answer.md +5 -4
- data/lib/principles/views/prompts/report-the-completed-audit/commit-only-what-the-audit-changed.md +2 -2
- data/lib/principles/views/prompts/run-a-first-audit-in-the-background/follow-the-brief.md +18 -0
- data/lib/principles/views/prompts/set-principles-up/offer-the-report-hooks.md +2 -0
- data/lib/principles/views/prompts/set-principles-up/wire-the-report-hooks-with-the-user.md +8 -0
- data/lib/principles/views/prompts/start-a-session/act-on-the-open-findings.md +3 -4
- data/lib/principles/views/prompts/start-a-session/every-loaded-line-costs-every-session.md +1 -1
- data/lib/principles/views/prompts/start-a-session/hand-the-first-audit-to-a-subagent.md +3 -0
- data/lib/principles/views/prompts/start-a-session/run-each-command-above.md +1 -0
- data/lib/principles/views/prompts/start-a-session/start-no-second-first-audit.md +2 -0
- data/lib/principles/views/prompts.rb +1 -1
- data/lib/principles/views/read_the_change.rb +36 -0
- data/lib/principles/views/record_waiting_on_an_upgrade.rb +2 -2
- data/lib/principles/views/repoint_result.rb +1 -1
- data/lib/principles/views/report_hooks_offer.rb +25 -0
- data/lib/principles/views/request_part.rb +5 -5
- data/lib/principles/views/request_parts.rb +1 -1
- data/lib/principles/views/session_start_report.rb +46 -0
- data/lib/principles/views/shell_word.rb +1 -1
- data/lib/principles/views/trimmed_instructions_note.rb +30 -0
- data/lib/principles/views/visible_text.rb +1 -1
- data/lib/principles/views/workflow_diagram.rb +1 -1
- data/principles.gemspec +44 -0
- metadata +83 -14
- data/lib/principles/views/prompts/start-a-session/it-returns-after-each-clear-or-compaction-too.md +0 -1
- data/lib/principles/views/prompts/start-a-session/it-returns-at-each-session-start.md +0 -1
|
@@ -9,7 +9,7 @@ module Principles
|
|
|
9
9
|
# The domain logic, and the mediation of persistence. models/CLAUDE.md owns the boundary.
|
|
10
10
|
module Models
|
|
11
11
|
# The judgements an answer leaves as its template printed them, each named with its pointer, which the answer
|
|
12
|
-
# refuses in one refusal, so a copied template takes one repair
|
|
12
|
+
# refuses in one refusal, so a copied template takes one repair.
|
|
13
13
|
class LeftAsPrinted
|
|
14
14
|
# The problem with a judgement sent back as its placeholder.
|
|
15
15
|
UNCHANGED = "is the template's placeholder, unchanged" #: String
|
|
@@ -22,7 +22,7 @@ module Principles
|
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
# Refuses the answer naming each judgement left as printed, then each of besides, problems its shape has
|
|
25
|
-
# elsewhere, so one refusal names every repair
|
|
25
|
+
# elsewhere, so one refusal names every repair; one at or under a pointer named is left out, since
|
|
26
26
|
# writing the judgement repairs it. Nothing when none is left as printed, so the shape's own refusal names them.
|
|
27
27
|
#: (?besides: Array[Hash[String, String]]) -> void
|
|
28
28
|
def refuse(besides: [])
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# typed: strict
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
module Principles
|
|
5
|
+
# The domain logic, which loads and saves itself through data/. models/CLAUDE.md owns the boundary.
|
|
6
|
+
module Models
|
|
7
|
+
# Where two versions of a member's lines differ: each run of lines one side changed, in order, as a line diff finds
|
|
8
|
+
# them by their longest common subsequence. The lines both sides share from the start and from the end are never
|
|
9
|
+
# part of a run, so the first run starts at the same line on both sides.
|
|
10
|
+
class LineDiff
|
|
11
|
+
# One run of changed lines: the 0-based, end-exclusive range each side's changed lines take, empty on a side
|
|
12
|
+
# that only the other side's lines were added to.
|
|
13
|
+
Hunk = Struct.new(:at_baseline, :now)
|
|
14
|
+
|
|
15
|
+
# The longest run of lines two sides hold in the same order, as the index on each side of each of its lines.
|
|
16
|
+
class CommonLines
|
|
17
|
+
#: (Array[String], Array[String]) -> void
|
|
18
|
+
def initialize(one, other)
|
|
19
|
+
@one = one
|
|
20
|
+
@other = other
|
|
21
|
+
freeze
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
#: () -> Array[[Integer, Integer]]
|
|
25
|
+
def pairs
|
|
26
|
+
longest = table
|
|
27
|
+
at = [0, 0] #: [Integer, Integer]
|
|
28
|
+
found = [] #: Array[[Integer, Integer]]
|
|
29
|
+
while at[0] < @one.length && at[1] < @other.length
|
|
30
|
+
found << at if @one[at[0]] == @other[at[1]]
|
|
31
|
+
at = next_from(longest, *at)
|
|
32
|
+
end
|
|
33
|
+
found
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
private
|
|
37
|
+
|
|
38
|
+
# The length of the longest common run from each pair of indices to both ends.
|
|
39
|
+
#: () -> Array[Array[Integer]]
|
|
40
|
+
def table
|
|
41
|
+
longest = Array.new(@one.length + 1) { Array.new(@other.length + 1, 0) }
|
|
42
|
+
(@one.length - 1).downto(0) do |one_at|
|
|
43
|
+
row = longest.fetch(one_at)
|
|
44
|
+
(@other.length - 1).downto(0) { |other_at| row[other_at] = length_at(longest, one_at, other_at) }
|
|
45
|
+
end
|
|
46
|
+
longest
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
#: (Array[Array[Integer]], Integer, Integer) -> Integer
|
|
50
|
+
def length_at(longest, one_at, other_at)
|
|
51
|
+
return cell(longest, one_at + 1, other_at + 1) + 1 if @one[one_at] == @other[other_at]
|
|
52
|
+
|
|
53
|
+
[cell(longest, one_at + 1, other_at), cell(longest, one_at, other_at + 1)].max.to_i
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# The indices after one_at and other_at along the longest common run.
|
|
57
|
+
#: (Array[Array[Integer]], Integer, Integer) -> [Integer, Integer]
|
|
58
|
+
def next_from(longest, one_at, other_at)
|
|
59
|
+
return [one_at + 1, other_at + 1] if @one[one_at] == @other[other_at]
|
|
60
|
+
|
|
61
|
+
skip_one = cell(longest, one_at + 1, other_at) >= cell(longest, one_at, other_at + 1)
|
|
62
|
+
skip_one ? [one_at + 1, other_at] : [one_at, other_at + 1]
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
#: (Array[Array[Integer]], Integer, Integer) -> Integer
|
|
66
|
+
def cell(longest, one_at, other_at) = longest.fetch(one_at).fetch(other_at)
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
#: (Array[String], Array[String]) -> void
|
|
70
|
+
def initialize(at_baseline, now)
|
|
71
|
+
@at_baseline = at_baseline
|
|
72
|
+
@now = now
|
|
73
|
+
freeze
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
# Each run of changed lines, in order; none when the sides read the same.
|
|
77
|
+
#: () -> Array[Hunk]
|
|
78
|
+
def hunks
|
|
79
|
+
from = [0, 0] #: [Integer, Integer]
|
|
80
|
+
(matched_pairs + [[@at_baseline.length, @now.length]]).each_with_object([]) do |(one, other), found|
|
|
81
|
+
found << Hunk.new(from[0]...one, from[1]...other) if [one, other] != from
|
|
82
|
+
from = [one + 1, other + 1]
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
private
|
|
87
|
+
|
|
88
|
+
# The index on each side of each line both sides keep, in order: those they share from the start and the end,
|
|
89
|
+
# and between them the longest common run.
|
|
90
|
+
#: () -> Array[[Integer, Integer]]
|
|
91
|
+
def matched_pairs
|
|
92
|
+
head = common_length(@at_baseline, @now)
|
|
93
|
+
tail = common_length(@at_baseline.drop(head).reverse, @now.drop(head).reverse)
|
|
94
|
+
(0...head).map { [it, it] } + matched_between(head, tail) +
|
|
95
|
+
tail.downto(1).map { [@at_baseline.length - it, @now.length - it] }
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
# The longest common run of the lines after the head lines and before the tail lines both sides share.
|
|
99
|
+
#: (Integer, Integer) -> Array[[Integer, Integer]]
|
|
100
|
+
def matched_between(head, tail)
|
|
101
|
+
one = @at_baseline[head...(@at_baseline.length - tail)].to_a
|
|
102
|
+
other = @now[head...(@now.length - tail)].to_a
|
|
103
|
+
CommonLines.new(one, other).pairs.map { |one_at, other_at| [one_at + head, other_at + head] }
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
# How many lines two sides share from their start.
|
|
107
|
+
#: (Array[String], Array[String]) -> Integer
|
|
108
|
+
def common_length(one, other)
|
|
109
|
+
one.zip(other).take_while { |line, other_line| line == other_line && !other_line.nil? }.length
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
end
|
|
@@ -38,7 +38,7 @@ module Principles
|
|
|
38
38
|
end
|
|
39
39
|
|
|
40
40
|
# Whether this span surely holds all of other's text: it holds other's lines and is a whole file, which holds
|
|
41
|
-
# every line's text, where a passage may start or end partway through a line
|
|
41
|
+
# every line's text, where a passage may start or end partway through a line.
|
|
42
42
|
#: (LineSpan) -> bool
|
|
43
43
|
def holds_all_text_of?(other)
|
|
44
44
|
@whole_file && holds?(other)
|
|
@@ -9,7 +9,7 @@ module Principles
|
|
|
9
9
|
# The domain logic, and the mediation of persistence. models/CLAUDE.md owns the boundary.
|
|
10
10
|
module Models
|
|
11
11
|
# A member's check that is this tool's own list-member-problems --short, which exits 3 while it lists the member
|
|
12
|
-
# itself, until the acknowledgement of its edit is committed
|
|
12
|
+
# itself, until the acknowledgement of its edit is committed. Only a check whose words
|
|
13
13
|
# map exactly to that command's is one: any other check passes on exit 0 alone.
|
|
14
14
|
class ListMemberProblemsCheck
|
|
15
15
|
COMMAND = "list-member-problems"
|
|
@@ -67,9 +67,9 @@ module Principles
|
|
|
67
67
|
end
|
|
68
68
|
|
|
69
69
|
# What the check lists in project now, read through the report the command prints from, over the same scope:
|
|
70
|
-
# each member, as its principle id and member id, and by principle the count of members no audit has assessed
|
|
71
|
-
#
|
|
72
|
-
#: (Project, principle_id: String, acknowledging: Array[String]) -> ListedMembers
|
|
70
|
+
# each member, as its principle id and member id, and by principle the count of members no audit has assessed,
|
|
71
|
+
# beside the members acknowledging names, each as its principle id and member id.
|
|
72
|
+
#: (Project, principle_id: String, acknowledging: Array[[String, String]]) -> ListedMembers
|
|
73
73
|
def listed(project, principle_id:, acknowledging:)
|
|
74
74
|
report = ProblemReport.for(project, @principle_id)
|
|
75
75
|
ListedMembers.new(listed: report.checked.fetch("members").map { it.values_at("principle", "id") },
|
|
@@ -5,12 +5,12 @@ module Principles
|
|
|
5
5
|
# The domain logic, and the mediation of persistence. models/CLAUDE.md owns the boundary.
|
|
6
6
|
module Models
|
|
7
7
|
# The members a member's own list-member-problems check lists now, beside those one answer acknowledges: the check
|
|
8
|
-
# exits 3 until that answer's record is committed, and lists none then only if it acknowledges every one
|
|
8
|
+
# exits 3 until that answer's record is committed, and lists none then only if it acknowledges every one.
|
|
9
9
|
class ListedMembers
|
|
10
|
-
# listed is each member the check lists, as its principle id and member id; acknowledging is
|
|
11
|
-
#
|
|
12
|
-
# assessed, which the check counts and no acknowledgement clears
|
|
13
|
-
#: (listed: Array[[String, String]], principle_id: String, acknowledging: Array[String],
|
|
10
|
+
# listed is each member the check lists, as its principle id and member id; acknowledging is each member the
|
|
11
|
+
# answer acknowledges, the same way, across every principle it answers for; never_assessed counts, by
|
|
12
|
+
# principle, the members no audit has assessed, which the check counts and no acknowledgement clears.
|
|
13
|
+
#: (listed: Array[[String, String]], principle_id: String, acknowledging: Array[[String, String]],
|
|
14
14
|
#| ?never_assessed: Hash[String, Integer]) -> void
|
|
15
15
|
def initialize(listed:, principle_id:, acknowledging:, never_assessed: {})
|
|
16
16
|
@listed = listed
|
|
@@ -29,10 +29,8 @@ module Principles
|
|
|
29
29
|
# members no audit has assessed, by count.
|
|
30
30
|
#: () -> Array[String]
|
|
31
31
|
def unacknowledged
|
|
32
|
-
listed = @listed.
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
id unless @acknowledging.include?(id)
|
|
32
|
+
listed = (@listed - @acknowledging).map do |principle, id|
|
|
33
|
+
principle == @principle_id ? id : "#{id} of #{principle}"
|
|
36
34
|
end
|
|
37
35
|
listed + @never_assessed.map { |principle, count| never_assessed(principle, count) }
|
|
38
36
|
end
|
|
@@ -6,11 +6,10 @@ require_relative "member_loads"
|
|
|
6
6
|
module Principles
|
|
7
7
|
# The domain logic, and the mediation of persistence. models/CLAUDE.md owns the boundary.
|
|
8
8
|
module Models
|
|
9
|
-
# The files a principle's members load, each once however many of its members it holds, since every member's
|
|
10
|
-
#
|
|
11
|
-
#
|
|
12
|
-
#
|
|
13
|
-
# size and is not totalled.
|
|
9
|
+
# The files a principle's members load, each once however many of its members it holds, since every member's loads
|
|
10
|
+
# gives its whole file's size and summing members counts a shared file once per member. Only session start loads
|
|
11
|
+
# its files together, so only those are totalled; a file that loads on files, on invocation or on delegation loads
|
|
12
|
+
# apart from the rest. A file that cannot be read has no size and is not totalled.
|
|
14
13
|
class LoadedFiles
|
|
15
14
|
# The files members load, each read whole once, as files hold it.
|
|
16
15
|
#: (Data::ProjectFiles, PrincipleMembers, hooks: HookCommands) -> LoadedFiles
|
|
@@ -9,10 +9,10 @@ module Principles
|
|
|
9
9
|
# The domain logic, and the mediation of persistence. models/CLAUDE.md owns the boundary.
|
|
10
10
|
module Models
|
|
11
11
|
# One decision in an assessment's loading_decisions on a member the audit listed to check against the
|
|
12
|
-
# activation
|
|
12
|
+
# activation. Whether the member should load as it does is the agent's judgement; this tool checks the
|
|
13
13
|
# decision's shape.
|
|
14
14
|
class LoadingDecision
|
|
15
|
-
# The reason start-audit --as template prints in each decision, which left as printed is not given
|
|
15
|
+
# The reason start-audit --as template prints in each decision, which left as printed is not given.
|
|
16
16
|
PLACEHOLDERS = TemplatePlaceholders.new(
|
|
17
17
|
{ "reason" => "One line saying why the member loads as it does" }
|
|
18
18
|
) #: TemplatePlaceholders
|
|
@@ -42,7 +42,7 @@ module Principles
|
|
|
42
42
|
private
|
|
43
43
|
|
|
44
44
|
# Refuses the decision unless it is accepted with a one-line reason, or kept on a member row whose loading
|
|
45
|
-
# the last audit accepted and is unchanged since, so its reason still holds
|
|
45
|
+
# the last audit accepted and is unchanged since, so its reason still holds.
|
|
46
46
|
#: (Hash[String, untyped]) -> void
|
|
47
47
|
def check(row)
|
|
48
48
|
return if @decision["decision"] == "accepted" && AnswerText.new(@decision["reason"]).written?
|
|
@@ -8,7 +8,7 @@ module Principles
|
|
|
8
8
|
module Models
|
|
9
9
|
# What a member's loads say about when it loads and what, at any depth, without the file's or the member's size.
|
|
10
10
|
# A file's size moves with every edit elsewhere in a shared file, so a judgement weighed on a member's loading
|
|
11
|
-
# compares these facts, not the sizes
|
|
11
|
+
# compares these facts, not the sizes.
|
|
12
12
|
class LoadingFacts
|
|
13
13
|
# loads is a member's loads as MemberLoads#to_h gives them, or as a record keeps them.
|
|
14
14
|
#: (Hash[String, untyped]) -> void
|
|
@@ -11,7 +11,7 @@ module Principles
|
|
|
11
11
|
# The domain logic, and the mediation of persistence. models/CLAUDE.md owns the boundary.
|
|
12
12
|
module Models
|
|
13
13
|
# The members a full audit lists for the agent to weigh against the principle's activation, each with the
|
|
14
|
-
# facts that put it there
|
|
14
|
+
# facts that put it there. It lists by fact and compares no globs, so
|
|
15
15
|
# whether a member loads outside the activation is the agent's judgement.
|
|
16
16
|
class LoadsToCheck
|
|
17
17
|
# activation is the map's, or nil when none is declared; loads is each member's MemberLoads by id; accepted
|
|
@@ -7,7 +7,7 @@ module Principles
|
|
|
7
7
|
# The domain logic, which loads and saves itself through data/. models/CLAUDE.md owns the boundary.
|
|
8
8
|
module Models
|
|
9
9
|
# The text a locator found now: its file, the lines it spans and the hash of what it says. A Locator says where
|
|
10
|
-
# to look; this is what was found there, as Project#locate finds it
|
|
10
|
+
# to look; this is what was found there, as Project#locate finds it.
|
|
11
11
|
class LocatedText
|
|
12
12
|
# The text found, from what Project#locate gives.
|
|
13
13
|
#: (Hash[String, untyped]) -> LocatedText
|
|
@@ -63,7 +63,7 @@ module Principles
|
|
|
63
63
|
|
|
64
64
|
# Whether principles is set up: the meta-principle's map names a keeping place, a member of any kind. That says
|
|
65
65
|
# a place is named, not that the principle is held, which its audit finds. A map this version cannot read, in a
|
|
66
|
-
# newer format, unparseable or invalid, counts, since it may well have members, so no read refuses over it
|
|
66
|
+
# newer format, unparseable or invalid, counts, since it may well have members, so no read refuses over it.
|
|
67
67
|
#: () -> bool
|
|
68
68
|
def set_up?
|
|
69
69
|
return false unless mapped?(MetaPrinciple::ID)
|
|
@@ -144,7 +144,7 @@ module Principles
|
|
|
144
144
|
@files.relative(id)
|
|
145
145
|
end
|
|
146
146
|
|
|
147
|
-
# The file map id was kept in under the folder's earlier name, relative to the project
|
|
147
|
+
# The file map id was kept in under the folder's earlier name, relative to the project.
|
|
148
148
|
#: (String) -> String
|
|
149
149
|
def earlier_file(id)
|
|
150
150
|
@files.earlier_relative(id)
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
|
|
4
4
|
require_relative "../error"
|
|
5
5
|
require_relative "locator"
|
|
6
|
+
require_relative "meta_principle"
|
|
7
|
+
require_relative "report_hooks"
|
|
6
8
|
|
|
7
9
|
module Principles
|
|
8
10
|
# The domain logic, which loads and saves itself through data/. models/CLAUDE.md owns the boundary.
|
|
@@ -36,7 +38,7 @@ module Principles
|
|
|
36
38
|
|
|
37
39
|
# fields is copied and frozen, so no caller changes a member through the hash it was built from or handed;
|
|
38
40
|
# the copy is shallow, so its strings are the caller's. Principle builds its members from strings it has
|
|
39
|
-
# copied and frozen, so a member in a map shares nothing
|
|
41
|
+
# copied and frozen, so a member in a map shares nothing.
|
|
40
42
|
#: (Hash[String, untyped]) -> void
|
|
41
43
|
def initialize(fields)
|
|
42
44
|
@fields = fields.dup.freeze #: Hash[String, untyped]
|
|
@@ -87,19 +89,29 @@ module Principles
|
|
|
87
89
|
end
|
|
88
90
|
|
|
89
91
|
# Whether it is its whole file, which no locator but its path narrows, so it holds all the text of every
|
|
90
|
-
# line it spans
|
|
92
|
+
# line it spans.
|
|
91
93
|
#: () -> bool
|
|
92
94
|
def whole_file?
|
|
93
95
|
(LOCATORS - ["path"]).none? { |locator| @fields.key?(locator) }
|
|
94
96
|
end
|
|
95
97
|
|
|
98
|
+
# Whether its change since a commit reads as the history of its own lines: it is part of its file, and paths,
|
|
99
|
+
# its file's path then and now, are one path.
|
|
100
|
+
#: (Array[String]) -> bool
|
|
101
|
+
def traced_by_lines?(paths) = !whole_file? && paths.one?
|
|
102
|
+
|
|
103
|
+
# The lines its change since a commit reads by: lines_now, the first_line and last_line it spans now, when
|
|
104
|
+
# traced_by_lines? says so over paths; else nil, and the change reads as its file's diff.
|
|
105
|
+
#: (Array[String], Hash[String, Integer]) -> Hash[String, Integer]?
|
|
106
|
+
def traced_lines(paths, lines_now) = (lines_now if traced_by_lines?(paths))
|
|
107
|
+
|
|
96
108
|
# What the member does for its principle, as the map states it.
|
|
97
109
|
#: () -> String?
|
|
98
110
|
def role
|
|
99
111
|
@fields["role"]
|
|
100
112
|
end
|
|
101
113
|
|
|
102
|
-
# The command that enforces the member, which an audit asks the agent to run
|
|
114
|
+
# The command that enforces the member, which an audit asks the agent to run; nil when it has none.
|
|
103
115
|
#: () -> String?
|
|
104
116
|
def check
|
|
105
117
|
@fields["check"]
|
|
@@ -108,7 +120,7 @@ module Principles
|
|
|
108
120
|
# Each invisible formatting or direction-changing character, or line separator, the member's check
|
|
109
121
|
# holds, in order, as its code point, its name when HIDDEN_CHARACTER_NAMES has it, and its position
|
|
110
122
|
# counted in characters from 1; none when it has no check. This tool prints such characters escaped, and
|
|
111
|
-
# naming them helps a reviewer who scans the command quickly
|
|
123
|
+
# naming them helps a reviewer who scans the command quickly.
|
|
112
124
|
#: () -> Array[String]
|
|
113
125
|
def check_hidden_characters
|
|
114
126
|
check.to_s.each_char.with_index(1).filter_map do |character, position|
|
|
@@ -131,6 +143,21 @@ module Principles
|
|
|
131
143
|
#: () -> Locator
|
|
132
144
|
def locator = Locator.new(reference)
|
|
133
145
|
|
|
146
|
+
# Which part of principles an upgrade can change this member is: "hook", the plugin's file at the path
|
|
147
|
+
# MetaPrinciple names, or a hooks or settings file whose hooks run the session-start command, whole or a part
|
|
148
|
+
# whose own text, which the block gives only then, runs it too; "skill", the plugin's file at the path
|
|
149
|
+
# MetaPrinciple names; or "passage", a section under the heading setup maps; nil for any other member.
|
|
150
|
+
#: (HookCommands) { () -> String } -> String?
|
|
151
|
+
def package_part(hooks, &)
|
|
152
|
+
return "passage" if @fields["section"] == MetaPrinciple::PASSAGE_HEADING
|
|
153
|
+
|
|
154
|
+
start = ReportHooks::SESSION_START.command
|
|
155
|
+
return ("hook" if hooks.passage_runs?(path, start, &)) unless whole_file?
|
|
156
|
+
return "hook" if path == MetaPrinciple::HOOK_PATH || hooks.runs?(path, start)
|
|
157
|
+
|
|
158
|
+
"skill" if path == MetaPrinciple::SKILL_PATH
|
|
159
|
+
end
|
|
160
|
+
|
|
134
161
|
# This member, still known by key once it has moved. The key is stored only while it differs from the
|
|
135
162
|
# member's id, so a member moved back to where it began has the bytes it had.
|
|
136
163
|
#: (String) -> Member
|
|
@@ -20,17 +20,17 @@ module Principles
|
|
|
20
20
|
module Models
|
|
21
21
|
# The member_assessments of an assessment answer: one for each mapped member, each with an assessment, a delivery,
|
|
22
22
|
# an observation when delivery is observed, evidence that resolves, and the result of the member's check when it
|
|
23
|
-
# has one
|
|
23
|
+
# has one.
|
|
24
24
|
class MemberAssessments
|
|
25
25
|
# What a record entry keeps for a member carried forward, until completion puts back its last assessment.
|
|
26
26
|
CARRIED = { "carried_forward" => true }.freeze #: Hash[String, untyped]
|
|
27
27
|
|
|
28
28
|
# The text a fresh member's template prints in its assessment, which an answer may not send back unchanged, as a
|
|
29
|
-
# correction may not send back its own
|
|
29
|
+
# correction may not send back its own.
|
|
30
30
|
PLACEHOLDER = "Your assessment, including its context cost" #: String
|
|
31
31
|
|
|
32
32
|
# The text the template printed alone gives a sighting's fields beside delivery, each left as printed when the
|
|
33
|
-
# delivery gives none
|
|
33
|
+
# delivery gives none.
|
|
34
34
|
SIGHTING = TemplatePlaceholders.new(
|
|
35
35
|
{ "observation" => "Only with delivery observed: what you saw the member do, where, and what you did not see",
|
|
36
36
|
"observed_at" => "Only for a sighting before this audit: when, in UTC, or a dated record's date " \
|
|
@@ -40,8 +40,8 @@ module Principles
|
|
|
40
40
|
# assessments is the answer's member_assessments; members are the mapped members, with each checked one's
|
|
41
41
|
# check; fields checks each field and locates each piece of evidence; judged_against is the principle's record
|
|
42
42
|
# as it stands, which says which members' last assessments may be carried forward, marked {"member_id",
|
|
43
|
-
# "carried_forward": true}
|
|
44
|
-
# the answer came, which no sighting it reports is after
|
|
43
|
+
# "carried_forward": true}, and which command it ran for each member's check; answered_at is when
|
|
44
|
+
# the answer came, which no sighting it reports is after.
|
|
45
45
|
#: (untyped, PrincipleMembers, fields: AnswerFields, answered_at: String, ?judged_against: RecordJudgedAgainst?)
|
|
46
46
|
#| -> void
|
|
47
47
|
def initialize(assessments, members, fields:, answered_at:, judged_against: nil)
|
|
@@ -73,7 +73,7 @@ module Principles
|
|
|
73
73
|
end
|
|
74
74
|
|
|
75
75
|
# Each member's assessment by id, as its record entry keeps it: what the agent said, and the hash of each piece
|
|
76
|
-
# of evidence it cited, which the block locates, so the next audit can say whether that evidence changed
|
|
76
|
+
# of evidence it cited, which the block locates, so the next audit can say whether that evidence changed.
|
|
77
77
|
#: () { (Locator) -> Hash[String, untyped] } -> Hash[String, Hash[String, untyped]]
|
|
78
78
|
def kept(&locate)
|
|
79
79
|
@assessments.to_h do |assessment|
|
|
@@ -89,8 +89,8 @@ module Principles
|
|
|
89
89
|
|
|
90
90
|
private
|
|
91
91
|
|
|
92
|
-
# assessments without the sighting fields each leaves as printed, which it does not give
|
|
93
|
-
# observed_at given with an offset read in audited_at's form
|
|
92
|
+
# assessments without the sighting fields each leaves as printed, which it does not give, each
|
|
93
|
+
# observed_at given with an offset read in audited_at's form.
|
|
94
94
|
#: (untyped) -> untyped
|
|
95
95
|
def given(assessments)
|
|
96
96
|
return assessments unless assessments.is_a?(Array)
|
|
@@ -9,7 +9,7 @@ module Principles
|
|
|
9
9
|
module Models
|
|
10
10
|
# A member of another principle's map whose text shares a line with one located member: its principle, id,
|
|
11
11
|
# role there and lines, and how its lines stand to the located member's: the same lines, all of them, within
|
|
12
|
-
# them, or none of these, for a partial overlap
|
|
12
|
+
# them, or none of these, for a partial overlap. These are lines, not text, so what an
|
|
13
13
|
# edit reaches is left to the agent.
|
|
14
14
|
class MemberElsewhere
|
|
15
15
|
# member is the other map's member, whose id and role are printed; span is its lines now.
|
|
@@ -24,7 +24,7 @@ module Principles
|
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
# Whether the agent should check the text where the lines meet before deciding which edit reaches which
|
|
27
|
-
# member: one holds the other's lines, and the one holding them is not a whole file
|
|
27
|
+
# member: one holds the other's lines, and the one holding them is not a whole file.
|
|
28
28
|
#: () -> bool
|
|
29
29
|
def text_check_needed? = @text_check_needed
|
|
30
30
|
|
|
@@ -32,12 +32,12 @@ module Principles
|
|
|
32
32
|
#: String
|
|
33
33
|
attr_reader :principle_id
|
|
34
34
|
|
|
35
|
-
# The findings among left_open, its principle's open findings, that name it
|
|
35
|
+
# The findings among left_open, its principle's open findings, that name it.
|
|
36
36
|
#: (Array[OpenFinding]) -> Array[OpenFinding]
|
|
37
37
|
def open_among(left_open) = left_open.select { |finding| finding.on?(@member.key) }
|
|
38
38
|
|
|
39
39
|
# Its entry, naming by id the findings among left_open that name it, which the request lists once, so the same
|
|
40
|
-
# problem is not raised again in another principle's audit
|
|
40
|
+
# problem is not raised again in another principle's audit; as to_h when none do.
|
|
41
41
|
#: (Array[OpenFinding]) -> Hash[String, untyped]
|
|
42
42
|
def naming(left_open)
|
|
43
43
|
on_it = open_among(left_open)
|
|
@@ -16,12 +16,12 @@ module Principles
|
|
|
16
16
|
# a member names; passage anchors then narrow it the same way in every type.
|
|
17
17
|
class MemberFile
|
|
18
18
|
# The refusals, raised here and by the file types, that say a member's reference finds nothing in a file's
|
|
19
|
-
# text, rather than that the reference itself is wrong. Add a new one here when it raises one
|
|
19
|
+
# text, rather than that the reference itself is wrong. Add a new one here when it raises one.
|
|
20
20
|
PLACEMENT_REFUSALS = %w[section_not_found ambiguous_heading passage_not_found ambiguous_passage
|
|
21
21
|
passage_end_not_found section_needs_markdown query_needs_frontmatter field_not_found
|
|
22
22
|
unsupported_frontmatter duplicate_frontmatter_key].freeze
|
|
23
23
|
# The placement refusals of a quote the text does not hold, which a pointer that is not a member may also
|
|
24
|
-
# repair by pointing at other text
|
|
24
|
+
# repair by pointing at other text.
|
|
25
25
|
QUOTE_NOT_FOUND = %w[passage_not_found passage_end_not_found].freeze #: Array[String]
|
|
26
26
|
# The placement refusals that mean a member's place in its file is gone: its heading, passage anchor or
|
|
27
27
|
# frontmatter field no longer matches, so it is lost there, not changed and not unreadable.
|
|
@@ -78,7 +78,7 @@ module Principles
|
|
|
78
78
|
found
|
|
79
79
|
end
|
|
80
80
|
|
|
81
|
-
# The lines of the region locator names, as the agent reads them
|
|
81
|
+
# The lines of the region locator names, as the agent reads them.
|
|
82
82
|
#: (Locator) -> Array[String]
|
|
83
83
|
def lines_of(locator)
|
|
84
84
|
located = locate(locator)
|
|
@@ -86,7 +86,7 @@ module Principles
|
|
|
86
86
|
end
|
|
87
87
|
|
|
88
88
|
# The opening of the region locator names, after the heading line itself when it names a heading, as
|
|
89
|
-
# WriteUpOpening finds it; nil when there is none. This tool does not judge what it says
|
|
89
|
+
# WriteUpOpening finds it; nil when there is none. This tool does not judge what it says.
|
|
90
90
|
#: (Locator) -> Hash[String, untyped]?
|
|
91
91
|
def write_up_opening(locator)
|
|
92
92
|
located = locate(locator)
|
|
@@ -11,7 +11,7 @@ module Principles
|
|
|
11
11
|
module Models
|
|
12
12
|
# The facts beside each member's own text that its assessment was judged on: its map entry, which holds its path,
|
|
13
13
|
# locator, role and check, and when it loads, without the sizes an edit elsewhere in its file moves. A full audit
|
|
14
|
-
# keeps a digest of each with the assessment, and carries the assessment forward only while both match
|
|
14
|
+
# keeps a digest of each with the assessment, and carries the assessment forward only while both match.
|
|
15
15
|
class MemberGrounds
|
|
16
16
|
# members are the map's members; loads is each member's MemberLoads by id.
|
|
17
17
|
#: (PrincipleMembers, Hash[String, MemberLoads]) -> void
|
|
@@ -7,7 +7,7 @@ module Principles
|
|
|
7
7
|
# The domain logic, which loads and saves itself through data/. models/CLAUDE.md owns the boundary.
|
|
8
8
|
module Models
|
|
9
9
|
# The member hashes an audit record holds, read from a record a later copy wrote that this copy's schema refuses,
|
|
10
|
-
# for list-member-problems to compare its members with, read-only
|
|
10
|
+
# for list-member-problems to compare its members with, read-only. Only those fields are read, each entry
|
|
11
11
|
# kept only when its hash is text, so nothing else of a shape this copy does not know travels; a member left out
|
|
12
12
|
# is compared with the commit that mapped it instead.
|
|
13
13
|
class MemberHashesAsWritten
|