DEX Bot Automation v3.0
Ops automation system for managing and monitoring web properties. Runs 15+ scheduled tasks via macOS launchd (or Docker), covering site health checks, GA4 analytics, competitor tracking, SSL/domain monitoring, and daily/weekly reporting — all with Telegram push notifications.
Features
- Site Health Monitoring — every 5 min checks with alert silencing and recovery notifications
- GA4 Analytics — daily/weekly/monthly reports, real-time anomaly alerts (spike/drop detection)
- Lighthouse Audits — automated performance scoring with CSV history tracking
- Competitor Watch — sitemap diffing against competitors with false-positive filtering
- SSL & Domain Expiry — Node.js TLS-based cert checks + domain countdown
- Broken Link Scanner — weekly crawl with concurrent link validation
- Cross-Site Funnel — traffic funnel analysis across properties
- Daily/Weekly Reports — structured ops reports with strict submission standards
- Morning Briefing — consolidated daily summary pushed before standup
- Dashboard — hourly auto-generated HTML dashboard integrating 5 data sources
- Log Rotation — 7-day cleanup + 1MB truncation
v3.0 Highlights
- Security: All shell command injection vectors eliminated (
execFileSync+ args arrays, Nodetlsmodule) - Shared Modules:
lib/with state management, date utils, formatting, CSV, GA4 helpers - Testing: 54 unit tests via Vitest + ESLint + GitHub Actions CI
- Structured Logging: JSON log output with level filtering (
lib/logger.mjs) - Resilience: Retry with exponential backoff + circuit breaker pattern
- Config: Externalized to
config/default.jsonwith env var overrides - Docker: Optional containerized deployment
- TypeScript Ready:
tsconfig.jsonwithallowJsfor incremental migration
Monitored Sites
| Site | URL |
|---|---|
| 小黃書 | xhslink.com |
| 51漫畫 | 51acgs.com |
Tech Stack
- Runtime: Node.js (ESM)
- Analytics: Google Analytics Data API (
@google-analytics/data) - Google APIs:
googleapis(Gmail, Sheets, etc.) - Notifications: Telegram Bot API
- Scheduling: macOS launchd (15 plist configs in
launchd/) - AI Agents: Claude Code subagents + external AI dispatch (Gemini, Codex, OpenCode)
Project Structure
├── config/default.json # Externalized config (sites, thresholds, email)
├── config.mjs # Config loader with env var overrides
├── automation-cron.sh # Unified cron entry point for all tasks
├── ai-dispatch.sh # Multi-AI agent dispatcher (portable timeout)
├── team-dispatch.sh # Multi-agent parallel workflow
│
├── lib/ # Shared modules (v3.0)
│ ├── state.mjs # State management factory
│ ├── date.mjs # Timezone-aware date utilities
│ ├── format.mjs # Text formatting (fmtNum, pct, bar, etc.)
│ ├── csv.mjs # CSV read/write/dedup
│ ├── ga4-helpers.mjs # GA4 metric extraction helpers
│ ├── logger.mjs # Structured JSON logging
│ ├── retry.mjs # Retry with exponential backoff
│ └── circuit-breaker.mjs # Per-service circuit breaker
│
├── tests/lib/ # Unit tests (54 tests)
├── .github/workflows/ci.yml # GitHub Actions CI
├── vitest.config.mjs # Test configuration
├── eslint.config.mjs # Lint configuration
├── tsconfig.json # TypeScript (incremental migration)
├── Dockerfile # Optional container deployment
│
├── site-health.mjs # Site uptime monitoring
├── ga4-alert.mjs # Real-time GA4 anomaly detection
├── ga4-daily-report.mjs # Daily GA4 analytics report
├── ... # (15+ automation scripts)
│
├── launchd/ # macOS launchd plist configs (15 schedules)
└── .claude/agents/ # Claude Code subagent definitions
Setup
# Install dependencies
npm install
# Copy and edit environment config
cp .env.example .env
# Required: GA4 service account key (not committed)
# Place your key file as: openclaw-ga4-488308-b099b607405b.json
# Required: Telegram bot config
# Create hooks-config.json with your bot token and chat ID
# Install launchd schedules (macOS)
cp launchd/*.plist ~/Library/LaunchAgents/
launchctl load ~/Library/LaunchAgents/com.dex.*.plist
# Or run with Docker
docker compose up -d
Development
npm test # Run 54 unit tests
npm run lint # ESLint check
npm run smoke # Syntax validation for all scripts
Usage
Run any task manually via the unified entry point:
./automation-cron.sh <task-name>
Available tasks: health, ga4-alert, ga4-daily, ga4-weekly, ga4-monthly, lighthouse, competitor, ssl, morning-briefing, daily-report, ops-report, weekend-review, funnel, broken-links, dashboard, log-rotate, backup, smoke-test
AI Agent Dispatch
# Single agent
./ai-dispatch.sh <agent> "<prompt>" [timeout]
# All agents in parallel
./ai-dispatch.sh all "<prompt>"
# Smart routing
./ai-dispatch.sh best "<prompt>"
# Multi-agent code review
./team-dispatch.sh multi-review
Schedule Overview
| Schedule | Frequency | Task |
|---|---|---|
| Site Health | Weekdays every 5 min | Uptime monitoring |
| GA4 Alert | Weekdays hourly (after 09:00) | Anomaly detection |
| GA4 Daily | Weekdays 09:00 | Daily analytics |
| GA4 Weekly | Monday 09:30 | Weekly insights |
| Morning Briefing | Weekdays 09:50 | Daily summary |
| Daily Report | Weekdays 17:50 | Work report |
| Lighthouse | Weekdays 06:00 | Performance audit |
| Competitor | Weekdays 07:00 | Competitor tracking |
| SSL Check | Weekdays 08:00 | SSL/domain expiry |
| Dashboard | Hourly | HTML dashboard |
| Log Rotate | Daily 03:00 | Log cleanup |
| Broken Links | Wednesday 04:00 | Link validation |
| Funnel | Monday 10:00 | Traffic funnel |
| Ops Report | Friday 18:00 | Weekly ops summary |
| Weekend Review | Monday 08:00 | Weekend digest |
All weekday-only tasks are silenced on weekends (both at plist level and in-script skipWeekend()).
License
MIT
Release files for dex-bot-claude 3.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dex_bot_claude-3.0.0.tar.gz | 4.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dex_bot_claude-3.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.9 kB
Release files / dex_bot_claude-3.0.0.tar.gz
| Download URL | dex_bot_claude-3.0.0.tar.gz |
|---|---|
| Size | 4.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
aab23077c2df2337ce3bd75a7fb75a468c246f8480b9b7e3ca720667a06270bd
|
|
BLAKE2b-256 checksum How to use checksums |
a2b2319dc6355451b33cfa94bbb3d00a4956e62ef9ea1eada1f355654e38ace1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|
Release files / dex_bot_claude-3.0.0-py3-none-any.whl
| Download URL | dex_bot_claude-3.0.0-py3-none-any.whl |
|---|---|
| Size | 3.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ce60ffca4c459e2b6c58ad46c870be2c37dad0c6ae894611af819fff3d507505
|
|
BLAKE2b-256 checksum How to use checksums |
89f5f7a0d3bf5938d0234c571ea849f18a8e4670929af0f68009124008269c5f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|