Skip to content

Instantly share code, notes, and snippets.

@DanielCardonaRojas
Created October 20, 2025 20:50
Show Gist options
  • Save DanielCardonaRojas/d9fdb98566fee61125da6740d83dab8e to your computer and use it in GitHub Desktop.
Save DanielCardonaRojas/d9fdb98566fee61125da6740d83dab8e to your computer and use it in GitHub Desktop.
Gather information about a ticket to create a plan afterwards.
description argument-hint
Fetch Azure DevOps ticket and create project directory
TICKET_ID

You are setting up a new project directory based on an Azure DevOps work item.

Task

  1. Fetch the Azure DevOps work item using the command:

    az boards work-item show --id {TICKET_ID} --output json
    
  2. Parse and extract the following information from the ticket:

    • Title
    • Description
    • Acceptance criteria
    • Priority
    • State/Status
    • Assigned to
    • Comments (discussion history)
    • Pull request references
    • Related work items (links to other tickets)
    • Attachments (URLs to screenshots or other files)
    • Any custom fields that contain relevant information
  3. Determine the target directory path:

    • If PATH is provided, use it as the parent directory
    • If PATH is NOT provided, determine the default path by running:
      dirname $(git rev-parse --show-toplevel)
      
      Then append /TicketContext to create the full parent path
    • Create the TicketContext directory if it doesn't exist
  4. Create a new directory at the determined path with this naming format:

    {PATH}/{TICKET_ID}_{TICKET_TITLE_IN_SNAKE_CASE}
    

    Where:

    • TICKET_ID is the numeric work item ID
    • TICKET_TITLE_IN_SNAKE_CASE is the ticket title converted to snake_case (lowercase with underscores)
  5. Inside the new directory, create a README.md file that includes:

    • Ticket ID and title
    • Link to the Azure DevOps ticket
    • Description
    • Acceptance criteria
    • Priority and status
    • Any relevant comments or discussion points
    • Links to related tickets
    • Links to attachments/screenshots
    • References to any mentioned PRs
  6. Display a summary of:

    • The directory path that was created
    • Key ticket information
    • Next steps or important considerations from the ticket

Important Notes

  • Ensure the directory name is valid (replace invalid filesystem characters)
  • Truncate the title if it's too long (max 50 characters recommended)
  • If PATH is not provided and not in a git repository, inform the user and ask them to provide a PATH
  • If the determined path doesn't exist, create parent directories automatically (including TicketContext)
  • Handle errors gracefully if the Azure CLI is not authenticated or the ticket doesn't exist
@DanielCardonaRojas
Copy link
Author

Note that dirname $(git rev-parse --show-toplevel) is suited for working with a worktrees setup adjust for a traditional workflow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment