char-fork/llama.cpp
git clone https://git.t4t.associates/char-fork/llama.cpp
c3f95c1f0
char/aliceai-t5-moe
1#!/usr/bin/env bash 2 3# initialize a new worktree from a branch name: 4# 5# - creates a new branch from current HEAD 6# - creates a new worktree in a parent folder, suffixed with the branch name 7# 8# sample usage: 9# ./scripts/wc2wt.sh gg/new-feature-foo-bar 10# ./scripts/wc2wt.sh gg/new-feature-foo-bar opencode 11# ./scripts/wc2wt.sh gg/new-feature-foo-bar "cmake -B build && cmake --build build" 12# ./scripts/wc2wt.sh gg/new-feature-foo-bar "bash -l" 13 14function usage () { 15echo "usage: $ 0 <branch_name> [cmd]" 16exit 1 17} 18 19# check we are in the right directory 20if [[ ! -f"scripts/wc2wt.sh" ]];then 21echo "error: this script must be run from the root of the repository" 22exit 1 23fi 24 25if [[$ # -lt 1 ||$ # -gt 2 ]];then 26usage 27fi 28 29BRANCH =$ 1 30 31if [[ -z" $ BRANCH " ]];then 32echo "error: branch name must not be empty" 33exit 1 34fi 35 36dir =$( basename $( pwd )) 37# sanitize branch name for directory name (replace / with -) 38dir_suffix =$( echo " $ BRANCH " | tr '/' '-' ) 39 40git worktree add"../ $ dir - $ dir_suffix " " $ BRANCH " ||git worktree add-b " $ BRANCH " "../ $ dir - $ dir_suffix " HEAD 41 42og_path =$( pwd ) 43wt_path =$( cd "../ $ dir - $ dir_suffix " && pwd ) 44 45echo "git worktree created in $ wt_path " 46 47cd " $ wt_path " 48 49# pi agent setup in the worktree 50if [[ -f" $ og_path /.pi/SYSTEM.md" && ! -f".pi/SYSTEM.md" ]];then 51mkdir -p .pi 52ln -sfn " $ og_path /.pi/SYSTEM.md" .pi/SYSTEM.md 53fi 54 55if [[$ # -eq 2 ]];then 56echo "executing: $ 2 " 57eval " $ 2 " 58fi