Skip to content

mthines/gw-tools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

79 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

gw-tools

Git Worktree Tools - A CLI for managing Git worktrees with automatic file syncing.

πŸ› οΈ gw CLI Tool

gw simplifies Git worktree management with features like:

  • Create worktrees with automatic file copying (.env, secrets, configs)
  • Quick navigation with gw cd and smart partial matching
  • Proxy commands for git worktree operations with enhanced output

Installation

npm install -g @gw-tools/gw-tool

Quick Start

# Create a new worktree (auto-creates branch if needed, auto-copies files)
gw add feature-auth

# Navigate to worktree
gw cd feature-auth

# Sync files between worktrees
gw sync feature-auth .env secrets/

# List all worktrees
gw list

# Remove when done
gw remove feature-auth

πŸ“– Full documentation: packages/gw-tool/README.md


πŸŽ“ AI Skills (for Claude Code, Copilot, Cursor, etc.)

Enhance your AI agent with gw-tools knowledge using skills.sh:

npx skills add https://github.com/mthines/gw-tools --skill @gw-git-worktree-workflows @gw-config-management @gw-multi-worktree-dev # installs all skills
# Master Git worktrees and gw workflows
npx skills add https://github.com/mthines/gw-tools --skill @gw-git-worktree-workflows

# Configure gw for your project type (Next.js, monorepos, etc.)
npx skills add https://github.com/mthines/gw-tools --skill @gw-config-management

# Advanced parallel development patterns
npx skills add https://github.com/mthines/gw-tools --skill @gw-multi-worktree-dev

Once installed, your AI agent can:

  • Create worktrees for bug fixes and features automatically
  • Configure gw for your specific project type
  • Navigate between worktrees and manage files
  • Create PRs from isolated worktrees

πŸ“– Skill documentation: skills/README.md


πŸ“¦ Other Packages

This monorepo also includes utility libraries:

  • @gw-tools/strings - String manipulation utilities
  • @gw-tools/async - Async utility functions with retry logic
  • @gw-tools/colors - Color conversion and manipulation utilities
  • @gw-tools/utils - Shared utilities (internal)

πŸ—οΈ Nx Monorepo

This repository uses Nx for monorepo management.

πŸš€ Development Quick Start

# Clone the repository
git clone <your-fork-url>
cd typescript-template

# Install dependencies
pnpm install

# Build all packages
npx nx run-many -t build

# Run tests
npx nx run-many -t test

# Lint all projects
npx nx run-many -t lint

# Run everything in parallel
npx nx run-many -t lint test build --parallel=3

# Visualize the project graph
npx nx graph

⭐ Featured Nx Capabilities

This repository showcases several powerful Nx features:

1. πŸ”’ Module Boundaries

Enforces architectural constraints using tags. Each package has specific dependencies it can use:

  • scope:shared (utils) - Can be used by all packages
  • scope:strings - Can only depend on shared utilities
  • scope:async - Can only depend on shared utilities
  • scope:colors - Can only depend on shared utilities

Try it out:

# See the current project graph and boundaries
npx nx graph

# View a specific project's details
npx nx show project strings --web

Learn more about module boundaries β†’

2. πŸ› οΈ Custom Run Commands

Packages can define custom commands beyond standard build/test/lint:

# Run the custom build-base command for strings package
npx nx run strings:build-base

# See all available targets for a project
npx nx show project strings

Learn more about custom run commands β†’

3. πŸ”§ Self-Healing CI

The CI pipeline includes nx fix-ci which automatically identifies and suggests fixes for common issues. To test it, you can make a change to async-retry.spec.ts so that it fails, and create a PR.

# Run tests and see the failure
npx nx test async

# In CI, this command provides automated fixes
npx nx fix-ci

Learn more about self-healing CI β†’

4. πŸ“¦ Package Publishing

Manage releases and publishing with Nx Release:

# Dry run to see what would be published
npx nx release --dry-run

# Version and release packages
npx nx release

# Publish only specific packages
npx nx release publish --projects=strings,colors

Learn more about Nx Release β†’

πŸ“ Project Structure

β”œβ”€β”€ packages/
β”‚   β”œβ”€β”€ strings/     [scope:strings] - String utilities (publishable)
β”‚   β”œβ”€β”€ async/       [scope:async]   - Async utilities (publishable)
β”‚   β”œβ”€β”€ colors/      [scope:colors]  - Color utilities (publishable)
β”‚   └── utils/       [scope:shared]  - Shared utilities (private)
β”œβ”€β”€ nx.json          - Nx configuration
β”œβ”€β”€ tsconfig.json    - TypeScript configuration
└── eslint.config.mjs - ESLint with module boundary rules

🏷️ Understanding Tags

This repository uses tags to enforce module boundaries:

Package Tag Can Import From
@gw-tools/utils scope:shared Nothing (base library)
@gw-tools/strings scope:strings scope:shared
@gw-tools/async scope:async scope:shared
@gw-tools/colors scope:colors scope:shared

The ESLint configuration enforces these boundaries, preventing circular dependencies and maintaining clean architecture.

πŸ§ͺ Testing Module Boundaries

To see module boundary enforcement in action:

  1. Try importing @gw-tools/colors into @gw-tools/strings
  2. Run npx nx lint strings
  3. You'll see an error about violating module boundaries

πŸ“š Useful Commands

# Project exploration
npx nx graph                                    # Interactive dependency graph
npx nx list                                     # List installed plugins
npx nx show project strings --web              # View project details

# Development
npx nx build strings                           # Build a specific package
npx nx test async                              # Test a specific package
npx nx lint colors                             # Lint a specific package

# Running multiple tasks
npx nx run-many -t build                       # Build all projects
npx nx run-many -t test --parallel=3          # Test in parallel
npx nx run-many -t lint test build            # Run multiple targets

# Affected commands (great for CI)
npx nx affected -t build                       # Build only affected projects
npx nx affected -t test                        # Test only affected projects

# Release management
npx nx release --dry-run                       # Preview release changes
npx nx release                                 # Create a new release

Nx Cloud

Nx Cloud ensures a fast and scalable CI pipeline. It includes features such as:

πŸ”— Learn More

πŸ’¬ Community

Join the Nx community:

About

Git Worktree tools

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •