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.

@@ -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 banner = `
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
- Powered by JARVIS AI Orchestration
22
- MoneyClub Edition v${version}
23
- `;
24
- console.log(banner);
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
- ┌${'─'.repeat(message.length + 4)}
30
- │ ${message}
31
- └${''.repeat(message.length + 4)}┘
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 ${message}\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
- │ Mega Brain instalado com sucesso! │
48
- │ │
49
- │ Próximo passo: │
50
- │ Abra o projeto no Claude Code e │
51
- │ execute: /setup │
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
- console.log(`
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
- 📊 STATUS DO SISTEMA
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
- 🧠 CAPACIDADES DO SISTEMA
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
- 🚀 COMECE A DAR PODER AO JARVIS
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
- │ 📥 CHECKLIST 2: Conteúdos do Seu Negócio │
196
- ├─────────────────────────────────────────────────────────────────────────────┤
197
- │ │
198
- │ 🎯 Objetivo: Dar contexto real aos agentes │
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
- O sistema acionará automaticamente:
219
- Fase 0 Constituição (4 princípios)
220
- Fase 1 C-Levels (CRO, CFO, CMO, COO)
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
- 📌 Resultado: Decisão fundamentada com evidências citadas,
226
- grau de confiança medido e plano de ação detalhado.
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
  }
@@ -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
- function prompt(question) {
25
- const rl = createInterface({ input: process.stdin, output: process.stdout });
26
- return new Promise((resolve) => {
27
- rl.question(question, (answer) => {
28
- rl.close();
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('\n Bem-vindo ao instalador do Mega Brain!\n');
42
+ console.log();
39
43
 
40
44
  // ──────────────────────────────────────────────────────────
41
45
  // STEP 1: Edition Selection
42
46
  // ──────────────────────────────────────────────────────────
43
- showStep(1, 5, 'Selecione sua Edição');
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
- showStep(2, 5, 'Validação de Acesso Premium');
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(' Digite o email cadastrado no MoneyClub: ');
61
-
62
- if (!email) {
63
- showError('Email não pode estar vazio.');
64
- continue;
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
- console.log(' Verificando...');
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
- console.log(`\n Bem-vindo, ${buyerName}! Acesso PREMIUM confirmado.`);
77
+ spinner.succeed(chalk.green(`Bem-vindo, ${chalk.bold(buyerName)}! Acesso PREMIUM confirmado.`));
74
78
  if (result.installCount > 1) {
75
- console.log(` (Esta é a sua instalação #${result.installCount})`);
79
+ console.log(chalk.dim(` (Instalação #${result.installCount})`));
76
80
  }
77
81
  validated = true;
78
82
  } else {
79
- showError(getErrorMessage(result.reason));
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(' Tentar novamente? (s/n): ');
84
- if (retry.toLowerCase() !== 's') {
85
- console.log('\n Instalação cancelada.\n');
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
- showStep(2, 5, 'Modo Community — Pulando validação');
92
- console.log('\n Instalando versão Community (shell sem conteúdo premium).');
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
- showStep(3, 5, 'Diretório de Instalação');
100
-
101
- console.log('\n Onde deseja instalar o Mega Brain?');
102
- console.log(' [1] Diretório atual (.)');
103
- console.log(' [2] Novo diretório (./mega-brain)');
104
- console.log(' [3] Caminho personalizado\n');
105
-
106
- const choice = await prompt(' Escolha (1/2/3): ');
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 (choice) {
110
- case '1':
111
- targetDir = process.cwd();
123
+ switch (dirChoice) {
124
+ case 'current':
125
+ targetDir = cwd;
112
126
  break;
113
- case '3': {
114
- const customPath = await prompt(' Digite o caminho completo: ');
115
- targetDir = resolve(customPath);
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 '2':
137
+ case 'new':
119
138
  default:
120
- targetDir = resolve(process.cwd(), 'mega-brain');
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(`\n Mega Brain ja existe em ${targetDir}. Sobrescrever? (s/n): `);
126
- if (overwrite.toLowerCase() !== 's') {
127
- console.log('\n Instalação cancelada.\n');
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
- showStep(4, 5, 'Instalando estrutura base...');
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
- // Create .env from template
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
- // Ensure all directories exist with .gitkeep
179
+ installSpinner.text = 'Criando diretórios...';
154
180
  ensureDirectories(targetDir);
155
181
 
156
- console.log('\n Estrutura base instalada com sucesso!');
182
+ installSpinner.succeed(chalk.green('Estrutura base instalada!'));
157
183
  } catch (err) {
158
- showError(`Erro ao instalar: ${err.message}`);
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
- showStep(5, 5, 'Baixando conteúdo PREMIUM...');
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
- console.log('\n Conteúdo PREMIUM instalado com sucesso!');
197
+ await fetchPremiumContent(targetDir, premiumToken, premiumSpinner);
198
+ premiumSpinner.succeed(chalk.green('Conteúdo PREMIUM instalado!'));
171
199
  } catch (err) {
172
- console.log(`\n AVISO: Não foi possível baixar conteúdo premium: ${err.message}`);
173
- console.log(' Você pode tentar novamente depois com: mega-brain upgrade');
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
- showStep(5, 5, 'Instalação Completa');
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 marketing copy
219
+ * Edition selection with inquirer arrow-key list
191
220
  */
192
221
  async function selectEdition() {
193
- console.log(`
194
- ┌──────────────────────────────────────────────────────────────────────┐
195
- │ │
196
- │ [1] PREMIUM Membro MoneyClub │
197
- │ │
198
- │ O sistema COMPLETO com o cérebro ligado.
199
- │ Inclui Mentes Clonadas de experts reais, Agentes │
200
- │ Operacionais que trabalham no seu negócio, +$500 mil │
201
- │ dólares em conteúdo pago já processado e pronto. │
202
- │ │
203
- │ → Clones cognitivos que PENSAM como os experts │
204
- │ → C-Levels (CRO, CFO, CMO, COO) operando 24/7 │
205
- │ → Squad de Vendas (Closer, BDR, SDS, LNS) │
206
- │ → Conclave de Deliberação Estratégica │
207
- │ → Playbooks e Frameworks extraídos de +50 fontes pagas │
208
- │ → Pipeline JARVIS de processamento inteligente │
209
- │ │
210
- │ Requer email cadastrado no MoneyClub. │
211
- │ │
212
- ├──────────────────────────────────────────────────────────────────────┤
213
- │ │
214
- │ [2] COMMUNITY Máquina sem Cérebro │
215
- │ │
216
- │ A estrutura vazia. Comandos, skills e protocolos │
217
- │ do JARVIS, mas SEM conteúdo processado. │
218
- │ Você precisará alimentar tudo do zero. │
219
- │ │
220
- │ → Estrutura de pastas e comandos │
221
- │ → Skills e hooks do Claude Code │
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 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
- console.log(' Download anterior encontrado, reutilizando...');
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
- console.log(`
303
- ┌──────────────────────────────────────────────────────────────┐
304
- │ │
305
- │ Mega Brain PREMIUM instalado com sucesso! │
306
- │ │
307
- │ Bem-vindo ao sistema completo, ${(name + '!').padEnd(25)} │
308
- │ │
309
- │ Próximo passo: │
310
- │ Abra o projeto no Claude Code e o JARVIS │
311
- │ irá se apresentar automaticamente.
312
- │ │
313
- │ Comandos iniciais: │
314
- /conclave "sua pergunta" — Deliberação estratégica │
315
- /ingest [URL/arquivo] — Alimentar o sistema │
316
- /ask [expert] — Consultar clone mental │
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
- console.log(`
327
- ┌──────────────────────────────────────────────────────────────┐
328
- │ │
329
- │ Mega Brain COMMUNITY instalado com sucesso! │
330
- │ │
331
- │ Você tem a estrutura. Agora precisa do cérebro. │
332
- │ │
333
- │ Para ativar o PREMIUM a qualquer momento: │
334
- mega-brain upgrade │
335
- │ │
336
- │ Ou comece do zero alimentando o sistema: │
337
- /ingest [URL do YouTube] — Importar conteúdo │
338
- /process-jarvis — Processar pipeline │
339
- │ │
340
- │ moneyclub.thiagofinch.com — Acesse o PREMIUM completo │
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.1.0",
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
  },