this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

zsh: task folder and worktree mgmt functions

+36 -62
+36 -62
zsh/zshenv
··· 37 37 alias wtl="git worktree list" 38 38 alias wtp="git worktree prune" 39 39 40 - # function wt { 41 - # task=${1-"task-$(date +%s)"} 42 - # base_branch=${2-$(git branch --show-current)} 43 - # repo_folder=$(basename $(pwd)) 44 - # 45 - # task_dir=$TASKS_DIR/$task 46 - # mkdir -p $task_dir 47 - # 48 - # git worktree add $task_dir/$repo_folder $base_branch 49 - # cd $task_dir/$repo_folder 50 - # } 51 - 52 40 alias lg="lazygit" 53 41 alias ld="lazydocker" 54 42 ··· 61 49 alias tm="${HOME}/dotfiles/scripts/tmopen.sh" 62 50 alias aic="aicommits --type conventional" 63 51 64 - # Load zapier-specific config if on my work machine 65 - ZAPIER_ZSHENV="${HOME}/projects/zapier/utils/zshenv" 66 - if [[ $(hostname) == "asteroid" && -f "${ZAPIER_ZSHENV}" ]]; then 67 - source "${ZAPIER_ZSHENV}" 68 - fi 52 + # find worktrunk worktree directories 53 + wtl() { 54 + find "${1:-.}" -type d -name '*.wt.*' 2>/dev/null 55 + } 56 + 57 + # Task workspace management 58 + alias tl="ls -laG $TASKS_DIR" 59 + alias cdt="cd ${TASKS_DIR}" 60 + 61 + function tn() { 62 + task_desc="${1-$(date +%s)}" 63 + task_dir="$TASKS_DIR/${task_desc}" 64 + mkdir -p "$task_dir" 65 + 66 + touch "$task_dir/TASK.md" 67 + cd "$task_dir" || { 68 + echo "failed to cd: ${task_dir}" 69 + return 1 70 + } 71 + } 72 + 73 + function tcd() { 74 + local selected 75 + selected=$(find "$TASKS_DIR" -maxdepth 1 -mindepth 1 -type d 2>/dev/null | 76 + sed 's|^'"$TASKS_DIR"'/||' | 77 + fzf --height 40% --reverse --preview "ls -la $TASKS_DIR/{}" \ 78 + --preview-window=right:50%:wrap) 79 + if [[ -n "$selected" ]]; then 80 + cd "$TASKS_DIR/$selected" || return 1 81 + fi 82 + } 69 83 70 84 # Accepts a target markdown file and opens it with firefox. 71 85 # ··· 96 110 date +%s | shasum | head -c$1 97 111 } 98 112 99 - # Task management 100 - task() { 101 - # Check if .tasks/ folder exists 102 - if [[ ! -d ".tasks" ]]; then 103 - echo "Error: .tasks/ folder not found in current directory" >&2 104 - return 1 105 - fi 106 - 107 - # Check if task name was provided 108 - if [[ -z "$1" ]]; then 109 - echo "Usage: task <task-name>" >&2 110 - return 1 111 - fi 112 - 113 - local timestamp=$(date +"%y%m%d%H%M") 114 - local task_name=$(echo "$*" | tr '[:upper:]' '[:lower:]' | tr ' ' '-') 115 - local folder_name=".tasks/${timestamp}-${task_name}" 116 - 117 - mkdir -p "$folder_name" 118 - touch "$folder_name/TASK.md" 119 - echo "You are working on @TASK.md, use that file as your long term memory for the task" >"$folder_name/AGENTS.md" 120 - ln -s "$folder_name/AGENTS.md" "$folder_name/CLAUDE.md" 121 - echo "$folder_name/TASK.md" 122 - } 123 - 124 113 function gittmp { 125 114 repo_uri=$1 126 115 if [ -z "$1" ]; then ··· 136 125 tmux switch -t $session_name 137 126 } 138 127 139 - # Opens for today's note in ~/obsidian/brain/Daily/ 140 - # Gets timestamp formatted like YYYY-MM-DD.md 141 - function dn { 142 - vault="brain" 143 - if [[ $(hostname) == "asteroid" ]]; then 144 - vault="zapier" 145 - fi 146 - 147 - daily_notes="$HOME/.obsidian/${vault}/Daily/" 148 - todays_note="$(date +%Y-%m-%d).md" 149 - 150 - cd $daily_notes 151 - nvim -c "Goyo" -c $'normal Go\eo***\eo\eo' -c "startinsert" $todays_note 152 - } 153 - 154 128 function gbrowse() { 155 129 branch=$(git branch --show-current) 156 130 if [ -z "$branch" ]; then ··· 172 146 fi 173 147 } 174 148 175 - function aicode { 176 - claude -p \ 177 - --append-system-prompt "Respond with only the code requested, absolutely no extra dialog, backticks, or anything else. The response should be suitable for directly injecting into a source file. If needed, use the web search tool to look up syntax or documentation to ensure the result is accurate." \ 178 - --allowedTools "WebSearch,WebFetch" \ 179 - } 149 + # Load zapier-specific config if on my work machine 150 + ZAPIER_ZSHENV="${HOME}/projects/zapier/utils/zshenv" 151 + if [[ $(hostname) == "asteroid" && -f "${ZAPIER_ZSHENV}" ]]; then 152 + source "${ZAPIER_ZSHENV}" 153 + fi 180 154 181 155 export HOMEBREW_BUNDLE_FILE="$HOME/dotfiles/Brewfile" 182 156