nex-framework-cli 1.0.18 → 1.0.19

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
@@ -342,20 +342,37 @@ program
342
342
  })
343
343
 
344
344
  // Comando: config
345
- program
345
+ const configCmd = program
346
346
  .command('config')
347
- .description('Gerencia configurações')
348
- .option('get <key>', 'Obtém valor de configuração')
349
- .option('set <key> <value>', 'Define valor de configuração')
350
- .option('list', 'Lista todas as configurações')
351
- .action(async (options) => {
352
- if (options.get) {
353
- // Obter configuração
354
- } else if (options.set) {
355
- // Definir configuração
356
- } else if (options.list) {
357
- // Listar configurações
358
- }
347
+ .description('Gerencia configurações do NEX CLI')
348
+
349
+ configCmd
350
+ .command('reset')
351
+ .description('Reconfigura o NEX CLI (nome, idiomas, integração Cursor)')
352
+ .action(async () => {
353
+ const { runSetup } = await import('../scripts/postinstall.js')
354
+ await runSetup()
355
+ })
356
+
357
+ configCmd
358
+ .command('show')
359
+ .alias('list')
360
+ .description('Mostra a configuração atual')
361
+ .action(async () => {
362
+ const { default: NEXMarketplace } = await import('../src/services/nex-marketplace/NEXMarketplace.js')
363
+ const marketplace = new NEXMarketplace()
364
+ const config = marketplace.getGlobalConfig()
365
+
366
+ console.log(chalk.blue('\n⚙️ Configuração do NEX CLI\n'))
367
+ console.log(chalk.gray('Usuário:'))
368
+ console.log(chalk.white(` Nome: ${config.user.name}`))
369
+ console.log(chalk.white(` Idioma de conversação: ${config.user.conversationLanguage}`))
370
+ console.log(chalk.white(` Idioma de documentos: ${config.user.documentLanguage}`))
371
+ console.log(chalk.gray('\nCursor:'))
372
+ console.log(chalk.white(` Integração: ${config.cursor.enabled ? chalk.green('Habilitada') : chalk.red('Desabilitada')}`))
373
+
374
+ const configPath = marketplace.getGlobalConfigPath()
375
+ console.log(chalk.gray(`\nArquivo: ${configPath}\n`))
359
376
  })
360
377
 
361
378
  // Funções auxiliares
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nex-framework-cli",
3
- "version": "1.0.18",
3
+ "version": "1.0.19",
4
4
  "description": "NEX CLI - Command-line interface for NEX Framework and Agent Marketplace",
5
5
  "type": "module",
6
6
  "main": "cli/nex-cli.js",
@@ -15,7 +15,7 @@ const __filename = fileURLToPath(import.meta.url)
15
15
  const __dirname = path.dirname(__filename)
16
16
 
17
17
  // Get global config path
18
- function getGlobalConfigPath() {
18
+ export function getGlobalConfigPath() {
19
19
  const homeDir = os.homedir()
20
20
 
21
21
  if (process.platform === 'win32') {
@@ -27,7 +27,7 @@ function getGlobalConfigPath() {
27
27
  }
28
28
  }
29
29
 
30
- async function runSetup() {
30
+ export async function runSetup() {
31
31
  // Check if config already exists
32
32
  const configPath = getGlobalConfigPath()
33
33
  const configDir = path.dirname(configPath)
@@ -122,8 +122,16 @@ async function runSetup() {
122
122
  console.log(chalk.cyan('\n💡 Dica: Para reconfigurar, execute: nex config reset\n'))
123
123
  }
124
124
 
125
- // Only run if not in CI/CD or if explicitly requested
126
- if (process.env.CI !== 'true' && process.env.NEX_SKIP_SETUP !== 'true') {
125
+ // Check if running in interactive mode (TTY available)
126
+ const isInteractive = process.stdin.isTTY && process.stdout.isTTY && process.stderr.isTTY
127
+ const isCI = process.env.CI === 'true'
128
+ const skipSetup = process.env.NEX_SKIP_SETUP === 'true'
129
+
130
+ // Only run interactive setup if:
131
+ // 1. Not in CI
132
+ // 2. Not explicitly skipped
133
+ // 3. Running in interactive mode (TTY)
134
+ if (!isCI && !skipSetup && isInteractive) {
127
135
  runSetup().catch((error) => {
128
136
  console.error(chalk.red('\n❌ Erro ao configurar NEX CLI:'))
129
137
  console.error(chalk.red(error.message))
@@ -131,12 +139,12 @@ if (process.env.CI !== 'true' && process.env.NEX_SKIP_SETUP !== 'true') {
131
139
  process.exit(0) // Don't fail the install
132
140
  })
133
141
  } else {
134
- // In CI/CD, create default config silently
142
+ // Non-interactive mode: create default config silently
135
143
  const configPath = getGlobalConfigPath()
136
144
  const configDir = path.dirname(configPath)
137
145
  const defaultConfig = {
138
146
  user: {
139
- name: 'Developer',
147
+ name: process.env.USER || process.env.USERNAME || 'Developer',
140
148
  conversationLanguage: 'pt-BR',
141
149
  documentLanguage: 'pt-BR'
142
150
  },
@@ -149,7 +157,13 @@ if (process.env.CI !== 'true' && process.env.NEX_SKIP_SETUP !== 'true') {
149
157
 
150
158
  fs.ensureDir(configDir)
151
159
  .then(() => fs.writeJSON(configPath, defaultConfig, { spaces: 2 }))
160
+ .then(() => {
161
+ if (!isCI && isInteractive) {
162
+ console.log(chalk.green('\n✅ NEX CLI instalado com configuração padrão'))
163
+ console.log(chalk.gray(' Para configurar: nex config reset\n'))
164
+ }
165
+ })
152
166
  .catch(() => {
153
- // Silently fail in CI
167
+ // Silently fail in non-interactive mode
154
168
  })
155
169
  }