import { VERSION } from "./constants.js"; import type { CliOptions, HtmlNode } from "./types.js"; export async function loadHtmlParser(): Promise<(html: string) => HtmlNode> { try { const mod = await import("node-html-parser"); return mod.parse as unknown as (html: string) => HtmlNode; } catch { throw new Error("Missing dependency 'node-html-parser'. Run bun install in this skill directory."); } } /* ------------------------------------------------------------------ */ /* cli */ /* ------------------------------------------------------------------ */ function printHelp(): void { console.log(`brand-assets v${VERSION} Extract brand assets from a website you name. Fetches the page over plain HTTP, parses it for icons, social preview images, theme colors, CSS color custom properties, and font stacks, then downloads what it finds. No API keys and no third-party services: the only host contacted is the one in the URL you pass (plus whatever that page links its own assets from). USAGE: brand-assets --url [options] brand-assets [options] OPTIONS: -u, --url Website to inspect. Required. -o, --output Output directory [./brand-assets] -t, --timeout Per-request timeout in milliseconds [15000] --max-assets Maximum assets to download [20] --no-download Discover and report only, fetch no binaries --json Print the brand profile as JSON on stdout --help Show this help message --version Show the current version WHAT IS DISCOVERED: (parsed for name, theme_color, background_color, icons) , (including per-color-scheme media variants) and inline whose src, alt, class, or id looks like a logo CSS custom properties whose name contains color / brand / accent / bg / fg font-family declarations, in inline