diff --git a/.github/workflows/auto-assign-pr.yml b/.github/workflows/auto-assign-pr.yml index b370bf0..161024f 100644 --- a/.github/workflows/auto-assign-pr.yml +++ b/.github/workflows/auto-assign-pr.yml @@ -21,13 +21,20 @@ jobs: const assignees = [copilotUsername]; // Or: ["copilot","anotheruser"] const currentAssignees = context.payload.pull_request.assignees.map(u => u.login); if (!assignees.every(a => currentAssignees.includes(a))) { - await github.rest.issues.addAssignees({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: context.payload.pull_request.number, - assignees - }); - console.log(`Assigned ${assignees.join(", ")} to PR #${context.payload.pull_request.number}`); + console.log(`PR has assignees to add. Attempting to assign ${assignees.join(", ")}...`); + + try { + await github.rest.issues.addAssignees({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.payload.pull_request.number, + assignees + }); + console.log(`✅ Assigned ${assignees.join(", ")} to PR #${context.payload.pull_request.number}`); + } catch (error) { + console.log(`⚠️ Failed to assign users: ${error.message}`); + console.log("Note: This may be due to insufficient permissions or the user not being a collaborator."); + } } else { - console.log(`Already assigned: ${assignees.join(", ")} on PR #${context.payload.pull_request.number}`); + console.log(`ℹ️ Already assigned: ${assignees.join(", ")} on PR #${context.payload.pull_request.number}`); } \ No newline at end of file diff --git a/.github/workflows/auto-complete-cicd-review.yml b/.github/workflows/auto-complete-cicd-review.yml index f1577bb..37365d2 100644 --- a/.github/workflows/auto-complete-cicd-review.yml +++ b/.github/workflows/auto-complete-cicd-review.yml @@ -358,36 +358,51 @@ jobs: `; // Check for existing review issues - const issues = await github.rest.issues.listForRepo({ - owner: context.repo.owner, - repo: context.repo.repo, - state: 'open', - labels: ['ci-cd-review', 'automated'], - per_page: 10 - }); - - const recentIssue = issues.data.find(issue => { - const createdAt = new Date(issue.created_at); - const hoursSinceCreation = (Date.now() - createdAt) / (1000 * 60 * 60); - return hoursSinceCreation < 24; - }); - - if (recentIssue) { - console.log(`Recent issue found: #${recentIssue.number}, updating`); - await github.rest.issues.createComment({ + try { + const issues = await github.rest.issues.listForRepo({ owner: context.repo.owner, repo: context.repo.repo, - issue_number: recentIssue.number, - body: `## Updated Review (${date})\n\n${report}` + state: 'open', + labels: ['ci-cd-review', 'automated'], + per_page: 10 }); - } else { - await github.rest.issues.create({ - owner: context.repo.owner, - repo: context.repo.repo, - title: title, - body: body, - labels: ['ci-cd-review', 'automated', 'needs-review'] + + const recentIssue = issues.data.find(issue => { + const createdAt = new Date(issue.created_at); + const hoursSinceCreation = (Date.now() - createdAt) / (1000 * 60 * 60); + return hoursSinceCreation < 24; }); + + if (recentIssue) { + console.log(`Recent issue found: #${recentIssue.number}, updating`); + try { + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: recentIssue.number, + body: `## Updated Review (${date})\n\n${report}` + }); + console.log(`✅ Updated existing issue #${recentIssue.number}`); + } catch (error) { + console.log(`⚠️ Failed to update existing issue: ${error.message}`); + } + } else { + try { + await github.rest.issues.create({ + owner: context.repo.owner, + repo: context.repo.repo, + title: title, + body: body, + labels: ['ci-cd-review', 'automated', 'needs-review'] + }); + console.log(`✅ Created new review issue`); + } catch (error) { + console.log(`⚠️ Failed to create new issue: ${error.message}`); + } + } + } catch (error) { + console.log(`⚠️ Failed to list existing issues: ${error.message}`); + console.log("Note: This may be due to insufficient permissions."); } - name: Upload Final Report diff --git a/.github/workflows/auto-copilot-code-cleanliness-review.yml b/.github/workflows/auto-copilot-code-cleanliness-review.yml index c224bf0..5bd21cb 100644 --- a/.github/workflows/auto-copilot-code-cleanliness-review.yml +++ b/.github/workflows/auto-copilot-code-cleanliness-review.yml @@ -60,28 +60,14 @@ jobs: ! -path "*/build/*" \ ! -path "*/.venv/*" \ ! -path "*/vendor/*" \ - -exec sh -c 'count=$(grep -c "$1" "$2" 2>/dev/null || echo 0); if [ "$count" -gt 20 ]; then echo "$count definitions in $2"; fi' _ "$pattern" {} \; \ + -exec sh -c 'count=$(grep -c "$1" "$2" 2>/dev/null || echo 0); count=${count:-0}; if [ "$count" -gt 20 ]; then echo "$count definitions in $2"; fi' _ "$pattern" {} \; \ 2>/dev/null || true done | sort -rn >> /tmp/analysis.md cat /tmp/analysis.md - - name: GitHub Copilot Code Review - uses: github/copilot-cli-action@main - with: - query: | - Review the codebase for code cleanliness issues: - 1. Identify files that are too large (>500 lines) and suggest how to split them into smaller, focused modules - 2. Look for code duplication and suggest refactoring opportunities - 3. Check for consistent code style and formatting - 4. Identify complex functions that could be simplified - 5. Suggest improvements for code organization and structure - 6. Check for proper separation of concerns - - Provide actionable recommendations with specific file names and line numbers. - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - continue-on-error: true + # Note: GitHub Copilot CLI action is not available as a public action + # Code cleanliness analysis is already performed in the previous step - name: Create Issue for Code Cleanliness Review uses: actions/github-script@main diff --git a/.github/workflows/auto-copilot-functionality-docs-review.yml b/.github/workflows/auto-copilot-functionality-docs-review.yml index df7bce2..3ec686a 100644 --- a/.github/workflows/auto-copilot-functionality-docs-review.yml +++ b/.github/workflows/auto-copilot-functionality-docs-review.yml @@ -181,6 +181,11 @@ jobs: class_count=$(grep -c "^class " "$file" 2>/dev/null || echo 0) docstring_count=$(grep -c '"""' "$file" 2>/dev/null || echo 0) + # Ensure variables are numeric + func_count=${func_count:-0} + class_count=${class_count:-0} + docstring_count=${docstring_count:-0} + total=$((func_count + class_count)) if [ $total -gt 0 ] && [ $docstring_count -eq 0 ]; then echo "⚠️ $file: $total definitions, no docstrings" >> /tmp/doc-analysis.md @@ -202,6 +207,11 @@ jobs: class_count=$(grep -c "^class " "$file" 2>/dev/null || echo 0) jsdoc_count=$(grep -c '/\*\*' "$file" 2>/dev/null || echo 0) + # Ensure variables are numeric + func_count=${func_count:-0} + class_count=${class_count:-0} + jsdoc_count=${jsdoc_count:-0} + total=$((func_count + class_count)) if [ $total -gt 5 ] && [ $jsdoc_count -eq 0 ]; then echo "⚠️ $file: ~$total definitions, no JSDoc comments" >> /tmp/doc-analysis.md @@ -211,24 +221,8 @@ jobs: cat /tmp/doc-analysis.md - - name: GitHub Copilot Documentation Review - uses: github/copilot-cli-actions@v1 - with: - query: | - Review the documentation for this repository: - 1. Check README.md completeness and quality - 2. Verify all features and functionality are documented - 3. Check for installation and usage instructions - 4. Identify missing or outdated documentation - 5. Suggest improvements for clarity and completeness - 6. Verify code comments and inline documentation - 7. Check for API documentation if applicable - 8. Ensure contributing guidelines are present - - Provide specific recommendations with file names and sections. - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - continue-on-error: true + # Note: GitHub Copilot CLI actions are not available as a public action + # The documentation analysis is already performed in the previous step - name: Create Documentation Review Report uses: actions/github-script@main diff --git a/.github/workflows/auto-copilot-org-playwright-loop.yaml b/.github/workflows/auto-copilot-org-playwright-loop.yaml index b728be5..63afdad 100644 --- a/.github/workflows/auto-copilot-org-playwright-loop.yaml +++ b/.github/workflows/auto-copilot-org-playwright-loop.yaml @@ -37,20 +37,13 @@ jobs: pytest tests/ || exit 1 continue-on-error: true - # Copilot PR Agent auto-review (if available for org) - - name: Copilot PR Agent Review - uses: github/copilot-agent/pr@main - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - continue-on-error: true + # Note: GitHub Copilot agent actions are not available as public actions + # This step would provide automated PR review + # For now, manual PR review is required - # Copilot Agent auto-fix (can loop up to N attempts if tests fail) - - name: Copilot Auto-fix Failing Playwright Tests - uses: github/copilot-agent/fix@main - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - max_attempts: 3 # Try up to 3 auto-fix loops! - continue-on-error: true + # Note: GitHub Copilot agent actions are not available as public actions + # This step would automatically fix failing Playwright tests with retry loops + # For now, manual test fixing is required # Create PR with fixes (if any) - name: Create Pull Request for Automated Fixes diff --git a/.github/workflows/auto-copilot-org-playwright-loopv2.yaml b/.github/workflows/auto-copilot-org-playwright-loopv2.yaml index f20950d..987a9cf 100644 --- a/.github/workflows/auto-copilot-org-playwright-loopv2.yaml +++ b/.github/workflows/auto-copilot-org-playwright-loopv2.yaml @@ -32,18 +32,13 @@ jobs: pytest tests/ || exit 1 continue-on-error: true - - name: Copilot PR Agent Review - uses: github/copilot-agent/pr@main - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - continue-on-error: true + # Note: GitHub Copilot agent actions are not available as public actions + # This step would provide automated PR review + # For now, manual PR review is required - - name: Copilot Auto-fix Failing Playwright Tests - uses: github/copilot-agent/fix@main - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - max_attempts: 3 - continue-on-error: true + # Note: GitHub Copilot agent actions are not available as public actions + # This step would automatically fix failing Playwright tests + # For now, manual test fixing is required - name: Create Pull Request for Automated Fixes uses: peter-evans/create-pull-request@main diff --git a/.github/workflows/auto-copilot-playwright-auto-test.yml b/.github/workflows/auto-copilot-playwright-auto-test.yml index de6ce89..b9cef57 100644 --- a/.github/workflows/auto-copilot-playwright-auto-test.yml +++ b/.github/workflows/auto-copilot-playwright-auto-test.yml @@ -27,23 +27,17 @@ jobs: run: | python -m playwright install - - name: Copilot Generate Playwright Scripts - uses: github/copilot-agent/playwright-generate@main # Example, customize for Python; or use Chat to generate script - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - prompt: "Generate Playwright test scripts covering every user action on this web app." - continue-on-error: true # If your agent doesn't support, replace with python script generation using Copilot Chat + # Note: GitHub Copilot agent actions are not available as public actions + # This step would generate Playwright test scripts automatically + # For now, manual test script creation is required - name: Run Playwright Tests run: | pytest tests/ # Or the path to your Playwright scripts - - name: If Tests Fail, Copilot Attempts Fix & Repeats - uses: github/copilot-agent/playwright-fix-and-loop@main # Example, requires agent loop feature - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - max_attempts: 5 - continue-on-error: true + # Note: GitHub Copilot agent actions are not available as public actions + # This step would automatically fix failing tests and retry + # For now, manual test fixing is required - name: Create PR with passing tests or attempted fixes uses: peter-evans/create-pull-request@main diff --git a/.github/workflows/auto-copilot-test-review-playwright.yml b/.github/workflows/auto-copilot-test-review-playwright.yml index 1799363..a85bf80 100644 --- a/.github/workflows/auto-copilot-test-review-playwright.yml +++ b/.github/workflows/auto-copilot-test-review-playwright.yml @@ -160,24 +160,8 @@ jobs: cat /tmp/test-analysis.md - - name: GitHub Copilot Test Review - uses: github/copilot-cli-action@main - with: - query: | - Review the test suite for this repository: - 1. Verify all web-based functionality has Playwright tests (both headed and headless) - 2. Identify missing test coverage for critical functionality - 3. Check test quality and maintainability - 4. Suggest improvements for test organization - 5. Verify tests follow best practices (isolation, clarity, proper assertions) - 6. Check for flaky tests or tests with timing issues - 7. Ensure tests are running in CI/CD pipeline - - For any web tests not using Playwright, recommend migration. - Provide specific, actionable recommendations with file names. - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - continue-on-error: true + # Note: GitHub Copilot CLI action is not available as a public action + # Test analysis is already performed in the previous step - name: Create or Update Test Review Issue uses: actions/github-script@main diff --git a/.github/workflows/auto-label-comment-prs.yml b/.github/workflows/auto-label-comment-prs.yml index 2209540..51067fb 100644 --- a/.github/workflows/auto-label-comment-prs.yml +++ b/.github/workflows/auto-label-comment-prs.yml @@ -11,17 +11,31 @@ jobs: github-token: ${{ secrets.GITHUB_TOKEN }} script: | const pr_number = context.payload.pull_request.number; + // Add label - await github.rest.issues.addLabels({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: pr_number, - labels: ["needs-review", "copilot"] // <-- TUNE ME - }); + try { + await github.rest.issues.addLabels({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: pr_number, + labels: ["needs-review", "copilot"] // <-- TUNE ME + }); + console.log(`✅ Added labels to PR #${pr_number}`); + } catch (error) { + console.log(`⚠️ Failed to add labels: ${error.message}`); + console.log("Note: This may be due to insufficient permissions or invalid label names."); + } + // Add automated comment - await github.rest.issues.createComment({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: pr_number, - body: "Thanks for the PR! Copilot will assist with review." - }); \ No newline at end of file + try { + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: pr_number, + body: "Thanks for the PR! Copilot will assist with review." + }); + console.log(`✅ Added comment to PR #${pr_number}`); + } catch (error) { + console.log(`⚠️ Failed to add comment: ${error.message}`); + console.log("Note: This may be due to insufficient permissions."); + } \ No newline at end of file diff --git a/.github/workflows/auto-label.yml b/.github/workflows/auto-label.yml index 6cfc538..768aae7 100644 --- a/.github/workflows/auto-label.yml +++ b/.github/workflows/auto-label.yml @@ -18,9 +18,16 @@ jobs: script: | // Add or tweak your labels here const labels = ["triage", "copilot"]; // <-- TUNE ME! - await github.rest.issues.addLabels({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: context.issue.number, - labels - }); \ No newline at end of file + + try { + await github.rest.issues.addLabels({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + labels + }); + console.log(`✅ Added labels [${labels.join(", ")}] to issue #${context.issue.number}`); + } catch (error) { + console.log(`⚠️ Failed to add labels: ${error.message}`); + console.log("Note: This may be due to insufficient permissions or invalid label names."); + } \ No newline at end of file diff --git a/README.md b/README.md index 70504e3..a8296b5 100644 --- a/README.md +++ b/README.md @@ -79,10 +79,6 @@ See the [examples directory](examples/) for more usage patterns. For users who prefer to manage their own I/O: -## Sans-I/O Mode (Original) - -For users who prefer to manage their own I/O: - ```python from cdp import page diff --git a/check_issues.sh b/check_issues.sh new file mode 100644 index 0000000..1c393f9 --- /dev/null +++ b/check_issues.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +echo "=== Searching for remaining shell arithmetic operations ===" +grep -r '\$((.*))' .github/workflows/ || echo "No shell arithmetic found" + +echo "" +echo "=== Searching for remaining GitHub Copilot actions ===" +grep -r 'github/copilot' .github/workflows/ || echo "No GitHub Copilot actions found" + +echo "" +echo "=== Searching for remaining shell arithmetic patterns ===" +grep -r '\$(' .github/workflows/ | grep -E '(count|total).*=' || echo "No problematic patterns found" + +echo "" +echo "=== Checking for any uses: statements with copilot ===" +grep -r 'uses:.*copilot' .github/workflows/ || echo "No copilot uses statements found" \ No newline at end of file diff --git a/IMPLEMENTATION.md b/docs/implementation.md similarity index 98% rename from IMPLEMENTATION.md rename to docs/implementation.md index 65ab3d3..6c38874 100644 --- a/IMPLEMENTATION.md +++ b/docs/implementation.md @@ -1,4 +1,4 @@ -# Implementation Summary: I/O and Multiplexing Support +# Implementation Design Document: I/O and Multiplexing Support This document summarizes the implementation of I/O capabilities and JSON-RPC framing with command multiplexing for the Chrome DevTools Protocol library. @@ -181,4 +181,4 @@ This implementation successfully adds I/O capabilities and command multiplexing - ✅ Documentation (README, guide, examples) - ✅ Backward compatibility (100%) -The implementation fulfills the issue requirements: "Add some IO up in this thing. Add support for the JSON RPC framing (if it's still a thing) AND multiplexing commands. Multiplex so much you can't plex any more." ✅ +The implementation fulfills the issue requirements: "Add some IO up in this thing. Add support for the JSON RPC framing (if it's still a thing) AND multiplexing commands. Multiplex so much you can't plex any more." ✅ \ No newline at end of file diff --git a/docs/index.rst b/docs/index.rst index c4ba5e6..e9b97d8 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -11,6 +11,7 @@ Python wrappers for Chrome DevTools Protocol (CDP). overview getting_started + connection api develop changelog