1import { blob } from "https://esm.town/v/std/blob";
2import atproto from "npm:@atproto/api@0.2.10";
3import { chunk } from "npm:lodash-es";
4
226});
227228// --- API Calls ---
229async function fetchIdeas(topic) {
230ideaSelector.innerHTML = '<option>Synthesizing concepts...</option>';
ostpolispambsky.ts1 match
1import { BskyAgent } from "npm:@atproto/api";
23// constants
ostpolispammeteo.ts3 matches
13const ANNEMASSE_LATITUDE = "46.1933";
14const ANNEMASSE_LONGITUDE = "6.2342";
15const METEO_API_VERSION = 1;
16const METEO_API_BASE = `https://api.open-meteo.com/v${METEO_API_VERSION}`;
1718// functions
20export async function getCurrentTemperature(): Promise<number> {
21const resourceUrl =
22`${METEO_API_BASE}/forecast?latitude=47.3769&longitude=8.5417¤t=temperature_2m&timezone=auto`;
23const res = await fetch(resourceUrl);
24validateResponse(res);
formalforgemain.tsx4 matches
47<meta name="viewport" content="width=device-width, initial-scale=1.0">
48<title>The Formal Letter Forge</title>
49<link rel="preconnect" href="https://fonts.googleapis.com">
50<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
51<link href="https://fonts.googleapis.com/css2?family=Lora:wght@400;600&family=Source+Sans+3:wght@400;600;700&display=swap" rel="stylesheet">
52<style>
53:root {
255<script>
256(function() {
257const API_URL = '${sourceUrl}';
258const THEME_KEY = 'formal_forge_theme';
259let commandPaletteItems = [];
422try {
423updateStatus('Initiating Process...', 'Sending context to strategists.');
424const response = await fetch(\`\${API_URL}?action=forge\`, {
425method: 'POST',
426headers: { 'Content-Type': 'application/json' },
ostpolispamutils.ts1 match
1export function validateResponse(res: Response): void {
2if (!res.ok) throw new Error(`api error: ${res.status}: ${res.statusText}`);
3if (res.status < 200 || res.status >= 300)
4throw new Error(`Unexpected status code: ${res.status}: ${res.statusText}`);
ProposalHandler.cursorrules10 matches
13- Generate code in TypeScript or TSX
14- Add appropriate TypeScript types and interfaces for all data structures
15- Prefer official SDKs or libraries than writing API calls directly
16- Ask the user to supply API or library documentation if you are at all unsure about it
17- **Never bake in secrets into the code** - always use environment variables
18- Include comments explaining complex logic (avoid commenting obvious operations)
23### 1. HTTP Trigger
2425- Create web APIs and endpoints
26- Handle HTTP requests and responses
27- Example structure:
173However, it's *extremely importing* to note that `parseProject` and other Standard Library utilities ONLY RUN ON THE SERVER.
174If you need access to this data on the client, run it in the server and pass it to the client by splicing it into the HTML page
175or by making an API request for it.
176177## Val Town Platform Specifics
181- **AI Image:** To inline generate an AI image use: `<img src="https://maxm-imggenurl.web.val.run/the-description-of-your-image" />`
182- **Storage:** DO NOT use the Deno KV module for storage
183- **Browser APIs:** DO NOT use the `alert()`, `prompt()`, or `confirm()` methods
184- **Weather Data:** Use open-meteo for weather data (doesn't require API keys) unless otherwise specified
185- **View Source:** Add a view source link by importing & using `import.meta.url.replace("ems.sh", "val.town)"` (or passing this data to the client) and include `target="_top"` attribute
186- **Error Debugging:** Add `<script src="https://esm.town/v/std/catch"></script>` to HTML to capture client-side errors
187- **Error Handling:** Only use try...catch when there's a clear local resolution; Avoid catches that merely log or return 500s. Let errors bubble up with full context
188- **Environment Variables:** Use `Deno.env.get('keyname')` when you need to, but generally prefer APIs that don't require keys
189- **Imports:** Use `https://esm.sh` for npm and Deno dependencies to ensure compatibility on server and browser
190- **Storage Strategy:** Only use backend storage if explicitly required; prefer simple static client-side sites
224### Backend (Hono) Best Practices
225226- Hono is the recommended API framework
227- Main entry point should be `backend/index.ts`
228- **Static asset serving:** Use the utility functions to read and serve project files:
248});
249```
250- Create RESTful API routes for CRUD operations
251- Always include this snippet at the top-level Hono app to re-throwing errors to see full stack traces:
252```ts
285- For files in the project, use `readFile` helpers
2862875. **API Design:**
288- `fetch` handler is the entry point for HTTP vals
289- Run the Hono app with `export default app.fetch // This is the entry point for HTTP vals`
github-apiIssueViewer.tsx1 match
44try {
45const response = await fetch(
46`/api/issues/${issue.number}/content?owner=${repoOwner}&repo=${repoName}`,
47{
48headers: {
23<newFunctionality>
4Declared in: https://esm.town/v/cricks_unmixed4u/github-api/api/index.tsx?v=30 onwards
56```tsx
85- Generate code in TypeScript or TSX
86- Add appropriate TypeScript types and interfaces for all data structures
87- Prefer official SDKs or libraries than writing API calls directly
88- Ask the user to supply API or library documentation if you are at all unsure about it
89- **Never bake in secrets into the code** - always use environment variables
90- Include comments explaining complex logic (avoid commenting obvious operations)
95### 1. HTTP Trigger
9697- Create web APIs and endpoints
98- Handle HTTP requests and responses
99- Example structure:
245However, it's *extremely importing* to note that `parseProject` and other Standard Library utilities ONLY RUN ON THE SERVER.
246If you need access to this data on the client, run it in the server and pass it to the client by splicing it into the HTML page
247or by making an API request for it.
248249## Val Town Platform Specifics
253- **AI Image:** To inline generate an AI image use: `<img src="https://maxm-imggenurl.web.val.run/the-description-of-your-image" />`
254- **Storage:** DO NOT use the Deno KV module for storage
255- **Browser APIs:** DO NOT use the `alert()`, `prompt()`, or `confirm()` methods
256- **Weather Data:** Use open-meteo for weather data (doesn't require API keys) unless otherwise specified
257- **View Source:** Add a view source link by importing & using `import.meta.url.replace("ems.sh", "val.town)"` (or passing this data to the client) and include `target="_top"` attribute
258- **Error Debugging:** Add `<script src="https://esm.town/v/std/catch"></script>` to HTML to capture client-side errors
259- **Error Handling:** Only use try...catch when there's a clear local resolution; Avoid catches that merely log or return 500s. Let errors bubble up with full context
260- **Environment Variables:** Use `Deno.env.get('keyname')` when you need to, but generally prefer APIs that don't require keys
261- **Imports:** Use `https://esm.sh` for npm and Deno dependencies to ensure compatibility on server and browser
262- **Storage Strategy:** Only use backend storage if explicitly required; prefer simple static client-side sites
296### Backend (Hono) Best Practices
297298- Hono is the recommended API framework
299- Main entry point should be `backend/index.ts`
300- **Static asset serving:** Use the utility functions to read and serve project files:
320});
321```
322- Create RESTful API routes for CRUD operations
323- Always include this snippet at the top-level Hono app to re-throwing errors to see full stack traces:
324```ts
357- For files in the project, use `readFile` helpers
3583595. **API Design:**
360- `fetch` handler is the entry point for HTTP vals
361- Run the Hono app with `export default app.fetch // This is the entry point for HTTP vals`
369- Import `https://www.val.town/x/cricks_unmixed4u/logger/code/logger/main.tsx` and use `logInfo`, `logError` or `logDebug`.
370371# Next Step 1 - Export a new function from api
372373The new function should return the relevant content of a given issue in markdown format.
github-apillm12 matches
23<newFunctionality>
4Declared in: https://esm.town/v/cricks_unmixed4u/github-api/api/index.tsx?v=30 onwards
56```tsx
85- Generate code in TypeScript or TSX
86- Add appropriate TypeScript types and interfaces for all data structures
87- Prefer official SDKs or libraries than writing API calls directly
88- Ask the user to supply API or library documentation if you are at all unsure about it
89- **Never bake in secrets into the code** - always use environment variables
90- Include comments explaining complex logic (avoid commenting obvious operations)
95### 1. HTTP Trigger
9697- Create web APIs and endpoints
98- Handle HTTP requests and responses
99- Example structure:
245However, it's *extremely importing* to note that `parseProject` and other Standard Library utilities ONLY RUN ON THE SERVER.
246If you need access to this data on the client, run it in the server and pass it to the client by splicing it into the HTML page
247or by making an API request for it.
248249## Val Town Platform Specifics
253- **AI Image:** To inline generate an AI image use: `<img src="https://maxm-imggenurl.web.val.run/the-description-of-your-image" />`
254- **Storage:** DO NOT use the Deno KV module for storage
255- **Browser APIs:** DO NOT use the `alert()`, `prompt()`, or `confirm()` methods
256- **Weather Data:** Use open-meteo for weather data (doesn't require API keys) unless otherwise specified
257- **View Source:** Add a view source link by importing & using `import.meta.url.replace("ems.sh", "val.town)"` (or passing this data to the client) and include `target="_top"` attribute
258- **Error Debugging:** Add `<script src="https://esm.town/v/std/catch"></script>` to HTML to capture client-side errors
259- **Error Handling:** Only use try...catch when there's a clear local resolution; Avoid catches that merely log or return 500s. Let errors bubble up with full context
260- **Environment Variables:** Use `Deno.env.get('keyname')` when you need to, but generally prefer APIs that don't require keys
261- **Imports:** Use `https://esm.sh` for npm and Deno dependencies to ensure compatibility on server and browser
262- **Storage Strategy:** Only use backend storage if explicitly required; prefer simple static client-side sites
296### Backend (Hono) Best Practices
297298- Hono is the recommended API framework
299- Main entry point should be `backend/index.ts`
300- **Static asset serving:** Use the utility functions to read and serve project files:
320});
321```
322- Create RESTful API routes for CRUD operations
323- Always include this snippet at the top-level Hono app to re-throwing errors to see full stack traces:
324```ts
357- For files in the project, use `readFile` helpers
3583595. **API Design:**
360- `fetch` handler is the entry point for HTTP vals
361- Run the Hono app with `export default app.fetch // This is the entry point for HTTP vals`
369- Import `https://www.val.town/x/cricks_unmixed4u/logger/code/logger/main.tsx` and use `logInfo`, `logError` or `logDebug`.
370371# Next Step 1 - Export a new function from api
372373The new function should return the relevant content of a given issue in markdown format.