execute method

  1. @override
Future<CommandResult> execute(
  1. String args,
  2. ToolUseContext context
)
override

Execute the command.

Implementation

@override
Future<CommandResult> execute(String args, ToolUseContext context) async {
  final description = args.trim();

  final buffer = StringBuffer();
  buffer.writeln('Bug Report');
  buffer.writeln('==========');
  buffer.writeln();

  // Collect system info
  buffer.writeln('System information:');
  buffer.writeln(
    '  Platform: ${Platform.operatingSystem} ${Platform.operatingSystemVersion}',
  );
  buffer.writeln('  Dart: ${Platform.version.split(' ').first}');
  buffer.writeln('  CWD: ${context.cwd}');
  buffer.writeln();

  if (description.isNotEmpty) {
    buffer.writeln('Description: $description');
    buffer.writeln();
    buffer.writeln('Bug report prepared. To submit:');
    buffer.writeln('  1. Copy this output');
    buffer.writeln(
      '  2. Open https://github.com/anthropics/neomage/issues/new',
    );
    buffer.writeln('  3. Paste and submit');
  } else {
    buffer.writeln('Usage: /bug <description of the issue>');
    buffer.writeln();
    buffer.writeln('Include steps to reproduce if possible.');
    buffer.writeln('The report will include system info automatically.');
  }

  return TextCommandResult(buffer.toString());
}