Skip to content

Purge orphaned .campaign.g.md files and their lock files with --purge flag - #9451

Merged
pelikhan merged 3 commits into
mainfrom
copilot/delete-orphaned-files
Jan 9, 2026
Merged

pelikhan merged 3 commits into
mainfrom
copilot/delete-orphaned-files

Conversation

Copilot AI commented Jan 9, 2026 •

Copy link
Copy Markdown
Contributor

The compile --purge flag was not removing orphaned .campaign.g.md files or their corresponding .campaign.lock.yml files when the source .campaign.md file was deleted.

Changes

  • Modified purgeOrphanedCampaignOrchestrators() in pkg/cli/compile_batch_operations.go:

    • Changed from no-op to actively purging orphaned .campaign.g.md files
    • Scans for .campaign.g.md files without corresponding .campaign.md sources
    • Deletes orphaned files with success/failure messages
  • Updated test expectations in pkg/cli/compile_command_test.go:

    • TestCompileWorkflows_PurgeCampaignOrchestrators now expects orphaned .campaign.g.md files to be deleted
    • Maintains verification that valid files with sources remain untouched

Behavior

Campaign file lifecycle:

.campaign.md → .campaign.g.md → .campaign.lock.yml

When source is deleted:

$ rm .github/workflows/test.campaign.md
$ gh aw compile --purge
✓ Removed orphaned campaign orchestrator file: test.campaign.g.md
✓ Removed orphaned campaign orchestrator lock file: test.campaign.lock.yml

Files with valid sources remain intact. The existing purgeOrphanedCampaignOrchestratorLockFiles() already handled .campaign.lock.yml files correctly.

Original prompt

The 'compile --purge' purging mode should delete orphaned .campaign.g.md files, and their related .lock.yml files.


💡 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.

Copilot AI and others added 2 commits January 9, 2026 13:10
When a .campaign.md source file is deleted, the compile --purge flag now:
- Deletes the orphaned .campaign.g.md file (generated orchestrator)
- Deletes the orphaned .campaign.lock.yml file (compiled workflow)

Changes:
- Modified purgeOrphanedCampaignOrchestrators() to actually purge .campaign.g.md files
- Updated test expectations to match new behavior
- Both integration tests pass

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Add purging mode to delete orphaned campaign files Purge orphaned .campaign.g.md files and their lock files with --purge flag Jan 9, 2026
Copilot AI requested a review from pelikhan January 9, 2026 13:16
@pelikhan

pelikhan commented Jan 9, 2026

Copy link
Copy Markdown
Collaborator

@copilot format, lint

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants