Skip to content

feat: implement read-only what-if analysis command#2182

Open
DevAbdullah90 wants to merge 3 commits intogithub:mainfrom
DevAbdullah90:feat/what-if-analysis
Open

feat: implement read-only what-if analysis command#2182
DevAbdullah90 wants to merge 3 commits intogithub:mainfrom
DevAbdullah90:feat/what-if-analysis

Conversation

@DevAbdullah90
Copy link
Copy Markdown

Description

This PR implements a new /speckit.whatif command that provides a read-only "What-if" analysis for requirement changes. This feature enables teams to preview the downstream impact (complexity, effort, tasks, and risks) of a specification change before committing any changes to the project files.

Key Features:

  • Complexity Delta: Calculates a heuristic-based complexity score (1-100) comparing the current state to the simulated post-change state.
  • Effort Estimation: Provides a person-hour estimate to implement the proposed change.
  • Task Diff: Identifies which tasks would be [ADDED], [REMOVED], or [CHANGED] based on the new requirements.
  • Risk Assessment: Highlights potential technical debt, breaking changes, or conflicts with the project's constitution.
  • Side-by-Side Preview: Generates a simulated diff preview for the most significantly impacted artifacts.

Testing

  • Tested locally with specify version and specify init.
  • Verified that the new /speckit.whatif command appears correctly in the Enhancement Commands panel during project setup.
  • Verified that command templates (e.g., speckit.whatif.agent.md) are correctly generated in the agent's integration folder.
  • Confirmed the execution is strictly read-only and does not modify any local files.

AI Disclosure

  • I did use AI assistance (Antigravity) for this contribution.
  • Description: The AI helped design the prompt logic for the whatif.md template, updated the Python CLI metadata for command registration, and assisted in revising the documentation to include the new command.

Fixes #2176

@DevAbdullah90 DevAbdullah90 requested a review from mnriem as a code owner April 11, 2026 22:09
Copy link
Copy Markdown
Collaborator

@mnriem mnriem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please deliver this as an extension as per https://github.com/github/spec-kit/tree/main/extensions

@mnriem mnriem self-assigned this Apr 13, 2026
@DevAbdullah90
Copy link
Copy Markdown
Author

I have refactored the implementation to deliver the "what-if" analysis as a standalone extension rather than a core feature.

Changes in this PR:

  • Moved to Extension: All "what-if" logic has been moved to a new directory: extensions/whatif/.
  • Core Reversion: Reverted changes to core files (README.md, src/specify_cli/__init__.py, and agent integrations) to keep the core codebase clean and modular.
  • Extension Manifest: Added extensions/whatif/extension.yml defining the speckit.whatif.analyze command.
  • Modular Design: The analysis logic is now contained in extensions/whatif/commands/analyze.md, and I've added a dedicated README.md for the extension.

The feature is now fully optional and can be added via specify extension add whatif. Ready for another look!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: What-if analysis for spec requirement changes

2 participants