Skip to content

Open source AI coding agent. Designed for large projects and real world tasks.

more infra work, require OPENAI_API_KEY env var in CLI, pass to server in tell request body

Dane Schneider216bc0539f74
diff --git a/app/cli/cmd/continue.go b/app/cli/cmd/continue.go
index 327296c5..469f16dd 100644
--- a/app/cli/cmd/continue.go
+++ b/app/cli/cmd/continue.go
@@ -34,6 +34,11 @@ func init() {
}
func next(cmd *cobra.Command, args []string) {
+ if os.Getenv("OPENAI_API_KEY") == "" {
+ term.OutputNoApiKeyMsg()
+ os.Exit(1)
+ }
+
auth.MustResolveAuthWithOrg()
lib.MustResolveProject()
lib.MustCheckOutdatedContextWithOutput()
@@ -59,6 +64,7 @@ func next(cmd *cobra.Command, args []string) {
apiErr := api.Client.TellPlan(lib.CurrentPlanId, lib.CurrentBranch, shared.TellPlanRequest{
Prompt: continuePrompt,
ConnectStream: !continueBg,
+ ApiKey: os.Getenv("OPENAI_API_KEY"),
}, lib.OnStreamPlan)
if apiErr != nil {
log.Println("Error telling plan:", apiErr)
diff --git a/app/cli/cmd/tell.go b/app/cli/cmd/tell.go
index 6e5a6de7..b75ee9dc 100644
--- a/app/cli/cmd/tell.go
+++ b/app/cli/cmd/tell.go
@@ -41,6 +41,11 @@ func init() {
}
func tell(cmd *cobra.Command, args []string) {
+ if os.Getenv("OPENAI_API_KEY") == "" {
+ term.OutputNoApiKeyMsg()
+ os.Exit(1)
+ }
+
auth.MustResolveAuthWithOrg()
lib.MustResolveProject()
@@ -145,6 +150,7 @@ func tell(cmd *cobra.Command, args []string) {
Prompt: prompt,
ConnectStream: !tellBg,
AutoContinue: !tellStep,
+ ApiKey: os.Getenv("OPENAI_API_KEY"),
}, lib.OnStreamPlan)
if apiErr != nil {
if apiErr.Type == shared.ApiErrorTypeTrialMessagesExceeded {
diff --git a/app/cli/term/errors.go b/app/cli/term/errors.go
new file mode 100644
index 00000000..eb84e66b
--- /dev/null
+++ b/app/cli/term/errors.go
@@ -0,0 +1,12 @@
+package term
+
+import (
+ "fmt"
+ "os"
+
+ "github.com/fatih/color"
+)
+
+func OutputNoApiKeyMsg() {
+ fmt.Fprintln(os.Stderr, color.New(color.Bold, color.FgHiRed).Sprintln("\n🚨 OPENAI_API_KEY environment variable is not set.")+color.New().Sprintln("\nSet it with:\n\nexport OPENAI_API_KEY=...\n\nThen try again.\n\nπŸ‘‰ If you don't have an OpenAI account, sign up here β†’ https://platform.openai.com/signup\n\nπŸ”‘ Generate an api key here β†’ https://platform.openai.com/api-keys"))
+}
diff --git a/infra/ecs-container-definitions.json b/infra/ecs-container-definitions.json
deleted file mode 100644
index 4507cb1a..00000000
--- a/infra/ecs-container-definitions.json
+++ /dev/null
@@ -1,36 +0,0 @@
-[
- {
- "name": "plandex-server",
- "image": "590183677625.dkr.ecr.us-east-1.amazonaws.com/plandex-ecr-repository:97fb9e6",
- "cpu": 256,
- "memory": 512,
- "essential": true,
- "portMappings": [
- {
- "containerPort": 80,
- "hostPort": 80
- }
- ],
- "environment": [
- {
- "name": "ECS_CONTAINER_STOP_TIMEOUT",
- "value": "60m"
- }
- ],
- "mountPoints": [
- {
- "sourceVolume": "plandex-efs-volume",
- "containerPath": "/plandex-server",
- "readOnly": false
- }
- ],
- "logConfiguration": {
- "logDriver": "awslogs",
- "options": {
- "awslogs-group": "/ecs/plandex-server",
- "awslogs-region": "us-east-1",
- "awslogs-stream-prefix": "ecs"
- }
- }
- }
-]