Skip to content

Latest commit

 

History

History
283 lines (215 loc) · 10.1 KB

File metadata and controls

283 lines (215 loc) · 10.1 KB
Conductor 脚手架 CLI Logo

Conductor 脚手架 CLI

NPM Version License Downloads

English | 简体中文 | 日本語 | 한국어


为任何 AI 编码代理生成规范驱动、可移植的 Gemini Conductor 工作流的脚手架工具。

立即开始:

npm create conductor-flow

Conductor 脚手架 CLI 通过即时设置与主流 AI 编码助手兼容的可移植工作流,实现了 上下文优先的规范驱动开发演进。支持的 AI 助手包括:

  • Opencode
  • Claude Code
  • Antigravity
  • Cursor
  • Github Copilot
  • Codex
  • Windsurf
  • Cline
  • Kilo Code
  • Roo Code
  • Qwen Code
  • Factory Droid
  • Gemini CLI

Conductor 最初是为 Gemini CLI 开发的,现在通过本项目解耦,赋予开发者维护上下文、管理任务和编排复杂功能的能力。它是人类意图与 AI 执行之间的桥梁,确保在 Agentic AI 时代"上下文为王"。

✨ 主要特性

  • 代理无关的设置: 提供一种机制将 Conductor 命令和模板"安装"到项目中,有效地"启用"它以供多种不同的编码代理使用。
  • 代理无关的工作流:在不丢失项目上下文或进度的情况下切换代理。
  • 上下文管理:结构化的工件(product.md, tech-stack.md, spec.md, plan.md)让您的 AI 代理保持专注并具备上下文感知能力。
  • 规范驱动开发:在询问 AI 如何构建之前,先定义您想要什么
  • Git 忽略配置:自动配置 .gitignore.git/info/exclude,将代理配置文件排除在版本控制之外。
  • 轻松初始化:使用 npm create conductor-flow 单条命令完成设置。

🚀 使用方法

交互模式(推荐)

最简单的开始方式是运行交互式设置。它将引导您配置工作流规范,选择您的 AI 代理和设置。

npm create conductor-flow

或者如果您喜欢简写别名:

npx conductor-init

系统将提示您选择目标环境:

? Select your coding agent:
❯ OpenCode (AGENTS.md, .opencode/commands)
  Claude Code (CLAUDE.md, .claude/commands)
  Antigravity (GEMINI.md, .agent/workflows)
  Cursor (AGENTS.md, .cursor/commands)
  Github Copilot (AGENTS.md, .github/prompts)
  Codex (AGENTS.md, .codex/prompts)
  Windsurf (AGENTS.md, .windsurf/workflows)
? Select installation method:
❯ Project (Current Directory)
? Configure git ignore for Conductor files?
  Add to .gitignore
  Add to .git/info/exclude
  Remove existing entries
❯ Don't configure git ignore
? Select template source:
❯ Bundled Templates (Offline) - Use built-in templates, no network required
  Official Repository (Latest) - Fetch latest from official repository
  Custom Repository - Specify your own repository and branch

模板来源选项

CLI 提供三种模板来源供选择:

选项 描述 适用场景
内置模板 使用 CLI 自带的内置模板,无需网络连接。 离线使用、快速设置、稳定模板
官方仓库 官方 Conductor 仓库 下载最新模板。 获取最新功能和更新
自定义仓库 指定您自己的 Git 仓库和分支作为模板来源。 自定义工作流、企业模板

非交互模式(CI/CD)

在 CI/CD 环境中或当 stdin 不是 TTY 时,CLI 会自动使用内置模板而不显示提示:

  • 当设置了 CI=true 环境变量时
  • 当在非交互式 Shell 中运行时(管道输入)

参数与标志

对于高级用户,您可以直接传递参数以跳过提示:

npm create conductor-flow -a claude-code

# 显式使用官方仓库
npm create conductor-flow --repo

# 指定自定义模板仓库和分支
npm create conductor-flow --repo https://github.com/your-org/custom-conductor --branch v2

常用选项

npm create conductor-flow [path] [options]

Positionals:
  path  Directory to install Conductor                   [string] [default: "."]

Options:
  -a, --agent       Specify the coding agent
          [string] [choices: "opencode", "claude-code", "antigravity", "cursor",
        "github-copilot", "codex", "windsurf", "cline", "kilo-code", "roo-code",
                                         "qwen-code", "factory-droid", "gemini"]
  -r, --repo        Git repository URL for templates. Without this flag,
                    interactive template source selection is shown.     [string]
  -b, --branch      Branch name for template repository
                                                      [string] [default: "main"]
  -s, --scope       Installation scope (project or global)
                                         [string] [choices: "project", "global"]
  -g, --git-ignore  Configure git ignore for Conductor files (gitignore: add to
                    .gitignore, exclude: add to .git/info/exclude, none: remove
                    entries)  [string] [choices: "gitignore", "exclude", "none"]
  -f, --force       Force overwrite existing installation
                                                      [boolean] [default: false]
      --reset       Clear saved preferences and show all prompts
                                                      [boolean] [default: false]
  -h, --help        Show help                                          [boolean]
  -v, --version     Show version number                                [boolean]

Examples:
  npm create conductor-flow                 Install with interactive prompts
  npm create conductor-flow --agent         Install for Claude Code agent
  claude-code
  npm create conductor-flow --repo          Use custom template repository
  https://github.com/user/templates
  npm create conductor-flow --git-ignore    Add Conductor files to .gitignore
  gitignore
  npm create conductor-flow --git-ignore    Add Conductor files to
  exclude                                   .git/info/exclude
  npm create conductor-flow --git-ignore    Remove Conductor entries from git
  none                                      ignore
  npm create conductor-flow --reset         Clear saved preferences and show all
                                            prompts

配置持久化

CLI 会在运行之间记住您的首选项,因此您不必每次都指定相同的选项。

保存的内容:

  • 模板来源 (--repo, --branch)
  • Git 忽略偏好 (--git-ignore)

工作原理:

  1. 首次运行时,通过交互方式或标志选择您的首选项
  2. 在后续运行时,保存的首选项将自动应用
  3. CLI 标志始终覆盖保存的首选项

示例:

# 首次运行 - 指定您的首选项
npm create conductor-flow --agent claude-code --git-ignore exclude

# 后续运行 - 自动使用 exclude
npm create conductor-flow
# 输出: [Config] Using saved git-ignore: exclude

重置首选项:

要清除保存的首选项并重新开始所有提示:

npm create conductor-flow --reset

配置文件位置:

首选项按照 XDG 基本目录规范存储:

  • macOS: ~/Library/Application Support/create-conductor-flow/config.json
  • Linux: ~/.config/create-conductor-flow/config.json
  • Windows: %APPDATA%\create-conductor-flow\config.json


### 3. Shell 补全(全局安装/高级设置)

启用特定 Shell (Bash, Zsh) 的 Tab 补全功能,让使用 `conductor-init` 更加轻松。

#### 全局安装

```bash
npm install -g create-conductor-flow

或者,如果您喜欢简写别名:

npm install -g conductor-init

安装完成后,您可以使用 conductor-init completion 命令生成补全脚本。

Zsh (推荐)

选项 1: 从文件加载 (性能最佳)

生成脚本到文件并在你的 .zshrc 中 source 它:

mkdir -p ~/.config/conductor
conductor-init completion > ~/.config/conductor/completion.zsh
echo 'source ~/.config/conductor/completion.zsh' >> ~/.zshrc
source ~/.zshrc

选项 2: 单行命令 (One-liner)

直接添加到你的 .zshrc (设置最简单):

echo 'source <(conductor-init completion)' >> ~/.zshrc
source ~/.zshrc

Bash

将补全脚本添加到你的 .bashrc

conductor-init completion >> ~/.bashrc
source ~/.bashrc

4. 与你的代理一起使用 Conductor

安装完成后,你可以指示你的 AI 代理(Agent)使用安装的命令执行 Conductor 任务。例如:

  • /conductor-setup - 初始化项目结构。
  • /conductor-newTrack - 开始一个新的功能或错误修复轨道。
  • /conductor-implement - 实现选定的轨道。
  • /conductor-review - 根据指南和计划审查已完成的轨道工作。
  • /conductor-revert - 恢复以前的工作。
  • /conductor-status - 检查当前轨道的状态。

注意:确切的调用语法取决于你的特定代理的斜杠命令或文件上下文功能。

🙏 致谢

本项目受到 ConductorConductor-for-all 的启发并基于此构建。