#!/usr/bin/env bash # Search a project for code and configuration that needs a decision on the way to Spring AI 2.1. # usage: scripts/grep-checklist.sh dir=${1:?project directory} cd "$dir" || exit 2 check() { # title, extended regex, file globs... local title=$1 regex=$2; shift 2 local includes=(); for g in "$@"; do includes+=("--include=$g"); done local hits; hits=$(grep -rnE "${includes[@]}" --exclude-dir=target --exclude-dir=build -e "$regex" . | sed 's#^\./##' | sort) if [ -n "$hits" ]; then echo; echo "[ ] $title"; echo "$hits" | sed 's/^ */ /'; fi } code=('*.java' '*.kt') conf=('*.properties' '*.yml' '*.yaml') build=('pom.xml' '*.gradle' '*.kts' '*.toml') echo "# Spring AI 2.1 upgrade checklist: $(basename "$PWD")" check "ChatMemory API: deprecated, removed in 3.0.0 (move to sessions)" \ 'MessageChatMemoryAdvisor|MessageWindowChatMemory|ChatMemoryRepository|ChatMemory\b' "${code[@]}" check "Chat memory modules and properties" 'chat-memory-repository|chat-memory-redis' "${build[@]}" check "Chat memory properties (JDBC ones have spring.ai.session replacements)" 'spring\.ai\.chat\.memory' "${conf[@]}" check "Anthropic sampling options: discarded with a WARN on 2.1.0" '\.(temperature|topP|topK)\(' "${code[@]}" check "Anthropic sampling properties" 'spring\.ai\.anthropic\.chat\.(options\.)?(temperature|top-p|top-k)' "${conf[@]}" check "Token arithmetic on cache counters: prompt tokens include them since 2.0.3" 'getCache(Read|Write)InputTokens' "${code[@]}" check "x-api-key handling: Anthropic keys now travel as Authorization: Bearer" '[Xx]-[Aa][Pp][Ii]-[Kk]ey' "${code[@]}" "${conf[@]}" '*.conf' check "Reasoning read from metadata or extra generations" '"(isThought|thinking|signature|reasoningContent|thinking_content)"|THOUGHT_METADATA_KEY|THINKING_[A-Z_]*METADATA|getReasoningContent|DeepSeekAssistantMessage' "${code[@]}" check "Mutating message lists (now unmodifiable)" 'get(Media|ToolCalls)\(\)\.(add|addAll|remove|removeIf|clear)\(' "${code[@]}" check "Custom ToolCallingManager: delegate the ToolCallDecisions overload" 'implements +ToolCallingManager|: *ToolCallingManager' "${code[@]}" check "Bedrock requestParameters widened to Map" 'requestParameters' "${code[@]}" check "entity() with filtered or guarded replies: exception types changed" 'SafeGuardAdvisor' "${code[@]}" check "pgvector 'distance' metadata key" 'getMetadata\(\)\.get\("distance"\)|DocumentMetadata\.DISTANCE' "${code[@]}" check "MCP server customizers: deprecated in 2.1.0" 'Mcp(Async|Sync|StatelessAsync|StatelessSync)ServerCustomizer' "${code[@]}" check "TikaDocumentReader: 10,000,000 character limit since 2.0.3" 'new TikaDocumentReader' "${code[@]}" check "SemanticCacheAdvisor: a scope resolver is mandatory since 2.0.2" 'SemanticCacheAdvisor' "${code[@]}" check "Tool resolution fallback: off by default since 2.0.1" 'ToolCallbackResolver' "${code[@]}" check "Spring AI and Spring Boot versions" 'spring-ai(\.version|-bom)|spring-boot-starter-parent' "${build[@]}" echo echo "A hit is a place to read, not proof of a problem. No hit is not proof of safety."