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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/setup.mjs +19 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orquestra-mcp",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Servidor MCP de Orquestra -- 35 tools para leer y escribir tareas, ideas, changelog, infraestructura y más desde un agente de IA",
5
5
  "type": "module",
6
6
  "bin": {
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) - 1
97
- if (idx < 0 || idx >= projects.length) throw new Error('Selección inválida')
98
- defaultProjectId = projects[idx].id
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 })