nex-framework-cli 1.0.12 → 1.0.13
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
CHANGED
|
@@ -28,7 +28,7 @@ program.configureHelp({
|
|
|
28
28
|
program
|
|
29
29
|
.name('nex')
|
|
30
30
|
.description('NEX Framework - Framework completo de agentes AI')
|
|
31
|
-
.version('1.0.
|
|
31
|
+
.version('1.0.12', '-v, --version', 'Mostra a versão')
|
|
32
32
|
.addHelpText('before', chalk.bold.cyan(`
|
|
33
33
|
╔════════════════════════════════════════════════════════════════╗
|
|
34
34
|
║ NEX Framework - CLI v1.0.9 ║
|
package/package.json
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import fs from 'fs-extra'
|
|
7
|
+
import { existsSync } from 'fs'
|
|
7
8
|
import path from 'path'
|
|
8
9
|
import yaml from 'yaml'
|
|
9
10
|
import chalk from 'chalk'
|
|
@@ -18,7 +19,30 @@ const __dirname = path.dirname(__filename)
|
|
|
18
19
|
export default class NEXMarketplace {
|
|
19
20
|
constructor(options = {}) {
|
|
20
21
|
this.projectRoot = options.projectRoot || process.cwd()
|
|
21
|
-
|
|
22
|
+
|
|
23
|
+
// Registry path: se não especificado, tenta encontrar no pacote npm instalado
|
|
24
|
+
if (options.registryPath) {
|
|
25
|
+
this.registryPath = options.registryPath
|
|
26
|
+
} else {
|
|
27
|
+
// Tentar encontrar o registry dentro do pacote npm instalado
|
|
28
|
+
try {
|
|
29
|
+
const currentFile = new URL(import.meta.url).pathname
|
|
30
|
+
const packageRoot = path.resolve(path.dirname(currentFile), '..', '..', '..')
|
|
31
|
+
const npmRegistryPath = path.join(packageRoot, 'registry')
|
|
32
|
+
|
|
33
|
+
// Verificar se existe (quando instalado via npm)
|
|
34
|
+
if (existsSync(npmRegistryPath)) {
|
|
35
|
+
this.registryPath = npmRegistryPath
|
|
36
|
+
} else {
|
|
37
|
+
// Fallback para registry no projeto
|
|
38
|
+
this.registryPath = path.join(this.projectRoot, 'registry')
|
|
39
|
+
}
|
|
40
|
+
} catch {
|
|
41
|
+
// Fallback para registry no projeto
|
|
42
|
+
this.registryPath = path.join(this.projectRoot, 'registry')
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
22
46
|
this.installPath = options.installPath || path.join(this.projectRoot, '.nex-core', 'agents')
|
|
23
47
|
|
|
24
48
|
// Supabase client
|
|
@@ -512,7 +536,7 @@ export default class NEXMarketplace {
|
|
|
512
536
|
results.forEach(agent => {
|
|
513
537
|
const icon = agent.icon || '🤖'
|
|
514
538
|
const name = agent.name
|
|
515
|
-
const version = agent.current_version || agent.version
|
|
539
|
+
const version = agent.current_version || agent.version || agent.latest_stable_version || 'latest'
|
|
516
540
|
const tagline = agent.tagline || agent.description?.substring(0, 60) + '...'
|
|
517
541
|
|
|
518
542
|
console.log(chalk.bold.cyan(`${icon} ${name} v${version}`))
|
|
@@ -541,8 +565,9 @@ export default class NEXMarketplace {
|
|
|
541
565
|
/**
|
|
542
566
|
* Get detailed agent information
|
|
543
567
|
*/
|
|
544
|
-
async info(agentId) {
|
|
545
|
-
const
|
|
568
|
+
async info(agentId, options = {}) {
|
|
569
|
+
const silent = options.silent || false
|
|
570
|
+
const spinner = silent ? null : ora(`Loading info for ${agentId}...`).start()
|
|
546
571
|
|
|
547
572
|
try {
|
|
548
573
|
// Try to load from API/Remote first (prefer API)
|
|
@@ -577,14 +602,16 @@ export default class NEXMarketplace {
|
|
|
577
602
|
}
|
|
578
603
|
|
|
579
604
|
if (!agent) {
|
|
580
|
-
spinner.fail(`Agent ${agentId} not found`)
|
|
605
|
+
if (spinner) spinner.fail(`Agent ${agentId} not found`)
|
|
581
606
|
return null
|
|
582
607
|
}
|
|
583
608
|
|
|
584
|
-
spinner.succeed(`Loaded info for ${agentId}`)
|
|
609
|
+
if (spinner) spinner.succeed(`Loaded info for ${agentId}`)
|
|
585
610
|
|
|
586
|
-
// Display detailed info
|
|
587
|
-
|
|
611
|
+
// Display detailed info (unless silent)
|
|
612
|
+
if (!silent) {
|
|
613
|
+
this.displayAgentInfo(agent)
|
|
614
|
+
}
|
|
588
615
|
|
|
589
616
|
return agent
|
|
590
617
|
|
|
@@ -737,11 +764,42 @@ export default class NEXMarketplace {
|
|
|
737
764
|
const version = options.version || await this.getLatestVersion(agentId)
|
|
738
765
|
spinner.text = `Installing ${agentId}@${version}...`
|
|
739
766
|
|
|
740
|
-
// 3. Load agent manifest
|
|
741
|
-
|
|
767
|
+
// 3. Load agent manifest (try API first, then local)
|
|
768
|
+
let manifest = null
|
|
769
|
+
|
|
770
|
+
// Try to get from API/marketplace first
|
|
771
|
+
if (this.apiUrl || this.supabase) {
|
|
772
|
+
try {
|
|
773
|
+
const agentInfo = await this.info(agentId, { silent: true })
|
|
774
|
+
if (agentInfo) {
|
|
775
|
+
// Convert API agent to manifest format
|
|
776
|
+
manifest = {
|
|
777
|
+
agent_id: agentInfo.agent_id || agentId,
|
|
778
|
+
name: agentInfo.name,
|
|
779
|
+
version: agentInfo.current_version || agentInfo.latest_stable_version || '1.0.0',
|
|
780
|
+
description: agentInfo.description,
|
|
781
|
+
tagline: agentInfo.tagline,
|
|
782
|
+
icon: agentInfo.icon,
|
|
783
|
+
category: agentInfo.category,
|
|
784
|
+
dependencies: agentInfo.dependencies || {},
|
|
785
|
+
repository_url: agentInfo.repository_url,
|
|
786
|
+
documentation_url: agentInfo.documentation_url
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
} catch (error) {
|
|
790
|
+
// API failed, try local
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
// Fallback to local registry
|
|
795
|
+
if (!manifest) {
|
|
796
|
+
manifest = await this.loadLocalManifest(agentId)
|
|
797
|
+
}
|
|
742
798
|
|
|
743
799
|
if (!manifest) {
|
|
744
|
-
spinner.fail(`Agent ${agentId} not found in registry`)
|
|
800
|
+
spinner.fail(`Agent ${agentId} not found in registry or marketplace`)
|
|
801
|
+
console.log(chalk.yellow('\n💡 Tip: Make sure the agent ID is correct.'))
|
|
802
|
+
console.log(chalk.gray(' Try: nex agent search <query> to find agents\n'))
|
|
745
803
|
return false
|
|
746
804
|
}
|
|
747
805
|
|