Files
Lucas Berger a409671dc6 docs(09): create phase plan
Phase 09: Batch Operations
- 4 plans in 4 waves
- 3 autonomous, 1 with checkpoint
- Ready for execution

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 21:01:06 -05:00

8.2 KiB

phase, plan, type, wave, depends_on, files_modified, autonomous, must_haves
phase plan type wave depends_on files_modified autonomous must_haves
09-batch-operations 03 execute 3
09-02
n8n-workflow.json
true
truths artifacts key_links
'Update all' command updates only containers with available updates
'Update all' shows confirmation with count before executing
If no containers have updates, shows 'All up to date' message
Inline keyboard allows selecting multiple containers for batch action
path provides contains
n8n-workflow.json Update all command and inline batch selection Check Available Updates
from to via pattern
'update all' command Docker API image inspection Compare current vs latest image digests update.*all
from to via pattern
Multi-select keyboard Batch execution Toggle selection encoded in callback_data batch:toggle
Add "update all" command targeting only containers with available updates, plus inline keyboard multi-select for batch operations via buttons.

Purpose: Enable convenient bulk updates and UI-based batch selection without typing container names. Output: "Update all" flow with pre-flight check and confirmation; multi-select toggle keyboard for batch actions.

<execution_context> @/home/luc/.claude/get-shit-done/workflows/execute-plan.md @/home/luc/.claude/get-shit-done/templates/summary.md </execution_context>

@.planning/PROJECT.md @.planning/ROADMAP.md @.planning/STATE.md @.planning/phases/09-batch-operations/09-CONTEXT.md @.planning/phases/09-batch-operations/09-RESEARCH.md @.planning/phases/09-batch-operations/09-01-SUMMARY.md @.planning/phases/09-batch-operations/09-02-SUMMARY.md @n8n-workflow.json Task 1: Add "update all" command with update availability check n8n-workflow.json Implement "update all" that only targets containers with updates available.
  1. In command detection (early in workflow), detect "update all" as special case:

    • Add to command matching: if message.toLowerCase() includes "update all" or "updateall"
    • Route to dedicated "Update All" flow (not the batch parsing flow)
  2. Add HTTP node "Get All Containers For Update All":

    • GET from Docker API via proxy: http://docker-socket-proxy:2375/containers/json?all=true
    • Returns all containers
  3. Add Code node "Check Available Updates":

    • For each container, need to check if update is available
    • This requires comparing current image digest to remote latest
    • Pattern from existing update flow: a. Get container's current image ID b. Pull :latest tag (or appropriate tag) c. Compare digests
    • This is expensive for many containers - consider approach:
      • Option A: Full check for each (slow but accurate)
      • Option B: Only check containers using :latest tag (faster, common case)
    • Recommendation: Use Option B as default - most containers use :latest
  4. For containers using :latest tag:

    • Execute: docker pull {image}:latest (via proxy exec or curl)
    • Compare pulled image digest to running container's image digest
    • Mark container as "has update" if different
  5. Add Code node "Build Update All Preview":

    • If no containers have updates: Return "All containers are up to date!"
    • If some have updates: Build list of containers with updates
    • Output: { containersToUpdate: Container[], count: number }
  6. Add IF node "Has Updates Available":

    • TRUE: Continue to confirmation
    • FALSE: Send "All up to date" message and stop
  7. Add Code node "Build Update All Confirmation":

    • Text: "Update {N} containers?\n\n{list container names with versions if available}"
    • Inline keyboard: [Confirm] [Cancel]
    • Callback format: uall:confirm:{timestamp} and uall:cancel
    • Store containers to update in workflow context (or encode in callback if small enough)
  8. Handle callbacks:

    • uall:confirm: Check 30-second timeout, then pass containers to batch execution flow (Plan 02)
    • uall:cancel: Send "Update cancelled" and return to list

Note: The actual batch execution reuses Plan 02's Loop Over Items infrastructure. Test "update all" command:

  • With containers that have updates: Shows confirmation "Update 3 containers? plex, sonarr, radarr"
  • With no updates available: Shows "All containers are up to date!"
  • Confirm executes batch update for listed containers
  • Cancel returns to normal state "Update all" checks for available updates, shows confirmation with count and list, executes batch for only updatable containers
Task 2: Add inline keyboard multi-select for batch operations n8n-workflow.json Implement toggle-style multi-select via inline keyboard buttons.
  1. Add entry point to batch selection mode:

    • In container list keyboard (from Phase 8), add button row: "Select Multiple"
    • Callback: batch:mode
  2. Handle batch:mode callback - Add Code node "Build Batch Select Keyboard":

    • Show container list with toggle checkmarks
    • Each container button: text shows name with/without checkmark
    • Callback format: batch:toggle:{selected_csv}:{container_name}
      • selected_csv: comma-separated currently selected containers
      • container_name: container being toggled
    • Example: batch:toggle:plex,sonarr:radarr means "plex and sonarr selected, toggling radarr"
  3. Handle batch:toggle:* callbacks:

    • Parse callback data to get current selection and container being toggled
    • Toggle the container in/out of selection
    • Rebuild keyboard with updated checkmarks
    • Edit message to show new keyboard
  4. Add action buttons when selection exists:

    • At bottom of keyboard, show: "[Update Selected] [Start Selected] [Stop Selected]"
    • Only show relevant actions based on container states (or show all and handle gracefully)
    • Callback format: batch:exec:{action}:{selected_csv}
  5. Handle batch:exec:* callbacks:

    • Parse action and selected containers
    • For stop: Show confirmation (per existing batch stop rule)
    • For start/restart: Execute immediately via batch loop
    • For update: Execute immediately via batch loop
    • Pass selected containers to batch execution infrastructure (Plan 02)
  6. 64-byte callback_data limit handling (per RESEARCH):

    • Average container name: 6-10 chars
    • With format batch:toggle:{csv}:{name}, limit ~8-10 containers
    • If limit approached, show warning: "Maximum selection reached. Use 'update all' for more."
    • Add Code node "Check Selection Size" before toggle to enforce limit
  7. Add "Clear Selection" and "Cancel" buttons:

    • "Clear": batch:clear - reset selection, rebuild keyboard
    • "Cancel": batch:cancel - return to normal container list

Note: This is Claude's discretion area from CONTEXT. Toggle checkmark pattern chosen for consistency with Phase 8 keyboard patterns. Test batch selection flow:

  • Click "Select Multiple" -> Container list with toggle buttons appears
  • Click container -> Checkmark appears/disappears
  • With 2+ selected -> Action buttons appear at bottom
  • Click "Update Selected" -> Batch update executes for selected containers
  • Clear selection resets all checkmarks
  • Cancel returns to normal container list Inline keyboard multi-select works with toggle checkmarks; action buttons execute batch for selected containers; callback_data size limit enforced
1. Workflow imports successfully in n8n 2. "update all" shows only containers with available updates 3. "update all" with no updates shows "All up to date" 4. Multi-select keyboard allows toggling containers 5. Selected containers can be batch updated/started/stopped 6. Callback data stays within 64-byte limit

<success_criteria>

  • "Update all" scans and shows "Update 3 containers?" only for those needing updates
  • When all up to date, shows "All containers are up to date!"
  • Inline multi-select: checkmarks toggle on click
  • "Update Selected" with 3 containers executes batch update
  • Selection limit prevents callback_data overflow </success_criteria>
After completion, create `.planning/phases/09-batch-operations/09-03-SUMMARY.md`