ChatQPet 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.
- chatqpet-0.0.1/LICENSE +21 -0
- chatqpet-0.0.1/PKG-INFO +101 -0
- chatqpet-0.0.1/README.md +72 -0
- chatqpet-0.0.1/pyproject.toml +42 -0
- chatqpet-0.0.1/setup.cfg +4 -0
- chatqpet-0.0.1/src/ChatQPet.egg-info/PKG-INFO +101 -0
- chatqpet-0.0.1/src/ChatQPet.egg-info/SOURCES.txt +16 -0
- chatqpet-0.0.1/src/ChatQPet.egg-info/dependency_links.txt +1 -0
- chatqpet-0.0.1/src/ChatQPet.egg-info/entry_points.txt +5 -0
- chatqpet-0.0.1/src/ChatQPet.egg-info/requires.txt +14 -0
- chatqpet-0.0.1/src/ChatQPet.egg-info/top_level.txt +1 -0
- chatqpet-0.0.1/src/chatqpet/__init__.py +5 -0
- chatqpet-0.0.1/src/chatqpet/cli.py +26 -0
- chatqpet-0.0.1/src/chatqpet/config.py +27 -0
- chatqpet-0.0.1/tests/test_cli.py +62 -0
- chatqpet-0.0.1/tests/test_config.py +7 -0
- chatqpet-0.0.1/tests/test_version.py +5 -0
- chatqpet-0.0.1/tests/test_workflow_contract.py +61 -0
chatqpet-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.
|
chatqpet-0.0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ChatQPet
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: ChatQPet: ChatArch QPet command-line package.
|
|
5
|
+
Author-email: ChatArch <1073853456@qq.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/ChatArch/ChatQPet
|
|
8
|
+
Project-URL: Repository, https://github.com/ChatArch/ChatQPet
|
|
9
|
+
Project-URL: Documentation, https://arch.gh.wzhecnu.cn/ChatQPet/
|
|
10
|
+
Keywords: chatqpet,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<9.0,>=8.0
|
|
17
|
+
Requires-Dist: chatstyle<0.3.0,>=0.2.0
|
|
18
|
+
Requires-Dist: chatenv<0.3.0,>=0.2.10
|
|
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/ChatQPet">
|
|
32
|
+
<img src="https://img.shields.io/pypi/v/ChatQPet.svg" alt="PyPI version" />
|
|
33
|
+
</a>
|
|
34
|
+
<a href="https://github.com/ChatArch/ChatQPet/actions/workflows/ci.yml">
|
|
35
|
+
<img src="https://github.com/ChatArch/ChatQPet/actions/workflows/ci.yml/badge.svg" alt="Tests" />
|
|
36
|
+
</a>
|
|
37
|
+
<a href="https://arch.gh.wzhecnu.cn/ChatQPet/">
|
|
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
|
+
# ChatQPet
|
|
48
|
+
|
|
49
|
+
ChatQPet: ChatArch QPet command-line package.
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
文档入口:<https://arch.gh.wzhecnu.cn/ChatQPet/>
|
|
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 ChatQPet
|
|
66
|
+
chatqpet --help
|
|
67
|
+
chatqpet --version
|
|
68
|
+
chatqpet --tree
|
|
69
|
+
chatqpet --tree-brief
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
开发环境:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
pip install -e ".[dev,docs]"
|
|
76
|
+
python -m pytest -q
|
|
77
|
+
mkdocs build --strict
|
|
78
|
+
python -m build
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## 命令行规范
|
|
82
|
+
|
|
83
|
+
这个占位包依赖 `chatstyle>=0.2.0,<0.3.0` 和 `chatenv>=0.2.10,<0.3.0`:
|
|
84
|
+
|
|
85
|
+
- `add_tree_option()` 从真实 Click 注册面提供 `--tree` / `--tree-brief`。
|
|
86
|
+
- `CommandSchema` / `CommandField` 描述输入。
|
|
87
|
+
- `add_interactive_option()` 提供统一 `-i/-I`。
|
|
88
|
+
- `resolve_command_inputs()` 统一缺参补问、默认值、TTY 与校验。
|
|
89
|
+
- 默认生成 `config.py` 和 `chatenv.configs` 入口点,使包可被 ChatEnv 发现;只有明确不需要 ChatEnv 接入时才使用 `--without-chatenv-provider`。
|
|
90
|
+
|
|
91
|
+
## 目录结构
|
|
92
|
+
|
|
93
|
+
- `src/`:包源码
|
|
94
|
+
- `tests/code-tests/`:代码测试和历史测试迁移
|
|
95
|
+
- `tests/cli-tests/`:真实 CLI 测试,doc-first
|
|
96
|
+
- `tests/mock-cli-tests/`:mock/fake CLI 测试,doc-first
|
|
97
|
+
- `docs/`:长期维护文档,由 mkdocs 构建
|
|
98
|
+
|
|
99
|
+
## 开发说明
|
|
100
|
+
|
|
101
|
+
扩展脚手架前,先阅读 `DEVELOP.md` 和 `AGENTS.md`。
|
chatqpet-0.0.1/README.md
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<a href="https://pypi.python.org/pypi/ChatQPet">
|
|
3
|
+
<img src="https://img.shields.io/pypi/v/ChatQPet.svg" alt="PyPI version" />
|
|
4
|
+
</a>
|
|
5
|
+
<a href="https://github.com/ChatArch/ChatQPet/actions/workflows/ci.yml">
|
|
6
|
+
<img src="https://github.com/ChatArch/ChatQPet/actions/workflows/ci.yml/badge.svg" alt="Tests" />
|
|
7
|
+
</a>
|
|
8
|
+
<a href="https://arch.gh.wzhecnu.cn/ChatQPet/">
|
|
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
|
+
# ChatQPet
|
|
19
|
+
|
|
20
|
+
ChatQPet: ChatArch QPet command-line package.
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
文档入口:<https://arch.gh.wzhecnu.cn/ChatQPet/>
|
|
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 ChatQPet
|
|
37
|
+
chatqpet --help
|
|
38
|
+
chatqpet --version
|
|
39
|
+
chatqpet --tree
|
|
40
|
+
chatqpet --tree-brief
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
开发环境:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
pip install -e ".[dev,docs]"
|
|
47
|
+
python -m pytest -q
|
|
48
|
+
mkdocs build --strict
|
|
49
|
+
python -m build
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## 命令行规范
|
|
53
|
+
|
|
54
|
+
这个占位包依赖 `chatstyle>=0.2.0,<0.3.0` 和 `chatenv>=0.2.10,<0.3.0`:
|
|
55
|
+
|
|
56
|
+
- `add_tree_option()` 从真实 Click 注册面提供 `--tree` / `--tree-brief`。
|
|
57
|
+
- `CommandSchema` / `CommandField` 描述输入。
|
|
58
|
+
- `add_interactive_option()` 提供统一 `-i/-I`。
|
|
59
|
+
- `resolve_command_inputs()` 统一缺参补问、默认值、TTY 与校验。
|
|
60
|
+
- 默认生成 `config.py` 和 `chatenv.configs` 入口点,使包可被 ChatEnv 发现;只有明确不需要 ChatEnv 接入时才使用 `--without-chatenv-provider`。
|
|
61
|
+
|
|
62
|
+
## 目录结构
|
|
63
|
+
|
|
64
|
+
- `src/`:包源码
|
|
65
|
+
- `tests/code-tests/`:代码测试和历史测试迁移
|
|
66
|
+
- `tests/cli-tests/`:真实 CLI 测试,doc-first
|
|
67
|
+
- `tests/mock-cli-tests/`:mock/fake CLI 测试,doc-first
|
|
68
|
+
- `docs/`:长期维护文档,由 mkdocs 构建
|
|
69
|
+
|
|
70
|
+
## 开发说明
|
|
71
|
+
|
|
72
|
+
扩展脚手架前,先阅读 `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 = "ChatQPet"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
description = "ChatQPet: ChatArch QPet command-line package."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
dependencies = ["click>=8.0,<9.0", "chatstyle>=0.2.0,<0.3.0", "chatenv>=0.2.10,<0.3.0"]
|
|
13
|
+
authors = [{name = "ChatArch", email = "1073853456@qq.com"}]
|
|
14
|
+
keywords = ["chatqpet", "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/ChatQPet"
|
|
22
|
+
Repository = "https://github.com/ChatArch/ChatQPet"
|
|
23
|
+
Documentation = "https://arch.gh.wzhecnu.cn/ChatQPet/"
|
|
24
|
+
|
|
25
|
+
[project.scripts]
|
|
26
|
+
chatqpet = "chatqpet.cli:main"
|
|
27
|
+
|
|
28
|
+
[project.entry-points."chatenv.configs"]
|
|
29
|
+
chatqpet = "chatqpet.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 = "chatqpet.__version__"}
|
|
37
|
+
|
|
38
|
+
[tool.setuptools.packages.find]
|
|
39
|
+
where = ["src"]
|
|
40
|
+
|
|
41
|
+
[tool.setuptools]
|
|
42
|
+
include-package-data = true
|
chatqpet-0.0.1/setup.cfg
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ChatQPet
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: ChatQPet: ChatArch QPet command-line package.
|
|
5
|
+
Author-email: ChatArch <1073853456@qq.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/ChatArch/ChatQPet
|
|
8
|
+
Project-URL: Repository, https://github.com/ChatArch/ChatQPet
|
|
9
|
+
Project-URL: Documentation, https://arch.gh.wzhecnu.cn/ChatQPet/
|
|
10
|
+
Keywords: chatqpet,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<9.0,>=8.0
|
|
17
|
+
Requires-Dist: chatstyle<0.3.0,>=0.2.0
|
|
18
|
+
Requires-Dist: chatenv<0.3.0,>=0.2.10
|
|
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/ChatQPet">
|
|
32
|
+
<img src="https://img.shields.io/pypi/v/ChatQPet.svg" alt="PyPI version" />
|
|
33
|
+
</a>
|
|
34
|
+
<a href="https://github.com/ChatArch/ChatQPet/actions/workflows/ci.yml">
|
|
35
|
+
<img src="https://github.com/ChatArch/ChatQPet/actions/workflows/ci.yml/badge.svg" alt="Tests" />
|
|
36
|
+
</a>
|
|
37
|
+
<a href="https://arch.gh.wzhecnu.cn/ChatQPet/">
|
|
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
|
+
# ChatQPet
|
|
48
|
+
|
|
49
|
+
ChatQPet: ChatArch QPet command-line package.
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
文档入口:<https://arch.gh.wzhecnu.cn/ChatQPet/>
|
|
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 ChatQPet
|
|
66
|
+
chatqpet --help
|
|
67
|
+
chatqpet --version
|
|
68
|
+
chatqpet --tree
|
|
69
|
+
chatqpet --tree-brief
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
开发环境:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
pip install -e ".[dev,docs]"
|
|
76
|
+
python -m pytest -q
|
|
77
|
+
mkdocs build --strict
|
|
78
|
+
python -m build
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## 命令行规范
|
|
82
|
+
|
|
83
|
+
这个占位包依赖 `chatstyle>=0.2.0,<0.3.0` 和 `chatenv>=0.2.10,<0.3.0`:
|
|
84
|
+
|
|
85
|
+
- `add_tree_option()` 从真实 Click 注册面提供 `--tree` / `--tree-brief`。
|
|
86
|
+
- `CommandSchema` / `CommandField` 描述输入。
|
|
87
|
+
- `add_interactive_option()` 提供统一 `-i/-I`。
|
|
88
|
+
- `resolve_command_inputs()` 统一缺参补问、默认值、TTY 与校验。
|
|
89
|
+
- 默认生成 `config.py` 和 `chatenv.configs` 入口点,使包可被 ChatEnv 发现;只有明确不需要 ChatEnv 接入时才使用 `--without-chatenv-provider`。
|
|
90
|
+
|
|
91
|
+
## 目录结构
|
|
92
|
+
|
|
93
|
+
- `src/`:包源码
|
|
94
|
+
- `tests/code-tests/`:代码测试和历史测试迁移
|
|
95
|
+
- `tests/cli-tests/`:真实 CLI 测试,doc-first
|
|
96
|
+
- `tests/mock-cli-tests/`:mock/fake CLI 测试,doc-first
|
|
97
|
+
- `docs/`:长期维护文档,由 mkdocs 构建
|
|
98
|
+
|
|
99
|
+
## 开发说明
|
|
100
|
+
|
|
101
|
+
扩展脚手架前,先阅读 `DEVELOP.md` 和 `AGENTS.md`。
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
src/ChatQPet.egg-info/PKG-INFO
|
|
5
|
+
src/ChatQPet.egg-info/SOURCES.txt
|
|
6
|
+
src/ChatQPet.egg-info/dependency_links.txt
|
|
7
|
+
src/ChatQPet.egg-info/entry_points.txt
|
|
8
|
+
src/ChatQPet.egg-info/requires.txt
|
|
9
|
+
src/ChatQPet.egg-info/top_level.txt
|
|
10
|
+
src/chatqpet/__init__.py
|
|
11
|
+
src/chatqpet/cli.py
|
|
12
|
+
src/chatqpet/config.py
|
|
13
|
+
tests/test_cli.py
|
|
14
|
+
tests/test_config.py
|
|
15
|
+
tests/test_version.py
|
|
16
|
+
tests/test_workflow_contract.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
chatqpet
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"""CLI entrypoint for chatqpet."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import click
|
|
6
|
+
from chatstyle import add_tree_option
|
|
7
|
+
|
|
8
|
+
from chatqpet import __version__
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@click.group(
|
|
12
|
+
name="chatqpet",
|
|
13
|
+
invoke_without_command=True,
|
|
14
|
+
no_args_is_help=True,
|
|
15
|
+
)
|
|
16
|
+
@click.version_option(__version__, prog_name="chatqpet")
|
|
17
|
+
@add_tree_option(renderer_options={"root_name": "chatqpet"})
|
|
18
|
+
def main() -> None:
|
|
19
|
+
"""ChatQPet placeholder command-line interface."""
|
|
20
|
+
# Add package-specific commands here. Prefer ChatStyle helpers for
|
|
21
|
+
# interactive input when a command needs recoverable user input.
|
|
22
|
+
pass
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
if __name__ == "__main__":
|
|
26
|
+
main()
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"Typed environment configuration for ChatQPet."
|
|
2
|
+
|
|
3
|
+
from chatenv import BaseEnvConfig, EnvField
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class ChatQPetConfig(BaseEnvConfig):
|
|
7
|
+
"ChatQPet ChatEnv configuration."
|
|
8
|
+
|
|
9
|
+
_title = "ChatQPet Configuration"
|
|
10
|
+
_aliases = ["chatqpet"]
|
|
11
|
+
_storage_dir = "ChatQPet"
|
|
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
|
+
CHATQPET_API_KEY = EnvField(
|
|
21
|
+
"CHATQPET_API_KEY",
|
|
22
|
+
desc="API key",
|
|
23
|
+
is_sensitive=True,
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
__all__ = ["ChatQPetConfig"]
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import click
|
|
2
|
+
from click.testing import CliRunner
|
|
3
|
+
from chatstyle import add_tree_option
|
|
4
|
+
|
|
5
|
+
from chatqpet import __version__
|
|
6
|
+
from chatqpet.cli import main
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def test_help_mentions_full_and_brief_tree_options():
|
|
10
|
+
result = CliRunner().invoke(main, ["--help"])
|
|
11
|
+
|
|
12
|
+
assert result.exit_code == 0
|
|
13
|
+
assert "--tree" in result.output
|
|
14
|
+
assert "--tree-brief" in result.output
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def test_version_option_reports_package_version():
|
|
18
|
+
result = CliRunner().invoke(main, ["--version"])
|
|
19
|
+
|
|
20
|
+
assert result.exit_code == 0
|
|
21
|
+
assert f"chatqpet, version {__version__}" in result.output
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def test_tree_reports_registered_root_only_surface():
|
|
25
|
+
result = CliRunner().invoke(main, ["--tree"])
|
|
26
|
+
|
|
27
|
+
assert result.exit_code == 0
|
|
28
|
+
assert result.output == (
|
|
29
|
+
"chatqpet\n"
|
|
30
|
+
"├── --help # Show this message and exit.\n"
|
|
31
|
+
"├── --version # Show the version and exit.\n"
|
|
32
|
+
"├── --tree # Print the registered CLI tree and exit.\n"
|
|
33
|
+
"└── --tree-brief # Print the registered CLI tree without parameter signatures and exit.\n"
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def test_tree_brief_reports_the_same_root_only_nodes():
|
|
38
|
+
full = CliRunner().invoke(main, ["--tree"])
|
|
39
|
+
brief = CliRunner().invoke(main, ["--tree-brief"])
|
|
40
|
+
|
|
41
|
+
assert brief.exit_code == 0
|
|
42
|
+
assert brief.output == full.output
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def test_tree_brief_omits_registered_command_signatures():
|
|
46
|
+
@click.group(name="sample")
|
|
47
|
+
@add_tree_option(renderer_options={"root_name": "sample"})
|
|
48
|
+
def sample() -> None:
|
|
49
|
+
"""Sample commands."""
|
|
50
|
+
|
|
51
|
+
@sample.command()
|
|
52
|
+
@click.argument("path")
|
|
53
|
+
def inspect(path: str) -> None:
|
|
54
|
+
"""Inspect a path."""
|
|
55
|
+
|
|
56
|
+
full = CliRunner().invoke(sample, ["--tree"])
|
|
57
|
+
brief = CliRunner().invoke(sample, ["--tree-brief"])
|
|
58
|
+
|
|
59
|
+
assert full.exit_code == brief.exit_code == 0
|
|
60
|
+
assert "inspect <PATH>" in full.output
|
|
61
|
+
assert "inspect # Inspect a path." in brief.output
|
|
62
|
+
assert "<PATH>" not in brief.output
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
|
|
3
|
+
from chatstyle import render_click_tree
|
|
4
|
+
|
|
5
|
+
from chatqpet.cli import main
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
ROOT = Path(__file__).resolve().parents[1]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def _text_blocks(path: Path) -> list[str]:
|
|
12
|
+
text = path.read_text(encoding="utf-8")
|
|
13
|
+
return [chunk.split("```", 1)[0].rstrip() for chunk in text.split("```text\n")[1:]]
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def test_runtime_dependency_contract():
|
|
17
|
+
pyproject = (ROOT / "pyproject.toml").read_text(encoding="utf-8")
|
|
18
|
+
cli = (ROOT / "src" / "chatqpet" / "cli.py").read_text(encoding="utf-8")
|
|
19
|
+
|
|
20
|
+
assert '"click>=8.0,<9.0"' in pyproject
|
|
21
|
+
assert '"chatstyle>=0.2.0,<0.3.0"' in pyproject
|
|
22
|
+
assert '"chatenv>=0.2.10,<0.3.0"' in pyproject
|
|
23
|
+
assert "add_tree_option" in cli
|
|
24
|
+
assert "_render_cli_tree" not in cli
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def test_publish_workflow_is_tag_only_oidc_and_main_guarded():
|
|
28
|
+
workflow = (ROOT / ".github" / "workflows" / "publish.yml").read_text(encoding="utf-8")
|
|
29
|
+
|
|
30
|
+
assert "tags:" in workflow
|
|
31
|
+
assert "workflow_dispatch" not in workflow
|
|
32
|
+
assert "id-token: write" in workflow
|
|
33
|
+
assert "environment:" not in workflow
|
|
34
|
+
assert "pypa/gh-action-pypi-publish@release/v1" in workflow
|
|
35
|
+
assert "git fetch --no-tags origin main:refs/remotes/origin/main" in workflow
|
|
36
|
+
assert 'git merge-base --is-ancestor "${GITHUB_SHA}" refs/remotes/origin/main' in workflow
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def test_ci_checks_installed_full_and_brief_trees_and_distributions():
|
|
40
|
+
workflow = (ROOT / ".github" / "workflows" / "ci.yml").read_text(encoding="utf-8")
|
|
41
|
+
|
|
42
|
+
assert 'python-version: ["3.10", "3.11", "3.12"]' in workflow
|
|
43
|
+
assert "chatqpet --version" in workflow
|
|
44
|
+
assert "chatqpet --tree" in workflow
|
|
45
|
+
assert "chatqpet --tree-brief" in workflow
|
|
46
|
+
assert "python -m build" in workflow
|
|
47
|
+
assert "python -m twine check dist/*" in workflow
|
|
48
|
+
assert '"$RUNNER_TEMP/chatqpet-wheel/bin/python" -m pip install dist/*.whl' in workflow
|
|
49
|
+
assert "mkdocs build --strict" in workflow
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def test_bilingual_cli_tree_docs_match_registered_trees():
|
|
53
|
+
expected = [
|
|
54
|
+
render_click_tree(main, root_name="chatqpet"),
|
|
55
|
+
render_click_tree(main, root_name="chatqpet", brief=True),
|
|
56
|
+
]
|
|
57
|
+
|
|
58
|
+
for path in (ROOT / "docs" / "cli-tree.md", ROOT / "docs" / "cli-tree.en.md"):
|
|
59
|
+
text = path.read_text(encoding="utf-8")
|
|
60
|
+
assert "chatstyle.add_tree_option()" in text
|
|
61
|
+
assert _text_blocks(path)[:2] == expected
|