Skip to content

Add a vectorless-cli crate as a workspace member for command-line access to the vectorless engine. #78

@zTgx

Description

@zTgx

Summary

Add a command-line interface for Vectorless, implemented in Python using the existing Python SDK.

Motivation

  • Current 8 Rust examples essentially act as ad-hoc CLI scripts — a formal CLI is needed

  • pip install vectorless already installs the SDK; adding CLI costs nothing extra

  • One package name serves both: from vectorless import Engine (library) and vectorless index ... (CLI)

  • No new crate needed — avoids maintaining a separate vectorless-cli Rust crate

    Commands

vectorless init         EngineBuilder::new() + workspace init
vectorless add          engine.index(IndexContext)
vectorless list         engine.list()
vectorless info         engine.info(doc_id)
vectorless remove       engine.remove(doc_id)
vectorless query        engine.query(QueryContext)
vectorless ask          engine.query() × N (REPL loop)
vectorless tree         engine.get_tree(doc_id)
vectorless stats        engine.stats()

Architecture

python/vectorless/                                                                                                                                                                                                                                         
  __init__.py       # existing                                                                                                                                                                                                                             
  cli/              # new                                                                                                                                                                                                                                  
    __init__.py     # CLI entry point                                                                                                                                                                                                                      
    main.py         # click/typer app + command routing                                                                                                                                                                                                    
    commands/                                                                                                                                                                                                                                              
      __init__.py                                                                                                                                                                                                                                          
      init.py       # init                                                                                                                                                                                                                                 
      add.py        # add → engine.index                                                                                                                                                                                                                   
      list_cmd.py   # list                                                                                                                                                                                                                                 
      info.py       # info                                                                                                                                                                                                                                 
      remove.py     # remove                                                                                                                                                                                                                               
      query.py      # query → engine.query                                                                                                                                                                                                                 
      ask.py        # interactive REPL                                                                                                                                                                                                                     
      tree.py       # tree visualization                                                                                                                                                                                                                   
      stats.py      # workspace stats                                                                                                                                                                                                                      
      config_cmd.py # config management                                                                                                                                                                                                                    
    output.py       # output formatting (text/json/table)                                                                                                                                                                                                  
    workspace.py    # .vectorless/ directory management                                                                                                                                                                                                    

Entry point in pyproject.toml:

[project.scripts]                                                                                                                                                                                                                                          
vectorless = "vectorless.cli.main:app"                                                                                                                                                                                                                 

Implementation Notes

  • All engine calls are async, CLI needs asyncio.run() wrapper
  • --verbose flag on query shows Agent navigation steps
  • --format json for script integration
  • ask REPL uses prompt_toolkit for history/completion
  • Workspace config stored in .vectorless/config.toml

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions