Skip to content

refactor logger to simple logger#425

Open
kfirstri wants to merge 9 commits intomainfrom
refactor-logger
Open

refactor logger to simple logger#425
kfirstri wants to merge 9 commits intomainfrom
refactor-logger

Conversation

@kfirstri
Copy link
Collaborator

@kfirstri kfirstri commented Mar 17, 2026

Note

Description

This PR extracts the logger abstraction into a dedicated @base44-cli/logger monorepo package and wires it through CLIContext so every command receives the correct logger implementation automatically. In interactive (TTY) mode a ClackLogger delegates to @clack/prompts; in non-interactive/CI mode a SimpleLogger writes plain text to stderr. Commands no longer import log from @clack/prompts directly — they destructure log (or logger) from the injected CLIContext.

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

  • Added new packages/logger workspace package (@base44-cli/logger) with a Logger interface, ClackLogger (interactive), and SimpleLogger (CI/piped output to stderr)
  • Added log: Logger field to CLIContext and instantiated the right implementation in cli/index.ts based on isNonInteractive
  • Updated Base44Command to inject CLIContext as the first argument to all action functions, replacing the old approach of accessing context via command.isNonInteractive
  • Removed the isNonInteractive getter from Base44Command (context is now passed directly)
  • Updated ensureAuth and ensureAppConfig middleware to accept CLIContext instead of a bare ErrorReporter
  • Migrated all command files to destructure log from CLIContext instead of importing log from @clack/prompts
  • Updated docs/commands.md to document the new CLIContext-injection pattern and Logger usage
  • Extracted shared tsconfig.base.json to the repo root; updated packages/logger/tsconfig.json to extend it

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 Logger interface maps 1:1 to @clack/prompts log methods, so future callers are familiar with the API. SimpleLogger writes to stderr to keep stdout clean for machine-readable output in CI pipelines.


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

@github-actions
Copy link
Contributor

github-actions bot commented Mar 17, 2026

🚀 Package Preview Available!


Install this PR's preview build with npm:

npm i @base44-preview/cli@0.0.47-pr.425.8bf8063

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.47-pr.425.8bf8063"

Or add it to your package.json dependencies:

{
  "dependencies": {
    "base44": "npm:@base44-preview/cli@0.0.47-pr.425.8bf8063"
  }
}

Preview published to npm registry — try new features instantly!

@kfirstri kfirstri moved this from Backlog to In progress in CLI Development Mar 18, 2026
@kfirstri kfirstri requested a review from artemdemo March 19, 2026 13:52
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe logger should be a separate package?
wdyt?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Love this idea, what do you think about the name @base44-cli/logger? maybe just @base44/logger?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

2 participants