Hybrid edit (FIELD_SPECS map + --set + --list-fields), link --list, and bjira show#17
Open
wiliam wants to merge 24 commits into
Open
Hybrid edit (FIELD_SPECS map + --set + --list-fields), link --list, and bjira show#17wiliam wants to merge 24 commits into
wiliam wants to merge 24 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What's new
1. Hybrid
edit— map-driven fields +--setescape hatchFIELD_SPECSinbjira/_fields.pymaps each named flag to a Jira field id + payload transform. Adding a common field is one dict entry — no changes toedit.py. Currently shipped:--summary/--description/--description-file--due(YYYY-MM-DDornone)duedate--assignee(login ornone)assignee--priority(name)priority--version(name ornone)fixVersions--team(value ornone)customfield_34238(Delivery Team)--sp(float)customfield_11212(Story Points)--set KEY=VALUEcovers anything not in the map, guarded bySET_DENY(status,resolution,issuetype,project,created,updated,creator,reporter,issuelinks,subtasks— with pointers to the right tool, e.g. "status/resolution → use 'bjira status'").All previous behaviour preserved:
--forcegate on summary/description,--description-file, label merge/clear, no-op skip, exit codes (0/2/3).2.
bjira edit KEY --list-fields [--json]Uses Jira's
editmetaendpoint to show what's editable on the issue right now: field name, id, type, allowed operations, and allowed enum values (e.g.fixVersions→ list of versions,priority→ 5 levels,Delivery Team→ 100+ teams). Truncates each enum to first 10 + total count;--jsonemits full JSON for piping.3.
bjira link --listEnumerates all link types via
jira.issue_link_types(). Useful because some Jira instances rename link types (e.g. onjira.hh.ruthe standard "Relates" is namedRelation).4.
bjira show KEY [--fields LIST] [--json]Symmetric read counterpart to hybrid
edit. Reads any subset of issue fields. Field labels accepted in any form:field id (
customfield_11210,summary)human name in any language (
Flagged,Дата блокировки) — resolved via/rest/api/2/fieldfieldset alias from
~/.bjira_config:{ \"fieldsets\": { \"default\": [\"summary\", \"status\", \"assignee\", \"labels\", \"duedate\"], \"blocker\": [\"Flagged\", \"is_blocked\", \"Дата блокировки\", \"Дата разблокировки\"] } }Aliases compose:
--fields blocker,timing,summary→ expanded list, dedup, order preserved. If the config definesdefault, it's used when no--fieldsis passed.Output: YAML-like text by default (label-aligned, multi-line values indented), or full JSON with
--json.Files changed
Test plan
pytest tests/ --ignore=tests/smoke.py— 58 unit tests pass on Python 3.14 (+21 new this PR: 8 for FIELD_SPECS-layer, 13 for show-layer)python tests/smoke.py— all sections pass on jira.hh.ru, including--list-fieldsandlink --listbjira edit PORTFOLIO-XXX --version 2026Q2 --team Конверсыapplied cleanlybjira show PORTFOLIO-XXX --fields \"summary,Flagged,Дата блокировки,customfield_11210\"resolves all four (id, English name, Russian name, id again)bjira edit ... --set status=Done→ exit 2 with actionable messagebjira edit KEY --summary <same>→ "no changes", exit 0, no API write--forceon non-empty summary/description),--description-file, labels merge/clear — all unchangedBackwards compatibility
All commands from #16 untouched.
bjira/operations/edit.pywas rewritten in place but every prior CLI invocation produces the same payload and exit code; the rewrite is internal (loop over map instead of hand-coded per-field branches).