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

Method BlockInfoCommand

pkg/wshrpc/wshserver/wshserver.go:806–834  ·  view source on GitHub ↗
(ctx context.Context, blockId string)

Source from the content-addressed store, hash-verified

804}
805
806func (ws *WshServer) BlockInfoCommand(ctx context.Context, blockId string) (*wshrpc.BlockInfoData, error) {
807 blockData, err := wstore.DBMustGet[*waveobj.Block](ctx, blockId)
808 if err != nil {
809 return nil, fmt.Errorf("error getting block: %w", err)
810 }
811 tabId, err := wstore.DBFindTabForBlockId(ctx, blockId)
812 if err != nil {
813 return nil, fmt.Errorf("error finding tab for block: %w", err)
814 }
815 workspaceId, err := wstore.DBFindWorkspaceForTabId(ctx, tabId)
816 if err != nil {
817 return nil, fmt.Errorf("error finding window for tab: %w", err)
818 }
819 fileList, err := filestore.WFS.ListFiles(ctx, blockId)
820 if err != nil {
821 return nil, fmt.Errorf("error listing blockfiles: %w", err)
822 }
823 var fileInfoList []*wshrpc.WaveFileInfo
824 for _, wf := range fileList {
825 fileInfoList = append(fileInfoList, waveFileToWaveFileInfo(wf))
826 }
827 return &wshrpc.BlockInfoData{
828 BlockId: blockId,
829 TabId: tabId,
830 WorkspaceId: workspaceId,
831 Block: blockData,
832 Files: fileInfoList,
833 }, nil
834}
835
836func (ws *WshServer) DebugTermCommand(ctx context.Context, data wshrpc.CommandDebugTermData) (*wshrpc.CommandDebugTermRtnData, error) {
837 if data.BlockId == "" {

Callers

nothing calls this directly

Calls 5

DBMustGetFunction · 0.92
DBFindTabForBlockIdFunction · 0.92
DBFindWorkspaceForTabIdFunction · 0.92
waveFileToWaveFileInfoFunction · 0.85
ListFilesMethod · 0.80

Tested by

no test coverage detected