feat: aidevops update now checks planning template versions#160
feat: aidevops update now checks planning template versions#160marcusquinn merged 1 commit intomainfrom
Conversation
- Extract check_planning_file_version() to top-level for reuse - Add check_planning_needs_upgrade() helper for per-repo checks - After version upgrades, scan registered repos for outdated planning templates and offer to upgrade them (runs upgrade-planning --force) - Shows current vs latest template version and what's new - Only checks repos with planning feature enabled
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary of ChangesHello @marcusquinn, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
🔍 Code Quality Report�[0;35m[MONITOR]�[0m Code Review Monitoring Report �[0;34m[INFO]�[0m Latest Quality Status: �[0;34m[INFO]�[0m Recent monitoring activity: 📈 Current Quality Metrics
Generated on: Sat Jan 24 01:30:40 UTC 2026 Generated by AI DevOps Framework Code Review Monitoring |
🤖 Augment PR SummarySummary: Extends Changes:
🤖 Was this summary useful? React with 👍 or 👎 |
| print_warning "$label format version $current_ver -> $template_ver (adds risk field, updated estimates)" | ||
| return 0 | ||
| # Check TODO.md | ||
| if check_planning_file_version "$todo_file" "$todo_template"; then |
There was a problem hiding this comment.
check_planning_file_version currently returns “up to date” when the planning file is missing, so cmd_upgrade_planning will treat a missing TODO.md/todo/PLANS.md as already up to date and skip the create-from-template path. This can also lead to printing an empty version string from the else branch when the file doesn’t exist.
Other Locations
aidevops.sh:1231
🤖 Was this useful? React with 👍 or 👎
There was a problem hiding this comment.
Code Review
This pull request introduces a useful feature for checking and upgrading planning templates. The implementation is solid, but there are several opportunities to improve maintainability and robustness by reducing code duplication and using more consistent tooling.
My review includes suggestions to:
- Extract repeated version-parsing logic into a helper function.
- Use
jqfor JSON parsing consistently, instead ofgrep. - Refactor duplicated blocks of code within
cmd_upgrade_planninginto a local helper function. - Simplify conditional logic for better readability.
Addressing these points will make the script more maintainable and easier to extend in the future.
| local has_planning | ||
| has_planning=$(grep -o '"planning": *true' "$repo_path/.aidevops.json" 2>/dev/null || true) | ||
| if [[ -n "$has_planning" ]] && check_planning_needs_upgrade "$repo_path"; then | ||
| repos_needing_planning+=("$repo_path") | ||
| fi |
There was a problem hiding this comment.
The script uses grep to check if the "planning": true key-value pair exists in .aidevops.json. This is inconsistent with other parts of the script that use jq for robust JSON parsing. Using jq is more reliable as it's not affected by whitespace or formatting changes in the JSON file. Since jq is a dependency for this script, it should be used here for consistency and correctness.
| local has_planning | |
| has_planning=$(grep -o '"planning": *true' "$repo_path/.aidevops.json" 2>/dev/null || true) | |
| if [[ -n "$has_planning" ]] && check_planning_needs_upgrade "$repo_path"; then | |
| repos_needing_planning+=("$repo_path") | |
| fi | |
| if jq -e '.features.planning == true' "$repo_path/.aidevops.json" &>/dev/null; then | |
| if check_planning_needs_upgrade "$repo_path"; then | |
| repos_needing_planning+=("$repo_path") | |
| fi | |
| fi |
| # Check TODO.md | ||
| if check_planning_file_version "$todo_file" "$todo_template"; then | ||
| if [[ -f "$todo_file" ]]; then | ||
| if ! grep -q "TOON:meta" "$todo_file" 2>/dev/null; then | ||
| print_warning "TODO.md uses minimal template (missing TOON markers)" | ||
| else | ||
| local current_ver template_ver | ||
| current_ver=$(grep -A1 "TOON:meta" "$todo_file" 2>/dev/null | tail -1 | cut -d',' -f1) | ||
| template_ver=$(grep -A1 "TOON:meta" "$todo_template" 2>/dev/null | tail -1 | cut -d',' -f1) | ||
| print_warning "TODO.md format version $current_ver -> $template_ver (adds risk field, updated estimates)" | ||
| fi | ||
| print_success "$label already up to date (v${current_ver})" | ||
| return 1 | ||
| else | ||
| print_info "$label not found - will create from template" | ||
| return 0 | ||
| print_info "TODO.md not found - will create from template" | ||
| fi | ||
| } | ||
|
|
||
| # Check TODO.md | ||
| if check_planning_file_version "$todo_file" "$todo_template" "TODO.md"; then | ||
| todo_needs_upgrade=true | ||
| needs_upgrade=true | ||
| else | ||
| local current_ver | ||
| current_ver=$(grep -A1 "TOON:meta" "$todo_file" 2>/dev/null | tail -1 | cut -d',' -f1) | ||
| print_success "TODO.md already up to date (v${current_ver})" | ||
| fi | ||
|
|
||
| # Check PLANS.md | ||
| if check_planning_file_version "$plans_file" "$plans_template" "todo/PLANS.md"; then | ||
| if check_planning_file_version "$plans_file" "$plans_template"; then | ||
| if [[ -f "$plans_file" ]]; then | ||
| if ! grep -q "TOON:meta" "$plans_file" 2>/dev/null; then | ||
| print_warning "todo/PLANS.md uses minimal template (missing TOON markers)" | ||
| else | ||
| local current_plans_ver template_plans_ver | ||
| current_plans_ver=$(grep -A1 "TOON:meta" "$plans_file" 2>/dev/null | tail -1 | cut -d',' -f1) | ||
| template_plans_ver=$(grep -A1 "TOON:meta" "$plans_template" 2>/dev/null | tail -1 | cut -d',' -f1) | ||
| print_warning "todo/PLANS.md format version $current_plans_ver -> $template_plans_ver" | ||
| fi | ||
| else | ||
| print_info "todo/PLANS.md not found - will create from template" | ||
| fi | ||
| plans_needs_upgrade=true | ||
| needs_upgrade=true | ||
| else | ||
| local current_plans_ver | ||
| current_plans_ver=$(grep -A1 "TOON:meta" "$plans_file" 2>/dev/null | tail -1 | cut -d',' -f1) | ||
| print_success "todo/PLANS.md already up to date (v${current_plans_ver})" | ||
| fi |
There was a problem hiding this comment.
There's significant code duplication between the logic for checking TODO.md and PLANS.md. This makes the code harder to read and maintain, as any changes to the checking logic would need to be applied in two places.
I recommend extracting this logic into a new local helper function. This function would handle checking a single planning file, printing the appropriate status message, and returning whether an upgrade is needed. This refactoring will improve code clarity and maintainability.
# Helper to check a single planning file and print status
_print_planning_file_status() {
local file="$1" template="$2" label="$3"
if ! check_planning_file_version "$file" "$template"; then
local current_ver
current_ver=$(grep -A1 "TOON:meta" "$file" 2>/dev/null | tail -1 | cut -d',' -f1)
print_success "$label already up to date (v${current_ver:-unknown})"
return 1
fi
if [[ -f "$file" ]]; then
if ! grep -q "TOON:meta" "$file" 2>/dev/null; then
print_warning "$label uses minimal template (missing TOON markers)"
else
local current_ver template_ver
current_ver=$(grep -A1 "TOON:meta" "$file" 2>/dev/null | tail -1 | cut -d',' -f1)
template_ver=$(grep -A1 "TOON:meta" "$template" 2>/dev/null | tail -1 | cut -d',' -f1)
local extra_msg=""
if [[ "$label" == "TODO.md" ]]; then
extra_msg=" (adds risk field, updated estimates)"
fi
print_warning "$label format version ${current_ver:-none} -> ${template_ver}${extra_msg}"
fi
else
print_info "$label not found - will create from template"
fi
return 0
}
# Check TODO.md
if _print_planning_file_status "$todo_file" "$todo_template" "TODO.md"; then
todo_needs_upgrade=true
needs_upgrade=true
fi
# Check PLANS.md
if _print_planning_file_status "$plans_file" "$plans_template" "todo/PLANS.md"; then
plans_needs_upgrade=true
needs_upgrade=true
fi| # Check if a planning file needs upgrading (version mismatch or missing TOON markers) | ||
| # Usage: check_planning_file_version <file> <template> | ||
| # Returns 0 if upgrade needed, 1 if up to date | ||
| check_planning_file_version() { | ||
| local file="$1" template="$2" | ||
| if [[ -f "$file" ]]; then | ||
| if ! grep -q "TOON:meta" "$file" 2>/dev/null; then | ||
| return 0 | ||
| fi | ||
| local current_ver template_ver | ||
| current_ver=$(grep -A1 "TOON:meta" "$file" 2>/dev/null | tail -1 | cut -d',' -f1) | ||
| template_ver=$(grep -A1 "TOON:meta" "$template" 2>/dev/null | tail -1 | cut -d',' -f1) | ||
| if [[ -n "$template_ver" ]] && [[ "$current_ver" != "$template_ver" ]]; then | ||
| return 0 | ||
| fi | ||
| return 1 | ||
| else | ||
| # No file = no upgrade needed (init would create it) | ||
| return 1 | ||
| fi | ||
| } |
There was a problem hiding this comment.
The logic to extract the version from TOON meta blocks is repeated in multiple places in this PR. To improve maintainability and reduce code duplication, I suggest extracting this logic into a helper function _get_toon_version and using it within check_planning_file_version. This new helper can then be reused in cmd_update and cmd_upgrade_planning to centralize version extraction.
# Helper to get version from a TOON meta block
_get_toon_version() {
local file="$1"
grep -A1 "TOON:meta" "$file" 2>/dev/null | tail -1 | cut -d',' -f1
}
# Check if a planning file needs upgrading (version mismatch or missing TOON markers)
# Usage: check_planning_file_version <file> <template>
# Returns 0 if upgrade needed, 1 if up to date
check_planning_file_version() {
local file="$1" template="$2"
if [[ -f "$file" ]]; then
if ! grep -q "TOON:meta" "$file" 2>/dev/null; then
return 0
fi
local current_ver template_ver
current_ver=$(_get_toon_version "$file")
template_ver=$(_get_toon_version "$template")
if [[ -n "$template_ver" ]] && [[ "$current_ver" != "$template_ver" ]]; then
return 0
fi
return 1
else
# No file = no upgrade needed (init would create it)
return 1
fi
}| if check_planning_file_version "$todo_file" "$todo_template"; then | ||
| return 0 | ||
| fi | ||
| if [[ -f "$plans_template" ]] && check_planning_file_version "$plans_file" "$plans_template"; then | ||
| return 0 | ||
| fi | ||
| return 1 |
There was a problem hiding this comment.
The conditional logic here can be simplified for better readability and conciseness. You can combine the checks using an || operator, which makes the function's intent clearer at a glance.
| if check_planning_file_version "$todo_file" "$todo_template"; then | |
| return 0 | |
| fi | |
| if [[ -f "$plans_template" ]] && check_planning_file_version "$plans_file" "$plans_template"; then | |
| return 0 | |
| fi | |
| return 1 | |
| if check_planning_file_version "$todo_file" "$todo_template" || \ | |
| ( [[ -f "$plans_template" ]] && check_planning_file_version "$plans_file" "$plans_template" ); then | |
| return 0 | |
| fi | |
| return 1 |



Summary
aidevops updatenow scans registered repos for outdated planning templatescheck_planning_file_version()to top-level for reuse across commandsWhat happens on
aidevops updateAfter the existing version check, a new section runs:
If confirmed, runs
upgrade-planning --forcein each repo (creates backups, merges existing tasks into new template structure).Testing
"planning": truein.aidevops.json