Skip to content

fix: hide registry flags from mcp init help output#267

Merged
peterj merged 3 commits intoagentregistry-dev:mainfrom
optimus-fulcria:fix/mcp-init-remove-registry-flags
Mar 6, 2026
Merged

fix: hide registry flags from mcp init help output#267
peterj merged 3 commits intoagentregistry-dev:mainfrom
optimus-fulcria:fix/mcp-init-remove-registry-flags

Conversation

@optimus-fulcria
Copy link
Copy Markdown
Contributor

@optimus-fulcria optimus-fulcria commented Mar 5, 2026

Description

Hide registry-specific flags (--registry-url, --project-dir) from the mcp init help output since they are not relevant to MCP initialization.

What changed:

  • Updated hideRegistryFlags to accept variadic commands
  • Applied to mcp init command to hide confusing flags from help text

Fixes #260

Change Type

/kind fix

Changelog

Hide registry flags from mcp init help output

Additional Notes

The flags still function if explicitly passed — they are only hidden from --help output.

The --registry-url and --registry-token flags inherited from the root
command are not relevant for `arctl mcp init` since it operates purely
offline. This hides them from the --help output using a custom help
function wrapper.

Closes agentregistry-dev#115

Co-Authored-By: Claude Opus 4.6 <[email protected]>
// hideRegistryFlags marks the inherited registry-url and registry-token flags
// as hidden so they do not appear in the --help output of commands that do not
// interact with the registry.
func hideRegistryFlags(cmd *cobra.Command) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can this be modified so we can potentially pass in multiple commands at the same time?

Per review feedback, accept multiple commands at once via variadic
parameter so callers can pass several commands in a single call.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@optimus-fulcria
Copy link
Copy Markdown
Contributor Author

Updated hideRegistryFlags to accept variadic ...*cobra.Command so multiple commands can be passed in a single call. Existing single-arg usage stays the same.

The function already accepts variadic commands; now pass all
three offline commands (InitCmd, BuildCmd, AddToolCmd) in one call.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@optimus-fulcria
Copy link
Copy Markdown
Contributor Author

Updated — the function already accepted variadic commands, now passing all three offline commands (InitCmd, BuildCmd, AddToolCmd) in a single call.

@optimus-fulcria
Copy link
Copy Markdown
Contributor Author

Already done! The function signature uses variadic args: func hideRegistryFlags(cmds ...*cobra.Command), and the call site passes multiple commands: hideRegistryFlags(InitCmd, BuildCmd, AddToolCmd). Any new offline commands can be added to that list.

@peterj peterj added this pull request to the merge queue Mar 6, 2026
Merged via the queue into agentregistry-dev:main with commit 22b2a60 Mar 6, 2026
6 checks passed
christian-posta pushed a commit to christian-posta/agentregistry that referenced this pull request Mar 9, 2026
…#267)

# Description

Hide registry-specific flags (`--registry-url`, `--project-dir`) from
the `mcp init` help output since they are not relevant to MCP
initialization.

**What changed:**
- Updated `hideRegistryFlags` to accept variadic commands
- Applied to `mcp init` command to hide confusing flags from help text

Fixes agentregistry-dev#260

# Change Type

/kind fix

# Changelog

```release-note
Hide registry flags from mcp init help output
```

# Additional Notes

The flags still function if explicitly passed — they are only hidden
from `--help` output.

---------

Co-authored-by: Claude Opus 4.6 <[email protected]>
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.

test issue automation for project

2 participants