SuperAPI AI Directory

boards-my-work

Coding & development

View repository

Updated 10-15 21:11

About this skill

My work items

Project selection

  • If the user has provided a project name (for example "Contoso project"), use it directly and do not call the project list API.

  • If not provided, ask the user to provide it once.

  • If still not provided, list the projects for the user to choose from:

    curl -sS -u ":$AZURE_DEVOPS_PAT" \
      "https://dev.azure.com/$AZURE_DEVOPS_ORG/_apis/projects?%24top=500&api-version=7.1"
    

    Display value[].name. The response header (curl -D - is visible) has x-ms-continuationtoken when there are more projects; add &continuationToken={token} to fetch the next page.

  • Do not continue until the user provides or selects a project.

Connection and authentication

Always use curl to call the Azure DevOps REST API directly; each command carries its own authentication parameters.

  • Organization: Read the environment variable AZURE_DEVOPS_ORG(organization name, for example contoso). If not set, ask the user once; if the user gives a URL, extract the organization name from https://dev.azure.com/{org} or https://{org}.visualstudio.com .
  • Token: Send the PAT with Basic authentication:-u ":$AZURE_DEVOPS_PAT"; if only AZURE_DEVOPS_EXT_PATis set (the variable used by the Azure CLI azure-devops extension), use that instead. When switching to a Microsoft Entra ID token, use -H "Authorization: Bearer $AZURE_DEVOPS_TOKEN"instead. If neither is set, ask the user to set AZURE_DEVOPS_PAT in their own terminal and retry, then stop. Read the token only from environment variables: do not ask the user to paste the token into the conversation, and do not print it or write it to a file.
  • PAT permission scopes:Work Items (Read)、Project and Team (Read)。
  • Encoding: URL-encode project names in paths (write spaces as %20); in query strings, write $ as %24(for example %24top) to avoid shell expansion.
  • Errors: HTTP 401, 403, 203, or an HTML login page in the response means the token is invalid, expired, or lacks permissions; report it and stop. HTTP 404 means the organization or project name is incorrect.
  • Windows PowerShell: Call curl.exe(not the curl alias), and write the environment variable as $env:AZURE_DEVOPS_PAT; PowerShell does not support <<'EOF', so write the JSON body to a temporary file first, then send it with --data-binary "@body.json" .

Steps

  1. Determine the project according to the rules above.

  2. Use WIQL to find work items assigned to the current user that are not yet completed.@Me resolves to the user the token belongs to, and@project resolves to the project in the URL:

    curl -sS -u ":$AZURE_DEVOPS_PAT" -X POST -H "Content-Type: application/json" \
      "https://dev.azure.com/$AZURE_DEVOPS_ORG/{project}/_apis/wit/wiql?%24top=200&api-version=7.1" \
      --data-binary @- <<'EOF'
    {"query": "SELECT [System.Id] FROM WorkItems WHERE [System.TeamProject] = @project AND [System.AssignedTo] = @Me AND [System.State] NOT IN ('Closed', 'Done', 'Removed') ORDER BY [System.ChangedDate] DESC"}
    EOF
    

    The excluded states cover the completed and removed states of the Agile, Scrum, CMMI, and Basic built-in processes. When the user asks to include completed items, remove the [System.State] condition; if the project uses a custom process with other completed states, add them to NOT IN。

  3. Fetch the response workItems[].id. If there are no items, explain that there are no in-progress work items assigned to the user in this project, then stop.

  4. Fetch details with batch calls (up to 200 IDs each time; split into batches if more). If the user has not specified fields, use the default fields below:

    curl -sS -u ":$AZURE_DEVOPS_PAT" -X POST -H "Content-Type: application/json" \
      "https://dev.azure.com/$AZURE_DEVOPS_ORG/{project}/_apis/wit/workitemsbatch?api-version=7.1" \
      -d '{"ids":[101,102],"fields":["System.Id","System.Title","System.State","System.AssignedTo","System.WorkItemType","System.CreatedDate","System.ChangedDate","System.Tags","Microsoft.VSTS.Common.Priority"],"errorPolicy":"Omit"}'
    
  5. Group by work item type (System.WorkItemType), and within each group sort by System.ChangedDate from newest to oldest.

  6. Present in the format below.

Presentation result

One heading and one table per type, with columns:

  • ID: a clickable hyperlink, in the format [{ID}](https://dev.azure.com/{organization}/{project}/_workitems/edit/{ID})({project} requires URL encoding)
  • Title
  • Status
  • Priority

Groups follow this order; groups with no items are skipped:

  1. Epic
  2. Feature
  3. Requirements category (User Story, Product Backlog Item, Requirement, Issue)
  4. Bug
  5. Task
  6. Test Case
  7. Other work item types