chatgame 0.0.1__py3-none-any.whl
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.
- chatgame/__init__.py +5 -0
- chatgame/cli.py +40 -0
- chatgame-0.0.1.dist-info/METADATA +74 -0
- chatgame-0.0.1.dist-info/RECORD +8 -0
- chatgame-0.0.1.dist-info/WHEEL +5 -0
- chatgame-0.0.1.dist-info/entry_points.txt +2 -0
- chatgame-0.0.1.dist-info/licenses/LICENSE +21 -0
- chatgame-0.0.1.dist-info/top_level.txt +1 -0
chatgame/__init__.py
ADDED
chatgame/cli.py
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"""CLI entrypoint for chatgame."""
|
|
2
|
+
|
|
3
|
+
import click
|
|
4
|
+
from chatstyle import (
|
|
5
|
+
CommandField,
|
|
6
|
+
CommandSchema,
|
|
7
|
+
add_interactive_option,
|
|
8
|
+
render_success,
|
|
9
|
+
resolve_command_inputs,
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
HELLO_SCHEMA = CommandSchema(
|
|
14
|
+
name="hello",
|
|
15
|
+
fields=(CommandField("name", prompt="name", required=True),),
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
@click.group()
|
|
20
|
+
def main() -> None:
|
|
21
|
+
"""chatgame command line interface."""
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
@main.command()
|
|
25
|
+
@click.argument("name", required=False)
|
|
26
|
+
@add_interactive_option
|
|
27
|
+
def hello(name: str | None, interactive: bool | None) -> None:
|
|
28
|
+
"""Print a greeting with ChatStyle-backed input resolution."""
|
|
29
|
+
|
|
30
|
+
values = resolve_command_inputs(
|
|
31
|
+
schema=HELLO_SCHEMA,
|
|
32
|
+
provided={"name": name},
|
|
33
|
+
interactive=interactive,
|
|
34
|
+
usage="Usage: chatgame hello [NAME]",
|
|
35
|
+
)
|
|
36
|
+
render_success(f"Hello, {values['name']}!")
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
if __name__ == "__main__":
|
|
40
|
+
main()
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: chatgame
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: chatgame package
|
|
5
|
+
Author-email: ChatArch <1073853456@qq.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Keywords: chatgame,chatarch,cli
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Requires-Python: >=3.10
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Requires-Dist: click>=8.0
|
|
14
|
+
Requires-Dist: chatstyle>=0.1.0
|
|
15
|
+
Requires-Dist: chatenv>=0.1.1
|
|
16
|
+
Provides-Extra: dev
|
|
17
|
+
Requires-Dist: build; extra == "dev"
|
|
18
|
+
Requires-Dist: pytest; extra == "dev"
|
|
19
|
+
Requires-Dist: twine; extra == "dev"
|
|
20
|
+
Provides-Extra: docs
|
|
21
|
+
Requires-Dist: mkdocs>=1.4.0; extra == "docs"
|
|
22
|
+
Requires-Dist: mkdocs-material>=9.0.0; extra == "docs"
|
|
23
|
+
Requires-Dist: mike>=2.0.0; extra == "docs"
|
|
24
|
+
Dynamic: license-file
|
|
25
|
+
|
|
26
|
+
<div align="center">
|
|
27
|
+
<a href="https://pypi.python.org/pypi/chatgame">
|
|
28
|
+
<img src="https://img.shields.io/pypi/v/chatgame.svg" alt="PyPI version" />
|
|
29
|
+
</a>
|
|
30
|
+
<a href="https://github.com/OWNER/REPO/actions/workflows/ci.yml">
|
|
31
|
+
<img src="https://github.com/OWNER/REPO/actions/workflows/ci.yml/badge.svg" alt="Tests" />
|
|
32
|
+
</a>
|
|
33
|
+
<a href="https://OWNER.github.io/REPO">
|
|
34
|
+
<img src="https://img.shields.io/badge/docs-mkdocs-blue.svg" alt="Documentation" />
|
|
35
|
+
</a>
|
|
36
|
+
</div>
|
|
37
|
+
|
|
38
|
+
<div align="center">
|
|
39
|
+
|
|
40
|
+
[English](README.en.md) | [简体中文](README.md)
|
|
41
|
+
</div>
|
|
42
|
+
|
|
43
|
+
# chatgame
|
|
44
|
+
|
|
45
|
+
chatgame package
|
|
46
|
+
|
|
47
|
+
## 快速开始
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
pip install -e ".[dev]"
|
|
51
|
+
chatgame hello ChatArch
|
|
52
|
+
python -m pytest -q
|
|
53
|
+
python -m build
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## CLI 规范
|
|
57
|
+
|
|
58
|
+
这个模板默认依赖 `chatstyle>=0.1.0` 和 `chatenv>=0.1.1`,新的命令应优先使用:
|
|
59
|
+
|
|
60
|
+
- `CommandSchema` / `CommandField` 描述输入。
|
|
61
|
+
- `add_interactive_option()` 提供统一 `-i/-I`。
|
|
62
|
+
- `resolve_command_inputs()` 统一缺参补问、默认值、TTY 与校验。
|
|
63
|
+
|
|
64
|
+
## 目录结构
|
|
65
|
+
|
|
66
|
+
- `src/`:包源码
|
|
67
|
+
- `tests/code-tests/`:代码测试和历史测试迁移
|
|
68
|
+
- `tests/cli-tests/`:真实 CLI 测试,doc-first
|
|
69
|
+
- `tests/mock-cli-tests/`:mock/fake CLI 测试,doc-first
|
|
70
|
+
- `docs/`:长期维护文档,由 mkdocs 构建
|
|
71
|
+
|
|
72
|
+
## 开发说明
|
|
73
|
+
|
|
74
|
+
扩展脚手架前,先阅读 `DEVELOP.md` 和 `AGENTS.md`。
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
chatgame/__init__.py,sha256=xZhai8XmAk7muH4BEmk59mIjQwyyDb6hgCvH2hVDujY,74
|
|
2
|
+
chatgame/cli.py,sha256=1rzdLjYuzTZs4rS-mDYVhg76JrIhIntDQ0VWwaSQQmE,871
|
|
3
|
+
chatgame-0.0.1.dist-info/licenses/LICENSE,sha256=G-fJLQ4pkXXISE3qeN8J5Cw5VRoNongA0hbsHA9TRe8,1065
|
|
4
|
+
chatgame-0.0.1.dist-info/METADATA,sha256=NoO3YcsBjeMxwvdQNqAFyGSezGsxUO52f-rMsK-K0-M,2131
|
|
5
|
+
chatgame-0.0.1.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
6
|
+
chatgame-0.0.1.dist-info/entry_points.txt,sha256=FC5XbkiJc0qn1sNqwPaJm1wt-vTVi2u3zlS3kYiBpUw,47
|
|
7
|
+
chatgame-0.0.1.dist-info/top_level.txt,sha256=1D0duo6ue7k7B6GcsxJaGx6WCePvhMKEWWROZWGtH9U,9
|
|
8
|
+
chatgame-0.0.1.dist-info/RECORD,,
|
|
@@ -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.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
chatgame
|