@workover/mcp 0.19.0 → 0.20.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
@@ -38,6 +38,7 @@ production sign-in names the environment instead.
38
38
  - `workover_set_image(docId, src, filename?, alt?)` — set an image's file name (its WordPress media name) and/or alt text, as the editor's Edit image dialog does. Needs `workover login --write`
39
39
  - `workover_doc_status(docId, status?)` — read a document's Workover status and the statuses its workflow offers (with whether you may move it to each, and why not), or set it through the browser's rules: role, workflow gates, approvals. Needs `workover login --write`, plus `--publish` to or from Published. Does not publish to WordPress
40
40
  - `workover_propose_edit(docId, markdown, note, tabId?, reasoning?)` — propose a revised version (rendered as suggestions; never applied or published automatically)
41
+ - `workover_suggestion_status(docId)` — the open suggestion: whether the editor has shown it, has not yet, or could not (and why)
41
42
  - `workover_edit_doc(docId, markdown?, title?, note, tabId?)` — edit a document directly, no review step. Needs `workover login --write`. Pass `title` to rename it: with no `markdown` only the name changes and the body is left as it is. A `# Heading` in the markdown never renames a document
42
43
  - `workover_style_guide(projectId?)` — the rules this team writes by
43
44
  - `workover_add_style_rule(text, projectId | organizationId)` — add a rule. Needs `workover login --rules`
package/index.mjs CHANGED
@@ -331,6 +331,16 @@ const TOOLS = [
331
331
  required: ['docId', 'markdown'],
332
332
  },
333
333
  },
334
+ {
335
+ name: 'workover_suggestion_status',
336
+ description:
337
+ "Check on a document's open suggestion, the one workover_propose_edit raises: who raised it and when, and whether the editor has shown it as tracked changes, has not yet (it appears when someone who can review it opens the document), or could NOT show it, with the reason. A document has one open suggestion at a time; proposing again replaces its text. Use it after proposing, rather than assuming the suggestion is on the page.",
338
+ inputSchema: {
339
+ type: 'object',
340
+ properties: { docId: DOC_ARG },
341
+ required: ['docId'],
342
+ },
343
+ },
334
344
  {
335
345
  name: 'workover_report_feedback',
336
346
  description: FEEDBACK_TOOL_DESCRIPTION,
@@ -576,7 +586,7 @@ const telemetry = telemetryEnabled(process.env, { auth });
576
586
  // Keep in step with package.json. It is what every telemetry event is stamped with, so a stale
577
587
  // value here does not break anything — it quietly attributes this release's behaviour to an older
578
588
  // one, which is worse, because the numbers still look fine.
579
- const VERSION = '0.19.0';
589
+ const VERSION = '0.20.0';
580
590
 
581
591
  /** This release and the connected client, stamped on a feedback report (see feedback.mjs). */
582
592
  function clientInfo() {
package/lib.mjs CHANGED
@@ -370,6 +370,50 @@ export const resolveDoc = async (api, value, apiBase) => {
370
370
  };
371
371
 
372
372
  /** Kept for callers of the earlier helper: the row id, or null. */
373
+ /**
374
+ * What `workover_propose_edit` did, from the api's `outcome` (WO-1748). An api older than the field
375
+ * answers without one, and is described the way every proposal used to be.
376
+ */
377
+ export function proposeOutcomeText(res, docId) {
378
+ const where = `${res?.tab ? `the "${res.tab.title}" tab of ` : ''}document #${docId}`;
379
+ const id = res?.id != null ? ` (suggestion #${res.id})` : '';
380
+ const check = 'workover_suggestion_status says whether the editor has shown it.';
381
+ if (res?.outcome === 'unchanged')
382
+ return `Nothing changed: the open suggestion on ${where}${id} already says exactly this. ${check}`;
383
+ if (res?.outcome === 'held')
384
+ return `Not applied: the open suggestion on ${where}${id} is out with Workover AI for a revision, and your text would be overwritten when that lands. Propose again once workover_suggestion_status says it is back.`;
385
+ if (res?.outcome === 'reoffered')
386
+ return `The open suggestion on ${where}${id} already says exactly this, and the editor had not been able to show it. It is offered again the next time someone who can review it opens the document; if it still cannot be shown, workover_suggestion_status says why.`;
387
+ const verb = res?.outcome === 'updated' ? 'Updated the open suggestion on' : 'Proposed your changes to';
388
+ return `${verb} ${where}${id}. They appear as tracked changes to accept or reject the next time someone who can review them opens the document in Workover. ${check}`;
389
+ }
390
+
391
+ /** The answer to `workover_suggestion_status`, from `GET /project/doc/:id/proposals/current`. */
392
+ export function suggestionStatusText(current, docId) {
393
+ if (!current)
394
+ return `Document #${docId} has no open suggestion. One raised earlier was accepted or dismissed, or none was raised.`;
395
+ const from = current.proposedBy?.name
396
+ ? `${current.proposedBy.name} via ${current.source}`
397
+ : current.source;
398
+ const lines = [
399
+ `Suggestion #${current.id} on document #${docId}, from ${from}, raised ${current.createdAt}${current.revisions ? `, revised ${current.revisions} time${current.revisions === 1 ? '' : 's'}` : ''}.`,
400
+ ];
401
+ if (current.tabField) lines.push(`Against tab "${current.tabField}".`);
402
+ if (current.status === 'refining')
403
+ lines.push('It is out with Workover AI for a revision, so it is not on the page right now.');
404
+ else if (current.editorRefusal)
405
+ lines.push(
406
+ `The editor could NOT show it as tracked changes, so nothing is on the page: ${current.editorRefusal}`,
407
+ 'Propose a version that avoids that, or send the same text again to have the editor try once more.',
408
+ );
409
+ else if (current.shownAt)
410
+ lines.push(`Shown in the editor at ${current.shownAt}, waiting for someone to accept or reject it.`);
411
+ else
412
+ lines.push('Not shown yet: it appears the next time someone who can review it opens the document.');
413
+ if (current.note) lines.push(`Note: ${current.note}`);
414
+ return lines.join('\n');
415
+ }
416
+
373
417
  export const resolveDocId = async (api, value) => (await resolveDoc(api, value)).id ?? null;
374
418
 
375
419
  const decodeAttr = (v) =>
@@ -1116,9 +1160,19 @@ export function makeDispatch({ auth, api, apiPost, fetchImpl = fetch, readFile,
1116
1160
  : {}),
1117
1161
  });
1118
1162
  return text(
1119
- `Proposed your changes to ${res?.tab ? `the "${res.tab.title}" tab of ` : ''}document #${docId}. They'll appear as suggestions to accept or reject when the document is open in Workover${res?.documentUrl ? `:\n${res.documentUrl}` : '.'}\n\nNothing is published until the person reviews and accepts.${renderStyleFeedback(res?.style)}`,
1163
+ `${proposeOutcomeText(res, docId)}${res?.documentUrl ? `\n${res.documentUrl}` : ''}\n\nNothing is published until the person reviews and accepts.${renderStyleFeedback(res?.style)}`,
1120
1164
  );
1121
1165
  }
1166
+ if (name === 'workover_suggestion_status') {
1167
+ // Whether a suggestion raised through workover_propose_edit reached the page (WO-1748):
1168
+ // before this the only answer was the propose call's own "they'll appear", which was said
1169
+ // whether or not the editor could show them.
1170
+ const doc = await resolveDoc(api, docArg(args), auth.api);
1171
+ if (doc.error) return doc.error;
1172
+ const docId = doc.id;
1173
+ const current = await api(`/project/doc/${docId}/proposals/current`);
1174
+ return text(suggestionStatusText(current, docId));
1175
+ }
1122
1176
  if (name === 'workover_doc_status') {
1123
1177
  // The document's WORKOVER status, read or set through the browser's rules (WO-1264). It
1124
1178
  // never publishes: the WordPress post is a separate thing, and the answer says so.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workover/mcp",
3
- "version": "0.19.0",
3
+ "version": "0.20.0",
4
4
  "description": "Workover MCP server — let Claude Code and other MCP clients read and cowork on your Workover documents.",
5
5
  "license": "UNLICENSED",
6
6
  "author": "ScaleMath",