Metadata-Version: 2.4
Name: cac-jira
Version: 0.5.4
Summary: A command-line interface for interacting with Jira
Author-email: Ryan Punt <ryan@mirum.org>
License-Expression: MIT
Project-URL: homepage, https://mirum.org/cac-jira/
Project-URL: repository, https://github.com/rpunt/cac-jira
Keywords: jira,cli,atlassian,project-management,command-lint,python,cli-tool
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Requires-Python: <4.0,>=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: cac-core<1.0.0,>=0.4.0
Requires-Dist: tabulate>=0.9.0
Requires-Dist: jira<4.0.0,>=3.8.0
Requires-Dist: pyyaml>=6.0.2
Requires-Dist: keyring>=25.5.0
Requires-Dist: argcomplete>=3.6.2
Provides-Extra: dev
Requires-Dist: mypy>=1.3.0; extra == "dev"
Requires-Dist: types-pyyaml>=6.0.12; extra == "dev"
Requires-Dist: types-tabulate>=0.9.0; extra == "dev"
Provides-Extra: test
Requires-Dist: pytest>=7.3.1; extra == "test"
Provides-Extra: lint
Requires-Dist: black<25.0,>=23.3; extra == "lint"
Requires-Dist: isort>=5.12.0; extra == "lint"
Requires-Dist: pylint>=2.17.0; extra == "lint"
Provides-Extra: docs
Requires-Dist: sphinx>=7.0.0; extra == "docs"
Requires-Dist: sphinx-rtd-theme>=1.2.0; extra == "docs"
Provides-Extra: all
Requires-Dist: mypy>=1.3.0; extra == "all"
Requires-Dist: types-pyyaml>=6.0.12; extra == "all"
Requires-Dist: types-tabulate>=0.9.0; extra == "all"
Requires-Dist: pytest>=7.3.1; extra == "all"
Requires-Dist: black<25.0,>=23.3; extra == "all"
Requires-Dist: isort>=5.12.0; extra == "all"
Requires-Dist: pylint>=2.17.0; extra == "all"
Requires-Dist: sphinx>=7.0.0; extra == "all"
Requires-Dist: sphinx-rtd-theme>=1.2.0; extra == "all"
Dynamic: license-file

# Jira CLI

A command-line interface for interacting with Jira.

This project uses [UV](https://github.com/astral-sh/uv) for dependency management.

## Installation

```bash
pip install cac-jira
```

## Authentication

On first-run, you'll be prompted for a Jira API token; generate one [here](https://id.atlassian.com/manage-profile/security/api-tokens). This will be stored in your system credential store (e.g. Keychain on Mac OS) in an items called `cac-jira`.

## Configuration

On first-run, a configuration file will be generated at `~/.config/cac_jira/config.yaml`. In this file you'll need to replace the values of `server` and `username` with appropriate values.

```yaml
server: https://your-jira-instance.atlassian.net
project: YOUR_PROJECT_KEY  # Optional default project
username: your.email@example.com
```

## Usage

The Jira CLI follows a command-action pattern for all operations:

```bash
jira <command> <action> [options]
```

### Global Options

- `--verbose`: Enable debug output
- `--output [table|json]`: Control output format (default table)
- `--help`: Show command help
<!-- --suppress-output: Hide command output -->
<!-- --version: Display version information -->

### Examples

#### Issue Commands

List issues in a project:

```bash
jira issue list --project PROJ
```

List issues with additional filtering:

```bash
jira issue list --project PROJ
```

Create a new issue:

```bash
jira issue create --project PROJ --type Task --title "Fix login bug" --description "Users can't log in"
```

Create a new issue of a type that requires custom fields:

```bash
#
# This assumes the name of the custom fields is "Custom Field One" and "Custom Field Two";
# the field name will be swapped to lower-case, and spaces replaced with underscores
#
jira issue create --project PROJ --type Custom\ Issue\ Type --title "Issue Title" --description "Issue description" \
  --field custom_field_one custom_field_value \
  --field custom_field_two custom_field_value
```

Create and assign to yourself:

```bash
jira issue create --project PROJ --type Bug --title "Server crash" --assign
```

Create and immediately start work:

```bash
jira issue create --project PROJ --type Story --title "Add login feature" --begin
```

Add an issue to an epic:

```bash
jira issue create --project PROJ --type Task --title "Subtask" --epic PROJ-100
```

Label an issue:

```bash
jira issue label --issue ISSUE_KEY --labels label1,label2
```

Transition an issue:

```bash
jira issue begin --issue ISSUE_KEY    # Start work
jira issue close --issue ISSUE_KEY    # Mark as complete
```

#### Project Commands

List all projects:

```bash
jira project list
```

Show a project:

```bash
jira project show --name PROJ-123
```

#### Advanced Examples

Update an issue's title or description:

```bash
jira issue update --issue ISSUE_KEY --title "New issue title" --description "new issue description"
```

Add a comment to an issue:

```bash
jira issue comment --issue ISSUE_KEY --comment "This is a comment."
```

List all issue IDs matching a label:

```bash
jira issue list --output json | jq -r '.[] | select(.Labels | contains("production")) | .ID'
```

## Development

### Setup Development Environment

```bash
# Install dependencies including dev dependencies
uv sync

# Activate the venv
source .venv/bin/activate

# Run tests
uv run pytest
```

Please note that tests are still WIP

### Project Structure

- `cac_jira/commands/` - Command implementations
  - `issue/` - Issue-related commands
  - `project/` - Project-related commands
- `cac_jira/cli/` - CLI entry point and argument parsing

### Adding New Commands

1. Create a new action module in the appropriate command directory.
2. Define a class that inherits from the command's base class.
3. Implement `define_arguments()` and `execute()` methods.
