@rely-ai/caliber 1.30.4 → 1.30.6
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 -3
- package/dist/bin.js +47 -46
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<a href="https://www.npmjs.com/package/@rely-ai/caliber"><img src="https://img.shields.io/npm/v/@rely-ai/caliber" alt="npm version"></a>
|
|
7
7
|
<a href="./LICENSE"><img src="https://img.shields.io/npm/l/@rely-ai/caliber" alt="license"></a>
|
|
8
8
|
<a href="https://nodejs.org"><img src="https://img.shields.io/node/v/@rely-ai/caliber" alt="node"></a>
|
|
9
|
-
<img src="https://img.shields.io/badge/caliber-
|
|
9
|
+
<img src="https://img.shields.io/badge/caliber-94%2F100-brightgreen" alt="Caliber Score">
|
|
10
10
|
<img src="https://img.shields.io/badge/Claude_Code-supported-blue" alt="Claude Code">
|
|
11
11
|
<img src="https://img.shields.io/badge/Cursor-supported-blue" alt="Cursor">
|
|
12
12
|
<img src="https://img.shields.io/badge/Codex-supported-blue" alt="Codex">
|
|
@@ -356,5 +356,3 @@ Uses [conventional commits](https://www.conventionalcommits.org/) — `feat:` fo
|
|
|
356
356
|
## License
|
|
357
357
|
|
|
358
358
|
MIT
|
|
359
|
-
|
|
360
|
-
This Project is awesome !
|
package/dist/bin.js
CHANGED
|
@@ -803,6 +803,47 @@ function readExistingConfigs(dir) {
|
|
|
803
803
|
import fs3 from "fs";
|
|
804
804
|
import path4 from "path";
|
|
805
805
|
import { execSync as execSync3 } from "child_process";
|
|
806
|
+
|
|
807
|
+
// src/lib/sanitize.ts
|
|
808
|
+
var KNOWN_PREFIX_PATTERNS = [
|
|
809
|
+
// Anthropic (before generic sk- pattern)
|
|
810
|
+
[/sk-ant-[A-Za-z0-9_-]{20,}/g, "[REDACTED]"],
|
|
811
|
+
// AWS access key IDs
|
|
812
|
+
[/AKIA[0-9A-Z]{16}/g, "[REDACTED]"],
|
|
813
|
+
// AWS secret keys in assignments
|
|
814
|
+
[/(?:aws)?_?secret_?(?:access)?_?key\s*[:=]\s*['"]?[A-Za-z0-9/+=]{40}['"]?/gi, "[REDACTED]"],
|
|
815
|
+
// GitHub tokens (PAT, OAuth, server, app install, fine-grained)
|
|
816
|
+
[/gh[pousr]_[A-Za-z0-9_]{36,}/g, "[REDACTED]"],
|
|
817
|
+
[/github_pat_[A-Za-z0-9_]{22,}/g, "[REDACTED]"],
|
|
818
|
+
// Stripe keys
|
|
819
|
+
[/[sr]k_(live|test)_[A-Za-z0-9]{20,}/g, "[REDACTED]"],
|
|
820
|
+
// Slack tokens
|
|
821
|
+
[/xox[bpsar]-[A-Za-z0-9-]{10,}/g, "[REDACTED]"],
|
|
822
|
+
// JWTs (3-segment base64url)
|
|
823
|
+
[/eyJ[A-Za-z0-9_-]{20,}\.eyJ[A-Za-z0-9_-]{20,}\.[A-Za-z0-9_-]{20,}/g, "[REDACTED]"],
|
|
824
|
+
// OpenAI keys (after sk-ant- to avoid false match)
|
|
825
|
+
[/sk-[A-Za-z0-9-]{20,}/g, "[REDACTED]"],
|
|
826
|
+
// Google API keys
|
|
827
|
+
[/AIza[A-Za-z0-9_-]{35}/g, "[REDACTED]"],
|
|
828
|
+
// Bearer tokens
|
|
829
|
+
[/[Bb]earer\s+[A-Za-z0-9_\-.]{20,}/g, "[REDACTED]"],
|
|
830
|
+
// PEM private keys
|
|
831
|
+
[/-----BEGIN[A-Z ]+KEY-----[\s\S]+?-----END[A-Z ]+KEY-----/g, "[REDACTED]"]
|
|
832
|
+
];
|
|
833
|
+
var SENSITIVE_ASSIGNMENT = /(?:api[_-]?key|secret[_-]?key|password|token|credential|auth[_-]?token|private[_-]?key)\s*[:=]\s*['"]?([^\s'"]{8,500})['"]?/gi;
|
|
834
|
+
function sanitizeSecrets(text) {
|
|
835
|
+
let result = text;
|
|
836
|
+
for (const [pattern, replacement] of KNOWN_PREFIX_PATTERNS) {
|
|
837
|
+
result = result.replace(pattern, replacement);
|
|
838
|
+
}
|
|
839
|
+
result = result.replace(
|
|
840
|
+
SENSITIVE_ASSIGNMENT,
|
|
841
|
+
(match, value) => match.replace(value, "[REDACTED]")
|
|
842
|
+
);
|
|
843
|
+
return result;
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
// src/fingerprint/code-analysis.ts
|
|
806
847
|
var IGNORE_DIRS2 = /* @__PURE__ */ new Set([
|
|
807
848
|
"node_modules",
|
|
808
849
|
".git",
|
|
@@ -878,7 +919,6 @@ var TEXT_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
|
878
919
|
".toml",
|
|
879
920
|
".ini",
|
|
880
921
|
".cfg",
|
|
881
|
-
".env",
|
|
882
922
|
".xml",
|
|
883
923
|
".plist",
|
|
884
924
|
".md",
|
|
@@ -908,7 +948,8 @@ var SKIP_PATTERNS = [
|
|
|
908
948
|
/\.map$/,
|
|
909
949
|
/\.d\.ts$/,
|
|
910
950
|
/\.generated\./,
|
|
911
|
-
/\.snap
|
|
951
|
+
/\.snap$/,
|
|
952
|
+
/^\.env($|\.)/
|
|
912
953
|
];
|
|
913
954
|
var COMMENT_LINE = {
|
|
914
955
|
"c": /^\s*\/\//,
|
|
@@ -949,7 +990,6 @@ var EXT_COMMENT = {
|
|
|
949
990
|
".toml": "h",
|
|
950
991
|
".ini": "h",
|
|
951
992
|
".cfg": "h",
|
|
952
|
-
".env": "h",
|
|
953
993
|
".html": "x",
|
|
954
994
|
".xml": "x",
|
|
955
995
|
".vue": "x",
|
|
@@ -1223,7 +1263,7 @@ function analyzeCode(dir) {
|
|
|
1223
1263
|
const repFP = structuralFingerprint(rep.compressed, rep.ext);
|
|
1224
1264
|
const similar = group.slice(1).filter((f) => structuralFingerprint(f.compressed, f.ext) === repFP);
|
|
1225
1265
|
const unique = group.slice(1).filter((f) => structuralFingerprint(f.compressed, f.ext) !== repFP);
|
|
1226
|
-
const repEntry = { path: rep.path, content: rep.compressed, size: rep.compressed.length, priority: rep.score };
|
|
1266
|
+
const repEntry = { path: rep.path, content: sanitizeSecrets(rep.compressed), size: rep.compressed.length, priority: rep.score };
|
|
1227
1267
|
const repSize = rep.path.length + rep.compressed.length + 10;
|
|
1228
1268
|
if (includedChars + repSize <= CHAR_BUDGET) {
|
|
1229
1269
|
result.push(repEntry);
|
|
@@ -1242,7 +1282,7 @@ function analyzeCode(dir) {
|
|
|
1242
1282
|
for (const f of unique) {
|
|
1243
1283
|
const skeletonSize = f.path.length + f.skeleton.length + 10;
|
|
1244
1284
|
if (includedChars + skeletonSize <= CHAR_BUDGET) {
|
|
1245
|
-
result.push({ path: f.path, content: f.skeleton, size: f.skeleton.length, priority: f.score });
|
|
1285
|
+
result.push({ path: f.path, content: sanitizeSecrets(f.skeleton), size: f.skeleton.length, priority: f.score });
|
|
1246
1286
|
includedChars += skeletonSize;
|
|
1247
1287
|
}
|
|
1248
1288
|
}
|
|
@@ -1252,7 +1292,7 @@ function analyzeCode(dir) {
|
|
|
1252
1292
|
if (includedPaths.has(f.path)) continue;
|
|
1253
1293
|
const skeletonSize = f.path.length + f.skeleton.length + 10;
|
|
1254
1294
|
if (includedChars + skeletonSize > CHAR_BUDGET) continue;
|
|
1255
|
-
result.push({ path: f.path, content: f.skeleton, size: f.skeleton.length, priority: f.score });
|
|
1295
|
+
result.push({ path: f.path, content: sanitizeSecrets(f.skeleton), size: f.skeleton.length, priority: f.score });
|
|
1256
1296
|
includedChars += skeletonSize;
|
|
1257
1297
|
}
|
|
1258
1298
|
return {
|
|
@@ -1311,7 +1351,7 @@ function filePriority(filePath) {
|
|
|
1311
1351
|
"lib.rs"
|
|
1312
1352
|
]);
|
|
1313
1353
|
if (entryPoints.has(base)) return 40;
|
|
1314
|
-
if (/\.(json|ya?ml|toml|ini|cfg
|
|
1354
|
+
if (/\.(json|ya?ml|toml|ini|cfg)$|config\.|Makefile|Dockerfile/i.test(filePath)) return 35;
|
|
1315
1355
|
if (/(route|api|controller|endpoint|handler)/i.test(filePath)) return 30;
|
|
1316
1356
|
if (/(types|schema|models|entities|migration)/i.test(filePath)) return 25;
|
|
1317
1357
|
if (/(service|lib|utils|helper|middleware)/i.test(filePath)) return 20;
|
|
@@ -10740,45 +10780,6 @@ function releaseFinalizeLock() {
|
|
|
10740
10780
|
}
|
|
10741
10781
|
}
|
|
10742
10782
|
|
|
10743
|
-
// src/lib/sanitize.ts
|
|
10744
|
-
var KNOWN_PREFIX_PATTERNS = [
|
|
10745
|
-
// Anthropic (before generic sk- pattern)
|
|
10746
|
-
[/sk-ant-[A-Za-z0-9_-]{20,}/g, "[REDACTED]"],
|
|
10747
|
-
// AWS access key IDs
|
|
10748
|
-
[/AKIA[0-9A-Z]{16}/g, "[REDACTED]"],
|
|
10749
|
-
// AWS secret keys in assignments
|
|
10750
|
-
[/(?:aws)?_?secret_?(?:access)?_?key\s*[:=]\s*['"]?[A-Za-z0-9/+=]{40}['"]?/gi, "[REDACTED]"],
|
|
10751
|
-
// GitHub tokens (PAT, OAuth, server, app install, fine-grained)
|
|
10752
|
-
[/gh[pousr]_[A-Za-z0-9_]{36,}/g, "[REDACTED]"],
|
|
10753
|
-
[/github_pat_[A-Za-z0-9_]{22,}/g, "[REDACTED]"],
|
|
10754
|
-
// Stripe keys
|
|
10755
|
-
[/[sr]k_(live|test)_[A-Za-z0-9]{20,}/g, "[REDACTED]"],
|
|
10756
|
-
// Slack tokens
|
|
10757
|
-
[/xox[bpsar]-[A-Za-z0-9-]{10,}/g, "[REDACTED]"],
|
|
10758
|
-
// JWTs (3-segment base64url)
|
|
10759
|
-
[/eyJ[A-Za-z0-9_-]{20,}\.eyJ[A-Za-z0-9_-]{20,}\.[A-Za-z0-9_-]{20,}/g, "[REDACTED]"],
|
|
10760
|
-
// OpenAI keys (after sk-ant- to avoid false match)
|
|
10761
|
-
[/sk-[A-Za-z0-9-]{20,}/g, "[REDACTED]"],
|
|
10762
|
-
// Google API keys
|
|
10763
|
-
[/AIza[A-Za-z0-9_-]{35}/g, "[REDACTED]"],
|
|
10764
|
-
// Bearer tokens
|
|
10765
|
-
[/[Bb]earer\s+[A-Za-z0-9_\-.]{20,}/g, "[REDACTED]"],
|
|
10766
|
-
// PEM private keys
|
|
10767
|
-
[/-----BEGIN[A-Z ]+KEY-----[\s\S]+?-----END[A-Z ]+KEY-----/g, "[REDACTED]"]
|
|
10768
|
-
];
|
|
10769
|
-
var SENSITIVE_ASSIGNMENT = /(?:api[_-]?key|secret[_-]?key|password|token|credential|auth[_-]?token|private[_-]?key)\s*[:=]\s*['"]?([^\s'"]{8,500})['"]?/gi;
|
|
10770
|
-
function sanitizeSecrets(text) {
|
|
10771
|
-
let result = text;
|
|
10772
|
-
for (const [pattern, replacement] of KNOWN_PREFIX_PATTERNS) {
|
|
10773
|
-
result = result.replace(pattern, replacement);
|
|
10774
|
-
}
|
|
10775
|
-
result = result.replace(
|
|
10776
|
-
SENSITIVE_ASSIGNMENT,
|
|
10777
|
-
(match, value) => match.replace(value, "[REDACTED]")
|
|
10778
|
-
);
|
|
10779
|
-
return result;
|
|
10780
|
-
}
|
|
10781
|
-
|
|
10782
10783
|
// src/lib/notifications.ts
|
|
10783
10784
|
import fs42 from "fs";
|
|
10784
10785
|
import path33 from "path";
|
package/package.json
CHANGED