diff --git a/scripts/atualizar-submodulo.sh b/scripts/atualizar-submodulo.sh index 5a3fe78..4db2406 100755 --- a/scripts/atualizar-submodulo.sh +++ b/scripts/atualizar-submodulo.sh @@ -50,8 +50,14 @@ if [ -f "$SUPER_DIR/.gitmodules" ]; then git -C "$SUPER_DIR" config -f .gitmodules submodule..agent.branch master 2>/dev/null || true fi - # Executar a atualização remota do submódulo .agent - if git -C "$SUPER_DIR" submodule update --init --recursive --remote .agent >/dev/null 2>&1; then + # Executar a atualização remota do submódulo .agent preservando commits locais (rebase) + if git -C "$SUPER_DIR" submodule update --init --recursive --remote --rebase .agent >/dev/null 2>&1 || \ + git -C "$SUPER_DIR" submodule update --init --recursive --remote .agent >/dev/null 2>&1; then + # Remover script legado menu/graphify-atualizar.sh (substituído por .agent/scripts/graphify.sh) e garantir .gitignore + rm -f "$SUPER_DIR/menu/graphify-atualizar.sh" 2>/dev/null || true + if [ -f "$SUPER_DIR/.agent/scripts/graphify.sh" ]; then + bash "$SUPER_DIR/.agent/scripts/graphify.sh" gitignore >/dev/null 2>&1 || true + fi [ -n "$CONV_ID" ] && touch "$LOCK_FILE" 2>/dev/null || true if [ "$IS_PIPE" -eq 1 ] && [ -n "$INPUT_JSON" ]; then echo '{"injectSteps":[{"ephemeralMessage":"ℹ️ Submódulo .agent sincronizado com sucesso na branch master (git submodule update --init --recursive --remote)."}]}'