Skip to content

Absorb craftcms/cloud into craftcms/cloud-ops for cloud 3.x#130

Merged
timkelty merged 12 commits intomainfrom
feature/cloud-3-opsify
Feb 26, 2026
Merged

Absorb craftcms/cloud into craftcms/cloud-ops for cloud 3.x#130
timkelty merged 12 commits intomainfrom
feature/cloud-3-opsify

Conversation

@timkelty
Copy link
Contributor

@timkelty timkelty commented Feb 25, 2026

Summary

Restructures the monorepo so that craftcms/cloud-ops absorbs all meaningful code from craftcms/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 with craftcms/cloud in their composer.json.

Changes

  • Dual PSR-4 autoload: cloud-ops now maps craft\cloud\src/ so all moved classes keep their original namespace with zero code changes
  • **craftcms/cloud is now only Plugin.php — handles wiring, version tracking, and schema version
  • Controller namespace override: Module.php uses Plugins::EVENT_AFTER_LOAD_PLUGINS to override controllerNamespace on the cloud module, working across cloud 1.x, 2.x, and 3.x
  • Dependencies absorbed: cloud-ops's composer.json picks up 7 dependencies previously only in cloud; cloud's dependencies reduced to just php, craftcms/cms, and craftcms/cloud-ops

@linear
Copy link

linear bot commented Feb 25, 2026

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).
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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\* to craft\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/* to cloud/*

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.

Comment on lines +24 to +36
$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';
});
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
@timkelty timkelty merged commit 206ed62 into main Feb 26, 2026
11 checks passed
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