reporefit 0.4.1 → 0.4.2
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/README.md +1 -1
- package/dist/reporefit.mjs +353 -157
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -55,4 +55,4 @@ Setup for other clients: https://reporefit.com/en/mcp/
|
|
|
55
55
|
|
|
56
56
|
Every rule ID (for example `SEC-001`) is explained at https://reporefit.com/en/rules/
|
|
57
57
|
|
|
58
|
-
RepoRefit 0.4.
|
|
58
|
+
RepoRefit 0.4.2 · MIT License · Third-party notices in THIRD_PARTY_NOTICES.md
|
package/dist/reporefit.mjs
CHANGED
|
@@ -11,7 +11,7 @@ import { dirname as dirname2, join as join4, resolve as resolve3 } from "node:pa
|
|
|
11
11
|
|
|
12
12
|
// ../core/src/types.ts
|
|
13
13
|
var SCHEMA_VERSION = "0.3.0";
|
|
14
|
-
var ENGINE_VERSION = "0.4.
|
|
14
|
+
var ENGINE_VERSION = "0.4.2";
|
|
15
15
|
var RULESET_VERSION = "2026.12.8";
|
|
16
16
|
|
|
17
17
|
// ../core/src/input/limits.ts
|
|
@@ -7991,10 +7991,11 @@ var PROFILES = {
|
|
|
7991
7991
|
},
|
|
7992
7992
|
cursor: {
|
|
7993
7993
|
platform: "cursor",
|
|
7994
|
-
profileVersion: "cursor-agents-window-rules@2026-12-
|
|
7995
|
-
reviewedAt: "2026-12-
|
|
7996
|
-
//
|
|
7997
|
-
|
|
7994
|
+
profileVersion: "cursor-agents-window-rules@2026-12-02",
|
|
7995
|
+
reviewedAt: "2026-12-02",
|
|
7996
|
+
// Cursor's own rules page. On 2026-12-02 it answers 308 Permanent Redirect to
|
|
7997
|
+
// docs.grok.com/build/agents-window/rules ("Rules"), the page the rules below were read from.
|
|
7998
|
+
sourceUrls: ["https://cursor.com/docs/context/rules"],
|
|
7998
7999
|
// "@file" in a rule only points at the file; it does not insert its content.
|
|
7999
8000
|
maxImportDepth: null,
|
|
8000
8001
|
maxCombinedBytes: null,
|
|
@@ -9805,6 +9806,7 @@ function measurableContext(report, platform, folder2) {
|
|
|
9805
9806
|
}
|
|
9806
9807
|
|
|
9807
9808
|
// ../core/src/scan.ts
|
|
9809
|
+
var OTHER_DOCS_BUDGET = 8 * 1024 * 1024;
|
|
9808
9810
|
var ScanCancelledError = class extends Error {
|
|
9809
9811
|
constructor() {
|
|
9810
9812
|
super("cancelled");
|
|
@@ -9894,7 +9896,11 @@ async function scanOnce(adapter, ctx) {
|
|
|
9894
9896
|
instruction: contextPaths,
|
|
9895
9897
|
ignored: gitignoreMatcher(docs.find((d) => d.path === ".gitignore")?.text ?? null)
|
|
9896
9898
|
});
|
|
9897
|
-
ctx.onInstructionTexts
|
|
9899
|
+
if (ctx.onInstructionTexts) {
|
|
9900
|
+
let budget = OTHER_DOCS_BUDGET;
|
|
9901
|
+
const others = mdDocs.filter((d) => !contextPaths.has(d.path) && (budget -= d.text.length) >= 0);
|
|
9902
|
+
ctx.onInstructionTexts([...agentDocs.filter((d) => contextPaths.has(d.path)), ...others].map((d) => ({ path: d.path, text: d.text })));
|
|
9903
|
+
}
|
|
9898
9904
|
const md002 = checkDuplicates(mdDocs, eligibleMd, mdPartial, MD002_MIN_CHARS, contextPaths);
|
|
9899
9905
|
const deps = extractDependencies(docs);
|
|
9900
9906
|
const dup = checkDuplicateCode(docs);
|
|
@@ -11045,7 +11051,7 @@ var zhT = {
|
|
|
11045
11051
|
// ../core/src/i18n/messages-cli.ts
|
|
11046
11052
|
var enC = {
|
|
11047
11053
|
"cli.header": "RepoRefit \xB7 {tool} \xB7 {read} files read of {listed} listed \xB7 {seconds}s",
|
|
11048
|
-
"cli.summary": "{findings} findings (high {high}, medium {medium}, low {low}) \xB7 {passed}/{evaluated} checks passed",
|
|
11054
|
+
"cli.summary": "{findings} findings (high {high}, medium {medium}, low {low}, info {info}) \xB7 {passed}/{evaluated} checks passed",
|
|
11049
11055
|
"cli.partial": "Partial scan: {reasons}",
|
|
11050
11056
|
"cli.partialUnknown": "some files were not read.",
|
|
11051
11057
|
"cli.symlinks": "Skipped {count} symbolic links (never followed).",
|
|
@@ -11099,11 +11105,24 @@ var enC = {
|
|
|
11099
11105
|
"cli.keep.unknown.partial": "partial scan",
|
|
11100
11106
|
"cli.keep.unknown.unread": "unread files",
|
|
11101
11107
|
"cli.keep.mandatory": "mandatory",
|
|
11102
|
-
"cli.keep.more": "\u2026 {count} more"
|
|
11108
|
+
"cli.keep.more": "\u2026 {count} more",
|
|
11109
|
+
"cli.keep.scope": "Checks the rules in the instruction files each agent loads at /. Other documents are checked below; code blocks, HTML and images are not compared.",
|
|
11110
|
+
"cli.keep.notVerified": "Not compared in these files: {code} code blocks, {html} HTML blocks, {images} images.",
|
|
11111
|
+
"cli.docs.title": "Requirements in other documents (README, docs/ and other Markdown no agent loads):",
|
|
11112
|
+
"cli.docs.none": "None of the {documents} other documents was removed or changed.",
|
|
11113
|
+
"cli.docs.line": "{removed} removed and {changed} changed of {documents} documents: {units} requirement units (numbers, obligations, pass/fail criteria, conditions, security, environment), kept {kept}, probably the same {estimated}, review {review} (fixed tokens changed {fixed}), possible losses {missing} -> {verdict}",
|
|
11114
|
+
"cli.docs.verdict.clean": "no loss found in the compared text (this does not prove the meaning is kept)",
|
|
11115
|
+
"cli.docs.verdict.estimated": "no loss found; reworded units look the same (estimate), read them once",
|
|
11116
|
+
"cli.docs.verdict.review": "review these units in the revised copy",
|
|
11117
|
+
"cli.docs.notVerified": "Not verified: {code} code blocks, {html} HTML blocks, {images} images and {documents} documents over the size limit; meaning spread over several sentences is not checked.",
|
|
11118
|
+
"cli.docs.scopeNote": "Requirement-like units of removed or changed Markdown documents that no agent loads, matched against every Markdown file of the revised copy. Code blocks, images and meaning across sentences are not verified.",
|
|
11119
|
+
"cli.links.title": "Links the edit broke (they resolved in the original):",
|
|
11120
|
+
"cli.docs.removed": "{path} (removed): {units} units, kept {kept}, probably the same {estimated}, review {review}, possible losses {missing}",
|
|
11121
|
+
"cli.docs.changed": "{path} (changed): {units} units, kept {kept}, probably the same {estimated}, review {review}, possible losses {missing}"
|
|
11103
11122
|
};
|
|
11104
11123
|
var koC = {
|
|
11105
11124
|
"cli.header": "RepoRefit \xB7 {tool} \xB7 \uD30C\uC77C {listed}\uAC1C \uC911 {read}\uAC1C \uC77D\uC74C \xB7 {seconds}\uCD08",
|
|
11106
|
-
"cli.summary": "\uBC1C\uACAC {findings}\uAC74(\uB192\uC74C {high}, \uC911\uAC04 {medium}, \uB0AE\uC74C {low}) \xB7 \uAC80\uC0AC {evaluated}\uAC1C \uC911 {passed}\uAC1C \uD1B5\uACFC",
|
|
11125
|
+
"cli.summary": "\uBC1C\uACAC {findings}\uAC74(\uB192\uC74C {high}, \uC911\uAC04 {medium}, \uB0AE\uC74C {low}, \uC815\uBCF4 {info}) \xB7 \uAC80\uC0AC {evaluated}\uAC1C \uC911 {passed}\uAC1C \uD1B5\uACFC",
|
|
11107
11126
|
"cli.partial": "\uBD80\uBD84 \uAC80\uC0AC: {reasons}",
|
|
11108
11127
|
"cli.partialUnknown": "\uC77C\uBD80 \uD30C\uC77C\uC744 \uC77D\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4.",
|
|
11109
11128
|
"cli.symlinks": "\uC2EC\uBCFC\uB9AD \uB9C1\uD06C {count}\uAC1C\uB294 \uB530\uB77C\uAC00\uC9C0 \uC54A\uACE0 \uAC74\uB108\uB6F0\uC5C8\uC2B5\uB2C8\uB2E4.",
|
|
@@ -11157,11 +11176,24 @@ var koC = {
|
|
|
11157
11176
|
"cli.keep.unknown.partial": "\uBD80\uBD84 \uAC80\uC0AC",
|
|
11158
11177
|
"cli.keep.unknown.unread": "\uC77D\uC9C0 \uBABB\uD55C \uD30C\uC77C",
|
|
11159
11178
|
"cli.keep.mandatory": "\uD544\uC218",
|
|
11160
|
-
"cli.keep.more": "\u2026 {count}\uAC1C \uB354"
|
|
11179
|
+
"cli.keep.more": "\u2026 {count}\uAC1C \uB354",
|
|
11180
|
+
"cli.keep.scope": "\uC5D0\uC774\uC804\uD2B8\uB9C8\uB2E4 /\uC5D0\uC11C \uC77D\uB294 \uC9C0\uC2DC \uD30C\uC77C\uC758 \uADDC\uCE59\uC744 \uBD05\uB2C8\uB2E4. \uB2E4\uB978 \uBB38\uC11C\uB294 \uC544\uB798\uC5D0\uC11C \uB530\uB85C \uBCF4\uACE0, \uCF54\uB4DC \uBE14\uB85D\xB7HTML\xB7\uC774\uBBF8\uC9C0\uB294 \uBE44\uAD50\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.",
|
|
11181
|
+
"cli.keep.notVerified": "\uC774 \uD30C\uC77C\uC5D0\uC11C \uBE44\uAD50\uD558\uC9C0 \uC54A\uC740 \uAC83: \uCF54\uB4DC \uBE14\uB85D {code}\uAC1C, HTML \uBE14\uB85D {html}\uAC1C, \uC774\uBBF8\uC9C0 {images}\uAC1C.",
|
|
11182
|
+
"cli.docs.title": "\uB2E4\uB978 \uBB38\uC11C\uC758 \uC694\uAD6C\uC0AC\uD56D(README, docs/ \uB4F1 \uC5D0\uC774\uC804\uD2B8\uAC00 \uC77D\uC9C0 \uC54A\uB294 Markdown):",
|
|
11183
|
+
"cli.docs.none": "\uB2E4\uB978 \uBB38\uC11C {documents}\uAC1C \uC911 \uC9C0\uC6B0\uAC70\uB098 \uBC14\uAFBC \uBB38\uC11C\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.",
|
|
11184
|
+
"cli.docs.line": "\uBB38\uC11C {documents}\uAC1C \uC911 {removed}\uAC1C \uC0AD\uC81C, {changed}\uAC1C \uBCC0\uACBD: \uC694\uAD6C\uC0AC\uD56D \uB2E8\uC704 {units}\uAC1C(\uC218\uCE58, \uC758\uBB34, \uD569\uACA9\xB7\uC2E4\uD328 \uAE30\uC900, \uC870\uAC74, \uBCF4\uC548, \uD658\uACBD), \uBCF4\uC874 {kept}, \uAC19\uC544 \uBCF4\uC784 {estimated}, \uAC80\uD1A0 {review}(\uACE0\uC815 \uD1A0\uD070 \uBCC0\uACBD {fixed}), \uC0AC\uB77C\uC84C\uC744 \uC218 \uC788\uC74C {missing} -> {verdict}",
|
|
11185
|
+
"cli.docs.verdict.clean": "\uBE44\uAD50\uD55C \uBB38\uC7A5\uC5D0\uC11C \uC783\uC740 \uAC83 \uC5C6\uC74C(\uC758\uBBF8 \uBCF4\uC874\uC744 \uC99D\uBA85\uD558\uC9C0\uB294 \uC54A\uC74C)",
|
|
11186
|
+
"cli.docs.verdict.estimated": "\uC783\uC740 \uAC83 \uC5C6\uC74C. \uBC14\uAFD4 \uC4F4 \uB2E8\uC704\uB294 \uAC19\uC544 \uBCF4\uC774\uB2C8(\uCD94\uC815) \uD55C \uBC88 \uC77D\uC5B4 \uBCF4\uC138\uC694",
|
|
11187
|
+
"cli.docs.verdict.review": "\uC218\uC815\uBCF8\uC5D0\uC11C \uC774 \uB2E8\uC704\uB4E4\uC744 \uAC80\uD1A0\uD558\uC138\uC694",
|
|
11188
|
+
"cli.docs.notVerified": "\uAC80\uC99D\uD558\uC9C0 \uC54A\uC74C: \uCF54\uB4DC \uBE14\uB85D {code}\uAC1C, HTML \uBE14\uB85D {html}\uAC1C, \uC774\uBBF8\uC9C0 {images}\uAC1C, \uD06C\uAE30 \uD55C\uB3C4\uB97C \uB118\uC740 \uBB38\uC11C {documents}\uAC1C. \uC5EC\uB7EC \uBB38\uC7A5\uC5D0 \uAC78\uCE5C \uC758\uBBF8\uB294 \uD655\uC778\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.",
|
|
11189
|
+
"cli.docs.scopeNote": "\uC5D0\uC774\uC804\uD2B8\uAC00 \uC77D\uC9C0 \uC54A\uB294 Markdown \uBB38\uC11C \uC911 \uC9C0\uC6B0\uAC70\uB098 \uBC14\uAFBC \uBB38\uC11C\uC758 \uC694\uAD6C\uC0AC\uD56D \uB2E8\uC704\uB97C \uC218\uC815\uBCF8\uC758 \uBAA8\uB4E0 Markdown \uD30C\uC77C\uACFC \uB9DE\uCDB0 \uBD05\uB2C8\uB2E4. \uCF54\uB4DC \uBE14\uB85D, \uC774\uBBF8\uC9C0, \uC5EC\uB7EC \uBB38\uC7A5\uC5D0 \uAC78\uCE5C \uC758\uBBF8\uB294 \uAC80\uC99D\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.",
|
|
11190
|
+
"cli.links.title": "\uC218\uC815\uC73C\uB85C \uAE68\uC9C4 \uB9C1\uD06C(\uC6D0\uBCF8\uC5D0\uC11C\uB294 \uC5F4\uB838\uB358 \uB9C1\uD06C):",
|
|
11191
|
+
"cli.docs.removed": "{path}(\uC0AD\uC81C): \uB2E8\uC704 {units}\uAC1C, \uBCF4\uC874 {kept}, \uAC19\uC544 \uBCF4\uC784 {estimated}, \uAC80\uD1A0 {review}, \uC0AC\uB77C\uC84C\uC744 \uC218 \uC788\uC74C {missing}",
|
|
11192
|
+
"cli.docs.changed": "{path}(\uBCC0\uACBD): \uB2E8\uC704 {units}\uAC1C, \uBCF4\uC874 {kept}, \uAC19\uC544 \uBCF4\uC784 {estimated}, \uAC80\uD1A0 {review}, \uC0AC\uB77C\uC84C\uC744 \uC218 \uC788\uC74C {missing}"
|
|
11161
11193
|
};
|
|
11162
11194
|
var jaC = {
|
|
11163
11195
|
"cli.header": "RepoRefit \xB7 {tool} \xB7 {listed} \u4EF6\u4E2D {read} \u4EF6\u306E\u30D5\u30A1\u30A4\u30EB\u3092\u8AAD\u307F\u8FBC\u307F \xB7 {seconds} \u79D2",
|
|
11164
|
-
"cli.summary": "\u691C\u51FA {findings} \u4EF6(\u9AD8 {high}\u3001\u4E2D {medium}\u3001\u4F4E {low}) \xB7 \u691C\u67FB {evaluated} \u4EF6\u4E2D {passed} \u4EF6\u5408\u683C",
|
|
11196
|
+
"cli.summary": "\u691C\u51FA {findings} \u4EF6(\u9AD8 {high}\u3001\u4E2D {medium}\u3001\u4F4E {low}\u3001\u60C5\u5831 {info}) \xB7 \u691C\u67FB {evaluated} \u4EF6\u4E2D {passed} \u4EF6\u5408\u683C",
|
|
11165
11197
|
"cli.partial": "\u90E8\u5206\u7684\u306A\u691C\u67FB: {reasons}",
|
|
11166
11198
|
"cli.partialUnknown": "\u4E00\u90E8\u306E\u30D5\u30A1\u30A4\u30EB\u3092\u8AAD\u3081\u307E\u305B\u3093\u3067\u3057\u305F\u3002",
|
|
11167
11199
|
"cli.symlinks": "\u30B7\u30F3\u30DC\u30EA\u30C3\u30AF\u30EA\u30F3\u30AF {count} \u4EF6\u306F\u305F\u3069\u3089\u305A\u306B\u30B9\u30AD\u30C3\u30D7\u3057\u307E\u3057\u305F\u3002",
|
|
@@ -11215,11 +11247,24 @@ var jaC = {
|
|
|
11215
11247
|
"cli.keep.unknown.partial": "\u90E8\u5206\u7684\u306A\u691C\u67FB",
|
|
11216
11248
|
"cli.keep.unknown.unread": "\u8AAD\u3081\u306A\u3044\u30D5\u30A1\u30A4\u30EB",
|
|
11217
11249
|
"cli.keep.mandatory": "\u5FC5\u9808",
|
|
11218
|
-
"cli.keep.more": "\u2026 \u307B\u304B {count} \u4EF6"
|
|
11250
|
+
"cli.keep.more": "\u2026 \u307B\u304B {count} \u4EF6",
|
|
11251
|
+
"cli.keep.scope": "\u30A8\u30FC\u30B8\u30A7\u30F3\u30C8\u3054\u3068\u306B / \u3067\u8AAD\u3080\u6307\u793A\u30D5\u30A1\u30A4\u30EB\u306E\u30EB\u30FC\u30EB\u3092\u78BA\u8A8D\u3057\u307E\u3059\u3002\u307B\u304B\u306E\u6587\u66F8\u306F\u4E0B\u3067\u78BA\u8A8D\u3057\u3001\u30B3\u30FC\u30C9\u30D6\u30ED\u30C3\u30AF\u30FBHTML\u30FB\u753B\u50CF\u306F\u6BD4\u8F03\u3057\u307E\u305B\u3093\u3002",
|
|
11252
|
+
"cli.keep.notVerified": "\u3053\u308C\u3089\u306E\u30D5\u30A1\u30A4\u30EB\u3067\u6BD4\u8F03\u3057\u3066\u3044\u306A\u3044\u3082\u306E: \u30B3\u30FC\u30C9\u30D6\u30ED\u30C3\u30AF {code} \u4EF6\u3001HTML \u30D6\u30ED\u30C3\u30AF {html} \u4EF6\u3001\u753B\u50CF {images} \u4EF6\u3002",
|
|
11253
|
+
"cli.docs.title": "\u307B\u304B\u306E\u6587\u66F8\u306E\u8981\u4EF6(README\u3001docs/ \u306A\u3069\u30A8\u30FC\u30B8\u30A7\u30F3\u30C8\u304C\u8AAD\u307E\u306A\u3044 Markdown):",
|
|
11254
|
+
"cli.docs.none": "\u307B\u304B\u306E\u6587\u66F8 {documents} \u4EF6\u306E\u3046\u3061\u3001\u524A\u9664\u30FB\u5909\u66F4\u3055\u308C\u305F\u6587\u66F8\u306F\u3042\u308A\u307E\u305B\u3093\u3002",
|
|
11255
|
+
"cli.docs.line": "\u6587\u66F8 {documents} \u4EF6\u4E2D {removed} \u4EF6\u524A\u9664\u3001{changed} \u4EF6\u5909\u66F4: \u8981\u4EF6\u306E\u5358\u4F4D {units} \u4EF6(\u6570\u5024\u3001\u7FA9\u52D9\u3001\u5408\u5426\u57FA\u6E96\u3001\u6761\u4EF6\u3001\u30BB\u30AD\u30E5\u30EA\u30C6\u30A3\u3001\u74B0\u5883)\u3001\u4FDD\u6301 {kept}\u3001\u540C\u3058\u306B\u898B\u3048\u308B {estimated}\u3001\u78BA\u8A8D {review}(\u56FA\u5B9A\u30C8\u30FC\u30AF\u30F3\u5909\u66F4 {fixed})\u3001\u5931\u308F\u308C\u305F\u53EF\u80FD\u6027 {missing} -> {verdict}",
|
|
11256
|
+
"cli.docs.verdict.clean": "\u6BD4\u8F03\u3057\u305F\u6587\u3067\u306F\u5931\u308F\u308C\u305F\u3082\u306E\u306F\u3042\u308A\u307E\u305B\u3093(\u610F\u5473\u306E\u4FDD\u6301\u3092\u8A3C\u660E\u3059\u308B\u3082\u306E\u3067\u306F\u3042\u308A\u307E\u305B\u3093)",
|
|
11257
|
+
"cli.docs.verdict.estimated": "\u5931\u308F\u308C\u305F\u3082\u306E\u306F\u3042\u308A\u307E\u305B\u3093\u3002\u8A00\u3044\u63DB\u3048\u305F\u5358\u4F4D\u306F\u540C\u3058\u306B\u898B\u3048\u307E\u3059(\u63A8\u5B9A)\u3002\u4E00\u5EA6\u8AAD\u3093\u3067\u304F\u3060\u3055\u3044",
|
|
11258
|
+
"cli.docs.verdict.review": "\u4FEE\u6B63\u7248\u3067\u3053\u308C\u3089\u306E\u5358\u4F4D\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044",
|
|
11259
|
+
"cli.docs.notVerified": "\u672A\u691C\u8A3C: \u30B3\u30FC\u30C9\u30D6\u30ED\u30C3\u30AF {code} \u4EF6\u3001HTML \u30D6\u30ED\u30C3\u30AF {html} \u4EF6\u3001\u753B\u50CF {images} \u4EF6\u3001\u30B5\u30A4\u30BA\u4E0A\u9650\u3092\u8D85\u3048\u305F\u6587\u66F8 {documents} \u4EF6\u3002\u8907\u6570\u306E\u6587\u306B\u307E\u305F\u304C\u308B\u610F\u5473\u306F\u78BA\u8A8D\u3057\u307E\u305B\u3093\u3002",
|
|
11260
|
+
"cli.docs.scopeNote": "\u30A8\u30FC\u30B8\u30A7\u30F3\u30C8\u304C\u8AAD\u307E\u306A\u3044 Markdown \u6587\u66F8\u306E\u3046\u3061\u3001\u524A\u9664\u30FB\u5909\u66F4\u3055\u308C\u305F\u6587\u66F8\u306E\u8981\u4EF6\u306E\u5358\u4F4D\u3092\u3001\u4FEE\u6B63\u7248\u306E\u3059\u3079\u3066\u306E Markdown \u30D5\u30A1\u30A4\u30EB\u3068\u7167\u5408\u3057\u307E\u3059\u3002\u30B3\u30FC\u30C9\u30D6\u30ED\u30C3\u30AF\u3001\u753B\u50CF\u3001\u8907\u6570\u306E\u6587\u306B\u307E\u305F\u304C\u308B\u610F\u5473\u306F\u691C\u8A3C\u3057\u307E\u305B\u3093\u3002",
|
|
11261
|
+
"cli.links.title": "\u4FEE\u6B63\u3067\u58CA\u308C\u305F\u30EA\u30F3\u30AF(\u5143\u306E\u7248\u3067\u306F\u958B\u3051\u305F\u3082\u306E):",
|
|
11262
|
+
"cli.docs.removed": "{path}(\u524A\u9664): \u5358\u4F4D {units} \u4EF6\u3001\u4FDD\u6301 {kept}\u3001\u540C\u3058\u306B\u898B\u3048\u308B {estimated}\u3001\u78BA\u8A8D {review}\u3001\u5931\u308F\u308C\u305F\u53EF\u80FD\u6027 {missing}",
|
|
11263
|
+
"cli.docs.changed": "{path}(\u5909\u66F4): \u5358\u4F4D {units} \u4EF6\u3001\u4FDD\u6301 {kept}\u3001\u540C\u3058\u306B\u898B\u3048\u308B {estimated}\u3001\u78BA\u8A8D {review}\u3001\u5931\u308F\u308C\u305F\u53EF\u80FD\u6027 {missing}"
|
|
11219
11264
|
};
|
|
11220
11265
|
var zhC = {
|
|
11221
11266
|
"cli.header": "RepoRefit \xB7 {tool} \xB7 \u5DF2\u8BFB\u53D6 {listed} \u4E2A\u6587\u4EF6\u4E2D\u7684 {read} \u4E2A \xB7 {seconds} \u79D2",
|
|
11222
|
-
"cli.summary": "\u53D1\u73B0 {findings} \u9879\uFF08\u9AD8 {high}\u3001\u4E2D {medium}\u3001\u4F4E {low}\uFF09\xB7 {evaluated} \u9879\u68C0\u67E5\u4E2D {passed} \u9879\u901A\u8FC7",
|
|
11267
|
+
"cli.summary": "\u53D1\u73B0 {findings} \u9879\uFF08\u9AD8 {high}\u3001\u4E2D {medium}\u3001\u4F4E {low}\u3001\u4FE1\u606F {info}\uFF09\xB7 {evaluated} \u9879\u68C0\u67E5\u4E2D {passed} \u9879\u901A\u8FC7",
|
|
11223
11268
|
"cli.partial": "\u90E8\u5206\u68C0\u67E5\uFF1A{reasons}",
|
|
11224
11269
|
"cli.partialUnknown": "\u6709\u4E9B\u6587\u4EF6\u672A\u80FD\u8BFB\u53D6\u3002",
|
|
11225
11270
|
"cli.symlinks": "\u5DF2\u8DF3\u8FC7 {count} \u4E2A\u7B26\u53F7\u94FE\u63A5\uFF08\u4ECE\u4E0D\u8DDF\u968F\uFF09\u3002",
|
|
@@ -11273,7 +11318,20 @@ var zhC = {
|
|
|
11273
11318
|
"cli.keep.unknown.partial": "\u90E8\u5206\u68C0\u67E5",
|
|
11274
11319
|
"cli.keep.unknown.unread": "\u672A\u8BFB\u53D6\u7684\u6587\u4EF6",
|
|
11275
11320
|
"cli.keep.mandatory": "\u5FC5\u987B",
|
|
11276
|
-
"cli.keep.more": "\u2026 \u8FD8\u6709 {count} \u9879"
|
|
11321
|
+
"cli.keep.more": "\u2026 \u8FD8\u6709 {count} \u9879",
|
|
11322
|
+
"cli.keep.scope": "\u68C0\u67E5\u6BCF\u4E2A\u4EE3\u7406\u5728 / \u8BFB\u53D6\u7684\u6307\u4EE4\u6587\u4EF6\u4E2D\u7684\u89C4\u5219\u3002\u5176\u4ED6\u6587\u6863\u5728\u4E0B\u9762\u5355\u72EC\u68C0\u67E5\uFF1B\u4E0D\u6BD4\u8F83\u4EE3\u7801\u5757\u3001HTML \u548C\u56FE\u7247\u3002",
|
|
11323
|
+
"cli.keep.notVerified": "\u8FD9\u4E9B\u6587\u4EF6\u4E2D\u672A\u6BD4\u8F83\u7684\u5185\u5BB9\uFF1A\u4EE3\u7801\u5757 {code} \u4E2A\u3001HTML \u5757 {html} \u4E2A\u3001\u56FE\u7247 {images} \u4E2A\u3002",
|
|
11324
|
+
"cli.docs.title": "\u5176\u4ED6\u6587\u6863\u4E2D\u7684\u8981\u6C42\uFF08README\u3001docs/ \u7B49\u4EE3\u7406\u4E0D\u8BFB\u53D6\u7684 Markdown\uFF09\uFF1A",
|
|
11325
|
+
"cli.docs.none": "{documents} \u4E2A\u5176\u4ED6\u6587\u6863\u4E2D\u6CA1\u6709\u88AB\u5220\u9664\u6216\u4FEE\u6539\u7684\u6587\u6863\u3002",
|
|
11326
|
+
"cli.docs.line": "{documents} \u4E2A\u6587\u6863\u4E2D\u5220\u9664 {removed} \u4E2A\u3001\u4FEE\u6539 {changed} \u4E2A\uFF1A\u8981\u6C42\u5355\u5143 {units} \u4E2A\uFF08\u6570\u503C\u3001\u4E49\u52A1\u3001\u901A\u8FC7/\u5931\u8D25\u6807\u51C6\u3001\u6761\u4EF6\u3001\u5B89\u5168\u3001\u73AF\u5883\uFF09\uFF0C\u4FDD\u7559 {kept}\uFF0C\u770B\u4F3C\u76F8\u540C {estimated}\uFF0C\u590D\u6838 {review}\uFF08\u56FA\u5B9A\u8BCD\u53D8\u5316 {fixed}\uFF09\uFF0C\u53EF\u80FD\u4E22\u5931 {missing} -> {verdict}",
|
|
11327
|
+
"cli.docs.verdict.clean": "\u6BD4\u8F83\u7684\u6587\u5B57\u4E2D\u6CA1\u6709\u53D1\u73B0\u4E22\u5931\uFF08\u8FD9\u4E0D\u80FD\u8BC1\u660E\u542B\u4E49\u88AB\u4FDD\u7559\uFF09",
|
|
11328
|
+
"cli.docs.verdict.estimated": "\u6CA1\u6709\u53D1\u73B0\u4E22\u5931\uFF1B\u6539\u5199\u7684\u5355\u5143\u770B\u4F3C\u76F8\u540C\uFF08\u4F30\u8BA1\uFF09\uFF0C\u8BF7\u8BFB\u4E00\u904D",
|
|
11329
|
+
"cli.docs.verdict.review": "\u8BF7\u5728\u4FEE\u6539\u7248\u4E2D\u590D\u6838\u8FD9\u4E9B\u5355\u5143",
|
|
11330
|
+
"cli.docs.notVerified": "\u672A\u9A8C\u8BC1\uFF1A\u4EE3\u7801\u5757 {code} \u4E2A\u3001HTML \u5757 {html} \u4E2A\u3001\u56FE\u7247 {images} \u4E2A\u3001\u8D85\u8FC7\u5927\u5C0F\u4E0A\u9650\u7684\u6587\u6863 {documents} \u4E2A\uFF1B\u4E0D\u68C0\u67E5\u8DE8\u591A\u4E2A\u53E5\u5B50\u7684\u542B\u4E49\u3002",
|
|
11331
|
+
"cli.docs.scopeNote": "\u628A\u4EE3\u7406\u4E0D\u8BFB\u53D6\u7684 Markdown \u6587\u6863\u4E2D\u88AB\u5220\u9664\u6216\u4FEE\u6539\u7684\u6587\u6863\u7684\u8981\u6C42\u5355\u5143\uFF0C\u4E0E\u4FEE\u6539\u7248\u7684\u6240\u6709 Markdown \u6587\u4EF6\u8FDB\u884C\u6BD4\u5BF9\u3002\u4E0D\u9A8C\u8BC1\u4EE3\u7801\u5757\u3001\u56FE\u7247\u548C\u8DE8\u53E5\u5B50\u7684\u542B\u4E49\u3002",
|
|
11332
|
+
"cli.links.title": "\u8FD9\u6B21\u4FEE\u6539\u5F04\u574F\u7684\u94FE\u63A5\uFF08\u5728\u539F\u7248\u4E2D\u53EF\u4EE5\u6253\u5F00\uFF09\uFF1A",
|
|
11333
|
+
"cli.docs.removed": "{path}\uFF08\u5220\u9664\uFF09\uFF1A\u5355\u5143 {units} \u4E2A\uFF0C\u4FDD\u7559 {kept}\uFF0C\u770B\u4F3C\u76F8\u540C {estimated}\uFF0C\u590D\u6838 {review}\uFF0C\u53EF\u80FD\u4E22\u5931 {missing}",
|
|
11334
|
+
"cli.docs.changed": "{path}\uFF08\u4FEE\u6539\uFF09\uFF1A\u5355\u5143 {units} \u4E2A\uFF0C\u4FDD\u7559 {kept}\uFF0C\u770B\u4F3C\u76F8\u540C {estimated}\uFF0C\u590D\u6838 {review}\uFF0C\u53EF\u80FD\u4E22\u5931 {missing}"
|
|
11277
11335
|
};
|
|
11278
11336
|
|
|
11279
11337
|
// ../core/src/i18n/messages.ts
|
|
@@ -11657,6 +11715,41 @@ function toLocale(code2) {
|
|
|
11657
11715
|
return null;
|
|
11658
11716
|
}
|
|
11659
11717
|
|
|
11718
|
+
// ../core/src/results.ts
|
|
11719
|
+
function changePercent(before, after) {
|
|
11720
|
+
if (!Number.isFinite(before) || !Number.isFinite(after) || before === 0) return null;
|
|
11721
|
+
return Math.round((after - before) / before * 100);
|
|
11722
|
+
}
|
|
11723
|
+
function allToolsSummary(report, tools) {
|
|
11724
|
+
const verdict = report.rules.filter((r) => r.ruleId !== "INV-001" && r.status !== "skipped" && r.status !== "error");
|
|
11725
|
+
const rulesPassed = verdict.filter((r) => r.status === "pass").length;
|
|
11726
|
+
return {
|
|
11727
|
+
rulesEvaluated: verdict.length,
|
|
11728
|
+
rulesPassed,
|
|
11729
|
+
passPercent: verdict.length ? Math.round(rulesPassed / verdict.length * 100) : null,
|
|
11730
|
+
tools: tools.map((t2) => {
|
|
11731
|
+
const rs = report.rules.filter((r) => t2.rules.includes(r.ruleId));
|
|
11732
|
+
const findings = rs.reduce((n, r) => n + r.findings.length, 0);
|
|
11733
|
+
const high = rs.reduce((n, r) => n + r.findings.filter((f) => f.severity === "high").length, 0);
|
|
11734
|
+
const ran = rs.filter((r) => r.status !== "skipped" && r.status !== "error");
|
|
11735
|
+
const status = ran.length === 0 ? report.coverage?.partial ? "unread" : "not-checked" : findings ? "issues" : ran.some((r) => r.status === "partial") ? "partial" : "clean";
|
|
11736
|
+
return { tool: t2.id, status, findings, high };
|
|
11737
|
+
})
|
|
11738
|
+
};
|
|
11739
|
+
}
|
|
11740
|
+
function severityCounts(findings) {
|
|
11741
|
+
const c = { total: findings.length, high: 0, medium: 0, low: 0, info: 0, unknown: 0 };
|
|
11742
|
+
for (const f of findings) {
|
|
11743
|
+
if (f.severity === "high" || f.severity === "medium" || f.severity === "low" || f.severity === "info") c[f.severity]++;
|
|
11744
|
+
else c.unknown++;
|
|
11745
|
+
}
|
|
11746
|
+
return c;
|
|
11747
|
+
}
|
|
11748
|
+
function severityParts(c) {
|
|
11749
|
+
const parts = [["high", c.high], ["medium", c.medium], ["low", c.low], ["info", c.info]];
|
|
11750
|
+
return c.unknown ? [...parts, ["unknown", c.unknown]] : parts;
|
|
11751
|
+
}
|
|
11752
|
+
|
|
11660
11753
|
// ../core/src/report/rule-docs.ts
|
|
11661
11754
|
var PUBLIC_SITE = "https://reporefit.com";
|
|
11662
11755
|
function ruleDocUrl(locale, ruleId) {
|
|
@@ -11779,6 +11872,7 @@ function renderMarkdownReport(report, locale) {
|
|
|
11779
11872
|
out.push(`| ${t(locale, "report.partial")} | ${yn(c.partial)} |`, "");
|
|
11780
11873
|
const findings = report.rules.flatMap((r) => r.findings);
|
|
11781
11874
|
out.push(`## ${t(locale, "report.findings")} (${findings.length})`, "");
|
|
11875
|
+
if (findings.length) out.push(severityParts(severityCounts(findings)).map(([s, n]) => `${t(locale, `severity.${s}`)} ${n}`).join(" \xB7 "), "");
|
|
11782
11876
|
if (findings.length === 0) out.push(t(locale, "report.noFindings"), "");
|
|
11783
11877
|
findings.forEach((f, i) => out.push(findingBlock(locale, f, i + 1)));
|
|
11784
11878
|
const unverified = report.rules.flatMap((r) => r.unverified);
|
|
@@ -11822,19 +11916,6 @@ function renderJsonReport(report) {
|
|
|
11822
11916
|
// ../core/src/report/fix-plan.ts
|
|
11823
11917
|
var ORDER = { high: 0, medium: 1, low: 2, info: 3, unknown: 4 };
|
|
11824
11918
|
var CONFIDENCE = { high: 0, medium: 1, low: 2 };
|
|
11825
|
-
function fenced2(text3) {
|
|
11826
|
-
const runs = text3.match(/`{3,}/g) ?? [];
|
|
11827
|
-
const longest = runs.reduce((m, r) => Math.max(m, r.length), 2);
|
|
11828
|
-
const fence = "`".repeat(longest + 1);
|
|
11829
|
-
return `${fence}text
|
|
11830
|
-
${text3}
|
|
11831
|
-
${fence}`;
|
|
11832
|
-
}
|
|
11833
|
-
function msg2(locale, key, params) {
|
|
11834
|
-
const safe = {};
|
|
11835
|
-
for (const [k, v] of Object.entries(params)) safe[k] = typeof v === "string" ? code(v) : v;
|
|
11836
|
-
return t(locale, key, safe).replace(/"(`[^`]*`+)"/g, "$1");
|
|
11837
|
-
}
|
|
11838
11919
|
var where = (locale, f) => f.line ? code(`${f.path}:${f.line}`) : f.path === "." ? t(locale, "report.project") : code(f.path);
|
|
11839
11920
|
function fixPlanTasks(report) {
|
|
11840
11921
|
return report.rules.flatMap((r) => r.findings).slice().sort(
|
|
@@ -11854,13 +11935,13 @@ function renderFixPlan(report, locale) {
|
|
|
11854
11935
|
if (tasks.length === 0) out.push(t(locale, "fixplan.none"), "");
|
|
11855
11936
|
tasks.forEach((f, i) => {
|
|
11856
11937
|
out.push(`### ${i + 1}. ${f.ruleId} \xB7 ${t(locale, `severity.${f.severity}`)} \xB7 ${t(locale, `rule.${f.ruleId}`)}`, "");
|
|
11857
|
-
out.push(`- ${t(locale, "fixplan.problem")}: ${
|
|
11938
|
+
out.push(`- ${t(locale, "fixplan.problem")}: ${msg(locale, f.messageKey, f.params)}`);
|
|
11858
11939
|
out.push(`- ${t(locale, "fixplan.target")}: ${where(locale, f.location)}${f.related?.length ? ` (${t(locale, "report.related")}: ${f.related.map((r) => where(locale, r)).join(", ")})` : ""}`);
|
|
11859
|
-
out.push(`- ${t(locale, "fixplan.change")}: ${
|
|
11940
|
+
out.push(`- ${t(locale, "fixplan.change")}: ${msg(locale, f.recommendation.messageKey, f.recommendation.params)}`);
|
|
11860
11941
|
out.push(`- ${t(locale, "fixplan.keep")}`);
|
|
11861
|
-
out.push(`- ${t(locale, "fixplan.verify")}: ${
|
|
11942
|
+
out.push(`- ${t(locale, "fixplan.verify")}: ${msg(locale, f.verification.messageKey, f.verification.params)}`);
|
|
11862
11943
|
out.push(`- ${t(locale, "report.ruleDoc")}: ${ruleDocUrl(locale, f.ruleId)}`);
|
|
11863
|
-
if (f.evidence) out.push("", `${t(locale, "report.evidence")}:`, "",
|
|
11944
|
+
if (f.evidence) out.push("", `${t(locale, "report.evidence")}:`, "", fenced(f.evidence));
|
|
11864
11945
|
out.push("");
|
|
11865
11946
|
});
|
|
11866
11947
|
const unverified = report.rules.flatMap((r) => r.unverified);
|
|
@@ -12018,6 +12099,44 @@ function extractRuleUnits(doc) {
|
|
|
12018
12099
|
visit(tree);
|
|
12019
12100
|
return units;
|
|
12020
12101
|
}
|
|
12102
|
+
function matchUnit(u, pool, originals) {
|
|
12103
|
+
const exact = pool.find((a) => a.exact === u.exact);
|
|
12104
|
+
if (exact) return { grade: "exact", at: exact, reason: null };
|
|
12105
|
+
const norm = pool.find((a) => a.normalized === u.normalized);
|
|
12106
|
+
if (norm) return { grade: "normalized", at: norm, reason: null };
|
|
12107
|
+
const inside = pool.find((a) => a.normalized.includes(u.normalized));
|
|
12108
|
+
const substantial = u.normalized.length >= 8 || (u.normalized.match(/[\p{Script=Hangul}\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}]/gu) ?? []).length >= 4;
|
|
12109
|
+
if (inside && substantial) return { grade: "structural", at: inside, reason: null };
|
|
12110
|
+
const sentences = u.normalized.split(/(?<=[.!?。!?])\s*/).map((x) => normalizeRule(x)).filter((x) => x.length >= 4);
|
|
12111
|
+
if (sentences.length > 1) {
|
|
12112
|
+
const homes = sentences.map((x) => pool.find((a) => a.normalized.includes(x)));
|
|
12113
|
+
if (homes.every(Boolean)) return { grade: "structural", at: homes[0], reason: null };
|
|
12114
|
+
}
|
|
12115
|
+
let best = null;
|
|
12116
|
+
let score = 0;
|
|
12117
|
+
for (const a of pool) {
|
|
12118
|
+
if (originals.has(a.normalized) && a.normalized !== u.normalized && !sameFixed(u.fixed, a.fixed)) continue;
|
|
12119
|
+
const o = ruleSimilarity(u.normalized, a.normalized);
|
|
12120
|
+
if (o > score) [best, score] = [a, o];
|
|
12121
|
+
}
|
|
12122
|
+
if (best && score >= REVIEW_MIN) {
|
|
12123
|
+
const same = sameFixed(u.fixed, best.fixed);
|
|
12124
|
+
if (same && score >= ESTIMATE_MIN) return { grade: "estimated", at: best, reason: "reworded" };
|
|
12125
|
+
return { grade: "review", at: best, reason: same ? "reworded" : "fixedChanged" };
|
|
12126
|
+
}
|
|
12127
|
+
return { grade: "missing", at: null, reason: null };
|
|
12128
|
+
}
|
|
12129
|
+
function countNotVerified(texts) {
|
|
12130
|
+
const out = { codeBlocks: 0, html: 0, images: 0, documents: 0 };
|
|
12131
|
+
const visit = (n) => {
|
|
12132
|
+
if (n.type === "code") out.codeBlocks++;
|
|
12133
|
+
else if (n.type === "html") out.html++;
|
|
12134
|
+
else if (n.type === "image" || n.type === "imageReference") out.images++;
|
|
12135
|
+
for (const c of n.children ?? []) visit(c);
|
|
12136
|
+
};
|
|
12137
|
+
for (const t2 of texts) visit(parseTree(t2.text));
|
|
12138
|
+
return out;
|
|
12139
|
+
}
|
|
12021
12140
|
var severity = (i) => (i.grade === "estimated" ? -10 : 0) + (i.mandatory ? 2 : 0) + (i.tags.length > 0 ? 1 : 0);
|
|
12022
12141
|
function comparePreservation(platform, workdir, before, after) {
|
|
12023
12142
|
const scopeOf2 = (docs) => activeContext(platform, workdir, docs);
|
|
@@ -12041,43 +12160,16 @@ function comparePreservation(platform, workdir, before, after) {
|
|
|
12041
12160
|
let fixedChanged = 0;
|
|
12042
12161
|
let missing = 0;
|
|
12043
12162
|
let scopeReduced = 0;
|
|
12044
|
-
const match = (u, pool) => {
|
|
12045
|
-
const exact = pool.find((a) => a.exact === u.exact);
|
|
12046
|
-
if (exact) return { grade: "exact", at: exact, reason: null };
|
|
12047
|
-
const norm = pool.find((a) => a.normalized === u.normalized);
|
|
12048
|
-
if (norm) return { grade: "normalized", at: norm, reason: null };
|
|
12049
|
-
const inside = pool.find((a) => a.normalized.includes(u.normalized));
|
|
12050
|
-
const substantial = u.normalized.length >= 8 || (u.normalized.match(/[\p{Script=Hangul}\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}]/gu) ?? []).length >= 4;
|
|
12051
|
-
if (inside && substantial) return { grade: "structural", at: inside, reason: null };
|
|
12052
|
-
const sentences = u.normalized.split(/(?<=[.!?。!?])\s*/).map((s) => normalizeRule(s)).filter((s) => s.length >= 4);
|
|
12053
|
-
if (sentences.length > 1) {
|
|
12054
|
-
const homes = sentences.map((s) => pool.find((a) => a.normalized.includes(s)));
|
|
12055
|
-
if (homes.every(Boolean)) return { grade: "structural", at: homes[0], reason: null };
|
|
12056
|
-
}
|
|
12057
|
-
let best = null;
|
|
12058
|
-
let score = 0;
|
|
12059
|
-
for (const a of pool) {
|
|
12060
|
-
if (beforeNorms.has(a.normalized) && a.normalized !== u.normalized && !sameFixed(u.fixed, a.fixed)) continue;
|
|
12061
|
-
const o = ruleSimilarity(u.normalized, a.normalized);
|
|
12062
|
-
if (o > score) [best, score] = [a, o];
|
|
12063
|
-
}
|
|
12064
|
-
if (best && score >= REVIEW_MIN) {
|
|
12065
|
-
const same = sameFixed(u.fixed, best.fixed);
|
|
12066
|
-
if (same && score >= ESTIMATE_MIN) return { grade: "estimated", at: best, reason: "reworded" };
|
|
12067
|
-
return { grade: "review", at: best, reason: same ? "reworded" : "fixedChanged" };
|
|
12068
|
-
}
|
|
12069
|
-
return { grade: "missing", at: null, reason: null };
|
|
12070
|
-
};
|
|
12071
12163
|
const claimed = /* @__PURE__ */ new Set();
|
|
12072
12164
|
for (const u of beforeUnits) {
|
|
12073
|
-
const inScope =
|
|
12165
|
+
const inScope = matchUnit(u, afterIn, beforeNorms);
|
|
12074
12166
|
if (inScope.at) claimed.add(inScope.at);
|
|
12075
12167
|
const keptGrade = inScope.grade === "exact" || inScope.grade === "normalized" || inScope.grade === "structural";
|
|
12076
12168
|
if (keptGrade) {
|
|
12077
12169
|
kept++;
|
|
12078
12170
|
continue;
|
|
12079
12171
|
}
|
|
12080
|
-
const anywhere =
|
|
12172
|
+
const anywhere = matchUnit(u, afterAll, beforeNorms);
|
|
12081
12173
|
const base2 = { before: loc2(u), mandatory: u.mandatory, tags: u.tags };
|
|
12082
12174
|
if (anywhere.grade === "exact" || anywhere.grade === "normalized" || anywhere.grade === "structural") {
|
|
12083
12175
|
scopeReduced++;
|
|
@@ -12120,31 +12212,56 @@ function comparePreservation(platform, workdir, before, after) {
|
|
|
12120
12212
|
added,
|
|
12121
12213
|
verdict,
|
|
12122
12214
|
unknownReasons,
|
|
12123
|
-
items
|
|
12215
|
+
items,
|
|
12216
|
+
notVerified: countNotVerified(before.texts.filter((t2) => beforeScope.has(t2.path)))
|
|
12124
12217
|
};
|
|
12125
12218
|
}
|
|
12126
|
-
|
|
12127
|
-
|
|
12128
|
-
function
|
|
12129
|
-
|
|
12130
|
-
|
|
12131
|
-
|
|
12132
|
-
|
|
12133
|
-
const
|
|
12134
|
-
const
|
|
12135
|
-
|
|
12136
|
-
|
|
12137
|
-
|
|
12138
|
-
|
|
12139
|
-
|
|
12140
|
-
|
|
12141
|
-
|
|
12142
|
-
|
|
12143
|
-
|
|
12144
|
-
|
|
12145
|
-
|
|
12146
|
-
|
|
12147
|
-
|
|
12219
|
+
var REQUIREMENT_RE = /\d|\b(must|never|always|should|shall|required?|requires|mandatory|only|do not|don't|pass(?:es|ed)?|fail(?:s|ed|ure)?|criteri(?:a|on)|accept\w*|threshold|target|limit|at least|at most|if|when|unless|except\w*|prerequisite\w*|environment|windows|linux|macos|ubuntu|version|secur\w*|secret\w*|password\w*|credential\w*|privacy|permission\w*)\b|반드시|필수|금지|절대|해야|하지 ?마|않|통과|실패|합격|불합격|기준|목표|이상|이하|초과|미만|경우|예외|전제|사전 ?조건|환경|버전|보안|개인정보|비밀|권한|必ず|禁止|しない|ないこと|合格|不合格|基準|目標|以上|以下|未満|場合|例外|前提|環境|バージョン|セキュリティ|権限|必须|不得|不要|通过|失败|标准|目标|如果|除非|前提|环境|版本|安全|隐私|权限/i;
|
|
12220
|
+
var NOT_PROJECT_DOCS2 = /(^|\/)(fixtures?|__fixtures__|testdata|test-data|examples?|samples?|vendor|third[_-]party|node_modules)\//i;
|
|
12221
|
+
function compareDocuments(before, after) {
|
|
12222
|
+
const isMd = (path) => /\.(md|mdx|markdown)$/i.test(path);
|
|
12223
|
+
const docsBefore = before.texts.filter((t2) => isMd(t2.path) && !before.instruction.has(t2.path) && !NOT_PROJECT_DOCS2.test(t2.path));
|
|
12224
|
+
const afterByPath = new Map(after.texts.map((t2) => [t2.path, t2.text]));
|
|
12225
|
+
const touched = docsBefore.filter((t2) => afterByPath.get(t2.path) !== t2.text);
|
|
12226
|
+
const removed = touched.filter((t2) => !afterByPath.has(t2.path)).length;
|
|
12227
|
+
const units = touched.flatMap((t2) => extractRuleUnits(t2)).filter((u) => REQUIREMENT_RE.test(u.exact));
|
|
12228
|
+
const originals = new Set(units.map((u) => u.normalized));
|
|
12229
|
+
const pool = after.texts.filter((t2) => isMd(t2.path) || /\.mdc$/i.test(t2.path)).flatMap((t2) => extractRuleUnits(t2));
|
|
12230
|
+
const loc2 = (u) => ({ path: u.path, line: u.line, preview: u.preview });
|
|
12231
|
+
const items = [];
|
|
12232
|
+
const n = { kept: 0, estimated: 0, review: 0, fixedChanged: 0, missing: 0 };
|
|
12233
|
+
const gone = new Set(touched.filter((t2) => !afterByPath.has(t2.path)).map((t2) => t2.path));
|
|
12234
|
+
const perDocument = new Map(touched.map((t2) => [t2.path, { path: t2.path, status: gone.has(t2.path) ? "removed" : "changed", units: 0, kept: 0, estimated: 0, review: 0, missing: 0 }]));
|
|
12235
|
+
for (const u of units) {
|
|
12236
|
+
const m = matchUnit(u, pool, originals);
|
|
12237
|
+
const doc = perDocument.get(u.path);
|
|
12238
|
+
doc.units++;
|
|
12239
|
+
if (m.grade === "exact" || m.grade === "normalized" || m.grade === "structural") {
|
|
12240
|
+
n.kept++;
|
|
12241
|
+
doc.kept++;
|
|
12242
|
+
continue;
|
|
12243
|
+
}
|
|
12244
|
+
if (m.grade === "estimated") {
|
|
12245
|
+
n.estimated++;
|
|
12246
|
+
doc.estimated++;
|
|
12247
|
+
} else if (m.grade === "review") {
|
|
12248
|
+
n.review++;
|
|
12249
|
+
doc.review++;
|
|
12250
|
+
if (m.reason === "fixedChanged") n.fixedChanged++;
|
|
12251
|
+
} else {
|
|
12252
|
+
n.missing++;
|
|
12253
|
+
doc.missing++;
|
|
12254
|
+
}
|
|
12255
|
+
items.push({ grade: m.grade, reason: m.reason, before: loc2(u), after: m.at ? loc2(m.at) : null, mandatory: u.mandatory, tags: u.tags });
|
|
12256
|
+
}
|
|
12257
|
+
const weight = (i) => (gone.has(i.before.path) ? 8 : 0) + (i.grade === "missing" ? 4 : i.reason === "fixedChanged" ? 2 : 0) + severity(i);
|
|
12258
|
+
items.sort((a, b) => weight(b) - weight(a) || (a.before.path < b.before.path ? -1 : a.before.path > b.before.path ? 1 : a.before.line - b.before.line));
|
|
12259
|
+
const docs = [...perDocument.values()].filter((d) => d.units > 0 || d.status === "removed");
|
|
12260
|
+
docs.sort((a, b) => a.status === b.status ? a.path < b.path ? -1 : 1 : a.status === "removed" ? -1 : 1);
|
|
12261
|
+
const provided = before.texts.filter((t2) => isMd(t2.path)).length;
|
|
12262
|
+
const notVerified = { ...countNotVerified(touched), documents: Math.max(0, before.markdownRead - provided) };
|
|
12263
|
+
const verdict = touched.length === 0 ? "none" : n.missing + n.review > 0 ? "review" : n.estimated > 0 ? "estimated" : "clean";
|
|
12264
|
+
return { documents: docsBefore.length, removed, changed: touched.length - removed, units: units.length, ...n, verdict, perDocument: docs, items, notVerified };
|
|
12148
12265
|
}
|
|
12149
12266
|
|
|
12150
12267
|
// ../core/src/compare.ts
|
|
@@ -12166,9 +12283,22 @@ function compareRuns(a, b, folder2 = "") {
|
|
|
12166
12283
|
rules: ids.map((ruleId) => ({ ruleId, before: count(a.report, ruleId), after: count(b.report, ruleId) })),
|
|
12167
12284
|
findings: { before: total(a.report), after: total(b.report) },
|
|
12168
12285
|
tokens,
|
|
12169
|
-
preservation
|
|
12286
|
+
preservation,
|
|
12287
|
+
documents: documentsOf(a, b),
|
|
12288
|
+
brokenLinks: brokenLinks(a.report, b.report)
|
|
12170
12289
|
};
|
|
12171
12290
|
}
|
|
12291
|
+
function documentsOf(a, b) {
|
|
12292
|
+
const instruction = new Set((a.report.metrics.tokens?.docs ?? []).map((d) => d.path));
|
|
12293
|
+
const markdownRead = a.report.rules.find((r) => r.ruleId === "MD-001")?.inspected ?? 0;
|
|
12294
|
+
return compareDocuments({ texts: a.texts, instruction, markdownRead }, { texts: b.texts });
|
|
12295
|
+
}
|
|
12296
|
+
function brokenLinks(a, b) {
|
|
12297
|
+
const md003 = (r) => r.rules.find((x) => x.ruleId === "MD-003")?.findings ?? [];
|
|
12298
|
+
const key = (path, target) => `${path}\0${String(target ?? "")}`;
|
|
12299
|
+
const before = new Set(md003(a).map((f) => key(f.location.path, f.params.target)));
|
|
12300
|
+
return md003(b).filter((f) => !before.has(key(f.location.path, f.params.target))).map((f) => ({ path: f.location.path, line: f.location.line, target: String(f.params.target ?? "") }));
|
|
12301
|
+
}
|
|
12172
12302
|
|
|
12173
12303
|
// ../core/src/tools.ts
|
|
12174
12304
|
var TOOLS = [
|
|
@@ -12345,7 +12475,7 @@ function shouldFail(r, failOn) {
|
|
|
12345
12475
|
}
|
|
12346
12476
|
|
|
12347
12477
|
// src/version.ts
|
|
12348
|
-
var VERSION = "0.4.
|
|
12478
|
+
var VERSION = "0.4.2";
|
|
12349
12479
|
|
|
12350
12480
|
// src/mcp.ts
|
|
12351
12481
|
import { createInterface } from "node:readline";
|
|
@@ -12354,6 +12484,7 @@ import { resolve as resolve2 } from "node:path";
|
|
|
12354
12484
|
|
|
12355
12485
|
// src/compare.ts
|
|
12356
12486
|
import * as nodePath from "node:path";
|
|
12487
|
+
var COMPARE_SCHEMA_VERSION = "1.0.0";
|
|
12357
12488
|
function tokenChangeText(c, locale) {
|
|
12358
12489
|
if (c.before === null || c.after === null || c.delta === null) return null;
|
|
12359
12490
|
const delta = c.delta > 0 ? `+${c.delta}` : String(c.delta);
|
|
@@ -12368,8 +12499,14 @@ function renderCompare(c, tool2, locale) {
|
|
|
12368
12499
|
lines.push(L("compare.tokens"));
|
|
12369
12500
|
if (c.tokens.length === 0) lines.push(` ${L("compare.noAgents")}`);
|
|
12370
12501
|
for (const x of c.tokens) lines.push(` ${tokenChangeText(x, locale) ?? L("compare.notComparable", { agent: t(locale, `platform.${x.platform}`) })}`);
|
|
12371
|
-
lines.push(` ${L("compare.limits")}`, "", L("keep.title"));
|
|
12502
|
+
lines.push(` ${L("compare.limits")}`, "", L("keep.title"), ` ${L("keep.scope")}`);
|
|
12372
12503
|
if (c.preservation.length === 0) lines.push(` ${L("keep.none")}`);
|
|
12504
|
+
const item = (i) => {
|
|
12505
|
+
const where3 = i.after ? ` -> ${i.after.path}:${i.after.line}` : "";
|
|
12506
|
+
const reason = i.reason ? ` (${L(`keep.reason.${i.reason}`)})` : "";
|
|
12507
|
+
return ` ${i.before.path}:${i.before.line}${where3} ${L(`keep.grade.${i.grade}`)}${reason}${i.mandatory ? ` [${L("keep.mandatory")}]` : ""} ${i.before.preview}`;
|
|
12508
|
+
};
|
|
12509
|
+
const unchecked = (n) => n.codeBlocks + n.html + n.images + n.documents > 0;
|
|
12373
12510
|
for (const r of c.preservation) {
|
|
12374
12511
|
const verdict = r.verdict === "unknown" ? L("keep.verdict.unknown", { reasons: r.unknownReasons.map((x) => L(`keep.unknown.${x}`)).join(", ") }) : L(`keep.verdict.${r.verdict}`);
|
|
12375
12512
|
lines.push(
|
|
@@ -12388,15 +12525,98 @@ function renderCompare(c, tool2, locale) {
|
|
|
12388
12525
|
verdict
|
|
12389
12526
|
})}`
|
|
12390
12527
|
);
|
|
12391
|
-
for (const i of r.items.slice(0, 10))
|
|
12392
|
-
const where3 = i.after ? ` -> ${i.after.path}:${i.after.line}` : "";
|
|
12393
|
-
const reason = i.reason ? ` (${L(`keep.reason.${i.reason}`)})` : "";
|
|
12394
|
-
lines.push(` ${i.before.path}:${i.before.line}${where3} ${L(`keep.grade.${i.grade}`)}${reason}${i.mandatory ? ` [${L("keep.mandatory")}]` : ""} ${i.before.preview}`);
|
|
12395
|
-
}
|
|
12528
|
+
for (const i of r.items.slice(0, 10)) lines.push(item(i));
|
|
12396
12529
|
if (r.items.length > 10) lines.push(` ${L("keep.more", { count: r.items.length - 10 })}`);
|
|
12530
|
+
if (unchecked(r.notVerified)) lines.push(` ${L("keep.notVerified", { code: r.notVerified.codeBlocks, html: r.notVerified.html, images: r.notVerified.images })}`);
|
|
12531
|
+
}
|
|
12532
|
+
const d = c.documents;
|
|
12533
|
+
lines.push("", L("docs.title"));
|
|
12534
|
+
if (d.verdict === "none") lines.push(` ${L("docs.none", { documents: d.documents })}`);
|
|
12535
|
+
else {
|
|
12536
|
+
lines.push(
|
|
12537
|
+
` ${L("docs.line", { removed: d.removed, changed: d.changed, documents: d.documents, units: d.units, kept: d.kept, estimated: d.estimated, review: d.review, fixed: d.fixedChanged, missing: d.missing, verdict: L(`docs.verdict.${d.verdict}`) })}`
|
|
12538
|
+
);
|
|
12539
|
+
for (const x of d.perDocument.slice(0, 20)) lines.push(` ${L(`docs.${x.status}`, { path: x.path, units: x.units, kept: x.kept, estimated: x.estimated, review: x.review, missing: x.missing })}`);
|
|
12540
|
+
for (const i of d.items.slice(0, 10)) lines.push(item(i));
|
|
12541
|
+
if (d.items.length > 10) lines.push(` ${L("keep.more", { count: d.items.length - 10 })}`);
|
|
12542
|
+
}
|
|
12543
|
+
if (unchecked(d.notVerified) || d.verdict !== "none") {
|
|
12544
|
+
lines.push(` ${L("docs.notVerified", { code: d.notVerified.codeBlocks, html: d.notVerified.html, images: d.notVerified.images, documents: d.notVerified.documents })}`);
|
|
12545
|
+
}
|
|
12546
|
+
if (c.brokenLinks.length) {
|
|
12547
|
+
lines.push("", L("links.title"));
|
|
12548
|
+
for (const l of c.brokenLinks.slice(0, 20)) lines.push(` ${l.path}:${l.line} -> ${l.target}`);
|
|
12549
|
+
if (c.brokenLinks.length > 20) lines.push(` ${L("keep.more", { count: c.brokenLinks.length - 20 })}`);
|
|
12397
12550
|
}
|
|
12398
12551
|
return lines.join("\n") + "\n";
|
|
12399
12552
|
}
|
|
12553
|
+
function compareJson(c, tool2, locale) {
|
|
12554
|
+
const agent = (p) => t(locale, `platform.${p}`);
|
|
12555
|
+
const item = (i) => ({
|
|
12556
|
+
before: `${i.before.path}:${i.before.line}`,
|
|
12557
|
+
after: i.after ? `${i.after.path}:${i.after.line}` : null,
|
|
12558
|
+
grade: i.grade,
|
|
12559
|
+
reason: i.reason,
|
|
12560
|
+
mandatory: i.mandatory,
|
|
12561
|
+
text: i.before.preview
|
|
12562
|
+
});
|
|
12563
|
+
const nv = (n) => ({ code_blocks: n.codeBlocks, html: n.html, images: n.images, documents: n.documents });
|
|
12564
|
+
const d = c.documents;
|
|
12565
|
+
return {
|
|
12566
|
+
kind: "reporefit-compare",
|
|
12567
|
+
schema_version: COMPARE_SCHEMA_VERSION,
|
|
12568
|
+
engine: ENGINE_VERSION,
|
|
12569
|
+
ruleset: RULESET_VERSION,
|
|
12570
|
+
tool: tool2,
|
|
12571
|
+
findings: c.findings,
|
|
12572
|
+
rules: c.rules.filter((r) => r.before || r.after).map((r) => ({ rule: r.ruleId, before: r.before, after: r.after })),
|
|
12573
|
+
// percent: signed change rounded to an integer (negative = fewer tokens), null when the original had 0 tokens.
|
|
12574
|
+
tokens: c.tokens.map((x) => ({
|
|
12575
|
+
agent: x.platform,
|
|
12576
|
+
name: agent(x.platform),
|
|
12577
|
+
before: x.before,
|
|
12578
|
+
after: x.after,
|
|
12579
|
+
change: x.delta,
|
|
12580
|
+
percent: x.percent,
|
|
12581
|
+
summary: tokenChangeText(x, locale) ?? t(locale, "cli.compare.notComparable", { agent: agent(x.platform) })
|
|
12582
|
+
})),
|
|
12583
|
+
token_note: t(locale, "cli.compare.limits"),
|
|
12584
|
+
preservation: c.preservation.map((r) => ({
|
|
12585
|
+
agent: r.platform,
|
|
12586
|
+
name: agent(r.platform),
|
|
12587
|
+
rules: r.units,
|
|
12588
|
+
mandatory: r.mandatory,
|
|
12589
|
+
kept: r.kept,
|
|
12590
|
+
probably_same: r.estimated,
|
|
12591
|
+
review: r.review,
|
|
12592
|
+
fixed_tokens_changed: r.fixedChanged,
|
|
12593
|
+
possible_losses: r.missing,
|
|
12594
|
+
out_of_scope: r.scopeReduced,
|
|
12595
|
+
duplicates_removed: r.removedDuplicates,
|
|
12596
|
+
new: r.added,
|
|
12597
|
+
verdict: r.verdict,
|
|
12598
|
+
items: r.items.slice(0, 20).map(item),
|
|
12599
|
+
not_verified: nv(r.notVerified)
|
|
12600
|
+
})),
|
|
12601
|
+
documents: {
|
|
12602
|
+
documents: d.documents,
|
|
12603
|
+
removed: d.removed,
|
|
12604
|
+
changed: d.changed,
|
|
12605
|
+
units: d.units,
|
|
12606
|
+
kept: d.kept,
|
|
12607
|
+
probably_same: d.estimated,
|
|
12608
|
+
review: d.review,
|
|
12609
|
+
fixed_tokens_changed: d.fixedChanged,
|
|
12610
|
+
possible_losses: d.missing,
|
|
12611
|
+
verdict: d.verdict,
|
|
12612
|
+
per_document: d.perDocument.map((x) => ({ path: x.path, status: x.status, units: x.units, kept: x.kept, probably_same: x.estimated, review: x.review, possible_losses: x.missing })),
|
|
12613
|
+
items: d.items.slice(0, 50).map(item),
|
|
12614
|
+
not_verified: nv(d.notVerified),
|
|
12615
|
+
note: t(locale, "cli.docs.scopeNote")
|
|
12616
|
+
},
|
|
12617
|
+
broken_links: c.brokenLinks
|
|
12618
|
+
};
|
|
12619
|
+
}
|
|
12400
12620
|
function badgeLink(folder2, file, path = nodePath) {
|
|
12401
12621
|
const rel = path.relative(path.resolve(folder2), path.resolve(file));
|
|
12402
12622
|
if (!rel || rel === ".." || rel.startsWith(`..${path.sep}`) || path.isAbsolute(rel)) return null;
|
|
@@ -12597,7 +12817,8 @@ function summarize(r, locale, max) {
|
|
|
12597
12817
|
status: r.findings.length ? "findings" : c.partial ? "partial-clean" : "clean",
|
|
12598
12818
|
checks: { evaluated: r.evaluated, passed: r.passed },
|
|
12599
12819
|
findings_total: r.findings.length,
|
|
12600
|
-
|
|
12820
|
+
// Every finding is in exactly one severity: the parts add up to findings_total (info included).
|
|
12821
|
+
by_severity: { high: r.bySeverity.high, medium: r.bySeverity.medium, low: r.bySeverity.low, info: r.bySeverity.info },
|
|
12601
12822
|
coverage: { files_listed: c.discovered, files_read: c.inspected, partial: c.partial, reasons: c.reasons.map((x) => t(locale, `coverage.${x.code}`, x.params)) },
|
|
12602
12823
|
findings: r.findings.slice(0, max).map((f) => ({
|
|
12603
12824
|
rule: f.ruleId,
|
|
@@ -12639,62 +12860,17 @@ async function callTool(name, args) {
|
|
|
12639
12860
|
const a = await runFolder(folder(args.before), opts);
|
|
12640
12861
|
const b = await runFolder(folder(args.after), opts);
|
|
12641
12862
|
const c = compareRuns({ report: a.report, texts: a.instructionTexts }, { report: b.report, texts: b.instructionTexts });
|
|
12642
|
-
|
|
12643
|
-
return JSON.stringify(
|
|
12644
|
-
{
|
|
12645
|
-
engine: ENGINE_VERSION,
|
|
12646
|
-
ruleset: RULESET_VERSION,
|
|
12647
|
-
tool: a.tool,
|
|
12648
|
-
findings: c.findings,
|
|
12649
|
-
rules: c.rules.filter((r) => r.before || r.after).map((r) => ({ rule: r.ruleId, before: r.before, after: r.after })),
|
|
12650
|
-
// percent: signed change rounded to an integer (negative = fewer tokens), null when the original had 0 tokens.
|
|
12651
|
-
tokens: c.tokens.map((x) => ({
|
|
12652
|
-
agent: x.platform,
|
|
12653
|
-
name: agent(x.platform),
|
|
12654
|
-
before: x.before,
|
|
12655
|
-
after: x.after,
|
|
12656
|
-
change: x.delta,
|
|
12657
|
-
percent: x.percent,
|
|
12658
|
-
summary: tokenChangeText(x, locale) ?? t(locale, "cli.compare.notComparable", { agent: agent(x.platform) })
|
|
12659
|
-
})),
|
|
12660
|
-
token_note: t(locale, "cli.compare.limits"),
|
|
12661
|
-
preservation: c.preservation.map((r) => ({
|
|
12662
|
-
agent: r.platform,
|
|
12663
|
-
name: agent(r.platform),
|
|
12664
|
-
rules: r.units,
|
|
12665
|
-
mandatory: r.mandatory,
|
|
12666
|
-
kept: r.kept,
|
|
12667
|
-
probably_same: r.estimated,
|
|
12668
|
-
review: r.review,
|
|
12669
|
-
fixed_tokens_changed: r.fixedChanged,
|
|
12670
|
-
possible_losses: r.missing,
|
|
12671
|
-
out_of_scope: r.scopeReduced,
|
|
12672
|
-
duplicates_removed: r.removedDuplicates,
|
|
12673
|
-
new: r.added,
|
|
12674
|
-
verdict: r.verdict,
|
|
12675
|
-
items: r.items.slice(0, 20).map((i) => ({
|
|
12676
|
-
before: `${i.before.path}:${i.before.line}`,
|
|
12677
|
-
after: i.after ? `${i.after.path}:${i.after.line}` : null,
|
|
12678
|
-
grade: i.grade,
|
|
12679
|
-
reason: i.reason,
|
|
12680
|
-
mandatory: i.mandatory,
|
|
12681
|
-
text: i.before.preview
|
|
12682
|
-
}))
|
|
12683
|
-
}))
|
|
12684
|
-
},
|
|
12685
|
-
null,
|
|
12686
|
-
2
|
|
12687
|
-
);
|
|
12863
|
+
return JSON.stringify(compareJson(c, a.tool, locale), null, 2);
|
|
12688
12864
|
}
|
|
12689
12865
|
throw new ToolError(`Unknown tool: ${name}`);
|
|
12690
12866
|
}
|
|
12691
|
-
async function handle(
|
|
12692
|
-
const reply = (result) => ({ jsonrpc: "2.0", id:
|
|
12693
|
-
const fail = (code2, message) => ({ jsonrpc: "2.0", id:
|
|
12694
|
-
if (
|
|
12695
|
-
switch (
|
|
12867
|
+
async function handle(msg2) {
|
|
12868
|
+
const reply = (result) => ({ jsonrpc: "2.0", id: msg2.id, result });
|
|
12869
|
+
const fail = (code2, message) => ({ jsonrpc: "2.0", id: msg2.id ?? null, error: { code: code2, message } });
|
|
12870
|
+
if (msg2.id === void 0) return null;
|
|
12871
|
+
switch (msg2.method) {
|
|
12696
12872
|
case "initialize": {
|
|
12697
|
-
const asked = String(
|
|
12873
|
+
const asked = String(msg2.params?.protocolVersion ?? "");
|
|
12698
12874
|
return reply({
|
|
12699
12875
|
protocolVersion: PROTOCOLS.includes(asked) ? asked : PROTOCOLS[0],
|
|
12700
12876
|
capabilities: { tools: { listChanged: false } },
|
|
@@ -12707,8 +12883,8 @@ async function handle(msg3) {
|
|
|
12707
12883
|
case "tools/list":
|
|
12708
12884
|
return reply({ tools: toolsList });
|
|
12709
12885
|
case "tools/call": {
|
|
12710
|
-
const name = String(
|
|
12711
|
-
const args =
|
|
12886
|
+
const name = String(msg2.params?.name ?? "");
|
|
12887
|
+
const args = msg2.params?.arguments ?? {};
|
|
12712
12888
|
try {
|
|
12713
12889
|
return reply({ content: [{ type: "text", text: await callTool(name, args) }], isError: false });
|
|
12714
12890
|
} catch (e) {
|
|
@@ -12717,21 +12893,21 @@ async function handle(msg3) {
|
|
|
12717
12893
|
}
|
|
12718
12894
|
}
|
|
12719
12895
|
default:
|
|
12720
|
-
return fail(-32601, `Method not found: ${
|
|
12896
|
+
return fail(-32601, `Method not found: ${msg2.method}`);
|
|
12721
12897
|
}
|
|
12722
12898
|
}
|
|
12723
12899
|
function serveStdio() {
|
|
12724
12900
|
const rl = createInterface({ input: process.stdin });
|
|
12725
12901
|
rl.on("line", async (line) => {
|
|
12726
12902
|
if (!line.trim()) return;
|
|
12727
|
-
let
|
|
12903
|
+
let msg2;
|
|
12728
12904
|
try {
|
|
12729
|
-
|
|
12905
|
+
msg2 = JSON.parse(line);
|
|
12730
12906
|
} catch {
|
|
12731
12907
|
process.stdout.write(JSON.stringify({ jsonrpc: "2.0", id: null, error: { code: -32700, message: "Parse error" } }) + "\n");
|
|
12732
12908
|
return;
|
|
12733
12909
|
}
|
|
12734
|
-
const out = await handle(
|
|
12910
|
+
const out = await handle(msg2);
|
|
12735
12911
|
if (out) process.stdout.write(JSON.stringify(out) + "\n");
|
|
12736
12912
|
});
|
|
12737
12913
|
process.stderr.write(`RepoRefit MCP server ${VERSION} ready (stdio, read-only, no network)
|
|
@@ -12739,6 +12915,17 @@ function serveStdio() {
|
|
|
12739
12915
|
}
|
|
12740
12916
|
|
|
12741
12917
|
// src/cli.ts
|
|
12918
|
+
var SCAN_OPTIONS = ["tool", "lang", "fail-on", "ignore", "max-files", "max-read-mb", "no-gitignore", "quiet"];
|
|
12919
|
+
var OPTIONS = {
|
|
12920
|
+
scan: [...SCAN_OPTIONS, "format", "out"],
|
|
12921
|
+
fix: [...SCAN_OPTIONS, "out"],
|
|
12922
|
+
report: [...SCAN_OPTIONS, "out"],
|
|
12923
|
+
badge: [...SCAN_OPTIONS, "out"],
|
|
12924
|
+
compare: [...SCAN_OPTIONS, "format", "out"],
|
|
12925
|
+
rules: ["tool", "lang"],
|
|
12926
|
+
mcp: []
|
|
12927
|
+
};
|
|
12928
|
+
var FORMATS = { scan: ["text", "json", "md", "fix"], compare: ["text", "json"] };
|
|
12742
12929
|
var DOCS = "https://reporefit.com/en/cli/";
|
|
12743
12930
|
var RULES_URL = (locale, id) => `https://reporefit.com/${locale === "zh-Hans" ? "zh-cn" : locale}/rules/#${id.toLowerCase()}`;
|
|
12744
12931
|
var HELP = `RepoRefit ${VERSION} (engine ${ENGINE_VERSION}, rules ${RULESET_VERSION})
|
|
@@ -12752,15 +12939,15 @@ Commands:
|
|
|
12752
12939
|
fix [folder] write an AI fix plan (Markdown) for Claude Code, Codex and others
|
|
12753
12940
|
report [folder] write reporefit-report.md and reporefit-report.json
|
|
12754
12941
|
badge [folder] write a README badge SVG (counts only)
|
|
12755
|
-
compare <before> <after> compare two copies
|
|
12942
|
+
compare <before> <after> compare two copies: findings, tokens per agent, rule and document preservation
|
|
12756
12943
|
rules list rule IDs with their documentation links
|
|
12757
12944
|
mcp run as an MCP server over stdio (for Claude Code, Cursor and other agents)
|
|
12758
12945
|
help | version
|
|
12759
12946
|
|
|
12760
12947
|
Options:
|
|
12761
12948
|
--tool <id> all (default), ${TOOLS.map((x) => x.id).join(", ")}
|
|
12762
|
-
--format <f> scan
|
|
12763
|
-
--out <path> output file (fix, badge,
|
|
12949
|
+
--format <f> scan: text (default), json, md, fix; compare: text (default), json
|
|
12950
|
+
--out <path> output file (scan, fix, badge, compare) or folder (report); missing folders are created
|
|
12764
12951
|
--lang <l> en (default), ko, ja, zh-Hans
|
|
12765
12952
|
--fail-on <s> exit 1 when a finding is at least: high, medium, low, none (default)
|
|
12766
12953
|
--ignore <glob> extra ignore pattern, gitignore syntax (repeatable)
|
|
@@ -12786,7 +12973,7 @@ function parse2(argv) {
|
|
|
12786
12973
|
else if (a.startsWith("--")) {
|
|
12787
12974
|
const eq = a.indexOf("=");
|
|
12788
12975
|
const k = eq > 0 ? a.slice(2, eq) : a.slice(2);
|
|
12789
|
-
if (!VALUED.has(k)) return `Unknown option: ${a}`;
|
|
12976
|
+
if (!VALUED.has(k)) return `Unknown option: ${a}${k === "json" ? " (use --format json)" : ""}`;
|
|
12790
12977
|
const v = eq > 0 ? a.slice(eq + 1) : argv[++i];
|
|
12791
12978
|
if (v === void 0) return `Missing value for --${k}`;
|
|
12792
12979
|
if (k === "ignore") ignore.push(v);
|
|
@@ -12809,7 +12996,7 @@ function renderText(r, locale) {
|
|
|
12809
12996
|
}
|
|
12810
12997
|
if (!r.findings.length) lines.push(t(locale, "report.noFindings"));
|
|
12811
12998
|
const b = r.bySeverity;
|
|
12812
|
-
lines.push("", t(locale, "cli.summary", { findings: r.findings.length, high: b.high, medium: b.medium, low: b.low, passed: r.passed, evaluated: r.evaluated }));
|
|
12999
|
+
lines.push("", t(locale, "cli.summary", { findings: r.findings.length, high: b.high, medium: b.medium, low: b.low, info: b.info, passed: r.passed, evaluated: r.evaluated }));
|
|
12813
13000
|
if (c.partial) lines.push(t(locale, "cli.partial", { reasons: c.reasons.map((x) => t(locale, `coverage.${x.code}`, x.params)).join(" ") || t(locale, "cli.partialUnknown") }));
|
|
12814
13001
|
if (r.listing.skippedSymlinks) lines.push(t(locale, "cli.symlinks", { count: r.listing.skippedSymlinks }));
|
|
12815
13002
|
if (r.findings.length) lines.push(t(locale, "cli.ruleDetails", { url: RULES_URL(locale, r.findings[0].ruleId).replace(/#.*$/, "") }));
|
|
@@ -12884,6 +13071,11 @@ Run "reporefit help" for usage.
|
|
|
12884
13071
|
if (command === "version") return io.out(`${VERSION} (engine ${ENGINE_VERSION}, rules ${RULESET_VERSION})
|
|
12885
13072
|
`), 0;
|
|
12886
13073
|
const locale = toLocale(opts.lang ?? "en") ?? "en";
|
|
13074
|
+
const given = [...Object.keys(opts), ...p.flags, ...p.ignore.length ? ["ignore"] : []].filter((k) => k !== "help" && k !== "version");
|
|
13075
|
+
const unused = OPTIONS[command] ? given.find((k) => !OPTIONS[command].includes(k)) : void 0;
|
|
13076
|
+
if (unused) return io.err(`Option --${unused} is not used by ${command}.
|
|
13077
|
+
Run "reporefit help" for usage.
|
|
13078
|
+
`), 2;
|
|
12887
13079
|
if (command === "mcp") {
|
|
12888
13080
|
serveStdio();
|
|
12889
13081
|
return new Promise(() => {
|
|
@@ -12896,7 +13088,8 @@ Run "reporefit help" for usage.
|
|
|
12896
13088
|
return 0;
|
|
12897
13089
|
}
|
|
12898
13090
|
const format = opts.format ?? "text";
|
|
12899
|
-
|
|
13091
|
+
const formats = FORMATS[command] ?? ["text"];
|
|
13092
|
+
if (!formats.includes(format)) return io.err(`Unknown --format for ${command}: ${format} (use ${formats.join(", ")})
|
|
12900
13093
|
`), 2;
|
|
12901
13094
|
const failOn = opts["fail-on"] ?? "none";
|
|
12902
13095
|
if (!["high", "medium", "low", "none"].includes(failOn)) return io.err(`Unknown --fail-on: ${failOn}
|
|
@@ -12931,7 +13124,10 @@ Run "reporefit help" for usage.
|
|
|
12931
13124
|
const b = await scan(args[1]);
|
|
12932
13125
|
if (typeof b === "number") return b;
|
|
12933
13126
|
const c = compareRuns({ report: a.report, texts: a.instructionTexts }, { report: b.report, texts: b.instructionTexts });
|
|
12934
|
-
|
|
13127
|
+
const text3 = format === "json" ? JSON.stringify(compareJson(c, a.tool, locale), null, 2) + "\n" : renderCompare(c, a.tool, locale);
|
|
13128
|
+
if (opts.out) {
|
|
13129
|
+
if (!writeOutput(io, locale, opts.out, text3)) return 2;
|
|
13130
|
+
} else io.out(text3);
|
|
12935
13131
|
return shouldFail(b, failOn) ? 1 : 0;
|
|
12936
13132
|
}
|
|
12937
13133
|
const r = await scan(args[0] ?? ".");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "reporefit",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"description": "Check AI coding projects (instructions, tokens, secrets, MCP, dependencies, structure, deploy setup) on your own machine. Nothing is uploaded.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"url": "https://github.com/reporefit/action/issues"
|
|
26
26
|
},
|
|
27
27
|
"reporefit": {
|
|
28
|
-
"engine": "0.4.
|
|
28
|
+
"engine": "0.4.2",
|
|
29
29
|
"rules": "2026.12.8",
|
|
30
30
|
"schema": "0.3.0"
|
|
31
31
|
},
|