jiradc-cli 1.0.6 → 1.0.8

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/dist/index.js +33 -7
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -6,6 +6,28 @@ import { Command } from "commander";
6
6
 
7
7
  // src/utils/client.ts
8
8
  import { JiraClient } from "jira-data-center-client";
9
+
10
+ // src/utils/credentials.ts
11
+ function getCredentialInfo() {
12
+ const baseUrl = process.env.JIRA_URL;
13
+ const token = process.env.JIRA_TOKEN;
14
+ return {
15
+ environment: {
16
+ JIRA_URL: {
17
+ value: baseUrl ?? null,
18
+ description: "Your Jira Server base URL (e.g., https://jira.example.com)"
19
+ },
20
+ JIRA_TOKEN: {
21
+ value: token ? "<set>" : null,
22
+ description: "Personal Access Token"
23
+ }
24
+ },
25
+ tokenUrl: `${baseUrl ?? "https://jira.example.com"}/secure/ViewProfile.jspa`,
26
+ hint: "Export environment variables in your shell profile (e.g., ~/.zshrc)."
27
+ };
28
+ }
29
+
30
+ // src/utils/client.ts
9
31
  function getClient() {
10
32
  const baseUrl = process.env.JIRA_URL;
11
33
  const token = process.env.JIRA_TOKEN;
@@ -14,11 +36,7 @@ function getClient() {
14
36
  process.stderr.write(
15
37
  `${JSON.stringify({
16
38
  error: `Missing required environment variables: ${missing.join(", ")}`,
17
- setup: {
18
- JIRA_URL: "Your Jira Server base URL (e.g., https://jira.example.com)",
19
- JIRA_TOKEN: "Personal Access Token \u2014 generate in Jira > Profile > Personal Access Tokens"
20
- },
21
- hint: "Export these in your shell profile (e.g., ~/.zshrc)."
39
+ ...getCredentialInfo()
22
40
  })}
23
41
  `
24
42
  );
@@ -50,8 +68,12 @@ function stripResponse(obj) {
50
68
  }
51
69
 
52
70
  // src/utils/output.ts
71
+ var prettyPrint = false;
72
+ function setPretty(value) {
73
+ prettyPrint = value;
74
+ }
53
75
  function output(data) {
54
- process.stdout.write(`${JSON.stringify(stripResponse(data), null, 2)}
76
+ process.stdout.write(`${JSON.stringify(stripResponse(data), null, prettyPrint ? 2 : void 0)}
55
77
  `);
56
78
  }
57
79
  function handleError(err) {
@@ -72,7 +94,7 @@ function handleError(err) {
72
94
  process.stderr.write(
73
95
  `${JSON.stringify({
74
96
  error: "Authentication failed (HTTP 401)",
75
- hint: "Verify that JIRA_URL and JIRA_TOKEN are set correctly. The token may be expired or invalid."
97
+ ...getCredentialInfo()
76
98
  })}
77
99
  `
78
100
  );
@@ -1088,6 +1110,10 @@ ${styleText("bold", "Examples:")}
1088
1110
  ${DIM}$${RESET} jiradc sprint list --board 42 --state active
1089
1111
  `
1090
1112
  );
1113
+ program.option("--pretty", "Pretty-print JSON output");
1114
+ program.hook("preAction", (thisCommand) => {
1115
+ if (thisCommand.optsWithGlobals().pretty) setPretty(true);
1116
+ });
1091
1117
  registerIssueCommands(program);
1092
1118
  registerProjectCommands(program);
1093
1119
  registerBoardCommands(program);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jiradc-cli",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "publish": true,
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -22,8 +22,8 @@
22
22
  "tsx": "^4.19.2",
23
23
  "typescript": "^5.7.2",
24
24
  "vitest": "^4.0.16",
25
- "config-typescript": "0.0.0",
26
- "config-eslint": "0.0.0"
25
+ "config-eslint": "0.0.0",
26
+ "config-typescript": "0.0.0"
27
27
  },
28
28
  "engines": {
29
29
  "node": ">=22.0.0"