Absorb craftcms/cloud into craftcms/cloud-ops for cloud 3.x#130
Absorb craftcms/cloud into craftcms/cloud-ops for cloud 3.x#130
Conversation
Eliminated the ops namespace by moving all files from src/cloud/ up to src/. Updated all namespace declarations from craft\cloud\ops\* to craft\cloud\*. Updated all cross-references (use statements, FQCNs), static route strings from cloud-ops/ to cloud/, and configuration files (composer.json, bootstrap, preload.php, bref cmd files, webpack.config.js).
There was a problem hiding this comment.
Pull request overview
This PR restructures the Craft Cloud monorepo to consolidate functionality from craftcms/cloud into craftcms/cloud-ops. The main goal is to allow cloud-ops (which is auto-upgraded on deployment) to contain all meaningful code, while craftcms/cloud becomes a minimal plugin shell that users interact with in their composer.json.
Changes:
- Moved all functional code from craftcms/cloud to craftcms/cloud-ops while changing namespaces from
craft\cloud\ops\*tocraft\cloud\* - Updated craftcms/cloud to be a minimal Plugin.php that extends BasePlugin from cloud-ops
- Migrated 7 dependencies from cloud's composer.json to cloud-ops's composer.json
- Added controller namespace override in Module.php using Plugins::EVENT_AFTER_LOAD_PLUGINS
- Moved webpack build configuration and JavaScript assets to cloud-ops
- Updated all command references from
cloud-ops/*tocloud/*
Reviewed changes
Copilot reviewed 36 out of 75 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/cloud-ops/composer.json | Added 7 dependencies from cloud, updated PSR-4 autoload (missing craft\cloud\ops mapping), changed bootstrap class |
| composer.lock | Reflects dependency and autoload changes, has inconsistency with bootstrap class |
| packages/cloud/composer.json | Removed 7 dependencies now in cloud-ops |
| packages/cloud/src/Plugin.php | Simplified to minimal shell extending BasePlugin |
| packages/cloud-ops/src/Module.php | Added controller namespace override logic for cloud plugin |
| packages/cloud-ops/src/* | Multiple files moved/added with namespace changed to craft\cloud |
| packages/cloud-ops/src/runtime/event/* | Namespace changed from craft\cloud\ops\runtime\event to craft\cloud\runtime\event |
| packages/cloud-ops/src/queue/* | Namespace changed from craft\cloud\ops\queue to craft\cloud\queue |
| packages/cloud-ops/src/cli/controllers/* | Namespace changed from craft\cloud\ops\cli\controllers to craft\cloud\cli\controllers |
| packages/cloud-ops/src/bref/* | Namespace changes and command reference updates |
| webpack.config.js | Moved to root, points to cloud-ops assets |
| packages/cloud-ops/src/web/assets/uploader/* | Uploader asset moved from cloud to cloud-ops |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| $app->getPlugins()->on(Plugins::EVENT_AFTER_LOAD_PLUGINS, function() use ($app) { | ||
| $cloudModule = $app->getModule('cloud'); | ||
|
|
||
| $this->controllerNamespace = $app->getRequest()->getIsConsoleRequest() | ||
| ? 'craft\\cloud\\ops\\cli\\controllers' | ||
| : null; | ||
| if ($cloudModule === null) { | ||
| Craft::debug('Cloud module was not found; skipping cloud controller namespace override.', __METHOD__); | ||
| return; | ||
| } | ||
|
|
||
| $app->setModule($this->id, $this); | ||
| $isConsole = $app->getRequest()->getIsConsoleRequest(); | ||
| $cloudModule->controllerNamespace = $isConsole | ||
| ? 'craft\\cloud\\cli\\controllers' | ||
| : 'craft\\cloud\\controllers'; | ||
| }); |
There was a problem hiding this comment.
There's a potential issue with the module ID. The Module class doesn't set an ID explicitly, and relies on $app->getModule('cloud') to find the cloud plugin. However, if the cloud plugin's handle is not 'cloud', this will fail silently. Consider either setting an explicit module ID or verifying that the plugin handle matches the expected 'cloud' value.
Summary
Restructures the monorepo so that
craftcms/cloud-opsabsorbs all meaningful code fromcraftcms/cloud, reducing the plugin to a minimal shell for version/schema tracking. This allows cloud-ops (auto-upgraded on deployment) to house the real functionality, while users only interact withcraftcms/cloudin theircomposer.json.Changes
craft\cloud\→src/so all moved classes keep their original namespace with zero code changescraftcms/cloudis now onlyPlugin.php— handles wiring, version tracking, and schema versionModule.phpusesPlugins::EVENT_AFTER_LOAD_PLUGINSto overridecontrollerNamespaceon the cloud module, working across cloud 1.x, 2.x, and 3.xcomposer.jsonpicks up 7 dependencies previously only in cloud; cloud's dependencies reduced to justphp,craftcms/cms, andcraftcms/cloud-ops