#!/usr/bin/env python3 """ issue_list.py — discovery: which issue numbers exist, one line each. Prints to stdout and writes nothing: INDEX.md is a map of the local cache, and this command deliberately does not pollute it. Use it to pick numbers, then fetch them with issue_get.py. #42 open type/task, tech/sql Wire sqlc into the repo layer Usage: issue_list.py [--state open|closed|all] [--label L]… [-q TEXT] [--milestone M] [--limit N] [--page N] [--repo owner/repo] Login: the operator's pin from .claude/settings.local.json (see /tea:auth). """ import argparse import os import sys sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) from _tea import list_issues, repo_base, require_login # noqa: E402 def main(): ap = argparse.ArgumentParser(description="List Gitea issues (stdout only, no files)") ap.add_argument("--state", default="open", choices=["open", "closed", "all"]) ap.add_argument("--label", action="append", default=[], help="filter by label; repeat for AND") ap.add_argument("-q", "--query", help="search text in title/body") ap.add_argument("--milestone", help="milestone id or title") ap.add_argument("--limit", type=int, default=30) ap.add_argument("--repo", help="owner/repo (default: auto-detect from CWD git remote)") args = ap.parse_args() login = require_login() got, ms_title = list_issues(login, repo_base(args.repo), state=args.state, labels=args.label, query=args.query, milestone=args.milestone, limit=args.limit) for iss in got: labels = ", ".join(l.get("name", "") for l in iss.get("labels") or []) or "-" print("#%-5d %-7s %-38s %s" % (iss["number"], iss.get("state", ""), labels[:38], iss.get("title", ""))) scope = " in milestone %s" % ms_title if ms_title else "" print("%d issue(s)%s — fetch them with: issue_get.py %s" % (len(got), scope, ("--milestone %s" % args.milestone) if args.milestone else "")) if __name__ == "__main__": main()