azdo-cli 0.2.0-develop.107 → 0.2.0-develop.133
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 +18 -4
- package/dist/index.js +12 -4
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -26,6 +26,20 @@ 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
|
+
|
|
29
43
|
## Authentication and Context Resolution
|
|
30
44
|
|
|
31
45
|
PAT resolution order:
|
|
@@ -88,8 +102,6 @@ azdo get-item 12345 --fields "System.Tags,Microsoft.VSTS.Common.Priority"
|
|
|
88
102
|
# Convert rich text fields to markdown
|
|
89
103
|
azdo get-item 12345 --markdown
|
|
90
104
|
|
|
91
|
-
# Disable markdown even if config is on
|
|
92
|
-
azdo get-item 12345 --no-markdown
|
|
93
105
|
```
|
|
94
106
|
|
|
95
107
|
```bash
|
|
@@ -118,7 +130,7 @@ azdo list-fields 12345 --json
|
|
|
118
130
|
|
|
119
131
|
The `get-item` command can convert HTML rich-text fields to readable markdown. Resolution order:
|
|
120
132
|
|
|
121
|
-
1. `--markdown`
|
|
133
|
+
1. `--markdown` flag enables markdown for the current call
|
|
122
134
|
2. Config setting: `azdo config set markdown true`
|
|
123
135
|
3. Default: off (HTML stripped to plain text)
|
|
124
136
|
|
|
@@ -155,7 +167,7 @@ azdo pr comments
|
|
|
155
167
|
|
|
156
168
|
`azdo pr status`
|
|
157
169
|
|
|
158
|
-
- Lists
|
|
170
|
+
- Lists pull requests for the current branch
|
|
159
171
|
- Prints `No pull requests found for branch <branch>.` when no PRs exist
|
|
160
172
|
- Supports `--json` for machine-readable output
|
|
161
173
|
|
|
@@ -288,6 +300,8 @@ These commands support `--json` for machine-readable output:
|
|
|
288
300
|
- `assign`
|
|
289
301
|
- `set-field`
|
|
290
302
|
- `set-md-field`
|
|
303
|
+
- `upsert`
|
|
304
|
+
- `pr status|open|comments`
|
|
291
305
|
- `config set|get|list|unset`
|
|
292
306
|
|
|
293
307
|
## Development
|
package/dist/index.js
CHANGED
|
@@ -39,7 +39,15 @@ 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)
|
|
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
|
+
}
|
|
43
51
|
return response;
|
|
44
52
|
}
|
|
45
53
|
async function readResponseMessage(response) {
|
|
@@ -633,7 +641,7 @@ function handleCommandError(err, id, context, scope = "write", exit = true) {
|
|
|
633
641
|
`Error: Access denied. Your PAT may lack ${scope} permissions for project "${context?.project}".
|
|
634
642
|
`
|
|
635
643
|
);
|
|
636
|
-
} else if (msg
|
|
644
|
+
} else if (msg.startsWith("NOT_FOUND")) {
|
|
637
645
|
process.stderr.write(
|
|
638
646
|
`Error: Work item ${id} not found in ${context?.org}/${context?.project}.
|
|
639
647
|
`
|
|
@@ -1418,7 +1426,7 @@ function buildUpsertResult(action, writeResult, fields) {
|
|
|
1418
1426
|
};
|
|
1419
1427
|
}
|
|
1420
1428
|
function isUpdateWriteError(err) {
|
|
1421
|
-
return err.message === "AUTH_FAILED" || err.message === "PERMISSION_DENIED" || err.message
|
|
1429
|
+
return err.message === "AUTH_FAILED" || err.message === "PERMISSION_DENIED" || err.message.startsWith("NOT_FOUND") || err.message === "NETWORK_ERROR" || err.message.startsWith("BAD_REQUEST:") || err.message.startsWith("UPDATE_REJECTED:");
|
|
1422
1430
|
}
|
|
1423
1431
|
function isCreateWriteError(err) {
|
|
1424
1432
|
return err.message === "AUTH_FAILED" || err.message === "PERMISSION_DENIED" || err.message === "NETWORK_ERROR" || err.message.startsWith("BAD_REQUEST:") || err.message.startsWith("HTTP_");
|
|
@@ -1684,7 +1692,7 @@ function handlePrCommandError(err, context, mode = "read") {
|
|
|
1684
1692
|
if (error.message === "NETWORK_ERROR") {
|
|
1685
1693
|
writeError("Could not connect to Azure DevOps. Check your network connection.");
|
|
1686
1694
|
}
|
|
1687
|
-
if (error.message
|
|
1695
|
+
if (error.message.startsWith("NOT_FOUND")) {
|
|
1688
1696
|
writeError(`Azure DevOps repository not found in ${context?.org}/${context?.project}.`);
|
|
1689
1697
|
}
|
|
1690
1698
|
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.133",
|
|
4
4
|
"description": "Azure DevOps CLI tool",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -15,7 +15,8 @@
|
|
|
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"
|
|
18
|
+
"test:integration": "npm run build && vitest run tests/integration",
|
|
19
|
+
"test:integration:full": "bash scripts/setup-keyring.sh && npm run test:integration"
|
|
19
20
|
},
|
|
20
21
|
"repository": {
|
|
21
22
|
"type": "git",
|