Recipe index
Every linked TypeScript example is compiled by the package typecheck. pack:verify
also executes these modules from the published tarball. Start with the smallest
example matching the workflow rather than assembling primitives from the API
inventory.
| Intent | Executable recipe | Main primitives |
|---|---|---|
| Sequential import or ETL | typed-import.ts |
createSteps, dependsOn, requireOutputs, targets |
| Validate options, outputs, and results | validated-boundaries.ts |
Standard Schema, outputSchema, resultSchema |
| Inspect, plan, or graph a pipeline or command | typed-import.ts |
tubeless inspect, tubeless plan, tubeless graph, toMermaid |
| Safe write/publish preview | publish-with-gates.ts |
dryRun, optionalDependsOn, skipAfterFailureOf |
| Deliberately omit unnecessary work | conditional-step.ts |
step.skippable, valued skip, skip-aware output typing |
| Preserve independent work after failure | best-effort.ts |
continueOnError, structured run result |
| Compose one reusable workflow | child-pipeline.ts |
fromPipeline, mapOptions, resolved async mapResult |
| Call a real HTTP service | remote-steps.ts |
fromRemote, fetch cancellation, validated HTTP output |
| Host a pipeline in a durable engine | host-embedding.ts |
runOrThrow, pass runId / parentRunId |
| Fan out over runtime items | fan-out-progress.ts |
forEachPipeline.skippable, stable keys, concurrency, progress |
| Inspect keyed fan-out failures | fan-out-progress.ts |
error.fanOut, bounded diagnostics, caller-directed reruns |
| Show determinate progress | fan-out-progress.ts |
reportProgress, bounded live CLI rows, complete final trees |
| Watch the live TTY reporter | live-tui.ts |
named steps, nested details; persist with --store |
| Retry and rate-limit remote calls | resumable-enrichment.ts |
withRetry, RateLimiter, injected sleep and signal |
| Resume durable long-running work | resumable-enrichment.ts |
dryRun, openCheckpoint, withCheckpointedBatch |
| Expose and run a typed command-line program | cli-job.ts |
definePipelineCommand, conditional mapOptions, tubeless run |
| Render plans and diagnostics | rendering.ts |
renderPipelinePlan, renderPipelineError |
| Handle cancellation and deterministic testing | cancellation-and-testing.ts |
createPipelineTestRuntime, captured status/progress |
| Export JSON or OpenTelemetry lifecycle events | tracing.ts |
trace context, exporter composition, JSON / OTel, onExporterError |
| Persist, port, inspect, launch, or cancel runs | local-observability.ts |
SQLite / NDJSON stores, tubeless history --pipeline <id>, studio projector |
| Watch many primitives in one run | peloton.ts |
delays, logs, children, fan-out, retry, gates, test runtime |
| Project layout, IDs, and command manifest | tubeless.project.ts |
pipelines/, scripts/, definePipelineProject, tubeless list |
Selection rules
- Use an ordinary step for one unit of domain work.
- Set
dryRun: "skip"or provide a side-effect-freedryRunhandler before exposing side-effecting work through CLI dry-run support. - Use
step.skippableonly for a successful policy decision, never to hide an error. - Use a child pipeline when the child has value independently; use a normal helper function when it does not.
- Use
forEachPipelinewhen every item needs child-pipeline lifecycle and reporting. Opt intoforEachPipeline.skippablewhen policy may omit the whole fan-out and a canonical skipped disposition matters. UserunConcurrentfor lightweight worker functions that should throw on the first failure. UserunConcurrentSettledwhen the caller needs completed results plus that failure without throwing.
Use fromRemote when a unit of work lives on another engine but the parent DAG still runs in this process. Omit dryRun only when the adapter and the remote worker are side-effect free under context.dryRun. Embed the whole pipeline in Temporal/Lambda/a worker when the graph must outlive the process.
- Use
definePipelineCommandfor pipeline scripts; usedefineCommandonly when the script is not centered on a pipeline. Preview selection withcommand.plan()ortubeless plan; do not simulate planning with--plan.--stepand--targetare argv flags;mapOptionsand hooks readstepIdsandtargets. - Declare public goals with
targets: [step]on the pipeline, select their IDs for goal-oriented execution, and usestepIdsonly for an exact filter. UserequireOutputswhen the final domain result is not meaningful without specific step outputs. Read planselectionReasonsinstead of recreating target-closure logic in a CLI or application. - Use
tubeless/renderwhen plans or diagnostics cross a human or JSON presentation boundary; do not duplicate selection-reason or error formatting. Usetubeless/reporterfor optional TTY run reporters; do not import them fromtubeless. - Copy consumer file layout, export names, and IDs from the project manifest. Register project commands explicitly; do not infer executable modules from run history or the filesystem. Cancel only a live launch owned by the current studio process; it is not crash-resume and does not abort sibling launches.
For semantics behind these choices, read core concepts. For workbench commands, read the CLI. For the local run UI, read the studio.