editorbrain 0.45.0 → 0.45.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/README.md CHANGED
@@ -5,13 +5,13 @@ Editorial references, brand context and portable video projects for Claude Code
5
5
  Inspect the CLI without configuring your agent:
6
6
 
7
7
  ```sh
8
- npx editorbrain@0.45.0 help
8
+ npx editorbrain@0.45.2 help
9
9
  ```
10
10
 
11
11
  For a persistent installation:
12
12
 
13
13
  ```sh
14
- npm install -g editorbrain@0.45.0
14
+ npm install -g editorbrain@0.45.2
15
15
  editorbrain login --url https://api.editorbrain.com
16
16
  editorbrain status --url https://api.editorbrain.com
17
17
  editorbrain projects list
@@ -2107,6 +2107,9 @@ function mergeProfile(base, patch) {
2107
2107
  const issues = creativePreferencesReviewedIssues(value);
2108
2108
  if (issues.length) throw new Error(issues.join("\n"));
2109
2109
  result2[key] = [.../* @__PURE__ */ new Set([...base.creativePreferencesReviewed ?? [], ...value])];
2110
+ } else if (key === "creatorContext") {
2111
+ const fields2 = record5(value, key, Object.keys(creatorContextOptions));
2112
+ result2[key] = { ...object5(result2[key]) ? result2[key] : {}, ...fields2 };
2110
2113
  } else if (key === "editorialDelivery" || key === "visualTaste") {
2111
2114
  const fields2 = record5(value, key, key === "editorialDelivery" ? Object.keys(editorialDeliveryOptions) : ["density", "energy", "contrast"]);
2112
2115
  const previous = object5(result2[key]) ? result2[key] : {};
@@ -202828,6 +202831,32 @@ var ApiError = class extends CliError {
202828
202831
  status;
202829
202832
  body;
202830
202833
  };
202834
+ function documentDiagnostic(body, endpoint2, status) {
202835
+ const error62 = body?.error;
202836
+ if (!error62 || typeof error62.code !== "string") return void 0;
202837
+ if ([400, 422].includes(status) && ["document_type_unsupported", "document_schema_unsupported"].includes(error62.code)) return { error: { code: error62.code } };
202838
+ if (!(status === 400 && error62.code === "invalid_path" || status === 422 && error62.code === "invalid_document")) return void 0;
202839
+ let legacyCheckpoint = false;
202840
+ if (status === 422 && typeof error62.message === "string" && error62.message.length <= 8192) {
202841
+ try {
202842
+ const path = endpoint2.slice("/v1/documents/".length).split("/").map(decodeURIComponent).join("/");
202843
+ const issues = JSON.parse(error62.message);
202844
+ legacyCheckpoint = /^videos\/[a-z0-9][a-z0-9_-]{0,79}\/checkpoint\.json$/.test(path) && Array.isArray(issues) && issues.length >= 1 && issues.length <= 2 && issues.every((issue3) => issue3 && issue3.path === path && ["schemaVersion must be 1", "Checkpoint has missing or unsupported fields."].includes(issue3.message)) && issues.some((issue3) => issue3.message === "schemaVersion must be 1");
202845
+ } catch {
202846
+ }
202847
+ }
202848
+ return { error: { code: error62.code, ...legacyCheckpoint ? { legacyCheckpoint: true } : {} } };
202849
+ }
202850
+ var UnsupportedDocumentError = class extends ApiError {
202851
+ constructor(status, path) {
202852
+ super(status, void 0);
202853
+ const checkpoint = /^videos\/[^/]+\/checkpoint\.json$/.test(path);
202854
+ this.code = checkpoint ? "CHECKPOINT_UNSUPPORTED" : "DOCUMENT_UNSUPPORTED";
202855
+ this.message = checkpoint ? "El servidor no soporta esta versi\xF3n de checkpoints todav\xEDa." : "El servidor no soporta este tipo o versi\xF3n de documento todav\xEDa.";
202856
+ this.hint = "Actualiza la API de EditorBrain y vuelve a ejecutar push. Conserva el documento local; no elimines campos ni reduzcas su versi\xF3n para forzar la sincronizaci\xF3n.";
202857
+ this.details = { status, documentPath: path };
202858
+ }
202859
+ };
202831
202860
  function retryDelay(value, now) {
202832
202861
  if (!value) return void 0;
202833
202862
  const parsed = /^\d+$/.test(value) ? Number(value) * 1e3 : Date.parse(value) - now;
@@ -202983,12 +203012,12 @@ var Client = class {
202983
203012
  const retryAfterMs = retryDelay(response.headers.get("Retry-After"), this.runtime.now());
202984
203013
  if (!response.ok) {
202985
203014
  let errorBody;
202986
- if ((/^\/v1\/(?:authored-motion|style-sources|sfx|team|studio|batches|render-cloud|resources)(?:\/|\?|$)/.test(path) || path === "/v1/search/brief" || path === "/v1/projects" || /^\/v1\/projects\/[^/]+\/(?:progress|intake|resolve|export)$/.test(path) || /^\/v1\/documents\/videos\/[^/]+\/project\.json$/.test(path)) && [400, 402, 403, 404, 409, 422, 429, 503].includes(response.status)) {
203015
+ if ((/^\/v1\/(?:authored-motion|style-sources|sfx|team|studio|batches|render-cloud|resources)(?:\/|\?|$)/.test(path) || path.startsWith("/v1/documents/") || path === "/v1/search/brief" || path === "/v1/projects" || /^\/v1\/projects\/[^/]+\/(?:progress|intake|resolve|export)$/.test(path)) && [400, 402, 403, 404, 409, 422, 429, 503].includes(response.status)) {
202987
203016
  try {
202988
203017
  const parsed = await boundedJson(response, 16 * 1024);
202989
- const diagnostic = searchDiagnostic(response.status, parsed);
203018
+ const diagnostic = path.startsWith("/v1/documents/") && !/^\/v1\/documents\/videos\/[^/]+\/project\.json$/.test(path) ? void 0 : searchDiagnostic(response.status, parsed);
202990
203019
  const voiceRevisionConflict = /^\/v1\/studio\/voice-selection(?:\?|$)/.test(path) && response.status === 409 && parsed?.error?.code === "revision_conflict";
202991
- errorBody = diagnostic ? { error: { code: diagnostic.serviceCode, ...safeDiagnosticDetails(parsed) } } : voiceRevisionConflict ? { error: { code: "revision_conflict" } } : void 0;
203020
+ errorBody = diagnostic ? { error: { code: diagnostic.serviceCode, ...safeDiagnosticDetails(parsed) } } : voiceRevisionConflict ? { error: { code: "revision_conflict" } } : path.startsWith("/v1/documents/") ? documentDiagnostic(parsed, path, response.status) : void 0;
202992
203021
  } catch {
202993
203022
  }
202994
203023
  } else await response.body?.cancel();
@@ -203018,7 +203047,21 @@ var Client = class {
203018
203047
  return this.request(`/v1/documents/${safeDocumentPath(path).split("/").map(encodeURIComponent).join("/")}`);
203019
203048
  }
203020
203049
  async put(path, content, expectedRevision) {
203021
- return this.request(`/v1/documents/${safeDocumentPath(path).split("/").map(encodeURIComponent).join("/")}`, { method: "PUT", body: { content, expectedRevision } });
203050
+ const endpoint2 = `/v1/documents/${safeDocumentPath(path).split("/").map(encodeURIComponent).join("/")}`;
203051
+ try {
203052
+ return await this.request(endpoint2, { method: "PUT", body: { content, expectedRevision } });
203053
+ } catch (error62) {
203054
+ if (error62 instanceof ApiError && [400, 422].includes(error62.status)) {
203055
+ const diagnostic = error62.body?.error;
203056
+ const valid = validateDocument(path, content).valid;
203057
+ const legacy = valid && diagnostic?.legacyCheckpoint === true && JSON.parse(content).schemaVersion === 2;
203058
+ if (valid && (legacy || ["document_type_unsupported", "document_schema_unsupported"].includes(diagnostic?.code ?? ""))) throw new UnsupportedDocumentError(error62.status, path);
203059
+ error62.details = { ...error62.details, documentPath: path };
203060
+ error62.message = `El servidor rechaz\xF3 el documento ${path} (HTTP ${error62.status}).`;
203061
+ error62.hint = "Ejecuta editorbrain validate --dir WORKSPACE y revisa este documento y la versi\xF3n de la API. El rechazo no confirma falta de compatibilidad; conserva los campos y no fuerces la sincronizaci\xF3n.";
203062
+ }
203063
+ throw error62;
203064
+ }
203022
203065
  }
203023
203066
  async uploadPreview(path, content, mimeType) {
203024
203067
  const hash11 = path.match(/^\/v1\/assets\/([a-f0-9]{64})(?:\?|$)/)?.[1];
@@ -203139,21 +203182,62 @@ async function pushWorkspace(client, root, files, options = {}) {
203139
203182
  }
203140
203183
  pending.push({ path, content, expectedRevision: base?.revision ?? 0 });
203141
203184
  }
203185
+ const finalPaths = new Set(options.finalizePaths ?? []);
203186
+ pending.sort((a, b) => Number(finalPaths.has(a.path)) - Number(finalPaths.has(b.path)));
203142
203187
  if (options.dryRun) return { dryRun: true, uploaded: [], unchanged: unchanged2, wouldUpload: pending.map((item) => item.path), conflicts };
203143
203188
  if (conflicts.length) throw new CliError("SYNC_CONFLICT", `Remote documents changed. Pull into a separate folder or reconcile changes before pushing:
203144
203189
  ${conflicts.join("\n")}`, "Run push --dry-run and reconcile the reported paths.", false, { conflicts });
203145
203190
  const uploaded = [];
203191
+ const skipped = [];
203192
+ const deferred = [];
203193
+ let finalChecked = false;
203146
203194
  for (const item of pending) {
203147
- const result2 = await client.put(item.path, item.content, item.expectedRevision);
203195
+ let result2;
203196
+ try {
203197
+ if (finalPaths.has(item.path)) {
203198
+ if (skipped.length) {
203199
+ deferred.push(item.path);
203200
+ continue;
203201
+ }
203202
+ if (!finalChecked) {
203203
+ if ((await client.me()).workspaceId !== me.workspaceId) throw new CliError("WORKSPACE_MISMATCH", "The connected workspace changed during sync.", "Retry against the intended account.");
203204
+ const latest = new Map((await client.list()).map((summary2) => {
203205
+ checkRemote(summary2);
203206
+ return [summary2.path, summary2];
203207
+ }));
203208
+ const changed2 = Object.keys(files).filter((path) => latest.get(path)?.revision !== remote.get(path)?.revision || latest.get(path)?.sha256 !== remote.get(path)?.sha256);
203209
+ if (changed2.length) throw new CliError("SYNC_CONFLICT", `Remote documents changed before confirmations were saved:
203210
+ ${changed2.join("\n")}`, "Reconcile the changed documents before retrying.", false, { conflicts: changed2 });
203211
+ await options.beforeFinalize?.();
203212
+ finalChecked = true;
203213
+ }
203214
+ }
203215
+ result2 = await client.put(item.path, item.content, item.expectedRevision);
203216
+ } catch (error62) {
203217
+ if (!(error62 instanceof UnsupportedDocumentError)) {
203218
+ if (error62 instanceof CliError) error62.details = { ...error62.details, sync: { uploaded: [...uploaded], skipped: [...skipped], failedPath: item.path } };
203219
+ throw error62;
203220
+ }
203221
+ skipped.push({ path: item.path, code: error62.code, status: error62.status, hint: error62.hint });
203222
+ continue;
203223
+ }
203148
203224
  checkRemote(result2);
203149
203225
  const digest5 = await sha256(item.content);
203150
203226
  if (result2.path !== item.path || result2.sha256 !== digest5) throw new Error("Server returned inconsistent write metadata");
203151
203227
  state.documents[item.path] = { revision: result2.revision, sha256: result2.sha256 };
203228
+ remote.set(item.path, result2);
203152
203229
  uploaded.push(item.path);
203153
203230
  await saveSyncState(root, state);
203154
203231
  }
203155
203232
  await saveSyncState(root, state);
203156
- return { uploaded, unchanged: unchanged2 };
203233
+ return { uploaded, unchanged: unchanged2, ...skipped.length ? {
203234
+ status: "partial",
203235
+ synced: false,
203236
+ skipped,
203237
+ ...deferred.length ? { deferred } : {},
203238
+ warnings: skipped.map((item) => `${item.path}: el servidor no soporta este documento; sigue pendiente y conservado localmente.`),
203239
+ next: "Actualiza la API y repite push para sincronizar los documentos pendientes. Los guardados confirmados no se repiten. El proyecto a\xFAn no est\xE1 sincronizado por completo."
203240
+ } : {} };
203157
203241
  }
203158
203242
  async function pullWorkspace(client, root, local, options = {}) {
203159
203243
  const me = await client.me();
@@ -203438,10 +203522,13 @@ async function listRegisteredProjects(options = {}) {
203438
203522
  if (options.brandId !== void 0) assertIdentifier(options.brandId);
203439
203523
  if (options.binding !== void 0) parseBinding(options.binding);
203440
203524
  if (options.query !== void 0 && (typeof options.query !== "string" || options.query.length > 500)) throw new CliError("INVALID_ARGUMENT", "Local project query must be at most 500 characters.", "Use a project ID or a few words from its topic.");
203441
- const registry2 = await readRegistry(await registryDirectory(false));
203525
+ const root = options.directory === void 0 ? void 0 : await ensureRoot(options.directory);
203526
+ const registry2 = await readRegistry(await registryDirectory(false, root ? [root] : []));
203527
+ if (root !== void 0 && !registry2.projects.some((entry) => entry.root === root)) throw new CliError("PROJECT_LOCATION_NOT_FOUND", "No projects are registered in the selected workspace directory.", "Use projects link --project ID --path DIR --dir WORKSPACE, or omit --dir to search all registered projects.");
203442
203528
  const projects = [];
203443
203529
  const issues = [];
203444
203530
  for (const entry of registry2.projects) {
203531
+ if (root !== void 0 && entry.root !== root) continue;
203445
203532
  if (options.binding !== void 0 && !sameBinding(options.binding, entry.binding) || options.brandId !== void 0 && options.brandId !== entry.brandId) continue;
203446
203533
  try {
203447
203534
  const current2 = await location2(entry.root, entry.projectId, "registry", entry);
@@ -204646,10 +204733,11 @@ async function cleanProject(directory, project, options = {}) {
204646
204733
 
204647
204734
  // packages/cli/src/command-help.ts
204648
204735
  var introductions = {
204736
+ push: "Sincroniza documentos con control de revisi\xF3n. Una incompatibilidad confirmada conserva el documento local y permite guardar los dem\xE1s: status:partial, synced:false, skipped y salida 2. Actualiza la API y repite push; no bajes el esquema ni borres campos. Conflictos, permisos, datos inv\xE1lidos y fallos de red detienen la operaci\xF3n. --dry-run no comprueba compatibilidad de escritura del servidor.",
204649
204737
  where: "Ubica archivos de un proyecto usando el registro privado de esta computadora. No usa red ni sincroniza rutas absolutas. Ante IDs ambiguos selecciona --dir.",
204650
204738
  resume: "Usa projects find para resolver nombre/tema/fecha antes de elegir el ID. --rehash fuerza SHA-256 nuevo; checkpointHash protege el siguiente hito con --expected-checkpoint. Descarga contexto y checkpoint, conserva cambios locales y verifica archivos por SHA-256. Solo lectura remota: no renderiza, sube medios, abre aplicaciones ni gasta.",
204651
- checkpoint: "Usa --expected-checkpoint SHA256|none del \xFAltimo resume para detectar trabajo concurrente. --current-version, --primary-artifact, --dependency y --render-command conservan contexto t\xE9cnico portable; nunca ejecutan. Guarda el hito declarado y hashes en videos/ID/checkpoint.json. Las rutas son relativas a la carpeta registrada por rol o al workspace. Repite --done/--pending/--decision/--artifact; listas suministradas reemplazan las anteriores. Usa push expl\xEDcitamente para sincronizar el texto.",
204652
- projects: "find/list buscan por nombre/tema, --brand, --since y --before (UTC ISO), con paginaci\xF3n y actividad real; find --local consulta el registro privado. link/unlink administran carpetas privadas locales; where ID las consulta y resume ID recupera el hito. create crea un proyecto remoto con tu marca existente; intake devuelve su material y enlace privado de subida. Conserva el mismo ID para retomarlo. No inicia edici\xF3n, render ni gasto; un enlace de subida requiere iniciar sesi\xF3n.",
204739
+ checkpoint: "Usa --expected-checkpoint SHA256|none del \xFAltimo resume para detectar trabajo concurrente. --current-version, --primary-artifact, --dependency y --render-command conservan contexto t\xE9cnico portable; nunca ejecutan. Guarda el hito declarado y hashes en videos/ID/checkpoint.json. Las rutas son relativas a la carpeta registrada por rol o al workspace. Repite --done/--pending/--decision; sus listas reemplazan las anteriores. --primary-artifact y --dependency registran y verifican sus archivos sin repetir --artifact. --artifact reemplaza la lista base y a\xF1ade esas referencias expl\xEDcitas; omitirlo conserva los artefactos previos. Usa push expl\xEDcitamente para sincronizar el texto.",
204740
+ projects: "find/list buscan por nombre/tema, --brand, --since y --before (UTC ISO), con paginaci\xF3n y actividad real; find --local consulta el registro privado; --dir lo limita a un workspace registrado, sin red ni escaneo. link/unlink administran carpetas privadas locales; where ID las consulta y resume ID recupera el hito. create crea un proyecto remoto con tu marca existente; intake devuelve su material y enlace privado de subida. Conserva el mismo ID para retomarlo. No inicia edici\xF3n, render ni gasto; un enlace de subida requiere iniciar sesi\xF3n.",
204653
204741
  styles: "Estilos de edici\xF3n completos. list = biblioteca publicada; mine = estilos locales de este workspace. media styles son recetas visuales para generar im\xE1genes, no ediciones completas.",
204654
204742
  production: "Revisi\xF3n local del resultado. Un chequeo t\xE9cnico no aprueba la calidad creativa. verify mide el archivo final; los chequeos de cortes/caras requieren evidencia alineada al mismo render.",
204655
204743
  studio: "Herramientas de generaci\xF3n: catalog \u2192 quote \u2192 run \u2192 get. Una cotizaci\xF3n no gasta; run requiere presupuesto autorizado. Las capacidades dependen del proveedor y del plan.",
@@ -205449,8 +205537,8 @@ async function pushStyle(client, directory, id4, options = {}) {
205449
205537
  }
205450
205538
  for (const [path, content] of Object.entries(initial)) if (await readText(root, path) !== content) throw new Error("Style changed locally during upload; reconcile before pushing documents. Uploaded assets remain available.");
205451
205539
  const result2 = await pushWorkspace(client, root, files);
205452
- if (options.withResources && files[resourcePath] !== initial[resourcePath]) await atomicWrite(root, resourcePath, files[resourcePath]);
205453
- return { ...result2, verifiedResources: verified, mediaUploaded: uploads.length > 0, skippedResources, warnings: [...styleResourceWarnings(files), ...skippedResources.length ? [`Skipped unsupported resources (still local): ${skippedResources.map((r) => r.path).join(", ")}. Convert them to style documents or explicit local requirements.`] : []], atomic: false };
205540
+ if (options.withResources && files[resourcePath] !== initial[resourcePath] && !result2.skipped?.some((item) => item.path === resourcePath)) await atomicWrite(root, resourcePath, files[resourcePath]);
205541
+ return { ...result2, verifiedResources: verified, mediaUploaded: uploads.length > 0, skippedResources, warnings: [...result2.warnings ?? [], ...styleResourceWarnings(files), ...skippedResources.length ? [`Skipped unsupported resources (still local): ${skippedResources.map((r) => r.path).join(", ")}. Convert them to style documents or explicit local requirements.`] : []], atomic: false };
205454
205542
  }, { migrateLegacy: false });
205455
205543
  }
205456
205544
  async function pullStyle(client, directory, id4, options = {}) {
@@ -207268,6 +207356,23 @@ import { fileURLToPath } from "node:url";
207268
207356
 
207269
207357
  // packages/cli/src/agent-guidance-history.ts
207270
207358
  var VERIFIED_GUIDANCE_RELEASES = [
207359
+ {
207360
+ "version": "0.45.1",
207361
+ "archiveSha256": "52fee57c90037924969319d5c6e9e576bbbe5166cdaeae4772cfe7be0b20988d",
207362
+ "files": {
207363
+ "editorbrain/references/onboarding.md": "b842dac368455b670543d9a0defdad91708c10788d1474ddfa6b31ca929e930b"
207364
+ }
207365
+ },
207366
+ {
207367
+ "version": "0.45.0",
207368
+ "archiveSha256": "3b1db0fe7840e6e2760b794212e4f1629005547fe33e3f6189b43548b5e602ea",
207369
+ "files": {
207370
+ "editorbrain/SKILL.md": "42a47f0660002152fc6cc82e9459730361d14a396ad8b551cc4e95f8a7eff711",
207371
+ "editorbrain/references/cli-mcp.md": "8c800570e14fcc926f03e609076e9a7ea2d72a59365d4f5ded6b8750870a0e55",
207372
+ "editorbrain/references/starting-an-edit.md": "d2933b8a53ef81f0c6a29549882d5c6a28cb6799141503a1b0304aa11bb2555f",
207373
+ "editorbrain/references/workspace-files.md": "1a22a183e083ffbd0a5944e6eaecc83186bf1674126ce60fd8b2bc086d56d6d4"
207374
+ }
207375
+ },
207271
207376
  {
207272
207377
  "version": "0.44.2",
207273
207378
  "archiveSha256": "ce8d57d580cb8ef296dab84d0dfcb3b18192d6c9a0a6e55f2d524d18fc7b5333",
@@ -209437,10 +209542,14 @@ function artifactInput(input2) {
209437
209542
  const separator = input2.indexOf("=");
209438
209543
  const role2 = input2.slice(0, separator);
209439
209544
  if (separator < 1 || !checkpointRoles.includes(role2)) {
209440
- throw new CliError("CHECKPOINT_ARTIFACT_INVALID", "Use --artifact work=relative/file, renders=relative/file or sources=relative/file.", "Repeat --artifact for each file. Paths are relative to that role\u2019s linked directory, or --dir if not linked.");
209545
+ throw new CliError("CHECKPOINT_ARTIFACT_INVALID", "Artifact references require work=relative/file, renders=relative/file or sources=relative/file.", "Use a concrete file for --artifact, --primary-artifact or --dependency. Paths are relative to that role\u2019s linked directory, or --dir if not linked.");
209441
209546
  }
209442
209547
  return { role: role2, path: assertCheckpointArtifactPath(input2.slice(separator + 1)) };
209443
209548
  }
209549
+ var artifactKey = (item) => `${item.role}:${item.path}`;
209550
+ function uniqueArtifacts(items) {
209551
+ return [...new Map(items.map((item) => [artifactKey(item), item])).values()];
209552
+ }
209444
209553
  async function writeProjectCheckpoint(options) {
209445
209554
  assertIdentifier(options.projectId);
209446
209555
  const location3 = await locateProject(options.projectId, options.directory);
@@ -209461,15 +209570,23 @@ async function writeProjectCheckpoint(options) {
209461
209570
  if (options.expectedCheckpoint !== void 0 && !/^(?:none|[a-f0-9]{64})$/.test(options.expectedCheckpoint)) throw new CliError("INVALID_ARGUMENT", "Expected checkpoint must be none or a lowercase SHA-256.", "Use the checkpointHash returned by resume or checkpoint.");
209462
209571
  if (options.expectedCheckpoint !== void 0 && options.expectedCheckpoint !== originalSha256) throw new CliError("CHECKPOINT_CONFLICT", "Another agent changed this milestone since you read it.", "Resume again, reconcile both agents\u2019 work, then checkpoint with the new expected hash. Nothing was overwritten.", false, { projectId: options.projectId, expected: options.expectedCheckpoint, actual: originalSha256 });
209463
209572
  const contextHashes = Object.fromEntries(await Promise.all(Object.entries(files).map(async ([path2, content2]) => [path2, await sha256(content2)])));
209464
- const declared = options.artifacts?.map(artifactInput);
209573
+ const primaryArtifact = options.primaryArtifact === void 0 ? previous?.continuity?.primaryArtifact ?? null : options.primaryArtifact ? artifactInput(options.primaryArtifact) : null;
209574
+ const dependencies = options.dependencies === void 0 ? previous?.continuity?.dependencies ?? [] : uniqueArtifacts(options.dependencies.map(artifactInput));
209575
+ const declared = uniqueArtifacts([
209576
+ ...options.artifacts?.map(artifactInput) ?? [],
209577
+ ...options.primaryArtifact && primaryArtifact ? [primaryArtifact] : [],
209578
+ ...options.dependencies === void 0 ? [] : dependencies
209579
+ ]);
209580
+ const artifacts = new Map((options.artifacts === void 0 ? previous?.artifacts ?? [] : []).map((item) => [artifactKey(item), item]));
209581
+ for (const item of declared) artifacts.set(artifactKey(item), { ...item, sha256: "0".repeat(64), bytes: 0 });
209465
209582
  const draft = validateProjectCheckpoint({
209466
209583
  schemaVersion: 2,
209467
209584
  projectId: options.projectId,
209468
209585
  status: options.status,
209469
209586
  continuity: {
209470
209587
  currentVersion: options.currentVersion === void 0 ? previous?.continuity?.currentVersion ?? null : options.currentVersion || null,
209471
- primaryArtifact: options.primaryArtifact === void 0 ? previous?.continuity?.primaryArtifact ?? null : options.primaryArtifact ? artifactInput(options.primaryArtifact) : null,
209472
- dependencies: options.dependencies?.map(artifactInput) ?? previous?.continuity?.dependencies ?? [],
209588
+ primaryArtifact,
209589
+ dependencies,
209473
209590
  renderCommand: options.renderCommand === void 0 ? previous?.continuity?.renderCommand ?? null : options.renderCommand || null,
209474
209591
  contextHashes
209475
209592
  },
@@ -209478,20 +209595,20 @@ async function writeProjectCheckpoint(options) {
209478
209595
  pending: options.pending ?? previous?.pending ?? [],
209479
209596
  decisions: options.decisions ?? previous?.decisions ?? [],
209480
209597
  next: options.next === void 0 ? previous?.next ?? null : options.next || null,
209481
- artifacts: declared?.map((item) => ({ ...item, sha256: "0".repeat(64), bytes: 0 })) ?? previous?.artifacts ?? []
209598
+ artifacts: [...artifacts.values()]
209482
209599
  }, options.projectId);
209483
- if (declared) {
209484
- draft.artifacts = [];
209600
+ if (declared.length) {
209485
209601
  for (const artifact of declared) {
209486
209602
  const base = links2?.folders[artifact.role] ?? root;
209487
209603
  if (resolve10(base, artifact.path) === resolve10(root, checkpointFile)) throw new CliError("CHECKPOINT_SELF_REFERENCE", "A checkpoint cannot hash itself as an artifact.", "Register the scene, original or render instead.");
209488
209604
  try {
209489
- draft.artifacts.push({ ...artifact, ...await checkpointFileHash(base, artifact.path) });
209605
+ artifacts.set(artifactKey(artifact), { ...artifact, ...await checkpointFileHash(base, artifact.path) });
209490
209606
  } catch (error62) {
209491
209607
  if (missing(error62)) throw new CliError("CHECKPOINT_ARTIFACT_MISSING", `Artifact ${artifact.role}=${artifact.path} is unavailable.`, recovery);
209492
209608
  throw error62;
209493
209609
  }
209494
209610
  }
209611
+ draft.artifacts = [...artifacts.values()];
209495
209612
  }
209496
209613
  const checkpoint = validateProjectCheckpoint(draft, options.projectId);
209497
209614
  const path = checkpointFile;
@@ -211154,7 +211271,8 @@ async function syncOnboardingDocuments(client, root, files, options) {
211154
211271
  }
211155
211272
  const valid = validateWorkspace(prepared);
211156
211273
  if (!valid.valid) throw new ValidationError(valid.issues);
211157
- const preview = await pushWorkspace(client, root, prepared, { dryRun: true });
211274
+ const finalizePaths = Object.keys(prepared).filter((path) => /^\.editorbrain\/brands\/[^/]+\/design\.md$/.test(path));
211275
+ const preview = await pushWorkspace(client, root, prepared, { dryRun: true, finalizePaths });
211158
211276
  if (preview.conflicts?.length) throw conflict(preview.conflicts);
211159
211277
  await unchanged(root, files);
211160
211278
  if (options.dryRun) return { ...preview, adoptedShared: [], wouldAdoptShared: adoptions.map((doc) => doc.path) };
@@ -211166,7 +211284,11 @@ async function syncOnboardingDocuments(client, root, files, options) {
211166
211284
  await atomicWrite(root, doc.path, doc.content);
211167
211285
  }
211168
211286
  await unchanged(root, prepared);
211169
- return { ...await pushWorkspace(client, root, prepared), adoptedShared: adoptions.map((doc) => doc.path) };
211287
+ const result2 = await pushWorkspace(client, root, prepared, { finalizePaths, beforeFinalize: () => unchanged(root, prepared) });
211288
+ return { ...result2, adoptedShared: adoptions.map((doc) => doc.path), ...result2.deferred?.length ? {
211289
+ deferredConfirmations: result2.deferred,
211290
+ next: `${result2.next ?? ""} Las confirmaciones editoriales quedan pendientes hasta guardar los documentos restantes.`.trim()
211291
+ } : {} };
211170
211292
  }
211171
211293
 
211172
211294
  // packages/cli/src/onboarding.ts
@@ -211259,7 +211381,7 @@ async function applyOnboarding(options) {
211259
211381
  if (configuration.status === "pending" && profile.questionMode !== "autonomous") throw failure2("ONBOARDING_PREFERENCES_PENDING", `Confirm the remaining preference categories before applying guided onboarding: ${configuration.pending.join(", ")}`, "Reopen the artifact or ask the user in chat. Keep saved choices; mark categories reviewed only after explicit confirmation or delegation.");
211260
211382
  const validation = validateWorkspace(merged);
211261
211383
  if (!validation.valid) throw new ValidationError(validation.issues);
211262
- const pending = writes.filter((w) => current2[w.path]?.content !== w.content);
211384
+ const pending = writes.filter((w) => current2[w.path]?.content !== w.content).sort((a, b) => Number(a.path === `.editorbrain/brands/${session.brandId}/design.md`) - Number(b.path === `.editorbrain/brands/${session.brandId}/design.md`));
211263
211385
  if (!options.dryRun) {
211264
211386
  for (const item of pending) {
211265
211387
  const now = await localDocument(root, item.path);
@@ -211286,7 +211408,7 @@ async function syncOnboarding(client, options) {
211286
211408
  if (!validation.valid) throw new ValidationError(validation.issues);
211287
211409
  const accountActions = onboardingAccountActions(receipt.accountSetup);
211288
211410
  const result2 = await syncOnboardingDocuments(client, root, files, { snapshots: session.snapshots, scaffold: scaffold(session.brandId, session.projectId), dryRun: options.dryRun });
211289
- return { ...result2, accountActions, brandId: session.brandId, projectId: session.projectId, aiAnalyzed: false, next: "Documents are synced only after success. Complete requested accountActions against the intended account and verify them before claiming connected setup is ready. Brain analysis is optional: only if requested, read design.md revision and use brain prepare; review before accepting." };
211411
+ return { ...result2, accountActions, brandId: session.brandId, projectId: session.projectId, aiAnalyzed: false, next: result2.next ?? "Documents are synced only after success. Complete requested accountActions against the intended account and verify them before claiming connected setup is ready. Brain analysis is optional: only if requested, read design.md revision and use brain prepare; review before accepting." };
211290
211412
  }, { migrateLegacy: !options.dryRun });
211291
211413
  }
211292
211414
  async function serveOnboarding(options) {
@@ -215657,7 +215779,7 @@ editorbrain batches retry|detach BATCH_ID --project ID --expected-revision N
215657
215779
  editorbrain batches claim|renew|release|attention BATCH_ID --project ID --lease-token UUID
215658
215780
  editorbrain brands list [--limit 20] [--after CURSOR]
215659
215781
  editorbrain projects list [--brand ID] [--query TEXT] [--since ISO] [--before ISO] [--sort recent|id] [--limit 20] [--after CURSOR]
215660
- editorbrain projects find "NAME OR TOPIC" [--brand ID] [--since ISO] [--before ISO] [--local]
215782
+ editorbrain projects find "NAME OR TOPIC" [--brand ID] [--since ISO] [--before ISO] [--local] [--dir workspace]
215661
215783
  editorbrain projects create ID --brand ID --style ID --output-profile ID [--name TEXT] [--topic TEXT] [--goal TEXT] [--dir folder]
215662
215784
  editorbrain projects intake --project ID [--dir folder]
215663
215785
  editorbrain projects link --project ID --path folder [--role work|renders|sources] [--dir workspace]
@@ -215870,6 +215992,7 @@ function str(args, name) {
215870
215992
  }
215871
215993
  function output2(value) {
215872
215994
  process.stdout.write(stableJson(value));
215995
+ if (value && typeof value === "object" && "status" in value && value.status === "partial" && "synced" in value && value.synced === false) process.exitCode = 2;
215873
215996
  }
215874
215997
  async function configRoot(create = false) {
215875
215998
  let path = process.env.EDITORBRAIN_CONFIG_DIR ?? process.env.EDITORHARNESS_CONFIG_DIR ?? join19(homedir4(), ".config", "editorbrain");
@@ -216667,8 +216790,8 @@ async function main() {
216667
216790
  if (argument && args.flags.query) throw new Error("Use the search phrase or --query, not both.");
216668
216791
  const query = argument ?? str(args, "query");
216669
216792
  if (args.flags.local) {
216670
- if (["url", "limit", "after", "since", "before", "sort", "dir"].some((key) => args.flags[key] !== void 0)) throw new Error("Local find supports only --brand and a query. It inspects this device registry without network access.");
216671
- output2({ source: "local_registry", ...await listRegisteredProjects({ query, brandId: str(args, "brand") }) });
216793
+ if (["url", "limit", "after", "since", "before", "sort"].some((key) => args.flags[key] !== void 0)) throw new Error("Local find supports only --brand, --dir and a query. It inspects this device registry without network access.");
216794
+ output2({ source: "local_registry", ...await listRegisteredProjects({ query, brandId: str(args, "brand"), directory: str(args, "dir") }) });
216672
216795
  return;
216673
216796
  }
216674
216797
  const params = new URLSearchParams();
@@ -216995,7 +217118,8 @@ async function main() {
216995
217118
  return;
216996
217119
  }
216997
217120
  if (command === "push") {
216998
- output2({ ...await pushWorkspace(new Client(await config2(args)), root, files, { dryRun: !!args.flags["dry-run"] }), warnings: styleResourceWarnings(files) });
217121
+ const result2 = await pushWorkspace(new Client(await config2(args)), root, files, { dryRun: !!args.flags["dry-run"] });
217122
+ output2({ ...result2, warnings: [...result2.warnings ?? [], ...styleResourceWarnings(files)] });
216999
217123
  return;
217000
217124
  }
217001
217125
  const project = subcommand ?? str(args, "project");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "editorbrain",
3
- "version": "0.45.0",
3
+ "version": "0.45.2",
4
4
  "description": "EditorBrain editorial knowledge, portable workspaces and skills for AI video agents",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",
@@ -43,6 +43,9 @@ first; remote metadata does not imply this host can open files on another Mac. S
43
43
  `checkpoint` at meaningful milestones; synchronize it only through an explicit,
44
44
  authorized `push`. See [workspace files](references/workspace-files.md#project-checkpoints-and-local-links)
45
45
  for local links, relative artifact paths and the portable record.
46
+ Read a push result before claiming synchronization: `status: "partial"` with
47
+ exit 2 leaves skipped documents local and unsynchronized. Follow its upgrade
48
+ hint and retry without downgrading checkpoint v2; see [sync recovery](references/cli-mcp.md#recovery-and-diagnostics-cli-07).
46
49
 
47
50
  Before composing an edit with visual support, use the [media acquisition guide](references/real-media.md), including for fully animated videos. Cover the relevant beats with acquired and inspected user/web/generated resources as appropriate. Resolved/workflow `mediaAcquisition`, when available, turns the effective choices into planning guidance; it is not proof of searches or tool access. Searching EditorBrain for editing techniques is a separate job.
48
51
 
@@ -213,6 +213,23 @@ Use `editorbrain version` to discover the installed release. Run `editorbrain do
213
213
 
214
214
  Before reconciling sync problems, use `push --dry-run` or `pull --dry-run`. Read `conflicts` and the planned paths. A preview neither writes nor reserves revisions. Never use a separate workspace to evade a binding mismatch.
215
215
 
216
+ CLI 0.45.1 adds partial push recovery for older APIs.
217
+ `push` continues only past confirmed unsupported document types or
218
+ schemas. Inspect `status: "partial"`, `synced: false`, `uploaded`, `skipped`
219
+ (path, code, hint, HTTP status), `warnings` and `next`. Exit **2** means action
220
+ remains; skipped documents stay local and unsynchronized. Follow the API upgrade
221
+ hint and retry. Successful revisions are recorded and are not uploaded again.
222
+ `push --dry-run` checks local validity and revision conflicts only; it does not
223
+ probe server document/schema support or predict these skips.
224
+
225
+ `CHECKPOINT_UNSUPPORTED` includes an older API rejecting checkpoint v2 because
226
+ `schemaVersion` must be 1. Update the API without stripping v2 continuity fields
227
+ or downgrading the document. Only recognized unsupported document/schema errors
228
+ qualify: generic HTTP 400/422 remain validation/request failures. Authentication,
229
+ conflicts, unsafe paths, invalid documents, server and network failures still
230
+ stop push, preserving any successfully uploaded prefix. Never report a partial
231
+ push as fully synchronized or clear local pending work to hide a skip.
232
+
216
233
  Errors include `code`, `hint`, `retryable` and the legacy text `error`. `AUTH_REQUIRED` needs user authorization, `ACCESS_DENIED` needs the right permission, `SYNC_CONFLICT` needs reconciliation, and `WORKSPACE_MISMATCH` requires the correct separate folder. `WORKSPACE_BUSY` means another CLI operation owns `.editorbrain-operation.lock`; do not auto-delete it. After a crash, verify no process is using the folder before removing a leftover lock.
217
234
 
218
235
  GET requests use bounded retries and respect Retry-After. Writes are not retried automatically: after a network error, inspect remote state before repeating them. Do not treat `retryable` as permission for an unbounded loop. HTTP error bodies are not printed. The MCP now provides matching structuredContent and text; consume either without counting them as separate results. Writing a document is declared mutating and may update existing content even though revision history is preserved.
@@ -135,6 +135,16 @@ editorbrain onboarding sync --session <session> --dir ./my-videos
135
135
 
136
136
  After `onboarding apply`, the canonical publishing step is `onboarding sync` (preview, then sync) for the same session. Do not additionally run `push`: it is the general document command and may include unrelated edits.
137
137
 
138
+ CLI 0.45.2 writes the brand's `design.md` with editorial confirmations last,
139
+ after its other local answers, including audio. Sync checks the whole selected
140
+ set before any upload, then rechecks local inputs and remote revisions before
141
+ publishing that final document. A conflict, failed upload or unsupported
142
+ document before that final write leaves the new confirmations unpublished. This is not a multi-file
143
+ transaction: earlier accepted writes remain saved. Inspect `uploaded`, `skipped`
144
+ and the recovery hint before retrying the same session; never mark the intake
145
+ complete from an HTTP success for only one document. If the final receipt is
146
+ missing, inspect the saved remote state before deciding whether it completed.
147
+
138
148
  Inspect planned paths/conflicts. Sync uploads only this brand/starter context.
139
149
  Untouched shared starter guides can adopt the account's existing versions;
140
150
  personalized local documents are never silently replaced. On network failure,
@@ -59,6 +59,9 @@ server document/progress activity, not an agent-supplied date. Follow its opaque
59
59
  cursor unchanged with the same filters; results are a live list. Offline,
60
60
  `projects find "name" --local` searches registered folders only and reports
61
61
  missing disks or stale identities; it is not a complete account inventory.
62
+ CLI 0.45.1 adds `--local --dir <workspace>` to validate the directory
63
+ and limit results to its canonical registered root, without network, folder scans
64
+ or registration. Check the installed version before using this option.
62
65
 
63
66
  Use `resume ID --dir <workspace>` when the workspace is known; without `--dir`,
64
67
  the CLI uses the current project or a unique private registry entry. If several
@@ -105,6 +105,8 @@ tool preferences. Keep local artifacts under separate project directories.
105
105
  Use CLI 0.45.0 or later for this workflow; remote discovery and continuity require
106
106
  API/MCP 0.45.0 or later. Check the installed CLI's help and the connection's actual
107
107
  tools before using them. Verify the intended workspace before selecting an ID.
108
+ CLI 0.45.1 adds scoped local discovery and automatic registration of explicit
109
+ continuity references below; use 0.45.1 or later for those fixes.
108
110
  Use `projects find "name or topic" --brand ID` for discovery and `projects list
109
111
  --brand ID --sort recent` for server-recorded activity. Convert relative dates in
110
112
  the user's timezone to UTC `--since`/`--before` boundaries. Preserve filters with
@@ -113,7 +115,9 @@ new query. Resolve ambiguous matches rather than choosing the first project.
113
115
 
114
116
  `projects find "name or topic" --local` searches only this device's private registry,
115
117
  without network access. It accepts a brand filter, not dates or remote pagination;
116
- it does not scan the whole disk. Old projects and completed milestones remain
118
+ it does not scan the whole disk. With `--dir <workspace>`, CLI 0.45.1 validates
119
+ the directory and filters by its canonical registered workspace root; it does
120
+ not scan the folder or register projects. Old projects and completed milestones remain
117
121
  discoverable while their documents and permissions exist. Archiving a chat does
118
122
  not remove saved project documents, and this release adds no project archive or
119
123
  unarchive command. Unsaved conversation-only decisions cannot be recovered from a
@@ -130,14 +134,14 @@ workspace binding requires registering the folders again.
130
134
  At meaningful milestones—direction ready, sample produced/reviewed, a resolved
131
135
  correction or a delivery—save actual progress, decisions, remaining work and
132
136
  concrete artifacts with `checkpoint`. This records work already done; it does
133
- not create another review gate or certify quality. For example, with an existing
134
- work folder containing `scene.html`:
137
+ not create another review gate or certify quality. Example for CLI 0.45.1+, with an
138
+ existing work folder containing `scene.html`:
135
139
 
136
140
  ```sh
137
141
  editorbrain checkpoint --project ID --status in_progress --dir <workspace> \
138
142
  --done "Representative scene implemented" --pending "Review motion and audio" \
139
143
  --decision "Keep the approved direction" --next "Inspect the sample" \
140
- --artifact work=scene.html --expected-checkpoint HASH_FROM_RESUME \
144
+ --expected-checkpoint HASH_FROM_RESUME \
141
145
  --current-version cut-v3 --primary-artifact work=scene.html
142
146
  ```
143
147
 
@@ -151,8 +155,11 @@ temporary links out of all portable fields, including free text.
151
155
  `in_review`, `blocked`, `completed`), `done`, `pending`, `decisions`, `next` and
152
156
  artifact references. Repeated `--done`, `--pending`, `--decision` and `--artifact`
153
157
  flags supply lists. Omitted fields remain unchanged; a supplied list replaces
154
- that list. Previous omitted artifacts keep their old hashes; they are not
155
- recertified. To clear a list, set it to `[]` in the checkpoint JSON and validate
158
+ that list. For artifacts, explicit `--primary-artifact` and `--dependency`
159
+ references are then added to that base and hashed. Without `--artifact`, the base
160
+ retains previous artifacts. Previous omitted artifacts keep their old hashes;
161
+ they are not recertified. Existing continuity references omitted from the command
162
+ do not trigger another file read. To clear a list, set it to `[]` in the checkpoint JSON and validate
156
163
  the workspace before synchronizing; use `null` to clear `next`, or pass
157
164
  `--next ""` to the checkpoint command.
158
165
 
@@ -160,7 +167,9 @@ New checkpoints use schema v2; v1 remains readable. `continuity` records
160
167
  `currentVersion` (agent label, not approval), `primaryArtifact`, `dependencies`,
161
168
  `renderCommand` (inert text) and `contextHashes` captured from current editorial
162
169
  documents. `--primary-artifact role=path` and repeated `--dependency role=path`
163
- must refer to declared artifacts; include them with `--artifact` first. Record
170
+ automatically register/hash explicitly supplied files in `artifacts` from CLI
171
+ 0.45.1; no duplicate `--artifact` is needed. On 0.45.0, also declare
172
+ those files with `--artifact`. Record
164
173
  reasons in `--decision`. `--render-command` must use portable relative paths and
165
174
  never contains secrets; resume never executes it. Empty strings clear version,
166
175
  primary artifact or render command. Removed artifacts require removing/updating
@@ -185,6 +194,10 @@ media or automatically pushes. Checkpoints are operational documents excluded
185
194
  from editorial resolution hashes, so recording progress does not invalidate a
186
195
  render. They supplement `direction.md`, versioned reviews and the progress board;
187
196
  their statuses do not change those records or grant approvals.
197
+ If push returns `status: "partial"` and exit 2, skipped documents remain local
198
+ and unsynchronized. Follow [sync recovery](cli-mcp.md#recovery-and-diagnostics-cli-07),
199
+ upgrade the API as directed, and retry without discarding v2 fields. Dry-run does
200
+ not test whether the server supports their document/schema versions.
188
201
 
189
202
  On resume, follow [adaptive entry](starting-an-edit.md#resume-an-existing-project).
190
203
  The CLI verifies each artifact and searches for moved bytes only within bounded