CLI Reference¶
This page documents all available commands in the kp CLI (KnitPkg Command Line Interface), grouped by category.
To see a quick overview of all commands, run:
All commands support the global option:
| Flag | Description |
|---|---|
--verbose |
Show detailed output |
Core Workflow Commands¶
kp init¶
Initializes a new KnitPkg project interactively or via flags. User is prompted for the not provided options .
Usage:
Options:
| Flag | Description | Default |
|---|---|---|
--dry-run, -d |
Show what would be done without making changes | False |
--type |
Project type (package, expert, indicator, library, service) |
Prompt |
--target, -t |
MetaTrader platform (mql4 or mql5) |
Prompt |
--name, -n |
Project name (alphanumeric, hyphen, underscore, dot) | Prompt |
--organization, -o |
Organization name | Prompt |
--version, -v |
Initial version (SemVer) | Prompt |
--description |
Short description | Prompt |
--author |
Author name | Prompt |
--license |
License identifier (e.g., MIT) | Prompt |
--include-mode |
include or flat |
Prompt |
--entrypoints |
Comma-separated list of entrypoints (required for flat mode) | Prompt |
--location, -l |
Output directory | Prompt |
--git-init |
Initialize Git repository | Prompt |
--enable-telemetry / --disable-telemetry |
Enable or disable telemetry | Prompt |
Example:
kp add¶
Adds a dependency to the current project.
Usage:
Options:
| Flag | Description | Default |
|---|---|---|
--verspec, -v |
Version specifier | * |
--project-dir, -d |
Project directory | . |
Example:
kp install¶
Resolves and installs all dependencies. Applicable for all project types except package.
Usage:
Options:
| Flag | Description | Default |
|---|---|---|
--project-dir, -d |
Project directory | . |
--locked |
Enforce lockfile consistency; not allowed with local dependencies | False |
--no-tree |
Skip dependency tree display | False |
Example:
kp compile¶
Compiles all the MQL source files declared in entrypoints and compile entries in manifest. MetaEditor standard compiler is used by command line. By default, the binaries .ex5 and .ex4 are moved to bin/ directory if compile is successful.
Usage:
Options:
| Flag | Description | Default |
|---|---|---|
--project-dir, -d |
Project directory | . |
--in-place |
Keep binaries in place | False |
--entrypoints-only |
Compile only entrypoints | False |
--compile-only |
Compile only compile list | False |
Example:
kp build¶
Builds the project. For packages, runs checkinstall and compile in sequence. For others, runs install --locked and then compile.
Usage:
Options:
| Flag | Description | Default |
|---|---|---|
--project-dir, -d |
Project directory | . |
--locked / --no-locked |
Enforce lockfile consistency | --locked |
--no-tree |
Skip dependency tree display | False |
--in-place |
Keep binaries in place | False |
--entrypoints-only |
Compile only entrypoints | False |
--compile-only |
Compile only compile list | False |
Example:
Package Development Commands¶
kp autocomplete¶
Generates autocomplete.mqh for MetaEditor IntelliSense and Unit tests compilation.
Usage:
Options:
| Flag | Description | Default |
|---|---|---|
--project-dir, -d |
Project directory | . |
Example:
kp checkinstall¶
Validates all directives and headers. If no errors are found, it means the package is good to be consumed as dependency by others projects.
Usage:
Options:
| Flag | Description | Default |
|---|---|---|
--skip-autocomplete |
Skip autocomplete generation | False |
--project-dir, -d |
Project directory | . |
Example:
Registry Commands¶
kp search¶
Searches the KnitPkg registry.
Usage:
Options:
| Flag | Description | Default |
|---|---|---|
--query, -q |
Search term | None |
--organization, -o |
Filter by organization | None |
--type, -t |
Filter by project type | None |
--author, -a |
Filter by author | None |
--license, -l |
Filter by license | None |
--sort-by, -S |
Sort field | published_at |
--sort-order, -O |
asc or desc |
desc |
--page, -p |
Page number | 1 |
--page-size, -s |
Results per page | 20 |
Example:
kp info¶
Displays metadata for a specific project.
Usage:
Options:
| Flag | Description | Default |
|---|---|---|
--verbose |
Show detailed output | False |
Example:
kp get¶
Downloads and installs a project directly into MetaTrader.
Usage:
Options:
| Flag | Description | Default |
|---|---|---|
--verspec, -v |
Version specifier | * |
--mql-data-folder, -m |
Path to MQL data folder | Auto-detect |
Example:
kp get mql5 @douglasrechia/sma ^1.0.0 --mql-data-folder ~/AppData/Roaming/MetaQuotes/Terminal/ABC123/MQL5
kp register¶
Publishes the current project to the registry.
Usage:
Options:
| Flag | Description | Default |
|---|---|---|
--project-dir, -d |
Project directory | . |
Example:
kp yank¶
Yanks a specific version from the registry.
Usage:
Options:
| Flag | Description | Default |
|---|---|---|
--verbose |
Show detailed output | False |
Example:
kp status¶
Shows registry and authentication status along with supported Git providers.
Usage:
Options:
| Flag | Description | Default |
|---|---|---|
--verbose |
Show detailed output | False |
kp login¶
Authenticates with the registry via OAuth. Run kp status to see the list of available providers.
Usage:
Options:
| Flag | Description | Default |
|---|---|---|
--provider |
OAuth provider (e.g., github). | Required |
--verbose |
Show detailed output | False |
kp logout¶
Logs out from the registry.
Usage:
Options:
| Flag | Description | Default |
|---|---|---|
--verbose |
Show detailed output | False |
kp whoami¶
Displays the currently authenticated user.
Usage:
Options:
| Flag | Description | Default |
|---|---|---|
--verbose |
Show detailed output | False |
Configuration Commands¶
kp config¶
Sets project-specific configuration.
Usage:
Options:
| Flag | Description | Default |
|---|---|---|
--project-dir, -d |
Project directory | . |
--mql5-compiler-path |
Path to MetaEditor64.exe | None |
--mql4-compiler-path |
Path to MetaEditor.exe | None |
--mql5-data-folder-path |
MQL5 data folder path | None |
--mql4-data-folder-path |
MQL4 data folder path | None |
--list, -l |
List current config | False |
kp globalconfig¶
Sets global CLI options.
Usage:
Options:
| Flag | Description | Default |
|---|---|---|
--mql5-compiler-path |
Path to MetaEditor64.exe | None |
--mql4-compiler-path |
Path to MetaEditor.exe | None |
--mql5-data-folder-path |
MQL5 data folder path | None |
--mql4-data-folder-path |
MQL4 data folder path | None |
--set-registry |
Set default registry URL | None |
kp telemetry¶
Enables or disables telemetry.
Usage:
Arguments:
| Name | Description |
|---|---|
state |
on or off |
Options:
| Flag | Description | Default |
|---|---|---|
--global / --local |
Scope of telemetry setting | global |
--project-dir, -d |
Project directory | . |
Example:
Note
Telemetry is opt-in and collects anonymized usage data to improve KnitPkg. See Telemetry Policy.