Skip to content

Add run list --mine for auto-detecting current user builds #171

@tiulpin

Description

@tiulpin

Area: Build Operations (run, trigger, cancel, logs)

Problem or use case

In Journey 1 (Developer Daily Loop), the biggest friction point is that an AI agent cannot find "my latest build" without the developer manually providing a build ID, job ID, or project name. The agent has no way to auto-resolve what the developer cares about from their current git context.

Current workaround requires the developer to tell the agent what to look for:

# Developer must know and provide the job ID
teamcity run list --job MyProject_Build --branch my-feature

The PRD identifies this as a key gap: "Agent currently needs the developer to provide a build ID or project name manually."

Proposed solution

--mine flag

teamcity run list --mine                     # My recent builds across all jobs
teamcity run list --mine --status failure     # My recent failures
teamcity run list --mine --branch auto        # My builds on current git branch

--mine filters to builds triggered by the currently authenticated user (from teamcity auth status).

Auto-detect from git context

When inside a git repository, auto-resolve useful defaults:

# Inside a git repo on branch "feature/login"
teamcity run list --mine
# → Equivalent to: teamcity run list --user <current-user> --branch feature/login

run last shortcut

For the most common agent use case — "what happened with my latest build?":

teamcity run last                            # Latest build for current user + branch
teamcity run last --job MyProject_Build      # Latest build for specific job
teamcity run last --json                     # Machine-readable for agents

Output:

RUN      JOB                   STATUS    BRANCH           FINISHED
#12345   MyProject :: Build    FAILURE   feature/login    5m ago

This is distinct from #145 (build status by commit SHA — starts from a known commit) and #119 (favorite builds — curated list). This is about "what's the CI status of what I'm working on right now?"

Implementation

  • Read current user from auth config (already available)
  • Read current branch from git rev-parse --abbrev-ref HEAD (similar to existing logic in internal/cmd/run/git.go)
  • Use existing --user and --branch filters on the builds API

Flags

  • --mine — filter to current authenticated user
  • --json — machine-readable output

Alternatives considered

  • Just document run list --user $(whoami) in skill docs — agent still doesn't know the username or branch
  • Add auto-detection to the skill documentation only — doesn't solve the core UX problem; the agent still needs multi-step resolution
  • Add a --context flag that reads .teamcity/ to auto-detect project — useful but separate concern

Contribution

  • I'd be willing to submit a PR for this feature

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:build-opsBuild operations (trigger, queue, cancel, logs)enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions