From 075a749940d300329f36cd20115bd1bbab547505 Mon Sep 17 00:00:00 2001 From: Jason Bowman Date: Tue, 25 Aug 2026 10:20:32 -0700 Subject: [PATCH 1/2] docs: cover undocumented public surface and fix stale API references MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds documentation for public features that shipped without docs, and corrects code comments still pointing at the removed adapter API. New page — explanation/structural-introspection: entity.hasAspect / entity.aspects, meta.handleWith with den.lib.aspects.fx.constraints (exclude / substitute / filterBy and their .global variants), and the lib-level building blocks. Covers where hasAspect is safe to call and why includes is not. Reference and guide additions: - pipe.broadcast stage semantics + worked fleet example - conditional aspects (meta.guard / meta.aspects) via policy.when - den.batteries.flake-scope - built-in policy tables: os-to-host, user-to-host, the home-env family, wsl, and the flake-parts pair - den.schema collection fields (isEntity, isolated, parent, collisionPolicy) and the den.schema.aspect base module - den.classes fields: description, forwardTo, parentPath, parentArg - den.reservedKeys, den.systems, flat host/home declaration forms - policy deliver/route guard + adaptArgs, route collectSubtree and the intoPath alias, custom instantiate specs, resolve.shared.to - captureFleet, resolveWithPaths / resolveWithState - class-module arg promotion for descendant entity kinds Corrections to existing docs: - collision policy resolves over four levels, not three - stale battery anchors in the sidebar and tutorials - lib.mdx linked to a nonexistent /reference/options/ page Code comments only (no behaviour change): has-aspect.nix and the example template referenced oneOfAspects, excludeAspect, meta.adapter and adapters.nix, none of which still exist; they now point at meta.handleWith + fx.constraints. --- docs/astro.config.mjs | 42 ++-- .../content/docs/explanation/parametric.mdx | 22 ++ .../src/content/docs/explanation/policies.mdx | 9 + .../explanation/structural-introspection.mdx | 212 ++++++++++++++++++ docs/src/content/docs/guides/batteries.mdx | 14 ++ .../content/docs/guides/configure-aspects.mdx | 7 + .../content/docs/guides/custom-classes.mdx | 37 +++ docs/src/content/docs/guides/quirks.mdx | 51 +++++ docs/src/content/docs/reference/aspects.mdx | 71 +++++- docs/src/content/docs/reference/batteries.mdx | 26 +++ docs/src/content/docs/reference/diag.mdx | 14 ++ docs/src/content/docs/reference/lib.mdx | 44 +++- docs/src/content/docs/reference/output.mdx | 14 ++ docs/src/content/docs/reference/policies.mdx | 62 ++++- docs/src/content/docs/reference/quirks.mdx | 31 ++- docs/src/content/docs/reference/schema.mdx | 44 +++- docs/src/content/docs/tutorials/default.mdx | 6 +- docs/src/content/docs/tutorials/minimal.mdx | 2 +- modules/context/has-aspect.nix | 5 +- .../modules/aspects/hasAspect-examples.nix | 14 +- 20 files changed, 677 insertions(+), 50 deletions(-) create mode 100644 docs/src/content/docs/explanation/structural-introspection.mdx diff --git a/docs/astro.config.mjs b/docs/astro.config.mjs index ae94f3549..47c37e957 100644 --- a/docs/astro.config.mjs +++ b/docs/astro.config.mjs @@ -61,6 +61,7 @@ export default defineConfig({ { label: 'Aspects & Functors', slug: 'explanation/aspects' }, { label: 'Class Modules', slug: 'explanation/class-modules' }, { label: 'Parametric Aspects', slug: 'explanation/parametric' }, + { label: 'Structural Introspection', slug: 'explanation/structural-introspection', badge: { text: 'advanced', variant: 'caution' } }, ], }, { @@ -130,26 +131,27 @@ export default defineConfig({ label: 'Batteries', collapsed: true, items: [ - { label: 'define-user — OS user accounts', link: '/reference/batteries/#den_define-user' }, - { label: 'hostname — set system hostname', link: '/reference/batteries/#den_hostname' }, - { label: 'os-class — cross-platform os class', link: '/reference/batteries/#den_os-class' }, - { label: 'os-user — user class forwarding', link: '/reference/batteries/#den_os-user' }, - { label: 'primary-user — admin privileges', link: '/reference/batteries/#den_primary-user' }, - { label: 'user-shell — login shell', link: '/reference/batteries/#den_user-shell' }, - { label: 'mutual-provider — host↔user config', link: '/reference/batteries/#den_mutual-provider' }, - { label: 'host-aspects — project host classes', link: '/reference/batteries/#den_host-aspects' }, - { label: 'tty-autologin — TTY auto-login', link: '/reference/batteries/#den_tty-autologin' }, - { label: 'vm-autologin — auto-login for VMs', link: '/reference/batteries/#den_vm-autologin' }, - { label: 'wsl — WSL support', link: '/reference/batteries/#den_wsl' }, - { label: 'forward — custom class factory', link: '/reference/batteries/#den_forward' }, - { label: 'import-tree — legacy module import', link: '/reference/batteries/#den_import-tree' }, - { label: 'home-manager — HM integration', link: '/reference/batteries/#den_home-manager' }, - { label: 'hjem — hjem integration', link: '/reference/batteries/#den_hjem' }, - { label: 'maid — nix-maid integration', link: '/reference/batteries/#den_maid' }, - { label: 'unfree — allow unfree packages', link: '/reference/batteries/#den_unfree' }, - { label: 'insecure — allow insecure packages', link: '/reference/batteries/#den_insecure' }, - { label: "inputs' — flake-parts inputs", link: '/reference/batteries/#den_inputs' }, - { label: "self' — flake-parts self outputs", link: '/reference/batteries/#den_self' }, + { label: 'define-user — OS user accounts', link: '/reference/batteries/#denbatteriesdefine-user' }, + { label: 'hostname — set system hostname', link: '/reference/batteries/#denbatterieshostname' }, + { label: 'os-class — cross-platform os class', link: '/reference/batteries/#denbatteriesos-class' }, + { label: 'os-user — user class forwarding', link: '/reference/batteries/#denbatteriesos-user' }, + { label: 'primary-user — admin privileges', link: '/reference/batteries/#denbatteriesprimary-user' }, + { label: 'user-shell — login shell', link: '/reference/batteries/#denbatteriesuser-shell' }, + { label: 'mutual-provider — host↔user config', link: '/reference/batteries/#denbatteriesmutual-provider' }, + { label: 'host-aspects — project host classes', link: '/reference/batteries/#denbatterieshost-aspects' }, + { label: 'tty-autologin — TTY auto-login', link: '/reference/batteries/#denbatteriestty-autologin' }, + { label: 'vm-autologin — auto-login for VMs', link: '/reference/batteries/#denbatteriesvm-autologin' }, + { label: 'wsl — WSL support', link: '/reference/batteries/#denbatterieswsl' }, + { label: 'forward — custom class factory', link: '/reference/batteries/#denbatteriesforward' }, + { label: 'import-tree — legacy module import', link: '/reference/batteries/#denbatteriesimport-tree' }, + { label: 'home-manager — HM integration', link: '/reference/batteries/#denbatterieshome-manager' }, + { label: 'hjem — hjem integration', link: '/reference/batteries/#denbatterieshjem' }, + { label: 'maid — nix-maid integration', link: '/reference/batteries/#denbatteriesmaid' }, + { label: 'unfree — allow unfree packages', link: '/reference/batteries/#denbatteriesunfree' }, + { label: 'insecure — allow insecure packages', link: '/reference/batteries/#denbatteriesinsecure' }, + { label: "inputs' — flake-parts inputs", link: '/reference/batteries/#denbatteriesinputs' }, + { label: "self' — flake-parts self outputs", link: '/reference/batteries/#denbatteriesself' }, + { label: "flake-scope — lib/inputs/den to pipeline", link: '/reference/batteries/#denbatteriesflake-scope' }, ], }, { label: 'Host↔User Mutual Config', slug: 'guides/mutual' }, diff --git a/docs/src/content/docs/explanation/parametric.mdx b/docs/src/content/docs/explanation/parametric.mdx index 02b175e75..7f2d1b57c 100644 --- a/docs/src/content/docs/explanation/parametric.mdx +++ b/docs/src/content/docs/explanation/parametric.mdx @@ -112,6 +112,28 @@ context drives the *entire aspect* (which classes to include, what includes to add). Use class-level injection when only a specific class module needs entity data alongside module-system args. + +