DocShell extracts documentation into versioned JSON and stops there. It owns generation and the artifact contract; it does not own a renderer, routing, authorization policy, tenancy, or product taxonomy.
Requires Elixir 1.17 or later. ash_oaskit and plug are optional
dependencies — install them only when the host uses those integrations.
- Configure only the
:doc_shellapplication. DocShell never reads another application's environment. - Precedence is per-call options to
DocShell.Build.run/1, thenconfig :doc_shell, then package defaults. Defaults live inDocShell.Config, not in a config file, so a host that configures nothing still gets a valid artifact tree. - Use
mix doc_shell.buildfor host builds. It documents every module in the current application. CallDocShell.Build.run/1directly, with an explicit:moduleslist, when you need a different set. - Handle both
{:ok, result}and{:error, reason}. Extraction stops at the first error and names the module or file at fault; it does not skip bad sources. - Pass explicit
:modules,:guide_bases, and:livebook_basevalues when the host layout differs from the defaults ([],["guides"],"livebooks"). - Leave
:open_api_adapterunset to emit a valid empty OpenAPI 3.1 document. This is a supported configuration, not a degraded one. - Use
DocShell.Build.run/1's return value to feed a database or knowledge graph, withwrite: falsewhen the files are not wanted. The return value is richer than what is written: entries keep their parsedastand nothing is filtered out. - Set
:presentation_sourceto aDocShell.Presentation.GraphProjectorimplementation to have the build use a host projector.:path_builder,:skip_empty, and:search_tokenspass through to the producer. - Set
:openapi_spec_pathwhen external tooling needs a bare OpenAPI file. Put it outside the artifact directories —DocShell.Web.Cacherejects a directory holding an unenveloped.json.
- Treat
DocShell.schema_version/0and thedoc-shell/v1shapes as public API. Never invent fields or change a field's type in place. - Read the version from
DocShell.schema_version/0rather than writing the literal"doc-shell/v1". - Read and write artifacts through
DocShell.Artifact. Do not bypass the envelope or encode artifact JSON by hand. - Keep generated content renderer-neutral: no host UI, routing, tenant, or authorization assumptions inside an artifact.
- Produce presentation data with
DocShell.Presentation.NavigationItem,SearchEntry, andBacklinkstructs, not bare maps. - Validate graph-backed output through
DocShell.Presentation.GraphProjector.project/2before exposing it. - Changing a
doc-shell/v1shape is a breaking change to every producer and renderer at once. Adding an optional field is usually safe; renaming, removing, or retyping one is not.
- Implement
c:DocShell.Generate.OpenApi.Adapter.load/1for a new OpenAPI source. Return{:ok, map}with anopenapikey of"3.0.x"or"3.1.x", or{:error, reason}with a reason worth reading in a failed build. - Resolve optional libraries at runtime with
Code.ensure_loaded?/1. A compile-time reference breaks every host that does not install the library. - Preserve Markdown as the renderer-neutral AST from
DocShell.Ast. Never emit HTML from an extractor. - Surface malformed configured sources as errors; do not silently discard them.
- Coerce non-JSON terms through
DocShell.Json.stringify/1so metadata from every source normalizes the same way. Structs become theirString.Charstext where they have one and theirinspect/1form otherwise. - Read
meta["moduledoc"]("present","hidden","none") rather than inferring documentation coverage from an emptyast.
- Add
DocShell.Web.Cacheto a supervision tree before serving artifacts, and callDocShell.Web.Cache.reload/1after a rebuild. - Use
DocShell.Web.Plugonly when Plug is installed. Both web modules are compiled conditionally. - Supply host authorization through the plug's
:gateoption — a unary function or an MFA tuple, returning:okortrueto allow. Omitting it serves everything to everyone. - Use
DocShell.Web.Controller.show/2instead when the host wants its own pipeline in front; put authorization in a plug there. - DocShell must not implement application-specific access policy.