tasks

Implement Schema DSL Runtime Values

Goal

Implement the P0 Forma Schema DSL, semantic types, placeholder resolution, slugify, and runtime value providers.

Sources

Context

The Schema DSL is the P0 user-authored object constraint language. Runtime values are explicit runtime.values.* definitions, and current-user behavior is modeled as a normal runtime value.

In Scope

  • Implement Schema DSL node types: object, string, number, integer, boolean, date, datetime, const, enum, entryRef, and list.
  • Implement field-local required: true, readonly, and hidden hints.
  • Implement semantic types for static enums and space-backed references.
  • Implement simple {{ path.to.value }} placeholder resolution with cycle detection.
  • Implement slugify transform.
  • Implement runtime providers: const, gitConfig, currentDate, currentDateTime, and workspaceRoot.
  • Make currentDate and currentDateTime use effective workspace.timezone.
  • Add tests for defaults, transforms, dependency resolution, cycles, and unresolved required runtime values.

Out Of Scope

  • JSON Schema authoring files.
  • Custom validators, executable plugins, or script hooks.
  • Union reference types, groups, lifecycle/deprecation, maps, or polymorphic object schemas.

Acceptance Criteria

  • Valid P0 starter space schemas parse and validate.
  • Invalid enum, ref, required, and type cases produce structured diagnostics.
  • Runtime values can be resolved from shared config and local overrides.
  • Placeholder cycles and missing required dependencies produce diagnostics.
  • slugify handles whitespace, reserved path characters, empty output, and Windows reserved names.

Relationship Notes

Blocked by config/path model. Downstream work can be derived from task items whose blockedBy references this task, including check/index and starter create flows.

Follow-up Notes

date and datetime lexical formats were fixed during implementation: persisted date values use YYYY-MM-DD, and persisted datetime values use RFC3339 with explicit Z or numeric offset.

Numeric Schema closure (2026-08-29) documents and tests strict YAML scalar semantics for number and integer, including the no-coercion rule and zero-padded lexical values. The workspace fixture and CLI contract are recorded in test-cases/forma-starter-kit/numeric-schema-type-contract. Numeric range constraints, finite-value policy, and WebApp/RPC cross-surface behavior remain deferred follow-up work. The release-cut fixture modeled ordinalWidth as the lexical string "2"; the 2026-08-30 Arcadia use case refines the distinction: numeric width controls use ordinalWidth: 2 with type: integer, while rendered ordinals such as "01" use type: string. Positive-width enforcement remains workspace-specific until Forma gains range constraints.