commit 2b10435643caa0003bef6b981693e1c5f16cc4f5 Author: Rodolpho Lopes Date: Tue May 26 15:11:41 2026 +0000 Initial commit — knowledge base migrada do dev local diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b8e4304 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +.DS_Store +*.swp +*.tmp +*.bak diff --git a/README.md b/README.md new file mode 100644 index 0000000..71fdd42 --- /dev/null +++ b/README.md @@ -0,0 +1,53 @@ +# Base de Conhecimento para Agentes de IA + +Esta base foi projetada para leitura eficiente por agentes e humanos. + +## Arquitetura recomendada +- `index.json`: catalogo central para busca semantica rapida por agente. +- `records/`: um registro por arquivo Markdown, com metadados em front matter YAML. +- `schemas/`: contrato JSON Schema para validar metadados e manter consistencia. + +## Por que esse formato e eficiente +- **JSON para roteamento**: agentes localizam o registro certo sem ler toda a base. +- **Markdown para contexto**: explica causa, impacto e procedimento com baixa ambiguidade. +- **Metadados padronizados**: permite filtro por `tags`, `severity`, `domain` e `status`. +- **Versionamento simples**: cada incidente vira um arquivo independente e auditavel no Git. + +## Convencao de registros +- ID: `KB--NNN` (ex.: `KB-INFRA-001`) +- Nome de arquivo: `-.md` +- Campos obrigatorios de metadados: + - `id` + - `title` + - `domain` + - `tags` + - `status` + - `severity` + - `created_at` + - `updated_at` + - `applies_to` + +## Fluxo de atualizacao +1. Criar novo registro em `records//`. +2. Atualizar `index.json` com resumo e caminho. +3. Validar aderencia ao schema em `schemas/`. +4. Referenciar o registro em documentacao operacional quando necessario. + +## Validacao automatica +Use: + +```bash +make kb-check +make kb-fix +``` + +A verificacao valida: +- metadados obrigatorios conforme schema; +- padrao de ID de registro; +- sincronizacao entre `index.json` e arquivos em `records/`. + +`make kb-fix` faz ajustes automaticos no `index.json`: +- inclui registros faltantes; +- remove entradas orfas; +- sincroniza campos principais; +- atualiza `last_updated`. diff --git a/index.json b/index.json new file mode 100644 index 0000000..fe69ec3 --- /dev/null +++ b/index.json @@ -0,0 +1,389 @@ +{ + "version": "1.0.0", + "last_updated": "2026-05-21", + "records": [ + { + "id": "KB-INFRA-001", + "title": "Caminho correto de plugins no container GLPI oficial", + "domain": "infrastructure", + "tags": [ + "glpi", + "docker", + "plugins", + "mount", + "orbstack" + ], + "status": "active", + "severity": "high", + "path": "records/infrastructure/KB-INFRA-001-glpi-plugin-path.md", + "summary": "id: KB-INFRA-001" + }, + { + "id": "KB-INFRA-002", + "title": "Icone de plugin GLPI 11 requer logo.png PNG na raiz do diretorio", + "domain": "infrastructure", + "tags": [ + "glpi", + "glpi11", + "plugin", + "icon", + "logo", + "marketplace" + ], + "status": "active", + "severity": "low", + "path": "records/infrastructure/KB-INFRA-002-plugin-icon-logo-png.md", + "summary": "id: KB-INFRA-002" + }, + { + "id": "KB-PLUGIN-001", + "title": "Instalacao de plugin GLPI requer callbacks install/uninstall", + "domain": "plugin-dev", + "tags": [ + "glpi", + "plugin", + "install", + "setup.php", + "hooks" + ], + "status": "active", + "severity": "high", + "path": "records/plugin-dev/KB-PLUGIN-001-install-hooks-required.md", + "summary": "id: KB-PLUGIN-001" + }, + { + "id": "KB-PLUGIN-002", + "title": "getCategory() deve ser sobrescrito em QuestionType de plugin GLPI 11", + "domain": "plugin-dev", + "tags": [ + "glpi", + "glpi11", + "form-builder", + "question-type", + "javascript", + "plugin" + ], + "status": "active", + "severity": "critical", + "path": "records/plugin-dev/KB-PLUGIN-002-questiontype-getcategory-override.md", + "summary": "id: KB-PLUGIN-002" + }, + { + "id": "KB-PLUGIN-003", + "title": "JSON em acidental +$json = json_encode($data, JSON_UNESCAPED_UNICODE | JSON_HEX_TAG | JSON_HEX_AMP); +``` + +# Por que JSON_HEX_TAG e JSON_HEX_AMP +- `JSON_HEX_TAG`: converte `<` → `<` e `>` → `>`, impedindo que `` apareça + literalmente e quebre o bloco script. Isso SIM é necessário para segurança. +- `JSON_HEX_AMP`: converte `&` → `&`, evita problemas em contextos XML/XHTML. +- `htmlspecialchars()` não deve ser usado — ele gera entidades HTML, não sequências JSON. + +# Validação padrão +1. Inspecionar o DOM e copiar o conteúdo do `