@seedgrid/ai-toolkit 0.0.0-stage → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (225) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +151 -2
  3. package/dist/adapters/claude.js +114 -0
  4. package/dist/adapters/codex.js +108 -0
  5. package/dist/adapters/index.js +17 -0
  6. package/dist/adapters/shared.js +142 -0
  7. package/dist/adapters/types.js +1 -0
  8. package/dist/cli.js +203 -0
  9. package/dist/commands/common.js +98 -0
  10. package/dist/commands/doctor.js +290 -0
  11. package/dist/commands/init.js +9 -0
  12. package/dist/commands/install.js +107 -0
  13. package/dist/commands/remove.js +54 -0
  14. package/dist/commands/review.js +127 -0
  15. package/dist/commands/status.js +73 -0
  16. package/dist/commands/update.js +8 -0
  17. package/dist/commands/validate.js +27 -0
  18. package/dist/core/apply.js +181 -0
  19. package/dist/core/blocks.js +64 -0
  20. package/dist/core/content.js +528 -0
  21. package/dist/core/env.js +40 -0
  22. package/dist/core/frontmatter.js +29 -0
  23. package/dist/core/hash.js +14 -0
  24. package/dist/core/inspect.js +51 -0
  25. package/dist/core/lock.js +124 -0
  26. package/dist/core/paths.js +65 -0
  27. package/dist/core/plan.js +242 -0
  28. package/dist/core/tools.js +62 -0
  29. package/dist/core/types.js +11 -0
  30. package/dist/core/updates.js +121 -0
  31. package/docs/arquitetura.md +80 -0
  32. package/docs/compatibilidade.md +50 -0
  33. package/docs/formato.md +155 -0
  34. package/docs/instalacao.md +105 -0
  35. package/docs/manutencao.md +115 -0
  36. package/package.json +43 -4
  37. package/seedgridKB/SeedGrid/Extensions/Catalogo-de-enums.md +161 -0
  38. package/seedgridKB/SeedGrid/Extensions/Catalogo-de-propriedades.md +971 -0
  39. package/seedgridKB/SeedGrid/Extensions/Indice.md +63 -0
  40. package/seedgridKB/SeedGrid/Extensions/ai-pricing/Configuracao.md +124 -0
  41. package/seedgridKB/SeedGrid/Extensions/ai-pricing/Enums.md +40 -0
  42. package/seedgridKB/SeedGrid/Extensions/ai-pricing/Exemplos.md +97 -0
  43. package/seedgridKB/SeedGrid/Extensions/ai-pricing/Visao-geral.md +114 -0
  44. package/seedgridKB/SeedGrid/Extensions/apikeys/Configuracao-Rust.md +69 -0
  45. package/seedgridKB/SeedGrid/Extensions/apikeys/Configuracao.md +88 -0
  46. package/seedgridKB/SeedGrid/Extensions/apikeys/Enums.md +33 -0
  47. package/seedgridKB/SeedGrid/Extensions/apikeys/Exemplos.md +121 -0
  48. package/seedgridKB/SeedGrid/Extensions/apikeys/Rust.md +126 -0
  49. package/seedgridKB/SeedGrid/Extensions/apikeys/Visao-geral.md +111 -0
  50. package/seedgridKB/SeedGrid/Extensions/audit/Configuracao-Rust.md +93 -0
  51. package/seedgridKB/SeedGrid/Extensions/audit/Configuracao.md +127 -0
  52. package/seedgridKB/SeedGrid/Extensions/audit/Enums.md +66 -0
  53. package/seedgridKB/SeedGrid/Extensions/audit/Exemplos.md +151 -0
  54. package/seedgridKB/SeedGrid/Extensions/audit/Rust.md +120 -0
  55. package/seedgridKB/SeedGrid/Extensions/audit/Visao-geral.md +114 -0
  56. package/seedgridKB/SeedGrid/Extensions/backup/Configuracao-Rust.md +136 -0
  57. package/seedgridKB/SeedGrid/Extensions/backup/Configuracao.md +319 -0
  58. package/seedgridKB/SeedGrid/Extensions/backup/Enums.md +131 -0
  59. package/seedgridKB/SeedGrid/Extensions/backup/Exemplos.md +210 -0
  60. package/seedgridKB/SeedGrid/Extensions/backup/Rust.md +135 -0
  61. package/seedgridKB/SeedGrid/Extensions/backup/Visao-geral.md +150 -0
  62. package/seedgridKB/SeedGrid/Extensions/billing/Configuracao-Rust.md +86 -0
  63. package/seedgridKB/SeedGrid/Extensions/billing/Configuracao.md +243 -0
  64. package/seedgridKB/SeedGrid/Extensions/billing/Enums.md +165 -0
  65. package/seedgridKB/SeedGrid/Extensions/billing/Exemplos.md +205 -0
  66. package/seedgridKB/SeedGrid/Extensions/billing/Rust.md +109 -0
  67. package/seedgridKB/SeedGrid/Extensions/billing/Visao-geral.md +181 -0
  68. package/seedgridKB/SeedGrid/Extensions/broker/Configuracao-Rust.md +40 -0
  69. package/seedgridKB/SeedGrid/Extensions/broker/Visao-geral.md +114 -0
  70. package/seedgridKB/SeedGrid/Extensions/cache/Configuracao-Rust.md +73 -0
  71. package/seedgridKB/SeedGrid/Extensions/cache/Configuracao.md +112 -0
  72. package/seedgridKB/SeedGrid/Extensions/cache/Enums.md +36 -0
  73. package/seedgridKB/SeedGrid/Extensions/cache/Exemplos.md +149 -0
  74. package/seedgridKB/SeedGrid/Extensions/cache/Rust.md +81 -0
  75. package/seedgridKB/SeedGrid/Extensions/cache/Visao-geral.md +90 -0
  76. package/seedgridKB/SeedGrid/Extensions/commons/Configuracao.md +107 -0
  77. package/seedgridKB/SeedGrid/Extensions/commons/Enums.md +105 -0
  78. package/seedgridKB/SeedGrid/Extensions/commons/Exemplos.md +141 -0
  79. package/seedgridKB/SeedGrid/Extensions/commons/Visao-geral.md +99 -0
  80. package/seedgridKB/SeedGrid/Extensions/exchange/Configuracao.md +122 -0
  81. package/seedgridKB/SeedGrid/Extensions/exchange/Enums.md +29 -0
  82. package/seedgridKB/SeedGrid/Extensions/exchange/Exemplos.md +82 -0
  83. package/seedgridKB/SeedGrid/Extensions/exchange/Visao-geral.md +118 -0
  84. package/seedgridKB/SeedGrid/Extensions/filemanagement/Configuracao-Rust.md +110 -0
  85. package/seedgridKB/SeedGrid/Extensions/filemanagement/Configuracao.md +157 -0
  86. package/seedgridKB/SeedGrid/Extensions/filemanagement/Exemplos.md +157 -0
  87. package/seedgridKB/SeedGrid/Extensions/filemanagement/Rust.md +70 -0
  88. package/seedgridKB/SeedGrid/Extensions/filemanagement/Visao-geral.md +88 -0
  89. package/seedgridKB/SeedGrid/Extensions/login-tenancy/Configuracao-Rust.md +124 -0
  90. package/seedgridKB/SeedGrid/Extensions/login-tenancy/Configuracao.md +195 -0
  91. package/seedgridKB/SeedGrid/Extensions/login-tenancy/Enums.md +71 -0
  92. package/seedgridKB/SeedGrid/Extensions/login-tenancy/Exemplos.md +149 -0
  93. package/seedgridKB/SeedGrid/Extensions/login-tenancy/Rust.md +139 -0
  94. package/seedgridKB/SeedGrid/Extensions/login-tenancy/Visao-geral.md +130 -0
  95. package/seedgridKB/SeedGrid/Extensions/notification/Configuracao.md +141 -0
  96. package/seedgridKB/SeedGrid/Extensions/notification/Enums.md +52 -0
  97. package/seedgridKB/SeedGrid/Extensions/notification/Exemplos.md +141 -0
  98. package/seedgridKB/SeedGrid/Extensions/notification/Visao-geral.md +113 -0
  99. package/seedgridKB/SeedGrid/Extensions/privacy/Configuracao-Rust.md +67 -0
  100. package/seedgridKB/SeedGrid/Extensions/privacy/Configuracao.md +94 -0
  101. package/seedgridKB/SeedGrid/Extensions/privacy/Enums.md +79 -0
  102. package/seedgridKB/SeedGrid/Extensions/privacy/Exemplos.md +172 -0
  103. package/seedgridKB/SeedGrid/Extensions/privacy/Rust.md +107 -0
  104. package/seedgridKB/SeedGrid/Extensions/privacy/Visao-geral.md +90 -0
  105. package/seedgridKB/SeedGrid/Extensions/realtime/Configuracao-Rust.md +72 -0
  106. package/seedgridKB/SeedGrid/Extensions/realtime/Configuracao.md +104 -0
  107. package/seedgridKB/SeedGrid/Extensions/realtime/Exemplos.md +104 -0
  108. package/seedgridKB/SeedGrid/Extensions/realtime/Rust.md +69 -0
  109. package/seedgridKB/SeedGrid/Extensions/realtime/Visao-geral.md +105 -0
  110. package/seedgridKB/SeedGrid/Extensions/resilience/Configuracao-Rust.md +68 -0
  111. package/seedgridKB/SeedGrid/Extensions/resilience/Configuracao.md +186 -0
  112. package/seedgridKB/SeedGrid/Extensions/resilience/Enums.md +96 -0
  113. package/seedgridKB/SeedGrid/Extensions/resilience/Exemplos.md +229 -0
  114. package/seedgridKB/SeedGrid/Extensions/resilience/Rust.md +80 -0
  115. package/seedgridKB/SeedGrid/Extensions/resilience/Visao-geral.md +112 -0
  116. package/seedgridKB/SeedGrid/Extensions/runtime/Configuracao-Rust.md +90 -0
  117. package/seedgridKB/SeedGrid/Extensions/runtime/Visao-geral.md +114 -0
  118. package/seedgridKB/SeedGrid/Extensions/security/Configuracao-Rust.md +327 -0
  119. package/seedgridKB/SeedGrid/Extensions/security/Configuracao.md +510 -0
  120. package/seedgridKB/SeedGrid/Extensions/security/Enums.md +95 -0
  121. package/seedgridKB/SeedGrid/Extensions/security/Exemplos.md +218 -0
  122. package/seedgridKB/SeedGrid/Extensions/security/Rust.md +203 -0
  123. package/seedgridKB/SeedGrid/Extensions/security/Visao-geral.md +131 -0
  124. package/seedgridKB/SeedGrid/Extensions/subdomain-tenancy/Configuracao-Rust.md +188 -0
  125. package/seedgridKB/SeedGrid/Extensions/subdomain-tenancy/Configuracao.md +345 -0
  126. package/seedgridKB/SeedGrid/Extensions/subdomain-tenancy/Enums.md +117 -0
  127. package/seedgridKB/SeedGrid/Extensions/subdomain-tenancy/Exemplos.md +205 -0
  128. package/seedgridKB/SeedGrid/Extensions/subdomain-tenancy/Rust.md +161 -0
  129. package/seedgridKB/SeedGrid/Extensions/subdomain-tenancy/Visao-geral.md +142 -0
  130. package/seedgridKB/SeedGrid/Extensions/whatsapp/Configuracao-Rust.md +75 -0
  131. package/seedgridKB/SeedGrid/Extensions/whatsapp/Configuracao.md +152 -0
  132. package/seedgridKB/SeedGrid/Extensions/whatsapp/Enums.md +198 -0
  133. package/seedgridKB/SeedGrid/Extensions/whatsapp/Exemplos.md +173 -0
  134. package/seedgridKB/SeedGrid/Extensions/whatsapp/Rust.md +83 -0
  135. package/seedgridKB/SeedGrid/Extensions/whatsapp/Visao-geral.md +99 -0
  136. package/seedgridKB/SeedGrid/Mapa-dos-repositorios.md +112 -0
  137. package/seedgridKB/SeedGrid/SeedGrid-components/Indice.md +323 -0
  138. package/seedgridKB/SeedGrid/SeedGrid-components/buttons/API.md +257 -0
  139. package/seedgridKB/SeedGrid/SeedGrid-components/buttons/Exemplos.md +307 -0
  140. package/seedgridKB/SeedGrid/SeedGrid-components/buttons/Visao-geral.md +51 -0
  141. package/seedgridKB/SeedGrid/SeedGrid-components/datatable/API.md +174 -0
  142. package/seedgridKB/SeedGrid/SeedGrid-components/datatable/Exemplos.md +236 -0
  143. package/seedgridKB/SeedGrid/SeedGrid-components/datatable/Visao-geral.md +76 -0
  144. package/seedgridKB/SeedGrid/SeedGrid-components/digits/API.md +339 -0
  145. package/seedgridKB/SeedGrid/SeedGrid-components/digits/Exemplos.md +311 -0
  146. package/seedgridKB/SeedGrid/SeedGrid-components/digits/Visao-geral.md +57 -0
  147. package/seedgridKB/SeedGrid/SeedGrid-components/editor/API.md +125 -0
  148. package/seedgridKB/SeedGrid/SeedGrid-components/editor/Exemplos.md +116 -0
  149. package/seedgridKB/SeedGrid/SeedGrid-components/editor/Visao-geral.md +86 -0
  150. package/seedgridKB/SeedGrid/SeedGrid-components/feedback-e-exibicao/API.md +490 -0
  151. package/seedgridKB/SeedGrid/SeedGrid-components/feedback-e-exibicao/Exemplos.md +544 -0
  152. package/seedgridKB/SeedGrid/SeedGrid-components/feedback-e-exibicao/Visao-geral.md +69 -0
  153. package/seedgridKB/SeedGrid/SeedGrid-components/fundamentos/API.md +113 -0
  154. package/seedgridKB/SeedGrid/SeedGrid-components/fundamentos/Exemplos.md +159 -0
  155. package/seedgridKB/SeedGrid/SeedGrid-components/fundamentos/Visao-geral.md +92 -0
  156. package/seedgridKB/SeedGrid/SeedGrid-components/gadgets/API.md +516 -0
  157. package/seedgridKB/SeedGrid/SeedGrid-components/gadgets/Exemplos.md +629 -0
  158. package/seedgridKB/SeedGrid/SeedGrid-components/gadgets/Visao-geral.md +80 -0
  159. package/seedgridKB/SeedGrid/SeedGrid-components/inputs-selecao/API.md +615 -0
  160. package/seedgridKB/SeedGrid/SeedGrid-components/inputs-selecao/Exemplos.md +384 -0
  161. package/seedgridKB/SeedGrid/SeedGrid-components/inputs-selecao/Visao-geral.md +111 -0
  162. package/seedgridKB/SeedGrid/SeedGrid-components/inputs-texto/API.md +661 -0
  163. package/seedgridKB/SeedGrid/SeedGrid-components/inputs-texto/Exemplos.md +312 -0
  164. package/seedgridKB/SeedGrid/SeedGrid-components/inputs-texto/Visao-geral.md +123 -0
  165. package/seedgridKB/SeedGrid/SeedGrid-components/layout/API.md +1090 -0
  166. package/seedgridKB/SeedGrid/SeedGrid-components/layout/Exemplos.md +1172 -0
  167. package/seedgridKB/SeedGrid/SeedGrid-components/layout/Visao-geral.md +98 -0
  168. package/seedgridKB/SeedGrid/SeedGrid-components/modulos/Visao-geral.md +98 -0
  169. package/seedgridKB/SeedGrid/SeedGrid-components/modulos/fe-apikeys.md +118 -0
  170. package/seedgridKB/SeedGrid/SeedGrid-components/modulos/fe-audit.md +88 -0
  171. package/seedgridKB/SeedGrid/SeedGrid-components/modulos/fe-backup.md +131 -0
  172. package/seedgridKB/SeedGrid/SeedGrid-components/modulos/fe-billing-platform.md +132 -0
  173. package/seedgridKB/SeedGrid/SeedGrid-components/modulos/fe-billing-user.md +120 -0
  174. package/seedgridKB/SeedGrid/SeedGrid-components/modulos/fe-login-tenancy.md +119 -0
  175. package/seedgridKB/SeedGrid/SeedGrid-components/modulos/fe-security.md +427 -0
  176. package/seedgridKB/SeedGrid/SeedGrid-components/modulos/fe-self-enter.md +104 -0
  177. package/seedgridKB/SeedGrid/SeedGrid-components/modulos/fe-subdomain-tenancy.md +110 -0
  178. package/seedgridKB/SeedGrid/SeedGrid-components/navegacao-e-overlay/API.md +490 -0
  179. package/seedgridKB/SeedGrid/SeedGrid-components/navegacao-e-overlay/Exemplos.md +561 -0
  180. package/seedgridKB/SeedGrid/SeedGrid-components/navegacao-e-overlay/Visao-geral.md +82 -0
  181. package/seedgridKB/SeedGrid/SeedGrid-components/pacotes/Visao-geral.md +68 -0
  182. package/seedgridKB/SeedGrid/SeedGrid-components/pacotes/fe-commons.md +61 -0
  183. package/seedgridKB/SeedGrid/SeedGrid-components/pacotes/fe-core.md +140 -0
  184. package/seedgridKB/SeedGrid/SeedGrid-components/pacotes/fe-playground.md +112 -0
  185. package/seedgridKB/SeedGrid/SeedGrid-components/pacotes/fe-theme.md +97 -0
  186. package/seedgridKB/SeedGrid/SeedGrid-components/providers/API.md +177 -0
  187. package/seedgridKB/SeedGrid/SeedGrid-components/providers/Exemplos.md +332 -0
  188. package/seedgridKB/SeedGrid/SeedGrid-components/providers/Visao-geral.md +106 -0
  189. package/seedgridKB/SeedGrid/SeedGrid-components/showcase.md +70 -0
  190. package/seedgridKB/SeedGrid/Toolkit/agents/arquiteto.md +53 -0
  191. package/seedgridKB/SeedGrid/Toolkit/agents/backend-java.md +45 -0
  192. package/seedgridKB/SeedGrid/Toolkit/agents/backend-rust.md +43 -0
  193. package/seedgridKB/SeedGrid/Toolkit/agents/frontend-react.md +41 -0
  194. package/seedgridKB/SeedGrid/Toolkit/agents/qa.md +44 -0
  195. package/seedgridKB/SeedGrid/Toolkit/agents/revisor.md +40 -0
  196. package/seedgridKB/SeedGrid/Toolkit/references/fluxo-de-trabalho.md +78 -0
  197. package/seedgridKB/SeedGrid/Toolkit/references/glossario.md +15 -0
  198. package/seedgridKB/SeedGrid/Toolkit/references/modos-shared-native.md +27 -0
  199. package/seedgridKB/SeedGrid/Toolkit/rules/backend-java-seedgrid.md +54 -0
  200. package/seedgridKB/SeedGrid/Toolkit/rules/coordenacao.md +39 -0
  201. package/seedgridKB/SeedGrid/Toolkit/rules/formato-entrega.md +29 -0
  202. package/seedgridKB/SeedGrid/Toolkit/rules/frontend-seedgrid.md +47 -0
  203. package/seedgridKB/SeedGrid/Toolkit/rules/personalizacao-local.md +22 -0
  204. package/seedgridKB/SeedGrid/Toolkit/skills/planejar-mudanca/SKILL.md +38 -0
  205. package/seedgridKB/SeedGrid/Toolkit/skills/revisar-codigo/SKILL.md +33 -0
  206. package/seedgridKB/SeedGrid/Toolkit/skills/revisar-codigo/references/checklist.md +25 -0
  207. package/seedgridKB/SeedGrid/Toolkit/skills/seedgrid-backend-crud/SKILL.md +29 -0
  208. package/seedgridKB/SeedGrid/Toolkit/skills/seedgrid-bump/SKILL.md +26 -0
  209. package/seedgridKB/SeedGrid/Toolkit/skills/seedgrid-crud/SKILL.md +221 -0
  210. package/seedgridKB/SeedGrid/Toolkit/skills/seedgrid-crud/agents/openai.yaml +4 -0
  211. package/seedgridKB/SeedGrid/Toolkit/skills/seedgrid-crud/references/checklist.md +31 -0
  212. package/seedgridKB/SeedGrid/Toolkit/skills/seedgrid-crud/references/patterns.md +185 -0
  213. package/seedgridKB/SeedGrid/Toolkit/skills/seedgrid-crud/references/routing.md +66 -0
  214. package/seedgridKB/SeedGrid/Toolkit/skills/seedgrid-new-screen/SKILL.md +56 -0
  215. package/seedgridKB/SeedGrid/Toolkit/skills/seedgrid-new-screen/agents/openai.yaml +4 -0
  216. package/seedgridKB/SeedGrid/Toolkit/skills/seedgrid-new-screen/references/checklist.md +32 -0
  217. package/seedgridKB/SeedGrid/Toolkit/skills/seedgrid-new-screen/references/steps.md +114 -0
  218. package/seedgridKB/SeedGrid/Toolkit/skills/seedgrid-review/SKILL.md +61 -0
  219. package/seedgridKB/SeedGrid/Toolkit/skills/validar-mudanca/SKILL.md +29 -0
  220. package/seedgridKB/SeedGrid/Toolkit/templates/decisao-arquitetura.md +29 -0
  221. package/seedgridKB/SeedGrid/Toolkit/templates/especificacao-tarefa.md +32 -0
  222. package/seedgridKB/SeedGrid/Toolkit/templates/relatorio-validacao.md +30 -0
  223. package/seedgridKB/SeedGrid/Versoes.md +64 -0
  224. package/seedgridKB/SeedGrid/Visao-geral.md +35 -0
  225. package/seedgridKB/manifest.json +142 -0
@@ -0,0 +1,47 @@
1
+ ---
2
+ description: "Padrões obrigatórios do front-end SeedGrid: usar sempre os componentes @seedgrid/fe-components e o componente certo para cada tipo de dado (telefone, CPF, CNPJ, e-mail, moeda...). Leia antes de criar ou alterar qualquer tela React."
3
+ ---
4
+ # Padrões do front-end SeedGrid
5
+
6
+ Regras **obrigatórias** para telas React que usam `@seedgrid/fe-components`. Cada regra tem um id (`FE-nn`) para citar em revisões (`seedgrid-review`). Para detalhes de props e exemplos, consulte a KB: comece por `.ai/brain/SeedGrid/SeedGrid-components/Indice.md` e abra só a nota do grupo necessário.
7
+
8
+ ## Componentes SeedGrid primeiro
9
+
10
+ - **FE-01.** Use componentes SeedGrid para toda a interface. Só use elemento HTML cru (`<input>`, `<button>`, `<select>`, `<textarea>`, `<table>`) se **não existir** componente SeedGrid equivalente; nesse caso, justifique em comentário curto.
11
+ - **FE-02.** Antes de criar um componente novo, procure no índice da KB se já existe um que atenda. Não reimplemente o que o SeedGrid já oferece.
12
+ - **FE-03.** Não invente props. Confirme nome e tipo na nota `API` do grupo; se não achar, diga que não encontrou.
13
+
14
+ ## Componente certo para cada dado
15
+
16
+ Nunca use `SgInputText` (nem `<input>` com máscara própria) para um dado que tem componente específico:
17
+
18
+ | Dado | Componente |
19
+ | --- | --- |
20
+ | **FE-10.** Telefone, celular, WhatsApp | `SgInputPhone` |
21
+ | **FE-11.** CPF | `SgInputCPF` |
22
+ | **FE-12.** CNPJ | `SgInputCNPJ` |
23
+ | **FE-13.** Campo que aceita CPF **ou** CNPJ | `SgInputCPFCNPJ` |
24
+ | **FE-14.** E-mail | `SgInputEmail` |
25
+ | **FE-15.** CEP / código postal | `SgInputPostalCode` |
26
+ | **FE-16.** Senha | `SgInputPassword` |
27
+ | **FE-17.** Valor monetário | `SgInputCurrency` (`currency="BRL"`, `decimals={2}`) |
28
+ | **FE-18.** Número (inteiro ou decimal não monetário) | `SgInputNumber` |
29
+ | **FE-19.** Data / data de nascimento | `SgInputDate` / `SgInputBirthDate` |
30
+ | **FE-20.** Busca remota com debounce | `SgInputTextSearch` |
31
+ | **FE-21.** Código de uso único (OTP) | `SgInputOTP` |
32
+ | **FE-22.** Sim/não | `SgToggleSwitch` |
33
+ | **FE-23.** Uma opção de lista fixa ou carregada uma vez | `SgCombobox` (lista remota ou grande: `SgAutocomplete`) |
34
+ | **FE-24.** Texto longo | `SgInputTextArea` |
35
+
36
+ ## Estrutura e feedback
37
+
38
+ - **FE-30.** Botões: `SgButton`. Layout: `SgStack`, `SgGrid`, `SgCard` etc. no lugar de `div` com flex/grid escritos à mão.
39
+ - **FE-31.** Tabelas de dados: `SgDatatable`, paginada e ordenada no servidor quando a lista puder crescer.
40
+ - **FE-32.** Confirmação de ação destrutiva: `SgConfirmationDialog`, nunca `window.confirm`/`alert`.
41
+ - **FE-33.** Avisos ao usuário: `toast` (ou `sgWhistle`), não `alert`.
42
+ - **FE-34.** Carregamento: `SgSkeleton` (tabelas com skeleton em formato de tabela).
43
+ - **FE-35.** Textos para o usuário em linguagem de negócio, não detalhe técnico.
44
+
45
+ ## CRUDs
46
+
47
+ Telas de cadastro seguem a skill `seedgrid-crud` (páginas `*_list` e `*_edit`, `publicId` nas URLs, proxy em `app/api/...`). Nunca exponha o `id` numérico ao navegador quando houver `publicId`.
@@ -0,0 +1,22 @@
1
+ ---
2
+ description: "Como personalizar o toolkit sem gerar conflito: usar .ai/local/, que nunca é alterado pelo seedgrid-ai. Leia antes de editar qualquer arquivo de .ai/."
3
+ ---
4
+ # Personalização local
5
+
6
+ O conteúdo em `.ai/agents/`, `.ai/rules/`, `.ai/templates/` e `.ai/references/` é gerenciado pelo `seedgrid-ai` e pode ser substituído em atualizações. Não edite esses arquivos: alterações locais geram conflito no próximo `update`.
7
+
8
+ Personalize em `.ai/local/`, que o toolkit nunca cria, altera ou remove:
9
+
10
+ | Arquivo sugerido | Uso |
11
+ | --- | --- |
12
+ | `.ai/local/projeto.md` | Stack, comandos de build/teste, convenções e arquitetura do projeto |
13
+ | `.ai/local/fluxos.md` | Fluxos obrigatórios (ex.: revisão antes de merge) |
14
+ | `.ai/local/papeis/<id>.md` | Complementos a um papel do catálogo (mesmo id) |
15
+
16
+ Precedência ao ler instruções:
17
+
18
+ 1. Pedido explícito do usuário na sessão.
19
+ 2. `.ai/local/` (específico do projeto).
20
+ 3. Regras compartilhadas em `.ai/rules/` e papéis em `.ai/agents/`.
21
+
22
+ Se `.ai/local/` não existir, siga apenas as regras compartilhadas. Ao ler um papel, verifique se existe `.ai/local/papeis/<id>.md` e aplique o complemento.
@@ -0,0 +1,38 @@
1
+ ---
2
+ name: planejar-mudanca
3
+ description: Planeja uma mudança de código antes de implementar - entende o objetivo, lê o código afetado, define critérios de aceite, divide em tarefas e identifica riscos. Use quando a tarefa atravessa vários arquivos ou camadas, é ambígua ou envolve decisão de arquitetura.
4
+ metadata:
5
+ toolkit: seedgrid-ai
6
+ ---
7
+
8
+ # Planejar mudança
9
+
10
+ Produza um plano curto e verificável antes de alterar código não trivial.
11
+
12
+ ## Passos
13
+
14
+ 1. **Objetivo.** Reescreva o pedido em uma frase e liste as restrições explícitas. Se faltar informação indispensável, pergunte antes de seguir.
15
+ 2. **Reconhecimento.** Leia os arquivos que serão afetados e o código que os chama. Anote convenções do projeto (estrutura, testes, nomes). Não presuma estrutura que não viu.
16
+ 3. **Critérios de aceite.** Escreva de 2 a 6 critérios verificáveis (comportamento observável, testes, comandos).
17
+ 4. **Abordagem.** Descreva a solução escolhida e, se houver escolha relevante, ao menos uma alternativa e por que foi descartada.
18
+ 5. **Tarefas.** Divida em tarefas pequenas com: papel responsável, arquivos prováveis, dependências e ordem. Marque o que pode ser paralelo; nunca coloque dois responsáveis escrevendo no mesmo arquivo ao mesmo tempo.
19
+ 6. **Riscos e verificação.** Liste riscos (dados, segurança, contratos, desempenho, migração) e o nível de revisão e validação proporcional.
20
+
21
+ ## Saída
22
+
23
+ Use o modelo [assets/especificacao-tarefa.md](assets/especificacao-tarefa.md) para cada tarefa delegada. Para o plano geral, responda com:
24
+
25
+ ```markdown
26
+ ## Objetivo
27
+ ## Critérios de aceite
28
+ ## Abordagem
29
+ ## Tarefas
30
+ | # | Tarefa | Papel | Arquivos | Depende de | Paralela? |
31
+ ## Riscos e verificação
32
+ ## Dúvidas
33
+ ```
34
+
35
+ ## Cuidados
36
+
37
+ - Tarefas triviais não precisam de plano formal: implemente direto e diga isso.
38
+ - O plano é uma saída do projeto; não o salve dentro das pastas gerenciadas pelo toolkit (`.ai/templates/`, `.ai/rules/`, `.ai/agents/`).
@@ -0,0 +1,33 @@
1
+ ---
2
+ name: revisar-codigo
3
+ description: Revisa um diff ou conjunto de arquivos alterados procurando defeitos de lógica, segurança, tratamento de erros, compatibilidade e testes ausentes, com achados priorizados e cenário concreto de falha. Use após implementar uma mudança substancial ou quando pedirem revisão de código.
4
+ metadata:
5
+ toolkit: seedgrid-ai
6
+ ---
7
+
8
+ # Revisar código
9
+
10
+ Encontre problemas reais e verificáveis; evite comentários de estilo sem impacto.
11
+
12
+ ## Passos
13
+
14
+ 1. **Escopo.** Obtenha o diff (por exemplo, `git diff` ou `git diff <base>...HEAD`) e o objetivo da mudança. Sem diff disponível, peça a lista de arquivos alterados.
15
+ 2. **Contexto.** Leia o código ao redor de cada trecho alterado e os pontos que o chamam.
16
+ 3. **Análise.** Percorra o [checklist](references/checklist.md). Para cada suspeita, construa um cenário concreto: entrada/estado → comportamento errado.
17
+ 4. **Filtro.** Descarte suspeitas que não sustentam um cenário concreto. Não reporte preferências pessoais como defeitos.
18
+ 5. **Verificações somente leitura.** Se útil, rode testes ou lint existentes para confirmar um achado. Não altere arquivos.
19
+
20
+ ## Saída
21
+
22
+ ```markdown
23
+ ## Achados
24
+ ### [bloqueante|importante|sugestão] Título curto
25
+ - Local: caminho/arquivo:linha
26
+ - Cenário: entrada/estado → resultado incorreto
27
+ - Correção sugerida: uma ou duas frases
28
+
29
+ ## Sem achados em
30
+ Áreas revisadas sem problemas relevantes.
31
+ ```
32
+
33
+ Se não houver achados bloqueantes, diga isso explicitamente.
@@ -0,0 +1,25 @@
1
+ # Checklist de revisão
2
+
3
+ ## Correção
4
+ - Condições de borda: vazio, nulo, limites numéricos, listas grandes, fuso horário, codificação de texto.
5
+ - Caminhos de erro: exceções engolidas, retornos ignorados, mensagens que escondem a causa.
6
+ - Estado: mutações compartilhadas, ordem de inicialização, cache inválido.
7
+ - Concorrência: condições de corrida, transações, idempotência em reprocessamento.
8
+
9
+ ## Segurança
10
+ - Entrada não confiável chegando a SQL, shell, caminhos de arquivo, HTML ou desserialização.
11
+ - Autorização verificada no servidor para cada operação, não apenas na interface.
12
+ - Segredos em código, logs, mensagens de erro ou arquivos versionados.
13
+ - Dados pessoais expostos além do necessário.
14
+
15
+ ## Contratos e compatibilidade
16
+ - APIs públicas, eventos, esquemas e formatos de arquivo alterados sem versionamento ou migração.
17
+ - Migrações de banco reversíveis ou com plano de recuperação.
18
+
19
+ ## Testes
20
+ - O comportamento novo tem teste que falharia sem a mudança?
21
+ - Casos de erro e de borda cobertos na medida do risco.
22
+
23
+ ## Manutenção
24
+ - Duplicação de lógica existente no projeto.
25
+ - Nomes e estrutura coerentes com o restante do código.
@@ -0,0 +1,29 @@
1
+ ---
2
+ name: seedgrid-backend-crud
3
+ description: Cria ou padroniza um CRUD de back-end Java com as extensions SeedGrid - entidade com BaseEntity e publicId, migration Flyway, campos pessoais cifrados com seedgrid-privacy (LGPD), auditoria com @Audit, permissões, controller com RestControllerPath, DTOs e testes. Use ao criar uma entidade nova com API, ou ao adicionar campo pessoal, auditoria ou permissão a um cadastro existente.
4
+ metadata:
5
+ toolkit: seedgrid-ai
6
+ ---
7
+
8
+ # CRUD de back-end SeedGrid
9
+
10
+ Monta um cadastro completo no padrão `.ai/rules/backend-java-seedgrid.md` (regras `BE-nn`), reaproveitando as extensions SeedGrid. Antes de começar, leia essa rule e, para cada extension usada, só a nota do grupo na KB (`.ai/brain/SeedGrid/Extensions/Indice.md` → `privacy`, `audit`, `commons`, `security`). Não invente propriedades nem anotações: confirme na KB ou no código.
11
+
12
+ ## Passos
13
+
14
+ 1. **Levantar.** Entidade, campos, quais são **dados pessoais** (CPF, telefone, e-mail, endereço, nascimento), quais precisam de **busca por igualdade**, permissões e se há relacionamentos. Leia um cadastro existente do projeto e copie as convenções dele. Dúvida de regra de negócio: pergunte.
15
+ 2. **Entidade** (`entities/`): estenda a base do `seedgrid-commons` (BE-23). **Host com Panache:** `BaseEntityPanache` (`id`, `publicId`, datas, usuário de criação/alteração; sem `active`). **Lib** (JPA puro, sem Panache, BE-21): `BaseEntity` (as mesmas colunas mais `active`). Se o projeto já tem cadastros, siga a base que eles usam. Relacionamentos usam o `id`; o `publicId` é só para fora (BE-30).
16
+ 3. **Campos pessoais** (BE-61): para cada um, `@Convert(converter = EncryptedFieldAttributeConverter.class)` + `@EncryptedField`, coluna `length = 512`. Com busca: `@EncryptedField(searchField = "cpfHash", normalize = SearchNormalization.CANONICAL)` (e-mail: `EMAIL`) e o campo irmão `cpfHash` (`length = 64`). Adicione `@EntityListeners(EncryptedFieldListener.class)` na entidade. Marque os mesmos campos com `@PersonalData` para o mascaramento na auditoria (BE-63).
17
+ 4. **Migration Flyway** (BE-20, BE-22, BE-24): tabela com `id BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY`, as colunas da base escolhida (`public_id`, `created_at`, `updated_at` como `timestamptz`, `create_user_public_id`, `update_user_public_id`, e `active` só no `BaseEntity`; a lib não traz migrations), colunas cifradas com `VARCHAR(512)` e de hash com `VARCHAR(64)`, e `CREATE UNIQUE INDEX idx_<tabela>_public_id ON <tabela>(public_id)`. A pasta segue `db/migration/<projeto>`.
18
+ 5. **Repository** (`repositories/`, JPA puro em libs; Panache só em hosts, BE-21). Busca por campo cifrado usa o hash: `CryptoProvider.getSecureSearch().hashForSearch(valor, <mesma normalização>)`.
19
+ 6. **Service** (`services/`, injeção por construtor, BE-10): regras de negócio e exceptions tipadas (BE-11). Criar, alterar e excluir com `@Transactional` e `@Audit(entityFqcn = "...", operation = AuditOperationEnum.CREATE|UPDATE|DELETE, description = "...")` (BE-64). Para UPDATE/DELETE, o repository precisa expor `findByIdOptional` (é por ele que o `@Audit` captura o "antes").
20
+ 7. **DTOs** (`dtos/`, BE-05): `...Request` só com o necessário, `...Response` raso, com `publicId` e **sem** `id`. Nada de dado pessoal em claro em respostas de erro ou log.
21
+ 8. **Controller** (`controllers/`, BE-03, BE-31): primeiro acrescente a seção do recurso em `RestControllerPath` (base, `..._BY_PUBLIC_ID`, `..._FULL`; o controller usa base e sub-paths, o teste usa os `_FULL`); `GET` paginado (`page`, `size`, `sortField`, `sortOrder`, com `LIKE` por prefixo, BE-32), `GET` por `publicId`, `POST`, `PUT`, `DELETE`. Proteja com `@PermissionsAllowed("<ENTIDADE>_READ|CREATE|EDIT|DELETE")` (ou `@RolesAllowed`), conforme a extension `security` (BE-65), e registre as permissões como o projeto faz.
22
+ 9. **Testes** (BE-40, BE-41): unitário do service e de integração do controller com Testcontainers + PostgreSQL, cobrindo CRUD, validação, permissão negada, **dado pessoal gravado cifrado** (consulta direta na coluna), busca pelo hash e registro de auditoria sem dado pessoal em claro. Vários asserts: `assertAll`.
23
+ 10. **Fechar** (BE-50): rode build e testes, remova o que sobrou e liste os TODO.
24
+
25
+ ## Cuidados
26
+
27
+ - Cifra de campo é opt-in: exige `seedgrid.privacy.encryption.enabled=true`, `seedgrid.privacy.crypto.key` e `seedgrid.privacy.search.key` fornecidos por variável de ambiente ou segredo, nunca versionados (BE-62). Sem a chave configurada, a leitura de valor já cifrado falha.
28
+ - A tela correspondente segue a skill `seedgrid-crud`; menu e permissão da tela, a `seedgrid-new-screen`.
29
+ - Para conferir o resultado contra o padrão, use `seedgrid-review back`.
@@ -0,0 +1,26 @@
1
+ ---
2
+ name: seedgrid-bump
3
+ description: Sobe a versão do projeto inteiro de uma vez, mantendo a mesma versão no back (pom.xml) e em todos os apps de front (package.json), e no que mais a exibir. Use quando pedirem bump, nova versão ou release do projeto (patch, minor, major ou uma versão informada). Não altera dependências.
4
+ metadata:
5
+ toolkit: seedgrid-ai
6
+ ---
7
+
8
+ # Bump de versão do projeto
9
+
10
+ Regra: **o projeto inteiro tem uma única versão**. Back e todos os fronts (por exemplo `backend/`, `admin/`, `frontend/`) saem sempre com o mesmo número. Esta skill muda **a versão do próprio projeto**; não sobe versões de dependências nem de extensions SeedGrid.
11
+
12
+ ## Passos
13
+
14
+ 1. **Descobrir a versão atual e onde ela está.** Leia a versão do `pom.xml` do back (a do projeto, não a de `<dependency>` nem `<parent>`) e o campo `version` de cada `package.json` de aplicação (ignore `node_modules` e pacotes que não sejam do projeto). Procure também onde a versão aparece como texto: `application.properties` (`app.build.version=${APP_VERSION:dev}` lê da variável de ambiente `APP_VERSION`, então não é editado), `Dockerfile`, `docker-compose`, README e changelog. Se as versões atuais já divergem entre si, **pare e mostre a divergência** antes de seguir.
15
+ 2. **Definir a nova versão** `X.Y.Z` (semver) a partir do pedido: `patch` (correção), `minor` (funcionalidade compatível), `major` (quebra de compatibilidade) ou um número informado. Sem indicação, sugira com base nas mudanças desde a última versão e confirme com o usuário.
16
+ 3. **Mostrar o plano** (arquivo: versão atual → nova) e só então alterar.
17
+ 4. **Aplicar** a mesma `X.Y.Z` em todos os arquivos encontrados: `pom.xml` do back (sem sufixo `-SNAPSHOT` em release; se o projeto usa `-SNAPSHOT` no desenvolvimento, pergunte se quer voltar para o próximo `-SNAPSHOT` depois), cada `package.json` de aplicação e os textos que repetem a versão. Mantenha a formatação dos arquivos; mude só a versão. Em `package.json` com lockfile, atualize também o campo de versão do próprio projeto no lockfile quando existir.
18
+ 5. **Verificar.** Rode build e testes de cada parte (`mvn -q verify` ou o comando do projeto, e `build`/`lint`/testes dos fronts) e confirme que nenhuma versão ficou para trás com uma busca pela versão antiga.
19
+ 6. **Registrar.** Atualize o changelog se o projeto tiver um, com o que mudou desde a versão anterior.
20
+ 7. **Entregar.** Liste os arquivos alterados e os resultados dos comandos. Commit, tag e push **só se o usuário pedir**; sugira a mensagem e a tag (`vX.Y.Z`).
21
+
22
+ ## Regras
23
+
24
+ - Nunca altere versões de `<dependency>`, `<parent>`, BOMs, extensions SeedGrid ou pacotes `@seedgrid/*`; atualização de dependências é outra tarefa.
25
+ - Não publique artefatos, não faça deploy e não envie nada a serviços externos.
26
+ - Se houver mudanças não commitadas no repositório, avise antes de alterar.
@@ -0,0 +1,221 @@
1
+ ---
2
+ name: seedgrid-crud
3
+ description: Create or refactor SeedGrid CRUD flows in a Next.js app built on the SeedGrid boilerplate, using the project standard of separate `*_list` and `*_edit` pages, `publicId` routing, Next API proxy routes, and SeedGrid components. Use when you need to build or standardize an entity CRUD (users, roles, plans, API keys, audit screens, etc.) with `SgDatatable`, `SgInputTextSearch`, permissions, user-facing copy, and menu/breadcrumb integration.
4
+ ---
5
+
6
+ # SeedGrid CRUD
7
+
8
+ Build SeedGrid CRUDs with the structure of the boilerplate's `users` and `roles` screens
9
+ (`app/security/users/user_list`, `user_edit`; `app/security/roles/role_list`, `role_edit`). Keep the
10
+ pages user-facing, consistent, and navigable through `SgMenu` and `SgBreadcrumb`.
11
+
12
+ Read the existing screens of the project before writing a new one and copy their conventions (imports,
13
+ hooks, helpers). The names below (`Shell`, `useSavedToast`, `ListLoadError`, `adminProxyClient`, ...)
14
+ are the boilerplate's own; if the project names them differently, use the project's equivalents.
15
+
16
+ To register the menu item, icon and permission of a new screen, use the `seedgrid-new-screen` skill.
17
+
18
+ ## Workflow
19
+
20
+ 1. Identify the entity, its permissions, and the backend endpoints that already exist (do not invent
21
+ endpoints; check the backend or the SeedGrid knowledge base in `.ai/brain/`).
22
+ 2. Create the pages under `app/<module>/<entity>/`:
23
+ - `<entity>_list/page.tsx`: table, search, pagination, sort and actions
24
+ - `<entity>_edit/page.tsx`: create/update in a dedicated page
25
+ - `page.tsx`: `redirect("/<module>/<entity>/<entity>_list")`
26
+ 3. Prefer `publicId` in URLs and route params. Keep the numeric `id` internal only.
27
+ 4. Use Next API routes in `app/api/<module>/<entity>/` as server-side proxies to the backend.
28
+ 5. Use SeedGrid components for the whole UI structure.
29
+ 6. Write user-facing labels and descriptions. Do not expose technical implementation details in the UI.
30
+ 7. Validate navigation, permission gates, and loading/error states.
31
+
32
+ ## Required Patterns
33
+
34
+ - Use the list/edit split described in `references/patterns.md`.
35
+ - Use `publicId` routing and proxy conventions from `references/routing.md`.
36
+ - Use `SgInputTextSearch` as the standard remote-search input.
37
+ - Use the checklist in `references/checklist.md` before closing the task.
38
+
39
+ ## Required UI Components
40
+
41
+ - Layout/navigation: `Shell`, `SgMenu`, `SgBreadcrumb`, `SgCard`, `SgStack`, `SgGrid`
42
+ - Listing: `SgDatatable`, `DatatableSkeleton` (table-shaped loading), `StatusBadge`, `ListLoadError`
43
+ - Search: `SgInputTextSearch`
44
+ - Destructive confirmation: `SgConfirmationDialog`
45
+ - Feedback: `toast` from `@seedgrid/fe-components`
46
+ - Edit: `SgInputText`, `SgInputNumber`, `SgInputCurrency`, `SgInputPassword`, `SgInputDate`, `SgToggleSwitch`, `SgButton` as applicable
47
+
48
+ ## Input Type Standard
49
+
50
+ Never use `SgInputText` (or a raw text input with `inputMode`) for numeric or
51
+ monetary fields — it lets the user type letters and the value only fails at
52
+ submit. Match the input component to the data type:
53
+
54
+ - **Monetary value** (price, fee, overage, balance) → `SgInputCurrency`
55
+ with `currency="BRL"`, `decimals={2}`, `minValue={0}` (or `allowNegative`
56
+ when negatives are valid). Read it back with `parseDecimalInput` from
57
+ `@/lib/format` (handles the pt-BR comma).
58
+ - **Integer count** (requests, users, quantity, day-of-month) → `SgInputNumber`
59
+ with `decimals={0}` and an appropriate `minValue`. Parse with
60
+ `Number.parseInt(value, 10)`.
61
+ - **Decimal non-money** (rates, factors) → `SgInputNumber` with the needed
62
+ `decimals` and `parseDecimalInput`.
63
+ - **Date** → `SgInputDate`. **Free text** → `SgInputText`.
64
+
65
+ Both `SgInputCurrency` and `SgInputNumber` are controlled via
66
+ `inputProps={{ value }}` and report back a string through `onChange`. Keep the
67
+ form state as the raw string and convert only on submit.
68
+
69
+ ## Search Standard
70
+
71
+ For searchable lists:
72
+
73
+ - Use `SgInputTextSearch` by name, not an ad-hoc input.
74
+ - Apply minimum 3 characters.
75
+ - Use debounce and distinct semantics.
76
+ - Cancel in-flight requests when the query changes (an RxJS `Subject` + `switchMap`, with an
77
+ `AbortController` aborted on unsubscribe).
78
+ - Keep the request server-side paginated and sortable.
79
+
80
+ ### Server-side `LIKE` must be a PREFIX match
81
+
82
+ The backend that feeds the `SgDatatable` binds the search term as `term + "%"`, never
83
+ `"%" + term + "%"`. A leading wildcard makes the database unable to use the column index, so every
84
+ keystroke turns the list query into a full table scan — the cost grows with the table, exactly where
85
+ it hurts most.
86
+
87
+ ```java
88
+ // CORRECT — uses the index
89
+ queryObj.setParameter("term", query + "%");
90
+ // WRONG — scans the whole table
91
+ queryObj.setParameter("term", "%" + query + "%");
92
+ ```
93
+
94
+ The JPQL/Panache clause itself does not change (`lower(u.name) LIKE :term`); only the bound value
95
+ does. Trade-off accepted deliberately: the user finds "AVENTAL IMPERIO" by typing `avental`, not by
96
+ typing `imperio`.
97
+
98
+ Equality (`= :param`) stays the right call for codes/IDs and for closed option lists (the filter fed
99
+ by a `DISTINCT`, rendered as `SgCombobox`/`SgAutocomplete`), where no `LIKE` is needed at all.
100
+
101
+ ### Critical RxJS pitfall (incremental search must keep working)
102
+
103
+ The debounce in `SgInputTextSearch` lives inside an `useEffect` subscription. Do
104
+ **not** put the `onSearchChange`/`onChange` callbacks in that effect's dependency
105
+ array. Parent pages recreate those callbacks on every render (and each keystroke
106
+ triggers a parent re-render via `setRawSearch`), so a callback-dependent effect
107
+ tears down and re-subscribes on every keystroke. The cleanup `unsubscribe()`
108
+ cancels the pending `debounceTime` timer, so the debounced value never reaches
109
+ `onSearchChange` and the search silently never fires.
110
+
111
+ Correct pattern: hold the latest callback in a `useRef`, keep the subscription
112
+ effect dependencies limited to stable values (`changes$`, `debounceMs`,
113
+ `minChars`), and call `onSearchChangeRef.current(...)` inside the subscriber.
114
+
115
+ ```ts
116
+ const onSearchChangeRef = useRef(onSearchChange);
117
+ onSearchChangeRef.current = onSearchChange;
118
+
119
+ useEffect(() => {
120
+ const subscription = changes$
121
+ .pipe(map((raw) => raw.trim()), debounceTime(debounceMs), distinctUntilChanged())
122
+ .subscribe((next) => {
123
+ if (next.length === 0 || next.length >= minChars) {
124
+ onSearchChangeRef.current(next);
125
+ }
126
+ });
127
+ return () => subscription.unsubscribe();
128
+ }, [changes$, debounceMs, minChars]); // never include the callbacks here
129
+ ```
130
+
131
+ The parent does not need `useCallback` for this to work — the component must be
132
+ robust to recreated callbacks on its own.
133
+
134
+ ## List Toolbar Layout Standard
135
+
136
+ The list header (search + `Novo` action) must not split the row into two equal
137
+ halves. The search is the primary control and should dominate the width.
138
+
139
+ - Lay the toolbar out with `SgStack direction="row" align="end" gap={12} wrap`
140
+ (not a 50/50 `SgGrid`).
141
+ - Wrap `SgInputTextSearch` in a growing container so it takes the remaining
142
+ space: `<div style={{ flex: 1, minWidth: 240 }}>`.
143
+ - Keep the create button compact: short label (`Novo`, not `Novo usuario`) and
144
+ `size="md"`.
145
+ - The button is shorter than the input by default. `SgInputText` is `h-11`
146
+ (44px); `SgButton size="md"` is `h-10` (40px). Match them with
147
+ `style={{ height: 44 }}` so the button lines up with the field.
148
+ - `align="end"` keeps the button aligned to the input's baseline (the input has
149
+ a label above it).
150
+ - `wrap` lets them stack on narrow viewports.
151
+
152
+ ```tsx
153
+ <SgStack align="end" direction="row" gap={12} wrap>
154
+ <div style={{ flex: 1, minWidth: 240 }}>
155
+ <SgInputTextSearch id="<entity>-search" label="Busca por nome" ... />
156
+ </div>
157
+ {canCreate ? (
158
+ <SgButton
159
+ appearance="outline"
160
+ label="Novo"
161
+ leftIcon={<Plus size={16} />}
162
+ severity="secondary"
163
+ size="md"
164
+ style={{ height: 44 }}
165
+ onClick={() => router.push("/<module>/<entity>/<entity>_edit")}
166
+ />
167
+ ) : null}
168
+ </SgStack>
169
+ ```
170
+
171
+ ## Destructive Action Standard
172
+
173
+ Delete (and any irreversible action) must use `SgConfirmationDialog`, never the
174
+ native `window.confirm`. The native dialog is the wrong, inconsistent popup.
175
+
176
+ - Drive the dialog with controlled state: a single `entityToDelete` state opens
177
+ it (`open={entityToDelete !== null}`).
178
+ - The row action only sets state (`onClick={() => setEntityToDelete(row)}`); it
179
+ does not perform the delete.
180
+ - Run the request in `onConfirm`. Keep the dialog open during the async call
181
+ with `closeOnConfirm={false}`, show progress on the confirm button
182
+ (`label: deleting ? "Excluindo..." : "Excluir"`, `disabled: deleting`), and
183
+ clear the state in a `finally` to close it.
184
+ - Use `severity="danger"`, a user-facing title and message that names the entity
185
+ and warns the action cannot be undone.
186
+ - After deleting the last row on a page, step `page` back by one (mirror the
187
+ existing list paging logic).
188
+
189
+ ```tsx
190
+ <SgConfirmationDialog
191
+ open={entityToDelete !== null}
192
+ severity="danger"
193
+ title="Excluir <entity>"
194
+ message={entityToDelete ? `Tem certeza que deseja excluir "${entityToDelete.name}"? Esta acao nao pode ser desfeita.` : ""}
195
+ confirmButton={{ label: deleting ? "Excluindo..." : "Excluir", severity: "danger", disabled: deleting }}
196
+ cancelButton={{ label: "Cancelar", disabled: deleting }}
197
+ closeOnConfirm={false}
198
+ onConfirm={() => void confirmDelete()}
199
+ onCancel={() => setEntityToDelete(null)}
200
+ />
201
+ ```
202
+
203
+ ## Permission Standard
204
+
205
+ - Hide menu entries if the user lacks view permission.
206
+ - Hide create/edit/delete actions if the user lacks the corresponding permission.
207
+ - If the page is opened without permission, render a proper blocked state (a `Shell` with a
208
+ "Sem permissao" card) instead of failing.
209
+ - Permissions are checked in the UI **and** enforced by the backend; the UI gate is only for
210
+ usability.
211
+
212
+ ## Error And Fallback Standard
213
+
214
+ - A load failure must never look like an empty list. Keep the error in its own state and render
215
+ `ListLoadError` (with a retry) **instead of** the table; do not fall through to "Nenhum registro
216
+ encontrado".
217
+ - If the backend is unavailable or the session is invalid, proxy routes return the real error status
218
+ as `problem+json` (use the project's `problemResponse`), never a `200` with an empty page.
219
+ - Show the message from the backend with `extractApiErrorMessage`, falling back to a generic
220
+ user-facing text.
221
+ - Avoid uncaught runtime failures: every request has a `catch` that ends in a visible state.
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "SeedGrid CRUD"
3
+ short_description: "Padrao CRUD SeedGrid"
4
+ default_prompt: "Use $seedgrid-crud to create a SeedGrid CRUD with list/edit pages, publicId routing, and SgInputTextSearch."
@@ -0,0 +1,31 @@
1
+ # Delivery Checklist
2
+
3
+ Before finishing a CRUD task, verify:
4
+
5
+ - Menu entry exists only if the user has view permission
6
+ - `SgMenu` and `SgBreadcrumb` navigate to valid routes
7
+ - There are two pages, `*_list` and `*_edit`, plus a `page.tsx` that redirects to the list
8
+ - `SgInputTextSearch` is used for remote search when the list is searchable
9
+ - Search uses min 3 chars and cancels in-flight requests
10
+ - `SgInputTextSearch` keeps its RxJS subscription stable: callbacks live in a `useRef`, never in the subscription effect's deps (otherwise per-keystroke re-subscribes cancel the debounce and search stops firing)
11
+ - Typing in the search field actually triggers requests (verify incremental search end-to-end, not just that it renders)
12
+ - Backend `LIKE` filters bind `term + "%"` (prefix), never `"%" + term + "%"`
13
+ - `SgDatatable` is server-paginated and sortable
14
+ - Column layout persistence uses the project environment pattern when available
15
+ - Edit and delete actions are permission-gated
16
+ - Delete uses a controlled `SgConfirmationDialog` (`severity="danger"`), never `window.confirm`; request runs in `onConfirm` with `closeOnConfirm={false}` and a busy/disabled confirm button
17
+ - List toolbar uses `SgStack` row with the search growing (`flex: 1`) and a compact `Novo` button, height-matched to the input (`style={{ height: 44 }}`), not a 50/50 `SgGrid`
18
+ - `publicId` is used in the edit URL and in the detail/update/delete proxy routes
19
+ - Edit page uses SeedGrid form components
20
+ - Numeric and monetary fields use the right input type, never `SgInputText`: `SgInputCurrency` (`currency="BRL"`, `decimals={2}`) for money; `SgInputNumber` (`decimals={0}`) for integer counts. Verify the field rejects letters at type-time, not only at submit
21
+ - Copy is user-facing, not technical
22
+ - Table loading uses a table-shaped skeleton (`DatatableSkeleton`: header + body rows, column count matching the table), not a single rectangle; row count is capped (e.g. `Math.min(pageSize, 8)`). Edit/form pages may still use a rectangular `SgSkeleton`
23
+ - A list load failure shows `ListLoadError` (with retry) instead of the table, never an empty list
24
+ - Proxy routes return the real error status as `problem+json` for invalid session and connection failure, without crashing the page
25
+ - TypeScript passes
26
+
27
+ Recommended verification command, in the folder of the Next.js app (`frontend/` in the boilerplate):
28
+
29
+ ```bash
30
+ npx tsc --noEmit --pretty false
31
+ ```