IdeaCms/BIBLE
IdeaCms — Project Bible
Single source of truth for what IdeaCms IS, is NOT, and the rules that keep it coherent. README.md says how to build/run; this says how to think about the system. Pending decisions that cannot be folded in yet would sit in
AMENDMENTS.md(normally empty).
1. The one sentence
IdeaCms is a single-deployment Blazor CMS — one App Service, one app pool, one database — that hosts many pages and goes live the moment you upload a .idea zip, with no redeploy and no app-pool restart.
2. The product promise
You ship capability by uploading or CLI'ing a .idea file (a plain, content-signed zip). The CMS reads whether it contains a Page, Plugin, Component, or Theme, registers it by convention, and it is live. The four kinds derive from one shared root IdeaBase.
- A Page is free-form. A Theme wraps it. Plugins activate site-wide behaviors. Components drop into specific positions. There are no zones, panes, slots, or grids (DotNetNuke's fixed-layout model is rejected).
- A Plugin is site-wide: selected per page in Admin → Page Properties (or inherited from the site's
plugins.default), it activates across the whole rendered page (e.g. Tooltip adds global tooltip behavior; OutfitFont loads a font family). A Plugin declares whether it renders before or after the body (§4.4). It may also be placed inline with<Plugin.X />on a one-off page. - A Component is lexically scoped: it renders at the exact
<Component.X />tag position in the page body. Components nest: a paired tag passes its inner markup to the outer component asChildContent. - Two authoring paths, one render path. A Data page (free-form
BodyHtml/PageCss/PageJsin the DB, zero deploy — the primary path) and a Code page (a compiledPageBasesubclass for genuine Blazor interactivity). A page can graduate Data ↔ Code as a row edit, never a schema change. - Every instance is configurable. A citizen's public, simple-typed
[Parameter]s are its instance settings, edited per instance in Admin and shared only by copy/paste (§4.5). - Never change, only enhance. Versions are whole numbers (
V1,V2); you shipV2alongsideV1and never mutate a shipped version. Coexisting versions are the never-break mechanism. - A page must never be invalid. A missing/disabled reference degrades to a visible placeholder and fires an Admin Inbox alert — never a crash.
3. What it is NOT
- NOT a zone/pane/slot/grid layout engine. Composition is lexical — the author places tags in free-form markup.
- NOT SemVer. No
1.5.11anywhere; whole-number versions only (HOUSE-LAW-1). NuGet transport uses{n}.0.0only because NuGet requires it; the CMS identity stays the integer. - NOT one-web-app-per-page. A whole standalone frontend collapses into a single Page (mindattic.com became the
frontpageData page; MindAttic.Legion.Frontend became the one-tagpersonaspage), not its own Site. Sites are for genuinely separate domains (§4.10). - NOT a per-page router. Pages resolve by
(SiteId, Slug)data lookup through one catch-allPageHost, never per-page routing — so a runtime-loaded.ideatype renders with zero router changes. - NOT the owner of sign-in. Authentication is the MindAttic.Authentication package (6.0.0, which also owns auth email and security alerts: SMTP from
MindAttic:Vault:Notifications:email, else a startup warning). Ideas hosts the reset pages (/forgot-password,/account/reset) and setsMindAttic:Auth:Reset:PublicBaseUrlper environment (story M.IDEA-US-F10) (HOUSE-LAW-7). What stays Ideas-owned is the Admin role, theCms.AuthorRawMarkupclaim, and the raw-content trust gate. - NOT hard-delete by default. Disable = exists-but-unusable; a version-specific delete is reference-guarded (HOUSE-LAW-2).
- NOT WebAssembly for uploaded packages. Uploaded
.ideatypes are Static or InteractiveServer only (a hard .NET boundary). - NOT a brace-token language.
{{ … }}is not part of the composition grammar; the tag form is (§4.4). - NOT a sandbox or showroom host. Nothing in the product resets or deletes a site's content on a timer. A demo is a separate, vanilla deployment with its own database (M.IDEA-LAW-11).
- NOT a by-type settings layer. There is no "settings for every instance of citizen X"; settings belong to one instance (§4.5).
- "Idea" is NOT a content kind. It names the shared base
IdeaBase, the.ideapackage, and the/_ideas/...asset route — never one of the content kinds.
4. Architecture canon
upload / CLI a .idea (content-signed zip; also fetched from a NuGet feed)
│
▼
┌──────────────────────────────────────────────────────────────────────────┐
│ IdeaCms.Blazor (Blazor Web App, global InteractiveServer) │
│ PageHost /{*slug} ─► ISiteResolver(host) ─► (SiteId,Slug) ─► Theme ─► render
│ CmsHead (@layer global, theme, page, component) │
│ /_ideas/{Kind}/{key}/{ver}/… /_media/{uid} /_health /_demo/reveal │
│ /admin (Admin policy) MindAttic.Authentication · Vault · Legion · Media │
│ CLI verbs: --export/--import/--compose-idealist, --extract/--upload-media │
└───────────┬──────────────────────────────────────┬──────────────────────────┘
│ uses │ uses
┌───────────▼────────────────┐ ┌────────────▼──────────────────────────┐
│ IdeaCms.Core │ │ IdeaCms.Packaging │
│ CmsDbContext (EF, SQL, │ │ manifest kernel + reader + validator │
│ temporal Pages, auth │ │ + CitizenValidator + packer + signer │
│ schema) │ │ + version resolver (pure, IO-free) │
│ catalog · install · ALC │ └────────────┬──────────────────────────┘
│ IncludeExpander · gate │ │
│ instance settings · sites │ ┌────────────▼──────────────────────────┐
│ .idealist import/export │ │ IdeaCms.Sdk (ma-idea CLI) │
└───────────┬────────────────┘ │ pack/inspect/list/install/verify/ │
│ references │ sign/nupkg │
┌───────────▼────────────────────────────────────────────────────────────────┐
│ IdeaCms.Abstractions (frozen v1 SDK, MAJOR pinned at 1) │
│ IdeaBase + PageBase/PluginBase/ThemeBase/ComponentBase, [Idea] [Uses] │
│ [Setting], IRenderContext, IPageTree, IComponentMetadataStore, IDemoAccess, │
│ ICmsContentSource/ITypeResolver/IRawContentGate seams │
│ refs ONLY Microsoft.AspNetCore.Components + System.Text.Json │
└────────────────────────────────────────────────────────────────────────────┘
First-party Themes/Plugins/Components live in library/ (its own solution and canon,
library/docs/BIBLE.md), packed to library/dist/*.idea and copied into the host's library/.
4.1 Projects
src/IdeaCms.Abstractions— the frozen v1 SDK:IdeaBase+ the four kind bases (PageBase/PluginBase/ThemeBase/ComponentBase),[Idea](incl.Slot),[Uses],[Setting],IRenderContext,IPageTree,IComponentMetadataStore,IDemoAccess,CmsInclude, discovery/catalog seams. References ONLYMicrosoft.AspNetCore.Components+System.Text.Json.src/IdeaCms.Core— EF entities,CmsDbContext(SQL Server, temporalPages, the authentication package's isolatedauthschema), convention discovery, persisted catalog, package install, raw-content gate,FreeFormPage/include expander, instance settings, site resolution,.idealistimport/export, the collectible-ALC type resolver, seed.src/IdeaCms.Packaging— the pure.ideawire contract: manifest kernel, reflection-only packer, zip-slip-guarded reader, manifest validator (incl. host-assemblybin/audit and retired categories),CitizenValidator,PackageSigner, SHA-256, version resolver.src/IdeaCms.Rendering—PageHost(the catch-all) andCmsHead(the cascade).src/IdeaCms.Sdk— thema-ideaCLI (pack / inspect / list / install / upgrade / verify / sign / nupkg).src/IdeaCms.Blazor— the Blazor Web App host:/admin,/_ideas,/_media,/_health,/_demo/reveal, the CLI verbs,BootProvisioning, Vault/Legion/Authentication/Media wiring.src/IdeaCms.Tests— the NUnit suite.library/— the first-party citizen library (library/IdeaCms.Library.slnx); builds independently of the CMS and references onlysrc/IdeaCms.Abstractions(Private=false,ExcludeAssets=runtime). Its own canon islibrary/docs/BIBLE.md(code MAIL).infra/— Bicep for the Azure estate;.github/workflows/—azure-deploy.ymlanddemo-reset.yml(§4.14);seed/— the company site's.idealistand the demo's front page.
4.2 Domain model — the NOUNS
IdeaBase— shared root of all content kinds.ContentKind—Page=0 · Plugin=1 · Theme=2 · Component=4. Ordinal 3 is reserved and never reused (M.IDEA-LAW-2).Page(src/IdeaCms.Core/Entities/Page.cs) — one durable EF row,PageKind {Data,Code}; Data columnsBodyHtml/PageCss/PageJs/BodyTrust; sharedSiteId/ParentId/Slug/ThemeKey/ThemeVersion;SeoMetaJson({title,description});ActivePluginsJson(array of"Plugin.key[@n]"; null = inherit the site'splugins.default,[]= none);WorkflowDefinitionId/WorkflowState. System-versioned temporal table.Site— a tenant:Key,HostBindings,IsDefault,DefaultThemeKey/DefaultThemeVersion,DefaultThemeMode(light|dark).Setting— Host- or Site-scoped key/value (page.frontpage,plugins.default,GlobalCss,nav.*,contact.action,social.*).CmsContentDefinition— the persisted catalog row:UNIQUE(Kind,Key,Version,Origin),Priority,IsShadowed, asset mount, raw bundle.InstalledPackage—.idearegistry row:(Category,Key,Version)unique, verbatim manifest, blob path, content hash (Sha256),Enabled.WidgetPlacementSettings(+…History) — a page's tagless instance-settings slots (theme,page,plugin:{key}), versioned with rollback.PageSlugHistory— old and vanity slugs that 301 to the page's current slug.WorkflowDefinition/WorkflowTransitionDef— named page state machines with role-gated transitions.ComponentMetadata— per-page, per-component JSON slots (e.g. thefrommdMarkdown a project page renders).AdminInboxMessage— dedup-by-DedupKey, severity/status, reopen-on-recurrence.- Media items — MindAttic.Storage rows addressed by uid, served at
/_media/{uid}(§4.11). - Identity is the triple
(ContentKind Kind, string Key, int Version)(M.IDEA-LAW-1).
4.3 Key services — the VERBS
CompiledContentSource/DiscoveryService(Core/Discovery) — convention discovery of compiled citizens into the catalog.ContentCatalog(Core/Discovery) — the one catalog; orderedICmsContentSourceproviders feed it; key lookups are case-insensitive.AlcAwareTypeResolver/CmsPackageLoadContext(Core/Discovery) — load.ideacitizens through a per-package collectibleAssemblyLoadContext; host types unify by reference identity.IncludeExpander/IncludeReferenceParser(Core/Rendering) — sanitize the body, then resolve citizen tags against the catalog; unresolved/disabled → placeholder linking to/admin/upload?missing=<reference>.RawContentGate(Core/Rendering) — the soleMarkupStringchokepoint and the HtmlSanitizer policy (§4.6).PageAssetCollector(Core/Rendering) — cascade-orders/dedupes a page's citizen css/scripts into<head>.PackageInstallService(Core/Services) — verify content signature → validate → checkrequires[]/minHostVersion→ registerInstalledPackage+ mirrored catalog row; idempotent, hash-conflict-rejecting, soft-disable, reload catalog (§4.8).ContentLifecycleService(Core/Services) — enable/disable + reference-guarded version-specific delete (body tags,uses[], andActivePluginsJsonall count as references).AdminInboxService/RenderAlertSink(Core/Services) — DB-backed dedup alerting; the render thread fire-and-forgets and never throws.PageAdminService/PageAuthoring(Core/Services) — page CRUD, soft-delete, publish, trust stamping, SEO metadata, slug-history writes, effective-plugin computation, UntrustedPageCssnormalization.PageMarkupValidator(Core/Services) — save-time page validation (§4.6).InstanceConfigService/BodyTagIndex— enumerate and edit a page's citizen instances (§4.5).SlugRedirectService,WorkflowService,WidgetInstanceSettingsService,PageHistoryService— §4.12.SiteResolver/SiteAdminService(Core/Sites,Core/Services) — §4.10.IdeaListImporter/IdeaListExporter(Core/Portability) — §4.9.SeedService(Core/Services) — idempotent upsert-by-key seed that never clobbers admin edits; converts any stored brace token to the tag form at startup; with an idealist configured, seeds only the structural minimum.CssConflictMerger/CssShorthandLinter(Core/Services) — §4.7.- Authentication —
AddMindAtticAuthentication<CmsDbContext>,UseMindAtticAuthentication(),MapMindAtticAuthEndpoints();IdeaCmsClaimsAugmentoradds the Admin role'sCms.AuthorRawMarkupclaim. The first admin is created from the Vault bootstrap token; Admin MFA is currently not required (MindAttic:Auth:Mfa:RequireForAdmin=false).
4.4 Composition grammar
In a Data page body, a citizen is placed with a PascalCase HTML tag:
<Component.Textbox /> <Plugin.Tooltip /> <Component.TabBoard alwaysShowTabPage="true" /> <Component.TabBoard data-version="2" /> <!-- pin a version; omit to float to latest --> <Component.Outer><Component.Inner /></Component.Outer> <!-- inner becomes ChildContent -->
- The kind segment is optional:
<Textbox />resolves as Component, then Plugin. An explicitkind="Plugin"attribute also selects the kind. Unknown kinds never become Page references. - A floating tag resolves the highest enabled version;
data-version="n"pins. A pinned version cannot be deleted while a page pins it; a floating reference blocks deletion only when it would orphan. - Other attributes are instance settings: a value matching a typed
[Parameter]coerces to bool/int/double/decimal/enum (nullable unwrapped); a failed conversion falls back to the raw value; unmatched attributes land in theCaptureUnmatchedValuesbag. One sharedEmitIncludepath serves data pages and<CmsInclude>in code pages, so both render identically. - Compiled citizens declare dependencies with
[Uses(ContentKind, "key", n)]; packages list them inuses[]asKind.key[@n](advisory: a miss raises an inbox alert at render) andrequires[](a hard install-time gate). - Plugin slots.
[Idea(Slot = PluginSlot.AfterBody)]renders a plugin after the body; the default isBeforeBody.PageHostpartitions active plugins by slot, keeping author order within each, and renders both passes inside the theme'sBodyhole so the theme's.pagewrapper frames header, breadcrumbs and footer too. - Brace tokens are not grammar.
SeedServiceconverts any{{ … }}still stored in a body into tags (parameters and versions kept), so old content never renders as visible text. - Shadow DOM is opt-in per Component (
UseShadowDom); seedocs/AUTHORING.md.
4.5 Instance settings
- A citizen's instance settings are its public, writable, simple-typed
[Parameter]s (bool, string, integer, floating, enum; nullable allowed).[Setting]adds the Admin label, group, order, help text,Multiline,Hidden, andCopyable = falsefor content (captions, links, image uids). A bool setting is how a citizen exposes an on/off feature. - A Component (or inline Plugin) instance is its tag, so its settings are that tag's attributes; Admin edits rewrite exactly that tag's attribute list (
BodyTagIndex) and save through the normal page save (trust stamping and history apply). - A Theme, a page/site-default Plugin, a Plugin a compiled Theme/Page composes by string id, and a Code page have no tag; their settings live in the page's
WidgetPlacementSettingsslots (theme,page,plugin:{key}).PageHostbinds each slot onto the citizen;IncludeRenderermergesplugin:{key}over the composing author's attributes;IRenderContext.GetInstanceSettingsJsonexposes them. - Unknown names and unparsable values are dropped on write and on bind.
- No by-type layer. Configuration is shared by Admin Copy / Paste Configuration between two instances of the same citizen; only
Copyablesettings travel, and a paste writes nothing until Save. - Admin's page tree expands each page into its instances (Page, Theme, theme-composed plugins, page plugins or the site default, nested body tags), each with Edit / Copy / Paste. A signed-in Admin sees a hover-revealed cog on every content page that deep-links to
/admin/pages?page={id}. IdeaBase.AddSettingsDataemits<data hidden data-ma-settings="{kind.key}" value="{json}">so a citizen's script can read its settings live across in-circuit navigation.ThemeBasecarriesPagePadding(default.75rem 1rem) andPageMarginfor the.pagewrapper.
4.6 Trust, sanitization and validation
- Trust is stamped at write time (M.IDEA-LAW-5). Every page body, at every trust level, is run through HtmlSanitizer (
IRawContentGate.SanitizeBody) beforeIncludeExpanderbuilds a render tree; the expander's own per-node filter stays behind it as defense in depth. - Neither profile keeps
<script>, event handlers,javascript:/vbscript:/data:URLs, frames, forms, embeds or<style>in markup. Both keepclass,role,aria-*,data-*. Author trust additionally keeps citizen tags and their settings (minus handlers and executable-scheme values),id, a form-less<button>,target(forcedrel="noopener noreferrer"), and inlinestylethrough HtmlSanitizer's CSS sanitizer. Untrusted bodies keep no citizen tags. - Deliberate author JavaScript lives only in the Author-only Page JS field, never in markup.
<style>/<script>raw text is emitted as one markup frame, so<tag>-looking text inside it survives interactive re-render.- Validation, one rule set in three places. Page save —
PageMarkupValidator: every citizen tag resolves (else Error), every attribute is a declared setting or pass-through (else Warning), typed values fit (else Error), an Untrusted page's tags are flagged as non-rendering, andIRawContentGate.Auditlists what the sanitizer would remove. Library pack —CitizenValidator(called byPacker.Pack; a failing citizen produces no package): colliding or reserved setting names, JS witheval(/new Function(/document.write(/stringsetTimeout/setInterval, CSS withexpression(/javascript:/-moz-binding/behavior:. CI — every package in the host's committedlibrary/passes the pack checks and every page ofseed/mindattic-site.idealistvalidates with no Error and nothing sanitizer-stripped.
4.7 CSS cascade
CmsHeademits@layer global, theme, page, component;once, before any CSS, and wraps each tier in its named layer (inline text via@layer x { … }, external stylesheets via@import url(…) layer(x);). Layer precedence decides between tiers before specificity, so no tier needs!importantto beat a lower one; inlinestyle=""and!importantstay above the layered cascade (M.IDEA-LAW-4).- Component beats Page: a Component guarantees its own presentation whatever page it sits in.
CssConflictMergercollapses exact same-selector duplicate rule blocks within one CSS text, keeping every byte outside a merged group untouched and refusing any group whose shorthand usesvar()or whose properties it cannot round-trip (e.g. vendor-prefixed). It runs on UntrustedPageCssat save and on library CSS via--expand-css-shorthand; AuthorPageCssis stored verbatim and the sharedGlobalCssis never rewritten.CssShorthandLinteris a non-blocking save-time advisory for a shorthand co-occurring with some but not all of its longhands.
4.8 Packages: install, signing, distribution
- Content signature. Every
.ideacarriesidea.sig.json({algorithm, signerThumbprint, signature}): RSA-2048 RSASSA-PSS/SHA-256 over a canonical manifest of every entry's path + SHA-256. It is verified at the one choke point every install path shares (PackageInstallService.InstallAsync), before the manifest is trusted. The verifying key comes from the host's trust (VaultPackageSigningTrust, Vault bucketPackageSigning,signing-cert-public), never from the archive; the thumbprint is only a diagnostic. Failures throwPackageSignatureException(NotSigned/Malformed/UntrustedSigner/BadSignature). Unsigned packages are refused. - Content hash.
InstalledPackage.Sha256is the hash of the canonical manifest, so re-signing unchanged content is a no-op while any content change is detected. Same version + different content isHashConflict: nothing is written and an Admin Inbox alert is raised, unlessallowOverride. - Dependencies.
minHostVersionblocks install on an older host (MIN_HOST_VERSION_UNMET);requires[]must all be present and enabled before any byte is persisted (REQUIRES_UNMET). - Collisions. An upload whose
(Kind,Key)collides with a compiled citizen is refused unless an admin confirms the override. - Distribution. Each citizen is also an independent NuGet package, id
IdeaCms.{Category}.{Key}, version{n}.0.0, carrying the signed.ideaunchanged atcontent/{key}.idea. Publishing islibrary/tools/pack-all.ps1 -Sign→ma-idea nupkg→library/tools/publish-nuget.ps1.
4.9 Portability: .idealist and boot provisioning
- A
.ideamoves a citizen; a.idealist(zip:idealist.json+media/) moves what an author built with citizens and names which citizens a deployment should have. It carries exactly one site: settings, pages (body, trust, theme pin, plugin selection, instance-settings slots, SEO, role access, slug aliases), per-component metadata, media, and a Packages list. Packages[]is purely referential —Kind.key@version, version mandatory, never bytes. Entries resolve fromlibrary/, thenIdeaCms:PackagesDirs/--packages-dir(matched by manifest, not filename), then a NuGet feed (CompositeIdeaListPackageResolver; downloads cached inlibrary/.nuget-cache/).- Apply order: install Packages in listed order (each idempotent), then validate every page's
Uses[]against the catalog, then write media/site/settings/pages/metadata. An unmetUses[]throws with nothing written. - Reconciliation: pages match by
Uid, then(SiteId, Slug), both scoped to the target site, so an import adopts an independently seeded page and a page whose uid exists on another site gets a fresh uid (a copy, never a move). Media is adopted by SHA-256 and every media uid reference is remapped through an old→new map. Re-import is a no-op. The target site is matched by key and created when absent (--into-siteoverrides). - Trust: the bundle's
Authortrust is honoured but announced;--untrusteddowngrades it.--prune(soft-delete pages absent from the list) is opt-in. - CLI:
--export-idealist,--import-idealist,--compose-idealist. - Boot.
IdeaCms:Idealist(envIDEACMS_IDEALIST) absent = vanilla: install everything inlibrary/, best-effort. Present = custom: apply that idealist and abort startup on any failure (BootProvisioning.ApplyAsync).
4.10 Sites and domains
- One deployment can serve many domains.
ISiteResolverscores the request host against each site'sHostBindings(comma/semicolon/whitespace separated, case-insensitive, URL-tolerant, port-agnostic unless a port is named). Precedence:host:port→host→*.domain(never the apex) →*→ the default site. Ties break by the default flag, then lowest id. - A site with no bindings answers every host it is the default for, so a single-site install needs no configuration.
PageHostreads the host fromNavigationManager.BaseUri, notHttpContext(null after the circuit connects).CmsSiteContext.Hostcarries the request host.- The bare route
/forwards to the slug in the Site-scopepage.frontpagesetting, else the Host-scope one (defaultfrontpage). IPageTree.ChildrenOfSlugAsync(siteId, slug)scopes a slug lookup to a site;Guid.Emptyfalls back to the unscoped, ordered lookup.- Admin → Sites creates sites, edits bindings, moves the default, sets the default theme and theme mode, and probes "which site answers this host?" with the render path's rule. A binding another site claims is refused; a site with pages, or the default site, cannot be deleted.
X-Forwarded-Hostis not trusted: forwarded headers are accepted from any peer (KnownProxiescleared) and onlyX-Forwarded-For/-Protoare forwarded, because a client-supplied host must never choose the tenant. Enable it only after populatingKnownProxies.
4.11 Media
- A page references an asset only by
/_media/{uid}.Media:Providerchooses the store —local(default) orazure— without changing any markup or row. Azure needsMedia:Azure:ConnectionStringorBlobServiceUri(via Vault); without them startup fails closed. - When a store can mint a URL,
/_media/{uid}302s to a short-lived SAS (or, withPublicRead+PublicBaseUri, a plain cacheable URL) and blob storage serves Range requests; otherwise the app streams withAccept-Ranges/206, an ETag from the stored SHA-256 (304 on match),Last-Modified, andCache-Control.image/,text/,video/,audio/and PDF are inline dispositions. - Uploads hash in flight over one sequential pass and spill past
InlineThresholdBytes(2 MB); memory is bounded by the threshold, not the file. --extract-medialifts inline base64 out of bodies (→<Component.MediaImage uid="…" />) and stylesheets (→/_media/{uid}), deduplicating by SHA-256 and leaving undecodable data inline as a reported failure.--upload-media <file…>streams local files into the configured store.- Deleting media is soft; blobs are left behind. Nothing migrates existing inline rows into blob storage.
4.12 Page lifecycle: history, workflow, redirects
- History.
Pagesis a SQL Server system-versioned temporal table; Admin's Page History panel readsFOR SYSTEM_TIMEandRestoreAsynccopies a snapshot's content onto the current row, re-stamping trust from the restoring user. - Workflow.
WorkflowDefinition(name, initial state,IsDefault) + role-gatedWorkflowTransitionDefs.WorkflowService.TransitionPageAsyncvalidates the transition, checks the role (Admins bypass), and setsIsPublishedonly for the state namedPublished. Creating a default demotes the previous one. A manifest'sdefaultWorkflowis advisory and not enforced. - Slug history. Changing a slug writes a
PageSlugHistoryrow; vanity slugs are added idempotently.PageHostchecksSlugRedirectServicebefore returning 404 and writes a real 301 withLocationwhen the response has not started (falling back toNavigateTo). No self-redirects; unpublished or disabled targets do not redirect. - Tagless instance settings are versioned in
WidgetPlacementSettings+ history; rollback restores a snapshot while advancing the version.
4.13 Themes and light/dark mode
- Every Theme ships a light and a dark palette, each WCAG 2.2 AA. The active mode is
data-theme-mode="light"|"dark"on<html>; eachtheme.cssoverrides its palette for the other mode. Site.DefaultThemeModeis the first-visit default.App.razorresolves the site and sets the attribute server-side; a synchronous inline script, first in<head>, then applies the visitor's saved choice (localStoragemindattic.theme-mode), so neither first nor return visits flash the wrong mode.Plugin.ThemeToggle(BeforeBody) flips the mode and stores the choice.- First-party themes: Autumn, Cyberspace, Hardware, Ideas, Spring, Summer, Winter. A page whose theme key does not resolve falls back to the built-in
bootstraptheme.
4.14 Deployment and the public demo
- One build runs as two deployments on one Linux App Service plan:
mindattic(the company site, https://mindattic.azurewebsites.net) andmindattic-ideas-demo(a public, vanilla install, https://mindattic-ideas-demo.azurewebsites.net). Runbook:docs/DEPLOYMENT.md. infra/main.bicep(+infra/webapp.bicepper site) provisions the plan, both web apps, Azure SQL (Entra-only), a storage account (no shared keys, no public blobs), Key Vault, and role assignments.appName = mindattic-ideasis the name base of every shared resource. Bicep owns every app setting; Key Vault references live in the template andinfra/provision.ps1generates the secret values.- Passwordless. Each site has a system-assigned managed identity for SQL, Blob Storage and Key Vault. The app identity holds
db_datareader+db_datawriteronly, so schema changes come only from CI. - App-setting names are alphanumeric, because App Service on Linux rewrites
.and-in setting names; Authentication and Vault match keys by letters and digits. - CI (
.github/workflows/azure-deploy.yml, push tomain, GitHub OIDC): build (restore from the vendoredlib/local-packages/+ nuget.org, full NUnit suite, publish, generateseed/demo.idealistand the idempotent migration script) → migrate (company database and the demo template, Entra token, single-run firewall rule) → deploy the company site and wait until/_healthreports this commit ready and/answers → deploy the demo → reset the demo. The two sites never cold-start together on the single-core B1 plan. Deploy never proceeds after a migrate that ran and failed. - Startup: the server listens first, then runs the boot sequence (discovery, seed, admin bootstrap, provisioning) through
StartupGate: transient failures (SQL, socket, timeout, Azure identity) are retried with backoff, a permanent one exits with code 1, never an unhandled abort (exit 134). Until the sequence finishes every request but/_healthgets503 starting. /_healthis a liveness probe that never touches the database and answers as soon as the server listens;X-IdeaCms-ReadyandX-IdeaCms-Version(build + commit) report boot state.- The demo is reset hourly by
.github/workflows/demo-reset.yml: rotate the admin password, stop the demo and pin the new password, replace the demo database with a copy ofIdeaCmsDemoTemplate, empty its media, start it (its one boot on the empty database seedsadminfrom the new password), sign in for real, then publish the login. The demo identity reaches only its own vault and containers; the company identity can read one demo secret (credentials). Demo admins cannot run code: unsigned packages are refused and markup is sanitized. - Product hooks used by the demo, all inert unless configured:
MindAttic:Auth:Bootstrap:RequirePasswordChange=false;IdeaCms:Packages:StorageRoot;IDemoAccess(demo URL and status, never credentials);POST /_demo/revealreturns the login only for a server-verified Turnstile token bound to thedemo-revealaction, 5/min per IP,no-store, 503 when Turnstile keys are absent.
5. The Laws
Inherited. IdeaCms inherits every org-wide law in
MindAttic.HouseRules.mdby reference. Do not restate them here. Of particular weight: whole-number versioning (HOUSE-LAW-1), soft-disable (HOUSE-LAW-2), Vault credentials (HOUSE-LAW-3), Legion LLMs (HOUSE-LAW-4), guarded packaging (HOUSE-LAW-5), one-engine-many-front-doors (HOUSE-LAW-6), MindAttic.Authentication (HOUSE-LAW-7), and verified-DoD (HOUSE-LAW-8).
These are the project-specific laws:
- Naming & identity lock. A citizen's forever-identity is
(ContentKind Kind, string Key, int Version)— never the CLR type name. The four kinds are Page · Plugin · Theme · Component underIdeaBase; "Idea" is never a kind. MindAttic'sComponentBaseowns the bare name; Blazor's is aliasedBlazorComponentBase. On any future framework name clash, alias the framework side. - Frozen SDK, MAJOR=1 forever.
Abstractionsreferences onlyMicrosoft.AspNetCore.Components+System.Text.Json; its surface is append-only (enums grow by appending ordinals, attributes by optional init-only properties, interfaces by default methods). Ordinal 3 ofContentKindis reserved and never reused. - One render primitive, no zones, no routing. All rendering is
DynamicComponent/FreeFormPagethrough the singlePageHostcatch-all resolving(SiteId, Slug). No zones/panes/slots/grids; no per-page routes. Reserved routes live under/_(/_ideas,/_media,/_health,/_ma-auth,/_demo) so they can never shadow a page slug. - Fixed CSS cascade, enforced in one place (
CmsHead). GLOBAL → THEME → PAGE → COMPONENT → DOM INLINE, guaranteed by cascade layers (§4.7); never reordered elsewhere. The shared asset route is locked at/_ideas/{Kind}/{key}/{version}/{**path}. - Trust at write time, sanitized at render. On save,
BodyTrust = Authoriff the writer holdsCms.AuthorRawMarkup(Admin), elseUntrusted. The singleIRawContentGateis the only place aMarkupStringis born, and it sanitizes every body; trust decides only what a body may additionally keep (§4.6). Demotion is a deliberateAuthorTrustVersionepoch bump, never a silent re-render; already-published Author pages keep rendering. - ALC defer-to-default. A per-
.ideacollectibleAssemblyLoadContextdefersSharedContracts.DeferToDefaultPrefixes(Abstractions, Core, Microsoft., System., …) to the default context so a package's base types unify by reference identity with the host's. Host assemblies are forbidden in a packagebin/. - A page is never invalid. A missing or disabled reference degrades to a placeholder and raises a Missing or Disabled Admin Inbox alert. The render thread never throws.
- Two version axes, never conflated.
manifestVersion(file-format host gate) is distinct fromsdk(runtime contract floor); both are integers. - Use the shared packages, don't reinvent. Credentials come from MindAttic.Vault, sign-in from MindAttic.Authentication, LLM access from MindAttic.Legion, media storage from MindAttic.Storage. Ideas adds capability to those packages rather than growing its own copy.
- Only signed packages install. Every install path goes through
PackageInstallService.InstallAsync, which verifies the content signature against host-configured trust before reading the manifest (§4.8). - A demo is a deployment, not a feature. The product contains no routine that resets or deletes a site's content on a schedule; a showroom is a separate vanilla install reset by its own operator (§4.14).
6. Verified state
Build/test evidence (2026-10-03): dotnet test src/IdeaCms.Tests → Passed: 586, Failed: 0, Skipped: 0. The SQL Server temporal proof (PageHistorySqlServerTests) is [Explicit] and runs against the development database (IdeaCmsDev in Azure SQL) on demand.
Live: the company site and the demo run on Azure from the CI pipeline. The hourly demo-reset.yml workflow passes (run 37152987331, 2026-10-03: stop, pin, swap, start, real sign-in, publish). The azure-deploy.yml run 37156225976 (2026-10-03) is green end to end: the company site listened 25 s after dotnet started, finished its boot sequence 33 s later, and reported the pushed commit ready; then the demo deployed and its reset signed in with the new password.
Proven working (each cited in USER_STORIES.md):
- ✅ Abstractions SDK (kind bases,
[Idea]/[Uses]/[Setting], plugin slots, page tree, metadata store). - ✅ Core EF model, temporal
Pages, Authentication package schema, seed. - ✅ Convention discovery, persisted catalog, ALC load + unification.
- ✅ Tag grammar, include expander, typed-attribute coercion, placeholder + Admin Inbox degradation.
- ✅ Body sanitization at every trust level; page, pack and CI validation.
- ✅ Cascade layers, Component-beats-Page, CSS conflict merger.
- ✅
.ideapackaging, content signing, install with dependency gates and hash-conflict detection. - ✅ Instance settings, Copy/Paste Configuration.
- ✅
.idealistexport/import/compose and boot provisioning. - ✅ Multi-domain sites, slug history (301), workflow, page history.
- ✅ Media on local disk and Azure Blob,
--extract-media,--upload-media. - ✅ Deployment packaging contract (vendored feed, health route, security floors), demo reveal endpoint.
7. Active frontier
No RFC is open. The CMS is in enhance-only mode per §2: new capability arrives as new stories, new whole-number content versions, and new library .ideas. Open stories (⬜/🟡) are listed in the USER_STORIES.md priority backlog; the library's frontier is in library/docs/BIBLE.md.
8. Quality bar
Definition of done (a feature is ✅ only when verified, never merely asserted — see HOUSE-LAW-8):
- Clean
dotnet build(0 warnings) onIdeaCms.slnx. - Green NUnit tests; a
✅story names the test that proves it. - For anything user-facing, an e2e or lifecycle assertion, or an observed live run.
- No new fact duplicated: a fact lives in exactly one layer and is cited by
<a id="id"></a>elsewhere. Code comments cite bible sections and laws (M.IDEA-§4.5,M.IDEA-LAW-4), never change records. - Whole-number versioning; soft-disable over hard-delete; secrets via Vault.
9. Glossary
- .idea — a plain zip whose required members are
idea.jsonandidea.sig.json; the install unit. - Idea / IdeaBase — the shared base of all content kinds and the package format; never a kind.
- Page — content, a CMS DB row (Data or Code), resolved by
(SiteId, Slug). - Plugin — a site-wide
.ideakind (ordinal 1): activates a behavior across the whole rendered page without occupying a token position (e.g. Tooltip, OutfitFont, Header, ThemeToggle). Selected per page in Admin (or inherited fromplugins.default); may be placed inline with<Plugin.X />; rendersBeforeBodyorAfterBody. - Component — an inline-placed
.ideakind (ordinal 4): renders at its<Component.X />tag; can nest other Components viaChildContent.ComponentBaseis MindAttic's; Blazor's isBlazorComponentBase. - Theme — layout chrome + one
@Bodyhole + a CSS bundle with light and dark palettes. - Citizen — any installed Page type, Plugin, Component or Theme.
- ContentKind —
Page=0 · Plugin=1 · Theme=2 · Component=4; ordinal 3 reserved. - Data page / Code page — free-form DB body (zero deploy) vs a compiled
PageBasesubclass. - Instance settings — a citizen instance's typed
[Parameter]values (§4.5). .idealist— the portable site + package-list artifact (§4.9).- Content signature — the RSA-PSS signature in
idea.sig.json(§4.8). - Catalog (
CmsContentDefinition) — the one persisted registry of all citizens. - ALC — the per-package collectible
AssemblyLoadContextused to load.ideacitizens. - Raw-content gate (
IRawContentGate) — the soleMarkupStringchokepoint; sanitizes every body. - Admin Inbox — DB-backed dedup alert surface for render-time degradation and install conflicts.
- Trust (
ContentTrust) —AuthorvsUntrusted, set at write time (M.IDEA-LAW-5). - Site — a tenant resolved from the request host (§4.10).
- Library — the
library/directory: the single home of all first-party Themes, Plugins and Components (canon code MAIL). - UiUx —
MindAttic.Components(itsweb/folder is the shared asset package, formerly the MindAttic.UiUx repo), the build-free upstream raw source for some library citizens' engines, consumed by pinned-tag jsDelivr URL.