1a2ad98c33
Runnable skeleton per AGENT.md: Echo server (/, /help, /healthz, /api/repos), read-only repo scanner with in-memory index, the internal/git boundary, the <repo-list> web component with design tokens, and dev tooling (Dockerfile, docker-compose, air, .env.example). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
32 lines
802 B
Go
32 lines
802 B
Go
// Package render wires Go html/template page shells into Echo. The server emits
|
|
// the page shell and declares web components; the components fetch their own
|
|
// data (AGENT.md §1.1, §2).
|
|
package render
|
|
|
|
import (
|
|
"html/template"
|
|
"io"
|
|
"path/filepath"
|
|
|
|
"github.com/labstack/echo/v4"
|
|
)
|
|
|
|
// Templates implements echo.Renderer over the templates in a directory.
|
|
type Templates struct {
|
|
tmpl *template.Template
|
|
}
|
|
|
|
// New parses every *.html file in dir.
|
|
func New(dir string) (*Templates, error) {
|
|
t, err := template.ParseGlob(filepath.Join(dir, "*.html"))
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &Templates{tmpl: t}, nil
|
|
}
|
|
|
|
// Render satisfies echo.Renderer.
|
|
func (t *Templates) Render(w io.Writer, name string, data any, _ echo.Context) error {
|
|
return t.tmpl.ExecuteTemplate(w, name, data)
|
|
}
|