--- phase: 10.1-aggressive-workflow-modularization plan: 03 type: execute wave: 2 depends_on: ["10.1-01"] files_modified: - n8n-workflow.json - n8n-status.json autonomous: true must_haves: truths: - "User can type 'list' to see container list with pagination" - "User can tap container in list to see status/actions" - "Pagination buttons (prev/next) work correctly" - "Container status shows correct running state" artifacts: - path: "n8n-status.json" provides: "Container status and list sub-workflow" contains: "Execute Workflow Trigger" - path: "n8n-workflow.json" provides: "Main workflow with status extraction" key_links: - from: "n8n-workflow.json" to: "n8n-status.json" via: "Execute Workflow node" pattern: "executeWorkflow.*status" --- Extract container status and list nodes from main workflow into dedicated n8n-status.json sub-workflow. Purpose: Remove ~10-15 nodes from main workflow by extracting the container list and status display domain. Output: New n8n-status.json sub-workflow, updated main workflow with list/status nodes extracted. @/home/luc/.claude/get-shit-done/workflows/execute-plan.md @/home/luc/.claude/get-shit-done/templates/summary.md @.planning/PROJECT.md @.planning/ROADMAP.md @.planning/STATE.md @.planning/phases/10.1-aggressive-workflow-modularization/10.1-CONTEXT.md @.planning/phases/10.1-aggressive-workflow-modularization/10.1-01-SUMMARY.md @n8n-workflow.json Task 1: Create n8n-status.json sub-workflow with extracted list/status nodes n8n-status.json (new) Create new sub-workflow containing container list and status display nodes. **Input contract (Execute Workflow Trigger):** - chatId: number (required) - messageId: number (optional, 0 for new message) - action: string ('list' | 'status' | 'paginate') - containerId: string (optional, for status action) - containerName: string (optional, for status action) - page: number (optional, for pagination, default 1) - responseMode: string ('text' or 'callback') **Nodes to extract** (list/pagination related): - Docker List Containers, Docker List for Action, Docker List for Update - Get Containers For List, Prepare List Fetch - Build Container List Keyboard, Build Paginated List - Edit Container List, Send Container List - Answer List Callback Also consider extracting status display nodes: - Get Single Container, Check Single Container - Build Container Submenu, Build Container Submenu Direct - Send Container Submenu, Send Container Submenu Direct - Prepare Container Fetch **Structure:** 1. Execute Workflow Trigger (entry point) 2. Parse Input (validate action type) 3. Switch on action type (list vs status vs paginate) 4. For list: Query Docker, build paginated list keyboard 5. For status: Get container details, build submenu 6. Return structured result **Output contract:** ```javascript { success: true/false, action: 'list|status|paginate', // For list: keyboard: {...}, text: "message text", totalContainers: number, currentPage: number, totalPages: number, // For status: container: { id, name, state, image, ports }, keyboard: {...}, text: "container status text", // Error: error: "error message" || null } ``` - `cat n8n-status.json | python3 -c "import json,sys; d=json.load(sys.stdin); print(f'Nodes: {len(d.get(\"nodes\",[]))}')"` shows node count (~10-15) - Sub-workflow has Execute Workflow Trigger node - Sub-workflow has Docker HTTP requests for container queries n8n-status.json created with container list and status nodes extracted. Task 2: Update main workflow to call status sub-workflow n8n-workflow.json Modify main workflow to replace list/status nodes with Execute Workflow call. 1. **Remove extracted list/status nodes** from main workflow 2. **Add Execute Workflow node** ("Execute Container Status"): - Source: database - WorkflowId: use TODO_DEPLOY_STATUS_WORKFLOW placeholder - Mode: once - waitForSubWorkflow: true - Input: { chatId, messageId, action, containerId, containerName, page, responseMode } 3. **Update routing** in main workflow: - Keyword Router should route "list" command to Execute Container Status with action='list' - Route Callback should route list pagination callbacks (list:page:N) to Execute Container Status with action='paginate' - Container selection callbacks should route to Execute Container Status with action='status' 4. **Add result handler** after Execute Container Status: - If result has keyboard: send/edit Telegram message with keyboard - If result has error: send error message **Note:** This extraction may be smaller than batch UI. If analysis from 10.1-01 shows fewer than 8 nodes in this domain, consider whether extraction is worthwhile per the "don't extract 2-3 node groups" decision. If close to threshold, proceed with extraction for consistency. - Main workflow has "Execute Container Status" node - No list/pagination nodes remain in main workflow except routing - TODO_DEPLOY_STATUS_WORKFLOW placeholder exists Main workflow updated with status nodes extracted and replaced by sub-workflow call. Task 3: Create backup and commit extraction n8n-workflow.json.backup-status 1. Create explicit backup: `cp n8n-workflow.json n8n-workflow.json.backup-status` 2. Verify the extraction: - Main workflow node count reduced by ~10-15 from previous state - n8n-status.json exists with extracted nodes - No orphan references 3. Commit the extraction: ```bash git add n8n-workflow.json n8n-status.json n8n-workflow.json.backup-status git commit -m "feat(10.1-03): extract container status to sub-workflow - Created n8n-status.json with list and status display nodes - Handles container list, pagination, and single container status - Added TODO_DEPLOY_STATUS_WORKFLOW placeholder" ``` - Backup file exists - Git commit created Status extraction committed with backup. - [ ] n8n-status.json exists with Execute Workflow Trigger - [ ] Main workflow node count further reduced - [ ] Main workflow has Execute Container Status node - [ ] Backup file created - [ ] Git commit records the extraction 1. New n8n-status.json sub-workflow created 2. Main workflow reduced by ~10-15 additional nodes 3. List and status display functionality extracted cleanly 4. Backup created for rollback 5. Changes committed to git After completion, create `.planning/phases/10.1-aggressive-workflow-modularization/10.1-03-SUMMARY.md`