Metadata-Version: 2.4
Name: codapact-jira
Version: 0.1.0
Summary: Typed Python client and `codapact-jira` CLI for the Jira Cloud platform REST API v3, with Markdown rich text, generated by Codapact
Keywords: jira,atlassian,markdown,adf,cli,api-client,codapact
Author: Mike Hill
License-Expression: MIT
License-File: LICENSE
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Typing :: Typed
Requires-Dist: codapact[keyring,browser]>=0.19.0,<0.20
Requires-Dist: adflux>=0.4.0,<0.5
Requires-Python: >=3.13
Project-URL: Homepage, https://github.com/mikejhill/codapact-jira
Project-URL: Repository, https://github.com/mikejhill/codapact-jira
Project-URL: Issues, https://github.com/mikejhill/codapact-jira/issues
Project-URL: Generator, https://github.com/mikejhill/codapact
Description-Content-Type: text/markdown

# codapact-jira

[![CI](https://github.com/mikejhill/codapact-jira/actions/workflows/ci.yml/badge.svg)](https://github.com/mikejhill/codapact-jira/actions/workflows/ci.yml) [![PyPI](https://img.shields.io/pypi/v/codapact-jira)](https://pypi.org/project/codapact-jira/) [![Python](https://img.shields.io/pypi/pyversions/codapact-jira)](https://pypi.org/project/codapact-jira/) [![License](https://img.shields.io/github/license/mikejhill/codapact-jira)](https://github.com/mikejhill/codapact-jira/blob/HEAD/LICENSE) [![Jira Cloud](https://img.shields.io/badge/Jira_Cloud-1001.0.0--SNAPSHOT--eac1257d8e1582ed7dd2a97a93dbea3c277d24be-blue)](https://developer.atlassian.com/cloud/jira/platform/rest/v3/) [![Generated by Codapact](https://img.shields.io/badge/generated_by-codapact_0.19.0-blue)](https://github.com/mikejhill/codapact)

Typed Python client and `codapact-jira` command-line tool for [Jira Cloud](https://developer.atlassian.com/cloud/jira/platform/rest/v3/), generated by [Codapact](https://github.com/mikejhill/codapact).

## API source

Generated from this exact contract; regenerating it with the same Codapact version reproduces the code byte for byte.

| | |
| --- | --- |
| API | [Jira Cloud](https://developer.atlassian.com/cloud/jira/platform/rest/v3/) |
| Contract | OpenAPI [`openapi.json`](https://github.com/mikejhill/codapact-jira/blob/HEAD/openapi.json), pinned copy of <https://dac-static.atlassian.com/cloud/jira/platform/swagger-v3.v3.json> |
| Version | `1001.0.0-SNAPSHOT-eac1257d8e1582ed7dd2a97a93dbea3c277d24be` |
| SHA-256 | `36a08f68d55c32f4e8dc257c1ca26f693d09e066a041dbf041ccb804dc52b971` |
| Generator | [Codapact](https://github.com/mikejhill/codapact) `0.19.0` |

## Run

With [uv](https://docs.astral.sh/uv/); uvx installs the package and its runtime on first use:

```console
uvx codapact-jira --help
uvx --refresh-package codapact-jira codapact-jira --version   # update to the latest
```

Requires Python 3.13 or newer.

## Credentials

Save once in the OS keyring with `uvx codapact-jira auth login`, or set per shell:

- `basic`: `JIRA_BASIC_USERNAME`, `JIRA_BASIC_PASSWORD`. Use your Atlassian account email as the username and an API token as the password (create one at https://id.atlassian.com/manage-profile/security/api-tokens).
- `session`: `JIRA_SESSION`. For sites where API tokens are disabled: signs in through a browser window and sends the session cookies.

`<VAR>_COMMAND` runs a command that prints the secret (e.g. a password manager). `uvx codapact-jira doctor` checks settings, credentials, connectivity, and the login.

## Use

```console
uvx codapact-jira issues get --issue-id-or-key PROJ-1 --query fields.description
uvx codapact-jira issue-search search-issues --jql 'project = PROJ ORDER BY created DESC' --fields summary,status
uvx codapact-jira issues create --fields '{"project":{"key":"PROJ"},"issuetype":{"name":"Task"},"summary":"Fix login"}' --markdown @description.md
uvx codapact-jira issue-comments add-comment --issue-id-or-key PROJ-1 --markdown 'Deployed :white_check_mark:'
uvx codapact-jira describe --brief   # every command, for scripts and agents
```

As a library:

```python
from codapact_jira import Client

client = Client()
```

## Agent skill

The package ships an agent skill that points agents at the CLI. Install it into a skills folder:

```console
uvx codapact-jira skill install --dir ~/.agents/skills   # or any skills folder
uvx codapact-jira skill show                             # print it
```

Rerun after an update to refresh it; a copy with local edits needs `--force`.

## Markdown

Rich text is Markdown both ways. `--markdown TEXT|@file|@-` sets an issue description,
a comment or a worklog comment; a Markdown string for `description`, `environment`,
a comment `body` or a worklog `comment` inside JSON arguments is converted too, and every
ADF document in a response comes back as Markdown. `--doc-format adf` (or
`JIRA_DOC_FORMAT=adf`) keeps raw ADF. The dialect (panels as `> [!NOTE]`, `:status[DONE]{color=green}`,
mentions, Jira emoji such as `:tick:`) is documented by `uvx adflux syntax`.

## Sign-in

Set `--base-url` (or `JIRA_BASE_URL`) to your site, for example
`https://your-site.atlassian.net`. Two ways to sign in:

- **API token (preferred):** `codapact-jira auth login --scheme basic` with your
  Atlassian email and a token from
  https://id.atlassian.com/manage-profile/security/api-tokens.
- **Browser sign-in, where API tokens are disabled:** `codapact-jira auth login
  --scheme session` opens a window. The CLI fills in your email; you type your
  password and any second factor yourself. The session cookies go to your keyring
  and are renewed without a window until your identity provider asks for you again.
  Browser sign-in needs Chrome, Edge or `playwright install chromium`.

**Known limitation:** the CLI never types your Atlassian password. Atlassian's
sign-in edge rejects a password typed by browser automation as a bot, even with the
right password, so a saved password cannot renew a session. When the session ends,
run `auth login --scheme session` again, or use an API token.

## Development

The code in `gen/python/` is generated by [Codapact](https://github.com/mikejhill/codapact). Do not edit it; regenerate instead:

```console
uvx codapact==0.19.0 sync --check                              # has the provider published a new contract?
uvx codapact==0.19.0 sync                                      # pull it into the pinned copy
uvx codapact==0.19.0 generate                                  # run where codapact.yaml is
uv run --directory gen/python pytest                           # offline: help, dry runs, scenarios
JIRA_E2E_LIVE=1 uv run --directory gen/python pytest -k live   # read-only calls to the real API
```
