lyzr-cortex-cli
v0.1.2
Published
CLI tool for Cortex platform developers - push, query, share documents and manage tools
Downloads
6
Maintainers
Readme
Lyzr Cortex CLI
Command-line tool for Cortex platform developers. Push documents, query the knowledge graph, share with users, and manage tool projects.
Installation
npm install -g lyzr-cortex-cliConfiguration
Set environment variables (or pass --api-url, --api-key, --tool-id to each command):
export CORTEX_API_URL=https://your-cortex-server.com
export CORTEX_API_KEY=your-api-key
export CORTEX_TOOL_ID=your-tool-idAPI Commands
These commands map directly to the Python (lyzr-cortex-sdk) and TypeScript (lyzr-cortex-sdk) SDK methods.
| CLI Command | Python SDK | TypeScript SDK | HTTP Endpoint |
|-------------|-----------|---------------|---------------|
| cortex push | client.push() | client.push() | POST /api/tools/documents |
| cortex query | client.query() | client.query() | POST /api/tools/query |
| cortex whoami | client.get_user_context() | client.getUserContext() | GET /api/tools/context/{email} |
| cortex share | client.share_document() | client.shareDocument() | POST /api/tools/share-document-for-user |
| cortex users | client.get_org_users() | client.getOrgUsers() | GET /api/tools/org-users-for-tool |
cortex push
Push a document to the Cortex Knowledge Graph.
# Push a transcript file
cortex push transcript_123 --type meeting_transcript --file ./transcript.txt --name "Product Sync"
# Push with personal scope
cortex push doc_456 --type note --file ./note.md --scope personal
# Push with team scope
cortex push doc_789 --type report --file ./report.txt --scope team --teams "team_eng,team_product"
# Push with metadata
cortex push doc_abc --type doc --file ./doc.txt --metadata '{"author":"[email protected]"}'Options:
<id>- Unique document ID (required)-t, --type <type>- Document type (required)-f, --file <path>- File with document content (required)-n, --name <name>- Display name-u, --url <url>- External URL-s, --scope <scope>- Access scope:global,team, orpersonal(default:global)--teams <ids>- Comma-separated team IDs (for team scope)--metadata <json>- JSON metadata object
cortex query
Query the Cortex Knowledge Graph.
# Simple query
cortex query "What decisions were made about Q1?"
# Filter by document type
cortex query "Latest meeting notes" --filters '{"type":["meeting_transcript"]}'
# Limit to recent documents
cortex query "Action items this week" --time-range 7
# Get raw JSON output
cortex query "Project status" --jsonOptions:
<question>- Natural language query (required)--filters <json>- JSON filter object--time-range <days>- Limit to recent N days--max-results <n>- Maximum results (default: 10)--user-email <email>- User email for access-scoped queries--json- Output raw JSON
cortex whoami
Get user context (teams, permissions, org info).
cortex whoami [email protected]
cortex whoami [email protected] --jsonOptions:
<email>- User email address (required)--json- Output raw JSON
cortex share
Share a document with another user. The document appears in the recipient's "Shared with Me" at /personal/shared.
cortex share transcript_123 --from [email protected] --to [email protected] --name "Product Sync"Options:
<document-id>- External ID of the document (required)--from <email>- Sharer's email (required)--to <email>- Recipient's email (required)-n, --name <name>- Document display name-c, --content <text>- Document content-u, --url <url>- External URL--metadata <json>- JSON metadata object
cortex users
List organization users.
cortex users
cortex users --exclude [email protected]
cortex users --jsonOptions:
--exclude <email>- Exclude an email from results--json- Output raw JSON
Project Management Commands
cortex init
Initialize a new Cortex tool project.
cortex init
cortex init --name my-tool --description "My awesome tool"
cortex init -y # Use defaults without promptsCreates:
cortex.yaml- Tool manifest.env.example- Environment variables template- Basic directory structure
cortex validate
Validate your cortex.yaml manifest.
cortex validate
cortex validate --file path/to/cortex.yamlcortex dev
Start local development environment.
cortex dev
cortex dev --port 8080cortex deploy
Deploy your tool to Cortex platform.
cortex deploy
cortex deploy --api-url https://api.cortex.ai --api-key your-key
cortex deploy --dry-runcortex status
Check tool registration and health status.
cortex status
cortex status --api-url https://api.cortex.ai --api-key your-keyAccess Scopes
| Scope | Who Can See | Cortex UI Location |
|-------|-------------|-------------------|
| global | Everyone in organization | Organization knowledge base |
| team | Specified team members | Team knowledge base |
| personal | Only the creator | /personal/transcripts |
| Shared via cortex share | Recipient | /personal/shared |
Manifest Format (cortex.yaml)
name: my-tool
display_name: My Tool
description: A tool that does awesome things
version: 1.0.0
documents:
- my_document_type
icon: puzzle
ui:
embed_path: /
menu:
label: My Tool
position: tools
build:
backend:
dockerfile: backend/Dockerfile
port: 8000
health_check: /health
frontend:
dockerfile: frontend/Dockerfile
port: 3000
secrets:
- MY_API_KEYLicense
MIT
