On this page
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
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:
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.
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:
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:
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:
- run: [npm, install]
When several candidates have the same remaining argv shape, a grouped alternative token removes repetition:
- run: [(pnpm|bun|yarn), add]
This is transparent shorthand for:
[pnpm, add]
[bun, add]
[yarn, add]
If several argv positions contain grouped alternatives, they are zipped by position, never Cartesian-expanded:
- run: [(a|b|c), (x|y|z), shared]
means:
[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:
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:
choose:
js.package_manager: { options: [pnpm, npm, bun, yarn] }
After grouped-run expansion, each candidate key is:
candidate.id when present
otherwise expanded run[0]
Thus:
commands:
- run: [(pnpm|bun|yarn), add]
- run: [npm, install]
produces candidate keys:
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:
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.
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:
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:
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:
- $(name)@$(version)
A scoped entry applies only while processing that scope:
- 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:
runtime -> pnpm add typeorm@^0.3 reflect-metadata@^0.2
dev -> pnpm add -D prettier@^3 typescript@^5.8
With npm:
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.
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:
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. Action policy lives on destinations.code.<unit>.
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.
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:
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.