Skip to content

chore: add multiline parsing and refactor share cred behavior #867

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
Oct 9, 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
16 changes: 0 additions & 16 deletions integration/cred_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,6 @@ func TestGPTScriptCredential(t *testing.T) {
require.Contains(t, out, "CREDENTIAL")
}

// TestCredentialScopes makes sure that environment variables set by credential tools and shared credential tools
// are only available to the correct tools. See scripts/credscopes.gpt for more details.
func TestCredentialScopes(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

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

nit: comments should be removed too

Copy link
Contributor Author

Choose a reason for hiding this comment

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

how funny. I think I clicked delete in goland so it just deleted the method

out, err := RunScript("scripts/cred_scopes.gpt", "--sub-tool", "oneOne")
require.NoError(t, err)
require.Contains(t, out, "good")

out, err = RunScript("scripts/cred_scopes.gpt", "--sub-tool", "twoOne")
require.NoError(t, err)
require.Contains(t, out, "good")

out, err = RunScript("scripts/cred_scopes.gpt", "--sub-tool", "twoTwo")
require.NoError(t, err)
require.Contains(t, out, "good")
}

// TestCredentialExpirationEnv tests a GPTScript with two credentials that expire at different times.
// One expires after two hours, and the other expires after one hour.
// This test makes sure that the GPTSCRIPT_CREDENTIAL_EXPIRATION environment variable is set to the nearer expiration time (1h).
Expand Down
160 changes: 0 additions & 160 deletions integration/scripts/cred_scopes.gpt

This file was deleted.

1 change: 0 additions & 1 deletion pkg/config/cliconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ func (a *AuthConfig) UnmarshalJSON(data []byte) error {
type CLIConfig struct {
Auths map[string]AuthConfig `json:"auths,omitempty"`
CredentialsStore string `json:"credsStore,omitempty"`
GatewayURL string `json:"gatewayURL,omitempty"`
Integrations map[string]string `json:"integrations,omitempty"`

auths map[string]types.AuthConfig
Expand Down
2 changes: 1 addition & 1 deletion pkg/credentials/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ func validateCredentialCtx(ctxs []string) error {
}

// check alphanumeric
r := regexp.MustCompile("^[a-zA-Z0-9]+$")
r := regexp.MustCompile("^[-a-zA-Z0-9]+$")
for _, c := range ctxs {
if !r.MatchString(c) {
return fmt.Errorf("credential contexts must be alphanumeric")
Expand Down
Loading