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): promote tasks commands from experimental to GA#20916

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
mafredri merged 6 commits intomainfrompromote-tasks-cli-to-ga
Nov 25, 2025
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletioncli/root.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -104,6 +104,7 @@ func (r *RootCmd) CoreSubcommands() []*serpent.Command {
r.resetPassword(),
r.sharing(),
r.state(),
r.tasksCommand(),
r.templates(),
r.tokens(),
r.users(),
Expand DownExpand Up@@ -149,7 +150,6 @@ func (r *RootCmd) AGPLExperimental() []*serpent.Command {
r.mcpCommand(),
r.promptExample(),
r.rptyCommand(),
r.tasksCommand(),
r.boundary(),
}
}
Expand Down
2 changes: 1 addition & 1 deletioncli/exp_task.go → cli/task.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -8,7 +8,7 @@ func (r *RootCmd) tasksCommand() *serpent.Command {
cmd := &serpent.Command{
Use: "task",
Aliases: []string{"tasks"},
Short: "Experimental task commands.",
Short: "Manage tasks",
Handler: func(i *serpent.Invocation) error {
return i.Command.HelpHandler(i)
},
Expand Down
12 changes: 6 additions & 6 deletionscli/exp_task_create.go → cli/task_create.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -28,27 +28,27 @@ func (r *RootCmd) taskCreate() *serpent.Command {

cmd := &serpent.Command{
Use: "create [input]",
Short: "Createan experimental task",
Short: "Createa task",
Long: FormatExamples(
Example{
Description: "Create a task with direct input",
Command: "coderexptask create \"Add authentication to the user service\"",
Command: "coder task create \"Add authentication to the user service\"",
},
Example{
Description: "Create a task with stdin input",
Command: "echo \"Add authentication to the user service\" | coderexptask create",
Command: "echo \"Add authentication to the user service\" | coder task create",
},
Example{
Description: "Create a task with a specific name",
Command: "coderexptask create --name task1 \"Add authentication to the user service\"",
Command: "coder task create --name task1 \"Add authentication to the user service\"",
},
Example{
Description: "Create a task from a specific template / preset",
Command: "coderexptask create --template backend-dev --preset \"My Preset\" \"Add authentication to the user service\"",
Command: "coder task create --template backend-dev --preset \"My Preset\" \"Add authentication to the user service\"",
},
Example{
Description: "Create a task for another user (requires appropriate permissions)",
Command: "coderexptask create --owner user@example.com \"Add authentication to the user service\"",
Command: "coder task create --owner user@example.com \"Add authentication to the user service\"",
},
),
Middleware: serpent.Chain(
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -329,7 +329,7 @@ func TestTaskCreate(t *testing.T) {
ctx = testutil.Context(t, testutil.WaitShort)
srv = httptest.NewServer(tt.handler(t, ctx))
client = codersdk.New(testutil.MustURL(t, srv.URL))
args = []string{"exp", "task", "create"}
args = []string{"task", "create"}
sb strings.Builder
err error
)
Expand Down
8 changes: 4 additions & 4 deletionscli/exp_task_delete.go → cli/task_delete.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -17,19 +17,19 @@ import (
func (r *RootCmd) taskDelete() *serpent.Command {
cmd := &serpent.Command{
Use: "delete <task> [<task> ...]",
Short: "Deleteexperimentaltasks",
Short: "Delete tasks",
Long: FormatExamples(
Example{
Description: "Delete a single task.",
Command: "$ coderexptask delete task1",
Command: "$ coder task delete task1",
},
Example{
Description: "Delete multiple tasks.",
Command: "$ coderexptask delete task1 task2 task3",
Command: "$ coder task delete task1 task2 task3",
},
Example{
Description: "Delete a task without confirmation.",
Command: "$ coderexptask delete task4 --yes",
Command: "$ coder task delete task4 --yes",
},
),
Middleware: serpent.Chain(
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -193,7 +193,7 @@ func TestExpTaskDelete(t *testing.T) {

client:=codersdk.New(testutil.MustURL(t,srv.URL))

args:=append([]string{"exp","task","delete"},tc.args...)
args:=append([]string{"task","delete"},tc.args...)
inv,root:=clitest.New(t,args...)
inv=inv.WithContext(ctx)
clitest.SetupConfig(t,client,root)
Expand Down
12 changes: 6 additions & 6 deletionscli/exp_task_list.go → cli/task_list.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -69,27 +69,27 @@ func (r *RootCmd) taskList() *serpent.Command {

cmd:=&serpent.Command{
Use:"list",
Short:"Listexperimentaltasks",
Short:"List tasks",
Long:FormatExamples(
Example{
Description:"List tasks for the current user.",
Command:"coderexptask list",
Command:"coder task list",
},
Example{
Description:"List tasks for a specific user.",
Command:"coderexptask list --user someone-else",
Command:"coder task list --user someone-else",
},
Example{
Description:"List all tasks you can view.",
Command:"coderexptask list --all",
Command:"coder task list --all",
},
Example{
Description:"List all your running tasks.",
Command:"coderexptask list --status running",
Command:"coder task list --status running",
},
Example{
Description:"As above, but only show IDs.",
Command:"coderexptask list --status running --quiet",
Command:"coder task list --status running --quiet",
},
),
Aliases: []string{"ls"},
Expand Down
14 changes: 7 additions & 7 deletionscli/exp_task_list_test.go → cli/task_list_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -69,7 +69,7 @@ func TestExpTaskList(t *testing.T) {
owner := coderdtest.CreateFirstUser(t, client)
memberClient, _ := coderdtest.CreateAnotherUser(t, client, owner.OrganizationID)

inv, root := clitest.New(t, "exp", "task", "list")
inv, root := clitest.New(t, "task", "list")
clitest.SetupConfig(t, memberClient, root)

pty := ptytest.New(t).Attach(inv)
Expand All@@ -93,7 +93,7 @@ func TestExpTaskList(t *testing.T) {
wantPrompt := "build me a web app"
task := makeAITask(t, db, owner.OrganizationID, owner.UserID, memberUser.ID, database.WorkspaceTransitionStart, wantPrompt)

inv, root := clitest.New(t, "exp", "task", "list", "--column", "id,name,status,initial prompt")
inv, root := clitest.New(t, "task", "list", "--column", "id,name,status,initial prompt")
clitest.SetupConfig(t, memberClient, root)

pty := ptytest.New(t).Attach(inv)
Expand DownExpand Up@@ -122,7 +122,7 @@ func TestExpTaskList(t *testing.T) {
pausedTask := makeAITask(t, db, owner.OrganizationID, owner.UserID, memberUser.ID, database.WorkspaceTransitionStop, "stop me please")

// Use JSON output to reliably validate filtering.
inv, root := clitest.New(t, "exp", "task", "list", "--status=paused", "--output=json")
inv, root := clitest.New(t, "task", "list", "--status=paused", "--output=json")
clitest.SetupConfig(t, memberClient, root)

ctx := testutil.Context(t, testutil.WaitShort)
Expand DownExpand Up@@ -153,7 +153,7 @@ func TestExpTaskList(t *testing.T) {
_ = makeAITask(t, db, owner.OrganizationID, owner.UserID, memberUser.ID, database.WorkspaceTransitionStart, "other-task")
task := makeAITask(t, db, owner.OrganizationID, owner.UserID, owner.UserID, database.WorkspaceTransitionStart, "me-task")

inv, root := clitest.New(t, "exp", "task", "list", "--user", "me")
inv, root := clitest.New(t, "task", "list", "--user", "me")
//nolint:gocritic // Owner client is intended here smoke test the member task not showing up.
clitest.SetupConfig(t, client, root)

Expand All@@ -180,7 +180,7 @@ func TestExpTaskList(t *testing.T) {
task2 := makeAITask(t, db, owner.OrganizationID, owner.UserID, memberUser.ID, database.WorkspaceTransitionStop, "stop me please")

// Given: We add the `--quiet` flag
inv, root := clitest.New(t, "exp", "task", "list", "--quiet")
inv, root := clitest.New(t, "task", "list", "--quiet")
clitest.SetupConfig(t, memberClient, root)

ctx := testutil.Context(t, testutil.WaitShort)
Expand DownExpand Up@@ -224,7 +224,7 @@ func TestExpTaskList_OwnerCanListOthers(t *testing.T) {
t.Parallel()

// As the owner, list only member A tasks.
inv, root := clitest.New(t, "exp", "task", "list", "--user", memberAUser.Username, "--output=json")
inv, root := clitest.New(t, "task", "list", "--user", memberAUser.Username, "--output=json")
//nolint:gocritic // Owner client is intended here to allow member tasks to be listed.
clitest.SetupConfig(t, ownerClient, root)

Expand DownExpand Up@@ -252,7 +252,7 @@ func TestExpTaskList_OwnerCanListOthers(t *testing.T) {

// As the owner, list all tasks to verify both member tasks are present.
// Use JSON output to reliably validate filtering.
inv, root := clitest.New(t, "exp", "task", "list", "--all", "--output=json")
inv, root := clitest.New(t, "task", "list", "--all", "--output=json")
//nolint:gocritic // Owner client is intended here to allow all tasks to be listed.
clitest.SetupConfig(t, ownerClient, root)

Expand Down
2 changes: 1 addition & 1 deletioncli/exp_task_logs.go → cli/task_logs.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -28,7 +28,7 @@ func (r *RootCmd) taskLogs() *serpent.Command {
Long: FormatExamples(
Example{
Description: "Show logs for a given task.",
Command: "coderexptask logs task1",
Command: "coder task logs task1",
}),
Middleware: serpent.Chain(
serpent.RequireNArgs(1),
Expand Down
12 changes: 6 additions & 6 deletionscli/exp_task_logs_test.go → cli/task_logs_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -46,7 +46,7 @@ func Test_TaskLogs(t *testing.T) {
userClient := client // user already has access to their own workspace

var stdout strings.Builder
inv, root := clitest.New(t, "exp", "task", "logs", task.Name, "--output", "json")
inv, root := clitest.New(t, "task", "logs", task.Name, "--output", "json")
inv.Stdout = &stdout
clitest.SetupConfig(t, userClient, root)

Expand All@@ -72,7 +72,7 @@ func Test_TaskLogs(t *testing.T) {
userClient := client

var stdout strings.Builder
inv, root := clitest.New(t, "exp", "task", "logs", task.ID.String(), "--output", "json")
inv, root := clitest.New(t, "task", "logs", task.ID.String(), "--output", "json")
inv.Stdout = &stdout
clitest.SetupConfig(t, userClient, root)

Expand All@@ -98,7 +98,7 @@ func Test_TaskLogs(t *testing.T) {
userClient := client

var stdout strings.Builder
inv, root := clitest.New(t, "exp", "task", "logs", task.ID.String())
inv, root := clitest.New(t, "task", "logs", task.ID.String())
inv.Stdout = &stdout
clitest.SetupConfig(t, userClient, root)

Expand All@@ -121,7 +121,7 @@ func Test_TaskLogs(t *testing.T) {
userClient, _ := coderdtest.CreateAnotherUser(t, client, owner.OrganizationID)

var stdout strings.Builder
inv, root := clitest.New(t, "exp", "task", "logs", "doesnotexist")
inv, root := clitest.New(t, "task", "logs", "doesnotexist")
inv.Stdout = &stdout
clitest.SetupConfig(t, userClient, root)

Expand All@@ -139,7 +139,7 @@ func Test_TaskLogs(t *testing.T) {
userClient, _ := coderdtest.CreateAnotherUser(t, client, owner.OrganizationID)

var stdout strings.Builder
inv, root := clitest.New(t, "exp", "task", "logs", uuid.Nil.String())
inv, root := clitest.New(t, "task", "logs", uuid.Nil.String())
inv.Stdout = &stdout
clitest.SetupConfig(t, userClient, root)

Expand All@@ -155,7 +155,7 @@ func Test_TaskLogs(t *testing.T) {
client, task := setupCLITaskTest(ctx, t, fakeAgentAPITaskLogsErr(assert.AnError))
userClient := client

inv, root := clitest.New(t, "exp", "task", "logs", task.ID.String())
inv, root := clitest.New(t, "task", "logs", task.ID.String())
clitest.SetupConfig(t, userClient, root)

err := inv.WithContext(ctx).Run()
Expand Down
4 changes: 2 additions & 2 deletionscli/exp_task_send.go → cli/task_send.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -17,10 +17,10 @@ func (r *RootCmd) taskSend() *serpent.Command {
Short: "Send input to a task",
Long: FormatExamples(Example{
Description: "Send direct input to a task.",
Command: "coderexptask send task1 \"Please also add unit tests\"",
Command: "coder task send task1 \"Please also add unit tests\"",
}, Example{
Description: "Send input from stdin to a task.",
Command: "echo \"Please also add unit tests\" | coderexptask send task1 --stdin",
Command: "echo \"Please also add unit tests\" | coder task send task1 --stdin",
}),
Middleware: serpent.RequireRangeArgs(1, 2),
Options: serpent.OptionSet{
Expand Down
12 changes: 6 additions & 6 deletionscli/exp_task_send_test.go → cli/task_send_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -30,7 +30,7 @@ func Test_TaskSend(t *testing.T) {
userClient := client

var stdout strings.Builder
inv, root := clitest.New(t, "exp", "task", "send", task.Name, "carry on with the task")
inv, root := clitest.New(t, "task", "send", task.Name, "carry on with the task")
inv.Stdout = &stdout
clitest.SetupConfig(t, userClient, root)

Expand All@@ -46,7 +46,7 @@ func Test_TaskSend(t *testing.T) {
userClient := client

var stdout strings.Builder
inv, root := clitest.New(t, "exp", "task", "send", task.ID.String(), "carry on with the task")
inv, root := clitest.New(t, "task", "send", task.ID.String(), "carry on with the task")
inv.Stdout = &stdout
clitest.SetupConfig(t, userClient, root)

Expand All@@ -62,7 +62,7 @@ func Test_TaskSend(t *testing.T) {
userClient := client

var stdout strings.Builder
inv, root := clitest.New(t, "exp", "task", "send", task.Name, "--stdin")
inv, root := clitest.New(t, "task", "send", task.Name, "--stdin")
inv.Stdout = &stdout
inv.Stdin = strings.NewReader("carry on with the task")
clitest.SetupConfig(t, userClient, root)
Expand All@@ -80,7 +80,7 @@ func Test_TaskSend(t *testing.T) {
userClient, _ := coderdtest.CreateAnotherUser(t, client, owner.OrganizationID)

var stdout strings.Builder
inv, root := clitest.New(t, "exp", "task", "send", "doesnotexist", "some task input")
inv, root := clitest.New(t, "task", "send", "doesnotexist", "some task input")
inv.Stdout = &stdout
clitest.SetupConfig(t, userClient, root)

Expand All@@ -98,7 +98,7 @@ func Test_TaskSend(t *testing.T) {
userClient, _ := coderdtest.CreateAnotherUser(t, client, owner.OrganizationID)

var stdout strings.Builder
inv, root := clitest.New(t, "exp", "task", "send", uuid.Nil.String(), "some task input")
inv, root := clitest.New(t, "task", "send", uuid.Nil.String(), "some task input")
inv.Stdout = &stdout
clitest.SetupConfig(t, userClient, root)

Expand All@@ -114,7 +114,7 @@ func Test_TaskSend(t *testing.T) {
userClient, task := setupCLITaskTest(ctx, t, fakeAgentAPITaskSendErr(t, assert.AnError))

var stdout strings.Builder
inv, root := clitest.New(t, "exp", "task", "send", task.Name, "some task input")
inv, root := clitest.New(t, "task", "send", task.Name, "some task input")
inv.Stdout = &stdout
clitest.SetupConfig(t, userClient, root)

Expand Down
4 changes: 2 additions & 2 deletionscli/exp_task_status.go → cli/task_status.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -47,11 +47,11 @@ func (r *RootCmd) taskStatus() *serpent.Command {
Long: FormatExamples(
Example{
Description: "Show the status of a given task.",
Command: "coderexptask status task1",
Command: "coder task status task1",
},
Example{
Description: "Watch the status of a given task until it completes (idle or stopped).",
Command: "coderexptask status task1 --watch",
Command: "coder task status task1 --watch",
},
),
Use: "status",
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -256,7 +256,7 @@ func Test_TaskStatus(t *testing.T) {
srv = httptest.NewServer(http.HandlerFunc(tc.hf(ctx, now)))
client = codersdk.New(testutil.MustURL(t, srv.URL))
sb = strings.Builder{}
args = []string{"exp", "task", "status", "--watch-interval", testutil.IntervalFast.String()}
args = []string{"task", "status", "--watch-interval", testutil.IntervalFast.String()}
)

t.Cleanup(srv.Close)
Expand Down
Loading
Loading

[8]ページ先頭

©2009-2025 Movatter.jp