feat: Add an esdm documentation command that renders the model as a Markdown tree.#21
Draft
goloroden wants to merge 2 commits into
Draft
feat: Add an esdm documentation command that renders the model as a Markdown tree.#21goloroden wants to merge 2 commits into
goloroden wants to merge 2 commits into
Conversation
…arkdown tree. Add `esdm documentation`, which writes the resolved model as a Markdown directory tree to --output. Each element becomes a page at its containment path, so the tree mirrors the reference notation (#8): the element esdm:library/cataloging/book/acquired lives at library/cataloging/book/acquired.md, and supplying a base URL turns a reference into a link into the tree. A container element is written as a directory with a README.md index; a leaf becomes <name>.md. The command mirrors view and glossary: -d/--directory to read (default the current directory) and an optional [path] to narrow to a subtree, keeping full paths so pages still line up with their references. It refuses to write into a non-empty directory unless --force clears it first, so the output always mirrors the model with no orphaned pages. This first slice renders the structure: each page's name, reference, description, and an index of its children grouped by kind. The kind-specific detail sections, the cross-links between related elements, and the documentation page for the command follow next. The Go package is named docgen rather than documentation because the toolchain excludes every file in a package literally named `documentation` from the build; the CLI command is unaffected. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01T9ZRRMdA7iKk6in8u12rK6
…tation. Flesh out each page with the detail the model records for its kind, aligned with `esdm view --with-details`: an aggregate's identity and state fields, a command's payload and published events, a read model's projections and paradigm, invariants and constraints, a bounded context's ubiquitous language, and so on. Wherever one element names another - publishes, handles, emits, projections, a query's read model, a context mapping's endpoints - the page links to it with a relative link, resolved through an index of the emitted pages so a link is never broken; a target outside the (possibly narrowed) output falls back to the element's reference. The ubiquitous-language rendering reuses the glossary command's term extraction, now exported as CollectTerms, rather than duplicating it. Document the command: a getting-started walkthrough and a CLI reference entry, both following the existing command pages. Also tighten naming for readability: containment paths are `segments` rather than `segs`, references are spelled out rather than `ref`, and a shadowed local is renamed. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01T9ZRRMdA7iKk6in8u12rK6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
esdm documentation, a command that renders a resolved ESDM model as a Markdown directory tree written to--output.Each element becomes one page at its containment path, so the tree mirrors the reference notation (#8): the page path is exactly the reference path, and supplying a base URL turns a reference into a link into the tree. A container element (Domain, Bounded Context, Aggregate, ...) is a directory with a
README.mdindex; a leaf (Command, Event, ...) is<name>.md.Each page renders the detail the model records for its kind, aligned with
esdm view --with-details(identity, payload/state/schema fields, invariants, constraints, projections, ubiquitous language, ...), and links to the elements it names (publishes, handles, emits, a query's read model, a context mapping's endpoints, ...) with relative links. A link to an element outside the (possibly narrowed) output falls back to its reference, so no link is ever broken.Why
esdm viewis a transient terminal summary andesdm glossaryis a single document; neither writes a browsable, publishable view of the whole domain. This command does, and it shares one addressing scheme with the reference notation (#8) rather than inventing a parallel one.Key decisions (signed off beforehand)
esdm documentation; input-d/--directory(default.); optional[path]narrows to a subtree, keeping full containment paths.-o/--output, required, no default (a whole tree is never written by accident).README.md(GitHub renders the folder landing natively).--forceclears it first, then writes, so the tree mirrors the model with no orphaned pages.mkdocs.yml, no theming).esdm view --with-details; H1 is the element's bare name; a reference line on every page; children grouped by kind.Notes
docgen, notdocumentation, because the toolchain excludes every non-test file in a package literally nameddocumentationfrom the build. The CLI command is unaffected.CollectTerms) rather than duplicating it. Consolidating shared helpers further can follow the decision on the glossary command's future (Decide whether and how ESDM should support multilingual terminology (a dictionary) #10).viewshows; richer per-field type tables could be a follow-up.make qapasses.Closes #5
🤖 Generated with Claude Code
https://claude.ai/code/session_01T9ZRRMdA7iKk6in8u12rK6