### Initiate Install from URL Prompt Source: https://github.com/sinelaw/fresh/blob/master/docs/internal/plugin-marketplace-design.md Starts a prompt to ask the user for a Git URL to install an unlisted package. ```typescript globalThis.pkg_install_url = async function(): Promise { editor.startPrompt("Git URL:", "pkg-install-url"); }; ``` -------------------------------- ### Installation Command Source: https://github.com/sinelaw/fresh/blob/master/crates/fresh-editor/tests/fixtures/syntax_highlighting/CMakeLists.txt Installs the 'hello' target to the 'bin' directory. ```cmake install(TARGETS hello DESTINATION bin) ``` -------------------------------- ### Quick Install Fresh Editor Source: https://github.com/sinelaw/fresh/blob/master/README.md Use this command to quickly install Fresh by downloading and executing the install script. This method attempts to autodetect the best installation method for your system. ```bash curl https://raw.githubusercontent.com/sinelaw/fresh/refs/heads/master/scripts/install.sh | sh ``` -------------------------------- ### Install Fresh Editor on OpenSUSE Source: https://github.com/sinelaw/fresh/blob/master/README.md Installs the Fresh Editor using the zypper package manager on OpenSUSE. ```bash zypper install fresh-editor ``` -------------------------------- ### Fresh Installation Commands Source: https://github.com/sinelaw/fresh/blob/master/homepage/index.html Provides installation commands for Fresh across different operating systems (Linux, macOS, Windows). ```javascript const INSTALL_COMMANDS = { linux: 'curl https://raw.githubusercontent.com/sinelaw/fresh/refs/heads/master/scripts/install.sh | sh', mac: 'brew install sinelaw/fresh/fresh-editor', windows: 'winget install fresh-editor' }; ``` -------------------------------- ### Install and Run Fresh Editor Flatpak Source: https://github.com/sinelaw/fresh/blob/master/README.md Installs the Fresh Editor as a Flatpak bundle and runs it. Ensure Flatpak is set up. ```bash flatpak install --user fresh-editor-VERSION-x86_64.flatpak flatpak run io.github.sinelaw.fresh ``` -------------------------------- ### Install Fresh Editor from AUR (Binary) Source: https://github.com/sinelaw/fresh/blob/master/README.md Install the pre-compiled binary package of Fresh from the Arch User Repository using git and makepkg. This is the recommended method for faster installation. ```bash git clone https://aur.archlinux.org/fresh-editor-bin.git cd fresh-editor-bin makepkg --syncdeps --install ``` -------------------------------- ### Install Fresh Editor via Winget Source: https://github.com/sinelaw/fresh/blob/master/README.md Install Fresh on Windows using the Windows Package Manager. ```bash winget install fresh-editor ``` -------------------------------- ### CSS for Installation Section Source: https://github.com/sinelaw/fresh/blob/master/homepage/index.html Styles the installation section with a darker background and borders to visually separate it. ```css .install-section { padding: 80px 24px; background: var(--bg-darker); border-top: 1px solid var(--border-color); border-bottom: 1px solid var(--border-color); } ``` -------------------------------- ### Install Plugin: Show Picker Source: https://github.com/sinelaw/fresh/blob/master/docs/internal/plugin-marketplace-design.md Initiates the plugin installation process by loading the registry and displaying a picker to the user. Requires the 'plugins' registry type. ```typescript globalThis.pkg_install = async function(): Promise { // 1. Load registry const plugins = await loadRegistry("plugins"); // 2. Show picker const items = Object.entries(plugins.packages).map(([name, info]) => ({ label: name, description: info.description, detail: `★ ${info.stars} | v${info.latest_version}`, data: { name, ...info } })); editor.startPrompt("Install plugin:", "pkg-install"); editor.setPromptSuggestions(items); }; ``` -------------------------------- ### Install Fresh Editor from AUR (Helper) Source: https://github.com/sinelaw/fresh/blob/master/README.md Install Fresh from the Arch User Repository using an AUR helper like yay or paru. Choose the binary package for faster installation or build from source. ```bash # Binary package (recommended, faster install) yay -S fresh-editor-bin # Or build from source yay -S fresh-editor ``` -------------------------------- ### Install Fresh Editor with cargo-binstall Source: https://github.com/sinelaw/fresh/blob/master/README.md Installs the Fresh Editor binary directly using cargo-binstall, which is faster than compiling from crates.io. First, install cargo-binstall if needed. ```bash cargo install cargo-binstall ``` ```bash cargo binstall fresh-editor ``` -------------------------------- ### Confirm Install from URL Source: https://github.com/sinelaw/fresh/blob/master/docs/internal/plugin-marketplace-design.md Extracts the package name from the provided Git URL and prepares for installation. Handles empty URLs. ```typescript globalThis.pkg_install_url_confirm = async function(): Promise { const url = editor.getPromptText(); if (!url) return; // Extract name from URL const name = url.split("/").pop()?.replace(/\.git$/, "") || "unknown"; ``` -------------------------------- ### Select Install OS and Display Command Source: https://github.com/sinelaw/fresh/blob/master/homepage/index.html Updates the displayed installation command and active tab based on the selected OS. Defaults to Linux. ```javascript function selectInstallOS(os) { const cmd = INSTALL_COMMANDS[os]; if (!cmd) return; const code = document.getElementById('install-cmd'); if (code) code.textContent = cmd; document.querySelectorAll('.install-tab').forEach(t => { t.classList.toggle('active', t.dataset.os === os); }); } // Preselect the visitor's OS. Linux is the static default // (curl | sh is a no-prereq one-liner), so the page renders // correctly before JS runs. selectInstallOS(detectOS()); ``` -------------------------------- ### Formatter Configuration Examples Source: https://github.com/sinelaw/fresh/blob/master/docs/plugins/development/language-packs.md Examples of how to configure different code formatters within the package.json. The file path is automatically appended to the arguments. ```json // Prettier (JavaScript/TypeScript/etc.) "formatter": { "command": "prettier", "args": ["--write"] } ``` ```json // Prettier with plugin (Svelte, Vue, etc.) "formatter": { "command": "prettier", "args": ["--write", "--plugin", "prettier-plugin-svelte"] } ``` ```json // Black (Python) "formatter": { "command": "black", "args": ["-"] } ``` ```json // rustfmt (Rust) "formatter": { "command": "rustfmt", "args": [] } ``` ```json // gofmt (Go) "formatter": { "command": "gofmt", "args": ["-w"] } ``` -------------------------------- ### Run Installed Flatpak Source: https://github.com/sinelaw/fresh/blob/master/crates/fresh-editor/flatpak/README.md Executes the Fresh application after it has been installed as a Flatpak. ```bash flatpak run io.github.sinelaw.fresh ``` -------------------------------- ### CSS for Quick Install Command Source: https://github.com/sinelaw/fresh/blob/master/homepage/index.html Styles for displaying quick installation commands, ensuring code is readable and fits within its container. ```css .quick-install-cmd.copyable code { font-size: 1.25rem; overflow: hidden !important; white-space: nowrap; } ``` -------------------------------- ### Install Fresh Editor with npm Source: https://github.com/sinelaw/fresh/blob/master/README.md Installs the Fresh Editor globally using npm or runs it directly with npx. ```bash npm install -g @fresh-editor/fresh-editor ``` ```bash npx @fresh-editor/fresh-editor ``` -------------------------------- ### Quick Install Command CSS Source: https://github.com/sinelaw/fresh/blob/master/homepage/index.html Styles the quick install command elements, including labels and the command itself, with transitions for interactive feedback. ```css .quick-install { display: flex; flex-direction: column; align-items: center; gap: 12px; width: 100%; } .quick-install-row { display: flex; align-items: baseline; gap: 12px; } .mobile-only { display: none; } .quick-install-label { font-size: 1.25rem; font-weight: 600; color: var(--text-light); flex-shrink: 0; } .quick-install-cmd { cursor: pointer; transition: border-color 0.2s, background 0.2s; position ``` -------------------------------- ### Install Plugin from URL Source: https://github.com/sinelaw/fresh/blob/master/docs/internal/plugin-marketplace-design.md Installs a plugin by cloning its repository from a given URL. It updates the package configuration and provides status feedback. ```typescript editor.setStatus(`Installing from ${url}...`); const targetDir = `${PACKAGES_DIR}/${name}`; const result = await editor.spawnProcess("git", [ "clone", "--depth", "1", url, targetDir ]); if (result.exit_code === 0) { await addPackageToConfig(name, url); editor.setStatus(`Installed ${name}. Restart to activate.`); } else { editor.setStatus(`Failed: ${result.stderr}`); } }; ``` -------------------------------- ### Build and Install Flatpak Source: https://github.com/sinelaw/fresh/blob/master/crates/fresh-editor/flatpak/README.md Builds the Flatpak package using the specified manifest file and installs it for the current user. ```bash flatpak-builder --force-clean --user --install build flatpak/io.github.sinelaw.fresh.yml ``` -------------------------------- ### Install Fresh Editor on Gentoo Source: https://github.com/sinelaw/fresh/blob/master/README.md Installs the Fresh Editor on Gentoo by enabling the GURU repository and emerging the package. ```bash emerge --ask app-editors/fresh ``` -------------------------------- ### Install Fresh Editor from crates.io Source: https://github.com/sinelaw/fresh/blob/master/README.md Installs the Fresh Editor using cargo, fetching the latest locked version from crates.io. ```bash cargo install --locked fresh-editor ``` -------------------------------- ### Install Fresh Editor via dpkg (Debian/Ubuntu) Source: https://github.com/sinelaw/fresh/blob/master/homepage/index.html Install the Fresh Editor on Debian-based systems by downloading the .deb package from Releases and then using dpkg. ```bash sudo dpkg -i fresh-editor_*.deb ``` -------------------------------- ### Install Fresh Editor Globally via npm Source: https://github.com/sinelaw/fresh/blob/master/homepage/index.html Install the Fresh Editor globally using npm for command-line access. ```bash npm install -g @fresh-editor/fresh-editor ``` -------------------------------- ### Install Fresh Editor from AUR (Source) Source: https://github.com/sinelaw/fresh/blob/master/README.md Build and install Fresh from source using the Arch User Repository with git and makepkg. ```bash git clone https://aur.archlinux.org/fresh-editor.git cd fresh-editor makepkg --syncdeps --install ``` -------------------------------- ### Run Fresh Editor via npx (No Install) Source: https://github.com/sinelaw/fresh/blob/master/homepage/index.html Execute the Fresh Editor directly using npx without a global installation. ```bash npx @fresh-editor/fresh-editor ``` -------------------------------- ### Preview Theme Installation Source: https://github.com/sinelaw/fresh/blob/master/docs/internal/plugin-marketplace-design.md TypeScript function to preview a theme from a Git repository before installation. It clones the repo, loads the theme, and applies it temporarily using editor APIs. ```typescript globalThis.pkg_preview_theme = async function(): Promise { const selection = editor.getPromptSelection(); if (!selection) return; // Clone to temp directory const tempDir = `/tmp/fresh-theme-preview`; await editor.spawnProcess("git", [ "clone", "--depth", "1", selection.data.repository, tempDir ]); // Load and apply first theme const manifest = JSON.parse(await editor.readFile(`${tempDir}/package.json`)); const themeFile = manifest.fresh.themes[0].file; const themeData = await editor.readFile(`${tempDir}/${themeFile}`); // Apply temporarily (requires editor API extension) editor.previewTheme(JSON.parse(themeData)); // Clean up on cancel editor.onPromptClose(() => { editor.revertTheme(); editor.spawnProcess("rm", ["-rf", tempDir]); }); }; ``` -------------------------------- ### Install Hint Code CSS Source: https://github.com/sinelaw/fresh/blob/master/homepage/index.html Styles inline code snippets used for installation hints, providing a distinct background and border for clarity. ```css .install-hint { color: var(--text-muted); font-size: 0.85rem; } .install-hint code { background: var(--bg-card); padding: 4px 10px; border-radius: 4px; border: 1px solid var(--border-color); color: var(--accent-green); } ``` -------------------------------- ### User Configuration Example for Lua LSP Source: https://github.com/sinelaw/fresh/blob/master/docs/internal/multi-lsp-design.md Example of a user-defined configuration for the Lua LSP, specifying the command and custom root markers. Setting `root_markers` to an empty array forces file-directory-only behavior. ```json { "lsp": { "lua": { "command": "lua-language-server", "root_markers": [".luarc.json", ".git"] } } } ``` -------------------------------- ### Start Background Server Source: https://github.com/sinelaw/fresh/blob/master/crates/fresh-editor/docs/fresh.txt Starts or reattaches to a background server for the current directory. Named sessions allow multiple instances per directory. ```bash fresh -a ``` ```bash fresh -a myname ``` -------------------------------- ### Install Language Pack from URL Source: https://github.com/sinelaw/fresh/blob/master/docs/plugins/development/language-packs.md Users can install your language pack directly from a Git repository using this command within the Fresh command palette. Provide the full Git URL. ```bash # In Fresh command palette Package: Install from URL # Then enter: https://github.com/username/your-language-pack ``` -------------------------------- ### Install Fresh Editor on Fedora/RHEL Source: https://github.com/sinelaw/fresh/blob/master/README.md Downloads and installs the latest .rpm package for Fedora/RHEL systems. Ensure you have curl installed. ```bash curl -sL $(curl -s https://api.github.com/repos/sinelaw/fresh/releases/latest | grep "browser_download_url.*\.$(uname -m)\.rpm" | cut -d '"' -f 4) -o fresh-editor.rpm && sudo rpm -U fresh-editor.rpm ``` -------------------------------- ### Install Fresh Editor on Debian/Ubuntu Source: https://github.com/sinelaw/fresh/blob/master/README.md Downloads and installs the latest .deb package for Debian/Ubuntu systems. Ensure you have curl installed. ```bash curl -sL $(curl -s https://api.github.com/repos/sinelaw/fresh/releases/latest | grep "browser_download_url.*_$(dpkg --print-architecture)\.deb" | cut -d '"' -f 4) -o fresh-editor.deb && sudo dpkg -i fresh-editor.deb ``` -------------------------------- ### LSP Server Configuration Example Source: https://github.com/sinelaw/fresh/blob/master/docs/internal/config-editor-design.md Displays the configuration options for an LSP server, including command, arguments, and enabled status. Shows the default configuration and provides options to test the connection or reset to default. ```text ┌──────────────────────────────────────────────────────────────┐ │ ▾ rust [Default]│ ├────────────────────────────────────────────────────────┤ │ Command [rust-analyzer ] │ │ Args [--log-file, /tmp/ra.log ] │ │ Enabled [✓] │ │ Auto Start [ ] │ │ │ │ [Test Connection] [Reset to Default] │ └──────────────────────────────────────────────────────────────┘ ``` -------------------------------- ### Install Row CSS Source: https://github.com/sinelaw/fresh/blob/master/homepage/index.html Arranges the install pill and 'More installation methods' link. It uses flexbox to allow wrapping on narrow screens. ```css .install-row { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; } .install-row .install-pill { flex: 1 1 260px; min-width: 0; max-width: 520px; } .install-row-label { color: var(--text-light); font-weight: 600; white-space: nowrap; flex-shrink: 0; } .install-more-link { color: var(--accent-green); white-space: nowrap; text-decoration: underline; text-decoration-color: rgba(16, 185, 129, 0.35); text-underline-offset: 3px; flex-shrink: 0; } .install-more-link:hover { color: var(--text-light); text-decoration-color: var(--accent-green); } ``` -------------------------------- ### Deep Merge Example for LSP Settings (Initialization Options) Source: https://github.com/sinelaw/fresh/blob/master/docs/configuration/index.md Demonstrates adding initialization options for an LSP server, such as for Rust, without repeating the default command. This leverages the deep merge behavior of the 'lsp' configuration map. ```json { "lsp": { "rust": { "initialization_options": { "checkOnSave": { "command": "clippy" } } } } } // Result: command="rust-analyzer" (from defaults) + your initialization_options ``` -------------------------------- ### Reproduce LSP Issues with Clangd Source: https://github.com/sinelaw/fresh/blob/master/docs/internal/LSP_HEURISTIC_EVAL_CLANGD.md Steps to set up the environment, build the editor, and run the evaluation with clangd. Ensure prerequisites are installed and the editor is built in debug mode. ```bash # Prerequisites sudo apt-get install -y clangd git clone --depth 1 https://github.com/fmtlib/fmt /tmp/fmt mkdir -p /tmp/fmt/build && (cd /tmp/fmt/build && \ cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DFMT_TEST=OFF ..) cp /tmp/fmt/build/compile_commands.json /tmp/fmt/ # Build editor in debug mode (no --release) cd cargo build # Run in tmux tmux new-session -d -s eval -x 200 -y 50 tmux send-keys -t eval "cd /tmp/fmt && \ /target/debug/fresh --no-restore --log-file /tmp/fresh.log \ src/format.cc" Enter # Inspect tmux capture-pane -t eval -e -p # with ANSI tmux capture-pane -t eval -p # layout only ``` -------------------------------- ### Basic Multi-Server Setup (Primary + Linter) Source: https://github.com/sinelaw/fresh/blob/master/docs/internal/multi-lsp-design.md Configure multiple LSP servers for a language, such as a primary language server and a linter. This allows for distinct feature sets per server. ```json { "lsp": { "typescript": [ { "command": "typescript-language-server", "args": ["--stdio"] }, { "command": "vscode-eslint-language-server", "args": ["--stdio"], "only_features": ["diagnostics", "code_action"] } ] } } ``` -------------------------------- ### Configure LSP for a New Language (C# Example) Source: https://github.com/sinelaw/fresh/blob/master/docs/features/lsp.md Add support for a new language by defining its file extensions in the `languages` section and configuring its language server command in the `lsp` section of `config.json`. The language name must match in both sections. ```json { "languages": { "csharp": { "extensions": ["cs"], "grammar": "c_sharp", "comment_prefix": "//", "auto_indent": true } }, "lsp": { "csharp": { "command": "/path/to/csharp-language-server", "args": [], "enabled": true } } } ``` -------------------------------- ### Copy Install Pill Code Source: https://github.com/sinelaw/fresh/blob/master/homepage/index.html Copies the code from an install pill element and shows a confirmation popup. ```javascript function copyInstallPill(el) { const code = el.querySelector('code'); const popup = el.querySelector('.copied-popup'); if (!code) return; navigator.clipboard.writeText(code.textContent).then(() => { if (popup) { popup.classList.add('show'); setTimeout(() => popup.classList.remove('show'), 1500); } }); } ``` -------------------------------- ### Install Flatpak and flatpak-builder Source: https://github.com/sinelaw/fresh/blob/master/crates/fresh-editor/flatpak/README.md Installs the necessary Flatpak tools on Debian/Ubuntu, Fedora, or Arch Linux systems. ```bash sudo apt install flatpak flatpak-builder ``` ```bash sudo dnf install flatpak flatpak-builder ``` ```bash sudo pacman -S flatpak flatpak-builder ``` -------------------------------- ### Streaming Process Execution with Live Output Example Source: https://github.com/sinelaw/fresh/blob/master/docs/internal/ssh-remote-editing-design.md Shows how to execute a process and receive its live output, including stdout, stderr, and the final exit code. ```json → {"id": 1, "m": "exec", "p": {"cmd": "rg", "args": ["TODO", "."]}} ← {"id": 1, "d": {"out": "src/main.rs:10:// TODO fix"}} ← {"id": 1, "d": {"out": "src/lib.rs:20:// TODO test"}} ← {"id": 1, "d": {"err": "some warning"}} ← {"id": 1, "r": {"code": 0}} ``` -------------------------------- ### Basic CMake Project Setup Source: https://github.com/sinelaw/fresh/blob/master/crates/fresh-editor/tests/fixtures/syntax_highlighting/CMakeLists.txt Sets the minimum required CMake version, project name, version, and languages. ```cmake cmake_minimum_required(VERSION 3.20) project(HelloWorld VERSION 1.0.0 LANGUAGES CXX) ``` -------------------------------- ### Example .fresh-tour.json Configuration Source: https://github.com/sinelaw/fresh/blob/master/docs/internal/code-tour-design.md This JSON file defines the structure and content of a Fresh code tour. It includes metadata like title and description, schema version, and a list of steps, each with its own ID, title, file path, line range, and explanation. ```json { "$schema": "./tour-schema.json", "title": "Fresh Plugin System Tour", "description": "Learn how plugins work in Fresh - from loading to execution", "schema_version": "1.0", "commit_hash": "ee3bda2", "steps": [ { "step_id": 1, "title": "Plugin Entry Point", "file_path": "crates/fresh-plugin-runtime/src/backend/quickjs_backend.rs", "lines": [1, 50], "explanation": "## QuickJS Backend\n\nThis module provides the JavaScript runtime for executing TypeScript plugins.\n\n**Key concepts:**\n- Plugins run in a sandboxed QuickJS environment\n- TypeScript is transpiled to JavaScript using oxc\n- The `JsEditorApi` struct exposes editor functionality to plugins", "overlay_config": { "type": "block", "focus_mode": true } }, { "step_id": 2, "title": "Plugin Command System", "file_path": "crates/fresh-core/src/api.rs", "lines": [735, 800], "explanation": "## PluginCommand Enum\n\nPlugins communicate with the editor through commands.\n\nEach variant represents an action the plugin can request:\n- `InsertText` - Insert text at a position\n- `AddOverlay` - Add visual decorations\n- `OpenFile` - Navigate to a file\n\nCommands are sent through a channel and processed by the editor's main loop." } ] } ``` -------------------------------- ### LSP Configuration with Initialization Options Source: https://github.com/sinelaw/fresh/blob/master/docs/plugins/development/language-packs.md Example of configuring a Language Server Protocol (LSP) server with custom initialization options for specific features, such as Cargo build scripts in rust-analyzer. ```json "lsp": { "command": "rust-analyzer", "args": [], "autoStart": true, "initializationOptions": { "cargo": { "buildScripts": { "enable": true } } } } ``` -------------------------------- ### Install Fresh Editor via Homebrew (macOS) Source: https://github.com/sinelaw/fresh/blob/master/homepage/index.html Install the Fresh Editor on macOS using the Homebrew package manager. ```bash brew install sinelaw/fresh/fresh-editor ``` -------------------------------- ### Auto-start LSP Configuration Source: https://github.com/sinelaw/fresh/blob/master/docs/internal/LSP_HEURISTIC_EVAL_CLANGD.md Recommendation to make `auto_start=true` the default for installed LSP servers or to display a persistent 'LSP: off' badge if auto-start is disabled. ```text Auto-start LSP per-language by default (or make `auto_start=true` the documented default for servers the user has actually installed). If `auto_start=false`, render a persistent clickable `LSP: off` badge in the status bar whenever the buffer's language has a configured server. *Fixes H-1.* ``` -------------------------------- ### CSS for Install More Link Source: https://github.com/sinelaw/fresh/blob/master/homepage/index.html Styles for a link that allows users to find more installation options. It has a hover effect for visual feedback. ```css .install-more-link { color: var(--accent-green); font-size: 1.25rem; font-weight: 600; white-space: nowrap; text-decoration: underline; text-underline-offset: 4px; transition: all 0.2s; } .install-more-link:hover { color: var(--text-light); } ``` -------------------------------- ### Current Serial Plugin Loading Flow Source: https://github.com/sinelaw/fresh/blob/master/docs/internal/parallel-plugin-loading.md Illustrates the sequential steps involved in loading each plugin, including file I/O, transpilation, and execution. ```pseudocode for each plugin_dir: for each .ts/.js file (filesystem order): 1. read_to_string(path) # blocking I/O 2. read i18n JSON # blocking I/O 3. transpile_typescript(source) # CPU-bound (oxc) or bundle_module(path) # CPU-bound (oxc + dependency resolution) 4. execute_js(js_code) # QuickJS execution (side effects) ``` -------------------------------- ### Option C: Primary + add-on model Source: https://github.com/sinelaw/fresh/blob/master/docs/internal/multi-lsp-design.md Configure a primary LSP server and then specify additional 'add-on' servers in an `addons` array. This model is fully backward compatible but has limitations on overriding primary server features. ```json { "lsp": { "typescript": { "command": "typescript-language-server", "args": ["--stdio"], "addons": [ { "command": "vscode-eslint-language-server", "args": ["--stdio"], "only_features": ["diagnostics", "code_action"] } ] } } } ``` -------------------------------- ### Install Tab CSS Source: https://github.com/sinelaw/fresh/blob/master/homepage/index.html Styles the tabs used for different operating systems in the installation section. Includes active state styling. ```css .install-tabs { display: flex; gap: 4px; margin-bottom: 8px; } .install-tab { background: transparent; border: 1px solid var(--border-color); border-radius: 6px; color: var(--text-muted); font-family: inherit; padding: 6px 14px; cursor: pointer; transition: border-color 0.15s, color 0.15s, background 0.15s; } .install-tab:hover { color: var(--text-light); border-color: #333; } .install-tab.active { color: var(--accent-green); border-color: var(--accent-green); background: rgba(16, 185, 129, 0.08); } ``` -------------------------------- ### Install Dev Container CLI Source: https://github.com/sinelaw/fresh/blob/master/docs/features/devcontainer.md Install the devcontainer CLI globally using npm. This is a prerequisite for Fresh to shell out to devcontainer commands. ```bash npm install -g @devcontainers/cli ``` -------------------------------- ### Flow D: Launch with named session AND file arguments Source: https://github.com/sinelaw/fresh/blob/master/docs/internal/hot-exit-improvements-plan.md This flow outlines the behavior when 'fresh' is launched with both a named session and file arguments. It details how the system connects to an existing server or starts a new one, restores the session state, and then incorporates the specified file arguments, ensuring they are either focused if already open or appended to the tab bar. ```text User runs: fresh -a mysession file.txt ↓ ┌─ Server for 'mysession' already running? │ YES → Connect to server │ → Send OpenFiles control message for file.txt │ → Server opens file.txt (appends to tab bar, focuses it) │ │ NO → Start new server (same as Flow C) │ → Restore workspace + hot exit recovery │ → Open file.txt: │ - If already in restored tabs, focus it │ - Otherwise append to tab bar and focus └─ ``` -------------------------------- ### Programmatic Integration with Fresh Source: https://github.com/sinelaw/fresh/blob/master/docs/features/session-persistence.md Integrate Fresh's '--wait' behavior with other tools. This example shows how to use it in a code review script and to step through 'grep' matches. ```bash # Code review script for file in $(git diff --name-only HEAD~1); do fresh --cmd session open-file . "$file@\"Review this file\"" --wait done ``` ```bash # Step through grep matches grep -rn "TODO" src/ | while IFS=: read -r file line _; do fresh --cmd session open-file . "$file:$line@\"TODO found here\"" --wait done ``` -------------------------------- ### Install Fresh Editor via Brew Source: https://github.com/sinelaw/fresh/blob/master/README.md Use this command to install Fresh on macOS and compatible Linux distributions using Homebrew. ```bash brew tap sinelaw/fresh brew install fresh-editor ``` -------------------------------- ### Quick Start: Activate and Use Fake CLI Source: https://github.com/sinelaw/fresh/blob/master/scripts/fake-devcontainer/README.md Activate the fake devcontainer CLI by sourcing the activate script, then verify its availability with 'which'. Subsequently, create a dummy devcontainer.json and run the fake CLI against a workspace. ```bash source scripts/fake-devcontainer/activate.sh which devcontainer which docker mkdir -p /tmp/wkspc/.devcontainer cat > /tmp/wkspc/.devcontainer/devcontainer.json <<'JSON' { "name": "fake", "image": "mcr.microsoft.com/devcontainers/base:ubuntu", "forwardPorts": [8080, 5432], "initializeCommand": "echo init >&2", "postCreateCommand": "echo postcreate >&2" } JSON ./target/debug/fresh /tmp/wkspc ``` -------------------------------- ### Basic Settings-like Layout with Column and Row Source: https://github.com/sinelaw/fresh/blob/master/docs/internal/UNIFIED_UI_FRAMEWORK_PLAN.md Demonstrates constructing a typical settings-like layout using `Column` and `Row`. `Fixed` is used for explicit sizing of header and footer, while `Fill` allows content to take available space. ```rust Column::new() .child(header.height(Fixed(1))) .child( Row::new() .child(sidebar.width(Fixed(30))) .child(content) // Defaults to Fill ) .child(footer.height(Fixed(1))) ```