feat(worktree-lifecycle): add PR tracking and safe destroy #138

Merged
shoko merged 4 commits from feat/worktree-lifecycle into main 2026-04-05 06:00:15 +02:00
Showing only changes of commit b8b97e3c09 - Show all commits

View File

@@ -78,7 +78,7 @@ Usage:
kugetsu destroy <issue-ref> [-y] Delete session for issue kugetsu destroy <issue-ref> [-y] Delete session for issue
kugetsu destroy --pm-agent [-y] Delete pm-agent session (not recommended) kugetsu destroy --pm-agent [-y] Delete pm-agent session (not recommended)
kugetsu destroy --base [-y] Delete base session kugetsu destroy --base [-y] Delete base session
kugetsu update-pr <issue-ref> <pr-url> Update PR URL for session (for PR tracking) kugetsu set-pr <issue-ref> <pr-url> Set PR URL for session (for PR tracking)
Outdated
Review

do we really have this update-pr command?

do we really have this update-pr command?
kugetsu help Show this help kugetsu help Show this help
Issue Ref Format: Issue Ref Format:
@@ -1499,6 +1499,7 @@ EOF
cmd_start() { cmd_start() {
local issue_ref="" local issue_ref=""
local message="" local message=""
local pr_url=""
local args=("$@") local args=("$@")
args=$(set_debug_mode "${args[@]}") args=$(set_debug_mode "${args[@]}")
@@ -1508,11 +1509,14 @@ cmd_start() {
issue_ref="$arg" issue_ref="$arg"
elif [ -z "$message" ]; then elif [ -z "$message" ]; then
message="$arg" message="$arg"
elif [ -z "$pr_url" ]; then
pr_url="$arg"
fi fi
done done
if [ -z "$issue_ref" ] || [ -z "$message" ]; then if [ -z "$issue_ref" ] || [ -z "$message" ]; then
echo "Error: start requires <issue-ref> and <message>" >&2 echo "Error: start requires <issue-ref> and <message>" >&2
echo "Usage: kugetsu start <issue-ref> <message> [pr-url]" >&2
exit 1 exit 1
fi fi
@@ -1654,7 +1658,7 @@ session = {
"created_at": "$(date -Iseconds)", "created_at": "$(date -Iseconds)",
"state": "idle", "state": "idle",
"branch_name": "$branch_name", "branch_name": "$branch_name",
"pr_url": None "pr_url": "$pr_url" if "$pr_url" else None
} }
with open("$SESSIONS_DIR/$session_file", "w") as f: with open("$SESSIONS_DIR/$session_file", "w") as f:
@@ -2021,12 +2025,12 @@ main() {
destroy) destroy)
Outdated
Review

remove git.fbrns.co here. just use github as example

remove git.fbrns.co here. just use github as example
cmd_destroy "$@" cmd_destroy "$@"
;; ;;
update-pr) set-pr)
local issue_ref="${1:-}" local issue_ref="${1:-}"
Review

dont put git.fbrns.co here

dont put git.fbrns.co here
local pr_url="${2:-}" local pr_url="${2:-}"
if [ -z "$issue_ref" ] || [ -z "$pr_url" ]; then if [ -z "$issue_ref" ] || [ -z "$pr_url" ]; then
echo "Usage: kugetsu update-pr <issue-ref> <pr-url>" >&2 echo "Usage: kugetsu set-pr <issue-ref> <pr-url>" >&2
echo "Example: kugetsu update-pr github.com/shoko/kugetsu#14 https://git.fbrns.co/shoko/kugetsu/pulls/123" >&2 echo "Example: kugetsu set-pr github.com/shoko/kugetsu#14 https://git.fbrns.co/shoko/kugetsu/pulls/123" >&2
exit 1 exit 1
fi fi
validate_issue_ref "$issue_ref" validate_issue_ref "$issue_ref"