Skip to content

enhance: accept cred overrides on run #2

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 2 commits into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from all 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 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/charmbracelet/lipgloss v0.11.0
github.com/chzyer/readline v1.5.1
github.com/fatih/color v1.17.0
github.com/gptscript-ai/go-gptscript v0.0.0-20240625134437-4b83849794cc
github.com/gptscript-ai/go-gptscript v0.9.1
github.com/pterm/pterm v0.12.79
github.com/sourcegraph/go-diff-patch v0.0.0-20240223163233-798fd1e94a8e
golang.org/x/exp v0.0.0-20240103183307-be819d1f06fc
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ github.com/gookit/color v1.5.4 h1:FZmqs7XOyGgCAxmWyPslpiok1k05wmY3SJTytgvYFs0=
github.com/gookit/color v1.5.4/go.mod h1:pZJOeOS8DM43rXbp4AZo1n9zCU2qjpcRko0b6/QJi9w=
github.com/gorilla/css v1.0.0 h1:BQqNyPTi50JCFMTw/b67hByjMVXZRwGha6wxVGkeihY=
github.com/gorilla/css v1.0.0/go.mod h1:Dn721qIggHpt4+EFCcTLTU/vk5ySda2ReITrtgBl60c=
github.com/gptscript-ai/go-gptscript v0.0.0-20240625134437-4b83849794cc h1:ABV7VAK65YBkqL7VlNp5ryVXnRqkKQ+U/NZfUO3ypqA=
github.com/gptscript-ai/go-gptscript v0.0.0-20240625134437-4b83849794cc/go.mod h1:Dh6vYRAiVcyC3ElZIGzTvNF1FxtYwA07BHfSiFKQY7s=
github.com/gptscript-ai/go-gptscript v0.9.1 h1:O9oSmYvzQ2GZkPfDhXpiMGdtO9BMCVGeWLdJH88AJzg=
github.com/gptscript-ai/go-gptscript v0.9.1/go.mod h1:Dh6vYRAiVcyC3ElZIGzTvNF1FxtYwA07BHfSiFKQY7s=
github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM=
github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg=
github.com/invopop/yaml v0.2.0 h1:7zky/qH+O0DwAyoobXUqvVBwgBFRxKoQ/3FjcVpjTMY=
Expand Down
21 changes: 12 additions & 9 deletions run.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ type RunOptions struct {
AppName string
TrustedRepoPrefixes []string
DisableCache bool
CredentialOverrides []string
Input string
CacheDir string
SubTool string
Expand All @@ -53,6 +54,7 @@ func complete(opts ...RunOptions) (result RunOptions, _ error) {
for _, opt := range opts {
result.TrustedRepoPrefixes = append(result.TrustedRepoPrefixes, opt.TrustedRepoPrefixes...)
result.DisableCache = first(opt.DisableCache, result.DisableCache)
result.CredentialOverrides = append(result.CredentialOverrides, opt.CredentialOverrides...)
result.CacheDir = first(opt.CacheDir, result.CacheDir)
result.SubTool = first(opt.SubTool, result.SubTool)
result.Workspace = first(opt.Workspace, result.Workspace)
Expand Down Expand Up @@ -163,15 +165,16 @@ func Run(ctx context.Context, tool string, opts ...RunOptions) error {
}

run, err := client.Run(localCtx, tool, gptscript.Options{
Confirm: true,
Prompt: true,
IncludeEvents: true,
DisableCache: opt.DisableCache,
Input: firstInput,
CacheDir: opt.CacheDir,
SubTool: opt.SubTool,
Workspace: opt.Workspace,
ChatState: opt.ChatState,
Confirm: true,
Prompt: true,
IncludeEvents: true,
DisableCache: opt.DisableCache,
CredentialOverrides: opt.CredentialOverrides,
Input: firstInput,
CacheDir: opt.CacheDir,
SubTool: opt.SubTool,
Workspace: opt.Workspace,
ChatState: opt.ChatState,
})
if err != nil {
return err
Expand Down