mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-05-01 06:23:28 +08:00
fix: keep loop status scans fail-soft
This commit is contained in:
committed by
Affaan Mustafa
parent
fb6cc8548b
commit
9aace2e6fe
@@ -135,21 +135,32 @@ function getNow(options = {}) {
|
||||
return now;
|
||||
}
|
||||
|
||||
function walkJsonlFiles(dir, files = []) {
|
||||
function walkJsonlFiles(dir, result = { errors: [], files: [] }) {
|
||||
if (!fs.existsSync(dir)) {
|
||||
return files;
|
||||
return result;
|
||||
}
|
||||
|
||||
let entries;
|
||||
try {
|
||||
entries = fs.readdirSync(dir, { withFileTypes: true });
|
||||
} catch (error) {
|
||||
result.errors.push({
|
||||
code: error.code || null,
|
||||
message: error.message,
|
||||
transcriptPath: dir,
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
||||
for (const entry of entries) {
|
||||
const fullPath = path.join(dir, entry.name);
|
||||
if (entry.isDirectory()) {
|
||||
walkJsonlFiles(fullPath, files);
|
||||
walkJsonlFiles(fullPath, result);
|
||||
} else if (entry.isFile() && entry.name.endsWith('.jsonl')) {
|
||||
files.push(fullPath);
|
||||
result.files.push(fullPath);
|
||||
}
|
||||
}
|
||||
return files;
|
||||
return result;
|
||||
}
|
||||
|
||||
function findTranscriptPaths(options = {}) {
|
||||
@@ -164,10 +175,11 @@ function findTranscriptPaths(options = {}) {
|
||||
|
||||
const homeDir = getHomeDir(normalizedOptions);
|
||||
const transcriptRoot = path.join(homeDir, '.claude', 'projects');
|
||||
const errors = [];
|
||||
const walkResult = walkJsonlFiles(transcriptRoot);
|
||||
const errors = [...walkResult.errors];
|
||||
const transcriptEntries = [];
|
||||
|
||||
for (const transcriptPath of walkJsonlFiles(transcriptRoot)) {
|
||||
for (const transcriptPath of walkResult.files) {
|
||||
try {
|
||||
transcriptEntries.push({
|
||||
transcriptPath,
|
||||
@@ -345,6 +357,10 @@ function buildRecommendation(signals) {
|
||||
return 'Open the transcript or interrupt the parked session; the scheduled wake is overdue.';
|
||||
}
|
||||
|
||||
if (signals.some(signal => signal.type === 'transcript_parse_errors')) {
|
||||
return 'Inspect the transcript; some JSONL lines could not be parsed.';
|
||||
}
|
||||
|
||||
return 'No stale ScheduleWakeup or Bash waits detected.';
|
||||
}
|
||||
|
||||
@@ -454,6 +470,13 @@ function analyzeTranscript(transcriptPath, options = {}) {
|
||||
}
|
||||
}
|
||||
|
||||
if (parseErrors > 0) {
|
||||
signals.push({
|
||||
count: parseErrors,
|
||||
type: 'transcript_parse_errors',
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
eventCount: entries.length,
|
||||
lastEventAt: toIso(lastEventAt),
|
||||
|
||||
Reference in New Issue
Block a user