Skip to content

Remove global flags from embedded tools #5507

Open

Description

@AustinAbro321

Describe what should be investigated or refactored

The embedded commands like zarf tools monitor/kubectl/helm/syft/yq take global flags even though they have absolutely no impact. We should remove these flags from these commands entirely, instead of just hiding them as we do now. Additionally, each command tree should be constructed as an independent root command so flags between tools do not interact with each other.

This would fix issues like #5444 and #4338

Activity

  1. dwertent commented on Oct 27, 2026

    @dwertent
    Member

    I can work on this

  2. moved this from Triage to Ready in Zarfon Oct 27, 2026
  3. dwertent commented on Nov 5, 2026

    @dwertent
    Member

    Proposed solution

    Each embedded tool will have its own Cobra root, separating its command tree and flags from Zarf and the other tools. The existing zarf tools <tool> interface stays the same, but each embedded tool will accept only its own flags.

    The current shared command tree allows Zarf flags to reach embedded tools and lets tools inspect sibling commands.

    What this breaks:

    Invocations that currently pass unrelated Zarf flags to embedded tools will return an error, including when those flags appear before tools. Affected scripts must remove those flags or use the embedded tool’s native equivalent.

    For example:

    # Currently accepted without affecting yq:
    $ zarf --log-level debug tools yq -n '.answer = 42'
    answer: 42
    
    # Proposed behavior:
    $ zarf --log-level debug tools yq -n '.answer = 42'
    Error: unknown flag: --log-level
    
    # Supported invocation:
    $ zarf tools yq -n '.answer = 42'
    answer: 42
    

    This applies to embedded tools. Zarf-owned helpers under tools will retain their relevant Zarf flags. Existing tool names, aliases, and native flags remain supported.

  4. AustinAbro321 commented on Nov 16, 2026

    @AustinAbro321
    MemberAuthor

    This strategy sounds good to me

  5. soltysh commented on Nov 18, 2026

    @soltysh
    Contributor

    @dwertent feel free to ping me when you have the PR ready, slack is preferred 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

  • Status
    Ready

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions