claude-flow-novice 2.14.14 → 2.14.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/commands/cfn-loop-cli.md +45 -122
- package/claude-assets/commands/cfn-loop-cli.md +45 -122
- package/claude-assets/skills/cfn-multi-coordinator-planning/map-dependencies-conflicts.sh +375 -375
- package/claude-assets/skills/cfn-multi-coordinator-planning/plan-coordinator-resources.sh +257 -257
- package/claude-assets/skills/cfn-multi-coordinator-planning/plan-multi-coordinator-work.sh +266 -266
- package/claude-assets/skills/cfn-multi-coordinator-planning/plan-risk-rollout.sh +349 -349
- package/claude-assets/skills/cfn-multi-coordinator-planning/test-multi-coordinator-planning.sh +337 -337
- package/claude-assets/skills/cfn-multi-coordinator-planning/validate-task-planning.sh +188 -188
- package/package.json +1 -1
|
@@ -1,267 +1,267 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
set -euo pipefail
|
|
4
|
-
|
|
5
|
-
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
6
|
-
|
|
7
|
-
# Colors
|
|
8
|
-
RED='\033[0;31m'
|
|
9
|
-
GREEN='\033[0;32m'
|
|
10
|
-
YELLOW='\033[1;33m'
|
|
11
|
-
BLUE='\033[0;34m'
|
|
12
|
-
NC='\033[0m'
|
|
13
|
-
|
|
14
|
-
log() {
|
|
15
|
-
echo -e "${GREEN}[$(date '+%Y-%m-%d %H:%M:%S')] $1${NC}"
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
warn() {
|
|
19
|
-
echo -e "${YELLOW}[$(date '+%Y-%m-%d %H:%M:%S')] WARNING: $1${NC}"
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
error() {
|
|
23
|
-
echo -e "${RED}[$(date '+%Y-%m-%d %H:%M:%S')] ERROR: $1${NC}"
|
|
24
|
-
exit 1
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
info() {
|
|
28
|
-
echo -e "${BLUE}[$(date '+%Y-%m-%d %H:%M:%S')] INFO: $1${NC}"
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
display_usage() {
|
|
32
|
-
echo "Multi-Coordinator Planning Tool"
|
|
33
|
-
echo
|
|
34
|
-
echo "Usage: $0 <zone-config-file> [options]"
|
|
35
|
-
echo
|
|
36
|
-
echo "Options:"
|
|
37
|
-
echo " --max-zones-per-phase N Maximum zones per rollout phase (default: 2)"
|
|
38
|
-
echo " --skip-validation Skip task validation (not recommended)"
|
|
39
|
-
echo " --dry-run Generate plan without execution"
|
|
40
|
-
echo " --output-dir DIR Output directory for plans (default: /tmp)"
|
|
41
|
-
echo " --help Display this help message"
|
|
42
|
-
echo
|
|
43
|
-
echo "Example:"
|
|
44
|
-
echo " $0 zone-config.json --max-zones-per-phase 3"
|
|
45
|
-
echo
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
validate_prerequisites() {
|
|
49
|
-
# Check for required tools
|
|
50
|
-
local required_tools=("jq" "redis-cli" "bc")
|
|
51
|
-
|
|
52
|
-
for tool in "${required_tools[@]}"; do
|
|
53
|
-
if ! command -v "$tool" >/dev/null 2>&1; then
|
|
54
|
-
error "Required tool not found: $tool"
|
|
55
|
-
fi
|
|
56
|
-
done
|
|
57
|
-
|
|
58
|
-
# Check Redis connectivity
|
|
59
|
-
if ! redis-cli ping >/dev/null 2>&1; then
|
|
60
|
-
error "Redis connection failed - required for namespace planning"
|
|
61
|
-
fi
|
|
62
|
-
|
|
63
|
-
log "✓ Prerequisites validation passed"
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
execute_planning_phase() {
|
|
67
|
-
local phase_name="$1"
|
|
68
|
-
local config_file="$2"
|
|
69
|
-
local output_dir="$3"
|
|
70
|
-
shift 3
|
|
71
|
-
local additional_args=("$@")
|
|
72
|
-
|
|
73
|
-
log "Executing planning phase: $phase_name"
|
|
74
|
-
|
|
75
|
-
case "$phase_name" in
|
|
76
|
-
"validation")
|
|
77
|
-
if [[ "${additional_args[*]}" != *"--skip-validation"* ]]; then
|
|
78
|
-
"$SCRIPT_DIR/validate-task-planning.sh" "$config_file"
|
|
79
|
-
fi
|
|
80
|
-
;;
|
|
81
|
-
"resources")
|
|
82
|
-
"$SCRIPT_DIR/plan-coordinator-resources.sh" "$config_file"
|
|
83
|
-
;;
|
|
84
|
-
"dependencies")
|
|
85
|
-
"$SCRIPT_DIR/map-dependencies-conflicts.sh" "$config_file"
|
|
86
|
-
;;
|
|
87
|
-
"rollout")
|
|
88
|
-
"$SCRIPT_DIR/plan-risk-rollout.sh" "$config_file" "${additional_args[@]}"
|
|
89
|
-
;;
|
|
90
|
-
*)
|
|
91
|
-
error "Unknown planning phase: $phase_name"
|
|
92
|
-
;;
|
|
93
|
-
esac
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
generate_execution_summary() {
|
|
97
|
-
local validation_file="$1"
|
|
98
|
-
local resource_file="$2"
|
|
99
|
-
local dependency_file="$3"
|
|
100
|
-
local rollout_file="$4"
|
|
101
|
-
local summary_file="$5"
|
|
102
|
-
|
|
103
|
-
local summary="{
|
|
104
|
-
\"timestamp\": $(date '+%s'),
|
|
105
|
-
\"planning_status\": \"completed\",
|
|
106
|
-
\"phases_executed\": [
|
|
107
|
-
\"task_validation\",
|
|
108
|
-
\"resource_allocation\",
|
|
109
|
-
\"dependency_analysis\",
|
|
110
|
-
\"rollout_planning\"
|
|
111
|
-
],
|
|
112
|
-
\"output_files\": {
|
|
113
|
-
\"validation\": \"$validation_file\",
|
|
114
|
-
\"resources\": \"$resource_file\",
|
|
115
|
-
\"dependencies\": \"$dependency_file\",
|
|
116
|
-
\"rollout\": \"$rollout_file\"
|
|
117
|
-
},
|
|
118
|
-
\"ready_for_execution\": true,
|
|
119
|
-
\"next_steps\": [
|
|
120
|
-
\"Review generated plans\",
|
|
121
|
-
\"Execute rollout in phases\",
|
|
122
|
-
\"Monitor coordinator health\",
|
|
123
|
-
\"Apply rollback triggers if needed\"
|
|
124
|
-
]
|
|
125
|
-
}"
|
|
126
|
-
|
|
127
|
-
echo "$summary" > "$summary_file"
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
display_final_summary() {
|
|
131
|
-
local summary_file="$1"
|
|
132
|
-
local summary_data
|
|
133
|
-
summary_data=$(jq . "$summary_file")
|
|
134
|
-
|
|
135
|
-
echo
|
|
136
|
-
info "=== Multi-Coordinator Planning Summary ==="
|
|
137
|
-
echo "Planning completed at: $(date -d @$(echo "$summary_data" | jq -r '.timestamp') '+%Y-%m-%d %H:%M:%S')"
|
|
138
|
-
echo "Status: $(echo "$summary_data" | jq -r '.planning_status')"
|
|
139
|
-
echo "Ready for execution: $(echo "$summary_data" | jq -r '.ready_for_execution')"
|
|
140
|
-
echo
|
|
141
|
-
|
|
142
|
-
echo "Generated Plans:"
|
|
143
|
-
echo "$summary_data" | jq -r '.output_files | to_entries[] | " - \(.key): \(.value)"'
|
|
144
|
-
echo
|
|
145
|
-
|
|
146
|
-
echo "Next Steps:"
|
|
147
|
-
echo "$summary_data" | jq -r '.next_steps[] | " - \(.)"'
|
|
148
|
-
echo
|
|
149
|
-
|
|
150
|
-
echo "Execution Command:"
|
|
151
|
-
local rollout_file
|
|
152
|
-
rollout_file=$(echo "$summary_data" | jq -r '.output_files.rollout')
|
|
153
|
-
echo " ./execute-coordinator-rollout.sh $rollout_file"
|
|
154
|
-
echo
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
main() {
|
|
158
|
-
# Parse command line arguments
|
|
159
|
-
local config_file=""
|
|
160
|
-
local max_zones_per_phase=2
|
|
161
|
-
local skip_validation=false
|
|
162
|
-
local dry_run=false
|
|
163
|
-
local output_dir="/tmp"
|
|
164
|
-
|
|
165
|
-
while [[ $# -gt 0 ]]; do
|
|
166
|
-
case $1 in
|
|
167
|
-
--max-zones-per-phase)
|
|
168
|
-
max_zones_per_phase="$2"
|
|
169
|
-
shift 2
|
|
170
|
-
;;
|
|
171
|
-
--skip-validation)
|
|
172
|
-
skip_validation=true
|
|
173
|
-
shift
|
|
174
|
-
;;
|
|
175
|
-
--dry-run)
|
|
176
|
-
dry_run=true
|
|
177
|
-
shift
|
|
178
|
-
;;
|
|
179
|
-
--output-dir)
|
|
180
|
-
output_dir="$2"
|
|
181
|
-
shift 2
|
|
182
|
-
;;
|
|
183
|
-
--help)
|
|
184
|
-
display_usage
|
|
185
|
-
exit 0
|
|
186
|
-
;;
|
|
187
|
-
-*)
|
|
188
|
-
error "Unknown option: $1"
|
|
189
|
-
;;
|
|
190
|
-
*)
|
|
191
|
-
if [[ -z "$config_file" ]]; then
|
|
192
|
-
config_file="$1"
|
|
193
|
-
else
|
|
194
|
-
error "Multiple configuration files specified"
|
|
195
|
-
fi
|
|
196
|
-
shift
|
|
197
|
-
;;
|
|
198
|
-
esac
|
|
199
|
-
done
|
|
200
|
-
|
|
201
|
-
# Validate arguments
|
|
202
|
-
if [[ -z "$config_file" ]]; then
|
|
203
|
-
error "Configuration file required"
|
|
204
|
-
fi
|
|
205
|
-
|
|
206
|
-
if [[ ! -f "$config_file" ]]; then
|
|
207
|
-
error "Configuration file not found: $config_file"
|
|
208
|
-
fi
|
|
209
|
-
|
|
210
|
-
# Create output directory
|
|
211
|
-
mkdir -p "$output_dir"
|
|
212
|
-
|
|
213
|
-
log "Starting multi-coordinator planning for: $config_file"
|
|
214
|
-
|
|
215
|
-
# Validate prerequisites
|
|
216
|
-
validate_prerequisites
|
|
217
|
-
|
|
218
|
-
# Prepare additional arguments
|
|
219
|
-
local additional_args=()
|
|
220
|
-
if [[ "$skip_validation" == true ]]; then
|
|
221
|
-
additional_args+=("--skip-validation")
|
|
222
|
-
fi
|
|
223
|
-
|
|
224
|
-
# Execute planning phases
|
|
225
|
-
local timestamp
|
|
226
|
-
timestamp=$(date '+%s')
|
|
227
|
-
|
|
228
|
-
local validation_output="/tmp/validated-task-$(basename "$config_file")"
|
|
229
|
-
local resource_output="/tmp/coordinator-resource-plan-$timestamp.json"
|
|
230
|
-
local dependency_output="/tmp/dependency-conflict-analysis-$timestamp.json"
|
|
231
|
-
local rollout_output="/tmp/rollout-plan-$timestamp.json"
|
|
232
|
-
|
|
233
|
-
# Phase 1: Task Validation
|
|
234
|
-
execute_planning_phase "validation" "$config_file" "$output_dir" "${additional_args[@]}"
|
|
235
|
-
|
|
236
|
-
# Phase 2: Resource Allocation
|
|
237
|
-
execute_planning_phase "resources" "$config_file" "$output_dir"
|
|
238
|
-
|
|
239
|
-
# Phase 3: Dependency Analysis
|
|
240
|
-
execute_planning_phase "dependencies" "$config_file" "$output_dir"
|
|
241
|
-
|
|
242
|
-
# Phase 4: Rollout Planning
|
|
243
|
-
execute_planning_phase "rollout" "$config_file" "$output_dir" "--max-zones-per-phase" "$max_zones_per_phase"
|
|
244
|
-
|
|
245
|
-
# Move files to output directory if specified
|
|
246
|
-
if [[ "$output_dir" != "/tmp" ]]; then
|
|
247
|
-
mv "$resource_output" "$output_dir/"
|
|
248
|
-
mv "$dependency_output" "$output_dir/"
|
|
249
|
-
mv "$rollout_output" "$output_dir/"
|
|
250
|
-
resource_output="$output_dir/$(basename "$resource_output")"
|
|
251
|
-
dependency_output="$output_dir/$(basename "$dependency_output")"
|
|
252
|
-
rollout_output="$output_dir/$(basename "$rollout_output")"
|
|
253
|
-
fi
|
|
254
|
-
|
|
255
|
-
# Generate execution summary
|
|
256
|
-
local summary_file="$output_dir/multi-coordinator-planning-summary-$timestamp.json"
|
|
257
|
-
generate_execution_summary "$validation_output" "$resource_output" "$dependency_output" "$rollout_output" "$summary_file"
|
|
258
|
-
|
|
259
|
-
log "✅ Multi-coordinator planning completed successfully"
|
|
260
|
-
|
|
261
|
-
if [[ "$dry_run" == false ]]; then
|
|
262
|
-
display_final_summary "$summary_file"
|
|
263
|
-
fi
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
# Execute main function with all arguments
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
set -euo pipefail
|
|
4
|
+
|
|
5
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
6
|
+
|
|
7
|
+
# Colors
|
|
8
|
+
RED='\033[0;31m'
|
|
9
|
+
GREEN='\033[0;32m'
|
|
10
|
+
YELLOW='\033[1;33m'
|
|
11
|
+
BLUE='\033[0;34m'
|
|
12
|
+
NC='\033[0m'
|
|
13
|
+
|
|
14
|
+
log() {
|
|
15
|
+
echo -e "${GREEN}[$(date '+%Y-%m-%d %H:%M:%S')] $1${NC}"
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
warn() {
|
|
19
|
+
echo -e "${YELLOW}[$(date '+%Y-%m-%d %H:%M:%S')] WARNING: $1${NC}"
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
error() {
|
|
23
|
+
echo -e "${RED}[$(date '+%Y-%m-%d %H:%M:%S')] ERROR: $1${NC}"
|
|
24
|
+
exit 1
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
info() {
|
|
28
|
+
echo -e "${BLUE}[$(date '+%Y-%m-%d %H:%M:%S')] INFO: $1${NC}"
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
display_usage() {
|
|
32
|
+
echo "Multi-Coordinator Planning Tool"
|
|
33
|
+
echo
|
|
34
|
+
echo "Usage: $0 <zone-config-file> [options]"
|
|
35
|
+
echo
|
|
36
|
+
echo "Options:"
|
|
37
|
+
echo " --max-zones-per-phase N Maximum zones per rollout phase (default: 2)"
|
|
38
|
+
echo " --skip-validation Skip task validation (not recommended)"
|
|
39
|
+
echo " --dry-run Generate plan without execution"
|
|
40
|
+
echo " --output-dir DIR Output directory for plans (default: /tmp)"
|
|
41
|
+
echo " --help Display this help message"
|
|
42
|
+
echo
|
|
43
|
+
echo "Example:"
|
|
44
|
+
echo " $0 zone-config.json --max-zones-per-phase 3"
|
|
45
|
+
echo
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
validate_prerequisites() {
|
|
49
|
+
# Check for required tools
|
|
50
|
+
local required_tools=("jq" "redis-cli" "bc")
|
|
51
|
+
|
|
52
|
+
for tool in "${required_tools[@]}"; do
|
|
53
|
+
if ! command -v "$tool" >/dev/null 2>&1; then
|
|
54
|
+
error "Required tool not found: $tool"
|
|
55
|
+
fi
|
|
56
|
+
done
|
|
57
|
+
|
|
58
|
+
# Check Redis connectivity
|
|
59
|
+
if ! redis-cli ping >/dev/null 2>&1; then
|
|
60
|
+
error "Redis connection failed - required for namespace planning"
|
|
61
|
+
fi
|
|
62
|
+
|
|
63
|
+
log "✓ Prerequisites validation passed"
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
execute_planning_phase() {
|
|
67
|
+
local phase_name="$1"
|
|
68
|
+
local config_file="$2"
|
|
69
|
+
local output_dir="$3"
|
|
70
|
+
shift 3
|
|
71
|
+
local additional_args=("$@")
|
|
72
|
+
|
|
73
|
+
log "Executing planning phase: $phase_name"
|
|
74
|
+
|
|
75
|
+
case "$phase_name" in
|
|
76
|
+
"validation")
|
|
77
|
+
if [[ "${additional_args[*]}" != *"--skip-validation"* ]]; then
|
|
78
|
+
"$SCRIPT_DIR/validate-task-planning.sh" "$config_file"
|
|
79
|
+
fi
|
|
80
|
+
;;
|
|
81
|
+
"resources")
|
|
82
|
+
"$SCRIPT_DIR/plan-coordinator-resources.sh" "$config_file"
|
|
83
|
+
;;
|
|
84
|
+
"dependencies")
|
|
85
|
+
"$SCRIPT_DIR/map-dependencies-conflicts.sh" "$config_file"
|
|
86
|
+
;;
|
|
87
|
+
"rollout")
|
|
88
|
+
"$SCRIPT_DIR/plan-risk-rollout.sh" "$config_file" "${additional_args[@]}"
|
|
89
|
+
;;
|
|
90
|
+
*)
|
|
91
|
+
error "Unknown planning phase: $phase_name"
|
|
92
|
+
;;
|
|
93
|
+
esac
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
generate_execution_summary() {
|
|
97
|
+
local validation_file="$1"
|
|
98
|
+
local resource_file="$2"
|
|
99
|
+
local dependency_file="$3"
|
|
100
|
+
local rollout_file="$4"
|
|
101
|
+
local summary_file="$5"
|
|
102
|
+
|
|
103
|
+
local summary="{
|
|
104
|
+
\"timestamp\": $(date '+%s'),
|
|
105
|
+
\"planning_status\": \"completed\",
|
|
106
|
+
\"phases_executed\": [
|
|
107
|
+
\"task_validation\",
|
|
108
|
+
\"resource_allocation\",
|
|
109
|
+
\"dependency_analysis\",
|
|
110
|
+
\"rollout_planning\"
|
|
111
|
+
],
|
|
112
|
+
\"output_files\": {
|
|
113
|
+
\"validation\": \"$validation_file\",
|
|
114
|
+
\"resources\": \"$resource_file\",
|
|
115
|
+
\"dependencies\": \"$dependency_file\",
|
|
116
|
+
\"rollout\": \"$rollout_file\"
|
|
117
|
+
},
|
|
118
|
+
\"ready_for_execution\": true,
|
|
119
|
+
\"next_steps\": [
|
|
120
|
+
\"Review generated plans\",
|
|
121
|
+
\"Execute rollout in phases\",
|
|
122
|
+
\"Monitor coordinator health\",
|
|
123
|
+
\"Apply rollback triggers if needed\"
|
|
124
|
+
]
|
|
125
|
+
}"
|
|
126
|
+
|
|
127
|
+
echo "$summary" > "$summary_file"
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
display_final_summary() {
|
|
131
|
+
local summary_file="$1"
|
|
132
|
+
local summary_data
|
|
133
|
+
summary_data=$(jq . "$summary_file")
|
|
134
|
+
|
|
135
|
+
echo
|
|
136
|
+
info "=== Multi-Coordinator Planning Summary ==="
|
|
137
|
+
echo "Planning completed at: $(date -d @$(echo "$summary_data" | jq -r '.timestamp') '+%Y-%m-%d %H:%M:%S')"
|
|
138
|
+
echo "Status: $(echo "$summary_data" | jq -r '.planning_status')"
|
|
139
|
+
echo "Ready for execution: $(echo "$summary_data" | jq -r '.ready_for_execution')"
|
|
140
|
+
echo
|
|
141
|
+
|
|
142
|
+
echo "Generated Plans:"
|
|
143
|
+
echo "$summary_data" | jq -r '.output_files | to_entries[] | " - \(.key): \(.value)"'
|
|
144
|
+
echo
|
|
145
|
+
|
|
146
|
+
echo "Next Steps:"
|
|
147
|
+
echo "$summary_data" | jq -r '.next_steps[] | " - \(.)"'
|
|
148
|
+
echo
|
|
149
|
+
|
|
150
|
+
echo "Execution Command:"
|
|
151
|
+
local rollout_file
|
|
152
|
+
rollout_file=$(echo "$summary_data" | jq -r '.output_files.rollout')
|
|
153
|
+
echo " ./execute-coordinator-rollout.sh $rollout_file"
|
|
154
|
+
echo
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
main() {
|
|
158
|
+
# Parse command line arguments
|
|
159
|
+
local config_file=""
|
|
160
|
+
local max_zones_per_phase=2
|
|
161
|
+
local skip_validation=false
|
|
162
|
+
local dry_run=false
|
|
163
|
+
local output_dir="/tmp"
|
|
164
|
+
|
|
165
|
+
while [[ $# -gt 0 ]]; do
|
|
166
|
+
case $1 in
|
|
167
|
+
--max-zones-per-phase)
|
|
168
|
+
max_zones_per_phase="$2"
|
|
169
|
+
shift 2
|
|
170
|
+
;;
|
|
171
|
+
--skip-validation)
|
|
172
|
+
skip_validation=true
|
|
173
|
+
shift
|
|
174
|
+
;;
|
|
175
|
+
--dry-run)
|
|
176
|
+
dry_run=true
|
|
177
|
+
shift
|
|
178
|
+
;;
|
|
179
|
+
--output-dir)
|
|
180
|
+
output_dir="$2"
|
|
181
|
+
shift 2
|
|
182
|
+
;;
|
|
183
|
+
--help)
|
|
184
|
+
display_usage
|
|
185
|
+
exit 0
|
|
186
|
+
;;
|
|
187
|
+
-*)
|
|
188
|
+
error "Unknown option: $1"
|
|
189
|
+
;;
|
|
190
|
+
*)
|
|
191
|
+
if [[ -z "$config_file" ]]; then
|
|
192
|
+
config_file="$1"
|
|
193
|
+
else
|
|
194
|
+
error "Multiple configuration files specified"
|
|
195
|
+
fi
|
|
196
|
+
shift
|
|
197
|
+
;;
|
|
198
|
+
esac
|
|
199
|
+
done
|
|
200
|
+
|
|
201
|
+
# Validate arguments
|
|
202
|
+
if [[ -z "$config_file" ]]; then
|
|
203
|
+
error "Configuration file required"
|
|
204
|
+
fi
|
|
205
|
+
|
|
206
|
+
if [[ ! -f "$config_file" ]]; then
|
|
207
|
+
error "Configuration file not found: $config_file"
|
|
208
|
+
fi
|
|
209
|
+
|
|
210
|
+
# Create output directory
|
|
211
|
+
mkdir -p "$output_dir"
|
|
212
|
+
|
|
213
|
+
log "Starting multi-coordinator planning for: $config_file"
|
|
214
|
+
|
|
215
|
+
# Validate prerequisites
|
|
216
|
+
validate_prerequisites
|
|
217
|
+
|
|
218
|
+
# Prepare additional arguments
|
|
219
|
+
local additional_args=()
|
|
220
|
+
if [[ "$skip_validation" == true ]]; then
|
|
221
|
+
additional_args+=("--skip-validation")
|
|
222
|
+
fi
|
|
223
|
+
|
|
224
|
+
# Execute planning phases
|
|
225
|
+
local timestamp
|
|
226
|
+
timestamp=$(date '+%s')
|
|
227
|
+
|
|
228
|
+
local validation_output="/tmp/validated-task-$(basename "$config_file")"
|
|
229
|
+
local resource_output="/tmp/coordinator-resource-plan-$timestamp.json"
|
|
230
|
+
local dependency_output="/tmp/dependency-conflict-analysis-$timestamp.json"
|
|
231
|
+
local rollout_output="/tmp/rollout-plan-$timestamp.json"
|
|
232
|
+
|
|
233
|
+
# Phase 1: Task Validation
|
|
234
|
+
execute_planning_phase "validation" "$config_file" "$output_dir" "${additional_args[@]}"
|
|
235
|
+
|
|
236
|
+
# Phase 2: Resource Allocation
|
|
237
|
+
execute_planning_phase "resources" "$config_file" "$output_dir"
|
|
238
|
+
|
|
239
|
+
# Phase 3: Dependency Analysis
|
|
240
|
+
execute_planning_phase "dependencies" "$config_file" "$output_dir"
|
|
241
|
+
|
|
242
|
+
# Phase 4: Rollout Planning
|
|
243
|
+
execute_planning_phase "rollout" "$config_file" "$output_dir" "--max-zones-per-phase" "$max_zones_per_phase"
|
|
244
|
+
|
|
245
|
+
# Move files to output directory if specified
|
|
246
|
+
if [[ "$output_dir" != "/tmp" ]]; then
|
|
247
|
+
mv "$resource_output" "$output_dir/"
|
|
248
|
+
mv "$dependency_output" "$output_dir/"
|
|
249
|
+
mv "$rollout_output" "$output_dir/"
|
|
250
|
+
resource_output="$output_dir/$(basename "$resource_output")"
|
|
251
|
+
dependency_output="$output_dir/$(basename "$dependency_output")"
|
|
252
|
+
rollout_output="$output_dir/$(basename "$rollout_output")"
|
|
253
|
+
fi
|
|
254
|
+
|
|
255
|
+
# Generate execution summary
|
|
256
|
+
local summary_file="$output_dir/multi-coordinator-planning-summary-$timestamp.json"
|
|
257
|
+
generate_execution_summary "$validation_output" "$resource_output" "$dependency_output" "$rollout_output" "$summary_file"
|
|
258
|
+
|
|
259
|
+
log "✅ Multi-coordinator planning completed successfully"
|
|
260
|
+
|
|
261
|
+
if [[ "$dry_run" == false ]]; then
|
|
262
|
+
display_final_summary "$summary_file"
|
|
263
|
+
fi
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
# Execute main function with all arguments
|
|
267
267
|
main "$@"
|