Skip to content

Comments

feat: add patches debug commands for inspecting and restoring custom code#1908

Merged
mfbx9da4 merged 7 commits intomainfrom
ash/updates-to-patches-command
Feb 24, 2026
Merged

feat: add patches debug commands for inspecting and restoring custom code#1908
mfbx9da4 merged 7 commits intomainfrom
ash/updates-to-patches-command

Conversation

@AshGodfrey
Copy link
Contributor

@AshGodfrey AshGodfrey commented Feb 24, 2026

Summary

  • Centralizes git repository opening with OpenGitRepository helper in internal/patches/git_repository.go
  • Adds view-diff file command to show unified diff between pristine and current version of a single file
  • Adds view-diff files command to list all files with custom code applied
  • Adds restore-pristine file command to restore a single file to its pristine generated version
  • Adds restore-pristine all command to restore all files with custom code to pristine
  • Extracts shared config/lockfile loading into common.go to deduplicate across commands
  • Uses byte comparison instead of diff computation for restore-pristine all performance

Commands

speakeasy patches
├── view-pristine -f <file>         # Show pristine (generated) version of a file
├── view-diff
│   ├── file -f <file>              # Show diff between pristine and current
│   └── files                       # List all files with custom code
└── restore-pristine
    ├── all                          # Restore all files to pristine
    └── file -f <file>              # Restore one file to pristine

Test plan

  • Tested all commands against tag-test SDK (TypeScript) and client-python-private (Python)
  • Verified view-diff files only reports files with actual content changes vs pristine (not deletions/moves)
  • Verified restore-pristine all correctly restores multiple files and reports count
  • Verified idempotency — running restore-pristine all twice shows no files on second run
  • go build succeeds

🤖 Generated with Claude Code

AshGodfrey and others added 5 commits February 24, 2026 15:01
Add OpenGitRepository helper to avoid duplicating git.NewLocalRepository +
WrapGitRepository in every caller. Also fixes view-diff files to compare
against pristine git objects rather than LastWriteChecksum.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds `speakeasy patches view-diff file -f <path>` to show the unified diff
between pristine and current version of a single file. Extracts shared
config/lockfile loading into common.go to remove duplication across commands.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…d version

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…tine all

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@AshGodfrey AshGodfrey changed the title refactor: centralize git repository opening in patches package feat: add patches debug commands for inspecting and restoring custom code Feb 24, 2026
AshGodfrey and others added 2 commits February 24, 2026 15:30
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…mands

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@mfbx9da4 mfbx9da4 enabled auto-merge (squash) February 24, 2026 16:13
@mfbx9da4 mfbx9da4 merged commit 9415934 into main Feb 24, 2026
4 checks passed
@mfbx9da4 mfbx9da4 deleted the ash/updates-to-patches-command branch February 24, 2026 16:13
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.

2 participants