@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/index.cjs
CHANGED
|
@@ -204,6 +204,12 @@ async function loadConfig() {
|
|
|
204
204
|
if (!config.githubToken && process.env.GITHUB_TOKEN) {
|
|
205
205
|
config.githubToken = process.env.GITHUB_TOKEN;
|
|
206
206
|
}
|
|
207
|
+
if (process.env.PROVIDER) {
|
|
208
|
+
config.provider = process.env.PROVIDER;
|
|
209
|
+
}
|
|
210
|
+
if (process.env.MODEL) {
|
|
211
|
+
config.model = process.env.MODEL;
|
|
212
|
+
}
|
|
207
213
|
return KakarotConfigSchema.parse(config);
|
|
208
214
|
} catch (err) {
|
|
209
215
|
if (err instanceof Error && err.message.includes("apiKey")) {
|
|
@@ -766,15 +772,24 @@ async function analyzeFile(filePath, content, changedRanges, ref, githubClient,
|
|
|
766
772
|
async function extractTestTargets(files, githubClient, prHeadRef, config) {
|
|
767
773
|
info(`Analyzing ${files.length} file(s) for test targets`);
|
|
768
774
|
const diffs = parsePullRequestFiles(files);
|
|
775
|
+
const globToRegex = (pattern) => {
|
|
776
|
+
let regexStr = pattern.replace(/\./g, "\\.");
|
|
777
|
+
regexStr = regexStr.replace(/\*\*\//g, "__DOUBLE_STAR_SLASH__");
|
|
778
|
+
regexStr = regexStr.replace(/\*\*/g, "__DOUBLE_STAR__");
|
|
779
|
+
regexStr = regexStr.replace(/\*/g, "[^/]*");
|
|
780
|
+
regexStr = regexStr.replace(/__DOUBLE_STAR_SLASH__/g, "(.*/)?");
|
|
781
|
+
regexStr = regexStr.replace(/__DOUBLE_STAR__/g, ".*");
|
|
782
|
+
return new RegExp(`^${regexStr}$`);
|
|
783
|
+
};
|
|
769
784
|
const filteredDiffs = diffs.filter((diff) => {
|
|
770
785
|
const matchesInclude = config.includePatterns.some((pattern) => {
|
|
771
|
-
const regex =
|
|
786
|
+
const regex = globToRegex(pattern);
|
|
772
787
|
return regex.test(diff.filename);
|
|
773
788
|
});
|
|
774
789
|
if (!matchesInclude)
|
|
775
790
|
return false;
|
|
776
791
|
const matchesExclude = config.excludePatterns.some((pattern) => {
|
|
777
|
-
const regex =
|
|
792
|
+
const regex = globToRegex(pattern);
|
|
778
793
|
return regex.test(diff.filename);
|
|
779
794
|
});
|
|
780
795
|
return !matchesExclude;
|