midnight-environment-setup

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Skill: Midnight Environment Setup

技能:Midnight开发环境搭建

Goal

目标

Automatically prepare a complete Midnight development environment for the user.
This skill should always be executed before attempting to build, compile, or deploy any Midnight application if the required tooling is not already installed.

为用户自动准备完整的Midnight开发环境。
如果所需工具尚未安装,在尝试构建、编译或部署任何Midnight应用前,必须先执行本技能。

Responsibilities

职责

The AI assistant should attempt to perform every installation step automatically.
Only if a step cannot be completed because of permission limitations, operating system restrictions, missing GUI access, or unavailable terminal access should the assistant ask the user to complete that specific step manually.
Never immediately paste installation documentation.

AI助手应尝试自动执行所有安装步骤。
仅当因权限限制、操作系统约束、缺少GUI访问权限或无法访问终端而无法完成某一步骤时,才应请求用户手动完成该特定步骤。
切勿直接粘贴安装文档。

Step 1 — Detect Environment

步骤1 — 检测环境

Determine:
  • Operating System
  • Shell (bash/zsh)
  • Docker availability
  • VS Code availability
  • Compact installation
  • Current PATH
  • Existing compiler version
Commands that may be useful:
bash
uname -a
which compact
compact --version
compact compile --version
docker --version
code --version
echo $SHELL

确定:
  • 操作系统
  • Shell(bash/zsh)
  • Docker可用性
  • VS Code可用性
  • Compact安装情况
  • 当前PATH配置
  • 现有编译器版本
可能有用的命令:
bash
uname -a
which compact
compact --version
compact compile --version
docker --version
code --version
echo $SHELL

Step 2 — Install Compact

步骤2 — 安装Compact

If Compact is not installed:
bash
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/midnightntwrk/compact/releases/latest/download/compact-installer.sh | sh
Wait until installation finishes.

如果未安装Compact:
bash
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/midnightntwrk/compact/releases/latest/download/compact-installer.sh | sh
等待安装完成。

Step 3 — Refresh PATH

步骤3 — 刷新PATH

Determine shell.
If zsh:
bash
source ~/.zshrc
If bash:
bash
source ~/.bashrc
If Compact still cannot be found, append:
bash
export PATH="$HOME/.compact/bin:$PATH"
Reload shell again.

确定当前Shell类型。
如果是zsh:
bash
source ~/.zshrc
如果是bash:
bash
source ~/.bashrc
如果仍无法找到Compact,添加以下配置:
bash
export PATH="$HOME/.compact/bin:$PATH"
重新加载Shell。

Step 4 — Update Compiler

步骤4 — 更新编译器

Always install the latest compiler.
bash
compact update

始终安装最新版本的编译器。
bash
compact update

Step 5 — Verify Installation

步骤5 — 验证安装

Run
bash
compact --version

compact compile --version

which compact
Installation is considered successful only if all commands execute without errors.

运行以下命令:
bash
compact --version

compact compile --version

which compact
只有当所有命令都能无错误执行时,才视为安装成功。

Step 6 — Docker

步骤6 — Docker配置

Check Docker availability.
If Docker is unavailable:
Explain that Docker Desktop must be installed manually.
Pause until Docker is running.

检查Docker是否可用。
如果Docker不可用:
说明必须手动安装Docker Desktop。
等待Docker启动后再继续。

Step 7 — Start Proof Server

步骤7 — 启动证明服务器

Run
bash
docker run -p 6300:6300 midnightntwrk/proof-server:latest midnight-proof-server -v
Verify logs indicate:
Listening on http://localhost:6300
If port 6300 is occupied, retry using:
bash
docker run -p 6301:6300 midnightntwrk/proof-server:latest midnight-proof-server -v
Inform the user that applications must now use port 6301.

运行以下命令:
bash
docker run -p 6300:6300 midnightntwrk/proof-server:latest midnight-proof-server -v
验证日志是否显示:
Listening on http://localhost:6300
如果端口6300已被占用,使用以下命令重试:
bash
docker run -p 6301:6300 midnightntwrk/proof-server:latest midnight-proof-server -v
告知用户应用程序现在必须使用端口6301。

Step 8 — VS Code Extension

步骤8 — VS Code扩展

If VS Code exists:
Guide the user to install the Compact VS Code extension (VSIX package).
AI agents cannot reliably install VS Code extensions through GUI interactions unless the environment explicitly supports it.
Provide concise instructions:
  1. Download the Compact VSIX package.
  2. Open VS Code.
  3. Extensions.
  4. Install from VSIX.
  5. Select the downloaded file.

如果已安装VS Code:
指导用户安装Compact VS Code扩展(VSIX包)。
除非环境明确支持,否则AI代理无法通过GUI交互可靠地安装VS Code扩展。
提供简明说明:
  1. 下载Compact VSIX包。
  2. 打开VS Code。
  3. 进入扩展面板。
  4. 选择“从VSIX安装”。
  5. 选择下载的文件。

Final Verification Checklist

最终验证清单

Confirm:
  • Compact installed
  • Latest compiler installed
  • PATH configured
  • Docker running
  • Proof Server running
  • VS Code extension installed (or user informed)

确认:
  • Compact已安装
  • 已安装最新版本的编译器
  • PATH已配置完成
  • Docker正在运行
  • 证明服务器正在运行
  • VS Code扩展已安装(或已告知用户)

Troubleshooting

故障排除

compact: command not found

compact: command not found

Reload shell.
If needed:
bash
export PATH="$HOME/.compact/bin:$PATH"
source ~/.zshrc
or
bash
source ~/.bashrc

重新加载Shell。
如果需要:
bash
export PATH="$HOME/.compact/bin:$PATH"
source ~/.zshrc
bash
source ~/.bashrc

Docker not running

Docker未运行

Ask the user to launch Docker Desktop and wait until the engine is fully started.

请求用户启动Docker Desktop,并等待引擎完全启动。

Port 6300 already in use

端口6300已被占用

Use:
bash
docker run -p 6301:6300 midnightntwrk/proof-server:latest midnight-proof-server -v
and configure applications to use:
http://localhost:6301

使用以下命令:
bash
docker run -p 6301:6300 midnightntwrk/proof-server:latest midnight-proof-server -v
并配置应用程序使用:
http://localhost:6301

Agent Behavior

代理行为

Always prefer automation over explanation.
Only request manual intervention when automation is impossible due to permission, GUI, or operating system limitations.
After every automated action, verify success before proceeding.
Never assume a command succeeded without checking its output.
The goal is to leave the user with a fully working Midnight development environment ready to build, compile, and deploy DApps.
Author: Kali-Decoder
始终优先选择自动化而非解释说明。
仅当因权限、GUI或操作系统限制导致自动化无法实现时,才请求手动干预。
每次执行自动操作后,在继续下一步前验证操作是否成功。
切勿在未检查输出的情况下假设命令执行成功。
目标是为用户提供一个可立即用于构建、编译和部署DApp的完整可用Midnight开发环境。
作者: Kali-Decoder