#!/usr/bin/env bun /** * Demo script showing new CLI UI features. * * @module */ import { highlightEnvBlock, createEnvTable, createChangeSummary } from "../cli/ui/index.js"; const sampleEnvVars = [ { key: "DATABASE_URL", value: "postgresql://user:pass@localhost:5432/mydb", is_runtime: true, is_buildtime: false, is_required: true, }, { key: "API_KEY", value: "sk_test_1234567890abcdef", is_runtime: true, is_buildtime: false, is_required: false, }, { key: "NODE_ENV", value: "production", is_runtime: true, is_buildtime: true, is_required: false, }, { key: "BUILD_ARG", value: "some_value", is_runtime: false, is_buildtime: true, is_required: false, }, ]; const sampleChanges = { added: [ { key: "NEW_VAR", value: "new_value" }, { key: "ANOTHER_NEW", value: "another" }, ], updated: [ { key: "DATABASE_URL", value: "new_db_url", oldValue: "old_db_url" }, { key: "API_KEY", value: "new_key", oldValue: "old_key" }, ], removed: ["DEPRECATED_VAR", "OLD_SETTING"], }; console.log("\n" + "=".repeat(60)); console.log(" CLI UI Demo - Syntax Highlighting"); console.log("=".repeat(60) + "\n"); // Demo 1: Syntax highlighted .env file console.log("1️⃣ Syntax Highlighted .env File"); console.log("─".repeat(60)); const envContent = await Bun.file("/tmp/test.env").text(); console.log(highlightEnvBlock(envContent)); console.log(); // Demo 2: Table view console.log("2️⃣ Table View with cli-table3"); console.log("─".repeat(60)); console.log(createEnvTable(sampleEnvVars, { compact: true, showType: true })); console.log(); // Demo 3: Change summary console.log("3️⃣ Change Summary for Sync"); console.log("─".repeat(60)); console.log(createChangeSummary(sampleChanges)); console.log(); console.log("=".repeat(60)); console.log(" ✨ Demo complete!"); console.log("=".repeat(60) + "\n");