CLI Reference

Complete reference for the trik command-line interface.

Installation

npm install -g @trikhub/cli

Synopsis

trik <command> [options]

Global Options

OptionDescription
--devUse development registry (localhost:3001)
--versionShow version number
--helpShow help

Commands

init

Initialize a new trik project with scaffold files.

trik init <language>

Arguments:

ArgumentDescription
languageProject language: ts (TypeScript) or py (Python)

Examples:

trik init ts # Scaffold a TypeScript trik trik init py # Scaffold a Python trik

Generates a complete project structure including manifest.json, entry point file, system prompt, tsconfig.json, and a .gitignore.


install

Install a trik. Resolves from the TrikHub registry first, then falls back to npm, and supports git URLs.

trik install <trik> [options] trik i <trik> [options]

Arguments:

ArgumentDescription
trikTrik identifier (e.g., @molefas/article-search)

Options:

OptionDescription
-v, --version <version>Install specific version

Examples:

trik install @molefas/article-search trik i @molefas/article-search -v 2.0.0

uninstall

Remove an installed trik.

trik uninstall <trik> trik rm <trik> trik remove <trik>

Arguments:

ArgumentDescription
trikTrik identifier to remove

Examples:

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

list

List installed triks.

trik list [options] trik ls [options]

Options:

OptionDescription
-j, --jsonOutput as JSON
-r, --runtime <runtime>Filter by runtime: node or python

Examples:

trik list trik ls --json trik list --runtime python

Search the registry for triks.

trik search <query> [options] trik s <query> [options]

Arguments:

ArgumentDescription
querySearch query

Options:

OptionDescription
-j, --jsonOutput as JSON
-l, --limit <number>Limit results (default: 10)
-r, --runtime <runtime>Filter by runtime: node or python

Examples:

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

info

Show detailed information about a trik, including its mode, domain tags, and tools.

trik info <trik> [options]

Arguments:

ArgumentDescription
trikTrik identifier

Options:

OptionDescription
-j, --jsonOutput as JSON

Examples:

trik info @molefas/article-search trik info @molefas/article-search --json

upgrade

Upgrade installed triks.

trik upgrade [trik] [options] trik up [trik] [options]

Arguments:

ArgumentDescription
trikOptional trik identifier (upgrades all if omitted)

Options:

OptionDescription
-f, --forceForce reinstall even if up to date

Examples:

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

sync

Discover triks installed via npm in node_modules and add them to the config.

trik sync [options]

Options:

OptionDescription
-n, --dry-runShow what would be synced
-j, --jsonOutput as JSON

Examples:

trik sync trik sync --dry-run

lint

Validate a trik for security and correctness. Checks manifest structure, semantic rules (mode consistency, TDPS constraints, log template matching), performs capability scanning with security tier classification, and cross-checks detected capabilities against manifest declarations. Undeclared capabilities are reported as errors.

trik lint <path> [options]

Arguments:

ArgumentDescription
pathPath to the trik directory

Options:

OptionDescription
--warnings-as-errorsTreat warnings as errors
--skip <rule>Skip a specific rule (can be repeated)

Examples:

trik lint . trik lint ./my-trik --warnings-as-errors trik lint . --skip manifest-completeness

login

Authenticate with GitHub.

trik login

Opens a browser for GitHub OAuth authentication. Tokens are stored in ~/.trikhub/config.json.


logout

Remove saved authentication.

trik logout

whoami

Show current authenticated user.

trik whoami

publish

Publish a trik to the registry. Requires authentication via trik login. Runs the full scanner cross-check before publishing: if your code uses capabilities (filesystem, process, storage, trikManagement) that are not declared in the manifest, publishing is blocked. Dynamic code execution patterns always block publishing.

trik publish [options]

Options:

OptionDescription
-d, --directory <path>Trik directory (default: .)
-t, --tag <version>Version tag (default: from manifest)

Examples:

trik publish trik publish -d ./my-trik trik publish -t 1.0.1

unpublish

Permanently remove a trik from the registry. Requires authentication and ownership.

trik unpublish <trik>

Arguments:

ArgumentDescription
trikTrik identifier to unpublish

Examples:

trik unpublish @molefas/article-search

mcp

Start the TrikHub MCP server for AI-assisted trik development. Run without flags to see setup instructions for Claude Code and VS Code.

trik mcp [options]

Options:

OptionDescription
--stdioRun in stdio mode for MCP clients

Examples:

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

Claude Code setup:

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

Config File

The CLI manages .trikhub/config.json in your project directory:

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

The triks array contains the package names of installed triks (strings, not objects). The CLI resolves these to actual trik directories via node_modules or .trikhub/triks/.


Token Storage

Authentication tokens are stored in ~/.trikhub/config.json in the user’s home directory (not in the system keychain).


Environment Variables

VariableDescription
NODE_ENVSet to development for dev registry
TRIKHUB_REGISTRYCustom registry URL

Exit Codes

CodeDescription
0Success
1Error