Project

sxn

0.0
No release in over 3 years
Sxn simplifies git worktree management with intelligent project rules and secure automation
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

~> 2.1
~> 2.4
~> 3.2
~> 13.0
~> 3.12
~> 1.50
~> 0.22
~> 6.2
~> 3.19

Runtime

~> 2.0
~> 3.1
~> 5.4
~> 3.8
>= 3.0
~> 1.23
~> 0.8
~> 1.6
~> 1.3
~> 0.23
~> 0.12
~> 2.6
 Project Readme

Sxn

CI Ruby Version License

Sxn is a powerful session management tool for multi-repository development. It helps developers manage complex development environments with multiple git repositories, providing isolated workspaces, automatic project setup, and intelligent session management.

Features

  • Session Management: Create isolated development sessions with their own git worktrees
  • Multi-Repository Support: Work with multiple repositories in a single session
  • Automatic Project Setup: Apply project-specific rules and templates automatically
  • Git Worktree Integration: Leverage git worktrees for efficient branch management
  • Template Engine: Generate project-specific files using Liquid templates
  • Security First: Path validation and command sanitization for safe operations
  • Thread-Safe: Concurrent operations with proper synchronization

Installation

Add this line to your application's Gemfile:

gem 'sxn'

And then execute:

bundle install

Or install it yourself as:

gem install sxn

Quick Start

Initialize Sxn in your workspace

sxn init

Create a new session

sxn add feature-xyz --description "Working on feature XYZ"

Switch to a session

sxn use feature-xyz

Add a project worktree to current session

sxn worktree add my-project --branch feature-xyz

List sessions

sxn list

Usage

Session Management

Sessions are isolated workspaces that contain git worktrees for your projects:

# Create a new session
sxn add my-feature

# Switch to a session
sxn use my-feature

# List all sessions
sxn list

# Show current session
sxn current

# Remove a session
sxn sessions remove my-feature

Project Management

Register and manage projects that can be added to sessions:

# Add a project
sxn projects add my-app ~/projects/my-app

# List projects
sxn projects list

# Remove a project
sxn projects remove my-app

Worktree Management

Add project worktrees to your current session:

# Add a worktree for a project
sxn worktree add my-app --branch feature-branch

# List worktrees in current session
sxn worktree list

# Remove a worktree
sxn worktree remove my-app

Rules and Templates

Define project-specific setup rules:

# List available rules
sxn rules list

# Apply rules to a project
sxn rules apply my-app

Configuration

Sxn stores its configuration in .sxn/config.yml in your workspace:

sessions_folder: .sxn-sessions
settings:
  auto_cleanup: true
  max_sessions: 10
  default_branch: main

Project Rules

Create .sxn-rules.yml in your project root to define automatic setup:

rules:
  - type: template
    template: rails/database.yml
    destination: config/database.yml

  - type: copy_files
    source: .env.example
    destination: .env

  - type: setup_commands
    commands:
      - bundle install
      - yarn install
      - rails db:setup

Templates

Sxn includes templates for common project types:

  • Rails: CLAUDE.md, database.yml, session-info.md
  • JavaScript: README.md, session-info.md
  • Common: .gitignore, session-info.md

Templates use Liquid syntax and have access to session, project, and environment variables.

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests.

Running Tests

# Run all tests
bundle exec rspec

# Run only unit tests
bundle exec rspec spec/unit

# Run with coverage
ENABLE_SIMPLECOV=true bundle exec rspec

Type Checking

# Install RBS dependencies
rbs collection install

# Run Steep type checker
steep check

Linting

# Run RuboCop
bundle exec rubocop

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/yourusername/sxn.

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

License

The gem is available as open source under the terms of the MIT License.