Skip to content

feat(docs-metadata): ADR-0046 — package docs as flat Markdown metadata#1789

Merged
xuyushun441-sys merged 1 commit into
mainfrom
feat/adr-0046-docs-as-metadata
Jun 12, 2026
Merged

feat(docs-metadata): ADR-0046 — package docs as flat Markdown metadata#1789
xuyushun441-sys merged 1 commit into
mainfrom
feat/adr-0046-docs-as-metadata

Conversation

@xuyushun441-sys

Copy link
Copy Markdown
Contributor

Summary

Revises ADR-0046 (package documentation as metadata) to the simplified flat design and ships the full P1 framework implementation.

ADR revision

  • One flat src/docs/*.md directory — no docSets, no meta.json, no directory taxonomy; flatness is the contract that keeps cross-references stable
  • Filename stem = metadata name = link anchor = URL (/docs/<name>); names are namespace-prefixed
  • Prefix rationale corrected: object names are kernel-validated because they are physical (table names); doc names need only logical uniqueness (registry key org/type/name has no package coordinate → silent last-write-wins overwrite), hence build/publish-lint enforcement
  • Hard requirements: kernel never parses content; list endpoint serves name+label without content
  • Two address spaces: instance routes are single-coordinate; registry/cloud surfaces use full coordinates (package id + version + name)

Implementation

  • spec: DocSchema { name, label?, content }, StackDefinition.docs, doc metadata type + registry entry (inert, runtime-creatable for AI drafting per ADR-0033) + canonical schema map, docs → doc plural mapping
  • cli: os build compiles flat src/docs/*.md (frontmatter title: / first # heading → label) and enforces the ADR lint — flat directory, namespace-prefixed snake_case names, namespace required when docs ship, MDX/image ban, same-package link resolution; same rules in os lint
  • objectql: docs joins the generic metadata registration loop (manifest + nested plugins)
  • runtime: docs count as app payload; GET /metadata/doc list omits content by default (?include=content opts in)
  • examples/app-todo: two cross-referencing docs as a living sample

Test plan

  • New unit tests: packages/spec/src/system/doc.test.ts, packages/cli/src/utils/collect-docs.test.ts (12 cases)
  • Full suites green locally: spec 6536, cli 287, objectql 569, runtime 370; builds (incl. DTS) pass
  • E2E: pnpm build on app-todo embeds both docs into dist/objectstack.json with correct labels; subdirectory + broken-link cases fail the build with corrective messages

🤖 Generated with Claude Code

Revised ADR-0046 (simplified from the directory/docSet design) plus the
full P1 framework implementation:

- spec: DocSchema { name, label?, content } (system/), StackDefinition.docs,
  'doc' metadata type + registry entry (inert data, runtime-creatable for
  AI drafting) + canonical schema map, docs→doc plural mapping
- cli: os build compiles flat src/docs/*.md into docs[] (frontmatter
  title / first # heading → label) and enforces the ADR lint: flat
  directory, namespace-prefixed snake_case names, namespace required when
  docs ship, MDX/image ban, same-package relative-link resolution; same
  rules wired into os lint
- objectql: docs joins the generic metadata registration loop (manifest +
  nested plugins)
- runtime: docs count as app payload; GET /metadata/doc list omits
  content by default (?include=content opts in) so unbounded manuals stay
  off hot paths
- examples/app-todo: two cross-referencing docs as a living sample

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 12, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
spec Ready Ready Preview, Comment Jun 12, 2026 2:17pm

Request Review

@github-actions github-actions Bot added documentation Improvements or additions to documentation protocol:system tests tooling size/l labels Jun 12, 2026
@xuyushun441-sys
xuyushun441-sys merged commit 1ada658 into main Jun 12, 2026
12 checks passed
@xuyushun441-sys
xuyushun441-sys deleted the feat/adr-0046-docs-as-metadata branch June 12, 2026 14:25
xuyushun441-sys added a commit that referenced this pull request Jun 12, 2026
The runtime dispatcher's /metadata/doc route already slims doc list
responses (#1789), but the console reads the REST server's /meta/:type
route, which still returned full bodies. Apply the same rule here:
list responses carry name + label only, ?include=content opts back in,
and GET /meta/doc/:name always returns the full body.

Found during live verification of the console /docs/:name route — the
list endpoint is the path that must stay content-free because manuals
are the one metadata payload that grows unbounded.

Co-authored-by: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation protocol:system size/l tests tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants