This repository was archived by the owner on Jan 23, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Add cli changes for new io auth config #226
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,22 +36,33 @@ Use the subcommands to manage your projects.`, | |
| }, | ||
| } | ||
|
|
||
| func saveEnv(dir string, apikey string) { | ||
| func saveEnv(dir string, apikey string, agentsKey string) { | ||
| filename := filepath.Join(dir, ".env") | ||
| envLines, err := env.ParseEnvFile(filename) | ||
| if err != nil { | ||
| errsystem.New(errsystem.ErrReadConfigurationFile, err, errsystem.WithContextMessage("Failed to parse .env file")).ShowErrorAndExit() | ||
| } | ||
| var found bool | ||
| var found map[string]bool = map[string]bool{ | ||
| "AGENTUITY_API_KEY": false, | ||
| "AGENTUITY_AGENTS_KEY": false, | ||
| } | ||
|
|
||
| for i, envLine := range envLines { | ||
| if envLine.Key == "AGENTUITY_API_KEY" { | ||
| envLines[i].Val = apikey | ||
| found = true | ||
| found["AGENTUITY_API_KEY"] = true | ||
| } | ||
| if envLine.Key == "AGENTUITY_AGENTS_KEY" { | ||
| envLines[i].Val = apikey | ||
| found["AGENTUITY_AGENTS_KEY"] = true | ||
| } | ||
| } | ||
| if !found { | ||
| if !found["AGENTUITY_API_KEY"] { | ||
| envLines = append(envLines, env.EnvLine{Key: "AGENTUITY_API_KEY", Val: apikey}) | ||
| } | ||
| if !found["AGENTUITY_AGENTS_KEY"] { | ||
| envLines = append(envLines, env.EnvLine{Key: "AGENTUITY_AGENTS_KEY", Val: apikey}) | ||
| } | ||
| if err := env.WriteEnvFile(filename, envLines); err != nil { | ||
| errsystem.New(errsystem.ErrWriteConfigurationFile, err, errsystem.WithContextMessage("Failed to write .env file")).ShowErrorAndExit() | ||
| } | ||
|
|
@@ -65,6 +76,7 @@ type InitProjectArgs struct { | |
| Name string | ||
| Description string | ||
| EnableWebhookAuth bool | ||
| AuthType string | ||
| Provider *templates.TemplateRules | ||
| Agents []project.AgentConfig | ||
| } | ||
|
|
@@ -78,6 +90,7 @@ func initProject(ctx context.Context, logger logger.Logger, args InitProjectArgs | |
| Name: args.Name, | ||
| Description: args.Description, | ||
| EnableWebhookAuth: args.EnableWebhookAuth, | ||
| AuthType: args.AuthType, | ||
| Dir: args.Dir, | ||
| Provider: args.Provider.Identifier, | ||
| Agents: args.Agents, | ||
|
|
@@ -126,7 +139,7 @@ func initProject(ctx context.Context, logger logger.Logger, args InitProjectArgs | |
| errsystem.New(errsystem.ErrSaveProject, err, errsystem.WithContextMessage("Failed to save project to disk")).ShowErrorAndExit() | ||
| } | ||
|
|
||
| saveEnv(args.Dir, result.APIKey) | ||
| saveEnv(args.Dir, result.APIKey, result.AgentsKey) | ||
|
|
||
| return result | ||
| } | ||
|
|
@@ -540,7 +553,8 @@ Examples: | |
| Description: description, | ||
| Provider: rules, | ||
| Agents: agents, | ||
| EnableWebhookAuth: authType != "none", | ||
| EnableWebhookAuth: authType == "project" || authType == "agent", | ||
| AuthType: authType, | ||
| }) | ||
|
|
||
| // remember our choices | ||
|
|
@@ -562,7 +576,7 @@ Examples: | |
| para = append(para, tui.Secondary("1. Switch into the project directory at ")+tui.Directory(projectDir)) | ||
| para = append(para, tui.Secondary("2. Run ")+tui.Command("dev")+tui.Secondary(" to run the project locally in development mode")) | ||
| para = append(para, tui.Secondary("3. Run ")+tui.Command("deploy")+tui.Secondary(" to deploy the project to the Agentuity Agent Cloud")) | ||
| if authType != "none" { | ||
| if authType == "project" || authType == "agent" { | ||
| para = append(para, tui.Secondary("4. Run ")+tui.Command("agent apikey")+tui.Secondary(" to fetch the Webhook API key for the agent")) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. will have to also update this command probably? |
||
| } | ||
| para = append(para, tui.Secondary("🏠 Access your project at ")+tui.Link("%s/projects/%s", appUrl, projectData.ProjectId)) | ||
|
|
@@ -811,6 +825,6 @@ func init() { | |
| projectNewCmd.Flags().StringP("template", "t", "", "The template to use for the project") | ||
| projectNewCmd.Flags().Bool("force", false, "Force the project to be created even if the directory already exists") | ||
| projectNewCmd.Flags().String("templates-dir", "", "The directory to load the templates. Defaults to loading them from the github.com/agentuity/templates repository") | ||
| projectNewCmd.Flags().String("auth", "bearer", "The authentication type for the agent (bearer or none)") | ||
| projectNewCmd.Flags().String("auth", "project", "The authentication type for the agent (project, agent, or none)") | ||
| projectNewCmd.Flags().String("action", "github-app", "The action to take for the project (github-action, github-app, none)") | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think we want
AGENTUITY_SDK_KEY