From e0507b02c7853c96a5380a1a270e4e470737d921 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 23 Aug 2026 05:48:03 +0000 Subject: [PATCH] Stop clearing the user's terminal; document in-repo runs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove clearConsole(). The card wrote an erase-screen sequence (ESC[2J ESC[0f) as its very first output on every TTY run, wiping whatever the user had on screen before drawing itself. That was always the wrong default for a one-shot command: the card is reference material — links, email, QR — and erasing the scrollback around it makes it harder to use, not more impressive. On block-based terminals it is worse than rude, because clearing can take the command's own output block with it. Nothing depended on the clear: the banner animation redraws in place with cursor-up sequences, not from a blank screen, and it renders identically without it (verified in a PTY — exactly one banner, no stacking). Also document a footgun that has nothing to do with the published package: running `npx brignano` inside this repo resolves to this package's own bin (dist/card.js) rather than the registry copy, and dist/ is gitignored, so on a fresh clone it exits silently with status 2 until you build. The readme now points at `npm run dev` for in-repo runs and explains how to exercise the published package instead. Verified: lint, build and test clean from a fresh node_modules; packed the tarball and installed it into a scratch project — 10.0 kB / 13 files, reports 2.0.1, and the first bytes written to a TTY are the banner rather than an erase sequence. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_012tJtqS7KELPAg3YaARcAGW --- package-lock.json | 4 ++-- package.json | 2 +- readme.md | 6 ++++++ src/card.ts | 3 --- src/env.ts | 14 -------------- 5 files changed, 9 insertions(+), 20 deletions(-) diff --git a/package-lock.json b/package-lock.json index 00af267..968aa80 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "brignano", - "version": "2.0.0", + "version": "2.0.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "brignano", - "version": "2.0.0", + "version": "2.0.1", "license": "ISC", "dependencies": { "@inquirer/prompts": "^8.6.0", diff --git a/package.json b/package.json index 2ae85c7..50236c0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "brignano", - "version": "2.0.0", + "version": "2.0.1", "type": "module", "engines": { "node": ">=20" diff --git a/readme.md b/readme.md index 9ebc6fd..56aa9cd 100644 --- a/readme.md +++ b/readme.md @@ -75,6 +75,12 @@ npm run build node dist/card.js ``` +> **Running it inside this repo:** `npx brignano` resolves to *this* package's +> `bin` (`dist/`), not the published one — and `dist/` is gitignored. On a fresh +> clone it will exit silently until you build. Use `npm run dev` (runs the +> TypeScript directly, no build step), or `npm run build` first. To exercise the +> published package instead, run `npx brignano` from any other directory. + Source lives in `src/` (split into small modules — `card.ts` is the entry/`bin` target) and compiles to `dist/` via `tsc`. `npm run dev` runs the TypeScript directly through `tsx`; `npm run lint` and `npm run format` use diff --git a/src/card.ts b/src/card.ts index 356b123..534751f 100644 --- a/src/card.ts +++ b/src/card.ts @@ -5,7 +5,6 @@ import { animateBanner, renderBanner } from './banner.js'; import { renderCard } from './cardBox.js'; import { funFacts, pick, profile, taglines } from './data.js'; import { - clearConsole, isInteractive, parseFlags, readVersion, @@ -74,8 +73,6 @@ async function main(): Promise { // overlaps the banner render. Skipped entirely when non-interactive/CI. const livePromise = shouldFetchLive(flags) ? fetchLive() : Promise.resolve(null); - clearConsole(); - // Banner first: an animated violet shimmer when we can animate, otherwise the // static gradient. if (animate) { diff --git a/src/env.ts b/src/env.ts index 0a091a7..d5f5fc5 100644 --- a/src/env.ts +++ b/src/env.ts @@ -95,17 +95,3 @@ export function shouldAnimate(flags: Flags): boolean { export function shouldFetchLive(flags: Flags): boolean { return isInteractive(flags); } - -export function clearConsole(): void { - const out = process.stdout as NodeJS.WriteStream & { clear?: () => void }; - if (typeof out.clear === 'function') { - try { - out.clear(); - } catch { - /* ignore */ - } - } - if (process.stdout.isTTY) { - process.stdout.write('\u001b[2J\u001b[0f'); - } -}