open-index/open-npm huggingface dataset:
npm package: @lotics/cli
Description: Lotics SDK and CLI for AI agents
Latest version: 0.10.0

# @lotics/cli

CLI and SDK for AI agents to interact with Lotics.

Lotics is an AI-powered operations platform. Through this CLI you can:

- Manage tables, records, and views (structured data with typed fields)
- Generate documents from templates (Excel, Word, PDF)
- Build and run automations (event-driven workflows)
- Create and manage apps, knowledge docs, and files

## Install

```bash
npm install -g @lotics/cli
```

## Update

```bash
npm install -g @lotics/cli@latest
```

The CLI checks for updates once per day and prompts when a new version is available.

## Authentication

**`lotics auth signup`** — Creates a new Lotics account, organization, workspace, and API key in one step. Sends a magic link email so you can access the web app.

```bash
lotics auth signup                                   # interactive prompts
lotics auth signup a@b.com --name "Agent"            # non-interactive
```

**`lotics auth web`** — Send a magic link email to access the web app (requires prior signup or setup).

```bash
lotics auth web
```

**`lotics auth api-key`** — Saves an existing API key directly (e.g. one created in the Lotics web app).

```bash
lotics auth api-key                  # interactive prompt
lotics auth api-key ltk_...          # non-interactive
```

API key is saved to `~/.lotics/config.json`. Run `lotics auth logout` to remove saved credentials.

Auth priority: `--api-key` flag > `LOTICS_API_KEY` env > `~/.lotics/config.json`.

## Workspaces

If your organization has multiple workspaces, select one before running tools:

```bash
lotics workspace                    # list workspaces (marks current)
lotics workspace select wks_...     # switch to a workspace
lotics workspace create "Sales"     # create a new workspace (admin only)
```

Single-workspace organizations auto-select on first use.

## CLI

```bash
# Discover tools
lotics tools                    # list tools by category with descriptions
lotics tools query_records      # show full description + input schema

# Execute
lotics run query_tables '{}'
lotics run query_records '{"table_id":"tbl_...","field_keys":["name"]}'

# Pipe args via stdin
echo '{"table_id":"tbl_..."}' | lotics run query_records

# Upload files (multiple files and directories supported)
lotics upload ./report.pdf ./data.csv ./documents/

# Generate a file, then download it
lotics run generate_excel_from_template '{"..."}'
lotics download <file_id> -o ./reports/

# CI / non-interactive
LOTICS_API_KEY=ltk_... lotics run query_tables '{}'
```

## SDK

```typescript
import { LoticsClient } from "@lotics/cli";

const client = new LoticsClient({ apiKey: "ltk_..." });

const { result } = await client.execute("query_tables", {});
const upload = await client.uploadFiles(["./report.pdf", "./data.csv"]);
await client.downloadFile(url, "./output.xlsx");
const { tools, categories } = await client.listTools();
const info = await client.getTool("query_records");
```