create-dwy 0.26.0 → 0.28.0
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.
- package/CHANGELOG.md +20 -0
- package/package.json +1 -1
- package/src/cli-help.js +11 -13
- package/src/sync-all.js +86 -11
- package/src/sync-plan.js +9 -1
- package/templates/ai-tools/CHANGELOG.md +13 -0
- package/templates/ai-tools/VERSION +1 -1
- package/templates/ai-tools/skills/Android/dwy-android-architecture/SKILL.md +10 -0
- package/templates/ai-tools/skills/Android/dwy-android-development/SKILL.md +16 -0
- package/templates/ai-tools/skills/Apple/dwy-apple-appkit/SKILL.md +17 -0
- package/templates/ai-tools/skills/Apple/dwy-apple-architecture/SKILL.md +12 -0
- package/templates/ai-tools/skills/Apple/dwy-apple-architecture/references/extraction.md +9 -0
- package/templates/ai-tools/{rules/iOS/dwy-apple-layering.md → skills/Apple/dwy-apple-architecture/references/layering.md} +2 -10
- package/templates/ai-tools/skills/Apple/dwy-apple-architecture/references/pitfalls.md +3 -0
- package/templates/ai-tools/skills/Apple/dwy-ios-development/SKILL.md +14 -0
- package/templates/ai-tools/skills/Apple/dwy-ios-development/references/appearance.md +6 -0
- package/templates/ai-tools/{rules/iOS/dwy-ios-layout-adaptation.md → skills/Apple/dwy-ios-development/references/layout.md} +0 -6
- package/templates/ai-tools/{rules/iOS/dwy-ios-pitfalls.md → skills/Apple/dwy-ios-development/references/pitfalls.md} +1 -9
- package/templates/ai-tools/skills/Apple/dwy-ios-development/references/presentations.md +11 -0
- package/templates/ai-tools/skills/Apple/dwy-macos-development/SKILL.md +14 -0
- package/templates/ai-tools/skills/Apple/dwy-macos-development/references/pitfalls.md +9 -0
- package/templates/ai-tools/skills/Apple/dwy-macos-development/references/presentations.md +5 -0
- package/templates/ai-tools/skills/Apple/dwy-macos-development/references/ui-adaptation.md +6 -0
- package/templates/ai-tools/skills/Apple/dwy-swift-development/SKILL.md +16 -0
- package/templates/ai-tools/{rules/iOS/dwy-swift-core.md → skills/Apple/dwy-swift-development/references/conventions.md} +2 -8
- package/templates/ai-tools/skills/Apple/dwy-swift-development/references/pitfalls.md +5 -0
- package/templates/ai-tools/skills/Apple/dwy-swift-development/references/presentations.md +8 -0
- package/templates/ai-tools/skills/Docker/dwy-docker/SKILL.md +2 -0
- package/templates/ai-tools/skills/Flutter/dwy-flutter-development/SKILL.md +15 -0
- package/templates/ai-tools/skills/HarmonyOS/dwy-harmony-development/SKILL.md +15 -0
- package/templates/ai-tools/skills/Python/dwy-apple-notify/SKILL.md +24 -0
- package/templates/ai-tools/skills/Python/dwy-apple-notify/references/v0/0.1.6.md +81 -0
- package/templates/ai-tools/skills/Python/dwy-auth/SKILL.md +24 -0
- package/templates/ai-tools/skills/Python/dwy-auth/references/v0/0.2.0.md +163 -0
- package/templates/ai-tools/skills/Python/dwy-device-fingerprint/SKILL.md +19 -0
- package/templates/ai-tools/skills/Python/dwy-device-fingerprint/references/v0/0.1.1.md +90 -0
- package/templates/ai-tools/skills/Python/dwy-eapi/SKILL.md +1 -1
- package/templates/ai-tools/skills/Python/dwy-eapi/versions.yml +3 -3
- package/templates/ai-tools/skills/Python/dwy-email-notify/SKILL.md +19 -0
- package/templates/ai-tools/skills/Python/dwy-email-notify/references/v0/0.1.0.md +31 -0
- package/templates/ai-tools/skills/Python/dwy-notify/SKILL.md +24 -0
- package/templates/ai-tools/skills/Python/dwy-notify/references/v0/0.3.2.md +128 -0
- package/templates/ai-tools/skills/Python/dwy-payment/SKILL.md +19 -0
- package/templates/ai-tools/skills/Python/dwy-payment/references/v0/0.3.0.md +90 -0
- package/templates/ai-tools/skills/Python/dwy-python-api/SKILL.md +8 -0
- package/templates/ai-tools/skills/Python/dwy-python-architecture/SKILL.md +8 -0
- package/templates/ai-tools/skills/Python/dwy-python-development/SKILL.md +17 -0
- package/templates/ai-tools/{rules/Python → skills/Python/dwy-python-development/references}/dwy-python-base-lib.md +3 -3
- package/templates/ai-tools/skills/Python/dwy-webhooks/SKILL.md +24 -0
- package/templates/ai-tools/skills/Python/dwy-webhooks/references/v0/0.6.2.md +238 -0
- package/templates/ai-tools/skills/Python/dwy-wechatpay-notify/SKILL.md +19 -0
- package/templates/ai-tools/skills/Python/dwy-wechatpay-notify/references/v0/0.1.1.md +101 -0
- package/templates/ai-tools/skills/Vue/dwy-admin-kit/SKILL.md +12 -0
- package/templates/ai-tools/skills/Vue/dwy-admin-kit/references/v0/0.3.0.md +176 -0
- package/templates/ai-tools/skills/Vue/dwy-auth-web/SKILL.md +10 -0
- package/templates/ai-tools/skills/Vue/dwy-ekit/SKILL.md +2 -3
- package/templates/ai-tools/skills/Vue/dwy-eui/SKILL.md +1 -1
- package/templates/ai-tools/skills/Vue/dwy-eui/versions.yml +2 -2
- package/templates/ai-tools/skills/Vue/dwy-vue-architecture/SKILL.md +8 -0
- package/templates/ai-tools/skills/Vue/dwy-vue-development/SKILL.md +16 -0
- package/templates/ai-tools/{rules/Vue → skills/Vue/dwy-vue-development/references}/dwy-vue-base-lib.md +3 -3
- package/templates/ai-tools/skills//344/272/247/345/223/2010/345/210/2601/dwy-architecture/SKILL.md +7 -7
- package/templates/ai-tools/skills//345/217/221/345/270/203/345/217/221/347/211/210/dwy-publish/SKILL.md +2 -0
- package/templates/ai-tools/skills//346/225/260/346/215/256/345/272/223/dwy-alembic/SKILL.md +8 -0
- package/templates/ai-tools/skills//346/225/260/346/215/256/345/272/223/dwy-postgres/SKILL.md +10 -0
- package/templates/ai-tools/skills//346/225/260/346/215/256/345/272/223/dwy-redis/SKILL.md +8 -0
- package/templates/ai-tools/skills//351/200/232/347/224/250/dwy-dependency-choice/SKILL.md +1 -1
- package/templates/ai-tools/skills//351/200/232/347/224/250/dwy-development-review/SKILL.md +2 -0
- package/templates/ai-tools/skills//351/200/232/347/224/250/dwy-git-commit/SKILL.md +1 -1
- /package/templates/ai-tools/{rules/Android → skills/Android/dwy-android-architecture/references}/dwy-android-layering.md +0 -0
- /package/templates/ai-tools/{rules/Android → skills/Android/dwy-android-architecture/references}/dwy-android-mvp.md +0 -0
- /package/templates/ai-tools/{rules/Android → skills/Android/dwy-android-development/references}/dwy-android-core.md +0 -0
- /package/templates/ai-tools/{rules/Android → skills/Android/dwy-android-development/references}/dwy-android-pitfalls.md +0 -0
- /package/templates/ai-tools/{rules/Android → skills/Android/dwy-android-development/references}/dwy-android-support-only.md +0 -0
- /package/templates/ai-tools/{rules/Docker → skills/Docker/dwy-docker/references}/dwy-docker.md +0 -0
- /package/templates/ai-tools/{rules/Flutter → skills/Flutter/dwy-flutter-development/references}/dwy-flutter-core.md +0 -0
- /package/templates/ai-tools/{rules/Flutter → skills/Flutter/dwy-flutter-development/references}/dwy-flutter-network.md +0 -0
- /package/templates/ai-tools/{rules/Flutter → skills/Flutter/dwy-flutter-development/references}/dwy-flutter-router.md +0 -0
- /package/templates/ai-tools/{rules/Flutter → skills/Flutter/dwy-flutter-development/references}/dwy-flutter-testing.md +0 -0
- /package/templates/ai-tools/{rules/HarmonyOS → skills/HarmonyOS/dwy-harmony-development/references}/dwy-arkts-strict.md +0 -0
- /package/templates/ai-tools/{rules/HarmonyOS → skills/HarmonyOS/dwy-harmony-development/references}/dwy-arkts-ui-build.md +0 -0
- /package/templates/ai-tools/{rules/HarmonyOS → skills/HarmonyOS/dwy-harmony-development/references}/dwy-arkts-ui-design.md +0 -0
- /package/templates/ai-tools/{rules/HarmonyOS → skills/HarmonyOS/dwy-harmony-development/references}/dwy-harmony-pitfalls.md +0 -0
- /package/templates/ai-tools/{rules/Python → skills/Python/dwy-python-api/references}/dwy-python-backend.md +0 -0
- /package/templates/ai-tools/{rules/Python → skills/Python/dwy-python-architecture/references}/dwy-python-layering.md +0 -0
- /package/templates/ai-tools/{rules/Python → skills/Python/dwy-python-development/references}/dwy-python-core.md +0 -0
- /package/templates/ai-tools/{rules/Python → skills/Python/dwy-python-development/references}/dwy-python-pitfalls.md +0 -0
- /package/templates/ai-tools/{rules/Python → skills/Python/dwy-python-development/references}/dwy-python-testing.md +0 -0
- /package/templates/ai-tools/{rules/Vue → skills/Vue/dwy-vue-architecture/references}/dwy-vue-layering.md +0 -0
- /package/templates/ai-tools/{rules/Vue → skills/Vue/dwy-vue-development/references}/dwy-vue-core.md +0 -0
- /package/templates/ai-tools/{rules/Vue → skills/Vue/dwy-vue-development/references}/dwy-vue-pinia.md +0 -0
- /package/templates/ai-tools/{rules/Vue → skills/Vue/dwy-vue-development/references}/dwy-vue-pitfalls.md +0 -0
- /package/templates/ai-tools/{rules/Vue → skills/Vue/dwy-vue-development/references}/dwy-vue-testing.md +0 -0
- /package/templates/ai-tools/{rules//345/274/200/345/217/221/346/265/201/347/250/213 → skills//345/217/221/345/270/203/345/217/221/347/211/210/dwy-publish/references}/dwy-prod-branch.md" +0 -0
- /package/templates/ai-tools/{rules//346/225/260/346/215/256/345/272/223 → skills//346/225/260/346/215/256/345/272/223/dwy-alembic/references}/dwy-db-migration.md" +0 -0
- /package/templates/ai-tools/{rules//346/225/260/346/215/256/345/272/223 → skills//346/225/260/346/215/256/345/272/223/dwy-postgres/references}/dwy-postgres.md" +0 -0
- /package/templates/ai-tools/{rules//346/225/260/346/215/256/345/272/223 → skills//346/225/260/346/215/256/345/272/223/dwy-redis/references}/dwy-redis.md" +0 -0
- /package/templates/ai-tools/{rules//345/274/200/345/217/221/346/265/201/347/250/213 → skills//351/200/232/347/224/250/dwy-dependency-choice/references}/dwy-dependency-freshness.md" +0 -0
- /package/templates/ai-tools/{rules//345/274/200/345/217/221/346/265/201/347/250/213 → skills//351/200/232/347/224/250/dwy-dependency-choice/references}/dwy-oss-commercial-license.md" +0 -0
- /package/templates/ai-tools/{rules//345/274/200/345/217/221/346/265/201/347/250/213 → skills//351/200/232/347/224/250/dwy-development-review/references}/dwy-code-craft.md" +0 -0
- /package/templates/ai-tools/{rules//345/274/200/345/217/221/346/265/201/347/250/213 → skills//351/200/232/347/224/250/dwy-git-commit/references}/dwy-git-commit.md" +0 -0
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
<!-- 来源:dwy-wechatpay-notify@0.1.1 的 backend/packages/wechatpay-notify/README.md;文中相对链接相对原仓库路径。 -->
|
|
2
|
+
|
|
3
|
+
# dwy-wechatpay-notify
|
|
4
|
+
|
|
5
|
+
独立微信支付来源包(0.1.1):复用 `wechatpayv3[async]==2.0.4` 的公开 `callback(headers, body)` 验签解密,把付款和退款结果转成 `dwy_notify.events.NotificationEvent`。不依赖宿主支付模块,不实现 RSA/AES、业务账本、权益变更或群消息发送。
|
|
6
|
+
|
|
7
|
+
本包采用 [MIT License](LICENSE)。微信支付 SDK `wechatpayv3==2.0.4` 同样采用 MIT,具体版权声明以各发行包为准。
|
|
8
|
+
|
|
9
|
+
## 已有支付后台
|
|
10
|
+
|
|
11
|
+
已有官方回调入口的项目直接使用 verifier,不重复注册本包路由。SDK 客户端、商户私钥、APIv3 密钥、公钥/平台证书全部由宿主配置;在 SDK 客户端有效上下文内注入它的同步公开 callback。本包不读取环境变量、不复制密钥、不调用 SDK 私有 core。
|
|
12
|
+
|
|
13
|
+
```python
|
|
14
|
+
from dwy_wechatpay_notify import (
|
|
15
|
+
PaymentNotificationContext,
|
|
16
|
+
WechatPayNotificationVerifier,
|
|
17
|
+
WechatPayNotifyConfig,
|
|
18
|
+
wechatpay_notification_event,
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
async def handle_callback(headers, raw_body, sdk_client, payment_service, durable_sink):
|
|
23
|
+
"""由宿主传入已打开的 SDK 客户端、原始 bytes 和持久接收器。"""
|
|
24
|
+
config = WechatPayNotifyConfig(mchid="1900000001", appid="wx123", scope="shop-production")
|
|
25
|
+
verified = await WechatPayNotificationVerifier(config, callback=sdk_client.callback).verify(headers, raw_body)
|
|
26
|
+
# 宿主核对本地订单/金额并完成业务提交;持久 outbox 应与业务事务一起写入。
|
|
27
|
+
confirmed = await payment_service.apply_verified_notification(verified)
|
|
28
|
+
event = wechatpay_notification_event(
|
|
29
|
+
confirmed,
|
|
30
|
+
scope=config.scope,
|
|
31
|
+
context=PaymentNotificationContext(description="基础版月付", outcome="权益已确认"),
|
|
32
|
+
)
|
|
33
|
+
await durable_sink(event)
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
`payment_service` 与 `durable_sink` 是宿主注入对象,示例不定义业务账本。主动查单、补单或对账时构造 `ConfirmedWechatPayResult`:付款需 `event_type="TRANSACTION.SUCCESS"`、`order_no`、`transaction_id`、整数分 `amount_fen`、`trade_type`、`trade_state="SUCCESS"`;退款另需 `refund_no`、`refund_id`、`refund_fen`、与事件一致的 `refund_status`。查单没有官方回调 ID 时保持 `provider_event_id=None`。
|
|
37
|
+
|
|
38
|
+
收到已验证官方事件**不证明本地已入账**。宿主必须核对订单、币种、原金额与状态,并由自己的事务确定权益。`REFUND.ABNORMAL`、`REFUND.CLOSED` 只表示异常/关闭,不能当作退款成功。退款回调可能没有 appid,始终核验 mchid;有 appid 时同时核验。
|
|
39
|
+
|
|
40
|
+
## 新项目:可选 FastAPI 安装器
|
|
41
|
+
|
|
42
|
+
安装包的 `[fastapi]` extra 后调用以下装配函数;生产必须传入持久化 `EventSink`,不得用只发 HTTP 群消息的函数替代持久接受。`sink(event)` 返回 True 表示新接受,False 表示之前已接受的重复,二者均确认;异常返回 HTTP 503,微信可重试。本模块不在验签前用内存 receipt 吞掉业务重试。
|
|
43
|
+
|
|
44
|
+
```python
|
|
45
|
+
from dwy_wechatpay_notify import (
|
|
46
|
+
WechatPayNotificationVerifier,
|
|
47
|
+
WechatPayNotifyConfig,
|
|
48
|
+
install_wechatpay_notifications,
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def configure_callbacks(app, sdk_client, durable_sink):
|
|
53
|
+
"""宿主 lifespan 保持 SDK 客户端存活,关闭资源仍由宿主负责。"""
|
|
54
|
+
config = WechatPayNotifyConfig(mchid="1900000001", appid="wx123", scope="shop-production")
|
|
55
|
+
install_wechatpay_notifications(
|
|
56
|
+
app,
|
|
57
|
+
config,
|
|
58
|
+
verifier=WechatPayNotificationVerifier(config, callback=sdk_client.callback),
|
|
59
|
+
sink=durable_sink,
|
|
60
|
+
)
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
默认接收地址示例:`http://localhost:8000/webhooks/wechatpay`;生产应配置真实公网 HTTPS,例如 `https://payments.example.com:443/webhooks/wechatpay`。可通过 config.path 更改。安装器流式读取请求,默认最多 65536 bytes;超限 HTTP 413,验签/身份/协议失败 HTTP 400,持久接受成功或重复 HTTP 204。只交给 SDK 一次原始 bytes,不改变宿主 lifespan、不启动或关闭其他应用。
|
|
64
|
+
|
|
65
|
+
## 安全与幂等
|
|
66
|
+
|
|
67
|
+
0.1.1 起,外部项目可以通过 `PaymentNotificationContext.extra_fields` 提供自定义展示字段:
|
|
68
|
+
|
|
69
|
+
```python
|
|
70
|
+
from dwy_notify import NotificationField
|
|
71
|
+
from dwy_wechatpay_notify import ConfirmedWechatPayResult, PaymentNotificationContext, wechatpay_notification_event
|
|
72
|
+
|
|
73
|
+
result = ConfirmedWechatPayResult(
|
|
74
|
+
event_type="TRANSACTION.SUCCESS", order_no="order123", transaction_id="wx123",
|
|
75
|
+
amount_fen=1, trade_type="NATIVE", trade_state="SUCCESS",
|
|
76
|
+
)
|
|
77
|
+
event = wechatpay_notification_event(
|
|
78
|
+
result, scope="shop-preview",
|
|
79
|
+
context=PaymentNotificationContext(
|
|
80
|
+
description="基础套餐", outcome="权益已发放",
|
|
81
|
+
extra_fields=(
|
|
82
|
+
NotificationField(label="客户编号", value="customer-001"),
|
|
83
|
+
NotificationField(label="项目名称", value="示例项目"),
|
|
84
|
+
),
|
|
85
|
+
),
|
|
86
|
+
)
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
最多 8 项,每项标签 1–32、值 1–256 字符,均为单行纯文本。禁止重复标签及“订单号、金额、退款金额、业务结果”等固定标签;字段不会合并进官方 `data` 或改变去重键。库不查询用户表,也不自动序列化业务对象。字段是否允许包含个人资料及是否脱敏由宿主显式决定;不得传入密码、密钥或原始回调。入队前渲染正文,重试沿用快照。`NotificationEvent.data` 不会自动成为群消息。
|
|
90
|
+
|
|
91
|
+
传入字段时,固定金融事实与业务结果优先,其次附加字段,最后商品描述;总预算仍为 1800 UTF-8 字节,附加展示过长会标记截断或省略。未传字段时保持 0.1.0 的正文兼容行为。
|
|
92
|
+
|
|
93
|
+
- 配置显式注入,商户/应用身份非空,scope 最长 128 字符;不同商户/应用必须使用不同 scope。
|
|
94
|
+
- 付款键 `wechat:payment:{order_no}:success`;退款键 `wechat:refund:{refund_no}:{SUCCESS|ABNORMAL|CLOSED}`。回调与主动查单使用同一业务键;sink 按 source、scope、event_id 持久幂等。
|
|
95
|
+
- 事件 data 仅包含类型化白名单字段;不自动转发 payer/openid、邮箱、手机号、密钥、签名或原文。商品与业务结果不能夹带个人信息;需要展示的宿主资料须显式选择 `extra_fields`,不接受任意账号对象。
|
|
96
|
+
- 通知正文严格不超过 1800 UTF8 bytes,不截断金融标识。未传自定义字段时沿用原有商品/业务结果整项省略规则。金额用整数分格式化。
|
|
97
|
+
- `WECHATPAY/SIGNTEST/` 不是交易,安全拒绝;SDK 的异常统一转成 `WechatPayVerificationError`,不携带原文或密钥。宿主不得给 SDK 配置记录回调原文的日志器。
|
|
98
|
+
|
|
99
|
+
## 开发与验收
|
|
100
|
+
|
|
101
|
+
执行本目录 `pytest` 运行全部用例,使用固定测试驱动与本地临时 RSA 密钥/AESGCM,均不访问微信/企微网络。`tests/TEST_CASES.md` 记录覆盖边界。`tests/wheel_smoke.py` 面向已安装 wheel,验证独立核心导入及事件合同。正式发行必须使用 GitHub Actions OIDC;本地构建仅做临时 wheel 验收,不替代发布工作流。
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: dwy-admin-kit
|
|
3
|
+
description: 使用或排查 @dwydev/admin-kit 的接入和现有功能时使用,核实消费项目实际版本。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# @dwydev/admin-kit
|
|
7
|
+
|
|
8
|
+
管理后台模块、路由装配及 AdminShell 布局。项目使用 0.3.0 时可阅读 [0.3.0 接入说明](references/v0/0.3.0.md);其他版本不能直接套用。
|
|
9
|
+
|
|
10
|
+
先查项目实际依赖、锁文件与已安装包的声明文件和现有调用;版本范围不是安装版本。核实组件 props、初始化和生命周期后再使用。当前能力索引基于 0.3.0;版本不同可能存在差异。相同版本的源码与接入文档见仓库 `frontend/admin-shell`,其他版本查对应 `@dwydev/admin-kit@版本` 标签;不能用默认分支代替。缺少证据时说明,不猜接口。项目未安装时不自行添加依赖。
|
|
11
|
+
|
|
12
|
+
0.2.0 重写 AdminShell,并移除旧版内置主题、通知和用户菜单;0.3.0 新增组件、composables、分页列表等子入口,EUI peer 下限为 2.7.2。升级时核实宿主插槽与配套版本,不能把 0.3.0 接口用于 0.1.x。
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
<!-- 来源:@dwydev/admin-kit@0.3.0 的 frontend/admin-shell/README.md;相对链接以原仓库为准。 -->
|
|
2
|
+
|
|
3
|
+
# @dwydev/admin-kit
|
|
4
|
+
|
|
5
|
+
Vue 3 **管理框架与通用组合组件**:模块装配菜单与路由,统一壳布局、页头、面包屑、列表状态和管理页面展示。不读取产品 API、store 或领域模型。
|
|
6
|
+
|
|
7
|
+
视觉底座用 [`@dwydev/eui`](https://www.npmjs.com/package/@dwydev/eui) 的 `EAdminLayout`,**不并入 eui**(eui 只提供 UI 原语)。
|
|
8
|
+
|
|
9
|
+
## 安装
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
pnpm add @dwydev/admin-kit
|
|
13
|
+
# peers
|
|
14
|
+
pnpm add vue vue-router @dwydev/eui @dwydev/ekit lucide-vue-next
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
宿主需接入 eui theme(`@dwydev/eui/theme`)与 Tailwind。若 shell 类名未生效,把 content 扫到:
|
|
18
|
+
|
|
19
|
+
```txt
|
|
20
|
+
./node_modules/@dwydev/admin-kit/dist/**/*.{js,mjs}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Vite 跨仓联调注意(file: / 源码 alias)
|
|
24
|
+
|
|
25
|
+
若用 `file:` 或 alias 指 monorepo **源码**(而非已发布 dist),宿主 `vite.config` 必须 **dedupe 并钉死 `vue` / `vue-router`** 到应用自身 `node_modules`,否则会出现两份 vue-router,`useRoute()` inject 为 `undefined`,控制台页读 `.meta` 白屏:
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
resolve: {
|
|
29
|
+
dedupe: ['vue', 'vue-router'],
|
|
30
|
+
alias: {
|
|
31
|
+
vue: fileURLToPath(new URL('./node_modules/vue', import.meta.url)),
|
|
32
|
+
'vue-router': fileURLToPath(new URL('./node_modules/vue-router', import.meta.url)),
|
|
33
|
+
},
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
发 npm 后消费 dist、peer 由宿主安装时通常无此问题。
|
|
38
|
+
## 快速接入(壳组件模式,适合营销 + 控制台共存)
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
import { createAdminShell, defineAdminModule, asMenuIcon, AdminShell } from '@dwydev/admin-kit'
|
|
42
|
+
import { LayoutDashboard } from 'lucide-vue-next'
|
|
43
|
+
|
|
44
|
+
export const appShell = createAdminShell({
|
|
45
|
+
title: 'My App',
|
|
46
|
+
logo: '/logo.png',
|
|
47
|
+
collapsedStorageKey: 'myapp:admin:sidebar:collapsed',
|
|
48
|
+
routeMetaDefaults: { requiresAuth: true, layout: 'admin' },
|
|
49
|
+
modules: [
|
|
50
|
+
defineAdminModule({
|
|
51
|
+
id: 'dashboard',
|
|
52
|
+
order: 10,
|
|
53
|
+
menu: { key: '/dashboard', label: '概览', icon: asMenuIcon(LayoutDashboard) },
|
|
54
|
+
routes: [{
|
|
55
|
+
path: '/dashboard',
|
|
56
|
+
name: 'dashboard',
|
|
57
|
+
component: () => import('./pages/Dashboard.vue'),
|
|
58
|
+
meta: { title: '概览' },
|
|
59
|
+
}],
|
|
60
|
+
}),
|
|
61
|
+
// 隐藏菜单、仅保留直访路由
|
|
62
|
+
defineAdminModule({
|
|
63
|
+
id: 'hidden-page',
|
|
64
|
+
showInMenu: false,
|
|
65
|
+
routes: [{ path: '/internal', name: 'internal', component: () => import('./pages/Internal.vue'), meta: { title: '内部' } }],
|
|
66
|
+
}),
|
|
67
|
+
],
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
// router: [...publicRoutes, ...appShell.routes]
|
|
71
|
+
// layout:
|
|
72
|
+
// <AdminShell v-bind="appShell.shellProps">
|
|
73
|
+
// <template #header-extra>…用户菜单…</template>
|
|
74
|
+
// </AdminShell>
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## 纯后台父子路由
|
|
78
|
+
|
|
79
|
+
首版以**扁平绝对 path + 宿主渲染 AdminShell** 为主(与 quant-cloud 一致)。
|
|
80
|
+
`path: '/'` + `children` 形态可在后续版本用 `createAdminShellRoute` 增强。
|
|
81
|
+
|
|
82
|
+
## 导出
|
|
83
|
+
|
|
84
|
+
| API | 说明 |
|
|
85
|
+
|-----|------|
|
|
86
|
+
| `createAdminShell` / `defineAdminModule` | 菜单 + 路由装配 |
|
|
87
|
+
| `AdminShell` | 布局组件 |
|
|
88
|
+
| `AdminPageHero` / `AdminBreadcrumb` / `AdminPageHeader` | 页头与面包屑 |
|
|
89
|
+
| `asMenuIcon` / `useAdminActiveKey` / `useAdminBreadcrumb` | 工具 |
|
|
90
|
+
|
|
91
|
+
## meta 约定
|
|
92
|
+
|
|
93
|
+
| 字段 | 说明 |
|
|
94
|
+
|------|------|
|
|
95
|
+
| `title` | 页头标题 |
|
|
96
|
+
| `description` | 页头副标题 |
|
|
97
|
+
| `menuKey` | 侧栏高亮(嵌套子页) |
|
|
98
|
+
| `pageHero` | 默认 true;false 时页面自管页头 |
|
|
99
|
+
| `breadcrumb` | 覆盖自动面包屑 |
|
|
100
|
+
|
|
101
|
+
## 不负责
|
|
102
|
+
|
|
103
|
+
鉴权守卫、角色模型、业务 header 内容、HTTP / Pinia。
|
|
104
|
+
|
|
105
|
+
## 0.3 通用管理组件
|
|
106
|
+
|
|
107
|
+
0.3 保留原根入口,新增以下显式子路径。EUI peer 下限为已修复标签关联与键盘输入操作的 2.7.2。
|
|
108
|
+
|
|
109
|
+
```ts
|
|
110
|
+
import { PagedTable, RecordSearch, RequestFeedback, ConfigFieldControl } from '@dwydev/admin-kit/components'
|
|
111
|
+
import { usePagedList } from '@dwydev/admin-kit/composables'
|
|
112
|
+
import { STATUS_TONE } from '@dwydev/admin-kit/status/tone'
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
`components` 还提供总览/统计卡、记录详情/代码/省略/日期展示、状态徽章、筛选器、图表容器及确认执行。`OverviewCard` 与 `WindowToggle` 旧名保持兼容;图表容器不引入 Plotly。密码字段和产品领域页面不在本包内。
|
|
116
|
+
|
|
117
|
+
加载样式并让 Tailwind 扫描实际安装的构建产物:
|
|
118
|
+
|
|
119
|
+
```css
|
|
120
|
+
@import '@dwydev/eui/theme';
|
|
121
|
+
@import '@dwydev/admin-kit/style.css';
|
|
122
|
+
@source '../node_modules/@dwydev/eui/dist/**/*.js';
|
|
123
|
+
@source '../node_modules/@dwydev/admin-kit/dist/**/*.js';
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
扫描路径以宿主 CSS 文件为基准。产品已有相应配置时只调整路径,不重复加载主题。
|
|
127
|
+
|
|
128
|
+
### 分页状态
|
|
129
|
+
|
|
130
|
+
`RecordSearch` 的 `label` 提供持久、视觉隐藏的输入标签;省略时沿用 `placeholder`。输入法合成回车不提交。用户手动删空或点击清空按钮时会先更新 `modelValue`,再各发一次 `clear` 与 `search`;`clear` 只用于通知,宿主统一在 `search` 中请求,避免重复加载。外部直接清空 `modelValue` 不触发搜索。
|
|
131
|
+
|
|
132
|
+
`PagedTable` 在实际横向溢出时显示滑动提示,并使滚动区可键盘聚焦。需要常驻的行操作列直接使用既有列属性 `{ key: 'actions', title: '操作', width: 80, fixed: 'right' }`;仅固定较窄的操作列,避免占满窄屏。列定义及 `#cell-*` 插槽仍原样转交 EUI。
|
|
133
|
+
|
|
134
|
+
`RecordEllipsis` 仅在文本实际截断时开启全文提示与键盘停靠,完整文本与占位符不增加 Tab 次数。
|
|
135
|
+
|
|
136
|
+
```ts
|
|
137
|
+
const list = usePagedList({
|
|
138
|
+
fetcher: async ({ page, pageSize, keyword }, request) => {
|
|
139
|
+
const result = await hostApi.list({ page, pageSize, keyword })
|
|
140
|
+
if (request.isCurrent()) hostSummary.value = result.summary
|
|
141
|
+
return { items: result.items, total: result.total }
|
|
142
|
+
},
|
|
143
|
+
})
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
`hostApi` 与 `hostSummary` 由产品提供。单参数 fetcher 继续兼容;`paged-list` 子路径与 `composables` 导出同一实现。
|
|
147
|
+
|
|
148
|
+
- `error` 保留原始失败对象;当前失败清空数据但不向调用方抛出,便于页面区分失败和零条记录。
|
|
149
|
+
- 每次 `load` 开始清旧错误,旧请求成功/失败/finally 不得覆盖新请求。
|
|
150
|
+
- `invalidate()` 停止 loading 并淘汰在途请求,保留数据、错误与筛选,允许之后再次加载。
|
|
151
|
+
- `reset()` 另清空数据/错误/关键词,恢复初始每页条数和排序。
|
|
152
|
+
- Vue 作用域销毁时自动 invalidate;底层 HTTP 不会被取消。
|
|
153
|
+
|
|
154
|
+
### 构建与实际制品验收
|
|
155
|
+
|
|
156
|
+
在仓库根执行:
|
|
157
|
+
|
|
158
|
+
```sh
|
|
159
|
+
pnpm --dir frontend/eui build
|
|
160
|
+
pnpm --dir frontend/ekit build
|
|
161
|
+
pnpm --dir frontend/admin-shell test
|
|
162
|
+
pnpm --dir frontend/admin-shell build
|
|
163
|
+
pnpm --dir frontend/admin-shell smoke:pack
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
smoke 将本轮实际 admin-kit/EUI/ekit tgz 安装到干净目录,检查根/子入口、类型、分页生命周期和 Vite 打包后的真实 EUI SSR;不依赖源码 alias 或共享仓库外的私有产物。它验证 Vue/Vite 消费模式,不承诺现有 ekit 可由原生 Node 无打包直接加载。其他固定依赖从官方 npm registry 安装,冷缓存需要网络。
|
|
167
|
+
|
|
168
|
+
两产品可暂保留 `@dwy/components` 转出口;本地准备脚本将本包 tgz 复制到各自 `.shared-packages`,不把临时绝对路径写进 package/lock。正式 registry 接入在另行发行后切换,制品验收通过不表示已经发布。
|
|
169
|
+
|
|
170
|
+
## 开发
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
cd frontend/admin-shell
|
|
174
|
+
pnpm test
|
|
175
|
+
pnpm build
|
|
176
|
+
```
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: dwy-auth-web
|
|
3
|
+
description: 使用或排查 @dwydev/auth-web 的接入和现有功能时使用,核实消费项目实际版本。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# @dwydev/auth-web
|
|
7
|
+
|
|
8
|
+
管理员 Cookie 登录表单与会话;宿主提供 EConfigProvider、样式和成功导航。
|
|
9
|
+
|
|
10
|
+
先查项目实际依赖、锁文件与已安装包的声明文件和现有调用;版本范围不是安装版本。核实组件 props、初始化和生命周期后再使用。当前仓库清单是 0.1.0,但尚未核实对应发布标签;不能仅凭清单推断已发布包的内容。源码与接入文档在仓库 `frontend/auth-web`;先确认实际来源与版本一致。缺少证据时说明,不猜接口。项目未安装时不自行添加依赖。
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: dwy-ekit
|
|
3
|
-
description:
|
|
4
|
-
ekit_baseline_version: "0.8.0"
|
|
3
|
+
description: 使用或排查 @dwydev/ekit 的请求、存储、日期、校验、文件和 Vue 工具时使用;按项目实际版本查证能力。
|
|
5
4
|
---
|
|
6
5
|
|
|
7
6
|
# @dwydev/ekit 工具库使用指南
|
|
@@ -20,7 +19,7 @@ ekit 共 82 个对外导出。**本文档不再镜像函数签名** —— 因
|
|
|
20
19
|
|
|
21
20
|
### 第一步:定位 ekit 真实版本
|
|
22
21
|
|
|
23
|
-
|
|
22
|
+
先读消费方项目的实际安装包和锁文件确定版本,再核对 `package.json` 的依赖范围;范围不等于实际安装版本。未安装时不要假设该库已可用或自行增加依赖。
|
|
24
23
|
|
|
25
24
|
### 第二步:读 module-manifest.json(一次拿导出索引)
|
|
26
25
|
|
|
@@ -16,7 +16,7 @@ Vue 3 组件库(Reka-ui + shadcn 视觉 + Element Plus 式 API + Tailwind 4)
|
|
|
16
16
|
node -p "require('@dwydev/eui/package.json').version"
|
|
17
17
|
```
|
|
18
18
|
失败则读 `pnpm-workspace.yaml` catalog `'@dwydev/eui'`,再读 `package.json` 的 `dependencies` / `peerDependencies`。
|
|
19
|
-
|
|
19
|
+
声明的依赖范围不代表实际安装版本。仍无法确定时说明缺口,不按任一版本猜测 API。
|
|
20
20
|
|
|
21
21
|
2. **选线**:读同目录 `versions.yml`。`2.y.z` → `v2/`,`1.y.z` → `v1/`。目录不存在(例如装了 3.x 但还没有 `v3/`)→ 不要用 `v2` 冒充;按下面「读源码」拿该版本代码,并说明文档线未建。
|
|
22
22
|
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: dwy-vue-development
|
|
3
|
+
description: 开发、修改、测试或排查 Vue 应用、组件及组合式函数时使用;覆盖团队写法、常见踩坑和自有基础库发现。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Vue 开发
|
|
7
|
+
|
|
8
|
+
先确认 Vue、TypeScript、构建工具及项目已有依赖。优先复用项目现有组件和工具,不自动新增自有依赖。涉及模块边界时使用可用的 dwy-vue-architecture。
|
|
9
|
+
|
|
10
|
+
- [Vue 规范](references/dwy-vue-core.md):组件、路由、样式及配置。
|
|
11
|
+
- [Pinia](references/dwy-vue-pinia.md):项目使用 Pinia 时参考。
|
|
12
|
+
- [测试](references/dwy-vue-testing.md):组件和业务测试。
|
|
13
|
+
- [踩坑](references/dwy-vue-pitfalls.md):响应式、路由和构建排查。
|
|
14
|
+
- [自有基础库](references/dwy-vue-base-lib.md):项目已使用时查 dwy-eui、dwy-ekit;管理后台和认证分别查 dwy-admin-kit、dwy-auth-web。
|
|
15
|
+
|
|
16
|
+
资料中的强制选型仅适用于已采用该栈或用户明确选择的新项目,现有项目遵循现有依赖和用户要求。
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
---
|
|
2
|
-
description:
|
|
2
|
+
description: 已使用 eui 和 ekit 的项目如何查找和复用基础能力
|
|
3
3
|
paths:
|
|
4
4
|
- "**/*.vue"
|
|
5
5
|
- "**/*.ts"
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
# Vue
|
|
8
|
+
# Vue 团队基础能力
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
本资料适用于已采用 eui 或 ekit 的项目;版本及公开接口以实际安装包和对应 Skill 为准。项目未采用时此处仅用于了解能力,不要求引入或替换现有实现。
|
|
11
11
|
|
|
12
12
|
`@dwydev/eui` 与 `@dwydev/ekit` 是团队内部 npm 基础库,分别覆盖 UI 组件层与通用工具层。
|
|
13
13
|
|
package/templates/ai-tools/skills//344/272/247/345/223/2010/345/210/2601/dwy-architecture/SKILL.md
CHANGED
|
@@ -39,19 +39,19 @@ description: "【dwy·技术架构】产品 0 到 1 设计与架构阶段。触
|
|
|
39
39
|
|
|
40
40
|
### 四层架构
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
层名、依赖边、分包树以对应技术栈的架构指引为准,本 skill **不另定义目录**:
|
|
43
43
|
|
|
44
|
-
- Python → `dwy-python-
|
|
45
|
-
- Vue → `dwy-vue-
|
|
46
|
-
- Android → `dwy-android-
|
|
47
|
-
- iOS / macOS → `dwy-apple-
|
|
44
|
+
- Python → `dwy-python-architecture`
|
|
45
|
+
- Vue → `dwy-vue-architecture`
|
|
46
|
+
- Android → `dwy-android-architecture`
|
|
47
|
+
- iOS / macOS → `dwy-apple-architecture`
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
团队新项目参考对应架构指引;既有项目先核实当前依赖边和模块组织,避免擅自重构。
|
|
50
50
|
|
|
51
51
|
## 实现
|
|
52
52
|
[自写型]
|
|
53
53
|
1. 读项目 `.claude/rules/`,结合上方架构约束产出架构(项目 rules 优先,本约束兜底)
|
|
54
|
-
2.
|
|
54
|
+
2. 技术架构:先读可用的对应栈架构 Skill,再写分层、模块边界和选型理由;选型不确定处走 `AskUserQuestion`
|
|
55
55
|
3. **判有无后端**(读选型/PRD:有 API / 持久化 / 账户体系 → 有后端):
|
|
56
56
|
- **有后端** → 必出数据库设计,且**建模到位**:库表清单 / 字段(类型·约束·默认·可空) / 主外键关系 / 索引 / 必要的范式或反范式说明,与接口契约 schema 对齐
|
|
57
57
|
- **纯前端**(无后端)→ 跳过数据库设计,在 `技术架构.md` 注明「无后端,不涉及库表」
|
|
@@ -7,6 +7,8 @@ description: "Use when 用户要求整理工程版本、更新 changelog、打
|
|
|
7
7
|
|
|
8
8
|
先识别工程及变更,再为需要更新的工程维护版本、changelog 和 tag;是否发布及发布方式按用户意图和项目上下文判断。
|
|
9
9
|
|
|
10
|
+
分支与环境关系应先核实当前项目的约定及实际工作流。[历史 develop/preview 规则](references/dwy-prod-branch.md)仅适用于明确采用该约定的项目,不覆盖其他项目的分支策略或用户授权。
|
|
11
|
+
|
|
10
12
|
## 流程
|
|
11
13
|
|
|
12
14
|
1. 读取仓库指令、结构、构建配置、版本来源、changelog、Git 状态和历史 tag,识别独立工程及共享版本边界。依据实际依赖判断共享代码影响;不要把每个子目录当成独立工程。优先遵循用户指定范围,分不清边界时询问。
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: dwy-alembic
|
|
3
|
+
description: 创建、审查或排查使用 Alembic 的 SQLAlchemy 数据库结构迁移时使用。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Alembic 迁移
|
|
7
|
+
|
|
8
|
+
先检查项目现有 Alembic 配置、元数据、迁移历史与目标数据库,避免重建已初始化的环境。按任务读 [Alembic 迁移](references/dwy-db-migration.md);示例导入路径需按当前项目替换。自动生成后人工检查升级、回滚和现有数据兼容性;生产执行与破坏性变更按用户授权及项目流程处理。
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: dwy-postgres
|
|
3
|
+
description: 设计、修改或排查 PostgreSQL 数据库、连接、权限与敏感数据时使用。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# PostgreSQL 开发
|
|
7
|
+
|
|
8
|
+
先核实实际 PostgreSQL 版本、连接方式、用户权限、数据规模和项目已有迁移机制。按任务读 [PostgreSQL 规范](references/dwy-postgres.md);数据库连接与凭据从环境或配置获取,不写入代码、日志或示例。涉及数据变更先评估兼容性与回滚,破坏性操作遵循已有授权边界。
|
|
9
|
+
|
|
10
|
+
历史资料提到的 `dwy-db-migration` 对应 `dwy-alembic`;只有项目使用 Alembic 时才适用。
|
|
@@ -7,7 +7,7 @@ description: "新增或升级运行时依赖、选版本、选基础镜像 / SDK
|
|
|
7
7
|
|
|
8
8
|
新装或新选依赖、base 镜像、SDK、字体、图标、素材、模型权重时读本 skill。已安装的旧版本不用为此升级。本包自己的发版版本号按 `dwy-publish` 决策。
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
旧模板摘要仅供识别迁移时的历史托管文件,不作为独立 Rules 分发;依赖版本和许可判断以本 Skill 及当前项目要求为准。
|
|
11
11
|
|
|
12
12
|
## 一、版本
|
|
13
13
|
|
|
@@ -9,6 +9,8 @@ description: Use when starting or completing code development, implementing feat
|
|
|
9
9
|
|
|
10
10
|
本 Skill 只定义通用流程,不依赖特定 CLI、模型、语言、框架或其他 Skill。自动加载取决于宿主的技能发现能力;本文件本身不是强制执行器,也不授予额外权限。
|
|
11
11
|
|
|
12
|
+
需要检查代码简约、行为变更及测试位置时,按需阅读 [代码质量](references/dwy-code-craft.md)。项目和用户明确要求优先。
|
|
13
|
+
|
|
12
14
|
## 入口与决策
|
|
13
15
|
|
|
14
16
|
- **开发任务**:从第 1 步走完整闭环,不把计划、候选方案或测试通过当作最终交付。
|
|
@@ -7,7 +7,7 @@ description: "准备 git commit、写 commit message、处理 git pull / rebase
|
|
|
7
7
|
|
|
8
8
|
本次任务包含提交、commit message、`git pull` / rebase 冲突、提交前检查时读本 skill。只改代码、不提交时不用。
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
旧模板摘要仅供识别迁移时的历史托管文件,不作为独立 Rules 分发;提交流程以本 Skill 和当前项目要求为准。
|
|
11
11
|
|
|
12
12
|
任一步不通过:中止提交。项目按多人协作处理,本地未基于最新远程提交前,禁止产生新 commit。
|
|
13
13
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/templates/ai-tools/{rules/Docker → skills/Docker/dwy-docker/references}/dwy-docker.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/templates/ai-tools/{rules/Vue → skills/Vue/dwy-vue-development/references}/dwy-vue-core.md
RENAMED
|
File without changes
|
/package/templates/ai-tools/{rules/Vue → skills/Vue/dwy-vue-development/references}/dwy-vue-pinia.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|