Contextium CLI - Command Line Interface

Access your Contextium documentation directly from the terminal. Perfect for developers who want to integrate documentation into their IDE workflow.

Contextium CLI - Command Line Interface

Access your Contextium documentation from the terminal - perfect for developers, automation, and IDE integration.

What is this? The Contextium CLI lets you access your documentation from the command line. Search files, view content, sync projects, and pipe documentation directly into your IDE or AI coding assistant.


Who This Is For

Perfect if you:

  • Work in the terminal - Prefer command-line tools and keyboard workflows
  • Use AI coding assistants - Want to pipe documentation to Claude, ChatGPT, Cursor, or Copilot
  • Build automation - Need to integrate documentation into scripts
  • IDE integration - Want documentation accessible without leaving your editor
  • Quick lookups - Need fast access to project context

What You Can Do

Read Operations

  • Search across all documentation
  • View file content in your terminal
  • Sync project files to local cache
  • Check connection status
  • List available files

Project Management

  • Initialize CLI for specific projects
  • Cache files locally for offline access
  • Stay in sync with your team's documentation
  • Work with multiple workspaces

Installation

Install the CLI globally from npm:

npm install -g @contextium/cli

Verify installation:

doxhub --version

Quick Start

1. Generate an API Key

  1. Go to Contextium Settings → API Keys
  2. Click "Create New API Key"
  3. Give it a name (e.g., "My Laptop CLI")
  4. Copy the key (starts with dxh_)

⚠️ Important: Save the key immediately - it's only shown once!


2. Initialize CLI in Your Project

Navigate to your project directory and run:

doxhub init --api-key YOUR_API_KEY --workspace YOUR_WORKSPACE_SLUG --project YOUR_PROJECT_SLUG

Example:

cd my-project doxhub init \ --api-key dxh_791ce3fc0877516f6fc92840eca04022e9fbe41e374c1a954899f96b79a75217 \ --workspace engineering-team \ --project api-documentation

What this does:

  • Creates .doxhubrc config file in your project directory
  • Saves your API key and project settings
  • Creates local cache directory (.contexthub-cache/)
  • Adds both to .gitignore automatically

3. Start Using Commands

# List your workspaces doxhub workspaces # List projects in a workspace doxhub projects doxhub # List files in a project doxhub files "my-project" # Find a file by name doxhub find authentication # View file content doxhub cat api-guide.md

All Commands

workspaces

List all your workspaces with project counts

doxhub workspaces Example output: Your Workspaces: Doxhub (9 projects) slug: doxhub Private Workspace (1 project) slug: private-workspace

What it shows:

  • All workspaces you have access to
  • Number of projects in each workspace
  • Workspace slugs for use in other commands

projects

List projects in a workspace with file counts

doxhub projects <workspace-name> Arguments: workspace-name Workspace name or slug Examples: # By workspace name doxhub projects Doxhub # By workspace slug doxhub projects doxhub Example output: Projects in 'Doxhub': Notion Import (1) (4 files) slug: notion-import-1 Dev (7 files) slug: dev Marketing (0 files) slug: marketing

What it shows:

  • All projects in the specified workspace
  • Number of files in each project
  • Project slugs for use in other commands

files

List files in a project with pagination

doxhub files <project-name> [options] Arguments: project-name Project name or slug Options: --workspace <slug> Specify workspace (if project name is ambiguous) --page <number> Page number (default: 1) --limit <number> Items per page (default: 20) Examples: # By project name doxhub files "Shared Project" # By project slug doxhub files dev # With pagination doxhub files dev --page 2 --limit 10 # Specify workspace if name is ambiguous doxhub files "test project" --workspace doxhub Example output: Files in 'Dev' (Doxhub): Page 1 of 1 (7 total files) 1. test-grace-period.ts (v1, 6d ago) 2. PRODUCTION_DEPLOYMENT.md (v1, 6d ago) 3. TEST_RESULTS.md (v1, 6d ago) 4. DOCS_SITE_IMPLEMENTATION.md (v1, 6d ago) ...

What it shows:

  • All files in the specified project
  • File versions and last update time
  • Pagination info for large file lists

find

Find files by name with smart partial matching

doxhub find <filename> [options] Arguments: filename File name or partial name (no extension needed) Options: --workspace <slug> Limit search to specific workspace Examples: # Find by partial name (no extension needed) doxhub find grace-period # Find in specific workspace doxhub find test --workspace doxhub Example output: Found 2 matches: 1. test-grace-period.ts Project: Shared Project Workspace: Doxhub Version: v1 Updated: 5 days ago 2. test-grace-period.ts Project: Dev Workspace: Doxhub Version: v1 Updated: 6 days ago To view this file, run: doxhub cat "test-grace-period.ts"

What it does:

  • Case-insensitive partial matching
  • No file extension required
  • Shows file location (workspace/project)
  • Sorts by relevance (exact matches first)

init

Initialize Contextium CLI in your project directory

doxhub init [options] Required Options: --api-key <key> Your Contextium API key (get from Settings > API Keys) --workspace <slug> Workspace slug (e.g., "engineering-team") --project <slug> Project slug (e.g., "api-docs") Optional: --api-url <url> Custom API URL (default: http://localhost:3001/api/v1) Examples: # Basic initialization doxhub init \ --api-key dxh_your_key_here \ --workspace my-workspace \ --project my-project # With custom API URL (for self-hosted) doxhub init \ --api-key dxh_your_key_here \ --workspace my-workspace \ --project my-project \ --api-url https://api.yourdomain.com/api/v1

What it creates:

  • .doxhubrc - Configuration file with API key and project info
  • .contexthub-cache/ - Local cache directory for synced files
  • Updates .gitignore - Prevents committing sensitive files

status

Check CLI status and connection to Contextium

doxhub status Example output: Project ID: abc-123-def-456 Workspace: engineering-team ✓ Connected to Contextium Files: 42 Last synced: 2 minutes ago Cache size: 1.2 MB

What it shows:

  • Current project and workspace
  • Connection status
  • Number of files available
  • Cache status and size

Search for files in your project

doxhub search <query> [options] Options: --tag <tags...> Filter by tags Examples: # Basic search doxhub search "authentication" # Search with tags doxhub search "API" --tag backend --tag rest Example output: 🔍 Search results for: "authentication" Found 5 files: 1. Authentication Guide Path: /guides/auth.md Tags: backend, security Updated: 2 hours ago 2. OAuth Setup Path: /setup/oauth.md Tags: backend, oauth Updated: 1 day ago 3. API Authentication Path: /api/auth.md Tags: api, backend Updated: 3 days ago

cat

Output file content to stdout (perfect for piping to AI assistants)

doxhub cat [files...] [options] Arguments: files Filenames to output (e.g., "api-guide.md") Options: --all Output all files in project --tag <tags...> Filter by tags --with-meta Include metadata header --format <format> Output format: text (default) or json --no-cache Skip local cache, fetch from API Examples: # Output single file doxhub cat authentication-guide.md # Output multiple files doxhub cat auth.md api-reference.md setup.md # Output all files doxhub cat --all # Output with metadata doxhub cat api.md --with-meta # Output files with specific tags doxhub cat --tag foundation-context --tag always-include # JSON output (for scripting) doxhub cat api.md --format json # Force fresh fetch (bypass cache) doxhub cat api.md --no-cache

Example output:

# Authentication Guide This guide covers authentication methods... [file content here] ───────────────────────────────────────────── # API Reference Our REST API uses JWT tokens... [file content here]

Example with metadata:

───
file: authentication-guide.md
version: 5
project_id: abc-123
last_updated: 2026-02-10T10:30:00Z
───

# Authentication Guide

[file content here]

sync

Sync project files to local cache

doxhub sync [files...] [options] Arguments: files Specific files to sync (optional) Options: --force Force re-sync even if up-to-date Examples: # Sync all files doxhub sync # Sync specific files doxhub sync api-guide.md auth-setup.md # Force full re-sync doxhub sync --force Example output: ⠋ Syncing files from Contextium... ✓ Downloaded 42 files Cache: .contexthub-cache/ Size: 1.2 MB Files synced successfully!

Configuration File

When you run doxhub init, a .doxhubrc file is created in your project:

{ "api_key": "dxh_your_key_here", "api_url": "http://localhost:3001/api/v1", "project_id": "abc-123-def-456", "workspace": "engineering-team", "cache": { "enabled": true, "ttl": 3600, "directory": ".contexthub-cache", "max_size_mb": 100 }, "sync": { "auto": true, "on_command": ["build", "test"], "notify_changes": true, "interval": 300 }, "files": { "include": [], "exclude": ["DEPRECATED_*.md", "DRAFT_*.md"], "tags": ["foundation-context", "always-include"], "auto_include_tags": true } }

Important: This file is automatically added to .gitignore to protect your API key.


Real-World Use Cases

Use Case 1: Pipe Docs to AI Coding Assistant

Scenario: Give Claude/ChatGPT/Cursor context about your API before asking questions.

# In Claude Code or similar doxhub cat --tag foundation-context | claude-code # Or manually copy doxhub cat api-reference.md authentication.md # Copy output and paste into ChatGPT/Claude

Use Case 2: IDE Integration

Scenario: Access documentation without leaving your code editor.

VS Code:

# Add to tasks.json { "label": "Search Contextium", "type": "shell", "command": "doxhub search \"${input:searchQuery}\"" }

Vim:

" Add to .vimrc command! -nargs=1 DoxSearch :r !doxhub search <args> command! -nargs=1 DoxCat :r !doxhub cat <args> " Usage: " :DoxSearch authentication " :DoxCat api-guide.md

Use Case 3: CI/CD Documentation Checks

Scenario: Ensure code changes reference updated documentation.

# .github/workflows/docs-check.yml name: Documentation Check on: [pull_request] jobs: check-docs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - name: Install Contextium CLI run: npm install -g @contextium/cli - name: Setup Contextium run: | echo '${{ secrets.DOXHUB_CONFIG }}' > .doxhubrc - name: Check if API docs are updated run: | # Search for API files doxhub search "API" --format json > api-docs.json # Add your validation logic here # e.g., check if certain files were updated recently

Use Case 4: Quick Documentation Reference

Scenario: Quick terminal lookups while coding.

# Add to .bashrc or .zshrc alias docs="doxhub search" alias readme="doxhub cat README.md" alias api-ref="doxhub cat api-reference.md" # Usage: docs "authentication" readme api-ref

Use Case 5: Sync Docs for Offline Work

Scenario: Work on documentation offline (airplane, poor connection).

# Before going offline cd my-project doxhub sync --force # While offline, files are cached locally doxhub cat api-guide.md # ✓ Works (from cache) doxhub search "auth" # ✓ Works (searches cache) doxhub status # ✓ Shows cache status

Per-Project Setup

The CLI is project-scoped - each project needs its own initialization:

# Project A cd ~/projects/api-backend doxhub init --api-key KEY --workspace team --project backend-api # Project B cd ~/projects/frontend-app doxhub init --api-key KEY --workspace team --project frontend-docs # Each project has its own: # - .doxhubrc (project config) # - .contexthub-cache/ (local file cache)

Benefits:

  • Different projects can connect to different Contextium projects
  • Each project has isolated documentation cache
  • Team members can use their own API keys

Multi-Workspace Support

You can work with multiple workspaces by initializing different projects:

# Work workspace cd ~/work/backend doxhub init --api-key WORK_KEY --workspace work-team --project backend # Personal workspace cd ~/personal/blog doxhub init --api-key PERSONAL_KEY --workspace personal --project blog-docs

Security Best Practices

API Key Management

DO:

  • Generate one API key per machine/developer
  • Name keys descriptively (e.g., "Tom's Laptop", "CI/CD Pipeline")
  • Revoke keys you're not using
  • Store keys in .doxhubrc (auto-added to .gitignore)

DON'T:

  • Share API keys between team members
  • Commit .doxhubrc to Git
  • Use the same key for local dev and CI/CD
  • Hardcode keys in scripts

CI/CD Best Practices

For GitHub Actions / GitLab CI:

- name: Setup Contextium CLI run: | npm install -g @contextium/cli # Create config from secret cat > .doxhubrc << EOF { "api_key": "${{ secrets.DOXHUB_API_KEY }}", "api_url": "https://api.contextium.io/api/v1", "project_id": "${{ secrets.DOXHUB_PROJECT_ID }}", "workspace": "your-workspace" } EOF

Create dedicated CI/CD API keys:

  1. Go to Settings → API Keys
  2. Create new key named "CI/CD - GitHub Actions"
  3. Add to your CI secrets
  4. Never share with local development

Troubleshooting

"Not authenticated" or "Invalid API key"

Error:

❌ Authentication failed: Invalid API key

Fix:

  1. Check your API key is correct in .doxhubrc
  2. Verify the key hasn't been revoked (Settings > API Keys)
  3. Ensure the key has access to the workspace/project
  4. Try generating a new key

"Project not found"

Error:

❌ Project not found: test-project

Fix:

  1. Verify the workspace slug is correct
  2. Check the project slug matches exactly
  3. Ensure you have access to the project
  4. Try listing projects: check Settings > API Keys for workspace/project slugs

"Connection failed"

Error:

❌ Failed to connect to Contextium API

Fix:

  1. Check your internet connection
  2. Verify API URL in .doxhubrc is correct
  3. For self-hosted: ensure API server is running
  4. Check firewall/proxy settings

Cache issues

If cached files seem outdated:

# Force re-sync all files doxhub sync --force # Or bypass cache for specific file doxhub cat file.md --no-cache

Advanced Usage

Custom API Endpoint (Self-Hosted)

If you're self-hosting Contextium:

doxhub init \ --api-key YOUR_KEY \ --workspace your-workspace \ --project your-project \ --api-url https://your-contextium-instance.com/api/v1

Shell Completion (Coming Soon)

# Bash doxhub completion bash >> ~/.bashrc # Zsh doxhub completion zsh >> ~/.zshrc # Fish doxhub completion fish > ~/.config/fish/completions/doxhub.fish

JSON Output for Scripting

# Get JSON output for parsing doxhub cat api.md --format json | jq '.content' # Use in scripts FILES=$(doxhub search "API" --format json | jq -r '.[].title') for file in $FILES; do echo "Processing: $file" doxhub cat "$file" --content-only > "output/$file" done

Workflow Persistence

Good news: Everything persists across terminal sessions!

One-Time Setup (Per Machine)

# Install CLI globally (once per machine) npm install -g @contextium/cli

One-Time Setup (Per Project)

# Initialize in project (once per project) cd my-project doxhub init --api-key KEY --workspace WORKSPACE --project PROJECT

Daily Usage (Forever)

# Close terminal, reopen tomorrow, change directories... cd my-project doxhub status # ✓ Still works! doxhub search # ✓ Still works! doxhub cat # ✓ Still works!

What persists:

  • ✅ Global CLI installation
  • ✅ Project configuration (.doxhubrc)
  • ✅ API key and credentials
  • ✅ Cached files (.contexthub-cache/)

What you DON'T need to do again:

  • ❌ Reinstall CLI
  • ❌ Regenerate API key
  • ❌ Re-run doxhub init
  • ❌ Re-enter credentials

Need Help?

Resources


Quick Reference

# Installation npm install -g @contextium/cli # Setup (workspace-level access) doxhub init --api-key KEY # Browse & Navigate doxhub workspaces # List all workspaces doxhub projects <workspace> # List projects in workspace doxhub files <project> # List files in project doxhub find <filename> # Find file by name # View Content doxhub cat file.md # View file doxhub cat --all --workspace SLUG # View all files doxhub cat --tag foundation-context # View tagged files # Advanced doxhub status --workspace SLUG # Check sync status doxhub search "query" # Search files doxhub sync # Sync files locally # Help doxhub --help # Show all commands doxhub <command> --help # Command-specific help

Happy command-line documentation access! 🚀


Last updated: February 10, 2026 Version: 0.2.0 - Added intuitive navigation commands (workspaces, projects, files, find) Questions? Email hello@contextium.io