modao-prd-cli 0.1.0__tar.gz → 0.2.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.
Files changed (45) hide show
  1. {modao_prd_cli-0.1.0/modao_prd_cli.egg-info → modao-prd-cli-0.2.0}/PKG-INFO +45 -8
  2. modao_prd_cli-0.1.0/PKG-INFO → modao-prd-cli-0.2.0/README.md +20 -30
  3. {modao_prd_cli-0.1.0 → modao-prd-cli-0.2.0}/modao_prd_cli/modao_prd/__init__.py +1 -2
  4. modao-prd-cli-0.2.0/modao_prd_cli/modao_prd/agent_access.py +498 -0
  5. {modao_prd_cli-0.1.0 → modao-prd-cli-0.2.0}/modao_prd_cli/modao_prd/capture_evidence.py +44 -10
  6. {modao_prd_cli-0.1.0 → modao-prd-cli-0.2.0}/modao_prd_cli/modao_prd/cli.py +106 -0
  7. {modao_prd_cli-0.1.0 → modao-prd-cli-0.2.0}/modao_prd_cli/modao_prd/explorer.py +36 -4
  8. modao-prd-cli-0.2.0/modao_prd_cli/modao_prd/schemas/agent-index-1.0.json +21 -0
  9. modao-prd-cli-0.2.0/modao_prd_cli/modao_prd/tests/test_agent_access.py +73 -0
  10. {modao_prd_cli-0.1.0 → modao-prd-cli-0.2.0}/modao_prd_cli/modao_prd/tests/test_cli.py +21 -0
  11. {modao_prd_cli-0.1.0 → modao-prd-cli-0.2.0}/modao_prd_cli/modao_prd/tests/test_writers.py +3 -3
  12. {modao_prd_cli-0.1.0 → modao-prd-cli-0.2.0}/modao_prd_cli/modao_prd/writers.py +48 -28
  13. modao-prd-cli-0.2.0/modao_prd_cli.egg-info/PKG-INFO +145 -0
  14. {modao_prd_cli-0.1.0 → modao-prd-cli-0.2.0}/modao_prd_cli.egg-info/SOURCES.txt +4 -0
  15. {modao_prd_cli-0.1.0 → modao-prd-cli-0.2.0}/pyproject.toml +2 -2
  16. {modao_prd_cli-0.1.0 → modao-prd-cli-0.2.0}/tests/test_capture_evidence.py +71 -0
  17. modao-prd-cli-0.2.0/tests/test_explorer.py +103 -0
  18. {modao_prd_cli-0.1.0 → modao-prd-cli-0.2.0}/tests/test_schemas.py +1 -1
  19. modao_prd_cli-0.1.0/README.md +0 -82
  20. {modao_prd_cli-0.1.0 → modao-prd-cli-0.2.0}/LICENSE +0 -0
  21. {modao_prd_cli-0.1.0 → modao-prd-cli-0.2.0}/modao_prd_cli/__init__.py +0 -0
  22. {modao_prd_cli-0.1.0 → modao-prd-cli-0.2.0}/modao_prd_cli/modao_prd/__main__.py +0 -0
  23. {modao_prd_cli-0.1.0 → modao-prd-cli-0.2.0}/modao_prd_cli/modao_prd/browser.py +0 -0
  24. {modao_prd_cli-0.1.0 → modao-prd-cli-0.2.0}/modao_prd_cli/modao_prd/classifier.py +0 -0
  25. {modao_prd_cli-0.1.0 → modao-prd-cli-0.2.0}/modao_prd_cli/modao_prd/errors.py +0 -0
  26. {modao_prd_cli-0.1.0 → modao-prd-cli-0.2.0}/modao_prd_cli/modao_prd/evidence.py +0 -0
  27. {modao_prd_cli-0.1.0 → modao-prd-cli-0.2.0}/modao_prd_cli/modao_prd/extractor.py +0 -0
  28. {modao_prd_cli-0.1.0 → modao-prd-cli-0.2.0}/modao_prd_cli/modao_prd/models.py +0 -0
  29. {modao_prd_cli-0.1.0 → modao-prd-cli-0.2.0}/modao_prd_cli/modao_prd/normalizer.py +0 -0
  30. {modao_prd_cli-0.1.0 → modao-prd-cli-0.2.0}/modao_prd_cli/modao_prd/schemas/coverage-1.0.json +0 -0
  31. {modao_prd_cli-0.1.0 → modao-prd-cli-0.2.0}/modao_prd_cli/modao_prd/schemas/document-2.0.json +0 -0
  32. {modao_prd_cli-0.1.0 → modao-prd-cli-0.2.0}/modao_prd_cli/modao_prd/schemas/document-2.1.json +0 -0
  33. {modao_prd_cli-0.1.0 → modao-prd-cli-0.2.0}/modao_prd_cli/modao_prd/schemas/manifest-1.0.json +0 -0
  34. {modao_prd_cli-0.1.0 → modao-prd-cli-0.2.0}/modao_prd_cli/modao_prd/tests/__init__.py +0 -0
  35. {modao_prd_cli-0.1.0 → modao-prd-cli-0.2.0}/modao_prd_cli/modao_prd/tests/fixtures/modao_sample.html +0 -0
  36. {modao_prd_cli-0.1.0 → modao-prd-cli-0.2.0}/modao_prd_cli/modao_prd/tests/test_browser.py +0 -0
  37. {modao_prd_cli-0.1.0 → modao-prd-cli-0.2.0}/modao_prd_cli/modao_prd/tests/test_classifier.py +0 -0
  38. {modao_prd_cli-0.1.0 → modao-prd-cli-0.2.0}/modao_prd_cli/modao_prd/tests/test_extractor.py +0 -0
  39. {modao_prd_cli-0.1.0 → modao-prd-cli-0.2.0}/modao_prd_cli/modao_prd/tests/test_full_e2e.py +0 -0
  40. {modao_prd_cli-0.1.0 → modao-prd-cli-0.2.0}/modao_prd_cli.egg-info/dependency_links.txt +0 -0
  41. {modao_prd_cli-0.1.0 → modao-prd-cli-0.2.0}/modao_prd_cli.egg-info/entry_points.txt +0 -0
  42. {modao_prd_cli-0.1.0 → modao-prd-cli-0.2.0}/modao_prd_cli.egg-info/requires.txt +0 -0
  43. {modao_prd_cli-0.1.0 → modao-prd-cli-0.2.0}/modao_prd_cli.egg-info/top_level.txt +0 -0
  44. {modao_prd_cli-0.1.0 → modao-prd-cli-0.2.0}/setup.cfg +0 -0
  45. {modao_prd_cli-0.1.0 → modao-prd-cli-0.2.0}/tests/test_evidence.py +0 -0
@@ -1,9 +1,31 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.1
2
2
  Name: modao-prd-cli
3
- Version: 0.1.0
3
+ Version: 0.2.0
4
4
  Summary: Extract public Modao prototype shares into agent-friendly JSON, Markdown, and NDJSON
5
5
  Author: modao-prd-cli contributors
6
- License-Expression: MIT
6
+ License: MIT License
7
+
8
+ Copyright (c) 2026 modao-prd-cli contributors
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+
7
29
  Keywords: modao,prototype,prd,cli,agent,playwright
8
30
  Classifier: Development Status :: 3 - Alpha
9
31
  Classifier: Environment :: Console
@@ -22,7 +44,6 @@ Provides-Extra: dev
22
44
  Requires-Dist: build>=1.2; extra == "dev"
23
45
  Requires-Dist: pytest>=7; extra == "dev"
24
46
  Requires-Dist: twine>=5; extra == "dev"
25
- Dynamic: license-file
26
47
 
27
48
  # modao-prd-cli
28
49
 
@@ -45,6 +66,18 @@ modao-prd-cli export "https://modao.cc/proto/<project-id>/sharing?view_mode=insp
45
66
  --format all
46
67
  ```
47
68
 
69
+ 导出后,Agent 不需要把完整 `document.json` 一次性读入上下文。先查看轻量索引,再按关键词、页面或事实 ID 查询:
70
+
71
+ ```bash
72
+ modao-prd-cli overview <project-id> --json
73
+ modao-prd-cli search <project-id> "奖励 概率" --json
74
+ modao-prd-cli screen <project-id> screen-001 --json
75
+ modao-prd-cli get <project-id> block-001 table-001 --json
76
+ modao-prd-cli unresolved <project-id> --json
77
+ ```
78
+
79
+ `<project-id>` 可以是项目 ID,也可以是证据包目录。`search`、`screen` 和 `unresolved` 默认最多返回 20 条、约 30 KB,并提供 `truncated` 与 `next_cursor`;需要更多结果时使用 `--cursor` 或增大 `--max-bytes`。
80
+
48
81
  不传 `--output` 时,工具会从当前工作目录向上查找最近的 Git 根目录,并将结果写入该项目根目录下的 `.modao-prd/<project-id>/`。如果当前目录不属于 Git 项目,则使用当前工作目录作为项目根目录。首次默认导出会在项目根目录的 `.gitignore` 中幂等加入 `/.modao-prd/`。
49
82
 
50
83
  如需指定其他位置,显式传入 `--output` 即可;此时不会修改项目的 `.gitignore`:
@@ -54,7 +87,7 @@ modao-prd-cli export "<墨刀公开分享链接>" \
54
87
  --format all --output ./modao-export
55
88
  ```
56
89
 
57
- 导出默认使用精简证据模式:保留结构化事实、DOM 布局快照、整页截图、可读画布截图和有效原型图片,过滤运行时代码、埋点资源和常见 UI 图标。DOM 快照也会排除 `script/style` 等运行时节点,避免把框架代码混进需求证据。需要排查渲染问题或核对视觉/无障碍细节时,再显式开启完整证据(debug/full)模式:
90
+ 导出默认使用精简证据模式:保留结构化事实、DOM 布局快照、可读画布截图和有效原型图片,过滤运行时代码、埋点资源和常见 UI 图标。DOM 快照也会排除 `script/style` 等运行时节点,避免把框架代码混进需求证据。需要排查渲染问题或核对视觉/无障碍细节时,再显式开启完整证据(debug/full)模式:
58
91
 
59
92
  ```bash
60
93
  modao-prd-cli export "<墨刀公开分享链接>" --format all \
@@ -73,6 +106,8 @@ modao-prd-cli export "<墨刀公开分享链接>" --format all \
73
106
  ├── document.json
74
107
  ├── document.md
75
108
  ├── document.ndjson
109
+ ├── agent-index.json
110
+ ├── search-index.sqlite
76
111
  ├── coverage.json
77
112
  └── evidence/
78
113
  ├── state-001.dom.json
@@ -84,9 +119,11 @@ modao-prd-cli export "<墨刀公开分享链接>" --format all \
84
119
  └── network/ # --evidence full
85
120
  ```
86
121
 
87
- 读取顺序建议为 `manifest.json → document.json → coverage.json → evidence/`。
122
+ 读取顺序建议为 `manifest.json → agent-index.json → coverage.json → search/get/screen → 必要时 document.json 或 evidence/`。
88
123
 
89
- - `document.json` 使用 schema 2.1,是面向 Agent 的紧凑精简投影,区分 `facts`(页面事实)和 `derived`(确定性启发式推导);需要人读时使用 `document.md`,需要逐条检索时使用 `document.ndjson`。
124
+ - `agent-index.json` 是面向 Agent 的轻量导航入口,只包含页面、表格、规则分类、交互摘要、覆盖率和警告,不替代事实。
125
+ - `search-index.sqlite` 是本地只读事实索引,包含所有可检索的 block、table、asset、状态、交互、规则和未覆盖项;查询不会访问网络,也不会把完整文档自动加载进上下文。
126
+ - `document.json` 使用 schema 2.1,是完整事实归档,区分 `facts`(页面事实)和 `derived`(确定性启发式推导)。它仍可能较大,默认通过查询命令按需读取;需要人读时使用 `document.md`,需要逐条流式处理时使用 `document.ndjson`。
90
127
  - `document.md` 是人工阅读摘要,不替代原始证据。
91
128
  - `document.ndjson` 是逐行知识单元,适合 RAG、向量化和增量处理。
92
129
  - 默认精简模式输出 DOM/布局证据、可读画布截图和过滤后的原型图片;`--evidence full` 额外保存浏览器整页截图、渲染 HTML、ARIA、相关 JSON/HTML 网络正文和网络索引。精简模式不会为了“完整”保存无助于需求分析的浏览器整页截图、JS、CSS、埋点或通用图标。
@@ -94,7 +131,7 @@ modao-prd-cli export "<墨刀公开分享链接>" --format all \
94
131
  - `--headed` 只控制是否显示浏览器窗口,便于 debug,不会单独切换证据级别;完整证据必须显式指定 `--evidence full`。
95
132
  - `coverage.json` 记录访问到的状态、动作、跳过项和部分完成原因。
96
133
 
97
- `document.json` 不重复内嵌完整 DOM 父子关系,也不重复输出旧版的 `document.blocks`、顶层 `requirements`、`tables` 等别名;布局树保存在 `evidence/state-*.dom.json`,主文档通过状态和精简证据引用回查。所有页面事实尽量带 `state_id`、`screen_id` 和核心 `evidence_ids`。发生冲突时,以截图、HTML、DOM、ARIA 和原始表格为准;`derived` 只作为分析线索。
134
+ `document.json` 不重复内嵌完整 DOM 父子关系,也不重复输出旧版的 `document.blocks`、顶层 `requirements`、`tables` 等别名;布局树保存在 `evidence/state-*.dom.json`,主文档通过状态和精简证据引用回查。所有页面事实尽量带 `state_id`、`screen_id` 和核心 `evidence_ids`。发生冲突时,以截图、HTML、DOM、ARIA 和原始表格为准;`derived` 只作为分析线索。为了避免漏需求,不要用 `agent-index.json` 替代事实归档;应通过 `search` 定位后再用 `get` 读取原始事实。
98
135
 
99
136
  退出码为 `0`(在策略范围内完成)、`2`(得到可用但部分完成的证据包)、`1`(未得到可用文档)。
100
137
 
@@ -1,29 +1,3 @@
1
- Metadata-Version: 2.4
2
- Name: modao-prd-cli
3
- Version: 0.1.0
4
- Summary: Extract public Modao prototype shares into agent-friendly JSON, Markdown, and NDJSON
5
- Author: modao-prd-cli contributors
6
- License-Expression: MIT
7
- Keywords: modao,prototype,prd,cli,agent,playwright
8
- Classifier: Development Status :: 3 - Alpha
9
- Classifier: Environment :: Console
10
- Classifier: Intended Audience :: Developers
11
- Classifier: Programming Language :: Python :: 3
12
- Classifier: Programming Language :: Python :: 3.10
13
- Classifier: Programming Language :: Python :: 3.11
14
- Classifier: Programming Language :: Python :: 3.12
15
- Classifier: Topic :: Software Development :: Documentation
16
- Requires-Python: >=3.10
17
- Description-Content-Type: text/markdown
18
- License-File: LICENSE
19
- Requires-Dist: click<9.0,>=8.1
20
- Requires-Dist: playwright<2.0,>=1.62
21
- Provides-Extra: dev
22
- Requires-Dist: build>=1.2; extra == "dev"
23
- Requires-Dist: pytest>=7; extra == "dev"
24
- Requires-Dist: twine>=5; extra == "dev"
25
- Dynamic: license-file
26
-
27
1
  # modao-prd-cli
28
2
 
29
3
  `modao-prd-cli` 将墨刀公开分享页采集为便于 Agent 读取的结构化文档和证据包。它使用本机 Chrome/Chromium 渲染页面,不登录墨刀、不保存 Cookie、不调用远程解析服务。
@@ -45,6 +19,18 @@ modao-prd-cli export "https://modao.cc/proto/<project-id>/sharing?view_mode=insp
45
19
  --format all
46
20
  ```
47
21
 
22
+ 导出后,Agent 不需要把完整 `document.json` 一次性读入上下文。先查看轻量索引,再按关键词、页面或事实 ID 查询:
23
+
24
+ ```bash
25
+ modao-prd-cli overview <project-id> --json
26
+ modao-prd-cli search <project-id> "奖励 概率" --json
27
+ modao-prd-cli screen <project-id> screen-001 --json
28
+ modao-prd-cli get <project-id> block-001 table-001 --json
29
+ modao-prd-cli unresolved <project-id> --json
30
+ ```
31
+
32
+ `<project-id>` 可以是项目 ID,也可以是证据包目录。`search`、`screen` 和 `unresolved` 默认最多返回 20 条、约 30 KB,并提供 `truncated` 与 `next_cursor`;需要更多结果时使用 `--cursor` 或增大 `--max-bytes`。
33
+
48
34
  不传 `--output` 时,工具会从当前工作目录向上查找最近的 Git 根目录,并将结果写入该项目根目录下的 `.modao-prd/<project-id>/`。如果当前目录不属于 Git 项目,则使用当前工作目录作为项目根目录。首次默认导出会在项目根目录的 `.gitignore` 中幂等加入 `/.modao-prd/`。
49
35
 
50
36
  如需指定其他位置,显式传入 `--output` 即可;此时不会修改项目的 `.gitignore`:
@@ -54,7 +40,7 @@ modao-prd-cli export "<墨刀公开分享链接>" \
54
40
  --format all --output ./modao-export
55
41
  ```
56
42
 
57
- 导出默认使用精简证据模式:保留结构化事实、DOM 布局快照、整页截图、可读画布截图和有效原型图片,过滤运行时代码、埋点资源和常见 UI 图标。DOM 快照也会排除 `script/style` 等运行时节点,避免把框架代码混进需求证据。需要排查渲染问题或核对视觉/无障碍细节时,再显式开启完整证据(debug/full)模式:
43
+ 导出默认使用精简证据模式:保留结构化事实、DOM 布局快照、可读画布截图和有效原型图片,过滤运行时代码、埋点资源和常见 UI 图标。DOM 快照也会排除 `script/style` 等运行时节点,避免把框架代码混进需求证据。需要排查渲染问题或核对视觉/无障碍细节时,再显式开启完整证据(debug/full)模式:
58
44
 
59
45
  ```bash
60
46
  modao-prd-cli export "<墨刀公开分享链接>" --format all \
@@ -73,6 +59,8 @@ modao-prd-cli export "<墨刀公开分享链接>" --format all \
73
59
  ├── document.json
74
60
  ├── document.md
75
61
  ├── document.ndjson
62
+ ├── agent-index.json
63
+ ├── search-index.sqlite
76
64
  ├── coverage.json
77
65
  └── evidence/
78
66
  ├── state-001.dom.json
@@ -84,9 +72,11 @@ modao-prd-cli export "<墨刀公开分享链接>" --format all \
84
72
  └── network/ # --evidence full
85
73
  ```
86
74
 
87
- 读取顺序建议为 `manifest.json → document.json → coverage.json → evidence/`。
75
+ 读取顺序建议为 `manifest.json → agent-index.json → coverage.json → search/get/screen → 必要时 document.json 或 evidence/`。
88
76
 
89
- - `document.json` 使用 schema 2.1,是面向 Agent 的紧凑精简投影,区分 `facts`(页面事实)和 `derived`(确定性启发式推导);需要人读时使用 `document.md`,需要逐条检索时使用 `document.ndjson`。
77
+ - `agent-index.json` 是面向 Agent 的轻量导航入口,只包含页面、表格、规则分类、交互摘要、覆盖率和警告,不替代事实。
78
+ - `search-index.sqlite` 是本地只读事实索引,包含所有可检索的 block、table、asset、状态、交互、规则和未覆盖项;查询不会访问网络,也不会把完整文档自动加载进上下文。
79
+ - `document.json` 使用 schema 2.1,是完整事实归档,区分 `facts`(页面事实)和 `derived`(确定性启发式推导)。它仍可能较大,默认通过查询命令按需读取;需要人读时使用 `document.md`,需要逐条流式处理时使用 `document.ndjson`。
90
80
  - `document.md` 是人工阅读摘要,不替代原始证据。
91
81
  - `document.ndjson` 是逐行知识单元,适合 RAG、向量化和增量处理。
92
82
  - 默认精简模式输出 DOM/布局证据、可读画布截图和过滤后的原型图片;`--evidence full` 额外保存浏览器整页截图、渲染 HTML、ARIA、相关 JSON/HTML 网络正文和网络索引。精简模式不会为了“完整”保存无助于需求分析的浏览器整页截图、JS、CSS、埋点或通用图标。
@@ -94,7 +84,7 @@ modao-prd-cli export "<墨刀公开分享链接>" --format all \
94
84
  - `--headed` 只控制是否显示浏览器窗口,便于 debug,不会单独切换证据级别;完整证据必须显式指定 `--evidence full`。
95
85
  - `coverage.json` 记录访问到的状态、动作、跳过项和部分完成原因。
96
86
 
97
- `document.json` 不重复内嵌完整 DOM 父子关系,也不重复输出旧版的 `document.blocks`、顶层 `requirements`、`tables` 等别名;布局树保存在 `evidence/state-*.dom.json`,主文档通过状态和精简证据引用回查。所有页面事实尽量带 `state_id`、`screen_id` 和核心 `evidence_ids`。发生冲突时,以截图、HTML、DOM、ARIA 和原始表格为准;`derived` 只作为分析线索。
87
+ `document.json` 不重复内嵌完整 DOM 父子关系,也不重复输出旧版的 `document.blocks`、顶层 `requirements`、`tables` 等别名;布局树保存在 `evidence/state-*.dom.json`,主文档通过状态和精简证据引用回查。所有页面事实尽量带 `state_id`、`screen_id` 和核心 `evidence_ids`。发生冲突时,以截图、HTML、DOM、ARIA 和原始表格为准;`derived` 只作为分析线索。为了避免漏需求,不要用 `agent-index.json` 替代事实归档;应通过 `search` 定位后再用 `get` 读取原始事实。
98
88
 
99
89
  退出码为 `0`(在策略范围内完成)、`2`(得到可用但部分完成的证据包)、`1`(未得到可用文档)。
100
90
 
@@ -1,4 +1,3 @@
1
1
  """Public Modao prototype extraction CLI."""
2
2
 
3
- __version__ = "0.1.0"
4
-
3
+ __version__ = "0.2.0"