Create a Pull Request for a Marshroom cart issue matching the current branch with proper closing keywords
Create a Pull Request for a Marshroom cart issue matching the current branch.
pending with prNumber and prURL in ${MARSHROOM_STATE:-~/.config/marshroom/state.json}. If this fails, stop and report the error — do NOT silently continue.marsh pr if available; otherwise fall back to direct jq atomic write (see step 9).${MARSHROOM_STATE:-~/.config/marshroom/state.json} and parse the JSONgit branch --show-current to get the current branch namebranchName match/#N suffix match (e.g., current branch HotFix/#20 matches cart entry with branchName: "Feature/#20" because both end with )/#20git push -u origin HEADissueBody field (non-null), include it under a "## Original Issue" section for reviewer contextclose #<issueNumber> (this is mandatory for auto-closing the issue)gh pr create:
gh pr view --json body -q '.body'close #<issueNumber> is NOT found in the body, fix it: gh pr edit --body "$(gh pr view --json body -q '.body')\n\nclose #<issueNumber>"gh pr view --json number,url -q '.number,.url'marsh prmarsh is not found in PATH, fall back to direct atomic update using the PR number and URL from step 8:
STATE_FILE="${MARSHROOM_STATE:-~/.config/marshroom/state.json}"
TMP="$(mktemp "${STATE_FILE}.XXXXXX")"
jq --argjson n ISSUE_NUMBER --argjson prNum PR_NUMBER --arg prUrl "PR_URL" \
'.cart |= map(if .issueNumber == $n then .status = "pending" | .prNumber = $prNum | .prURL = $prUrl else . end)' \
"$STATE_FILE" > "$TMP" && mv -f "$TMP" "$STATE_FILE"
pending