Skip to main content

kscli

CLI tool for the Knowledge Stack platform. Wraps the auto-generated ksapi Python SDK with a Click-based command interface using a resource-first routing pattern.

kscli folders list
kscli folders describe <id>
kscli documents create --name "My Doc" --parent-path-part-id <id>
kscli chunks search --query "semantic search" --folder-id <id>

Installation

Requires Python 3.12+ and uv.

# From PyPI
uv tool install kscli

# From source
git clone https://github.com/knowledgestack/ks-cli.git
cd ks-cli
uv sync --all-extras --group dev

Quick Start

1. Authenticate

Create an API key under My Account / API Keys after signing up on app.knowledgestack.ai.

kscli login --api-key <your-api-key>

You can also point at a different environment:

kscli login --api-key <your-api-key> --url https://api.knowledgestack.ai

2. Use the CLI

# Verify identity
kscli whoami

# Browse folders
kscli folders list
kscli folders list --format tree

# Work with documents
kscli documents list --folder-id <id>
kscli documents describe <doc-id>
kscli documents ingest --name "report.pdf" --file ./report.pdf --parent-path-part-id <id>

# Search chunks
kscli chunks search --query "quarterly revenue" --folder-id <id>

Commands

Top-level

Command Description
login Authenticate with a user-scoped API key
logout Remove stored credentials
whoami Show current authenticated identity
settings environment <name> Set environment preset (local/prod)
settings show Print resolved configuration

Resource groups

Each resource group supports a subset of verbs (list, describe, create, update, delete, and resource-specific actions):

Resource Verbs
folders list, describe, create, update, delete
documents list, describe, create, update, delete, ingest
document-versions list, describe, create, update, delete, contents, clear-contents
sections describe, create, update, delete
chunks describe, create, update, update-content, delete, search
tags list, describe, create, update, delete, attach, detach
workflows list, describe, cancel, rerun
tenants list, describe, update, delete, list-users
users update
permissions list, create, update, delete
invites list, create, delete, accept
threads list, describe, create, update, delete
thread-messages list, describe, create
chunk-lineages describe, create, delete
path-parts list, describe

Output Formats

Control output with --format / -f (can appear anywhere in the command):

kscli folders list --format json       # JSON output
kscli folders list -f yaml             # YAML output
kscli folders list -f table            # Rich table (default)
kscli folders list -f tree             # Tree view for hierarchical data
kscli folders list -f id-only          # Just IDs, one per line (useful for piping)
kscli folders list --no-header         # Suppress table headers

The default format can be set via KSCLI_FORMAT env var or kscli settings.

Configuration

Configuration resolves in order: CLI flags > environment variables > config file > defaults.

Environment Variable Description Default
KSCLI_BASE_URL API base URL http://localhost:8000
KSCLI_FORMAT Default output format table
KSCLI_VERIFY_SSL Enable SSL verification true
KSCLI_CA_BUNDLE Path to custom CA certificate bundle (system default)
KSCLI_CONFIG Config file path ~/.config/kscli/config.json
KSCLI_CREDENTIALS_PATH Credentials file path /tmp/kscli/.credentials

See docs/configuration.md for the full configuration reference.

Development

# Install dev dependencies
make install-dev

# Lint
make lint

# Lint + autofix
make fix

# Type check
make typecheck

# Run unit tests
make test

# Run full pre-commit checks (lint + typecheck + tests)
make pre-commit

Running E2E Tests

E2E tests require a running ks-backend instance. See docs/e2e-testing.md for the full guide.

# Quick start (with ks-backend checked out alongside ks-cli):
cd ../ks-backend
make e2e-stack    # Start Docker stack (postgres, API, worker)
make e2e-prep     # Seed database

cd ../ks-cli
make e2e-test     # Waits for API readiness, then runs tests

CI/CD

The GitHub Actions pipeline (.github/workflows/workflow.yml) runs three jobs:

  1. lint — ruff + basedpyright
  2. e2e — spins up the ks-backend Docker stack, seeds data, runs CLI e2e tests
  3. release — semantic-release to PyPI (gated on both lint and e2e passing)

See docs/ci.md for pipeline details.

Documentation

Metadata

Release files for kscli 1.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kscli 1.3.1
File Size Uploaded Provenance
kscli-1.3.1.tar.gz 80.3 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for kscli 1.3.1
File Interpreter ABI Platform
kscli-1.3.1-py3-none-any.whl Python 3 none any Details

Total release size: 112.5 kB

Release files / kscli-1.3.1.tar.gz

Download URL kscli-1.3.1.tar.gz
Size 80.3 kB
Tags Source
SHA-256 checksum
How to use checksums
cc5ee590bd0a3e621a858bf877daa613f76829b661f6c1378843ba0e0669cdcf
BLAKE2b-256 checksum
How to use checksums
8b9c8c2424c58e2d32f7e0dfe084bed43bc23db3905e9ce6e038570a6d3dc9bf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 31, 2026.

Transparency log

Release files / kscli-1.3.1-py3-none-any.whl

Download URL kscli-1.3.1-py3-none-any.whl
Size 32.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
70e2b714468d746606d40bb3257d090d3f95451e094385e5389ba1971c36390c
BLAKE2b-256 checksum
How to use checksums
04cd5d268acb1a0bf8aa69336bd76a80a146e1850a3e74c460c181bd587e9692
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 31, 2026.

Transparency log

Security for kscli 1.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for kscli-1.3.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Mar 31, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page