Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Projects, packages and the release store

FormaSL project commands organize sources into packages (authored in a forma.toml manifest), optionally grouped into a workspace with one governing domain. This chapter covers the project-mode workflow: manifests, the lock lifecycle, project check/inspect/run/realize, formasl test, package sealing and verification, and source re-introduction.

forma.toml — the package manifest

Every package declares a manifest at its root:

format = 1

[package]
reference = "example.app"     # PackageReference: [A-Za-z0-9][A-Za-z0-9._/-]*
version = "0.1.0"             # VersionLabel:      [A-Za-z0-9][A-Za-z0-9._+-]*
source-roots = ["src"]        # production sources (required, non-empty)
test-source-roots = ["tests"] # test sources (explicit; may be empty)
default-target = "main"

[targets.main]                # named RootSets only
roots = ["example::app"]

# [workspace]
# members = ["packages/member"]   # only at the governing domain root

Dependencies are exact: alias = { package = "example.lib", version = "1.0.0" } or alias = { package = "example.lib", workspace = true } for a workspace member. Test-only dependencies use the same shape under [test-dependencies]; they are admitted only inside test worlds and never authorize a production import.

Active package and workspace members

Discovery starts at the current directory (or an explicit --manifest-path) and resolves both the active package and the governing ResolutionDomain. Inside a workspace member, commands still find the ancestor domain; the active package stays the member:

  • the subject of check/run/realize is the active package’s default-target (or the explicit --target/--root selection);
  • check --package checks the whole active package (package completeness), not the default world;
  • formasl test and package seal operate on the active package;
  • the domain lock and release store live at the domain root.

--manifest-path PATH selects the manifest at exactly that path; a missing file fails (--manifest-path is never reinterpreted as an upward walk).

The lock: forma.lock

The domain lock (<domain-root>/forma.lock) records the exact selected package/provider graph: package entries, sealed release ids, dependency edges, the language semantic basis and the stdlib provider digest. It never embeds source bytes or target-specific closures.

  • Normal mode (no --locked): after a complete exact resolution and validation succeeds, the resolver atomically replaces forma.lock with the canonical solution. A partial or failed solution never becomes the lock.
  • --locked: requires an existing valid lock, validates the current intent against it, and never mutates it. Any mismatch is a typed LOCK_OUT_OF_DATE (or integrity) diagnostic. A present-but-malformed lock is a schema/integrity failure, never silently treated as “lock missing”.
  • --offline: exact local artifacts only; there is no fallback to names, versions, siblings or newest artifacts (v0.1 has no network).
  • --frozen: exactly --locked + --offline (mutually exclusive with the individual flags).

Project flags combine with any of the four verbs in project mode, e.g. formasl check --locked --root example::app.

Project-mode commands

With no explicit .fsl operands, the four verbs run in project mode over the resolved domain:

formasl check   [--manifest-path PATH] [--target NAME] [--root MODULE[@sel]] [--package]
formasl inspect [--manifest-path PATH] --view VIEW [--target NAME] [--root MODULE[@sel]]
formasl run     [--manifest-path PATH] --gas N [--app NAME] [--target NAME] [--root MODULE[@sel]]
formasl realize [--manifest-path PATH] --for PLAN.fsp [--target NAME] [--root MODULE[@sel]]

Mode separation is strict: explicit .fsl operands cannot be combined with project flags.

Tests: formasl test

formasl test FILTER... --receipt PATH discovers *.test.toml suites recursively under the active package’s test source roots, builds the test world (production solution + the package’s test overlay), and executes each case against the sealed subject. Receipts are written atomically and embed the production resolution digest, the test overlay digest, per-case world evidence and exact machine outcomes. Exit classes: 0 pass, 1 mismatch, 2 invalid test/filter, 3 infrastructure failure. A filter is a case-sensitive substring of the fully-qualified case id; zero matches is an invalid test (receipt still written, exit 2).

Sealing and verifying releases

formasl package seal   [--manifest-path PATH] [--locked|--offline|--frozen]
formasl package verify <sealed-release-dir>
formasl package source-rebind --reference <urn> --path <path>
formasl package source-new    --path <path>

package seal freezes the active package’s exact production solution, verifies it, re-checks the sealed bytes through real formasl::check, runs the package’s required *.test.toml cases against the sealed subject, commits the source ledger, and atomically publishes the release into the domain store (<domain-root>/target/forma/releases/<release-id>/). One (package, version) coordinate binds at most one release id inside the store; a second seal of different bytes under the same coordinate fails with a typed conflict, while re-sealing identical bytes is idempotent.

package verify re-verifies a sealed release directory (read-only): the release id is re-derived from the canonical core, every source digest is checked, and each module identity is rediscovered from the sealed bytes.

--store and --ledger are not part of the v0.1 grammar: the release store is ResolutionDomain-derived and the ledger is package-owned. Supplying either is a typed usage error.

Inspecting the resolution: deps and explain

formasl deps                      # every selected provider + dependency edge
formasl explain <reference>       # why one package is here (who requires it)

Both operate on the same governed resolution as check/run (normal mode refreshes forma.lock; --locked/--frozen validate without mutating). Output is deterministic text in canonical order; explain addresses a package by its exact reference — there is no name search.

Remote packages: fetch and publish

formasl publish <release-dir>               # verify + print the metadata document
formasl fetch <registry-base>               # resolve metadata, transfer, verify, install

publish never touches the network (seal != publish): it verifies the sealed artifact fail-closed and emits the registry metadata document; the operator transports artifact + metadata to the registry. fetch reads the metadata document, transfers the artifact separately, verifies every byte against its digest before admitting it into the local release store, and the ordinary resolver consumes it from there. The v0.1 transport is plaintext HTTP/1.1 (no TLS, no redirects, no auth) or plain filesystem locations; see Support and limitations.

Source re-introduction: source-rebind / source-new

The per-package ledger (<package>/.forma/source-ledger.json) tracks every source path with immutable, monotone revisions. When a path returns after a removal, an explicit decision is required:

  • package source-rebind --reference <urn> --path <path> preserves the named source reference and reactivates it at the path;
  • package source-new --path <path> deliberately mints a fresh reference for a path whose previous entries are inactive; the old reference is never reused.

A path that is still actively bound fails closed; rebinding onto a path occupied by a different active reference also fails closed — deactivate or rebind that reference explicitly first.

Exit codes

Project commands follow the frozen taxonomy: 0 success; 1 product/semantic rejection; 2 invalid authored project/package/spec/selection or usage error; 3 driver I/O. See Errors and exits.