Commit a5cdc7e
authored
feat(admin): add dev-only nuke all button to KiloClaw admin page (#1321)
## Summary
Add a "Nuke All" button to the KiloClaw admin instances page that
destroys all active KiloClaw instances, including their Fly machines via
the worker. The button and its backend endpoint are both gated to
development mode only (`process.env.NODE_ENV !== 'development'`).
- Backend: new `devNukeAll` mutation on `adminKiloclawInstancesRouter`
that iterates active instances, marks each destroyed in Postgres, then
calls `client.destroy()` on the worker. Uses the same mark-then-revert
pattern as the existing single-instance `destroy` endpoint — if the
worker call fails, the DB row is restored so state stays consistent.
- Frontend: `DevNukeAllButton` component renders `null` outside
development mode. Shows a destructive button with confirmation dialog.
Reports results including any partial failures.
## Verification
- [x] `pnpm typecheck` — 28 packages pass, 0 failures
- [x] `pnpm format` — no formatting issues
- [x] `git push` — pre-push hooks (format:check, lint, typecheck) all
pass
## Visual Changes
N/A
## Reviewer Notes
- The button is tree-shaken from production builds via the
`process.env.NODE_ENV !== 'development'` early return. The server
endpoint also hard-gates with the same check and returns `FORBIDDEN`.
- The destroy loop is sequential per instance to avoid overwhelming the
worker. Each instance is independently mark/destroy/revert so partial
failures don't affect other instances.2 files changed
Lines changed: 119 additions & 2 deletions
File tree
- src
- app/admin/components/KiloclawInstances
- routers
Lines changed: 74 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
27 | 37 | | |
28 | 38 | | |
29 | 39 | | |
| |||
219 | 229 | | |
220 | 230 | | |
221 | 231 | | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
222 | 292 | | |
223 | 293 | | |
224 | 294 | | |
| |||
378 | 448 | | |
379 | 449 | | |
380 | 450 | | |
| 451 | + | |
| 452 | + | |
381 | 453 | | |
382 | 454 | | |
383 | 455 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
637 | 637 | | |
638 | 638 | | |
639 | 639 | | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
640 | 685 | | |
641 | 686 | | |
642 | 687 | | |
| |||
0 commit comments