Skip to content

Conversation

spinualexandru
Copy link
Contributor

Brief description of what this PR does

snapshot_2025-09-19_17-31-27 snapshot_2025-09-19_17-32-13 snapshot_2025-09-19_17-32-26

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Testing

  • Tested with Ollama
  • Tested with OpenRouter
  • Tested with OpenAI-compatible API
  • Tested MCP integration (if applicable)

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • Documentation updated (if needed)
  • No breaking changes (or clearly documented)

@Copilot Copilot AI review requested due to automatic review settings September 19, 2025 14:39
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds the ability to export conversation history to markdown files, addressing issue #6. The export command creates markdown files with metadata frontmatter including session date, provider, model, and total tokens.

  • Extends the Command interface to accept messages and metadata parameters
  • Updates all existing commands to match the new interface signature
  • Adds a new /export command that generates markdown files with conversation history

Reviewed Changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
source/types/commands.ts Updates Command interface to include messages and metadata parameters
source/types/app.ts Adds provider, model, and token counting to MessageSubmissionOptions
source/commands/export.tsx New export command implementation with markdown formatting
source/commands/*.ts Updates all command handlers to match new interface signature
source/commands.ts Updates CommandRegistry execute method to pass messages and metadata
source/app/utils/appUtils.ts Calculates total tokens and passes metadata to command execution
source/app/hooks/useAppInitialization.tsx Registers the new export command
source/app.tsx Passes provider, model, and token counting function to message submission
package.json Updates ink dependency version
README.md Documents the new export command

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +53 to +55
const filename =
args[0] ||
`nanocoder-chat-${new Date().toISOString().replace(/:/g, '-')}.md`;
Copy link
Preview

Copilot AI Sep 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The filename generation uses a magic string replacement pattern. Consider extracting this to a helper function or using a more robust date formatting approach for better maintainability.

Copilot uses AI. Check for mistakes.


`;

const markdownContent = messages.map(formatMessageContent).join('');
Copy link
Preview

Copilot AI Sep 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using map().join('') creates intermediate arrays. For better performance with large message arrays, consider using a single loop or reduce operation to build the content string directly.

Suggested change
const markdownContent = messages.map(formatMessageContent).join('');
const markdownContent = messages.reduce((acc, msg) => acc + formatMessageContent(msg), '');

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant