mirror of
https://github.com/cexll/myclaude.git
synced 2026-02-05 02:30:26 +08:00
This commit addresses the remaining Minor issues from PR #94 code review: Minor #12: Unicode Symbol Compatibility - Added CODEAGENT_ASCII_MODE environment variable support - When set to "true", uses ASCII symbols: PASS/WARN/FAIL - Default behavior (unset or "false"): Unicode symbols ✓/⚠️/✗ - Updated help text to document the environment variable - Added tests for both ASCII and Unicode modes Implementation: - executor.go:514: New getStatusSymbols() function - executor.go:531: Dynamic symbol selection in generateFinalOutputWithMode - main.go:34: useASCIIMode variable declaration - main.go:495: Environment variable documentation in help - executor_concurrent_test.go:292: Tests for ASCII mode - main_integration_test.go:89: Parser updated for both symbol formats Minor #13: Performance Optimization - Reduce Repeated String Operations - Optimized Message parsing to split only once per task result - Added *FromLines() variants of all extractor functions - Original extract*() functions now wrap *FromLines() for compatibility - Reduces memory allocations and CPU usage in parallel execution Implementation: - utils.go:300: extractCoverageFromLines() - utils.go:390: extractFilesChangedFromLines() - utils.go:455: extractTestResultsFromLines() - utils.go:551: extractKeyOutputFromLines() - main.go:255: Single split with reuse: lines := strings.Split(...) Backward Compatibility: - All original extract*() functions preserved - Tests updated to handle both symbol formats - No breaking changes to public API Test Results: - All tests pass: go test ./... (40.164s) - ASCII mode verified: PASS/WARN/FAIL symbols display correctly - Unicode mode verified: ✓/⚠️/✗ symbols remain default - Performance: Single split per Message instead of 4+ Usage Examples: # Unicode mode (default) ./codeagent-wrapper --parallel < tasks.txt # ASCII mode (for terminals without Unicode support) CODEAGENT_ASCII_MODE=true ./codeagent-wrapper --parallel < tasks.txt Benefits: - Improved terminal compatibility across different environments - Reduced memory allocations in parallel execution - Better performance for large-scale parallel tasks - User choice between Unicode aesthetics and ASCII compatibility Related: #94 Generated with SWE-Agent.ai Co-Authored-By: SWE-Agent.ai <noreply@swe-agent.ai>
This commit is contained in:
@@ -31,6 +31,8 @@ const (
|
||||
stdoutDrainTimeout = 100 * time.Millisecond
|
||||
)
|
||||
|
||||
var useASCIIMode = os.Getenv("CODEAGENT_ASCII_MODE") == "true"
|
||||
|
||||
// Test hooks for dependency injection
|
||||
var (
|
||||
stdinReader io.Reader = os.Stdin
|
||||
@@ -257,18 +259,20 @@ func run() (exitCode int) {
|
||||
continue
|
||||
}
|
||||
|
||||
lines := strings.Split(results[i].Message, "\n")
|
||||
|
||||
// Coverage extraction
|
||||
results[i].Coverage = extractCoverage(results[i].Message)
|
||||
results[i].Coverage = extractCoverageFromLines(lines)
|
||||
results[i].CoverageNum = extractCoverageNum(results[i].Coverage)
|
||||
|
||||
// Files changed
|
||||
results[i].FilesChanged = extractFilesChanged(results[i].Message)
|
||||
results[i].FilesChanged = extractFilesChangedFromLines(lines)
|
||||
|
||||
// Test results
|
||||
results[i].TestsPassed, results[i].TestsFailed = extractTestResults(results[i].Message)
|
||||
results[i].TestsPassed, results[i].TestsFailed = extractTestResultsFromLines(lines)
|
||||
|
||||
// Key output summary
|
||||
results[i].KeyOutput = extractKeyOutput(results[i].Message, 150)
|
||||
results[i].KeyOutput = extractKeyOutputFromLines(lines, 150)
|
||||
}
|
||||
|
||||
// Default: summary mode (context-efficient)
|
||||
@@ -487,7 +491,8 @@ Parallel mode examples:
|
||||
%[1]s --parallel <<'EOF'
|
||||
|
||||
Environment Variables:
|
||||
CODEX_TIMEOUT Timeout in milliseconds (default: 7200000)
|
||||
CODEX_TIMEOUT Timeout in milliseconds (default: 7200000)
|
||||
CODEAGENT_ASCII_MODE Use ASCII symbols instead of Unicode (PASS/WARN/FAIL)
|
||||
|
||||
Exit Codes:
|
||||
0 Success
|
||||
|
||||
Reference in New Issue
Block a user