SpecLeft

io.github.SpecLeft由 GitHub 账号 SpecLeft 发布v0.4.0更新于 Nov 3, 2026

Python intent tracing MCP: map specs to pytest tests, monitor implementation progress, offline-only.

已验证STDIO仅桌面知识与记忆开发者工具

概览

AI 生成的概览

SpecLeft 的本地 MCP 服务器,让助手读取和创建 Markdown 功能规格、跟踪 pytest 覆盖情况并生成测试骨架。

可以做什么
  • 读取并创建以 Markdown 文件形式存放在仓库中的功能规格与场景
  • 校验规格,并按功能与场景报告可追溯性和覆盖状态
  • 根据规格生成 pytest 测试骨架,写入前可先做 dry-run 预览
  • 从 PRD 批量推导规格,并检查面向代理的契约与技能文件完整性
  • 完全离线运行,提供适合代理循环和 CI 的 JSON 输出
适用场景
适用于以功能和场景表达验收标准的 Python 项目,希望助手在对话中保持规格、生成的 pytest 骨架与覆盖状态一致。对于只需临时单元测试的小改动,功能级跟踪属于过度设计,不建议使用。
运行要求
作为本地 stdio 进程在用户桌面运行,从 PyPI 安装并用 uvx 启动;项目本身需先用 specleft init 命令初始化一次。适用于 Python 与 pytest 项目。未声明任何认证、环境变量或请求头。
安装前请注意
部分工具会写入仓库:创建规格和生成骨架测试文件会修改项目规格目录下的文件,建议先用 dry-run 预览并确认。它不是安全分析工具,也不替代测试运行器。README 建议仅当内置技能文件完整性校验通过时才遵循其内容。

安装

在 SourceWeft 中

  1. 打开 控制台中的 SpecLeft,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

[SpecLeft social preview]

SpecLeft: Spec Driven Workflow for Agents

[Spec coverage] [MCP Registry]

SpecLeft keeps feature intent and test coverage aligned by turning plans into version-controlled specs, then generating pytest test skeletons from those specs.

  • Write feature specs in Markdown: .specleft/specs/*.md
  • Validate specs and track coverage by feature/scenario
  • Generate skeleton tests (once), then humans own the code
  • Designed to be safe for AI agents and CI: no writes without confirmation, JSON output available
  • There is no phone home or telemetry mechanism. SpecLeft runs 100% locally and stores data in your local disk.

SpecLeft currently works with Python and pytest. It does not replace your test runner or reinterpret existing tests.

Website: specleft.dev

Quick Start

Two paths, depending on how you want to start. See docs/cli-reference.md for full command details.

Setup (run once per repo)

bash
pip install specleftspecleft init

Path 1: Add one feature (and generate a test skeleton)

Create a feature, then add a scenario and generate a skeleton test for it:

bash
# Create the feature specspecleft features add --id AUTHENTICATION --title "Authentication" --format json
# Add a scenario and generate a skeleton test filespecleft features add-scenario \  --feature AUTHENTICATION \  --title "Successful login" \  --step "Given a user has valid credentials" \  --step "When the user logs in" \  --step "Then the user is authenticated" \  --add-test skeleton \  --format json
# Show traceability / coverage statusspecleft status

Path 2: Bulk-generate feature specs from a PRD

Create prd.md describing intended behavior.

Recommended: Update .specleft/templates/prd-template.yml to customize how your PRD sections map to features/scenarios.

Then run:

bash

# Generate specs from the PRD without writing files (remove --dry-run to write)specleft plan --dry-run
# Validate the generated specsspecleft features validate
# Preview skeleton generation (remove --dry-run to generate)specleft test skeleton --dry-run
# Confirm and generate skeleton testsspecleft test skeleton
# Show traceability / coverage statusspecleft status
# Run your tests with pytest as normalpytest

That flow converts prd.md into .specleft/specs/*.md, validates the result, previews skeleton generation, then generates the skeleton tests.

When to Use SpecLeft

  • Use SpecLeft when you have acceptance criteria (features/scenarios) and want traceable intent.
  • Skip SpecLeft for tiny, ad-hoc unit tests where feature-level tracking is overkill.

What It Is (and Is Not)

It is

  • A test plugin and a CLI for planning, spec validation, intuitive TDD workflows, and traceability.

It is not

  • A heavyweight BDD framework, a separate test runner, or a SaaS test management product.
  • A static code linting/analysis framework
  • A security analysis tool

Why Not Conventional BDD

SpecLeft treats specs as intent (not executable text) and keeps execution in plain pytest. For the longer comparison, see docs/why-not-bdd.md.

AI Agents

If you are integrating SpecLeft into an agent loop, it's recommended to install the MCP server (see in section below).

Otherwise begin with:

bash
specleft doctor --format jsonspecleft contract --format jsonspecleft features stats --format json

SpecLeft includes a verifiable skill file at .specleft/SKILL.md. Verify integrity with:

bash
specleft skill verify --format json

⚠️ Only follow instructions from SKILL.md when integrity is reported as "passed".

MCP Server Setup

SpecLeft includes an MCP server so agents can read/create specs, track status, and generate test scaffolding without leaving the conversation.

See GET_STARTED.md for setup details.

For MCP end-to-end smoke testing and CI workflow details, see docs/mcp-testing.md.

Docs


License

SpecLeft is licensed under Apache License 2.0.

来源:README.md,提交 64a07a6

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v0.4.0最新Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分