Skip to content

Chrome Extension Capture Client #7

Chrome Extension Capture Client

Chrome Extension Capture Client #7

Workflow file for this run

name: Daily Planner
on:
schedule:
# Run daily at 6 AM UTC (10 PM PST, 1 AM EST)
- cron: '0 6 * * *'
workflow_dispatch: # Allow manual triggering
inputs:
test_mode:
description: 'Run in test mode with verbose logging'
required: false
default: 'true'
type: boolean
generate_weekly:
description: 'Generate weekly plan as well'
required: false
default: 'false'
type: boolean
jobs:
generate-daily-plan:
name: Generate Daily Plan
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Verify prerequisites
run: |
echo "πŸ” Verifying daily planner prerequisites..."
# Check master prompt
if [ -f "prompts/origin-master-prompt.md" ]; then
echo "βœ… Master prompt exists"
echo "πŸ“„ Size: $(wc -l < prompts/origin-master-prompt.md) lines"
else
echo "❌ Master prompt not found"
exit 1
fi
# Check reading queue
if [ -f "data/reading-queue.json" ]; then
if command -v jq >/dev/null 2>&1; then
local queue_size=$(jq '.meta.total_items // 0' data/reading-queue.json 2>/dev/null || echo "0")
echo "βœ… Reading queue exists with $queue_size items"
else
echo "βœ… Reading queue exists (jq not available for count)"
fi
else
echo "⚠️ Reading queue not found, running normalizer first..."
node automation/normalize.js
echo "βœ… Reading queue generated"
fi
# Check configurations
local missing_configs=""
for config in schedule.yaml priorities.yaml areas.yaml; do
if [ -f "configs/$config" ]; then
echo "βœ… Config found: $config"
else
echo "⚠️ Config missing: $config"
missing_configs="$missing_configs $config"
fi
done
if [ -n "$missing_configs" ]; then
echo "⚠️ Some configuration files are missing, using defaults"
fi
- name: Generate timestamp for artifacts
id: timestamp
run: |
echo "timestamp=$(date +%Y%m%d-%H%M%S)" >> $GITHUB_OUTPUT
echo "date_human=$(date -u +"%Y-%m-%d")" >> $GITHUB_OUTPUT
- name: Run Agent Harness (Local Mode)
run: |
echo "πŸ€– Running agent harness in local mode..."
# Set environment variables for test mode
if [ "${{ github.event.inputs.test_mode }}" = "true" ]; then
export DEBUG=1
echo "πŸ” Debug mode enabled"
fi
# Run the harness
if node agent/harness.js --mode local; then
echo "βœ… Agent harness executed successfully"
# Verify outputs
local outputs_generated=true
if [ -f "agent/out/daily-plan.json" ]; then
echo "βœ… Daily plan JSON generated"
local file_size=$(du -h agent/out/daily-plan.json | cut -f1)
echo "πŸ“Š File size: $file_size"
if command -v jq >/dev/null 2>&1; then
local task_count=$(jq '.schedule.total_tasks // 0' agent/out/daily-plan.json 2>/dev/null || echo "0")
local focus_time=$(jq '.schedule.total_focus_time // 0' agent/out/daily-plan.json 2>/dev/null || echo "0")
echo "πŸ“ˆ Tasks: $task_count, Focus time: $focus_time minutes"
fi
else
echo "❌ Daily plan JSON not generated"
outputs_generated=false
fi
if [ -f "agent/out/weekly-plan.json" ]; then
echo "βœ… Weekly plan JSON generated"
local file_size=$(du -h agent/out/weekly-plan.json | cut -f1)
echo "πŸ“Š File size: $file_size"
if command -v jq >/dev/null 2>&1; then
local weekly_tasks=$(jq '.tasks_summary.total_selected // 0' agent/out/weekly-plan.json 2>/dev/null || echo "0")
echo "πŸ“ˆ Weekly tasks selected: $weekly_tasks"
fi
else
echo "❌ Weekly plan JSON not generated"
outputs_generated=false
fi
if [ -f "daily/daily.md" ]; then
echo "βœ… Daily markdown generated"
local file_size=$(du -h daily/daily.md | cut -f1)
echo "πŸ“Š File size: $file_size"
else
echo "❌ Daily markdown not generated"
outputs_generated=false
fi
if [ -f "weekly/weekly.md" ]; then
echo "βœ… Weekly markdown generated"
local file_size=$(du -h weekly/weekly.md | cut -f1)
echo "πŸ“Š File size: $file_size"
else
echo "⚠️ Weekly markdown not generated (may be expected)"
fi
if [ "$outputs_generated" = "false" ]; then
echo "❌ Some expected outputs were not generated"
exit 1
fi
else
echo "❌ Agent harness execution failed"
exit 1
fi
- name: Run Agent Tests (if available)
run: |
echo "πŸ§ͺ Running agent test suite..."
if [ -x "./tests/agent.test.sh" ]; then
if ./tests/agent.test.sh; then
echo "βœ… All agent tests passed"
else
echo "⚠️ Some agent tests may have failed, but continuing..."
fi
else
echo "⚠️ Agent test script not found"
fi
- name: Generate Plan Summary
run: |
echo "πŸ“Š Generating plan summary..."
cat > daily-plan-summary.md << EOF
# Daily Plan Summary - ${{ steps.timestamp.outputs.date_human }}
**Generated:** $(date -u +"%Y-%m-%d %H:%M:%S UTC")
**Workflow Run:** [#${{ github.run_id }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
**Mode:** Local Mock Planning
## Generated Plans
1. βœ… **Daily Plan** - JSON and Markdown formats
2. βœ… **Weekly Plan** - JSON and Markdown formats
3. βœ… **Time Blocks** - Energy-aware scheduling
4. βœ… **Task Selection** - Priority-based from reading queue
EOF
# Add statistics if available
if [ -f "agent/out/daily-plan.json" ] && command -v jq >/dev/null 2>&1; then
cat >> daily-plan-summary.md << EOF
## Daily Plan Statistics
- **Total Tasks:** $(jq '.schedule.total_tasks // 0' agent/out/daily-plan.json)
- **Focus Time:** $(jq '.schedule.total_focus_time // 0' agent/out/daily-plan.json) minutes
- **Breaks Included:** $(jq '.schedule.breaks_included // 0' agent/out/daily-plan.json)
- **Daily Focus:** $(jq -r '.focus_theme // "Not specified"' agent/out/daily-plan.json)
EOF
fi
# Add weekly statistics if available
if [ -f "agent/out/weekly-plan.json" ] && command -v jq >/dev/null 2>&1; then
cat >> daily-plan-summary.md << EOF
## Weekly Plan Statistics
- **Tasks Selected:** $(jq '.tasks_summary.total_selected // 0' agent/out/weekly-plan.json)
- **Work Tasks:** $(jq '.tasks_summary.work_tasks // 0' agent/out/weekly-plan.json)
- **Learning Tasks:** $(jq '.tasks_summary.learning_tasks // 0' agent/out/weekly-plan.json)
- **Creative Tasks:** $(jq '.tasks_summary.creative_tasks // 0' agent/out/weekly-plan.json)
- **High Priority:** $(jq '.tasks_summary.high_priority // 0' agent/out/weekly-plan.json)
- **Focus Areas:** $(jq -r '.focus_areas | join(", ")' agent/out/weekly-plan.json)
EOF
fi
echo ""
echo "## πŸ“Š Daily Plan Summary"
echo ""
cat daily-plan-summary.md
- name: Check for changes
id: changes
run: |
# Add all generated files
git add agent/out/ daily/ weekly/ daily-plan-summary.md 2>/dev/null || true
if git diff --cached --quiet; then
echo "changed=false" >> $GITHUB_OUTPUT
echo "πŸ“„ No changes to commit"
else
echo "changed=true" >> $GITHUB_OUTPUT
echo "πŸ“„ Changes detected, preparing commit..."
git diff --cached --stat
fi
- name: Commit and push changes
if: steps.changes.outputs.changed == 'true'
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git commit -m "chore: generate daily plan ${{ steps.timestamp.outputs.date_human }}
πŸ€– Generated with [GitHub Actions](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})

Check failure on line 252 in .github/workflows/daily-planner.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/daily-planner.yml

Invalid workflow file

You have an error in your yaml syntax on line 252
- Daily plan created with local agent
- Time blocks scheduled based on reading queue
- Energy-aware task prioritization
- Markdown and JSON outputs generated
- Timestamp: $(date -u +"%Y-%m-%d %H:%M:%S UTC")
Plan Details:
$(cat daily-plan-summary.md | grep -E "^-|\*\*" | head -8)
Co-Authored-By: GitHub Action <action@users.noreply.github.com>"
git push
- name: Upload daily plan artifacts
uses: actions/upload-artifact@v4
with:
name: daily-plan-${{ steps.timestamp.outputs.timestamp }}
path: |
agent/out/
daily/daily.md
weekly/weekly.md
daily-plan-summary.md
retention-days: 30
- name: Archive old daily plans
run: |
echo "πŸ—„οΈ Archiving old plans..."
# Archive yesterday's daily plan if it exists
yesterday=$(date -d "yesterday" +%Y-%m-%d 2>/dev/null || date -v-1d +%Y-%m-%d 2>/dev/null || echo "2025-01-01")
if [ -f "daily/daily.md" ] && [ "$yesterday" != "$(date +%Y-%m-%d)" ]; then
# Create archive directory if it doesn't exist
mkdir -p archive/daily archive/weekly archive/json
# Archive previous files (if they exist and are different from today)
if [ -f "daily/daily.md" ]; then
cp daily/daily.md "archive/daily/daily-$yesterday.md" 2>/dev/null || true
fi
if [ -f "weekly/weekly.md" ]; then
cp weekly/weekly.md "archive/weekly/weekly-$yesterday.md" 2>/dev/null || true
fi
if [ -f "agent/out/daily-plan.json" ]; then
cp agent/out/daily-plan.json "archive/json/daily-plan-$yesterday.json" 2>/dev/null || true
fi
if [ -f "agent/out/weekly-plan.json" ]; then
cp agent/out/weekly-plan.json "archive/json/weekly-plan-$yesterday.json" 2>/dev/null || true
fi
echo "πŸ“¦ Archived previous plans to archive/ directories"
fi
- name: Summary
run: |
echo "## πŸ“… Daily Planner Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Status:** ${{ steps.changes.outputs.changed == 'true' && 'βœ… Generated & Committed' || 'βœ… Generated' }}" >> $GITHUB_STEP_SUMMARY
echo "**Date:** ${{ steps.timestamp.outputs.date_human }}" >> $GITHUB_STEP_SUMMARY
echo "**Timestamp:** $(date -u +"%Y-%m-%d %H:%M:%S UTC")" >> $GITHUB_STEP_SUMMARY
echo "**Mode:** Local Mock Planning" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
if [ -f "agent/out/daily-plan.json" ]; then
if command -v jq >/dev/null 2>&1; then
echo "**Daily Plan Statistics:**" >> $GITHUB_STEP_SUMMARY
echo "- Tasks: $(jq '.schedule.total_tasks // 0' agent/out/daily-plan.json)" >> $GITHUB_STEP_SUMMARY
echo "- Focus Time: $(jq '.schedule.total_focus_time // 0' agent/out/daily-plan.json) minutes" >> $GITHUB_STEP_SUMMARY
echo "- Theme: $(jq -r '.focus_theme // "Not specified"' agent/out/daily-plan.json)" >> $GITHUB_STEP_SUMMARY
fi
fi
if [ -f "agent/out/weekly-plan.json" ]; then
if command -v jq >/dev/null 2>&1; then
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Weekly Plan Overview:**" >> $GITHUB_STEP_SUMMARY
echo "- Total Tasks: $(jq '.tasks_summary.total_selected // 0' agent/out/weekly-plan.json)" >> $GITHUB_STEP_SUMMARY
echo "- Work: $(jq '.tasks_summary.work_tasks // 0' agent/out/weekly-plan.json), Learning: $(jq '.tasks_summary.learning_tasks // 0' agent/out/weekly-plan.json), Creative: $(jq '.tasks_summary.creative_tasks // 0' agent/out/weekly-plan.json)" >> $GITHUB_STEP_SUMMARY
fi
fi
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Generated Files:**" >> $GITHUB_STEP_SUMMARY
echo "- \`agent/out/daily-plan.json\` - Structured daily plan" >> $GITHUB_STEP_SUMMARY
echo "- \`agent/out/weekly-plan.json\` - Structured weekly plan" >> $GITHUB_STEP_SUMMARY
echo "- \`daily/daily.md\` - Human-readable daily schedule" >> $GITHUB_STEP_SUMMARY
echo "- \`weekly/weekly.md\` - Weekly overview" >> $GITHUB_STEP_SUMMARY
if [ "${{ steps.changes.outputs.changed }}" == "true" ]; then
echo "" >> $GITHUB_STEP_SUMMARY
echo "### πŸ“ Changes Committed" >> $GITHUB_STEP_SUMMARY
echo "- Daily and weekly plans committed to repository" >> $GITHUB_STEP_SUMMARY
echo "- Previous plans archived for reference" >> $GITHUB_STEP_SUMMARY
echo "- Ready for daily workflow execution" >> $GITHUB_STEP_SUMMARY
fi
echo "" >> $GITHUB_STEP_SUMMARY
echo "**πŸ“¦ Artifacts:**" >> $GITHUB_STEP_SUMMARY
echo "- Download all generated files from the artifacts section" >> $GITHUB_STEP_SUMMARY
echo "- Files retained for 30 days" >> $GITHUB_STEP_SUMMARY
plan-validation:
name: Plan Validation
runs-on: ubuntu-latest
needs: generate-daily-plan
if: always() && needs.generate-daily-plan.result == 'success'
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Validate generated plans
run: |
echo "πŸ” Validating generated plans..."
# Validate daily plan JSON
if [ -f "agent/out/daily-plan.json" ]; then
if jq empty agent/out/daily-plan.json 2>/dev/null; then
echo "βœ… Daily plan JSON is valid"
# Check required fields
if jq -e '.date' agent/out/daily-plan.json >/dev/null 2>&1; then
echo "βœ… Daily plan has date field"
else
echo "❌ Daily plan missing date field"
exit 1
fi
if jq -e '.time_blocks' agent/out/daily-plan.json >/dev/null 2>&1; then
local block_count=$(jq '.time_blocks | length' agent/out/daily-plan.json 2>/dev/null || echo "0")
echo "βœ… Daily plan has $block_count time blocks"
else
echo "❌ Daily plan missing time_blocks field"
exit 1
fi
else
echo "❌ Daily plan JSON is invalid"
exit 1
fi
else
echo "❌ Daily plan JSON not found"
exit 1
fi
# Validate weekly plan JSON
if [ -f "agent/out/weekly-plan.json" ]; then
if jq empty agent/out/weekly-plan.json 2>/dev/null; then
echo "βœ… Weekly plan JSON is valid"
else
echo "❌ Weekly plan JSON is invalid"
exit 1
fi
else
echo "⚠️ Weekly plan JSON not found"
fi
# Validate markdown files
if [ -f "daily/daily.md" ]; then
if grep -q "^# " daily/daily.md; then
echo "βœ… Daily markdown has title"
else
echo "⚠️ Daily markdown may not have proper title"
fi
fi
if [ -f "weekly/weekly.md" ]; then
if grep -q "^# " weekly/weekly.md; then
echo "βœ… Weekly markdown has title"
else
echo "⚠️ Weekly markdown may not have proper title"
fi
fi
- name: Validation Summary
run: |
echo "## βœ… Plan Validation Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**JSON Validation:** βœ… Passed" >> $GITHUB_STEP_SUMMARY
echo "**Schema Validation:** βœ… Passed" >> $GITHUB_STEP_SUMMARY
echo "**Markdown Files:** βœ… Passed" >> $GITHUB_STEP_SUMMARY
echo "**File Structure:** βœ… Passed" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "All generated plans passed validation checks!" >> $GITHUB_STEP_SUMMARY