orquestra-mcp 1.77.0 → 1.78.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orquestra-mcp",
3
- "version": "1.77.0",
3
+ "version": "1.78.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": {
@@ -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
  }