# Droid 快速上手：安装、登录和第一次可审查的改动

> 安装 Droid CLI、登录 Factory，先让它读懂代码库，再完成一次小而可验证的改动，并熟悉模式切换等日常操作。

- 网址：https://funcoding.ai/agents/droid/getting-started/quickstart/
- 核实日期：2026-09-30（命令、配置和价格以官方文档为准）
- 官方来源：[Factory 文档：Droid CLI Quickstart](https://docs.factory.com/droid-cli/quickstart)

---
## 安装

| 方式 | 命令 |
| --- | --- |
| macOS / Linux | `curl -fsSL https://app.factory.ai/cli \| sh` |
| Homebrew | `brew install --cask droid` |
| Windows | `irm https://app.factory.ai/cli/windows \| iex` |
| npm | `npm install -g droid` |

Linux 用户需要先装好 `xdg-utils`：

```bash
sudo apt-get install xdg-utils
```

## 启动并登录

在项目目录里运行：

```bash
cd /path/to/your/project
droid
```

会进入全屏的终端界面。首次启动会提示在浏览器里登录 Factory 账号。

建议在 Git 仓库里使用，这样才能体验完整的「提议、审查、提交」流程。

## 第一步：让它读懂代码库

先别急着改东西，让它把项目摸一遍：

```text
> analyze this codebase and explain the overall architecture
```

```text
> where are the main entry points, test commands, and code conventions?
```

它会读取需要的文件，总结架构，并找出改动前应该跑的检查命令。

## 第二步：一次小的、可验证的改动

```text
> add structured logging to the app entry point and replace the existing console calls
```

Droid 的处理顺序是：

1. 检查当前实现
2. 任务需要时先给出计划
3. 展示确切的 diff
4. **等你批准后才修改**
5. 按要求跑相关的校验

审查 diff、跑过测试再接受。这个「提议、批准」的循环，是把更多工作交给它时仍然保持掌控的关键。

## 第三步：Git 操作

```text
> review my uncommitted changes and suggest improvements before I commit
```

```text
> create a well-structured commit with a descriptive message following our team conventions
```

## 日常操作

| 操作 | 方法 |
| --- | --- |
| 发送消息 | 输入后按 `Enter` |
| 多行输入 | `Shift+Enter` 换行 |
| 切换模式 | `Shift+Tab` |
| Bash 模式（直接执行命令，不经过 AI） | 输入框为空时按 `!`，按 `Esc` 返回 |
| 查看完整记录 | `Ctrl+O` |
| 选择模型 | `/model` |
| 查看费用 | `/cost` |

## 接下来

- 多步骤的功能用 **Specification Mode**，先出计划再实现
- 重复性的流程放进 **Droid Exec**，用于脚本、CI 和定时任务
- 想用自己的 Key 接入其他模型，看[官方文档](https://docs.factory.com)
