Skip to content

Instantly share code, notes, and snippets.

View FranciscoMoretti's full-sized avatar

Francisco Moretti FranciscoMoretti

View GitHub Profile
@FranciscoMoretti
FranciscoMoretti / prompt-fix-mypy-parallel-code-agents.txt
Last active November 16, 2025 15:37
prompt-fix-mypy-parallel-code-agents
I want you to fix mypy errors
To do so, you need to do it by pieces.
The best way to do it is to solve by file.
Here are 2 important commands:
1) Summary of number of mypy errors per file
@FranciscoMoretti
FranciscoMoretti / prompt-fix-biome-errors.txt
Last active November 12, 2025 13:23
Fix Biome Errors with subagents
I want you to fix biome violations
To do so, you need to do it by pieces
The best way to do it is to solve by rule
Here are 2 important commands:
```
npx biome check . --reporter=summary
```
Will print a summary of number of violations per file
@FranciscoMoretti
FranciscoMoretti / demo-static-dynamic-models.ts
Last active November 10, 2025 08:32
ai-registry: vercel-gateway demo-static-dynamic-models.ts
const models = [
{
id: 'openai/gpt-5',
provider: 'openai',
},
{
id: 'openai/gpt-4o',
provider: 'openai',
},
@FranciscoMoretti
FranciscoMoretti / fetch-base.ts
Last active November 10, 2025 08:09
ai-registry vercel-gateway snapshot: models/providers/get-functions
#!/usr/bin/env tsx
import { mkdirSync, writeFileSync } from "node:fs";
import { dirname, join } from "node:path";
import { fileURLToPath } from "node:url";
import {
type AiGatewayModelsResponse,
AiGatewayModelsResponseSchema,
} from "../../packages/vercel-gateway/ai-sdk-models-schemas";
function ensureDir(filePath: string) {
@FranciscoMoretti
FranciscoMoretti / NPM_RELEASES.md
Created October 26, 2025 08:16
Deploy NPM packages Github + Vercel Workflow

NPM releases for a pnpm monorepo (GitHub Actions + Changesets)

Minimal, reliable setup to auto-version, create GitHub Releases, and publish to npm from main using Changesets. No GitHub App required (uses GITHUB_TOKEN).

What this does

  • Opens a "Version Packages" PR when changesets land on main.
  • On merging that PR, publishes to npm and creates GitHub Releases.
  • Optionally deploys to Vercel after publish (see VERCEL_DEPLOYMENTS.md).
@FranciscoMoretti
FranciscoMoretti / NPM_RELEASES.md
Created October 23, 2025 07:22
ai-registry: Changesets + Release workflow + Vercel deploy

NPM releases for a pnpm monorepo (GitHub Actions + Changesets)

Minimal, reliable setup to auto-version, create GitHub Releases, and publish to npm from main using Changesets. No GitHub App required (uses GITHUB_TOKEN).

What this does

  • Opens a "Version Packages" PR when changesets land on main.
  • On merging that PR, publishes to npm and creates GitHub Releases.
  • Optionally deploys to Vercel after publish (see VERCEL_DEPLOYMENTS.md).
@FranciscoMoretti
FranciscoMoretti / DIFF_PR_FLOW.md
Created September 3, 2025 11:42
Diff PR flow automation script

Goal: Turn my current working tree diff into a PR to upstream. Infer upstream_repo, branch_name, commit_message, PR title/body from git remotes, git status, and my message.

My message (use this to infer type/scope/subject and PR body): """ <WRITE YOUR MESSAGE HERE — first line becomes the Conventional Commit subject, lines after a blank line become the body> """

Behavior:

  • Non-interactive. Assume gh is installed and authenticated. Use | cat to avoid pagers.
@FranciscoMoretti
FranciscoMoretti / deep-research-guide.mdx
Last active August 20, 2025 09:53
Deep Research Guide

Create a Deep Research Tool (AI SDK)

In this guide, you’ll build a Deep Research tool using AI SDK. It orchestrates two agents — a Supervisor and a Researcher — and runs through three concrete phases:

  • Clarifying questions (optional but automatic)
  • Research orchestration (supervisor) and evidence gathering/compression (researcher)
  • Final report writing with citations

What you’ll get

@FranciscoMoretti
FranciscoMoretti / chat-store.ts
Last active July 21, 2025 11:35
Zustand + AI SDK useChat Integration - how to use Zustand store with AI SDK's useChat hook
import { create } from 'zustand';
import { subscribeWithSelector, devtools } from 'zustand/middleware';
import {
AbstractChat,
type ChatInit,
type ChatState,
type ChatStatus,
type UIMessage,
} from 'ai';
import type { ChatMessage } from '@/lib/ai/types';
@FranciscoMoretti
FranciscoMoretti / table_1_node-file-writing-methods-createwritestream-vs-writefilesync.md
Created January 13, 2025 10:08
Table for node-file-writing-methods-createwritestream-vs-writefilesync article in Medium
Feature fs.createWriteStream(path).write(buffer) fs.writeFileSync(path, buffer)
Synchronicity Asynchronous Synchronous
Blocking Non-blocking Blocking
Performance Better for large files or frequent writes Better for small, infrequent writes
Memory Usage More memory-efficient for large files Loads entire content into memory
Error Handling Requires callback or event listeners Throws errors directly
Use Case Streaming large files, real-time data Quick, simple writes, small files
Control Flow Continues execution immediately Waits until write is complete
Backpressure Handling Handles backpressure autom