Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .claude/ai-usage-prompt.md
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,8 @@ budjira create issue "Issue summary" --no-interactive [OPTIONS]
- `--description-dialect {markdown,wiki}`: Dialect the description is written in
(overrides the connection setting for this call)
- `--priority PRIORITY`: Priority level (Highest, High, Medium, Low, Lowest)
- `--priority-id ID`: Priority as numeric ID, sent as `{"id": ...}` — for instances
that reject priority names (mutually exclusive with `--priority`)
- `--assignee USER`: Assign to user (username or account ID)
- `--label TAG`: Add label (can be used multiple times)
- `--project KEY`: Override default project
Expand Down Expand Up @@ -527,6 +529,8 @@ Update existing issues with status transitions, field changes, and label managem
- `--status STATUS`, `-s`: Transition to new status
- `--assignee USER`, `-a`: Assign to user (username, accountId, or `currentUser()`)
- `--priority PRIORITY`, `-p`: Set priority (Highest, High, Medium, Low, Lowest)
- `--priority-id ID`: Set priority by numeric ID, sent as `{"id": ...}` — for
instances that reject priority names (mutually exclusive with `--priority`)
- `--summary TEXT`: Update summary/title
- `--description TEXT`: Update description
- `--description-dialect {markdown,wiki}`: Dialect the description is written in
Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,17 @@ budjira create issue "Story 3" --type Story --epic PROJ-100 --no-interactive

# Create a sub-task under a parent issue
budjira create issue "Implement login form" --type Subtask --parent PROJ-123 --no-interactive

# Priority as numeric ID (instances that reject priority names)
budjira create issue "Fix bug" --type Bug --priority-id 3 --no-interactive
budjira issue update PROJ-123 --priority-id 3
```

**Priority by name or ID:** `--priority` sends the name (`{"name": ...}`) and stays
the default. `--priority-id` sends `{"id": ...}` for instances whose priorities
reject names; the two options are mutually exclusive. When a priority is
rejected, the error message lists the values the instance actually offers.

**Epic Linking:**
- Use `--epic PROJ-100` to link issue to epic during creation
- Eliminates need for separate update step
Expand Down
13 changes: 13 additions & 0 deletions budjira/cli/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,7 @@ def _display_create_dry_run(
assignee: str | None,
labels: list[str],
epic: str | None,
priority_id: str | None = None,
) -> None:
"""Show the exact create payload without touching the API.

Expand All @@ -654,6 +655,7 @@ def _display_create_dry_run(
assignee: Assignee if given
labels: Labels if given
epic: Epic key the issue would be linked to after creation
priority_id: Priority as numeric ID if given
"""
fields = build_create_fields(
project_key,
Expand All @@ -665,6 +667,7 @@ def _display_create_dry_run(
labels,
dialect,
extra_fields,
priority_id=priority_id,
)
console.print(f"\n[cyan]Dry run:[/cyan] would create {issue_type} in project {project_key} — no API call made")
console.print("[cyan]fields payload:[/cyan]")
Expand Down Expand Up @@ -710,6 +713,11 @@ def issue(
help="Priority level (uses project metadata if available, otherwise: "
f"{', '.join([p.value for p in Priority])})",
),
priority_id: str = typer.Option(
None,
"--priority-id",
help='Priority as numeric ID, sent as {"id": ...} (for instances that reject priority names)',
),
assignee: str = typer.Option(
None,
"--assignee",
Expand Down Expand Up @@ -841,6 +849,9 @@ def issue(
_check_required_custom_fields(custom_values, custom_field_configs)

# Validate
if priority and priority_id:
console.print("[red]✗[/red] --priority and --priority-id cannot be used together", style="red")
raise typer.Exit(1)
_validate_required_fields(summary, issue_type)
_validate_parent(parent, issue_type, project_metadata)
_validate_dor(description, issue_type, skip_dor, settings, interactive)
Expand Down Expand Up @@ -871,6 +882,7 @@ def issue(
assignee,
labels,
epic,
priority_id=priority_id,
)
return

Expand All @@ -884,6 +896,7 @@ def issue(
issue_type=issue_type,
description=description,
priority=priority,
priority_id=priority_id,
assignee=assignee,
labels=labels,
description_dialect=resolved_dialect,
Expand Down
22 changes: 20 additions & 2 deletions budjira/cli/issue.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ def _display_update_dry_run(
remaining_estimate: str | None,
log_work: str | None,
work_comment: str | None,
priority_id: str | None = None,
) -> None:
"""Show the exact update payload(s) without touching the API.

Expand All @@ -269,14 +270,16 @@ def _display_update_dry_run(
remaining_estimate: Remaining estimate option value
log_work: Work time that would be logged
work_comment: Worklog comment
priority_id: Priority as numeric ID option value
"""
if any([assignee is not None, priority, summary, description]):
if any([assignee is not None, priority, priority_id, summary, description]):
update_fields = build_update_fields(
assignee=assignee,
priority=priority,
summary=summary,
description=description,
description_dialect=resolve_description_dialect(description_dialect, conn),
priority_id=priority_id,
)
console.print(f"[cyan]Dry run:[/cyan] would update {issue_key} — no API call made")
console.print("[cyan]fields payload:[/cyan]")
Expand Down Expand Up @@ -336,6 +339,12 @@ def update_issue(
str | None, typer.Option("--assignee", "-a", help="Assign to user (username or 'currentUser()')")
] = None,
priority: Annotated[str | None, typer.Option("--priority", "-p", help="Set priority")] = None,
priority_id: Annotated[
str | None,
typer.Option(
"--priority-id", help='Set priority by numeric ID, sent as {"id": ...} (for instances that reject names)'
),
] = None,
add_label: Annotated[list[str] | None, typer.Option("--add-label", help="Add label (repeatable)")] = None,
remove_label: Annotated[list[str] | None, typer.Option("--remove-label", help="Remove label (repeatable)")] = None,
summary: Annotated[str | None, typer.Option("--summary", help="Update summary")] = None,
Expand Down Expand Up @@ -397,13 +406,18 @@ def update_issue(
console.print("[red]Error: --work-comment requires --log-work[/red]")
raise typer.Exit(1)

if priority and priority_id:
console.print("[red]Error: --priority and --priority-id cannot be used together[/red]")
raise typer.Exit(1)

# Check that at least one update option is provided
if not any(
[
status,
field,
assignee is not None,
priority,
priority_id,
add_label,
remove_label,
summary,
Expand Down Expand Up @@ -471,17 +485,19 @@ def update_issue(
remaining_estimate=remaining_estimate,
log_work=log_work,
work_comment=work_comment,
priority_id=priority_id,
)
return

# Perform field updates
try:
# Update basic fields
if any([assignee is not None, priority, summary, description]):
if any([assignee is not None, priority, priority_id, summary, description]):
client.update_issue(
issue_key,
assignee=assignee,
priority=priority,
priority_id=priority_id,
summary=summary,
description=description,
description_dialect=resolve_description_dialect(description_dialect, conn),
Expand All @@ -490,6 +506,8 @@ def update_issue(
changes.append(("Assignee", f"→ {assignee}"))
if priority:
changes.append(("Priority", f"→ {priority}"))
if priority_id:
changes.append(("Priority", f"→ id {priority_id}"))
if summary:
changes.append(("Summary", "Updated"))
if description:
Expand Down
7 changes: 6 additions & 1 deletion budjira/core/jira_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ def create_issue(
issue_type: str,
description: str | None = None,
priority: str | None = None,
priority_id: str | None = None,
assignee: str | None = None,
labels: list[str] | None = None,
description_dialect: DescriptionDialect = "markdown",
Expand All @@ -191,6 +192,7 @@ def create_issue(
issue_type,
description,
priority,
priority_id,
assignee,
labels,
description_dialect,
Expand All @@ -203,6 +205,7 @@ def update_issue(
fields: dict[str, Any] | None = None,
assignee: str | None = None,
priority: str | None = None,
priority_id: str | None = None,
summary: str | None = None,
description: str | None = None,
description_dialect: DescriptionDialect = "markdown",
Expand All @@ -211,7 +214,9 @@ def update_issue(

DEPRECATED: Use client.issues.update() instead.
"""
self.issues.update(issue_key, fields, assignee, priority, summary, description, description_dialect)
self.issues.update(
issue_key, fields, assignee, priority, priority_id, summary, description, description_dialect
)

# ==================== Worklog Operations (delegate to WorklogService) ====================

Expand Down
4 changes: 4 additions & 0 deletions budjira/models/ai_prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,8 @@ def get_default_ai_prompt_template() -> AiPromptTemplate:
- `--description-dialect {markdown,wiki}`: Dialect the description is written in
(overrides the connection setting for this call)
- `--priority PRIORITY`: Priority level (Highest, High, Medium, Low, Lowest)
- `--priority-id ID`: Priority as numeric ID, sent as `{"id": ...}` — for instances
that reject priority names (mutually exclusive with `--priority`)
- `--assignee USER`: Assign to user (username or account ID)
- `--label TAG`: Add label (can be used multiple times)
- `--project KEY`: Override default project
Expand Down Expand Up @@ -694,6 +696,8 @@ def get_default_ai_prompt_template() -> AiPromptTemplate:
- `--status STATUS`, `-s`: Transition to new status
- `--assignee USER`, `-a`: Assign to user (username, accountId, or `currentUser()`)
- `--priority PRIORITY`, `-p`: Set priority (Highest, High, Medium, Low, Lowest)
- `--priority-id ID`: Set priority by numeric ID, sent as `{"id": ...}` — for
instances that reject priority names (mutually exclusive with `--priority`)
- `--summary TEXT`: Update summary/title
- `--description TEXT`: Update description
- `--description-dialect {markdown,wiki}`: Dialect the description is written in
Expand Down
Loading
Loading