Feat v0.6.3 dead code sweep (#38)
All checks were successful
CI/CD / detect-changes (push) Successful in 4s
CI/CD / test-frontend (push) Successful in 6s
CI/CD / test-sqlite (push) Successful in 2m46s
CI/CD / test-go-pg (push) Successful in 2m47s
CI/CD / build-and-deploy (push) Successful in 26s

Co-authored-by: Jeffrey Smith <jasafpro@gmail.com>
Co-committed-by: Jeffrey Smith <jasafpro@gmail.com>
This commit was merged in pull request #38.
This commit is contained in:
2026-03-31 12:37:47 +00:00
committed by xcaliber
parent a887b4c78b
commit 3d4228f868
130 changed files with 522 additions and 1215 deletions

View File

@@ -28,10 +28,10 @@ type AdminPageData struct {
}
// SettingsPageData is what the settings surface templates receive.
// Feature gates (BYOK, personas) moved to sw.auth.policies in v0.37.19.
// Feature gates (BYOK, personas) moved to sw.auth.policies.
type SettingsPageData struct {
Section string `json:"section"`
ConfigSections []ConfigSectionEntry `json:"config_sections,omitempty"` // v0.38.3
ConfigSections []ConfigSectionEntry `json:"config_sections,omitempty"`
}
// ── Loader registration ──────────────────────
@@ -39,7 +39,7 @@ type SettingsPageData struct {
// TeamAdminPageData is what the team-admin surface receives.
type TeamAdminPageData struct {
Section string `json:"section"`
ConfigSections []ConfigSectionEntry `json:"config_sections,omitempty"` // v0.38.3
ConfigSections []ConfigSectionEntry `json:"config_sections,omitempty"`
}
func (e *Engine) registerLoaders() {
@@ -91,7 +91,6 @@ func sectionCategory(section string) string {
}
// ── Settings loader ──────────────────────────
// v0.22.7: Reads feature gates from GlobalConfig to control
// which nav links/tabs are visible (BYOK, User Personas).
func (e *Engine) teamAdminLoader(c *gin.Context, s store.Stores) (any, error) {
@@ -117,7 +116,7 @@ func (e *Engine) settingsLoader(c *gin.Context, s store.Stores) (any, error) {
}, nil
}
// ── Config section discovery (v0.38.3) ───────
// ── Config section discovery ───────
//
// Packages declare a config_section in their manifest. This helper scans
// enabled packages and returns entries whose surfaces array includes the

View File

@@ -38,7 +38,7 @@ type Engine struct {
cfg *config.Config
stores store.Stores
loaders map[string]DataLoaderFunc
surfaces []SurfaceManifest // v0.25.0: registered surface definitions
surfaces []SurfaceManifest
devMode bool
}
@@ -95,25 +95,20 @@ type PageData struct {
User *UserContext
Data any // surface-specific data from loader
// v0.22.7: Theme + settings injection
Theme string // "dark", "light", or "" (= use default)
SurfaceSettings any // JSON-serialized to window.__SETTINGS__
// v0.25.0: Surface manifest — layout preset, components, etc.
Manifest *SurfaceManifest `json:"manifest,omitempty"`
// v0.25.0: Enabled surface IDs for conditional nav rendering.
EnabledSurfaces []string `json:"-"`
// v0.27.0: Extension surfaces for sidebar nav rendering.
ExtensionSurfaces []ExtensionNavItem `json:"-"`
// v0.22.7: Login/splash page fields
InstanceName string // branding: instance display name
LogoURL string // branding: custom logo URL
Tagline string // branding: tagline under instance name
RegistrationOpen bool // whether self-registration is enabled
AuthMode string // v0.24.1: "builtin", "mtls", "oidc"
AuthMode string // "builtin", "mtls", "oidc"
}
// SurfaceEnabled returns true if the given surface ID is in the EnabledSurfaces list.
@@ -137,7 +132,6 @@ type ExtensionNavItem struct {
// ConfigSectionEntry describes a package-declared config section for
// lazy-loading in Settings, Admin, or Team Admin surfaces.
// v0.38.3: manifest-driven discovery — no new tables or endpoints.
type ConfigSectionEntry struct {
PackageID string `json:"package_id"` // section key & asset path prefix
Label string `json:"label"` // nav link text
@@ -207,7 +201,7 @@ func New(cfg *config.Config, stores store.Stores) *Engine {
e.parseTemplates()
e.registerLoaders()
e.registerCoreSurfaces()
e.SeedSurfaces() // v0.25.0: Write core manifests to DB (preserves admin toggle state)
e.SeedSurfaces()
return e
}
@@ -278,7 +272,6 @@ func (e *Engine) parseTemplates() {
"toJSON": toJSON,
"eq": func(a, b string) bool { return a == b },
"contains": stringContains,
"roleFilterType": roleFilterType,
"esc": template.HTMLEscapeString,
"safeHTML": func(s string) template.HTML { return template.HTML(s) },
"join": strings.Join,
@@ -323,7 +316,6 @@ func (e *Engine) Render(c *gin.Context, name string, data PageData) {
data.Message = e.loadMessage()
data.Footer = e.loadFooter()
// v0.22.7: Default theme if not set
if data.Theme == "" {
data.Theme = "dark"
}
@@ -478,7 +470,6 @@ func (e *Engine) RegisterPageRoutes(base *gin.RouterGroup, mw PageRouteMiddlewar
registerRoutes(group, s, handler)
}
// v0.27.0: Extension surface catch-all — DB lookup at request time.
// No restart needed after installing new surfaces via admin API.
group.GET("/s/:slug", e.RenderExtensionSurface())
}
@@ -593,7 +584,6 @@ func stripPrefix(route, prefix string) string {
// RenderLogin serves the standalone login page.
func (e *Engine) RenderLogin() gin.HandlerFunc {
return func(c *gin.Context) {
// v0.22.7: Populate splash/login fields from global config
instanceName, logoURL, tagline := e.loadBranding()
regOpen := e.isRegistrationOpen()
@@ -620,8 +610,8 @@ type WorkflowPageData struct {
FormTemplateJSON string // typed form template JSON (empty if custom)
TotalStages int
CurrentStage int
SurfacePkgID string // v0.30.2: custom package surface override (empty = use StageMode)
BrandingJSON string // v0.35.0: workflow branding JSON (accent_color, logo_url, tagline)
SurfacePkgID string
BrandingJSON string
}
// WorkflowLandingPageData is passed to workflow-landing.html.
@@ -639,7 +629,7 @@ type WorkflowLandingPageData struct {
PersonaName string
PersonaIcon string
StageCount int
FirstStageMode string // custom | form_only | form_chat (v0.29.3)
FirstStageMode string // custom | form_only | form_chat
ResumeURL string // non-empty if visitor has an active session
}
@@ -659,7 +649,7 @@ func (e *Engine) RenderWorkflow() gin.HandlerFunc {
// Load session display name
sessionName := "Visitor"
// Load workflow stage info for form rendering (v0.29.3)
// Load workflow stage info for form rendering
var stageMode, stageName, formTplJSON, surfacePkgID, brandingJSON string
var totalStages, currentStage int
stageMode = "custom" // default
@@ -919,18 +909,6 @@ func stringContains(haystack []string, needle string) bool {
return false
}
// roleFilterType returns the model_type filter for a given role name.
func roleFilterType(role string) string {
switch role {
case "embedding":
return "embedding"
case "utility":
return "chat"
default:
return ""
}
}
// dict creates a map from alternating key/value pairs for template use.
func dict(pairs ...any) map[string]any {
m := make(map[string]any, len(pairs)/2)

View File

@@ -35,7 +35,6 @@ func (e *Engine) SeedSurfaces() {
}
log.Printf("[pages] Seeded %d core surfaces into registry", len(e.surfaces))
// v0.31.0: Clean up old "editor" core surface row.
// Editor is now an installable package — the old seed row would show a
// broken nav link until the package .pkg is uploaded via admin UI.
if sr, err := e.stores.Packages.Get(ctx, "editor"); err == nil && sr != nil && sr.Source == "extension" {