controllers

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 6, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	LoginRedirect = "/"
)

Functions

func AuthMiddleware

func AuthMiddleware(next http.Handler) http.Handler

AuthMiddleware wraps an http.Handler with auth checking.

func GetUser

func GetUser(r *http.Request) *models.User

GetUser extracts the authenticated user from the request's session cookie.

func RequireAuth

func RequireAuth() application.Bouncer

RequireAuth returns a bouncer that redirects unauthenticated requests.

Types

type ActivityGroup

type ActivityGroup struct {
	Action string
	Items  []*models.LogEntry
}

ActivityGroup is a set of consecutive log entries with the same type.

func (ActivityGroup) Count

func (g ActivityGroup) Count() int

Count returns the number of items in the group.

func (ActivityGroup) First

func (g ActivityGroup) First() *models.LogEntry

First returns the most recent entry in the group (for timestamps).

func (ActivityGroup) Single

func (g ActivityGroup) Single() bool

Single returns true if the group has exactly one item.

type AgentController

type AgentController struct {
	application.BaseController
}

func Agent

func Agent() (string, *AgentController)

func (*AgentController) Chat

func (*AgentController) Conversations

func (c *AgentController) Conversations() []*models.Conversation

func (*AgentController) DeleteConversation

func (c *AgentController) DeleteConversation(w http.ResponseWriter, r *http.Request)

func (AgentController) Handle

func (*AgentController) HasAgent

func (c *AgentController) HasAgent() bool

func (*AgentController) ListConversations

func (c *AgentController) ListConversations(w http.ResponseWriter, r *http.Request)

func (*AgentController) LoadConversation

func (c *AgentController) LoadConversation(w http.ResponseWriter, r *http.Request)

func (*AgentController) NewConversation

func (c *AgentController) NewConversation(w http.ResponseWriter, r *http.Request)

func (*AgentController) Setup

func (c *AgentController) Setup(app *application.App)

type AuthController

type AuthController struct {
	application.BaseController
}

func Auth

func Auth() (string, *AuthController)

func (*AuthController) ChangePassword

func (c *AuthController) ChangePassword(w http.ResponseWriter, r *http.Request)

func (*AuthController) CreateAccount

func (c *AuthController) CreateAccount(w http.ResponseWriter, r *http.Request)

func (*AuthController) CurrentUser

func (c *AuthController) CurrentUser() *models.User

func (AuthController) Handle

func (*AuthController) HasError

func (c *AuthController) HasError() bool

func (*AuthController) Login

func (c *AuthController) Login(w http.ResponseWriter, r *http.Request)

func (*AuthController) Logout

func (c *AuthController) Logout(w http.ResponseWriter, r *http.Request)

func (*AuthController) NeedsSetup

func (c *AuthController) NeedsSetup() bool

func (*AuthController) Setup

func (c *AuthController) Setup(app *application.App)

type ClaudeProcess

type ClaudeProcess struct {
	PID     string
	Command string
	Running bool
}

ClaudeProcess represents a running Claude Code instance.

type DashboardController

type DashboardController struct {
	application.BaseController
}

func Dashboard

func Dashboard() (string, *DashboardController)

func (*DashboardController) APIServicesStatus

func (c *DashboardController) APIServicesStatus(w http.ResponseWriter, r *http.Request)

func (*DashboardController) APIStats

func (c *DashboardController) APIStats(w http.ResponseWriter, r *http.Request)

func (*DashboardController) ActiveTasks

func (c *DashboardController) ActiveTasks() []*models.Task

ActiveTasks returns user-created task checklist items.

func (*DashboardController) AvailableRepos

func (c *DashboardController) AvailableRepos() []*models.Repository

AvailableRepos returns repos available for deployment.

func (*DashboardController) ClaudeProcesses

func (c *DashboardController) ClaudeProcesses() []ClaudeProcess

ClaudeProcesses checks for running Claude instances in the code-server container.

func (*DashboardController) Conversations

func (c *DashboardController) Conversations() []*models.Conversation

Conversations returns recent agent conversations.

func (*DashboardController) CronCreate

func (c *DashboardController) CronCreate(w http.ResponseWriter, r *http.Request)

func (*DashboardController) CronDelete

func (c *DashboardController) CronDelete(w http.ResponseWriter, r *http.Request)

func (*DashboardController) CronJobs

func (c *DashboardController) CronJobs() []internal.CronJob

CronJobs returns cron entries from code-server.

func (*DashboardController) CronList

func (c *DashboardController) CronList(w http.ResponseWriter, r *http.Request)

func (*DashboardController) Domain

func (c *DashboardController) Domain() string

func (DashboardController) Handle

func (*DashboardController) HasAgent

func (c *DashboardController) HasAgent() bool

HasAgent checks if the Claude Code CLI is authenticated.

func (*DashboardController) HasDomain

func (c *DashboardController) HasDomain() bool

func (*DashboardController) IsCoderRunning

func (c *DashboardController) IsCoderRunning() bool

func (*DashboardController) RecentActivity

func (c *DashboardController) RecentActivity() []ActivityGroup

RecentActivity returns log entries grouped by consecutive type.

func (*DashboardController) RepoCount

func (c *DashboardController) RepoCount() int

func (*DashboardController) Repositories

func (c *DashboardController) Repositories() []*models.Repository

Repositories returns all repos ordered by update time.

func (*DashboardController) RestartCoder

func (c *DashboardController) RestartCoder(w http.ResponseWriter, r *http.Request)

func (*DashboardController) Routes

func (c *DashboardController) Routes() []*models.Domain

Routes returns all domain records.

func (*DashboardController) RunningContainers

func (c *DashboardController) RunningContainers() []internal.RunningContainer

RunningContainers returns all running Docker containers for dashboard display.

func (*DashboardController) RunningServiceCount

func (c *DashboardController) RunningServiceCount() int

func (*DashboardController) ServicesByRepo

func (c *DashboardController) ServicesByRepo() map[string]int

ServicesByRepo returns a map of repo ID → service count from infra.json.

func (*DashboardController) Setup

func (c *DashboardController) Setup(app *application.App)

func (*DashboardController) SetupDomain

func (c *DashboardController) SetupDomain(w http.ResponseWriter, r *http.Request)

func (*DashboardController) Stats

func (*DashboardController) SystemStats

func (c *DashboardController) SystemStats() *internal.SystemStats

type ExplorerController

type ExplorerController struct {
	application.BaseController
	// contains filtered or unexported fields
}

func Explorer

func Explorer() (string, *ExplorerController)

func (*ExplorerController) Breadcrumbs

func (c *ExplorerController) Breadcrumbs() []FileEntry

func (*ExplorerController) Entries

func (c *ExplorerController) Entries() []FileEntry

func (*ExplorerController) File

func (c *ExplorerController) File() *SourceFile

func (ExplorerController) Handle

func (*ExplorerController) HasInfra

func (c *ExplorerController) HasInfra() bool

HasInfra returns true if the repo has an infra.json file.

func (*ExplorerController) Infra

func (c *ExplorerController) Infra() *InfraData

Infra reads and parses infra.json from the repo into typed display structures.

func (*ExplorerController) InstanceCount

func (c *ExplorerController) InstanceCount() int

InstanceCount returns the total number of instances from infra.json.

func (*ExplorerController) IsFile

func (c *ExplorerController) IsFile() bool

func (*ExplorerController) LinkedRoutes

func (c *ExplorerController) LinkedRoutes() []*models.Domain

LinkedRoutes returns domains associated with services from this repo.

func (*ExplorerController) LinkedRunningCount

func (c *ExplorerController) LinkedRunningCount() int

LinkedRunningCount returns the number of running services from this project.

func (*ExplorerController) LinkedServices

func (c *ExplorerController) LinkedServices() []internal.LocalService

LinkedServices returns services from this project's infra.json (cached per request).

func (*ExplorerController) NotFound

func (c *ExplorerController) NotFound() bool

func (*ExplorerController) Path

func (c *ExplorerController) Path() string

func (*ExplorerController) Repo

func (*ExplorerController) Setup

func (c *ExplorerController) Setup(app *application.App)

type FileEntry

type FileEntry struct {
	Name  string
	IsDir bool
	Path  string
	Size  string
}

type InfraData

type InfraData struct {
	Provider     string
	Region       string
	ServerGroups []InfraServerGroup
	ServiceList  []InfraServiceInfo
	Raw          string
}

InfraData holds parsed infra.json for template display.

type InfraInstanceInfo

type InfraInstanceInfo struct {
	Name   string
	IP     string
	Region string
	Role   string
}

type InfraServerGroup

type InfraServerGroup struct {
	Name      string
	Size      string
	Instances []InfraInstanceInfo
}

type InfraServiceInfo

type InfraServiceInfo struct {
	Name   string
	Image  string
	Source string
	Ports  string
}

type ReposController

type ReposController struct {
	application.BaseController
}

func Repos

func Repos() (string, *ReposController)

func (*ReposController) Clone

func (*ReposController) Delete

func (c *ReposController) Delete(w http.ResponseWriter, r *http.Request)

func (ReposController) Handle

func (*ReposController) Init

func (*ReposController) NewProject

func (c *ReposController) NewProject(w http.ResponseWriter, r *http.Request)

func (*ReposController) Pull

func (*ReposController) Setup

func (c *ReposController) Setup(app *application.App)

type RoutesController

type RoutesController struct {
	application.BaseController
}

func Routes

func Routes() (string, *RoutesController)

func (*RoutesController) AddRoute

func (c *RoutesController) AddRoute(w http.ResponseWriter, r *http.Request)

func (*RoutesController) CheckDNS

func (c *RoutesController) CheckDNS(w http.ResponseWriter, r *http.Request)

func (*RoutesController) DeleteRoute

func (c *RoutesController) DeleteRoute(w http.ResponseWriter, r *http.Request)

func (RoutesController) Handle

func (*RoutesController) Setup

func (c *RoutesController) Setup(app *application.App)

func (*RoutesController) UpdateRoute

func (c *RoutesController) UpdateRoute(w http.ResponseWriter, r *http.Request)

type ServicesController

type ServicesController struct {
	application.BaseController
}

func Services

func Services() (string, *ServicesController)

func (*ServicesController) AllServices

func (c *ServicesController) AllServices() []internal.LocalService

AllServices returns all services from all projects' infra.json files.

func (*ServicesController) AvailableRepos

func (c *ServicesController) AvailableRepos() []*models.Repository

AvailableRepos returns repos available for deployment.

func (*ServicesController) Delete

func (*ServicesController) Deploy

func (*ServicesController) EnvJSON

func (c *ServicesController) EnvJSON() string

EnvJSON returns the service env as a JSON string (for EnvEditor component).

func (ServicesController) Handle

func (*ServicesController) LaunchRemote

func (c *ServicesController) LaunchRemote(w http.ResponseWriter, r *http.Request)

func (*ServicesController) Logs

func (*ServicesController) Redeploy

func (c *ServicesController) Redeploy(w http.ResponseWriter, r *http.Request)

func (*ServicesController) Restart

func (*ServicesController) RunBinary

func (c *ServicesController) RunBinary(w http.ResponseWriter, r *http.Request)

func (*ServicesController) Service

Service returns the current service from infra.json + Docker state.

func (*ServicesController) ServiceDomainID

func (c *ServicesController) ServiceDomainID() string

ServiceDomainID returns the Domain record ID for DNS check.

func (*ServicesController) ServiceHistory

func (c *ServicesController) ServiceHistory() []*models.LogEntry

ServiceHistory returns recent log entries for this service.

func (*ServicesController) ServiceUptime

func (c *ServicesController) ServiceUptime() string

func (*ServicesController) SetDomain

func (c *ServicesController) SetDomain(w http.ResponseWriter, r *http.Request)

func (*ServicesController) Setup

func (c *ServicesController) Setup(app *application.App)

func (*ServicesController) Start

func (*ServicesController) Stop

func (*ServicesController) StopBinary

func (c *ServicesController) StopBinary(w http.ResponseWriter, r *http.Request)

func (*ServicesController) UpdateEnv

func (c *ServicesController) UpdateEnv(w http.ResponseWriter, r *http.Request)

func (*ServicesController) UpdateSettings

func (c *ServicesController) UpdateSettings(w http.ResponseWriter, r *http.Request)

func (*ServicesController) VolumesJSON

func (c *ServicesController) VolumesJSON() string

VolumesJSON returns the service volumes as a JSON string (for VolumeEditor component).

type SourceFile

type SourceFile struct {
	Name     string
	Path     string
	Content  string
	Lines    int
	LineNums []int
	Lang     string
}

type WorkController

type WorkController struct {
	application.BaseController
}

func Work

func Work() (string, *WorkController)

func (*WorkController) APICreateLogEntry

func (c *WorkController) APICreateLogEntry(w http.ResponseWriter, r *http.Request)

func (*WorkController) APICreateTask

func (c *WorkController) APICreateTask(w http.ResponseWriter, r *http.Request)

func (*WorkController) APIUpdateTaskStatus

func (c *WorkController) APIUpdateTaskStatus(w http.ResponseWriter, r *http.Request)

func (*WorkController) ActiveTasks

func (c *WorkController) ActiveTasks(w http.ResponseWriter, r *http.Request)

ActiveTasks returns user-created tasks as HTMX partial.

func (*WorkController) AgentHeartbeat

func (c *WorkController) AgentHeartbeat() string

func (*WorkController) AgentStatus

func (c *WorkController) AgentStatus() string

func (*WorkController) ApprovePlan

func (c *WorkController) ApprovePlan(w http.ResponseWriter, r *http.Request)

func (*WorkController) CleanupTasks

func (c *WorkController) CleanupTasks(w http.ResponseWriter, r *http.Request)

CleanupTasks removes all completed tasks.

func (*WorkController) ClearActivity

func (c *WorkController) ClearActivity(w http.ResponseWriter, r *http.Request)

ClearActivity removes all log entries.

func (*WorkController) CreateTask

func (c *WorkController) CreateTask(w http.ResponseWriter, r *http.Request)

func (*WorkController) DeleteTask

func (c *WorkController) DeleteTask(w http.ResponseWriter, r *http.Request)

func (*WorkController) DoneTasks

func (c *WorkController) DoneTasks() []*models.Task

func (WorkController) Handle

func (*WorkController) LogEntries

func (c *WorkController) LogEntries() []*models.LogEntry

func (*WorkController) Plans

func (c *WorkController) Plans() []*models.Plan

func (*WorkController) QuickCreateTask

func (c *WorkController) QuickCreateTask(w http.ResponseWriter, r *http.Request)

QuickCreateTask adds a manual checklist item from the dashboard.

func (*WorkController) RejectPlan

func (c *WorkController) RejectPlan(w http.ResponseWriter, r *http.Request)

func (*WorkController) Setup

func (c *WorkController) Setup(app *application.App)

func (*WorkController) Tasks

func (c *WorkController) Tasks() []*models.Task

func (*WorkController) TodoTasks

func (c *WorkController) TodoTasks() []*models.Task

func (*WorkController) ToggleTask

func (c *WorkController) ToggleTask(w http.ResponseWriter, r *http.Request)

ToggleTask marks a todo task as done or a done task back to todo.

func (*WorkController) UpdateTaskStatus

func (c *WorkController) UpdateTaskStatus(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL