#!/usr/bin/env bun // scratch — CLI-first tool for organizing agent knowledge into // scratchpads (a folder + scratchpad.json manifest). Thin layer over the FS. import { parseArgs } from "node:util"; import pkg from "../package.json" with { type: "json" }; import { bold, cyan, dim, red } from "./colors.ts"; import { cmdAdd, cmdComments, cmdExport, cmdImport, cmdLs, cmdNew, cmdPreview, cmdRm, cmdShow, cmdUi, defaultIO, type IO } from "./commands.ts"; // A function, not a const: styling is decided per call (TTY/NO_COLOR), so it // must not be baked in at import time. const help = () => `${bold("scratch")} — organize agent knowledge into scratchpads (folder + manifest) ${bold("USAGE")} ${cyan("scratch new")} ${dim("--dir [--id ] [--force]")} Create // + manifest, then print an onboarding prompt. --dir is REQUIRED — placement is always deliberate (no assumed location). ${cyan("scratch add")} ${dim("[--title ..] [--desc ..] [--tag a,b] [--type note] [--group ..]")} Register an already-present file into the pad's manifest with metadata. --group places the file under a named group header in the viewer. The CLI never copies/moves/authors content — you write the file, it tracks it. --link [--as