CLI Commands

The trik CLI helps you discover, install, and manage triks.

Installation

npm install -g @trikhub/cli

Or use with npx:

npx @trikhub/cli <command>

Verify installation:

trik --version

Commands

trik install

Install a trik from the registry.

trik install <trik> trik i <trik> # alias

Options:

  • -v, --version <version> - Install a specific version

Examples:

# Install latest version trik install @molefas/article-search # Install specific version trik install @molefas/article-search -v 2.0.0 # Shorthand trik i @acme/weather

What happens:

  1. Downloads the trik from GitHub releases
  2. Extracts to .trikhub/triks/<trik>/
  3. Adds to .trikhub/config.json

trik uninstall

Remove an installed trik.

trik uninstall <trik> trik rm <trik> # alias trik remove <trik> # alias

Example:

trik uninstall @molefas/article-search trik rm @acme/weather

trik list

List installed triks.

trik list trik ls # alias

Options:

  • -j, --json - Output as JSON

Example output:

Installed triks: @molefas/article-search@2.0.0 @acme/weather@1.2.0

Search the registry for triks.

trik search <query> trik s <query> # alias

Options:

  • -j, --json - Output as JSON
  • -l, --limit <number> - Limit results (default: 10)

Example:

trik search article trik search weather -l 5

trik info

Show detailed information about a trik.

trik info <trik>

Options:

  • -j, --json - Output as JSON

Example:

trik info @molefas/article-search

Output:

@molefas/article-search@2.0.0 Article Search Searches for articles on a given topic. Demonstrates type-directed privilege separation. Actions: search Search for articles by topic (template) details Get article details (passthrough) list List article summaries (passthrough) Repository: github.com/molefas/article-search

trik upgrade

Upgrade installed triks.

trik upgrade [trik] trik up [trik] # alias

Options:

  • -f, --force - Force reinstall even if up to date

Examples:

# Upgrade specific trik trik upgrade @molefas/article-search # Upgrade all triks trik upgrade # Force reinstall trik upgrade --force

trik sync

Discover triks installed via npm/pip and add them to config.

trik sync

Options:

  • -n, --dry-run - Show what would be synced
  • -j, --json - Output as JSON

When to use:

If you install a trik package directly via npm or pip:

npm install @trikhub/article-search trik sync

Authentication

trik login

Authenticate with GitHub for publishing.

trik login

Opens a browser for GitHub OAuth. Tokens are stored securely.

trik logout

Remove saved authentication.

trik logout

trik whoami

Show current authenticated user.

trik whoami

Publishing

trik publish

Publish a trik to the registry.

trik publish

Options:

  • -d, --directory <path> - Trik directory (default: current dir)
  • -t, --tag <version> - Version tag (default: from manifest)

Requirements:

  • Must be logged in (trik login)
  • Must have a valid manifest.json
  • Must have a GitHub repository

Example:

cd my-trik trik publish # Or from another directory trik publish -d ./triks/my-trik

Config File

The CLI manages .trikhub/config.json:

{ "triks": [ "@molefas/article-search", "@acme/weather" ] }

This file is read by the gateway to load triks at runtime.


Global Options

Available on all commands:

  • --dev - Use development registry (localhost:3001)
  • --version - Show CLI version
  • --help - Show help

Next: Learn about SDK Integration to use triks in your code.