Code that uses await here for a synchronous call:
export class MyDurableObject extends DurableObject {
async query() {
const rows = await this.ctx.storage.sql.exec("select 1");
return rows;
}
}Code that uses await here for a synchronous call:
export class MyDurableObject extends DurableObject {
async query() {
const rows = await this.ctx.storage.sql.exec("select 1");
return rows;
}
}Example CLI using @clack/prompts that outputs a machine-readable YAML schema when --help is invoked in a non-TTY context.
Context: https://x.com/elithrar/status/2008657921593536771
bun install
bun kv-cli.ts --help | cat # YAML schema
bun kv-cli.ts # interactive mode🗣️ this is a useful guide to help you memorize + better understand how Jujutsu works, but it's not a replacement for learning the mental model or deeper strategies!
@ — a symbol pointing to the current working copy change (like HEAD, but for changes)@- — the parent of @| /** | |
| * Cross-Repo Tool for OpenCode | |
| * | |
| * Enables operations on GitHub repositories other than the current working repository. | |
| * Useful for coordinated changes across multiple repos, updating related repos, | |
| * or opening PRs in different repositories. | |
| * | |
| * ## Security Model | |
| * | |
| * Authentication is context-aware: |
Instructions for AI coding agents working in this repository.
| import { Agent, AgentNamespace, routeAgentRequest } from 'agents'; | |
| import { GoogleGenerativeAI, HarmCategory, HarmBlockThreshold } from '@google/generative-ai'; | |
| // Define the environment variables and bindings required by the Worker and Agent | |
| interface Env { | |
| // Binding for the Agent Durable Object | |
| SECURITY_AUDIT_AGENT: AgentNamespace<SecurityAuditAgent>; | |
| // Secret holding the Google Gemini API Key | |
| GEMINI_API_KEY: string; | |
| // Optional: Secret holding a GitHub API token for higher rate limits / private repos |
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Simple Cloudflare Agent Chat</title> | |
| <style> | |
| body { | |
| font-family: Arial, sans-serif; | |
| max-width: 800px; |
| { | |
| "$schema": "https://zed.dev/schema/themes/v0.1.0.json", | |
| "name": "Hypersubatomic", | |
| "author": "Converted from VSCode theme", | |
| "themes": [ | |
| { | |
| "name": "Hypersubatomic Dark", | |
| "appearance": "dark", | |
| "style": { | |
| "background": "#0F111A", |
| import { Solicitud, Respuesta, ContextoDeEjecucion, Entorno, Prometo, URL } from "./workers.es"; | |
| export default { | |
| async obtener(solicitud: Solicitud, entorno: Entorno, contexto: ContextoDeEjecucion): Prometo<Respuesta> { | |
| let url = new URL(solicitud.url); | |
| let nombre = url.parametrosBusqueda.get("nombre") || "mundo"; | |
| return Respuesta.json({ | |
| mensaje: `hola ${nombre}`, | |
| }); |
| import { BskyAgent } from "@atproto/api"; | |
| type Env = { | |
| BLUESKY_APP_PASSWORD: string; | |
| POST_TOKEN: string; | |
| }; | |
| export default { | |
| async fetch(request, env, ctx): Promise<Response> { | |
| let url = new URL(request.url); |