mega-brain-ai 1.1.0 → 1.2.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.
Potentially problematic release.
This version of mega-brain-ai might be problematic. Click here for more details.
- package/bin/lib/ascii-art.js +85 -117
- package/bin/lib/installer.js +161 -139
- package/bin/mega-brain.js +8 -8
- package/package.json +2 -1
package/bin/lib/ascii-art.js
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Mega Brain - ASCII Art & Visual Elements
|
|
3
|
+
* Uses chalk for colors and gradient-string for gradient text.
|
|
3
4
|
*/
|
|
4
5
|
|
|
6
|
+
import chalk from 'chalk';
|
|
7
|
+
import gradient from 'gradient-string';
|
|
8
|
+
import boxen from 'boxen';
|
|
9
|
+
|
|
10
|
+
const megaGradient = gradient(['#6366f1', '#8b5cf6', '#a855f7']);
|
|
11
|
+
|
|
5
12
|
export function showBanner(version = '1.0.0') {
|
|
6
|
-
const
|
|
13
|
+
const art = `
|
|
7
14
|
███╗ ███╗███████╗ ██████╗ █████╗
|
|
8
15
|
████╗ ████║██╔════╝██╔════╝ ██╔══██╗
|
|
9
16
|
██╔████╔██║█████╗ ██║ ███╗███████║
|
|
@@ -16,85 +23,96 @@ export function showBanner(version = '1.0.0') {
|
|
|
16
23
|
██████╔╝██████╔╝███████║██║██╔██╗ ██║
|
|
17
24
|
██╔══██╗██╔══██╗██╔══██║██║██║╚██╗██║
|
|
18
25
|
██████╔╝██║ ██║██║ ██║██║██║ ╚████║
|
|
19
|
-
╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝╚═╝
|
|
26
|
+
╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝╚═╝ ╚═══╝`;
|
|
20
27
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
console.log(
|
|
28
|
+
console.log(megaGradient(art));
|
|
29
|
+
console.log();
|
|
30
|
+
console.log(chalk.dim(' Powered by JARVIS AI Orchestration'));
|
|
31
|
+
console.log(chalk.dim(` MoneyClub Edition v${version}`));
|
|
32
|
+
console.log();
|
|
25
33
|
}
|
|
26
34
|
|
|
27
35
|
export function showSuccess(message) {
|
|
28
|
-
console.log(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
36
|
+
console.log(boxen(chalk.green(message), {
|
|
37
|
+
padding: { left: 2, right: 2, top: 0, bottom: 0 },
|
|
38
|
+
margin: { left: 2 },
|
|
39
|
+
borderStyle: 'round',
|
|
40
|
+
borderColor: 'green',
|
|
41
|
+
}));
|
|
33
42
|
}
|
|
34
43
|
|
|
35
44
|
export function showError(message) {
|
|
36
|
-
console.error(`\n
|
|
45
|
+
console.error(chalk.red(`\n ✖ ${message}\n`));
|
|
37
46
|
}
|
|
38
47
|
|
|
39
48
|
export function showStep(step, total, description) {
|
|
40
|
-
console.log(`\n [${step}/${total}] ${description}`);
|
|
49
|
+
console.log(`\n ${chalk.dim(`[${step}/${total}]`)} ${chalk.bold(description)}`);
|
|
41
50
|
}
|
|
42
51
|
|
|
43
52
|
export function showPostInstall() {
|
|
44
|
-
console.log(
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
console.log(boxen(
|
|
54
|
+
chalk.green(' Mega Brain instalado com sucesso!') + '\n\n'
|
|
55
|
+
+ chalk.dim(' Próximo passo:') + '\n'
|
|
56
|
+
+ chalk.white(' Abra o projeto no Claude Code e execute: /setup'),
|
|
57
|
+
{
|
|
58
|
+
padding: 1,
|
|
59
|
+
margin: { left: 2 },
|
|
60
|
+
borderStyle: 'round',
|
|
61
|
+
borderColor: 'green',
|
|
62
|
+
}
|
|
63
|
+
));
|
|
55
64
|
}
|
|
56
65
|
|
|
57
66
|
export function showOnboarding() {
|
|
58
|
-
|
|
67
|
+
const headerGradient = gradient(['#6366f1', '#a855f7', '#ec4899']);
|
|
68
|
+
const sectionGradient = gradient(['#06b6d4', '#3b82f6']);
|
|
69
|
+
|
|
70
|
+
console.log(headerGradient(`
|
|
59
71
|
═══════════════════════════════════════════════════════════════════════════════════
|
|
60
72
|
JARVIS OPERATIONAL BRIEFING
|
|
61
|
-
|
|
73
|
+
═══════════════════════════════════════════════════════════════════════════════════`));
|
|
62
74
|
|
|
75
|
+
console.log(megaGradient(`
|
|
63
76
|
██╗ █████╗ ██████╗ ██╗ ██╗██╗███████╗
|
|
64
77
|
██║██╔══██╗██╔══██╗██║ ██║██║██╔════╝
|
|
65
78
|
██║███████║██████╔╝██║ ██║██║███████╗
|
|
66
79
|
██ ██║██╔══██║██╔══██╗╚██╗ ██╔╝██║╚════██║
|
|
67
80
|
╚█████╔╝██║ ██║██║ ██║ ╚████╔╝ ██║███████║
|
|
68
|
-
╚════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═══╝
|
|
81
|
+
╚════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═══╝ ╚═╝╚══════╝`));
|
|
69
82
|
|
|
83
|
+
console.log(chalk.dim(`
|
|
70
84
|
Knowledge Management System v1.0.0
|
|
71
|
-
"Seu segundo cérebro, alimentado por IA"
|
|
85
|
+
"Seu segundo cérebro, alimentado por IA"`));
|
|
72
86
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
87
|
+
console.log(sectionGradient(`
|
|
88
|
+
═══════════════════════════════════════════════════════════════════════════════════`));
|
|
89
|
+
console.log(chalk.bold(' 📊 STATUS DO SISTEMA'));
|
|
90
|
+
console.log(sectionGradient(`═══════════════════════════════════════════════════════════════════════════════════`));
|
|
76
91
|
|
|
92
|
+
console.log(`
|
|
77
93
|
┌────────────────────────────────┬────────────┬──────────────────────────────┐
|
|
78
94
|
│ Módulo │ Status │ Progresso │
|
|
79
95
|
├────────────────────────────────┼────────────┼──────────────────────────────┤
|
|
80
|
-
│ 🧬 Experts Clonados (DNAs) │ 0 vazio │ [░░░░░░░░░░░░░░░░] Aguarda │
|
|
81
|
-
│ 📋 Temas Extraídos │ 0 vazio │ [░░░░░░░░░░░░░░░░] Aguarda │
|
|
82
|
-
│ 📦 Chunks Processados │ 0 vazio │ [░░░░░░░░░░░░░░░░] Aguarda │
|
|
83
|
-
│ 📖 Playbooks Gerados │ 0 vazio │ [░░░░░░░░░░░░░░░░] Aguarda │
|
|
84
|
-
│ 📁 Dossiers Compilados │ 0 vazio │ [░░░░░░░░░░░░░░░░] Aguarda │
|
|
85
|
-
│ 👔 C-Levels (CRO/CFO/CMO/COO) │ 4 ready │ [████████████████] 100% │
|
|
86
|
-
│ 💼 Cargos (Closer/BDR/SDS/LNS)│ 4 ready │ [████████████████] 100% │
|
|
87
|
-
│ ⚖️ Conclave (Deliberação) │ 3 ready │ [████████████████] 100% │
|
|
96
|
+
│ ${chalk.cyan('🧬 Experts Clonados (DNAs)')} │ ${chalk.dim('0 vazio')} │ ${chalk.dim('[░░░░░░░░░░░░░░░░] Aguarda')} │
|
|
97
|
+
│ ${chalk.cyan('📋 Temas Extraídos')} │ ${chalk.dim('0 vazio')} │ ${chalk.dim('[░░░░░░░░░░░░░░░░] Aguarda')} │
|
|
98
|
+
│ ${chalk.cyan('📦 Chunks Processados')} │ ${chalk.dim('0 vazio')} │ ${chalk.dim('[░░░░░░░░░░░░░░░░] Aguarda')} │
|
|
99
|
+
│ ${chalk.cyan('📖 Playbooks Gerados')} │ ${chalk.dim('0 vazio')} │ ${chalk.dim('[░░░░░░░░░░░░░░░░] Aguarda')} │
|
|
100
|
+
│ ${chalk.cyan('📁 Dossiers Compilados')} │ ${chalk.dim('0 vazio')} │ ${chalk.dim('[░░░░░░░░░░░░░░░░] Aguarda')} │
|
|
101
|
+
│ ${chalk.green('👔 C-Levels (CRO/CFO/CMO/COO)')} │ ${chalk.green('4 ready')} │ ${chalk.green('[████████████████] 100%')} │
|
|
102
|
+
│ ${chalk.green('💼 Cargos (Closer/BDR/SDS/LNS)')}│ ${chalk.green('4 ready')} │ ${chalk.green('[████████████████] 100%')} │
|
|
103
|
+
│ ${chalk.green('⚖️ Conclave (Deliberação)')} │ ${chalk.green('3 ready')} │ ${chalk.green('[████████████████] 100%')} │
|
|
88
104
|
└────────────────────────────────┴────────────┴──────────────────────────────┘
|
|
89
105
|
|
|
90
|
-
Health Score: [░░░░░░░░░░░░░░░░] 0/100 — Alimente o sistema para crescer
|
|
106
|
+
Health Score: ${chalk.dim('[░░░░░░░░░░░░░░░░] 0/100 — Alimente o sistema para crescer')}`);
|
|
91
107
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
108
|
+
console.log(sectionGradient(`
|
|
109
|
+
═══════════════════════════════════════════════════════════════════════════════════`));
|
|
110
|
+
console.log(chalk.bold(' 🧠 CAPACIDADES DO SISTEMA'));
|
|
111
|
+
console.log(sectionGradient(`═══════════════════════════════════════════════════════════════════════════════════`));
|
|
95
112
|
|
|
113
|
+
console.log(`
|
|
96
114
|
┌─────────────────────────────────────────────────────────────────────────────┐
|
|
97
|
-
│ 🧬 CLONAGEM MENTAL (DNA Extraction) │
|
|
115
|
+
│ ${chalk.cyan.bold('🧬 CLONAGEM MENTAL (DNA Extraction)')} │
|
|
98
116
|
├─────────────────────────────────────────────────────────────────────────────┤
|
|
99
117
|
│ │
|
|
100
118
|
│ Insira conteúdos de um especialista (vídeos do YouTube, PDFs, cursos, │
|
|
@@ -115,7 +133,7 @@ export function showOnboarding() {
|
|
|
115
133
|
└─────────────────────────────────────────────────────────────────────────────┘
|
|
116
134
|
|
|
117
135
|
┌─────────────────────────────────────────────────────────────────────────────┐
|
|
118
|
-
│ 👔 AGENTES OPERACIONAIS (C-Levels + Cargos) │
|
|
136
|
+
│ ${chalk.cyan.bold('👔 AGENTES OPERACIONAIS (C-Levels + Cargos)')} │
|
|
119
137
|
├─────────────────────────────────────────────────────────────────────────────┤
|
|
120
138
|
│ │
|
|
121
139
|
│ C-Levels: CRO (Revenue) │ CFO (Finanças) │ CMO (Marketing) │ COO (Ops) │
|
|
@@ -123,13 +141,11 @@ export function showOnboarding() {
|
|
|
123
141
|
│ │
|
|
124
142
|
│ Agentes que trabalham OPERACIONALMENTE no seu negócio │
|
|
125
143
|
│ usando o conhecimento extraído dos experts clonados. │
|
|
126
|
-
│ Cada agente carrega os frameworks e heurísticas dos │
|
|
127
|
-
│ materiais que você inseriu — nada inventado. │
|
|
128
144
|
│ │
|
|
129
145
|
└─────────────────────────────────────────────────────────────────────────────┘
|
|
130
146
|
|
|
131
147
|
┌─────────────────────────────────────────────────────────────────────────────┐
|
|
132
|
-
│ ⚖️ CONCLAVE — Sistema de Deliberação Estratégica │
|
|
148
|
+
│ ${chalk.cyan.bold('⚖️ CONCLAVE — Sistema de Deliberação Estratégica')} │
|
|
133
149
|
├─────────────────────────────────────────────────────────────────────────────┤
|
|
134
150
|
│ │
|
|
135
151
|
│ O Conclave NÃO é apenas um conselho de 3 agentes. │
|
|
@@ -137,17 +153,14 @@ export function showOnboarding() {
|
|
|
137
153
|
│ │
|
|
138
154
|
│ ┌─── FASE 0: FUNDAMENTO CONSTITUCIONAL ────────────────────────────────┐ │
|
|
139
155
|
│ │ ⚖️ Empirismo │ 📊 Pareto 80/20 │ 🔄 Inversão │ 💪 Antifragilidade │ │
|
|
140
|
-
│ │ A Constituição é invocada como base de toda deliberação. │ │
|
|
141
156
|
│ └──────────────────────────────────────────────────────────────────────┘ │
|
|
142
157
|
│ │
|
|
143
158
|
│ ┌─── FASE 1: C-LEVELS ─────────────────────────────────────────────────┐ │
|
|
144
159
|
│ │ 👔 CRO (Revenue) │ CFO (Finanças) │ CMO (Marketing) │ COO (Ops) │ │
|
|
145
|
-
│ │ Cada C-Level analisa sob a perspectiva do seu domínio. │ │
|
|
146
160
|
│ └──────────────────────────────────────────────────────────────────────┘ │
|
|
147
161
|
│ │
|
|
148
|
-
│ ┌─── FASE 2: CARGOS ─────────────────────────────────────────────────┐
|
|
149
|
-
│ │ 💼 Closer │ BDR │ SDS │ LNS │
|
|
150
|
-
│ │ Agentes operacionais trazem dados e experiência de campo. │ │
|
|
162
|
+
│ ┌─── FASE 2: CARGOS ─────────────────────────────────────────────────┐ │
|
|
163
|
+
│ │ 💼 Closer │ BDR │ SDS │ LNS │ │
|
|
151
164
|
│ └──────────────────────────────────────────────────────────────────────┘ │
|
|
152
165
|
│ │
|
|
153
166
|
│ ┌─── FASE 3: CONSELHO DE AVALIAÇÃO ───────────────────────────────────┐ │
|
|
@@ -156,79 +169,34 @@ export function showOnboarding() {
|
|
|
156
169
|
│ │ 🎯 Sintetizador — reconcilia e gera recomendação final │ │
|
|
157
170
|
│ └──────────────────────────────────────────────────────────────────────┘ │
|
|
158
171
|
│ │
|
|
159
|
-
│ ┌─── FASE 4+: ROUNDS ADICIONAIS ─────────────────────────────────────┐ │
|
|
160
|
-
│ │ Se o consenso for < 60%, o Conclave aciona rodadas adicionais │ │
|
|
161
|
-
│ │ com contra-argumentação, validação cruzada e nova síntese. │ │
|
|
162
|
-
│ │ Resultado: decisão fundamentada com grau de confiança medido. │ │
|
|
163
|
-
│ └──────────────────────────────────────────────────────────────────────┘ │
|
|
164
|
-
│ │
|
|
165
172
|
│ 📌 Tudo baseado EXCLUSIVAMENTE nos materiais inseridos. │
|
|
166
173
|
│ Zero "achismo". 100% fundamentado. Evidências citadas. │
|
|
167
174
|
│ │
|
|
168
|
-
|
|
175
|
+
└─────────────────────────────────────────────────────────────────────────────┘`);
|
|
169
176
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
177
|
+
console.log(sectionGradient(`
|
|
178
|
+
═══════════════════════════════════════════════════════════════════════════════════`));
|
|
179
|
+
console.log(chalk.bold(' 🚀 COMECE A DAR PODER AO JARVIS'));
|
|
180
|
+
console.log(sectionGradient(`═══════════════════════════════════════════════════════════════════════════════════`));
|
|
173
181
|
|
|
182
|
+
console.log(`
|
|
174
183
|
O sistema está pronto. Você precisa alimentá-lo.
|
|
175
|
-
Há 2 tipos de conteúdo para inserir:
|
|
176
|
-
|
|
177
|
-
┌─────────────────────────────────────────────────────────────────────────────┐
|
|
178
|
-
│ 📥 CHECKLIST 1: Conteúdos de Especialistas │
|
|
179
|
-
├─────────────────────────────────────────────────────────────────────────────┤
|
|
180
|
-
│ │
|
|
181
|
-
│ 🎯 Objetivo: Clonar a mente de experts do seu nicho │
|
|
182
|
-
│ │
|
|
183
|
-
│ Comandos: │
|
|
184
|
-
│ /ingest [URL do YouTube] ← Transcreve e importa automaticamente │
|
|
185
|
-
│ /ingest [caminho do PDF] ← Extrai texto e importa │
|
|
186
|
-
│ /process-jarvis ← Processa pipeline de 5 fases │
|
|
187
|
-
│ /extract-dna [nome-do-expert] ← Gera DNA cognitivo + agente │
|
|
188
|
-
│ │
|
|
189
|
-
│ 📌 Resultado: Clone mental + agente especializado que pensa, │
|
|
190
|
-
│ fala e decide como o expert original. │
|
|
191
|
-
│ │
|
|
192
|
-
└─────────────────────────────────────────────────────────────────────────────┘
|
|
193
184
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
│ │
|
|
200
|
-
│ Comandos: │
|
|
201
|
-
│ /ingest [playbook do produto] ← Alimenta a árvore de produtos │
|
|
202
|
-
│ /ingest [narrativa da empresa] ← Contexto para deliberações │
|
|
203
|
-
│ /ingest [documentos estratégicos]← Dados para decisões informadas │
|
|
204
|
-
│ │
|
|
205
|
-
│ 📌 Resultado: Árvore de produtos, narrativas e estratégias que │
|
|
206
|
-
│ servem como contexto em TODOS os debates e decisões. │
|
|
207
|
-
│ │
|
|
208
|
-
└─────────────────────────────────────────────────────────────────────────────┘
|
|
209
|
-
|
|
210
|
-
═══════════════════════════════════════════════════════════════════════════════════
|
|
211
|
-
⚡ PRIMEIRO USO DO CONCLAVE
|
|
212
|
-
═══════════════════════════════════════════════════════════════════════════════════
|
|
213
|
-
|
|
214
|
-
Após inserir conteúdos dos 2 checklists acima, execute:
|
|
215
|
-
|
|
216
|
-
/conclave "Sua pergunta estratégica aqui"
|
|
185
|
+
${chalk.cyan.bold('📥 Conteúdos de Especialistas')} — Clonar a mente de experts
|
|
186
|
+
${chalk.cyan('/ingest [URL do YouTube]')} ← Transcreve e importa
|
|
187
|
+
${chalk.cyan('/ingest [caminho do PDF]')} ← Extrai texto e importa
|
|
188
|
+
${chalk.cyan('/process-jarvis')} ← Processa pipeline de 5 fases
|
|
189
|
+
${chalk.cyan('/extract-dna [nome-do-expert]')} ← Gera DNA cognitivo + agente
|
|
217
190
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
Fase 2 → Cargos (Closer, BDR, SDS, LNS)
|
|
222
|
-
Fase 3 → Conselho (Crítico + Diabo + Sintetizador)
|
|
223
|
-
Fase 4+ → Rounds adicionais se consenso < 60%
|
|
191
|
+
${chalk.cyan.bold('📥 Conteúdos do Seu Negócio')} — Dar contexto real aos agentes
|
|
192
|
+
${chalk.cyan('/ingest [playbook do produto]')} ← Alimenta a árvore de produtos
|
|
193
|
+
${chalk.cyan('/ingest [narrativa da empresa]')} ← Contexto para deliberações
|
|
224
194
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
Você pode também entrevistar seus clones diretamente com /ask.
|
|
195
|
+
${chalk.cyan.bold('⚡ Primeiro uso do Conclave:')}
|
|
196
|
+
${chalk.cyan('/conclave "Sua pergunta estratégica aqui"')}
|
|
197
|
+
`);
|
|
229
198
|
|
|
230
|
-
|
|
199
|
+
console.log(chalk.dim(`═══════════════════════════════════════════════════════════════════════════════════
|
|
231
200
|
— "De fato, senhor. O sistema aguarda seus comandos."
|
|
232
|
-
|
|
233
|
-
`);
|
|
201
|
+
═══════════════════════════════════════════════════════════════════════════════════`));
|
|
234
202
|
}
|
package/bin/lib/installer.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Mega Brain - Installer Module
|
|
2
|
+
* Mega Brain - Installer Module (Interactive UX)
|
|
3
|
+
*
|
|
4
|
+
* Uses inquirer for arrow-key navigation, chalk for colors,
|
|
5
|
+
* ora for spinners, boxen for styled boxes, gradient-string for banners.
|
|
6
|
+
*
|
|
3
7
|
* Handles the full installation flow:
|
|
4
8
|
* 1. Edition selection (PREMIUM vs Community)
|
|
5
9
|
* 2. Email validation (PREMIUM only)
|
|
@@ -9,38 +13,38 @@
|
|
|
9
13
|
* 6. Post-install summary
|
|
10
14
|
*/
|
|
11
15
|
|
|
12
|
-
import { createInterface } from 'readline';
|
|
13
16
|
import { existsSync, mkdirSync, cpSync, writeFileSync, readFileSync } from 'fs';
|
|
14
17
|
import { resolve, dirname, join } from 'path';
|
|
15
18
|
import { fileURLToPath } from 'url';
|
|
16
19
|
import { execSync } from 'child_process';
|
|
20
|
+
import inquirer from 'inquirer';
|
|
21
|
+
import chalk from 'chalk';
|
|
22
|
+
import ora from 'ora';
|
|
23
|
+
import boxen from 'boxen';
|
|
24
|
+
import gradient from 'gradient-string';
|
|
17
25
|
import { validateEmail, getErrorMessage, resetAttempts } from './validate-email.js';
|
|
18
|
-
import { showStep, showSuccess, showError, showPostInstall } from './ascii-art.js';
|
|
19
26
|
|
|
20
27
|
const __filename = fileURLToPath(import.meta.url);
|
|
21
28
|
const __dirname = dirname(__filename);
|
|
22
29
|
const TEMPLATE_ROOT = resolve(__dirname, '..', '..');
|
|
23
30
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
resolve(answer.trim());
|
|
30
|
-
});
|
|
31
|
-
});
|
|
31
|
+
const megaGradient = gradient(['#6366f1', '#8b5cf6', '#a855f7']);
|
|
32
|
+
const goldGradient = gradient(['#f59e0b', '#eab308', '#fbbf24']);
|
|
33
|
+
|
|
34
|
+
function stepHeader(step, total, description) {
|
|
35
|
+
console.log(`\n ${chalk.dim(`─── Passo ${step} de ${total} ───`)} ${chalk.bold(description)}\n`);
|
|
32
36
|
}
|
|
33
37
|
|
|
34
38
|
/**
|
|
35
39
|
* Main installer flow
|
|
36
40
|
*/
|
|
37
41
|
export async function runInstaller(version) {
|
|
38
|
-
console.log(
|
|
42
|
+
console.log();
|
|
39
43
|
|
|
40
44
|
// ──────────────────────────────────────────────────────────
|
|
41
45
|
// STEP 1: Edition Selection
|
|
42
46
|
// ──────────────────────────────────────────────────────────
|
|
43
|
-
|
|
47
|
+
stepHeader(1, 5, 'Selecione sua Edição');
|
|
44
48
|
|
|
45
49
|
const isPremium = await selectEdition();
|
|
46
50
|
|
|
@@ -51,80 +55,100 @@ export async function runInstaller(version) {
|
|
|
51
55
|
let premiumToken = null;
|
|
52
56
|
|
|
53
57
|
if (isPremium) {
|
|
54
|
-
|
|
58
|
+
stepHeader(2, 5, 'Validação de Acesso Premium');
|
|
55
59
|
|
|
56
60
|
let validated = false;
|
|
57
61
|
resetAttempts();
|
|
58
62
|
|
|
59
63
|
while (!validated) {
|
|
60
|
-
const email = await prompt(
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
64
|
+
const { email } = await inquirer.prompt([{
|
|
65
|
+
type: 'input',
|
|
66
|
+
name: 'email',
|
|
67
|
+
message: chalk.cyan('Email cadastrado no MoneyClub:'),
|
|
68
|
+
validate: (input) => input.trim() ? true : chalk.red('Email não pode estar vazio.'),
|
|
69
|
+
}]);
|
|
66
70
|
|
|
67
|
-
|
|
68
|
-
const result = await validateEmail(email);
|
|
71
|
+
const spinner = ora({ text: 'Verificando acesso...', color: 'cyan' }).start();
|
|
72
|
+
const result = await validateEmail(email.trim());
|
|
69
73
|
|
|
70
74
|
if (result.valid) {
|
|
71
75
|
buyerName = result.name || 'Membro';
|
|
72
76
|
premiumToken = result.premium_token || null;
|
|
73
|
-
|
|
77
|
+
spinner.succeed(chalk.green(`Bem-vindo, ${chalk.bold(buyerName)}! Acesso PREMIUM confirmado.`));
|
|
74
78
|
if (result.installCount > 1) {
|
|
75
|
-
console.log(`
|
|
79
|
+
console.log(chalk.dim(` (Instalação #${result.installCount})`));
|
|
76
80
|
}
|
|
77
81
|
validated = true;
|
|
78
82
|
} else {
|
|
79
|
-
|
|
83
|
+
spinner.fail(chalk.red(getErrorMessage(result.reason)));
|
|
80
84
|
if (result.reason === 'max_attempts_exceeded') {
|
|
81
85
|
process.exit(1);
|
|
82
86
|
}
|
|
83
|
-
const retry = await prompt(
|
|
84
|
-
|
|
85
|
-
|
|
87
|
+
const { retry } = await inquirer.prompt([{
|
|
88
|
+
type: 'confirm',
|
|
89
|
+
name: 'retry',
|
|
90
|
+
message: 'Tentar novamente?',
|
|
91
|
+
default: true,
|
|
92
|
+
}]);
|
|
93
|
+
if (!retry) {
|
|
94
|
+
console.log(chalk.yellow('\n Instalação cancelada.\n'));
|
|
86
95
|
process.exit(0);
|
|
87
96
|
}
|
|
88
97
|
}
|
|
89
98
|
}
|
|
90
99
|
} else {
|
|
91
|
-
|
|
92
|
-
console.log('
|
|
100
|
+
stepHeader(2, 5, 'Modo Community');
|
|
101
|
+
console.log(chalk.dim(' Pulando validação — instalando shell sem conteúdo premium.'));
|
|
93
102
|
buyerName = 'Community User';
|
|
94
103
|
}
|
|
95
104
|
|
|
96
105
|
// ──────────────────────────────────────────────────────────
|
|
97
106
|
// STEP 3: Installation Directory
|
|
98
107
|
// ──────────────────────────────────────────────────────────
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
108
|
+
stepHeader(3, 5, 'Diretório de Instalação');
|
|
109
|
+
|
|
110
|
+
const cwd = process.cwd();
|
|
111
|
+
const { dirChoice } = await inquirer.prompt([{
|
|
112
|
+
type: 'list',
|
|
113
|
+
name: 'dirChoice',
|
|
114
|
+
message: chalk.cyan('Onde deseja instalar?'),
|
|
115
|
+
choices: [
|
|
116
|
+
{ name: `Diretório atual ${chalk.dim('(' + cwd + ')')}`, value: 'current' },
|
|
117
|
+
{ name: `Novo diretório ${chalk.dim('./mega-brain')}`, value: 'new' },
|
|
118
|
+
{ name: 'Caminho personalizado', value: 'custom' },
|
|
119
|
+
],
|
|
120
|
+
}]);
|
|
107
121
|
|
|
108
122
|
let targetDir;
|
|
109
|
-
switch (
|
|
110
|
-
case '
|
|
111
|
-
targetDir =
|
|
123
|
+
switch (dirChoice) {
|
|
124
|
+
case 'current':
|
|
125
|
+
targetDir = cwd;
|
|
112
126
|
break;
|
|
113
|
-
case '
|
|
114
|
-
const customPath = await prompt(
|
|
115
|
-
|
|
127
|
+
case 'custom': {
|
|
128
|
+
const { customPath } = await inquirer.prompt([{
|
|
129
|
+
type: 'input',
|
|
130
|
+
name: 'customPath',
|
|
131
|
+
message: chalk.cyan('Caminho completo:'),
|
|
132
|
+
validate: (input) => input.trim() ? true : chalk.red('Caminho não pode estar vazio.'),
|
|
133
|
+
}]);
|
|
134
|
+
targetDir = resolve(customPath.trim());
|
|
116
135
|
break;
|
|
117
136
|
}
|
|
118
|
-
case '
|
|
137
|
+
case 'new':
|
|
119
138
|
default:
|
|
120
|
-
targetDir = resolve(
|
|
139
|
+
targetDir = resolve(cwd, 'mega-brain');
|
|
121
140
|
break;
|
|
122
141
|
}
|
|
123
142
|
|
|
124
143
|
if (existsSync(join(targetDir, '.claude', 'CLAUDE.md'))) {
|
|
125
|
-
const overwrite = await prompt(
|
|
126
|
-
|
|
127
|
-
|
|
144
|
+
const { overwrite } = await inquirer.prompt([{
|
|
145
|
+
type: 'confirm',
|
|
146
|
+
name: 'overwrite',
|
|
147
|
+
message: chalk.yellow(`Mega Brain já existe em ${targetDir}. Sobrescrever?`),
|
|
148
|
+
default: false,
|
|
149
|
+
}]);
|
|
150
|
+
if (!overwrite) {
|
|
151
|
+
console.log(chalk.yellow('\n Instalação cancelada.\n'));
|
|
128
152
|
process.exit(0);
|
|
129
153
|
}
|
|
130
154
|
}
|
|
@@ -132,30 +156,32 @@ export async function runInstaller(version) {
|
|
|
132
156
|
// ──────────────────────────────────────────────────────────
|
|
133
157
|
// STEP 4: Install Shell (Layer 1 — always)
|
|
134
158
|
// ──────────────────────────────────────────────────────────
|
|
135
|
-
|
|
159
|
+
stepHeader(4, 5, 'Instalando estrutura base');
|
|
160
|
+
|
|
161
|
+
const installSpinner = ora({ text: 'Copiando arquivos do template...', color: 'cyan' }).start();
|
|
136
162
|
|
|
137
163
|
try {
|
|
138
164
|
if (!existsSync(targetDir)) {
|
|
139
165
|
mkdirSync(targetDir, { recursive: true });
|
|
140
166
|
}
|
|
141
167
|
|
|
142
|
-
// Copy template files (excluding node_modules, .git, bin/)
|
|
143
168
|
const excludeDirs = ['.git', 'node_modules', 'bin'];
|
|
144
169
|
copyTemplateFiles(TEMPLATE_ROOT, targetDir, excludeDirs);
|
|
145
170
|
|
|
146
|
-
|
|
171
|
+
installSpinner.text = 'Configurando ambiente...';
|
|
172
|
+
|
|
147
173
|
const envTemplate = resolve(__dirname, '..', 'templates', 'env.example');
|
|
148
174
|
if (existsSync(envTemplate)) {
|
|
149
175
|
const envContent = readFileSync(envTemplate, 'utf-8');
|
|
150
176
|
writeFileSync(join(targetDir, '.env.example'), envContent);
|
|
151
177
|
}
|
|
152
178
|
|
|
153
|
-
|
|
179
|
+
installSpinner.text = 'Criando diretórios...';
|
|
154
180
|
ensureDirectories(targetDir);
|
|
155
181
|
|
|
156
|
-
|
|
182
|
+
installSpinner.succeed(chalk.green('Estrutura base instalada!'));
|
|
157
183
|
} catch (err) {
|
|
158
|
-
|
|
184
|
+
installSpinner.fail(chalk.red(`Erro ao instalar: ${err.message}`));
|
|
159
185
|
process.exit(1);
|
|
160
186
|
}
|
|
161
187
|
|
|
@@ -163,22 +189,25 @@ export async function runInstaller(version) {
|
|
|
163
189
|
// STEP 5: Fetch Premium Content (Layer 2 — PREMIUM only)
|
|
164
190
|
// ──────────────────────────────────────────────────────────
|
|
165
191
|
if (isPremium && premiumToken) {
|
|
166
|
-
|
|
192
|
+
stepHeader(5, 5, 'Baixando conteúdo PREMIUM');
|
|
193
|
+
|
|
194
|
+
const premiumSpinner = ora({ text: 'Conectando ao repositório premium...', color: 'magenta' }).start();
|
|
167
195
|
|
|
168
196
|
try {
|
|
169
|
-
await fetchPremiumContent(targetDir, premiumToken);
|
|
170
|
-
|
|
197
|
+
await fetchPremiumContent(targetDir, premiumToken, premiumSpinner);
|
|
198
|
+
premiumSpinner.succeed(chalk.green('Conteúdo PREMIUM instalado!'));
|
|
171
199
|
} catch (err) {
|
|
172
|
-
|
|
173
|
-
console.log('
|
|
200
|
+
premiumSpinner.warn(chalk.yellow(`Não foi possível baixar conteúdo premium: ${err.message}`));
|
|
201
|
+
console.log(chalk.dim(' Tente novamente depois com: mega-brain upgrade'));
|
|
174
202
|
}
|
|
175
203
|
} else {
|
|
176
|
-
|
|
204
|
+
stepHeader(5, 5, 'Instalação Completa');
|
|
177
205
|
}
|
|
178
206
|
|
|
179
207
|
// ──────────────────────────────────────────────────────────
|
|
180
208
|
// Summary
|
|
181
209
|
// ──────────────────────────────────────────────────────────
|
|
210
|
+
console.log();
|
|
182
211
|
if (isPremium) {
|
|
183
212
|
showPostInstallPremium(buyerName);
|
|
184
213
|
} else {
|
|
@@ -187,46 +216,38 @@ export async function runInstaller(version) {
|
|
|
187
216
|
}
|
|
188
217
|
|
|
189
218
|
/**
|
|
190
|
-
* Edition selection with
|
|
219
|
+
* Edition selection with inquirer arrow-key list
|
|
191
220
|
*/
|
|
192
221
|
async function selectEdition() {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
│ → Templates vazios para começar │
|
|
223
|
-
│ → Sem agentes, sem playbooks, sem DNAs │
|
|
224
|
-
│ │
|
|
225
|
-
└──────────────────────────────────────────────────────────────────────┘
|
|
226
|
-
`);
|
|
227
|
-
|
|
228
|
-
const choice = await prompt(' Sua escolha (1/2): ');
|
|
229
|
-
return choice === '1';
|
|
222
|
+
const premiumLabel = goldGradient('★ PREMIUM') + chalk.white(' — Membro MoneyClub');
|
|
223
|
+
const premiumDesc = [
|
|
224
|
+
chalk.dim(' Sistema COMPLETO com o cérebro ligado.'),
|
|
225
|
+
chalk.dim(' Mentes Clonadas, C-Levels (CRO/CFO/CMO/COO),'),
|
|
226
|
+
chalk.dim(' Squad de Vendas, Conclave de Deliberação,'),
|
|
227
|
+
chalk.dim(' +50 fontes pagas já processadas.'),
|
|
228
|
+
chalk.dim(' Requer email cadastrado no MoneyClub.'),
|
|
229
|
+
].join('\n');
|
|
230
|
+
|
|
231
|
+
const communityLabel = chalk.white(' COMMUNITY') + chalk.dim(' — Máquina sem Cérebro');
|
|
232
|
+
const communityDesc = [
|
|
233
|
+
chalk.dim(' Estrutura vazia. Comandos, skills e protocolos'),
|
|
234
|
+
chalk.dim(' do JARVIS, mas SEM conteúdo processado.'),
|
|
235
|
+
chalk.dim(' Você precisará alimentar tudo do zero.'),
|
|
236
|
+
].join('\n');
|
|
237
|
+
|
|
238
|
+
const { edition } = await inquirer.prompt([{
|
|
239
|
+
type: 'list',
|
|
240
|
+
name: 'edition',
|
|
241
|
+
message: chalk.cyan('Escolha sua edição:'),
|
|
242
|
+
choices: [
|
|
243
|
+
{ name: premiumLabel + '\n' + premiumDesc, value: 'premium' },
|
|
244
|
+
new inquirer.Separator(chalk.dim(' ─────────────────────────────────────────')),
|
|
245
|
+
{ name: communityLabel + '\n' + communityDesc, value: 'community' },
|
|
246
|
+
],
|
|
247
|
+
loop: false,
|
|
248
|
+
}]);
|
|
249
|
+
|
|
250
|
+
return edition === 'premium';
|
|
230
251
|
}
|
|
231
252
|
|
|
232
253
|
/**
|
|
@@ -239,7 +260,7 @@ async function selectEdition() {
|
|
|
239
260
|
* The .layer-sync/ directory is left in place and listed in .gitignore.
|
|
240
261
|
* This installer runs on other people's machines — we never risk data loss.
|
|
241
262
|
*/
|
|
242
|
-
async function fetchPremiumContent(targetDir, token) {
|
|
263
|
+
async function fetchPremiumContent(targetDir, token, spinner) {
|
|
243
264
|
const premiumRepo = 'https://github.com/thiagofinch/mega-brain-premium.git';
|
|
244
265
|
const tempDir = join(targetDir, '.layer-sync', 'premium-fetch');
|
|
245
266
|
|
|
@@ -256,6 +277,8 @@ async function fetchPremiumContent(targetDir, token) {
|
|
|
256
277
|
|
|
257
278
|
// If a previous clone exists, reuse it (no delete + re-clone)
|
|
258
279
|
if (!existsSync(join(tempDir, '.git'))) {
|
|
280
|
+
spinner.text = 'Clonando repositório premium...';
|
|
281
|
+
|
|
259
282
|
// Use http.extraheader so the token is NEVER written to .git/config.
|
|
260
283
|
// The -c flag is a runtime-only override — not persisted to disk.
|
|
261
284
|
const base64Auth = Buffer.from(`x-access-token:${token}`).toString('base64');
|
|
@@ -269,9 +292,11 @@ async function fetchPremiumContent(targetDir, token) {
|
|
|
269
292
|
}
|
|
270
293
|
);
|
|
271
294
|
} else {
|
|
272
|
-
|
|
295
|
+
spinner.text = 'Download anterior encontrado, reutilizando...';
|
|
273
296
|
}
|
|
274
297
|
|
|
298
|
+
spinner.text = 'Integrando conteúdo premium na estrutura...';
|
|
299
|
+
|
|
275
300
|
// Copy premium content over the shell (merge, not replace)
|
|
276
301
|
const excludeDirs = ['.git', 'node_modules', 'bin', '.layer-sync'];
|
|
277
302
|
cpSync(tempDir, targetDir, {
|
|
@@ -287,8 +312,6 @@ async function fetchPremiumContent(targetDir, token) {
|
|
|
287
312
|
},
|
|
288
313
|
});
|
|
289
314
|
|
|
290
|
-
console.log(' Conteúdo premium integrado na estrutura.');
|
|
291
|
-
|
|
292
315
|
// NOTE: .layer-sync/ is intentionally NOT deleted.
|
|
293
316
|
// It is listed in .gitignore and contains no sensitive data
|
|
294
317
|
// (token was never written to disk thanks to http.extraheader).
|
|
@@ -299,48 +322,47 @@ async function fetchPremiumContent(targetDir, token) {
|
|
|
299
322
|
* Post-install message for PREMIUM users
|
|
300
323
|
*/
|
|
301
324
|
function showPostInstallPremium(name) {
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
325
|
+
const content =
|
|
326
|
+
goldGradient(' ★ Mega Brain PREMIUM instalado!') + '\n\n'
|
|
327
|
+
+ chalk.white(` Bem-vindo ao sistema completo, ${chalk.bold(name)}!`) + '\n\n'
|
|
328
|
+
+ chalk.dim(' Próximo passo:') + '\n'
|
|
329
|
+
+ chalk.white(' Abra o projeto no Claude Code e o JARVIS') + '\n'
|
|
330
|
+
+ chalk.white(' irá se apresentar automaticamente.') + '\n\n'
|
|
331
|
+
+ chalk.dim(' Comandos iniciais:') + '\n'
|
|
332
|
+
+ chalk.cyan(' /conclave "sua pergunta"') + chalk.dim(' — Deliberação estratégica') + '\n'
|
|
333
|
+
+ chalk.cyan(' /ingest [URL/arquivo]') + chalk.dim(' — Alimentar o sistema') + '\n'
|
|
334
|
+
+ chalk.cyan(' /ask [expert]') + chalk.dim(' — Consultar clone mental');
|
|
335
|
+
|
|
336
|
+
console.log(boxen(content, {
|
|
337
|
+
padding: 1,
|
|
338
|
+
margin: { left: 2 },
|
|
339
|
+
borderStyle: 'round',
|
|
340
|
+
borderColor: '#f59e0b',
|
|
341
|
+
}));
|
|
342
|
+
console.log();
|
|
320
343
|
}
|
|
321
344
|
|
|
322
345
|
/**
|
|
323
346
|
* Post-install message for Community users
|
|
324
347
|
*/
|
|
325
348
|
function showPostInstallCommunity() {
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
`);
|
|
349
|
+
const content =
|
|
350
|
+
megaGradient(' Mega Brain COMMUNITY instalado!') + '\n\n'
|
|
351
|
+
+ chalk.white(' Você tem a estrutura. Agora precisa do cérebro.') + '\n\n'
|
|
352
|
+
+ chalk.dim(' Para ativar o PREMIUM a qualquer momento:') + '\n'
|
|
353
|
+
+ chalk.cyan(' mega-brain upgrade') + '\n\n'
|
|
354
|
+
+ chalk.dim(' Ou comece do zero alimentando o sistema:') + '\n'
|
|
355
|
+
+ chalk.cyan(' /ingest [URL do YouTube]') + chalk.dim(' — Importar conteúdo') + '\n'
|
|
356
|
+
+ chalk.cyan(' /process-jarvis') + chalk.dim(' — Processar pipeline') + '\n\n'
|
|
357
|
+
+ chalk.dim(' moneyclub.thiagofinch.com — Acesse o PREMIUM completo');
|
|
358
|
+
|
|
359
|
+
console.log(boxen(content, {
|
|
360
|
+
padding: 1,
|
|
361
|
+
margin: { left: 2 },
|
|
362
|
+
borderStyle: 'round',
|
|
363
|
+
borderColor: '#6366f1',
|
|
364
|
+
}));
|
|
365
|
+
console.log();
|
|
344
366
|
}
|
|
345
367
|
|
|
346
368
|
function copyTemplateFiles(source, target, excludeDirs) {
|
package/bin/mega-brain.js
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
* CLI Entry Point
|
|
6
6
|
*
|
|
7
7
|
* Usage:
|
|
8
|
-
* npx mega-brain install - Install Mega Brain in current/specified directory
|
|
9
|
-
* npx mega-brain validate - Validate MoneyClub email
|
|
10
|
-
* npx mega-brain push - Push to Layer 1/2/3 remote
|
|
11
|
-
* npx mega-brain upgrade - Upgrade Community to Premium
|
|
12
|
-
* npx mega-brain --help - Show help
|
|
8
|
+
* npx mega-brain-ai install - Install Mega Brain in current/specified directory
|
|
9
|
+
* npx mega-brain-ai validate - Validate MoneyClub email
|
|
10
|
+
* npx mega-brain-ai push - Push to Layer 1/2/3 remote
|
|
11
|
+
* npx mega-brain-ai upgrade - Upgrade Community to Premium
|
|
12
|
+
* npx mega-brain-ai --help - Show help
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
import { createRequire } from 'module';
|
|
@@ -85,9 +85,9 @@ function showHelp() {
|
|
|
85
85
|
Layer 3 Full Backup (pessoal) — tudo incluindo dados sensíveis
|
|
86
86
|
|
|
87
87
|
Exemplos:
|
|
88
|
-
npx mega-brain install
|
|
89
|
-
npx mega-brain push --layer 1
|
|
90
|
-
npx mega-brain push
|
|
88
|
+
npx mega-brain-ai install
|
|
89
|
+
npx mega-brain-ai push --layer 1
|
|
90
|
+
npx mega-brain-ai push
|
|
91
91
|
`);
|
|
92
92
|
}
|
|
93
93
|
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mega-brain-ai",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "AI Knowledge Management System - Transform expert materials into actionable playbooks",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
|
+
"mega-brain-ai": "bin/cli.js",
|
|
7
8
|
"mega-brain": "bin/cli.js",
|
|
8
9
|
"mega-brain-push": "bin/push.js"
|
|
9
10
|
},
|