@thanaen/ado-cli 0.1.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.
- package/README.md +174 -0
- package/dist/cli.js +57827 -0
- package/package.json +47 -0
- package/skills/ado-workflows/SKILL.md +43 -0
package/README.md
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
# @thanaen/ado-cli
|
|
2
|
+
|
|
3
|
+
Lightweight CLI for Azure DevOps REST workflows (repos, branches, work items, PRs, builds).
|
|
4
|
+
|
|
5
|
+
## Why this exists
|
|
6
|
+
|
|
7
|
+
This project provides a tiny scriptable command layer over the Azure DevOps API so automation agents and developers can run common actions quickly.
|
|
8
|
+
|
|
9
|
+
## Requirements
|
|
10
|
+
|
|
11
|
+
- Node.js 18+ (runtime for the published npm package)
|
|
12
|
+
- An Azure DevOps Personal Access Token (PAT)
|
|
13
|
+
|
|
14
|
+
For development you also need [Bun](https://bun.sh/) (used for builds, tests, and scripts).
|
|
15
|
+
|
|
16
|
+
## Configuration
|
|
17
|
+
|
|
18
|
+
Set environment variables before running commands:
|
|
19
|
+
|
|
20
|
+
- `DEVOPS_PAT` **(required)**
|
|
21
|
+
- `ADO_COLLECTION_URL` (default: `https://dev.azure.com/<your-org>`)
|
|
22
|
+
- `ADO_PROJECT` (default: `<your-project>`)
|
|
23
|
+
- `ADO_REPO` (default: `<your-repository>`)
|
|
24
|
+
- `ADO_INSECURE=1` (optional; only for self-signed TLS environments)
|
|
25
|
+
|
|
26
|
+
Example:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
export DEVOPS_PAT="***"
|
|
30
|
+
export ADO_COLLECTION_URL="https://dev.azure.com/acme"
|
|
31
|
+
export ADO_PROJECT="MyProject"
|
|
32
|
+
export ADO_REPO="MyRepo"
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
On-prem / localserver example:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
export DEVOPS_PAT="***"
|
|
39
|
+
export ADO_COLLECTION_URL="https://localserver/DefaultCollection"
|
|
40
|
+
export ADO_PROJECT="UserLock"
|
|
41
|
+
export ADO_REPO="Ulysse Interface"
|
|
42
|
+
export ADO_INSECURE=1
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Install
|
|
46
|
+
|
|
47
|
+
Global install (CLI available as `ado`):
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
npm i -g @thanaen/ado-cli
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Usage
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
ado help
|
|
57
|
+
ado smoke
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Commands
|
|
61
|
+
|
|
62
|
+
- `smoke`
|
|
63
|
+
- `repos`
|
|
64
|
+
- `branches [repo]`
|
|
65
|
+
- `workitem-get <id> [--raw] [--expand=all|fields|links|relations]`
|
|
66
|
+
- `workitems-recent [top] [--tag=<tag>] [--type=<work-item-type>] [--state=<state>]`
|
|
67
|
+
- `workitem-comments <id> [top] [--top=<n>] [--order=asc|desc]`
|
|
68
|
+
- `workitem-comment-add <id> --text="..." [--file=path]`
|
|
69
|
+
- `workitem-comment-update <id> <commentId> --text="..." [--file=path]`
|
|
70
|
+
- `prs [status] [top] [repo]`
|
|
71
|
+
- `pr-get <id> [repo]`
|
|
72
|
+
- `pr-create --title=... --source=... --target=... [--description=...] [--repo=...] [--work-items=123,456]`
|
|
73
|
+
- `pr-update <id> [--title=...] [--description=...] [--repo=...] [--work-items=123,456]`
|
|
74
|
+
- `pr-approve <id> [repo]`
|
|
75
|
+
- `pr-autocomplete <id> [repo]`
|
|
76
|
+
- `builds [top]`
|
|
77
|
+
|
|
78
|
+
Examples:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
# 20 derniers bugs taggés "bot"
|
|
82
|
+
ado workitems-recent 20 --type=Bug --tag=bot
|
|
83
|
+
|
|
84
|
+
# Bugs "bot" encore en état New
|
|
85
|
+
ado workitems-recent --type=Bug --tag=bot --state=New
|
|
86
|
+
|
|
87
|
+
# Mettre à jour un commentaire existant (dédup)
|
|
88
|
+
ado workitem-comment-update 20485 12527 --file=./comment.md
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## npm publication (GitHub Actions)
|
|
92
|
+
|
|
93
|
+
The repository includes a workflow at `.github/workflows/npm-publish.yml`.
|
|
94
|
+
|
|
95
|
+
It can publish in two ways:
|
|
96
|
+
|
|
97
|
+
- automatically when a GitHub Release is published
|
|
98
|
+
- manually with **Run workflow** (`workflow_dispatch`)
|
|
99
|
+
|
|
100
|
+
### Required repository secret
|
|
101
|
+
|
|
102
|
+
- `NPM_TOKEN`: npm automation token allowed to publish `@thanaen/ado-cli`
|
|
103
|
+
|
|
104
|
+
### Release prep
|
|
105
|
+
|
|
106
|
+
- bump `package.json` version before creating the release/tag
|
|
107
|
+
|
|
108
|
+
### Workflow behavior
|
|
109
|
+
|
|
110
|
+
Before publishing, the workflow runs:
|
|
111
|
+
|
|
112
|
+
- `bun run fmt:check`
|
|
113
|
+
- `bun run lint`
|
|
114
|
+
- `bun run typecheck`
|
|
115
|
+
- `bun test`
|
|
116
|
+
- `npm pack --dry-run`
|
|
117
|
+
|
|
118
|
+
Then it publishes with:
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
npm publish --access public --provenance
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## Agent skill included
|
|
125
|
+
|
|
126
|
+
A reusable agent skill is included at:
|
|
127
|
+
|
|
128
|
+
- `skills/ado-workflows/SKILL.md`
|
|
129
|
+
|
|
130
|
+
This helps AI coding agents run consistent Azure DevOps workflows using this CLI.
|
|
131
|
+
|
|
132
|
+
## Development
|
|
133
|
+
|
|
134
|
+
### Setup
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
bun install # installs deps + sets up git hooks via lefthook
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Scripts
|
|
141
|
+
|
|
142
|
+
| Script | Description |
|
|
143
|
+
| -------------------- | ------------------------------------------ |
|
|
144
|
+
| `bun run lint` | Lint with oxlint (type-aware + type-check) |
|
|
145
|
+
| `bun run lint:fix` | Lint and auto-fix safe issues |
|
|
146
|
+
| `bun run fmt` | Format all files with oxfmt |
|
|
147
|
+
| `bun run fmt:check` | Check formatting without writing |
|
|
148
|
+
| `bun test` | Run tests |
|
|
149
|
+
| `bun run typecheck` | Run tsc type-check (manual, not in hooks) |
|
|
150
|
+
| `bun run build` | Compile to standalone binary |
|
|
151
|
+
| `bun run build:dist` | Build Node CLI used for npm publication |
|
|
152
|
+
| `bun run prepack` | Rebuild dist before `npm pack/publish` |
|
|
153
|
+
|
|
154
|
+
### Quality gates (git hooks via Lefthook)
|
|
155
|
+
|
|
156
|
+
**Pre-commit** — runs on staged files, auto-fixes and re-stages:
|
|
157
|
+
|
|
158
|
+
- `oxfmt` (format)
|
|
159
|
+
- `oxlint --type-aware --type-check --fix` (lint + fix)
|
|
160
|
+
|
|
161
|
+
### Editor
|
|
162
|
+
|
|
163
|
+
Install the recommended VS Code extension (`oxc.oxc-vscode`) when prompted. Format-on-save and lint fix-on-save are pre-configured in `.vscode/settings.json`.
|
|
164
|
+
|
|
165
|
+
## Security notes
|
|
166
|
+
|
|
167
|
+
- Never commit your PAT.
|
|
168
|
+
- Prefer setting secrets through runtime environment injection.
|
|
169
|
+
- `ADO_INSECURE=1` should only be used in trusted internal environments.
|
|
170
|
+
|
|
171
|
+
## Troubleshooting
|
|
172
|
+
|
|
173
|
+
- `400 Bad Request - Invalid URL` at startup usually means one of `ADO_COLLECTION_URL`, `ADO_PROJECT`, or `ADO_REPO` is still using placeholder defaults.
|
|
174
|
+
- If strict TLS fails on internal servers, use `ADO_INSECURE=1` only when appropriate for trusted self-signed endpoints.
|