Skip to content

Root document inputs: CLI and env delivery #324

Description

@taras

Intent

A root document declares the values it needs as one complete draft-07 object
schema
— the same declaration shape an imported component uses. xmd run
turns that schema's top-level properties into command-line flags and
environment variables, resolves them by precedence (individual option →
aggregate option → individual env var → aggregate env var → schema default),
validates the combined object against the root schema, and only then runs the
document body.

The declaration lives in frontmatter and the resolved values reach the document
the same way an imported component's do — explicit interpolation, root eval
bindings, bare binding interpolation.

Prior art: the parked draft

A draft of this design exists on the branch
wip/root-document-inputs
(commit 9d36541), which adds specs/root-document-inputs-spec.md and rewrites
the declaration sections of specs/executable-mdx-spec.md.

Do not merge or cherry-pick it. It predates #317 and #319, and its
specs/executable-mdx-spec.md hunks would revert both. The branch is a record
of the intent; the intent gets re-derived against current main and applied as
a fresh diff.

First task — blocking all others: a terminology decision

The parked draft uses three names for one concept:

  • inputs: in frontmatter
  • {props.name} in the body
  • --props-name / XMD_PROPS_NAME on the CLI

Per the Terminology registry's rules in architecture.md — only use terms
defined there or already in the spec and code, and ask before adding one —
inputs replacing props is a vocabulary decision that has to be settled
before any of this is specced or built. Questions for @taras:

  1. Does inputs go everywhereinputs: in frontmatter, {inputs.name}
    in the body, --input-name, XMD_INPUT_NAME?
  2. Does props survive as a distinct term for component invocation
    attributes (what a caller passes at the call site), with inputs reserved
    for the declaration?
  3. What are the resulting registry entries in architecture.md?

Nothing else here should move until that is answered.

Notes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions