iCode Agent · 快速开始

安装 iCode Agent。

一个包,一次安装。iCode Agent 运行在 Node.js 22 或更高版本上,支持 Windows、macOS 和 Linux。

本指南介绍终端智能体。桌面环境请参见 iCode Workbench。

1. 安装

全局安装,然后在任何项目中运行:

npm install -g @icodehq/icode-agent
cd ~/my-project
icode-agent

不想安装?用 npx @icodehq/icode-agent 运行一次。

2. 配置模型

首次启动时,iCode Agent 会先设置模型,再打开工作区。它使用 openai 和 anthropic 协议,因此可搭配官方 API 和任何兼容端点。

  • 选择现有配置或新增一个:协议、端点、模型名称、API 密钥。
  • 必须先通过真实的连接测试,才会保存任何内容。
  • 配置保存在本地 ~/.icode-agent/models.json。

随时使用 /model 或 Ctrl+P 切换模型。

3. 交给它一个任务

用自然语言输入任务,然后按 Enter:

Fix the failing tests in this repository.

iCode Agent 会探索代码、做出修改、运行你的命令,并验证自己的工作。你可以实时观看,并随时引导它。

非交互式使用

用于脚本和 CI:

icode-agent -p "run the tests and report failures"   # print the final response
icode-agent --mode json -p "find TODO comments"      # stream events as JSON lines
icode-agent -c -p "now fix what you found"           # continue the last session

故障排查

  • 工作区始终打不开——还没有激活的模型。完成设置流程,或直接写入 ~/.icode-agent/models.json。
  • 命令立即失败——在 Windows 上,命令默认在 PowerShell 中运行;在设置中配置 "shell": "cmd" 以使用 CMD。
  • 长任务变慢——iCode Agent 会总结较早的上下文以控制请求大小;总结时会告知你。

跨平台兼容性已实现;自动化验证在 Linux 上执行,Windows 和 macOS 原生验证仍待完成。

仍然卡住?提交一个 issue。