On this page

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.

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.

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.

Search in