feat(worktree-lifecycle): add PR tracking and safe destroy #138
Reference in New Issue
Block a user
Delete Branch "feat/worktree-lifecycle"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Overview
Implements #135 - Worktree lifecycle management with PR check.
Changes
New Configuration
WORKTREE_CHECK_PR_STATUS=true(default) - Check PR status before destroySession File Enhancement
Session files now include
pr_urlandbranch_name:New Command
Updates the PR URL in the session file. Dev agents should call this when they create a PR.
PR Status Check on Destroy
kugetsu destroy <issue>checks PR status via APIkugetsu destroy <issue> --forcebypasses the checkAPI Support
Related Issues
Closes #135
why do we have to create a specific command to create a PR? what if the PR already exist? should we handle it as well? what if we need it for different instance, how can user update it without changing the script?
please adjust
@@ -13,6 +13,7 @@ VERBOSITY_DIR="$KUGETSU_DIR/verbosity"MAX_CONCURRENT_AGENTS="${MAX_CONCURRENT_AGENTS:-3}"KUGETSU_VERBOSITY="${KUGETSU_VERBOSITY:-default}"WORKTREE_CHECK_PR_STATUS="${WORKTREE_CHECK_PR_STATUS:-true}"what is the default value of this?
@@ -78,2 +79,3 @@kugetsu destroy --pm-agent [-y] Delete pm-agent session (not recommended)kugetsu destroy --base [-y] Delete base sessionkugetsu destroy --base [-y] Delete base sessionkugetsu update-pr <issue-ref> <pr-url> Update PR URL for session (for PR tracking)do we really have this update-pr command?
@@ -259,0 +269,4 @@local api_url=""local token=""if [[ "$pr_url" =~ git\.fbrns\.co ]]; thenI don't want this to be in the code. this should be a custom configurable. don't we have repos.json or anything? or servers.json? I forget. the place where we configure which instances are we using (github, gitlab, selfhosted gitea, etc)
@@ -259,0 +276,4 @@api_url=$(echo "$pr_url" | sed -E 's|https://github\.com/([^/]+)/([^/]+)/pulls/([0-9]+)|https://api.github.com/repos/\1/\2/pulls/\3|')token="${GITHUB_TOKEN:-}"elseecho "unknown_server"this is totally killing the feature in a way that the git instance should be registered here wont work in the open internet
@@ -259,0 +287,4 @@response=$(curl -s "$api_url" 2>/dev/null || echo "{}")fiif [[ "$pr_url" =~ git\.fbrns\.co ]]; thensame with this, I dont want to be hardcoded here the domain. it should be configurable in a way user could always add later, by not changing this script
@@ -1890,0 +2026,4 @@local pr_url="${2:-}"if [ -z "$issue_ref" ] || [ -z "$pr_url" ]; thenecho "Usage: kugetsu update-pr <issue-ref> <pr-url>" >&2echo "Example: kugetsu update-pr github.com/shoko/kugetsu#14 https://git.fbrns.co/shoko/kugetsu/pulls/123" >&2dont put git.fbrns.co here
@@ -1890,0 +2022,4 @@local pr_url="${2:-}"if [ -z "$issue_ref" ] || [ -z "$pr_url" ]; thenecho "Usage: kugetsu set-pr <issue-ref> <pr-url>" >&2echo "Example: kugetsu set-pr github.com/shoko/kugetsu#14 https://git.fbrns.co/shoko/kugetsu/pulls/123" >&2remove git.fbrns.co here. just use github as example
ce4116bcb1toac850869fdlgtm