azdo-cli 0.2.0-develop.133 → 0.2.0-develop.134
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 +4 -18
- package/dist/index.js +4 -12
- package/package.json +2 -3
package/README.md
CHANGED
|
@@ -26,20 +26,6 @@ Azure DevOps CLI focused on work item read/write workflows.
|
|
|
26
26
|
npm install -g azdo-cli
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
-
## Utility Scripts
|
|
30
|
-
|
|
31
|
-
The repository also includes a helper script for syncing local `.env` entries into GitHub Actions secrets for the current repository:
|
|
32
|
-
|
|
33
|
-
```bash
|
|
34
|
-
./scripts/sync-env-to-gh-secrets.zsh
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
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:
|
|
38
|
-
|
|
39
|
-
```bash
|
|
40
|
-
./scripts/sync-env-to-gh-secrets.zsh FOO BAR
|
|
41
|
-
```
|
|
42
|
-
|
|
43
29
|
## Authentication and Context Resolution
|
|
44
30
|
|
|
45
31
|
PAT resolution order:
|
|
@@ -102,6 +88,8 @@ azdo get-item 12345 --fields "System.Tags,Microsoft.VSTS.Common.Priority"
|
|
|
102
88
|
# Convert rich text fields to markdown
|
|
103
89
|
azdo get-item 12345 --markdown
|
|
104
90
|
|
|
91
|
+
# Disable markdown even if config is on
|
|
92
|
+
azdo get-item 12345 --no-markdown
|
|
105
93
|
```
|
|
106
94
|
|
|
107
95
|
```bash
|
|
@@ -130,7 +118,7 @@ azdo list-fields 12345 --json
|
|
|
130
118
|
|
|
131
119
|
The `get-item` command can convert HTML rich-text fields to readable markdown. Resolution order:
|
|
132
120
|
|
|
133
|
-
1. `--markdown`
|
|
121
|
+
1. `--markdown` / `--no-markdown` flag (highest priority)
|
|
134
122
|
2. Config setting: `azdo config set markdown true`
|
|
135
123
|
3. Default: off (HTML stripped to plain text)
|
|
136
124
|
|
|
@@ -167,7 +155,7 @@ azdo pr comments
|
|
|
167
155
|
|
|
168
156
|
`azdo pr status`
|
|
169
157
|
|
|
170
|
-
- Lists pull requests for the current branch
|
|
158
|
+
- Lists all pull requests for the current branch, including active, completed, and abandoned PRs
|
|
171
159
|
- Prints `No pull requests found for branch <branch>.` when no PRs exist
|
|
172
160
|
- Supports `--json` for machine-readable output
|
|
173
161
|
|
|
@@ -300,8 +288,6 @@ These commands support `--json` for machine-readable output:
|
|
|
300
288
|
- `assign`
|
|
301
289
|
- `set-field`
|
|
302
290
|
- `set-md-field`
|
|
303
|
-
- `upsert`
|
|
304
|
-
- `pr status|open|comments`
|
|
305
291
|
- `config set|get|list|unset`
|
|
306
292
|
|
|
307
293
|
## Development
|
package/dist/index.js
CHANGED
|
@@ -39,15 +39,7 @@ async function fetchWithErrors(url, init) {
|
|
|
39
39
|
}
|
|
40
40
|
if (response.status === 401) throw new Error("AUTH_FAILED");
|
|
41
41
|
if (response.status === 403) throw new Error("PERMISSION_DENIED");
|
|
42
|
-
if (response.status === 404)
|
|
43
|
-
let detail = "";
|
|
44
|
-
try {
|
|
45
|
-
const body = await response.text();
|
|
46
|
-
detail = ` | url=${url} | body=${body}`;
|
|
47
|
-
} catch {
|
|
48
|
-
}
|
|
49
|
-
throw new Error(`NOT_FOUND${detail}`);
|
|
50
|
-
}
|
|
42
|
+
if (response.status === 404) throw new Error("NOT_FOUND");
|
|
51
43
|
return response;
|
|
52
44
|
}
|
|
53
45
|
async function readResponseMessage(response) {
|
|
@@ -641,7 +633,7 @@ function handleCommandError(err, id, context, scope = "write", exit = true) {
|
|
|
641
633
|
`Error: Access denied. Your PAT may lack ${scope} permissions for project "${context?.project}".
|
|
642
634
|
`
|
|
643
635
|
);
|
|
644
|
-
} else if (msg
|
|
636
|
+
} else if (msg === "NOT_FOUND") {
|
|
645
637
|
process.stderr.write(
|
|
646
638
|
`Error: Work item ${id} not found in ${context?.org}/${context?.project}.
|
|
647
639
|
`
|
|
@@ -1426,7 +1418,7 @@ function buildUpsertResult(action, writeResult, fields) {
|
|
|
1426
1418
|
};
|
|
1427
1419
|
}
|
|
1428
1420
|
function isUpdateWriteError(err) {
|
|
1429
|
-
return err.message === "AUTH_FAILED" || err.message === "PERMISSION_DENIED" || err.message
|
|
1421
|
+
return err.message === "AUTH_FAILED" || err.message === "PERMISSION_DENIED" || err.message === "NOT_FOUND" || err.message === "NETWORK_ERROR" || err.message.startsWith("BAD_REQUEST:") || err.message.startsWith("UPDATE_REJECTED:");
|
|
1430
1422
|
}
|
|
1431
1423
|
function isCreateWriteError(err) {
|
|
1432
1424
|
return err.message === "AUTH_FAILED" || err.message === "PERMISSION_DENIED" || err.message === "NETWORK_ERROR" || err.message.startsWith("BAD_REQUEST:") || err.message.startsWith("HTTP_");
|
|
@@ -1692,7 +1684,7 @@ function handlePrCommandError(err, context, mode = "read") {
|
|
|
1692
1684
|
if (error.message === "NETWORK_ERROR") {
|
|
1693
1685
|
writeError("Could not connect to Azure DevOps. Check your network connection.");
|
|
1694
1686
|
}
|
|
1695
|
-
if (error.message
|
|
1687
|
+
if (error.message === "NOT_FOUND") {
|
|
1696
1688
|
writeError(`Azure DevOps repository not found in ${context?.org}/${context?.project}.`);
|
|
1697
1689
|
}
|
|
1698
1690
|
if (error.message.startsWith("HTTP_")) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "azdo-cli",
|
|
3
|
-
"version": "0.2.0-develop.
|
|
3
|
+
"version": "0.2.0-develop.134",
|
|
4
4
|
"description": "Azure DevOps CLI tool",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -15,8 +15,7 @@
|
|
|
15
15
|
"typecheck": "tsc --noEmit",
|
|
16
16
|
"format": "prettier --check src/",
|
|
17
17
|
"test": "npm run build && vitest run tests/unit",
|
|
18
|
-
"test:integration": "npm run build && vitest run tests/integration"
|
|
19
|
-
"test:integration:full": "bash scripts/setup-keyring.sh && npm run test:integration"
|
|
18
|
+
"test:integration": "npm run build && vitest run tests/integration"
|
|
20
19
|
},
|
|
21
20
|
"repository": {
|
|
22
21
|
"type": "git",
|