Feature request: `openspec drift` — detect divergence between git changes and active change scope

未关闭
#2,201 0 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
35/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
活跃
技术栈
git, typescript

调研方向

Start by reading src/core/store/git.ts to understand the existing git utilities, then inspect the CLI command structure and how it parses tasks.md and design.md. Define how file references map to git changes and how phantom completions are identified; done means reporting aligned and unscoped changes and checked tasks with untouched paths, with --json output. The issue proposes the behavior but does not name CLI files or tests.

由索引模型根据 Issue 内容生成。

描述

The problem, in one or two sentences

During implementation (/opsx:apply or manual coding), there is no way to verify whether the files actually modified in git match the scope declared in tasks.md and design.md. Coding agents can silently touch files outside the plan (scope creep or unintended regressions) or check off tasks without actually modifying the relevant files (phantom completions), with no CLI command to catch this drift before archiving or opening a PR.

Who this affects

Everyone using coding agents (Claude Code, Cursor, Copilot, Cline, etc.) and teams reviewing PRs. Because agents frequently make extraneous edits or hallucinate task completion, verifying that the git working tree aligns with the spec is currently a tedious, manual review step for every change.

Alternatives you considered
  • openspec validate: Only checks Markdown schemas, structure, placeholders, and RFC 2119 keywords inside openspec/. It has zero awareness of the git working tree or codebase files.
  • /opsx:verify: Relies entirely on the LLM's subjective self-evaluation inside the agent chat session. It consumes substantial token context, can be nondeterministic, and does not provide a fast, offline verification in CI or terminal.
  • Manual git status / git diff: Developers and reviewers must manually cross-reference dozens of changed lines against task checkboxes.
Why it's worth the added complexity

OpenSpec’s core value is keeping agents and humans honest on a single plan. Catching drift between the spec plan and actual code before archiving or merging is the missing link between spec authoring and code implementation.

  • Zero heavy dependencies: OpenSpec already has git utilities in src/core/store/git.ts.
  • Fast & deterministic: Runs in sub-second CLI time without needing an LLM call.
  • CI-friendly: Can run as a gate in pull requests (openspec drift --strict / --json) to ensure PRs don't introduce un-scoped changes.
What you have in mind

A lightweight command like openspec drift [change-name] (or flag on openspec validate):

  1. Extract scope from change artifacts:
    • Parse file paths, directories, and components referenced in tasks.md and design.md.
  2. Inspect git changes:
    • Read modified files from git status --porcelain (or git diff --name-only <base>...HEAD).
  3. Report alignment:
    • Unscoped changes: files modified in git with no reference or relevance in the active change.
    • Phantom completions: tasks marked [x] whose referenced files/paths were never touched.
    • Aligned changes: summary of files modified that match planned tasks.
  4. Provide --json output complying with the agent contract for tool integration.

I would love to help design and implement this if the maintainers agree this fits OpenSpec's roadmap!

主要语言
TypeScript
星标
76k
派生
5.2k
平均合并
1 天 5 小时
30 天内合并 PR
58

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Fission-AI/OpenSpec 的其他 Issue

查看 Fission-AI/OpenSpec 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。