Skip to content

Add tab autocompletion to the cli#91

Merged
hiverge-robot merged 1 commit intomainfrom
autocomplete
Jan 16, 2026
Merged

Add tab autocompletion to the cli#91
hiverge-robot merged 1 commit intomainfrom
autocomplete

Conversation

@brp-hiverge
Copy link
Contributor

No description provided.

@hiverge-robot hiverge-robot added needs-triage Indicates an issue or PR lacks a label and requires one. needs-priority Indicates a PR lacks a label and requires one. do-not-merge/needs-kind Indicates a PR lacks a label and requires one. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Jan 16, 2026
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 adds tab autocompletion support to the Hive CLI using argcomplete, enabling users to autocomplete commands, experiment names, sandbox names, and file paths.

Changes:

  • Added argcomplete integration to the CLI argument parser
  • Implemented three completer functions (experiment, sandbox, config file) with timeout handling
  • Created comprehensive unit tests for all completer functions

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/hive_cli/completers.py New module implementing completer functions for experiments, sandboxes, and config files with timeout and error handling
src/hive_cli/main.py Integrated argcomplete by adding completers to CLI arguments and calling autocomplete() on the parser
tests/test_completers.py Comprehensive unit tests covering success cases, error handling, and filtering for all completer functions
pyproject.toml Added argcomplete dependency
README.md Added documentation for shell completion setup and usage

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +32 to +34
class TimeoutError(Exception):
"""Raised when a completion operation times out."""
pass
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

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

The custom TimeoutError class shadows Python's built-in TimeoutError exception (available since Python 3.3). Rename this to avoid conflicts, for example: CompletionTimeoutError.

Copilot uses AI. Check for mistakes.
Returns:
List of experiment names matching the prefix
"""
# Set up 2-second timeout
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

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

The comment states a '2-second timeout' but there's no explanation of why 2 seconds was chosen or how users can adjust this if needed. Consider documenting the rationale for this value.

Copilot uses AI. Check for mistakes.
Returns:
List of sandbox pod names matching the prefix
"""
# Set up 2-second timeout
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

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

The comment states a '2-second timeout' but there's no explanation of why 2 seconds was chosen or how users can adjust this if needed. Consider documenting the rationale for this value.

Copilot uses AI. Check for mistakes.
Comment on lines +59 to +61
# Set up 2-second timeout
signal.signal(signal.SIGALRM, timeout_handler)
signal.alarm(2)
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

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

The timeout duration (2 seconds) is hardcoded in both experiment_completer and sandbox_completer. Extract this to a module-level constant like COMPLETION_TIMEOUT_SECONDS = 2 to improve maintainability.

Copilot uses AI. Check for mistakes.
@ky-hiverge
Copy link
Member

/lgtm
/kind feature

@hiverge-robot hiverge-robot added lgtm Looks good to me, indicates that a PR is ready to be merged. feature Categorizes issue or PR as related to a new feature. and removed do-not-merge/needs-kind Indicates a PR lacks a label and requires one. labels Jan 16, 2026
@hiverge-robot hiverge-robot merged commit f76455d into main Jan 16, 2026
41 checks passed
@ky-hiverge ky-hiverge deleted the autocomplete branch January 16, 2026 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. feature Categorizes issue or PR as related to a new feature. lgtm Looks good to me, indicates that a PR is ready to be merged. needs-priority Indicates a PR lacks a label and requires one. needs-triage Indicates an issue or PR lacks a label and requires one.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants