CLI for working with TFS/Azure DevOps Server work items (create, update, delete, search, WIQL, and more).
- Run WIQL and list matching work items.
- Create, update, and delete work items (including comments).
- Search by title/description.
- Show details and child items.
- List work item types and resolve your identity.
- Create Git pull requests in TFS/Azure DevOps Server.
- JSON output by default, with optional text tables.
- Go 1.21+ (for building from source).
- A TFS/Azure DevOps Server instance and a PAT token.
Build a local binary:
go build -o tfs .Run it from the repo root:
./tfs --helpConfigure the CLI, then create a backlog item and a child task. The examples below use common English work item names:
- Product Backlog Item
- Task
./tfs config set --base-url "https://dev.azure.com/your-org" --project "YourProject" --pat "YOUR_PAT"
./tfs create --type "Product Backlog Item" --title "Export data to CSV" \
--set "System.Description=Allow users to export filtered data to CSV"
./tfs create --type "Task" --title "Build export endpoint" --parent 123 \
--set $'System.Description=Implement the API endpoint\n\nResult: CSV returned in response' \
--set "Microsoft.VSTS.Common.Activity=Development" \
--set "Microsoft.VSTS.Scheduling.RemainingWork=4" \
--set "Microsoft.VSTS.Scheduling.OriginalEstimate=4"You can configure the CLI via a config file, environment variables, or flags.
Save config values:
./tfs config set --base-url "https://dev.azure.com/your-org" --project "YourProject" --pat "YOUR_PAT"View config (PAT redacted):
./tfs config viewThe config file is stored in the OS user config directory (for example, ~/.config/tfs/config.json on Linux, %AppData%\\tfs\\config.json on Windows).
TFS_BASE_URLTFS_PROJECTTFS_PAT
Flags override environment variables, which override the config file.
Set --base-url (or TFS_BASE_URL) to the organization/collection root:
- Azure DevOps Services:
https://dev.azure.com/{org} - TFS on-prem:
http://server:8080/tfs/{collection}
If the URL ends with the project name, the CLI will normalize it automatically.
Run ./tfs --help for the full command list. Main commands:
wiql- run a WIQL query and list itemsview- show a work item by IDupdate- update fields or add a commentcreate- create a work itemdelete- delete a work item; add--destroyto attempt permanent removal when the PAT has destroy permissionsearch- search by title/descriptionmy- list your assigned itemsshow- show details plus child itemspr create- create a Git pull requesttypes- list work item typeswhoami- show the resolved identity from the PATconfig- view/set stored config
The examples below assume these English type names and field references:
- Work item types:
Product Backlog Item,Task - Activity field:
Microsoft.VSTS.Common.Activity(value:Development) - Remaining work:
Microsoft.VSTS.Scheduling.RemainingWork - Original estimate:
Microsoft.VSTS.Scheduling.OriginalEstimate
List work item types (text output):
./tfs types --json=falseCreate a work item:
./tfs create --type "Product Backlog Item" --title "Add bulk export" \
--set "System.Description=Export data to CSV"Create a child task:
./tfs create --type "Task" --title "Implement export endpoint" --parent 123 \
--set $'System.Description=Implement the API endpoint\n\nResult: CSV returned in response' \
--set "Microsoft.VSTS.Common.Activity=Development" \
--set "Microsoft.VSTS.Scheduling.RemainingWork=4" \
--set "Microsoft.VSTS.Scheduling.OriginalEstimate=4"Update fields and add a comment:
./tfs update 123 --set "System.Title=Export supports filters" --add-comment "Updated scope"Delete a work item:
./tfs delete 123 --yesPermanently delete a work item when the PAT has destroy permission:
./tfs delete 123 --destroy --yesCreate a pull request:
./tfs pr create --repository "crypto-adapter" \
--source "feat/remove-regtest-miners" \
--target "develop" \
--title "Удалить BTC/LTC regtest miners" \
--description "Вырезаны scheduled regtest miners и прямой auto-mining из тестового BTC адаптера" \
--work-item 12345 \
--work-item 12346 \
--auto-completeIf you pass --work-item, the CLI links those work items to the PR. --auto-complete is optional and disabled by default.
Show details and children:
./tfs show 123Search:
./tfs search --query "export csv" --top 20Run a WIQL query:
./tfs wiql "SELECT [System.Id] FROM WorkItems WHERE [System.State] = 'New'" --top 50- Most commands output JSON by default.
- Use
--json=falseto get text tables where supported. myandshowdefault to text unless--jsonis explicitly provided.
Run tests:
go test ./...Integration tests require a live instance and environment variables:
TFS_BASE_URL=... \
TFS_PROJECT=... \
TFS_PAT=... \
TFS_WIT_TYPE=... \
go test -tags=integration ./internal/integrationOptional integration variables:
TFS_TASK_TYPE(default in code:Задача)TFS_TASK_ACTIVITY_NAME(default in code:Активность)TFS_TASK_ACTIVITY_VALUE(default in code:Разработка)TFS_TASK_REMAINING_WORK_NAME(default in code:Оставшаяся работа)TFS_ASSIGNED_TOTFS_INSECURE(set to non-empty to skip TLS verification)
- The CLI uses Azure DevOps REST API version 6.0.
- For API background and examples (in Russian), see
tfs_api.md.