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.

When an AI agent helps with Mimic projects, follow these defaults:

  1. Always verify the CLI version first and prefer the latest release.

  2. For new projects, always start with init instead of creating files manually.

1) Always use the latest CLI

Use the latest CLI when running ad-hoc commands:

npx @mimicprotocol/cli@latest <command>

If the project uses a local dev dependency, check and update it before continuing:

yarn mimic --version
npm view @mimicprotocol/cli version
yarn add -D @mimicprotocol/cli@latest

This avoids version drift across workspaces and prevents docs/code mismatches.

2) Start new projects with init

For new function projects, bootstrap with init first, even when working in multi-workspace setups:

npx @mimicprotocol/cli@latest init [directory]

init creates the correct baseline (manifest.yaml, TypeScript setup, starter function, dependencies, and codegen). Manual scaffolding should be the exception, not the default.


Installation

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

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


Commands

init — Scaffold a new project

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

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