drogon-claude-plugin 0.3.0__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.
Files changed (47) hide show
  1. drogon_claude_plugin-0.3.0.dist-info/METADATA +235 -0
  2. drogon_claude_plugin-0.3.0.dist-info/RECORD +47 -0
  3. drogon_claude_plugin-0.3.0.dist-info/WHEEL +5 -0
  4. drogon_claude_plugin-0.3.0.dist-info/entry_points.txt +2 -0
  5. drogon_claude_plugin-0.3.0.dist-info/licenses/LICENSE +21 -0
  6. drogon_claude_plugin-0.3.0.dist-info/top_level.txt +1 -0
  7. drogon_plugin/__init__.py +14 -0
  8. drogon_plugin/cli.py +307 -0
  9. drogon_plugin/drogon_plugin_assets/.claude-plugin/marketplace.json +18 -0
  10. drogon_plugin/drogon_plugin_assets/.claude-plugin/plugin.json +21 -0
  11. drogon_plugin/drogon_plugin_assets/CLAUDE.md +60 -0
  12. drogon_plugin/drogon_plugin_assets/hooks/hooks.json +28 -0
  13. drogon_plugin/drogon_plugin_assets/hooks/posttooluse.py +244 -0
  14. drogon_plugin/drogon_plugin_assets/skills/drogon-create-controller/SKILL.md +38 -0
  15. drogon_plugin/drogon_plugin_assets/skills/drogon-create-controller/references/code-guide.md +107 -0
  16. drogon_plugin/drogon_plugin_assets/skills/drogon-gen-advice/SKILL.md +42 -0
  17. drogon_plugin/drogon_plugin_assets/skills/drogon-gen-advice/references/code-guide.md +95 -0
  18. drogon_plugin/drogon_plugin_assets/skills/drogon-gen-cmake/SKILL.md +39 -0
  19. drogon_plugin/drogon_plugin_assets/skills/drogon-gen-cmake/references/code-guide.md +64 -0
  20. drogon_plugin/drogon_plugin_assets/skills/drogon-gen-coroutine-handler/SKILL.md +35 -0
  21. drogon_plugin/drogon_plugin_assets/skills/drogon-gen-coroutine-handler/references/code-guide.md +126 -0
  22. drogon_plugin/drogon_plugin_assets/skills/drogon-gen-csp-view/SKILL.md +37 -0
  23. drogon_plugin/drogon_plugin_assets/skills/drogon-gen-csp-view/references/code-guide.md +158 -0
  24. drogon_plugin/drogon_plugin_assets/skills/drogon-gen-db-config/SKILL.md +39 -0
  25. drogon_plugin/drogon_plugin_assets/skills/drogon-gen-db-config/references/code-guide.md +84 -0
  26. drogon_plugin/drogon_plugin_assets/skills/drogon-gen-file-upload/SKILL.md +36 -0
  27. drogon_plugin/drogon_plugin_assets/skills/drogon-gen-file-upload/references/code-guide.md +79 -0
  28. drogon_plugin/drogon_plugin_assets/skills/drogon-gen-filter/SKILL.md +36 -0
  29. drogon_plugin/drogon_plugin_assets/skills/drogon-gen-filter/references/code-guide.md +102 -0
  30. drogon_plugin/drogon_plugin_assets/skills/drogon-gen-http-client/SKILL.md +36 -0
  31. drogon_plugin/drogon_plugin_assets/skills/drogon-gen-http-client/references/code-guide.md +85 -0
  32. drogon_plugin/drogon_plugin_assets/skills/drogon-gen-lambda-handler/SKILL.md +36 -0
  33. drogon_plugin/drogon_plugin_assets/skills/drogon-gen-lambda-handler/references/code-guide.md +78 -0
  34. drogon_plugin/drogon_plugin_assets/skills/drogon-gen-middleware/SKILL.md +36 -0
  35. drogon_plugin/drogon_plugin_assets/skills/drogon-gen-middleware/references/code-guide.md +106 -0
  36. drogon_plugin/drogon_plugin_assets/skills/drogon-gen-orm-crud/SKILL.md +39 -0
  37. drogon_plugin/drogon_plugin_assets/skills/drogon-gen-orm-crud/references/code-guide.md +109 -0
  38. drogon_plugin/drogon_plugin_assets/skills/drogon-gen-plugin/SKILL.md +40 -0
  39. drogon_plugin/drogon_plugin_assets/skills/drogon-gen-plugin/references/code-guide.md +127 -0
  40. drogon_plugin/drogon_plugin_assets/skills/drogon-gen-redis-config/SKILL.md +39 -0
  41. drogon_plugin/drogon_plugin_assets/skills/drogon-gen-redis-config/references/code-guide.md +55 -0
  42. drogon_plugin/drogon_plugin_assets/skills/drogon-gen-session-auth/SKILL.md +35 -0
  43. drogon_plugin/drogon_plugin_assets/skills/drogon-gen-session-auth/references/code-guide.md +108 -0
  44. drogon_plugin/drogon_plugin_assets/skills/drogon-gen-test/SKILL.md +37 -0
  45. drogon_plugin/drogon_plugin_assets/skills/drogon-gen-test/references/code-guide.md +125 -0
  46. drogon_plugin/drogon_plugin_assets/skills/drogon-setup-config/SKILL.md +37 -0
  47. drogon_plugin/drogon_plugin_assets/skills/drogon-setup-config/references/code-guide.md +92 -0
@@ -0,0 +1,235 @@
1
+ Metadata-Version: 2.4
2
+ Name: drogon-claude-plugin
3
+ Version: 0.3.0
4
+ Summary: Drogon C++ backend Claude Code plugin - rules & code generation skills, plus a CLI installer (install/verify/uninstall)
5
+ Author: voidvec
6
+ License: MIT License
7
+
8
+ Copyright (c) 2026 vilas
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: Homepage, https://github.com/voidvec/drogon-claude-plugin
29
+ Project-URL: Repository, https://github.com/voidvec/drogon-claude-plugin
30
+ Project-URL: Documentation, https://github.com/voidvec/drogon-claude-plugin#readme
31
+ Project-URL: Changelog, https://github.com/voidvec/drogon-claude-plugin/blob/main/CHANGELOG.md
32
+ Keywords: drogon,claude-code,claude,plugin,cpp,c++,async,web-framework,backend
33
+ Classifier: Development Status :: 4 - Beta
34
+ Classifier: Environment :: Console
35
+ Classifier: Intended Audience :: Developers
36
+ Classifier: License :: OSI Approved :: MIT License
37
+ Classifier: Operating System :: OS Independent
38
+ Classifier: Programming Language :: Python :: 3
39
+ Classifier: Programming Language :: Python :: 3.9
40
+ Classifier: Programming Language :: Python :: 3.10
41
+ Classifier: Programming Language :: Python :: 3.11
42
+ Classifier: Programming Language :: Python :: 3.12
43
+ Classifier: Programming Language :: Python :: 3.13
44
+ Classifier: Topic :: Software Development :: Code Generators
45
+ Requires-Python: >=3.9
46
+ Description-Content-Type: text/markdown; charset=UTF-8
47
+ License-File: LICENSE
48
+ Dynamic: license-file
49
+
50
+ # drogon-claude-plugin
51
+
52
+ > **Drogon C++ 后端开发的 Claude Code 插件** — 提供 AI 辅助开发规则与代码生成技能,让 AI 写出正确的异步代码,避开回调/事件循环等高频陷阱。
53
+
54
+ [![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
55
+ [![PyPI version](https://img.shields.io/pypi/v/drogon-claude-plugin.svg)](https://pypi.org/project/drogon-claude-plugin/)
56
+ [![npm version](https://img.shields.io/npm/v/drogon-claude-plugin.svg)](https://www.npmjs.com/package/drogon-claude-plugin)
57
+ [![Claude Code](https://img.shields.io/badge/Claude%20Code-plugin-8A2BE2)](https://docs.anthropic.com/en/docs/claude-code/plugins)
58
+
59
+ 基于 [Drogon](https://github.com/drogonframework/drogon) C++ HTTP 框架的应用项目提供 **AI 辅助开发规则与代码生成技能**,让 AI 写出正确的异步代码,避开回调/事件循环等高频陷阱。
60
+
61
+ ## 安装
62
+
63
+ ### 方式 A:通过 marketplace(推荐)
64
+
65
+ ```bash
66
+ # 添加 marketplace 源(首次)
67
+ claude plugin marketplace add https://github.com/voidvec/drogon-claude-plugin
68
+
69
+ # 安装插件
70
+ claude plugin install drogon
71
+
72
+ # 更新到最新版
73
+ claude plugin update drogon
74
+ ```
75
+
76
+ ### 方式 B:通过 npm / PyPI(CLI 安装器)
77
+
78
+ ```bash
79
+ # npm
80
+ npx drogon-claude-plugin install
81
+
82
+ # 或 PyPI
83
+ pipx install drogon-claude-plugin
84
+ drogon-plugin install
85
+ ```
86
+
87
+ > 两种包共用同一份插件资产,CLI 提供 `install` / `verify` / `uninstall` 子命令,详见 [CLI 安装器](#--cli-安装器)。
88
+
89
+ ### 方式 C:本地安装
90
+
91
+ ```bash
92
+ git clone https://github.com/voidvec/drogon-claude-plugin
93
+ cd <你的 drogon 项目>
94
+ claude plugin install ../drogon-claude-plugin --scope project
95
+ ```
96
+
97
+ ### 验证安装
98
+
99
+ ```bash
100
+ claude plugin details drogon
101
+ ```
102
+
103
+ 应显示 17 个技能和 2 个钩子(SessionStart + PostToolUse)。
104
+
105
+ ## CLI 安装器
106
+
107
+ `drogon-claude-plugin` 同时发布到 [npm](https://www.npmjs.com/package/drogon-claude-plugin) 与 [PyPI](https://pypi.org/project/drogon-claude-plugin/),两种包内置同一份插件资产(skills / hooks / CLAUDE.md / .claude-plugin),并提供一致的命令行界面(bin 名均为 `drogon-plugin`):
108
+
109
+ | 命令 | 作用 |
110
+ |------|------|
111
+ | `drogon-plugin install [--scope project\|user\|local]` | 将插件资产拷贝到当前项目(或指定 scope),并提示执行 `claude plugin install` 启用 |
112
+ | `drogon-plugin verify` | 校验插件的技能数 / 钩子 / manifest,输出结构报告 |
113
+ | `drogon-plugin uninstall` | 从当前项目(或由 `--target` 指定目录)移除已安装的插件资产 |
114
+ | `drogon-plugin version` | 显示 CLI 与内置插件版本 |
115
+
116
+ 安装器只负责**分发与落盘**,不替换 Claude Code 官方插件机制——启用插件仍走 `claude plugin install`。
117
+
118
+ ## 功能组件
119
+
120
+ ### 规则层(CLAUDE.md,自动注入会话上下文)
121
+
122
+ CLAUDE.md 采用**精简路由**设计:只保留跨所有任务的顶层纪律(异步回调模型、事件循环模型)+ Skill 路由表,**详细知识(模板、API 速查、配置格式、禁止模式)全部下沉到各 Skill 的 `references/code-guide.md` 按需加载**,避免常驻占用上下文。
123
+
124
+ 顶层纪律覆盖:
125
+
126
+ - **A 异步回调模型**:回调恰好一次、按值捕获、禁阻塞、优先协程、异常安全
127
+ - **B 事件循环模型(Trantor IO)**:不阻塞循环、重活走线程池、跨循环共享状态加锁
128
+ - **通用纪律**:所有 I/O 异步、异步操作双回调、异常不逃逸 handler、配置加载 try/catch、键名严格
129
+
130
+ ### 代码生成技能(17 个)
131
+
132
+ 每个技能提供准确的 drogon API 用法、代码模板与常犯错误警告。遇到对应任务时 AI 主动调用,按需加载详细知识:
133
+
134
+ | 技能 | 用途 |
135
+ |------|------|
136
+ | `drogon-create-controller` | 生成控制器(Simple/Http/WebSocket),含路径前缀差异、`:param`、自动注册 |
137
+ | `drogon-gen-cmake` | 生成 CMakeLists.txt,含 Conan、插件过滤器编译 |
138
+ | `drogon-gen-csp-view` | 生成 CSP 视图模板,含 `drogon_ctl create view` 管线、布局 |
139
+ | `drogon-gen-db-config` | 生成数据库配置,含键名黑名单、SQL 注入防护、运行期异常 |
140
+ | `drogon-gen-filter` | 生成 Filter 请求拦截器 |
141
+ | `drogon-gen-middleware` | 生成 Middleware 处理链 |
142
+ | `drogon-gen-plugin` | 生成 Plugin 系统级扩展(连接池/SDK 初始化),含三者职责边界 |
143
+ | `drogon-gen-orm-crud` | 生成 ORM CRUD 代码,含禁 `execSqlSync`、事务纪律 |
144
+ | `drogon-gen-redis-config` | 生成 Redis 配置 + 单例/异步/订阅防泄漏用法 |
145
+ | `drogon-gen-test` | 生成 DROGON_TEST 测试,含断言宏、CMake 扫描 |
146
+ | `drogon-setup-config` | 生成完整配置文件,含路径解析、键名黑名单、多环境 |
147
+ | `drogon-gen-session-auth` | 生成 Session 登录/登出/鉴权 handler(防 fixation) |
148
+ | `drogon-gen-file-upload` | 生成文件上传 handler(MultiPartParser + 校验 + 落盘) |
149
+ | `drogon-gen-advice` | 生成 AOP Advice(11 切面,拦截型/观察型) |
150
+ | `drogon-gen-coroutine-handler` | 生成协程 handler/中间件/ORM(参数按值,区分 Task/AsyncTask,含 `forwardCoro`) |
151
+ | `drogon-gen-http-client` | 生成出站 HttpClient 调用(异步/协程/反向代理) |
152
+ | `drogon-gen-lambda-handler` | 生成 `registerHandler` lambda 路由(`{N}` 参数绑定) |
153
+
154
+ ### 自动化检测钩子(PostToolUse)
155
+
156
+ 在 AI 编辑文件后自动扫描 drogon API 违规:
157
+
158
+ | 文件类型 | 检测项 |
159
+ |---------|--------|
160
+ | `.h/.cc/.cpp` | `FILTER_ADD`、`ADD_MIDDLEWARE`、`METHOD_LIST_ADD`、`createDbClient`、`AsyncTask`+`co_await` 未兜异常、回调式 `HttpMiddleware` 内 `co_await`、同步 `sendRequest` 死锁、`session->operator[]`、Advice 在 handler 内注册 |
161
+ | `.csp` | `{{ }}`、`<%raw%>`、`<%viewpath`、`@@key@@`、`<%extends`、`{% if %}` |
162
+ | `config.json/.yaml` | `"password"`、`"username"`、`"ssl": "字符串"` |
163
+ | `test*.cc` | `done()`、`ASSERT_*`、`createDbClient` |
164
+
165
+ > v0.2.0 修复:C++ 标识符检测改为大小写敏感(不再误报 `isDone()`);移除与 CLAUDE.md 示例冲突的 callback 变量名硬约束。
166
+
167
+ ## 使用
168
+
169
+ 在 drogon 项目中启用插件后,AI 自动生效。典型对话:
170
+
171
+ ```
172
+ > 创建一个 /api/users 的 REST 控制器
173
+ AI: [使用 drogon-create-controller 技能] 生成 UserController.h/.cc...
174
+
175
+ > 添加一个 JWT 认证过滤器
176
+ AI: [使用 drogon-gen-filter 技能] 生成 JwtAuthFilter.h + registerFilter()...
177
+
178
+ > 写一个测试验证用户注册接口
179
+ AI: [使用 drogon-gen-test 技能] 生成 DROGON_TEST(UserRegister)...
180
+
181
+ > 这个 handler 代码有问题吗?
182
+ AI: [对照 CLAUDE.md 异步回调纪律] 这个 handler 的提前返回路径没有调用 callback...
183
+ ```
184
+
185
+ ## 前提
186
+
187
+ - Claude Code CLI 已安装
188
+ - 插件用于 **依赖 drogon 框架的应用项目**(drogon 本身作为库被安装)
189
+ - Python 3 在 PATH 中(PostToolUse 钩子需要)
190
+
191
+ ## 仓库结构
192
+
193
+ ```
194
+ ├── .claude-plugin/
195
+ │ ├── plugin.json
196
+ │ └── marketplace.json
197
+ ├── .github/workflows/
198
+ │ ├── ci.yml # 插件结构/CLI 冒烟测试
199
+ │ └── publish.yml # tag 触发 → PyPI + npm + GitHub Release
200
+ ├── hooks/
201
+ │ ├── hooks.json
202
+ │ └── posttooluse.py
203
+ ├── src/drogon_plugin/ # PyPI 包(CLI 安装器)
204
+ │ ├── __init__.py
205
+ │ └── cli.py
206
+ ├── npm/ # npm 包(CLI 安装器)
207
+ │ ├── package.json
208
+ │ └── bin/cli.js
209
+ ├── skills/
210
+ │ ├── drogon-create-controller/
211
+ │ ├── drogon-gen-advice/
212
+ │ ├── drogon-gen-cmake/
213
+ │ ├── drogon-gen-coroutine-handler/
214
+ │ ├── drogon-gen-csp-view/
215
+ │ ├── drogon-gen-db-config/
216
+ │ ├── drogon-gen-file-upload/
217
+ │ ├── drogon-gen-filter/
218
+ │ ├── drogon-gen-http-client/
219
+ │ ├── drogon-gen-lambda-handler/
220
+ │ ├── drogon-gen-middleware/
221
+ │ ├── drogon-gen-orm-crud/
222
+ │ ├── drogon-gen-plugin/
223
+ │ ├── drogon-gen-redis-config/
224
+ │ ├── drogon-gen-session-auth/
225
+ │ ├── drogon-gen-test/
226
+ │ └── drogon-setup-config/
227
+ ├── CLAUDE.md
228
+ ├── LICENSE
229
+ ├── README.md
230
+ └── pyproject.toml # PyPI 打包配置
231
+ ```
232
+
233
+ ## 许可
234
+
235
+ MIT — 详见 [LICENSE](LICENSE)。
@@ -0,0 +1,47 @@
1
+ drogon_claude_plugin-0.3.0.dist-info/licenses/LICENSE,sha256=E2o-EZob6-Kbr0fPGfYyaAnrHo1H4nGKVz_C2PPa6X4,1062
2
+ drogon_plugin/__init__.py,sha256=2uMpIQkZPxIe5yoi5rwNWmeuA9D5nNWgOwo7HILorO4,441
3
+ drogon_plugin/cli.py,sha256=EFNg_0s4Dr6hca_rLRLwyv-59op_BbPW1p40qxa2fvs,9739
4
+ drogon_plugin/drogon_plugin_assets/CLAUDE.md,sha256=9OriEgNNTF77YXPDjQIPOwmODX2Ab7DvB2TvLblraXU,6158
5
+ drogon_plugin/drogon_plugin_assets/.claude-plugin/marketplace.json,sha256=yFH-s0CPa-OKUMy0l_ZqnNMh5bMbvZP7wDAvdw2RrIQ,510
6
+ drogon_plugin/drogon_plugin_assets/.claude-plugin/plugin.json,sha256=1OKm2w4U5UWtRhsepzm03BsFCxcPOig-e6VN2foqR-M,532
7
+ drogon_plugin/drogon_plugin_assets/hooks/hooks.json,sha256=I8Vr7tVDrneB1625W-mZZnlxV8cFzfVlE-yez2UblHU,788
8
+ drogon_plugin/drogon_plugin_assets/hooks/posttooluse.py,sha256=QXDRMl1Pa-m66eHzbCshjb580UfudRbeibpbrZg3bOU,10712
9
+ drogon_plugin/drogon_plugin_assets/skills/drogon-create-controller/SKILL.md,sha256=wuxCK9hYSpjygkqGXFmmRfmlbJwaq8XFxLemuHqEfOk,1312
10
+ drogon_plugin/drogon_plugin_assets/skills/drogon-create-controller/references/code-guide.md,sha256=X0ryMDgiUANy1LfZXqZmSi-psyjPFAriC1bbjlETVs8,5035
11
+ drogon_plugin/drogon_plugin_assets/skills/drogon-gen-advice/SKILL.md,sha256=nl-RoTr8XlPj2oqicWZHQAf788Z-y7X7XS-pSfoYe8E,1326
12
+ drogon_plugin/drogon_plugin_assets/skills/drogon-gen-advice/references/code-guide.md,sha256=twL3eNW9g81yjAPXXOzp1Q5LSpNldbCH5DC0Z3hv4nQ,3892
13
+ drogon_plugin/drogon_plugin_assets/skills/drogon-gen-cmake/SKILL.md,sha256=Swmiiwr1szakyEKDuokDTw4RZkU9oa8w2o-0qw7dqwQ,1427
14
+ drogon_plugin/drogon_plugin_assets/skills/drogon-gen-cmake/references/code-guide.md,sha256=hybW-JE5SIeP8T6uIiJKHncZCiXX9iYO9CFIK817kUE,2828
15
+ drogon_plugin/drogon_plugin_assets/skills/drogon-gen-coroutine-handler/SKILL.md,sha256=k0xxBvvc5pXZKRpZu19C2-s5a1Ym1twsY3HjD75T1aY,1343
16
+ drogon_plugin/drogon_plugin_assets/skills/drogon-gen-coroutine-handler/references/code-guide.md,sha256=FqfqSVK7x87iQVMj8qbajc247h0XZoe4peg6sYdCj5M,4640
17
+ drogon_plugin/drogon_plugin_assets/skills/drogon-gen-csp-view/SKILL.md,sha256=rprklOqjjpo7aTGD9tVMYIRVM15DF3RReVSgyKkQXBI,1206
18
+ drogon_plugin/drogon_plugin_assets/skills/drogon-gen-csp-view/references/code-guide.md,sha256=_BNLapApISwmb4DnSDHmjEKGo3fFyDqiGoYMFLLrXg0,5175
19
+ drogon_plugin/drogon_plugin_assets/skills/drogon-gen-db-config/SKILL.md,sha256=al_zNncgrxzGLat5IsAdBqEz5pzSKrsZnrv5mRwZuDg,1208
20
+ drogon_plugin/drogon_plugin_assets/skills/drogon-gen-db-config/references/code-guide.md,sha256=-kA9-nPdT7B0r6F0rkqEJ1rpPaiEoO95ZdNSoLPpuEc,2657
21
+ drogon_plugin/drogon_plugin_assets/skills/drogon-gen-file-upload/SKILL.md,sha256=jC3_i-Vcms-WlAvKJnxGnC0zu5Ylh-4w8voCYGcbCpA,1218
22
+ drogon_plugin/drogon_plugin_assets/skills/drogon-gen-file-upload/references/code-guide.md,sha256=ODZR1lEW43TsP0XvJYfzIkRUhZc2vZ8k9VQX4kQy4P4,3262
23
+ drogon_plugin/drogon_plugin_assets/skills/drogon-gen-filter/SKILL.md,sha256=iTpxnfLkhf8ockum7mcdfQo8C-safQNyUc6M5Egh8Qs,1036
24
+ drogon_plugin/drogon_plugin_assets/skills/drogon-gen-filter/references/code-guide.md,sha256=p3XOWNNSRqSumuWbXoACjFnS38QgB4CTHCnYHP9onCI,3418
25
+ drogon_plugin/drogon_plugin_assets/skills/drogon-gen-http-client/SKILL.md,sha256=mnXsslpNbkmrj5-Dyy9yS6w_MQd8O7opsfgSH9cAXJ8,1197
26
+ drogon_plugin/drogon_plugin_assets/skills/drogon-gen-http-client/references/code-guide.md,sha256=jdYPnzkOgsAudMQVUUTKIXxisFikSt3heTYF_yLv7MQ,3441
27
+ drogon_plugin/drogon_plugin_assets/skills/drogon-gen-lambda-handler/SKILL.md,sha256=Af4NRAkHByT9Yv-i-1lfqG6wy2jEJObVtbXIZFeYlhg,1378
28
+ drogon_plugin/drogon_plugin_assets/skills/drogon-gen-lambda-handler/references/code-guide.md,sha256=EX-oyiYGO76HQuCQlxl9p6e8yoNs3KGBu-g_slxHOK0,2894
29
+ drogon_plugin/drogon_plugin_assets/skills/drogon-gen-middleware/SKILL.md,sha256=iozXWR1CFaiHMyYvlm0V9oMbV9uZMzrD2pzJlEzjb3I,1118
30
+ drogon_plugin/drogon_plugin_assets/skills/drogon-gen-middleware/references/code-guide.md,sha256=WS55ZGqseq8lfXtumX4QC0ovyj7WFLsUhqnD2GVDs0g,4086
31
+ drogon_plugin/drogon_plugin_assets/skills/drogon-gen-orm-crud/SKILL.md,sha256=ZM3n1byjbrpRuAe1eUgT6iYumoZ5-Rew8VDMk_RVYos,1302
32
+ drogon_plugin/drogon_plugin_assets/skills/drogon-gen-orm-crud/references/code-guide.md,sha256=KjGYQASqFnQFK1lgwe8agFZOJPBlHEcs4MR4YZCyZCQ,4719
33
+ drogon_plugin/drogon_plugin_assets/skills/drogon-gen-plugin/SKILL.md,sha256=CUUqaKAAoh6Y2yLoGYYfdx_yVdmIosySyHplK1vB9Aw,1563
34
+ drogon_plugin/drogon_plugin_assets/skills/drogon-gen-plugin/references/code-guide.md,sha256=llXyC1X9gp0HiSTBw-dS8rnln9c8vnS6a2XuhR3ACB8,4107
35
+ drogon_plugin/drogon_plugin_assets/skills/drogon-gen-redis-config/SKILL.md,sha256=TNiIosp3ZVFcTRfGOqyNO31w6POEJoOqRzUQfa9HyAk,1152
36
+ drogon_plugin/drogon_plugin_assets/skills/drogon-gen-redis-config/references/code-guide.md,sha256=hV8CqB0EdHxPAN3OxK4n_HWjWcLJwDcGJ53yyQAveJY,2383
37
+ drogon_plugin/drogon_plugin_assets/skills/drogon-gen-session-auth/SKILL.md,sha256=kYZWl3GdAQZU7DysZfL3zxOmOMvQ2yvgMgoxfXiu2Xs,1123
38
+ drogon_plugin/drogon_plugin_assets/skills/drogon-gen-session-auth/references/code-guide.md,sha256=D29beh-ezXbVb5ViwQOm--shdnL_7PSPXZz5nLX0r6A,3659
39
+ drogon_plugin/drogon_plugin_assets/skills/drogon-gen-test/SKILL.md,sha256=hzsHWRe_hf5ecNoR0GJ-ffda5uUHhDqeuX5Pr06PM-g,1069
40
+ drogon_plugin/drogon_plugin_assets/skills/drogon-gen-test/references/code-guide.md,sha256=xQKT_J7GK6v4rgS1fie6olzHtmIlYWnvl1sqGHtJ9HI,4307
41
+ drogon_plugin/drogon_plugin_assets/skills/drogon-setup-config/SKILL.md,sha256=jDGle2Iz0xuJNMpK8_y93hhxm5ltVkUcTW7M0guwsHA,1343
42
+ drogon_plugin/drogon_plugin_assets/skills/drogon-setup-config/references/code-guide.md,sha256=aM3wnP2Nz1BoQTRdpo3dI0EgJxOwuY3SB-fyT94jpeo,3367
43
+ drogon_claude_plugin-0.3.0.dist-info/METADATA,sha256=P3HS_Mb9Fq-R2lf0uudOjR_mpHGz3jtKBislCS1au1I,10907
44
+ drogon_claude_plugin-0.3.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
45
+ drogon_claude_plugin-0.3.0.dist-info/entry_points.txt,sha256=MhGQaOkZZM0AOfbAy1N34bvJlQiUP1mBGlkIh0BnKXg,57
46
+ drogon_claude_plugin-0.3.0.dist-info/top_level.txt,sha256=QkQoQI6GWLObEOjIBcfWqubEa0ts7LSFfZCkYwtc12Y,14
47
+ drogon_claude_plugin-0.3.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ drogon-plugin = drogon_plugin.cli:main
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 vilas
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
+ drogon_plugin
@@ -0,0 +1,14 @@
1
+ """drogon-claude-plugin — PyPI 发行包(CLI 安装器).
2
+
3
+ 本包将 drogon Claude Code 插件的完整资产(skills / hooks / CLAUDE.md /
4
+ .claude-plugin)一并打包进 wheel,通过 `drogon-plugin` 命令安装到目标项目。
5
+
6
+ 插件本体仓库: https://github.com/voidvec/drogon-claude-plugin
7
+ """
8
+
9
+ __version__ = "0.3.0"
10
+
11
+ # 打包进 wheel 的插件资产
12
+ PLUGIN_VERSION = "0.3.0"
13
+
14
+ __all__ = ["__version__", "PLUGIN_VERSION"]
drogon_plugin/cli.py ADDED
@@ -0,0 +1,307 @@
1
+ #!/usr/bin/env python3
2
+ """drogon-plugin — CLI 安装器(PyPI 发行版).
3
+
4
+ 把随包内置的 drogon Claude Code 插件资产安装到目标项目并提示启用,
5
+ 或对已安装目录做结构校验 / 卸载。
6
+
7
+ 子命令:
8
+ install [--target DIR] [--scope project|user|local]
9
+ verify [--target DIR]
10
+ uninstall [--target DIR]
11
+ version
12
+ """
13
+
14
+ import argparse
15
+ import json
16
+ import shutil
17
+ import sys
18
+ from pathlib import Path
19
+
20
+ # 资产在 wheel 内统一放在 ``drogon_plugin_assets/`` 下(见 pyproject.toml data-files)
21
+ _ASSETS_PREFIX = "drogon_plugin_assets"
22
+ _PLUGIN_ASSET_DIRS = ("skills", "hooks", ".claude-plugin")
23
+ _PLUGIN_FILES = ("CLAUDE.md",)
24
+ _EXPECTED_SKILLS = 17
25
+ _EXPECTED_HOOKS = 2
26
+
27
+ # scope 目录名映射(Claude Code 约定)
28
+ _SCOPE_DIRS = {
29
+ "user": Path.home() / ".claude" / "plugins",
30
+ "local": Path.home() / ".claude" / "plugins",
31
+ "project": None, # 项目根(默认)
32
+ }
33
+
34
+ _PKG_VERSION: str | None = None
35
+
36
+
37
+ def _version() -> str:
38
+ """返回已安装发行包的版本;源码树运行时返回 unknown。"""
39
+ global _PKG_VERSION
40
+ if _PKG_VERSION is None:
41
+ try:
42
+ from importlib.metadata import version
43
+
44
+ _PKG_VERSION = version("drogon-claude-plugin")
45
+ except Exception:
46
+ _PKG_VERSION = "dev"
47
+ return _PKG_VERSION
48
+
49
+
50
+ def _find_assets() -> Path:
51
+ """定位随包携带的插件资产根目录。"""
52
+ here = Path(__file__).resolve().parent
53
+ dev_candidate = here / _ASSETS_PREFIX # src/drogon_plugin/drogon_plugin_assets/
54
+ if dev_candidate.is_dir():
55
+ return dev_candidate
56
+ # wheel 布局: site-packages/drogon_plugin/drogon_plugin_assets/
57
+ return here / _ASSETS_PREFIX
58
+
59
+
60
+ # ---------------------------------------------------------------------------
61
+ # 资产复制 / 管理
62
+ # ---------------------------------------------------------------------------
63
+
64
+
65
+ def _list_assets(root: Path):
66
+ return (p for p in root.rglob("*") if p.is_file())
67
+
68
+
69
+ def _copy_assets(src_root: Path, target_root: Path) -> int:
70
+ """把 src_root 下所有资产复制到 target_root,返回文件数。"""
71
+ count = 0
72
+ for f in _list_assets(src_root):
73
+ rel = f.relative_to(src_root)
74
+ dest = target_root / rel
75
+ dest.parent.mkdir(parents=True, exist_ok=True)
76
+ shutil.copy2(f, dest)
77
+ count += 1
78
+ return count
79
+
80
+
81
+ def _load_manifest(target_root: Path) -> dict:
82
+ p = target_root / ".claude-plugin" / "plugin.json"
83
+ if not p.is_file():
84
+ raise FileNotFoundError(f"缺少插件清单: {p}")
85
+ return json.loads(p.read_text(encoding="utf-8"))
86
+
87
+
88
+ def _plugin_version(target_root: Path) -> str:
89
+ return str(_load_manifest(target_root).get("version", "?"))
90
+
91
+
92
+ def _resolve_target(args) -> Path:
93
+ """子命令用: --target > --scope > 当前目录。"""
94
+ if args.target:
95
+ return Path(args.target).expanduser().resolve()
96
+ if getattr(args, "scope", None):
97
+ if args.scope == "project":
98
+ return Path.cwd().resolve()
99
+ d = _SCOPE_DIRS.get(args.scope)
100
+ if d:
101
+ return d.resolve()
102
+ return Path.cwd().resolve()
103
+
104
+
105
+ # ---------------------------------------------------------------------------
106
+ # 子命令
107
+ # ---------------------------------------------------------------------------
108
+
109
+
110
+ def cmd_install(args) -> int:
111
+ from . import PLUGIN_VERSION
112
+
113
+ target = _resolve_target(args)
114
+ try:
115
+ src_root = _find_assets()
116
+ if not src_root.is_dir():
117
+ raise FileNotFoundError(
118
+ f"未找到插件资产目录({src_root})。请确认包安装完整。"
119
+ )
120
+ count = _copy_assets(src_root, target)
121
+ except FileNotFoundError as e:
122
+ print(f"❌ {e}", file=sys.stderr)
123
+ return 1
124
+
125
+ stamp = target / ".drogon-plugin-installed.json"
126
+ try:
127
+ manifest_version = _plugin_version(target)
128
+ except FileNotFoundError:
129
+ manifest_version = PLUGIN_VERSION
130
+ stamp.write_text(
131
+ json.dumps(
132
+ {
133
+ "source": "pypi:drogon-claude-plugin",
134
+ "cli_version": _version(),
135
+ "plugin_version": manifest_version,
136
+ "files": count,
137
+ },
138
+ indent=2,
139
+ ),
140
+ encoding="utf-8",
141
+ )
142
+
143
+ print(f"✅ 已安装 drogon 插件资产到 {target}")
144
+ print(f" 复制 {count} 个文件 · 插件版本 {manifest_version}")
145
+ print(" 下一步:")
146
+ print(" 1) cd <你的 drogon 项目>")
147
+ print(" 2) claude plugin install ../drogon-claude-plugin --scope project")
148
+ print(" (或如果已通过 marketplace 添加: claude plugin install drogon)")
149
+ return 0
150
+
151
+
152
+ def cmd_verify(args) -> int:
153
+ target = _resolve_target(args)
154
+ try:
155
+ manifest = _load_manifest(target)
156
+ except FileNotFoundError as e:
157
+ print(f"❌ {e}", file=sys.stderr)
158
+ return 1
159
+
160
+ manifest_ver = str(manifest.get("version", "?"))
161
+ problems: list[str] = []
162
+ skill_names: list[str] = []
163
+
164
+ # 技能
165
+ skills_dir = target / "skills"
166
+ if not skills_dir.is_dir():
167
+ problems.append("缺少 skills/ 目录")
168
+ else:
169
+ skill_names = sorted(
170
+ d.name for d in skills_dir.iterdir() if d.is_dir()
171
+ )
172
+ if len(skill_names) != _EXPECTED_SKILLS:
173
+ problems.append(f"技能数 {len(skill_names)} != 预期 {_EXPECTED_SKILLS}")
174
+ for n in skill_names:
175
+ if not (skills_dir / n / "SKILL.md").is_file():
176
+ problems.append(f"技能 {n} 缺少 SKILL.md")
177
+
178
+ # hooks
179
+ hooks_dir = target / "hooks"
180
+ if not hooks_dir.is_dir():
181
+ problems.append("缺少 hooks/ 目录")
182
+ else:
183
+ hooks_json = hooks_dir / "hooks.json"
184
+ if not hooks_json.is_file():
185
+ problems.append("缺少 hooks/hooks.json")
186
+ else:
187
+ try:
188
+ data = json.loads(hooks_json.read_text(encoding="utf-8"))
189
+ n = len(data.get("hooks", {}))
190
+ if n != _EXPECTED_HOOKS:
191
+ problems.append(f"hooks 数 {n} != 预期 {_EXPECTED_HOOKS}")
192
+ except json.JSONDecodeError:
193
+ problems.append("hooks/hooks.json 不是合法 JSON")
194
+
195
+ if not (hooks_dir / "posttooluse.py").is_file():
196
+ problems.append("缺少 hooks/posttooluse.py")
197
+
198
+ # CLAUDE.md
199
+ if not (target / "CLAUDE.md").is_file():
200
+ problems.append("缺少 CLAUDE.md")
201
+
202
+ # 版本一致性
203
+ try:
204
+ from . import PLUGIN_VERSION
205
+
206
+ if manifest_ver := manifest.get("version"):
207
+ if str(manifest_ver) != PLUGIN_VERSION:
208
+ problems.append(
209
+ f"manifest 版本 {manifest_ver} 与包版本 {PLUGIN_VERSION} 不一致"
210
+ )
211
+ except ImportError:
212
+ pass
213
+
214
+ print(f"📦 drogon-claude-plugin 结构校验 — {target}")
215
+ print(f" 插件版本 : {manifest_ver}")
216
+ print(f" 技能数 : {len(skill_names)}")
217
+ print(f" hooks : {_EXPECTED_HOOKS} (SessionStart + PostToolUse)")
218
+ if problems:
219
+ print(" ❌ 发现问题:")
220
+ for p in problems:
221
+ print(f" - {p}")
222
+ return 1
223
+ print(" ✅ 通过")
224
+ return 0
225
+
226
+
227
+ def cmd_uninstall(args) -> int:
228
+ target = _resolve_target(args)
229
+ removed: list[str] = []
230
+ for name in (*_PLUGIN_ASSET_DIRS, *_PLUGIN_FILES):
231
+ p = target / name
232
+ if p.is_dir() and not p.is_symlink():
233
+ shutil.rmtree(p)
234
+ removed.append(name)
235
+ elif p.is_file():
236
+ p.unlink()
237
+ removed.append(name)
238
+ stamp = target / ".drogon-plugin-installed.json"
239
+ if stamp.is_file():
240
+ stamp.unlink()
241
+ removed.append(".drogon-plugin-installed.json")
242
+
243
+ if removed:
244
+ print(f"🗑 已从 {target} 移除: {', '.join(removed)}")
245
+ else:
246
+ print(f"ℹ️ 未在 {target} 发现插件资产")
247
+ return 0
248
+
249
+
250
+ def cmd_version(args) -> int:
251
+ try:
252
+ from . import PLUGIN_VERSION
253
+ except ImportError:
254
+ PLUGIN_VERSION = "?"
255
+ print(f"drogon-claude-plugin (pypi) v{_version()} | 内置插件 v{PLUGIN_VERSION}")
256
+ return 0
257
+
258
+
259
+ # ---------------------------------------------------------------------------
260
+ # 入口
261
+ # ---------------------------------------------------------------------------
262
+
263
+
264
+ def _build_parser() -> argparse.ArgumentParser:
265
+ parser = argparse.ArgumentParser(
266
+ prog="drogon-plugin",
267
+ description="安装 / 校验 / 卸载 drogon Claude Code 插件资产(PyPI 发行版)。",
268
+ )
269
+ sub = parser.add_subparsers(dest="command", required=True)
270
+
271
+ p_install = sub.add_parser("install", help="安装插件资产到目标项目")
272
+ p_install.add_argument("--target")
273
+ p_install.add_argument("--scope", choices=["project", "user", "local"])
274
+ p_install.set_defaults(func=cmd_install)
275
+
276
+ p_verify = sub.add_parser("verify", help="校验已安装插件结构")
277
+ p_verify.add_argument("--target")
278
+ p_verify.set_defaults(func=cmd_verify)
279
+
280
+ p_uninstall = sub.add_parser("uninstall", help="移除已安装插件资产")
281
+ p_uninstall.add_argument("--target")
282
+ p_uninstall.set_defaults(func=cmd_uninstall)
283
+
284
+ sub.add_parser("version", help="显示版本").set_defaults(func=cmd_version)
285
+ return parser
286
+
287
+
288
+ def main(argv: list[str] | None = None) -> int:
289
+ parser = _build_parser()
290
+ args = parser.parse_args(argv)
291
+
292
+ if not hasattr(args, "func"):
293
+ parser.print_help()
294
+ return 0
295
+
296
+ # 只有需要目标路径的子命令才设置 target
297
+ if getattr(args, "func", None) in (cmd_install, cmd_verify, cmd_uninstall):
298
+ args.target = _resolve_target(args)
299
+
300
+ try:
301
+ return args.func(args)
302
+ except KeyboardInterrupt:
303
+ return 130
304
+
305
+
306
+ if __name__ == "__main__":
307
+ sys.exit(main())
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "drogon-claude-plugin",
3
+ "description": "Drogon C++ framework Claude Code plugin — rules and skills for correct async code generation",
4
+ "owner": {
5
+ "name": "voidvec"
6
+ },
7
+ "plugins": [
8
+ {
9
+ "name": "drogon",
10
+ "source": ".",
11
+ "description": "Drogon C++ 后端开发规则与技能: 基于 Drogon 框架编写正确的异步代码, 避开回调/事件循环等高频陷阱。",
12
+ "author": {
13
+ "name": "voidvec"
14
+ },
15
+ "category": "development"
16
+ }
17
+ ]
18
+ }