hakucc 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.
- hakucc-0.1.0/.github/workflows/ci.yml +39 -0
- hakucc-0.1.0/.github/workflows/notify.yml +51 -0
- hakucc-0.1.0/.github/workflows/release.yml +83 -0
- hakucc-0.1.0/.gitignore +16 -0
- hakucc-0.1.0/LICENSE +21 -0
- hakucc-0.1.0/PKG-INFO +105 -0
- hakucc-0.1.0/README.md +80 -0
- hakucc-0.1.0/pixi.lock +1199 -0
- hakucc-0.1.0/pixi.toml +28 -0
- hakucc-0.1.0/pyproject.toml +42 -0
- hakucc-0.1.0/src/hakucc/__init__.py +3 -0
- hakucc-0.1.0/src/hakucc/__main__.py +266 -0
- hakucc-0.1.0/src/hakucc/bridge.py +809 -0
- hakucc-0.1.0/src/hakucc/commands/__init__.py +3 -0
- hakucc-0.1.0/src/hakucc/commands/builtin.py +256 -0
- hakucc-0.1.0/src/hakucc/commands/registry.py +90 -0
- hakucc-0.1.0/src/hakucc/config.py +510 -0
- hakucc-0.1.0/src/hakucc/feishu/__init__.py +0 -0
- hakucc-0.1.0/src/hakucc/feishu/cardkit.py +367 -0
- hakucc-0.1.0/src/hakucc/feishu/client.py +267 -0
- hakucc-0.1.0/src/hakucc/feishu/document.py +309 -0
- hakucc-0.1.0/src/hakucc/feishu/file.py +127 -0
- hakucc-0.1.0/src/hakucc/feishu/image.py +122 -0
- hakucc-0.1.0/src/hakucc/feishu/message.py +281 -0
- hakucc-0.1.0/src/hakucc/feishu/reaction.py +54 -0
- hakucc-0.1.0/src/hakucc/feishu/ws.py +414 -0
- hakucc-0.1.0/src/hakucc/format/__init__.py +0 -0
- hakucc-0.1.0/src/hakucc/format/card.py +96 -0
- hakucc-0.1.0/src/hakucc/format/document.py +351 -0
- hakucc-0.1.0/src/hakucc/format/image_resolver.py +58 -0
- hakucc-0.1.0/src/hakucc/format/markdown.py +97 -0
- hakucc-0.1.0/src/hakucc/format/thinking.py +76 -0
- hakucc-0.1.0/src/hakucc/lock.py +168 -0
- hakucc-0.1.0/src/hakucc/logger.py +54 -0
- hakucc-0.1.0/src/hakucc/session.py +98 -0
- hakucc-0.1.0/src/hakucc/setup.py +168 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
lint:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- name: Checkout
|
|
14
|
+
uses: actions/checkout@v4
|
|
15
|
+
|
|
16
|
+
- name: Setup pixi
|
|
17
|
+
uses: prefix-dev/setup-pixi@v0.8.3
|
|
18
|
+
with:
|
|
19
|
+
cache: true
|
|
20
|
+
|
|
21
|
+
- name: Lint with ruff
|
|
22
|
+
run: pixi run ruff check src/
|
|
23
|
+
|
|
24
|
+
build:
|
|
25
|
+
runs-on: ubuntu-latest
|
|
26
|
+
steps:
|
|
27
|
+
- name: Checkout
|
|
28
|
+
uses: actions/checkout@v4
|
|
29
|
+
|
|
30
|
+
- name: Setup pixi
|
|
31
|
+
uses: prefix-dev/setup-pixi@v0.8.3
|
|
32
|
+
with:
|
|
33
|
+
cache: true
|
|
34
|
+
|
|
35
|
+
- name: Build package
|
|
36
|
+
run: pixi run python -m build --no-isolation
|
|
37
|
+
|
|
38
|
+
- name: Check package
|
|
39
|
+
run: pixi run twine check dist/*
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
name: Feishu Notify
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
issues:
|
|
5
|
+
types: [opened]
|
|
6
|
+
pull_request:
|
|
7
|
+
types: [opened]
|
|
8
|
+
issue_comment:
|
|
9
|
+
types: [created]
|
|
10
|
+
|
|
11
|
+
permissions:
|
|
12
|
+
issues: read
|
|
13
|
+
pull-requests: read
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
notify:
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
steps:
|
|
19
|
+
- name: Notify Feishu
|
|
20
|
+
run: |
|
|
21
|
+
EVENT="${{ github.event_name }}"
|
|
22
|
+
ACTOR="${{ github.actor }}"
|
|
23
|
+
REPO="${{ github.repository }}"
|
|
24
|
+
|
|
25
|
+
if [ "$EVENT" = "issues" ]; then
|
|
26
|
+
TITLE="${{ github.event.issue.title }}"
|
|
27
|
+
URL="${{ github.event.issue.html_url }}"
|
|
28
|
+
MSG="**${ACTOR}** opened issue: [${TITLE}](${URL})"
|
|
29
|
+
elif [ "$EVENT" = "pull_request" ]; then
|
|
30
|
+
TITLE="${{ github.event.pull_request.title }}"
|
|
31
|
+
URL="${{ github.event.pull_request.html_url }}"
|
|
32
|
+
MSG="**${ACTOR}** opened PR: [${TITLE}](${URL})"
|
|
33
|
+
elif [ "$EVENT" = "issue_comment" ]; then
|
|
34
|
+
URL="${{ github.event.comment.html_url }}"
|
|
35
|
+
MSG="**${ACTOR}** commented on [${REPO}](${URL})"
|
|
36
|
+
fi
|
|
37
|
+
|
|
38
|
+
curl -X POST "${{ secrets.FEISHU_WEBHOOK }}" \
|
|
39
|
+
-H "Content-Type: application/json" \
|
|
40
|
+
-d "{
|
|
41
|
+
\"msg_type\": \"interactive\",
|
|
42
|
+
\"card\": {
|
|
43
|
+
\"header\": {
|
|
44
|
+
\"title\": { \"tag\": \"plain_text\", \"content\": \"π hakucc δ»εΊε¨ζ\" },
|
|
45
|
+
\"template\": \"blue\"
|
|
46
|
+
},
|
|
47
|
+
\"elements\": [
|
|
48
|
+
{ \"tag\": \"div\", \"text\": { \"tag\": \"lark_md\", \"content\": \"${MSG}\" } }
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
}"
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
publish:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
outputs:
|
|
14
|
+
version: ${{ steps.version.outputs.version }}
|
|
15
|
+
status: ${{ steps.publish.outcome }}
|
|
16
|
+
|
|
17
|
+
steps:
|
|
18
|
+
- name: Checkout
|
|
19
|
+
uses: actions/checkout@v4
|
|
20
|
+
|
|
21
|
+
- name: Get version
|
|
22
|
+
id: version
|
|
23
|
+
run: echo "version=$(python -c 'import tomllib; print(tomllib.load(open(\"pyproject.toml\",\"rb\"))[\"project\"][\"version\"])')" >> $GITHUB_OUTPUT
|
|
24
|
+
|
|
25
|
+
- name: Setup pixi
|
|
26
|
+
uses: prefix-dev/setup-pixi@v0.8.3
|
|
27
|
+
with:
|
|
28
|
+
cache: true
|
|
29
|
+
|
|
30
|
+
- name: Build package
|
|
31
|
+
run: pixi run python -m build --no-isolation
|
|
32
|
+
|
|
33
|
+
- name: Publish to PyPI
|
|
34
|
+
id: publish
|
|
35
|
+
run: pixi run twine upload dist/*
|
|
36
|
+
env:
|
|
37
|
+
TWINE_USERNAME: __token__
|
|
38
|
+
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
|
|
39
|
+
|
|
40
|
+
notify:
|
|
41
|
+
runs-on: ubuntu-latest
|
|
42
|
+
needs: publish
|
|
43
|
+
if: always()
|
|
44
|
+
|
|
45
|
+
steps:
|
|
46
|
+
- name: Notify Feishu on success
|
|
47
|
+
if: needs.publish.outputs.status == 'success'
|
|
48
|
+
run: |
|
|
49
|
+
curl -X POST "${{ secrets.FEISHU_WEBHOOK }}" \
|
|
50
|
+
-H "Content-Type: application/json" \
|
|
51
|
+
-d '{
|
|
52
|
+
"msg_type": "interactive",
|
|
53
|
+
"card": {
|
|
54
|
+
"header": {
|
|
55
|
+
"title": { "tag": "plain_text", "content": "β
hakucc εεΈζε" },
|
|
56
|
+
"template": "green"
|
|
57
|
+
},
|
|
58
|
+
"elements": [
|
|
59
|
+
{ "tag": "div", "text": { "tag": "lark_md", "content": "**ηζ¬:** ${{ needs.publish.outputs.version }}" } },
|
|
60
|
+
{ "tag": "div", "text": { "tag": "lark_md", "content": "**PyPI:** https://pypi.org/project/hakucc/" } },
|
|
61
|
+
{ "tag": "div", "text": { "tag": "lark_md", "content": "**GitHub:** https://github.com/suj1e/hakucc/releases/tag/v${{ needs.publish.outputs.version }}" } }
|
|
62
|
+
]
|
|
63
|
+
}
|
|
64
|
+
}'
|
|
65
|
+
|
|
66
|
+
- name: Notify Feishu on failure
|
|
67
|
+
if: needs.publish.outputs.status == 'failure'
|
|
68
|
+
run: |
|
|
69
|
+
curl -X POST "${{ secrets.FEISHU_WEBHOOK }}" \
|
|
70
|
+
-H "Content-Type: application/json" \
|
|
71
|
+
-d '{
|
|
72
|
+
"msg_type": "interactive",
|
|
73
|
+
"card": {
|
|
74
|
+
"header": {
|
|
75
|
+
"title": { "tag": "plain_text", "content": "β hakucc εεΈε€±θ΄₯" },
|
|
76
|
+
"template": "red"
|
|
77
|
+
},
|
|
78
|
+
"elements": [
|
|
79
|
+
{ "tag": "div", "text": { "tag": "lark_md", "content": "**ηζ¬:** ${{ needs.publish.outputs.version }}" } },
|
|
80
|
+
{ "tag": "div", "text": { "tag": "lark_md", "content": "**ζ₯εΏ:** https://github.com/suj1e/hakucc/actions/runs/${{ github.run_id }}" } }
|
|
81
|
+
]
|
|
82
|
+
}
|
|
83
|
+
}'
|
hakucc-0.1.0/.gitignore
ADDED
hakucc-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 suj1e
|
|
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.
|
hakucc-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: hakucc
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Claude Code β Feishu bridge via claude-agent-sdk
|
|
5
|
+
Project-URL: Repository, https://github.com/suj1e/hakucc
|
|
6
|
+
Author: suj1e
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Keywords: chatbot,claude,claude-code,feishu,lark
|
|
10
|
+
Requires-Python: >=3.10
|
|
11
|
+
Requires-Dist: claude-agent-sdk>=0.1.76
|
|
12
|
+
Requires-Dist: click>=8.0
|
|
13
|
+
Requires-Dist: httpx>=0.27
|
|
14
|
+
Requires-Dist: lark-oapi>=1.5.5
|
|
15
|
+
Requires-Dist: protobuf>=5.0
|
|
16
|
+
Requires-Dist: rich>=13.0
|
|
17
|
+
Requires-Dist: tomli-w>=1.0
|
|
18
|
+
Requires-Dist: tomli>=2.0; python_version < '3.11'
|
|
19
|
+
Requires-Dist: websockets>=13.0
|
|
20
|
+
Provides-Extra: dev
|
|
21
|
+
Requires-Dist: ruff>=0.8; extra == 'dev'
|
|
22
|
+
Provides-Extra: image
|
|
23
|
+
Requires-Dist: pillow>=10.0; extra == 'image'
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
|
|
26
|
+
# hakucc
|
|
27
|
+
|
|
28
|
+
Claude Code on Feishu/Lark β Python implementation using [claude-agent-sdk](https://github.com/anthropics/claude-agent-sdk-python).
|
|
29
|
+
|
|
30
|
+
## Install
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
pip install hakucc
|
|
34
|
+
# or with image processing support
|
|
35
|
+
pip install hakucc[image]
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Quick Start
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
# Configure Feishu app credentials
|
|
42
|
+
hakucc setup
|
|
43
|
+
|
|
44
|
+
# Start the bot
|
|
45
|
+
hakucc
|
|
46
|
+
|
|
47
|
+
# Background mode
|
|
48
|
+
hakucc -d
|
|
49
|
+
|
|
50
|
+
# Resume last session
|
|
51
|
+
hakucc -c
|
|
52
|
+
|
|
53
|
+
# Use a specific profile
|
|
54
|
+
hakucc -p work
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Commands
|
|
58
|
+
|
|
59
|
+
| Command | Description |
|
|
60
|
+
|---------|-------------|
|
|
61
|
+
| `hakucc setup` | Interactive configuration wizard |
|
|
62
|
+
| `hakucc new-profile <name>` | Create a new profile |
|
|
63
|
+
| `hakucc list-profiles` | List all profiles |
|
|
64
|
+
| `hakucc ps` | List running processes |
|
|
65
|
+
| `hakucc kill <target>` | Kill a process |
|
|
66
|
+
| `hakucc kill-all` | Kill all processes |
|
|
67
|
+
| `hakucc reset-session` | Clear session state |
|
|
68
|
+
| `hakucc sessions` | Show session info |
|
|
69
|
+
| `hakucc cleanup-tmp-files` | Clean temp files |
|
|
70
|
+
|
|
71
|
+
## Configuration
|
|
72
|
+
|
|
73
|
+
Global config: `~/.hakucc/config.toml`
|
|
74
|
+
|
|
75
|
+
```toml
|
|
76
|
+
[feishu]
|
|
77
|
+
app_id = "cli_a_xxxx"
|
|
78
|
+
app_secret = "xxxx"
|
|
79
|
+
|
|
80
|
+
[agent]
|
|
81
|
+
# permission_mode = "acceptEdits"
|
|
82
|
+
# model = "claude-sonnet-4-5"
|
|
83
|
+
|
|
84
|
+
[streaming]
|
|
85
|
+
# mode = "cardkit" # cardkit | update | none
|
|
86
|
+
|
|
87
|
+
[overflow]
|
|
88
|
+
# mode = "document" # document | chunk
|
|
89
|
+
# threshold = 8000
|
|
90
|
+
|
|
91
|
+
# [profiles.work]
|
|
92
|
+
# feishu.app_id = "cli_a_yyyy"
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Development
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
pixi install
|
|
99
|
+
pixi run setup
|
|
100
|
+
pixi run start
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## License
|
|
104
|
+
|
|
105
|
+
MIT
|
hakucc-0.1.0/README.md
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# hakucc
|
|
2
|
+
|
|
3
|
+
Claude Code on Feishu/Lark β Python implementation using [claude-agent-sdk](https://github.com/anthropics/claude-agent-sdk-python).
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install hakucc
|
|
9
|
+
# or with image processing support
|
|
10
|
+
pip install hakucc[image]
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
# Configure Feishu app credentials
|
|
17
|
+
hakucc setup
|
|
18
|
+
|
|
19
|
+
# Start the bot
|
|
20
|
+
hakucc
|
|
21
|
+
|
|
22
|
+
# Background mode
|
|
23
|
+
hakucc -d
|
|
24
|
+
|
|
25
|
+
# Resume last session
|
|
26
|
+
hakucc -c
|
|
27
|
+
|
|
28
|
+
# Use a specific profile
|
|
29
|
+
hakucc -p work
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Commands
|
|
33
|
+
|
|
34
|
+
| Command | Description |
|
|
35
|
+
|---------|-------------|
|
|
36
|
+
| `hakucc setup` | Interactive configuration wizard |
|
|
37
|
+
| `hakucc new-profile <name>` | Create a new profile |
|
|
38
|
+
| `hakucc list-profiles` | List all profiles |
|
|
39
|
+
| `hakucc ps` | List running processes |
|
|
40
|
+
| `hakucc kill <target>` | Kill a process |
|
|
41
|
+
| `hakucc kill-all` | Kill all processes |
|
|
42
|
+
| `hakucc reset-session` | Clear session state |
|
|
43
|
+
| `hakucc sessions` | Show session info |
|
|
44
|
+
| `hakucc cleanup-tmp-files` | Clean temp files |
|
|
45
|
+
|
|
46
|
+
## Configuration
|
|
47
|
+
|
|
48
|
+
Global config: `~/.hakucc/config.toml`
|
|
49
|
+
|
|
50
|
+
```toml
|
|
51
|
+
[feishu]
|
|
52
|
+
app_id = "cli_a_xxxx"
|
|
53
|
+
app_secret = "xxxx"
|
|
54
|
+
|
|
55
|
+
[agent]
|
|
56
|
+
# permission_mode = "acceptEdits"
|
|
57
|
+
# model = "claude-sonnet-4-5"
|
|
58
|
+
|
|
59
|
+
[streaming]
|
|
60
|
+
# mode = "cardkit" # cardkit | update | none
|
|
61
|
+
|
|
62
|
+
[overflow]
|
|
63
|
+
# mode = "document" # document | chunk
|
|
64
|
+
# threshold = 8000
|
|
65
|
+
|
|
66
|
+
# [profiles.work]
|
|
67
|
+
# feishu.app_id = "cli_a_yyyy"
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Development
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
pixi install
|
|
74
|
+
pixi run setup
|
|
75
|
+
pixi run start
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## License
|
|
79
|
+
|
|
80
|
+
MIT
|