pi-maestro-flow 0.2.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.
Files changed (179) hide show
  1. package/README.md +124 -0
  2. package/agents/aggregator.md +27 -0
  3. package/agents/cli-explore-agent.md +188 -0
  4. package/agents/cross-role-reviewer.md +171 -0
  5. package/agents/delegate.md +19 -0
  6. package/agents/explorer.md +23 -0
  7. package/agents/impeccable-agent.md +99 -0
  8. package/agents/ralph-executor.md +81 -0
  9. package/agents/reference.md +24 -0
  10. package/agents/role-design-author.md +220 -0
  11. package/agents/team-supervisor.md +143 -0
  12. package/agents/team-worker.md +237 -0
  13. package/agents/ui-design-agent.md +270 -0
  14. package/agents/workflow-analyzer.md +116 -0
  15. package/agents/workflow-codebase-mapper.md +77 -0
  16. package/agents/workflow-collab-planner.md +147 -0
  17. package/agents/workflow-debugger.md +104 -0
  18. package/agents/workflow-executor.md +133 -0
  19. package/agents/workflow-external-researcher.md +86 -0
  20. package/agents/workflow-integration-checker.md +83 -0
  21. package/agents/workflow-nyquist-auditor.md +85 -0
  22. package/agents/workflow-phase-researcher.md +85 -0
  23. package/agents/workflow-plan-checker.md +100 -0
  24. package/agents/workflow-planner.md +200 -0
  25. package/agents/workflow-project-researcher.md +74 -0
  26. package/agents/workflow-research-synthesizer.md +70 -0
  27. package/agents/workflow-reviewer.md +82 -0
  28. package/agents/workflow-roadmapper.md +81 -0
  29. package/agents/workflow-verifier.md +120 -0
  30. package/package.json +58 -0
  31. package/skills/codify-to-knowhow/SKILL.md +167 -0
  32. package/skills/delegation-check/SKILL.md +297 -0
  33. package/skills/domain-add/SKILL.md +75 -0
  34. package/skills/insight-challenge/SKILL.md +226 -0
  35. package/skills/learn-decompose/SKILL.md +124 -0
  36. package/skills/learn-follow/SKILL.md +163 -0
  37. package/skills/learn-investigate/SKILL.md +160 -0
  38. package/skills/learn-second-opinion/SKILL.md +128 -0
  39. package/skills/maestro/SKILL.md +239 -0
  40. package/skills/maestro-amend/SKILL.md +169 -0
  41. package/skills/maestro-analyze/SKILL.md +173 -0
  42. package/skills/maestro-blueprint/SKILL.md +159 -0
  43. package/skills/maestro-brainstorm/SKILL.md +193 -0
  44. package/skills/maestro-collab/SKILL.md +181 -0
  45. package/skills/maestro-companion/SKILL.md +536 -0
  46. package/skills/maestro-composer/SKILL.md +192 -0
  47. package/skills/maestro-execute/SKILL.md +193 -0
  48. package/skills/maestro-fork/SKILL.md +104 -0
  49. package/skills/maestro-grill/SKILL.md +151 -0
  50. package/skills/maestro-guard/SKILL.md +124 -0
  51. package/skills/maestro-help/SKILL.md +328 -0
  52. package/skills/maestro-impeccable/SKILL.md +302 -0
  53. package/skills/maestro-init/SKILL.md +151 -0
  54. package/skills/maestro-merge/SKILL.md +90 -0
  55. package/skills/maestro-milestone-audit/SKILL.md +117 -0
  56. package/skills/maestro-milestone-complete/SKILL.md +133 -0
  57. package/skills/maestro-milestone-release/SKILL.md +131 -0
  58. package/skills/maestro-next/SKILL.md +269 -0
  59. package/skills/maestro-overlay/SKILL.md +203 -0
  60. package/skills/maestro-plan/SKILL.md +194 -0
  61. package/skills/maestro-player/SKILL.md +184 -0
  62. package/skills/maestro-quick/SKILL.md +117 -0
  63. package/skills/maestro-ralph/SKILL.md +905 -0
  64. package/skills/maestro-ralph-cli/SKILL.md +976 -0
  65. package/skills/maestro-ralph-cli-execute/SKILL.md +229 -0
  66. package/skills/maestro-ralph-execute/SKILL.md +409 -0
  67. package/skills/maestro-ralph-v2/SKILL.md +1198 -0
  68. package/skills/maestro-roadmap/SKILL.md +157 -0
  69. package/skills/maestro-swarm-workflow/SKILL.md +272 -0
  70. package/skills/maestro-tools-execute/SKILL.md +143 -0
  71. package/skills/maestro-tools-register/SKILL.md +192 -0
  72. package/skills/maestro-ui-codify/SKILL.md +127 -0
  73. package/skills/maestro-universal-workflow/SKILL.md +622 -0
  74. package/skills/maestro-update/SKILL.md +156 -0
  75. package/skills/manage-codebase-rebuild/SKILL.md +111 -0
  76. package/skills/manage-drift-realign/SKILL.md +159 -0
  77. package/skills/manage-harvest/SKILL.md +121 -0
  78. package/skills/manage-issue/SKILL.md +88 -0
  79. package/skills/manage-issue-discover/SKILL.md +104 -0
  80. package/skills/manage-kg-extractors/SKILL.md +147 -0
  81. package/skills/manage-knowhow/SKILL.md +102 -0
  82. package/skills/manage-knowhow-capture/SKILL.md +109 -0
  83. package/skills/manage-knowledge-audit/SKILL.md +147 -0
  84. package/skills/manage-status/SKILL.md +80 -0
  85. package/skills/manage-wiki/SKILL.md +104 -0
  86. package/skills/odyssey-debug/SKILL.md +344 -0
  87. package/skills/odyssey-improve/SKILL.md +423 -0
  88. package/skills/odyssey-planex/SKILL.md +542 -0
  89. package/skills/odyssey-review-test-fix/SKILL.md +392 -0
  90. package/skills/odyssey-ui/SKILL.md +388 -0
  91. package/skills/prompt-generator/SKILL.md +470 -0
  92. package/skills/quality-auto-test/SKILL.md +168 -0
  93. package/skills/quality-debug/SKILL.md +176 -0
  94. package/skills/quality-refactor/SKILL.md +108 -0
  95. package/skills/quality-retrospective/SKILL.md +134 -0
  96. package/skills/quality-review/SKILL.md +169 -0
  97. package/skills/quality-sync/SKILL.md +90 -0
  98. package/skills/quality-test/SKILL.md +183 -0
  99. package/skills/scholar-anti-ai-writing/SKILL.md +173 -0
  100. package/skills/scholar-anti-ai-writing/references/patterns-chinese.md +242 -0
  101. package/skills/scholar-anti-ai-writing/references/patterns-english.md +242 -0
  102. package/skills/scholar-citation-verify/SKILL.md +166 -0
  103. package/skills/scholar-citation-verify/references/api-usage.md +372 -0
  104. package/skills/scholar-citation-verify/references/common-errors.md +384 -0
  105. package/skills/scholar-citation-verify/references/verification-rules.md +399 -0
  106. package/skills/scholar-experiment/SKILL.md +321 -0
  107. package/skills/scholar-ideation/SKILL.md +288 -0
  108. package/skills/scholar-latex-organizer/SKILL.md +186 -0
  109. package/skills/scholar-publish/SKILL.md +220 -0
  110. package/skills/scholar-rebuttal-pro/README.md +313 -0
  111. package/skills/scholar-rebuttal-pro/SKILL.md +511 -0
  112. package/skills/scholar-review/SKILL.md +227 -0
  113. package/skills/scholar-thesis-docx/README.md +111 -0
  114. package/skills/scholar-thesis-docx/README_EN.md +108 -0
  115. package/skills/scholar-thesis-docx/SKILL.md +212 -0
  116. package/skills/scholar-thesis-docx/references/failure-patterns-and-quality-gates.md +178 -0
  117. package/skills/scholar-thesis-docx/references/figure-and-code-rules.md +33 -0
  118. package/skills/scholar-thesis-docx/references/paper-format-workflow.md +68 -0
  119. package/skills/scholar-thesis-docx/references/script-usage.md +157 -0
  120. package/skills/scholar-thesis-docx/scripts/audit_docx_ooxml.py +429 -0
  121. package/skills/scholar-thesis-docx/scripts/check_word_com.ps1 +50 -0
  122. package/skills/scholar-thesis-docx/scripts/export_word_pdf.ps1 +62 -0
  123. package/skills/scholar-thesis-docx/scripts/normalize_word_styles.ps1 +498 -0
  124. package/skills/scholar-thesis-docx/scripts/render_mermaid_figure.ps1 +148 -0
  125. package/skills/scholar-writing/SKILL.md +296 -0
  126. package/skills/security-audit/SKILL.md +244 -0
  127. package/skills/skill-generator/SKILL.md +472 -0
  128. package/skills/skill-iter-tune/SKILL.md +382 -0
  129. package/skills/skill-simplify/SKILL.md +63 -0
  130. package/skills/skill-tuning/SKILL.md +174 -0
  131. package/skills/spec-add/SKILL.md +105 -0
  132. package/skills/spec-load/SKILL.md +98 -0
  133. package/skills/spec-remove/SKILL.md +74 -0
  134. package/skills/spec-setup/SKILL.md +75 -0
  135. package/skills/team-adversarial-swarm/SKILL.md +233 -0
  136. package/skills/team-adversarial-swarm/scripts/__pycache__/pheromone.cpython-313.pyc +0 -0
  137. package/skills/team-adversarial-swarm/scripts/__pycache__/scoring.cpython-313.pyc +0 -0
  138. package/skills/team-adversarial-swarm/scripts/aco.py +473 -0
  139. package/skills/team-adversarial-swarm/scripts/pheromone.py +144 -0
  140. package/skills/team-adversarial-swarm/scripts/scoring.py +92 -0
  141. package/skills/team-adversarial-swarm/scripts/test_aco.py +475 -0
  142. package/skills/team-arch-opt/SKILL.md +158 -0
  143. package/skills/team-brainstorm/SKILL.md +171 -0
  144. package/skills/team-coordinate/SKILL.md +266 -0
  145. package/skills/team-designer/SKILL.md +160 -0
  146. package/skills/team-executor/SKILL.md +189 -0
  147. package/skills/team-frontend/SKILL.md +136 -0
  148. package/skills/team-frontend-debug/SKILL.md +198 -0
  149. package/skills/team-interactive-craft/SKILL.md +141 -0
  150. package/skills/team-issue/SKILL.md +171 -0
  151. package/skills/team-lifecycle-v4/SKILL.md +209 -0
  152. package/skills/team-motion-design/SKILL.md +142 -0
  153. package/skills/team-perf-opt/SKILL.md +175 -0
  154. package/skills/team-planex/SKILL.md +137 -0
  155. package/skills/team-quality-assurance/SKILL.md +147 -0
  156. package/skills/team-review/SKILL.md +147 -0
  157. package/skills/team-roadmap-dev/SKILL.md +169 -0
  158. package/skills/team-swarm/SKILL.md +178 -0
  159. package/skills/team-swarm/scripts/aco.py +473 -0
  160. package/skills/team-swarm/scripts/pheromone.py +144 -0
  161. package/skills/team-swarm/scripts/scoring.py +92 -0
  162. package/skills/team-swarm/scripts/test_aco.py +475 -0
  163. package/skills/team-tech-debt/SKILL.md +128 -0
  164. package/skills/team-testing/SKILL.md +143 -0
  165. package/skills/team-ui-polish/SKILL.md +141 -0
  166. package/skills/team-uidesign/SKILL.md +144 -0
  167. package/skills/team-ultra-analyze/SKILL.md +173 -0
  168. package/skills/team-ux-improve/SKILL.md +151 -0
  169. package/skills/team-visual-a11y/SKILL.md +156 -0
  170. package/skills/workflow-skill-designer/SKILL.md +496 -0
  171. package/src/extension/index.ts +222 -0
  172. package/src/extension/schemas.ts +131 -0
  173. package/src/providers/cli-tools-loader.ts +74 -0
  174. package/src/providers/provider-registry.ts +130 -0
  175. package/src/tools/delegate.ts +85 -0
  176. package/src/tools/explore.ts +134 -0
  177. package/src/tools/moa.ts +213 -0
  178. package/src/tools/status.ts +99 -0
  179. package/src/tools/wait.ts +166 -0
@@ -0,0 +1,372 @@
1
+ # API 使用指南
2
+
3
+ 本文档详细说明如何使用三个主要 API 进行文献验证。
4
+
5
+ ## Semantic Scholar API
6
+
7
+ ### 概述
8
+
9
+ Semantic Scholar 是一个免费的学术搜索引擎,提供强大的 API 用于论文检索和元数据获取。
10
+
11
+ **优势:**
12
+ - 免费使用,无需 API key
13
+ - 覆盖广泛的学科领域
14
+ - 提供丰富的元数据
15
+ - 支持模糊搜索
16
+
17
+ **限制:**
18
+ - 请求频率限制:100 requests/5min
19
+ - 部分论文可能缺失
20
+
21
+ ### API 端点
22
+
23
+ **1. 通过 Paper ID 获取论文**
24
+ ```
25
+ GET https://api.semanticscholar.org/graph/v1/paper/{paper_id}
26
+ ```
27
+
28
+ **2. 搜索论文**
29
+ ```
30
+ GET https://api.semanticscholar.org/graph/v1/paper/search?query={query}
31
+ ```
32
+
33
+ ### Python 示例
34
+
35
+ **安装:**
36
+ ```bash
37
+ pip install semanticscholar
38
+ ```
39
+
40
+ **基本用法:**
41
+ ```python
42
+ from semanticscholar import SemanticScholar
43
+
44
+ sch = SemanticScholar()
45
+
46
+ # 通过标题搜索
47
+ results = sch.search_paper("Attention is All You Need", limit=5)
48
+ for paper in results:
49
+ print(f"Title: {paper.title}")
50
+ print(f"Authors: {[a.name for a in paper.authors]}")
51
+ print(f"Year: {paper.year}")
52
+ print(f"DOI: {paper.externalIds.get('DOI', 'N/A')}")
53
+ print("---")
54
+ ```
55
+
56
+ **通过 DOI 获取:**
57
+ ```python
58
+ # DOI 格式: DOI:10.48550/arXiv.1706.03762
59
+ paper = sch.get_paper("DOI:10.48550/arXiv.1706.03762")
60
+ print(f"Title: {paper.title}")
61
+ print(f"Citations: {paper.citationCount}")
62
+ ```
63
+
64
+ ### 字段说明
65
+
66
+ **返回的主要字段:**
67
+ - `paperId` - Semantic Scholar 内部 ID
68
+ - `title` - 论文标题
69
+ - `authors` - 作者列表
70
+ - `year` - 发表年份
71
+ - `venue` - 发表场所(会议/期刊)
72
+ - `externalIds` - 外部标识符(DOI, arXiv, PubMed 等)
73
+ - `citationCount` - 引用次数
74
+ - `abstract` - 摘要
75
+
76
+ ### 错误处理
77
+
78
+ ```python
79
+ try:
80
+ paper = sch.get_paper("invalid_id")
81
+ except Exception as e:
82
+ print(f"Error: {e}")
83
+ # 处理错误:标记需要人工验证
84
+ ```
85
+
86
+ ## arXiv API
87
+
88
+ ### 概述
89
+
90
+ arXiv 是预印本论文库,提供免费的 API 用于访问论文元数据。
91
+
92
+ **优势:**
93
+ - 完全免费,无需认证
94
+ - 覆盖物理、数学、计算机科学等领域
95
+ - 提供完整的论文 PDF
96
+ - 更新及时
97
+
98
+ **限制:**
99
+ - 仅限预印本论文
100
+ - 不包含已发表的期刊版本信息
101
+
102
+ ### API 端点
103
+
104
+ **查询接口:**
105
+ ```
106
+ GET http://export.arxiv.org/api/query?search_query={query}&start={start}&max_results={max}
107
+ ```
108
+
109
+ ### Python 示例
110
+
111
+ **安装:**
112
+ ```bash
113
+ pip install arxiv
114
+ ```
115
+
116
+ **基本用法:**
117
+ ```python
118
+ import arxiv
119
+
120
+ # 通过 arXiv ID 获取
121
+ paper = next(arxiv.Search(id_list=["1706.03762"]).results())
122
+ print(f"Title: {paper.title}")
123
+ print(f"Authors: {[a.name for a in paper.authors]}")
124
+ print(f"Published: {paper.published}")
125
+ print(f"PDF URL: {paper.pdf_url}")
126
+
127
+ # 通过标题搜索
128
+ search = arxiv.Search(
129
+ query="Attention is All You Need",
130
+ max_results=5,
131
+ sort_by=arxiv.SortCriterion.Relevance
132
+ )
133
+
134
+ for result in search.results():
135
+ print(f"Title: {result.title}")
136
+ print(f"arXiv ID: {result.entry_id.split('/')[-1]}")
137
+ print("---")
138
+ ```
139
+
140
+ ### arXiv ID 格式
141
+
142
+ **识别 arXiv ID:**
143
+ - 新格式: `YYMM.NNNNN` (如 2301.12345)
144
+ - 旧格式: `arch-ive/YYMMNNN` (如 cs/0703001)
145
+
146
+ **从 URL 提取:**
147
+ ```python
148
+ import re
149
+
150
+ def extract_arxiv_id(text):
151
+ # 匹配新格式
152
+ match = re.search(r'\d{4}\.\d{4,5}', text)
153
+ if match:
154
+ return match.group()
155
+ # 匹配旧格式
156
+ match = re.search(r'[a-z-]+/\d{7}', text)
157
+ if match:
158
+ return match.group()
159
+ return None
160
+ ```
161
+
162
+ ## CrossRef API
163
+
164
+ ### 概述
165
+
166
+ CrossRef 是 DOI 注册机构,提供权威的学术文献元数据。
167
+
168
+ **优势:**
169
+ - DOI 是最可靠的唯一标识符
170
+ - 覆盖几乎所有正式发表的论文
171
+ - 数据质量高,权威性强
172
+ - 支持 BibTeX 格式直接获取
173
+
174
+ **限制:**
175
+ - 仅限有 DOI 的论文
176
+ - 预印本通常没有 DOI
177
+
178
+ ### API 端点
179
+
180
+ **通过 DOI 获取元数据:**
181
+ ```
182
+ GET https://api.crossref.org/works/{doi}
183
+ ```
184
+
185
+ **通过 DOI 获取 BibTeX:**
186
+ ```
187
+ GET https://doi.org/{doi}
188
+ Headers: Accept: application/x-bibtex
189
+ ```
190
+
191
+ ### Python 示例
192
+
193
+ **通过 DOI 获取元数据:**
194
+ ```python
195
+ import requests
196
+
197
+ def get_crossref_metadata(doi):
198
+ url = f"https://api.crossref.org/works/{doi}"
199
+ response = requests.get(url)
200
+ if response.status_code == 200:
201
+ data = response.json()
202
+ return data['message']
203
+ return None
204
+
205
+ # 示例
206
+ doi = "10.48550/arXiv.1706.03762"
207
+ metadata = get_crossref_metadata(doi)
208
+ if metadata:
209
+ print(f"Title: {metadata['title'][0]}")
210
+ print(f"Authors: {[f\"{a['given']} {a['family']}\" for a in metadata['author']]}")
211
+ print(f"Published: {metadata['published']['date-parts'][0]}")
212
+ ```
213
+
214
+ **通过 DOI 获取 BibTeX:**
215
+ ```python
216
+ def doi_to_bibtex(doi):
217
+ url = f"https://doi.org/{doi}"
218
+ headers = {"Accept": "application/x-bibtex"}
219
+ response = requests.get(url, headers=headers)
220
+ if response.status_code == 200:
221
+ return response.text
222
+ return None
223
+
224
+ # 示例
225
+ bibtex = doi_to_bibtex("10.48550/arXiv.1706.03762")
226
+ print(bibtex)
227
+ ```
228
+
229
+ ### DOI 格式
230
+
231
+ **标准格式:**
232
+ - `10.XXXX/suffix` (如 10.1038/nature12345)
233
+ - 前缀 `10.` 是固定的
234
+ - 中间是注册机构代码
235
+ - 后缀是出版商定义的
236
+
237
+ **从文本中提取 DOI:**
238
+ ```python
239
+ import re
240
+
241
+ def extract_doi(text):
242
+ # 匹配 DOI 格式
243
+ match = re.search(r'10\.\d{4,}/[^\s]+', text)
244
+ if match:
245
+ return match.group()
246
+ return None
247
+ ```
248
+
249
+ ## API 选择策略
250
+
251
+ 根据引用信息选择最合适的 API:
252
+
253
+ ### 决策流程
254
+
255
+ ```
256
+ 有 DOI?
257
+ ├─ 是 → CrossRef API (最可靠)
258
+ └─ 否 → 有 arXiv ID?
259
+ ├─ 是 → arXiv API
260
+ └─ 否 → Semantic Scholar API (通用搜索)
261
+ ```
262
+
263
+ ### 实现示例
264
+
265
+ ```python
266
+ def verify_citation(citation_info):
267
+ """
268
+ 根据引用信息选择合适的 API 进行验证
269
+
270
+ Args:
271
+ citation_info: dict with keys: doi, arxiv_id, title, authors
272
+
273
+ Returns:
274
+ 验证结果字典
275
+ """
276
+ # 策略 1: DOI 优先
277
+ if citation_info.get('doi'):
278
+ return verify_with_crossref(citation_info['doi'])
279
+
280
+ # 策略 2: arXiv ID
281
+ if citation_info.get('arxiv_id'):
282
+ return verify_with_arxiv(citation_info['arxiv_id'])
283
+
284
+ # 策略 3: 通用搜索
285
+ if citation_info.get('title'):
286
+ return verify_with_semantic_scholar(
287
+ citation_info['title'],
288
+ citation_info.get('authors')
289
+ )
290
+
291
+ return {'status': 'insufficient_info'}
292
+ ```
293
+
294
+ ## 最佳实践
295
+
296
+ ### 1. 错误处理
297
+
298
+ ```python
299
+ import time
300
+ from requests.exceptions import RequestException
301
+
302
+ def api_call_with_retry(func, max_retries=3):
303
+ """带重试的 API 调用"""
304
+ for i in range(max_retries):
305
+ try:
306
+ return func()
307
+ except RequestException as e:
308
+ if i == max_retries - 1:
309
+ raise
310
+ time.sleep(2 ** i) # 指数退避
311
+ ```
312
+
313
+ ### 2. 速率限制
314
+
315
+ ```python
316
+ import time
317
+
318
+ class RateLimiter:
319
+ def __init__(self, calls_per_minute):
320
+ self.calls_per_minute = calls_per_minute
321
+ self.last_call = 0
322
+
323
+ def wait_if_needed(self):
324
+ elapsed = time.time() - self.last_call
325
+ min_interval = 60.0 / self.calls_per_minute
326
+ if elapsed < min_interval:
327
+ time.sleep(min_interval - elapsed)
328
+ self.last_call = time.time()
329
+
330
+ # 使用示例
331
+ limiter = RateLimiter(calls_per_minute=20)
332
+ limiter.wait_if_needed()
333
+ result = api_call()
334
+ ```
335
+
336
+ ### 3. 缓存结果
337
+
338
+ ```python
339
+ import json
340
+ from pathlib import Path
341
+
342
+ class APICache:
343
+ def __init__(self, cache_dir=".cache"):
344
+ self.cache_dir = Path(cache_dir)
345
+ self.cache_dir.mkdir(exist_ok=True)
346
+
347
+ def get(self, key):
348
+ cache_file = self.cache_dir / f"{key}.json"
349
+ if cache_file.exists():
350
+ return json.loads(cache_file.read_text())
351
+ return None
352
+
353
+ def set(self, key, value):
354
+ cache_file = self.cache_dir / f"{key}.json"
355
+ cache_file.write_text(json.dumps(value))
356
+ ```
357
+
358
+ ## 总结
359
+
360
+ ### API 对比
361
+
362
+ | API | 优势 | 限制 | 推荐场景 |
363
+ |-----|------|------|----------|
364
+ | **CrossRef** | 最权威,支持 BibTeX | 仅限有 DOI 的论文 | 有 DOI 时首选 |
365
+ | **arXiv** | 免费,更新快 | 仅限预印本 | arXiv 论文 |
366
+ | **Semantic Scholar** | 覆盖广,模糊搜索 | 部分论文缺失 | 通用搜索 |
367
+
368
+ ### 验证可靠性排序
369
+
370
+ 1. **CrossRef (DOI)** - 最可靠
371
+ 2. **arXiv (arXiv ID)** - 可靠
372
+ 3. **Semantic Scholar (标题搜索)** - 较可靠,需要人工确认