{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "terminal",
  "type": "registry:ui",
  "title": "Terminal",
  "description": "Scrollable log/output block with typed line entries, color-coded types, and a blinking cursor.",
  "dependencies": [],
  "registryDependencies": [
    "utils"
  ],
  "files": [
    {
      "path": "ui/terminal/terminal.tsx",
      "type": "registry:ui",
      "content": "'use client'\n\nimport * as React from 'react'\nimport { cn } from '@/lib/utils'\n\nexport type TerminalLineType = 'input' | 'output' | 'warn' | 'error' | 'system'\n\nexport interface TerminalLine {\n  type?:      TerminalLineType\n  text:       string\n  timestamp?: string\n}\n\nexport interface TerminalProps extends React.HTMLAttributes<HTMLDivElement> {\n  lines?:       TerminalLine[]\n  prompt?:      string\n  title?:       string\n  height?:      string | number\n  blinkCursor?: boolean\n}\n\nfunction lineColor(type: TerminalLineType = 'output'): string {\n  switch (type) {\n    case 'input':  return 'var(--color-green)'\n    case 'output': return 'var(--text-secondary)'\n    case 'warn':   return 'var(--color-amber)'\n    case 'error':  return 'var(--color-red)'\n    case 'system': return 'var(--text-muted)'\n  }\n}\n\nfunction linePrefix(type: TerminalLineType = 'output'): string {\n  switch (type) {\n    case 'input':  return '>'\n    case 'output': return ' '\n    case 'warn':   return '⚠'\n    case 'error':  return '✕'\n    case 'system': return '#'\n  }\n}\n\nconst Terminal = React.forwardRef<HTMLDivElement, TerminalProps>(\n  (\n    {\n      className,\n      lines = [],\n      prompt = '>',\n      title = 'TERMINAL',\n      height = '16rem',\n      blinkCursor = true,\n      style,\n      ...props\n    },\n    ref\n  ) => {\n    const bodyRef = React.useRef<HTMLDivElement>(null)\n\n    React.useEffect(() => {\n      if (bodyRef.current) {\n        bodyRef.current.scrollTop = bodyRef.current.scrollHeight\n      }\n    }, [lines])\n\n    return (\n      <div\n        ref={ref}\n        className={cn(className)}\n        style={{\n          border:      '1px solid var(--border)',\n          background:  'var(--surface)',\n          fontFamily:  'var(--font-mono)',\n          overflow:    'hidden',\n          display:     'flex',\n          flexDirection: 'column',\n          ...style,\n        }}\n        {...props}\n      >\n        {/* Title bar */}\n        <div\n          style={{\n            display:      'flex',\n            alignItems:   'center',\n            gap:          '0.5rem',\n            padding:      '0.4rem 0.75rem',\n            borderBottom: '1px solid var(--border)',\n            background:   'var(--surface-raised)',\n          }}\n        >\n          <span\n            style={{\n              fontSize:      '0.6rem',\n              color:         'var(--text-muted)',\n              letterSpacing: '0.12em',\n              textTransform: 'uppercase',\n            }}\n          >\n            {title}\n          </span>\n          {/* Status dot */}\n          <span\n            style={{\n              marginLeft:   'auto',\n              width:        '6px',\n              height:       '6px',\n              borderRadius: '50%',\n              background:   'var(--color-green)',\n              boxShadow:    'var(--glow-green)',\n              animation:    'blink-cursor 2s step-end infinite',\n            }}\n          />\n        </div>\n\n        {/* Output body */}\n        <div\n          ref={bodyRef}\n          style={{\n            flex:          1,\n            overflowY:     'auto',\n            padding:       '0.75rem',\n            height,\n            display:       'flex',\n            flexDirection: 'column',\n            gap:           '0.2rem',\n          }}\n        >\n          {lines.map((line, i) => (\n            <div\n              key={i}\n              style={{\n                display:    'flex',\n                gap:        '0.5rem',\n                fontSize:   '0.75rem',\n                lineHeight: 1.6,\n                color:      lineColor(line.type),\n              }}\n            >\n              {line.timestamp && (\n                <span\n                  style={{\n                    color:     'var(--text-muted)',\n                    flexShrink: 0,\n                    fontSize:  '0.65rem',\n                  }}\n                >\n                  {line.timestamp}\n                </span>\n              )}\n              <span style={{ flexShrink: 0, opacity: 0.5, userSelect: 'none' }}>\n                {linePrefix(line.type)}\n              </span>\n              <span style={{ wordBreak: 'break-all' }}>{line.text}</span>\n            </div>\n          ))}\n\n          {/* Blinking cursor */}\n          {blinkCursor && (\n            <div\n              style={{\n                display:    'flex',\n                alignItems: 'center',\n                fontSize:   '0.75rem',\n                marginTop:  '0.1rem',\n                gap:        '0.25rem',\n              }}\n            >\n              <span style={{ color: 'var(--text-muted)', userSelect: 'none' }}>{prompt}</span>\n              <span\n                style={{\n                  display:    'inline-block',\n                  width:      '0.55rem',\n                  height:     '1em',\n                  background: 'var(--color-green)',\n                  boxShadow:  'var(--glow-green)',\n                  animation:  'blink-cursor 1s step-end infinite',\n                }}\n              />\n            </div>\n          )}\n        </div>\n      </div>\n    )\n  }\n)\nTerminal.displayName = 'Terminal'\n\nexport { Terminal }\n"
    }
  ]
}