Skip to content

Commit 8e19a2a

Browse files
rounak610czeziTarannJotbhokaremoinjedan2506
authored
Support for frontend stories (#59)
Support for frontend stories --------- Co-authored-by: Sasikanth L <[email protected]> Co-authored-by: TarannJot <[email protected]> Co-authored-by: bhokaremoin <[email protected]> Co-authored-by: bhokaremoin <[email protected]> Co-authored-by: parthpathak <[email protected]> Co-authored-by: Fluder-Paradyne <[email protected]>
1 parent 82e22fd commit 8e19a2a

File tree

166 files changed

+5906
-606
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

166 files changed

+5906
-606
lines changed

Dockerfile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@ FROM public.ecr.aws/docker/library/golang:1.22.3-bookworm AS build-base
22

33
RUN apt-get update && apt-get install -y jq postgresql-client && apt-get clean && rm -rf /var/lib/apt/lists/*
44

5+
RUN groupadd -g 1000 coder
6+
RUN useradd -u 1000 -g coder coder
7+
RUN usermod -aG sudo coder
8+
RUN echo 'coder ALL=NOPASSWD: ALL' >> /etc/sudoers
9+
10+
USER coder
11+
WORKDIR /home/coder
12+
13+
RUN git config --global --add safe.directory /workspaces
14+
RUN git config --global user.email "[email protected]"
15+
RUN git config --global user.name "SuperCoder"
16+
517
WORKDIR $GOPATH/src/packages/ai-developer/
618

719
COPY go.mod .
@@ -51,6 +63,9 @@ ENTRYPOINT ["go", "run", "worker.go"]
5163

5264
FROM superagidev/supercoder-python-ide:latest AS python-executor
5365

66+
WORKDIR /home/coder
67+
68+
RUN git config --global --add safe.directory /workspaces
5469
RUN git config --global user.email "[email protected]"
5570
RUN git config --global user.name "SuperCoder"
5671

@@ -65,6 +80,11 @@ ENTRYPOINT ["bash", "-c", "/entrypoint.d/initialise.sh && /go/executor"]
6580

6681
FROM superagidev/supercoder-node-ide:latest AS node-executor
6782

83+
USER coder
84+
85+
WORKDIR /home/coder
86+
87+
RUN git config --global --add safe.directory /workspaces
6888
RUN git config --global user.email "[email protected]"
6989
RUN git config --global user.name "SuperCoder"
7090

@@ -83,6 +103,11 @@ RUN apt-get update && \
83103
apt-get install -y git zip \
84104
&& apt-get clean
85105

106+
RUN useradd -m coder
107+
108+
USER coder
109+
110+
RUN git config --global --add safe.directory /workspaces
86111
RUN git config --global user.email "[email protected]"
87112
RUN git config --global user.name "SuperCoder"
88113

app/client/workspace/workspace_service.go

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,45 @@ func (ws *WorkspaceServiceClient) CreateWorkspace(createWorkspaceRequest *reques
6767
return
6868
}
6969

70+
func (ws *WorkspaceServiceClient) CreateFrontendWorkspace(createWorkspaceRequest *request.CreateWorkspaceRequest) (createWorkspaceResponse *response.CreateWorkspaceResponse, err error) {
71+
payload, err := json.Marshal(createWorkspaceRequest)
72+
if err != nil {
73+
log.Printf("failed to marshal create workspace request: %v", err)
74+
return
75+
}
76+
req, err := http.NewRequest("POST", fmt.Sprintf("%s/api/v1/frontend/workspaces", ws.endpoint), bytes.NewBuffer(payload))
77+
if err != nil {
78+
log.Printf("failed to create create workspace request: %v", err)
79+
return
80+
}
81+
res, err := ws.client.Do(req)
82+
if err != nil {
83+
log.Printf("failed to send create workspace request: %v", err)
84+
return
85+
}
86+
87+
if res.StatusCode < 200 || res.StatusCode > 299 {
88+
return nil, errors.New(fmt.Sprintf("invalid res from workspace service for create workspace request"))
89+
}
90+
91+
defer func(Body io.ReadCloser) {
92+
_ = Body.Close()
93+
}(res.Body)
94+
95+
responseBody, err := io.ReadAll(res.Body)
96+
if err != nil {
97+
log.Printf("failed to read res payload: %v", err)
98+
return
99+
}
100+
101+
createWorkspaceResponse = &response.CreateWorkspaceResponse{}
102+
if err1 := json.Unmarshal(responseBody, &createWorkspaceResponse); err1 != nil {
103+
log.Printf("failed to unmarshal create workspace res: %v", err1)
104+
return
105+
}
106+
return
107+
}
108+
70109
func (ws *WorkspaceServiceClient) DeleteWorkspace(workspaceId string) (err error) {
71110
req, err := http.NewRequest("DELETE", fmt.Sprintf("%s/api/v1/workspaces/%s", ws.endpoint, workspaceId), nil)
72111
if err != nil {

app/config/frontend_workspace.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package config
2+
3+
import "fmt"
4+
import "path/filepath"
5+
6+
func FrontendWorkspacePath(projectHashID string, storyHashId string) string{
7+
output := filepath.Join(WorkspaceWorkingDirectory(), projectHashID, "frontend" , ".stories" , storyHashId)
8+
fmt.Println("___frontend workspace____",output)
9+
return output
10+
}

app/config/model.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
package config
22

33
func OpenAIAPIKey() string { return config.String("openai.api.key") }
4+
5+
func ClaudeAPIKey() string { return config.String("claude.api.key") }

app/config/s3_config.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package config
2+
3+
func AWSAccessKeyID() string { return config.String("aws.access.key.id") }
4+
5+
func AWSSecretAccessKey() string { return config.String("aws.secret.access.key") }
6+
7+
func AWSBucketName() string { return config.String("aws.bucket.name") }
8+
9+
func AWSRegion() string { return config.String("aws.region") }

app/config/workspace_config.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
package config
22

33
func WorkspaceWorkingDirectory() string { return config.String("workspace.working.dir") }
4+
func WorkspaceStaticFrontendUrl() string { return config.String("workspace.static.frontend.url") }

app/constants/models.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ const (
44
GPT_4O = "gpt-4o"
55
GPT_3_5_Turbo = "gpt-3.5-turbo"
66
GPT_3_5 = "gpt-3.5"
7+
CLAUDE_3 = "claude-3"
78
)

app/constants/pr_type.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package constants
2+
3+
const (
4+
Automated = "automated"
5+
Manual = "manual"
6+
)

app/constants/project_workflows.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package constants
2+
3+
const (
4+
Flask = "flask"
5+
NextJs = "nextjs"
6+
)

app/constants/story_type.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package constants
2+
3+
const (
4+
Backend = "backend"
5+
Frontend = "frontend"
6+
)

0 commit comments

Comments
 (0)