#!/usr/bin/env node import { Buffer } from "node:buffer"; import { existsSync } from "node:fs"; import { mkdir, readFile, stat, writeFile } from "node:fs/promises"; import { homedir } from "node:os"; import path from "node:path"; import { fileURLToPath } from "node:url"; const BASE_DIR = path.resolve(path.dirname(fileURLToPath(import.meta.url)), ".."); const TEMPLATES_PATH = path.join(BASE_DIR, "references", "templates.json"); const IMGFLIP_GET_MEMES_URL = "https://api.imgflip.com/get_memes"; const IMGFLIP_CAPTION_URL = "https://api.imgflip.com/caption_image"; const USER_AGENT = "OpenClawMemeMaker/1.0"; const STOPWORDS = new Set([ "a", "an", "and", "are", "for", "in", "is", "it", "of", "on", "or", "the", "this", "to", "use", "with", ]); function usage(exitCode = 0) { const out = exitCode === 0 ? console.log : console.error; out(`Usage: meme.mjs list [--json] meme.mjs search [--json] meme.mjs suggest [--limit N] [--json] meme.mjs render