azdo-cli 0.5.0-develop.153 → 0.5.0-feature-fixer-and-gitflow-skills.261

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 +22 -340
  2. package/dist/index.js +1238 -265
  3. package/package.json +3 -2
package/README.md CHANGED
@@ -9,17 +9,14 @@ Azure DevOps CLI focused on work item read/write workflows.
9
9
  ## Features
10
10
 
11
11
  - Retrieve work items with readable output (`get-item`)
12
- - Update work item state (`set-state`)
13
- - Assign and unassign work items (`assign`)
14
- - Set any work item field by reference name (`set-field`)
12
+ - Update work item state, assignee, or any field (`set-state`, `assign`, `set-field`)
15
13
  - Create or update work items from markdown documents (`upsert`)
16
14
  - Read and post work item comments (`comments`)
17
- - Read rich-text fields as markdown (`get-md-field`)
18
- - Set rich-text fields as markdown from inline text, file, or stdin (`set-md-field`)
19
- - Check branch pull request status, open PRs to `develop`, and review active comments (`pr`)
15
+ - Read/write rich-text fields as markdown (`get-md-field`, `set-md-field`)
16
+ - Check branch pull request status, open PRs to `develop`, list PR comment threads for any PR (`--pr-number`), and resolve/reopen threads from the CLI (`pr`)
20
17
  - Persist org/project/default fields in local config (`config`)
21
18
  - List all fields of a work item (`list-fields`)
22
- - Store PAT in OS credential store (or use `AZDO_PAT`)
19
+ - Store a PAT per Azure DevOps organization in the OS credential store via `azdo auth` (or use `AZDO_PAT`). Inspect with `azdo auth status`, remove with `azdo auth logout`. See [docs/authentication.md](docs/authentication.md).
23
20
 
24
21
  ## Installation
25
22
 
@@ -27,357 +24,42 @@ Azure DevOps CLI focused on work item read/write workflows.
27
24
  npm install -g azdo-cli
28
25
  ```
29
26
 
30
- ## Utility Scripts
31
-
32
- The repository also includes a helper script for syncing local `.env` entries into GitHub Actions secrets for the current repository:
33
-
34
- ```bash
35
- ./scripts/sync-env-to-gh-secrets.zsh
36
- ```
37
-
38
- It walks upward from the current directory until it finds a `.env`, then sets each valid `KEY=VALUE` entry with `gh secret set`. You can also limit the sync to selected keys:
39
-
40
- ```bash
41
- ./scripts/sync-env-to-gh-secrets.zsh FOO BAR
42
- ```
43
-
44
- ## Authentication and Context Resolution
45
-
46
- PAT resolution order:
47
- 1. `AZDO_PAT` environment variable
48
- 2. Stored credential from OS keyring
49
- 3. Interactive PAT prompt (then stored for next runs)
50
-
51
- Org/project resolution order:
52
- 1. `--org` + `--project` flags
53
- 2. Saved config (`azdo config set org ...`, `azdo config set project ...`)
54
- 3. Azure DevOps `origin` git remote auto-detection
55
-
56
27
  ## Quick Start
57
28
 
58
29
  ```bash
59
- # 1) Configure defaults once
30
+ # Configure defaults once
60
31
  azdo config set org myorg
61
32
  azdo config set project myproject
62
33
 
63
- # 2) Read a work item
34
+ # Read a work item
64
35
  azdo get-item 12345
65
36
 
66
- # 3) Update state
37
+ # Update state
67
38
  azdo set-state 12345 "Active"
68
39
 
69
- # 4) Create or update a work item from markdown
40
+ # Create a work item from markdown
70
41
  azdo upsert --type "User Story" --content $'---\nTitle: Improve markdown import UX\nState: New\n---'
71
42
 
72
- # 5) Review work item discussion and post an update
43
+ # Read and post work item comments
73
44
  azdo comments list 12345
74
45
  azdo comments add 12345 "Investigating the root cause now."
75
- ```
76
-
77
- ## Command Cheat Sheet
78
-
79
- | Command | Purpose | Common Flags |
80
- | --- | --- | --- |
81
- | `azdo get-item <id>` | Read a work item | `--short`, `--fields`, `--markdown`, `--org`, `--project` |
82
- | `azdo set-state <id> <state>` | Change work item state | `--json`, `--org`, `--project` |
83
- | `azdo assign <id> [name]` | Assign or unassign owner | `--unassign`, `--json`, `--org`, `--project` |
84
- | `azdo set-field <id> <field> <value>` | Update any field | `--json`, `--org`, `--project` |
85
- | `azdo upsert [id]` | Create or update a work item from markdown | `--content`, `--file`, `--type`, `--json`, `--org`, `--project` |
86
- | `azdo comments <subcommand>` | Read or add work item comments | `list`, `add`, `--json`, `--org`, `--project` |
87
- | `azdo get-md-field <id> <field>` | Get field as markdown | `--org`, `--project` |
88
- | `azdo set-md-field <id> <field> [content]` | Set markdown field | `--file`, `--json`, `--org`, `--project` |
89
- | `azdo list-fields <id>` | List all fields of a work item | `--json`, `--org`, `--project` |
90
- | `azdo pr <subcommand>` | Manage pull requests for the current branch | `status`, `open`, `comments`, `--json`, `--org`, `--project` |
91
- | `azdo config <subcommand>` | Manage saved settings | `set`, `get`, `list`, `unset`, `wizard`, `--json` |
92
- | `azdo clear-pat` | Remove stored PAT | none |
93
-
94
- ## Command Reference
95
-
96
- ### Core
97
-
98
- ```bash
99
- # Get full work item
100
- azdo get-item 12345
101
-
102
- # Get short view
103
- azdo get-item 12345 --short
104
-
105
- # Include extra fields for this call
106
- azdo get-item 12345 --fields "System.Tags,Microsoft.VSTS.Common.Priority"
107
-
108
- # Convert rich text fields to markdown
109
- azdo get-item 12345 --markdown
110
-
111
- ```
112
-
113
- ```bash
114
- # Set state
115
- azdo set-state 12345 "Closed"
116
-
117
- # Assign / unassign
118
- azdo assign 12345 "someone@company.com"
119
- azdo assign 12345 --unassign
120
-
121
- # Set generic field
122
- azdo set-field 12345 System.Title "Updated title"
123
- ```
124
-
125
- ### List Fields
126
-
127
- ```bash
128
- # List all fields with values (rich text fields preview first 5 lines)
129
- azdo list-fields 12345
130
-
131
- # JSON output
132
- azdo list-fields 12345 --json
133
- ```
134
-
135
- ### Markdown Display
136
-
137
- The `get-item` command can convert HTML rich-text fields to readable markdown. Resolution order:
138
-
139
- 1. `--markdown` flag enables markdown for the current call
140
- 2. Config setting: `azdo config set markdown true`
141
- 3. Default: off (HTML stripped to plain text)
142
-
143
- ### Markdown Field Commands
144
-
145
- ```bash
146
- # Read field and auto-convert HTML -> markdown
147
- azdo get-md-field 12345 System.Description
148
-
149
- # Set markdown inline
150
- azdo set-md-field 12345 System.Description "# Title\n\nSome **bold** text"
151
-
152
- # Set markdown from file
153
- azdo set-md-field 12345 System.Description --file ./description.md
154
-
155
- # Set markdown from stdin
156
- cat description.md | azdo set-md-field 12345 System.Description
157
- ```
158
-
159
- ### Pull Request Commands
160
-
161
- The `pr` command group uses the current git branch and the Azure DevOps `origin` remote automatically. It requires a PAT with `Code (Read)` scope for read operations and `Code (Read & Write)` for pull request creation.
162
-
163
- ```bash
164
- # Check whether the current branch already has pull requests
165
- azdo pr status
166
-
167
- # Open a pull request to develop
168
- azdo pr open --title "Add PR handling" --description "Implements pr status, pr open, pr comments commands"
169
-
170
- # Review active comments for the current branch's active pull request
171
- azdo pr comments
172
- ```
173
-
174
- `azdo pr status`
175
-
176
- - Lists pull requests for the current branch
177
- - Prints `No pull requests found for branch <branch>.` when no PRs exist
178
- - Supports `--json` for machine-readable output
179
-
180
- `azdo pr open`
181
-
182
- - Requires both `--title <title>` and `--description <description>`
183
- - Targets `develop` automatically
184
- - Creates a new active pull request when none exists
185
- - Reuses the existing active PR when one already matches the branch and target
186
- - Fails with a clear error when run from `develop` or when multiple active PRs already exist
187
-
188
- `azdo pr comments`
189
-
190
- - Resolves the single active pull request for the current branch
191
- - Returns only active or pending threads with visible, non-deleted comments
192
- - Groups text output by thread and shows file context when available
193
- - Prints `Pull request #<id> has no active comments.` when the PR has no active comment threads
194
- - Fails instead of guessing when no active PR or multiple active PRs exist
195
-
196
- ### Work Item Comment Commands
197
-
198
- The `comments` command group works on a specific work item ID. It requires a PAT with `Work Items (read)` scope for listing comments and `Work Items (Read & Write)` to add a new comment.
199
46
 
200
- ```bash
201
- # Read the visible comment history for a work item
202
- azdo comments list 12345
203
-
204
- # Read the same history as JSON
205
- azdo comments list 12345 --json
206
-
207
- # Post a progress update
208
- azdo comments add 12345 "Investigation complete. Working on the fix next."
209
-
210
- # Post the update and return JSON
211
- azdo comments add 12345 "Queued validation run." --json
212
- ```
213
-
214
- `azdo comments list`
215
-
216
- - Resolves the target work item directly from the provided ID
217
- - Retrieves the full visible comment history and follows Azure DevOps pagination internally
218
- - Prints comments newest first with comment ID, author, timestamp, and body text
219
- - Prints `Work item #<id> has no comments.` when the work item has no visible comments
220
-
221
- `azdo comments add`
222
-
223
- - Requires a non-empty `<text>` positional argument
224
- - Preserves the supplied comment text as the submitted body
225
- - Prints `Added comment #<commentId> to work item #<id>` on success
226
- - Fails locally before any API call when the text is empty or whitespace-only
227
-
228
- ## azdo upsert
229
-
230
- `azdo upsert` accepts a single markdown work-item document and either creates a new Azure DevOps work item or updates an existing one. Omit `[id]` to create; pass `[id]` to update that work item in place. Create mode defaults to `Task`, and `--type <work item type>` lets you create `Bug`, `User Story`, `Feature`, `Epic`, and other Azure DevOps work item types.
231
-
232
- ```bash
233
- # Create a Bug from inline content
234
- azdo upsert --type Bug --content $'---\nTitle: Improve markdown import UX\nAssigned To: user@example.com\nState: New\n---'
235
-
236
- # Preserve the default Task create behavior
237
- azdo upsert --content $'---\nTitle: Follow-up task\nAssigned To: user@example.com\nState: New\n---'
238
-
239
- # Update from a file
240
- azdo upsert 12345 --file ./task-import.md
241
-
242
- # JSON output
243
- azdo upsert 12345 --content $'---\nSystem.Title: Improve markdown import UX\n---' --json
244
- ```
245
-
246
- The command requires exactly one source flag:
247
-
248
- - `azdo upsert [id] --content <markdown>`
249
- - `azdo upsert [id] --file <path>`
250
- - `azdo upsert --type <work-item-type> --content <markdown>`
251
-
252
- If `--file` succeeds, the source file is deleted after the Azure DevOps write completes. If parsing, validation, or the API call fails, the file is preserved. If deletion fails after a successful write, the command still succeeds and prints a warning.
253
-
254
- Type rules:
255
-
256
- - `--type` is optional for create and defaults to `Task`.
257
- - `--type` is only valid when creating a new work item.
258
- - Human-readable and JSON success output include the resulting work item type.
259
-
260
- ### Task Document Format
261
-
262
- The document starts with YAML front matter for scalar fields, followed by optional `##` heading sections for markdown rich-text fields.
263
-
264
- ```md
265
- ---
266
- Title: Improve markdown import UX
267
- Assigned To: user@example.com
268
- State: New
269
- Tags: cli; markdown
270
- Priority: null
271
- ---
272
-
273
- ## Description
274
-
275
- Implement a single-command task import flow.
276
-
277
- ## Acceptance Criteria
278
-
279
- - Supports create when no ID is passed
280
- - Supports update when an ID is passed
281
- - Deletes imported files only after success
282
- ```
283
-
284
- Supported friendly field names:
285
-
286
- - `Title`
287
- - `Assigned To` / `assignedTo`
288
- - `State`
289
- - `Description`
290
- - `Acceptance Criteria` / `acceptanceCriteria`
291
- - `Tags`
292
- - `Priority`
293
-
294
- Raw Azure DevOps reference names are also accepted anywhere a field name is expected, for example `System.Title` or `Microsoft.VSTS.Common.AcceptanceCriteria`.
295
-
296
- Clear semantics:
297
-
298
- - Scalar YAML fields with `null` or an empty value are treated as clears on update.
299
- - Rich-text heading sections with an empty body are treated as clears on update.
300
- - Omitted fields are untouched on update.
301
-
302
- `--json` output shape:
303
-
304
- ```json
305
- {
306
- "action": "created",
307
- "id": 12345,
308
- "workItemType": "User Story",
309
- "fields": {
310
- "System.Title": "Improve markdown import UX",
311
- "System.Description": "Implement a single-command task import flow."
312
- }
313
- }
314
- ```
315
-
316
- ### Configuration
317
-
318
- ```bash
319
- # List settings
320
- azdo config list
321
-
322
- # Interactive setup
323
- azdo config wizard
324
-
325
- # Enable markdown display for all get-item calls
326
- azdo config set markdown true
327
-
328
- # Set/get/unset values
329
- azdo config set fields "System.Tags,Custom.Priority"
330
- azdo config get fields
331
- azdo config unset fields
332
-
333
- # JSON output
334
- azdo config list --json
335
- ```
336
-
337
- ### Credential Management
338
-
339
- ```bash
340
- # Remove stored PAT from keyring
341
- azdo clear-pat
342
- ```
343
-
344
- ## JSON Output
345
-
346
- These commands support `--json` for machine-readable output:
347
- - `list-fields`
348
- - `set-state`
349
- - `assign`
350
- - `set-field`
351
- - `set-md-field`
352
- - `upsert`
353
- - `comments list|add`
354
- - `pr status|open|comments`
355
- - `config set|get|list|unset`
356
-
357
- ## Development
358
-
359
- ### Prerequisites
360
-
361
- - Node.js LTS (20+)
362
- - npm
363
-
364
- ### Setup
365
-
366
- ```bash
367
- git clone https://github.com/alkampfergit/azdo-cli.git
368
- cd azdo-cli
369
- npm install
47
+ # PR comment threads — list, filter, target by number, resolve or reopen
48
+ azdo pr comments # active-branch PR
49
+ azdo pr comments --pr-number 64 # any PR by number (skips branch lookup)
50
+ azdo pr comments --pr-number 64 --hide-resolved
51
+ azdo pr comment-resolve 17 --pr-number 64 # idempotent: exit 0 even when already resolved
52
+ azdo pr comment-reopen 17 --pr-number 64
370
53
  ```
371
54
 
372
- ### Scripts
55
+ ## Documentation
373
56
 
374
- | Command | Description |
375
- | --- | --- |
376
- | `npm run build` | Build the CLI with tsup |
377
- | `npm test` | Build and run tests with vitest |
378
- | `npm run lint` | Lint source files with ESLint |
379
- | `npm run typecheck` | Type-check with tsc (no emit) |
380
- | `npm run format` | Check formatting with Prettier |
57
+ | Topic | File |
58
+ |-------|------|
59
+ | Authentication & PAT storage | [docs/authentication.md](docs/authentication.md) |
60
+ | Linux credential store setup | [docs/linux-credential-store.md](docs/linux-credential-store.md) |
61
+ | Full command reference | [docs/commands.md](docs/commands.md) |
62
+ | Development setup | [docs/development.md](docs/development.md) |
381
63
 
382
64
  ## License
383
65