21: Add forgejo_list_milestones tool #35
No reviewers
Labels
No labels
bug
chore
documentation
enhancement
feature
ready
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
david/pi-extensions-and-skills!35
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/issue-21/add-forgejo-list-milestones-tool"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
21: Add forgejo_list_milestones tool
Implements 21.
Generated in 8m 28s.
Review findings
The grep tool isn't quoting patterns with spaces. Let me use bash directly.Now let me check the exact test block and search for any other references that need updating.I have full context. Now let me apply the fixes. First, the main tool handler in
src/index.ts(findings 1, 2, 3):Now align thelimitschema on the two existing search tools (finding 3's parenthetical — same server cap applies):Now the DESIGN.md diagram count (finding 4):Now update the tool handler tests to cover the new behavior (findings 1 and 2):Now let me verify the changes and discover the build/test commands:Let me review the final handler and run the gates:All gates pass. Let me run the coverage gate to confirm the new branches are covered:All gates pass, andmilestones.tsremains at 100% coverage. Let me review the final working-tree diff:All changes are complete and gates pass. Here is my remediation summary.Summary of remediation
Fixed all 4 code/doc findings; 1 finding (commit-message format) is out of scope for the working tree and remains unresolved:
forgejo_list_milestonesnow computeshas_more = milestones.length === (params.limit ?? 10)(server default page size), appends a "More milestones may be available — pass page=N (or a larger limit) to continue" line when a full page returns, and includesdetails.has_more. Tests added for the full-page and partial-page branches.No open milestones (pass state="all" to include closed milestones).whenstateis unset/"open", andNo milestones match.otherwise. Tests updated/added.limitschema changed frommaximum: 100tomaximum: 50; per the finding's suggestion I also aligned the identical server-cap issue inforgejo_issue_search(line 761) andforgejo_pr_search(line 1075), which had the samemaximum: 100.21: Add forgejo_list_milestones tool(55670c2) and future PR/commit naming; this pipeline stage must not commit/amend, so there is nothing in the working tree to change.Gates re-run:
npm run check✅,npm run build✅,npm test✅ (9 suites, 148 tests),npm run test:coverage✅ (milestones.ts at 100% stmt/line/branch/func).Review Findings — 21
Summary
Stage 1 adds the
forgejo_list_milestonestool (name→id lookup for themilestoneparam), with API function, TypeBox schema, tool handler, docs updates, and tests. Gates:npm run check(tsc --noEmit) passed,npm run build(tsc) passed,npm test(jest) passed — 9 suites / 148 tests (2 added in remediation), with milestones.ts at 100% coverage. No lint configuration exists in the repo (no lint gate). The implementation is correct and follows existing tool patterns; findings below are UX/consistency improvements, no critical or high issues.Remediation: the pagination-hint finding (Medium), the state-aware empty message (Low), the
limitcap (Low, including aligningforgejo_issue_search/forgejo_pr_searchtomaximum: 50), and the DESIGN.md diagram count (Low) are all fixed. The AGENTS.md commit-message finding (Low) is left unresolved: it concerns the already-created commit21: Add forgejo_list_milestones tool(55670c2) and future squash-merge/PR naming, which this stage cannot change (no commit/amend permitted); it is recorded for the human operator to apply when merging.Critical
High
Medium
details.count(line 1266) reflect only the current page, and there is no hint when more pages exist. Since the tool's stated purpose is name→id lookup before passing amilestoneid, a repo with more thanlimit(server default 10) milestones would silently omit later milestones and the model could wrongly conclude a milestone doesn't exist. Suggested fix: whenmilestones.length === limit(i.e. a full page came back), append a line like "More milestones may be available — pass page=N (or a larger limit) to continue" and/or adddetails.has_more: milestones.length === (params.limit ?? 10).Low
stateis passed, the server defaults tostate=open; a repo whose milestones are all closed returns[]and the tool prints "No milestones in this repository." even though closed milestones exist — the message overstates the data and could mislead the model. Suggested fix: make the empty message state-aware, e.g. "No open milestones (pass state="all" to include closed milestones)" whenstateis unset or"open", and "No milestones match" otherwise.limitschema allowsmaximum: 100, but the Forgejo/Gitea API caps page size at 50 (setting.API.MaxResponseItems), so values 51–100 are silently truncated by the server. Suggested fix: setmaximum: 50to match server behavior (also consider aligning the existingforgejo_issue_searchschema at lines 761/1075).forgejo_issue_*ops if that is the intent).21: Add forgejo_list_milestones tool(commit55670c2), but AGENTS.md requires the formatissue-<N>: <summary>. Suggested fix: useissue-21: Add forgejo_list_milestones toolfor the squash-merge commit / PR title (per AGENTS.md:34), and followissue-<N>: <summary>for future commits.