utils/input/process_user_input library
Classes
- CommandReference
- Slash command reference.
- ConversationContext
- Extract key entities from a conversation for context.
- FileMention
- @-mention of a file or directory.
- GitRefMention
- @-mention of a git ref (branch, commit, tag).
- InputHistory
- Input history management.
- InputSegment
- Types of user input segments.
- MentionSuggestion
- Autocomplete suggestion for @-mentions.
- ParsedUserInput
- Parsed user input.
- TextSegment
- Plain text segment.
- UrlMention
- @-mention of a URL.
Enums
Constants
-
knownCommands
→ const List<
String> - Known command names for autocomplete.
Properties
- fileMentionPattern → RegExp
-
Pattern for file mentions: @path/to/file or @./relative/path
final
- gitRefPattern → RegExp
-
Pattern for git ref mentions: @branch:name or @commit:hash
final
- urlMentionPattern → RegExp
-
Pattern for URL mentions: @https://... or @http://...
final
Functions
-
buildContext(
List< String> userMessages) → ConversationContext - Build context from conversation history.
-
checkInputSafety(
String input) → List< String> - Check for potentially harmful input patterns.
-
containsCodeBlock(
String input) → bool - Detect if input contains code blocks.
-
detectImplicitFileReferences(
String input) → List< String> - Detect if input is asking about a specific file.
-
detectLanguage(
String input) → String? - Detect programming language from input content.
-
extractCodeBlocks(
String input) → List< ({String code, String language})> - Extract code blocks from input.
-
getCompletions(
String partial, {required String workingDirectory, int maxResults = 20}) → Future< List< MentionSuggestion> > - Generate autocomplete suggestions for a partial @-mention.
-
isSlashCommand(
String input) → bool - Check if input is a slash command.
-
looksLikeFilePath(
String input) → bool - Check if a string looks like a file path.
-
normalizeInput(
String input) → String - Strip leading/trailing whitespace and normalize newlines.
-
parseSlashCommand(
String input) → ({String args, String command})? - Parse a slash command.
-
parseUserInput(
String input, {String? workingDirectory}) → ParsedUserInput - Parse user input into structured segments.
-
resolveFilePath(
String mention, String workingDirectory) → String - Resolve a file mention to an absolute path.
-
validateInputLength(
String input, {int maxChars = 100000, int maxLines = 10000}) → String? - Check if input exceeds length limits.