erosolar-cli 1.7.27 → 1.7.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/BrowserSessionManager.js +1 -1
- package/dist/browser/BrowserSessionManager.js.map +1 -1
- package/dist/core/agent.d.ts +3 -3
- package/dist/core/agent.d.ts.map +1 -1
- package/dist/core/agent.js +57 -4
- package/dist/core/agent.js.map +1 -1
- package/dist/core/agentRulebook.js +1 -1
- package/dist/core/agentRulebook.js.map +1 -1
- package/dist/core/contextManager.js +2 -2
- package/dist/core/contextManager.js.map +1 -1
- package/dist/core/designThoughtCheck.d.ts +196 -0
- package/dist/core/designThoughtCheck.d.ts.map +1 -0
- package/dist/core/designThoughtCheck.js +287 -0
- package/dist/core/designThoughtCheck.js.map +1 -0
- package/dist/core/designThoughtCheckEngine.d.ts +58 -0
- package/dist/core/designThoughtCheckEngine.d.ts.map +1 -0
- package/dist/core/designThoughtCheckEngine.js +358 -0
- package/dist/core/designThoughtCheckEngine.js.map +1 -0
- package/dist/core/designThoughtCheckIntegration.d.ts +103 -0
- package/dist/core/designThoughtCheckIntegration.d.ts.map +1 -0
- package/dist/core/designThoughtCheckIntegration.js +207 -0
- package/dist/core/designThoughtCheckIntegration.js.map +1 -0
- package/dist/core/isolatedVerifier.d.ts +18 -0
- package/dist/core/isolatedVerifier.d.ts.map +1 -0
- package/dist/core/isolatedVerifier.js +349 -0
- package/dist/core/isolatedVerifier.js.map +1 -0
- package/dist/core/responseVerifier.d.ts +11 -2
- package/dist/core/responseVerifier.d.ts.map +1 -1
- package/dist/core/responseVerifier.js +108 -73
- package/dist/core/responseVerifier.js.map +1 -1
- package/dist/intelligence/testGenerator.js +2 -2
- package/dist/intelligence/testGenerator.js.map +1 -1
- package/dist/providers/openaiChatCompletionsProvider.js +5 -5
- package/dist/providers/openaiChatCompletionsProvider.js.map +1 -1
- package/dist/security/active-stack-security.js +2 -2
- package/dist/security/active-stack-security.js.map +1 -1
- package/dist/shell/bracketedPasteManager.enhanced.d.ts +2 -0
- package/dist/shell/bracketedPasteManager.enhanced.d.ts.map +1 -0
- package/dist/shell/bracketedPasteManager.enhanced.js +4 -0
- package/dist/shell/bracketedPasteManager.enhanced.js.map +1 -0
- package/dist/shell/inputProcessor.js +2 -2
- package/dist/shell/inputProcessor.js.map +1 -1
- package/dist/shell/interactiveShell.d.ts +16 -2
- package/dist/shell/interactiveShell.d.ts.map +1 -1
- package/dist/shell/interactiveShell.js +81 -22
- package/dist/shell/interactiveShell.js.map +1 -1
- package/dist/tools/cloudTools.js +2 -2
- package/dist/tools/cloudTools.js.map +1 -1
- package/dist/tools/devTools.js +2 -2
- package/dist/tools/devTools.js.map +1 -1
- package/dist/tools/diffUtils.js +22 -2
- package/dist/tools/diffUtils.js.map +1 -1
- package/dist/tools/fileTools.d.ts.map +1 -1
- package/dist/tools/fileTools.js +20 -2
- package/dist/tools/fileTools.js.map +1 -1
- package/dist/tools/frontendTestingTools.js +1 -1
- package/dist/tools/frontendTestingTools.js.map +1 -1
- package/dist/tools/globTools.js +1 -1
- package/dist/tools/globTools.js.map +1 -1
- package/dist/tools/grepTools.js +1 -1
- package/dist/tools/grepTools.js.map +1 -1
- package/dist/tools/webTools.js +2 -2
- package/dist/tools/webTools.js.map +1 -1
- package/dist/ui/ShellUIAdapter.d.ts +5 -0
- package/dist/ui/ShellUIAdapter.d.ts.map +1 -1
- package/dist/ui/ShellUIAdapter.js +30 -7
- package/dist/ui/ShellUIAdapter.js.map +1 -1
- package/dist/ui/advancedTheme.js +1 -1
- package/dist/ui/advancedTheme.js.map +1 -1
- package/dist/ui/diffViewer.js +1 -1
- package/dist/ui/diffViewer.js.map +1 -1
- package/dist/ui/display.js +3 -3
- package/dist/ui/display.js.map +1 -1
- package/dist/ui/logFormatter.js +1 -1
- package/dist/ui/logFormatter.js.map +1 -1
- package/dist/ui/outputSummarizer.js +6 -7
- package/dist/ui/outputSummarizer.js.map +1 -1
- package/dist/ui/persistentPrompt.js +4 -4
- package/dist/ui/persistentPrompt.js.map +1 -1
- package/dist/ui/tableFormatter.js +4 -4
- package/dist/ui/tableFormatter.js.map +1 -1
- package/dist/ui/textHighlighter.js +2 -2
- package/dist/ui/textHighlighter.js.map +1 -1
- package/dist/ui/toolDisplay.d.ts +18 -0
- package/dist/ui/toolDisplay.d.ts.map +1 -1
- package/dist/ui/toolDisplay.js +922 -6
- package/dist/ui/toolDisplay.js.map +1 -1
- package/dist/ui/treeVisualizer.js +1 -1
- package/dist/ui/treeVisualizer.js.map +1 -1
- package/package.json +12 -3
- package/scripts/isolated-verification-runner.mjs +364 -0
- package/scripts/isolated-verification-wrapper.mjs +276 -0
package/dist/ui/toolDisplay.js
CHANGED
|
@@ -160,12 +160,12 @@ function truncatePathForDisplay(path, maxLength) {
|
|
|
160
160
|
const parts = path.split('/').filter(p => p);
|
|
161
161
|
if (parts.length <= 2) {
|
|
162
162
|
// Short path, just truncate
|
|
163
|
-
return path.slice(0, maxLength - 3)
|
|
163
|
+
return `${path.slice(0, maxLength - 3)}...`;
|
|
164
164
|
}
|
|
165
165
|
// Keep filename and truncate middle
|
|
166
166
|
const filename = parts[parts.length - 1];
|
|
167
167
|
if (!filename) {
|
|
168
|
-
return path.slice(0, maxLength - 3)
|
|
168
|
+
return `${path.slice(0, maxLength - 3)}...`;
|
|
169
169
|
}
|
|
170
170
|
const firstPart = parts.slice(0, 2).join('/');
|
|
171
171
|
if (firstPart.length + filename.length + 4 <= maxLength) {
|
|
@@ -175,7 +175,7 @@ function truncatePathForDisplay(path, maxLength) {
|
|
|
175
175
|
if (filename.length <= maxLength - 3) {
|
|
176
176
|
return `.../${filename}`;
|
|
177
177
|
}
|
|
178
|
-
return filename.slice(0, maxLength - 3)
|
|
178
|
+
return `${filename.slice(0, maxLength - 3)}...`;
|
|
179
179
|
}
|
|
180
180
|
/**
|
|
181
181
|
* Format expandable content preview
|
|
@@ -363,17 +363,17 @@ export function truncateCommand(command, maxLength = 60) {
|
|
|
363
363
|
// Try to keep command name and first few args
|
|
364
364
|
const parts = command.split(/\s+/).filter(p => p);
|
|
365
365
|
if (parts.length === 0 || !parts[0]) {
|
|
366
|
-
return command.slice(0, maxLength - 3)
|
|
366
|
+
return `${command.slice(0, maxLength - 3)}...`;
|
|
367
367
|
}
|
|
368
368
|
if (parts.length === 1) {
|
|
369
369
|
// Single long command/path
|
|
370
|
-
return command.slice(0, maxLength - 3)
|
|
370
|
+
return `${command.slice(0, maxLength - 3)}...`;
|
|
371
371
|
}
|
|
372
372
|
// Keep first part (command) and truncate rest
|
|
373
373
|
const cmdName = parts[0];
|
|
374
374
|
const rest = parts.slice(1).join(' ');
|
|
375
375
|
if (cmdName.length + 7 > maxLength) {
|
|
376
|
-
return cmdName.slice(0, maxLength - 3)
|
|
376
|
+
return `${cmdName.slice(0, maxLength - 3)}...`;
|
|
377
377
|
}
|
|
378
378
|
const availableSpace = maxLength - cmdName.length - 4; // -4 for " ..."
|
|
379
379
|
if (rest.length <= availableSpace) {
|
|
@@ -421,4 +421,920 @@ export function formatList(items, bullet = '•') {
|
|
|
421
421
|
export function formatKeyValue(key, value) {
|
|
422
422
|
return `${theme.ui.muted(key)}: ${value}`;
|
|
423
423
|
}
|
|
424
|
+
/**
|
|
425
|
+
* Format a tool result summary for display in the terminal.
|
|
426
|
+
* This is the central function for displaying ALL tool results.
|
|
427
|
+
*
|
|
428
|
+
* To add support for a new tool:
|
|
429
|
+
* 1. Add a case in the switch statement below
|
|
430
|
+
* 2. Create a format function for that tool type
|
|
431
|
+
*
|
|
432
|
+
* @returns Formatted string to display, or null if no display needed
|
|
433
|
+
*/
|
|
434
|
+
export function formatToolResultSummary(input) {
|
|
435
|
+
const { toolName, args, output, success, durationMs } = input;
|
|
436
|
+
// Determine tool category and format accordingly
|
|
437
|
+
switch (toolName) {
|
|
438
|
+
// === FILE OPERATIONS ===
|
|
439
|
+
case 'Edit':
|
|
440
|
+
case 'edit_file':
|
|
441
|
+
case 'Write':
|
|
442
|
+
case 'write_file':
|
|
443
|
+
// These already return formatted diff output from fileTools.ts
|
|
444
|
+
return output;
|
|
445
|
+
// === BASH/COMMAND EXECUTION ===
|
|
446
|
+
case 'Bash':
|
|
447
|
+
case 'bash':
|
|
448
|
+
case 'execute_bash':
|
|
449
|
+
case 'execute_bash_stream':
|
|
450
|
+
case 'execute_command':
|
|
451
|
+
return formatBashResult(args, output, success, durationMs);
|
|
452
|
+
// === BACKGROUND BASH ===
|
|
453
|
+
case 'BashOutput':
|
|
454
|
+
return formatBashOutputResult(args, output, success);
|
|
455
|
+
case 'KillShell':
|
|
456
|
+
return formatKillShellResult(args, output, success);
|
|
457
|
+
// === FILE READING ===
|
|
458
|
+
case 'Read':
|
|
459
|
+
case 'read_file':
|
|
460
|
+
return formatReadResult(args, output, success);
|
|
461
|
+
// === SEARCH OPERATIONS ===
|
|
462
|
+
case 'Grep':
|
|
463
|
+
case 'grep':
|
|
464
|
+
case 'grep_search':
|
|
465
|
+
case 'search_text':
|
|
466
|
+
case 'search_files':
|
|
467
|
+
return formatGrepResult(args, output, success);
|
|
468
|
+
case 'Glob':
|
|
469
|
+
case 'glob':
|
|
470
|
+
case 'list_files':
|
|
471
|
+
return formatGlobResult(args, output, success);
|
|
472
|
+
case 'find_definition':
|
|
473
|
+
return formatFindDefinitionResult(args, output, success);
|
|
474
|
+
// === WEB OPERATIONS ===
|
|
475
|
+
case 'WebFetch':
|
|
476
|
+
case 'web_fetch':
|
|
477
|
+
return formatWebFetchResult(args, output, success);
|
|
478
|
+
case 'WebSearch':
|
|
479
|
+
case 'web_search':
|
|
480
|
+
return formatWebSearchResult(args, output, success);
|
|
481
|
+
case 'WebExtract':
|
|
482
|
+
return formatWebExtractResult(args, output, success);
|
|
483
|
+
// === TASK/AGENT OPERATIONS ===
|
|
484
|
+
case 'Task':
|
|
485
|
+
case 'task':
|
|
486
|
+
return formatTaskResult(args, output, success);
|
|
487
|
+
// === TODO OPERATIONS ===
|
|
488
|
+
case 'TodoWrite':
|
|
489
|
+
case 'todo_write':
|
|
490
|
+
return formatTodoResult(args, output, success);
|
|
491
|
+
// === NOTEBOOK OPERATIONS ===
|
|
492
|
+
case 'NotebookEdit':
|
|
493
|
+
case 'notebook_edit':
|
|
494
|
+
return formatNotebookResult(args, output, success);
|
|
495
|
+
// === USER INTERACTION ===
|
|
496
|
+
case 'AskUserQuestion':
|
|
497
|
+
return formatAskUserResult(args, output, success);
|
|
498
|
+
// === DEV TOOLS ===
|
|
499
|
+
case 'run_tests':
|
|
500
|
+
return formatTestResult(args, output, success, durationMs);
|
|
501
|
+
case 'run_build':
|
|
502
|
+
return formatBuildResult(args, output, success, durationMs);
|
|
503
|
+
case 'install_dependencies':
|
|
504
|
+
return formatInstallResult(args, output, success, durationMs);
|
|
505
|
+
case 'check_package_info':
|
|
506
|
+
return formatPackageInfoResult(args, output, success);
|
|
507
|
+
// === GIT OPERATIONS ===
|
|
508
|
+
case 'git_release':
|
|
509
|
+
case 'git_sync':
|
|
510
|
+
case 'git_cleanup':
|
|
511
|
+
return formatGitResult(toolName, args, output, success);
|
|
512
|
+
// === DOCKER ===
|
|
513
|
+
case 'docker_build':
|
|
514
|
+
case 'docker_compose':
|
|
515
|
+
return formatDockerResult(toolName, args, output, success, durationMs);
|
|
516
|
+
// === CODE ANALYSIS ===
|
|
517
|
+
case 'analyze_code_structure':
|
|
518
|
+
case 'find_dependencies':
|
|
519
|
+
case 'check_code_complexity':
|
|
520
|
+
case 'advanced_ast_analysis':
|
|
521
|
+
case 'analyze_code_complexity':
|
|
522
|
+
case 'suggest_refactoring':
|
|
523
|
+
case 'generate_code_quality_report':
|
|
524
|
+
return formatCodeAnalysisResult(toolName, args, output, success);
|
|
525
|
+
// === TESTING TOOLS ===
|
|
526
|
+
case 'generate_test_templates':
|
|
527
|
+
case 'run_coverage_analysis':
|
|
528
|
+
case 'summarize_coverage_report':
|
|
529
|
+
case 'analyze_test_coverage':
|
|
530
|
+
case 'generate_comprehensive_tests':
|
|
531
|
+
return formatTestingToolResult(toolName, args, output, success);
|
|
532
|
+
// === LINT/QUALITY ===
|
|
533
|
+
case 'run_lint_checks':
|
|
534
|
+
case 'inspect_code_quality':
|
|
535
|
+
case 'list_lint_rules':
|
|
536
|
+
return formatLintResult(toolName, args, output, success);
|
|
537
|
+
// === CLOUD DEPLOY ===
|
|
538
|
+
case 'cloud_status':
|
|
539
|
+
case 'cloud_deploy':
|
|
540
|
+
case 'cloud_init':
|
|
541
|
+
case 'cloud_login':
|
|
542
|
+
case 'firebase_deploy':
|
|
543
|
+
case 'aliyun_deploy':
|
|
544
|
+
return formatCloudResult(toolName, args, output, success);
|
|
545
|
+
// === BROWSER AUTOMATION ===
|
|
546
|
+
case 'browser_create_session':
|
|
547
|
+
case 'browser_navigate':
|
|
548
|
+
case 'browser_click':
|
|
549
|
+
case 'browser_type':
|
|
550
|
+
case 'browser_screenshot':
|
|
551
|
+
case 'browser_close_session':
|
|
552
|
+
return formatBrowserResult(toolName, args, output, success);
|
|
553
|
+
// === EMAIL ===
|
|
554
|
+
case 'send_email':
|
|
555
|
+
case 'send_batch_emails':
|
|
556
|
+
case 'verify_email_config':
|
|
557
|
+
return formatEmailResult(toolName, args, output, success);
|
|
558
|
+
// === SKILLS ===
|
|
559
|
+
case 'ListSkills':
|
|
560
|
+
case 'Skill':
|
|
561
|
+
return formatSkillResult(toolName, args, output, success);
|
|
562
|
+
// === PLANNING ===
|
|
563
|
+
case 'ExitPlanMode':
|
|
564
|
+
return formatPlanModeResult(args, output, success);
|
|
565
|
+
// === REPO CHECKS ===
|
|
566
|
+
case 'run_repo_checks':
|
|
567
|
+
return formatRepoChecksResult(args, output, success);
|
|
568
|
+
// === LEARNING ===
|
|
569
|
+
case 'learn_codebase':
|
|
570
|
+
case 'learn_file':
|
|
571
|
+
case 'learn_topic':
|
|
572
|
+
case 'learn_summary':
|
|
573
|
+
return formatLearnResult(toolName, args, output, success);
|
|
574
|
+
// === DEFAULT: Unknown tools ===
|
|
575
|
+
default:
|
|
576
|
+
// For unknown tools, show a generic summary if output is non-empty
|
|
577
|
+
return formatGenericToolResult(toolName, output, success, durationMs);
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
/**
|
|
581
|
+
* Format Bash command result
|
|
582
|
+
* Shows: command executed, exit status, and output preview
|
|
583
|
+
*/
|
|
584
|
+
function formatBashResult(args, output, success, durationMs) {
|
|
585
|
+
const command = args['command'] || '';
|
|
586
|
+
const description = args['description'];
|
|
587
|
+
const lines = [];
|
|
588
|
+
// Header with command
|
|
589
|
+
const statusIcon = success ? theme.success('✓') : theme.error('✗');
|
|
590
|
+
const cmdDisplay = truncateCommand(command, 50);
|
|
591
|
+
const durationStr = durationMs ? ` ${theme.ui.muted(`(${formatDuration(durationMs)})`)}` : '';
|
|
592
|
+
if (description) {
|
|
593
|
+
lines.push(`${statusIcon} ${description}${durationStr}`);
|
|
594
|
+
lines.push(` ${theme.ui.muted('$')} ${theme.dim(cmdDisplay)}`);
|
|
595
|
+
}
|
|
596
|
+
else {
|
|
597
|
+
lines.push(`${statusIcon} ${theme.ui.muted('$')} ${cmdDisplay}${durationStr}`);
|
|
598
|
+
}
|
|
599
|
+
// Output preview (max 5 lines)
|
|
600
|
+
if (output && output.trim()) {
|
|
601
|
+
const outputLines = output.trim().split('\n');
|
|
602
|
+
const maxPreviewLines = 5;
|
|
603
|
+
const previewLines = outputLines.slice(0, maxPreviewLines);
|
|
604
|
+
for (const line of previewLines) {
|
|
605
|
+
// Truncate long lines
|
|
606
|
+
const truncatedLine = line.length > 80 ? `${line.slice(0, 77)}...` : line;
|
|
607
|
+
lines.push(` ${theme.dim(truncatedLine)}`);
|
|
608
|
+
}
|
|
609
|
+
if (outputLines.length > maxPreviewLines) {
|
|
610
|
+
const remaining = outputLines.length - maxPreviewLines;
|
|
611
|
+
lines.push(` ${theme.ui.muted(`... +${remaining} more line${remaining === 1 ? '' : 's'}`)}`);
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
return lines.join('\n');
|
|
615
|
+
}
|
|
616
|
+
/**
|
|
617
|
+
* Format Read file result
|
|
618
|
+
* Shows: file path and line count
|
|
619
|
+
*/
|
|
620
|
+
function formatReadResult(args, output, success) {
|
|
621
|
+
const filePath = (args['file_path'] || args['path']) || '';
|
|
622
|
+
const displayPath = truncatePathForDisplay(filePath, 50);
|
|
623
|
+
if (!success) {
|
|
624
|
+
return `${theme.error('✗')} Failed to read ${displayPath}`;
|
|
625
|
+
}
|
|
626
|
+
const lineCount = output.split('\n').length;
|
|
627
|
+
return `${theme.success('✓')} Read ${theme.info(displayPath)} ${theme.ui.muted(`(${lineCount} lines)`)}`;
|
|
628
|
+
}
|
|
629
|
+
/**
|
|
630
|
+
* Format Grep search result
|
|
631
|
+
* Shows: pattern, matches found, and file list preview
|
|
632
|
+
*/
|
|
633
|
+
function formatGrepResult(args, output, success) {
|
|
634
|
+
const pattern = args['pattern'] || '';
|
|
635
|
+
const patternDisplay = pattern.length > 30 ? `${pattern.slice(0, 27)}...` : pattern;
|
|
636
|
+
const lines = [];
|
|
637
|
+
if (!success || !output.trim()) {
|
|
638
|
+
lines.push(`${theme.warning('○')} No matches for "${patternDisplay}"`);
|
|
639
|
+
return lines.join('\n');
|
|
640
|
+
}
|
|
641
|
+
// Count matches/files
|
|
642
|
+
const outputLines = output.trim().split('\n').filter(l => l.trim());
|
|
643
|
+
const matchCount = outputLines.length;
|
|
644
|
+
lines.push(`${theme.success('✓')} Found ${theme.info(String(matchCount))} match${matchCount === 1 ? '' : 'es'} for "${patternDisplay}"`);
|
|
645
|
+
// Show first few matches
|
|
646
|
+
const maxPreview = 3;
|
|
647
|
+
for (let i = 0; i < Math.min(maxPreview, outputLines.length); i++) {
|
|
648
|
+
const line = outputLines[i] || '';
|
|
649
|
+
const truncated = line.length > 70 ? `${line.slice(0, 67)}...` : line;
|
|
650
|
+
lines.push(` ${theme.dim(truncated)}`);
|
|
651
|
+
}
|
|
652
|
+
if (matchCount > maxPreview) {
|
|
653
|
+
lines.push(` ${theme.ui.muted(`... +${matchCount - maxPreview} more`)}`);
|
|
654
|
+
}
|
|
655
|
+
return lines.join('\n');
|
|
656
|
+
}
|
|
657
|
+
/**
|
|
658
|
+
* Format Glob file search result
|
|
659
|
+
* Shows: pattern and files found
|
|
660
|
+
*/
|
|
661
|
+
function formatGlobResult(args, output, success) {
|
|
662
|
+
const pattern = args['pattern'] || '*';
|
|
663
|
+
const lines = [];
|
|
664
|
+
if (!success || !output.trim()) {
|
|
665
|
+
lines.push(`${theme.warning('○')} No files matching "${pattern}"`);
|
|
666
|
+
return lines.join('\n');
|
|
667
|
+
}
|
|
668
|
+
const files = output.trim().split('\n').filter(f => f.trim());
|
|
669
|
+
const fileCount = files.length;
|
|
670
|
+
lines.push(`${theme.success('✓')} Found ${theme.info(String(fileCount))} file${fileCount === 1 ? '' : 's'} matching "${pattern}"`);
|
|
671
|
+
// Show first few files
|
|
672
|
+
const maxPreview = 4;
|
|
673
|
+
for (let i = 0; i < Math.min(maxPreview, files.length); i++) {
|
|
674
|
+
const file = files[i] || '';
|
|
675
|
+
lines.push(` ${theme.dim(truncatePathForDisplay(file, 60))}`);
|
|
676
|
+
}
|
|
677
|
+
if (fileCount > maxPreview) {
|
|
678
|
+
lines.push(` ${theme.ui.muted(`... +${fileCount - maxPreview} more`)}`);
|
|
679
|
+
}
|
|
680
|
+
return lines.join('\n');
|
|
681
|
+
}
|
|
682
|
+
/**
|
|
683
|
+
* Format WebFetch result
|
|
684
|
+
* Shows: URL and content summary
|
|
685
|
+
*/
|
|
686
|
+
function formatWebFetchResult(args, output, success) {
|
|
687
|
+
const url = args['url'] || '';
|
|
688
|
+
let hostname = url;
|
|
689
|
+
try {
|
|
690
|
+
hostname = new URL(url).hostname;
|
|
691
|
+
}
|
|
692
|
+
catch {
|
|
693
|
+
// Keep original URL if parsing fails
|
|
694
|
+
}
|
|
695
|
+
if (!success) {
|
|
696
|
+
return `${theme.error('✗')} Failed to fetch ${hostname}`;
|
|
697
|
+
}
|
|
698
|
+
const contentLength = output.length;
|
|
699
|
+
const sizeStr = formatFileSize(contentLength);
|
|
700
|
+
return `${theme.success('✓')} Fetched ${theme.info(hostname)} ${theme.ui.muted(`(${sizeStr})`)}`;
|
|
701
|
+
}
|
|
702
|
+
/**
|
|
703
|
+
* Format WebSearch result
|
|
704
|
+
* Shows: query and result count
|
|
705
|
+
*/
|
|
706
|
+
function formatWebSearchResult(args, output, success) {
|
|
707
|
+
const query = args['query'] || '';
|
|
708
|
+
const queryDisplay = query.length > 40 ? `${query.slice(0, 37)}...` : query;
|
|
709
|
+
if (!success) {
|
|
710
|
+
return `${theme.error('✗')} Search failed for "${queryDisplay}"`;
|
|
711
|
+
}
|
|
712
|
+
// Try to count results from output
|
|
713
|
+
const resultMatches = output.match(/^\d+\./gm);
|
|
714
|
+
const resultCount = resultMatches ? resultMatches.length : 'multiple';
|
|
715
|
+
return `${theme.success('✓')} Found ${theme.info(String(resultCount))} results for "${queryDisplay}"`;
|
|
716
|
+
}
|
|
717
|
+
/**
|
|
718
|
+
* Format Task/Agent result
|
|
719
|
+
* Shows: task description and completion status
|
|
720
|
+
*/
|
|
721
|
+
function formatTaskResult(args, _output, success) {
|
|
722
|
+
const description = args['description'] || 'Task';
|
|
723
|
+
const truncatedDesc = description.length > 50 ? `${description.slice(0, 47)}...` : description;
|
|
724
|
+
if (!success) {
|
|
725
|
+
return `${theme.error('✗')} Task failed: ${truncatedDesc}`;
|
|
726
|
+
}
|
|
727
|
+
return `${theme.success('✓')} Completed: ${truncatedDesc}`;
|
|
728
|
+
}
|
|
729
|
+
/**
|
|
730
|
+
* Format TodoWrite result
|
|
731
|
+
* Shows: todo list update summary
|
|
732
|
+
*/
|
|
733
|
+
function formatTodoResult(args, _output, success) {
|
|
734
|
+
const todos = args['todos'];
|
|
735
|
+
if (!success) {
|
|
736
|
+
return `${theme.error('✗')} Failed to update todo list`;
|
|
737
|
+
}
|
|
738
|
+
if (!todos || !Array.isArray(todos)) {
|
|
739
|
+
return `${theme.success('✓')} Todo list updated`;
|
|
740
|
+
}
|
|
741
|
+
const completed = todos.filter(t => t.status === 'completed').length;
|
|
742
|
+
const inProgress = todos.filter(t => t.status === 'in_progress').length;
|
|
743
|
+
const pending = todos.filter(t => t.status === 'pending').length;
|
|
744
|
+
const parts = [`${theme.success('✓')} Todos:`];
|
|
745
|
+
if (completed > 0)
|
|
746
|
+
parts.push(theme.success(`${completed} done`));
|
|
747
|
+
if (inProgress > 0)
|
|
748
|
+
parts.push(theme.warning(`${inProgress} active`));
|
|
749
|
+
if (pending > 0)
|
|
750
|
+
parts.push(theme.dim(`${pending} pending`));
|
|
751
|
+
return parts.join(' ');
|
|
752
|
+
}
|
|
753
|
+
/**
|
|
754
|
+
* Format NotebookEdit result
|
|
755
|
+
* Shows: notebook and cell info
|
|
756
|
+
*/
|
|
757
|
+
function formatNotebookResult(args, _output, success) {
|
|
758
|
+
const notebookPath = args['notebook_path'] || '';
|
|
759
|
+
const editMode = args['edit_mode'] || 'replace';
|
|
760
|
+
const displayPath = truncatePathForDisplay(notebookPath, 40);
|
|
761
|
+
if (!success) {
|
|
762
|
+
return `${theme.error('✗')} Failed to edit notebook ${displayPath}`;
|
|
763
|
+
}
|
|
764
|
+
const action = editMode === 'insert' ? 'Inserted cell in' : editMode === 'delete' ? 'Deleted cell from' : 'Updated';
|
|
765
|
+
return `${theme.success('✓')} ${action} ${theme.info(displayPath)}`;
|
|
766
|
+
}
|
|
767
|
+
/**
|
|
768
|
+
* Format generic/unknown tool result
|
|
769
|
+
* Provides a basic summary for tools not explicitly handled
|
|
770
|
+
*/
|
|
771
|
+
function formatGenericToolResult(toolName, output, success, durationMs) {
|
|
772
|
+
const statusIcon = success ? theme.success('✓') : theme.error('✗');
|
|
773
|
+
const durationStr = durationMs ? ` ${theme.ui.muted(`(${formatDuration(durationMs)})`)}` : '';
|
|
774
|
+
if (!output || !output.trim()) {
|
|
775
|
+
return `${statusIcon} ${toolName} completed${durationStr}`;
|
|
776
|
+
}
|
|
777
|
+
const lineCount = output.split('\n').length;
|
|
778
|
+
return `${statusIcon} ${toolName} completed ${theme.ui.muted(`(${lineCount} lines)`)}${durationStr}`;
|
|
779
|
+
}
|
|
780
|
+
// ============================================================================
|
|
781
|
+
// ADDITIONAL TOOL FORMATTERS
|
|
782
|
+
// ============================================================================
|
|
783
|
+
/**
|
|
784
|
+
* Format BashOutput (background shell) result
|
|
785
|
+
*/
|
|
786
|
+
function formatBashOutputResult(args, output, success) {
|
|
787
|
+
const shellId = (args['bash_id'] || args['shell_id']) || '';
|
|
788
|
+
const lines = [];
|
|
789
|
+
if (!success) {
|
|
790
|
+
return `${theme.error('✗')} Failed to get output from shell ${shellId}`;
|
|
791
|
+
}
|
|
792
|
+
const outputLines = output.trim().split('\n').filter(l => l);
|
|
793
|
+
const lineCount = outputLines.length;
|
|
794
|
+
lines.push(`${theme.success('✓')} Shell ${theme.info(shellId)} ${theme.ui.muted(`(${lineCount} lines)`)}`);
|
|
795
|
+
// Show preview
|
|
796
|
+
const maxPreview = 3;
|
|
797
|
+
for (let i = 0; i < Math.min(maxPreview, outputLines.length); i++) {
|
|
798
|
+
const line = outputLines[i] || '';
|
|
799
|
+
const truncated = line.length > 70 ? `${line.slice(0, 67)}...` : line;
|
|
800
|
+
lines.push(` ${theme.dim(truncated)}`);
|
|
801
|
+
}
|
|
802
|
+
if (lineCount > maxPreview) {
|
|
803
|
+
lines.push(` ${theme.ui.muted(`... +${lineCount - maxPreview} more`)}`);
|
|
804
|
+
}
|
|
805
|
+
return lines.join('\n');
|
|
806
|
+
}
|
|
807
|
+
/**
|
|
808
|
+
* Format KillShell result
|
|
809
|
+
*/
|
|
810
|
+
function formatKillShellResult(args, _output, success) {
|
|
811
|
+
const shellId = (args['shell_id']) || '';
|
|
812
|
+
if (!success) {
|
|
813
|
+
return `${theme.error('✗')} Failed to kill shell ${shellId}`;
|
|
814
|
+
}
|
|
815
|
+
return `${theme.success('✓')} Killed shell ${theme.info(shellId)}`;
|
|
816
|
+
}
|
|
817
|
+
/**
|
|
818
|
+
* Format find_definition result
|
|
819
|
+
*/
|
|
820
|
+
function formatFindDefinitionResult(args, output, success) {
|
|
821
|
+
const symbol = (args['symbol'] || args['name']) || '';
|
|
822
|
+
if (!success || !output.trim()) {
|
|
823
|
+
return `${theme.warning('○')} Definition not found: ${symbol}`;
|
|
824
|
+
}
|
|
825
|
+
const locations = output.trim().split('\n').filter(l => l);
|
|
826
|
+
return `${theme.success('✓')} Found ${theme.info(String(locations.length))} definition${locations.length === 1 ? '' : 's'} for "${symbol}"`;
|
|
827
|
+
}
|
|
828
|
+
/**
|
|
829
|
+
* Format WebExtract result
|
|
830
|
+
*/
|
|
831
|
+
function formatWebExtractResult(args, output, success) {
|
|
832
|
+
const url = args['url'] || '';
|
|
833
|
+
let hostname = url;
|
|
834
|
+
try {
|
|
835
|
+
hostname = new URL(url).hostname;
|
|
836
|
+
}
|
|
837
|
+
catch {
|
|
838
|
+
// Keep original
|
|
839
|
+
}
|
|
840
|
+
if (!success) {
|
|
841
|
+
return `${theme.error('✗')} Failed to extract from ${hostname}`;
|
|
842
|
+
}
|
|
843
|
+
const contentLength = output.length;
|
|
844
|
+
return `${theme.success('✓')} Extracted from ${theme.info(hostname)} ${theme.ui.muted(`(${formatFileSize(contentLength)})`)}`;
|
|
845
|
+
}
|
|
846
|
+
/**
|
|
847
|
+
* Format AskUserQuestion result
|
|
848
|
+
*/
|
|
849
|
+
function formatAskUserResult(args, output, success) {
|
|
850
|
+
const questions = args['questions'];
|
|
851
|
+
const questionCount = questions?.length || 1;
|
|
852
|
+
if (!success) {
|
|
853
|
+
return `${theme.error('✗')} Failed to ask user`;
|
|
854
|
+
}
|
|
855
|
+
if (output.includes('answer') || output.includes('response')) {
|
|
856
|
+
return `${theme.success('✓')} User responded`;
|
|
857
|
+
}
|
|
858
|
+
return `${theme.info('?')} Asked ${questionCount} question${questionCount === 1 ? '' : 's'}`;
|
|
859
|
+
}
|
|
860
|
+
/**
|
|
861
|
+
* Format test run result
|
|
862
|
+
*/
|
|
863
|
+
function formatTestResult(args, output, success, durationMs) {
|
|
864
|
+
const testPattern = (args['pattern'] || args['filter']);
|
|
865
|
+
const lines = [];
|
|
866
|
+
const durationStr = durationMs ? ` ${theme.ui.muted(`(${formatDuration(durationMs)})`)}` : '';
|
|
867
|
+
// Try to extract test counts from output
|
|
868
|
+
const passMatch = output.match(/(\d+)\s*(?:passing|passed|✓)/i);
|
|
869
|
+
const failMatch = output.match(/(\d+)\s*(?:failing|failed|✗)/i);
|
|
870
|
+
const skipMatch = output.match(/(\d+)\s*(?:skipped|pending)/i);
|
|
871
|
+
const passed = passMatch ? parseInt(passMatch[1] || '0', 10) : 0;
|
|
872
|
+
const failed = failMatch ? parseInt(failMatch[1] || '0', 10) : 0;
|
|
873
|
+
const skipped = skipMatch ? parseInt(skipMatch[1] || '0', 10) : 0;
|
|
874
|
+
const statusIcon = success && failed === 0 ? theme.success('✓') : theme.error('✗');
|
|
875
|
+
let summary = `${statusIcon} Tests`;
|
|
876
|
+
if (testPattern) {
|
|
877
|
+
summary += ` "${testPattern}"`;
|
|
878
|
+
}
|
|
879
|
+
summary += durationStr;
|
|
880
|
+
lines.push(summary);
|
|
881
|
+
// Show counts
|
|
882
|
+
const counts = [];
|
|
883
|
+
if (passed > 0)
|
|
884
|
+
counts.push(theme.success(`${passed} passed`));
|
|
885
|
+
if (failed > 0)
|
|
886
|
+
counts.push(theme.error(`${failed} failed`));
|
|
887
|
+
if (skipped > 0)
|
|
888
|
+
counts.push(theme.warning(`${skipped} skipped`));
|
|
889
|
+
if (counts.length > 0) {
|
|
890
|
+
lines.push(` ${counts.join(', ')}`);
|
|
891
|
+
}
|
|
892
|
+
// Show first error if failed
|
|
893
|
+
if (!success && failed > 0) {
|
|
894
|
+
const errorMatch = output.match(/(?:Error|FAIL|✗).*?:(.*?)(?:\n|$)/i);
|
|
895
|
+
if (errorMatch && errorMatch[1]) {
|
|
896
|
+
const errorMsg = errorMatch[1].trim().slice(0, 60);
|
|
897
|
+
lines.push(` ${theme.error(errorMsg)}`);
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
return lines.join('\n');
|
|
901
|
+
}
|
|
902
|
+
/**
|
|
903
|
+
* Format build result
|
|
904
|
+
*/
|
|
905
|
+
function formatBuildResult(args, output, success, durationMs) {
|
|
906
|
+
const target = (args['target'] || args['script']);
|
|
907
|
+
const durationStr = durationMs ? ` ${theme.ui.muted(`(${formatDuration(durationMs)})`)}` : '';
|
|
908
|
+
if (!success) {
|
|
909
|
+
// Try to extract error count
|
|
910
|
+
const errorMatches = output.match(/error/gi);
|
|
911
|
+
const errorCount = errorMatches ? errorMatches.length : 0;
|
|
912
|
+
if (errorCount > 0) {
|
|
913
|
+
return `${theme.error('✗')} Build failed with ${errorCount} error${errorCount === 1 ? '' : 's'}${durationStr}`;
|
|
914
|
+
}
|
|
915
|
+
return `${theme.error('✗')} Build failed${durationStr}`;
|
|
916
|
+
}
|
|
917
|
+
const label = target ? `Build "${target}"` : 'Build';
|
|
918
|
+
return `${theme.success('✓')} ${label} succeeded${durationStr}`;
|
|
919
|
+
}
|
|
920
|
+
/**
|
|
921
|
+
* Format install dependencies result
|
|
922
|
+
*/
|
|
923
|
+
function formatInstallResult(args, output, success, durationMs) {
|
|
924
|
+
const packages = args['packages'];
|
|
925
|
+
const durationStr = durationMs ? ` ${theme.ui.muted(`(${formatDuration(durationMs)})`)}` : '';
|
|
926
|
+
if (!success) {
|
|
927
|
+
return `${theme.error('✗')} Install failed${durationStr}`;
|
|
928
|
+
}
|
|
929
|
+
// Try to extract package count from output
|
|
930
|
+
const addedMatch = output.match(/added\s+(\d+)\s+packages?/i);
|
|
931
|
+
const packageCount = addedMatch ? addedMatch[1] : null;
|
|
932
|
+
let summary = `${theme.success('✓')} Dependencies installed`;
|
|
933
|
+
if (packageCount) {
|
|
934
|
+
summary += ` ${theme.ui.muted(`(${packageCount} packages)`)}`;
|
|
935
|
+
}
|
|
936
|
+
else if (packages) {
|
|
937
|
+
const pkgList = Array.isArray(packages) ? packages : [packages];
|
|
938
|
+
summary += ` ${theme.ui.muted(`(${pkgList.length} packages)`)}`;
|
|
939
|
+
}
|
|
940
|
+
summary += durationStr;
|
|
941
|
+
return summary;
|
|
942
|
+
}
|
|
943
|
+
/**
|
|
944
|
+
* Format package info result
|
|
945
|
+
*/
|
|
946
|
+
function formatPackageInfoResult(args, output, success) {
|
|
947
|
+
const packageName = (args['package'] || args['name']) || '';
|
|
948
|
+
if (!success) {
|
|
949
|
+
return `${theme.error('✗')} Package info failed for ${packageName}`;
|
|
950
|
+
}
|
|
951
|
+
// Try to extract version
|
|
952
|
+
const versionMatch = output.match(/version[:\s]+["']?([^"'\s\n]+)/i);
|
|
953
|
+
const version = versionMatch ? versionMatch[1] : null;
|
|
954
|
+
if (version) {
|
|
955
|
+
return `${theme.success('✓')} ${theme.info(packageName)}@${version}`;
|
|
956
|
+
}
|
|
957
|
+
return `${theme.success('✓')} Package info: ${theme.info(packageName)}`;
|
|
958
|
+
}
|
|
959
|
+
/**
|
|
960
|
+
* Format git operation result
|
|
961
|
+
*/
|
|
962
|
+
function formatGitResult(toolName, args, output, success) {
|
|
963
|
+
const action = toolName.replace('git_', '');
|
|
964
|
+
if (!success) {
|
|
965
|
+
return `${theme.error('✗')} Git ${action} failed`;
|
|
966
|
+
}
|
|
967
|
+
switch (toolName) {
|
|
968
|
+
case 'git_release': {
|
|
969
|
+
const version = (args['version'] || args['tag']);
|
|
970
|
+
if (version) {
|
|
971
|
+
return `${theme.success('✓')} Released ${theme.info(version)}`;
|
|
972
|
+
}
|
|
973
|
+
return `${theme.success('✓')} Release created`;
|
|
974
|
+
}
|
|
975
|
+
case 'git_sync': {
|
|
976
|
+
// Try to extract ahead/behind from output
|
|
977
|
+
const aheadMatch = output.match(/(\d+)\s+commit.*ahead/i);
|
|
978
|
+
const behindMatch = output.match(/(\d+)\s+commit.*behind/i);
|
|
979
|
+
const parts = [];
|
|
980
|
+
if (aheadMatch)
|
|
981
|
+
parts.push(`${aheadMatch[1]} ahead`);
|
|
982
|
+
if (behindMatch)
|
|
983
|
+
parts.push(`${behindMatch[1]} behind`);
|
|
984
|
+
if (parts.length > 0) {
|
|
985
|
+
return `${theme.success('✓')} Synced ${theme.ui.muted(`(${parts.join(', ')})`)}`;
|
|
986
|
+
}
|
|
987
|
+
return `${theme.success('✓')} Git synced`;
|
|
988
|
+
}
|
|
989
|
+
case 'git_cleanup': {
|
|
990
|
+
const branchMatch = output.match(/deleted.*?(\d+)/i);
|
|
991
|
+
if (branchMatch) {
|
|
992
|
+
return `${theme.success('✓')} Cleaned up ${branchMatch[1]} branches`;
|
|
993
|
+
}
|
|
994
|
+
return `${theme.success('✓')} Git cleanup completed`;
|
|
995
|
+
}
|
|
996
|
+
default:
|
|
997
|
+
return `${theme.success('✓')} Git ${action} completed`;
|
|
998
|
+
}
|
|
999
|
+
}
|
|
1000
|
+
/**
|
|
1001
|
+
* Format docker result
|
|
1002
|
+
*/
|
|
1003
|
+
function formatDockerResult(toolName, args, output, success, durationMs) {
|
|
1004
|
+
const durationStr = durationMs ? ` ${theme.ui.muted(`(${formatDuration(durationMs)})`)}` : '';
|
|
1005
|
+
if (!success) {
|
|
1006
|
+
return `${theme.error('✗')} Docker ${toolName.replace('docker_', '')} failed${durationStr}`;
|
|
1007
|
+
}
|
|
1008
|
+
switch (toolName) {
|
|
1009
|
+
case 'docker_build': {
|
|
1010
|
+
const tag = (args['tag'] || args['image']);
|
|
1011
|
+
// Try to extract image ID from output
|
|
1012
|
+
const imageMatch = output.match(/(?:Successfully built|sha256:)\s*([a-f0-9]{12})/i);
|
|
1013
|
+
if (tag) {
|
|
1014
|
+
return `${theme.success('✓')} Built image ${theme.info(tag)}${durationStr}`;
|
|
1015
|
+
}
|
|
1016
|
+
if (imageMatch) {
|
|
1017
|
+
return `${theme.success('✓')} Built image ${theme.info(imageMatch[1] || '')}${durationStr}`;
|
|
1018
|
+
}
|
|
1019
|
+
return `${theme.success('✓')} Docker build completed${durationStr}`;
|
|
1020
|
+
}
|
|
1021
|
+
case 'docker_compose': {
|
|
1022
|
+
const action = (args['action'] || args['command']) || 'up';
|
|
1023
|
+
return `${theme.success('✓')} Docker compose ${action}${durationStr}`;
|
|
1024
|
+
}
|
|
1025
|
+
default:
|
|
1026
|
+
return `${theme.success('✓')} Docker operation completed${durationStr}`;
|
|
1027
|
+
}
|
|
1028
|
+
}
|
|
1029
|
+
/**
|
|
1030
|
+
* Format code analysis result
|
|
1031
|
+
*/
|
|
1032
|
+
function formatCodeAnalysisResult(toolName, args, output, success) {
|
|
1033
|
+
const filePath = (args['file_path'] || args['path'] || args['file']);
|
|
1034
|
+
const displayPath = filePath ? truncatePathForDisplay(filePath, 40) : '';
|
|
1035
|
+
if (!success) {
|
|
1036
|
+
return `${theme.error('✗')} Analysis failed${displayPath ? ` for ${displayPath}` : ''}`;
|
|
1037
|
+
}
|
|
1038
|
+
const toolLabels = {
|
|
1039
|
+
'analyze_code_structure': 'Structure analyzed',
|
|
1040
|
+
'find_dependencies': 'Dependencies found',
|
|
1041
|
+
'check_code_complexity': 'Complexity checked',
|
|
1042
|
+
'advanced_ast_analysis': 'AST analyzed',
|
|
1043
|
+
'analyze_code_complexity': 'Complexity analyzed',
|
|
1044
|
+
'suggest_refactoring': 'Refactoring suggestions',
|
|
1045
|
+
'generate_code_quality_report': 'Quality report generated',
|
|
1046
|
+
};
|
|
1047
|
+
const label = toolLabels[toolName] || 'Analysis completed';
|
|
1048
|
+
// Try to extract counts from output
|
|
1049
|
+
const issueMatch = output.match(/(\d+)\s*(?:issue|warning|suggestion)/i);
|
|
1050
|
+
if (issueMatch) {
|
|
1051
|
+
return `${theme.success('✓')} ${label}: ${issueMatch[1]} items${displayPath ? ` in ${displayPath}` : ''}`;
|
|
1052
|
+
}
|
|
1053
|
+
return `${theme.success('✓')} ${label}${displayPath ? ` for ${displayPath}` : ''}`;
|
|
1054
|
+
}
|
|
1055
|
+
/**
|
|
1056
|
+
* Format testing tool result
|
|
1057
|
+
*/
|
|
1058
|
+
function formatTestingToolResult(toolName, args, output, success) {
|
|
1059
|
+
const filePath = (args['file_path'] || args['path']);
|
|
1060
|
+
const displayPath = filePath ? truncatePathForDisplay(filePath, 40) : '';
|
|
1061
|
+
if (!success) {
|
|
1062
|
+
return `${theme.error('✗')} ${toolName.replace(/_/g, ' ')} failed`;
|
|
1063
|
+
}
|
|
1064
|
+
switch (toolName) {
|
|
1065
|
+
case 'generate_test_templates': {
|
|
1066
|
+
const countMatch = output.match(/(\d+)\s*(?:test|template)/i);
|
|
1067
|
+
if (countMatch) {
|
|
1068
|
+
return `${theme.success('✓')} Generated ${countMatch[1]} test templates`;
|
|
1069
|
+
}
|
|
1070
|
+
return `${theme.success('✓')} Test templates generated`;
|
|
1071
|
+
}
|
|
1072
|
+
case 'run_coverage_analysis':
|
|
1073
|
+
case 'summarize_coverage_report': {
|
|
1074
|
+
const coverageMatch = output.match(/(\d+(?:\.\d+)?)\s*%/);
|
|
1075
|
+
if (coverageMatch) {
|
|
1076
|
+
const pct = parseFloat(coverageMatch[1] || '0');
|
|
1077
|
+
const color = pct >= 80 ? theme.success : pct >= 60 ? theme.warning : theme.error;
|
|
1078
|
+
return `${theme.success('✓')} Coverage: ${color(`${pct}%`)}${displayPath ? ` for ${displayPath}` : ''}`;
|
|
1079
|
+
}
|
|
1080
|
+
return `${theme.success('✓')} Coverage analyzed${displayPath ? ` for ${displayPath}` : ''}`;
|
|
1081
|
+
}
|
|
1082
|
+
case 'analyze_test_coverage': {
|
|
1083
|
+
const coverageMatch = output.match(/(\d+(?:\.\d+)?)\s*%/);
|
|
1084
|
+
if (coverageMatch) {
|
|
1085
|
+
return `${theme.success('✓')} Test coverage: ${coverageMatch[1]}%`;
|
|
1086
|
+
}
|
|
1087
|
+
return `${theme.success('✓')} Test coverage analyzed`;
|
|
1088
|
+
}
|
|
1089
|
+
case 'generate_comprehensive_tests': {
|
|
1090
|
+
return `${theme.success('✓')} Comprehensive tests generated${displayPath ? ` for ${displayPath}` : ''}`;
|
|
1091
|
+
}
|
|
1092
|
+
default:
|
|
1093
|
+
return `${theme.success('✓')} Testing tool completed`;
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
1096
|
+
/**
|
|
1097
|
+
* Format lint result
|
|
1098
|
+
*/
|
|
1099
|
+
function formatLintResult(toolName, args, output, success) {
|
|
1100
|
+
const filePath = (args['file_path'] || args['path']);
|
|
1101
|
+
const displayPath = filePath ? truncatePathForDisplay(filePath, 40) : '';
|
|
1102
|
+
// Try to extract error/warning counts
|
|
1103
|
+
const errorMatch = output.match(/(\d+)\s*error/i);
|
|
1104
|
+
const warnMatch = output.match(/(\d+)\s*warning/i);
|
|
1105
|
+
const errors = errorMatch ? parseInt(errorMatch[1] || '0', 10) : 0;
|
|
1106
|
+
const warnings = warnMatch ? parseInt(warnMatch[1] || '0', 10) : 0;
|
|
1107
|
+
const statusIcon = errors === 0 ? theme.success('✓') : theme.error('✗');
|
|
1108
|
+
switch (toolName) {
|
|
1109
|
+
case 'run_lint_checks': {
|
|
1110
|
+
let summary = `${statusIcon} Lint`;
|
|
1111
|
+
if (displayPath)
|
|
1112
|
+
summary += ` ${displayPath}`;
|
|
1113
|
+
const counts = [];
|
|
1114
|
+
if (errors > 0)
|
|
1115
|
+
counts.push(theme.error(`${errors} errors`));
|
|
1116
|
+
if (warnings > 0)
|
|
1117
|
+
counts.push(theme.warning(`${warnings} warnings`));
|
|
1118
|
+
if (counts.length > 0) {
|
|
1119
|
+
summary += `: ${counts.join(', ')}`;
|
|
1120
|
+
}
|
|
1121
|
+
else if (success) {
|
|
1122
|
+
summary += ': clean';
|
|
1123
|
+
}
|
|
1124
|
+
return summary;
|
|
1125
|
+
}
|
|
1126
|
+
case 'inspect_code_quality': {
|
|
1127
|
+
return `${statusIcon} Code quality inspected${displayPath ? ` for ${displayPath}` : ''}`;
|
|
1128
|
+
}
|
|
1129
|
+
case 'list_lint_rules': {
|
|
1130
|
+
const ruleMatch = output.match(/(\d+)\s*rule/i);
|
|
1131
|
+
if (ruleMatch) {
|
|
1132
|
+
return `${theme.success('✓')} Found ${ruleMatch[1]} lint rules`;
|
|
1133
|
+
}
|
|
1134
|
+
return `${theme.success('✓')} Lint rules listed`;
|
|
1135
|
+
}
|
|
1136
|
+
default:
|
|
1137
|
+
return `${statusIcon} Lint completed`;
|
|
1138
|
+
}
|
|
1139
|
+
}
|
|
1140
|
+
/**
|
|
1141
|
+
* Format cloud deployment result
|
|
1142
|
+
*/
|
|
1143
|
+
function formatCloudResult(toolName, args, output, success) {
|
|
1144
|
+
const provider = (args['provider'] || args['platform']);
|
|
1145
|
+
if (!success) {
|
|
1146
|
+
return `${theme.error('✗')} ${toolName.replace(/_/g, ' ')} failed`;
|
|
1147
|
+
}
|
|
1148
|
+
switch (toolName) {
|
|
1149
|
+
case 'cloud_status': {
|
|
1150
|
+
return `${theme.success('✓')} Cloud status checked${provider ? ` (${provider})` : ''}`;
|
|
1151
|
+
}
|
|
1152
|
+
case 'cloud_deploy':
|
|
1153
|
+
case 'firebase_deploy':
|
|
1154
|
+
case 'aliyun_deploy': {
|
|
1155
|
+
// Try to extract URL from output
|
|
1156
|
+
const urlMatch = output.match(/https?:\/\/[^\s]+/);
|
|
1157
|
+
if (urlMatch) {
|
|
1158
|
+
return `${theme.success('✓')} Deployed to ${theme.info(urlMatch[0])}`;
|
|
1159
|
+
}
|
|
1160
|
+
return `${theme.success('✓')} Deployment successful${provider ? ` (${provider})` : ''}`;
|
|
1161
|
+
}
|
|
1162
|
+
case 'cloud_init': {
|
|
1163
|
+
return `${theme.success('✓')} Cloud project initialized${provider ? ` (${provider})` : ''}`;
|
|
1164
|
+
}
|
|
1165
|
+
case 'cloud_login': {
|
|
1166
|
+
return `${theme.success('✓')} Logged in${provider ? ` to ${provider}` : ''}`;
|
|
1167
|
+
}
|
|
1168
|
+
default:
|
|
1169
|
+
return `${theme.success('✓')} Cloud operation completed`;
|
|
1170
|
+
}
|
|
1171
|
+
}
|
|
1172
|
+
/**
|
|
1173
|
+
* Format browser automation result
|
|
1174
|
+
*/
|
|
1175
|
+
function formatBrowserResult(toolName, args, output, success) {
|
|
1176
|
+
if (!success) {
|
|
1177
|
+
return `${theme.error('✗')} Browser ${toolName.replace('browser_', '')} failed`;
|
|
1178
|
+
}
|
|
1179
|
+
switch (toolName) {
|
|
1180
|
+
case 'browser_create_session': {
|
|
1181
|
+
const sessionMatch = output.match(/session[:\s]+["']?([^"'\s\n]+)/i);
|
|
1182
|
+
if (sessionMatch) {
|
|
1183
|
+
return `${theme.success('✓')} Browser session created: ${theme.info(sessionMatch[1] || '')}`;
|
|
1184
|
+
}
|
|
1185
|
+
return `${theme.success('✓')} Browser session created`;
|
|
1186
|
+
}
|
|
1187
|
+
case 'browser_navigate': {
|
|
1188
|
+
const url = (args['url']);
|
|
1189
|
+
if (url) {
|
|
1190
|
+
try {
|
|
1191
|
+
const hostname = new URL(url).hostname;
|
|
1192
|
+
return `${theme.success('✓')} Navigated to ${theme.info(hostname)}`;
|
|
1193
|
+
}
|
|
1194
|
+
catch {
|
|
1195
|
+
return `${theme.success('✓')} Navigated to page`;
|
|
1196
|
+
}
|
|
1197
|
+
}
|
|
1198
|
+
return `${theme.success('✓')} Navigated`;
|
|
1199
|
+
}
|
|
1200
|
+
case 'browser_click': {
|
|
1201
|
+
const selector = (args['selector']);
|
|
1202
|
+
return `${theme.success('✓')} Clicked ${selector ? theme.dim(selector) : 'element'}`;
|
|
1203
|
+
}
|
|
1204
|
+
case 'browser_type': {
|
|
1205
|
+
const selector = (args['selector']);
|
|
1206
|
+
return `${theme.success('✓')} Typed text ${selector ? `in ${theme.dim(selector)}` : ''}`;
|
|
1207
|
+
}
|
|
1208
|
+
case 'browser_screenshot': {
|
|
1209
|
+
const path = (args['path'] || args['file_path']);
|
|
1210
|
+
if (path) {
|
|
1211
|
+
return `${theme.success('✓')} Screenshot saved: ${truncatePathForDisplay(path, 40)}`;
|
|
1212
|
+
}
|
|
1213
|
+
return `${theme.success('✓')} Screenshot captured`;
|
|
1214
|
+
}
|
|
1215
|
+
case 'browser_close_session': {
|
|
1216
|
+
return `${theme.success('✓')} Browser session closed`;
|
|
1217
|
+
}
|
|
1218
|
+
default:
|
|
1219
|
+
return `${theme.success('✓')} Browser action completed`;
|
|
1220
|
+
}
|
|
1221
|
+
}
|
|
1222
|
+
/**
|
|
1223
|
+
* Format email result
|
|
1224
|
+
*/
|
|
1225
|
+
function formatEmailResult(toolName, args, _output, success) {
|
|
1226
|
+
if (!success) {
|
|
1227
|
+
return `${theme.error('✗')} ${toolName.replace(/_/g, ' ')} failed`;
|
|
1228
|
+
}
|
|
1229
|
+
switch (toolName) {
|
|
1230
|
+
case 'send_email': {
|
|
1231
|
+
const to = (args['to']);
|
|
1232
|
+
const recipients = Array.isArray(to) ? to.length : (to ? 1 : 0);
|
|
1233
|
+
return `${theme.success('✓')} Email sent${recipients ? ` to ${recipients} recipient${recipients === 1 ? '' : 's'}` : ''}`;
|
|
1234
|
+
}
|
|
1235
|
+
case 'send_batch_emails': {
|
|
1236
|
+
const emails = (args['emails']);
|
|
1237
|
+
const count = emails?.length || 0;
|
|
1238
|
+
return `${theme.success('✓')} Sent ${count} email${count === 1 ? '' : 's'}`;
|
|
1239
|
+
}
|
|
1240
|
+
case 'verify_email_config': {
|
|
1241
|
+
return `${theme.success('✓')} Email config verified`;
|
|
1242
|
+
}
|
|
1243
|
+
default:
|
|
1244
|
+
return `${theme.success('✓')} Email operation completed`;
|
|
1245
|
+
}
|
|
1246
|
+
}
|
|
1247
|
+
/**
|
|
1248
|
+
* Format skill result
|
|
1249
|
+
*/
|
|
1250
|
+
function formatSkillResult(toolName, args, output, success) {
|
|
1251
|
+
if (!success) {
|
|
1252
|
+
return `${theme.error('✗')} Skill operation failed`;
|
|
1253
|
+
}
|
|
1254
|
+
switch (toolName) {
|
|
1255
|
+
case 'ListSkills': {
|
|
1256
|
+
const skillMatch = output.match(/(\d+)\s*skill/i);
|
|
1257
|
+
if (skillMatch) {
|
|
1258
|
+
return `${theme.success('✓')} Found ${skillMatch[1]} skills`;
|
|
1259
|
+
}
|
|
1260
|
+
return `${theme.success('✓')} Skills listed`;
|
|
1261
|
+
}
|
|
1262
|
+
case 'Skill': {
|
|
1263
|
+
const skillName = (args['skill'] || args['name']);
|
|
1264
|
+
if (skillName) {
|
|
1265
|
+
return `${theme.success('✓')} Skill "${skillName}" executed`;
|
|
1266
|
+
}
|
|
1267
|
+
return `${theme.success('✓')} Skill executed`;
|
|
1268
|
+
}
|
|
1269
|
+
default:
|
|
1270
|
+
return `${theme.success('✓')} Skill completed`;
|
|
1271
|
+
}
|
|
1272
|
+
}
|
|
1273
|
+
/**
|
|
1274
|
+
* Format plan mode result
|
|
1275
|
+
*/
|
|
1276
|
+
function formatPlanModeResult(_args, _output, success) {
|
|
1277
|
+
if (!success) {
|
|
1278
|
+
return `${theme.error('✗')} Failed to exit plan mode`;
|
|
1279
|
+
}
|
|
1280
|
+
return `${theme.success('✓')} Exited plan mode`;
|
|
1281
|
+
}
|
|
1282
|
+
/**
|
|
1283
|
+
* Format repo checks result
|
|
1284
|
+
*/
|
|
1285
|
+
function formatRepoChecksResult(args, output, success) {
|
|
1286
|
+
const checks = (args['checks']);
|
|
1287
|
+
const checkCount = checks?.length || 0;
|
|
1288
|
+
// Try to extract pass/fail counts
|
|
1289
|
+
const passMatch = output.match(/(\d+)\s*pass/i);
|
|
1290
|
+
const failMatch = output.match(/(\d+)\s*fail/i);
|
|
1291
|
+
const passed = passMatch ? parseInt(passMatch[1] || '0', 10) : 0;
|
|
1292
|
+
const failed = failMatch ? parseInt(failMatch[1] || '0', 10) : 0;
|
|
1293
|
+
const statusIcon = success && failed === 0 ? theme.success('✓') : theme.error('✗');
|
|
1294
|
+
if (passed > 0 || failed > 0) {
|
|
1295
|
+
const counts = [];
|
|
1296
|
+
if (passed > 0)
|
|
1297
|
+
counts.push(theme.success(`${passed} passed`));
|
|
1298
|
+
if (failed > 0)
|
|
1299
|
+
counts.push(theme.error(`${failed} failed`));
|
|
1300
|
+
return `${statusIcon} Repo checks: ${counts.join(', ')}`;
|
|
1301
|
+
}
|
|
1302
|
+
return `${statusIcon} Repo checks${checkCount > 0 ? ` (${checkCount} checks)` : ''} ${success ? 'passed' : 'failed'}`;
|
|
1303
|
+
}
|
|
1304
|
+
/**
|
|
1305
|
+
* Format learn tool result
|
|
1306
|
+
*/
|
|
1307
|
+
function formatLearnResult(toolName, args, output, success) {
|
|
1308
|
+
if (!success) {
|
|
1309
|
+
return `${theme.error('✗')} Learning failed`;
|
|
1310
|
+
}
|
|
1311
|
+
switch (toolName) {
|
|
1312
|
+
case 'learn_codebase': {
|
|
1313
|
+
const fileMatch = output.match(/(\d+)\s*file/i);
|
|
1314
|
+
if (fileMatch) {
|
|
1315
|
+
return `${theme.success('✓')} Learned codebase: ${fileMatch[1]} files analyzed`;
|
|
1316
|
+
}
|
|
1317
|
+
return `${theme.success('✓')} Codebase learned`;
|
|
1318
|
+
}
|
|
1319
|
+
case 'learn_file': {
|
|
1320
|
+
const filePath = (args['file_path'] || args['path']);
|
|
1321
|
+
if (filePath) {
|
|
1322
|
+
return `${theme.success('✓')} Learned: ${truncatePathForDisplay(filePath, 40)}`;
|
|
1323
|
+
}
|
|
1324
|
+
return `${theme.success('✓')} File learned`;
|
|
1325
|
+
}
|
|
1326
|
+
case 'learn_topic': {
|
|
1327
|
+
const topic = (args['topic']);
|
|
1328
|
+
if (topic) {
|
|
1329
|
+
return `${theme.success('✓')} Learned topic: ${topic}`;
|
|
1330
|
+
}
|
|
1331
|
+
return `${theme.success('✓')} Topic learned`;
|
|
1332
|
+
}
|
|
1333
|
+
case 'learn_summary': {
|
|
1334
|
+
return `${theme.success('✓')} Summary generated`;
|
|
1335
|
+
}
|
|
1336
|
+
default:
|
|
1337
|
+
return `${theme.success('✓')} Learning completed`;
|
|
1338
|
+
}
|
|
1339
|
+
}
|
|
424
1340
|
//# sourceMappingURL=toolDisplay.js.map
|