mirror of
https://github.com/Fission-AI/OpenSpec.git
synced 2026-09-14 20:16:53 +08:00
3.1 KiB
3.1 KiB
Remove Diff Command
Problem
The openspec diff command adds unnecessary complexity to the OpenSpec CLI for several reasons:
- Redundant functionality: The
openspec showcommand already provides comprehensive visualization of changes through structured JSON output and markdown rendering - Maintenance burden: The diff command requires a separate dependency (jest-diff) and additional code complexity (~227 lines)
- Limited value: Developers can achieve better diff visualization using existing tools:
- Git diff for actual file changes
- The
showcommand for structured change viewing - Standard diff utilities for comparing spec files directly
- Inconsistent with verb-noun pattern: The command doesn't follow the preferred verb-first command structure that other commands are migrating to
Solution
Remove the openspec diff command entirely and guide users to more appropriate alternatives:
-
For viewing change content: Use
openspec show <change-name>which provides:- Structured JSON output with
--jsonflag - Markdown rendering for human-readable format
- Delta-only views with
--deltas-onlyflag - Full spec content visualization
- Structured JSON output with
-
For comparing files: Use standard tools:
git difffor version control comparisons- System diff utilities for file-by-file comparisons
- IDE diff viewers for visual comparisons
Benefits
- Reduced complexity: Removes ~227 lines of code and the jest-diff dependency
- Clearer user journey: Directs users to the canonical
showcommand for viewing changes - Lower maintenance: Fewer commands to maintain and test
- Better alignment: Focuses on the core OpenSpec workflow without redundant features
Implementation
Files to Remove
/src/core/diff.ts- The entire diff command implementation/openspec/specs/cli-diff/spec.md- The diff command specification
Files to Update
/src/cli/index.ts- Remove diff command registration (lines 8, 84-96)/package.json- Remove jest-diff dependency/README.md- Remove diff command documentation/openspec/README.md- Remove diff command references- Various documentation files mentioning
openspec diff
Migration Guide for Users
Users currently using openspec diff should transition to:
# Before
openspec diff add-feature
# After - view the change proposal
openspec show add-feature
# After - view only the deltas
openspec show add-feature --json --deltas-only
# After - use git for file comparisons
git diff openspec/specs openspec/changes/add-feature/specs
Risks
-
User disruption: Existing users may have workflows depending on the diff command
- Mitigation: Provide clear migration guide and deprecation period
-
Loss of visual diff: The colored, unified diff format will no longer be available
- Mitigation: Users can use git diff or other tools for visual comparisons
Success Metrics
- Successful removal with no broken dependencies
- Documentation updated to reflect the change
- Tests passing without the diff command
- Reduced package size from removing jest-diff dependency