nex-framework-cli 1.0.21 → 1.0.23

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,10 +28,10 @@ program.configureHelp({
28
28
  program
29
29
  .name('nex')
30
30
  .description('NEX Framework - Framework completo de agentes AI')
31
- .version('1.0.20', '-v, --version', 'Mostra a versão')
31
+ .version('1.0.23', '-v, --version', 'Mostra a versão')
32
32
  .addHelpText('before', chalk.bold.cyan(`
33
33
  ╔════════════════════════════════════════════════════════════════╗
34
- ║ NEX Framework - CLI v1.0.9
34
+ ║ NEX Framework - CLI v1.0.23
35
35
  ║ Framework completo de agentes AI ║
36
36
  ╚════════════════════════════════════════════════════════════════╝
37
37
  `))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nex-framework-cli",
3
- "version": "1.0.21",
3
+ "version": "1.0.23",
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",
@@ -2,13 +2,14 @@
2
2
  /**
3
3
  * NEX CLI Post-Install Script
4
4
  * Runs after npm install to configure the CLI
5
+ *
6
+ * IMPORTANT: This script must be FAST and NON-BLOCKING
7
+ * Interactive setup is done via: nex config reset
5
8
  */
6
9
 
7
- import inquirer from 'inquirer'
8
10
  import fs from 'fs-extra'
9
11
  import path from 'path'
10
12
  import os from 'os'
11
- import chalk from 'chalk'
12
13
  import { fileURLToPath } from 'url'
13
14
 
14
15
  const __filename = fileURLToPath(import.meta.url)
@@ -27,7 +28,12 @@ export function getGlobalConfigPath() {
27
28
  }
28
29
  }
29
30
 
31
+ // Interactive setup (only called by nex config reset)
30
32
  export async function runSetup(force = false) {
33
+ // Dynamic import to avoid loading inquirer during postinstall
34
+ const inquirer = (await import('inquirer')).default
35
+ const chalk = (await import('chalk')).default
36
+
31
37
  // Check if config already exists
32
38
  const configPath = getGlobalConfigPath()
33
39
  const configDir = path.dirname(configPath)
@@ -116,7 +122,7 @@ export async function runSetup(force = false) {
116
122
  enabled: answers.cursorIntegration
117
123
  },
118
124
  installedAt: new Date().toISOString(),
119
- version: '1.0.20'
125
+ version: '1.0.23'
120
126
  }
121
127
 
122
128
  // Save config
@@ -132,24 +138,9 @@ export async function runSetup(force = false) {
132
138
  console.log(chalk.cyan('\n💡 Dica: Para reconfigurar, execute: nex config reset\n'))
133
139
  }
134
140
 
135
- // Check if running in interactive mode (TTY available)
136
- const isInteractive = process.stdin.isTTY && process.stdout.isTTY && process.stderr.isTTY
137
- const isCI = process.env.CI === 'true'
138
- const skipSetup = process.env.NEX_SKIP_SETUP === 'true'
139
-
140
- // Only run interactive setup if:
141
- // 1. Not in CI
142
- // 2. Not explicitly skipped
143
- // 3. Running in interactive mode (TTY)
144
- if (!isCI && !skipSetup && isInteractive) {
145
- runSetup().catch((error) => {
146
- console.error(chalk.red('\n❌ Erro ao configurar NEX CLI:'))
147
- console.error(chalk.red(error.message))
148
- console.log(chalk.yellow('\n💡 Você pode configurar manualmente depois executando: nex config reset\n'))
149
- process.exit(0) // Don't fail the install
150
- })
151
- } else {
152
- // Non-interactive mode: create default config silently
141
+ // Post-install: Create default config SYNCHRONOUSLY and EXIT IMMEDIATELY
142
+ // This must be FAST - no async operations, no prompts, no delays
143
+ try {
153
144
  const configPath = getGlobalConfigPath()
154
145
  const configDir = path.dirname(configPath)
155
146
  const defaultConfig = {
@@ -162,18 +153,21 @@ if (!isCI && !skipSetup && isInteractive) {
162
153
  enabled: false
163
154
  },
164
155
  installedAt: new Date().toISOString(),
165
- version: '1.0.20'
156
+ version: '1.0.23'
157
+ }
158
+
159
+ // Create directory and file synchronously (fast)
160
+ if (!fs.existsSync(configDir)) {
161
+ fs.mkdirSync(configDir, { recursive: true })
166
162
  }
167
163
 
168
- fs.ensureDir(configDir)
169
- .then(() => fs.writeJSON(configPath, defaultConfig, { spaces: 2 }))
170
- .then(() => {
171
- if (!isCI && isInteractive) {
172
- console.log(chalk.green('\n✅ NEX CLI instalado com configuração padrão'))
173
- console.log(chalk.gray(' Para configurar: nex config reset\n'))
174
- }
175
- })
176
- .catch(() => {
177
- // Silently fail in non-interactive mode
178
- })
164
+ // Only create if doesn't exist (don't overwrite existing config)
165
+ if (!fs.existsSync(configPath)) {
166
+ fs.writeFileSync(configPath, JSON.stringify(defaultConfig, null, 2), 'utf8')
167
+ }
168
+ } catch (error) {
169
+ // Silently fail - don't block installation
179
170
  }
171
+
172
+ // Exit immediately - don't wait for anything
173
+ process.exit(0)