jarvis-ai-framework 1.0.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 (240) hide show
  1. package/AGENTS.md +416 -0
  2. package/LICENSE +21 -0
  3. package/README.md +190 -0
  4. package/agents/AGENTS.md +234 -0
  5. package/agents/README.md +309 -0
  6. package/agents/engineering/data/eng.data-engineer.agent.md +309 -0
  7. package/agents/engineering/eng.agent.md +303 -0
  8. package/agents/engineering/eng.bug-hunter.md +386 -0
  9. package/agents/engineering/eng.cybersecurity.agent.md +503 -0
  10. package/agents/engineering/eng.dev-code-reviewer.md +148 -0
  11. package/agents/engineering/eng.docs-writer.md +152 -0
  12. package/agents/engineering/eng.frontend.agent.md +117 -0
  13. package/agents/engineering/eng.rpa.agent.md +215 -0
  14. package/agents/engineering/eng.tech-analyst.agent.md +102 -0
  15. package/agents/engineering/eng.ux-designer.agent.md +193 -0
  16. package/agents/engineering/qa/eng.qa.cypress-specialist.md +109 -0
  17. package/agents/engineering/qa/eng.qa.quality-champion-task-agent.md +85 -0
  18. package/agents/engineering/qa/eng.qa.quality-strategist.md +111 -0
  19. package/agents/engineering/qa/eng.qa.test-architect.md +400 -0
  20. package/agents/engineering/qa/eng.qa.test-planner.md +477 -0
  21. package/agents/engineering/qa/eng.qa.testing-engineer.md +339 -0
  22. package/agents/product/prod.pm-checker.md +52 -0
  23. package/bin/commands/docs-publish.js +184 -0
  24. package/bin/commands/docs-sync.js +139 -0
  25. package/bin/commands/info.js +87 -0
  26. package/bin/commands/init.js +237 -0
  27. package/bin/commands/install-rtk.js +90 -0
  28. package/bin/commands/list.js +48 -0
  29. package/bin/commands/qa-signoff.js +112 -0
  30. package/bin/commands/whoami.js +43 -0
  31. package/bin/jarvis.js +159 -0
  32. package/bin/lib/auth/session.js +56 -0
  33. package/bin/lib/config/constants.js +123 -0
  34. package/bin/lib/config/ide-config.js +233 -0
  35. package/bin/lib/core/scanner.js +124 -0
  36. package/bin/lib/core/sync-engine.js +551 -0
  37. package/bin/lib/docs/fetch-file.sh +41 -0
  38. package/bin/lib/docs/publish-file.sh +284 -0
  39. package/bin/lib/docs/validate-frontmatter.js +157 -0
  40. package/bin/lib/env-loader.js +198 -0
  41. package/bin/lib/tasks/comment.js +131 -0
  42. package/bin/lib/utils/git-parser.js +145 -0
  43. package/bin/lib/utils/logger.js +104 -0
  44. package/bin/lib/utils/npmrc-parser.js +106 -0
  45. package/bin/lib/utils/paths.js +55 -0
  46. package/bin/lib/utils/ui.js +59 -0
  47. package/bin/lib/vcs/api.js +312 -0
  48. package/bin/lib/vcs/create-issue.js +43 -0
  49. package/bin/lib/vcs/create-merge.js +43 -0
  50. package/bin/lib/vcs/fetch-raw.js +30 -0
  51. package/bin/postinstall.js +41 -0
  52. package/members.md +25 -0
  53. package/package.json +55 -0
  54. package/rules/AGENTS.md +205 -0
  55. package/rules/engineering/data/data-rules.md +200 -0
  56. package/rules/engineering/eng-rules.md +243 -0
  57. package/rules/engineering/eng-security-rules.md +186 -0
  58. package/rules/engineering/eng.breakdown-subtasks-rules.md +585 -0
  59. package/rules/engineering/eng.bump-rules.md +27 -0
  60. package/rules/engineering/eng.docs-scraping-rules.md +64 -0
  61. package/rules/engineering/eng.downstream-flow-rules.md +297 -0
  62. package/rules/engineering/eng.integrations-rules.md +73 -0
  63. package/rules/engineering/eng.plan-rules.md +333 -0
  64. package/rules/engineering/eng.pr-rules.md +359 -0
  65. package/rules/engineering/eng.pre-pr-rules.md +103 -0
  66. package/rules/engineering/eng.start-rules.md +246 -0
  67. package/rules/engineering/eng.tech-spec-rules.md +968 -0
  68. package/rules/engineering/eng.work-rules.md +312 -0
  69. package/rules/engineering/frontend/eng.frontend-rules.md +147 -0
  70. package/rules/engineering/qa/eng.qa.cypress-standards-rules.md +259 -0
  71. package/rules/engineering/qa/eng.qa.exploratory-session-rules.md +137 -0
  72. package/rules/engineering/qa/eng.qa.quality-gate-scoring-rules.md +181 -0
  73. package/rules/engineering/qa/eng.qa.tech-spec-validation-criteria-rules.md +120 -0
  74. package/rules/engineering/rpa/eng.rpa-rules.md +230 -0
  75. package/rules/product/README.md +24 -0
  76. package/rules/product/prod-rules.md +151 -0
  77. package/rules/rtk-rules.md +68 -0
  78. package/skills/AGENTS.md +290 -0
  79. package/skills/SKILLS-ROADMAP.md +333 -0
  80. package/skills/churn-audit/SKILL.md +385 -0
  81. package/skills/context-detect/SKILL.md +399 -0
  82. package/skills/context-detect/assets/context-profile-template.md +127 -0
  83. package/skills/docs-central/README.md +310 -0
  84. package/skills/docs-central/SKILL.md +423 -0
  85. package/skills/docs-index/SKILL.md +377 -0
  86. package/skills/eng-ai-engineer/SKILL.md +296 -0
  87. package/skills/eng-arch-c4/SKILL.md +358 -0
  88. package/skills/eng-arch-c4/assets/example-code.md +189 -0
  89. package/skills/eng-arch-c4/assets/example-component.md +105 -0
  90. package/skills/eng-arch-c4/assets/example-container.md +104 -0
  91. package/skills/eng-arch-c4/assets/example-context.md +81 -0
  92. package/skills/eng-backend/SKILL.md +776 -0
  93. package/skills/eng-browser-extension-builder/SKILL.md +385 -0
  94. package/skills/eng-cybersecurity/SKILL.md +645 -0
  95. package/skills/eng-data-bi/SKILL.md +199 -0
  96. package/skills/eng-data-debug/SKILL.md +307 -0
  97. package/skills/eng-data-engineer/SKILL.md +256 -0
  98. package/skills/eng-data-onboard/SKILL.md +310 -0
  99. package/skills/eng-data-orchestrator/SKILL.md +426 -0
  100. package/skills/eng-design-system/SKILL.md +619 -0
  101. package/skills/eng-docs-write/SKILL.md +312 -0
  102. package/skills/eng-frontend/SKILL.md +913 -0
  103. package/skills/eng-jira-comment/SKILL.md +17 -0
  104. package/skills/eng-microfrontend/SKILL.md +602 -0
  105. package/skills/eng-ms-trace/SKILL.md +469 -0
  106. package/skills/eng-nestjs/SKILL.md +791 -0
  107. package/skills/eng-performance-engineer/SKILL.md +312 -0
  108. package/skills/eng-pr/SKILL.md +339 -0
  109. package/skills/eng-qa-a11y-audit/SKILL.md +269 -0
  110. package/skills/eng-qa-bug-report/SKILL.md +1088 -0
  111. package/skills/eng-qa-bug-report/TASK_MANAGERS.md +138 -0
  112. package/skills/eng-qa-cypress-e2e/SKILL.md +177 -0
  113. package/skills/eng-qa-dev-guide/SKILL.md +164 -0
  114. package/skills/eng-qa-e2e/SKILL.md +400 -0
  115. package/skills/eng-qa-e2e-spec-writer/SKILL.md +322 -0
  116. package/skills/eng-qa-exploratory/SKILL.md +188 -0
  117. package/skills/eng-qa-gate/SKILL.md +370 -0
  118. package/skills/eng-qa-gate/assets/checklist-validacao.md +291 -0
  119. package/skills/eng-qa-graphql-contract/SKILL.md +256 -0
  120. package/skills/eng-qa-quality-report/SKILL.md +412 -0
  121. package/skills/eng-qa-test-plan/SKILL.md +466 -0
  122. package/skills/eng-qa-test-plan/assets/test-coverage-template.md +92 -0
  123. package/skills/eng-qa-test-plan/assets/test-patterns.md +178 -0
  124. package/skills/eng-qa-testsprite/SKILL.md +325 -0
  125. package/skills/eng-qa-testsprite/references/testsprite-mcp.md +224 -0
  126. package/skills/eng-qa-unit-test/SKILL.md +471 -0
  127. package/skills/eng-rabbitmq/SKILL.md +661 -0
  128. package/skills/eng-scraper/SKILL.md +683 -0
  129. package/skills/eng-scraper-robot-builder/SKILL.md +370 -0
  130. package/skills/eng-security-patch/SKILL.md +378 -0
  131. package/skills/eng-security-triage/SKILL.md +266 -0
  132. package/skills/eng-task-comment/SKILL.md +60 -0
  133. package/skills/eng-tech-analyst/SKILL.md +529 -0
  134. package/skills/eng-threat-model/SKILL.md +161 -0
  135. package/skills/init-jarvis/SKILL.md +1304 -0
  136. package/skills/init-jarvis/assets/mcp-configs.md +389 -0
  137. package/skills/init-jarvis/assets/onboarding-checklist.md +104 -0
  138. package/skills/init-jarvis/assets/setup-guide.md +360 -0
  139. package/skills/lovable-prompt-generator/SKILL.md +304 -0
  140. package/skills/prod-roadmap-report/README.md +303 -0
  141. package/skills/prod-roadmap-report/SKILL.md +198 -0
  142. package/skills/prod-roadmap-report/commands/status.compiled.single.team.md +23 -0
  143. package/skills/prod-roadmap-report/commands/status.list.projects.md +17 -0
  144. package/skills/prod-roadmap-report/commands/status.memory.md +192 -0
  145. package/skills/prod-roadmap-report/commands/status.roadmap.preview.md +94 -0
  146. package/skills/prod-roadmap-report/references/detailed-guide.md +236 -0
  147. package/skills/prod-roadmap-report/rules/detailed-guide.md +237 -0
  148. package/skills/prod-roadmap-report/rules/status-report-rules.md +44 -0
  149. package/skills/prod-roadmap-report/templates/template-multiple-teams-compiled-status.md +53 -0
  150. package/skills/prod-roadmap-report/templates/template-projects-list.md +23 -0
  151. package/skills/prod-roadmap-report/templates/template-single-team-compiled-status.md +60 -0
  152. package/skills/prod-roadmap-report/templates/template-single-team-status.md +49 -0
  153. package/skills/prod-specs/SKILL.md +108 -0
  154. package/skills/prod-specs/references/prod.spec.clarify.md +176 -0
  155. package/skills/prod-specs/references/prod.spec.epic.md +107 -0
  156. package/skills/prod-specs/references/prod.spec.frd.md +135 -0
  157. package/skills/prod-specs/references/prod.spec.issue.md +145 -0
  158. package/skills/prod-specs/references/prod.spec.prd.md +118 -0
  159. package/skills/prod-specs/rules/prod-spec-rules.md +186 -0
  160. package/skills/prod-specs/templates/prod-breakdown-template.md +136 -0
  161. package/skills/prod-specs/templates/prod-epic-template.md +76 -0
  162. package/skills/prod-specs/templates/prod-frd-template.md +172 -0
  163. package/skills/prod-specs/templates/prod-issue-template.md +68 -0
  164. package/skills/prod-specs/templates/prod-prd-full-template.md +159 -0
  165. package/skills/prod-specs/templates/prod-prd-template.md +173 -0
  166. package/skills/prod-specs-update/SKILL.md +272 -0
  167. package/skills/report-issue/SKILL.md +156 -0
  168. package/taxonomy.md +270 -0
  169. package/templates/AGENTS.md +189 -0
  170. package/templates/CDD aplicado a Prompts.md +182 -0
  171. package/templates/ENV-template.md +187 -0
  172. package/templates/engineering/AGENTS-template.md +71 -0
  173. package/templates/engineering/ARD-template.md +193 -0
  174. package/templates/engineering/CONTACTS-template.md +135 -0
  175. package/templates/engineering/PR-template.md +40 -0
  176. package/templates/engineering/RFC-Playbook.md +325 -0
  177. package/templates/engineering/RFC-template.md +199 -0
  178. package/templates/engineering/architecture-template.md +277 -0
  179. package/templates/engineering/breakdown-subtasks-template.md +582 -0
  180. package/templates/engineering/c4-model-template.md +516 -0
  181. package/templates/engineering/data-contract-template.md +135 -0
  182. package/templates/engineering/data-pipeline-template.md +163 -0
  183. package/templates/engineering/plan-template.md +255 -0
  184. package/templates/engineering/qa/eng.qa.quality-gate-examples-template.md +311 -0
  185. package/templates/engineering/qa/eng.qa.quality-gate-report-template.md +249 -0
  186. package/templates/engineering/qa/qa.cypress-test-template.md +172 -0
  187. package/templates/engineering/qa/qa.exploratory-session-template.md +148 -0
  188. package/templates/engineering/qa/qa.quality-report-template.md +130 -0
  189. package/templates/engineering/qa/qa.release-signoff-template.md +54 -0
  190. package/templates/engineering/qa/qa.sprint-plan-template.md +49 -0
  191. package/templates/engineering/swagger-template.md +145 -0
  192. package/templates/engineering/tech-spec-template.md +497 -0
  193. package/templates/engineering/work-progress-template.md +155 -0
  194. package/workflows/AGENTS.md +240 -0
  195. package/workflows/README.md +160 -0
  196. package/workflows/all-tools.md +11 -0
  197. package/workflows/engineering/data/data.contract.md +202 -0
  198. package/workflows/engineering/data/data.new-pipeline.md +234 -0
  199. package/workflows/engineering/eng.breakdown-subtasks.md +420 -0
  200. package/workflows/engineering/eng.bug-audit.md +591 -0
  201. package/workflows/engineering/eng.build-tech-spec.md +1116 -0
  202. package/workflows/engineering/eng.create-ard-from-code.md +259 -0
  203. package/workflows/engineering/eng.create-ard.md +382 -0
  204. package/workflows/engineering/eng.create-rfc.md +245 -0
  205. package/workflows/engineering/eng.debug.md +479 -0
  206. package/workflows/engineering/eng.docs.md +40 -0
  207. package/workflows/engineering/eng.light-arch.md +84 -0
  208. package/workflows/engineering/eng.plan.md +213 -0
  209. package/workflows/engineering/eng.pr.md +466 -0
  210. package/workflows/engineering/eng.pre-pr.md +167 -0
  211. package/workflows/engineering/eng.review.md +185 -0
  212. package/workflows/engineering/eng.rpa.robot.md +342 -0
  213. package/workflows/engineering/eng.security-audit.md +312 -0
  214. package/workflows/engineering/eng.security-incident.md +275 -0
  215. package/workflows/engineering/eng.security-pipeline.md +210 -0
  216. package/workflows/engineering/eng.security-review.md +235 -0
  217. package/workflows/engineering/eng.start.md +494 -0
  218. package/workflows/engineering/eng.work.md +558 -0
  219. package/workflows/engineering/frontend/eng.frontend-component.md +190 -0
  220. package/workflows/engineering/frontend/eng.frontend-perf-audit.md +375 -0
  221. package/workflows/engineering/frontend/eng.frontend-review.md +185 -0
  222. package/workflows/engineering/qa/eng.qa-dev-quality-guide.md +51 -0
  223. package/workflows/engineering/qa/eng.qa-e2e-test-generation.md +51 -0
  224. package/workflows/engineering/qa/eng.qa-exploratory-session.md +60 -0
  225. package/workflows/engineering/qa/eng.qa-quality-gate-validation.md +202 -0
  226. package/workflows/engineering/qa/eng.qa-quality-report.md +83 -0
  227. package/workflows/engineering/qa/eng.qa-refinement-entry.md +83 -0
  228. package/workflows/engineering/qa/eng.qa-release-signoff.md +170 -0
  229. package/workflows/engineering/qa/eng.qa-sprint-planning.md +100 -0
  230. package/workflows/engineering/ta/eng.ta.atendimento.md +93 -0
  231. package/workflows/product/prod.roadmap.preview.md +110 -0
  232. package/workflows/product/prod.spec.breakdown.md +163 -0
  233. package/workflows/product/prod.spec.clarify.md +178 -0
  234. package/workflows/product/prod.spec.epic.md +154 -0
  235. package/workflows/product/prod.spec.frd.md +96 -0
  236. package/workflows/product/prod.spec.issue.md +145 -0
  237. package/workflows/product/prod.spec.md +60 -0
  238. package/workflows/product/prod.spec.prd.md +100 -0
  239. package/workflows/taxonomy.md +92 -0
  240. package/workflows/warm-up.md +574 -0
@@ -0,0 +1,516 @@
1
+ # Templates C4 Model
2
+
3
+ Templates prontos para documentação de arquitetura usando C4 Model.
4
+
5
+ ---
6
+
7
+ ## 1. Context Diagram - Completo
8
+
9
+ ```plantuml
10
+ @startuml C4_Context
11
+ !include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Context.puml
12
+
13
+ LAYOUT_TOP_DOWN()
14
+ LAYOUT_WITH_LEGEND()
15
+
16
+ title Sistema de [Nome] - Diagrama de Contexto
17
+
18
+ ' === PERSONAS ===
19
+ Person(customer, "Cliente", "Usuário final que utiliza o sistema")
20
+ Person(admin, "Administrador", "Gerencia configurações e usuários")
21
+ Person(support, "Suporte", "Atende chamados e monitora sistema")
22
+
23
+ ' === SISTEMA PRINCIPAL ===
24
+ System(system, "Nome do Sistema", "Descrição completa do que o sistema faz e seu propósito principal")
25
+
26
+ ' === SISTEMAS EXTERNOS ===
27
+ System_Ext(payment, "Gateway de Pagamento", "Processa transações financeiras")
28
+ System_Ext(email, "Serviço de Email", "Envia notificações por email")
29
+ System_Ext(sms, "Serviço de SMS", "Envia notificações por SMS")
30
+ System_Ext(erp, "ERP Corporativo", "Sistema legado de gestão")
31
+
32
+ ' === RELACIONAMENTOS ===
33
+ Rel(customer, system, "Usa", "HTTPS/Browser")
34
+ Rel(admin, system, "Configura", "HTTPS/Browser")
35
+ Rel(support, system, "Monitora", "HTTPS/Browser")
36
+
37
+ Rel(system, payment, "Processa pagamentos", "REST/HTTPS")
38
+ Rel(system, email, "Envia emails", "SMTP/API")
39
+ Rel(system, sms, "Envia SMS", "REST/HTTPS")
40
+ Rel_L(system, erp, "Sincroniza dados", "REST/HTTPS")
41
+
42
+ @enduml
43
+ ```
44
+
45
+ ---
46
+
47
+ ## 2. Container Diagram - Microservices
48
+
49
+ ```plantuml
50
+ @startuml C4_Container
51
+ !include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml
52
+
53
+ LAYOUT_TOP_DOWN()
54
+ LAYOUT_WITH_LEGEND()
55
+
56
+ title Sistema de [Nome] - Diagrama de Contêineres
57
+
58
+ Person(user, "Usuário", "Usuário do sistema")
59
+
60
+ System_Boundary(system, "Sistema Principal") {
61
+
62
+ ' === FRONTEND ===
63
+ Container(spa, "Single Page Application", "React, TypeScript", "Interface web responsiva")
64
+ Container(mobile, "Mobile App", "React Native", "Aplicativo iOS/Android")
65
+
66
+ ' === API GATEWAY ===
67
+ Container(gateway, "API Gateway", "Kong/NGINX", "Roteamento, auth, rate limiting")
68
+
69
+ ' === MICROSERVICES ===
70
+ Container(auth, "Auth Service", "Node.js, Express", "Autenticação e autorização")
71
+ Container(users, "Users Service", "Node.js, Express", "Gestão de usuários")
72
+ Container(orders, "Orders Service", "Node.js, Express", "Gestão de pedidos")
73
+ Container(notifications, "Notifications Service", "Node.js", "Envio de notificações")
74
+
75
+ ' === DADOS ===
76
+ ContainerDb(authdb, "Auth DB", "PostgreSQL", "Credenciais e tokens")
77
+ ContainerDb(usersdb, "Users DB", "PostgreSQL", "Dados de usuários")
78
+ ContainerDb(ordersdb, "Orders DB", "PostgreSQL", "Dados de pedidos")
79
+ ContainerDb(cache, "Cache", "Redis", "Cache e sessões")
80
+
81
+ ' === MENSAGERIA ===
82
+ ContainerQueue(queue, "Message Broker", "RabbitMQ", "Eventos assíncronos")
83
+ }
84
+
85
+ ' === EXTERNOS ===
86
+ System_Ext(payment, "Payment Gateway", "Stripe/PagSeguro")
87
+ System_Ext(email, "Email Service", "SendGrid/SES")
88
+
89
+ ' === RELACIONAMENTOS FRONTEND ===
90
+ Rel(user, spa, "Usa", "HTTPS")
91
+ Rel(user, mobile, "Usa", "HTTPS")
92
+ Rel(spa, gateway, "Consome", "REST/JSON")
93
+ Rel(mobile, gateway, "Consome", "REST/JSON")
94
+
95
+ ' === RELACIONAMENTOS GATEWAY -> SERVICES ===
96
+ Rel(gateway, auth, "Roteia", "REST")
97
+ Rel(gateway, users, "Roteia", "REST")
98
+ Rel(gateway, orders, "Roteia", "REST")
99
+
100
+ ' === RELACIONAMENTOS SERVICES -> DB ===
101
+ Rel(auth, authdb, "Lê/Escreve", "SQL")
102
+ Rel(auth, cache, "Cache", "Redis Protocol")
103
+ Rel(users, usersdb, "Lê/Escreve", "SQL")
104
+ Rel(orders, ordersdb, "Lê/Escreve", "SQL")
105
+
106
+ ' === RELACIONAMENTOS ASSÍNCRONOS ===
107
+ Rel(orders, queue, "Publica eventos", "AMQP")
108
+ Rel(notifications, queue, "Consome eventos", "AMQP")
109
+
110
+ ' === RELACIONAMENTOS EXTERNOS ===
111
+ Rel(orders, payment, "Processa", "REST")
112
+ Rel(notifications, email, "Envia", "REST")
113
+
114
+ @enduml
115
+ ```
116
+
117
+ ---
118
+
119
+ ## 3. Container Diagram - Monolito
120
+
121
+ ```plantuml
122
+ @startuml C4_Container_Monolith
123
+ !include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml
124
+
125
+ LAYOUT_WITH_LEGEND()
126
+
127
+ title Sistema [Nome] - Arquitetura Monolítica
128
+
129
+ Person(user, "Usuário", "Usuário do sistema")
130
+
131
+ System_Boundary(system, "Sistema") {
132
+ Container(web, "Web Application", "Next.js, React", "SSR e interface do usuário")
133
+ Container(api, "Backend API", "Node.js, Express", "API REST e lógica de negócio")
134
+ ContainerDb(db, "Database", "PostgreSQL", "Dados da aplicação")
135
+ ContainerDb(cache, "Cache", "Redis", "Cache e filas")
136
+ Container(worker, "Background Worker", "Node.js, Bull", "Jobs assíncronos")
137
+ Container(storage, "Object Storage", "MinIO/S", "Arquivos e mídia")
138
+ }
139
+
140
+ System_Ext(email, "Email", "SMTP")
141
+ System_Ext(payment, "Pagamento", "API")
142
+
143
+ Rel(user, web, "Acessa", "HTTPS")
144
+ Rel(web, api, "Consome", "REST/JSON")
145
+ Rel(api, db, "Persiste", "SQL")
146
+ Rel(api, cache, "Cache", "Redis")
147
+ Rel(api, storage, "Upload/Download", "S API")
148
+ Rel(worker, cache, "Processa filas", "Redis")
149
+ Rel(worker, db, "Atualiza", "SQL")
150
+ Rel(api, email, "Envia", "SMTP")
151
+ Rel(api, payment, "Processa", "REST")
152
+
153
+ @enduml
154
+ ```
155
+
156
+ ---
157
+
158
+ ## 4. Component Diagram - Clean Architecture
159
+
160
+ ```plantuml
161
+ @startuml C4_Component_Clean
162
+ !include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Component.puml
163
+
164
+ LAYOUT_WITH_LEGEND()
165
+
166
+ title API Backend - Componentes (Clean Architecture)
167
+
168
+ Container_Boundary(api, "API Backend") {
169
+
170
+ ' === PRESENTATION LAYER ===
171
+ Component(controllers, "Controllers", "Express Router", "Handlers HTTP, validação de entrada")
172
+ Component(middleware, "Middlewares", "Express", "Auth, logging, error handling")
173
+ Component(presenters, "Presenters", "TypeScript", "Formatação de resposta")
174
+
175
+ ' === APPLICATION LAYER ===
176
+ Component(usecases, "Use Cases", "TypeScript", "Orquestração de lógica de negócio")
177
+ Component(dtos, "DTOs", "TypeScript", "Data Transfer Objects")
178
+ Component(mappers, "Mappers", "TypeScript", "Conversão Entity <-> DTO")
179
+
180
+ ' === DOMAIN LAYER ===
181
+ Component(entities, "Entities", "TypeScript", "Entidades de domínio")
182
+ Component(valueobjects, "Value Objects", "TypeScript", "Objetos de valor imutáveis")
183
+ Component(domainservices, "Domain Services", "TypeScript", "Lógica de domínio complexa")
184
+ Component(repositories_if, "Repository Interfaces", "TypeScript", "Contratos de persistência")
185
+
186
+ ' === INFRASTRUCTURE LAYER ===
187
+ Component(repositories, "Repositories", "TypeORM/Prisma", "Implementação de persistência")
188
+ Component(external, "External Services", "TypeScript", "Clientes de APIs externas")
189
+ Component(queue, "Queue Adapters", "TypeScript", "Publicação/consumo de mensagens")
190
+ }
191
+
192
+ ' === EXTERNOS ===
193
+ ContainerDb(db, "Database", "PostgreSQL")
194
+ ContainerQueue(mq, "Message Queue", "RabbitMQ")
195
+ Container_Ext(ext, "External API", "Third-party")
196
+
197
+ ' === FLUXO: Presentation -> Application ===
198
+ Rel(controllers, middleware, "Usa")
199
+ Rel(controllers, usecases, "Executa")
200
+ Rel(controllers, presenters, "Formata resposta")
201
+ Rel(usecases, dtos, "Usa")
202
+ Rel(usecases, mappers, "Converte")
203
+
204
+ ' === FLUXO: Application -> Domain ===
205
+ Rel(usecases, entities, "Manipula")
206
+ Rel(usecases, domainservices, "Usa")
207
+ Rel(usecases, repositories_if, "Depende de")
208
+ Rel(domainservices, entities, "Opera sobre")
209
+ Rel(entities, valueobjects, "Contém")
210
+
211
+ ' === FLUXO: Infrastructure (implementa interfaces) ===
212
+ Rel(repositories, repositories_if, "Implementa")
213
+ Rel(repositories, db, "Persiste")
214
+ Rel(external, ext, "Integra")
215
+ Rel(queue, mq, "Publica/Consome")
216
+ Rel(usecases, external, "Usa")
217
+ Rel(usecases, queue, "Usa")
218
+
219
+ @enduml
220
+ ```
221
+
222
+ ---
223
+
224
+ ## 5. Component Diagram - Hexagonal (Ports & Adapters)
225
+
226
+ ```plantuml
227
+ @startuml C4_Component_Hexagonal
228
+ !include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Component.puml
229
+
230
+ LAYOUT_WITH_LEGEND()
231
+
232
+ title API - Arquitetura Hexagonal
233
+
234
+ Container_Boundary(api, "API") {
235
+
236
+ ' === DRIVING ADAPTERS (entrada) ===
237
+ Component(rest, "REST Adapter", "Express", "Endpoints HTTP")
238
+ Component(graphql, "GraphQL Adapter", "Apollo", "Queries e Mutations")
239
+ Component(grpc, "gRPC Adapter", "gRPC", "Comunicação entre serviços")
240
+ Component(consumer, "Queue Consumer", "RabbitMQ", "Processa mensagens")
241
+
242
+ ' === PORTS (interfaces) ===
243
+ Component(inbound, "Inbound Ports", "TypeScript Interfaces", "Contratos de entrada")
244
+ Component(outbound, "Outbound Ports", "TypeScript Interfaces", "Contratos de saída")
245
+
246
+ ' === CORE (domínio) ===
247
+ Component(application, "Application Services", "TypeScript", "Casos de uso")
248
+ Component(domain, "Domain Model", "TypeScript", "Entidades e regras")
249
+
250
+ ' === DRIVEN ADAPTERS (saída) ===
251
+ Component(dbadapter, "Database Adapter", "Prisma", "Persistência")
252
+ Component(cacheadapter, "Cache Adapter", "Redis Client", "Cache")
253
+ Component(httpadapter, "HTTP Adapter", "Axios", "APIs externas")
254
+ Component(publisher, "Queue Publisher", "RabbitMQ", "Publica mensagens")
255
+ }
256
+
257
+ ' === EXTERNOS ===
258
+ ContainerDb(db, "Database", "PostgreSQL")
259
+ ContainerDb(cache, "Cache", "Redis")
260
+ ContainerQueue(queue, "Queue", "RabbitMQ")
261
+ Container_Ext(ext, "External API", "Third-party")
262
+
263
+ ' === DRIVING -> PORTS -> CORE ===
264
+ Rel(rest, inbound, "Usa")
265
+ Rel(graphql, inbound, "Usa")
266
+ Rel(grpc, inbound, "Usa")
267
+ Rel(consumer, inbound, "Usa")
268
+ Rel(inbound, application, "Define contrato")
269
+ Rel(application, domain, "Usa")
270
+
271
+ ' === CORE -> PORTS -> DRIVEN ===
272
+ Rel(application, outbound, "Depende de")
273
+ Rel(dbadapter, outbound, "Implementa")
274
+ Rel(cacheadapter, outbound, "Implementa")
275
+ Rel(httpadapter, outbound, "Implementa")
276
+ Rel(publisher, outbound, "Implementa")
277
+
278
+ ' === DRIVEN -> EXTERNOS ===
279
+ Rel(dbadapter, db, "Conecta")
280
+ Rel(cacheadapter, cache, "Conecta")
281
+ Rel(publisher, queue, "Publica")
282
+ Rel(httpadapter, ext, "Chama")
283
+
284
+ @enduml
285
+ ```
286
+
287
+ ---
288
+
289
+ ## 6. Code Diagram (Nível 4) - UML Classes
290
+
291
+ ```plantuml
292
+ @startuml
293
+ !theme plain
294
+ skinparam classAttributeIconSize 0
295
+ skinparam classFontStyle bold
296
+
297
+ title Diagrama de Código - [Nome do Componente]
298
+
299
+ ' === INTERFACES ===
300
+ interface IUserRepository {
301
+ +findById(id: string): Promise<User>
302
+ +findByEmail(email: string): Promise<User>
303
+ +save(user: User): Promise<void>
304
+ +delete(id: string): Promise<void>
305
+ }
306
+
307
+ interface IEmailService {
308
+ +send(to: string, subject: string, body: string): Promise<void>
309
+ +sendTemplate(to: string, template: string, data: object): Promise<void>
310
+ }
311
+
312
+ interface IEventPublisher {
313
+ +publish(event: DomainEvent): Promise<void>
314
+ }
315
+
316
+ ' === VALUE OBJECTS ===
317
+ class Email <<Value Object>> {
318
+ -value: string
319
+ +{static} create(value: string): Email
320
+ +validate(): boolean
321
+ +toString(): string
322
+ +equals(other: Email): boolean
323
+ }
324
+
325
+ class Name <<Value Object>> {
326
+ -firstName: string
327
+ -lastName: string
328
+ +{static} create(first: string, last: string): Name
329
+ +fullName(): string
330
+ +equals(other: Name): boolean
331
+ }
332
+
333
+ class UserId <<Value Object>> {
334
+ -value: string
335
+ +{static} generate(): UserId
336
+ +{static} fromString(value: string): UserId
337
+ +toString(): string
338
+ }
339
+
340
+ ' === ENTIDADES ===
341
+ class User <<Aggregate Root>> {
342
+ -id: UserId
343
+ -email: Email
344
+ -name: Name
345
+ -status: UserStatus
346
+ -createdAt: Date
347
+ -updatedAt: Date
348
+ --
349
+ +{static} create(props: CreateUserProps): User
350
+ +changeEmail(email: Email): void
351
+ +changeName(name: Name): void
352
+ +activate(): void
353
+ +deactivate(): void
354
+ +isActive(): boolean
355
+ }
356
+
357
+ enum UserStatus {
358
+ ACTIVE
359
+ INACTIVE
360
+ PENDING
361
+ SUSPENDED
362
+ }
363
+
364
+ ' === DOMAIN EVENTS ===
365
+ abstract class DomainEvent <<Event>> {
366
+ +eventId: string
367
+ +occurredAt: Date
368
+ +aggregateId: string
369
+ }
370
+
371
+ class UserCreatedEvent <<Event>> {
372
+ +userId: string
373
+ +email: string
374
+ }
375
+
376
+ class UserEmailChangedEvent <<Event>> {
377
+ +userId: string
378
+ +oldEmail: string
379
+ +newEmail: string
380
+ }
381
+
382
+ ' === APPLICATION SERVICES ===
383
+ class CreateUserUseCase <<Use Case>> {
384
+ -userRepository: IUserRepository
385
+ -emailService: IEmailService
386
+ -eventPublisher: IEventPublisher
387
+ --
388
+ +execute(input: CreateUserInput): Promise<CreateUserOutput>
389
+ }
390
+
391
+ class UpdateUserUseCase <<Use Case>> {
392
+ -userRepository: IUserRepository
393
+ -eventPublisher: IEventPublisher
394
+ --
395
+ +execute(input: UpdateUserInput): Promise<UpdateUserOutput>
396
+ }
397
+
398
+ ' === RELACIONAMENTOS ===
399
+ User -- UserId : identity
400
+ User -- Email : contains
401
+ User -- Name : contains
402
+ User -- UserStatus : has
403
+ User ..> DomainEvent : raises
404
+
405
+ UserCreatedEvent --|> DomainEvent
406
+ UserEmailChangedEvent --|> DomainEvent
407
+
408
+ CreateUserUseCase ..> IUserRepository : uses
409
+ CreateUserUseCase ..> IEmailService : uses
410
+ CreateUserUseCase ..> IEventPublisher : uses
411
+ CreateUserUseCase ..> User : creates
412
+
413
+ UpdateUserUseCase ..> IUserRepository : uses
414
+ UpdateUserUseCase ..> IEventPublisher : uses
415
+ UpdateUserUseCase ..> User : updates
416
+
417
+ @enduml
418
+ ```
419
+
420
+ ---
421
+
422
+ ## 7. Mermaid - Context (alternativa sem PlantUML)
423
+
424
+ ```mermaid
425
+ C4Context
426
+ title Sistema de Exemplo - Contexto
427
+
428
+ Person(customer, "Cliente", "Usuário final")
429
+ Person(admin, "Admin", "Administrador")
430
+
431
+ System(system, "Sistema Principal", "Aplicação web")
432
+
433
+ System_Ext(payment, "Pagamento", "Gateway")
434
+ System_Ext(email, "Email", "Notificações")
435
+
436
+ Rel(customer, system, "Usa")
437
+ Rel(admin, system, "Gerencia")
438
+ Rel(system, payment, "Processa")
439
+ Rel(system, email, "Envia")
440
+ ```
441
+
442
+ ---
443
+
444
+ ## 8. Mermaid - Container (alternativa sem PlantUML)
445
+
446
+ ```mermaid
447
+ C4Container
448
+ title Sistema - Contêineres
449
+
450
+ Person(user, "Usuário", "")
451
+
452
+ System_Boundary(b, "Sistema") {
453
+ Container(web, "Web App", "React", "UI")
454
+ Container(api, "API", "Node.js", "Backend")
455
+ ContainerDb(db, "Database", "PostgreSQL", "Dados")
456
+ }
457
+
458
+ System_Ext(ext, "Externo", "API")
459
+
460
+ Rel(user, web, "Usa")
461
+ Rel(web, api, "REST")
462
+ Rel(api, db, "SQL")
463
+ Rel(api, ext, "HTTP")
464
+ ```
465
+
466
+ ---
467
+
468
+ ## Referência Rápida
469
+
470
+ ### Elementos
471
+
472
+ | Elemento | Sintaxe | Uso |
473
+ |----------|---------|-----|
474
+ | Pessoa | `Person(id, "Nome", "Desc")` | Usuários do sistema |
475
+ | Sistema | `System(id, "Nome", "Desc")` | Sistema interno |
476
+ | Sistema Externo | `System_Ext(id, "Nome", "Desc")` | Terceiros |
477
+ | Contêiner | `Container(id, "Nome", "Tech", "Desc")` | Apps, APIs |
478
+ | Banco de Dados | `ContainerDb(id, "Nome", "Tech", "Desc")` | Databases |
479
+ | Fila | `ContainerQueue(id, "Nome", "Tech", "Desc")` | Mensageria |
480
+ | Componente | `Component(id, "Nome", "Tech", "Desc")` | Módulos internos |
481
+
482
+ ### Relacionamentos
483
+
484
+ | Sintaxe | Descrição |
485
+ |---------|-----------|
486
+ | `Rel(from, to, "label")` | Relacionamento simples |
487
+ | `Rel(from, to, "label", "tech")` | Com tecnologia |
488
+ | `Rel_D(from, to, "label")` | Direção para baixo |
489
+ | `Rel_R(from, to, "label")` | Direção para direita |
490
+ | `Rel_L(from, to, "label")` | Direção para esquerda |
491
+ | `Rel_U(from, to, "label")` | Direção para cima |
492
+
493
+ ### Boundaries
494
+
495
+ | Sintaxe | Uso |
496
+ |---------|-----|
497
+ | `System_Boundary(id, "name") { }` | Agrupa contêineres |
498
+ | `Container_Boundary(id, "name") { }` | Agrupa componentes |
499
+ | `Enterprise_Boundary(id, "name") { }` | Agrupa sistemas |
500
+
501
+ ### Layouts
502
+
503
+ ```plantuml
504
+ LAYOUT_TOP_DOWN() ' Vertical (padrão)
505
+ LAYOUT_LEFT_RIGHT() ' Horizontal
506
+ LAYOUT_WITH_LEGEND() ' Com legenda
507
+ LAYOUT_LANDSCAPE() ' Paisagem
508
+ ```
509
+
510
+ ---
511
+
512
+ ## Referências
513
+
514
+ - [C4 Model](https://c4model.com/)
515
+ - [C4-PlantUML](https://github.com/plantuml-stdlib/C4-PlantUML)
516
+ - [Structurizr](https://structurizr.com/)
@@ -0,0 +1,135 @@
1
+ # Contrato de Dados: {{NOME_DO_CONTRATO}}
2
+
3
+ > **Versão:** 1.0 | **Owner:** {{EMAIL_OWNER}} | **Criado em:** {{DATA}}
4
+
5
+ ---
6
+
7
+ ## Identificação
8
+
9
+ | Campo | Valor |
10
+ |-------|-------|
11
+ | **Nome do contrato** | {{NOME_DO_CONTRATO}} |
12
+ | **Tabela / recurso** | `gold.{{NOME_TABELA}}` |
13
+ | **Squad dona dos dados** | DATA |
14
+ | **Squad requisitante** | {{SQUAD_REQUISITANTE}} |
15
+ | **Caso de uso** | {{CASO_DE_USO}} |
16
+ | **Status** | Ativo / Em revisão / Deprecado |
17
+ | **Criado em** | {{DATA}} |
18
+ | **Válido até** | {{DATA_EXPIRACAO}} (ou "Indeterminado") |
19
+
20
+ ---
21
+
22
+ ## Descrição
23
+
24
+ > O que esses dados representam? Qual o contexto de negócio?
25
+
26
+ {{DESCRICAO}}
27
+
28
+ ---
29
+
30
+ ## Como Acessar
31
+
32
+ | Método | Detalhe |
33
+ |--------|---------|
34
+ | **Athena** | `SELECT * FROM gold.{{NOME_TABELA}} WHERE data_referencia = '{{DATA}}'` |
35
+ | **S3** | `s3://YOUR-DATA-LAKE/gold/{{DOMINIO}}/{{NOME_TABELA}}/` |
36
+ | **Metabase** | Dashboard: [{{NOME_DASHBOARD}}]({{LINK_DASHBOARD}}) |
37
+ | **Acesso IAM** | Role necessária: `{{IAM_ROLE}}` |
38
+
39
+ > Solicitação de acesso: canal `$DATA_REQUESTS_CHANNEL` + card no task manager.
40
+
41
+ ---
42
+
43
+ ## SLA de Atualização
44
+
45
+ | Campo | Valor |
46
+ |-------|-------|
47
+ | **Frequência** | {{FREQUENCIA}} (ex: diário às 07h, horário) |
48
+ | **SLA de disponibilidade** | {{SLA}} (ex: dados do dia D disponíveis até 07h30 do dia D+1) |
49
+ | **Janela de reprocessamento** | {{JANELA}} (ex: últimos 7 dias sob solicitação) |
50
+ | **Pipeline que alimenta** | {{NOME_PIPELINE}} |
51
+
52
+ ---
53
+
54
+ ## Schema
55
+
56
+ | Campo | Tipo | Nulável | Sensível | Descrição |
57
+ |-------|------|---------|---------|-----------|
58
+ | `id_{{entidade}}` | `string` | Não | Não | Chave primária |
59
+ | `data_referencia` | `date` | Não | Não | Data de referência da partição |
60
+ | `ingested_at` | `timestamp` | Não | Não | Timestamp de ingestão |
61
+ | `{{campo}}` | `{{tipo}}` | Sim/Não | Sim/Não | {{descricao}} |
62
+
63
+ ---
64
+
65
+ ## Campos Sensíveis e Restrições
66
+
67
+ | Campo | Tipo de Dado Sensível | Tratamento Aplicado | Restrição de Uso |
68
+ |-------|----------------------|---------------------|-----------------|
69
+ | {{campo}} | CPF / dados pessoais | Mascarado (últimos 3 dígitos visíveis) | Não exibir em dashboards públicos |
70
+
71
+ > Se não houver campos sensíveis: N/A
72
+
73
+ ---
74
+
75
+ ## Definições de Negócio
76
+
77
+ > Glossário dos campos e métricas — o que significa cada coisa nesse contexto.
78
+
79
+ | Termo | Definição |
80
+ |-------|-----------|
81
+ | `{{campo}}` | {{definicao}} |
82
+
83
+ ---
84
+
85
+ ## Particionamento e Performance
86
+
87
+ | Coluna de partição | `data_referencia` |
88
+ |--------------------|------------------|
89
+ | **Volume estimado** | {{VOLUME}} (ex: ~100k rows/dia) |
90
+ | **Retenção** | {{RETENCAO}} (ex: 2 anos, indeterminado) |
91
+ | **Dica de query** | Sempre filtrar por `data_referencia` para evitar full scan |
92
+
93
+ ```sql
94
+ -- Query recomendada (filtro por partição obrigatório)
95
+ SELECT *
96
+ FROM gold.{{NOME_TABELA}}
97
+ WHERE data_referencia BETWEEN '{{DATA_INICIO}}' AND '{{DATA_FIM}}'
98
+ ```
99
+
100
+ ---
101
+
102
+ ## Qualidade Garantida
103
+
104
+ | Check | Frequência | Resultado esperado |
105
+ |-------|-----------|-------------------|
106
+ | Volume mínimo | A cada execução | ≥ 1 row |
107
+ | Nulos em PK | A cada execução | 0 nulos |
108
+ | Unicidade de PK | A cada execução | 0 duplicatas |
109
+ | {{check_negocio}} | {{frequencia}} | {{resultado}} |
110
+
111
+ ---
112
+
113
+ ## Casos de Uso Aprovados
114
+
115
+ | Squad | Caso de uso | Tipo de acesso |
116
+ |-------|------------|----------------|
117
+ | {{SQUAD}} | {{CASO_DE_USO}} | Athena / Metabase |
118
+
119
+ ---
120
+
121
+ ## Processo de Alteração
122
+
123
+ Qualquer alteração de schema (adição, remoção ou mudança de tipo de campo) deve:
124
+
125
+ 1. Ser comunicada no canal `$DATA_REQUESTS_CHANNEL` com **7 dias de antecedência**
126
+ 2. Ter nova versão do contrato criada (versionamento semântico: `MAJOR.MINOR`)
127
+ 3. Período de coexistência: versão antiga disponível por **30 dias** após nova versão publicada
128
+
129
+ ---
130
+
131
+ ## Histórico de Versões
132
+
133
+ | Versão | Data | Autor | Descrição |
134
+ |--------|------|-------|-----------|
135
+ | 1.0 | {{DATA}} | {{AUTOR}} | Criação inicial |