SuperAPI AI Directory

boards-backlog-summary

Coding & development

View repository

Updated 10-15 21:11

About this skill

Team backlog summary

This Skill retrieves the team's requirements-level backlog (Requirements), filters forIn progressandassigned to the current useritems, adds parent item and child item information, and then presents them in priority order.

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 once.

  • If still not provided, list 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"
    
  • Do not continue until the user provides or selects a project.

Team selection

  • If the user has provided a team name, use it directly and do not call the team list API.

  • If not provided, ask the user once.

  • If still not provided, list the teams in the selected project for the user to choose from:

    curl -sS -u ":$AZURE_DEVOPS_PAT" \
      "https://dev.azure.com/$AZURE_DEVOPS_ORG/_apis/projects/{project}/teams?%24top=500&api-version=7.1"
    
  • Do not continue until the user provides or selects a team.

The response header of the project list (curl -D - is visible in) has x-ms-continuationtoken , add &continuationToken={token} to get the next page; the team list is paged by %24skip .

Connection and authentication

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

  • Organization: Read the environment variable AZURE_DEVOPS_ORG(organization name, for example, contoso). If it is 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 using a Microsoft Entra ID token instead, switch to -H "Authorization: Bearer $AZURE_DEVOPS_TOKEN". 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 scope:Work Items (Read)、Project and Team (Read)。
  • Encoding: Project and team names in the path must be URL-encoded (write spaces as %20); in the query string, $ is written as %24(for example, %24top) to avoid shell expansion.
  • Errors: HTTP 401, 403, 203, or a response that is an HTML login page means the token is invalid, expired, or lacks sufficient permissions; report it and stop. HTTP 404 means the organization, project, or team 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 first write the JSON body to a temporary file, then send it with --data-binary "@body.json" .

Steps

  1. Determine the project and team according to the rules above.

  2. Get the work item IDs of the team's requirements-level backlog:

    curl -sS -u ":$AZURE_DEVOPS_PAT" \
      "https://dev.azure.com/$AZURE_DEVOPS_ORG/{project}/{team}/_apis/work/backlogs/Microsoft.RequirementCategory/workItems?api-version=7.1"
    

    ID in workItems[].target.id. When the list is empty, go directly to the empty result message in step 4.

  3. Filter server-side with WIQL: keep only items that are in progress and assigned to the current user (@Me) and whose type is Requirement or Bug. Fill the IDs from step 2 into IN (...)(when there are more than 1,000 IDs, query in batches):

    curl -sS -u ":$AZURE_DEVOPS_PAT" -X POST -H "Content-Type: application/json" \
      "https://dev.azure.com/$AZURE_DEVOPS_ORG/{project}/_apis/wit/wiql?api-version=7.1" \
      --data-binary @- <<'EOF'
    {"query": "SELECT [System.Id] FROM WorkItems WHERE [System.Id] IN (101, 102, 103) AND [System.AssignedTo] = @Me AND [System.State] IN ('Active', 'Committed', 'Doing') AND [System.WorkItemType] IN ('Product Backlog Item', 'User Story', 'Requirement', 'Issue', 'Bug')"}
    EOF
    

    "In progress" corresponds to the in-progress state of each built-in process: for Agile and CMMI it is Active, for Scrum it is Committed, and for Basic it is Doing. When the project uses a custom process, use that process's in-progress state name instead.

  4. When the response's workItems is empty, explain that this team has no in-progress backlog items assigned to the user, then stop.

  5. Retrieve the fields and relations of the filtered items with batched calls (at most 200 IDs each time):

    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],"$expand":"Relations","errorPolicy":"Omit"}'
    

    $expand cannot be specified together with fields , so this time all fields will be returned; only use System.Id、System.Title、System.State、System.AssignedTo、System.WorkItemType、System.ChangedDate、System.IterationPath、Microsoft.VSTS.Common.Priority、System.Parent。

  6. From each item's relations collectparent item ID(rel is System.LinkTypes.Hierarchy-Reverse) andchild item ID(System.LinkTypes.Hierarchy-Forward), the ID is the last segment of url . After excluding the IDs already retrieved, use one batched call to retrieve their System.Id、System.Title、System.State:

    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":[201,202],"fields":["System.Id","System.Title","System.State"],"errorPolicy":"Omit"}'
    
  7. Present the results in the format below.

Present the results

Sort all items by Microsoft.VSTS.Common.Priority from smallest to largest (Priority 1 first). For each item display:


{ID} — {title}

Field Value
State {System.State}
Priority {Microsoft.VSTS.Common.Priority}
Changed Date {System.ChangedDate, format YYYY/MM/DD}
Iteration {last segment of System.IterationPath}
Work Item Type {System.WorkItemType}

Parent item:

  • Has a parent item:{ParentID} {parent item title}
  • No parent item:(None)

Child items:

When there are child items, display them in a table:

ID Title State
{ChildID} {child item title} {child item state}

When there are no child items, display:(None)


After listing all items, display a summary line:

Total {N} in-progress backlog items assigned to you, team {team name}, project {project name}。