@fatecannotbealtered-/jira-cli 1.0.2 → 1.0.4

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/CHANGELOG.md CHANGED
@@ -7,6 +7,46 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.0.4] - 2026-05-31
11
+
12
+ ### Fixed
13
+
14
+ - **`issue get` description** — `description` is now included in the default flat output and selectable via `--fields description` (previously only reachable through `--raw`). Bulk outputs (`issue list`, `search`, `filter run`, `sprint issues`) stay lean and omit `description` by default to preserve token efficiency. Handles both Data Center (plain string) and Cloud/v3 (ADF) descriptions.
15
+
16
+ ## [1.0.3] - 2026-05-26
17
+
18
+ ### Fixed
19
+
20
+ - **Semantic exit codes** — validation, auth, and config failures now return non-zero exit codes (via `SilentErr`); `doctor` and `login` work correctly in CI scripts.
21
+ - **Audit logging on failed writes** — write commands are logged even when the operation fails.
22
+ - **`FilterSprintFields`** — camelCase sprint fields (`startDate`, `endDate`) filter correctly with `--fields`.
23
+ - **Config file corruption detection** — invalid JSON in `~/.jira-cli/config.json` returns a clear parse error.
24
+ - **`issue edit --description`** — plain text is converted to ADF, matching `issue create`.
25
+ - **Agile API pagination** — sprint/board list, backlog, epics, and epic issues fetch all pages instead of truncating at ~50 items.
26
+ - **`ListWorklogs` pagination** — worklogs beyond the first page are included.
27
+ - **`search --order-by`** — skips appending `ORDER BY` when JQL already contains one.
28
+ - **`issue delete --dry-run`** — no longer prompts for confirmation before previewing.
29
+ - **`issue bulk-transition`** — `skipped` and `failed` counts are reported separately in JSON output.
30
+ - **E2E script** — sprint move (K7) runs before issue cleanup; `JIRA_E2E_CLEANUP=0` is honored.
31
+
32
+ ### Added
33
+
34
+ - **`cmd.Run()` / `Main()`** — testable CLI entry point with correct exit code propagation.
35
+ - **Comprehensive unit tests** — 100% statement coverage across all packages; httptest-based command integration tests.
36
+ - **`internal/api/agile_page.go`** — shared pagination helper for Jira Agile API endpoints.
37
+
38
+ ### Changed
39
+
40
+ - **Minimum Go version** — `go.mod` updated to Go 1.24 (uses `testing.T.Chdir` in tests).
41
+
42
+ ### Documentation
43
+
44
+ - Clarify `search --fields` (Jira fetch) vs `issue get/list --fields` (output trimming).
45
+ - Document `issue delete --dry-run` skips confirmation; remove misleading `sprint close --force` wording.
46
+ - Add `epic list` / `epic issues` to README; document `filter run --raw/--fields`.
47
+ - Document stdout (success JSON) vs stderr (error JSON); `doctor` exit code and `authValid` checks.
48
+ - Note npm install requires `curl`; add `install-skill` and `issue list` vs `search` JSON/jq examples.
49
+
10
50
  ## [1.0.2] - 2026-05-14
11
51
 
12
52
  ### Fixed
@@ -73,7 +113,8 @@ Initial release of jira-cli for Jira Data Center.
73
113
  - SKILL.md with JSON output schemas, error codes, exit codes, and complete flag reference.
74
114
  - GitHub PR template for contributors.
75
115
 
76
- [Unreleased]: https://github.com/fatecannotbealtered/jira-cli/compare/v1.0.2...HEAD
116
+ [Unreleased]: https://github.com/fatecannotbealtered/jira-cli/compare/v1.0.3...HEAD
117
+ [1.0.3]: https://github.com/fatecannotbealtered/jira-cli/compare/v1.0.2...v1.0.3
77
118
  [1.0.2]: https://github.com/fatecannotbealtered/jira-cli/compare/v1.0.1...v1.0.2
78
119
  [1.0.1]: https://github.com/fatecannotbealtered/jira-cli/compare/v1.0.0...v1.0.1
79
120
  [1.0.0]: https://github.com/fatecannotbealtered/jira-cli/releases/tag/v1.0.0
package/README.md CHANGED
@@ -36,21 +36,22 @@ This project is shared for **personal learning, research, and everyday productiv
36
36
 
37
37
  ### Quick start
38
38
 
39
- Recommended flow: install the CLI from npm, then install the AI Agent Skill with `npx skills add`.
39
+ Copy the block below to your agent (or run it yourself):
40
40
 
41
41
  ```bash
42
- # Install CLI
42
+ # Please install jira-cli and use it for all Jira DC operations going forward (always pass --json).
43
+ # Install CLI (requires curl on PATH — used to download the binary)
43
44
  npm install -g @fatecannotbealtered-/jira-cli
44
45
 
45
- # Install CLI Skill
46
+ # Install CLI Skill (required) — copies into your agent-supported skills directory
46
47
  npx skills add fatecannotbealtered/jira-cli -y -g
47
48
 
48
49
  # Login and verify
49
50
  jira-cli login
50
- jira-cli doctor
51
+ jira-cli doctor --json
51
52
  ```
52
53
 
53
- The CLI package provides the `jira-cli` binary; the Skill package teaches compatible AI coding assistants how to use it safely. If you are an AI Agent helping a user set this up, run the same steps and ask the user to complete any interactive browser or terminal prompts.
54
+ Optional: `jira-cli install-skill` copies the bundled skill to `~/.openclaw/skills` for OpenClaw-compatible agents.
54
55
 
55
56
  ### Alternative: Go install
56
57
 
@@ -91,7 +92,7 @@ Environment variables take precedence over the config file. This is the recommen
91
92
  ```bash
92
93
  export JIRA_HOST=https://jira.company.com
93
94
  export JIRA_TOKEN=<your-personal-access-token>
94
- jira-cli doctor --json
95
+ jira-cli doctor --json # verify authValid is true
95
96
  ```
96
97
 
97
98
  ### Generating a PAT
@@ -115,7 +116,8 @@ jira-cli issue create --project PROJ --summary "Fix login bug" --type Bug
115
116
  jira-cli issue create --project PROJ --summary "Sized story" --field "Story Points=5"
116
117
  jira-cli issue edit PROJ-123 --priority High --assignee me
117
118
  jira-cli issue edit PROJ-123 --field "Story Points=8" --field "Team=Backend"
118
- jira-cli issue delete PROJ-123 --force # --force skips confirmation
119
+ jira-cli issue delete PROJ-123 --force # --force skips confirmation prompt
120
+ jira-cli issue delete PROJ-123 --dry-run --json # preview delete (no confirmation prompt)
119
121
 
120
122
  # Clone
121
123
  jira-cli issue clone PROJ-123
@@ -165,7 +167,16 @@ jira-cli sprint list --board 42
165
167
  jira-cli sprint active --board 42
166
168
  jira-cli sprint create --board 42 --name "Sprint 5" --start-date 2024-02-01 --end-date 2024-02-14
167
169
  jira-cli sprint move --sprint 10 --issues PROJ-123,PROJ-124
168
- jira-cli sprint close --sprint 10 --force
170
+ jira-cli sprint close --sprint 10
171
+ jira-cli sprint close --sprint 10 --dry-run # preview without closing
172
+ ```
173
+
174
+ ### Epic Management
175
+
176
+ ```bash
177
+ jira-cli epic list --board 42
178
+ jira-cli epic list --board 42 --done # completed epics only
179
+ jira-cli epic issues PROJ-1 --board 42
169
180
  ```
170
181
 
171
182
  ### Board & Backlog
@@ -186,31 +197,52 @@ jira-cli user search --query "john"
186
197
  jira-cli user me
187
198
  jira-cli filter list
188
199
  jira-cli filter run <filterId>
200
+ jira-cli filter run <filterId> --json --fields key,summary,status
201
+ jira-cli filter run <filterId> --json --raw
189
202
  ```
190
203
 
191
204
  ## JSON Output
192
205
 
193
- All commands support `--json` for machine-readable output. By default, issue and sprint data is returned in a **flat, token-efficient format** (ideal for AI Agents):
206
+ All commands support `--json` for machine-readable output. **Success JSON goes to stdout; error JSON goes to stderr** — pipe or capture stdout for data, check `$?` and stderr for failures.
207
+
208
+ By default, issue and sprint data is returned in a **flat, token-efficient format** (ideal for AI Agents):
194
209
 
195
210
  ```bash
196
211
  # Flat JSON (default) — minimal fields, low token cost
197
212
  jira-cli issue get PROJ-123 --json
198
213
  jira-cli search "project = PROJ" --json | jq '.issues[].key'
199
214
 
200
- # Select only the fields you need
215
+ # issue list returns a bare array; search wraps issues in pagination metadata
216
+ # filter run with --fields also returns a bare trimmed array
217
+ jira-cli issue list --project PROJ --json | jq '.[].key'
218
+ jira-cli search "project = PROJ" --json | jq '.issues[].key'
219
+ jira-cli filter run 12345 --json --fields key,summary | jq '.[].key'
220
+
221
+ # Trim flat JSON output (issue get / issue list / sprint / filter run)
201
222
  jira-cli issue get PROJ-123 --json --fields key,summary,status,assignee
202
223
 
224
+ # search --fields controls which fields Jira fetches (API request), not output trimming
225
+ jira-cli search "project = PROJ" --fields summary,status,customfield_10001 --json
226
+
203
227
  # Raw Jira API response (full nested structure)
204
228
  jira-cli issue get PROJ-123 --json --raw
205
229
 
206
- # Clean output for scripts (suppress all non-JSON noise)
230
+ # Clean output for scripts (suppress all non-JSON noise on stdout)
207
231
  jira-cli issue get PROJ-123 --json --quiet
208
232
 
209
233
  # Preview destructive operations without executing
210
234
  jira-cli issue delete PROJ-123 --dry-run --json
211
235
  ```
212
236
 
213
- Error responses include machine-readable error codes and actionable hints:
237
+ ### Verify connectivity (`doctor`)
238
+
239
+ When using `--json`, check the `authValid` field (exit code 3 on auth/config failure):
240
+
241
+ ```bash
242
+ jira-cli doctor --json | jq '.authValid' # must be true
243
+ ```
244
+
245
+ Error responses (stderr) include machine-readable error codes and actionable hints:
214
246
 
215
247
  ```json
216
248
  {
@@ -260,13 +292,15 @@ Credentials stored at `~/.jira-cli/config.json` (permissions: 0600):
260
292
 
261
293
  | Flag | Commands | Description |
262
294
  |---|---|---|
263
- | `--raw` | `issue get`, `issue list`, `search`, `sprint list`, `sprint issues`, `sprint active` | Return raw Jira API response instead of flat format |
264
- | `--fields` | `issue get`, `issue list`, `sprint list`, `sprint issues` | Output only specified fields (e.g. `--fields key,summary,status`) |
295
+ | `--raw` | `issue get`, `issue list`, `search`, `filter run`, `sprint list`, `sprint issues`, `sprint active` | Return raw Jira API response instead of flat format |
296
+ | `--fields` | `issue get`, `issue list`, `sprint list`, `sprint issues`, `filter run` | **Output trimming** — include only listed fields in flat JSON (e.g. `--fields key,summary,status`) |
297
+ | `--fields` | `search` only | **Jira fetch fields** — comma-separated fields to request from the API (e.g. `--fields summary,status,customfield_10001`); does not trim flat output |
265
298
 
266
299
  ## Troubleshooting
267
300
 
268
301
  | Issue | Solution |
269
302
  |---|---|
303
+ | npm install fails / curl not found | Ensure `curl` is on PATH (required by npm postinstall to download the binary) |
270
304
  | Config not found | Run `jira-cli login` or set `JIRA_HOST` and `JIRA_TOKEN` env vars |
271
305
  | Authentication failed | Regenerate PAT in your Jira DC profile settings |
272
306
  | Permission denied | Check your PAT scope and project permissions |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fatecannotbealtered-/jira-cli",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "Full-featured Jira Data Center CLI for humans and AI Agents — manage issues, sprints, boards, epics, projects, users, and filters from your terminal",
5
5
  "keywords": [
6
6
  "jira",
@@ -8,9 +8,20 @@ metadata: {"openclaw":{"emoji":"🎯","requires":{"bins":["jira-cli"]}}}
8
8
 
9
9
  Jira Data Center CLI for humans and AI Agents. Supports **Jira DC only** (self-hosted), not Jira Cloud.
10
10
 
11
- > Install CLI: `npm install -g @fatecannotbealtered-/jira-cli`
12
- >
13
- > Install Skill: `npx skills add fatecannotbealtered/jira-cli -y -g`
11
+ ```bash
12
+ # Please install jira-cli and use it for all Jira DC operations going forward (always pass --json).
13
+ # Install CLI (requires curl on PATH)
14
+ npm install -g @fatecannotbealtered-/jira-cli
15
+
16
+ # Install CLI Skill (required) — copies into your agent-supported skills directory
17
+ npx skills add fatecannotbealtered/jira-cli -y -g
18
+
19
+ # Login and verify
20
+ jira-cli login
21
+ jira-cli doctor --json
22
+ ```
23
+
24
+ Optional: `jira-cli install-skill` → `~/.openclaw/skills`.
14
25
 
15
26
  ## Prerequisites
16
27
 
@@ -20,15 +31,18 @@ Before using any command, authenticate with a Jira DC instance. Follow these ste
20
31
  2. Ask the user for a **Personal Access Token (PAT)**. If they don't have one, guide them:
21
32
  "Log in to your Jira DC → click your profile avatar → Personal Access Tokens → Create token."
22
33
  3. Run `jira-cli login --host <URL> --token <PAT>` to save credentials.
23
- 4. Run `jira-cli doctor --json` to verify connectivity. If `authValid` is `true`, you're ready.
34
+ 4. Run `jira-cli doctor --json` to verify connectivity. Check that `authValid` is `true` (exit code 3 on auth/config failure).
24
35
 
25
36
  **Important:** Credentials are saved locally at `~/.jira-cli/config.json`. Environment variables `JIRA_HOST` and `JIRA_TOKEN` override the config file — use them for CI or when the user prefers not to save credentials.
26
37
 
27
38
  **Always use `--json` flag when parsing output.** Without it, output is human-formatted and not suitable for programmatic use.
28
39
 
40
+ **Stdout vs stderr:** Success JSON is written to **stdout**; error JSON is written to **stderr**. Capture stdout for data; check exit code and stderr for failures.
41
+
29
42
  ## Safety
30
43
 
31
44
  - **Do NOT use `--force` on destructive commands unless the user explicitly asks.** Commands like `issue delete` prompt for confirmation by default. Skipping confirmation with `--force` is irreversible.
45
+ - **`issue delete --dry-run` skips confirmation** — dry-run is evaluated before the confirmation prompt.
32
46
  - **Use `--dry-run` before write operations** to preview what will happen without executing. Example: `issue create --project PROJ --summary "test" --type Task --dry-run --json`.
33
47
  - **AI Agents can make mistakes.** Always confirm with the user before executing `issue delete`, `issue bulk-transition`, `sprint close`, or any operation that modifies multiple issues.
34
48
  - All write operations are recorded in `~/.jira-cli/audit/` for traceability.
@@ -38,11 +52,10 @@ Before using any command, authenticate with a Jira DC instance. Follow these ste
38
52
  ```bash
39
53
  # View issues (flat JSON by default — token-efficient)
40
54
  jira-cli issue get PROJ-123 --json
41
- jira-cli issue get PROJ-123 --json --fields key,summary,status,assignee # Only specific fields
55
+ jira-cli issue get PROJ-123 --json --fields key,summary,status,assignee # Output trimming (flat JSON)
42
56
  jira-cli issue get PROJ-123 --json --raw # Full Jira API response
43
- jira-cli issue list --project PROJ --json
44
- jira-cli issue list --project PROJ --status "In Progress" --assignee me --json
45
- jira-cli issue list --project PROJ --type Bug --priority High --limit 20 --json
57
+ jira-cli issue list --project PROJ --json # Returns bare array of flat issues
58
+ jira-cli issue list --project PROJ --json --fields key,summary,status # Trimmed array
46
59
 
47
60
  # Create and edit
48
61
  jira-cli issue create --project PROJ --summary "Fix login bug" --type Bug --json
@@ -51,6 +64,7 @@ jira-cli issue create --project PROJ --summary "Sized story" --type Story --fiel
51
64
  jira-cli issue edit PROJ-123 --summary "Updated summary" --priority Medium
52
65
  jira-cli issue edit PROJ-123 --field "Story Points=8" --field "Team=Backend"
53
66
  jira-cli issue delete PROJ-123 --force # Skip confirmation prompt
67
+ jira-cli issue delete PROJ-123 --dry-run --json # Preview delete (no confirmation prompt)
54
68
 
55
69
  # Clone an issue
56
70
  jira-cli issue clone PROJ-123 --json # Clone with default summary
@@ -110,7 +124,7 @@ jira-cli search "project = PROJ" --limit 100 --json
110
124
  jira-cli search "project = PROJ" --all --json # Fetch ALL results (auto-paginate)
111
125
  jira-cli search "project = PROJ" --count # Only show total count
112
126
  jira-cli search "project = PROJ" --order-by updated --json
113
- jira-cli search "type = Bug AND priority = High" --fields key,summary,status --json
127
+ jira-cli search "type = Bug AND priority = High" --fields summary,status,customfield_10001 --json # Jira fetch fields (API request)
114
128
  ```
115
129
 
116
130
  ## Sprint Management
@@ -124,7 +138,8 @@ jira-cli sprint issues --sprint 10 --json
124
138
  jira-cli sprint create --board 42 --name "Sprint 5" --start-date 2024-02-01 --end-date 2024-02-14 --json
125
139
  jira-cli sprint update --sprint 10 --goal "Complete payment refactor"
126
140
  jira-cli sprint move --sprint 10 --issues PROJ-123,PROJ-124,PROJ-125
127
- jira-cli sprint close --sprint 10 --force # --force skips confirmation
141
+ jira-cli sprint close --sprint 10 --json
142
+ jira-cli sprint close --sprint 10 --dry-run --json # Preview without closing (no confirmation prompt)
128
143
  ```
129
144
 
130
145
  ## Board & Backlog
@@ -175,6 +190,8 @@ jira-cli filter list --json
175
190
  jira-cli filter get <filterId> --json
176
191
  jira-cli filter create --name "My Bugs" --jql "assignee = me AND type = Bug" --json
177
192
  jira-cli filter run <filterId> --json
193
+ jira-cli filter run <filterId> --json --fields key,summary,status # Output trimming
194
+ jira-cli filter run <filterId> --json --raw # Raw Jira search response
178
195
  jira-cli filter delete <filterId>
179
196
  ```
180
197
 
@@ -218,9 +235,9 @@ jira-cli sprint move --sprint 11 --issues PROJ-200,PROJ-201,PROJ-202
218
235
 
219
236
  ## Guardrails
220
237
 
221
- - Always run `jira-cli doctor --json` to verify auth before bulk operations
222
- - `issue delete` requires typing the issue key to confirm. Use `--force` to skip confirmation in automated workflows
223
- - `sprint close` is irreversible. Use `--force` to skip confirmation
238
+ - Always run `jira-cli doctor --json` and verify **`authValid` is `true`** before bulk operations (exit code 3 on failure)
239
+ - `issue delete` requires typing the issue key to confirm. Use `--force` to skip confirmation in automated workflows; `--dry-run` skips confirmation
240
+ - `sprint close` has no confirmation prompt — use `--dry-run` to preview; confirm with the user before closing
224
241
  - Use `--json` flag when parsing output in scripts or AI workflows
225
242
  - Use `--dry-run` to preview what a write command would do without executing it
226
243
  - Use `--quiet` with `--json` to suppress all non-JSON output (clean pipe-friendly output)
@@ -237,13 +254,36 @@ jira-cli sprint move --sprint 11 --issues PROJ-200,PROJ-201,PROJ-202
237
254
 
238
255
  ## Output Control Flags
239
256
 
240
- These flags are available on read commands (`issue get`, `issue list`, `search`, `sprint list`, `sprint issues`):
257
+ Two different meanings for `--fields`:
258
+
259
+ | Command | `--fields` meaning |
260
+ |---------|-------------------|
261
+ | `search` | **Jira fetch fields** — comma-separated fields to request from the API (e.g. `summary,status,customfield_10001`) |
262
+ | `issue get`, `issue list`, `sprint list`, `sprint issues`, `filter run` | **Output trimming** — include only listed keys in flat JSON (e.g. `key,summary,status`) |
241
263
 
242
- - `--raw` — Return the full raw Jira API response instead of the token-efficient flat format
243
- - `--fields key,summary,status` — Output only the specified fields (flat JSON mode only)
264
+ Other read-command flags:
265
+
266
+ - `--raw` — Return the full raw Jira API response instead of the token-efficient flat format (on `issue get/list`, `search`, `filter run`, `sprint list/issues/active`)
244
267
 
245
268
  ## JSON Output Schemas
246
269
 
270
+ ### List vs search JSON shape
271
+
272
+ | Command | Flat `--json` shape |
273
+ |---------|---------------------|
274
+ | `issue list` | Bare array: `[{key, summary, ...}, ...]` |
275
+ | `search`, `filter run` (default) | Object with pagination: `{total, startAt, maxResults, issues: [...]}` |
276
+ | `filter run --fields ...` | Bare trimmed array (like `issue list --fields`) |
277
+ | `issue get` | Single flat issue object |
278
+
279
+ **jq examples:**
280
+
281
+ ```bash
282
+ jira-cli issue list --project PROJ --json | jq '.[].key'
283
+ jira-cli search "project = PROJ" --json | jq '.issues[].key'
284
+ jira-cli filter run 12345 --json | jq '.issues[].status'
285
+ ```
286
+
247
287
  ### Flat Issue (default with --json)
248
288
 
249
289
  ```json
@@ -276,7 +316,7 @@ These flags are available on read commands (`issue get`, `issue list`, `search`,
276
316
  }
277
317
  ```
278
318
 
279
- ### Error Response (with --json)
319
+ ### Error Response (with --json, written to stderr)
280
320
 
281
321
  ```json
282
322
  {