Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat(cli): add exp task logs#19915

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
DanielleMaywood merged 2 commits intomainfromdanielle/tasks/cli-logs
Sep 26, 2025
Merged

Conversation

DanielleMaywood
Copy link
Contributor

@DanielleMaywoodDanielleMaywood commentedSep 22, 2025
edited
Loading

@DanielleMaywoodDanielleMaywoodforce-pushed thedanielle/tasks/cli-logs branch 11 times, most recently fromd0e4d4c tocc041e5CompareSeptember 25, 2025 15:43
There isn't a supporting API for this yet. This is a skeletonimplementation prepared in advance for the API being available.
Comment on lines 49 to 54
enc:=json.NewEncoder(inv.Stdout)
for_,log:=rangelogs.Logs {
iferr:=enc.Encode(log);err!=nil {
returnxerrors.Errorf("encode task log: %w",err)
}
}
Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Q: Do we want this? This will spit out a json object per log line, each separated by a newline. This is easily consumed by jq and other tools. I'm happy to change this if desired.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Yep, this is fine!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I think it's very usable! This way I can get just the last two entries, my input and the agents output.

❯ ./coder exp tasks logs task-foo-bar-15e4 | tail -n2 | jq -r '.type, .content'inputrun echo "are we there yet?"output● coder - coder_report_task (MCP)(summary: "Running echo command                                 with quoted string as requested",                                 link: "https://coder.com", state:                                 "working")  ⎿  {       "message": "Thanks for reporting!"     }● Bash(echo "are we there yet?")  ⎿  are we there yet?● are we there yet?

Comment on lines 15 to 22
Children: []*serpent.Command{
r.taskList(),
r.taskCreate(),
r.taskStatus(),
r.taskDelete(),
r.taskList(),
r.taskLogs(),
r.taskSend(),
r.taskStatus(),
},
Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

drive-by: sort

@DanielleMaywoodDanielleMaywood marked this pull request as ready for reviewSeptember 25, 2025 15:46
Comment on lines 49 to 54
enc:=json.NewEncoder(inv.Stdout)
for_,log:=rangelogs.Logs {
iferr:=enc.Encode(log);err!=nil {
returnxerrors.Errorf("encode task log: %w",err)
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Yep, this is fine!

Comment on lines +33 to +42
ifid,err:=uuid.Parse(task);err==nil {
taskID=id
}else {
ws,err:=namedWorkspace(ctx,client,task)
iferr!=nil {
returnxerrors.Errorf("resolve task %q: %w",task,err)
}

taskID=ws.ID
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

suggestion: at this point, we can probably use some kind of helpertaskByNameOrID

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Possibly. I'm curious about what it would look like though because I don't want to make an unnecessary API call.

returnxerrors.Errorf("get task logs: %w",err)
}

enc:=json.NewEncoder(inv.Stdout)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

suggestion: we could possibly use a cli.OutputFormatter and emit the logs either as text or JSON

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I've never used that before, I'll take a look at.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Copy link
Member

@mafredrimafredri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

:shipit:

Copy link
Member

@johnstcnjohnstcn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

🚢

Note: with thecli.OutputFormatter the JSON output will be an array now.

DanielleMaywood reacted with thumbs up emoji
@DanielleMaywoodDanielleMaywood merged commitb7e0b2a intomainSep 26, 2025
51 of 53 checks passed
@DanielleMaywoodDanielleMaywood deleted the danielle/tasks/cli-logs branchSeptember 26, 2025 09:37
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsSep 26, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@mafredrimafredrimafredri approved these changes

@johnstcnjohnstcnjohnstcn approved these changes

Assignees

@DanielleMaywoodDanielleMaywood

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Tasks CLI: Addlogs command
3 participants
@DanielleMaywood@mafredri@johnstcn

[8]ページ先頭

©2009-2025 Movatter.jp