fix: add error handling for CSV read/parse in loadAgentManifest and loadBmadHelp
Wrap file read and csv.parse in try/catch blocks so malformed or unreadable CSV files gracefully degrade instead of aborting setup. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
3ba4bbcb73
commit
22fabf7ba1
|
|
@ -98,14 +98,18 @@ class GitHubCopilotSetup extends BaseIdeSetup {
|
||||||
return agents;
|
return agents;
|
||||||
}
|
}
|
||||||
|
|
||||||
const csvContent = await fs.readFile(manifestPath, 'utf8');
|
try {
|
||||||
const records = csv.parse(csvContent, {
|
const csvContent = await fs.readFile(manifestPath, 'utf8');
|
||||||
columns: true,
|
const records = csv.parse(csvContent, {
|
||||||
skip_empty_lines: true,
|
columns: true,
|
||||||
});
|
skip_empty_lines: true,
|
||||||
|
});
|
||||||
|
|
||||||
for (const record of records) {
|
for (const record of records) {
|
||||||
agents.set(record.name, record);
|
agents.set(record.name, record);
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
// Gracefully degrade if manifest is unreadable/malformed
|
||||||
}
|
}
|
||||||
|
|
||||||
return agents;
|
return agents;
|
||||||
|
|
@ -123,11 +127,16 @@ class GitHubCopilotSetup extends BaseIdeSetup {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const csvContent = await fs.readFile(helpPath, 'utf8');
|
try {
|
||||||
return csv.parse(csvContent, {
|
const csvContent = await fs.readFile(helpPath, 'utf8');
|
||||||
columns: true,
|
return csv.parse(csvContent, {
|
||||||
skip_empty_lines: true,
|
columns: true,
|
||||||
});
|
skip_empty_lines: true,
|
||||||
|
});
|
||||||
|
} catch {
|
||||||
|
// Gracefully degrade if help CSV is unreadable/malformed
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue