Repository navigation
refactor(console)!: move Console and Command into Utopia\Console - #14261
Conversation
Step B of the monorepo shape (phase 6 of #13828): console was one of two packages left at the bare Utopia\ root, which a Utopia\<Ns>\ prefix cannot load. Console and Command now live in Utopia\Console and the package maps Utopia\Console\ => src/ like every other one. src/compat.php aliases the old names, registered up front and guarded as client's shim was, so vendored utopia-php/database and consumers on Packagist keep working until the next major drops it. console leaves BARE, and the root autoload maps Utopia\Console\ and loads the shim.
Every call site in Appwrite and the sibling packages moves to the new names in the same change, so nothing here relies on the compat aliases.
|
Review complete. 🟡 1 medium 📍 Findings outside the diff (1) — 🟡 1 medium — defects on lines GitHub can't attach comments to🟡 Medium — Sibling packages pin // packages/vcs/composer.json
34 "utopia-php/console": "^0.2",The console classes moved to 🧹 Nitpicks (1) — 🟢 1 low
This PR absorbs
The rename itself is clean and consistent — no stale old-namespace imports remain. Two packaging-level items worth attention: sibling package version constraints and a stale Reviewed commit: 1f54b4c |
🟢 Tier S · Ready to merge
Moved the console package classes into
📂 Walkthrough · 4
Reviewed |
console took step B in #14261, so validators is the second to land: the root autoload drops the bare Utopia\ prefix, BARE is empty, both compat shims load through files, and console's Command imports the new validator name and requires validators ^2.0.
Summary
Phase 6 of #13828 (step B in
rfc/monorepo.md) forconsole. Console was one of the two packages still declaring the bareUtopia\prefix, which a standardUtopia\<Ns>\prefix cannot load. Its two classes move into the package namespace:Utopia\ConsoleUtopia\Console\ConsoleUtopia\CommandUtopia\Console\CommandThe commits:
refactor(console)!: move Console and Command into Utopia\Consolepackages/consolemapsUtopia\Console\→src/.Commandnow importsUtopia\Validatorexplicitly, which it used to resolve from the sharedUtopianamespace.Shim:
src/compat.phpaliases both old names. It's loaded throughautoload.filesand mirrors the shimclientshipped for its 0.5 rename: the aliases are registered up front, because PHP never autoloads a name while checking a declared type, and each is guarded withclass_exists(..., false), because a process can load the file through both the root and the package autoloader.bin/monorepo:consoleleavesBARE.Root
composer.json:bin/monorepo autoloadaddsUtopia\Console\→packages/console/srcandautoload.files→packages/console/src/compat.php, and removespackages/console/srcfrom the bareUtopia\list.The PHPStan baseline's two entries are renamed to the new class names. There are no new findings.
New tests in
CompatTest:\Utopia\Console::log(),new \Utopia\Command(...));\Utopia\Commandaccepts a newUtopia\Console\Command.With
compat.phpemptied, all three fail (2 failures, 1 error).refactor: import Console and Command from Utopia\Console: every call site moves to the new names, so nothing in this repository depends on the aliases. 96 files (imports only), pluspackages/cli/README.md:src: 63tests: 13packages/vcs: 10app: 7packages/agents,packages/emails,packages/orchestration: 1 eachOutside the shim, its tests and RFC prose, nothing references the old names.
docs(rfc): record console's step BBare
Utopia\listAfter this, the root
Utopia\entry holds onlypackages/validators/src. Thevalidatorsstep B runs in a parallel PR. Whichever of the two merges second removes theUtopia\key from the root autoload entirely, and that PR should resolve the conflict that way.Release plan
Cut
console/0.3.0after merge. In 0.x the minor is the breaking slot (^0.2won't pick it up), the same asclient0.4 → 0.5. It's the first console release from this repository; the mirror's last one is 0.2.9.What consumers see:
packages/consoledirectly, and every call site uses the new names.utopia-php/database/migration: these stilluse Utopia\Consoleinsrc/(Database.php,PDO.php,PDOStatement.php).replacehands thempackages/console, and the shim keeps the old name working. I checked this by calling\Utopia\Console::warning()through the root autoloader after loadingUtopia\Database\Database. Both packages are being absorbed (Absorb database, mongo and migration into packages/ (wave 6) #14255), and their imports can move then.server-ce. Its own call sites keep working through the shim on the next bump and can move to the new names whenever convenient.console 0.1.1locked) and open-runtimes/executor (^0.1.1): unaffected until they move to^0.3. When they do, the old names keep working through the shim.Tests
bin/monorepo test console: 46 tests, 180 assertions.bin/monorepo check console: Rector, Pint and PHPStan (level max with the renamed baseline) pass.bin/monorepo check agents emails orchestration vcs: all pass.bin/monorepo test <dependent> --linked(siblings from this checkout, as CI runs dependents):unitsuite inappwrite/base:2.1.0: 1419 tests pass.packagessuite in Docker: 9435 tests. The 5 errors areagents'DiffCheckTest, which can't rungitinside the container from a git worktree checkout ("not a git repository"); the same file passes on the host (5 tests). The NATS warning is unrelated.pint --test,rector --dry-run,phpstan analyseandbin/monorepo validateall pass.Part of #13828.