Skip to content

SDK: NavItem + WebBundle + ManifestUI #83

Description

@I-am-nothing

Scope

UI metadata so the host dashboard (Next.js + module federation) can render module sidebar entries and locate module remote bundles.

API additions to `mirrorstack.go`

```go
func NavItem(spec NavItemSpec)
func (m *Module) NavItem(spec NavItemSpec)

func WebBundle(url string) // module federation remoteEntry.js URL
func (m *Module) WebBundle(url string)
```

Registry types

```go
type NavItemSpec struct {
ID string `json:"id"`
Title string `json:"title"`
Path string `json:"path"`
Icon string `json:"icon,omitempty"`
ParentGroup string `json:"parentGroup,omitempty"`
Order int `json:"order,omitempty"`
}
```

Accumulator: `navItems []NavItemSpec`, `webBundle string` (set-once). Adders: `AddNavItem`, `SetWebBundle`.

Manifest changes

```go
UI ManifestUI `json:"ui"`

type ManifestUI struct {
NavItems []registry.NavItemSpec `json:"navItems"`
WebBundle string `json:"webBundle,omitempty"`
}
```

What is NOT included (deliberately)

  • `ms.Page()` — pages auto-discovered from `web/platform/pages/**/page.tsx` by future `@mirrorstack/vite-plugin` (see `app-modules/app-mod-media/web/vite.config.ts` for today's manual federation exposes).
  • `ms.Contribute()` — contributions auto-discovered from `web/platform/contributions//.tsx`.

Go SDK declares only what the frontend build can't infer: sidebar metadata + remote bundle URL.

Acceptance

  • `go test ./...` passes with cases for NavItem dedup, WebBundle set-once, manifest JSON shape
  • Module declaring nav + bundle → manifest `ui.navItems[]` populated, `ui.webBundle` present
  • Empty case serializes as `"ui":{"navItems":[]}`
  • Godoc examples for both helpers

Depends on

Part of the #14 orchestration work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions