goharbor / goharbor/harbor-cli

[feature]: Add interactive command navigation mode for nested Harbor CLI commands

Open
#1,055 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Go
Stars
163
Forks
211
Avg merge
1m
Merged PRs (30d)
1

Description

## Problem
Harbor CLI has a large and deeply nested command tree, which makes command discovery hard for new and infrequent users.

Today, users often need to repeatedly run help commands like `harbor help`, `harbor artifact help`, or `harbor artifact tags help` just to find the correct command path. While some leaf commands already support interactive input for selecting resources such as projects or repositories, the CLI does not provide an interactive way to navigate the command and subcommand hierarchy itself.

This creates a few pain points:
- users must already know the correct command group before interactive prompts become useful
- discovering the right command path takes multiple help/look-up steps
- the experience becomes harder as more commands and nested subcommands are added
- the CLI is powerful, but not very guided for exploration

## Proposed Solution
Add an interactive command navigation mode, for example:

```text
harbor interactive
```

This mode should let users:
- browse top-level Harbor commands
- drill down into subcommands step by step
- continue until they reach a leaf command
- see the selected command path and command description
- eventually collect missing arguments interactively and execute the command safely

The command tree should be derived dynamically from the existing Cobra command hierarchy rather than manually defining a separate interactive tree. That way, when a new command or subcommand is added to Harbor CLI and registered normally, it automatically appears in interactive mode.

A phased approach would work well:
- v1: browse all visible commands/subcommands dynamically and show the selected leaf command path
- v2: collect common arguments interactively for leaf commands
- v3: execute commands interactively, with confirmations for mutating or destructive actions

## Additional Context
Harbor CLI already has interactive prompt helpers for selecting resources like projects, repositories, tags, robot IDs, and similar entities. This feature would extend that interactive experience upward to the command-discovery layer.

The interactive mode should remain a thin layer on top of the existing Cobra command tree, not a separate command system. Cobra should stay the single source of truth for:
- command hierarchy
- command names
- descriptions
- flags and behavior

Example desired flow:

```text
harbor interactive
-> artifact
-> tags
-> create
```

This would make Harbor CLI easier to explore without reducing the power of the existing command-based workflow.

Contributor guide

Open the contributing guide

Research direction

Start by tracing Harbor CLI's existing Cobra command hierarchy and registration, then review the interactive prompt helpers mentioned in the issue. Define the first phase around dynamically browsing visible commands and subcommands, showing the selected path and description. Done for v1 means new commands registered in Cobra appear without a separate manually maintained tree.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.