Local Development
Local Development
Since the Statusline Editor is a client-side web application built with vanilla JavaScript, there are no build steps, compilers, or heavy dependencies required to start developing.
Getting Started
-
Clone the repository:
git clone https://github.com/buluktaev/statusline-editor.git cd statusline-editor -
Launch the editor: Simply open
index.htmlin your preferred web browser.Note: While the app runs fine via the
file://protocol, using a local development server (like the Live Server extension in VS Code orpython3 -m http.server) is recommended for a more consistent experience with asset loading.
Project Structure
To modify the editor or add new statusline segments, familiarize yourself with the modular file structure:
js/state.js: Contains the default configuration (DEFAULTS) and the mock data (MOCK) used for the live preview.js/preview.js: Controls how blocks are rendered in the "Terminal" window UI.js/generator.js: Contains the logic that translates your UI configuration into the final Bash script.js/settings.js: Manages the property editors (colors, toggles, sliders) for each block.styles/: Modular CSS files for layout, terminal styling, and UI components.
Adding a New Block
To add a new statusline segment, follow these steps:
- Define the State: Add a new block object to the
DEFAULTS.blocksarray injs/state.js. - Add Preview Logic: Update the
renderPreview()function injs/preview.js. Add acaseto the switch statement to define how the block should appear in the browser. UseMOCKdata to simulate real-time values. - Update the Generator: In
js/generator.js, add the corresponding Bash logic to thegenerateScript()function. This ensures that when a user clicks "Copy," their script includes the new functionality. - Create Settings UI: In
js/settings.js, define the controls (color pickers, toggles) that allow users to customize your new block.
Testing Changes
The editor includes a "Live Preview" that reacts immediately to code changes if you are using a hot-reloading server.
To test the Output Script:
- Make your changes in the Editor UI.
- Click Copy Install Cmd in the Output panel.
- Paste and run the command in a test terminal.
- Run a Claude Code session to verify the statusline renders as expected:
claude
UI Components for Developers
When building new settings or blocks, use the utility functions provided in js/components.js to maintain visual consistency:
buildAnsiPalette(currentCode, onChange): Creates an interactive 256-color ANSI picker.buildToggle(checked, label, onChange): Creates a standardized switch.buildSegment(options, current, onChange): Creates a segmented button group (e.g., for selecting formats).buildCounter(value, min, max, onChange): Creates a +/- incrementer.