zeal-builder 0.1.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.
- zeal_builder-0.1.0/LICENSE +21 -0
- zeal_builder-0.1.0/PKG-INFO +92 -0
- zeal_builder-0.1.0/README.md +78 -0
- zeal_builder-0.1.0/pyproject.toml +33 -0
- zeal_builder-0.1.0/pyproject.toml.orig +36 -0
- zeal_builder-0.1.0/src/zeal/__init__.py +5 -0
- zeal_builder-0.1.0/src/zeal/cli.py +113 -0
- zeal_builder-0.1.0/src/zeal/line_bot.py +1004 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 stoday
|
|
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,92 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: zeal-builder
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Create and configure a LINE Messaging API echo bot from your terminal.
|
|
5
|
+
Author: stoday
|
|
6
|
+
Author-email: stoday <stoday@gmail.com>
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Requires-Dist: playwright>=1.55,<2
|
|
10
|
+
Requires-Python: >=3.11
|
|
11
|
+
Project-URL: Repository, https://github.com/stoday/ZEAL
|
|
12
|
+
Project-URL: Issues, https://github.com/stoday/ZEAL/issues
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
|
|
15
|
+
# ZEAL
|
|
16
|
+
|
|
17
|
+
[繁體中文](https://github.com/stoday/ZEAL/blob/main/README.zh-TW.md) | English
|
|
18
|
+
|
|
19
|
+
ZEAL (**Zona's Easy Adapter for Lin-bot**) helps you quickly create and
|
|
20
|
+
configure a LINE Bot.
|
|
21
|
+
|
|
22
|
+
Inspired by [Zona](https://github.com/zonawang), ZEAL aims to help anyone who
|
|
23
|
+
wants to build a LINE Bot finish the basic setup quickly, so they can spend
|
|
24
|
+
their time developing the Bot itself.
|
|
25
|
+
|
|
26
|
+
## Before you begin
|
|
27
|
+
|
|
28
|
+
- Python 3.11 or later
|
|
29
|
+
- [uv](https://docs.astral.sh/uv/)
|
|
30
|
+
- A LINE account that can sign in to LINE Business
|
|
31
|
+
- An ngrok account and authtoken
|
|
32
|
+
|
|
33
|
+
## Install
|
|
34
|
+
|
|
35
|
+
Install the published package from PyPI:
|
|
36
|
+
|
|
37
|
+
```powershell
|
|
38
|
+
uv tool install zeal-builder
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
To work from the source checkout instead:
|
|
42
|
+
|
|
43
|
+
```powershell
|
|
44
|
+
git clone https://github.com/stoday/ZEAL.git
|
|
45
|
+
cd ZEAL
|
|
46
|
+
uv sync
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Run
|
|
50
|
+
|
|
51
|
+
```powershell
|
|
52
|
+
zeal line-bot setup
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
From the source checkout, use:
|
|
56
|
+
|
|
57
|
+
```powershell
|
|
58
|
+
uv run zeal line-bot setup
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Follow the terminal prompts to enter the required account information. When
|
|
62
|
+
LINE opens a browser and asks you to sign in, enter an OTP/MFA code, or confirm
|
|
63
|
+
that you are human, complete that step yourself. ZEAL performs the remaining
|
|
64
|
+
supported setup automatically.
|
|
65
|
+
|
|
66
|
+
At the end, scan the QR code, send the Bot a message, and confirm the reply.
|
|
67
|
+
ZEAL creates `line-bot-<account-name>/`; edit `app.py` there to change the
|
|
68
|
+
Bot's reply. Keep `.env` private.
|
|
69
|
+
|
|
70
|
+
## Other commands
|
|
71
|
+
|
|
72
|
+
```powershell
|
|
73
|
+
# Keep the local Bot and ngrok running after setup
|
|
74
|
+
zeal line-bot setup --keep-running
|
|
75
|
+
|
|
76
|
+
# Set up a local Bot project for an existing LINE Messaging API channel
|
|
77
|
+
zeal line-bot resume
|
|
78
|
+
|
|
79
|
+
# View all available options
|
|
80
|
+
zeal line-bot setup --help
|
|
81
|
+
zeal line-bot resume --help
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
When working from the source checkout, prefix these commands with `uv run`.
|
|
85
|
+
|
|
86
|
+
After setup, use [LINE Official Account Manager](https://manager.line.biz/) to
|
|
87
|
+
edit account details and automatic replies. Use the
|
|
88
|
+
[LINE Developers Console](https://developers.line.biz/console/) to edit the
|
|
89
|
+
Webhook and Messaging API settings.
|
|
90
|
+
|
|
91
|
+
For a detailed manual walkthrough in Traditional Chinese, see
|
|
92
|
+
[line-bot-apply.md](https://github.com/stoday/ZEAL/blob/main/line-bot-apply.md).
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# ZEAL
|
|
2
|
+
|
|
3
|
+
[繁體中文](https://github.com/stoday/ZEAL/blob/main/README.zh-TW.md) | English
|
|
4
|
+
|
|
5
|
+
ZEAL (**Zona's Easy Adapter for Lin-bot**) helps you quickly create and
|
|
6
|
+
configure a LINE Bot.
|
|
7
|
+
|
|
8
|
+
Inspired by [Zona](https://github.com/zonawang), ZEAL aims to help anyone who
|
|
9
|
+
wants to build a LINE Bot finish the basic setup quickly, so they can spend
|
|
10
|
+
their time developing the Bot itself.
|
|
11
|
+
|
|
12
|
+
## Before you begin
|
|
13
|
+
|
|
14
|
+
- Python 3.11 or later
|
|
15
|
+
- [uv](https://docs.astral.sh/uv/)
|
|
16
|
+
- A LINE account that can sign in to LINE Business
|
|
17
|
+
- An ngrok account and authtoken
|
|
18
|
+
|
|
19
|
+
## Install
|
|
20
|
+
|
|
21
|
+
Install the published package from PyPI:
|
|
22
|
+
|
|
23
|
+
```powershell
|
|
24
|
+
uv tool install zeal-builder
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
To work from the source checkout instead:
|
|
28
|
+
|
|
29
|
+
```powershell
|
|
30
|
+
git clone https://github.com/stoday/ZEAL.git
|
|
31
|
+
cd ZEAL
|
|
32
|
+
uv sync
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Run
|
|
36
|
+
|
|
37
|
+
```powershell
|
|
38
|
+
zeal line-bot setup
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
From the source checkout, use:
|
|
42
|
+
|
|
43
|
+
```powershell
|
|
44
|
+
uv run zeal line-bot setup
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Follow the terminal prompts to enter the required account information. When
|
|
48
|
+
LINE opens a browser and asks you to sign in, enter an OTP/MFA code, or confirm
|
|
49
|
+
that you are human, complete that step yourself. ZEAL performs the remaining
|
|
50
|
+
supported setup automatically.
|
|
51
|
+
|
|
52
|
+
At the end, scan the QR code, send the Bot a message, and confirm the reply.
|
|
53
|
+
ZEAL creates `line-bot-<account-name>/`; edit `app.py` there to change the
|
|
54
|
+
Bot's reply. Keep `.env` private.
|
|
55
|
+
|
|
56
|
+
## Other commands
|
|
57
|
+
|
|
58
|
+
```powershell
|
|
59
|
+
# Keep the local Bot and ngrok running after setup
|
|
60
|
+
zeal line-bot setup --keep-running
|
|
61
|
+
|
|
62
|
+
# Set up a local Bot project for an existing LINE Messaging API channel
|
|
63
|
+
zeal line-bot resume
|
|
64
|
+
|
|
65
|
+
# View all available options
|
|
66
|
+
zeal line-bot setup --help
|
|
67
|
+
zeal line-bot resume --help
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
When working from the source checkout, prefix these commands with `uv run`.
|
|
71
|
+
|
|
72
|
+
After setup, use [LINE Official Account Manager](https://manager.line.biz/) to
|
|
73
|
+
edit account details and automatic replies. Use the
|
|
74
|
+
[LINE Developers Console](https://developers.line.biz/console/) to edit the
|
|
75
|
+
Webhook and Messaging API settings.
|
|
76
|
+
|
|
77
|
+
For a detailed manual walkthrough in Traditional Chinese, see
|
|
78
|
+
[line-bot-apply.md](https://github.com/stoday/ZEAL/blob/main/line-bot-apply.md).
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "zeal-builder"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Create and configure a LINE Messaging API echo bot from your terminal."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = "MIT"
|
|
7
|
+
license-files = ["LICENSE"]
|
|
8
|
+
requires-python = ">=3.11"
|
|
9
|
+
dependencies = ["playwright>=1.55,<2"]
|
|
10
|
+
|
|
11
|
+
[[project.authors]]
|
|
12
|
+
name = "stoday"
|
|
13
|
+
email = "stoday@gmail.com"
|
|
14
|
+
|
|
15
|
+
[project.urls]
|
|
16
|
+
Repository = "https://github.com/stoday/ZEAL"
|
|
17
|
+
Issues = "https://github.com/stoday/ZEAL/issues"
|
|
18
|
+
|
|
19
|
+
[project.scripts]
|
|
20
|
+
zeal = "zeal:main"
|
|
21
|
+
|
|
22
|
+
[build-system]
|
|
23
|
+
requires = ["uv_build>=0.12.17,<0.13.0"]
|
|
24
|
+
build-backend = "uv_build"
|
|
25
|
+
|
|
26
|
+
[tool.uv.build-backend]
|
|
27
|
+
module-name = "zeal"
|
|
28
|
+
|
|
29
|
+
[tool.pytest.ini_options]
|
|
30
|
+
testpaths = ["tests"]
|
|
31
|
+
|
|
32
|
+
[dependency-groups]
|
|
33
|
+
dev = ["pytest>=9.1.1"]
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "zeal-builder"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Create and configure a LINE Messaging API echo bot from your terminal."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = "MIT"
|
|
7
|
+
license-files = ["LICENSE"]
|
|
8
|
+
authors = [
|
|
9
|
+
{ name = "stoday", email = "stoday@gmail.com" }
|
|
10
|
+
]
|
|
11
|
+
requires-python = ">=3.11"
|
|
12
|
+
dependencies = [
|
|
13
|
+
"playwright>=1.55,<2",
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
[project.urls]
|
|
17
|
+
Repository = "https://github.com/stoday/ZEAL"
|
|
18
|
+
Issues = "https://github.com/stoday/ZEAL/issues"
|
|
19
|
+
|
|
20
|
+
[project.scripts]
|
|
21
|
+
zeal = "zeal:main"
|
|
22
|
+
|
|
23
|
+
[build-system]
|
|
24
|
+
requires = ["uv_build>=0.12.17,<0.13.0"]
|
|
25
|
+
build-backend = "uv_build"
|
|
26
|
+
|
|
27
|
+
[tool.uv.build-backend]
|
|
28
|
+
module-name = "zeal"
|
|
29
|
+
|
|
30
|
+
[dependency-groups]
|
|
31
|
+
dev = [
|
|
32
|
+
"pytest>=9.1.1",
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
[tool.pytest.ini_options]
|
|
36
|
+
testpaths = ["tests"]
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"""The public command-line interface for ZEAL."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import argparse
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
from typing import Sequence
|
|
8
|
+
|
|
9
|
+
from zeal.line_bot import run_resume, run_setup
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def build_parser() -> argparse.ArgumentParser:
|
|
13
|
+
parser = argparse.ArgumentParser(
|
|
14
|
+
prog="zeal",
|
|
15
|
+
description="Bootstrap small developer workflows safely.",
|
|
16
|
+
)
|
|
17
|
+
commands = parser.add_subparsers(dest="command", required=True)
|
|
18
|
+
|
|
19
|
+
line_bot = commands.add_parser(
|
|
20
|
+
"line-bot",
|
|
21
|
+
help="Create and configure a LINE Messaging API echo bot.",
|
|
22
|
+
)
|
|
23
|
+
line_bot_commands = line_bot.add_subparsers(dest="line_bot_command", required=True)
|
|
24
|
+
setup = line_bot_commands.add_parser(
|
|
25
|
+
"setup",
|
|
26
|
+
help="Create a local project, ngrok tunnel, and assist LINE Console setup.",
|
|
27
|
+
)
|
|
28
|
+
setup.add_argument(
|
|
29
|
+
"--output",
|
|
30
|
+
type=Path,
|
|
31
|
+
help="Directory in which to create line-bot-<account-name> (default: current directory).",
|
|
32
|
+
)
|
|
33
|
+
setup.add_argument(
|
|
34
|
+
"--port",
|
|
35
|
+
type=int,
|
|
36
|
+
default=8000,
|
|
37
|
+
help="Local port for the generated Flask app (default: 8000).",
|
|
38
|
+
)
|
|
39
|
+
setup.add_argument(
|
|
40
|
+
"--ngrok-authtoken",
|
|
41
|
+
help="ngrok authtoken. Prefer NGROK_AUTHTOKEN or the hidden prompt instead.",
|
|
42
|
+
)
|
|
43
|
+
setup.add_argument(
|
|
44
|
+
"--skip-browser-install",
|
|
45
|
+
action="store_true",
|
|
46
|
+
help="Do not download Playwright Chromium; fail if it is unavailable.",
|
|
47
|
+
)
|
|
48
|
+
setup.add_argument(
|
|
49
|
+
"--browser-profile",
|
|
50
|
+
type=Path,
|
|
51
|
+
help="保存 LINE 登入狀態的 Playwright profile 目錄(預設為使用者的 ZEAL 資料目錄)。",
|
|
52
|
+
)
|
|
53
|
+
setup.add_argument(
|
|
54
|
+
"--keep-running",
|
|
55
|
+
action="store_true",
|
|
56
|
+
help="Keep ngrok and the Flask app running after the final confirmation.",
|
|
57
|
+
)
|
|
58
|
+
setup.set_defaults(handler=run_setup)
|
|
59
|
+
|
|
60
|
+
resume = line_bot_commands.add_parser(
|
|
61
|
+
"resume",
|
|
62
|
+
help="Finish local setup for an existing LINE Messaging API channel.",
|
|
63
|
+
)
|
|
64
|
+
resume.add_argument(
|
|
65
|
+
"--name",
|
|
66
|
+
help="Existing LINE Official Account name (asked interactively when omitted).",
|
|
67
|
+
)
|
|
68
|
+
resume.add_argument(
|
|
69
|
+
"--output",
|
|
70
|
+
type=Path,
|
|
71
|
+
help="Directory in which to create line-bot-<account-name> (default: current directory).",
|
|
72
|
+
)
|
|
73
|
+
resume.add_argument(
|
|
74
|
+
"--port",
|
|
75
|
+
type=int,
|
|
76
|
+
default=8000,
|
|
77
|
+
help="Local port for the generated Flask app (default: 8000).",
|
|
78
|
+
)
|
|
79
|
+
resume.add_argument(
|
|
80
|
+
"--webhook-url",
|
|
81
|
+
help="Reuse this public HTTPS URL instead of detecting or starting ngrok.",
|
|
82
|
+
)
|
|
83
|
+
resume.add_argument(
|
|
84
|
+
"--ngrok-authtoken",
|
|
85
|
+
help="ngrok authtoken, used only when ZEAL must start ngrok.",
|
|
86
|
+
)
|
|
87
|
+
resume.add_argument(
|
|
88
|
+
"--channel-id",
|
|
89
|
+
help="LINE Developers Console 的數字 Channel ID;提供後可自動設定 Webhook。",
|
|
90
|
+
)
|
|
91
|
+
resume.add_argument(
|
|
92
|
+
"--skip-browser-install",
|
|
93
|
+
action="store_true",
|
|
94
|
+
help="不下載 Playwright Chromium;瀏覽器尚未存在時會失敗。",
|
|
95
|
+
)
|
|
96
|
+
resume.add_argument(
|
|
97
|
+
"--browser-profile",
|
|
98
|
+
type=Path,
|
|
99
|
+
help="保存 LINE 登入狀態的 Playwright profile 目錄(預設為使用者的 ZEAL 資料目錄)。",
|
|
100
|
+
)
|
|
101
|
+
resume.add_argument(
|
|
102
|
+
"--no-browser",
|
|
103
|
+
action="store_true",
|
|
104
|
+
help="不要開啟瀏覽器,僅印出 Webhook URL 供手動設定。",
|
|
105
|
+
)
|
|
106
|
+
resume.set_defaults(handler=run_resume)
|
|
107
|
+
return parser
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def main(argv: Sequence[str] | None = None) -> None:
|
|
111
|
+
parser = build_parser()
|
|
112
|
+
args = parser.parse_args(argv)
|
|
113
|
+
args.handler(args)
|