Module: Sxn

Defined in:
lib/sxn.rb,
lib/sxn/ui.rb,
lib/sxn/CLI.rb,
lib/sxn/core.rb,
lib/sxn/rules.rb,
lib/sxn/config.rb,
lib/sxn/errors.rb,
lib/sxn/version.rb,
lib/sxn/commands.rb,
lib/sxn/database.rb,
lib/sxn/security.rb,
lib/sxn/ui/table.rb,
lib/sxn/templates.rb,
lib/sxn/ui/output.rb,
lib/sxn/ui/prompt.rb,
lib/sxn/rules/errors.rb,
lib/sxn/commands/init.rb,
lib/sxn/commands/rules.rb,
lib/sxn/database/errors.rb,
lib/sxn/rules/base_rule.rb,
lib/sxn/ui/progress_bar.rb,
lib/sxn/templates/errors.rb,
lib/sxn/commands/projects.rb,
lib/sxn/commands/sessions.rb,
lib/sxn/commands/worktrees.rb,
lib/sxn/core/rules_manager.rb,
lib/sxn/rules/rules_engine.rb,
lib/sxn/config/config_cache.rb,
lib/sxn/core/config_manager.rb,
lib/sxn/rules/template_rule.rb,
lib/sxn/runtime_validations.rb,
lib/sxn/core/project_manager.rb,
lib/sxn/core/session_manager.rb,
lib/sxn/core/worktree_manager.rb,
lib/sxn/rules/copy_files_rule.rb,
lib/sxn/rules/project_detector.rb,
lib/sxn/config/config_discovery.rb,
lib/sxn/config/config_validator.rb,
lib/sxn/database/session_database.rb,
lib/sxn/rules/setup_commands_rule.rb,
lib/sxn/templates/template_engine.rb,
lib/sxn/security/secure_file_copier.rb,
lib/sxn/templates/template_security.rb,
lib/sxn/templates/template_processor.rb,
lib/sxn/templates/template_variables.rb,
lib/sxn/security/secure_path_validator.rb,
lib/sxn/security/secure_command_executor.rb

Defined Under Namespace

Modules: Commands, Config, Core, Database, Rules, RuntimeValidations, Security, Templates, UI Classes: ApplicationError, BranchError, CLI, CommandExecutionError, ConfigurationError, DatabaseConnectionError, DatabaseError, DatabaseMigrationError, Error, GitError, InvalidProjectNameError, InvalidProjectPathError, InvalidRuleConfigError, InvalidRuleTypeError, InvalidSessionNameError, MCPError, MCPServerError, MCPValidationError, NoActiveSessionError, PathValidationError, ProjectAlreadyExistsError, ProjectError, ProjectExistsError, ProjectInUseError, ProjectNotFoundError, RollbackError, RuleError, RuleExecutionError, RuleNotFoundError, RuleValidationError, SecurityError, SessionAlreadyExistsError, SessionError, SessionExistsError, SessionHasChangesError, SessionNotFoundError, TemplateError, TemplateNotFoundError, TemplateProcessingError, ValidationError, WorktreeCreationError, WorktreeError, WorktreeExistsError, WorktreeNotFoundError, WorktreeRemovalError

Constant Summary collapse

VERSION =
"0.2.3"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configObject

Returns the value of attribute config.



19
20
21
# File 'lib/sxn.rb', line 19

def config
  @config
end

.loggerObject

Returns the value of attribute logger.



19
20
21
# File 'lib/sxn.rb', line 19

def logger
  @logger
end

Class Method Details

.lib_rootObject



25
26
27
# File 'lib/sxn.rb', line 25

def lib_root
  File.expand_path(__dir__)
end

.load_configObject



33
34
35
# File 'lib/sxn.rb', line 33

def load_config
  @config = Config.current
end

.rootObject



21
22
23
# File 'lib/sxn.rb', line 21

def root
  File.expand_path("..", __dir__)
end

.setup_logger(level: :info) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/sxn.rb', line 37

def setup_logger(level: :info)
  require "logger"
  @logger = Logger.new($stdout)

  # Convert string level to symbol if needed
  level = level.to_sym if level.is_a?(String)

  @logger.level = case level
                  when :debug then Logger::DEBUG
                  when :info then Logger::INFO
                  when :warn then Logger::WARN
                  when :error then Logger::ERROR
                  else Logger::INFO
                  end

  # Set custom formatter
  @logger.formatter = proc do |severity, datetime, _progname, msg|
    "[#{datetime.strftime("%Y-%m-%d %H:%M:%S")}] #{severity}: #{msg}\n"
  end

  @logger
end

.versionObject



29
30
31
# File 'lib/sxn.rb', line 29

def version
  VERSION
end