CLI
A command-line interface for bootstrapping, generating types, compiling, and deploying tasks using Mimic Protocol’s workflow.
1. Initialize
Initializes a new Mimic-compatible project structure in the current directory. This command will create a minimal folder layout, a manifest file, and example AssemblyScript task.
Usage
$ mimic init [options]
Options
--force
Overwrite existing files if they already exist
false
Examples
# Initialize a fresh project using default settings
$ mimic init
# Force initialization, overwriting existing files
$ mimic init --force
Manifest
This file describes metadata, triggers, inputs, and ABIs for your AssemblyScript task, so the CLI can validate, generate code, compile, and ultimately deploy your task. For example:
version: 1.0.0
name: Balance Monitoring Task
description: Monitors an account's token balance and creates a swap intent if conditions are met.
trigger: cron
inputs:
- chainId: number
- account: address
- tokenIn: address
- tokenOut: address
- slippage: number
- threshold: number
abis:
- ERC20: './abis/IERC20.json'
2. Codegen
Scans your manifest.yaml
and generates typed interfaces for declared inputs and ABIs. This step is typically used to create or update TypeScript/AssemblyScript types for your project so you can safely reference them in your code.
Usage
$ mimic codegen [options]
Options
--manifest <path>
Specify a custom manifest file path
manifest.yaml
--output <dir>
Output directory for generated types
types
--clean
Remove existing generated types before generating new files
false
Examples
# Generate types in the default "types" directory
$ mimic codegen
# Generate types from a custom manifest, output to a "generated" folder
$ mimic codegen --manifest ./custom-manifest.yaml --output generated
3. Compile
Compiles your AssemblyScript task into a Wasm binary, along with validating your manifest and producing any required runtime artifacts (like inputs.json
). This step ensures you have a complete, ready-to-deploy package of your task logic and metadata.
Usage
$ mimic compile [options]
Options
--task <path>
Path to the AssemblyScript entry file
src/task.ts
--manifest <path>
Path to the manifest file to validate
manifest.yaml
--output <directory>
Output directory for compiled artifacts
build
Examples
# Compile using the default task and manifest
$ mimic compile
# Compile a specific file, output to a custom directory
$ mimic compile --task ./tasks/myTask.ts --output ./out
Outputs
After a successful compile, you should see:
task.wasm
– The compiled WebAssembly binary.manifest.json
– A validated version of your manifest.inputs.json
– A list of environment or external dependencies.
4. Deploy
Uploads your compiled task artifacts to IPFS and registers it into the Mimic Registry so others can discover it. This step pins the result under a CID so relayers can discover and execute it.
Usage
$ mimic deploy [options]
Options
--key <deploymentKey>
Your account deployment key
(no default)
--input <directory>
Directory containing the compiled artifacts
build
--output <directory>
Output directory for deployment CID
build
Examples
# Deploy from the default build directory, using your pre-configured key
$ mimic deploy --key my-key
# Deploy from a custom folder
$ mimic deploy --input ./dist --key my-key
# Specify a different output path
$ mimic deploy --input ./dist --key my-key --output ./dist
Outputs
After a successful deployment, you should see:
CID
– The CID where the task was published.
5. Link
Associates a previously deployed task, identified by its CID, with a specific project under your account. This step lets your project reference and manage the deployed task, making it discoverable to your relayers or team.
Usage
$ mimic link [options]
Options
--project <projectKey>
The key to identify the project you want to link this task to
(no default)
--key <deploymentKey>
Your deployment key, used to authenticate the linking operation
(no default)
--task <CID>
The CID where your task artifacts were published
build/CID
Examples
# Links an existing task to a specific project
mimic link --project your-project-key --key your-key
# Specify a different CID instead of the default path
mimic link --task MY_CID --project your-project-key --key your-key
Last updated