Skip to content

Commit d43acc7

Browse files
author
Sisyphus Agent
committed
fix: submit 命令添加 OpenCode Server path 参数限制说明
- 在命令帮助中注明 OpenCode Server 可能忽略 path 参数 - 会话目录当前由服务器工作目录决定 - 这是 OpenCode Server 端的已知限制
1 parent 77baaf9 commit d43acc7

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

oho/cmd/session/submit.go

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import (
1818
var submitCmd = &cobra.Command{
1919
Use: "submit [message]",
2020
Short: "Submit a task by creating a session and sending a message in one step",
21-
Long: "Create a new session, optionally initialize it with AGENTS.md, and send a message in one command",
21+
Long: "Create a new session in current directory, optionally initialize it with AGENTS.md, and send a message in one command.\n\n注意:当前 OpenCode Server 可能会忽略 path 参数,会话目录由服务器决定。",
2222
Args: cobra.ExactArgs(1),
2323
RunE: func(cmd *cobra.Command, args []string) error {
2424
// Step 1: Validate flags
@@ -36,9 +36,18 @@ var submitCmd = &cobra.Command{
3636
if title != "" {
3737
req["title"] = title
3838
}
39-
if directory != "" {
40-
req["directory"] = directory
39+
40+
// 使用当前工作目录(如果用户未指定)
41+
// 注意:API 参数名是 path 不是 directory
42+
sessionPath := directory
43+
if sessionPath == "" {
44+
var err error
45+
sessionPath, err = os.Getwd()
46+
if err != nil {
47+
return fmt.Errorf("failed to get current directory: %w", err)
48+
}
4149
}
50+
req["path"] = sessionPath
4251

4352
resp, err := c.Post(ctx, "/session", req)
4453
if err != nil {

0 commit comments

Comments
 (0)