@pjmendonca/devflow 1.9.0
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/CHANGELOG.md +526 -0
- package/LICENSE +21 -0
- package/README.md +620 -0
- package/bin/devflow-checkpoint.js +10 -0
- package/bin/devflow-collab.js +10 -0
- package/bin/devflow-cost.js +10 -0
- package/bin/devflow-create-persona.js +10 -0
- package/bin/devflow-init.js +10 -0
- package/bin/devflow-memory.js +10 -0
- package/bin/devflow-new-doc.js +10 -0
- package/bin/devflow-personalize.js +10 -0
- package/bin/devflow-setup-checkpoint.js +10 -0
- package/bin/devflow-story.js +10 -0
- package/bin/devflow-tech-debt.js +10 -0
- package/bin/devflow-validate-overrides.js +10 -0
- package/bin/devflow-validate.js +10 -0
- package/bin/devflow-version.js +10 -0
- package/lib/constants.js +30 -0
- package/lib/exec-python.js +78 -0
- package/lib/python-check.js +178 -0
- package/package.json +64 -0
- package/tooling/.automation/agents/architect.md +135 -0
- package/tooling/.automation/agents/ba.md +70 -0
- package/tooling/.automation/agents/dev.md +79 -0
- package/tooling/.automation/agents/maintainer.md +97 -0
- package/tooling/.automation/agents/pm.md +116 -0
- package/tooling/.automation/agents/reviewer.md +141 -0
- package/tooling/.automation/agents/sm.md +61 -0
- package/tooling/.automation/agents/writer.md +193 -0
- package/tooling/.automation/config.ps1.template +61 -0
- package/tooling/.automation/config.sh.template +48 -0
- package/tooling/.automation/memory/.gitkeep +6 -0
- package/tooling/.automation/memory/knowledge/kg_integration-test.json +94 -0
- package/tooling/.automation/memory/knowledge/kg_test-story.json +300 -0
- package/tooling/.automation/memory/shared/shared_integration-test.json +30 -0
- package/tooling/.automation/memory/shared/shared_test-story.json +78 -0
- package/tooling/.automation/overrides/templates/README.md +113 -0
- package/tooling/.automation/overrides/templates/architect/README.md +27 -0
- package/tooling/.automation/overrides/templates/architect/cloud-native.yaml +92 -0
- package/tooling/.automation/overrides/templates/architect/enterprise-architect.yaml +85 -0
- package/tooling/.automation/overrides/templates/architect/pragmatic-minimalist.yaml +88 -0
- package/tooling/.automation/overrides/templates/ba/README.md +27 -0
- package/tooling/.automation/overrides/templates/ba/agile-storyteller.yaml +86 -0
- package/tooling/.automation/overrides/templates/ba/domain-expert.yaml +91 -0
- package/tooling/.automation/overrides/templates/ba/requirements-engineer.yaml +89 -0
- package/tooling/.automation/overrides/templates/dev/README.md +32 -0
- package/tooling/.automation/overrides/templates/dev/junior-mentored.yaml +39 -0
- package/tooling/.automation/overrides/templates/dev/performance-engineer.yaml +43 -0
- package/tooling/.automation/overrides/templates/dev/rapid-prototyper.yaml +52 -0
- package/tooling/.automation/overrides/templates/dev/security-focused.yaml +43 -0
- package/tooling/.automation/overrides/templates/dev/senior-fullstack.yaml +39 -0
- package/tooling/.automation/overrides/templates/maintainer/README.md +27 -0
- package/tooling/.automation/overrides/templates/maintainer/devops-maintainer.yaml +113 -0
- package/tooling/.automation/overrides/templates/maintainer/legacy-steward.yaml +94 -0
- package/tooling/.automation/overrides/templates/maintainer/oss-maintainer.yaml +94 -0
- package/tooling/.automation/overrides/templates/pm/README.md +27 -0
- package/tooling/.automation/overrides/templates/pm/agile-pm.yaml +91 -0
- package/tooling/.automation/overrides/templates/pm/hybrid-delivery.yaml +87 -0
- package/tooling/.automation/overrides/templates/pm/traditional-pm.yaml +91 -0
- package/tooling/.automation/overrides/templates/reviewer/README.md +11 -0
- package/tooling/.automation/overrides/templates/reviewer/mentoring-reviewer.yaml +45 -0
- package/tooling/.automation/overrides/templates/reviewer/quick-sanity.yaml +50 -0
- package/tooling/.automation/overrides/templates/reviewer/thorough-critic.yaml +48 -0
- package/tooling/.automation/overrides/templates/sm/README.md +11 -0
- package/tooling/.automation/overrides/templates/sm/agile-coach.yaml +52 -0
- package/tooling/.automation/overrides/templates/sm/startup-pm.yaml +50 -0
- package/tooling/.automation/overrides/templates/sm/technical-lead.yaml +47 -0
- package/tooling/.automation/overrides/templates/user-profile.template.yaml +62 -0
- package/tooling/.automation/overrides/templates/writer/README.md +27 -0
- package/tooling/.automation/overrides/templates/writer/api-documentarian.yaml +99 -0
- package/tooling/.automation/overrides/templates/writer/docs-as-code.yaml +108 -0
- package/tooling/.automation/overrides/templates/writer/user-guide-author.yaml +100 -0
- package/tooling/completions/DevflowCompletion.ps1 +213 -0
- package/tooling/completions/_run-story +116 -0
- package/tooling/completions/run-story-completion.bash +136 -0
- package/tooling/docs/DOC-STANDARD.md +717 -0
- package/tooling/docs/sprint-status.yaml.template +24 -0
- package/tooling/docs/templates/bug-report.md +234 -0
- package/tooling/docs/templates/migration-spec.md +274 -0
- package/tooling/docs/templates/refactor-spec.md +86 -0
- package/tooling/docs/templates/tech-debt.md +86 -0
- package/tooling/scripts/context_checkpoint.py +556 -0
- package/tooling/scripts/cost_dashboard.py +617 -0
- package/tooling/scripts/create-persona.py +690 -0
- package/tooling/scripts/create-persona.sh +435 -0
- package/tooling/scripts/init-project-workflow.ps1 +651 -0
- package/tooling/scripts/init-project-workflow.py +70 -0
- package/tooling/scripts/init-project-workflow.sh +746 -0
- package/tooling/scripts/lib/__init__.py +35 -0
- package/tooling/scripts/lib/agent_handoff.py +526 -0
- package/tooling/scripts/lib/agent_router.py +698 -0
- package/tooling/scripts/lib/checkpoint-integration.ps1 +245 -0
- package/tooling/scripts/lib/checkpoint-integration.sh +191 -0
- package/tooling/scripts/lib/claude-cli.ps1 +952 -0
- package/tooling/scripts/lib/claude-cli.sh +1293 -0
- package/tooling/scripts/lib/cost_config.py +222 -0
- package/tooling/scripts/lib/cost_display.py +443 -0
- package/tooling/scripts/lib/cost_tracker.py +710 -0
- package/tooling/scripts/lib/currency_converter.py +328 -0
- package/tooling/scripts/lib/errors.py +438 -0
- package/tooling/scripts/lib/override-loader.sh +286 -0
- package/tooling/scripts/lib/pair_programming.py +589 -0
- package/tooling/scripts/lib/shared_memory.py +637 -0
- package/tooling/scripts/lib/swarm_orchestrator.py +689 -0
- package/tooling/scripts/memory_summarize.py +324 -0
- package/tooling/scripts/new-doc.ps1 +405 -0
- package/tooling/scripts/new-doc.py +93 -0
- package/tooling/scripts/new-doc.sh +534 -0
- package/tooling/scripts/personalize_agent.py +385 -0
- package/tooling/scripts/rollback-migration.sh +540 -0
- package/tooling/scripts/run-collab.ps1 +251 -0
- package/tooling/scripts/run-collab.py +605 -0
- package/tooling/scripts/run-collab.sh +110 -0
- package/tooling/scripts/run-story.ps1 +490 -0
- package/tooling/scripts/run-story.py +387 -0
- package/tooling/scripts/run-story.sh +467 -0
- package/tooling/scripts/setup-checkpoint-service.ps1 +219 -0
- package/tooling/scripts/setup-checkpoint-service.py +87 -0
- package/tooling/scripts/setup-checkpoint-service.sh +236 -0
- package/tooling/scripts/tech-debt-tracker.py +608 -0
- package/tooling/scripts/update_version.py +244 -0
- package/tooling/scripts/validate-overrides.py +511 -0
- package/tooling/scripts/validate-overrides.sh +432 -0
- package/tooling/scripts/validate_setup.py +539 -0
|
@@ -0,0 +1,432 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
################################################################################
|
|
3
|
+
# Validate Overrides - Override YAML Validation and Linting
|
|
4
|
+
#
|
|
5
|
+
# This script validates all override YAML files in the overrides directory.
|
|
6
|
+
# It checks for:
|
|
7
|
+
# - Valid YAML syntax
|
|
8
|
+
# - Required fields
|
|
9
|
+
# - Valid field types
|
|
10
|
+
# - Valid model names
|
|
11
|
+
# - Valid budget ranges
|
|
12
|
+
#
|
|
13
|
+
# Usage:
|
|
14
|
+
# ./validate-overrides.sh # Validate all overrides
|
|
15
|
+
# ./validate-overrides.sh dev # Validate specific agent override
|
|
16
|
+
# ./validate-overrides.sh --fix # Auto-fix common issues
|
|
17
|
+
# ./validate-overrides.sh --verbose # Show detailed output
|
|
18
|
+
#
|
|
19
|
+
################################################################################
|
|
20
|
+
|
|
21
|
+
set -e
|
|
22
|
+
|
|
23
|
+
# Colors
|
|
24
|
+
RED='\033[0;31m'
|
|
25
|
+
GREEN='\033[0;32m'
|
|
26
|
+
YELLOW='\033[1;33m'
|
|
27
|
+
BLUE='\033[0;34m'
|
|
28
|
+
CYAN='\033[0;36m'
|
|
29
|
+
NC='\033[0m'
|
|
30
|
+
|
|
31
|
+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
32
|
+
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
33
|
+
OVERRIDES_DIR="$PROJECT_ROOT/.automation/overrides"
|
|
34
|
+
AGENTS_DIR="$PROJECT_ROOT/.automation/agents"
|
|
35
|
+
|
|
36
|
+
# Valid values
|
|
37
|
+
VALID_MODELS=("sonnet" "opus" "haiku")
|
|
38
|
+
MIN_BUDGET=0.01
|
|
39
|
+
MAX_BUDGET=100.00
|
|
40
|
+
|
|
41
|
+
# Counters
|
|
42
|
+
ERRORS=0
|
|
43
|
+
WARNINGS=0
|
|
44
|
+
VALIDATED=0
|
|
45
|
+
|
|
46
|
+
################################################################################
|
|
47
|
+
# Helper Functions
|
|
48
|
+
################################################################################
|
|
49
|
+
|
|
50
|
+
print_header() {
|
|
51
|
+
echo ""
|
|
52
|
+
echo -e "${CYAN}═══════════════════════════════════════════════════════════════${NC}"
|
|
53
|
+
echo -e "${CYAN} OVERRIDE VALIDATOR${NC}"
|
|
54
|
+
echo -e "${CYAN}═══════════════════════════════════════════════════════════════${NC}"
|
|
55
|
+
echo ""
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
error() {
|
|
59
|
+
echo -e "${RED} ✗ ERROR:${NC} $1"
|
|
60
|
+
((ERRORS++))
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
warning() {
|
|
64
|
+
echo -e "${YELLOW} ⚠ WARNING:${NC} $1"
|
|
65
|
+
((WARNINGS++))
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
success() {
|
|
69
|
+
echo -e "${GREEN} ✓${NC} $1"
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
info() {
|
|
73
|
+
[[ "$VERBOSE" == "true" ]] && echo -e "${BLUE} ℹ${NC} $1"
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
################################################################################
|
|
77
|
+
# YAML Validation Helpers
|
|
78
|
+
################################################################################
|
|
79
|
+
|
|
80
|
+
# Check if file has valid YAML syntax using basic shell parsing
|
|
81
|
+
check_yaml_syntax() {
|
|
82
|
+
local file="$1"
|
|
83
|
+
|
|
84
|
+
# Check for common YAML syntax issues
|
|
85
|
+
local line_num=0
|
|
86
|
+
local in_list=false
|
|
87
|
+
local prev_indent=0
|
|
88
|
+
|
|
89
|
+
while IFS= read -r line || [[ -n "$line" ]]; do
|
|
90
|
+
((line_num++))
|
|
91
|
+
|
|
92
|
+
# Skip empty lines and comments
|
|
93
|
+
[[ -z "$line" || "$line" =~ ^[[:space:]]*# ]] && continue
|
|
94
|
+
|
|
95
|
+
# Check for tabs (YAML should use spaces)
|
|
96
|
+
if [[ "$line" == *$'\t'* ]]; then
|
|
97
|
+
error "Line $line_num: Contains tabs (use spaces instead)"
|
|
98
|
+
return 1
|
|
99
|
+
fi
|
|
100
|
+
|
|
101
|
+
# Check for trailing spaces
|
|
102
|
+
if [[ "$line" =~ [[:space:]]$ ]]; then
|
|
103
|
+
warning "Line $line_num: Trailing whitespace"
|
|
104
|
+
fi
|
|
105
|
+
|
|
106
|
+
# Check for unclosed quotes
|
|
107
|
+
local quote_count=$(echo "$line" | grep -o '"' | wc -l | tr -d ' ')
|
|
108
|
+
if [[ $((quote_count % 2)) -ne 0 ]]; then
|
|
109
|
+
error "Line $line_num: Unclosed double quote"
|
|
110
|
+
return 1
|
|
111
|
+
fi
|
|
112
|
+
|
|
113
|
+
local single_quote_count=$(echo "$line" | grep -o "'" | wc -l | tr -d ' ')
|
|
114
|
+
if [[ $((single_quote_count % 2)) -ne 0 ]]; then
|
|
115
|
+
error "Line $line_num: Unclosed single quote"
|
|
116
|
+
return 1
|
|
117
|
+
fi
|
|
118
|
+
|
|
119
|
+
# Check for proper colon spacing in key-value pairs
|
|
120
|
+
if [[ "$line" =~ ^[[:space:]]*[a-zA-Z_][a-zA-Z0-9_]*:[^[:space:]] && ! "$line" =~ ^[[:space:]]*[a-zA-Z_][a-zA-Z0-9_]*:$ ]]; then
|
|
121
|
+
# Allow for URLs and special cases
|
|
122
|
+
if [[ ! "$line" =~ https?: && ! "$line" =~ \".*:.*\" ]]; then
|
|
123
|
+
warning "Line $line_num: Missing space after colon"
|
|
124
|
+
fi
|
|
125
|
+
fi
|
|
126
|
+
|
|
127
|
+
done < "$file"
|
|
128
|
+
|
|
129
|
+
return 0
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
# Extract value from YAML key
|
|
133
|
+
yaml_get() {
|
|
134
|
+
local file="$1"
|
|
135
|
+
local key="$2"
|
|
136
|
+
grep -E "^${key}:" "$file" 2>/dev/null | sed "s/^${key}:[[:space:]]*//" | sed 's/^["'"'"']//' | sed 's/["'"'"']$//' | head -1
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
# Check if a list exists and has items
|
|
140
|
+
yaml_has_list() {
|
|
141
|
+
local file="$1"
|
|
142
|
+
local key="$2"
|
|
143
|
+
grep -q "^${key}:" "$file" 2>/dev/null && \
|
|
144
|
+
awk "/^${key}:/{found=1; next} found && /^[[:space:]]*-/{print; exit} found && /^[a-zA-Z]/{exit}" "$file" 2>/dev/null | grep -q .
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
################################################################################
|
|
148
|
+
# Override Validation
|
|
149
|
+
################################################################################
|
|
150
|
+
|
|
151
|
+
validate_override_file() {
|
|
152
|
+
local file="$1"
|
|
153
|
+
local filename=$(basename "$file")
|
|
154
|
+
local agent_name="${filename%.override.yaml}"
|
|
155
|
+
|
|
156
|
+
echo ""
|
|
157
|
+
echo -e "${BLUE}Validating:${NC} $filename"
|
|
158
|
+
|
|
159
|
+
# Check if corresponding agent exists
|
|
160
|
+
local agent_file="$AGENTS_DIR/${agent_name}.md"
|
|
161
|
+
if [[ ! -f "$agent_file" ]]; then
|
|
162
|
+
warning "No corresponding agent file found: ${agent_name}.md"
|
|
163
|
+
warning "This override may not be applied to any agent"
|
|
164
|
+
else
|
|
165
|
+
info "Agent file found: ${agent_name}.md"
|
|
166
|
+
fi
|
|
167
|
+
|
|
168
|
+
# Check YAML syntax
|
|
169
|
+
if ! check_yaml_syntax "$file"; then
|
|
170
|
+
error "YAML syntax validation failed"
|
|
171
|
+
return 1
|
|
172
|
+
fi
|
|
173
|
+
success "YAML syntax is valid"
|
|
174
|
+
|
|
175
|
+
# Validate model override if present
|
|
176
|
+
local model=$(yaml_get "$file" "model")
|
|
177
|
+
if [[ -n "$model" ]]; then
|
|
178
|
+
local valid=false
|
|
179
|
+
for valid_model in "${VALID_MODELS[@]}"; do
|
|
180
|
+
if [[ "$model" == "$valid_model" ]]; then
|
|
181
|
+
valid=true
|
|
182
|
+
break
|
|
183
|
+
fi
|
|
184
|
+
done
|
|
185
|
+
|
|
186
|
+
if [[ "$valid" == "true" ]]; then
|
|
187
|
+
success "Model override is valid: $model"
|
|
188
|
+
else
|
|
189
|
+
error "Invalid model: '$model'. Valid options: ${VALID_MODELS[*]}"
|
|
190
|
+
fi
|
|
191
|
+
fi
|
|
192
|
+
|
|
193
|
+
# Validate budget override if present
|
|
194
|
+
local budget=$(yaml_get "$file" "max_budget_usd")
|
|
195
|
+
if [[ -n "$budget" ]]; then
|
|
196
|
+
# Check if it's a valid number
|
|
197
|
+
if [[ "$budget" =~ ^[0-9]+\.?[0-9]*$ ]]; then
|
|
198
|
+
if (( $(echo "$budget < $MIN_BUDGET" | bc -l) )); then
|
|
199
|
+
error "Budget too low: $budget (minimum: $MIN_BUDGET)"
|
|
200
|
+
elif (( $(echo "$budget > $MAX_BUDGET" | bc -l) )); then
|
|
201
|
+
warning "Budget unusually high: $budget (maximum recommended: $MAX_BUDGET)"
|
|
202
|
+
else
|
|
203
|
+
success "Budget override is valid: \$$budget"
|
|
204
|
+
fi
|
|
205
|
+
else
|
|
206
|
+
error "Invalid budget format: '$budget' (must be a number)"
|
|
207
|
+
fi
|
|
208
|
+
fi
|
|
209
|
+
|
|
210
|
+
# Check for additional_rules
|
|
211
|
+
if yaml_has_list "$file" "additional_rules"; then
|
|
212
|
+
local rule_count=$(awk '/^additional_rules:/{found=1; next} found && /^[[:space:]]*-/{count++} found && /^[a-zA-Z]/{exit} END{print count}' "$file")
|
|
213
|
+
success "Additional rules defined: ${rule_count:-0} rules"
|
|
214
|
+
fi
|
|
215
|
+
|
|
216
|
+
# Check for memories
|
|
217
|
+
if yaml_has_list "$file" "memories"; then
|
|
218
|
+
local memory_count=$(awk '/^memories:/{found=1; next} found && /^[[:space:]]*-/{count++} found && /^[a-zA-Z]/{exit} END{print count}' "$file")
|
|
219
|
+
success "Memories defined: ${memory_count:-0} items"
|
|
220
|
+
fi
|
|
221
|
+
|
|
222
|
+
# Check for critical_actions
|
|
223
|
+
if yaml_has_list "$file" "critical_actions"; then
|
|
224
|
+
local action_count=$(awk '/^critical_actions:/{found=1; next} found && /^[[:space:]]*-/{count++} found && /^[a-zA-Z]/{exit} END{print count}' "$file")
|
|
225
|
+
success "Critical actions defined: ${action_count:-0} actions"
|
|
226
|
+
fi
|
|
227
|
+
|
|
228
|
+
((VALIDATED++))
|
|
229
|
+
return 0
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
validate_user_profile() {
|
|
233
|
+
local file="$OVERRIDES_DIR/user-profile.yaml"
|
|
234
|
+
|
|
235
|
+
if [[ ! -f "$file" ]]; then
|
|
236
|
+
warning "No user-profile.yaml found"
|
|
237
|
+
return 0
|
|
238
|
+
fi
|
|
239
|
+
|
|
240
|
+
echo ""
|
|
241
|
+
echo -e "${BLUE}Validating:${NC} user-profile.yaml"
|
|
242
|
+
|
|
243
|
+
# Check YAML syntax
|
|
244
|
+
if ! check_yaml_syntax "$file"; then
|
|
245
|
+
error "YAML syntax validation failed"
|
|
246
|
+
return 1
|
|
247
|
+
fi
|
|
248
|
+
success "YAML syntax is valid"
|
|
249
|
+
|
|
250
|
+
# Check for user section
|
|
251
|
+
if grep -q "^user:" "$file"; then
|
|
252
|
+
success "User section found"
|
|
253
|
+
|
|
254
|
+
local name=$(grep -A10 "^user:" "$file" | grep "name:" | sed 's/.*name:[[:space:]]*//' | head -1)
|
|
255
|
+
if [[ -n "$name" && "$name" != "User" ]]; then
|
|
256
|
+
success "User name configured: $name"
|
|
257
|
+
fi
|
|
258
|
+
|
|
259
|
+
local level=$(grep -A10 "^user:" "$file" | grep "technical_level:" | sed 's/.*technical_level:[[:space:]]*//' | head -1)
|
|
260
|
+
if [[ -n "$level" ]]; then
|
|
261
|
+
local valid_levels=("beginner" "intermediate" "advanced" "expert")
|
|
262
|
+
local valid=false
|
|
263
|
+
for valid_level in "${valid_levels[@]}"; do
|
|
264
|
+
if [[ "${level,,}" == "$valid_level" ]]; then
|
|
265
|
+
valid=true
|
|
266
|
+
break
|
|
267
|
+
fi
|
|
268
|
+
done
|
|
269
|
+
|
|
270
|
+
if [[ "$valid" == "true" ]]; then
|
|
271
|
+
success "Technical level: $level"
|
|
272
|
+
else
|
|
273
|
+
warning "Unusual technical level: $level"
|
|
274
|
+
fi
|
|
275
|
+
fi
|
|
276
|
+
else
|
|
277
|
+
warning "No user section found in profile"
|
|
278
|
+
fi
|
|
279
|
+
|
|
280
|
+
((VALIDATED++))
|
|
281
|
+
return 0
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
################################################################################
|
|
285
|
+
# Auto-Fix Functions
|
|
286
|
+
################################################################################
|
|
287
|
+
|
|
288
|
+
fix_trailing_whitespace() {
|
|
289
|
+
local file="$1"
|
|
290
|
+
# Remove trailing whitespace
|
|
291
|
+
sed -i '' 's/[[:space:]]*$//' "$file" 2>/dev/null || \
|
|
292
|
+
sed -i 's/[[:space:]]*$//' "$file" 2>/dev/null
|
|
293
|
+
success "Fixed trailing whitespace in $(basename "$file")"
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
fix_tabs() {
|
|
297
|
+
local file="$1"
|
|
298
|
+
# Convert tabs to 2 spaces
|
|
299
|
+
sed -i '' 's/\t/ /g' "$file" 2>/dev/null || \
|
|
300
|
+
sed -i 's/\t/ /g' "$file" 2>/dev/null
|
|
301
|
+
success "Converted tabs to spaces in $(basename "$file")"
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
auto_fix_file() {
|
|
305
|
+
local file="$1"
|
|
306
|
+
echo ""
|
|
307
|
+
echo -e "${YELLOW}Auto-fixing:${NC} $(basename "$file")"
|
|
308
|
+
|
|
309
|
+
# Backup original
|
|
310
|
+
cp "$file" "${file}.bak"
|
|
311
|
+
|
|
312
|
+
fix_trailing_whitespace "$file"
|
|
313
|
+
fix_tabs "$file"
|
|
314
|
+
|
|
315
|
+
# Remove backup if no changes
|
|
316
|
+
if diff -q "$file" "${file}.bak" > /dev/null 2>&1; then
|
|
317
|
+
rm "${file}.bak"
|
|
318
|
+
info "No changes needed"
|
|
319
|
+
else
|
|
320
|
+
info "Changes made (backup saved as ${file}.bak)"
|
|
321
|
+
fi
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
################################################################################
|
|
325
|
+
# Main
|
|
326
|
+
################################################################################
|
|
327
|
+
|
|
328
|
+
print_usage() {
|
|
329
|
+
echo "Usage: ./validate-overrides.sh [agent-name] [options]"
|
|
330
|
+
echo ""
|
|
331
|
+
echo "Options:"
|
|
332
|
+
echo " <agent-name> Validate specific agent override (e.g., 'dev')"
|
|
333
|
+
echo " --fix Auto-fix common issues (whitespace, tabs)"
|
|
334
|
+
echo " --verbose Show detailed output"
|
|
335
|
+
echo " --help Show this help message"
|
|
336
|
+
echo ""
|
|
337
|
+
echo "Examples:"
|
|
338
|
+
echo " ./validate-overrides.sh # Validate all overrides"
|
|
339
|
+
echo " ./validate-overrides.sh dev # Validate dev.override.yaml"
|
|
340
|
+
echo " ./validate-overrides.sh --fix # Fix all issues"
|
|
341
|
+
echo ""
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
main() {
|
|
345
|
+
local target=""
|
|
346
|
+
local FIX_MODE=false
|
|
347
|
+
VERBOSE=false
|
|
348
|
+
|
|
349
|
+
# Parse arguments
|
|
350
|
+
while [[ $# -gt 0 ]]; do
|
|
351
|
+
case "$1" in
|
|
352
|
+
--fix)
|
|
353
|
+
FIX_MODE=true
|
|
354
|
+
;;
|
|
355
|
+
--verbose|-v)
|
|
356
|
+
VERBOSE=true
|
|
357
|
+
;;
|
|
358
|
+
--help|-h)
|
|
359
|
+
print_usage
|
|
360
|
+
exit 0
|
|
361
|
+
;;
|
|
362
|
+
*)
|
|
363
|
+
target="$1"
|
|
364
|
+
;;
|
|
365
|
+
esac
|
|
366
|
+
shift
|
|
367
|
+
done
|
|
368
|
+
|
|
369
|
+
print_header
|
|
370
|
+
|
|
371
|
+
if [[ ! -d "$OVERRIDES_DIR" ]]; then
|
|
372
|
+
error "Overrides directory not found: $OVERRIDES_DIR"
|
|
373
|
+
exit 1
|
|
374
|
+
fi
|
|
375
|
+
|
|
376
|
+
if [[ -n "$target" ]]; then
|
|
377
|
+
# Validate specific override
|
|
378
|
+
local file="$OVERRIDES_DIR/${target}.override.yaml"
|
|
379
|
+
if [[ ! -f "$file" ]]; then
|
|
380
|
+
error "Override file not found: $file"
|
|
381
|
+
exit 1
|
|
382
|
+
fi
|
|
383
|
+
|
|
384
|
+
if [[ "$FIX_MODE" == "true" ]]; then
|
|
385
|
+
auto_fix_file "$file"
|
|
386
|
+
fi
|
|
387
|
+
validate_override_file "$file"
|
|
388
|
+
else
|
|
389
|
+
# Validate all overrides
|
|
390
|
+
echo -e "${BLUE}Scanning:${NC} $OVERRIDES_DIR"
|
|
391
|
+
|
|
392
|
+
# Validate user profile first
|
|
393
|
+
if [[ "$FIX_MODE" == "true" && -f "$OVERRIDES_DIR/user-profile.yaml" ]]; then
|
|
394
|
+
auto_fix_file "$OVERRIDES_DIR/user-profile.yaml"
|
|
395
|
+
fi
|
|
396
|
+
validate_user_profile
|
|
397
|
+
|
|
398
|
+
# Validate all override files
|
|
399
|
+
for file in "$OVERRIDES_DIR"/*.override.yaml; do
|
|
400
|
+
if [[ -f "$file" ]]; then
|
|
401
|
+
if [[ "$FIX_MODE" == "true" ]]; then
|
|
402
|
+
auto_fix_file "$file"
|
|
403
|
+
fi
|
|
404
|
+
validate_override_file "$file"
|
|
405
|
+
fi
|
|
406
|
+
done
|
|
407
|
+
fi
|
|
408
|
+
|
|
409
|
+
# Summary
|
|
410
|
+
echo ""
|
|
411
|
+
echo -e "${CYAN}═══════════════════════════════════════════════════════════════${NC}"
|
|
412
|
+
echo -e "${CYAN} VALIDATION SUMMARY${NC}"
|
|
413
|
+
echo -e "${CYAN}═══════════════════════════════════════════════════════════════${NC}"
|
|
414
|
+
echo ""
|
|
415
|
+
echo -e " Files validated: ${GREEN}$VALIDATED${NC}"
|
|
416
|
+
echo -e " Errors: ${RED}$ERRORS${NC}"
|
|
417
|
+
echo -e " Warnings: ${YELLOW}$WARNINGS${NC}"
|
|
418
|
+
echo ""
|
|
419
|
+
|
|
420
|
+
if [[ $ERRORS -gt 0 ]]; then
|
|
421
|
+
echo -e "${RED}❌ Validation failed with $ERRORS error(s)${NC}"
|
|
422
|
+
exit 1
|
|
423
|
+
elif [[ $WARNINGS -gt 0 ]]; then
|
|
424
|
+
echo -e "${YELLOW}⚠️ Validation passed with $WARNINGS warning(s)${NC}"
|
|
425
|
+
exit 0
|
|
426
|
+
else
|
|
427
|
+
echo -e "${GREEN}✅ All validations passed!${NC}"
|
|
428
|
+
exit 0
|
|
429
|
+
fi
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
main "$@"
|