Skip to content

Add cleanup script and replace chmod patterns with bash invocation#14

Merged
swarm-protocol merged 10 commits intomainfrom
copilot/add-bash-script-for-cleanup
Feb 8, 2026
Merged

Add cleanup script and replace chmod patterns with bash invocation#14
swarm-protocol merged 10 commits intomainfrom
copilot/add-bash-script-for-cleanup

Conversation

Copy link
Contributor

Copilot AI commented Feb 8, 2026

  • Create cleanup.sh - fully commented-out bash script for deleting leftover files
  • Add "Protocol: Cleanup Leftover Files" section in AGENTS.md
  • Replace chmod +x / ./script.sh patterns with bash script.sh across all files
  • Add warning about empty EXPECTED_FILES in AGENTS.md (review comment)
  • Document git restore cleanup.sh for re-commenting (review comment)
  • Fix ./cleanup.shbash cleanup.sh in script USAGE header (review comment)
  • Use -path './.git' -prune for empty dir cleanup (review comment)
  • Use git rev-parse for repo-root detection instead of [ ! -d ".git" ] (review comment)
  • Add guard that aborts when EXPECTED_FILES is empty/unset (review comment)
  • Use git ls-files instead of bare find for file discovery (review comment)
  • Use rm -- instead of rm to handle paths starting with - (review comment)
  • Run code review and security checks
Original prompt

include a bash script that is fully commented out that is soul purpouse is the delete the files that are leftover when new codebase is created and dosnt match the original repos file structure. add this as a protocol in AGENTS.md when prompted and only when the llm is prompted

Custom agent used: documentation-builder
Specialized agent for building README.md and AGENTS.md files from template versions


💡 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 February 8, 2026 11:02
Co-authored-by: swarm-protocol <169869917+swarm-protocol@users.noreply.github.com>
Co-authored-by: swarm-protocol <169869917+swarm-protocol@users.noreply.github.com>
Copilot AI changed the title [WIP] Add bash script for deleting leftover files in new codebase Add commented-out cleanup script and AGENTS.md protocol for removing leftover files Feb 8, 2026
Copilot AI requested a review from swarm-protocol February 8, 2026 11:04
Co-authored-by: swarm-protocol <169869917+swarm-protocol@users.noreply.github.com>
Copilot AI changed the title Add commented-out cleanup script and AGENTS.md protocol for removing leftover files Add cleanup script and protocol for removing scaffolding leftovers Feb 8, 2026
@swarm-protocol swarm-protocol marked this pull request as ready for review February 8, 2026 11:09
Copilot AI review requested due to automatic review settings February 8, 2026 11:09
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an on-demand, inert-by-default cleanup mechanism to remove scaffolding leftovers that diverge from the canonical template repo structure, plus a documented protocol for invoking it intentionally.

Changes:

  • Introduces cleanup.sh as a fully commented-out cleanup script intended for manual/LLM-prompted use only.
  • Documents an explicit “Protocol: Cleanup Leftover Files” workflow in AGENTS.md, including steps, checklist, and agent invocation examples.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 8 comments.

File Description
cleanup.sh Adds an inert cleanup script that can diff current files vs an expected list and delete leftovers after confirmation.
AGENTS.md Adds a protocol section describing how/when to run the cleanup script and how to safely execute the workflow.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: swarm-protocol <169869917+swarm-protocol@users.noreply.github.com>
Copilot AI changed the title Add cleanup script and protocol for removing scaffolding leftovers Add cleanup script and replace chmod patterns with bash invocation Feb 8, 2026
swarm-protocol and others added 4 commits February 8, 2026 19:14
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@swarm-protocol
Copy link
Owner

@copilot apply changes based on the comments in this thread

…ty-array guard, git-aware file discovery, safe rm

Co-authored-by: swarm-protocol <169869917+swarm-protocol@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 8, 2026

@copilot apply changes based on the comments in this thread

Applied all 8 review comments in commit a5b99f6. The 4 that were already addressed (AGENTS.md warning, git restore docs, bash cleanup.sh usage, .git prune) were verified in place. The 4 remaining changes applied to cleanup.sh:

  1. Repo-root detection now uses git rev-parse --show-toplevel instead of [ ! -d ".git" ]
  2. Added a guard that aborts with an error if EXPECTED_FILES is empty/unset
  3. File discovery now uses git ls-files + git ls-files --others --exclude-standard instead of bare find
  4. Changed rm "$file" to rm -- "$file" for paths starting with -

@swarm-protocol swarm-protocol merged commit 6c88166 into main Feb 8, 2026
4 checks passed
@swarm-protocol swarm-protocol deleted the copilot/add-bash-script-for-cleanup branch February 8, 2026 11:19
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