@workover/cli 0.11.0 → 0.11.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.
Files changed (2) hide show
  1. package/bin/workover.mjs +43 -1
  2. package/package.json +1 -1
package/bin/workover.mjs CHANGED
@@ -625,6 +625,32 @@ const printStyleFeedback = (style) => {
625
625
  for (const line of style.summary.split('\n')) console.error(` ${line}`);
626
626
  };
627
627
 
628
+ /**
629
+ * What the api did about a leading `# Title` in the submitted body.
630
+ *
631
+ * Printed rather than swallowed, because the whole reason this mistake recurs is
632
+ * that nothing ever told the writer. A silent fix leaves the agent believing its
633
+ * body was correct and writing the same duplicate heading next time.
634
+ */
635
+ const printTitleHeading = (titleHeading) => {
636
+ if (!titleHeading) return;
637
+ if (titleHeading.removed) {
638
+ console.error(
639
+ `\n Removed the body's opening "# ${titleHeading.removed}": the title IS the H1,`,
640
+ );
641
+ console.error(' so start the body at ## and do not repeat it.');
642
+ }
643
+ if (titleHeading.keptUnmatched) {
644
+ console.error(
645
+ `\n Kept the body's opening "# ${titleHeading.keptUnmatched}" because it is not the`,
646
+ );
647
+ console.error(
648
+ ' title, but the title is already an H1, so that page now has two. Use ## unless',
649
+ );
650
+ console.error(' you meant it.');
651
+ }
652
+ };
653
+
628
654
  const RULES_USAGE = [
629
655
  '',
630
656
  ' Usage: workover rules <command>',
@@ -903,7 +929,21 @@ async function docCommand() {
903
929
 
904
930
  if (asJson) return console.log(JSON.stringify(live ? { ...doc, ...live } : doc, null, 2));
905
931
  if (flags.html === true) return console.log(live?.html || doc.content || '');
906
- console.log(`\n# ${doc.title || 'Untitled'} (id ${doc.id})\n`);
932
+ // The title goes to STDERR, labelled, and deliberately NOT as `# Title`.
933
+ //
934
+ // It used to print as an H1 on stdout immediately above the body, which
935
+ // made it indistinguishable from the body's own first line. In Workover the
936
+ // tab/document title IS the H1, so a body must never contain one — but an
937
+ // agent that reads this output concludes the H1 belongs to the body and
938
+ // writes it back on the next `doc write`, giving the page two. Observed
939
+ // repeatedly on 2026-09-23, and it is the output format teaching it, so no
940
+ // amount of instruction fixes it while the format says otherwise.
941
+ //
942
+ // Same channel and same reasoning as the tabs block below: this is metadata
943
+ // about the document, not part of it, so piping the output to a file gets
944
+ // the body alone.
945
+ console.error(`\n Title: ${doc.title || 'Untitled'} (id ${doc.id})`);
946
+ console.error(' The title IS the H1: start the body at ## and never include one.\n');
907
947
  console.log(live?.markdown?.trim() || documentText(doc) || '(empty document)');
908
948
  // Which tab this was, and that there are others.
909
949
  //
@@ -1003,6 +1043,7 @@ async function docCommand() {
1003
1043
  );
1004
1044
  console.log(' They appear as tracked-change suggestions for a person to accept or reject.');
1005
1045
  if (res?.documentUrl) console.log(` ${res.documentUrl}`);
1046
+ printTitleHeading(res?.titleHeading);
1006
1047
  printStyleFeedback(res?.style);
1007
1048
  console.log('');
1008
1049
  return;
@@ -1033,6 +1074,7 @@ async function docCommand() {
1033
1074
  console.log(` Replaced ${res.replacedCharacters} characters of existing text.`);
1034
1075
  }
1035
1076
  if (res?.documentUrl) console.log(` ${res.documentUrl}`);
1077
+ printTitleHeading(res?.titleHeading);
1036
1078
  printStyleFeedback(res?.style);
1037
1079
  console.log('');
1038
1080
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workover/cli",
3
- "version": "0.11.0",
3
+ "version": "0.11.1",
4
4
  "description": "Workover command line — sign in and cowork on your documents from the terminal.",
5
5
  "license": "UNLICENSED",
6
6
  "author": "ScaleMath",