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
|
@@ -15,7 +15,7 @@ module Principles
|
|
|
15
15
|
module Models
|
|
16
16
|
# One principle's member mappings, newest first: each key's run ends where a selected map no longer holds it.
|
|
17
17
|
# Supplied certified mapping history selects earlier IDs and refuses unprovable reads. The legacy direct-ID
|
|
18
|
-
# walk stops at unreadable maps, which can only hide an older change
|
|
18
|
+
# walk stops at unreadable maps, which can only hide an older change.
|
|
19
19
|
class PrincipleHistory
|
|
20
20
|
#: (id: String, history: ProjectHistory, principles: MappedPrinciples, ?mapping: PrincipleMappingHistory?) -> void
|
|
21
21
|
def initialize(id:, history:, principles:, mapping: nil)
|
|
@@ -67,7 +67,7 @@ module Principles
|
|
|
67
67
|
end
|
|
68
68
|
|
|
69
69
|
# The commits that changed member's own text since baseline, walking the commits that touched this map or
|
|
70
|
-
# any file it has placed the member in, so a move to a renamed file keeps its earlier edits
|
|
70
|
+
# any file it has placed the member in, so a move to a renamed file keeps its earlier edits.
|
|
71
71
|
#: (Member, baseline: String, now: String) -> Hash[String, untyped]
|
|
72
72
|
def member_history(member, baseline:, now:)
|
|
73
73
|
key = member.key
|
|
@@ -80,7 +80,7 @@ module Principles
|
|
|
80
80
|
end
|
|
81
81
|
|
|
82
82
|
# The map as commit holds it, such as the one an audit began from, refused as MappedPrinciples refuses its text;
|
|
83
|
-
# a commit before the folder took its name now holds it under the earlier name
|
|
83
|
+
# a commit before the folder took its name now holds it under the earlier name, and a commit that lacks
|
|
84
84
|
# the map under both gives empty text, which is refused as unparseable in the legacy path. A supplied
|
|
85
85
|
# mapping history owns strict earlier-ID selection and its refusal outside the proven interval.
|
|
86
86
|
#: (String) -> Principle
|
|
@@ -93,7 +93,7 @@ module Principles
|
|
|
93
93
|
end
|
|
94
94
|
|
|
95
95
|
# Whether a full audit of this principle can have started from HEAD, so a correction may be open: in git,
|
|
96
|
-
# start-audit refuses a map that is not committed or has no member
|
|
96
|
+
# start-audit refuses a map that is not committed or has no member. False outside git, or when HEAD
|
|
97
97
|
# holds no map it can read.
|
|
98
98
|
#: () -> bool
|
|
99
99
|
def startable_at_head?
|
|
@@ -106,7 +106,7 @@ module Principles
|
|
|
106
106
|
end
|
|
107
107
|
|
|
108
108
|
# Whether an add-member to map, as it stands before the member joins, is the first since the map was last
|
|
109
|
-
# committed, which add-member's reminders print on
|
|
109
|
+
# committed, which add-member's reminders print on: map has no member, or, in git, its file is as HEAD
|
|
110
110
|
# holds it. Outside git, only with the first member.
|
|
111
111
|
#: (Principle) -> bool
|
|
112
112
|
def first_add_since_commit?(map)
|
|
@@ -117,7 +117,7 @@ module Principles
|
|
|
117
117
|
end
|
|
118
118
|
|
|
119
119
|
# The member's fields as the map at commit placed it, found by key; nil where that map did not hold it or cannot
|
|
120
|
-
# be read, so a one-member audit reads a moved member where it was at its baseline
|
|
120
|
+
# be read, so a one-member audit reads a moved member where it was at its baseline.
|
|
121
121
|
#: (String, String) -> Hash[String, untyped]?
|
|
122
122
|
def placed_at(commit, key)
|
|
123
123
|
members_at(commit)&.fetch(key, nil)
|
|
@@ -125,7 +125,7 @@ module Principles
|
|
|
125
125
|
|
|
126
126
|
# Where the member with key may be read at since and at each later commit that touched its map or a file the
|
|
127
127
|
# map has placed it in, oldest first: as each commit's map placed it, then as now_at, its entry now, places it.
|
|
128
|
-
# Lazy, so a search for the baseline reads no further than the commit that holds it
|
|
128
|
+
# Lazy, so a search for the baseline reads no further than the commit that holds it.
|
|
129
129
|
#: (String, String, Hash[String, untyped]) -> Enumerator::Lazy[Placement]
|
|
130
130
|
def placements_since(since, key, now_at)
|
|
131
131
|
paths = [*paths_of(Member.new(now_at)), *map_paths]
|
|
@@ -134,7 +134,7 @@ module Principles
|
|
|
134
134
|
end
|
|
135
135
|
|
|
136
136
|
# The paths a change to the member with key from commit to now_at, its entry now, spans: as commit's map placed
|
|
137
|
-
# it, or as now_at does where that map did not hold it, then its path now
|
|
137
|
+
# it, or as now_at does where that map did not hold it, then its path now.
|
|
138
138
|
#: (String, String, Hash[String, untyped]) -> Array[String]
|
|
139
139
|
def paths_from(commit, key, now_at)
|
|
140
140
|
placements_at(commit, key, now_at).fetch(0).paths_to(Member.new(now_at).path)
|
|
@@ -50,6 +50,13 @@ module Principles
|
|
|
50
50
|
#: () -> Hash[String, Member]
|
|
51
51
|
def by_id = @list.to_h { |member| [member.id, member] }
|
|
52
52
|
|
|
53
|
+
# Each part of principles an upgrade can change that a member is, as Member#package_part names it from the
|
|
54
|
+
# project's hooks and, when it asks, the text of a member the block gives, once.
|
|
55
|
+
#: (HookCommands) { (Member) -> String } -> Array[String]
|
|
56
|
+
def package_parts(hooks, &text_of)
|
|
57
|
+
@list.filter_map { |member| member.package_part(hooks) { text_of.call(member) } }.uniq
|
|
58
|
+
end
|
|
59
|
+
|
|
53
60
|
# Each file a member is in, once, in the map's order.
|
|
54
61
|
#: () -> Array[String]
|
|
55
62
|
def paths = @list.map(&:path).uniq
|
|
@@ -59,7 +66,7 @@ module Principles
|
|
|
59
66
|
def in_files(paths) = @list.select { |member| paths.include?(member.path) }
|
|
60
67
|
|
|
61
68
|
# Each member in one of paths, by its id and path, as show-meta-principle-passage reports the members already in
|
|
62
|
-
# an entry file, which the agent judges against the passage
|
|
69
|
+
# an entry file, which the agent judges against the passage.
|
|
63
70
|
#: (Array[String]) -> Array[Hash[String, String]]
|
|
64
71
|
def members_in(paths)
|
|
65
72
|
in_files(paths).map { |member| { "id" => member.id, "path" => member.path } }
|
|
@@ -81,15 +88,15 @@ module Principles
|
|
|
81
88
|
#: (String) -> Member?
|
|
82
89
|
def with_key(key) = @list.find { |member| member.key == key }
|
|
83
90
|
|
|
84
|
-
# The check of the member with member_id, or nil when it has none or no member has that id
|
|
91
|
+
# The check of the member with member_id, or nil when it has none or no member has that id.
|
|
85
92
|
#: (untyped) -> String?
|
|
86
93
|
def check(member_id) = with_id(member_id)&.check
|
|
87
94
|
|
|
88
|
-
# The id of each member that names a check, in the map's order
|
|
95
|
+
# The id of each member that names a check, in the map's order.
|
|
89
96
|
#: () -> Array[String]
|
|
90
97
|
def checked_ids = @list.select(&:check).map(&:id)
|
|
91
98
|
|
|
92
|
-
# Whether a member has member_id and names no check, so its assessment takes no check_result
|
|
99
|
+
# Whether a member has member_id and names no check, so its assessment takes no check_result.
|
|
93
100
|
#: (untyped) -> bool
|
|
94
101
|
def unchecked?(member_id)
|
|
95
102
|
member = with_id(member_id)
|
|
@@ -135,7 +142,7 @@ module Principles
|
|
|
135
142
|
end
|
|
136
143
|
|
|
137
144
|
# The refusal for an id no member has now, naming the member that had it before it moved, since a member keeps
|
|
138
|
-
# its id from before its first move as its key
|
|
145
|
+
# its id from before its first move as its key. A member moved twice is not found by its middle id.
|
|
139
146
|
#: (String) -> Error
|
|
140
147
|
def unknown(member_id)
|
|
141
148
|
ids = "To see each member's id: #{Error::EXECUTABLE} show-principle #{@principle_id}"
|
|
@@ -149,7 +156,7 @@ module Principles
|
|
|
149
156
|
|
|
150
157
|
# The refusal for an id no member has or had, naming the one mapped id it is spelled like apart from case and
|
|
151
158
|
# punctuation, if any, under did_you_mean, so the controller can print the command again with it. The near miss
|
|
152
|
-
# itself is never accepted
|
|
159
|
+
# itself is never accepted.
|
|
153
160
|
#: (String, String) -> Error
|
|
154
161
|
def misspelt(member_id, ids)
|
|
155
162
|
unknown = "#{member_id} is not a member of #{@principle_id}"
|
|
@@ -180,7 +187,7 @@ module Principles
|
|
|
180
187
|
"then commit it.", file)
|
|
181
188
|
end
|
|
182
189
|
|
|
183
|
-
# Two members with ids of their own known by one key
|
|
190
|
+
# Two members with ids of their own known by one key: which keeps it decides which keeps the audit filed
|
|
184
191
|
# under it, so the repair leaves that to the agent.
|
|
185
192
|
#: (String, String) -> void
|
|
186
193
|
def refuse_repeated_keys(where, file)
|
|
@@ -10,7 +10,7 @@ module Principles
|
|
|
10
10
|
# Whether a project's maps and records have moved from .memeplex, the folder's earlier name, to .principles.
|
|
11
11
|
# Reading the new folder alone would show an unmoved project as unmapped, so every command that reads either
|
|
12
12
|
# refuses until the folder moves, or until one of two folders holding them is removed. A file an older version
|
|
13
|
-
# left in .memeplex beside no maps or records does not count
|
|
13
|
+
# left in .memeplex beside no maps or records does not count.
|
|
14
14
|
class PrinciplesFolderMove
|
|
15
15
|
FOLDER = Data::PrinciplesSubfolder::FOLDER #: String
|
|
16
16
|
EARLIER = Data::PrinciplesSubfolder::EARLIER_FOLDER #: String
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# typed: strict
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
module Principles
|
|
5
|
+
# The domain logic, and the mediation of persistence. models/CLAUDE.md owns the boundary.
|
|
6
|
+
module Models
|
|
7
|
+
# Another principles earlier on PATH than the plugin's own, which a bare principles command runs in place of it:
|
|
8
|
+
# its path, the version it prints and which of the commands it was asked about it does not run.
|
|
9
|
+
class PrinciplesOnPath
|
|
10
|
+
#: String
|
|
11
|
+
attr_reader :path, :version
|
|
12
|
+
#: Array[String]
|
|
13
|
+
attr_reader :lacking
|
|
14
|
+
|
|
15
|
+
#: (String, String, ?lacking: Array[String]) -> void
|
|
16
|
+
def initialize(path, version, lacking: [])
|
|
17
|
+
@path = path
|
|
18
|
+
@version = version
|
|
19
|
+
@lacking = lacking.freeze #: Array[String]
|
|
20
|
+
freeze
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# Whether it runs another version than running, compared as each prints --version, whole, so a build of the
|
|
24
|
+
# same release from another commit counts as another.
|
|
25
|
+
#: (String) -> bool
|
|
26
|
+
def shadows?(running) = @version != running
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -9,11 +9,11 @@ module Principles
|
|
|
9
9
|
# The release of principles an audit of the meta-principle ran under: its version, and a digest of the passage
|
|
10
10
|
# it proposes for setup, as printed. An upgrade can change the session-start hook, the skill and the passage,
|
|
11
11
|
# none of which a consuming project maps, so the meta-principle's record keeps this and its next audit states
|
|
12
|
-
# what changed since
|
|
12
|
+
# what changed since.
|
|
13
13
|
class PrinciplesPackage
|
|
14
|
-
# The key the passage's digest is kept under. The record keeps its digests by key, as releases
|
|
14
|
+
# The key the passage's digest is kept under. The record keeps its digests by key, as earlier releases kept
|
|
15
15
|
# one for each of two passage forms, so their records stay valid; neither form's key is this one, so a record
|
|
16
|
-
# one of them wrote reads as a passage change once, at the next audit
|
|
16
|
+
# one of them wrote reads as a passage change once, at the next audit.
|
|
17
17
|
PASSAGE = "entry_file_passage"
|
|
18
18
|
|
|
19
19
|
# The release running now, from its version and the passage's text.
|
|
@@ -8,21 +8,21 @@ module Principles
|
|
|
8
8
|
module Models
|
|
9
9
|
# The fields a decision on a prior finding may give, as start-audit --as template prints them to fill: each with
|
|
10
10
|
# a placeholder saying which decisions take it, so the agent fills those its decision takes and leaves the rest
|
|
11
|
-
# as printed, which is not giving them
|
|
12
|
-
# list instead, which is not given either
|
|
11
|
+
# as printed, which is not giving them. A marked finding's decision may start problem_evidence as an empty
|
|
12
|
+
# list instead, which is not given either.
|
|
13
13
|
module PriorDecisionFields
|
|
14
|
-
# The decision's placeholder, naming what it may be
|
|
15
|
-
# one refusal for every judgement left as printed
|
|
14
|
+
# The decision's placeholder, naming what it may be; one sent back is no decision, named in the answer's
|
|
15
|
+
# one refusal for every judgement left as printed.
|
|
16
16
|
DECISION = "still_holds, resolved, withdrawn or raised_again" #: String
|
|
17
17
|
# The fields that take pointers, which the answer's schema lets be text only for their placeholders.
|
|
18
18
|
POINTERS = %w[evidence recorded_at problem_evidence].freeze #: Array[String]
|
|
19
19
|
# raised_in's placeholder, in plain words, since the answer's schema accepts it as the one alternative to a full
|
|
20
|
-
# sha, the only value that reaches git
|
|
20
|
+
# sha, the only value that reaches git.
|
|
21
21
|
RAISED_IN = "With first_raised_at: its record's commit, full sha; else leave" #: String
|
|
22
22
|
# The placeholder printed in each field a decision may give: only which decision takes it, and what, since that
|
|
23
23
|
# a field left as printed is not given is stated once, at the template's head, and each finding printed every
|
|
24
|
-
# field's whole help
|
|
25
|
-
# has, "else leave" where it gives nothing
|
|
24
|
+
# field's whole help. Each says what to do otherwise: "else kept" where omission keeps what the finding
|
|
25
|
+
# has, "else leave" where it gives nothing. action's says instead that it is a change, which only
|
|
26
26
|
# still_holds may make, since naming the decision read as a request to restate the action (dogfood D6).
|
|
27
27
|
PLACEHOLDERS = TemplatePlaceholders.new(
|
|
28
28
|
{
|
|
@@ -30,7 +30,7 @@ module Principles
|
|
|
30
30
|
"as" => "raised_again: the new finding's id; else leave",
|
|
31
31
|
"evidence" => [{ "path" => "resolved: where the fix shows, with heading; else leave" }],
|
|
32
32
|
"action" => "to change it: deferred or accepted; else kept",
|
|
33
|
-
"recorded_at" => "still_holds: a
|
|
33
|
+
"recorded_at" => "still_holds: a new pointer; null drops it; else kept",
|
|
34
34
|
"waits_on" => "deferral: whom it waits on, for what, or null; else kept",
|
|
35
35
|
"problem" => "still_holds: restated if renamed or moved; else kept",
|
|
36
36
|
"problem_evidence" => [{ "path" => "still_holds: where it shows, with heading, if not kept; else leave",
|
|
@@ -15,7 +15,7 @@ require_relative "waits_on"
|
|
|
15
15
|
module Principles
|
|
16
16
|
# The domain logic, and the mediation of persistence. models/CLAUDE.md owns the boundary.
|
|
17
17
|
module Models
|
|
18
|
-
# One decision on a prior finding the request listed
|
|
18
|
+
# One decision on a prior finding the request listed, checked against that finding and this audit's
|
|
19
19
|
# new findings. Whether the finding still holds is the agent's judgement; this tool checks the decision's shape.
|
|
20
20
|
class PriorFindingDecision
|
|
21
21
|
KINDS = %w[still_holds resolved withdrawn raised_again].freeze
|
|
@@ -73,18 +73,18 @@ module Principles
|
|
|
73
73
|
|
|
74
74
|
# The finding a still_holds decision keeps, against the map's members now. Its problem_evidence is read with an
|
|
75
75
|
# empty list as none given: the template starts a marked finding's decision with one, which an agent leaves in
|
|
76
|
-
# whatever it decides
|
|
76
|
+
# whatever it decides.
|
|
77
77
|
#: () -> KeptPriorFinding
|
|
78
78
|
def kept = KeptPriorFinding.new(@decision, @finding, @members)
|
|
79
79
|
|
|
80
|
-
# The earlier first_raised_at this decision claims, if any, to check against the record it cites
|
|
80
|
+
# The earlier first_raised_at this decision claims, if any, to check against the record it cites.
|
|
81
81
|
#: () -> FirstRaisedClaim
|
|
82
82
|
def first_raised_claim = FirstRaisedClaim.new(@decision, @finding)
|
|
83
83
|
|
|
84
84
|
private
|
|
85
85
|
|
|
86
86
|
# Refuses text, other than its placeholder, in a field that takes pointers, which the schema lets be text only
|
|
87
|
-
# so the placeholder can be left
|
|
87
|
+
# so the placeholder can be left.
|
|
88
88
|
#: () -> void
|
|
89
89
|
def pointers_as_text
|
|
90
90
|
field = PriorDecisionFields::POINTERS.find { |name| @decision[name].is_a?(String) } or return
|
|
@@ -94,7 +94,7 @@ module Principles
|
|
|
94
94
|
end
|
|
95
95
|
|
|
96
96
|
# A still_holds decision may make its finding deferred or accepted, with a one-line reason, and a deferral
|
|
97
|
-
# says where it is written up, if only as null, as a correction's does
|
|
97
|
+
# says where it is written up, if only as null, as a correction's does.
|
|
98
98
|
#: () -> void
|
|
99
99
|
def new_action
|
|
100
100
|
action = @decision["action"] or return
|
|
@@ -127,7 +127,7 @@ module Principles
|
|
|
127
127
|
"Set recorded_at to where #{@id} is written up, as {\"path\": ..., \"heading\": ...}, or to null.")
|
|
128
128
|
end
|
|
129
129
|
|
|
130
|
-
# The action the finding keeps once decided, or nil when the decision closes it or raises it again
|
|
130
|
+
# The action the finding keeps once decided, or nil when the decision closes it or raises it again.
|
|
131
131
|
#: () -> String?
|
|
132
132
|
def kept_action
|
|
133
133
|
return nil unless @decision["decision"] == "still_holds"
|
|
@@ -142,7 +142,7 @@ module Principles
|
|
|
142
142
|
end
|
|
143
143
|
|
|
144
144
|
# A reason on a still_holds decision that changes no action, which the record has nowhere to keep, so the fact
|
|
145
|
-
# it corrects would stay as it was
|
|
145
|
+
# it corrects would stay as it was.
|
|
146
146
|
#: () -> bot
|
|
147
147
|
def unkept_reason
|
|
148
148
|
invalid("still_holds keeps no reason",
|
|
@@ -162,7 +162,7 @@ module Principles
|
|
|
162
162
|
#: () -> bool
|
|
163
163
|
def raised_as_new? = @new_ids.include?(@decision["as"])
|
|
164
164
|
|
|
165
|
-
# A resolved decision may point at where its fix shows
|
|
165
|
+
# A resolved decision may point at where its fix shows.
|
|
166
166
|
#: (^(Locator) -> void) -> void
|
|
167
167
|
def fix_shown(locate)
|
|
168
168
|
return unless @decision.key?("evidence")
|
|
@@ -10,7 +10,7 @@ module Principles
|
|
|
10
10
|
# The domain logic, and the mediation of persistence. models/CLAUDE.md owns the boundary.
|
|
11
11
|
module Models
|
|
12
12
|
# What the next full audit's decisions, once PriorFindings has checked them, do to each finding the last audit
|
|
13
|
-
# left open
|
|
13
|
+
# left open: the findings kept, as the record keeps them, the ones closed, and, for each new finding that
|
|
14
14
|
# raises a prior one again, when that one was first raised.
|
|
15
15
|
class PriorFindingOutcomes
|
|
16
16
|
# decisions are the checked decisions, each on the finding it decides.
|
|
@@ -12,7 +12,7 @@ module Principles
|
|
|
12
12
|
# The domain logic, and the mediation of persistence. models/CLAUDE.md owns the boundary.
|
|
13
13
|
module Models
|
|
14
14
|
# The findings the last completed audit deferred or accepted, which the next full audit must decide one by
|
|
15
|
-
# one
|
|
15
|
+
# one: each still holds, was resolved, was withdrawn, or is raised again as a new finding. This tool
|
|
16
16
|
# lists them and checks the decisions; whether a finding still holds is the agent's judgement.
|
|
17
17
|
class PriorFindings
|
|
18
18
|
# record is the last audit's record, or nil; members are the map's members now, and now each one's hash.
|
|
@@ -33,7 +33,7 @@ module Principles
|
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
# Each prior finding as the request shows it: as listed, and with a last_audited_commit, each evidence item with
|
|
36
|
-
# what since says of it now against that commit
|
|
36
|
+
# what since says of it now against that commit. The request id digests listed, so these facts never
|
|
37
37
|
# make an answer stale.
|
|
38
38
|
#: () { (EvidenceItem, String) -> Hash[String, bool] } -> Array[Hash[String, untyped]]
|
|
39
39
|
def shown(&since)
|
|
@@ -43,7 +43,7 @@ module Principles
|
|
|
43
43
|
end
|
|
44
44
|
|
|
45
45
|
# The commit the audit that left these findings open, raising or keeping each, was based on: what each evidence
|
|
46
|
-
# item's text is compared at
|
|
46
|
+
# item's text is compared at. nil outside git, or with no record. The record AuditRecord#left_open reads
|
|
47
47
|
# them from gives it, so the two cannot disagree.
|
|
48
48
|
#: () -> String?
|
|
49
49
|
def last_audited_commit = @record&.last_completed&.base_commit
|
|
@@ -56,7 +56,7 @@ module Principles
|
|
|
56
56
|
|
|
57
57
|
# The decisions, checked against the listed findings and this audit's new findings. locate checks that a
|
|
58
58
|
# new recorded_at resolves, as a deferral's is checked; records read the record a claim of an earlier
|
|
59
|
-
# first_raised_at cites
|
|
59
|
+
# first_raised_at cites.
|
|
60
60
|
#: (untyped, Array[untyped], ?records: AuditRecords?) { (Locator) -> void } -> DecidedPriorFindings
|
|
61
61
|
def decided(decisions, findings, records: nil, &locate)
|
|
62
62
|
new_ids = findings.map { |finding| finding.fetch("id") }
|
|
@@ -80,7 +80,7 @@ module Principles
|
|
|
80
80
|
end
|
|
81
81
|
|
|
82
82
|
# Refuses decision unless it is sound for the finding it decides, given this audit's new findings, and any
|
|
83
|
-
# earlier first_raised_at it claims is borne out by the record it cites, which records read
|
|
83
|
+
# earlier first_raised_at it claims is borne out by the record it cites, which records read.
|
|
84
84
|
#: (PriorFindingDecision, ^(Locator) -> void, AuditRecords?) -> void
|
|
85
85
|
def check(decision, locate, records)
|
|
86
86
|
decision.check(locate)
|
|
@@ -22,7 +22,7 @@ module Principles
|
|
|
22
22
|
new(maps, history: project.history)
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
-
# history, when given, lets each missing file carry the rename git detects for it
|
|
25
|
+
# history, when given, lets each missing file carry the rename git detects for it.
|
|
26
26
|
#: (Array[MemberProblems], ?history: ProjectHistory?) -> void
|
|
27
27
|
def initialize(maps, history: nil)
|
|
28
28
|
@maps = maps
|
|
@@ -45,34 +45,44 @@ module Principles
|
|
|
45
45
|
end
|
|
46
46
|
|
|
47
47
|
# The principles that await their first full audit, in map order, which list-member-problems names in one
|
|
48
|
-
# line
|
|
48
|
+
# line.
|
|
49
49
|
#: () -> Array[String]
|
|
50
50
|
def awaiting_first_audit = @maps.select(&:awaits_first_audit?).map(&:principle_id)
|
|
51
51
|
|
|
52
52
|
# Whether any map's member changed since an audit or acknowledgement assessed it, not only since it was
|
|
53
|
-
# mapped, which --short exits 3 for rather than 4
|
|
53
|
+
# mapped, which --short exits 3 for rather than 4.
|
|
54
54
|
#: () -> bool
|
|
55
55
|
def assessed_change? = @maps.any?(&:assessed_change?)
|
|
56
56
|
|
|
57
57
|
# For each map with a changed member an audit or acknowledgement assessed, how many, which --session-start
|
|
58
|
-
# counts instead of listing each
|
|
58
|
+
# counts instead of listing each.
|
|
59
59
|
#: () -> Hash[String, Integer]
|
|
60
60
|
def assessed_changes = @maps.to_h { [it.principle_id, it.assessed_changes] }.reject { |_, count| count.zero? }
|
|
61
61
|
|
|
62
|
-
# For each map with members no audit has assessed, how many, which --short counts on stdout
|
|
62
|
+
# For each map with members no audit has assessed, how many, which --short counts on stdout.
|
|
63
63
|
#: () -> Hash[String, Integer]
|
|
64
64
|
def never_assessed = @maps.to_h { [it.principle_id, it.never_assessed] }.reject { |_, count| count.zero? }
|
|
65
65
|
|
|
66
66
|
# For each map with a changed member a one-member audit may judge, the ids of those members, which
|
|
67
|
-
# list-member-problems offers that audit for, one command per principle
|
|
67
|
+
# list-member-problems offers that audit for, one command per principle.
|
|
68
68
|
#: () -> Hash[String, Array[String]]
|
|
69
69
|
def acknowledgeable
|
|
70
70
|
@maps.to_h { |map| [map.principle_id, map.acknowledgeable_member_ids] }.reject { |_, ids| ids.empty? }
|
|
71
71
|
end
|
|
72
72
|
|
|
73
|
+
# The acknowledgeable members, those of principles that share one joined in one acknowledgement across them:
|
|
74
|
+
# each set of principle ids, in id order, with the members they acknowledge together, leaving out the
|
|
75
|
+
# principles in except, whose records wait on an upgrade.
|
|
76
|
+
#: (?except: Array[String]) -> Hash[Array[String], Array[String]]
|
|
77
|
+
def acknowledgeable_together(except: [])
|
|
78
|
+
acknowledgeable.reduce({}) do |groups, (id, members)|
|
|
79
|
+
except.include?(id) ? groups : joining(groups, id, members)
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
|
|
73
83
|
# For each map with members no baseline holds, its map file and the files those members are in, and in git
|
|
74
|
-
# only those of them that differ from HEAD or are untracked, since committing an unchanged file does nothing
|
|
75
|
-
#
|
|
84
|
+
# only those of them that differ from HEAD or are untracked, since committing an unchanged file does nothing.
|
|
85
|
+
# In git the list is empty when every one is committed already.
|
|
76
86
|
#: (MappedPrinciples) -> Hash[String, Array[String]]
|
|
77
87
|
def files_to_commit(principles)
|
|
78
88
|
no_baseline_paths.to_h do |id, paths|
|
|
@@ -136,6 +146,14 @@ module Principles
|
|
|
136
146
|
rerun: "#{Error::EXECUTABLE} list-member-problems",
|
|
137
147
|
note: "A map listed as unreadable_map needs its own refusal's repair. ")
|
|
138
148
|
end
|
|
149
|
+
|
|
150
|
+
# groups with principle id's members joined into each group that shares one of them, as one group.
|
|
151
|
+
#: (Hash[Array[String], Array[String]], String, Array[String]) -> Hash[Array[String], Array[String]]
|
|
152
|
+
def joining(groups, id, members)
|
|
153
|
+
joined = groups.select { |_ids, others| others.intersect?(members) }
|
|
154
|
+
rest = groups.reject { |ids, _others| joined.key?(ids) }
|
|
155
|
+
rest.merge([*joined.keys.flatten, id].sort => [*joined.values.flatten, *members].uniq)
|
|
156
|
+
end
|
|
139
157
|
end
|
|
140
158
|
end
|
|
141
159
|
end
|
|
@@ -34,7 +34,7 @@ module Principles
|
|
|
34
34
|
# The user's project as this tool reads it: its instruction files, each member's text, the answers an
|
|
35
35
|
# agent hands in, and the maps, audit records and git history kept beside them. Controllers reach the
|
|
36
36
|
# project only through this model. It is handed its five data adapters, so a spec can hand it stand-ins
|
|
37
|
-
# that meet the same contracts
|
|
37
|
+
# that meet the same contracts.
|
|
38
38
|
class Project
|
|
39
39
|
# An implicit invocation reuses its nearest established project; an explicit root uses .at directly.
|
|
40
40
|
#: (String) -> Project
|
|
@@ -86,7 +86,7 @@ module Principles
|
|
|
86
86
|
GuidanceSearchPaths.read(@guidance_search_paths)
|
|
87
87
|
end
|
|
88
88
|
|
|
89
|
-
# The project's history, one for the whole command, so every read names the HEAD it first read
|
|
89
|
+
# The project's history, one for the whole command, so every read names the HEAD it first read.
|
|
90
90
|
#: () -> ProjectHistory
|
|
91
91
|
def history
|
|
92
92
|
@history ||= ProjectHistory.new(@repository, @files)
|
|
@@ -101,10 +101,14 @@ module Principles
|
|
|
101
101
|
end
|
|
102
102
|
|
|
103
103
|
# Whether two paths name one file, as their symbolic links lead them, so an edit through either is an edit
|
|
104
|
-
# to both
|
|
104
|
+
# to both.
|
|
105
105
|
#: (String, String) -> bool
|
|
106
106
|
def same_file?(path, other) = @files.leads_to(path) == @files.leads_to(other)
|
|
107
107
|
|
|
108
|
+
# Whether path names a folder in the project.
|
|
109
|
+
#: (String) -> bool
|
|
110
|
+
def folder?(path) = @files.folder?(path)
|
|
111
|
+
|
|
108
112
|
# Where a member is in its file now, and the hash of what it says there.
|
|
109
113
|
#: (Locator) -> Hash[String, untyped]
|
|
110
114
|
def locate(locator)
|
|
@@ -115,14 +119,18 @@ module Principles
|
|
|
115
119
|
#: (Locator) -> Hash[String, untyped]
|
|
116
120
|
def locate_for_authoring(locator) = member_file(locator.path).locate_for_authoring(locator)
|
|
117
121
|
|
|
118
|
-
# The
|
|
122
|
+
# The lines locator finds now, as one text; refused as locate refuses.
|
|
123
|
+
#: (Locator) -> String
|
|
124
|
+
def member_text(locator) = member_file(locator.path).lines_of(locator).join
|
|
125
|
+
|
|
126
|
+
# The text locator finds now, as one value: its path, its lines and the hash of what it says.
|
|
119
127
|
#: (Locator) -> LocatedText
|
|
120
128
|
def located_text(locator) = LocatedText.of(locate(locator))
|
|
121
129
|
|
|
122
130
|
# The member at locator, its lines in its file at commit beside its lines now, which an audit shows the
|
|
123
|
-
# agent so it judges the member's own change without the rest of its file's
|
|
124
|
-
# file or its locator finds nothing there, as after a move, which each caller says in its own terms
|
|
125
|
-
# then_locator places it at commit where it was elsewhere then, as before a move
|
|
131
|
+
# agent so it judges the member's own change without the rest of its file's; nil when commit lacks the
|
|
132
|
+
# file or its locator finds nothing there, as after a move, which each caller says in its own terms.
|
|
133
|
+
# then_locator places it at commit where it was elsewhere then, as before a move.
|
|
126
134
|
#: (Locator, since: String, ?then_locator: Locator) -> MemberLines?
|
|
127
135
|
def member_lines(locator, since:, then_locator: locator)
|
|
128
136
|
before = history.lines_at(since, then_locator) or return nil
|
|
@@ -131,16 +139,17 @@ module Principles
|
|
|
131
139
|
end
|
|
132
140
|
|
|
133
141
|
# As member_lines, since the last full audit's commit, or that it cannot be found there, so a full audit still
|
|
134
|
-
# starts
|
|
142
|
+
# starts.
|
|
135
143
|
#: (Locator, since: String) -> (MemberLines | MemberLinesNotFoundAtLastAudit)
|
|
136
144
|
def member_lines_since_last_audit(locator, since:)
|
|
137
145
|
member_lines(locator, since: since) || MemberLinesNotFoundAtLastAudit.new
|
|
138
146
|
end
|
|
139
147
|
|
|
140
|
-
# The project file at path as the type that finds a member in it, refused when it cannot be read
|
|
148
|
+
# The project file at path as the type that finds a member in it, refused when it cannot be read, or while git
|
|
149
|
+
# tracks it only in another case.
|
|
141
150
|
#: (String) -> MemberFile
|
|
142
151
|
def member_file(path)
|
|
143
|
-
MemberFile.for(path: path, text: @files.read_text(path))
|
|
152
|
+
MemberFile.for(path: history.tracked_paths.spelt_as_tracked(path), text: @files.read_text(path))
|
|
144
153
|
end
|
|
145
154
|
|
|
146
155
|
# Each of map's members by id, where it is in its file now and the hash of what it says there. It is
|
|
@@ -193,23 +202,22 @@ module Principles
|
|
|
193
202
|
members.to_h { |member| [member.id, MemberLoads.read(@files, member.locator, hooks: hooks)] }
|
|
194
203
|
end
|
|
195
204
|
|
|
196
|
-
# The files members load, each read whole once, with the project's hooks as hooks read them
|
|
205
|
+
# The files members load, each read whole once, with the project's hooks as hooks read them.
|
|
197
206
|
#: (PrincipleMembers, HookCommands) -> LoadedFiles
|
|
198
207
|
def loaded_files(members, hooks) = LoadedFiles.read(@files, members, hooks: hooks)
|
|
199
208
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
end
|
|
209
|
+
# The command hooks in each of paths present, the project settings files unless others are given.
|
|
210
|
+
#: (?Array[String]) -> HookCommands
|
|
211
|
+
def hook_commands(paths = HookCommands::SETTINGS) = HookCommands.read(@files, paths)
|
|
204
212
|
|
|
205
213
|
# The root entry files every session of a host loads, whether one links the other and which git does not
|
|
206
214
|
# track.
|
|
207
215
|
#: () -> EntryFiles
|
|
208
216
|
def entry_files = EntryFiles.read(@files, history)
|
|
209
217
|
|
|
210
|
-
# An answer to the request given, or to the one it names when none is
|
|
211
|
-
# read from stdin, its head checked against that request's phase's answer schema
|
|
212
|
-
# check once its request is known
|
|
218
|
+
# An answer to the request given, or to the one it names when none is, from file, where - means it was
|
|
219
|
+
# read from stdin, its head checked against that request's phase's answer schema and the rest left to
|
|
220
|
+
# check once its request is known.
|
|
213
221
|
#: (String, stdin: String?, given: String?) -> SentAnswer
|
|
214
222
|
def answer(file, stdin:, given:) = SentAnswer.read(@files, file, stdin:, given:)
|
|
215
223
|
|
|
@@ -226,7 +234,7 @@ module Principles
|
|
|
226
234
|
|
|
227
235
|
private
|
|
228
236
|
|
|
229
|
-
# Refuses while the maps or records are still in the folder's earlier name
|
|
237
|
+
# Refuses while the maps or records are still in the folder's earlier name.
|
|
230
238
|
#: () -> void
|
|
231
239
|
def refuse_unmoved_folder
|
|
232
240
|
PrinciplesFolderMove.new(@maps.held_in | @audits.held_in).refuse_while_pending
|