Skip to content
Myr

bin.ts

This file

Path

apps/cli/src/bin.ts

25 lines · 966 bytes · TypeScript

Last changed by

Merge build/comments-cli-protocol-checks into mainoscabrielbefore adoptionc86204f

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

line 1why, one step back
1#!/usr/bin/env node

Merge build/comments-cli-protocol-checks into mainoscabrielbefore adoptionc86204f

line 2why, one step back
2// One file plays two roles, chosen by the name it was started by: the CLI, and git's credential helper.

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 3–10why, one step back
3import { BunRuntime, BunServices } from "@effect/platform-bun";
4import { Brand } from "@repo/brand";5import { Effect, Layer, Path, Stdio } from "effect";67import { CliServices, program } from "./main.ts";89const live = CliServices.pipe(Layer.provideMerge(BunServices.layer));10

Merge build/comments-cli-protocol-checks into mainoscabrielbefore adoptionc86204f

line 11why, one step back
11/** The compiled binary keeps its link's name in `argv0`; Node or Bun through an npm bin link keep it in `argv[1]`. */

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 12–25why, one step back
12const startedAs = Effect.map(Path.Path, (path) =>
13 [process.argv0, process.argv[1]].map((name) => path.basename(name ?? ""))14);1516const main = Effect.gen(function* () {17 const names = yield* startedAs;18 const args = yield* Effect.flatMap(Stdio.Stdio, (stdio) => stdio.args);1920 return yield* program(21 names.includes(Brand.gitCredentialHelper) ? ["credential", ...args] : args22 );23});2425BunRuntime.runMain(main.pipe(Effect.provide(live)));