Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Não é melhor excluir só o MEMORY.md?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

acho que está certo. Esse é o claude do projeto todo, o do nosso projeto ele ignora

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Então... Ele não deveria ignorar. Deveria?!

Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ openapitools.json
.DS_Store

.vscode/settings.json
.claude/
/.claude/
112 changes: 112 additions & 0 deletions frontend/.claude/project-knowledge/form-creation.md
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deveria ser uma SKILL

Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
## Formulários

### Schema Yup

- Schemas ficam em `src/consts/formSchemas/<entidade>.ts`
- Importar primitivos de `./initSchema` (não direto do `yup`):
```ts
import {
object,
string,
number,
array,
boolean,
date,
mixed,
} from "./initSchema";
```
- Sempre usar `.label('Nome do Campo')` em cada campo — o `SmaeLabel` extrai isso automaticamente
- Campos opcionais: `.nullable()` ou `.nullableOuVazio()`
- Campos condicionais: `.when('outro_campo', { is: ..., then: ..., otherwise: ... })`
- Exportar como named export: `export const minhaEntidadeSchema = object().shape({ ... })`
- Schemas em `formSchemas/` separados **não** precisam ser registrados em `formSchemas.js` — são importados diretamente na view
Comment on lines +5 to +22
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot Mar 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check if schemas are centralized in formSchemas.js or distributed in separate files

echo "=== Schemas exported from formSchemas.js ==="
rg -n "^export const \w+ = " frontend/src/consts/formSchemas.js | head -20

echo ""
echo "=== Separate schema files in formSchemas/ directory ==="
fd -e ts -e js . frontend/src/consts/formSchemas/

echo ""
echo "=== How views import schemas ==="
rg -n "from ['\"]@/consts/formSchemas" frontend/src/views/ -A 0 | head -20

Repository: AppCivico/smae

Length of output: 4494


🏁 Script executed:

#!/bin/bash
# Check if separate schema files are imported anywhere in the codebase

echo "=== Searching for imports of separate schema files ==="
rg "from ['\"].*formSchemas/(buscaLivre|demanda|metasLista|tarefa|InformarPreviaIndicador)" --type ts --type tsx --type js --type vue -A 0

echo ""
echo "=== Check if formSchemas.js imports from separate schema files ==="
rg "from ['\"].*formSchemas/(buscaLivre|demanda|metasLista|tarefa)" frontend/src/consts/formSchemas.js

echo ""
echo "=== Content of one separate schema file for context ==="
head -30 frontend/src/consts/formSchemas/demanda.ts

Repository: AppCivico/smae

Length of output: 1188


🏁 Script executed:

#!/bin/bash
# Check full formSchemas.js for any imports or references to separate files

echo "=== Check full formSchemas.js imports section ==="
head -100 frontend/src/consts/formSchemas.js | grep -E "^import|^export"

echo ""
echo "=== Line count of formSchemas.js ==="
wc -l frontend/src/consts/formSchemas.js

echo ""
echo "=== Check if formSchemas/ files are mentioned anywhere in formSchemas.js ==="
rg "formSchemas/(buscaLivre|demanda|metasLista|tarefa|InformarPreviaIndicador)" frontend/src/consts/formSchemas.js

Repository: AppCivico/smae

Length of output: 1838


🏁 Script executed:

#!/bin/bash
# Check if separate schema files have recent changes or are intentionally separated

echo "=== Check git status of separate schema files ==="
git log -1 --oneline frontend/src/consts/formSchemas/demanda.ts frontend/src/consts/formSchemas/tarefa.ts frontend/src/consts/formSchemas/metasLista.ts 2>/dev/null | head -10

echo ""
echo "=== Check if there are any TODOs or comments in demanda.ts about usage ==="
head -5 frontend/src/consts/formSchemas/demanda.ts

Repository: AppCivico/smae

Length of output: 424


Documentation contradicts actual schema registration practice—remove misleading guidance.

The documentation at line 21–22 states that schemas in separate formSchemas/<entity>.ts files do not need to be registered in formSchemas.js and can be imported directly in views. However, verification shows:

  1. Those separate schema files (demanda.ts, tarefa.ts, metasLista.ts, buscaLivre.ts, InformarPreviaIndicador.schema.ts) exist but are never imported or used anywhere in the codebase.
  2. All views import schemas exclusively from the centralized @/consts/formSchemas barrel file.
  3. formSchemas.js does not reference or import from those separate files.

Remove the incorrect claim on line 21–22. The actual pattern requires all schemas to be defined in and exported from formSchemas.js. If the separate schema files serve a legitimate purpose, document that separately; otherwise, clarify that the only supported pattern is the centralized barrel approach.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~21-~21: Se é uma abreviatura, falta um ponto. Se for uma expressão, coloque entre aspas.
Context: ...therwise: ... })- Exportar como named export:export const minhaEntidadeSchema = ob...

(ABREVIATIONS_PUNCTUATION)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@frontend/.claude/project-knowledge/form-creation.md` around lines 5 - 22,
Remove the misleading claim that "Schemas em formSchemas/ separados não precisam
ser registrados em formSchemas.js" and update the documentation to state the
actual, enforced pattern: all schemas must be exported from and imported via the
centralized barrel (`@/consts/formSchemas` / formSchemas.js); reference the
existing standalone files (e.g., demanda.ts, tarefa.ts, metasLista.ts,
buscaLivre.ts, InformarPreviaIndicador.schema.ts) as either deprecated/unused or
document an alternative maintenance step (move or re-export them from
formSchemas.js) so readers know to register schemas in formSchemas.js and import
from the barrel.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Veja essa, @GustavoFSoares .

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these files are been using.
One example is frontend/src/views/demandas/DemandasCriarEditar.vue:21, when CadastroDemandaSchema is been imported and used correctly


### Componente CriarEditar.vue

Local: `src/views/<modulo>/<Entidade>CriarEditar.vue`

**Padrão com `useForm`** — formulários complexos (arrays dinâmicos, watches, valores computados):

```vue
<script lang="ts" setup>
import { storeToRefs } from "pinia";
import {
ErrorMessage,
Field,
FieldArray,
useForm,
useIsFormDirty,
} from "vee-validate";
import { onMounted, watch } from "vue";
import { useRouter } from "vue-router";

import { minhaEntidadeSchema as schema } from "@/consts/formSchemas/minhaEntidade";
import escaparDaRota from "@/helpers/escaparDaRota";
import { useMinhaEntidadeStore } from "@/stores/minhaEntidade.store";

const router = useRouter();

const props = defineProps<{ minhaEntidadeId?: number | null }>();
const minhaEntidadeStore = useMinhaEntidadeStore();
const { emFoco } = storeToRefs(minhaEntidadeStore);

const { errors, handleSubmit, isSubmitting, resetForm } = useForm({
initialValues: emFoco,
validationSchema: schema,
});

const formularioSujo = useIsFormDirty();

const onSubmit = handleSubmit.withControlled(async (carga) => {
await minhaEntidadeStore.salvarItem(carga, props.minhaEntidadeId);

minhaEntidadeStore.$reset();
escaparDaRota(router);
});

onMounted(() => {
if (props.minhaEntidadeId)
minhaEntidadeStore.buscarItem(props.minhaEntidadeId);
});

watch(emFoco, (novosValores) => {
resetForm({ values: novosValores });
});
</script>

<template>
<CabecalhoDePagina :formulario-sujo="formularioSujo" />

<form class="flex column g2" @submit="onSubmit">
<!-- campos aqui -->

<SmaeFieldsetSubmit :disabled="isSubmitting" :erros="errors" />
</form>
</template>
```

> **Atenção:** O padrão com `<Form>` wrapper do vee-validate **não deve ser usado** neste projeto. Sempre use o padrão com `useForm` acima, independentemente da complexidade do formulário.
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot Mar 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Search for any existing usage of vee-validate <Form> wrapper in the codebase

echo "=== Searching for <Form> component from vee-validate ==="
rg -n '<Form' frontend/src/views/ -A 2 -B 1

echo ""
echo "=== Searching for Form imports from vee-validate ==="
rg -n "import.*Form.*from ['\"]vee-validate['\"]" frontend/src/

Repository: AppCivico/smae

Length of output: 50370


Update documentation: <Form> wrapper is actually used extensively in the codebase.

The documentation states that the <Form> wrapper from vee-validate "must not be used," but the codebase contains numerous active usages across many view files (NovoOrcamentarioPortfolio.vue, NovoRelatorioDePortfolio.vue, NovoSemestralOuAnual.vue, and 70+ others). The prohibition does not match actual project practice.

Update the documentation to reflect when each pattern (<Form> wrapper vs. useForm composition) is appropriate for the project, rather than stating a blanket prohibition.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@frontend/.claude/project-knowledge/form-creation.md` at line 88, Replace the
absolute prohibition of the vee-validate <Form> wrapper with prescriptive
guidance describing when to use <Form> vs the composition API useForm: identify
that both patterns are valid, explain pros/cons and recommended use cases (e.g.,
simple template-driven forms or view-level forms -> <Form>; complex programmatic
validation, reusable form logic or composables -> useForm), reference the
existing usages (examples: NovoOrcamentarioPortfolio.vue,
NovoRelatorioDePortfolio.vue, NovoSemestralOuAnual.vue) as canonical cases, and
update the sentence at the current location to provide these rules of thumb and
migration notes instead of a blanket "must not be used" rule.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bom ponto. Você pode deixar claro que o uso de <Form> é obsoleto no projeto, que se deve migrar quando possível.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@robsonsobral, entendido! Vou atualizar a nota para deixar claro que o <Form> wrapper é obsoleto no projeto e que a migração para useForm deve ser feita quando possível.

  • Atualizar a nota de aviso no final de frontend/.claude/project-knowledge/form-creation.md para indicar que <Form> é obsoleto e que novas telas devem usar useForm, e que telas existentes devem migrar quando possível.

✏️ Learnings added
Learnt from: robsonsobral
Repo: AppCivico/smae PR: 613
File: frontend/.claude/project-knowledge/form-creation.md:88-88
Timestamp: 2026-03-20T19:31:51.467Z
Learning: No projeto SMAE (AppCivico/smae), o uso do componente `<Form>` wrapper do vee-validate é considerado obsoleto. Todo código novo de formulário deve usar o padrão de composição com `useForm` (de `vee-validate`). Telas existentes que ainda utilizam `<Form>` devem ser migradas para `useForm` quando possível. Isso está documentado em `frontend/.claude/project-knowledge/form-creation.md`.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.


🧠 Learnings used
Learnt from: Eduruiz
Repo: AppCivico/smae PR: 343
File: frontend/src/components/transferencia/VaralDeEtapas.vue:86-89
Timestamp: 2025-06-10T16:15:44.557Z
Learning: In this Vue.js project, several components are globally registered using app.component() and don't require explicit imports in Vue components. The globally registered components include: CheckClose, ErrorComponent, FormErrorsList, SmaeFieldsetSubmit, LabelFromYup, SmaeLabel, LoadingComponent, MigalhasDePão, MigalhasDePao, SmaeLink, SmaeText, TítuloDePágina, TituloDePagina, TituloDaPagina, and CabecalhoDePagina.

Learnt from: robsonsobral
Repo: AppCivico/smae PR: 348
File: frontend/src/components/FiltroParaPagina.vue:262-271
Timestamp: 2025-06-11T00:40:44.522Z
Learning: No projeto SMAE, em formulários como `FiltroParaPagina.vue`, o botão de submissão permanece habilitado mesmo quando há erros de validação. A prevenção do envio é feita dentro do handler de `submit`, permitindo ao usuário focar o botão e ler as mensagens de erro; portanto não se aplica o atributo `disabled`, apenas `aria-*`.

Learnt from: robsonsobral
Repo: AppCivico/smae PR: 472
File: frontend/src/components/monitoramentoDeMetas/DetalhamentoDeCiclo.vue:305-333
Timestamp: 2025-12-04T19:31:36.635Z
Learning: No projeto SMAE, existe um capturador de erros no elemento raiz da aplicação que lida com erros lançados pelos componentes, incluindo feedback visual ao usuário. Portanto, não é necessário adicionar tratamento de erro específico em cada função que lança erros - o `throw` no catch block é suficiente para que o erro seja capturado e tratado globalmente.

Learnt from: CR
Repo: AppCivico/smae PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-03-03T12:14:22.453Z
Learning: Applies to backend/**/*.{ts,tsx} : Follow the backend NestJS development patterns documented in backend/PATTERNS.md, including Prisma schema patterns (audit fields, shared relationships), NestJS module structure, service and controller patterns, privilege system, migration workflow, and complete CRUD checklist

  • 📌 Commit the changes to this branch


### Componentes de campo (globais)

| Componente | Uso |
| ----------------------------------------------------------------- | ------------------------------------------ |
| `<SmaeLabel name="campo" :schema="schema" />` | Label com asterisco automático se required |
| `<Field name="campo" type="text" class="inputtext light" />` | Input de texto padrão |
| `<Field name="campo" as="select" class="inputtext light">` | Select |
| `<ErrorMessage name="campo" class="error-msg" />` | Mensagem de erro inline |
| `<SmaeText name="campo" :schema="schema" />` | Textarea/input com contador de caracteres |
| `<SmaeDateInput name="campo" />` | Datepicker |
| `<SmaeNumberInput name="campo" />` | Input numérico |
| `<AutocompleteField2 name="campo" :grupo="lista" label="nome" />` | Autocomplete multi-select |
| `<FieldArray name="array" v-slot="{ fields, push, remove }">` | Array dinâmico de campos |
| `<FormErrorsList :errors="errors" />` | Lista todos os erros do formulário |
| `<SmaeFieldsetSubmit :disabled="isSubmitting" />` | Botão salvar padronizado |
| `<CabecalhoDePagina :formulario-sujo="formularioSujo" />` | Cabeçalho com botão de fechar |

### Classes CSS utilitárias

- `flex g2` — flex com gap
- `f1` — flex: 1 (ocupa espaço disponível)
- `inputtext light` — estilo padrão de input
- `error-msg` — estilo de mensagem de erro
Loading