atlass 1.5.0 → 1.7.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 (3) hide show
  1. package/README.md +69 -254
  2. package/dist/cli.mjs +1461 -771
  3. package/package.json +9 -1
package/README.md CHANGED
@@ -1,317 +1,132 @@
1
1
  # atlass
2
2
 
3
- CLI to copy Jira issues and Confluence pages to Markdown, and push edits back to
4
- Confluence.
5
-
6
- Fetches an issue or page from Atlassian Cloud, converts its rich content to
7
- Markdown, writes a `.md` file with YAML frontmatter, and downloads any
8
- attachments alongside it. Confluence pages can be edited locally and updated
9
- back on the server.
3
+ CLI for Atlassian Cloud. Views Jira issues in the terminal, copies Jira issues
4
+ and Confluence pages to Markdown, pushes edits back, searches both, and shows
5
+ Bitbucket pipeline runs.
10
6
 
11
7
  ## Install
12
8
 
13
9
  ```bash
14
- pnpm install
15
- pnpm build
16
- pnpm link --global # exposes the `atlass` binary
10
+ npm install -g atlass
17
11
  ```
18
12
 
19
- Or run from source without linking:
20
-
21
- ```bash
22
- node dist/cli.mjs <command>
23
- ```
13
+ Or from source: `pnpm install && pnpm build && pnpm link --global`.
24
14
 
25
15
  ## Authentication
26
16
 
27
- Atlassian Cloud only. Auth uses your account email plus an API token
28
- (Basic auth). Create a token at
29
- `https://id.atlassian.com/manage-profile/security/api-tokens`.
17
+ Create an API token at
18
+ `https://id.atlassian.com/manage-profile/security/api-tokens`, then:
30
19
 
31
20
  ```bash
32
- atlass auth login
21
+ atlass auth login # prompts for site, email, and token
22
+ atlass auth status
23
+ atlass auth logout
33
24
  ```
34
25
 
35
- You are prompted for:
26
+ Site and email go in `~/.config/atlass/config.json`. The token goes in the OS
27
+ keyring. One account at a time.
36
28
 
37
- - site, e.g. `acme.atlassian.net`
38
- - account email
39
- - API token
40
-
41
- The login is verified against `/rest/api/3/myself` before anything is saved.
42
- The site and email are stored in `~/.config/atlass/config.json`
43
- (or `$XDG_CONFIG_HOME/atlass/config.json`). The API token is stored in the OS
44
- keyring (service `atlass`), never on disk.
29
+ Bitbucket needs its own Bitbucket-scoped token with pipeline and workspace read
30
+ scopes, since Atlassian tokens are scoped per product:
45
31
 
46
32
  ```bash
47
- atlass auth status # show current site/email and whether a token is stored
48
- atlass auth logout # remove config and delete the token from the keyring
33
+ atlass bitbucket login # prompts for workspace, default repo, and token
34
+ atlass bitbucket status
35
+ atlass bitbucket logout
49
36
  ```
50
37
 
51
- Only one account is supported at a time.
52
-
53
- ## Usage
54
-
55
- ### Copy a Jira issue
56
-
57
- ```bash
58
- atlass jira copy PROJ-123
59
- atlass jira copy https://acme.atlassian.net/browse/PROJ-123
60
- atlass jira copy # prompts for the key or URL
61
- ```
62
-
63
- Accepts an issue key or any URL containing one. Writes `PROJ-123.md` to the
64
- current directory.
65
-
66
- ### Update a Jira issue
67
-
68
- Copy an issue, edit the Markdown, then push the description back:
38
+ ## View
69
39
 
70
40
  ```bash
71
- atlass jira update PROJ-123.md
72
- atlass jira update # prompts for the file path
73
- atlass jira update file.md --dry-run # show what would change, write nothing
74
- atlass jira update file.md --summary # also push the H1 as the issue summary
41
+ atlass jira view PROJ-123
42
+ atlass jira view https://acme.atlassian.net/browse/PROJ-123
75
43
  ```
76
44
 
77
- The issue key comes from the file's frontmatter. The body is everything between
78
- the H1 and the `## Comments` section; the frontmatter, the H1, and the
79
- `## Comments` / `## Attachments` sections are not sent.
80
-
81
- Only the description is updated by default. Pass `--summary` to also push the H1
82
- as the new issue summary.
83
-
84
- Notes and safety:
85
-
86
- - The body is converted from Markdown to ADF. Only the standard constructs the
87
- copy produces round-trip (headings, lists, task lists, code, blockquotes,
88
- tables, rules, inline marks, links). Jira-specific content (panels, macros)
89
- was flattened to plain Markdown on copy and cannot be rebuilt. When the live
90
- description still contains such content, the update warns and asks for
91
- confirmation before overwriting.
92
- - Jira has no page-style version number, so staleness is checked against the
93
- frontmatter `updated` timestamp. If the issue changed since you copied it, the
94
- update aborts so you can re-copy. `--force` overrides this and the data-loss
95
- confirmation.
96
- - Image changes are not supported yet. External image URLs are kept as external
97
- media, but a local image reference aborts the update (edit text only), and a
98
- server-side image in the description is reported before it would be removed.
45
+ Prints the issue to the terminal: fields, description, the last five comments
46
+ (`--all-comments` for all of them), and attachment names. The status is colored
47
+ by category and the Markdown is syntax highlighted, code blocks included; color
48
+ turns off automatically when piping, or with `NO_COLOR`, leaving plain Markdown.
99
49
 
100
- ### Copy a Confluence page
50
+ ## Copy
101
51
 
102
52
  ```bash
53
+ atlass jira copy PROJ-123
54
+ atlass jira copy https://acme.atlassian.net/browse/PROJ-123
103
55
  atlass confluence copy 123456
104
56
  atlass confluence copy https://acme.atlassian.net/wiki/spaces/DEV/pages/123456/Title
105
- atlass confluence copy # prompts for the id or URL
106
57
  ```
107
58
 
108
- Accepts a numeric page id or a page URL. Writes `123456-title-slug.md` to the
109
- current directory.
59
+ Writes `PROJ-123.md` or `123456-title-slug.md` to the current directory, with
60
+ attachments in a sibling `<name>.assets/` folder. Pass `--out` with a directory
61
+ or file path to write elsewhere. Existing files are overwritten.
110
62
 
111
- ### Update a Confluence page
63
+ Each file has YAML frontmatter, an H1, the body as Markdown, a `## Comments`
64
+ section, and an `## Attachments` section. Inline images link to the local copy
65
+ when they can be matched to an attachment.
112
66
 
113
- Copy a page, edit the Markdown, then push it back:
67
+ ## Update
68
+
69
+ Edit a copied file, then push it back:
114
70
 
115
71
  ```bash
72
+ atlass jira update PROJ-123.md
73
+ atlass jira update PROJ-123.md --summary # also push the H1 as the summary
116
74
  atlass confluence update 123456-title-slug.md
117
- atlass confluence update # prompts for the file path
118
- atlass confluence update file.md --dry-run # show what would change, write nothing
119
- atlass confluence update file.md --title # also rename the page to the H1
75
+ atlass confluence update file.md --title # also push the H1 as the title
120
76
  atlass confluence update file.md -m "fix typo"
121
77
  ```
122
78
 
123
- The page id and version come from the file's frontmatter, so the file is
124
- self-describing. The body is everything between the H1 and the `## Comments`
125
- section; the frontmatter, the H1, and the `## Comments` / `## Attachments`
126
- sections are not sent as page content.
127
-
128
- Only the body is updated by default. Pass `--title` to also push the H1 as the
129
- new page title.
130
-
131
- Notes and safety:
132
-
133
- - The body is converted from Markdown to ADF. Only the standard constructs the
134
- copy produces round-trip (headings, lists, task lists, code, blockquotes,
135
- tables, rules, inline marks, links, images). Confluence-specific content
136
- (panels, expands, macros, layouts) was flattened to plain Markdown on copy
137
- and cannot be rebuilt. When the live page still contains such content, the
138
- update warns and asks for confirmation before overwriting.
139
- - Before writing, the current server version is checked against the frontmatter
140
- version. If the page changed since you copied it, the update aborts so you can
141
- re-copy. `--force` overrides this and the data-loss confirmation.
142
- - Images referenced in the body are uploaded as attachments (matched by name and
143
- size, so unchanged images are not re-uploaded). Local paths resolve relative
144
- to the Markdown file; a missing local image aborts the update. External image
145
- URLs are kept as external media.
146
- - Each update adds a version with the message `Updated via atlass` (override
147
- with `--message`).
148
-
149
- ### Search Jira issues
79
+ Both accept `--dry-run` to preview and `--force` to skip the checks below. The
80
+ body sent is everything between the H1 and `## Comments`.
150
81
 
151
- ```bash
152
- atlass jira search "safari login" # free text
153
- atlass jira search --project PROJ --assignee me # my open issues in PROJ
154
- atlass jira search --status "In Progress"
155
- atlass jira search --jql "project = PROJ AND labels = regression"
156
- atlass jira search # recent issues
157
- ```
158
-
159
- Friendly filters (`--project`, `--assignee`, `--status`, text) are AND'd
160
- together and ordered by most recently updated. `--assignee me` maps to the
161
- current user. `--jql` takes a raw query and cannot be combined with the friendly
162
- filters. Prints one issue per line (`KEY status summary`); use `--json` for
163
- machine output. Only the first `--limit` results are shown (default 25, max
164
- 100).
82
+ - The update aborts if the issue or page changed on the server since the copy.
83
+ - Panels, macros, expands, and layouts were flattened on copy and cannot be
84
+ rebuilt. If the live content still has them, the update asks before
85
+ overwriting.
86
+ - Confluence uploads local images referenced in the body as attachments. Jira
87
+ update does not support image changes yet.
165
88
 
166
- ### List Jira projects
89
+ ## Search
167
90
 
168
91
  ```bash
169
- atlass jira projects # every project you can browse
170
- atlass jira projects pay # filter by key or name
171
- atlass jira projects --json # machine output
172
- ```
173
-
174
- A discovery aid for the `--project` filter above: it fetches every project
175
- (paginated, ordered by key) and prints one per line as an aligned `KEY Name`
176
- list. An optional query filters by key or name server-side. `--json` emits
177
- `{ key, name, id, type, url }` per project.
178
-
179
- ### List Jira statuses
180
-
181
- ```bash
182
- atlass jira statuses # every status on the site
183
- atlass jira statuses progress # filter by name
184
- atlass jira statuses --project PROJ # statuses used by one project
185
- atlass jira statuses --json # machine output
186
- ```
187
-
188
- A discovery aid for the `--status` filter above. Without `--project` it lists
189
- every status on the site; with `--project` it lists the statuses that project's
190
- issue types use (flattened to one list). An optional query filters by name
191
- (case-insensitive substring). Statuses are collapsed by name and category, then
192
- ordered by workflow lifecycle (To Do, then In Progress, then Done) and name.
193
- Prints an aligned `Name Category` list; `--json` emits
194
- `{ name, id, category, categoryKey }` per status.
195
-
196
- ### Search Confluence pages
197
-
198
- ```bash
199
- atlass confluence search "onboarding"
200
- atlass confluence search --space DOCS
92
+ atlass jira search "safari login"
93
+ atlass jira search --project PROJ --assignee me --status "In Progress"
94
+ atlass jira search --jql "project = PROJ AND labels = regression"
95
+ atlass confluence search "onboarding" --space DOCS
201
96
  atlass confluence search --cql "label = runbook ORDER BY created DESC"
202
- atlass confluence search # recent pages
203
97
  ```
204
98
 
205
- Friendly mode always constrains to pages, so every result is copy-able. `--cql`
206
- takes a raw query and cannot be combined with `--space` or text. Prints one page
207
- per line (`id space title`); `--json` and `--limit` work as for Jira.
99
+ Filters combine with AND and sort by most recently updated. `--jql` and `--cql`
100
+ replace the friendly filters. `--limit` defaults to 25, max 100. `--json` prints
101
+ machine output. Add `--copy` to pick results interactively and copy each one,
102
+ with `--out` as the target directory.
208
103
 
209
- ### Copy from search results
210
-
211
- Add `--copy` to any search to pick results interactively and copy each to
212
- Markdown (multi-select, needs an interactive terminal). With `--copy`, `--out`
213
- is a directory that every selected file is written into:
104
+ Discovery aids for the filters:
214
105
 
215
106
  ```bash
216
- atlass jira search --project PROJ --copy --out ./tickets/
217
- atlass confluence search --space DOCS --copy
107
+ atlass jira projects [query]
108
+ atlass jira statuses [query] [--project PROJ]
218
109
  ```
219
110
 
220
- Copying continues on failure and reports a summary at the end.
221
-
222
- ### Output location
223
-
224
- By default files are written to the current directory, named after the issue
225
- key (Jira) or `<id>-<title-slug>` (Confluence). Use `--out` to override:
111
+ ## Bitbucket pipelines
226
112
 
227
113
  ```bash
228
- atlass jira copy PROJ-123 --out ./tickets/ # directory: ./tickets/PROJ-123.md
229
- atlass jira copy PROJ-123 --out ./bug.md # explicit file path
114
+ atlass bitbucket pipelines # recent runs for the default repo
115
+ atlass bitbucket pipelines --repo acme/web
116
+ atlass bitbucket pipeline 124 # one run and its steps
230
117
  ```
231
118
 
232
- Existing files are overwritten.
233
-
234
- ## Output format
235
-
236
- Each file is:
237
-
238
- - YAML frontmatter with metadata
239
- - an H1 heading (issue summary / page title)
240
- - the body, converted from ADF to Markdown
241
- - a `## Comments` section (Jira comments / Confluence footer comments)
242
- - an `## Attachments` section linking every downloaded file
243
-
244
- Jira frontmatter: `key`, `type`, `status`, `assignee`, `reporter`, `priority`,
245
- `labels`, `created`, `updated`, `url`.
246
-
247
- Confluence frontmatter: `title`, `id`, `space`, `version`, `author`, `created`,
248
- `updated`, `url`.
249
-
250
- Example (Jira):
251
-
252
- ```markdown
253
- ---
254
- key: "PROJ-123"
255
- type: "Bug"
256
- status: "In Progress"
257
- assignee: "Dana Scully"
258
- reporter: "Fox Mulder"
259
- priority: "High"
260
- labels:
261
- - "regression"
262
- url: "https://acme.atlassian.net/browse/PROJ-123"
263
- ---
264
-
265
- # Login button does nothing on Safari
266
-
267
- Steps to reproduce...
268
-
269
- ## Comments
270
-
271
- ### Fox Mulder - 2025-07-01 10:30
272
-
273
- Reproduced on 17.5.
274
-
275
- ## Attachments
276
-
277
- - [screenshot.png](PROJ-123.assets/screenshot.png)
278
- ```
279
-
280
- ### Attachments
281
-
282
- All attachments are downloaded into a sibling `<name>.assets/` folder and
283
- listed under `## Attachments`. Inline images are linked to the local copy where
284
- they can be matched:
285
-
286
- - Confluence media nodes carry the attachment file id, so inline images resolve
287
- reliably.
288
- - Jira media nodes usually expose only a filename, so inline images resolve when
289
- that filename matches an attachment; otherwise they render as
290
- `[embedded media: ...]` and the file is still captured in the attachments
291
- folder and section.
119
+ `--repo` takes `workspace/slug` or a bare slug under the configured workspace.
120
+ `--limit` and `--json` work as for search.
292
121
 
293
122
  ## Development
294
123
 
295
124
  ```bash
296
- pnpm test # run unit tests
297
- pnpm check # format, lint, typecheck (add --fix to auto-fix)
125
+ pnpm test # unit tests
126
+ pnpm check # format, lint, typecheck (--fix to auto-fix)
298
127
  pnpm build # build dist/cli.mjs
299
128
  pnpm dev # build in watch mode
300
129
  ```
301
130
 
302
- ### Layout
303
-
304
- - `src/cli.ts` command wiring (commander)
305
- - `src/commands/` `auth`, `jira`, `confluence` command handlers
306
- - `src/api/` fetch client, Jira and Confluence endpoints, attachment up/download
307
- - `src/adf/` ADF to Markdown and Markdown to ADF converters (unit tested)
308
- - `src/markdown/` frontmatter, comments, attachments, media resolver, update source
309
- - `src/config.ts`, `src/credentials.ts` config file and keyring
310
- - `src/util/` key/id parsing and output path resolution
311
-
312
- The ADF to Markdown converter in `src/adf/to-markdown.ts` is a single hand
313
- rolled walker shared by both commands. Confluence page bodies are requested as
314
- `atlas_doc_format` so they flow through the same converter as Jira. The reverse
315
- direction, `src/adf/from-markdown.ts`, tokenizes Markdown with `marked` and
316
- emits ADF for the Confluence update command; it covers the same clean subset the
317
- copy produces.
131
+ Commands live in `src/commands/`, API clients in `src/api/`, and the ADF
132
+ converters in `src/adf/`.