Skip to content

Conversation

@kfirstri
Copy link
Collaborator

@kfirstri kfirstri commented Feb 8, 2026

Note

Description

Introduces an SDK facade pattern to establish a clean separation between CLI commands and core functionality. Commands now receive a ProjectSDK instance via dependency injection instead of importing core modules directly, setting the foundation for better testability and future instance isolation.

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

  • Created src/core/sdk.ts with createProjectSDK() factory that exports organized namespaces (auth, project, entities, functions, agents, site, types)
  • Updated CLIContext interface to include sdk: ProjectSDK alongside errorReporter
  • Modified runCommand() to pass SDK instance to command functions: commandFn: (sdk: ProjectSDK) => Promise<RunCommandResult>
  • Refactored all CLI commands (auth, project, entities, functions, agents, site, types, dashboard) to receive SDK via parameter instead of importing from @/core
  • Updated getDashboardUrl() to require explicit projectId parameter instead of implicitly reading from cached config
  • Initialized SDK in runCLI() and injected into command context
  • Updated test infrastructure (CLITestkit) to create and inject SDK instance for command tests

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

This is the first step in migrating to an SDK-based architecture. The SDK currently wraps existing functions but maintains the same global state behavior. Future work can enhance the SDK factory to accept configuration (app config, auth tokens, custom API endpoints) for true instance isolation, enabling better testing and multi-project support.

Architecture Benefits:

  • Clear API boundary between CLI and core modules
  • Better dependency injection for testing
  • Preparation for stateful SDK instances
  • Organized namespace structure (sdk.auth., sdk.project., etc.)

Breaking Changes: None - this is an internal refactoring that doesn't affect the CLI interface or behavior.


🤖 Generated by Claude | 2026-02-08 23:00 UTC

@kfirstri kfirstri self-assigned this Feb 8, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Feb 8, 2026

🚀 Package Preview Available!


Install this PR's preview build with npm:

npm i @base44-preview/cli@0.0.28-pr.207.1a7af2c

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.28-pr.207.1a7af2c"

Or add it to your package.json dependencies:

{
  "dependencies": {
    "base44": "npm:@base44-preview/cli@0.0.28-pr.207.1a7af2c"
  }
}

Preview published to npm registry — try new features instantly!

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

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

1 participant