@workover/cli 0.3.0 → 0.4.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
@@ -69,7 +69,19 @@ workover doc write 1234 --file rewritten.md --note "as discussed"
69
69
  ```
70
70
 
71
71
  `doc write` **replaces the whole body**, so pass the complete document — anything you leave out is
72
- deleted. Read it first with `workover doc read`. It needs a token from `workover login --write`;
72
+ deleted. Read it first with `workover doc read`, which returns the LIVE body from the editor's own
73
+ room, images included:
74
+
75
+ ```sh
76
+ workover doc read 1234 > body.md # images come back as ![alt](url)
77
+ $EDITOR body.md
78
+ workover doc write 1234 --file body.md --note "tightened the intro"
79
+ ```
80
+
81
+ The image URLs round-trip, so editing one paragraph and writing the file back keeps every picture.
82
+ This matters more than it sounds: a document that is *only* screenshots has no plain text at all, so
83
+ anything reading the stored row sees an empty page — and "empty page" plus "replace the whole body"
84
+ is how images get deleted by something that thought it was filling in a blank. It needs a token from `workover login --write`;
73
85
  without that scope it is refused and `doc propose` is the way through. Every direct edit is recorded
74
86
  in the workspace's audit log, since unlike a proposal it leaves no review trail of its own.
75
87
 
package/bin/workover.mjs CHANGED
@@ -628,10 +628,27 @@ async function docCommand() {
628
628
  console.error(`\n ✗ Document ${docId} not found (or no access).\n`);
629
629
  process.exit(1);
630
630
  }
631
- if (asJson) return console.log(JSON.stringify(doc, null, 2));
632
- if (flags.html === true) return console.log(doc.content || '');
631
+ // The LIVE body, from the collab room, with images kept at their real URLs.
632
+ //
633
+ // The document row is not the document. Its `content` is only written on a WordPress import and
634
+ // its `bodyText` is plain text for search, so a page written in the editor used to read as
635
+ // empty here — and one made of screenshots read as empty EXACTLY, because plain text of an
636
+ // image is nothing. Reading nothing and then calling `doc write`, which replaces the whole
637
+ // body, is how an agent deletes somebody's images while believing the page was blank.
638
+ //
639
+ // Best-effort: an older api has no such route, and collab can be unconfigured. Fall back to
640
+ // what the row holds rather than failing to print anything.
641
+ let live = null;
642
+ try {
643
+ live = await authedCall(cfg, `/project/doc/${docId}/content`);
644
+ } catch {
645
+ live = null;
646
+ }
647
+
648
+ if (asJson) return console.log(JSON.stringify(live ? { ...doc, ...live } : doc, null, 2));
649
+ if (flags.html === true) return console.log(live?.html || doc.content || '');
633
650
  console.log(`\n# ${doc.title || 'Untitled'} (id ${doc.id})\n`);
634
- console.log(documentText(doc) || '(empty document)');
651
+ console.log(live?.markdown?.trim() || documentText(doc) || '(empty document)');
635
652
  console.log('');
636
653
  return;
637
654
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workover/cli",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Workover command line — sign in and cowork on your documents from the terminal.",
5
5
  "license": "UNLICENSED",
6
6
  "author": "ScaleMath",