knowhere icon indicating copy to clipboard operation
knowhere copied to clipboard

[Feature]: Add `knowhere` CLI with TUI and JSON headless modes

Open kaiyu96 opened this issue 5 months ago • 0 comments

Problem statement

To use Knowhere today, every team must write their own HTTP client, async polling loop and result download logic.

Without an official CLI, users repeatedly reimplement:

  • Submitting jobs and waiting for long-running parses.
  • Downloading and unpacking result ZIPs.
  • Inspecting and understanding the Knowhere output format.

Affected area

Other

Proposed solution

Provide an official knowhere CLI that wraps the existing API and supports two modes:

  1. TUI / human-friendly mode (default):
    Rich terminal output with progress, colors and concise hints.

  2. JSON headless mode (--json):
    Machine-friendly output: stdout contains only valid JSON (including errors), with no extra text. Suitable for scripts, CI and AI agents.

Proposed commands:

  • knowhere ingest
    Submit parsing jobs for one or more documents.
    Options: --wait (block until completed), --no-wait, --name.
    Uses POST /v1/jobs under the hood.

  • knowhere status
    Show status and progress for a given job_id.
    Wrapper over GET /v1/jobs/{id}.

  • knowhere download
    Download the result package for a job and unpack to a target directory (e.g. chunks.json, images/, tables/).

  • knowhere inspect
    Inspect a local result directory: sample chunks, field structure, basic counts. Local-only.

  • knowhere get-hierarchy
    Print the document hierarchy tree derived from the Knowhere result (tree view in TUI, JSON in --json mode).

  • knowhere retrieve
    Run Agentic Retrieval over a parsed result directory given a text query, returning ranked hits with hierarchy paths.

  • knowhere read-chunks
    Read and filter raw chunks from a result directory (by type, path, etc.), useful for debugging and custom indexing.

Authentication:

  • Use KNOWHERE_API_KEY environment variable (and document this clearly) so users can call the CLI from any project without repeating configuration.

Alternatives considered

No response

Compatibility and migration notes

No response

Additional context

No response

kaiyu96 avatar Jun 23 '26 05:06 kaiyu96