From abde765472dfbfb3fb1ab0249187687ac4a66e3f Mon Sep 17 00:00:00 2001 From: Defame1297 Date: Tue, 24 Nov 2026 21:39:18 +0000 Subject: [PATCH] docs(agents): make issue-tracker.md tool-neutral and name tea as the supported tool issue-tracker.md becomes Conventions (operations as Gitea concepts) and a Tool section with one tea command per operation, tea api for blocked_by dependencies. It names no skill or MCP tool, and drops the maintainer-only token and account-lookup lines. setup.md adds The tracker: install tea 0.14.2 or later and log in with a token of your own account. dev-setup.sh warns when tea is missing or older; it installs nothing. Closes #267 Assisted-by: Claude Code --- docs/agents/issue-tracker.md | 46 +++++++++++++++------- docs/contributing/setup.md | 17 +++++++++ scripts/dev-setup.sh | 21 +++++++++++ tests/scripts/test_dev_setup.py | 67 +++++++++++++++++++++++++++++++++ 4 files changed, 138 insertions(+), 13 deletions(-) diff --git a/docs/agents/issue-tracker.md b/docs/agents/issue-tracker.md index b579d01..41d5841 100644 --- a/docs/agents/issue-tracker.md +++ b/docs/agents/issue-tracker.md @@ -1,30 +1,50 @@ # Issue tracker: Gitea -Issues and specs for this repo live as Gitea issues on `mortis/kamino` (https://git.rkdr.net/mortis/kamino). Use the `gitea-issues` skill and the Gitea MCP tools (`mcp__gitea__issue_read`, `issue_write`, `list_issues`, `search_issues`); there is no `gh` or `glab`. Pull requests are a different object: `gitea-prs`. +Issues and specs for this repo live as Gitea issues on `mortis/kamino` (https://git.rkdr.net/mortis/kamino). +The Conventions below hold whatever client you use; the Tool section gives the supported one. ## Conventions -- **Create an issue**: `issue_write` (method `create`) with `title` and `body`. -- **Read an issue**: `issue_read`, which returns the body, labels and comments. -- **List issues**: `list_issues` or `search_issues`, filtered by state and label. -- **Comment on an issue**: `issue_write` with the comment method. -- **Apply / remove labels**: label names are resolved to IDs with `label_read` (`list_repo_labels`); see `triage-labels.md`. -- **Close**: post the explanation as a comment first, then close the issue. +- **Operations**: create an issue (title, body, labels, milestone); read an issue with its comments; + comment; add and remove a label; assign; set the milestone; close; search by text, label or state; + add, list and remove a `blocked_by` dependency. +- **Number space**: issues and pull requests share one number space in Gitea, so confirm which one + `#N` refers to before acting on it. Pull requests are a different object from issues. - **Sub-issues**: Gitea has no parent link. Put `Part of #` on the first line of the child body. -- **Blocking**: use Gitea's native dependencies (`issue_write`, method `add_dependency`, `dependency_type: blocked_by`), so the issue page shows what blocks it. A ticket is unblocked when every blocker is closed. - -Issues and pull requests share one number space in Gitea, so confirm which one `#N` refers to before acting on it. - -File issues only into `mortis/kamino`. The configured token holds `write:issue` and `write:repository` but not `read:organization`, so organisation-level labels cannot be read. +- **Blocking**: use Gitea's native dependencies (a `blocked_by` dependency on the blocked issue), so + the issue page shows what blocks it. A ticket is unblocked when every blocker is closed. +- **Close**: post the explanation as a comment first, then close the issue. +- **Labels**: the repo uses Gitea's scoped labels; see `triage-labels.md` for which to use. +- **Repository**: file issues only into `mortis/kamino`. ## Wayfinding operations - **Map**: one issue labelled `Wayfinder/Map`. - **Ticket**: a child issue of the map (`Part of #`) with one type label: `Wayfinder/Grilling`, `Wayfinder/Research`, `Wayfinder/Prototype` or `Wayfinder/Task`. Maps and tickets carry no `Status/` label. -- **Claim**: assign the ticket to the Gitea account of the person driving the session, before any work. Ask for the account if it is not known; the token cannot look it up. An open, unassigned ticket is unclaimed. +- **Claim**: assign the ticket to the Gitea account of the person driving the session, before any work. An open, unassigned ticket is unclaimed. - **Frontier**: the open, unassigned tickets of the map with no open blocker. - **Resolve**: post the answer as a comment, close the ticket, then add one line to the map's "Decisions so far". ## Pull requests as a triage surface **PRs as a request surface: no.** Fork and AGit pull requests are closed unmerged ([reviewing.md](../contributing/reviewing.md)), so PRs do not enter the triage queue. Set to `yes` only if that changes. + +## Tool + +`tea` 0.14.2 or later is the supported client: the docs and skills assume it, and +`docs/contributing/setup.md` says how to install it and log in. It is not a rule; any client may be used if the Conventions hold. Run the +commands inside the clone, where `tea` finds the repository from `origin`, or add `--repo mortis/kamino`. + +| Operation | Command | +| --- | --- | +| Create | `tea issues create --title '' --description-file body.md --labels '<a>,<b>' --milestone '<name>'` | +| Read with comments | `tea issues <n> --comments` | +| Comment | `tea comment <n> '<body>'` | +| Add / remove a label | `tea issues edit <n> --add-labels '<label>'` / `--remove-labels '<label>'` | +| Assign | `tea issues edit <n> --add-assignees <account>` | +| Milestone | `tea issues edit <n> --milestone '<name>'` | +| Close | `tea issues close <n>` | +| Search | `tea issues list --state all --keyword '<text>' --labels '<label>'` | +| List blockers | `tea api 'repos/{owner}/{repo}/issues/<n>/dependencies'` | +| Add a blocker | `tea api -X POST 'repos/{owner}/{repo}/issues/<n>/dependencies' -d '{"index": <blocker>, "owner": "mortis", "repo": "kamino"}'` | +| Remove a blocker | `tea api -X DELETE 'repos/{owner}/{repo}/issues/<n>/dependencies' -d '{"index": <blocker>, "owner": "mortis", "repo": "kamino"}'` | diff --git a/docs/contributing/setup.md b/docs/contributing/setup.md index 3564198..7f023ac 100644 --- a/docs/contributing/setup.md +++ b/docs/contributing/setup.md @@ -24,6 +24,23 @@ held by review until an offline link check exists. *Reason:* a finding only that test reports stops the push instead of the Build check. *Held by:* control: the pre-push hook, and the Build check. +## The tracker + +- **Install `tea` 0.14.2 or later**, by any of its official routes: Homebrew (`brew install tea`), + your distribution's package, or a release binary from https://gitea.com/gitea/tea/releases checked + against that release's `checksums.txt`, whose `checksums.txt.sig` is signed by the Gitea release + key (`7C9E68152594688862D62AF62D9AE806EC1592E2`). + *Reason:* it is the client [issue-tracker.md](../agents/issue-tracker.md) gives commands for, and + those commands assume 0.14.2 or later. + *Held by:* aspirational (`scripts/dev-setup.sh` warns when `tea` is missing or older). +- **Log in with a token of your own account, with the scopes `write:issue` and `read:user` only:** + `tea login add --url https://git.rkdr.net --token '<your-token>'`. Create the token under + Settings > Applications on the forge. `tea login add` needs `read:user`; that `write:issue` covers + every command of the Tool section is checked in issue #360. + *Reason:* what you or your agent do on the tracker is then yours, and a token that leaks can do no + more than edit issues. + *Held by:* aspirational. + ## Agent tools - **Use Claude Code 2.1.281 or later.** diff --git a/scripts/dev-setup.sh b/scripts/dev-setup.sh index fcfc8c3..a59cede 100755 --- a/scripts/dev-setup.sh +++ b/scripts/dev-setup.sh @@ -158,4 +158,25 @@ for hook in pre-commit commit-msg pre-push; do fi done +# tea is the supported tracker client (docs/agents/issue-tracker.md); only warn, the hooks do not need it. +tea_min=0.14.2 +tea_see="see docs/contributing/setup.md (The tracker)" +if ! command -v tea >/dev/null 2>&1; then + echo "warning: tea $tea_min or later is not on PATH; $tea_see." >&2 +else + # The first line reads `Version: 0.16.0<TAB>golang: ...`, the number possibly in ANSI bold. + tea_version="$(tea --version 2>/dev/null | tr -d '\033' \ + | sed -nE '1s/^Version: (\[[0-9;]*m)?([0-9]+\.[0-9]+\.[0-9]+).*/\2/p' || true)" + if [ -z "$tea_version" ]; then + echo "warning: could not read the version of tea (need $tea_min or later); $tea_see." >&2 + else + IFS=. read -r t_major t_minor t_patch <<< "$tea_version" + IFS=. read -r m_major m_minor m_patch <<< "$tea_min" + if [ "$t_major" -lt "$m_major" ] || { [ "$t_major" -eq "$m_major" ] && { + [ "$t_minor" -lt "$m_minor" ] || { [ "$t_minor" -eq "$m_minor" ] && [ "$t_patch" -lt "$m_patch" ]; }; }; }; then + echo "warning: tea $tea_version is older than $tea_min; $tea_see." >&2 + fi + fi +fi + echo "Done: git commit now runs the hooks with the tools in $root/.venv/bin and the collections in $collections." diff --git a/tests/scripts/test_dev_setup.py b/tests/scripts/test_dev_setup.py index 22e94fd..ec22fb2 100644 --- a/tests/scripts/test_dev_setup.py +++ b/tests/scripts/test_dev_setup.py @@ -139,6 +139,39 @@ class DevSetupTest(unittest.TestCase): check=False, ) + def path_without_tea(self) -> str: + """The test PATH with every directory that holds a tea replaced by a copy without it. + + Dropping the directory would also drop git and the shell tools a distribution installs + next to its tea package. + """ + dirs = [] + for i, d in enumerate(self.env["PATH"].split(os.pathsep)): + if not os.access(os.path.join(d, "tea"), os.X_OK): + dirs.append(d) + continue + farm = self.tmp / f"no-tea-{i}" + farm.mkdir(exist_ok=True) + for entry in os.listdir(d): + if entry != "tea" and not (farm / entry).exists(): + (farm / entry).symlink_to(os.path.join(d, entry)) + dirs.append(str(farm)) + return os.pathsep.join(dirs) + + def path_with_tea(self, version_line: str) -> str: + """The test PATH with a tea stub first whose `--version` prints `version_line`.""" + bin_dir = self.tmp / "tea-bin" + bin_dir.mkdir(exist_ok=True) + tea = bin_dir / "tea" + tea.write_text(f"#!/bin/sh\nprintf '{version_line}\\n'\n") + tea.chmod(0o755) + return f"{bin_dir}{os.pathsep}{self.env['PATH']}" + + @staticmethod + def tea_0_16_line(version: str) -> str: + """The first line of `tea --version` as tea 0.16.0 prints it, number in ANSI bold.""" + return f"Version: \\033[1m{version}\\033[0m\\tgolang: 1.26.6\\tgo-sdk: v1.2.0" + def hooks_z(self, repo: Path) -> bytes: return self.git( repo, "config", "--local", "-z", "--get-all", "core.hooksPath", check=False @@ -196,6 +229,40 @@ class DevSetupTest(unittest.TestCase): self.assertIn("# kamino-dev-setup: virtualenv first on PATH", text) self.assertEqual(self.hooks_z(repo), b"") + def test_a_missing_tea_warns_and_setup_succeeds(self) -> None: + repo = self.make_repo() + proc = self.run_setup(repo, PATH=self.path_without_tea()) + self.assertEqual(proc.returncode, 0, proc.stderr) + self.assertIn("warning: tea 0.14.2 or later is not on PATH", proc.stderr) + + def test_a_tea_older_than_0_14_2_warns_and_setup_succeeds(self) -> None: + repo = self.make_repo() + for old in ("0.14.1", "0.9.2"): + with self.subTest(old=old): + proc = self.run_setup( + repo, PATH=self.path_with_tea(self.tea_0_16_line(old)) + ) + self.assertEqual(proc.returncode, 0, proc.stderr) + self.assertIn(f"warning: tea {old} is older than 0.14.2", proc.stderr) + + def test_a_tea_of_0_14_2_or_later_gives_no_warning(self) -> None: + repo = self.make_repo() + for ok in ("0.14.2", "0.16.0", "1.0.0"): + with self.subTest(ok=ok): + proc = self.run_setup( + repo, PATH=self.path_with_tea(self.tea_0_16_line(ok)) + ) + self.assertEqual(proc.returncode, 0, proc.stderr) + self.assertNotIn("warning: tea", proc.stderr) + + def test_an_unreadable_tea_version_warns_and_setup_succeeds(self) -> None: + repo = self.make_repo() + # A dev build: the version is not numeric, and the golang version must not stand in for it. + line = "Version: main-dev\\tgolang: 1.26.6\\tgo-sdk: v1.2.0" + proc = self.run_setup(repo, PATH=self.path_with_tea(line)) + self.assertEqual(proc.returncode, 0, proc.stderr) + self.assertIn("warning: could not read the version of tea", proc.stderr) + def test_tools_are_installed_from_the_hashed_lock_with_its_pins(self) -> None: repo = self.make_repo() self.assertEqual(self.run_setup(repo).returncode, 0)