← back to Daily Reporting
initial scaffold (relocated from ~/.claude/skills/)
d062744adf2f24d76abfeeee2e645fb28fb44e41 · 2026-05-06 14:36:08 -0700 · Steve
Files touched
A .gitignoreA HIERARCHY-DIAGRAM.mdA INSTALLATION-COMPLETE.mdA QUICK-START.mdA README.mdA SLACK-SETUP-GUIDE.mdA agent-hierarchy.tsA daily-report-runner.tsA package-lock.jsonA package.jsonA report-generator.tsA send-report-to-steve.shA setup-cron.shA skill.jsonA slack-formatter.tsA slack-notifier.tsA tsconfig.json
Diff
commit d062744adf2f24d76abfeeee2e645fb28fb44e41
Author: Steve <steve@designerwallcoverings.com>
Date: Wed May 6 14:36:08 2026 -0700
initial scaffold (relocated from ~/.claude/skills/)
---
.gitignore | 8 +
HIERARCHY-DIAGRAM.md | 440 +++++++++++++++++++++++
INSTALLATION-COMPLETE.md | 494 +++++++++++++++++++++++++
QUICK-START.md | 354 ++++++++++++++++++
README.md | 410 +++++++++++++++++++++
SLACK-SETUP-GUIDE.md | 472 ++++++++++++++++++++++++
agent-hierarchy.ts | 333 +++++++++++++++++
daily-report-runner.ts | 201 +++++++++++
package-lock.json | 913 +++++++++++++++++++++++++++++++++++++++++++++++
package.json | 36 ++
report-generator.ts | 335 +++++++++++++++++
send-report-to-steve.sh | 123 +++++++
setup-cron.sh | 173 +++++++++
skill.json | 34 ++
slack-formatter.ts | 295 +++++++++++++++
slack-notifier.ts | 177 +++++++++
tsconfig.json | 26 ++
17 files changed, 4824 insertions(+)
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..1924158
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,8 @@
+node_modules/
+.env*
+tmp/
+*.log
+.DS_Store
+dist/
+build/
+.next/
diff --git a/HIERARCHY-DIAGRAM.md b/HIERARCHY-DIAGRAM.md
new file mode 100644
index 0000000..4f14947
--- /dev/null
+++ b/HIERARCHY-DIAGRAM.md
@@ -0,0 +1,440 @@
+# DW-Agents Organizational Hierarchy
+
+Visual representation of the complete agent reporting structure.
+
+```
+ ┌─────────────────────────────────────┐
+ │ 👔 MASTER HUB (PRESIDENT) │
+ │ Port: 9893 │
+ │ Central Command & Coordination │
+ └─────────────────────────────────────┘
+ │
+ ┌───────────────────────────┼───────────────────────────┐
+ │ │ │
+ ┌─────▼─────┐ ┌─────▼─────┐ ┌─────▼─────┐
+ │ EXECUTIVE │ │ DEPARTMENT │ │ SUPPORT │
+ │ LEVEL │ │ HEADS │ │ SERVICES │
+ └───────────┘ └─────┬─────┘ └─────┬─────┘
+ │ │
+ ┌─────────────────┼─────────────────┐ │
+ │ │ │ │
+ ┌──────▼──────┐ ┌─────▼──────┐ ┌─────▼──────┐ │
+ │ OPERATIONS │ │ FINANCE & │ │ CUSTOMER │ │
+ │ │ │ LEGAL │ │ ENGAGEMENT │ │
+ └──────────────┘ └────────────┘ └────────────┘ │
+ │
+ ┌─────────────────────────────────────────────┘
+ │
+ ┌─────────┼─────────────────┬──────────────┐
+ │ │ │ │
+ ┌─────▼─────┐ │ ┌──────▼──────┐ ┌───▼────────┐
+ │ IT │ │ │ PRODUCT │ │ OTHER │
+ │ OPERATIONS│ │ │ & DESIGN │ │ SERVICES │
+ └───────────┘ │ └─────────────┘ └────────────┘
+ │
+```
+
+## EXECUTIVE LEVEL
+
+```
+👔 MASTER HUB (President)
+├─ Port: 9893
+├─ Role: Central Command & Coordination
+├─ Department: Executive
+└─ Metrics:
+ ├─ Total agents online
+ ├─ System health score
+ ├─ Critical alerts
+ └─ Daily task completion rate
+```
+
+## DEPARTMENT HEADS
+
+### Legal & Compliance
+```
+⚖️ LEGAL TEAM
+├─ Port: 9878
+├─ Reports to: Master Hub
+├─ Department: Legal
+└─ Metrics:
+ ├─ Settlement compliance checks
+ ├─ Contract reviews completed
+ ├─ Legal issues flagged
+ └─ Compliance score
+```
+
+### Finance
+```
+💰 ACCOUNTING
+├─ Port: 9882
+├─ Reports to: Master Hub
+├─ Department: Finance
+└─ Metrics:
+ ├─ Daily revenue
+ ├─ Expenses tracked
+ ├─ P&L accuracy
+ ├─ Budget variance
+ └─ Outstanding invoices
+```
+
+### Marketing
+```
+📢 MARKETING
+├─ Port: 9881
+├─ Reports to: Master Hub
+├─ Department: Marketing
+└─ Metrics:
+ ├─ Blog posts published
+ ├─ Social media engagement
+ ├─ Email campaigns sent
+ ├─ Lead generation
+ └─ Campaign ROI
+```
+
+### Operations - Procurement
+```
+🛒 PURCHASING OFFICE
+├─ Port: 9880
+├─ Reports to: Master Hub
+├─ Department: Operations
+└─ Metrics:
+ ├─ Orders placed
+ ├─ Cost savings identified
+ ├─ Vendor response time
+ ├─ Inventory alerts
+ └─ Price comparisons run
+```
+
+### Operations - Sample Processing
+```
+📦 DIGITAL SAMPLES
+├─ Port: 9879
+├─ Reports to: Master Hub
+├─ Department: Operations
+└─ Metrics:
+ ├─ DIG-series orders processed
+ ├─ Files delivered
+ ├─ Processing time avg
+ ├─ Customer satisfaction
+ └─ Pending requests
+```
+
+### Strategy
+```
+📊 TREND RESEARCH
+├─ Port: 9883
+├─ Reports to: Master Hub
+├─ Department: Strategy
+└─ Metrics:
+ ├─ Trends identified
+ ├─ Market reports generated
+ ├─ Competitor analysis
+ └─ Forecast accuracy
+```
+
+## SUPPORT SERVICES
+
+### Customer Service
+```
+💬 ZENDESK CHAT
+├─ Port: 9884
+├─ Reports to: Master Hub
+├─ Department: Customer Service
+└─ Metrics:
+ ├─ Tickets handled
+ ├─ Response time avg
+ ├─ Customer satisfaction
+ ├─ Open tickets
+ └─ Chat sessions
+```
+
+### Sales
+```
+🛍️ SHOPIFY STORE MANAGER
+├─ Port: 7238
+├─ Reports to: Master Hub
+├─ Department: Sales
+└─ Metrics:
+ ├─ Orders processed
+ ├─ Inventory sync status
+ ├─ Product updates
+ └─ Store health score
+```
+
+### IT Operations
+```
+🖥️ SERVER UPTIME MONITOR
+├─ Port: 7242
+├─ Reports to: Master Hub
+├─ Department: IT Operations
+└─ Metrics:
+ ├─ Server uptime %
+ ├─ Response times
+ ├─ Resource usage
+ └─ Incidents detected
+
+📝 LOG MONITOR
+├─ Port: 7239
+├─ Reports to: Master Hub
+├─ Department: IT Operations
+└─ Metrics:
+ ├─ Errors detected
+ ├─ Critical issues
+ ├─ Auto-resolved
+ └─ Logs analyzed
+
+🔄 RESTART ANALYZER
+├─ Port: 7241
+├─ Reports to: Master Hub
+├─ Department: IT Operations
+└─ Metrics:
+ ├─ Restart patterns detected
+ ├─ Agent health scores
+ ├─ Stability metrics
+ └─ Recommendations
+```
+
+### Product & Design
+```
+🎨 UI MANAGER
+├─ Port: 7240
+├─ Reports to: Master Hub
+├─ Department: Product
+└─ Metrics:
+ ├─ UI consistency score
+ ├─ Theme updates
+ ├─ User feedback
+ └─ Accessibility score
+```
+
+## OPERATIONS & ORCHESTRATION
+
+```
+🎯 TASK ORCHESTRATOR
+├─ Port: 9900
+├─ Reports to: Master Hub
+├─ Department: Operations
+└─ Metrics:
+ ├─ Tasks routed
+ ├─ Completion rate
+ ├─ Agent utilization
+ └─ Queue depth
+
+⚠️ NEEDS ATTENTION
+├─ Port: 7243
+├─ Reports to: Master Hub
+├─ Department: Operations
+└─ Metrics:
+ ├─ Issues flagged
+ ├─ Escalations
+ ├─ Resolution time
+ └─ Priority distribution
+```
+
+## REPORTING FLOW
+
+```
+┌─────────────────────────────────────────────────────────────────┐
+│ 6:00 AM - Morning Standup Report │
+└─────────────────────────────────────────────────────────────────┘
+ │
+ ├──► 1. Collect metrics from all agents (parallel)
+ │
+ ├──► 2. Generate Executive Summary
+ │ └─ System health, tasks completed, critical issues
+ │
+ ├──► 3. Generate Department Reports
+ │ ├─ Executive Level
+ │ ├─ Department Heads (Legal, Finance, Marketing, etc.)
+ │ ├─ Support Services (Customer Service, IT, Product)
+ │ └─ Operations & Orchestration
+ │
+ ├──► 4. Identify Issues Requiring Attention
+ │ ├─ Critical: Offline agents, system failures
+ │ ├─ High: Error rates, performance issues
+ │ ├─ Medium: Degraded performance
+ │ └─ Low: Minor warnings
+ │
+ ├──► 5. Generate Action Items
+ │ └─ Prioritized next steps
+ │
+ ├──► 6. Calculate Q&A Readiness
+ │ └─ Agent status and recent activities
+ │
+ ├──► 7. Format for Slack
+ │ └─ Clean markdown with health bars and emojis
+ │
+ └──► 8. Send to #morning-report channel
+ └─ @channel mention if critical issues
+
+┌─────────────────────────────────────────────────────────────────┐
+│ 5:00 PM - End-of-Day Summary │
+└─────────────────────────────────────────────────────────────────┘
+ │
+ └──► Same process as above, with full day statistics
+```
+
+## DEPARTMENT GROUPING
+
+### By Function
+
+**Core Business**
+- Legal Team
+- Accounting
+- Marketing
+- Purchasing Office
+- Digital Samples
+
+**Customer Facing**
+- Zendesk Chat
+- Shopify Store Manager
+
+**Technology Infrastructure**
+- Server Uptime Monitor
+- Log Monitor
+- Restart Analyzer
+- UI Manager
+
+**Strategic**
+- Trend Research
+- Task Orchestrator
+
+**Operational Support**
+- Needs Attention
+
+### By Priority Level
+
+**Priority 1 - Mission Critical**
+- Master Hub
+- Task Orchestrator
+- Server Uptime Monitor
+- Log Monitor
+
+**Priority 2 - Business Operations**
+- Digital Samples
+- Purchasing Office
+- Accounting
+- Zendesk Chat
+
+**Priority 3 - Business Development**
+- Marketing
+- Trend Research
+- Legal Team
+
+**Priority 4 - Support & Enhancement**
+- UI Manager
+- Restart Analyzer
+- Needs Attention
+- Shopify Store Manager
+
+## COMMUNICATION PATHS
+
+```
+User Request
+ │
+ ▼
+Master Hub ──────────────► Slack #morning-report
+ │ │
+ ├─► Department Heads ├─► Team notifications
+ │ ├─► Legal ├─► Critical alerts
+ │ ├─► Accounting └─► Daily summaries
+ │ ├─► Marketing
+ │ ├─► Purchasing
+ │ ├─► Digital Samples
+ │ └─► Trend Research
+ │
+ ├─► Support Services
+ │ ├─► Zendesk Chat
+ │ ├─► Shopify Store
+ │ ├─► Server Uptime
+ │ ├─► Log Monitor
+ │ ├─► UI Manager
+ │ └─► Restart Analyzer
+ │
+ └─► Operations
+ ├─► Task Orchestrator
+ └─► Needs Attention
+```
+
+## ACCESS MATRIX
+
+| Agent | Port | Dashboard | API | Reports To |
+|-------|------|-----------|-----|------------|
+| Master Hub | 9893 | ✅ | ✅ | - |
+| Legal Team | 9878 | ✅ | ✅ | Master Hub |
+| Accounting | 9882 | ✅ | ✅ | Master Hub |
+| Marketing | 9881 | ✅ | ✅ | Master Hub |
+| Purchasing | 9880 | ✅ | ✅ | Master Hub |
+| Digital Samples | 9879 | ✅ | ✅ | Master Hub |
+| Trend Research | 9883 | ✅ | ✅ | Master Hub |
+| Zendesk Chat | 9884 | ✅ | ✅ | Master Hub |
+| Shopify Store | 7238 | ✅ | ✅ | Master Hub |
+| Server Uptime | 7242 | ✅ | ✅ | Master Hub |
+| Log Monitor | 7239 | ✅ | ✅ | Master Hub |
+| UI Manager | 7240 | ✅ | ✅ | Master Hub |
+| Restart Analyzer | 7241 | ✅ | ✅ | Master Hub |
+| Task Orchestrator | 9900 | ✅ | ✅ | Master Hub |
+| Needs Attention | 7243 | ✅ | ✅ | Master Hub |
+
+## METRICS COLLECTION ORDER
+
+Reports collect data in this order for optimal efficiency:
+
+1. **Executive Level** (1 agent)
+ - Master Hub
+
+2. **Department Heads** (6 agents in parallel)
+ - Legal Team
+ - Accounting
+ - Marketing
+ - Purchasing Office
+ - Digital Samples
+ - Trend Research
+
+3. **Support Services** (6 agents in parallel)
+ - Zendesk Chat
+ - Shopify Store Manager
+ - Server Uptime Monitor
+ - Log Monitor
+ - UI Manager
+ - Restart Analyzer
+
+4. **Operations** (2 agents in parallel)
+ - Task Orchestrator
+ - Needs Attention
+
+Total: **15 agents** queried in **4 parallel batches** (~5 seconds total)
+
+## STATUS INDICATORS
+
+```
+✅ Online and healthy (green)
+⚠️ Degraded performance (yellow)
+❌ Offline or critical error (red)
+🔄 Restarting (blue)
+🔧 Maintenance mode (gray)
+```
+
+## ESCALATION PATH
+
+```
+Issue Detected
+ │
+ ▼
+Log Monitor / Needs Attention
+ │
+ ▼
+Master Hub Dashboard
+ │
+ ├─► Slack Alert (@channel for critical)
+ │
+ ├─► Email (if configured)
+ │
+ └─► Daily Report Summary
+```
+
+---
+
+For more details, see:
+- `/root/.claude/skills/daily-reporting/README.md`
+- `/root/.claude/skills/daily-reporting/agent-hierarchy.ts`
diff --git a/INSTALLATION-COMPLETE.md b/INSTALLATION-COMPLETE.md
new file mode 100644
index 0000000..31e4786
--- /dev/null
+++ b/INSTALLATION-COMPLETE.md
@@ -0,0 +1,494 @@
+# Daily Reporting System - Installation Complete
+
+## Installation Summary
+
+✅ **Daily Reporting System Successfully Created**
+
+The comprehensive daily reporting system for DW-Agents hierarchy has been installed at:
+```
+/root/.claude/skills/daily-reporting/
+```
+
+## What Was Created
+
+### Core Files
+
+1. **agent-hierarchy.ts** (7.4 KB)
+ - Complete organizational hierarchy
+ - 15 agents across 4 levels
+ - Department grouping
+ - Metrics definitions
+
+2. **report-generator.ts** (8.9 KB)
+ - Data collection from all agents
+ - Executive summary generation
+ - Department report compilation
+ - Issue detection
+ - Q&A readiness calculation
+
+3. **slack-formatter.ts** (8.3 KB)
+ - Slack markdown formatting
+ - Health bars and emojis
+ - Department sections
+ - Block Kit support
+
+4. **slack-notifier.ts** (4.7 KB)
+ - Slack webhook integration
+ - Message sending
+ - Error handling
+ - File backup
+
+5. **daily-report-runner.ts** (6.3 KB) ⭐ Main Entry Point
+ - Command-line interface
+ - Report orchestration
+ - Cron execution handler
+ - Usage documentation
+
+### Setup & Documentation
+
+6. **setup-cron.sh** (4.7 KB)
+ - Automated cron installation
+ - Environment configuration
+ - Testing utilities
+
+7. **README.md** (9.2 KB)
+ - Complete documentation
+ - Usage instructions
+ - Troubleshooting guide
+
+8. **QUICK-START.md** (6.8 KB)
+ - 5-minute setup guide
+ - Essential commands
+ - Common workflows
+
+9. **SLACK-SETUP-GUIDE.md** (9.9 KB)
+ - Detailed Slack configuration
+ - Webhook creation
+ - Channel setup
+ - Security best practices
+
+10. **HIERARCHY-DIAGRAM.md** (13 KB)
+ - Visual org chart
+ - Reporting structure
+ - Access matrix
+ - Communication paths
+
+### Configuration Files
+
+11. **skill.json** (1.1 KB)
+ - Skill metadata
+ - Cron schedules
+ - Capabilities list
+
+12. **tsconfig.json** (534 B)
+ - TypeScript configuration
+
+13. **package.json** (956 B)
+ - Dependencies
+ - NPM scripts
+
+## Agent Hierarchy (15 Agents)
+
+### Executive Level (1)
+- 👔 Master Hub (President) - Port 9893
+
+### Department Heads (6)
+- ⚖️ Legal Team - Port 9878
+- 💰 Accounting - Port 9882
+- 📢 Marketing - Port 9881
+- 🛒 Purchasing Office - Port 9880
+- 📦 Digital Samples - Port 9879
+- 📊 Trend Research - Port 9883
+
+### Support Services (6)
+- 💬 Zendesk Chat - Port 9884
+- 🛍️ Shopify Store Manager - Port 7238
+- 🖥️ Server Uptime Monitor - Port 7242
+- 📝 Log Monitor - Port 7239
+- 🎨 UI Manager - Port 7240
+- 🔄 Restart Analyzer - Port 7241
+
+### Operations (2)
+- 🎯 Task Orchestrator - Port 9900
+- ⚠️ Needs Attention - Port 7243
+
+## Features Implemented
+
+### Automated Reporting
+- ✅ Morning standup report (6:00 AM)
+- ✅ End-of-day summary (5:00 PM)
+- ✅ Cron job automation
+- ✅ Manual execution support
+
+### Data Collection
+- ✅ Parallel agent metrics fetching
+- ✅ Hierarchical data organization
+- ✅ Error handling and fallbacks
+- ✅ Timeout management
+
+### Report Content
+- ✅ Executive summary (system health, tasks, issues)
+- ✅ Department reports (by function)
+- ✅ Issues requiring attention (prioritized)
+- ✅ Action items (clear next steps)
+- ✅ Q&A readiness status
+- ✅ Top achievements
+
+### Slack Integration
+- ✅ Webhook support
+- ✅ Rich markdown formatting
+- ✅ Health bars with emojis
+- ✅ Status indicators
+- ✅ @channel mentions for critical issues
+- ✅ Action buttons to dashboard
+
+### Backup & Logging
+- ✅ JSON report backups
+- ✅ Detailed execution logs
+- ✅ Error tracking
+- ✅ Performance metrics
+
+## Next Steps to Complete Installation
+
+### 1. Install Node Dependencies (1 minute)
+
+```bash
+cd /root/DW-Agents
+npm install node-fetch @types/node-fetch
+```
+
+### 2. Configure Slack Webhook (2 minutes)
+
+#### Create Webhook:
+1. Go to: https://api.slack.com/messaging/webhooks
+2. Create new app "DW-Agents Reporter"
+3. Enable incoming webhooks
+4. Add webhook to #morning-report channel
+5. Copy webhook URL
+
+#### Set Environment Variable:
+```bash
+export SLACK_WEBHOOK_URL="https://hooks.slack.com/services/YOUR/WEBHOOK/URL"
+export SLACK_CHANNEL="#morning-report"
+
+# Make persistent
+echo 'export SLACK_WEBHOOK_URL="https://hooks.slack.com/services/YOUR/WEBHOOK/URL"' >> ~/.bashrc
+echo 'export SLACK_CHANNEL="#morning-report"' >> ~/.bashrc
+source ~/.bashrc
+```
+
+### 3. Run Setup Script (2 minutes)
+
+```bash
+cd /root/.claude/skills/daily-reporting
+./setup-cron.sh
+```
+
+This will:
+- Verify prerequisites
+- Configure Slack
+- Install cron jobs
+- Run test report
+- Display results
+
+### 4. Verify Installation
+
+```bash
+# Test Slack connection
+tsx daily-report-runner.ts test
+
+# Generate test report
+tsx daily-report-runner.ts morning
+
+# Check cron jobs
+crontab -l | grep daily-report
+
+# View logs
+tail -f /root/DW-Agents/logs/morning-report.log
+```
+
+## Quick Reference
+
+### Generate Reports
+
+```bash
+cd /root/.claude/skills/daily-reporting
+
+# Morning report
+tsx daily-report-runner.ts morning
+
+# End-of-day report
+tsx daily-report-runner.ts eod
+
+# Test Slack
+tsx daily-report-runner.ts test
+
+# Show help
+tsx daily-report-runner.ts help
+```
+
+### View Logs
+
+```bash
+# Real-time morning logs
+tail -f /root/DW-Agents/logs/morning-report.log
+
+# Real-time EOD logs
+tail -f /root/DW-Agents/logs/eod-report.log
+
+# Saved reports
+ls -lh /root/DW-Agents/reports/
+```
+
+### Manage Cron
+
+```bash
+# View cron jobs
+crontab -l
+
+# Edit cron jobs
+crontab -e
+
+# Check cron service
+systemctl status cron
+```
+
+## Cron Schedule
+
+Once installed, reports run automatically:
+
+```bash
+# Morning standup at 6:00 AM daily
+0 6 * * * cd /root/.claude/skills/daily-reporting && /root/DW-Agents/node_modules/.bin/tsx daily-report-runner.ts morning >> /root/DW-Agents/logs/morning-report.log 2>&1
+
+# End-of-day summary at 5:00 PM daily
+0 17 * * * cd /root/.claude/skills/daily-reporting && /root/DW-Agents/node_modules/.bin/tsx daily-report-runner.ts eod >> /root/DW-Agents/logs/eod-report.log 2>&1
+```
+
+## Slack Webhook URL Format
+
+Your Slack webhook URL should look like:
+
+```
+https://hooks.slack.com/services/T{WORKSPACE_ID}/B{CHANNEL_ID}/{SECRET_TOKEN}
+```
+
+Example:
+```
+https://hooks.slack.com/services/T012AB3C4D5/B678EF9G0H1/abcdefghijklmnopqrstuvwx1234567
+```
+
+### Create Webhook:
+
+1. **Go to Slack API**:
+ - Visit: https://api.slack.com/messaging/webhooks
+ - Sign in to your workspace
+
+2. **Create App**:
+ - Click "Create New App"
+ - Select "From scratch"
+ - Name: "DW-Agents Reporter"
+ - Select workspace
+
+3. **Enable Webhooks**:
+ - Click "Incoming Webhooks"
+ - Toggle "Activate Incoming Webhooks" to ON
+ - Click "Add New Webhook to Workspace"
+
+4. **Select Channel**:
+ - Choose or create **#morning-report**
+ - Click "Allow"
+
+5. **Copy URL**:
+ - Copy the webhook URL
+ - Keep it secure (it's like a password)
+
+### Create #morning-report Channel:
+
+In Slack:
+```
+/create #morning-report
+```
+
+Or:
+1. Click "+" next to Channels
+2. Name: "morning-report"
+3. Description: "Daily automated reports from DW-Agents system"
+4. Create
+
+### Invite Team:
+```
+/invite @teammate
+```
+
+## Report Example
+
+### Morning Standup Report
+
+```
+☀️ MORNING STANDUP REPORT
+Friday, November 9, 2025
+━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
+
+📊 EXECUTIVE SUMMARY
+
+System Health: 🟢🟢🟢🟢🟢🟢🟢🟢🟢⚪⚪⚪⚪⚪⚪ 95%
+Agents Online: 14/15
+Tasks Completed Today: 127
+Critical Issues: ✅ None
+
+🏆 Top Achievements:
+ 1. Marketing completed 45 tasks
+ 2. Digital Samples processed 32 orders
+ 3. Zendesk handled 28 tickets
+
+🏢 DEPARTMENT REPORTS
+
+Executive (1/1 online)
+🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢 100%
+Tasks Completed: 12
+ ✅ Master Hub (President) • 12 tasks
+
+Legal (1/1 online)
+🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢 100%
+Tasks Completed: 8
+ ✅ Legal Team • 8 tasks
+
+Finance (1/1 online)
+🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢 100%
+Tasks Completed: 15
+ ✅ Accounting • 15 tasks
+
+Marketing (1/1 online)
+🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢 100%
+Tasks Completed: 45
+ ✅ Marketing • 45 tasks
+ ✨ Highlights:
+ • Marketing completed 45 tasks
+
+[... more departments ...]
+
+🎉 ISSUES REQUIRING ATTENTION
+
+✅ No critical issues detected! All systems operational.
+
+✅ ACTION ITEMS
+
+No pending action items.
+
+💬 Q&A READINESS STATUS
+
+Overall Readiness: 🟢🟢🟢🟢🟢🟢🟢🟢⚪⚪⚪⚪⚪⚪⚪ 85%
+
+Agent Readiness Scores:
+🟢 Marketing: 95%
+🟢 Master Hub (President): 92%
+🟢 Digital Samples: 90%
+[... more agents ...]
+
+━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
+📅 Next Report: End-of-Day Summary at 5:00 PM
+🔗 Master Hub: http://45.61.58.125:9893
+Generated at 6:00:15 AM
+```
+
+## Documentation Reference
+
+All documentation files:
+
+1. **QUICK-START.md** - Get started in 5 minutes
+2. **README.md** - Complete documentation
+3. **SLACK-SETUP-GUIDE.md** - Detailed Slack configuration
+4. **HIERARCHY-DIAGRAM.md** - Organizational structure
+5. **INSTALLATION-COMPLETE.md** - This file
+
+## File Structure
+
+```
+/root/.claude/skills/daily-reporting/
+├── agent-hierarchy.ts # Agent organization
+├── report-generator.ts # Data collection & reports
+├── slack-formatter.ts # Message formatting
+├── slack-notifier.ts # Slack integration
+├── daily-report-runner.ts # Main entry point ⭐
+├── setup-cron.sh # Installation script
+├── skill.json # Skill metadata
+├── tsconfig.json # TypeScript config
+├── package.json # Dependencies
+├── QUICK-START.md # Quick guide
+├── README.md # Full documentation
+├── SLACK-SETUP-GUIDE.md # Slack setup
+├── HIERARCHY-DIAGRAM.md # Org chart
+└── INSTALLATION-COMPLETE.md # This file
+
+Reports saved to:
+/root/DW-Agents/reports/
+├── morning-report-YYYY-MM-DD-HH-MM-SS.json
+└── eod-report-YYYY-MM-DD-HH-MM-SS.json
+
+Logs saved to:
+/root/DW-Agents/logs/
+├── morning-report.log
+└── eod-report.log
+```
+
+## Support & Troubleshooting
+
+### Common Issues
+
+1. **Slack not receiving messages**
+ ```bash
+ tsx daily-report-runner.ts test
+ echo $SLACK_WEBHOOK_URL
+ ```
+
+2. **Cron not running**
+ ```bash
+ systemctl status cron
+ crontab -l
+ ```
+
+3. **Agents showing offline**
+ ```bash
+ pm2 list
+ pm2 restart all
+ ```
+
+### Get Help
+
+```bash
+# Show help
+tsx daily-report-runner.ts help
+
+# Test connection
+tsx daily-report-runner.ts test
+
+# Check logs
+tail -f /root/DW-Agents/logs/morning-report.log
+```
+
+## Status
+
+✅ **Installation**: Complete
+⏳ **Configuration**: Pending (requires Slack webhook)
+⏳ **Testing**: Pending (run setup script)
+⏳ **Deployment**: Pending (cron installation)
+
+## Ready to Deploy
+
+Once you complete the 3 next steps above:
+
+1. ✅ Install dependencies
+2. ✅ Configure Slack webhook
+3. ✅ Run setup script
+
+Your system will automatically generate and send:
+- 📊 Morning reports at 6:00 AM
+- 📊 End-of-day reports at 5:00 PM
+- 🔔 Critical alerts as needed
+
+---
+
+**🎉 Installation Complete!**
+
+Start with the **QUICK-START.md** guide to get running in 5 minutes.
diff --git a/QUICK-START.md b/QUICK-START.md
new file mode 100644
index 0000000..aeff53d
--- /dev/null
+++ b/QUICK-START.md
@@ -0,0 +1,354 @@
+# Quick Start Guide - Daily Reporting System
+
+Get up and running with automated daily reports in 5 minutes.
+
+## Prerequisites
+
+- DW-Agents system running
+- PM2 managing agents
+- Node.js and npm installed
+- Slack workspace access (for notifications)
+
+## Installation (5 Minutes)
+
+### Step 1: Install Dependencies (1 min)
+
+```bash
+cd /root/DW-Agents
+npm install node-fetch @types/node-fetch
+```
+
+### Step 2: Configure Slack (2 min)
+
+#### A. Create Slack Webhook
+
+1. Go to: https://api.slack.com/messaging/webhooks
+2. Click "Create New App" > "From scratch"
+3. Name: "DW-Agents Reporter"
+4. Click "Incoming Webhooks" > Toggle ON
+5. Click "Add New Webhook to Workspace"
+6. Select channel: **#morning-report** (create if needed)
+7. Copy webhook URL
+
+#### B. Set Environment Variable
+
+```bash
+export SLACK_WEBHOOK_URL="https://hooks.slack.com/services/YOUR/WEBHOOK/URL"
+export SLACK_CHANNEL="#morning-report"
+
+# Make it persistent
+echo 'export SLACK_WEBHOOK_URL="https://hooks.slack.com/services/YOUR/WEBHOOK/URL"' >> ~/.bashrc
+echo 'export SLACK_CHANNEL="#morning-report"' >> ~/.bashrc
+source ~/.bashrc
+```
+
+### Step 3: Run Setup Script (2 min)
+
+```bash
+cd /root/.claude/skills/daily-reporting
+chmod +x setup-cron.sh
+./setup-cron.sh
+```
+
+This will:
+- Verify dependencies
+- Install cron jobs (6:00 AM and 5:00 PM)
+- Run a test report
+- Send test message to Slack
+
+## Verify Installation
+
+### Check Cron Jobs
+
+```bash
+crontab -l | grep daily-report
+```
+
+Should show:
+```
+0 6 * * * cd /root/.claude/skills/daily-reporting && /root/DW-Agents/node_modules/.bin/tsx daily-report-runner.ts morning >> /root/DW-Agents/logs/morning-report.log 2>&1
+0 17 * * * cd /root/.claude/skills/daily-reporting && /root/DW-Agents/node_modules/.bin/tsx daily-report-runner.ts eod >> /root/DW-Agents/logs/eod-report.log 2>&1
+```
+
+### Test Report Generation
+
+```bash
+cd /root/.claude/skills/daily-reporting
+tsx daily-report-runner.ts morning
+```
+
+Expected output:
+```
+============================================================
+🤖 DW-AGENTS DAILY REPORTING SYSTEM
+============================================================
+
+📊 Report Type: MORNING
+⏰ Started at: ...
+
+📋 Step 1: Generating report...
+✅ Report generated successfully
+
+💾 Step 2: Saving report to file...
+✅ Report saved: /root/DW-Agents/reports/morning-report-...json
+
+📤 Step 3: Sending report to Slack...
+✅ Report sent to Slack channel: #morning-report
+
+📊 REPORT SUMMARY:
+ System Health: 95%
+ Agents Online: 14/15
+ Tasks Completed: 127
+ Critical Issues: 0
+ Q&A Readiness: 85%
+
+✅ Daily report completed successfully!
+```
+
+### Check Slack
+
+Go to **#morning-report** channel in Slack. You should see the report!
+
+## Manual Usage
+
+### Generate Reports Manually
+
+```bash
+cd /root/.claude/skills/daily-reporting
+
+# Morning report
+tsx daily-report-runner.ts morning
+
+# End-of-day report
+tsx daily-report-runner.ts eod
+
+# Test Slack connection
+tsx daily-report-runner.ts test
+
+# Show help
+tsx daily-report-runner.ts help
+```
+
+### View Logs
+
+```bash
+# Real-time monitoring
+tail -f /root/DW-Agents/logs/morning-report.log
+
+# Last 50 lines
+tail -50 /root/DW-Agents/logs/eod-report.log
+
+# View saved reports
+ls -lh /root/DW-Agents/reports/
+```
+
+## What You Get
+
+### Morning Report (6:00 AM)
+
+```
+☀️ MORNING STANDUP REPORT
+━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
+
+📊 EXECUTIVE SUMMARY
+- System health percentage
+- Agents online/offline
+- Critical issues
+- Top achievements
+
+🏢 DEPARTMENT REPORTS
+For each department:
+- Agent status
+- Tasks completed
+- Issues detected
+- Highlights
+
+🚨 ISSUES REQUIRING ATTENTION
+- Critical: Offline agents
+- High: Error rates
+- Medium: Performance issues
+- Low: Warnings
+
+✅ ACTION ITEMS
+- Prioritized next steps
+
+💬 Q&A READINESS
+- Agent status scores
+- Recent activities
+```
+
+### End-of-Day Report (5:00 PM)
+
+Same structure, with full day statistics.
+
+## Troubleshooting
+
+### Problem: No Slack messages
+
+**Solution**:
+```bash
+# Test webhook
+tsx daily-report-runner.ts test
+
+# Check environment variable
+echo $SLACK_WEBHOOK_URL
+
+# Verify network
+curl -I https://hooks.slack.com
+```
+
+### Problem: Cron not running
+
+**Solution**:
+```bash
+# Check cron service
+systemctl status cron
+
+# Verify crontab
+crontab -l
+
+# Check logs
+tail -f /var/log/syslog | grep CRON
+```
+
+### Problem: Agents showing offline
+
+**Solution**:
+```bash
+# Check PM2
+pm2 list
+
+# Restart all agents
+pm2 restart all
+
+# Check specific agent
+curl http://45.61.58.125:9878/api/metrics
+```
+
+## Customization
+
+### Change Report Times
+
+```bash
+crontab -e
+
+# Change 6:00 AM to 7:00 AM
+0 7 * * * ...
+
+# Change 5:00 PM to 6:00 PM
+0 18 * * * ...
+```
+
+### Change Slack Channel
+
+```bash
+export SLACK_CHANNEL="#operations"
+
+# Update in crontab
+crontab -e
+# Add: SLACK_CHANNEL=#operations
+```
+
+### Disable @channel Mentions
+
+Edit `/root/.claude/skills/daily-reporting/daily-report-runner.ts`:
+
+```typescript
+const slackConfig = {
+ // ...
+ mentionChannelOnIssues: false
+};
+```
+
+## Daily Workflow
+
+### 6:00 AM - Morning Standup
+1. Report automatically generates
+2. Sent to #morning-report
+3. Team reviews overnight activities
+4. Action items prioritized
+
+### Throughout the Day
+- Agents collect metrics
+- Issues auto-detected
+- Reports saved to files
+
+### 5:00 PM - End-of-Day
+1. Full day report generates
+2. Sent to #morning-report
+3. Review accomplishments
+4. Plan for tomorrow
+
+## Next Steps
+
+1. **Invite team to #morning-report**:
+ ```
+ /invite @teammate
+ ```
+
+2. **Customize agent metrics**:
+ - Edit `/root/.claude/skills/daily-reporting/agent-hierarchy.ts`
+ - Add custom metrics per agent
+
+3. **Set up multiple channels**:
+ - Create separate webhooks
+ - Send executive summary to #leadership
+ - Send IT metrics to #ops
+
+4. **Add visualizations**:
+ - Integrate with Grafana
+ - Create custom dashboards
+ - Export to Google Sheets
+
+## Cheat Sheet
+
+```bash
+# Test connection
+tsx daily-report-runner.ts test
+
+# Generate morning report
+tsx daily-report-runner.ts morning
+
+# Generate EOD report
+tsx daily-report-runner.ts eod
+
+# View logs
+tail -f /root/DW-Agents/logs/morning-report.log
+
+# Check cron
+crontab -l
+
+# Check PM2
+pm2 list
+
+# View reports
+ls -lh /root/DW-Agents/reports/
+```
+
+## Support
+
+### Documentation
+- **Full README**: `/root/.claude/skills/daily-reporting/README.md`
+- **Slack Setup**: `/root/.claude/skills/daily-reporting/SLACK-SETUP-GUIDE.md`
+- **Hierarchy**: `/root/.claude/skills/daily-reporting/HIERARCHY-DIAGRAM.md`
+
+### Commands
+```bash
+# Help
+tsx daily-report-runner.ts help
+
+# Test
+tsx daily-report-runner.ts test
+
+# Manual run
+tsx daily-report-runner.ts morning
+```
+
+### Common Paths
+- **Skill directory**: `/root/.claude/skills/daily-reporting/`
+- **Reports**: `/root/DW-Agents/reports/`
+- **Logs**: `/root/DW-Agents/logs/`
+
+---
+
+**🎉 You're all set!** Reports will now run automatically at 6:00 AM and 5:00 PM daily.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..14cd773
--- /dev/null
+++ b/README.md
@@ -0,0 +1,410 @@
+# Daily Reporting System for DW-Agents
+
+Comprehensive automated reporting system that generates morning standup and end-of-day summary reports for all DW-Agents in the hierarchy.
+
+## Features
+
+- **Automated Daily Reports**: Morning (6:00 AM) and End-of-Day (5:00 PM)
+- **Hierarchical Agent Collection**: Collects data from all agents in organizational order
+- **Executive Summary**: System health, critical alerts, top achievements
+- **Department Reports**: Detailed metrics from each department
+- **Issue Detection**: Automatic identification of problems requiring attention
+- **Action Items**: Clear next steps based on current status
+- **Q&A Readiness**: Agent status and recent activities
+- **Slack Integration**: Formatted reports sent to #morning-report channel
+- **File Backup**: All reports saved to `/root/DW-Agents/reports/`
+
+## Agent Hierarchy
+
+### Executive Level
+- **Master Hub (President)** - Port 9893 - Central command & coordination
+
+### Department Heads
+- **Legal Team** - Port 9878 - Legal compliance & risk management
+- **Accounting** - Port 9882 - Financial management & reporting
+- **Marketing** - Port 9881 - Marketing campaigns & content
+- **Purchasing Office** - Port 9880 - Procurement & vendor management
+- **Digital Samples** - Port 9879 - Sample processing & delivery
+- **Trend Research** - Port 9883 - Market intelligence & analysis
+
+### Support Services
+- **Zendesk Chat** - Port 9884 - Customer support & chat
+- **Shopify Store Manager** - Port 7238 - E-commerce operations
+- **Server Uptime Monitor** - Port 7242 - Infrastructure monitoring
+- **Log Monitor** - Port 7239 - Error detection & analysis
+- **UI Manager** - Port 7240 - Design system & UX
+- **Restart Analyzer** - Port 7241 - System health & pattern analysis
+
+### Operations & Orchestration
+- **Task Orchestrator** - Port 9900 - Task routing & coordination
+- **Needs Attention** - Port 7243 - Issue detection & escalation
+
+## Installation
+
+### 1. Install Dependencies
+
+```bash
+cd /root/DW-Agents
+npm install node-fetch @types/node-fetch
+```
+
+### 2. Configure Slack Webhook
+
+Create a Slack incoming webhook:
+
+1. Go to https://api.slack.com/messaging/webhooks
+2. Click "Create New App" > "From scratch"
+3. Name it "DW-Agents Reporter"
+4. Select your workspace
+5. Click "Incoming Webhooks" > "Activate Incoming Webhooks"
+6. Click "Add New Webhook to Workspace"
+7. Select the **#morning-report** channel (create it first if needed)
+8. Copy the webhook URL
+
+### 3. Set Environment Variables
+
+Add to `~/.bashrc` or `~/.profile`:
+
+```bash
+export SLACK_WEBHOOK_URL="https://hooks.slack.com/services/YOUR/WEBHOOK/URL"
+export SLACK_CHANNEL="#morning-report"
+export REPORTS_DIR="/root/DW-Agents/reports"
+```
+
+Then reload:
+
+```bash
+source ~/.bashrc
+```
+
+### 4. Run Setup Script
+
+```bash
+cd /root/.claude/skills/daily-reporting
+./setup-cron.sh
+```
+
+This will:
+- Verify prerequisites
+- Configure Slack (if needed)
+- Install cron jobs
+- Run a test report
+
+## Usage
+
+### Manual Report Generation
+
+```bash
+cd /root/.claude/skills/daily-reporting
+
+# Generate morning report
+tsx daily-report-runner.ts morning
+
+# Generate end-of-day report
+tsx daily-report-runner.ts eod
+
+# Test Slack connection
+tsx daily-report-runner.ts test
+
+# Show help
+tsx daily-report-runner.ts help
+```
+
+### Automated Scheduling
+
+Reports are automatically generated via cron:
+
+- **6:00 AM**: Morning standup report
+- **5:00 PM**: End-of-day summary
+
+View cron jobs:
+
+```bash
+crontab -l
+```
+
+### Monitor Logs
+
+```bash
+# Morning report logs
+tail -f /root/DW-Agents/logs/morning-report.log
+
+# EOD report logs
+tail -f /root/DW-Agents/logs/eod-report.log
+
+# All reports saved to
+ls -lh /root/DW-Agents/reports/
+```
+
+## Report Structure
+
+### Executive Summary
+- System health percentage
+- Agents online count
+- Tasks completed today
+- Critical issues count
+- Top achievements
+
+### Department Reports
+For each department:
+- Agent status (online/offline)
+- Tasks completed
+- Error counts
+- Highlights and achievements
+- Issues detected
+
+### Issues Requiring Attention
+Prioritized list of:
+- Critical: Offline agents, system failures
+- High: High error rates, performance issues
+- Medium: Degraded performance, low readiness
+- Low: Minor warnings
+
+### Action Items
+- Clear next steps based on current status
+- Prioritized by severity
+- Includes department-specific actions
+
+### Q&A Readiness Status
+- Overall readiness score (0-100)
+- Individual agent readiness scores
+- Recent activities per agent
+
+## Slack Integration
+
+### Channel Setup
+
+1. **Create the channel**:
+ ```
+ /create #morning-report
+ ```
+
+2. **Set channel description**:
+ ```
+ Daily automated reports from DW-Agents system
+ Morning standup at 6:00 AM | EOD summary at 5:00 PM
+ ```
+
+3. **Invite team members**:
+ ```
+ /invite @username
+ ```
+
+### Message Format
+
+Reports are sent in clean Slack markdown with:
+- Health bars with emoji indicators
+- Status indicators (✅❌⚠️)
+- Severity emojis (🚨⚠️⚡ℹ️)
+- Department sections
+- Action buttons to dashboard
+- @channel mentions for critical issues
+
+### Sample Report
+
+```
+☀️ MORNING STANDUP REPORT
+Friday, November 9, 2025
+━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
+
+📊 EXECUTIVE SUMMARY
+
+System Health: 🟢🟢🟢🟢🟢🟢🟢🟢🟢⚪⚪⚪⚪⚪⚪ 95%
+Agents Online: 14/15
+Tasks Completed Today: 127
+Critical Issues: ✅ None
+
+🏆 Top Achievements:
+ 1. Marketing completed 45 tasks
+ 2. Digital Samples processed 32 orders
+ 3. Zendesk handled 28 tickets
+
+🏢 DEPARTMENT REPORTS
+
+Executive (1/1 online)
+🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢 100%
+Tasks Completed: 12
+ ✅ Master Hub (President) • 12 tasks
+
+Legal (1/1 online)
+🟢🟢🟢🟢🟢🟢🟢🟢🟢🟢 100%
+Tasks Completed: 8
+ ✅ Legal Team • 8 tasks
+
+...
+```
+
+## Troubleshooting
+
+### No Slack Messages Received
+
+1. **Verify webhook URL**:
+ ```bash
+ echo $SLACK_WEBHOOK_URL
+ ```
+
+2. **Test connection**:
+ ```bash
+ cd /root/.claude/skills/daily-reporting
+ tsx daily-report-runner.ts test
+ ```
+
+3. **Check logs**:
+ ```bash
+ tail -50 /root/DW-Agents/logs/morning-report.log
+ ```
+
+### Agents Showing as Offline
+
+1. **Check PM2 status**:
+ ```bash
+ pm2 list
+ ```
+
+2. **Check individual agent**:
+ ```bash
+ curl http://45.61.58.125:9878/api/metrics
+ ```
+
+3. **View agent logs**:
+ ```bash
+ pm2 logs dw-legal-team
+ ```
+
+### Cron Jobs Not Running
+
+1. **Verify cron is running**:
+ ```bash
+ systemctl status cron
+ ```
+
+2. **Check crontab**:
+ ```bash
+ crontab -l
+ ```
+
+3. **Run manually to test**:
+ ```bash
+ cd /root/.claude/skills/daily-reporting
+ tsx daily-report-runner.ts morning
+ ```
+
+### Reports Not Saving
+
+1. **Check directory permissions**:
+ ```bash
+ ls -la /root/DW-Agents/reports/
+ ```
+
+2. **Create directory if missing**:
+ ```bash
+ mkdir -p /root/DW-Agents/reports
+ ```
+
+## Customization
+
+### Change Report Times
+
+Edit crontab:
+
+```bash
+crontab -e
+```
+
+Cron format: `minute hour day month weekday`
+
+Examples:
+```
+# 7:00 AM instead of 6:00 AM
+0 7 * * * cd /root/.claude/skills/daily-reporting && tsx daily-report-runner.ts morning
+
+# 6:00 PM instead of 5:00 PM
+0 18 * * * cd /root/.claude/skills/daily-reporting && tsx daily-report-runner.ts eod
+```
+
+### Add Custom Metrics
+
+Edit `/root/.claude/skills/daily-reporting/agent-hierarchy.ts` to add metrics for each agent.
+
+### Change Slack Channel
+
+```bash
+export SLACK_CHANNEL="#your-channel-name"
+```
+
+Update in crontab:
+```bash
+crontab -e
+# Add: SLACK_CHANNEL=#your-channel-name
+```
+
+### Disable @channel Mentions
+
+Edit `/root/.claude/skills/daily-reporting/slack-notifier.ts`:
+
+```typescript
+const slackConfig = {
+ // ...
+ mentionChannelOnIssues: false // Change to false
+};
+```
+
+## API Endpoints
+
+Each agent should expose a `/api/metrics` endpoint returning:
+
+```json
+{
+ "uptime": 86400,
+ "responseTime": 150,
+ "tasksCompleted": 42,
+ "errorsToday": 2,
+ "qnaReadiness": 85,
+ "lastActivity": "2025-11-09T14:30:00Z",
+ "customMetrics": {
+ "specific_metric": "value"
+ }
+}
+```
+
+## Files Structure
+
+```
+/root/.claude/skills/daily-reporting/
+├── skill.json # Skill configuration
+├── agent-hierarchy.ts # Agent organizational structure
+├── report-generator.ts # Report generation logic
+├── slack-formatter.ts # Slack message formatting
+├── slack-notifier.ts # Slack API integration
+├── daily-report-runner.ts # Main entry point
+├── setup-cron.sh # Installation script
+└── README.md # This file
+
+/root/DW-Agents/reports/ # Backup reports directory
+├── morning-report-2025-11-09-06-00-00.json
+├── eod-report-2025-11-09-17-00-00.json
+└── ...
+
+/root/DW-Agents/logs/ # Log files
+├── morning-report.log
+└── eod-report.log
+```
+
+## Support
+
+For issues or questions:
+
+1. Check logs: `tail -f /root/DW-Agents/logs/morning-report.log`
+2. Run manual test: `tsx daily-report-runner.ts morning`
+3. Test Slack: `tsx daily-report-runner.ts test`
+4. Review agent status: `pm2 list`
+
+## Version History
+
+- **v1.0.0** (2025-11-09)
+ - Initial release
+ - Morning and EOD reports
+ - Full agent hierarchy support
+ - Slack integration
+ - Automated scheduling
+ - Q&A readiness tracking
diff --git a/SLACK-SETUP-GUIDE.md b/SLACK-SETUP-GUIDE.md
new file mode 100644
index 0000000..d6b6b8c
--- /dev/null
+++ b/SLACK-SETUP-GUIDE.md
@@ -0,0 +1,472 @@
+# Slack Integration Setup Guide
+
+Complete guide for setting up Slack integration with DW-Agents Daily Reporting System.
+
+## Step-by-Step Setup
+
+### 1. Create Slack App
+
+1. Go to https://api.slack.com/apps
+2. Click **"Create New App"**
+3. Select **"From scratch"**
+4. Enter app name: **DW-Agents Reporter**
+5. Select your workspace
+6. Click **"Create App"**
+
+### 2. Enable Incoming Webhooks
+
+1. In your app settings, click **"Incoming Webhooks"** (left sidebar)
+2. Toggle **"Activate Incoming Webhooks"** to ON
+3. Scroll down and click **"Add New Webhook to Workspace"**
+4. Select the channel: **#morning-report** (create it first if needed)
+5. Click **"Allow"**
+
+You'll see a webhook URL like:
+```
+https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXX
+```
+
+**Important**: Keep this URL secure! It's like a password for your Slack channel.
+
+### 3. Create #morning-report Channel
+
+If you haven't created the channel yet:
+
+1. In Slack, click the **+** next to "Channels"
+2. Name it: **morning-report**
+3. Description: `Daily automated reports from DW-Agents system`
+4. Set it to **Public** or **Private** (your choice)
+5. Click **"Create"**
+
+### 4. Invite Team Members
+
+In the #morning-report channel:
+
+```
+/invite @username
+```
+
+Or click the channel name > "Members" > "Add people"
+
+### 5. Configure Environment Variables
+
+#### Option A: Add to ~/.bashrc (Persistent)
+
+```bash
+# Edit bashrc
+nano ~/.bashrc
+
+# Add these lines at the end:
+export SLACK_WEBHOOK_URL="https://hooks.slack.com/services/YOUR/WEBHOOK/URL"
+export SLACK_CHANNEL="#morning-report"
+export REPORTS_DIR="/root/DW-Agents/reports"
+
+# Save and reload
+source ~/.bashrc
+```
+
+#### Option B: Add to Crontab (Cron-specific)
+
+```bash
+crontab -e
+
+# Add these lines at the top:
+SLACK_WEBHOOK_URL=https://hooks.slack.com/services/YOUR/WEBHOOK/URL
+SLACK_CHANNEL=#morning-report
+REPORTS_DIR=/root/DW-Agents/reports
+```
+
+### 6. Test Connection
+
+```bash
+cd /root/.claude/skills/daily-reporting
+tsx daily-report-runner.ts test
+```
+
+You should see:
+```
+🧪 Testing Slack webhook connection...
+✅ Slack connection successful!
+ Channel: #morning-report
+ Check your Slack channel for a test message.
+```
+
+## Webhook URL Format
+
+The webhook URL should look like this:
+
+```
+https://hooks.slack.com/services/T{WORKSPACE_ID}/B{CHANNEL_ID}/{TOKEN}
+```
+
+Example:
+```
+https://hooks.slack.com/services/T012AB3C4D5/B678EF9G0H1/abcdefghijklmnopqrstuvwx1234567
+```
+
+### URL Components:
+- **T012AB3C4D5**: Your workspace ID
+- **B678EF9G0H1**: The channel/webhook ID
+- **abcdef...**: Secret token (32 characters)
+
+## Channel Configuration
+
+### Recommended Channel Settings
+
+1. **Name**: `#morning-report`
+2. **Topic**: `📊 Daily automated reports - Morning at 6:00 AM | EOD at 5:00 PM`
+3. **Description**:
+ ```
+ Automated daily reports from DW-Agents hierarchy system.
+
+ Report Types:
+ - ☀️ Morning Standup (6:00 AM)
+ - 🌙 End-of-Day Summary (5:00 PM)
+
+ Dashboard: http://45.61.58.125:9893
+ ```
+
+4. **Notifications**:
+ - Set to **All messages** for critical updates
+ - Or **Mentions only** to reduce noise
+
+### Channel Permissions
+
+**Public Channel** (Recommended):
+- ✅ Anyone in workspace can join
+- ✅ Searchable message history
+- ✅ Easy for new team members
+
+**Private Channel**:
+- ⚠️ Invite-only access
+- ⚠️ More secure for sensitive data
+- ⚠️ Requires manual invitation
+
+## Message Formatting
+
+### What You'll Receive
+
+#### Morning Report (6:00 AM)
+```
+☀️ MORNING STANDUP REPORT
+Friday, November 9, 2025
+━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
+
+📊 EXECUTIVE SUMMARY
+...
+
+🏢 DEPARTMENT REPORTS
+...
+
+🚨 ISSUES REQUIRING ATTENTION
+...
+
+✅ ACTION ITEMS
+...
+
+💬 Q&A READINESS STATUS
+...
+```
+
+#### EOD Report (5:00 PM)
+Same format, with full day's statistics.
+
+### Alert Mentions
+
+If there are **critical issues**, the bot will mention the channel:
+
+```
+<!channel> Attention Required - Critical issues detected!
+
+☀️ MORNING STANDUP REPORT
+...
+```
+
+You'll receive a notification from Slack.
+
+## Customization
+
+### Change Report Times
+
+Edit the cron schedule:
+
+```bash
+crontab -e
+```
+
+**Current schedule**:
+```
+0 6 * * * ... # 6:00 AM
+0 17 * * * ... # 5:00 PM
+```
+
+**Custom times**:
+```
+0 7 * * * ... # 7:00 AM
+0 18 * * * ... # 6:00 PM
+30 8 * * * ... # 8:30 AM
+```
+
+### Change Channel
+
+```bash
+export SLACK_CHANNEL="#operations"
+```
+
+Update in crontab:
+```bash
+crontab -e
+# Change: SLACK_CHANNEL=#operations
+```
+
+### Disable @channel Mentions
+
+Edit `/root/.claude/skills/daily-reporting/daily-report-runner.ts`:
+
+```typescript
+const slackConfig = {
+ webhookUrl: SLACK_WEBHOOK_URL,
+ channel: SLACK_CHANNEL,
+ username: 'DW-Agents Reporter',
+ iconEmoji: reportType === 'morning' ? ':sunrise:' : ':city_sunset:',
+ mentionChannelOnIssues: false // Change to false
+};
+```
+
+### Custom Bot Name and Icon
+
+In `slack-notifier.ts`:
+
+```typescript
+const payload = {
+ username: 'Your Bot Name', // Custom name
+ icon_emoji: ':robot_face:', // Custom emoji
+ // Or use custom image:
+ icon_url: 'https://example.com/bot-icon.png'
+};
+```
+
+## Multiple Channels
+
+To send reports to multiple channels, create separate webhooks:
+
+### 1. Create Additional Webhooks
+
+Repeat Step 2 above for each channel:
+- #executive-reports
+- #it-operations
+- #department-heads
+
+### 2. Configure Multiple Webhooks
+
+```bash
+export SLACK_WEBHOOK_EXEC="https://hooks.slack.com/services/T.../B.../exec..."
+export SLACK_WEBHOOK_OPS="https://hooks.slack.com/services/T.../B.../ops..."
+```
+
+### 3. Modify Script
+
+Edit `daily-report-runner.ts` to send to multiple webhooks:
+
+```typescript
+const webhooks = [
+ { url: process.env.SLACK_WEBHOOK_URL, channel: '#morning-report' },
+ { url: process.env.SLACK_WEBHOOK_EXEC, channel: '#executive-reports' },
+ { url: process.env.SLACK_WEBHOOK_OPS, channel: '#it-operations' }
+];
+
+for (const webhook of webhooks) {
+ await sendToSlack(report, {
+ webhookUrl: webhook.url,
+ channel: webhook.channel,
+ ...
+ });
+}
+```
+
+## Troubleshooting
+
+### "Invalid webhook URL"
+
+**Problem**: The webhook URL is incorrect or expired.
+
+**Solution**:
+1. Go to https://api.slack.com/apps
+2. Select your app
+3. Click "Incoming Webhooks"
+4. Verify the webhook URL
+5. If deleted, create a new webhook
+6. Update environment variable
+
+### "Channel not found"
+
+**Problem**: The channel doesn't exist or webhook wasn't added to it.
+
+**Solution**:
+1. Verify channel exists: `/join #morning-report`
+2. Recreate the webhook for the correct channel
+3. Update webhook URL in environment
+
+### "No test message received"
+
+**Problem**: Slack webhook might be inactive or network issues.
+
+**Solution**:
+```bash
+# Test with curl
+curl -X POST -H 'Content-type: application/json' \
+ --data '{"text":"Test from command line"}' \
+ $SLACK_WEBHOOK_URL
+
+# Check network connectivity
+ping hooks.slack.com
+
+# Verify firewall allows outbound HTTPS
+curl -I https://hooks.slack.com
+```
+
+### "Messages not formatted correctly"
+
+**Problem**: Slack markdown rendering issues.
+
+**Solution**:
+- Slack uses mrkdwn, not full markdown
+- Don't use HTML tags
+- Use supported formatting:
+ - `*bold*` → **bold**
+ - `_italic_` → _italic_
+ - `~strikethrough~` → ~~strikethrough~~
+ - `` `code` `` → `code`
+ - `>` for quotes
+
+### "Cron runs but no Slack message"
+
+**Problem**: Environment variables not available in cron.
+
+**Solution**:
+```bash
+crontab -e
+
+# Add at the top:
+SHELL=/bin/bash
+PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
+SLACK_WEBHOOK_URL=https://hooks.slack.com/services/YOUR/WEBHOOK/URL
+SLACK_CHANNEL=#morning-report
+
+# Then your cron jobs...
+```
+
+## Security Best Practices
+
+### 1. Protect Webhook URL
+
+❌ **Don't**:
+- Commit webhook URL to Git
+- Share in public channels
+- Include in screenshots
+- Log to public logs
+
+✅ **Do**:
+- Store in environment variables
+- Use `.env` file (add to `.gitignore`)
+- Rotate periodically
+- Limit who knows the URL
+
+### 2. Webhook Rotation
+
+Rotate webhook URLs every 90 days:
+
+1. Create new webhook
+2. Update environment variable
+3. Test new webhook
+4. Delete old webhook
+
+### 3. Access Control
+
+- Keep #morning-report private if handling sensitive data
+- Limit webhook creation to admins
+- Monitor webhook usage in Slack app settings
+
+## Advanced Features
+
+### Rich Message Blocks
+
+For more interactive messages, edit `slack-formatter.ts` to use blocks:
+
+```typescript
+const blocks = [
+ {
+ type: 'header',
+ text: { type: 'plain_text', text: '☀️ Morning Report' }
+ },
+ {
+ type: 'section',
+ text: { type: 'mrkdwn', text: '*System Health:* 95%' }
+ },
+ {
+ type: 'actions',
+ elements: [
+ {
+ type: 'button',
+ text: { type: 'plain_text', text: 'View Dashboard' },
+ url: 'http://45.61.58.125:9893'
+ }
+ ]
+ }
+];
+```
+
+### Threaded Replies
+
+Send detailed metrics as thread replies:
+
+```typescript
+// First, send main message and get timestamp
+const response = await fetch(webhookUrl, { ... });
+const ts = response.ts;
+
+// Then send threaded reply
+await fetch(webhookUrl, {
+ thread_ts: ts,
+ text: 'Detailed metrics...'
+});
+```
+
+### Slack App Features
+
+Beyond webhooks, you can add:
+- **Slash commands**: `/report morning`
+- **Interactive buttons**: Acknowledge issues
+- **Bot mentions**: `@DW-Agents status`
+- **Home tab**: Dashboard in Slack
+
+See: https://api.slack.com/start/building
+
+## Getting Help
+
+### Slack API Documentation
+- Webhooks: https://api.slack.com/messaging/webhooks
+- Message formatting: https://api.slack.com/reference/surfaces/formatting
+- Block Kit: https://api.slack.com/block-kit
+
+### Test Your Setup
+```bash
+cd /root/.claude/skills/daily-reporting
+tsx daily-report-runner.ts test
+```
+
+### Check Logs
+```bash
+tail -f /root/DW-Agents/logs/morning-report.log
+tail -f /root/DW-Agents/logs/eod-report.log
+```
+
+### Manual Test
+```bash
+cd /root/.claude/skills/daily-reporting
+tsx daily-report-runner.ts morning
+```
+
+---
+
+**Questions?** Check the main README.md or test with `tsx daily-report-runner.ts test`
diff --git a/agent-hierarchy.ts b/agent-hierarchy.ts
new file mode 100644
index 0000000..fc8ad5d
--- /dev/null
+++ b/agent-hierarchy.ts
@@ -0,0 +1,333 @@
+/**
+ * DW-Agents Organizational Hierarchy
+ *
+ * This defines the reporting structure for all agents in the system
+ */
+
+export interface Agent {
+ id: string;
+ name: string;
+ port: number;
+ url: string;
+ role: string;
+ department: string;
+ level: 'executive' | 'department_head' | 'support' | 'operations';
+ reportsTo?: string;
+ metrics: string[];
+ icon: string;
+ color: string;
+}
+
+export const AGENT_HIERARCHY: Agent[] = [
+ // EXECUTIVE LEVEL - President
+ {
+ id: 'master-hub',
+ name: 'Master Hub (President)',
+ port: 9893,
+ url: 'http://45.61.58.125:9893',
+ role: 'Central Command & Coordination',
+ department: 'Executive',
+ level: 'executive',
+ metrics: [
+ 'Total agents online',
+ 'System health score',
+ 'Critical alerts',
+ 'Daily task completion rate'
+ ],
+ icon: '👔',
+ color: '#1a1a2e'
+ },
+
+ // DEPARTMENT HEADS
+ {
+ id: 'legal',
+ name: 'Legal Team',
+ port: 9878,
+ url: 'http://45.61.58.125:9878',
+ role: 'Legal Compliance & Risk Management',
+ department: 'Legal',
+ level: 'department_head',
+ reportsTo: 'master-hub',
+ metrics: [
+ 'Settlement compliance checks',
+ 'Contract reviews completed',
+ 'Legal issues flagged',
+ 'Compliance score'
+ ],
+ icon: '⚖️',
+ color: '#dc143c'
+ },
+ {
+ id: 'accounting',
+ name: 'Accounting',
+ port: 9882,
+ url: 'http://45.61.58.125:9882',
+ role: 'Financial Management & Reporting',
+ department: 'Finance',
+ level: 'department_head',
+ reportsTo: 'master-hub',
+ metrics: [
+ 'Daily revenue',
+ 'Expenses tracked',
+ 'P&L accuracy',
+ 'Budget variance',
+ 'Outstanding invoices'
+ ],
+ icon: '💰',
+ color: '#43e97b'
+ },
+ {
+ id: 'marketing',
+ name: 'Marketing',
+ port: 9881,
+ url: 'http://45.61.58.125:9881',
+ role: 'Marketing Campaigns & Content',
+ department: 'Marketing',
+ level: 'department_head',
+ reportsTo: 'master-hub',
+ metrics: [
+ 'Blog posts published',
+ 'Social media engagement',
+ 'Email campaigns sent',
+ 'Lead generation',
+ 'Campaign ROI'
+ ],
+ icon: '📢',
+ color: '#f093fb'
+ },
+ {
+ id: 'purchasing',
+ name: 'Purchasing Office',
+ port: 9880,
+ url: 'http://45.61.58.125:9880',
+ role: 'Procurement & Vendor Management',
+ department: 'Operations',
+ level: 'department_head',
+ reportsTo: 'master-hub',
+ metrics: [
+ 'Orders placed',
+ 'Cost savings identified',
+ 'Vendor response time',
+ 'Inventory alerts',
+ 'Price comparisons run'
+ ],
+ icon: '🛒',
+ color: '#667eea'
+ },
+ {
+ id: 'digital-samples',
+ name: 'Digital Samples',
+ port: 9879,
+ url: 'http://45.61.58.125:9879',
+ role: 'Sample Processing & Delivery',
+ department: 'Operations',
+ level: 'department_head',
+ reportsTo: 'master-hub',
+ metrics: [
+ 'DIG-series orders processed',
+ 'Files delivered',
+ 'Processing time avg',
+ 'Customer satisfaction',
+ 'Pending requests'
+ ],
+ icon: '📦',
+ color: '#4facfe'
+ },
+ {
+ id: 'trend-research',
+ name: 'Trend Research',
+ port: 9883,
+ url: 'http://45.61.58.125:9883',
+ role: 'Market Intelligence & Analysis',
+ department: 'Strategy',
+ level: 'department_head',
+ reportsTo: 'master-hub',
+ metrics: [
+ 'Trends identified',
+ 'Market reports generated',
+ 'Competitor analysis',
+ 'Forecast accuracy'
+ ],
+ icon: '📊',
+ color: '#38b2ac'
+ },
+
+ // SUPPORT SERVICES
+ {
+ id: 'zendesk-chat',
+ name: 'Zendesk Chat',
+ port: 9884,
+ url: 'http://45.61.58.125:9884',
+ role: 'Customer Support & Chat',
+ department: 'Customer Service',
+ level: 'support',
+ reportsTo: 'master-hub',
+ metrics: [
+ 'Tickets handled',
+ 'Response time avg',
+ 'Customer satisfaction',
+ 'Open tickets',
+ 'Chat sessions'
+ ],
+ icon: '💬',
+ color: '#17a2b8'
+ },
+ {
+ id: 'shopify-store',
+ name: 'Shopify Store Manager',
+ port: 7238,
+ url: 'http://45.61.58.125:7238',
+ role: 'E-commerce Operations',
+ department: 'Sales',
+ level: 'support',
+ reportsTo: 'master-hub',
+ metrics: [
+ 'Orders processed',
+ 'Inventory sync status',
+ 'Product updates',
+ 'Store health score'
+ ],
+ icon: '🛍️',
+ color: '#96bf48'
+ },
+ {
+ id: 'server-uptime',
+ name: 'Server Uptime Monitor',
+ port: 7242,
+ url: 'http://45.61.58.125:7242',
+ role: 'Infrastructure Monitoring',
+ department: 'IT Operations',
+ level: 'support',
+ reportsTo: 'master-hub',
+ metrics: [
+ 'Server uptime %',
+ 'Response times',
+ 'Resource usage',
+ 'Incidents detected'
+ ],
+ icon: '🖥️',
+ color: '#6c757d'
+ },
+ {
+ id: 'log-monitor',
+ name: 'Log Monitor',
+ port: 7239,
+ url: 'http://45.61.58.125:7239',
+ role: 'Error Detection & Analysis',
+ department: 'IT Operations',
+ level: 'support',
+ reportsTo: 'master-hub',
+ metrics: [
+ 'Errors detected',
+ 'Critical issues',
+ 'Auto-resolved',
+ 'Logs analyzed'
+ ],
+ icon: '📝',
+ color: '#fd7e14'
+ },
+ {
+ id: 'ui-manager',
+ name: 'UI Manager',
+ port: 7240,
+ url: 'http://45.61.58.125:7240',
+ role: 'Design System & UX',
+ department: 'Product',
+ level: 'support',
+ reportsTo: 'master-hub',
+ metrics: [
+ 'UI consistency score',
+ 'Theme updates',
+ 'User feedback',
+ 'Accessibility score'
+ ],
+ icon: '🎨',
+ color: '#e83e8c'
+ },
+ {
+ id: 'restart-analyzer',
+ name: 'Restart Analyzer',
+ port: 7241,
+ url: 'http://45.61.58.125:7241',
+ role: 'System Health & Pattern Analysis',
+ department: 'IT Operations',
+ level: 'support',
+ reportsTo: 'master-hub',
+ metrics: [
+ 'Restart patterns detected',
+ 'Agent health scores',
+ 'Stability metrics',
+ 'Recommendations'
+ ],
+ icon: '🔄',
+ color: '#20c997'
+ },
+
+ // OPERATIONS & ORCHESTRATION
+ {
+ id: 'task-orchestrator',
+ name: 'Task Orchestrator',
+ port: 9900,
+ url: 'http://45.61.58.125:9900',
+ role: 'Task Routing & Coordination',
+ department: 'Operations',
+ level: 'operations',
+ reportsTo: 'master-hub',
+ metrics: [
+ 'Tasks routed',
+ 'Completion rate',
+ 'Agent utilization',
+ 'Queue depth'
+ ],
+ icon: '🎯',
+ color: '#6610f2'
+ },
+ {
+ id: 'needs-attention',
+ name: 'Needs Attention',
+ port: 7243,
+ url: 'http://45.61.58.125:7243',
+ role: 'Issue Detection & Escalation',
+ department: 'Operations',
+ level: 'operations',
+ reportsTo: 'master-hub',
+ metrics: [
+ 'Issues flagged',
+ 'Escalations',
+ 'Resolution time',
+ 'Priority distribution'
+ ],
+ icon: '⚠️',
+ color: '#ffc107'
+ }
+];
+
+/**
+ * Get agents by department
+ */
+export function getAgentsByDepartment(): Map<string, Agent[]> {
+ const departments = new Map<string, Agent[]>();
+
+ AGENT_HIERARCHY.forEach(agent => {
+ if (!departments.has(agent.department)) {
+ departments.set(agent.department, []);
+ }
+ departments.get(agent.department)!.push(agent);
+ });
+
+ return departments;
+}
+
+/**
+ * Get agents by reporting level
+ */
+export function getAgentsByLevel(level: Agent['level']): Agent[] {
+ return AGENT_HIERARCHY.filter(agent => agent.level === level);
+}
+
+/**
+ * Get direct reports for an agent
+ */
+export function getDirectReports(agentId: string): Agent[] {
+ return AGENT_HIERARCHY.filter(agent => agent.reportsTo === agentId);
+}
diff --git a/daily-report-runner.ts b/daily-report-runner.ts
new file mode 100755
index 0000000..764c607
--- /dev/null
+++ b/daily-report-runner.ts
@@ -0,0 +1,201 @@
+#!/usr/bin/env node
+/**
+ * Daily Report Runner
+ *
+ * Main entry point for generating and sending daily reports
+ * Can be run manually or via cron
+ */
+
+import { generateDailyReport } from './report-generator';
+import { sendToSlack, saveReportToFile, testSlackConnection } from './slack-notifier';
+
+// Configuration
+const SLACK_WEBHOOK_URL = process.env.SLACK_WEBHOOK_URL || '';
+const SLACK_CHANNEL = process.env.SLACK_CHANNEL || '#morning-report';
+const REPORTS_DIR = process.env.REPORTS_DIR || '/root/DW-Agents/reports';
+
+/**
+ * Main runner function
+ */
+async function runDailyReport(reportType: 'morning' | 'eod'): Promise<void> {
+ console.log(`\n${'='.repeat(60)}`);
+ console.log(`🤖 DW-AGENTS DAILY REPORTING SYSTEM`);
+ console.log(`${'='.repeat(60)}\n`);
+
+ console.log(`📊 Report Type: ${reportType.toUpperCase()}`);
+ console.log(`⏰ Started at: ${new Date().toLocaleString()}\n`);
+
+ try {
+ // Step 1: Generate report
+ console.log('📋 Step 1: Generating report...');
+ const report = await generateDailyReport(reportType);
+ console.log('✅ Report generated successfully\n');
+
+ // Step 2: Save to file
+ console.log('💾 Step 2: Saving report to file...');
+ const filepath = await saveReportToFile(report, REPORTS_DIR);
+ console.log(`✅ Report saved: ${filepath}\n`);
+
+ // Step 3: Send to Slack (if webhook configured)
+ if (SLACK_WEBHOOK_URL) {
+ console.log('📤 Step 3: Sending report to Slack...');
+
+ const slackConfig = {
+ webhookUrl: SLACK_WEBHOOK_URL,
+ channel: SLACK_CHANNEL,
+ username: 'DW-Agents Reporter',
+ iconEmoji: reportType === 'morning' ? ':sunrise:' : ':city_sunset:',
+ mentionChannelOnIssues: true
+ };
+
+ const success = await sendToSlack(report, slackConfig);
+
+ if (success) {
+ console.log(`✅ Report sent to Slack channel: ${SLACK_CHANNEL}\n`);
+ } else {
+ console.log('⚠️ Failed to send report to Slack (report saved to file)\n');
+ }
+ } else {
+ console.log('⏭️ Step 3: Skipping Slack (webhook not configured)\n');
+ }
+
+ // Summary
+ console.log('📊 REPORT SUMMARY:');
+ console.log(` System Health: ${report.executiveSummary.systemHealth}%`);
+ console.log(` Agents Online: ${report.executiveSummary.agentsOnline}/${report.executiveSummary.totalAgents}`);
+ console.log(` Tasks Completed: ${report.executiveSummary.tasksCompletedToday}`);
+ console.log(` Critical Issues: ${report.executiveSummary.criticalIssues}`);
+ console.log(` Q&A Readiness: ${report.qnaStatus.overallReadiness}%\n`);
+
+ if (report.issuesRequiringAttention.length > 0) {
+ console.log('⚠️ ISSUES REQUIRING ATTENTION:');
+ report.issuesRequiringAttention.slice(0, 5).forEach((issue, i) => {
+ console.log(` ${i + 1}. [${issue.severity.toUpperCase()}] ${issue.agent}: ${issue.issue}`);
+ });
+ console.log('');
+ }
+
+ console.log('✅ Daily report completed successfully!\n');
+ console.log(`${'='.repeat(60)}\n`);
+
+ } catch (error) {
+ console.error('\n❌ ERROR: Failed to generate daily report');
+ console.error(error);
+ console.log(`\n${'='.repeat(60)}\n`);
+ process.exit(1);
+ }
+}
+
+/**
+ * Test Slack webhook connection
+ */
+async function testSlack(): Promise<void> {
+ console.log('🧪 Testing Slack webhook connection...\n');
+
+ if (!SLACK_WEBHOOK_URL) {
+ console.error('❌ SLACK_WEBHOOK_URL environment variable not set');
+ console.log('\nTo configure Slack:');
+ console.log('1. Create a Slack incoming webhook at: https://api.slack.com/messaging/webhooks');
+ console.log('2. Set environment variable: export SLACK_WEBHOOK_URL="your-webhook-url"');
+ console.log('3. Optionally set channel: export SLACK_CHANNEL="#morning-report"\n');
+ process.exit(1);
+ }
+
+ const success = await testSlackConnection(SLACK_WEBHOOK_URL);
+
+ if (success) {
+ console.log(`✅ Slack connection successful!`);
+ console.log(` Channel: ${SLACK_CHANNEL}`);
+ console.log(' Check your Slack channel for a test message.\n');
+ } else {
+ console.error('❌ Slack connection failed!');
+ console.log(' Please check your webhook URL and try again.\n');
+ process.exit(1);
+ }
+}
+
+/**
+ * Display usage information
+ */
+function showUsage(): void {
+ console.log(`
+🤖 DW-AGENTS DAILY REPORTING SYSTEM
+
+USAGE:
+ tsx daily-report-runner.ts [command]
+
+COMMANDS:
+ morning Generate and send morning standup report (6:00 AM)
+ eod Generate and send end-of-day summary report (5:00 PM)
+ test Test Slack webhook connection
+ help Show this help message
+
+ENVIRONMENT VARIABLES:
+ SLACK_WEBHOOK_URL Required: Your Slack incoming webhook URL
+ SLACK_CHANNEL Optional: Target Slack channel (default: #morning-report)
+ REPORTS_DIR Optional: Directory for report backups (default: /root/DW-Agents/reports)
+
+EXAMPLES:
+ # Generate morning report
+ tsx daily-report-runner.ts morning
+
+ # Generate end-of-day report
+ tsx daily-report-runner.ts eod
+
+ # Test Slack connection
+ tsx daily-report-runner.ts test
+
+CRON SETUP:
+ # Add to crontab (crontab -e):
+ 0 6 * * * cd /root/.claude/skills/daily-reporting && /root/DW-Agents/node_modules/.bin/tsx daily-report-runner.ts morning
+ 0 17 * * * cd /root/.claude/skills/daily-reporting && /root/DW-Agents/node_modules/.bin/tsx daily-report-runner.ts eod
+
+SLACK SETUP:
+ 1. Go to: https://api.slack.com/messaging/webhooks
+ 2. Create an incoming webhook for your workspace
+ 3. Create a channel named #morning-report (or use existing)
+ 4. Copy the webhook URL
+ 5. Set environment variable:
+ export SLACK_WEBHOOK_URL="https://hooks.slack.com/services/YOUR/WEBHOOK/URL"
+ 6. Add to ~/.bashrc or ~/.profile to persist
+
+SLACK CHANNEL INVITATION:
+ To invite the webhook to your channel:
+ 1. Create or open the #morning-report channel
+ 2. Type: /invite @DW-Agents Reporter
+ 3. The webhook will be able to post messages
+
+`);
+}
+
+// Main execution
+if (require.main === module) {
+ const command = process.argv[2];
+
+ switch (command) {
+ case 'morning':
+ runDailyReport('morning');
+ break;
+
+ case 'eod':
+ runDailyReport('eod');
+ break;
+
+ case 'test':
+ testSlack();
+ break;
+
+ case 'help':
+ case '--help':
+ case '-h':
+ showUsage();
+ break;
+
+ default:
+ console.error('❌ Invalid command\n');
+ showUsage();
+ process.exit(1);
+ }
+}
+
+export { runDailyReport };
diff --git a/package-lock.json b/package-lock.json
new file mode 100644
index 0000000..b110730
--- /dev/null
+++ b/package-lock.json
@@ -0,0 +1,913 @@
+{
+ "name": "dw-agents-daily-reporting",
+ "version": "1.0.0",
+ "lockfileVersion": 3,
+ "requires": true,
+ "packages": {
+ "": {
+ "name": "dw-agents-daily-reporting",
+ "version": "1.0.0",
+ "license": "MIT",
+ "dependencies": {
+ "node-fetch": "^2.6.7"
+ },
+ "devDependencies": {
+ "@types/node": "^20.0.0",
+ "@types/node-fetch": "^2.6.2",
+ "tsx": "^4.0.0",
+ "typescript": "^5.0.0"
+ },
+ "engines": {
+ "node": ">=18.0.0"
+ }
+ },
+ "node_modules/@esbuild/aix-ppc64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.12.tgz",
+ "integrity": "sha512-Hhmwd6CInZ3dwpuGTF8fJG6yoWmsToE+vYgD4nytZVxcu1ulHpUQRAB1UJ8+N1Am3Mz4+xOByoQoSZf4D+CpkA==",
+ "cpu": [
+ "ppc64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "aix"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/android-arm": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.12.tgz",
+ "integrity": "sha512-VJ+sKvNA/GE7Ccacc9Cha7bpS8nyzVv0jdVgwNDaR4gDMC/2TTRc33Ip8qrNYUcpkOHUT5OZ0bUcNNVZQ9RLlg==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/android-arm64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.12.tgz",
+ "integrity": "sha512-6AAmLG7zwD1Z159jCKPvAxZd4y/VTO0VkprYy+3N2FtJ8+BQWFXU+OxARIwA46c5tdD9SsKGZ/1ocqBS/gAKHg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/android-x64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.12.tgz",
+ "integrity": "sha512-5jbb+2hhDHx5phYR2By8GTWEzn6I9UqR11Kwf22iKbNpYrsmRB18aX/9ivc5cabcUiAT/wM+YIZ6SG9QO6a8kg==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/darwin-arm64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.12.tgz",
+ "integrity": "sha512-N3zl+lxHCifgIlcMUP5016ESkeQjLj/959RxxNYIthIg+CQHInujFuXeWbWMgnTo4cp5XVHqFPmpyu9J65C1Yg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/darwin-x64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.12.tgz",
+ "integrity": "sha512-HQ9ka4Kx21qHXwtlTUVbKJOAnmG1ipXhdWTmNXiPzPfWKpXqASVcWdnf2bnL73wgjNrFXAa3yYvBSd9pzfEIpA==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/freebsd-arm64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.12.tgz",
+ "integrity": "sha512-gA0Bx759+7Jve03K1S0vkOu5Lg/85dou3EseOGUes8flVOGxbhDDh/iZaoek11Y8mtyKPGF3vP8XhnkDEAmzeg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "freebsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/freebsd-x64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.12.tgz",
+ "integrity": "sha512-TGbO26Yw2xsHzxtbVFGEXBFH0FRAP7gtcPE7P5yP7wGy7cXK2oO7RyOhL5NLiqTlBh47XhmIUXuGciXEqYFfBQ==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "freebsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-arm": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.12.tgz",
+ "integrity": "sha512-lPDGyC1JPDou8kGcywY0YILzWlhhnRjdof3UlcoqYmS9El818LLfJJc3PXXgZHrHCAKs/Z2SeZtDJr5MrkxtOw==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-arm64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.12.tgz",
+ "integrity": "sha512-8bwX7a8FghIgrupcxb4aUmYDLp8pX06rGh5HqDT7bB+8Rdells6mHvrFHHW2JAOPZUbnjUpKTLg6ECyzvas2AQ==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-ia32": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.12.tgz",
+ "integrity": "sha512-0y9KrdVnbMM2/vG8KfU0byhUN+EFCny9+8g202gYqSSVMonbsCfLjUO+rCci7pM0WBEtz+oK/PIwHkzxkyharA==",
+ "cpu": [
+ "ia32"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-loong64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.12.tgz",
+ "integrity": "sha512-h///Lr5a9rib/v1GGqXVGzjL4TMvVTv+s1DPoxQdz7l/AYv6LDSxdIwzxkrPW438oUXiDtwM10o9PmwS/6Z0Ng==",
+ "cpu": [
+ "loong64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-mips64el": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.12.tgz",
+ "integrity": "sha512-iyRrM1Pzy9GFMDLsXn1iHUm18nhKnNMWscjmp4+hpafcZjrr2WbT//d20xaGljXDBYHqRcl8HnxbX6uaA/eGVw==",
+ "cpu": [
+ "mips64el"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-ppc64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.12.tgz",
+ "integrity": "sha512-9meM/lRXxMi5PSUqEXRCtVjEZBGwB7P/D4yT8UG/mwIdze2aV4Vo6U5gD3+RsoHXKkHCfSxZKzmDssVlRj1QQA==",
+ "cpu": [
+ "ppc64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-riscv64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.12.tgz",
+ "integrity": "sha512-Zr7KR4hgKUpWAwb1f3o5ygT04MzqVrGEGXGLnj15YQDJErYu/BGg+wmFlIDOdJp0PmB0lLvxFIOXZgFRrdjR0w==",
+ "cpu": [
+ "riscv64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-s390x": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.12.tgz",
+ "integrity": "sha512-MsKncOcgTNvdtiISc/jZs/Zf8d0cl/t3gYWX8J9ubBnVOwlk65UIEEvgBORTiljloIWnBzLs4qhzPkJcitIzIg==",
+ "cpu": [
+ "s390x"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-x64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.12.tgz",
+ "integrity": "sha512-uqZMTLr/zR/ed4jIGnwSLkaHmPjOjJvnm6TVVitAa08SLS9Z0VM8wIRx7gWbJB5/J54YuIMInDquWyYvQLZkgw==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/netbsd-arm64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.12.tgz",
+ "integrity": "sha512-xXwcTq4GhRM7J9A8Gv5boanHhRa/Q9KLVmcyXHCTaM4wKfIpWkdXiMog/KsnxzJ0A1+nD+zoecuzqPmCRyBGjg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "netbsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/netbsd-x64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.12.tgz",
+ "integrity": "sha512-Ld5pTlzPy3YwGec4OuHh1aCVCRvOXdH8DgRjfDy/oumVovmuSzWfnSJg+VtakB9Cm0gxNO9BzWkj6mtO1FMXkQ==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "netbsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/openbsd-arm64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.12.tgz",
+ "integrity": "sha512-fF96T6KsBo/pkQI950FARU9apGNTSlZGsv1jZBAlcLL1MLjLNIWPBkj5NlSz8aAzYKg+eNqknrUJ24QBybeR5A==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "openbsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/openbsd-x64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.12.tgz",
+ "integrity": "sha512-MZyXUkZHjQxUvzK7rN8DJ3SRmrVrke8ZyRusHlP+kuwqTcfWLyqMOE3sScPPyeIXN/mDJIfGXvcMqCgYKekoQw==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "openbsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/openharmony-arm64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.25.12.tgz",
+ "integrity": "sha512-rm0YWsqUSRrjncSXGA7Zv78Nbnw4XL6/dzr20cyrQf7ZmRcsovpcRBdhD43Nuk3y7XIoW2OxMVvwuRvk9XdASg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "openharmony"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/sunos-x64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.12.tgz",
+ "integrity": "sha512-3wGSCDyuTHQUzt0nV7bocDy72r2lI33QL3gkDNGkod22EsYl04sMf0qLb8luNKTOmgF/eDEDP5BFNwoBKH441w==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "sunos"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/win32-arm64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.12.tgz",
+ "integrity": "sha512-rMmLrur64A7+DKlnSuwqUdRKyd3UE7oPJZmnljqEptesKM8wx9J8gx5u0+9Pq0fQQW8vqeKebwNXdfOyP+8Bsg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/win32-ia32": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.12.tgz",
+ "integrity": "sha512-HkqnmmBoCbCwxUKKNPBixiWDGCpQGVsrQfJoVGYLPT41XWF8lHuE5N6WhVia2n4o5QK5M4tYr21827fNhi4byQ==",
+ "cpu": [
+ "ia32"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/win32-x64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.12.tgz",
+ "integrity": "sha512-alJC0uCZpTFrSL0CCDjcgleBXPnCrEAhTBILpeAp7M/OFgoqtAetfBzX0xM00MUsVVPpVjlPuMbREqnZCXaTnA==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@types/node": {
+ "version": "20.19.24",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.24.tgz",
+ "integrity": "sha512-FE5u0ezmi6y9OZEzlJfg37mqqf6ZDSF2V/NLjUyGrR9uTZ7Sb9F7bLNZ03S4XVUNRWGA7Ck4c1kK+YnuWjl+DA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "undici-types": "~6.21.0"
+ }
+ },
+ "node_modules/@types/node-fetch": {
+ "version": "2.6.13",
+ "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.13.tgz",
+ "integrity": "sha512-QGpRVpzSaUs30JBSGPjOg4Uveu384erbHBoT1zeONvyCfwQxIkUshLAOqN/k9EjGviPRmWTTe6aH2qySWKTVSw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/node": "*",
+ "form-data": "^4.0.4"
+ }
+ },
+ "node_modules/asynckit": {
+ "version": "0.4.0",
+ "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
+ "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/call-bind-apply-helpers": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz",
+ "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "es-errors": "^1.3.0",
+ "function-bind": "^1.1.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/combined-stream": {
+ "version": "1.0.8",
+ "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
+ "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "delayed-stream": "~1.0.0"
+ },
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/delayed-stream": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
+ "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.4.0"
+ }
+ },
+ "node_modules/dunder-proto": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",
+ "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "call-bind-apply-helpers": "^1.0.1",
+ "es-errors": "^1.3.0",
+ "gopd": "^1.2.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/es-define-property": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz",
+ "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/es-errors": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",
+ "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/es-object-atoms": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz",
+ "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "es-errors": "^1.3.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/es-set-tostringtag": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz",
+ "integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "es-errors": "^1.3.0",
+ "get-intrinsic": "^1.2.6",
+ "has-tostringtag": "^1.0.2",
+ "hasown": "^2.0.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/esbuild": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.12.tgz",
+ "integrity": "sha512-bbPBYYrtZbkt6Os6FiTLCTFxvq4tt3JKall1vRwshA3fdVztsLAatFaZobhkBC8/BrPetoa0oksYoKXoG4ryJg==",
+ "dev": true,
+ "hasInstallScript": true,
+ "license": "MIT",
+ "bin": {
+ "esbuild": "bin/esbuild"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "optionalDependencies": {
+ "@esbuild/aix-ppc64": "0.25.12",
+ "@esbuild/android-arm": "0.25.12",
+ "@esbuild/android-arm64": "0.25.12",
+ "@esbuild/android-x64": "0.25.12",
+ "@esbuild/darwin-arm64": "0.25.12",
+ "@esbuild/darwin-x64": "0.25.12",
+ "@esbuild/freebsd-arm64": "0.25.12",
+ "@esbuild/freebsd-x64": "0.25.12",
+ "@esbuild/linux-arm": "0.25.12",
+ "@esbuild/linux-arm64": "0.25.12",
+ "@esbuild/linux-ia32": "0.25.12",
+ "@esbuild/linux-loong64": "0.25.12",
+ "@esbuild/linux-mips64el": "0.25.12",
+ "@esbuild/linux-ppc64": "0.25.12",
+ "@esbuild/linux-riscv64": "0.25.12",
+ "@esbuild/linux-s390x": "0.25.12",
+ "@esbuild/linux-x64": "0.25.12",
+ "@esbuild/netbsd-arm64": "0.25.12",
+ "@esbuild/netbsd-x64": "0.25.12",
+ "@esbuild/openbsd-arm64": "0.25.12",
+ "@esbuild/openbsd-x64": "0.25.12",
+ "@esbuild/openharmony-arm64": "0.25.12",
+ "@esbuild/sunos-x64": "0.25.12",
+ "@esbuild/win32-arm64": "0.25.12",
+ "@esbuild/win32-ia32": "0.25.12",
+ "@esbuild/win32-x64": "0.25.12"
+ }
+ },
+ "node_modules/form-data": {
+ "version": "4.0.4",
+ "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.4.tgz",
+ "integrity": "sha512-KrGhL9Q4zjj0kiUt5OO4Mr/A/jlI2jDYs5eHBpYHPcBEVSiipAvn2Ko2HnPe20rmcuuvMHNdZFp+4IlGTMF0Ow==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "asynckit": "^0.4.0",
+ "combined-stream": "^1.0.8",
+ "es-set-tostringtag": "^2.1.0",
+ "hasown": "^2.0.2",
+ "mime-types": "^2.1.12"
+ },
+ "engines": {
+ "node": ">= 6"
+ }
+ },
+ "node_modules/fsevents": {
+ "version": "2.3.3",
+ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
+ "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
+ "dev": true,
+ "hasInstallScript": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": "^8.16.0 || ^10.6.0 || >=11.0.0"
+ }
+ },
+ "node_modules/function-bind": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
+ "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
+ "dev": true,
+ "license": "MIT",
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/get-intrinsic": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
+ "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "call-bind-apply-helpers": "^1.0.2",
+ "es-define-property": "^1.0.1",
+ "es-errors": "^1.3.0",
+ "es-object-atoms": "^1.1.1",
+ "function-bind": "^1.1.2",
+ "get-proto": "^1.0.1",
+ "gopd": "^1.2.0",
+ "has-symbols": "^1.1.0",
+ "hasown": "^2.0.2",
+ "math-intrinsics": "^1.1.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/get-proto": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz",
+ "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "dunder-proto": "^1.0.1",
+ "es-object-atoms": "^1.0.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/get-tsconfig": {
+ "version": "4.13.0",
+ "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.13.0.tgz",
+ "integrity": "sha512-1VKTZJCwBrvbd+Wn3AOgQP/2Av+TfTCOlE4AcRJE72W1ksZXbAx8PPBR9RzgTeSPzlPMHrbANMH3LbltH73wxQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "resolve-pkg-maps": "^1.0.0"
+ },
+ "funding": {
+ "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1"
+ }
+ },
+ "node_modules/gopd": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz",
+ "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/has-symbols": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz",
+ "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/has-tostringtag": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz",
+ "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "has-symbols": "^1.0.3"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/hasown": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz",
+ "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "function-bind": "^1.1.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/math-intrinsics": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
+ "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/mime-db": {
+ "version": "1.52.0",
+ "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
+ "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/mime-types": {
+ "version": "2.1.35",
+ "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
+ "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "mime-db": "1.52.0"
+ },
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/node-fetch": {
+ "version": "2.7.0",
+ "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz",
+ "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==",
+ "license": "MIT",
+ "dependencies": {
+ "whatwg-url": "^5.0.0"
+ },
+ "engines": {
+ "node": "4.x || >=6.0.0"
+ },
+ "peerDependencies": {
+ "encoding": "^0.1.0"
+ },
+ "peerDependenciesMeta": {
+ "encoding": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/resolve-pkg-maps": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz",
+ "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==",
+ "dev": true,
+ "license": "MIT",
+ "funding": {
+ "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1"
+ }
+ },
+ "node_modules/tr46": {
+ "version": "0.0.3",
+ "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
+ "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==",
+ "license": "MIT"
+ },
+ "node_modules/tsx": {
+ "version": "4.20.6",
+ "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.20.6.tgz",
+ "integrity": "sha512-ytQKuwgmrrkDTFP4LjR0ToE2nqgy886GpvRSpU0JAnrdBYppuY5rLkRUYPU1yCryb24SsKBTL/hlDQAEFVwtZg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "esbuild": "~0.25.0",
+ "get-tsconfig": "^4.7.5"
+ },
+ "bin": {
+ "tsx": "dist/cli.mjs"
+ },
+ "engines": {
+ "node": ">=18.0.0"
+ },
+ "optionalDependencies": {
+ "fsevents": "~2.3.3"
+ }
+ },
+ "node_modules/typescript": {
+ "version": "5.9.3",
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz",
+ "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "bin": {
+ "tsc": "bin/tsc",
+ "tsserver": "bin/tsserver"
+ },
+ "engines": {
+ "node": ">=14.17"
+ }
+ },
+ "node_modules/undici-types": {
+ "version": "6.21.0",
+ "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz",
+ "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/webidl-conversions": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
+ "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==",
+ "license": "BSD-2-Clause"
+ },
+ "node_modules/whatwg-url": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
+ "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==",
+ "license": "MIT",
+ "dependencies": {
+ "tr46": "~0.0.3",
+ "webidl-conversions": "^3.0.0"
+ }
+ }
+ }
+}
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..6850348
--- /dev/null
+++ b/package.json
@@ -0,0 +1,36 @@
+{
+ "name": "dw-agents-daily-reporting",
+ "version": "1.0.0",
+ "description": "Comprehensive daily reporting system for DW-Agents hierarchy with morning standup and end-of-day reports",
+ "main": "daily-report-runner.ts",
+ "scripts": {
+ "morning": "tsx daily-report-runner.ts morning",
+ "eod": "tsx daily-report-runner.ts eod",
+ "test": "tsx daily-report-runner.ts test",
+ "setup": "./setup-cron.sh",
+ "logs:morning": "tail -f /root/DW-Agents/logs/morning-report.log",
+ "logs:eod": "tail -f /root/DW-Agents/logs/eod-report.log"
+ },
+ "keywords": [
+ "dw-agents",
+ "reporting",
+ "slack",
+ "automation",
+ "cron",
+ "monitoring"
+ ],
+ "author": "DW-Agents Team",
+ "license": "MIT",
+ "dependencies": {
+ "node-fetch": "^2.6.7"
+ },
+ "devDependencies": {
+ "@types/node": "^20.0.0",
+ "@types/node-fetch": "^2.6.2",
+ "tsx": "^4.0.0",
+ "typescript": "^5.0.0"
+ },
+ "engines": {
+ "node": ">=18.0.0"
+ }
+}
diff --git a/report-generator.ts b/report-generator.ts
new file mode 100644
index 0000000..4b22ee8
--- /dev/null
+++ b/report-generator.ts
@@ -0,0 +1,335 @@
+/**
+ * Daily Report Generator for DW-Agents
+ *
+ * Generates comprehensive morning and end-of-day reports
+ */
+
+import fetch from 'node-fetch';
+import { AGENT_HIERARCHY, getAgentsByDepartment, getAgentsByLevel, type Agent } from './agent-hierarchy';
+
+export interface AgentMetrics {
+ agentId: string;
+ agentName: string;
+ status: 'online' | 'offline' | 'degraded';
+ uptime: number;
+ responseTime: number;
+ tasksCompleted: number;
+ errorsToday: number;
+ customMetrics: Record<string, any>;
+ lastActivity: string;
+ qnaReadiness: number; // 0-100 score
+}
+
+export interface DepartmentReport {
+ department: string;
+ agentsCount: number;
+ onlineCount: number;
+ totalTasks: number;
+ issues: string[];
+ highlights: string[];
+ metrics: AgentMetrics[];
+}
+
+export interface DailyReport {
+ reportType: 'morning' | 'eod';
+ timestamp: string;
+ executiveSummary: {
+ systemHealth: number;
+ agentsOnline: number;
+ totalAgents: number;
+ criticalIssues: number;
+ tasksCompletedToday: number;
+ topAchievements: string[];
+ };
+ departmentReports: DepartmentReport[];
+ issuesRequiringAttention: Array<{
+ severity: 'critical' | 'high' | 'medium' | 'low';
+ agent: string;
+ issue: string;
+ actionRequired: string;
+ }>;
+ actionItems: string[];
+ qnaStatus: {
+ overallReadiness: number;
+ agentReadiness: Array<{ agent: string; score: number; recentActivities: string[] }>;
+ };
+}
+
+/**
+ * Fetch metrics from an agent
+ */
+async function fetchAgentMetrics(agent: Agent): Promise<AgentMetrics> {
+ try {
+ const response = await fetch(`${agent.url}/api/metrics`, {
+ timeout: 5000,
+ headers: { 'Accept': 'application/json' }
+ });
+
+ if (!response.ok) {
+ throw new Error(`HTTP ${response.status}`);
+ }
+
+ const data = await response.json() as any;
+
+ return {
+ agentId: agent.id,
+ agentName: agent.name,
+ status: 'online',
+ uptime: data.uptime || 0,
+ responseTime: data.responseTime || 0,
+ tasksCompleted: data.tasksCompleted || 0,
+ errorsToday: data.errorsToday || 0,
+ customMetrics: data.customMetrics || {},
+ lastActivity: data.lastActivity || new Date().toISOString(),
+ qnaReadiness: data.qnaReadiness || 75
+ };
+ } catch (error) {
+ console.error(`Failed to fetch metrics from ${agent.name}:`, error);
+
+ // Return offline status with default values
+ return {
+ agentId: agent.id,
+ agentName: agent.name,
+ status: 'offline',
+ uptime: 0,
+ responseTime: 0,
+ tasksCompleted: 0,
+ errorsToday: 0,
+ customMetrics: {},
+ lastActivity: 'N/A',
+ qnaReadiness: 0
+ };
+ }
+}
+
+/**
+ * Fetch metrics from all agents concurrently
+ */
+async function fetchAllAgentMetrics(): Promise<Map<string, AgentMetrics>> {
+ const metricsMap = new Map<string, AgentMetrics>();
+
+ const promises = AGENT_HIERARCHY.map(agent =>
+ fetchAgentMetrics(agent).then(metrics => {
+ metricsMap.set(agent.id, metrics);
+ })
+ );
+
+ await Promise.allSettled(promises);
+
+ return metricsMap;
+}
+
+/**
+ * Generate department reports
+ */
+function generateDepartmentReports(metricsMap: Map<string, AgentMetrics>): DepartmentReport[] {
+ const departments = getAgentsByDepartment();
+ const reports: DepartmentReport[] = [];
+
+ for (const [department, agents] of departments) {
+ const metrics = agents
+ .map(agent => metricsMap.get(agent.id))
+ .filter(m => m !== undefined) as AgentMetrics[];
+
+ const onlineCount = metrics.filter(m => m.status === 'online').length;
+ const totalTasks = metrics.reduce((sum, m) => sum + m.tasksCompleted, 0);
+
+ const issues: string[] = [];
+ const highlights: string[] = [];
+
+ metrics.forEach(m => {
+ if (m.status === 'offline') {
+ issues.push(`${m.agentName} is offline`);
+ } else if (m.errorsToday > 10) {
+ issues.push(`${m.agentName} has ${m.errorsToday} errors today`);
+ }
+
+ if (m.tasksCompleted > 50) {
+ highlights.push(`${m.agentName} completed ${m.tasksCompleted} tasks`);
+ }
+ });
+
+ reports.push({
+ department,
+ agentsCount: agents.length,
+ onlineCount,
+ totalTasks,
+ issues,
+ highlights,
+ metrics
+ });
+ }
+
+ return reports;
+}
+
+/**
+ * Generate executive summary
+ */
+function generateExecutiveSummary(
+ metricsMap: Map<string, AgentMetrics>,
+ departmentReports: DepartmentReport[]
+): DailyReport['executiveSummary'] {
+ const allMetrics = Array.from(metricsMap.values());
+ const onlineCount = allMetrics.filter(m => m.status === 'online').length;
+ const totalTasks = allMetrics.reduce((sum, m) => sum + m.tasksCompleted, 0);
+
+ const criticalIssues = departmentReports.reduce((sum, dept) => {
+ return sum + dept.issues.filter(i => i.includes('offline') || i.includes('critical')).length;
+ }, 0);
+
+ const topAchievements: string[] = [];
+ departmentReports.forEach(dept => {
+ if (dept.highlights.length > 0) {
+ topAchievements.push(...dept.highlights.slice(0, 2));
+ }
+ });
+
+ const systemHealth = Math.round((onlineCount / allMetrics.length) * 100);
+
+ return {
+ systemHealth,
+ agentsOnline: onlineCount,
+ totalAgents: allMetrics.length,
+ criticalIssues,
+ tasksCompletedToday: totalTasks,
+ topAchievements: topAchievements.slice(0, 5)
+ };
+}
+
+/**
+ * Identify issues requiring attention
+ */
+function identifyIssues(
+ metricsMap: Map<string, AgentMetrics>,
+ departmentReports: DepartmentReport[]
+): DailyReport['issuesRequiringAttention'] {
+ const issues: DailyReport['issuesRequiringAttention'] = [];
+
+ for (const [agentId, metrics] of metricsMap) {
+ if (metrics.status === 'offline') {
+ issues.push({
+ severity: 'critical',
+ agent: metrics.agentName,
+ issue: 'Agent is offline',
+ actionRequired: 'Restart agent and investigate cause'
+ });
+ }
+
+ if (metrics.errorsToday > 20) {
+ issues.push({
+ severity: 'high',
+ agent: metrics.agentName,
+ issue: `${metrics.errorsToday} errors detected today`,
+ actionRequired: 'Review error logs and fix underlying issues'
+ });
+ }
+
+ if (metrics.responseTime > 2000) {
+ issues.push({
+ severity: 'medium',
+ agent: metrics.agentName,
+ issue: `Slow response time (${metrics.responseTime}ms)`,
+ actionRequired: 'Optimize performance or scale resources'
+ });
+ }
+
+ if (metrics.qnaReadiness < 50) {
+ issues.push({
+ severity: 'medium',
+ agent: metrics.agentName,
+ issue: 'Low Q&A readiness score',
+ actionRequired: 'Update agent knowledge base and test responses'
+ });
+ }
+ }
+
+ return issues.sort((a, b) => {
+ const severityOrder = { critical: 0, high: 1, medium: 2, low: 3 };
+ return severityOrder[a.severity] - severityOrder[b.severity];
+ });
+}
+
+/**
+ * Generate Q&A readiness status
+ */
+function generateQnaStatus(metricsMap: Map<string, AgentMetrics>): DailyReport['qnaStatus'] {
+ const allMetrics = Array.from(metricsMap.values());
+ const avgReadiness = allMetrics.reduce((sum, m) => sum + m.qnaReadiness, 0) / allMetrics.length;
+
+ const agentReadiness = allMetrics
+ .map(m => ({
+ agent: m.agentName,
+ score: m.qnaReadiness,
+ recentActivities: [
+ `${m.tasksCompleted} tasks completed`,
+ `Last active: ${m.lastActivity}`,
+ `Status: ${m.status}`
+ ]
+ }))
+ .sort((a, b) => b.score - a.score);
+
+ return {
+ overallReadiness: Math.round(avgReadiness),
+ agentReadiness
+ };
+}
+
+/**
+ * Generate action items
+ */
+function generateActionItems(
+ departmentReports: DepartmentReport[],
+ issues: DailyReport['issuesRequiringAttention']
+): string[] {
+ const actionItems: string[] = [];
+
+ // Critical actions from issues
+ issues.slice(0, 5).forEach(issue => {
+ actionItems.push(`[${issue.severity.toUpperCase()}] ${issue.agent}: ${issue.actionRequired}`);
+ });
+
+ // Department-specific actions
+ departmentReports.forEach(dept => {
+ if (dept.onlineCount < dept.agentsCount) {
+ actionItems.push(`${dept.department}: Bring ${dept.agentsCount - dept.onlineCount} offline agents back online`);
+ }
+ });
+
+ return actionItems;
+}
+
+/**
+ * Generate complete daily report
+ */
+export async function generateDailyReport(reportType: 'morning' | 'eod'): Promise<DailyReport> {
+ console.log(`Generating ${reportType} report...`);
+
+ // Fetch all metrics
+ const metricsMap = await fetchAllAgentMetrics();
+
+ // Generate department reports
+ const departmentReports = generateDepartmentReports(metricsMap);
+
+ // Generate executive summary
+ const executiveSummary = generateExecutiveSummary(metricsMap, departmentReports);
+
+ // Identify issues
+ const issuesRequiringAttention = identifyIssues(metricsMap, departmentReports);
+
+ // Generate Q&A status
+ const qnaStatus = generateQnaStatus(metricsMap);
+
+ // Generate action items
+ const actionItems = generateActionItems(departmentReports, issuesRequiringAttention);
+
+ return {
+ reportType,
+ timestamp: new Date().toISOString(),
+ executiveSummary,
+ departmentReports,
+ issuesRequiringAttention,
+ actionItems,
+ qnaStatus
+ };
+}
diff --git a/send-report-to-steve.sh b/send-report-to-steve.sh
new file mode 100755
index 0000000..da87c8e
--- /dev/null
+++ b/send-report-to-steve.sh
@@ -0,0 +1,123 @@
+#!/bin/bash
+###############################################################################
+# Send Daily Report to Steve via #claude-to-steve
+#
+# This script runs the daily report and sends it to Steve using the
+# existing DW-MCP dm-user.js Slack Bot API integration
+###############################################################################
+
+set -e
+
+REPORT_TYPE="${1:-morning}"
+SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+DW_MCP_DIR="/root/Projects/Designer-Wallcoverings/DW-MCP"
+
+echo "========================================"
+echo "📊 Daily Report to Steve - $REPORT_TYPE"
+echo "========================================"
+echo ""
+
+# Step 1: Generate the report and save to file
+echo "1️⃣ Generating $REPORT_TYPE report..."
+cd "$SCRIPT_DIR"
+export REPORTS_DIR="/root/DW-Agents/reports"
+/root/DW-Agents/node_modules/.bin/tsx daily-report-runner.ts "$REPORT_TYPE" 2>&1 | tee /tmp/daily-report-$REPORT_TYPE.log
+
+# Get the most recent report file
+LATEST_REPORT=$(ls -t /root/DW-Agents/reports/$REPORT_TYPE-report-*.json 2>/dev/null | head -1)
+
+if [ -z "$LATEST_REPORT" ]; then
+ echo "❌ Error: No report file generated"
+ exit 1
+fi
+
+echo "✅ Report generated: $LATEST_REPORT"
+echo ""
+
+# Step 2: Extract summary from report
+echo "2️⃣ Extracting report summary..."
+
+SYSTEM_HEALTH=$(jq -r '.executiveSummary.systemHealth' "$LATEST_REPORT")
+AGENTS_ONLINE=$(jq -r '.executiveSummary.agentsOnline' "$LATEST_REPORT")
+TOTAL_AGENTS=$(jq -r '.executiveSummary.totalAgents' "$LATEST_REPORT")
+CRITICAL_ISSUES=$(jq -r '.executiveSummary.criticalIssues' "$LATEST_REPORT")
+TASKS_COMPLETED=$(jq -r '.executiveSummary.tasksCompletedToday' "$LATEST_REPORT")
+QNA_READINESS=$(jq -r '.qnaStatus.overallReadiness' "$LATEST_REPORT")
+
+# Get current date/time
+REPORT_TIME=$(date '+%A, %B %d, %Y at %I:%M %p')
+
+# Build the Slack message
+if [ "$REPORT_TYPE" == "morning" ]; then
+ EMOJI="☀️"
+ TITLE="MORNING STANDUP REPORT"
+else
+ EMOJI="🌙"
+ TITLE="END-OF-DAY SUMMARY REPORT"
+fi
+
+MESSAGE="$EMOJI *$TITLE*
+$REPORT_TIME
+
+*📊 EXECUTIVE SUMMARY*
+• System Health: *${SYSTEM_HEALTH}%*
+• Agents Online: *${AGENTS_ONLINE}/${TOTAL_AGENTS}*
+• Tasks Completed Today: *${TASKS_COMPLETED}*
+• Critical Issues: *${CRITICAL_ISSUES}*
+• Q&A Readiness: *${QNA_READINESS}%*
+
+*🎯 KEY HIGHLIGHTS*"
+
+# Add top 3 highlights
+HIGHLIGHT_COUNT=0
+for i in 0 1 2; do
+ HIGHLIGHT=$(jq -r ".executiveSummary.keyHighlights[$i] // empty" "$LATEST_REPORT")
+ if [ -n "$HIGHLIGHT" ]; then
+ MESSAGE="$MESSAGE
+• $HIGHLIGHT"
+ HIGHLIGHT_COUNT=$((HIGHLIGHT_COUNT + 1))
+ fi
+done
+
+# Add critical issues if any
+if [ "$CRITICAL_ISSUES" -gt 0 ]; then
+ MESSAGE="$MESSAGE
+
+*🚨 ISSUES REQUIRING ATTENTION*"
+
+ for i in 0 1 2; do
+ ISSUE_AGENT=$(jq -r ".issuesRequiringAttention[$i].agent // empty" "$LATEST_REPORT")
+ ISSUE_TEXT=$(jq -r ".issuesRequiringAttention[$i].issue // empty" "$LATEST_REPORT")
+ ISSUE_SEVERITY=$(jq -r ".issuesRequiringAttention[$i].severity // empty" "$LATEST_REPORT")
+
+ if [ -n "$ISSUE_AGENT" ] && [ -n "$ISSUE_TEXT" ]; then
+ MESSAGE="$MESSAGE
+• [$ISSUE_SEVERITY] $ISSUE_AGENT: $ISSUE_TEXT"
+ fi
+ done
+fi
+
+MESSAGE="$MESSAGE
+
+📁 Full report saved to: \`$(basename $LATEST_REPORT)\`
+🌐 Dashboard: http://45.61.58.125:9893"
+
+echo "✅ Message prepared"
+echo ""
+
+# Step 3: Send to Steve via dm-user.js
+echo "3️⃣ Sending to Steve via #claude-to-steve..."
+
+cd "$DW_MCP_DIR"
+node dm-user.js "steve" "$MESSAGE"
+
+if [ $? -eq 0 ]; then
+ echo ""
+ echo "✅ Report successfully sent to Steve!"
+ echo "========================================"
+else
+ echo ""
+ echo "❌ Failed to send report to Steve"
+ echo "========================================"
+ exit 1
+fi
diff --git a/setup-cron.sh b/setup-cron.sh
new file mode 100755
index 0000000..10ec982
--- /dev/null
+++ b/setup-cron.sh
@@ -0,0 +1,173 @@
+#!/bin/bash
+#
+# Setup Cron Jobs for Daily Reporting
+#
+# This script configures automated daily reports:
+# - Morning standup at 6:00 AM
+# - End-of-day summary at 5:00 PM
+#
+
+set -e
+
+echo "=============================================="
+echo "🤖 DW-AGENTS DAILY REPORTING CRON SETUP"
+echo "=============================================="
+echo ""
+
+# Check if running as root
+if [ "$EUID" -eq 0 ]; then
+ echo "⚠️ Warning: Running as root. Cron will be set up for root user."
+ echo ""
+fi
+
+# Paths
+SKILL_DIR="/root/.claude/skills/daily-reporting"
+TSX_PATH="/root/DW-Agents/node_modules/.bin/tsx"
+RUNNER_SCRIPT="$SKILL_DIR/daily-report-runner.ts"
+LOG_DIR="/root/DW-Agents/logs"
+
+# Verify files exist
+echo "📋 Checking prerequisites..."
+
+if [ ! -f "$TSX_PATH" ]; then
+ echo "❌ Error: tsx not found at $TSX_PATH"
+ echo " Please install dependencies: cd /root/DW-Agents && npm install"
+ exit 1
+fi
+
+if [ ! -f "$RUNNER_SCRIPT" ]; then
+ echo "❌ Error: Runner script not found at $RUNNER_SCRIPT"
+ exit 1
+fi
+
+echo "✅ All prerequisites found"
+echo ""
+
+# Create log directory
+mkdir -p "$LOG_DIR"
+
+# Check if SLACK_WEBHOOK_URL is set
+echo "🔍 Checking Slack configuration..."
+if [ -z "$SLACK_WEBHOOK_URL" ]; then
+ echo "⚠️ Warning: SLACK_WEBHOOK_URL not set in environment"
+ echo " Reports will be saved to files only (no Slack notifications)"
+ echo ""
+ read -p "Do you want to configure Slack webhook now? (y/N) " -n 1 -r
+ echo ""
+ if [[ $REPLY =~ ^[Yy]$ ]]; then
+ read -p "Enter Slack webhook URL: " WEBHOOK_URL
+
+ # Add to .bashrc for persistence
+ if ! grep -q "SLACK_WEBHOOK_URL" ~/.bashrc; then
+ echo "" >> ~/.bashrc
+ echo "# DW-Agents Daily Reporting Slack Configuration" >> ~/.bashrc
+ echo "export SLACK_WEBHOOK_URL=\"$WEBHOOK_URL\"" >> ~/.bashrc
+ echo "export SLACK_CHANNEL=\"#morning-report\"" >> ~/.bashrc
+ echo "✅ Added SLACK_WEBHOOK_URL to ~/.bashrc"
+ fi
+
+ export SLACK_WEBHOOK_URL="$WEBHOOK_URL"
+ export SLACK_CHANNEL="${SLACK_CHANNEL:-#morning-report}"
+
+ echo "✅ Slack webhook configured"
+ echo ""
+ fi
+else
+ echo "✅ Slack webhook found: ${SLACK_WEBHOOK_URL:0:50}..."
+ echo " Channel: ${SLACK_CHANNEL:-#morning-report}"
+ echo ""
+fi
+
+# Create cron entries
+echo "📅 Setting up cron jobs..."
+echo ""
+
+# Backup existing crontab
+crontab -l > /tmp/crontab.backup 2>/dev/null || true
+
+# Remove any existing daily-reporting cron jobs
+crontab -l 2>/dev/null | grep -v "daily-report-runner.ts" > /tmp/crontab.new || true
+
+# Add environment variables export
+cat >> /tmp/crontab.new << EOF
+
+# DW-Agents Daily Reporting System
+# Generated on $(date)
+SLACK_WEBHOOK_URL=${SLACK_WEBHOOK_URL:-}
+SLACK_CHANNEL=${SLACK_CHANNEL:-#morning-report}
+REPORTS_DIR=$LOG_DIR
+
+# Morning standup report at 6:00 AM daily
+0 6 * * * cd $SKILL_DIR && $TSX_PATH daily-report-runner.ts morning >> $LOG_DIR/morning-report.log 2>&1
+
+# End-of-day summary at 5:00 PM daily
+0 17 * * * cd $SKILL_DIR && $TSX_PATH daily-report-runner.ts eod >> $LOG_DIR/eod-report.log 2>&1
+
+EOF
+
+# Install new crontab
+crontab /tmp/crontab.new
+
+echo "✅ Cron jobs installed successfully!"
+echo ""
+echo "📋 Installed cron jobs:"
+echo " • Morning report: Daily at 6:00 AM"
+echo " • EOD report: Daily at 5:00 PM"
+echo ""
+echo "📝 Logs will be saved to:"
+echo " • Morning: $LOG_DIR/morning-report.log"
+echo " • EOD: $LOG_DIR/eod-report.log"
+echo ""
+
+# Show current crontab
+echo "📅 Current crontab:"
+crontab -l | tail -10
+echo ""
+
+# Test report generation
+echo "🧪 Testing report generation..."
+read -p "Do you want to run a test report now? (Y/n) " -n 1 -r
+echo ""
+if [[ ! $REPLY =~ ^[Nn]$ ]]; then
+ echo ""
+ echo "Running test morning report..."
+ cd "$SKILL_DIR"
+ $TSX_PATH daily-report-runner.ts morning
+fi
+
+echo ""
+echo "=============================================="
+echo "✅ SETUP COMPLETE!"
+echo "=============================================="
+echo ""
+echo "NEXT STEPS:"
+echo ""
+echo "1. Verify cron is running:"
+echo " systemctl status cron"
+echo ""
+echo "2. Monitor report logs:"
+echo " tail -f $LOG_DIR/morning-report.log"
+echo ""
+echo "3. Test Slack connection:"
+echo " cd $SKILL_DIR"
+echo " $TSX_PATH daily-report-runner.ts test"
+echo ""
+echo "4. Manual report generation:"
+echo " cd $SKILL_DIR"
+echo " $TSX_PATH daily-report-runner.ts morning"
+echo " $TSX_PATH daily-report-runner.ts eod"
+echo ""
+echo "5. View scheduled jobs:"
+echo " crontab -l"
+echo ""
+echo "6. Remove cron jobs:"
+echo " crontab -e # Remove the daily-report lines"
+echo ""
+echo "SLACK CHANNEL SETUP:"
+echo "1. Create #morning-report channel in Slack"
+echo "2. The webhook will automatically post there"
+echo "3. Optional: Invite team members to the channel"
+echo ""
+
+# Cleanup
+rm -f /tmp/crontab.new
diff --git a/skill.json b/skill.json
new file mode 100644
index 0000000..70a8cd4
--- /dev/null
+++ b/skill.json
@@ -0,0 +1,34 @@
+{
+ "name": "daily-reporting",
+ "version": "1.0.0",
+ "description": "Comprehensive daily reporting system for DW-Agents hierarchy with morning standup and end-of-day reports",
+ "author": "DW-Agents Team",
+ "triggers": ["daily report", "morning standup", "eod report", "agent status"],
+ "capabilities": [
+ "Automated morning standup reports (6:00 AM)",
+ "End-of-day summary reports (5:00 PM)",
+ "Hierarchical agent data collection",
+ "Slack channel integration",
+ "Executive summary generation",
+ "Issue detection and escalation",
+ "Q&A readiness metrics",
+ "Agent health monitoring"
+ ],
+ "cron_schedules": [
+ {
+ "name": "morning-standup",
+ "schedule": "0 6 * * *",
+ "description": "Morning standup report at 6:00 AM daily"
+ },
+ {
+ "name": "end-of-day",
+ "schedule": "0 17 * * *",
+ "description": "End-of-day summary at 5:00 PM daily"
+ }
+ ],
+ "slack_config": {
+ "channel": "morning-report",
+ "webhook_url_env": "SLACK_WEBHOOK_URL",
+ "mention_channel_on_issues": true
+ }
+}
diff --git a/slack-formatter.ts b/slack-formatter.ts
new file mode 100644
index 0000000..cdbbbbe
--- /dev/null
+++ b/slack-formatter.ts
@@ -0,0 +1,295 @@
+/**
+ * Slack Message Formatter for Daily Reports
+ *
+ * Formats daily reports into clean Slack markdown with charts and metrics
+ */
+
+import type { DailyReport } from './report-generator';
+
+/**
+ * Generate a health bar visualization
+ */
+function generateHealthBar(percentage: number, width: number = 20): string {
+ const filled = Math.round((percentage / 100) * width);
+ const empty = width - filled;
+
+ const filledChar = percentage >= 80 ? '🟢' : percentage >= 60 ? '🟡' : '🔴';
+ const emptyChar = '⚪';
+
+ return filledChar.repeat(Math.max(0, filled)) + emptyChar.repeat(Math.max(0, empty)) + ` ${percentage}%`;
+}
+
+/**
+ * Format severity emoji
+ */
+function getSeverityEmoji(severity: string): string {
+ switch (severity) {
+ case 'critical': return '🚨';
+ case 'high': return '⚠️';
+ case 'medium': return '⚡';
+ case 'low': return 'ℹ️';
+ default: return '•';
+ }
+}
+
+/**
+ * Format status emoji
+ */
+function getStatusEmoji(status: string): string {
+ switch (status) {
+ case 'online': return '✅';
+ case 'offline': return '❌';
+ case 'degraded': return '⚠️';
+ default: return '❓';
+ }
+}
+
+/**
+ * Format report header
+ */
+function formatHeader(report: DailyReport): string {
+ const emoji = report.reportType === 'morning' ? '☀️' : '🌙';
+ const title = report.reportType === 'morning' ? 'MORNING STANDUP REPORT' : 'END-OF-DAY SUMMARY';
+ const date = new Date(report.timestamp).toLocaleDateString('en-US', {
+ weekday: 'long',
+ year: 'numeric',
+ month: 'long',
+ day: 'numeric'
+ });
+
+ return `${emoji} *${title}*\n${date}\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n`;
+}
+
+/**
+ * Format executive summary
+ */
+function formatExecutiveSummary(summary: DailyReport['executiveSummary']): string {
+ let text = '*📊 EXECUTIVE SUMMARY*\n\n';
+
+ text += `*System Health:* ${generateHealthBar(summary.systemHealth, 15)}\n`;
+ text += `*Agents Online:* ${summary.agentsOnline}/${summary.totalAgents}\n`;
+ text += `*Tasks Completed Today:* ${summary.tasksCompletedToday}\n`;
+ text += `*Critical Issues:* ${summary.criticalIssues === 0 ? '✅ None' : `🚨 ${summary.criticalIssues}`}\n\n`;
+
+ if (summary.topAchievements.length > 0) {
+ text += '*🏆 Top Achievements:*\n';
+ summary.topAchievements.forEach((achievement, index) => {
+ text += ` ${index + 1}. ${achievement}\n`;
+ });
+ }
+
+ return text + '\n';
+}
+
+/**
+ * Format department reports
+ */
+function formatDepartmentReports(reports: DailyReport['departmentReports']): string {
+ let text = '*🏢 DEPARTMENT REPORTS*\n\n';
+
+ // Group by executive, department heads, and support
+ const sortedReports = [...reports].sort((a, b) => {
+ const order: Record<string, number> = {
+ 'Executive': 0,
+ 'Legal': 1,
+ 'Finance': 2,
+ 'Marketing': 3,
+ 'Operations': 4,
+ 'Strategy': 5,
+ 'Customer Service': 6,
+ 'Sales': 7,
+ 'IT Operations': 8,
+ 'Product': 9
+ };
+ return (order[a.department] || 99) - (order[b.department] || 99);
+ });
+
+ for (const dept of sortedReports) {
+ const healthPercentage = Math.round((dept.onlineCount / dept.agentsCount) * 100);
+
+ text += `*${dept.department}* (${dept.onlineCount}/${dept.agentsCount} online)\n`;
+ text += `${generateHealthBar(healthPercentage, 10)}\n`;
+ text += `Tasks Completed: ${dept.totalTasks}\n`;
+
+ // Show agent details
+ dept.metrics.forEach(metric => {
+ text += ` ${getStatusEmoji(metric.status)} _${metric.agentName}_`;
+ if (metric.status === 'online') {
+ text += ` • ${metric.tasksCompleted} tasks`;
+ if (metric.errorsToday > 0) {
+ text += ` • ⚠️ ${metric.errorsToday} errors`;
+ }
+ }
+ text += '\n';
+ });
+
+ // Highlights
+ if (dept.highlights.length > 0) {
+ text += ' ✨ *Highlights:*\n';
+ dept.highlights.forEach(h => text += ` • ${h}\n`);
+ }
+
+ // Issues
+ if (dept.issues.length > 0) {
+ text += ' ⚠️ *Issues:*\n';
+ dept.issues.forEach(i => text += ` • ${i}\n`);
+ }
+
+ text += '\n';
+ }
+
+ return text;
+}
+
+/**
+ * Format issues requiring attention
+ */
+function formatIssues(issues: DailyReport['issuesRequiringAttention']): string {
+ if (issues.length === 0) {
+ return '*🎉 ISSUES REQUIRING ATTENTION*\n\n✅ *No critical issues detected!* All systems operational.\n\n';
+ }
+
+ let text = '*🚨 ISSUES REQUIRING ATTENTION*\n\n';
+
+ issues.forEach((issue, index) => {
+ text += `${getSeverityEmoji(issue.severity)} *[${issue.severity.toUpperCase()}]* ${issue.agent}\n`;
+ text += ` _Issue:_ ${issue.issue}\n`;
+ text += ` _Action:_ ${issue.actionRequired}\n\n`;
+ });
+
+ return text;
+}
+
+/**
+ * Format action items
+ */
+function formatActionItems(actionItems: string[]): string {
+ if (actionItems.length === 0) {
+ return '*✅ ACTION ITEMS*\n\nNo pending action items.\n\n';
+ }
+
+ let text = '*✅ ACTION ITEMS*\n\n';
+
+ actionItems.forEach((item, index) => {
+ text += `${index + 1}. ${item}\n`;
+ });
+
+ return text + '\n';
+}
+
+/**
+ * Format Q&A readiness status
+ */
+function formatQnaStatus(qnaStatus: DailyReport['qnaStatus']): string {
+ let text = '*💬 Q&A READINESS STATUS*\n\n';
+
+ text += `*Overall Readiness:* ${generateHealthBar(qnaStatus.overallReadiness, 15)}\n\n`;
+
+ text += '*Agent Readiness Scores:*\n';
+ qnaStatus.agentReadiness.slice(0, 10).forEach(agent => {
+ const emoji = agent.score >= 80 ? '🟢' : agent.score >= 60 ? '🟡' : '🔴';
+ text += `${emoji} ${agent.agent}: ${agent.score}%\n`;
+ });
+
+ return text + '\n';
+}
+
+/**
+ * Format footer
+ */
+function formatFooter(report: DailyReport): string {
+ const nextReport = report.reportType === 'morning'
+ ? 'End-of-Day Summary at 5:00 PM'
+ : 'Morning Standup at 6:00 AM';
+
+ return `━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n` +
+ `📅 Next Report: ${nextReport}\n` +
+ `🔗 Master Hub: http://45.61.58.125:9893\n` +
+ `Generated at ${new Date(report.timestamp).toLocaleTimeString()}`;
+}
+
+/**
+ * Format complete report for Slack
+ */
+export function formatSlackReport(report: DailyReport, mentionChannel: boolean = false): string {
+ let message = '';
+
+ // Mention channel if there are critical issues
+ if (mentionChannel && report.executiveSummary.criticalIssues > 0) {
+ message += '<!channel> *Attention Required* - Critical issues detected!\n\n';
+ }
+
+ message += formatHeader(report);
+ message += formatExecutiveSummary(report.executiveSummary);
+ message += formatDepartmentReports(report.departmentReports);
+ message += formatIssues(report.issuesRequiringAttention);
+ message += formatActionItems(report.actionItems);
+ message += formatQnaStatus(report.qnaStatus);
+ message += formatFooter(report);
+
+ return message;
+}
+
+/**
+ * Format report as JSON for Slack blocks (advanced formatting)
+ */
+export function formatSlackBlocks(report: DailyReport): any[] {
+ const blocks: any[] = [];
+
+ // Header
+ blocks.push({
+ type: 'header',
+ text: {
+ type: 'plain_text',
+ text: report.reportType === 'morning' ? '☀️ Morning Standup Report' : '🌙 End-of-Day Summary',
+ emoji: true
+ }
+ });
+
+ blocks.push({ type: 'divider' });
+
+ // Executive Summary
+ blocks.push({
+ type: 'section',
+ text: {
+ type: 'mrkdwn',
+ text: `*📊 EXECUTIVE SUMMARY*\n\n` +
+ `*System Health:* ${report.executiveSummary.systemHealth}%\n` +
+ `*Agents Online:* ${report.executiveSummary.agentsOnline}/${report.executiveSummary.totalAgents}\n` +
+ `*Tasks Completed:* ${report.executiveSummary.tasksCompletedToday}\n` +
+ `*Critical Issues:* ${report.executiveSummary.criticalIssues}`
+ }
+ });
+
+ // Critical issues alert
+ if (report.issuesRequiringAttention.length > 0) {
+ blocks.push({
+ type: 'section',
+ text: {
+ type: 'mrkdwn',
+ text: `*🚨 ${report.issuesRequiringAttention.length} Issues Require Attention*`
+ }
+ });
+ }
+
+ blocks.push({ type: 'divider' });
+
+ // Action button
+ blocks.push({
+ type: 'actions',
+ elements: [
+ {
+ type: 'button',
+ text: {
+ type: 'plain_text',
+ text: '📊 View Full Dashboard',
+ emoji: true
+ },
+ url: 'http://45.61.58.125:9893',
+ style: 'primary'
+ }
+ ]
+ });
+
+ return blocks;
+}
diff --git a/slack-notifier.ts b/slack-notifier.ts
new file mode 100644
index 0000000..67e4cd6
--- /dev/null
+++ b/slack-notifier.ts
@@ -0,0 +1,177 @@
+/**
+ * Slack Notifier for Daily Reports
+ *
+ * Sends formatted reports to Slack channels
+ */
+
+import fetch from 'node-fetch';
+import type { DailyReport } from './report-generator';
+import { formatSlackReport, formatSlackBlocks } from './slack-formatter';
+
+export interface SlackConfig {
+ webhookUrl: string;
+ channel?: string;
+ username?: string;
+ iconEmoji?: string;
+ mentionChannelOnIssues?: boolean;
+}
+
+/**
+ * Send report to Slack webhook
+ */
+export async function sendToSlack(
+ report: DailyReport,
+ config: SlackConfig
+): Promise<boolean> {
+ try {
+ const mentionChannel = config.mentionChannelOnIssues && report.executiveSummary.criticalIssues > 0;
+
+ // Format the message
+ const text = formatSlackReport(report, mentionChannel);
+
+ // Prepare payload
+ const payload: any = {
+ username: config.username || 'DW-Agents Reporter',
+ icon_emoji: config.iconEmoji || (report.reportType === 'morning' ? ':sunrise:' : ':city_sunset:'),
+ text: text
+ };
+
+ // Add channel if specified
+ if (config.channel) {
+ payload.channel = config.channel;
+ }
+
+ // Send to Slack
+ const response = await fetch(config.webhookUrl, {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify(payload)
+ });
+
+ if (!response.ok) {
+ throw new Error(`Slack API error: ${response.status} ${response.statusText}`);
+ }
+
+ console.log(`✅ Successfully sent ${report.reportType} report to Slack`);
+ return true;
+
+ } catch (error) {
+ console.error('❌ Failed to send report to Slack:', error);
+ return false;
+ }
+}
+
+/**
+ * Send report with rich formatting (blocks)
+ */
+export async function sendToSlackWithBlocks(
+ report: DailyReport,
+ config: SlackConfig
+): Promise<boolean> {
+ try {
+ const mentionChannel = config.mentionChannelOnIssues && report.executiveSummary.criticalIssues > 0;
+
+ // Format blocks
+ const blocks = formatSlackBlocks(report);
+ const text = formatSlackReport(report, false); // Fallback text
+
+ // Prepare payload
+ const payload: any = {
+ username: config.username || 'DW-Agents Reporter',
+ icon_emoji: config.iconEmoji || (report.reportType === 'morning' ? ':sunrise:' : ':city_sunset:'),
+ text: text, // Fallback
+ blocks: blocks
+ };
+
+ // Add channel if specified
+ if (config.channel) {
+ payload.channel = config.channel;
+ }
+
+ // Add channel mention if needed
+ if (mentionChannel) {
+ payload.text = '<!channel> Critical issues detected!\n\n' + payload.text;
+ }
+
+ // Send to Slack
+ const response = await fetch(config.webhookUrl, {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify(payload)
+ });
+
+ if (!response.ok) {
+ throw new Error(`Slack API error: ${response.status} ${response.statusText}`);
+ }
+
+ console.log(`✅ Successfully sent ${report.reportType} report with blocks to Slack`);
+ return true;
+
+ } catch (error) {
+ console.error('❌ Failed to send report with blocks to Slack:', error);
+ // Fallback to simple text
+ return sendToSlack(report, config);
+ }
+}
+
+/**
+ * Test Slack connection
+ */
+export async function testSlackConnection(webhookUrl: string): Promise<boolean> {
+ try {
+ const response = await fetch(webhookUrl, {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify({
+ text: '🧪 Test message from DW-Agents Daily Reporting System\n\nIf you see this, the webhook is configured correctly! ✅'
+ })
+ });
+
+ if (!response.ok) {
+ throw new Error(`HTTP ${response.status}`);
+ }
+
+ console.log('✅ Slack connection test successful');
+ return true;
+
+ } catch (error) {
+ console.error('❌ Slack connection test failed:', error);
+ return false;
+ }
+}
+
+/**
+ * Save report to file (backup)
+ */
+export async function saveReportToFile(report: DailyReport, directory: string = '/root/DW-Agents/reports'): Promise<string> {
+ const fs = require('fs').promises;
+ const path = require('path');
+
+ try {
+ // Ensure directory exists
+ await fs.mkdir(directory, { recursive: true });
+
+ // Generate filename
+ const date = new Date(report.timestamp);
+ const dateStr = date.toISOString().split('T')[0];
+ const timeStr = date.toTimeString().split(' ')[0].replace(/:/g, '-');
+ const filename = `${report.reportType}-report-${dateStr}-${timeStr}.json`;
+ const filepath = path.join(directory, filename);
+
+ // Save report
+ await fs.writeFile(filepath, JSON.stringify(report, null, 2));
+
+ console.log(`📁 Report saved to ${filepath}`);
+ return filepath;
+
+ } catch (error) {
+ console.error('❌ Failed to save report to file:', error);
+ throw error;
+ }
+}
diff --git a/tsconfig.json b/tsconfig.json
new file mode 100644
index 0000000..b5e221f
--- /dev/null
+++ b/tsconfig.json
@@ -0,0 +1,26 @@
+{
+ "compilerOptions": {
+ "target": "ES2020",
+ "module": "commonjs",
+ "lib": ["ES2020"],
+ "moduleResolution": "node",
+ "esModuleInterop": true,
+ "allowSyntheticDefaultImports": true,
+ "resolveJsonModule": true,
+ "strict": true,
+ "skipLibCheck": true,
+ "forceConsistentCasingInFileNames": true,
+ "outDir": "./dist",
+ "rootDir": ".",
+ "declaration": true,
+ "declarationMap": true,
+ "sourceMap": true
+ },
+ "include": [
+ "**/*.ts"
+ ],
+ "exclude": [
+ "node_modules",
+ "dist"
+ ]
+}
(oldest)
·
back to Daily Reporting
·
(newest)