@zgsm/costrict-cli 0.0.11 → 0.0.13
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/bundle/gemini.js +243539 -243513
- package/bundle/workers/call-graph-worker.js +36 -0
- package/bundle/workers/ckg-build-worker.js +36 -0
- package/bundle/workers/ckg-parser-worker.js +36 -0
- package/bundle/workers/file-importance-worker.js +36 -0
- package/bundle/workers/get-ranked-tags-worker.js +36 -0
- package/package.json +1 -1
|
@@ -40068,6 +40068,7 @@ var DebugLogger = class {
|
|
|
40068
40068
|
if (logFilePath) {
|
|
40069
40069
|
if (!this.customLogFilePath) {
|
|
40070
40070
|
this.currentLogDate = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
40071
|
+
this.cleanupOldLogs();
|
|
40071
40072
|
}
|
|
40072
40073
|
this.logStream = fs3.createWriteStream(logFilePath, {
|
|
40073
40074
|
flags: "a"
|
|
@@ -40077,11 +40078,46 @@ var DebugLogger = class {
|
|
|
40077
40078
|
});
|
|
40078
40079
|
}
|
|
40079
40080
|
}
|
|
40081
|
+
cleanupOldLogs() {
|
|
40082
|
+
if (this.customLogFilePath) {
|
|
40083
|
+
return;
|
|
40084
|
+
}
|
|
40085
|
+
try {
|
|
40086
|
+
const logDir = path2.join(os.homedir(), GEMINI_DIR, "logs");
|
|
40087
|
+
if (!fs3.existsSync(logDir)) {
|
|
40088
|
+
return;
|
|
40089
|
+
}
|
|
40090
|
+
const now = /* @__PURE__ */ new Date();
|
|
40091
|
+
const maxAgeInDays = 7;
|
|
40092
|
+
const maxAgeInMs = maxAgeInDays * 24 * 60 * 60 * 1e3;
|
|
40093
|
+
const files = fs3.readdirSync(logDir);
|
|
40094
|
+
for (const file of files) {
|
|
40095
|
+
const isDebugLog = file.startsWith("costrict-cli-debug-") && file.endsWith(".log");
|
|
40096
|
+
const isLastErrorsFile = file.endsWith(".last-errors");
|
|
40097
|
+
if (isDebugLog || isLastErrorsFile) {
|
|
40098
|
+
const filePath = path2.join(logDir, file);
|
|
40099
|
+
try {
|
|
40100
|
+
const stats = fs3.statSync(filePath);
|
|
40101
|
+
const fileAge = now.getTime() - stats.mtime.getTime();
|
|
40102
|
+
if (fileAge > maxAgeInMs) {
|
|
40103
|
+
fs3.unlinkSync(filePath);
|
|
40104
|
+
console.log(`Deleted old debug log: ${file}`);
|
|
40105
|
+
}
|
|
40106
|
+
} catch (err2) {
|
|
40107
|
+
console.error(`Failed to process log file ${file}:`, err2);
|
|
40108
|
+
}
|
|
40109
|
+
}
|
|
40110
|
+
}
|
|
40111
|
+
} catch (err2) {
|
|
40112
|
+
console.error("Failed to cleanup old debug logs:", err2);
|
|
40113
|
+
}
|
|
40114
|
+
}
|
|
40080
40115
|
rotateLogFileIfNeeded() {
|
|
40081
40116
|
if (!this.customLogFilePath && this.logStream) {
|
|
40082
40117
|
const currentDate = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
40083
40118
|
if (currentDate !== this.currentLogDate) {
|
|
40084
40119
|
this.logStream.end();
|
|
40120
|
+
this.cleanupOldLogs();
|
|
40085
40121
|
this.initializeLogStream();
|
|
40086
40122
|
}
|
|
40087
40123
|
}
|
|
@@ -40818,6 +40818,7 @@ var DebugLogger = class {
|
|
|
40818
40818
|
if (logFilePath) {
|
|
40819
40819
|
if (!this.customLogFilePath) {
|
|
40820
40820
|
this.currentLogDate = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
40821
|
+
this.cleanupOldLogs();
|
|
40821
40822
|
}
|
|
40822
40823
|
this.logStream = fs3.createWriteStream(logFilePath, {
|
|
40823
40824
|
flags: "a"
|
|
@@ -40827,11 +40828,46 @@ var DebugLogger = class {
|
|
|
40827
40828
|
});
|
|
40828
40829
|
}
|
|
40829
40830
|
}
|
|
40831
|
+
cleanupOldLogs() {
|
|
40832
|
+
if (this.customLogFilePath) {
|
|
40833
|
+
return;
|
|
40834
|
+
}
|
|
40835
|
+
try {
|
|
40836
|
+
const logDir = path2.join(os.homedir(), GEMINI_DIR, "logs");
|
|
40837
|
+
if (!fs3.existsSync(logDir)) {
|
|
40838
|
+
return;
|
|
40839
|
+
}
|
|
40840
|
+
const now = /* @__PURE__ */ new Date();
|
|
40841
|
+
const maxAgeInDays = 7;
|
|
40842
|
+
const maxAgeInMs = maxAgeInDays * 24 * 60 * 60 * 1e3;
|
|
40843
|
+
const files = fs3.readdirSync(logDir);
|
|
40844
|
+
for (const file of files) {
|
|
40845
|
+
const isDebugLog = file.startsWith("costrict-cli-debug-") && file.endsWith(".log");
|
|
40846
|
+
const isLastErrorsFile = file.endsWith(".last-errors");
|
|
40847
|
+
if (isDebugLog || isLastErrorsFile) {
|
|
40848
|
+
const filePath = path2.join(logDir, file);
|
|
40849
|
+
try {
|
|
40850
|
+
const stats = fs3.statSync(filePath);
|
|
40851
|
+
const fileAge = now.getTime() - stats.mtime.getTime();
|
|
40852
|
+
if (fileAge > maxAgeInMs) {
|
|
40853
|
+
fs3.unlinkSync(filePath);
|
|
40854
|
+
console.log(`Deleted old debug log: ${file}`);
|
|
40855
|
+
}
|
|
40856
|
+
} catch (err2) {
|
|
40857
|
+
console.error(`Failed to process log file ${file}:`, err2);
|
|
40858
|
+
}
|
|
40859
|
+
}
|
|
40860
|
+
}
|
|
40861
|
+
} catch (err2) {
|
|
40862
|
+
console.error("Failed to cleanup old debug logs:", err2);
|
|
40863
|
+
}
|
|
40864
|
+
}
|
|
40830
40865
|
rotateLogFileIfNeeded() {
|
|
40831
40866
|
if (!this.customLogFilePath && this.logStream) {
|
|
40832
40867
|
const currentDate = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
40833
40868
|
if (currentDate !== this.currentLogDate) {
|
|
40834
40869
|
this.logStream.end();
|
|
40870
|
+
this.cleanupOldLogs();
|
|
40835
40871
|
this.initializeLogStream();
|
|
40836
40872
|
}
|
|
40837
40873
|
}
|
|
@@ -40042,6 +40042,7 @@ var DebugLogger = class {
|
|
|
40042
40042
|
if (logFilePath) {
|
|
40043
40043
|
if (!this.customLogFilePath) {
|
|
40044
40044
|
this.currentLogDate = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
40045
|
+
this.cleanupOldLogs();
|
|
40045
40046
|
}
|
|
40046
40047
|
this.logStream = fs3.createWriteStream(logFilePath, {
|
|
40047
40048
|
flags: "a"
|
|
@@ -40051,11 +40052,46 @@ var DebugLogger = class {
|
|
|
40051
40052
|
});
|
|
40052
40053
|
}
|
|
40053
40054
|
}
|
|
40055
|
+
cleanupOldLogs() {
|
|
40056
|
+
if (this.customLogFilePath) {
|
|
40057
|
+
return;
|
|
40058
|
+
}
|
|
40059
|
+
try {
|
|
40060
|
+
const logDir = path2.join(os.homedir(), GEMINI_DIR, "logs");
|
|
40061
|
+
if (!fs3.existsSync(logDir)) {
|
|
40062
|
+
return;
|
|
40063
|
+
}
|
|
40064
|
+
const now = /* @__PURE__ */ new Date();
|
|
40065
|
+
const maxAgeInDays = 7;
|
|
40066
|
+
const maxAgeInMs = maxAgeInDays * 24 * 60 * 60 * 1e3;
|
|
40067
|
+
const files = fs3.readdirSync(logDir);
|
|
40068
|
+
for (const file of files) {
|
|
40069
|
+
const isDebugLog = file.startsWith("costrict-cli-debug-") && file.endsWith(".log");
|
|
40070
|
+
const isLastErrorsFile = file.endsWith(".last-errors");
|
|
40071
|
+
if (isDebugLog || isLastErrorsFile) {
|
|
40072
|
+
const filePath = path2.join(logDir, file);
|
|
40073
|
+
try {
|
|
40074
|
+
const stats = fs3.statSync(filePath);
|
|
40075
|
+
const fileAge = now.getTime() - stats.mtime.getTime();
|
|
40076
|
+
if (fileAge > maxAgeInMs) {
|
|
40077
|
+
fs3.unlinkSync(filePath);
|
|
40078
|
+
console.log(`Deleted old debug log: ${file}`);
|
|
40079
|
+
}
|
|
40080
|
+
} catch (err2) {
|
|
40081
|
+
console.error(`Failed to process log file ${file}:`, err2);
|
|
40082
|
+
}
|
|
40083
|
+
}
|
|
40084
|
+
}
|
|
40085
|
+
} catch (err2) {
|
|
40086
|
+
console.error("Failed to cleanup old debug logs:", err2);
|
|
40087
|
+
}
|
|
40088
|
+
}
|
|
40054
40089
|
rotateLogFileIfNeeded() {
|
|
40055
40090
|
if (!this.customLogFilePath && this.logStream) {
|
|
40056
40091
|
const currentDate = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
40057
40092
|
if (currentDate !== this.currentLogDate) {
|
|
40058
40093
|
this.logStream.end();
|
|
40094
|
+
this.cleanupOldLogs();
|
|
40059
40095
|
this.initializeLogStream();
|
|
40060
40096
|
}
|
|
40061
40097
|
}
|
|
@@ -41900,6 +41900,7 @@ var DebugLogger = class {
|
|
|
41900
41900
|
if (logFilePath) {
|
|
41901
41901
|
if (!this.customLogFilePath) {
|
|
41902
41902
|
this.currentLogDate = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
41903
|
+
this.cleanupOldLogs();
|
|
41903
41904
|
}
|
|
41904
41905
|
this.logStream = fs4.createWriteStream(logFilePath, {
|
|
41905
41906
|
flags: "a"
|
|
@@ -41909,11 +41910,46 @@ var DebugLogger = class {
|
|
|
41909
41910
|
});
|
|
41910
41911
|
}
|
|
41911
41912
|
}
|
|
41913
|
+
cleanupOldLogs() {
|
|
41914
|
+
if (this.customLogFilePath) {
|
|
41915
|
+
return;
|
|
41916
|
+
}
|
|
41917
|
+
try {
|
|
41918
|
+
const logDir = path3.join(os.homedir(), GEMINI_DIR, "logs");
|
|
41919
|
+
if (!fs4.existsSync(logDir)) {
|
|
41920
|
+
return;
|
|
41921
|
+
}
|
|
41922
|
+
const now = /* @__PURE__ */ new Date();
|
|
41923
|
+
const maxAgeInDays = 7;
|
|
41924
|
+
const maxAgeInMs = maxAgeInDays * 24 * 60 * 60 * 1e3;
|
|
41925
|
+
const files = fs4.readdirSync(logDir);
|
|
41926
|
+
for (const file of files) {
|
|
41927
|
+
const isDebugLog = file.startsWith("costrict-cli-debug-") && file.endsWith(".log");
|
|
41928
|
+
const isLastErrorsFile = file.endsWith(".last-errors");
|
|
41929
|
+
if (isDebugLog || isLastErrorsFile) {
|
|
41930
|
+
const filePath = path3.join(logDir, file);
|
|
41931
|
+
try {
|
|
41932
|
+
const stats = fs4.statSync(filePath);
|
|
41933
|
+
const fileAge = now.getTime() - stats.mtime.getTime();
|
|
41934
|
+
if (fileAge > maxAgeInMs) {
|
|
41935
|
+
fs4.unlinkSync(filePath);
|
|
41936
|
+
console.log(`Deleted old debug log: ${file}`);
|
|
41937
|
+
}
|
|
41938
|
+
} catch (err2) {
|
|
41939
|
+
console.error(`Failed to process log file ${file}:`, err2);
|
|
41940
|
+
}
|
|
41941
|
+
}
|
|
41942
|
+
}
|
|
41943
|
+
} catch (err2) {
|
|
41944
|
+
console.error("Failed to cleanup old debug logs:", err2);
|
|
41945
|
+
}
|
|
41946
|
+
}
|
|
41912
41947
|
rotateLogFileIfNeeded() {
|
|
41913
41948
|
if (!this.customLogFilePath && this.logStream) {
|
|
41914
41949
|
const currentDate = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
41915
41950
|
if (currentDate !== this.currentLogDate) {
|
|
41916
41951
|
this.logStream.end();
|
|
41952
|
+
this.cleanupOldLogs();
|
|
41917
41953
|
this.initializeLogStream();
|
|
41918
41954
|
}
|
|
41919
41955
|
}
|
|
@@ -42448,6 +42448,7 @@ var DebugLogger = class {
|
|
|
42448
42448
|
if (logFilePath) {
|
|
42449
42449
|
if (!this.customLogFilePath) {
|
|
42450
42450
|
this.currentLogDate = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
42451
|
+
this.cleanupOldLogs();
|
|
42451
42452
|
}
|
|
42452
42453
|
this.logStream = fs5.createWriteStream(logFilePath, {
|
|
42453
42454
|
flags: "a"
|
|
@@ -42457,11 +42458,46 @@ var DebugLogger = class {
|
|
|
42457
42458
|
});
|
|
42458
42459
|
}
|
|
42459
42460
|
}
|
|
42461
|
+
cleanupOldLogs() {
|
|
42462
|
+
if (this.customLogFilePath) {
|
|
42463
|
+
return;
|
|
42464
|
+
}
|
|
42465
|
+
try {
|
|
42466
|
+
const logDir = path5.join(os2.homedir(), GEMINI_DIR, "logs");
|
|
42467
|
+
if (!fs5.existsSync(logDir)) {
|
|
42468
|
+
return;
|
|
42469
|
+
}
|
|
42470
|
+
const now = /* @__PURE__ */ new Date();
|
|
42471
|
+
const maxAgeInDays = 7;
|
|
42472
|
+
const maxAgeInMs = maxAgeInDays * 24 * 60 * 60 * 1e3;
|
|
42473
|
+
const files = fs5.readdirSync(logDir);
|
|
42474
|
+
for (const file of files) {
|
|
42475
|
+
const isDebugLog = file.startsWith("costrict-cli-debug-") && file.endsWith(".log");
|
|
42476
|
+
const isLastErrorsFile = file.endsWith(".last-errors");
|
|
42477
|
+
if (isDebugLog || isLastErrorsFile) {
|
|
42478
|
+
const filePath = path5.join(logDir, file);
|
|
42479
|
+
try {
|
|
42480
|
+
const stats = fs5.statSync(filePath);
|
|
42481
|
+
const fileAge = now.getTime() - stats.mtime.getTime();
|
|
42482
|
+
if (fileAge > maxAgeInMs) {
|
|
42483
|
+
fs5.unlinkSync(filePath);
|
|
42484
|
+
console.log(`Deleted old debug log: ${file}`);
|
|
42485
|
+
}
|
|
42486
|
+
} catch (err2) {
|
|
42487
|
+
console.error(`Failed to process log file ${file}:`, err2);
|
|
42488
|
+
}
|
|
42489
|
+
}
|
|
42490
|
+
}
|
|
42491
|
+
} catch (err2) {
|
|
42492
|
+
console.error("Failed to cleanup old debug logs:", err2);
|
|
42493
|
+
}
|
|
42494
|
+
}
|
|
42460
42495
|
rotateLogFileIfNeeded() {
|
|
42461
42496
|
if (!this.customLogFilePath && this.logStream) {
|
|
42462
42497
|
const currentDate = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
42463
42498
|
if (currentDate !== this.currentLogDate) {
|
|
42464
42499
|
this.logStream.end();
|
|
42500
|
+
this.cleanupOldLogs();
|
|
42465
42501
|
this.initializeLogStream();
|
|
42466
42502
|
}
|
|
42467
42503
|
}
|