Lightweight CLI for Azure DevOps REST workflows (repos, branches, work items, PRs, builds).
This project provides a tiny scriptable command layer over the Azure DevOps API so automation agents and developers can run common actions quickly.
- Node.js 18+ (runtime for the published npm package)
- An Azure DevOps Personal Access Token (PAT)
For development you also need Bun (used for builds, tests, and scripts).
Set environment variables before running commands:
DEVOPS_PAT(required)ADO_COLLECTION_URL(default:https://dev.azure.com/<your-org>)ADO_PROJECT(default:<your-project>)ADO_REPO(default:<your-repository>)ADO_INSECURE=1(optional; only for self-signed TLS environments)
Example:
export DEVOPS_PAT="***"
export ADO_COLLECTION_URL="https://dev.azure.com/acme"
export ADO_PROJECT="MyProject"
export ADO_REPO="MyRepo"On-prem / localserver example:
export DEVOPS_PAT="***"
export ADO_COLLECTION_URL="https://localserver/DefaultCollection"
export ADO_PROJECT="ExampleProject"
export ADO_REPO="Example Repository"
export ADO_INSECURE=1Global install (CLI available as ado):
npm i -g @thanaen/ado-cliado help
ado smoke-v,--versioninit [--local]configsmokereposbranches [repo]workitem-get <id> [--raw] [--expand=all|fields|links|relations]workitems-recent [top] [--tag=<tag>] [--type=<work-item-type>] [--state=<state>]workitem-comments <id> [top] [--top=<n>] [--order=asc|desc]workitem-comment-add <id> --text="..." [--file=path]workitem-comment-update <id> <commentId> --text="..." [--file=path]prs [status] [top] [repo]pr-get <id> [repo]pr-create --title=... --source=... --target=... [--description=...] [--repo=...] [--work-items=123,456] [--tags=tag-a,tag-b]pr-update <id> [--title=...] [--description=...] [--repo=...] [--work-items=123,456] [--tags=tag-a,tag-b]pr-cherry-pick <id> --target=... [--topic=branch-name] [--repo=...]pr-approve <id> [repo]pr-autocomplete <id> [repo]builds [top]
Examples:
# 20 derniers bugs taggés "bot"
ado workitems-recent 20 --type=Bug --tag=bot
# Bugs "bot" encore en état New
ado workitems-recent --type=Bug --tag=bot --state=New
# Mettre à jour un commentaire existant (dédup)
ado workitem-comment-update 20485 12527 --file=./comment.mdThe repository includes a workflow at .github/workflows/npm-publish.yml.
It can publish in two ways:
- automatically when a GitHub Release is published
- manually with Run workflow (
workflow_dispatch)
NPM_TOKEN: npm automation token allowed to publish@thanaen/ado-cli
- bump
package.jsonversion before creating the release/tag
Before publishing, the workflow runs:
bun run fmt:checkbun run lintbun run typecheckbun testnpm pack --dry-run
Then it publishes with:
npm publish --access public --provenanceA reusable agent skill is included at:
skills/ado-workflows/SKILL.md
This helps AI coding agents run consistent Azure DevOps workflows using this CLI.
bun install # installs deps + sets up git hooks via lefthook| Script | Description |
|---|---|
bun run lint |
Lint with oxlint (type-aware + type-check) |
bun run lint:fix |
Lint and auto-fix safe issues |
bun run fmt |
Format all files with oxfmt |
bun run fmt:check |
Check formatting without writing |
bun test |
Run tests |
bun run typecheck |
Run tsc type-check (manual, not in hooks) |
bun run build |
Compile to standalone binary |
bun run build:dist |
Build Node CLI used for npm publication |
bun run prepack |
Rebuild dist before npm pack/publish |
Pre-commit — runs on staged files, auto-fixes and re-stages:
oxfmt(format)oxlint --type-aware --type-check --fix(lint + fix)
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.
- Never commit your PAT.
- Prefer setting secrets through runtime environment injection.
ADO_INSECURE=1should only be used in trusted internal environments.
400 Bad Request - Invalid URLat startup usually means one ofADO_COLLECTION_URL,ADO_PROJECT, orADO_REPOis still using placeholder defaults.- If strict TLS fails on internal servers, use
ADO_INSECURE=1only when appropriate for trusted self-signed endpoints.