ChatVoice 0.0.1__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.
- chatvoice-0.0.1/LICENSE +21 -0
- chatvoice-0.0.1/PKG-INFO +91 -0
- chatvoice-0.0.1/README.md +62 -0
- chatvoice-0.0.1/pyproject.toml +42 -0
- chatvoice-0.0.1/setup.cfg +4 -0
- chatvoice-0.0.1/src/ChatVoice.egg-info/PKG-INFO +91 -0
- chatvoice-0.0.1/src/ChatVoice.egg-info/SOURCES.txt +14 -0
- chatvoice-0.0.1/src/ChatVoice.egg-info/dependency_links.txt +1 -0
- chatvoice-0.0.1/src/ChatVoice.egg-info/entry_points.txt +5 -0
- chatvoice-0.0.1/src/ChatVoice.egg-info/requires.txt +14 -0
- chatvoice-0.0.1/src/ChatVoice.egg-info/top_level.txt +1 -0
- chatvoice-0.0.1/src/chatvoice/__init__.py +5 -0
- chatvoice-0.0.1/src/chatvoice/cli.py +94 -0
- chatvoice-0.0.1/src/chatvoice/config.py +27 -0
- chatvoice-0.0.1/tests/test_cli.py +21 -0
- chatvoice-0.0.1/tests/test_version.py +5 -0
chatvoice-0.0.1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 ChatArch
|
|
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.
|
chatvoice-0.0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ChatVoice
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: ChatArch voice recording, transcription, and meeting-notes toolkit.
|
|
5
|
+
Author-email: ChatArch <rex@chatarch.org>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/ChatArch/ChatVoice
|
|
8
|
+
Project-URL: Repository, https://github.com/ChatArch/ChatVoice
|
|
9
|
+
Project-URL: Documentation, https://arch.gh.wzhecnu.cn/ChatVoice/
|
|
10
|
+
Keywords: chatvoice,chatarch,cli
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Requires-Python: >=3.10
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
Requires-Dist: click>=8.0
|
|
17
|
+
Requires-Dist: chatstyle<0.2.0,>=0.1.0
|
|
18
|
+
Requires-Dist: chatenv<0.3.0,>=0.2.0
|
|
19
|
+
Provides-Extra: dev
|
|
20
|
+
Requires-Dist: build; extra == "dev"
|
|
21
|
+
Requires-Dist: pytest; extra == "dev"
|
|
22
|
+
Requires-Dist: twine; extra == "dev"
|
|
23
|
+
Provides-Extra: docs
|
|
24
|
+
Requires-Dist: mkdocs<2.0,>=1.6; extra == "docs"
|
|
25
|
+
Requires-Dist: mkdocs-material<9.7,>=9.5; extra == "docs"
|
|
26
|
+
Requires-Dist: mkdocs-static-i18n<2.0,>=1.2; extra == "docs"
|
|
27
|
+
Requires-Dist: mike<3.0,>=2.0; extra == "docs"
|
|
28
|
+
Dynamic: license-file
|
|
29
|
+
|
|
30
|
+
<div align="center">
|
|
31
|
+
<a href="https://pypi.python.org/pypi/ChatVoice">
|
|
32
|
+
<img src="https://img.shields.io/pypi/v/ChatVoice.svg" alt="PyPI version" />
|
|
33
|
+
</a>
|
|
34
|
+
<a href="https://github.com/ChatArch/ChatVoice/actions/workflows/ci.yml">
|
|
35
|
+
<img src="https://github.com/ChatArch/ChatVoice/actions/workflows/ci.yml/badge.svg" alt="Tests" />
|
|
36
|
+
</a>
|
|
37
|
+
<a href="https://arch.gh.wzhecnu.cn/ChatVoice/">
|
|
38
|
+
<img src="https://img.shields.io/badge/docs-mkdocs-blue.svg" alt="Documentation" />
|
|
39
|
+
</a>
|
|
40
|
+
</div>
|
|
41
|
+
|
|
42
|
+
<div align="center">
|
|
43
|
+
|
|
44
|
+
[英文版](README.en.md) | [简体中文](README.md)
|
|
45
|
+
</div>
|
|
46
|
+
|
|
47
|
+
# ChatVoice
|
|
48
|
+
|
|
49
|
+
ChatArch voice recording, transcription, and meeting-notes toolkit.
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
文档入口:<https://arch.gh.wzhecnu.cn/ChatVoice/>
|
|
53
|
+
|
|
54
|
+
按场景选择文档:
|
|
55
|
+
|
|
56
|
+
| 场景 | 文档 |
|
|
57
|
+
| --- | --- |
|
|
58
|
+
| 第一次安装、运行命令行、确认包可用 | [CLI 树](docs/cli-tree.md) |
|
|
59
|
+
| 校对当前包有哪些一等能力和边界 | [能力地图](docs/capability-map.md) |
|
|
60
|
+
| 从 Python 代码调用包能力 | [接口树](docs/interface-tree.md) |
|
|
61
|
+
|
|
62
|
+
## 快速开始
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
pip install -e ".[dev]"
|
|
66
|
+
chatvoice --help
|
|
67
|
+
chatvoice --version
|
|
68
|
+
python -m pytest -q
|
|
69
|
+
python -m build
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## 命令行规范
|
|
73
|
+
|
|
74
|
+
这个模板默认依赖 `chatstyle>=0.1.0,<0.2.0` 和 `chatenv>=0.2.0,<0.3.0`,新增命令应优先使用:
|
|
75
|
+
|
|
76
|
+
- `CommandSchema` / `CommandField` 描述输入。
|
|
77
|
+
- `add_interactive_option()` 提供统一 `-i/-I`。
|
|
78
|
+
- `resolve_command_inputs()` 统一缺参补问、默认值、TTY 与校验。
|
|
79
|
+
- 默认生成 `config.py` 和 `chatenv.configs` 入口点,使包可被 ChatEnv 发现;只有明确不需要 ChatEnv 接入时才使用 `--without-chatenv-provider`。
|
|
80
|
+
|
|
81
|
+
## 目录结构
|
|
82
|
+
|
|
83
|
+
- `src/`:包源码
|
|
84
|
+
- `tests/code-tests/`:代码测试和历史测试迁移
|
|
85
|
+
- `tests/cli-tests/`:真实 CLI 测试,doc-first
|
|
86
|
+
- `tests/mock-cli-tests/`:mock/fake CLI 测试,doc-first
|
|
87
|
+
- `docs/`:长期维护文档,由 mkdocs 构建
|
|
88
|
+
|
|
89
|
+
## 开发说明
|
|
90
|
+
|
|
91
|
+
扩展脚手架前,先阅读 `DEVELOP.md` 和 `AGENTS.md`。
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<a href="https://pypi.python.org/pypi/ChatVoice">
|
|
3
|
+
<img src="https://img.shields.io/pypi/v/ChatVoice.svg" alt="PyPI version" />
|
|
4
|
+
</a>
|
|
5
|
+
<a href="https://github.com/ChatArch/ChatVoice/actions/workflows/ci.yml">
|
|
6
|
+
<img src="https://github.com/ChatArch/ChatVoice/actions/workflows/ci.yml/badge.svg" alt="Tests" />
|
|
7
|
+
</a>
|
|
8
|
+
<a href="https://arch.gh.wzhecnu.cn/ChatVoice/">
|
|
9
|
+
<img src="https://img.shields.io/badge/docs-mkdocs-blue.svg" alt="Documentation" />
|
|
10
|
+
</a>
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
<div align="center">
|
|
14
|
+
|
|
15
|
+
[英文版](README.en.md) | [简体中文](README.md)
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
# ChatVoice
|
|
19
|
+
|
|
20
|
+
ChatArch voice recording, transcription, and meeting-notes toolkit.
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
文档入口:<https://arch.gh.wzhecnu.cn/ChatVoice/>
|
|
24
|
+
|
|
25
|
+
按场景选择文档:
|
|
26
|
+
|
|
27
|
+
| 场景 | 文档 |
|
|
28
|
+
| --- | --- |
|
|
29
|
+
| 第一次安装、运行命令行、确认包可用 | [CLI 树](docs/cli-tree.md) |
|
|
30
|
+
| 校对当前包有哪些一等能力和边界 | [能力地图](docs/capability-map.md) |
|
|
31
|
+
| 从 Python 代码调用包能力 | [接口树](docs/interface-tree.md) |
|
|
32
|
+
|
|
33
|
+
## 快速开始
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
pip install -e ".[dev]"
|
|
37
|
+
chatvoice --help
|
|
38
|
+
chatvoice --version
|
|
39
|
+
python -m pytest -q
|
|
40
|
+
python -m build
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## 命令行规范
|
|
44
|
+
|
|
45
|
+
这个模板默认依赖 `chatstyle>=0.1.0,<0.2.0` 和 `chatenv>=0.2.0,<0.3.0`,新增命令应优先使用:
|
|
46
|
+
|
|
47
|
+
- `CommandSchema` / `CommandField` 描述输入。
|
|
48
|
+
- `add_interactive_option()` 提供统一 `-i/-I`。
|
|
49
|
+
- `resolve_command_inputs()` 统一缺参补问、默认值、TTY 与校验。
|
|
50
|
+
- 默认生成 `config.py` 和 `chatenv.configs` 入口点,使包可被 ChatEnv 发现;只有明确不需要 ChatEnv 接入时才使用 `--without-chatenv-provider`。
|
|
51
|
+
|
|
52
|
+
## 目录结构
|
|
53
|
+
|
|
54
|
+
- `src/`:包源码
|
|
55
|
+
- `tests/code-tests/`:代码测试和历史测试迁移
|
|
56
|
+
- `tests/cli-tests/`:真实 CLI 测试,doc-first
|
|
57
|
+
- `tests/mock-cli-tests/`:mock/fake CLI 测试,doc-first
|
|
58
|
+
- `docs/`:长期维护文档,由 mkdocs 构建
|
|
59
|
+
|
|
60
|
+
## 开发说明
|
|
61
|
+
|
|
62
|
+
扩展脚手架前,先阅读 `DEVELOP.md` 和 `AGENTS.md`。
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "ChatVoice"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
description = "ChatArch voice recording, transcription, and meeting-notes toolkit."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
dependencies = ["click>=8.0", "chatstyle>=0.1.0,<0.2.0", "chatenv>=0.2.0,<0.3.0"]
|
|
13
|
+
authors = [{name = "ChatArch", email = "rex@chatarch.org"}]
|
|
14
|
+
keywords = ["chatvoice", "chatarch", "cli"]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Programming Language :: Python :: 3",
|
|
17
|
+
"Operating System :: OS Independent",
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
[project.urls]
|
|
21
|
+
Homepage = "https://github.com/ChatArch/ChatVoice"
|
|
22
|
+
Repository = "https://github.com/ChatArch/ChatVoice"
|
|
23
|
+
Documentation = "https://arch.gh.wzhecnu.cn/ChatVoice/"
|
|
24
|
+
|
|
25
|
+
[project.scripts]
|
|
26
|
+
chatvoice = "chatvoice.cli:main"
|
|
27
|
+
|
|
28
|
+
[project.entry-points."chatenv.configs"]
|
|
29
|
+
chatvoice = "chatvoice.config"
|
|
30
|
+
|
|
31
|
+
[project.optional-dependencies]
|
|
32
|
+
dev = ["build", "pytest", "twine"]
|
|
33
|
+
docs = ["mkdocs>=1.6,<2.0", "mkdocs-material>=9.5,<9.7", "mkdocs-static-i18n>=1.2,<2.0", "mike>=2.0,<3.0"]
|
|
34
|
+
|
|
35
|
+
[tool.setuptools.dynamic]
|
|
36
|
+
version = {attr = "chatvoice.__version__"}
|
|
37
|
+
|
|
38
|
+
[tool.setuptools.packages.find]
|
|
39
|
+
where = ["src"]
|
|
40
|
+
|
|
41
|
+
[tool.setuptools]
|
|
42
|
+
include-package-data = true
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ChatVoice
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: ChatArch voice recording, transcription, and meeting-notes toolkit.
|
|
5
|
+
Author-email: ChatArch <rex@chatarch.org>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/ChatArch/ChatVoice
|
|
8
|
+
Project-URL: Repository, https://github.com/ChatArch/ChatVoice
|
|
9
|
+
Project-URL: Documentation, https://arch.gh.wzhecnu.cn/ChatVoice/
|
|
10
|
+
Keywords: chatvoice,chatarch,cli
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Requires-Python: >=3.10
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
Requires-Dist: click>=8.0
|
|
17
|
+
Requires-Dist: chatstyle<0.2.0,>=0.1.0
|
|
18
|
+
Requires-Dist: chatenv<0.3.0,>=0.2.0
|
|
19
|
+
Provides-Extra: dev
|
|
20
|
+
Requires-Dist: build; extra == "dev"
|
|
21
|
+
Requires-Dist: pytest; extra == "dev"
|
|
22
|
+
Requires-Dist: twine; extra == "dev"
|
|
23
|
+
Provides-Extra: docs
|
|
24
|
+
Requires-Dist: mkdocs<2.0,>=1.6; extra == "docs"
|
|
25
|
+
Requires-Dist: mkdocs-material<9.7,>=9.5; extra == "docs"
|
|
26
|
+
Requires-Dist: mkdocs-static-i18n<2.0,>=1.2; extra == "docs"
|
|
27
|
+
Requires-Dist: mike<3.0,>=2.0; extra == "docs"
|
|
28
|
+
Dynamic: license-file
|
|
29
|
+
|
|
30
|
+
<div align="center">
|
|
31
|
+
<a href="https://pypi.python.org/pypi/ChatVoice">
|
|
32
|
+
<img src="https://img.shields.io/pypi/v/ChatVoice.svg" alt="PyPI version" />
|
|
33
|
+
</a>
|
|
34
|
+
<a href="https://github.com/ChatArch/ChatVoice/actions/workflows/ci.yml">
|
|
35
|
+
<img src="https://github.com/ChatArch/ChatVoice/actions/workflows/ci.yml/badge.svg" alt="Tests" />
|
|
36
|
+
</a>
|
|
37
|
+
<a href="https://arch.gh.wzhecnu.cn/ChatVoice/">
|
|
38
|
+
<img src="https://img.shields.io/badge/docs-mkdocs-blue.svg" alt="Documentation" />
|
|
39
|
+
</a>
|
|
40
|
+
</div>
|
|
41
|
+
|
|
42
|
+
<div align="center">
|
|
43
|
+
|
|
44
|
+
[英文版](README.en.md) | [简体中文](README.md)
|
|
45
|
+
</div>
|
|
46
|
+
|
|
47
|
+
# ChatVoice
|
|
48
|
+
|
|
49
|
+
ChatArch voice recording, transcription, and meeting-notes toolkit.
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
文档入口:<https://arch.gh.wzhecnu.cn/ChatVoice/>
|
|
53
|
+
|
|
54
|
+
按场景选择文档:
|
|
55
|
+
|
|
56
|
+
| 场景 | 文档 |
|
|
57
|
+
| --- | --- |
|
|
58
|
+
| 第一次安装、运行命令行、确认包可用 | [CLI 树](docs/cli-tree.md) |
|
|
59
|
+
| 校对当前包有哪些一等能力和边界 | [能力地图](docs/capability-map.md) |
|
|
60
|
+
| 从 Python 代码调用包能力 | [接口树](docs/interface-tree.md) |
|
|
61
|
+
|
|
62
|
+
## 快速开始
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
pip install -e ".[dev]"
|
|
66
|
+
chatvoice --help
|
|
67
|
+
chatvoice --version
|
|
68
|
+
python -m pytest -q
|
|
69
|
+
python -m build
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## 命令行规范
|
|
73
|
+
|
|
74
|
+
这个模板默认依赖 `chatstyle>=0.1.0,<0.2.0` 和 `chatenv>=0.2.0,<0.3.0`,新增命令应优先使用:
|
|
75
|
+
|
|
76
|
+
- `CommandSchema` / `CommandField` 描述输入。
|
|
77
|
+
- `add_interactive_option()` 提供统一 `-i/-I`。
|
|
78
|
+
- `resolve_command_inputs()` 统一缺参补问、默认值、TTY 与校验。
|
|
79
|
+
- 默认生成 `config.py` 和 `chatenv.configs` 入口点,使包可被 ChatEnv 发现;只有明确不需要 ChatEnv 接入时才使用 `--without-chatenv-provider`。
|
|
80
|
+
|
|
81
|
+
## 目录结构
|
|
82
|
+
|
|
83
|
+
- `src/`:包源码
|
|
84
|
+
- `tests/code-tests/`:代码测试和历史测试迁移
|
|
85
|
+
- `tests/cli-tests/`:真实 CLI 测试,doc-first
|
|
86
|
+
- `tests/mock-cli-tests/`:mock/fake CLI 测试,doc-first
|
|
87
|
+
- `docs/`:长期维护文档,由 mkdocs 构建
|
|
88
|
+
|
|
89
|
+
## 开发说明
|
|
90
|
+
|
|
91
|
+
扩展脚手架前,先阅读 `DEVELOP.md` 和 `AGENTS.md`。
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
src/ChatVoice.egg-info/PKG-INFO
|
|
5
|
+
src/ChatVoice.egg-info/SOURCES.txt
|
|
6
|
+
src/ChatVoice.egg-info/dependency_links.txt
|
|
7
|
+
src/ChatVoice.egg-info/entry_points.txt
|
|
8
|
+
src/ChatVoice.egg-info/requires.txt
|
|
9
|
+
src/ChatVoice.egg-info/top_level.txt
|
|
10
|
+
src/chatvoice/__init__.py
|
|
11
|
+
src/chatvoice/cli.py
|
|
12
|
+
src/chatvoice/config.py
|
|
13
|
+
tests/test_cli.py
|
|
14
|
+
tests/test_version.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
chatvoice
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"""CLI entrypoint for chatvoice."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import inspect
|
|
6
|
+
|
|
7
|
+
import click
|
|
8
|
+
|
|
9
|
+
from chatvoice import __version__
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def _purpose(command: click.Command) -> str:
|
|
13
|
+
text = command.short_help or inspect.getdoc(command.callback) or ""
|
|
14
|
+
return " ".join(text.strip().split()).rstrip(".")
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def _parameter_piece(parameter: click.Parameter) -> str | None:
|
|
18
|
+
if getattr(parameter, "hidden", False) or parameter.name == "help":
|
|
19
|
+
return None
|
|
20
|
+
if isinstance(parameter, click.Argument):
|
|
21
|
+
piece = parameter.name.upper().replace("_", "-")
|
|
22
|
+
if not parameter.required:
|
|
23
|
+
piece = f"[{piece}]"
|
|
24
|
+
if parameter.nargs == -1:
|
|
25
|
+
piece = f"{piece}..."
|
|
26
|
+
return piece
|
|
27
|
+
if not isinstance(parameter, click.Option):
|
|
28
|
+
return None
|
|
29
|
+
option_names = [name for name in (*parameter.opts, *parameter.secondary_opts) if name.startswith("--")]
|
|
30
|
+
if not option_names:
|
|
31
|
+
option_names = [name for name in (*parameter.opts, *parameter.secondary_opts) if name.startswith("-")]
|
|
32
|
+
if not option_names:
|
|
33
|
+
return None
|
|
34
|
+
if parameter.is_flag or parameter.flag_value is not None:
|
|
35
|
+
piece = "/".join(option_names)
|
|
36
|
+
else:
|
|
37
|
+
metavar = parameter.metavar or parameter.name.upper().replace("_", "-")
|
|
38
|
+
piece = f"{'/'.join(option_names)} {metavar}"
|
|
39
|
+
if not parameter.required:
|
|
40
|
+
piece = f"[{piece}]"
|
|
41
|
+
return piece
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def _command_signature(name: str, command: click.Command) -> str:
|
|
45
|
+
pieces = [piece for piece in (_parameter_piece(parameter) for parameter in command.params) if piece]
|
|
46
|
+
return " ".join([name, *pieces])
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def _render_command_tree(command: click.Command, name: str, prefix: str, is_last: bool, lines: list[str]) -> None:
|
|
50
|
+
connector = "└── " if is_last else "├── "
|
|
51
|
+
line = f"{prefix}{connector}{_command_signature(name, command)}"
|
|
52
|
+
purpose = _purpose(command)
|
|
53
|
+
if purpose:
|
|
54
|
+
line = f"{line} # {purpose}"
|
|
55
|
+
lines.append(line)
|
|
56
|
+
if not isinstance(command, click.Group):
|
|
57
|
+
return
|
|
58
|
+
children = [(child_name, child) for child_name, child in command.commands.items() if not child.hidden]
|
|
59
|
+
child_prefix = prefix + (" " if is_last else "│ ")
|
|
60
|
+
for index, (child_name, child) in enumerate(children):
|
|
61
|
+
_render_command_tree(child, child_name, child_prefix, index == len(children) - 1, lines)
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def _render_cli_tree(root: click.Group) -> str:
|
|
65
|
+
children = [(name, command) for name, command in root.commands.items() if not command.hidden]
|
|
66
|
+
lines = [f"chatvoice # {_purpose(root)}"]
|
|
67
|
+
root_options = [
|
|
68
|
+
("--help", "Show help for the current command."),
|
|
69
|
+
("--version", "Show package version."),
|
|
70
|
+
("--tree", "Print the registered CLI tree."),
|
|
71
|
+
]
|
|
72
|
+
for index, (option, purpose) in enumerate(root_options):
|
|
73
|
+
is_last = not children and index == len(root_options) - 1
|
|
74
|
+
lines.append(f"{'└──' if is_last else '├──'} {option} # {purpose}")
|
|
75
|
+
for index, (child_name, child) in enumerate(children):
|
|
76
|
+
_render_command_tree(child, child_name, "", index == len(children) - 1, lines)
|
|
77
|
+
return "\n".join(lines)
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
@click.group(invoke_without_command=True, no_args_is_help=True)
|
|
81
|
+
@click.version_option(__version__, prog_name="chatvoice")
|
|
82
|
+
@click.option("--tree", "show_tree", is_flag=True, is_eager=True, help="Print the registered CLI tree.")
|
|
83
|
+
@click.pass_context
|
|
84
|
+
def main(ctx: click.Context, show_tree: bool) -> None:
|
|
85
|
+
"""chatvoice command line interface."""
|
|
86
|
+
# Add package-specific commands here. Prefer ChatStyle helpers for
|
|
87
|
+
# interactive input when a command needs recoverable user input.
|
|
88
|
+
if show_tree:
|
|
89
|
+
click.echo(_render_cli_tree(ctx.command))
|
|
90
|
+
ctx.exit()
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
if __name__ == "__main__":
|
|
94
|
+
main()
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"Typed environment configuration for ChatVoice."
|
|
2
|
+
|
|
3
|
+
from chatenv import BaseEnvConfig, EnvField
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class ChatvoiceConfig(BaseEnvConfig):
|
|
7
|
+
"ChatVoice ChatEnv configuration."
|
|
8
|
+
|
|
9
|
+
_title = "ChatVoice Configuration"
|
|
10
|
+
_aliases = ["chatvoice"]
|
|
11
|
+
_storage_dir = "Chatvoice"
|
|
12
|
+
|
|
13
|
+
@classmethod
|
|
14
|
+
def test(cls) -> None:
|
|
15
|
+
"""Validate schema registration without external side effects."""
|
|
16
|
+
|
|
17
|
+
print(f"Testing {cls._title}...")
|
|
18
|
+
print("Schema loaded; no network test is required.")
|
|
19
|
+
|
|
20
|
+
CHATVOICE_API_KEY = EnvField(
|
|
21
|
+
"CHATVOICE_API_KEY",
|
|
22
|
+
desc="API key",
|
|
23
|
+
is_sensitive=True,
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
__all__ = ["ChatvoiceConfig"]
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
from click.testing import CliRunner
|
|
2
|
+
|
|
3
|
+
from chatvoice import __version__
|
|
4
|
+
from chatvoice.cli import main
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def test_version_option_reports_package_version():
|
|
8
|
+
result = CliRunner().invoke(main, ["--version"])
|
|
9
|
+
|
|
10
|
+
assert result.exit_code == 0
|
|
11
|
+
assert f"chatvoice, version {__version__}" in result.output
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def test_tree_option_prints_registered_cli_tree():
|
|
15
|
+
result = CliRunner().invoke(main, ["--tree"])
|
|
16
|
+
|
|
17
|
+
assert result.exit_code == 0, result.output
|
|
18
|
+
assert "chatvoice # chatvoice command line interface" in result.output
|
|
19
|
+
assert "├── --help # Show help for the current command." in result.output
|
|
20
|
+
assert "├── --version # Show package version." in result.output
|
|
21
|
+
assert "└── --tree # Print the registered CLI tree." in result.output
|