editorbrain 0.45.1 → 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.1 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.1
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] : {};
@@ -203179,14 +203182,36 @@ async function pushWorkspace(client, root, files, options = {}) {
203179
203182
  }
203180
203183
  pending.push({ path, content, expectedRevision: base?.revision ?? 0 });
203181
203184
  }
203185
+ const finalPaths = new Set(options.finalizePaths ?? []);
203186
+ pending.sort((a, b) => Number(finalPaths.has(a.path)) - Number(finalPaths.has(b.path)));
203182
203187
  if (options.dryRun) return { dryRun: true, uploaded: [], unchanged: unchanged2, wouldUpload: pending.map((item) => item.path), conflicts };
203183
203188
  if (conflicts.length) throw new CliError("SYNC_CONFLICT", `Remote documents changed. Pull into a separate folder or reconcile changes before pushing:
203184
203189
  ${conflicts.join("\n")}`, "Run push --dry-run and reconcile the reported paths.", false, { conflicts });
203185
203190
  const uploaded = [];
203186
203191
  const skipped = [];
203192
+ const deferred = [];
203193
+ let finalChecked = false;
203187
203194
  for (const item of pending) {
203188
203195
  let result2;
203189
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
+ }
203190
203215
  result2 = await client.put(item.path, item.content, item.expectedRevision);
203191
203216
  } catch (error62) {
203192
203217
  if (!(error62 instanceof UnsupportedDocumentError)) {
@@ -203200,6 +203225,7 @@ ${conflicts.join("\n")}`, "Run push --dry-run and reconcile the reported paths."
203200
203225
  const digest5 = await sha256(item.content);
203201
203226
  if (result2.path !== item.path || result2.sha256 !== digest5) throw new Error("Server returned inconsistent write metadata");
203202
203227
  state.documents[item.path] = { revision: result2.revision, sha256: result2.sha256 };
203228
+ remote.set(item.path, result2);
203203
203229
  uploaded.push(item.path);
203204
203230
  await saveSyncState(root, state);
203205
203231
  }
@@ -203208,6 +203234,7 @@ ${conflicts.join("\n")}`, "Run push --dry-run and reconcile the reported paths."
203208
203234
  status: "partial",
203209
203235
  synced: false,
203210
203236
  skipped,
203237
+ ...deferred.length ? { deferred } : {},
203211
203238
  warnings: skipped.map((item) => `${item.path}: el servidor no soporta este documento; sigue pendiente y conservado localmente.`),
203212
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."
203213
203240
  } : {} };
@@ -207329,6 +207356,13 @@ import { fileURLToPath } from "node:url";
207329
207356
 
207330
207357
  // packages/cli/src/agent-guidance-history.ts
207331
207358
  var VERIFIED_GUIDANCE_RELEASES = [
207359
+ {
207360
+ "version": "0.45.1",
207361
+ "archiveSha256": "52fee57c90037924969319d5c6e9e576bbbe5166cdaeae4772cfe7be0b20988d",
207362
+ "files": {
207363
+ "editorbrain/references/onboarding.md": "b842dac368455b670543d9a0defdad91708c10788d1474ddfa6b31ca929e930b"
207364
+ }
207365
+ },
207332
207366
  {
207333
207367
  "version": "0.45.0",
207334
207368
  "archiveSha256": "3b1db0fe7840e6e2760b794212e4f1629005547fe33e3f6189b43548b5e602ea",
@@ -211237,7 +211271,8 @@ async function syncOnboardingDocuments(client, root, files, options) {
211237
211271
  }
211238
211272
  const valid = validateWorkspace(prepared);
211239
211273
  if (!valid.valid) throw new ValidationError(valid.issues);
211240
- 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 });
211241
211276
  if (preview.conflicts?.length) throw conflict(preview.conflicts);
211242
211277
  await unchanged(root, files);
211243
211278
  if (options.dryRun) return { ...preview, adoptedShared: [], wouldAdoptShared: adoptions.map((doc) => doc.path) };
@@ -211249,7 +211284,11 @@ async function syncOnboardingDocuments(client, root, files, options) {
211249
211284
  await atomicWrite(root, doc.path, doc.content);
211250
211285
  }
211251
211286
  await unchanged(root, prepared);
211252
- 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
+ } : {} };
211253
211292
  }
211254
211293
 
211255
211294
  // packages/cli/src/onboarding.ts
@@ -211342,7 +211381,7 @@ async function applyOnboarding(options) {
211342
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.");
211343
211382
  const validation = validateWorkspace(merged);
211344
211383
  if (!validation.valid) throw new ValidationError(validation.issues);
211345
- 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`));
211346
211385
  if (!options.dryRun) {
211347
211386
  for (const item of pending) {
211348
211387
  const now = await localDocument(root, item.path);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "editorbrain",
3
- "version": "0.45.1",
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",
@@ -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,