Skip to content

Enhance CLI by adding instance management#364

Merged
ArangoGutierrez merged 1 commit intoNVIDIA:mainfrom
ArangoGutierrez:cli_enh1
May 23, 2025
Merged

Enhance CLI by adding instance management#364
ArangoGutierrez merged 1 commit intoNVIDIA:mainfrom
ArangoGutierrez:cli_enh1

Conversation

@ArangoGutierrez
Copy link
Collaborator

This pull request introduces significant updates to the CLI for managing Holodeck instances. Key changes include the addition of new commands (list and status), enhancements to the create and delete commands, and improvements to the overall CLI user experience. The changes aim to streamline instance management and provide more detailed information about instances.

❯ ./bin/holodeck create -f tests/test_aws.yml
✔       Creating VPC
✔       Creating subnet
✔       Creating Internet Gateway
✔       Creating route table
✔       Creating security group
✔       Creating EC2 instance
Created instance 84e1dca0
❯ ./bin/holodeck list
INSTANCE ID   NAME                    PROVIDER   STATUS    CREATED               AGE
84e1dca0      holodeck-aws-e2e-test   aws        running   2025-05-21 19:01:30   1m48s
❯ ./bin/holodeck status 84e1dca0
Instance ID: 84e1dca0
Name: holodeck-aws-e2e-test
Provider: aws
Status: running
Created: 2025-05-21 19:01:30 (2m2s ago)
Cache File: /Users/eduardoa/.cache/holodeck/84e1dca0.yaml
❯ ./bin/holodeck delete -i 84e1dca0
✔       Waiting for instance i-0e28582e748d1ff59 to be terminated
✔       Deleting VPC resources
Successfully deleted instance 84e1dca0 (holodeck-aws-e2e-test)

New Commands

  • list Command: Added a new list command to display all Holodeck instances in a tabular format, including details like instance ID, name, provider, status, creation time, and age.
  • status Command: Added a new status command to show detailed information about a specific Holodeck instance, such as its ID, name, provider, status, creation time, and cache file.

Enhancements to Existing Commands

  • create Command:
    • Integrated an instance manager to generate unique instance IDs and manage cache paths dynamically.
    • Added instance ID to environment metadata for better tracking.
    • Removed hardcoded cache file paths for improved flexibility. [1] [2]
    • Logging improvements to indicate successful instance creation.
  • delete Command:
    • Refactored to support deletion by either environment file or instance ID, with validation to ensure only one is provided.
    • Replaced hardcoded cache file handling with the instance manager for consistency. [1] [2]

CLI Improvements

  • Added a detailed description and examples to the CLI help text, making it easier for users to understand and utilize the tool.
  • Introduced a custom help template with examples for each command, enhancing usability.
  • Enabled Bash completion for better developer experience.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances the Holodeck CLI by adding instance management commands and refactoring existing ones to use a centralized instance manager.

  • Introduces new list and status commands for inspecting instances.
  • Refactors create and delete to generate unique IDs, manage cache paths dynamically, and improve logging.
  • Improves CLI UX with richer help text, examples, and Bash completion.

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/data/test_aws.yml Updated test fixture paths and added an IP allow rule.
internal/instances/instances.go Added Manager implementation for instance lifecycle.
internal/instances/instances_test.go New unit tests for the instance manager.
cmd/cli/list/list.go New list command for tabular instance display.
cmd/cli/status/status.go New status command for detailed instance info.
cmd/cli/delete/delete.go Refactored delete to support env file or instance ID.
cmd/cli/create/create.go Refactored create to assign instance IDs dynamically.
cmd/cli/main.go Enhanced global help, description, examples, and flags.
Comments suppressed due to low confidence (4)

cmd/cli/delete/delete.go:61

  • [nitpick] The flag name "envFile" is inconsistent with typical CLI conventions (use lowercase and hyphens); consider renaming to "env-file" for consistency.
Name:        "envFile",

cmd/cli/list/list.go:64

  • There are no unit tests for the list command; consider adding tests to verify header output, no-instances behavior, and proper formatting.
func (m command) run(c *cli.Context) error {

cmd/cli/status/status.go:66

  • The status command lacks automated tests; consider adding tests for required-argument validation, successful lookup, and fallback to GetInstanceByFilename.
func (m command) run(c *cli.Context, instanceID string) error {

cmd/cli/main.go:66

  • [nitpick] The global examples show holodeck delete <instance-id> but the command actually requires -i <instance-id>; consider updating the example to include the flag for clarity.
#  Delete an environment

@ArangoGutierrez ArangoGutierrez requested a review from Copilot May 21, 2025 18:01
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances the CLI for managing Holodeck instances by introducing new instance management commands (list and status), improving create and delete functionality, and refining the overall user experience.

  • New commands for listing and checking the status of instances
  • Updates to the create and delete commands for dynamic cache handling and improved logging
  • Enhanced CLI help text with custom templates and Bash completion

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/data/test_aws.yml Updated AWS test configuration (privateKey path, additional CIDR rule)
internal/instances/instances_test.go Added tests for instance manager functions
internal/instances/instances.go Implemented instance management functions and status querying
cmd/cli/status/status.go Added status command to display detailed instance information
cmd/cli/main.go Updated CLI main entry with new commands and help template
cmd/cli/list/list.go Introduced list command for tabular display of instances
cmd/cli/delete/delete.go Refactored delete command to support removal by env file or instance ID
cmd/cli/create/create.go Improved create command with dynamic instance ID generation and cache handling
Comments suppressed due to low confidence (1)

cmd/cli/create/create.go:119

  • [nitpick] The variable opts.cachePath is later overwritten with a file path, which may be confusing since it was initially used as the cache directory. Consider introducing a separate variable (e.g., instanceCacheFile) for the file path to improve clarity.
instanceID := manager.GenerateInstanceID()

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR improves the Holodeck CLI by enhancing instance management functionality. The key changes include:

  • Introducing two new commands: "list" for displaying all instances and "status" for detailed information of a single instance.
  • Enhancing the "create" and "delete" commands with dynamic cache file handling and instance ID management.
  • Updating the CLI’s overall help text and enabling Bash completion.

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
internal/instances/instances_test.go Added tests for instance manager functions
internal/instances/instances.go Implements instance operations and status checks
cmd/cli/status/status.go Introduces the "status" command with detailed instance info
cmd/cli/main.go Updates main CLI setup with new commands and a custom help template
cmd/cli/list/list.go Implements the "list" command for displaying instances
cmd/cli/delete/delete.go Refactors the "delete" command to support deletion by env file or instance ID
cmd/cli/create/create.go Enhances the "create" command by generating unique instance IDs and dynamic cache file management

@ArangoGutierrez ArangoGutierrez force-pushed the cli_enh1 branch 3 times, most recently from e7d46ce to dcab961 Compare May 22, 2025 15:16
@ArangoGutierrez ArangoGutierrez added this to the v0.2.8 milestone May 22, 2025
Signed-off-by: Carlos Eduardo Arango Gutierrez <eduardoa@nvidia.com>
@ArangoGutierrez ArangoGutierrez merged commit b6014e5 into NVIDIA:main May 23, 2025
15 checks passed
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.

2 participants