@pratik7368patil/anchor-core 0.1.26 → 0.1.27
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/index.d.ts +3 -0
- package/dist/index.js +12 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -716,6 +716,8 @@ type IndexPullRequestsProgress = {
|
|
|
716
716
|
type CodeIndexProgress = {
|
|
717
717
|
stage: "discovering_code_files";
|
|
718
718
|
repo: string;
|
|
719
|
+
scanned?: number;
|
|
720
|
+
total?: number;
|
|
719
721
|
} | {
|
|
720
722
|
stage: "discovered_code_files";
|
|
721
723
|
repo: string;
|
|
@@ -1133,6 +1135,7 @@ type CodeFileDiscoveryResult = {
|
|
|
1133
1135
|
declare function isHardExcludedCodePath(filePath: string): boolean;
|
|
1134
1136
|
declare function discoverCodeFiles(cwd: string, repo: string, options?: {
|
|
1135
1137
|
maxFileBytes?: number;
|
|
1138
|
+
onScan?: (scanned: number, total: number) => void;
|
|
1136
1139
|
}): CodeFileDiscoveryResult;
|
|
1137
1140
|
|
|
1138
1141
|
declare function indexCodebase(db: AnchorDatabase, options: {
|
package/dist/index.js
CHANGED
|
@@ -1694,7 +1694,7 @@ function calculateCoverage(input) {
|
|
|
1694
1694
|
}
|
|
1695
1695
|
|
|
1696
1696
|
// src/db/database.ts
|
|
1697
|
-
var CODE_WRITE_PROGRESS_INTERVAL =
|
|
1697
|
+
var CODE_WRITE_PROGRESS_INTERVAL = 150;
|
|
1698
1698
|
function shouldEmitCodeWriteProgress(current, total) {
|
|
1699
1699
|
return current === 0 || current === 1 || current === total || current % CODE_WRITE_PROGRESS_INTERVAL === 0;
|
|
1700
1700
|
}
|
|
@@ -2796,7 +2796,7 @@ function chunkCodeFile(file, options = {}) {
|
|
|
2796
2796
|
import crypto2 from "crypto";
|
|
2797
2797
|
import path6 from "path";
|
|
2798
2798
|
var KNOWN_EXTENSIONS = [".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs", ".json"];
|
|
2799
|
-
var ARCHITECTURE_PROGRESS_INTERVAL =
|
|
2799
|
+
var ARCHITECTURE_PROGRESS_INTERVAL = 100;
|
|
2800
2800
|
function shouldEmitProgress2(current, total) {
|
|
2801
2801
|
return current === 0 || current === 1 || current === total || current % ARCHITECTURE_PROGRESS_INTERVAL === 0;
|
|
2802
2802
|
}
|
|
@@ -3243,12 +3243,19 @@ function discoverGitFiles(cwd) {
|
|
|
3243
3243
|
});
|
|
3244
3244
|
return output.split("\n").map((line) => normalizeGitPath(line.trim())).filter(Boolean);
|
|
3245
3245
|
}
|
|
3246
|
+
var DISCOVERY_SCAN_INTERVAL = 200;
|
|
3246
3247
|
function discoverCodeFiles(cwd, repo, options = {}) {
|
|
3247
3248
|
const maxFileBytes = options.maxFileBytes ?? DEFAULT_MAX_CODE_FILE_BYTES;
|
|
3248
3249
|
const rootPath = path7.resolve(cwd);
|
|
3249
3250
|
const files = [];
|
|
3250
3251
|
let skippedFiles = 0;
|
|
3251
|
-
|
|
3252
|
+
const gitFiles = discoverGitFiles(cwd);
|
|
3253
|
+
const total = gitFiles.length;
|
|
3254
|
+
for (const [scanIndex, filePath] of gitFiles.entries()) {
|
|
3255
|
+
const scanned = scanIndex + 1;
|
|
3256
|
+
if (scanned % DISCOVERY_SCAN_INTERVAL === 0 || scanned === total) {
|
|
3257
|
+
options.onScan?.(scanned, total);
|
|
3258
|
+
}
|
|
3252
3259
|
if (isHardExcludedCodePath(filePath)) {
|
|
3253
3260
|
skippedFiles += 1;
|
|
3254
3261
|
continue;
|
|
@@ -3524,7 +3531,8 @@ function refreshTestCommands(db, cwd, repo, files = [], options = {}) {
|
|
|
3524
3531
|
function indexCodebase(db, options) {
|
|
3525
3532
|
options.onProgress?.({ stage: "discovering_code_files", repo: options.repo });
|
|
3526
3533
|
const discovery = discoverCodeFiles(options.cwd, options.repo, {
|
|
3527
|
-
maxFileBytes: options.maxFileBytes
|
|
3534
|
+
maxFileBytes: options.maxFileBytes,
|
|
3535
|
+
onScan: (scanned, total) => options.onProgress?.({ stage: "discovering_code_files", repo: options.repo, scanned, total })
|
|
3528
3536
|
});
|
|
3529
3537
|
options.onProgress?.({
|
|
3530
3538
|
stage: "discovered_code_files",
|