principles 0.1.3 → 0.1.5
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 +151 -1
- data/README.md +10 -6
- data/exe/principles +1 -1
- data/lib/principles/cli.rb +9 -10
- data/lib/principles/command_line.rb +15 -6
- data/lib/principles/command_routes.rb +18 -2
- data/lib/principles/controllers/acknowledgement.rb +19 -4
- data/lib/principles/controllers/acknowledgements.rb +43 -12
- data/lib/principles/controllers/after_commit_report.rb +15 -2
- data/lib/principles/controllers/assessment.rb +7 -3
- data/lib/principles/controllers/audit.rb +17 -8
- data/lib/principles/controllers/audit_completion.rb +34 -9
- data/lib/principles/controllers/carrier_edit_report.rb +40 -0
- data/lib/principles/controllers/carrier_practices.rb +26 -0
- data/lib/principles/controllers/command.rb +36 -5
- data/lib/principles/controllers/context_budget.rb +61 -0
- data/lib/principles/controllers/correction.rb +15 -5
- data/lib/principles/controllers/full_audit_request.rb +38 -42
- data/lib/principles/controllers/inventory.rb +78 -71
- data/lib/principles/controllers/last_record_notice_beside.rb +51 -0
- data/lib/principles/controllers/member_addition.rb +20 -5
- data/lib/principles/controllers/member_entries.rb +50 -39
- data/lib/principles/controllers/member_entry_changes.rb +71 -0
- data/lib/principles/controllers/member_problems_report.rb +26 -6
- data/lib/principles/controllers/members_a_commit_changed.rb +14 -5
- data/lib/principles/controllers/members_in_logged_requests.rb +52 -0
- data/lib/principles/controllers/members_to_assess.rb +35 -8
- data/lib/principles/controllers/meta_principle_setup.rb +12 -4
- data/lib/principles/controllers/open_correction.rb +3 -2
- data/lib/principles/controllers/parts_to_read.rb +48 -6
- data/lib/principles/controllers/plugin_member_addition.rb +48 -0
- data/lib/principles/controllers/principle_listing.rb +84 -0
- data/lib/principles/controllers/request_logging.rb +65 -0
- data/lib/principles/controllers/running_tool.rb +55 -15
- data/lib/principles/controllers/session_start_report.rb +26 -2
- data/lib/principles/data/branches_bringing_in.rb +52 -0
- data/lib/principles/data/captured_requests.rb +118 -0
- data/lib/principles/data/carrier_page_markers.rb +38 -0
- data/lib/principles/data/changes_since.rb +56 -0
- data/lib/principles/data/claude_code_home.rb +75 -0
- data/lib/principles/data/command-steps.json +139 -23
- data/lib/principles/data/decoded_leaf.rb +63 -0
- data/lib/principles/data/head_reflog.rb +13 -2
- data/lib/principles/data/kept_line.rb +39 -0
- data/lib/principles/data/known_marketplaces.rb +50 -0
- data/lib/principles/data/logged_request_matches.rb +144 -0
- data/lib/principles/data/logged_request_scan.rb +188 -0
- data/lib/principles/data/map_files.rb +18 -4
- data/lib/principles/data/plugin_folder.rb +85 -0
- data/lib/principles/data/plugin_registry.rb +73 -0
- data/lib/principles/data/principles_store.rb +49 -0
- data/lib/principles/data/project_files.rb +15 -0
- data/lib/principles/data/ran.rb +25 -0
- data/lib/principles/data/raw_request_filter.rb +61 -0
- data/lib/principles/data/repository.rb +29 -27
- data/lib/principles/data/request_logging_folder.rb +135 -0
- data/lib/principles/data/request_shape.rb +33 -0
- data/lib/principles/data/running_version.rb +1 -1
- data/lib/principles/data/schemas/acknowledgement-answer.schema.json +16 -1
- data/lib/principles/data/schemas/acknowledgements-answer.schema.json +16 -1
- data/lib/principles/data/schemas/assessment-answer.schema.json +8 -0
- data/lib/principles/data/schemas/command-steps.schema.json +1 -1
- data/lib/principles/data/schemas/correction-answer-guide.schema.json +2 -1
- data/lib/principles/data/schemas/correction-answer.schema.json +14 -0
- data/lib/principles/data/schemas/member-map.schema.json +12 -1
- data/lib/principles/data/settings_env_keys.rb +26 -0
- data/lib/principles/data/string_counts.rb +39 -0
- data/lib/principles/data/tools_on_path.rb +25 -0
- data/lib/principles/data/user_request_logging_folder.rb +73 -0
- data/lib/principles/invocation_options.rb +5 -3
- data/lib/principles/launch.rb +29 -10
- data/lib/principles/models/acknowledged_check.rb +11 -1
- data/lib/principles/models/acknowledgement.rb +5 -0
- data/lib/principles/models/acknowledgement_refusal.rb +20 -11
- data/lib/principles/models/acknowledgements_to_offer.rb +86 -0
- data/lib/principles/models/after_commit_input.rb +5 -0
- data/lib/principles/models/answer_fields.rb +3 -0
- data/lib/principles/models/assessment_basis.rb +10 -3
- data/lib/principles/models/audit.rb +10 -10
- data/lib/principles/models/audit_record.rb +10 -0
- data/lib/principles/models/audit_records.rb +4 -3
- data/lib/principles/models/audit_start.rb +9 -0
- data/lib/principles/models/authored_locator.rb +33 -0
- data/lib/principles/models/candidate_files.rb +23 -3
- data/lib/principles/models/candidate_outline.rb +18 -125
- data/lib/principles/models/captured_sessions.rb +166 -0
- data/lib/principles/models/carrier_edit_input.rb +56 -0
- data/lib/principles/models/carrier_kind.rb +79 -0
- data/lib/principles/models/carrier_pages_shown.rb +28 -0
- data/lib/principles/models/carved_message_bytes.rb +115 -0
- data/lib/principles/models/cited_files.rb +12 -3
- data/lib/principles/models/context_parts.rb +59 -0
- data/lib/principles/models/decided_prior_findings.rb +5 -0
- data/lib/principles/models/declared_map_changes.rb +22 -13
- data/lib/principles/models/disposition.rb +37 -6
- data/lib/principles/models/disposition_placeholders.rb +12 -0
- data/lib/principles/models/disposition_text_field.rb +4 -0
- data/lib/principles/models/dropped_thinking.rb +73 -0
- data/lib/principles/models/feature.rb +54 -0
- data/lib/principles/models/finding_outcomes.rb +55 -0
- data/lib/principles/models/findings_left_open.rb +9 -11
- data/lib/principles/models/head_moves.rb +27 -10
- data/lib/principles/models/installed_component.rb +55 -0
- data/lib/principles/models/installed_plugins.rb +174 -0
- data/lib/principles/models/kept_sessions.rb +34 -0
- data/lib/principles/models/locator.rb +8 -0
- data/lib/principles/models/logged_request_reach.rb +52 -0
- data/lib/principles/models/logged_request_scan_completeness.rb +43 -0
- data/lib/principles/models/map_format_raise.rb +28 -0
- data/lib/principles/models/mapped_baseline.rb +46 -0
- data/lib/principles/models/mapped_principles.rb +2 -1
- data/lib/principles/models/maps_holding_file_whole.rb +42 -0
- data/lib/principles/models/markdown_text.rb +143 -0
- data/lib/principles/models/member.rb +19 -1
- data/lib/principles/models/member_entry.rb +56 -0
- data/lib/principles/models/member_justification.rb +52 -0
- data/lib/principles/models/member_lines.rb +11 -0
- data/lib/principles/models/member_loads.rb +17 -2
- data/lib/principles/models/member_problems.rb +46 -42
- data/lib/principles/models/member_reach.rb +59 -0
- data/lib/principles/models/member_snapshots.rb +34 -4
- data/lib/principles/models/member_text_as_sent.rb +31 -0
- data/lib/principles/models/member_texts.rb +45 -0
- data/lib/principles/models/members_by_part.rb +67 -0
- data/lib/principles/models/members_in_logged_requests.rb +279 -0
- data/lib/principles/models/meta_principle.rb +4 -4
- data/lib/principles/models/missing_files.rb +41 -16
- data/lib/principles/models/nearly_matching_maps.rb +56 -0
- data/lib/principles/models/open_correction.rb +5 -0
- data/lib/principles/models/open_finding.rb +4 -3
- data/lib/principles/models/outline_budget.rb +10 -1
- data/lib/principles/models/outline_item.rb +25 -0
- data/lib/principles/models/outline_section.rb +15 -4
- data/lib/principles/models/part_named.rb +16 -2
- data/lib/principles/models/part_token_estimates.rb +60 -0
- data/lib/principles/models/plugin_component.rb +37 -0
- data/lib/principles/models/plugin_enabled_in_project_settings.rb +61 -0
- data/lib/principles/models/plugin_install.rb +33 -0
- data/lib/principles/models/plugin_name.rb +23 -0
- data/lib/principles/models/plugin_reference.rb +53 -0
- data/lib/principles/models/principle.rb +7 -4
- data/lib/principles/models/principle_members.rb +22 -0
- data/lib/principles/models/prior_finding_decision.rb +1 -1
- data/lib/principles/models/prior_finding_outcomes.rb +12 -1
- data/lib/principles/models/problem_report.rb +14 -25
- data/lib/principles/models/project.rb +51 -56
- data/lib/principles/models/project_harness.rb +48 -0
- data/lib/principles/models/project_history.rb +19 -5
- data/lib/principles/models/recorded_members.rb +7 -0
- data/lib/principles/models/report_hooks.rb +9 -4
- data/lib/principles/models/request_channel.rb +62 -0
- data/lib/principles/models/request_kind.rb +62 -0
- data/lib/principles/models/request_logging.rb +231 -0
- data/lib/principles/models/request_logging_guard.rb +84 -0
- data/lib/principles/models/request_time.rb +46 -0
- data/lib/principles/models/runs_from.rb +0 -5
- data/lib/principles/models/script_comments.rb +58 -0
- data/lib/principles/models/session_registry.rb +61 -0
- data/lib/principles/models/session_start_input.rb +11 -2
- data/lib/principles/models/session_trend.rb +36 -0
- data/lib/principles/models/stale_request.rb +9 -0
- data/lib/principles/models/turn_opening.rb +83 -0
- data/lib/principles/models/turn_position.rb +43 -0
- data/lib/principles/models/unfixed_part.rb +82 -0
- data/lib/principles/models/unresolved_plugin_members.rb +35 -0
- data/lib/principles/models/user_logged_requests.rb +90 -0
- data/lib/principles/models/user_settings_entries.rb +49 -0
- data/lib/principles/models/whole_file_member_read.rb +48 -0
- data/lib/principles/models/without_prose.rb +20 -0
- data/lib/principles/models/workflow_jobs.rb +92 -0
- data/lib/principles/show_members_in_logged_requests_options.rb +27 -0
- data/lib/principles/show_principle_options.rb +32 -0
- data/lib/principles/version.rb +2 -2
- data/lib/principles/views/acknowledged_result.rb +31 -12
- data/lib/principles/views/acknowledgement_result.rb +18 -13
- data/lib/principles/views/acknowledgement_template_alone.rb +55 -0
- data/lib/principles/views/acknowledgements_offered.rb +54 -0
- data/lib/principles/views/added_member.rb +22 -6
- data/lib/principles/views/answer_in_a_file.rb +15 -15
- data/lib/principles/views/assessed_members.rb +19 -8
- data/lib/principles/views/assessment_request.rb +14 -6
- data/lib/principles/views/audit_changes.rb +14 -8
- data/lib/principles/views/audit_findings.rb +34 -0
- data/lib/principles/views/audit_result.rb +26 -24
- data/lib/principles/views/candidate_files_result.rb +1 -1
- data/lib/principles/views/carrier_checks.rb +40 -0
- data/lib/principles/views/carrier_edit_denial.rb +36 -0
- data/lib/principles/views/carrier_practices_page.rb +49 -0
- data/lib/principles/views/completed_audit_findings.rb +33 -0
- data/lib/principles/views/completed_audit_next_step.rb +12 -4
- data/lib/principles/views/consecutive_sections_elsewhere.rb +4 -0
- data/lib/principles/views/context_budget_result.rb +99 -0
- data/lib/principles/views/context_parts.rb +129 -25
- data/lib/principles/views/correction_request.rb +32 -17
- data/lib/principles/views/disposition_template.rb +35 -0
- data/lib/principles/views/first_audit.rb +29 -15
- data/lib/principles/views/first_audit_line.rb +4 -5
- data/lib/principles/views/hook_setup_result.rb +3 -1
- data/lib/principles/views/invocation.rb +14 -5
- data/lib/principles/views/last_record_notice.rb +41 -0
- data/lib/principles/views/lines_shared_with_member.rb +16 -22
- data/lib/principles/views/logged_request_status_meanings.rb +29 -0
- data/lib/principles/views/logged_requests_evidence.rb +84 -0
- data/lib/principles/views/map_added_to.rb +14 -12
- data/lib/principles/views/map_format_raised.rb +28 -0
- data/lib/principles/views/map_result.rb +41 -18
- data/lib/principles/views/maps_needing_members_or_audit.rb +1 -1
- data/lib/principles/views/member_change_since_baseline.rb +4 -0
- data/lib/principles/views/member_row.rb +13 -4
- data/lib/principles/views/member_sets_overlap.rb +31 -0
- data/lib/principles/views/members_a_commit_changed.rb +42 -25
- data/lib/principles/views/members_changed_during_audit.rb +27 -0
- data/lib/principles/views/members_in_logged_requests_result.rb +123 -0
- data/lib/principles/views/members_too_short_to_scan.rb +45 -0
- data/lib/principles/views/members_with_no_baseline.rb +6 -6
- data/lib/principles/views/meta_principle_result.rb +52 -15
- data/lib/principles/views/open_findings_line.rb +31 -92
- data/lib/principles/views/parts_index_result.rb +9 -5
- data/lib/principles/views/principle_read_result.rb +52 -11
- data/lib/principles/views/prior_findings_result.rb +9 -1
- data/lib/principles/views/problem_facts.rb +5 -3
- data/lib/principles/views/problem_lines.rb +54 -6
- data/lib/principles/views/problem_result.rb +7 -15
- data/lib/principles/views/prompts/assess-every-member/ask-whether-a-member-seen-only-as-read-is-loaded.md +3 -0
- data/lib/principles/views/prompts/assess-every-member/ask-whether-each-reason-holds.md +2 -0
- data/lib/principles/views/prompts/assess-every-member/claim-an-earlier-first-raised-at.md +6 -6
- data/lib/principles/views/prompts/assess-every-member/judge-the-keeping-against-the-other-principles.md +2 -0
- data/lib/principles/views/prompts/assess-every-member/read-a-compact-carried-member.md +9 -8
- data/lib/principles/views/prompts/assess-every-member/read-a-flagged-member-s-text-whole.md +3 -0
- data/lib/principles/views/prompts/assess-every-member/read-a-judged-member-s-text-whole.md +3 -0
- data/lib/principles/views/prompts/assess-every-member/turn-on-request-logging-to-see-what-reaches-context.md +2 -0
- data/lib/principles/views/prompts/assess-every-member/weigh-what-reached-the-context.md +7 -0
- data/lib/principles/views/prompts/dispose-of-each-finding/answer-guide.json +1 -0
- data/lib/principles/views/prompts/dispose-of-each-finding/fix-or-record-each-finding.md +6 -1
- data/lib/principles/views/prompts/dispose-of-each-finding/read-the-carrier-page-before-fixing.md +1 -0
- data/lib/principles/views/prompts/edit-a-carrier/read-the-page-before-the-first-edit.md +2 -0
- data/lib/principles/views/prompts/find-a-principle-to-map/read-a-cut-section-back.md +1 -1
- data/lib/principles/views/prompts/follow-each-carriers-best-practices/practices-for-hook-configuration.md +41 -0
- data/lib/principles/views/prompts/follow-each-carriers-best-practices/practices-for-hook-scripts.md +35 -0
- data/lib/principles/views/prompts/follow-each-carriers-best-practices/practices-for-instruction-files.md +37 -0
- data/lib/principles/views/prompts/follow-each-carriers-best-practices/practices-for-other-text-an-agent-reads.md +38 -0
- data/lib/principles/views/prompts/follow-each-carriers-best-practices/practices-for-rule-files.md +34 -0
- data/lib/principles/views/prompts/follow-each-carriers-best-practices/practices-for-skills.md +35 -0
- data/lib/principles/views/prompts/follow-each-carriers-best-practices/practices-for-subagent-definitions.md +35 -0
- data/lib/principles/views/prompts/learn-what-a-command-does/add-member.md +49 -51
- data/lib/principles/views/prompts/learn-what-a-command-does/change-member-name.md +12 -0
- data/lib/principles/views/prompts/learn-what-a-command-does/change-member-reason.md +12 -0
- data/lib/principles/views/prompts/learn-what-a-command-does/change-member-role.md +2 -1
- data/lib/principles/views/prompts/learn-what-a-command-does/every-command-and-how-they-chain.md +1 -1
- data/lib/principles/views/prompts/learn-what-a-command-does/list-candidate-files.md +1 -1
- data/lib/principles/views/prompts/learn-what-a-command-does/list-member-problems.md +32 -32
- data/lib/principles/views/prompts/learn-what-a-command-does/list-open-findings.md +10 -11
- data/lib/principles/views/prompts/learn-what-a-command-does/move-member.md +7 -6
- data/lib/principles/views/prompts/learn-what-a-command-does/remove-logged-requests.md +22 -0
- data/lib/principles/views/prompts/learn-what-a-command-does/remove-member.md +2 -1
- data/lib/principles/views/prompts/learn-what-a-command-does/report-at-session-start.md +8 -4
- data/lib/principles/views/prompts/learn-what-a-command-does/report-before-carrier-edit.md +13 -0
- data/lib/principles/views/prompts/learn-what-a-command-does/show-audit.md +7 -0
- data/lib/principles/views/prompts/learn-what-a-command-does/show-candidate-outlines.md +8 -2
- data/lib/principles/views/prompts/learn-what-a-command-does/show-carrier-practices.md +13 -0
- data/lib/principles/views/prompts/learn-what-a-command-does/show-context-budget.md +69 -0
- data/lib/principles/views/prompts/learn-what-a-command-does/show-hook-setup.md +4 -4
- data/lib/principles/views/prompts/learn-what-a-command-does/show-logged-requests.md +22 -0
- data/lib/principles/views/prompts/learn-what-a-command-does/show-members-in-logged-requests.md +62 -0
- data/lib/principles/views/prompts/learn-what-a-command-does/show-meta-principle-passage.md +13 -10
- data/lib/principles/views/prompts/learn-what-a-command-does/show-principle.md +16 -16
- data/lib/principles/views/prompts/learn-what-a-command-does/start-audit.md +27 -27
- data/lib/principles/views/prompts/learn-what-a-command-does/submit-answer.md +17 -17
- data/lib/principles/views/prompts/learn-what-a-command-does/turn-off-request-logging.md +18 -0
- data/lib/principles/views/prompts/learn-what-a-command-does/turn-on-request-logging.md +44 -0
- data/lib/principles/views/prompts/read-requested-outlines/continue-the-survey.md +3 -2
- data/lib/principles/views/prompts/read-what-reached-the-context/explain-request-logging-to-the-user.md +11 -0
- data/lib/principles/views/prompts/read-what-reached-the-context/explain-user-request-logging-to-the-user.md +10 -0
- data/lib/principles/views/prompts/read-what-reached-the-context/see-whether-members-reach-the-agent.md +2 -0
- data/lib/principles/views/prompts/read-what-reached-the-context/what-a-thread-continuation-holds.md +3 -0
- data/lib/principles/views/prompts/read-what-reached-the-context/what-absent-means.md +2 -0
- data/lib/principles/views/prompts/read-what-reached-the-context/what-each-context-budget-line-says.md +4 -0
- data/lib/principles/views/prompts/read-what-reached-the-context/what-each-member-line-says.md +2 -0
- data/lib/principles/views/prompts/read-what-reached-the-context/what-not-a-carrier-means.md +2 -0
- data/lib/principles/views/prompts/read-what-reached-the-context/what-present-but-not-loaded-means.md +2 -0
- data/lib/principles/views/prompts/read-what-reached-the-context/what-present-means.md +1 -0
- data/lib/principles/views/prompts/read-what-reached-the-context/what-unmeasurable-means.md +2 -0
- data/lib/principles/views/prompts/report-after-a-commit/a-row-ending-audit-asks-to-acknowledge-or-audit-again.md +1 -0
- data/lib/principles/views/prompts/report-after-a-commit/a-row-ending-mapping-commit-asks-for-an-audit.md +1 -0
- data/lib/principles/views/prompts/report-after-a-commit/a-row-ending-pinned-asks-for-an-audit.md +1 -0
- data/lib/principles/views/prompts/report-after-a-commit/plugin-members-are-still-listed.md +1 -0
- data/lib/principles/views/prompts/report-after-a-commit/the-commits-changed-these-members-waiting-on-an-upgrade.md +2 -2
- data/lib/principles/views/prompts/report-after-a-commit/the-commits-changed-these-members.md +2 -2
- data/lib/principles/views/prompts/report-after-a-commit/this-command-shows-what-each-needs-before-the-next-commit.md +1 -0
- data/lib/principles/views/prompts/run-a-first-audit-in-the-background/follow-the-brief.md +1 -0
- data/lib/principles/views/prompts/set-principles-up/ask-to-set-principles-up-after-an-audit.md +1 -0
- data/lib/principles/views/prompts/set-principles-up/entry-file-passage.md +1 -1
- data/lib/principles/views/prompts/set-principles-up/map-the-enabling-line-at-no-edit.md +3 -0
- data/lib/principles/views/prompts/set-principles-up/name-the-step-each-member-lacks.md +2 -2
- data/lib/principles/views/prompts/set-principles-up/place-the-passage-with-the-user.md +4 -2
- data/lib/principles/views/prompts/set-principles-up/what-the-passage-presumes.md +1 -1
- data/lib/principles/views/prompts/set-principles-up/why-set-principles-up.md +1 -0
- data/lib/principles/views/prompts/start-a-session/act-on-the-open-findings.md +2 -1
- data/lib/principles/views/prompts/start-a-session/ask-to-set-principles-up.md +2 -0
- data/lib/principles/views/prompts/start-a-session/hand-the-first-audit-to-a-subagent.md +2 -3
- data/lib/principles/views/prompts/start-a-session/name-the-principles-nothing-checks.md +1 -0
- data/lib/principles/views/prompts/start-a-session/raise-the-open-findings-waiting-on-no-one.md +1 -0
- data/lib/principles/views/request_logging_result.rb +108 -0
- data/lib/principles/views/request_part.rb +10 -4
- data/lib/principles/views/request_parts.rb +9 -0
- data/lib/principles/views/set_up_offer_line.rb +43 -0
- data/lib/principles/views/whole_file_elsewhere.rb +30 -0
- metadata +154 -5
- data/lib/principles/views/prompts/report-after-a-commit/the-principles-skill-is-where-to-start.md +0 -1
- data/lib/principles/views/prompts/report-after-a-commit/this-command-shows-each-one.md +0 -1
- data/lib/principles/views/prompts/set-principles-up/keep-them-held-between-audits.md +0 -2
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# typed: strict
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require "time"
|
|
5
|
+
require_relative "invocation"
|
|
6
|
+
require_relative "prompts"
|
|
7
|
+
require_relative "shell_word"
|
|
8
|
+
|
|
9
|
+
module Principles
|
|
10
|
+
# What this tool prints, from plain values a controller hands it. views/CLAUDE.md owns the boundary.
|
|
11
|
+
module Views
|
|
12
|
+
# What turning request logging on or off did.
|
|
13
|
+
class RequestLoggingResult
|
|
14
|
+
RELAUNCH = "A host started with the launch file keeps capturing until you relaunch it; the logged requests " \
|
|
15
|
+
"already captured stay in .principles/request-logging/requests/, which git ignores."
|
|
16
|
+
NEVER_ON = "Request logging was never turned on here, so there is nothing to stop."
|
|
17
|
+
|
|
18
|
+
#: (Invocation) -> void
|
|
19
|
+
def initialize(invocation)
|
|
20
|
+
@invocation = invocation
|
|
21
|
+
freeze
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# launch_line starts the host with the launch file for that launch only: a printed line, never an alias, since
|
|
25
|
+
# an alias would capture in every project the user starts the host in; resume_line is the same line resuming a
|
|
26
|
+
# conversation, since a fresh launch starts a new one. explain_to_user is what the agent tells
|
|
27
|
+
# the user before that relaunch: what is logged, who can read it, its cost and how to stop it.
|
|
28
|
+
#: (wrote: Array[String], launch_file: String) -> Hash[String, untyped]
|
|
29
|
+
def turned_on(wrote:, launch_file:)
|
|
30
|
+
launch = "claude --settings #{ShellWord.new(launch_file)}"
|
|
31
|
+
{ "status" => "request_logging_on", "wrote" => wrote, "launch_line" => launch,
|
|
32
|
+
"resume_line" => "#{launch} --resume",
|
|
33
|
+
"explain_to_user" => Prompts.text("read-what-reached-the-context/explain-request-logging-to-the-user"),
|
|
34
|
+
"next_action" => "Give the user launch_line to start Claude Code with; capture starts only on that " \
|
|
35
|
+
"launch, so relaunch the host with it. Each logged request holds the session's whole " \
|
|
36
|
+
"working context, the files read and every tool result, in a folder git ignores. The " \
|
|
37
|
+
"launch file sets every telemetry exporter to none for that launch, overriding an " \
|
|
38
|
+
"exporter the user set up. Turning request logging off deletes no logged request: " \
|
|
39
|
+
"#{@invocation.in_project("turn-off-request-logging")}" }
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# to_add is the env entries for the user to add to settings_file; explain_to_user is what the agent tells the
|
|
43
|
+
# user, whose consent it gets before they make the edit.
|
|
44
|
+
#: (wrote: Array[String], settings_file: String, to_add: Hash[String, String], settings_unreadable: bool,
|
|
45
|
+
#| pruned: Hash[String, Integer]) -> Hash[String, untyped]
|
|
46
|
+
def turned_on_for_user(wrote:, settings_file:, to_add:, settings_unreadable:, pruned:)
|
|
47
|
+
{ "status" => "request_logging_on_for_user", "settings_file" => settings_file, "add_to_env" => to_add,
|
|
48
|
+
"pruned" => pruned, "wrote" => wrote,
|
|
49
|
+
"explain_to_user" => Prompts.text("read-what-reached-the-context/explain-user-request-logging-to-the-user"),
|
|
50
|
+
"next_action" => "Give the user explain_to_user and ask whether they agree. Only once they do, have them " \
|
|
51
|
+
"add add_to_env to the env of settings_file; this tool never writes that file. " \
|
|
52
|
+
"#{exporters_left_out(settings_unreadable)} Each host they start after the edit logs " \
|
|
53
|
+
"every request; one already running does not until it is relaunched." }
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# What add_to_env leaves out of the exporter entries, and what it cannot know.
|
|
57
|
+
#: (bool) -> String
|
|
58
|
+
def exporters_left_out(settings_unreadable)
|
|
59
|
+
known = if settings_unreadable
|
|
60
|
+
"settings_file could not be read, so add_to_env holds every exporter entry: ask the user which " \
|
|
61
|
+
"they set there for telemetry of their own, and skip those."
|
|
62
|
+
else
|
|
63
|
+
"add_to_env leaves out each exporter settings_file already sets."
|
|
64
|
+
end
|
|
65
|
+
"#{known} An exporter set in the shell or a project's settings is not read here, so ask the user whether " \
|
|
66
|
+
"they set one there, and skip that entry if so."
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# newest names facts for the agent to judge whether capture is running; it never says a session is capturing.
|
|
70
|
+
#: (sessions: Array[Hash[String, untyped]], orphan_requests: Hash[String, Integer],
|
|
71
|
+
#| newest_request_written_at: Time?, newest_session_id: String?) -> Hash[String, untyped]
|
|
72
|
+
def shown(sessions:, orphan_requests:, newest_request_written_at:, newest_session_id:)
|
|
73
|
+
{ "status" => "logged_requests_shown", "sessions" => sessions, "orphan_requests" => orphan_requests,
|
|
74
|
+
"newest" => { "request_written_at" => newest_request_written_at&.utc&.iso8601,
|
|
75
|
+
"session_id" => newest_session_id },
|
|
76
|
+
"wrote" => [] }
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
# pruned counts the sessions no project registered whose requests were removed from the user-level folder, and
|
|
80
|
+
# their files and bytes; it never names them, since they are other projects' sessions.
|
|
81
|
+
#: (removed: Array[String], pruned: Hash[String, Integer]) -> Hash[String, untyped]
|
|
82
|
+
def removed(removed:, pruned:)
|
|
83
|
+
{ "status" => "logged_requests_removed", "removed" => removed, "pruned" => pruned, "wrote" => [] }
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# own is the entry that is request logging's alone, shared those the user may have set for telemetry of their
|
|
87
|
+
# own; pruned counts the sessions no project registered whose requests were removed, as removed gives it.
|
|
88
|
+
#: (settings_file: String, own: Hash[String, String], shared: Array[String], pruned: Hash[String, Integer])
|
|
89
|
+
#| -> Hash[String, untyped]
|
|
90
|
+
def turned_off_for_user(settings_file:, own:, shared:, pruned:)
|
|
91
|
+
{ "status" => "request_logging_off_for_user", "settings_file" => settings_file, "remove_from_env" => own,
|
|
92
|
+
"remove_if_added_for_this" => shared, "pruned" => pruned, "wrote" => [],
|
|
93
|
+
"next_action" => "Ask the user whether they set any of remove_if_added_for_this for telemetry of their " \
|
|
94
|
+
"own; then have them remove remove_from_env, and each of the rest they added for " \
|
|
95
|
+
"request logging, from the env of settings_file. This tool never writes that file. " \
|
|
96
|
+
"Every host started since they were added keeps capturing until it is relaunched. " \
|
|
97
|
+
"Requests already captured stay in the user-level folder until each project's " \
|
|
98
|
+
"remove-logged-requests removes them." }
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
#: (wrote: Array[String]) -> Hash[String, untyped]
|
|
102
|
+
def turned_off(wrote:)
|
|
103
|
+
{ "status" => "request_logging_off", "wrote" => wrote,
|
|
104
|
+
"next_action" => wrote.empty? ? NEVER_ON : RELAUNCH }
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
end
|
|
@@ -19,14 +19,16 @@ module Principles
|
|
|
19
19
|
|
|
20
20
|
# listed is what the agent reads of this part before its instructions. help is, by slot, the placeholder text
|
|
21
21
|
# each of its entries carries in the answer printed alone, where no instruction is printed beside it to say
|
|
22
|
-
# what each field takes.
|
|
22
|
+
# what each field takes. alone is, by slot, its entries as the answer printed alone gives them before their
|
|
23
|
+
# help, where they show what the list beside the request's answer would.
|
|
23
24
|
#: (shown: Hash[String, untyped], slots: Hash[String, untyped], ?instructions: Array[Instruction],
|
|
24
|
-
#| ?help: Hash[String, Hash[String, untyped]]) -> void
|
|
25
|
-
def initialize(shown:, slots:, instructions: [], help: {})
|
|
25
|
+
#| ?help: Hash[String, Hash[String, untyped]], ?alone: Hash[String, untyped]) -> void
|
|
26
|
+
def initialize(shown:, slots:, instructions: [], help: {}, alone: {})
|
|
26
27
|
@listed = shown
|
|
27
28
|
@slots = slots
|
|
28
29
|
@instructions = instructions
|
|
29
30
|
@help = help
|
|
31
|
+
@alone = alone
|
|
30
32
|
freeze
|
|
31
33
|
end
|
|
32
34
|
|
|
@@ -34,11 +36,15 @@ module Principles
|
|
|
34
36
|
#: () -> Hash[String, untyped]
|
|
35
37
|
def shown = @instructions.reduce(@listed) { |all, instruction| all.merge(instruction.printed) }
|
|
36
38
|
|
|
39
|
+
# Why the index gives no bytes for this part, when this read left it unfilled; nil, as here, when it is filled.
|
|
40
|
+
#: () -> String?
|
|
41
|
+
def bytes_unknown = nil
|
|
42
|
+
|
|
37
43
|
# The slots, each entry with its help in place of the fields the agent fills.
|
|
38
44
|
#: () -> Hash[String, untyped]
|
|
39
45
|
def slots_to_fill
|
|
40
46
|
@slots.to_h do |name, entries|
|
|
41
|
-
[name, entries.map { |entry| entry.merge(@help.fetch(name, {})) }]
|
|
47
|
+
[name, @alone.fetch(name, entries).map { |entry| entry.merge(@help.fetch(name, {})) }]
|
|
42
48
|
end
|
|
43
49
|
end
|
|
44
50
|
end
|
|
@@ -22,6 +22,15 @@ module Principles
|
|
|
22
22
|
#: () -> Array[Instruction]
|
|
23
23
|
def instructions = @parts.flat_map(&:instructions)
|
|
24
24
|
|
|
25
|
+
# Why the index gives no bytes, by the name of each part this read left unfilled.
|
|
26
|
+
#: () -> Hash[String, String]
|
|
27
|
+
def bytes_unknown
|
|
28
|
+
@parts.each_with_object({}) do |part, unknown|
|
|
29
|
+
reason = part.bytes_unknown or next
|
|
30
|
+
part.shown.each_key { unknown[it] = reason }
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
25
34
|
# template, with each part's slots added after its own entries, in order.
|
|
26
35
|
#: (Hash[String, untyped]) -> Hash[String, untyped]
|
|
27
36
|
def slotted_after(template) = @parts.reduce(template) { |all, part| all.merge(part.slots) }
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# typed: strict
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require_relative "invocation"
|
|
5
|
+
require_relative "prompts"
|
|
6
|
+
|
|
7
|
+
module Principles
|
|
8
|
+
# What this tool prints, from plain values a controller hands it. views/CLAUDE.md owns the boundary.
|
|
9
|
+
module Views
|
|
10
|
+
# The session-start line asking the agent to offer setting principles up, while a full audit has completed and
|
|
11
|
+
# nothing in the project has every session check the principles. It counts the audited principles and names none,
|
|
12
|
+
# so its length stays fixed, and it records no decline, so it asks again at each start until setup (019 F5, F7).
|
|
13
|
+
class SetUpOfferLine
|
|
14
|
+
#: (Invocation) -> void
|
|
15
|
+
def initialize(invocation)
|
|
16
|
+
@invocation = invocation
|
|
17
|
+
freeze
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# The line, as a list of none or one, for count audited principles at the session's start from source:
|
|
21
|
+
# startup, resume, clear or compact; at resume and compact, the facts alone.
|
|
22
|
+
#: (Integer, String) -> Array[String]
|
|
23
|
+
def lines(count, source)
|
|
24
|
+
return [] if count.zero?
|
|
25
|
+
|
|
26
|
+
counted = if count == 1 then "1 audited principle, and nothing in the project has every session check it"
|
|
27
|
+
else "#{count} audited principles, and nothing in the project has every session check them"
|
|
28
|
+
end
|
|
29
|
+
return [Prompts.text("start-a-session/name-the-principles-nothing-checks", counted:)] if resumed?(source)
|
|
30
|
+
|
|
31
|
+
[Prompts.text("start-a-session/ask-to-set-principles-up",
|
|
32
|
+
counted:, command: @invocation.in_project("show-meta-principle-passage"))]
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
private
|
|
36
|
+
|
|
37
|
+
# Whether the session resumed or was compacted, so its context began with the line asking already, and asking
|
|
38
|
+
# again would interrupt the task in hand.
|
|
39
|
+
#: (String) -> bool
|
|
40
|
+
def resumed?(source) = %w[resume compact].include?(source)
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# typed: strict
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
module Principles
|
|
5
|
+
module Views
|
|
6
|
+
# The other maps holding a new whole-file member's file whole, which ask the agent AddedMember's scope-or-join
|
|
7
|
+
# question.
|
|
8
|
+
class WholeFileElsewhere
|
|
9
|
+
#: (?Array[String]) -> void
|
|
10
|
+
def initialize(principle_ids = [])
|
|
11
|
+
@principle_ids = principle_ids
|
|
12
|
+
freeze
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
#: () -> Hash[String, untyped]
|
|
16
|
+
def to_h = @principle_ids.empty? ? {} : { "whole_file_elsewhere" => @principle_ids }
|
|
17
|
+
|
|
18
|
+
#: () -> String
|
|
19
|
+
def note
|
|
20
|
+
return "" if @principle_ids.empty?
|
|
21
|
+
|
|
22
|
+
"Other principles hold this whole file too (whole_file_elsewhere), so every edit to it is a change to each. "
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# Whether it asks AddedMember's scope-or-join question: when other principles hold the file whole.
|
|
26
|
+
#: () -> bool
|
|
27
|
+
def asks_scope_or_join? = @principle_ids.any?
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|