Skip to content

💫 Toolkit to help you get started with SDD or any other process!

Fix script config

Den Delimarsky 🌺93e41567d998
diff --git a/scripts/bash/update-agent-context.sh b/scripts/bash/update-agent-context.sh
index e69e912b8..8fe11e00e 100644
--- a/scripts/bash/update-agent-context.sh
+++ b/scripts/bash/update-agent-context.sh
@@ -297,14 +297,37 @@ create_new_agent_file() {
local escaped_framework=$(printf '%s\n' "$NEW_FRAMEWORK" | sed 's/[[\.*^$()+{}|]/\\&/g')
local escaped_branch=$(printf '%s\n' "$CURRENT_BRANCH" | sed 's/[[\.*^$()+{}|]/\\&/g')
+ # Build technology stack and recent change strings conditionally
+ local tech_stack
+ if [[ -n "$escaped_lang" && -n "$escaped_framework" ]]; then
+ tech_stack="- $escaped_lang + $escaped_framework ($escaped_branch)"
+ elif [[ -n "$escaped_lang" ]]; then
+ tech_stack="- $escaped_lang ($escaped_branch)"
+ elif [[ -n "$escaped_framework" ]]; then
+ tech_stack="- $escaped_framework ($escaped_branch)"
+ else
+ tech_stack="- ($escaped_branch)"
+ fi
+
+ local recent_change
+ if [[ -n "$escaped_lang" && -n "$escaped_framework" ]]; then
+ recent_change="- $escaped_branch: Added $escaped_lang + $escaped_framework"
+ elif [[ -n "$escaped_lang" ]]; then
+ recent_change="- $escaped_branch: Added $escaped_lang"
+ elif [[ -n "$escaped_framework" ]]; then
+ recent_change="- $escaped_branch: Added $escaped_framework"
+ else
+ recent_change="- $escaped_branch: Added"
+ fi
+
local substitutions=(
"s|\[PROJECT NAME\]|$project_name|"
"s|\[DATE\]|$current_date|"
- "s|\[EXTRACTED FROM ALL PLAN.MD FILES\]|- $escaped_lang + $escaped_framework ($escaped_branch)|"
+ "s|\[EXTRACTED FROM ALL PLAN.MD FILES\]|$tech_stack|"
"s|\[ACTUAL STRUCTURE FROM PLANS\]|$project_structure|g"
"s|\[ONLY COMMANDS FOR ACTIVE TECHNOLOGIES\]|$commands|"
"s|\[LANGUAGE-SPECIFIC, ONLY FOR LANGUAGES IN USE\]|$language_conventions|"
- "s|\[LAST 3 FEATURES AND WHAT THEY ADDED\]|- $escaped_branch: Added $escaped_lang + $escaped_framework|"
+ "s|\[LAST 3 FEATURES AND WHAT THEY ADDED\]|$recent_change|"
)
for substitution in "${substitutions[@]}"; do
@@ -425,6 +448,11 @@ update_existing_agent_file() {
fi
done < "$target_file"
+ # Post-loop check: if we're still in the Active Technologies section and haven't added new entries
+ if [[ $in_tech_section == true ]] && [[ $tech_entries_added == false ]] && [[ ${#new_tech_entries[@]} -gt 0 ]]; then
+ printf '%s\n' "${new_tech_entries[@]}" >> "$temp_file"
+ fi
+
# Move temp file to target atomically
if ! mv "$temp_file" "$target_file"; then
log_error "Failed to update target file"
diff --git a/scripts/powershell/update-agent-context.ps1 b/scripts/powershell/update-agent-context.ps1
index ec11c7f54..5204b4715 100644
--- a/scripts/powershell/update-agent-context.ps1
+++ b/scripts/powershell/update-agent-context.ps1
@@ -319,6 +319,11 @@ function Update-ExistingAgentFile {
$output.Add($line)
}
+ # Post-loop check: if we're still in the Active Technologies section and haven't added new entries
+ if ($inTech -and -not $techAdded -and $newTechEntries.Count -gt 0) {
+ $newTechEntries | ForEach-Object { $output.Add($_) }
+ }
+
Set-Content -LiteralPath $TargetFile -Value ($output -join [Environment]::NewLine)
return $true
}