🧹 Refactor Duplicated JSON Parsing Logic - #5
Conversation
- Created src/utils/ai-parser.ts with parseAIResponse utility - Refactored DriftAgent, FactCheckAgent, IntelligentAnalyzer, cross-sync, and cleanup commands to use the new utility - Added comprehensive unit tests for the new utility - Improved robustness of JSON extraction from AI responses by supporting both objects and arrays and handling markdown formatting Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
- Created src/utils/ai-parser.ts with parseAIResponse utility - Refactored multiple agents and commands to use the new utility - Moved sqlite-vec-windows-x64 to optionalDependencies to fix CI installation failure on Linux - Added comprehensive unit tests for the new parser utility Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
- Fixed require statement errors by replacing them with proper imports - Resolved lexical declaration errors in switch-case blocks by adding braces - Fixed unnecessary escape characters in regex and prefer-const issues - Addressed any warnings by using better types or unknown - Fixed a bug in task matching regex in todolist-manager.ts - Removed unused imports and variables Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
|
@jules , ci is failing |
I've addressed the CI failures. The issues were caused by a combination of platform-specific dependency errors (EBADPLATFORM for |
- Created src/utils/ai-parser.ts with parseAIResponse utility - Refactored multiple agents and commands to use the new utility - Fixed CI platform errors by moving sqlite-vec-windows-x64 to optionalDependencies - Resolved numerous lint errors and warnings across the codebase - Fixed require statement errors, lexical declarations, and unnecessary escapes - Improved type safety and removed unused imports/variables - Corrected task matching regex in todolist-manager.ts Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
- Fixed src/cli/generate.ts compilation errors by defining SimpleContextItem interface - Corrected variable naming in generateClineMapContext - Restored settings type to Record<string, any> in src/cli/index.ts to fix property access errors - Standardized ContextItem usage across all tool-specific generator functions Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
🎯 What: Extracted duplicated JSON parsing logic into a shared utility function
parseAIResponse.💡 Why: This improves maintainability and readability by centralizing the logic for robustly parsing JSON from AI responses (handling markdown blocks and conversational text).
✅ Verification:
tests/utils/ai-parser.test.tswith comprehensive test cases.vitest.✨ Result: Reduced code duplication and improved robustness across multiple agents and CLI commands.
PR created automatically by Jules for task 17627427213899443861 started by @SireJeff