Admin Tools

Overview

Starnion provides CLI commands for server administrators to manage user accounts and database migrations directly from the terminal.


starnion users โ€” User Account Management

The starnion users command group accesses PostgreSQL directly to manage user accounts. No login required โ€” instead, a valid database connection must be configured in ~/.starnion/config.yaml.

List Users

starnion users list

Example output:

โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ• USERS โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

  ID        EMAIL                  NAME          ROLE    CREATED
  โ”€โ”€โ”€โ”€โ”€โ”€    โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€  โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€  โ”€โ”€โ”€โ”€โ”€   โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
  a1b2c3    admin@example.com      Admin         admin   2024-01-15
  d4e5f6    user@example.com       John Doe      user    2024-02-01

  Total: 2 users

Add a New User

starnion users add \
  --email user@example.com \
  --password "StrongPassword123!" \
  --name "John Doe"

# Grant admin privileges
starnion users add \
  --email admin@example.com \
  --password "AdminPass!" \
  --name "System Admin" \
  --admin
Flag Required Description
--email โœ… Email address (must be unique)
--password โœ… Initial password
--name โœ… Display name
--admin โŒ Grant admin role (default: regular user)

Remove a User

starnion users remove user@example.com

A confirmation prompt is shown. Type yes to proceed with deletion.

โš ๏ธ Warning: All data associated with the account โ€” conversations, memos, diary entries, etc. โ€” will be permanently deleted.

Reset Password

starnion users reset-password user@example.com

A secure prompt is displayed to enter the new password (input is hidden from the terminal).


starnion db โ€” Database Migrations

The starnion db command group manages the database schema version. It uses the schema_migrations table to track which migrations have been applied.

Apply Migrations

starnion db migrate

Runs all .sql files in gateway/internal/cli/migrations/incremental/ in filename order. Already-applied files are skipped.

Example output:

  ยท v1.1.0-add-search-index.sql already applied
  โœ“ v1.2.0-add-usage-logs.sql applied

  Migration complete: 1 applied, 1 skipped

Check Migration Status

starnion db status

Example output:

โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ• MIGRATION STATUS โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•

  โœ“ v1.0.0 (baseline)          [applied 2024-01-15 10:30:00]
  โœ“ v1.1.0-add-search-index    [applied 2024-02-01 14:22:10]
  ยท v1.2.0-add-usage-logs      [pending]

Adding New Migration Files

  1. Create a .sql file in gateway/internal/cli/migrations/incremental/
  2. Use a version prefix โ€” filenames are executed in sort order:

    v1.2.0-add-usage-logs.sql
    v1.2.1-add-audit-table.sql
    
  3. Apply with starnion db migrate
  4. Verify with starnion db status

Document Processing Queue (Background Queue)

Parsing and embedding large documents (โ‰ฅ 500 KB) is handled by a background queue to prevent gRPC handler timeouts.

How It Works

parse_document called
  โ†“
File size check
  โ”œโ”€โ”€ < 500 KB โ†’ process synchronously โ†’ return result
  โ””โ”€โ”€ โ‰ฅ 500 KB โ†’ enqueue โ†’ return task_id
                     โ†“
               Background Workers (up to 2 concurrent)
                     โ†“
               Docling parsing + embedding + DB storage

Check Status (AI Tool)

After uploading a large document, use the returned task_id to poll progress:

check_document_status('<task_id>')

Status values:

Status Meaning
pending Waiting (not yet started)
processing In progress (Docling parsing + embedding)
done Complete (N sections stored in vector DB)
error Failed (error message included)

Configuration

# Number of concurrent workers (default: 2)
DOC_QUEUE_WORKERS=3

๐Ÿ’ก Docling is CPU-intensive. Setting too many workers can cause CPU contention and actually slow down processing.


Copyright © 2025 StarNion. All rights reserved.  |  v0.1.1