Crunch Protocol CLI Skill
Translates natural language queries into crunch-cli commands. Supports profiles and output formatting for Slack, Telegram, Discord, or plain text.
Prerequisites
- - Node.js 18+ with INLINECODE1
- Solana wallet keypair (for on-chain operations)
Package Installation
This skill installs packages via npm (global):
| Package | Source | Purpose |
|---|
| INLINECODE2 | npm | CrunchDAO protocol CLI (coordinators, competitions, staking) |
Agent rules for package installation:
- - Only install
@crunchdao/crunch-cli from the official npm registry - No custom registry URLs — no
--registry overrides - Ask the user before installing if not already present
Credentials
Solana Wallet Keypair (required for on-chain operations)
- - What it is: A JSON file containing a Solana private key, used to sign transactions
- How it's configured: Set via
crunch-cli config set wallet /path/to/wallet.json or -w flag per command - Stored in: User-managed file on disk; path referenced in INLINECODE7
Agent rules for wallets:
- - Never create or generate wallet keypairs unless the user explicitly asks and understands the security implications
- Never read or display the contents of wallet keypair files
- Never commit wallet files to git — always verify
.gitignore covers them - Ask the user for the wallet path — never assume or search for keypair files
Profile Config (~/.crunch/config.json)
- - Stores network, wallet path, and RPC URL per profile
- Managed via
crunch-cli config commands — no need to edit manually - Never modify or delete existing profiles unless explicitly asked
Setup
CODEBLOCK0
Profiles
The CLI has built-in profile management via ~/.crunch/config.json:
CODEBLOCK1
Global flags can override config per-command:
| Flag | Description |
|---|
| INLINECODE12 | Solana network: mainnet-beta, devnet, INLINECODE15 |
| INLINECODE16 |
Custom RPC URL |
|
-w, --wallet | Path to Solana keypair |
|
-o, --output | Output format:
json,
table,
yaml |
Direct Phrase Mapping
| User Phrase | CLI Command |
|---|
| INLINECODE22 | INLINECODE23 |
| INLINECODE24 |
crunch-cli crunch list |
|
get/show coordinator [address] |
crunch-cli coordinator get [address] |
|
list coordinators |
crunch-cli coordinator list |
|
get config |
crunch-cli coordinator get-config |
|
checkpoint for <name> |
crunch-cli crunch checkpoint-get-current "<name>" |
|
create checkpoint <name> |
crunch-cli crunch checkpoint-create "<name>" prizes.json |
|
deposit reward <name> <amount> |
crunch-cli crunch deposit-reward "<name>" <amount> |
|
drain <name> |
crunch-cli crunch drain "<name>" |
|
create/register cruncher |
crunch-cli cruncher create |
|
register for <name> |
crunch-cli cruncher register "<name>" |
|
claim rewards <name> |
crunch-cli cruncher claim "<name>" |
|
show staking positions |
crunch-cli staking positions |
|
stake/deposit <amount> |
crunch-cli staking deposit <amount> |
|
delegate to <coordinator> |
crunch-cli staking delegate "<coordinator>" <amount> |
|
show staking rewards |
crunch-cli staking rewards |
|
claim staking rewards |
crunch-cli staking claim |
|
undelegate from <coordinator> |
crunch-cli staking undelegate "<coordinator>" <amount> |
|
withdraw stake <amount> |
crunch-cli staking withdraw <amount> |
|
init workspace <name> |
crunch-cli init-workspace "<name>" |
|
list scenarios/simulations |
crunch-cli model list |
|
run simulation <scenario> |
crunch-cli model run "<scenario>" |
|
register coordinator <name> |
crunch-cli coordinator register "<name>" |
|
create crunch <name> |
crunch-cli crunch create "<name>" <amount> [maxModels] |
|
start/end crunch <name> |
crunch-cli crunch start/end "<name>" |
Execution Pattern
- 1. Parse — Identify action, target, name/identifier, parameters
- Resolve profile — If mentioned, switch profile or use flags
- Map — Use phrase mapping table
- Execute — Run command
- Format — Output for requested medium (Slack/Telegram/Discord/plain)
Output Formatting
Detect medium from user request ("for slack", "telegram format", etc.):
- - Slack:
*bold*, • bullets, ━ separators - Telegram:
<b>bold</b>, emoji prefixes - Discord:
## headers, INLINECODE77 - Plain: Simple key: value pairs
Error Handling
If command fails, suggest fixes:
- - Wrong network? Add
-n mainnet-beta or INLINECODE79 - Missing wallet? Add INLINECODE80
- Not found? List available with INLINECODE81
Coordinator Node Setup
Scaffold a new competition workspace:
CODEBLOCK2
This generates a full node workspace. See the coordinator-node-starter skill for customization.
Reference
For full CLI documentation: references/cli-reference.md
Crunch Protocol CLI 技能
将自然语言查询转换为 crunch-cli 命令。支持 Slack、Telegram、Discord 或纯文本格式的配置文件和输出格式化。
前置条件
- - Node.js 18+ 及 npm
- Solana 钱包密钥对(用于链上操作)
包安装
本技能通过 npm(全局)安装包:
| 包 | 来源 | 用途 |
|---|
| @crunchdao/crunch-cli | npm | CrunchDAO 协议 CLI(协调者、竞赛、质押) |
代理包安装规则:
- - 仅安装 @crunchdao/crunch-cli 来自官方 npm 注册表
- 无自定义注册表 URL — 不使用 --registry 覆盖
- 安装前询问用户(如果尚未安装)
凭据
Solana 钱包密钥对(链上操作必需)
- - 是什么: 包含 Solana 私钥的 JSON 文件,用于签署交易
- 配置方式: 通过 crunch-cli config set wallet /path/to/wallet.json 或每条命令的 -w 标志设置
- 存储位置: 用户管理的磁盘文件;路径在 ~/.crunch/config.json 中引用
代理钱包规则:
- - 绝不创建或生成钱包密钥对,除非用户明确要求并理解安全影响
- 绝不读取或显示 钱包密钥对文件的内容
- 绝不将钱包文件提交到 git — 始终验证 .gitignore 包含它们
- 向用户询问 钱包路径 — 绝不假设或搜索密钥对文件
配置文件 (~/.crunch/config.json)
- - 按配置文件存储网络、钱包路径和 RPC URL
- 通过 crunch-cli config 命令管理 — 无需手动编辑
- 绝不修改或删除现有配置文件,除非明确要求
设置
bash
npm install -g @crunchdao/crunch-cli
crunch-cli --version
配置文件
CLI 通过 ~/.crunch/config.json 内置配置文件管理:
bash
crunch-cli config show # 显示当前配置
crunch-cli config active # 显示解析后的活动值
crunch-cli config list-profiles # 列出可用配置文件
crunch-cli config save-profile # 将当前配置保存为配置文件
crunch-cli config use # 切换配置文件
crunch-cli config set # 设置配置值
全局标志可覆盖每条命令的配置:
| 标志 | 描述 |
|---|
| -n, --network | Solana 网络:mainnet-beta、devnet、localhost |
| -u, --url |
自定义 RPC URL |
| -w, --wallet | Solana 密钥对路径 |
| -o, --output | 输出格式:json、table、yaml |
直接短语映射
| 用户短语 | CLI 命令 |
|---|
| 获取/显示 crunch <名称> | crunch-cli crunch get <名称> |
| 列出 crunches |
crunch-cli crunch list |
| 获取/显示协调者 [地址] | crunch-cli coordinator get [地址] |
| 列出协调者 | crunch-cli coordinator list |
| 获取配置 | crunch-cli coordinator get-config |
| <名称> 的检查点 | crunch-cli crunch checkpoint-get-current <名称> |
| 创建检查点 <名称> | crunch-cli crunch checkpoint-create <名称> prizes.json |
| 存入奖励 <名称> <数量> | crunch-cli crunch deposit-reward <名称> <数量> |
| 清空 <名称> | crunch-cli crunch drain <名称> |
| 创建/注册 cruncher | crunch-cli cruncher create |
| 注册 <名称> | crunch-cli cruncher register <名称> |
| 领取奖励 <名称> | crunch-cli cruncher claim <名称> |
| 显示质押仓位 | crunch-cli staking positions |
| 质押/存入 <数量> | crunch-cli staking deposit <数量> |
| 委托给 <协调者> | crunch-cli staking delegate <协调者> <数量> |
| 显示质押奖励 | crunch-cli staking rewards |
| 领取质押奖励 | crunch-cli staking claim |
| 取消委托 <协调者> | crunch-cli staking undelegate <协调者> <数量> |
| 提取质押 <数量> | crunch-cli staking withdraw <数量> |
| 初始化工作区 <名称> | crunch-cli init-workspace <名称> |
| 列出场景/模拟 | crunch-cli model list |
| 运行模拟 <场景> | crunch-cli model run <场景> |
| 注册协调者 <名称> | crunch-cli coordinator register <名称> |
| 创建 crunch <名称> | crunch-cli crunch create <名称> <数量> [maxModels] |
| 开始/结束 crunch <名称> | crunch-cli crunch start/end <名称> |
执行模式
- 1. 解析 — 识别操作、目标、名称/标识符、参数
- 解析配置文件 — 如果提到,切换配置文件或使用标志
- 映射 — 使用短语映射表
- 执行 — 运行命令
- 格式化 — 按请求的媒介输出(Slack/Telegram/Discord/纯文本)
输出格式化
从用户请求中检测媒介(for slack、telegram format 等):
- - Slack: 粗体、• 项目符号、━ 分隔符
- Telegram: 粗体、表情符号前缀
- Discord: ## 标题、粗体
- 纯文本: 简单的键:值对
错误处理
如果命令失败,建议修复方法:
- - 网络错误?添加 -n mainnet-beta 或 -n devnet
- 缺少钱包?添加 -w /path/to/wallet.json
- 未找到?使用 crunch-cli crunch list 列出可用项
协调者节点设置
搭建新的竞赛工作区:
bash
crunch-cli init-workspace my-challenge
这将生成一个完整的节点工作区。有关自定义,请参阅协调者节点启动技能。
参考
完整 CLI 文档:references/cli-reference.md