Skip to content

Commit 8ce78ec

Browse files
NiveditJainclaude
andauthored
[luv-2] Query /pulls alongside /issues so folder numbers match next issue/PR (#19)
GitHub's /repos/{owner}/{repo}/issues endpoint is documented to include PRs but returns [] for repos with no plain issues — luv only has PRs, so the previous filter=all fix was a no-op (filter applies only to user-scoped issues, not repo-scoped). Result: latest=0, candidate=1, while-loop bumped past existing ~/prs/luv-1 to luv-2 instead of the expected luv-19. Query /issues and /pulls separately and take the max. Bumps to 0.0.13. Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
1 parent abde627 commit 8ce78ec

2 files changed

Lines changed: 13 additions & 8 deletions

File tree

luv/__init__.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -682,13 +682,18 @@ def main() -> None:
682682
if r.returncode != 0:
683683
die(f"repo '{org}/{repo}' not found or gh auth failed.\n{r.stderr.strip()}")
684684

685-
# 2. Get latest issue/PR number (shared counter on GitHub)
686-
r = run(["gh", "api",
687-
f"repos/{org}/{repo}/issues?state=all&filter=all&per_page=1&sort=created&direction=desc"])
688-
if r.returncode != 0:
689-
die(f"failed to fetch issues.\n{r.stderr.strip()}")
690-
items = json.loads(r.stdout)
691-
latest = items[0]["number"] if items else 0
685+
# 2. Get latest issue/PR number (shared counter on GitHub).
686+
# /issues is documented to include PRs but in practice returns [] for repos
687+
# with no plain issues, so query both endpoints and take the max.
688+
def _latest(endpoint: str) -> int:
689+
r = run(["gh", "api",
690+
f"repos/{org}/{repo}/{endpoint}?state=all&per_page=1&sort=created&direction=desc"])
691+
if r.returncode != 0:
692+
die(f"failed to fetch {endpoint}.\n{r.stderr.strip()}")
693+
items = json.loads(r.stdout)
694+
return items[0]["number"] if items else 0
695+
696+
latest = max(_latest("issues"), _latest("pulls"))
692697
candidate = latest + 1
693698

694699
# 3. Find free local folder

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "luv-cli"
7-
version = "0.0.12"
7+
version = "0.0.13"
88
description = "Launch Claude Code agents on GitHub repos with isolated workspaces and optional Docker dev environments"
99
requires-python = ">=3.10"
1010
license = "MIT"

0 commit comments

Comments
 (0)