orquestra-mcp 1.77.0 → 1.79.0

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/README.md CHANGED
@@ -46,6 +46,16 @@ la suya hasta que reconectas (en Claude Code: `/mcp` → reconectar).
46
46
  versión vieja, `npx clear-npx-cache`. Si registraste el MCP como `orquestra-mcp` sin
47
47
  `@latest`, migra con un comando:
48
48
  `claude mcp remove orquestra && claude mcp add orquestra -e ORQUESTRA_AGENT=claude-code -- npx -y orquestra-mcp@latest`.
49
+ `npx orquestra-mcp@latest setup` también actualiza solo las entradas que ya tenías sin versión
50
+ (`orquestra-mcp` pasa a `orquestra-mcp@latest`) en `~/.claude.json`, Cursor, Gemini CLI y Claude
51
+ Desktop; deja un respaldo `*.orquestra-bak`, no toca tu `env` ni versiones fijadas a propósito, y
52
+ no crea entradas nuevas (para eso usa los comandos de abajo). Codex (`~/.codex/config.toml`) se
53
+ edita a mano.
54
+
55
+ **Limpiar la caché de npx** (si tras publicar una versión nueva sigues viendo la vieja):
56
+ `npx clear-npx-cache`, o a mano `rm -rf ~/.npm/_npx` (macOS/Linux) / borrar
57
+ `%LocalAppData%\npm-cache\_npx` (Windows); luego reinicia la herramienta. Para comparar,
58
+ `npm view orquestra-mcp version` muestra la última publicada.
49
59
  `diagnostico_conexion` (cuando no hay conexión) muestra la versión en uso frente a la
50
60
  última publicada y detecta configs sin `@latest`; con conexión, `get_project_context`
51
61
  trae `orquestraMcpUpdate` si hay versión nueva.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orquestra-mcp",
3
- "version": "1.77.0",
3
+ "version": "1.79.0",
4
4
  "description": "Servidor MCP de Orquestra -- 161 tools para leer y escribir tareas, ideas, changelog, infraestructura, contenido, QA y más desde un agente de IA",
5
5
  "type": "module",
6
6
  "bin": {
@@ -0,0 +1,53 @@
1
+ // ORQ-587: `setup` deja las entradas ya existentes de los clientes MCP con
2
+ // `orquestra-mcp@latest`, para que npx no reuse una copia en caché vieja.
3
+ // Solo EDITA entradas que ya lanzan este paquete sin versión (`orquestra-mcp`):
4
+ // no crea entradas nuevas (el formato depende del cliente; eso lo imprime
5
+ // connectionHelp), no toca env/ORQUESTRA_AGENT ni otras cuentas/servidores, y
6
+ // no pisa versiones fijadas a propósito (`orquestra-mcp@1.2.3`).
7
+ import { existsSync, readFileSync, writeFileSync, renameSync, copyFileSync } from 'fs'
8
+ import { homedir } from 'os'
9
+ import { join } from 'path'
10
+
11
+ const BARE = 'orquestra-mcp'
12
+ const LATEST = 'orquestra-mcp@latest'
13
+
14
+ export function clientConfigFiles(home = homedir()) {
15
+ return [
16
+ join(home, '.claude.json'),
17
+ join(home, '.cursor', 'mcp.json'),
18
+ join(home, '.gemini', 'settings.json'),
19
+ join(home, 'Library', 'Application Support', 'Claude', 'claude_desktop_config.json'),
20
+ ]
21
+ }
22
+
23
+ function fixServers(servers) {
24
+ let n = 0
25
+ if (!servers || typeof servers !== 'object') return n
26
+ for (const entry of Object.values(servers)) {
27
+ if (!entry || !Array.isArray(entry.args)) continue
28
+ const i = entry.args.indexOf(BARE)
29
+ if (i >= 0) { entry.args[i] = LATEST; n++ }
30
+ }
31
+ return n
32
+ }
33
+
34
+ // Devuelve [{ file, changed }] solo de los archivos modificados. Nunca lanza.
35
+ export function migrateClientConfigs({ home = homedir() } = {}) {
36
+ const done = []
37
+ for (const file of clientConfigFiles(home)) {
38
+ try {
39
+ if (!existsSync(file)) continue
40
+ const raw = readFileSync(file, 'utf8')
41
+ const cfg = JSON.parse(raw)
42
+ let changed = fixServers(cfg.mcpServers)
43
+ for (const proj of Object.values(cfg.projects || {})) changed += fixServers(proj?.mcpServers)
44
+ if (!changed) continue
45
+ copyFileSync(file, `${file}.orquestra-bak`)
46
+ const tmp = `${file}.orquestra-tmp`
47
+ writeFileSync(tmp, JSON.stringify(cfg, null, raw.includes('\n "') ? 2 : undefined) + (raw.endsWith('\n') ? '\n' : ''))
48
+ renameSync(tmp, file)
49
+ done.push({ file, changed })
50
+ } catch {}
51
+ }
52
+ return done
53
+ }
@@ -28,3 +28,31 @@ export function summarizeAppStatus(app, status) {
28
28
  if (status.errors) out.errors = status.errors
29
29
  return out
30
30
  }
31
+
32
+ // ORQ-579: POST /v1/design-apps/migrate migra por tandas y responde done:false mientras quede trabajo.
33
+ export const MIGRATE_MAX_CALLS = 10
34
+ const MIGRATE_KEYS = ['nav', 'components', 'drift', 'parity']
35
+ const num = v => (Number.isFinite(v) ? v : 0)
36
+
37
+ // `call()` hace UNA llamada a la API. dryRun:true => una sola; dryRun:false => repite mientras done:false (tope `max`).
38
+ // Devuelve el acumulado { dryRun, appKey, nav, components, drift, parity, calls, done } (+ remaining/warning si no terminó).
39
+ // Si una llamada falla con 5xx, relanza el error con `migrated` (lo acumulado hasta entonces) y `calls`.
40
+ export async function migrateAll(call, { dryRun, max = MIGRATE_MAX_CALLS } = {}) {
41
+ const acc = { dryRun, appKey: undefined, nav: 0, components: 0, drift: 0, parity: 0, calls: 0, done: false }
42
+ let last = null
43
+ while (acc.calls < (dryRun ? 1 : max)) {
44
+ let r
45
+ try { r = await call() } catch (err) { err.migrated = pickCounts(acc); err.calls = acc.calls; throw err }
46
+ acc.calls++
47
+ last = r
48
+ acc.appKey = r?.appKey ?? acc.appKey
49
+ for (const k of MIGRATE_KEYS) acc[k] += num(r?.[k])
50
+ if (r?.done !== false) { acc.done = true; break }
51
+ }
52
+ if (!acc.done) {
53
+ acc.remaining = last?.remaining
54
+ acc.warning = `Quedan documentos por migrar tras ${acc.calls} llamadas: vuelve a ejecutar migrate_design_apps con dryRun:false (es idempotente).`
55
+ } else if (dryRun) acc.remaining = last?.remaining
56
+ return acc
57
+ }
58
+ const pickCounts = acc => Object.fromEntries(MIGRATE_KEYS.map(k => [k, acc[k]]))
package/src/server.mjs CHANGED
@@ -14,7 +14,7 @@ import { parseSource, previewSkill, installSkill } from './skillInstall.mjs'
14
14
  import { normalizeStatuses, findClosePath } from './closePath.mjs'
15
15
  import { TOOL_GUIDES, GUIDE_TOPICS } from './toolGuides.mjs'
16
16
  import { runCheck, runMark } from './designSync.mjs'
17
- import { APP_SLUG_RE, APP_DESC, APP_TOKEN_DESC, takeQuery, arrayOf, summarizeAppStatus } from './designApps.mjs'
17
+ import { APP_SLUG_RE, APP_DESC, APP_TOKEN_DESC, takeQuery, arrayOf, summarizeAppStatus, migrateAll } from './designApps.mjs'
18
18
  import { getDesignFlow, computeDesignStatus, DESIGN_PLATFORM_ARGS, DESIGN_PLATFORMS } from './designFlow.mjs'
19
19
 
20
20
  // Versión leída de package.json (3 sep 2026) -- antes estaba hardcodeada
@@ -3373,7 +3373,7 @@ export function createServer() {
3373
3373
  server.registerTool(
3374
3374
  'migrate_design_apps',
3375
3375
  {
3376
- description: 'Asigna a UNA app todo lo de Diseño que aún no tiene app (nav, componentes, deriva, paridad). Cambia datos existentes: con dryRun:true (default) solo informa qué movería.',
3376
+ description: 'Asigna a UNA app todo lo de Diseño que aún no tiene app (nav, componentes, deriva, paridad). Cambia datos existentes: con dryRun:true (default) solo informa qué movería (una llamada). Con dryRun:false repite por tandas hasta done:true (máx. 10 llamadas) y devuelve el acumulado.',
3377
3377
  inputSchema: {
3378
3378
  projectId: z.string().optional().describe(PROJECT_ID_DESC),
3379
3379
  appKey: APP_STR.describe('Key de la app destino (list_design_apps)'),
@@ -3382,8 +3382,15 @@ export function createServer() {
3382
3382
  },
3383
3383
  async ({ projectId, appKey, dryRun }) => {
3384
3384
  try {
3385
- return textResult(await apiPost(config, '/v1/design-apps/migrate', { projectId: resolveProjectId(projectId), appKey, dryRun: dryRun ?? true }))
3385
+ const pid = resolveProjectId(projectId)
3386
+ const dry = dryRun ?? true
3387
+ return textResult(await migrateAll(() => apiPost(config, '/v1/design-apps/migrate', { projectId: pid, appKey, dryRun: dry }), { dryRun: dry }))
3386
3388
  } catch (err) {
3389
+ if (err instanceof ApiError && err.status >= 500 && err.migrated) {
3390
+ const m = err.migrated
3391
+ const total = m.nav + m.components + m.drift + m.parity
3392
+ return errorResult(new ApiError(err.status, `${err.message} | Migrado antes del fallo (${err.calls} llamadas completas): nav ${m.nav}, componentes ${m.components}, deriva ${m.drift}, paridad ${m.parity} (${total} docs). Repite la tool: es idempotente.`))
3393
+ }
3387
3394
  return errorResult(err)
3388
3395
  }
3389
3396
  }
package/src/setup.mjs CHANGED
@@ -5,6 +5,7 @@ import { createInterface } from 'readline'
5
5
  import { homedir } from 'os'
6
6
  import { resolve } from 'path'
7
7
  import { findLegacyNpxConfigs, MIGRATE_COMMAND } from './updateCheck.mjs'
8
+ import { migrateClientConfigs } from './clientConfig.mjs'
8
9
  import { upsertProjectMapping, replaceAgentToken, connectedAgents, readOrCreateMachine, agentKey, CONFIG_PATH } from './configFile.mjs'
9
10
 
10
11
  const DEFAULT_API_BASE = 'https://api.orquestra.me'
@@ -202,6 +203,10 @@ export async function runSetup({ agent: presetAgent } = {}) {
202
203
  if (others.length) console.log(`También actualicé el token de ${agentLabel} en: ${others.join(', ')}.`)
203
204
  console.log('\nSiguiente paso -- conéctalo a tu herramienta (si ya estaba conectada, solo reconecta el MCP):\n')
204
205
  console.log(connectionHelp(agent, agentLabel))
206
+ // ORQ-587: las entradas existentes sin versión pasan a @latest (con respaldo .orquestra-bak).
207
+ for (const m of migrateClientConfigs()) {
208
+ console.log(`\nActualicé ${m.changed} entrada(s) de Orquestra a orquestra-mcp@latest en ${m.file} (respaldo: ${m.file}.orquestra-bak). Reinicia o reconecta la herramienta.`)
209
+ }
205
210
  if (findLegacyNpxConfigs().length) {
206
211
  console.log('\nOjo: tu Claude Code tiene Orquestra registrado como "orquestra-mcp" sin @latest (npx se queda con una versión vieja). Migra con:')
207
212
  console.log(` ${MIGRATE_COMMAND}`)