@theholocron/jira-client 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +35 -56
  2. package/package.json +34 -35
package/README.md CHANGED
@@ -1,72 +1,51 @@
1
- # Jira CLI
1
+ # @theholocron/jira-client
2
2
 
3
- Interact with our internal Jira appliance from the command-line.
3
+ TypeScript client for the Jira REST API v2. Covers issues, versions, projects, links, transitions, and search.
4
4
 
5
5
  ## Installation
6
6
 
7
7
  ```bash
8
- npm install --save-dev @theholocron/cli-jira
8
+ pnpm add @theholocron/jira-client
9
9
  ```
10
10
 
11
- ## Table of Contents
12
-
13
- * [Usage](#how-do-i-use-this)
14
- * [Documentation](#documentation-)
15
-
16
- ## How Do I Use This?
17
-
18
- Run the `--help` or `-h` command to find out how to use the command.
19
-
20
- ```sh
21
- Usage: jira <command> [options]
22
-
23
- Options:
24
- --verbose Turn on the extra logging [boolean] [default: false]
25
- -h, --help Show help [boolean]
26
- -v, --version Show version number [boolean]
27
-
28
- Commands:
29
- jira link <command> [options]
30
- jira search <command> [options]
31
- jira ticket <command> [options]
32
- jira transition <command> [options]
33
- jira version <command> [options]
34
-
35
- Examples:
36
- jira link create PL-1 PL-2
37
- jira link create PL-1 PL-2 --type="Duplicate"
38
- jira search 'application-example 2020.1.0'
39
- jira search 'application-example 2020.1.0' --project="PL" --subtasks
40
- jira ticket create "app has a bug" '{ "description": "follow these steps…" }' --project="PL" --type="Bug"
41
- jira ticket edit PL-1 '{ "description": "follow these steps to reproduce…" }'
42
- jira ticket get PL-1
43
- jira transition create PL-1 released
44
- jira transition get PL-1
45
- jira version create "app release 2020.1.0" '{ "description": "first release of 2020" }' --project="PL"
46
- jira version get 10000 --param="issuesstatus"
47
- jira version edit 1000 '{ "description": "second release of 2020" }'
48
- jira version delete 10000
49
- jira version archive 10000 '{ "description": "archiving releases of 2019" }'
50
- jira version release 10000 '{ "releaseDate": "2020-01-01" }'
51
- ```
11
+ ## Usage
12
+
13
+ ```ts
14
+ import { createJiraClient } from "@theholocron/jira-client";
15
+
16
+ const jira = createJiraClient({
17
+ host: "https://your-org.atlassian.net/rest/api/2",
18
+ token: Buffer.from(`${email}:${apiToken}`).toString("base64"),
19
+ });
52
20
 
53
- ### Token
21
+ // Create a ticket
22
+ const issue = await jira.issues.create("Fix login bug", "Bug", "PROJ");
54
23
 
55
- This CLI uses Jira's [v2 API](https://developer.atlassian.com/cloud/jira/platform/rest/v2/) and requires a username and password in order to access anything on our GitHub appliance and it expects that to be exposed on the Node environment process.
24
+ // Get multiple tickets
25
+ const issues = await jira.issues.getMany(["PROJ-1", "PROJ-2"]);
56
26
 
57
- `RP_JIRA_USERNAME` and `RP_JIRA_PASSWORD` is required for this to work on the command-line, so we recommend exposing them by putting them in your `.bashrc` or `.bash_profile` (e.g. `export RP_JIRA_USERNAME=<user>; export RP_JIRA_PASSWORD=<password>`).
27
+ // Search with JQL
28
+ const results = await jira.issues.search({
29
+ jql: "project = PROJ AND status = Open",
30
+ });
31
+
32
+ // Manage versions
33
+ const version = await jira.versions.create("v1.2.0", "PROJ");
34
+ await jira.versions.update(version.id, { released: true });
35
+ ```
58
36
 
59
- You can also source this while running the command (e.g. `RP_JIRA_USERNAME=<username> RP_JIRA_PASSWORD=<password> jira <command>"`), but if you plan on running this more than once, its probably best to follow the above advice.
37
+ ## API
60
38
 
61
- ### Return
39
+ - **`jira.issues`** — create, get, getMany, update, getProperty, search
40
+ - **`jira.versions`** — create, get, getMany, update, delete
41
+ - **`jira.projects`** — get
42
+ - **`jira.links`** — create, createMany, getLinkTypes
43
+ - **`jira.transitions`** — create, get, getResolutions
62
44
 
63
- If command is valid, it will exit with a `0` code. Otherwise, it will exit with `1` code and an error message.
45
+ ## Auth
64
46
 
65
- ## Documentation
47
+ Jira REST API v2 uses HTTP Basic auth with a base64-encoded `email:apiToken` string. Generate an API token at [id.atlassian.com/manage-profile/security/api-tokens](https://id.atlassian.com/manage-profile/security/api-tokens).
66
48
 
67
- Because of the complex nature of Jira and its API, this CLI has been broken down into sub-commands based on the groupings provided by Jira's [API documentation](https://developer.atlassian.com/cloud/jira/platform/rest/v2/). Each sub-command has its own documentation.
49
+ ## License
68
50
 
69
- * [Link](./src/cmds/link/README.md) - create a link between two tickets
70
- * [Search](./src/cmds/README.md) - search for anything on a Jira project board
71
- * [Ticket](./src/cmds/ticket/README.md) - create a ticket, grab information from a ticket, or edit a ticket; anything that correlates to tickets according to [Jira's grouping](https://developer.atlassian.com/cloud/jira/platform/rest/v2/#api-group-Issues)
72
- * [Version](./src/cmds/version/README.md) - create a version, grab information from a version, edit a version, delete a version, archive or release a version; anything that correlates to versions according to [Jira's grouping](https://developer.atlassian.com/cloud/jira/platform/rest/v2/#api-group-Project-versions)
51
+ GPL-3.0 © [Newton Koumantzelis](https://github.com/iamnewton)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theholocron/jira-client",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "A TypeScript client for the Jira REST API",
5
5
  "homepage": "https://github.com/theholocron/clients/tree/main/packages/jira-client#readme",
6
6
  "bugs": "https://github.com/theholocron/clients/issues",
@@ -12,49 +12,48 @@
12
12
  "license": "GPL-3.0",
13
13
  "author": "Newton Koumantzelis",
14
14
  "type": "module",
15
- "main": "./src/index.ts",
15
+ "main": "./dist/index.mjs",
16
16
  "exports": {
17
- ".": "./src/index.ts"
18
- },
19
- "scripts": {
20
- "build": "tsdown",
21
- "lint": "eslint .",
22
- "test": "vitest run",
23
- "test:watch": "vitest",
24
- "test:coverage": "vitest run --coverage",
25
- "typecheck": "tsc --noEmit"
17
+ ".": {
18
+ "types": "./dist/index.d.mts",
19
+ "import": "./dist/index.mjs",
20
+ "default": "./dist/index.mjs"
21
+ }
26
22
  },
27
23
  "devDependencies": {
28
24
  "@types/node": "^22.0.0",
29
- "@theholocron/eslint-config": "catalog:",
30
- "@theholocron/tsconfig": "catalog:",
31
- "@theholocron/tsdown-config": "catalog:",
32
- "@theholocron/vitest-config": "catalog:",
33
- "@vitest/coverage-v8": "catalog:",
34
- "@vitest/eslint-plugin": "catalog:",
35
- "eslint": "catalog:",
36
- "eslint-plugin-n": "catalog:",
37
- "globals": "catalog:",
38
- "tsdown": "catalog:",
39
- "typescript": "catalog:",
40
- "vitest": "catalog:"
25
+ "@theholocron/eslint-config": "^6.0.0",
26
+ "@theholocron/tsconfig": "^6.0.0",
27
+ "@theholocron/tsdown-config": "^6.0.0",
28
+ "@theholocron/vitest-config": "^6.0.0",
29
+ "@vitest/coverage-v8": "^4.1.10",
30
+ "@vitest/eslint-plugin": "^1.6.23",
31
+ "eslint": "^10.7.0",
32
+ "eslint-plugin-n": "^18.2.2",
33
+ "globals": "^17.7.0",
34
+ "tsdown": "^0.22.5",
35
+ "typescript": "^5.9.3",
36
+ "vitest": "^4.1.10"
41
37
  },
42
38
  "publishConfig": {
43
- "access": "public",
44
- "main": "./dist/index.mjs",
45
- "types": "./dist/index.d.mts",
46
- "exports": {
47
- ".": {
48
- "types": "./dist/index.d.mts",
49
- "import": "./dist/index.mjs",
50
- "default": "./dist/index.mjs"
51
- }
52
- }
39
+ "access": "public"
53
40
  },
54
41
  "files": [
55
42
  "dist",
56
43
  "README.md"
57
44
  ],
45
+ "engines": {
46
+ "node": ">=22.0.0"
47
+ },
58
48
  "releases": "https://github.com/theholocron/clients/releases",
59
- "wiki": "https://github.com/theholocron/clients/wiki"
60
- }
49
+ "wiki": "https://github.com/theholocron/clients/wiki",
50
+ "scripts": {
51
+ "build": "tsdown",
52
+ "lint": "eslint .",
53
+ "test": "vitest run",
54
+ "test:watch": "vitest",
55
+ "test:coverage": "vitest run --coverage",
56
+ "typecheck": "tsc --noEmit"
57
+ },
58
+ "types": "./dist/index.d.mts"
59
+ }