@khanglvm/outline-cli 0.2.1 → 0.2.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.2 - 2026-07-30
4
+
5
+ - Changes since `v0.2.1`.
6
+ - Normalize Outline comment line breaks (6326791)
7
+
3
8
  ## 0.2.1 - 2026-07-21
4
9
 
5
10
  - Changes since `v0.2.0`.
package/README.md CHANGED
@@ -241,7 +241,9 @@ Create a comment directly from a remembered document title. Pass plain/markdown
241
241
  `text` (the ProseMirror `data` doc is built for you) and an optional `mentions`
242
242
  list of names, emails, or userIds. Names match on **first name**, so Jira-order
243
243
  `"Tran Le Quan"` resolves to Outline's `"Quan, Tran Le"`. The comment text is
244
- capped at 1000 characters (checked pre-flight). `comments.post` is an alias.
244
+ capped at 1000 characters (checked pre-flight). Actual newlines and doubly
245
+ escaped `\n`/`\r\n` sequences are normalized into ProseMirror hard breaks, so
246
+ comments never display a literal `\n`. `comments.post` is an alias.
245
247
 
246
248
  ```bash
247
249
  # simple comment
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@khanglvm/outline-cli",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "Agent-optimized CLI for Outline API",
5
5
  "type": "module",
6
6
  "bin": {
@@ -3,8 +3,8 @@ export const ENTRY_INTEGRITY_MANIFEST = Object.freeze({
3
3
  version: 1,
4
4
  algorithm: "sha256",
5
5
  signatureAlgorithm: "sha256-salted-manifest-v1",
6
- signature: "c282b3ac3eb71f8543fc1666f780d828853b310203f4fe80f02a5c22cdb925a3",
7
- generatedAt: "2026-07-21T09:09:21.194Z",
6
+ signature: "3e3aff281deb7b640b1a678cb57ec5b9fc1647df006e45a24889cb26d49732bf",
7
+ generatedAt: "2026-07-30T08:04:26.287Z",
8
8
  files: [
9
9
  {
10
10
  "path": "src/action-gate.js",
@@ -56,7 +56,7 @@ export const ENTRY_INTEGRITY_MANIFEST = Object.freeze({
56
56
  },
57
57
  {
58
58
  "path": "src/tools.extended.js",
59
- "sha256": "acbd8f5b297c4d4c08e913a710230879e63a230886592823b716bdb5b5cca52d"
59
+ "sha256": "ef4be3189009af8f2aa0483d377987e10c457b65c1ee8f48f9a8217d6bceef39"
60
60
  },
61
61
  {
62
62
  "path": "src/tools.js",
@@ -1023,6 +1023,15 @@ async function resolveAccessId(ctx, args = {}, input) {
1023
1023
 
1024
1024
  const COMMENT_TEXT_LIMIT = 1000;
1025
1025
 
1026
+ function normalizeCommentText(text) {
1027
+ return String(text == null ? "" : text)
1028
+ .replace(/\r\n?/g, "\n")
1029
+ // Agents sometimes pass a doubly escaped JSON/shell body. Normalize those
1030
+ // sequences before building ProseMirror nodes so Outline renders a hard
1031
+ // break instead of showing the characters "\n".
1032
+ .replace(/\\r\\n|\\n|\\r/g, "\n");
1033
+ }
1034
+
1026
1035
  function commentTextNode(text) {
1027
1036
  return { type: "text", text };
1028
1037
  }
@@ -1043,7 +1052,7 @@ function commentMentionNode({ userId, label }) {
1043
1052
  // Split plain/markdown text into paragraphs on blank lines, and keep single
1044
1053
  // newlines as hard breaks inside a paragraph (mirrors how a human pastes text).
1045
1054
  function splitCommentParagraphs(text) {
1046
- const normalized = String(text == null ? "" : text).replace(/\r\n?/g, "\n");
1055
+ const normalized = normalizeCommentText(text);
1047
1056
  const blocks = normalized.split(/\n{2,}/);
1048
1057
  const paragraphs = [];
1049
1058
  for (const block of blocks) {
@@ -1104,7 +1113,7 @@ function buildCommentData(text, resolvedMentions = []) {
1104
1113
  // Character count of the human-readable comment text (mention labels count as
1105
1114
  // "@label", matching how Outline measures the 1000-char limit on the data doc).
1106
1115
  function commentTextLength(text, resolvedMentions = []) {
1107
- const textLen = String(text == null ? "" : text).length;
1116
+ const textLen = normalizeCommentText(text).length;
1108
1117
  const mentionLen = resolvedMentions.reduce(
1109
1118
  (sum, mention) => sum + 1 + String(mention.label || "user").length + 1,
1110
1119
  0
@@ -1272,7 +1281,7 @@ async function resolveMentions(ctx, mentions, { maxAttempts } = {}) {
1272
1281
  // the ProseMirror `data` doc from `text` + `mentions`, enforces the 1000-char
1273
1282
  // limit, and strips the convenience-only keys from the outgoing body.
1274
1283
  async function prepareCommentBody(ctx, def, args, bodyArgs) {
1275
- const text = typeof bodyArgs.text === "string" ? bodyArgs.text : "";
1284
+ const text = typeof bodyArgs.text === "string" ? normalizeCommentText(bodyArgs.text) : "";
1276
1285
  const hasMentions = Array.isArray(args.mentions) && args.mentions.length > 0;
1277
1286
  const hasExplicitData = bodyArgs.data !== undefined && bodyArgs.data !== null;
1278
1287
 
@@ -1690,7 +1699,7 @@ const RPC_WRAPPER_DEFS = [
1690
1699
  },
1691
1700
  },
1692
1701
  bestPractices: [
1693
- "Pass plain/markdown `text`; the ProseMirror `data` doc is built for you (blank lines split paragraphs, single newlines become line breaks).",
1702
+ "Pass plain/markdown `text`; the ProseMirror `data` doc is built for you (blank lines split paragraphs, while real or doubly escaped newlines become hard breaks instead of visible \\\\n text).",
1694
1703
  "Pass `mentions` as a list of names, emails, or userIds; names match on FIRST NAME (e.g. \"Tran Le Quan\" matches Outline's \"Quan, Tran Le\"). Ambiguous names are rejected with candidates — disambiguate with an email or userId.",
1695
1704
  "Comment text is capped at 1000 characters (pre-flight check on text, not JSON).",
1696
1705
  "Pass query/refs/url/urlId to comment on a remembered document without a separate lookup.",
@@ -1726,7 +1735,7 @@ const RPC_WRAPPER_DEFS = [
1726
1735
  },
1727
1736
  },
1728
1737
  bestPractices: [
1729
- "Same as comments.create: simple `text` + `mentions` (names/emails/userIds), 1000-char limit, parentCommentId for replies.",
1738
+ "Same as comments.create: simple `text` + `mentions` (names/emails/userIds), real or doubly escaped newlines render as hard breaks, 1000-char limit, parentCommentId for replies.",
1730
1739
  "Names resolve on FIRST NAME + email; ambiguous names error with candidates.",
1731
1740
  "This tool is action-gated; set performAction=true only for explicitly confirmed mutations.",
1732
1741
  ],
@@ -5761,6 +5770,7 @@ async function federatedPermissionSnapshotTool(ctx, args = {}) {
5761
5770
  // without hitting the network.
5762
5771
  export const __commentInternals = {
5763
5772
  COMMENT_TEXT_LIMIT,
5773
+ normalizeCommentText,
5764
5774
  buildCommentData,
5765
5775
  commentTextLength,
5766
5776
  splitCommentParagraphs,