Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.
Python agentagent-osaiai-agentsai-partnerchatopsclaudeclaude-codecodexdevtoolsdiscord-botlark-botllmlocal-firstlong-term-memoryopencodeslack-botvibe-codingvibeywechat
refactor(ui): reuse Button + badgeVariants in BackendLifecycleChip
cyh2a3a97487364
diff --git a/AGENTS.md b/AGENTS.mdindex aa24ba7eb..219407cbb 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -188,6 +188,14 @@ Source-of-truth rule:- build command: `npm run build` from `ui/`- built assets land in `ui/dist/` and are served by `vibe/ui_server.py`+Reuse design-system primitives — do not re-roll:++- buttons must use `Button` from `ui/src/components/ui/button.tsx`; pick a `variant` + `size` rather than hand-rolling `<button>` with custom Tailwind classes. Icon-only triggers use `variant="ghost" size="icon"` (with a `className` size override when the surrounding row is tight).+- status pills must use `Badge` (or `badgeVariants()` applied to a `<button>` when the pill needs to be clickable) from `ui/src/components/ui/badge.tsx`; pick a semantic variant (`success` / `warning` / `info` / `destructive` / `secondary`) instead of redefining border/bg/text colors.+- the same rule applies to every other primitive under `ui/src/components/ui/` (`Card`, `Input`, `Label`, `Popover`, `Dialog`, `Combobox`, `Separator`, ...): if a primitive already exists, extend it via `variant`, `size`, or `className` overrides — do not duplicate it inline.+- if no existing primitive fits, add a new variant (or a new primitive in `ui/src/components/ui/`) so the next caller can reuse it. Prefer adjusting the design-system layer over re-implementing the visual locally in a feature component.+- the source of truth for visual tokens (colors, radii, spacing, variant names) is `design.pen` — extend primitives to match its variant names so design ↔ code stay aligned.+Important packaging caveat:- the installed `vibe` command uses packaged UI assets, not raw `ui/dist/` from the repo by defaultdiff --git a/ui/src/components/settings/BackendLifecycleChip.tsx b/ui/src/components/settings/BackendLifecycleChip.tsxindex 40410be52..32d82c041 100644--- a/ui/src/components/settings/BackendLifecycleChip.tsx+++ b/ui/src/components/settings/BackendLifecycleChip.tsx@@ -5,10 +5,13 @@ import clsx from 'clsx';import { useApi, type BackendRuntimeInfo } from '../../context/ApiContext';import { useToast } from '../../context/ToastContext';import { Button } from '../ui/button';+import { badgeVariants } from '../ui/badge';+import { cn } from '@/lib/utils';type CliStatus = 'unknown' | 'ok' | 'missing';type Phase = 'idle' | 'loading' | 'upgrading' | 'restarting';type Visual = 'disabled' | 'ready' | 'updating' | 'update' | 'error' | 'loading';+type BadgeVariant = 'secondary' | 'success' | 'info' | 'warning' | 'destructive';interface BackendLifecycleChipProps {name: string;@@ -17,13 +20,16 @@ interface BackendLifecycleChipProps {onChanged?: () => void | Promise<void>;}-const VISUAL_STYLES: Record<Visual, string> = {- disabled: 'border-border bg-surface-2/60 text-muted',- ready: 'border-mint/30 bg-mint/[0.08] text-mint',- updating: 'border-cyan/30 bg-cyan/[0.10] text-cyan',- update: 'border-gold/30 bg-gold/15 text-gold',- error: 'border-destructive/30 bg-destructive/10 text-destructive',- loading: 'border-border bg-surface-2/60 text-muted',+// Map lifecycle visual states to canonical Badge variants from the design+// system. The chip is a clickable status pill so it shares Badge's shape;+// we apply badgeVariants() to a <button> rather than re-roll the styling.+const BADGE_VARIANT: Record<Visual, BadgeVariant> = {+ disabled: 'secondary',+ loading: 'secondary',+ ready: 'success',+ updating: 'info',+ update: 'warning',+ error: 'destructive',};const DOT_STYLES: Record<Visual, string> = {@@ -184,9 +190,9 @@ export const BackendLifecycleChip: React.FC<BackendLifecycleChipProps> = ({<buttontype="button"onClick={() => setIsOpen((prev) => !prev)}- className={clsx(- 'inline-flex items-center gap-1.5 rounded-full border px-2.5 py-0.5 text-[11px] font-medium transition-colors',- VISUAL_STYLES[visual],+ className={cn(+ badgeVariants({ variant: BADGE_VARIANT[visual] }),+ 'cursor-pointer font-medium tracking-normal hover:brightness-110 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background',)}aria-label={chipLabel}>@@ -205,24 +211,26 @@ export const BackendLifecycleChip: React.FC<BackendLifecycleChipProps> = ({<div className="flex items-center justify-between border-b border-border px-4 py-3"><span className="text-sm font-medium text-foreground">{t('backendLifecycle.title')}</span><div className="flex items-center gap-1">- <button- type="button"+ <Button+ variant="ghost"+ size="icon"+ className="h-7 w-7 text-muted hover:text-foreground"onClick={() => void loadRuntime()}disabled={phase !== 'idle'}- className="rounded p-1.5 text-muted hover:bg-surface-2 hover:text-foreground disabled:opacity-50"aria-label={t('common.refresh')}title={t('common.refresh')}><RefreshCw size={14} className={phase === 'loading' ? 'animate-spin' : ''} />- </button>- <button- type="button"+ </Button>+ <Button+ variant="ghost"+ size="icon"+ className="h-7 w-7 text-muted hover:text-foreground"onClick={() => setIsOpen(false)}- className="rounded p-1.5 text-muted hover:bg-surface-2 hover:text-foreground"aria-label={t('common.close')}><X size={14} />- </button>+ </Button></div></div>diff --git a/ui/src/components/ui/badge.tsx b/ui/src/components/ui/badge.tsxindex 75d9c91c1..1b4b29def 100644--- a/ui/src/components/ui/badge.tsx+++ b/ui/src/components/ui/badge.tsx@@ -31,3 +31,5 @@ export type BadgeProps = React.HTMLAttributes<HTMLSpanElement> & VariantProps<tyexport const Badge = ({ className, variant, ...props }: BadgeProps) => (<span className={cn(badgeVariants({ variant }), className)} {...props} />);++export { badgeVariants };