#!/bin/sh DIR="$(cd "$(dirname "$0")" && pwd)" BASE="https://paiol.idz.one/desenvolvimento/agent-ia" ERROS=0 baixar() { TMP=$(mktemp) echo "baixando $1" ERRO_CURL="$(curl -sSfL --create-dirs "$1" -o "$TMP" 2>&1)" || { echo " ⚠ $1" echo " $ERRO_CURL" rm -f "$TMP" ERROS=$((ERROS + 1)) return 1 } # Rejeitar arquivos menores que 50 bytes (prováveis erros de proxy/WAF) TAMANHO=$(wc -c < "$TMP" | tr -d ' ') if [ "$TAMANHO" -lt 50 ]; then echo " ⚠ $1 — arquivo muito pequeno ($TAMANHO bytes), ignorado" rm -f "$TMP" ERROS=$((ERROS + 1)) return 1 fi mkdir -p "$(dirname "$2")" mv "$TMP" "$2" } # ignorar se não auto atualizar if [ "$NAO_AUTO_ATUALIZAR" != "1" ]; then # atualizar-agente.global.sh if baixar "$BASE/atualizar-agente.global.sh" "$DIR/atualizar-agente.global.sh"; then NAO_AUTO_ATUALIZAR=1 sh "$DIR/atualizar-agente.global.sh" exit "$ERROS" fi fi # rules baixar "$BASE/global/rules/carta-principios-agente-azteca" "$DIR/rules/carta-principios-agente-azteca" baixar "$BASE/global/rules/escrita-natural" "$DIR/rules/escrita-natural" baixar "$BASE/global/rules/typescript-sem-any" "$DIR/rules/typescript-sem-any" baixar "$BASE/global/rules/regras-negocio-md" "$DIR/rules/regras-negocio-md" baixar "$BASE/global/rules/zod-validacao-padrao" "$DIR/rules/zod-validacao-padrao" baixar "$BASE/global/rules/limite-linhas" "$DIR/rules/limite-linhas" baixar "$BASE/global/rules/jsdoc-padrao" "$DIR/rules/jsdoc-padrao" baixar "$BASE/global/rules/autonomia-agente" "$DIR/rules/autonomia-agente" baixar "$BASE/global/rules/fronteiras-monorepo" "$DIR/rules/fronteiras-monorepo" baixar "$BASE/global/rules/mensagens-usuario" "$DIR/rules/mensagens-usuario" baixar "$BASE/global/rules/feedback-visivel" "$DIR/rules/feedback-visivel" # workflows baixar "$BASE/global/workflows/aprimorar-IA" "$DIR/workflows/aprimorar-IA" baixar "$BASE/global/workflows/otimizar-codigos" "$DIR/workflows/otimizar-codigos" baixar "$BASE/global/workflows/documentar-regras-negocio" "$DIR/workflows/documentar-regras-negocio" baixar "$BASE/global/workflows/ux" "$DIR/workflows/ux" # skills baixar "$BASE/global/skills/mapear-codigo-fonte/SKILL" "$DIR/skills/mapear-codigo-fonte/SKILL" baixar "$BASE/global/skills/diagnosticar-erros-build/SKILL" "$DIR/skills/diagnosticar-erros-build/SKILL" baixar "$BASE/global/skills/documentar-decisao-tecnica/SKILL" "$DIR/skills/documentar-decisao-tecnica/SKILL" baixar "$BASE/global/skills/documentar-regras-negocio/SKILL" "$DIR/skills/documentar-regras-negocio/SKILL" baixar "$BASE/global/skills/criar-schema-zod/SKILL" "$DIR/skills/criar-schema-zod/SKILL" baixar "$BASE/global/skills/documentar-dominio-modulo/SKILL" "$DIR/skills/documentar-dominio-modulo/SKILL" baixar "$BASE/global/skills/orquestrar-agentes/SKILL" "$DIR/skills/orquestrar-agentes/SKILL" # raiz baixar "$BASE/TOOLS" "$DIR/TOOLS" baixar "$BASE/verificar-linhas.sh" "$DIR/verificar-linhas.sh" exit "$ERROS"