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

Commitfa82f84

Browse files
authored
chore(docs): add documentation for exp CLI commands (#20019)
Updates task documentation with experimental CLI.~Generated by Claude using `--help` output.~Should be merged alongside#20020
1 parent5807fe0 commitfa82f84

File tree

8 files changed

+320
-6
lines changed

8 files changed

+320
-6
lines changed

‎cli/exp_task_create.go‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,28 @@ func (r *RootCmd) taskCreate() *serpent.Command {
2929
cmd:=&serpent.Command{
3030
Use:"create [input]",
3131
Short:"Create an experimental task",
32+
Long:FormatExamples(
33+
Example{
34+
Description:"Create a task with direct input",
35+
Command:"coder exp task create\"Add authentication to the user service\"",
36+
},
37+
Example{
38+
Description:"Create a task with stdin input",
39+
Command:"echo\"Add authentication to the user service\" | coder exp task create",
40+
},
41+
Example{
42+
Description:"Create a task with a specific name",
43+
Command:"coder exp task create --name task1\"Add authentication to the user service\"",
44+
},
45+
Example{
46+
Description:"Create a task from a specific template / preset",
47+
Command:"coder exp task create --template backend-dev --preset\"My Preset\"\"Add authentication to the user service\"",
48+
},
49+
Example{
50+
Description:"Create a task for another user (requires appropriate permissions)",
51+
Command:"coder exp task create --owner user@example.com\"Add authentication to the user service\"",
52+
},
53+
),
3254
Middleware:serpent.Chain(
3355
serpent.RequireRangeArgs(0,1),
3456
),

‎cli/exp_task_delete.go‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,20 @@ func (r *RootCmd) taskDelete() *serpent.Command {
1919
cmd:=&serpent.Command{
2020
Use:"delete <task> [<task> ...]",
2121
Short:"Delete experimental tasks",
22+
Long:FormatExamples(
23+
Example{
24+
Description:"Delete a single task.",
25+
Command:"$ coder exp task delete task1",
26+
},
27+
Example{
28+
Description:"Delete multiple tasks.",
29+
Command:"$ coder exp task delete task1 task2 task3",
30+
},
31+
Example{
32+
Description:"Delete a task without confirmation.",
33+
Command:"$ coder exp task delete task4 --yes",
34+
},
35+
),
2236
Middleware:serpent.Chain(
2337
serpent.RequireRangeArgs(1,-1),
2438
),

‎cli/exp_task_list.go‎

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,30 @@ func (r *RootCmd) taskList() *serpent.Command {
6767
)
6868

6969
cmd:=&serpent.Command{
70-
Use:"list",
71-
Short:"List experimental tasks",
70+
Use:"list",
71+
Short:"List experimental tasks",
72+
Long:FormatExamples(
73+
Example{
74+
Description:"List tasks for the current user.",
75+
Command:"coder exp task list",
76+
},
77+
Example{
78+
Description:"List tasks for a specific user.",
79+
Command:"coder exp task list --user someone-else",
80+
},
81+
Example{
82+
Description:"List all tasks you can view.",
83+
Command:"coder exp task list --all",
84+
},
85+
Example{
86+
Description:"List all your running tasks.",
87+
Command:"coder exp task list --status running",
88+
},
89+
Example{
90+
Description:"As above, but only show IDs.",
91+
Command:"coder exp task list --status running --quiet",
92+
},
93+
),
7294
Aliases: []string{"ls"},
7395
Middleware:serpent.Chain(
7496
serpent.RequireNArgs(0),

‎cli/exp_task_logs.go‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ func (r *RootCmd) taskLogs() *serpent.Command {
2626
cmd:=&serpent.Command{
2727
Use:"logs <task>",
2828
Short:"Show a task's logs",
29+
Long:FormatExamples(
30+
Example{
31+
Description:"Show logs for a given task.",
32+
Command:"coder exp task logs task1",
33+
}),
2934
Middleware:serpent.Chain(
3035
serpent.RequireNArgs(1),
3136
),

‎cli/exp_task_send.go‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,15 @@ func (r *RootCmd) taskSend() *serpent.Command {
1414
varstdinbool
1515

1616
cmd:=&serpent.Command{
17-
Use:"send <task> [<input> | --stdin]",
18-
Short:"Send input to a task",
17+
Use:"send <task> [<input> | --stdin]",
18+
Short:"Send input to a task",
19+
Long:FormatExamples(Example{
20+
Description:"Send direct input to a task.",
21+
Command:"coder exp task send task1\"Please also add unit tests\"",
22+
},Example{
23+
Description:"Send input from stdin to a task.",
24+
Command:"echo\"Please also add unit tests\" | coder exp task send task1 --stdin",
25+
}),
1926
Middleware:serpent.RequireRangeArgs(1,2),
2027
Options: serpent.OptionSet{
2128
{

‎cli/exp_task_status.go‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,17 @@ func (r *RootCmd) taskStatus() *serpent.Command {
4444
watchIntervalArg time.Duration
4545
)
4646
cmd:=&serpent.Command{
47-
Short:"Show the status of a task.",
47+
Short:"Show the status of a task.",
48+
Long:FormatExamples(
49+
Example{
50+
Description:"Show the status of a given task.",
51+
Command:"coder exp task status task1",
52+
},
53+
Example{
54+
Description:"Watch the status of a given task until it completes (idle or stopped).",
55+
Command:"coder exp task status task1 --watch",
56+
},
57+
),
4858
Use:"status",
4959
Aliases: []string{"stat"},
5060
Options: serpent.OptionSet{

‎docs/ai-coder/cli.md‎

Lines changed: 230 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,230 @@
1+
#Tasks CLI
2+
3+
The Coder CLI provides experimental commands for managing tasks programmatically. These are available under`coder exp task`:
4+
5+
```console
6+
USAGE:
7+
coder exp task
8+
9+
Experimental task commands.
10+
11+
Aliases: tasks
12+
13+
SUBCOMMANDS:
14+
create Create an experimental task
15+
delete Delete experimental tasks
16+
list List experimental tasks
17+
logs Show a task's logs
18+
send Send input to a task
19+
status Show the status of a task.
20+
```
21+
22+
##Creating tasks
23+
24+
```console
25+
USAGE:
26+
coder exp task create [flags] [input]
27+
28+
Create an experimental task
29+
30+
- Create a task with direct input:
31+
32+
$ coder exp task create "Add authentication to the user service"
33+
34+
- Create a task with stdin input:
35+
36+
$ echo "Add authentication to the user service" | coder exp task create
37+
38+
- Create a task with a specific name:
39+
40+
$ coder exp task create --name task1 "Add authentication to the user service"
41+
42+
- Create a task from a specific template / preset:
43+
44+
$ coder exp task create --template backend-dev --preset "My Preset" "Add authentication to the user service"
45+
46+
- Create a task for another user (requires appropriate permissions):
47+
48+
$ coder exp task create --owner user@example.com "Add authentication to the user service"
49+
50+
OPTIONS:
51+
-O, --org string, $CODER_ORGANIZATION
52+
Select which organization (uuid or name) to use.
53+
54+
--name string
55+
Specify the name of the task. If you do not specify one, a name will be generated for you.
56+
57+
--owner string (default: me)
58+
Specify the owner of the task. Defaults to the current user.
59+
60+
--preset string, $CODER_TASK_PRESET_NAME (default: none)
61+
-q, --quiet bool
62+
Only display the created task's ID.
63+
64+
--stdin bool
65+
Reads from stdin for the task input.
66+
67+
--template string, $CODER_TASK_TEMPLATE_NAME
68+
--template-version string, $CODER_TASK_TEMPLATE_VERSION
69+
```
70+
71+
##Deleting Tasks
72+
73+
```console
74+
USAGE:
75+
coder exp task delete [flags] <task> [<task> ...]
76+
77+
Delete experimental tasks
78+
79+
Aliases: rm
80+
81+
- Delete a single task.:
82+
83+
$ $ coder exp task delete task1
84+
85+
- Delete multiple tasks.:
86+
87+
$ $ coder exp task delete task1 task2 task3
88+
89+
- Delete a task without confirmation.:
90+
91+
$ $ coder exp task delete task4 --yes
92+
93+
OPTIONS:
94+
-y, --yes bool
95+
Bypass prompts.
96+
```
97+
98+
##Listing tasks
99+
100+
```console
101+
USAGE:
102+
coder exp task list [flags]
103+
104+
List experimental tasks
105+
106+
Aliases: ls
107+
108+
- List tasks for the current user.:
109+
110+
$ coder exp task list
111+
112+
- List tasks for a specific user.:
113+
114+
$ coder exp task list --user someone-else
115+
116+
- List all tasks you can view.:
117+
118+
$ coder exp task list --all
119+
120+
- List all your running tasks.:
121+
122+
$ coder exp task list --status running
123+
124+
- As above, but only show IDs.:
125+
126+
$ coder exp task list --status running --quiet
127+
128+
OPTIONS:
129+
-a, --all bool (default: false)
130+
List tasks for all users you can view.
131+
132+
-c, --column [id|organization id|owner id|owner name|name|template id|template name|template display name|template icon|workspace id|workspace agent id|workspace agent lifecycle|workspace agent health|initial prompt|status|state|message|created at|updated at|state changed] (default: name,status,state,state changed,message)
133+
Columns to display in table output.
134+
135+
-o, --output table|json (default: table)
136+
Output format.
137+
138+
-q, --quiet bool (default: false)
139+
Only display task IDs.
140+
141+
--status string
142+
Filter by task status (e.g. running, failed, etc).
143+
144+
--user string
145+
List tasks for the specified user (username, "me").
146+
```
147+
148+
##Viewing Task Logs
149+
150+
```console
151+
USAGE:
152+
coder exp task logs [flags] <task>
153+
154+
Show a task's logs
155+
156+
- Show logs for a given task.:
157+
158+
$ coder exp task logs task1
159+
160+
OPTIONS:
161+
-c, --column [id|content|type|time] (default: type,content)
162+
Columns to display in table output.
163+
164+
-o, --output table|json (default: table)
165+
Output format.
166+
```
167+
168+
##Sending input to a task
169+
170+
```console
171+
USAGE:
172+
coder exp task send [flags] <task> [<input> | --stdin]
173+
174+
Send input to a task
175+
176+
- Send direct input to a task.:
177+
178+
$ coder exp task send task1 "Please also add unit tests"
179+
180+
- Send input from stdin to a task.:
181+
182+
$ echo "Please also add unit tests" | coder exp task send task1 --stdin
183+
184+
OPTIONS:
185+
--stdin bool
186+
Reads the input from stdin.
187+
```
188+
189+
##Viewing Task Status
190+
191+
```console
192+
USAGE:
193+
coder exp task status [flags]
194+
195+
Show the status of a task.
196+
197+
Aliases: stat
198+
199+
- Show the status of a given task.:
200+
201+
$ coder exp task status task1
202+
203+
- Watch the status of a given task until it completes (idle or stopped).:
204+
205+
$ coder exp task status task1 --watch
206+
207+
OPTIONS:
208+
-c, --column [state changed|status|healthy|state|message] (default: state changed,status,healthy,state,message)
209+
Columns to display in table output.
210+
211+
-o, --output table|json (default: table)
212+
Output format.
213+
214+
--watch bool (default: false)
215+
Watch the task status output. This will stream updates to the terminal until the underlying workspace is stopped.
216+
```
217+
218+
>**Note**: The`--watch` flag will automatically exit when the task reaches a terminal state. Watch mode ends when:
219+
>
220+
>- The workspace is stopped
221+
>- The workspace agent becomes unhealthy or is shutting down
222+
>- The task completes (reaches a non-working state like completed, failed, or canceled)
223+
224+
##Identifying Tasks
225+
226+
Tasks can be identified in CLI commands using either:
227+
228+
-**Task Name**: The human-readable name (e.g.,`my-task-name`)
229+
>Note: Tasks owned by other users can be identified by their owner and name (e.g.,`alice/her-task`).
230+
-**Task ID**: The UUID identifier (e.g.,`550e8400-e29b-41d4-a716-446655440000`)

‎docs/ai-coder/tasks.md‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ data "coder_parameter" "setup_script" {
6363
6464
# The Claude Code module does the automatic task reporting
6565
# Other agent modules: https://registry.coder.com/modules?search=agent
66-
# Or use a custom agent:
66+
# Or use a custom agent:
6767
module "claude-code" {
6868
source = "registry.coder.com/coder/claude-code/coder"
6969
version = "3.0.1"
@@ -128,6 +128,10 @@ Coder can automatically generate a name your tasks if you set the `ANTHROPIC_API
128128

129129
If you tried Tasks and decided you don't want to use it, you can hide the Tasks tab by starting`coder server` with the`CODER_HIDE_AI_TASKS=true` environment variable or the`--hide-ai-tasks` flag.
130130

131+
##Command Line Interface
132+
133+
See[Tasks CLI](./cli.md).
134+
131135
##Next Steps
132136

133137
<children></children>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp