nex-framework-cli 1.0.4 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/nex-cli.js +109 -11
- package/package.json +1 -1
- package/src/services/nex-marketplace/NEXMarketplace.js +78 -0
package/cli/nex-cli.js
CHANGED
|
@@ -15,17 +15,51 @@ const __dirname = path.dirname(__filename)
|
|
|
15
15
|
|
|
16
16
|
const program = new Command()
|
|
17
17
|
|
|
18
|
+
// Custom help formatting
|
|
19
|
+
program.configureHelp({
|
|
20
|
+
helpWidth: 100,
|
|
21
|
+
sortSubcommands: true,
|
|
22
|
+
subcommandTerm: (cmd) => {
|
|
23
|
+
const aliases = cmd.aliases().length > 0 ? `|${cmd.aliases().join('|')}` : ''
|
|
24
|
+
return chalk.cyan(`${cmd.name()}${aliases}`)
|
|
25
|
+
}
|
|
26
|
+
})
|
|
27
|
+
|
|
18
28
|
program
|
|
19
29
|
.name('nex')
|
|
20
30
|
.description('NEX Framework - Framework completo de agentes AI')
|
|
21
|
-
.version('1.0.
|
|
31
|
+
.version('1.0.6', '-v, --version', 'Mostra a versão')
|
|
32
|
+
.addHelpText('before', chalk.bold.cyan(`
|
|
33
|
+
╔════════════════════════════════════════════════════════════════╗
|
|
34
|
+
║ NEX Framework - CLI v1.0.6 ║
|
|
35
|
+
║ Framework completo de agentes AI ║
|
|
36
|
+
╚════════════════════════════════════════════════════════════════╝
|
|
37
|
+
`))
|
|
38
|
+
.addHelpText('after', chalk.gray(`
|
|
39
|
+
📚 Exemplos rápidos:
|
|
40
|
+
${chalk.cyan('nex agent list --all')} Lista todos os agentes disponíveis
|
|
41
|
+
${chalk.cyan('nex agent search planning')} Busca agentes por termo
|
|
42
|
+
${chalk.cyan('nex agent install anx')} Instala um agente
|
|
43
|
+
${chalk.cyan('nex agent info anx')} Mostra informações de um agente
|
|
44
|
+
|
|
45
|
+
📖 Para mais informações sobre um comando:
|
|
46
|
+
${chalk.cyan('nex <comando> --help')} Ex: nex agent --help
|
|
47
|
+
|
|
48
|
+
🔗 Documentação: https://github.com/INOSX/nex-store
|
|
49
|
+
`))
|
|
22
50
|
|
|
23
51
|
// Comando: init
|
|
24
52
|
program
|
|
25
53
|
.command('init')
|
|
26
54
|
.description('Inicializa um novo projeto NEX')
|
|
27
55
|
.option('-n, --name <name>', 'Nome do projeto')
|
|
28
|
-
.option('-t, --template <template>', 'Template a usar')
|
|
56
|
+
.option('-t, --template <template>', 'Template a usar (blank, full-stack, api-only, mobile)')
|
|
57
|
+
.addHelpText('after', chalk.gray(`
|
|
58
|
+
Exemplos:
|
|
59
|
+
${chalk.cyan('nex init')} Inicializa projeto interativamente
|
|
60
|
+
${chalk.cyan('nex init -n meu-projeto')} Inicializa com nome específico
|
|
61
|
+
${chalk.cyan('nex init -t full-stack')} Usa template full-stack
|
|
62
|
+
`))
|
|
29
63
|
.action(async (options) => {
|
|
30
64
|
console.log(chalk.blue('🚀 Inicializando projeto NEX...'))
|
|
31
65
|
|
|
@@ -60,6 +94,14 @@ program
|
|
|
60
94
|
program
|
|
61
95
|
.command('plan')
|
|
62
96
|
.description('Gera plano completo do projeto (PRD, arquitetura, etc.)')
|
|
97
|
+
.option('-r, --requirements <file>', 'Arquivo de requisitos JSON')
|
|
98
|
+
.option('-o, --output <dir>', 'Diretório de saída')
|
|
99
|
+
.addHelpText('after', chalk.gray(`
|
|
100
|
+
Exemplos:
|
|
101
|
+
${chalk.cyan('nex plan')} Gera plano interativamente
|
|
102
|
+
${chalk.cyan('nex plan -r requirements.json')} Usa arquivo de requisitos
|
|
103
|
+
${chalk.cyan('nex plan -o ./docs')} Salva em diretório específico
|
|
104
|
+
`))
|
|
63
105
|
.option('-r, --requirements <file>', 'Arquivo de requisitos')
|
|
64
106
|
.option('-o, --output <dir>', 'Diretório de saída')
|
|
65
107
|
.action(async (options) => {
|
|
@@ -104,14 +146,24 @@ program
|
|
|
104
146
|
const agentCmd = program
|
|
105
147
|
.command('agent')
|
|
106
148
|
.description('Gerencia agentes do NEX Marketplace')
|
|
149
|
+
.addHelpText('before', chalk.bold('\n📦 Marketplace de Agentes\n'))
|
|
150
|
+
.addHelpText('after', chalk.gray(`
|
|
151
|
+
💡 Dica: Use ${chalk.cyan('nex agent list --all')} para ver todos os agentes disponíveis
|
|
152
|
+
`))
|
|
107
153
|
|
|
108
154
|
// agent search
|
|
109
155
|
agentCmd
|
|
110
156
|
.command('search <query>')
|
|
111
|
-
.description('Busca agentes no marketplace')
|
|
112
|
-
.option('-c, --category <category>', 'Filtrar por categoria')
|
|
157
|
+
.description('Busca agentes no marketplace por termo')
|
|
158
|
+
.option('-c, --category <category>', 'Filtrar por categoria (planning, execution, community)')
|
|
113
159
|
.option('--official', 'Apenas agentes oficiais')
|
|
114
160
|
.option('-l, --limit <number>', 'Limitar resultados', '50')
|
|
161
|
+
.addHelpText('after', chalk.gray(`
|
|
162
|
+
Exemplos:
|
|
163
|
+
${chalk.cyan('nex agent search planning')} Busca por "planning"
|
|
164
|
+
${chalk.cyan('nex agent search "análise" --official')} Busca apenas oficiais
|
|
165
|
+
${chalk.cyan('nex agent search "" --category planning')} Lista todos de planejamento
|
|
166
|
+
`))
|
|
115
167
|
.action(async (query, options) => {
|
|
116
168
|
const { default: NEXMarketplace } = await import('../src/services/nex-marketplace/NEXMarketplace.js')
|
|
117
169
|
const marketplace = new NEXMarketplace()
|
|
@@ -121,9 +173,15 @@ agentCmd
|
|
|
121
173
|
// agent install
|
|
122
174
|
agentCmd
|
|
123
175
|
.command('install <agentId>')
|
|
124
|
-
.description('Instala um agente')
|
|
176
|
+
.description('Instala um agente no projeto atual')
|
|
125
177
|
.option('-v, --version <version>', 'Versão específica')
|
|
126
178
|
.option('-m, --method <method>', 'Método de instalação (symlink|copy)')
|
|
179
|
+
.addHelpText('after', chalk.gray(`
|
|
180
|
+
Exemplos:
|
|
181
|
+
${chalk.cyan('nex agent install anx')} Instala o agente ANX
|
|
182
|
+
${chalk.cyan('nex agent install anx -v 1.0.0')} Instala versão específica
|
|
183
|
+
${chalk.cyan('nex agent install anx -m copy')} Instala usando cópia
|
|
184
|
+
`))
|
|
127
185
|
.action(async (agentId, options) => {
|
|
128
186
|
const { default: NEXMarketplace } = await import('../src/services/nex-marketplace/NEXMarketplace.js')
|
|
129
187
|
const marketplace = new NEXMarketplace()
|
|
@@ -134,18 +192,39 @@ agentCmd
|
|
|
134
192
|
agentCmd
|
|
135
193
|
.command('list')
|
|
136
194
|
.alias('ls')
|
|
137
|
-
.description('Lista agentes instalados')
|
|
138
|
-
.option('-a, --all', '
|
|
195
|
+
.description('Lista agentes instalados ou todos os agentes disponíveis no marketplace')
|
|
196
|
+
.option('-a, --all', 'Listar todos os agentes disponíveis no marketplace')
|
|
197
|
+
.option('-c, --category <category>', 'Filtrar por categoria (planning, execution, community)')
|
|
198
|
+
.option('--official', 'Apenas agentes oficiais')
|
|
199
|
+
.addHelpText('after', chalk.gray(`
|
|
200
|
+
Exemplos:
|
|
201
|
+
${chalk.cyan('nex agent list --all')} Lista todos os agentes disponíveis
|
|
202
|
+
${chalk.cyan('nex agent list')} Lista apenas agentes instalados
|
|
203
|
+
${chalk.cyan('nex agent list --all --category planning')} Lista agentes de planejamento
|
|
204
|
+
${chalk.cyan('nex agent list --all --official')} Lista apenas agentes oficiais
|
|
205
|
+
`))
|
|
139
206
|
.action(async (options) => {
|
|
140
207
|
const { default: NEXMarketplace } = await import('../src/services/nex-marketplace/NEXMarketplace.js')
|
|
141
208
|
const marketplace = new NEXMarketplace()
|
|
142
|
-
|
|
209
|
+
|
|
210
|
+
if (options.all) {
|
|
211
|
+
// Listar todos os agentes disponíveis no marketplace
|
|
212
|
+
await marketplace.listAll(options)
|
|
213
|
+
} else {
|
|
214
|
+
// Listar apenas agentes instalados
|
|
215
|
+
await marketplace.list(options)
|
|
216
|
+
}
|
|
143
217
|
})
|
|
144
218
|
|
|
145
219
|
// agent info
|
|
146
220
|
agentCmd
|
|
147
221
|
.command('info <agentId>')
|
|
148
222
|
.description('Mostra informações detalhadas do agente')
|
|
223
|
+
.addHelpText('after', chalk.gray(`
|
|
224
|
+
Exemplos:
|
|
225
|
+
${chalk.cyan('nex agent info anx')} Informações do agente ANX
|
|
226
|
+
${chalk.cyan('nex agent info pmx')} Informações do agente PMX
|
|
227
|
+
`))
|
|
149
228
|
.action(async (agentId) => {
|
|
150
229
|
const { default: NEXMarketplace } = await import('../src/services/nex-marketplace/NEXMarketplace.js')
|
|
151
230
|
const marketplace = new NEXMarketplace()
|
|
@@ -156,7 +235,12 @@ agentCmd
|
|
|
156
235
|
agentCmd
|
|
157
236
|
.command('uninstall <agentId>')
|
|
158
237
|
.alias('remove')
|
|
159
|
-
.description('Remove um agente instalado')
|
|
238
|
+
.description('Remove um agente instalado do projeto')
|
|
239
|
+
.addHelpText('after', chalk.gray(`
|
|
240
|
+
Exemplos:
|
|
241
|
+
${chalk.cyan('nex agent uninstall anx')} Remove o agente ANX
|
|
242
|
+
${chalk.cyan('nex agent remove anx')} Alias para uninstall
|
|
243
|
+
`))
|
|
160
244
|
.action(async (agentId) => {
|
|
161
245
|
const { default: NEXMarketplace } = await import('../src/services/nex-marketplace/NEXMarketplace.js')
|
|
162
246
|
const marketplace = new NEXMarketplace()
|
|
@@ -166,8 +250,13 @@ agentCmd
|
|
|
166
250
|
// agent update
|
|
167
251
|
agentCmd
|
|
168
252
|
.command('update [agentId]')
|
|
169
|
-
.description('Atualiza agente(s)')
|
|
170
|
-
.option('-a, --all', 'Atualizar todos os agentes')
|
|
253
|
+
.description('Atualiza agente(s) para a versão mais recente')
|
|
254
|
+
.option('-a, --all', 'Atualizar todos os agentes instalados')
|
|
255
|
+
.addHelpText('after', chalk.gray(`
|
|
256
|
+
Exemplos:
|
|
257
|
+
${chalk.cyan('nex agent update anx')} Atualiza o agente ANX
|
|
258
|
+
${chalk.cyan('nex agent update --all')} Atualiza todos os agentes
|
|
259
|
+
`))
|
|
171
260
|
.action(async (agentId, options) => {
|
|
172
261
|
const { default: NEXMarketplace } = await import('../src/services/nex-marketplace/NEXMarketplace.js')
|
|
173
262
|
const marketplace = new NEXMarketplace()
|
|
@@ -188,6 +277,10 @@ agentCmd
|
|
|
188
277
|
agentCmd
|
|
189
278
|
.command('register <agentId>')
|
|
190
279
|
.description('Registra um agente no NEX Hub para uso')
|
|
280
|
+
.addHelpText('after', chalk.gray(`
|
|
281
|
+
Exemplos:
|
|
282
|
+
${chalk.cyan('nex agent register anx')} Registra o agente ANX no Hub
|
|
283
|
+
`))
|
|
191
284
|
.action(async (agentId) => {
|
|
192
285
|
const { default: NEXMarketplace } = await import('../src/services/nex-marketplace/NEXMarketplace.js')
|
|
193
286
|
const marketplace = new NEXMarketplace()
|
|
@@ -199,6 +292,11 @@ agentCmd
|
|
|
199
292
|
.command('my-agents')
|
|
200
293
|
.alias('registered')
|
|
201
294
|
.description('Lista agentes registrados no NEX Hub')
|
|
295
|
+
.addHelpText('after', chalk.gray(`
|
|
296
|
+
Exemplos:
|
|
297
|
+
${chalk.cyan('nex agent my-agents')} Lista seus agentes registrados
|
|
298
|
+
${chalk.cyan('nex agent registered')} Alias para my-agents
|
|
299
|
+
`))
|
|
202
300
|
.action(async () => {
|
|
203
301
|
const { default: NEXMarketplace } = await import('../src/services/nex-marketplace/NEXMarketplace.js')
|
|
204
302
|
const marketplace = new NEXMarketplace()
|
package/package.json
CHANGED
|
@@ -165,6 +165,84 @@ export default class NEXMarketplace {
|
|
|
165
165
|
return agents || []
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
+
/**
|
|
169
|
+
* List all available agents (browse marketplace)
|
|
170
|
+
*/
|
|
171
|
+
async listAll(options = {}) {
|
|
172
|
+
const spinner = ora('Loading available agents...').start()
|
|
173
|
+
|
|
174
|
+
try {
|
|
175
|
+
let results = []
|
|
176
|
+
|
|
177
|
+
// List from API/Remote if available
|
|
178
|
+
if (this.apiUrl) {
|
|
179
|
+
results = await this.listAllViaAPI(options)
|
|
180
|
+
} else if (this.supabase) {
|
|
181
|
+
results = await this.listAllViaClient(options)
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// Also include local registry
|
|
185
|
+
const localResults = await this.searchLocal('', options)
|
|
186
|
+
|
|
187
|
+
// Merge results
|
|
188
|
+
const merged = this.mergeResults(results, localResults)
|
|
189
|
+
|
|
190
|
+
spinner.succeed(`Found ${merged.length} available agents`)
|
|
191
|
+
|
|
192
|
+
// Display results
|
|
193
|
+
this.displaySearchResults(merged)
|
|
194
|
+
|
|
195
|
+
return merged
|
|
196
|
+
|
|
197
|
+
} catch (error) {
|
|
198
|
+
spinner.fail('Failed to load agents')
|
|
199
|
+
console.error(chalk.red(`Error: ${error.message}`))
|
|
200
|
+
throw error
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* List all agents via Edge Function API
|
|
206
|
+
*/
|
|
207
|
+
async listAllViaAPI(options = {}) {
|
|
208
|
+
const response = await fetch(`${this.apiUrl}/list`)
|
|
209
|
+
|
|
210
|
+
if (!response.ok) {
|
|
211
|
+
throw new Error(`API error: ${response.statusText}`)
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
const { agents } = await response.json()
|
|
215
|
+
return agents || []
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* List all agents via Supabase client (fallback)
|
|
220
|
+
*/
|
|
221
|
+
async listAllViaClient(options = {}) {
|
|
222
|
+
let query = this.supabase
|
|
223
|
+
.from('nex_marketplace_agents')
|
|
224
|
+
.select('*')
|
|
225
|
+
.eq('is_active', true)
|
|
226
|
+
.order('total_installs', { ascending: false })
|
|
227
|
+
|
|
228
|
+
if (options.category) {
|
|
229
|
+
query = query.eq('category', options.category)
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
if (options.official) {
|
|
233
|
+
query = query.eq('is_official', true)
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
const limit = options.limit || 100
|
|
237
|
+
query = query.limit(limit)
|
|
238
|
+
|
|
239
|
+
const { data, error } = await query
|
|
240
|
+
|
|
241
|
+
if (error) throw error
|
|
242
|
+
|
|
243
|
+
return data || []
|
|
244
|
+
}
|
|
245
|
+
|
|
168
246
|
/**
|
|
169
247
|
* Search via Supabase client (fallback - requer anon key)
|
|
170
248
|
*/
|