2.5 KiB
2.5 KiB
Label batch safety shortcuts
Background
The label shortcut group already supported listing, creating, updating, and deleting issue labels. Deletion executed immediately, and larger taxonomy setup or cleanup workflows still required repeated manual commands or Raw API calls.
This change adds safer destructive operations and first-class batch helpers.
New and changed shortcuts
label +deletenow supports--dry-runand requires--yesfor real deletion.label +batch-createcreates multiple labels from a semicolon-separatedname:color:descriptionlist.label +batch-deletedeletes multiple labels from a comma-separated ID list.
Safety model
Destructive or multi-write commands should be previewed first:
gitlink-cli label +delete --owner Gitlink --repo forgeplus -i 42 --dry-run
gitlink-cli label +batch-create --owner Gitlink --repo forgeplus \
--labels 'bug:#ee0701:Bug fixes;feature:#0075ca:New features' --dry-run
gitlink-cli label +batch-delete --owner Gitlink --repo forgeplus --ids 3,5,8 --dry-run
After confirmation, pass --yes:
gitlink-cli label +delete --owner Gitlink --repo forgeplus -i 42 --yes
gitlink-cli label +batch-create --owner Gitlink --repo forgeplus \
--labels 'bug:#ee0701:Bug fixes;feature:#0075ca:New features' --yes
gitlink-cli label +batch-delete --owner Gitlink --repo forgeplus --ids 3,5,8 --yes
Parsing rules
label +batch-create --labelsuses semicolons between labels and colons inside each label spec:name:color:description.- Missing colors default to
#1E90FF. - Colors are validated as
#RGBor#RRGGBBbefore any API call. label +batch-delete --idsaccepts comma-separated positive integer IDs and removes duplicates before making requests.
Documentation updates
- README and README.zh-CN include safe delete and batch examples.
skills/gitlink-labeldocuments the new shortcuts and safety model.skills/gitlink-issue-tagnow recommends label shortcuts instead of Raw API calls for common label workflows.skills/gitlink-stale-issue-manageruseslabel +batch-createfor stale label bootstrap steps.
Tests
Unit tests cover:
- single delete dry-run and
--yesconfirmation; - batch-create dry-run/default preview and real API calls;
- batch-delete dry-run/default preview, de-duplication, and real API calls;
- parser validation for label specs, colors, and ID lists;
- partial batch failure reporting.
Suggested verification:
go test ./shortcuts/label ./shortcuts
Full project verification:
go test ./...