- Build-time discovery (D-028, the Caddy pattern): a module self-registers from init(); internal/modules/imports_gen.go (go:generate) blank-imports every module directory, so THE DIRECTORY IS THE SOURCE OF TRUTH - The registry: deterministic registration order, config-backed enable/disable (D-038), required modules, name-prefixed migrations, Mount() into the door - The name-collision guard now also fails a module named for a reserved level-1 workflow (SPEC-009 §13 Q-1) — access · static · api · media · ws · dev — derived from routing.ReservedWorkflows, `home` excepted (D-2) - home: the reference dashboard module, and the core Modules page
43 lines
1.6 KiB
Go
43 lines
1.6 KiB
Go
// Package home is MyDay's core dashboard module: the landing page a user
|
|
// reaches at /{GUID} (the registry default) and /{GUID}/home. It is built on
|
|
// the SPEC-008/D-037 skeleton — app.go (this manifest) · routing.go (routes) ·
|
|
// handlers.go (the handlers) — and is the reference module that proves build-time
|
|
// discovery works end to end.
|
|
package home
|
|
|
|
import (
|
|
"context"
|
|
|
|
"git.lohmar.co.uk/cclohmar/NextMyDay/internal/core/module"
|
|
)
|
|
|
|
// Module is the `home` manifest (SPEC-008 §4).
|
|
type Module struct{}
|
|
|
|
// init self-registers the module (D-028): the generated aggregator
|
|
// (internal/modules/imports_gen.go) blank-imports this package, so this runs at
|
|
// process start and the directory alone is what makes `home` exist.
|
|
func init() { module.Add(&Module{}) }
|
|
|
|
var _ module.Module = (*Module)(nil)
|
|
|
|
// Name is the PARAM2 segment (SPEC-002 §4.4: PARAM2 = "home").
|
|
func (*Module) Name() string { return "home" }
|
|
|
|
// Required is true: the routing model's default module is `home`
|
|
// (routing.DefaultModule), so disabling it would break /{GUID} for every user
|
|
// (D-038, AC-4).
|
|
func (*Module) Required() bool { return true }
|
|
|
|
// Kind marks the dashboard as core chrome rather than a domain module
|
|
// (SPEC-008 §4.8, listed on the Modules page §7).
|
|
func (*Module) Kind() string { return "core" }
|
|
|
|
// Migrations is empty: the dashboard owns no tables.
|
|
func (*Module) Migrations() []module.Migration { return nil }
|
|
|
|
// Register self-registers into the runtime registry.
|
|
func (m *Module) Register(r *module.Registry) error { return r.Add(m) }
|
|
|
|
// Start has no background work (the optional hook, SPEC-008 §4).
|
|
func (*Module) Start(context.Context) error { return nil }
|