Files
using.cash/scripts/agent-worktree.sh
T
rick 212f19ac19 Add v6-rewrite OpenSpec: proposal, design, specs, and tasks
Complete specification for rewriting Swarmops v5 as using.cash v6:
- Proposal: scope buckets (Working Rewrite / First Beyond Working / Maybe),
  non-goals (governance, geography, memberships permanently cut)
- Design: 18 architectural decisions including preserved patterns
  (Basic/Logic, stored procs, credential split), new patterns (repository
  classes, chain abstraction, rate providers), and operational concerns
  (Galera awareness, continuation transactions, VAT booking, OOD
  denormalization)
- Specs: 17 capability specifications with SHALL/MUST requirements and
  WHEN/THEN scenarios, covering accounting core, AP/AR, crypto treasury,
  exchange rates, organizations, users/auth, documents, comms, dashboard,
  end-of-month, backend worker, event bus, data migration, API layer,
  frontend app, and CI/packaging
- Tasks: 145 implementation tasks grouped by subsystem, ordered by
  dependency (migration gates API/frontend work)

Two rounds of adversarial review incorporated.

Made-with: Cursor
2026-04-08 16:02:58 +02:00

64 lines
1.3 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
usage() {
echo "Usage:"
echo " $0 create <topic> [base-branch]"
echo " $0 list"
echo " $0 remove <topic>"
exit 1
}
sanitize_topic() {
local topic="${1:-}"
if [[ -z "$topic" ]]; then
usage
fi
echo "$topic" | tr '[:upper:]' '[:lower:]' | tr ' ' '-' | tr -cd 'a-z0-9._-'
}
cmd="${1:-}"
case "$cmd" in
create)
topic="$(sanitize_topic "${2:-}")"
base="${3:-falken-qol}"
branch="agent/${topic}"
wt_root=".worktree"
wt_path="${wt_root}/${topic}"
mkdir -p "$wt_root"
if [[ -e "$wt_path" ]]; then
echo "Worktree path already exists: $wt_path"
exit 1
fi
git fetch --all --prune
git worktree add "$wt_path" -b "$branch" "$base"
{
echo "owner=${USER:-unknown}"
echo "task=${topic}"
echo "branch=${branch}"
date -u +"created_at=%Y-%m-%dT%H:%M:%SZ"
} > "${wt_path}/.agent-lock"
echo "Created worktree: $wt_path"
echo "Branch: $branch"
;;
list)
git worktree list
;;
remove)
topic="$(sanitize_topic "${2:-}")"
wt_path=".worktree/${topic}"
if [[ ! -d "$wt_path" ]]; then
echo "Worktree path not found: $wt_path"
exit 1
fi
git worktree remove "$wt_path"
echo "Removed worktree: $wt_path"
;;
*)
usage
;;
esac