nex-framework-cli 1.0.19 → 1.0.20
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.19', '-v, --version', 'Mostra a versão')
|
|
32
32
|
.addHelpText('before', chalk.bold.cyan(`
|
|
33
33
|
╔════════════════════════════════════════════════════════════════╗
|
|
34
34
|
║ NEX Framework - CLI v1.0.9 ║
|
|
@@ -64,12 +64,26 @@ Exemplos:
|
|
|
64
64
|
console.log(chalk.blue('🚀 Inicializando projeto NEX...'))
|
|
65
65
|
console.log()
|
|
66
66
|
|
|
67
|
+
// Detectar nome do projeto atual (da pasta ou package.json)
|
|
68
|
+
let currentProjectName = path.basename(process.cwd())
|
|
69
|
+
try {
|
|
70
|
+
const packageJsonPath = path.join(process.cwd(), 'package.json')
|
|
71
|
+
if (await fs.pathExists(packageJsonPath)) {
|
|
72
|
+
const packageJson = await fs.readJSON(packageJsonPath)
|
|
73
|
+
if (packageJson.name) {
|
|
74
|
+
currentProjectName = packageJson.name
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
} catch (error) {
|
|
78
|
+
// Ignore errors
|
|
79
|
+
}
|
|
80
|
+
|
|
67
81
|
const answers = await inquirer.prompt([
|
|
68
82
|
{
|
|
69
83
|
type: 'input',
|
|
70
84
|
name: 'projectName',
|
|
71
85
|
message: 'Nome do projeto:',
|
|
72
|
-
default: options.name ||
|
|
86
|
+
default: options.name || currentProjectName,
|
|
73
87
|
when: !options.name
|
|
74
88
|
},
|
|
75
89
|
{
|
|
@@ -85,10 +99,10 @@ Exemplos:
|
|
|
85
99
|
const projectName = options.name || answers.projectName
|
|
86
100
|
const template = options.template || answers.template
|
|
87
101
|
|
|
88
|
-
// Criar estrutura do projeto (
|
|
89
|
-
await createProjectStructure(projectName, template)
|
|
102
|
+
// Criar estrutura do projeto no diretório atual (não criar nova pasta)
|
|
103
|
+
await createProjectStructure(projectName, template, true)
|
|
90
104
|
|
|
91
|
-
console.log(chalk.green(`\n✅ Projeto ${projectName}
|
|
105
|
+
console.log(chalk.green(`\n✅ Projeto ${projectName} inicializado com sucesso!`))
|
|
92
106
|
console.log()
|
|
93
107
|
})
|
|
94
108
|
|
|
@@ -351,7 +365,7 @@ configCmd
|
|
|
351
365
|
.description('Reconfigura o NEX CLI (nome, idiomas, integração Cursor)')
|
|
352
366
|
.action(async () => {
|
|
353
367
|
const { runSetup } = await import('../scripts/postinstall.js')
|
|
354
|
-
await runSetup()
|
|
368
|
+
await runSetup(true) // Force reconfiguration
|
|
355
369
|
})
|
|
356
370
|
|
|
357
371
|
configCmd
|
|
@@ -376,8 +390,8 @@ configCmd
|
|
|
376
390
|
})
|
|
377
391
|
|
|
378
392
|
// Funções auxiliares
|
|
379
|
-
async function createProjectStructure(projectName, template) {
|
|
380
|
-
const projectDir = path.join(process.cwd(), projectName)
|
|
393
|
+
async function createProjectStructure(projectName, template, useCurrentDir = false) {
|
|
394
|
+
const projectDir = useCurrentDir ? process.cwd() : path.join(process.cwd(), projectName)
|
|
381
395
|
await fs.ensureDir(projectDir)
|
|
382
396
|
|
|
383
397
|
// Criar estrutura básica
|
package/package.json
CHANGED
package/scripts/postinstall.js
CHANGED
|
@@ -27,20 +27,30 @@ export function getGlobalConfigPath() {
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
export async function runSetup() {
|
|
30
|
+
export async function runSetup(force = false) {
|
|
31
31
|
// Check if config already exists
|
|
32
32
|
const configPath = getGlobalConfigPath()
|
|
33
33
|
const configDir = path.dirname(configPath)
|
|
34
34
|
|
|
35
|
-
if (await fs.pathExists(configPath)) {
|
|
35
|
+
if (!force && await fs.pathExists(configPath)) {
|
|
36
36
|
try {
|
|
37
37
|
const existingConfig = await fs.readJSON(configPath)
|
|
38
|
-
// If config exists and is valid,
|
|
38
|
+
// If config exists and is valid, ask if user wants to reconfigure
|
|
39
39
|
if (existingConfig.user && existingConfig.user.name) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
const { overwrite } = await inquirer.prompt([
|
|
41
|
+
{
|
|
42
|
+
type: 'confirm',
|
|
43
|
+
name: 'overwrite',
|
|
44
|
+
message: 'NEX CLI já está configurado. Deseja reconfigurar?',
|
|
45
|
+
default: false
|
|
46
|
+
}
|
|
47
|
+
])
|
|
48
|
+
|
|
49
|
+
if (!overwrite) {
|
|
50
|
+
console.log(chalk.green('\n✅ Configuração mantida.'))
|
|
51
|
+
console.log(chalk.gray(` Config: ${configPath}\n`))
|
|
52
|
+
return
|
|
53
|
+
}
|
|
44
54
|
}
|
|
45
55
|
} catch (error) {
|
|
46
56
|
// Config file exists but is invalid, continue with setup
|
|
@@ -106,7 +116,7 @@ export async function runSetup() {
|
|
|
106
116
|
enabled: answers.cursorIntegration
|
|
107
117
|
},
|
|
108
118
|
installedAt: new Date().toISOString(),
|
|
109
|
-
version: '1.0.
|
|
119
|
+
version: '1.0.19'
|
|
110
120
|
}
|
|
111
121
|
|
|
112
122
|
// Save config
|
|
@@ -152,7 +162,7 @@ if (!isCI && !skipSetup && isInteractive) {
|
|
|
152
162
|
enabled: false
|
|
153
163
|
},
|
|
154
164
|
installedAt: new Date().toISOString(),
|
|
155
|
-
version: '1.0.
|
|
165
|
+
version: '1.0.19'
|
|
156
166
|
}
|
|
157
167
|
|
|
158
168
|
fs.ensureDir(configDir)
|
|
@@ -1087,8 +1087,8 @@ export default class NEXMarketplace {
|
|
|
1087
1087
|
const mainCursorRulesPath = path.join(this.projectRoot, '.cursorrules')
|
|
1088
1088
|
const importLine = `import .cursorrules/${rulesFile}`
|
|
1089
1089
|
const commentLine = `# ${manifest.name} - ${manifest.tagline || manifest.description?.substring(0, 50)}`
|
|
1090
|
-
const
|
|
1091
|
-
const agentComment = `# Use: ${
|
|
1090
|
+
const agentTrigger = manifest.bmad?.activation_trigger || `@${agentId}`
|
|
1091
|
+
const agentComment = `# Use: ${agentTrigger} <command>`
|
|
1092
1092
|
|
|
1093
1093
|
let cursorRulesContent = ''
|
|
1094
1094
|
if (await fs.pathExists(mainCursorRulesPath)) {
|
|
@@ -1112,8 +1112,7 @@ export default class NEXMarketplace {
|
|
|
1112
1112
|
|
|
1113
1113
|
console.log(chalk.green(`\n✅ Cursor integration complete!`))
|
|
1114
1114
|
console.log(chalk.gray(` Added ${rulesFile} to .cursorrules`))
|
|
1115
|
-
|
|
1116
|
-
console.log(chalk.gray(` Use: ${trigger} <command> in Cursor\n`))
|
|
1115
|
+
console.log(chalk.gray(` Use: ${agentTrigger} <command> in Cursor\n`))
|
|
1117
1116
|
|
|
1118
1117
|
} catch (error) {
|
|
1119
1118
|
console.log(chalk.yellow(`\n⚠️ Cursor integration failed: ${error.message}`))
|