@abraca/cli 2.3.0 → 2.5.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abraca/cli",
3
- "version": "2.3.0",
3
+ "version": "2.5.0",
4
4
  "description": "CLI for Abracadabra — interact with CRDT document workspaces from the terminal",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -39,6 +39,6 @@
39
39
  "yjs": "^13.6.8"
40
40
  },
41
41
  "devDependencies": {
42
- "@abraca/dabra": "2.3.0"
42
+ "@abraca/dabra": "2.5.0"
43
43
  }
44
44
  }
@@ -57,7 +57,7 @@ registerCommand({
57
57
  const fragment = doc.getXmlFragment('default')
58
58
 
59
59
  // Read existing, prepend, rewrite
60
- const { markdown: existing } = yjsToMarkdown(fragment)
60
+ const existing = yjsToMarkdown(fragment, '')
61
61
  const text = content.replace(/\\n/g, '\n').replace(/\\t/g, '\t')
62
62
  const combined = args.flags.has('inline')
63
63
  ? text + existing
@@ -91,7 +91,7 @@ registerCommand({
91
91
  try {
92
92
  const provider = await conn.getChildProvider(docId)
93
93
  const fragment = provider.document.getXmlFragment('default')
94
- const { markdown } = yjsToMarkdown(fragment)
94
+ const markdown = yjsToMarkdown(fragment, '')
95
95
 
96
96
  const words = markdown.split(/\s+/).filter(Boolean).length
97
97
  const chars = markdown.length
@@ -122,7 +122,9 @@ registerCommand({
122
122
  try {
123
123
  const provider = await conn.getChildProvider(docId)
124
124
  const fragment = provider.document.getXmlFragment('default')
125
- const { title, markdown } = yjsToMarkdown(fragment)
125
+ const treeMap = conn.getTreeMap()
126
+ const title = (treeMap?.get(docId) as any)?.label as string | undefined
127
+ const markdown = yjsToMarkdown(fragment, title ?? '')
126
128
 
127
129
  const resolvedPath = path.resolve(outputPath)
128
130
  fs.writeFileSync(resolvedPath, markdown, 'utf-8')
@@ -74,19 +74,19 @@ registerCommand({
74
74
  try {
75
75
  const provider = await conn.getChildProvider(docId)
76
76
  const fragment = provider.document.getXmlFragment('default')
77
- const { title, markdown } = yjsToMarkdown(fragment)
77
+ const markdown = yjsToMarkdown(fragment, '')
78
78
 
79
79
  if (args.flags.has('json') || args.params['format'] === 'json') {
80
80
  // Include tree metadata + children
81
81
  const treeMap = conn.getTreeMap()
82
- let label = title
82
+ let label = ''
83
83
  let type: string | undefined
84
84
  let meta: Record<string, unknown> | undefined
85
85
  let children: Array<{ id: string; label: string; type?: string }> = []
86
86
  if (treeMap) {
87
87
  const entry = treeMap.get(docId)
88
88
  if (entry) {
89
- label = entry.label || title
89
+ label = entry.label || label
90
90
  type = entry.type
91
91
  meta = entry.meta
92
92
  }