gh add: better tracking of added/modified files#34
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
- Add FileTracker struct to track created/modified files during workflow operations - Modify AddWorkflowWithRepoAndPR to use file tracking with rollback on git operation failure - Create AddWorkflowWithTracking function that tracks all file operations (md, lock.yml, .gitattributes) - Update stageWorkflowChanges to stage specific tracked files instead of entire directories - Add compileWorkflowWithTracking to track compilation-generated files - Implement rollback functionality that deletes created files on error - Add comprehensive tests for file tracker functionality - Maintain backward compatibility with existing AddWorkflow function Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
add --pr command
…iles - Move FileTracker struct and methods to pkg/cli/file_tracker.go for better organization - Add OriginalContent map to store file content before modification - Enhance TrackModified() to capture original content automatically - Add RollbackModifiedFiles() method to restore files to original state - Add RollbackAllFiles() method for comprehensive rollback - Update defer function to use RollbackAllFiles() instead of RollbackCreatedFiles() - Fix timing of tracking calls to happen before file modification - Add comprehensive tests for all rollback scenarios Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
add --pr commandadd --pr command
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Applied console formatting helpers for error messages. Converted warning and error messages to use console.FormatWarningMessage(), console.FormatErrorMessage(), console.FormatSuccessMessage(), and console.FormatInfoMessage() throughout the codebase. Error messages now properly go to stderr with styled formatting. Commit c84acf2 Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
add --pr commandadd --pr command
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
add --pr commandadd --pr command
add --pr command* Replace check-team-member shared action with inlined JavaScript script (#22) * Initial plan * Replace check-team-member template with inlined JavaScript script Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> * Fix code formatting (remove trailing whitespace) Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> * Add check_team_member.cjs to tsconfig.json and create comprehensive tests Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> Co-authored-by: Peli de Halleux <pelikhan@users.noreply.github.com> * Refactor compute_text_action.yaml as embedded JavaScript with sanitization (#25) * Simplify add-reaction feature by removing fallback and try/catch logic (#24) * Initial plan * Reimplement add-reaction feature as inlined JavaScript Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> * Remove "remove" functionality from add-reaction feature, simplify to only support adding reactions Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> * Remove fallback and try/catch clauses from add-reaction feature Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> Co-authored-by: Peli de Halleux <pelikhan@users.noreply.github.com> * Remove compute-text action dependency and template files from workflow system (#29) * Fix linter issues: Remove unused reactionActionTemplate variable (#30) * Add output text to test-claude and inline JavaScript instead of shared actions (#32) * Remove obsolete reaction_action.yaml template file (#34) * Remove unnecessary content permissions and checkout steps from task and add_reaction jobs (#35) --------- Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
This commit addresses CodeQL security alert #34 by removing detailed error messages from workflow compilation failures that could potentially expose sensitive information from secret configurations. **Alert Details:** - Alert Number: #34 - Severity: High - Rule: go/clear-text-logging - CWE: CWE-312, CWE-315, CWE-359 **Changes Made:** - Modified pkg/cli/mcp_add.go line 147-149 to log generic error message - Removed direct inclusion of error details in console output - Error details are no longer passed through fmt.Sprintf which could leak sensitive data from the compilation process **Security Impact:** - Prevents potential exposure of secret values or sensitive configuration data in compilation error messages - Maintains user experience by still informing them of compilation failure - Users can still run 'gh aw compile --verbose' for detailed debugging **Testing:** - The fix maintains existing functionality - Generic error message provides sufficient information for users - Sensitive data no longer flows from secrets to logging output 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
…ert #34) This fix addresses CWE-312, CWE-315, and CWE-359 vulnerabilities where sensitive data from secret configurations could flow through error messages to logging output. Changes: - Removed detailed error messages from workflow compilation failures - Changed from logging full error details to generic error messages - Added security-focused comments explaining the fix 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
…tion - Add //go:build integration to run_command_test.go (TestProgressFlagSignature: 30.26s) - Add //go:build integration to compile_command_test.go (TestCompileWorkflows: 10.24s) - Add //go:build integration to mcp_inspect_headers_test.go (TestConnectHTTPMCPServer: 20s) These tests are already isolated in dedicated integration matrix groups but were running in BOTH the unit test job and integration jobs, causing ~60s of duplicate test execution per CI run. Expected impact: - Unit test time: 110s → 50s (45% reduction) - Integration test time: No change (tests already in matrix) - Net savings: ~60 seconds per run (~100 minutes/day) Fixes duplicate test execution identified by CI Coach workflow run #34
This PR implements comprehensive file tracking and explicit rollback functionality for the
gh aw add --prcommand, while enhancing user experience with consistent console formatting and simplifying the API.Problem
The current
add --prcommand had several issues:.github/workflows/directory, missing other generated filesSolution
File Tracking & Explicit Rollback
Enhanced User Experience
API Simplification
AddWorkflowfunctionAddWorkflowWithTrackingdirectlyImplementation
The solution uses a modular
FileTrackerarchitecture (in separate filepkg/cli/file_tracker.go) with explicit rollback pattern:This explicit approach provides better control over when rollback occurs and makes the error handling flow more transparent compared to defer-based cleanup.
Testing
All existing tests pass with the new implementation. The console formatting provides immediate visual feedback making it easier to identify issues during development and usage.
Fixes #33.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.