Problem Statement
The cubemastercli template commands are the primary interface for users to create, monitor, and manage CubeSandbox templates. While the server-side logic is mature and feature-complete, the CLI's user-facing experience for template creation is still in a very primitive state. This creates a steep learning curve for new users and a frustrating experience for operators managing long-running template builds.
The core issue is that backend API responses are directly piped to the terminal without any user-experience layer. There is no visualization of progress, no interactive guidance, no friendly error handling, and no structured summary upon completion.
Current Behavior
1. No Interactive Wizard
template create-from-image exposes 20+ flags. New users must read documentation and memorize all parameters upfront. There is no --interactive or wizard mode.
$ cubemastercli template create-from-image
Error: image is required
2. Primitive Progress Display
Backend async jobs have a rich 6-phase pipeline (PULLING -> UNPACKING -> BUILDING_EXT4 -> DISTRIBUTING -> CREATING_TEMPLATE -> READY), but the CLI only prints a plain number:
job_id: job-abc-123
status: RUNNING
phase: DISTRIBUTING
progress: 70%
No progress bar, no stage indicator, no node-level distribution status.
3. Cluttered Watch Output
template watch polls every 2 seconds and prints the entire job object on every state change, flooding the terminal with repetitive text:
job_id: job-abc-123
status: RUNNING
phase: DISTRIBUTING
progress: 70%
distribution: 1/3 ready, 0 failed
job_id: job-abc-123
status: RUNNING
phase: CREATING_TEMPLATE
progress: 85%
distribution: 3/3 ready, 0 failed
4. No Intermediate Feedback for Sync Commands
template create is a synchronous HTTP call. During the potentially multi-second (or longer) server-side snapshot execution, the terminal is completely blank.
5. Unfriendly Error Messages
Parameter validation returns bare strings:
return errors.New("image is required")
Server-side errors are passed through unmodified:
return errors.New(rsp.Ret.RetMsg)
There is no error classification, no remediation hints, no links to documentation.
6. No Completion Summary
When a job succeeds, the output is still a flat key-value dump. There is no structured success panel showing build time, ready nodes, or suggested next commands.
7. No Color or Visual Hierarchy
The entire CLI uses raw fmt.Printf. Success/failure/warning states are indistinguishable. The myPrint utility prefixes errors with nanosecond timestamps, which is noise for end users:
2024-01-15T10:30:45.123456789Z,template create request err. connection refused. RequestId: abc-123
8. Confusing Parameter Syntax
CubeVS flags support both --flag=value and trailing positional boolean arguments, but the error message on misuse is unhelpful:
unexpected positional or trailing argument %q
Expected Behavior / Proposed Improvements
High Priority
-
Visual Progress Tracking
- Replace plain
progress: 70% with a real-time progress bar.
- Show the current phase as a step indicator (e.g.,
[3/6] Building ext4 rootfs...).
- In
watch mode, use ANSI cursor control to refresh a single terminal region instead of re-printing the full job object.
-
Friendly Error Handling
- Classify errors (validation, network, server, permission, resource).
- Print remediation suggestions and related CLI commands.
- Surface the
RequestID prominently for log correlation.
Medium Priority
-
Interactive Wizard Mode (--interactive)
- For
create-from-image, create, and commit commands.
- Step-by-step prompts with defaults, input validation, and a final confirmation preview.
- Gracefully degrade to non-interactive mode in CI pipelines.
-
Completion Summary Panel
- On success: highlight
template_id, build time, ready node count, and suggest next commands (sandbox create, template info, template render).
- On failure: show the failing phase, error message, and retry command.
-
Terminal Beautification
- Introduce a consistent color scheme (green for success, red for error, yellow for warning, blue for info).
- Remove or demote nanosecond timestamps from user-facing output (keep them in a
--debug or log mode).
- Use bold text and box-drawing characters for structured panels.
Low Priority / Future
- Real-time Push Instead of Polling
- Long-term: consider WebSocket or SSE from the server so
watch can receive true real-time updates instead of 2-second polling.
Relevant Code Locations
| File |
Relevant Lines |
Description |
CubeMaster/cmd/cubemastercli/commands/cubebox/template.go |
747-833 |
TemplateCreateFromImageCommand action and flag parsing |
CubeMaster/cmd/cubemastercli/commands/cubebox/template.go |
937-973 |
TemplateWatchCommand polling loop |
CubeMaster/cmd/cubemastercli/commands/cubebox/template.go |
327-451 |
TemplateCreateCommand synchronous request |
CubeMaster/cmd/cubemastercli/commands/cubebox/template.go |
1165-1208 |
printTemplateImageJob output formatting |
CubeMaster/cmd/cubemastercli/commands/cubebox/util.go |
153-156 |
myPrint utility function |
CubeMaster/cmd/cubemastercli/commands/client.go |
(nearby) |
AskForConfirm — the only existing interactive function (basic y/n) |
Environment
- CLI Framework:
github.com/urfave/cli v1.22.14
- Current UI Libraries: None (no color, no progress bar, no prompt library, no TUI framework)
- Affected Commands:
template create, template create-from-image, template commit, template redo, template watch, template build-watch
Additional Context
This issue is opened to gather community feedback before implementation begins. The work can be broken into independent phases (beautification -> progress visualization -> interactive wizard -> completion summaries), making it suitable for incremental contributions.
If you are interested in contributing, please comment below with the phase or sub-feature you'd like to work on, and we can coordinate.
Problem Statement
The
cubemastercli templatecommands are the primary interface for users to create, monitor, and manage CubeSandbox templates. While the server-side logic is mature and feature-complete, the CLI's user-facing experience for template creation is still in a very primitive state. This creates a steep learning curve for new users and a frustrating experience for operators managing long-running template builds.The core issue is that backend API responses are directly piped to the terminal without any user-experience layer. There is no visualization of progress, no interactive guidance, no friendly error handling, and no structured summary upon completion.
Current Behavior
1. No Interactive Wizard
template create-from-imageexposes 20+ flags. New users must read documentation and memorize all parameters upfront. There is no--interactiveor wizard mode.2. Primitive Progress Display
Backend async jobs have a rich 6-phase pipeline (
PULLING->UNPACKING->BUILDING_EXT4->DISTRIBUTING->CREATING_TEMPLATE->READY), but the CLI only prints a plain number:No progress bar, no stage indicator, no node-level distribution status.
3. Cluttered Watch Output
template watchpolls every 2 seconds and prints the entire job object on every state change, flooding the terminal with repetitive text:4. No Intermediate Feedback for Sync Commands
template createis a synchronous HTTP call. During the potentially multi-second (or longer) server-side snapshot execution, the terminal is completely blank.5. Unfriendly Error Messages
Parameter validation returns bare strings:
Server-side errors are passed through unmodified:
There is no error classification, no remediation hints, no links to documentation.
6. No Completion Summary
When a job succeeds, the output is still a flat key-value dump. There is no structured success panel showing build time, ready nodes, or suggested next commands.
7. No Color or Visual Hierarchy
The entire CLI uses raw
fmt.Printf. Success/failure/warning states are indistinguishable. ThemyPrintutility prefixes errors with nanosecond timestamps, which is noise for end users:8. Confusing Parameter Syntax
CubeVS flags support both
--flag=valueand trailing positional boolean arguments, but the error message on misuse is unhelpful:Expected Behavior / Proposed Improvements
High Priority
Visual Progress Tracking
progress: 70%with a real-time progress bar.[3/6] Building ext4 rootfs...).watchmode, use ANSI cursor control to refresh a single terminal region instead of re-printing the full job object.Friendly Error Handling
RequestIDprominently for log correlation.Medium Priority
Interactive Wizard Mode (
--interactive)create-from-image,create, andcommitcommands.Completion Summary Panel
template_id, build time, ready node count, and suggest next commands (sandbox create,template info,template render).Terminal Beautification
--debugor log mode).Low Priority / Future
watchcan receive true real-time updates instead of 2-second polling.Relevant Code Locations
CubeMaster/cmd/cubemastercli/commands/cubebox/template.goTemplateCreateFromImageCommandaction and flag parsingCubeMaster/cmd/cubemastercli/commands/cubebox/template.goTemplateWatchCommandpolling loopCubeMaster/cmd/cubemastercli/commands/cubebox/template.goTemplateCreateCommandsynchronous requestCubeMaster/cmd/cubemastercli/commands/cubebox/template.goprintTemplateImageJoboutput formattingCubeMaster/cmd/cubemastercli/commands/cubebox/util.gomyPrintutility functionCubeMaster/cmd/cubemastercli/commands/client.goAskForConfirm— the only existing interactive function (basic y/n)Environment
github.com/urfave/cli v1.22.14template create,template create-from-image,template commit,template redo,template watch,template build-watchAdditional Context
This issue is opened to gather community feedback before implementation begins. The work can be broken into independent phases (beautification -> progress visualization -> interactive wizard -> completion summaries), making it suitable for incremental contributions.
If you are interested in contributing, please comment below with the phase or sub-feature you'd like to work on, and we can coordinate.