From 233e211eb8bca3c065f4a0a6e5a9f87b482852d8 Mon Sep 17 00:00:00 2001 From: bendtherules Date: Mon, 23 Mar 2026 11:32:42 +0530 Subject: [PATCH] feat: add cleanup command to readme Introduce a new `cleanup` command that discovers and deletes archive tags, with options for force, remote handling, and local-only operations. Updated README with usage examples, added help entry, and expanded documentation to describe the command and its steps. Added corresponding implementation files (`cleanup.ts`) in both core and tools directories. --- README.md | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 54 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5e743f3..f6ce43b 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,11 @@ sessionName: my-session, models: ["openai/gpt-5.2", "anthropic/claude-3-5-sonnet call tool multi-model-close with sessionName: my-session ``` +**Cleanup archive tags (using tool):** +``` +call tool multi-model-cleanup +``` + **Close a session (using manual command):** ```bash tmux kill-session -t my-session && rm -rf ~/.local/share/opencode/multi-model/my-session && git worktree prune && git branch -D $(git branch --format='%(refname:short)' --list 'opencode/my-session/*') @@ -88,6 +93,21 @@ opencode-multi-model open my-session -m openai/gpt-5.2 opencode-multi-model close my-session ``` +**Cleanup archive tags (CLI command):** +```bash +# Delete all archive tags from local and remote repositories +opencode-multi-model cleanup + +# Delete all archive tags without confirmation prompts +opencode-multi-model cleanup --force + +# Delete only local archive tags, skip remote deletion +opencode-multi-model cleanup --no-remote + +# Delete archive tags and push deletions to a specific remote +opencode-multi-model cleanup --remote origin +``` + **Close a session (manual command):** ```bash tmux kill-session -t my-session && rm -rf ~/.local/share/opencode/multi-model/my-session && git worktree prune && git branch -D $(git branch --format='%(refname:short)' --list 'opencode/my-session/*') @@ -98,6 +118,7 @@ tmux kill-session -t my-session && rm -rf ~/.local/share/opencode/multi-model/my opencode-multi-model --help opencode-multi-model open --help opencode-multi-model close --help +opencode-multi-model cleanup --help ``` ## Configuration @@ -151,6 +172,21 @@ opencode-multi-model close [options] | `--no-tags` | Do not create archive tags before deleting branches | | `-f, --force` | Skip confirmation prompts | +### `cleanup` - Delete all archive tags from local and remote repositories + +Archive tags have the format: `archive/-`. These are created by the close command to preserve branch state before deletion. + +```bash +opencode-multi-model cleanup [options] +``` + +**Options:** +| Option | Description | +|--------|-------------| +| `-f, --force` | Skip confirmation prompts | +| `-r, --remote ` | Remote name to push deletions to (default: first remote from git remote -v) | +| `--no-remote` | Only delete local tags, skip remote | + ### Global Options | Option | Description | @@ -191,6 +227,20 @@ The `close` command performs the following steps: 4. **Directory cleanup**: Removes the base session directory +### `cleanup` command + +The `cleanup` command performs the following steps: + +1. **Archive tag discovery**: Finds all git tags matching the pattern `archive/*` + +2. **Local tag deletion**: Deletes all archive tags from the local repository + +3. **Remote tag deletion** (unless `--no-remote`): + - Determines which remote to use (user-specified, first available, or skip) + - Pushes tag deletions to the remote repository + +4. **Summary**: Reports the number of tags deleted locally and remotely + ## Requirements - tmux @@ -230,11 +280,13 @@ bun dist/cli.js close test-session │ ├── core/ │ │ ├── index.ts # Core exports │ │ ├── open.ts # Launch session logic -│ │ ├── close.ts # Close session logic +│ │ ├── close.ts # Close session logic +│ │ ├── cleanup.ts # Cleanup archive tags logic │ │ └── utils.ts # Helper functions │ └── tools/ │ ├── open.ts # Open tool definition -│ └── close.ts # Close tool definition +│ ├── close.ts # Close tool definition +│ └── cleanup.ts # Cleanup tool definition ├── tests/ │ └── multi-model.test.ts # Tests ├── package.json