# Dryv documentation --- > Dryv documentation: deterministic code generation from contracts, the dryv CLI, authoring, templating and packs, and how to use Dryv with AI agents and agent skills. --- # What is Dryv? Dryv (full name Dryvcode) is a deterministic software-generation engine. It lets you describe software meaning once, convert that meaning into one canonical Runtime IR, and generate implementation through reusable packs without hiding why the output exists. > **The promise:** Describe meaning once → canonicalize it → inspect and > validate it → choose packs → plan exactly what will happen → render explicit > templates → receive deterministic artifacts → trace every result back to > meaning. ## The three tiers Dryv keeps responsibilities separate: - **Authoring** defines software meaning. - **Canonical Runtime IR** is the semantic authority. - **Templating** defines how canonical meaning becomes generated representation. - **Usage** connects the semantic source, packs, bindings, destinations, and generation behavior to a real project. ## One semantic authority Canonical Dryv Runtime IR is the only authority for what the described software means. Authoring produces it. The runtime validates, resolves, loads, inspects, and plans from it. Packs consume explicit context derived from it. ## Plan before project mutation Dryv plans semantic selection, template invocations, output paths, generated dependencies, and template context before a client applies files. A useful plan can answer: - Which authored item selected this template? - Why was another item skipped? - Which context paths did the template receive? - Why does this generated dependency exist? - Where will the artifact be written? - How does the artifact trace back to canonical meaning? ## Language and renderer independence Current authoring implementations are **Python** and **TypeScript**. Current template renderer implementations are **Jinja**, **Handlebars**, **Liquid**, and **Mustache**. These are separate extension points. The authoring language does not constrain the renderer, and the renderer does not define the language of generated output. ## Where to go next Start with [Get started](/docs/getting-started), then continue into the core concepts once you have seen a real project configuration and generation plan. --- # Installation A Dryv setup has three parts: | Part | What it does | Where it runs | | --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------- | | **Client** | The `dryv` CLI or the VS Code extension. Reads your project, runs the compiler, sends the result to the engine and writes generated files. | Your machine | | **Author + compiler** | A library you declare software meaning with, and the compiler that turns it into Canonical Runtime IR. | Your project, as dev dependencies | | **Engine** | Validates the IR, plans packs and renders templates. Clients talk to it over HTTP. | On your machine, or in your Playground | ## 1. Install the CLI The CLI is distributed by the Dryv Platform, not by the open source repository. Today the only published build is **0.1.0 for Linux x64**. The installer downloads it, verifies its signature and sha256, and installs it to `~/.dryv` without sudo. It needs neither Node.js nor Python. ```bash curl -fsSL https://dryvcode.com/install.sh | sh dryv --help ``` Pin a version with `DRYV_VERSION=0.1.0` and change the folder with `DRYV_INSTALL_DIR`. Update later with `dryv update`. Direct downloads with checksums are on the [download page](/download). There is no published build for macOS or Windows yet. The 0.1.0 build also predates the keyless Engine described below, so some of its behaviour may differ from these pages. The `@dryvcode/cli` package on npm is the old 0.1.0 package and is not maintained. ### Or the VS Code extension The extension's `.vsix` is on the [download page](/download). In VS Code, choose **Extensions → … → Install from VSIX**. The listing on [Open VSX](https://open-vsx.org/extension/alidantechorg/dryv-vscode) is an older preview. ### Without the CLI You can run the open source Engine from source and send it a project directly. You need [Bun](https://bun.sh) 1.4.2, [uv](https://docs.astral.sh/uv/) and git: ```bash git clone https://github.com/dryvcode/dryv.git cd dryv bun run setup # installs the TypeScript and Python dependencies bun run dev # the Engine on http://127.0.0.1:8750 with its template servers ``` In another terminal, `python3 scripts/engine_sample.py sdk/_examples/projects/quickstart` validates and plans the sample project through the Engine API. See the repository's `README.md` for details. ## 2. Add an author to your project Pick the language you want to describe your software in. The generated code can target any stack. The authoring language only decides how you write the meaning. ### TypeScript ```bash tab="npm" npm install -D @dryvcode/author @dryvcode/compiler ``` ```bash tab="pnpm" pnpm add -D @dryvcode/author @dryvcode/compiler ``` ```bash tab="yarn" yarn add -D @dryvcode/author @dryvcode/compiler ``` ```bash tab="bun" bun add -d @dryvcode/author @dryvcode/compiler ``` [@dryvcode/author](https://www.npmjs.com/package/@dryvcode/author) · [@dryvcode/compiler](https://www.npmjs.com/package/@dryvcode/compiler). The compiler's command is `dryv-ts`. It loads your `.ts` files directly, which needs **Node.js 22.18+** or Bun. On Node, use erasable TypeScript only: no `enum` or `namespace`. ### Python (3.11+) ```bash tab="uv" uv add --dev dryv-author dryv-compiler ``` ```bash tab="pip" pip install dryv-author dryv-compiler ``` [dryv-author](https://pypi.org/project/dryv-author/) · [dryv-compiler](https://pypi.org/project/dryv-compiler/). The compiler's command is `dryv-py`. If the project doesn't have the author or compiler yet, the CLI can install them for you. It asks first, or proceeds without asking when you pass `--yes`. ## 3. Connect to an engine ### Where the engine runs The engine runs on your own machine. The CLI and the VS Code extension use the local engine that the [local daemon](/docs/guides/local-daemon) starts, on a free port it picks. There is no public hosted engine: the engine in your Playground is reached only through the signed-in Platform API. A local engine needs no login and no API key. You only sign in (`dryv login`) to sync data through the Platform API (the web and mobile apps), sync tasks, publish, use private packs, and download or export your data. ### Run it locally The installed CLI starts a local Engine for you through its local daemon. Check or control it with `dryv local status`, `dryv local restart`, `dryv local stop` and `dryv local logs`. See [Local daemon](/docs/guides/local-daemon). To use an Engine you run yourself, for example one started with `bun run dev` from the open source repository, point the CLI at it: ```bash export DRYV_API_URL=http://127.0.0.1:8750 ``` Pass `--api` to any command instead, if you prefer. The VS Code extension uses the CLI named by the `dryv.cli.command` setting (default `dryv`) to start the same local daemon. The Engine needs no key, token or database. ## 4. Check it ```bash dryv info # the engine, its version and its template servers dryv capabilities # what this machine can run ``` Next: [How a project flows through Dryv](/docs/usage/workflow). --- # Get started with Dryv A Dryv project connects software meaning, reusable packs, and output destinations through one user-facing project contract: `dryv.yaml`. The recommended first loop is simple: 1. [install the CLI and an author](/docs/usage/installation) for your language; 2. create `dryv.yaml`; 3. point it at your authored source; 4. activate one small pack; 5. run `dryv plan` and read the plan; 6. run `dryv generate` only after you understand the plan. For the whole picture of what runs where, read [How a project flows through Dryv](/docs/usage/workflow). ## Create dryv.yaml ```yaml version: dryv/v1alpha1 sources: authoring: main: type: typescript path: dryv/contracts entrypoint: index.ts packs: local: path: dryv/packs packs: models: source: $ref: "#/sources/packs/local" path: models destination: { $ref: "#/destinations/generatedModels" } destinations: ir: main: { path: dryv/ir } generatedModels: path: src/_gen/models authoring: source: { $ref: "#/sources/authoring/main" } destination: { $ref: "#/destinations/ir/main" } build: cache: reuse default_action: generate ``` ## Choose how meaning enters Dryv A project can provide authored source through a supported Author implementation or load serialized Canonical Runtime IR directly. Once canonical meaning exists, the downstream planning and generation model is the same. ## Inspect before generating Planning should expose validation diagnostics, selected and skipped template invocations, planned artifact identities and paths, generated dependencies, cache decisions, and collision diagnostics before workspace mutation. ## Keep the first project small Start with one pack and one destination. Verify that selection and output paths are understandable before composing multiple packs. --- # How a project flows through Dryv ```mermaid flowchart LR A["Author
TypeScript or Python"] -->|compile| B["Canonical
Runtime IR"] B -->|stream| C["Dryv Engine
validate + plan"] P["Packs
dryv.yaml"] --> C C -->|render| D["Template servers"] D --> E["Plan + diff
+ trace"] E -->|you approve| F["Generated files"] ``` 1. **Author.** You describe schemas, operations, events, policies and apps with the author library, in TypeScript or Python. 2. **Compile.** The client runs your project's compiler (`dryv-ts` or `dryv-py`). The compiler turns the declarations into **Canonical Runtime IR**, the single source of meaning. 3. **Validate and plan.** The client streams the IR to the engine. The engine validates it, loads the packs listed in `dryv.yaml`, and plans every file: which template, which subject, which path, and what it depends on. 4. **Render.** Template servers render each planned file. The engine returns the files and a trace that explains why each one exists. 5. **Apply.** The client shows the diff and writes files only when you approve. Your source code never leaves your machine, only the compiled IR does. The engine never writes to your workspace. The client does. ## 1. Author TypeScript, in `dryv/contracts/index.ts`: ```ts import { dryv, property } from "@dryvcode/author"; const shop = dryv.group({ name: "shop" }); export const shopProperties = shop.properties({ Id: property.string.uuid(), Name: property.string(), Price: property.number.money({ minorUnits: true, currency: "USD" }), }); export default dryv.app({ name: "shop" }).groups(shop); ``` Python uses the same concepts with Pythonic names: `type: python` and a Python entrypoint such as `app.py`. ## 2. Configure: dryv.yaml ```yaml version: dryv/v1alpha1 sources: authoring: main: type: typescript # or python path: dryv/contracts entrypoint: index.ts packs: official: repository: https://github.com/dryvcode/packs ref: # written for you by `dryv pack add` root: packs packs: entities: source: $ref: "#/sources/packs/official" path: inject/persistence/typeorm-entities destination: { $ref: "#/destinations/entities" } destinations: ir: main: { path: dryv/ir } entities: path: src/generated/entities authoring: source: { $ref: "#/sources/authoring/main" } destination: { $ref: "#/destinations/ir/main" } ``` You rarely write the pack source by hand: `dryv pack add ` does it. See [Find and use packs](/docs/usage/packs) and [dryv.yaml](/docs/usage/dryv-yaml). ## 3. Run | Command | What it does | Writes files? | | ------------------------- | ------------------------------------------------------------------------------- | ------------------- | | `dryv build` | Compiles authored source and writes configured Runtime IR YAML/JSON/JSONL files | yes | | `dryv validate` | Compiles and validates against the engine | no | | `dryv plan` | Shows every planned file, its template and its path | no | | `dryv generate --dry-run` | Renders and shows the diff | no | | `dryv generate` | Renders, shows the diff and asks before writing | yes, after approval | | `dryv generate --check` | Fails when the generated files are out of date (for CI) | no | Every command takes `--api `, or reads `DRYV_API_URL`. ## Where to go next - [Installation](/docs/usage/installation) - [Authoring](/docs/concepts/authoring) - [Packs & templating](/docs/concepts/packs) - [Planning & explainability](/docs/concepts/planning) --- # Authoring defines software meaning Authoring is the human- and tool-friendly layer where software meaning is declared. An authoring implementation may be written in Python, TypeScript, or another language, but every implementation must compile into the same Canonical Dryv Runtime IR. Authoring exists to make software meaning expressive without turning one host language into a private Dryv dialect. ## The authoring boundary The boundary is intentionally narrow: ```text Authoring source ↓ Language-native Author SDK ↓ Typed authored definitions ↓ Author compiler / provider ↓ Canonical Dryv Runtime IR ``` Once canonical meaning has been produced, authoring is finished. ## What authoring owns Authoring can: - define schemas, operations, events, policies, failures, views, workflows, and other canonical concepts; - validate authored declarations; - create explicit typed relationships; - reduce repetitive declarations without hiding behavior; - preserve documentation and source provenance; - compile declarations into canonical Runtime IR structures. Authoring should make related concepts convenient to express, but convenience must compile into explicit canonical relationships. ## What authoring does not own Authoring does not: - select generation packs; - select templates; - define target-framework roles; - define generated output paths; - write generated files; - serialize Runtime IR; - own Runtime IR loading or inspection; - create a semantic model understood only by one authoring language. These responsibilities belong to the runtime, templating, usage, and client layers. ## Current authoring implementations Dryv currently has authoring implementations for: ### Python Python authoring provides language-native declarations and compiles them into the same canonical Runtime IR used everywhere else in Dryv. ### TypeScript TypeScript authoring provides a typed API for the same canonical model. It does not create a separate TypeScript semantic model. The important invariant is not that both APIs look identical. The invariant is that equivalent authored meaning compiles into the same canonical vocabulary. ## Connected APIs, canonical ownership A language API may let you start from one concept and fluently declare related concepts. For example, a Schema-focused API could make it convenient to declare an associated Operation. That convenience does not change semantic ownership. Compilation should normalize the authored convenience into explicit registries, stable references, and canonical relationships. ## Determinism and identity Authoring must not rely on process-global mutation, import order, or host object identity as semantic authority. Equivalent authored meaning should produce deterministic canonical meaning with stable identities and explicit relationships. ## Why this matters to users Because authoring ends at canonical meaning, the same software description can be used with different packs, renderers, target languages, and project structures without redefining the software itself. --- # Canonical Dryv Runtime IR Runtime IR is the semantic center of Dryv: one portable, language-neutral contract shared by authoring implementations, the engine, packs, clients, and tools. There is one Dryv Runtime IR. There is not a Python IR, TypeScript IR, or renderer-specific IR. ## One semantic authority Runtime IR is the only authority for what described software means. Authoring produces it. The runtime validates, resolves, indexes, inspects, hashes, serializes, loads, and plans from it. Packs consume bounded context derived from it. Generated application code does not become a competing semantic authority after generation. ## Canonical properties Canonical Runtime IR should remain: - language-agnostic; - framework-agnostic; - runtime-agnostic; - portable; - explicit; - deterministic; - inspectable; - versioned; - usable by both humans and automated agents. Stable identity must not depend on host-language object identity. ## Typed relationships Canonical concepts connect through explicit directional relationships. Examples include: ```text Schema extends Schema StorageMapping maps Schema Operation uses Policy Operation may fail with Failure Operation emits Event Workflow waits for Event View triggers Operation Presentation places View ``` The authored direction is stored explicitly. Reverse relationships can be derived by the runtime. ## Authored facts and derived facts Dryv avoids forcing authors to maintain the same relationship twice. If an Operation emits an Event, the Operation can author that forward relationship. Runtime can derive an index of Event emitters for inspection or template context. This reduces contradictory state while preserving rich queries. ## One Schema concept Typed structure reuses the same Schema concept across: - operation inputs and outputs; - event payloads; - workflow data; - nested fields; - views and other typed interactions. A request DTO, database entity, SDK model, or form model is normally a pack-specific representation of canonical structure rather than a separate canonical root. ## Serialization is transport Runtime IR can be transported through formats such as JSON, JSONL, or YAML without creating separate semantics. A serialized Runtime IR document can be loaded without the original authoring runtime. That is a core portability property. ## Provenance Runtime IR should retain enough provenance to explain: - which authored declaration produced a concept; - where inherited or composed facts originated; - which relationships were authored directly; - which facts were derived later; - how a generated result traces back to canonical meaning. Provenance is part of explainability, not merely debugging metadata. ## The canonical-root test Before introducing a new Runtime IR root, ask whether the concept has durable, language-neutral meaning independent of how one target stack likes to generate code. If the idea exists only because a template or framework wants a role such as controller, repository, DTO, page, or component, it normally belongs in the pack rather than Runtime IR. --- # Packs define code emission Template packs turn Canonical Dryv Runtime IR into generated representation. They own how software meaning becomes source code, configuration, documentation, packages, project fragments, or complete projects. Packs consume meaning. They do not redefine it. ## Layout and ownership Each `dryv.pack.yaml` has one layout: `inject` (the default), `package`, or `project`. An inject pack contributes files to an existing destination. Package and project layouts describe reusable package or application output. The layout is declared in the manifest; the repository folder name is organizational. Templates normally produce Dryv-managed files. A resource filename with `.sf` immediately before its renderer extension, such as `main.ts.sf.hbs`, produces a scaffold: Dryv creates it only when absent and does not overwrite the project's later edits. Packs may declare logical generation actions. A project's `dryv.yaml` defines reusable concrete actions under top-level `actions.files` and `actions.final`; code destinations select them in order. The Engine resolves the action plan, while the client runs the resulting argv in the project environment. ## What a pack declares A reusable pack can declare: - which canonical concepts it is interested in; - why items are selected, grouped, or skipped; - which template is associated with an invocation; - which bounded context a template requires; - which artifacts and symbols are planned; - generated dependencies between planned artifacts; - renderer requirements; - output destinations; - pack options and project bindings. These declarations make generation explainable before rendering begins. ## The same vocabulary end to end Pack selection uses the same canonical vocabulary as authoring and Runtime IR. A pack can reason about Schema, Operation, Event, Workflow, View, Policy, and other canonical concepts. Target roles such as controller, entity, DTO, repository, screen, page, or SDK model are usually representation choices made by a pack. ## Selection is explicit Templates should not run because of hidden filename conventions or renderer magic. A pack explicitly selects canonical subjects and defines the scope of an invocation. That lets Dryv explain: - what matched; - what did not match; - why the template was selected; - how selected subjects were partitioned into generation work. ## Template context is bounded A template does not receive a live reference to the entire semantic graph. The engine prepares ordinary JSON-compatible context from: - the selected canonical subject; - explicitly exposed relationships; - derived runtime facts; - pack options; - project bindings; - planned artifacts and generated dependencies; - deterministic helpers where justified; - trace and provenance information. Bounded context improves explainability, memory use, renderer portability, security, hashing, and cache invalidation. ## Renderers stay semantically narrow A renderer has a deliberately small contract: ```text template + bounded context + renderer options ↓ renderer ↓ rendered content + diagnostics ``` The renderer does not own semantic selection, canonical meaning, artifact planning, dependency resolution, or filesystem mutation. ## Current renderer implementations Dryv currently has template-server implementations for: - Jinja; - Handlebars; - Liquid; - Mustache. Renderer support is separate from generated output language. A Handlebars pack can emit TypeScript. A Jinja pack can emit Python, YAML, Rust, Markdown, or another textual representation. The pack owns the target representation. ## Generated symbols and dependencies A planned artifact can declare that it exports a generated symbol. Another artifact can declare that it requires that symbol. The planner resolves the providing artifact and logical dependency. The template then renders target-language syntax such as import, use, extends, or implements. That separation keeps dependency meaning explicit without teaching the core runtime every target language's syntax. ## Portable packs A portable pack should make its requirements visible: - renderer requirements; - required project bindings; - supported options; - selected canonical subjects; - output behavior; - generated dependencies. A user should be able to understand what a pack needs before running it. --- # Plan exactly what will happen Dryv separates semantic selection from rendering and plans generated output before a client mutates a project. Planning is where deterministic generation becomes visible. ```mermaid sequenceDiagram participant You participant CLI as dryv CLI participant Engine You->>CLI: dryv plan CLI->>Engine: Runtime IR + dryv.yaml Engine-->>CLI: planned files, templates, paths You->>CLI: dryv generate --dry-run CLI->>Engine: render Engine-->>CLI: files + trace CLI-->>You: diff, nothing written You->>CLI: dryv generate CLI-->>You: asks, then writes ``` ## Selection creates generation work A pack starts by selecting canonical subjects. The result should retain enough information to explain: - which canonical subject matched; - which selection rule caused the match; - which candidates were skipped; - how work was partitioned; - which pack and template own the invocation. Selection is semantic planning, not template rendering. ## Template invocation plans A template invocation plan can carry information such as: - stable invocation identity; - pack identity; - template identity; - selected canonical subject or partition; - requested context dependencies; - planned artifact identity; - planned generated symbols; - generated dependencies; - destination and output-path intent; - provenance. This model allows Dryv to inspect generation work before templates execute. ## Artifacts, symbols, and dependencies are different A generated file is an artifact. A target-language name exported from that artifact is a generated symbol. A dependency says that one planned result requires another planned result or symbol. Keeping these concepts distinct allows packs to describe imports, exports, barrels, inheritance, registration, or other target relationships without collapsing them into filenames. ## Planning precedes mutation The engine can return plans, diagnostics, traces, and generated artifacts to a workspace-aware client. The client decides how to show diffs and whether to apply changes to the real filesystem. This separation enables: - dry-run workflows; - editor previews; - remote generation; - browser tooling; - collision detection; - explicit create, update, delete, or conflict behavior. ## Explainability is a product contract A user should be able to ask: ### Why was this selected? Dryv should identify the canonical subject, pack, selection rule, and relevant semantic facts. ### What did the template receive? Dryv should expose the bounded context paths and explain where values came from. ### Why does this import or dependency exist? Dryv should trace the declared generated dependency and the planned artifact or symbol that satisfies it. ### Why does this file exist? Dryv should trace the artifact through canonical meaning, pack, template, invocation, renderer, and destination. ## Stable identity Stable identities for canonical subjects, invocations, artifacts, symbols, and dependencies make reproducible planning, collision detection, caching, and tracing possible. Identity must not depend on nondeterministic process state. ## Cache correctness Reusable generation work is valid only while all output-affecting inputs remain compatible. Those inputs can include: - canonical meaning; - pack configuration; - project bindings; - template content; - renderer identity and compatible version; - relevant context dependencies. Correct invalidation matters more than maximizing cache hits. ## Example trace A trace may conceptually contain information like: ```text artifact generated/users/user.ts subject #/schemas/User pack @example/typescript template model selected schema + public facet context selected.fields, imports renderer handlebars dependsOn generated/shared/id.ts result create ``` The exact presentation can differ by client, but the underlying explanation should remain available. --- # Dryv agent The Dryv agent is a coding agent that runs on your machine. It reads and edits your project, runs commands, and uses Dryv itself: it can validate your contracts, plan generation, explain generated files and manage your tasks. The agent runs inside the [local daemon](/docs/guides/local-daemon). It needs no Dryv account. It uses a model from a provider you choose, with **your own** provider API key. Dryv does not supply a model or a key. > [!NOTE] > The agent, tasks and the local daemon are in the current Dryv CLI. The published 0.1.0 build may not include them yet. See [Installation](/docs/usage/installation). ## When to use it - You want an assistant that knows Dryv's loop (`validate`, `plan`, `generate`) and asks before it writes generated files. - You want the agent to create and work through [tasks](/docs/guides/tasks) in your project. - You want everything to stay on your machine, apart from the calls to your model provider. ## Before you start You need: - The `dryv` CLI. See [Installation](/docs/usage/installation). - An API key from one of the supported model providers. ### Supported model providers | Provider | Environment variable | | ---------- | --------------------- | | Google Gemini API | `GEMINI_API_KEY` | | Groq | `GROQ_API_KEY` | | Mistral | `MISTRAL_API_KEY` | | Cerebras | `CEREBRAS_API_KEY` | | OpenRouter | `OPENROUTER_API_KEY` | A provider is skipped until its key is set. One variable can hold several keys separated by commas. The agent tries them in order and moves to the next key when one is rejected or rate limited. ## Set your provider key Pick one way. **In your shell.** Export the variable before the daemon starts: ```bash export GEMINI_API_KEY="your-key" dryv local restart ``` **In the daemon's credentials file.** Create `~/.dryv/local/credentials.yaml`. It maps variable names to a key or a list of keys: ```yaml title="~/.dryv/local/credentials.yaml" GEMINI_API_KEY: - first-key - second-key GROQ_API_KEY: another-key ``` Make it readable by you only, then restart the daemon: ```bash chmod 600 ~/.dryv/local/credentials.yaml dryv local restart ``` A variable already set in your environment wins over the file. The daemon logs a warning when the file can be read by other users. ## Start the agent in the terminal From your project folder: ```bash dryv code ``` `dryv agent` and the `dryvcode` command do the same thing. The command starts the local daemon if it is not running, then opens the full-screen interface. It needs an interactive terminal. Type a request and press Enter. Type `/` to see the commands. ### Commands in the interface | Command | What it does | | --- | --- | | `/help` | Show the commands. | | `/init [project name]` | Create a project and link it to this folder. | | `/status` | Show the runtime and the current project. | | `/projects [get\|open ]` | List or open projects. | | `/workspace` | Show the current workspace and its folders. | | `/chats [open\|new\|rename\|archive\|delete]` | Manage chats. | | `/resume [chat-id]` | Open a previous chat. | | `/new` | Start a new chat. | | `/model [backend-id model-id]` | Show or set the model for this chat. | | `/context reset` | Start the next turn with fresh context. | | `/approval [set ]` | Show or change the approval policy. See [Approvals](#approvals). | | `/runs [run-id]` | List the runs in this chat, or inspect one. | | `/interactions [interaction-id]` | List or inspect questions and approvals in this chat. | | `/artifacts ` | Inspect an artifact the agent produced. | | `/diff` | Show the latest diff. | | `/knowledge ` | Search what the agent has stored. | | `/browser` | Find or manage browser resources. | | `/copy [max-characters]` | Copy recent transcript text to the clipboard. | | `/theme` | Choose the terminal colours. | | `/clear` | Clear the transcript on screen. | | `/retry` | Retry the connection to the daemon. | | `/quit` | Exit (also `/exit`). | ### Choose a model Run `/model` to see the current selection. Set one with `/model `. The choice is saved for that chat. ## Run one command without the interface `dryv code ` runs one command and exits. Add `--json` for machine-readable output. This is useful in scripts. ```bash dryv code status dryv code chats dryv code runs get dryv code approval set require_approval ``` | Command | What it does | | --- | --- | | `api start\|status\|stop\|restart\|logs` | Manage the local daemon. | | `init [--name ]` | Create a project for this folder. | | `status` | Show the runtime and current resources. | | `projects [get\|open ]` | List or open projects. | | `workspace ` | Show a workspace. | | `chats [project-id]` | List chats. | | `runs [chat-id]`, `runs get ` | List runs, or show one. | | `interactions [interaction-id]` | List or show interactions. | | `artifacts get\|content ` | Show an artifact's metadata or content. | | `approval get ` | Show the approval policy. | | `approval set ` | Change the approval policy. | | `knowledge search `, `knowledge get ` | Search or read stored knowledge. | | `browser installations\|resources` | List browsers or open browser resources. | | `browser open [url]`, `browser close ` | Open or close a managed browser. | | `cwd` | Print the working folder. | | `logs [--tail ]` | Print the daemon log. | | `open ` | Open a path. Also `open .`, `open logs`, `open config`. | Options for `dryv code`: | Option | Meaning | | --- | --- | | `--project ` | Workspace folder. Defaults to the current directory. | | `--runtime-home ` | Use a different daemon home (same as `DRYV_LOCAL_HOME`). | | `--endpoint ` and `--token ` | Use an explicit loopback daemon address and its token. | | `--json` | Print machine-readable output. | | `--plain` | Turn off terminal styling. | ## Use the agent in VS Code The VS Code extension adds a **Dryv Agent** view with a chat. See [VS Code](/docs/guides/vscode#agent-chat). ## What the agent can do The agent works only inside the folder of the current workspace. | Tool group | Examples | | --- | --- | | Files | Read, list and search files. Write, edit, patch, move, copy and delete files. | | Content | Read and compare content and images. | | Shell | Run a process or a script. | | Environment | Find an executable, read the platform and environment variables. | | Dryv | `dryv.docs.read`, `dryv.project.validate`, `dryv.project.status`, `dryv.generate.plan`, `dryv.generate.explain`, `dryv.generate.apply`, `dryv.generate.undo`. | | Tasks | `task.list`, `task.show`, `task.search`, `task.validate`, `task.create`, `task.update`, `task.start`, `task.check`, `task.comment`. | The Dryv tools run the same CLI commands you would. They use the local Engine, so they need no key or login. ## Approvals Each workspace has an approval policy for tools that change things: | Policy | Effect | | --- | --- | | `require_approval` | The agent asks you before each change. This is the default. | | `allow` | Changes run without asking. | | `block` | Changes are refused. | Tools that only read are not affected by the policy. Writing generated files is always your decision. `dryv.generate.apply` and `dryv.generate.undo` ask for approval even when the policy is `allow`, and are refused when it is `block`. The agent can only apply a plan it created in the same run. Change the policy with `/approval set ` in the interface, or `dryv code approval set `. ## Where your data stays - The agent and its data live in the daemon's home, `~/.dryv/local` by default. - Your prompts and the files the agent reads go to the model provider you chose. - Nothing is sent to Dryv. Signing in is only needed for [task sync](/docs/guides/sync). ## Desktop app A desktop app for the agent is in development. It is not available to download yet. ## Troubleshooting **"Dryv interactive mode requires a TTY."** You ran `dryv code` with redirected input or output. Run it in a terminal, or use a one-shot command such as `dryv code status --json`. **The agent cannot answer, or no model is listed.** No provider key is set for the daemon. Set one as shown above and run `dryv local restart`. A key exported after the daemon started is not seen until it restarts. **"dryv-local was not found."** The CLI could not find the local daemon. See [Local daemon troubleshooting](/docs/guides/local-daemon#troubleshooting). **The agent keeps asking for approval.** That is the default policy. Change it with `/approval set allow`. Generated-file writes still ask. --- # Tasks `dryv task` keeps your project's work as Markdown files inside the project. Each task is one file with YAML frontmatter. Tasks are grouped in **waves**. You, your teammates and the [Dryv agent](/docs/guides/agent) all read and change the same files. Tasks work offline and need no account. Sign in only if you want to [sync them](/docs/guides/sync) to the Dryv web app and your other devices. > [!NOTE] > Tasks are in the current Dryv CLI. The published 0.1.0 build may not include them yet. ## When to use it - You want a plan for a feature that lives next to the code. - You want an agent to pick up work, record progress and hand it back. - You want to see which files changed while a task was in progress. ## Set up a project From your project folder: ```bash dryv task init ``` This creates: | Path | What it is | | --- | --- | | `task.yaml` | Task configuration. | | `tasks/` | The task workspace. | | `tasks/README.md` | How the workspace works. | | `tasks/rules/task-writing.md` | The writing standard tasks must meet. | | `AGENTS.md` | A managed block that tells agents how to use tasks. | Use `--workspace ` to choose another folder. Run `dryv task init update` later to refresh the guide and the `AGENTS.md` block. By default the task workspace is kept out of git. Dryv adds it to `.git/info/exclude`, never to `.gitignore`. See [Configuration](#configuration) to track it. ## Create and work on tasks Create a wave, then a task in it: ```bash dryv task wave create --title "Login flow" dryv task create --title "Add password reset" --wave login-flow --priority high --assignee alice ``` Each task gets an id such as `TSK-9C598FB02513`. Waves are stored by week, for example `tasks/todo/work/W49/login-flow--b4c221/`. Write the task body with `dryv task edit `, which opens `$EDITOR`. A task needs a real Goal, Context and checklist before you can start it. The rules are in `tasks/rules/task-writing.md`. Then work through it: ```bash dryv task start TSK-9C598FB02513 --track # move to in-progress and record git changes dryv task check TSK-9C598FB02513 --item 1 # tick the first checkbox dryv task comment TSK-9C598FB02513 --text "API done, UI left." dryv task update TSK-9C598FB02513 --status completed dryv task validate ``` Statuses are `planned`, `in-progress`, `blocked`, `completed` and `archived`. Priorities are `low`, `medium` and `high`. ## Agents and handover The Dryv agent has task tools: `task.list`, `task.show`, `task.search`, `task.validate`, `task.create`, `task.update`, `task.start`, `task.check` and `task.comment`. Changes go through the agent's [approval policy](/docs/guides/agent#approvals). Other agents use the same files through the CLI. `dryv task init` writes instructions for them into `AGENTS.md`, and `dryv task setup` can add more agent guidance. To hand work to someone: 1. Set who owns it: `dryv task update --assignee `. 2. Leave a note: `dryv task comment --text "What is done, what is left, where to look."`. 3. Read the history with `dryv task activity ` and `dryv task comments `. ## Command reference Run `dryv task --help` for the same list. `dryv tasks` is an alias. | Command | What it does | | --- | --- | | `dryv task` | Show the workspace overview. | | `init [--workspace ]` | Set up the project for tasks. | | `init update` | Update the workspace guide and the `AGENTS.md` instructions. | | `init --refresh-docs` | Refresh the task docs without prompting. | | `project inspect` | Inspect the repository and suggest guidance. Read-only. | | `setup` | Review and apply project documentation and agent guidance. | | `setup plan --json` | Print a setup plan without writing files. | | `setup apply --path ` | Apply a saved setup plan. | | `tui`, `-f` | Open the full-screen interface. | | `run` | Start the local dashboard and open it in a browser. | | `doctor` | Check Bun and workspace health. | | `info`, `status`, `stats` | Show workspace information and counts. | | `tree` | Show the Markdown workspace paths. | | `wave create\|list` | Manage waves. `group` is an alias. | | `migrate` | Move old flat waves into week folders. | | `list [filters]` | List active tasks. Add `--archived` for archived ones. | | `show ` | Show a task or document. | | `search ` | Search metadata and Markdown text. | | `create` | Create a task in a wave. | | `update ` | Change task metadata. | | `edit ` | Edit the Markdown body in `$EDITOR`. | | `archive `, `restore ` | Archive or restore. | | `start [--track]` | Move to in-progress, optionally recording git changes. | | `changes [--diff ]` | Show the git changes made while the task was in progress. | | `comment --text "…"`, `comments ` | Add or list comments. | | `move (--before\|--after \| --order N \| --wave )` | Reorder or move a task. | | `attach `, `detach ` | Manage small attachments and links. | | `template create\|list` | Manage task templates. Use with `create --template `. | | `bulk [--status …]` | Change many tasks at once. | | `activity ` | Show a task's timeline. | | `checklist ` | Show a task's checkboxes by heading. | | `check\|uncheck (--item N \| --section "Heading" \| --all)` | Tick or untick checkboxes. | | `delete [--yes] [--force] [--cascade]` | Move a task, wave or document to the trash. | | `undelete `, `trash list` | Restore from the trash, or list it. | | `validate [scope]` | Validate tasks, docs, links and references. | | `docs list\|show\|search\|tree\|open\|create` | Work with documents. | | `index status\|rebuild\|verify` | Inspect or rebuild the index. | | `registry` | List every registered task and document (`dryv.task.yaml`). | | `sync [status\|now\|enable\|disable]` | Sync tasks with your Dryv account. See [Sync](/docs/guides/sync). | Task fields: `--title`, `--wave` (or `--group`), `--status`, `--priority`, `--assignee`, `--project`, `--tag a,b`, `--due YYYY-MM-DD`, `--depends-on TSK-…`, `--extra JSON`. Common options: `--workspace `, `--json`, `--plain`, `--no-color`, `--quiet`, `--verbose`, `--no-open`. ## Configuration Settings live in a `tasks:` block in `dryv.yaml`. If there is no such block, `task.yaml` is read instead. ```yaml title="dryv.yaml" tasks: workspace: tasks # folder with the task files documents: [docs, notes] # other folders whose Markdown files are registered sync: enabled: false # turned on by `dryv task sync enable` ignore: ["*.draft.md"] # files never uploaded git: track: false # true keeps the workspace visible to git quality: mode: reject # reject, warn or off tracking: enabled: true # record file changes while a task is in progress ``` Every key is optional; `tasks: {}` uses the defaults. The block also accepts `idPrefix`, `identity`, and `organization`. The CLI and the local daemon accept the same keys, so `registry` and `sync` work with any valid block. ## The registry `dryv task registry` lists every file Dryv knows about: the files in the task workspace and the Markdown files under `documents` folders. The list is written to `dryv.task.yaml` at the project root. It is rebuilt from the files, so do not edit it. Some files are never registered, so never uploaded: hidden files, links, files over 1 MB, `node_modules`, and names that often hold secrets (`.env*`, `*.pem`, `*.key`, `id_*`, `credentials*`, `secrets.*`). `dryv task registry` and `dryv task sync` use the [local daemon](/docs/guides/local-daemon) and start it if needed. ## Troubleshooting **"Write the missing content … then try again."** The task or its wave plan is too thin to start. Fill in the sections named in the message, or relax `quality.mode`. **"No Task workspace in the project."** The CLI looks for the workspace only in the project root, the folder with `dryv.yaml`. It never uses a `tasks` folder from a parent directory. Run `dryv task init` in your project first, add a `tasks:` block, or pass `--workspace`. **"The local Dryv daemon is not reachable."** Only `registry` and `sync` need the daemon. See [Local daemon](/docs/guides/local-daemon#troubleshooting). --- # VS Code The Dryv extension for VS Code brings the Dryv workflow, the [agent](/docs/guides/agent) and [tasks](/docs/guides/tasks) into the editor. It uses the [local daemon](/docs/guides/local-daemon) on your machine. It needs no account. Sign in only for Platform features such as [sync](/docs/guides/sync). ## Install You need VS Code 1.108 or later and the `dryv` CLI. The extension starts the local daemon through the CLI. 1. Install the CLI. See [Installation](/docs/usage/installation). 2. Download the extension's `.vsix` from the [download page](/download). 3. In VS Code, open **Extensions**, choose **…** then **Install from VSIX**, and pick the file. 4. Open a folder that contains a `dryv.yaml` and trust the workspace. The extension turns on when the folder has a `dryv.yaml` or `dryv.author.yaml`, or when you open one of its views. > [!WARNING] > Do not enable this extension and the open source Dryv extension at the same time. Both register `dryv.*` commands. If `dryv` is not on your `PATH`, set **Dryv › Cli: Command** (`dryv.cli.command`) to its full path. ## Views The extension adds two icons to the activity bar. **Dryv** - **Workspace.** Your Dryv projects, with buttons to refresh, open the output, show info, build authoring and restart the connection. - **Tasks.** Tasks and documents from the project's [task registry](/docs/guides/tasks#the-registry). Create, filter, refresh, and show or hide archived tasks from the view's title bar. Right-click a task to start it or tick a step. **Dryv Agent** - **Chat.** A chat with the Dryv agent. You can move it to the secondary sidebar with **Dryv: Move Chat to Secondary Sidebar**. ## Generate code Use the Command Palette (Ctrl+Shift+P or Cmd+Shift+P): 1. **Dryv: Validate** checks your contracts and `dryv.yaml`. 2. **Dryv: Plan** shows what would be generated. 3. **Dryv: Generate Dry Run** shows the diff without writing. 4. **Dryv: Generate** shows the changes and asks **Apply N Dryv generated changes?** before writing. **Dryv: Check Generated Files** reports whether generated output is up to date. Results and diagnostics appear in the **Dryv** output and the Problems panel. By default the extension validates again shortly after you change a Dryv file. Auto-validation never approves changes to your environment. To learn where a generated file came from, right-click it in the Explorer and choose **Dryv: Trace Current File** or **Dryv: Explain Artifact**. ## Agent chat 1. Set a model provider key for the daemon. See [Dryv agent](/docs/guides/agent#set-your-provider-key). 2. Run **Dryv: Open Chat**. 3. Pick a model with **Dryv: Select Chat Model**. 4. Type a request. To give the agent context, select code and right-click: **Dryv: Ask About Selection**, **Dryv: Add Selection to Context** or **Dryv: Add Current File to Context**. Stop a response with **Dryv: Stop Current Response**. Start over with **Dryv: New Chat**. Changes still follow the agent's [approval policy](/docs/guides/agent#approvals). ## Commands | Command | What it does | | --- | --- | | Dryv: Sign In | Sign in to the Dryv Platform in your browser. | | Dryv: Sign Out | Sign out of the Dryv Platform. | | Dryv: Info | Show the Engine and its template servers. | | Dryv: Workflow Capabilities | List which workflows the Engine supports. | | Dryv: Check Environment | Check that the project and Engine are ready. | | Dryv: Build Authoring | Compile your authored source to Runtime IR. | | Dryv: Validate | Validate the project. | | Dryv: Plan | Show the planned files. | | Dryv: Generate Dry Run | Show the diff without writing. | | Dryv: Generate | Show the diff and apply it after you confirm. | | Dryv: Check Generated Files | Check whether generated files are up to date. | | Dryv: Show Changes | Show pending generated changes. | | Dryv: Open Dryv Output | Open the Dryv output channel. | | Dryv: Restart API Connection | Reconnect to the Engine. | | Dryv: Refresh | Refresh the Workspace view. | | Dryv: Trace Current File | Explain where the current generated file came from. | | Dryv: Explain Artifact | Explain a generated file. | | Dryv: Open Chat | Open the agent chat. | | Dryv: New Chat | Start a new chat. | | Dryv: Stop Current Response | Stop the agent's current answer. | | Dryv: Select Chat Model | Choose the model for the chat. | | Dryv: Open Managed Browser | Open a browser the agent can use. | | Dryv: Show Runtime Status | Show the agent runtime's status. | | Dryv: Move Chat to Secondary Sidebar | Show how to move the chat. | | Dryv: Ask About Selection | Ask the agent about the selected code. | | Dryv: Add Selection to Context | Add the selection to the chat. | | Dryv: Add Current File to Context | Add the open file to the chat. | | Dryv: Reconnect Local Daemon | Reconnect to, or restart, the local daemon. | | Dryv: Refresh Tasks | Reload the Tasks view. | | Dryv: Create Task | Create a task. | | Dryv: Start Task | Start a planned or blocked task. | | Dryv: Tick Task Step | Tick a checkbox in a task. | | Dryv: Filter Tasks | Filter the Tasks view. | | Dryv: Show or Hide Archived Tasks | Toggle archived tasks. | ## Settings | Setting | Default | What it does | | --- | --- | --- | | `dryv.cli.command` | `dryv` | The CLI that starts the daemon and runs `dryv task`. Use a path, or a command such as `bun /path/to/dryv.ts`. | | `dryv.local.runtimeHome` | empty | A different daemon home. Empty uses the default, `~/.dryv/local`. | | `dryv.validation.auto` | `true` | Validate again after Dryv files change. | | `dryv.validation.delayMs` | `1200` | How long to wait after a change before validating, in milliseconds. | | `dryv.notifications` | `true` | Show short success and failure notifications. | | `dryv.connection.refreshSeconds` | `30` | How often to check the connection while a Dryv workspace is open. | | `dryv.debug` | `false` | Log more transport and process details. Project content and secrets are never logged. | The extension also adds a **Dryv** file icon theme. Choose it under **Preferences: File Icon Theme**. ## Troubleshooting **The views say they cannot connect.** Run **Dryv: Reconnect Local Daemon**. If that fails, run `dryv local logs` in a terminal. Check that `dryv.cli.command` points at a working CLI. **Commands are missing or run twice.** Disable the open source Dryv extension. **The chat has no models.** Set a provider key for the daemon, then run `dryv local restart` and **Dryv: Reconnect Local Daemon**. **Agent commands are disabled in the editor menu.** They need a trusted workspace. Run **Workspaces: Manage Workspace Trust**. --- # Local daemon The local daemon is a background process on your machine. It runs: - the **Dryv Engine**, which validates, plans and generates; - the **agent runtime** behind [`dryv code`](/docs/guides/agent) and the VS Code chat; - **task registry and sync** for [tasks](/docs/guides/tasks). It listens only on your own machine (`127.0.0.1`). It needs no Dryv account and no key. ## How clients use it You rarely start the daemon yourself. - **CLI.** Commands that need the Engine, such as `dryv validate`, `plan` and `generate`, start the daemon when it is not running and use its Engine. `dryv code` and `dryv task sync` also start it. - **VS Code.** The extension runs `dryv local connect --json` to start or find the daemon. If you pass `--api ` or set `DRYV_API_URL`, the CLI uses that Engine instead and does not start the daemon. ## Ports The daemon picks free ports when it starts. It serves two addresses: - the agent API, for example `http://127.0.0.1:41000/v1`; - the Engine, on its own port. Each start creates a new random access token for the agent API. Clients read the addresses and token from the daemon's connection file. You never need to copy them. To choose the agent API port, pass `--port` to `connect`, `start` or `restart`. The Engine port is always picked automatically. ## Commands ```bash dryv local connect # start the daemon if needed and print how to reach it dryv local status # is it running? dryv local logs # print the log (last 200 lines) dryv local restart # stop it and start a fresh one dryv local stop # stop it ``` | Action | What it does | Options | | --- | --- | --- | | `connect` | Starts the daemon if it is not running, then prints its connection details. | `--host`, `--port`, `--runtime-home`, `--json` | | `start` | Same as `connect`. | Same as `connect` | | `status` | Reports whether the daemon is running. Exits with status 1 when it is not. | `--runtime-home`, `--json` | | `restart` | Stops the daemon and starts a new one. Refuses while agent runs are active. | `--force`, `--host`, `--port`, `--runtime-home`, `--json` | | `stop` | Stops the daemon gracefully. | `--runtime-home`, `--json` | | `logs` | Prints the daemon log. | `--tail ` (default 200), `--runtime-home`, `--json` | | `link status\|connect\|disconnect` | Shows or changes whether the daemon holds your Platform sign-in. | `--platform `, `--json` | `restart` will not interrupt work. If runs are active it stops and tells you how many. Use `dryv local restart --force` to restart anyway. ## Where it keeps its files The daemon home is `~/.dryv/local`. Set `DRYV_LOCAL_HOME` to use another folder. | Path | Contents | | --- | --- | | `daemon.json` | How clients reach the running daemon. Removed when it stops. | | `credentials.yaml` | Optional model provider keys. See [Dryv agent](/docs/guides/agent#set-your-provider-key). | | `data/logs/api/api.log` | The log that `dryv local logs` prints. | | `task-sync.json` | Projects with task sync turned on, so sync resumes after a restart. | ## Signing in and the daemon `dryv login` stores your Platform session in your operating system's keychain. Each time the CLI reaches the daemon, it hands the session to the daemon, which keeps it in memory only. The daemon uses it for [task sync](/docs/guides/sync). - `dryv local link status` shows whether the daemon holds a session. - `dryv local link connect` hands it over now. It fails if you are not signed in. - `dryv local link disconnect` makes the daemon forget it. A daemon restarted without the CLI has no session until the next CLI command. Remote control of your machine from the web or mobile app is not available yet. ## Troubleshooting **"dryv-local was not found."** The CLI looks for the daemon in this order: the `DRYV_LOCAL_COMMAND` variable, the copy packaged with the CLI, `dryv-local` on your `PATH`. Reinstall the CLI, or set `DRYV_LOCAL_COMMAND` to the command that runs `dryv-local`. **A command hangs, then fails to connect.** Run `dryv local logs` to see why the daemon did not start, then `dryv local restart`. **The agent does not see a new provider key.** Keys are read when the daemon starts. Run `dryv local restart`. **You want to use another Engine.** Pass `--api ` or set `DRYV_API_URL`. The daemon is then not used for Engine commands. --- # Playground The Playground is a workspace in your browser. It has a file explorer, an editor, a terminal, diffs and a preview. Each Playground workspace has its own Dryv Engine. Only you and the members of your organization can reach it, through the Platform. The Playground needs a Dryv account. To work on your own machine instead, use the [CLI](/docs/usage/cli) or [VS Code](/docs/guides/vscode), which need no account. ## When to use it - You want to try Dryv without installing anything. - You want to share a running preview with your team. - You want to work on a project from any computer. ## Create a project 1. Sign in at [app.dryvcode.com](https://app.dryvcode.com) and open **Playground**. 2. Start a new project, or open `/playground/new`. 3. Choose the organization the project belongs to. You need permission to create projects there. See [Organizations](/docs/platform/organizations). 4. Name the project. 5. Choose a starter: - **Contract authoring language:** TypeScript or Python. - **Project type:** for example **Next.js + API contracts** or **OpenAPI + JSON Schema**. - **Data storage:** no database (data resets when the app restarts), a PostgreSQL starter, or an existing PostgreSQL database. 6. Preview the starter files, then choose **Create and generate**. Instead of a starter you can connect a GitHub repository. See [GitHub](#github). ## Work in the workbench Open a project from **Playground** to get the workbench. - **Explorer and editor.** Edit any file. Search files by name with the palette; type `>` for commands. - **Snapshots.** Save your files as a snapshot. Runs use saved snapshots. You can restore an earlier snapshot; existing snapshots are kept. - **Operations.** Run Dryv on a snapshot: - **Validate**: check contracts and configuration. - **Plan**: show what generation would change. - **Generate**: write generated files to the run's output. - **Runs.** See each run's output. Copy a run's output into the workspace, or stop a run. - **Console.** Commands run on your Playground's Engine. - **Activity.** See what happened in the project. ## Run your app 1. Open **Application** and choose **Start workspace**. 2. Install dependencies, then check and run your app from the terminal. 3. When the app is ready, its private preview opens. Stopping the workspace interrupts running commands. Your files and the project database are kept. ### Database A project can use: - a **private PostgreSQL** database for the workspace, with no public port. Its data survives workspace stop and start; - **your own PostgreSQL** database. Enter its connection string and, if needed, a custom certificate authority. Dryv can test the connection with a read-only query. SQL files under `database/` are applied only after you review them. ## Share a preview A preview starts private: only members of the organization can open it, and its address works for one hour. Reopen the preview for a fresh address. To share it, choose **Share preview**, then: - **Create unlisted link**: anyone with the link can open it; - **Publish publicly**: it is published for anyone to open. You can also open the generated site of a run, after confirming who will be able to see it. ## Download your work - **Download the open snapshot as ZIP.** - **Download the selected run's output as ZIP.** ## GitHub The Playground connects to GitHub through the **Dryv GitHub App**. 1. Open **Source control** and choose **Connect a Git repository**. 2. Connect your GitHub account and choose which repositories the app can access. 3. Pick a repository. Connecting keeps the files already in the project. 4. Create or choose a branch, review the changed files, then commit and push. Changes are reviewed before every commit. Deletions and replacements need your confirmation. ## Troubleshooting **"Sign in to use the Playground."** The Playground needs an account. Sign in, or use the CLI locally. **"Choose an organization where you have permission to create projects."** Your role in that organization cannot create projects. Ask an owner or admin. **"Save files as a snapshot to run them."** Runs use saved snapshots. Save first. **"Runtime connection lost."** The worker is busy or restarting. Wait, then retry. --- # Sign in and sync Everything in Dryv works without an account. Sign in when you want to: - sync a project's [tasks](/docs/guides/tasks) to your account and see them in the web app; - [publish packs](/docs/guides/publishing) or use private packs; - use the [Playground](/docs/guides/playground); - connect an [MCP client](/docs/guides/mcp); - download or export your data. ## Sign in from the CLI ```bash dryv login ``` The CLI prints a link and a code, and opens your browser. Sign in at [app.dryvcode.com](https://app.dryvcode.com) and approve the code. The CLI waits until you approve. Check who you are signed in as: ```bash dryv whoami ``` Sign out, which also revokes the session: ```bash dryv logout ``` `dryv login`, `logout` and `whoami` use the Dryv Platform API at `https://api.dryvcode.com`. To use another Platform address, pass `--platform ` or set `DRYV_PLATFORM_URL`. The session is stored in your operating system's keychain. Where no keychain is available, the CLI stores it in `~/.config/dryv/platform-session.json`, readable only by you, and tells you so. The CLI hands the session to the [local daemon](/docs/guides/local-daemon#signing-in-and-the-daemon), which keeps it in memory only. Login options: `--platform `, `--json`, `--events` (print the device code as JSON on standard error, for tools). `--no-input` makes login fail at once, because it always needs a browser approval. ## Turn on task sync Sync is off for every project until you turn it on. ```bash dryv login dryv task sync enable ``` Dryv asks before it uploads anything. In scripts, pass `--yes`. Turning sync on: 1. Creates a task workspace in your account, or links to one you name. 2. Uploads the task workspace and the registered documents. 3. Keeps watching the files and syncs changes a few seconds after you stop editing. Only [registered files](/docs/guides/tasks#the-registry) are uploaded. Secret-looking files, hidden files and files over 1 MB never are. Options for `enable`: | Option | Meaning | | --- | --- | | `--workspace-id ` | Link to an existing task workspace, for example one you created on another computer. | | `--project-key ` | The key for a new task workspace. Defaults to the folder name. | | `--name ` | The display name for a new task workspace. Defaults to the folder name. | | `--yes` | Confirm the upload without a prompt. | ## Check and control sync ```bash dryv task sync status # on or off, state, workspace id, last sync, conflicts dryv task sync now # sync immediately dryv task sync disable # stop syncing this project ``` `status` shows one of `disabled`, `idle`, `syncing`, `offline` or `error`. ## Use the same tasks on another computer 1. On the first computer, run `dryv task sync status` and copy the workspace id. 2. On the second computer, clone the project, sign in, and run: ```bash dryv task sync enable --workspace-id ``` Both computers should use the same `tasks:` settings, so commit `dryv.yaml`. ## Conflicts If a file changed differently on two devices, Dryv keeps your local version and saves the other one next to it as `.conflict-.md`. `dryv task sync status` counts them. Merge the content by hand and delete the conflict copy. A file you edit while a download is being applied is never overwritten. The incoming version becomes a conflict copy instead. ## Offline When the network is down, changes queue up and Dryv retries with a growing delay, up to five minutes. When the daemon restarts, it resumes syncing every project that had sync on. ## See your tasks on the web Open [app.dryvcode.com/tasks](https://app.dryvcode.com/tasks). Task workspaces are listed by organization. You can also open one by id. Each task shows its status, checklist, linked files and comments. The mobile app is coming soon. ## Troubleshooting **"Not signed in" or `sync enable` fails.** Run `dryv login`, then `dryv local link status` to check the daemon holds your session. If you restarted the daemon, run any `dryv` command once so the CLI hands the session over again. **`dryv login` cannot connect.** Check your network. If you set `DRYV_PLATFORM_URL` or `--platform`, check that the address is right, or unset it to use `https://api.dryvcode.com`. **State is `error`.** Run `dryv task sync status` to read the last error. Errors that retrying cannot fix, such as an archive over 25 MB or a revoked session, are not retried. Fix the cause, then run `dryv task sync now`. **A file is missing on the other device.** It may not be registered. Run `dryv task registry` on both devices and compare. --- # Publish packs You can publish your own packs to the Dryv pack registry, under a namespace such as `@you`. A pack is **public**, so anyone can find and install it, or **private**, so only people with access to the namespace can use it. Publishing needs a Dryv account. Building and testing a pack does not. See [Test and publish](/pack-builders/test-and-publish) for the checks to run first. ## 1. Create a namespace 1. Sign in at [app.dryvcode.com](https://app.dryvcode.com). 2. Open **Settings → Pack namespaces**. 3. Choose **Create a namespace**. Use lowercase letters, numbers and hyphens, starting with a letter or number. You can move a namespace to another account or to an organization from the same page. The other side accepts it under **Incoming**. ## 2. Package the pack Make an archive of the pack folder with `dryv.pack.yaml` and `README.md` at its root. ```bash tar -czf clinic-pack.tar.gz -C path/to/clinic-pack . ``` The archive must be a `.tar.gz` or `.tgz` file of 48 MiB or less. ## 3. Release it 1. Open **Packs → Release a pack** (`/packs/release`). 2. Choose the namespace under **Publish under** and enter the pack name. 3. Under **Who can use it**, choose **Private** or **Public**. 4. Upload the archive and add release notes. 5. Choose **Check the release**. The registry reads the manifest, checks it and lists every file it will publish. 6. Review the list, then choose **Publish private** or **Publish public**. Nothing is published until you confirm. ## Use a published pack Find packs at [packs.dryvcode.com](https://packs.dryvcode.com), or with `dryv pack search`. Add one to a project by its package name in `dryv.yaml`: ```yaml title="dryv.yaml" sources: packs: clinic: package: "@you/clinic-pack" ``` Add `version:` to pin a version. See [Find and use packs](/docs/usage/packs) for how to activate it. ## Use private packs Public packs need no sign-in. To use a private pack, sign in first so the CLI can send your session to the registry: ```bash dryv login dryv validate ``` The CLI uses the registry at `https://api.dryvcode.com`. Set `DRYV_PLATFORM_URL` only to use another Platform address. See [Sign in and sync](/docs/guides/sync#sign-in-from-the-cli). ## Troubleshooting **"Create a namespace first."** You have no namespace yet. Create one in **Settings → Pack namespaces**. **"The archive is larger than 48 MiB."** Remove build output and dependencies from the pack folder and package it again. **A private pack is not found from the CLI.** Run `dryv whoami`. If you are not signed in, or signed in to another Platform address, sign in again with the right `DRYV_PLATFORM_URL`. Check that your account has access to the namespace. --- # Connect an MCP client The Dryv Platform has an MCP server. An AI assistant that supports MCP can use it to search the Dryv docs and to read, validate, plan and generate your Playground projects. The server is at: ```text https://api.dryvcode.com/mcp ``` It uses Streamable HTTP. You need a Dryv account. There are no tokens to copy: your client signs you in with OAuth in the browser. ## Connect 1. Add a remote MCP server in your client with the address above. Most clients call this a "remote", "HTTP" or "Streamable HTTP" server. 2. Connect. The client opens your browser. 3. Sign in to Dryv if you are not signed in. Your email must be verified. 4. The consent page shows the app's name, where the answer goes and what each permission allows. Choose **Approve** or **Decline**. The client can now use the tools you approved. ## Permissions | Scope | What the client can do | | --- | --- | | `mcp:read` | Search the docs, list your organizations and projects, read snapshots, files and activity, and start validate and plan runs. | | `mcp:write` | Also start generate runs and restore snapshots. | A client with read access only does not see the write tools. ## Tools | Tool | Scope | What it does | | --- | --- | --- | | `documentation_search` | read | Search the public Dryv docs. Returns titles, links and short excerpts. | | `organizations_list` | read | List your organizations and your role in each. | | `projects_list` | read | List the projects in an organization you can read. | | `project_snapshots_list` | read | List a project's saved snapshots. | | `project_snapshot_files_list` | read | List the paths in a snapshot. No file contents. | | `project_snapshot_text_file_read` | read | Read one UTF-8 text file of up to 64 KiB from a snapshot. | | `project_activity_list` | read | List recent project activity. | | `project_validate` | read | Validate a snapshot in a hosted run. Never changes files. | | `project_plan` | read | Plan generation for a snapshot. Never writes files. | | `project_run_get` | read | Read a run's status, report and output paths. | | `project_generate` | write | Generate from a snapshot. The output stays a private run output; it is never written into the project. | | `project_snapshot_restore_propose` | write | Prepare a snapshot restore. Changes nothing until confirmed. | | `project_snapshot_restore_confirm` | write | Confirm a proposed restore within 10 minutes. | Run tools use the latest snapshot when you do not name one. They wait up to 30 seconds by default for the result; use `project_run_get` to keep waiting. ## Disconnect a client Open **Settings → Connected apps** in [app.dryvcode.com](https://app.dryvcode.com) and disconnect the app. Its access ends at once. Access tokens last one hour. The client refreshes them for up to 30 days while you stay connected. ## Use Dryv on your machine instead The MCP server works on your Playground projects. To let an assistant work on a project on your own machine, it can run the `dryv` CLI with `--json --no-input`. See [Agents and CI](/docs/usage/agents-and-ci). That needs no account. ## Troubleshooting **The client gets "401 Unauthorized".** It has not signed in yet, or its access was revoked. Reconnect it. **The browser shows an error before the consent page.** The client sent an address Dryv does not accept. Check the client's MCP setup, then try again. **A write tool is missing.** You approved read access only. Disconnect the app and connect again, approving write access. --- # Configure a project with dryv.yaml Usage is intentionally the simplest Dryv tier. The user-facing project file is `dryv.yaml`. It connects an authored source or serialized Runtime IR with active packs, project-specific bindings, logical destinations, and build behavior. It does not become another semantic authoring language. ## The usage contract A project configuration should answer: 1. What software description are we using? 2. Which packs are active? 3. What does each pack require from this project? 4. Where should generated artifacts go? 5. How should this generation run? ## Example ```yaml version: dryv/v1alpha1 sources: authoring: model: type: typescript path: dryv/contracts entrypoint: index.ts packs: local: { path: dryv/packs } actions: format: stage: files extensions: [.ts] commands: - run: [bun, x, prettier, --write, $(files)] destinations: ir: compiled: { path: .dryv/ir } models: path: src/_gen/models actions: - { $ref: "#/actions/format" } services: path: src/_gen/services actions: - { $ref: "#/actions/format" } authoring: source: { $ref: "#/sources/authoring/model" } destination: { $ref: "#/destinations/ir/compiled" } packs: models: source: $ref: "#/sources/packs/local" path: models destination: { $ref: "#/destinations/models" } service-contracts: source: $ref: "#/sources/packs/local" path: service-contracts destination: { $ref: "#/destinations/services" } build: cache: reuse default_action: generate ``` The top-level `actions` registry defines reusable project commands. Each action declares `stage: files` or `stage: final`. Each code destination selects actions in an ordered list of explicit `$ref` entries to `#/actions/`. File actions run on staged generated files before comparison. Final actions run after changed files are applied. Dryv-owned keys use `snake_case`; Dryv-owned fixed values remain kebab-case or dot-case. For keys you create, such as pack, template, selection and destination names, prefer one word or kebab-case for two words (`entity-index`). Dryv preserves these user-authored identifiers rather than rewriting them. ## Semantic source A source can identify authored software that must be compiled by an Author implementation, or it can identify serialized Canonical Runtime IR. Authored source uses `path` for the source boundary and `entrypoint` for the compiler entry file relative to that boundary. The downstream runtime and pack model does not change based on which authoring language originally produced the meaning. ## Packs Projects can activate one or several packs. Each pack remains responsible for declaring what it generates, what it selects, what renderer capabilities it needs, and what options or bindings are required. Usage chooses and configures packs. It does not redefine their selection logic. ## Project bindings Reusable packs sometimes need project-specific values that cannot be portable canonical meaning. Those values belong in explicit project bindings or supported pack options, not in hidden template conventions. ## Logical destinations Destinations are resolved before real filesystem mutation. That separation lets Dryv plan project-relative output while clients retain control over the actual workspace. Logical destinations make dry-runs, editor previews, remote execution, and safe collision detection possible. ## Multiple packs When several packs are active, Dryv must reason about the combined generation plan. The runtime should detect project-wide output conflicts rather than allowing one pack to silently overwrite another pack's artifacts. ## Cache behavior Usage can control supported cache modes independently from whether output is applied. Cache behavior must never change canonical meaning or hide an invalid plan. ## PostgreSQL partition layouts Partitioning is canonical schema storage meaning under `facets.storage.partitioning`. Declare it in the Author SDK or Runtime IR; project usage only supplies the connection and pack activation. The owner explicitly changed the previous usage-only placement on 25 November 2026. There is one declaration authority and no usage override or compatibility alias. All contracts remain v1alpha1. ```ts storage("captures") .primaryKey("id", "capturedOn") .partitioning({ strategy: "range", keys: ["capturedOn"], partitions: [], series: { start: "2026-01-01", end: "2027-01-01", unit: "month", name: "captures_{year}_{month}", }, }); ``` LIST supports one scalar key, as required by PostgreSQL. RANGE and HASH support ordered composite `keys`. LIST bounds use scalar `values`; RANGE bounds are ordered `lower`/`upper` tuples with the same arity as `keys`, with inclusive lower and exclusive upper bounds. A null endpoint or trailing null tuple components mean MINVALUE/MAXVALUE. HASH bounds use `modulus` and `remainder`; compatible mixed moduli are checked for divisibility and overlap. Hash layouts cannot have a default partition. Explicit `default` bounds cover otherwise uncovered LIST/RANGE values. Nested layouts are supported up to four levels and 1024 physical children per logical table. A bounded calendar `series` supports day, month and year units with a positive step. Start/end dates and name placeholders (`{year}`, `{month}`, `{day}`) are explicit. Monthly and yearly series start on calendar boundaries; the end must align with the chosen step. The Engine expands the series deterministically without consulting a clock. Extending the end produces additive migration steps for future partitions. No scheduler, automatic expiry, implicit data deletion or distributed sharding is introduced. Primary keys and unique indexes must contain all keys in the complete partition tree. Composite references must include the target route keys; required companion fields let one composite foreign key preserve the authored scalar relation. Nullable companions do not silently replace stronger scalar enforcement. Canonical validation checks names, key resolution/types, tuple arity, bounds, calendar intervals and effective key compatibility. Physical child names are unique within their namespace, lowercase PostgreSQL identifiers of at most 63 characters. SQL syntax and field naming variants remain pack responsibilities. Capable persistence packs declare `capabilities.partitioning: true`. They receive the normalized layout at `schema.facets.storage.partitioning`, with `keys` as NameContext lists and parent-before-child flattened partitions; an aggregate projection is also available at `pack.connection.partitioning`. SQL packs and migrations consume the same canonical layout. Initial and additive SQL generation, exact numeric/UUID/timezone normalization, nested parent ordering and catalog topology verification are supported. Converting populated tables, changing/removing bounds or keys, or adding routes beside a populated default partition requires an explicit reviewed migration intervention and verification. The Engine never widens keys or moves/deletes existing rows implicitly. RANGE keys currently cover numeric, date and timestamp values; expression keys, custom collations/operator classes and tablespaces are outside the supported typed adapter. An inherited layout cannot be overridden. --- # Find and use packs Packs are reusable implementations: they turn your definitions into NestJS controllers, TypeORM entities, Zod schemas, FastAPI routes, Flutter clients and more. Official packs are published to the Dryv pack registry, which the Platform API serves publicly. The CLI and the [pack catalogue](https://packs.dryvcode.com) both read it, with no sign-in. ## Search and read ```bash dryv pack search validation # find packs by name, language, framework or tag dryv pack info inject/backend/nestjs dryv pack describe inject/backend/nestjs # the full README, what it needs and provides dryv pack explain inject/backend/nestjs # how to bind and activate it in dryv.yaml ``` Use `--json` for scripts and agents. Retired packs stay readable but are marked retired. ## Add a pack ```bash dryv pack add inject/backend/nestjs --activation server --destination src/server --yes ``` This writes an explicit activation to `dryv.yaml`, pinned to the **commit** the registry has published, so your generation is repeatable. The registry only tracks each pack's latest state; GitHub (`dryvcode/packs`) keeps the history. Move to a newer commit on purpose with `dryv pack update`. ## Needs and provides A pack can need capabilities from other packs, for example `schema.persistence`. Bind them in `dryv.yaml`: ```yaml packs: server: source: { $ref: "#/sources/packs/official", path: inject/backend/nestjs } destination: { $ref: "#/destinations/server" } bind: schema.persistence: { $ref: "#/packs/entities" } ``` `dryv pack explain` lists exactly which capabilities a pack needs. ## Offline and your own packs Without network access the CLI falls back to a local checkout of the packs repository (`DRYV_PACKS_REPO`). To build your own packs see [Extensibility](/docs/ecosystem/extensibility) and `dryv pack init`. --- # Agents and CI Dryv is built to be driven by scripts and agents as safely as by people. ## Give an agent the context `dryv init` writes `dryv/README.md` and a Dryv block in `AGENTS.md`. Refresh them any time: ```bash dryv docs --write ``` Agents can read the built-in guides offline: `dryv docs`, `dryv docs dryv-yaml`, `dryv docs errors`, `dryv docs agents`. ## Rules an agent should follow - Use `--json --no-input` and branch on `status` and `code`. - Order: `dryv doctor`, `validate`, `plan`, `generate --dry-run`, then `generate --yes`. - Never hand-edit managed generated files; change the definitions or the pack. - Ask the user before choosing names, structure or behaviour. - Use `dryv why ` before touching a generated file. ## CI ```bash dryv generate --check --json --no-input ``` It exits with status 2 when generated output is out of date. Grant workspace trust explicitly with `dryv trust --yes`: Dryv never trusts a workspace on its own in CI. The engine needs no key or token. See the [CLI reference](/docs/usage/cli) for every command and error code. ## The loop at a glance ```mermaid flowchart TD D["dryv doctor"] --> V["dryv validate"] V --> P["dryv plan"] P --> R["dryv generate --dry-run"] R --> G{"Diff as expected?"} G -- yes --> W["dryv generate --yes"] G -- no --> E["Fix definitions or pack"] E --> V W --> X["dryv generate --check in CI"] ``` --- # Clean up generated code Generated files can contain imports a particular output does not use, for example when a pack emits a shared header and a project needs only part of it. Dryv does not rewrite those imports itself. It runs **actions** you choose on the staged files, before they are written, so the cleanup is explicit, repeatable and part of your project. ## One command ```bash dryv action list # the available presets dryv action add clean-imports-typescript --yes # TypeScript and JavaScript dryv action add clean-imports-python --yes # Python ``` This adds the action to `dryv.yaml` under `actions` and puts it **first** in the action list of every code destination, so it runs before your formatter. Use `--destination ` (repeatable) to attach it to specific destinations only, and `--dry-run` to preview. Running it again changes nothing. | Preset | Runs | Needs | | -------------------------- | ------------------------------------------------------------------- | ------------------------------- | | `clean-imports-typescript` | Biome's `noUnusedImports` fix on `.ts .tsx .mts .cts .js .jsx .mjs` | Node.js (`npx` downloads Biome) | | `clean-imports-python` | Ruff's `F401` fix on `.py` | `uv` (`uvx` runs Ruff) | | `clean-imports-go` | `goimports -w` on `.go` (removes unused and adds missing imports) | `goimports` on the `PATH` | | `clean-imports-dart` | `dart fix --apply --code=unused_import` after files are written | the Dart SDK | The TypeScript and Python presets were run against real files and removed unused imports. The Go and Dart presets use those tools' standard commands but have not been run in CI. ## What it adds ```yaml actions: clean-imports-typescript: stage: files extensions: [.ts, .tsx, .mts, .cts, .js, .jsx, .mjs] commands: - run: [ npx, --yes, "@biomejs/biome@2", lint, --write, --unsafe, --only=correctness/noUnusedImports, $(files), ] destinations: entities: path: src/entities actions: - { $ref: "#/actions/clean-imports-typescript" } # first: clean up - { $ref: "#/actions/format" } # then format ``` `stage: files` actions run on the staged output before Dryv compares and writes it, so the diff you review is already clean. `stage: final` actions run after files are written, from the destination directory. > [!NOTE] > Biome only removes unused imports when the rule is selected and `--unsafe` is passed. A plain `biome lint --write` does **not** remove them. Removing one name from `{ a, b }` can leave `{ a, }`, so keep a formatter action after it. ## Write your own Any command that rewrites files works: `eslint --fix` with the `unused-imports` plugin, `ruff check --select F401,I --fix`, `gofmt`, `cargo fix`, `google-java-format --replace`. Declare it once under `actions` with a `stage`, and select it on destinations with `$ref`. See [dryv.yaml](/docs/usage/dryv-yaml) and the action rules in [Actions and commands](/pack-builders/design/actions). ## Tips - Run `dryv generate --dry-run` first: the diff shows the cleaned files. - `dryv generate --no-actions` skips every action, which is useful when debugging a template. - Actions run argv directly, without a shell, and project-controlled commands need workspace trust (`dryv trust`). - In CI, `dryv generate --check` fails when the output, cleaned by your actions, differs from what is committed. --- # CLI reference The `dryv` CLI is the client that owns your filesystem. It compiles your authored source, talks to the engine, shows diffs and writes generated files only after you approve. Install it with [Installation](/docs/usage/installation). For every option of every command, see [All CLI commands](/docs/cli/commands). ## Global options | Option | Meaning | | --------------- | ------------------------------------------------------------------------ | | `--api ` | Engine URL. Defaults to `DRYV_API_URL`, then the Engine of the [local daemon](/docs/guides/local-daemon), which the CLI starts when needed. | | `--root ` | Project root. Defaults to the current directory. | | `-y, --yes` | Approve a known change without prompting. It never picks missing values. | | `--json` | Print one machine-readable JSON result. | | `--no-input` | Never prompt. Fail with a clear code when input is required. | | `-q, --quiet` | Print only errors and the final result. | Use `--json --no-input` in CI and from agents. Results share one envelope (`dryv.cli.result/v1alpha1`) with stable codes such as `DRYV_INPUT_REQUIRED`, `DRYV_TRUST_REQUIRED`, `DRYV_PLAN_STALE` and `DRYV_NOT_FOUND`. ## Set up a project | Command | What it does | Writes? | | --------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | | `dryv init` | Previews and creates `dryv.yaml`, plus `dryv/README.md` and an `AGENTS.md` block for agents (`--no-docs` skips them). Refuses to overwrite one. | yes | | `dryv configure` | Previews structured edits to `dryv.yaml`, such as build settings. | yes | | `dryv pack search` | Searches the official pack catalogue. | no | | `dryv pack list / info` | Lists packs, or shows one. Read from the Dryv registry. | no | | `dryv pack describe ` | Prints a pack's README, what it needs and what it provides. | no | | `dryv pack explain ` | Explains how to bind and activate it in `dryv.yaml`. | no | | `dryv pack add ` | Adds a pack as an explicit activation in `dryv.yaml`. | yes | | `dryv pack remove` | Removes an activation. | yes | | `dryv pack update` | Moves a pack source to a new ref. | yes | | `dryv action list / add ` | Adds a ready-made action such as removing unused imports and attaches it to your destinations. See [Clean up generated code](/docs/usage/clean-generated-code). | yes | | `dryv pack catalog` | Inspects the official pack catalogue. | no | | `dryv server setup` | Writes a `dryv.server.yaml` that wires the API and template servers. | yes | The catalogue is for discovery only. `pack add` writes the exact source and ref into `dryv.yaml`, so what you generate with is always visible in your repository. ## Generate | Command | What it does | Writes? | | ------------------------- | ----------------------------------------------------------------- | ------------------- | | `dryv build` | Compiles authored source to Runtime IR files (YAML, JSON, JSONL). | yes | | `dryv validate` | Compiles and validates against the engine. | no | | `dryv plan` | Shows every planned file, its template and its path. | no | | `dryv generate --dry-run` | Renders and shows the diff. | no | | `dryv generate` | Renders, shows the diff and asks before writing. | yes, after approval | | `dryv generate --check` | Exits with status 2 when generated files are out of date (CI). | no | | `dryv apply ` | Applies a saved plan without re-rendering. | yes | | `dryv undo` | Reverts the most recent apply while its journal is still valid. | yes | `--diff stat|names|full` controls how much of the diff is printed. `--no-actions` skips pack actions such as dependency installs. ### Edited generated files If you changed a managed file and your definition changed it too, Dryv reports a conflict instead of overwriting. Choose with `--conflicts block|overwrite|keep` on `generate` or `apply`. `--yes` alone never resolves a conflict. ## Database schema changes | Command | What it does | Writes? | | ----------------------- | -------------------------------------------------------------------------------- | ------------------- | | `dryv migrate plan / generate / apply / status / verify / adopt` | Plans, renders and applies reviewed PostgreSQL schema changes for your project. | yes, after approval | | `dryv checkpoint approve / status` | Approves or inspects the durable generation baselines that migrations compare to. | yes | ## Tasks and agent | Command | What it does | | ---------------- | ------------------------------------------------------------------------------ | | `dryv task` | Manages the project's tasks: create, list, update, check, comment, validate, sync. See [Tasks](/docs/guides/tasks). `dryv tasks` is an alias. | | `dryv code` | Opens the Dryv coding agent, or runs one of its commands. See [Dryv agent](/docs/guides/agent). `dryv agent` and `dryvcode` are aliases. | ## Understand | Command | What it does | | --------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | | `dryv status` | Shows generated output drift and freshness. | | `dryv why ` | Explains why one generated path exists, from persisted evidence. | | `dryv explain change` | Explains what caused the current or a past generated change. | | `dryv context list / show ` | Lists the template context vocabulary the engine serves, or explains one path. | | `dryv watch` | Follows project activity produced by any connected client. | | `dryv ui` | Opens the optional full-screen terminal interface. | | `dryv docs [topic]` | Prints built-in guides (workflow, dryv-yaml, pack-yaml, authoring, errors, agents). `--write` refreshes `dryv/README.md` and the `AGENTS.md` block. | ## Environment and trust | Command | What it does | | --------------------------- | ------------------------------------------------------------------------- | | `dryv doctor` | Checks project, engine, pack catalogue and execution readiness. | | `dryv info` | Shows the engine, its version and its template servers. | | `dryv capabilities` | Shows which workflows this machine and engine support. | | `dryv trust / trust revoke` | Grants or removes trust for running project-controlled code. | | `dryv local ` | Manages the local daemon that runs your Engine: `connect`, `start`, `status`, `restart`, `stop`, `logs`, `link`. See [Local daemon](/docs/guides/local-daemon). | | `dryv update` | Installs the latest Dryv release next to this one, verifies it and switches to it. See [Update the CLI](#update-the-cli). | | `dryv login / logout` | Signs in to or out of the Dryv Platform. Only needed to sync, publish, use private packs, use the Playground or export your data. See [Sign in and sync](/docs/guides/sync). | | `dryv whoami` | Shows the signed-in Dryv Platform identity. | | `dryv clean` | Removes Dryv plans, journals, logs and caches stored outside the project. | Trust lets Dryv run your author compiler, install dependencies and run pack actions. It never approves file changes. In CI, grant it explicitly: Dryv never trusts a workspace on its own without a prompt. The engine needs no key or token, whether it runs on your machine or you host it yourself. Everything on this page except `login`, `logout`, `whoami` and Platform sync works without signing in. ## Build your own plugins | Command | For | | -------------------------------------------------------- | --------------------------------------- | | `dryv pack init/inspect/validate/doctor/test` | Developing a pack. | | `dryv author init/inspect/validate/doctor/test` | Developing an author and compiler pair. | | `dryv template-server init/inspect/validate/doctor/test` | Developing a template server. | | `dryv check [path]` | Validating any `dryv.*.yaml` artifact. | | `dryv ir build` | Writing portable Runtime IR on its own. | | `dryv server info/plugins/setup/inspect/validate/doctor` | Inspecting and configuring the API and template server wiring. | | `dryv pack catalog validate` | Validating a pack catalogue. | See [Extensibility](/docs/ecosystem/extensibility). ## Update the CLI ```bash dryv update ``` `dryv update` downloads the latest release next to the one you run, verifies it, and switches to it. | Option | Meaning | | --- | --- | | `--channel ` | Release channel. Defaults to `stable`, or `DRYV_CHANNEL`. | | `--to ` | Install this exact version. | | `--force` | Reinstall even when you already have the latest version. | ## Environment variables | Variable | Used for | | --- | --- | | `DRYV_API_URL` | The Engine to use instead of the local daemon's Engine. | | `DRYV_PLATFORM_URL` | The Dryv Platform API for `login`, `logout`, `whoami`, private packs and the pack catalogue, instead of `https://api.dryvcode.com`. Leave it unset to use Dryv. | | `DRYV_LOCAL_HOME` | The local daemon's home. Defaults to `~/.dryv/local`. | | `DRYV_LOCAL_COMMAND` | The command that runs the local daemon, when the CLI cannot find it. | | `DRYV_CONFIG_HOME` | Where the Platform session file is stored when no keychain is available. | | `DRYV_CHANNEL` | The release channel for `dryv update`. | --- # All CLI commands This page lists every `dryv` command with its options. It is generated from the CLI's own `--help` output, so it matches what the CLI accepts. For an overview, read the [CLI reference](/docs/usage/cli). Run `dryv --help` for the same text in your terminal. `dryv code`, `dryv task`, `dryv local` and `dryv update` have their own pages: [Dryv agent](/docs/guides/agent), [Tasks](/docs/guides/tasks) and [Local daemon](/docs/guides/local-daemon). `dryv update` is described in the [CLI reference](/docs/usage/cli#update-the-cli). When you do not pass `--api` or set `DRYV_API_URL`, commands use the Engine of your [local daemon](/docs/guides/local-daemon). The daemon starts it on demand on a free port on 127.0.0.1, so there is no fixed address. Run `dryv local status` to see it. ## dryv ui Open the full-screen Dryv project interface. ```text dryv ui [options] ``` | Option | Meaning | | --- | --- | | `--api ` | Dryv API base URL (default: the Engine served by the local daemon, started on demand on a free 127.0.0.1 port; see `dryv local status`) | | `--root ` | project root (default: the current directory) | ## dryv capabilities Show supported Dryv product workflows. ```text dryv capabilities [options] ``` | Option | Meaning | | --- | --- | | `--api ` | Dryv API base URL (default: the Engine served by the local daemon, started on demand on a free 127.0.0.1 port; see `dryv local status`) | | `--root ` | project root (default: the current directory) | | `--json` | print one JSON result document to stdout (default: false) | | `--no-input` | accepted for automation parity; capability inspection never prompts | ## dryv info Show Dryv API, client-session, engine, and Template Server capabilities. ```text dryv info [options] ``` | Option | Meaning | | --- | --- | | `--api ` | Dryv API base URL (default: the Engine served by the local daemon, started on demand on a free 127.0.0.1 port; see `dryv local status`) | | `--root ` | project root for dryv.server.yaml resolution (default: the current directory) | | `--json` | print one JSON result document to stdout (default: false) | | `--no-input` | accepted for automation parity; info never prompts | ## dryv context Discover the template context vocabulary served by the engine. ```text dryv context [options] [command] ``` | Subcommand | What it does | | --- | --- | | `list [options]` | list context roots and types | | `show [options] ` | show what one context path reads, e.g. schema.fields[].value.is.boolean | ## dryv context list List context roots and types. ```text dryv context list [options] ``` | Option | Meaning | | --- | --- | | `--api ` | Dryv API base URL (default: the Engine served by the local daemon, started on demand on a free 127.0.0.1 port; see `dryv local status`) | | `--json` | print the catalog as JSON (default: false) | | `--no-input` | accepted for automation parity; context inspection never prompts | ## dryv context show Show what one context path reads, e.g. schema.fields[].value.is.boolean. ```text dryv context show [options] ``` | Option | Meaning | | --- | --- | | `--api ` | Dryv API base URL (default: the Engine served by the local daemon, started on demand on a free 127.0.0.1 port; see `dryv local status`) | | `--json` | print the result as JSON (default: false) | | `--no-input` | accepted for automation parity; context inspection never prompts | ## dryv watch Watch shared project activity produced by any connected Dryv client. ```text dryv watch [options] ``` | Option | Meaning | | --- | --- | | `--api ` | Dryv API base URL (default: the Engine served by the local daemon, started on demand on a free 127.0.0.1 port; see `dryv local status`) | | `--root ` | project root (default: the current directory) | | `--system` | also watch API and Template Server system activity (default: false) | | `--from-now` | do not replay buffered activity when subscribing (default: false) | ## dryv build Resolve authoring requirements and compile authored source into canonical Runtime IR. ```text dryv build [options] ``` | Option | Meaning | | --- | --- | | `--api ` | Dryv API base URL (default: the Engine served by the local daemon, started on demand on a free 127.0.0.1 port; see `dryv local status`) | | `--root ` | project root (default: the current directory) | | `--yes` | approve requested environment changes without prompting (default: false) | | `--json` | print one JSON result document to stdout (default: false) | | `--ir-out ` | override Runtime IR output directory for this invocation | | `--ir-name ` | override Runtime IR output base filename for this invocation | | `--ir-format ` | Runtime IR format to write; repeat for multiple formats (default: []) | | `--no-input` | do not prompt; fail rather than request environment mutation approval | ## dryv init Create an explicit dryv.yaml usage document for this project. ```text dryv init [options] ``` | Option | Meaning | | --- | --- | | `--root ` | project root (default: the current directory) | | `--author ` | authoring source: ir, typescript, or python (default: "ir") | | `--author-path ` | IR file path or authored entrypoint path (defaults inside workspace.path) | | `--pack ` | pack activation to add; repeatable (default: []) | | `--workspace-path ` | Dryv working folder (default: "dryv") | | `--pack-source-path ` | local pack source directory (defaults inside workspace.path) | | `--destination ` | base generated-code destination (default: "generated") | | `--dry-run` | preview dryv.yaml without writing (default: false) | | `--no-docs` | do not seed documentation and agent resources | | `-y, --yes` | write without prompting (default: false) | | `--json` | print the planned init result as JSON (default: false) | | `--no-input` | do not prompt; fail clearly when approval is required | ## dryv docs Show built-in guides, or write them into this project. ```text dryv docs [options] [topic] [query...] ``` | Option | Meaning | | --- | --- | | `topic` | guide topic; omit to list topics, or `search` to query the Dryv knowledge base | | `query` | search words, with `dryv docs search` | | `--root ` | project root (default: the current directory) | | `--write` | refresh working-folder documentation and root agent pointer (default: false) | | `--json` | print the result as JSON (default: false) | ## dryv configure Preview and write structured dryv.yaml configuration edits. ```text dryv configure [options] ``` | Option | Meaning | | --- | --- | | `--root ` | project root (default: the current directory) | | `--default-action ` | build default action: plan or generate | | `--cache ` | build cache mode: reuse, refresh, or disabled | | `--dry-run` | preview dryv.yaml without writing (default: false) | | `-y, --yes` | write without prompting (default: false) | | `--json` | print the planned configure result as JSON (default: false) | | `--no-input` | do not prompt; fail clearly when approval is required | ## dryv action Add ready-made generation actions, such as removing unused imports. ```text dryv action [options] [command] ``` | Subcommand | What it does | | --- | --- | | `list [options]` | list the available action presets | | `add [options] ` | add a preset to dryv.yaml and attach it to your code destinations | ## dryv action list List the available action presets. ```text dryv action list [options] ``` | Option | Meaning | | --- | --- | | `--json` | print as JSON (default: false) | ## dryv action add Add a preset to dryv.yaml and attach it to your code destinations. ```text dryv action add [options] ``` | Option | Meaning | | --- | --- | | `--root ` | project root (default: the current directory) | | `--destination ` | destination to attach it to; repeatable (default: all code destinations) (default: []) | | `--name ` | action id in dryv.yaml (default: the preset id) | | `--dry-run` | preview dryv.yaml without writing (default: false) | | `-y, --yes` | write without prompting (default: false) | | `--json` | print the planned edit as JSON (default: false) | | `--no-input` | do not prompt | ## dryv pack Develop, discover and manage Dryv packs. ```text dryv pack [options] [command] ``` | Subcommand | What it does | | --- | --- | | `search [options] [query]` | search the official pack catalog projection | | `list [options]` | list all official packs | | `info [options] ` | show one catalog pack | | `describe [options] ` | show a pack's README, needs and provides | | `explain [options] ` | explain how to bind and activate a pack in dryv.yaml | | `add [options] ` | add a catalog pack as an explicit dryv.yaml activation | | `remove [options] ` | remove a pack activation from dryv.yaml | | `update [options]` | update an explicit pack source ref in dryv.yaml | | `catalog` | inspect the official pack catalog projection | | `init [options] [path]` | create a minimal dryv.pack.yaml and pack filesystem | | `inspect [options] [path]` | inspect one local pack using Engine-validated facts | | `validate [options] [path]` | validate one local pack against filesystem and Engine semantics | | `doctor [options] [path]` | check local pack renderer and action runtime readiness | | `test [options] [path]` | run a local pack against Engine-owned canonical IR in an isolated temp workspace | ## dryv pack search Search the official pack catalog projection. ```text dryv pack search [options] [query] ``` | Option | Meaning | | --- | --- | | `--root ` | project root (default: the current directory) | | `--json` | print catalog entries as JSON (default: false) | | `-y, --yes` | accepted for option consistency; has no effect (default: false) | | `--no-input` | do not prompt | | `--dry-run` | accepted for option consistency; has no effect (default: false) | ## dryv pack list List all official packs. ```text dryv pack list [options] ``` | Option | Meaning | | --- | --- | | `--root ` | project root (default: the current directory) | | `--json` | print catalog entries as JSON (default: false) | | `-y, --yes` | accepted for option consistency; has no effect (default: false) | | `--no-input` | do not prompt | | `--dry-run` | accepted for option consistency; has no effect (default: false) | ## dryv pack info Show one catalog pack. ```text dryv pack info [options] ``` | Option | Meaning | | --- | --- | | `--root ` | project root (default: the current directory) | | `--json` | print pack info as JSON (default: false) | | `-y, --yes` | accepted for option consistency; has no effect (default: false) | | `--no-input` | do not prompt | | `--dry-run` | accepted for option consistency; has no effect (default: false) | ## dryv pack describe Show a pack's README, needs and provides. ```text dryv pack describe [options] ``` | Option | Meaning | | --- | --- | | `--root ` | project root (default: the current directory) | | `--json` | print as JSON (default: false) | | `-y, --yes` | accepted for option consistency (default: false) | | `--no-input` | do not prompt | | `--dry-run` | accepted for option consistency (default: false) | ## dryv pack explain Explain how to bind and activate a pack in dryv.yaml. ```text dryv pack explain [options] ``` | Option | Meaning | | --- | --- | | `--root ` | project root (default: the current directory) | | `--json` | print as JSON (default: false) | | `-y, --yes` | accepted for option consistency (default: false) | | `--no-input` | do not prompt | | `--dry-run` | accepted for option consistency (default: false) | ## dryv pack add Add a catalog pack as an explicit dryv.yaml activation. ```text dryv pack add [options] ``` | Option | Meaning | | --- | --- | | `--root ` | project root (default: the current directory) | | `--activation ` | project activation key | | `--destination ` | generated-code destination path | | `--source-name ` | pack source key in dryv.yaml (default: "official") | | `--dry-run` | preview dryv.yaml without writing (default: false) | | `-y, --yes` | write without prompting (default: false) | | `--json` | print the planned edit as JSON (default: false) | | `--no-input` | do not prompt; fail clearly when approval is required | ## dryv pack remove Remove a pack activation from dryv.yaml. ```text dryv pack remove [options] ``` | Option | Meaning | | --- | --- | | `--root ` | project root (default: the current directory) | | `--dry-run` | preview dryv.yaml without writing (default: false) | | `-y, --yes` | write without prompting (default: false) | | `--json` | print the planned edit as JSON (default: false) | | `--no-input` | do not prompt; fail clearly when approval is required | ## dryv pack update Update an explicit pack source ref in dryv.yaml. ```text dryv pack update [options] ``` | Option | Meaning | | --- | --- | | `--root ` | project root (default: the current directory) | | `--source-name ` | pack source key in dryv.yaml (default: "official") | | `--ref ` | new source ref (default: "develop") | | `--dry-run` | preview dryv.yaml without writing (default: false) | | `-y, --yes` | write without prompting (default: false) | | `--json` | print the planned edit as JSON (default: false) | | `--no-input` | do not prompt; fail clearly when approval is required | ## dryv pack catalog Inspect the official pack catalog projection. ```text dryv pack catalog [options] [command] ``` | Subcommand | What it does | | --- | --- | | `validate [options]` | validate the local official catalog projection | ## dryv pack catalog validate Validate the local official catalog projection. ```text dryv pack catalog validate [options] ``` | Option | Meaning | | --- | --- | | `--root ` | project root (default: the current directory) | | `--json` | print validation result as JSON (default: false) | | `-y, --yes` | accepted for option consistency; has no effect (default: false) | | `--no-input` | do not prompt | | `--dry-run` | accepted for option consistency; has no effect (default: false) | ## dryv pack init Create a minimal dryv.pack.yaml and pack filesystem. ```text dryv pack init [options] [path] ``` | Option | Meaning | | --- | --- | | `--key ` | pack key; defaults from the target directory name | | `--title ` | pack title; defaults to the key | | `--version <version>` | pack version (default: "0.0.1") | | `--layout <layout>` | pack layout: inject or unit (default: "inject") | | `--source <path>` | pack source directory (default: "templates") | | `--renderer <name>` | required Template Server/provider name | | `--renderer-version <version>` | required renderer version or compatible constraint | | `--extension <suffix>` | renderer-owned terminal extension; repeatable (default: []) | | `--starter-subject <subject>` | optional neutral starter selection subject | | `--api <url>` | Dryv API base URL (default: the Engine served by the local daemon, started on demand on a free 127.0.0.1 port; see `dryv local status`) | | `--json` | print one JSON result document to stdout (default: false) | | `-y, --yes` | approve requested writes without prompting (default: false) | | `--no-input` | do not prompt | ## dryv pack inspect Inspect one local pack using Engine-validated facts. ```text dryv pack inspect [options] [path] ``` | Option | Meaning | | --- | --- | | `--api <url>` | Dryv API base URL (default: the Engine served by the local daemon, started on demand on a free 127.0.0.1 port; see `dryv local status`) | | `--json` | print one JSON result document to stdout (default: false) | | `-y, --yes` | approve requested writes without prompting (default: false) | | `--no-input` | do not prompt | ## dryv pack validate Validate one local pack against filesystem and Engine semantics. ```text dryv pack validate [options] [path] ``` | Option | Meaning | | --- | --- | | `--api <url>` | Dryv API base URL (default: the Engine served by the local daemon, started on demand on a free 127.0.0.1 port; see `dryv local status`) | | `--json` | print one JSON result document to stdout (default: false) | | `-y, --yes` | approve requested writes without prompting (default: false) | | `--no-input` | do not prompt | ## dryv pack doctor Check local pack renderer and action runtime readiness. ```text dryv pack doctor [options] [path] ``` | Option | Meaning | | --- | --- | | `--api <url>` | Dryv API base URL (default: the Engine served by the local daemon, started on demand on a free 127.0.0.1 port; see `dryv local status`) | | `--json` | print one JSON result document to stdout (default: false) | | `-y, --yes` | approve requested writes without prompting (default: false) | | `--no-input` | do not prompt | ## dryv pack test Run a local pack against Engine-owned canonical IR in an isolated temp workspace. ```text dryv pack test [options] [path] ``` | Option | Meaning | | --- | --- | | `--no-actions` | skip Engine-resolved file and final actions | | `--api <url>` | Dryv API base URL (default: the Engine served by the local daemon, started on demand on a free 127.0.0.1 port; see `dryv local status`) | | `--json` | print one JSON result document to stdout (default: false) | | `-y, --yes` | approve requested writes without prompting (default: false) | | `--no-input` | do not prompt | ## dryv author Develop and prove Dryv author/compiler plugins. ```text dryv author [options] [command] ``` | Subcommand | What it does | | --- | --- | | `init [options] [path]` | create dryv.author.yaml and author/compiler package boundaries | | `inspect [options] [path]` | inspect a local author/compiler plugin without executing it | | `validate [options] [path]` | validate a local author manifest and package metadata | | `doctor [options] [path]` | check compiler resolution, version and Authoring Protocol handshake | | `test [options] [path]` | compile a language fixture and compare it with Dryv-owned canonical Runtime IR | ## dryv author init Create dryv.author.yaml and author/compiler package boundaries. ```text dryv author init [options] [path] ``` | Option | Meaning | | --- | --- | | `--id <id>` | author implementation id | | `--language <id>` | language id | | `--extension <suffix>` | language source extension | | `--author-ecosystem <name>` | author package ecosystem | | `--author-package <name>` | author package name | | `--compiler-ecosystem <name>` | compiler package ecosystem | | `--compiler-package <name>` | compiler package name | | `--compiler-executable <name>` | compiler executable | | `--version <version>` | initial author/compiler version (default: "0.0.1") | | `--api <url>` | Dryv API base URL (default: the Engine served by the local daemon, started on demand on a free 127.0.0.1 port; see `dryv local status`) | | `--json` | print one JSON result document to stdout (default: false) | | `-y, --yes` | approve requested writes without prompting (default: false) | | `--no-input` | do not prompt | ## dryv author inspect Inspect a local author/compiler plugin without executing it. ```text dryv author inspect [options] [path] ``` | Option | Meaning | | --- | --- | | `--api <url>` | Dryv API base URL (default: the Engine served by the local daemon, started on demand on a free 127.0.0.1 port; see `dryv local status`) | | `--json` | print one JSON result document to stdout (default: false) | | `-y, --yes` | approve requested writes without prompting (default: false) | | `--no-input` | do not prompt | ## dryv author validate Validate a local author manifest and package metadata. ```text dryv author validate [options] [path] ``` | Option | Meaning | | --- | --- | | `--api <url>` | Dryv API base URL (default: the Engine served by the local daemon, started on demand on a free 127.0.0.1 port; see `dryv local status`) | | `--json` | print one JSON result document to stdout (default: false) | | `-y, --yes` | approve requested writes without prompting (default: false) | | `--no-input` | do not prompt | ## dryv author doctor Check compiler resolution, version and Authoring Protocol handshake. ```text dryv author doctor [options] [path] ``` | Option | Meaning | | --- | --- | | `--compiler <path>` | override compiler executable for this invocation | | `--api <url>` | Dryv API base URL (default: the Engine served by the local daemon, started on demand on a free 127.0.0.1 port; see `dryv local status`) | | `--json` | print one JSON result document to stdout (default: false) | | `-y, --yes` | approve requested writes without prompting (default: false) | | `--no-input` | do not prompt | ## dryv author test Compile a language fixture and compare it with Dryv-owned canonical Runtime IR. ```text dryv author test [options] [path] ``` | Option | Meaning | | --- | --- | | `--compiler <path>` | override compiler executable for this invocation | | `--entrypoint <path>` | language fixture entrypoint; defaults to fixtures/complete<language-extension> | | `--api <url>` | Dryv API base URL (default: the Engine served by the local daemon, started on demand on a free 127.0.0.1 port; see `dryv local status`) | | `--json` | print one JSON result document to stdout (default: false) | | `-y, --yes` | approve requested writes without prompting (default: false) | | `--no-input` | do not prompt | ## dryv template-server Develop and prove Dryv Template Server plugins. ```text dryv template-server [options] [command] ``` | Subcommand | What it does | | --- | --- | | `init [options] [path]` | create a dryv.server.yaml Template Server manifest | | `inspect [options] [path]` | inspect Template Server manifest entries | | `validate [options] [path]` | validate Template Server manifest wiring without launching it | | `doctor [options] [path]` | connect to Template Server discovery endpoints and verify protocol identity | | `test [options] [path]` | run Dryv-owned Template Server protocol conformance | ## dryv template-server init Create a dryv.server.yaml Template Server manifest. ```text dryv template-server init [options] [path] ``` | Option | Meaning | | --- | --- | | `--name <name>` | Template Server name (default: "custom") | | `--url <url>` | Template Server endpoint (default: "http://127.0.0.1:8769") | | `--command <arg>` | launch command argument; repeatable (default: []) | | `--api <url>` | Dryv API base URL (default: the Engine served by the local daemon, started on demand on a free 127.0.0.1 port; see `dryv local status`) | | `--json` | print one JSON result document to stdout (default: false) | | `-y, --yes` | approve requested writes without prompting (default: false) | | `--no-input` | do not prompt | ## dryv template-server inspect Inspect Template Server manifest entries. ```text dryv template-server inspect [options] [path] ``` | Option | Meaning | | --- | --- | | `--name <name>` | inspect one Template Server entry | | `--api <url>` | Dryv API base URL (default: the Engine served by the local daemon, started on demand on a free 127.0.0.1 port; see `dryv local status`) | | `--json` | print one JSON result document to stdout (default: false) | | `-y, --yes` | approve requested writes without prompting (default: false) | | `--no-input` | do not prompt | ## dryv template-server validate Validate Template Server manifest wiring without launching it. ```text dryv template-server validate [options] [path] ``` | Option | Meaning | | --- | --- | | `--name <name>` | validate one Template Server entry | | `--api <url>` | Dryv API base URL (default: the Engine served by the local daemon, started on demand on a free 127.0.0.1 port; see `dryv local status`) | | `--json` | print one JSON result document to stdout (default: false) | | `-y, --yes` | approve requested writes without prompting (default: false) | | `--no-input` | do not prompt | ## dryv template-server doctor Connect to Template Server discovery endpoints and verify protocol identity. ```text dryv template-server doctor [options] [path] ``` | Option | Meaning | | --- | --- | | `--name <name>` | doctor one Template Server entry | | `--launch` | launch an unreachable manifest-declared local command for this check (default: false) | | `--api <url>` | Dryv API base URL (default: the Engine served by the local daemon, started on demand on a free 127.0.0.1 port; see `dryv local status`) | | `--json` | print one JSON result document to stdout (default: false) | | `-y, --yes` | approve requested writes without prompting (default: false) | | `--no-input` | do not prompt | ## dryv template-server test Run Dryv-owned Template Server protocol conformance. ```text dryv template-server test [options] [path] ``` | Option | Meaning | | --- | --- | | `--name <name>` | test one Template Server entry | | `--launch` | launch an unreachable manifest-declared local command for this test (default: false) | | `--api <url>` | Dryv API base URL (default: the Engine served by the local daemon, started on demand on a free 127.0.0.1 port; see `dryv local status`) | | `--json` | print one JSON result document to stdout (default: false) | | `-y, --yes` | approve requested writes without prompting (default: false) | | `--no-input` | do not prompt | ## dryv doctor Inspect Dryv project, API, pack catalog and execution readiness. ```text dryv doctor [options] ``` | Option | Meaning | | --- | --- | | `--api <url>` | Dryv API base URL (default: the Engine served by the local daemon, started on demand on a free 127.0.0.1 port; see `dryv local status`) | | `--root <path>` | project root (default: the current directory) | | `--json` | print the doctor report as JSON (default: false) | | `--no-input` | do not prompt; doctor is observation-only | ## dryv clean Remove Dryv plans, journals, logs and caches stored outside the project. ```text dryv clean [options] ``` | Option | Meaning | | --- | --- | | `--root <path>` | project root (default: the current directory) | | `--global` | clean every project and the shared cache (default: false) | | `--all` | remove everything for the scope, ignoring retention (default: false) | | `--dry-run` | show what would be removed (default: false) | | `--json` | print the clean report as JSON (default: false) | | `--no-input` | do not prompt; clean never prompts | ## dryv check Detect and validate a Dryv artifact by explicit filename. ```text dryv check [options] [path] ``` | Option | Meaning | | --- | --- | | `--artifact <kind>` | artifact kind: project, pack, author, or server (choices: "project", "pack", "author", "server") | | `--app <name>` | select application activation; repeatable (default: []) | | `--pack <name>` | select pack activation; repeatable (default: []) | | `--store <name>` | select logical store; repeatable (default: []) | | `--with-dependencies` | include provider app outputs (default: false) | | `--api <url>` | Dryv API base URL (default: the Engine served by the local daemon, started on demand on a free 127.0.0.1 port; see `dryv local status`) | | `--root <path>` | project root (default: the current directory) | | `--json` | print one JSON result document to stdout (default: false) | | `--max-file-size-mb <number>` | maximum uploaded text file size in MiB (default: 5) | | `--exclude <pattern>` | additional .gitignore-style upload exclusion; repeatable (default: []) | | `-y, --yes` | approve requested environment changes without prompting (default: false) | | `--conflicts <resolution>` | resolve managed-file drift conflicts: block, overwrite or keep | | `--no-input` | do not prompt; fail clearly when input is required | ## dryv server Inspect and configure explicit Dryv API/Template Server wiring. ```text dryv server [options] [command] ``` | Subcommand | What it does | | --- | --- | | `info [options]` | show connected API, Engine and Template Server information | | `plugins [options]` | list live Template Server/plugin connections exposed by the API | | `setup [options]` | configure servers in dryv.yaml; does not deploy servers | | `inspect [options]` | inspect servers in dryv.yaml without connecting | | `validate [options]` | validate dryv.server.yaml wiring without connecting | | `doctor [options]` | validate dryv.server.yaml and check configured API and Template Servers | ## dryv server info Show connected API, Engine and Template Server information. ```text dryv server info [options] ``` | Option | Meaning | | --- | --- | | `--api <url>` | Dryv API base URL (default: the Engine served by the local daemon, started on demand on a free 127.0.0.1 port; see `dryv local status`) | | `--root <path>` | project root (default: the current directory) | | `--json` | print server information as JSON (default: false) | | `--no-input` | accepted for automation parity; server info never prompts | ## dryv server plugins List live Template Server/plugin connections exposed by the API. ```text dryv server plugins [options] ``` | Option | Meaning | | --- | --- | | `--api <url>` | Dryv API base URL (default: the Engine served by the local daemon, started on demand on a free 127.0.0.1 port; see `dryv local status`) | | `--root <path>` | project root (default: the current directory) | | `--json` | print Template Server information as JSON (default: false) | | `--no-input` | accepted for automation parity; plugin inspection never prompts | ## dryv server setup Configure servers in dryv.yaml; does not deploy servers. ```text dryv server setup [options] ``` | Option | Meaning | | --- | --- | | `--root <path>` | workspace root for the manifest (default: the current directory) | | `--output <path>` | project configuration filename (default: "dryv.yaml") | | `--name <name>` | API server manifest name (default: "local") | | `--url <url>` | Dryv API endpoint (default: "http://127.0.0.1:8750") | | `--template <name=url>` | Template Server endpoint; repeatable (default: []) | | `--dry-run` | preview the server manifest without writing (default: false) | | `-y, --yes` | write without prompting (default: false) | | `--json` | print the planned server manifest as JSON (default: false) | | `--no-input` | do not prompt; fail clearly when approval is required | ## dryv server inspect Inspect servers in dryv.yaml without connecting. ```text dryv server inspect [options] ``` | Option | Meaning | | --- | --- | | `--root <path>` | project root (default: the current directory) | | `--json` | print server manifest facts as JSON (default: false) | | `--no-input` | accepted for automation parity; server inspect never prompts | ## dryv server validate Validate dryv.server.yaml wiring without connecting. ```text dryv server validate [options] ``` | Option | Meaning | | --- | --- | | `--root <path>` | project root (default: the current directory) | | `--json` | print validation result as JSON (default: false) | | `--no-input` | accepted for automation parity; server validate never prompts | ## dryv server doctor Validate dryv.server.yaml and check configured API and Template Servers. ```text dryv server doctor [options] ``` | Option | Meaning | | --- | --- | | `--api <url>` | Dryv API base URL (default: the Engine served by the local daemon, started on demand on a free 127.0.0.1 port; see `dryv local status`) | | `--root <path>` | project root (default: the current directory) | | `--launch` | launch unreachable manifest-declared local Template Server commands for this check (default: false) | | `--json` | print server doctor result as JSON (default: false) | | `--no-input` | do not prompt; fail if --launch requires ungranted workspace trust | ## dryv trust Manage local trust for project-controlled Dryv execution. ```text dryv trust [options] [command] ``` | Subcommand | What it does | | --- | --- | | `status [options]` | show whether this workspace is locally trusted | | `revoke [options]` | remove local trust for this workspace | | Option | Meaning | | --- | --- | | `--root <path>` | project root (default: the current directory) | | `-y, --yes` | grant trust without prompting (default: false) | | `--json` | print trust result as JSON (default: false) | | `--no-input` | do not prompt; fail clearly when trust cannot be granted | ## dryv trust status Show whether this workspace is locally trusted. ```text dryv trust status [options] ``` | Option | Meaning | | --- | --- | | `--root <path>` | project root (default: the current directory) | | `-y, --yes` | accepted for option consistency; has no effect (default: false) | | `--json` | print trust status as JSON (default: false) | | `--no-input` | do not prompt | ## dryv trust revoke Remove local trust for this workspace. ```text dryv trust revoke [options] ``` | Option | Meaning | | --- | --- | | `--root <path>` | project root (default: the current directory) | | `-y, --yes` | accepted for option consistency; has no effect (default: false) | | `--json` | print trust status as JSON (default: false) | | `--no-input` | do not prompt | ## dryv migrate Plan, render and apply reviewed PostgreSQL schema changes. ```text dryv migrate [options] [command] ``` | Subcommand | What it does | | --- | --- | | `plan [options]` | See below. | | `generate [options]` | See below. | | `apply [options] <release>` | See below. | | `status [options]` | See below. | | `verify [options]` | See below. | | `adopt [options]` | See below. | ## dryv migrate plan ```text dryv migrate plan [options] ``` | Option | Meaning | | --- | --- | | `--root <path>` | project root (default: the current directory) | | `--api <url>` | Engine API (default: the Engine served by the local daemon, started on demand on a free 127.0.0.1 port; see `dryv local status`) | | `--store <name>` | explicit logical store | | `--interventions <path>` | project-relative reviewed intervention JSON | | `--allow-destructive` | acknowledge reviewed destructive steps (default: false) | | `--json` | print one JSON result (default: false) | ## dryv migrate generate ```text dryv migrate generate [options] ``` | Option | Meaning | | --- | --- | | `--root <path>` | project root (default: the current directory) | | `--api <url>` | Engine API (default: the Engine served by the local daemon, started on demand on a free 127.0.0.1 port; see `dryv local status`) | | `--store <name>` | explicit logical store | | `--interventions <path>` | project-relative reviewed intervention JSON | | `--allow-destructive` | acknowledge reviewed destructive steps (default: false) | | `--json` | print one JSON result (default: false) | ## dryv migrate apply ```text dryv migrate apply [options] <release> ``` | Option | Meaning | | --- | --- | | `--root <path>` | project root (default: the current directory) | | `--api <url>` | Engine API (default: the Engine served by the local daemon, started on demand on a free 127.0.0.1 port; see `dryv local status`) | | `--store <name>` | explicit logical store | | `--interventions <path>` | project-relative reviewed intervention JSON | | `--allow-destructive` | acknowledge reviewed destructive steps (default: false) | | `--json` | print one JSON result (default: false) | ## dryv migrate status ```text dryv migrate status [options] ``` | Option | Meaning | | --- | --- | | `--root <path>` | project root (default: the current directory) | | `--api <url>` | Engine API (default: the Engine served by the local daemon, started on demand on a free 127.0.0.1 port; see `dryv local status`) | | `--store <name>` | explicit logical store | | `--interventions <path>` | project-relative reviewed intervention JSON | | `--allow-destructive` | acknowledge reviewed destructive steps (default: false) | | `--json` | print one JSON result (default: false) | ## dryv migrate verify ```text dryv migrate verify [options] ``` | Option | Meaning | | --- | --- | | `--root <path>` | project root (default: the current directory) | | `--api <url>` | Engine API (default: the Engine served by the local daemon, started on demand on a free 127.0.0.1 port; see `dryv local status`) | | `--store <name>` | explicit logical store | | `--interventions <path>` | project-relative reviewed intervention JSON | | `--allow-destructive` | acknowledge reviewed destructive steps (default: false) | | `--json` | print one JSON result (default: false) | ## dryv migrate adopt ```text dryv migrate adopt [options] ``` | Option | Meaning | | --- | --- | | `--root <path>` | project root (default: the current directory) | | `--api <url>` | Engine API (default: the Engine served by the local daemon, started on demand on a free 127.0.0.1 port; see `dryv local status`) | | `--store <name>` | explicit logical store | | `--interventions <path>` | project-relative reviewed intervention JSON | | `--allow-destructive` | acknowledge reviewed destructive steps (default: false) | | `--json` | print one JSON result (default: false) | ## dryv checkpoint Explicitly approve or inspect durable generation baselines. ```text dryv checkpoint [options] [command] ``` | Subcommand | What it does | | --- | --- | | `approve [options]` | See below. | | `status [options]` | See below. | ## dryv checkpoint approve ```text dryv checkpoint approve [options] ``` | Option | Meaning | | --- | --- | | `--root <path>` | project root (default: the current directory) | | `--app <name>` | application activation to approve (default: []) | | `--store <name>` | store to approve (default: []) | | `--json` | print one JSON result (default: false) | ## dryv checkpoint status ```text dryv checkpoint status [options] ``` | Option | Meaning | | --- | --- | | `--root <path>` | project root (default: the current directory) | | `--app <name>` | application activation to approve (default: []) | | `--store <name>` | store to approve (default: []) | | `--json` | print one JSON result (default: false) | ## dryv validate Prepare and validate the current Dryv project. ```text dryv validate [options] ``` | Option | Meaning | | --- | --- | | `--app <name>` | select application activation; repeatable (default: []) | | `--pack <name>` | select pack activation; repeatable (default: []) | | `--store <name>` | select logical store; repeatable (default: []) | | `--with-dependencies` | include provider app outputs (default: false) | | `--api <url>` | Dryv API base URL (default: the Engine served by the local daemon, started on demand on a free 127.0.0.1 port; see `dryv local status`) | | `--root <path>` | project root (default: the current directory) | | `--json` | print one JSON result document to stdout (default: false) | | `--max-file-size-mb <number>` | maximum uploaded text file size in MiB (default: 5) | | `--exclude <pattern>` | additional .gitignore-style upload exclusion; repeatable (default: []) | | `-y, --yes` | approve requested environment changes without prompting (default: false) | | `--conflicts <resolution>` | resolve managed-file drift conflicts: block, overwrite or keep | | `--no-input` | do not prompt; fail clearly when input is required | ## dryv plan Prepare and show planned artifacts without writing files. ```text dryv plan [options] ``` | Option | Meaning | | --- | --- | | `--app <name>` | select application activation; repeatable (default: []) | | `--pack <name>` | select pack activation; repeatable (default: []) | | `--store <name>` | select logical store; repeatable (default: []) | | `--with-dependencies` | include provider app outputs (default: false) | | `--api <url>` | Dryv API base URL (default: the Engine served by the local daemon, started on demand on a free 127.0.0.1 port; see `dryv local status`) | | `--root <path>` | project root (default: the current directory) | | `--json` | print one JSON result document to stdout (default: false) | | `--max-file-size-mb <number>` | maximum uploaded text file size in MiB (default: 5) | | `--exclude <pattern>` | additional .gitignore-style upload exclusion; repeatable (default: []) | | `-y, --yes` | approve requested environment changes without prompting (default: false) | | `--conflicts <resolution>` | resolve managed-file drift conflicts: block, overwrite or keep | | `--no-input` | do not prompt; fail clearly when input is required | ## dryv apply Apply a previously saved rendered generation plan without re-rendering. ```text dryv apply [options] <plan-id> ``` | Option | Meaning | | --- | --- | | `--app <name>` | select application activation; repeatable (default: []) | | `--pack <name>` | select pack activation; repeatable (default: []) | | `--store <name>` | select logical store; repeatable (default: []) | | `--with-dependencies` | include provider app outputs (default: false) | | `--api <url>` | Dryv API base URL (default: the Engine served by the local daemon, started on demand on a free 127.0.0.1 port; see `dryv local status`) | | `--root <path>` | project root (default: the current directory) | | `--json` | print one JSON result document to stdout (default: false) | | `--max-file-size-mb <number>` | maximum uploaded text file size in MiB (default: 5) | | `--exclude <pattern>` | additional .gitignore-style upload exclusion; repeatable (default: []) | | `-y, --yes` | approve requested environment changes without prompting (default: false) | | `--conflicts <resolution>` | resolve managed-file drift conflicts: block, overwrite or keep | | `--no-input` | do not prompt; fail clearly when input is required | ## dryv undo Undo the most recent generated file apply when its journal is still valid. ```text dryv undo [options] ``` | Option | Meaning | | --- | --- | | `--root <path>` | project root (default: the current directory) | | `--json` | print one JSON result document to stdout (default: false) | | `--no-input` | accepted for automation parity; undo never prompts | ## dryv status Show generated output drift and freshness. ```text dryv status [options] ``` | Option | Meaning | | --- | --- | | `--app <name>` | select application activation; repeatable (default: []) | | `--pack <name>` | select pack activation; repeatable (default: []) | | `--store <name>` | select logical store; repeatable (default: []) | | `--with-dependencies` | include provider app outputs (default: false) | | `--api <url>` | Dryv API base URL (default: the Engine served by the local daemon, started on demand on a free 127.0.0.1 port; see `dryv local status`) | | `--root <path>` | project root (default: the current directory) | | `--json` | print one JSON result document to stdout (default: false) | | `--max-file-size-mb <number>` | maximum uploaded text file size in MiB (default: 5) | | `--exclude <pattern>` | additional .gitignore-style upload exclusion; repeatable (default: []) | | `-y, --yes` | approve requested environment changes without prompting (default: false) | | `--conflicts <resolution>` | resolve managed-file drift conflicts: block, overwrite or keep | | `--no-input` | do not prompt; fail clearly when input is required | ## dryv why Explain one generated path from persisted evidence. ```text dryv why [options] <path> ``` | Option | Meaning | | --- | --- | | `--app <name>` | select application activation; repeatable (default: []) | | `--pack <name>` | select pack activation; repeatable (default: []) | | `--store <name>` | select logical store; repeatable (default: []) | | `--with-dependencies` | include provider app outputs (default: false) | | `--api <url>` | Dryv API base URL (default: the Engine served by the local daemon, started on demand on a free 127.0.0.1 port; see `dryv local status`) | | `--root <path>` | project root (default: the current directory) | | `--json` | print one JSON result document to stdout (default: false) | | `--max-file-size-mb <number>` | maximum uploaded text file size in MiB (default: 5) | | `--exclude <pattern>` | additional .gitignore-style upload exclusion; repeatable (default: []) | | `-y, --yes` | approve requested environment changes without prompting (default: false) | | `--conflicts <resolution>` | resolve managed-file drift conflicts: block, overwrite or keep | | `--no-input` | do not prompt; fail clearly when input is required | ## dryv explain Explain generation evidence. ```text dryv explain [options] [command] ``` | Subcommand | What it does | | --- | --- | | `change [options] [run-id]` | explain current or historical generated changes | ## dryv explain change Explain current or historical generated changes. ```text dryv explain change [options] [run-id] ``` | Option | Meaning | | --- | --- | | `--baseline <name>` | compare with an explicitly approved checkpoint (choices: "approved") | | `--check` | exit 2 when approved changes are detected (default: false) | | `--diff <mode>` | diff output mode (default: "stat") | | `--app <name>` | select application activation; repeatable (default: []) | | `--pack <name>` | select pack activation; repeatable (default: []) | | `--store <name>` | select logical store; repeatable (default: []) | | `--with-dependencies` | include provider app outputs (default: false) | | `--api <url>` | Dryv API base URL (default: the Engine served by the local daemon, started on demand on a free 127.0.0.1 port; see `dryv local status`) | | `--root <path>` | project root (default: the current directory) | | `--json` | print one JSON result document to stdout (default: false) | | `--max-file-size-mb <number>` | maximum uploaded text file size in MiB (default: 5) | | `--exclude <pattern>` | additional .gitignore-style upload exclusion; repeatable (default: []) | | `-y, --yes` | approve requested environment changes without prompting (default: false) | | `--conflicts <resolution>` | resolve managed-file drift conflicts: block, overwrite or keep | | `--no-input` | do not prompt; fail clearly when input is required | ## dryv generate Prepare, generate, preview diffs, and optionally apply output. ```text dryv generate [options] ``` | Option | Meaning | | --- | --- | | `--app <name>` | select application activation; repeatable (default: []) | | `--pack <name>` | select pack activation; repeatable (default: []) | | `--store <name>` | select logical store; repeatable (default: []) | | `--with-dependencies` | include provider app outputs (default: false) | | `--api <url>` | Dryv API base URL (default: the Engine served by the local daemon, started on demand on a free 127.0.0.1 port; see `dryv local status`) | | `--root <path>` | project root (default: the current directory) | | `--json` | print one JSON result document to stdout (default: false) | | `--max-file-size-mb <number>` | maximum uploaded text file size in MiB (default: 5) | | `--exclude <pattern>` | additional .gitignore-style upload exclusion; repeatable (default: []) | | `-y, --yes` | approve requested environment changes without prompting (default: false) | | `--conflicts <resolution>` | resolve managed-file drift conflicts: block, overwrite or keep | | `--no-input` | do not prompt; fail clearly when input is required | | `-n, --dry-run` | show generated diffs but never write files (default: false) | | `--check` | do not write; exit with status 2 when generated output differs (default: false) | | `--no-actions` | skip resolved file and final actions | | `--diff <mode>` | diff output mode: stat, names, or full (default: "stat") | | `-q, --quiet` | only print errors and final result (default: false) | | `-v, --verbose` | show additional generation details (default: false) | | `--no-color` | disable ANSI color | ## dryv ir Build and inspect portable canonical Runtime IR. ```text dryv ir [options] [command] ``` | Subcommand | What it does | | --- | --- | | `build [options]` | compile authored source and write canonical Runtime IR files | ## dryv ir build Compile authored source and write canonical Runtime IR files. ```text dryv ir build [options] ``` | Option | Meaning | | --- | --- | | `--api <url>` | Dryv API base URL (default: the Engine served by the local daemon, started on demand on a free 127.0.0.1 port; see `dryv local status`) | | `--root <path>` | project root (default: the current directory) | | `--yes` | approve requested environment changes without prompting (default: false) | | `--format <format>` | Runtime IR representation (choices: "yaml", "json", "jsonl", default: "yaml") | | `--all` | write YAML, JSON, and JSONL representations (default: false) | | `--out <path>` | project-relative output directory (defaults to workspace.path/ir) | ## dryv login Sign in to Dryv Platform through browser device authorization. ```text dryv login [options] ``` | Option | Meaning | | --- | --- | | `--platform <url>` | Dryv Platform API URL (default: "https://api.dryvcode.com") | | `--json` | print one JSON result document (default: false) | | `--events` | emit public device instructions as JSON on stderr (default: false) | | `--no-input` | fail instead of waiting for browser approval | ## dryv logout Revoke and remove the stored Dryv Platform session. ```text dryv logout [options] ``` | Option | Meaning | | --- | --- | | `--platform <url>` | Dryv Platform API URL (default: "https://api.dryvcode.com") | | `--json` | print one JSON result document (default: false) | ## dryv whoami Show the active Dryv Platform identity. ```text dryv whoami [options] ``` | Option | Meaning | | --- | --- | | `--platform <url>` | Dryv Platform API URL (default: "https://api.dryvcode.com") | | `--json` | print one JSON result document (default: false) | --- <!-- Source: https://docs.dryvcode.com/docs/platform --> # About the Platform Dryv has two parts: open source tools you run yourself, and the hosted Dryv Platform. You can generate code with the open source tools alone. The Platform adds syncing, publishing and a hosted Playground. ## Open source The Dryv Engine, the authoring SDKs and the compilers are open source under the Apache License 2.0. The code is at [github.com/dryvcode/dryv](https://github.com/dryvcode/dryv). To contribute, read `CONTRIBUTING.md` in that repository, then open a pull request into the `develop` branch. Report bugs and ask questions in [GitHub issues](https://github.com/dryvcode/dryv/issues). ## Work locally, without an account The `dryv` CLI and the VS Code extension work on your own machine with a local Engine, run by the [local daemon](/docs/guides/local-daemon). They need no login and no Dryv key. This covers validating, planning and generating code, installing public packs, [tasks](/docs/guides/tasks), and the [Dryv agent](/docs/guides/agent), which uses your own model provider key. A desktop app is in development and not available to download yet. | Where you work | Engine | Sign-in needed | | ----------------------- | ------------------------------ | -------------- | | CLI, VS Code | Local, on your machine | No | | Your own server | Self-hosted Engine you run | No | | Playground | Inside your Playground workspace | Yes | There is no public hosted Engine. The Engine runs on your machine, or inside your Playground workspace where only the Platform API and the Playground can reach it. ## What the Platform adds The Platform is the hosted part of Dryv. You sign in to use it. - **The web app.** Work at [app.dryvcode.com](https://app.dryvcode.com). See [The web app](/docs/platform/web-app). - **Task sync.** A project's tasks sync between your computers and the web app. See [Sign in and sync](/docs/guides/sync). - **Publishing and private packs.** Publish packs to the [pack registry](/packs) under your namespace, and use private packs shared with you or your organization. See [Publish packs](/docs/guides/publishing). - **Playground.** Run a project in a hosted workspace with its own Engine, then preview or download the output. See [Playground](/docs/guides/playground). - **MCP.** Connect an AI assistant to your Playground projects. See [Connect an MCP client](/docs/guides/mcp). - **Organizations.** Share projects and packs with a team. See [Organizations](/docs/platform/organizations). - **Your data.** Download or export your data at any time. See [Account and security](/docs/platform/account-and-security). The mobile app is coming soon. ## When you need to sign in Sign in only to sync data through the Platform API (the web and mobile apps), sync tasks, publish packs, use private packs, use the Playground, connect MCP clients, and download or export your data. Everything else works without a login or any key. To sign in from the CLI, see [Sign in and sync](/docs/guides/sync#sign-in-from-the-cli). --- <!-- Source: https://docs.dryvcode.com/docs/platform/web-app --> # The web app The Dryv web app is at [app.dryvcode.com](https://app.dryvcode.com). You sign in to use it. See [About the Platform](/docs/platform) for what needs an account and what does not. | Area | What you do there | Guide | | --- | --- | --- | | Playground | Create, generate, run and preview projects in a hosted workspace. | [Playground](/docs/guides/playground) | | Tasks | Read the task workspaces you synced from your projects. | [Sign in and sync](/docs/guides/sync#see-your-tasks-on-the-web) | | Packs | Browse the registry and release your own packs. | [Publish packs](/docs/guides/publishing) | | Organizations | Create teams, invite people and set roles. | [Organizations](/docs/platform/organizations) | | Settings | Sign-in methods, passkeys, two-factor authentication, AI provider keys, connected apps, usage, notifications, data export. | [Account and security](/docs/platform/account-and-security) | The web app also approves sign-ins from the CLI and VS Code (the device code page) and from [MCP clients](/docs/guides/mcp) (the consent page). ## Mobile app The mobile app is coming soon. ## Desktop app The desktop app is not available to download yet. Use the [CLI](/docs/guides/agent) or [VS Code](/docs/guides/vscode) on your computer. --- <!-- Source: https://docs.dryvcode.com/docs/platform/account-and-security --> # Account and security Your Dryv account is only needed for Platform features: sync, publishing, private packs, the Playground, MCP and data export. Everything you run locally works without one. Account settings are at [app.dryvcode.com/settings](https://app.dryvcode.com/settings). ## Create an account and sign in Create an account at [app.dryvcode.com/sign-up](https://app.dryvcode.com/sign-up). You can sign up and sign in with: - email and password (at least 12 characters); - Google or GitHub, where they are turned on. Confirm your email address from the message Dryv sends. Some features, such as MCP consent and snapshot restores, need a verified email. If you forget your password, choose **Forgot password?** on the sign-in page. ## Password and authentication Open **Settings → Password and authentication**. From there you can: - **Change your password.** Other sessions are signed out. - **Connect accounts.** Link Google or GitHub, or add email and password as another way in. - **Add passkeys.** Your browser and device confirm before a passkey is added. Name each passkey so you can tell them apart. Passkeys need a browser with passkey support over HTTPS. - **Turn on two-factor authentication.** Scan the QR code with an authenticator app, or enter the setup key, then confirm with a six-digit code. Save the recovery codes shown. You can replace or turn off the authenticator later. - **Change your email address.** Confirm it from the link sent to the new address. - **Review active sessions** and sign out the ones you do not recognise. - **Review recent security activity.** Some changes ask you to confirm your identity first. The confirmation lasts one hour. ## CLI and editor sign-in `dryv login` and **Dryv: Sign In** in VS Code show a code. Approve it in the browser while signed in. See [Sign in and sync](/docs/guides/sync). ## Connected apps **Settings → Connected apps** lists the AI agents and editors you connected to the Dryv [MCP server](/docs/guides/mcp). Disconnect one to revoke its access at once. ## AI provider keys **Settings → AI provider keys** stores your own model provider keys for AI features you start on the Platform. Enter a provider slug, a label and the key. Keys are encrypted, never shown again and never returned by the API. They are used only on the server. These keys are separate from the local [Dryv agent](/docs/guides/agent), which reads keys on your own machine. ## Usage and quotas **Settings → Usage and quotas** shows your usage in the current window: hosted runs, generated output, pack releases and their size, pack file reads, archive downloads, and recent MCP activity. ## Email notifications **Settings → Email notifications** chooses which product emails you get: successful and failed hosted runs, pack publication confirmations, and usage and quota warnings. Security and account emails are always sent. ## Download your data Open **Settings → Export your data** (on the **Account** page) and choose **Download my account data**. You get a JSON file with your profile, sign-in methods, organizations, the projects you created, your AI provider key labels and your usage history. It never includes passwords, tokens, keys or project files. To download project files, use the ZIP downloads in the [Playground](/docs/guides/playground#download-your-work). ## Delete your account Open **Settings → Account** and choose **Delete account**. If two-factor authentication is on, enter an authenticator code or a recovery code. Deleting your account also ends every connected app's access. --- <!-- Source: https://docs.dryvcode.com/docs/platform/organizations --> # Organizations An organization is a shared space for a team. Projects, Playground workspaces, synced task workspaces and pack namespaces can belong to an organization instead of one person. Working alone in a one-person organization is fine. ## Create an organization 1. Sign in at [app.dryvcode.com](https://app.dryvcode.com). 2. Open **Organizations** and choose **Create an organization**, or open `/organizations/new`. 3. Enter a name. You become its owner. ## Invite people 1. Open the organization. 2. Choose **Invite by verified email** and enter the address. 3. Pick a role. Invitations expire after 7 days. Inviting the same address again replaces the pending link. You can revoke a pending invitation, change a member's role, or remove a member. ## Roles | Role | Read the organization and its projects | Change projects | Manage members | Billing and deleting the organization | | --- | --- | --- | --- | --- | | Owner | Yes | Yes | Yes | Yes | | Admin | Yes | Yes | Yes | No | | Member | Yes | Yes | No | No | | Viewer | Yes | No | No | No | ## Transfer ownership Open **Settings → Organizations**. Under **Organization ownership**, choose the organization to transfer and who should receive it. You must own the organization. The receiver accepts it under **Incoming**. Pack namespaces are transferred the same way, from **Settings → Pack namespaces**. See [Publish packs](/docs/guides/publishing). --- <!-- Source: https://docs.dryvcode.com/docs/ecosystem/extensibility --> # Extend Dryv without changing its meaning Dryv is designed so new authoring languages, renderer implementations, packs, clients, and engine implementations can be added without creating parallel semantic systems. Extensibility is valid only when the same canonical contracts remain intact. ## Authoring languages Current authoring implementations are: - Python; - TypeScript. A future Rust, JavaScript, or other authoring implementation must compile into the same Canonical Dryv Runtime IR. It can provide language-native ergonomics without creating private semantics. ## Template renderers Current renderer implementations are: - Jinja; - Handlebars; - Liquid; - Mustache. A new renderer must consume the same bounded context contract and remain semantically narrow. Renderer-specific syntax belongs inside the renderer or template, not in canonical Runtime IR. ## Output languages are pack-defined Dryv does not need a hard-coded registry of every language that can be generated. A pack decides what its templates emit. That may be TypeScript, Python, Rust, Java, Dart, YAML, Markdown, Terraform, or another target representation. This is why renderer support and output-language support are different ideas. ## Engine implementations The current backbone implementation is organized under `engine/python/` with separate engine and API packages. A future engine implementation in another language must preserve the same Canonical Runtime IR, validation semantics, planning contracts, protocols, and observable behavior. There is still one Dryv semantic model. ## Clients Clients can include: - the CLI; - editor integrations such as VS Code; - web interfaces; - future desktop or mobile surfaces; - automated agents. Clients can discover project resources, display diagnostics and plans, receive artifacts, show diffs, and apply changes. Clients do not own semantic selection or Runtime IR meaning. ## Pack sources Packs can be loaded through supported local or repository-based sources. Private repository access should rely on the user's existing Git credentials rather than a separate Dryv credential system. ## Humans and AI use the same system Dryv should not create a hidden AI-only execution path. Humans and agents use the same authored meaning, Runtime IR, usage configuration, generation plans, diagnostics, template context, and traces. That shared contract makes automation more reliable without making an AI model the semantic authority. ## Extension rule Every extension should preserve these equations: ```text new authoring implementation → same Runtime IR new renderer → same context contract new client → same plans and artifacts new pack → same canonical vocabulary new engine implementation → same semantics and protocols ``` If an extension weakens determinism, portability, explainability, or architectural separation, it is not a compatible Dryv extension. --- <!-- Source: https://docs.dryvcode.com/docs/reference/vocabulary --> # Dryv's canonical vocabulary Dryv uses language-neutral concepts and explicit typed relationships so the same meaning can be authored, inspected, selected by packs, and traced into generated output. The vocabulary belongs to canonical meaning, not to a particular framework. ## Schema A Schema describes reusable typed structure. Schemas can be used across operation inputs and outputs, event payloads, workflow data, nested fields, views, and other typed interactions. Generated roles such as DTO or database entity normally represent a Schema rather than replace it. ## Operation An Operation describes what happens. It can have typed inputs and outputs and participate in explicit relationships with policies, failures, events, workflows, or other canonical concepts. Transport details should be modeled through explicit canonical facets where appropriate rather than by inventing separate REST-operation or queue-operation semantic roots. ## Event An Event describes a business occurrence and can carry a typed payload. Operations can emit events and workflows can react to or wait for events. ## Policy A Policy is a reusable rule referenced by other canonical concepts. It represents durable software meaning rather than target-framework guard or middleware syntax. ## Failure A Failure gives explicit identity to canonical failure meaning. Operations can declare failures they may produce so packs can represent those failures in target-specific ways. ## Workflow A Workflow describes semantic orchestration using existing operations, events, transitions, conditions, and related meaning. Generated job runners, state machines, queue consumers, or handlers are representations of that orchestration. ## View A View is a neutral interaction unit that can reference schemas, operations, sources, policies, and other presentation-relevant meaning. Generated page, screen, component, or template roles normally belong to packs. ## Storage mapping A StorageMapping describes explicit persistence representation for canonical structure. Storage is kept distinct because persistence concerns should not silently become properties of every Schema. ## Source A Source describes where reusable software values are obtained. Sources may connect interaction concepts to operation results or other language-neutral value providers without encoding one UI framework's data-fetch API into canonical meaning. ## Directional relationships Relationships are authored once in a clear direction. Examples: ```text Schema extends Schema StorageMapping maps Schema Operation uses Policy Operation may fail with Failure Operation emits Event Workflow waits for Event View triggers Operation ``` Runtime can derive reverse indexes when needed for inspection or template context. ## Generated roles are representations These are usually pack-level roles rather than canonical roots: - DTO; - entity; - controller; - service; - repository; - handler; - page; - screen; - component. They should become canonical concepts only if they acquire stable, language-neutral meaning independent of one generated target. ## The concept test Before adding new canonical meaning, ask: 1. Does it have independent language-neutral meaning? 2. Can it be expressed by composing existing canonical concepts? 3. Do multiple canonical concepts need to reference it? 4. Does it require independent identity, documentation, and provenance? 5. Is it useful to inspect and select independently across target languages? If the answer points mainly to one renderer, framework, or generated role, the idea probably belongs outside Runtime IR. --- <!-- Source: https://docs.dryvcode.com/docs/reference/template-context --> # Template context A pack template reads **context**: named facts about the subject it renders (a schema, an operation, a feature), plus metadata such as the file being written and the pack's inputs. Every path is lower `snake_case`, for example `schema.fields[].name.camel`. ## Only what a template asks for Before rendering, the template server analyses the template and reports the exact paths it reads. The engine checks them against the context vocabulary and projects only those paths. A large vocabulary therefore never means a large object per file, and a typo in a path fails before anything renders. ## Raw and derived context Raw context mirrors the canonical meaning: values, constraints, relations, HTTP bindings. Derived context saves templates from rebuilding common facts: | Need | Read | Instead of | | --------------------------- | ------------------------------------------------------- | ------------------------------------------------ | | What kind of value is this? | `field.value.is.uuid`, `field.value.is.schema` | comparing `kind`, `type` and `format` strings | | Is a bound declared? | `length.has_min`, `range.has_max` | `min is not none` (and truthiness bugs with `0`) | | A safe literal | `field.default.value_json`, `pattern.match_json[]` | encoding values in the template | | One kind of HTTP binding | `facets.http.input_groups.body[]` | filtering `inputs` | | Path pieces | `facets.http.path.segments[]` (`literal` / `parameter`) | parsing `/users/{id}` | | The DTO for this value | `field.value.generated.schema_validation.symbol` | searching `file.dependencies` | Derived facts never name a framework: turning `is.uuid` into `z.string().uuid()` or `@IsUUID()` stays in your pack, where you can see and change it. ## Renderers Jinja, Handlebars and Liquid read the same paths. Jinja suits packs with macros and local logic; Handlebars suits templates that mostly look like their output, since derived context removes most of the branching. Mustache renders, but can't be analysed, so it isn't used for planned generation. ## Discover the vocabulary ```bash dryv context list dryv context show "schema.fields[].value.is.boolean" dryv context show "schema.fields[].value.generated.schema_validation" --json ``` `show` prints where a path starts, whether it is one value, optional or a list, and where it comes from (canonical meaning, a derived fact, or the generation plan). An invalid path explains why. --- <!-- Source: https://docs.dryvcode.com/docs/reference/changelog --> # Release notes ## Unreleased These changes are in the source but not yet in a numbered release. ### Engine needs no keys - The Engine no longer authenticates requests. There are no Engine API keys or tokens, no `DRYV_API_KEY`, no `dryv engine login` or `logout`, and no Engine entry in the OS credential store. - The Engine runs in one of two places: on your own machine, where the CLI, the VS Code extension or the desktop app starts or connects to it, or inside your Playground workspace, where only the signed-in Platform API and the Playground can reach it. There is no public hosted Engine. - The Engine needs no database. It keeps sessions and builds in memory, and it limits concurrent generations for the whole process instead of per key. - The Engine no longer serves the pack registry or the knowledge base. Pack metadata, vocabulary and docs are public reads from the Platform API at `https://api.dryvcode.com`, and you can browse packs at [packs.dryvcode.com](https://packs.dryvcode.com). ### Sign-in is for Platform features only - `dryv login`, `dryv logout` and `dryv whoami` sign in to the Dryv Platform. You need this only to sync data through the Platform API (the web app at [app.dryvcode.com](https://app.dryvcode.com) and the mobile app), sync tasks, publish packs, use private packs, use the Playground, and download or export your data. - Validating, planning and generating with a local Engine works without signing in. ### Repository split and domains - The open source part of Dryv is at [github.com/dryvcode/dryv](https://github.com/dryvcode/dryv) under the Apache License 2.0. It holds the Engine and its API, the authoring SDKs and compilers, the template servers, the schemas and the examples. Packs are at [github.com/dryvcode/packs](https://github.com/dryvcode/packs). - The `dryv` CLI, the VS Code extension, this website and the Platform services are distributed by the Dryv Platform. They are not in the open source repository. - Dryv lives at `dryvcode.com`: the website at [dryvcode.com](https://dryvcode.com), docs at [docs.dryvcode.com](https://docs.dryvcode.com), packs at [packs.dryvcode.com](https://packs.dryvcode.com), the web app at [app.dryvcode.com](https://app.dryvcode.com) and the Platform API at `https://api.dryvcode.com`. ### CLI - The CLI starts or connects to a local Engine through a local daemon (`dryv local connect|status|restart|stop|logs`). `--api` or `DRYV_API_URL` points it at another Engine. Without the daemon, the default is `http://127.0.0.1:8750`. - New commands: `dryv update` installs and verifies the latest release, `dryv task` manages project tasks, `dryv code` opens the coding agent, and `dryv migrate` plans, renders and applies reviewed PostgreSQL schema changes for your generated application. - `dryv.yaml` can declare an optional `tasks:` block, and `dryv.task.yaml` holds the task registry. ## 0.1.0 The first public release of Dryvcode. ### Author and compile - **TypeScript author** (`@dryvcode/author`) and **Python author** (`dryv-author`): describe schemas, operations, events, failures, policies, workflows, views and themes once. Both compile to the same canonical Runtime IR. - **Compilers** (`@dryvcode/compiler` as `dryv-ts`, `dryv-compiler` as `dryv-py`) with a stable protocol and author compatibility ranges (`>=0.1.0,<0.2`). - Operation **query scope**: bind a persisted field to a trusted policy value. - The authors and compilers are published at 0.1.0 on npm and PyPI. ### CLI - `dryv init` writes `dryv.yaml` plus `dryv/README.md` and an `AGENTS.md` block for agents. `dryv docs [topic]` prints built-in guides (workflow, dryv-yaml, pack-yaml, authoring, errors, agents). - `validate`, `plan`, `generate` (`--dry-run`, `--check`), `apply`, `undo`, `status`, `why`, `explain change`, with managed-file drift detection and explicit conflict resolution. - `dryv pack search / list / info / describe / explain / add / remove / update`. - `dryv context list|show` discovers the template context vocabulary, and `dryv pack|author|template-server init/inspect/validate/doctor/test` build plugins. - `--json --no-input` on every command, stable result codes, workspace trust, `dryv clean`, `dryv doctor`, `dryv ui`. - The 0.1.0 CLI release is a Linux x64 build installed with `install.sh`. ### Engine and API - Deterministic planning and rendering through Jinja, Handlebars, Liquid and Mustache template servers. - `/health` endpoint, `traceparent` and `X-Request-Id` on every response. ### Packs - 100+ packs (NestJS, TypeORM, Mongoose, Zod, Joi, class-validator, FastAPI, Next.js, Flutter, Dart and many more), each with a README and a browsable file tree. Git holds the history, and `dryv pack add` pins the published commit. ### Website - **Docs**, **Authoring** (vocabulary and cookbook) and **Pack builders** (the full template-context reference) as separate sections, and a pack catalogue with search, filters and a file explorer. ### VS Code extension (`dryv-vscode`) - Plans, diagnostics, generation and trace views using the same Engine as the CLI. --- <!-- Source: https://docs.dryvcode.com/docs/ai/agents --> # Use Dryv with AI agents Dryv and AI agents fit together well. An agent is good at reading intent and editing contracts; Dryv is deterministic code generation, so the same contracts and packs always produce the same files. The agent changes the meaning, Dryv renders the code, and every generated file can be explained with `dryv why`. This page shows how to give an agent what it needs. The short version: 1. Install the [Dryv agent skill](agent-skill.md) so the agent knows the loop and the rules. 2. Keep the Dryv block in your project's `AGENTS.md` (`dryv init` writes it). 3. Point the agent at the docs as Markdown: [llms.txt](#docs-for-language-models). ## What an agent should do An agent working in a Dryv project follows the same loop as a person, without prompts: ```bash dryv validate --json --no-input dryv plan --json --no-input dryv generate --dry-run --json --no-input dryv generate --yes --json --no-input ``` - **Branch on JSON.** With `--json` every command prints one result document. On failure, read its `code` (for example `DRYV_MANAGED_CONFLICT`) and look it up with `dryv docs errors`. - **Preview first.** `generate --dry-run` (or `-n`) shows the diff and writes nothing. - **Never hand-edit managed files.** Change the contracts in `dryv/contracts`, `dryv.yaml` or the pack, then regenerate. `dryv why <path>` explains where a file came from. - **Ask before deciding.** Names, structure and behaviour belong to the user. An agent should ask instead of inventing an entity, a route or a pack choice. - **Find packs, don't guess.** `dryv pack search <query>` and `dryv pack info <id>` read the catalogue; `dryv pack add <id> --dry-run` previews the `dryv.yaml` edit. [Agents and CI](../usage/agents-and-ci.md) covers the same rules for scripts and CI. ## Project instructions `dryv init` writes `dryv/README.md` and a Dryv block in the project's `AGENTS.md`. Refresh both with `dryv docs --write`. If you keep your own `AGENTS.md` or `CLAUDE.md`, this block is enough: ```markdown ## Dryv This project generates code with [Dryv](https://dryvcode.com). Read `dryv/README.md` first, or run `dryv docs`. - Meaning lives in `dryv/contracts`; configuration in `dryv.yaml`. Do not hand-edit managed generated files. - Loop: `dryv validate` -> `dryv plan` -> `dryv generate --dry-run` -> `dryv generate`. - Use `--json --no-input` in scripts. On failure read the `code` and run `dryv docs errors`. - Ask the user before choosing names, structure or behaviour. ``` ## Docs for language models The documentation is published for agents as well as people: - [llms.txt](https://docs.dryvcode.com/llms.txt) lists every docs page with a link to its Markdown. - [llms-full.txt](https://docs.dryvcode.com/llms-full.txt) is the whole documentation in one file. - Every page is plain Markdown at its URL plus `.md`, for example `https://docs.dryvcode.com/docs/getting-started.md`. Section homes are `/docs/index.md`. - The pack registry has its own index at [packs.dryvcode.com/llms.txt](https://packs.dryvcode.com/llms.txt). Offline, the CLI carries the essentials: `dryv docs` lists the built-in guides and `dryv docs agents` prints the agent rules. ## MCP Dryv Platform serves an MCP endpoint at `https://api.dryvcode.com/mcp` (Streamable HTTP). It needs a Dryv account: the client signs in through the browser with OAuth the first time. For example, in Claude Code: ```bash claude mcp add --transport http dryv https://api.dryvcode.com/mcp ``` You don't need MCP to generate code. The CLI, the engine and the agent skill work locally without an account; MCP adds access to your Platform workspace from the agent. ## Next - [Install the Dryv agent skill](agent-skill.md) - [CLI reference](../usage/cli.md) - [Find packs](https://packs.dryvcode.com) --- <!-- Source: https://docs.dryvcode.com/docs/ai/agent-skill --> # Dryv agent skill The Dryv agent skill is a single `SKILL.md` file. It teaches an AI agent how to use Dryv: the validate, plan, dry-run, generate loop, non-interactive `--json --no-input` runs, the `DRYV_*` error codes, finding and adding packs, and the two rules that matter most: never hand-edit managed generated files, and ask the user before choosing names. Download it from a stable URL: ```text https://docs.dryvcode.com/skills/dryv/SKILL.md ``` It follows the [Agent Skills](https://agentskills.io) format (a `name` and `description` in the frontmatter, instructions in the body), so it works with Claude Code and with other agents that read skills. ## Install in Claude Code For every project on your machine: ```bash mkdir -p ~/.claude/skills/dryv curl -fsSL https://docs.dryvcode.com/skills/dryv/SKILL.md -o ~/.claude/skills/dryv/SKILL.md ``` For one project, shared with your team through version control: ```bash mkdir -p .claude/skills/dryv curl -fsSL https://docs.dryvcode.com/skills/dryv/SKILL.md -o .claude/skills/dryv/SKILL.md ``` Claude Code loads the skill when a task matches its description: a project with a `dryv.yaml`, a request to generate code from contracts, a pack to add, or a `DRYV_*` error. You can also call it directly with `/dryv`. ## Other agents Agents that read skills from another folder take the same file; put it where that agent looks for skills. Agents without skills support read `AGENTS.md`: add the [Dryv block](agents.md#project-instructions) there instead, or as well. ## What the skill says The skill is short on purpose. It covers: - **The loop:** `dryv doctor`, `dryv validate`, `dryv plan`, `dryv generate --dry-run`, then `dryv generate --yes` once the user agrees with the preview. - **Automation:** `--json --no-input` on every command, branching on `status` and `code`. - **Errors:** what to do for each code, from `DRYV_INPUT_REQUIRED` to `DRYV_MANAGED_CONFLICT`. - **Packs:** `dryv pack search`, `info`, `describe`, `explain` and `add --dry-run`. - **Boundaries:** no edits to managed files, no `--conflicts` choice or `dryv trust` without the user, and no invented names, structure or behaviour. Read the full text at the URL above before you install it; it is plain Markdown. ## Keep it current The skill tracks the released CLI. Download it again after you update Dryv (`dryv update`). If a command in it fails with `DRYV_ARGUMENT_ERROR`, `dryv <command> --help` is the source of truth. ## Next - [Use Dryv with AI agents](agents.md) - [Agents and CI](../usage/agents-and-ci.md) --- <!-- Source: https://docs.dryvcode.com/pack-builders --> # Pack builders A **pack** is a reusable implementation. It reads the meaning a project has authored and turns it into files: controllers, entities, DTOs, SDKs, config, docs. Packs never redefine meaning; they _represent_ it. This section is for people who write packs. If you only want to use packs, read [Find and use packs](/docs/usage/packs). If you want to describe software, read [Authoring](/authoring). ```mermaid flowchart LR A["Authored meaning<br/>(Runtime IR)"] --> S["Selection<br/>which subjects?"] S --> C["Bounded context<br/>only the paths a template reads"] C --> T["Templates<br/>Jinja · Handlebars · Liquid · Mustache"] T --> F["Planned files<br/>paths, symbols, dependencies"] F --> D["Diff you approve"] ``` ## The mental model 1. **Selections** pick canonical subjects (every `schema`, every `operation` with an HTTP facet, every `property.enum`). 2. **Templates** are files on disk. Each one is bound to a selection and decides where its output goes (`output.name`, `output.path`, `output.symbol`). 3. **Context** is what a template can read. The engine never hands a template the whole model. It analyses the template, learns which context paths it reads, validates them against the vocabulary, and projects _only those paths_. 4. **Composition** lets packs `provide` and `need` capabilities (`schema.validation`, `schema.persistence`) that a project binds together. 5. **Actions** are explicit commands (format, install) the client runs after generation. The engine plans them; it never runs them. Everything is deterministic and explainable. A generated file can always be traced back to the selection, template and context that produced it. ## Where to go next | You want to | Read | | ------------------------------------------ | ----------------------------------------------------------------------------------------------------- | | Make something work in ten minutes | [Build your first pack](/pack-builders/first-pack) | | Know every key of `dryv.pack.yaml` | [Pack anatomy](/pack-builders/anatomy) | | See which values a template can read | [Context overview](/pack-builders/context/overview) and the [catalog](/pack-builders/context/catalog) | | Understand `is`, `has_*`, `*_json` helpers | [Derived values](/pack-builders/context/derived) | | Wire packs together | [Composition and bindings](/pack-builders/design/composition-and-bindings) | | Run commands after generation | [Actions and commands](/pack-builders/design/actions) | | Prove and ship a pack | [Test and publish](/pack-builders/test-and-publish) | ## Discover context from the terminal You never have to guess a path. The CLI asks the engine: ```bash dryv context list # every root and type dryv context show "schema.fields[].value.is.boolean" # what one path reads, with provenance dryv context show "schema.fields[].value.generated.schema_validation" --json ``` > [!NOTE] > `dryv context` needs a CLI that includes it (0.1.0 or newer built from this repository). If your shell says `unknown command 'context'`, you are running an older global install: see [CLI for pack builders](/pack-builders/cli). --- <!-- Source: https://docs.dryvcode.com/pack-builders/first-pack --> # Build your first pack You will create a pack that writes one TypeScript type per schema. It takes about ten minutes and uses only the CLI. ## 1. Scaffold ```bash mkdir types-pack && cd types-pack dryv pack init . --yes \ --key inject.types.simple \ --title "Simple types" \ --layout inject \ --renderer handlebars --renderer-version ">=0.1" \ --extension .hbs \ --starter-subject schema ``` This writes two things: ```yaml # dryv.pack.yaml version: dryv.pack/v1alpha1 key: inject.types.simple source: templates info: title: Simple types version: 0.0.1 layout: inject plugins: - name: handlebars version: ">=0.1" extensions: - .hbs selections: starter: subject: schema scope: each templates: starter: $ref: "#/selections/starter" output: name: $(subject.name.kebab) ``` and a template at `templates/{starter}/$(name).txt.hbs`. The folder name in braces (`{starter}`) links the file to the template entry `starter`; `$(name)` is replaced with that entry's `output.name`. ## 2. Write the template Rename the file to end in `.ts.hbs` and give it a body. The `schema` root is available because the selection's subject is `schema`. ```handlebars // templates/{starter}/$(name).ts.hbs export interface {{schema.name.pascal}} { {{#each schema.fields}} {{name.camel}}{{#if optional}}?{{/if}}: unknown; {{/each}} } ``` Use `dryv context show "schema.fields[].name"` to see exactly what a path gives you. Names expose casing variants (`camel`, `pascal`, `snake`, `kebab`) so templates never re-case strings themselves. ## 3. Name the output ```yaml templates: starter: $ref: "#/selections/starter" output: name: $(subject.name.kebab) # user-profile symbol: $(subject.name.pascal) # UserProfile ``` `symbol` lets other templates import this one without guessing names. See [Template filesystem](/pack-builders/design/template-filesystem) for every placement rule. ## 4. Inspect, validate, test ```bash dryv pack inspect . # what Dryv discovered: resources, ownership, renderer, size dryv pack validate . # manifest, filesystem and engine semantics dryv pack doctor . # is the renderer available? dryv pack test . # render against the engine's canonical sample IR in a temp workspace ``` `pack test` never touches your project. It renders into an isolated directory and reports every planned file, its template and the context paths it read. ## 5. Try it in a project Point a project's `dryv.yaml` at the local folder: ```yaml sources: packs: local: { path: ../types-pack/.. } packs: types: source: { $ref: "#/sources/packs/local", path: types-pack } destination: { $ref: "#/destinations/types" } destinations: types: { path: src/generated/types } ``` Then: ```bash dryv plan dryv generate --dry-run ``` ## Common mistakes | Symptom | Cause | Fix | | ------------------------------- | ----------------------------------------------------------------- | -------------------------------------------------------------------------------- | | `unknown context path` | A template reads a path the vocabulary does not define | `dryv context show "<path>"` and fix the spelling or the collection (`fields[]`) | | Nothing is generated | Selection matched no subjects | Check `subject`, `scope` and any `filter` | | Wrong file name | `output.name` uses a different casing variant | Use `$(subject.name.kebab)` or another variant | | File written once, then ignored | The filename has `.sf` before the renderer extension (a scaffold) | Remove `.sf` if Dryv should keep owning it | Next: [Pack anatomy](/pack-builders/anatomy). --- <!-- Source: https://docs.dryvcode.com/pack-builders/anatomy --> # Pack anatomy A pack is a folder: ```text my-pack/ ├── dryv.pack.yaml # the manifest: selections, templates, inputs, composition, actions ├── README.md # shown by `dryv pack describe` and on the website ├── CHANGELOG.md ├── templates/ # resources: templates and static files (the manifest's `source`) └── tests/ # a fixture project and a check script ``` ## A real manifest This is the TypeScript API client pack, trimmed. Read it top to bottom. ```yaml version: dryv.pack/v1alpha1 key: unit.clients.ts-api-client layout: unit # inject | unit package: # unit packs describe the package they generate name: { $ref: "#/inputs/package_name" } import_root: src source: templates # where resources live info: # catalogue metadata (what `pack search` shows) title: TypeScript API Client version: 0.1.0 purpose: clients summary: A framework-free TypeScript API client over fetch. languages: [typescript] frameworks: [fetch] tags: [client, sdk, typescript] plugins: # renderers this pack needs - name: jinja extensions: [.j2] inputs: # typed, bounded values a project may set package_name: { type: string, default: admin-console-api } selections: # WHICH subjects models: subject: schema scope: each operations: subject: operation filter: all: { facet: http } # only operations that have an HTTP facet scope: each templates: # WHAT each selection produces model: $ref: "#/selections/models" output: name: $(subject.name.kebab) symbol: $(subject.name.pascal) operation: $ref: "#/selections/operations" output: name: $(subject.name.kebab) path: [$(group.name.kebab)] symbol: $(subject.name.camel) imports: # generated-symbol dependencies between templates - $ref: "#/templates/model" provides: # capabilities other packs can bind to operation.client: { $ref: "#/templates/operation" } schema.types: { $ref: "#/templates/model" } actions: final: install: commands: - run: [(pnpm|npm|bun|yarn), install] ``` ## Section by section | Key | Purpose | Details | | -------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- | | `version`, `key` | Contract version and the pack's stable identity (`<layout>.<purpose>.<name>`) | [Core model](/pack-builders/design/core-model) | | `layout` | `inject` adds files to an existing destination; `unit` generates a self-contained package or application | [Layouts and units](/pack-builders/design/layouts-and-units) | | `source` | Folder holding templates and static resources | [Template filesystem](/pack-builders/design/template-filesystem) | | `info` | Human and catalogue metadata. `purpose`, `summary` and `languages` are required to publish | [Test and publish](/pack-builders/test-and-publish) | | `plugins` | Renderer name, version constraint and owned file extensions | [Template servers](/pack-builders/context/template-servers) | | `inputs` | Typed values a project can set; exposed to templates as the `pack` context | [`pack` context](/pack-builders/context/pack) | | `selections` | `subject`, `scope` (`each` or `all`), optional `filter` | [Context overview](/pack-builders/context/overview) | | `templates` | Bind templates to selections; name outputs, declare symbols, imports and exports | [Artifact graph](/pack-builders/context/artifact-graph) | | `provides` / `needs` | Capability slots between packs | [Composition and bindings](/pack-builders/design/composition-and-bindings) | | `choose` | Options a project must pick (for example the JS package manager) | [Project configuration](/pack-builders/design/project-configuration) | | `actions` | File and final commands for the client to run | [Actions and commands](/pack-builders/design/actions) | ## Subjects you can select `schema`, `operation`, `event`, `failure`, `policy`, `expression`, `workflow`, `view`, `view.part`, `surface`, and the property kinds `property.primitive`, `property.enum`, `property.composite`, `property.literal`, `property.union`, `property.record`, `property.tuple`, `property.generic`, `property.temporal`. Each has a context page under **Context: subjects** in the sidebar. ## Scope: `each` versus `all` | Scope | You get | Use it for | | ------ | ------------------------------------------------------- | -------------------------------------------------- | | `each` | One render per subject, with a singular root (`schema`) | One file per schema | | `all` | One render with a plural root (`schemas[]`) | An index, a module, a router that lists everything | Collection scopes such as `group` and `feature` add `group` or `feature` roots when ownership is provable. ## Ownership: managed or scaffold A resource whose name has `.sf` immediately before the renderer extension (`main.ts.sf.hbs`) is a **scaffold**: Dryv creates it once and never overwrites your later edits. Everything else is **managed**: Dryv rewrites it, and reports a conflict if you changed it by hand. See [Starters, recipes and ownership](/pack-builders/design/ownership). --- <!-- Source: https://docs.dryvcode.com/pack-builders/test-and-publish --> # Test and publish ## The proof ladder | Level | Command | Proves | | ------------ | ----------------------------------- | ------------------------------------------------------------------------ | | Manifest | `dryv pack validate .` | The manifest, filesystem and engine semantics agree | | Resources | `dryv pack inspect .` | Which resources exist, who owns them, which renderer handles them | | Renderer | `dryv pack doctor .` | The renderer and any action runtime are ready | | Render | `dryv pack test .` | The pack renders against the engine's sample IR in an isolated directory | | Real project | `tests/check.sh` + `tests/fixture/` | The generated code compiles and passes its own tests | Project-controlled actions need workspace trust. Skip them while iterating with `dryv pack test . --no-actions`. ## A fixture worth having Every official pack carries a `tests/fixture/` project (a `dryv.yaml`, authored contracts and the target's own test config) and a `tests/check.sh` that generates, installs and runs the target's compiler and tests. The generated output is only "correct" if the target accepts it. ## Write a README that describes `dryv pack describe <id>` and the website show your README, so write for a user who has never seen the pack: - what it generates and for which stack; - what it **needs** from other packs (capability names) and what it **provides**; - the `inputs` a project can set; - a minimal `dryv.yaml` snippet. ## Versions and the registry Git is the source of truth for versions. The registry keeps only each pack's **latest published state** and the commit it was published from. `dryv pack add` pins that commit in the project's `dryv.yaml`, so builds repeat exactly. The pack registry is part of the Dryv Platform and is served by the Platform API (`https://api.dryvcode.com`). Reading it is public, and you can browse it at [packs.dryvcode.com](https://packs.dryvcode.com). Publishing a pack, and using private packs, needs a Platform sign-in (`dryv login`). Testing and using packs locally needs no sign-in. Official packs are published by the maintainers from the [dryvcode/packs](https://github.com/dryvcode/packs) repository through the Platform registry API. Publishing is deliberate and manual. A pack is publishable when it has `info.purpose`, `info.summary`, `info.languages`, a `README.md`, a `key` of the form `<layout>.<purpose>.<name>` that matches its folder, and the commit is clean. Bundles are built from a commit, so commit first. Published packs are retired, never deleted, and can be renamed. ## Checklist before you publish - [ ] `dryv pack validate .` and `dryv pack test .` pass - [ ] The fixture project builds and its tests pass - [ ] README explains needs, provides, inputs and a sample `dryv.yaml` - [ ] `CHANGELOG.md` records the change - [ ] No template reads a context path `dryv context show` cannot explain --- <!-- Source: https://docs.dryvcode.com/pack-builders/cli --> # CLI for pack builders ## Commands | Command | Use it to | | -------------------------------------------------------- | ------------------------------------------------------------------------------------ | | `dryv context list` | List every context root and type the engine serves | | `dryv context show <path>` | Explain one path: root, cardinality, provenance, provider, and the fields beneath it | | `dryv pack init [path]` | Scaffold `dryv.pack.yaml` and a template folder | | `dryv pack inspect [path]` | Show discovered resources and renderers | | `dryv pack validate [path]` | Check manifest, filesystem and engine semantics | | `dryv pack doctor [path]` | Check renderer and action readiness | | `dryv pack test [path]` | Render against engine-owned sample IR | | `dryv pack describe <id>` / `explain <id>` | Read how a published pack is documented and used | | `dryv template-server init/inspect/validate/doctor/test` | Build a renderer | | `dryv author init/inspect/validate/doctor/test` | Build an author and compiler pair | Every command accepts `--json --no-input` for scripts and agents. ## `dryv context` ```bash dryv context list dryv context show "schema.fields[].value.is.boolean" dryv context show "schema.fields[].value.generated.schema_validation" --json ``` A lookup always answers with `info` or a stable error code: `context.root.unknown`, `context.path.collection_invalid`, `context.path.field_unknown`, `context.path.named_map_key`. See [Derived values](/pack-builders/context/derived) for what the derived helpers mean. ## `unknown command 'context'` `dryv context` ships with the 0.1.0 line. If your shell reports it as unknown, the `dryv` on your `PATH` is an older install. Check which one you are running: ```bash dryv --version which dryv ``` Update the global install: ```bash dryv update ``` or, when working from a repository checkout, run the checkout's build: ```bash cd source/apps/cli && bun run build && bun link ``` Then `dryv --version` should print 0.1.0 or newer and `dryv context list` should work. --- <!-- Source: https://docs.dryvcode.com/pack-builders/design/core-model --> # Core model ## 1. Pack A pack is a reusable generator. It may contain many templates, including: - static/global files; - per-schema files; - per-operation files; - export/barrel files; - project/package root files. A pack does **not** need to be tiny and does not need one pack per template concern. A pack is described by: ```text dryv.pack.yaml ``` It does not use an active internal `dryv.yaml` to activate other packs. ## 2. Activation An activation is one use of a pack in the user's `dryv.yaml`. The same reusable pack may be activated more than once with different: - destinations; - inputs; - capability bindings; - executable selections. ## 3. Generated unit A generated unit is the project/package root that packs contribute to. Examples: ```text apps/backend apps/web apps/mobile packages/api_client packages/shared_contracts ``` A `package` or `project` pack establishes a unit. An `inject` pack contributes into a unit. This is an internal/planning concept. It does not create a new semantic tier and does not compete with Runtime IR. ## 4. Capability composition A pack declares only the capability it needs. Example: ```yaml needs: operation.client: required ``` The project chooses the concrete provider: ```yaml bind: operation.client: $ref: "#/packs/api-client" ``` Rule: ```text PACK declares NEEDS. USAGE chooses PROVIDERS. ``` Do not add hidden pack dependencies that automatically activate other packs. ## 5. Why package/project are still packs A package pack is a generator that establishes a reusable generated package. A project pack is a generator that establishes an editable application/project. Both can generate real root files such as: - `package.json`; - `pubspec.yaml`; - `pyproject.toml`; - `tsconfig.json`; - app entrypoints; - configuration files; - generated source trees. Neither requires a nested `dryv.yaml`. The distinction is primarily how the generated unit participates in the workspace and how its artifacts are normally owned. ## 6. Typical ownership Package: ```text mostly managed ``` Project: ```text mix of scaffold + managed ``` Inject: ```text depends on purpose ``` This is a convention, not a semantic shortcut. Ownership is resolved per output resource: ```text normal filename → managed *.sf[.<renderer>] → scaffold ``` Do not use fake manifest templates merely to assign ownership. ## 7. Starter/recipe is not a pack A starter or recipe is reusable composition. It may provide an initial `dryv.yaml` that activates several packs. It does not hide those packs after initialization. A starter may create: ```text dryv.yaml .dryv/contracts/... initial handwritten/scaffold files ``` but normal generation still runs through the explicit project `dryv.yaml`. --- <!-- Source: https://docs.dryvcode.com/pack-builders/design/layouts-and-units --> # Layouts and units ## Proposed layout contract The runtime layout is deliberately small. Inject is the default and normally omitted: ```yaml # no layout key ``` Unit: ```yaml layout: unit ``` The value is scalar. Do not use `layout.kind`. This belongs to the runtime pack contract, not only catalogue metadata. The current discovery-only `catalog.layout: inject | standalone` is too coarse because `standalone` mixes reusable packages and editable applications. ## Inject An inject pack contributes artifacts into a destination/unit it does not own. Examples: - TypeORM entities; - Zod schemas; - class-validator DTOs; - Flutter JSON models; - generated controllers added to an existing backend; - documentation fragments. An inject pack may target: 1. a unit established by a `unit` pack; or 2. a handwritten existing project with no Dryv root-owning pack. ## Unit A unit pack establishes a generated unit root. Runtime package identity is separate from layout and intentionally minimal: ```yaml layout: unit package: name: $ref: "#/inputs/package_name" import_root: lib ``` Do not add an `ecosystem` field simply to make the Engine understand npm, Dart, Python or another package manager. Languages/frameworks remain discovery metadata. Examples: - Dart API package; - npm API SDK; - Python client package; - Rust crate; - generated shared contracts library. Typical result: ```text packages/api_client/ ├── package manifest ├── configuration ├── generated public entrypoint └── generated implementation ``` The package can contain static/global templates and dynamic templates in one pack. It may also accept inject packs in the same unit when modular composition is useful. ## Project A project pack establishes an editable runnable/deployable project. Examples: - Flutter application; - Next.js application; - NestJS application; - FastAPI application; - CLI project. Typical result: ```text apps/mobile/ ├── project manifest ├── user-editable scaffold files └── Dryv-managed generated files ``` A project pack can be substantial. It does not need private internal packs merely because it generates many kinds of files. Split functionality into additional packs only when independent reuse or composition has real value. ## Unit ownership Proposed validation: - one `package` or `project` pack may establish a given destination root; - any number of compatible `inject` packs may contribute to that unit; - two root-owning packs targeting the same unit are an error; - inject-only generation into a handwritten destination remains valid. Example: ```text apps/backend/ owner: unit/backend/nestjs contributors: inject/persistence/typeorm inject/validation/class-validator packages/api_client/ owner: package/clients/typescript-api-client apps/web/ owner: project/frontend/nextjs-app ``` ## Package identity versus workspace path A generated package has at least two different identities: ```text workspace path packages/api_client consumer identity @riderescue/api-client ``` or: ```text workspace path packages/riderescue_api consumer identity riderescue_api ``` Do not conflate these. A consuming pack must be able to learn generic package/unit facts from a bound provider while still deciding target-language import syntax itself. Dryv should not generate framework/language import syntax. ## Cross-unit dependencies A frontend may consume `operation.client` from a generated package unit. Conceptually the planner needs enough information to expose: ```text provider unit provider package identity producer artifact producer symbol package-relative artifact path workspace-relative unit path ``` The consuming template decides whether that becomes: ```text import { createOrder } from "@riderescue/api-client" ``` or: ```text import 'package:riderescue_api/riderescue_api.dart'; ``` or another target-specific form. ## Unit as command-policy boundary A generated unit maps to a `destinations.code` entry in the proposed Usage redesign. IR serialization destinations live separately under `destinations.ir` and are not generated-code units. The generated unit is also the boundary for action resolution and project environment choices. All packs targeting the same destination contribute to one unit-level set of: ```text dependencies choice groups actions generated files ``` Usage configures the real environment on that destination: ```yaml destinations: backend: path: apps/backend choose: { js.package_manager: pnpm } ``` This is intentionally not pack-activation configuration. TypeORM, validation and a backend project pack contributing to the backend application must see the same package-manager choice because their commands execute in the same project. Different destinations remain independent: ```text apps/backend -> pnpm packages/api_client -> dart apps/mobile -> flutter ``` An inject-only handwritten destination is still a generated unit for this purpose even when no `project` or `package` pack owns its root. --- <!-- Source: https://docs.dryvcode.com/pack-builders/design/composition-and-bindings --> # Composition and bindings ## Principle Composition remains explicit. A pack never activates another pack because it happens to need something. Instead: ```text provider pack provides capability ↓ dryv.yaml pack activation bind ↓ consumer pack needs capability ``` Existing Dryv capability slots remain the model: - `schema.types` - `schema.validation` - `schema.persistence` - `property.enum.types` - `operation.client` The slot catalogue may evolve separately, but pack layout does not replace capability composition. ## Example graph ```text TypeORM entities inject provides schema.persistence │ ▼ NestJS backend project needs schema.persistence │ TypeScript API client package provides operation.client │ ▼ Next.js frontend project needs operation.client ``` ## Same-unit versus cross-unit binding Same unit: ```text apps/backend ├── NestJS project pack ├── TypeORM inject pack └── validation inject pack ``` Cross unit: ```text packages/api_client └── API package pack provides operation.client │ ▼ apps/web └── Next.js project pack needs operation.client ``` Both should use the same `provides / needs / bind` mechanism. The difference belongs to planning/addressing, not to a second dependency system. ## Pack-level binding context Current `file.dependencies[]` is useful for artifact-specific dependencies. Root/global project files sometimes need broader knowledge. Example: ```text apps/mobile/pubspec.yaml ``` needs to know that `operation.client` comes from Dart package `riderescue_api` even though `pubspec.yaml` is not a specific operation artifact. Therefore the future template context likely needs a generic pack/unit binding view. Conceptually: ```text pack.bindings.operation_client.provider pack.bindings.operation_client.unit pack.bindings.operation_client.package ``` This must remain planning-derived and demand-driven. It must not expose framework-specific facts such as: ```text uses_zod uses_dio uses_next_api_bridge ``` ## No nested composition Do not allow: ```text dryv.yaml → pack A → hidden dryv.yaml → pack B → pack C ``` The project must remain able to inspect every activated pack and binding in its own usage configuration. Under the proposed Usage redesign, pack activations also reference shared `sources.packs` entries and typed `destinations.code` entries. This changes project wiring, not the `provides / needs / bind` capability model. A starter/recipe can prepare that explicit configuration, but it cannot remain a hidden runtime layer. ## Capability binding versus action batching Capability composition and command/action composition are separate concerns. ```text needs / provides / bind -> which generated artifacts satisfy semantic capability slots same destination + same action ID -> which generation-support actions may batch for one unit ``` For example, TypeORM and class-validator may both contribute an `install` action to the backend application. Those actions can batch without either pack providing a capability to the other. Likewise a capability binding does not imply any command dependency or package-manager choice. Both mechanisms meet only at the generated unit, where the Engine can explain: - which packs provide/need capabilities; - which packs contributed dependencies; - which packs requested each action; - which destination choice selected the concrete command. --- <!-- Source: https://docs.dryvcode.com/pack-builders/design/template-filesystem --> # Template filesystem This document applies the locked rules from [00-locked-decisions.md](/pack-builders/design/rules). ## Global resources Any resource under the pack source root that is not inside a `{template_key}` marker is generated once per pack activation. Examples: ```text templates/ ├── package.json.sf.hbs ├── tsconfig.json.sf.hbs └── src/ └── main.ts.sf.hbs ``` No manifest `templates.project` entry is required. Rendered global resources may use roots that are structurally valid for a global invocation, such as pack inputs and bound-unit facts. They do not receive a fake semantic subject. ## Selection resources A selection template has a real manifest entry: ```yaml selections: schemas: subject: schema scope: each templates: dto: $ref: "#/selections/schemas" output: name: $(subject.name.kebab) symbol: $(subject.name.pascal)Dto ``` Physical layout: ```text templates/ └── src/ └── generated/ └── dto/ └── {dto}/ └── $(name).dto.ts.hbs ``` Static path structure is visible in the filesystem. ## Dynamic path insertion The marker is the insertion point for `output.path`. Example: ```text templates/src/controllers/{controller}/$(name).controller.ts.hbs ``` and: ```yaml output: name: $(feature.name.kebab) path: - $(group.name.kebab) - $(feature.name.kebab) ``` means: ```text src/controllers/<group>/<feature>/<name>.controller.ts ``` The Engine must reject a static segment such as: ```yaml path: - src ``` because `src` belongs physically in the template tree. ## Ownership control suffix Normal resource: ```text $(name).dto.ts.hbs ``` is managed. Scaffold resource: ```text $(name).screen.dart.sf.hbs ``` is written only if missing and then belongs to the user. This convention applies equally to: - global rendered files; - global raw/static files; - selection-rendered files; - files produced by project, package and inject packs. Ownership is visible from the source resource and must appear explicitly in the plan/trace. ## Why ownership belongs to files A single selection may legitimately produce both kinds: ```text {view}/ ├── $(name).generated.dart.hbs └── $(name).screen.dart.sf.hbs ``` Template-level ownership cannot represent that without splitting an otherwise coherent selection into artificial registry entries. Resource-level ownership avoids that duplication. ## Collision identity Collision detection must operate on final output paths after stripping: 1. renderer suffix; 2. ownership control suffix. Therefore these two resources conflict: ```text main.dart.hbs main.dart.sf.hbs ``` because both target: ```text main.dart ``` There is never a last-writer-wins rule. ## Staged files and file actions The `files` action stage operates on rendered/staged generated files before compare/write. A pack action may restrict the files it contributes to a batched action: ```yaml actions: format: stage: files extensions: [.ts] commands: - run: [pnpm, exec, prettier, --write, $(files)] ``` The extension filter is evaluated against each pack's own staged outputs before same-ID actions are batched. Dryv then unions and sorts the filtered file paths. This means: ```text Pack A extensions [.ts] Pack B extensions [.ts, .json] ``` does not cause Pack A's unrelated JSON outputs to enter the merged formatter invocation. Formatting in staging is part of generated-output normalization. The normalized staged result is what comparison, write and trace should observe. The staging location must preserve deterministic access to unit configuration used by tools such as formatters, without changing the rule that the Client owns workspace I/O and process execution. --- <!-- Source: https://docs.dryvcode.com/pack-builders/design/ownership --> # Starters, recipes and ownership ## Starter A starter helps a user begin an editable project/workspace. Typical contents: ```text dryv.yaml .dryv/contracts/... README.md possibly initial handwritten/scaffold files ``` The starter may activate project, package and inject packs. After initialization, the resulting `dryv.yaml` is visible and owned by the user. ## Recipe A recipe is a reusable recommended composition that may be useful even when the resulting unit is mostly generated. Example: ```text standard Dart API package = Dart model inject pack + Dart HTTP operation inject pack + Dart package-root pack ``` A recipe can help produce the explicit usage configuration, but it does not become a hidden runtime dependency layer. The exact product name and storage format for recipe/starter definitions are not approved yet. ## Why a generated package is not a starter A Riderescue API package may be almost entirely Dryv-managed: ```text packages/riderescue_api/ ├── pubspec.yaml ├── analysis_options.yaml ├── lib/riderescue_api.dart ├── lib/models/*.dart └── lib/operations/*.dart ``` The user consumes it from another project and normally does not edit it. That is a package pack/unit, not a starter. A starter may choose to activate that package pack. ## Why a project pack is not automatically a starter A Flutter project pack may generate a project root: ```text apps/mobile/ ├── pubspec.yaml ├── android/ ├── ios/ └── lib/ ``` That is still a generator pack. A separate starter can make it easy to initialize a workspace that activates: - the Flutter project pack; - a Dart API package; - optional validation/inject packs; - initial authored source. ## Ownership proof A package unit will often be: ```text managed managed managed managed ``` A project unit can intentionally mix: ```text pubspec.yaml scaffold lib/main.dart scaffold lib/app.dart scaffold lib/_generated/routes.dart managed lib/_generated/forms/* managed ``` This allows the project pack to create a working starting application without forcing Dryv to permanently own every application file. The source-resource convention is now locked: ```text normal resource name → managed *.sf[.<renderer>] → scaffold ``` Examples: ```text pubspec.yaml.hbs → managed main.dart.sf.hbs → scaffold $(name).screen.dart.sf.hbs → scaffold $(name).routes.dart.hbs → managed ``` Ownership is therefore visible at the exact file that carries it rather than being duplicated at template-registry level. ## Managed-file drift The CLI records the digest of each managed file after a successful apply. When a later definition changes the desired output and the current file also differs from that recorded digest, the CLI reports a conflict if the developer's version does not already match the desired output. Apply blocks the batch by default. Interactive use offers overwrite, keep, or cancel; automation selects with `--conflicts overwrite|keep|block`. Keeping a conflict skips that managed file while allowing unrelated generated changes to apply. A missing receipt means Dryv has no baseline for this comparison, so the CLI reports evidence as unavailable instead of claiming that an edit is manual drift. Scaffold files remain project-owned and are skipped once they exist. This conflict rule applies only to managed artifacts with a recorded baseline; it does not change scaffold ownership. ## Starters may persist environment choices Because a starter may create the initial project-owned `dryv.yaml`, it may also persist explicit destination choices that are known for that starter. Example: ```yaml destinations: backend: path: apps/backend choose: { js.package_manager: pnpm } ``` This does not make pnpm a hidden pack dependency. It is visible project configuration created by the starter and remains editable by the user. A reusable pack must still not infer or force that choice merely because a starter commonly selects it. A starter using the proposed Usage model may also declare shared pack sources once and reference them from several activations: ```yaml sources: packs: dryv: repository: https://github.com/dryvcode/packs ref: develop root: packs ``` This remains visible project-owned `dryv.yaml` configuration. --- <!-- Source: https://docs.dryvcode.com/pack-builders/design/actions --> # Actions and commands ## Goal Commands exist only to support generation. Typical needs are: - install generated-code dependencies; - format generated files; - typecheck/analyze; - run secondary generators such as Dart build_runner; - remove unused imports; - run pack-specific project tooling. The model must stay small because Dryv does not know the user's runtime, installed tools or preferred package manager. ## Responsibility boundary ```text PACK dependencies choice groups staged actions explicit command patterns USAGE / dryv.yaml typed code destinations per-destination choices action replacements/disables ENGINE expand, merge, resolve, plan exact argv CLIENT execute approved exact argv ``` The pack knows what its generated code needs. The project knows which explicit tool choice it uses. ## Pack YAML style Pack examples prefer compact YAML when a small object is clearer on one line: ```yaml plugins: - { name: handlebars, extensions: [.hbs] } inputs: package_name: { type: string, required: true } needs: schema.validation: required schema.persistence: required choose: js.package_manager: { options: [pnpm, npm, bun, yarn] } ``` Flow style and block style have identical semantics. Expand structures when compression would make them harder to read. `actions` is placed last in normal `dryv.pack.yaml` examples because actions are operational consequences of the pack definition. ## Action shape Actions are keyed by action ID, and each action declares its lifecycle `stage`. ```yaml actions: format: stage: files extensions: [.ts] commands: - run: [(pnpm|yarn), exec, prettier, --write, $(files)] - run: [npm, exec, --, prettier, --write, $(files)] - run: [bun, x, prettier, --write, $(files)] install: stage: final dependencies: args: - dev: { (pnpm|yarn): [-D], bun: [--dev], npm: [--save-dev] } - $(name)@$(version) commands: - run: [(pnpm|bun|yarn), add] - run: [npm, install] typecheck: stage: final after: [install] commands: - run: [(pnpm|yarn), exec, tsc, --noEmit] - run: [npm, exec, --, tsc, --noEmit] - run: [bun, x, tsc, --noEmit] ``` The mapping order is the pack's normal action sequence inside the stage. ## Stages Keep only the currently useful stages: - `files` — operates on staged generated files before comparison/write; - `final` — operates in the generated unit after workspace write. Do not add more phases until a real pack requires one. ## Stable and custom action IDs Dryv may ship only human-readable metadata for common IDs: ```text format install typecheck analyze test build ``` `install-dev` is not an action. `dev` is a dependency scope handled by the same logical `install` action. Known IDs never imply hidden command recipes. Packs may define arbitrary custom IDs: ```yaml build-runner: name: Generate serializers description: Run json_serializable companion generation. commands: - run: [dart, run, build_runner, build, --delete-conflicting-outputs] ``` ## Command patterns `run` is argv data, never a shell string. A normal run is one explicit candidate: ```yaml - run: [npm, install] ``` When several candidates have the same remaining argv shape, a grouped alternative token removes repetition: ```yaml - run: [(pnpm|bun|yarn), add] ``` This is transparent shorthand for: ```text [pnpm, add] [bun, add] [yarn, add] ``` If several argv positions contain grouped alternatives, they are zipped by position, never Cartesian-expanded: ```yaml - run: [(a|b|c), (x|y|z), shared] ``` means: ```text [a, x, shared] [b, y, shared] [c, z, shared] ``` All grouped alternative tokens in one `run` must have the same number of alternatives. A token is treated as grouped syntax only when the whole argv item has the form `(a|b|c)`. Other argv strings remain literal. Only candidates with genuinely identical remaining argv structure should be grouped. A different command shape gets its own `run`: ```yaml commands: - run: [(pnpm|bun|yarn), add] - run: [npm, install] ``` Dryv expands grouped runs into ordinary explicit candidates before normal candidate selection, batching, tracing and execution. ## Candidate keys and choices Related multi-candidate actions may share a choice group: ```yaml choose: js.package_manager: { options: [pnpm, npm, bun, yarn] } ``` After grouped-run expansion, each candidate key is: ```text candidate.id when present otherwise expanded run[0] ``` Thus: ```yaml commands: - run: [(pnpm|bun|yarn), add] - run: [npm, install] ``` produces candidate keys: ```text pnpm bun yarn npm ``` The choice group's first option is the pack default. Candidate declaration order does not need to duplicate the choice-group order. Explicit candidate IDs remain available for individual candidates when `run[0]` is not a useful stable key. Grouped runs normally derive their keys from their expanded first token rather than hiding the alternatives behind one ID. A one-candidate action needs no choice group. ## Ordering Mapping order defines the normal sequence inside a stage. Use `after` when the relationship must survive cross-pack merging: ```yaml build-runner: after: [install] commands: - run: [dart, run, build_runner, build] ``` `after` only refers to actions in the same stage. Missing targets and cycles are planning errors. ## Files `$(files)` is the generated-file argv expansion for `files` actions. `extensions` belongs to the action. During batching, each contributing pack filters its own generated files first; Dryv then unions and sorts those filtered sets. ```yaml format: extensions: [.dart] commands: - run: [dart, format, $(files)] ``` A broader extension list from one pack must not broaden another pack's file set. An empty resolved file list skips the invocation. ## Dependency requirements Top-level dependencies describe what generated output requires: ```yaml dependencies: runtime: typeorm: ^0.3 reflect-metadata: ^0.2 dev: prettier: ^3 typescript: ^5.8 ``` `runtime` and `dev` are dependency scopes, not action IDs. ## Dependency argv expansion An install action can describe how every non-empty dependency scope becomes argv: ```yaml install: dependencies: args: - dev: { (pnpm|yarn): [-D], bun: [--dev], npm: [--save-dev] } - $(name)@$(version) commands: - run: [(pnpm|bun|yarn), add] - run: [npm, install] ``` `dependencies.args` is ordered. Its list order is exact argv order. A plain entry applies to every dependency scope: ```yaml - $(name)@$(version) ``` A scoped entry applies only while processing that scope: ```yaml - dev: { (pnpm|yarn): [-D], bun: [--dev], npm: [--save-dev] } ``` The inner keys select by the already-selected command candidate key. Grouped keys such as `(pnpm|yarn)` mean both candidate keys receive the same extra argv. A missing scope entry means no scope-specific extra argv. There is no need for `runtime: {}`. For every non-empty dependency scope, Dryv resolves one invocation from the selected command plus the ordered dependency args. With pnpm: ```text runtime -> pnpm add typeorm@^0.3 reflect-metadata@^0.2 dev -> pnpm add -D prettier@^3 typescript@^5.8 ``` With npm: ```text runtime -> npm install typeorm@^0.3 reflect-metadata@^0.2 dev -> npm install --save-dev prettier@^3 typescript@^5.8 ``` The same logical action may therefore resolve to zero, one or several process invocations. ```text ACTION != PROCESS INVOCATION ``` If a dependency scope is empty, no invocation is produced for that scope. Dryv does not interpret package-manager semantics. The pack exposes all differences explicitly in `commands` and `dependencies.args`. ## Managed package versus editable project A generated package can render merged dependencies into its managed manifest: ```yaml actions: install: stage: final commands: - run: [(dart|flutter), pub, get] ``` No dependency argv expansion is needed because the dependency requirements are already materialized in the managed manifest. An editable/scaffold manifest instead uses explicit dependency argv expansion so the selected project tool updates the user-owned manifest and lockfile. ## Project authority The surrounding Usage tree is defined in [10-dryv-yaml-usage-update.md](/pack-builders/design/project-configuration). Action policy lives on `destinations.code.<unit>`. ```yaml destinations: backend: path: apps/backend choose: { js.package_manager: pnpm } actions: files: format: commands: - run: [pnpm, exec, biome, format, --write, $(files)] final: typecheck: { disable: true } ``` A destination may select a shared candidate, replace an action command, override explicit action fields or disable an action. Omitted action fields remain inherited from the merged pack action. ## Batching Same-stage, same-ID actions in one unit are natural batching points. ```text typeorm.install class-validator.install nestjs.install => one logical install action => merged runtime/dev dependency scopes => one selected package-manager candidate => one invocation per non-empty dependency scope ``` Do not merge actions merely because their argv happens to look similar. ## No environment guessing Dryv must not silently infer command choice from PATH, lockfiles, installed executables or environment variables. If the selected command requires `pnpm` and `pnpm` is unavailable, the Client reports the missing executable. It does not fall back to npm. ## No shell language Canonical commands remain argv patterns: ```yaml run: [(pnpm|yarn), exec, prettier, --write, $(files)] ``` not shell strings. A project that truly needs shell behavior can call an explicit project-owned script as a normal argv command. --- <!-- Source: https://docs.dryvcode.com/pack-builders/design/action-schema --> # Action command schema Status: **design direction** This document describes the proposed pack-side action/command shape and the matching destination-level usage configuration. ## 1. Compact authoring style Small declarative objects should normally use YAML flow style: ```yaml plugins: - { name: handlebars, extensions: [.hbs] } inputs: package_name: { type: string, required: true } needs: schema.validation: required schema.persistence: required choose: js.package_manager: { options: [pnpm, npm, bun, yarn] } ``` This is a documentation/style preference only. Flow and block forms have identical semantics. Normal pack examples place `actions` last. ## 2. Choice groups Related multi-candidate actions may share one explicit tool choice: ```yaml choose: js.package_manager: { options: [pnpm, npm, bun, yarn] } ``` The first option is the pack default. Choice groups choose between explicit command candidates. They never contain hidden command recipes. ## 3. Actions are an ordered flat registry ```yaml actions: format: stage: files ... install: stage: final ... typecheck: stage: final ... ``` The action ID is the mapping key. Do not repeat `id:`. The retained stages are: - `files` — staged generated files before compare/write; - `final` — the generated unit after workspace write. Known action IDs may omit repetitive human metadata: ```text format install typecheck analyze test build ``` `install-dev` is deliberately absent. `dev` is a dependency scope inside `install`. Custom action IDs remain valid. ## 4. Action fields An action may contain: ```text name description extensions dependencies after commands ``` `commands` is optional when the pack can explain the required work but cannot safely provide a project-specific implementation. ## 5. Command candidates A normal command candidate is exact argv: ```yaml commands: - run: [npm, install] ``` `run` is never a shell string. Candidate `id` remains optional for an individual candidate when `run[0]` is not a useful stable key. ## 6. Grouped run alternatives Repeated candidates with the same argv structure may be compressed: ```yaml commands: - run: [(pnpm|bun|yarn), add] - run: [npm, install] ``` The grouped token expands positionally: ```text [pnpm, add] [bun, add] [yarn, add] [npm, install] ``` When several argv positions contain grouped alternatives, expansion is zipped by index: ```yaml - run: [(a|b|c), (x|y|z), common] ``` expands to: ```text [a, x, common] [b, y, common] [c, z, common] ``` Rules: - expansion is never Cartesian; - all grouped tokens inside one `run` must have the same arity; - grouped syntax is recognized only when the whole argv item has the form `(a|b|c)`; - every other argv string is literal; - ungrouped argv tokens are shared by every expanded candidate; - only genuinely identical command shapes should be grouped; - a command with a different argv shape gets its own `run`. Grouped runs are syntax compression only. The Engine expands them to ordinary explicit candidates before selection and planning. ## 7. Candidate keys After grouped-run expansion, the candidate key is: ```text candidate.id when present otherwise expanded run[0] ``` Therefore: ```yaml commands: - run: [(pnpm|bun|yarn), add] - run: [npm, install] ``` provides: ```text pnpm bun yarn npm ``` for a choice group such as: ```yaml choose: js.package_manager: { options: [pnpm, npm, bun, yarn] } ``` Candidate declaration order does not need to repeat the choice-group option order. The group itself owns the default. Grouped candidates normally derive their keys from the expanded first argv token. If an explicit `id` is needed, author the candidate individually rather than hiding several alternatives behind one ID. ## 8. File actions and extensions ```yaml format: extensions: [.ts, .tsx] commands: - run: [(pnpm|yarn), exec, prettier, --write, $(files)] - run: [npm, exec, --, prettier, --write, $(files)] - run: [bun, x, prettier, --write, $(files)] ``` `$(files)` expands to staged generated files as separate argv items. When same-ID file actions batch: 1. each contributing pack filters its own generated files by its own `extensions`; 2. Dryv unions those filtered sets; 3. Dryv sorts the resolved staged paths; 4. the union is supplied to the selected command. An empty final file set skips the invocation. ## 9. Dependency requirements versus dependency argv Top-level dependencies remain structured requirements: ```yaml dependencies: runtime: typeorm: ^0.3 reflect-metadata: ^0.2 dev: prettier: ^3 typescript: ^5.8 ``` Action-local `dependencies.args` describes how those scopes become argv: ```yaml install: dependencies: args: - dev: { (pnpm|yarn): [-D], bun: [--dev], npm: [--save-dev] } - $(name)@$(version) commands: - run: [(pnpm|bun|yarn), add] - run: [npm, install] ``` The two structures answer different questions: ```text top-level dependencies -> what generated code requires action dependencies.args -> how dependency scopes are expressed in argv ``` ## 10. Ordered dependency args `dependencies.args` is an ordered list. List order is argv order. A plain item applies to every dependency scope: ```yaml - $(name)@$(version) ``` A scope mapping applies only to that scope: ```yaml - dev: { (pnpm|yarn): [-D], bun: [--dev], npm: [--save-dev] } ``` The scoped mapping's inner keys are candidate keys. A grouped key such as `(pnpm|yarn)` applies the same argv to each listed candidate. Missing scope configuration means no extra scope-specific argv. Do not write: ```yaml runtime: {} ``` unless a future real use case gives that mapping additional meaning. For each non-empty dependency scope, Dryv produces one invocation from: ```text selected command argv + ordered dependency args for that scope/candidate ``` A plain `$(name)@$(version)` item expands once per dependency in the current scope. Dependency ordering is deterministic before expansion. ## 11. One install action, multiple invocations `install` is the logical action. `runtime` and `dev` are dependency scopes. Therefore this: ```text install install-dev ``` is replaced by: ```text install runtime invocation when runtime dependencies exist dev invocation when dev dependencies exist ``` For pnpm: ```text pnpm add typeorm@^0.3 reflect-metadata@^0.2 pnpm add -D prettier@^3 typescript@^5.8 ``` For npm: ```text npm install typeorm@^0.3 reflect-metadata@^0.2 npm install --save-dev prettier@^3 typescript@^5.8 ``` An empty scope produces no invocation. This establishes: ```text logical action != process invocation ``` An action may resolve to zero, one or several exact argv invocations. ## 12. Managed package install If dependencies are already rendered into a Dryv-managed package manifest: ```yaml install: commands: - run: [(dart|flutter), pub, get] ``` No dependency argv expansion belongs on that action. Editable/scaffold manifests instead use explicit dependency argv expansion to let the selected project tool update the user-owned manifest and lockfile. The exact managed-manifest detection contract remains a separate open design point. ## 13. Ordering Use `after` only when an ordering relationship must survive cross-pack merging: ```yaml typecheck: after: [install] ``` Rules: - `after` refers only to action IDs in the same stage; - it may refer to an action contributed by another pack; - unknown targets are planning errors; - cycles are planning errors. Because dev dependencies are part of `install`, a consumer that requires all installed dependencies simply uses `after: [install]`. ## 14. Destination usage Project environment configuration belongs to `destinations.code.<unit>`: ```yaml destinations: backend: path: apps/backend choose: { js.package_manager: pnpm } actions: files: format: commands: - run: [pnpm, exec, biome, format, --write, $(files)] final: typecheck: { disable: true } ``` A destination can select one shared tool option, replace an action command, explicitly override supported action fields, or disable an action. Destination overrides change only fields they set. Omitted fields remain inherited from the merged pack action. ## 15. Full TypeScript action example ```yaml dependencies: runtime: typeorm: ^0.3 reflect-metadata: ^0.2 dev: prettier: ^3 typescript: ^5.8 choose: js.package_manager: { options: [pnpm, npm, bun, yarn] } actions: format: stage: files extensions: [.ts] commands: - run: [(pnpm|yarn), exec, prettier, --write, $(files)] - run: [npm, exec, --, prettier, --write, $(files)] - run: [bun, x, prettier, --write, $(files)] install: stage: final dependencies: args: - dev: { (pnpm|yarn): [-D], bun: [--dev], npm: [--save-dev] } - $(name)@$(version) commands: - run: [(pnpm|bun|yarn), add] - run: [npm, install] typecheck: stage: final after: [install] commands: - run: [(pnpm|yarn), exec, tsc, --noEmit] - run: [npm, exec, --, tsc, --noEmit] - run: [bun, x, tsc, --noEmit] ``` ## 16. Full Dart package action example ```yaml choose: dart.sdk: { options: [dart, flutter] } actions: format: stage: files extensions: [.dart] commands: - run: [dart, format, $(files)] install: stage: final commands: - run: [(dart|flutter), pub, get] build-runner: stage: final name: Generate serializers description: Run json_serializable companion generation. after: [install] commands: - run: [dart, run, build_runner, build, --delete-conflicting-outputs] analyze: stage: final after: [build-runner] commands: - run: [(dart|flutter), analyze] ``` `format` and `build-runner` have one candidate. The `dart.sdk` choice affects only the grouped multi-candidate actions. --- <!-- Source: https://docs.dryvcode.com/pack-builders/design/action-resolution --> # Action resolution Status: **design direction** ## Core rule Packs request logical work. Projects own their environment. Dryv resolves the two into one unit-scoped execution plan containing exact argv invocations. ```text pack actions + merged dependency scopes + destination choices/overrides ↓ Engine ↓ expanded candidates logical actions exact argv invocations ↓ Client execution ``` ## 1. Collect per generated unit Code-destination identity comes from `destinations.code.<name>`. Every pack activation targeting the same code destination contributes to the same generated unit. Example: ```text TypeORM inject files: format final: install class-validator inject files: format final: install NestJS project files: format final: install, typecheck ``` Dependencies are independently merged into the same unit by scope. ## 2. Expand grouped command patterns Before candidate selection, Dryv expands grouped alternatives. ```yaml commands: - run: [(pnpm|bun|yarn), add] - run: [npm, install] ``` becomes conceptually: ```text [pnpm, add] [bun, add] [yarn, add] [npm, install] ``` Several grouped argv positions are zipped by index, never multiplied as a Cartesian product. ```yaml - run: [(a|b|c), (x|y|z), common] ``` becomes: ```text [a, x, common] [b, y, common] [c, z, common] ``` Expansion is deterministic and traceable. The plan may show both the authored compact pattern and the selected expanded argv. ## 3. Resolve candidate keys and choices After expansion, a candidate key is: ```text candidate.id when present otherwise expanded run[0] ``` For each compatible choice group: 1. collect the options declared by contributing packs; 2. destination `choose` wins when present; 3. otherwise the group's first option is the authored default; 4. select the expanded command candidate whose key matches that option; 5. if a bound action does not support the selected option, report a planning conflict; 6. never inspect PATH, lockfiles or installed tools to choose another candidate. Candidate declaration order does not define the grouped default. The choice group does. ## 4. Batch same-stage same-ID actions The action ID is the batching identity. Compatible requests for: ```text files.format ``` become one logical format action. Compatible requests for: ```text final.install ``` become one logical install action over the unit's merged dependency scopes. Do not batch merely because resolved argv happens to match. ## 5. Preserve ordering Within each pack, action mapping order defines relative order. `after` adds an explicit same-stage ordering edge that survives cross-pack merging. Missing targets and cycles are planning errors. If packs impose contradictory ordering, fail planning and name the conflicting actions and packs. Because dev dependencies are part of `install`, downstream work waits on the same logical action: ```yaml typecheck: after: [install] ``` There is no `install-dev` action. ## 6. Resolve action metadata Known action IDs may receive standard human labels from Dryv. Pack-provided `name` and `description` enrich or replace that human metadata. Custom actions remain opaque to the Engine. Known IDs never imply hidden execution recipes. ## 7. Resolve file actions For a files action: ```yaml format: extensions: [.ts] commands: - run: [(pnpm|yarn), exec, prettier, --write, $(files)] ``` Each contributing pack first filters its own generated files using its own `extensions`. Dryv then: 1. unions the filtered sets; 2. sorts the resolved staged paths; 3. expands `$(files)` as separate argv items. An empty final file set produces no invocation. ## 8. Resolve dependency scopes Top-level dependency requirements are already merged per unit: ```yaml runtime: typeorm: ^0.3 reflect-metadata: ^0.2 dev: prettier: ^3 typescript: ^5.8 ``` An install action describes argv placement: ```yaml dependencies: args: - dev: { (pnpm|yarn): [-D], bun: [--dev], npm: [--save-dev] } - $(name)@$(version) ``` The `args` list is processed in authored order separately for each non-empty dependency scope. Rules: - a plain arg item applies to every scope; - a `runtime:` item applies only to the runtime scope; - a `dev:` item applies only to the dev scope; - missing scope configuration emits nothing extra; - scoped inner mappings select by the already-selected command candidate key; - grouped scoped keys such as `(pnpm|yarn)` apply the same argv to each key; - dependency items inside a scope are sorted deterministically before token rendering. ## 9. Produce install invocations Suppose the selected command is: ```text [pnpm, add] ``` and the install action is: ```yaml dependencies: args: - dev: { (pnpm|yarn): [-D], bun: [--dev], npm: [--save-dev] } - $(name)@$(version) ``` Runtime resolution: ```text [pnpm, add] + [] + [reflect-metadata@^0.2, typeorm@^0.3] → pnpm add reflect-metadata@^0.2 typeorm@^0.3 ``` Dev resolution: ```text [pnpm, add] + [-D] + [prettier@^3, typescript@^5.8] → pnpm add -D prettier@^3 typescript@^5.8 ``` With npm the same logical action resolves using the selected npm candidate: ```text npm install reflect-metadata@^0.2 typeorm@^0.3 npm install --save-dev prettier@^3 typescript@^5.8 ``` Therefore: ```text one logical install action may produce multiple exact process invocations ``` An empty dependency scope produces no invocation. If an action has `commands` but no dependency expansion, it normally resolves to one invocation. ## 10. Managed package install A generated package may render merged dependencies directly into a Dryv-managed manifest. Its install action can therefore be: ```yaml install: commands: - run: [(dart|flutter), pub, get] ``` After choice resolution this produces one normal sync invocation and does not expand dependency requirements into argv. The managed-manifest ownership decision remains separate from action resolution. ## 11. Destination usage Destination usage has authority over project environment choices: ```yaml destinations: backend: path: apps/backend choose: { js.package_manager: pnpm } actions: files: format: commands: - run: [pnpm, exec, biome, format, --write, $(files)] final: typecheck: { disable: true } ``` A destination action override changes only the fields it explicitly supplies. Omitted `extensions`, `dependencies`, `after`, `name` and `description` remain inherited from the merged action unless that field is explicitly replaceable by the Usage contract. A disabled action stays visible in the plan with its contributing packs and disabling usage location. ## 12. Unresolved actions A pack may declare an action without `commands` when it knows work is required but cannot safely provide a project-specific implementation. After destination overrides are applied: - if commands are available, continue normal resolution; - if the action remains commandless, report it as unresolved; - do not invent a built-in recipe. ## 13. Client boundary The Engine emits enough information for the Client to show: ```text unit stage logical action ID requesting packs choice source authored compact command pattern expanded selected candidate dependency scope exact argv for each invocation file/dependency expansion override/disable origin ``` The Engine never starts a process. The Client owns executable availability, approval/policy, process execution and workspace I/O. Final-stage invocations execute from the generated unit root. Files-stage invocations operate on that unit's staged generated files. ## 14. Determinism Resolution depends on committed Usage configuration, pack contents, Runtime IR-derived planning data and deterministic expansion rules. It must not depend on: - PATH order; - whichever package manager happens to be installed; - lockfile sniffing; - environment-driven silent selection. Grouped command syntax reduces repetition only. It does not weaken explicitness or traceability. --- <!-- Source: https://docs.dryvcode.com/pack-builders/design/project-configuration --> # Project configuration Status: **proposed Usage-tier change caused by the pack-design redesign** This document records the proposed `dryv.yaml` redesign that became necessary while designing reusable packs, generated units, action choices and destination-scoped command policy. This is explicitly a **`dryv.yaml` / `dryv/v1alpha1` change**. It is not a new semantic tier and does not change the Canonical Runtime IR. All work remains on `v1alpha1`. Do not introduce `v1alpha2`. ## Why pack design changes usage The pack design established several facts: - several packs may contribute to one generated unit; - the generated unit is represented by a destination; - environment/tool choices belong to the destination, not to individual pack activations; - pack repositories should be declared once and reused by several activations; - authored source and serialized Runtime IR are both inputs to the same downstream pipeline; - project wiring should remain visible and explicit. The previous usage shape repeats source information inside pack activations and uses one top-level semantic `source`. The proposed shape separates declaration from wiring. ## Structural model The new usage file has four structural top-level sections: ```text sources destinations authoring packs ``` ```yaml version: dryv/v1alpha1 sources: authoring: <name>: ... packs: <name>: ... destinations: ir: <name>: ... <name>: ... authoring: source: { $ref: "#/sources/authoring/<name>" } destination: { $ref: "#/destinations/ir/<name>" } # only when compiling and emitting IR packs: <activation>: source: { $ref: "#/sources/packs/<name>" } destination: { $ref: "#/destinations/<name>" } path: <pack path inside source> ``` The word `authoring` is intentional. Dryv's canonical tier is **Authoring**; `Author` remains the implementation/system role. ## 1. sources Sources declare every external or project-local input Dryv reads. They are grouped by role. ### Authoring sources ```yaml sources: authoring: ir: type: ir path: dryv.ir.yaml model: type: typescript path: dryv/contracts entrypoint: index.ts ``` An authoring source is one of: ```text type: ir serialized Canonical Runtime IR type: typescript or python authored software that must be compiled into Runtime IR; path is the source boundary and entrypoint is relative to that boundary ``` The exact authoring-backend/compiler option contract remains owned by the Authoring design. Usage must identify the selected authoring implementation explicitly by source type; it must not infer one from file extensions. ### Pack sources A pack collection is declared once: ```yaml sources: packs: dryv: repository: https://github.com/dryvcode/packs ref: develop root: packs local: path: ./packs ``` Pack sources support the project-level repository mechanisms already required by Dryv: - local path; - public Git repository; - private Git repository accessible through normal Git credentials. No separate Dryv credential system is introduced. For Git sources: - `repository` identifies the repository; - `ref` is the requested branch/tag/ref; - `root` is an optional directory inside the repository containing the pack collection; - exact resolved commit identity belongs in `dryv.lock`. ## 2. destinations Destinations declare every output location. They are grouped by content kind. ### IR destinations ```yaml destinations: ir: compiled: path: build/ir name: dryv.ir formats: [yaml, json, jsonl] ``` An IR destination is valid only when an authored source is compiled and the project chooses to serialize the resulting Runtime IR. Serialized IR is still owned by the Engine. Authoring implementations do not serialize it themselves. ### Code destinations ```yaml destinations: backend: path: apps/backend choose: { js.package_manager: pnpm } api-client: path: packages/riderescue_api choose: { dart.sdk: dart } mobile: path: apps/mobile ``` A code destination is a generated unit. It owns: - the workspace path; - destination-level `choose` selections; - destination-level action replacements/overrides/disables. All packs targeting one code destination share that destination's environment policy. ## 3. authoring The `authoring` section chooses one declared authoring/IR source. Serialized IR: ```yaml authoring: source: { $ref: "#/sources/authoring/ir" } ``` Authored source with emitted IR: ```yaml authoring: source: { $ref: "#/sources/authoring/model" } destination: { $ref: "#/destinations/ir/compiled" } ``` Rules: - `authoring.source` must reference `#/sources/authoring/...`; - `authoring.destination` must reference `#/destinations/ir/...`; - `destination` is invalid for `type: ir` because no compilation output exists to serialize; - authored definitions compile to Canonical Runtime IR before pack planning; - downstream pack planning is identical whether the IR came from authoring or was loaded directly. Authoring-specific compiler/backend options remain an Authoring-contract concern and must not be invented by the pack design. ## 4. packs Pack activations reference declared pack sources and code destinations. ```yaml packs: entities: source: { $ref: "#/sources/packs/dryv", path: inject/persistence/typeorm } destination: { $ref: "#/destinations/backend" } validation: source: { $ref: "#/sources/packs/dryv", path: inject/validation/class-validator } destination: { $ref: "#/destinations/backend" } backend: source: { $ref: "#/sources/packs/dryv", path: unit/backend/nestjs } destination: { $ref: "#/destinations/backend" } inputs: package_name: "@riderescue/backend" bind: schema.validation: { $ref: "#/packs/validation" } schema.persistence: { $ref: "#/packs/entities" } ``` Existing pack-activation concepts remain: - `inputs`; - `bind`; - explicit activation identity; - one destination or an explicit destination-slot map for packs with several outputs. The new source tree does not replace pack inputs or capability bindings. ## 5. Typed $ref wiring Everything that consumes a source or destination refers to it explicitly. Allowed prefixes: | Use site | Required branch | | ------------------------ | ----------------------------------- | | `authoring.source` | `#/sources/authoring/` | | `authoring.destination` | `#/destinations/ir/` | | `packs.*.source` | `#/sources/packs/` | | `packs.*.destination` | `#/destinations/<code destination>` | | `packs.*.destinations.*` | `#/destinations/<code destination>` | | `packs.*.bind.*` | `#/packs/` | A wrong branch is a validation error. Dryv never guesses what a reference meant. Most `$ref` objects contain only `$ref`. A pack activation source also contains `path`, because the reference chooses the pack collection and `source.path` chooses the pack directory inside that collection. ## 6. Destination-level choices and actions Pack design makes this part of `dryv.yaml`. ```yaml destinations: backend: path: apps/backend choose: { js.package_manager: pnpm } actions: files: format: commands: - run: [pnpm, exec, biome, format, --write, $(files)] final: install: commands: - run: [pnpm, add, --save-exact] typecheck: disable: true ``` Rules from pack design remain authoritative: - destination `choose` selects among compatible pack candidates; - a destination action replacement changes only fields it supplies; - omitted `extensions`, `dependencies`, `after`, `name` and `description` remain inherited from the merged pack action; - unknown action IDs are errors; - action configuration is unit-scoped, not workspace-global. ## 7. Full IR-based example ```yaml version: dryv/v1alpha1 sources: authoring: ir: { type: ir, path: dryv.ir.yaml } packs: dryv: repository: https://github.com/dryvcode/packs ref: develop root: packs destinations: backend: path: apps/backend choose: { js.package_manager: pnpm } api-client: path: packages/riderescue_api choose: { dart.sdk: dart } mobile: path: apps/mobile authoring: source: { $ref: "#/sources/authoring/ir" } packs: entities: source: { $ref: "#/sources/packs/dryv", path: inject/persistence/typeorm } destination: { $ref: "#/destinations/backend" } validation: source: { $ref: "#/sources/packs/dryv", path: inject/validation/class-validator } destination: { $ref: "#/destinations/backend" } backend: source: { $ref: "#/sources/packs/dryv", path: unit/backend/nestjs } destination: { $ref: "#/destinations/backend" } inputs: package_name: "@riderescue/backend" bind: schema.validation: { $ref: "#/packs/validation" } schema.persistence: { $ref: "#/packs/entities" } api-client: source: { $ref: "#/sources/packs/dryv", path: package/clients/dart-api-client } destination: { $ref: "#/destinations/api-client" } inputs: package_name: riderescue_api mobile: source: { $ref: "#/sources/packs/dryv", path: project/frontend/flutter-app } destination: { $ref: "#/destinations/mobile" } inputs: app_name: riderescue bind: operation.client: { $ref: "#/packs/api-client" } ``` ## 8. Authored-source example ```yaml version: dryv/v1alpha1 sources: authoring: model: type: typescript path: dryv/contracts entrypoint: index.ts packs: dryv: repository: https://github.com/dryvcode/packs ref: develop root: packs destinations: ir: compiled: { path: build/dryv.ir.yaml } backend: path: apps/backend choose: { js.package_manager: pnpm } authoring: source: { $ref: "#/sources/authoring/model" } destination: { $ref: "#/destinations/ir/compiled" } packs: backend: source: { $ref: "#/sources/packs/dryv", path: unit/backend/nestjs } destination: { $ref: "#/destinations/backend" } ``` If `authoring.destination` is omitted, Runtime IR may remain in memory for planning/generation. ## 9. dryv.lock The usage redesign introduces a generated reproducibility companion: ```text dryv.yaml human-authored project intent and allowed source refs dryv.lock exact resolved source/compiler/pack identities ``` Conceptual shape: ```yaml version: dryv.lock/v1alpha1 authoring: backend: id: dryv.typescript version: 0.9.4 digest: sha256:... sources: packs: dryv: commit: 3f9c2a1e... authoring: model: digest: sha256:... packs: backend: digest: sha256:... entities: digest: sha256:... ``` Rules: - generated by Dryv, not handwritten; - intended to be committed with the project; - Git sources resolve requested refs to exact commits; - local sources may record content digests; - pack contents may record digests; - authoring implementation identity/version may be locked; - the Engine validates lock compatibility before reproducible generation. Exact lock hashing and update-command behavior still require implementation design. ## 10. This is a Usage-tier change The pack model caused this redesign, but the fields in this document belong to Usage. Do not implement them in: - Runtime IR; - Authoring Protocol; - pack semantic vocabulary; - template-server contracts. They belong to: ```text dryv/v1alpha1 dryv.yaml dryv.lock/v1alpha1 ``` The architectural boundary remains: ```text Authoring source / serialized IR ↓ dryv.yaml source wiring ↓ Canonical Runtime IR ↓ pack selection/planning/actions ↓ code destinations ↓ Client applies output and executes approved commands ``` ## 11. Intentionally not copied from the external proposal The following ideas are **not** adopted as pack-design facts: - a project pack does not imply a managed package manifest; - managed/scaffold ownership still comes from actual resource ownership such as `.sf`; - a destination does not declare a `choose` value when no pack action offers a real choice; - pack-map order must not carry required semantic ordering; required action order uses `after`; - compiler-specific option names are not invented by Usage before Authoring defines them. ## 12. Existing build settings The current usage contract has a `build` section. This redesign focuses on project wiring and does not silently redefine cache/default-action behavior. Before implementation, decide whether current build settings: - remain as an additional orthogonal Usage section; or - move entirely to CLI/client configuration. Do not drop them accidentally merely because the structural examples above focus on `sources`, `destinations`, `authoring` and `packs`. ## 13. Design fixtures Concrete examples in this workspace: - fullstack-monorepo.dryv.yaml — serialized IR plus several code destinations; - authored-project.dryv.yaml — authored source plus optional IR emission; - project-actions.dryv.yaml — destination-scoped `choose` and selected project actions; - fullstack-monorepo.dryv.lock — conceptual generated lock companion. These are design fixtures only. The current stable Usage contract and implementation still use the existing shape until this redesign is approved for implementation. --- <!-- Source: https://docs.dryvcode.com/pack-builders/design/rules --> # Design rules Status: **locked for this design review** These approved decisions are preserved here as design authority. They do not imply every planned feature is implemented. An implementation AI must not silently change them. All contract work remains on `v1alpha1`. ## 1. Renderer/tool plugins Pack plugin dependencies use the key: ```yaml plugins: - { name: handlebars, extensions: [.hbs] } ``` Do not use `requires:` for renderer plugins. The word `needs` remains reserved for capability needs between packs. ## 2. Layout is a scalar Layout is not an object. ```yaml layout: unit ``` Inject is the default: ```yaml # layout omitted ``` means: ```text layout = inject ``` Explicit `layout: inject` may be accepted, but normal packs should omit it. ## 3. Package metadata is separate from layout Do not put package metadata inside `layout`. A package pack uses a separate top-level `package` block only for generic runtime facts that planning actually needs. Current proposed minimum: ```yaml layout: unit package: name: { $ref: "#/inputs/package_name" } import_root: lib ``` Rules: - no `ecosystem` field merely to teach Dryv npm/Dart/Python semantics; - `name` is the consumer-visible package identity; - `import_root` is optional and exists only when package-relative artifact addressing needs it; - package discovery metadata such as languages/frameworks stays in `catalog`; - runtime package identity must not live only in `catalog`, because catalogue metadata is not runtime authority. The exact internal reference contract for `#/inputs/<key>` still needs implementation design, but package identity must remain explicit and minimal. ## 4. Global resources do not require fake template entries A pack must not create manifest entries such as: ```yaml templates: package: ownership: managed ``` merely to generate root files. Resources outside a `{template_key}` marker are global resources and are emitted once per pack activation. Example: ```text templates/ ├── pubspec.yaml.hbs ├── analysis_options.yaml └── lib/ └── client.dart.hbs ``` These are real files, not a fake `package` selection/template. The same rule applies to project root files such as `package.json`, `pubspec.yaml`, `main.ts`, and `main.dart`. ## 5. Ownership is resource-level Managed is the default. A normal resource name means: ```text managed ``` A reserved `.sf` control suffix means: ```text generate once, then user-owned ``` `.sf` is the canonical and only scaffold suffix. Do not also support `.scaffold`; one spelling keeps resource identity and parsing unambiguous. Because `.sf` is reserved by Dryv, a literal output filename that itself ends in `.sf` cannot be represented by placing that suffix at the terminal control position. Use `.sf` (scaffold), not `immutable` or `.im`. “Immutable” suggests the user must not edit the file, which is the opposite of scaffold behavior. Rendered example: ```text templates/lib/main.dart.sf.hbs ^^ scaffold marker ^^^ renderer suffix ``` Output: ```text lib/main.dart ``` Raw/static example: ```text templates/README.md.sf ``` Output: ```text README.md ``` Resolution order: 1. detect and strip the renderer suffix; 2. detect and strip the terminal `.sf` control suffix from the remaining resource name; 3. the remaining filename is the output filename. This allows one selection/template to own both managed and scaffold resources without a template-level ownership setting. Do not duplicate ownership in `dryv.pack.yaml`. ## 6. Static directories live in the template filesystem `output.path` is only for dynamic directory segments. Wrong: ```yaml output: path: [src, generated, dto] ``` Correct filesystem: ```text templates/ └── src/ └── generated/ └── dto/ └── {dto}/ └── $(name).dto.ts.hbs ``` with no `output.path` when no dynamic directory is required. When dynamic directories are required: ```yaml templates: controller: $ref: "#/selections/controllers" output: name: $(feature.name.kebab) path: - $(group.name.kebab) - $(feature.name.kebab) symbol: $(feature.name.pascal)Controller ``` and: ```text templates/ └── src/ └── generated/ └── controllers/ └── {controller}/ └── $(name).controller.ts.hbs ``` produces a path conceptually like: ```text src/generated/controllers/<group>/<feature>/<name>.controller.ts ``` Every `output.path` segment must contain at least one allowed planning interpolation token. Purely static path segments are rejected. ## 7. Manifest templates represent real selection/export behavior A `templates.<key>` entry exists because the template has real planner behavior: - it is driven by a selection; or - it aggregates/exports planned artifacts. Do not create registry entries solely to name static/global files, assign ownership, or model a package/project root. ## 8. One project usage document remains authoritative Generator packs use `dryv.pack.yaml`. The user's workspace uses one `dryv.yaml`. Packs do not hide another active `dryv.yaml` or auto-activate other packs. ## 9. Generated-code dependencies Packs explicitly declare libraries required by the code they generate. Use compact name-to-version mappings: ```yaml dependencies: runtime: typeorm: ^0.3 reflect-metadata: ^0.2 dev: some-build-tool: ^1 ``` Rules: - every mapping entry is exactly one dependency `name` and `version`; - `runtime` and `dev` are separate sets; - version syntax is opaque to the Engine; - Dryv does not implement npm/pub/pip/other version semantics; - requirements are aggregated per generated unit; - the same name and same version deduplicates; - the same name with different declared versions is a planning conflict until an explicit future resolution model is designed; - diagnostics and plans must show which pack contributed each requirement. Dependencies are not renderer plugins, capability needs or executable tools. ```text plugins -> Dryv/template processing dependencies needs/provides -> generated capability relationships dependencies -> libraries imported/required by generated code actions/commands-> external generation work and exact argv implementations ``` ## 10. Project versus package dependency application Editable project units follow the safer project behavior: ```text pack dependencies -> unit dependency requirements -> explicit installer command -> selected package manager/runtime tool -> tool updates the user-owned manifest and lockfile ``` Dryv does not directly rewrite a scaffold/handwritten `package.json`, `pubspec.yaml`, `pyproject.toml` or equivalent simply to add dependencies. Generated package units may use their merged unit dependencies while rendering their managed package manifest, because that manifest remains Dryv-owned. A normal sync command may then restore/install from that manifest. Therefore: ```text project unit: install requirements through an explicit command package unit: render requirements into managed manifest then run normal dependency sync if desired ``` The client still owns command execution and project configuration may override or disable it. ## 11. Actions live in the pack and appear last in normal pack documents A pack declares actions directly in `dryv.pack.yaml`. ```yaml actions: format: stage: files ... install: stage: final ... typecheck: stage: final ... ``` Rules: - each action declares `stage: files` or `stage: final` (the earlier `files:`/`final:` grouping is replaced by this flat registry; see actions); - the action ID is the mapping key; - mapping order is significant and is the pack's requested sequence among actions of the same stage; - do not repeat an `id:` field on the action; - stage is not duplicated inside command candidates; - normal pack examples place `actions` last because actions are operational consequences of the pack definition. `files` acts on staged generated files before compare/write. `final` acts after workspace write. ## 12. Common action IDs are stable vocabulary, not hidden command recipes Dryv may define human-facing metadata for common action IDs such as: ```text format install typecheck analyze test build ``` `install-dev` is not a separate action. `dev` is a dependency scope handled by the logical `install` action. Dryv knowing an action ID never means Dryv knows how to execute it. There is no built-in npm/pnpm/bun/Dart recipe. Custom action IDs are allowed. A custom action should provide `name` and/or `description` when its purpose is not obvious. ## 13. Action entries must carry useful information Avoid meaningless empty declarations. If a pack omits both `name` and `description`, the action must still carry useful behavior or requirements, such as `extensions`, `dependencies`, `after`, or a non-empty `commands` list. An action may contain: - `name` — optional human title; - `description` — optional explanation; - `extensions` — optional `files`-stage filtering; - `dependencies` — optional dependency argument rule; - `after` — optional same-stage ordering dependency; - `commands` — optional candidate implementations. A pack may intentionally leave execution to the project when it provides enough metadata to explain the custom requirement. ## 14. Commands are explicit argv patterns inside the action There is no separate `dryv.cmd.yaml`. A normal command is exact argv: ```yaml commands: - run: [npm, install] ``` Repeated candidates with the same argv shape may use grouped alternatives: ```yaml commands: - run: [(pnpm|bun|yarn), add] - run: [npm, install] ``` The grouped run is explicit shorthand for: ```text [pnpm, add] [bun, add] [yarn, add] [npm, install] ``` When several argv positions contain grouped alternatives, they are zipped by position, never Cartesian-expanded: ```yaml - run: [(a|b|c), (x|y|z), common] ``` means: ```text [a, x, common] [b, y, common] [c, z, common] ``` All grouped positions in one `run` must have the same arity. Grouped syntax is recognized only when the whole argv item has the form `(a|b|c)`. Other argv strings remain literal. A command with a different argv shape gets its own `run`. Grouped syntax only removes repetition. The Engine expands it to ordinary explicit candidates before selection, planning and tracing. Commands are argv data, never shell strings. ## 15. Candidate IDs are optional After grouped-run expansion, the candidate key is: ```text candidate.id when present otherwise expanded run[0] ``` Therefore: ```yaml commands: - run: [(pnpm|bun|yarn), add] - run: [npm, install] ``` provides the candidate keys `pnpm`, `bun`, `yarn` and `npm`. Explicit IDs remain useful for an individual command when `run[0]` is not a useful stable key: ```yaml commands: - id: prettier run: [pnpm, exec, prettier, --write, $(files)] ``` A grouped run normally derives its keys from its expanded first token. Do not hide several alternatives behind one explicit ID. ## 16. The project owns knowledge of its real environment The pack knows what generation needs. The project/user knows what tooling the project actually uses. A pack may expose explicit pnpm/npm/bun/yarn candidates, while `dryv.yaml` selects the destination's real choice. Dryv must not silently choose based on PATH, lockfiles or installed tools. For a one-candidate action, that candidate is used. For a multi-candidate action, the compatible `choose` group's first option is the authored default unless destination usage selects another option. Candidate declaration order does not need to repeat the choice-group option order. ## 17. Dependency requirements remain separate from dependency argv Packs declare generated-code requirements as structured data: ```yaml dependencies: runtime: typeorm: ^0.3 reflect-metadata: ^0.2 dev: prettier: ^3 typescript: ^5.8 ``` `runtime` and `dev` are dependency scopes. An action describes how scopes become argv with an ordered `dependencies.args` list: ```yaml install: dependencies: args: - dev: { (pnpm|yarn): [-D], bun: [--dev], npm: [--save-dev] } - $(name)@$(version) commands: - run: [(pnpm|bun|yarn), add] - run: [npm, install] ``` A plain args item applies to every dependency scope. A scoped item such as `dev:` applies only while processing that scope. The list order is exact argv order. Dryv does not interpret `@`, `:`, `-D`, `--dev` or package-manager semantics. The pack states those differences explicitly. ## 18. Dependency scope args are ordered and candidate-aware For every non-empty dependency scope, Dryv processes `dependencies.args` in authored order. Rules: - a plain item such as `$(name)@$(version)` applies to every scope; - `runtime:` applies only to runtime dependencies; - `dev:` applies only to dev dependencies; - missing scope configuration means no scope-specific extra argv; - there is no need for `runtime: {}`; - inside a scoped mapping, keys are selected command candidate keys; - a grouped key such as `(pnpm|yarn)` applies the same argv to both keys. Example: ```yaml dependencies: args: - dev: { (pnpm|yarn): [-D], bun: [--dev], npm: [--save-dev] } - $(name)@$(version) ``` For pnpm, runtime emits only dependency items while dev emits `-D` before the dependency items. The action-local dependency model does not duplicate the top-level dependency requirements; it only defines their argv placement. ## 19. Managed package manifests do not need dependency argv expansion A generated package may render merged dependencies into its Dryv-managed package manifest. Its install/sync action can therefore be: ```yaml install: commands: - run: [(dart|flutter), pub, get] ``` No `dependencies.args` expansion is needed. For an editable/user-owned manifest, `install` may consume merged dependency scopes and let the selected project tool update the manifest and lockfile. ## 20. Same action IDs are batching points Within one generated unit, compatible requests for the same action ID represent one logical action. Examples: ```text TypeORM -> install class-validator -> install NestJS -> install ``` can resolve to one logical `install` action over the unit's merged runtime/dev scopes. One logical action may produce multiple exact process invocations. For example, `install` can produce one runtime invocation and one dev invocation. Likewise compatible `format` or `typecheck` requests can resolve once per unit. Different command definitions or contradictory ordering must not be silently combined. ## 21. Engine plans; Client executes The Engine may: - expand grouped command patterns into explicit candidates; - merge dependencies by scope; - merge/batch compatible logical actions; - apply destination choices and action overrides; - expand `$(files)` and ordered dependency args; - produce one or more exact argv invocations per logical action; - explain authored pattern, expanded candidate, scope and origin. The Engine never starts host processes. The Client owns executable availability checks, approval/policy, process execution and workspace I/O. No command executes merely because its action ID is familiar. ## 22. Choice groups coordinate related command choices A pack may declare reusable tool choices separately from actions: ```yaml choose: js.package_manager: { options: [pnpm, npm, bun, yarn] } ``` The first option is the pack default. Grouped command patterns expand first. Candidate keys are then derived from each expanded candidate. ```yaml commands: - run: [(pnpm|bun|yarn), add] - run: [npm, install] ``` therefore supports the four explicit candidate keys required by the choice group. A one-candidate action needs no choice group. Choice groups are selection vocabulary only. They contain no hidden command recipes. ## 23. Destination/unit owns project command choices Project environment configuration belongs to the code destination because every contributing pack executes in the same generated unit. ```yaml destinations: backend: path: apps/backend choose: { js.package_manager: pnpm } actions: files: format: commands: - run: [pnpm, exec, biome, format, --write, $(files)] final: typecheck: { disable: true } ``` Different destinations may choose different environments. Do not put one global package-manager choice over unrelated destinations. ## 24. Usage action overrides inherit action semantics A destination action override changes only the fields it supplies. If the merged pack action has: ```yaml format: extensions: [.ts] commands: - run: [(pnpm|yarn), exec, prettier, --write, $(files)] ``` and usage changes only `commands`, the `extensions` filter remains inherited. The same field-level inheritance principle applies to `dependencies`, `name`, `description` and ordering metadata where the Usage contract allows replacement. A project command replacement normally supplies one exact command because the destination already knows its environment. ## 25. Extensions are action semantics `extensions` belongs to a `files` action, never to an individual command candidate. ```yaml format: extensions: [.ts, .tsx] commands: - run: [pnpm, exec, prettier, --write, $(files)] ``` When same-ID file actions from several packs batch, each pack's generated files are first filtered by that pack's declared extensions. The resulting file sets are then unioned, sorted and supplied to the merged action. This prevents one pack's broader extension set from changing which files another pack intended its action to receive. If destination usage explicitly overrides `extensions`, the override becomes the filter for the resolved project action. An empty resolved `$(files)` list skips the command. ## 26. Action ordering may cross pack boundaries Mapping order remains the normal sequence inside one pack. When an action has a real dependency on another same-stage action, use: ```yaml build-runner: after: [install] ``` `after` may refer to a same-stage action contributed by another pack in the same generated unit. Unknown `after` targets are planning errors. They are not silently ignored. Cycles are planning errors. ## 27. Commands may be intentionally omitted `commands` is optional. A pack may know that an action is required without knowing a safe project-specific implementation: ```yaml install: dependencies: args: - $(name)@$(version) ``` or: ```yaml company-setup: name: Configure generated client description: Register generated client artifacts using project tooling. ``` Such an action remains unresolved until destination configuration supplies an implementation. Do not force a pack to invent environment knowledge merely to satisfy schema validation. ## 28. Choice groups merge per generated unit Choice groups are unit-scoped planning data even though packs declare them independently. When several packs contributing to one destination declare the same group: - option sets are merged deterministically; - a destination-level `choose` value is authoritative; - grouped command patterns expand before support is checked; - every multi-candidate action bound to the group must support the selected option after expansion; - if packs disagree on the first/default option and usage does not select one explicitly, planning reports a choice conflict. Expanded candidate keys must be unique within one action. ## 29. Destination action configuration is constrained Destination usage may configure only actions contributed to that generated unit. ```yaml destinations: backend: actions: final: typecheck: { disable: true } ``` Unknown action IDs are configuration errors, not silent no-ops. A disabled action does not execute but remains visible in the plan with its contributing packs and disabling usage location. A project command replacement should normally provide one exact command implementation because the destination already knows its environment. Pack alternatives belong in pack `commands` plus `choose`. ## 30. Action execution context is unit-scoped Every final-stage command executes with the generated unit root as its working directory. Files-stage commands operate on staged files for that same unit. The staging location must remain inside or otherwise preserve unit-relative tool configuration lookup so tools such as formatters can find project configuration deterministically. The Engine plans working-directory intent but never touches the host filesystem or starts the process. ## 31. Empty expansions skip only what is empty An empty resolved `$(files)` list produces no files-action invocation. For an action using `dependencies.args`, each non-empty dependency scope produces its own invocation. An empty scope produces no invocation for that scope. If every dependency scope is empty, a dependency-consuming install action produces no dependency invocation. An action with commands but no dependency expansion follows its normal command semantics, such as a managed-package `dart pub get`. ## 32. Pack design requires a dryv.yaml Usage change The generated-unit/action design cannot remain clean with the old usage shape. This workspace therefore proposes a coordinated `dryv/v1alpha1` change. The new structural Usage vocabulary is: ```yaml sources: authoring: ... packs: ... destinations: ir: ... code: ... authoring: source: { $ref: "#/sources/authoring/..." } packs: ... ``` This is a **Usage-tier change**, not a pack semantic field and not Runtime IR. Pack activations reference shared pack sources and typed code destinations instead of repeating repository configuration. Code-destination `choose` and `actions` hold the unit environment policy established by this pack design. The complete proposal is recorded in [10-dryv-yaml-usage-update.md](/pack-builders/design/project-configuration). ## 33. Usage reference branches are typed The proposed Usage refs are constrained by role: ```text authoring.source -> #/sources/authoring/ authoring.destination -> #/destinations/ir/ packs.*.source -> #/sources/packs/ packs.*.destination -> #/destinations/<code destination> packs.*.destinations.* -> #/destinations/<code destination> packs.*.bind.* -> #/packs/ ``` Wrong-branch references fail validation. Dryv does not infer intended branches. ## 34. dryv.lock is a Usage reproducibility companion The Usage redesign introduces a generated `dryv.lock` concept for exact resolution of human-friendly source refs. Its role is to pin facts such as: - Git commits; - local source digests; - resolved authoring implementation versions/digests; - pack content digests. The lock does not define software meaning and does not become Runtime IR. Exact hashing/update behavior remains implementation design. ## 35. Compact YAML is preferred when it removes repetition Small declarative objects should use flow style when that makes a pack easier to scan: ```yaml plugins: - { name: handlebars, extensions: [.hbs] } inputs: package_name: { type: string, required: true } needs: schema.validation: required schema.persistence: required choose: js.package_manager: { options: [pnpm, npm, bun, yarn] } ``` This is a style convention, not different semantics. Expand YAML when the compressed form would make structure harder to understand. --- <!-- Source: https://docs.dryvcode.com/pack-builders/design/packs-reference --> # Packs reference A pack selects IR subjects, discovers templates from its filesystem, and declares generated identity: names, paths, symbols, imports and exports. Working examples: `sdk/_examples/packs/fastapi-backend`, `sdk/_examples/packs/nestjs`, `sdk/_examples/packs/dart-client-sdk`. Editor validation: ```yaml # yaml-language-server: $schema=../../../schemas/dryv.pack.schema.json ``` ## Document ```yaml version: dryv.pack/v1alpha1 key: examples.fastapi-backend # [A-Za-z0-9][A-Za-z0-9._-]* source: templates # template root: a directory, or "." info: title: FastAPI Backend version: 0.1.0 description: … purpose: backend # optional discovery metadata summary: FastAPI routes and models. languages: [python] frameworks: [fastapi] tags: [api] plugins: # renderer providers only - name: jinja version: ^1.0 # optional extensions: [.j2] # optional; defaults to what the provider advertises inputs: {} # typed project configuration selections: {} # what drives generation templates: {} # what gets generated ``` `info` also feeds pack discovery, such as the catalogue the `dryvcode/packs` repository publishes. It may hold `purpose`, `summary`, `languages`, `frameworks` and `tags`, all lowercase words except `summary`. The Engine validates the manifest itself; no selection, binding, context or rendering depends on a separate catalogue block. External tools such as formatters, package managers and runtimes are **not** renderer/plugin requirements. Pack and project dependency/action behavior is defined by generation actions. ## Inputs ```yaml inputs: package_name: { type: string, required: true, description: Package name } emit_validation: { type: boolean, default: true } tags: { type: "string[]", default: [] } ``` The types are `string`, `number`, `boolean`, `string[]`, `number[]` and `boolean[]`. A project sets values in `dryv.yaml` under `packs.<name>.inputs`. Unknown keys, type mismatches and missing required values fail before planning. Templates read only `pack.inputs.<key>`. Dryv-owned YAML keys and pack input names use `snake_case`. User-authored template, selection and destination keys should preferably be one word, or kebab-case when two words are needed, such as `entity-index`. This recommendation improves readability but is not enforced; Dryv preserves those identifiers. ## Selections ```yaml selections: publicCreates: subject: operation filter: all: { tags: [public] } any: { role: [create, update] } not: { tags: [deprecated] } scope: each ``` **Subjects:** `property.{primitive,enum,composite,literal,union,record,tuple,generic,temporal}`, `schema`, `expression`, `policy`, `failure`, `event`, `operation`, `view`, `view.part`, `workflow`, `surface`. `application`, `group` and `feature` are not subjects; they're bounded metadata. **Filters** decide membership only (decision 0006). `all` means every predicate matches, `any` means at least one does, `not` means none do. `role`, `facet` and `kind` take a single value or a list. `tags` is a non-empty list. | Classifier | Contract allows | Implemented today | | ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------- | | `tags` | all subjects | yes | | `role` | `schema`: entity, value, request, response, command, query, filter, event, view-model, config. `operation`: create, update, delete, detail, list, search, validate, transform, action. `view`: list, detail, form, dashboard, wizard, search. `policy`: authentication, authorization, ownership, rate, feature-flag. `event`: domain, integration, notification. `workflow`: saga, process, approval, scheduled | yes | | `facet` | `schema`: storage. `operation`: http, websocket, schedule | All listed facets | | `kind` | `surface`: web, mobile, desktop, cli, embedded | yes | An unsupported classifier fails planning with `planner.selection.classifier_unavailable`. It never silently matches nothing. Filters never support IDs, include/exclude, IR paths, names, counts, comparisons or structural inspection. **Scopes** decide how matches become invocations: | Scope | Invocations | With 0 matches | | ------------------ | -------------------------- | --------------------- | | `each` | one per subject | 0 | | `all` | one, holding every subject | 1, with an empty list | | `collects.feature` | one per owning feature | 0 | | `collects.group` | one per owning group | 0 | ## Templates The kind of template is inferred from its shape. There's no `mode` field. ```yaml templates: model: # selection-driven: top-level $ref → #/selections/* $ref: "#/selections/models" output: name: $(subject.name.snake) path: [$(feature.name.kebab)] symbol: $(subject.name.pascal) # primary symbol symbols: { model: …, identifier: … } # optional named symbols imports: - $ref: "#/templates/enum" # producers that may satisfy references package: {} # global: no $ref and no exports models-index: # export/barrel: has exports barrel: all # default; or `each` exports: - $ref: "#/templates/enum" - $ref: "#/templates/model" ``` - A top-level `$ref` and `exports` can't appear together. `output.symbol` names the primary symbol and `output.symbols` names additional keyed symbols; a template may declare both. A template that `provides` a slot must declare `output.symbol`. - **Interpolation** is finite: `$(subject|feature|group.name.<variant>)`, where the variant is one of `raw`, `local`, `qualified`, `camel`, `pascal`, `snake`, `kebab`, `constant`, `title`. A root must be structurally available for the scope. For example, `feature` doesn't exist under `scope: all`. - `output.destination` names an output slot. Usage maps it with `packs.<key>.destinations.<slot>`; templates without one write to the activation's `destination`. A slot no template declares (`usage.pack.destinations.unknown`) or a declared slot left unmapped (`usage.pack.destinations.missing`) fails planning. Actions run on each file in the destination it is written to; the pack's dependencies install in its default destination. - `output.name` must be dynamic; a static value only warns. Filenames use it through `$(name)`. `output.path` holds dynamic directory segments, one segment per item. `output.symbol(s)` can be static or dynamic, and must be declared, because rendered code is never parsed. - `imports` lists _eligible producers_. A dependency is created only when a consumer subject references a subject that the producer represents. An aggregate adds `members: true` to also depend on the producer files that represent its own subjects, for example a group module importing its feature modules: `imports: [{ $ref: '#/templates/feature', members: true }]`. `members` is rejected on `exports`. `transitive: true` (on template or `#/needs/<slot>` imports) links every subject the consumer's references reach, following schemas and projection sources, for example a use case reaching the entity behind its response's read projection; a transitive slot import links what the bound pack represents and does not require it to cover every reached subject. - `exports` consumes already-planned producer artifacts. `barrel: all` produces one aggregate. `barrel: each` keeps the producers' existing partitions and never creates a new grouping. ## Ownership: managed and scaffold Ownership is decided per resource by the template filename, not in `dryv.pack.yaml`. A terminal `.sf` control suffix, after the renderer suffix is removed, marks the file as a scaffold; everything else is managed: ```text templates/src/{usecase}/$(name).usecase.ts.sf.hbs -> scaffold src/<feature>/<name>.usecase.ts templates/src/{entity}/$(name).entity.ts.hbs -> managed src/<feature>/<name>.entity.ts templates/README.md.sf -> scaffold README.md ``` One selection or template can therefore produce both managed and scaffold files. A template-level `ownership:` key is rejected. | Ownership | Behaviour | | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `managed` (default) | Dryv owns the file and rewrites it on every generate. | | `scaffold` | The client writes the file only when it's missing. Once it exists, it belongs to the project: Dryv never edits or deletes it, and the client reports it as `SKIP … scaffold already exists; owned by the project`. | Planned and generated artifacts carry `ownership`, so the client decides with the file on disk as the only state. Because there's no record of which files Dryv once scaffolded, orphaned scaffolds (whose meaning was removed) aren't reported yet; that waits on lock state. ## Commands A pack can declare actions around generation, such as formatting. A code destination can override or disable them. See actions. ## Composition: `provides`, `needs` and `bind` Packs compose through capability **slots** (decision 0014). A pack that produces something other packs import declares `provides`. A pack that imports it declares `needs`. The project decides who fills each need. | Slot | Covers | A provider exports | | -------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- | | `schema.types` | `schema` | one type symbol per schema | | `schema.entity.types` | `schema` | externally owned stored-entity type; lets a general type pack import entity declarations without providing the same entity twice | | `schema.validation` | `schema` | one validating symbol per schema (class, zod schema, joi schema) | | `schema.persistence` | `schema` | one entity symbol per persisted schema | | `schema.examples` | `schema` | one valid example (and its field spec) per schema, for generated tests | | `property.enum.types` | `property.enum` | one symbol per enum | | `property.types` | `property.primitive`, `property.composite`, `property.literal`, `property.union`, `property.record`, `property.tuple`, `property.generic`, `property.temporal` | one type symbol per property, from one template per kind | | `operation.client` | `operation` | one callable per operation | | `operation.server` | `operation` | one server-side entrypoint per operation | | `operation.implementation` | `operation` | one handwritten implementation per operation (for example a feature `ServiceImpl` covering its operations) | | `operation.usecase` | `operation` | one use case per operation | ```yaml # class-validator/dryv.pack.yaml provides: schema.validation: $ref: "#/templates/dto" # a selection template over schemas, with output.symbol # nestjs/dryv.pack.yaml needs: schema.validation: required templates: controller: $ref: "#/selections/controllers" imports: - $ref: "#/needs/schema.validation" # project dryv.yaml packs: dtos: { source: … } server: source: … bind: schema.validation: { $ref: "#/packs/dtos" } ``` Rules: - The slot list is closed. A providing template must be a selection template whose subject the slot covers, and it must declare `output.symbol`. A slot that covers one subject takes one `$ref`; `property.types` takes a list with at most one template per property kind: ```yaml provides: property.enum.types: { $ref: "#/templates/enum" } property.types: - $ref: "#/templates/union" - $ref: "#/templates/generic" ``` A pack can't both provide and need the same slot. - Imports may reference `#/needs/<slot>` only for slots the pack declares under `needs`. - The project lists every pack; nothing is activated implicitly. Each consumer binds its own providers, so one project can bind zod for one pack and class-validator for another. - A provider covers whatever its selection matches. - Barrels never export another pack's files. - Planning diagnostics: `usage.bind.missing` (required need not bound), `usage.bind.unknown_pack`, `usage.bind.slot_not_provided`, `usage.bind.unexpected` (bound a slot the pack doesn't need), `usage.bind.self`, `planner.bind.cycle`. Providers are planned before their consumers. Resolution: the planner plans providers before consumers. A consumer's `#/needs/<slot>` import resolves each referenced subject of the slot's kind to the bound provider's file and symbol, and appears in `file.dependencies[]` with `pack` and `slot`. If a referenced subject isn't generated by the provider (or by a same-pack import), planning fails with `planner.bind.uncovered_subject`. An optional need the project leaves unbound contributes nothing. The public plan lists cross-pack dependencies with their `pack` and `slot`. ## Rendering invariants Templates can't recurse, so they render `schema.invariants[].form`, never the raw expression tree: | Form | Example rule | TypeORM | class-validator / zod / joi | | --------------------------------- | ----------------------------- | ----------------------------------------------- | ------------------------------------------------------------ | | `comparison`, field vs literal | `quantity > 0` | `@Check("quantity > 0")` | field-level check, e.g. `z.number().gt(0)` via refine | | `comparison`, field vs field | `confirmPassword == password` | `@Check(...)` | cross-field rule (`Match`, `superRefine`, `Joi.ref`) | | `comparison`, field vs arithmetic | `total == unit * quantity` | `@Check("total_price = unit_price * quantity")` | cross-field rule computing the terms | | `all` / `any` | `a > 0 and b > 0` | one check joined with `AND` / `OR` | one rule per comparison (`all`) or one combined rule (`any`) | | `opaque` | anything else | skip, with a comment naming the invariant | a custom validator, or skip and document it | Field names come from `field.snake`, `field.camel` and the other name variants, so each target applies its own naming. Use the invariant `name` for constraint names and `message` for errors. ## Developing and testing a pack The CLI can treat a pack directory as a standalone Dryv artifact: ```text dryv pack init . dryv pack inspect . dryv pack validate . dryv pack doctor . dryv pack test . ``` `pack validate` loads `dryv.pack.yaml`, discovers the actual pack filesystem and then uses the Engine-owned `complete` Runtime IR scenario. Manifest references, markers, selections, slots, interpolation, planning collisions, renderer analysis and typed context requests are checked through the ordinary Engine contracts. A normal reusable pack does not need to maintain its own `dryv.ir.yaml`. `pack doctor` adds machine/runtime readiness checks: connected Template Servers, declared renderer versions and explicitly declared action executables. `pack test` runs the normal generation lifecycle and writes only to an isolated temporary workspace under the system temporary directory (`/tmp/dryv/...` on typical Linux systems). Engine-resolved file actions run against staged generated files, artifacts are then applied to that temporary workspace, and final actions run from the generated destination. `--no-actions` keeps the lifecycle render-only. The official catalogue remains a separate concern. Its validation command is: ```text dryv pack catalog validate ``` The standalone developer harness uses Dryv's Engine-owned canonical scenario and synthetic activation/bindings. It is intentionally independent of normal project authoring/build/server configuration; project workflows reuse the same Engine contracts separately. `pack inspect` also reports the Engine-discovered resource map: source/output paths, template key, renderer mode, ownership, byte length and ignored resources. Filesystem diagnostics include structured source locations when an offending resource is known. See developer artifact workflows. ## Template filesystem ```text templates/ ├── README.md # global static file, copied as-is └── src/ └── {model}/ # binds this subtree to templates.model └── $(name).py.j2 # rendered by Jinja → <name>.py ``` - A `{key}` directory marks a registry boundary. It disappears from the output. Each key has exactly one marker, and markers can't nest. - The last registered extension picks the renderer (`.j2` → Jinja, `.hbs` → Handlebars), and that suffix is stripped from the output name. Any other file is copied byte-for-byte, once per invocation of its template. - Dynamic directories go in `output.path`, never in physical directory names. - `.dryvignore` uses gitignore syntax. Default ignores cover `.git`, `node_modules`, `.venv`, `dist`, `build`, `.env` and similar. `dryv.pack.yaml`, `dryv.yaml`, `dryv.lock.yaml` and `.dryvignore` are never emitted. ## Validation split The JSON Schema checks shapes, reference _kinds_, enums, interpolation syntax and path segments. The Engine checks everything that needs the whole pack: that references exist, that roots are available per scope, that markers are unique, extension conflicts, barrel compatibility, import ambiguity and path collisions. ## Relationship to the old template generator An older, separate template generator was used as a usability benchmark only. Dryv makes no compatibility promise for its `paths.yaml`, selectors, template variables or `meta`/`lang`/`emit` model. --- <!-- Source: https://docs.dryvcode.com/pack-builders/design/implemented-contract --> # Implemented contract The approved design record preserves the locked decisions and examples. This page describes the implemented contract only; generated-unit composition and `dryv.lock` remain incomplete. Pack manifests use `plugins`, scalar `layout` (`inject`, `package`, or `project`), optional package and unit metadata, and typed generated-code dependencies. Scaffold resources use the `.sf` suffix immediately before the renderer suffix, for example `settings.json.sf.j2`. Usage destinations are grouped by `ir` and `code`; code destinations select reusable project actions from a top-level `actions` tree. Actions are typed Engine data and are executed by clients. A `dryv.lock` implementation is still pending; the existing `dryv.lock.yaml` bootstrap support is not a complete reproducibility lock. The Runtime IR remains the only semantic authority and all contracts remain in the `v1alpha1` family. --- <!-- Source: https://docs.dryvcode.com/pack-builders/context/overview --> # Context overview This directory documents the renderer-facing context that pack templates can request. Use this folder in this order: | Need | File | | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------- | | Find a concrete template path such as `schema.fields[].name.snake` | [catalog.md](/pack-builders/context/catalog) | | Understand derived helper facts such as `is`, `has_*`, `*_json`, path segments and generated representations | [derived.md](/pack-builders/context/derived) | | Understand a selectable semantic subject such as `schema` or `operation` | the subject files below | | Understand reusable nested contracts such as `NameContext` | [shared/](/pack-builders/context/shared-overview) | Context discovery through `dryv context list|show` is documented in [derived.md](/pack-builders/context/derived). ## Subjects | Subject | File | | -------------------- | ------------------------------------------------------------------ | | `property.primitive` | [property.primitive.md](/pack-builders/context/property-primitive) | | `property.enum` | [property.enum.md](/pack-builders/context/property-enum) | | `property.composite` | [property.composite.md](/pack-builders/context/property-composite) | | `property.literal` | [property.literal.md](/pack-builders/context/property-literal) | | `property.union` | [property.union.md](/pack-builders/context/property-union) | | `property.record` | [property.record.md](/pack-builders/context/property-record) | | `property.tuple` | [property.tuple.md](/pack-builders/context/property-tuple) | | `property.generic` | [property.generic.md](/pack-builders/context/property-generic) | | `property.temporal` | [property.temporal.md](/pack-builders/context/property-temporal) | | `schema` | [schema.md](/pack-builders/context/schema) | | `expression` | [expression.md](/pack-builders/context/expression) | | `policy` | [policy.md](/pack-builders/context/policy) | | `failure` | [failure.md](/pack-builders/context/failure) | | `event` | [event.md](/pack-builders/context/event) | | `operation` | [operation.md](/pack-builders/context/operation) | | `view` | [view.md](/pack-builders/context/view) | | `view.part` | [view.part.md](/pack-builders/context/view-part) | | `workflow` | [workflow.md](/pack-builders/context/workflow) | | `surface` | [surface.md](/pack-builders/context/surface) | ## Pack configuration metadata | Context | File | Availability | | ------- | ----------------------------------------------- | --------------------------------------------------------------------- | | `pack` | [metadata/pack.md](/pack-builders/context/pack) | Bounded values declared by the active pack's typed `inputs` contract. | ## Generation metadata context `file` is separate from semantic/structural metadata. | Context | File | Availability | | ------- | ----------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | `file` | [metadata/file.md](/pack-builders/context/file) | One concrete rendered `PlannedFileArtifact`; carries planned symbols, paths, generated dependencies, exports, and renderer-useful artifact metadata. | A symbol-bearing template should use `file.symbol` or `file.symbols.<key>` for the exported declaration name. Semantic names remain semantic identity and must not be recomposed to guess the generated symbol. ## Structural metadata contexts These are **not selectable subjects**. | Context | File | Availability | | ------------- | ------------------------------------------------------------- | ------------------------------------------------------------------------------------------ | | `application` | [metadata/application.md](/pack-builders/context/application) | Global bounded metadata for every invocation. | | `group` | [metadata/group.md](/pack-builders/context/group) | Collector metadata for `collects.group`; also owner metadata alongside `collects.feature`. | | `feature` | [metadata/feature.md](/pack-builders/context/feature) | Collector metadata for `collects.feature`. | They deliberately omit declaration-membership arrays such as all schemas, operations, features, groups, or views. ## Core rule ```text generation metadata + global metadata + selected subject + scope → renderer context ``` Every rendered concrete file may request: ```text file: FileContext application: ApplicationContext ``` `file` is defined in [metadata/file.md](/pack-builders/context/file) and is derived from artifact planning planning, not Runtime IR. Every invocation may additionally request: The application root is deliberately bounded metadata, not an aggregate semantic graph. Filters only change membership. They never change the item context contract. Examples: ```text schema + each → schema: SchemaContext schema + all → schemas: SchemaContext[] property.enum + each → property.enum: EnumPropertyContext property.enum + all → properties.enums: EnumPropertyContext[] view.part + each → view.part: ViewPartContext view.part + all → views.parts: ViewPartContext[] ``` ## Context composition rule Each context contract has exactly one authoritative definition. A subject file documents only: - the context fields unique to that subject; - relationships to shared contexts; - relationships to another subject's full context; - any local constraints on how that borrowed context is used. Do **not** copy an existing context tree into another subject file. Use references such as: ```text NameContext → shared/name.md SemanticLinkContext → shared/semantic-link.md SemanticValueContext → shared/semantic-value.md ExplanationContext → shared/explanation.md LifecycleContext → shared/lifecycle.md SemanticPathContext → shared/semantic-path.md schema.fields[].value.property.primitive → full PrimitivePropertyContext from property.primitive.md schema.fields[].value.property.enum → full EnumPropertyContext from property.enum.md schema.fields[].value.schema → full SchemaContext from schema.md ``` "Full context" means the exact same typed contract. It does **not** mean Dryv eagerly materializes the entire subtree. Template analysis and context resolution still request/materialize only paths actually used by the template. This rule is important because one semantic concept must not slowly acquire several almost-identical template contracts. ## Proposed template-normalization rules ### Absence When a requested semantic value is absent: - optional scalar/object → `null`; - collection → `[]`. Template analysis and context resolution still control whether a path is materialized at all. ### Named maps become arrays Canonical IR may store dictionaries for efficient lookup, but template context should expose named members as deterministic arrays: ```text IR map key → item.name + deterministic array entry ``` This avoids renderer-specific map-key tricks such as Handlebars `@key` and makes the same context usable from Jinja, Liquid, Mustache, etc. ### Raw JSON pointers are not the template API Templates should not parse: ```text #/schemas/users.User #/operations/users.CreateUser ``` References resolve to bounded semantic links. ## Shared contexts Shared nested contracts live in [shared/](/pack-builders/context/shared-overview). They are not selectable roots, but they appear inside many subject and metadata contexts. Every first-class semantic subject context exposes `id: string`. `id` is semantic identity and is deliberately separate from [NameContext](/pack-builders/context/shared-name). ### TypeContext `TypeContext` remains the renderer-neutral recursive type-expression contract used where Dryv meaning is itself a type expression, for example union members, record keys/values, tuple items, and generic bodies/arguments. Schema/composite fields do **not** use an ambiguous generic `TypeContext` for their primary value. They use [SemanticValueContext](/pack-builders/context/shared-semantic-value), because a field specifically distinguishes: ```text property schema unknown dynamic ``` This preserves the canonical difference between "field uses another schema" and "field uses a reusable property with its complete constraints/meaning." Target-language spellings never belong in either contract. ### ValuePortContext | Path | Type | Meaning | | ------- | --------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | | `index` | `integer` | Stable order/binding index. | | `name` | [`NameContext`](/pack-builders/context/shared-name) | Semantic parameter/result name. | | `value` | `SemanticValueContext` | Full reusable semantic value carried by the port; see [shared/semantic-value.md](/pack-builders/context/shared-semantic-value). | Ports carry an optional canonical `name`; unnamed ports project as `input_0`, `output_0` (decision 0012). ## First-class metadata consistency The pack contract allows `tags` on every selectable subject. Therefore every selectable subject context should consistently expose `id`, `name`, `description`, `tags`, and `explanations` where meaningful. Owned semantic items expose at most one canonical `feature: SemanticLinkContext|null`. Cross-feature usage is represented through normal semantic references, not `features[]`. Every selectable subject inherits `SemanticMetadata` (decision 0012). ## Audit standard For every subject file ask: 1. Can a real pack generate useful code without parsing raw refs or map keys? 2. Is the context renderer-neutral? 3. Are relationships resolved but bounded? 4. Are target-language details kept out of semantic context? 5. Does the example prove the context is actually usable? 6. What Runtime IR changes does this imply? 7. Does any nested unit independently cause artifacts and deserve a subject? ## Collector metadata rule Structural scope metadata never carries full membership trees. For `collects.group`: ```text application: ApplicationContext group: GroupContext schemas: SchemaContext[] ``` For `collects.feature`: ```text application: ApplicationContext group: GroupContext feature: FeatureContext operations: OperationContext[] ``` A selected item may still contain bounded owner links such as `schema.group` or `schema.feature`, but those links do not recursively expand into the metadata roots. For `each` and `all`, Dryv does not invent a singular `group` or `feature` root from collection contents. Scope controls those roots explicitly. --- <!-- Source: https://docs.dryvcode.com/pack-builders/context/catalog --> # Context catalog This is the pack-author index for renderer-facing context paths. It is intentionally organized by root and nested collection. The subject files remain the authoritative contract pages; this page helps a template author find the right path quickly. ## Always Available Metadata | Path | Type | Contract | | -------------------------- | -------------------------------------------------------------------------- | ------------------------------------------------------------- | | `application` | `ApplicationContext` | [metadata/application.md](/pack-builders/context/application) | | `application.name` | [`NameContext`](/pack-builders/context/shared-name) | Active application name. | | `application.description` | `string\|null` | Application description. | | `application.tags` | `string[]` | Application tags. | | `application.explanations` | [`ExplanationContext[]`](shared-explanation.md) | Advisory metadata. | | `application.group` | [`SemanticLinkContext\|null`](/pack-builders/context/shared-semantic-link) | Optional root/owning group link. | | `file` | `FileContext` | [metadata/file.md](/pack-builders/context/file) | | `file.path` | `FilePathContext` | Planned output path metadata. | | `file.symbol` | `string\|null` | Single generated symbol when the template declares one. | | `file.symbols` | `map<string,string>` | Named generated symbols. | | `file.dependencies[]` | `GeneratedArtifactReferenceContext[]` | Planned generated dependencies. | | `file.exports[]` | `GeneratedArtifactReferenceContext[]` | Planned generated exports. | | `pack` | `PackContext` | [metadata/pack.md](/pack-builders/context/pack) | ## Scope Metadata | Path | Type | Contract | | --------------- | -------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | | `group` | `GroupContext` | [metadata/group.md](/pack-builders/context/group), available for group or feature collection scopes. | | `group.name` | [`NameContext`](/pack-builders/context/shared-name) | Group identity and naming variants. | | `group.parent` | [`SemanticLinkContext\|null`](/pack-builders/context/shared-semantic-link) | Parent group link. | | `feature` | `FeatureContext` | [metadata/feature.md](/pack-builders/context/feature), available for feature collection scopes. | | `feature.name` | [`NameContext`](/pack-builders/context/shared-name) | Feature identity and naming variants. | | `feature.group` | [`SemanticLinkContext`](/pack-builders/context/shared-semantic-link) | Owning group link. | ## Selection Roots | Selection | Each root | All root | Contract | | -------------------- | -------------------- | ------------------------- | ------------------------------------------------------------------ | | `schema` | `schema` | `schemas[]` | [schema.md](/pack-builders/context/schema) | | `property.primitive` | `property.primitive` | `properties.primitives[]` | [property.primitive.md](/pack-builders/context/property-primitive) | | `property.enum` | `property.enum` | `properties.enums[]` | [property.enum.md](/pack-builders/context/property-enum) | | `property.composite` | `property.composite` | `properties.composites[]` | [property.composite.md](/pack-builders/context/property-composite) | | `property.literal` | `property.literal` | `properties.literals[]` | [property.literal.md](/pack-builders/context/property-literal) | | `property.union` | `property.union` | `properties.unions[]` | [property.union.md](/pack-builders/context/property-union) | | `property.record` | `property.record` | `properties.records[]` | [property.record.md](/pack-builders/context/property-record) | | `property.tuple` | `property.tuple` | `properties.tuples[]` | [property.tuple.md](/pack-builders/context/property-tuple) | | `property.generic` | `property.generic` | `properties.generics[]` | [property.generic.md](/pack-builders/context/property-generic) | | `property.temporal` | `property.temporal` | `properties.temporals[]` | [property.temporal.md](/pack-builders/context/property-temporal) | | `operation` | `operation` | `operations[]` | [operation.md](/pack-builders/context/operation) | | `event` | `event` | `events[]` | [event.md](/pack-builders/context/event) | | `failure` | `failure` | `failures[]` | [failure.md](/pack-builders/context/failure) | | `policy` | `policy` | `policies[]` | [policy.md](/pack-builders/context/policy) | | `expression` | `expression` | `expressions[]` | [expression.md](/pack-builders/context/expression) | | `workflow` | `workflow` | `workflows[]` | [workflow.md](/pack-builders/context/workflow) | | `view` | `view` | `views[]` | [view.md](/pack-builders/context/view) | | `view.part` | `view.part` | `views.parts[]` | [view.part.md](/pack-builders/context/view-part) | | `surface` | `surface` | `surfaces[]` | [surface.md](/pack-builders/context/surface) | ## Common Subject Fields Most selectable subjects expose these paths: | Path suffix | Type | Contract | | --------------- | -------------------------------------------------------------------------- | ----------------------------------------------- | | `.id` | `string` | Opaque semantic identity. | | `.name` | [`NameContext`](/pack-builders/context/shared-name) | Semantic naming variants. | | `.description` | `string\|null` | Human description. | | `.tags` | `string[]` | Semantic tags. | | `.explanations` | [`ExplanationContext[]`](shared-explanation.md) | Advisory notes. | | `.group` | [`SemanticLinkContext\|null`](/pack-builders/context/shared-semantic-link) | Owning group link. | | `.feature` | [`SemanticLinkContext\|null`](/pack-builders/context/shared-semantic-link) | Canonical owning feature link. | | `.lifecycle` | [`LifecycleContext`](/pack-builders/context/shared-lifecycle) | Deprecation/removal metadata, where applicable. | ## Schema Paths | Path | Type | | --------------------------------- | ---------------------------------------------------------------------- | | `schema.name` | [`NameContext`](/pack-builders/context/shared-name) | | `schema.extends` | `SchemaContext\|null` | | `schema.source` | `SchemaSourceContext\|null` | | `schema.fields[]` | `SchemaFieldContext[]` | | `schema.fields[].name` | [`NameContext`](/pack-builders/context/shared-name) | | `schema.fields[].value` | [`SemanticValueContext`](/pack-builders/context/shared-semantic-value) | | `schema.fields[].optional` | `boolean` | | `schema.fields[].nullable` | `boolean` | | `schema.fields[].array` | `ArrayBoundsContext\|null` | | `schema.fields[].default` | `DefaultValueContext\|null` | | `schema.fields[].mutation` | `create-only\|system\|null` | | `schema.fields[].query` | `FieldQueryContext\|null` | | `schema.fields[].sensitive` | `boolean` | | `schema.fields[].policy.read` | `PolicyContext\|null` | | `schema.fields[].policy.write` | `PolicyContext\|null` | | `schema.fields[].relation` | `RelationContext\|null` | | `schema.fields[].related` | `RelatedContext\|null` | | `schema.fields[].sources[]` | `FieldSourceContext[]` | | `schema.facets.storage` | `SchemaStorageContext\|null` | | `schema.facets.storage.namespace` | `string\|null` | | `schema.invariants[]` | `SchemaInvariantContext[]` | | `schema.invariants[].name` | [`NameContext`](/pack-builders/context/shared-name) | ## Property Paths All property roots use the same family prefix: ```text property.<kind> properties.<plural_kind>[] ``` Each property kind documents its own fields: | Kind | Notable paths | Contract | | --------- | ---------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ | | Primitive | `property.primitive.kind`, `property.primitive.constraints` | [property.primitive.md](/pack-builders/context/property-primitive) | | Enum | `property.enum.values[]`, `property.enum.values[].name`, `property.enum.values[].value` | [property.enum.md](/pack-builders/context/property-enum) | | Composite | `property.composite.fields[]`, `property.composite.fields[].value` | [property.composite.md](/pack-builders/context/property-composite) | | Literal | `property.literal.value`, `property.literal.value_json` | [property.literal.md](/pack-builders/context/property-literal), [derived.md](/pack-builders/context/derived) | | Union | `property.union.discriminant`, `property.union.members[]` | [property.union.md](/pack-builders/context/property-union) | | Record | `property.record.keys`, `property.record.values` | [property.record.md](/pack-builders/context/property-record) | | Tuple | `property.tuple.items[]` | [property.tuple.md](/pack-builders/context/property-tuple) | | Generic | `property.generic.parameters[]`, `property.generic.body`, `property.generic.arguments[]` | [property.generic.md](/pack-builders/context/property-generic) | | Temporal | `property.temporal.kind`, `property.temporal.point`, `property.temporal.constraints` | [property.temporal.md](/pack-builders/context/property-temporal) | ## Operation Paths | Path | Type | | ----------------------------------- | --------------------------------------------------- | | `operation.name` | [`NameContext`](/pack-builders/context/shared-name) | | `operation.input` | `OperationInputContext\|null` | | `operation.output` | `OperationOutputContext\|null` | | `operation.failures[]` | [`SemanticLinkContext[]`](shared-semantic-link.md) | | `operation.emits[]` | [`SemanticLinkContext[]`](shared-semantic-link.md) | | `operation.facets.http` | `HttpFacetContext\|null` | | `operation.access.policies[]` | [`SemanticLinkContext[]`](shared-semantic-link.md) | | `operation.execution.invalidates[]` | [`SemanticLinkContext[]`](shared-semantic-link.md) | ## Derived Paths Derived context sits next to semantic context and is documented in [derived.md](/pack-builders/context/derived). | Path family | Meaning | | ------------------------------------- | -------------------------------------------------------------------------- | | `*.is.*` | Classification booleans. | | `*.has_*` | Presence booleans that are safe for falsey values such as `0` and `false`. | | `*_json` | JSON literal strings safe for JSON-compatible generated code. | | `facets.http.path.segments[]` | Normalized route path pieces. | | `schema.fields[].storage.primary_key` | Effective storage facts. | | `<subject>.generated.*` | Planning-aware generated representations. | ## Absence and Demand Context is demand-driven. A path exists in this catalogue only as a contract. Dryv still materializes only the roots and branches requested by template analysis. When a requested value is absent: | Shape | Value | | ---------------------- | ------ | | optional scalar/object | `null` | | collection | `[]` | Templates should use the documented paths and should not parse Runtime IR pointers, map keys or generated filenames. --- <!-- Source: https://docs.dryvcode.com/pack-builders/context/derived --> # Derived values Beside the raw, IR-shaped context, the engine offers **derived** context: deterministic facts that templates would otherwise reconstruct. It exists so a template can mostly look like the code it emits, in any renderer, including logic-light ones such as Handlebars. Derived context follows the same rules as all context: - **Demand-driven.** Only analysed and validated requirement paths are projected. Requesting `value.is.boolean` produces that one flag; sibling flags and raw branches stay absent. - **Renderer- and framework-neutral.** No field names a target language, framework or database. Mapping a classification to code (`z.string().uuid()`, `@Column("uuid")`) stays visible in the pack. - **Explainable.** Each field carries provenance: `derived` (semantic facts) or `planning` (provider `planning-file`). `dryv context show <path>` prints it. - **Additive.** Raw fields stay; derived fields sit next to them. - **Snake case.** Every renderer-facing path segment is lower `snake_case`, including pack input names. Dryv-known keys in `dryv.yaml` and `dryv.pack.yaml` are snake_case too; Dryv-known values stay kebab- or dot-case. ## Classifications: `is` Closed boolean flags replace `kind`/`type`/`format` comparisons. Exactly the flags that apply are `true`. | Path | Flags | | ------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `<value>.is` (semantic values) | `schema`, `property`, `unknown`, `dynamic`; property kinds (`primitive`, `enum`, `composite`, `literal`, `union`, `record`, `tuple`, `generic`, `temporal`); primitive types, kinds and formats (`string`, `number`, `boolean`, `integer`, `decimal`, `uuid`, `email`, `hex_color`, …); temporal kinds (`date`, `time`, `date_time`, …) | | `property.primitive.is`, `property.temporal.is` | the primitive or temporal flags alone | | `relation.is`, `relation.on_delete_is`, `relation.on_update_is` | `one_to_one`, `one_to_many`, `many_to_one`, `many_to_many`; `restrict`, `cascade`, `detach`, `reset` | | `facets.http.is` | `get`, `post`, `put`, `patch`, `delete`, `head`, `options`, `trace` (there is no `method_name`: turning a method into a target name is the pack's decision) | | `facets.http.inputs[].is` | `path`, `query`, `query_object`, `header`, `cookie`, `body`, `multipart`, `form` | | representations `.is` | `json`, `xml`, `csv`, `text`, `bytes`, `event_stream` | | `facets.http.path.segments[].is` | `literal`, `parameter` | | invariant `form.is`, `comparisons[].is`, operand `.is`, operand `.operator_is` | form, comparison operator, operand kind and arithmetic operator flags | Top-level value flags (`schema`, `property`, `unknown`, `dynamic`) never resolve the referenced property; property-specific flags resolve it only when requested. ## Presence: `has_*` `length.has_exact|has_min|has_max`, `range.has_min|has_max`, `array.has_min|has_max`, and `constraints.has_multiple_of|has_bits|has_unsigned|has_precision|has_scale` say whether a bound is declared. They are true for `0` and `false`, so templates never rely on truthiness. ## JSON literals: `*_json` The JSON text of a canonical literal, beside the raw value, for renderers that cannot encode values: `default.value_json`, enum `values[].value_json`, `pattern.match_json[]` (and `starts_json`, `ends_json`, `allow_json`, `deny_json`), invariant `message_json`, operand and term `value_json`. JSON is the IR's own value format, so the text is a safe literal for any JSON-compatible target; templates embed it raw (`{{{field.default.value_json}}}`). ## HTTP views - `facets.http.input_groups.<kind>[]`: the bindings of one kind (`path`, `query`, `query_object`, `header`, `cookie`, `body`, `multipart`, `form`) in declaration order. A body-only request never materialises the other groups. `facets.http.inputs` stays the canonical ordered list. - `facets.http.path.effective`: the deterministic full route assembled from the active application HTTP root, the owning group's parent chain from root to leaf, and the operation-local path. Scope roots remain canonical semantic facts; only the join is derived. - `facets.http.path.segments[]`: the canonical local path split once into `literal` text and `parameter` names, from the same `{name}` grammar IR validation uses. Target syntax such as `:id` stays in packs. ## Field storage `schema.fields[].storage.primary_key`: whether the field is part of the effective primary key, using the validator's `effective_primary_key` rule (inherited storage included). A schema without local or inherited storage gives `storage: null`. Storage facts come from canonical declarations, never field names. ## Planned generated representations How the planner already represents a subject **for the current file**, from that file's own dependencies only: | Path | Meaning | | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `<value>.generated.all[]`, `<field link>.generated.all[]` | every representation of the subject, in planner order | | `….generated.same_pack[]` | representations from the current pack (a list: several templates may represent one subject) | | `….generated.schema_types` · `schema_validation` · `schema_persistence` · `schema_examples` · `property_enum_types` · `property_types` · `operation_client` · `operation_implementation` · `operation_usecase` | the representation through that bound slot, or null. A bound slot resolves to one provider template, so at most one exists; if the planner ever yields more, projection fails with `context.projection.representation_ambiguous` | | `file.dependency_groups.<group>[]` | the file's dependencies grouped the same way (`same_pack` and the five slot groups) | | `file.dependencies[].is_self` | the dependency is the current file (self-referencing subjects), so templates can skip a self-import | Each item is a generated dependency: `symbol`, `symbols`, `path`, `template`, `pack`, `slot`, `target`. ## Discovery `dryv context list` prints every root and type; `dryv context show <path>` explains one path (root, cardinality, provenance, provider, and the fields it leads to), with `--json` for both. The engine derives these from the registries requirement validation uses, served read-only by `GET /v1/context/catalog` and `GET /v1/context/path?path=…`. A lookup always answers with `info` or a stable `error` code: `context.root.unknown`, `context.path.collection_invalid`, `context.path.field_unknown`, `context.path.named_map_key`. ## Renderers Jinja, Handlebars and Liquid read the same vocabulary. `source/plugins/templating/_conformance/` holds one case written in all three; each renderer's tests check that it yields the same leaf requirement paths (exact paths that are not a prefix of another; Handlebars `{{#with}}` also lists the object it tests, which the engine merges into the same request tree). Mustache is render-only: its sections don't distinguish booleans, objects and lists, so it can't derive exact requirements. The `sdk/_examples/packs/zod` pack is the logic-light proof: one Handlebars template with no custom helpers whose output is byte-identical to its earlier Jinja version. Other packs stay on Jinja, where macros keep target mappings readable, and use derived flags instead of `kind` comparisons. ## Known gaps - **Partials.** Packs have no non-emitted resources: every file under a template boundary is generated, and `.dryvignore` also hides files from snapshots. Logic-light templates therefore repeat reusable mappings or inline them. - **Representation traits.** The `schema.validation` slot doesn't say whether its representation is a class, a Zod schema or a Joi schema. That is a capability-model question, deferred to its own design; packs keep their current behaviour. - **Mustache analysis** stays deferred without a protocol change. --- <!-- Source: https://docs.dryvcode.com/pack-builders/context/analysis-protocol --> # Template analysis protocol For the derived vocabulary templates can request (classifications, presence facts, JSON literals, HTTP views, storage, generated representations) and the CLI discovery commands, see [context/derived.md](/pack-builders/context/derived). Template Servers tell the Engine which context paths a template reads. The Engine validates those paths, projects only them, and asks for a strict render of the same snapshot. ```text Engine ─ POST /analysis (TemplateAnalysisRequest) ─▶ Template Server ◀─ requirements: exact + subtree paths, dependencies, diagnostics Engine validates paths: vocabulary + invocation envelope Engine projects context (see context-resolution) Engine ─ POST /render (TemplateRenderRequest, same snapshot identity) ─▶ rendered bytes ``` The protocol is `dryv.templates/v1alpha1`, the requirements document is `dryv.context-requirements/v1alpha1`, and the vocabulary is `dryv.context/v1alpha1`. The server never receives Runtime IR, and the Engine never parses template syntax. ## Snapshot A snapshot contains sorted, digest-checked resources, the root resource, the vocabulary version, the provider version, the built-in helper-set version and the renderer configuration. Changing any of these changes its identity. Rendering always refers to an analysed identity. Static dependencies must be supplied resources, and cycles or missing dependencies are errors. ## Requirements ```yaml version: dryv.context-requirements/v1alpha1 template: { key: entity, source: src/{entity}/entity.ts.hbs, digest: sha256:… } vocabulary: dryv.context/v1alpha1 requirements: exact: - file.symbol - file.dependencies[].path.relative - schema.fields[].name.camel subtree: [] dependencies: [{ source: src/shared/type.hbs, digest: sha256:… }] diagnostics: [] ``` Requirements are sorted and deduplicated. ## Path grammar | Form | Example | Meaning | | ---------- | ------------------------------------------------ | -------------------------------------------------------------- | | member | `schema.name.pascal` | exact value | | collection | `schema.fields[].name.camel` | only that member of each element | | named map | `file.symbols.model`, `pack.inputs.package_name` | lower snake-case literal key, checked against the plan or pack | Raw IR paths (`#/schemas/…`, `$ref`, `ir.*`) are never valid. Renderer-local aliases (`with`, `set`, sections, macro parameters, loop variables) must resolve back to canonical paths. ## Analysis rules - **Conditions are conservative.** Every branch's reads are requested. Presence is decided at render time, and a missing value becomes `null` or `[]`. - **Dynamic lookups** request a bounded subtree and emit a warning. A subtree includes only the node's local fields and stops at context-reference boundaries (for example, `value → SchemaContext`). The Engine rejects unbounded named-map requests. Dynamic keys on `pack.inputs` are rejected. - **Includes and partials** are analysed as part of the dependency closure. - **Opaque helpers, ambient filters, dynamic dependencies and unsupported constructs fail analysis.** Only the built-in, versioned, pure helper set exists. ## Engine validation Before resolving anything, the Engine rejects unknown roots or members, invalid `[]` traversal, traversal through scalars, invalid map keys, roots unavailable for this invocation (for example, `feature` under `scope: each`), unbounded subtrees, leftover aliases, and version or digest mismatches. Diagnostics point to the template, the span, the offending path and the expected vocabulary. **Root availability:** `file` is always available. `application` is always available and resolved on demand. `pack` is always available. The subject root follows subject + scope. `group` is available for `collects.group` and `collects.feature`. `feature` is available for `collects.feature`. ## Renderer conformance - **Strict.** Accessing anything that wasn't analysed or wasn't supplied fails deterministically. - **Hermetic.** No network, undeclared files, environment reads, clock or randomness, and no IR or artifact queries. - Analysis caches are capped at 128 snapshots and don't depend on the semantic subject. | Renderer | Analysis | Strict snapshot render | | ------------------------- | ---------------------- | ------------------------------------- | | Handlebars, Jinja, Liquid | yes | yes | | Mustache | explicitly unsupported | can't be used for analysed generation | --- <!-- Source: https://docs.dryvcode.com/pack-builders/context/resolution --> # Context resolution The `DemandDrivenContextProjector` turns validated requirement paths into the minimal render context for one file. It resolves directly from IR and planning indexes. There's no expanded context-IR copy (decision 0005). The vocabulary itself (every context type and field) is in [context](/pack-builders/context/overview). ## Envelope | Root | Source | When available | | ------------------- | ------------------------------------------------- | ----------------------------------------------------------------------------------------------- | | `file` | the `PlannedFileArtifact` | always | | `application` | the active application (bounded metadata) | always; resolved only when requested | | `pack.inputs.<key>` | usage inputs checked against the pack declaration | always | | subject | IR, by subject + scope | `each` → `schema`, `property.enum`… · `all` / `collects.*` → `schemas[]`, `properties.enums[]`… | | `group` | the partition identity | `collects.group`, and `collects.feature` (owner) | | `feature` | the partition identity | `collects.feature` | The collector always comes from the partition, never from the first item. ## Algorithm For every requirement: 1. take the root from the envelope; 2. walk only the requested segments, projecting while traversing (never materialise and then prune); 3. resolve `$ref`s only when traversal reaches them, delegating to the authoritative resolver for that context type; 4. compute name variants and derived values only when requested; 5. take `file` facts only from planning; 6. apply absence rules, memoise safe lookups, and merge the result into one output tree; 7. discard the per-file context after rendering. Requirements are merged into one request tree. A parent path never implies its children unless it's a subtree request. ## Absence | Case | Result | | ------------------------------------------------------------------------------------ | ----------- | | Not requested | key omitted | | Requested, optional object or scalar absent | `null` | | Requested, collection empty | `[]` | | Requested inactive variant branch (e.g. `value.property` when `value.kind = schema`) | `null` | ## Ordering Each collection uses the order its contract defines: tuple and ordered-enum order, canonical order for unordered enums, effective schema field order, planning order for `file.dependencies`, and export-stream order for `file.exports`. Dictionary iteration order is never used. ## Bounds and cycles Subtree expansion stops at context-reference boundaries. Semantic cycles (`User.manager → User`) are safe because request paths are finite. A guard keyed on context type + canonical identity + request node turns any recursive attempt into a bounded diagnostic. ## Errors | Code | Meaning | | --------------------------------------------- | ----------------------------------------------------------------------------------------------- | | `context.request.invalid` | The path isn't in the vocabulary | | `context.root.unavailable` | Valid path, but not available for this invocation | | `context.reference.invalid` | Broken or incompatible canonical reference | | `context.resolution.bounded` | A forbidden recursive expansion was attempted | | `context.projection.planned_artifact_missing` | Expected generated representation not planned. Names the consumer, target and allowed producers | Projection-specific failures use the `context.projection.*` family, e.g. `root_invalid`, `pack_input_undeclared`, `application_ambiguous`, `port_missing`. ## Evidence `project_with_evidence()` returns the context plus the requested, materialised and unmaterialised paths, and typed provider provenance (no values). This feeds [tracing](/pack-builders/context/tracing). --- <!-- Source: https://docs.dryvcode.com/pack-builders/context/artifact-graph --> # Artifact graph Planning turns selections and the template filesystem into concrete files, symbols and edges **before rendering** (decision 0007). ## Three levels ```text SelectionPartition ─▶ TemplateInvocation ─▶ PlannedFileArtifact(s) (which subjects) (why this instance) (which concrete files) ``` | Level | Holds | | ---------- | --------------------------------------------------------------------------------------------------------------------------------- | | Partition | selection, subject, scope, axis (`subject:<kind>`, `all`, `feature`, `group`), key, represented subjects | | Invocation | pack, template key, kind (selection, global, export), partition, resolved output (name, path, symbols), imports, exports, trace | | File | identity, source path, workspace path, `raw` or `rendered`, renderer, represented subjects, symbols, dependencies, exports, trace | Partition identity comes from canonical relationships, never from filenames, tags or output. ## Identity and paths - File identity = pack + template key (or global resource) + partition identity + source resource. It never depends on render order, content or list position. - Workspace path = destination path + activation destination root + static prefix before `{key}` + `output.path` + static suffix + filename minus renderer suffix. `src/{entity}/entities/$(name).entity.ts.j2` for `User` in `users` → `src/users/entities/user.entity.ts`. - Paths are portable and relative. Absolute paths, `..`, backslashes, empty names and escaping the source root are all rejected. - **Collisions are errors.** That covers exact matches, including raw versus rendered (`user.ts` and `user.ts.j2`), and case-folded equivalents (`User.ts` and `user.ts`), within or across packs. There's no last-writer-wins. ## Symbols - Declared `output.symbol(s)` are the only source of symbol identity. Rendered code is never parsed. - A symbol-bearing invocation must own exactly one file. If it owns several, planning fails; Dryv never guesses from names or extensions. ## Imports After producers are planned, Dryv indexes `(pack, template key, canonical subject) → invocation → file → symbols`. For each consumer: 1. collect the canonical references of its represented subjects, through a typed index rather than JSON walking; 2. for each producer allowed in `imports`, find the invocations that represent those targets; 3. record a generated-dependency edge carrying the producer's path and symbols. - A missing representation adds no edge. Dryv never invents a file. - Several producer templates for one target are fine, because they're different representations. - One producer template with several addressable files for the same target is an ambiguity error. - Import cycles are allowed. Generated references aren't build-order edges. - An edge says a dependency is _eligible_. The template decides whether to emit import syntax. ## Exports and barrels - The export stream follows declared `exports` order, then stable file identity or path within each producer. Only identical identities are deduplicated. - The template key is the unit of export. To keep some files out, split them into another key; there's no filename filtering. - `barrel: all` makes one invocation. Its subjects are the union of its producers' subjects, with no scalar feature or group. - `barrel: each` keeps the producer partitions. The producers' axes must be compatible (all `feature`, or all `subject:schema`); otherwise the plan is rejected. When key sets differ, the barrel takes the deterministic union. - Barrels can export barrels. ## Edge types Three kinds of edge are kept separate, with no generic "depends on": a **generated reference** (import eligibility), an **export aggregation** (barrel membership) and **invocation ownership** (file belongs to invocation). ## Determinism and trace Selections, partitions, invocations, files, edges and export streams all have canonical order. Every file can explain which pack, selection, subjects, template, source resource, output and dependencies produced it. See [tracing](/pack-builders/context/tracing). --- <!-- Source: https://docs.dryvcode.com/pack-builders/context/template-servers --> # Template servers A server manifest documents Dryv runtime endpoints. It is infrastructure wiring, not project generation configuration. Use it for local development, private plugin renderers and hosted API/template-server deployments. Keep server URLs and launch commands out of `dryv.yaml` and `dryv.pack.yaml`. The source-checkout API default registry is `source/engine/python/api/dryv.server.yaml`. ## Shape A server manifest describes one or more runtime endpoints: ```yaml apiVersion: dryv.server/v1alpha1 servers: - kind: TEMPLATE_SERVER name: jinja url: http://127.0.0.1:8765 command: - dryv-jinja - serve - kind: DRYV_API_SERVER name: local url: http://127.0.0.1:8750 ``` `TEMPLATE_SERVER.name` is the renderer name packs require. The API connects to `url` and reads the server's live discovery response before rendering when that manifest is supplied to the API process as runtime configuration. If the URL is unavailable and `command` is present, the local API may launch the command from the manifest directory and retry discovery. The API template renderer uses only `TEMPLATE_SERVER` entries. `command` is valid only for `TEMPLATE_SERVER`; API endpoints remain observational connection targets. `DRYV_API_SERVER` entries are for clients and tools that need to discover an API endpoint. ## Packs and Custom Renderers Packs continue to declare renderer needs by name/capability in `dryv.pack.yaml`: ```yaml requires: - name: my-renderer ``` An advanced pack may include a server manifest beside the pack as optional runtime metadata, but it is not activated automatically. The project, CLI or API process must opt into that manifest explicitly. This keeps rare custom plugin wiring possible without letting a pack silently make the engine call arbitrary URLs. ## Local and Remote Rules Local template plugins work when the Dryv API process can reach their `url` or launch their `command`. Remote APIs can only use URLs reachable from the remote API environment. A local `command` in a manifest sent to a remote API is not useful unless that remote API process has the same command and working directory available. The client-facing API discovery endpoint exposes live server identity, URLs and capabilities. It does not expose manifest paths or launch commands. ## CLI resolution and doctor Project commands resolve the API in this order: ```text explicit --api ↓ project dryv.server.yaml ↓ normal default ``` The resolution source is preserved as `explicit`, `manifest` or `default` and is visible in CLI discovery/doctor machine evidence. Ordinary generation uses the Template Servers already connected to the resolved API. A project `dryv.server.yaml` does not mutate a running API's renderer registry per request. `dryv server validate` checks manifest wiring without network access. `dryv server doctor` checks the resolved API plus every configured Template Server. With explicit `--launch`, an unreachable Template Server may be started from its manifest-declared command after the workspace trust boundary is satisfied. The CLI never launches a `DRYV_API_SERVER` from the manifest. --- <!-- Source: https://docs.dryvcode.com/pack-builders/context/tracing --> # Tracing `GenerationResult.trace` exposes a `dryv.trace/v1alpha1` graph, and artifacts keep compact `TraceReference` links into it. ## Separate graphs Semantic, selection/partition, artifact, requirement, resolution, render and write/tooling traces are separate graphs. They link through stable structured identities (semantic id, selection key, partition key, template key, invocation id, file id, template and requirement digests, provider identity). They never use memory addresses, random ids or list positions. Transport correlation ids can be ephemeral. ## A full file explanation ```text file src/users/user.entity.ts pack example.typescript selection storageSchemas · subject schema · matched users.User · reason facet=storage partition scope each · key schema:users.User template entity · templates/src/{entity}/$(name).entity.ts.hbs output name user · path users · symbol UserEntity requirements file.symbol, schema.fields[].name.camel, … renderer provider + version result output digest ``` Symbols, dependencies, exports, context values, requirement sources and subtree fallbacks can each be explained the same way. Failure traces keep every stage that succeeded before the failure. ## Provenance classes | Class | Source | | ------------------ | ------------------------------------------------------ | | `semantic` | canonical meaning | | `semantic-derived` | deterministic derivation (name variant, resolved path) | | `planning` | file, path, symbol, dependency or export facts | | `scope-metadata` | application, group or feature metadata | Traces store references and digests, not snapshots of values. ## Determinism contract With the same IR, pack, templates, usage and provider versions, all of these must be identical: selections, partitions, file identities, paths, symbols, edges, export streams, requirements, materialised context, render requests, rendered bytes and the write plan. Replay digests cover the plan, the template closure, the requirements, the projected context and the rendered bytes. ## Cache rules A cache hit changes cost, not meaning, and the trace still shows the source. Safe keys include `(renderer version, template closure, vocabulary version) → requirements`, `(canonical id, naming variant) → name`, and `(artifact, producer) → relative path`. Never cache recursively expanded graphs. ## Metrics Workspace and plan size, context demand versus materialisation, projection cache activity, context bytes and elapsed time. ## Privacy Traces never store credentials or environment variable values (they record that `VIRTUAL_ENV` was required, not its value). Semantic values in traces are summarised or digested. --- <!-- Source: https://docs.dryvcode.com/pack-builders/context/schema --> # schema Derived additions: `has_*` presence facts, `*_json` literals, `fields[].storage.primary_key` and field-link `generated`. See [derived.md](/pack-builders/context/derived). ## Intent A named structured semantic object used for entities, DTOs, requests/responses, persistence models, and reusable domain structures. Exact selection subject: ```yaml subject: schema ``` The current Runtime IR is evidence, not authority. Target improvements needed for a usable template contract are called out explicitly. ## Scope envelope | Scope | Context | | --------------------- | ------------------------------------ | | `each` | `schema: SchemaContext` | | `all` | `schemas: SchemaContext[]` | | collection candidates | `collects.group`, `collects.feature` | For `collects.<dimension>`, the singular collector is added beside the plural selected-subject array. A collector is valid only when ownership is semantically provable. ## Context tree This file defines only schema-local context. Shared/nested contexts are referenced, not duplicated. | Context path | Type | Meaning / template use | | ---------------------------------------- | -------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `schema.id` | `string` | Opaque stable semantic identity. | | `schema.name` | `NameContext` | See shared `NameContext` in [README.md](/pack-builders/context/overview). | | `schema.description` | `string\|null` | Human semantic description. | | `schema.tags` | `string[]` | Semantic classifiers. | | `schema.explanations` | `ExplanationContext[]` | See [README.md](/pack-builders/context/overview). | | `schema.group` | `SemanticLinkContext\|null` | Owning group link; see [README.md](/pack-builders/context/overview). | | `schema.feature` | `SemanticLinkContext\|null` | Canonical owning feature, when present. | | `schema.role` | `SchemaRole\|null` | One of `entity`, `value`, `request`, `response`, `command`, `query`, `filter`, `event`, `view-model`, `config`. | | `schema.abstract` | `boolean` | Whether the schema contributes meaning without direct concrete identity. | | `schema.extends` | `SchemaContext\|null` | Full context of the base schema from this file, demand-resolved. | | `schema.source` | `SchemaSourceContext\|null` | The projection this schema derives from: `schema` link, `purpose` (`read\|create\|edit\|query\|custom`), `fields[]` as `{name, source}`, and `policies`. `null` for original schemas. | | `schema.fields` | `SchemaFieldContext[]` | Effective fields ordered by name: local fields, projected fields (with their optional/nullable/array overrides) and fields inherited through `extends`. | | `schema.facets.storage` | `SchemaStorageContext\|null` | Storage semantics unique to schema. | | `schema.facets.storage.namespace` | `string\|null` | Effective storage namespace: the schema's own, else the nearest group default. | | `schema.invariants` | `SchemaInvariantContext[]` | Effective invariants: inherited, carried over from a projection source, then local. | | `schema.invariants[].name` | `NameContext` | Stable invariant name, for constraint names such as `chk_cart_item_quantity_positive`. | | `schema.invariants[].message` | `string\|null` | Optional error message. | | `schema.invariants[].rule` | `ExpressionContext` | The rule's full expression, demand-resolved. | | `schema.invariants[].form.kind` | `comparison\|all\|any\|opaque` | The rule's simplest fixed-depth shape, computed by the Engine. `opaque` means the rule has no simple form. | | `schema.invariants[].form.comparisons[]` | `InvariantComparisonContext[]` | One entry for `comparison`, several for `all`/`any`, none for `opaque`. | | `…comparisons[].operator` | `equal\|not-equal\|less-than\|less-than-or-equal\|greater-than\|greater-than-or-equal` | Comparison operator. | | `…comparisons[].left` / `.right` | `InvariantOperandContext` | `kind` is `field`, `literal` or `arithmetic`. `field` is a `NameContext` for a top-level field; `value` is the literal; `operator` and `terms[]` describe arithmetic over fields and literals. | | `schema.examples` | `CanonicalValue[]` | Whole-schema examples. | ### SchemaFieldContext | Context path | Type | Meaning / template use | | ------------------------------ | --------------------------- | --------------------------------------------------------------------------------------------------------- | | `schema.fields[].name` | `NameContext` | Field identity; shared context from [README.md](/pack-builders/context/overview). | | `schema.fields[].value` | `SemanticValueContext` | Exact field-value contract from [shared/semantic-value.md](/pack-builders/context/shared-semantic-value). | | `schema.fields[].optional` | `boolean` | Field-local optional presence. | | `schema.fields[].nullable` | `boolean` | Field-local nullable value. | | `schema.fields[].array` | `ArrayBoundsContext\|null` | Field-local array cardinality. | | `schema.fields[].default` | `DefaultValueContext\|null` | Canonical value or expression default. | | `schema.fields[].mutation` | `create-only\|system\|null` | Mutation rule. | | `schema.fields[].query` | `FieldQueryContext\|null` | Filter/sort/search/nesting capabilities. | | `schema.fields[].sensitive` | `boolean` | Sensitive-data marker. | | `schema.fields[].policy.read` | `PolicyContext\|null` | Full policy context from [policy.md](/pack-builders/context/policy), demand-resolved. | | `schema.fields[].policy.write` | `PolicyContext\|null` | Full policy context from [policy.md](/pack-builders/context/policy), demand-resolved. | | `schema.fields[].relation` | `RelationContext\|null` | Field-local relation semantics. | | `schema.fields[].related` | `RelatedContext\|null` | Derived/inverse relation semantics. | | `schema.fields[].sources` | `FieldSourceContext[]` | Field-local value/resolve/options source bindings. | A reusable property's constraints are therefore reached naturally through the field value, for example: ```text schema.fields[].value.property.primitive.constraints.length schema.fields[].value.property.primitive.constraints.range schema.fields[].value.property.primitive.constraints.precision schema.fields[].value.property.primitive.constraints.scale schema.fields[].value.property.enum.values schema.fields[].value.property.temporal.constraints schema.fields[].value.property.composite.fields ``` Those subtrees are not redefined here; they are the full matching property contexts from their subject files. ## Usage rules - `fields` is the effective generation view; templates should not rebuild inheritance/derivation semantics. - `role` says what the schema does; `source` says where its shape came from. - Storage stays under `facets.storage`. ## Runtime IR implications to audit - Resolve each field through `SemanticValueContext`; property/schema references must expose their authoritative full context contract without templates parsing pointer prefixes. ## Template example — Handlebars / TypeScript DTO ```hbs {{#each file.dependencies}} {{#if symbol}} import { {{symbol}} } from "{{path.relative}}"; {{/if}} {{/each}} export interface {{file.symbol}} { {{#each schema.fields}} {{name.camel}}{{#if optional}}?{{/if}}: {{renderFieldValue value ../file.dependencies}}{{#if nullable}} | null{{/if}}; {{/each}} } ``` The example uses semantic context for field meaning and `file` metadata for exact generated representation identity. `renderFieldValue` is a pack-owned macro that resolves generated schema/property types through `file.dependencies` instead of guessing their symbols from semantic casing. Any `renderType`/`render_type` helper shown is a pack-owned macro/partial consuming the documented `TypeContext`, not hidden Dryv context. ## Audit questions - Is `schema.source` clearer than the current `projection` concept? - Do proof packs need roles beyond request/response? - Do templates need declared-vs-effective fields, or is effective meaning enough? ## Facet cardinality Initial storage cardinality is singular: ```text schema.facets.storage 0..1 ``` One schema has at most one canonical storage mapping in the initial contract. Multiple target-specific physical representations belong to pack generation, not multiple semantic storage facets. --- <!-- Source: https://docs.dryvcode.com/pack-builders/context/operation --> # operation Derived additions: `facets.http.is.*`, `inputs[].is.*`, `input_groups.<kind>[]`, `path.effective` and `path.segments[]`. See [derived.md](/pack-builders/context/derived#http-views). ## Intent A callable semantic behavior supporting service methods, controllers/routes, SDK calls, handlers, access controls, execution semantics, schedules, failures, and events. Exact selection subject: ```yaml subject: operation ``` The current Runtime IR is evidence, not authority. Target improvements needed for a usable template contract are called out explicitly. ## Scope envelope | Scope | Context | | --------------------- | ------------------------------------ | | `each` | `operation: OperationContext` | | `all` | `operations: OperationContext[]` | | collection candidates | `collects.group`, `collects.feature` | For `collects.<dimension>`, the singular collector is added beside the plural selected-subject array. A collector is valid only when ownership is semantically provable. ## Context tree | Context path | Type | Meaning / template use | | ------------------------------------------- | --------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `operation.id` | `string` | Opaque stable semantic identity. | | `operation.name` | `NameContext` | Stable semantic identity and finite naming variants. | | `operation.description` | `string\|null` | Human semantic description. | | `operation.tags` | `string[]` | Semantic classifiers; empty when none. | | `operation.explanations` | `ExplanationContext[]` | Advisory usage/security/implementation notes. | | `operation.group` | `SemanticLinkContext\|null` | Owning semantic group. | | `operation.feature` | `SemanticLinkContext\|null` | Canonical owning feature. | | | `operation.role` | `create\|update\|delete\|detail\|list\|search\|validate\|transform\|action\|null` | Semantic role. | | `operation.input` | `OperationInputContext \| null` | The single input: `kind` (`fields` or `schema`), `value` (the schema, for a schema input), and `fields[]` with `name`, `value` (null for unknown/dynamic schema fields) and `optional`. Always named: a schema input lists the schema's fields. | | | `operation.output` | `OperationOutputContext \| null` | The single output: `value`. | | | `operation.failures` | `SemanticLinkContext[]` | Declared failure contracts. | | `operation.emits` | `SemanticLinkContext[]` | Emitted events. | | `operation.access.authenticated` | `boolean` | Authentication requirement. | | `operation.access.policies` | `SemanticLinkContext[]` | Required policies. | | `operation.execution.mode` | `sync\|async` | Execution mode. | | `operation.execution.timeout.seconds` | `integer\|null` | Timeout. | | `operation.execution.rate_limit` | `RateLimitContext\|null` | Limit/window. | | `operation.execution.cache.ttl.seconds` | `integer\|null` | Cache lifetime. | | `operation.execution.transaction.required` | `boolean\|null` | Transaction requirement. | | `operation.execution.retry` | `RetryContext\|null` | Attempts/backoff. | | `operation.execution.idempotency.key` | `OperationPortLinkContext\|null` | Named input port used as idempotency key. | | `operation.execution.audit.required` | `boolean\|null` | Audit requirement. | | `operation.execution.invalidates` | `SemanticLinkContext[]` | Invalidated operations. | | `operation.facets.http.method` | `HttpMethod\|null` | HTTP method. | | `operation.facets.http.path.local` | `string\|null` | Operation-declared path, unchanged from Runtime IR. | | `operation.facets.http.path.effective` | `string\|null` | Derived full path: active application HTTP root + ordered owning-group HTTP roots + operation-local path. | | `operation.facets.http.inputs` | `HttpInputBindingContext[]` | Input field (or whole schema input)→path/query/header/cookie/body/multipart/form bindings. `port.field` is the field name, or null for the whole input; `port.name` is the field name, or `input`. | | `operation.facets.http.outputs` | `HttpOutputBindingContext[]` | Output→status/representation bindings. | | `operation.facets.http.failures` | `HttpFailureBindingContext[]` | Failure→status/representation bindings. | | `operation.facets.websocket.path.local` | `string\|null` | Operation-declared WebSocket path. | | `operation.facets.websocket.path.effective` | `string\|null` | Derived full WebSocket path using the same scope-root composition rule. | | `operation.facets.schedule` | `ScheduleFacetContext\|null` | Interval/daily schedule. | ## Usage rules - Ports have stable indices and an optional canonical `name`; unnamed ports project as `input_0`, `output_0`. - `path.local` preserves the authored operation path. `path.effective` is the Engine-composed route using the active application root, root-to-leaf owning-group HTTP roots, then the local path. Packs that mount routers beneath their own prefixes may still intentionally use `local`; external API descriptions and direct route registrations should normally use `effective`. ## Runtime IR implications to audit Effective path resolution is derived from existing canonical scope facts; it does not add Runtime IR fields. ## Template example — Handlebars / controller method The controller flattens the input into one parameter per HTTP binding, then passes the service one input object: ```hbs @{{operation.facets.http.method}}("{{operation.facets.http.path.local}}") async {{operation.name.camel}}( {{#each operation.facets.http.inputs}} {{port.name.camel}}: {{renderValue port.value @root.file.dependencies}}{{#unless @last }},{{/unless}} {{/each}} ) { return this.service.{{operation.name.camel}}({ {{#each operation.facets.http.inputs}}{{port.name.camel}}{{#unless @last}}, {{/unless}}{{/each}} }); } ``` The example uses semantic context only. Any `renderType`/`render_type` helper shown is a pack-owned macro/partial consuming the documented `TypeContext`, not hidden Dryv context. ## Audit questions - Are named ports the correct canonical improvement? ## Facet cardinality Initial context cardinality is intentionally singular: ```text operation.facets.http 0..1 operation.facets.websocket 0..1 operation.facets.schedule 0..1 ``` If one behavior must be exposed through several independent HTTP bindings, model those as distinct operations that may share underlying semantic behavior rather than turning the context path into an array. --- <!-- Source: https://docs.dryvcode.com/pack-builders/context/event --> # event ## Intent A reusable semantic event with optional payload and explicit operation/workflow listeners. Exact selection subject: ```yaml subject: event ``` The current Runtime IR is evidence, not authority. Target improvements needed for a usable template contract are called out explicitly. ## Scope envelope | Scope | Context | | --------------------- | ------------------------------------ | | `each` | `event: EventContext` | | `all` | `events: EventContext[]` | | collection candidates | `collects.group`, `collects.feature` | For `collects.<dimension>`, the singular collector is added beside the plural selected-subject array. A collector is valid only when ownership is semantically provable. ## Context tree | Context path | Type | Meaning / template use | | -------------------------- | ---------------------------- | ----------------------------------------------------------------- | | `event.id` | `string` | Opaque stable semantic identity. | | `event.name` | `NameContext` | Stable semantic identity and finite naming variants. | | `event.description` | `string\|null` | Human semantic description. | | `event.tags` | `string[]` | Semantic classifiers; empty when none. | | `event.explanations` | `ExplanationContext[]` | Advisory usage/security/implementation notes. | | `event.group` | `SemanticLinkContext\|null` | Owning semantic group. | | `event.feature` | `SemanticLinkContext\|null` | Canonical owning feature. | | | `event.payload` | `SemanticValueContext\|null` | Property/schema payload using the shared semantic-value contract. | | `event.listeners` | `EventListenerContext[]` | Known listeners. | | `event.listeners[].kind` | `operation\|workflow` | Listener kind. | | `event.listeners[].target` | `SemanticLinkContext` | Resolved listener. | ## Usage rules - Target kind is explicit; templates never infer operation/workflow from pointer prefixes. - Do not invent broker/transport facets until proven. ## Runtime IR implications to audit - Current event model is broadly useful; reverse emitter links can be derived if packs prove the need. ## Template example — Handlebars / TypeScript event ```hbs export class {{file.symbol}} { static readonly name = "{{event.name.qualified}}"; // payload type is rendered by a pack-owned semantic-value macro constructor(public readonly payload: {{renderValue event.payload file.dependencies}}) {} } ``` The example uses semantic context only. Any `renderType`/`render_type` helper shown is a pack-owned macro/partial consuming the documented `TypeContext`, not hidden Dryv context. ## Audit questions - Can a real event pack generate code without parsing raw IR storage conventions? - Is any field here present only because the current IR happens to store it? - Does any nested item need first-class selection of its own? --- <!-- Source: https://docs.dryvcode.com/pack-builders/context/policy --> # policy ## Intent A reusable authorization/business rule with explicit required/provided semantic context and an optional expression rule. Exact selection subject: ```yaml subject: policy ``` The current Runtime IR is evidence, not authority. Target improvements needed for a usable template contract are called out explicitly. ## Scope envelope | Scope | Context | | --------------------- | ------------------------------------ | | `each` | `policy: PolicyContext` | | `all` | `policies: PolicyContext[]` | | collection candidates | `collects.group`, `collects.feature` | For `collects.<dimension>`, the singular collector is added beside the plural selected-subject array. A collector is valid only when ownership is semantically provable. ## Context tree | Context path | Type | Meaning / template use | | --------------------------------- | --------------------------- | ---------------------------------------------------- | | `policy.id` | `string` | Opaque stable semantic identity. | | `policy.name` | `NameContext` | Stable semantic identity and finite naming variants. | | `policy.description` | `string\|null` | Human semantic description. | | `policy.tags` | `string[]` | Semantic classifiers; empty when none. | | `policy.explanations` | `ExplanationContext[]` | Advisory usage/security/implementation notes. | | `policy.group` | `SemanticLinkContext\|null` | Owning semantic group. | | `policy.feature` | `SemanticLinkContext\|null` | Canonical owning feature, when present. | | `policy.context.requires` | `NamedValueContext[]` | Named values the policy expects. | | `policy.context.provides` | `NamedValueContext[]` | Named values the policy provides. | | `policy.context.requires[].name` | `NameContext` | Explicit context key. | | `policy.context.requires[].value` | `SemanticLinkContext` | Property/schema value. | | `policy.rule` | `SemanticLinkContext\|null` | Reusable expression rule. | ## Usage rules - Current requires/provides maps become explicit named arrays. - Target-specific guard/decorator syntax stays in the pack. ## Runtime IR implications to audit - Mostly normalization; keep reverse feature membership efficient. ## Template example — Handlebars / guard skeleton ```hbs export class {{file.symbol}} { canActivate(context: PolicyContext): boolean { {{#each policy.context.requires}} const {{name.camel}} = context.require("{{name.local}}"); {{/each}} return evaluatePolicy("{{policy.name.qualified}}", context); } } ``` The example uses semantic context only. Any `renderType`/`render_type` helper shown is a pack-owned macro/partial consuming the documented `TypeContext`, not hidden Dryv context. ## Audit questions - Can a real policy pack generate code without parsing raw IR storage conventions? - Is any field here present only because the current IR happens to store it? - Does any nested item need first-class selection of its own? --- <!-- Source: https://docs.dryvcode.com/pack-builders/context/failure --> # failure ## Intent A reusable domain/operation failure for exceptions, error DTOs, protocol errors, and documentation. Exact selection subject: ```yaml subject: failure ``` The current Runtime IR is evidence, not authority. Target improvements needed for a usable template contract are called out explicitly. ## Scope envelope | Scope | Context | | --------------------- | ------------------------------------ | | `each` | `failure: FailureContext` | | `all` | `failures: FailureContext[]` | | collection candidates | `collects.group`, `collects.feature` | For `collects.<dimension>`, the singular collector is added beside the plural selected-subject array. A collector is valid only when ownership is semantically provable. ## Context tree | Context path | Type | Meaning / template use | | ---------------------- | --------------------------- | ---------------------------------------------------- | | `failure.id` | `string` | Opaque stable semantic identity. | | `failure.name` | `NameContext` | Stable semantic identity and finite naming variants. | | `failure.description` | `string\|null` | Human semantic description. | | `failure.tags` | `string[]` | Semantic classifiers; empty when none. | | `failure.explanations` | `ExplanationContext[]` | Advisory usage/security/implementation notes. | | `failure.group` | `SemanticLinkContext\|null` | Owning semantic group. | | `failure.feature` | `SemanticLinkContext\|null` | Canonical owning feature. | | | `failure.code` | `string` | Stable semantic/business error code. | | `failure.payload` | `TypeContext\|null` | Optional structured payload. | ## Usage rules - `code` stays distinct from generated class names and transport-specific status codes. ## Runtime IR implications to audit - Current `Failure` should inherit universal semantic metadata because the pack contract permits tag filtering. ## Template example — Jinja / Python exception ```jinja class {{ file.symbol }}(Exception): code = "{{ failure.code }}" {% if failure.payload %} payload_type = {{ render_type(failure.payload) }} {% endif %} ``` The example uses semantic context only. Any `renderType`/`render_type` helper shown is a pack-owned macro/partial consuming the documented `TypeContext`, not hidden Dryv context. ## Audit questions - Can a real failure pack generate code without parsing raw IR storage conventions? - Is any field here present only because the current IR happens to store it? - Does any nested item need first-class selection of its own? ## Payload contract Failure payload remains `TypeContext`, not `SemanticValueContext`. Current failure semantics allow an arbitrary type expression, while `SemanticValueContext` models ValueRef-like carriers that distinguish reusable property/schema/unknown/dynamic values. Do not erase that distinction merely to reuse one context shape. --- <!-- Source: https://docs.dryvcode.com/pack-builders/context/workflow --> # workflow ## Intent A named orchestration graph connecting operation/workflow calls, event waits, data bindings, policies, transitions, and outputs. Exact selection subject: ```yaml subject: workflow ``` The current Runtime IR is evidence, not authority. Target improvements needed for a usable template contract are called out explicitly. ## Scope envelope | Scope | Context | | --------------------- | ------------------------------------ | | `each` | `workflow: WorkflowContext` | | `all` | `workflows: WorkflowContext[]` | | collection candidates | `collects.group`, `collects.feature` | For `collects.<dimension>`, the singular collector is added beside the plural selected-subject array. A collector is valid only when ownership is semantically provable. ## Context tree | Context path | Type | Meaning / template use | | ---------------------------------- | -------------------------------- | ----------------------------------------------------------------- | | `workflow.id` | `string` | Opaque stable semantic identity. | | `workflow.name` | `NameContext` | Stable semantic identity and finite naming variants. | | `workflow.description` | `string\|null` | Human semantic description. | | `workflow.tags` | `string[]` | Semantic classifiers; empty when none. | | `workflow.explanations` | `ExplanationContext[]` | Advisory usage/security/implementation notes. | | `workflow.group` | `SemanticLinkContext\|null` | Owning semantic group. | | `workflow.feature` | `SemanticLinkContext\|null` | Canonical owning feature. | | | `workflow.inputs` | `ValuePortContext[]` | Named ordered inputs; each port.value uses SemanticValueContext. | | | `workflow.outputs` | `ValuePortContext[]` | Named ordered outputs; each port.value uses SemanticValueContext. | | | `workflow.start` | `WorkflowStepLinkContext` | Starting step. | | `workflow.steps` | `WorkflowStepContext[]` | Named deterministic steps. | | `workflow.steps[].name` | `NameContext` | Step identity. | | `workflow.steps[].kind` | `operation\|workflow\|wait` | Structural variant. | | `workflow.steps[].operation` | `SemanticLinkContext\|null` | Operation target. | | `workflow.steps[].workflow` | `SemanticLinkContext\|null` | Nested workflow target. | | `workflow.steps[].event` | `SemanticLinkContext\|null` | Waited event. | | `workflow.steps[].timeout.seconds` | `integer\|null` | Wait timeout. | | `workflow.steps[].inputs` | `StepInputBindingContext[]` | Target input ← workflow/step/event source. | | `workflow.transitions` | `WorkflowTransitionContext[]` | From/to step links plus optional policy. | | `workflow.output_bindings` | `WorkflowOutputBindingContext[]` | Workflow output ← semantic source. | ## Usage rules - Step maps become arrays with explicit names. - All source/target refs resolve to bounded port/step/link objects. - Workflow ports need semantic names for generated APIs. ## Runtime IR implications to audit - Add stable names to workflow ports. - Ensure step identities are explicit, not map-key-only. - Promote workflow.step to a subject only if proof packs generate artifacts per step. ## Template example — Jinja / orchestration skeleton ```jinja async def {{ file.symbol }}({% for p in workflow.inputs %}{{ p.name.snake }}{% if not loop.last %}, {% endif %}{% endfor %}): {% for step in workflow.steps %} # {{ step.name.local }} — {{ step.kind }} {% if step.kind == "operation" %} await {{ step.operation.name.snake }}(...) {% endif %} {% endfor %} ``` The example uses semantic context only. Any `renderType`/`render_type` helper shown is a pack-owned macro/partial consuming the documented `TypeContext`, not hidden Dryv context. ## Audit questions - Can a real workflow pack generate code without parsing raw IR storage conventions? - Is any field here present only because the current IR happens to store it? - Does any nested item need first-class selection of its own? --- <!-- Source: https://docs.dryvcode.com/pack-builders/context/view --> # view ## Intent A semantic user-facing view composed from named context values, independently meaningful parts, and one or more surface presentations. Exact selection subject: ```yaml subject: view ``` The current Runtime IR is evidence, not authority. Target improvements needed for a usable template contract are called out explicitly. ## Scope envelope | Scope | Context | | --------------------- | ------------------------------------ | | `each` | `view: ViewContext` | | `all` | `views: ViewContext[]` | | collection candidates | `collects.group`, `collects.feature` | For `collects.<dimension>`, the singular collector is added beside the plural selected-subject array. A collector is valid only when ownership is semantically provable. ## Context tree | Context path | Type | Meaning / template use | | ------------------------------ | --------------------------- | ---------------------------------------------------- | | `view.id` | `string` | Opaque stable semantic identity. | | `view.name` | `NameContext` | Stable semantic identity and finite naming variants. | | `view.description` | `string\|null` | Human semantic description. | | `view.tags` | `string[]` | Semantic classifiers; empty when none. | | `view.explanations` | `ExplanationContext[]` | Advisory usage/security/implementation notes. | | `view.group` | `SemanticLinkContext\|null` | Owning semantic group. | | `view.feature` | `SemanticLinkContext\|null` | Canonical owning feature, when present. | | `view.context` | `NamedValueContext[]` | Named semantic values available to the view. | | `view.parts` | `ViewPartContext[]` | Same item contract as the `view.part` subject. | | `view.presentations` | `ViewPresentationContext[]` | Named surface presentations. | | `view.presentations[].name` | `NameContext` | Presentation identity. | | `view.presentations[].surface` | `SemanticLinkContext` | Target surface. | ## Usage rules - `view.parts[]` must reuse the exact `ViewPartContext`. - Making parts selectable does not flatten them out of the view hierarchy. - Context/presentation map keys become explicit names. ## Runtime IR implications to audit - Current `View` should gain universal metadata. - View parts need stable canonical identities for selection/indexing. ## Template example — Handlebars / React composition ```hbs export function {{file.symbol}}() { return ( <main> {{#each view.parts}} <{{name.pascal}} /> {{/each}} </main> ); } ``` The example uses semantic context only. Any `renderType`/`render_type` helper shown is a pack-owned macro/partial consuming the documented `TypeContext`, not hidden Dryv context. ## Audit questions - Can a real view pack generate code without parsing raw IR storage conventions? - Is any field here present only because the current IR happens to store it? - Does any nested item need first-class selection of its own? --- <!-- Source: https://docs.dryvcode.com/pack-builders/context/view-part --> # view.part ## Intent An independently selectable portion of a view that can generate a form, presenter, action component, or other UI fragment while retaining view ownership. Exact selection subject: ```yaml subject: view.part ``` The current Runtime IR is evidence, not authority. Target improvements needed for a usable template contract are called out explicitly. ## Scope envelope | Scope | Context | | --------------------- | ------------------------------------ | | `each` | `view.part: ViewPartContext` | | `all` | `views.parts: ViewPartContext[]` | | collection candidates | `collects.group`, `collects.feature` | For `collects.<dimension>`, the singular collector is added beside the plural selected-subject array. A collector is valid only when ownership is semantically provable. ## Context tree | Context path | Type | Meaning / template use | | ---------------------------------- | -------------------------------- | ---------------------------------------------------- | | `view.part.id` | `string` | Opaque stable semantic identity. | | `view.part.name` | `NameContext` | Stable semantic identity and finite naming variants. | | `view.part.description` | `string\|null` | Human semantic description. | | `view.part.tags` | `string[]` | Semantic classifiers; empty when none. | | `view.part.explanations` | `ExplanationContext[]` | Advisory usage/security/implementation notes. | | `view.part.group` | `SemanticLinkContext\|null` | Owning semantic group. | | `view.part.feature` | `SemanticLinkContext\|null` | Canonical owning feature, when present. | | `view.part.view` | `SemanticLinkContext` | Owning view. | | `view.part.kind` | `present\|collect\|invoke` | Structural variant. | | `view.part.present.source.port` | `OperationPortLinkContext\|null` | Resolved output port being presented. | | `view.part.present.source.select` | `SemanticPathContext[]` | Selected subpaths. | | `view.part.present.context` | `OperationInputBindingContext[]` | View-context→operation-input bindings of the source operation. | | `view.part.collect.target.port` | `OperationPortLinkContext\|null` | Resolved input port being collected. | | `view.part.collect.target.collect` | `SemanticPathContext[]` | Subpaths collected. | | `view.part.collect.target.context` | `ContextBindingContext[]` | View-context values injected into target paths. | | `view.part.invoke.operation` | `SemanticLinkContext\|null` | Invoked operation. | | `view.part.invoke.context` | `OperationInputBindingContext[]` | View-context→operation-input bindings. | ## Usage rules - Variant-specific subtrees are null unless active. - Resolved port links include index/name/value so UI templates can generate meaningful controls. - First-class selection keeps the canonical root `view.part`. ## Runtime IR implications to audit - Give view parts stable identity and universal metadata. - Operation port naming is required for readable form/action context. - Audit whether `kind` should become a selection filter after proof packs. ## Template example — Jinja / form component ```jinja {% if view.part.kind == "collect" %} export function {{ file.symbol }}() { return ( <form> {/* collects {{ render_value(view.part.collect.target.port.value, file.dependencies) }} */} <button type="submit">Submit</button> </form> ); } {% endif %} ``` The example uses semantic context only. Any `renderType`/`render_type` helper shown is a pack-owned macro/partial consuming the documented `TypeContext`, not hidden Dryv context. ## Audit questions - Can a real view.part pack generate code without parsing raw IR storage conventions? - Is any field here present only because the current IR happens to store it? - Does any nested item need first-class selection of its own? --- <!-- Source: https://docs.dryvcode.com/pack-builders/context/surface --> # surface ## Intent A delivery/presentation surface such as web, mobile, desktop, CLI, or embedded. Exact selection subject: ```yaml subject: surface ``` The current Runtime IR is evidence, not authority. Target improvements needed for a usable template contract are called out explicitly. ## Scope envelope | Scope | Context | | --------------------- | ---------------------------- | | `each` | `surface: SurfaceContext` | | `all` | `surfaces: SurfaceContext[]` | | collection candidates | `collects.group` | For `collects.<dimension>`, the singular collector is added beside the plural selected-subject array. A collector is valid only when ownership is semantically provable. ## Context tree | Context path | Type | Meaning / template use | | ---------------------- | ------------------------------------- | ---------------------------------------------------- | | `surface.id` | `string` | Opaque stable semantic identity. | | `surface.name` | `NameContext` | Stable semantic identity and finite naming variants. | | `surface.description` | `string\|null` | Human semantic description. | | `surface.tags` | `string[]` | Semantic classifiers; empty when none. | | `surface.explanations` | `ExplanationContext[]` | Advisory usage/security/implementation notes. | | `surface.group` | `SemanticLinkContext\|null` | Owning semantic group. | | `surface.kind` | `web\|mobile\|desktop\|cli\|embedded` | Structural kind. | | `surface.views` | `SemanticLinkContext[]` | Derived views presented on the surface. | | `surface.applications` | `SemanticLinkContext[]` | Derived applications including the surface. | ## Usage rules - `views` is a reverse index from view presentations; templates should not scan all views. - Do not add kind-specific fields until real packs prove them. ## Runtime IR implications to audit - Current surface variants should gain universal metadata. - Provide efficient reverse indexes for views/application membership. ## Template example — Handlebars / view registry ```hbs export const {{file.symbol}} = [ {{#each surface.views}} "{{name.pascal}}", {{/each}} ] as const; ``` The example uses semantic context only. Any `renderType`/`render_type` helper shown is a pack-owned macro/partial consuming the documented `TypeContext`, not hidden Dryv context. ## Audit questions - Can a real surface pack generate code without parsing raw IR storage conventions? - Is any field here present only because the current IR happens to store it? - Does any nested item need first-class selection of its own? --- <!-- Source: https://docs.dryvcode.com/pack-builders/context/expression --> # expression ## Intent A named renderer-neutral evaluable expression used by policies, defaults, invariants, and semantic conditions. Exact selection subject: ```yaml subject: expression ``` The current Runtime IR is evidence, not authority. Target improvements needed for a usable template contract are called out explicitly. ## Scope envelope | Scope | Context | | --------------------- | ------------------------------------ | | `each` | `expression: ExpressionContext` | | `all` | `expressions: ExpressionContext[]` | | collection candidates | `collects.group`, `collects.feature` | For `collects.<dimension>`, the singular collector is added beside the plural selected-subject array. A collector is valid only when ownership is semantically provable. ## Context tree | Context path | Type | Meaning / template use | | ---------------------------- | ----------------------------------------------------------------------------------------- | ---------------------------------------------------- | | `expression.id` | `string` | Opaque stable semantic identity. | | `expression.name` | `NameContext` | Stable semantic identity and finite naming variants. | | `expression.description` | `string\|null` | Human semantic description. | | `expression.tags` | `string[]` | Semantic classifiers; empty when none. | | `expression.explanations` | `ExplanationContext[]` | Advisory usage/security/implementation notes. | | `expression.group` | `SemanticLinkContext\|null` | Owning semantic group. | | `expression.feature` | `SemanticLinkContext\|null` | Canonical owning feature, when present. | | `expression.node` | `ExpressionNodeContext` | Normalized recursive AST root. | | `expression.node.kind` | `literal\|context\|duration\|comparison\|arithmetic\|logical\|unary\|function\|reference` | Explicit node discriminator. | | `expression.node.value` | `CanonicalValue\|ExpressionNodeContext\|null` | Literal/unary/function input. | | `expression.node.context` | `string\|null` | Named evaluation context. | | `expression.node.path` | `SemanticPathContext\|null` | Path inside named context. | | `expression.node.operator` | `string\|null` | Comparison/arithmetic/logical/unary operator. | | `expression.node.values` | `ExpressionNodeContext[]` | N-ary operands. | | `expression.node.left/right` | `ExpressionNodeContext\|null` | Binary comparison operands. | | `expression.node.function` | `string\|null` | Temporal function. | | `expression.node.time_zone` | `string\|null` | Timezone argument. | | `expression.node.duration` | `DurationContext\|null` | Duration literal. | | `expression.node.target` | `SemanticLinkContext\|null` | Reusable expression link. | ## Usage rules - Normalize structurally different current nodes into an explicit `kind` tree. - Recursive expression refs remain bounded unless a future request protocol explicitly expands them. ## Runtime IR implications to audit - Reusable expressions should gain consistent metadata/group ownership. - Provide a normalized inspectable node discriminator. ## Template example — Jinja / predicate ```jinja def {{ expression.name.snake }}(ctx): {% if expression.node.kind == "comparison" %} return {{ render_expression(expression.node.left) }} {{ render_operator(expression.node.operator) }} {{ render_expression(expression.node.right) }} {% endif %} ``` The example uses semantic context only. Any `renderType`/`render_type` helper shown is a pack-owned macro/partial consuming the documented `TypeContext`, not hidden Dryv context. ## Audit questions - Can a real expression pack generate code without parsing raw IR storage conventions? - Is any field here present only because the current IR happens to store it? - Does any nested item need first-class selection of its own? --- <!-- Source: https://docs.dryvcode.com/pack-builders/context/property-primitive --> # property.primitive ## Intent A reusable primitive semantic value suitable for validators, serializers, database mappings, SDK scalars, and value aliases. Exact selection subject: ```yaml subject: property.primitive ``` The current Runtime IR is evidence, not authority. Target improvements needed for a usable template contract are called out explicitly. ## Scope envelope | Scope | Context | | --------------------- | --------------------------------------------------- | | `each` | `property.primitive: PrimitivePropertyContext` | | `all` | `properties.primitives: PrimitivePropertyContext[]` | | collection candidates | `collects.group`, `collects.feature` | For `collects.<dimension>`, the singular collector is added beside the plural selected-subject array. A collector is valid only when ownership is semantically provable. ## Context tree | Context path | Type | Meaning / template use | | -------------------------------------------- | --------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | | `property.primitive.id` | `string` | Opaque stable semantic identity. | | `property.primitive.name` | `NameContext` | Stable semantic identity and finite naming variants. | | `property.primitive.description` | `string\|null` | Human semantic description. | | `property.primitive.tags` | `string[]` | Semantic classifiers; empty when none. | | `property.primitive.explanations` | `ExplanationContext[]` | Advisory usage/security/implementation notes. | | `property.primitive.group` | `SemanticLinkContext\|null` | Owning semantic group. | | `property.primitive.feature` | `SemanticLinkContext\|null` | Canonical owning feature, when present. | | `property.primitive.lifecycle` | `LifecycleContext` | Deprecation/removal semantics. | | `property.primitive.examples` | `CanonicalValue[]` | Valid examples. | | `property.primitive.type` | `string\|number\|boolean` | Structural discriminator. | | `property.primitive.kind` | `string\|null` | Refinement such as text, format, integer, decimal, float, double. | | `property.primitive.format` | `string\|null` | Named semantic format. For strings it's one of the canonical `StringFormat` values below. Number formats (such as `int32`) are separate. | | `property.primitive.money` | `MoneyContext\|null` | For `format: money`: `currency` (ISO 4217 or null) and `minor_units` (true when the amount counts cents). Null otherwise. | | `property.primitive.constraints.length` | `LengthContext\|null` | Exact/min/max length. | | `property.primitive.constraints.pattern` | `PatternContext\|null` | String matching rules. | | `property.primitive.constraints.range` | `RangeContext\|null` | Numeric min/max. | | `property.primitive.constraints.multiple_of` | `number\|null` | Numeric divisibility. | | `property.primitive.constraints.bits` | `integer\|null` | Integer width. | | `property.primitive.constraints.unsigned` | `boolean\|null` | Unsigned integer semantics. | | `property.primitive.constraints.precision` | `integer\|null` | Decimal precision. | | `property.primitive.constraints.scale` | `integer\|null` | Decimal scale. | ## Usage rules - Group constraints under one predictable subtree even though current IR spreads several values across the property root. - `type` is structural; `kind` is a refinement, not a semantic role. ## Runtime IR implications to audit - Properties should gain universal semantic metadata. - Consider normalizing primitive constraints canonically. ## Template example — Jinja / Python constrained scalar ```jinja {% if property.primitive.type == "string" %} {{ file.symbol }} = Annotated[ str, StringConstraints( min_length={{ property.primitive.constraints.length.min }}, max_length={{ property.primitive.constraints.length.max }}, ), ] {% endif %} ``` The example uses semantic context only. Any `renderType`/`render_type` helper shown is a pack-owned macro/partial consuming the documented `TypeContext`, not hidden Dryv context. ## Audit questions - Can a real property.primitive pack generate code without parsing raw IR storage conventions? - Is any field here present only because the current IR happens to store it? - Does any nested item need first-class selection of its own? ## String formats String formats are a closed vocabulary (`StringFormat`). Anything else is a text property with a `pattern`. `uuid`, `ulid`, `email`, `url`, `uri`, `hostname`, `ipv4`, `ipv6`, `phone` (loose), `e164` (strict), `slug`, `hex-color`, `base64`, `hex`, `jwt`, `semver`, `mime-type`, `locale`, `language-tag`, `country-code`, `currency-code`, `path`, `file-path`, `file-name`, `regex`, `html`, `markdown`, `json`, `yaml`, `xml`, `csv`. `uuid`, `ulid`, `base64`, `hex` and `jwt` are opaque: they can't carry length or pattern constraints. Dates and times are never string formats; use temporal properties. --- <!-- Source: https://docs.dryvcode.com/pack-builders/context/property-enum --> # property.enum ## Intent A reusable finite value set. Member names must be explicit so templates do not depend on dictionary-key iteration behavior. Exact selection subject: ```yaml subject: property.enum ``` The current Runtime IR is evidence, not authority. Target improvements needed for a usable template contract are called out explicitly. ## Scope envelope | Scope | Context | | --------------------- | ----------------------------------------- | | `each` | `property.enum: EnumPropertyContext` | | `all` | `properties.enums: EnumPropertyContext[]` | | collection candidates | `collects.group`, `collects.feature` | For `collects.<dimension>`, the singular collector is added beside the plural selected-subject array. A collector is valid only when ownership is semantically provable. ## Context tree | Context path | Type | Meaning / template use | | ------------------------------------ | --------------------------- | ---------------------------------------------------- | | `property.enum.id` | `string` | Opaque stable semantic identity. | | `property.enum.name` | `NameContext` | Stable semantic identity and finite naming variants. | | `property.enum.description` | `string\|null` | Human semantic description. | | `property.enum.tags` | `string[]` | Semantic classifiers; empty when none. | | `property.enum.explanations` | `ExplanationContext[]` | Advisory usage/security/implementation notes. | | `property.enum.group` | `SemanticLinkContext\|null` | Owning semantic group. | | `property.enum.feature` | `SemanticLinkContext\|null` | Canonical owning feature, when present. | | `property.enum.lifecycle` | `LifecycleContext` | Deprecation/removal semantics. | | `property.enum.examples` | `CanonicalValue[]` | Examples. | | `property.enum.ordered` | `boolean` | Whether member order is semantic. | | `property.enum.values` | `EnumValueContext[]` | Deterministic explicit members. | | `property.enum.values[].name` | `NameContext` | Member symbolic name. | | `property.enum.values[].value` | `string\|number\|boolean` | Serialized value. | | `property.enum.values[].title` | `string\|null` | Display title. | | `property.enum.values[].description` | `string\|null` | Member meaning. | ## Usage rules - Current `values` map becomes an array with explicit member names. - When `ordered=false`, output order is deterministic but carries no semantic meaning. ## Runtime IR implications to audit - Properties should gain universal metadata. - If `ordered=true`, canonical IR needs an explicitly preserved semantic order, not accidental map insertion order. ## Template example — Handlebars / TypeScript enum ```hbs export enum {{file.symbol}} { {{#each property.enum.values}} {{name.constant}} = "{{value}}", {{/each}} } ``` The example uses semantic context only. Any `renderType`/`render_type` helper shown is a pack-owned macro/partial consuming the documented `TypeContext`, not hidden Dryv context. ## Audit questions - Can a real property.enum pack generate code without parsing raw IR storage conventions? - Is any field here present only because the current IR happens to store it? - Does any nested item need first-class selection of its own? --- <!-- Source: https://docs.dryvcode.com/pack-builders/context/property-composite --> # property.composite ## Intent A reusable structured value object made of named fields plus invariants. Exact selection subject: ```yaml subject: property.composite ``` The current Runtime IR is evidence, not authority. Target improvements needed for a usable template contract are called out explicitly. ## Scope envelope | Scope | Context | | --------------------- | --------------------------------------------------- | | `each` | `property.composite: CompositePropertyContext` | | `all` | `properties.composites: CompositePropertyContext[]` | | collection candidates | `collects.group`, `collects.feature` | For `collects.<dimension>`, the singular collector is added beside the plural selected-subject array. A collector is valid only when ownership is semantically provable. ## Context tree This file defines the unique composite-property context. Its nested fields reuse the shared field-value contract. | Context path | Type | Meaning / template use | | --------------------------------- | --------------------------- | --------------------------------------------------------------------------------------- | | `property.composite.id` | `string` | Opaque stable semantic identity. | | `property.composite.name` | `NameContext` | Shared naming context from [README.md](/pack-builders/context/overview). | | `property.composite.description` | `string\|null` | Semantic description. | | `property.composite.tags` | `string[]` | Semantic tags. | | `property.composite.explanations` | `ExplanationContext[]` | Shared explanation context. | | `property.composite.group` | `SemanticLinkContext\|null` | Owning group link. | | `property.composite.feature` | `SemanticLinkContext\|null` | Canonical owning feature. | | | `property.composite.lifecycle` | `LifecycleContext` | Shared lifecycle context. | | `property.composite.examples` | `CanonicalValue[]` | Examples. | | `property.composite.fields` | `CompositeFieldContext[]` | Deterministic named fields. | | `property.composite.invariants` | `ExpressionContext[]` | Full contexts from [expression.md](/pack-builders/context/expression), demand-resolved. | ### CompositeFieldContext | Context path | Type | Meaning / template use | | -------------------------------------- | -------------------------- | -------------------------------------------------------------------------------- | | `property.composite.fields[].name` | `NameContext` | Field identity. | | `property.composite.fields[].value` | `SemanticValueContext` | Reuses [shared/semantic-value.md](/pack-builders/context/shared-semantic-value). | | `property.composite.fields[].optional` | `boolean` | Field-local optional presence. | | `property.composite.fields[].nullable` | `boolean` | Field-local nullable value. | | `property.composite.fields[].array` | `ArrayBoundsContext\|null` | Field-local array cardinality. | | `property.composite.fields[].tags` | `string[]` | Field-level tags. | ## Usage rules - Composite fields reuse `SemanticValueContext`; templates never inspect pointer prefixes and nested reusable properties/schemas keep their authoritative context contract. - Field maps become arrays with explicit names. ## Runtime IR implications to audit - Properties should gain universal metadata. - Provide a consistent type projection for property/schema-backed fields. ## Template example — Jinja / Python value object ```jinja @dataclass(frozen=True) class {{ file.symbol }}: {% for field in property.composite.fields %} {{ field.name.snake }}: {{ render_field_value(field.value) }} {% endfor %} ``` The example uses semantic context only. Any `renderType`/`render_type` helper shown is a pack-owned macro/partial consuming the documented `TypeContext`, not hidden Dryv context. ## Audit questions - Can a real property.composite pack generate code without parsing raw IR storage conventions? - Is any field here present only because the current IR happens to store it? - Does any nested item need first-class selection of its own? --- <!-- Source: https://docs.dryvcode.com/pack-builders/context/property-literal --> # property.literal ## Intent A reusable exact literal used for constants, discriminators, and protocol/domain markers. Exact selection subject: ```yaml subject: property.literal ``` The current Runtime IR is evidence, not authority. Target improvements needed for a usable template contract are called out explicitly. ## Scope envelope | Scope | Context | | --------------------- | ----------------------------------------------- | | `each` | `property.literal: LiteralPropertyContext` | | `all` | `properties.literals: LiteralPropertyContext[]` | | collection candidates | `collects.group`, `collects.feature` | For `collects.<dimension>`, the singular collector is added beside the plural selected-subject array. A collector is valid only when ownership is semantically provable. ## Context tree | Context path | Type | Meaning / template use | | ------------------------------- | ------------------------------- | ---------------------------------------------------- | | `property.literal.id` | `string` | Opaque stable semantic identity. | | `property.literal.name` | `NameContext` | Stable semantic identity and finite naming variants. | | `property.literal.description` | `string\|null` | Human semantic description. | | `property.literal.tags` | `string[]` | Semantic classifiers; empty when none. | | `property.literal.explanations` | `ExplanationContext[]` | Advisory usage/security/implementation notes. | | `property.literal.group` | `SemanticLinkContext\|null` | Owning semantic group. | | `property.literal.feature` | `SemanticLinkContext\|null` | Canonical owning feature, when present. | | `property.literal.lifecycle` | `LifecycleContext` | Deprecation/removal semantics. | | `property.literal.value.kind` | `string\|number\|boolean\|null` | Derived literal kind for weak template languages. | | `property.literal.value.value` | `CanonicalValue` | Exact canonical literal. | ## Usage rules - Expose a derived literal kind so Handlebars/Mustache do not need runtime type introspection. - Target quoting/escaping remains pack responsibility. ## Runtime IR implications to audit - Properties should gain universal metadata. - Provide a canonical literal-kind inspection projection. ## Template example — Handlebars / constant ```hbs export const {{file.symbol}} = {{#if (eq property.literal.value.kind "string") }}"{{property.literal.value.value}}"{{else}}{{property.literal.value.value}}{{/if}} as const; ``` The example uses semantic context only. Any `renderType`/`render_type` helper shown is a pack-owned macro/partial consuming the documented `TypeContext`, not hidden Dryv context. ## Audit questions - Can a real property.literal pack generate code without parsing raw IR storage conventions? - Is any field here present only because the current IR happens to store it? - Does any nested item need first-class selection of its own? --- <!-- Source: https://docs.dryvcode.com/pack-builders/context/property-union --> # property.union ## Intent A named semantic union suitable for sealed types, discriminated unions, serializers, and schema alternatives. Exact selection subject: ```yaml subject: property.union ``` The current Runtime IR is evidence, not authority. Target improvements needed for a usable template contract are called out explicitly. ## Scope envelope | Scope | Context | | --------------------- | ------------------------------------------- | | `each` | `property.union: UnionPropertyContext` | | `all` | `properties.unions: UnionPropertyContext[]` | | collection candidates | `collects.group`, `collects.feature` | For `collects.<dimension>`, the singular collector is added beside the plural selected-subject array. A collector is valid only when ownership is semantically provable. ## Context tree | Context path | Type | Meaning / template use | | ------------------------------- | --------------------------- | ---------------------------------------------------- | | `property.union.id` | `string` | Opaque stable semantic identity. | | `property.union.name` | `NameContext` | Stable semantic identity and finite naming variants. | | `property.union.description` | `string\|null` | Human semantic description. | | `property.union.tags` | `string[]` | Semantic classifiers; empty when none. | | `property.union.explanations` | `ExplanationContext[]` | Advisory usage/security/implementation notes. | | `property.union.group` | `SemanticLinkContext\|null` | Owning semantic group. | | `property.union.feature` | `SemanticLinkContext\|null` | Canonical owning feature, when present. | | `property.union.lifecycle` | `LifecycleContext` | Deprecation/removal semantics. | | `property.union.discriminant` | `NameContext` | Discriminator field name. | | `property.union.members` | `UnionMemberContext[]` | Named alternatives. | | `property.union.members[].name` | `NameContext` | Alternative name. | | `property.union.members[].type` | `TypeContext` | Alternative type. | ## Usage rules - Current member map becomes explicit named entries. - The discriminant is semantic; target annotation syntax is not. ## Runtime IR implications to audit - Properties should gain universal metadata. - Audit how each member's discriminant value is canonically represented so packs never infer it. ## Template example — Jinja / TypeScript union ```jinja export type {{ file.symbol }} = {% for member in property.union.members -%} | {{ render_type(member.type) }}{{ ";" if loop.last else "" }} {% endfor %} ``` The example uses semantic context only. Any `renderType`/`render_type` helper shown is a pack-owned macro/partial consuming the documented `TypeContext`, not hidden Dryv context. ## Audit questions - Can a real property.union pack generate code without parsing raw IR storage conventions? - Is any field here present only because the current IR happens to store it? - Does any nested item need first-class selection of its own? --- <!-- Source: https://docs.dryvcode.com/pack-builders/context/property-record --> # property.record ## Intent A reusable key/value mapping type. Exact selection subject: ```yaml subject: property.record ``` The current Runtime IR is evidence, not authority. Target improvements needed for a usable template contract are called out explicitly. ## Scope envelope | Scope | Context | | --------------------- | --------------------------------------------- | | `each` | `property.record: RecordPropertyContext` | | `all` | `properties.records: RecordPropertyContext[]` | | collection candidates | `collects.group`, `collects.feature` | For `collects.<dimension>`, the singular collector is added beside the plural selected-subject array. A collector is valid only when ownership is semantically provable. ## Context tree | Context path | Type | Meaning / template use | | ------------------------------ | --------------------------- | ---------------------------------------------------- | | `property.record.id` | `string` | Opaque stable semantic identity. | | `property.record.name` | `NameContext` | Stable semantic identity and finite naming variants. | | `property.record.description` | `string\|null` | Human semantic description. | | `property.record.tags` | `string[]` | Semantic classifiers; empty when none. | | `property.record.explanations` | `ExplanationContext[]` | Advisory usage/security/implementation notes. | | `property.record.group` | `SemanticLinkContext\|null` | Owning semantic group. | | `property.record.feature` | `SemanticLinkContext\|null` | Canonical owning feature, when present. | | `property.record.lifecycle` | `LifecycleContext` | Deprecation/removal semantics. | | `property.record.keys` | `TypeContext` | Allowed key type. | | `property.record.values` | `TypeContext` | Mapped value type. | ## Usage rules - Keep the tree semantic; no JavaScript/Python map spelling belongs here. ## Runtime IR implications to audit - Properties should gain universal metadata. ## Template example — Handlebars / TypeScript record ```hbs export type {{file.symbol}} = Record<{{renderType property.record.keys}}, {{renderType property.record.values}}>; ``` The example uses semantic context only. Any `renderType`/`render_type` helper shown is a pack-owned macro/partial consuming the documented `TypeContext`, not hidden Dryv context. ## Audit questions - Can a real property.record pack generate code without parsing raw IR storage conventions? - Is any field here present only because the current IR happens to store it? - Does any nested item need first-class selection of its own? --- <!-- Source: https://docs.dryvcode.com/pack-builders/context/property-tuple --> # property.tuple ## Intent A reusable ordered heterogeneous tuple. Exact selection subject: ```yaml subject: property.tuple ``` The current Runtime IR is evidence, not authority. Target improvements needed for a usable template contract are called out explicitly. ## Scope envelope | Scope | Context | | --------------------- | ------------------------------------------- | | `each` | `property.tuple: TuplePropertyContext` | | `all` | `properties.tuples: TuplePropertyContext[]` | | collection candidates | `collects.group`, `collects.feature` | For `collects.<dimension>`, the singular collector is added beside the plural selected-subject array. A collector is valid only when ownership is semantically provable. ## Context tree | Context path | Type | Meaning / template use | | ------------------------------ | --------------------------- | ---------------------------------------------------- | | `property.tuple.id` | `string` | Opaque stable semantic identity. | | `property.tuple.name` | `NameContext` | Stable semantic identity and finite naming variants. | | `property.tuple.description` | `string\|null` | Human semantic description. | | `property.tuple.tags` | `string[]` | Semantic classifiers; empty when none. | | `property.tuple.explanations` | `ExplanationContext[]` | Advisory usage/security/implementation notes. | | `property.tuple.group` | `SemanticLinkContext\|null` | Owning semantic group. | | `property.tuple.feature` | `SemanticLinkContext\|null` | Canonical owning feature, when present. | | `property.tuple.lifecycle` | `LifecycleContext` | Deprecation/removal semantics. | | `property.tuple.items` | `TupleItemContext[]` | Ordered elements. | | `property.tuple.items[].index` | `integer` | Canonical position. | | `property.tuple.items[].type` | `TypeContext` | Element type. | ## Usage rules - Tuple item order is semantic and must be preserved exactly. ## Runtime IR implications to audit - Properties should gain universal metadata. ## Template example — Jinja / TypeScript tuple ```jinja export type {{ file.symbol }} = [ {% for item in property.tuple.items %} {{ render_type(item.type) }}{{ "," if not loop.last else "" }} {% endfor %} ]; ``` The example uses semantic context only. Any `renderType`/`render_type` helper shown is a pack-owned macro/partial consuming the documented `TypeContext`, not hidden Dryv context. ## Audit questions - Can a real property.tuple pack generate code without parsing raw IR storage conventions? - Is any field here present only because the current IR happens to store it? - Does any nested item need first-class selection of its own? --- <!-- Source: https://docs.dryvcode.com/pack-builders/context/property-generic --> # property.generic ## Intent A reusable generic definition or a reusable application of another generic definition. Exact selection subject: ```yaml subject: property.generic ``` The current Runtime IR is evidence, not authority. Target improvements needed for a usable template contract are called out explicitly. ## Scope envelope | Scope | Context | | --------------------- | ----------------------------------------------- | | `each` | `property.generic: GenericPropertyContext` | | `all` | `properties.generics: GenericPropertyContext[]` | | collection candidates | `collects.group`, `collects.feature` | For `collects.<dimension>`, the singular collector is added beside the plural selected-subject array. A collector is valid only when ownership is semantically provable. ## Context tree | Context path | Type | Meaning / template use | | ------------------------------------------- | --------------------------- | ---------------------------------------------------- | | `property.generic.id` | `string` | Opaque stable semantic identity. | | `property.generic.name` | `NameContext` | Stable semantic identity and finite naming variants. | | `property.generic.description` | `string\|null` | Human semantic description. | | `property.generic.tags` | `string[]` | Semantic classifiers; empty when none. | | `property.generic.explanations` | `ExplanationContext[]` | Advisory usage/security/implementation notes. | | `property.generic.group` | `SemanticLinkContext\|null` | Owning semantic group. | | `property.generic.feature` | `SemanticLinkContext\|null` | Canonical owning feature, when present. | | `property.generic.lifecycle` | `LifecycleContext` | Deprecation/removal semantics. | | `property.generic.kind` | `definition\|application` | Structural variant. | | `property.generic.parameters` | `GenericParameterContext[]` | Definition parameters. | | `property.generic.parameters[].name` | `NameContext` | Parameter name. | | `property.generic.parameters[].description` | `string\|null` | Parameter meaning. | | `property.generic.value` | `TypeContext\|null` | Definition body. | | `property.generic.target` | `SemanticLinkContext\|null` | Generic definition referenced by an application. | | `property.generic.arguments` | `TypeContext[]` | Application arguments. | ## Usage rules - Definition/application remain one subject because they are structural forms of the same semantic concept. - Raw `#/properties/generics/...` is resolved to a semantic link. ## Runtime IR implications to audit - Properties should gain universal metadata. ## Template example — Handlebars / TypeScript generic ```hbs {{#if (eq property.generic.kind "definition")}} export type {{file.symbol}}<{{#each property.generic.parameters}}{{name.pascal}}{{#unless @last}}, {{/unless}}{{/each}}> = {{renderType property.generic.value}}; {{/if}} ``` The example uses semantic context only. Any `renderType`/`render_type` helper shown is a pack-owned macro/partial consuming the documented `TypeContext`, not hidden Dryv context. ## Audit questions - Can a real property.generic pack generate code without parsing raw IR storage conventions? - Is any field here present only because the current IR happens to store it? - Does any nested item need first-class selection of its own? --- <!-- Source: https://docs.dryvcode.com/pack-builders/context/property-temporal --> # property.temporal ## Intent A reusable temporal value such as date, instant, duration, interval, or zoned date-time. Exact selection subject: ```yaml subject: property.temporal ``` The current Runtime IR is evidence, not authority. Target improvements needed for a usable template contract are called out explicitly. ## Scope envelope | Scope | Context | | --------------------- | ------------------------------------------------ | | `each` | `property.temporal: TemporalPropertyContext` | | `all` | `properties.temporal: TemporalPropertyContext[]` | | collection candidates | `collects.group`, `collects.feature` | For `collects.<dimension>`, the singular collector is added beside the plural selected-subject array. A collector is valid only when ownership is semantically provable. ## Context tree | Context path | Type | Meaning / template use | | ----------------------------------------- | -------------------------------------------------------------------------------------------- | ---------------------------------------------------- | | `property.temporal.id` | `string` | Opaque stable semantic identity. | | `property.temporal.name` | `NameContext` | Stable semantic identity and finite naming variants. | | `property.temporal.description` | `string\|null` | Human semantic description. | | `property.temporal.tags` | `string[]` | Semantic classifiers; empty when none. | | `property.temporal.explanations` | `ExplanationContext[]` | Advisory usage/security/implementation notes. | | `property.temporal.group` | `SemanticLinkContext\|null` | Owning semantic group. | | `property.temporal.feature` | `SemanticLinkContext\|null` | Canonical owning feature, when present. | | `property.temporal.lifecycle` | `LifecycleContext` | Deprecation/removal semantics. | | `property.temporal.kind` | `date\|time\|date-time\|instant\|zoned-date-time\|duration\|interval\|year-month\|month-day` | Temporal kind. | | `property.temporal.precision` | `second\|millisecond\|microsecond\|null` | Precision when meaningful. | | `property.temporal.point` | `SemanticLinkContext\|null` | Interval point temporal type. | | `property.temporal.constraints.range` | `TemporalRangeContext\|null` | Min/max temporal bounds. | | `property.temporal.constraints.past` | `boolean\|DurationContext\|null` | Past-only rule. | | `property.temporal.constraints.future` | `boolean\|DurationContext\|null` | Future-only rule. | | `property.temporal.constraints.time_zone` | `string\|null` | Timezone rule. | ## Usage rules - Normalize temporal rules under `constraints` for a predictable tree. ## Runtime IR implications to audit - Properties should gain universal metadata. - Consider canonical normalization of temporal constraints. ## Template example — Jinja / Python temporal alias ```jinja {% if property.temporal.kind == "instant" %} {{ file.symbol }} = datetime {% elif property.temporal.kind == "date" %} {{ file.symbol }} = date {% endif %} ``` The example uses semantic context only. Any `renderType`/`render_type` helper shown is a pack-owned macro/partial consuming the documented `TypeContext`, not hidden Dryv context. ## Audit questions - Can a real property.temporal pack generate code without parsing raw IR storage conventions? - Is any field here present only because the current IR happens to store it? - Does any nested item need first-class selection of its own? --- <!-- Source: https://docs.dryvcode.com/pack-builders/context/pack --> # pack **Selectable subject:** no **Context root:** `pack` `pack` exposes only bounded configuration declared by the active pack. ## Context ```text pack.inputs.<declared-key> ``` Keys come from `dryv.pack.yaml inputs:`. Values come from the consuming project's root `dryv.yaml` pack activation or the pack-declared default. No undeclared key exists. Pack inputs are configuration, not Runtime IR semantics, and must never become an untyped options dictionary. Example: ```hbs export const packageName = "{{pack.inputs.package_name}}"; ``` Template analysis validates literal input keys against the loaded pack declaration. Context resolution resolves only requested keys. --- <!-- Source: https://docs.dryvcode.com/pack-builders/context/file --> # file Planning-derived additions: `file.dependency_groups` and `file.dependencies[].is_self`. See [derived.md](/pack-builders/context/derived#planned-generated-representations). **Selectable subject:** no **Context root:** `file` `file` is the authoritative renderer-facing metadata for one concrete `PlannedFileArtifact` from artifact planning. It is generation metadata, not Runtime IR semantics. A rendered template must use this context for facts already decided by pack planning—especially exported symbols, final paths, resolved generated representation dependencies, and barrel/export members—instead of reconstructing those facts from semantic names. ## Availability ```text one rendered PlannedFileArtifact → file: FileContext ``` A template invocation may expand to several files. Each rendered file receives its own `FileContext` while reusing the invocation's semantic context. Raw/static files are copied and do not need renderer context. ## Identity and source | Context path | Type | Meaning / template use | | ------------------ | -------------- | ------------------------------------------------------------------------------------- | | `file.template` | `string\|null` | Owning template registry key; null for a global resource outside a template boundary. | | `file.mode` | `rendered` | This context is supplied to a rendered concrete file. | | `file.source.path` | `string` | Pack-relative source resource path before rendering/output composition. | ## Planned output path | Context path | Type | Meaning / template use | | ----------------------- | -------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `file.path.pack` | `string` | Final pack-relative generated path after static/dynamic path composition and renderer-suffix removal. | | `file.path.workspace` | `string` | Final workspace/project-relative generated path after the usage output root is applied. | | `file.path.directory` | `string` | Derived directory of `file.path.workspace`; empty for a workspace-root file. | | `file.path.name` | `string` | Final generated filename including its target extension. | | `file.path.import_base` | `string\|null` | Import alias address of this file's destination root, ending in the separator (for example `#/modules/`), for addressing the pack's own static files. Null when no import alias applies. | Paths use Dryv portable `/` separators. The file context does not invent language-specific module specifiers. A TypeScript, Python, Dart, Rust, or other pack may transform a planned file path according to that ecosystem's import rules. ## Declared output symbols | Context path | Type | Meaning / template use | | -------------- | -------------------- | ------------------------------------------------------------------- | | `file.symbol` | `string\|null` | Exact resolved value of this template invocation's `output.symbol`. | | `file.symbols` | `map<string,string>` | Exact resolved named values from `output.symbols`; empty when none. | These values are planner authority. Dryv must **never** derive them again from: ```text schema.name operation.name property.enum.name filename target-language parsing ``` If a pack declares: ```yaml templates: entity: output: symbol: $(subject.name.pascal)Entity ``` and the selected schema is `User`, rendering receives: ```text schema.name.pascal = User file.symbol = UserEntity ``` The template therefore writes: ```hbs export class {{file.symbol}} { ... } ``` not: ```hbs export class {{schema.name.pascal}}Entity { ... } ``` This keeps the emitted declaration exactly synchronized with pack planning. ### Multiple named symbols If the pack declares: ```yaml output: symbols: model: $(subject.name.pascal) identifier: $(subject.name.pascal)Id ``` the template accesses: ```hbs export interface {{file.symbols.model}} {} export type {{file.symbols.identifier}} = string; ``` `file.symbol` remains null in this case. Dryv must not silently choose one named symbol as "primary." Artifact planning's initial carrier rule still applies: a symbol-bearing invocation must resolve to one unambiguous concrete symbol-carrying file. ## GeneratedArtifactReferenceContext Imports and exports reuse one generated-artifact reference contract. | Context path | Type | Meaning / template use | | ------------------ | ----------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `template` | `string\|null` | Producer template key. | | `path.pack` | `string` | Producer's planned pack-relative output path. | | `path.workspace` | `string` | Producer's planned workspace path. | | `path.relative` | `string` | Portable relative filesystem path from the current file's directory to the producer file, including the producer filename. | | `path.import_root` | `string\|null` | Producer path relative to its import root: the pack activation's `imports`, else its destination's, rooted at `imports.root` (destination-relative) or `imports.path` (project-relative). Null when no import alias applies. | | `path.prefixed` | `string\|null` | `path.import_root` shaped by `imports.separator` and `imports.extension` and prefixed with `imports.prefix` (for example `#/modules/users/user.dto.ts`, `app.users.models`, `crate::users::models`). Null when no import alias applies. | | `symbol` | `string\|null` | Producer's exact declared `output.symbol`. | | `symbols` | `map<string,string>` | Producer's exact named `output.symbols`. | | `subjects` | `SemanticLinkContext[]` | Canonical semantic subjects represented by the producer artifact. | `path.relative`, `path.import_root` and `path.prefixed` are facts derived from already-planned workspace paths. They are not target-language module specifiers until a pack renders them as one. ## Resolved generated dependencies | Context path | Type | Meaning / template use | | ---------------------------- | -------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | | `file.dependencies` | `GeneratedDependencyContext[]` | Resolved generated dependencies for this concrete file. | | `file.dependencies[].target` | `SemanticLinkContext` | Specific semantic reference in the consumer that caused this dependency. | | `file.dependencies[].pack` | `string` | Key of the pack that generated the dependency, such as `examples.zod`. Lets a template adapt to the bound provider without guessing from names. | | `file.dependencies[].slot` | `string\|null` | The bound slot for a dependency on another pack's file (`schema.validation`, …); null within one pack. | | `file.dependencies[]` | `GeneratedArtifactReferenceContext + target, pack, slot` | All other fields reuse the generated-artifact reference contract above. `path.relative` works across destinations. | These are **resolved generated representation dependencies**, not source-language import statements and not the pack's raw `imports:` eligibility list. The pack key `imports:` is retained because it declares which producer templates are eligible to satisfy generated references. Artifact planning resolves those declarations, including `#/needs/<slot>` imports through the project's `bind`, into `file.dependencies[]`. A dependency may later render as an ES import, Python import, Rust use, Dart import, fully-qualified reference, inline reference, or no emitted import syntax at all. artifact planning has already performed: ```text consumer semantic reference → allowed producer template → generated representation index → concrete producer file → declared producer symbol(s) ``` So a target pack may choose to render some dependencies as source-language imports, for example: ```hbs {{#each file.dependencies}} {{#if symbol}} import { {{symbol}} } from "{{path.relative}}"; {{/if}} {{/each}} ``` A real TypeScript pack may apply a small pack-owned path macro to remove/adjust the target extension. It must not recalculate the producer symbol. The same rule applies when semantic context later needs to mention a generated representation. For example, if: ```text schema field → semantic schema Customer resolved generated dependency → target = Customer → symbol = CustomerDto ``` the generated field type must use the resolved import symbol `CustomerDto`, not reconstruct `Customer` from `field.value.schema.name`. A pack may centralize this lookup in a macro/partial such as: ```text renderFieldValue(field.value, file.dependencies) ``` where semantic meaning comes from `field.value` and generated representation identity comes from the dependency entry whose `target` matches that semantic value. This lookup is pack template logic over explicit context; Dryv does not inject generated symbols into semantic subjects. ## Barrel/export members | Context path | Type | Meaning / template use | | -------------- | ------------------------------------- | -------------------------------------------------------------------------------------------------- | | `file.exports` | `GeneratedArtifactReferenceContext[]` | Deterministic producer stream already resolved by artifact planning for an export/barrel artifact. | The order is the artifact planning deterministic export order: 1. declared `exports` template-ref order; 2. stable artifact order within each producer; 3. deduplication only by identical artifact identity. Example: ```hbs {{#each file.exports}} {{#if symbol}} export { {{symbol}} } from "{{path.relative}}"; {{else}} export * from "{{path.relative}}"; {{/if}} {{/each}} ``` Again, symbol and path identity come from planning. ## Boundary with semantic context Use semantic context for software meaning: ```text schema.name schema.fields operation.inputs property.enum.values ``` Use `file` for generated-artifact facts: ```text file.symbol file.symbols file.path file.dependencies file.exports ``` Never add generated facts back onto semantic subjects: ```text schema.symbol # wrong schema.path # wrong operation.imports # wrong property.enum.file # wrong ``` ## Demand-driven materialization This file defines the complete available contract. A template using only: ```text file.symbol schema.fields ``` does not require Dryv to materialize `file.dependencies`, `file.exports`, trace metadata, or unused path variants. ## Runtime/planner implications artifact planning already requires the planner to know all underlying facts before rendering. The context vocabulary therefore does not create new semantic authority. It only exposes a renderer-facing projection of: - concrete planned file identity; - source/output paths; - exact declared output symbols; - resolved generated representation dependency edges; - resolved export stream; - represented subjects; - trace provenance. No rendered source parsing is allowed. ## Import aliases A code destination, or a single pack activation, declares how generated code addresses planned files: ```yaml destinations: modules: path: src/modules imports: { path: src, prefix: "#/" } # project-relative root: #/modules/..., #/types/... packs: generated-client: imports: { path: src/gen, prefix: "@gen" } # this pack's own alias overrides the destination's python-models: imports: { path: app, prefix: app, separator: ".", extension: strip } # app.users.models ``` `root` (destination-relative) and `path` (project-relative) are alternatives. Packs render `path.prefixed` for dependencies and `file.path.import_base` for their own static files, falling back to relative paths when no alias applies. The project maps each alias in its toolchain (for TypeScript, `tsconfig.json` `paths` and `package.json` `imports`). --- <!-- Source: https://docs.dryvcode.com/pack-builders/context/group --> # group **Selectable subject:** no A group is structural scope metadata. It is exposed when the generation partition is explicitly grouped by `collects.group`, or as the owner of a `collects.feature` partition. ## Availability ```text scope: collects.group → group: GroupContext scope: collects.feature → group: GroupContext feature: FeatureContext ``` ## Context tree | Context path | Type | Meaning / template use | | ------------------------ | --------------------------- | ----------------------------------------- | | `group.id` | `string` | Opaque stable semantic identity. | | `group.name` | `NameContext` | Group identity/naming. | | `group.description` | `string\|null` | Scope purpose. | | `group.tags` | `string[]` | Semantic metadata. | | `group.explanations` | `ExplanationContext[]` | Advisory metadata. | | `group.parent` | `SemanticLinkContext\|null` | Parent group link. | | `group.facets.http.root` | `string\|null` | HTTP scope root contributed by the group. | ## Deliberately excluded Do not embed: ```text group.children group.features group.schemas group.operations group.policies ... ``` The selected subject array already describes what this invocation is generating. Group metadata only describes the partition. ## Example ```jinja # package for {{ group.name.qualified }} ROUTE_ROOT = "{{ group.facets.http.root }}" ``` ## Runtime IR implications - Group identity/metadata remains canonical, but declaration membership should not leak into template context by default. --- <!-- Source: https://docs.dryvcode.com/pack-builders/context/feature --> # feature **Selectable subject:** no A feature is structural collection metadata for `collects.feature`. It describes the current partition; it does not recursively enumerate everything in the feature. ## Availability ```text scope: collects.feature → group: GroupContext feature: FeatureContext <selected-subject plural>: [...] ``` ## Context tree | Context path | Type | Meaning / template use | | ---------------------- | ---------------------- | -------------------------------- | | `feature.id` | `string` | Opaque stable semantic identity. | | `feature.name` | `NameContext` | Feature identity/naming. | | `feature.description` | `string\|null` | Feature purpose. | | `feature.tags` | `string[]` | Semantic metadata. | | `feature.explanations` | `ExplanationContext[]` | Advisory metadata. | | `feature.group` | `SemanticLinkContext` | Owning group link. | ## Deliberately excluded Do not expose membership lists such as: ```text feature.properties feature.schemas feature.operations feature.events feature.workflows feature.views ... ``` Those arrays can become extremely large and duplicate the selected-subject collection already present in the invocation. ## Example ```hbs // feature: {{feature.name.qualified}} // group: {{group.name.qualified}} export const featureName = "{{feature.name.local}}"; ``` ## Runtime IR implications - Keep feature identity and ownership canonical. - Artifact planning/Runtime inspection must provide deterministic feature partition identity without requiring templates to inspect feature membership. --- <!-- Source: https://docs.dryvcode.com/pack-builders/context/application --> # application **Selectable subject:** no `application` is global bounded metadata available to template invocations. It is not a selection subject and must not expand into the application's entire semantic graph. ## Availability ```text all template invocations → application: ApplicationContext ``` If Runtime IR contains multiple applications, usage/runtime resolution must identify one active application before this context can be materialized. Dryv must not select one by registry order. ## Context tree | Context path | Type | Meaning / template use | | ------------------------------ | --------------------------- | ----------------------------------- | | `application.id` | `string` | Opaque stable semantic identity. | | `application.name` | `NameContext` | Active application identity/naming. | | `application.description` | `string\|null` | Human purpose. | | `application.tags` | `string[]` | Semantic metadata. | | `application.explanations` | `ExplanationContext[]` | Advisory metadata. | | `application.group` | `SemanticLinkContext\|null` | Optional root/owning group link. | | `application.facets.http.root` | `string\|null` | Application HTTP scope root. | ## Deliberately excluded Do not expose aggregate membership here: ```text application.groups application.features application.schemas application.operations application.views application.surfaces ... ``` Those would turn global metadata into an enormous implicit context. ## Example ```hbs // {{application.name.qualified}} export const API_ROOT = "{{application.facets.http.root}}"; ``` ## Runtime IR implications - Generation usage/runtime needs an explicit active-application resolution when an IR contains more than one application. --- <!-- Source: https://docs.dryvcode.com/pack-builders/context/shared-overview --> # Shared contracts These files define reusable nested context contracts that are not independent selection subjects. A subject file must reference these contracts rather than copy their tables. | Context | File | Used by | | ---------------------- | ----------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | | `NameContext` | [name.md](/pack-builders/context/shared-name) | Every named semantic subject, field, port, enum value, generated metadata label and scoped owner. | | `SemanticLinkContext` | [semantic-link.md](/pack-builders/context/shared-semantic-link) | Bounded references to another semantic subject without recursively embedding it. | | `SemanticValueContext` | [semantic-value.md](/pack-builders/context/shared-semantic-value) | Schema/composite fields, operation/workflow ports, event payloads, and other semantic value carriers. Failure payloads intentionally use `TypeContext`. | | `ExplanationContext` | [explanation.md](/pack-builders/context/shared-explanation) | Advisory notes exposed on semantic subjects and structural metadata. | | `LifecycleContext` | [lifecycle.md](/pack-builders/context/shared-lifecycle) | Deprecation, removal and replacement metadata. | | `SemanticPathContext` | [semantic-path.md](/pack-builders/context/shared-semantic-path) | Renderer-friendly semantic paths. | Subject files should link to these contracts instead of repeating their fields. The searchable path-level index is [../catalog.md](/pack-builders/context/catalog). --- <!-- Source: https://docs.dryvcode.com/pack-builders/context/shared-name --> # NameContext `NameContext` is the shared renderer-facing shape for a semantic name. It is for semantic identity and naming variants, not for generated symbols. A template that needs the actual declaration emitted by the current file should use `file.symbol` or `file.symbols.<key>` from [../metadata/file.md](/pack-builders/context/file). ## Fields | Path | Type | Meaning | | ---------------- | -------- | ------------------------------------------------------------------------------ | | `name.raw` | `string` | Original semantic name before derived casing variants; never the subject `id`. | | `name.local` | `string` | Unqualified semantic name. | | `name.qualified` | `string` | Human-readable qualified identity, never JSON-pointer syntax. | | `name.camel` | `string` | `camelCase` local name. | | `name.pascal` | `string` | `PascalCase` local name. | | `name.snake` | `string` | `snake_case` local name. | | `name.kebab` | `string` | `kebab-case` local name. | | `name.constant` | `string` | `CONSTANT_CASE` local name. | | `name.title` | `string` | Human display title. | Only requested variants are calculated. ## Use Use semantic names for semantic intent: ```jinja {{ schema.name.pascal }} {{ field.name.camel }} {{ operation.name.kebab }} ``` Use file metadata for generated declarations: ```jinja {{ file.symbol }} {{ file.symbols.model }} ``` Do not reconstruct generated symbols from semantic names when `file.symbol` or `file.symbols` is available. Planning owns generated symbol identity. --- <!-- Source: https://docs.dryvcode.com/pack-builders/context/shared-explanation --> # Explanation `ExplanationContext` carries advisory notes attached to semantic subjects or structural metadata. ## Fields | Path | Type | Meaning | | ------ | --------------------------------------------------------------- | ------------------ | | `kind` | `info\|hint\|security\|usage\|implementation\|warning\|example` | Advisory category. | | `text` | `string` | Human explanation. | Explanations are documentation and generation guidance. They are not hidden policy, validation, ownership or routing rules. --- <!-- Source: https://docs.dryvcode.com/pack-builders/context/shared-lifecycle --> # Lifecycle `LifecycleContext` exposes deprecation and removal metadata for reusable semantic subjects. ## Fields | Path | Type | Meaning | | ------------- | ---------------------------------------------------------------------------- | ------------------------------------- | | `deprecated` | `boolean` | Deprecated state. | | `since` | `string\|null` | Deprecation version or epoch. | | `reason` | `string\|null` | Human reason for the lifecycle state. | | `replaced_by` | [`SemanticLinkContext`](/pack-builders/context/shared-semantic-link)`\|null` | Replacement subject, when known. | | `removed` | `boolean` | Removed-but-retained semantic state. | Templates may use lifecycle metadata for comments, generated annotations or compatibility shims. It must not change canonical semantic meaning. --- <!-- Source: https://docs.dryvcode.com/pack-builders/context/shared-semantic-link --> # Semantic link `SemanticLinkContext` is a bounded link to another semantic subject. It lets templates compare or name a related subject without forcing Dryv to materialize that subject's full context. ## Fields | Path | Type | Meaning | | --------- | --------------------------------------------------- | ---------------------------------------------------------------------------------- | | `id` | `string` | Opaque stable semantic identity. Templates may compare it but must never parse it. | | `subject` | `SubjectName` | Exact target subject, such as `schema`, `operation` or `property.enum`. | | `name` | [`NameContext`](/pack-builders/context/shared-name) | Resolved target naming. | Links are deliberately not recursive. If a template needs the complete target context, that complete context must be requested through the documented subject path that owns it. --- <!-- Source: https://docs.dryvcode.com/pack-builders/context/shared-semantic-path --> # Semantic path `SemanticPathContext` is a renderer-friendly semantic path. ## Fields | Path | Type | Meaning | | ---------- | ---------- | --------------------------------------------- | | `segments` | `string[]` | Canonical path segments. | | `dotted` | `string` | Derived readable path for templates and docs. | Templates should treat the path as display or generated-code input. They should not parse Runtime IR JSON pointers. --- <!-- Source: https://docs.dryvcode.com/pack-builders/context/shared-semantic-value --> # Semantic value Derived additions: `value.is.*` classification flags and `value.generated` planned representations. See [derived.md](/pack-builders/context/derived). **Used by:** schema/composite fields, operation/workflow ports, event payloads, and other ValueRef-like semantic carriers This is the authoritative contract for a reusable semantic value carried by a field, port, event payload, result, or similar ValueRef-like semantic carrier. A field value is not a "constraint" and not an ambiguous reference. It has one explicit structural kind: ```text property schema unknown dynamic ``` Carrier-local semantics stay on the owning context. For example, field optionality/nullability/array/default/relation/query rules remain on a field; port ordering/direction stays on the port. ## Context tree | Context path | Type | Meaning | | ---------------- | ------------------------------------ | ------------------------------------------------------------------------------------------ | | `value.kind` | `property\|schema\|unknown\|dynamic` | Primary field-value discriminator. | | `value.property` | `PropertySemanticValueContext\|null` | Reusable property meaning when `kind=property`. | | `value.schema` | `SchemaContext\|null` | Full schema context from [../schema.md](/pack-builders/context/schema) when `kind=schema`. | No nested payload exists for `unknown` or `dynamic`. ## PropertySemanticValueContext A property-backed field has a second discriminator because reusable properties have several semantic kinds: | Context path | Type | Meaning | | -------------------------- | ------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------- | | `value.property.kind` | `primitive\|enum\|composite\|literal\|union\|record\|tuple\|generic\|temporal` | Exact reusable-property kind. | | `value.property.primitive` | `PrimitivePropertyContext\|null` | Full context from [../property.primitive.md](/pack-builders/context/property-primitive). | | `value.property.enum` | `EnumPropertyContext\|null` | Full context from [../property.enum.md](/pack-builders/context/property-enum). | | `value.property.composite` | `CompositePropertyContext\|null` | Full context from [../property.composite.md](/pack-builders/context/property-composite). | | `value.property.literal` | `LiteralPropertyContext\|null` | Full context from [../property.literal.md](/pack-builders/context/property-literal). | | `value.property.union` | `UnionPropertyContext\|null` | Full context from [../property.union.md](/pack-builders/context/property-union). | | `value.property.record` | `RecordPropertyContext\|null` | Full context from [../property.record.md](/pack-builders/context/property-record). | | `value.property.tuple` | `TuplePropertyContext\|null` | Full context from [../property.tuple.md](/pack-builders/context/property-tuple). | | `value.property.generic` | `GenericPropertyContext\|null` | Full context from [../property.generic.md](/pack-builders/context/property-generic). | | `value.property.temporal` | `TemporalPropertyContext\|null` | Full context from [../property.temporal.md](/pack-builders/context/property-temporal). | Exactly one property-kind branch is active and it must match `value.property.kind`. The nested property context is the **same context contract** used when that property is selected directly. It is not a reduced copy and must not be redefined here. ## Property example A decimal property field conceptually exposes: ```text field.value.kind property field.value.property.kind primitive field.value.property.primitive → full PrimitivePropertyContext including: type = number kind = decimal constraints.precision constraints.scale constraints.range ... ``` A database-model template can therefore read: ```hbs {{#if (eq field.value.property.kind "primitive")}} {{#if (eq field.value.property.primitive.kind "decimal")}} precision: {{field.value.property.primitive.constraints.precision}}, scale: {{field.value.property.primitive.constraints.scale}} {{/if}} {{/if}} ``` without performing a second registry lookup. ## Schema example A field carrying another schema exposes: ```text field.value.kind = schema field.value.schema = full SchemaContext ``` A template can use only identity: ```hbs {{field.name.camel}}: {{field.value.schema.name.pascal}}; ``` or explicitly request deeper nested schema facts if its generation genuinely needs them. The full `SchemaContext` contract is reused from [../schema.md](/pack-builders/context/schema); it is not copied here. ## Unknown and dynamic ```text unknown concrete value type is intentionally unspecified/opaque dynamic runtime value is intentionally permitted to vary ``` Target packs choose their target-language representation. Dryv does not convert either one into a fake property/schema reference. ## Demand-driven and recursive safety "Full context of X" defines the available typed vocabulary, not eager expansion. If a template requests only: ```text schema.fields.*.value.schema.name.pascal ``` Dryv only needs the nested schema name. If a template explicitly requests nested fields, those paths may be materialized under the same `SchemaContext` contract. Template analysis and context resolution must keep reference expansion bounded and cycle-safe so schema↔schema or composite↔composite relationships cannot recursively explode context. ## Runtime IR implications The current IR already distinguishes field kinds: ```text property schema unknown dynamic ``` That distinction should remain canonical. What needs improvement is the inspection/context layer: - property references must resolve to the complete matching reusable-property semantic context; - schema references must resolve to the same `SchemaContext` vocabulary; - templates must not parse reference prefixes to discover which one they received; - field-local usage semantics must remain separate from reusable value-definition semantics. ## Reuse outside fields The same contract is reused unchanged: ```text SchemaFieldContext.value CompositeFieldContext.value OperationPortContext.value WorkflowPortContext.value EventContext.payload ``` A carrier never replaces this rich semantic value with a bare link merely because it is not a schema field. --- <!-- Source: https://docs.dryvcode.com/authoring --> # Authoring Authoring is where you **describe meaning**. You declare what your software _is_ (typed structures, what can happen, who may do it, what it emits) and nothing about how any framework represents it. Packs turn that meaning into code. ```mermaid flowchart LR A["TypeScript<br/>@dryvcode/author"] --> C["Compiler<br/>dryv-ts"] B["Python<br/>dryv-author"] --> D["Compiler<br/>dryv-py"] C --> IR["Canonical<br/>Runtime IR"] D --> IR IR --> P["Packs<br/>NestJS · FastAPI · Next.js · Flutter ..."] P --> F["Generated code"] ``` Both languages describe the **same concepts** and compile to the **same IR**, so you can pick the language your team already writes and still use every pack. ## What you describe | Concept | In one line | Reference | | ------------------- | ---------------------------------------------------------------- | ---------------------------------------------- | | **Property** | A reusable value type: `string.uuid`, an enum, a union, a date | [Properties](/authoring/vocabulary/properties) | | **Schema** | Typed structure built from fields: entities, requests, responses | [Schemas](/authoring/vocabulary/schemas) | | **Operation** | What happens: one input, one output, failures, events | [Operations](/authoring/vocabulary/operations) | | **Event** | A business occurrence with an optional payload | [Events](/authoring/vocabulary/events) | | **Failure** | A named, typed way an operation can fail | [Operations](/authoring/vocabulary/operations) | | **Policy** | A reusable rule or required context, not a framework guard | [Policies](/authoring/vocabulary/policies) | | **Workflow** | Orchestration over operations and events | [Workflows](/authoring/vocabulary/workflows) | | **View** | A user-facing composition of parts on a surface | [Views](/authoring/vocabulary/views) | | **Group / feature** | Ownership and registration scopes | [Groups](/authoring/vocabulary/groups) | Start with the [Quick start](/authoring/quick-start), then keep the [Cookbook](/authoring/cookbook) open while you work. The [canonical vocabulary](/authoring/vocabulary/canonical) is the full reference. ## Rules that keep authoring honest - **Register before you reference.** A reusable declaration must be registered on a group before another declaration can use it. Registration returns a lightweight typed _ref_. - **Meaning, not representation.** Say "this field is a UUID and is generated by the system", not "this column is `uuid` with a default". Packs decide the representation. - **Names are semantic.** Group, app and registration names never contain `.`; the compiler qualifies identities (`users` + `User` becomes `users.User`). - **One input, one output.** An operation takes a single input (a schema or named fields) and returns a single output. - **No hidden conventions.** If generated code needs a fact, there is a place in the model to state it. ## Agents Authoring is deliberately explicit, so agents do well with it. Run `dryv docs authoring` for the built-in tips and `dryv docs agents` for the working rules. --- <!-- Source: https://docs.dryvcode.com/authoring/quick-start --> # Quick start ## 1. Install TypeScript: ```bash npm install -D @dryvcode/author @dryvcode/compiler curl -fsSL https://dryvcode.com/install.sh | sh ``` Python 3.11+: ```bash uv add --dev dryv-author dryv-compiler curl -fsSL https://dryvcode.com/install.sh | sh ``` The `install.sh` line installs the `dryv` CLI. Today it has a Linux x64 build only; see [Installation](/docs/usage/installation) for other options. The TypeScript compiler loads `.ts` files directly, so use Node 22.18+ or Bun, and erasable TypeScript only (no `enum`, no `namespace`). ## 2. Declare something ```ts // dryv/contracts/index.ts import { body, dryv, field, http, operation, property, respond, schema, storage, } from "@dryvcode/author"; const shop = dryv.group({ name: "shop" }); const values = shop.properties({ Id: property.string.uuid(), Name: property.string(), }); const schemas = shop.schemas({ Product: schema({ id: field(values.Id).system(), name: field(values.Name), }).facets({ storage: storage("products").primaryKey("id") }), }); const CreateProduct = operation() .role("create") .input(schemas.Product) .output(schemas.Product); CreateProduct.facets({ http: http("POST", "/products") .input(CreateProduct.in, body()) .output(CreateProduct.out, respond(201)), }); shop.operations({ CreateProduct }); export default dryv.app({ name: "shop" }).groups(shop); ``` The Python version uses the same concepts with Pythonic names. See the [Python author](/authoring/sdk/python) and the TypeScript to Python table there. ## 3. Point a project at it ```bash dryv init --author typescript --author-path dryv/contracts/index.ts --yes ``` `dryv init` also writes `dryv/README.md` and an `AGENTS.md` block so people and agents know how the project works. ## 4. Compile, validate, plan ```bash dryv build # compile your contracts to Runtime IR dryv validate # check it against the engine dryv plan # see which files would be generated (writes nothing) ``` If `dryv build` fails, the error points at the line of your contract. See [Troubleshooting](/authoring/troubleshooting). ## Where next - [A CRUD resource](/authoring/cookbook/crud-resource): the full pattern with projections and HTTP - [Conventions](/authoring/conventions): naming and structure that scale - [TypeScript author](/authoring/sdk/typescript): every helper --- <!-- Source: https://docs.dryvcode.com/authoring/conventions --> # Conventions ## Naming | Thing | Convention | Example | | ---------------------------- | ------------------------------------------------------ | ------------------------------ | | Group, app, registration key | No `.`; PascalCase for declarations, camelCase for app | `core`, `UserProfile` | | Properties | Describe the _value_, not the field | `UserId`, `Email`, `Timestamp` | | Schema fields | camelCase | `externalCustomerId` | | Operations | Verb then noun | `CreateUser`, `ListUsers` | | Events | Past tense | `UserCreated` | | Policies | Describe the requirement | `CurrentUser`, `CanRead` | Packs derive every casing (`kebab`, `snake`, `pascal`, `camel`) from the semantic name, so choose a name that reads well as plain words. See [Naming](/authoring/vocabulary/naming) for the formal rules. ## Structure - **One group per bounded area** (`users`, `billing`) and **features** inside it when you need a finer registration scope. A declaration belongs to one group and at most one feature. - **Shared values in a `shared` group** (`Id`, `Email`, `Timestamp`) so every schema reuses one definition. - **Separate the stored shape from the API shapes.** Declare one `entity` schema with a `storage` facet, then derive `UserRead`, `CreateUserRequest`, `UpdateUserRequest` and `UserQuery` with projections instead of copying fields. - **Give operations a `role`** (`create`, `detail`, `list`, `update`, `delete`). Packs use roles to choose HTTP verbs, status codes and handler shapes. ## Modelling habits 1. **Mark system fields** (`.system()`): ids and timestamps the client must not send. 2. **State query ability on the field** (`.query({ filter: ["equal"], sort: true })`) instead of in the API layer. 3. **Prefer registered properties to inline types** so constraints live in one place. 4. **Say what is sensitive** (`.sensitive()`), so packs can redact it in logs and docs. 5. **Declare failures and events** an operation can produce; packs map them to error responses and messages. 6. **Keep policies semantic.** A policy says "needs a current user with an id"; it is not middleware. ## What not to do - Do not put framework concepts (decorators, column types, controllers) in contracts. - Do not reference a raw definition: register it first. - Do not encode behaviour in names that packs must parse. - Do not rely on file order or hidden defaults. If a pack needs a fact, state it. --- <!-- Source: https://docs.dryvcode.com/authoring/troubleshooting --> # Troubleshooting Start with `dryv doctor`, then `dryv build` for compile errors with source locations, then `dryv validate` for engine checks. Use `--json --no-input` to read structured diagnostics. | Symptom | Likely cause | Fix | | ---------------------------------------------- | ----------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ | | `Cannot reference an unregistered declaration` | A raw `property.*()` or `schema()` was passed to `field(...)` | Register it on a group first: `const values = group.properties({ Id })`, then `field(values.Id)` | | Compile error on `enum` or `namespace` | Node strips types but does not compile them | Use string-literal unions or `property.enum({...})` | | `DRYV_TRUST_REQUIRED` | Your compiler is project code and has not been trusted | Run `dryv trust` once in the project (CI never trusts automatically) | | Author or compiler "incompatible" | Mismatched versions | Install matching versions of the author and compiler (`>=0.1.0 <0.2`) | | Identity contains `.` | A group, app or registration name has a dot | Rename it; `.` is reserved for compiler qualification | | Operation fails validation | More than one input or output | Use one schema or named fields as the input, and one output | | Scoped operation rejected | The target is not a persisted field, or the policy does not provide the named value | Check [Scoped operations](/authoring/cookbook/scoped-operations) | | `unknown command 'context'` | An older global `dryv` | Update the CLI: see [CLI for pack builders](/pack-builders/cli) | ## Reading a diagnostic Diagnostics carry a stable code, the artifact (your contract file), a source location and a human message. `dryv explain change` and `dryv why <path>` explain _generation_; they do not explain compile errors. For compile errors, fix the line the diagnostic points to, then run `dryv build` again. --- <!-- Source: https://docs.dryvcode.com/authoring/cookbook --> # Cookbook Each recipe states a problem, shows code that compiles with `@dryvcode/author`, and explains why. The patterns come from the maintained `core-journey` example project in the repository (`sdk/_examples/projects/core-journey`), which is generated and tested end to end. | Recipe | Solves | | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------- | | [A CRUD resource](/authoring/cookbook/crud-resource) | Entity, read/create/update/query shapes, five operations, HTTP | | [Properties, enums and validation](/authoring/cookbook/properties-and-validation) | Reusable value types, constraints, enums, unions, optional and array fields | | [Relations between schemas](/authoring/cookbook/relations) | Foreign keys, cardinality, delete behaviour | | [Policies and access](/authoring/cookbook/policies-and-access) | Authentication, rules, scope policies | | [Scoped operations](/authoring/cookbook/scoped-operations) | Constrain records to a tenant or owner | | [Events and workflows](/authoring/cookbook/events-and-workflows) | Events, failures and who listens | | [Storage and projections](/authoring/cookbook/storage-and-projections) | Storage facets, indexes, derived shapes | > [!TIP] > Every recipe is TypeScript. The Python author has the same concepts with Pythonic names; use the [TypeScript to Python table](/authoring/sdk/python) to translate. --- <!-- Source: https://docs.dryvcode.com/authoring/cookbook/crud-resource --> # A CRUD resource **Problem.** You need a `User` that is stored, created, read, updated, listed and deleted, without copying the field list five times. **Pattern.** One stored _entity_ schema, several _projections_ of it, and one operation per role. ```ts import { body, dryv, field, http, operation, path, projection, property, queryObject, respond, schema, storage, } from "@dryvcode/author"; const core = dryv.group({ name: "core" }); const values = core.properties({ UserId: property.string.uuid(), DisplayName: property.string(), Timestamp: property.string(), Count: property.number.integer({ range: { min: 0 } }), UserStatus: property.enum({ active: "active", suspended: "suspended" }), }); const userManagement = core.feature("UserManagement"); // 1. The stored shape: the single source of truth for fields const stored = userManagement.schemas({ UserProfile: schema({ id: field(values.UserId) .system() .query({ filter: ["equal"] }), displayName: field(values.DisplayName).query({ filter: ["equal"] }), status: field(values.UserStatus).optional(), createdAt: field(values.Timestamp) .system() .query({ filter: ["equal"] }), }) .role("entity") .facets({ storage: storage("UserStore").primaryKey("id") }), }); // 2. API shapes derived from it const users = userManagement.schemas({ UserRead: schema({}).projection( projection(stored.UserProfile) .read() .pick("id", "displayName", "status", "createdAt"), ), CreateUserRequest: schema({}).projection( projection(stored.UserProfile).create().pick("displayName", "status"), ), UpdateUserRequest: schema({}).projection( projection(stored.UserProfile).edit().pick("displayName", "status"), ), UserQuery: schema({}).projection( projection(stored.UserProfile) .query() .pick("id", "displayName", "createdAt") .rename({ id: "userId" }) .usage({ userId: { optional: true }, displayName: { optional: true }, createdAt: { optional: true }, }), ), UserPage: schema({ items: field(stored.UserProfile).array(), total: field(values.Count), }).role("response"), }); // 3. One operation per role const CreateUser = operation() .role("create") .input(users.CreateUserRequest) .output(users.UserRead); const GetUser = operation() .role("detail") .input({ id: values.UserId }) .output(users.UserRead); const ListUsers = operation() .role("list") .input(users.UserQuery) .output(users.UserPage); const UpdateUser = operation() .role("update") .input({ id: values.UserId, update: users.UpdateUserRequest }) .output(users.UserRead); const DeleteUser = operation().role("delete").input({ id: values.UserId }); // 4. Transport is a facet, not part of the operation's meaning CreateUser.facets({ http: http("POST", "/users") .input(CreateUser.in, body()) .output(CreateUser.out, respond(201)), }); GetUser.facets({ http: http("GET", "/users/{id}") .input(GetUser.in.id, path("id")) .output(GetUser.out, respond(200)), }); ListUsers.facets({ http: http("GET", "/users") .input(ListUsers.in, queryObject()) .output(ListUsers.out, respond(200)), }); UpdateUser.facets({ http: http("PATCH", "/users/{id}") .input(UpdateUser.in.id, path("id")) .input(UpdateUser.in.update, body()) .output(UpdateUser.out, respond(200)), }); DeleteUser.facets({ http: http("DELETE", "/users/{id}").input(DeleteUser.in.id, path("id")), }); userManagement.operations({ CreateUser, GetUser, ListUsers, UpdateUser, DeleteUser, }); export default dryv .app({ name: "coreJourney" }) .groups(core) .facets({ http: { root: "/api" } }); ``` ## Why it is shaped this way | Choice | Reason | | -------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | | `.system()` on `id` and `createdAt` | Clients must not send them; the `create` and `edit` projections leave them out automatically | | `projection(...).read() / .create() / .edit() / .query()` | The purpose tells packs what the shape is for (a response, a request body, a patch, a filter) | | `.rename({ id: "userId" })` | The query shape can use friendlier names without forking the entity | | `.usage({ ... optional })` | Query parameters are optional even when the stored field is required | | `role("create" \| "detail" \| "list" \| "update" \| "delete")` | Packs choose HTTP verbs, status codes and handler shapes from roles | | HTTP as a `facet` | The same operation can later gain a queue or CLI facet without changing meaning | ## Try it Copy the file into `dryv/contracts/index.ts`, then: ```bash dryv build && dryv validate && dryv plan ``` The maintained, tested version of this example lives in `sdk/_examples/projects/core-journey` in the repository. --- <!-- Source: https://docs.dryvcode.com/authoring/cookbook/properties-and-validation --> # Properties, enums and validation **Problem.** The same value (an email, a money amount, a status) appears in many schemas and must always mean the same thing. **Pattern.** Declare each value once as a registered _property_, then reuse it with `field(...)`. ```ts import { dryv, field, property, schema } from "@dryvcode/author"; const shared = dryv.group({ name: "shared" }); const base = shared.properties({ Id: property.string.uuid(), Email: property.string.email(), Name: property.string(), Count: property.number.nonNegativeInteger(), Active: property.literal("active"), CreatedAt: property.temporal.instant().precision("millisecond"), Status: property.enum({ active: "active", suspended: "suspended" }), }); ``` ## Combine values ```ts const advanced = shared.properties({ Coordinates: property.composite({ x: field(base.Count), y: field(base.Count), }), Identifier: property.union({ discriminant: "kind", members: { id: base.Id, active: base.Active }, }), Pair: property.tuple(base.Id, base.Active), Labels: property.record(base.Id, base.Name), Box: property.generic.define((T) => property.composite({ value: field(T) })), }); ``` ## Shape a field ```ts const users = dryv.group({ name: "users" }); const schemas = users.schemas({ User: schema({ id: field(base.Id).system(), email: field(base.Email) .optional() .nullable() .query({ filter: ["equal", "contains"], sort: true, search: true }), names: field(base.Name).array({ min: 1 }), status: field(base.Status).default("active"), secret: field(base.Name).sensitive(), }), }); ``` | Helper | Meaning | | ---------------------------------- | ------------------------------------------------------------- | | `.required()` / `.optional()` | Presence in requests and storage | | `.nullable()` | Value may be `null` (different from absent) | | `.array({ min, max })` | A list of the value | | `.default(...)` | Default when not supplied | | `.system()` / `.createOnly()` | Generated by the system / settable only on creation | | `.query({ filter, sort, search })` | Which operations clients may use against the field | | `.sensitive()` | Mark data packs should treat carefully (logs, docs, examples) | ## Notes - There are no reusable `unknown` or `dynamic` registries: `unknown()` and `dynamic()` are intrinsic and stay inline. - Properties never carry framework types. A pack decides that `property.string.uuid()` becomes `Guid`, `uuid.UUID` or `String`. - A generic is _defined_ once and _applied_ with registered arguments: `property.generic.apply(advanced.Box, [schemas.User])`. --- <!-- Source: https://docs.dryvcode.com/authoring/cookbook/relations --> # Relations between schemas **Problem.** An `Order` belongs to a `Customer`. Packs need to know the target, how many, and what happens on delete. ```ts import { dryv, field, property, relation, schema, storage, } from "@dryvcode/author"; const shared = dryv.group({ name: "shared" }); const values = shared.properties({ Id: property.string.uuid(), Name: property.string(), }); const sales = dryv.group({ name: "sales" }); const schemas = sales.schemas({ Customer: schema({ id: field(values.Id).system(), name: field(values.Name), }).facets({ storage: storage("customers").primaryKey("id") }), }); sales.schemas({ Order: schema({ id: field(values.Id).system(), customerId: field(values.Id).relation({ target: () => schemas.Customer.field("id"), cardinality: relation.manyToOne(), onDelete: relation.restrict(), }), }).facets({ storage: storage("orders").primaryKey("id") }), }); ``` ## Point at a field, not a column `schemas.Customer.field("id")` is a _semantic_ field reference. The compiler emits `{ $ref: <schema>, field: "id" }`, never a physical column path. A pack renders it as a foreign key, a reference, a join or a link, depending on the stack. ## Relate to an abstract base ```ts const entities = sales.schemas({ Entity: schema({ id: field(values.Id) }).abstract(), }); sales.schemas({ Membership: schema({ ownerId: field(values.Id).relation({ target: () => entities.Entity.field("id"), cardinality: relation.manyToOne(), onDelete: relation.restrict(), }), }), }); ``` Abstract schemas contribute shared fields and storage rules without being stored themselves. Remember to compose every group into the app, including the shared one that owns the properties: ```ts export default dryv.app({ name: "sales" }).groups(shared, sales); ``` ## Choosing behaviour | Option | Use it to say | | ---------------------- | ------------------------------------------------ | | `relation.manyToOne()` | Many of this schema point to one target | | `relation.restrict()` | Block deleting a target that is still referenced | Check [Schemas](/authoring/vocabulary/schemas) for the full list of cardinalities and delete behaviours. --- <!-- Source: https://docs.dryvcode.com/authoring/cookbook/policies-and-access --> # Policies and access **Problem.** Some operations need a signed-in user, some need ownership, some need a tenant. You want that stated once, in meaning. **Pattern.** Declare a _policy_ (what it requires and provides, and optionally a rule) and attach it to operations, groups or the app. ```ts import { context, dryv, expression, field, operation, policy, property, schema, } from "@dryvcode/author"; const users = dryv.group({ name: "users" }); const values = users.properties({ UserId: property.string.uuid() }); const schemas = users.schemas({ User: schema({ id: field(values.UserId).system() }), }); // A reusable boolean rule from a closed vocabulary const expressions = users.expressions({ IsOwner: expression.equal( context("actor", "id"), context("resource", "ownerId"), ), }); const policies = users.policies({ // Authentication: provides the current user's id to operations that require it CurrentUser: policy() .role("authentication") .provides({ userId: values.UserId }), // Authorization: what the caller and the record must look like, and the rule that decides CanRead: policy() .requires({ actor: schemas.User, resource: schemas.User }) .provides({ id: values.UserId }) .rule(expressions.IsOwner), }); const GetMe = operation() .role("detail") .input({ id: values.UserId }) .output(schemas.User) .requires(policies.CurrentUser, policies.CanRead); ``` ## Scope a policy to many things ```ts users.policies(policies.CurrentUser); // every declaration in the group dryv.app({ name: "example" }).groups(users).policies(policies.CurrentUser); // the whole application ``` Authoring records only the _declared_ scope. Working out what is effectively inherited is the runtime's job. ## What Dryv does and does not do - Dryv records the requirement and the rule, so packs can generate guards, checks or documentation. - Dryv does **not** evaluate policies at runtime. Your application obtains trusted values and enforces the rule. - Expressions are a closed vocabulary: `equal`, date and time helpers, `value(...)`, and `context(...)`. There is no arbitrary-code escape hatch, which keeps rules portable. See [Policies](/authoring/vocabulary/policies) for the full contract. --- <!-- Source: https://docs.dryvcode.com/authoring/cookbook/scoped-operations --> # Scoped operations **Problem.** `ListOrders` must only ever return the caller's tenant's orders, and the tenant id must never come from the client. **Pattern.** Bind a persisted schema field to a named value that a required policy _provides_. ```ts const policies = orders.policies({ CurrentTenant: policy() .role("authentication") .provides({ tenantId: values.TenantId }), }); const ListOrders = operation() .role("list") .input(schemas.OrderQuery) .output(schemas.OrderRead) .requires(policies.CurrentTenant) .scope({ target: schemas.Order.field("tenantId"), source: { policy: policies.CurrentTenant, name: "tenantId" }, }); ``` The same shape appears on `detail`, `update` and `delete` operations in the maintained `core-journey` example, so a user can only reach their own record. ## Rules - **`target`** must be a persisted field of a stored schema. - **`source.policy`** must be a policy the operation `.requires(...)`, and **`source.name`** must be a value that policy `.provides(...)`. - Use one binding object per persisted field. - The compiler keeps both references explicit, sorts bindings deterministically and omits `scope` when none is declared. - Runtime validation checks role, persistence, references and types. ## What packs do with it A pack can add the constraint to every query, reject a client-supplied value for the target field, and fail closed when the trusted value is missing. Dryv does not evaluate the policy or run the query: your application provides the trusted value, and the generated code applies the constraint. --- <!-- Source: https://docs.dryvcode.com/authoring/cookbook/events-and-workflows --> # Events and workflows **Problem.** Creating a user should announce `UserCreated`, and a duplicate email should be a typed failure, not a generic error. ```ts import { dryv, event, failure, field, operation, property, schema, } from "@dryvcode/author"; const users = dryv.group({ name: "users" }); const values = users.properties({ Id: property.string.uuid(), Email: property.string.email(), }); const schemas = users.schemas({ User: schema({ id: field(values.Id).system(), email: field(values.Email) }), UserCreatedPayload: schema({ id: field(values.Id) }), }); // A reacting operation: it receives the event payload const SendWelcome = operation().input(schemas.UserCreatedPayload); const reactions = users.operations({ SendWelcome }); // An event with a typed payload, and who listens (an operation or a workflow) const events = users.events({ UserCreated: event() .payload(schemas.UserCreatedPayload) .listeners(reactions.SendWelcome), }); // A named, typed failure const failures = users.failures({ EmailTaken: failure("EMAIL_TAKEN").description( "A user with this email already exists", ), }); // The operation that fails with it and announces the event const CreateUser = operation() .role("create") .input(schemas.User) .output(schemas.User) .failures(failures.EmailTaken) .emits(events.UserCreated); users.operations({ CreateUser }); export default dryv.app({ name: "example" }).groups(users); ``` ## How packs use this | You declare | Packs can generate | | ----------------- | ---------------------------------------------------------------- | | `.failures(...)` | Typed error responses, exception classes, documented error codes | | `.emits(...)` | Publish calls, outbox rows, event contracts | | `.listeners(...)` | Subscribers, consumers, handlers | ## Workflows When several operations and events must be sequenced (with conditions and transitions), declare a _workflow_: named steps, a start step and transitions between them. Workflows reuse existing operations and events; they never redefine them. See [Workflows](/authoring/vocabulary/workflows) for the full contract and the TypeScript author's `workflow()`, `operationStep`, `workflowStep` and `waitFor` helpers. --- <!-- Source: https://docs.dryvcode.com/authoring/cookbook/storage-and-projections --> # Storage and projections ## Storage is a facet of the schema There is no storage registry. Portable storage meaning belongs to the schema it describes: ```ts const stored = users.schemas({ User: schema({ id: field(values.UserId), email: field(values.Email), }).facets({ storage: storage("users") .primaryKey("id") .indexes({ fields: ["email"], unique: true }), }), }); ``` A concrete stored schema needs a storage name. An abstract schema may contribute inherited storage rules without one. ## Projections derive shapes ```ts users.schemas({ UserRead: schema({}).projection( projection(stored.User) .purpose("read") .pick("id", "email") .rename({ email: "contactEmail" }) .usage({ email: { optional: true } }), ), }); ``` | Method | Effect | | ------------------------------------------------ | ------------------------------------------------------ | | `.pick(...)` | Keep only these effective fields | | `.rename({ from: "to" })` | Rename a field in the derived shape | | `.usage({ field: { optional: true } })` | Change presence in this shape | | `.read()` / `.create()` / `.edit()` / `.query()` | Set the purpose (also available as `.purpose("read")`) | Selectors are an authoring convenience. The compiler resolves them against the source schema's effective fields and emits explicit canonical `projection.fields`, so packs never guess. ## Why this matters - One change to the stored schema updates every derived shape. - Packs generating DTOs, entities and forms stay in agreement because they read the same fields. - Purpose-aware projections let a pack drop system fields from `create` shapes without special cases. --- <!-- Source: https://docs.dryvcode.com/authoring/sdk/typescript --> # TypeScript author Describe your software once, in TypeScript: schemas, operations, events, policies. The `dryv` CLI compiles it and generates code from it with reusable packs. ## Install ```bash npm install -D @dryvcode/author @dryvcode/compiler curl -fsSL https://dryvcode.com/install.sh | sh dryv init --author typescript --author-path dryv/contracts/index.ts --yes ``` Create `dryv/contracts/index.ts` with the example below, then run `dryv validate` and `dryv plan`. Run `dryv docs authoring` for tips. This package only describes meaning; it does not generate code or write files. ## Quick start ## Model ```text full definitions -> Group registration -> lightweight typed refs \ -> App composition ``` Groups own full declarations. Registration names supply local identity and return lightweight typed refs. Relationships use those refs rather than raw builders. ```ts import { dryv, field, property, schema } from "@dryvcode/author"; const shared = dryv.group({ name: "shared" }); const values = shared.properties({ UserId: property.string.uuid(), Email: property.string.email(), CreatedAt: property.temporal.instant().precision("millisecond"), }); const users = dryv.group({ name: "users" }); const schemas = users.schemas({ User: schema({ id: field(values.UserId).system(), email: field(values.Email), createdAt: field(values.CreatedAt).system(), }), }); schemas.User.field("email"); export default dryv.app({ name: "example" }).groups(shared, users); ``` The compiler qualifies local identities at the Author/Runtime boundary: ```text users + User -> users.User -> #/schemas/users.User ``` Runtime registries remain flat by semantic kind. Group ancestry affects semantic scope, never canonical declaration identity. `.` is reserved for compiler qualification and cannot appear in authored Group names, App names, or registration keys. ## Registered refs Reusable declarations must be registered before another declaration can reference them. ```ts const Id = property.string.uuid(); // invalid: raw definition // field(Id) const shared = dryv.group({ name: "shared" }); const values = shared.properties({ Id }); field(values.Id); // valid ``` This rule applies across Schemas, Properties, Policies, Operations, Events, Failures, Workflows, Views, Presentations, Features, and Applications. `unknown()` and `dynamic()` are intrinsic targets and remain inline. ## Properties `group.properties({...})` classifies reusable value meaning into the canonical registries: ```text primitives enums composites literals unions records tuples generics temporal ``` There are no reusable `unknown` or `dynamic` registries. Examples: ```ts const base = shared.properties({ Id: property.string.uuid(), Name: property.string(), Count: property.number.nonNegativeInteger(), Active: property.literal("active"), CreatedAt: property.temporal.instant().precision("millisecond"), }); const advanced = shared.properties({ Coordinates: property.composite({ x: field(base.Count), y: field(base.Count), }), Identifier: property.union({ discriminant: "kind", members: { id: base.Id, active: base.Active }, }), Pair: property.tuple(base.Id, base.Active), Labels: property.record(base.Id, base.Name), Box: property.generic.define((T) => property.composite({ value: field(T) })), }); ``` Generic applications consume a registered generic definition and registered arguments: ```ts shared.properties({ UserBox: property.generic.apply(advanced.Box, [schemas.User]), }); ``` Properties may carry their property-specific description/examples/lifecycle semantics. Universal `tags` and structured `explanations` are only exposed where the Runtime contract supports them; they are not silently accepted on Properties or Expressions. ## Expressions Expressions are named reusable declarations with a closed Dryv vocabulary. ```ts import { context, expression, value } from "@dryvcode/author"; const expressions = users.expressions({ IsOwner: expression.equal( context("actor", "id"), context("resource", "ownerId"), ), CurrentDate: expression.date( expression.inTimeZone(expression.now(), "Africa/Nairobi"), ), DefaultName: value("unknown"), }); ``` Registered Expression refs are consumed by Policy rules, temporal dynamic bounds, Schema defaults, and composite invariants. There is no arbitrary custom-AST escape hatch. ## Policies Policies are reusable semantic requirements, not framework guards or middleware definitions. ```ts const policies = users.policies({ CanRead: policy() .requires({ actor: schemas.User, resource: schemas.User }) .provides({ id: values.UserId }) .rule(expressions.IsOwner), }); ``` A Policy may intentionally have no rule. Context values are registered Property/Schema refs and rules are registered boolean Expression refs. Groups and Applications may also declare scope policies: ```ts users.policies(policies.CanRead); dryv.app({ name: "example" }).groups(users).policies(policies.CanRead); ``` Effective inherited scope is Runtime/inspection responsibility; Authoring records only the declared scope. ## Schemas Schema field meaning is flat in Author state and canonical Runtime IR. There is no field `usage` wrapper. ```ts const users = dryv.group({ name: "users" }); const schemas = users.schemas({ User: schema({ id: field(values.UserId).system(), email: field(values.Email) .optional() .nullable() .query({ filter: ["equal", "contains"], sort: true, search: true }), names: field(values.Name).array({ min: 1 }), }), }); ``` Field helpers include: - `.required()` / `.optional()`; - `.nullable()`; - `.array(...)`; - `.default(...)`; - `.system()` / `.createOnly()`; - `.query(...)`; - `.sensitive()`; - `.policy(...)`; - `.relation(...)` / `.related(...)`; - `.sources(...)`; - `.tags(...)` / `.explain(...)` where Runtime field metadata is supported. The retired `.mutation(...)` shortcut is intentionally not supported. ### Effective field references and relations `SchemaRef.field(...)` represents semantic effective-field identity. The compiler emits `{ $ref: <schema>, field: <name> }`, not a physical `/fields/...` pointer. ```ts const entities = users.schemas({ Entity: schema({ id: field(values.UserId) }).abstract(), }); users.schemas({ Membership: schema({ ownerId: field(values.UserId).relation({ target: () => entities.Entity.field("id"), cardinality: relation.manyToOne(), onDelete: relation.restrict(), }), }), }); ``` ### Operations: one input, one output An operation takes one input, like a component's props, and returns one output: ```ts const UpdateUser = operation() .input({ userId: sharedProperties.Id, body: userSchemas.UpdateUserBody }) // named fields .output(userSchemas.User); const FindUsers = operation() .input(userSchemas.UserListQuery) .output(userSchemas.UserList); // one schema UpdateUser.facets({ http: http("PATCH", "/users/{userId}") .input(UpdateUser.in.userId, path()) // the path name defaults to the field name .input(UpdateUser.in.body, body()) .output(UpdateUser.out, respond(200)), }); FindUsers.facets({ http: http("GET", "/users") .input(FindUsers.in, queryObject()) .output(FindUsers.out), }); ``` ### Trusted record scope Bind a persisted Schema field to a named value from a Policy that the Operation requires: ```ts const currentTenant = policies.CurrentTenant; const ListOrders = operation() .role("list") .input(schemas.OrderQuery) .output(schemas.OrderRead) .requires(currentTenant) .scope({ target: schemas.Order.field("tenantId"), source: { policy: currentTenant, name: "tenantId" }, }); ``` Use multiple binding objects for multiple persisted fields. The compiler preserves the explicit schema-field and Policy references, sorts canonical bindings deterministically, and omits `scope` when none is declared. Runtime validates role, persistence, references and types. Authoring does not evaluate Policies or execute queries; the generated application must obtain trusted values from its Policy evaluation context and apply the constraints. `Op.in.<field>` refers to one field, `Op.in` to a whole schema input, and `Op.out` to the output. `idempotentBy("userId")`, `source.resolve(op).output().input("userId", source.value())` and `part.invoke(op, { userId: "contextName" })` also use field names. ### Field-local sources There is no root Source declaration or `group.sources(...)` registry. Source meaning belongs to the Schema field that consumes it. ```ts const operations = users.operations({ ListStatuses: operation().output(statusSchemas.StatusList), }); users.schemas({ Filter: schema({ status: field(values.Name).sources({ choices: source.options(operations.ListStatuses).output(), }), }), }); ``` Input bindings use `source.value()` for the consuming field value or `source.field(() => schemaRef.field(...))` for another effective Schema field. If a source operation has exactly one output, the compiler may infer it; otherwise `.output(...)` is required. ### Storage facets There is no root Storage declaration or storage registry. Portable storage semantics belong to `schema.facets.storage`. ```ts const stored = users.schemas({ User: schema({ id: field(values.UserId), email: field(values.Email), }).facets({ storage: storage("users") .primaryKey("id") .indexes({ fields: ["email"], unique: true }), }), }); ``` Concrete stored Schemas require a storage name. Abstract Schemas may contribute inherited storage rules without a concrete name. ### Projection selectors Projection selection is Author-only convenience. The compiler resolves selectors against effective source fields and emits explicit canonical `projection.fields`. ```ts users.schemas({ UserRead: schema({}).projection( projection(stored.User) .purpose("read") .pick("id", "email") .rename({ email: "contactEmail" }) .usage({ email: { optional: true } }), ), }); ``` Supported helpers are `.pick(...)`, `.omit(...)`, `.rename(...)`, `.usage(...)`, `.purpose(...)`, and `.policies(...)`. Projection-from-projection, projection inheritance, abstract projections, projection storage facets, unknown selections, and output collisions are rejected. ## Universal semantic metadata The hardened Runtime contracts currently expose universal metadata on: - Application; - Group; - Policy; - Schema; - Schema/composite fields. Authoring uses: ```ts const users = dryv .group({ name: "users" }) .tags("domain") .explain("info", "User capabilities"); ``` Tags are normalized deterministically. Explanations compile as `{ kind, text }`. Empty/default metadata is omitted. ## App composition The root App is the canonical root Application composition. ```ts export default dryv .app({ name: "example", description: "Example" }) .groups(shared, users) .policies(policies.CanRead) .facets({ http: { root: "/api" } }); ``` The App may compose Groups, policies, HTTP scope, features, surfaces, and presentations. It is not a separate semantic model. ## Next Docs: https://docs.dryvcode.com/docs · Compiler: [`@dryvcode/compiler`](https://www.npmjs.com/package/@dryvcode/compiler) · Python version: [`dryv-author`](https://pypi.org/project/dryv-author/) --- <!-- Source: https://docs.dryvcode.com/authoring/sdk/python --> # Python author Describe your software once, in Python: schemas, operations, events, policies. The `dryv` CLI compiles it and generates code from it with reusable packs. It mirrors the TypeScript author (`@dryvcode/author`) with Pythonic names, so both produce the same result. ## Install ```bash uv add --dev dryv-author dryv-compiler # or: pip install dryv-author dryv-compiler curl -fsSL https://dryvcode.com/install.sh | sh dryv init --author python --author-path dryv.py --yes ``` Requires Python 3.11+. Create `dryv.py` with the example below (it must expose one module-level `dryv.app(...)`), then run `dryv validate` and `dryv plan`. Run `dryv docs authoring` for tips. This package only describes meaning; it does not generate code or write files. ## Example ```python from dryv_author import ( body, dryv, field, http, operation, path, policy, prop, respond, schema, scope_binding, storage, ) users = dryv.group("users") accounts = users.feature("Accounts") # features are registration scopes ids = accounts.properties({"Id": prop.string.uuid(), "Name": prop.string()}) models = accounts.schemas( { "User": schema( { "id": field(ids.Id).system(), "name": field(ids.Name).query(filter="*", sort=True), } ).facets(storage=storage("users").primary_key("id")), } ) create = operation().role("create").inputs(models.User).outputs(models.User) create.facets( http=http("POST", "/users") .input(create.input(0), body()) .output(create.output(0), respond(201)), ) accounts.operations({"CreateUser": create}) users.schemas({"AuditEntry": schema({"id": field(ids.Id)})}) # group-owned: no feature tenant_policy = accounts.policies({"CurrentTenant": policy().provides({"tenantId": ids.Id})}) get_user = ( operation() .role("detail") .inputs(id=ids.Id) .outputs(models.User) .requires(tenant_policy.CurrentTenant) .scope(scope_binding(models.User.field("id"), tenant_policy.CurrentTenant, "tenantId")) ) accounts.operations({"GetUser": get_user}) app = dryv.app("accounts").groups(users) ``` The entrypoint configured in `dryv.yaml` must expose exactly one module-level `dryv.app(...)`. It may import ordinary modules; every registration records the caller's file and line. ## Ownership Registering through `group.feature("Name")` makes the group the declaration's `group` and the feature its `feature`. Registering directly on the group leaves it group-owned. A declaration can belong to one group and at most one feature. ## API map (TypeScript → Python) | TypeScript | Python | | ----------------------------------------------------- | ---------------------------------------------------------- | | `property.string.uuid()` | `prop.string.uuid()` | | `property.number.integer({ range: { min: 0 } })` | `prop.number.integer(range={"min": 0})` | | `field(x).createOnly()` | `field(x).create_only()` | | `.query({ filter: ["notEqual"] })` | `.query(filter=["not-equal"])` (`not_equal` also accepted) | | `expression.and(...)`, `.or(...)`, `.not(...)` | `expression.all_of(...)`, `.any_of(...)`, `.not_(...)` | | `operation().async()` | `operation().async_()` | | `operationStep`, `waitFor`, `outputFrom`, `inputFrom` | `operation_step`, `wait_for`, `output_from`, `input_from` | | `group.policies(ref1, ref2)` | same: a mapping registers, refs set scope policies | | `.scope({ target, source: { policy, name } })` | `.scope(scope_binding(target, policy, name))` | An Operation scope binds a persisted Schema field to a named value declared in an attached Policy's `provides` context. Use one binding helper per field. The compiler lowers these to the same canonical scope contract as TypeScript and omits the scope when undeclared. Runtime validates declarations; the application remains responsible for Policy evaluation and conjunctive query execution. ## Next Docs: https://docs.dryvcode.com/docs · Compiler: [`dryv-compiler`](https://pypi.org/project/dryv-compiler/) --- <!-- Source: https://docs.dryvcode.com/authoring/vocabulary/canonical --> ## Canonical vocabulary This document defines the rules governing vocabulary across Dryv. It does not create a second semantic authority. The **Canonical Runtime IR remains the only semantic authority**. This document defines how concepts are named, reused, projected and extended consistently across: ```text Authoring ↓ Authoring Protocol ↓ Canonical Runtime IR ↓ Engine inspection and context ↓ Template packs ↓ Generated implementations ``` The purpose of the vocabulary is simple: > The same meaning should have the same name everywhere in Dryv. Vocabulary consistency is a fundamental part of Dryv's portability, explainability and learnability. --- ## 1. Core principle Dryv describes **meaning**, not programming syntax. Its vocabulary must be: | Property | Requirement | | ---------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | | Language-neutral | No concept depends on TypeScript, Python, Rust, Java, Go, Dart, C#, or another programming language. | | Framework-neutral | No canonical concept depends on NestJS, React, Django, FastAPI, Spring, Flutter, TypeORM, PyTorch, Unity, or another framework/library. | | Renderer-neutral | Jinja, Handlebars, Liquid, Mustache and future renderers receive the same semantic vocabulary. | | Implementation-neutral | Meaning must survive replacing one implementation technology with another. | | Domain-extensible | Dryv is not limited to CRUD, web applications, databases, or today's packs. | | Meaning-preserving | Vocabulary names actual concepts rather than convenient code-generation tricks. | | Deterministic | A canonical term must have one defined meaning. | | Explainable | Humans and AI agents should be able to follow the same term through every layer. | | Conservative | New vocabulary is added only when real use proves it is necessary and sufficiently portable. | Dryv is therefore **implementation-agnostic and domain-extensible**, but it is not meaning-agnostic. Meaning is exactly what Runtime IR exists to preserve. --- ## 2. Runtime IR owns canonical semantic words Runtime IR is the only semantic authority. If Runtime IR defines: ```text schema projection field relation operation workflow event policy surface view ``` those are the canonical semantic terms. Other tiers must not silently rename them. For example: ```text Runtime IR schema.projection Context schema.projection ``` is preferred over: ```text Runtime IR schema.projection Context schema.source ``` unless Dryv explicitly decides that `source` is the better canonical concept and changes the Runtime IR accordingly. Context is not allowed to correct or redesign Runtime IR vocabulary independently. Authoring is not allowed to create a competing semantic vocabulary. Packs are not allowed to create semantic aliases for canonical concepts. --- ## 3. Vocabulary classes Not every word visible to a template is canonical software meaning. Dryv vocabulary belongs to distinct classes. | Class | Examples | Authority | | -------------------------------- | -------------------------------------------------------------------------------------------- | ------------------------ | | Semantic vocabulary | `schema`, `field`, `operation`, `relation`, `workflow`, `event`, `policy`, `view`, `surface` | Runtime IR | | Semantic qualifiers | `role`, `kind`, `purpose`, `cardinality`, `optional`, `nullable`, `sensitive` | Runtime IR | | Interface/facet vocabulary | `http`, `websocket`, `schedule`, `storage`, `representation` | Runtime IR | | Derived semantic vocabulary | `is.boolean`, `has_min`, effective storage facts | Engine | | Structural projection vocabulary | `NameContext`, resolved links, map→array normalization | Engine | | Planning vocabulary | `file`, `unit`, `symbol`, `dependency`, `import`, `export`, `generated` | Planner | | Pack vocabulary | `selection`, `template`, `provides`, `needs`, `layout`, `actions` | Pack contract | | Usage vocabulary | `sources`, `packs`, `destinations`, `bindings` | Usage contract | | Authoring convenience | host-language builders, helpers and syntactic sugar | Authoring implementation | These classes must not be confused. For example: ```text value.generated.schema_validation ``` does not mean that `schema_validation` has become part of software meaning. It means: ```text semantic value + current generation plan ↓ representation generated through schema.validation ``` The semantic concept remains the value. The generated representation belongs to planning. --- ## 4. Semantic vocabulary must survive implementation replacement A candidate canonical concept should survive substantial implementation changes. For example: ```text operation ``` remains meaningful when implemented by: ```text NestJS FastAPI Spring Gin Axum ASP.NET ``` Therefore `operation` is a strong canonical concept. Similarly: ```text relation ``` can be represented through: ```text TypeORM SQLAlchemy Hibernate EF Core GORM SeaORM ``` The semantic relation survives the technology choice. By contrast: ```text controller component decorator hook class interface ORM entity React state Django serializer ``` are implementation concepts. They belong in packs. They are not Runtime IR vocabulary. --- ## 5. Programming syntax is not software meaning Dryv must not gradually become an abstract programming language. Canonical Runtime IR should not model imperative programming primitives merely because generated languages contain them. The following are not sufficient reasons for canonical vocabulary: ```text if else for while loop switch class interface method variable statement return statement import statement ``` A template may generate those constructs. A pack may reason about how target code should represent Dryv meaning. But Runtime IR should model the meaning that caused those constructs to exist. For example: ```text policy condition invariant transition relation selection constraint expression ``` may legitimately result in generated `if`, `match`, `switch`, guards, decorators or predicates. The canonical concept is still the semantic rule, not the programming statement. --- ## 6. Declarative logic and mathematics are allowed Avoiding programming primitives does **not** mean Dryv cannot represent logic or mathematics. Logical and mathematical concepts may be genuine semantic meaning. Existing examples include: ```text comparison arithmetic range duration constraint expression invariant ``` Future requirements could justify concepts such as: ```text quantity unit dimension vector matrix tensor equation distribution probability coordinate transform ``` but none of these are automatically approved. They must pass the vocabulary admission rules in this document. An equation is semantic meaning. A `for` loop used to calculate it is an implementation decision. --- ## 7. Context must project vocabulary, not redesign it Template context exists to make canonical meaning usable by renderers. Context may safely perform structural normalization such as: ```text map → deterministic named array reference → bounded resolved semantic link canonical value → JSON literal projection semantic classification → is.* optional bound → has_* planned representation → generated.* ``` These transformations improve usability without creating new software meaning. However, semantic names must remain canonical. This is acceptable: ```text relation.cardinality relation.is.many_to_one ``` because `is.many_to_one` is an explicitly derived classification of the canonical cardinality. This is not acceptable without a canonical vocabulary change: ```text Runtime IR: projection Context: source ``` because the same semantic concept has acquired two names. --- ## 8. Derived vocabulary must identify itself as derived Derived context must never masquerade as authored canonical meaning. Current conventions are good examples: ```text is.* has_* *_json generated.* dependency_groups.* name.camel name.pascal name.snake name.kebab ``` These are clearly projections or conveniences. When possible, new derived vocabulary should follow equally recognizable conventions. A template author should be able to distinguish: ```text what the software means ``` from: ```text what the Engine calculated to make that meaning easier to use ``` --- ## 9. Canonical naming rules | Concept | Rule | | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | | `kind` | Structural variant of one concept. | | `role` | What a semantic declaration does in the larger system. | | `purpose` | Why a concept is being used in a particular relationship or derivation. | | `facet` | Optional semantic concern/interface attached to another concept. | | `source` | Provenance/origin of a value or relationship, not a synonym for another concept. | | `target` | Explicit destination of a relationship/binding. | | `value` | Semantic information carried by a field, port, payload or similar carrier. | | `input` / `output` | Direction across a semantic boundary. | | `binding` | Explicit connection between two known semantic endpoints. | | `relation` | Semantic association between values/entities, not generated dependency wiring. | | `dependency` | Artifact/generation dependency unless specifically qualified otherwise. | | `provides` / `needs` | Pack capability composition. | | `projection` | Derived semantic shape produced from another semantic shape. | | `context` | Must normally be qualified because Dryv has semantic context, policy context, view context, evaluation context and template context. | | `action` | Avoid as a generic top-level term because Pack Actions already have generation meaning and `operation.role=action` already has semantic meaning. | | `model` | Avoid unqualified canonical use because it is overloaded across databases, UI, mathematics and machine learning. | Casing may adapt to the host language: ```text rate_limit rateLimit ``` but the words may not change: ```text projection source ``` are not casing variants. They are different vocabulary. --- ## 10. Authoring vocabulary Authoring implementations may provide ergonomic syntax, but they must preserve canonical terminology. Allowed adaptation: ```text Runtime IR Authoring TypeScript rate_limit → rateLimit on_delete → onDelete primary_key → primaryKey ``` This is casing adaptation. Semantic aliases should be avoided: ```text canonical: projection author API: derivedFrom canonical: relation author API: association canonical: operation author API: endpoint ``` unless those words describe genuinely different concepts. Authoring sugar may introduce temporary construction concepts such as: ```text pick omit rename ``` when the compiler completely resolves them into canonical Runtime IR. Such construction vocabulary must not accidentally become another semantic model. --- ## 11. Packs must speak canonical Dryv vocabulary Pack manifests should select canonical concepts: ```text schema operation view workflow property.enum ``` They may map those concepts into target terminology: ```text schema → TypeORM Entity schema → Pydantic Model operation → NestJS controller method operation → FastAPI route view → React page ``` The right-hand concepts belong to the pack. They must not leak backwards into Runtime IR. Folders, framework names and template filenames also carry no semantic authority. --- ## 12. Dryv is not limited to conventional application software The current vocabulary contains many concepts common to application development: ```text schema operation event workflow policy view surface storage HTTP ``` These are the vocabulary Dryv currently needs. They are not a declaration that Dryv can only describe web/business applications. Dryv may eventually describe other complex systems if real use requires it. Potential domains include: | Domain | Possible semantic concepts — not approved merely by appearing here | | ---------------- | ------------------------------------------------------------------------------ | | Mathematics | quantities, units, vectors, matrices, equations, distributions | | Graphics / 3D | geometry, transform, coordinate space, scene, material, camera, light | | Machine learning | dataset, observation, label, prediction, inference, training, embedding | | AI systems | model interaction, tool, observation, prediction, evaluation | | NLP | document, utterance, language, tokenization intent, classification, extraction | | Computer use | environment, observation, action intent, target, state | | Simulation | state, transition, actor, environment, timestep | | Optimization | objective, variable, constraint, solution | | Robotics | sensor, actuator, pose, trajectory, observation | This table is exploratory, not a roadmap. Dryv does not add vocabulary simply because something could theoretically be represented. --- ## 13. Vocabulary expansion is optional There is no goal to make Runtime IR describe every possible domain. The preferred state is always: ```text current vocabulary is enough ``` until a real requirement proves otherwise. A new concept must pass all of these tests before becoming canonical: | Test | Question | | ------------------------ | ---------------------------------------------------------------------------------------------------------------- | | Real-use test | Is an actual project or pack blocked without this concept? | | Meaning test | Does it describe enduring meaning rather than generated syntax? | | Neutrality test | Is it independent of a specific framework, language, vendor or library? | | Portability test | Can at least substantially different implementations represent it? | | Replacement test | Would the concept remain valid if today's implementation were replaced? | | Reuse test | Is this meaning useful beyond one template or one generated file? | | Existing-vocabulary test | Can current concepts already express it cleanly? | | Determinism test | Can its meaning and validation be made precise? | | Composition test | Can it interact with existing semantic concepts without hidden rules? | | Naming test | Does it have a clear term that does not conflict with existing vocabulary? | | Boundary test | Does it belong in Runtime IR rather than Authoring sugar, Context derivation, Pack logic or Usage configuration? | Failure of any major test is a reason not to add the concept yet. --- ## 14. Portability must be demonstrated A proposed semantic concept should not be accepted merely because its name sounds generic. For example, an ML concept is not automatically neutral simply because multiple ML frameworks use the same word. A proposal should demonstrate mappings conceptually such as: ```text canonical concept │ ├── implementation A ├── implementation B └── implementation C ``` without requiring target-specific fields in the canonical concept. For example, a future `prediction` concept may be promising if the same canonical meaning can map independently into different ML runtimes or generated APIs. A concept requiring fields such as: ```text pytorch_module tensorflow_layer sklearn_estimator ``` has failed the neutrality test. Those belong in packs. --- ## 15. Natural language does not become Runtime IR syntax Dryv may eventually support rich natural-language authoring. For example, a user might describe: ```text The total must never exceed the account limit. ``` or: ```text Predict crop disease probability from these observations. ``` Natural-language authoring may interpret that intent. The compiler must still produce explicit canonical Runtime IR. Runtime IR should not store arbitrary natural-language parse trees as the semantic contract merely because natural language produced the declaration. The same rule applies to AI-assisted authoring: ```text AI interprets ↓ authoring declaration ↓ canonical meaning ``` AI does not become another semantic authority. --- ## 16. Domain namespaces require proof Some domains reuse words Dryv already owns. For example, machine learning uses the word: ```text feature ``` but Dryv already has: ```text feature ``` as a software-composition concept. Do not overload the existing canonical word with a second incompatible meaning. If a future domain genuinely requires such a concept, its vocabulary design must explicitly solve the collision. Possible namespacing or a better neutral concept may be considered at that time. Do not reserve speculative namespaces today. --- ## 17. Vocabulary should be small A smaller, composable vocabulary is better than a large ontology. Prefer: ```text existing concepts + composition ``` over: ```text new special-case concept ``` A vocabulary becomes powerful when a few stable concepts combine to describe many systems. Expansion should therefore normally happen because Dryv discovers a missing **primitive of meaning**, not because a framework has another abstraction that could be copied. --- ## 18. Current vocabulary families The current canonical vocabulary broadly covers: | Family | Concepts | | ----------------------- | ------------------------------------------------------------------------------------------ | | Composition | application, group, feature | | Values | property, schema, field, literal, enum, composite, union, record, tuple, generic, temporal | | Constraints | range, length, pattern, invariant | | Relationships | relation, related, reference, binding | | Behavior | operation, input, output, failure, event | | Rules | policy, expression | | Orchestration | workflow, step, transition | | Interaction | view, part, presentation | | Delivery | surface | | Interfaces | facet, HTTP, WebSocket, schedule, representation | | Data semantics | storage, projection, query | | Cross-cutting semantics | role, kind, purpose, access, execution, lifecycle | This is an inventory, not a closed universe. --- ## 19. Known vocabulary drift to audit The current repository already contains several cases that should be reviewed. | Current state | Concern | | ---------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | | Context docs say Runtime IR is “evidence, not authority” | Contradicts the architecture. Runtime IR is the semantic authority. | | Runtime IR `schema.projection` → context `schema.source` | Same semantic concept has been renamed between layers. Prefer one canonical term. | | Runtime mutation vocabulary has `create-only`, `system`, `context`, `transition`, while `context/schema.md` documents fewer values | Documentation/context vocabulary has drifted from the canonical contract. | | Context expression nodes normalize several Runtime IR expression forms into `function` | May be valid projection, but must be explicitly documented as derived structural normalization rather than canonical vocabulary replacement. | | Authoring uses names such as `primitiveKind`, `genericKind`, `surfaceKind` in some internal state contracts | Audit whether these are implementation-only collision avoidance or user-visible competing vocabulary. | | Context has `generated.*`, `file.*`, dependency groups and naming variants | Valid planning/derived vocabulary, but they must stay explicitly outside semantic vocabulary. | The goal of the audit is not to force identical object shapes across all tiers. The goal is: > identical semantic concept → identical canonical word. --- ## 20. Vocabulary change procedure Any proposed vocabulary change should record: | Question | Required answer | | ------------------------------------------------- | ------------------------------------------------------------------ | | What concept is missing or incorrectly named? | Concrete semantic need | | Where was the need discovered? | Real project, authoring requirement or pack | | What existing vocabulary was considered? | Reuse before expansion | | Why is the concept implementation-neutral? | Neutrality argument | | Which different implementations can represent it? | Portability evidence | | Which tier owns it? | Authoring / Runtime IR / derived context / planning / pack / usage | | Does it collide with an existing word? | Collision analysis | | Does it rename an existing concept? | Migration/alignment impact | | Which layers must change? | Authoring, protocol, IR, context, docs, packs | | Does it weaken determinism? | Must be no | A semantic vocabulary change is incomplete until all affected layers agree again. --- ## 21. Drift is a defect Vocabulary drift is not merely a documentation issue. It makes Dryv harder for: ```text humans AI agents pack authors authoring implementations template authors engine maintainers ``` to reason about. If one concept becomes: ```text projection source derived schema mapped schema ``` depending on the layer, Dryv begins requiring translation knowledge. That defeats one of its strongest properties. The desired experience is: ```text learn the Dryv concept once ↓ recognize it in Authoring ↓ recognize it in Runtime IR ↓ recognize it in Context ↓ use it in Packs ``` Vocabulary is therefore part of Dryv's architecture, not merely naming style. --- ## 22. Final rule Before adding a new word to Dryv, ask: > Does Dryv need to understand this meaning, or does only an implementation need to know how to represent it? If only an implementation needs it: ```text put it in the pack. ``` If only an authoring language needs it for convenience: ```text keep it in authoring and compile it away. ``` If only templates need a deterministic convenience over existing meaning: ```text make it explicitly derived context. ``` If it describes durable, portable meaning that Dryv itself must understand: ```text consider it for Canonical Runtime IR. ``` And if the current vocabulary already expresses it: ```text add nothing. ``` --- <!-- Source: https://docs.dryvcode.com/authoring/vocabulary/runtime-ir --> # Runtime IR reference The implemented `dryv.ir/v1alpha1` ownership model. Per-concept pages: [properties](/authoring/vocabulary/properties), [schemas](/authoring/vocabulary/schemas), [policies](/authoring/vocabulary/policies), [events](/authoring/vocabulary/events), [operations](/authoring/vocabulary/operations), [workflows](/authoring/vocabulary/workflows), [views](/authoring/vocabulary/views), [parts](/authoring/vocabulary/parts), [presentations](/authoring/vocabulary/presentations), [themes](/authoring/vocabulary/themes), [groups](/authoring/vocabulary/groups). Serialization rules: [naming](/authoring/vocabulary/naming). Complete example: `sdk/_examples/ir/dryv.ir.yaml`. ## Meaning One authored Dryv software description compiles into one canonical Runtime IR document. ```text Authoring source -> canonical Dryv Runtime IR -> Runtime validation / loading / serialization / inspection -> pack selection / binding / planning / rendering -> generated output ``` Runtime IR is the semantic authority. ## Major ownership rule Every semantic fact must have one clear owner. Dryv must not duplicate one meaning across competing top-level concepts, create root registries merely because a subordinate contract is complex, hide semantic relationships in naming conventions, move canonical meaning into packs, or preserve obsolete models for compatibility. ## Canonical root Runtime IR ```yaml version: dryv.ir/v1alpha1 key: example info: {} groups: {} properties: primitives: {} enums: {} composites: {} literals: {} unions: {} records: {} tuples: {} generics: {} temporal: {} schemas: {} expressions: {} policies: {} failures: {} events: {} operations: {} workflows: {} views: {} surfaces: {} themes: {} features: {} applications: {} ``` There is no root: ```text sources storage exposures presentations ``` Sources belong to Schema fields, storage belongs to Schema facets, transport facets belong to Operations, and Presentations belong to Views. ## Root registries versus semantic ownership Root registries provide deterministic lookup. Semantic ownership lives where the meaning belongs. Examples: ```text features root lookup registry <declaration>.feature semantic ownership: the declaration names its Feature operations root lookup registry Operation.facets semantic ownership of callable transport mappings schemas root lookup registry Schema.facets semantic ownership of Schema-local facets such as storage views root lookup registry View.presentations semantic ownership of Surface bindings for one View ``` ## Groups Groups own semantic organizational scope. Group parentage affects scope but does not alter declaration identity. Declarations use: ```text <group>.<local-name> ``` not ancestry-qualified or Feature-qualified identities. ## Features A Feature is a named unit owned by exactly one Group (`feature.group`). Features are flat inside their Group. Ownership is written on each declaration: a required `group` and an optional `feature` whose Group must match. Declarations without a feature are owned directly by their Group. Feature membership is derived, never listed on the Feature or Group. See [groups](/authoring/vocabulary/groups) and decision 0011. Ownership does not change canonical identities, and it does not restrict references: any declaration may reference any other. ## Properties Properties own reusable value/type meaning. Canonical reusable registries are: ```text primitives enums composites literals unions records tuples generics temporal ``` `unknown` and `dynamic` are intrinsic use-site targets, not reusable root registries. ## Schemas Schemas own structured software-state meaning, including flat fields, usage amendments, defaults, mutation/query/sensitivity semantics, field Policies, relations, field-local Sources, inheritance, resolved projections, Schema facets, Schema-local storage semantics, invariants, examples, and semantic metadata. There is no root Source or Storage registry. ## Expressions Expressions are reusable named semantic computations/conditions. Each is an owned declaration (`group`, optional `feature`, description, tags, explanations) whose `value` holds the expression tree. Consumers reference canonical Expression declarations rather than embedding competing rule models. ## Policies Policies own reusable semantic requirements/guards/decisions. A Policy may define typed required/provided context and an optional Expression rule. ## Failures Failures remain reusable root declarations. Operations reference Failures, and transport mappings may map declared Failures to transport-specific responses. ## Operations Operations own executable semantic capability meaning. Current Operation-owned semantics include optional role, ordered direct value input/output ports, declared Failures, emitted Events, access/Policy requirements, trusted persisted-record scope, execution facets, and named callable exposures. Scope bindings reference a persisted Schema field directly and a named value from an attached Policy; projections identify exposed aliases when present. Operation I/O ports reference reusable Properties/Schemas directly through `ValueRef`. Specific ports use typed `OperationPortRef` with Operation identity, direction, and index. There are no keyed Operation I/O maps and no physical port pointers. ### Operation-owned facets There is no root `exposures` registry. HTTP, WebSocket and schedule mappings belong to their owning Operation as `facets.http`, `facets.websocket` and `facets.schedule`. ## Events Events own semantic occurrence meaning, direct Property/Schema payload references, and typed Operation/Workflow listeners. Relationships remain distinct: ```text Operation -> emits -> Event Event -> listeners -> Operation / Workflow Workflow WaitStep -> waits for -> Event ``` ## Workflows Workflows own orchestration meaning: ordered direct value ports, explicit output bindings, named steps, Operation/nested Workflow/Event wait steps, typed step refs, explicit source-to-target value flow, and transitions. There is no keyed Workflow I/O and no implicit type-based wiring. ## Views and Parts Views own coherent interaction meaning. A View may own: - named `context` values using canonical `ValueRef`s; - named tagged Parts; - named local Presentations. `Part` is a closed tagged union: ```text present collect invoke ``` A Present Part reads an Operation output port and may select semantic paths. A Collect Part supplies one Operation input port from collected semantic paths and/or View context. An Invoke Part invokes an Operation and explicitly supplies required inputs from View context. There is no broad Part object containing `presents`, `collects`, `invocation`, `contains`, `emits`, `reacts`, or `when`. There is no `PartRef` and no Part containment graph. Specific View context values are referenced with typed `ViewContextRef`: ```yaml $ref: "#/views/orders.OrderDetails" context: orderId ``` Runtime validation resolves Present/Collect paths through effective Schema or Composite Property meaning and validates context type compatibility. The previous Event-driven `ViewTransition` model is removed. Navigation/routing is not currently a canonical View concept. ## Surfaces Surfaces remain reusable root declarations. A Surface describes a broad interaction environment such as web, mobile, desktop, CLI, or embedded without selecting a framework implementation. ## View-owned Presentations Presentation is no longer a root declaration. A View owns a local map of Presentation bindings: ```yaml views: orders.OrderDetails: presentations: web: surface: $ref: "#/surfaces/web" layout: master-detail peers: - $ref: "#/views/orders.OrderList" ``` A View-local Presentation owns a Surface reference and may carry portable `flow` or `master-detail` layout intent. `master-detail` requires one or more peer Views. Removed concepts include root `presentations`, `PresentationRef`, Presentation parent chains, Presentation addresses, Feature presentation membership, Application presentation membership, and standalone authoring `presentation` records. Routes, stack operations and framework page placement remain pack-owned. ## Applications Applications remain root composition declarations. An Application may select Groups, Policies, scoped HTTP roots (`facets.http.root`), Surfaces, a Theme, named destinations, named transitions, and semantic metadata. Destinations reference a View and optionally one of that View's local Presentation names. Transitions connect two destination names, may reference the Operation that initiates the transition, and declare either `replace` or `overlay` intent. Runtime validates all references and requires an overlay target to contain overlay collection intent. Generation context exposes destinations and transitions as sorted typed collections, including derived name variants and semantic links. Packs use these facts to choose target routes or navigation-stack representations without re-parsing Runtime IR. Applications do not own Feature lists or Presentation lists. Feature reachability is: ```text Application -> Groups -> Features -> declarations ``` ## Explicit reference rule Relationships between canonical declarations use typed machine-resolvable references wherever possible. Examples: ```text Schema relation -> SchemaFieldRef Operation port -> OperationPortRef Workflow port -> WorkflowPortRef Workflow step -> WorkflowStepRef View context -> ViewContextRef Event listener -> typed OperationRef / WorkflowRef Declaration owner -> GroupRef + optional FeatureRef ``` Physical implementation-style pointers are not substitutes for these semantic references. ## In-place ownership rule Semantic facts are declared where their meaning belongs. ```text Property value meaning -> Property Schema field/source/storage -> Schema Operation execution/exposure -> Operation Event listeners -> Event Workflow value flow -> Workflow View context/Parts/Presentation -> View Declaration ownership -> the declaration (group + feature) ``` ## Classification test Before adding an IR field or relationship, ask: - **Does it describe the software?** Then it may belong in Runtime IR. - **Does it describe generation?** Then it belongs in packs or planning. - **Does it describe presentation?** Then it belongs in templates or derived context formatting. - **Is it renderer- or framework-specific?** Then it never becomes canonical meaning unless a framework-neutral concept sits underneath it. Convenient template context is not automatically canonical meaning. ## Pack boundary Packs consume canonical meaning but do not redefine it. A UI pack selects Views, then inspects tagged Parts, View context, and View-local Presentations. It does not select a root Presentation registry because none exists. ## Authoring boundary Authoring APIs may be more ergonomic than Runtime IR. The compiler must resolve conveniences into canonical Runtime IR before Engine ingestion. Authoring must not require Runtime IR to preserve an Authoring-only abstraction. ## Current authority When materials disagree, authority is: 1. current Runtime IR contracts under `source/engine/python/engine/src/dryv/contracts/semantic/`; 2. current validators/serialization/loading/inspection behavior; 3. these spec pages; 4. the complete example `sdk/_examples/ir/dryv.ir.yaml`. --- <!-- Source: https://docs.dryvcode.com/authoring/vocabulary/naming --> # Naming This document defines the serialization vocabulary shared by Runtime IR, the Authoring Protocol, compilers, loaders, serializers, packs, inspection, and tooling. It is normative for Dryv-owned wire contracts. ## Core rule Dryv separates four naming domains. They must not be conflated. | Domain | Canonical form | Example | | --------------------------------- | --------------------------- | ---------------------------------------------------- | | Dryv-owned serialized object keys | `lower_snake_case` | `primary_key`, `time_zone`, `max_attempts` | | Dryv-owned fixed symbolic values | `lower-kebab-case` | `starts-with`, `property-temporal`, `provider-hello` | | User-authored identifiers | preserve exactly | `UserProfile`, `externalCustomerId`, `moneyAmount` | | Reserved/external-standard tokens | preserve governing spelling | `$ref`, `GET`, `application/json`, `Africa/Nairobi` | The compiler is the normalization boundary. Authoring APIs may use language-idiomatic spelling, but every compiler must emit the same canonical Runtime and Authoring Protocol vocabulary. This contract defines the current unpublished format. Retired spellings are not canonical aliases and Runtime does not convert them. ## Dryv-owned keys Serialized keys owned by Dryv use `lower_snake_case`. Examples: ```text timeZone -> time_zone primaryKey -> primary_key rateLimit -> rate_limit maxAttempts -> max_attempts mediaType -> media_type sessionId -> session_id runtimeIRVersion -> runtime_ir_version ``` CamelCase Dryv keys are not canonical aliases. `$ref` is intentionally exempt. It is a reserved structural key and remains `$ref` everywhere in canonical IR and protocol records. Python implementations may require internal field aliases for reserved syntax such as `$ref` or language keywords such as `from`. Those implementation names do not change the canonical serialized spelling. ## Dryv-owned fixed values Known Dryv discriminators, operators, protocol message types, and record kinds use `lower-kebab-case` when they contain multiple words. Examples: ```text startsWith -> starts-with notEqual -> not-equal greaterThanOrEqual -> greater-than-or-equal compile.request -> compile-request provider.hello -> provider-hello properties.primitive -> property-primitive properties.temporal -> property-temporal ``` Single-word controlled values remain single words, for example `schema`, `operation`, `unknown`, `dynamic`, `required`, and `optional`. ## User-authored identifiers Dryv never recursively normalizes arbitrary keys or names supplied by the author. Authored identities include: - property and schema names; - schema/composite field names; - enum member keys and authored enum values; - union member names and discriminant field names; - generic parameter names; - operation input/output names; - event, failure, policy, workflow, source, view, surface, feature, application, and presentation names; - group names; - storage names and authored index names; - project-specific labels and binding names. Example: ```text schema: UserProfile field: externalCustomerId property: moneyAmount union member: byExternalId ``` Canonical references preserve those exact path tokens, subject only to JSON Pointer escaping: ```yaml $ref: "#/schemas/UserProfile" $ref: "#/schemas/UserProfile/fields/externalCustomerId" $ref: "#/properties/primitives/moneyAmount" ``` ## External and standards-owned vocabulary Dryv does not rename values whose spelling is governed by another standard or external system. Examples include: - HTTP methods such as `GET` and `POST`; - media types such as `application/json`; - IANA timezone IDs such as `Africa/Nairobi`; - URI/path values; - external provider identifiers where the contract declares them opaque; - canonical version identifiers such as `dryv.ir/v1alpha1`. A field containing an external value may still have a Dryv-owned snake_case key. ## Runtime IR examples Canonical schema field: ```yaml externalCustomerId: kind: property $ref: "#/properties/primitives/CustomerId" mutation: create-only ``` Canonical storage facet: ```yaml facets: storage: primary_key: - externalCustomerId ``` Canonical query operators: ```yaml query: filter: - starts-with - not-equal - greater-than-or-equal ``` The authored field name remains camelCase because it belongs to the author. The Dryv-owned keys and operators do not. ## Authoring Protocol examples Client request: ```json { "type": "compile-request", "session_id": "s1", "entrypoint": "authoring/app.ts", "protocol_versions": ["dryv.authoring/v1alpha1"], "runtime_ir_versions": ["dryv.ir/v1alpha1"], "batch_size": 64 } ``` Provider hello uses: ```text type = provider-hello compiler_id compiler_version author_version author_compatibility author_representation protocol_versions runtime_ir_versions ``` Canonical property records are: ```text property-primitive property-enum property-composite property-literal property-union property-record property-tuple property-generic property-temporal ``` ## Property registry naming Canonical reusable property registries are exactly: ```text primitives enums composites literals unions records tuples generics temporal ``` `unknown` and `dynamic` are direct field target kinds. They never create reusable registries and are not recursive type-expression variants. ## Compiler requirements Every Author compiler must: 1. validate its own implementation-specific Author representation; 2. resolve authored declaration identities explicitly; 3. preserve user-authored identifiers exactly; 4. map Dryv-owned keys to canonical snake_case; 5. map Dryv-owned fixed values to canonical kebab-case; 6. emit reserved `$ref` rather than an implementation-specific `ref` key; 7. emit only current canonical Runtime registries and concepts; 8. reject authored constructs that cannot be represented canonically instead of emitting an older shape; 9. produce the same semantic IR for equivalent authoring in different languages. A compiler must not apply a blind recursive case converter. Such a converter would corrupt authored identities and standards-owned values. Normalization belongs in explicit semantic mapping code. ## Enforcement The naming contract must be reflected in: - Runtime contract field names and controlled values; - Runtime serialization and loading; - Authoring Protocol contracts; - every compiler implementation; - protocol and mapping tests; - canonical examples; - pack-facing Runtime vocabulary; - inspection and planning output where canonical IR fields are exposed. Vocabulary that violates these rules is a contract defect, not a stylistic preference. --- <!-- Source: https://docs.dryvcode.com/authoring/vocabulary/groups --> # Groups ## Meaning A Group is a semantic organizational scope within Dryv. Groups divide a large authored system into meaningful domains, responsibilities, capabilities, or product areas without implying source folders, packages, framework modules, deployment units, or generated project structure. Groups may form parent/child hierarchies. Example: ```text commerce identity administration ``` Parent hierarchy affects semantic scope. It does not become part of declaration identity. ## Declaration identity Declarations that belong to a Group use the canonical identity: ```text <group>.<local-name> ``` Example: ```text group = administration local declaration = Administrator identity = administration.Administrator ``` If `administration` has parent `core`, the identity is still: ```text administration.Administrator ``` not: ```text core.administration.Administrator ``` Group ancestry is semantic scope, not registry nesting. ## Canonical Group shape A Group may define: - optional parent Group; - optional description; - Policies scoped to the Group; - scoped facets such as `facets.http.root` and `facets.storage.namespace` (the storage namespace default for the group's persisted schemas); - owned Feature references; - universal semantic metadata. Example: ```yaml groups: users: description: User-management semantics features: - $ref: "#/features/users.Accounts" ``` ## Group-owned Features Feature remains a canonical structural concept. Its meaning is: > These canonical declarations belong together as one cohesive capability within a Group. Ownership is written on the declaration (decision 0011): ```text Group ─owns─▶ Feature (feature.group, required) Declaration ─names─▶ Group (group, required) Declaration ─names─▶ Feature (feature, optional; must belong to the same Group) ``` ```yaml features: users.Accounts: group: $ref: "#/groups/users" schemas: users.User: group: $ref: "#/groups/users" feature: $ref: "#/features/users.Accounts" users.AuditEntry: # no feature: owned directly by the group group: $ref: "#/groups/users" ``` Rules: - Ownable declarations are Properties, Schemas, Expressions, Policies, Failures, Events, Operations, Workflows and Views. Surfaces and Applications are not feature-owned. - `group` is required. `feature` is optional. When set, the Feature's `group` must equal the declaration's `group` (`ir.feature.group_mismatch`), and the Feature must exist (`ir.feature.unresolved_reference`). - Features are flat inside their Group. There is no Feature parent. - Features and Groups do not list their members. Membership is a derived reverse index, so two Features can never claim the same declaration. - Ownership is not usage. Any declaration may `$ref` any other, across Features and Groups. - A pack using `scope: collects.feature` partitions only feature-owned subjects. Group-owned subjects are skipped with an info diagnostic (`planner.partition.feature_owner_absent`). Use `collects.group` to include them. ## Feature identity and declaration identity Feature ownership never changes declaration identity. `users.User` stays `users.User`, not `users.Accounts.User`. Registries remain separated by semantic meaning, and packs look declarations up through those registries. View parts inherit the owner of their View. Operation facets and Schema storage are reached through their owning declaration. ## Group hierarchy Groups may have parent Groups: ```yaml groups: platform: {} users: parent: $ref: "#/groups/platform" ``` Group hierarchy may participate in inherited semantic scope such as effective policies and scoped HTTP roots. It does not imply: - filesystem nesting; - package nesting; - runtime module loading; - service/process boundaries; - deployment topology; - generated code layout. Packs may choose generated structure from Group/Feature meaning, but that choice belongs to the pack. ## Application relationship Applications select Groups directly: ```text Application -> Groups ``` Applications do not own Feature lists. Features are reached through their owning Groups, and declarations through their `feature`/`group` owner: ```text Application -> Groups -> Features -> declarations ``` This keeps application composition simple while retaining reusable Feature structure. ## Boundaries A Group does not redefine: - Property value meaning; - Schema state meaning; - Operation behavior; - Workflow orchestration; - Event meaning; - Policy rules; - View/Presentation meaning. A Feature also does not redefine those meanings. It is the named owner that declarations point at. Neither Group nor Feature implies framework modules, packages, directories, services, or deployment units. ## Canonical ownership summary ```text DryvIR groups canonical Group registry features canonical Feature lookup registry schemas canonical Schema registry operations canonical Operation registry events canonical Event registry workflows canonical Workflow registry ... Group features -> Feature refs Feature group -> owning Group parent? -> Feature in same Group declaration membership refs Application groups -> Group refs ``` This gives Dryv both human structural organization and flat deterministic semantic registries without introducing hidden nesting into declaration identity. --- <!-- Source: https://docs.dryvcode.com/authoring/vocabulary/properties --> # Properties Properties are reusable value definitions shared across Dryv Authoring, canonical Runtime IR, and template packs. This page describes the current contract. Earlier unpublished Property shapes are not compatibility inputs. ## Reusable property families Canonical Runtime IR has exactly nine property registries: ```text primitives enums composites literals unions records tuples generics temporal ``` There is no catch-all `types` registry and there are no `unknowns` or `dynamics` registries. ## Primitive properties Primitive properties are string, number, and boolean definitions. String semantics are explicit: ```yaml properties: primitives: DisplayName: type: string kind: text length: min: 1 max: 120 Email: type: string kind: format format: email ``` Number semantics use `type: number` with a numeric `kind`: ```yaml properties: primitives: Count: type: number kind: integer format: non-negative-integer range: min: 0 Price: type: number kind: decimal format: money precision: 12 scale: 2 currency: KES PriceCents: type: number kind: integer format: money minor_units: true currency: KES ``` `integer` is not a primitive `type`. Money is a number with `format: money`. In major units it's a `decimal` with precision and scale. With `minor_units: true` it's an `integer` count of minor units (cents). `currency` is an optional ISO 4217 code. `currency` and `minor_units` are valid only on money. ## Temporal properties Dates, times, instants, durations, intervals, year-month, and month-day are first-class reusable temporal properties: ```yaml properties: temporal: CreatedAt: kind: instant precision: millisecond MaintenanceWindow: kind: interval point: $ref: "#/properties/temporal/CreatedAt" range: min: PT5M max: PT2H ``` Temporal meaning is not encoded through a string-format fallback. ## Enum properties Enums define reusable closed scalar sets with authored member keys and values: ```yaml properties: enums: Status: values: active: value: active disabled: value: disabled ``` `ordered: true` makes declaration order semantic and enables ordering operations. ## Composite properties Composites define reusable structured values without making them source/schemas/entities: ```yaml properties: composites: Money: fields: amount: kind: property $ref: "#/properties/primitives/Amount" currency: kind: property $ref: "#/properties/primitives/Currency" ``` Composite invariants reference named canonical Expressions. They are reusable value-level rules evaluated against the composite value rather than embedded anonymous rule objects: ```yaml properties: composites: shared.Range: fields: min: kind: property $ref: "#/properties/primitives/shared.Number" max: kind: property $ref: "#/properties/primitives/shared.Number" invariants: - $ref: "#/expressions/shared.ValidRange" ``` The Expression owns the reusable rule; the Composite owns the fact that the invariant applies to its value. ## Literal, union, record, and tuple These remain distinct reusable families: ```text literal -> one exact scalar/null value union -> one explicitly named discriminated alternative record -> explicit key/value map meaning tuple -> fixed positional sequence meaning ``` Reusable unions are always discriminated: ```yaml Identifier: discriminant: identifierKind members: byUuid: kind: reference $ref: "#/properties/primitives/Uuid" bySlug: kind: reference $ref: "#/properties/primitives/Slug" ``` A canonical value uses the union's discriminant plus `value`: ```yaml identifierKind: byUuid value: 018f6f0d-7e6b-7c4c-bca2-4cc840e9d8f5 ``` ## Generic properties Generic definitions and reusable applications share `properties.generics`: ```yaml Page: kind: definition parameters: - name: T value: {} ``` ```yaml UserPage: kind: application $ref: "#/properties/generics/Page" arguments: - kind: reference $ref: "#/schemas/User" ``` Applications use positional arguments and must match the target definition's parameter count exactly. ## Direct unknown and dynamic `unknown` and `dynamic` are direct field targets only: ```yaml fields: providerPayload: kind: unknown runtimeMetadata: kind: dynamic ``` They are not reusable properties and cannot occur recursively inside `TypeExpression`. ## Field target contract Canonical field kinds are: ```text property schema unknown dynamic ``` ```text property -> $ref required schema -> $ref required unknown -> $ref forbidden dynamic -> $ref forbidden ``` Presence, nullability, and arrays remain use-site semantics. ## Naming and compiler normalization ```text Dryv-owned keys lower_snake_case Dryv-owned fixed values lower-kebab-case Authored identifiers preserve exactly External/reserved tokens preserve exactly ``` An Authoring implementation may expose idiomatic host-language names, but its compiler must emit canonical Runtime names and values explicitly. It must not recursively rename authored identifiers such as `moneyAmount`, `UserProfile`, `externalCustomerId`, or union member names. Canonical references use `$ref`. See: - `.tasks/docs/design/ir-properties.md` - `.tasks/docs/design/canonical-naming.md` - `.tasks/docs/design/ir.md` ## Authoring expectations An Authoring SDK may provide ergonomic constructors and infer which canonical registry owns a declaration. The compiler remains responsible for producing the exact current Runtime contract and rejecting meaning that cannot be represented without hidden semantics. ## Pack expectations Packs consume canonical property meaning directly. They may support, lower, bind, or explicitly reject a concept depending on target capability, but must not redefine it. --- <!-- Source: https://docs.dryvcode.com/authoring/vocabulary/schemas --> # Schemas This document describes the canonical Runtime IR contract. Authoring implementations may expose richer helpers, but they must lower into these resolved forms. Runtime IR does not preserve authoring selectors, shorthand, or compatibility shapes. ## Meaning A Schema describes canonical structured software state. Properties own reusable value meaning. Schemas compose those reusable values into structured state and add context-specific semantics such as usage, relationships, query capability, mutation rules, field-local sources, inheritance, projection, policies, and portable storage requirements. Schema meaning is resolved and inspectable. Packs consume that meaning; they do not redefine it. ## Canonical field shape Schema and composite fields use a flat shape. There is no `usage` wrapper. ```yaml email: kind: property $ref: "#/properties/primitives/customers.Email" optional: true nullable: true array: min: 1 max: 5 ``` Absence has canonical meaning: - no `optional` means required; - no `nullable` means non-nullable; - no `array` means scalar. `array: {}` means an unbounded array. `array.min` and `array.max` constrain collection length. Fields target one of: - a Property; - another Schema; - intrinsic `unknown`; - intrinsic `dynamic`. Properties and Schemas remain the reusable semantic authority. Field usage does not mutate the referenced definition. ## Field defaults A field may declare a literal canonical value or a named Expression reference as its default. ```yaml status: kind: property $ref: "#/properties/enums/orders.Status" default: pending ``` Computed defaults use the canonical Expression registry rather than inline expression definitions. ## Mutation, query, sensitivity, and policies Field mutation currently supports: - `create-only`; - `system`; - `context`; - `transition`. Absence means normal mutable participation. Query capability is explicit and resolved: ```yaml email: kind: property $ref: "#/properties/primitives/customers.Email" query: filter: [contains, equal] sort: true search: true ``` Only capabilities compatible with the effective field target and usage are valid. Optional, nullable, and array usage enable their corresponding operators. `allow_nested: true` is only valid for Schema/composite targets. Sensitivity is expressed as `sensitive: true`; absence means no local sensitivity declaration. Field policies reference reusable Policies: ```yaml policy: read: $ref: "#/policies/customers.CanReadEmail" write: $ref: "#/policies/customers.CanEditEmail" ``` Capabilities and policies remain distinct: capability says whether the behavior is semantically supported; policy says under which reusable rule it may be exercised. ## Effective Schema field references Schema relationships reference effective Schema meaning, not physical serialized field locations. Canonical field reference: ```yaml $ref: "#/schemas/customers.Customer" field: id ``` Do not use physical pointers such as: ```yaml #/schemas/customers.Customer/fields/id ``` The effective reference remains valid when the field is inherited or projected because it identifies the Schema and effective field name rather than one storage location in the document. ## Inheritance `extends` means specialization / IS-A. ```yaml schemas: records.BaseRecord: abstract: true fields: id: kind: property $ref: "#/properties/primitives/shared.Id" customers.Customer: extends: $ref: "#/schemas/records.BaseRecord" fields: name: kind: property $ref: "#/properties/primitives/customers.Name" ``` Rules: - one direct parent; - deep inheritance is valid; - inherited fields are implicit and must not be serialized again on a child; - redefining an inherited field is invalid; - inheritance cycles are invalid; - effective Schema meaning includes the full ancestor chain. `abstract: true` marks reusable non-final structured meaning. Absence means concrete. ## Relations A forward relation is declared on a Property field and points to an effective field on another Schema. ```yaml customerId: kind: property $ref: "#/properties/primitives/shared.Id" relation: target: $ref: "#/schemas/customers.Customer" field: id cardinality: many-to-one on_delete: restrict ``` Cardinality is one of: - `one-to-one`; - `one-to-many`; - `many-to-one`; - `many-to-many`. Lifecycle behavior is one of: - `restrict`; - `cascade`; - `detach`; - `reset`. Normal relation cycles and self-relations are valid. Cascade graphs are validated separately because delete/update cascade cycles can make lifecycle behavior unsafe or ambiguous. Forward relation source and target fields must have compatible effective types. ## Reverse related fields Reverse navigation is explicit and belongs on a Schema-valued field. ```yaml orders: kind: schema $ref: "#/schemas/orders.Order" array: {} related: via: $ref: "#/schemas/orders.Order" field: customerId cardinality: one-to-many ``` `related.via` must resolve to a forward relation that targets the Schema represented by the reverse field. An optional `inverse` effective-field reference may make a paired relationship explicit. `relation` and `related` are different semantic facts and cannot coexist on the same field. ## Field-local sources Sources are Schema-field semantics. There is no root `sources` registry. A field may own named sources for distinct purposes. The source selects its producing Operation output through a typed `OperationPortRef` rather than a separate Operation reference plus output name: ```yaml countryId: kind: property $ref: "#/properties/primitives/shared.Id" sources: choices: purpose: options output: $ref: "#/operations/countries.ListCountries" direction: output index: 0 ``` Purpose is one of: - `value`; - `resolve`; - `options`. Sources may bind Operation inputs either from the consuming field value or from another effective Schema field. Bindings are ordered objects with an explicit target Operation input port and typed source: ```yaml inputs: - target: $ref: "#/operations/countries.ResolveCountry" direction: input index: 0 source: kind: field value: $ref: "#/schemas/customers.Customer" field: tenantId - target: $ref: "#/operations/countries.ResolveCountry" direction: input index: 1 source: kind: value ``` `kind: value` means the consuming field value. `kind: field` references another effective Schema field. Runtime validation checks that the output targets an existing Operation output port, each input binding targets an input port of that same Operation, duplicate targets are rejected, and bound input types are compatible. A field source is not a global data loader, transport endpoint, cache contract, query language, or UI widget definition. ## Storage facets Portable storage requirements belong to Schema under `facets.storage`. There is no root `storage` registry and no Storage reference from Feature. `namespace` is the logical storage namespace, such as a database schema. When a schema doesn't set one, it comes from the nearest group up the owning group chain that sets `facets.storage.namespace`. Physical details (column names, database types, transformers) are pack decisions, never IR. Concrete stored Schema: ```yaml facets: storage: name: customers kind: persistent primary_key: [id] indexes: - fields: [email] unique: true - fields: [tenantId, externalId] unique: true - fields: [createdAt] name: customer_created_at ``` `kind` defaults to `persistent`; `volatile` is also allowed. Indexes have one canonical object shape: ```yaml fields: [fieldA, fieldB] unique: true # optional; absence means false name: index_name # optional ``` There is no scalar index shorthand and no separate uniqueness list. Storage fields resolve against effective Schema fields, including inherited fields. ### Storage inheritance Abstract Schemas may contribute storage rules without concrete identity: ```yaml records.StoredRecord: abstract: true fields: id: kind: property $ref: "#/properties/primitives/shared.Id" facets: storage: primary_key: [id] ``` A concrete descendant that inherits or declares storage rules must complete the facet with its own local `name`: ```yaml customers.Customer: extends: $ref: "#/schemas/records.StoredRecord" facets: storage: name: customers ``` Rules: - abstract storage facets must not declare a concrete storage name; - concrete storage names do not inherit; - inherited primary keys remain implicit and cannot be redefined; - local indexes may extend inherited indexes; - inherited index name/signature conflicts fail; - concrete stored Schemas are inheritance terminals and cannot have descendants. Partitioning is declared in `facets.storage.partitioning` using the storage builder. LIST, composite RANGE/HASH, nested layouts and bounded calendar series share one canonical declaration. Provider-specific ORM decorators, repository code and SQL syntax remain pack concerns. See the [partitioning reference](../../docs/usage/dryv-yaml.md#postgresql-partition-layouts). ## Projection Projection derives a new structured shape from exactly one original non-projected Schema while preserving explicit lineage. Canonical Runtime IR is fully resolved: ```yaml projection: source: $ref: "#/schemas/customers.Customer" purpose: read policies: - $ref: "#/policies/customers.CanReadCustomer" fields: displayName: from: name email: from: email optional: true slug: from: slug ``` Projection purposes are: - `read`; - `create`; - `edit`; - `query`; - `custom`. The Runtime IR does not preserve authoring selectors such as pick/omit/capability selectors or wildcard heuristics. Authoring may offer such helpers, but the compiler must lower them into the explicit `fields` map above. The TypeScript and Python Authors require an explicit purpose helper. An unqualified `projection(source)` is invalid, and `custom` additionally requires an explicit non-empty `pick`. Purpose helpers derive the eligible field set, while `pick`, `omit`, `rename` and usage amendments refine it. Both compilers sort and lower the result to the same explicit canonical map; the Engine never derives hidden fields. Each projected output field records its source field through `from`. Projection may rename and alter usage only; it cannot redefine the underlying Property/Schema target. Usage amendments are explicit. Omitted usage members inherit the source usage. Explicit `optional`/`nullable` booleans can tighten or loosen those dimensions; `array: false` makes the projected field scalar, while an array object sets projected array usage. A projected Schema may add independent local fields through its normal `fields` map. Local fields and projected output fields must not collide. ### Projection safety Projection rules: - source must resolve to an original non-projected Schema; - projection-from-projection is invalid; - projection inheritance is invalid; - abstract projections are invalid; - projection storage facets are invalid; - projection must contain at least one explicit field mapping; - source field names must resolve against effective source fields; - required field policies must be present in `projection.policies`. Purpose-specific restrictions are validated: - `read`: readable normal/system/related fields may be projected, subject to read policies; - `create`: system-, context- and transition-managed and reverse-related fields are excluded, and write policies apply; - `edit`: has create restrictions and also excludes create-only fields; - `query`: projected source fields must expose query capability and required read policies; - `custom`: explicit mappings remain structurally and referentially validated without inventing an implicit purpose. ## Effective Schema resolution Consumers should reason about effective meaning, not raw declaration location. Effective fields are resolved from: 1. inherited ancestor fields; 2. explicit projection mappings when the Schema is a projection; 3. local fields. Invalid collisions/redefinitions are rejected rather than resolved by hidden precedence. Effective-field references, relations, related fields, storage rules, examples, validation, and inspection all operate on this same resolved meaning. Inspection preserves provenance separately: projection lineage shows each projected output field and its source effective field; inheritance remains visible through `extends`; storage dependencies point to effective Schema fields. ## Invariants An invariant is a named rule that every valid value of the schema satisfies. The rule is a boolean expression declared in `expressions`. It reads the schema's fields through the `value` context, exactly as composite invariants do. ```yaml expressions: commerce.QuantityPositive: group: { $ref: "#/groups/commerce" } value: operator: greater-than left: { context: value, path: [quantity] } right: { value: 0 } schemas: commerce.CartItem: invariants: - name: quantityPositive rule: { $ref: "#/expressions/commerce.QuantityPositive" } message: Quantity must be at least 1 ``` - `name` is alphanumeric, starts with a letter, and is unique within the schema. `message` is optional plain text. - A rule may read only the `value` context, and every path must resolve to one of the schema's effective fields. Diagnostics: `ir.schema.invariant_unknown_context`, `ir.schema.invariant_unresolved_field`, `ir.schema.invariant_type_mismatch`. - Invariants are for rules across fields or computed rules. Single-field limits (range, length, pattern) stay field constraints. - **Effective invariants.** `extends` inherits every parent invariant. A projection carries over a source invariant only when every field the rule reads is projected under the same name; otherwise it's dropped. A local invariant with the same name replaces an inherited one. ## Metadata Schemas and fields may use universal semantic metadata such as `tags` and structured `explanations`. Metadata does not create hidden behavior. ## Boundaries Schemas do not own: - reusable Property value/type meaning; - reusable Policy definitions; - Operation execution/retry/transport behavior; - Workflow orchestration; - Event occurrence definitions; - Part/View/Presentation experience behavior; - framework ORM models; - database-provider implementation details; - generated file/folder structure. Schemas may reference Properties, Policies, Operations, and other Schemas when structured-state meaning requires those relationships. ## Canonical summary The established Schema surface includes: - structured state definitions; - flat fields and contextual usage; - literal/expression defaults; - mutation, query, sensitivity, and field policy semantics; - deep single-parent inheritance with implicit inherited fields; - effective Schema-field references; - forward relations and reverse related fields; - field-local named sources; - Schema-owned `facets.storage`; - explicit resolved projections with purpose and lineage; - Schema examples; - universal semantic metadata. There are no canonical root Source or Storage registries, no field `usage` wrapper, no physical Schema-field reference convention, and no weak projection selector representation in Runtime IR. --- <!-- Source: https://docs.dryvcode.com/authoring/vocabulary/operations --> # Operations ## Meaning An Operation is a named executable semantic capability of the authored software. Operation identity exists independently of transport. HTTP, schedules, WebSocket reachability, and future callable transports are owned mappings around the Operation rather than root declarations. ## Canonical shape An Operation may define: - optional `group`; - optional semantic `role`; - one `input`: named `fields`, or one `schema`; - one `output`; - declared failures; - emitted Events; - access/policy requirements; - execution semantics; - Operation-owned facets (`http`, `websocket`, `schedule`), one per kind; - universal semantic metadata. ### Roles The canonical optional role vocabulary is: ```text create update delete detail list search validate transform action ``` A role describes semantic intent. It does not select a framework controller, ORM operation, route, transport, or implementation strategy. When an operation directly references a projected Schema, Runtime validation checks that the projection purpose matches the role and direction: | Operation role | Input projection purpose | Output projection purpose | | -------------- | ------------------------ | ------------------------- | | `create` | `create` | `read` | | `update` | `edit` | `read` | | `delete` | `query` | `read` | | `detail` | `query` | `read` | | `list` | `query` | `read` | | `search` | `query` | `read` | `custom` is compatible in either direction as an explicit exception. `validate`, `transform` and `action` impose no projection-purpose constraint. Ordinary non-projected Schemas remain valid for every role; roles do not cause hidden projection derivation. Validation applies to a whole-schema input, each named schema-valued input field and a schema-valued output. Nested Schemas inside a wrapper are validated through their own declarations rather than recursively assigned an Operation role. An incompatible direct reference produces `ir.operation.projection_purpose_incompatible` at the input or output reference. Authors and compilers preserve the explicit role and projection purpose; the Engine owns this compatibility decision. ## Input and output An Operation takes **one input** and returns **one output**, like a component that takes one props object. Every value it receives has a name, so bindings and generated code use names, never positions. The input is either named fields, in declaration order: ```yaml input: fields: - name: userId value: $ref: "#/properties/primitives/shared.Id" - name: body value: $ref: "#/schemas/users.UpdateUserBody" output: value: $ref: "#/schemas/users.User" ``` or one schema, whose fields are the input fields: ```yaml input: schema: $ref: "#/schemas/users.UserListQuery" ``` Both are optional. Field names are unique, and values are `ValueRef`s (`PropertyRef | SchemaRef`). Operations don't own anonymous type expressions: richer meaning is modelled as Properties or Schemas first. Templates always see named fields: for a schema input, `operation.input.fields` lists the schema's effective fields (ordered by name), and `operation.input.value` is the schema itself. ## Port references A reference to an Operation's output, or to one of its input fields: ```yaml $ref: "#/operations/users.UpdateUser" direction: input field: userId ``` `field` names an input field. It is omitted for the output, and for the **whole input** when the input is one schema (for example, a list endpoint binding its query schema as a query object). Validation rejects unknown fields, whole-input references to an inline-fields input, and duplicate bindings. Required fields must all be bound; optional schema fields may be left out. Do not use physical pointers such as `#/operations/users.CreateUser/input/fields/user`. Workflows still bind by position. An operation step sees a schema input as position 0 and named fields in declaration order; the output is position 0. ## Failures and Events Operations may declare reusable Failure references and emitted Event references: ```yaml failures: - $ref: "#/failures/users.EmailTaken" emits: - $ref: "#/events/users.UserCreated" ``` The Failure/Event definitions remain owned by their canonical registries. An Operation emitting an Event and an Event declaring listeners are separate relationships: ```text Operation -> emits -> Event Event -> listeners -> Operation / Workflow ``` ## Access and execution Operation-owned semantic execution facets currently include: - sync/async mode; - timeout; - rate limiting; - cache TTL; - transaction requirement; - retry/backoff; - idempotency; - audit requirement; - invalidation relationships. Idempotency references an input port of the same Operation through `OperationPortRef`. Framework middleware, guards, queue products, transaction libraries, cache providers, controller classes, decorators, and similar implementation details remain pack concerns. ### Trusted record scope An Operation may declare trusted constraints for selecting persisted records. Each binding names a persisted field directly and a value provided by a Policy attached to that Operation: ```yaml scope: bindings: - target: $ref: "#/schemas/orders.Order" field: tenantId source: policy: $ref: "#/policies/orders.CurrentTenant" name: tenantId ``` The target Schema must have persistent storage, and the target must resolve to a scalar property with a statically known type. The named Policy must appear in `access.policies`, declare the named value under `context.provides`, and provide a value of the same type. A field may be bound only once per Operation. Scope is valid for `detail`, `list`, `search`, `update`, and `delete`, which select existing records. A detail/update/delete Operation can use a path ID and body without a query projection; the binding still targets the persisted Schema field directly. When an Operation has query or read projections, clients and packs use their field mappings to identify aliases that expose the scoped field and reject those aliases during request validation. A scoped field is not a caller-controlled filter. The Policy evaluator supplies the trusted value in operation context. Every declared predicate is combined with ordinary client filters using conjunction. Missing trusted values fail closed. Scope is never inferred from names, roles, Groups, relations, path values, or transport configuration. The Engine validates declarations but does not evaluate Policies or execute database queries; those remain application and pack responsibilities. Operations without `scope` retain their existing meaning. ## Operation-owned facets There is no root transport registry. Transport reachability belongs to the owning Operation as `facets`, with at most one facet per kind (decision 0012). **An operation with an `http` facet must belong to a feature** (`feature` set). A group-owned operation serves other purposes, such as workflows and events, and is never an HTTP endpoint. Validation fails with `ir.http.feature_required` otherwise. For example: ```yaml operations: users.CreateUser: input: schema: $ref: "#/schemas/users.CreateUser" output: value: $ref: "#/schemas/users.User" facets: http: method: POST path: /users ``` The facet key is its kind, so facets carry no `kind` field. Pack `facet: http|websocket|schedule` filters match these keys. ### HTTP HTTP bindings explicitly connect transport sources and responses to named input fields, the whole schema input, or the output. Example: ```yaml facets: http: method: POST path: /users inputs: - port: $ref: "#/operations/users.CreateUser" direction: input source: kind: body outputs: - port: $ref: "#/operations/users.CreateUser" direction: output response: status: 201 ``` HTTP path/query/header/cookie/body/form/multipart semantics are transport mappings. They do not redefine Operation input meaning. ### Schedule A schedule that invokes a semantic capability is Operation-owned: ```yaml facets: schedule: schedule: kind: daily hour: 2 minute: 30 time_zone: Africa/Nairobi ``` ### WebSocket WebSocket reachability is Operation-owned. Event emission/listening remains represented through Operation `emits` and Event `listeners`, not duplicated inside WebSocket transport configuration. ## Boundaries Operations reference Properties/Schemas for value meaning, Policies for reusable rules, Failures for declared failure meaning, and Events for occurrences emitted during execution. Operations do not own those definitions. Transport is subordinate to Operation meaning. Packs decide how canonical Operations become controllers, RPC procedures, workers, handlers, queues, framework decorators, SDK methods, or other generated implementation artifacts. --- <!-- Source: https://docs.dryvcode.com/authoring/vocabulary/events --> # Events ## Meaning An Event is a named semantic occurrence in authored software. It describes that something meaningful happened without binding the occurrence to a broker, queue, WebSocket library, callback mechanism, framework event object, or delivery product. Events are defined once and referenced by other semantic systems. ## Canonical shape An Event may define: - optional `group`; - optional description/semantic metadata; - optional direct payload value; - zero or more typed listeners. Example: ```yaml events: users.UserCreated: group: $ref: "#/groups/users" payload: $ref: "#/schemas/users.User" listeners: - kind: operation operation: $ref: "#/operations/notifications.SendWelcomeEmail" - kind: workflow workflow: $ref: "#/workflows/users.Onboarding" ``` ## Payload An Event payload is a direct `ValueRef`: ```text PropertyRef | SchemaRef ``` It is not an arbitrary `TypeExpression`. If a richer payload shape is needed, that meaning must first be expressed as a reusable Property or Schema. Omitting `payload` means the Event carries no canonical value payload. ## Listeners Listeners belong to the Event. Canonical listener kinds are currently: ```text operation workflow ``` An Operation listener references one Operation. A Workflow listener references one Workflow. When an Event has a payload, a direct listener must expose exactly one compatible input value. When an Event has no payload, it cannot directly satisfy listener inputs. This rule makes Event-to-listener value flow explicit and deterministic. ## Emission versus listening These are separate relationships: ```text Operation -> emits -> Event Event -> listeners -> Operation / Workflow Workflow WaitStep -> waits for -> Event ``` An Operation's `emits` list records that the Operation may cause the occurrence. The Event's `listeners` list records semantic consumers that are triggered by the occurrence. A Workflow wait step records orchestration that pauses until the occurrence happens. None of these relationships should be collapsed into a detached transport declaration. ## Removed model There is no root Event exposure and no `EventExposure` contract. Do not represent: ```yaml exposures: Something: kind: event event: ... operation: ... ``` There is no root `exposures` registry at all. ## Boundaries Events do not define broker topics, queues, WebSocket channels, HTTP callbacks, retry products, delivery guarantees, consumer group names, or framework handlers. Those implementation details remain pack/runtime concerns unless a future canonical semantic contract is explicitly approved. Event identity and payload/listener meaning remain portable across implementations. --- <!-- Source: https://docs.dryvcode.com/authoring/vocabulary/policies --> # Policies ## Meaning A Policy is reusable declarative rule meaning that can be referenced wherever the App needs a policy decision without embedding framework or implementation behavior. A Policy owns the reusable rule. A use site owns the fact that the Policy applies there. ## Canonical shape A Policy may define: - optional Group membership; - description and universal semantic metadata; - optional typed context requirements/provisions; - an optional named Expression rule. ```yaml policies: orders.CanEditOrder: group: $ref: "#/groups/orders" description: May edit an order context: requires: actor: $ref: "#/schemas/identity.Actor" provides: order: $ref: "#/schemas/orders.Order" rule: $ref: "#/expressions/orders.CanEditOrderRule" ``` `context.requires` and `context.provides` are named canonical value references. The Expression registry owns reusable computation/rule structure; Policy owns the decision contract and the fact that its rule applies. ## Use sites Policies may be referenced by concepts such as: - Operation access requirements; - Schema fields; - Schema projections; - Groups and Applications through effective scope; - Parts through `when`; - View and Workflow transitions. Those concepts do not redefine the Policy. ## Boundaries Policies must not encode framework-specific guards, middleware, decorators, database-provider rules, UI controls, or generated implementation structure. Policy evaluation infrastructure may interpret canonical Policy and Expression meaning, but implementation/runtime mechanics are not authored Policy semantics. --- <!-- Source: https://docs.dryvcode.com/authoring/vocabulary/workflows --> # Workflows ## Meaning A Workflow describes semantic orchestration across multiple pieces of behavior over time. It owns ordered/conditional/waiting execution that is larger than one Operation. Workflow meaning remains declarative and implementation-neutral. Queue engines, workflow products, workers, schedulers, persistence products, and execution frameworks remain pack/runtime choices. ## Canonical shape A Workflow may define: - optional `group` and semantic metadata; - ordered direct input value ports; - ordered direct output value ports; - explicit output bindings; - a named start step; - named steps; - transitions between steps. Example: ```yaml workflows: users.Onboarding: inputs: - value: $ref: "#/schemas/users.User" outputs: - value: $ref: "#/schemas/users.User" start: $ref: "#/workflows/users.Onboarding" step: create ``` ## Workflow ports Workflow inputs/outputs use the same direct authored-value principle as Operations: ```yaml inputs: - value: $ref: "#/schemas/users.User" ``` A port references one canonical `ValueRef`: ```text PropertyRef | SchemaRef ``` Workflow I/O is ordered. It is not a keyed map of arbitrary `ValueUsage` contracts. Typed Workflow port references use: ```yaml $ref: "#/workflows/users.Onboarding" direction: input index: 0 ``` ## Step identity A Workflow step is addressed through the Workflow identity plus an explicit step key: ```yaml $ref: "#/workflows/users.Onboarding" step: create ``` Do not use physical pointers such as: ```text #/workflows/users.Onboarding/steps/create ``` ## Step kinds Canonical step kinds currently include: - `operation` — invoke an Operation; - `workflow` — invoke another Workflow; - `wait` — wait for a semantic Event. Operation and nested-Workflow steps do not redefine the target declaration's input/output meaning. ## Explicit value flow Step input flow is explicit. A binding identifies the target input index on the invoked Operation/Workflow and a typed semantic source: ```yaml inputs: - target: 0 source: kind: workflow-input port: $ref: "#/workflows/users.Onboarding" direction: input index: 0 ``` Supported Workflow value sources are: ### Workflow input ```yaml kind: workflow-input port: $ref: "#/workflows/users.Onboarding" direction: input index: 0 ``` ### Step output ```yaml kind: step-output step: $ref: "#/workflows/users.Onboarding" step: create index: 0 ``` ### Event payload ```yaml kind: event-payload step: $ref: "#/workflows/users.Onboarding" step: created ``` An Event-payload source is valid only for a wait step whose Event has a payload. ## Workflow outputs Workflow output flow is also explicit: ```yaml output_bindings: - target: $ref: "#/workflows/users.Onboarding" direction: output index: 0 source: kind: step-output step: $ref: "#/workflows/users.Onboarding" step: create index: 0 ``` The source value must be compatible with the target Workflow output value. ## Transitions Transitions use typed Workflow-step references: ```yaml transitions: - from: $ref: "#/workflows/users.Onboarding" step: create to: $ref: "#/workflows/users.Onboarding" step: waitForCreated ``` An optional Policy reference may guard a transition. ## Event relationships A wait step may wait for an Event: ```yaml waitForCreated: kind: wait event: $ref: "#/events/users.UserCreated" ``` This is different from an Event listener. ```text Event.listeners ``` expresses consumers triggered by the Event. ```text Workflow WaitStep ``` expresses orchestration that waits for an Event occurrence. ## Removed model Do not emit keyed Workflow input/output maps, arbitrary canonical-value dictionaries, implicit type-based input inference, or physical step pointers. The old patterns: ```text #/workflows/<name>/inputs/<key> #/workflows/<name>/steps/<key> ``` are not canonical behavior references. ## Boundaries A Workflow may invoke Operations and nested Workflows and wait for Events, but it does not redefine those declarations. Value flow must remain explicit, typed, deterministic, inspectable, and portable. Hidden transformations or string-path mapping conventions are not part of canonical Workflow meaning. --- <!-- Source: https://docs.dryvcode.com/authoring/vocabulary/views --> # Views ## Meaning A View is a coherent semantic interaction composed from Parts. It describes experience meaning without describing framework pages, visual component trees, layout, styling, route handlers, or generated files. ## Canonical shape A View may define: - required Group membership; - optional semantic role (`list`, `detail`, `form`, `dashboard`, `wizard`, or `search`); - description; - named `context` values; - named tagged `parts`; - named local `presentations`. Example: ```yaml views: orders.OrderDetails: group: $ref: "#/groups/orders" context: orderId: $ref: "#/properties/primitives/orders.OrderId" parts: details: kind: present source: port: $ref: "#/operations/orders.GetOrder" direction: output index: 0 presentations: web: surface: $ref: "#/surfaces/web" layout: master-detail peers: - $ref: "#/views/orders.OrderList" ``` ## View context View context contains named reusable semantic values whose types are canonical `ValueRef`s. A Part refers to context through a typed `ViewContextRef`: ```yaml $ref: "#/views/orders.OrderDetails" context: orderId ``` Runtime validation requires the referenced View and context name to exist. Interaction Part bindings are restricted to context owned by the same View. ## Parts Parts are a closed tagged union of: - `present` — reads Operation output meaning; - `collect` — supplies Operation input meaning from collected values and/or View context; - `invoke` — invokes an Operation using View context for required inputs. See `parts.md` for the canonical shapes and validation rules. ## Local presentations A View owns a named map of lightweight Presentation bindings. Each binding contains a Surface reference and may include portable layout intent: ```yaml presentations: mobile: surface: $ref: "#/surfaces/mobile" layout: flow ``` `layout` is `flow` or `master-detail`. A `master-detail` binding requires at least one `peers` View reference; peers are invalid for other layouts. Presentation is not a root declaration and has no independent identity outside its owning View. ## Navigation The previous Event-driven `ViewTransition` model remains removed. Portable navigation is now Application-owned: destinations reference Views and transitions connect destination names. URLs, route strings, framework pages and stack operations remain pack-owned. ## Boundaries A View does not own transport endpoints, URLs, route strings, CLI commands, framework pages, component trees, layout, or styling. Surface remains a reusable root declaration. View-local Presentation binds a View to a Surface without becoming a second root registry. --- <!-- Source: https://docs.dryvcode.com/authoring/vocabulary/parts --> # Parts ## Meaning A Part is a neutral semantic interaction building block owned by one View. A Part describes one focused interaction meaning without prescribing visual controls, layout, framework components, or styling. Canonical Dryv does not use UI-widget vocabulary such as button, form, input, card, table, modal, or framework component as Part kinds. Those are template-pack concerns. ## Canonical kinds `Part` is a closed tagged union: - `present` - `collect` - `invoke` The previous broad Part object with `presents`, `collects`, `invocation`, `contains`, `emits`, `reacts`, and `when` no longer exists. ## Present Part A Present Part reads from one Operation output port. ```yaml kind: present collection: table source: port: $ref: "#/operations/orders.GetOrder" direction: output index: 0 select: - [id] - [status] - [customer, address, city] ``` `select` is optional. When omitted, the whole output value is presented. `collection` is optional portable collection intent: `list` or `table`. It does not select a widget, component library or target-specific behavior. Paths are semantic segment arrays, not dotted strings. Runtime validation resolves them through effective Schema or Composite Property meaning and rejects unknown or non-traversable paths. ## Collect Part A Collect Part supplies one Operation input port from user-collected meaning, View context, or both. ```yaml kind: collect flow: overlay target: port: $ref: "#/operations/orders.UpdateOrder" direction: input index: 0 collect: - [notes] context: - path: [id] source: $ref: "#/views/orders.OrderDetails" context: orderId ``` `collect` uses semantic segment paths. Context bindings use typed `ViewContextRef` references. Runtime validation requires: - the target to be an Operation input port; - every selected path to resolve against the input value; - context references to belong to the same owning View; - context value types to match their target input paths; - user-collected and context-supplied paths not to overlap; - overlapping context target paths to be rejected; - all required input meaning to be satisfied whenever the input is partially supplied. If `collect` and `context` are both omitted, the whole input value is collected. `flow` is optional interaction intent: `inline`, `overlay`, or `destination`. It does not prescribe a modal, sheet, route or framework navigation primitive. ## Invoke Part An Invoke Part invokes an Operation without collecting user input itself. ```yaml kind: invoke emphasis: danger operation: $ref: "#/operations/orders.CancelOrder" context: - target: $ref: "#/operations/orders.CancelOrder" direction: input index: 0 source: $ref: "#/views/orders.OrderDetails" context: orderId ``` Every required Operation input port must be supplied explicitly from View context. Duplicate or foreign input-port bindings are invalid. `emphasis` is optional action priority: `normal`, `primary`, or `danger`. Packs choose the concrete control and styling. ## Boundaries Parts may reference Operations and View context and carry the closed interaction hints above. They do not own routes, addresses, surfaces, styling, concrete layout, navigation, Events, Policies, or other Parts. Operations own behavior contracts. Views own interaction context and Part composition. Template packs decide how those meanings become concrete controls and components. --- <!-- Source: https://docs.dryvcode.com/authoring/vocabulary/presentations --> # Presentations ## Meaning A Presentation connects one owning View to a reusable Surface. It is intentionally lightweight and has no independent canonical identity outside that View. ## Canonical shape Presentations live under Views: ```yaml views: orders.OrderDetails: presentations: web: surface: $ref: "#/surfaces/web" layout: master-detail peers: - $ref: "#/views/orders.OrderList" mobile: surface: $ref: "#/surfaces/mobile" ``` The local map key identifies the presentation within its owning View. A View Presentation contains: - required `surface`. - optional `layout`: `flow` or `master-detail`; - optional `peers`, permitted and required only for `master-detail`. Runtime validation requires Surface and peer View references to resolve. It rejects peers on non-master-detail layouts and master-detail layouts without peers. ## Removed root model The following old model no longer exists: - root `presentations` registry; - `PresentationRef`; - Presentation Group membership; - Presentation parent chains; - `WebPathAddress`; - `CliCommandAddress`; - `AppRouteAddress`; - generic Presentation `Address`; - Feature presentation membership; - Application presentation membership; - standalone authoring `presentation` records. There is no compatibility loader or compiler translation for those shapes. ## Surfaces Surfaces remain reusable root declarations. Canonical Surface kinds are: - `web`; - `mobile`; - `desktop`; - `cli`; - `embedded`. A Surface may carry Group membership and description. It represents a broad semantic interaction environment rather than a framework implementation. ## Routing and navigation Routing/address semantics are intentionally not preserved from the removed root Presentation model. Application destinations may select a View and one of its local Presentation names, and Application transitions connect those destinations. Template packs map destinations, transitions, Views and Surfaces to framework routes or navigation stacks. Concrete route strings and stack operations are not canonical Runtime IR meaning. ## Boundaries Parts describe local interaction meaning. Views compose Parts and own context. View-local Presentations bind those Views to Surfaces. Concrete components, styling, breakpoint behavior, routing implementation, and generated file structure remain template-pack concerns. --- <!-- Source: https://docs.dryvcode.com/authoring/vocabulary/themes --> # Themes ## Meaning A Theme is a Group-owned semantic declaration that supplies interoperable token values and a closed set of portable roles. It preserves design meaning across targets without putting CSS, Flutter, SwiftUI, component-library names or environment selection into Runtime IR. ## Canonical shape ```yaml themes: shared.Brand: group: $ref: "#/groups/shared" tokens: ink: kind: color value: "#10201a" paper: kind: color value: "#f7fbf9" inkAlias: kind: color value: token: ink roles: content.primary: { token: inkAlias } surface.background: { token: paper } modes: dark: color_scheme: dark roles: surface.background: { token: ink } ``` The closed token kinds are `color`, `dimension`, `font-family`, `font-weight`, `duration`, `cubic-bezier`, `number`, and `shadow`. An alias names another token and must retain the same kind. Dimensions use `px` or `rem`; durations are non-negative milliseconds; colors use six- or eight-digit hexadecimal notation. The closed roles are `content.primary`, `content.inverse`, `surface.background`, `surface.elevated`, `action.primary`, `action.danger`, `border.default`, and `focus.indicator`. Runtime resolves aliases, rejects cycles and missing targets, and verifies that each role has the required token kind. ## Modes A named mode has a unique selector made from at least one of: - `color_scheme`: `light` or `dark`; - `contrast`: `standard` or `more`; - `density`: `comfortable` or `compact`. A mode overrides one or more role bindings. The environment selects a matching mode; Runtime IR does not contain operating-system probes, media queries or application preference storage. ## Application relationship An Application may reference one Theme. Generation context exposes the selected Theme with aliases resolved to deterministic typed values so packs do not need to reimplement alias traversal. ## Boundaries Themes do not define components, widgets, pages, route strings, responsive breakpoints or target token syntax. Packs map semantic roles and typed values to target representations. Clients and generated applications own environment observation and mode selection.