@sonar-autofix/core 0.0.4 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +9 -2
  2. package/package.json +5 -5
package/index.js CHANGED
@@ -91,6 +91,12 @@ class CoreOrchestrator {
91
91
  try {
92
92
  // Step 1: Create a working branch
93
93
  const branchName = this.config.git?.branch || 'sonar-autofix';
94
+ // Capture the base branch BEFORE switching to the working branch,
95
+ // so the PR targets the branch the CLI was actually running on
96
+ // (unless an explicit base branch is configured).
97
+ const baseBranch =
98
+ this.config.git?.baseBranch ||
99
+ (await this.gitClient.getCurrentBranch());
94
100
  if (!this.dryRun) {
95
101
  await this.gitClient.createBranch(branchName);
96
102
  console.log(`✓ Created branch: ${branchName}`);
@@ -185,6 +191,7 @@ class CoreOrchestrator {
185
191
  const prUrl = await this.gitClient.createPullRequest(
186
192
  'fix(sonar): automatically resolve Sonar issues',
187
193
  this.buildPRBody(totalFixed, iteration),
194
+ baseBranch,
188
195
  );
189
196
  console.log(`✓ Pull Request created: ${prUrl}`);
190
197
  }
@@ -435,7 +442,7 @@ Return ONLY the complete fixed file content, wrapped in a code block.`;
435
442
  * Build a descriptive PR body
436
443
  */
437
444
  buildPRBody(totalFixed, iterations) {
438
- return `## Automated Sonar Issue Fixes
445
+ return `Automated Sonar Issue Fixes
439
446
 
440
447
  This PR was automatically generated by **sonar-autofix**.
441
448
 
@@ -456,7 +463,7 @@ This PR was automatically generated by **sonar-autofix**.
456
463
  - Please review the changes carefully before merging.
457
464
 
458
465
  ---
459
- *Generated by [sonar-autofix](https://github.com/sonar-autofix)*`;
466
+ *Generated by [sonar-autofix]`;
460
467
  }
461
468
 
462
469
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sonar-autofix/core",
3
- "version": "0.0.4",
3
+ "version": "0.2.0",
4
4
  "description": "Core orchestrator for the Sonar Autofix tool",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -15,8 +15,8 @@
15
15
  "author": "Sonar Autofix Team",
16
16
  "license": "MIT",
17
17
  "dependencies": {
18
- "@sonar-autofix/sonar-client": "^0.0.3",
19
- "@sonar-autofix/llm-client": "^0.0.2",
20
- "@sonar-autofix/git-client": "^0.0.1"
18
+ "@sonar-autofix/sonar-client": "^0.2.0",
19
+ "@sonar-autofix/llm-client": "^0.2.0",
20
+ "@sonar-autofix/git-client": "^0.2.0"
21
21
  }
22
- }
22
+ }