25dd3ab2d2
Phase 10.1: Aggressive Workflow Modularization - 5 plan(s) in 3 wave(s) - Wave 1: Foundation (rename files, analyze boundaries, user approval) - Wave 2: 3 parallel extractions (batch-ui, status, confirmation) - Wave 3: Integration verification and UAT - Ready for execution Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
202 lines
6.9 KiB
Markdown
202 lines
6.9 KiB
Markdown
---
|
|
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"
|
|
---
|
|
|
|
<objective>
|
|
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.
|
|
</objective>
|
|
|
|
<execution_context>
|
|
@/home/luc/.claude/get-shit-done/workflows/execute-plan.md
|
|
@/home/luc/.claude/get-shit-done/templates/summary.md
|
|
</execution_context>
|
|
|
|
<context>
|
|
@.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
|
|
</context>
|
|
|
|
<tasks>
|
|
|
|
<task type="auto">
|
|
<name>Task 1: Create n8n-status.json sub-workflow with extracted list/status nodes</name>
|
|
<files>n8n-status.json (new)</files>
|
|
<action>
|
|
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
|
|
}
|
|
```
|
|
</action>
|
|
<verify>
|
|
- `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
|
|
</verify>
|
|
<done>n8n-status.json created with container list and status nodes extracted.</done>
|
|
</task>
|
|
|
|
<task type="auto">
|
|
<name>Task 2: Update main workflow to call status sub-workflow</name>
|
|
<files>n8n-workflow.json</files>
|
|
<action>
|
|
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.
|
|
</action>
|
|
<verify>
|
|
- Main workflow has "Execute Container Status" node
|
|
- No list/pagination nodes remain in main workflow except routing
|
|
- TODO_DEPLOY_STATUS_WORKFLOW placeholder exists
|
|
</verify>
|
|
<done>Main workflow updated with status nodes extracted and replaced by sub-workflow call.</done>
|
|
</task>
|
|
|
|
<task type="auto">
|
|
<name>Task 3: Create backup and commit extraction</name>
|
|
<files>n8n-workflow.json.backup-status</files>
|
|
<action>
|
|
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"
|
|
```
|
|
</action>
|
|
<verify>
|
|
- Backup file exists
|
|
- Git commit created
|
|
</verify>
|
|
<done>Status extraction committed with backup.</done>
|
|
</task>
|
|
|
|
</tasks>
|
|
|
|
<verification>
|
|
- [ ] 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
|
|
</verification>
|
|
|
|
<success_criteria>
|
|
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
|
|
</success_criteria>
|
|
|
|
<output>
|
|
After completion, create `.planning/phases/10.1-aggressive-workflow-modularization/10.1-03-SUMMARY.md`
|
|
</output>
|