Add to current chat command

I often want to send the output of a command to the current chat. To do this, I have two options:

  • Run the command and then use the “Add To Chat” button. This usually works, but sometimes I don’t get the option.
  • Pipe the command into clipcopy and then paste it into the chat. This has the advantage of not littering the terminal with text but littering the prompt with the same.

Ideally, I’d like to have the convenience of clipcopy with the benefits of adding to chat. This would have the added benefit of adding multiple references at once, e.g. a commit message helper (I realise that @git exists; this is more, for example)

#!/bin/sh
git diff | cursor-chat
git status | cursor-chat

or being able to add a push to chat debug command to my codebase

const { spawn } = require('child_process');

function pushToChat(data) {
  // Spawn the cursor-chat command
  const chatProcess = spawn('cursor-chat', [], { shell: true });

  // Stringify the data and write it to the process
  const jsonData = JSON.stringify(data);
  chatProcess.stdin.write(jsonData);
  chatProcess.stdin.end();
}