diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 67c81fe..f189219 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -27,6 +27,9 @@ jobs: - name: Install dependencies run: npm ci + - name: Lint runtime console usage + run: npm run lint:console + - name: Build run: npm run build diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0112244..77d7843 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -20,6 +20,9 @@ jobs: - name: Install dependencies run: npm ci + + - name: Lint runtime console usage + run: npm run lint:console - name: Build run: npm run build @@ -40,6 +43,9 @@ jobs: - name: Install dependencies run: npm ci + + - name: Lint runtime console usage + run: npm run lint:console - name: Build run: npm run build diff --git a/scripts/no-console.sh b/scripts/no-console.sh index d6a380d..0c1dc82 100755 --- a/scripts/no-console.sh +++ b/scripts/no-console.sh @@ -3,25 +3,24 @@ # Runtime code should use createLogger() from src/logger.ts instead. # # Excluded: -# - CLI commands (src/cli*, onboard, setup) -- user-facing terminal output +# - CLI commands (src/cli*, src/cron/cli.ts, onboard, setup) -- user-facing terminal output # - Test files (*.test.ts, mock-*) -- test output # - banner.ts -- ASCII art display -# - whatsapp/session.ts installConsoleFilters() -- intentional console interception (Baileys noise filter) # - JSDoc examples (lines starting with ' *') set -euo pipefail -hits=$(grep -rn 'console\.\(log\|error\|warn\|info\)(' src/ --include='*.ts' \ - | grep -v '/cli' \ - | grep -v '\.test\.' \ - | grep -v 'mock-channel' \ - | grep -v 'banner\.ts' \ - | grep -v 'session\.ts.*\(originalLog\|originalError\|originalWarn\|console\.\(log\|error\|warn\) =\)' \ - | grep -v 'setup\.ts' \ - | grep -v 'onboard\.ts' \ - | grep -v 'slack-wizard\.ts' \ - | grep -v 'cron/cli\.ts' \ - | grep -v ' \* ' \ +hits=$(grep -rEn 'console\.(log|error|warn|info|debug|trace)[[:space:]]*\(' src/ --include='*.ts' \ + --exclude='*.test.ts' \ + --exclude='mock-*.ts' \ + --exclude='mock-channel.ts' \ + --exclude='banner.ts' \ + --exclude='setup.ts' \ + --exclude='onboard.ts' \ + --exclude='slack-wizard.ts' \ + --exclude='cli.ts' \ + --exclude-dir='cli' \ + | grep -Ev ':[0-9]+:[[:space:]]*\* ' \ || true) if [ -n "$hits" ]; then