CLI Commands

The trik CLI helps you discover, install, manage, and develop 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 TrikHub 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. Checks the TrikHub registry for the trik
  2. Verifies the git tag’s commit SHA matches the registry record (security check)
  1. For same-language triks (JS trik in JS project): adds a git URL to package.json and runs your package manager’s install
  2. For cross-language triks (e.g. Python trik in JS project): downloads to .trikhub/triks/<trik>/
  3. If not found on TrikHub: falls back to npm for third-party packages
  1. Registers the trik in .trikhub/config.json
  2. If the trik declares config.required, shows the required configuration keys and how to set them up in secrets.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
  • -r, --runtime <runtime> - Filter by runtime (node or python)

Example:

trik list --runtime python

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)
  • -r, --runtime <runtime> - Filter by runtime (node or python)

Example:

trik search article trik search weather -l 5 trik search weather --runtime node

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 Searches for articles on a given topic. Agent Info Mode: conversational Domain: content curation, article discovery Tools: search, details, list Security Tier: B (Network) Stats Latest version: 2.0.0 Downloads: 1.2K Stars: 42

trik init

Scaffold a new trik project with boilerplate code.

trik init <language>

Arguments:

  • <language> - ts (TypeScript) or py (Python)

Examples:

trik init ts # TypeScript project trik init py # Python project

This launches an interactive wizard that asks for:

  • Trik name, display name, description
  • Author name and GitHub username
  • Category
  • Agent mode (conversational or tool)
  • Handoff description (for conversational mode)
  • Tool names (for tool mode)
  • Domain tags
  • Storage and config preferences

The wizard generates a complete project with manifest, source files, and build configuration.


trik lint

Validate a trik’s manifest and source files for security and correctness.

trik lint <path>

Options:

  • --warnings-as-errors - Treat warnings as errors
  • --skip <rule> - Skip a specific rule (can be used multiple times)

Example:

trik lint . trik lint ./my-trik --warnings-as-errors

Rules checked:

  • valid-manifest — Manifest must be valid JSON and match the schema
  • manifest-completeness — Check for recommended manifest fields
  • entry-point-exists — Entry point in manifest must exist
  • tdps-agent-safe-output — outputSchema strings must use constrained types
  • tdps-constrained-log — logSchema strings must have at least one constraint
  • tdps-log-template — logTemplate placeholders must match logSchema fields
  • tdps-output-template — outputTemplate placeholders must match outputSchema fields

Security tier: The linter scans all source files and classifies the trik into a security tier (A through D) based on detected capabilities such as network access, filesystem usage, or process execution. The tier is informational and does not block publishing.


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 and add them to config.

trik sync

Options:

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

trik mcp

Start or configure the TrikHub MCP server for AI-assisted trik development.

trik mcp # Show configuration instructions trik mcp --stdio # Start MCP server in stdio mode

Setup for Claude Code:

Add this to your MCP settings:

{ "mcpServers": { "trikhub": { "command": "npx", "args": ["-y", "@trikhub/mcp"] } } }

The MCP server provides tools for:

  • analyze_trik_requirements — Understand what to build
  • design_tool — Design tool schemas with log templates
  • design_log_schema — Create constrained log schemas
  • scaffold_trik — Generate complete project
  • validate_manifest — Check manifest for errors
  • diagnose_error — Explain and fix errors

Authentication

trik login

Authenticate with GitHub for publishing.

trik login

Opens a browser for GitHub device authorization. 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

trik unpublish

Permanently remove a trik from the TrikHub registry.

trik unpublish <trik>

Example:

trik unpublish @molefas/old-trik

This requires confirmation — you must type the full trik name to confirm. This action deletes the trik and all its versions permanently.


Config File

The CLI manages .trikhub/config.json:

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

This file is read by the gateway at runtime to load triks. The triks array is a flat list of package names — the gateway resolves them from node_modules or .trikhub/triks/.


Global Options

Available on all commands:

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

Next: Learn about the Gateway API to use triks in your code.