MCPcopy
hub / github.com/wavetermdev/waveterm / WriteAppGoFileCommand

Method WriteAppGoFileCommand

pkg/wshrpc/wshserver/wshserver.go:1088–1106  ·  view source on GitHub ↗
(ctx context.Context, data wshrpc.CommandWriteAppGoFileData)

Source from the content-addressed store, hash-verified

1086}
1087
1088func (ws *WshServer) WriteAppGoFileCommand(ctx context.Context, data wshrpc.CommandWriteAppGoFileData) (*wshrpc.CommandWriteAppGoFileRtnData, error) {
1089 if data.AppId == "" {
1090 return nil, fmt.Errorf("must provide an appId to WriteAppGoFileCommand")
1091 }
1092 contents, err := base64.StdEncoding.DecodeString(data.Data64)
1093 if err != nil {
1094 return nil, fmt.Errorf("failed to decode data64: %w", err)
1095 }
1096
1097 formattedOutput := waveapputil.FormatGoCode(contents)
1098
1099 err = waveappstore.WriteAppFile(data.AppId, "app.go", formattedOutput)
1100 if err != nil {
1101 return nil, err
1102 }
1103
1104 encoded := base64.StdEncoding.EncodeToString(formattedOutput)
1105 return &wshrpc.CommandWriteAppGoFileRtnData{Data64: encoded}, nil
1106}
1107
1108func (ws *WshServer) DeleteAppFileCommand(ctx context.Context, data wshrpc.CommandDeleteAppFileData) error {
1109 if data.AppId == "" {

Callers

nothing calls this directly

Calls 2

FormatGoCodeFunction · 0.92
WriteAppFileFunction · 0.92

Tested by

no test coverage detected