listpage_cli 0.0.305 → 0.0.306
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.
|
@@ -50,12 +50,6 @@ async function handleCheckTodoCommand(input, client, fs) {
|
|
|
50
50
|
if (!todoBlock) {
|
|
51
51
|
return (0, command_result_1.commandError)(`未找到第 ${index} 个待办事项 (总数: ${todoItems.length})`, "todo_not_found", 1);
|
|
52
52
|
}
|
|
53
|
-
// 检查是否为 Todo Block (block_type 11 是 Todo)
|
|
54
|
-
if (todoBlock.block_type !== 11) {
|
|
55
|
-
// 如果不是 TODO 类型,可能是文本或其他,视情况处理
|
|
56
|
-
// 这里简单判断,如果不是 TODO 块,可能 index 指向了非 TODO 元素
|
|
57
|
-
console.warn(`警告: 第 ${index} 个子节点类型为 ${todoBlock.block_type},可能不是待办事项。尝试继续操作...`);
|
|
58
|
-
}
|
|
59
53
|
// 3. 检查是否已完成
|
|
60
54
|
if (todoBlock.todo?.style?.done === true) {
|
|
61
55
|
console.log(`待办事项 (ID: ${todoBlock.block_id}) 已经是完成状态。`);
|
|
@@ -65,7 +59,7 @@ async function handleCheckTodoCommand(input, client, fs) {
|
|
|
65
59
|
const todoElements = todoBlock.todo?.elements;
|
|
66
60
|
const firstTextRun = todoElements?.find((e) => e.text_run)?.text_run;
|
|
67
61
|
const todoContent = firstTextRun?.content || "";
|
|
68
|
-
console.log(`正在勾选待办事项: "${todoContent}"
|
|
62
|
+
console.log(`正在勾选待办事项: "${todoContent}"`);
|
|
69
63
|
const updateRes = await client.docx.documentBlock.patch({
|
|
70
64
|
path: {
|
|
71
65
|
document_id: docToken,
|
|
@@ -8,20 +8,25 @@ async function handleReadCommand(input, client, fs) {
|
|
|
8
8
|
return (0, command_result_1.commandError)("错误: 请提供飞书文档的 doc_token。用法: listpage_cli lark read <doc_token>", "missing_doc_token", 1);
|
|
9
9
|
}
|
|
10
10
|
console.log(`正在读取飞书文档内容,doc_token: ${docToken}`);
|
|
11
|
-
const response = await client.
|
|
12
|
-
path: {
|
|
13
|
-
document_id: docToken,
|
|
14
|
-
},
|
|
11
|
+
const response = await client.docs.v1.content.get({
|
|
15
12
|
params: {
|
|
16
|
-
|
|
13
|
+
doc_token: docToken,
|
|
14
|
+
doc_type: "docx",
|
|
15
|
+
content_type: "markdown",
|
|
16
|
+
lang: "zh",
|
|
17
17
|
},
|
|
18
18
|
});
|
|
19
19
|
if (response.code !== 0) {
|
|
20
20
|
return (0, command_result_1.commandError)(`读取飞书文档失败,错误码: ${response.code}, 错误信息: ${response.msg}`, "read_doc_failed", 1);
|
|
21
21
|
}
|
|
22
22
|
const docContent = response.data?.content || "";
|
|
23
|
-
const
|
|
24
|
-
fs.
|
|
25
|
-
|
|
23
|
+
const relativePath = `.listpage/lark/${docToken}.md`;
|
|
24
|
+
const absolutePath = fs.resolve(fs.cwd(), relativePath);
|
|
25
|
+
const outputDir = fs.dirname(absolutePath);
|
|
26
|
+
if (!fs.exists(outputDir)) {
|
|
27
|
+
fs.ensureDir(outputDir);
|
|
28
|
+
}
|
|
29
|
+
fs.writeText(absolutePath, docContent);
|
|
30
|
+
console.log(`飞书文档读取成功!内容已保存至: ${relativePath}`);
|
|
26
31
|
return (0, command_result_1.commandOk)();
|
|
27
32
|
}
|
package/package.json
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"react": "^19.2.0",
|
|
14
14
|
"react-dom": "^19.2.0",
|
|
15
|
-
"listpage-next": "~0.0.
|
|
15
|
+
"listpage-next": "~0.0.306",
|
|
16
16
|
"react-router-dom": ">=6.0.0",
|
|
17
17
|
"@ant-design/v5-patch-for-react-19": "~1.0.3",
|
|
18
18
|
"ahooks": "^3.9.5",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"styled-components": "^6.1.19",
|
|
24
24
|
"mobx": "~6.15.0",
|
|
25
25
|
"@ant-design/icons": "~6.0.2",
|
|
26
|
-
"listpage-components": "~0.0.
|
|
26
|
+
"listpage-components": "~0.0.306",
|
|
27
27
|
"lucide-react": "~0.575.0"
|
|
28
28
|
"mobx-react-lite": "~4.1.1"
|
|
29
29
|
},
|