@bricks2k/governance 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.
package/LICENSE ADDED
@@ -0,0 +1,51 @@
1
+ Licença MIT / MIT License
2
+
3
+ Copyright (c) 2026 bricks2k 🇧🇷
4
+
5
+ ---
6
+
7
+ ## [PT-BR] Português do Brasil
8
+
9
+ É concedida permissão, gratuitamente, a qualquer pessoa que obtenha uma cópia
10
+ deste software e dos arquivos de documentação associados (o "Software"), para
11
+ lidar com o Software sem restrições, incluindo, sem limitação, os direitos de
12
+ usar, copiar, modificar, mesclar, publicar, distribuir, sublicenciar e/ou vender
13
+ cópias do Software, e para permitir que as pessoas a quem o Software é fornecido
14
+ o façam, sob as seguintes condições:
15
+
16
+ O aviso de copyright acima e este aviso de permissão devem ser incluídos em todas
17
+ as cópias ou partes substanciais do Software.
18
+
19
+ O SOFTWARE É FORNECIDO "COMO ESTÁ", SEM GARANTIA DE QUALQUER TIPO, EXPRESSA OU
20
+ IMPLÍCITA, INCLUINDO, MAS NÃO SE LIMITANDO ÀS GARANTIAS DE COMERCIALIZAÇÃO,
21
+ ADEQUAÇÃO A UM PROPÓSITO ESPECÍFICO E NÃO VIOLAÇÃO. EM NENHUM CASO OS AUTORES OU
22
+ TITULARES DOS DIREITOS AUTORAIS SERÃO RESPONSÁVEIS POR QUALQUER RECLAMAÇÃO, DANOS
23
+ OU OUTRA RESPONSABILIDADE, SEJA EM AÇÃO DE CONTRATO, ATO ILÍCITO OU DE OUTRA FORMA,
24
+ DECORRENTE DE, FORA DE OU EM CONEXÃO COM O SOFTWARE OU O USO OU OUTRAS NEGOCIAÇÕES
25
+ NO SOFTWARE.
26
+
27
+ ---
28
+
29
+ ## [EN] English
30
+
31
+ Permission is hereby granted, free of charge, to any person obtaining a copy
32
+ of this software and associated documentation files (the "Software"), to deal
33
+ in the Software without restriction, including without limitation the rights
34
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
35
+ copies of the Software, and to permit persons to whom the Software is
36
+ furnished to do so, subject to the following conditions:
37
+
38
+ The above copyright notice and this permission notice shall be included in all
39
+ copies or substantial portions of the Software.
40
+
41
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
42
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
43
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
44
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
45
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
46
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
47
+ SOFTWARE.
48
+
49
+ ---
50
+
51
+ 🇧🇷 Feito com orgulho no Brasil | Made with pride in Brazil 🇧🇷
package/README.md ADDED
@@ -0,0 +1,357 @@
1
+ # @bricks2k/governance
2
+
3
+ > Sistema de governança para projetos React com gestão de débitos técnicos, backlog e logs de desenvolvimento.
4
+
5
+ ## 📋 Funcionalidades
6
+
7
+ - ✅ **Dashboard de Governança** - Visão unificada do projeto
8
+ - 📊 **Tech Debt Management** - Rastreamento de débitos técnicos
9
+ - 📦 **Backlog Management** - Gestão de features e melhorias
10
+ - 📝 **Logs System** - Histórico de arquitetura e decisões
11
+ - 🏗️ **Architecture View** - Visualização da arquitetura
12
+ - 🔧 **Supabase Integration** - Status e configuração do Supabase
13
+ - 🤖 **AI Assistant** - Assistente de desenvolvimento
14
+
15
+ ## 🚀 Instalação
16
+
17
+ ```bash
18
+ npm install @bricks2k/governance
19
+ ```
20
+
21
+ ### Peer Dependencies
22
+
23
+ ```bash
24
+ npm install react react-dom
25
+ ```
26
+
27
+ ## 📦 Uso Básico
28
+
29
+ ### Sem Provider (Standalone)
30
+
31
+ ```jsx
32
+ import { GovernanceDashboard } from '@bricks2k/governance';
33
+
34
+ function App() {
35
+ return (
36
+ <GovernanceDashboard />
37
+ );
38
+ }
39
+ ```
40
+
41
+ ### Com Provider (Recomendado)
42
+
43
+ O `GovernanceProvider` permite injetar dependências e configurações customizadas:
44
+
45
+ ```jsx
46
+ import { GovernanceProvider, GovernanceDashboard } from '@bricks2k/governance';
47
+ import { copyToClipboard, maskCredential } from './lib/credentialUtils';
48
+ import { supabase } from './lib/supabase';
49
+ import { SUPABASE_CONFIG } from './lib/constants/supabaseConfig';
50
+ import { supabaseHealthCheck } from './lib/supabaseHealthCheck';
51
+
52
+ function App() {
53
+ return (
54
+ <GovernanceProvider
55
+ utils={{ copyToClipboard, maskCredential }}
56
+ client={supabase}
57
+ config={{ supabase: SUPABASE_CONFIG }}
58
+ healthCheck={supabaseHealthCheck}
59
+ >
60
+ <GovernanceDashboard />
61
+ </GovernanceProvider>
62
+ );
63
+ }
64
+ ```
65
+
66
+ ### Uso Avançado com Chat AI
67
+
68
+ ```jsx
69
+ import { GovernanceProvider } from '@bricks2k/governance';
70
+ import { DevAssistantTab } from '@bricks2k/governance';
71
+ import ChatInterface from './components/ai/ChatInterface';
72
+
73
+ function App() {
74
+ return (
75
+ <GovernanceProvider
76
+ utils={{ copyToClipboard, maskCredential }}
77
+ ChatInterface={ChatInterface}
78
+ chatConfig={{
79
+ endpoint: '/api/openrouter-ai-service',
80
+ context: 'development',
81
+ systemContext: 'React development project'
82
+ }}
83
+ >
84
+ <DevAssistantTab />
85
+ </GovernanceProvider>
86
+ );
87
+ }
88
+ ```
89
+
90
+ ## 🎨 Estilização
91
+
92
+ O pacote requer **Tailwind CSS** configurado no projeto host.
93
+
94
+ ### Tailwind Config
95
+
96
+ Adicione o caminho do pacote no `tailwind.config.js`:
97
+
98
+ ```javascript
99
+ module.exports = {
100
+ content: [
101
+ './src/**/*.{js,jsx,ts,tsx}',
102
+ './node_modules/@bricks2k/governance/dist/**/*.{js,jsx}' // ← Adicionar
103
+ ],
104
+ theme: {
105
+ extend: {},
106
+ },
107
+ plugins: [],
108
+ }
109
+ ```
110
+
111
+ ## 📄 Estrutura de Dados
112
+
113
+ ### Tech Debt Registry
114
+
115
+ Esperado em: `public/docs/TECHNICAL_DEBT_REGISTRY.md`
116
+
117
+ ```markdown
118
+ | TD-001 | Descrição | 🔴 Crítico | Trigger | Location | Owner | ⏳ Pendente | 2026-01-01 |
119
+ ```
120
+
121
+ ### Backlog Registry
122
+
123
+ Esperado em: `public/docs/BACKLOG_REGISTRY.md`
124
+
125
+ ```markdown
126
+ | BL-001 | Título | ✨ Feature | 📋 Backlog | Owner | M | 2026-01-01 |
127
+ ```
128
+
129
+ ### Logs
130
+
131
+ Esperados em: `public/.logs/`
132
+ - `architecture.log.md`
133
+ - `decisions.log.md`
134
+
135
+ ## 🔧 API Completa
136
+
137
+ ### GovernanceProvider
138
+
139
+ Provider para injeção de dependências e configuração.
140
+
141
+ **Props:**
142
+
143
+ | Prop | Tipo | Required | Descrição |
144
+ |------|------|----------|-----------|
145
+ | `children` | `ReactNode` | ✅ | Componentes filhos |
146
+ | `utils` | `Object` | ❌ | Utilitários customizados |
147
+ | `utils.copyToClipboard` | `Function` | ❌ | Função para copiar texto |
148
+ | `utils.maskCredential` | `Function` | ❌ | Função para mascarar credenciais |
149
+ | `client` | `Object` | ❌ | Cliente de banco (ex: Supabase) |
150
+ | `config` | `Object` | ❌ | Configurações gerais |
151
+ | `config.supabase` | `Object` | ❌ | Configuração Supabase |
152
+ | `healthCheck` | `Function` | ❌ | Função de health check |
153
+ | `ChatInterface` | `Component` | ❌ | Componente de chat AI |
154
+ | `chatConfig` | `Object` | ❌ | Configuração do chat |
155
+
156
+ **Exemplo Completo:**
157
+
158
+ ```jsx
159
+ import { GovernanceProvider } from '@bricks2k/governance';
160
+
161
+ <GovernanceProvider
162
+ // Utilitários customizados
163
+ utils={{
164
+ copyToClipboard: async (text) => {
165
+ await navigator.clipboard.writeText(text);
166
+ toast.success('Copiado!');
167
+ },
168
+ maskCredential: (value) => '•'.repeat(value.length)
169
+ }}
170
+
171
+ // Cliente de banco de dados
172
+ client={supabase}
173
+
174
+ // Configurações
175
+ config={{
176
+ supabase: {
177
+ url: process.env.VITE_SUPABASE_URL,
178
+ anonKey: process.env.VITE_SUPABASE_ANON_KEY
179
+ }
180
+ }}
181
+
182
+ // Health check customizado
183
+ healthCheck={async () => {
184
+ const { data, error } = await supabase.from('_health').select('*');
185
+ return { healthy: !error, services: [...] };
186
+ }}
187
+
188
+ // Chat AI (opcional)
189
+ ChatInterface={ChatInterface}
190
+ chatConfig={{
191
+ endpoint: '/api/chat',
192
+ context: 'development'
193
+ }}
194
+ >
195
+ <YourApp />
196
+ </GovernanceProvider>
197
+ ```
198
+
199
+ ### useGovernance Hook
200
+
201
+ Hook para acessar o contexto do Provider.
202
+
203
+ ```jsx
204
+ import { useGovernance } from '@bricks2k/governance';
205
+
206
+ function MyComponent({ onCopy }) {
207
+ const context = useGovernance();
208
+
209
+ // Prioridade: props > context > default
210
+ const copyFn = onCopy || context?.utils?.copyToClipboard || defaultCopy;
211
+
212
+ return <button onClick={() => copyFn('text')}>Copy</button>;
213
+ }
214
+ ```
215
+
216
+ ### Componentes Principais
217
+
218
+ #### `<GovernanceDashboard />`
219
+ Dashboard completo com todas as abas.
220
+
221
+ ```jsx
222
+ import { GovernanceDashboard } from '@bricks2k/governance';
223
+
224
+ <GovernanceDashboard />
225
+ ```
226
+
227
+ #### `<TechDebtTab />`
228
+ Aba de débitos técnicos standalone.
229
+
230
+ ```jsx
231
+ import { TechDebtTab } from '@bricks2k/governance';
232
+
233
+ <TechDebtTab />
234
+ ```
235
+
236
+ #### `<BacklogTab />`
237
+ Aba de backlog standalone.
238
+
239
+ ```jsx
240
+ import { BacklogTab } from '@bricks2k/governance';
241
+
242
+ <BacklogTab />
243
+ ```
244
+
245
+ #### `<SupabaseTab />`
246
+ Aba de integração Supabase (requer Provider com `client` e `config`).
247
+
248
+ ```jsx
249
+ import { GovernanceProvider, SupabaseTab } from '@bricks2k/governance';
250
+
251
+ <GovernanceProvider client={supabase} config={{ supabase: {...} }}>
252
+ <SupabaseTab />
253
+ </GovernanceProvider>
254
+ ```
255
+
256
+ #### `<DevAssistantTab />`
257
+ Assistente de desenvolvimento com AI (requer Provider com `ChatInterface`).
258
+
259
+ ```jsx
260
+ import { GovernanceProvider, DevAssistantTab } from '@bricks2k/governance';
261
+ import ChatInterface from './components/ai/ChatInterface';
262
+
263
+ <GovernanceProvider
264
+ ChatInterface={ChatInterface}
265
+ chatConfig={{ endpoint: '/api/chat' }}
266
+ >
267
+ <DevAssistantTab />
268
+ </GovernanceProvider>
269
+ ```
270
+
271
+ ### Utilitários
272
+
273
+ ```javascript
274
+ import {
275
+ parseTechDebtRegistry,
276
+ parseBacklogRegistry,
277
+ calculateHealthScore
278
+ } from '@bricks2k/governance';
279
+
280
+ // Parse de arquivos Markdown
281
+ const { debts, stats } = parseTechDebtRegistry(markdownContent);
282
+
283
+ // Cálculo de health score do projeto
284
+ const score = calculateHealthScore(techDebtStats, backlogStats);
285
+ ```
286
+
287
+ ## 🧪 Desenvolvimento
288
+
289
+ ```bash
290
+ # Instalar dependências
291
+ npm install
292
+
293
+ # Desenvolvimento
294
+ npm run dev
295
+
296
+ # Build
297
+ npm run build
298
+
299
+ # Testes
300
+ npm test
301
+
302
+ # Lint
303
+ npm run lint
304
+ ```
305
+
306
+ ## 📁 Estrutura do Projeto
307
+
308
+ ```
309
+ governance/
310
+ ├── src/
311
+ │ ├── components/ # Componentes React
312
+ │ │ ├── dashboard/ # Componentes de dashboard
313
+ │ │ ├── backlog/ # Módulo de backlog
314
+ │ │ ├── logs/ # Módulo de logs
315
+ │ │ ├── supabase/ # Módulo Supabase
316
+ │ │ ├── techdebt/ # Módulo tech debt
317
+ │ │ └── widgets/ # Widgets reutilizáveis
318
+ │ ├── utils/ # Utilitários (parsers, helpers)
319
+ │ └── index.js # Entry point
320
+ ├── tests/ # Testes
321
+ ├── docs/ # Documentação
322
+ └── package.json
323
+ ```
324
+
325
+ ## 🤝 Contribuindo
326
+
327
+ Este é um repositório privado mantido por @bricks2k.
328
+
329
+ ### Workflow
330
+
331
+ 1. Criar branch para mudanças
332
+ 2. Testar localmente
333
+ 3. Criar PR
334
+ 4. Review e testes
335
+ 5. Merge para main
336
+
337
+ ## 📝 Changelog
338
+
339
+ ### v1.0.0 (2026-01-17)
340
+ - ✨ Versão inicial com sistema completo
341
+ - 📦 35 componentes React organizados
342
+ - 🎯 GovernanceProvider para injeção de dependências
343
+ - 🛠️ 3 utilitários principais (parsers e health check)
344
+ - 📚 Documentação completa com exemplos
345
+ - ✅ Testes unitários com Vitest
346
+ - 🔧 ESLint configurado para qualidade de código
347
+ - 📋 Suporte a 7 abas: Overview, Tech Debt, Backlog, Logs, Architecture, Supabase, AI Assistant
348
+
349
+ ## 📄 Licença
350
+
351
+ MIT © bricks2k
352
+
353
+ ---
354
+
355
+ **Última Atualização:** 2026-01-17
356
+ **Autor:** Nexus Team
357
+ **Status:** Em Desenvolvimento