mirror of
https://github.com/github/spec-kit.git
synced 2026-07-03 20:36:23 +08:00
Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5b397b02f1 | ||
|
|
697daec733 | ||
|
|
02a1d610df | ||
|
|
8d2797dc03 | ||
|
|
076bb40f2e | ||
|
|
530d1ce514 | ||
|
|
c717cbb42d | ||
|
|
282dd3da56 | ||
|
|
e0fd355dad | ||
|
|
db8131441e | ||
|
|
752683d347 |
29
CHANGELOG.md
29
CHANGELOG.md
@@ -2,6 +2,35 @@
|
||||
|
||||
<!-- insert new changelog below this comment -->
|
||||
|
||||
## [0.7.2] - 2026-04-16
|
||||
|
||||
### Changed
|
||||
|
||||
- docs: add core commands reference and simplify README CLI section (#2245)
|
||||
- docs: add workflows reference, reorganize into docs/reference/, and add --version flag (#2244)
|
||||
- docs: add presets reference page and rename pack_id to preset_id (#2243)
|
||||
- docs: add extensions reference page and integrations FAQ (#2242)
|
||||
- docs: consolidate integration documentation into docs/integrations.md (#2241)
|
||||
- feat: update memorylint and superpowers-bridge versions to 1.3.0 with new download URLs (#2240)
|
||||
- feat: Integration catalog — discovery, versioning, and community distribution (#2130)
|
||||
- Add Catalog CI extension to community catalog (#2239)
|
||||
- Added issues extension (#2194)
|
||||
- chore: release 0.7.1, begin 0.7.2.dev0 development (#2235)
|
||||
|
||||
## [0.7.1] - 2026-04-15
|
||||
|
||||
### Changed
|
||||
|
||||
- ci: add windows-latest to test matrix (#2233)
|
||||
- docs: remove deprecated --skip-tls references from local-development guide (#2231)
|
||||
- fix: allow Claude to chain skills for hook execution (#2227)
|
||||
- docs: merge TESTING.md into CONTRIBUTING.md, remove TESTING.md (#2228)
|
||||
- Add agent-assign extension to community catalog (#2030)
|
||||
- fix: unofficial PyPI warning (#1982) and legacy extension command name auto-correction (#2017) (#2027)
|
||||
- feat: register architect-preview in community catalog (#2214)
|
||||
- chore: deprecate --ai flag in favor of --integration on specify init (#2218)
|
||||
- chore: release 0.7.0, begin 0.7.1.dev0 development (#2217)
|
||||
|
||||
## [0.7.0] - 2026-04-14
|
||||
|
||||
### Changed
|
||||
|
||||
@@ -11,7 +11,7 @@ These are one time installations required to be able to test your changes locall
|
||||
1. Install [Python 3.11+](https://www.python.org/downloads/)
|
||||
1. Install [uv](https://docs.astral.sh/uv/) for package management
|
||||
1. Install [Git](https://git-scm.com/downloads)
|
||||
1. Have an [AI coding agent available](README.md#-supported-ai-agents)
|
||||
1. Have an [AI coding agent available](README.md#-supported-ai-coding-agent-integrations)
|
||||
|
||||
<details>
|
||||
<summary><b>💡 Hint if you are using <code>VSCode</code> or <code>GitHub Codespaces</code> as your IDE</b></summary>
|
||||
|
||||
199
README.md
199
README.md
@@ -26,7 +26,7 @@
|
||||
- [🎨 Community Presets](#-community-presets)
|
||||
- [🚶 Community Walkthroughs](#-community-walkthroughs)
|
||||
- [🛠️ Community Friends](#️-community-friends)
|
||||
- [🤖 Supported AI Agents](#-supported-ai-agents)
|
||||
- [🤖 Supported AI Coding Agent Integrations](#-supported-ai-coding-agent-integrations)
|
||||
- [🔧 Specify CLI Reference](#-specify-cli-reference)
|
||||
- [🧩 Making Spec Kit Your Own: Extensions & Presets](#-making-spec-kit-your-own-extensions--presets)
|
||||
- [📚 Core Philosophy](#-core-philosophy)
|
||||
@@ -77,9 +77,9 @@ And use the tool directly:
|
||||
specify init <PROJECT_NAME>
|
||||
|
||||
# Or initialize in existing project
|
||||
specify init . --ai claude
|
||||
specify init . --ai copilot
|
||||
# or
|
||||
specify init --here --ai claude
|
||||
specify init --here --ai copilot
|
||||
|
||||
# Check installed tools
|
||||
specify check
|
||||
@@ -100,9 +100,9 @@ Run directly without installing:
|
||||
uvx --from git+https://github.com/github/spec-kit.git@vX.Y.Z specify init <PROJECT_NAME>
|
||||
|
||||
# Or initialize in existing project
|
||||
uvx --from git+https://github.com/github/spec-kit.git@vX.Y.Z specify init . --ai claude
|
||||
uvx --from git+https://github.com/github/spec-kit.git@vX.Y.Z specify init . --ai copilot
|
||||
# or
|
||||
uvx --from git+https://github.com/github/spec-kit.git@vX.Y.Z specify init --here --ai claude
|
||||
uvx --from git+https://github.com/github/spec-kit.git@vX.Y.Z specify init --here --ai copilot
|
||||
```
|
||||
|
||||
**Benefits of persistent installation:**
|
||||
@@ -199,6 +199,7 @@ The following community-contributed extensions are available in [`catalog.commun
|
||||
| Brownfield Bootstrap | Bootstrap spec-kit for existing codebases — auto-discover architecture and adopt SDD incrementally | `process` | Read+Write | [spec-kit-brownfield](https://github.com/Quratulain-bilal/spec-kit-brownfield) |
|
||||
| Bugfix Workflow | Structured bugfix workflow — capture bugs, trace to spec artifacts, and patch specs surgically | `process` | Read+Write | [spec-kit-bugfix](https://github.com/Quratulain-bilal/spec-kit-bugfix) |
|
||||
| Canon | Adds canon-driven (baseline-driven) workflows: spec-first, code-first, spec-drift. Requires Canon Core preset installation. | `process` | Read+Write | [spec-kit-canon](https://github.com/maximiliamus/spec-kit-canon/tree/master/extension) |
|
||||
| Catalog CI | Automated validation for spec-kit community catalog entries — structure, URLs, diffs, and linting | `process` | Read-only | [spec-kit-catalog-ci](https://github.com/Quratulain-bilal/spec-kit-catalog-ci) |
|
||||
| CI Guard | Spec compliance gates for CI/CD — verify specs exist, check drift, and block merges on gaps | `process` | Read-only | [spec-kit-ci-guard](https://github.com/Quratulain-bilal/spec-kit-ci-guard) |
|
||||
| Checkpoint Extension | Commit the changes made during the middle of the implementation, so you don't end up with just one very large commit at the end | `code` | Read+Write | [spec-kit-checkpoint](https://github.com/aaronrsun/spec-kit-checkpoint) |
|
||||
| Cleanup Extension | Post-implementation quality gate that reviews changes, fixes small issues (scout rule), creates tasks for medium issues, and generates analysis for large issues | `code` | Read+Write | [spec-kit-cleanup](https://github.com/dsrednicki/spec-kit-cleanup) |
|
||||
@@ -209,7 +210,8 @@ The following community-contributed extensions are available in [`catalog.commun
|
||||
| Fix Findings | Automated analyze-fix-reanalyze loop that resolves spec findings until clean | `code` | Read+Write | [spec-kit-fix-findings](https://github.com/Quratulain-bilal/spec-kit-fix-findings) |
|
||||
| FixIt Extension | Spec-aware bug fixing — maps bugs to spec artifacts, proposes a plan, applies minimal changes | `code` | Read+Write | [spec-kit-fixit](https://github.com/speckit-community/spec-kit-fixit) |
|
||||
| Fleet Orchestrator | Orchestrate a full feature lifecycle with human-in-the-loop gates across all SpecKit phases | `process` | Read+Write | [spec-kit-fleet](https://github.com/sharathsatish/spec-kit-fleet) |
|
||||
| GitHub Issues Integration | Generate spec artifacts from GitHub Issues - import issues, sync updates, and maintain bidirectional traceability | `integration` | Read+Write | [spec-kit-github-issues](https://github.com/Fatima367/spec-kit-github-issues) |
|
||||
| GitHub Issues Integration 1 | Generate spec artifacts from GitHub Issues - import issues, sync updates, and maintain bidirectional traceability | `integration` | Read+Write | [spec-kit-github-issues](https://github.com/Fatima367/spec-kit-github-issues) |
|
||||
| GitHub Issues Integration 2 | Creates and syncs local specs from an existing GitHub issue | `integration` | Read+Write | [spec-kit-issue](https://github.com/aaronrsun/spec-kit-issue) |
|
||||
| Iterate | Iterate on spec documents with a two-phase define-and-apply workflow — refine specs mid-implementation and go straight back to building | `docs` | Read+Write | [spec-kit-iterate](https://github.com/imviancagrace/spec-kit-iterate) |
|
||||
| Jira Integration | Create Jira Epics, Stories, and Issues from spec-kit specifications and task breakdowns with configurable hierarchy and custom field support | `integration` | Read+Write | [spec-kit-jira](https://github.com/mbachorik/spec-kit-jira) |
|
||||
| Learning Extension | Generate educational guides from implementations and enhance clarifications with mentoring context | `docs` | Read+Write | [spec-kit-learn](https://github.com/imviancagrace/spec-kit-learn) |
|
||||
@@ -312,38 +314,11 @@ Community projects that extend, visualize, or build on Spec Kit:
|
||||
|
||||
- **[SpecKit Companion](https://marketplace.visualstudio.com/items?itemName=alfredoperez.speckit-companion)** — A VS Code extension that brings a visual GUI to Spec Kit. Browse specs in a rich markdown viewer with clickable file references, create specifications with image attachments, comment and refine each step inline (GitHub-style review), track your progress through the SDD workflow with a visual phase stepper, and manage steering documents like constitutions and templates.
|
||||
|
||||
## 🤖 Supported AI Agents
|
||||
| Agent | Support | Notes |
|
||||
| ------------------------------------------------------------------------------------ | ------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [Qoder CLI](https://qoder.com/cli) | ✅ | |
|
||||
| [Kiro CLI](https://kiro.dev/docs/cli/) | ✅ | Use `--ai kiro-cli` (alias: `--ai kiro`) |
|
||||
| [Amp](https://ampcode.com/) | ✅ | |
|
||||
| [Auggie CLI](https://docs.augmentcode.com/cli/overview) | ✅ | |
|
||||
| [Claude Code](https://www.anthropic.com/claude-code) | ✅ | Installs skills in `.claude/skills`; invoke spec-kit as `/speckit-constitution`, `/speckit-plan`, etc. |
|
||||
| [CodeBuddy CLI](https://www.codebuddy.ai/cli) | ✅ | |
|
||||
| [Codex CLI](https://github.com/openai/codex) | ✅ | Requires `--ai-skills`. Codex recommends [skills](https://developers.openai.com/codex/skills) and treats [custom prompts](https://developers.openai.com/codex/custom-prompts) as deprecated. Spec-kit installs Codex skills into `.agents/skills` and invokes them as `$speckit-<command>`. |
|
||||
| [Cursor](https://cursor.sh/) | ✅ | |
|
||||
| [Forge](https://forgecode.dev/) | ✅ | CLI tool: `forge` |
|
||||
| [Gemini CLI](https://github.com/google-gemini/gemini-cli) | ✅ | |
|
||||
| [Goose](https://block.github.io/goose/) | ✅ | Uses YAML recipe format in `.goose/recipes/` with slash command support |
|
||||
| [GitHub Copilot](https://code.visualstudio.com/) | ✅ | |
|
||||
| [IBM Bob](https://www.ibm.com/products/bob) | ✅ | IDE-based agent with slash command support |
|
||||
| [Jules](https://jules.google.com/) | ✅ | |
|
||||
| [Kilo Code](https://github.com/Kilo-Org/kilocode) | ✅ | |
|
||||
| [opencode](https://opencode.ai/) | ✅ | |
|
||||
| [Pi Coding Agent](https://pi.dev) | ✅ | Pi doesn't have MCP support out of the box, so `taskstoissues` won't work as intended. MCP support can be added via [extensions](https://github.com/badlogic/pi-mono/tree/main/packages/coding-agent#extensions) |
|
||||
| [Qwen Code](https://github.com/QwenLM/qwen-code) | ✅ | |
|
||||
| [Roo Code](https://roocode.com/) | ✅ | |
|
||||
| [SHAI (OVHcloud)](https://github.com/ovh/shai) | ✅ | |
|
||||
| [Tabnine CLI](https://docs.tabnine.com/main/getting-started/tabnine-cli) | ✅ | |
|
||||
| [Mistral Vibe](https://github.com/mistralai/mistral-vibe) | ✅ | |
|
||||
| [Kimi Code](https://code.kimi.com/) | ✅ | |
|
||||
| [iFlow CLI](https://docs.iflow.cn/en/cli/quickstart) | ✅ | |
|
||||
| [Windsurf](https://windsurf.com/) | ✅ | |
|
||||
| [Junie](https://junie.jetbrains.com/) | ✅ | |
|
||||
| [Antigravity (agy)](https://antigravity.google/) | ✅ | Requires `--ai-skills` |
|
||||
| [Trae](https://www.trae.ai/) | ✅ | |
|
||||
| Generic | ✅ | Bring your own agent — use `--ai generic --ai-commands-dir <path>` for unsupported agents |
|
||||
## 🤖 Supported AI Coding Agent Integrations
|
||||
|
||||
Spec Kit works with 30+ AI coding agents — both CLI tools and IDE-based assistants. See the full list with notes and usage details in the [Supported AI Coding Agent Integrations](https://github.github.io/spec-kit/reference/integrations.html) guide.
|
||||
|
||||
Run `specify integration list` to see all available integrations in your installed version.
|
||||
|
||||
## Available Slash Commands
|
||||
|
||||
@@ -374,135 +349,7 @@ Additional commands for enhanced quality and validation:
|
||||
|
||||
## 🔧 Specify CLI Reference
|
||||
|
||||
The `specify` tool is invoked as
|
||||
|
||||
```text
|
||||
specify <COMMAND> [SUBCOMMAND] [OPTIONS]
|
||||
```
|
||||
|
||||
and supports the following commands:
|
||||
|
||||
### Commands
|
||||
|
||||
| Command | Description |
|
||||
| ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `init` | Initialize a new Specify project from the latest template. |
|
||||
| `check` | Check for installed tools: `git` plus all CLI-based agents configured in `AGENT_CONFIG` (for example: `claude`, `gemini`, `code`/`code-insiders`, `cursor-agent`, `windsurf`, `junie`, `qwen`, `opencode`, `codex`, `kiro-cli`, `shai`, `qodercli`, `vibe`, `kimi`, `iflow`, `pi`, `forge`, etc.) |
|
||||
| `version` | Show the currently installed Spec Kit version. |
|
||||
| `extension` | Manage extensions |
|
||||
| `preset` | Manage presets |
|
||||
| `integration` | Manage integrations |
|
||||
|
||||
### `specify init` Arguments & Options
|
||||
|
||||
```bash
|
||||
specify init [PROJECT_NAME] <OPTIONS>
|
||||
```
|
||||
|
||||
| Argument/Option | Type | Description |
|
||||
| ---------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `<PROJECT_NAME>` | Argument | Name for your new project directory (optional if using `--here`, or use `.` for current directory) |
|
||||
| `--ai` | Option | AI assistant to use (see `AGENT_CONFIG` for the full, up-to-date list). Common options include: `claude`, `gemini`, `copilot`, `cursor-agent`, `qwen`, `opencode`, `codex`, `windsurf`, `junie`, `kilocode`, `auggie`, `roo`, `codebuddy`, `amp`, `shai`, `kiro-cli` (`kiro` alias), `agy`, `bob`, `qodercli`, `vibe`, `kimi`, `iflow`, `pi`, `forge`, or `generic` (requires `--ai-commands-dir`) |
|
||||
| `--ai-commands-dir` | Option | Directory for agent command files (required with `--ai generic`, e.g. `.myagent/commands/`) |
|
||||
| `--script` | Option | Script variant to use: `sh` (bash/zsh) or `ps` (PowerShell) |
|
||||
| `--ignore-agent-tools` | Flag | Skip checks for AI agent tools like Claude Code |
|
||||
| `--no-git` | Flag | Skip git repository initialization |
|
||||
| `--here` | Flag | Initialize project in the current directory instead of creating a new one |
|
||||
| `--force` | Flag | Force merge/overwrite when initializing in current directory (skip confirmation) |
|
||||
| `--skip-tls` | Flag | Skip SSL/TLS verification (not recommended) |
|
||||
| `--debug` | Flag | Enable detailed debug output for troubleshooting |
|
||||
| `--github-token` | Option | GitHub token for API requests (or set GH_TOKEN/GITHUB_TOKEN env variable) |
|
||||
| `--ai-skills` | Flag | Install Prompt.MD templates as agent skills in agent-specific `skills/` directory (requires `--ai`). Extension commands are also auto-registered as skills when extensions are added later. |
|
||||
| `--branch-numbering` | Option | Branch numbering strategy: `sequential` (default — `001`, `002`, `003`, …, `1000`, … — expands beyond 3 digits automatically) or `timestamp` (`YYYYMMDD-HHMMSS`). Timestamp mode is useful for distributed teams to avoid numbering conflicts |
|
||||
|
||||
### Examples
|
||||
|
||||
```bash
|
||||
# Basic project initialization
|
||||
specify init my-project
|
||||
|
||||
# Initialize with specific AI assistant
|
||||
specify init my-project --ai claude
|
||||
|
||||
# Initialize with Cursor support
|
||||
specify init my-project --ai cursor-agent
|
||||
|
||||
# Initialize with Qoder support
|
||||
specify init my-project --ai qodercli
|
||||
|
||||
# Initialize with Windsurf support
|
||||
specify init my-project --ai windsurf
|
||||
|
||||
# Initialize with Kiro CLI support
|
||||
specify init my-project --ai kiro-cli
|
||||
|
||||
# Initialize with Amp support
|
||||
specify init my-project --ai amp
|
||||
|
||||
# Initialize with SHAI support
|
||||
specify init my-project --ai shai
|
||||
|
||||
# Initialize with Mistral Vibe support
|
||||
specify init my-project --ai vibe
|
||||
|
||||
# Initialize with IBM Bob support
|
||||
specify init my-project --ai bob
|
||||
|
||||
# Initialize with Pi Coding Agent support
|
||||
specify init my-project --ai pi
|
||||
|
||||
# Initialize with Codex CLI support
|
||||
specify init my-project --ai codex --ai-skills
|
||||
|
||||
# Initialize with Antigravity support
|
||||
specify init my-project --ai agy --ai-skills
|
||||
|
||||
# Initialize with Forge support
|
||||
specify init my-project --ai forge
|
||||
|
||||
# Initialize with an unsupported agent (generic / bring your own agent)
|
||||
specify init my-project --ai generic --ai-commands-dir .myagent/commands/
|
||||
|
||||
# Initialize with PowerShell scripts (Windows/cross-platform)
|
||||
specify init my-project --ai copilot --script ps
|
||||
|
||||
# Initialize in current directory
|
||||
specify init . --ai copilot
|
||||
# or use the --here flag
|
||||
specify init --here --ai copilot
|
||||
|
||||
# Force merge into current (non-empty) directory without confirmation
|
||||
specify init . --force --ai copilot
|
||||
# or
|
||||
specify init --here --force --ai copilot
|
||||
|
||||
# Skip git initialization
|
||||
specify init my-project --ai gemini --no-git
|
||||
|
||||
# Enable debug output for troubleshooting
|
||||
specify init my-project --ai claude --debug
|
||||
|
||||
# Use GitHub token for API requests (helpful for corporate environments)
|
||||
specify init my-project --ai claude --github-token ghp_your_token_here
|
||||
|
||||
# Claude Code installs skills with the project by default
|
||||
specify init my-project --ai claude
|
||||
|
||||
# Initialize in current directory with agent skills
|
||||
specify init --here --ai gemini --ai-skills
|
||||
|
||||
# Use timestamp-based branch numbering (useful for distributed teams)
|
||||
specify init my-project --ai claude --branch-numbering timestamp
|
||||
|
||||
# Check system requirements
|
||||
specify check
|
||||
```
|
||||
|
||||
### Environment Variables
|
||||
|
||||
| Variable | Description |
|
||||
| ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| `SPECIFY_FEATURE` | Override feature detection for non-Git repositories. Set to the feature directory name (e.g., `001-photo-albums`) to work on a specific feature when not using Git branches.<br/>\*\*Must be set in the context of the agent you're working with prior to using `/speckit.plan` or follow-up commands. |
|
||||
For full command details, options, and examples, see the [CLI Reference](https://github.github.io/spec-kit/reference/overview.html).
|
||||
|
||||
## 🧩 Making Spec Kit Your Own: Extensions & Presets
|
||||
|
||||
@@ -535,7 +382,7 @@ specify extension add <extension-name>
|
||||
|
||||
For example, extensions could add Jira integration, post-implementation code review, V-Model test traceability, or project health diagnostics.
|
||||
|
||||
See the [Extensions README](./extensions/README.md) for the full guide and how to build and publish your own. Browse the [community extensions](#-community-extensions) above for what's available.
|
||||
See the [Extensions reference](https://github.github.io/spec-kit/reference/extensions.html) for the full command guide. Browse the [community extensions](#-community-extensions) above for what's available.
|
||||
|
||||
### Presets — Customize Existing Workflows
|
||||
|
||||
@@ -551,7 +398,7 @@ specify preset add <preset-name>
|
||||
|
||||
For example, presets could restructure spec templates to require regulatory traceability, adapt the workflow to fit the methodology you use (e.g., Agile, Kanban, Waterfall, jobs-to-be-done, or domain-driven design), add mandatory security review gates to plans, enforce test-first task ordering, or localize the entire workflow to a different language. The [pirate-speak demo](https://github.com/mnriem/spec-kit-pirate-speak-preset-demo) shows just how deep the customization can go. Multiple presets can be stacked with priority ordering.
|
||||
|
||||
See the [Presets README](./presets/README.md) for the full guide, including resolution order, priority, and how to create your own.
|
||||
See the [Presets reference](https://github.github.io/spec-kit/reference/presets.html) for the full command guide, including resolution order and priority stacking.
|
||||
|
||||
### When to Use Which
|
||||
|
||||
@@ -609,7 +456,7 @@ Our research and experimentation focus on:
|
||||
## 🔧 Prerequisites
|
||||
|
||||
- **Linux/macOS/Windows**
|
||||
- [Supported](#-supported-ai-agents) AI coding agent.
|
||||
- [Supported](#-supported-ai-coding-agent-integrations) AI coding agent.
|
||||
- [uv](https://docs.astral.sh/uv/) for package management
|
||||
- [Python 3.11+](https://www.python.org/downloads/)
|
||||
- [Git](https://git-scm.com/downloads)
|
||||
@@ -651,29 +498,29 @@ specify init --here --force
|
||||
You will be prompted to select the AI agent you are using. You can also proactively specify it directly in the terminal:
|
||||
|
||||
```bash
|
||||
specify init <project_name> --ai claude
|
||||
specify init <project_name> --ai copilot
|
||||
specify init <project_name> --ai gemini
|
||||
specify init <project_name> --ai copilot
|
||||
|
||||
# Or in current directory:
|
||||
specify init . --ai claude
|
||||
specify init . --ai copilot
|
||||
specify init . --ai codex --ai-skills
|
||||
|
||||
# or use --here flag
|
||||
specify init --here --ai claude
|
||||
specify init --here --ai copilot
|
||||
specify init --here --ai codex --ai-skills
|
||||
|
||||
# Force merge into a non-empty current directory
|
||||
specify init . --force --ai claude
|
||||
specify init . --force --ai copilot
|
||||
|
||||
# or
|
||||
specify init --here --force --ai claude
|
||||
specify init --here --force --ai copilot
|
||||
```
|
||||
|
||||
The CLI will check if you have Claude Code, Gemini CLI, Cursor CLI, Qwen CLI, opencode, Codex CLI, Qoder CLI, Tabnine CLI, Kiro CLI, Pi, Forge, Goose, or Mistral Vibe installed. If you do not, or you prefer to get the templates without checking for the right tools, use `--ignore-agent-tools` with your command:
|
||||
|
||||
```bash
|
||||
specify init <project_name> --ai claude --ignore-agent-tools
|
||||
specify init <project_name> --ai copilot --ignore-agent-tools
|
||||
```
|
||||
|
||||
### **STEP 1:** Establish project principles
|
||||
|
||||
79
docs/reference/core.md
Normal file
79
docs/reference/core.md
Normal file
@@ -0,0 +1,79 @@
|
||||
# Core Commands
|
||||
|
||||
The core `specify` commands handle project initialization, system checks, and version information.
|
||||
|
||||
## Initialize a Project
|
||||
|
||||
```bash
|
||||
specify init [<project_name>]
|
||||
```
|
||||
|
||||
| Option | Description |
|
||||
| ------------------------ | ------------------------------------------------------------------------ |
|
||||
| `--integration <key>` | AI coding agent integration to use (e.g. `copilot`, `claude`, `gemini`). See the [Integrations reference](integrations.md) for all available keys |
|
||||
| `--integration-options` | Options for the integration (e.g. `--integration-options="--commands-dir .myagent/cmds"`) |
|
||||
| `--script sh\|ps` | Script type: `sh` (bash/zsh) or `ps` (PowerShell) |
|
||||
| `--here` | Initialize in the current directory instead of creating a new one |
|
||||
| `--force` | Force merge/overwrite when initializing in an existing directory |
|
||||
| `--no-git` | Skip git repository initialization |
|
||||
| `--ignore-agent-tools` | Skip checks for AI coding agent CLI tools |
|
||||
| `--preset <id>` | Install a preset during initialization |
|
||||
| `--branch-numbering` | Branch numbering strategy: `sequential` (default) or `timestamp` |
|
||||
|
||||
Creates a new Spec Kit project with the necessary directory structure, templates, scripts, and AI coding agent integration files.
|
||||
|
||||
Use `<project_name>` to create a new directory, or `--here` (or `.`) to initialize in the current directory. If the directory already has files, use `--force` to merge without confirmation.
|
||||
|
||||
### Examples
|
||||
|
||||
```bash
|
||||
# Create a new project with an integration
|
||||
specify init my-project --integration copilot
|
||||
|
||||
# Initialize in the current directory
|
||||
specify init --here --integration copilot
|
||||
|
||||
# Force merge into a non-empty directory
|
||||
specify init --here --force --integration copilot
|
||||
|
||||
# Use PowerShell scripts (Windows/cross-platform)
|
||||
specify init my-project --integration copilot --script ps
|
||||
|
||||
# Skip git initialization
|
||||
specify init my-project --integration copilot --no-git
|
||||
|
||||
# Install a preset during initialization
|
||||
specify init my-project --integration copilot --preset compliance
|
||||
|
||||
# Use timestamp-based branch numbering (useful for distributed teams)
|
||||
specify init my-project --integration copilot --branch-numbering timestamp
|
||||
```
|
||||
|
||||
### Environment Variables
|
||||
|
||||
| Variable | Description |
|
||||
| ----------------- | ------------------------------------------------------------------------ |
|
||||
| `SPECIFY_FEATURE` | Override feature detection for non-Git repositories. Set to the feature directory name (e.g., `001-photo-albums`) to work on a specific feature when not using Git branches. Must be set in the context of the agent prior to using `/speckit.plan` or follow-up commands. |
|
||||
|
||||
## Check Installed Tools
|
||||
|
||||
```bash
|
||||
specify check
|
||||
```
|
||||
|
||||
Checks that required tools are available on your system: `git` and any CLI-based AI coding agents. IDE-based agents are skipped since they don't require a CLI tool.
|
||||
|
||||
## Version Information
|
||||
|
||||
```bash
|
||||
specify version
|
||||
```
|
||||
|
||||
Displays the Spec Kit CLI version, Python version, platform, and architecture.
|
||||
|
||||
A quick version check is also available via:
|
||||
|
||||
```bash
|
||||
specify --version
|
||||
specify -V
|
||||
```
|
||||
201
docs/reference/extensions.md
Normal file
201
docs/reference/extensions.md
Normal file
@@ -0,0 +1,201 @@
|
||||
# Extensions
|
||||
|
||||
Extensions add new capabilities to Spec Kit — domain-specific commands, external tool integrations, quality gates, and more. They introduce new commands and templates that go beyond the built-in Spec-Driven Development workflow.
|
||||
|
||||
## Search Available Extensions
|
||||
|
||||
```bash
|
||||
specify extension search [query]
|
||||
```
|
||||
|
||||
| Option | Description |
|
||||
| ------------ | ------------------------------------ |
|
||||
| `--tag` | Filter by tag |
|
||||
| `--author` | Filter by author |
|
||||
| `--verified` | Show only verified extensions |
|
||||
|
||||
Searches all active catalogs for extensions matching the query. Without a query, lists all available extensions.
|
||||
|
||||
## Install an Extension
|
||||
|
||||
```bash
|
||||
specify extension add <name>
|
||||
```
|
||||
|
||||
| Option | Description |
|
||||
| --------------- | -------------------------------------------------------- |
|
||||
| `--dev` | Install from a local directory (for development) |
|
||||
| `--from <url>` | Install from a custom URL instead of the catalog |
|
||||
| `--priority <N>`| Resolution priority (default: 10; lower = higher precedence) |
|
||||
|
||||
Installs an extension from the catalog, a URL, or a local directory. Extension commands are automatically registered with the currently installed AI coding agent integration.
|
||||
|
||||
> **Note:** All extension commands require a project already initialized with `specify init`.
|
||||
|
||||
## Remove an Extension
|
||||
|
||||
```bash
|
||||
specify extension remove <name>
|
||||
```
|
||||
|
||||
| Option | Description |
|
||||
| --------------- | ---------------------------------------------- |
|
||||
| `--keep-config` | Preserve configuration files during removal |
|
||||
| `--force` | Skip confirmation prompt |
|
||||
|
||||
Removes an installed extension. Configuration files are backed up by default; use `--keep-config` to leave them in place or `--force` to skip the confirmation.
|
||||
|
||||
## List Installed Extensions
|
||||
|
||||
```bash
|
||||
specify extension list
|
||||
```
|
||||
|
||||
| Option | Description |
|
||||
| ------------- | -------------------------------------------------- |
|
||||
| `--available` | Show available (uninstalled) extensions |
|
||||
| `--all` | Show both installed and available extensions |
|
||||
|
||||
Lists installed extensions with their status, version, and command counts.
|
||||
|
||||
## Extension Info
|
||||
|
||||
```bash
|
||||
specify extension info <name>
|
||||
```
|
||||
|
||||
Shows detailed information about an installed or available extension, including its description, version, commands, and configuration.
|
||||
|
||||
## Update Extensions
|
||||
|
||||
```bash
|
||||
specify extension update [<name>]
|
||||
```
|
||||
|
||||
Updates a specific extension, or all installed extensions if no name is given.
|
||||
|
||||
## Enable / Disable an Extension
|
||||
|
||||
```bash
|
||||
specify extension enable <name>
|
||||
specify extension disable <name>
|
||||
```
|
||||
|
||||
Disable an extension without removing it. Disabled extensions are not loaded and their commands are not available. Re-enable with `enable`.
|
||||
|
||||
## Set Extension Priority
|
||||
|
||||
```bash
|
||||
specify extension set-priority <name> <priority>
|
||||
```
|
||||
|
||||
Changes the resolution priority of an extension. When multiple extensions provide a command with the same name, the extension with the lowest priority number takes precedence.
|
||||
|
||||
## Catalog Management
|
||||
|
||||
Extension catalogs control where `search` and `add` look for extensions. Catalogs are checked in priority order (lower number = higher precedence).
|
||||
|
||||
### List Catalogs
|
||||
|
||||
```bash
|
||||
specify extension catalog list
|
||||
```
|
||||
|
||||
Shows all active catalogs in the stack with their priorities and install permissions.
|
||||
|
||||
### Add a Catalog
|
||||
|
||||
```bash
|
||||
specify extension catalog add <url>
|
||||
```
|
||||
|
||||
| Option | Description |
|
||||
| ------------------------------------ | -------------------------------------------------- |
|
||||
| `--name <name>` | Required. Unique name for the catalog |
|
||||
| `--priority <N>` | Priority (default: 10; lower = higher precedence) |
|
||||
| `--install-allowed / --no-install-allowed` | Whether extensions can be installed from this catalog |
|
||||
| `--description <text>` | Optional description |
|
||||
|
||||
Adds a catalog to the project's `.specify/extension-catalogs.yml`.
|
||||
|
||||
### Remove a Catalog
|
||||
|
||||
```bash
|
||||
specify extension catalog remove <name>
|
||||
```
|
||||
|
||||
Removes a catalog from the project configuration.
|
||||
|
||||
### Catalog Resolution Order
|
||||
|
||||
Catalogs are resolved in this order (first match wins):
|
||||
|
||||
1. **Environment variable** — `SPECKIT_CATALOG_URL` overrides all catalogs
|
||||
2. **Project config** — `.specify/extension-catalogs.yml`
|
||||
3. **User config** — `~/.specify/extension-catalogs.yml`
|
||||
4. **Built-in defaults** — official catalog + community catalog
|
||||
|
||||
Example `.specify/extension-catalogs.yml`:
|
||||
|
||||
```yaml
|
||||
catalogs:
|
||||
- name: "my-org-catalog"
|
||||
url: "https://example.com/catalog.json"
|
||||
priority: 5
|
||||
install_allowed: true
|
||||
description: "Our approved extensions"
|
||||
```
|
||||
|
||||
## Extension Configuration
|
||||
|
||||
Most extensions include configuration files in their install directory:
|
||||
|
||||
```text
|
||||
.specify/extensions/<ext>/
|
||||
├── <ext>-config.yml # Project config (version controlled)
|
||||
├── <ext>-config.local.yml # Local overrides (gitignored)
|
||||
└── <ext>-config.template.yml # Template reference
|
||||
```
|
||||
|
||||
Configuration is merged in this order (highest priority last):
|
||||
|
||||
1. **Extension defaults** (from `extension.yml`)
|
||||
2. **Project config** (`<ext>-config.yml`)
|
||||
3. **Local overrides** (`<ext>-config.local.yml`)
|
||||
4. **Environment variables** (`SPECKIT_<EXT>_*`)
|
||||
|
||||
To set up configuration for a newly installed extension, copy the template:
|
||||
|
||||
```bash
|
||||
cp .specify/extensions/<ext>/<ext>-config.template.yml \
|
||||
.specify/extensions/<ext>/<ext>-config.yml
|
||||
```
|
||||
|
||||
## FAQ
|
||||
|
||||
### Why can't I find an extension with `search`?
|
||||
|
||||
Check the spelling of the extension name. The extension may not be published yet, or it may be in a catalog you haven't added. Use `specify extension catalog list` to see which catalogs are active.
|
||||
|
||||
### Why doesn't the extension command appear in my AI coding agent?
|
||||
|
||||
Verify the extension is installed and enabled with `specify extension list`. If it shows as installed, restart your AI coding agent — it may need to reload for it to take effect.
|
||||
|
||||
### How do I set up extension configuration?
|
||||
|
||||
Copy the config template that ships with the extension:
|
||||
|
||||
```bash
|
||||
cp .specify/extensions/<ext>/<ext>-config.template.yml \
|
||||
.specify/extensions/<ext>/<ext>-config.yml
|
||||
```
|
||||
|
||||
See [Extension Configuration](#extension-configuration) for details on config layers and overrides.
|
||||
|
||||
### How do I resolve an incompatible version error?
|
||||
|
||||
Update Spec Kit to the version required by the extension.
|
||||
|
||||
### Who maintains extensions?
|
||||
|
||||
Most extensions are independently created and maintained by their respective authors. The Spec Kit maintainers do not review, audit, endorse, or support extension code. Review an extension's source code before installing and use at your own discretion. For issues with a specific extension, contact its author or file an issue on the extension's repository.
|
||||
140
docs/reference/integrations.md
Normal file
140
docs/reference/integrations.md
Normal file
@@ -0,0 +1,140 @@
|
||||
# Supported AI Coding Agent Integrations
|
||||
|
||||
The Specify CLI supports a wide range of AI coding agents. When you run `specify init`, the CLI sets up the appropriate command files, context rules, and directory structures for your chosen AI coding agent — so you can start using Spec-Driven Development immediately, regardless of which tool you prefer.
|
||||
|
||||
## Supported AI Coding Agents
|
||||
|
||||
| Agent | Key | Notes |
|
||||
| ------------------------------------------------------------------------------------ | ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| [Amp](https://ampcode.com/) | `amp` | |
|
||||
| [Antigravity (agy)](https://antigravity.google/) | `agy` | Skills-based integration; skills are installed automatically |
|
||||
| [Auggie CLI](https://docs.augmentcode.com/cli/overview) | `auggie` | |
|
||||
| [Claude Code](https://www.anthropic.com/claude-code) | `claude` | Skills-based integration; installs skills in `.claude/skills` |
|
||||
| [CodeBuddy CLI](https://www.codebuddy.ai/cli) | `codebuddy` | |
|
||||
| [Codex CLI](https://github.com/openai/codex) | `codex` | Skills-based integration; installs skills into `.agents/skills` and invokes them as `$speckit-<command>` |
|
||||
| [Cursor](https://cursor.sh/) | `cursor-agent` | |
|
||||
| [Forge](https://forgecode.dev/) | `forge` | |
|
||||
| [Gemini CLI](https://github.com/google-gemini/gemini-cli) | `gemini` | |
|
||||
| [GitHub Copilot](https://code.visualstudio.com/) | `copilot` | |
|
||||
| [Goose](https://block.github.io/goose/) | `goose` | Uses YAML recipe format in `.goose/recipes/` |
|
||||
| [IBM Bob](https://www.ibm.com/products/bob) | `bob` | IDE-based agent |
|
||||
| [iFlow CLI](https://docs.iflow.cn/en/cli/quickstart) | `iflow` | |
|
||||
| [Junie](https://junie.jetbrains.com/) | `junie` | |
|
||||
| [Kilo Code](https://github.com/Kilo-Org/kilocode) | `kilocode` | |
|
||||
| [Kimi Code](https://code.kimi.com/) | `kimi` | Skills-based integration; supports `--migrate-legacy` for dotted→hyphenated directory migration |
|
||||
| [Kiro CLI](https://kiro.dev/docs/cli/) | `kiro-cli` | Alias: `--integration kiro` |
|
||||
| [Mistral Vibe](https://github.com/mistralai/mistral-vibe) | `vibe` | |
|
||||
| [opencode](https://opencode.ai/) | `opencode` | |
|
||||
| [Pi Coding Agent](https://pi.dev) | `pi` | Pi doesn't have MCP support out of the box, so `taskstoissues` won't work as intended. MCP support can be added via [extensions](https://github.com/badlogic/pi-mono/tree/main/packages/coding-agent#extensions) |
|
||||
| [Qoder CLI](https://qoder.com/cli) | `qodercli` | |
|
||||
| [Qwen Code](https://github.com/QwenLM/qwen-code) | `qwen` | |
|
||||
| [Roo Code](https://roocode.com/) | `roo` | |
|
||||
| [SHAI (OVHcloud)](https://github.com/ovh/shai) | `shai` | |
|
||||
| [Tabnine CLI](https://docs.tabnine.com/main/getting-started/tabnine-cli) | `tabnine` | |
|
||||
| [Trae](https://www.trae.ai/) | `trae` | Skills-based integration; skills are installed automatically |
|
||||
| [Windsurf](https://windsurf.com/) | `windsurf` | |
|
||||
| Generic | `generic` | Bring your own agent — use `--integration generic --integration-options="--commands-dir <path>"` for AI coding agents not listed above |
|
||||
|
||||
## List Available Integrations
|
||||
|
||||
```bash
|
||||
specify integration list
|
||||
```
|
||||
|
||||
Shows all available integrations, which one is currently installed, and whether each requires a CLI tool or is IDE-based.
|
||||
|
||||
## Install an Integration
|
||||
|
||||
```bash
|
||||
specify integration install <key>
|
||||
```
|
||||
|
||||
| Option | Description |
|
||||
| ------------------------ | ------------------------------------------------------------------------ |
|
||||
| `--script sh\|ps` | Script type: `sh` (bash/zsh) or `ps` (PowerShell) |
|
||||
| `--integration-options` | Integration-specific options (e.g. `--integration-options="--commands-dir .myagent/cmds"`) |
|
||||
|
||||
Installs the specified integration into the current project. Fails if another integration is already installed — use `switch` instead. If the installation fails partway through, it automatically rolls back to a clean state.
|
||||
|
||||
> **Note:** All integration management commands require a project already initialized with `specify init`. To start a new project with a specific agent, use `specify init <project> --integration <key>` instead.
|
||||
|
||||
## Uninstall an Integration
|
||||
|
||||
```bash
|
||||
specify integration uninstall [<key>]
|
||||
```
|
||||
|
||||
| Option | Description |
|
||||
| --------- | --------------------------------------------------- |
|
||||
| `--force` | Remove files even if they have been modified |
|
||||
|
||||
Uninstalls the current integration (or the specified one). Spec Kit tracks every file created during install along with a SHA-256 hash of the original content:
|
||||
|
||||
- **Unmodified files** are removed automatically.
|
||||
- **Modified files** (where you've made manual edits) are preserved so your customizations are not lost.
|
||||
- Use `--force` to remove all integration files regardless of modifications.
|
||||
|
||||
## Switch to a Different Integration
|
||||
|
||||
```bash
|
||||
specify integration switch <key>
|
||||
```
|
||||
|
||||
| Option | Description |
|
||||
| ------------------------ | ------------------------------------------------------------------------ |
|
||||
| `--script sh\|ps` | Script type: `sh` (bash/zsh) or `ps` (PowerShell) |
|
||||
| `--force` | Force removal of modified files during uninstall |
|
||||
| `--integration-options` | Options for the target integration |
|
||||
|
||||
Equivalent to running `uninstall` followed by `install` in a single step.
|
||||
|
||||
## Upgrade an Integration
|
||||
|
||||
```bash
|
||||
specify integration upgrade [<key>]
|
||||
```
|
||||
|
||||
| Option | Description |
|
||||
| ------------------------ | ------------------------------------------------------------------------ |
|
||||
| `--force` | Overwrite files even if they have been modified |
|
||||
| `--script sh\|ps` | Script type: `sh` (bash/zsh) or `ps` (PowerShell) |
|
||||
| `--integration-options` | Options for the integration |
|
||||
|
||||
Reinstalls the current integration with updated templates and commands (e.g., after upgrading Spec Kit). Defaults to the currently installed integration; if a key is provided, it must match the installed one — otherwise the command fails and suggests using `switch` instead. Detects locally modified files and blocks the upgrade unless `--force` is used. Stale files from the previous install that are no longer needed are removed automatically.
|
||||
|
||||
## Integration-Specific Options
|
||||
|
||||
Some integrations accept additional options via `--integration-options`:
|
||||
|
||||
| Integration | Option | Description |
|
||||
| ----------- | ------------------- | -------------------------------------------------------------- |
|
||||
| `generic` | `--commands-dir` | Required. Directory for command files |
|
||||
| `kimi` | `--migrate-legacy` | Migrate legacy dotted skill directories to hyphenated format |
|
||||
|
||||
Example:
|
||||
|
||||
```bash
|
||||
specify integration install generic --integration-options="--commands-dir .myagent/cmds"
|
||||
```
|
||||
|
||||
## FAQ
|
||||
|
||||
### Can I use multiple integrations at the same time?
|
||||
|
||||
No. Only one AI coding agent integration can be installed per project. Use `specify integration switch <key>` to change to a different AI coding agent.
|
||||
|
||||
### What happens to my changes when I uninstall or switch?
|
||||
|
||||
Files you've modified are preserved automatically. Only unmodified files (matching their original SHA-256 hash) are removed. Use `--force` to override this.
|
||||
|
||||
### How do I know which key to use?
|
||||
|
||||
Run `specify integration list` to see all available integrations with their keys, or check the [Supported AI Coding Agents](#supported-ai-coding-agents) table above.
|
||||
|
||||
### Do I need the AI coding agent installed to use an integration?
|
||||
|
||||
CLI-based integrations (like Claude Code, Gemini CLI) require the tool to be installed. IDE-based integrations (like Windsurf, Cursor) work through the IDE itself. Some agents like GitHub Copilot support both IDE and CLI usage. `specify integration list` shows which type each integration is.
|
||||
|
||||
### When should I use `upgrade` vs `switch`?
|
||||
|
||||
Use `upgrade` when you've upgraded Spec Kit and want to refresh the same integration's templates. Use `switch` when you want to change to a different AI coding agent.
|
||||
33
docs/reference/overview.md
Normal file
33
docs/reference/overview.md
Normal file
@@ -0,0 +1,33 @@
|
||||
# CLI Reference
|
||||
|
||||
The Specify CLI (`specify`) manages the full lifecycle of Spec-Driven Development — from project initialization to workflow automation.
|
||||
|
||||
## Core Commands
|
||||
|
||||
The foundational commands for creating and managing Spec Kit projects. Initialize a new project with the necessary directory structure, templates, and scripts. Verify that your system has the required tools installed. Check version and system information.
|
||||
|
||||
[Core Commands reference →](core.md)
|
||||
|
||||
## Integrations
|
||||
|
||||
Integrations connect Spec Kit to your AI coding agent. Each integration sets up the appropriate command files, context rules, and directory structures for a specific agent. Only one integration is active per project at a time, and you can switch between them at any point.
|
||||
|
||||
[Integrations reference →](integrations.md)
|
||||
|
||||
## Extensions
|
||||
|
||||
Extensions add new capabilities to Spec Kit — domain-specific commands, external tool integrations, quality gates, and more. They are discovered through catalogs and can be installed, updated, enabled, disabled, or removed independently. Multiple extensions can coexist in a single project.
|
||||
|
||||
[Extensions reference →](extensions.md)
|
||||
|
||||
## Presets
|
||||
|
||||
Presets customize how Spec Kit works — overriding command files, template files, and script files without changing any tooling. They let you enforce organizational standards, adapt the workflow to your methodology, or localize the entire experience. Multiple presets can be stacked with priority ordering to layer customizations.
|
||||
|
||||
[Presets reference →](presets.md)
|
||||
|
||||
## Workflows
|
||||
|
||||
Workflows automate multi-step Spec-Driven Development processes into repeatable sequences. They chain commands, prompts, shell steps, and human checkpoints together, with support for conditional logic, loops, fan-out/fan-in, and the ability to pause and resume from the exact point of interruption.
|
||||
|
||||
[Workflows reference →](workflows.md)
|
||||
224
docs/reference/presets.md
Normal file
224
docs/reference/presets.md
Normal file
@@ -0,0 +1,224 @@
|
||||
# Presets
|
||||
|
||||
Presets customize how Spec Kit works — overriding templates, commands, and terminology without changing any tooling. They let you enforce organizational standards, adapt the workflow to your methodology, or localize the entire experience. Multiple presets can be stacked with priority ordering.
|
||||
|
||||
## Search Available Presets
|
||||
|
||||
```bash
|
||||
specify preset search [query]
|
||||
```
|
||||
|
||||
| Option | Description |
|
||||
| ---------- | -------------------- |
|
||||
| `--tag` | Filter by tag |
|
||||
| `--author` | Filter by author |
|
||||
|
||||
Searches all active catalogs for presets matching the query. Without a query, lists all available presets.
|
||||
|
||||
## Install a Preset
|
||||
|
||||
```bash
|
||||
specify preset add [<preset_id>]
|
||||
```
|
||||
|
||||
| Option | Description |
|
||||
| ---------------- | -------------------------------------------------------- |
|
||||
| `--dev <path>` | Install from a local directory (for development) |
|
||||
| `--from <url>` | Install from a custom URL instead of the catalog |
|
||||
| `--priority <N>` | Resolution priority (default: 10; lower = higher precedence) |
|
||||
|
||||
Installs a preset from the catalog, a URL, or a local directory. Preset commands are automatically registered with the currently installed AI coding agent integration.
|
||||
|
||||
> **Note:** All preset commands require a project already initialized with `specify init`.
|
||||
|
||||
## Remove a Preset
|
||||
|
||||
```bash
|
||||
specify preset remove <preset_id>
|
||||
```
|
||||
|
||||
Removes an installed preset and cleans up its registered commands.
|
||||
|
||||
## List Installed Presets
|
||||
|
||||
```bash
|
||||
specify preset list
|
||||
```
|
||||
|
||||
Lists installed presets with their versions, descriptions, template counts, and current status.
|
||||
|
||||
## Preset Info
|
||||
|
||||
```bash
|
||||
specify preset info <preset_id>
|
||||
```
|
||||
|
||||
Shows detailed information about an installed or available preset, including its templates, metadata, and tags.
|
||||
|
||||
## Resolve a File
|
||||
|
||||
```bash
|
||||
specify preset resolve <name>
|
||||
```
|
||||
|
||||
Shows which file will be used for a given name by tracing the full resolution stack. Useful for debugging when multiple presets provide the same file.
|
||||
|
||||
## Enable / Disable a Preset
|
||||
|
||||
```bash
|
||||
specify preset enable <preset_id>
|
||||
specify preset disable <preset_id>
|
||||
```
|
||||
|
||||
Disable a preset without removing it. Disabled presets are skipped during file resolution but their commands remain registered. Re-enable with `enable`.
|
||||
|
||||
## Set Preset Priority
|
||||
|
||||
```bash
|
||||
specify preset set-priority <preset_id> <priority>
|
||||
```
|
||||
|
||||
Changes the resolution priority of an installed preset. Lower numbers take precedence. When multiple presets provide the same file, the one with the lowest priority number wins.
|
||||
|
||||
## Catalog Management
|
||||
|
||||
Preset catalogs control where `search` and `add` look for presets. Catalogs are checked in priority order (lower number = higher precedence).
|
||||
|
||||
### List Catalogs
|
||||
|
||||
```bash
|
||||
specify preset catalog list
|
||||
```
|
||||
|
||||
Shows all active catalogs with their priorities and install permissions.
|
||||
|
||||
### Add a Catalog
|
||||
|
||||
```bash
|
||||
specify preset catalog add <url>
|
||||
```
|
||||
|
||||
| Option | Description |
|
||||
| -------------------------------------------- | -------------------------------------------------- |
|
||||
| `--name <name>` | Required. Unique name for the catalog |
|
||||
| `--priority <N>` | Priority (default: 10; lower = higher precedence) |
|
||||
| `--install-allowed / --no-install-allowed` | Whether presets can be installed from this catalog (default: discovery only) |
|
||||
| `--description <text>` | Optional description |
|
||||
|
||||
Adds a catalog to the project's `.specify/preset-catalogs.yml`.
|
||||
|
||||
### Remove a Catalog
|
||||
|
||||
```bash
|
||||
specify preset catalog remove <name>
|
||||
```
|
||||
|
||||
Removes a catalog from the project configuration.
|
||||
|
||||
### Catalog Resolution Order
|
||||
|
||||
Catalogs are resolved in this order (first match wins):
|
||||
|
||||
1. **Environment variable** — `SPECKIT_PRESET_CATALOG_URL` overrides all catalogs
|
||||
2. **Project config** — `.specify/preset-catalogs.yml`
|
||||
3. **User config** — `~/.specify/preset-catalogs.yml`
|
||||
4. **Built-in defaults** — official catalog + community catalog
|
||||
|
||||
Example `.specify/preset-catalogs.yml`:
|
||||
|
||||
```yaml
|
||||
catalogs:
|
||||
- name: "my-org-presets"
|
||||
url: "https://example.com/preset-catalog.json"
|
||||
priority: 5
|
||||
install_allowed: true
|
||||
description: "Our approved presets"
|
||||
```
|
||||
|
||||
## File Resolution
|
||||
|
||||
Presets can provide command files, template files (like `plan-template.md`), and script files. These are resolved at runtime using a **replace** strategy — the first match in the priority stack wins and is used entirely. Each file is looked up independently, so different files can come from different layers.
|
||||
|
||||
> **Note:** Additional composition strategies (`append`, `prepend`, `wrap`) are planned for a future release.
|
||||
|
||||
The resolution stack, from highest to lowest precedence:
|
||||
|
||||
1. **Project-local overrides** — `.specify/templates/overrides/`
|
||||
2. **Installed presets** — sorted by priority (lower = checked first)
|
||||
3. **Installed extensions** — sorted by priority
|
||||
4. **Spec Kit core** — `.specify/templates/`
|
||||
|
||||
Commands are registered at install time (not resolved through the stack at runtime).
|
||||
|
||||
### Resolution Stack
|
||||
|
||||
```mermaid
|
||||
flowchart TB
|
||||
subgraph stack [" "]
|
||||
direction TB
|
||||
A["⬆ Highest precedence<br/><br/>1. Project-local overrides<br/>.specify/templates/overrides/"]
|
||||
B["2. Presets — by priority<br/>.specify/presets/‹id›/"]
|
||||
C["3. Extensions — by priority<br/>.specify/extensions/‹id›/"]
|
||||
D["4. Spec Kit core<br/>.specify/templates/<br/><br/>⬇ Lowest precedence"]
|
||||
end
|
||||
|
||||
A --> B --> C --> D
|
||||
|
||||
style A fill:#4a9,color:#fff
|
||||
style B fill:#49a,color:#fff
|
||||
style C fill:#a94,color:#fff
|
||||
style D fill:#999,color:#fff
|
||||
```
|
||||
|
||||
Within each layer, files are organized by type:
|
||||
|
||||
| Type | Subdirectory | Override path |
|
||||
| --------- | -------------- | ------------------------------------------ |
|
||||
| Templates | `templates/` | `.specify/templates/overrides/` |
|
||||
| Commands | `commands/` | `.specify/templates/overrides/` |
|
||||
| Scripts | `scripts/` | `.specify/templates/overrides/scripts/` |
|
||||
|
||||
### Resolution in Action
|
||||
|
||||
```mermaid
|
||||
flowchart TB
|
||||
A["File requested:<br/>plan-template.md"] --> B{"Project-local override?"}
|
||||
B -- Found --> Z["✓ Use this file"]
|
||||
B -- Not found --> C{"Preset: compliance<br/>(priority 5)"}
|
||||
C -- Found --> Z
|
||||
C -- Not found --> D{"Preset: team-workflow<br/>(priority 10)"}
|
||||
D -- Found --> Z
|
||||
D -- Not found --> E{"Extension files?"}
|
||||
E -- Found --> Z
|
||||
E -- Not found --> F["Spec Kit core"]
|
||||
F --> Z
|
||||
```
|
||||
|
||||
### Example
|
||||
|
||||
```bash
|
||||
specify preset add compliance --priority 5
|
||||
specify preset add team-workflow --priority 10
|
||||
```
|
||||
|
||||
For any file that both provide, `compliance` wins (priority 5 < 10). For files only one provides, that one is used. For files neither provides, the core default is used.
|
||||
|
||||
## FAQ
|
||||
|
||||
### Can I use multiple presets at the same time?
|
||||
|
||||
Yes. Presets stack by priority — each file is resolved independently from the highest-priority source that provides it. Use `specify preset set-priority` to control the order.
|
||||
|
||||
### How do I see which file is actually being used?
|
||||
|
||||
Run `specify preset resolve <name>` to trace the resolution stack and see which file wins.
|
||||
|
||||
### What's the difference between disabling and removing a preset?
|
||||
|
||||
**Disabling** (`specify preset disable`) keeps the preset installed but excludes its files from the resolution stack. Commands the preset registered remain available in your AI coding agent. This is useful for temporarily testing behavior without a preset, or comparing output with and without it. Re-enable anytime with `specify preset enable`.
|
||||
|
||||
**Removing** (`specify preset remove`) fully uninstalls the preset — deletes its files, unregisters its commands from your AI coding agent, and removes it from the registry.
|
||||
|
||||
### Who maintains presets?
|
||||
|
||||
Most presets are independently created and maintained by their respective authors. The Spec Kit maintainers do not review, audit, endorse, or support preset code. Review a preset's source code before installing and use at your own discretion. For issues with a specific preset, contact its author or file an issue on the preset's repository.
|
||||
289
docs/reference/workflows.md
Normal file
289
docs/reference/workflows.md
Normal file
@@ -0,0 +1,289 @@
|
||||
# Workflows
|
||||
|
||||
Workflows automate multi-step Spec-Driven Development processes — chaining commands, prompts, shell steps, and human checkpoints into repeatable sequences. They support conditional logic, loops, fan-out/fan-in, and can be paused and resumed from the exact point of interruption.
|
||||
|
||||
## Run a Workflow
|
||||
|
||||
```bash
|
||||
specify workflow run <source>
|
||||
```
|
||||
|
||||
| Option | Description |
|
||||
| ------------------- | -------------------------------------------------------- |
|
||||
| `-i` / `--input` | Pass input values as `key=value` (repeatable) |
|
||||
|
||||
Runs a workflow from a catalog ID, URL, or local file path. Inputs declared by the workflow can be provided via `--input` or will be prompted interactively.
|
||||
|
||||
Example:
|
||||
|
||||
```bash
|
||||
specify workflow run speckit -i spec="Build a kanban board with drag-and-drop task management" -i scope=full
|
||||
```
|
||||
|
||||
> **Note:** All workflow commands require a project already initialized with `specify init`.
|
||||
|
||||
## Resume a Workflow
|
||||
|
||||
```bash
|
||||
specify workflow resume <run_id>
|
||||
```
|
||||
|
||||
Resumes a paused or failed workflow run from the exact step where it stopped. Useful after responding to a gate step or fixing an issue that caused a failure.
|
||||
|
||||
## Workflow Status
|
||||
|
||||
```bash
|
||||
specify workflow status [<run_id>]
|
||||
```
|
||||
|
||||
Shows the status of a specific run, or lists all runs if no ID is given. Run states: `created`, `running`, `completed`, `paused`, `failed`, `aborted`.
|
||||
|
||||
## List Installed Workflows
|
||||
|
||||
```bash
|
||||
specify workflow list
|
||||
```
|
||||
|
||||
Lists workflows installed in the current project.
|
||||
|
||||
## Install a Workflow
|
||||
|
||||
```bash
|
||||
specify workflow add <source>
|
||||
```
|
||||
|
||||
Installs a workflow from the catalog, a URL (HTTPS required), or a local file path.
|
||||
|
||||
## Remove a Workflow
|
||||
|
||||
```bash
|
||||
specify workflow remove <workflow_id>
|
||||
```
|
||||
|
||||
Removes an installed workflow from the project.
|
||||
|
||||
## Search Available Workflows
|
||||
|
||||
```bash
|
||||
specify workflow search [query]
|
||||
```
|
||||
|
||||
| Option | Description |
|
||||
| ------- | --------------- |
|
||||
| `--tag` | Filter by tag |
|
||||
|
||||
Searches all active catalogs for workflows matching the query.
|
||||
|
||||
## Workflow Info
|
||||
|
||||
```bash
|
||||
specify workflow info <workflow_id>
|
||||
```
|
||||
|
||||
Shows detailed information about a workflow, including its steps, inputs, and requirements.
|
||||
|
||||
## Catalog Management
|
||||
|
||||
Workflow catalogs control where `search` and `add` look for workflows. Catalogs are checked in priority order.
|
||||
|
||||
### List Catalogs
|
||||
|
||||
```bash
|
||||
specify workflow catalog list
|
||||
```
|
||||
|
||||
Shows all active catalog sources.
|
||||
|
||||
### Add a Catalog
|
||||
|
||||
```bash
|
||||
specify workflow catalog add <url>
|
||||
```
|
||||
|
||||
| Option | Description |
|
||||
| --------------- | -------------------------------- |
|
||||
| `--name <name>` | Optional name for the catalog |
|
||||
|
||||
Adds a custom catalog URL to the project's `.specify/workflow-catalogs.yml`.
|
||||
|
||||
### Remove a Catalog
|
||||
|
||||
```bash
|
||||
specify workflow catalog remove <index>
|
||||
```
|
||||
|
||||
Removes a catalog by its index in the catalog list.
|
||||
|
||||
### Catalog Resolution Order
|
||||
|
||||
Catalogs are resolved in this order (first match wins):
|
||||
|
||||
1. **Environment variable** — `SPECKIT_WORKFLOW_CATALOG_URL` overrides all catalogs
|
||||
2. **Project config** — `.specify/workflow-catalogs.yml`
|
||||
3. **User config** — `~/.specify/workflow-catalogs.yml`
|
||||
4. **Built-in defaults** — official catalog + community catalog
|
||||
|
||||
## Workflow Definition
|
||||
|
||||
Workflows are defined in YAML files. Here is the built-in **Full SDD Cycle** workflow that ships with Spec Kit:
|
||||
|
||||
```yaml
|
||||
schema_version: "1.0"
|
||||
workflow:
|
||||
id: "speckit"
|
||||
name: "Full SDD Cycle"
|
||||
version: "1.0.0"
|
||||
author: "GitHub"
|
||||
description: "Runs specify → plan → tasks → implement with review gates"
|
||||
|
||||
requires:
|
||||
speckit_version: ">=0.7.2"
|
||||
integrations:
|
||||
any: ["copilot", "claude", "gemini"]
|
||||
|
||||
inputs:
|
||||
spec:
|
||||
type: string
|
||||
required: true
|
||||
prompt: "Describe what you want to build"
|
||||
integration:
|
||||
type: string
|
||||
default: "copilot"
|
||||
prompt: "Integration to use (e.g. claude, copilot, gemini)"
|
||||
scope:
|
||||
type: string
|
||||
default: "full"
|
||||
enum: ["full", "backend-only", "frontend-only"]
|
||||
|
||||
steps:
|
||||
- id: specify
|
||||
command: speckit.specify
|
||||
integration: "{{ inputs.integration }}"
|
||||
input:
|
||||
args: "{{ inputs.spec }}"
|
||||
|
||||
- id: review-spec
|
||||
type: gate
|
||||
message: "Review the generated spec before planning."
|
||||
options: [approve, reject]
|
||||
on_reject: abort
|
||||
|
||||
- id: plan
|
||||
command: speckit.plan
|
||||
integration: "{{ inputs.integration }}"
|
||||
input:
|
||||
args: "{{ inputs.spec }}"
|
||||
|
||||
- id: review-plan
|
||||
type: gate
|
||||
message: "Review the plan before generating tasks."
|
||||
options: [approve, reject]
|
||||
on_reject: abort
|
||||
|
||||
- id: tasks
|
||||
command: speckit.tasks
|
||||
integration: "{{ inputs.integration }}"
|
||||
input:
|
||||
args: "{{ inputs.spec }}"
|
||||
|
||||
- id: implement
|
||||
command: speckit.implement
|
||||
integration: "{{ inputs.integration }}"
|
||||
input:
|
||||
args: "{{ inputs.spec }}"
|
||||
```
|
||||
|
||||
This produces the following execution flow:
|
||||
|
||||
```mermaid
|
||||
flowchart TB
|
||||
A["specify<br/>(command)"] --> B{"review-spec<br/>(gate)"}
|
||||
B -- approve --> C["plan<br/>(command)"]
|
||||
B -- reject --> X1["⏹ Abort"]
|
||||
C --> D{"review-plan<br/>(gate)"}
|
||||
D -- approve --> E["tasks<br/>(command)"]
|
||||
D -- reject --> X2["⏹ Abort"]
|
||||
E --> F["implement<br/>(command)"]
|
||||
|
||||
style A fill:#49a,color:#fff
|
||||
style B fill:#a94,color:#fff
|
||||
style C fill:#49a,color:#fff
|
||||
style D fill:#a94,color:#fff
|
||||
style E fill:#49a,color:#fff
|
||||
style F fill:#49a,color:#fff
|
||||
style X1 fill:#999,color:#fff
|
||||
style X2 fill:#999,color:#fff
|
||||
```
|
||||
|
||||
Run it with:
|
||||
|
||||
```bash
|
||||
specify workflow run speckit -i spec="Build a kanban board with drag-and-drop task management"
|
||||
```
|
||||
|
||||
## Step Types
|
||||
|
||||
| Type | Purpose |
|
||||
| ------------ | ------------------------------------------------ |
|
||||
| `command` | Invoke a Spec Kit command (e.g., `speckit.plan`) |
|
||||
| `prompt` | Send an arbitrary prompt to the AI coding agent |
|
||||
| `shell` | Execute a shell command and capture output |
|
||||
| `gate` | Pause for human approval before continuing |
|
||||
| `if` | Conditional branching (then/else) |
|
||||
| `switch` | Multi-branch dispatch on an expression |
|
||||
| `while` | Loop while a condition is true |
|
||||
| `do-while` | Execute at least once, then loop on condition |
|
||||
| `fan-out` | Dispatch a step for each item in a list |
|
||||
| `fan-in` | Aggregate results from a fan-out step |
|
||||
|
||||
## Expressions
|
||||
|
||||
Steps can reference inputs and previous step outputs using `{{ expression }}` syntax:
|
||||
|
||||
| Namespace | Description |
|
||||
| ------------------------------ | ------------------------------------ |
|
||||
| `inputs.spec` | Workflow input values |
|
||||
| `steps.specify.output.file` | Output from a previous step |
|
||||
| `item` | Current item in a fan-out iteration |
|
||||
|
||||
Available filters: `default`, `join`, `contains`, `map`.
|
||||
|
||||
Example:
|
||||
|
||||
```yaml
|
||||
condition: "{{ steps.test.output.exit_code == 0 }}"
|
||||
args: "{{ inputs.spec }}"
|
||||
message: "{{ status | default('pending') }}"
|
||||
```
|
||||
|
||||
## Input Types
|
||||
|
||||
| Type | Coercion |
|
||||
| --------- | ------------------------------------------------- |
|
||||
| `string` | Pass-through |
|
||||
| `number` | `"42"` → `42`, `"3.14"` → `3.14` |
|
||||
| `boolean` | `"true"` / `"1"` / `"yes"` → `True` |
|
||||
|
||||
## State and Resume
|
||||
|
||||
Each workflow run persists its state at `.specify/workflows/runs/<run_id>/`:
|
||||
|
||||
- `state.json` — current run state and step progress
|
||||
- `inputs.json` — resolved input values
|
||||
- `log.jsonl` — step-by-step execution log
|
||||
|
||||
This enables `specify workflow resume` to continue from the exact step where a run was paused (e.g., at a gate) or failed.
|
||||
|
||||
## FAQ
|
||||
|
||||
### What happens when a workflow hits a gate step?
|
||||
|
||||
The workflow pauses and waits for human input. Run `specify workflow resume <run_id>` after reviewing to continue.
|
||||
|
||||
### Can I run the same workflow multiple times?
|
||||
|
||||
Yes. Each run gets a unique ID and its own state directory. Use `specify workflow status` to see all runs.
|
||||
|
||||
### Who maintains workflows?
|
||||
|
||||
Most workflows are independently created and maintained by their respective authors. The Spec Kit maintainers do not review, audit, endorse, or support workflow code. Review a workflow's source before installing and use at your own discretion.
|
||||
16
docs/toc.yml
16
docs/toc.yml
@@ -12,6 +12,22 @@
|
||||
- name: Upgrade
|
||||
href: upgrade.md
|
||||
|
||||
# Reference
|
||||
- name: Reference
|
||||
items:
|
||||
- name: Overview
|
||||
href: reference/overview.md
|
||||
- name: Core Commands
|
||||
href: reference/core.md
|
||||
- name: Integrations
|
||||
href: reference/integrations.md
|
||||
- name: Extensions
|
||||
href: reference/extensions.md
|
||||
- name: Presets
|
||||
href: reference/presets.md
|
||||
- name: Workflows
|
||||
href: reference/workflows.md
|
||||
|
||||
# Development workflows
|
||||
- name: Development
|
||||
items:
|
||||
|
||||
@@ -76,7 +76,7 @@ Run this inside your project directory:
|
||||
specify init --here --force --ai <your-agent>
|
||||
```
|
||||
|
||||
Replace `<your-agent>` with your AI assistant. Refer to this list of [Supported AI Agents](../README.md#-supported-ai-agents)
|
||||
Replace `<your-agent>` with your AI coding agent. Refer to this list of [Supported AI Coding Agent Integrations](reference/integrations.md)
|
||||
|
||||
**Example:**
|
||||
|
||||
@@ -401,7 +401,7 @@ The `specify` CLI tool is used for:
|
||||
- **Upgrades:** `specify init --here --force` to update templates and commands
|
||||
- **Diagnostics:** `specify check` to verify tool installation
|
||||
|
||||
Once you've run `specify init`, the slash commands (like `/speckit.specify`, `/speckit.plan`, etc.) are **permanently installed** in your project's agent folder (`.claude/`, `.github/prompts/`, `.pi/prompts/`, etc.). Your AI assistant reads these command files directly—no need to run `specify` again.
|
||||
Once you've run `specify init`, the slash commands (like `/speckit.specify`, `/speckit.plan`, etc.) are **permanently installed** in your project's agent folder (`.claude/`, `.github/prompts/`, `.pi/prompts/`, etc.). Your AI coding agent reads these command files directly—no need to run `specify` again.
|
||||
|
||||
**If your agent isn't recognizing slash commands:**
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"schema_version": "1.0",
|
||||
"updated_at": "2026-04-14T21:30:00Z",
|
||||
"updated_at": "2026-04-16T18:00:00Z",
|
||||
"catalog_url": "https://raw.githubusercontent.com/github/spec-kit/main/extensions/catalog.community.json",
|
||||
"extensions": {
|
||||
"aide": {
|
||||
@@ -301,6 +301,38 @@
|
||||
"created_at": "2026-03-29T00:00:00Z",
|
||||
"updated_at": "2026-03-29T00:00:00Z"
|
||||
},
|
||||
"catalog-ci": {
|
||||
"name": "Catalog CI",
|
||||
"id": "catalog-ci",
|
||||
"description": "Automated validation for spec-kit community catalog entries — structure, URLs, diffs, and linting.",
|
||||
"author": "Quratulain-bilal",
|
||||
"version": "1.0.0",
|
||||
"download_url": "https://github.com/Quratulain-bilal/spec-kit-catalog-ci/archive/refs/tags/v1.0.0.zip",
|
||||
"repository": "https://github.com/Quratulain-bilal/spec-kit-catalog-ci",
|
||||
"homepage": "https://github.com/Quratulain-bilal/spec-kit-catalog-ci",
|
||||
"documentation": "https://github.com/Quratulain-bilal/spec-kit-catalog-ci/blob/main/README.md",
|
||||
"changelog": "https://github.com/Quratulain-bilal/spec-kit-catalog-ci/blob/main/CHANGELOG.md",
|
||||
"license": "MIT",
|
||||
"requires": {
|
||||
"speckit_version": ">=0.4.0"
|
||||
},
|
||||
"provides": {
|
||||
"commands": 4,
|
||||
"hooks": 0
|
||||
},
|
||||
"tags": [
|
||||
"ci",
|
||||
"validation",
|
||||
"catalog",
|
||||
"quality",
|
||||
"automation"
|
||||
],
|
||||
"verified": false,
|
||||
"downloads": 0,
|
||||
"stars": 0,
|
||||
"created_at": "2026-04-16T00:00:00Z",
|
||||
"updated_at": "2026-04-16T00:00:00Z"
|
||||
},
|
||||
"ci-guard": {
|
||||
"name": "CI Guard",
|
||||
"id": "ci-guard",
|
||||
@@ -714,7 +746,7 @@
|
||||
"updated_at": "2026-03-31T00:00:00Z"
|
||||
},
|
||||
"github-issues": {
|
||||
"name": "GitHub Issues Integration",
|
||||
"name": "GitHub Issues Integration 1",
|
||||
"id": "github-issues",
|
||||
"description": "Generate spec artifacts from GitHub Issues - import issues, sync updates, and maintain bidirectional traceability",
|
||||
"author": "Fatima367",
|
||||
@@ -753,6 +785,38 @@
|
||||
"created_at": "2026-04-12T15:30:00Z",
|
||||
"updated_at": "2026-04-13T14:39:00Z"
|
||||
},
|
||||
"issue": {
|
||||
"name": "GitHub Issues Integration 2",
|
||||
"id": "issue",
|
||||
"description": "Creates and syncs local specs based on an existing issue in GitHub",
|
||||
"author": "aaronrsun",
|
||||
"version": "1.0.0",
|
||||
"download_url": "https://github.com/aaronrsun/spec-kit-issue/archive/refs/tags/v1.0.0.zip",
|
||||
"repository": "https://github.com/aaronrsun/spec-kit-issue",
|
||||
"homepage": "https://github.com/aaronrsun/spec-kit-issue",
|
||||
"documentation": "https://github.com/aaronrsun/spec-kit-issue/blob/main/README.md",
|
||||
"changelog": "https://github.com/aaronrsun/spec-kit-issue/blob/main/CHANGELOG.md",
|
||||
"license": "MIT",
|
||||
"requires": {
|
||||
"speckit_version": ">=0.1.0"
|
||||
},
|
||||
"provides": {
|
||||
"commands": 3,
|
||||
"hooks": 0
|
||||
},
|
||||
"tags": [
|
||||
"issue",
|
||||
"integration",
|
||||
"github",
|
||||
"issues",
|
||||
"sync"
|
||||
],
|
||||
"verified": false,
|
||||
"downloads": 0,
|
||||
"stars": 0,
|
||||
"created_at": "2026-04-04T00:00:00Z",
|
||||
"updated_at": "2026-04-04T00:00:00Z"
|
||||
},
|
||||
"iterate": {
|
||||
"name": "Iterate",
|
||||
"id": "iterate",
|
||||
@@ -1076,8 +1140,8 @@
|
||||
"id": "memorylint",
|
||||
"description": "Agent memory governance tool: Automatically audits and fixes boundary conflicts between AGENTS.md and the constitution.",
|
||||
"author": "RbBtSn0w",
|
||||
"version": "1.0.0",
|
||||
"download_url": "https://github.com/RbBtSn0w/spec-kit-extensions/archive/refs/tags/v1.0.0.zip",
|
||||
"version": "1.3.0",
|
||||
"download_url": "https://github.com/RbBtSn0w/spec-kit-extensions/releases/download/memorylint-v1.3.0/memorylint.zip",
|
||||
"repository": "https://github.com/RbBtSn0w/spec-kit-extensions",
|
||||
"homepage": "https://github.com/RbBtSn0w/spec-kit-extensions/tree/main/memorylint",
|
||||
"documentation": "https://github.com/RbBtSn0w/spec-kit-extensions/blob/main/memorylint/README.md",
|
||||
@@ -1101,7 +1165,7 @@
|
||||
"downloads": 0,
|
||||
"stars": 0,
|
||||
"created_at": "2026-04-09T00:00:00Z",
|
||||
"updated_at": "2026-04-09T00:00:00Z"
|
||||
"updated_at": "2026-04-16T13:10:26Z"
|
||||
},
|
||||
"onboard": {
|
||||
"name": "Onboard",
|
||||
@@ -1829,8 +1893,8 @@
|
||||
"id": "superb",
|
||||
"description": "Orchestrates obra/superpowers skills within the spec-kit SDD workflow. Thin bridge commands delegate to superpowers' authoritative SKILL.md files at runtime (with graceful fallback), while bridge-original commands provide spec-kit-native value. Eight commands cover the full lifecycle: intent clarification, TDD enforcement, task review, verification, critique, systematic debugging, branch completion, and review response. Hook-bound commands fire automatically; standalone commands are invoked when needed.",
|
||||
"author": "rbbtsn0w",
|
||||
"version": "1.0.0",
|
||||
"download_url": "https://github.com/RbBtSn0w/spec-kit-extensions/releases/download/superpowers-bridge-v1.0.0/superpowers-bridge.zip",
|
||||
"version": "1.3.0",
|
||||
"download_url": "https://github.com/RbBtSn0w/spec-kit-extensions/releases/download/superpowers-bridge-v1.3.0/superpowers-bridge.zip",
|
||||
"repository": "https://github.com/RbBtSn0w/spec-kit-extensions",
|
||||
"homepage": "https://github.com/RbBtSn0w/spec-kit-extensions",
|
||||
"documentation": "https://github.com/RbBtSn0w/spec-kit-extensions/blob/main/superpowers-bridge/README.md",
|
||||
@@ -1865,7 +1929,7 @@
|
||||
"downloads": 0,
|
||||
"stars": 0,
|
||||
"created_at": "2026-03-30T00:00:00Z",
|
||||
"updated_at": "2026-03-30T00:00:00Z"
|
||||
"updated_at": "2026-04-16T14:08:23Z"
|
||||
},
|
||||
"sync": {
|
||||
"name": "Spec Sync",
|
||||
|
||||
142
integrations/CONTRIBUTING.md
Normal file
142
integrations/CONTRIBUTING.md
Normal file
@@ -0,0 +1,142 @@
|
||||
# Contributing to the Integration Catalog
|
||||
|
||||
This guide covers adding integrations to both the **built-in** and **community** catalogs.
|
||||
|
||||
## Adding a Built-In Integration
|
||||
|
||||
Built-in integrations are maintained by the Spec Kit core team and ship with the CLI.
|
||||
|
||||
### Checklist
|
||||
|
||||
1. **Create the integration subpackage** under `src/specify_cli/integrations/<package_dir>/`
|
||||
— `<package_dir>` matches the integration key when it contains no hyphens (e.g., `gemini`), or replaces hyphens with underscores when it does (e.g., key `cursor-agent` → directory `cursor_agent/`, key `kiro-cli` → directory `kiro_cli/`). Python package names cannot use hyphens.
|
||||
2. **Implement the integration class** extending `MarkdownIntegration`, `TomlIntegration`, or `SkillsIntegration`
|
||||
3. **Register the integration** in `src/specify_cli/integrations/__init__.py`
|
||||
4. **Add tests** under `tests/integrations/test_integration_<package_dir>.py`
|
||||
5. **Add a catalog entry** in `integrations/catalog.json`
|
||||
6. **Update documentation** in `AGENTS.md` and `README.md`
|
||||
|
||||
### Catalog Entry Format
|
||||
|
||||
Add your integration under the top-level `integrations` key in `integrations/catalog.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
"schema_version": "1.0",
|
||||
"integrations": {
|
||||
"my-agent": {
|
||||
"id": "my-agent",
|
||||
"name": "My Agent",
|
||||
"version": "1.0.0",
|
||||
"description": "Integration for My Agent",
|
||||
"author": "spec-kit-core",
|
||||
"repository": "https://github.com/github/spec-kit",
|
||||
"tags": ["cli"]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Adding a Community Integration
|
||||
|
||||
Community integrations are contributed by external developers and listed in `integrations/catalog.community.json` for discovery.
|
||||
|
||||
### Prerequisites
|
||||
|
||||
1. **Working integration** — tested with `specify integration install`
|
||||
2. **Public repository** — hosted on GitHub or similar
|
||||
3. **`integration.yml` descriptor** — valid descriptor file (see below)
|
||||
4. **Documentation** — README with usage instructions
|
||||
5. **License** — open source license file
|
||||
|
||||
### `integration.yml` Descriptor
|
||||
|
||||
Every community integration must include an `integration.yml`:
|
||||
|
||||
```yaml
|
||||
schema_version: "1.0"
|
||||
integration:
|
||||
id: "my-agent"
|
||||
name: "My Agent"
|
||||
version: "1.0.0"
|
||||
description: "Integration for My Agent"
|
||||
author: "your-name"
|
||||
repository: "https://github.com/your-name/speckit-my-agent"
|
||||
license: "MIT"
|
||||
requires:
|
||||
speckit_version: ">=0.6.0"
|
||||
tools:
|
||||
- name: "my-agent"
|
||||
version: ">=1.0.0"
|
||||
required: true
|
||||
provides:
|
||||
commands:
|
||||
- name: "speckit.specify"
|
||||
file: "templates/speckit.specify.md"
|
||||
scripts:
|
||||
- update-context.sh
|
||||
```
|
||||
|
||||
### Descriptor Validation Rules
|
||||
|
||||
| Field | Rule |
|
||||
|-------|------|
|
||||
| `schema_version` | Must be `"1.0"` |
|
||||
| `integration.id` | Lowercase alphanumeric + hyphens (`^[a-z0-9-]+$`) |
|
||||
| `integration.version` | Valid PEP 440 version (parsed with `packaging.version.Version()`) |
|
||||
| `requires.speckit_version` | Required field; specify a version constraint such as `>=0.6.0` (current validation checks presence only) |
|
||||
| `provides` | Must include at least one command or script |
|
||||
| `provides.commands[].name` | String identifier |
|
||||
| `provides.commands[].file` | Relative path to template file |
|
||||
|
||||
### Submitting to the Community Catalog
|
||||
|
||||
1. **Fork** the [spec-kit repository](https://github.com/github/spec-kit)
|
||||
2. **Add your entry** under the `integrations` key in `integrations/catalog.community.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
"schema_version": "1.0",
|
||||
"integrations": {
|
||||
"my-agent": {
|
||||
"id": "my-agent",
|
||||
"name": "My Agent",
|
||||
"version": "1.0.0",
|
||||
"description": "Integration for My Agent",
|
||||
"author": "your-name",
|
||||
"repository": "https://github.com/your-name/speckit-my-agent",
|
||||
"tags": ["cli"]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
3. **Open a pull request** with:
|
||||
- Your catalog entry
|
||||
- Link to your integration repository
|
||||
- Confirmation that `integration.yml` is valid
|
||||
|
||||
### Version Updates
|
||||
|
||||
To update your integration version in the catalog:
|
||||
|
||||
1. Release a new version of your integration
|
||||
2. Open a PR updating the `version` field in `catalog.community.json`
|
||||
3. Ensure backward compatibility or document breaking changes
|
||||
|
||||
## Upgrade Workflow
|
||||
|
||||
The `specify integration upgrade` command supports diff-aware upgrades:
|
||||
|
||||
1. **Hash comparison** — the manifest records SHA-256 hashes of all installed files
|
||||
2. **Modified file detection** — files changed since installation are flagged
|
||||
3. **Safe default** — the upgrade blocks if any installed files were modified since installation
|
||||
4. **Forced reinstall** — passing `--force` overwrites modified files with the latest version
|
||||
|
||||
```bash
|
||||
# Upgrade current integration (blocks if files are modified)
|
||||
specify integration upgrade
|
||||
|
||||
# Force upgrade (overwrites modified files)
|
||||
specify integration upgrade --force
|
||||
```
|
||||
129
integrations/README.md
Normal file
129
integrations/README.md
Normal file
@@ -0,0 +1,129 @@
|
||||
# Spec Kit Integration Catalog
|
||||
|
||||
The integration catalog enables discovery, versioning, and distribution of AI agent integrations for Spec Kit.
|
||||
|
||||
## Catalog Files
|
||||
|
||||
### Built-In Catalog (`catalog.json`)
|
||||
|
||||
Contains integrations that ship with Spec Kit. These are maintained by the core team and always installable.
|
||||
|
||||
### Community Catalog (`catalog.community.json`)
|
||||
|
||||
Community-contributed integrations. Listed for discovery only — users install from the source repositories.
|
||||
|
||||
## Catalog Configuration
|
||||
|
||||
The catalog stack is resolved in this order (first match wins):
|
||||
|
||||
1. **Environment variable** — `SPECKIT_INTEGRATION_CATALOG_URL` overrides all catalogs with a single URL
|
||||
2. **Project config** — `.specify/integration-catalogs.yml` in the project root
|
||||
3. **User config** — `~/.specify/integration-catalogs.yml` in the user home directory
|
||||
4. **Built-in defaults** — `catalog.json` + `catalog.community.json`
|
||||
|
||||
Example `integration-catalogs.yml`:
|
||||
|
||||
```yaml
|
||||
catalogs:
|
||||
- url: "https://example.com/my-catalog.json"
|
||||
name: "my-catalog"
|
||||
priority: 1
|
||||
install_allowed: true
|
||||
```
|
||||
|
||||
## CLI Commands
|
||||
|
||||
```bash
|
||||
# List built-in integrations (default)
|
||||
specify integration list
|
||||
|
||||
# Browse full catalog (built-in + community)
|
||||
specify integration list --catalog
|
||||
|
||||
# Install an integration
|
||||
specify integration install copilot
|
||||
|
||||
# Upgrade the current integration (diff-aware)
|
||||
specify integration upgrade
|
||||
|
||||
# Upgrade with force (overwrite modified files)
|
||||
specify integration upgrade --force
|
||||
```
|
||||
|
||||
## Integration Descriptor (`integration.yml`)
|
||||
|
||||
Each integration can include an `integration.yml` descriptor that documents its metadata, requirements, and provided commands/scripts:
|
||||
|
||||
```yaml
|
||||
schema_version: "1.0"
|
||||
integration:
|
||||
id: "my-agent"
|
||||
name: "My Agent"
|
||||
version: "1.0.0"
|
||||
description: "Integration for My Agent"
|
||||
author: "my-org"
|
||||
repository: "https://github.com/my-org/speckit-my-agent"
|
||||
license: "MIT"
|
||||
requires:
|
||||
speckit_version: ">=0.6.0"
|
||||
tools:
|
||||
- name: "my-agent"
|
||||
version: ">=1.0.0"
|
||||
required: true
|
||||
provides:
|
||||
commands:
|
||||
- name: "speckit.specify"
|
||||
file: "templates/speckit.specify.md"
|
||||
- name: "speckit.plan"
|
||||
file: "templates/speckit.plan.md"
|
||||
scripts:
|
||||
- update-context.sh
|
||||
- update-context.ps1
|
||||
```
|
||||
|
||||
## Catalog Schema
|
||||
|
||||
Both catalog files follow the same JSON schema:
|
||||
|
||||
```json
|
||||
{
|
||||
"schema_version": "1.0",
|
||||
"updated_at": "2026-04-08T00:00:00Z",
|
||||
"catalog_url": "https://...",
|
||||
"integrations": {
|
||||
"my-agent": {
|
||||
"id": "my-agent",
|
||||
"name": "My Agent",
|
||||
"version": "1.0.0",
|
||||
"description": "Integration for My Agent",
|
||||
"author": "my-org",
|
||||
"repository": "https://github.com/my-org/speckit-my-agent",
|
||||
"tags": ["cli"]
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Required Fields
|
||||
|
||||
| Field | Type | Description |
|
||||
|-------|------|-------------|
|
||||
| `schema_version` | string | Must be `"1.0"` |
|
||||
| `updated_at` | string | ISO 8601 timestamp |
|
||||
| `integrations` | object | Map of integration ID → metadata |
|
||||
|
||||
### Integration Entry Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
|-------|------|----------|-------------|
|
||||
| `id` | string | Yes | Unique ID (lowercase alphanumeric + hyphens) |
|
||||
| `name` | string | Yes | Human-readable display name |
|
||||
| `version` | string | Yes | PEP 440 version (e.g., `1.0.0`, `1.0.0a1`) |
|
||||
| `description` | string | Yes | One-line description |
|
||||
| `author` | string | No | Author name or organization |
|
||||
| `repository` | string | No | Source repository URL |
|
||||
| `tags` | array | No | Searchable tags (e.g., `["cli", "ide"]`) |
|
||||
|
||||
## Contributing
|
||||
|
||||
See [CONTRIBUTING.md](CONTRIBUTING.md) for how to add integrations to the community catalog.
|
||||
6
integrations/catalog.community.json
Normal file
6
integrations/catalog.community.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"schema_version": "1.0",
|
||||
"updated_at": "2026-04-08T00:00:00Z",
|
||||
"catalog_url": "https://raw.githubusercontent.com/github/spec-kit/main/integrations/catalog.community.json",
|
||||
"integrations": {}
|
||||
}
|
||||
259
integrations/catalog.json
Normal file
259
integrations/catalog.json
Normal file
@@ -0,0 +1,259 @@
|
||||
{
|
||||
"schema_version": "1.0",
|
||||
"updated_at": "2026-04-08T00:00:00Z",
|
||||
"catalog_url": "https://raw.githubusercontent.com/github/spec-kit/main/integrations/catalog.json",
|
||||
"integrations": {
|
||||
"claude": {
|
||||
"id": "claude",
|
||||
"name": "Claude Code",
|
||||
"version": "1.0.0",
|
||||
"description": "Anthropic Claude Code CLI integration",
|
||||
"author": "spec-kit-core",
|
||||
"repository": "https://github.com/github/spec-kit",
|
||||
"tags": ["cli", "anthropic"]
|
||||
},
|
||||
"copilot": {
|
||||
"id": "copilot",
|
||||
"name": "GitHub Copilot",
|
||||
"version": "1.0.0",
|
||||
"description": "GitHub Copilot IDE integration with agent commands and prompt files",
|
||||
"author": "spec-kit-core",
|
||||
"repository": "https://github.com/github/spec-kit",
|
||||
"tags": ["ide", "github"]
|
||||
},
|
||||
"gemini": {
|
||||
"id": "gemini",
|
||||
"name": "Gemini CLI",
|
||||
"version": "1.0.0",
|
||||
"description": "Google Gemini CLI integration with TOML command format",
|
||||
"author": "spec-kit-core",
|
||||
"repository": "https://github.com/github/spec-kit",
|
||||
"tags": ["cli", "google"]
|
||||
},
|
||||
"cursor-agent": {
|
||||
"id": "cursor-agent",
|
||||
"name": "Cursor",
|
||||
"version": "1.0.0",
|
||||
"description": "Cursor IDE integration",
|
||||
"author": "spec-kit-core",
|
||||
"repository": "https://github.com/github/spec-kit",
|
||||
"tags": ["ide"]
|
||||
},
|
||||
"windsurf": {
|
||||
"id": "windsurf",
|
||||
"name": "Windsurf",
|
||||
"version": "1.0.0",
|
||||
"description": "Windsurf IDE workflow integration",
|
||||
"author": "spec-kit-core",
|
||||
"repository": "https://github.com/github/spec-kit",
|
||||
"tags": ["ide"]
|
||||
},
|
||||
"amp": {
|
||||
"id": "amp",
|
||||
"name": "Amp",
|
||||
"version": "1.0.0",
|
||||
"description": "Amp CLI integration",
|
||||
"author": "spec-kit-core",
|
||||
"repository": "https://github.com/github/spec-kit",
|
||||
"tags": ["cli"]
|
||||
},
|
||||
"codex": {
|
||||
"id": "codex",
|
||||
"name": "Codex CLI",
|
||||
"version": "1.0.0",
|
||||
"description": "Codex CLI skills-based integration",
|
||||
"author": "spec-kit-core",
|
||||
"repository": "https://github.com/github/spec-kit",
|
||||
"tags": ["cli", "skills"]
|
||||
},
|
||||
"qwen": {
|
||||
"id": "qwen",
|
||||
"name": "Qwen Code",
|
||||
"version": "1.0.0",
|
||||
"description": "Alibaba Qwen Code CLI integration",
|
||||
"author": "spec-kit-core",
|
||||
"repository": "https://github.com/github/spec-kit",
|
||||
"tags": ["cli", "alibaba"]
|
||||
},
|
||||
"opencode": {
|
||||
"id": "opencode",
|
||||
"name": "opencode",
|
||||
"version": "1.0.0",
|
||||
"description": "opencode CLI integration",
|
||||
"author": "spec-kit-core",
|
||||
"repository": "https://github.com/github/spec-kit",
|
||||
"tags": ["cli"]
|
||||
},
|
||||
"forge": {
|
||||
"id": "forge",
|
||||
"name": "Forge",
|
||||
"version": "1.0.0",
|
||||
"description": "Forge CLI integration with parameter-based commands",
|
||||
"author": "spec-kit-core",
|
||||
"repository": "https://github.com/github/spec-kit",
|
||||
"tags": ["cli"]
|
||||
},
|
||||
"kiro-cli": {
|
||||
"id": "kiro-cli",
|
||||
"name": "Kiro CLI",
|
||||
"version": "1.0.0",
|
||||
"description": "Kiro CLI prompt-based integration",
|
||||
"author": "spec-kit-core",
|
||||
"repository": "https://github.com/github/spec-kit",
|
||||
"tags": ["cli"]
|
||||
},
|
||||
"junie": {
|
||||
"id": "junie",
|
||||
"name": "Junie",
|
||||
"version": "1.0.0",
|
||||
"description": "Junie by JetBrains CLI integration",
|
||||
"author": "spec-kit-core",
|
||||
"repository": "https://github.com/github/spec-kit",
|
||||
"tags": ["cli", "jetbrains"]
|
||||
},
|
||||
"auggie": {
|
||||
"id": "auggie",
|
||||
"name": "Auggie CLI",
|
||||
"version": "1.0.0",
|
||||
"description": "Auggie CLI integration",
|
||||
"author": "spec-kit-core",
|
||||
"repository": "https://github.com/github/spec-kit",
|
||||
"tags": ["cli"]
|
||||
},
|
||||
"shai": {
|
||||
"id": "shai",
|
||||
"name": "SHAI",
|
||||
"version": "1.0.0",
|
||||
"description": "SHAI CLI integration",
|
||||
"author": "spec-kit-core",
|
||||
"repository": "https://github.com/github/spec-kit",
|
||||
"tags": ["cli"]
|
||||
},
|
||||
"tabnine": {
|
||||
"id": "tabnine",
|
||||
"name": "Tabnine CLI",
|
||||
"version": "1.0.0",
|
||||
"description": "Tabnine CLI integration with TOML command format",
|
||||
"author": "spec-kit-core",
|
||||
"repository": "https://github.com/github/spec-kit",
|
||||
"tags": ["cli"]
|
||||
},
|
||||
"kilocode": {
|
||||
"id": "kilocode",
|
||||
"name": "Kilo Code",
|
||||
"version": "1.0.0",
|
||||
"description": "Kilo Code IDE workflow integration",
|
||||
"author": "spec-kit-core",
|
||||
"repository": "https://github.com/github/spec-kit",
|
||||
"tags": ["ide"]
|
||||
},
|
||||
"roo": {
|
||||
"id": "roo",
|
||||
"name": "Roo Code",
|
||||
"version": "1.0.0",
|
||||
"description": "Roo Code IDE integration",
|
||||
"author": "spec-kit-core",
|
||||
"repository": "https://github.com/github/spec-kit",
|
||||
"tags": ["ide"]
|
||||
},
|
||||
"bob": {
|
||||
"id": "bob",
|
||||
"name": "IBM Bob",
|
||||
"version": "1.0.0",
|
||||
"description": "IBM Bob IDE integration",
|
||||
"author": "spec-kit-core",
|
||||
"repository": "https://github.com/github/spec-kit",
|
||||
"tags": ["ide", "ibm"]
|
||||
},
|
||||
"trae": {
|
||||
"id": "trae",
|
||||
"name": "Trae",
|
||||
"version": "1.0.0",
|
||||
"description": "Trae IDE rules-based integration",
|
||||
"author": "spec-kit-core",
|
||||
"repository": "https://github.com/github/spec-kit",
|
||||
"tags": ["ide"]
|
||||
},
|
||||
"codebuddy": {
|
||||
"id": "codebuddy",
|
||||
"name": "CodeBuddy",
|
||||
"version": "1.0.0",
|
||||
"description": "CodeBuddy CLI integration",
|
||||
"author": "spec-kit-core",
|
||||
"repository": "https://github.com/github/spec-kit",
|
||||
"tags": ["cli"]
|
||||
},
|
||||
"qodercli": {
|
||||
"id": "qodercli",
|
||||
"name": "Qoder CLI",
|
||||
"version": "1.0.0",
|
||||
"description": "Qoder CLI integration",
|
||||
"author": "spec-kit-core",
|
||||
"repository": "https://github.com/github/spec-kit",
|
||||
"tags": ["cli"]
|
||||
},
|
||||
"kimi": {
|
||||
"id": "kimi",
|
||||
"name": "Kimi Code",
|
||||
"version": "1.0.0",
|
||||
"description": "Kimi Code CLI skills-based integration by Moonshot AI",
|
||||
"author": "spec-kit-core",
|
||||
"repository": "https://github.com/github/spec-kit",
|
||||
"tags": ["cli", "skills"]
|
||||
},
|
||||
"pi": {
|
||||
"id": "pi",
|
||||
"name": "Pi Coding Agent",
|
||||
"version": "1.0.0",
|
||||
"description": "Pi terminal coding agent prompt-based integration",
|
||||
"author": "spec-kit-core",
|
||||
"repository": "https://github.com/github/spec-kit",
|
||||
"tags": ["cli"]
|
||||
},
|
||||
"iflow": {
|
||||
"id": "iflow",
|
||||
"name": "iFlow CLI",
|
||||
"version": "1.0.0",
|
||||
"description": "iFlow CLI integration by iflow-ai",
|
||||
"author": "spec-kit-core",
|
||||
"repository": "https://github.com/github/spec-kit",
|
||||
"tags": ["cli"]
|
||||
},
|
||||
"vibe": {
|
||||
"id": "vibe",
|
||||
"name": "Mistral Vibe",
|
||||
"version": "1.0.0",
|
||||
"description": "Mistral Vibe CLI prompt-based integration",
|
||||
"author": "spec-kit-core",
|
||||
"repository": "https://github.com/github/spec-kit",
|
||||
"tags": ["cli", "mistral"]
|
||||
},
|
||||
"agy": {
|
||||
"id": "agy",
|
||||
"name": "Antigravity",
|
||||
"version": "1.0.0",
|
||||
"description": "Antigravity IDE skills-based integration",
|
||||
"author": "spec-kit-core",
|
||||
"repository": "https://github.com/github/spec-kit",
|
||||
"tags": ["ide", "skills"]
|
||||
},
|
||||
"generic": {
|
||||
"id": "generic",
|
||||
"name": "Generic (bring your own agent)",
|
||||
"version": "1.0.0",
|
||||
"description": "Generic integration for any agent via --ai-commands-dir",
|
||||
"author": "spec-kit-core",
|
||||
"repository": "https://github.com/github/spec-kit",
|
||||
"tags": ["generic"]
|
||||
},
|
||||
"goose": {
|
||||
"id": "goose",
|
||||
"name": "Goose",
|
||||
"version": "1.0.0",
|
||||
"description": "Goose CLI integration with YAML recipe format",
|
||||
"author": "spec-kit-core",
|
||||
"repository": "https://github.com/github/spec-kit",
|
||||
"tags": ["cli"]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name = "specify-cli"
|
||||
version = "0.7.1.dev0"
|
||||
version = "0.7.2"
|
||||
description = "Specify CLI, part of GitHub Spec Kit. A tool to bootstrap your projects for Spec-Driven Development (SDD)."
|
||||
requires-python = ">=3.11"
|
||||
dependencies = [
|
||||
|
||||
@@ -351,8 +351,16 @@ def show_banner():
|
||||
console.print(Align.center(Text(TAGLINE, style="italic bright_yellow")))
|
||||
console.print()
|
||||
|
||||
def _version_callback(value: bool):
|
||||
if value:
|
||||
console.print(f"specify {get_speckit_version()}")
|
||||
raise typer.Exit()
|
||||
|
||||
@app.callback()
|
||||
def callback(ctx: typer.Context):
|
||||
def callback(
|
||||
ctx: typer.Context,
|
||||
version: bool = typer.Option(False, "--version", "-V", callback=_version_callback, is_eager=True, help="Show version and exit."),
|
||||
):
|
||||
"""Show banner when no subcommand is provided."""
|
||||
if ctx.invoked_subcommand is None and "--help" not in sys.argv and "-h" not in sys.argv:
|
||||
show_banner()
|
||||
@@ -1775,7 +1783,9 @@ def _resolve_script_type(project_root: Path, script_type: str | None) -> str:
|
||||
|
||||
|
||||
@integration_app.command("list")
|
||||
def integration_list():
|
||||
def integration_list(
|
||||
catalog: bool = typer.Option(False, "--catalog", help="Browse full catalog (built-in + community)"),
|
||||
):
|
||||
"""List available integrations and installed status."""
|
||||
from .integrations import INTEGRATION_REGISTRY
|
||||
|
||||
@@ -1790,6 +1800,50 @@ def integration_list():
|
||||
current = _read_integration_json(project_root)
|
||||
installed_key = current.get("integration")
|
||||
|
||||
if catalog:
|
||||
from .integrations.catalog import IntegrationCatalog, IntegrationCatalogError
|
||||
|
||||
ic = IntegrationCatalog(project_root)
|
||||
try:
|
||||
entries = ic.search()
|
||||
except IntegrationCatalogError as exc:
|
||||
console.print(f"[red]Error:[/red] {exc}")
|
||||
raise typer.Exit(1)
|
||||
|
||||
if not entries:
|
||||
console.print("[yellow]No integrations found in catalog.[/yellow]")
|
||||
return
|
||||
|
||||
table = Table(title="Integration Catalog")
|
||||
table.add_column("ID", style="cyan")
|
||||
table.add_column("Name")
|
||||
table.add_column("Version")
|
||||
table.add_column("Source")
|
||||
table.add_column("Status")
|
||||
|
||||
for entry in sorted(entries, key=lambda e: e["id"]):
|
||||
eid = entry["id"]
|
||||
cat_name = entry.get("_catalog_name", "")
|
||||
install_allowed = entry.get("_install_allowed", True)
|
||||
if eid == installed_key:
|
||||
status = "[green]installed[/green]"
|
||||
elif eid in INTEGRATION_REGISTRY:
|
||||
status = "built-in"
|
||||
elif install_allowed is False:
|
||||
status = "discovery-only"
|
||||
else:
|
||||
status = ""
|
||||
table.add_row(
|
||||
eid,
|
||||
entry.get("name", eid),
|
||||
entry.get("version", ""),
|
||||
cat_name,
|
||||
status,
|
||||
)
|
||||
|
||||
console.print(table)
|
||||
return
|
||||
|
||||
table = Table(title="AI Agent Integrations")
|
||||
table.add_column("Key", style="cyan")
|
||||
table.add_column("Name")
|
||||
@@ -2176,6 +2230,120 @@ def integration_switch(
|
||||
console.print(f"\n[green]✓[/green] Switched to integration '{name}'")
|
||||
|
||||
|
||||
@integration_app.command("upgrade")
|
||||
def integration_upgrade(
|
||||
key: str | None = typer.Argument(None, help="Integration key to upgrade (default: current integration)"),
|
||||
force: bool = typer.Option(False, "--force", help="Force upgrade even if files are modified"),
|
||||
script: str | None = typer.Option(None, "--script", help="Script type: sh or ps (default: from init-options.json or platform default)"),
|
||||
integration_options: str | None = typer.Option(None, "--integration-options", help="Options for the integration"),
|
||||
):
|
||||
"""Upgrade an integration by reinstalling with diff-aware file handling.
|
||||
|
||||
Compares manifest hashes to detect locally modified files and
|
||||
blocks the upgrade unless --force is used.
|
||||
"""
|
||||
from .integrations import get_integration
|
||||
from .integrations.manifest import IntegrationManifest
|
||||
|
||||
project_root = Path.cwd()
|
||||
|
||||
specify_dir = project_root / ".specify"
|
||||
if not specify_dir.exists():
|
||||
console.print("[red]Error:[/red] Not a spec-kit project (no .specify/ directory)")
|
||||
console.print("Run this command from a spec-kit project root")
|
||||
raise typer.Exit(1)
|
||||
|
||||
current = _read_integration_json(project_root)
|
||||
installed_key = current.get("integration")
|
||||
|
||||
if key is None:
|
||||
if not installed_key:
|
||||
console.print("[yellow]No integration is currently installed.[/yellow]")
|
||||
raise typer.Exit(0)
|
||||
key = installed_key
|
||||
|
||||
if installed_key and installed_key != key:
|
||||
console.print(
|
||||
f"[red]Error:[/red] Integration '{key}' is not the currently installed integration ('{installed_key}')."
|
||||
)
|
||||
console.print(f"Use [cyan]specify integration switch {key}[/cyan] instead.")
|
||||
raise typer.Exit(1)
|
||||
|
||||
integration = get_integration(key)
|
||||
if integration is None:
|
||||
console.print(f"[red]Error:[/red] Unknown integration '{key}'")
|
||||
raise typer.Exit(1)
|
||||
|
||||
manifest_path = project_root / ".specify" / "integrations" / f"{key}.manifest.json"
|
||||
if not manifest_path.exists():
|
||||
console.print(f"[yellow]No manifest found for integration '{key}'. Nothing to upgrade.[/yellow]")
|
||||
console.print(f"Run [cyan]specify integration install {key}[/cyan] to perform a fresh install.")
|
||||
raise typer.Exit(0)
|
||||
|
||||
try:
|
||||
old_manifest = IntegrationManifest.load(key, project_root)
|
||||
except (ValueError, FileNotFoundError) as exc:
|
||||
console.print(f"[red]Error:[/red] Integration manifest for '{key}' is unreadable: {exc}")
|
||||
raise typer.Exit(1)
|
||||
|
||||
# Detect modified files via manifest hashes
|
||||
modified = old_manifest.check_modified()
|
||||
if modified and not force:
|
||||
console.print(f"[yellow]⚠[/yellow] {len(modified)} file(s) have been modified since installation:")
|
||||
for rel in modified:
|
||||
console.print(f" {rel}")
|
||||
console.print("\nUse [cyan]--force[/cyan] to overwrite modified files, or resolve manually.")
|
||||
raise typer.Exit(1)
|
||||
|
||||
selected_script = _resolve_script_type(project_root, script)
|
||||
|
||||
# Ensure shared infrastructure is present (safe to run unconditionally;
|
||||
# _install_shared_infra merges missing files without overwriting).
|
||||
_install_shared_infra(project_root, selected_script)
|
||||
if os.name != "nt":
|
||||
ensure_executable_scripts(project_root)
|
||||
|
||||
# Phase 1: Install new files (overwrites existing; old-only files remain)
|
||||
console.print(f"Upgrading integration: [cyan]{key}[/cyan]")
|
||||
new_manifest = IntegrationManifest(key, project_root, version=get_speckit_version())
|
||||
|
||||
parsed_options: dict[str, Any] | None = None
|
||||
if integration_options:
|
||||
parsed_options = _parse_integration_options(integration, integration_options)
|
||||
|
||||
try:
|
||||
integration.setup(
|
||||
project_root,
|
||||
new_manifest,
|
||||
parsed_options=parsed_options,
|
||||
script_type=selected_script,
|
||||
raw_options=integration_options,
|
||||
)
|
||||
new_manifest.save()
|
||||
_write_integration_json(project_root, key, selected_script)
|
||||
_update_init_options_for_integration(project_root, integration, script_type=selected_script)
|
||||
except Exception as exc:
|
||||
# Don't teardown — setup overwrites in-place, so teardown would
|
||||
# delete files that were working before the upgrade. Just report.
|
||||
console.print(f"[red]Error:[/red] Failed to upgrade integration: {exc}")
|
||||
console.print("[yellow]The previous integration files may still be in place.[/yellow]")
|
||||
raise typer.Exit(1)
|
||||
|
||||
# Phase 2: Remove stale files from old manifest that are not in the new one
|
||||
old_files = old_manifest.files
|
||||
new_files = new_manifest.files
|
||||
stale_keys = set(old_files) - set(new_files)
|
||||
if stale_keys:
|
||||
stale_manifest = IntegrationManifest(key, project_root, version="stale-cleanup")
|
||||
stale_manifest._files = {k: old_files[k] for k in stale_keys}
|
||||
stale_removed, _ = stale_manifest.uninstall(project_root, force=True)
|
||||
if stale_removed:
|
||||
console.print(f" Removed {len(stale_removed)} stale file(s) from previous install")
|
||||
|
||||
name = (integration.config or {}).get("name", key)
|
||||
console.print(f"\n[green]✓[/green] Integration '{name}' upgraded successfully")
|
||||
|
||||
|
||||
# ===== Preset Commands =====
|
||||
|
||||
|
||||
@@ -2216,7 +2384,7 @@ def preset_list():
|
||||
|
||||
@preset_app.command("add")
|
||||
def preset_add(
|
||||
pack_id: str = typer.Argument(None, help="Preset ID to install from catalog"),
|
||||
preset_id: str = typer.Argument(None, help="Preset ID to install from catalog"),
|
||||
from_url: str = typer.Option(None, "--from", help="Install from a URL (ZIP file)"),
|
||||
dev: str = typer.Option(None, "--dev", help="Install from local directory (development mode)"),
|
||||
priority: int = typer.Option(10, "--priority", help="Resolution priority (lower = higher precedence, default 10)"),
|
||||
@@ -2284,19 +2452,19 @@ def preset_add(
|
||||
|
||||
console.print(f"[green]✓[/green] Preset '{manifest.name}' v{manifest.version} installed (priority {priority})")
|
||||
|
||||
elif pack_id:
|
||||
elif preset_id:
|
||||
# Try bundled preset first, then catalog
|
||||
bundled_path = _locate_bundled_preset(pack_id)
|
||||
bundled_path = _locate_bundled_preset(preset_id)
|
||||
if bundled_path:
|
||||
console.print(f"Installing bundled preset [cyan]{pack_id}[/cyan]...")
|
||||
console.print(f"Installing bundled preset [cyan]{preset_id}[/cyan]...")
|
||||
manifest = manager.install_from_directory(bundled_path, speckit_version, priority)
|
||||
console.print(f"[green]✓[/green] Preset '{manifest.name}' v{manifest.version} installed (priority {priority})")
|
||||
else:
|
||||
catalog = PresetCatalog(project_root)
|
||||
pack_info = catalog.get_pack_info(pack_id)
|
||||
pack_info = catalog.get_pack_info(preset_id)
|
||||
|
||||
if not pack_info:
|
||||
console.print(f"[red]Error:[/red] Preset '{pack_id}' not found in catalog")
|
||||
console.print(f"[red]Error:[/red] Preset '{preset_id}' not found in catalog")
|
||||
raise typer.Exit(1)
|
||||
|
||||
# Bundled presets should have been caught above; if we reach
|
||||
@@ -2304,7 +2472,7 @@ def preset_add(
|
||||
if pack_info.get("bundled") and not pack_info.get("download_url"):
|
||||
from .extensions import REINSTALL_COMMAND
|
||||
console.print(
|
||||
f"[red]Error:[/red] Preset '{pack_id}' is bundled with spec-kit "
|
||||
f"[red]Error:[/red] Preset '{preset_id}' is bundled with spec-kit "
|
||||
f"but could not be found in the installed package."
|
||||
)
|
||||
console.print(
|
||||
@@ -2316,14 +2484,14 @@ def preset_add(
|
||||
|
||||
if not pack_info.get("_install_allowed", True):
|
||||
catalog_name = pack_info.get("_catalog_name", "unknown")
|
||||
console.print(f"[red]Error:[/red] Preset '{pack_id}' is from the '{catalog_name}' catalog which is discovery-only (install not allowed).")
|
||||
console.print(f"[red]Error:[/red] Preset '{preset_id}' is from the '{catalog_name}' catalog which is discovery-only (install not allowed).")
|
||||
console.print("Add the catalog with --install-allowed or install from the preset's repository directly with --from.")
|
||||
raise typer.Exit(1)
|
||||
|
||||
console.print(f"Installing preset [cyan]{pack_info.get('name', pack_id)}[/cyan]...")
|
||||
console.print(f"Installing preset [cyan]{pack_info.get('name', preset_id)}[/cyan]...")
|
||||
|
||||
try:
|
||||
zip_path = catalog.download_pack(pack_id)
|
||||
zip_path = catalog.download_pack(preset_id)
|
||||
manifest = manager.install_from_zip(zip_path, speckit_version, priority)
|
||||
console.print(f"[green]✓[/green] Preset '{manifest.name}' v{manifest.version} installed (priority {priority})")
|
||||
finally:
|
||||
@@ -2346,7 +2514,7 @@ def preset_add(
|
||||
|
||||
@preset_app.command("remove")
|
||||
def preset_remove(
|
||||
pack_id: str = typer.Argument(..., help="Preset ID to remove"),
|
||||
preset_id: str = typer.Argument(..., help="Preset ID to remove"),
|
||||
):
|
||||
"""Remove an installed preset."""
|
||||
from .presets import PresetManager
|
||||
@@ -2361,14 +2529,14 @@ def preset_remove(
|
||||
|
||||
manager = PresetManager(project_root)
|
||||
|
||||
if not manager.registry.is_installed(pack_id):
|
||||
console.print(f"[red]Error:[/red] Preset '{pack_id}' is not installed")
|
||||
if not manager.registry.is_installed(preset_id):
|
||||
console.print(f"[red]Error:[/red] Preset '{preset_id}' is not installed")
|
||||
raise typer.Exit(1)
|
||||
|
||||
if manager.remove(pack_id):
|
||||
console.print(f"[green]✓[/green] Preset '{pack_id}' removed successfully")
|
||||
if manager.remove(preset_id):
|
||||
console.print(f"[green]✓[/green] Preset '{preset_id}' removed successfully")
|
||||
else:
|
||||
console.print(f"[red]Error:[/red] Failed to remove preset '{pack_id}'")
|
||||
console.print(f"[red]Error:[/red] Failed to remove preset '{preset_id}'")
|
||||
raise typer.Exit(1)
|
||||
|
||||
|
||||
@@ -2439,7 +2607,7 @@ def preset_resolve(
|
||||
|
||||
@preset_app.command("info")
|
||||
def preset_info(
|
||||
pack_id: str = typer.Argument(..., help="Preset ID to get info about"),
|
||||
preset_id: str = typer.Argument(..., help="Preset ID to get info about"),
|
||||
):
|
||||
"""Show detailed information about a preset."""
|
||||
from .extensions import normalize_priority
|
||||
@@ -2455,7 +2623,7 @@ def preset_info(
|
||||
|
||||
# Check if installed locally first
|
||||
manager = PresetManager(project_root)
|
||||
local_pack = manager.get_pack(pack_id)
|
||||
local_pack = manager.get_pack(preset_id)
|
||||
|
||||
if local_pack:
|
||||
console.print(f"\n[bold cyan]Preset: {local_pack.name}[/bold cyan]\n")
|
||||
@@ -2477,7 +2645,7 @@ def preset_info(
|
||||
console.print(f" License: {license_val}")
|
||||
console.print("\n [green]Status: installed[/green]")
|
||||
# Get priority from registry
|
||||
pack_metadata = manager.registry.get(pack_id)
|
||||
pack_metadata = manager.registry.get(preset_id)
|
||||
priority = normalize_priority(pack_metadata.get("priority") if isinstance(pack_metadata, dict) else None)
|
||||
console.print(f" [dim]Priority:[/dim] {priority}")
|
||||
console.print()
|
||||
@@ -2486,15 +2654,15 @@ def preset_info(
|
||||
# Fall back to catalog
|
||||
catalog = PresetCatalog(project_root)
|
||||
try:
|
||||
pack_info = catalog.get_pack_info(pack_id)
|
||||
pack_info = catalog.get_pack_info(preset_id)
|
||||
except PresetError:
|
||||
pack_info = None
|
||||
|
||||
if not pack_info:
|
||||
console.print(f"[red]Error:[/red] Preset '{pack_id}' not found (not installed and not in catalog)")
|
||||
console.print(f"[red]Error:[/red] Preset '{preset_id}' not found (not installed and not in catalog)")
|
||||
raise typer.Exit(1)
|
||||
|
||||
console.print(f"\n[bold cyan]Preset: {pack_info.get('name', pack_id)}[/bold cyan]\n")
|
||||
console.print(f"\n[bold cyan]Preset: {pack_info.get('name', preset_id)}[/bold cyan]\n")
|
||||
console.print(f" ID: {pack_info['id']}")
|
||||
console.print(f" Version: {pack_info.get('version', '?')}")
|
||||
console.print(f" Description: {pack_info.get('description', '')}")
|
||||
@@ -2507,13 +2675,13 @@ def preset_info(
|
||||
if pack_info.get("license"):
|
||||
console.print(f" License: {pack_info['license']}")
|
||||
console.print("\n [yellow]Status: not installed[/yellow]")
|
||||
console.print(f" Install with: [cyan]specify preset add {pack_id}[/cyan]")
|
||||
console.print(f" Install with: [cyan]specify preset add {preset_id}[/cyan]")
|
||||
console.print()
|
||||
|
||||
|
||||
@preset_app.command("set-priority")
|
||||
def preset_set_priority(
|
||||
pack_id: str = typer.Argument(help="Preset ID"),
|
||||
preset_id: str = typer.Argument(help="Preset ID"),
|
||||
priority: int = typer.Argument(help="New priority (lower = higher precedence)"),
|
||||
):
|
||||
"""Set the resolution priority of an installed preset."""
|
||||
@@ -2536,14 +2704,14 @@ def preset_set_priority(
|
||||
manager = PresetManager(project_root)
|
||||
|
||||
# Check if preset is installed
|
||||
if not manager.registry.is_installed(pack_id):
|
||||
console.print(f"[red]Error:[/red] Preset '{pack_id}' is not installed")
|
||||
if not manager.registry.is_installed(preset_id):
|
||||
console.print(f"[red]Error:[/red] Preset '{preset_id}' is not installed")
|
||||
raise typer.Exit(1)
|
||||
|
||||
# Get current metadata
|
||||
metadata = manager.registry.get(pack_id)
|
||||
metadata = manager.registry.get(preset_id)
|
||||
if metadata is None or not isinstance(metadata, dict):
|
||||
console.print(f"[red]Error:[/red] Preset '{pack_id}' not found in registry (corrupted state)")
|
||||
console.print(f"[red]Error:[/red] Preset '{preset_id}' not found in registry (corrupted state)")
|
||||
raise typer.Exit(1)
|
||||
|
||||
from .extensions import normalize_priority
|
||||
@@ -2551,21 +2719,21 @@ def preset_set_priority(
|
||||
# Only skip if the stored value is already a valid int equal to requested priority
|
||||
# This ensures corrupted values (e.g., "high") get repaired even when setting to default (10)
|
||||
if isinstance(raw_priority, int) and raw_priority == priority:
|
||||
console.print(f"[yellow]Preset '{pack_id}' already has priority {priority}[/yellow]")
|
||||
console.print(f"[yellow]Preset '{preset_id}' already has priority {priority}[/yellow]")
|
||||
raise typer.Exit(0)
|
||||
|
||||
old_priority = normalize_priority(raw_priority)
|
||||
|
||||
# Update priority
|
||||
manager.registry.update(pack_id, {"priority": priority})
|
||||
manager.registry.update(preset_id, {"priority": priority})
|
||||
|
||||
console.print(f"[green]✓[/green] Preset '{pack_id}' priority changed: {old_priority} → {priority}")
|
||||
console.print(f"[green]✓[/green] Preset '{preset_id}' priority changed: {old_priority} → {priority}")
|
||||
console.print("\n[dim]Lower priority = higher precedence in template resolution[/dim]")
|
||||
|
||||
|
||||
@preset_app.command("enable")
|
||||
def preset_enable(
|
||||
pack_id: str = typer.Argument(help="Preset ID to enable"),
|
||||
preset_id: str = typer.Argument(help="Preset ID to enable"),
|
||||
):
|
||||
"""Enable a disabled preset."""
|
||||
from .presets import PresetManager
|
||||
@@ -2582,31 +2750,31 @@ def preset_enable(
|
||||
manager = PresetManager(project_root)
|
||||
|
||||
# Check if preset is installed
|
||||
if not manager.registry.is_installed(pack_id):
|
||||
console.print(f"[red]Error:[/red] Preset '{pack_id}' is not installed")
|
||||
if not manager.registry.is_installed(preset_id):
|
||||
console.print(f"[red]Error:[/red] Preset '{preset_id}' is not installed")
|
||||
raise typer.Exit(1)
|
||||
|
||||
# Get current metadata
|
||||
metadata = manager.registry.get(pack_id)
|
||||
metadata = manager.registry.get(preset_id)
|
||||
if metadata is None or not isinstance(metadata, dict):
|
||||
console.print(f"[red]Error:[/red] Preset '{pack_id}' not found in registry (corrupted state)")
|
||||
console.print(f"[red]Error:[/red] Preset '{preset_id}' not found in registry (corrupted state)")
|
||||
raise typer.Exit(1)
|
||||
|
||||
if metadata.get("enabled", True):
|
||||
console.print(f"[yellow]Preset '{pack_id}' is already enabled[/yellow]")
|
||||
console.print(f"[yellow]Preset '{preset_id}' is already enabled[/yellow]")
|
||||
raise typer.Exit(0)
|
||||
|
||||
# Enable the preset
|
||||
manager.registry.update(pack_id, {"enabled": True})
|
||||
manager.registry.update(preset_id, {"enabled": True})
|
||||
|
||||
console.print(f"[green]✓[/green] Preset '{pack_id}' enabled")
|
||||
console.print(f"[green]✓[/green] Preset '{preset_id}' enabled")
|
||||
console.print("\nTemplates from this preset will now be included in resolution.")
|
||||
console.print("[dim]Note: Previously registered commands/skills remain active.[/dim]")
|
||||
|
||||
|
||||
@preset_app.command("disable")
|
||||
def preset_disable(
|
||||
pack_id: str = typer.Argument(help="Preset ID to disable"),
|
||||
preset_id: str = typer.Argument(help="Preset ID to disable"),
|
||||
):
|
||||
"""Disable a preset without removing it."""
|
||||
from .presets import PresetManager
|
||||
@@ -2623,27 +2791,27 @@ def preset_disable(
|
||||
manager = PresetManager(project_root)
|
||||
|
||||
# Check if preset is installed
|
||||
if not manager.registry.is_installed(pack_id):
|
||||
console.print(f"[red]Error:[/red] Preset '{pack_id}' is not installed")
|
||||
if not manager.registry.is_installed(preset_id):
|
||||
console.print(f"[red]Error:[/red] Preset '{preset_id}' is not installed")
|
||||
raise typer.Exit(1)
|
||||
|
||||
# Get current metadata
|
||||
metadata = manager.registry.get(pack_id)
|
||||
metadata = manager.registry.get(preset_id)
|
||||
if metadata is None or not isinstance(metadata, dict):
|
||||
console.print(f"[red]Error:[/red] Preset '{pack_id}' not found in registry (corrupted state)")
|
||||
console.print(f"[red]Error:[/red] Preset '{preset_id}' not found in registry (corrupted state)")
|
||||
raise typer.Exit(1)
|
||||
|
||||
if not metadata.get("enabled", True):
|
||||
console.print(f"[yellow]Preset '{pack_id}' is already disabled[/yellow]")
|
||||
console.print(f"[yellow]Preset '{preset_id}' is already disabled[/yellow]")
|
||||
raise typer.Exit(0)
|
||||
|
||||
# Disable the preset
|
||||
manager.registry.update(pack_id, {"enabled": False})
|
||||
manager.registry.update(preset_id, {"enabled": False})
|
||||
|
||||
console.print(f"[green]✓[/green] Preset '{pack_id}' disabled")
|
||||
console.print(f"[green]✓[/green] Preset '{preset_id}' disabled")
|
||||
console.print("\nTemplates from this preset will be skipped during resolution.")
|
||||
console.print("[dim]Note: Previously registered commands/skills remain active until preset removal.[/dim]")
|
||||
console.print(f"To re-enable: specify preset enable {pack_id}")
|
||||
console.print(f"To re-enable: specify preset enable {preset_id}")
|
||||
|
||||
|
||||
# ===== Preset Catalog Commands =====
|
||||
|
||||
626
src/specify_cli/integrations/catalog.py
Normal file
626
src/specify_cli/integrations/catalog.py
Normal file
@@ -0,0 +1,626 @@
|
||||
"""Integration catalog — discovery, validation, and upgrade support.
|
||||
|
||||
Provides:
|
||||
- ``IntegrationCatalogEntry`` — single catalog source metadata.
|
||||
- ``IntegrationCatalog`` — fetches, caches, and searches integration
|
||||
catalogs (built-in + community).
|
||||
- ``IntegrationDescriptor`` — loads and validates ``integration.yml``.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
from dataclasses import dataclass
|
||||
from datetime import datetime, timezone
|
||||
from pathlib import Path
|
||||
from typing import Any, Dict, List, Optional
|
||||
|
||||
import yaml
|
||||
from packaging import version as pkg_version
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Errors
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
class IntegrationCatalogError(Exception):
|
||||
"""Raised when a catalog operation fails."""
|
||||
|
||||
|
||||
class IntegrationDescriptorError(Exception):
|
||||
"""Raised when an integration.yml descriptor is invalid."""
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# IntegrationCatalogEntry
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
@dataclass
|
||||
class IntegrationCatalogEntry:
|
||||
"""Represents a single catalog source in the catalog stack."""
|
||||
|
||||
url: str
|
||||
name: str
|
||||
priority: int
|
||||
install_allowed: bool
|
||||
description: str = ""
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# IntegrationCatalog
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
class IntegrationCatalog:
|
||||
"""Manages integration catalog fetching, caching, and searching."""
|
||||
|
||||
DEFAULT_CATALOG_URL = (
|
||||
"https://raw.githubusercontent.com/github/spec-kit/main/integrations/catalog.json"
|
||||
)
|
||||
COMMUNITY_CATALOG_URL = (
|
||||
"https://raw.githubusercontent.com/github/spec-kit/main/integrations/catalog.community.json"
|
||||
)
|
||||
CACHE_DURATION = 3600 # 1 hour
|
||||
|
||||
def __init__(self, project_root: Path) -> None:
|
||||
self.project_root = project_root
|
||||
self.cache_dir = project_root / ".specify" / "integrations" / ".cache"
|
||||
|
||||
# -- URL validation ---------------------------------------------------
|
||||
|
||||
@staticmethod
|
||||
def _validate_catalog_url(url: str) -> None:
|
||||
from urllib.parse import urlparse
|
||||
|
||||
parsed = urlparse(url)
|
||||
is_localhost = parsed.hostname in ("localhost", "127.0.0.1", "::1")
|
||||
if parsed.scheme != "https" and not (parsed.scheme == "http" and is_localhost):
|
||||
raise IntegrationCatalogError(
|
||||
f"Catalog URL must use HTTPS (got {parsed.scheme}://). "
|
||||
"HTTP is only allowed for localhost."
|
||||
)
|
||||
if not parsed.netloc:
|
||||
raise IntegrationCatalogError(
|
||||
"Catalog URL must be a valid URL with a host."
|
||||
)
|
||||
|
||||
# -- Catalog stack ----------------------------------------------------
|
||||
|
||||
def _load_catalog_config(
|
||||
self, config_path: Path
|
||||
) -> Optional[List[IntegrationCatalogEntry]]:
|
||||
"""Load catalog stack from a YAML file.
|
||||
|
||||
Returns None when the file does not exist.
|
||||
|
||||
Raises:
|
||||
IntegrationCatalogError: on invalid content
|
||||
"""
|
||||
if not config_path.exists():
|
||||
return None
|
||||
try:
|
||||
data = yaml.safe_load(config_path.read_text(encoding="utf-8")) or {}
|
||||
except (yaml.YAMLError, OSError, UnicodeError) as exc:
|
||||
raise IntegrationCatalogError(
|
||||
f"Failed to read catalog config {config_path}: {exc}"
|
||||
)
|
||||
if not isinstance(data, dict):
|
||||
raise IntegrationCatalogError(
|
||||
f"Invalid catalog config {config_path}: expected a YAML mapping at the root"
|
||||
)
|
||||
catalogs_data = data.get("catalogs", [])
|
||||
if not isinstance(catalogs_data, list):
|
||||
raise IntegrationCatalogError(
|
||||
f"Invalid catalog config: 'catalogs' must be a list, "
|
||||
f"got {type(catalogs_data).__name__}"
|
||||
)
|
||||
if not catalogs_data:
|
||||
raise IntegrationCatalogError(
|
||||
f"Catalog config {config_path} exists but contains no 'catalogs' entries. "
|
||||
f"Remove the file to use built-in defaults, or add valid catalog entries."
|
||||
)
|
||||
entries: List[IntegrationCatalogEntry] = []
|
||||
skipped: List[int] = []
|
||||
for idx, item in enumerate(catalogs_data):
|
||||
if not isinstance(item, dict):
|
||||
raise IntegrationCatalogError(
|
||||
f"Invalid catalog entry at index {idx}: "
|
||||
f"expected a mapping, got {type(item).__name__}"
|
||||
)
|
||||
url = str(item.get("url", "")).strip()
|
||||
if not url:
|
||||
skipped.append(idx)
|
||||
continue
|
||||
self._validate_catalog_url(url)
|
||||
try:
|
||||
priority = int(item.get("priority", idx + 1))
|
||||
except (TypeError, ValueError):
|
||||
raise IntegrationCatalogError(
|
||||
f"Invalid priority for catalog '{item.get('name', idx + 1)}': "
|
||||
f"expected integer, got {item.get('priority')!r}"
|
||||
)
|
||||
raw_install = item.get("install_allowed", False)
|
||||
if isinstance(raw_install, str):
|
||||
install_allowed = raw_install.strip().lower() in ("true", "yes", "1")
|
||||
else:
|
||||
install_allowed = bool(raw_install)
|
||||
entries.append(
|
||||
IntegrationCatalogEntry(
|
||||
url=url,
|
||||
name=str(item.get("name", f"catalog-{idx + 1}")),
|
||||
priority=priority,
|
||||
install_allowed=install_allowed,
|
||||
description=str(item.get("description", "")),
|
||||
)
|
||||
)
|
||||
entries.sort(key=lambda e: e.priority)
|
||||
if not entries:
|
||||
raise IntegrationCatalogError(
|
||||
f"Catalog config {config_path} contains {len(catalogs_data)} "
|
||||
f"entries but none have valid URLs (entries at indices {skipped} "
|
||||
f"were skipped). Each catalog entry must have a 'url' field."
|
||||
)
|
||||
return entries
|
||||
|
||||
def get_active_catalogs(self) -> List[IntegrationCatalogEntry]:
|
||||
"""Return the ordered list of active integration catalogs.
|
||||
|
||||
Resolution:
|
||||
1. ``SPECKIT_INTEGRATION_CATALOG_URL`` env var
|
||||
2. Project ``.specify/integration-catalogs.yml``
|
||||
3. User ``~/.specify/integration-catalogs.yml``
|
||||
4. Built-in defaults (built-in + community)
|
||||
"""
|
||||
import sys
|
||||
|
||||
env_value = os.environ.get("SPECKIT_INTEGRATION_CATALOG_URL", "").strip()
|
||||
if env_value:
|
||||
self._validate_catalog_url(env_value)
|
||||
if env_value != self.DEFAULT_CATALOG_URL:
|
||||
if not getattr(self, "_non_default_catalog_warning_shown", False):
|
||||
print(
|
||||
"Warning: Using non-default integration catalog. "
|
||||
"Only use catalogs from sources you trust.",
|
||||
file=sys.stderr,
|
||||
)
|
||||
self._non_default_catalog_warning_shown = True
|
||||
return [
|
||||
IntegrationCatalogEntry(
|
||||
url=env_value,
|
||||
name="custom",
|
||||
priority=1,
|
||||
install_allowed=True,
|
||||
description="Custom catalog via SPECKIT_INTEGRATION_CATALOG_URL",
|
||||
)
|
||||
]
|
||||
|
||||
project_cfg = self.project_root / ".specify" / "integration-catalogs.yml"
|
||||
catalogs = self._load_catalog_config(project_cfg)
|
||||
if catalogs is not None:
|
||||
return catalogs
|
||||
|
||||
user_cfg = Path.home() / ".specify" / "integration-catalogs.yml"
|
||||
catalogs = self._load_catalog_config(user_cfg)
|
||||
if catalogs is not None:
|
||||
return catalogs
|
||||
|
||||
return [
|
||||
IntegrationCatalogEntry(
|
||||
url=self.DEFAULT_CATALOG_URL,
|
||||
name="default",
|
||||
priority=1,
|
||||
install_allowed=True,
|
||||
description="Built-in catalog of installable integrations",
|
||||
),
|
||||
IntegrationCatalogEntry(
|
||||
url=self.COMMUNITY_CATALOG_URL,
|
||||
name="community",
|
||||
priority=2,
|
||||
install_allowed=False,
|
||||
description="Community-contributed integrations (discovery only)",
|
||||
),
|
||||
]
|
||||
|
||||
# -- Fetching ---------------------------------------------------------
|
||||
|
||||
def _fetch_single_catalog(
|
||||
self,
|
||||
entry: IntegrationCatalogEntry,
|
||||
force_refresh: bool = False,
|
||||
) -> Dict[str, Any]:
|
||||
"""Fetch one catalog, with per-URL caching."""
|
||||
import urllib.error
|
||||
import urllib.request
|
||||
|
||||
url_hash = hashlib.sha256(entry.url.encode()).hexdigest()[:16]
|
||||
cache_file = self.cache_dir / f"catalog-{url_hash}.json"
|
||||
cache_meta = self.cache_dir / f"catalog-{url_hash}-metadata.json"
|
||||
|
||||
if not force_refresh and cache_file.exists() and cache_meta.exists():
|
||||
try:
|
||||
meta = json.loads(cache_meta.read_text(encoding="utf-8"))
|
||||
cached_at = datetime.fromisoformat(meta.get("cached_at", ""))
|
||||
if cached_at.tzinfo is None:
|
||||
cached_at = cached_at.replace(tzinfo=timezone.utc)
|
||||
age = (datetime.now(timezone.utc) - cached_at).total_seconds()
|
||||
if age < self.CACHE_DURATION:
|
||||
return json.loads(cache_file.read_text(encoding="utf-8"))
|
||||
except (json.JSONDecodeError, ValueError, KeyError, TypeError, AttributeError, OSError, UnicodeError):
|
||||
# Cache is invalid or stale metadata; delete and refetch from source.
|
||||
try:
|
||||
cache_file.unlink(missing_ok=True)
|
||||
cache_meta.unlink(missing_ok=True)
|
||||
except OSError:
|
||||
pass # Cache cleanup is best-effort; ignore deletion failures.
|
||||
|
||||
try:
|
||||
with urllib.request.urlopen(entry.url, timeout=10) as resp:
|
||||
# Validate final URL after redirects
|
||||
final_url = resp.geturl()
|
||||
if final_url != entry.url:
|
||||
self._validate_catalog_url(final_url)
|
||||
catalog_data = json.loads(resp.read())
|
||||
|
||||
if not isinstance(catalog_data, dict):
|
||||
raise IntegrationCatalogError(
|
||||
f"Invalid catalog format from {entry.url}: expected a JSON object"
|
||||
)
|
||||
if (
|
||||
"schema_version" not in catalog_data
|
||||
or "integrations" not in catalog_data
|
||||
):
|
||||
raise IntegrationCatalogError(
|
||||
f"Invalid catalog format from {entry.url}"
|
||||
)
|
||||
if not isinstance(catalog_data.get("integrations"), dict):
|
||||
raise IntegrationCatalogError(
|
||||
f"Invalid catalog format from {entry.url}: 'integrations' must be a JSON object"
|
||||
)
|
||||
|
||||
try:
|
||||
self.cache_dir.mkdir(parents=True, exist_ok=True)
|
||||
cache_file.write_text(json.dumps(catalog_data, indent=2), encoding="utf-8")
|
||||
cache_meta.write_text(
|
||||
json.dumps(
|
||||
{
|
||||
"cached_at": datetime.now(timezone.utc).isoformat(),
|
||||
"catalog_url": entry.url,
|
||||
},
|
||||
indent=2,
|
||||
),
|
||||
encoding="utf-8",
|
||||
)
|
||||
except OSError:
|
||||
pass # Cache is best-effort; proceed with fetched data
|
||||
return catalog_data
|
||||
|
||||
except urllib.error.URLError as exc:
|
||||
raise IntegrationCatalogError(
|
||||
f"Failed to fetch catalog from {entry.url}: {exc}"
|
||||
)
|
||||
except json.JSONDecodeError as exc:
|
||||
raise IntegrationCatalogError(
|
||||
f"Invalid JSON in catalog from {entry.url}: {exc}"
|
||||
)
|
||||
|
||||
def _get_merged_integrations(
|
||||
self, force_refresh: bool = False
|
||||
) -> List[Dict[str, Any]]:
|
||||
"""Fetch and merge integrations from all active catalogs.
|
||||
|
||||
Catalogs are processed in the order returned by
|
||||
:meth:`get_active_catalogs`. On conflicts, the first catalog in that
|
||||
order wins (lower numeric priority = higher precedence). Each dict is
|
||||
annotated with ``_catalog_name`` and ``_install_allowed``.
|
||||
"""
|
||||
import sys
|
||||
|
||||
active = self.get_active_catalogs()
|
||||
merged: Dict[str, Dict[str, Any]] = {}
|
||||
any_success = False
|
||||
|
||||
for entry in active:
|
||||
try:
|
||||
data = self._fetch_single_catalog(entry, force_refresh)
|
||||
any_success = True
|
||||
except IntegrationCatalogError as exc:
|
||||
print(
|
||||
f"Warning: Could not fetch catalog '{entry.name}': {exc}",
|
||||
file=sys.stderr,
|
||||
)
|
||||
continue
|
||||
|
||||
for integ_id, integ_data in data.get("integrations", {}).items():
|
||||
if not isinstance(integ_data, dict):
|
||||
continue
|
||||
if integ_id not in merged:
|
||||
merged[integ_id] = {
|
||||
**integ_data,
|
||||
"id": integ_id,
|
||||
"_catalog_name": entry.name,
|
||||
"_install_allowed": entry.install_allowed,
|
||||
}
|
||||
|
||||
if not any_success and active:
|
||||
raise IntegrationCatalogError(
|
||||
"Failed to fetch any integration catalog"
|
||||
)
|
||||
|
||||
return list(merged.values())
|
||||
|
||||
# -- Search / info ----------------------------------------------------
|
||||
|
||||
def search(
|
||||
self,
|
||||
query: Optional[str] = None,
|
||||
tag: Optional[str] = None,
|
||||
author: Optional[str] = None,
|
||||
) -> List[Dict[str, Any]]:
|
||||
"""Search catalogs for integrations matching the given filters."""
|
||||
results: List[Dict[str, Any]] = []
|
||||
for item in self._get_merged_integrations():
|
||||
author_val = item.get("author", "")
|
||||
if not isinstance(author_val, str):
|
||||
author_val = str(author_val) if author_val is not None else ""
|
||||
if author and author_val.lower() != author.lower():
|
||||
continue
|
||||
if tag:
|
||||
raw_tags = item.get("tags", [])
|
||||
tags_list = raw_tags if isinstance(raw_tags, list) else []
|
||||
if tag.lower() not in [t.lower() for t in tags_list if isinstance(t, str)]:
|
||||
continue
|
||||
if query:
|
||||
raw_tags = item.get("tags", [])
|
||||
tags_list = raw_tags if isinstance(raw_tags, list) else []
|
||||
name_val = item.get("name", "")
|
||||
desc_val = item.get("description", "")
|
||||
id_val = item.get("id", "")
|
||||
haystack = " ".join(
|
||||
[
|
||||
str(name_val) if name_val else "",
|
||||
str(desc_val) if desc_val else "",
|
||||
str(id_val) if id_val else "",
|
||||
]
|
||||
+ [t for t in tags_list if isinstance(t, str)]
|
||||
).lower()
|
||||
if query.lower() not in haystack:
|
||||
continue
|
||||
results.append(item)
|
||||
return results
|
||||
|
||||
def get_integration_info(
|
||||
self, integration_id: str
|
||||
) -> Optional[Dict[str, Any]]:
|
||||
"""Return catalog metadata for a single integration, or None."""
|
||||
for item in self._get_merged_integrations():
|
||||
if item["id"] == integration_id:
|
||||
return item
|
||||
return None
|
||||
|
||||
# -- Cache management -------------------------------------------------
|
||||
|
||||
def clear_cache(self) -> None:
|
||||
"""Remove all cached catalog files."""
|
||||
if self.cache_dir.exists():
|
||||
for pattern in ("catalog-*.json", "catalog-*-metadata.json"):
|
||||
for f in self.cache_dir.glob(pattern):
|
||||
f.unlink(missing_ok=True)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# IntegrationDescriptor (integration.yml)
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
class IntegrationDescriptor:
|
||||
"""Loads and validates an ``integration.yml`` descriptor.
|
||||
|
||||
The descriptor mirrors ``extension.yml`` and ``preset.yml``::
|
||||
|
||||
schema_version: "1.0"
|
||||
integration:
|
||||
id: "my-agent"
|
||||
name: "My Agent"
|
||||
version: "1.0.0"
|
||||
description: "Integration for My Agent"
|
||||
author: "my-org"
|
||||
requires:
|
||||
speckit_version: ">=0.6.0"
|
||||
tools: [...]
|
||||
provides:
|
||||
commands: [...]
|
||||
scripts: [...]
|
||||
"""
|
||||
|
||||
SCHEMA_VERSION = "1.0"
|
||||
REQUIRED_TOP_LEVEL = ["schema_version", "integration", "requires", "provides"]
|
||||
|
||||
def __init__(self, descriptor_path: Path) -> None:
|
||||
self.path = descriptor_path
|
||||
self.data = self._load(descriptor_path)
|
||||
self._validate()
|
||||
|
||||
# -- Loading ----------------------------------------------------------
|
||||
|
||||
@staticmethod
|
||||
def _load(path: Path) -> dict:
|
||||
try:
|
||||
with open(path, "r", encoding="utf-8") as fh:
|
||||
return yaml.safe_load(fh) or {}
|
||||
except yaml.YAMLError as exc:
|
||||
raise IntegrationDescriptorError(f"Invalid YAML in {path}: {exc}")
|
||||
except FileNotFoundError:
|
||||
raise IntegrationDescriptorError(f"Descriptor not found: {path}")
|
||||
except (OSError, UnicodeError) as exc:
|
||||
raise IntegrationDescriptorError(
|
||||
f"Unable to read descriptor {path}: {exc}"
|
||||
)
|
||||
|
||||
# -- Validation -------------------------------------------------------
|
||||
|
||||
def _validate(self) -> None:
|
||||
if not isinstance(self.data, dict):
|
||||
raise IntegrationDescriptorError(
|
||||
f"Descriptor root must be a YAML mapping, got {type(self.data).__name__}"
|
||||
)
|
||||
for field in self.REQUIRED_TOP_LEVEL:
|
||||
if field not in self.data:
|
||||
raise IntegrationDescriptorError(
|
||||
f"Missing required field: {field}"
|
||||
)
|
||||
|
||||
if self.data["schema_version"] != self.SCHEMA_VERSION:
|
||||
raise IntegrationDescriptorError(
|
||||
f"Unsupported schema version: {self.data['schema_version']} "
|
||||
f"(expected {self.SCHEMA_VERSION})"
|
||||
)
|
||||
|
||||
integ = self.data["integration"]
|
||||
if not isinstance(integ, dict):
|
||||
raise IntegrationDescriptorError(
|
||||
"'integration' must be a mapping"
|
||||
)
|
||||
for field in ("id", "name", "version", "description"):
|
||||
if field not in integ:
|
||||
raise IntegrationDescriptorError(
|
||||
f"Missing integration.{field}"
|
||||
)
|
||||
if not isinstance(integ[field], str):
|
||||
raise IntegrationDescriptorError(
|
||||
f"integration.{field} must be a string, got {type(integ[field]).__name__}"
|
||||
)
|
||||
|
||||
if not re.match(r"^[a-z0-9-]+$", integ["id"]):
|
||||
raise IntegrationDescriptorError(
|
||||
f"Invalid integration ID '{integ['id']}': "
|
||||
"must be lowercase alphanumeric with hyphens only"
|
||||
)
|
||||
|
||||
try:
|
||||
pkg_version.Version(integ["version"])
|
||||
except (pkg_version.InvalidVersion, TypeError):
|
||||
raise IntegrationDescriptorError(
|
||||
f"Invalid version '{integ['version']}'"
|
||||
)
|
||||
|
||||
requires = self.data["requires"]
|
||||
if not isinstance(requires, dict):
|
||||
raise IntegrationDescriptorError(
|
||||
"'requires' must be a mapping"
|
||||
)
|
||||
if "speckit_version" not in requires:
|
||||
raise IntegrationDescriptorError(
|
||||
"Missing requires.speckit_version"
|
||||
)
|
||||
if not isinstance(requires["speckit_version"], str) or not requires["speckit_version"].strip():
|
||||
raise IntegrationDescriptorError(
|
||||
"requires.speckit_version must be a non-empty string"
|
||||
)
|
||||
tools = requires.get("tools")
|
||||
if tools is not None:
|
||||
if not isinstance(tools, list):
|
||||
raise IntegrationDescriptorError(
|
||||
"requires.tools must be a list"
|
||||
)
|
||||
for tool in tools:
|
||||
if not isinstance(tool, dict):
|
||||
raise IntegrationDescriptorError(
|
||||
"Each requires.tools entry must be a mapping"
|
||||
)
|
||||
tool_name = tool.get("name")
|
||||
if not isinstance(tool_name, str) or not tool_name.strip():
|
||||
raise IntegrationDescriptorError(
|
||||
"requires.tools entry 'name' must be a non-empty string"
|
||||
)
|
||||
|
||||
provides = self.data["provides"]
|
||||
if not isinstance(provides, dict):
|
||||
raise IntegrationDescriptorError(
|
||||
"'provides' must be a mapping"
|
||||
)
|
||||
commands = provides.get("commands", [])
|
||||
scripts = provides.get("scripts", [])
|
||||
if "commands" in provides and not isinstance(commands, list):
|
||||
raise IntegrationDescriptorError(
|
||||
"Invalid provides.commands: expected a list"
|
||||
)
|
||||
if "scripts" in provides and not isinstance(scripts, list):
|
||||
raise IntegrationDescriptorError(
|
||||
"Invalid provides.scripts: expected a list"
|
||||
)
|
||||
if not commands and not scripts:
|
||||
raise IntegrationDescriptorError(
|
||||
"Integration must provide at least one command or script"
|
||||
)
|
||||
for cmd in commands:
|
||||
if not isinstance(cmd, dict):
|
||||
raise IntegrationDescriptorError(
|
||||
"Each command entry must be a mapping"
|
||||
)
|
||||
if "name" not in cmd or "file" not in cmd:
|
||||
raise IntegrationDescriptorError(
|
||||
"Command entry missing 'name' or 'file'"
|
||||
)
|
||||
cmd_name = cmd["name"]
|
||||
cmd_file = cmd["file"]
|
||||
if not isinstance(cmd_name, str) or not cmd_name.strip():
|
||||
raise IntegrationDescriptorError(
|
||||
"Command entry 'name' must be a non-empty string"
|
||||
)
|
||||
if not isinstance(cmd_file, str) or not cmd_file.strip():
|
||||
raise IntegrationDescriptorError(
|
||||
"Command entry 'file' must be a non-empty string"
|
||||
)
|
||||
if os.path.isabs(cmd_file) or ".." in Path(cmd_file).parts or Path(cmd_file).drive or Path(cmd_file).anchor:
|
||||
raise IntegrationDescriptorError(
|
||||
f"Command entry 'file' must be a relative path without '..': {cmd_file}"
|
||||
)
|
||||
for script_entry in scripts:
|
||||
if not isinstance(script_entry, str) or not script_entry.strip():
|
||||
raise IntegrationDescriptorError(
|
||||
"Script entry must be a non-empty string"
|
||||
)
|
||||
if os.path.isabs(script_entry) or ".." in Path(script_entry).parts or Path(script_entry).drive or Path(script_entry).anchor:
|
||||
raise IntegrationDescriptorError(
|
||||
f"Script entry must be a relative path without '..': {script_entry}"
|
||||
)
|
||||
|
||||
# -- Property accessors -----------------------------------------------
|
||||
|
||||
@property
|
||||
def id(self) -> str:
|
||||
return self.data["integration"]["id"]
|
||||
|
||||
@property
|
||||
def name(self) -> str:
|
||||
return self.data["integration"]["name"]
|
||||
|
||||
@property
|
||||
def version(self) -> str:
|
||||
return self.data["integration"]["version"]
|
||||
|
||||
@property
|
||||
def description(self) -> str:
|
||||
return self.data["integration"]["description"]
|
||||
|
||||
@property
|
||||
def requires_speckit_version(self) -> str:
|
||||
return self.data["requires"]["speckit_version"]
|
||||
|
||||
@property
|
||||
def commands(self) -> List[Dict[str, Any]]:
|
||||
return self.data.get("provides", {}).get("commands", [])
|
||||
|
||||
@property
|
||||
def scripts(self) -> List[str]:
|
||||
return self.data.get("provides", {}).get("scripts", [])
|
||||
|
||||
@property
|
||||
def tools(self) -> List[Dict[str, Any]]:
|
||||
return self.data.get("requires", {}).get("tools") or []
|
||||
|
||||
def get_hash(self) -> str:
|
||||
"""SHA-256 hash of the descriptor file."""
|
||||
with open(self.path, "rb") as fh:
|
||||
return f"sha256:{hashlib.sha256(fh.read()).hexdigest()}"
|
||||
@@ -255,7 +255,7 @@ def evaluate_expression(template: str, context: Any) -> Any:
|
||||
----------
|
||||
template:
|
||||
The template string (e.g., ``"{{ steps.plan.output.task_count }}"``
|
||||
or ``"Processed {{ inputs.feature_name }}"``.
|
||||
or ``"Processed {{ inputs.spec }}"``.
|
||||
context:
|
||||
A ``StepContext`` or compatible object.
|
||||
|
||||
|
||||
656
tests/integrations/test_integration_catalog.py
Normal file
656
tests/integrations/test_integration_catalog.py
Normal file
@@ -0,0 +1,656 @@
|
||||
"""Tests for the integration catalog system (catalog.py)."""
|
||||
|
||||
import json
|
||||
import os
|
||||
|
||||
import pytest
|
||||
import yaml
|
||||
|
||||
from specify_cli.integrations.catalog import (
|
||||
IntegrationCatalog,
|
||||
IntegrationCatalogEntry,
|
||||
IntegrationCatalogError,
|
||||
IntegrationDescriptor,
|
||||
IntegrationDescriptorError,
|
||||
)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# IntegrationCatalogEntry
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
class TestIntegrationCatalogEntry:
|
||||
def test_create_entry(self):
|
||||
entry = IntegrationCatalogEntry(
|
||||
url="https://example.com/catalog.json",
|
||||
name="test",
|
||||
priority=1,
|
||||
install_allowed=True,
|
||||
description="Test catalog",
|
||||
)
|
||||
assert entry.url == "https://example.com/catalog.json"
|
||||
assert entry.name == "test"
|
||||
assert entry.priority == 1
|
||||
assert entry.install_allowed is True
|
||||
assert entry.description == "Test catalog"
|
||||
|
||||
def test_default_description(self):
|
||||
entry = IntegrationCatalogEntry(
|
||||
url="https://example.com/catalog.json",
|
||||
name="test",
|
||||
priority=1,
|
||||
install_allowed=False,
|
||||
)
|
||||
assert entry.description == ""
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# IntegrationCatalog — URL validation
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
class TestCatalogURLValidation:
|
||||
def test_https_allowed(self):
|
||||
IntegrationCatalog._validate_catalog_url("https://example.com/catalog.json")
|
||||
|
||||
def test_http_rejected(self):
|
||||
with pytest.raises(IntegrationCatalogError, match="HTTPS"):
|
||||
IntegrationCatalog._validate_catalog_url("http://example.com/catalog.json")
|
||||
|
||||
def test_http_localhost_allowed(self):
|
||||
IntegrationCatalog._validate_catalog_url("http://localhost:8080/catalog.json")
|
||||
IntegrationCatalog._validate_catalog_url("http://127.0.0.1/catalog.json")
|
||||
|
||||
def test_missing_host_rejected(self):
|
||||
with pytest.raises(IntegrationCatalogError, match="valid URL"):
|
||||
IntegrationCatalog._validate_catalog_url("https:///no-host")
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# IntegrationCatalog — active catalogs
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
class TestActiveCatalogs:
|
||||
def test_defaults_when_no_config(self, tmp_path, monkeypatch):
|
||||
monkeypatch.setenv("HOME", str(tmp_path))
|
||||
monkeypatch.setenv("USERPROFILE", str(tmp_path))
|
||||
monkeypatch.delenv("SPECKIT_INTEGRATION_CATALOG_URL", raising=False)
|
||||
(tmp_path / ".specify").mkdir()
|
||||
cat = IntegrationCatalog(tmp_path)
|
||||
active = cat.get_active_catalogs()
|
||||
assert len(active) == 2
|
||||
assert active[0].name == "default"
|
||||
assert active[1].name == "community"
|
||||
|
||||
def test_env_var_override(self, tmp_path, monkeypatch):
|
||||
(tmp_path / ".specify").mkdir()
|
||||
monkeypatch.setenv(
|
||||
"SPECKIT_INTEGRATION_CATALOG_URL",
|
||||
"https://custom.example.com/catalog.json",
|
||||
)
|
||||
cat = IntegrationCatalog(tmp_path)
|
||||
active = cat.get_active_catalogs()
|
||||
assert len(active) == 1
|
||||
assert active[0].name == "custom"
|
||||
|
||||
def test_project_config_overrides_defaults(self, tmp_path):
|
||||
specify = tmp_path / ".specify"
|
||||
specify.mkdir()
|
||||
cfg = specify / "integration-catalogs.yml"
|
||||
cfg.write_text(yaml.dump({
|
||||
"catalogs": [
|
||||
{"url": "https://my.example.com/cat.json", "name": "mine", "priority": 1, "install_allowed": True},
|
||||
]
|
||||
}))
|
||||
cat = IntegrationCatalog(tmp_path)
|
||||
active = cat.get_active_catalogs()
|
||||
assert len(active) == 1
|
||||
assert active[0].name == "mine"
|
||||
|
||||
def test_empty_config_raises(self, tmp_path):
|
||||
specify = tmp_path / ".specify"
|
||||
specify.mkdir()
|
||||
cfg = specify / "integration-catalogs.yml"
|
||||
cfg.write_text(yaml.dump({"catalogs": []}))
|
||||
cat = IntegrationCatalog(tmp_path)
|
||||
with pytest.raises(IntegrationCatalogError, match="no 'catalogs' entries"):
|
||||
cat.get_active_catalogs()
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# IntegrationCatalog — fetch & search (using monkeypatched urlopen responses)
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
class TestCatalogFetch:
|
||||
"""Tests that use a local HTTP server stub via monkeypatch."""
|
||||
|
||||
def _patch_urlopen(self, monkeypatch, catalog_data):
|
||||
"""Patch urllib.request.urlopen to return *catalog_data*."""
|
||||
|
||||
class FakeResponse:
|
||||
def __init__(self, data, url=""):
|
||||
self._data = json.dumps(data).encode()
|
||||
self._url = url
|
||||
|
||||
def read(self):
|
||||
return self._data
|
||||
|
||||
def geturl(self):
|
||||
return self._url
|
||||
|
||||
def __enter__(self):
|
||||
return self
|
||||
|
||||
def __exit__(self, *a):
|
||||
pass
|
||||
|
||||
def fake_urlopen(url, timeout=10):
|
||||
return FakeResponse(catalog_data, url)
|
||||
|
||||
import urllib.request
|
||||
monkeypatch.setattr(urllib.request, "urlopen", fake_urlopen)
|
||||
|
||||
def test_fetch_and_search_all(self, tmp_path, monkeypatch):
|
||||
monkeypatch.setenv("HOME", str(tmp_path))
|
||||
monkeypatch.setenv("USERPROFILE", str(tmp_path))
|
||||
monkeypatch.delenv("SPECKIT_INTEGRATION_CATALOG_URL", raising=False)
|
||||
(tmp_path / ".specify").mkdir()
|
||||
cat = IntegrationCatalog(tmp_path)
|
||||
|
||||
catalog = {
|
||||
"schema_version": "1.0",
|
||||
"updated_at": "2026-01-01T00:00:00Z",
|
||||
"integrations": {
|
||||
"acme-coder": {
|
||||
"id": "acme-coder",
|
||||
"name": "Acme Coder",
|
||||
"version": "2.0.0",
|
||||
"description": "Community integration for Acme Coder",
|
||||
"author": "acme-org",
|
||||
"tags": ["cli"],
|
||||
},
|
||||
},
|
||||
}
|
||||
self._patch_urlopen(monkeypatch, catalog)
|
||||
|
||||
results = cat.search()
|
||||
assert len(results) >= 1
|
||||
ids = [r["id"] for r in results]
|
||||
assert "acme-coder" in ids
|
||||
|
||||
def test_search_by_tag(self, tmp_path, monkeypatch):
|
||||
monkeypatch.setenv("HOME", str(tmp_path))
|
||||
monkeypatch.setenv("USERPROFILE", str(tmp_path))
|
||||
monkeypatch.delenv("SPECKIT_INTEGRATION_CATALOG_URL", raising=False)
|
||||
(tmp_path / ".specify").mkdir()
|
||||
cat = IntegrationCatalog(tmp_path)
|
||||
|
||||
catalog = {
|
||||
"schema_version": "1.0",
|
||||
"updated_at": "2026-01-01T00:00:00Z",
|
||||
"integrations": {
|
||||
"a": {"id": "a", "name": "A", "version": "1.0.0", "tags": ["cli"]},
|
||||
"b": {"id": "b", "name": "B", "version": "1.0.0", "tags": ["ide"]},
|
||||
},
|
||||
}
|
||||
self._patch_urlopen(monkeypatch, catalog)
|
||||
|
||||
results = cat.search(tag="cli")
|
||||
assert all("cli" in r.get("tags", []) for r in results)
|
||||
|
||||
def test_search_by_query(self, tmp_path, monkeypatch):
|
||||
monkeypatch.setenv("HOME", str(tmp_path))
|
||||
monkeypatch.setenv("USERPROFILE", str(tmp_path))
|
||||
monkeypatch.delenv("SPECKIT_INTEGRATION_CATALOG_URL", raising=False)
|
||||
(tmp_path / ".specify").mkdir()
|
||||
cat = IntegrationCatalog(tmp_path)
|
||||
|
||||
catalog = {
|
||||
"schema_version": "1.0",
|
||||
"updated_at": "2026-01-01T00:00:00Z",
|
||||
"integrations": {
|
||||
"claude": {"id": "claude", "name": "Claude Code", "version": "1.0.0", "description": "Anthropic", "tags": []},
|
||||
"gemini": {"id": "gemini", "name": "Gemini CLI", "version": "1.0.0", "description": "Google", "tags": []},
|
||||
},
|
||||
}
|
||||
self._patch_urlopen(monkeypatch, catalog)
|
||||
|
||||
results = cat.search(query="claude")
|
||||
assert len(results) == 1
|
||||
assert results[0]["id"] == "claude"
|
||||
|
||||
def test_get_integration_info(self, tmp_path, monkeypatch):
|
||||
monkeypatch.setenv("HOME", str(tmp_path))
|
||||
monkeypatch.setenv("USERPROFILE", str(tmp_path))
|
||||
monkeypatch.delenv("SPECKIT_INTEGRATION_CATALOG_URL", raising=False)
|
||||
(tmp_path / ".specify").mkdir()
|
||||
cat = IntegrationCatalog(tmp_path)
|
||||
|
||||
catalog = {
|
||||
"schema_version": "1.0",
|
||||
"updated_at": "2026-01-01T00:00:00Z",
|
||||
"integrations": {
|
||||
"claude": {"id": "claude", "name": "Claude Code", "version": "1.0.0"},
|
||||
},
|
||||
}
|
||||
self._patch_urlopen(monkeypatch, catalog)
|
||||
|
||||
info = cat.get_integration_info("claude")
|
||||
assert info is not None
|
||||
assert info["name"] == "Claude Code"
|
||||
|
||||
assert cat.get_integration_info("nonexistent") is None
|
||||
|
||||
def test_invalid_catalog_format(self, tmp_path, monkeypatch):
|
||||
monkeypatch.setenv("HOME", str(tmp_path))
|
||||
monkeypatch.setenv("USERPROFILE", str(tmp_path))
|
||||
monkeypatch.delenv("SPECKIT_INTEGRATION_CATALOG_URL", raising=False)
|
||||
(tmp_path / ".specify").mkdir()
|
||||
cat = IntegrationCatalog(tmp_path)
|
||||
|
||||
self._patch_urlopen(monkeypatch, {"schema_version": "1.0"}) # missing "integrations"
|
||||
|
||||
with pytest.raises(IntegrationCatalogError, match="Failed to fetch any integration catalog"):
|
||||
cat.search()
|
||||
|
||||
def test_clear_cache(self, tmp_path):
|
||||
(tmp_path / ".specify").mkdir()
|
||||
cat = IntegrationCatalog(tmp_path)
|
||||
cat.cache_dir.mkdir(parents=True, exist_ok=True)
|
||||
(cat.cache_dir / "catalog-abc123.json").write_text("{}")
|
||||
cat.clear_cache()
|
||||
assert not list(cat.cache_dir.glob("catalog-*.json"))
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# IntegrationDescriptor (integration.yml)
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
VALID_DESCRIPTOR = {
|
||||
"schema_version": "1.0",
|
||||
"integration": {
|
||||
"id": "my-agent",
|
||||
"name": "My Agent",
|
||||
"version": "1.0.0",
|
||||
"description": "Integration for My Agent",
|
||||
"author": "my-org",
|
||||
},
|
||||
"requires": {
|
||||
"speckit_version": ">=0.6.0",
|
||||
},
|
||||
"provides": {
|
||||
"commands": [
|
||||
{"name": "speckit.specify", "file": "templates/speckit.specify.md"},
|
||||
],
|
||||
"scripts": ["update-context.sh"],
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
class TestIntegrationDescriptor:
|
||||
def _write(self, tmp_path, data):
|
||||
p = tmp_path / "integration.yml"
|
||||
p.write_text(yaml.dump(data))
|
||||
return p
|
||||
|
||||
def test_valid_descriptor(self, tmp_path):
|
||||
p = self._write(tmp_path, VALID_DESCRIPTOR)
|
||||
desc = IntegrationDescriptor(p)
|
||||
assert desc.id == "my-agent"
|
||||
assert desc.name == "My Agent"
|
||||
assert desc.version == "1.0.0"
|
||||
assert desc.description == "Integration for My Agent"
|
||||
assert desc.requires_speckit_version == ">=0.6.0"
|
||||
assert len(desc.commands) == 1
|
||||
assert desc.scripts == ["update-context.sh"]
|
||||
|
||||
def test_missing_schema_version(self, tmp_path):
|
||||
data = {**VALID_DESCRIPTOR}
|
||||
del data["schema_version"]
|
||||
p = self._write(tmp_path, data)
|
||||
with pytest.raises(IntegrationDescriptorError, match="Missing required field: schema_version"):
|
||||
IntegrationDescriptor(p)
|
||||
|
||||
def test_unsupported_schema_version(self, tmp_path):
|
||||
data = {**VALID_DESCRIPTOR, "schema_version": "99.0"}
|
||||
p = self._write(tmp_path, data)
|
||||
with pytest.raises(IntegrationDescriptorError, match="Unsupported schema version"):
|
||||
IntegrationDescriptor(p)
|
||||
|
||||
def test_missing_integration_id(self, tmp_path):
|
||||
data = {**VALID_DESCRIPTOR, "integration": {"name": "X", "version": "1.0.0", "description": "Y"}}
|
||||
p = self._write(tmp_path, data)
|
||||
with pytest.raises(IntegrationDescriptorError, match="Missing integration.id"):
|
||||
IntegrationDescriptor(p)
|
||||
|
||||
def test_invalid_id_format(self, tmp_path):
|
||||
integ = {**VALID_DESCRIPTOR["integration"], "id": "BAD_ID"}
|
||||
data = {**VALID_DESCRIPTOR, "integration": integ}
|
||||
p = self._write(tmp_path, data)
|
||||
with pytest.raises(IntegrationDescriptorError, match="Invalid integration ID"):
|
||||
IntegrationDescriptor(p)
|
||||
|
||||
def test_invalid_version(self, tmp_path):
|
||||
integ = {**VALID_DESCRIPTOR["integration"], "version": "not-semver"}
|
||||
data = {**VALID_DESCRIPTOR, "integration": integ}
|
||||
p = self._write(tmp_path, data)
|
||||
with pytest.raises(IntegrationDescriptorError, match="Invalid version"):
|
||||
IntegrationDescriptor(p)
|
||||
|
||||
def test_missing_speckit_version(self, tmp_path):
|
||||
data = {**VALID_DESCRIPTOR, "requires": {}}
|
||||
p = self._write(tmp_path, data)
|
||||
with pytest.raises(IntegrationDescriptorError, match="requires.speckit_version"):
|
||||
IntegrationDescriptor(p)
|
||||
|
||||
def test_no_commands_or_scripts(self, tmp_path):
|
||||
data = {**VALID_DESCRIPTOR, "provides": {}}
|
||||
p = self._write(tmp_path, data)
|
||||
with pytest.raises(IntegrationDescriptorError, match="at least one command or script"):
|
||||
IntegrationDescriptor(p)
|
||||
|
||||
def test_command_missing_name(self, tmp_path):
|
||||
data = {**VALID_DESCRIPTOR, "provides": {"commands": [{"file": "x.md"}]}}
|
||||
p = self._write(tmp_path, data)
|
||||
with pytest.raises(IntegrationDescriptorError, match="missing 'name' or 'file'"):
|
||||
IntegrationDescriptor(p)
|
||||
|
||||
def test_commands_not_a_list(self, tmp_path):
|
||||
data = {**VALID_DESCRIPTOR, "provides": {"commands": "not-a-list", "scripts": ["a.sh"]}}
|
||||
p = self._write(tmp_path, data)
|
||||
with pytest.raises(IntegrationDescriptorError, match="expected a list"):
|
||||
IntegrationDescriptor(p)
|
||||
|
||||
def test_scripts_not_a_list(self, tmp_path):
|
||||
data = {**VALID_DESCRIPTOR, "provides": {"commands": [{"name": "a", "file": "b"}], "scripts": "not-a-list"}}
|
||||
p = self._write(tmp_path, data)
|
||||
with pytest.raises(IntegrationDescriptorError, match="expected a list"):
|
||||
IntegrationDescriptor(p)
|
||||
|
||||
def test_file_not_found(self, tmp_path):
|
||||
with pytest.raises(IntegrationDescriptorError, match="Descriptor not found"):
|
||||
IntegrationDescriptor(tmp_path / "nonexistent.yml")
|
||||
|
||||
def test_invalid_yaml(self, tmp_path):
|
||||
p = tmp_path / "integration.yml"
|
||||
p.write_text(": : :")
|
||||
with pytest.raises(IntegrationDescriptorError, match="Invalid YAML"):
|
||||
IntegrationDescriptor(p)
|
||||
|
||||
def test_get_hash(self, tmp_path):
|
||||
p = self._write(tmp_path, VALID_DESCRIPTOR)
|
||||
desc = IntegrationDescriptor(p)
|
||||
h = desc.get_hash()
|
||||
assert h.startswith("sha256:")
|
||||
|
||||
def test_tools_accessor(self, tmp_path):
|
||||
data = {**VALID_DESCRIPTOR, "requires": {
|
||||
"speckit_version": ">=0.6.0",
|
||||
"tools": [{"name": "my-agent", "version": ">=1.0.0", "required": True}],
|
||||
}}
|
||||
p = self._write(tmp_path, data)
|
||||
desc = IntegrationDescriptor(p)
|
||||
assert len(desc.tools) == 1
|
||||
assert desc.tools[0]["name"] == "my-agent"
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# CLI: integration list --catalog
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
class TestIntegrationListCatalog:
|
||||
"""Test ``specify integration list --catalog``."""
|
||||
|
||||
def _init_project(self, tmp_path):
|
||||
"""Create a minimal spec-kit project."""
|
||||
from typer.testing import CliRunner
|
||||
from specify_cli import app
|
||||
runner = CliRunner()
|
||||
project = tmp_path / "proj"
|
||||
project.mkdir()
|
||||
old = os.getcwd()
|
||||
try:
|
||||
os.chdir(project)
|
||||
result = runner.invoke(app, [
|
||||
"init", "--here",
|
||||
"--integration", "copilot",
|
||||
"--script", "sh",
|
||||
"--no-git",
|
||||
"--ignore-agent-tools",
|
||||
], catch_exceptions=False)
|
||||
finally:
|
||||
os.chdir(old)
|
||||
assert result.exit_code == 0, result.output
|
||||
return project
|
||||
|
||||
def test_list_catalog_flag(self, tmp_path, monkeypatch):
|
||||
"""--catalog should show catalog entries."""
|
||||
from typer.testing import CliRunner
|
||||
from specify_cli import app
|
||||
runner = CliRunner()
|
||||
project = self._init_project(tmp_path)
|
||||
|
||||
catalog = {
|
||||
"schema_version": "1.0",
|
||||
"updated_at": "2026-01-01T00:00:00Z",
|
||||
"integrations": {
|
||||
"test-agent": {
|
||||
"id": "test-agent",
|
||||
"name": "Test Agent",
|
||||
"version": "1.0.0",
|
||||
"description": "A test agent",
|
||||
"tags": ["cli"],
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
import urllib.request
|
||||
|
||||
class FakeResponse:
|
||||
def __init__(self, data, url=""):
|
||||
self._data = json.dumps(data).encode()
|
||||
self._url = url
|
||||
def read(self):
|
||||
return self._data
|
||||
def geturl(self):
|
||||
return self._url
|
||||
def __enter__(self):
|
||||
return self
|
||||
def __exit__(self, *a):
|
||||
pass
|
||||
|
||||
monkeypatch.setattr(urllib.request, "urlopen", lambda url, timeout=10: FakeResponse(catalog, url))
|
||||
|
||||
old = os.getcwd()
|
||||
try:
|
||||
os.chdir(project)
|
||||
result = runner.invoke(app, ["integration", "list", "--catalog"])
|
||||
finally:
|
||||
os.chdir(old)
|
||||
|
||||
assert result.exit_code == 0
|
||||
assert "test-agent" in result.output
|
||||
assert "Test Agent" in result.output
|
||||
|
||||
def test_list_without_catalog_still_works(self, tmp_path):
|
||||
"""Default list (no --catalog) works as before."""
|
||||
from typer.testing import CliRunner
|
||||
from specify_cli import app
|
||||
runner = CliRunner()
|
||||
project = self._init_project(tmp_path)
|
||||
|
||||
old = os.getcwd()
|
||||
try:
|
||||
os.chdir(project)
|
||||
result = runner.invoke(app, ["integration", "list"])
|
||||
finally:
|
||||
os.chdir(old)
|
||||
|
||||
assert result.exit_code == 0
|
||||
assert "copilot" in result.output
|
||||
assert "installed" in result.output
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# CLI: integration upgrade
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
class TestIntegrationUpgrade:
|
||||
"""Test ``specify integration upgrade``."""
|
||||
|
||||
def _init_project(self, tmp_path, integration="copilot"):
|
||||
from typer.testing import CliRunner
|
||||
from specify_cli import app
|
||||
runner = CliRunner()
|
||||
project = tmp_path / "proj"
|
||||
project.mkdir()
|
||||
old = os.getcwd()
|
||||
try:
|
||||
os.chdir(project)
|
||||
result = runner.invoke(app, [
|
||||
"init", "--here",
|
||||
"--integration", integration,
|
||||
"--script", "sh",
|
||||
"--no-git",
|
||||
"--ignore-agent-tools",
|
||||
], catch_exceptions=False)
|
||||
finally:
|
||||
os.chdir(old)
|
||||
assert result.exit_code == 0, result.output
|
||||
return project
|
||||
|
||||
def test_upgrade_requires_speckit_project(self, tmp_path):
|
||||
from typer.testing import CliRunner
|
||||
from specify_cli import app
|
||||
runner = CliRunner()
|
||||
old = os.getcwd()
|
||||
try:
|
||||
os.chdir(tmp_path)
|
||||
result = runner.invoke(app, ["integration", "upgrade"])
|
||||
finally:
|
||||
os.chdir(old)
|
||||
assert result.exit_code != 0
|
||||
assert "Not a spec-kit project" in result.output
|
||||
|
||||
def test_upgrade_no_integration_installed(self, tmp_path):
|
||||
from typer.testing import CliRunner
|
||||
from specify_cli import app
|
||||
runner = CliRunner()
|
||||
project = tmp_path / "proj"
|
||||
project.mkdir()
|
||||
(project / ".specify").mkdir()
|
||||
old = os.getcwd()
|
||||
try:
|
||||
os.chdir(project)
|
||||
result = runner.invoke(app, ["integration", "upgrade"])
|
||||
finally:
|
||||
os.chdir(old)
|
||||
assert result.exit_code == 0
|
||||
assert "No integration is currently installed" in result.output
|
||||
|
||||
def test_upgrade_succeeds(self, tmp_path):
|
||||
from typer.testing import CliRunner
|
||||
from specify_cli import app
|
||||
runner = CliRunner()
|
||||
project = self._init_project(tmp_path, "copilot")
|
||||
|
||||
old = os.getcwd()
|
||||
try:
|
||||
os.chdir(project)
|
||||
result = runner.invoke(app, ["integration", "upgrade"], catch_exceptions=False)
|
||||
finally:
|
||||
os.chdir(old)
|
||||
assert result.exit_code == 0
|
||||
assert "upgraded successfully" in result.output
|
||||
|
||||
def test_upgrade_blocks_on_modified_files(self, tmp_path):
|
||||
from typer.testing import CliRunner
|
||||
from specify_cli import app
|
||||
runner = CliRunner()
|
||||
project = self._init_project(tmp_path, "copilot")
|
||||
|
||||
# Modify a tracked file so the manifest hash won't match
|
||||
manifest_path = project / ".specify" / "integrations" / "copilot.manifest.json"
|
||||
assert manifest_path.exists(), "Manifest should exist after init"
|
||||
manifest_data = json.loads(manifest_path.read_text())
|
||||
tracked_files = manifest_data.get("files", {})
|
||||
assert tracked_files, "Manifest should track at least one file"
|
||||
first_rel = next(iter(tracked_files))
|
||||
target_file = project / first_rel
|
||||
assert target_file.exists(), f"Tracked file {first_rel} should exist"
|
||||
target_file.write_text("MODIFIED CONTENT\n")
|
||||
|
||||
old = os.getcwd()
|
||||
try:
|
||||
os.chdir(project)
|
||||
result = runner.invoke(app, ["integration", "upgrade"])
|
||||
finally:
|
||||
os.chdir(old)
|
||||
assert result.exit_code != 0
|
||||
assert "modified" in result.output.lower()
|
||||
|
||||
def test_upgrade_force_overwrites_modified(self, tmp_path):
|
||||
from typer.testing import CliRunner
|
||||
from specify_cli import app
|
||||
runner = CliRunner()
|
||||
project = self._init_project(tmp_path, "copilot")
|
||||
|
||||
# Modify a tracked file
|
||||
manifest_path = project / ".specify" / "integrations" / "copilot.manifest.json"
|
||||
manifest_data = json.loads(manifest_path.read_text())
|
||||
tracked_files = manifest_data.get("files", {})
|
||||
assert tracked_files, "Manifest should track at least one file"
|
||||
first_rel = next(iter(tracked_files))
|
||||
target_file = project / first_rel
|
||||
assert target_file.exists(), f"Tracked file {first_rel} should exist"
|
||||
target_file.write_text("MODIFIED CONTENT\n")
|
||||
|
||||
old = os.getcwd()
|
||||
try:
|
||||
os.chdir(project)
|
||||
result = runner.invoke(app, ["integration", "upgrade", "--force"], catch_exceptions=False)
|
||||
finally:
|
||||
os.chdir(old)
|
||||
assert result.exit_code == 0
|
||||
assert "upgraded successfully" in result.output
|
||||
|
||||
def test_upgrade_wrong_integration_key(self, tmp_path):
|
||||
from typer.testing import CliRunner
|
||||
from specify_cli import app
|
||||
runner = CliRunner()
|
||||
project = self._init_project(tmp_path, "copilot")
|
||||
|
||||
old = os.getcwd()
|
||||
try:
|
||||
os.chdir(project)
|
||||
result = runner.invoke(app, ["integration", "upgrade", "claude"])
|
||||
finally:
|
||||
os.chdir(old)
|
||||
assert result.exit_code != 0
|
||||
assert "not the currently installed integration" in result.output
|
||||
|
||||
def test_upgrade_no_manifest(self, tmp_path):
|
||||
"""Upgrade with missing manifest suggests fresh install."""
|
||||
from typer.testing import CliRunner
|
||||
from specify_cli import app
|
||||
runner = CliRunner()
|
||||
project = self._init_project(tmp_path, "copilot")
|
||||
|
||||
# Remove manifest
|
||||
manifest_path = project / ".specify" / "integrations" / "copilot.manifest.json"
|
||||
if manifest_path.exists():
|
||||
manifest_path.unlink()
|
||||
|
||||
old = os.getcwd()
|
||||
try:
|
||||
os.chdir(project)
|
||||
result = runner.invoke(app, ["integration", "upgrade"])
|
||||
finally:
|
||||
os.chdir(old)
|
||||
assert result.exit_code == 0
|
||||
assert "Nothing to upgrade" in result.output
|
||||
35
tests/test_cli_version.py
Normal file
35
tests/test_cli_version.py
Normal file
@@ -0,0 +1,35 @@
|
||||
"""Tests for the --version CLI flag."""
|
||||
|
||||
from unittest.mock import patch
|
||||
|
||||
from typer.testing import CliRunner
|
||||
|
||||
from specify_cli import app
|
||||
|
||||
|
||||
runner = CliRunner()
|
||||
|
||||
|
||||
class TestVersionFlag:
|
||||
"""Test --version / -V flag on the root command."""
|
||||
|
||||
def test_version_long_flag(self):
|
||||
"""specify --version prints version and exits 0."""
|
||||
with patch("specify_cli.get_speckit_version", return_value="1.2.3"):
|
||||
result = runner.invoke(app, ["--version"])
|
||||
assert result.exit_code == 0
|
||||
assert "specify 1.2.3" in result.output
|
||||
|
||||
def test_version_short_flag(self):
|
||||
"""specify -V prints version and exits 0."""
|
||||
with patch("specify_cli.get_speckit_version", return_value="1.2.3"):
|
||||
result = runner.invoke(app, ["-V"])
|
||||
assert result.exit_code == 0
|
||||
assert "specify 1.2.3" in result.output
|
||||
|
||||
def test_version_flag_takes_precedence_over_subcommand(self):
|
||||
"""--version should work even when a subcommand follows."""
|
||||
with patch("specify_cli.get_speckit_version", return_value="0.7.2"):
|
||||
result = runner.invoke(app, ["--version", "init"])
|
||||
assert result.exit_code == 0
|
||||
assert "specify 0.7.2" in result.output
|
||||
@@ -54,7 +54,7 @@ workflow:
|
||||
description: "A test workflow"
|
||||
|
||||
inputs:
|
||||
feature_name:
|
||||
spec:
|
||||
type: string
|
||||
required: true
|
||||
scope:
|
||||
@@ -65,7 +65,7 @@ steps:
|
||||
- id: step-one
|
||||
command: speckit.specify
|
||||
input:
|
||||
args: "{{ inputs.feature_name }}"
|
||||
args: "{{ inputs.spec }}"
|
||||
|
||||
- id: step-two
|
||||
command: speckit.plan
|
||||
@@ -1152,8 +1152,8 @@ class TestWorkflowDefinition:
|
||||
from specify_cli.workflows.engine import WorkflowDefinition
|
||||
|
||||
definition = WorkflowDefinition.from_string(sample_workflow_yaml)
|
||||
assert "feature_name" in definition.inputs
|
||||
assert definition.inputs["feature_name"]["required"] is True
|
||||
assert "spec" in definition.inputs
|
||||
assert definition.inputs["spec"]["required"] is True
|
||||
assert definition.inputs["scope"]["default"] == "full"
|
||||
|
||||
|
||||
|
||||
@@ -62,10 +62,10 @@ requires:
|
||||
any: ["claude", "gemini"] # At least one required
|
||||
|
||||
inputs:
|
||||
feature_name:
|
||||
spec:
|
||||
type: string
|
||||
required: true
|
||||
prompt: "Feature name"
|
||||
prompt: "Describe what you want to build"
|
||||
scope:
|
||||
type: string
|
||||
default: "full"
|
||||
@@ -75,7 +75,7 @@ steps:
|
||||
- id: specify
|
||||
command: speckit.specify
|
||||
input:
|
||||
args: "{{ inputs.feature_name }}"
|
||||
args: "{{ inputs.spec }}"
|
||||
|
||||
- id: review
|
||||
type: gate
|
||||
@@ -99,7 +99,7 @@ steps:
|
||||
|
||||
```bash
|
||||
# Run with required inputs
|
||||
specify workflow run ./workflow.yml --input feature_name="user-auth"
|
||||
specify workflow run ./workflow.yml --input spec="Build a user authentication system with OAuth support"
|
||||
|
||||
# Check validation
|
||||
specify workflow info ./workflow.yml
|
||||
|
||||
@@ -11,7 +11,7 @@ steps:
|
||||
- id: specify
|
||||
command: speckit.specify
|
||||
input:
|
||||
args: "{{ inputs.feature_name }}"
|
||||
args: "{{ inputs.spec }}"
|
||||
|
||||
- id: review
|
||||
type: gate
|
||||
@@ -35,10 +35,10 @@ specify workflow search
|
||||
specify workflow add speckit
|
||||
|
||||
# Or run directly from a local YAML file
|
||||
specify workflow run ./workflow.yml --input feature_name="user-auth"
|
||||
specify workflow run ./workflow.yml --input spec="Build a user authentication system with OAuth support"
|
||||
|
||||
# Run an installed workflow with inputs
|
||||
specify workflow run speckit --input feature_name="user-auth"
|
||||
specify workflow run speckit --input spec="Build a user authentication system with OAuth support"
|
||||
|
||||
# Check run status
|
||||
specify workflow status
|
||||
@@ -59,20 +59,20 @@ specify workflow remove speckit
|
||||
|
||||
```bash
|
||||
specify workflow add speckit
|
||||
specify workflow run speckit --input feature_name="user-auth"
|
||||
specify workflow run speckit --input spec="Build a user authentication system with OAuth support"
|
||||
```
|
||||
|
||||
### From a Local YAML File
|
||||
|
||||
```bash
|
||||
specify workflow run ./my-workflow.yml --input feature_name="user-auth"
|
||||
specify workflow run ./my-workflow.yml --input spec="Build a user authentication system with OAuth support"
|
||||
```
|
||||
|
||||
### Multiple Inputs
|
||||
|
||||
```bash
|
||||
specify workflow run speckit \
|
||||
--input feature_name="user-auth" \
|
||||
--input spec="Build a user authentication system with OAuth support" \
|
||||
--input scope="backend-only"
|
||||
```
|
||||
|
||||
@@ -88,7 +88,7 @@ Invoke an installed Spec Kit command by name via the integration CLI:
|
||||
- id: specify
|
||||
command: speckit.specify
|
||||
input:
|
||||
args: "{{ inputs.feature_name }}"
|
||||
args: "{{ inputs.spec }}"
|
||||
integration: claude # Optional: override workflow default
|
||||
model: "claude-sonnet-4-20250514" # Optional: override model
|
||||
```
|
||||
@@ -225,7 +225,7 @@ Workflow definitions use `{{ expression }}` syntax for dynamic values:
|
||||
|
||||
```yaml
|
||||
# Access inputs
|
||||
args: "{{ inputs.feature_name }}"
|
||||
args: "{{ inputs.spec }}"
|
||||
|
||||
# Access previous step outputs
|
||||
args: "{{ steps.specify.output.file }}"
|
||||
@@ -245,10 +245,10 @@ Workflow inputs are type-checked and coerced from CLI string values:
|
||||
|
||||
```yaml
|
||||
inputs:
|
||||
feature_name:
|
||||
spec:
|
||||
type: string
|
||||
required: true
|
||||
prompt: "Feature name"
|
||||
prompt: "Describe what you want to build"
|
||||
task_count:
|
||||
type: number
|
||||
default: 5
|
||||
|
||||
@@ -7,15 +7,15 @@ workflow:
|
||||
description: "Runs specify → plan → tasks → implement with review gates"
|
||||
|
||||
requires:
|
||||
speckit_version: ">=0.6.1"
|
||||
speckit_version: ">=0.7.2"
|
||||
integrations:
|
||||
any: ["copilot", "claude", "gemini"]
|
||||
|
||||
inputs:
|
||||
feature_name:
|
||||
spec:
|
||||
type: string
|
||||
required: true
|
||||
prompt: "Feature name"
|
||||
prompt: "Describe what you want to build"
|
||||
integration:
|
||||
type: string
|
||||
default: "copilot"
|
||||
@@ -30,7 +30,7 @@ steps:
|
||||
command: speckit.specify
|
||||
integration: "{{ inputs.integration }}"
|
||||
input:
|
||||
args: "{{ inputs.feature_name }}"
|
||||
args: "{{ inputs.spec }}"
|
||||
|
||||
- id: review-spec
|
||||
type: gate
|
||||
@@ -42,7 +42,7 @@ steps:
|
||||
command: speckit.plan
|
||||
integration: "{{ inputs.integration }}"
|
||||
input:
|
||||
args: "{{ inputs.feature_name }}"
|
||||
args: "{{ inputs.spec }}"
|
||||
|
||||
- id: review-plan
|
||||
type: gate
|
||||
@@ -54,10 +54,10 @@ steps:
|
||||
command: speckit.tasks
|
||||
integration: "{{ inputs.integration }}"
|
||||
input:
|
||||
args: "{{ inputs.feature_name }}"
|
||||
args: "{{ inputs.spec }}"
|
||||
|
||||
- id: implement
|
||||
command: speckit.implement
|
||||
integration: "{{ inputs.integration }}"
|
||||
input:
|
||||
args: "{{ inputs.feature_name }}"
|
||||
args: "{{ inputs.spec }}"
|
||||
|
||||
Reference in New Issue
Block a user