fb5445915f
`issue.store_root` and `_gitea.PAYLOAD_ROOT` were anchored on `__file__`, on
the reasoning that where an installation keeps its files is a fact about the
installation. That holds for an installation and not for a store.
Installed, the plugin therefore resolved every project's issues inside its own
directory — and a plugin cache is versioned, so the store moved on each
update:
~/.claude/plugins/cache/tea/tea/2.0.0/tmp/issues 5 files, 2 origin: local
~/.claude/plugins/cache/tea/tea/2.1.0/tmp/issues 12 files
~/.claude/plugins/cache/claude-skills/tea/2.2.0/ empty, the current one
Issues written from one project were invisible from the next, and an `origin:
local` file — which IS the issue, the only copy — was stranded a version bump
at a time. Two of them were.
The store is a fact about the project, exactly as the login pin is. So the
anchor is now an explicit marker an operator creates, `.tea/`, searched for up
from $CLAUDE_PROJECT_DIR and then cwd — the pin's order, so the two cannot
disagree about which project this is. Inferred markers were tried and are worse
than useless here: `.git` is in every clone including this plugin's own, and
the agents-sync hook writes an AGENTS.md next to every AGENTS.md, so the plugin
root always carried one and cwd never got a turn.
With no marker anywhere, `store_root()` is None and every entry point reports
which directories it searched. A store in a plausible-looking directory is the
failure this replaces, so nothing falls back to one.
- `.tea/` holds the store and the transport's scratchpad: `.tea/issues`,
`.tea/payload`. One marker, one walk, one gitignore line.
- `issue_init.py` creates it, moves an old `tmp/issues` store in rather than
copying, adds `.tea/` to `.gitignore`, and refuses to pick a winner when both
sides hold the same file name.
- A linked worktree has no marker — it is gitignored — and reaches the main
checkout's store by the hop the pin already took.
- `parents`, `gitdir_of` and `main_worktree` move from `pin.py` into the domain
and `pin.py` imports them. The domain depends on nothing, so it is the layer
all three callers can borrow from, and the walk stays written once: the
guard, the transport and the store cannot disagree about a directory.
The suite stopped copying the script layers into its fixtures. That is what hid
this: with the scripts inside the fixture, the installation and the project
were the same directory. They are now deliberately far apart, and a regression
test asserts the plugin tree gains no files when commands run against a project
somewhere else.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
75 lines
3.0 KiB
Python
75 lines
3.0 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
remote.py — what exists in Gitea, one line each.
|
|
|
|
Discovery only: prints to stdout and writes nothing. The local store is a
|
|
store, not a search-results folder, so a listing never lands in it. Pick the
|
|
numbers here, then pull them.
|
|
|
|
#42 open type/task, tech/sql Wire sqlc into the repo layer
|
|
└─ local: wire-sqlc-appclick
|
|
|
|
The second line appears when the issue is already in the local store, so it is
|
|
obvious what a pull would refresh versus what it would add.
|
|
|
|
Usage:
|
|
remote.py [--state open|closed|all] [--label L]… [-q TEXT]
|
|
[--milestone M] [--limit N] [--repo owner/repo]
|
|
|
|
`--limit` here caps the LISTING: N lines out, closed ones among them. That is
|
|
not what the same flag means to `pull.py`, and the difference is not an
|
|
oversight — pull.py bounds what it writes, and this command writes nothing, so
|
|
there is nothing else for a limit to bound. Enumeration is the whole job.
|
|
|
|
Login: the operator's pin from .claude/settings.local.json (see /tea:auth).
|
|
"""
|
|
import argparse
|
|
import os
|
|
import sys
|
|
|
|
_HERE = os.path.dirname(os.path.abspath(__file__))
|
|
sys.path[:0] = [_HERE, os.path.normpath(os.path.join(_HERE, "..", "..", "issue", "scripts"))]
|
|
|
|
import _gitea # noqa: E402
|
|
import issue # noqa: E402
|
|
import map as gmap # 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)")
|
|
ap.add_argument("--out", default=issue.ISSUE_ROOT,
|
|
help="store root (default: <project>/.tea/issues)")
|
|
args = ap.parse_args()
|
|
|
|
login = _gitea.require_login()
|
|
base = _gitea.repo_base(args.repo)
|
|
payloads, ms_title = _gitea.list_issues(
|
|
login, base, state=args.state, labels=args.label, query=args.query,
|
|
milestone=args.milestone, limit=args.limit)
|
|
|
|
remote_map = _gitea.load_map(args.out)
|
|
repo = _gitea.repo_slug(login, args.repo) if remote_map else None
|
|
|
|
for p in payloads:
|
|
labels = ", ".join(l.get("name", "") for l in p.get("labels") or []) or "-"
|
|
print("#%-5d %-7s %-38s %s" % (p["number"], p.get("state", ""),
|
|
labels[:38], p.get("title", "")))
|
|
local = remote_map.get(gmap.remote_key(repo, p["number"])) if repo else None
|
|
if local:
|
|
print("%13s└─ local: %s" % ("", local))
|
|
|
|
scope = " in milestone %s" % ms_title if ms_title else ""
|
|
hint = ("--milestone %s" % args.milestone) if args.milestone else "<n>"
|
|
print("%d issue(s)%s — pull them with: pull.py %s" % (len(payloads), scope, hint))
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|