### Install wkit Fish Functions Source: https://github.com/takashabe/wkit/blob/main/examples/fish/README.md Demonstrates how to install wkit functions into your Fish shell configuration directory. This involves copying the provided `.fish` files to the appropriate location for Fish to recognize them. ```bash cp functions/*.fish ~/.config/fish/functions/ # Or copy specific functions cp functions/ws.fish ~/.config/fish/functions/ ``` -------------------------------- ### Build, Test, and Install wkit CLI Source: https://github.com/takashabe/wkit/blob/main/CLAUDE.md Provides essential bash commands to compile the Go project, execute its test suite, and install the resulting binary to the system's PATH. It also includes an optional step to copy Fish shell integration scripts. ```bash # Build the project go build -o wkit . # Run tests go test ./... # Install to system (after building) sudo cp wkit /usr/local/bin/ # Copy Fish integration examples (optional) cp examples/fish/functions/*.fish ~/.config/fish/functions/ ``` -------------------------------- ### Install wkit from Source (Bash) Source: https://github.com/takashabe/wkit/blob/main/README.md Instructions for building and installing the wkit CLI tool from its source code. Requires Go (1.21+) and Git (2.25+). The process involves cloning the repository, building the binary, and copying it to a system path. ```bash # Clone and build git clone https://github.com/takashabe/wkit.git cd wkit go build -o wkit . # Install binary sudo cp wkit /usr/local/bin/ ``` -------------------------------- ### Fish: List Worktrees (`wl`) Source: https://github.com/takashabe/wkit/blob/main/examples/fish/README.md A Fish shell function to list all available worktrees. It displays the worktrees in a formatted table, providing a clear overview of your project's worktree structure. ```fish function wl wkit list end ``` -------------------------------- ### Fish Shell Integration Examples Source: https://github.com/takashabe/wkit/blob/main/CLAUDE.md Illustrates how to integrate wkit commands into the Fish shell environment. This includes creating functions for tab completion, defining aliases for common operations, and integrating worktree status into the shell prompt. ```fish # Example Fish function for 'wkit list' function wkit-list-fish wkit list --format=json | jq '.[] | .name' end # Example alias for 'wkit switch' alias wst 'wkit switch' # Example prompt integration (conceptual) function fish_prompt set_color blue echo -n "wkit:$(wkit current --format=name)" # ... other prompt elements end ``` -------------------------------- ### Fish: Custom Worktree List with jq Source: https://github.com/takashabe/wkit/blob/main/examples/fish/README.md An example of a custom Fish function that uses `wkit` to list worktrees in JSON format and then processes this output with `jq`. It extracts and formats the branch name and path for easier parsing or display. ```fish function my_worktree_list wkit list --format=json | jq -r '.[] | "\(.branch)\t\(.path)"' end ``` -------------------------------- ### Fish: Add wkit Abbreviation Source: https://github.com/takashabe/wkit/blob/main/examples/fish/README.md A Fish shell tip showing how to create an abbreviation for the `wkit` command. This allows for shorter command entry, such as typing `wt` instead of `wkit`, improving efficiency. ```fish abbr -a wt 'wkit' ``` -------------------------------- ### Fish: Switch Worktree (`ws`) Source: https://github.com/takashabe/wkit/blob/main/examples/fish/README.md A Fish shell function that allows switching between worktrees using fuzzy search. It leverages `fzf` for interactive selection, making it easy to find and navigate to different worktrees. ```fish function ws wkit list --format=json | \ jq -r '.[] | "\(.branch)\t\(.path)"' | \ fzf --preview 'echo {} | cut -f2 | xargs -I {} ls -la {}' | \ cut -f2 | \ read -l selected and cd $selected end ``` -------------------------------- ### Fish: Show Worktree Status (`wst`) Source: https://github.com/takashabe/wkit/blob/main/examples/fish/README.md A Fish shell function that displays the status of all worktrees. This function helps in quickly checking the state of each worktree, including any uncommitted changes. ```fish function wst wkit status end ``` -------------------------------- ### Fish: Worktree Prompt Integration Source: https://github.com/takashabe/wkit/blob/main/examples/fish/README.md Demonstrates how to integrate worktree information into the Fish shell prompt. It checks for the current worktree's branch and displays it within brackets in the prompt, providing context for the current working directory. ```fish function fish_prompt # Your existing prompt code... # Add worktree info set -l worktree_info (wkit list --format=json 2>/dev/null | jq -r '.[] | select(.path == "(root)" or .path == ".") | .branch' 2>/dev/null) if test -n "$worktree_info" echo -n " [$worktree_info]" end # Rest of your prompt... end ``` -------------------------------- ### Fish: Add Worktree (`wa`) Source: https://github.com/takashabe/wkit/blob/main/examples/fish/README.md A Fish shell function to create a new worktree. It automatically uses the `wkit` configuration to set up the new worktree, simplifying the process of adding new development branches. ```fish function wa wkit add $argv end ``` -------------------------------- ### wkit JSON Output Example (Bash) Source: https://github.com/takashabe/wkit/blob/main/README.md Illustrates how to obtain structured output from wkit commands, specifically using the `--format=json` flag. This is useful for scripting and integrating wkit's functionality into automated workflows. ```bash # Get worktree list as JSON wkit list --format=json ``` -------------------------------- ### wkit Configuration Commands (Bash) Source: https://github.com/takashabe/wkit/blob/main/README.md Shows how to interact with wkit's configuration settings. Commands allow displaying current settings, setting new values, and initializing local configuration files. Configuration can be managed globally or locally. ```bash # Show current configuration wkit config show # Set configuration values wkit config set wkit_root .git/.wkit-worktrees wkit config set auto_cleanup true wkit config set main_branch main # Create local configuration file wkit config init ``` -------------------------------- ### wkit Configuration System Overview Source: https://github.com/takashabe/wkit/blob/main/CLAUDE.md Details the hierarchical precedence of configuration settings for the wkit tool. Settings can be defined via command-line arguments, local project files, global user configuration, or built-in defaults. ```APIDOC wkit Configuration Precedence: 1. Command-line arguments (highest priority) 2. Local `.wkit.yaml` in current directory 3. Global `~/.config/wkit/config.yaml` 4. Built-in defaults (lowest priority) Configuration Keys: - `wkit_root`: Specifies the root directory for worktrees. - `auto_cleanup`: Enables or disables automatic cleanup of stale worktrees. - `default_sync_strategy`: Sets the default strategy for synchronizing worktrees. - `main_branch`: Defines the name of the main development branch. - `copy_files`: Controls whether files are copied when creating new worktrees. ``` -------------------------------- ### wkit Configuration File Options (YAML) Source: https://github.com/takashabe/wkit/blob/main/README.md Details the available configuration options for wkit, which can be set in local (`.wkit.yaml`) or global configuration files. These options control aspects like the default worktree root, automatic cleanup, sync strategy, and file copying. ```yaml # Default path for new worktrees wkit_root: ".git/.wkit-worktrees" # Automatically clean up deleted branches auto_cleanup: false # Default sync strategy (merge or rebase) default_sync_strategy: "merge" # Main branch name main_branch: "main" # Copy files to new worktrees copy_files: enabled: false files: - ".envrc" - ".env.local" - "compose.override.yaml" ``` -------------------------------- ### wkit Basic Worktree Management Commands (Bash) Source: https://github.com/takashabe/wkit/blob/main/README.md Demonstrates common wkit commands for managing Git worktrees. These include listing, adding, removing, switching, checking status, cleaning up, and syncing worktrees with the main branch. Supports specifying worktree paths and sync strategies (merge/rebase). ```bash # List all worktrees wkit list # Add a new worktree wkit add feature-branch wkit add feature-branch custom/path # Remove a worktree wkit remove feature-branch # Switch to a worktree (outputs path) cd $(wkit switch main) # Show status of all worktrees wkit status # Clean up worktrees wkit clean # Sync worktree with main branch wkit sync # current worktree wkit sync feature-branch # specific worktree wkit sync --rebase # use rebase instead of merge ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.