CLI Reference
Complete reference for the trik command-line interface.
Installation
npm install -g @trikhub/cliSynopsis
trik <command> [options]Global Options
| Option | Description |
|---|---|
--dev | Use development registry (localhost:3001) |
--version | Show version number |
--help | Show help |
Commands
init
Initialize a new trik project with scaffold files.
trik init <language>Arguments:
| Argument | Description |
|---|---|
language | Project language: ts (TypeScript) or py (Python) |
Examples:
trik init ts # Scaffold a TypeScript trik
trik init py # Scaffold a Python trikGenerates 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:
| Argument | Description |
|---|---|
trik | Trik identifier (e.g., @molefas/article-search) |
Options:
| Option | Description |
|---|---|
-v, --version <version> | Install specific version |
Examples:
trik install @molefas/article-search
trik i @molefas/article-search -v 2.0.0uninstall
Remove an installed trik.
trik uninstall <trik>
trik rm <trik>
trik remove <trik>Arguments:
| Argument | Description |
|---|---|
trik | Trik identifier to remove |
Examples:
trik uninstall @molefas/article-search
trik rm @acme/weatherlist
List installed triks.
trik list [options]
trik ls [options]Options:
| Option | Description |
|---|---|
-j, --json | Output as JSON |
-r, --runtime <runtime> | Filter by runtime: node or python |
Examples:
trik list
trik ls --json
trik list --runtime pythonsearch
Search the registry for triks.
trik search <query> [options]
trik s <query> [options]Arguments:
| Argument | Description |
|---|---|
query | Search query |
Options:
| Option | Description |
|---|---|
-j, --json | Output 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 nodeinfo
Show detailed information about a trik, including its mode, domain tags, and tools.
trik info <trik> [options]Arguments:
| Argument | Description |
|---|---|
trik | Trik identifier |
Options:
| Option | Description |
|---|---|
-j, --json | Output as JSON |
Examples:
trik info @molefas/article-search
trik info @molefas/article-search --jsonupgrade
Upgrade installed triks.
trik upgrade [trik] [options]
trik up [trik] [options]Arguments:
| Argument | Description |
|---|---|
trik | Optional trik identifier (upgrades all if omitted) |
Options:
| Option | Description |
|---|---|
-f, --force | Force reinstall even if up to date |
Examples:
trik upgrade # Upgrade all
trik upgrade @molefas/article-search # Upgrade specific
trik up --force # Force reinstall allsync
Discover triks installed via npm in node_modules and add them to the config.
trik sync [options]Options:
| Option | Description |
|---|---|
-n, --dry-run | Show what would be synced |
-j, --json | Output as JSON |
Examples:
trik sync
trik sync --dry-runlint
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:
| Argument | Description |
|---|---|
path | Path to the trik directory |
Options:
| Option | Description |
|---|---|
--warnings-as-errors | Treat 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-completenesslogin
Authenticate with GitHub.
trik loginOpens a browser for GitHub OAuth authentication. Tokens are stored in ~/.trikhub/config.json.
logout
Remove saved authentication.
trik logoutwhoami
Show current authenticated user.
trik whoamipublish
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:
| Option | Description |
|---|---|
-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.1unpublish
Permanently remove a trik from the registry. Requires authentication and ownership.
trik unpublish <trik>Arguments:
| Argument | Description |
|---|---|
trik | Trik identifier to unpublish |
Examples:
trik unpublish @molefas/article-searchmcp
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:
| Option | Description |
|---|---|
--stdio | Run in stdio mode for MCP clients |
Examples:
trik mcp # Show setup instructions
trik mcp --stdio # Start MCP server in stdio modeClaude 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
| Variable | Description |
|---|---|
NODE_ENV | Set to development for dev registry |
TRIKHUB_REGISTRY | Custom registry URL |
Exit Codes
| Code | Description |
|---|---|
| 0 | Success |
| 1 | Error |