@taloswork/ose-shared 0.1.11 → 0.1.12

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 (119) hide show
  1. package/package.json +3 -3
  2. package/skills/document/SKILL.md +143 -215
  3. package/skills/document/art-directions/base.css +27 -2
  4. package/skills/document/art-directions/cinematic-depth.css +3 -1
  5. package/skills/document/art-directions/collage-paper.css +5 -1
  6. package/skills/document/art-directions/editorial-cut.css +5 -1
  7. package/skills/document/art-directions/geometric-pop.css +6 -0
  8. package/skills/document/art-directions/gradient-mesh.css +5 -1
  9. package/skills/document/art-directions/illustrated-doodle.css +5 -0
  10. package/skills/document/art-directions/luxury-ornament.css +4 -1
  11. package/skills/document/art-directions/maximalist-blocks.css +6 -0
  12. package/skills/document/art-directions/technical-grid.css +4 -0
  13. package/skills/document/assets/fonts/fonts.json +2 -2
  14. package/skills/document/assets/pdf-fonts/NotoSansSC-PDF-Bold.ttf +0 -0
  15. package/skills/document/assets/pdf-fonts/NotoSansSC-PDF-Regular.ttf +0 -0
  16. package/skills/document/assets/pdf-fonts/OFL.txt +93 -0
  17. package/skills/document/assets/pdf-fonts/README.md +35 -0
  18. package/skills/document/assets/tessdata/LICENSE-Apache-2.0.txt +202 -0
  19. package/skills/document/assets/tessdata/README.md +21 -0
  20. package/skills/document/assets/tessdata/chi_sim.traineddata.gz +0 -0
  21. package/skills/document/assets/tessdata/eng.traineddata.gz +0 -0
  22. package/skills/document/bin/deck-build.cjs +2311 -41
  23. package/skills/document/bin/deck-chart.cjs +762 -0
  24. package/skills/document/bin/deck-plan.cjs +802 -0
  25. package/skills/document/bin/deck-qa.cjs +984 -249
  26. package/skills/document/bin/deck-scenario.cjs +1346 -0
  27. package/skills/document/bin/doc-convert.cjs +130 -39
  28. package/skills/document/bin/doc-fill.cjs +73121 -170
  29. package/skills/document/bin/doc-gen.cjs +625 -68
  30. package/skills/document/bin/doc-run.cjs +162 -24
  31. package/skills/document/bin/doc-scan.cjs +13 -0
  32. package/skills/document/bin/doc-text.cjs +13 -0
  33. package/skills/document/bin/doc-validate.cjs +718 -23
  34. package/skills/document/bin/doc-xml.cjs +9 -5
  35. package/skills/document/bin/docx-annotate.cjs +95 -19
  36. package/skills/document/bin/fontkit.cjs +1 -0
  37. package/skills/document/bin/html2pptx.cjs +1372 -121
  38. package/skills/document/bin/ocr-worker.cjs +1 -0
  39. package/skills/document/bin/ocr.cjs +131 -40
  40. package/skills/document/bin/pdf-form.cjs +674 -177
  41. package/skills/document/bin/pdf-images.cjs +13 -0
  42. package/skills/document/bin/pdf-ops.cjs +634 -199
  43. package/skills/document/bin/pdf-render.cjs +19 -3
  44. package/skills/document/bin/pdf-tables.cjs +13 -0
  45. package/skills/document/bin/pptx-clone.cjs +3 -3
  46. package/skills/document/bin/pptx-slide.cjs +3 -3
  47. package/skills/document/bin/xlsx-query.cjs +192 -61
  48. package/skills/document/bin-reference.md +56 -33
  49. package/skills/document/content-pipeline.md +129 -242
  50. package/skills/document/deck-design.md +355 -638
  51. package/skills/document/layouts/README.md +46 -33
  52. package/skills/document/layouts/capacity.json +1 -0
  53. package/skills/document/layouts/slots.json +1 -1
  54. package/skills/document/layouts/toc-panel.tpl +1 -1
  55. package/skills/document/motion/README.md +3 -2
  56. package/skills/document/office.md +3 -3
  57. package/skills/document/packs/board-brief/backdrop.html +2 -0
  58. package/skills/document/packs/board-brief/pack.css +2 -1
  59. package/skills/document/packs/mckinsey-photo/backdrop.html +2 -0
  60. package/skills/document/packs/mckinsey-photo/pack.css +2 -1
  61. package/skills/document/packs/press-room/backdrop.html +2 -0
  62. package/skills/document/packs/press-room/pack.css +2 -1
  63. package/skills/document/packs/prismatic-3d/backdrop.html +2 -0
  64. package/skills/document/packs/prismatic-3d/pack.css +4 -1
  65. package/skills/document/pdf.md +53 -49
  66. package/skills/document/rewrite.md +241 -308
  67. package/skills/document/scenarios.json +1290 -0
  68. package/skills/document/scenarios.schema.json +103 -0
  69. package/skills/document/styles/README.md +15 -25
  70. package/skills/document/styles/_contract-defaults.css +25 -1
  71. package/skills/document/styles/anthropic/skin.css +6 -3
  72. package/skills/document/styles/apple/skin.css +4 -3
  73. package/skills/document/styles/bistro-warm/backdrop.html +2 -0
  74. package/skills/document/styles/bistro-warm/skin.css +4 -1
  75. package/skills/document/styles/black-gold/skin.css +6 -5
  76. package/skills/document/styles/bold-clash/backdrop.html +2 -0
  77. package/skills/document/styles/bold-clash/skin.css +2 -1
  78. package/skills/document/styles/branding/skin.css +4 -4
  79. package/skills/document/styles/campus-teal/backdrop.html +2 -0
  80. package/skills/document/styles/campus-teal/skin.css +2 -1
  81. package/skills/document/styles/cinereel/skin.css +7 -3
  82. package/skills/document/styles/clinic-care/backdrop.html +2 -0
  83. package/skills/document/styles/clinic-care/skin.css +2 -1
  84. package/skills/document/styles/cool/skin.css +6 -5
  85. package/skills/document/styles/dark-glass/backdrop.html +2 -0
  86. package/skills/document/styles/dark-glass/skin.css +2 -1
  87. package/skills/document/styles/gov-brief/backdrop.html +2 -0
  88. package/skills/document/styles/gov-brief/skin.css +2 -1
  89. package/skills/document/styles/grid-tech/backdrop.html +2 -0
  90. package/skills/document/styles/grid-tech/skin.css +2 -1
  91. package/skills/document/styles/hand-drawn/skin.css +3 -3
  92. package/skills/document/styles/ivory-gold/skin.css +7 -6
  93. package/skills/document/styles/legal-slate/backdrop.html +2 -0
  94. package/skills/document/styles/legal-slate/skin.css +2 -1
  95. package/skills/document/styles/magazine-ink/skin.css +4 -3
  96. package/skills/document/styles/mckinsey/skin.css +2 -1
  97. package/skills/document/styles/memphis/backdrop.html +2 -0
  98. package/skills/document/styles/memphis/skin.css +2 -1
  99. package/skills/document/styles/mono/skin.css +6 -2
  100. package/skills/document/styles/neon-cyber/backdrop.html +2 -0
  101. package/skills/document/styles/neon-cyber/skin.css +2 -1
  102. package/skills/document/styles/olive-gold/skin.css +7 -6
  103. package/skills/document/styles/organic-earth/backdrop.html +2 -0
  104. package/skills/document/styles/organic-earth/skin.css +2 -1
  105. package/skills/document/styles/pastel-saas/backdrop.html +2 -0
  106. package/skills/document/styles/pastel-saas/skin.css +2 -1
  107. package/skills/document/styles/portfolio-noir/backdrop.html +2 -0
  108. package/skills/document/styles/portfolio-noir/skin.css +2 -1
  109. package/skills/document/styles/retro-press/backdrop.html +2 -0
  110. package/skills/document/styles/retro-press/skin.css +2 -1
  111. package/skills/document/styles/sport-arena/backdrop.html +2 -0
  112. package/skills/document/styles/sport-arena/skin.css +4 -1
  113. package/skills/document/styles/swiss-grid/skin.css +10 -5
  114. package/skills/document/styles/wedding-blush/backdrop.html +2 -0
  115. package/skills/document/styles/wedding-blush/skin.css +4 -1
  116. package/skills/document/theme-system.md +85 -77
  117. package/skills/document/themes/README.md +7 -5
  118. package/skills/document/vision.md +8 -5
  119. package/skills/document/xlsx.md +15 -25
@@ -1,102 +1,110 @@
1
1
  # Theme V2 — composable deck design system
2
2
 
3
- Theme V2 separates five decisions that the old pack model coupled together:
3
+ This file is the single source for **which entries take Theme V2, what it adds, and
4
+ the spec fields that control it**. Theme V2 separates five decisions:
4
5
 
5
6
  1. **Theme** (`style`) — palette, typography, background and family identity.
6
- 2. **Component profile** — cards, metrics, pricing, quotes, tables, badges and data UI.
7
- 3. **Media style** — product/device, editorial photo, collage, illustration or cinematic treatment.
8
- 4. **Art direction** — large color fields, pattern language, decorative geometry and page atmosphere.
9
- 5. **Layout + recipe** — content geometry per slide and narrative order per deck.
10
-
11
- `theme-system.json` binds every existing catalog id to one component profile, one
12
- default media style and one art direction. A deck can override only the media treatment;
13
- art direction remains part of the Theme identity and layout selection stays separate.
14
-
15
- Component profiles: `clean`, `glass`, `editorial`, `poster`, `organic`, `luxury`.
16
- They alter radius, border weight, depth, surface behavior, label typography and emphasis
17
- patterns across the full semantic component contract (cards, KPI, proof, pricing, quote,
18
- table, chart, workflow, funding and CTA).
19
-
20
- Media styles: `clean-product`, `device-stage`, `editorial-photo`, `cutout-collage`,
21
- `illustrated`, `cinematic`, `spatial-3d`. They can be changed independently for a deck or
22
- a bespoke page while the Theme's color, type, background and component grammar remain.
23
-
24
- Art directions: `geometric-pop`, `gradient-mesh`, `editorial-cut`, `collage-paper`,
25
- `illustrated-doodle`, `cinematic-depth`, `luxury-ornament`, `technical-grid`,
26
- `maximalist-blocks`. The renderer injects a decoration-only backdrop canvas for these
27
- profiles. Each uses the selected family's full `--c1`…`--c4` ramp rather than only its
28
- accent, so Theme differences include composition and motif—not merely hue.
7
+ 2. **Component profile** — `clean` · `glass` · `editorial` · `poster` · `organic` ·
8
+ `luxury`: radius, border weight, depth, surfaces, labels and emphasis across the
9
+ semantic components (cards, KPI, proof, pricing, quote, table, chart, workflow,
10
+ funding, CTA).
11
+ 3. **Media style** — `clean-product` · `device-stage` · `editorial-photo` ·
12
+ `cutout-collage` · `illustrated` · `cinematic` · `spatial-3d`. The only layer a deck
13
+ may override (`mediaStyle` / `--media-style`); colour, type, background and component
14
+ grammar stay the Theme's.
15
+ 4. **Art direction** — `geometric-pop` · `gradient-mesh` · `editorial-cut` ·
16
+ `collage-paper` · `illustrated-doodle` · `cinematic-depth` · `luxury-ornament` ·
17
+ `technical-grid` · `maximalist-blocks`: a decoration-only backdrop canvas that uses
18
+ the family's whole `--c1`…`--c4` ramp. Part of the Theme identity — not overridable.
19
+ 5. **Layout + recipe** — content geometry per slide (layouts/README.md) and narrative
20
+ order per deck (`recipes/`). Never chosen by the Theme.
21
+
22
+ `theme-system.json` binds every catalog id to one component profile, one default media
23
+ style and one art direction.
24
+
25
+ ## Which entries take it — classic-v1 vs V2
26
+
27
+ - Entries in a `catalog.json` collection with `renderMode:"classic-v1"` (today
28
+ `original-13`, frozen at commit `7306d8e5`; its `entryIds` are the list) render V1: omit `themeVersion`, `mediaStyle`, `decorRhythm`, per-slide
29
+ `scene`/`decorDensity` and every layout in `layouts/profiles.json.themeV2Layouts`;
30
+ render with `--style <id>` and never `--theme-v2`. `deck-build` (exit 64) and
31
+ `html2pptx` reject the attempt. They keep current bug/font/contrast fixes; samples and
32
+ fidelity baselines are V1.
33
+ - Every other newly authored deck sets `"themeVersion":2` and renders with
34
+ `--style <id> --theme-v2 [--media-style <id>]`. `--theme-v2` needs a catalog id
35
+ (not an explicit style directory or a user style); `--media-style` needs `--theme-v2`.
36
+ - The ten `themeV2Layouts` use the semantic component contract and require
37
+ `themeVersion:2`; every older layout works in both. `themeVersion:2` never changes
38
+ which layout a slide uses.
39
+ - Under `--theme-v2` html2pptx does not auto-pick a shared backdrop variant (the art
40
+ direction owns the backdrop); an explicit `--backdrop` still wins.
29
41
 
30
42
  ## Page scenes and deck rhythm
31
43
 
32
- `deck-build` maps each slide intent to one visual scene: `hero`, `content`, `data`,
33
- `media` or `closing`. The scene controls which art-direction motifs remain visible;
34
- `decorDensity` (`low`, `medium`, `high`) controls their combined intensity. With the
35
- default `decorRhythm:"auto"`, adjacent high-intensity pages are softened, long medium
36
- runs receive a low beat, and repeated scenes cycle deterministic motif variants.
37
-
38
- Authors normally provide only `intent`. Use a per-slide `scene` or `decorDensity` only
39
- for a deliberate override. Set top-level `decorRhythm:"steady"` to keep the intent
40
- profile's density unchanged. These fields require `themeVersion:2` and never select or
41
- rewrite a layout.
44
+ `deck-build` maps each slide's `intent` to one scene — `hero`, `content`, `data`,
45
+ `media` or `closing` — which decides the art-direction motifs shown; `decorDensity`
46
+ (`low`/`medium`/`high`) sets their intensity. With the default `decorRhythm:"auto"`,
47
+ adjacent high-intensity pages are softened, long medium runs get a low beat and
48
+ repeated scenes cycle motif variants. Normally give only `intent`; a per-slide `scene`
49
+ or `decorDensity` is a deliberate override, and top-level `decorRhythm:"steady"` keeps
50
+ each intent's density. These fields require `themeVersion:2` and never pick a layout.
42
51
 
43
52
  ```json
44
53
  {
45
- "style": "cool",
54
+ "style": "neon-cyber",
46
55
  "scenario": "发布会",
47
56
  "themeVersion": 2,
48
- "decorRhythm": "auto",
49
57
  "mediaStyle": "device-stage",
50
58
  "layoutPack": "none",
51
59
  "slides": [
52
- {"intent":"problem", "layout":"pitch-problem", "slots":{}},
53
- {"intent":"product-demo", "layout":"product-device", "slots":{}}
60
+ {"intent": "problem", "layout": "pitch-problem", "slots": {
61
+ "eyebrow": "THE PROBLEM", "title": "对账每月吃掉财务团队一周", "stat": "38h", "stat_label": "每月人工对账", "stat_note": "50 家受访客户中位数",
62
+ "point1_title": "数据分散", "point1_body": "银行、ERP、表格三处来源",
63
+ "point2_title": "规则靠人记", "point2_body": "例外处理无沉淀",
64
+ "point3_title": "出错难追溯", "point3_body": "审计时逐笔翻查",
65
+ "footer": "", "pageno": ""}},
66
+ {"intent": "product-demo", "layout": "product-device", "slots": {
67
+ "eyebrow": "PRODUCT", "title": "一键完成三方对账", "body": "接入银行流水与 ERP,规则自动匹配,例外进入待办",
68
+ "feature1": "自动匹配 95% 流水", "feature2": "例外一键分派", "feature3": "全程留痕可审计",
69
+ "media_label": "", "screen_title": "对账工作台", "screen_note": "",
70
+ "footer": "", "pageno": ""}}
54
71
  ]
55
72
  }
56
73
  ```
57
74
 
58
- `deck-build` emits the matching render command:
75
+ Every slot is filled (`""` blanks one on purpose): an omitted slot renders the layout's
76
+ demo copy and `deck-build` warns. The build result's `next` is the matching render
77
+ command:
59
78
 
60
79
  ```sh
61
- html2pptx deck.html out.pptx --style cool --theme-v2 --media-style device-stage
80
+ html2pptx deck.html out.pptx --style neon-cyber --theme-v2 --media-style device-stage
62
81
  ```
63
82
 
83
+ ## Layout selection and packs
84
+
85
+ Match content to layouts through `layouts/profiles.json` (intent → candidates, density,
86
+ item cap, media requirement) — `deck-plan` does it for you. `deck-build` warns when an
87
+ explicit layout is outside the intent's candidates and errors on an unknown intent.
88
+
89
+ `layoutPack` is independent of the Theme. `kind:"pack"` entries (`packs/README.md`)
90
+ ship same-name signature layouts: a spec that omits `layoutPack` keeps the legacy
91
+ behaviour (a pack style implicitly uses them); new specs state `layoutPack:"<pack>"`
92
+ or `"none"` (shared layouts only).
93
+
94
+ `recipes/` hold pitch narratives as roles, not fixed pages, so one story renders in
95
+ any Theme.
96
+
64
97
  ## Compatibility
65
98
 
66
- - Existing `{style:"cool"}` specs and `html2pptx --style cool` calls remain V1 and
67
- render exactly as before.
68
- - `catalog.json` collection `original-13` freezes the initial roster at commit
69
- `7306d8e5` with `renderMode:"classic-v1"`. Those entries keep current bug/font/contrast
70
- fixes but reject `themeVersion:2`, `--theme-v2`, media overrides, scene controls and
71
- Theme V2-only layouts. Their samples and fidelity cover baselines are rendered in V1.
72
- - `themeVersion:2` adds component, media and art-direction layers; it does not change
73
- the selected layout.
74
- - Existing `{style:"press-room"}` keeps the legacy implicit same-name layout pack.
75
- New specs should state `layoutPack:"press-room"` or `layoutPack:"none"` explicitly.
76
- - `--theme <theme.json>` is a different legacy document recolor path and is not Theme V2.
77
-
78
- ## Content-first layout selection
79
-
80
- Use `layouts/profiles.json`. Match `intent`, then check density, item capacity and media
81
- requirement before selecting a candidate. `deck-build` warns when a slide's explicit
82
- layout is outside the candidate list and errors on unknown intents. It never forces a
83
- layout merely because a visual Theme was selected.
84
-
85
- The ten layouts listed in `themeV2Layouts` use the new semantic component contract and
86
- therefore require `themeVersion:2`; `deck-build` rejects a V1 attempt before writing HTML.
87
- All pre-existing layouts remain valid in both V1 and V2.
88
-
89
- Pitch recipes live in `recipes/`. They describe narrative roles, not fixed visual pages,
90
- so the same fundraising story can render in a clean consulting Theme, neon product Theme
91
- or editorial Theme without changing its content contract.
92
-
93
- ## Coverage and provenance
94
-
95
- The 18 pitch intents cover problem, solution, product, market, competition, business
96
- model, pricing, traction, go-to-market, economics, financials, proof, team, ask and close.
97
- The visual archetypes are clean-room abstractions informed by broad category patterns,
98
- including the SlidesCarnival pitch-deck index: geometric color fields, gradient/3D depth,
99
- editorial cropping, paper collage, illustration/doodles, ornament, grids and maximalist
100
- blocks. Do not copy third-party template assets or page geometry. SlidesCarnival templates
101
- are CC BY 4.0 and embedded photos may carry separate licenses; importing an actual template
102
- requires preserving attribution and asset credits.
99
+ - `{style:"<id>"}` without `themeVersion`, and `html2pptx --style <id>` without
100
+ `--theme-v2`, stay V1 and render exactly as before.
101
+ - `--theme <theme.json>` is the legacy document-recolor path, not Theme V2, and it does
102
+ not repaint a `--style` deck (the skin's tokens win).
103
+
104
+ ## Provenance
105
+
106
+ The 18 pitch intents (problem … ask, close) and the visual archetypes are clean-room
107
+ abstractions of broad category patterns (incl. the SlidesCarnival index). Do not copy
108
+ third-party template assets or page geometry; SlidesCarnival templates are CC BY 4.0
109
+ and their photos may carry separate licenses — importing one requires keeping
110
+ attribution and asset credits.
@@ -9,14 +9,14 @@
9
9
 
10
10
  | 主题 | 配对家族 | 基调 | 适用场景 |
11
11
  |---|---|---|---|
12
- | **cool-tech**(默认) | `cool` | 深海军蓝 + 蓝青辉光(深色 deck) | 科技/发布/pitch/keynote —— 默认酷炫 |
12
+ | **cool-tech** | `cool` | 深海军蓝 + 蓝青辉光(深色 deck) | 科技/发布/pitch/keynote |
13
13
  | **apple-keynote** | `apple` | 纯黑 + 单色近白(深色 deck) | 产品发布、keynote、极简演示:超大字、大留白、无彩色 |
14
14
  | **mckinsey-consulting** | `mckinsey` | 白底 + 深藏青 + 克制亮蓝 | 咨询/战略汇报、评审、董事会;**报告/docx 默认** |
15
15
  | **anthropic-clay** | `anthropic` | 奶油底 + 赤陶珊瑚(暖) | AI/产品、温暖人文品牌、研究分享:衬线标题、有深度 |
16
16
  | **black-gold** | `black-gold` | 纯黑 + 金辉光 + 衬线金字 | 金融/年报/路演/奢侈品/高端商务 |
17
17
  | **hand-drawn** | `hand-drawn` | 纸感 + 手绘描边 + 马克笔色 | 创意/头脑风暴/教学/工作坊 |
18
18
  | **mono** | `mono` | 纯白 + 黑灰 + 细线 + 大留白 | 极简/高端/设计;**clean/light 默认** |
19
- | **warm-editorial** | `warm` | 奶油 + 陶土橙 + 衬线 | 品牌/咨询/报告暖调 |
19
+ | **warm-editorial** | —(无同名 deck 风格) | 奶油 + 陶土橙 + 衬线 | 品牌/咨询/报告暖调 |
20
20
  | **ivory-gold** | `ivory-gold` | 奶油底 + 青铜金 Anton 粗体大写标题 + 黑色反色区块 | 奢华极简/品牌手册/路演/高端零售 |
21
21
  | **cinereel** | `cinereel` | 黑底/照片底 + 白色 Anton 粗体大写(无色相)+ 常驻胶片取景框 | 影视/创意作品集/音乐传媒行业/幕后花絮 |
22
22
  | **magazine-ink** | `magazine-ink` | 瓷白底 + 靛蓝 Noto Serif SC 衬线大标题 + 无阴影无卡片盒 | 人文分享/行业观察/商业发布/杂志感演讲 |
@@ -26,9 +26,11 @@
26
26
  白纸 + 品牌色标题。具名"风格"主题只设 `fonts.heading`(Latin 标题生效、CJK 自动回退,
27
27
  正文留空走引擎栈保 CJK)。
28
28
 
29
- **用户自建主题放 `themes/custom/`**(资源更新永不触碰;选型时优先查它),文件名
30
- kebab-case、带 `bestFor`。确认过的偏好写入 agent memory,下次直接用(见 rewrite.md
31
- "Picking a theme")。
29
+ **用户自建主题保存到 `$TALOS_DOC_STYLES_DIR/themes/<名>.json`**(kebab-case、带
30
+ `bestFor`),之后用 `--theme <名>` 按名字套用。这是用户自己的风格目录,跨会话保留、所有
31
+ 专家共用;**不要写进 skill 目录**——它是带完整性校验的安装包,内容一变就会被隔离重装,
32
+ 写进去的文件随之丢失。确认过的偏好写入 agent memory,下次直接用(见 rewrite.md
33
+ "Themes" 的 Choosing with the user)。
32
34
 
33
35
  > 更多纯配色变体(arctic-frost / ocean-depths / golden-hour / chinese-ink 等 17 套)已
34
36
  > **退役到 `apps/admin/data/deck-template-backup/retired-themes/`** —— 它们只是同布局换色,
@@ -6,8 +6,9 @@ loses.
6
6
 
7
7
  ## Steps
8
8
 
9
- 1. `bin/pdf-render file.pdf <pages>` — `<pages>` is a single page (`4`) or a
10
- range (`2-6`). It writes PNGs and prints their paths.
9
+ 1. `bin/pdf-render.cjs file.pdf <pages> [scale]` — `<pages>` is `4`, `2-6`, `3,7-8`
10
+ or `all`; PNGs land beside the PDF (`<stem>_p<N>.png`) and their paths are printed.
11
+ Keep the default scale `2` for formulas and fine print; `1` is enough for layout.
11
12
  2. Look at each PNG. For:
12
13
  - **Formulas** → transcribe to LaTeX from the image.
13
14
  - **Tables** → read the table structure directly; report values row/column.
@@ -25,9 +26,11 @@ render that page here and read it visually instead.
25
26
  When the model has **no** image modality but the page is scanned, OCR the raster
26
27
  instead of guessing:
27
28
 
28
- 1. `bin/pdf-render file.pdf <page>` → PNG.
29
- 2. `bin/ocr <page.png> [lang]` → `{ text, confidence }`. Report low confidence
30
- honestly. Set `$TALOS_TESSDATA` to a dir to cache/serve language data offline.
29
+ 1. `bin/pdf-render.cjs file.pdf <page>` → PNG.
30
+ 2. `bin/ocr.cjs <page.png> [lang]` → `{ text, confidence }` (`lang` default `eng`).
31
+ Report low confidence honestly. Chinese: `chi_sim` (or `chi_sim+eng` for mixed
32
+ text; `chi_tra` traditional). `eng` and `chi_sim` are bundled and work offline;
33
+ other languages download once into `$TALOS_TESSDATA`.
31
34
 
32
35
  Prefer vision when it is available — OCR loses layout and struggles with
33
36
  formulas. Use OCR only as the text-only fallback.
@@ -7,7 +7,7 @@ files.
7
7
  ## Steps
8
8
 
9
9
  1. `bin/xlsx-query file.xlsx --summary` → per-sheet shape (name, row/col counts,
10
- headers). Decide which sheet + column the question is about.
10
+ `headerRow`, headers). Decide which sheet + column the question is about.
11
11
  2. Aggregate: `bin/xlsx-query file.xlsx --agg <sheet> <column> <op>` where `op` ∈
12
12
  `sum | avg | min | max | count | count-nonempty`. `<column>` may be a header
13
13
  label or a 1-based index.
@@ -16,31 +16,21 @@ files.
16
16
 
17
17
  ## Notes / boundaries
18
18
 
19
- - Non-numeric cells are ignored by `sum/avg/min/max`; `value:null` means no
20
- numeric cells qualified — report that rather than guessing 0.
19
+ - The header row is detected: the first mostly-text row (of the first ~10) whose next
20
+ row has numbers, so a title row above the table is skipped — check `headerRow`;
21
+ `--header-row N` (1-based sheet row) overrides it.
22
+ - `--agg` leaves total rows out — a cell reading 合计 / 总计 / 小计 / Total / Subtotal /
23
+ Sum, or a `SUM` over the same column — and lists them in `excludedRows`;
24
+ `--include-totals` keeps them.
25
+ - Numbers: numeric cells use their stored value (a cell shown as `15%` is 0.15). In
26
+ text cells `¥ ¥ $ € £`, commas, spaces and a trailing `元` are stripped; `15%` → 0.15,
27
+ `(300)` → −300. Sums/averages are rounded to 15 significant digits (no `0.1+0.2` noise).
28
+ - Non-numeric cells are ignored by `sum/avg/min/max` and listed in `skippedCells`
29
+ (first 20; `skippedCellCount` is the total); `value:null` means no numeric cells
30
+ qualified — report that rather than guessing 0.
21
31
  - A missing/misnamed column returns `value:null` with `colIdx:-1`; check headers
22
32
  first via `--summary`.
23
- - Currency/percent strings (`$1,200`, `15%`) are coerced to numbers.
24
33
  - For pivots or multi-column math beyond these ops, read rows with `--sample`
25
34
  and compute in a short script, or ask for the specific cut.
26
-
27
- ## Writing formulas (the repair loop — mandatory)
28
-
29
- When you GENERATE or EDIT a spreadsheet, use live formulas (`"=SUM(A2:A9)"`),
30
- never precomputed values — the file must recalculate when the user edits data.
31
- Then close the loop:
32
-
33
- 1. `bin/xlsx-recalc.cjs out.xlsx out.xlsx` — evaluates every formula and caches
34
- results (openpyxl-class writers leave them blank).
35
- 2. The output's `errors` array must be **empty**. Any `#DIV/0!`, `#REF!`, `#N/A`
36
- → fix the formula (guard divisors with IF, correct the range) and re-run
37
- recalc. **Never deliver a spreadsheet with formula errors**, and never
38
- "fix" one by replacing the formula with a hardcoded value.
39
-
40
- ## Known engine limits (HyperFormula vs LibreOffice recalc)
41
-
42
- `xlsx-recalc` covers ~400 functions — all common math/stat/text/date/lookup.
43
- Known gaps vs a full Excel/LibreOffice engine: some exotic financial functions
44
- and dynamic-array spilling. If recalc reports `#NAME?` on a function you know is
45
- valid Excel, that is an engine limit — say so and compute that cell's value via
46
- `xlsx-query`/script instead of guessing.
35
+ - **Generating or editing** a workbook (formulas, the `xlsx-recalc` repair loop) →
36
+ rewrite.md "Formulas".