web.ui #
HeroPrompt Web UI
A clean web interface for creating and managing AI prompts with file and workspace management.
Overview
HeroPrompt provides a VS Codeβstyle interface to browse files, organize workspaces, and generate AI prompts. It combines a modern UI with intelligent file handling and flexible prompt generation.
Features
- π¨ Modern UI: Light/dark themes, responsive layout, smooth animations
- π Workspaces: Create, update, delete, and persist workspaces
- ποΈ File Explorer: Tree view, filtering, expand/collapse, multi-select
- π Preview: Card-based file previews with metadata and syntax highlighting
- π Prompt Generation: Build structured AI prompts from selected files
Usage
./cli/compile.vsh ##./hero web ##
- Create a workspace β select files β preview β generate prompts
- Manage workspaces (create, update, delete) via UI
fn detect_lang #
fn detect_lang(path string) string
Language detection utility for code files
fn new #
fn new(args FactoryArgs) !&App
fn render_chat_alt #
fn render_chat_alt(app &App) !string
fn render_heroscript_alt #
fn render_heroscript_alt(app &App) !string
Render HeroScript page
fn start #
fn start(args FactoryArgs) !
Start the webserver (blocking)
struct App #
struct App {
veb.StaticHandler
pub mut:
title string
menu []MenuItem
port int
}
The App holds server state and config
fn (App) root #
fn (app &App) root(mut ctx Context) veb.Result
Redirect root to /admin
fn (App) serve_colors_css #
fn (app &App) serve_colors_css(mut ctx Context) veb.Result
Serve shared static assets (colors.css, main.css, theme.js)
fn (App) serve_main_css #
fn (app &App) serve_main_css(mut ctx Context) veb.Result
fn (App) serve_theme_js #
fn (app &App) serve_theme_js(mut ctx Context) veb.Result
fn (App) admin_index #
fn (app &App) admin_index(mut ctx Context) veb.Result
Admin home page
fn (App) admin_section #
fn (app &App) admin_section(mut ctx Context, path string) veb.Result
Catch-all content under /admin/*
fn (App) api_test #
fn (app &App) api_test(mut ctx Context) veb.Result
Test API endpoint to verify routing works
struct Context #
struct Context {
veb.Context
}
Public Context type for veb
struct FactoryArgs #
@[params]
struct FactoryArgs {
pub mut:
name string = 'default'
host string = 'localhost'
port int = 9999
title string = 'Admin'
menu []MenuItem
open bool
}
Factory args
struct MenuItem #
struct MenuItem {
pub:
title string
href string
children []MenuItem
}
Simple tree menu structure