Skip to content

feat: adding applyPatchContent and applyFiles for supporting autofix f…#1371

Merged
rpapani merged 4 commits intomainfrom
code-apply-patch
Mar 31, 2026
Merged

feat: adding applyPatchContent and applyFiles for supporting autofix f…#1371
rpapani merged 4 commits intomainfrom
code-apply-patch

Conversation

@rpapani
Copy link
Copy Markdown
Contributor

@rpapani rpapani commented Feb 24, 2026

Autofix flows are currently using patch content stored in the suggestion or patch files, not the actual patch, so added the following support

  • Adds two new public methods to CloudManagerClient — applyPatchContent for applying patches from in-memory strings (no S3 download) and applyFiles for writing files directly to a clone and committing. These support autofix workflows where the patch content or file data is already available in memory.
  • Internally, the three apply methods (applyPatch, applyPatchContent, applyFiles) now share a single #applyChanges orchestration path that configures git identity, checks out the branch, runs the caller's apply callback, and optionally stages + commits.
  • createPullRequest now accepts an optional repoUrl parameter and constructs a pullRequestUrl from the CM API response's externalNumber. Supports GitHub and GitLab providers (including self-hosted instances). This is needed because the CM API response does not include a pull request URL directly.

Required for https://github.com/adobe/spacecat-autofix-worker/pull/445

rpapani and others added 2 commits March 25, 2026 22:01
Adds #buildPullRequestUrl instance method to construct the pull request
URL from externalNumber and repoUrl. Supports GitHub and GitLab providers.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
# Conflicts:
#	package-lock.json
#	packages/spacecat-shared-cloud-manager-client/src/index.js
@github-actions
Copy link
Copy Markdown

This PR will trigger a minor release when merged.

Comment thread packages/spacecat-shared-cloud-manager-client/src/index.js Dismissed
Comment thread packages/spacecat-shared-cloud-manager-client/src/index.js Dismissed
@vdua vdua changed the title feat: adding applyPathContent and applyFiles for supporting autofix f… feat: adding applyPatchContent and applyFiles for supporting autofix f… Mar 26, 2026
@rpapani rpapani merged commit 5bb9c2a into main Mar 31, 2026
7 checks passed
@rpapani rpapani deleted the code-apply-patch branch March 31, 2026 04:49
solaris007 pushed a commit that referenced this pull request Mar 31, 2026
## [@adobe/spacecat-shared-cloud-manager-client-v1.1.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-cloud-manager-client-v1.0.6...@adobe/spacecat-shared-cloud-manager-client-v1.1.0) (2026-03-31)

### Features

* adding applyPatchContent and applyFiles for supporting autofix for code opportunities ([#1371](#1371)) ([5bb9c2a](5bb9c2a))
@solaris007
Copy link
Copy Markdown
Member

🎉 This PR is included in version @adobe/spacecat-shared-cloud-manager-client-v1.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants