Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ jobs:
run: npm run security-check
- name: Run linter
run: npm run lint
- name: Console.* guard — block new console.log/warn/error in src/
run: bash scripts/console-guard.sh
feat-minor-bump-gate:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
Expand Down
6 changes: 1 addition & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,25 +57,20 @@ docs/superpowers/
.omc/
competitors/
_competitors/

# Ad-hoc analysis/report artifacts (not published)
docs/*-analysis-20??-??-??.md
docs/*-report-20??-??-??.md
*-analysis-20??-??-??.md
*-report-20??-??-??.md

# TypeDoc API reference (generated, served via GitHub Pages)
docs/api/
keys.env
tracked.txt

# Dashboard icon audit output (reporter, regenerated on demand)
scripts/dashboard-icons-audit.current.txt

# Local memory / vibe files and release tarballs
memory/
*.tgz

# Test artifacts (leaked in 996feb8)
/.test-scratch/
playwright-report/
Expand All @@ -85,3 +80,4 @@ coverage/
wt-last-updated
wt-i18n-sessionboard
node_modules
aegis
39 changes: 39 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,54 @@ export default [
],
},
},
// no-console: error for production src/ — existing violators are excluded so CI stays green.
// Goal: shrink this list over time by migrating to StructuredLogger.
{
files: ['src/**/*.ts'],
ignores: [
'src/__tests__/**',
// Core infra — logger, CLI, startup bootstrap
'src/cli.ts',
'src/logger.ts',
'src/startup.ts',
'src/suppress.ts',
'src/tracing.ts',
// Hooks & permissions
'src/hooks.ts',
'src/hook.ts',
'src/permission-guard.ts',
'src/permission-request-manager.ts',
// Sessions
'src/session.ts',
'src/session-discovery.ts',
'src/session-transcripts.ts',
// ACP
'src/services/acp/backend.ts',
'src/services/auth/AuthManager.ts',
'src/services/state/JsonFileStore.ts',
// Channels
'src/channels/email.ts',
'src/channels/manager.ts',
'src/channels/slack.ts',
'src/channels/telegram.ts',
'src/channels/webhook.ts',
// Server & config
'src/server.ts',
'src/config.ts',
'src/events.ts',
// Memory & learnings
'src/memory-bridge-learning.ts',
'src/memory-bridge.ts',
'src/structured-learnings.ts',
// Misc
'src/file-utils.ts',
'src/jsonl-watcher.ts',
'src/mcp/server.ts',
'src/question-manager.ts',
'src/signal-cleanup-helper.ts',
'src/template-store.ts',
'src/transcript.ts',
'src/webhook/verify.ts',
],
rules: {
'no-console': 'error',
Expand Down
44 changes: 44 additions & 0 deletions scripts/console-guard.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/usr/bin/env bash
# console-guard.sh — CI guard: fail if production src/ adds new console.* calls
# Existing exceptions are tracked in eslint.config.js ignores.
# This script provides a second layer: a baseline count that must not increase.
set -euo pipefail

cd "$(git rev-parse --show-toplevel 2>/dev/null || echo .)"

# Count console.* calls in non-test src/ (excluding comments)
VIOLATIONS=$(grep -rn "console\.\(log\|warn\|error\)" src/ --include="*.ts" \
| grep -v "node_modules" \
| grep -v "__tests__" \
| grep -v "^\s*//" \
| grep -v "^\s*\*" \
| wc -l)

BASELINE=165

echo "Console.* violations in src/: ${VIOLATIONS}"
echo "Baseline: ${BASELINE}"

if [ "$VIOLATIONS" -gt "$BASELINE" ]; then
DIFF=$((VIOLATIONS - BASELINE))
echo ""
echo "❌ FAIL: ${DIFF} new console.* call(s) detected in production code."
echo " Use StructuredLogger instead, or add the file to eslint.config.js ignores."
echo ""
echo "New violations:"
grep -rn "console\.\(log\|warn\|error\)" src/ --include="*.ts" \
| grep -v "node_modules" \
| grep -v "__tests__" \
| grep -v "^\s*//" \
| grep -v "^\s*\*" \
| head -20
exit 1
fi

if [ "$VIOLATIONS" -lt "$BASELINE" ]; then
DIFF=$((BASELINE - VIOLATIONS))
echo "✅ PASS: ${DIFF} violation(s) removed since baseline — consider updating BASELINE in this script."
fi

echo "✅ PASS: No new console.* violations."
exit 0
Loading