Repository and package scripts are written in TypeScript with Effect and effect/cli, executed directly by the pinned Node runtime (#!/usr/bin/env node). Do not route around Effect with plain Node glue scripts.
-
CLI parsing with
effect/cli. Define commands, flags, and positional args withCommand.make,Flag, andArgument(validating values withFlag.withSchema). Do not hand-rollprocess.argvparsers or add third-party CLI parsers. -
Platform services over raw Node built-ins. Use Effect platform services—
FileSystem.FileSystem,Path.Path,ChildProcess/ChildProcessSpawner,Config,Console, andHttpClient—provided via@effect/platform-node/NodeServices. Do not importnode:fs,node:child_process, or readprocess.envdirectly, and do not suppressnodeBuiltinImportunless an external API genuinely requires it (with an explicit-- <reason>comment). -
Scoped resources and typed errors. Follow Effect services: subpath namespace imports (
import * as Effect from "effect/Effect"),Schema.TaggedErrorfor failures,Effect.fn("...")for reusable steps, andEffect.scoped(such asfs.makeTempDirectoryScoped) so temporary directories and child processes always clean up. -
Importable and testable entrypoints. Export the core Effect functions and guard CLI execution behind
if (import.meta.main):if (import.meta.main) { Command.run(command, { version: "0.0.0" }).pipe( Effect.provide(NodeServices.layer), NodeRuntime.runMain, ); }
-
References:
scripts/build-npm-launcher.tsandscripts/resolve-nightly-release.ts.
Thin bootstrap shims that run before dependencies exist (such as scripts/install.sh / scripts/install.ps1 and the zero-dependency scripts/npm-launcher/t3.mjs) and e2e test files under scripts/scenarios/ (which run under the e2e runner) do not use effect/cli.