Skip to content
Myr

box.ts

This file

Path

apps/sandbox/src/box.ts

35 lines · 979 bytes · TypeScript

Last changed by

Merge build/comments-ops into mainoscabrielbefore adoptione4c407e

History of this file

Take it

The walk stopped after 200 commits: lines older than 678c8b8 point at it.

Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8

lines 1–35why, one step back
1import { Context, Schema } from "effect";
2import type { Array, Effect } from "effect";34export class BoxFailed extends Schema.TaggedError<BoxFailed>()("BoxFailed", {5 operation: Schema.Literals(["exec", "writeFile"]),6 reason: Schema.String,7}) {}89export interface ExecOptions {10 readonly cwd?: string;11 readonly env?: Readonly<Record<string, string>>;12 readonly timeoutMs?: number;13}1415export interface Executed {16 readonly exitCode: number;17 readonly stdout: string;18 readonly stderr: string;19}2021export class Box extends Context.Service<22 Box,23 {24 /** Runs `argv` and waits for it; a command that exits non-zero is still a success. */25 readonly exec: (26 argv: Array.NonEmptyReadonlyArray<string>,27 options?: ExecOptions28 ) => Effect.Effect<Executed, BoxFailed>;29 readonly writeFile: (30 path: string,31 bytes: Uint8Array32 ) => Effect.Effect<void, BoxFailed>;33 readonly destroy: () => Effect.Effect<void>;34 }35>()("sandbox/Box") {}