orquestra-mcp 1.0.2 → 1.0.3
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/package.json +1 -1
- package/src/setup.mjs +19 -3
package/package.json
CHANGED
package/src/setup.mjs
CHANGED
|
@@ -91,11 +91,27 @@ export async function runSetup() {
|
|
|
91
91
|
console.log(`Usando tu proyecto "${projects[0].name}" como default.`)
|
|
92
92
|
} else {
|
|
93
93
|
console.log('\nElige el proyecto que este MCP va a usar por default:')
|
|
94
|
+
console.log(' 0. (crear un proyecto nuevo)')
|
|
94
95
|
projects.forEach((p, i) => console.log(` ${i + 1}. ${p.name}`))
|
|
95
96
|
const answer = await prompt('Número: ')
|
|
96
|
-
const idx = parseInt(answer, 10)
|
|
97
|
-
if (idx < 0 || idx
|
|
98
|
-
|
|
97
|
+
const idx = parseInt(answer, 10)
|
|
98
|
+
if (Number.isNaN(idx) || idx < 0 || idx > projects.length) throw new Error('Selección inválida')
|
|
99
|
+
|
|
100
|
+
if (idx === 0) {
|
|
101
|
+
const name = await prompt('Nombre del proyecto nuevo: ')
|
|
102
|
+
if (!name.trim()) throw new Error('El nombre no puede estar vacío')
|
|
103
|
+
const res2 = await fetch(`${apiBase}/v1/projects?workspaceId=${workspaceId}`, {
|
|
104
|
+
method: 'POST',
|
|
105
|
+
headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' },
|
|
106
|
+
body: JSON.stringify({ name: name.trim() }),
|
|
107
|
+
})
|
|
108
|
+
const newProject = await res2.json()
|
|
109
|
+
if (!res2.ok) throw new Error(newProject?.error || `HTTP ${res2.status}`)
|
|
110
|
+
defaultProjectId = newProject.id
|
|
111
|
+
console.log(`Proyecto "${newProject.name}" creado y configurado como default.`)
|
|
112
|
+
} else {
|
|
113
|
+
defaultProjectId = projects[idx - 1].id
|
|
114
|
+
}
|
|
99
115
|
}
|
|
100
116
|
|
|
101
117
|
writeConfigFile({ apiBase, apiToken: token, workspaceId, defaultProjectId })
|