vue-componentes/.agent/atualizar-agente.global.sh

77 lines
No EOL
4.2 KiB
Bash
Executable file

#!/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/rules/carta-principios-agente-azteca.global.md" "$DIR/rules/carta-principios-agente-azteca.global.md"
baixar "$BASE/rules/escrita-natural.global.md" "$DIR/rules/escrita-natural.global.md"
baixar "$BASE/rules/typescript-sem-any.global.md" "$DIR/rules/typescript-sem-any.global.md"
baixar "$BASE/rules/regras-negocio-md.global.md" "$DIR/rules/regras-negocio-md.global.md"
baixar "$BASE/rules/zod-validacao-padrao.global.md" "$DIR/rules/zod-validacao-padrao.global.md"
baixar "$BASE/rules/limite-linhas.global.md" "$DIR/rules/limite-linhas.global.md"
baixar "$BASE/rules/estrutura-vue.global.md" "$DIR/rules/estrutura-vue.global.md"
baixar "$BASE/rules/jsdoc-padrao.global.md" "$DIR/rules/jsdoc-padrao.global.md"
baixar "$BASE/rules/autonomia-agente.global.md" "$DIR/rules/autonomia-agente.global.md"
baixar "$BASE/rules/fronteiras-monorepo.global.md" "$DIR/rules/fronteiras-monorepo.global.md"
baixar "$BASE/rules/mensagens-usuario.global.md" "$DIR/rules/mensagens-usuario.global.md"
# workflows
baixar "$BASE/workflows/aprimorar-IA.global.md" "$DIR/workflows/aprimorar-IA.global.md"
baixar "$BASE/workflows/adicionar-ajuda.global.md" "$DIR/workflows/adicionar-ajuda.global.md"
baixar "$BASE/workflows/atualizar-agente.global.md" "$DIR/workflows/atualizar-agente.global.md"
baixar "$BASE/workflows/criar-fluxograma.global.md" "$DIR/workflows/criar-fluxograma.global.md"
baixar "$BASE/workflows/otimizar-codigos.global.md" "$DIR/workflows/otimizar-codigos.global.md"
baixar "$BASE/workflows/comercial.global.md" "$DIR/workflows/comercial.global.md"
baixar "$BASE/workflows/marketing.global.md" "$DIR/workflows/marketing.global.md"
baixar "$BASE/workflows/orcamento.global.md" "$DIR/workflows/orcamento.global.md"
baixar "$BASE/workflows/reels.global.md" "$DIR/workflows/reels.global.md"
baixar "$BASE/workflows/documentar-regras-negocio.global.md" "$DIR/workflows/documentar-regras-negocio.global.md"
baixar "$BASE/workflows/ux.global.md" "$DIR/workflows/ux.global.md"
# skills
baixar "$BASE/skills/mapear-codigo-fonte.global/SKILL.md" "$DIR/skills/mapear-codigo-fonte.global/SKILL.md"
baixar "$BASE/skills/diagnosticar-erros-build.global/SKILL.md" "$DIR/skills/diagnosticar-erros-build.global/SKILL.md"
baixar "$BASE/skills/documentar-decisao-tecnica.global/SKILL.md" "$DIR/skills/documentar-decisao-tecnica.global/SKILL.md"
baixar "$BASE/skills/documentar-regras-negocio.global/SKILL.md" "$DIR/skills/documentar-regras-negocio.global/SKILL.md"
baixar "$BASE/skills/criar-schema-zod.global/SKILL.md" "$DIR/skills/criar-schema-zod.global/SKILL.md"
baixar "$BASE/skills/documentar-dominio-modulo.global/SKILL.md" "$DIR/skills/documentar-dominio-modulo.global/SKILL.md"
# raiz (.agent)
baixar "$BASE/tools.md" "$DIR/tools.md"
baixar "$BASE/verificar-linhas.sh" "$DIR/verificar-linhas.sh"
exit "$ERROS"