Documentation
DocumentationInputs

Inputs

You can set pre-defined inputs to be provided by the user for each command. There are various kinds of input available - String, Code, (more coming soon).

String Input

StringInput is a class that represents a string input field in the text field. It allows users to provide a string value as input to the agent.

class StringInput extends DashInput {
  StringInput(super.displayText, {super.optional});
}
  • displayText: Provides a hint to the user on what input to add.
  • optional: Marks the input as optional. If set to true, "NA" will be appended in steps if no value is provided by the user.

Example usage:

final userQuery = StringInput('Your query');
final additionalInstructions = StringInput('Additional Instructions', optional: true);
 
@override
List<DashInput> get registerInputs => [userQuery, additionalInstructions];

Code Input

CodeInput is a class that represents a code input field in the text field. It allows users to attach code snippets of any programming language from within their workspace.

class CodeInput extends DashInput {
  CodeInput(super.displayText, {super.optional, this.includeContextualCode = true});
 
  final bool includeContextualCode;
}
  • displayText: Provides a hint to the user on the kind of code snippet to attach.
  • optional: Marks the input as optional. If set to true, "NA" will be appended in steps if no code snippet is added by the user.
  • includeContextualCode: If set to true, it extracts the nested code objects and matching code files from the codebase.

Example usage:

final testMethod = CodeInput('Test Method');
final reference1 = CodeInput('Existing Reference', optional: true);
final reference2 = CodeInput('Existing Reference', optional: true);
final reference3 = CodeInput('Existing Reference', optional: true);
 
@override
List<DashInput> get registerInputs => [testMethod, reference1, reference2, reference3];

Text Field Layout

Requested inputs appear in the text field in the Dash Panel.

class UnitCommand extends Command {
 
  /// Inputs
  final codeAttachment = CodeInput('Test Code', optional: false);
  final extraDetails = StringInput('Instructions', optional: true);
  final reference1 =
      CodeInput('Existing Test', optional: true, includeContextualCode: false);
 
  @override
  String get textFieldLayout =>
      "To generate unit test, please provide: $codeAttachment $extraDetails \n\n A matching existing test [Optional]: $reference1";
 
  @override
  List<DashInput> get registerInputs =>
      [extraDetails, codeAttachment, reference1];
}
Code and String inputs to generate unit tests
Code and String inputs to generate unit tests

Advanced Note: Inputs are special variables used in other steps by string interpolating them, for example: 'This is the $userQuery'. The actual value of the variable will be automatically inserted by the framework.