Skip to content

non interactive runTask function#441

Merged
kfirstri merged 4 commits intomainfrom
non-tty-run-task
Mar 29, 2026
Merged

non interactive runTask function#441
kfirstri merged 4 commits intomainfrom
non-tty-run-task

Conversation

@kfirstri
Copy link
Copy Markdown
Collaborator

@kfirstri kfirstri commented Mar 24, 2026

Note

Description

This PR refactors runTask from a standalone exported function into a dependency-injected factory pattern. Instead of importing runTask directly, commands now receive it via CLIContext, with two implementations: createInteractiveRunTask (uses clack spinner for TTY) and createSimpleRunTask (uses plain log output for non-interactive/CI environments). This ensures that spinner-based UI is never used in non-TTY contexts.

Related Issue

None

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

  • Replaced the exported runTask function with createInteractiveRunTask() and createSimpleRunTask(log) factory functions in runTask.ts
  • Added RunTaskFn type alias exported from runTask.ts
  • Added runTask: RunTaskFn field to CLIContext interface in types.ts
  • Instantiated the correct runTask implementation in index.ts based on isNonInteractive flag, and passed it into CLIContext
  • Removed runTask from the cli/utils/index.ts barrel export (no longer a free-standing import)
  • Updated all command files (~20 files) to destructure runTask from CLIContext instead of importing it directly

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 docs/ (AGENTS.md) if I made architectural changes

Additional Notes

The createSimpleRunTask implementation logs the start message via log.info, update messages via log.info, success via log.success, and errors via log.error — making non-interactive output readable in CI/piped environments without spinner control codes.


🤖 Generated by Claude | 2026-03-29 00:00 UTC

@kfirstri kfirstri requested a review from artemdemo March 24, 2026 14:53
@kfirstri kfirstri self-assigned this Mar 24, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 24, 2026

🚀 Package Preview Available!


Install this PR's preview build with npm:

npm i @base44-preview/cli@0.0.49-pr.441.dc5bedd

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

npm i "base44@npm:@base44-preview/cli@0.0.49-pr.441.dc5bedd"

Or add it to your package.json dependencies:

{
  "dependencies": {
    "base44": "npm:@base44-preview/cli@0.0.49-pr.441.dc5bedd"
  }
}

Preview published to npm registry — try new features instantly!

@kfirstri
Copy link
Copy Markdown
Collaborator Author

@artemdemo I wonder what do you think about this. moving the runTask to be injected from the CLIContext.

  • It's nice to have it support non interactive and such
  • I feel that maybe it's not the right place for runTask 🤔

}

/**
* Creates a RunTaskFn that delegates to the provided logger for non-interactive environments.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delegates what? :)
Description is a bit unclear

Copy link
Copy Markdown
Contributor

@artemdemo artemdemo Mar 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@artemdemo I wonder what do you think about this. moving the runTask to be injected from the CLIContext.
It's nice to have it support non interactive and such
I feel that maybe it's not the right place for runTask 🤔

non interractive runTask is a good idea.

but what do you mean about the place? Like you don't want to place it in the context?
You're actually don't have to.
You can just check interactivity in runTask itself and then use spinner or logger

@kfirstri kfirstri force-pushed the main branch 4 times, most recently from 5abb3da to b5ae3fe Compare March 25, 2026 15:26
@kfirstri kfirstri merged commit 4363989 into main Mar 29, 2026
12 checks passed
@kfirstri kfirstri deleted the non-tty-run-task branch March 29, 2026 16:33
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.

2 participants