first step migration to sdk #207
Draft
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.
Note
Description
Introduces an SDK facade pattern to establish a clean separation between CLI commands and core functionality. Commands now receive a
ProjectSDKinstance 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
Changes Made
src/core/sdk.tswithcreateProjectSDK()factory that exports organized namespaces (auth, project, entities, functions, agents, site, types)CLIContextinterface to includesdk: ProjectSDKalongsideerrorReporterrunCommand()to pass SDK instance to command functions:commandFn: (sdk: ProjectSDK) => Promise<RunCommandResult>@/coregetDashboardUrl()to require explicitprojectIdparameter instead of implicitly reading from cached configrunCLI()and injected into command contextCLITestkit) to create and inject SDK instance for command testsTesting
npm test)Checklist
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:
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