dsh-science-plugin 0.0.0-stage → 0.14.1
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/LICENSE +21 -0
- package/README.md +90 -2
- package/agents/_README.md +5 -0
- package/agents/analyst.md +27 -0
- package/agents/figure-expert.md +35 -0
- package/agents/literature-scout.md +32 -0
- package/agents/presentation.md +78 -0
- package/agents/reviewer.md +32 -0
- package/agents/simulator.md +30 -0
- package/agents/topic-designer.md +26 -0
- package/agents/trainer.md +36 -0
- package/agents/writer.md +44 -0
- package/assets/mascots/analyst.svg +33 -0
- package/assets/mascots/designer.svg +33 -0
- package/assets/mascots/figure.svg +35 -0
- package/assets/mascots/idle.svg +9 -0
- package/assets/mascots/lead.svg +33 -0
- package/assets/mascots/presentation.svg +40 -0
- package/assets/mascots/reviewer.svg +31 -0
- package/assets/mascots/scout.svg +31 -0
- package/assets/mascots/simulator.svg +33 -0
- package/assets/mascots/thinking.svg +23 -0
- package/assets/mascots/trainer.svg +32 -0
- package/assets/mascots/working.svg +9 -0
- package/assets/mascots/writer.svg +33 -0
- package/client/client.js +3425 -0
- package/client/client.js.map +7 -0
- package/cordis.patch.yml +10 -0
- package/docs/DEVLOG.md +864 -0
- package/docs/SPEC.md +452 -0
- package/docs/recipes/agent-teams-science.md +46 -0
- package/docs/research/2026-11-12-academic-figure-skill-/350/257/204/344/274/260.md +33 -0
- package/docs/research/2026-11-12-/347/224/237/347/211/251/347/247/221/347/240/224/350/203/275/345/212/233/344/270/216/345/267/245/344/275/234/345/217/260/351/233/206/346/210/220/350/260/203/347/240/224.md +169 -0
- package/docs/research/2026-11-12-/347/247/221/347/240/224/347/273/230/345/233/276/345/274/200/346/272/220/346/226/271/346/241/210/350/260/203/347/240/224.md +52 -0
- package/docs/research/2026-11-13-/345/257/271/350/257/235/351/251/261/345/212/250/347/247/221/347/240/224/345/267/245/344/275/234/345/217/260/344/272/247/345/223/201/347/255/226/347/225/245/350/260/203/347/240/224.md +319 -0
- package/docs/research/2026-11-13-/350/267/257/347/272/277B/346/212/200/346/234/257/345/217/257/350/241/214/346/200/247/344/270/216/344/275/216/347/274/272/351/231/267/350/256/276/350/256/241/350/260/203/347/240/224.md +65 -0
- package/docs/superpowers/specs/2026-11-12-/347/247/221/347/240/224/345/267/245/344/275/234/345/217/260/351/207/215/346/236/204/350/256/276/350/256/241.md +364 -0
- package/docs/superpowers/specs/2026-11-13-/345/257/271/350/257/235/344/274/230/345/205/210/347/247/221/347/240/224/345/215/241/347/211/207/345/267/245/344/275/234/345/217/260/351/207/215/346/236/204/350/256/276/350/256/241.md +607 -0
- package/icon.svg +6 -0
- package/lib/action-cards.js +194 -0
- package/lib/artifact-index.js +131 -0
- package/lib/blueprint.js +1487 -0
- package/lib/dag.js +69 -0
- package/lib/db.js +386 -0
- package/lib/figureqa.js +290 -0
- package/lib/figures.js +732 -0
- package/lib/httpdata-auth.js +91 -0
- package/lib/httpdata.js +863 -0
- package/lib/index.js +330 -0
- package/lib/lit.js +100 -0
- package/lib/paperspine.js +287 -0
- package/lib/project-adapter.js +259 -0
- package/lib/project-catalog.js +227 -0
- package/lib/project-context.js +282 -0
- package/lib/project-domain.js +849 -0
- package/lib/project-remote.js +348 -0
- package/lib/project-store.js +653 -0
- package/lib/rail-team.js +47 -0
- package/lib/resources.js +94 -0
- package/lib/reviewcov.js +238 -0
- package/lib/reviewer.js +638 -0
- package/lib/reviewruns.js +95 -0
- package/lib/roles.js +41 -0
- package/lib/router.js +133 -0
- package/lib/skeleton-context.js +181 -0
- package/lib/skillmenu.js +994 -0
- package/lib/ssh.js +637 -0
- package/lib/status.js +138 -0
- package/lib/store.js +50 -0
- package/lib/team.js +945 -0
- package/lib/vendor/ssh2.bundle.cjs +20124 -0
- package/lib/workspace-key.js +64 -0
- package/locale/en.json +7 -0
- package/locale/zh.json +7 -0
- package/package.json +72 -4
- package/skills/sci-autoresearch/SKILL.md +41 -0
- package/skills/sci-figures/SKILL.md +91 -0
- package/skills/sci-figures/references/journal-requirements.md +22 -0
- package/skills/sci-figures/references/r-figures.md +106 -0
- package/skills/sci-figures/scripts/figure_export.py +45 -0
- package/skills/sci-figures/scripts/style_presets.py +82 -0
- package/skills/sci-hypothesis/SKILL.md +37 -0
- package/skills/sci-polish/SKILL.md +28 -0
- package/skills/sci-remote-jobs/SKILL.md +48 -0
- package/skills/sci-simulation/SKILL.md +70 -0
- package/skills/sci-simulation/references/tool-dossiers/_TEMPLATE.md +25 -0
- package/skills/sci-simulation/references/tool-dossiers/ase.md +42 -0
- package/skills/sci-simulation/references/tool-dossiers/gaussian.md +42 -0
- package/skills/sci-simulation/references/tool-dossiers/gromacs.md +37 -0
- package/skills/sci-simulation/references/tool-dossiers/lammps.md +34 -0
- package/skills/sci-simulation/references/tool-dossiers/quantum-espresso.md +34 -0
- package/skills/sci-simulation/references/universal-tool-onboarding.md +117 -0
- package/skills/sci-slides/SKILL.md +73 -0
- package/skills/sci-slides/scripts/make_deck.py +332 -0
- package/skills/sci-writing/SKILL.md +33 -0
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""dsh-science sci-slides — 科研汇报 PPT 最小模板脚本(python-pptx)。
|
|
3
|
+
|
|
4
|
+
骨架函数(封面/背景与缺口/方法概览/每 result 一页/结论与展望/Q&A 备份页),
|
|
5
|
+
版面纪律落在常量与断言里:16:9、Results 页图占右 55% 版面、要点 ≤5 条/页
|
|
6
|
+
(超限抛错,不静默截断)、层级字号、红灰学术配色、来源角标可溯源。
|
|
7
|
+
|
|
8
|
+
用法(CLI,会话工作区内跑):
|
|
9
|
+
python make_deck.py --out slides/demo_deck.pptx --spec spec.json
|
|
10
|
+
python make_deck.py --out slides/deck.pptx --title "..." --claim "..." \
|
|
11
|
+
--figure figures/fig1.png --figure figures/fig2.png # 无 spec 时的极简路径
|
|
12
|
+
|
|
13
|
+
spec.json 见 SKILL.md(字段全部可缺省)。也可以 import 本文件逐页拼装:
|
|
14
|
+
from make_deck import new_deck, add_cover, add_result, ...
|
|
15
|
+
依赖: pip install python-pptx(缺依赖时报错并给安装提示,不静默换库)。
|
|
16
|
+
字体: python-pptx 无法直接嵌入字体——本脚本统一 Arial(拉丁)+ 微软雅黑(东亚),
|
|
17
|
+
保证 Windows/LibreOffice 兼容;需要真嵌入时用 PowerPoint 另存(嵌入字体)。
|
|
18
|
+
|
|
19
|
+
方法论出处见 SKILL.md 头注(PPTAgent / academic-ppt-skill / open-kimi-ppt,机制吸收、原创实现)。
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
import argparse
|
|
23
|
+
import json
|
|
24
|
+
import os
|
|
25
|
+
import sys
|
|
26
|
+
|
|
27
|
+
try:
|
|
28
|
+
from pptx import Presentation
|
|
29
|
+
from pptx.util import Inches, Pt, Emu
|
|
30
|
+
from pptx.dml.color import RGBColor
|
|
31
|
+
from pptx.enum.text import PP_ALIGN, MSO_ANCHOR
|
|
32
|
+
except ImportError:
|
|
33
|
+
sys.stderr.write("缺少依赖 python-pptx:请先运行 pip install python-pptx\n")
|
|
34
|
+
sys.exit(2)
|
|
35
|
+
|
|
36
|
+
# ---- 版面常量(母版复用:所有页共用同一套坐标/字号/色板,不要逐页手调) ----
|
|
37
|
+
SLIDE_W_IN, SLIDE_H_IN = 13.333, 7.5 # 16:9
|
|
38
|
+
MARGIN_IN = 0.6 # 四周外边距
|
|
39
|
+
PIC_RATIO = 0.55 # Results 页图区宽度占比(≥50% 纪律)
|
|
40
|
+
MAX_BULLETS = 5 # 每页要点上限(超限抛错)
|
|
41
|
+
MAX_BODY_CHARS = 40 # 每页正文字数上限(导读句)
|
|
42
|
+
|
|
43
|
+
INK = RGBColor(0x2C, 0x3E, 0x50) # 深灰(正文/标题)
|
|
44
|
+
ACCENT = RGBColor(0xC0, 0x39, 0x2B) # 学术红(强调/角标)
|
|
45
|
+
MUTED = RGBColor(0x7F, 0x8C, 0x8D) # 中灰(图注/来源)
|
|
46
|
+
LINE = RGBColor(0xBD, 0xC3, 0xC7) # 边框灰
|
|
47
|
+
FILL = RGBColor(0xFD, 0xED, 0xEC) # 浅红填充(主张框)
|
|
48
|
+
FONT_LATIN, FONT_EA = "Arial", "微软雅黑"
|
|
49
|
+
|
|
50
|
+
TITLE_PT, BODY_PT, NOTE_PT = 30, 19, 13 # 层级字号:页标题/要点/图注
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def _set_font(run, size, bold=False, color=INK):
|
|
54
|
+
"""统一设置拉丁 + 东亚字体(python-pptx 的 font.name 只管拉丁,东亚要写 rPr.ea)。"""
|
|
55
|
+
f = run.font
|
|
56
|
+
f.name = FONT_LATIN
|
|
57
|
+
f.size = Pt(size)
|
|
58
|
+
f.bold = bold
|
|
59
|
+
f.color.rgb = color
|
|
60
|
+
try:
|
|
61
|
+
rPr = run._r.get_or_add_rPr()
|
|
62
|
+
ea = rPr.find("{http://schemas.openxmlformats.org/drawingml/2006/main}ea")
|
|
63
|
+
if ea is None:
|
|
64
|
+
ea = rPr.makeelement("{http://schemas.openxmlformats.org/drawingml/2006/main}ea", {})
|
|
65
|
+
rPr.append(ea)
|
|
66
|
+
ea.set("typeface", FONT_EA)
|
|
67
|
+
except Exception:
|
|
68
|
+
pass
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def _check_bullets(items, where):
|
|
72
|
+
if len(items) > MAX_BULLETS:
|
|
73
|
+
raise ValueError(f"{where} 要点 {len(items)} 条 > 上限 {MAX_BULLETS}:拆页或挪备份页(密度纪律)")
|
|
74
|
+
return list(items)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def _textbox(slide, left, top, width, height):
|
|
78
|
+
box = slide.shapes.add_textbox(Inches(left), Inches(top), Inches(width), Inches(height))
|
|
79
|
+
tf = box.text_frame
|
|
80
|
+
tf.word_wrap = True
|
|
81
|
+
return tf
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def _title(slide, text, color=INK):
|
|
85
|
+
"""页标题(结论句)+ 标题下强调短线,全页共用坐标。"""
|
|
86
|
+
tf = _textbox(slide, MARGIN_IN, 0.35, SLIDE_W_IN - 2 * MARGIN_IN, 0.9)
|
|
87
|
+
p = tf.paragraphs[0]
|
|
88
|
+
run = p.add_run()
|
|
89
|
+
run.text = text
|
|
90
|
+
_set_font(run, TITLE_PT, bold=True, color=color)
|
|
91
|
+
bar = slide.shapes.add_shape(1, Inches(MARGIN_IN), Inches(1.28), Inches(1.6), Pt(3))
|
|
92
|
+
bar.fill.solid()
|
|
93
|
+
bar.fill.fore_color.rgb = ACCENT
|
|
94
|
+
bar.line.fill.background()
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
def _source_tag(slide, text):
|
|
98
|
+
"""右下角来源角标(res-N / fig-*),可溯源。"""
|
|
99
|
+
if not text:
|
|
100
|
+
return
|
|
101
|
+
tf = _textbox(slide, SLIDE_W_IN - MARGIN_IN - 3.2, SLIDE_H_IN - 0.5, 3.2, 0.35)
|
|
102
|
+
p = tf.paragraphs[0]
|
|
103
|
+
p.alignment = PP_ALIGN.RIGHT
|
|
104
|
+
run = p.add_run()
|
|
105
|
+
run.text = str(text)
|
|
106
|
+
_set_font(run, NOTE_PT, color=MUTED)
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
def _bullets(slide, items, left, top, width, height, size=BODY_PT):
|
|
110
|
+
items = _check_bullets(items, "本页")
|
|
111
|
+
tf = _textbox(slide, left, top, width, height)
|
|
112
|
+
for i, item in enumerate(items):
|
|
113
|
+
p = tf.paragraphs[0] if i == 0 else tf.add_paragraph()
|
|
114
|
+
run = p.add_run()
|
|
115
|
+
run.text = f"• {item}"
|
|
116
|
+
_set_font(run, size)
|
|
117
|
+
p.space_after = Pt(10)
|
|
118
|
+
return tf
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
def _picture_zone(slide, paths, left, top, width, height):
|
|
122
|
+
"""图区:等比缩放居中放登记图(多图纵向均分);无图放占位框标注登记图路径——绝不拿装饰图冒充。"""
|
|
123
|
+
n = max(len(paths), 1)
|
|
124
|
+
cell_h = height / n
|
|
125
|
+
for i in range(n):
|
|
126
|
+
cell_top = top + i * cell_h
|
|
127
|
+
path = paths[i] if i < len(paths) else None
|
|
128
|
+
if path and os.path.exists(path):
|
|
129
|
+
ratio = 4 / 3 # 缺 Pillow 或读图失败时按 4:3 兜底
|
|
130
|
+
try:
|
|
131
|
+
from PIL import Image
|
|
132
|
+
with Image.open(path) as im:
|
|
133
|
+
w, h = im.size
|
|
134
|
+
if h:
|
|
135
|
+
ratio = w / h
|
|
136
|
+
except Exception:
|
|
137
|
+
pass
|
|
138
|
+
draw_w, draw_h = width, width / ratio
|
|
139
|
+
if draw_h > cell_h:
|
|
140
|
+
draw_h, draw_w = cell_h, cell_h * ratio
|
|
141
|
+
slide.shapes.add_picture(
|
|
142
|
+
path,
|
|
143
|
+
Inches(left + (width - draw_w) / 2),
|
|
144
|
+
Inches(cell_top + (cell_h - draw_h) / 2),
|
|
145
|
+
Inches(draw_w),
|
|
146
|
+
Inches(draw_h),
|
|
147
|
+
)
|
|
148
|
+
else:
|
|
149
|
+
ph = slide.shapes.add_shape(1, Inches(left + 0.2), Inches(cell_top + 0.2),
|
|
150
|
+
Inches(width - 0.4), Inches(cell_h - 0.4))
|
|
151
|
+
ph.fill.solid()
|
|
152
|
+
ph.fill.fore_color.rgb = RGBColor(0xEC, 0xF0, 0xF1)
|
|
153
|
+
ph.line.color.rgb = LINE
|
|
154
|
+
tf = ph.text_frame
|
|
155
|
+
tf.word_wrap = True
|
|
156
|
+
p = tf.paragraphs[0]
|
|
157
|
+
p.alignment = PP_ALIGN.CENTER
|
|
158
|
+
run = p.add_run()
|
|
159
|
+
run.text = "图位:登记图表路径\n(sci_figure_list 取图,≥50% 版面)" + (f"\n待嵌入:{path}" if path else "")
|
|
160
|
+
_set_font(run, NOTE_PT, color=MUTED)
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
def new_deck():
|
|
164
|
+
"""16:9 空白演示文稿(页面一律用空白版式自绘,母版坐标由本模块常量统一)。"""
|
|
165
|
+
prs = Presentation()
|
|
166
|
+
prs.slide_width = Inches(SLIDE_W_IN)
|
|
167
|
+
prs.slide_height = Inches(SLIDE_H_IN)
|
|
168
|
+
return prs
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
def _blank(prs):
|
|
172
|
+
return prs.slides.add_slide(prs.slide_layouts[6])
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
def add_cover(prs, title, subtitle="", authors="", date=""):
|
|
176
|
+
"""封面:标题/副标题(场合或期刊)/作者/日期。缺省内容用占位符并注明。"""
|
|
177
|
+
s = _blank(prs)
|
|
178
|
+
tf = _textbox(s, 1.2, 2.3, SLIDE_W_IN - 2.4, 2.0)
|
|
179
|
+
p = tf.paragraphs[0]
|
|
180
|
+
p.alignment = PP_ALIGN.CENTER
|
|
181
|
+
run = p.add_run()
|
|
182
|
+
run.text = title or "(标题占位:blueprint.core.title)"
|
|
183
|
+
_set_font(run, 40, bold=True, color=INK)
|
|
184
|
+
tf2 = _textbox(s, 1.2, 4.3, SLIDE_W_IN - 2.4, 1.6)
|
|
185
|
+
for i, line in enumerate(x for x in (subtitle, authors, date) if x):
|
|
186
|
+
p = tf2.paragraphs[0] if i == 0 else tf2.add_paragraph()
|
|
187
|
+
p.alignment = PP_ALIGN.CENTER
|
|
188
|
+
run = p.add_run()
|
|
189
|
+
run.text = line
|
|
190
|
+
_set_font(run, 18, color=MUTED if i else ACCENT)
|
|
191
|
+
return s
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
def add_background(prs, gap_points, claim=""):
|
|
195
|
+
"""背景与缺口(1-2 页之一):要点 ≤5 + 底部主张框(claim 口语版)。"""
|
|
196
|
+
s = _blank(prs)
|
|
197
|
+
_title(s, "背景与缺口")
|
|
198
|
+
_bullets(s, gap_points, MARGIN_IN, 1.6, SLIDE_W_IN - 2 * MARGIN_IN, 3.4)
|
|
199
|
+
if claim:
|
|
200
|
+
body_len = sum(len(x) for x in gap_points)
|
|
201
|
+
if body_len > MAX_BODY_CHARS:
|
|
202
|
+
raise ValueError(f"背景页正文 {body_len} 字 > 上限 {MAX_BODY_CHARS}:精简或拆页")
|
|
203
|
+
box = s.shapes.add_shape(1, Inches(MARGIN_IN), Inches(5.6), SLIDE_W_IN - 2 * MARGIN_IN, Inches(1.1))
|
|
204
|
+
box.fill.solid()
|
|
205
|
+
box.fill.fore_color.rgb = FILL
|
|
206
|
+
box.line.color.rgb = ACCENT
|
|
207
|
+
tf = box.text_frame
|
|
208
|
+
tf.word_wrap = True
|
|
209
|
+
p = tf.paragraphs[0]
|
|
210
|
+
p.alignment = PP_ALIGN.CENTER
|
|
211
|
+
run = p.add_run()
|
|
212
|
+
run.text = f"本工作主张:{claim}"
|
|
213
|
+
_set_font(run, 20, bold=True, color=ACCENT)
|
|
214
|
+
return s
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
def add_method(prs, one_liner, steps=()):
|
|
218
|
+
"""方法概览(1 页):一句话路线 + 步骤要点(参数表进备份页,不进这里)。"""
|
|
219
|
+
s = _blank(prs)
|
|
220
|
+
_title(s, "方法概览")
|
|
221
|
+
tf = _textbox(s, MARGIN_IN, 1.7, SLIDE_W_IN - 2 * MARGIN_IN, 1.4)
|
|
222
|
+
p = tf.paragraphs[0]
|
|
223
|
+
run = p.add_run()
|
|
224
|
+
run.text = one_liner or "(一句话说清路线:数据/系统/怎么做的)"
|
|
225
|
+
_set_font(run, 22, bold=True, color=INK)
|
|
226
|
+
_bullets(s, list(steps), MARGIN_IN, 3.3, SLIDE_W_IN - 2 * MARGIN_IN, 3.0)
|
|
227
|
+
return s
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
def add_result(prs, title, bullets=(), figures=(), source=""):
|
|
231
|
+
"""Results 页:结论句作页标题;图区占右侧 55% 宽(≥50% 纪律);文字只给导读。"""
|
|
232
|
+
s = _blank(prs)
|
|
233
|
+
_title(s, title or "(结论式页标题:res-N 的 claim 改陈述句)")
|
|
234
|
+
text_w = (SLIDE_W_IN - 2 * MARGIN_IN) * (1 - PIC_RATIO) - 0.3
|
|
235
|
+
pic_left = MARGIN_IN + text_w + 0.3
|
|
236
|
+
pic_w = (SLIDE_W_IN - 2 * MARGIN_IN) * PIC_RATIO
|
|
237
|
+
_bullets(s, bullets, MARGIN_IN, 1.8, text_w, 4.6)
|
|
238
|
+
body_chars = sum(len(x) for x in bullets)
|
|
239
|
+
if body_chars > MAX_BODY_CHARS:
|
|
240
|
+
raise ValueError(f"Results 页正文 {body_chars} 字 > 上限 {MAX_BODY_CHARS}:文字只写图说明什么")
|
|
241
|
+
_picture_zone(s, list(figures), pic_left, 1.6, pic_w, SLIDE_H_IN - 2.4)
|
|
242
|
+
_source_tag(s, source)
|
|
243
|
+
return s
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
def add_conclusion(prs, takeaways, outlook=""):
|
|
247
|
+
"""结论与展望(1 页):≤3 条结论 + 下一步。"""
|
|
248
|
+
s = _blank(prs)
|
|
249
|
+
_title(s, "结论与展望")
|
|
250
|
+
_bullets(s, _check_bullets(takeaways[:3], "结论页"), MARGIN_IN, 1.8, SLIDE_W_IN - 2 * MARGIN_IN, 3.2, size=22)
|
|
251
|
+
if outlook:
|
|
252
|
+
tf = _textbox(s, MARGIN_IN, 5.4, SLIDE_W_IN - 2 * MARGIN_IN, 1.0)
|
|
253
|
+
p = tf.paragraphs[0]
|
|
254
|
+
run = p.add_run()
|
|
255
|
+
run.text = f"下一步:{outlook}"
|
|
256
|
+
_set_font(run, 18, color=ACCENT)
|
|
257
|
+
return s
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
def add_backup(prs, title="统计细节(Q&A 备份)", rows=()):
|
|
261
|
+
"""备份页:统计细节/参数表(Q&A 弹药),表格逐格写不截图。"""
|
|
262
|
+
s = _blank(prs)
|
|
263
|
+
_title(s, title, color=ACCENT)
|
|
264
|
+
rows = [list(map(str, r)) for r in rows]
|
|
265
|
+
if rows:
|
|
266
|
+
n_r, n_c = len(rows), max(len(r) for r in rows)
|
|
267
|
+
tbl = s.shapes.add_table(n_r, n_c, Inches(MARGIN_IN), Inches(1.8),
|
|
268
|
+
SLIDE_W_IN - 2 * MARGIN_IN, Inches(min(0.5 * n_r, 4.8))).table
|
|
269
|
+
for i, row in enumerate(rows):
|
|
270
|
+
for j in range(n_c):
|
|
271
|
+
cell = tbl.cell(i, j)
|
|
272
|
+
cell.text = row[j] if j < len(row) else ""
|
|
273
|
+
for p in cell.text_frame.paragraphs:
|
|
274
|
+
for run in p.runs:
|
|
275
|
+
_set_font(run, 14, bold=(i == 0))
|
|
276
|
+
else:
|
|
277
|
+
_bullets(s, ["(无备份内容:统计细节/参数表/数据来源按需补)"], MARGIN_IN, 1.8,
|
|
278
|
+
SLIDE_W_IN - 2 * MARGIN_IN, 3.0)
|
|
279
|
+
return s
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
def build_deck(spec):
|
|
283
|
+
"""按 spec(蓝图驱动的页面规划)拼装整副汇报。段→页模板见 SKILL.md。"""
|
|
284
|
+
prs = new_deck()
|
|
285
|
+
cover = spec.get("cover") or {}
|
|
286
|
+
add_cover(prs, cover.get("title", ""), cover.get("subtitle", ""),
|
|
287
|
+
cover.get("authors", ""), cover.get("date", ""))
|
|
288
|
+
bg = spec.get("background") or {}
|
|
289
|
+
add_background(prs, bg.get("gap_points") or [], bg.get("claim", ""))
|
|
290
|
+
meth = spec.get("method") or {}
|
|
291
|
+
add_method(prs, meth.get("one_liner", ""), meth.get("steps") or [])
|
|
292
|
+
for r in spec.get("results") or []:
|
|
293
|
+
add_result(prs, r.get("title", ""), r.get("bullets") or [],
|
|
294
|
+
r.get("figures") or [], r.get("source", ""))
|
|
295
|
+
concl = spec.get("conclusion") or {}
|
|
296
|
+
add_conclusion(prs, concl.get("takeaways") or [], concl.get("outlook", ""))
|
|
297
|
+
backup = spec.get("backup") or {}
|
|
298
|
+
add_backup(prs, backup.get("title", "统计细节(Q&A 备份)"), backup.get("rows") or [])
|
|
299
|
+
return prs
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
def main(argv=None):
|
|
303
|
+
ap = argparse.ArgumentParser(description="科研汇报 PPT 最小模板(python-pptx,蓝图驱动)")
|
|
304
|
+
ap.add_argument("--out", required=True, help="输出 pptx 路径(建议 slides/ 目录)")
|
|
305
|
+
ap.add_argument("--spec", help="页面规划 JSON 文件(字段见 SKILL.md;全部可缺省)")
|
|
306
|
+
ap.add_argument("--title", help="封面标题(无 spec 时的极简路径)")
|
|
307
|
+
ap.add_argument("--claim", help="核心主张(无 spec 时进背景页主张框)")
|
|
308
|
+
ap.add_argument("--figure", action="append", default=[], help="登记图路径(可重复,进第 1 个 Results 页)")
|
|
309
|
+
args = ap.parse_args(argv)
|
|
310
|
+
|
|
311
|
+
if args.spec:
|
|
312
|
+
with open(args.spec, "r", encoding="utf-8") as f:
|
|
313
|
+
spec = json.load(f)
|
|
314
|
+
else:
|
|
315
|
+
spec = {
|
|
316
|
+
"cover": {"title": args.title or ""},
|
|
317
|
+
"background": {"gap_points": [], "claim": args.claim or ""},
|
|
318
|
+
"method": {"one_liner": ""},
|
|
319
|
+
"results": [{"title": "", "bullets": [], "figures": args.figure, "source": ""}] if args.figure else [],
|
|
320
|
+
}
|
|
321
|
+
prs = build_deck(spec)
|
|
322
|
+
out_dir = os.path.dirname(os.path.abspath(args.out))
|
|
323
|
+
os.makedirs(out_dir, exist_ok=True)
|
|
324
|
+
prs.save(args.out)
|
|
325
|
+
# 自检:重新打开核对页数
|
|
326
|
+
n = len(Presentation(args.out).slides._sldIdLst)
|
|
327
|
+
print(f"OK: {args.out}({n} 页)")
|
|
328
|
+
return 0
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
if __name__ == "__main__":
|
|
332
|
+
sys.exit(main())
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sci-writing
|
|
3
|
+
description: 学术论文写作规范与流程。撰写或修改论文任何章节(摘要/引言/方法/结果/讨论)时使用。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# 学术论文写作(设计参考 nature-skills/ARS 的流程思想)
|
|
7
|
+
|
|
8
|
+
## 动笔前
|
|
9
|
+
|
|
10
|
+
1. 明确目标期刊与文章类型(Article/Letter/Review)。
|
|
11
|
+
2. 先列大纲(IMRaD 骨架 + 每节 3-5 个要点),与用户确认后再展开。
|
|
12
|
+
3. 盘点已有材料:图表(`sci_figure_list`)、数据(`sci_db_query` 结果)、文献(`web_search` 检索记录 + `sci_doi_verify` 核对结论)。
|
|
13
|
+
|
|
14
|
+
## 各章节要点
|
|
15
|
+
|
|
16
|
+
- **摘要**:背景一句 → 缺口一句 → 方法两句 → 关键结果(带数字)→ 意义一句。150-250 词,禁用引用。
|
|
17
|
+
- **引言**:漏斗结构(领域重要性 → 已有工作 → 具体缺口 → 本文贡献)。每段一个论点,引用支撑。
|
|
18
|
+
- **方法**:可复现优先。写清数据来源、参数、软件版本;远程计算步骤引用作业记录。
|
|
19
|
+
- **结果**:图主文从,文字讲"图说明了什么"而非重复数字;统计方法与检验值齐全。
|
|
20
|
+
- **讨论**:结果解读 → 与文献对比 → 局限性(主动写)→ 意义与展望。
|
|
21
|
+
|
|
22
|
+
## 硬规则
|
|
23
|
+
|
|
24
|
+
- 每个数字必须能在会话执行记录或产物中溯源(配合 /sci-review 检查)。
|
|
25
|
+
- 引用必须真实:引用前用 `sci_doi_verify` 核对 DOI;不确定的文献宁可不引。
|
|
26
|
+
- 时态:方法/结果过去时,结论现在时。避免绝对化措辞(prove → demonstrate/support)。
|
|
27
|
+
- 拒绝 AI 腔:不用 "delve/moreover/it is worth noting";段落长短交错;少用排比。
|
|
28
|
+
|
|
29
|
+
## 流程
|
|
30
|
+
|
|
31
|
+
1. `出大纲` → 用户确认
|
|
32
|
+
2. `逐节起草` → 每节完成后暂停供修改
|
|
33
|
+
3. `自查`:数字溯源清单 + 引用核对 → 建议 /sci-review
|