@kud/jira-cli 0.7.0 → 0.8.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.
package/README.md CHANGED
@@ -145,8 +145,17 @@ Exit codes:
145
145
  | `0` | success |
146
146
  | `1` | Jira rejected the request, or bad usage |
147
147
  | `2` | the environment is not set up |
148
+ | `3` | `--json` result may be truncated |
148
149
  | `4` | not authenticated |
149
150
 
151
+ `issue list` and `search` stop at `--limit` (50 by default), and Jira no longer
152
+ reports a total, so a full page is the only evidence that rows were left behind.
153
+ When one comes back, both commands warn on stderr, and with `--json` they also
154
+ exit `3`. Stdout is untouched, so `--json` parses exactly as before and a caller
155
+ that ignores the exit code sees no change. The table output keeps exiting `0`,
156
+ so `jira issue list && …` still works at a terminal.
157
+ Raise `--limit` to be sure you have it all.
158
+
150
159
  Colour is disabled automatically when stdout is not a TTY, and when `NO_COLOR` is set.
151
160
 
152
161
  ## Custom fields
@@ -60,6 +60,16 @@ var printJson = (value) => {
60
60
  process.stdout.write(`${JSON.stringify(value, null, 2)}
61
61
  `);
62
62
  };
63
+ var TRUNCATED_EXIT_CODE = 3;
64
+ var isTruncated = (count, limit) => Number.isFinite(limit) && limit > 0 && count >= limit;
65
+ var warnIfTruncated = (count, limit, { exitCode }) => {
66
+ if (!isTruncated(count, limit)) return;
67
+ process.stderr.write(
68
+ `jira: result may be truncated at --limit ${limit} \u2014 there may be more
69
+ `
70
+ );
71
+ if (exitCode) process.exitCode = TRUNCATED_EXIT_CODE;
72
+ };
63
73
 
64
74
  export {
65
75
  table,
@@ -67,5 +77,6 @@ export {
67
77
  exitError,
68
78
  isExitError,
69
79
  context,
70
- printJson
80
+ printJson,
81
+ warnIfTruncated
71
82
  };
package/dist/index.js CHANGED
@@ -5,8 +5,9 @@ import {
5
5
  isExitError,
6
6
  printJson,
7
7
  table,
8
- truncate
9
- } from "./chunk-RTBMVYZM.js";
8
+ truncate,
9
+ warnIfTruncated
10
+ } from "./chunk-UTNXGDH2.js";
10
11
 
11
12
  // src/index.ts
12
13
  import { realpathSync } from "fs";
@@ -407,10 +408,13 @@ var registerIssueCommands = (program2) => {
407
408
  issue.command("list").alias("ls").description("list issues matching the given filters").option("-a, --assignee <who>", "assignee account id, email, or 'none'").option("-m, --mine", "issues assigned to you").option("-s, --status <status>", "status name, e.g. 'In Progress'").option("-p, --project <key>", "project key").option("--sprint <name>", "sprint name, or 'current' for open sprints").option("-l, --label <label>", "label").option("-q, --jql <jql>", "raw JQL, replacing all other filters").option("-n, --limit <n>", "maximum issues to return", "50").option("--json", "emit JSON").action(async (options) => {
408
409
  const ctx = context();
409
410
  const jql = buildJql(options, ctx.config.defaultProject);
410
- const issues = await ctx.client.searchIssues(jql, {
411
- limit: Number(options.limit)
412
- });
413
- if (options.json) return printJson(issues);
411
+ const limit = Number(options.limit);
412
+ const issues = await ctx.client.searchIssues(jql, { limit });
413
+ if (options.json) {
414
+ printJson(issues);
415
+ warnIfTruncated(issues.length, limit, { exitCode: true });
416
+ return;
417
+ }
414
418
  if (issues.length === 0) {
415
419
  const me = await ctx.client.getMe().catch(() => null);
416
420
  if (!me?.accountId)
@@ -424,6 +428,7 @@ var registerIssueCommands = (program2) => {
424
428
  }
425
429
  process.stdout.write(`${table(issues, issueColumns(ctx))}
426
430
  `);
431
+ warnIfTruncated(issues.length, limit, { exitCode: false });
427
432
  });
428
433
  issue.command("view <key>").description("show one issue").option("--json", "emit JSON").option("--comments", "include comments").action(
429
434
  async (key, options) => {
@@ -722,10 +727,13 @@ import { configPath, readFileConfig } from "@kud/jira";
722
727
  var registerSearchCommand = (program2) => {
723
728
  program2.command("search <jql>").description("run a raw JQL query").option("-n, --limit <n>", "maximum issues to return", "50").option("--json", "emit JSON").action(async (jql, options) => {
724
729
  const ctx = context();
725
- const issues = await ctx.client.searchIssues(jql, {
726
- limit: Number(options.limit)
727
- });
728
- if (options.json) return printJson(issues);
730
+ const limit = Number(options.limit);
731
+ const issues = await ctx.client.searchIssues(jql, { limit });
732
+ if (options.json) {
733
+ printJson(issues);
734
+ warnIfTruncated(issues.length, limit, { exitCode: true });
735
+ return;
736
+ }
729
737
  if (issues.length === 0) {
730
738
  process.stderr.write("no issues match\n");
731
739
  return;
@@ -738,6 +746,7 @@ var registerSearchCommand = (program2) => {
738
746
  ])}
739
747
  `
740
748
  );
749
+ warnIfTruncated(issues.length, limit, { exitCode: false });
741
750
  });
742
751
  };
743
752
  var registerFieldsCommand = (program2) => {
@@ -900,7 +909,7 @@ var interactiveArgs = (argv) => {
900
909
  var main = async () => {
901
910
  const { screen, mock, board, isBare } = interactiveArgs(process.argv);
902
911
  if (screen === "list" && isBare) {
903
- const { SCREENS } = await import("./tui-Y4KR7SWS.js");
912
+ const { SCREENS } = await import("./tui-HYJNQNH4.js");
904
913
  process.stdout.write(`${SCREENS.join("\n")}
905
914
  `);
906
915
  return;
@@ -910,7 +919,7 @@ var main = async () => {
910
919
  program.outputHelp();
911
920
  return;
912
921
  }
913
- const { runTui } = await import("./tui-Y4KR7SWS.js");
922
+ const { runTui } = await import("./tui-HYJNQNH4.js");
914
923
  const [, key] = (screen ?? "").split(":");
915
924
  await runTui({
916
925
  screen: screen?.startsWith("detail") ? "detail" : "issues",
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  context
3
- } from "./chunk-RTBMVYZM.js";
3
+ } from "./chunk-UTNXGDH2.js";
4
4
 
5
5
  // src/tui/index.tsx
6
6
  import { render } from "ink";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kud/jira-cli",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "type": "module",
5
5
  "description": "Jira on the command line — read issues, comments and attachments as plain text",
6
6
  "keywords": [