forked from Gitlink/gitlink-cli
2.0 KiB
2.0 KiB
feat(issue): add batch maintenance shortcuts
Summary
This PR adds focused Issue batch maintenance shortcuts:
issue +batch-listissue +batch-closeissue +batch-label
The commands help maintainers inspect and act on groups of Issues with safe defaults and structured output.
Motivation
Maintainers often need to find stale or labeled Issues, preview a batch action, and then execute it carefully. Existing single-Issue commands are useful, but they do not provide a guarded batch maintenance workflow.
Changes
- Add
issue +batch-listfor read-only candidate listing. - Upgrade
issue +batch-closeto use filter-based selection, default dry-run, and explicit--yesexecution. - Add
issue +batch-labelfor dry-run label maintenance planning. - Add batch DTOs and table/json rendering inside the issue shortcut package.
- Add long help text with examples and safety notes.
- Add tests and documentation for the batch workflow.
Safety
issue +batch-listis read-only.issue +batch-closeandissue +batch-labeldefault to dry-run.--yesis required before any remote mutation is attempted.- Batch close requires
--older-than-days. - Batch close rejects
--older-than-daysvalues lower than7. --limitis capped at100.- Per-item failures are recorded in
errorsand do not hide partial failures. issue +batch-label --yesdoes not fake success when a label write endpoint is unavailable.
Tests
gofmt -w shortcuts/issue/*.go shortcuts/common/*.go
go test ./shortcuts/issue
go test ./...
Coverage includes filtering, dry-run behavior, JSON/table rendering, httptest API list responses, and per-item write failure reporting.
Documentation
README.mdREADME.zh-CN.mddocs/issue-batch-design.mddocs/issue-batch-test-report.md
Known Limitations
- Label mutation is intentionally not executed until a stable GitLink add-label endpoint is confirmed.
- The current candidate fetch uses one page with the requested limit.