Skip to content

prime001/ADO_Ticket_Analyzer

Repository files navigation

ADO Ticket Analyzer

A Python CLI tool that connects to Azure DevOps, prioritizes your daily workload, reviews PRs with AI agents, and generates reports for team meetings.

What It Does

  • Daily Task List -- Fetches all work items from your ADO board, scores them by priority/state/assignment/staleness, and produces a ranked focus list
  • PR Review Report -- Pulls active PRs from configured repos, categorizes them (needs review, mine, stale), ready for weekly meetings
  • AI Agent PR Reviews -- Three AI specialist personas (Code Reviewer, Cisco NSO Expert, Debugging Specialist) review unapproved PRs and generate comment files
  • Epic Breakdown -- Shows work items grouped by parent Epic with state summaries
  • Backlog View -- Filterable backlog dump by state and assignee

Architecture

ADO_Ticket_Analyzer/
├── config.yaml                  # Your orgs, PATs, settings (gitignored)
├── config.example.yaml          # Template
├── requirements.txt
├── cron_agent_review.sh         # Cron wrapper for AI reviews
├── ado_analyzer/
│   ├── cli.py                   # Click CLI (daily, pr-review, agent-review, epics, backlog, config)
│   ├── config.py                # YAML + env var PAT resolution
│   ├── ado_client.py            # ADO REST API client (multi-org, configurable API version)
│   ├── work_items.py            # WIQL queries, work item normalization
│   ├── prioritizer.py           # Scoring engine (priority, state, assignment, staleness, tags, points)
│   ├── pull_requests.py         # PR fetch, normalize, categorize
│   ├── pr_reviewer.py           # AI agent review (3 personas via Claude API)
│   ├── epics.py                 # Epic + child resolution via parent links
│   └── reporter.py              # Terminal table + markdown formatters
├── output/
│   └── pr_reviews/              # AI review results (JSON + markdown)
└── tests/
    ├── test_prioritizer.py
    ├── test_work_items.py
    └── test_pull_requests.py

Setup

1. Clone and install

git clone https://github.com/prime001/ADO_Ticket_Analyzer.git
cd ADO_Ticket_Analyzer
python3 -m venv venv
./venv/bin/pip install -r requirements.txt

2. Configure

Copy the example config and edit:

cp config.example.yaml config.yaml

Edit config.yaml:

  • Set your organization URLs, project names, and team
  • Set your my_identity email (e.g., [email protected])
  • Adjust daily.top and pr_review.stale_days as needed

3. Set environment variables

Add to ~/.zshrc or ~/.bashrc:

# ADO Personal Access Tokens
export ADO_PAT_BOARDS="your-pat-for-boards-org"
export ADO_PAT_LEGACY="your-pat-for-legacy-server"

# Anthropic API key (for AI agent reviews)
export ANTHROPIC_API_KEY="sk-ant-..."

PAT scopes required:

  • Boards org: Work Items (Read)
  • Repos org: Code (Read), Pull Requests (Read/Write for posting comments)

4. Test connection

./venv/bin/python -m ado_analyzer config --test

Usage

Daily prioritized task list

./venv/bin/python -m ado_analyzer daily
./venv/bin/python -m ado_analyzer daily --top 10
./venv/bin/python -m ado_analyzer daily --format markdown --output output/today.md

Scoring weights:

Factor Weight Logic
ADO Priority (P1-P4) 40% P1=100, P2=75, P3=50, P4=25
State 20% Active=100, New=50, Resolved=25
Assigned to me 15% Mine=100, Unassigned=50, Others=0
Staleness 10% Days since last update (capped at 100)
Tag match 10% Boost for focus-area tags
Story points 5% Smaller items get slight boost

PR review report

./venv/bin/python -m ado_analyzer pr-review
./venv/bin/python -m ado_analyzer pr-review --format markdown --output output/pr_review.md

Groups PRs into:

  • Needs my review (I'm a reviewer, haven't voted)
  • My PRs (waiting on others)
  • Stale (>7 days, configurable)

AI agent PR reviews

# Review unapproved PRs and save results to output/pr_reviews/
./venv/bin/python -m ado_analyzer agent-review

# Review AND post comments directly to ADO PRs
./venv/bin/python -m ado_analyzer agent-review --post

Three AI personas review each unapproved PR:

Persona Focus
PR-Review Code quality, DRY, naming, test coverage, git hygiene
Cisco-NSO-Expert YANG models, Python callbacks, templates, NED compatibility, MAAPI patterns
Debugging-Specialist Edge cases, error handling, resource leaks, security, backward compatibility

Each review produces:

  • output/pr_reviews/pr_<id>_<repo>_comment.md -- Markdown ready to post to ADO
  • output/pr_reviews/pr_<id>_<repo>_review.json -- Full structured data

Epic breakdown

# All team epics
./venv/bin/python -m ado_analyzer epics

# Only my items, grouped by epic
./venv/bin/python -m ado_analyzer epics --assigned-to me

# Include closed epics
./venv/bin/python -m ado_analyzer epics --assigned-to me --show-closed

Backlog

./venv/bin/python -m ado_analyzer backlog
./venv/bin/python -m ado_analyzer backlog --state Active --assigned-to me
./venv/bin/python -m ado_analyzer backlog --state Resolved --assigned-to me

Multi-Org Support

The tool supports multiple ADO organizations simultaneously — useful when boards and repos live in different places (e.g., cloud vs on-prem).

Each org gets its own PAT and API version in config.yaml. See config.example.yaml for the full template.

Scheduling (Cron)

crontab -e
# Daily task list at 7am
0 7 * * * cd "$HOME/Scripts/ADO_Ticket_Analyzer" && ./venv/bin/python -m ado_analyzer daily --format markdown --output output/daily_$(date +\%Y\%m\%d).md >> output/daily.log 2>&1

# Friday PR review at 9am (before team meeting)
0 9 * * 5 cd "$HOME/Scripts/ADO_Ticket_Analyzer" && ./venv/bin/python -m ado_analyzer pr-review --format markdown --output output/pr_review_$(date +\%Y\%m\%d).md >> output/pr_review.log 2>&1

# Thursday 8pm -- AI agent reviews (gives time to process before Friday)
0 20 * * 4 "$HOME/Scripts/ADO_Ticket_Analyzer/cron_agent_review.sh" >> "$HOME/Scripts/ADO_Ticket_Analyzer/output/agent_review.log" 2>&1

Running Tests

./venv/bin/python -m pytest tests/ -v

Security

  • PATs are stored in environment variables, never in config files
  • config.yaml, .env, and output/ are gitignored
  • The Anthropic API key is also env-var only
  • AI agent reviews can be run locally without --post to inspect before publishing

License

MIT

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors