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

Function generateBuilderAppData

pkg/aiusechat/usechat.go:846–884  ·  view source on GitHub ↗
(appId string)

Source from the content-addressed store, hash-verified

844}
845
846func generateBuilderAppData(appId string) (string, string, string, error) {
847 appGoFile := ""
848 fileData, err := waveappstore.ReadAppFile(appId, "app.go")
849 if err == nil {
850 appGoFile = string(fileData.Contents)
851 }
852
853 staticFilesJSON := ""
854 allFiles, err := waveappstore.ListAllAppFiles(appId)
855 if err == nil {
856 var staticFiles []StaticFileInfo
857 for _, entry := range allFiles.Entries {
858 if strings.HasPrefix(entry.Name, "static/") {
859 staticFiles = append(staticFiles, StaticFileInfo{
860 Name: entry.Name,
861 Size: entry.Size,
862 Modified: entry.Modified,
863 ModifiedTime: entry.ModifiedTime,
864 })
865 }
866 }
867
868 if len(staticFiles) > 0 {
869 staticFilesBytes, marshalErr := json.Marshal(staticFiles)
870 if marshalErr == nil {
871 staticFilesJSON = string(staticFilesBytes)
872 }
873 }
874 }
875
876 platformInfo := wavebase.GetSystemSummary()
877 if currentUser, userErr := user.Current(); userErr == nil && currentUser.Username != "" {
878 platformInfo = fmt.Sprintf("Local Machine: %s, User: %s", platformInfo, currentUser.Username)
879 } else {
880 platformInfo = fmt.Sprintf("Local Machine: %s", platformInfo)
881 }
882
883 return appGoFile, staticFilesJSON, platformInfo, nil
884}

Callers 1

WaveAIPostMessageHandlerFunction · 0.85

Calls 3

ReadAppFileFunction · 0.92
ListAllAppFilesFunction · 0.92
GetSystemSummaryFunction · 0.92

Tested by

no test coverage detected