Skill: CLI

The Mimic CLI (@mimicprotocol/cli) is the main tool for scaffolding, building, and deploying functions. You use it via npx without a global install, or as a local dev dependency invoked through yarn mimic.


Installation

No global install required. Run any command directly with npx:

npx @mimicprotocol/cli <command>

Or add it as a local dev dependency and invoke it through yarn scripts:

yarn add -D @mimicprotocol/cli
yarn mimic <command>

Commands

init — Scaffold a new project

Creates a minimal project structure with a manifest file, a starter function, and all dependencies.

npx @mimicprotocol/cli init [directory] [--force]
Option
Description
Default

directory

Where to initialize the project

./

--force, -f

Overwrite existing files (asks for confirmation)

false

Examples

Output structure

After scaffolding, the CLI automatically runs yarn install and yarn codegen.


codegen — Generate types from the manifest

Reads manifest.yaml and generates typed AssemblyScript interfaces for declared inputs and ABIs into src/types/.

Option
Description
Default

--manifest, -m

Path to manifest file

manifest.yaml

--output, -o

Output directory for generated types

./src/types

--clean, -c

Delete existing types before regenerating (asks confirmation)

false

Examples

Output

  • src/types/index.ts — Input parameter types

  • src/types/<ContractName>.ts — One file per ABI, with read/write methods and event decoders

circle-info

Run codegen every time you change manifest.yaml. Generated files are meant to be committed — do not edit them manually.


compile — Build to WebAssembly

Validates the manifest and compiles your AssemblyScript function into a WASM binary.

Option
Description
Default

--function, -f

Path to entry file

src/function.ts

--manifest, -m

Path to manifest file

manifest.yaml

--output, -o

Output directory

build

Examples

Output


login — Save your API key locally

Stores credentials in ~/.mimic/credentials so you don't need to pass --api-key on every deploy.

Option
Description
Default

--profile, -p

Profile name

default

--api-key, -k

API key (skips interactive prompt)

--force-login, -f

Overwrite existing profile without confirmation

false

Examples

circle-info

Retrieve your API key from the Mimic explorerarrow-up-right under account settings. Profile names cannot contain [, ], or =.


logout — Remove stored credentials


profiles — List configured profiles


deploy — Upload to the Mimic Registry

Runs codegen + compile (unless skipped), uploads artifacts to IPFS, and registers the function in the Mimic Registry so relayers can discover it.

Option
Description
Default

--api-key, -k

API key

--profile, -p

Credential profile to use

default

--input, -i

Directory with compiled artifacts

build

--output, -o

Directory to write the CID file

build

--skip-compile

Skip codegen and compile

false

--url, -u

Registry base URL

https://api-protocol.mimic.fi

Examples

Before uploading, the CLI validates that build/ contains both manifest.json and function.wasm.

Output: build/CID.json — the IPFS Content Identifier for your deployed function.


test — Run function tests

Runs codegen + compile, then executes tests/**/*.spec.ts with Mocha.

Option
Description
Default

--directory, -d

Function directory to test

./

--skip-compile

Skip codegen and compile before tests

false


Multi-function projects (mimic.yaml)

For projects with more than one function, create a mimic.yaml at the project root. All commands (codegen, compile, test, deploy) will iterate over every function defined in it.

Filtering

circle-info

mimic.yaml is optional — single-function projects can continue using individual command flags without it.

Last updated