scriptbook 1.0.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.
- scriptbook-1.0.0/.claude/settings.local.json +13 -0
- scriptbook-1.0.0/.gitignore +199 -0
- scriptbook-1.0.0/PKG-INFO +212 -0
- scriptbook-1.0.0/README.md +178 -0
- scriptbook-1.0.0/README_en.md +178 -0
- scriptbook-1.0.0/content/example.md +51 -0
- scriptbook-1.0.0/content/test_cases.md +325 -0
- scriptbook-1.0.0/content/test_interactive.md +46 -0
- scriptbook-1.0.0/docs/screenshot.png +0 -0
- scriptbook-1.0.0/pyproject.toml +58 -0
- scriptbook-1.0.0/pytest.ini +29 -0
- scriptbook-1.0.0/requirements-test.txt +15 -0
- scriptbook-1.0.0/requirements.txt +7 -0
- scriptbook-1.0.0/src/integration_tests/README.md +121 -0
- scriptbook-1.0.0/src/integration_tests/conftest.py +123 -0
- scriptbook-1.0.0/src/integration_tests/test_scriptbook_pytest.py +140 -0
- scriptbook-1.0.0/src/integration_tests/test_websocket_integration.py +273 -0
- scriptbook-1.0.0/src/scriptbook/__init__.py +5 -0
- scriptbook-1.0.0/src/scriptbook/cli.py +112 -0
- scriptbook-1.0.0/src/scriptbook/core/__init__.py +0 -0
- scriptbook-1.0.0/src/scriptbook/core/file_scanner.py +99 -0
- scriptbook-1.0.0/src/scriptbook/core/markdown_parser.py +160 -0
- scriptbook-1.0.0/src/scriptbook/core/plugin_manager.py +109 -0
- scriptbook-1.0.0/src/scriptbook/core/script_executor.py +116 -0
- scriptbook-1.0.0/src/scriptbook/main.py +70 -0
- scriptbook-1.0.0/src/scriptbook/models/__init__.py +0 -0
- scriptbook-1.0.0/src/scriptbook/models/schemas.py +58 -0
- scriptbook-1.0.0/src/scriptbook/plugins/dark-theme/manifest.json +8 -0
- scriptbook-1.0.0/src/scriptbook/plugins/dark-theme/style.css +248 -0
- scriptbook-1.0.0/src/scriptbook/plugins/default/manifest.json +8 -0
- scriptbook-1.0.0/src/scriptbook/plugins/default/style.css +202 -0
- scriptbook-1.0.0/src/scriptbook/routers/__init__.py +0 -0
- scriptbook-1.0.0/src/scriptbook/routers/markdown.py +214 -0
- scriptbook-1.0.0/src/scriptbook/routers/plugins.py +61 -0
- scriptbook-1.0.0/src/scriptbook/routers/scripts.py +160 -0
- scriptbook-1.0.0/src/scriptbook/static/css/main.css +353 -0
- scriptbook-1.0.0/src/scriptbook/static/index.html +77 -0
- scriptbook-1.0.0/src/scriptbook/static/js/app.js +352 -0
- scriptbook-1.0.0/src/scriptbook/static/js/plugin-loader.js +136 -0
- scriptbook-1.0.0/src/scriptbook/static/plugins/dark-theme/manifest.json +8 -0
- scriptbook-1.0.0/src/scriptbook/static/plugins/dark-theme/style.css +248 -0
- scriptbook-1.0.0/src/scriptbook/static/plugins/default/manifest.json +8 -0
- scriptbook-1.0.0/src/scriptbook/static/plugins/default/style.css +202 -0
- scriptbook-1.0.0/src/tests/__init__.py +1 -0
- scriptbook-1.0.0/src/tests/conftest.py +86 -0
- scriptbook-1.0.0/src/tests/js/README.md +216 -0
- scriptbook-1.0.0/src/tests/js/__mocks__/styleMock.js +2 -0
- scriptbook-1.0.0/src/tests/js/app.test.js +538 -0
- scriptbook-1.0.0/src/tests/js/package-lock.json +4462 -0
- scriptbook-1.0.0/src/tests/js/package.json +27 -0
- scriptbook-1.0.0/src/tests/js/run_js_tests.sh +55 -0
- scriptbook-1.0.0/src/tests/js/setup.js +38 -0
- scriptbook-1.0.0/src/tests/js/test-summary.md +198 -0
- scriptbook-1.0.0/src/tests/js/test_debug.js +32 -0
- scriptbook-1.0.0/src/tests/test_file_scanner.py +181 -0
- scriptbook-1.0.0/src/tests/test_markdown_parser.py +282 -0
- scriptbook-1.0.0/src/tests/test_plugin_manager.py +366 -0
- scriptbook-1.0.0/src/tests/test_report.py +204 -0
- scriptbook-1.0.0/src/tests/test_script_executor.py +323 -0
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py,cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
#Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# poetry
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
102
|
+
#poetry.lock
|
|
103
|
+
|
|
104
|
+
# pdm
|
|
105
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
106
|
+
#pdm.lock
|
|
107
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
|
108
|
+
# in version control.
|
|
109
|
+
# https://pdm.fming.dev/#use-with-ide
|
|
110
|
+
.pdm.toml
|
|
111
|
+
|
|
112
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
113
|
+
__pypackages__/
|
|
114
|
+
|
|
115
|
+
# Celery stuff
|
|
116
|
+
celerybeat-schedule
|
|
117
|
+
celerybeat.pid
|
|
118
|
+
|
|
119
|
+
# SageMath parsed files
|
|
120
|
+
*.sage.py
|
|
121
|
+
|
|
122
|
+
# Environments
|
|
123
|
+
.env
|
|
124
|
+
.venv
|
|
125
|
+
env/
|
|
126
|
+
venv/
|
|
127
|
+
ENV/
|
|
128
|
+
env.bak/
|
|
129
|
+
venv.bak/
|
|
130
|
+
|
|
131
|
+
# Spyder project settings
|
|
132
|
+
.spyderproject
|
|
133
|
+
.spyproject
|
|
134
|
+
|
|
135
|
+
# Rope project settings
|
|
136
|
+
.ropeproject
|
|
137
|
+
|
|
138
|
+
# mkdocs documentation
|
|
139
|
+
/site
|
|
140
|
+
|
|
141
|
+
# mypy
|
|
142
|
+
.mypy_cache/
|
|
143
|
+
.dmypy.json
|
|
144
|
+
dmypy.json
|
|
145
|
+
|
|
146
|
+
# Pyre type checker
|
|
147
|
+
.pyre/
|
|
148
|
+
|
|
149
|
+
# pytype static type analyzer
|
|
150
|
+
.pytype/
|
|
151
|
+
|
|
152
|
+
# Cython debug symbols
|
|
153
|
+
cython_debug/
|
|
154
|
+
|
|
155
|
+
# PyCharm
|
|
156
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
157
|
+
# be added to the global gitignore or merged into this project gitignore. For a PyCharm
|
|
158
|
+
# project, it is also possible to uncomment the following lines.
|
|
159
|
+
.idea/
|
|
160
|
+
|
|
161
|
+
# VSCode
|
|
162
|
+
.vscode/
|
|
163
|
+
|
|
164
|
+
# Node.js
|
|
165
|
+
node_modules/
|
|
166
|
+
npm-debug.log*
|
|
167
|
+
yarn-debug.log*
|
|
168
|
+
yarn-error.log*
|
|
169
|
+
|
|
170
|
+
# macOS
|
|
171
|
+
.DS_Store
|
|
172
|
+
.AppleDouble
|
|
173
|
+
.LSOverride
|
|
174
|
+
|
|
175
|
+
# Windows
|
|
176
|
+
Thumbs.db
|
|
177
|
+
ehthumbs.db
|
|
178
|
+
Desktop.ini
|
|
179
|
+
|
|
180
|
+
# Virtual environments
|
|
181
|
+
.venv/
|
|
182
|
+
venv/
|
|
183
|
+
ENV/
|
|
184
|
+
env.bak/
|
|
185
|
+
venv.bak/
|
|
186
|
+
|
|
187
|
+
# Testing
|
|
188
|
+
.pytest_cache/
|
|
189
|
+
.coverage
|
|
190
|
+
htmlcov/
|
|
191
|
+
|
|
192
|
+
# Temporary files
|
|
193
|
+
*.tmp
|
|
194
|
+
*.bak
|
|
195
|
+
*.swp
|
|
196
|
+
*~
|
|
197
|
+
|
|
198
|
+
# Log files
|
|
199
|
+
*.log
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: scriptbook
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Scriptbook - An executable Markdown server with script execution support, ideal for SOP automation
|
|
5
|
+
Project-URL: Homepage, https://github.com/lengmoXXL/scriptbook
|
|
6
|
+
Project-URL: Repository, https://github.com/lengmoXXL/scriptbook
|
|
7
|
+
Project-URL: Issues, https://github.com/lengmoXXL/scriptbook/issues
|
|
8
|
+
Author-email: lzy <forlearn_lzy@163.com>
|
|
9
|
+
License: MIT
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
19
|
+
Requires-Python: >=3.10
|
|
20
|
+
Requires-Dist: fastapi>=0.104.0
|
|
21
|
+
Requires-Dist: markdown>=3.5
|
|
22
|
+
Requires-Dist: pydantic>=2.0.0
|
|
23
|
+
Requires-Dist: python-multipart>=0.0.6
|
|
24
|
+
Requires-Dist: uvicorn[standard]>=0.24.0
|
|
25
|
+
Requires-Dist: watchdog>=3.0
|
|
26
|
+
Requires-Dist: websockets>=12.0
|
|
27
|
+
Provides-Extra: dev
|
|
28
|
+
Requires-Dist: coverage>=7.3.0; extra == 'dev'
|
|
29
|
+
Requires-Dist: pytest-asyncio>=1.3.0; extra == 'dev'
|
|
30
|
+
Requires-Dist: pytest-cov>=4.1.0; extra == 'dev'
|
|
31
|
+
Requires-Dist: pytest-mock>=3.12.0; extra == 'dev'
|
|
32
|
+
Requires-Dist: pytest>=9.0.2; extra == 'dev'
|
|
33
|
+
Description-Content-Type: text/markdown
|
|
34
|
+
|
|
35
|
+
# Scriptbook - 可执行脚本的 Markdown 服务器
|
|
36
|
+
|
|
37
|
+
[English](README_en.md)
|
|
38
|
+
|
|
39
|
+
一个支持脚本执行的在线 Markdown 服务器。借鉴 Jupyter Notebook 的设计理念,支持在 Markdown 文档中嵌入并执行脚本,非常适合 SOP(标准操作流程)自动化和交互式文档场景。
|
|
40
|
+
|
|
41
|
+
## 功能特性
|
|
42
|
+
|
|
43
|
+
- **交互式文档** - 在Markdown中嵌入可执行脚本,类似Jupyter Notebook
|
|
44
|
+
- **交互式输入** - 支持在脚本执行过程中接收用户输入(如`read`命令)
|
|
45
|
+
- **实时执行** - WebSocket实现脚本实时输出流
|
|
46
|
+
- **独立输出** - 每个脚本块下方有独立的输出区域
|
|
47
|
+
- **多文档支持** - 支持多个文档切换
|
|
48
|
+
- **主题切换** - 支持明亮和暗色主题
|
|
49
|
+
- **SOP自动化** - 适用于企业标准操作流程的展示和执行
|
|
50
|
+
- **完整测试** - 包含102个单元测试和集成测试
|
|
51
|
+
|
|
52
|
+
## 截图预览
|
|
53
|
+
|
|
54
|
+

|
|
55
|
+
|
|
56
|
+
## 快速开始
|
|
57
|
+
|
|
58
|
+
### 环境要求
|
|
59
|
+
- Python 3.10+
|
|
60
|
+
- 现代浏览器
|
|
61
|
+
|
|
62
|
+
### 安装
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
# 直接安装(推荐)
|
|
66
|
+
pip install scriptbook
|
|
67
|
+
|
|
68
|
+
# 或者从源码安装
|
|
69
|
+
git clone https://github.com/lengmoXXL/scriptbook.git
|
|
70
|
+
cd scriptbook
|
|
71
|
+
pip install .
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### 使用方法
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
# 启动服务(使用默认content目录)
|
|
78
|
+
scriptbook content/
|
|
79
|
+
|
|
80
|
+
# 指定自定义文档目录
|
|
81
|
+
scriptbook /path/to/my/documents/
|
|
82
|
+
|
|
83
|
+
# 指定端口
|
|
84
|
+
scriptbook content/ --port 9000
|
|
85
|
+
|
|
86
|
+
# 允许外部访问
|
|
87
|
+
scriptbook content/ --host 0.0.0.0
|
|
88
|
+
|
|
89
|
+
# 访问应用
|
|
90
|
+
open http://localhost:8000
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
**注意**: 修改代码后请手动重启服务以应用更改。
|
|
94
|
+
|
|
95
|
+
## 发布信息
|
|
96
|
+
|
|
97
|
+
### PyPI安装
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
pip install scriptbook
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
**PyPI链接**: https://pypi.org/project/scriptbook/
|
|
104
|
+
|
|
105
|
+
### 版本
|
|
106
|
+
|
|
107
|
+
- 当前版本: 1.0.0
|
|
108
|
+
- Python要求: >=3.10
|
|
109
|
+
|
|
110
|
+
### 更新日志
|
|
111
|
+
|
|
112
|
+
#### v1.0.0 (2025-12-21)
|
|
113
|
+
- 项目重命名为 Scriptbook
|
|
114
|
+
- 新增交互式输入功能,支持在脚本执行过程中接收用户输入
|
|
115
|
+
- 新增25个JavaScript单元测试
|
|
116
|
+
- 重组测试目录结构,统一管理测试文件
|
|
117
|
+
- 优化WebSocket通信,支持stdin双向交互
|
|
118
|
+
- 所有102个测试全部通过
|
|
119
|
+
|
|
120
|
+
### 许可证
|
|
121
|
+
|
|
122
|
+
MIT License
|
|
123
|
+
|
|
124
|
+
### GitHub仓库
|
|
125
|
+
|
|
126
|
+
- 源码: https://github.com/lengmoXXL/scriptbook
|
|
127
|
+
- 问题反馈: https://github.com/lengmoXXL/scriptbook/issues
|
|
128
|
+
|
|
129
|
+
## 测试
|
|
130
|
+
|
|
131
|
+
本项目包含完整的测试套件,总计102个测试用例。
|
|
132
|
+
|
|
133
|
+
### 运行所有测试
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
# 运行所有测试(单元测试 + 集成测试)
|
|
137
|
+
pytest src/ src/integration_tests/ -v
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### 分别运行测试
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
# Python 单元测试
|
|
144
|
+
pytest src/tests/ -v
|
|
145
|
+
|
|
146
|
+
# JavaScript 单元测试
|
|
147
|
+
cd src/tests/js
|
|
148
|
+
npm test
|
|
149
|
+
|
|
150
|
+
# 集成测试
|
|
151
|
+
pytest src/integration_tests/ -v
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### 测试覆盖率
|
|
155
|
+
|
|
156
|
+
- **JavaScript 测试**: 25个测试用例(使用Jest + JSDOM)
|
|
157
|
+
- **Python 单元测试**: 64个测试用例
|
|
158
|
+
- **集成测试**: 13个测试用例
|
|
159
|
+
- **总测试数**: 102个,全部通过
|
|
160
|
+
|
|
161
|
+
测试覆盖:
|
|
162
|
+
- App类初始化和基本功能
|
|
163
|
+
- 全局函数(executeScript、copyCode、sendInput)
|
|
164
|
+
- WebSocket事件处理
|
|
165
|
+
- 文件扫描和Markdown解析
|
|
166
|
+
- 插件管理系统
|
|
167
|
+
- 脚本执行器
|
|
168
|
+
- 交互式输入功能
|
|
169
|
+
|
|
170
|
+
## 开发指南
|
|
171
|
+
|
|
172
|
+
### 本地开发
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
# 克隆仓库
|
|
176
|
+
git clone https://github.com/lengmoXXL/scriptbook.git
|
|
177
|
+
cd scriptbook
|
|
178
|
+
|
|
179
|
+
# 创建虚拟环境
|
|
180
|
+
python -m venv .venv
|
|
181
|
+
source .venv/bin/activate
|
|
182
|
+
|
|
183
|
+
# 安装依赖
|
|
184
|
+
pip install -e .
|
|
185
|
+
pip install -r requirements-test.txt
|
|
186
|
+
|
|
187
|
+
# 安装JavaScript测试依赖(仅测试需要)
|
|
188
|
+
cd src/tests/js
|
|
189
|
+
npm install
|
|
190
|
+
|
|
191
|
+
# 返回根目录
|
|
192
|
+
cd /path/to/scriptbook
|
|
193
|
+
|
|
194
|
+
# 运行所有测试
|
|
195
|
+
pytest src/ src/integration_tests/ -v
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### 发布到PyPI
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
# 构建包
|
|
202
|
+
python -m build
|
|
203
|
+
|
|
204
|
+
# 上传到PyPI
|
|
205
|
+
twine upload dist/*
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
或者使用GitHub Actions进行自动发布。
|
|
209
|
+
|
|
210
|
+
---
|
|
211
|
+
|
|
212
|
+
**Scriptbook** - 让文档更易于理解和执行
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
# Scriptbook - 可执行脚本的 Markdown 服务器
|
|
2
|
+
|
|
3
|
+
[English](README_en.md)
|
|
4
|
+
|
|
5
|
+
一个支持脚本执行的在线 Markdown 服务器。借鉴 Jupyter Notebook 的设计理念,支持在 Markdown 文档中嵌入并执行脚本,非常适合 SOP(标准操作流程)自动化和交互式文档场景。
|
|
6
|
+
|
|
7
|
+
## 功能特性
|
|
8
|
+
|
|
9
|
+
- **交互式文档** - 在Markdown中嵌入可执行脚本,类似Jupyter Notebook
|
|
10
|
+
- **交互式输入** - 支持在脚本执行过程中接收用户输入(如`read`命令)
|
|
11
|
+
- **实时执行** - WebSocket实现脚本实时输出流
|
|
12
|
+
- **独立输出** - 每个脚本块下方有独立的输出区域
|
|
13
|
+
- **多文档支持** - 支持多个文档切换
|
|
14
|
+
- **主题切换** - 支持明亮和暗色主题
|
|
15
|
+
- **SOP自动化** - 适用于企业标准操作流程的展示和执行
|
|
16
|
+
- **完整测试** - 包含102个单元测试和集成测试
|
|
17
|
+
|
|
18
|
+
## 截图预览
|
|
19
|
+
|
|
20
|
+

|
|
21
|
+
|
|
22
|
+
## 快速开始
|
|
23
|
+
|
|
24
|
+
### 环境要求
|
|
25
|
+
- Python 3.10+
|
|
26
|
+
- 现代浏览器
|
|
27
|
+
|
|
28
|
+
### 安装
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
# 直接安装(推荐)
|
|
32
|
+
pip install scriptbook
|
|
33
|
+
|
|
34
|
+
# 或者从源码安装
|
|
35
|
+
git clone https://github.com/lengmoXXL/scriptbook.git
|
|
36
|
+
cd scriptbook
|
|
37
|
+
pip install .
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### 使用方法
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
# 启动服务(使用默认content目录)
|
|
44
|
+
scriptbook content/
|
|
45
|
+
|
|
46
|
+
# 指定自定义文档目录
|
|
47
|
+
scriptbook /path/to/my/documents/
|
|
48
|
+
|
|
49
|
+
# 指定端口
|
|
50
|
+
scriptbook content/ --port 9000
|
|
51
|
+
|
|
52
|
+
# 允许外部访问
|
|
53
|
+
scriptbook content/ --host 0.0.0.0
|
|
54
|
+
|
|
55
|
+
# 访问应用
|
|
56
|
+
open http://localhost:8000
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**注意**: 修改代码后请手动重启服务以应用更改。
|
|
60
|
+
|
|
61
|
+
## 发布信息
|
|
62
|
+
|
|
63
|
+
### PyPI安装
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
pip install scriptbook
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
**PyPI链接**: https://pypi.org/project/scriptbook/
|
|
70
|
+
|
|
71
|
+
### 版本
|
|
72
|
+
|
|
73
|
+
- 当前版本: 1.0.0
|
|
74
|
+
- Python要求: >=3.10
|
|
75
|
+
|
|
76
|
+
### 更新日志
|
|
77
|
+
|
|
78
|
+
#### v1.0.0 (2025-12-21)
|
|
79
|
+
- 项目重命名为 Scriptbook
|
|
80
|
+
- 新增交互式输入功能,支持在脚本执行过程中接收用户输入
|
|
81
|
+
- 新增25个JavaScript单元测试
|
|
82
|
+
- 重组测试目录结构,统一管理测试文件
|
|
83
|
+
- 优化WebSocket通信,支持stdin双向交互
|
|
84
|
+
- 所有102个测试全部通过
|
|
85
|
+
|
|
86
|
+
### 许可证
|
|
87
|
+
|
|
88
|
+
MIT License
|
|
89
|
+
|
|
90
|
+
### GitHub仓库
|
|
91
|
+
|
|
92
|
+
- 源码: https://github.com/lengmoXXL/scriptbook
|
|
93
|
+
- 问题反馈: https://github.com/lengmoXXL/scriptbook/issues
|
|
94
|
+
|
|
95
|
+
## 测试
|
|
96
|
+
|
|
97
|
+
本项目包含完整的测试套件,总计102个测试用例。
|
|
98
|
+
|
|
99
|
+
### 运行所有测试
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
# 运行所有测试(单元测试 + 集成测试)
|
|
103
|
+
pytest src/ src/integration_tests/ -v
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### 分别运行测试
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
# Python 单元测试
|
|
110
|
+
pytest src/tests/ -v
|
|
111
|
+
|
|
112
|
+
# JavaScript 单元测试
|
|
113
|
+
cd src/tests/js
|
|
114
|
+
npm test
|
|
115
|
+
|
|
116
|
+
# 集成测试
|
|
117
|
+
pytest src/integration_tests/ -v
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### 测试覆盖率
|
|
121
|
+
|
|
122
|
+
- **JavaScript 测试**: 25个测试用例(使用Jest + JSDOM)
|
|
123
|
+
- **Python 单元测试**: 64个测试用例
|
|
124
|
+
- **集成测试**: 13个测试用例
|
|
125
|
+
- **总测试数**: 102个,全部通过
|
|
126
|
+
|
|
127
|
+
测试覆盖:
|
|
128
|
+
- App类初始化和基本功能
|
|
129
|
+
- 全局函数(executeScript、copyCode、sendInput)
|
|
130
|
+
- WebSocket事件处理
|
|
131
|
+
- 文件扫描和Markdown解析
|
|
132
|
+
- 插件管理系统
|
|
133
|
+
- 脚本执行器
|
|
134
|
+
- 交互式输入功能
|
|
135
|
+
|
|
136
|
+
## 开发指南
|
|
137
|
+
|
|
138
|
+
### 本地开发
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
# 克隆仓库
|
|
142
|
+
git clone https://github.com/lengmoXXL/scriptbook.git
|
|
143
|
+
cd scriptbook
|
|
144
|
+
|
|
145
|
+
# 创建虚拟环境
|
|
146
|
+
python -m venv .venv
|
|
147
|
+
source .venv/bin/activate
|
|
148
|
+
|
|
149
|
+
# 安装依赖
|
|
150
|
+
pip install -e .
|
|
151
|
+
pip install -r requirements-test.txt
|
|
152
|
+
|
|
153
|
+
# 安装JavaScript测试依赖(仅测试需要)
|
|
154
|
+
cd src/tests/js
|
|
155
|
+
npm install
|
|
156
|
+
|
|
157
|
+
# 返回根目录
|
|
158
|
+
cd /path/to/scriptbook
|
|
159
|
+
|
|
160
|
+
# 运行所有测试
|
|
161
|
+
pytest src/ src/integration_tests/ -v
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### 发布到PyPI
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
# 构建包
|
|
168
|
+
python -m build
|
|
169
|
+
|
|
170
|
+
# 上传到PyPI
|
|
171
|
+
twine upload dist/*
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
或者使用GitHub Actions进行自动发布。
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
**Scriptbook** - 让文档更易于理解和执行
|