@workover/mcp 0.6.0 → 0.7.1
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 +1 -1
- package/index.mjs +7 -1
- package/lib.mjs +31 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@ That's it. Ask Claude Code things like *"read my Workover doc about onboarding a
|
|
|
24
24
|
- `workover_search_docs(query)` — find documents by title/content
|
|
25
25
|
- `workover_read_doc(docId, tabId?)` — read a document's text, with the style guide attached
|
|
26
26
|
- `workover_list_projects()` — list your projects
|
|
27
|
-
- `workover_create_doc(projectId, title, markdown)` — create a document with its content written in
|
|
27
|
+
- `workover_create_doc(projectId, title, markdown, categories?)` — create a document with its content written in, filed under the categories you name (a category that does not exist yet is created)
|
|
28
28
|
- `workover_upload_image(docId, path, alt)` — put a local image into a document's media
|
|
29
29
|
- `workover_propose_edit(docId, markdown, note, tabId?)` — propose a revised version (rendered as suggestions; never applied or published automatically)
|
|
30
30
|
- `workover_edit_doc(docId, markdown, note, tabId?)` — edit a document directly, no review step. Needs `workover login --write`
|
package/index.mjs
CHANGED
|
@@ -154,6 +154,12 @@ const TOOLS = [
|
|
|
154
154
|
},
|
|
155
155
|
title: { type: 'string', description: 'The document title.' },
|
|
156
156
|
markdown: { type: 'string', description: 'The document body as markdown.' },
|
|
157
|
+
categories: {
|
|
158
|
+
type: 'array',
|
|
159
|
+
items: { type: 'string' },
|
|
160
|
+
description:
|
|
161
|
+
'Category names to file the document under, e.g. ["RunCache"]. A category that does not exist yet is created. Without this the document carries no category and does not appear under any category filter in the document list.',
|
|
162
|
+
},
|
|
157
163
|
},
|
|
158
164
|
required: ['projectId', 'title', 'markdown'],
|
|
159
165
|
},
|
|
@@ -239,7 +245,7 @@ const telemetry = telemetryEnabled(process.env, { auth });
|
|
|
239
245
|
// Keep in step with package.json. It is what every telemetry event is stamped with, so a stale
|
|
240
246
|
// value here does not break anything — it quietly attributes this release's behaviour to an older
|
|
241
247
|
// one, which is worse, because the numbers still look fine.
|
|
242
|
-
const VERSION = '0.
|
|
248
|
+
const VERSION = '0.7.1';
|
|
243
249
|
|
|
244
250
|
/**
|
|
245
251
|
* What the client is told about this server before it calls anything.
|
package/lib.mjs
CHANGED
|
@@ -375,22 +375,45 @@ export function makeDispatch({ auth, api, apiPost, fetchImpl = fetch, readFile }
|
|
|
375
375
|
// The body goes WITH the create. A document this call brought into existence has no prior
|
|
376
376
|
// text to protect, so its first content is written directly rather than queued as
|
|
377
377
|
// suggestions for the person to accept against an empty page.
|
|
378
|
+
// Categories ride along on the create rather than needing a second call: filing a document
|
|
379
|
+
// is part of making it, and a follow-up write is another thing that can half-fail and leave
|
|
380
|
+
// the document sitting outside every filter in the list.
|
|
381
|
+
const categories = Array.isArray(args.categories)
|
|
382
|
+
? args.categories
|
|
383
|
+
.filter((c) => typeof c === 'string')
|
|
384
|
+
.map((c) => c.trim())
|
|
385
|
+
.filter(Boolean)
|
|
386
|
+
: [];
|
|
378
387
|
const doc = await apiPost(`/project/${projectId}/documents`, {
|
|
379
388
|
title,
|
|
380
389
|
markdown: md,
|
|
390
|
+
...(categories.length ? { wpCategories: categories } : {}),
|
|
381
391
|
});
|
|
382
392
|
if (!doc?.id) return err('Could not create the document.');
|
|
393
|
+
// Same shape of check as `contentCommitted` below, for the same reason: an older Workover
|
|
394
|
+
// drops a field it does not know, answers 200, and the document is quietly uncategorised.
|
|
395
|
+
const filed =
|
|
396
|
+
!categories.length ||
|
|
397
|
+
(Array.isArray(doc.wpCategories) && doc.wpCategories.length > 0);
|
|
398
|
+
const filedNote = filed
|
|
399
|
+
? categories.length
|
|
400
|
+
? ` Filed under ${categories.join(', ')}.`
|
|
401
|
+
: ''
|
|
402
|
+
: ` NOTE: this Workover ignored the categories, so the document is not filed under ${categories.join(', ')} — set them in the document list.`;
|
|
383
403
|
if (contentCommitted(doc)) {
|
|
384
|
-
// The
|
|
404
|
+
// The verdict when the api ran the check, the guide when it could not have.
|
|
385
405
|
//
|
|
386
|
-
//
|
|
387
|
-
//
|
|
388
|
-
// happen, this
|
|
389
|
-
//
|
|
390
|
-
// again, in a place nobody would think to look
|
|
391
|
-
const style =
|
|
406
|
+
// A current api lints the body on create the way `propose` and `edit` do and returns
|
|
407
|
+
// `style` (null meaning no rules). An older one has no such field, and rather than assert
|
|
408
|
+
// a check that did not happen, this falls back to showing the rules so the agent can
|
|
409
|
+
// measure its own draft against them. Claiming "no violations" on a check that never ran
|
|
410
|
+
// would be the empty-checklist problem again, in a place nobody would think to look.
|
|
411
|
+
const style =
|
|
412
|
+
doc && 'style' in doc
|
|
413
|
+
? renderStyleFeedback(doc.style)
|
|
414
|
+
: renderStyleGuide(await fetchRules(api, projectId));
|
|
392
415
|
return text(
|
|
393
|
-
`Created "${title}" (document #${doc.id}) with the content written in — no review step, because it is a new document.${doc.documentUrl ? `\n${doc.documentUrl}` : ''}\n\nFurther changes to it go through workover_propose_edit, which the person accepts or rejects. Nothing is published to WordPress either way.${style}`,
|
|
416
|
+
`Created "${title}" (document #${doc.id}) with the content written in — no review step, because it is a new document.${filedNote}${doc.documentUrl ? `\n${doc.documentUrl}` : ''}\n\nFurther changes to it go through workover_propose_edit, which the person accepts or rejects. Nothing is published to WordPress either way.${style}`,
|
|
394
417
|
);
|
|
395
418
|
}
|
|
396
419
|
// This Workover predates create-with-content and dropped the field, leaving an empty
|
package/package.json
CHANGED