Skip to content

Conversation

@ng-galien
Copy link
Contributor

@ng-galien ng-galien commented Sep 22, 2025

CLI Improvements: Model Index Selection, listls, Unified Positional Parameter

Short Summary
Improve CLI UX: add positional <model name | index> parameter, rename list to ls, refactor model listing, and update developer guide formatting.


Overview

This PR streamlines and unifies how models are referenced across CLI commands. Users can now specify either a full HuggingFace-style model identifier (owner/name) or a numeric index produced by the new ls command. The previous list command has been renamed to the shorter and more conventional ls.


Key Changes

  1. Added a required positional parameter <model name> (can be a name or an index) to model-driven commands via ModelBaseCommand.
  2. Renamed the list command to ls and simplified its logic to enumerate local models with stable 1..N indices.
  3. Refactored listing to avoid ad-hoc filesystem traversal and leverage shared helpers.
  4. Updated multiple CLI commands to consume the new positional model argument:
    • ApiServiceCommand
    • ChatCommand
    • ClusterCoordinatorCommand
    • ClusterWorkerCommand
    • CompleteCommand
    • DownloadCommand
    • QuantizeCommand
    • RemoveCommand
    • SimpleBaseCommand
    • ModelBaseCommand
  5. Updated DEVELOPER_GUIDE.md (language hint for build code block and minor formatting polish).

Rationale

  • Faster iteration: ./run-cli.sh chat 2 instead of typing a long model identifier.
  • Consistent UX across commands.
  • Reduced duplication and clearer argument handling.

Testing

  • Local build: ./mvnw -DskipTests verify completed successfully.
  • Manual runtime check: ./run-cli.sh ls displays enumerated models; index-based selection works with downstream commands.

Example Usage

# List models with indices
./run-cli.sh ls

# Use a model by index (e.g., the second one)
./run-cli.sh chat 2

# Or by explicit identifier
./run-cli.sh chat owner/model-name

…l name> param; refactor listing logic; update developer guide code block
Copy link
Owner

@tjake tjake left a comment

Choose a reason for hiding this comment

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

Great idea, just a couple issues

@ng-galien
Copy link
Contributor Author

@tjake Thx, issues are fixed

# Conflicts:
#	jlama-cli/src/main/java/com/github/tjake/jlama/cli/commands/DownloadCommand.java
#	jlama-cli/src/main/java/com/github/tjake/jlama/cli/commands/SimpleBaseCommand.java
@tjake tjake merged commit 8e37517 into tjake:main Oct 12, 2025
1 of 5 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