Skip to content

web.heroprompt #

fn new #

fn new(args ServerArgs) !&App

new creates a new HeroPrompt app instance.

fn start #

fn start(args ServerArgs) !

start starts the web server (blocking).

struct App #

struct App {
	veb.StaticHandler
pub mut:
	title            string
	port             int
	backend          &heroprompt_backend.HeropromptBackend = unsafe { nil }
	active_workspace string
	logger           logger.Logger
}

App holds server state and configuration.

fn (App) api_activate_workspace #

fn (mut app App) api_activate_workspace(mut ctx Context, id string) veb.Result

fn (App) api_add_dir #

fn (mut app App) api_add_dir(mut ctx Context, id string) veb.Result

Directory Endpoints

fn (App) api_add_repo #

fn (mut app App) api_add_repo(mut ctx Context, id string) veb.Result

fn (App) api_create_workspace #

fn (mut app App) api_create_workspace(mut ctx Context) veb.Result

fn (App) api_delete_workspace #

fn (mut app App) api_delete_workspace(mut ctx Context, id string) veb.Result

fn (App) api_generate_context #

fn (mut app App) api_generate_context(mut ctx Context, id string) veb.Result

Context Generation Endpoints

fn (App) api_get_file_content #

fn (mut app App) api_get_file_content(mut ctx Context) veb.Result

File Content Endpoints

fn (App) api_get_files #

fn (mut app App) api_get_files(mut ctx Context, id string) veb.Result

fn (App) api_get_workspaces #

fn (mut app App) api_get_workspaces(mut ctx Context) veb.Result

Workspace Endpoints

fn (App) api_remove_dir #

fn (mut app App) api_remove_dir(mut ctx Context, ws_id string, dir_id string) veb.Result

fn (App) api_remove_repo #

fn (mut app App) api_remove_repo(mut ctx Context, ws_id string, repo_id string) veb.Result

fn (App) api_rename_workspace #

fn (mut app App) api_rename_workspace(mut ctx Context, id string) veb.Result

fn (App) index #

fn (app &App) index(mut ctx Context) veb.Result

index serves the main HeroPrompt interface.

fn (App) log_api #

fn (mut app App) log_api(message string)

log_api logs an API-related message.

fn (App) log_api_error #

fn (mut app App) log_api_error(message string)

log_api_error logs an API error.

fn (App) log_error #

fn (mut app App) log_error(message string)

log_error logs an error message.

fn (App) log_info #

fn (mut app App) log_info(message string)

log_info logs an informational message.

struct Context #

struct Context {
	veb.Context
}

Context is the veb request context.

struct ServerArgs #

@[params]
struct ServerArgs {
pub mut:
	name           string = 'default'
	host           string = 'localhost'
	port           int    = 8888
	title          string = 'HeroPrompt'
	open           bool
	log_path       string = '/tmp/heroprompt_logs'
	console_output bool   = true
}

ServerArgs specifies options for creating a HeroPrompt server.