Skip to content

Conversation

@kfirstri
Copy link
Contributor

@kfirstri kfirstri commented Jan 27, 2026

Description

This PR improves the CLI's behavior in non-interactive environments by automatically detecting TTY contexts and disabling animations, while also refactoring user cancellation handling to use proper error flow instead of direct process exits. This prevents rendering issues in CI/CD pipelines and piped output scenarios, while making the codebase more maintainable and testable.

Related Issue

Fixes #138

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Other (please describe):

Changes Made

  • Added TTY detection in bin/run.js and bin/dev.js to identify non-interactive environments
  • Automatically set CI=true when stdin or stdout is not a TTY to disable @clack/prompts animations
  • Refactored cancellation handling to use CLIExitError instead of process.exit(0) in:
    • src/cli/commands/project/link.ts:66 - prompt cancellation handlers
    • src/cli/commands/project/link.ts:116 - project selection cancellation
    • src/cli/utils/prompts.ts:10 - onPromptCancel utility function
  • Updated src/cli/utils/runCommand.ts:96 to pass through CLIExitError without logging (for intentional exits)

Testing

  • I have tested these changes locally
  • I have added/updated tests as needed
  • All tests pass (npm test)

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (if applicable)
  • My changes generate no new warnings
  • I have updated AGENTS.md if I made architectural changes

Additional Notes

The TTY detection uses Node.js's built-in process.stdin.isTTY and process.stdout.isTTY properties. Setting CI=true is a standard convention that @clack/prompts respects to disable animations.

The cancellation refactoring improves code quality by using proper error flow (CLIExitError) instead of direct process.exit() calls, making the code more testable and maintainable. The runCommand utility now silently passes through CLIExitError instances since these represent intentional, graceful exits (e.g., user cancellations).


🤖 Generated by Claude | 2026-01-27 22:50 UTC

Add automatic detection of non-interactive environments (piped output,
automated scripts, non-TTY contexts) and set CI=true to disable
@clack/prompts animations. This prevents issues when running the CLI
in automated scripts or with piped output.

Fixes #138

Co-authored-by: Kfir Stri <[email protected]>
@github-actions
Copy link
Contributor

github-actions bot commented Jan 27, 2026

🚀 Package Preview Available!


Install this PR's preview build with npm:

npm i @base44-preview/[email protected]

Prefer not to change any import paths? Install using npm alias so your code still imports base44:

npm i "base44@npm:@base44-preview/[email protected]"

Or add it to your package.json dependencies:

{
  "dependencies": {
    "base44": "npm:@base44-preview/[email protected]"
  }
}

Preview published to npm registry — try new features instantly!

@claude
Copy link

claude bot commented Jan 27, 2026

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

@kfirstri kfirstri merged commit 26b34d7 into main Jan 27, 2026
6 checks passed
@kfirstri kfirstri deleted the claude/issue-138-20260127-1626 branch January 27, 2026 22:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Handle non-interactive/non-TTY environments - remove animations

2 participants