sonar-autofix 0.0.5 → 0.0.7

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.
package/.idea/vcs.xml ADDED
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="" vcs="Git" />
5
+ </component>
6
+ </project>
@@ -5,17 +5,8 @@
5
5
  </component>
6
6
  <component name="ChangeListManager">
7
7
  <list default="true" id="2b435513-27c8-4fc6-b596-5368f46599ce" name="Changes" comment="package publishing changes">
8
- <change beforePath="$PROJECT_DIR$/packages/cli/index.js" beforeDir="false" afterPath="$PROJECT_DIR$/packages/cli/index.js" afterDir="false" />
8
+ <change beforePath="$PROJECT_DIR$/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/package.json" afterDir="false" />
9
9
  <change beforePath="$PROJECT_DIR$/packages/cli/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/packages/cli/package.json" afterDir="false" />
10
- <change beforePath="$PROJECT_DIR$/packages/core/index.js" beforeDir="false" afterPath="$PROJECT_DIR$/packages/core/index.js" afterDir="false" />
11
- <change beforePath="$PROJECT_DIR$/packages/core/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/packages/core/package.json" afterDir="false" />
12
- <change beforePath="$PROJECT_DIR$/packages/git-client/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/packages/git-client/package.json" afterDir="false" />
13
- <change beforePath="$PROJECT_DIR$/packages/github-action/action.yml" beforeDir="false" afterPath="$PROJECT_DIR$/packages/github-action/action.yml" afterDir="false" />
14
- <change beforePath="$PROJECT_DIR$/packages/github-action/index.js" beforeDir="false" afterPath="$PROJECT_DIR$/packages/github-action/index.js" afterDir="false" />
15
- <change beforePath="$PROJECT_DIR$/packages/github-action/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/packages/github-action/package.json" afterDir="false" />
16
- <change beforePath="$PROJECT_DIR$/packages/llm-client/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/packages/llm-client/package.json" afterDir="false" />
17
- <change beforePath="$PROJECT_DIR$/packages/sonar-client/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/packages/sonar-client/package.json" afterDir="false" />
18
- <change beforePath="$PROJECT_DIR$/packages/validator/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/packages/validator/package.json" afterDir="false" />
19
10
  </list>
20
11
  <option name="SHOW_DIALOG" value="false" />
21
12
  <option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -23,6 +14,7 @@
23
14
  <option name="LAST_RESOLUTION" value="IGNORE" />
24
15
  </component>
25
16
  <component name="EmbeddingIndexingInfo">
17
+ <option name="cachedIndexableFilesCount" value="25" />
26
18
  <option name="fileBasedEmbeddingIndicesEnabled" value="true" />
27
19
  </component>
28
20
  <component name="Git.Settings">
@@ -37,61 +29,61 @@
37
29
  </component>
38
30
  <component name="NextEditCompletionFeaturesState">
39
31
  <decayedCancelled>
40
- <entry key="MS100" value="1.6744833171325262" />
41
- <entry key="MS500" value="2.58172093612023" />
42
- <entry key="S2" value="2.8844669777281875" />
43
- <entry key="S5" value="2.952829092826303" />
44
- <entry key="S10" value="2.9775799052902783" />
45
- <entry key="S30" value="3.2207563904736163" />
46
- <entry key="S60" value="4.125034379367315" />
47
- <entry key="M2" value="6.484005379877605" />
48
- <entry key="M5" value="16.623270843638018" />
49
- <entry key="M10" value="29.496886119445264" />
50
- <entry key="M15" value="38.53321653752027" />
51
- <entry key="M30" value="70.6509361650961" />
52
- <entry key="H1" value="145.50802139516395" />
53
- <entry key="H2" value="245.85094452197504" />
54
- <entry key="H4" value="356.03484955949796" />
55
- <entry key="D1" value="698.1026936159626" />
56
- <entry key="W1" value="847.6316849660216" />
32
+ <entry key="MS100" value="1.0" />
33
+ <entry key="MS500" value="1.0000010630696083" />
34
+ <entry key="S2" value="1.085698262886935" />
35
+ <entry key="S5" value="1.8553209869316774" />
36
+ <entry key="S10" value="2.848026798066077" />
37
+ <entry key="S30" value="4.103355747015544" />
38
+ <entry key="S60" value="4.865704926318314" />
39
+ <entry key="M2" value="7.0166618967179355" />
40
+ <entry key="M5" value="17.887823189073007" />
41
+ <entry key="M10" value="39.8043532550405" />
42
+ <entry key="M15" value="58.4186986090559" />
43
+ <entry key="M30" value="103.34134703824637" />
44
+ <entry key="H1" value="184.35992450148024" />
45
+ <entry key="H2" value="295.26760130871315" />
46
+ <entry key="H4" value="417.9066226756095" />
47
+ <entry key="D1" value="780.6170757948555" />
48
+ <entry key="W1" value="937.998753014559" />
57
49
  </decayedCancelled>
58
50
  <decayedSelected>
59
51
  <entry key="MS100" value="0.0" />
60
52
  <entry key="MS500" value="0.0" />
61
- <entry key="S2" value="8.004104522733288E-98" />
62
- <entry key="S5" value="1.7659974950749445E-39" />
63
- <entry key="S10" value="5.606983364968166E-20" />
64
- <entry key="S30" value="6.007864112985362E-7" />
65
- <entry key="S60" value="0.0011366291571186739" />
66
- <entry key="M2" value="0.053374018625082606" />
67
- <entry key="M5" value="0.5796786411829966" />
68
- <entry key="M10" value="1.3138956828306059" />
69
- <entry key="M15" value="1.7608935390999911" />
70
- <entry key="M30" value="2.67969488017297" />
71
- <entry key="H1" value="4.088046159387631" />
72
- <entry key="H2" value="5.749963416540233" />
73
- <entry key="H4" value="7.4206497976591725" />
74
- <entry key="D1" value="11.833666975867306" />
75
- <entry key="W1" value="13.637653890653624" />
53
+ <entry key="S2" value="1.5053480704232286E-96" />
54
+ <entry key="S5" value="4.688725113954481E-39" />
55
+ <entry key="S10" value="6.847426607094436E-20" />
56
+ <entry key="S30" value="4.091173421392379E-7" />
57
+ <entry key="S60" value="6.427052721421471E-4" />
58
+ <entry key="M2" value="0.027757665603434716" />
59
+ <entry key="M5" value="0.38154513615045355" />
60
+ <entry key="M10" value="1.2137523181031915" />
61
+ <entry key="M15" value="1.9513320700484582" />
62
+ <entry key="M30" value="3.519262710611161" />
63
+ <entry key="H1" value="5.4992232557998015" />
64
+ <entry key="H2" value="7.667270491124691" />
65
+ <entry key="H4" value="9.738061899504235" />
66
+ <entry key="D1" value="14.660909742889698" />
67
+ <entry key="W1" value="16.60958115381583" />
76
68
  </decayedSelected>
77
69
  <decayedShown>
78
- <entry key="MS100" value="1.5755714284839712" />
79
- <entry key="MS500" value="2.55267875896726" />
80
- <entry key="S2" value="2.8764410362323525" />
81
- <entry key="S5" value="2.9495496407514823" />
82
- <entry key="S10" value="2.975927565551862" />
83
- <entry key="S30" value="3.220162936681101" />
84
- <entry key="S60" value="4.1257516017012605" />
85
- <entry key="M2" value="6.5362002384950975" />
86
- <entry key="M5" value="17.19949398327749" />
87
- <entry key="M10" value="30.807204946579795" />
88
- <entry key="M15" value="40.29098126195295" />
89
- <entry key="M30" value="73.32822699520365" />
90
- <entry key="H1" value="149.59415118159862" />
91
- <entry key="H2" value="251.59949415755062" />
92
- <entry key="H4" value="363.45450004438277" />
93
- <entry key="D1" value="709.9360002138405" />
94
- <entry key="W1" value="861.2692745399029" />
70
+ <entry key="MS100" value="0.9592641193252643" />
71
+ <entry key="MS500" value="0.9917177866077763" />
72
+ <entry key="S2" value="1.0834785316787015" />
73
+ <entry key="S5" value="1.8539240744953136" />
74
+ <entry key="S10" value="2.8470013113855037" />
75
+ <entry key="S30" value="4.102874355898777" />
76
+ <entry key="S60" value="4.86600845323043" />
77
+ <entry key="M2" value="7.043660987515908" />
78
+ <entry key="M5" value="18.266745639553655" />
79
+ <entry key="M10" value="41.014390097897845" />
80
+ <entry key="M15" value="60.36620132604634" />
81
+ <entry key="M30" value="106.85726199633412" />
82
+ <entry key="H1" value="189.85651925438876" />
83
+ <entry key="H2" value="302.9329937229338" />
84
+ <entry key="H4" value="427.6434113749325" />
85
+ <entry key="D1" value="795.277569646641" />
86
+ <entry key="W1" value="954.6082613335526" />
95
87
  </decayedShown>
96
88
  </component>
97
89
  <component name="ProjectColorInfo">{
@@ -103,35 +95,35 @@
103
95
  <option name="hideEmptyMiddlePackages" value="true" />
104
96
  <option name="showLibraryContents" value="true" />
105
97
  </component>
106
- <component name="PropertiesComponent"><![CDATA[{
107
- "keyToString": {
108
- "ModuleVcsDetector.initialDetectionPerformed": "true",
109
- "RunOnceActivity.MCP Project settings loaded": "true",
110
- "RunOnceActivity.ShowReadmeOnStart": "true",
111
- "RunOnceActivity.git.unshallow": "true",
112
- "RunOnceActivity.typescript.service.memoryLimit.init": "true",
113
- "SONARLINT_PRECOMMIT_ANALYSIS": "true",
114
- "codeWithMe.voiceChat.enabledByDefault": "false",
115
- "com.intellij.ml.llm.matterhorn.ej.ui.settings.DefaultModelSelectionForGA.v1": "true",
116
- "git-widget-placeholder": "master",
117
- "javascript.nodejs.core.library.configured.version": "24.18.0",
118
- "javascript.nodejs.core.library.typings.version": "24.13.3",
119
- "javascript.preferred.runtime.type.id": "node",
120
- "junie.onboarding.icon.badge.shown": "true",
121
- "last_opened_file_path": "/Users/divyaaditya/projects/sonar-autofix",
122
- "node.js.detected.package.eslint": "true",
123
- "node.js.detected.package.jshint": "true",
124
- "node.js.detected.package.tslint": "true",
125
- "node.js.selected.package.eslint": "(autodetect)",
126
- "node.js.selected.package.jshint": "",
127
- "node.js.selected.package.tslint": "(autodetect)",
128
- "nodejs_interpreter_path": "node",
129
- "nodejs_package_manager_path": "npm",
130
- "settings.editor.selected.configurable": "project.propVCSSupport.DirectoryMappings",
131
- "to.speed.mode.migration.done": "true",
132
- "ts.external.directory.path": "/Applications/WebStorm.app/Contents/plugins/javascript-plugin/jsLanguageServicesImpl/external"
98
+ <component name="PropertiesComponent">{
99
+ &quot;keyToString&quot;: {
100
+ &quot;ModuleVcsDetector.initialDetectionPerformed&quot;: &quot;true&quot;,
101
+ &quot;RunOnceActivity.MCP Project settings loaded&quot;: &quot;true&quot;,
102
+ &quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
103
+ &quot;RunOnceActivity.git.unshallow&quot;: &quot;true&quot;,
104
+ &quot;RunOnceActivity.typescript.service.memoryLimit.init&quot;: &quot;true&quot;,
105
+ &quot;SONARLINT_PRECOMMIT_ANALYSIS&quot;: &quot;true&quot;,
106
+ &quot;codeWithMe.voiceChat.enabledByDefault&quot;: &quot;false&quot;,
107
+ &quot;com.intellij.ml.llm.matterhorn.ej.ui.settings.DefaultModelSelectionForGA.v1&quot;: &quot;true&quot;,
108
+ &quot;git-widget-placeholder&quot;: &quot;master&quot;,
109
+ &quot;javascript.nodejs.core.library.configured.version&quot;: &quot;24.18.0&quot;,
110
+ &quot;javascript.nodejs.core.library.typings.version&quot;: &quot;24.13.3&quot;,
111
+ &quot;javascript.preferred.runtime.type.id&quot;: &quot;node&quot;,
112
+ &quot;junie.onboarding.icon.badge.shown&quot;: &quot;true&quot;,
113
+ &quot;last_opened_file_path&quot;: &quot;/Users/divyaaditya/projects/sonar-autofix&quot;,
114
+ &quot;node.js.detected.package.eslint&quot;: &quot;true&quot;,
115
+ &quot;node.js.detected.package.jshint&quot;: &quot;true&quot;,
116
+ &quot;node.js.detected.package.tslint&quot;: &quot;true&quot;,
117
+ &quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;,
118
+ &quot;node.js.selected.package.jshint&quot;: &quot;&quot;,
119
+ &quot;node.js.selected.package.tslint&quot;: &quot;(autodetect)&quot;,
120
+ &quot;nodejs_interpreter_path&quot;: &quot;node&quot;,
121
+ &quot;nodejs_package_manager_path&quot;: &quot;npm&quot;,
122
+ &quot;settings.editor.selected.configurable&quot;: &quot;project.propVCSSupport.DirectoryMappings&quot;,
123
+ &quot;to.speed.mode.migration.done&quot;: &quot;true&quot;,
124
+ &quot;ts.external.directory.path&quot;: &quot;/Applications/WebStorm.app/Contents/plugins/javascript-plugin/jsLanguageServicesImpl/external&quot;
133
125
  }
134
- }]]></component>
126
+ }</component>
135
127
  <component name="RecentsManager">
136
128
  <key name="CopyFile.RECENT_KEYS">
137
129
  <recent name="$PROJECT_DIR$" />
@@ -164,7 +156,9 @@
164
156
  <workItem from="1788169983174" duration="1684000" />
165
157
  <workItem from="1788171725187" duration="4774000" />
166
158
  <workItem from="1788177896634" duration="4501000" />
167
- <workItem from="1788182750659" duration="236000" />
159
+ <workItem from="1788182750659" duration="1495000" />
160
+ <workItem from="1788184609891" duration="38000" />
161
+ <workItem from="1788186007862" duration="1115000" />
168
162
  </task>
169
163
  <task id="LOCAL-00001" summary="package publishing changes">
170
164
  <option name="closed" value="true" />
@@ -174,7 +168,15 @@
174
168
  <option name="project" value="LOCAL" />
175
169
  <updated>1788181949023</updated>
176
170
  </task>
177
- <option name="localTasksCounter" value="2" />
171
+ <task id="LOCAL-00002" summary="package publishing changes">
172
+ <option name="closed" value="true" />
173
+ <created>1788186558939</created>
174
+ <option name="number" value="00002" />
175
+ <option name="presentableId" value="LOCAL-00002" />
176
+ <option name="project" value="LOCAL" />
177
+ <updated>1788186558939</updated>
178
+ </task>
179
+ <option name="localTasksCounter" value="3" />
178
180
  <servers />
179
181
  </component>
180
182
  <component name="TypeScriptGeneratedFilesManager">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sonar-autofix",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "scripts": {
5
5
  "test": "node tests/core.test.js",
6
6
  "test:structure": "node test-project.js"
File without changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sonar-autofix/cli",
3
- "version": "0.0.1",
3
+ "version": "0.0.4",
4
4
  "description": "CLI tool for the Sonar Autofix tool",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -18,6 +18,6 @@
18
18
  "author": "Sonar Autofix Team",
19
19
  "license": "MIT",
20
20
  "dependencies": {
21
- "@sonar-autofix/core": "^0.0.1"
21
+ "@sonar-autofix/core": "^0.0.3"
22
22
  }
23
23
  }
@@ -23,6 +23,7 @@ class CoreOrchestrator {
23
23
  constructor(config, deps = {}) {
24
24
  this.config = config;
25
25
  this.dryRun = config.dryRun || false;
26
+ this.restoreOnFail = config.restoreOnFail || false;
26
27
  this.retryLimit = config.retry?.maxRetries || DEFAULT_RETRY_LIMIT;
27
28
  this.maxIterations = config.retry?.maxIterations || DEFAULT_MAX_ITERATIONS;
28
29
  this.cwd = config.cwd || process.cwd();
@@ -139,7 +140,7 @@ class CoreOrchestrator {
139
140
  console.log(` ✓ ${filePath} fixed successfully`);
140
141
  } else {
141
142
  console.log(` ✗ ${filePath} could not be fixed — restoring original`);
142
- if (!this.dryRun) {
143
+ if (!this.dryRun && this.restoreOnFail) {
143
144
  await this.gitClient.restoreFile(filePath);
144
145
  }
145
146
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sonar-autofix/core",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "description": "Core orchestrator for the Sonar Autofix tool",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -16,7 +16,7 @@
16
16
  "license": "MIT",
17
17
  "dependencies": {
18
18
  "@sonar-autofix/sonar-client": "^0.0.1",
19
- "@sonar-autofix/llm-client": "^0.0.1",
19
+ "@sonar-autofix/llm-client": "^0.0.2",
20
20
  "@sonar-autofix/git-client": "^0.0.1"
21
21
  }
22
22
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  const axios = require('axios');
4
4
 
5
- const DEFAULT_TIMEOUT = 120000;
5
+ const DEFAULT_TIMEOUT = 360000;
6
6
  const MAX_RETRIES = 3;
7
7
  const RETRY_STATUS_CODES = [429, 500, 503];
8
8
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sonar-autofix/llm-client",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "LLM client for the Sonar Autofix tool",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,136 +0,0 @@
1
- # Publishing Instructions for sonar-autofix Monorepo
2
-
3
- This document outlines how to publish all packages in this monorepo to npm.
4
-
5
- ## Overview
6
- The project is a monorepo containing 7 packages under the `@sonar-autofix` scope:
7
- 1. @sonar-autofix/cli
8
- 2. @sonar-autofix/core
9
- 3. @sonar-autofix/git-client
10
- 4. @sonar-autofix/github-action
11
- 5. @sonar-autofix/llm-client
12
- 6. @sonar-autofix/sonar-client
13
- 7. @sonar-autofix/validator
14
-
15
- ## Prerequisites
16
- 1. You must have npm account with publish permissions
17
- 2. You need to be logged into npm: `npm login`
18
- 3. All packages must have unique versions (they currently all have version 0.0.1)
19
-
20
- ## Publishing Steps
21
-
22
- ### Option 1: Manual Publishing (Simplest)
23
- ```bash
24
- # Navigate to each package and publish individually
25
- cd packages/cli && npm publish
26
- cd ../core && npm publish
27
- cd ../git-client && npm publish
28
- cd ../github-action && npm publish
29
- cd ../llm-client && npm publish
30
- cd ../sonar-client && npm publish
31
- cd ../validator && npm publish
32
- ```
33
-
34
- ### Option 2: Using Changesets (Recommended for Version Management)
35
- 1. Install changesets:
36
- ```bash
37
- npm install @changesets/cli --save-dev
38
- ```
39
-
40
- 2. Initialize changesets:
41
- ```bash
42
- npx changeset init
43
- ```
44
-
45
- 3. Create a changeset for each package:
46
- ```bash
47
- npx changeset add
48
- ```
49
-
50
- 4. Generate version updates and publish:
51
- ```bash
52
- npx changeset version
53
- npm publish
54
- ```
55
-
56
- ### Option 3: Using Lerna (Alternative)
57
- 1. Install lerna:
58
- ```bash
59
- npm install lerna --save-dev
60
- ```
61
-
62
- 2. Configure lerna in root package.json:
63
- ```json
64
- {
65
- "name": "sonar-autofix",
66
- "version": "0.0.1",
67
- "lerna": {
68
- "packages": [
69
- "packages/*"
70
- ],
71
- "version": "independent"
72
- }
73
- }
74
- ```
75
-
76
- 3. Publish packages:
77
- ```bash
78
- npx lerna publish --scope @sonar-autofix/*
79
- ```
80
-
81
- ## Package Structure
82
- Each package contains:
83
- - `index.js` - Main implementation file
84
- - `package.json` - Package configuration (already properly set up)
85
- - Some packages also contain additional files:
86
- - `github-action` contains `action.yml`
87
- - All packages have proper main entry points
88
-
89
- ## Configuration Notes
90
- 1. All package.json files already correctly specify:
91
- - Scoped names: `@sonar-autofix/*`
92
- - Proper main entry points
93
- - Version numbers (currently 0.0.1 for all)
94
-
95
- 2. The root package.json includes:
96
- - `workspaces` configuration
97
- - Dependencies
98
-
99
- 3. Files to ensure are included in published packages:
100
- - All JavaScript files (index.js)
101
- - action.yml (for github-action package)
102
- - All necessary source code files
103
-
104
- ## Publishing Considerations
105
- 1. **Version Management**: All packages currently have version 0.0.1 - you should update these to appropriate versions
106
- 2. **Scope**: All packages are correctly scoped under `@sonar-autofix`
107
- 3. **Dependencies**: Packages depend on each other (e.g., CLI depends on core, which depends on other packages)
108
- 4. **Publish Access**: Make sure you have permissions to publish to the `@sonar-autofix` scope
109
-
110
- ## Troubleshooting
111
- 1. If publishing fails due to version conflicts:
112
- - Update version numbers in each package.json
113
- - Ensure versions are unique and follow semantic versioning
114
-
115
- 2. If files appear to be missing:
116
- - Check .npmignore files in each package directory
117
- - Ensure no files are being excluded
118
-
119
- 3. If you get 404 errors:
120
- - Make sure you're using the correct scope name
121
- - Verify that your npm account has proper permissions
122
-
123
- ## Best Practices
124
- 1. Use semantic versioning (v0.1.0, v0.2.0, etc.)
125
- 2. Consider using changesets or lerna for consistent versioning across packages
126
- 3. Document breaking changes in changelogs
127
- 4. Test package installations in clean environments before publishing
128
-
129
- ## Testing After Publishing
130
- After publishing, test installation:
131
- ```bash
132
- # In a new project
133
- npm install @sonar-autofix/cli
134
- ```
135
-
136
- Check that all expected files and functionality are present.