#!/bin/bash # description: Mark a plan as in-progress (rename __todo -> __wip) # Args: # Output: new filename set -euo pipefail _find_beads() { local d="$PWD"; while [ "$d" != "/" ]; do [ -d "$d/.beads" ] && return 0; d="$(dirname "$d")"; done; return 1; } if [ "${OLLIE_BEADS_ENABLE:-1}" != "0" ] && command -v bd >/dev/null 2>&1 && _find_beads; then echo "error: beads is available — use 'bd' for planning instead of plan_start" >&2 exit 2 fi OLLIE="${OLLIE:-$HOME/mnt/ollie}" PLAN_DIR="$OLLIE/pl" [ $# -eq 1 ] || { echo "usage: plan_start "; exit 1; } SRC="$PLAN_DIR/$(basename "$1")" [ -f "$SRC" ] || { echo "error: plan not found: $(basename "$1")"; exit 1; } case "$SRC" in *__todo.md) ;; *) echo "error: plan is not tagged __todo: $(basename "$SRC")"; exit 1 ;; esac DST="${SRC/__todo.md/__wip.md}" mv "$SRC" "$DST" echo "$(basename "$DST")"