MCPcopy Create free account
hub / github.com/agentforce314/clawcodex / _write_export

Method _write_export

src/command_system/export_command.py:223–250  ·  view source on GitHub ↗

Render + write the export; never raises (export.tsx:67-82, ExportDialog.tsx:95-121 both wrap the write in a try/catch and report a failure message rather than throwing out of the command).

(
        messages: Any,
        fmt: ExportFormat,
        filename: str,
        cwd: str,
        *,
        preserve_markdown_extension: bool,
    )

Source from the content-addressed store, hash-verified

221
222 @staticmethod
223 def _write_export(
224 messages: Any,
225 fmt: ExportFormat,
226 filename: str,
227 cwd: str,
228 *,
229 preserve_markdown_extension: bool,
230 ) -> InteractiveOutcome:
231 """Render + write the export; never raises (export.tsx:67-82,
232 ExportDialog.tsx:95-121 both wrap the write in a try/catch and report a
233 failure message rather than throwing out of the command)."""
234 try:
235 content = render_messages_for_export(messages, format=fmt)
236 final_filename = ensure_export_filename_extension(
237 filename,
238 fmt,
239 preserve_markdown_extension=preserve_markdown_extension,
240 )
241 filepath = resolve_export_filepath(cwd, final_filename)
242 with open(filepath, "w", encoding="utf-8") as fh:
243 fh.write(content)
244 return InteractiveOutcome(
245 message=f"Conversation exported to: {filepath}", display="system"
246 )
247 except Exception as exc: # mirror TS catch-all (export.tsx:79)
248 return InteractiveOutcome(
249 message=f"Failed to export conversation: {exc}", display="system"
250 )
251
252
253EXPORT_COMMAND = ExportCommand(

Callers 1

runMethod · 0.95

Calls 5

resolve_export_filepathFunction · 0.90
InteractiveOutcomeClass · 0.85
writeMethod · 0.45

Tested by

no test coverage detected