From 1fc9e177655e33f85d2fb7038ef77fa1d0a3f6c0 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 1 Jan 2026 22:31:52 +0000 Subject: [PATCH 1/2] Initial plan From 46b59b86ff4a447470e771b66450f4a9be2b3fe1 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 1 Jan 2026 22:40:32 +0000 Subject: [PATCH 2/2] Add charts and visualization to daily-code-metrics workflow - Replace trending-charts-simple.md with python-dataviz.md import - Add shared/trends.md import for trending analysis patterns - Add upload-asset to safe-outputs for chart asset uploads - Add comprehensive "Data Visualization with Python" section with 6 required charts: 1. loc_by_language.png - LOC distribution by language 2. top_directories.png - Top 10 directories by LOC 3. quality_score_breakdown.png - Quality score components 4. test_coverage.png - Test vs source code comparison 5. code_churn.png - Top 10 most changed files (7 days) 6. historical_trends.png - Multi-line time series (30 days) - Add chart quality standards (300 DPI, 12x7 inches, seaborn styling) - Update report format with embedded chart images and collapsible details - Add Python script structure for data collection and visualization - Update guidelines to mention visualization requirements Workflow compiled successfully: 99.9 KB (from ~70 KB) File size: 392 lines (from 96 lines), +296 lines added Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --- .github/workflows/daily-code-metrics.lock.yml | 900 +++++++++++++++++- .github/workflows/daily-code-metrics.md | 323 ++++++- 2 files changed, 1161 insertions(+), 62 deletions(-) diff --git a/.github/workflows/daily-code-metrics.lock.yml b/.github/workflows/daily-code-metrics.lock.yml index 6c06ad773ee..8015c4d7afe 100644 --- a/.github/workflows/daily-code-metrics.lock.yml +++ b/.github/workflows/daily-code-metrics.lock.yml @@ -24,7 +24,8 @@ # Resolved workflow manifest: # Imports: # - shared/reporting.md -# - shared/trending-charts-simple.md +# - shared/python-dataviz.md +# - shared/trends.md name: "Daily Code Metrics and Trend Tracking Agent" "on": @@ -83,6 +84,9 @@ jobs: concurrency: group: "gh-aw-claude-${{ github.workflow }}" env: + GH_AW_ASSETS_ALLOWED_EXTS: ".png,.jpg,.jpeg" + GH_AW_ASSETS_BRANCH: "assets/${{ github.workflow }}" + GH_AW_ASSETS_MAX_SIZE_KB: 10240 GH_AW_MCP_LOG_DIR: /tmp/gh-aw/mcp-logs/safeoutputs GH_AW_SAFE_OUTPUTS: /tmp/gh-aw/safeoutputs/outputs.jsonl GH_AW_SAFE_OUTPUTS_CONFIG_PATH: /tmp/gh-aw/safeoutputs/config.json @@ -110,23 +114,23 @@ jobs: - name: Create gh-aw temp directory run: bash /tmp/gh-aw/actions/create_gh_aw_tmp_dir.sh - name: Setup Python environment - run: | - mkdir -p /tmp/gh-aw/python/{data,charts,artifacts} - pip install --user --quiet numpy pandas matplotlib seaborn scipy + run: "# Create working directory for Python scripts\nmkdir -p /tmp/gh-aw/python\nmkdir -p /tmp/gh-aw/python/data\nmkdir -p /tmp/gh-aw/python/charts\nmkdir -p /tmp/gh-aw/python/artifacts\n\necho \"Python environment setup complete\"\necho \"Working directory: /tmp/gh-aw/python\"\necho \"Data directory: /tmp/gh-aw/python/data\"\necho \"Charts directory: /tmp/gh-aw/python/charts\"\necho \"Artifacts directory: /tmp/gh-aw/python/artifacts\"\n" + - name: Install Python scientific libraries + run: "pip install --user --quiet numpy pandas matplotlib seaborn scipy\n\n# Verify installations\npython3 -c \"import numpy; print(f'NumPy {numpy.__version__} installed')\"\npython3 -c \"import pandas; print(f'Pandas {pandas.__version__} installed')\"\npython3 -c \"import matplotlib; print(f'Matplotlib {matplotlib.__version__} installed')\"\npython3 -c \"import seaborn; print(f'Seaborn {seaborn.__version__} installed')\"\npython3 -c \"import scipy; print(f'SciPy {scipy.__version__} installed')\"\n\necho \"All scientific libraries installed successfully\"\n" - if: always() - name: Upload charts + name: Upload generated charts uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 with: if-no-files-found: warn - name: trending-charts + name: data-charts path: /tmp/gh-aw/python/charts/*.png retention-days: 30 - if: always() - name: Upload source and data + name: Upload source files and data uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 with: if-no-files-found: warn - name: trending-source-and-data + name: python-source-and-data path: | /tmp/gh-aw/python/*.py /tmp/gh-aw/python/data/* @@ -138,12 +142,11 @@ jobs: - name: Restore cache memory file share data uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 with: - key: trending-data-${{ github.workflow }}-${{ github.run_id }} + key: memory-${{ github.workflow }}-${{ github.run_id }} path: /tmp/gh-aw/cache-memory restore-keys: | - trending-data-${{ github.workflow }}- - trending-data- - trending- + memory-${{ github.workflow }}- + memory- # Repo memory git-based storage configuration from frontmatter processed below - name: Clone repo-memory branch (default) env: @@ -209,7 +212,7 @@ jobs: mkdir -p /tmp/gh-aw/safeoutputs mkdir -p /tmp/gh-aw/mcp-logs/safeoutputs cat > /tmp/gh-aw/safeoutputs/config.json << 'EOF' - {"create_discussion":{"max":1},"missing_tool":{"max":0},"noop":{"max":1}} + {"create_discussion":{"max":1},"missing_tool":{"max":0},"noop":{"max":1},"upload_asset":{"max":0}} EOF cat > /tmp/gh-aw/safeoutputs/tools.json << 'EOF' [ @@ -239,6 +242,23 @@ jobs: }, "name": "create_discussion" }, + { + "description": "Upload a file as a URL-addressable asset that can be referenced in issues, PRs, or comments. The file is stored on an orphaned git branch and returns a permanent URL. Use this for images, diagrams, or other files that need to be embedded in GitHub content. CONSTRAINTS: Maximum file size: 10240KB. Allowed file extensions: [.png .jpg .jpeg].", + "inputSchema": { + "additionalProperties": false, + "properties": { + "path": { + "description": "Absolute file path to upload (e.g., '/tmp/chart.png'). Must be under the workspace or /tmp directory. By default, only image files (.png, .jpg, .jpeg) are allowed; other file types require workflow configuration.", + "type": "string" + } + }, + "required": [ + "path" + ], + "type": "object" + }, + "name": "upload_asset" + }, { "description": "Report that a tool or capability needed to complete the task is not available. Use this when you cannot accomplish what was requested because the required functionality is missing or access is restricted.", "inputSchema": { @@ -344,6 +364,15 @@ jobs: "maxLength": 65000 } } + }, + "upload_asset": { + "defaultMax": 10, + "fields": { + "path": { + "required": true, + "type": "string" + } + } } } EOF @@ -351,6 +380,9 @@ jobs: env: GITHUB_MCP_SERVER_TOKEN: ${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN || secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} GH_AW_SAFE_OUTPUTS: ${{ env.GH_AW_SAFE_OUTPUTS }} + GH_AW_ASSETS_BRANCH: ${{ env.GH_AW_ASSETS_BRANCH }} + GH_AW_ASSETS_MAX_SIZE_KB: ${{ env.GH_AW_ASSETS_MAX_SIZE_KB }} + GH_AW_ASSETS_ALLOWED_EXTS: ${{ env.GH_AW_ASSETS_ALLOWED_EXTS }} run: | mkdir -p /tmp/gh-aw/mcp-config cat > /tmp/gh-aw/mcp-config/mcp-servers.json << EOF @@ -424,7 +456,7 @@ jobs: event_name: context.eventName, staged: false, network_mode: "defaults", - allowed_domains: [], + allowed_domains: ["defaults","python"], firewall_enabled: true, awf_version: "v0.7.0", steps: { @@ -465,47 +497,425 @@ jobs: - Include up to 3 most relevant run URLs at end under `**References:**` - Do NOT add footer attribution (system adds automatically) - # Python Environment Ready + # Python Data Visualization Guide - Libraries: NumPy, Pandas, Matplotlib, Seaborn, SciPy - Directories: `/tmp/gh-aw/python/{data,charts,artifacts}`, `/tmp/gh-aw/cache-memory/` + Python scientific libraries have been installed and are ready for use. A temporary folder structure has been created at `/tmp/gh-aw/python/` for organizing scripts, data, and outputs. - ## Store Historical Data (JSON Lines) + ## Installed Libraries - ```python - import json - from datetime import datetime + - **NumPy**: Array processing and numerical operations + - **Pandas**: Data manipulation and analysis + - **Matplotlib**: Chart generation and plotting + - **Seaborn**: Statistical data visualization + - **SciPy**: Scientific computing utilities + + ## Directory Structure - # Append data point - with open('/tmp/gh-aw/cache-memory/trending//history.jsonl', 'a') as f: - f.write(json.dumps({"timestamp": datetime.now().isoformat(), "value": 42}) + '\n') ``` + /tmp/gh-aw/python/ + ├── data/ # Store all data files here (CSV, JSON, etc.) + ├── charts/ # Generated chart images (PNG) + ├── artifacts/ # Additional output files + └── *.py # Python scripts + ``` + + ## Data Separation Requirement + + **CRITICAL**: Data must NEVER be inlined in Python code. Always store data in external files and load using pandas. - ## Generate Charts + ### ❌ PROHIBITED - Inline Data + ```python + # DO NOT do this + data = [10, 20, 30, 40, 50] + labels = ['A', 'B', 'C', 'D', 'E'] + ``` + ### ✅ REQUIRED - External Data Files ```python + # Always load data from external files import pandas as pd + + # Load data from CSV + data = pd.read_csv('/tmp/gh-aw/python/data/data.csv') + + # Or from JSON + data = pd.read_json('/tmp/gh-aw/python/data/data.json') + ``` + + ## Chart Generation Best Practices + + ### High-Quality Chart Settings + + ```python import matplotlib.pyplot as plt import seaborn as sns - df = pd.read_json('history.jsonl', lines=True) - df['date'] = pd.to_datetime(df['timestamp']).dt.date + # Set style for better aesthetics + sns.set_style("whitegrid") + sns.set_palette("husl") + + # Create figure with high DPI + fig, ax = plt.subplots(figsize=(10, 6), dpi=300) + + # Your plotting code here + # ... + + # Save with high quality + plt.savefig('/tmp/gh-aw/python/charts/chart.png', + dpi=300, + bbox_inches='tight', + facecolor='white', + edgecolor='none') + ``` + + ### Chart Quality Guidelines + + - **DPI**: Use 300 or higher for publication quality + - **Figure Size**: Standard is 10x6 inches (adjustable based on needs) + - **Labels**: Always include clear axis labels and titles + - **Legend**: Add legends when plotting multiple series + - **Grid**: Enable grid lines for easier reading + - **Colors**: Use colorblind-friendly palettes (seaborn defaults are good) + + ## Including Images in Reports + + When creating reports (issues, discussions, etc.), use the `upload asset` tool to make images URL-addressable and include them in markdown: + + ### Step 1: Generate and Upload Chart + ```python + # Generate your chart + plt.savefig('/tmp/gh-aw/python/charts/my_chart.png', dpi=300, bbox_inches='tight') + ``` + + ### Step 2: Upload as Asset + Use the `upload asset` tool to upload the chart file. The tool will return a GitHub raw content URL. + + ### Step 3: Include in Markdown Report + When creating your discussion or issue, include the image using markdown: + + ```markdown + ## Visualization Results + + ![Chart Description](https://raw.githubusercontent.com/owner/repo/assets/workflow-name/my_chart.png) + + The chart above shows... + ``` + + **Important**: Assets are published to an orphaned git branch and become URL-addressable after workflow completion. + + ## Cache Memory Integration + + The cache memory at `/tmp/gh-aw/cache-memory/` is available for storing reusable code: + + **Helper Functions to Cache:** + - Data loading utilities: `data_loader.py` + - Chart styling functions: `chart_utils.py` + - Common data transformations: `transforms.py` + + **Check Cache Before Creating:** + ```bash + # Check if helper exists in cache + if [ -f /tmp/gh-aw/cache-memory/data_loader.py ]; then + cp /tmp/gh-aw/cache-memory/data_loader.py /tmp/gh-aw/python/ + echo "Using cached data_loader.py" + fi + ``` + + **Save to Cache for Future Runs:** + ```bash + # Save useful helpers to cache + cp /tmp/gh-aw/python/data_loader.py /tmp/gh-aw/cache-memory/ + echo "Saved data_loader.py to cache for future runs" + ``` + + ## Complete Example Workflow + + ```python + #!/usr/bin/env python3 + """ + Example data visualization script + Generates a bar chart from external data + """ + import pandas as pd + import matplotlib.pyplot as plt + import seaborn as sns + # Set style sns.set_style("whitegrid") + sns.set_palette("husl") + + # Load data from external file (NEVER inline) + data = pd.read_csv('/tmp/gh-aw/python/data/data.csv') + + # Process data + summary = data.groupby('category')['value'].sum() + + # Create chart + fig, ax = plt.subplots(figsize=(10, 6), dpi=300) + summary.plot(kind='bar', ax=ax) + + # Customize + ax.set_title('Data Summary by Category', fontsize=16, fontweight='bold') + ax.set_xlabel('Category', fontsize=12) + ax.set_ylabel('Value', fontsize=12) + ax.grid(True, alpha=0.3) + + # Save chart + plt.savefig('/tmp/gh-aw/python/charts/chart.png', + dpi=300, + bbox_inches='tight', + facecolor='white') + + print("Chart saved to /tmp/gh-aw/python/charts/chart.png") + ``` + + ## Error Handling + + **Check File Existence:** + ```python + import os + + data_file = '/tmp/gh-aw/python/data/data.csv' + if not os.path.exists(data_file): + raise FileNotFoundError(f"Data file not found: {data_file}") + ``` + + **Validate Data:** + ```python + # Check for required columns + required_cols = ['category', 'value'] + missing = set(required_cols) - set(data.columns) + if missing: + raise ValueError(f"Missing columns: {missing}") + ``` + + ## Artifact Upload + + Charts and source files are automatically uploaded as artifacts: + + **Charts Artifact:** + - Name: `data-charts` + - Contents: PNG files from `/tmp/gh-aw/python/charts/` + - Retention: 30 days + + **Source and Data Artifact:** + - Name: `python-source-and-data` + - Contents: Python scripts and data files + - Retention: 30 days + + Both artifacts are uploaded with `if: always()` condition, ensuring they're available even if the workflow fails. + + ## Tips for Success + + 1. **Always Separate Data**: Store data in files, never inline in code + 2. **Use Cache Memory**: Store reusable helpers for faster execution + 3. **High Quality Charts**: Use DPI 300+ and proper sizing + 4. **Clear Documentation**: Add docstrings and comments + 5. **Error Handling**: Validate data and check file existence + 6. **Type Hints**: Use type annotations for better code quality + 7. **Seaborn Defaults**: Leverage seaborn for better aesthetics + 8. **Reproducibility**: Set random seeds when needed + + ## Common Data Sources + + Based on common use cases: + + **Repository Statistics:** + ```python + # Collect via GitHub API, save to data.csv + # Then load and visualize + data = pd.read_csv('/tmp/gh-aw/python/data/repo_stats.csv') + ``` + + **Workflow Metrics:** + ```python + # Collect via GitHub Actions API, save to data.json + data = pd.read_json('/tmp/gh-aw/python/data/workflow_metrics.json') + ``` + + **Sample Data Generation:** + ```python + # Generate with NumPy, save to file first + import numpy as np + data = np.random.randn(100, 2) + df = pd.DataFrame(data, columns=['x', 'y']) + df.to_csv('/tmp/gh-aw/python/data/sample_data.csv', index=False) + + # Then load it back (demonstrating the pattern) + data = pd.read_csv('/tmp/gh-aw/python/data/sample_data.csv') + ``` + + # Trends Visualization Guide + + You are an expert at creating compelling trend visualizations that reveal insights from data over time. + + ## Trending Chart Best Practices + + When generating trending charts, focus on: + + ### 1. **Time Series Excellence** + - Use line charts for continuous trends over time + - Add trend lines or moving averages to highlight patterns + - Include clear date/time labels on the x-axis + - Show confidence intervals or error bands when relevant + + ### 2. **Comparative Trends** + - Use multi-line charts to compare multiple trends + - Apply distinct colors for each series with a clear legend + - Consider using area charts for stacked trends + - Highlight key inflection points or anomalies + + ### 3. **Visual Impact** + - Use vibrant, contrasting colors to make trends stand out + - Add annotations for significant events or milestones + - Include grid lines for easier value reading + - Use appropriate scale (linear vs. logarithmic) + + ### 4. **Contextual Information** + - Show percentage changes or growth rates + - Include baseline comparisons (year-over-year, month-over-month) + - Add summary statistics (min, max, average, median) + - Highlight recent trends vs. historical patterns + + ## Example Trend Chart Types + + ### Temporal Trends + ```python + # Line chart with multiple trends fig, ax = plt.subplots(figsize=(12, 7), dpi=300) - df.groupby('date')['value'].mean().plot(ax=ax, marker='o') - ax.set_title('Trend', fontsize=16, fontweight='bold') + for column in data.columns: + ax.plot(data.index, data[column], marker='o', label=column, linewidth=2) + ax.set_title('Trends Over Time', fontsize=16, fontweight='bold') + ax.set_xlabel('Date', fontsize=12) + ax.set_ylabel('Value', fontsize=12) + ax.legend(loc='best') + ax.grid(True, alpha=0.3) plt.xticks(rotation=45) + ``` + + ### Growth Rates + ```python + # Bar chart showing period-over-period growth + fig, ax = plt.subplots(figsize=(10, 6), dpi=300) + growth_data.plot(kind='bar', ax=ax, color=sns.color_palette("husl")) + ax.set_title('Growth Rates by Period', fontsize=16, fontweight='bold') + ax.axhline(y=0, color='black', linestyle='-', linewidth=0.8) + ax.set_ylabel('Growth %', fontsize=12) + ``` + + ### Moving Averages + ```python + # Trend with moving average overlay + fig, ax = plt.subplots(figsize=(12, 7), dpi=300) + ax.plot(dates, values, label='Actual', alpha=0.5, linewidth=1) + ax.plot(dates, moving_avg, label='7-day Moving Average', linewidth=2.5) + ax.fill_between(dates, values, moving_avg, alpha=0.2) + ``` + + ## Data Preparation for Trends + + ### Time-Based Indexing + ```python + # Convert to datetime and set as index + data['date'] = pd.to_datetime(data['date']) + data.set_index('date', inplace=True) + data = data.sort_index() + ``` + + ### Resampling and Aggregation + ```python + # Resample daily data to weekly + weekly_data = data.resample('W').mean() + + # Calculate rolling statistics + data['rolling_mean'] = data['value'].rolling(window=7).mean() + data['rolling_std'] = data['value'].rolling(window=7).std() + ``` + + ### Growth Calculations + ```python + # Calculate percentage change + data['pct_change'] = data['value'].pct_change() * 100 + + # Calculate year-over-year growth + data['yoy_growth'] = data['value'].pct_change(periods=365) * 100 + ``` + + ## Color Palettes for Trends + + Use these palettes for impactful trend visualizations: + + - **Sequential trends**: `sns.color_palette("viridis", n_colors=5)` + - **Diverging trends**: `sns.color_palette("RdYlGn", n_colors=7)` + - **Multiple series**: `sns.color_palette("husl", n_colors=8)` + - **Categorical**: `sns.color_palette("Set2", n_colors=6)` + + ## Annotation Best Practices + + ```python + # Annotate key points + max_idx = data['value'].idxmax() + max_val = data['value'].max() + ax.annotate(f'Peak: {max_val:.2f}', + xy=(max_idx, max_val), + xytext=(10, 20), + textcoords='offset points', + arrowprops=dict(arrowstyle='->', color='red'), + fontsize=10, + fontweight='bold') + ``` + + ## Styling for Awesome Charts + + ```python + import matplotlib.pyplot as plt + import seaborn as sns + + # Set professional style + sns.set_style("whitegrid") + sns.set_context("notebook", font_scale=1.2) + + # Custom color palette + custom_colors = ["#FF6B6B", "#4ECDC4", "#45B7D1", "#FFA07A", "#98D8C8"] + sns.set_palette(custom_colors) + + # Figure with optimal dimensions + fig, ax = plt.subplots(figsize=(14, 8), dpi=300) + + # ... your plotting code ... + + # Tight layout for clean appearance plt.tight_layout() - plt.savefig('/tmp/gh-aw/python/charts/trend.png', dpi=300, bbox_inches='tight') + + # Save with high quality + plt.savefig('/tmp/gh-aw/python/charts/trend_chart.png', + dpi=300, + bbox_inches='tight', + facecolor='white', + edgecolor='none') ``` - ## Best Practices + ## Tips for Trending Charts + + 1. **Start with the story**: What trend are you trying to show? + 2. **Choose the right timeframe**: Match granularity to the pattern + 3. **Smooth noise**: Use moving averages for volatile data + 4. **Show context**: Include historical baselines or benchmarks + 5. **Highlight insights**: Use annotations to draw attention + 6. **Test readability**: Ensure labels and legends are clear + 7. **Optimize colors**: Use colorblind-friendly palettes + 8. **Export high quality**: Always use DPI 300+ for presentations + + ## Common Trend Patterns to Visualize - - Use JSON Lines (`.jsonl`) for append-only storage - - Include ISO 8601 timestamps in all data points - - Implement 90-day retention: `df[df['timestamp'] >= cutoff_date]` - - Charts: 300 DPI, 12x7 inches, clear labels, seaborn style + - **Seasonal patterns**: Monthly or quarterly cycles + - **Long-term growth**: Exponential or linear trends + - **Volatility changes**: Periods of stability vs. fluctuation + - **Correlations**: How multiple trends relate + - **Anomalies**: Outliers or unusual events + - **Forecasts**: Projected future trends with uncertainty + + Remember: The best trending charts tell a clear story, make patterns obvious, and inspire action based on the insights revealed. {{#runtime-import? .github/shared-instructions.md}} @@ -540,23 +950,321 @@ jobs: {"date": "2024-01-15", "timestamp": 1705334400, "metrics": {"size": {...}, "quality": {...}, "tests": {...}, "churn": {...}, "workflows": {...}, "docs": {...}}} ``` + ## Data Visualization with Python + + Generate **6 high-quality charts** to visualize code metrics and trends using Python, matplotlib, and seaborn. All charts must be uploaded as assets and embedded in the discussion report. + + ### Required Charts + + #### 1. LOC by Language (`loc_by_language.png`) + **Type**: Horizontal bar chart + **Content**: Distribution of lines of code by programming language + - Sort by LOC descending + - Include percentage labels on bars + - Use color-coding by language type (e.g., compiled vs interpreted) + - Show total LOC in title + - Save to: `/tmp/gh-aw/python/charts/loc_by_language.png` + + #### 2. Top Directories (`top_directories.png`) + **Type**: Horizontal bar chart + **Content**: Top 10 directories by lines of code + - Show full directory paths + - Display LOC count and percentage of total codebase + - Highlight key directories (cmd, pkg, docs, workflows) + - Use distinct colors for different directory types + - Save to: `/tmp/gh-aw/python/charts/top_directories.png` + + #### 3. Quality Score Breakdown (`quality_score_breakdown.png`) + **Type**: Stacked bar or pie chart with breakdown + **Content**: Quality score component breakdown + - Test Coverage: 30% + - Code Organization: 25% + - Documentation: 20% + - Churn Stability: 15% + - Comment Density: 10% + - Show current score vs target (100%) for each component + - Use color gradient from red (poor) to green (excellent) + - Save to: `/tmp/gh-aw/python/charts/quality_score_breakdown.png` + + #### 4. Test Coverage (`test_coverage.png`) + **Type**: Grouped bar chart or side-by-side comparison + **Content**: Test vs source code comparison + - Test LOC vs Source LOC by language + - Test-to-source ratio visualization + PROMPT_EOF + - name: Append prompt (part 2) + env: + GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt + run: | + cat << 'PROMPT_EOF' >> "$GH_AW_PROMPT" + - Include trend indicator if historical data available + - Highlight recommended ratio (e.g., 0.5-1.0) + - Save to: `/tmp/gh-aw/python/charts/test_coverage.png` + + #### 5. Code Churn (`code_churn.png`) + **Type**: Diverging bar chart + **Content**: Top 10 most changed files in last 7 days + - Show lines added (positive) and deleted (negative) + - Net change highlighting + - Color-code by file type + - Include file paths truncated if needed + - Save to: `/tmp/gh-aw/python/charts/code_churn.png` + + #### 6. Historical Trends (`historical_trends.png`) + **Type**: Multi-line time series chart + **Content**: Track key metrics over 30 days + - Total LOC trend line + - Test coverage percentage trend line + - Quality score trend line + - Use multiple y-axes if scales differ significantly + - Show 7-day moving averages + - Annotate significant changes (>10%) + - Save to: `/tmp/gh-aw/python/charts/historical_trends.png` + + ### Chart Quality Standards + + All charts must meet these quality standards: + + - **DPI**: 300 minimum for publication quality + - **Figure Size**: 12x7 inches (consistent with daily-issues-report) + - **Styling**: Use seaborn styling (`sns.set_style("whitegrid")`) + - **Color Palette**: Professional colors (`sns.set_palette("husl")` or custom) + - **Labels**: Clear titles, axis labels, and legends + - **Grid Lines**: Enable for readability (`ax.grid(True, alpha=0.3)`) + - **Save Format**: PNG with `bbox_inches='tight'` for proper cropping + + ### Python Script Structure + + Create a Python script to collect data, analyze metrics, and generate all 6 charts: + + ```python + #!/usr/bin/env python3 + """ + Daily Code Metrics Analysis and Visualization + Generates 6 charts for code metrics tracking + """ + import pandas as pd + import numpy as np + import matplotlib.pyplot as plt + import seaborn as sns + from datetime import datetime, timedelta + import json + from pathlib import Path + + # Set style + sns.set_style("whitegrid") + sns.set_palette("husl") + + # Load historical data from repo-memory + history_file = Path('/tmp/gh-aw/repo-memory/default/history.jsonl') + historical_data = [] + if history_file.exists(): + with open(history_file, 'r') as f: + for line in f: + historical_data.append(json.loads(line)) + + # Load current metrics from data files + # (Collect metrics using bash commands and save to JSON first) + current_metrics = json.load(open('/tmp/gh-aw/python/data/current_metrics.json')) + + # Generate each chart + # Chart 1: LOC by Language + # ... implementation ... + + # Chart 2: Top Directories + # ... implementation ... + + # Chart 3: Quality Score Breakdown + # ... implementation ... + + # Chart 4: Test Coverage + # ... implementation ... + + # Chart 5: Code Churn + # ... implementation ... + + # Chart 6: Historical Trends + # ... implementation ... + + print("All charts generated successfully") + ``` + + ### Chart Upload and Embedding + + After generating charts: + + 1. **Upload each chart as an asset**: + - Use the `upload asset` safe-output tool for each PNG file + - Collect the returned URLs for embedding + + 2. **Embed in discussion report**: + ```markdown + ## 📊 Visualizations + + ### LOC Distribution by Language + ![LOC by Language](URL_FROM_UPLOAD_ASSET_1) + + ### Top Directories by LOC + ![Top Directories](URL_FROM_UPLOAD_ASSET_2) + + ### Quality Score Breakdown + ![Quality Score](URL_FROM_UPLOAD_ASSET_3) + + ### Test Coverage Analysis + ![Test Coverage](URL_FROM_UPLOAD_ASSET_4) + + ### Code Churn (7 Days) + ![Code Churn](URL_FROM_UPLOAD_ASSET_5) + + ### Historical Trends (30 Days) + ![Historical Trends](URL_FROM_UPLOAD_ASSET_6) + ``` + ## Trend Calculation For each metric: current value, 7-day % change, 30-day % change, trend indicator (⬆️/➡️/⬇️) ## Report Format - Use detailed template with: - - Executive summary table (current, 7d/30d trends, quality score 0-100) - - Size metrics by language/directory/files - - Quality indicators (complexity, large files) - - Test coverage (files, LOC, ratio, trends) - - Code churn (7d: files, commits, lines, top files) - - Workflow metrics (count, avg size, growth) - - Documentation (files, LOC, coverage) - - Historical trends (ASCII charts optional) - - Insights & recommendations (3-5 actionable items) - - Quality score breakdown (Test 30%, Organization 25%, Docs 20%, Churn 15%, Comments 10%) + Use detailed template with embedded visualization charts: + + ### Discussion Structure + + **Title**: `Daily Code Metrics Report - YYYY-MM-DD` + + **Body**: + + ```markdown + Brief 2-3 paragraph executive summary highlighting key findings, quality score, notable trends, and any concerns requiring attention. + + ## 📊 Visualizations + + ### LOC Distribution by Language + ![LOC by Language](URL_FROM_UPLOAD_ASSET) + + [Analysis of language distribution and changes] + + ### Top Directories by LOC + ![Top Directories](URL_FROM_UPLOAD_ASSET) + + [Analysis of directory sizes and organization] + + ### Quality Score Breakdown + ![Quality Score](URL_FROM_UPLOAD_ASSET) + + [Current quality score and component analysis] + + ### Test Coverage Analysis + ![Test Coverage](URL_FROM_UPLOAD_ASSET) + + [Test coverage metrics and recommendations] + + ### Code Churn (Last 7 Days) + ![Code Churn](URL_FROM_UPLOAD_ASSET) + + [Most changed files and activity patterns] + + ### Historical Trends (30 Days) + ![Historical Trends](URL_FROM_UPLOAD_ASSET) + + [Trend analysis and significant changes] + +
+ 📈 Detailed Metrics + + ## Size Metrics + + ### Lines of Code by Language + | Language | LOC | % of Total | Change (7d) | + |----------|-----|------------|-------------| + | Go | X,XXX | XX% | ⬆️ +X% | + | JavaScript | X,XXX | XX% | ➡️ 0% | + | ... | ... | ... | ... | + + ### Lines of Code by Directory + | Directory | LOC | % of Total | Files | + |-----------|-----|------------|-------| + | pkg/ | X,XXX | XX% | XXX | + | cmd/ | X,XXX | XX% | XX | + | ... | ... | ... | ... | + + ## Quality Indicators + + - **Average File Size**: XXX lines + - **Large Files (>500 LOC)**: XX files + - **Function Count**: X,XXX functions + - **Comment Lines**: X,XXX lines (XX% ratio) + - **Comment Density**: XX% + + ## Test Coverage + + - **Test Files**: XX files + - **Test LOC**: X,XXX lines + - **Source LOC**: X,XXX lines + - **Test-to-Source Ratio**: X.XX + - **Trend (7d)**: ⬆️ +X% + - **Trend (30d)**: ⬆️ +X% + + ## Code Churn (Last 7 Days) + + - **Files Modified**: XXX files + - **Commits**: XXX commits + - **Lines Added**: +X,XXX lines + - **Lines Deleted**: -X,XXX lines + - **Net Change**: +/-X,XXX lines + + ### Most Active Files + 1. path/to/file.go: +XXX/-XXX lines + 2. path/to/file.js: +XXX/-XXX lines + ... + + ## Workflow Metrics + + - **Total Workflow Files (.md)**: XXX files + - **Compiled Workflows (.lock.yml)**: XXX files + - **Average Workflow Size**: XXX lines + - **Growth (7d)**: ⬆️ +X% + + ## Documentation + + - **Doc Files (docs/)**: XXX files + - **Doc LOC**: X,XXX lines + - **Code-to-Docs Ratio**: X.XX:1 + - **Documentation Coverage**: XX% + + ## Quality Score: XX/100 + + ### Component Breakdown + - **Test Coverage (30%)**: XX/30 points + - **Code Organization (25%)**: XX/25 points + - **Documentation (20%)**: XX/20 points + - **Churn Stability (15%)**: XX/15 points + - **Comment Density (10%)**: XX/10 points + +
+ + ## 💡 Insights & Recommendations + + 1. [Specific actionable recommendation based on metrics] + 2. [Another recommendation] + 3. [Focus area for improvement] + 4. [...] + + --- + *Report generated by Daily Code Metrics workflow* + *Historical data: 30 days | Last updated: YYYY-MM-DD HH:MM UTC* + ``` + + ### Report Guidelines + + - Include all 6 visualization charts as embedded images + - Upload charts using `upload asset` tool for permanent URLs + - Provide brief analysis for each chart + - Use collapsible details section for detailed metrics tables + - Highlight trends with emoji indicators (⬆️/➡️/⬇️) + - Calculate and display quality score prominently + - Provide 3-5 actionable recommendations + - Include metadata footer with generation info ## Quality Score @@ -569,7 +1277,10 @@ jobs: - Use repo memory for persistent history (90-day retention) - Handle missing data gracefully - Visual indicators for quick scanning - - Store metrics to repo memory, create discussion report + - Generate all 6 required visualization charts + - Upload charts as assets for permanent URLs + - Embed charts in discussion report with analysis + - Store metrics to repo memory, create discussion report with visualizations PROMPT_EOF - name: Append XPIA security instructions to prompt @@ -650,7 +1361,7 @@ jobs: To create or modify GitHub resources (issues, discussions, pull requests, etc.), you MUST call the appropriate safe output tool. Simply writing content will NOT work - the workflow requires actual tool calls. - **Available tools**: create_discussion, missing_tool, noop + **Available tools**: create_discussion, missing_tool, noop, upload_asset **Critical**: Tool calls write structured data that downstream jobs process. Without tool calls, follow-up actions will be skipped. @@ -841,6 +1552,9 @@ jobs: DISABLE_BUG_COMMAND: 1 DISABLE_ERROR_REPORTING: 1 DISABLE_TELEMETRY: 1 + GH_AW_ASSETS_ALLOWED_EXTS: ".png,.jpg,.jpeg" + GH_AW_ASSETS_BRANCH: "assets/${{ github.workflow }}" + GH_AW_ASSETS_MAX_SIZE_KB: 10240 GH_AW_MCP_CONFIG: /tmp/gh-aw/mcp-config/mcp-servers.json GH_AW_MODEL_AGENT_CLAUDE: ${{ vars.GH_AW_MODEL_AGENT_CLAUDE || '' }} GH_AW_PROMPT: /tmp/gh-aw/aw-prompts/prompt.txt @@ -952,6 +1666,13 @@ jobs: with: name: cache-memory path: /tmp/gh-aw/cache-memory + - name: Upload safe outputs assets + if: always() + uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 + with: + name: safe-outputs-assets + path: /tmp/gh-aw/safeoutputs/assets/ + if-no-files-found: ignore - name: Validate agent logs for errors if: always() uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 @@ -973,6 +1694,7 @@ jobs: - push_repo_memory - safe_outputs - update_cache_memory + - upload_assets if: (always()) && (needs.agent.result != 'skipped') runs-on: ubuntu-slim permissions: @@ -1408,6 +2130,86 @@ jobs: - name: Save cache-memory to cache (default) uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 with: - key: trending-data-${{ github.workflow }}-${{ github.run_id }} + key: memory-${{ github.workflow }}-${{ github.run_id }} path: /tmp/gh-aw/cache-memory + upload_assets: + needs: + - agent + - detection + if: ((!cancelled()) && (needs.agent.result != 'skipped')) && (contains(needs.agent.outputs.output_types, 'upload_asset')) + runs-on: ubuntu-slim + permissions: + contents: write + timeout-minutes: 10 + outputs: + branch_name: ${{ steps.upload_assets.outputs.branch_name }} + published_count: ${{ steps.upload_assets.outputs.published_count }} + steps: + - name: Checkout actions folder + uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1 + with: + sparse-checkout: | + actions + persist-credentials: false + - name: Setup Scripts + uses: ./actions/setup + with: + destination: /tmp/gh-aw/actions + - name: Checkout repository + uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1 + with: + persist-credentials: false + fetch-depth: 0 + - name: Configure Git credentials + env: + REPO_NAME: ${{ github.repository }} + SERVER_URL: ${{ github.server_url }} + run: | + git config --global user.email "github-actions[bot]@users.noreply.github.com" + git config --global user.name "github-actions[bot]" + # Re-authenticate git with GitHub token + SERVER_URL_STRIPPED="${SERVER_URL#https://}" + git remote set-url origin "https://x-access-token:${{ github.token }}@${SERVER_URL_STRIPPED}/${REPO_NAME}.git" + echo "Git configured with standard GitHub Actions identity" + - name: Download assets + continue-on-error: true + uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0 + with: + name: safe-outputs-assets + path: /tmp/gh-aw/safeoutputs/assets/ + - name: List downloaded asset files + continue-on-error: true + run: | + echo "Downloaded asset files:" + find /tmp/gh-aw/safeoutputs/assets/ -maxdepth 1 -ls + - name: Download agent output artifact + continue-on-error: true + uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0 + with: + name: agent-output + path: /tmp/gh-aw/safeoutputs/ + - name: Setup agent output environment variable + run: | + mkdir -p /tmp/gh-aw/safeoutputs/ + find "/tmp/gh-aw/safeoutputs/" -type f -print + echo "GH_AW_AGENT_OUTPUT=/tmp/gh-aw/safeoutputs/agent_output.json" >> "$GITHUB_ENV" + - name: Upload Assets to Orphaned Branch + id: upload_assets + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 + env: + GH_AW_AGENT_OUTPUT: ${{ env.GH_AW_AGENT_OUTPUT }} + GH_AW_ASSETS_BRANCH: "assets/${{ github.workflow }}" + GH_AW_ASSETS_MAX_SIZE_KB: 10240 + GH_AW_ASSETS_ALLOWED_EXTS: ".png,.jpg,.jpeg" + GH_AW_WORKFLOW_NAME: "Daily Code Metrics and Trend Tracking Agent" + GH_AW_TRACKER_ID: "daily-code-metrics" + GH_AW_ENGINE_ID: "claude" + with: + github-token: ${{ secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} + script: | + const { setupGlobals } = require('/tmp/gh-aw/actions/setup_globals.cjs'); + setupGlobals(core, github, context, exec, io); + const { main } = require('/tmp/gh-aw/actions/upload_assets.cjs'); + await main(); + diff --git a/.github/workflows/daily-code-metrics.md b/.github/workflows/daily-code-metrics.md index a78042e6a8e..f928e7f4fd9 100644 --- a/.github/workflows/daily-code-metrics.md +++ b/.github/workflows/daily-code-metrics.md @@ -17,6 +17,7 @@ tools: max-file-size: 102400 # 100KB bash: safe-outputs: + upload-asset: create-discussion: expires: 3d category: "audits" @@ -26,7 +27,8 @@ timeout-minutes: 15 strict: true imports: - shared/reporting.md - - shared/trending-charts-simple.md + - shared/python-dataviz.md + - shared/trends.md --- {{#runtime-import? .github/shared-instructions.md}} @@ -62,23 +64,315 @@ Store as JSON Lines in `/tmp/gh-aw/repo-memory/default/history.jsonl`: {"date": "2024-01-15", "timestamp": 1705334400, "metrics": {"size": {...}, "quality": {...}, "tests": {...}, "churn": {...}, "workflows": {...}, "docs": {...}}} ``` +## Data Visualization with Python + +Generate **6 high-quality charts** to visualize code metrics and trends using Python, matplotlib, and seaborn. All charts must be uploaded as assets and embedded in the discussion report. + +### Required Charts + +#### 1. LOC by Language (`loc_by_language.png`) +**Type**: Horizontal bar chart +**Content**: Distribution of lines of code by programming language +- Sort by LOC descending +- Include percentage labels on bars +- Use color-coding by language type (e.g., compiled vs interpreted) +- Show total LOC in title +- Save to: `/tmp/gh-aw/python/charts/loc_by_language.png` + +#### 2. Top Directories (`top_directories.png`) +**Type**: Horizontal bar chart +**Content**: Top 10 directories by lines of code +- Show full directory paths +- Display LOC count and percentage of total codebase +- Highlight key directories (cmd, pkg, docs, workflows) +- Use distinct colors for different directory types +- Save to: `/tmp/gh-aw/python/charts/top_directories.png` + +#### 3. Quality Score Breakdown (`quality_score_breakdown.png`) +**Type**: Stacked bar or pie chart with breakdown +**Content**: Quality score component breakdown +- Test Coverage: 30% +- Code Organization: 25% +- Documentation: 20% +- Churn Stability: 15% +- Comment Density: 10% +- Show current score vs target (100%) for each component +- Use color gradient from red (poor) to green (excellent) +- Save to: `/tmp/gh-aw/python/charts/quality_score_breakdown.png` + +#### 4. Test Coverage (`test_coverage.png`) +**Type**: Grouped bar chart or side-by-side comparison +**Content**: Test vs source code comparison +- Test LOC vs Source LOC by language +- Test-to-source ratio visualization +- Include trend indicator if historical data available +- Highlight recommended ratio (e.g., 0.5-1.0) +- Save to: `/tmp/gh-aw/python/charts/test_coverage.png` + +#### 5. Code Churn (`code_churn.png`) +**Type**: Diverging bar chart +**Content**: Top 10 most changed files in last 7 days +- Show lines added (positive) and deleted (negative) +- Net change highlighting +- Color-code by file type +- Include file paths truncated if needed +- Save to: `/tmp/gh-aw/python/charts/code_churn.png` + +#### 6. Historical Trends (`historical_trends.png`) +**Type**: Multi-line time series chart +**Content**: Track key metrics over 30 days +- Total LOC trend line +- Test coverage percentage trend line +- Quality score trend line +- Use multiple y-axes if scales differ significantly +- Show 7-day moving averages +- Annotate significant changes (>10%) +- Save to: `/tmp/gh-aw/python/charts/historical_trends.png` + +### Chart Quality Standards + +All charts must meet these quality standards: + +- **DPI**: 300 minimum for publication quality +- **Figure Size**: 12x7 inches (consistent with daily-issues-report) +- **Styling**: Use seaborn styling (`sns.set_style("whitegrid")`) +- **Color Palette**: Professional colors (`sns.set_palette("husl")` or custom) +- **Labels**: Clear titles, axis labels, and legends +- **Grid Lines**: Enable for readability (`ax.grid(True, alpha=0.3)`) +- **Save Format**: PNG with `bbox_inches='tight'` for proper cropping + +### Python Script Structure + +Create a Python script to collect data, analyze metrics, and generate all 6 charts: + +```python +#!/usr/bin/env python3 +""" +Daily Code Metrics Analysis and Visualization +Generates 6 charts for code metrics tracking +""" +import pandas as pd +import numpy as np +import matplotlib.pyplot as plt +import seaborn as sns +from datetime import datetime, timedelta +import json +from pathlib import Path + +# Set style +sns.set_style("whitegrid") +sns.set_palette("husl") + +# Load historical data from repo-memory +history_file = Path('/tmp/gh-aw/repo-memory/default/history.jsonl') +historical_data = [] +if history_file.exists(): + with open(history_file, 'r') as f: + for line in f: + historical_data.append(json.loads(line)) + +# Load current metrics from data files +# (Collect metrics using bash commands and save to JSON first) +current_metrics = json.load(open('/tmp/gh-aw/python/data/current_metrics.json')) + +# Generate each chart +# Chart 1: LOC by Language +# ... implementation ... + +# Chart 2: Top Directories +# ... implementation ... + +# Chart 3: Quality Score Breakdown +# ... implementation ... + +# Chart 4: Test Coverage +# ... implementation ... + +# Chart 5: Code Churn +# ... implementation ... + +# Chart 6: Historical Trends +# ... implementation ... + +print("All charts generated successfully") +``` + +### Chart Upload and Embedding + +After generating charts: + +1. **Upload each chart as an asset**: + - Use the `upload asset` safe-output tool for each PNG file + - Collect the returned URLs for embedding + +2. **Embed in discussion report**: + ```markdown + ## 📊 Visualizations + + ### LOC Distribution by Language + ![LOC by Language](URL_FROM_UPLOAD_ASSET_1) + + ### Top Directories by LOC + ![Top Directories](URL_FROM_UPLOAD_ASSET_2) + + ### Quality Score Breakdown + ![Quality Score](URL_FROM_UPLOAD_ASSET_3) + + ### Test Coverage Analysis + ![Test Coverage](URL_FROM_UPLOAD_ASSET_4) + + ### Code Churn (7 Days) + ![Code Churn](URL_FROM_UPLOAD_ASSET_5) + + ### Historical Trends (30 Days) + ![Historical Trends](URL_FROM_UPLOAD_ASSET_6) + ``` + ## Trend Calculation For each metric: current value, 7-day % change, 30-day % change, trend indicator (⬆️/➡️/⬇️) ## Report Format -Use detailed template with: -- Executive summary table (current, 7d/30d trends, quality score 0-100) -- Size metrics by language/directory/files -- Quality indicators (complexity, large files) -- Test coverage (files, LOC, ratio, trends) -- Code churn (7d: files, commits, lines, top files) -- Workflow metrics (count, avg size, growth) -- Documentation (files, LOC, coverage) -- Historical trends (ASCII charts optional) -- Insights & recommendations (3-5 actionable items) -- Quality score breakdown (Test 30%, Organization 25%, Docs 20%, Churn 15%, Comments 10%) +Use detailed template with embedded visualization charts: + +### Discussion Structure + +**Title**: `Daily Code Metrics Report - YYYY-MM-DD` + +**Body**: + +```markdown +Brief 2-3 paragraph executive summary highlighting key findings, quality score, notable trends, and any concerns requiring attention. + +## 📊 Visualizations + +### LOC Distribution by Language +![LOC by Language](URL_FROM_UPLOAD_ASSET) + +[Analysis of language distribution and changes] + +### Top Directories by LOC +![Top Directories](URL_FROM_UPLOAD_ASSET) + +[Analysis of directory sizes and organization] + +### Quality Score Breakdown +![Quality Score](URL_FROM_UPLOAD_ASSET) + +[Current quality score and component analysis] + +### Test Coverage Analysis +![Test Coverage](URL_FROM_UPLOAD_ASSET) + +[Test coverage metrics and recommendations] + +### Code Churn (Last 7 Days) +![Code Churn](URL_FROM_UPLOAD_ASSET) + +[Most changed files and activity patterns] + +### Historical Trends (30 Days) +![Historical Trends](URL_FROM_UPLOAD_ASSET) + +[Trend analysis and significant changes] + +
+📈 Detailed Metrics + +## Size Metrics + +### Lines of Code by Language +| Language | LOC | % of Total | Change (7d) | +|----------|-----|------------|-------------| +| Go | X,XXX | XX% | ⬆️ +X% | +| JavaScript | X,XXX | XX% | ➡️ 0% | +| ... | ... | ... | ... | + +### Lines of Code by Directory +| Directory | LOC | % of Total | Files | +|-----------|-----|------------|-------| +| pkg/ | X,XXX | XX% | XXX | +| cmd/ | X,XXX | XX% | XX | +| ... | ... | ... | ... | + +## Quality Indicators + +- **Average File Size**: XXX lines +- **Large Files (>500 LOC)**: XX files +- **Function Count**: X,XXX functions +- **Comment Lines**: X,XXX lines (XX% ratio) +- **Comment Density**: XX% + +## Test Coverage + +- **Test Files**: XX files +- **Test LOC**: X,XXX lines +- **Source LOC**: X,XXX lines +- **Test-to-Source Ratio**: X.XX +- **Trend (7d)**: ⬆️ +X% +- **Trend (30d)**: ⬆️ +X% + +## Code Churn (Last 7 Days) + +- **Files Modified**: XXX files +- **Commits**: XXX commits +- **Lines Added**: +X,XXX lines +- **Lines Deleted**: -X,XXX lines +- **Net Change**: +/-X,XXX lines + +### Most Active Files +1. path/to/file.go: +XXX/-XXX lines +2. path/to/file.js: +XXX/-XXX lines +... + +## Workflow Metrics + +- **Total Workflow Files (.md)**: XXX files +- **Compiled Workflows (.lock.yml)**: XXX files +- **Average Workflow Size**: XXX lines +- **Growth (7d)**: ⬆️ +X% + +## Documentation + +- **Doc Files (docs/)**: XXX files +- **Doc LOC**: X,XXX lines +- **Code-to-Docs Ratio**: X.XX:1 +- **Documentation Coverage**: XX% + +## Quality Score: XX/100 + +### Component Breakdown +- **Test Coverage (30%)**: XX/30 points +- **Code Organization (25%)**: XX/25 points +- **Documentation (20%)**: XX/20 points +- **Churn Stability (15%)**: XX/15 points +- **Comment Density (10%)**: XX/10 points + +
+ +## 💡 Insights & Recommendations + +1. [Specific actionable recommendation based on metrics] +2. [Another recommendation] +3. [Focus area for improvement] +4. [...] + +--- +*Report generated by Daily Code Metrics workflow* +*Historical data: 30 days | Last updated: YYYY-MM-DD HH:MM UTC* +``` + +### Report Guidelines + +- Include all 6 visualization charts as embedded images +- Upload charts using `upload asset` tool for permanent URLs +- Provide brief analysis for each chart +- Use collapsible details section for detailed metrics tables +- Highlight trends with emoji indicators (⬆️/➡️/⬇️) +- Calculate and display quality score prominently +- Provide 3-5 actionable recommendations +- Include metadata footer with generation info ## Quality Score @@ -91,5 +385,8 @@ Weighted average: Test coverage (30%), Code organization (25%), Documentation (2 - Use repo memory for persistent history (90-day retention) - Handle missing data gracefully - Visual indicators for quick scanning -- Store metrics to repo memory, create discussion report +- Generate all 6 required visualization charts +- Upload charts as assets for permanent URLs +- Embed charts in discussion report with analysis +- Store metrics to repo memory, create discussion report with visualizations