Module: Ace::Git::Worktree

Defined in:
lib/ace/git/worktree.rb,
lib/ace/git/worktree/cli.rb,
lib/ace/git/worktree/version.rb,
lib/ace/git/worktree/configuration.rb,
lib/ace/git/worktree/atoms/git_command.rb,
lib/ace/git/worktree/cli/commands/list.rb,
lib/ace/git/worktree/cli/commands/prune.rb,
lib/ace/git/worktree/atoms/path_expander.rb,
lib/ace/git/worktree/cli/commands/config.rb,
lib/ace/git/worktree/cli/commands/create.rb,
lib/ace/git/worktree/cli/commands/remove.rb,
lib/ace/git/worktree/cli/commands/switch.rb,
lib/ace/git/worktree/atoms/slug_generator.rb,
lib/ace/git/worktree/models/worktree_info.rb,
lib/ace/git/worktree/molecules/pr_creator.rb,
lib/ace/git/worktree/commands/list_command.rb,
lib/ace/git/worktree/molecules/task_pusher.rb,
lib/ace/git/worktree/commands/prune_command.rb,
lib/ace/git/worktree/models/worktree_config.rb,
lib/ace/git/worktree/molecules/task_fetcher.rb,
lib/ace/git/worktree/atoms/task_id_extractor.rb,
lib/ace/git/worktree/commands/config_command.rb,
lib/ace/git/worktree/commands/create_command.rb,
lib/ace/git/worktree/commands/remove_command.rb,
lib/ace/git/worktree/commands/switch_command.rb,
lib/ace/git/worktree/molecules/config_loader.rb,
lib/ace/git/worktree/molecules/hook_executor.rb,
lib/ace/git/worktree/models/worktree_metadata.rb,
lib/ace/git/worktree/molecules/task_committer.rb,
lib/ace/git/worktree/molecules/worktree_lister.rb,
lib/ace/git/worktree/molecules/worktree_creator.rb,
lib/ace/git/worktree/molecules/worktree_remover.rb,
lib/ace/git/worktree/organisms/worktree_manager.rb,
lib/ace/git/worktree/cli/commands/shared_helpers.rb,
lib/ace/git/worktree/molecules/current_task_linker.rb,
lib/ace/git/worktree/molecules/task_status_updater.rb,
lib/ace/git/worktree/molecules/parent_task_resolver.rb,
lib/ace/git/worktree/organisms/task_worktree_orchestrator.rb

Overview

Main module for ace-git-worktree gem

This gem provides task-aware git worktree management capabilities integrated with the ACE task management system.

Key features:

  • Task-aware worktree creation with automatic metadata lookup

  • Integration with ace-task for task information

  • Configuration-driven naming conventions

  • Automated environment setup (mise trust)

  • Support for traditional worktree operations

Examples:

Task-aware worktree creation

require 'ace/git/worktree'

# Create a worktree for a task
orchestrator = Ace::Git::Worktree::TaskWorktreeOrchestrator.new
result = orchestrator.create_for_task("081")

Traditional worktree creation

manager = Ace::Git::Worktree::WorktreeManager.new
result = manager.create("feature-branch")

Access timeout configuration

Ace::Git::Worktree.default_timeout  # => 30
Ace::Git::Worktree.max_timeout      # => 300

Defined Under Namespace

Modules: Atoms, CLI, Commands, Configuration, Models, Molecules, Organisms

Constant Summary collapse

VERSION =
'0.21.4'

Class Method Summary collapse

Class Method Details

.commit_timeoutInteger

Timeout for git commit operations

Returns:

  • (Integer)

    Timeout in seconds (default: 30)



106
107
108
# File 'lib/ace/git/worktree.rb', line 106

def commit_timeout
  config.dig("timeouts", "commit") || 30
end

.configHash

Get configuration for ace-git-worktree Follows ADR-022: Configuration Default and Override Pattern Uses Ace::Support::Config.create() for configuration cascade resolution Thread-safe: uses mutex for initialization

Examples:

Get current configuration

config = Ace::Git::Worktree.config
puts config.dig("timeouts", "default")  # => 30

Returns:

  • (Hash)

    merged configuration hash



59
60
61
62
63
64
65
66
67
# File 'lib/ace/git/worktree.rb', line 59

def config
  # Fast path: return cached config if already initialized
  return @config if defined?(@config) && @config

  # Thread-safe initialization
  @config_mutex.synchronize do
    @config ||= load_config
  end
end

.default_timeoutInteger

Default timeout for general git operations

Returns:

  • (Integer)

    Timeout in seconds (default: 30)



82
83
84
# File 'lib/ace/git/worktree.rb', line 82

def default_timeout
  config.dig("timeouts", "default") || 30
end

.hook_timeoutInteger

Timeout for after_create hook commands

Returns:

  • (Integer)

    Timeout in seconds (default: 30)



94
95
96
# File 'lib/ace/git/worktree.rb', line 94

def hook_timeout
  config.dig("timeouts", "hook") || 30
end

.list_timeoutInteger

Timeout for worktree list operations

Returns:

  • (Integer)

    Timeout in seconds (default: 30)



100
101
102
# File 'lib/ace/git/worktree.rb', line 100

def list_timeout
  config.dig("timeouts", "list") || 30
end

.max_timeoutInteger

Maximum allowed timeout for any operation

Returns:

  • (Integer)

    Timeout in seconds (default: 300)



88
89
90
# File 'lib/ace/git/worktree.rb', line 88

def max_timeout
  config.dig("timeouts", "max") || 300
end

.remove_timeoutInteger

Timeout for worktree removal operations

Returns:

  • (Integer)

    Timeout in seconds (default: 30)



112
113
114
# File 'lib/ace/git/worktree.rb', line 112

def remove_timeout
  config.dig("timeouts", "remove") || 30
end

.reset_config!Object

Reset configuration cache (mainly for testing) Thread-safe: uses mutex to prevent race conditions



71
72
73
74
75
# File 'lib/ace/git/worktree.rb', line 71

def reset_config!
  @config_mutex.synchronize do
    @config = nil
  end
end