This guide explains how to develop and test Keycutter features locally.
When developing Keycutter features, you often need to test configuration changes without pulling from git. The update subcommands make this easy:
# From your feature branch or worktree
keycutter update configThis updates your SSH config files from the current directory without performing a git pull.
# Update only SSH config
keycutter update config
# Check requirements only
keycutter update requirements
# Update touch detector only
keycutter update touch-detectorYou can override the Keycutter installation directory:
# Test from a different directory
KEYCUTTER_ROOT=/path/to/your/worktree keycutter update config
# Or export it for the session
export KEYCUTTER_ROOT=/path/to/your/worktree
keycutter update configGit worktrees are ideal for developing Keycutter features:
# Create a new worktree for your feature
git worktree add ../keycutter-my-feature -b feat/my-feature
# Navigate to the worktree
cd ../keycutter-my-feature
# Make your changes
vim bin/keycutter
# Test your changes locally
./bin/keycutter update config
# Or install from the worktree
KEYCUTTER_ROOT=$(pwd) ./install.sh# Run all tests
make test
# Run specific test file
./test/run_tests.sh test_keycutter.bats
# Run with verbose output
make test-verbose
# Run specific test
bats test/test_keycutter.bats -f 'update'Before committing, ensure your code passes quality checks:
# Run shellcheck
make shellcheck
# Clean test artifacts
make cleanThe keycutter update command has been modularized into subcommands:
Runs the full update sequence:
- Pull from git (only on master branch)
- Check requirements
- Update SSH config
- Update touch detector
- Pulls latest changes from the git repository
- Only works on the master branch
- Skips update if on a feature branch
- Updates SSH config files from the current installation
- Preserves existing host files
- Shows diffs and prompts for overwrites
- Perfect for testing local changes
- Checks system requirements
- Verifies all dependencies are installed
- Updates the YubiKey touch notification tool
- Only prompts if FIDO keys are detected
- Edit the template in
ssh_config/keycutter/ - Run
keycutter update configto install it - Verify with
keycutter config <hostname>
- Create the service module in
lib/ - Add SSH config in
ssh_config/keycutter/hosts/ - Update keytag detection in
bin/keycutter - Test with
keycutter create service.com_username - Update documentation
# See what config would be used
keycutter config github.com_alex
# Test the connection with verbose output
ssh -vvv github.com_alex
# Check which keys would be offered
keycutter authorized-keys github.com_alex- Fork the repository
- Create a feature branch
- Make your changes
- Run tests and shellcheck
- Update documentation
- Submit a pull request
Remember to:
- Follow existing code style
- Add tests for new features
- Update help text when adding commands
- Document any new environment variables