@kakarot-ci/core 0.5.1 → 0.6.1
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/dist/cli/index.js +17 -2
- package/dist/cli/index.js.map +2 -2
- package/dist/index.cjs +17 -2
- package/dist/index.cjs.map +2 -2
- package/dist/index.js +17 -2
- package/dist/index.js.map +2 -2
- package/dist/src/utils/config-loader.d.ts.map +1 -1
- package/dist/src/utils/test-target-extractor.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -387,6 +387,12 @@ async function loadConfig() {
|
|
|
387
387
|
if (!config.githubToken && process.env.GITHUB_TOKEN) {
|
|
388
388
|
config.githubToken = process.env.GITHUB_TOKEN;
|
|
389
389
|
}
|
|
390
|
+
if (process.env.PROVIDER) {
|
|
391
|
+
config.provider = process.env.PROVIDER;
|
|
392
|
+
}
|
|
393
|
+
if (process.env.MODEL) {
|
|
394
|
+
config.model = process.env.MODEL;
|
|
395
|
+
}
|
|
390
396
|
return KakarotConfigSchema.parse(config);
|
|
391
397
|
} catch (err) {
|
|
392
398
|
if (err instanceof Error && err.message.includes("apiKey")) {
|
|
@@ -710,15 +716,24 @@ async function analyzeFile(filePath, content, changedRanges, ref, githubClient,
|
|
|
710
716
|
async function extractTestTargets(files, githubClient, prHeadRef, config) {
|
|
711
717
|
info(`Analyzing ${files.length} file(s) for test targets`);
|
|
712
718
|
const diffs = parsePullRequestFiles(files);
|
|
719
|
+
const globToRegex = (pattern) => {
|
|
720
|
+
let regexStr = pattern.replace(/\./g, "\\.");
|
|
721
|
+
regexStr = regexStr.replace(/\*\*\//g, "__DOUBLE_STAR_SLASH__");
|
|
722
|
+
regexStr = regexStr.replace(/\*\*/g, "__DOUBLE_STAR__");
|
|
723
|
+
regexStr = regexStr.replace(/\*/g, "[^/]*");
|
|
724
|
+
regexStr = regexStr.replace(/__DOUBLE_STAR_SLASH__/g, "(.*/)?");
|
|
725
|
+
regexStr = regexStr.replace(/__DOUBLE_STAR__/g, ".*");
|
|
726
|
+
return new RegExp(`^${regexStr}$`);
|
|
727
|
+
};
|
|
713
728
|
const filteredDiffs = diffs.filter((diff) => {
|
|
714
729
|
const matchesInclude = config.includePatterns.some((pattern) => {
|
|
715
|
-
const regex =
|
|
730
|
+
const regex = globToRegex(pattern);
|
|
716
731
|
return regex.test(diff.filename);
|
|
717
732
|
});
|
|
718
733
|
if (!matchesInclude)
|
|
719
734
|
return false;
|
|
720
735
|
const matchesExclude = config.excludePatterns.some((pattern) => {
|
|
721
|
-
const regex =
|
|
736
|
+
const regex = globToRegex(pattern);
|
|
722
737
|
return regex.test(diff.filename);
|
|
723
738
|
});
|
|
724
739
|
return !matchesExclude;
|