Skip to content

PR-1282: Fix duplicate 'Other' section in clarifai CLI --help output#974

Open
ackizilkale wants to merge 1 commit intomasterfrom
PR-1282/fix-duplicate-other-section-cli-help
Open

PR-1282: Fix duplicate 'Other' section in clarifai CLI --help output#974
ackizilkale wants to merge 1 commit intomasterfrom
PR-1282/fix-duplicate-other-section-cli-help

Conversation

@ackizilkale
Copy link
Contributor

@ackizilkale ackizilkale commented Mar 5, 2026

Summary

  • clarifai --help was showing two "Other:" sections with duplicate/aliased commands
  • LazyAliasedGroup.list_commands() returned all lazy_mapping keys (including short aliases like a, af, cc, pl) as separate commands
  • command_sections was missing logout, app, and had wrong key pipeline-step instead of pipelinestep

Changes

  • clarifai/utils/cli.py: Added _lazy_primary_names set so list_commands() only returns canonical names (not aliases). Fixed format_commands() to not show redundant alias labels.
  • clarifai/cli/base.py: Fixed command_sections — added logout to Auth, app to Other, fixed pipeline-steppipelinestep in Pipelines.

Before

Other:
  artifact (af)     Manage artifacts and files.
  run               Run a script with context env vars.
  shell-completion  Generate shell completion script.

Other:
  a (a)                           Manage Apps: create, delete, list
  af (af)                         Manage artifacts and files.
  cc (cc)                         Manage compute clusters.
  ...

After

Auth:
  login   Authenticate and save credentials.
  whoami  Show current user and context.
  logout  Log out by clearing saved credentials.
...
Other:
  app (a)           Manage Apps: create, delete, list
  artifact (af)     Manage artifacts and files.
  run               Run a script with context env vars.
  shell-completion  Generate shell completion script.

Test plan

  • clarifai --help shows single clean output with no duplicate sections
  • Short aliases still work (clarifai pl, clarifai ps, clarifai a)

Jira: PR-1282

🤖 Generated with Claude Code

LazyAliasedGroup.list_commands() was returning all lazy_mapping keys
including short aliases (a, af, cc, pl, etc.) as separate commands,
causing them to appear in a second "Other:" catch-all section.

- Add _lazy_primary_names set to only expose canonical command names in --help
- Fix command_sections: add missing commands (logout, app), fix pipeline-step -> pipelinestep
- Deduplicate alias display in format_commands() to avoid redundant alias labels

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ackizilkale ackizilkale requested a review from a team March 5, 2026 14:38
@github-actions
Copy link

github-actions bot commented Mar 5, 2026

Code Coverage

Package Line Rate Health
clarifai 45%
clarifai.cli 62%
clarifai.cli.templates 67%
clarifai.cli.templates.toolkits 100%
clarifai.client 65%
clarifai.client.auth 67%
clarifai.constants 100%
clarifai.datasets 100%
clarifai.datasets.export 69%
clarifai.datasets.upload 75%
clarifai.datasets.upload.loaders 37%
clarifai.models 100%
clarifai.rag 0%
clarifai.runners 52%
clarifai.runners.models 60%
clarifai.runners.pipeline_steps 39%
clarifai.runners.pipelines 72%
clarifai.runners.utils 62%
clarifai.runners.utils.data_types 72%
clarifai.schema 100%
clarifai.urls 58%
clarifai.utils 65%
clarifai.utils.evaluation 16%
clarifai.workflows 95%
Summary 60% (11191 / 18501)

Minimum allowed line rate is 50%

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant