stigmergy 1.0.68 → 1.0.70
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.en.md +306 -300
- package/README.md +469 -301
- package/package.json +97 -81
- package/scripts/publish.js +268 -0
- package/scripts/simple-publish.js +59 -0
- package/src/index.js +12 -0
- package/test/enhanced-main-alignment.test.js +298 -0
- package/test/hook-system-integration-test.js +307 -0
- package/test/natural-language-skills-test.js +320 -0
- package/test/nl-integration-test.js +179 -0
- package/test/parameter-parsing-test.js +143 -0
- package/test/real-test.js +435 -0
- package/test/system-compatibility-test.js +447 -0
- package/test/tdd-fixes-test.js +211 -0
- package/test/third-party-skills-test.js +321 -0
- package/test/tool-selection-integration-test.js +157 -0
- package/test/unit/cli-scanner.test.js +291 -0
- package/test/unit/cross-cli-executor.test.js +399 -0
- package/src/adapters/claude/__init__.py +0 -13
- package/src/adapters/claude/claude_skills_integration.py +0 -609
- package/src/adapters/claude/hook_adapter.py +0 -663
- package/src/adapters/claude/install_claude_integration.py +0 -265
- package/src/adapters/claude/skills_hook_adapter.py +0 -841
- package/src/adapters/claude/standalone_claude_adapter.py +0 -384
- package/src/adapters/cline/__init__.py +0 -20
- package/src/adapters/cline/config.py +0 -108
- package/src/adapters/cline/install_cline_integration.py +0 -617
- package/src/adapters/cline/mcp_server.py +0 -713
- package/src/adapters/cline/standalone_cline_adapter.py +0 -459
- package/src/adapters/codebuddy/__init__.py +0 -13
- package/src/adapters/codebuddy/buddy_adapter.py +0 -1125
- package/src/adapters/codebuddy/install_codebuddy_integration.py +0 -279
- package/src/adapters/codebuddy/skills_hook_adapter.py +0 -672
- package/src/adapters/codebuddy/skills_integration.py +0 -395
- package/src/adapters/codebuddy/standalone_codebuddy_adapter.py +0 -403
- package/src/adapters/codex/__init__.py +0 -11
- package/src/adapters/codex/base.py +0 -46
- package/src/adapters/codex/install_codex_integration.py +0 -311
- package/src/adapters/codex/mcp_server.py +0 -493
- package/src/adapters/codex/natural_language_parser.py +0 -82
- package/src/adapters/codex/slash_command_adapter.py +0 -326
- package/src/adapters/codex/standalone_codex_adapter.py +0 -362
- package/src/adapters/copilot/__init__.py +0 -13
- package/src/adapters/copilot/install_copilot_integration.py +0 -564
- package/src/adapters/copilot/mcp_adapter.py +0 -772
- package/src/adapters/copilot/mcp_server.py +0 -168
- package/src/adapters/copilot/standalone_copilot_adapter.py +0 -114
- package/src/adapters/gemini/__init__.py +0 -13
- package/src/adapters/gemini/extension_adapter.py +0 -690
- package/src/adapters/gemini/install_gemini_integration.py +0 -257
- package/src/adapters/gemini/standalone_gemini_adapter.py +0 -366
- package/src/adapters/iflow/__init__.py +0 -7
- package/src/adapters/iflow/hook_adapter.py +0 -1038
- package/src/adapters/iflow/hook_installer.py +0 -536
- package/src/adapters/iflow/install_iflow_integration.py +0 -271
- package/src/adapters/iflow/official_hook_adapter.py +0 -1272
- package/src/adapters/iflow/standalone_iflow_adapter.py +0 -48
- package/src/adapters/iflow/workflow_adapter.py +0 -793
- package/src/adapters/qoder/hook_installer.py +0 -732
- package/src/adapters/qoder/install_qoder_integration.py +0 -265
- package/src/adapters/qoder/notification_hook_adapter.py +0 -863
- package/src/adapters/qoder/standalone_qoder_adapter.py +0 -48
- package/src/adapters/qwen/__init__.py +0 -17
- package/src/adapters/qwencode/__init__.py +0 -13
- package/src/adapters/qwencode/inheritance_adapter.py +0 -818
- package/src/adapters/qwencode/install_qwencode_integration.py +0 -276
- package/src/adapters/qwencode/standalone_qwencode_adapter.py +0 -399
- package/src/atomic_collaboration_handler.py +0 -461
- package/src/cli_collaboration_agent.py +0 -697
- package/src/collaboration/hooks.py +0 -315
- package/src/core/__init__.py +0 -21
- package/src/core/ai_environment_scanner.py +0 -331
- package/src/core/base_adapter.py +0 -220
- package/src/core/cli_hook_integration.py +0 -406
- package/src/core/cross_cli_executor.py +0 -713
- package/src/core/cross_cli_mapping.py +0 -1165
- package/src/core/cross_platform_encoding.py +0 -365
- package/src/core/cross_platform_safe_cli.py +0 -894
- package/src/core/direct_cli_executor.py +0 -805
- package/src/core/direct_cli_hook_system.py +0 -958
- package/src/core/enhanced_init_processor.py +0 -467
- package/src/core/graceful_cli_executor.py +0 -912
- package/src/core/md_enhancer.py +0 -342
- package/src/core/md_generator.py +0 -619
- package/src/core/models.py +0 -218
- package/src/core/parser.py +0 -108
- package/src/core/real_cli_hook_system.py +0 -852
- package/src/core/real_cross_cli_system.py +0 -925
- package/src/core/verified_cross_cli_system.py +0 -961
- package/src/deploy.js +0 -737
- package/src/enhanced-main.js +0 -626
- package/src/enhanced_deploy.js +0 -303
- package/src/enhanced_universal_cli_setup.py +0 -930
- package/src/kimi_wrapper.py +0 -104
- package/src/main.js +0 -1309
- package/src/shell_integration.py +0 -398
- package/src/simple-main.js +0 -315
- package/src/smart_router_creator.py +0 -323
- package/src/universal_cli_setup.py +0 -1289
- package/src/utils/__init__.py +0 -12
- package/src/utils/cli_detector.py +0 -445
- package/src/utils/file_utils.py +0 -246
package/src/core/md_enhancer.py
DELETED
|
@@ -1,342 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
MD Document Enhancer - MD文档增强器
|
|
3
|
-
为现有MD文档添加协作感知章节
|
|
4
|
-
"""
|
|
5
|
-
import re
|
|
6
|
-
import asyncio
|
|
7
|
-
from pathlib import Path
|
|
8
|
-
from datetime import datetime
|
|
9
|
-
from typing import List, Dict, Optional, Tuple
|
|
10
|
-
|
|
11
|
-
from .models import (
|
|
12
|
-
CLIInfo, AIEnvironmentInfo, CollaborationGuide,
|
|
13
|
-
MarkdownSection, EnhancementResult, CLI_CONFIG_MAPPING
|
|
14
|
-
)
|
|
15
|
-
|
|
16
|
-
import logging
|
|
17
|
-
logger = logging.getLogger(__name__)
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
class MDDocumentEnhancer:
|
|
21
|
-
"""MD文档增强器 - 为现有MD文档添加协作感知"""
|
|
22
|
-
|
|
23
|
-
def __init__(self):
|
|
24
|
-
self.collaboration_keywords = [
|
|
25
|
-
"协作", "collaboration", "AI工具", "跨AI", "协同",
|
|
26
|
-
"cooperation", "ai tools", "cross-ai", "synergy"
|
|
27
|
-
]
|
|
28
|
-
|
|
29
|
-
async def enhance_existing_md(self,
|
|
30
|
-
existing_content: str,
|
|
31
|
-
collaboration_content: str,
|
|
32
|
-
cli_name: str) -> str:
|
|
33
|
-
"""增强现有MD文档"""
|
|
34
|
-
try:
|
|
35
|
-
# 解析现有文档结构
|
|
36
|
-
doc_structure = self._parse_markdown_structure(existing_content)
|
|
37
|
-
|
|
38
|
-
# 检查是否已存在协作相关章节
|
|
39
|
-
has_collaboration = self._has_collaboration_section(doc_structure)
|
|
40
|
-
|
|
41
|
-
if has_collaboration:
|
|
42
|
-
logger.info(f"文档 {cli_name}.md 已存在协作章节,将更新内容")
|
|
43
|
-
# 更新现有协作章节
|
|
44
|
-
return await self._update_collaboration_section(existing_content, collaboration_content)
|
|
45
|
-
else:
|
|
46
|
-
logger.info(f"文档 {cli_name}.md 不存在协作章节,将添加新章节")
|
|
47
|
-
# 添加新的协作章节
|
|
48
|
-
return await self._add_collaboration_section(existing_content, collaboration_content, cli_name)
|
|
49
|
-
|
|
50
|
-
except Exception as e:
|
|
51
|
-
logger.error(f"增强MD文档失败: {e}")
|
|
52
|
-
# 如果增强失败,返回原内容
|
|
53
|
-
return existing_content
|
|
54
|
-
|
|
55
|
-
async def generate_collaboration_section(self,
|
|
56
|
-
cli_name: str,
|
|
57
|
-
ai_environment: AIEnvironmentInfo,
|
|
58
|
-
current_cli: str) -> str:
|
|
59
|
-
"""生成协作感知章节内容"""
|
|
60
|
-
try:
|
|
61
|
-
# 获取当前CLI信息
|
|
62
|
-
current_cli_info = ai_environment.available_clis.get(cli_name)
|
|
63
|
-
if not current_cli_info:
|
|
64
|
-
logger.warning(f"未找到CLI工具 {cli_name} 的信息")
|
|
65
|
-
return ""
|
|
66
|
-
|
|
67
|
-
# 获取可协作的其他CLI工具
|
|
68
|
-
peer_clis = ai_environment.collaboration_guide.available_peers
|
|
69
|
-
|
|
70
|
-
collaboration_section = f"""
|
|
71
|
-
|
|
72
|
-
## 🤝 AI工具协作指南
|
|
73
|
-
|
|
74
|
-
> 📅 协作配置更新时间: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}
|
|
75
|
-
> 🔧 由 {current_cli.upper()} 工具增强
|
|
76
|
-
|
|
77
|
-
### 🎯 本项目可用的AI CLI工具
|
|
78
|
-
|
|
79
|
-
**当前工具**: **{current_cli_info.display_name}** v{current_cli_info.version}
|
|
80
|
-
- 集成类型: {self._get_integration_type_display(current_cli_info.integration_type)}
|
|
81
|
-
- 配置文件: `{current_cli_info.config_file}`
|
|
82
|
-
- 状态: {self._get_status_display(current_cli_info.status)}
|
|
83
|
-
|
|
84
|
-
**🔄 可协作工具**:
|
|
85
|
-
"""
|
|
86
|
-
|
|
87
|
-
# 添加可协作工具列表
|
|
88
|
-
for peer_name, peer_info in peer_clis.items():
|
|
89
|
-
status_emoji = "✅" if peer_info.status.value == "available" else "❌"
|
|
90
|
-
capabilities = ", ".join(peer_info.capabilities[:3]) # 只显示前3个能力
|
|
91
|
-
if len(peer_info.capabilities) > 3:
|
|
92
|
-
capabilities += f" 等{len(peer_info.capabilities)}项能力"
|
|
93
|
-
|
|
94
|
-
collaboration_section += f"""
|
|
95
|
-
- **{peer_info.display_name}** v{peer_info.version} - {self._get_integration_type_display(peer_info.integration_type)} {status_emoji}
|
|
96
|
-
- 能力: {capabilities}
|
|
97
|
-
- 配置: `{peer_info.config_file}`
|
|
98
|
-
"""
|
|
99
|
-
|
|
100
|
-
# 添加协作协议
|
|
101
|
-
collaboration_section += f"""
|
|
102
|
-
|
|
103
|
-
### 🔄 跨AI协作指令模板
|
|
104
|
-
|
|
105
|
-
**中文协作指令**:
|
|
106
|
-
"""
|
|
107
|
-
for protocol in ai_environment.collaboration_guide.protocols.get("chinese", [])[:5]:
|
|
108
|
-
example = self._generate_protocol_example(protocol, list(peer_clis.keys())[:2])
|
|
109
|
-
collaboration_section += f"- `{example}`\n"
|
|
110
|
-
|
|
111
|
-
collaboration_section += """
|
|
112
|
-
**英文协作指令**:
|
|
113
|
-
"""
|
|
114
|
-
for protocol in ai_environment.collaboration_guide.protocols.get("english", [])[:5]:
|
|
115
|
-
example = self._generate_protocol_example(protocol, list(peer_clis.keys())[:2])
|
|
116
|
-
collaboration_section += f"- `{example}`\n"
|
|
117
|
-
|
|
118
|
-
# 添加协作示例
|
|
119
|
-
collaboration_section += f"""
|
|
120
|
-
|
|
121
|
-
### 🎨 协作场景示例
|
|
122
|
-
|
|
123
|
-
基于当前项目特点和可用AI工具,推荐以下协作模式:
|
|
124
|
-
|
|
125
|
-
#### 🔗 代码生成与审查链
|
|
126
|
-
```bash
|
|
127
|
-
# 使用不同工具进行协作开发
|
|
128
|
-
> 请用qwen帮我生成用户认证模块
|
|
129
|
-
> 调用gemini审查代码安全性
|
|
130
|
-
> 用claude分析架构设计
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
#### 🔄 工作流自动化
|
|
134
|
-
```bash
|
|
135
|
-
# 创建自动化流程
|
|
136
|
-
> 用iflow创建测试工作流
|
|
137
|
-
> 让qwen生成部署脚本
|
|
138
|
-
> 调用gemini优化性能
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
#### 📊 数据分析协作
|
|
142
|
-
```bash
|
|
143
|
-
# 数据处理和分析
|
|
144
|
-
> 请用qwen处理这个数据集
|
|
145
|
-
> 用gemini分析关键趋势
|
|
146
|
-
> 调用claude生成报告
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
#### 🎯 问题解决链
|
|
150
|
-
```bash
|
|
151
|
-
# 复杂问题协作解决
|
|
152
|
-
> 请用claude分析这个问题
|
|
153
|
-
> 调用gemini提供解决方案
|
|
154
|
-
> 用qwen实现修复代码
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
#### 🛠️ 项目维护协作
|
|
158
|
-
```bash
|
|
159
|
-
# 项目维护和优化
|
|
160
|
-
> 用iflow创建更新工作流
|
|
161
|
-
> 请用qwen重构老旧模块
|
|
162
|
-
> 调用gemini进行性能优化
|
|
163
|
-
"""
|
|
164
|
-
|
|
165
|
-
# 添加协作技巧和最佳实践
|
|
166
|
-
collaboration_section += f"""
|
|
167
|
-
|
|
168
|
-
### 💡 协作技巧与最佳实践
|
|
169
|
-
|
|
170
|
-
1. **上下文保持**: 跨工具调用时,提供充分的上下文信息
|
|
171
|
-
2. **任务分解**: 将复杂任务分解为不同工具的专长领域
|
|
172
|
-
3. **结果验证**: 使用不同工具交叉验证重要结果
|
|
173
|
-
4. **版本控制**: 为重要的协作结果建立版本记录
|
|
174
|
-
|
|
175
|
-
### ⚠️ 重要提示
|
|
176
|
-
|
|
177
|
-
- **当前激活工具**: {current_cli_info.display_name} (您正在使用的工具)
|
|
178
|
-
- **协作感知**: 本文档已启用跨AI工具协作感知
|
|
179
|
-
- **动态更新**: 协作配置会随AI环境变化自动更新
|
|
180
|
-
- **工具状态**: 协作前请确认目标工具的可用状态
|
|
181
|
-
|
|
182
|
-
### 🔧 故障排除
|
|
183
|
-
|
|
184
|
-
如果跨AI工具协作遇到问题:
|
|
185
|
-
|
|
186
|
-
1. **检查工具可用性**: 确认目标CLI工具已正确安装
|
|
187
|
-
2. **验证配置文件**: 检查配置文件是否存在且格式正确
|
|
188
|
-
3. **网络连接**: 某些协作可能需要网络连接
|
|
189
|
-
4. **权限设置**: 确认工具具有执行相应任务的权限
|
|
190
|
-
5. **查看日志**: 检查各CLI工具的日志文件
|
|
191
|
-
|
|
192
|
-
### 📚 相关文档
|
|
193
|
-
|
|
194
|
-
- 项目AI环境配置: `.ai-cli-unified/config.json`
|
|
195
|
-
- 全局CLI配置: `~/.ai-cli-unified/global-config.json`
|
|
196
|
-
- 协作协议文档: [协作协议详细说明]
|
|
197
|
-
|
|
198
|
-
---
|
|
199
|
-
*📌 协作感知由 AI CLI Router 在 {datetime.now().isoformat()} 自动增强*
|
|
200
|
-
*🔄 支持的工具: {', '.join([info.display_name for info in ai_environment.available_clis.values()])}*
|
|
201
|
-
"""
|
|
202
|
-
|
|
203
|
-
return collaboration_section
|
|
204
|
-
|
|
205
|
-
except Exception as e:
|
|
206
|
-
logger.error(f"生成协作章节失败: {e}")
|
|
207
|
-
return f"\n\n## 🤝 协作指南\n\n协作功能暂时不可用: {str(e)}\n"
|
|
208
|
-
|
|
209
|
-
def _parse_markdown_structure(self, content: str) -> List[MarkdownSection]:
|
|
210
|
-
"""解析Markdown文档结构"""
|
|
211
|
-
sections = []
|
|
212
|
-
lines = content.split('\n')
|
|
213
|
-
current_section = None
|
|
214
|
-
|
|
215
|
-
for line in lines:
|
|
216
|
-
# 检测标题
|
|
217
|
-
if line.strip().startswith('#'):
|
|
218
|
-
if current_section:
|
|
219
|
-
sections.append(current_section)
|
|
220
|
-
|
|
221
|
-
current_section = MarkdownSection(
|
|
222
|
-
title=line.strip(),
|
|
223
|
-
content=[],
|
|
224
|
-
level=len(line) - len(line.lstrip('#'))
|
|
225
|
-
)
|
|
226
|
-
elif current_section:
|
|
227
|
-
current_section.content.append(line)
|
|
228
|
-
|
|
229
|
-
if current_section:
|
|
230
|
-
sections.append(current_section)
|
|
231
|
-
|
|
232
|
-
return sections
|
|
233
|
-
|
|
234
|
-
def _has_collaboration_section(self, sections: List[MarkdownSection]) -> bool:
|
|
235
|
-
"""检查是否已存在协作章节"""
|
|
236
|
-
for section in sections:
|
|
237
|
-
title_lower = section.title.lower()
|
|
238
|
-
if any(keyword in title_lower for keyword in self.collaboration_keywords):
|
|
239
|
-
return True
|
|
240
|
-
return False
|
|
241
|
-
|
|
242
|
-
async def _update_collaboration_section(self, existing_content: str, new_collaboration_content: str) -> str:
|
|
243
|
-
"""更新现有协作章节"""
|
|
244
|
-
try:
|
|
245
|
-
# 找到协作章节的起始位置
|
|
246
|
-
lines = existing_content.split('\n')
|
|
247
|
-
collaboration_start = -1
|
|
248
|
-
collaboration_end = -1
|
|
249
|
-
|
|
250
|
-
for i, line in enumerate(lines):
|
|
251
|
-
if collaboration_start == -1:
|
|
252
|
-
# 寻找协作章节开始
|
|
253
|
-
if any(keyword in line.lower() for keyword in self.collaboration_keywords) and line.strip().startswith('#'):
|
|
254
|
-
collaboration_start = i
|
|
255
|
-
else:
|
|
256
|
-
# 寻找协作章节结束(下一个同级或更高级标题)
|
|
257
|
-
if line.strip().startswith('#'):
|
|
258
|
-
current_level = len(line) - len(line.lstrip('#'))
|
|
259
|
-
# 找到协作章节的级别
|
|
260
|
-
collaboration_level = len(lines[collaboration_start]) - len(lines[collaboration_start].lstrip('#'))
|
|
261
|
-
|
|
262
|
-
if current_level <= collaboration_level:
|
|
263
|
-
collaboration_end = i
|
|
264
|
-
break
|
|
265
|
-
|
|
266
|
-
# 如果找到了协作章节,替换它
|
|
267
|
-
if collaboration_start != -1:
|
|
268
|
-
if collaboration_end == -1:
|
|
269
|
-
# 协作章节在文档末尾
|
|
270
|
-
new_content = lines[:collaboration_start] + [new_collaboration_content.strip()]
|
|
271
|
-
else:
|
|
272
|
-
# 协作章节在文档中间
|
|
273
|
-
new_content = lines[:collaboration_start] + [new_collaboration_content.strip()] + lines[collaboration_end:]
|
|
274
|
-
|
|
275
|
-
return '\n'.join(new_content)
|
|
276
|
-
else:
|
|
277
|
-
# 没找到协作章节,添加到文档末尾
|
|
278
|
-
return existing_content + new_collaboration_content
|
|
279
|
-
|
|
280
|
-
except Exception as e:
|
|
281
|
-
logger.error(f"更新协作章节失败: {e}")
|
|
282
|
-
return existing_content + new_collaboration_content
|
|
283
|
-
|
|
284
|
-
async def _add_collaboration_section(self, existing_content: str, collaboration_content: str, cli_name: str) -> str:
|
|
285
|
-
"""添加新的协作章节"""
|
|
286
|
-
# 在文档末尾添加协作章节
|
|
287
|
-
if not existing_content.endswith('\n'):
|
|
288
|
-
existing_content += '\n'
|
|
289
|
-
|
|
290
|
-
return existing_content + collaboration_content
|
|
291
|
-
|
|
292
|
-
def _generate_protocol_example(self, protocol: str, peer_clis: List[str]) -> str:
|
|
293
|
-
"""生成协议示例"""
|
|
294
|
-
if not peer_clis:
|
|
295
|
-
return protocol.replace('{cli}', '工具名').replace('{task}', '任务')
|
|
296
|
-
|
|
297
|
-
peer_cli = peer_clis[0] # 使用第一个可用的CLI作为示例
|
|
298
|
-
example_tasks = {
|
|
299
|
-
"qwen": ["生成代码", "重构函数", "编写测试", "优化算法"],
|
|
300
|
-
"gemini": ["分析性能", "优化查询", "数据可视化", "安全审查"],
|
|
301
|
-
"claude": ["架构设计", "代码审查", "需求分析", "文档编写"],
|
|
302
|
-
"iflow": ["创建工作流", "自动化部署", "持续集成", "流程优化"]
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
tasks = example_tasks.get(peer_cli, ["执行任务"])
|
|
306
|
-
task = tasks[0] if tasks else "执行任务"
|
|
307
|
-
|
|
308
|
-
return protocol.replace('{cli}', peer_cli).replace('{task}', task)
|
|
309
|
-
|
|
310
|
-
def _get_integration_type_display(self, integration_type) -> str:
|
|
311
|
-
"""获取集成类型的显示名称"""
|
|
312
|
-
type_names = {
|
|
313
|
-
"hook_system": "钩子系统",
|
|
314
|
-
"extension_system": "扩展系统",
|
|
315
|
-
"class_inheritance": "类继承",
|
|
316
|
-
"workflow_pipeline": "工作流流水线",
|
|
317
|
-
"notification_hook": "通知钩子",
|
|
318
|
-
"mcp_server": "MCP服务器",
|
|
319
|
-
"slash_command": "斜杠命令"
|
|
320
|
-
}
|
|
321
|
-
return type_names.get(integration_type.value, integration_type.value)
|
|
322
|
-
|
|
323
|
-
def _get_status_display(self, status) -> str:
|
|
324
|
-
"""获取状态的显示名称"""
|
|
325
|
-
status_names = {
|
|
326
|
-
"available": "✅ 可用",
|
|
327
|
-
"unavailable": "❌ 不可用",
|
|
328
|
-
"version_incompatible": "⚠️ 版本不兼容",
|
|
329
|
-
"config_missing": "⚠️ 配置缺失"
|
|
330
|
-
}
|
|
331
|
-
return status_names.get(status.value, status.value)
|
|
332
|
-
|
|
333
|
-
def _extract_sections(self, content: str) -> List[str]:
|
|
334
|
-
"""提取文档中的所有章节标题"""
|
|
335
|
-
sections = []
|
|
336
|
-
lines = content.split('\n')
|
|
337
|
-
|
|
338
|
-
for line in lines:
|
|
339
|
-
if line.strip().startswith('#'):
|
|
340
|
-
sections.append(line.strip())
|
|
341
|
-
|
|
342
|
-
return sections
|