feat(project): add dev status command#1062
Conversation
Add `shopware-cli project dev status` reporting whether the development environment is running. Prints a human-readable status and exits 0 when up, 1 when down, so it can be used in scripts and health checks. Adds EnvironmentStatus to the Executor interface; Docker reuses the `docker compose ps --status=running` check, while local and symfony-cli executors report it as unsupported.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e1f6deb363
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "Codex (@codex) review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "Codex (@codex) address that feedback".
| if cmd, _, findErr := rootCmd.Find(os.Args[1:]); findErr == nil && cmd != rootCmd && cmd.RunE != nil { | ||
| result := "success" | ||
| if err != nil { | ||
| if err != nil && !errors.Is(err, project.ErrEnvironmentDown) { |
There was a problem hiding this comment.
Record down status as non-success in telemetry
The new err != nil && !errors.Is(err, project.ErrEnvironmentDown) condition leaves result as success when project dev status detects a down environment, even though the same error is handled a few lines later by exiting with status code 1. This causes status-check failures to be tracked as successes, which will skew command result analytics and any experiment/reporting that relies on the result tag.
Useful? React with 👍 / 👎.
A down environment exits with code 1, so tracking it as a successful command result was inconsistent and skewed analytics. Let it fall through to the failure bucket; the clean exit-without-error-log behavior is still handled separately via the ErrEnvironmentDown exit check.
golangci-lint (gocritic exitAfterDefer) flagged os.Exit running while deferred cleanup was still pending. Extract the body into run() which returns an exit code, so its defers run before Execute calls os.Exit.
What
Adds
shopware-cli project dev status, a counterpart todev start/dev stopthat reports whether the development environment is running.✓ Development environment is up/✗ Development environment is down).How
EnvironmentStatus(ctx) (bool, error)to theExecutorinterface.docker compose ps --status=running -qcheck (same definition the dev TUI uses).ErrNotSupported, mirroring theirStart/StopEnvironment.ErrEnvironmentDowndrives the exit-1-without-error-noise behavior incmd/root.go; the command setsSilenceUsageso a status of "down" doesn't print usage.Test plan
go test ./...ErrNotSupportedfromEnvironmentStatus.