Class: Carson::Runtime
- Inherits:
-
Object
- Object
- Carson::Runtime
- Defined in:
- lib/carson/runtime.rb,
lib/carson/runtime.rb,
lib/carson/runtime/audit.rb,
lib/carson/runtime/local.rb,
lib/carson/runtime/repos.rb,
lib/carson/runtime/setup.rb,
lib/carson/runtime/govern.rb,
lib/carson/runtime/review.rb,
lib/carson/runtime/status.rb,
lib/carson/runtime/deliver.rb,
lib/carson/runtime/housekeep.rb,
lib/carson/runtime/local/sync.rb,
lib/carson/runtime/local/hooks.rb,
lib/carson/runtime/local/prune.rb,
lib/carson/runtime/local/onboard.rb,
lib/carson/runtime/local/template.rb,
lib/carson/runtime/local/worktree.rb,
lib/carson/runtime/review/utility.rb,
lib/carson/runtime/review/query_text.rb,
lib/carson/runtime/review/data_access.rb,
lib/carson/runtime/review/gate_support.rb,
lib/carson/runtime/review/sweep_support.rb
Defined Under Namespace
Modules: Audit, Deliver, Govern, Housekeep, Local, Repos, Review, Setup, Status
Constant Summary collapse
- EXIT_OK =
Shared exit-code contract used by all commands and CI smoke assertions.
0- EXIT_ERROR =
1- EXIT_BLOCK =
2- REPORT_MD =
"pr_report_latest.md".freeze
- REPORT_JSON =
"pr_report_latest.json".freeze
- REVIEW_GATE_REPORT_MD =
"review_gate_latest.md".freeze
- REVIEW_GATE_REPORT_JSON =
"review_gate_latest.json".freeze
- REVIEW_SWEEP_REPORT_MD =
"review_sweep_latest.md".freeze
- REVIEW_SWEEP_REPORT_JSON =
"review_sweep_latest.json".freeze
- DISPOSITION_TOKENS =
%w[accepted rejected deferred].freeze
Constants included from Setup
Constants included from Local
Local::SUPERSEDED, Local::TEMPLATE_SYNC_BRANCH
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#ledger ⇒ Object
readonly
Returns the value of attribute ledger.
-
#output ⇒ Object
readonly
Returns the value of attribute output.
-
#template_sync_result ⇒ Object
readonly
Returns the value of attribute template_sync_result.
Instance Method Summary collapse
-
#branch_record(name: current_branch) ⇒ Object
Passive branch record for the current checkout.
-
#current_head ⇒ Object
Current branch head SHA for delivery identity.
-
#git_capture!(*args) ⇒ Object
Captures git stdout and raises on non-zero exit.
-
#git_run(*args) ⇒ Object
Low-level git invocation wrapper.
-
#initialize(repo_root:, tool_root:, output:, error:, in_stream: $stdin, verbose: false) ⇒ Runtime
constructor
Runtime wiring for repository context, tool paths, and output streams.
-
#puts_line(message) ⇒ Object
Single output funnel to keep messaging style consistent.
-
#puts_verbose(message) ⇒ Object
Prints a line only when verbose mode is active.
-
#repository_record ⇒ Object
Passive repository record for the current runtime context.
-
#verbose? ⇒ Boolean
Returns true when full diagnostic output is enabled via –verbose.
Methods included from Housekeep
#housekeep!, #housekeep_all!, #housekeep_one_dry_run, #housekeep_target!, #reap_dead_worktrees!, #reap_dead_worktrees_plan
Methods included from Deliver
Methods included from Status
Methods included from Review
Methods included from Govern
#govern!, #govern_cycle!, #govern_loop!
Methods included from Setup
Methods included from Repos
Methods included from Local
#cwd_worktree_branch, #main_worktree_root, #offboard!, #onboard!, #prune!, #prune_all!, #prune_plan, #realpath_safe, #refresh!, #refresh_all!, #sweep_stale_worktrees!, #sync!, #sync_all!, #template_apply!, #template_check!, #template_check_all!, #worktree_create!, #worktree_list, #worktree_remove!
Methods included from Audit
Constructor Details
#initialize(repo_root:, tool_root:, output:, error:, in_stream: $stdin, verbose: false) ⇒ Runtime
Runtime wiring for repository context, tool paths, and output streams.
26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/carson/runtime.rb', line 26 def initialize( repo_root:, tool_root:, output:, error:, in_stream: $stdin, verbose: false ) @repo_root = repo_root @tool_root = tool_root @output = output @error = error @in = in_stream @verbose = verbose @config = Config.load( repo_root: repo_root ) @git_adapter = Adapters::Git.new( repo_root: repo_root ) @github_adapter = Adapters::GitHub.new( repo_root: repo_root ) @ledger = Ledger.new( path: @config.govern_state_path ) @template_sync_result = nil end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
44 45 46 |
# File 'lib/carson/runtime.rb', line 44 def config @config end |
#ledger ⇒ Object (readonly)
Returns the value of attribute ledger.
40 41 42 |
# File 'lib/carson/runtime.rb', line 40 def ledger @ledger end |
#output ⇒ Object (readonly)
Returns the value of attribute output.
44 45 46 |
# File 'lib/carson/runtime.rb', line 44 def output @output end |
#template_sync_result ⇒ Object (readonly)
Returns the value of attribute template_sync_result.
40 41 42 |
# File 'lib/carson/runtime.rb', line 40 def template_sync_result @template_sync_result end |
Instance Method Details
#branch_record(name: current_branch) ⇒ Object
Passive branch record for the current checkout.
98 99 100 |
# File 'lib/carson/runtime.rb', line 98 def branch_record( name: current_branch ) repository_record.branch( name ).reload end |
#current_head ⇒ Object
Current branch head SHA for delivery identity.
85 86 87 |
# File 'lib/carson/runtime.rb', line 85 def current_head git_capture!( "rev-parse", "HEAD" ).strip end |
#git_capture!(*args) ⇒ Object
Captures git stdout and raises on non-zero exit.
230 231 232 233 234 235 236 237 |
# File 'lib/carson/runtime.rb', line 230 def git_capture!( *args ) stdout_text, stderr_text, success, = git_run( *args ) unless success error.print stderr_text unless stderr_text.empty? raise "git #{args.join( ' ' )} failed" end stdout_text end |
#git_run(*args) ⇒ Object
Low-level git invocation wrapper.
246 247 248 |
# File 'lib/carson/runtime.rb', line 246 def git_run( *args ) git_adapter.run( *args ) end |
#puts_line(message) ⇒ Object
Single output funnel to keep messaging style consistent. Prefixes non-empty lines with the Carson badge (⧓).
121 122 123 124 125 126 127 |
# File 'lib/carson/runtime.rb', line 121 def puts_line( ) if .to_s.strip.empty? output.puts "" else output.puts "#{BADGE} #{}" end end |
#puts_verbose(message) ⇒ Object
Prints a line only when verbose mode is active.
58 59 60 |
# File 'lib/carson/runtime.rb', line 58 def puts_verbose( ) puts_line( ) if verbose? end |
#repository_record ⇒ Object
Passive repository record for the current runtime context. Uses main_worktree_root so the repo_path stored in the ledger is always the canonical main tree path, regardless of which worktree the command runs from. This ensures govern (which looks up by main tree path) finds worktree deliveries.
93 94 95 |
# File 'lib/carson/runtime.rb', line 93 def repository_record Repository.new( path: main_worktree_root, authority: config., runtime: self ) end |
#verbose? ⇒ Boolean
Returns true when full diagnostic output is enabled via –verbose.
53 54 55 |
# File 'lib/carson/runtime.rb', line 53 def verbose? @verbose end |