Skip to content

[Proposal] Use annotation-based daemon skip for cobra commands#413

Draft
inFocus7 wants to merge 2 commits intoagentregistry-dev:mainfrom
inFocus7:infocus7/daemon-skip-annotation
Draft

[Proposal] Use annotation-based daemon skip for cobra commands#413
inFocus7 wants to merge 2 commits intoagentregistry-dev:mainfrom
inFocus7:infocus7/daemon-skip-annotation

Conversation

@inFocus7
Copy link
Copy Markdown
Collaborator

@inFocus7 inFocus7 commented Apr 1, 2026

This is a proposal, can be removed if not as helpful as I think it is 👍🏼

Description

  • Remove daemon skip map
  • Use special annotation to skip daemon on commands

Currently we define the set of skipped commands in an un-exported field. If anyone extends this library they won't be able to easily set up commands that don't require a daemon running. We can create extension points (exported functionality or cli option one can plug in commands), but this would be another extension point which adds complexity to the codebase.

Proposal is to move from the map-based skips to an annotation-based one. Commands would be able to define if they don't need the daemon directly in its definition through the annotation field.

Annotations are key/value pairs that can be used by applications to identify or group commands or set special options.

Change Type

/kind cleanup

Changelog

NONE

Additional Notes

An edge case would be if commands define their own PersistentPreRun, then the one we use now is overriden and so setting skipDaemon: true on those commands won't have any effect. This is a pre-existing edge case, but worth noting.

The root completion command is from cobra, so it is the exception where we can't directly define the annotation for.

Signed-off-by: Fabian Gonzalez <fabian.gonzalez@solo.io>
Signed-off-by: Fabian Gonzalez <fabian.gonzalez@solo.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant