#!/usr/bin/env sh #MISE description="Create a workspace for an agent to work in beside others" #USAGE arg "" help="The number that names the workspace" #USAGE arg "[base]" help="The revision to start from" set -e case "$1" in "" | *[!0-9]*) echo "id must be a number" >&2 exit 1 ;; esac id="$1" dir="tmp/worktrees/ws${id}" mkdir -p tmp/worktrees if [ -d .jj ]; then jj workspace add "$dir" --name "ws${id}" -r "${2:-@-}" else git worktree add -b "ws${id}" "$dir" "${2:-HEAD}" fi mise trust --quiet "$dir/.config/mise.toml"