MCPcopy Create free account
hub / github.com/Surfer-Org/Protocol / getCodeExamples

Function getCodeExamples

desktop/src/renderer/helpers.ts:41–73  ·  view source on GitHub ↗
(run: any)

Source from the content-addressed store, hash-verified

39};
40
41export const getCodeExamples = async (run: any) => {
42 const fetchGithubFile = async (path: string) => {
43 const response = await fetch(
44 `https://raw.githubusercontent.com/Surfer-Org/Protocol/main/${path}`
45 );
46 return response.text();
47 };
48
49 const claudePath = 'cookbook/python/claude-mcp/README.md';
50 const claudeCode = await fetchGithubFile(claudePath);
51 console.log(claudeCode);
52
53 const dashboardPath = 'cookbook/python/streamlit-chatbot/app.py';
54 const dashboardCode = await fetchGithubFile(dashboardPath);
55
56 const knowledgeGraphPath = 'cookbook/python/knowledge-graph/app.py';
57 const knowledgeGraphCode = await fetchGithubFile(knowledgeGraphPath);
58
59 return {
60 dashboard: {
61 code: dashboardCode,
62 githubUrl: `${GITHUB_BASE_URL}/${dashboardPath}`
63 },
64 knowledge_graph: {
65 code: knowledgeGraphCode,
66 githubUrl: `${GITHUB_BASE_URL}/${knowledgeGraphPath}`
67 },
68 claude: {
69 code: claudeCode,
70 githubUrl: `${GITHUB_BASE_URL}/${claudePath}`
71 }
72 };
73};
74
75export const getLanguageFromFilename = (filename: string): string => {
76 const extension = filename.split('.').pop()?.toLowerCase();

Callers 1

loadCodeExamplesFunction · 0.90

Calls 1

fetchGithubFileFunction · 0.85

Tested by

no test coverage detected