On this page

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.

Search in