name: update-ports description: Update PORTS.md with current port configurations across all Barry services and apps context: current allowed-tools: Grep, Glob, Read, Edit, Bash
Update Ports Documentation
Updates the PORTS.md file by scanning the Barry codebase for current port configurations across all services, apps, and external dependencies.
Usage
/update-ports- Update PORTS.md with current port configurations/update-ports --dry-run- Preview changes without writing to PORTS.md
Workflow
Step 1: Scan Core Services
Search for port configurations in the main Barry services:
Barry API Server (/servers/api/):
- Pattern:
getEnvironmentPort\(\s*(\d+) - Environment variables:
BARRY_API_PORT,PORT - WebSocket endpoint check
Web Frontend (/apps/web/barry.works/):
- Pattern:
getEnvironmentPort\(\s*(\d+) - Environment variables:
BARRY_WEB_PORT,PORT
Step 2: Scan Application Servers
Check application-specific servers:
Slack Bot (/apps/slack/):
- Config port settings
Step 3: Scan HTTP Service Servers
Find all HTTP service servers in /servers/:
for file in servers/*/src/index.ts; do
[ -f "$file" ] || continue
echo "=== $file ==="
grep -n "getEnvironmentPort\|\.listen\|process\.env\.PORT\|const.*port" "$file"
done
Extract base ports and document environment offset behavior.
Step 4: Check External Service References
Search for hardcoded external service ports:
Ollama (Local AI):
Pattern: localhost:11434|127\.0\.0\.1:11434
Pattern: /api/generate|/api/tags
Whisperflow (Speech-to-Text):
Pattern: 127\.0\.0\.1:8001|ws://.*:8001
Pattern: BARRY_WHISPERFLOW_URL
Redis:
Pattern: :6379|localhost:6379
Pattern: REDIS_HOST|REDIS_PORT
PostgreSQL:
Pattern: postgres://.*:5433|:5433
Pattern: DATABASE_URL
Step 5: Check OAuth and Development Services
OAuth Local Server:
Location: /servers/mcp/google-calendar/scripts/
Pattern: OAUTH_LOCAL_PORT|8765
Step 6: Verify Watchdog Configuration
Barry Watchdog:
Pattern: WATCHDOG_HEALTH_URL
Pattern: localhost:3854/health
Step 7: Scan Package.json Scripts
Check for port references in start/dev scripts:
find . -name "package.json" -not -path "./node_modules/*" | xargs grep -l "port\|:3\|:4\|:8"
Step 8: Update PORTS.md
Generate updated content with sections:
- Environment-Based Port System - Document offset logic
- Core Barry Services - Main API and web
- Application Servers - Individual apps
- HTTP Service Servers - With dev/prod port mapping
- External Service Dependencies - Third-party services
- Standalone Services - Independent services
- WebSocket Endpoints - WS connection points
- Watchdog Service - Health monitoring
- Port Range Allocation - Summary by range
- Configuration Files - Key reference files
Step 9: Validate Changes
After updating:
- Verify all services from Step 1-7 are documented
- Check for any new services not in previous version
- Validate port numbers match current configurations
- Ensure environment variables are correctly documented
Output Format
When complete, provide a summary:
## Port Documentation Update Complete
### Services Scanned
- ✅ Core Barry Services (3 services)
- ✅ Application Servers (4 services)
- ✅ HTTP Service Servers (10 services)
- ✅ External Dependencies (5 services)
- ✅ Standalone Services (2 services)
### Changes Made
- Updated [service name]: port changed from X to Y
- Added new service: [service name] on port Z
- Removed deprecated: [old service name]
- Updated environment variables for: [service name]
### Validation
- ✅ All ports verified against source code
- ✅ Environment offset logic documented
- ✅ External dependencies confirmed
- ✅ WebSocket endpoints validated
Search Patterns
Use these grep patterns for comprehensive scanning:
# Main port patterns
grep -r "getEnvironmentPort\|\.listen\|process\.env\.PORT" --include="*.ts" --include="*.js" .
# Environment variables
grep -r "BARRY_.*_PORT\|PORT\s*=" --include="*.ts" --include="*.js" .
# Hardcoded ports
grep -r "localhost:[0-9]\+\|127\.0\.0\.1:[0-9]\+" --include="*.ts" --include="*.js" .
# External service URLs
grep -r "11434\|8001\|6379\|5433\|8765" --include="*.ts" --include="*.js" .
# WebSocket patterns
grep -r "ws://\|wss://\|WebSocket" --include="*.ts" --include="*.js" .
Exclusions
Skip these directories when scanning:
node_modules/dist/,build/.git/__pycache__/.venv/,venv/coverage/tmp/,temp/
API Documentation Generator
Documentation
Automatically generates OpenAPI/Swagger API documentation.
Technical Writer
Documentation
Writes clear technical documentation following top style guides.
Project Documentation Lookup
Documentation
Find project information in the docs/ folder using a three-step strategy: orient, locate the right file, report.