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
9 changes: 3 additions & 6 deletions .claude/ai-usage-prompt.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
╭─ 🦖 budjira v1.35.0 ─ Your CLI Pal for Jira ─╮
╰──────────────────────────────────────────────╯

# budjira - Jira CLI Tool Usage Guide for AI Assistants

## Overview
Expand Down Expand Up @@ -291,16 +288,16 @@ budjira search --assignee currentUser()
# Multiple filters (combined with AND)
budjira search --project MYPROJ --type Bug --status Open

# Limit results
budjira search --status "To Do" --max 50
# Limit results (total across pages; --max, --limit and --max-results are the same option)
budjira search --status "To Do" --limit 10
```

**Available Filters:**
- `--project KEY`: Filter by project key
- `--status STATUS`: Filter by status name
- `--assignee USER`: Filter by assignee (supports currentUser())
- `--type TYPE`: Filter by issue type (Bug, Story, Task, etc.)
- `--max N`: Limit number of results (default: 50)
- `--max N` / `--limit N` / `--max-results N`: Limit total number of results (default: 50)

### Search Output

Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,9 @@ budjira search "project = PROJ AND status = 'In Progress'"
budjira search --status "In Progress" --assignee currentUser()
budjira search --project PROJ --type Bug --max 100

# Cap the total number of results (--max, --limit/-n and --max-results are aliases)
budjira search "project = PROJ ORDER BY created DESC" --limit 5

# Use specific connection
budjira search --connection my-connection --status Done

Expand Down
7 changes: 5 additions & 2 deletions budjira/cli/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,10 @@ def search(
50,
"--max",
"-m",
help="Maximum number of results to return",
"--limit",
"-n",
"--max-results",
help="Maximum total number of results to return (across pages)",
min=1,
max=1000,
),
Expand Down Expand Up @@ -202,7 +205,7 @@ def search(
# Show summary
console.print(f"\n[dim]Found {len(issues)} issue{'s' if len(issues) != 1 else ''}[/dim]")
if len(issues) == max_results:
console.print(f"[dim]Limited to {max_results} results. Use --max to increase.[/dim]")
console.print(f"[dim]Limited to {max_results} results. Use --max/--limit to increase.[/dim]")

except BudjiraError as e:
console.print(f"[red]✗[/red] {e}", style="red")
Expand Down
6 changes: 3 additions & 3 deletions budjira/models/ai_prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,16 +435,16 @@ def get_default_ai_prompt_template() -> AiPromptTemplate:
# Multiple filters (combined with AND)
budjira search --project MYPROJ --type Bug --status Open

# Limit results
budjira search --status "To Do" --max 50
# Limit results (total across pages; --max, --limit and --max-results are the same option)
budjira search --status "To Do" --limit 10
```

**Available Filters:**
- `--project KEY`: Filter by project key
- `--status STATUS`: Filter by status name
- `--assignee USER`: Filter by assignee (supports currentUser())
- `--type TYPE`: Filter by issue type (Bug, Story, Task, etc.)
- `--max N`: Limit number of results (default: 50)
- `--max N` / `--limit N` / `--max-results N`: Limit total number of results (default: 50)

### Search Output

Expand Down
29 changes: 29 additions & 0 deletions tests/cli/test_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,35 @@ def test_search_with_max_results(
max_results=100,
)

@pytest.mark.parametrize("flag", ["--limit", "-n", "--max-results"])
@patch("budjira.cli.search.JiraClient")
@patch("budjira.cli.search.get_active_connection")
def test_search_with_limit_aliases(
self,
mock_get_active_connection: Mock,
mock_jira_client_class: Mock,
flag: str,
mock_connection: Connection,
mock_issue: Issue,
) -> None:
"""Test search with --limit/-n/--max-results spellings of the result cap."""
# Setup mocks
mock_get_active_connection.return_value = mock_connection

mock_client = MagicMock()
mock_client.search_issues.return_value = [mock_issue]
mock_jira_client_class.from_connection.return_value = mock_client

# Run command
result = runner.invoke(app, ["project = TEST", flag, "5"])

# Verify
assert result.exit_code == 0
mock_client.search_issues.assert_called_once_with(
"project = TEST",
max_results=5,
)

@patch("budjira.cli.search.JiraClient")
@patch("budjira.cli.search.get_active_connection")
def test_search_no_results(
Expand Down
Loading