odforge 0.3.0__tar.gz
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.
- odforge-0.3.0/.gitignore +13 -0
- odforge-0.3.0/LICENSE +21 -0
- odforge-0.3.0/PKG-INFO +95 -0
- odforge-0.3.0/README.md +33 -0
- odforge-0.3.0/constraints.txt +73 -0
- odforge-0.3.0/hatch_build.py +120 -0
- odforge-0.3.0/pyproject.toml +157 -0
- odforge-0.3.0/skills/odforge-design/SKILL.md +298 -0
- odforge-0.3.0/skills/odforge-design/themes/academic.md +52 -0
- odforge-0.3.0/skills/odforge-design/themes/clay.md +53 -0
- odforge-0.3.0/skills/odforge-design/themes/color-system.md +59 -0
- odforge-0.3.0/skills/odforge-design/themes/crimson.md +53 -0
- odforge-0.3.0/skills/odforge-design/themes/dark.md +53 -0
- odforge-0.3.0/skills/odforge-design/themes/forest.md +54 -0
- odforge-0.3.0/skills/odforge-design/themes/gold.md +53 -0
- odforge-0.3.0/skills/odforge-design/themes/minimal.md +53 -0
- odforge-0.3.0/skills/odforge-design/themes/navy.md +56 -0
- odforge-0.3.0/skills/odforge-design/themes/plum.md +53 -0
- odforge-0.3.0/skills/odforge-design/themes/sky.md +53 -0
- odforge-0.3.0/skills/odforge-design/themes/slate.md +53 -0
- odforge-0.3.0/skills/odforge-design/themes/teal.md +53 -0
- odforge-0.3.0/skills/odforge-design/themes/violet.md +56 -0
- odforge-0.3.0/src/odforge/__init__.py +1 -0
- odforge-0.3.0/src/odforge/benchmark.py +287 -0
- odforge-0.3.0/src/odforge/check.py +416 -0
- odforge-0.3.0/src/odforge/cli.py +1027 -0
- odforge-0.3.0/src/odforge/components.py +270 -0
- odforge-0.3.0/src/odforge/critic.py +1260 -0
- odforge-0.3.0/src/odforge/docfonts.py +104 -0
- odforge-0.3.0/src/odforge/editor_api.py +33 -0
- odforge-0.3.0/src/odforge/editor_launch.py +134 -0
- odforge-0.3.0/src/odforge/editor_routes.py +131 -0
- odforge-0.3.0/src/odforge/extract.py +478 -0
- odforge-0.3.0/src/odforge/feedback.py +86 -0
- odforge-0.3.0/src/odforge/fontembed.py +166 -0
- odforge-0.3.0/src/odforge/ir.py +1181 -0
- odforge-0.3.0/src/odforge/layoutcheck.py +602 -0
- odforge-0.3.0/src/odforge/llm.py +1865 -0
- odforge-0.3.0/src/odforge/localguard.py +42 -0
- odforge-0.3.0/src/odforge/mcp_server.py +552 -0
- odforge-0.3.0/src/odforge/media.py +352 -0
- odforge-0.3.0/src/odforge/odpedit.py +1219 -0
- odforge-0.3.0/src/odforge/package.py +114 -0
- odforge-0.3.0/src/odforge/pagefacts.py +388 -0
- odforge-0.3.0/src/odforge/preview.py +104 -0
- odforge-0.3.0/src/odforge/references.py +153 -0
- odforge-0.3.0/src/odforge/render/__init__.py +40 -0
- odforge-0.3.0/src/odforge/render/odp.py +5687 -0
- odforge-0.3.0/src/odforge/render/ods.py +155 -0
- odforge-0.3.0/src/odforge/render/odt.py +223 -0
- odforge-0.3.0/src/odforge/scene.py +657 -0
- odforge-0.3.0/src/odforge/setup_agents.py +274 -0
- odforge-0.3.0/src/odforge/templates.py +250 -0
- odforge-0.3.0/src/odforge/textmetrics.py +616 -0
- odforge-0.3.0/src/odforge/textutil.py +24 -0
- odforge-0.3.0/src/odforge/themes.py +886 -0
- odforge-0.3.0/src/odforge/validate.py +403 -0
- odforge-0.3.0/src/odforge/watch.py +266 -0
- odforge-0.3.0/src/odforge/webapi.py +2617 -0
- odforge-0.3.0/src/odforge/xmlsafe.py +46 -0
- odforge-0.3.0/src/odforge/zipguard.py +91 -0
- odforge-0.3.0/tests/conftest.py +232 -0
- odforge-0.3.0/tests/test_benchmark.py +112 -0
- odforge-0.3.0/tests/test_check.py +211 -0
- odforge-0.3.0/tests/test_cli.py +1039 -0
- odforge-0.3.0/tests/test_critic.py +1498 -0
- odforge-0.3.0/tests/test_deck_quality.py +686 -0
- odforge-0.3.0/tests/test_editor.py +677 -0
- odforge-0.3.0/tests/test_editor_launch.py +45 -0
- odforge-0.3.0/tests/test_extract.py +363 -0
- odforge-0.3.0/tests/test_integration_pipeline.py +208 -0
- odforge-0.3.0/tests/test_ir.py +772 -0
- odforge-0.3.0/tests/test_layoutcheck.py +212 -0
- odforge-0.3.0/tests/test_llm.py +1609 -0
- odforge-0.3.0/tests/test_localguard.py +37 -0
- odforge-0.3.0/tests/test_mcp.py +453 -0
- odforge-0.3.0/tests/test_media.py +74 -0
- odforge-0.3.0/tests/test_package.py +91 -0
- odforge-0.3.0/tests/test_pagefacts.py +227 -0
- odforge-0.3.0/tests/test_preview.py +78 -0
- odforge-0.3.0/tests/test_render_odp.py +2915 -0
- odforge-0.3.0/tests/test_render_ods.py +151 -0
- odforge-0.3.0/tests/test_render_odt.py +76 -0
- odforge-0.3.0/tests/test_setup_agents.py +120 -0
- odforge-0.3.0/tests/test_sources.py +184 -0
- odforge-0.3.0/tests/test_templates.py +330 -0
- odforge-0.3.0/tests/test_textmetrics.py +163 -0
- odforge-0.3.0/tests/test_validate.py +469 -0
- odforge-0.3.0/tests/test_watch.py +189 -0
- odforge-0.3.0/tests/test_webapi.py +2753 -0
- odforge-0.3.0/tests/test_zipguard.py +58 -0
- odforge-0.3.0/web/editor.html +12 -0
- odforge-0.3.0/web/index.html +23 -0
- odforge-0.3.0/web/package-lock.json +2255 -0
- odforge-0.3.0/web/package.json +34 -0
- odforge-0.3.0/web/src/App.test.tsx +808 -0
- odforge-0.3.0/web/src/App.tsx +541 -0
- odforge-0.3.0/web/src/components/ConfirmBar.test.tsx +36 -0
- odforge-0.3.0/web/src/components/ConfirmBar.tsx +43 -0
- odforge-0.3.0/web/src/components/DiscoveryPanel.test.tsx +291 -0
- odforge-0.3.0/web/src/components/DiscoveryPanel.tsx +356 -0
- odforge-0.3.0/web/src/components/DownloadDock.test.tsx +31 -0
- odforge-0.3.0/web/src/components/DownloadDock.tsx +27 -0
- odforge-0.3.0/web/src/components/ErrorPanel.test.tsx +37 -0
- odforge-0.3.0/web/src/components/ErrorPanel.tsx +30 -0
- odforge-0.3.0/web/src/components/GateRail.test.tsx +87 -0
- odforge-0.3.0/web/src/components/GateRail.tsx +183 -0
- odforge-0.3.0/web/src/components/HomeDashboard.test.tsx +147 -0
- odforge-0.3.0/web/src/components/HomeDashboard.tsx +190 -0
- odforge-0.3.0/web/src/components/OutlineRail.test.tsx +124 -0
- odforge-0.3.0/web/src/components/OutlineRail.tsx +125 -0
- odforge-0.3.0/web/src/components/PreviewStage.tsx +67 -0
- odforge-0.3.0/web/src/components/PromptBar.test.tsx +727 -0
- odforge-0.3.0/web/src/components/PromptBar.tsx +762 -0
- odforge-0.3.0/web/src/components/SideNav.tsx +48 -0
- odforge-0.3.0/web/src/components/StatusNarrator.tsx +77 -0
- odforge-0.3.0/web/src/components/TemplateGallery.test.tsx +226 -0
- odforge-0.3.0/web/src/components/TemplateGallery.tsx +509 -0
- odforge-0.3.0/web/src/components/TemplatesPage.tsx +17 -0
- odforge-0.3.0/web/src/components/UnitCell.tsx +62 -0
- odforge-0.3.0/web/src/components/UnitDetail.test.tsx +152 -0
- odforge-0.3.0/web/src/components/UnitDetail.tsx +165 -0
- odforge-0.3.0/web/src/components/WaitingCard.tsx +53 -0
- odforge-0.3.0/web/src/components/display.test.tsx +124 -0
- odforge-0.3.0/web/src/components/preview.test.tsx +108 -0
- odforge-0.3.0/web/src/main.tsx +5 -0
- odforge-0.3.0/web/src/next/Bars.tsx +306 -0
- odforge-0.3.0/web/src/next/Canvas.tsx +668 -0
- odforge-0.3.0/web/src/next/Comments.tsx +192 -0
- odforge-0.3.0/web/src/next/EditorApp.tsx +626 -0
- odforge-0.3.0/web/src/next/Elements.tsx +93 -0
- odforge-0.3.0/web/src/next/PageList.tsx +103 -0
- odforge-0.3.0/web/src/next/SlideView.test.tsx +52 -0
- odforge-0.3.0/web/src/next/SlideView.tsx +474 -0
- odforge-0.3.0/web/src/next/api.ts +94 -0
- odforge-0.3.0/web/src/next/editor.css +299 -0
- odforge-0.3.0/web/src/next/geometry.test.ts +155 -0
- odforge-0.3.0/web/src/next/geometry.ts +416 -0
- odforge-0.3.0/web/src/next/main.tsx +10 -0
- odforge-0.3.0/web/src/next/richtext.test.ts +29 -0
- odforge-0.3.0/web/src/next/richtext.ts +235 -0
- odforge-0.3.0/web/src/next/types.ts +161 -0
- odforge-0.3.0/web/src/smoke.test.ts +5 -0
- odforge-0.3.0/web/src/state/api.test.ts +349 -0
- odforge-0.3.0/web/src/state/api.ts +538 -0
- odforge-0.3.0/web/src/state/cockpit.test.ts +300 -0
- odforge-0.3.0/web/src/state/cockpit.ts +148 -0
- odforge-0.3.0/web/src/state/discovery.test.ts +46 -0
- odforge-0.3.0/web/src/state/discovery.ts +38 -0
- odforge-0.3.0/web/src/state/errors.test.ts +18 -0
- odforge-0.3.0/web/src/state/errors.ts +21 -0
- odforge-0.3.0/web/src/state/mockStream.test.ts +22 -0
- odforge-0.3.0/web/src/state/mockStream.ts +45 -0
- odforge-0.3.0/web/src/state/sse.test.ts +115 -0
- odforge-0.3.0/web/src/state/sse.ts +62 -0
- odforge-0.3.0/web/src/state/subscribe.test.ts +78 -0
- odforge-0.3.0/web/src/state/taskName.test.ts +33 -0
- odforge-0.3.0/web/src/state/taskName.ts +18 -0
- odforge-0.3.0/web/src/state/throttle.test.ts +129 -0
- odforge-0.3.0/web/src/state/throttle.ts +115 -0
- odforge-0.3.0/web/src/state/types.ts +105 -0
- odforge-0.3.0/web/src/styles/app.css +3859 -0
- odforge-0.3.0/web/src/styles/layout.test.ts +121 -0
- odforge-0.3.0/web/src/test/setup.ts +11 -0
- odforge-0.3.0/web/src/theme/contrast.test.ts +219 -0
- odforge-0.3.0/web/src/theme/tokens.css +145 -0
- odforge-0.3.0/web/src/theme/useTheme.test.ts +44 -0
- odforge-0.3.0/web/src/theme/useTheme.ts +28 -0
- odforge-0.3.0/web/tsconfig.json +10 -0
- odforge-0.3.0/web/tsconfig.test.json +14 -0
- odforge-0.3.0/web/vite.config.ts +27 -0
odforge-0.3.0/.gitignore
ADDED
odforge-0.3.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 ODForge contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
odforge-0.3.0/PKG-INFO
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: odforge
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: Forge natural language into native ODF documents (.odt/.odp/.ods)
|
|
5
|
+
Project-URL: Homepage, https://github.com/FantasySakura0515/ODForge
|
|
6
|
+
Project-URL: Source, https://github.com/FantasySakura0515/ODForge
|
|
7
|
+
Project-URL: Issues, https://github.com/FantasySakura0515/ODForge/issues
|
|
8
|
+
Author: FantasySakura0515
|
|
9
|
+
License: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: agent,claude,libreoffice,mcp,odf,odp,presentation,slides
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Natural Language :: Chinese (Traditional)
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Topic :: Office/Business :: Office Suites
|
|
17
|
+
Requires-Python: >=3.11
|
|
18
|
+
Requires-Dist: json-repair>=0.30
|
|
19
|
+
Requires-Dist: lxml<7,>=6.1
|
|
20
|
+
Requires-Dist: mcp>=1.2
|
|
21
|
+
Requires-Dist: odfdo>=3.22
|
|
22
|
+
Requires-Dist: openai>=1.40
|
|
23
|
+
Requires-Dist: pydantic>=2.7
|
|
24
|
+
Requires-Dist: pymupdf>=1.24
|
|
25
|
+
Requires-Dist: rich>=13
|
|
26
|
+
Requires-Dist: typer>=0.12
|
|
27
|
+
Provides-Extra: cjk
|
|
28
|
+
Requires-Dist: jieba>=0.42; extra == 'cjk'
|
|
29
|
+
Requires-Dist: zhconv>=1.4; extra == 'cjk'
|
|
30
|
+
Provides-Extra: dev
|
|
31
|
+
Requires-Dist: anthropic>=0.40; extra == 'dev'
|
|
32
|
+
Requires-Dist: build>=1.2; extra == 'dev'
|
|
33
|
+
Requires-Dist: fastapi>=0.110; extra == 'dev'
|
|
34
|
+
Requires-Dist: httpx>=0.27; extra == 'dev'
|
|
35
|
+
Requires-Dist: jieba>=0.42; extra == 'dev'
|
|
36
|
+
Requires-Dist: pytest-cov>=5; extra == 'dev'
|
|
37
|
+
Requires-Dist: pytest>=8; extra == 'dev'
|
|
38
|
+
Requires-Dist: python-dotenv>=1.0; extra == 'dev'
|
|
39
|
+
Requires-Dist: ruff>=0.15; extra == 'dev'
|
|
40
|
+
Requires-Dist: sse-starlette>=2.0; extra == 'dev'
|
|
41
|
+
Requires-Dist: uvicorn>=0.29; extra == 'dev'
|
|
42
|
+
Requires-Dist: zhconv>=1.4; extra == 'dev'
|
|
43
|
+
Provides-Extra: test
|
|
44
|
+
Requires-Dist: anthropic>=0.40; extra == 'test'
|
|
45
|
+
Requires-Dist: fastapi>=0.110; extra == 'test'
|
|
46
|
+
Requires-Dist: httpx>=0.27; extra == 'test'
|
|
47
|
+
Requires-Dist: jieba>=0.42; extra == 'test'
|
|
48
|
+
Requires-Dist: pytest-cov>=5; extra == 'test'
|
|
49
|
+
Requires-Dist: pytest>=8; extra == 'test'
|
|
50
|
+
Requires-Dist: python-dotenv>=1.0; extra == 'test'
|
|
51
|
+
Requires-Dist: sse-starlette>=2.0; extra == 'test'
|
|
52
|
+
Requires-Dist: uvicorn>=0.29; extra == 'test'
|
|
53
|
+
Requires-Dist: zhconv>=1.4; extra == 'test'
|
|
54
|
+
Provides-Extra: vision
|
|
55
|
+
Requires-Dist: anthropic>=0.40; extra == 'vision'
|
|
56
|
+
Provides-Extra: web
|
|
57
|
+
Requires-Dist: fastapi>=0.110; extra == 'web'
|
|
58
|
+
Requires-Dist: python-dotenv>=1.0; extra == 'web'
|
|
59
|
+
Requires-Dist: sse-starlette>=2.0; extra == 'web'
|
|
60
|
+
Requires-Dist: uvicorn>=0.29; extra == 'web'
|
|
61
|
+
Description-Content-Type: text/markdown
|
|
62
|
+
|
|
63
|
+
# odforge
|
|
64
|
+
|
|
65
|
+
ODForge 的 Python 套件:CLI(`odforge`)、MCP server(`odforge-mcp`)與網頁編輯器。
|
|
66
|
+
讓 AI 助理直接產出原生 ODF 簡報、文件、試算表(`.odp`/`.odt`/`.ods`),並在瀏覽器裡跟你來回修改。
|
|
67
|
+
|
|
68
|
+
## 安裝
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
uv tool install "odforge[web,cjk]" # 或 pipx install "odforge[web,cjk]"
|
|
72
|
+
odforge setup # 接上這台電腦的 Claude Code 與 Codex
|
|
73
|
+
odforge init 我的簡報 # 或只設定某個資料夾:放 AGENTS.md、skill 與 .mcp.json
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
只用 Claude Code 的話,也可以直接裝 plugin:
|
|
77
|
+
|
|
78
|
+
```text
|
|
79
|
+
/plugin marketplace add FantasySakura0515/ODForge
|
|
80
|
+
/plugin install odforge@odforge
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
建議另外裝 [LibreOffice](https://www.libreoffice.org/),預覽圖和第三道驗證閘會用到它(只在背景執行)。
|
|
84
|
+
|
|
85
|
+
完整用法見 GitHub 上的 README:[繁體中文](https://github.com/FantasySakura0515/ODForge/blob/main/README.md) |
|
|
86
|
+
[English](https://github.com/FantasySakura0515/ODForge/blob/main/README.en.md)。
|
|
87
|
+
|
|
88
|
+
- 驗證閘的定義:[docs/gates.md](https://github.com/FantasySakura0515/ODForge/blob/main/odforge/docs/gates.md)
|
|
89
|
+
- Web API:[docs/webapi.md](https://github.com/FantasySakura0515/ODForge/blob/main/odforge/docs/webapi.md)
|
|
90
|
+
- `odforge benchmark` 報告格式:[docs/benchmark.md](https://github.com/FantasySakura0515/ODForge/blob/main/odforge/docs/benchmark.md)
|
|
91
|
+
- 環境變數範本:[.env.example](https://github.com/FantasySakura0515/ODForge/blob/main/odforge/.env.example)
|
|
92
|
+
|
|
93
|
+
## 授權
|
|
94
|
+
|
|
95
|
+
MIT。
|
odforge-0.3.0/README.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# odforge
|
|
2
|
+
|
|
3
|
+
ODForge 的 Python 套件:CLI(`odforge`)、MCP server(`odforge-mcp`)與網頁編輯器。
|
|
4
|
+
讓 AI 助理直接產出原生 ODF 簡報、文件、試算表(`.odp`/`.odt`/`.ods`),並在瀏覽器裡跟你來回修改。
|
|
5
|
+
|
|
6
|
+
## 安裝
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
uv tool install "odforge[web,cjk]" # 或 pipx install "odforge[web,cjk]"
|
|
10
|
+
odforge setup # 接上這台電腦的 Claude Code 與 Codex
|
|
11
|
+
odforge init 我的簡報 # 或只設定某個資料夾:放 AGENTS.md、skill 與 .mcp.json
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
只用 Claude Code 的話,也可以直接裝 plugin:
|
|
15
|
+
|
|
16
|
+
```text
|
|
17
|
+
/plugin marketplace add FantasySakura0515/ODForge
|
|
18
|
+
/plugin install odforge@odforge
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
建議另外裝 [LibreOffice](https://www.libreoffice.org/),預覽圖和第三道驗證閘會用到它(只在背景執行)。
|
|
22
|
+
|
|
23
|
+
完整用法見 GitHub 上的 README:[繁體中文](https://github.com/FantasySakura0515/ODForge/blob/main/README.md) |
|
|
24
|
+
[English](https://github.com/FantasySakura0515/ODForge/blob/main/README.en.md)。
|
|
25
|
+
|
|
26
|
+
- 驗證閘的定義:[docs/gates.md](https://github.com/FantasySakura0515/ODForge/blob/main/odforge/docs/gates.md)
|
|
27
|
+
- Web API:[docs/webapi.md](https://github.com/FantasySakura0515/ODForge/blob/main/odforge/docs/webapi.md)
|
|
28
|
+
- `odforge benchmark` 報告格式:[docs/benchmark.md](https://github.com/FantasySakura0515/ODForge/blob/main/odforge/docs/benchmark.md)
|
|
29
|
+
- 環境變數範本:[.env.example](https://github.com/FantasySakura0515/ODForge/blob/main/odforge/.env.example)
|
|
30
|
+
|
|
31
|
+
## 授權
|
|
32
|
+
|
|
33
|
+
MIT。
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# Pinned dependency set — the "locked" CI lane installs with
|
|
2
|
+
# pip install -e ".[test,vision,web]" -c constraints.txt
|
|
3
|
+
#
|
|
4
|
+
# Why this file exists: this repo's own venv was sitting on mcp 1.28 and PyMuPDF
|
|
5
|
+
# 1.28.0 while a clean resolve produced mcp 2.0 and PyMuPDF 1.28.2 — two
|
|
6
|
+
# releases that respectively removed an imported module and started printing to
|
|
7
|
+
# stdout. Every test passed on the machine that had the old ones. A locked lane
|
|
8
|
+
# makes CI reproducible; the UNPINNED lane (the default `python` job) stays as
|
|
9
|
+
# the early warning that upstream has moved. Both must be green to release.
|
|
10
|
+
#
|
|
11
|
+
# Regenerate: create a clean venv, `pip install ".[test,vision,web]"`, then
|
|
12
|
+
# `pip freeze --exclude-editable`.
|
|
13
|
+
annotated-doc==0.0.5
|
|
14
|
+
annotated-types==0.8.0
|
|
15
|
+
anthropic==0.121.0
|
|
16
|
+
anyio==4.14.2
|
|
17
|
+
attrs==26.1.0
|
|
18
|
+
certifi==2026.7.22
|
|
19
|
+
cffi==2.1.1
|
|
20
|
+
click==8.4.2
|
|
21
|
+
colorama==0.4.6
|
|
22
|
+
coverage==7.15.4
|
|
23
|
+
cryptography==50.0.0
|
|
24
|
+
distro==1.9.0
|
|
25
|
+
docstring_parser==0.18.0
|
|
26
|
+
fastapi==0.141.1
|
|
27
|
+
h11==0.16.0
|
|
28
|
+
httpcore==1.0.9
|
|
29
|
+
httpcore2==2.10.0
|
|
30
|
+
httpx==0.28.1
|
|
31
|
+
httpx2==2.10.0
|
|
32
|
+
idna==3.18
|
|
33
|
+
iniconfig==2.3.0
|
|
34
|
+
jieba==0.42.1
|
|
35
|
+
jiter==0.16.0
|
|
36
|
+
json_repair==0.63.1
|
|
37
|
+
jsonschema==4.26.0
|
|
38
|
+
jsonschema-specifications==2025.9.1
|
|
39
|
+
lxml==6.1.1
|
|
40
|
+
markdown-it-py==4.2.0
|
|
41
|
+
mcp==2.0.0
|
|
42
|
+
mcp-types==2.0.0
|
|
43
|
+
mdurl==0.1.2
|
|
44
|
+
odfdo==3.24.3
|
|
45
|
+
openai==3.0.0
|
|
46
|
+
opentelemetry-api==1.44.0
|
|
47
|
+
packaging==26.3
|
|
48
|
+
pluggy==1.6.0
|
|
49
|
+
pycparser==3.0
|
|
50
|
+
pydantic==2.13.4
|
|
51
|
+
pydantic_core==2.46.4
|
|
52
|
+
Pygments==2.20.0
|
|
53
|
+
PyJWT==2.13.0
|
|
54
|
+
pymupdf==1.28.2
|
|
55
|
+
pytest==9.1.1
|
|
56
|
+
pytest-cov==7.1.0
|
|
57
|
+
python-dotenv==1.2.2
|
|
58
|
+
python-multipart==0.0.32
|
|
59
|
+
pywin32==312
|
|
60
|
+
referencing==0.37.0
|
|
61
|
+
rich==15.0.0
|
|
62
|
+
rpds-py==2026.6.3
|
|
63
|
+
shellingham==1.5.4
|
|
64
|
+
sniffio==1.3.1
|
|
65
|
+
sse-starlette==3.4.8
|
|
66
|
+
starlette==1.6.0
|
|
67
|
+
tqdm==4.70.0
|
|
68
|
+
truststore==0.10.4
|
|
69
|
+
typer==0.27.1
|
|
70
|
+
typing-inspection==0.4.4
|
|
71
|
+
typing_extensions==4.16.0
|
|
72
|
+
uvicorn==0.52.2
|
|
73
|
+
zhconv==1.4.3
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"""Build the web cockpit into the wheel — reproducibly, or not at all.
|
|
2
|
+
|
|
3
|
+
Before this hook, ``odforge serve`` located the frontend by walking *up from the
|
|
4
|
+
source file* to ``odforge/web/dist``. That path exists only in a git checkout, so
|
|
5
|
+
every wheel installed anywhere else silently ran API-only: ``GET /`` returned 404
|
|
6
|
+
and the failure was indistinguishable from "you forgot to build it". Worse, the
|
|
7
|
+
build was whatever happened to be sitting in the developer's ``web/dist`` at the
|
|
8
|
+
time — an untracked directory, from an unknown commit, installed by no recorded
|
|
9
|
+
command.
|
|
10
|
+
|
|
11
|
+
This hook fixes both halves:
|
|
12
|
+
|
|
13
|
+
* **Reproducible.** The frontend is built here, by this hook, with ``npm ci``
|
|
14
|
+
against the committed ``package-lock.json`` — not ``npm install``, which is
|
|
15
|
+
free to resolve newer versions, and not "whatever is already in dist".
|
|
16
|
+
* **Fail at build time, not at run time.** If the assets are not in the wheel,
|
|
17
|
+
the build *fails*. An API-only wheel is now something you ask for explicitly
|
|
18
|
+
(``ODFORGE_API_ONLY=1``), not something you discover in production.
|
|
19
|
+
|
|
20
|
+
``ODFORGE_SKIP_WEB_BUILD=1`` reuses an existing ``web/dist`` (for CI jobs that
|
|
21
|
+
already ran the frontend build and want to package that exact artifact) — it
|
|
22
|
+
skips the *build*, never the verification.
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
from __future__ import annotations
|
|
26
|
+
|
|
27
|
+
import os
|
|
28
|
+
import shutil
|
|
29
|
+
import subprocess
|
|
30
|
+
import sys
|
|
31
|
+
from pathlib import Path
|
|
32
|
+
|
|
33
|
+
from hatchling.builders.hooks.plugin.interface import BuildHookInterface
|
|
34
|
+
|
|
35
|
+
# Where the built assets live inside the installed package. ``importlib.resources``
|
|
36
|
+
# finds this at run time; see ``webapi.frontend_dist``.
|
|
37
|
+
PACKAGE_WEBUI = Path("src") / "odforge" / "webui"
|
|
38
|
+
WEB_SOURCE = Path("web")
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class WebUIBuildHook(BuildHookInterface):
|
|
42
|
+
PLUGIN_NAME = "odforge-webui"
|
|
43
|
+
|
|
44
|
+
def initialize(self, version: str, build_data: dict) -> None:
|
|
45
|
+
root = Path(self.root)
|
|
46
|
+
target = root / PACKAGE_WEBUI
|
|
47
|
+
web = root / WEB_SOURCE
|
|
48
|
+
|
|
49
|
+
if version == "editable":
|
|
50
|
+
# `pip install -e .` is a development install: the source tree's own
|
|
51
|
+
# `web/dist` is already found by frontend_dist()'s second lookup, and
|
|
52
|
+
# requiring Node for every editable install would make the Python
|
|
53
|
+
# test job depend on a toolchain it has no other use for.
|
|
54
|
+
return
|
|
55
|
+
|
|
56
|
+
if os.environ.get("ODFORGE_API_ONLY") == "1":
|
|
57
|
+
self.app.display_waiting(
|
|
58
|
+
"ODFORGE_API_ONLY=1 — building a deliberately API-only wheel "
|
|
59
|
+
"(no web cockpit; `GET /` will 404)."
|
|
60
|
+
)
|
|
61
|
+
return
|
|
62
|
+
|
|
63
|
+
if os.environ.get("ODFORGE_SKIP_WEB_BUILD") != "1":
|
|
64
|
+
self._build_frontend(web)
|
|
65
|
+
|
|
66
|
+
dist = web / "dist"
|
|
67
|
+
if not (dist / "index.html").is_file():
|
|
68
|
+
raise RuntimeError(
|
|
69
|
+
f"web frontend not built: {dist / 'index.html'} is missing.\n"
|
|
70
|
+
"Run `npm ci && npm run build` in odforge/web, or set "
|
|
71
|
+
"ODFORGE_API_ONLY=1 to intentionally build an API-only wheel."
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
# Staged inside the package directory, so hatchling's normal selector
|
|
75
|
+
# picks it up as package data. ``artifacts`` in pyproject keeps it
|
|
76
|
+
# included even though it is a build product (and gitignored).
|
|
77
|
+
shutil.rmtree(target, ignore_errors=True)
|
|
78
|
+
shutil.copytree(dist, target)
|
|
79
|
+
|
|
80
|
+
def finalize(self, version: str, build_data: dict, artifact_path: str) -> None:
|
|
81
|
+
"""Remove the staged copy so a source tree is not left dirty."""
|
|
82
|
+
shutil.rmtree(Path(self.root) / PACKAGE_WEBUI, ignore_errors=True)
|
|
83
|
+
|
|
84
|
+
def _build_frontend(self, web: Path) -> None:
|
|
85
|
+
if not (web / "package.json").is_file():
|
|
86
|
+
raise RuntimeError(f"no frontend source at {web}")
|
|
87
|
+
lockfile = web / "package-lock.json"
|
|
88
|
+
if not lockfile.is_file():
|
|
89
|
+
raise RuntimeError(
|
|
90
|
+
f"{lockfile} is missing — a reproducible build needs the "
|
|
91
|
+
"lockfile. Commit it, or set ODFORGE_SKIP_WEB_BUILD=1 to "
|
|
92
|
+
"package an already-built web/dist."
|
|
93
|
+
)
|
|
94
|
+
npm = shutil.which("npm") or shutil.which("npm.cmd")
|
|
95
|
+
if npm is None:
|
|
96
|
+
raise RuntimeError(
|
|
97
|
+
"npm not found on PATH, so the web cockpit cannot be built. "
|
|
98
|
+
"Install Node.js, or set ODFORGE_SKIP_WEB_BUILD=1 to package an "
|
|
99
|
+
"existing web/dist, or ODFORGE_API_ONLY=1 for an API-only wheel."
|
|
100
|
+
)
|
|
101
|
+
for argv in (["ci"], ["run", "build"]):
|
|
102
|
+
self.app.display_waiting(f"web: npm {' '.join(argv)}")
|
|
103
|
+
# Pin the encoding: ``text=True`` alone decodes with the system
|
|
104
|
+
# locale, and npm/vite emit UTF-8 box-drawing characters — on a
|
|
105
|
+
# cp950 console that raises mid-capture and loses the real error.
|
|
106
|
+
proc = subprocess.run(
|
|
107
|
+
[npm, *argv],
|
|
108
|
+
cwd=web,
|
|
109
|
+
capture_output=True,
|
|
110
|
+
text=True,
|
|
111
|
+
encoding="utf-8",
|
|
112
|
+
errors="replace",
|
|
113
|
+
)
|
|
114
|
+
if proc.returncode != 0:
|
|
115
|
+
sys.stderr.write(proc.stdout or "")
|
|
116
|
+
sys.stderr.write(proc.stderr or "")
|
|
117
|
+
raise RuntimeError(
|
|
118
|
+
f"`npm {' '.join(argv)}` failed with exit code "
|
|
119
|
+
f"{proc.returncode}; the wheel would ship without its UI."
|
|
120
|
+
)
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "odforge"
|
|
3
|
+
# Single source: src/odforge/__init__.py (it had drifted to 0.1.0 while this said 0.2.0).
|
|
4
|
+
dynamic = ["version"]
|
|
5
|
+
description = "Forge natural language into native ODF documents (.odt/.odp/.ods)"
|
|
6
|
+
readme = "README.md"
|
|
7
|
+
requires-python = ">=3.11"
|
|
8
|
+
license = { text = "MIT" }
|
|
9
|
+
authors = [{ name = "FantasySakura0515" }]
|
|
10
|
+
keywords = ["odf", "odp", "presentation", "slides", "libreoffice", "mcp", "claude", "agent"]
|
|
11
|
+
classifiers = [
|
|
12
|
+
"Programming Language :: Python :: 3",
|
|
13
|
+
"License :: OSI Approved :: MIT License",
|
|
14
|
+
"Operating System :: OS Independent",
|
|
15
|
+
"Topic :: Office/Business :: Office Suites",
|
|
16
|
+
"Natural Language :: Chinese (Traditional)",
|
|
17
|
+
]
|
|
18
|
+
dependencies = [
|
|
19
|
+
"odfdo>=3.22", "pydantic>=2.7", "typer>=0.12", "rich>=13",
|
|
20
|
+
"openai>=1.40", "mcp>=1.2", "lxml>=6.1,<7", "json-repair>=0.30",
|
|
21
|
+
"PyMuPDF>=1.24",
|
|
22
|
+
]
|
|
23
|
+
[project.optional-dependencies]
|
|
24
|
+
# Everything needed to COLLECT and RUN the full test suite on a clean machine.
|
|
25
|
+
# ``dev`` used to be the only extra and it did not include the web/vision deps,
|
|
26
|
+
# so a fresh checkout could not collect tests/test_webapi.py at all — the suite
|
|
27
|
+
# only passed on machines that already had them from some earlier experiment.
|
|
28
|
+
test = [
|
|
29
|
+
"pytest>=8", "pytest-cov>=5", "httpx>=0.27",
|
|
30
|
+
"fastapi>=0.110", "uvicorn>=0.29", "sse-starlette>=2.0", "python-dotenv>=1.0",
|
|
31
|
+
"anthropic>=0.40",
|
|
32
|
+
# The line-layout tests pin word-aware breaks, which need the cjk extra.
|
|
33
|
+
"jieba>=0.42", "zhconv>=1.4",
|
|
34
|
+
]
|
|
35
|
+
dev = ["odforge[test]", "ruff>=0.15", "build>=1.2"]
|
|
36
|
+
# Vision critic (Task 16.2). Imported lazily inside critic.py's claude backend,
|
|
37
|
+
# so it is never required to import the package or run the off/ollama paths.
|
|
38
|
+
vision = ["anthropic>=0.40"]
|
|
39
|
+
# Word-aware CJK line breaking (cards, steps, panels, headings). jieba cuts
|
|
40
|
+
# words; zhconv lets it cut traditional text with its simplified dictionary
|
|
41
|
+
# (臺灣 was 「臺」「灣物種」). Without them lines break between any two
|
|
42
|
+
# characters; the renderer works either way.
|
|
43
|
+
cjk = ["jieba>=0.42", "zhconv>=1.4"]
|
|
44
|
+
# Web API (Task 18.1). Imported only by webapi.py / the `serve` command, never at
|
|
45
|
+
# package import — the core suite runs without these installed.
|
|
46
|
+
web = ["fastapi>=0.110", "uvicorn>=0.29", "sse-starlette>=2.0", "python-dotenv>=1.0"]
|
|
47
|
+
[project.urls]
|
|
48
|
+
Homepage = "https://github.com/FantasySakura0515/ODForge"
|
|
49
|
+
Source = "https://github.com/FantasySakura0515/ODForge"
|
|
50
|
+
Issues = "https://github.com/FantasySakura0515/ODForge/issues"
|
|
51
|
+
[project.scripts]
|
|
52
|
+
odforge = "odforge.cli:app"
|
|
53
|
+
# The MCP server as a runnable command, so an MCP host can be pointed at
|
|
54
|
+
# ODForge without knowing module paths or which interpreter to use.
|
|
55
|
+
odforge-mcp = "odforge.mcp_server:main"
|
|
56
|
+
[build-system]
|
|
57
|
+
requires = ["hatchling"]
|
|
58
|
+
build-backend = "hatchling.build"
|
|
59
|
+
[tool.hatch.build.targets.wheel]
|
|
60
|
+
packages = ["src/odforge"]
|
|
61
|
+
# Staged by the build hook below; listed here so it ships even though it is a
|
|
62
|
+
# gitignored build product.
|
|
63
|
+
artifacts = ["src/odforge/webui/**"]
|
|
64
|
+
# The web cockpit is built from source (npm ci + npm run build against the
|
|
65
|
+
# committed lockfile) and staged into the package as odforge/webui. See
|
|
66
|
+
# hatch_build.py — a wheel that would ship without it fails the build instead.
|
|
67
|
+
[tool.hatch.version]
|
|
68
|
+
path = "src/odforge/__init__.py"
|
|
69
|
+
# The agent skill lives at the repo's skills/ because that is also the Claude Code
|
|
70
|
+
# plugin's root; a wheel install needs its own copy for `odforge setup` / `init`.
|
|
71
|
+
[tool.hatch.build.targets.wheel.force-include]
|
|
72
|
+
"skills/odforge-design" = "odforge/skills/odforge-design"
|
|
73
|
+
[tool.hatch.build.targets.wheel.hooks.custom]
|
|
74
|
+
path = "hatch_build.py"
|
|
75
|
+
[tool.hatch.build.targets.sdist]
|
|
76
|
+
# The frontend *sources* must travel in the sdist, or `pip install` from it
|
|
77
|
+
# cannot rebuild the cockpit.
|
|
78
|
+
include = [
|
|
79
|
+
"src/odforge",
|
|
80
|
+
"skills",
|
|
81
|
+
"tests",
|
|
82
|
+
"web/src",
|
|
83
|
+
"web/index.html",
|
|
84
|
+
"web/editor.html",
|
|
85
|
+
"web/package.json",
|
|
86
|
+
"web/package-lock.json",
|
|
87
|
+
"web/tsconfig.json",
|
|
88
|
+
"web/tsconfig.test.json",
|
|
89
|
+
"web/vite.config.ts",
|
|
90
|
+
"hatch_build.py",
|
|
91
|
+
"constraints.txt",
|
|
92
|
+
"README.md",
|
|
93
|
+
"LICENSE",
|
|
94
|
+
]
|
|
95
|
+
[tool.pytest.ini_options]
|
|
96
|
+
testpaths = ["tests"]
|
|
97
|
+
|
|
98
|
+
[tool.coverage.run]
|
|
99
|
+
source = ["src/odforge"]
|
|
100
|
+
branch = true
|
|
101
|
+
omit = ["src/odforge/benchmark.py"]
|
|
102
|
+
|
|
103
|
+
[tool.coverage.report]
|
|
104
|
+
# Baseline, measured on the suite as it stands (86.4% at the time of writing).
|
|
105
|
+
# Raise it, never lower it: a drop means new code arrived without tests, which is
|
|
106
|
+
# exactly what the number is for.
|
|
107
|
+
fail_under = 85
|
|
108
|
+
show_missing = true
|
|
109
|
+
exclude_lines = [
|
|
110
|
+
"pragma: no cover",
|
|
111
|
+
"if TYPE_CHECKING:",
|
|
112
|
+
"raise NotImplementedError",
|
|
113
|
+
]
|
|
114
|
+
|
|
115
|
+
[tool.ruff]
|
|
116
|
+
target-version = "py311"
|
|
117
|
+
line-length = 100
|
|
118
|
+
|
|
119
|
+
[tool.ruff.lint]
|
|
120
|
+
# Explicit, and every rule here passes today. The previous config selected
|
|
121
|
+
# nothing, so `ruff check .` was a no-op that looked like a passing lint gate.
|
|
122
|
+
select = [
|
|
123
|
+
"E", # pycodestyle errors
|
|
124
|
+
"F", # pyflakes
|
|
125
|
+
"W", # pycodestyle warnings
|
|
126
|
+
"I", # import sorting
|
|
127
|
+
"B", # bugbear
|
|
128
|
+
"UP", # pyupgrade
|
|
129
|
+
"C4", # comprehensions
|
|
130
|
+
"SIM", # simplify
|
|
131
|
+
"RUF", # ruff-specific
|
|
132
|
+
]
|
|
133
|
+
ignore = [
|
|
134
|
+
# Ambiguous-unicode checks fire on every line of this project's zh-TW prose
|
|
135
|
+
# (full-width comma/colon are the correct characters here, not lookalikes).
|
|
136
|
+
"RUF001", "RUF002", "RUF003",
|
|
137
|
+
# `Optional[X]` / `Dict[...]` are used deliberately and consistently; churning
|
|
138
|
+
# them to PEP-604 syntax across the codebase is noise, not a fix.
|
|
139
|
+
"UP006", "UP007", "UP035", "UP045",
|
|
140
|
+
"B008", # typer/FastAPI dependency defaults are function calls by design
|
|
141
|
+
"SIM105", # `contextlib.suppress` is not always clearer than try/except/pass
|
|
142
|
+
# typer resolves CLI choices from `class X(str, Enum)`; `enum.StrEnum` is not
|
|
143
|
+
# an accepted substitute in the pinned typer, so this rule cannot be honoured
|
|
144
|
+
# without breaking `--theme`/`--backend`/`--mode`.
|
|
145
|
+
"UP042",
|
|
146
|
+
# A whitespace-delimited block is how the OpenFormula function allowlist stays
|
|
147
|
+
# readable and diffable; a 57-element list literal is not an improvement.
|
|
148
|
+
"SIM905",
|
|
149
|
+
]
|
|
150
|
+
|
|
151
|
+
[tool.ruff.lint.per-file-ignores]
|
|
152
|
+
# Tests deliberately build long literal payloads, assert on regex-looking
|
|
153
|
+
# strings, and nest `with` blocks for readability.
|
|
154
|
+
"tests/**" = ["E501", "B011", "SIM117", "UP031", "RUF043", "B007", "RUF059", "C416", "B905"]
|
|
155
|
+
# The zh-TW prompt constants are long strings by nature.
|
|
156
|
+
"src/odforge/llm.py" = ["E501"]
|
|
157
|
+
"src/odforge/critic.py" = ["E501"]
|