Skip to content

Refactor DockerCLI for console 0.2 commands#66

Merged
TorstenDittmann merged 5 commits into
mainfrom
chore/console-0-2-structured-commands
May 25, 2026
Merged

Refactor DockerCLI for console 0.2 commands#66
TorstenDittmann merged 5 commits into
mainfrom
chore/console-0-2-structured-commands

Conversation

@TorstenDittmann
Copy link
Copy Markdown
Contributor

Summary

  • update utopia-php/console to 0.2.* and refresh the lockfile
  • migrate DockerCLI from shell-string execution to structured Utopia\Command usage
  • keep compatibility with legacy pre-quoted command arguments while removing manual shell escaping

Validation

  • ./vendor/bin/pint --test
  • ./vendor/bin/phpstan analyse --level 6 src tests
  • ./vendor/bin/phpunit --configuration phpunit.xml tests/Orchestration/Adapter/DockerCLITest.php (fails locally because the test setup expects /usr/src/code/tests/Orchestration/Resources, which is not present in this workspace; opening the PR to run CI in the intended environment)

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Apr 20, 2026

Greptile Summary

This PR migrates DockerCLI from manual shell-string concatenation to structured Utopia\Command objects, eliminating all manual shell escaping and quoting. It also upgrades utopia-php/console from 0.1.* to 0.2.* to unlock the Command API.

  • Every method in DockerCLI now builds a Command instance with typed argument(), option(), and flag() calls, removing brittle string interpolation and escapeshellarg usage.
  • The lossy str_replace("'", '', $label) stripping is removed, and label values (e.g. O'Brien) now round-trip correctly; a new regression test covers this.
  • The screen/stress test invocation is fixed to pass each word as a separate argv token, matching how structured execution actually works.

Confidence Score: 5/5

The change is safe to merge; all previously identified issues have been addressed and the migration is internally consistent.

All methods in DockerCLI were updated uniformly to the structured Command API with no shell escaping left behind. The three previously raised concerns are each resolved and covered by tests or confirmed removed. No new logic paths were introduced that could silently mishandle arguments.

No files require special attention.

Important Files Changed

Filename Overview
src/Orchestration/Adapter/DockerCLI.php Full migration from shell-string construction to structured Command objects; all shell escaping removed and arguments passed directly as process tokens. Previously flagged issues are fully resolved in this revision.
tests/Orchestration/Base.php Adds regression test for label values containing single quotes and fixes the screen/stress invocation to pass individual argv tokens.
composer.json Bumps utopia-php/console dependency from 0.1.* to 0.2.* to get the Command class.
composer.lock Lockfile updated to utopia-php/console 0.2.1, adding utopia-php/validators 0.2.0 as a new transitive dependency.
.gitignore Adds .DS_Store to ignored files; trivial housekeeping.

Reviews (4): Last reviewed commit: "Update .gitignore" | Re-trigger Greptile

Comment thread src/Orchestration/Adapter/DockerCLI.php Outdated
Comment thread src/Orchestration/Adapter/DockerCLI.php
@TorstenDittmann
Copy link
Copy Markdown
Contributor Author

@greptile-apps please review the latest commit on this PR.

Comment thread tests/Orchestration/Base.php Outdated
@TorstenDittmann
Copy link
Copy Markdown
Contributor Author

@greptile-apps please review the latest commit on this PR (49a86d9). The screen argv regression is fixed, label quote stripping is removed, and a regression test was added for labels containing single quotes.

@TorstenDittmann TorstenDittmann merged commit f453ea7 into main May 25, 2026
7 checks passed
@TorstenDittmann TorstenDittmann deleted the chore/console-0-2-structured-commands branch May 25, 2026 20:44
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