const INJECTED_TAG_NAMES = [
  'ide_opened_file',
  'ide_selection',
  'ide_diagnostics',
  'system-reminder',
  'user-prompt-submit-hook',
  'task-notification',
  'task-id',
  'tool-use-id',
  'output-file',
  'command-name',
  'command-message',
  'command-args',
  'local-command-stdout',
  'local-command-stderr',
  'bash-input',
  'bash-stdout',
  'bash-stderr',
  'automated-reminder',
];

export function cleanPrompt(rawPrompt: string): string {
  let cleaned = rawPrompt;
  for (const tag of INJECTED_TAG_NAMES) {
    const pattern = new RegExp(`<${tag}>[\\s\\S]*?</${tag}>`, 'g');
    cleaned = cleaned.replace(pattern, '');
  }
  return cleaned.trim();
}
