Repository navigation
feat: add doc update --publish to publish drafts - #156
Conversation
`doc create` makes a draft unless `--publish` is passed, and there was no way to publish that draft later without the web UI. `doc update` now takes `--publish`, which sets `publish: true` on `documents.update`. It works on its own, leaving the title and text untouched. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
scottlovegrove
left a comment
There was a problem hiding this comment.
Thanks, this works as described for drafts created through the CLI. A couple of comments inline, the first being the more important one.
| .option('--title <title>', 'New title') | ||
| .option('--text <text>', 'New body (markdown)') | ||
| .option('--file <path>', 'Read markdown from file') | ||
| .option('--publish', 'Publish a draft') |
There was a problem hiding this comment.
This won't work for drafts that don't belong to a collection, which you can create from the web UI. For those, Outline's authorizeDocumentPublish requires a collectionId in the request and rejects with collectionId is required to publish a draft without collection (source), and there's currently no way to pass one from the CLI. Drafts made with ol doc create always have a collection because it requires --collection or --parent, which is why it works in your testing.
Could you add a --collection <ref> option to doc update that resolves via resolveCollectionId and sends collectionId alongside publish: true? documents.update already accepts collectionId for this.
There was a problem hiding this comment.
Good catch, thanks.
Added in fa1c940:
doc update now takes --collection <ref>, resolved via resolveCollectionId, and sends it as collectionId alongside publish: true. Outline only uses collectionId on update when publishing, so --collection without --publish now errors (pointing to doc move) instead of silently doing nothing. Checked against Outline 1.11.0 with a draft created without a collection: --publish alone gets collectionId is required to publish a draft without collection, and --publish --collection <ref> publishes it into that collection.
| if (rawText) body.text = rawText | ||
| if (opts.title) body.title = opts.title | ||
| } | ||
| if (opts.publish) body.publish = true |
There was a problem hiding this comment.
Minor: with --publish the output further down still prints Updated: <title>. Printing Published: <title> in that case would make it clearer the publish happened.
…-collection` Drafts created in the web UI can have no collection, and Outline rejects publishing them unless `collectionId` is sent. `doc update` now takes `--collection <ref>`, resolved like the other collection options. Outline ignores `collectionId` on update unless publishing, so `--collection` without `--publish` is rejected instead of being a silent no-op. With `--publish`, the output says `Published:`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
## [2.2.0](v2.1.12...v2.2.0) (2026-10-23) ### Features * add `doc update --publish` to publish drafts ([#156](#156)) ([e155c92](e155c92))
|
🎉 This PR is included in version 2.2.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
ol doc createmakes a draft unless--publishis passed, but there was no way to publish that draft later without the web UI.ol doc updatenow takes--publish, which setspublish: trueondocuments.update, the same waydoc createdoes. It works on its own (ol doc update <id> --publish), leaving the title and text untouched, and the output saysPublished:instead ofUpdated:.Drafts created in the web UI can have no collection, and Outline won't publish those without a
collectionId. For them,--collection <ref>names the collection to publish into, resolved like the other collection options. Outline ignorescollectionIdon update unless publishing, so--collectionwithout--publishstops with an error instead of doing nothing. The README and the skill list both forms.Tested:
npm test(236 passing, with tests that--publishsends only{ id, publish: true }, that--collectionsends the resolvedcollectionId, and that--collectionalone errors before any API call), type-check, lint, format and the skill sync check. Against self-hosted Outline 1.11.0:doc update <draft> --publishpublishes a CLI-created draft with its title and text unchanged, and a plaindoc updateleaves a draft unpublished. A draft created without a collection fails withcollectionId is required to publish a draft without collectionon--publishalone, and--publish --collection <ref>publishes it into that collection.