--- description: Undeploy all apps from the test server except traefik argument-hint: [recipe-name] allowed-tools: [Bash, Read, Grep, Glob] --- # Test Context Reset Undeploy all apps from the active test server except for infrastructure services and (optionally) a specific recipe and its dependencies. This frees memory so you can test one recipe at a time without interference from other deployed apps. The optional recipe name is: $ARGUMENTS Read and follow the instructions in `.claude/commands/includes/logging.md`. ## Steps 1. **Resolve the active test server**: ``` python3 scripts/get_test_instance.py ``` This outputs SERVER and INSTANCE. Use SERVER as `` in the steps below. 2. **Build the protected recipe list.** Start with the always-protected infrastructure recipes: - `traefik` - `backup-bot-two` If a recipe name was provided in `$ARGUMENTS`: - Add that recipe to the protected list. - Read `recipe-info//dependencies.md` (if it exists). Each `##` heading names a recipe that is a test dependency. Add every listed recipe to the protected list. - Read `recipe-info//test.md` and look for a `## Requires` section. Each line under that heading starting with `- ` names a required recipe (e.g. `- keycloak`). Add every required recipe to the protected list. - For each required recipe found, also read its `recipe-info//dependencies.md` and `recipe-info//test.md` and check for further dependencies (transitive). Add those too. Continue until no new dependencies are found. 3. **List all deployed apps** on the test server: ``` abra app ls -s -S -m ``` Parse the JSON output to get the list of app domains and their recipes. 4. **Match deployed apps to protected recipes** — for each deployed app, check if its recipe name matches any entry in the protected list. If it does, mark it as protected and skip it. 5. **Show the user what will be undeployed** — list the app domains that will be undeployed and confirm the protected apps that will be kept (and why — infrastructure, target recipe, or dependency). 6. **Undeploy each non-protected app** — for every app that is not protected, run: ``` abra app undeploy --no-input ``` Run these sequentially (not in parallel) to avoid overwhelming the server. 7. **Verify** — run `abra app ls -s -S -m` again and confirm only the protected apps remain deployed. 8. **Summarise** — report what was undeployed and what's still running.