Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(desktop): recognize keyworded write outputs

david70603e810dce
diff --git a/apps/desktop/src/renderer/__tests__/generatedFiles.test.ts b/apps/desktop/src/renderer/__tests__/generatedFiles.test.ts
index 7ed1ca5be1..7f8ce71bc5 100644
--- a/apps/desktop/src/renderer/__tests__/generatedFiles.test.ts
+++ b/apps/desktop/src/renderer/__tests__/generatedFiles.test.ts
@@ -212,6 +212,12 @@ describe('extractCommandOutputPathCandidates', () => {
expect(
extractCommandOutputPathCandidates("Path('out/data.bin').write_bytes(payload)"),
).toEqual(['out/data.bin']);
+ expect(
+ extractCommandOutputPathCandidates("df.to_csv(path_or_buf='out/report.csv', index=False)"),
+ ).toEqual(['out/report.csv']);
+ expect(
+ extractCommandOutputPathCandidates("workbook.to_excel(excel_writer=\"out/report.xlsx\")"),
+ ).toEqual(['out/report.xlsx']);
expect(extractCommandOutputPathCandidates('cp source.txt output/')).toEqual(['output/source.txt']);
expect(extractCommandOutputPathCandidates('copy source.txt output\\')).toEqual(['output\\source.txt']);
expect(
diff --git a/apps/desktop/src/renderer/lib/generatedFiles.ts b/apps/desktop/src/renderer/lib/generatedFiles.ts
index bf4f720bd8..ceef76ddef 100644
--- a/apps/desktop/src/renderer/lib/generatedFiles.ts
+++ b/apps/desktop/src/renderer/lib/generatedFiles.ts
@@ -159,7 +159,7 @@ function extractCommandPathTokens(command: string): CommandPathToken[] {
}
const WRITE_CALL_PREFIX_RE =
- /(?:\.|\b)(?:save|writeFileSync|writeFile|writeAllText|writeAllBytes|createWriteStream|write_text|write_bytes|to_csv|to_excel|to_json|to_parquet|imwrite|imsave|dump)\s*\(\s*(?:[rubf]{0,2})?['"]$/i;
+ /(?:\.|\b)(?:save|writeFileSync|writeFile|writeAllText|writeAllBytes|createWriteStream|write_text|write_bytes|to_csv|to_excel|to_json|to_parquet|imwrite|imsave|dump)\s*\(\s*(?:(?:path_or_buf|excel_writer|path|filename|fname|fp|file)\s*=\s*)?(?:[rubf]{0,2})?['"]$/i;
const POWERSHELL_CMDLET_RE = /\b[A-Za-z][A-Za-z0-9]*-[A-Za-z][A-Za-z0-9-]*\b/g;
const POWERSHELL_WRITE_COMMANDS = new Set([
'out-file',