Skip to content

Commit 428122c

Browse files
committed
Apply colors to terminal symbols only, not messages
1 parent dc61783 commit 428122c

1 file changed

Lines changed: 34 additions & 20 deletions

File tree

scripts/claude.mjs

Lines changed: 34 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,11 @@ function hashError(errorOutput) {
570570
.slice(0, 500)
571571

572572
// Use proper cryptographic hashing for consistent results
573-
return crypto.createHash('sha256').update(normalized).digest('hex').slice(0, 16)
573+
return crypto
574+
.createHash('sha256')
575+
.update(normalized)
576+
.digest('hex')
577+
.slice(0, 16)
574578
}
575579

576580
/**
@@ -1061,7 +1065,7 @@ async function executeParallel(tasks, workers = 3) {
10611065
}
10621066

10631067
// Parallel execution with worker limit
1064-
log.substep(` Executing ${tasks.length} tasks with ${workers} workers`)
1068+
log.substep(`🚀 Executing ${tasks.length} tasks with ${workers} workers`)
10651069
const results = []
10661070
const executing = []
10671071

@@ -2920,16 +2924,16 @@ function calculatePollDelay(status, attempt, hasActiveJobs = false) {
29202924
// If jobs are actively running, poll more frequently
29212925
if (hasActiveJobs || status === 'in_progress') {
29222926
// Start at 5s, gradually increase to 15s max
2923-
return Math.min(5000 + attempt * 2000, 15000)
2927+
return Math.min(5000 + attempt * 2000, 15_000)
29242928
}
29252929

29262930
// If queued or waiting, use longer intervals (30s)
29272931
if (status === 'queued' || status === 'waiting') {
2928-
return 30000
2932+
return 30_000
29292933
}
29302934

29312935
// Default: moderate polling for unknown states (10s)
2932-
return 10000
2936+
return 10_000
29332937
}
29342938

29352939
/**
@@ -2991,24 +2995,26 @@ async function validateBeforePush(cwd) {
29912995

29922996
// Check 1: No console.log statements
29932997
if (diff.match(/^\+.*console\.log\(/m)) {
2994-
warnings.push('⚠️ Added console.log() statements detected')
2998+
warnings.push(
2999+
`${colors.yellow('⚠')} Added console.log() statements detected`,
3000+
)
29953001
}
29963002

29973003
// Check 2: No .only in tests
29983004
if (diff.match(/^\+.*\.(only|skip)\(/m)) {
2999-
warnings.push('⚠️ Test .only() or .skip() detected')
3005+
warnings.push(`${colors.yellow('⚠')} Test .only() or .skip() detected`)
30003006
}
30013007

30023008
// Check 3: No debugger statements
30033009
if (diff.match(/^\+.*debugger[;\s]/m)) {
3004-
warnings.push('⚠️ Debugger statement detected')
3010+
warnings.push(`${colors.yellow('⚠')} Debugger statement detected`)
30053011
}
30063012

30073013
// Check 4: No TODO/FIXME without issue link
30083014
const todoMatches = diff.match(/^\+.*\/\/\s*(TODO|FIXME)(?!\s*\(#\d+\))/gim)
30093015
if (todoMatches && todoMatches.length > 0) {
30103016
warnings.push(
3011-
`⚠️ ${todoMatches.length} TODO/FIXME comment(s) without issue links`,
3017+
`${colors.yellow('⚠')} ${todoMatches.length} TODO/FIXME comment(s) without issue links`,
30123018
)
30133019
}
30143020

@@ -3019,7 +3025,7 @@ async function validateBeforePush(cwd) {
30193025
const pkgContent = await fs.readFile(pkgPath, 'utf8')
30203026
JSON.parse(pkgContent)
30213027
} catch (e) {
3022-
warnings.push(`⚠️ Invalid package.json: ${e.message}`)
3028+
warnings.push(`${colors.yellow('⚠')} Invalid package.json: ${e.message}`)
30233029
}
30243030
}
30253031

@@ -3290,7 +3296,9 @@ Let's work through this together to get CI passing.`
32903296
const validation = await validateBeforePush(rootPath)
32913297
if (!validation.valid) {
32923298
log.warn('Pre-push validation warnings:')
3293-
validation.warnings.forEach(warning => log.substep(warning))
3299+
validation.warnings.forEach(warning => {
3300+
log.substep(warning)
3301+
})
32943302
log.substep('Continuing with push (warnings are non-blocking)...')
32953303
}
32963304

@@ -3501,8 +3509,10 @@ Let's work through this together to get CI passing.`
35013509

35023510
if (!matchingRun) {
35033511
// Use moderate delay when no run found yet (10s)
3504-
const delay = 10000
3505-
log.substep(`No matching workflow runs found yet, waiting ${delay / 1000}s...`)
3512+
const delay = 10_000
3513+
log.substep(
3514+
`No matching workflow runs found yet, waiting ${delay / 1000}s...`,
3515+
)
35063516
await new Promise(resolve => setTimeout(resolve, delay))
35073517
pollAttempt++
35083518
continue
@@ -3778,7 +3788,9 @@ Fix all issues by making necessary file changes. Be direct, don't ask questions.
37783788
const validation = await validateBeforePush(rootPath)
37793789
if (!validation.valid) {
37803790
log.warn('Pre-commit validation warnings:')
3781-
validation.warnings.forEach(warning => log.substep(warning))
3791+
validation.warnings.forEach(warning => {
3792+
log.substep(warning)
3793+
})
37823794
}
37833795

37843796
// Commit with generated message
@@ -3890,7 +3902,7 @@ Fix all issues by making necessary file changes. Be direct, don't ask questions.
38903902

38913903
// Fix each failed job immediately
38923904
for (const job of sortedFailures) {
3893-
log.substep(` ${job.name}: ${job.conclusion}`)
3905+
log.substep(`${colors.red('✗')} ${job.name}: ${job.conclusion}`)
38943906

38953907
// Fetch logs for this specific failed job using job ID
38963908
log.progress(`Fetching logs for ${job.name}`)
@@ -4093,7 +4105,9 @@ Fix the issue by making necessary file changes. Be direct, don't ask questions.`
40934105
const validation = await validateBeforePush(rootPath)
40944106
if (!validation.valid) {
40954107
log.warn('Pre-commit validation warnings:')
4096-
validation.warnings.forEach(warning => log.substep(warning))
4108+
validation.warnings.forEach(warning => {
4109+
log.substep(warning)
4110+
})
40974111
}
40984112

40994113
// Commit with generated message
@@ -4157,7 +4171,7 @@ async function runWatchMode(claudeCmd, options = {}) {
41574171
const opts = { __proto__: null, ...options }
41584172
printHeader('Watch Mode - Continuous Monitoring')
41594173

4160-
log.info('👁️ Starting continuous monitoring...')
4174+
log.info('Starting continuous monitoring...')
41614175
log.substep('Press Ctrl+C to stop')
41624176

41634177
const _watchPath = !opts['cross-repo'] ? rootPath : parentPath
@@ -4614,13 +4628,13 @@ async function main() {
46144628

46154629
// Display execution mode
46164630
if (executionMode.workers > 1) {
4617-
log.substep(` Parallel mode: ${executionMode.workers} workers`)
4631+
log.substep(`🚀 Parallel mode: ${executionMode.workers} workers`)
46184632
}
46194633
if (executionMode.watch) {
4620-
log.substep('👁️ Watch mode: Continuous monitoring enabled')
4634+
log.substep('Watch mode: Continuous monitoring enabled')
46214635
}
46224636
if (!executionMode.autoFix) {
4623-
log.substep('💬 Prompt mode: Fixes require approval')
4637+
log.substep('Prompt mode: Fixes require approval')
46244638
}
46254639

46264640
// Execute requested operation.

0 commit comments

Comments
 (0)