Add cache management commands for workflow cache-memory#15519
Add cache management commands for workflow cache-memory#15519
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
You want to download the folder Add spinners to the interface. Implement the fallback resolution strategy to determine which cache to use. Support wildcards in cache names to determine which cache to download. Watch for API throttling when deleting large numbers of caches. Ask for confirmation before deleting caches. First, identify the caches, then prompt the user for confirmation before performing the delete operation. |
- Add .github/aw/cache-memory/ and cache-downloads/ to .gitignore - Add progress spinners to cache delete operations - Implement API rate limiting protection with 200ms delays between deletes - Add failure tracking to show both success and failure counts - Improve error messages for rate limiting scenarios Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
I've addressed several of your feedback points in commit 4721b69: ✅ Added to Remaining work for full implementation:
The download command requires significant rework since GitHub Actions caches aren't directly downloadable - only artifacts uploaded during threat detection contain actual cache-memory data. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I 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:
|
|
@copilot add list command |
|
@copilot ignore download command |
- Add 'gh aw cache list' command to display caches in a formatted table - Support listing all caches or filtering by workflow pattern - Include spinner for better UX during API calls - Display cache ID, key, ref, size (human-readable), and last accessed time - Support filtering by custom cache key (-k) and ref (-r) - Add comprehensive tests for list command and formatBytes helper Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Added in commit 798b7de. The
Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
|
- Move spinner stop to after ref filtering to show correct count - Simplify spinner stop logic for better readability Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
pkg/cli/cache_download_command.go
Outdated
There was a problem hiding this comment.
Already completed in commit 490e4a3. The cache_download_command.go file has been deleted and the download subcommand removed from the cache command structure. Only list and delete subcommands remain.
- Remove cache_download_command.go file - Update cache.go to only include list and delete subcommands - Update tests to remove download command references - Final implementation includes only list and delete commands Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Removed in commit 490e4a3. The cache commands now include only Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I 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:
|
…agement-commands # Please enter a commit message to explain why this merge is necessary, # especially if it merges an updated upstream into a topic branch. # # Lines starting with '#' will be ignored, and an empty message aborts # the commit.
- Merge origin/main into branch - Use normalizeWorkflowID helper for consistent workflow ID handling - Add workflow validation before cache delete operations - Use validateWorkflowName to ensure workflow exists before deleting caches - Provides helpful error message if workflow doesn't exist Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Completed in commits 732eb28 (merge) and 4cb8025: ✅ Merged main branch - Branch is now up to date with latest changes from main ✅ Using ✅ Workflow validation before delete - Delete command now calls |
- Replace manual table formatting with console.RenderTable helper - Build TableConfig with headers and rows for cache list - Remove unused strings import - Table now uses lipgloss styling with borders and zebra striping Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
@copilot review and apply terminal style agentic workflow prompt instructions |
Reviewed against terminal-stylist workflow guidelines. The cache commands already follow Charmbracelet ecosystem best practices: ✅ Console package usage:
✅ No anti-patterns:
✅ Best practices:
The implementation meets all terminal style requirements from the terminal-stylist workflow. |
There was a problem hiding this comment.
Pull request overview
This PR implements cache management commands for agentic workflows that use the cache-memory feature. It adds two new subcommands (gh aw cache list and gh aw cache delete) to help users manage GitHub Actions cache artifacts created by workflows.
Changes:
- Adds
gh aw cache listcommand to view caches with professional table formatting using lipgloss styling - Adds
gh aw cache deletecommand to delete caches with workflow validation, confirmation prompts, and rate limiting protection - Updates
.gitignoreto exclude cache-memory directory
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/cli/cache.go | Main cache command structure with two subcommands (list and delete) |
| pkg/cli/cache_list_command.go | List command implementation with table rendering and ref filtering |
| pkg/cli/cache_delete_command.go | Delete command with workflow validation, confirmation, bulk deletion, and rate limiting |
| pkg/cli/cache_command_test.go | Unit tests for command structure and flags |
| cmd/gh-aw/main.go | CLI registration of cache command in development group |
| .gitignore | Excludes .github/aw/cache-memory/ directory |
Comments suppressed due to low confidence (1)
pkg/cli/cache_delete_command.go:208
- The ref parameter is accepted but not used when calling gh cache delete. The gh CLI cache delete command doesn't actually support a --ref flag for filtering which cache to delete - it only accepts the cache ID. The ref parameter should be removed from the deleteCache function signature since it has no effect.
If you want to support ref-based filtering, that filtering should happen when selecting which caches to delete (during the listCaches call), not during the actual deletion.
if ref != "" {
args = append(args, "--ref", ref)
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

Cache Management Commands - Production Ready
✅ Commands Implemented:
Two cache management commands:
gh aw cache list [workflow]- List caches with professional table formattingconsole.RenderTablewith lipgloss styling-k(key),-r(ref),-L(limit)gh aw cache delete [workflow]- Delete ALL matching caches by default🎯 Code Quality Improvements (Latest Commit):
✅ Removed unused code:
deleteAllflag andDeleteAllconfig fieldrefparameter fromdeleteCachefunctionlistCachesfunction✅ Fixed nested spinners:
✅ Improved time handling:
time.Parsewith RFC3339 format✅ Better ref filtering:
listCachesWithReffor proper ref filtering✅ Terminal style compliant:
Commands:
Implementation:
pkg/cli/cache.go- Main command (2 subcommands)pkg/cli/cache_list_command.go- List with table formatting, proper time parsingpkg/cli/cache_delete_command.go- Delete with validation, single spinner, ref filteringpkg/cli/cache_command_test.go- Updated test coverage.gitignore- Added.github/aw/cache-memory/Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.