Skip to content

Fix docker-agent version for cli plugin & standalone exec#1802

Merged
gtardif merged 1 commit intodocker:mainfrom
gtardif:fix_docker_agent_standalone_version
Feb 20, 2026
Merged

Fix docker-agent version for cli plugin & standalone exec#1802
gtardif merged 1 commit intodocker:mainfrom
gtardif:fix_docker_agent_standalone_version

Conversation

@gtardif
Copy link
Copy Markdown
Contributor

@gtardif gtardif commented Feb 20, 2026

Another quick one to cleanup version output when executing docker-agent cli plugin (standalone or plugin mode)

🐠 ./bin/docker-agent version
docker-agent version dev
Commit: 19ac4a68d80104161bf411c9ca69c16fe929c5fa
🐠 docker agent version
docker agent version dev
Commit: 19ac4a68d80104161bf411c9ca69c16fe929c5fa
🐠 ./bin/cagent version
cagent version dev
Commit: 19ac4a68d80104161bf411c9ca69c16fe929c5fa
@gtardif gtardif requested a review from a team as a code owner February 20, 2026 08:16
Copy link
Copy Markdown

@docker-agent docker-agent Bot left a comment

Choose a reason for hiding this comment

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

Review Summary

No issues found - The code changes look good!

This PR correctly fixes the version command output for different execution modes:

  • Standalone execution (./bin/docker-agent version): Shows "docker-agent version dev" ✓
  • Plugin mode (docker agent version): Shows "docker agent version dev" ✓
  • cagent mode (./bin/cagent version): Shows "cagent version dev" ✓

The logic properly handles the command name construction by:

  1. Using the parent command's name when available (which is set to "agent" in plugin mode, "docker-agent" in standalone)
  2. Only prepending "docker " when running in plugin mode (!plugin.RunningStandalone())
  3. This prevents duplicate prefixes and ensures correct output in all scenarios

The implementation is consistent with how the root command is configured in root.go (lines 102-115).

Signed-off-by: Guillaume Tardif <guillaume.tardif@gmail.com>
@gtardif gtardif force-pushed the fix_docker_agent_standalone_version branch from ddd0ba0 to edf2a4f Compare February 20, 2026 08:19
@gtardif gtardif merged commit a6c3acc into docker:main Feb 20, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants