Skip to content

[[[[Switch to English]]]]

安装指南

先决条件

安装

初始化新项目

最简单的入门方法是初始化一个新项目:

bash
uvx --from git+https://github.com/github/spec-kit.git specify init <PROJECT_NAME>

也就是在当前目录初始化:

bash
uvx --from git+https://github.com/github/spec-kit.git specify init .
# 或者使用 --here 标志
uvx --from git+https://github.com/github/spec-kit.git specify init --here

指定 AI 智能体

您可以在初始化期间主动指定您的 AI 智能体:

bash
uvx --from git+https://github.com/github/spec-kit.git specify init <project_name> --ai claude
uvx --from git+https://github.com/github/spec-kit.git specify init <project_name> --ai gemini
uvx --from git+https://github.com/github/spec-kit.git specify init <project_name> --ai copilot
uvx --from git+https://github.com/github/spec-kit.git specify init <project_name> --ai codebuddy

指定脚本类型 (Shell vs PowerShell)

所有自动化脚本现在都有 Bash (.sh) 和 PowerShell (.ps1) 两种变体。

自动行为:

  • Windows 默认:ps
  • 其他 OS 默认:sh
  • 交互模式:除非您传递 --script,否则会提示您选择

强制指定特定脚本类型:

bash
uvx --from git+https://github.com/github/spec-kit.git specify init <project_name> --script sh
uvx --from git+https://github.com/github/spec-kit.git specify init <project_name> --script ps

忽略智能体工具检查

如果您希望在不检查正确工具的情况下获取模板:

bash
uvx --from git+https://github.com/github/spec-kit.git specify init <project_name> --ai claude --ignore-agent-tools

验证

初始化后,您应该在您的 AI 智能体中看到以下可用命令:

  • /speckit.specify - 创建规格
  • /speckit.plan - 生成实施计划
  • /speckit.tasks - 分解为可操作的任务

.specify/scripts 目录将包含 .sh.ps1 脚本。

故障排除

Linux 上的 Git 凭据管理器 (Git Credential Manager)

如果您在 Linux 上遇到 Git 身份验证问题,可以安装 Git 凭据管理器:

bash
#!/usr/bin/env bash
set -e
echo "Downloading Git Credential Manager v2.6.1..."
wget https://github.com/git-ecosystem/git-credential-manager/releases/download/v2.6.1/gcm-linux_amd64.2.6.1.deb
echo "Installing Git Credential Manager..."
sudo dpkg -i gcm-linux_amd64.2.6.1.deb
echo "Configuring Git to use GCM..."
git config --global credential.helper manager
echo "Cleaning up..."
rm gcm-linux_amd64.2.6.1.deb