endo 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.
- endo-0.3.0/.gitignore +55 -0
- endo-0.3.0/.pre-commit-config.yaml +22 -0
- endo-0.3.0/.python-version +1 -0
- endo-0.3.0/.vscode/settings.json +36 -0
- endo-0.3.0/LICENSE +21 -0
- endo-0.3.0/PKG-INFO +169 -0
- endo-0.3.0/README.md +116 -0
- endo-0.3.0/backend/endo/__init__.py +0 -0
- endo-0.3.0/backend/endo/api/__init__.py +0 -0
- endo-0.3.0/backend/endo/api/deps.py +5 -0
- endo-0.3.0/backend/endo/api/v1/__init__.py +0 -0
- endo-0.3.0/backend/endo/api/v1/analysis.py +82 -0
- endo-0.3.0/backend/endo/api/v1/attachments.py +206 -0
- endo-0.3.0/backend/endo/api/v1/exports.py +133 -0
- endo-0.3.0/backend/endo/api/v1/projects.py +96 -0
- endo-0.3.0/backend/endo/api/v1/requirements.py +253 -0
- endo-0.3.0/backend/endo/api/v1/tests.py +175 -0
- endo-0.3.0/backend/endo/core/__init__.py +0 -0
- endo-0.3.0/backend/endo/core/config.py +50 -0
- endo-0.3.0/backend/endo/core/database.py +25 -0
- endo-0.3.0/backend/endo/core/plugin_registry.py +81 -0
- endo-0.3.0/backend/endo/main.py +92 -0
- endo-0.3.0/backend/endo/models/__init__.py +0 -0
- endo-0.3.0/backend/endo/models/attachment.py +47 -0
- endo-0.3.0/backend/endo/models/base.py +30 -0
- endo-0.3.0/backend/endo/models/project.py +24 -0
- endo-0.3.0/backend/endo/models/requirement.py +105 -0
- endo-0.3.0/backend/endo/models/test.py +79 -0
- endo-0.3.0/backend/endo/plugins/__init__.py +0 -0
- endo-0.3.0/backend/endo/plugins/analysis/__init__.py +0 -0
- endo-0.3.0/backend/endo/plugins/analysis/plugin.py +34 -0
- endo-0.3.0/backend/endo/plugins/attachment/__init__.py +0 -0
- endo-0.3.0/backend/endo/plugins/attachment/plugin.py +24 -0
- endo-0.3.0/backend/endo/plugins/base.py +60 -0
- endo-0.3.0/backend/endo/plugins/export/__init__.py +0 -0
- endo-0.3.0/backend/endo/plugins/export/plugin.py +25 -0
- endo-0.3.0/backend/endo/plugins/project/__init__.py +0 -0
- endo-0.3.0/backend/endo/plugins/project/plugin.py +30 -0
- endo-0.3.0/backend/endo/plugins/requirement/__init__.py +0 -0
- endo-0.3.0/backend/endo/plugins/requirement/plugin.py +38 -0
- endo-0.3.0/backend/endo/plugins/test/__init__.py +0 -0
- endo-0.3.0/backend/endo/plugins/test/plugin.py +34 -0
- endo-0.3.0/backend/endo/runner.py +1275 -0
- endo-0.3.0/backend/endo/schemas/__init__.py +0 -0
- endo-0.3.0/backend/endo/schemas/analysis.py +53 -0
- endo-0.3.0/backend/endo/schemas/attachment.py +43 -0
- endo-0.3.0/backend/endo/schemas/project.py +30 -0
- endo-0.3.0/backend/endo/schemas/requirement.py +133 -0
- endo-0.3.0/backend/endo/schemas/test.py +99 -0
- endo-0.3.0/backend/endo/services/__init__.py +0 -0
- endo-0.3.0/backend/endo/services/document_parser.py +353 -0
- endo-0.3.0/backend/endo/services/export_service.py +562 -0
- endo-0.3.0/frontend/.gitignore +24 -0
- endo-0.3.0/frontend/README.md +73 -0
- endo-0.3.0/frontend/eslint.config.js +22 -0
- endo-0.3.0/frontend/index.html +13 -0
- endo-0.3.0/frontend/package-lock.json +3304 -0
- endo-0.3.0/frontend/package.json +30 -0
- endo-0.3.0/frontend/pnpm-lock.yaml +2369 -0
- endo-0.3.0/frontend/public/favicon.svg +1 -0
- endo-0.3.0/frontend/public/icons.svg +24 -0
- endo-0.3.0/frontend/src/App.css +184 -0
- endo-0.3.0/frontend/src/App.tsx +36 -0
- endo-0.3.0/frontend/src/api/client.ts +18 -0
- endo-0.3.0/frontend/src/api/index.ts +407 -0
- endo-0.3.0/frontend/src/components/AttachmentManager.tsx +295 -0
- endo-0.3.0/frontend/src/components/ExportButton.tsx +84 -0
- endo-0.3.0/frontend/src/index.css +110 -0
- endo-0.3.0/frontend/src/layouts/MainLayout.tsx +180 -0
- endo-0.3.0/frontend/src/main.tsx +30 -0
- endo-0.3.0/frontend/src/pages/analysis/DocumentAnalysis.tsx +349 -0
- endo-0.3.0/frontend/src/pages/dashboard/Dashboard.tsx +201 -0
- endo-0.3.0/frontend/src/pages/projects/ProjectList.tsx +146 -0
- endo-0.3.0/frontend/src/pages/requirements/RequirementDetail.tsx +236 -0
- endo-0.3.0/frontend/src/pages/requirements/RequirementList.tsx +244 -0
- endo-0.3.0/frontend/src/pages/requirements/RequirementStatistics.tsx +120 -0
- endo-0.3.0/frontend/src/pages/requirements/RequirementTraceability.tsx +174 -0
- endo-0.3.0/frontend/src/pages/requirements/RequirementTree.tsx +91 -0
- endo-0.3.0/frontend/src/pages/tests/TestDetail.tsx +247 -0
- endo-0.3.0/frontend/src/pages/tests/TestList.tsx +251 -0
- endo-0.3.0/frontend/src/pages/tests/TestStatistics.tsx +131 -0
- endo-0.3.0/frontend/src/vite-env.d.ts +1 -0
- endo-0.3.0/frontend/tsconfig.app.json +34 -0
- endo-0.3.0/frontend/tsconfig.json +11 -0
- endo-0.3.0/frontend/tsconfig.node.json +28 -0
- endo-0.3.0/frontend/vite.config.ts +21 -0
- endo-0.3.0/hatch_build.py +72 -0
- endo-0.3.0/pyproject.toml +134 -0
- endo-0.3.0/tests/fixtures/__init__.py +0 -0
- endo-0.3.0/tests/fixtures/generate_fixtures.py +255 -0
- endo-0.3.0/tests/fixtures/sample_requirements.docx +0 -0
- endo-0.3.0/tests/fixtures/sample_requirements.pdf +0 -0
- endo-0.3.0/tests/test_api.py +24 -0
- endo-0.3.0/tox.ini +37 -0
- endo-0.3.0/uv.lock +4044 -0
endo-0.3.0/.gitignore
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Python-generated files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[oc]
|
|
4
|
+
build/
|
|
5
|
+
dist/
|
|
6
|
+
wheels/
|
|
7
|
+
*.egg-info
|
|
8
|
+
|
|
9
|
+
# Virtual environments
|
|
10
|
+
.venv
|
|
11
|
+
venv/
|
|
12
|
+
env/
|
|
13
|
+
|
|
14
|
+
# 数据库与运行时
|
|
15
|
+
*.db
|
|
16
|
+
*.sqlite
|
|
17
|
+
*.sqlite3
|
|
18
|
+
backend/uploads/
|
|
19
|
+
|
|
20
|
+
# 前端
|
|
21
|
+
node_modules/
|
|
22
|
+
.vite
|
|
23
|
+
frontend/dist/
|
|
24
|
+
frontend/.vite/
|
|
25
|
+
*.tsbuildinfo
|
|
26
|
+
backend/endo/static/
|
|
27
|
+
|
|
28
|
+
# 测试与覆盖率
|
|
29
|
+
.pytest_cache/
|
|
30
|
+
.coverage
|
|
31
|
+
coverage.xml
|
|
32
|
+
htmlcov/
|
|
33
|
+
.tox/
|
|
34
|
+
coverage/
|
|
35
|
+
|
|
36
|
+
# IDE
|
|
37
|
+
.idea/
|
|
38
|
+
*.swp
|
|
39
|
+
*.swo
|
|
40
|
+
.DS_Store
|
|
41
|
+
Thumbs.db
|
|
42
|
+
|
|
43
|
+
# CI 产物
|
|
44
|
+
release-assets/
|
|
45
|
+
assets/
|
|
46
|
+
RELEASE_NOTES.md
|
|
47
|
+
|
|
48
|
+
# 环境变量
|
|
49
|
+
.env
|
|
50
|
+
.env.local
|
|
51
|
+
.env.*.local
|
|
52
|
+
|
|
53
|
+
# 日志
|
|
54
|
+
*.log
|
|
55
|
+
logs/
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# prek compatible configuration
|
|
2
|
+
# See https://pre-commit.com for more information
|
|
3
|
+
repos:
|
|
4
|
+
- repo: https://gitcode.com/gh_mirrors/ru/ruff-pre-commit.git
|
|
5
|
+
# Ruff version - keep in sync with pyproject.toml
|
|
6
|
+
rev: v0.15.4
|
|
7
|
+
hooks:
|
|
8
|
+
# Run the linter
|
|
9
|
+
- id: ruff
|
|
10
|
+
args: [ --fix, --exit-non-zero-on-fix ]
|
|
11
|
+
# Run the formatter
|
|
12
|
+
- id: ruff-format
|
|
13
|
+
args: [ --config=pyproject.toml]
|
|
14
|
+
- repo: https://gitcode.com/gh_mirrors/pr/pre-commit-hooks.git
|
|
15
|
+
rev: v5.0.0
|
|
16
|
+
hooks:
|
|
17
|
+
- id: check-merge-conflict
|
|
18
|
+
- id: debug-statements
|
|
19
|
+
- id: fix-byte-order-marker
|
|
20
|
+
- id: trailing-whitespace
|
|
21
|
+
args: [ --markdown-linebreak-ext=md ]
|
|
22
|
+
- id: end-of-file-fixer
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.13
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"[python]": {
|
|
3
|
+
"editor.codeActionsOnSave": {
|
|
4
|
+
"source.fixAll.ruff": "always",
|
|
5
|
+
"source.organizeImports.ruff": "always",
|
|
6
|
+
"source.sort.json": "always"
|
|
7
|
+
},
|
|
8
|
+
"editor.defaultFormatter": "charliermarsh.ruff",
|
|
9
|
+
"editor.formatOnSave": true
|
|
10
|
+
},
|
|
11
|
+
"[toml]": {
|
|
12
|
+
"editor.defaultFormatter": "tamasfe.even-better-toml",
|
|
13
|
+
"editor.formatOnSave": true
|
|
14
|
+
},
|
|
15
|
+
"evenBetterToml.formatter.alignComments": true,
|
|
16
|
+
"evenBetterToml.formatter.alignEntries": true,
|
|
17
|
+
"evenBetterToml.formatter.allowedBlankLines": 1,
|
|
18
|
+
"evenBetterToml.formatter.arrayAutoCollapse": true,
|
|
19
|
+
"evenBetterToml.formatter.arrayAutoExpand": true,
|
|
20
|
+
"evenBetterToml.formatter.arrayTrailingComma": true,
|
|
21
|
+
"evenBetterToml.formatter.columnWidth": 120,
|
|
22
|
+
"evenBetterToml.formatter.compactEntries": false,
|
|
23
|
+
"evenBetterToml.formatter.indentEntries": false,
|
|
24
|
+
"evenBetterToml.formatter.indentTables": false,
|
|
25
|
+
"evenBetterToml.formatter.reorderArrays": true,
|
|
26
|
+
"evenBetterToml.formatter.reorderInlineTables": true,
|
|
27
|
+
"evenBetterToml.formatter.reorderKeys": true,
|
|
28
|
+
"python.languageServer": "None",
|
|
29
|
+
"python.testing.pytestArgs": [
|
|
30
|
+
"src",
|
|
31
|
+
"tests",
|
|
32
|
+
],
|
|
33
|
+
"python.testing.pytestEnabled": true,
|
|
34
|
+
"python.testing.unittestEnabled": false,
|
|
35
|
+
"ruff.importStrategy": "fromEnvironment"
|
|
36
|
+
}
|
endo-0.3.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 endo Team
|
|
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.
|
endo-0.3.0/PKG-INFO
ADDED
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: endo
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: Integrated Product Development Platform for Structural Design
|
|
5
|
+
Project-URL: Changelog, https://github.com/endo/endo/releases
|
|
6
|
+
Project-URL: Documentation, https://github.com/endo/endo#readme
|
|
7
|
+
Project-URL: Homepage, https://github.com/endo/endo
|
|
8
|
+
Project-URL: Issues, https://github.com/endo/endo/issues
|
|
9
|
+
Project-URL: Repository, https://github.com/endo/endo
|
|
10
|
+
Author-email: endo Team <dev@endo.example.com>
|
|
11
|
+
Maintainer-email: endo Team <dev@endo.example.com>
|
|
12
|
+
License-Expression: MIT
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Keywords: fastapi,ipd,product-development,requirements,traceability
|
|
15
|
+
Classifier: Development Status :: 3 - Alpha
|
|
16
|
+
Classifier: Framework :: FastAPI
|
|
17
|
+
Classifier: Intended Audience :: Developers
|
|
18
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
19
|
+
Classifier: Operating System :: OS Independent
|
|
20
|
+
Classifier: Programming Language :: Python :: 3
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
26
|
+
Classifier: Topic :: Office/Business
|
|
27
|
+
Classifier: Topic :: Software Development
|
|
28
|
+
Requires-Python: >=3.9
|
|
29
|
+
Requires-Dist: alembic>=1.14.0
|
|
30
|
+
Requires-Dist: fastapi>=0.115.0
|
|
31
|
+
Requires-Dist: openpyxl>=3.1.0
|
|
32
|
+
Requires-Dist: pdfplumber>=0.11.0
|
|
33
|
+
Requires-Dist: pydantic-settings>=2.0.0
|
|
34
|
+
Requires-Dist: pydantic>=2.0.0
|
|
35
|
+
Requires-Dist: python-docx>=1.1.0
|
|
36
|
+
Requires-Dist: python-multipart>=0.0.9
|
|
37
|
+
Requires-Dist: sqlalchemy>=2.0.0
|
|
38
|
+
Requires-Dist: uvicorn[standard]>=0.34.0
|
|
39
|
+
Provides-Extra: dev
|
|
40
|
+
Requires-Dist: hatch>=1.14.2; extra == 'dev'
|
|
41
|
+
Requires-Dist: httpx>=0.28.0; extra == 'dev'
|
|
42
|
+
Requires-Dist: prek>=0.4.5; extra == 'dev'
|
|
43
|
+
Requires-Dist: pytest-asyncio>=0.24.0; extra == 'dev'
|
|
44
|
+
Requires-Dist: pytest-cov>=5.0.0; extra == 'dev'
|
|
45
|
+
Requires-Dist: pytest-html>=4.1.1; extra == 'dev'
|
|
46
|
+
Requires-Dist: pytest-mock>=3.14.0; extra == 'dev'
|
|
47
|
+
Requires-Dist: pytest-xdist>=3.6.1; extra == 'dev'
|
|
48
|
+
Requires-Dist: pytest>=8.0.0; extra == 'dev'
|
|
49
|
+
Requires-Dist: ruff>=0.8.0; extra == 'dev'
|
|
50
|
+
Requires-Dist: tox-uv>=1.13.1; extra == 'dev'
|
|
51
|
+
Requires-Dist: tox>=4.25.0; extra == 'dev'
|
|
52
|
+
Description-Content-Type: text/markdown
|
|
53
|
+
|
|
54
|
+
# endo
|
|
55
|
+
|
|
56
|
+
**Integrated Product Development Platform for Structural Design**
|
|
57
|
+
|
|
58
|
+
endo 是一个面向结构设计领域的集成产品开发平台,提供需求管理、追溯矩阵、测试管理与文档导出能力。
|
|
59
|
+
|
|
60
|
+
## 功能特性
|
|
61
|
+
|
|
62
|
+
- **需求管理**:层级需求树、版本控制、评审流程
|
|
63
|
+
- **追溯矩阵**:需求间双向追溯关系(衍生/依赖/验证/满足)
|
|
64
|
+
- **测试管理**:测试用例库、执行记录、缺陷跟踪
|
|
65
|
+
- **附件管理**:多态关联文件上传/下载(项目/需求/测试用例)
|
|
66
|
+
- **文档导出**:需求规格书 PDF、追溯矩阵 Excel、测试报告 PDF
|
|
67
|
+
- **插件架构**:模块化设计,按需启用功能插件
|
|
68
|
+
- **影响分析**:需求变更影响范围分析
|
|
69
|
+
|
|
70
|
+
## 快速开始
|
|
71
|
+
|
|
72
|
+
### 安装
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
pip install endo
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### 启动服务
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
# 启动后端 API 服务(默认 127.0.0.1:8000)
|
|
82
|
+
ipd
|
|
83
|
+
|
|
84
|
+
# 指定监听地址和端口
|
|
85
|
+
ipd serve --host 0.0.0.0 --port 8080
|
|
86
|
+
|
|
87
|
+
# 开发模式(自动重载)
|
|
88
|
+
ipd serve --reload
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
访问 API 文档:http://127.0.0.1:8000/docs
|
|
92
|
+
|
|
93
|
+
### 开发模式(前后端联调)
|
|
94
|
+
|
|
95
|
+
在源码仓库内执行:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
ipd dev # 同时启动后端(8000)和前端(5173)
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## 技术栈
|
|
102
|
+
|
|
103
|
+
**后端**
|
|
104
|
+
- FastAPI + Uvicorn(异步 Web 框架)
|
|
105
|
+
- SQLAlchemy 2.0 + Alembic(ORM 与迁移)
|
|
106
|
+
- Pydantic v2(数据校验)
|
|
107
|
+
- ReportLab / OpenPyXL(PDF / Excel 生成)
|
|
108
|
+
|
|
109
|
+
**前端**
|
|
110
|
+
- React 18 + TypeScript
|
|
111
|
+
- Ant Design 5(UI 组件库)
|
|
112
|
+
- Vite(构建工具)
|
|
113
|
+
|
|
114
|
+
## 项目结构
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
endo/
|
|
118
|
+
├── backend/
|
|
119
|
+
│ └── endo/
|
|
120
|
+
│ ├── api/v1/ # REST API 端点
|
|
121
|
+
│ ├── core/ # 配置、数据库、插件注册
|
|
122
|
+
│ ├── models/ # SQLAlchemy 数据模型
|
|
123
|
+
│ ├── schemas/ # Pydantic 校验模型
|
|
124
|
+
│ ├── services/ # 业务逻辑(导出、解析)
|
|
125
|
+
│ ├── plugins/ # 功能插件
|
|
126
|
+
│ └── main.py # 应用入口
|
|
127
|
+
├── frontend/ # React 前端
|
|
128
|
+
├── tests/ # 测试
|
|
129
|
+
└── pyproject.toml
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## 插件体系
|
|
133
|
+
|
|
134
|
+
endo 采用插件架构,核心功能以插件形式注册:
|
|
135
|
+
|
|
136
|
+
| 插件 | 功能 |
|
|
137
|
+
|------|------|
|
|
138
|
+
| `project` | 项目管理 |
|
|
139
|
+
| `requirement` | 需求管理 + 追溯关系 |
|
|
140
|
+
| `test` | 测试用例 + 执行记录 |
|
|
141
|
+
| `analysis` | 影响分析 |
|
|
142
|
+
| `attachment` | 文件附件管理 |
|
|
143
|
+
| `export` | 文档导出(PDF/Excel) |
|
|
144
|
+
|
|
145
|
+
## 开发
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
# 安装开发依赖
|
|
149
|
+
uv sync --extra dev
|
|
150
|
+
|
|
151
|
+
# 运行测试
|
|
152
|
+
ipd test
|
|
153
|
+
|
|
154
|
+
# 代码检查
|
|
155
|
+
ipd lint
|
|
156
|
+
|
|
157
|
+
# 构建前后端
|
|
158
|
+
ipd build
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## 系统要求
|
|
162
|
+
|
|
163
|
+
- **操作系统**:Windows 10+ / macOS 10.15+ / Linux
|
|
164
|
+
- **Python**:3.9+
|
|
165
|
+
- **Node.js**:20+(仅开发前端时需要)
|
|
166
|
+
|
|
167
|
+
## 许可证
|
|
168
|
+
|
|
169
|
+
[MIT](LICENSE)
|
endo-0.3.0/README.md
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# endo
|
|
2
|
+
|
|
3
|
+
**Integrated Product Development Platform for Structural Design**
|
|
4
|
+
|
|
5
|
+
endo 是一个面向结构设计领域的集成产品开发平台,提供需求管理、追溯矩阵、测试管理与文档导出能力。
|
|
6
|
+
|
|
7
|
+
## 功能特性
|
|
8
|
+
|
|
9
|
+
- **需求管理**:层级需求树、版本控制、评审流程
|
|
10
|
+
- **追溯矩阵**:需求间双向追溯关系(衍生/依赖/验证/满足)
|
|
11
|
+
- **测试管理**:测试用例库、执行记录、缺陷跟踪
|
|
12
|
+
- **附件管理**:多态关联文件上传/下载(项目/需求/测试用例)
|
|
13
|
+
- **文档导出**:需求规格书 PDF、追溯矩阵 Excel、测试报告 PDF
|
|
14
|
+
- **插件架构**:模块化设计,按需启用功能插件
|
|
15
|
+
- **影响分析**:需求变更影响范围分析
|
|
16
|
+
|
|
17
|
+
## 快速开始
|
|
18
|
+
|
|
19
|
+
### 安装
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pip install endo
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### 启动服务
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# 启动后端 API 服务(默认 127.0.0.1:8000)
|
|
29
|
+
ipd
|
|
30
|
+
|
|
31
|
+
# 指定监听地址和端口
|
|
32
|
+
ipd serve --host 0.0.0.0 --port 8080
|
|
33
|
+
|
|
34
|
+
# 开发模式(自动重载)
|
|
35
|
+
ipd serve --reload
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
访问 API 文档:http://127.0.0.1:8000/docs
|
|
39
|
+
|
|
40
|
+
### 开发模式(前后端联调)
|
|
41
|
+
|
|
42
|
+
在源码仓库内执行:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
ipd dev # 同时启动后端(8000)和前端(5173)
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## 技术栈
|
|
49
|
+
|
|
50
|
+
**后端**
|
|
51
|
+
- FastAPI + Uvicorn(异步 Web 框架)
|
|
52
|
+
- SQLAlchemy 2.0 + Alembic(ORM 与迁移)
|
|
53
|
+
- Pydantic v2(数据校验)
|
|
54
|
+
- ReportLab / OpenPyXL(PDF / Excel 生成)
|
|
55
|
+
|
|
56
|
+
**前端**
|
|
57
|
+
- React 18 + TypeScript
|
|
58
|
+
- Ant Design 5(UI 组件库)
|
|
59
|
+
- Vite(构建工具)
|
|
60
|
+
|
|
61
|
+
## 项目结构
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
endo/
|
|
65
|
+
├── backend/
|
|
66
|
+
│ └── endo/
|
|
67
|
+
│ ├── api/v1/ # REST API 端点
|
|
68
|
+
│ ├── core/ # 配置、数据库、插件注册
|
|
69
|
+
│ ├── models/ # SQLAlchemy 数据模型
|
|
70
|
+
│ ├── schemas/ # Pydantic 校验模型
|
|
71
|
+
│ ├── services/ # 业务逻辑(导出、解析)
|
|
72
|
+
│ ├── plugins/ # 功能插件
|
|
73
|
+
│ └── main.py # 应用入口
|
|
74
|
+
├── frontend/ # React 前端
|
|
75
|
+
├── tests/ # 测试
|
|
76
|
+
└── pyproject.toml
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## 插件体系
|
|
80
|
+
|
|
81
|
+
endo 采用插件架构,核心功能以插件形式注册:
|
|
82
|
+
|
|
83
|
+
| 插件 | 功能 |
|
|
84
|
+
|------|------|
|
|
85
|
+
| `project` | 项目管理 |
|
|
86
|
+
| `requirement` | 需求管理 + 追溯关系 |
|
|
87
|
+
| `test` | 测试用例 + 执行记录 |
|
|
88
|
+
| `analysis` | 影响分析 |
|
|
89
|
+
| `attachment` | 文件附件管理 |
|
|
90
|
+
| `export` | 文档导出(PDF/Excel) |
|
|
91
|
+
|
|
92
|
+
## 开发
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
# 安装开发依赖
|
|
96
|
+
uv sync --extra dev
|
|
97
|
+
|
|
98
|
+
# 运行测试
|
|
99
|
+
ipd test
|
|
100
|
+
|
|
101
|
+
# 代码检查
|
|
102
|
+
ipd lint
|
|
103
|
+
|
|
104
|
+
# 构建前后端
|
|
105
|
+
ipd build
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## 系统要求
|
|
109
|
+
|
|
110
|
+
- **操作系统**:Windows 10+ / macOS 10.15+ / Linux
|
|
111
|
+
- **Python**:3.9+
|
|
112
|
+
- **Node.js**:20+(仅开发前端时需要)
|
|
113
|
+
|
|
114
|
+
## 许可证
|
|
115
|
+
|
|
116
|
+
[MIT](LICENSE)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"""文档解析 API 路由"""
|
|
2
|
+
|
|
3
|
+
import io
|
|
4
|
+
|
|
5
|
+
from fastapi import APIRouter, Depends, File, HTTPException, UploadFile
|
|
6
|
+
from sqlalchemy.orm import Session
|
|
7
|
+
|
|
8
|
+
from endo.api.deps import get_db
|
|
9
|
+
from endo.models.requirement import Requirement
|
|
10
|
+
from endo.schemas.analysis import (
|
|
11
|
+
ImportResult,
|
|
12
|
+
ImportToRequirementRequest,
|
|
13
|
+
ParseResultResponse,
|
|
14
|
+
)
|
|
15
|
+
from endo.services.document_parser import parse_document
|
|
16
|
+
|
|
17
|
+
router = APIRouter()
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
@router.post("/parse", response_model=ParseResultResponse)
|
|
21
|
+
async def parse_file(file: UploadFile = File(...)):
|
|
22
|
+
"""上传文件并解析出结构化技术要求"""
|
|
23
|
+
if not file.filename:
|
|
24
|
+
raise HTTPException(status_code=400, detail="文件名不能为空")
|
|
25
|
+
|
|
26
|
+
content = await file.read()
|
|
27
|
+
if not content:
|
|
28
|
+
raise HTTPException(status_code=400, detail="文件内容为空")
|
|
29
|
+
|
|
30
|
+
# 限制文件大小 20MB
|
|
31
|
+
if len(content) > 20 * 1024 * 1024:
|
|
32
|
+
raise HTTPException(status_code=413, detail="文件过大,限制 20MB")
|
|
33
|
+
|
|
34
|
+
try:
|
|
35
|
+
result = parse_document(
|
|
36
|
+
io.BytesIO(content),
|
|
37
|
+
file.filename,
|
|
38
|
+
file.content_type or "",
|
|
39
|
+
)
|
|
40
|
+
except ValueError as e:
|
|
41
|
+
raise HTTPException(status_code=400, detail=str(e)) from e
|
|
42
|
+
except Exception as e:
|
|
43
|
+
raise HTTPException(status_code=500, detail=f"解析失败: {e}") from e
|
|
44
|
+
|
|
45
|
+
return result.to_dict()
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
@router.post("/import", response_model=ImportResult, status_code=201)
|
|
49
|
+
def import_to_requirements(
|
|
50
|
+
data: ImportToRequirementRequest,
|
|
51
|
+
db: Session = Depends(get_db),
|
|
52
|
+
):
|
|
53
|
+
"""将解析结果导入为需求条目"""
|
|
54
|
+
if not data.items:
|
|
55
|
+
raise HTTPException(status_code=400, detail="没有可导入的条目")
|
|
56
|
+
|
|
57
|
+
created: list[dict] = []
|
|
58
|
+
for item in data.items:
|
|
59
|
+
params = [p.model_dump() for p in item.parameters]
|
|
60
|
+
# 参数摘要追加到描述
|
|
61
|
+
param_summary = ""
|
|
62
|
+
if params:
|
|
63
|
+
param_summary = "\n\n关键参数:\n" + "\n".join(
|
|
64
|
+
f"- {p['name']} {p['operator']} {p['value']} {p['unit']}".strip() for p in params
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
req = Requirement(
|
|
68
|
+
project_id=data.project_id,
|
|
69
|
+
req_code=item.raw_code or f"REQ-{item.index:03d}",
|
|
70
|
+
title=item.title or f"导入条目 {item.index}",
|
|
71
|
+
description=item.content + param_summary,
|
|
72
|
+
category=item.category,
|
|
73
|
+
priority=data.default_priority,
|
|
74
|
+
source=data.default_source or "文档解析导入",
|
|
75
|
+
created_by=data.created_by,
|
|
76
|
+
structural_constraints={"parameters": params} if params else None,
|
|
77
|
+
)
|
|
78
|
+
db.add(req)
|
|
79
|
+
created.append({"req_code": req.req_code, "title": req.title})
|
|
80
|
+
|
|
81
|
+
db.commit()
|
|
82
|
+
return ImportResult(imported=len(created), items=created)
|