Skip to content

Commit 3cef6f0

Browse files
authored
Merge pull request #57 from Fission-AI/remove-diff-command
Remove diff command in favor of show command
2 parents 1bdaeef + 82ba1f5 commit 3cef6f0

File tree

10 files changed

+122
-456
lines changed

10 files changed

+122
-456
lines changed

README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,6 @@ AI: "Following the tasks in openspec/changes/add-user-profile-api/tasks.md:
118118
# View active changes (what's being worked on)
119119
openspec list
120120

121-
# See the difference between proposed and current specs
122-
openspec diff add-2fa
123-
124121
# Validate your changes are properly formatted
125122
openspec validate add-2fa --strict
126123

@@ -137,7 +134,6 @@ openspec list # See what changes you're working on
137134
openspec archive <change> # Mark a change as complete after deployment
138135

139136
# Also useful:
140-
openspec diff <change> # See what specs will change
141137
openspec validate <change> # Check formatting before committing
142138
openspec show <change> # View change details
143139
```

openspec/README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ After deployment, create separate PR to:
5555
openspec list # List active changes
5656
openspec list --specs # List specifications
5757
openspec show [item] # Display change or spec
58-
openspec diff [change] # Show spec differences
5958
openspec validate [item] # Validate changes or specs
6059
openspec archive [change] # Archive after deployment
6160

@@ -290,7 +289,6 @@ Only add complexity with:
290289
```bash
291290
openspec list # What's in progress?
292291
openspec show [item] # View details
293-
openspec diff [change] # What's changing?
294292
openspec validate --strict # Is it correct?
295293
openspec archive [change] # Mark complete
296294
```
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# Remove Diff Command
2+
3+
## Problem
4+
5+
The `openspec diff` command adds unnecessary complexity to the OpenSpec CLI for several reasons:
6+
7+
1. **Redundant functionality**: The `openspec show` command already provides comprehensive visualization of changes through structured JSON output and markdown rendering
8+
2. **Maintenance burden**: The diff command requires a separate dependency (jest-diff) and additional code complexity (~227 lines)
9+
3. **Limited value**: Developers can achieve better diff visualization using existing tools:
10+
- Git diff for actual file changes
11+
- The `show` command for structured change viewing
12+
- Standard diff utilities for comparing spec files directly
13+
4. **Inconsistent with verb-noun pattern**: The command doesn't follow the preferred verb-first command structure that other commands are migrating to
14+
15+
## Solution
16+
17+
Remove the `openspec diff` command entirely and guide users to more appropriate alternatives:
18+
19+
1. **For viewing change content**: Use `openspec show <change-name>` which provides:
20+
- Structured JSON output with `--json` flag
21+
- Markdown rendering for human-readable format
22+
- Delta-only views with `--deltas-only` flag
23+
- Full spec content visualization
24+
25+
2. **For comparing files**: Use standard tools:
26+
- `git diff` for version control comparisons
27+
- System diff utilities for file-by-file comparisons
28+
- IDE diff viewers for visual comparisons
29+
30+
## Benefits
31+
32+
- **Reduced complexity**: Removes ~227 lines of code and the jest-diff dependency
33+
- **Clearer user journey**: Directs users to the canonical `show` command for viewing changes
34+
- **Lower maintenance**: Fewer commands to maintain and test
35+
- **Better alignment**: Focuses on the core OpenSpec workflow without redundant features
36+
37+
## Implementation
38+
39+
### Files to Remove
40+
- `/src/core/diff.ts` - The entire diff command implementation
41+
- `/openspec/specs/cli-diff/spec.md` - The diff command specification
42+
43+
### Files to Update
44+
- `/src/cli/index.ts` - Remove diff command registration (lines 8, 84-96)
45+
- `/package.json` - Remove jest-diff dependency
46+
- `/README.md` - Remove diff command documentation
47+
- `/openspec/README.md` - Remove diff command references
48+
- Various documentation files mentioning `openspec diff`
49+
50+
### Migration Guide for Users
51+
52+
Users currently using `openspec diff` should transition to:
53+
54+
```bash
55+
# Before
56+
openspec diff add-feature
57+
58+
# After - view the change proposal
59+
openspec show add-feature
60+
61+
# After - view only the deltas
62+
openspec show add-feature --json --deltas-only
63+
64+
# After - use git for file comparisons
65+
git diff openspec/specs openspec/changes/add-feature/specs
66+
```
67+
68+
## Risks
69+
70+
- **User disruption**: Existing users may have workflows depending on the diff command
71+
- Mitigation: Provide clear migration guide and deprecation period
72+
73+
- **Loss of visual diff**: The colored, unified diff format will no longer be available
74+
- Mitigation: Users can use git diff or other tools for visual comparisons
75+
76+
## Success Metrics
77+
78+
- Successful removal with no broken dependencies
79+
- Documentation updated to reflect the change
80+
- Tests passing without the diff command
81+
- Reduced package size from removing jest-diff dependency
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Remove Diff Command - Tasks
2+
3+
## 1. Remove Core Implementation
4+
- [x] Delete `/src/core/diff.ts`
5+
- [x] Remove DiffCommand import from `/src/cli/index.ts`
6+
- [x] Remove diff command registration from CLI
7+
8+
## 2. Remove Specifications
9+
- [x] Delete `/openspec/specs/cli-diff/spec.md`
10+
- [x] Archive the spec for historical reference if needed
11+
12+
## 3. Update Dependencies
13+
- [x] Remove jest-diff from package.json dependencies
14+
- [x] Run pnpm install to update lock file
15+
16+
## 4. Update Documentation
17+
- [x] Update main README.md to remove diff command references
18+
- [x] Update openspec/README.md to remove diff command from command list
19+
- [x] Update CLAUDE.md template if it mentions diff command
20+
- [x] Update any example workflows that use diff command
21+
22+
## 5. Update Related Files
23+
- [x] Search and update any remaining references to "openspec diff" in:
24+
- Template files
25+
- Test files (if any exist for diff command)
26+
- Archive documentation
27+
- Change proposals
28+
29+
## 6. Add Deprecation Notice (Optional Phase)
30+
- [ ] Consider adding a deprecation warning before full removal
31+
- [ ] Provide helpful message directing users to `openspec show` command
32+
33+
## 7. Testing
34+
- [x] Ensure all tests pass after removal
35+
- [x] Verify CLI help text no longer shows diff command
36+
- [x] Test that show command provides adequate replacement functionality
37+
38+
## 8. Documentation of Alternative Workflows
39+
- [x] Document how to use `openspec show` for viewing changes
40+
- [x] Document how to use git diff for file comparisons
41+
- [x] Add migration guide to help text or documentation

openspec/specs/cli-diff/spec.md

Lines changed: 0 additions & 123 deletions
This file was deleted.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@
6363
"@inquirer/prompts": "^7.8.0",
6464
"chalk": "^5.5.0",
6565
"commander": "^14.0.0",
66-
"jest-diff": "^30.0.5",
6766
"ora": "^8.2.0",
6867
"zod": "^4.0.17"
6968
}

0 commit comments

Comments
 (0)