fix piped CLI output truncation - #249
Merged
Merged
Conversation
nahiyankhan
marked this pull request as ready for review
August 4, 2026 16:42
chailandau
approved these changes
Aug 4, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Category: fix
User Impact: Ghost commands now return complete output when consumed through pipes or subprocess capture.
Problem: Commands wrote to stdout and immediately called
process.exit, allowing Node to terminate before asynchronous pipe buffers drained. Large pulls were silently cut off at the host pipe capacity, and JSON output could become invalid.Solution: Centralize command termination behind a flush-before-exit helper, migrate every command exit path to it, and cover the behavior with real multi-megabyte subprocess tests plus an exit-discipline guardrail.
Validation:
pnpm build: passedpnpm test: passed, 18 test files passed; 202 passed, 1 skipped (203 total)pnpm check: passedChangeset: added a patch changeset for
@design-intelligence/ghost.ghost Review:
ghost check --base main: not run because the current CLI has nocheckcommand and this change does not alter product-surface guidance.ghost review --base main --include-memory: not run because this lifecycle fix does not change guidance, checks, or review packet behavior.File changes
.changeset/early-falcons-smile.md: patch changeset for the public Ghost package.packages/ghost/src/commands/errors.ts: adds the shared flush-before-exit helper and routes fatal command exits through it.packages/ghost/src/commands/checks-command.ts: migrates checks command exit paths to the shared helper.packages/ghost/src/commands/export-command.ts: migrates export command exit paths to the shared helper.packages/ghost/src/commands/fingerprint-commands.ts: migrates fingerprint command exit paths to the shared helper.packages/ghost/src/commands/gather-command.ts: migrates gather command exit paths to the shared helper.packages/ghost/src/commands/init-command.ts: migrates init command exit paths to the shared helper.packages/ghost/src/commands/manifest-command.ts: migrates manifest command exit paths to the shared helper.packages/ghost/src/commands/pull-command.ts: migrates pull command exit paths to the shared helper.packages/ghost/src/commands/pulse-command.ts: migrates pulse command exit paths to the shared helper.packages/ghost/src/commands/review-command.ts: migrates review command exit paths to the shared helper.packages/ghost/src/commands/skill-command.ts: migrates skill command exit paths to the shared helper.packages/ghost/test/cli-exit.test.ts: adds subprocess coverage for multi-megabyte piped output and a guardrail that rejects directprocess.exitin command modules.Screenshots/Demos: N/A