MCPcopy Create free account
hub / github.com/altic-dev/Pilot / selectFile

Function selectFile

src/components/file-browser.tsx:73–90  ·  view source on GitHub ↗
(filePath: string)

Source from the content-addressed store, hash-verified

71 };
72
73 const selectFile = async (filePath: string) => {
74 setSelectedFile(filePath);
75
76 try {
77 const response = await fetch(
78 `/api/container/${sessionId}/file-content?path=${encodeURIComponent(filePath)}`
79 );
80
81 if (!response.ok) {
82 throw new Error("Failed to load file");
83 }
84
85 const content = await response.text();
86 setFileContent(content);
87 } catch (err) {
88 setFileContent(`Error: ${err instanceof Error ? err.message : "Failed to load file"}`);
89 }
90 };
91
92 const renderTree = (parentPath: string, level: number = 0): React.JSX.Element[] => {
93 const children = files.filter((f) => {

Callers 1

renderTreeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected