auto-cr-cmd 2.0.97 → 2.0.99

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 WeiweiWang
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/dist/index.js CHANGED
File without changes
@@ -198,6 +198,9 @@ function renderViolations(filePath, violations, options) {
198
198
  var indent = ' ';
199
199
  var colon = language === 'zh' ? ':' : ':';
200
200
  var headerGap = language === 'zh' ? '' : ' ';
201
+ var writeLine = function (stream, line) {
202
+ stream.write("".concat(line, "\n"));
203
+ };
201
204
  (_b = options.onBeforeReport) === null || _b === void 0 ? void 0 : _b.call(options);
202
205
  violations.forEach(function (violation) {
203
206
  var timestamp = formatter.format(new Date());
@@ -206,18 +209,22 @@ function renderViolations(filePath, violations, options) {
206
209
  var logger = getLoggerForSeverity(violation.severity);
207
210
  var header = "[".concat(timestamp, "] ").concat(severityIcon, " [").concat(tagLabel, "]").concat(colon).concat(headerGap).concat(violation.ruleName);
208
211
  logger(header);
212
+ // 让 header 与详情走同一输出流,避免 stdout/stderr 混排导致顺序错乱。
213
+ var detailStream = violation.severity === auto_cr_rules_1.RuleSeverity.Error || violation.severity === auto_cr_rules_1.RuleSeverity.Warning
214
+ ? process.stderr
215
+ : process.stdout;
209
216
  var location = typeof violation.line === 'number' ? "".concat(filePath, ":").concat(violation.line) : filePath;
210
- consola_1.default.log("".concat(indent).concat(t.reporterFileLabel(), ": ").concat(location));
211
- consola_1.default.log("".concat(indent).concat(t.reporterDescriptionLabel(), ": ").concat(violation.message));
217
+ writeLine(detailStream, "".concat(indent).concat(t.reporterFileLabel(), ": ").concat(location));
218
+ writeLine(detailStream, "".concat(indent).concat(t.reporterDescriptionLabel(), ": ").concat(violation.message));
212
219
  if (violation.code) {
213
- consola_1.default.log("".concat(indent).concat(t.reporterCodeLabel(), ": ").concat(violation.code));
220
+ writeLine(detailStream, "".concat(indent).concat(t.reporterCodeLabel(), ": ").concat(violation.code));
214
221
  }
215
222
  if (violation.suggestions && violation.suggestions.length > 0) {
216
223
  var suggestionSeparator = language === 'zh' ? '; ' : ' | ';
217
224
  var suggestionLine = violation.suggestions
218
225
  .map(function (suggestion) { return t.reporterFormatSuggestion(suggestion); })
219
226
  .join(suggestionSeparator);
220
- consola_1.default.log("".concat(indent).concat(t.reporterSuggestionLabel(), ": ").concat(suggestionLine));
227
+ writeLine(detailStream, "".concat(indent).concat(t.reporterSuggestionLabel(), ": ").concat(suggestionLine));
221
228
  }
222
229
  });
223
230
  (_c = options.onAfterReport) === null || _c === void 0 ? void 0 : _c.call(options);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "auto-cr-cmd",
3
- "version": "2.0.97",
3
+ "version": "2.0.99",
4
4
  "description": "Fast automated code review CLI powered by SWC-based static analysis",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/types/index.d.ts",
@@ -10,18 +10,6 @@
10
10
  "files": [
11
11
  "dist"
12
12
  ],
13
- "scripts": {
14
- "build": "tsc --build tsconfig.json",
15
- "build:force": "tsc --build tsconfig.json --force",
16
- "postbuild": "node ../../scripts/readme-sync.mjs copy auto-cr-cmd",
17
- "postbuild:force": "node ../../scripts/readme-sync.mjs copy auto-cr-cmd",
18
- "dev": "tsc --watch",
19
- "start": "node dist/index.js",
20
- "cli": "ts-node src/index.ts",
21
- "prepublishOnly": "pnpm run build",
22
- "release": "pnpm run build && npm publish --access public",
23
- "format": "prettier --write src"
24
- },
25
13
  "keywords": [
26
14
  "auto-cr",
27
15
  "code-review",
@@ -47,11 +35,11 @@
47
35
  "dependencies": {
48
36
  "@swc/core": "^1.15.8",
49
37
  "@swc/wasm": "^1.15.8",
50
- "auto-cr-rules": "^2.0.96",
51
38
  "commander": "^14.0.2",
52
39
  "consola": "^3.4.2",
53
40
  "jsonc-parser": "^3.3.1",
54
- "picomatch": "^4.0.3"
41
+ "picomatch": "^4.0.3",
42
+ "auto-cr-rules": "2.0.99"
55
43
  },
56
44
  "devDependencies": {
57
45
  "@eslint/js": "^9.39.2",
@@ -67,5 +55,16 @@
67
55
  "tslib": "^2.8.1",
68
56
  "typescript": "^5.9.2",
69
57
  "typescript-eslint": "^8.51.0"
58
+ },
59
+ "scripts": {
60
+ "build": "tsc --build tsconfig.json",
61
+ "build:force": "tsc --build tsconfig.json --force",
62
+ "postbuild": "node ../../scripts/readme-sync.mjs copy auto-cr-cmd",
63
+ "postbuild:force": "node ../../scripts/readme-sync.mjs copy auto-cr-cmd",
64
+ "dev": "tsc --watch",
65
+ "start": "node dist/index.js",
66
+ "cli": "ts-node src/index.ts",
67
+ "release": "pnpm run build && pnpm publish --access public --no-git-checks",
68
+ "format": "prettier --write src"
70
69
  }
71
- }
70
+ }