nex-app 0.2.0 → 0.2.2
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/generator/cursor-integration.js +54 -6
- package/package.json +1 -1
- package/server/routes.js +9 -2
|
@@ -71,7 +71,56 @@ export async function integrateCursor(projectPath, agents) {
|
|
|
71
71
|
const cursorRulesDir = path.join(projectPath, '.cursor', 'rules', 'nex')
|
|
72
72
|
await fs.ensureDir(cursorRulesDir)
|
|
73
73
|
|
|
74
|
-
// 3. Criar
|
|
74
|
+
// 3. Criar arquivos .mdc para cada agente (NOVO!)
|
|
75
|
+
const agentPromises = agents.map(async (agentId) => {
|
|
76
|
+
// Tentar encontrar o agente no registry
|
|
77
|
+
const registryPath = path.join(projectPath, 'registry', 'bmad', agentId, 'README.md')
|
|
78
|
+
|
|
79
|
+
let agentContent = `---
|
|
80
|
+
description: NEX Agent - ${agentId}
|
|
81
|
+
globs:
|
|
82
|
+
alwaysApply: false
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
# ${agentId.toUpperCase()} Agent
|
|
86
|
+
|
|
87
|
+
Expert agent from NEX Framework.
|
|
88
|
+
|
|
89
|
+
## How to Use
|
|
90
|
+
|
|
91
|
+
Reference this agent using: \`@nex/${agentId}\`
|
|
92
|
+
|
|
93
|
+
## Installation
|
|
94
|
+
|
|
95
|
+
This agent was installed via: \`npx nex-app\`
|
|
96
|
+
`
|
|
97
|
+
|
|
98
|
+
// Se encontrar README no registry, usar ele
|
|
99
|
+
if (await fs.pathExists(registryPath)) {
|
|
100
|
+
const readme = await fs.readFile(registryPath, 'utf8')
|
|
101
|
+
agentContent = `---
|
|
102
|
+
description: ${agentId} - NEX Agent
|
|
103
|
+
globs:
|
|
104
|
+
alwaysApply: false
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
${readme}`
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Criar diretório para o agente (assumindo categoria 'bmad' para agora)
|
|
111
|
+
const agentDir = path.join(cursorRulesDir, 'bmad', 'agents')
|
|
112
|
+
await fs.ensureDir(agentDir)
|
|
113
|
+
|
|
114
|
+
// Criar arquivo .mdc do agente
|
|
115
|
+
const agentPath = path.join(agentDir, `${agentId}.mdc`)
|
|
116
|
+
await fs.writeFile(agentPath, agentContent, 'utf8')
|
|
117
|
+
|
|
118
|
+
console.log(` ✅ Criado: .cursor/rules/nex/bmad/agents/${agentId}.mdc`)
|
|
119
|
+
})
|
|
120
|
+
|
|
121
|
+
await Promise.all(agentPromises)
|
|
122
|
+
|
|
123
|
+
// 4. Criar index.mdc (similar ao BMAD index.mdc)
|
|
75
124
|
const indexContent = `---
|
|
76
125
|
description: NEX Framework - Master Index
|
|
77
126
|
globs:
|
|
@@ -90,13 +139,13 @@ NEX rules have been installed to: \`.cursor/rules/nex/\`
|
|
|
90
139
|
|
|
91
140
|
## How to Use
|
|
92
141
|
|
|
93
|
-
- Reference specific agents: @nex/
|
|
142
|
+
- Reference specific agents: @nex/bmad/agents/{agent-name}
|
|
94
143
|
- Reference this index: @nex/index
|
|
95
144
|
|
|
96
145
|
## Installed Agents
|
|
97
146
|
|
|
98
147
|
${agents.length > 0
|
|
99
|
-
? agents.map(agentId => `- @nex/${agentId} - ${agentId}`).join('\n')
|
|
148
|
+
? agents.map(agentId => `- @nex/bmad/agents/${agentId} - ${agentId}`).join('\n')
|
|
100
149
|
: 'No agents installed yet. Use: nex agent install <agent-id>'
|
|
101
150
|
}
|
|
102
151
|
|
|
@@ -124,11 +173,10 @@ specific agent expertise.
|
|
|
124
173
|
'utf8'
|
|
125
174
|
)
|
|
126
175
|
|
|
127
|
-
console.log('🔗 Integração com Cursor configurada
|
|
176
|
+
console.log('🔗 Integração com Cursor configurada')
|
|
128
177
|
console.log(` Config: nex/core/config.yaml`)
|
|
129
178
|
console.log(` Rules: .cursor/rules/nex/index.mdc`)
|
|
130
|
-
console.log(` Agentes
|
|
131
|
-
console.log(' (Para instalar agentes reais, execute: nex agent install <agent-id>)')
|
|
179
|
+
console.log(` Agentes: ${agents.length} agente(s) instalado(s)`)
|
|
132
180
|
}
|
|
133
181
|
|
|
134
182
|
/**
|
package/package.json
CHANGED
package/server/routes.js
CHANGED
|
@@ -47,8 +47,15 @@ router.post('/generate', async (req, res) => {
|
|
|
47
47
|
})
|
|
48
48
|
|
|
49
49
|
// Fechar o servidor após a geração do projeto
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
const server = req.app.get('server')
|
|
51
|
+
if (server) {
|
|
52
|
+
console.log('\n✅ Instalação concluída! Fechando servidor...')
|
|
53
|
+
setTimeout(() => {
|
|
54
|
+
server.close(() => {
|
|
55
|
+
console.log('🔒 Servidor fechado')
|
|
56
|
+
process.exit(0)
|
|
57
|
+
})
|
|
58
|
+
}, 2000) // Fecha após 2 segundos
|
|
52
59
|
}
|
|
53
60
|
|
|
54
61
|
} catch (error) {
|