Repository navigation
feat: add /export-session command to export session with full system prompt - #18010
Conversation
Export current session to HTML file with full system prompt included. Uses pi-coding-agent templates for consistent rendering. Features: - Exports session entries + full system prompt + tools - Saves to workspace by default, or custom path - Optional --open flag to open in browser - Reuses pi-mono export-html templates Usage: /export-session # Export to workspace /export-session ~/export # Export to custom path /export-session --open # Export and open in browser
…odules - Copy templates from pi-coding-agent into src/auto-reply/reply/export-html/ - Add build script to copy templates to dist/ - Remove fragile node_modules path traversal - Templates are now self-contained (~250KB total)
| "long": "^5.3.2", | ||
| "markdown-it": "^14.1.1", | ||
| "node-edge-tts": "^1.2.10", | ||
| "openclaw": "link:../../Library/pnpm/global/5/node_modules/openclaw", |
There was a problem hiding this comment.
local dev dependency accidentally committed
this link: dependency points to a specific machine path and will break CI/CD and other developers' environments
| "openclaw": "link:../../Library/pnpm/global/5/node_modules/openclaw", |
Prompt To Fix With AI
This is a comment left during a code review.
Path: package.json
Line: 167:167
Comment:
local dev dependency accidentally committed
this `link:` dependency points to a specific machine path and will break CI/CD and other developers' environments
```suggestion
```
How can I resolve this? If you propose a fix, please make it concise.
Additional Comments (1)
the codebase has a standard utility ( Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time! Prompt To Fix With AIThis is a comment left during a code review.
Path: src/auto-reply/reply/commands-export-session.ts
Line: 322:322
Comment:
use `resolveUserPath` from `src/utils.ts` instead of manual tilde expansion with `process.env.HOME`
the codebase has a standard utility (`resolveUserPath`) that properly handles tilde expansion with fallbacks and edge cases. see line 295 in `src/utils.ts`
```suggestion
? resolveUserPath(args.outputPath)
```
<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>
How can I resolve this? If you propose a fix, please make it concise. |
|
Thanks for the review! Both issues have been addressed:
The templates are now fully bundled in |
|
Thanks again for the work here, and sorry for the churn. We accidentally merged a batch of PRs and need to temporarily roll this back for now. Revert details:
We can't repope right now, but we will revisit this later and bring this back properly. |
Summary
Adds
/export-session(alias/export) command that exports the current session to a standalone HTML file including the complete system prompt.Motivation
Currently there is no easy way to inspect or share a session with its full context (system prompt, tools, conversation). The pi-mono CLI has
/sharewhich uploads to a gist, but:This command generates a local HTML file making it easy to:
Usage
Output:
Implementation
src/auto-reply/reply/export-html/(~250KB) — no runtime dependency on pi-coding-agent internal filesbuildAgentSystemPrompt()resolveUserPath()for proper path handlingFiles Changed
src/auto-reply/reply/commands-export-session.ts- New handler (~280 lines)src/auto-reply/reply/export-html/- Bundled HTML templatessrc/auto-reply/commands-registry.data.ts- Command registrationsrc/auto-reply/reply/commands-core.ts- Handler wiringsrc/auto-reply/reply/commands-info.ts- Exportscripts/copy-export-html-templates.ts- Build scriptpackage.json- Add copy script to buildTesting
Tested locally via Signal. The exported HTML renders correctly with:
Happy to address any feedback! 🦞