wegho-agentes 7.0.0 → 7.0.1

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 (108) hide show
  1. package/.agent/skills/wegho-global-rules/SKILL.md +20 -0
  2. package/.agent/workflows/PROMPT_GUIDE.md +7 -4
  3. package/.agents/cli.ts +29 -21
  4. package/.agents/core/base-agent.ts +28 -12
  5. package/.agents/core/memory-system.ts +45 -13
  6. package/.agents/core/report-generator.ts +26 -19
  7. package/.agents/orchestrator.ts +104 -74
  8. package/.clinerules +318 -1229
  9. package/.cursorrules +0 -189
  10. package/README.md +3 -3
  11. package/docs/VERSION.md +3 -2
  12. package/package.json +3 -3
  13. package/.agents/agents/ai-agents/README.md +0 -175
  14. package/.agents/agents/ai-agents/agent.ts +0 -83
  15. package/.agents/agents/ai-agents/specialty.md +0 -14
  16. package/.agents/agents/architecture/README.md +0 -61
  17. package/.agents/agents/architecture/agent.ts +0 -238
  18. package/.agents/agents/architecture/memory.md +0 -111
  19. package/.agents/agents/architecture/specialty.md +0 -31
  20. package/.agents/agents/automation/README.md +0 -60
  21. package/.agents/agents/automation/agent.ts +0 -61
  22. package/.agents/agents/automation/specialty.md +0 -14
  23. package/.agents/agents/backend/README.md +0 -155
  24. package/.agents/agents/backend/agent.ts +0 -100
  25. package/.agents/agents/backend/specialty.md +0 -14
  26. package/.agents/agents/cloud/README.md +0 -73
  27. package/.agents/agents/cloud/agent.ts +0 -53
  28. package/.agents/agents/cloud/specialty.md +0 -14
  29. package/.agents/agents/code-auditor/README.md +0 -37
  30. package/.agents/agents/code-auditor/agent.ts +0 -334
  31. package/.agents/agents/code-auditor/specialty.md +0 -14
  32. package/.agents/agents/cro/README.md +0 -200
  33. package/.agents/agents/cro/agent.ts +0 -61
  34. package/.agents/agents/cro/specialty.md +0 -14
  35. package/.agents/agents/database/README.md +0 -67
  36. package/.agents/agents/database/agent.ts +0 -93
  37. package/.agents/agents/database/specialty.md +0 -14
  38. package/.agents/agents/devops/README.md +0 -84
  39. package/.agents/agents/devops/agent.ts +0 -54
  40. package/.agents/agents/devops/specialty.md +0 -14
  41. package/.agents/agents/documentation/README.md +0 -107
  42. package/.agents/agents/documentation/agent.ts +0 -253
  43. package/.agents/agents/documentation/memory.md +0 -56
  44. package/.agents/agents/documentation/specialty.md +0 -33
  45. package/.agents/agents/frontend/README.md +0 -188
  46. package/.agents/agents/frontend/agent.ts +0 -211
  47. package/.agents/agents/frontend/memory.md +0 -139
  48. package/.agents/agents/frontend/specialty.md +0 -30
  49. package/.agents/agents/inventory/README.md +0 -35
  50. package/.agents/agents/inventory/agent.ts +0 -758
  51. package/.agents/agents/inventory/memory.md +0 -50
  52. package/.agents/agents/inventory/specialty.md +0 -129
  53. package/.agents/agents/nextjs/README.md +0 -58
  54. package/.agents/agents/nextjs/agent.ts +0 -114
  55. package/.agents/agents/nextjs/specialty.md +0 -14
  56. package/.agents/agents/pentest/README.md +0 -228
  57. package/.agents/agents/pentest/agent.ts +0 -96
  58. package/.agents/agents/pentest/specialty.md +0 -14
  59. package/.agents/agents/planning/README.md +0 -107
  60. package/.agents/agents/planning/agent.ts +0 -389
  61. package/.agents/agents/planning/specialty.md +0 -14
  62. package/.agents/agents/project-discovery/README.md +0 -35
  63. package/.agents/agents/project-discovery/agent.ts +0 -344
  64. package/.agents/agents/project-discovery/specialty.md +0 -14
  65. package/.agents/agents/quality/README.md +0 -81
  66. package/.agents/agents/quality/agent.ts +0 -269
  67. package/.agents/agents/quality/memory.md +0 -110
  68. package/.agents/agents/quality/specialty.md +0 -31
  69. package/.agents/agents/rag/README.md +0 -41
  70. package/.agents/agents/rag/agent.ts +0 -85
  71. package/.agents/agents/rag/specialty.md +0 -14
  72. package/.agents/agents/security/README.md +0 -152
  73. package/.agents/agents/security/agent.ts +0 -218
  74. package/.agents/agents/security/memory.md +0 -91
  75. package/.agents/agents/security/specialty.md +0 -31
  76. package/.agents/agents/task-analyzer/README.md +0 -36
  77. package/.agents/agents/task-analyzer/agent.ts +0 -462
  78. package/.agents/agents/task-analyzer/specialty.md +0 -14
  79. package/.agents/agents/testing/README.md +0 -161
  80. package/.agents/agents/testing/agent.ts +0 -61
  81. package/.agents/agents/testing/specialty.md +0 -14
  82. package/.agents/agents/uiux/README.md +0 -68
  83. package/.agents/agents/uiux/agent.ts +0 -95
  84. package/.agents/agents/uiux/specialty.md +0 -14
  85. package/.agents/base/base-agent.ts +0 -331
  86. package/.agents/base/memory-system.ts +0 -397
  87. package/.agents/base/skill-manager.ts +0 -95
  88. package/.agents/convert-memory.ps1 +0 -153
  89. package/.agents/examples/reporting-example.md +0 -203
  90. package/.agents/managers/build-manager.ts +0 -304
  91. package/.agents/managers/cache-manager.ts +0 -184
  92. package/.agents/managers/checkpoint-manager.ts +0 -299
  93. package/.agents/migrate-agents.ps1 +0 -117
  94. package/.agents/templates/change-report.md +0 -55
  95. package/.agents/templates/execution-plan.md +0 -36
  96. package/.agents/unmapped-skills.txt +0 -0
  97. package/.agents/utils/agent-migrator.ts +0 -360
  98. package/.agents/utils/agent-monitor.ts +0 -102
  99. package/.agents/utils/agent-parallelizer.ts +0 -108
  100. package/.agents/utils/context-monitor.ts +0 -140
  101. package/.agents/utils/feedback-collector.ts +0 -207
  102. package/.agents/utils/file-generator.ts +0 -304
  103. package/.agents/utils/memory-converter.ts +0 -217
  104. package/.agents/utils/memory-dashboard.ts +0 -147
  105. package/.agents/utils/performance-tracker.ts +0 -275
  106. package/.agents/utils/report-generator.ts +0 -193
  107. package/.agents/utils/retry-utility.ts +0 -140
  108. package/.agents/utils/workflow-validator.ts +0 -158
@@ -1,193 +0,0 @@
1
- import { execSync } from 'child_process';
2
-
3
- /**
4
- * Report Generator - Gera relatórios executivos de tarefas
5
- *
6
- * Responsabilidades:
7
- * - Gerar relatório de execução
8
- * - Documentar arquivos criados/modificados
9
- * - Listar validações executadas
10
- * - Fornecer próximos passos
11
- */
12
-
13
- export interface ExecutionReport {
14
- task: string;
15
- status: 'success' | 'failure';
16
- duration: string;
17
- filesCreated: string[];
18
- filesModified: string[];
19
- filesDeleted: string[];
20
- validation: {
21
- validate: boolean;
22
- lint: boolean;
23
- build: boolean;
24
- test: boolean;
25
- };
26
- errors: string[];
27
- warnings: string[];
28
- nextSteps: string[];
29
- }
30
-
31
- export class ReportGenerator {
32
- /**
33
- * Gera relatório executivo
34
- */
35
- generateExecutionReport(report: ExecutionReport): string {
36
- const statusEmoji = report.status === 'success' ? '✅' : '❌';
37
- const statusText = report.status === 'success' ? 'SUCESSO' : 'FALHOU';
38
-
39
- let markdown = `# ${statusEmoji} Execução ${statusText}\n\n`;
40
-
41
- // Resumo
42
- markdown += `## 📊 Resumo\n\n`;
43
- markdown += `- **Tarefa**: ${report.task}\n`;
44
- markdown += `- **Status**: ${statusText}\n`;
45
- markdown += `- **Duração**: ${report.duration}\n\n`;
46
-
47
- // Arquivos
48
- if (report.filesCreated.length > 0 || report.filesModified.length > 0 || report.filesDeleted.length > 0) {
49
- markdown += `## 📁 Arquivos Alterados\n\n`;
50
-
51
- if (report.filesCreated.length > 0) {
52
- markdown += `### ✨ Criados (${report.filesCreated.length})\n\n`;
53
- report.filesCreated.forEach(f => {
54
- markdown += `- \`${f}\`\n`;
55
- });
56
- markdown += `\n`;
57
- }
58
-
59
- if (report.filesModified.length > 0) {
60
- markdown += `### ✏️ Modificados (${report.filesModified.length})\n\n`;
61
- report.filesModified.forEach(f => {
62
- markdown += `- \`${f}\`\n`;
63
- });
64
- markdown += `\n`;
65
- }
66
-
67
- if (report.filesDeleted.length > 0) {
68
- markdown += `### 🗑️ Deletados (${report.filesDeleted.length})\n\n`;
69
- report.filesDeleted.forEach(f => {
70
- markdown += `- \`${f}\`\n`;
71
- });
72
- markdown += `\n`;
73
- }
74
- }
75
-
76
- // Validações
77
- markdown += `## ✅ Validações\n\n`;
78
- markdown += `| Validação | Status |\n`;
79
- markdown += `|-----------|--------|\n`;
80
- markdown += `| Validate | ${report.validation.validate ? '✅ Passou' : '❌ Falhou'} |\n`;
81
- markdown += `| Lint | ${report.validation.lint ? '✅ Passou' : '❌ Falhou'} |\n`;
82
- markdown += `| Build | ${report.validation.build ? '✅ Passou' : '❌ Falhou'} |\n`;
83
- markdown += `| Tests | ${report.validation.test ? '✅ Passou' : '❌ Falhou'} |\n\n`;
84
-
85
- // Erros
86
- if (report.errors.length > 0) {
87
- markdown += `## 🚨 Erros\n\n`;
88
- report.errors.forEach(err => {
89
- markdown += `- ${err}\n`;
90
- });
91
- markdown += `\n`;
92
- }
93
-
94
- // Avisos
95
- if (report.warnings.length > 0) {
96
- markdown += `## ⚠️ Avisos\n\n`;
97
- report.warnings.forEach(warn => {
98
- markdown += `- ${warn}\n`;
99
- });
100
- markdown += `\n`;
101
- }
102
-
103
- // Próximos passos
104
- if (report.nextSteps.length > 0) {
105
- markdown += `## 📚 Próximos Passos\n\n`;
106
- report.nextSteps.forEach((step, i) => {
107
- markdown += `${i + 1}. ${step}\n`;
108
- });
109
- markdown += `\n`;
110
- }
111
-
112
- // Como testar
113
- if (report.status === 'success') {
114
- markdown += `## 🧪 Como Testar\n\n`;
115
- markdown += `\`\`\`bash\n`;
116
- markdown += `npm run dev\n`;
117
- markdown += `# Acesse http://localhost:3000\n`;
118
- markdown += `\`\`\`\n\n`;
119
- }
120
-
121
- markdown += `---\n\n`;
122
- markdown += `**Gerado em**: ${new Date().toLocaleString('pt-BR')}\n`;
123
-
124
- return markdown;
125
- }
126
-
127
- /**
128
- * Salva relatório em arquivo
129
- */
130
- saveReport(report: ExecutionReport, outputPath: string): void {
131
- const markdown = this.generateExecutionReport(report);
132
- const fs = require('fs');
133
- const path = require('path');
134
-
135
- const dir = path.dirname(outputPath);
136
- if (!fs.existsSync(dir)) {
137
- fs.mkdirSync(dir, { recursive: true });
138
- }
139
-
140
- fs.writeFileSync(outputPath, markdown, 'utf-8');
141
- console.log(`\n📊 Relatório salvo em: ${outputPath}`);
142
- }
143
-
144
- /**
145
- * Exibe relatório no console
146
- */
147
- displayReport(report: ExecutionReport): void {
148
- console.log('\n' + '='.repeat(60));
149
- console.log(`${report.status === 'success' ? '✅' : '❌'} RELATÓRIO DE EXECUÇÃO`);
150
- console.log('='.repeat(60) + '\n');
151
-
152
- console.log(`📋 Tarefa: ${report.task}`);
153
- console.log(`⏱️ Duração: ${report.duration}\n`);
154
-
155
- if (report.filesCreated.length > 0) {
156
- console.log(`✨ Arquivos criados: ${report.filesCreated.length}`);
157
- report.filesCreated.slice(0, 3).forEach(f => console.log(` - ${f}`));
158
- if (report.filesCreated.length > 3) {
159
- console.log(` ... e mais ${report.filesCreated.length - 3}`);
160
- }
161
- console.log('');
162
- }
163
-
164
- if (report.filesModified.length > 0) {
165
- console.log(`✏️ Arquivos modificados: ${report.filesModified.length}`);
166
- report.filesModified.slice(0, 3).forEach(f => console.log(` - ${f}`));
167
- if (report.filesModified.length > 3) {
168
- console.log(` ... e mais ${report.filesModified.length - 3}`);
169
- }
170
- console.log('');
171
- }
172
-
173
- console.log('✅ Validações:');
174
- console.log(` Validate: ${report.validation.validate ? '✅' : '❌'}`);
175
- console.log(` Lint: ${report.validation.lint ? '✅' : '❌'}`);
176
- console.log(` Build: ${report.validation.build ? '✅' : '❌'}`);
177
- console.log(` Tests: ${report.validation.test ? '✅' : '❌'}\n`);
178
-
179
- if (report.errors.length > 0) {
180
- console.log('🚨 Erros:');
181
- report.errors.forEach(err => console.log(` - ${err}`));
182
- console.log('');
183
- }
184
-
185
- if (report.status === 'success' && report.nextSteps.length > 0) {
186
- console.log('📚 Próximos passos:');
187
- report.nextSteps.forEach((step, i) => console.log(` ${i + 1}. ${step}`));
188
- console.log('');
189
- }
190
-
191
- console.log('='.repeat(60) + '\n');
192
- }
193
- }
@@ -1,140 +0,0 @@
1
- /**
2
- * Retry Utility - Implementa retry logic com backoff exponencial
3
- *
4
- * Funcionalidades:
5
- * - Retry automático em caso de falha
6
- * - Backoff exponencial (delay aumenta a cada tentativa)
7
- * - Configurável por tipo de erro
8
- * - Logging de tentativas
9
- */
10
-
11
- export interface RetryOptions {
12
- maxRetries: number;
13
- initialDelay: number;
14
- maxDelay: number;
15
- backoffMultiplier: number;
16
- retryableErrors?: string[];
17
- }
18
-
19
- export const DEFAULT_RETRY_OPTIONS: RetryOptions = {
20
- maxRetries: 3,
21
- initialDelay: 1000,
22
- maxDelay: 10000,
23
- backoffMultiplier: 2,
24
- retryableErrors: ['ETIMEDOUT', 'ECONNRESET', 'ENOTFOUND']
25
- };
26
-
27
- export class RetryUtility {
28
- /**
29
- * Executa função com retry automático
30
- */
31
- static async executeWithRetry<T>(
32
- fn: () => Promise<T>,
33
- options: Partial<RetryOptions> = {},
34
- context?: string
35
- ): Promise<T> {
36
- const opts = { ...DEFAULT_RETRY_OPTIONS, ...options };
37
- let lastError: Error;
38
-
39
- for (let attempt = 1; attempt <= opts.maxRetries; attempt++) {
40
- try {
41
- return await fn();
42
- } catch (error: any) {
43
- lastError = error;
44
-
45
- // Verificar se erro é retryable
46
- if (!this.isRetryableError(error, opts.retryableErrors)) {
47
- throw error;
48
- }
49
-
50
- // Última tentativa - não fazer retry
51
- if (attempt === opts.maxRetries) {
52
- break;
53
- }
54
-
55
- // Calcular delay com backoff exponencial
56
- const delay = Math.min(
57
- opts.initialDelay * Math.pow(opts.backoffMultiplier, attempt - 1),
58
- opts.maxDelay
59
- );
60
-
61
- console.log(
62
- `⚠️ [Retry] Tentativa ${attempt}/${opts.maxRetries} falhou` +
63
- (context ? ` (${context})` : '') +
64
- `. Retentando em ${delay}ms...`
65
- );
66
-
67
- await this.sleep(delay);
68
- }
69
- }
70
-
71
- throw new Error(
72
- `Falha após ${opts.maxRetries} tentativas` +
73
- (context ? ` (${context})` : '') +
74
- `: ${lastError!.message}`
75
- );
76
- }
77
-
78
- /**
79
- * Verifica se erro é retryable
80
- */
81
- private static isRetryableError(error: any, retryableErrors?: string[]): boolean {
82
- if (!retryableErrors || retryableErrors.length === 0) {
83
- return true; // Retry em todos os erros se não especificado
84
- }
85
-
86
- const errorCode = error.code || error.name || '';
87
- const errorMessage = error.message || '';
88
-
89
- return retryableErrors.some(
90
- retryable =>
91
- errorCode.includes(retryable) ||
92
- errorMessage.includes(retryable)
93
- );
94
- }
95
-
96
- /**
97
- * Sleep helper
98
- */
99
- private static sleep(ms: number): Promise<void> {
100
- return new Promise(resolve => setTimeout(resolve, ms));
101
- }
102
-
103
- /**
104
- * Executa com timeout
105
- */
106
- static async executeWithTimeout<T>(
107
- fn: () => Promise<T>,
108
- timeoutMs: number,
109
- context?: string
110
- ): Promise<T> {
111
- return Promise.race([
112
- fn(),
113
- new Promise<T>((_, reject) =>
114
- setTimeout(
115
- () => reject(new Error(
116
- `Timeout após ${timeoutMs}ms` +
117
- (context ? ` (${context})` : '')
118
- )),
119
- timeoutMs
120
- )
121
- )
122
- ]);
123
- }
124
-
125
- /**
126
- * Executa com timeout E retry
127
- */
128
- static async executeWithTimeoutAndRetry<T>(
129
- fn: () => Promise<T>,
130
- timeoutMs: number,
131
- retryOptions: Partial<RetryOptions> = {},
132
- context?: string
133
- ): Promise<T> {
134
- return this.executeWithRetry(
135
- () => this.executeWithTimeout(fn, timeoutMs, context),
136
- retryOptions,
137
- context
138
- );
139
- }
140
- }
@@ -1,158 +0,0 @@
1
- /**
2
- * Workflow Validator - Garante que agentes sigam os 6 passos obrigatórios
3
- *
4
- * Passos obrigatórios do AGENT_WORKFLOW.md:
5
- * 1. Consultar memória para casos similares
6
- * 2. Obter recomendações de aprendizados
7
- * 3. Consultar repositórios de referência relevantes
8
- * 4. Aplicar aprendizados com alta confiança (>0.7)
9
- * 5. Registrar resultado (sucesso ou falha)
10
- * 6. Gerar aprendizados baseado em feedback (opcional)
11
- */
12
-
13
- export interface WorkflowStep {
14
- name: string;
15
- required: boolean;
16
- completed: boolean;
17
- timestamp?: Date;
18
- details?: any;
19
- }
20
-
21
- export interface WorkflowValidationResult {
22
- compliant: boolean;
23
- missingSteps: string[];
24
- warnings: string[];
25
- completedSteps: string[];
26
- totalRequired: number;
27
- totalCompleted: number;
28
- }
29
-
30
- export class WorkflowValidator {
31
- /**
32
- * Valida se um agente seguiu todos os passos obrigatórios
33
- */
34
- validateAgentExecution(agentName: string, executionLog: WorkflowStep[]): WorkflowValidationResult {
35
- const requiredSteps = executionLog.filter(step => step.required);
36
- const completedRequired = requiredSteps.filter(step => step.completed);
37
- const missingSteps = requiredSteps
38
- .filter(step => !step.completed)
39
- .map(step => step.name);
40
-
41
- const warnings: string[] = [];
42
- const completedSteps = executionLog
43
- .filter(step => step.completed)
44
- .map(step => step.name);
45
-
46
- // Verificar se passos foram executados na ordem correta
47
- const expectedOrder = [
48
- 'Consultar Memória',
49
- 'Obter Recomendações',
50
- 'Consultar Repositórios',
51
- 'Aplicar Aprendizados',
52
- 'Registrar Resultado'
53
- ];
54
-
55
- const completedOrder = executionLog
56
- .filter(step => step.completed && step.timestamp)
57
- .sort((a, b) => a.timestamp!.getTime() - b.timestamp!.getTime())
58
- .map(step => step.name);
59
-
60
- // Verificar ordem (warning, não erro)
61
- for (let i = 0; i < completedOrder.length - 1; i++) {
62
- const currentIndex = expectedOrder.indexOf(completedOrder[i]);
63
- const nextIndex = expectedOrder.indexOf(completedOrder[i + 1]);
64
-
65
- if (currentIndex !== -1 && nextIndex !== -1 && currentIndex > nextIndex) {
66
- warnings.push(
67
- `Passos executados fora de ordem: "${completedOrder[i]}" antes de "${completedOrder[i + 1]}"`
68
- );
69
- }
70
- }
71
-
72
- // Verificar se passos críticos foram pulados
73
- const criticalSteps = ['Consultar Memória', 'Registrar Resultado'];
74
- const missingCritical = criticalSteps.filter(
75
- step => !completedSteps.includes(step)
76
- );
77
-
78
- if (missingCritical.length > 0) {
79
- warnings.push(
80
- `Passos críticos não executados: ${missingCritical.join(', ')}`
81
- );
82
- }
83
-
84
- const compliant = missingSteps.length === 0;
85
-
86
- return {
87
- compliant,
88
- missingSteps,
89
- warnings,
90
- completedSteps,
91
- totalRequired: requiredSteps.length,
92
- totalCompleted: completedRequired.length
93
- };
94
- }
95
-
96
- /**
97
- * Gera relatório detalhado de validação
98
- */
99
- generateValidationReport(agentName: string, validation: WorkflowValidationResult): string {
100
- const lines: string[] = [];
101
-
102
- lines.push(`\n━━━ Validação de Workflow: ${agentName} ━━━`);
103
- lines.push(`Status: ${validation.compliant ? '✅ COMPLIANT' : '❌ NON-COMPLIANT'}`);
104
- lines.push(`Passos Completados: ${validation.totalCompleted}/${validation.totalRequired}`);
105
-
106
- if (validation.completedSteps.length > 0) {
107
- lines.push(`\n✅ Passos Executados:`);
108
- validation.completedSteps.forEach(step => {
109
- lines.push(` - ${step}`);
110
- });
111
- }
112
-
113
- if (validation.missingSteps.length > 0) {
114
- lines.push(`\n❌ Passos Faltantes:`);
115
- validation.missingSteps.forEach(step => {
116
- lines.push(` - ${step}`);
117
- });
118
- }
119
-
120
- if (validation.warnings.length > 0) {
121
- lines.push(`\n⚠️ Avisos:`);
122
- validation.warnings.forEach(warning => {
123
- lines.push(` - ${warning}`);
124
- });
125
- }
126
-
127
- lines.push(`━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n`);
128
-
129
- return lines.join('\n');
130
- }
131
-
132
- /**
133
- * Valida múltiplos agentes e retorna resumo
134
- */
135
- validateMultipleAgents(
136
- agentExecutions: Array<{ agentName: string; steps: WorkflowStep[] }>
137
- ): {
138
- allCompliant: boolean;
139
- compliantCount: number;
140
- nonCompliantCount: number;
141
- details: Array<{ agentName: string; validation: WorkflowValidationResult }>;
142
- } {
143
- const details = agentExecutions.map(({ agentName, steps }) => ({
144
- agentName,
145
- validation: this.validateAgentExecution(agentName, steps)
146
- }));
147
-
148
- const compliantCount = details.filter(d => d.validation.compliant).length;
149
- const nonCompliantCount = details.length - compliantCount;
150
-
151
- return {
152
- allCompliant: nonCompliantCount === 0,
153
- compliantCount,
154
- nonCompliantCount,
155
- details
156
- };
157
- }
158
- }