{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "codex-diff",
  "title": "Codex Diff",
  "description": "Codex's full-screen /diff pager — spaced DIFF title bar, unified git hunks, ~ fillers, and quit footer.",
  "files": [
    {
      "path": "registry/brainless/codex/codex-diff.tsx",
      "content": "import * as React from \"react\";\nimport { cn } from \"@/lib/utils\";\n\n/**\n * CodexDiff — Codex CLI's full-screen `/diff` pager.\n *\n * Captured grammar (v0.132): a spaced `D I F F` title bar padded with `/`,\n * unified git diff body, vim-style `~` fillers, a percentage footer, and\n * scroll / quit hints.\n */\nexport type CodexDiffLine = {\n  type: \"meta\" | \"hunk\" | \"add\" | \"del\" | \"ctx\" | \"fill\";\n  text: string;\n};\n\nconst FG = \"#ededed\";\nconst DIM = \"#7a7a7a\";\nconst GREEN = \"#abdfa7\";\nconst RED = \"#f2a0a0\";\nconst META = \"#f6e2b7\";\n\nconst DEFAULT_LINES: CodexDiffLine[] = [\n  { type: \"meta\", text: \"diff --git a/scratch.txt b/scratch.txt\" },\n  { type: \"meta\", text: \"index e382994..401fe17 100644\" },\n  { type: \"meta\", text: \"--- a/scratch.txt\" },\n  { type: \"meta\", text: \"+++ b/scratch.txt\" },\n  { type: \"hunk\", text: \"@@ -1 +1 @@\" },\n  { type: \"del\", text: \"-hello scratch\" },\n  { type: \"add\", text: \"+hello scratch edited\" },\n  { type: \"meta\", text: \"diff --git a/other.txt b/other.txt\" },\n  { type: \"meta\", text: \"new file mode 100644\" },\n  { type: \"meta\", text: \"index 0000000..fa49b07\" },\n  { type: \"meta\", text: \"--- /dev/null\" },\n  { type: \"meta\", text: \"+++ b/other.txt\" },\n  { type: \"hunk\", text: \"@@ -0,0 +1 @@\" },\n  { type: \"add\", text: \"+new file\" },\n];\n\nfunction titleBar(cols = 80) {\n  const label = \"D I F F\";\n  const inner = `/ ${label} ${\"/ \".repeat(40)}`.trimEnd();\n  return (inner + \" /\".repeat(cols)).slice(0, cols);\n}\n\nfunction lineColor(type: CodexDiffLine[\"type\"]) {\n  switch (type) {\n    case \"add\":\n      return GREEN;\n    case \"del\":\n      return RED;\n    case \"hunk\":\n      return META;\n    case \"fill\":\n      return DIM;\n    default:\n      return FG;\n  }\n}\n\nexport function CodexDiff({\n  lines = DEFAULT_LINES,\n  percent = 100,\n  fillRows = 8,\n  className,\n}: {\n  lines?: CodexDiffLine[];\n  percent?: number;\n  fillRows?: number;\n  className?: string;\n}) {\n  const body = [\n    ...lines,\n    ...Array.from({ length: fillRows }, () => ({\n      type: \"fill\" as const,\n      text: \"~\",\n    })),\n  ];\n\n  return (\n    <div\n      className={cn(\n        \"overflow-hidden rounded-none border border-[#2a2a2a] bg-[#1a1a1a] font-mono text-[13px] leading-[1.45]\",\n        className,\n      )}\n      role=\"region\"\n      aria-label=\"Diff pager\"\n    >\n      <div\n        className=\"truncate px-2 py-1 text-[12px] tracking-wide\"\n        style={{ color: DIM, background: \"#121212\" }}\n      >\n        {titleBar(88)}\n      </div>\n\n      <pre className=\"overflow-x-auto px-2 py-1.5\">\n        {body.map((l, i) => (\n          <div key={i} style={{ color: lineColor(l.type) }}>\n            {l.type === \"add\" ? (\n              <span className=\"sr-only\">added: </span>\n            ) : l.type === \"del\" ? (\n              <span className=\"sr-only\">removed: </span>\n            ) : null}\n            {l.text}\n          </div>\n        ))}\n      </pre>\n\n      <div\n        className=\"border-t px-2 py-1 text-[12px]\"\n        style={{ borderColor: \"#2a2a2a\", color: DIM }}\n      >\n        <div className=\"flex items-center justify-end\">\n          <span>{percent}%</span>\n        </div>\n        <div className=\"mt-0.5\">↑/↓ to scroll · pgup/pgdn to page · home/end to jump</div>\n        <div>\n          <kbd className=\"font-semibold\" style={{ color: FG }}>\n            q\n          </kbd>{\" \"}\n          to quit\n        </div>\n      </div>\n    </div>\n  );\n}\n",
      "type": "registry:ui",
      "target": "components/brainless/codex/codex-diff.tsx"
    }
  ],
  "type": "registry:ui"
}