ui/

directory
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: May 2, 2026 License: MIT

README

ui/

Top-level directory for CogOS web UI surfaces.

Convention

Each UI surface is its own Go package. The package owns:

  • The static HTML file (no build step, no external dependencies)
  • An embed.go wrapper that embeds the HTML via //go:embed
  • A small public API: Bytes() []byte and Handler() http.Handler

The kernel's serve.go imports the package and mounts Handler() at the appropriate route — no handler logic lives inside serve.go itself.

Surfaces

Package Route Description
ui/dashboard GET / Main web dashboard
ui/canvas GET /canvas Infinite-canvas spatial interface

Why separate packages?

Go's //go:embed directive is package-local: it can only embed files in or below the package directory. Moving HTML assets to a top-level ui/ directory while keeping the embed in internal/engine/ would require relative path traversal, which //go:embed does not support. Making each surface its own package keeps the embed, the HTML, and the handler co-located and importable from anywhere in the module.

Out of scope

  • Build pipelines (Vite, npm, etc.) — these are single-file static surfaces.
  • The cogfield panel: consumed via HTTP from cogos-dev/cogfield, not embedded here.
  • API-explorer / manifest-driven panel discovery: tracked in issue #98.

Directories

Path Synopsis
Package canvas embeds the CogOS canvas view and exposes it as a net/http handler.
Package canvas embeds the CogOS canvas view and exposes it as a net/http handler.
Package dashboard embeds the CogOS web dashboard and exposes it as a net/http handler.
Package dashboard embeds the CogOS web dashboard and exposes it as a net/http handler.

Jump to

Keyboard shortcuts

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