Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 9 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,30 +25,21 @@ uv sync --all-extras --group dev

## Quick Start

### 1. Configure the environment
### 1. Authenticate

```bash
# Point at a running Knowledge Stack instance
kscli settings environment local # http://localhost:8000
kscli settings environment prod # https://api.knowledgestack.ai
```

Or set environment variables directly:
Create an API key under **My Account / API Keys** after signing up on [app.knowledgestack.ai](https://app.knowledgestack.ai).

```bash
export KSCLI_BASE_URL=http://localhost:8000
export ADMIN_API_KEY=your-admin-key
kscli login --api-key <your-api-key>
```

### 2. Authenticate
You can also point at a different environment:

```bash
kscli assume-user --tenant-id <tenant-uuid> --user-id <user-uuid>
kscli login --api-key <your-api-key> --url https://api.knowledgestack.ai
```

This obtains a JWT via the `/v1/auth/assume_user` admin endpoint and caches it locally. The token auto-refreshes on expiry. See [docs/authentication.md](docs/authentication.md) for details.

### 3. Use the CLI
### 2. Use the CLI

```bash
# Verify identity
Expand All @@ -73,7 +64,8 @@ kscli chunks search --query "quarterly revenue" --folder-id <id>

| Command | Description |
|---------|-------------|
| `assume-user` | Authenticate as a specific user via admin impersonation |
| `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 |
Expand All @@ -91,7 +83,7 @@ Each resource group supports a subset of verbs (`list`, `describe`, `create`, `u
| `chunks` | describe, create, update, update-content, delete, search |
| `tags` | list, describe, create, update, delete, attach, detach |
| `workflows` | list, describe, cancel, rerun |
| `tenants` | list, describe, create, update, delete, list-users |
| `tenants` | list, describe, update, delete, list-users |
| `users` | update |
| `permissions` | list, create, update, delete |
| `invites` | list, create, delete, accept |
Expand Down Expand Up @@ -122,7 +114,6 @@ Configuration resolves in order: **CLI flags > environment variables > config fi
| Environment Variable | Description | Default |
|---------------------|-------------|---------|
| `KSCLI_BASE_URL` | API base URL | `http://localhost:8000` |
| `ADMIN_API_KEY` | Admin API key for authentication | _(required)_ |
| `KSCLI_FORMAT` | Default output format | `table` |
| `KSCLI_VERIFY_SSL` | Enable SSL verification | `true` |
| `KSCLI_CA_BUNDLE` | Path to custom CA certificate bundle | _(system default)_ |
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ packages = ["src/kscli"]
[dependency-groups]
dev = [
"basedpyright>=1.38.1",
"pre-commit>=4.5.1",
"pytest>=9.0.2",
"pytest-xdist>=3.8.0",
"ruff>=0.15.2",
Expand Down
14 changes: 0 additions & 14 deletions src/kscli/commands/tenants.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,6 @@ def describe_tenant(ctx, tenant_id):
print_result(ctx, result.model_dump(mode="json"))


@tenants.command("create")
@click.option("--name", "-n", required=True)
@click.option("--idp-config", default=None, help="JSON string of IDP config")
@click.pass_context
def create_tenant(ctx, name, idp_config):
"""Create a tenant."""
api_client = get_api_client(ctx)
with handle_client_errors():
api = ksapi.TenantsApi(api_client)
idp = json.loads(idp_config) if idp_config else None
result = api.create_tenant(ksapi.CreateTenantRequest(name=name, idp_config=idp))
print_result(ctx, result.model_dump(mode="json"))


@tenants.command("update")
@click.argument("tenant_id", type=click.UUID)
@click.option("--name", "-n", default=None)
Expand Down
8 changes: 4 additions & 4 deletions src/kscli/commands/workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def list_workflows(ctx, limit, offset):
api_client = get_api_client(ctx)
with handle_client_errors():
api = ksapi.WorkflowsApi(api_client)
result = api.list_workflows(limit=limit, offset=offset)
result = api.list_dv_workflows(limit=limit, offset=offset)
print_result(ctx, result.model_dump(mode="json"), columns=COLUMNS)


Expand All @@ -35,7 +35,7 @@ def describe_workflow(ctx, workflow_id):
api_client = get_api_client(ctx)
with handle_client_errors():
api = ksapi.WorkflowsApi(api_client)
result = api.get_workflow(str(workflow_id))
result = api.get_dv_workflow(str(workflow_id))
print_result(ctx, result.model_dump(mode="json"))


Expand All @@ -47,7 +47,7 @@ def cancel_workflow(ctx, workflow_id):
api_client = get_api_client(ctx)
with handle_client_errors():
api = ksapi.WorkflowsApi(api_client)
result = api.workflow_action(str(workflow_id), ksapi.WorkflowAction.CANCEL)
result = api.cancel_temporal_workflow(str(workflow_id))
print_result(ctx, result.model_dump(mode="json"))


Expand All @@ -59,5 +59,5 @@ def rerun_workflow(ctx, workflow_id):
api_client = get_api_client(ctx)
with handle_client_errors():
api = ksapi.WorkflowsApi(api_client)
result = api.workflow_action(str(workflow_id), ksapi.WorkflowAction.RERUN)
result = api.dv_workflow_rerun(str(workflow_id))
print_result(ctx, result.model_dump(mode="json"))
Loading
Loading