feat(agent-task view): support PR /agent-sessions/* URL as argument

Signed-off-by: Babak K. Shandiz <babakks@github.com>
This commit is contained in:
Babak K. Shandiz 2025-09-10 18:45:06 +01:00
parent 7e21837f3d
commit 3798d98969
No known key found for this signature in database
GPG key ID: 9472CAEFF56C742E
2 changed files with 11 additions and 0 deletions

View file

@ -80,6 +80,8 @@ func NewCmdView(f *cmdutil.Factory, runF func(*ViewOptions) error) *cobra.Comman
opts.SelectorArg = args[0]
if shared.IsSessionID(opts.SelectorArg) {
opts.SessionID = opts.SelectorArg
} else if sessionID, err := shared.ParsePullRequestAgentSessionURL(opts.SelectorArg); err == nil {
opts.SessionID = sessionID
}
}

View file

@ -46,6 +46,15 @@ func TestNewCmdList(t *testing.T) {
SessionID: "00000000-0000-0000-0000-000000000000",
},
},
{
name: "PR agent-session URL arg tty",
tty: true,
args: "https://github.com/OWNER/REPO/pull/101/agent-sessions/00000000-0000-0000-0000-000000000000",
wantOpts: ViewOptions{
SelectorArg: "https://github.com/OWNER/REPO/pull/101/agent-sessions/00000000-0000-0000-0000-000000000000",
SessionID: "00000000-0000-0000-0000-000000000000",
},
},
{
name: "non-session ID arg tty",
tty: true,