Features
- Factory, not a class —
createJiraClient(options)returns a plain object of methods: nonew, no inheritance, nothing to extend. - Nearly 60 methods, one client — issues, comments, attachments, worklogs, watchers, links (including remote links), projects, boards, sprints, epics, backlog and ranking, people search and instance metadata all come off the same object.
- No environment coupling in the client — it never reads
process.envor callsprocess.exit; every credential and setting arrives through the options object, so the same client behaves identically in a CLI, an MCP server, a TUI or a test. Config loading lives separately inloadConfig, for hosts that want the shared lookup. - Injectable
fetch— defaults toglobalThis.fetch; pass a fake for tests or a wrapped one for logging and retries. - ADF and Markdown, both ways —
adfToMarkdownandmarkdownToAdfconvert Jira's document format without ever emitting ANSI or HTML. - Attachments that know where they came from —
locateAttachmentsmaps each one back to the body, description or comment that referenced it, anduploadAttachment/downloadAttachmenthandle the multipart and redirect quirks. - JQL helpers and typed errors —
buildJql,searchJqland friends compose and escape queries;isJiraApiErroranderrorMessagesOfgive callers an error they can act on. - Zero runtime dependencies — plain
fetchand Node platform APIs only.
Install
npm install @kud/jiraUsage
import { createJiraClient, loadConfig } from "@kud/jira"
const jira = createJiraClient({
baseUrl: "jira.example.com",
email: "me@example.com",
token: process.env["JIRA_TOKEN"]!,
})
const issue = await jira.getIssue("ACME-1234")
console.log(issue.fields.summary)
const results = await jira.searchIssues(
"project = ACME AND status = 'In Progress'",
{ limit: 20 },
)
const transitions = await jira.getTransitions("ACME-1234")
await jira.transitionIssue("ACME-1234", transitions[0].id, {
resolution: { name: "Done" },
})baseUrl accepts a bare host as readily as a full URL. When you would rather not wire credentials by hand, loadConfig() resolves the instance URL, email and token from the environment and an optional config file, and returns { config } ready for createJiraClient, or { missing } naming every absent value.
| Area | What you get |
|---|---|
| Issues | get, create, update, delete, assign, transitions (with screen fields), changelog |
| Comments | list, add, update, delete, with ADF bodies |
| Attachments | upload from a path or bytes, download, locate where each was used |
| Worklogs and links | worklogs (add, update, delete), watchers, issue links, remote links, flattenIssueLinks |
| Projects | projects, versions, components, statuses per issue type |
| Agile | boards, board configuration, sprints, epics, backlog, moveIssuesToSprint, moveIssuesToBacklog, rankIssues |
| People and metadata | user search, fields, issue types, priorities, resolutions, statuses, labels, filters, dashboards, permissions |