Skip to content

feat(codeagent): support local cli mode #7

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 5, 2025
Merged

Conversation

CarlJi
Copy link
Contributor

@CarlJi CarlJi commented Jul 5, 2025

No description provided.

@@ -356,3 +377,31 @@ func (a *Agent) FixPR(pr *github.PullRequest) error {
func (a *Agent) ReviewPR(pr *github.PullRequest) error {
return nil
}

// promptWithRetry 带重试机制的 prompt 调用
func (a *Agent) promptWithRetry(code code.Code, prompt string, maxRetries int) (*code.Response, error) {
Copy link

Choose a reason for hiding this comment

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

(*Agent).promptWithRetry - maxRetries always receives 3 (unparam)

Details

lint 解释

这个lint结果表明在方法 (*Agent).promptWithRetry 中,参数 maxRetries 始终被赋值为 3。这意味着该参数没有被使用或配置,因此可以考虑将其移除以提高代码的可读性和灵活性。

错误用法

func (a *Agent) promptWithRetry(prompt string, maxRetries int) error {
    for i := 0; i < maxRetries; i++ {
        // 执行某些操作
    }
    return nil
}

在这个示例中,maxRetries 参数始终被赋值为 3,并且没有在方法内部使用。

正确用法

func (a *Agent) promptWithRetry(prompt string, maxRetries int) error {
    if maxRetries <= 0 {
        return errors.New("maxRetries must be greater than 0")
    }
    for i := 0; i < maxRetries; i++ {
        // 执行某些操作
    }
    return nil
}

在这个示例中,maxRetries 参数被正确使用,并且在方法内部进行了检查。这样可以确保 maxRetries 的值是有效的,并且可以根据需要进行调整。


💡 以上内容由 AI 辅助生成,如有疑问欢迎反馈交流

return NewClaude(workspace, cfg)
// Claude 目前只支持 Docker 模式
if !cfg.UseDocker {
return nil, fmt.Errorf("Claude only supports Docker mode currently")
Copy link

Choose a reason for hiding this comment

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

use-errors-new: replace fmt.Errorf by errors.New (revive)

Details

lint 解释

use-errors-new 是一个 lint 规则,建议使用 errors.New 来创建错误对象,而不是使用 fmt.Errorffmt.Errorf 会生成带有堆栈跟踪的错误信息,而 errors.New 则不会。

错误用法

package main

import (
    "fmt"
)

func main() {
    err := fmt.Errorf("这是一个错误")
    if err != nil {
        fmt.Println(err)
    }
}

在这个例子中,使用了 fmt.Errorf 来创建一个错误对象。

正确用法

package main

import (
    "errors"
)

func main() {
    err := errors.New("这是一个错误")
    if err != nil {
        fmt.Println(err)
    }
}

在这个例子中,使用了 errors.New 来创建一个错误对象。


💡 以上内容由 AI 辅助生成,如有疑问欢迎反馈交流

@CarlJi CarlJi merged commit b06e8d3 into qiniu:main Jul 5, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant