Skip to content
joinery / docs
228 words · updated 6 hours agoinfrastructure/scripts/src/shared/README.md

🧰 shared

What more than one script needs. Nothing here knows a script exists.

What's here

FileWhat it is
cli.tsrun (argv parsed once, one meaning per exit code), fail and flag
errors.tsExpectedError and CancelledError, which run treats as answers, not bugs
adapters/io.tsThe terminal: out.*, and requireTerminal before any prompt
adapters/exec.tsSubprocesses: run, capture, inherit, and assertNotFlagLike
adapters/git.tsgit, repoRoot() and at()
adapters/gh.tsgh and createIssue
adapters/usage.tsappendUsage, the row run() records after every command
adapters/cache.tsThe file cache under node_modules/.cache/@joinery/scripts
adapters/prompts.tsorExit, so a cancelled prompt unwinds to run
domain/cli.tsThe argv parser, optionValue, detailOf
domain/usage.tsWhat a recorded run holds — see usage/
domain/layout.tsPROJECT_ROOTS
domain/logs.tsstripAnsi and excerpt

Code moves here when a second script needs it. Facts about the environment (the repo root, the terminal) live here from the start, so there's only one copy.

No side effects at module scope

No run(), git() or readFileSync at a file's top level, and read process.argv/process.env inside a command or through flag(). Breaking this once made two modules unimportable outside a git checkout.