Val Town Code SearchReturn to Val Town

API Access

You can access search results via JSON API by adding format=json to your query:

https://codesearch.val.run/$2?q=fetch&page=19&format=json

For typeahead suggestions, use the /typeahead endpoint:

https://codesearch.val.run/typeahead?q=fetch

Returns an array of strings in format "username" or "username/projectName"

Found 13188 results for "fetch"(1364ms)

Townietext-editor.ts1 match

@claudiaowusu•Updated 1 day ago
166 let type_: "file" | "http" | "script";
167 if (path.includes("backend/index.ts")) type_ = "http";
168 if (file_text?.includes("export default app.fetch")) type_ = "http";
169 if ([".ts", ".tsx", ".js", ".jsx"].some(ext => path.endsWith(ext))) {
170 type_ = "script";

Towniesystem_prompt.txt3 matches

@claudiaowusu•Updated 1 day ago
216
217 // Inject data to avoid extra round-trips
218 const initialData = await fetchInitialData();
219 const dataScript = `<script>
220 window.__INITIAL_DATA__ = ${JSON.stringify(initialData)};
263
2645. **API Design:**
265 - `fetch` handler is the entry point for HTTP vals
266 - Run the Hono app with `export default app.fetch // This is the entry point for HTTP vals`
267
2686. **Hono Peculiarities:**

Towniestyles.css9 matches

@claudiaowusu•Updated 1 day ago
1/** fetch tool styles */
2.fetch-result {
3 display: flex;
4 flex-direction: column;
6}
7
8.fetch-header {
9 display: flex;
10 justify-content: space-between;
45}
46
47.fetch-section {
48 margin-top: var(--space-2);
49}
50
51.fetch-section h4 {
52 margin-bottom: var(--space-1);
53 font-size: var(--font-size-5);
54}
55
56.fetch-headers, .fetch-body {
57 font-size: var(--font-size-6);
58 background-color: var(--slate-50);
63}
64
65.fetch-error {
66 color: var(--red);
67}
68
69.fetch-error h4 {
70 margin-bottom: var(--space-1);
71 font-size: var(--font-size-5);
72}
73
74.fetch-error pre {
75 font-size: var(--font-size-6);
76 background-color: var(--red-light);

Towniesend-message.ts5 matches

@claudiaowusu•Updated 1 day ago
13 startTrackingUsage,
14} from "../database/queries.tsx";
15import { makeChangeValTypeTool, makeFetchTool, makeTextEditorTool } from "../tools/index.ts";
16import fileWithLinesNumbers from "../utils/fileWithLinesNumbers.ts";
17
161 }
162
163 // If there are selected files, fetch their content and add them to the messages
164 if (selectedFiles && selectedFiles.length > 0) {
165 const vt = new ValTown({ bearerToken });
181 fileContents += `## File: ${filePath}\n\`\`\`\n${fileWithLinesNumbers(content)}\n\`\`\`\n\n`;
182 } catch (error) {
183 console.error(`Error fetching file ${filePath}:`, error);
184 fileContents += `## File: ${filePath}\nError: Could not fetch file content\n\n`;
185 }
186 }
225 // think: thinkTool,
226 change_val_type: makeChangeValTypeTool({ bearerToken, project, branch_id: branchId }),
227 fetch: makeFetchTool({ bearerToken, project, branch_id: branchId }),
228 },
229 maxSteps: 20,

Townierequests.ts2 matches

@claudiaowusu•Updated 1 day ago
56 row.parentNode.insertBefore(newRow, row.nextSibling);
57
58 // Fetch the inference calls data
59 fetch('/api/inference-calls?usage_id=' + usageId)
60 .then(response => response.json())
61 .then(data => {

TownieREADME.md1 match

@claudiaowusu•Updated 1 day ago
8
9- **AI-Assisted Editing**: Chat with Claude 4 Sonnet about your code and let it make changes directly to your project files
10- **Fetch tool**: Townie is able to make HTTP calls to your HTTP services to test them and continue iterating
11- **Branch Management**: View, select, and create branches without leaving the app
12- **Sound Notifications**: Get alerted when Claude finishes responding

Townieproject-files.ts2 matches

@claudiaowusu•Updated 1 day ago
30 return c.json({ files: files.data });
31 } catch (error) {
32 console.error("Error fetching project files:", error);
33 return Response.json({ error: "Failed to fetch project files" }, { status: 500 });
34 }
35});

Townieproject-branches.ts2 matches

@claudiaowusu•Updated 1 day ago
21 return c.json({ branches: branches.data });
22 } catch (error) {
23 console.error("Error fetching branches:", error);
24 return Response.json({ error: "Failed to fetch branches" }, { status: 500 });
25 }
26});
19solution that changes as little code as possible.
20
21Use your 'fetch' tool to debug HTTP vals making requests to them and examining the responses.

TownieMessages.tsx9 matches

@claudiaowusu•Updated 1 day ago
219 </>
220 );
221 case "fetch":
222 return (
223 <Details
232 summary={(
233 <>
234 <div>fetch:</div>
235 <div>{args?.valPath}</div>
236 <div>{args?.urlPath || "/"}</div>
238 )}>
239 {result?.type === "success" ? (
240 <div className="fetch-result">
241 <div className="fetch-header">
242 <span className={`status-badge ${result.data.status >= 200 && result.data.status < 300 ? 'success' :
243 result.data.status >= 300 && result.data.status < 400 ? 'redirect' :
247 <span className="response-time">{result.data.responseTime}ms</span>
248 </div>
249 <div className="fetch-section">
250 <h4>Headers</h4>
251 <pre className="fetch-headers">{JSON.stringify(result.data.headers, null, 2)}</pre>
252 </div>
253 <div className="fetch-section">
254 <h4>Response Body</h4>
255 <pre className="fetch-body">
256 {typeof result.data.body === 'object'
257 ? JSON.stringify(result.data.body, null, 2)
261 </div>
262 ) : (
263 <div className="fetch-error">
264 <h4>Error</h4>
265 <pre>{result?.message || "Unknown error"}</pre>

proxiedfetch1 file match

@jayden•Updated 12 hours ago

fetch-socials4 file matches

@welson•Updated 4 days ago
fetch and archive my social posts