<?xml version="1.0" encoding="UTF-8"?>
<spec xmlns="https://vibevm.org/spec/1">
  <title>vibe tree — the TUI application (PROP-037) visual sign-off</title>
  <p p="1"><fact id="purpose" status="impl/done">**Purpose.** `vibe tree` is now a full TUI application (PROP-037, TREE-TUI-PLAN
v0.2): a formal visual language (five palettes, glyph vocabulary, rendering
tiers), a reusable `ui::` component library, the tree filter/shape pipeline,
trees in every mode, a keymap-driven action dispatch, a detail card, settings
persistence, and a copy system. The automated suite (241 vibe-cli tests,
`self-check` all green) proves the *model + the rendering fns*; it cannot drive
a real terminal and confirm the TUI *looks and reads right* — that the Unicode
box-drawing aligns, the palette is beautiful and switchable, the windows float,
the card wraps, the modals cascade at depth 2. That is what a human signs off
here.</fact></p>
  <p p="2"><fact id="settings-mutation-note" status="impl/done">Unlike MT-01, this TUI **writes user settings** (`~/.vibe/` via the vibe-settings
system, Шаг 2) — palette/tier/mode/sort/shape choices persist. The test mutates
only machine-global user prefs (never project files); back them up or accept the
delta.</fact></p>
  <section title="Preconditions">
    <list ordered="false" p="3">
      <item><fact id="PRE-TTY-TRUECOLOR" status="impl/done">A real interactive terminal (a tty), ideally truecolor (`echo $COLORTERM` →
  `truecolor`/`24bit`) so Tier 3 shows; a 256-colour or 16-colour terminal is the
  degradation path and is worth a second pass.</fact></item>
      <item><fact id="PRE-BINARY" status="impl/done">`cargo build -p vibe-cli` (invoke `./target/debug/vibe`).</fact></item>
      <item><fact id="PRE-REPO-ROOT" status="impl/done">Run from the vibevm repo root.</fact></item>
    </list>
  </section>
  <section title="Steps">
    <list ordered="true" p="4">
      <item><fact id="STEP-1-DEFAULT-LOOK" status="impl/done">**Launch + the default look (Rosé Pine, Tier 3).**</fact></item>
    </list>
    <fence p="5">   ./target/debug/vibe tree</fence>
    <list ordered="false" p="6">
      <item><fact id="S1-GLYPHS" status="impl/done">Tree connectors `│├└─` align; fold indicator is `▾`/`▸` (not `+`/`-`); DAG
     re-occurrence is `↩` (not `(*)`); flags are `●`/`○` (not `x`/`.`).</fact></item>
      <item><fact id="S1-FOOTER" status="impl/done">The footer lists `F1 search · F2 sort · F3 mode · F4 settings · F6 copy
     · ↑↓ move · ←→ pan · Space fold · Enter details · Esc quit` (Tabs mode adds
     `Shift+←/→ tab`).</fact></item>
      <item><fact id="S1-STATUS-LINE" status="impl/done">The status line shows ordering · mode · STATIC.md size · package count.</fact></item>
    </list>
    <list ordered="true" p="7">
      <item><fact id="STEP-2-NAVIGATION" status="impl/done">**Navigation + fold (every mode is a tree).** `↑`/`↓` move, `←`/`→` pan,
   `Space` folds a node (▾↔▸), `Enter` opens the detail card.</fact></item>
    </list>
    <list ordered="true" p="8">
      <item><fact id="STEP-3-DETAIL-CARD" status="impl/done">**The detail card (§8).** `Enter` on a package → a paper panel, **bold field
   headers**, wrapped long values (a 64-char hash wraps, never truncates), a `✕`
   close affordance top-right; `Esc`/`✕` closes.</fact></item>
    </list>
    <list ordered="true" p="9">
      <item><fact id="STEP-4-MODES" status="impl/done">**Modes (§4) — all trees.** `F3` → the mode menu → SubTables (stacked trees per
   load partition, each under a subheader), Tabs (`Shift+←`/`Shift+→` switch
   tabs, each tab a tree). Fold a package in SubTables — it folds in every block.</fact></item>
    </list>
    <list ordered="true" p="10">
      <item><fact id="STEP-5-SORT-SHAPE" status="impl/done">**Sort &amp; shape (§7.2).** `F2` → a multi-group dialog: Sort by (alphabetical/
   topological) + Shape (members-as-roots / load-type-forest / pruned-tree) +
   Block order (sub-tables only). Pick a shape — the tree re-forms. The menu
   stays open (sticky); `Esc` closes.</fact></item>
    </list>
    <list ordered="true" p="11">
      <item><fact id="STEP-6-SEARCH" status="impl/done">**Search Everywhere (§7.3).** `F1` → the hybrid "All" + per-category tabs;
   type a query — packages, card fields, and `vibe.tree` actions match; `Enter`
   on an action runs it in place.</fact></item>
    </list>
    <list ordered="true" p="12">
      <item><fact id="STEP-7-COPY" status="impl/done">**Copy (§10).** `F6` → copies the current screen (tree or card) as Markdown
   to the clipboard (footer flash `✓ copied`). `Shift+F6` → copy-settings
   (format Markdown/PNG + dest clipboard/file). PNG → ComingSoon. dest=file →
   the FileDest modal (TextField + Save/Cancel) **over** copy-settings (depth-2);
   `Esc` returns to copy-settings, not the base.</fact></item>
    </list>
    <list ordered="true" p="13">
      <item><fact id="STEP-8-QUIT-CONFIRM" status="impl/done">**Quit-confirm (§7.4).** At the base, `Esc` → "Really quit?" dialog (not an
   instant quit); `Enter` quits, `Esc`/`No` cancels.</fact></item>
    </list>
    <list ordered="true" p="14">
      <item><fact id="STEP-9-PALETTE" status="impl/done">**Switchable palette (§2.2.1, the owner vision).** Quit, set the palette:</fact></item>
    </list>
    <fence p="15">   # edit directly, or pick it in the F4 settings menu    ~/.vibe/settings.toml
   [vibe.tree]
   palette = "catppuccin-mocha"   # or -macchiato / -frappe / -latte (light) / rose-pine</fence>
    <p p="16"><fact id="S9-RELAUNCH" status="impl/done">Relaunch — the whole UI (tree, windows, card, menus, search) is now in the
   chosen palette; Latte is light. Tier override: `tier = 1` (16-colour) or
   `0` (ASCII fallback) to see the degradation.</fact></p>
    <list ordered="true" p="17">
      <item><fact id="STEP-10-PERSISTENCE" status="impl/done">**Persistence.** Change mode/sort/shape via the menus; quit; relaunch — the
    choices are restored.</fact></item>
    </list>
  </section>
  <section title="Pass">
    <p p="18"><fact id="pass-criteria" status="impl/done">Every step reads as described: the Unicode aligns, the palettes are beautiful
and distinct, the windows float, the card wraps, the depth-2 cascade works, and
the five palettes all render. The owner signs the date below.</fact></p>
  </section>
  <section title="Sign-off">
    <list ordered="false" p="19">
      <item><fact id="SIGNOFF-OWNER" status="impl/work">[ ] Owner visual sign-off (date / initials): ______</fact></item>
      <item><fact id="SIGNOFF-TIER-3" status="impl/work">Tier 3 (truecolor) checked on terminal: ______</fact></item>
      <item><fact id="SIGNOFF-DEGRADATION" status="impl/work">A degradation tier (256 / 16 / ASCII) also checked: ______</fact></item>
    </list>
  </section>
</spec>
