redis-py-kit 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.
Files changed (83) hide show
  1. redis_py_kit-0.1.0/.claude/settings.local.json +15 -0
  2. redis_py_kit-0.1.0/.gitignore +2 -0
  3. redis_py_kit-0.1.0/.idea/.gitignore +8 -0
  4. redis_py_kit-0.1.0/.idea/inspectionProfiles/Project_Default.xml +15 -0
  5. redis_py_kit-0.1.0/.idea/inspectionProfiles/profiles_settings.xml +6 -0
  6. redis_py_kit-0.1.0/.idea/misc.xml +7 -0
  7. redis_py_kit-0.1.0/.idea/modules.xml +8 -0
  8. redis_py_kit-0.1.0/.idea/redis-kit.iml +8 -0
  9. redis_py_kit-0.1.0/.idea/vcs.xml +7 -0
  10. redis_py_kit-0.1.0/.idea/workspace.xml +110 -0
  11. redis_py_kit-0.1.0/.python-version +1 -0
  12. redis_py_kit-0.1.0/CLAUDE.md +220 -0
  13. redis_py_kit-0.1.0/LICENSE +21 -0
  14. redis_py_kit-0.1.0/PKG-INFO +314 -0
  15. redis_py_kit-0.1.0/README.md +270 -0
  16. redis_py_kit-0.1.0/docs/lessons.md +0 -0
  17. redis_py_kit-0.1.0/docs/planning-with-files/findings.md +55 -0
  18. redis_py_kit-0.1.0/docs/planning-with-files/progress.md +36 -0
  19. redis_py_kit-0.1.0/docs/planning-with-files/task_plan.md +39 -0
  20. redis_py_kit-0.1.0/docs/superpowers/plans/2026-04-05-redis-kit-v1.md +4367 -0
  21. redis_py_kit-0.1.0/docs/superpowers/specs/2026-04-05-redis-kit-design.md +696 -0
  22. redis_py_kit-0.1.0/pyproject.toml +56 -0
  23. redis_py_kit-0.1.0/redis_kit/__init__.py +66 -0
  24. redis_py_kit-0.1.0/redis_kit/bloom/__init__.py +4 -0
  25. redis_py_kit-0.1.0/redis_kit/bloom/async_bloom.py +64 -0
  26. redis_py_kit-0.1.0/redis_kit/bloom/bloom.py +64 -0
  27. redis_py_kit-0.1.0/redis_kit/cache/__init__.py +5 -0
  28. redis_py_kit-0.1.0/redis_kit/cache/_logic.py +76 -0
  29. redis_py_kit-0.1.0/redis_kit/cache/async_cache.py +167 -0
  30. redis_py_kit-0.1.0/redis_kit/cache/cache.py +180 -0
  31. redis_py_kit-0.1.0/redis_kit/cache/decorator.py +122 -0
  32. redis_py_kit-0.1.0/redis_kit/compressors/__init__.py +17 -0
  33. redis_py_kit-0.1.0/redis_kit/compressors/base.py +11 -0
  34. redis_py_kit-0.1.0/redis_kit/compressors/lz4.py +13 -0
  35. redis_py_kit-0.1.0/redis_kit/compressors/zlib.py +16 -0
  36. redis_py_kit-0.1.0/redis_kit/compressors/zstd.py +17 -0
  37. redis_py_kit-0.1.0/redis_kit/config.py +32 -0
  38. redis_py_kit-0.1.0/redis_kit/connection.py +139 -0
  39. redis_py_kit-0.1.0/redis_kit/counter/__init__.py +11 -0
  40. redis_py_kit-0.1.0/redis_kit/counter/async_counter.py +78 -0
  41. redis_py_kit-0.1.0/redis_kit/counter/counter.py +78 -0
  42. redis_py_kit-0.1.0/redis_kit/exceptions.py +94 -0
  43. redis_py_kit-0.1.0/redis_kit/hooks.py +31 -0
  44. redis_py_kit-0.1.0/redis_kit/lock/__init__.py +4 -0
  45. redis_py_kit-0.1.0/redis_kit/lock/_lua.py +64 -0
  46. redis_py_kit-0.1.0/redis_kit/lock/async_lock.py +154 -0
  47. redis_py_kit-0.1.0/redis_kit/lock/lock.py +160 -0
  48. redis_py_kit-0.1.0/redis_kit/observability/__init__.py +10 -0
  49. redis_py_kit-0.1.0/redis_kit/observability/metrics.py +39 -0
  50. redis_py_kit-0.1.0/redis_kit/observability/otel.py +33 -0
  51. redis_py_kit-0.1.0/redis_kit/queue/__init__.py +17 -0
  52. redis_py_kit-0.1.0/redis_kit/queue/async_delay_queue.py +41 -0
  53. redis_py_kit-0.1.0/redis_kit/queue/async_pubsub.py +54 -0
  54. redis_py_kit-0.1.0/redis_kit/queue/async_reliable_queue.py +69 -0
  55. redis_py_kit-0.1.0/redis_kit/queue/delay_queue.py +41 -0
  56. redis_py_kit-0.1.0/redis_kit/queue/pubsub.py +54 -0
  57. redis_py_kit-0.1.0/redis_kit/queue/reliable_queue.py +69 -0
  58. redis_py_kit-0.1.0/redis_kit/serializers/__init__.py +11 -0
  59. redis_py_kit-0.1.0/redis_kit/serializers/base.py +11 -0
  60. redis_py_kit-0.1.0/redis_kit/serializers/json.py +14 -0
  61. redis_py_kit-0.1.0/redis_kit/serializers/msgpack.py +15 -0
  62. redis_py_kit-0.1.0/redis_kit/serializers/pickle.py +17 -0
  63. redis_py_kit-0.1.0/redis_kit/session/__init__.py +4 -0
  64. redis_py_kit-0.1.0/redis_kit/session/async_session.py +66 -0
  65. redis_py_kit-0.1.0/redis_kit/session/session.py +66 -0
  66. redis_py_kit-0.1.0/tests/__init__.py +0 -0
  67. redis_py_kit-0.1.0/tests/conftest.py +25 -0
  68. redis_py_kit-0.1.0/tests/test_bloom.py +48 -0
  69. redis_py_kit-0.1.0/tests/test_cache.py +144 -0
  70. redis_py_kit-0.1.0/tests/test_cache_decorator.py +111 -0
  71. redis_py_kit-0.1.0/tests/test_compressors.py +56 -0
  72. redis_py_kit-0.1.0/tests/test_config.py +74 -0
  73. redis_py_kit-0.1.0/tests/test_connection.py +67 -0
  74. redis_py_kit-0.1.0/tests/test_counter.py +138 -0
  75. redis_py_kit-0.1.0/tests/test_exceptions.py +95 -0
  76. redis_py_kit-0.1.0/tests/test_hooks.py +68 -0
  77. redis_py_kit-0.1.0/tests/test_lock.py +45 -0
  78. redis_py_kit-0.1.0/tests/test_observability.py +35 -0
  79. redis_py_kit-0.1.0/tests/test_queue_delay.py +37 -0
  80. redis_py_kit-0.1.0/tests/test_queue_reliable.py +50 -0
  81. redis_py_kit-0.1.0/tests/test_serializers.py +85 -0
  82. redis_py_kit-0.1.0/tests/test_session.py +79 -0
  83. redis_py_kit-0.1.0/uv.lock +504 -0
@@ -0,0 +1,15 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "WebSearch",
5
+ "Bash(gh api:*)",
6
+ "WebFetch(domain:github.com)",
7
+ "Bash(uv sync:*)",
8
+ "Bash(uv run:*)",
9
+ "Bash(echo \"EXIT: $?\")",
10
+ "Bash(uv build:*)",
11
+ "Bash(uv publish:*)",
12
+ "Bash(rm:*)"
13
+ ]
14
+ }
15
+ }
@@ -0,0 +1,2 @@
1
+ __pycache__/
2
+ *.pyc
@@ -0,0 +1,8 @@
1
+ # 默认忽略的文件
2
+ /shelf/
3
+ /workspace.xml
4
+ # 基于编辑器的 HTTP 客户端请求
5
+ /httpRequests/
6
+ # Datasource local storage ignored files
7
+ /dataSources/
8
+ /dataSources.local.xml
@@ -0,0 +1,15 @@
1
+ <component name="InspectionProjectProfileManager">
2
+ <profile version="1.0">
3
+ <option name="myName" value="Project Default" />
4
+ <inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
5
+ <inspection_tool class="PyArgumentListInspection" enabled="false" level="WARNING" enabled_by_default="false" />
6
+ <inspection_tool class="PyPep8Inspection" enabled="true" level="INFORMATION" enabled_by_default="true">
7
+ <option name="ignoredErrors">
8
+ <list>
9
+ <option value="E261" />
10
+ <option value="E305" />
11
+ </list>
12
+ </option>
13
+ </inspection_tool>
14
+ </profile>
15
+ </component>
@@ -0,0 +1,6 @@
1
+ <component name="InspectionProjectProfileManager">
2
+ <settings>
3
+ <option name="USE_PROJECT_PROFILE" value="false" />
4
+ <version value="1.0" />
5
+ </settings>
6
+ </component>
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="Black">
4
+ <option name="sdkName" value="uv (redis-kit)" />
5
+ </component>
6
+ <component name="ProjectRootManager" version="2" project-jdk-name="uv (redis-kit)" project-jdk-type="Python SDK" />
7
+ </project>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/redis-kit.iml" filepath="$PROJECT_DIR$/.idea/redis-kit.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="PYTHON_MODULE" version="4">
3
+ <component name="NewModuleRootManager">
4
+ <content url="file://$MODULE_DIR$" />
5
+ <orderEntry type="jdk" jdkName="uv (redis-kit)" jdkType="Python SDK" />
6
+ <orderEntry type="sourceFolder" forTests="false" />
7
+ </component>
8
+ </module>
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="" vcs="Git" />
5
+ <mapping directory="$PROJECT_DIR$" vcs="Git" />
6
+ </component>
7
+ </project>
@@ -0,0 +1,110 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="AutoImportSettings">
4
+ <option name="autoReloadType" value="SELECTIVE" />
5
+ </component>
6
+ <component name="ChangeListManager">
7
+ <list default="true" id="81639434-f817-470f-b142-34a6722ea336" name="更改" comment="CLAUDE.md">
8
+ <change beforePath="$PROJECT_DIR$/.claude/settings.local.json" beforeDir="false" afterPath="$PROJECT_DIR$/.claude/settings.local.json" afterDir="false" />
9
+ <change beforePath="$PROJECT_DIR$/README.md" beforeDir="false" afterPath="$PROJECT_DIR$/README.md" afterDir="false" />
10
+ <change beforePath="$PROJECT_DIR$/pyproject.toml" beforeDir="false" afterPath="$PROJECT_DIR$/pyproject.toml" afterDir="false" />
11
+ </list>
12
+ <option name="SHOW_DIALOG" value="false" />
13
+ <option name="HIGHLIGHT_CONFLICTS" value="true" />
14
+ <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
15
+ <option name="LAST_RESOLUTION" value="IGNORE" />
16
+ </component>
17
+ <component name="Git.Settings">
18
+ <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
19
+ </component>
20
+ <component name="GitHubPullRequestSearchHistory">{
21
+ &quot;lastFilter&quot;: {
22
+ &quot;state&quot;: &quot;OPEN&quot;,
23
+ &quot;assignee&quot;: &quot;Xinzz995&quot;
24
+ }
25
+ }</component>
26
+ <component name="GithubPullRequestsUISettings">{
27
+ &quot;selectedUrlAndAccountId&quot;: {
28
+ &quot;url&quot;: &quot;https://github.com/Xinzz995/redis-kit.git&quot;,
29
+ &quot;accountId&quot;: &quot;f4cd84d6-287e-48c1-87f5-6633a431a863&quot;
30
+ }
31
+ }</component>
32
+ <component name="ProjectColorInfo">{
33
+ &quot;associatedIndex&quot;: 3
34
+ }</component>
35
+ <component name="ProjectId" id="3BvhcXlhhhysSQzokYYCIyPNP34" />
36
+ <component name="ProjectViewState">
37
+ <option name="hideEmptyMiddlePackages" value="true" />
38
+ <option name="showLibraryContents" value="true" />
39
+ </component>
40
+ <component name="PropertiesComponent"><![CDATA[{
41
+ "keyToString": {
42
+ "ModuleVcsDetector.initialDetectionPerformed": "true",
43
+ "RunOnceActivity.ShowReadmeOnStart": "true",
44
+ "RunOnceActivity.git.unshallow": "true",
45
+ "git-widget-placeholder": "main",
46
+ "last_opened_file_path": "E:/_coding/github/Xinzz995/redis-kit",
47
+ "node.js.detected.package.eslint": "true",
48
+ "node.js.detected.package.tslint": "true",
49
+ "node.js.selected.package.eslint": "(autodetect)",
50
+ "node.js.selected.package.tslint": "(autodetect)",
51
+ "nodejs_package_manager_path": "npm",
52
+ "vue.rearranger.settings.migration": "true"
53
+ }
54
+ }]]></component>
55
+ <component name="RecentsManager">
56
+ <key name="CopyFile.RECENT_KEYS">
57
+ <recent name="E:\_coding\github\Xinzz995\redis-kit" />
58
+ <recent name="E:\_coding\github\Xinzz995\redis-kit\old" />
59
+ </key>
60
+ </component>
61
+ <component name="SharedIndexes">
62
+ <attachedChunks>
63
+ <set>
64
+ <option value="bundled-js-predefined-d6986cc7102b-6a121458b545-JavaScript-PY-251.25410.159" />
65
+ <option value="bundled-python-sdk-e0ed3721d81e-36ea0e71a18c-com.jetbrains.pycharm.pro.sharedIndexes.bundled-PY-251.25410.159" />
66
+ </set>
67
+ </attachedChunks>
68
+ </component>
69
+ <component name="TaskManager">
70
+ <task active="true" id="Default" summary="默认任务">
71
+ <changelist id="81639434-f817-470f-b142-34a6722ea336" name="更改" comment="" />
72
+ <created>1775375531680</created>
73
+ <option name="number" value="Default" />
74
+ <option name="presentableId" value="Default" />
75
+ <updated>1775375531680</updated>
76
+ <workItem from="1775375532737" duration="17756000" />
77
+ <workItem from="1775456942507" duration="24947000" />
78
+ <workItem from="1775622266896" duration="6666000" />
79
+ <workItem from="1775720601229" duration="12473000" />
80
+ </task>
81
+ <task id="LOCAL-00001" summary="CLAUDE.md">
82
+ <option name="closed" value="true" />
83
+ <created>1775741864037</created>
84
+ <option name="number" value="00001" />
85
+ <option name="presentableId" value="LOCAL-00001" />
86
+ <option name="project" value="LOCAL" />
87
+ <updated>1775741864037</updated>
88
+ </task>
89
+ <option name="localTasksCounter" value="2" />
90
+ <servers />
91
+ </component>
92
+ <component name="TypeScriptGeneratedFilesManager">
93
+ <option name="version" value="3" />
94
+ </component>
95
+ <component name="Vcs.Log.Tabs.Properties">
96
+ <option name="TAB_STATES">
97
+ <map>
98
+ <entry key="MAIN">
99
+ <value>
100
+ <State />
101
+ </value>
102
+ </entry>
103
+ </map>
104
+ </option>
105
+ </component>
106
+ <component name="VcsManagerConfiguration">
107
+ <MESSAGE value="CLAUDE.md" />
108
+ <option name="LAST_COMMIT_MESSAGE" value="CLAUDE.md" />
109
+ </component>
110
+ </project>
@@ -0,0 +1 @@
1
+ 3.11
@@ -0,0 +1,220 @@
1
+ # CLAUDE.md
2
+
3
+ 你的目标不是"给出一个看起来合理的答案",而是基于当前代码库和真实上下文,安全、准确地完成任务。
4
+
5
+ ---
6
+
7
+ ## 项目简介
8
+
9
+ - 项目名称: redis-kit
10
+ - 项目类型: 工具库
11
+ - Python 版本: 3.11+
12
+ - 包管理: uv
13
+ - 主要技术栈: redis-py >= 7.4.0
14
+ - 目标:redis-kit 是一个企业级 Python Redis 工具库,提供缓存、分布式锁、消息队列、布隆过滤器、计数器/ID 生成器和 Session 管理,支持同步/异步双模 API。
15
+
16
+ ---
17
+
18
+ ## 三方协同
19
+
20
+ ### 职责归属
21
+
22
+ | 职责 | 归属 | 说明 |
23
+ |------|------|------|
24
+ | 工作流执行 | **Superpowers** | brainstorm → plan → implement → review → debug → subagent 的全流程方法论 |
25
+ | 状态持久化 | **planning-with-files** | `docs/planning-with-files/` 下 task_plan.md / findings.md / progress.md 的生命周期管理 |
26
+ | 项目约束与经验 | **本文件** | 硬约束、编码规范、质量验收标准、`docs/lessons.md` 经验循环 |
27
+
28
+ ### 协同规则
29
+
30
+ 1. **Superpowers 负责"怎么做",本文件负责"什么不能做"和"必须满足什么"**
31
+ 2. planning-with-files 只负责将 Superpowers 产出的计划和发现落盘到三文件,不另起规划流程
32
+ 3. 如果 Superpowers brainstorm 已产出设计文档,task_plan.md 引用即可,不复制内容
33
+ 4. **冲突时本文件的约束优先级最高**,插件方法论必须在这些约束内执行
34
+
35
+ ### 已由插件覆盖的能力(本文件不再定义其方法论)
36
+
37
+ - 规划流程(brainstorm / plan)→ Superpowers
38
+ - TDD 循环(Red → Green → Refactor)→ Superpowers
39
+ - Code Review 方法论(逐文件 diff、自我挑战)→ Superpowers
40
+ - Debug 方法论(收集症状 → 形成假设 → 验证 → 定位根因)→ Superpowers
41
+ - Subagent 委派策略 → Superpowers
42
+ - 任务计划与进度追踪 → planning-with-files
43
+ - 跨 session 状态恢复 → planning-with-files
44
+
45
+
46
+ ## Session 启动协议
47
+
48
+ 每次新 session 按以下顺序执行,缺一不可:
49
+
50
+ ```text
51
+ 1. 读取本文件 (CLAUDE.md) → 加载项目约束
52
+ 2. 读取 docs/lessons.md → 加载历史经验和踩坑记录
53
+ 3. 读取 planning-with-files 三文件 → 恢复任务上下文
54
+ ├── progress.md → 上次做到哪了
55
+ ├── task_plan.md → 哪些步骤未完成
56
+ └── findings.md → 有无待处理的发现
57
+ 4. 综合判断:
58
+ ├─ 有未完成任务 → 向用户汇报断点,等待确认后再继续
59
+ └─ 无未完成任务 → 等待新指令
60
+ ```
61
+ 汇报格式示例:
62
+
63
+ "上次在做 [任务名],完成到 Step [N]/[总数]。findings.md 中记录了 [Y] 需要注意。是否继续?"
64
+
65
+ **绝对不要跳过恢复流程直接开始工作。**
66
+
67
+ ---
68
+
69
+ ## 硬约束(红线)
70
+
71
+ 以下为不可违反的绝对规则。所有工作流阶段、所有插件的执行都必须在这些约束内进行。
72
+
73
+ | # | 约束 | 说明 |
74
+ | --- | --- | --- |
75
+ | 1 | 先读后改 | 修改任何文件前,必须先读取该文件及其调用链上下游;上下文不足时提问,不猜测 |
76
+ | 2 | 先证据后结论 | 所有结论必须基于代码、日志、测试结果或运行输出;不基于假设、推测或二手结论 |
77
+ | 3 | 先验证后宣称 | 未经实际验证的结果,不得标记为"已完成"或"可正常工作";无法验证时必须标注"未验证"及原因 |
78
+ | 4 | 最小改动 | 只做解决当前问题所必需的改动;不改无关代码,不预埋未来需求,不顺手重构 |
79
+ | 5 | 不捏造 | 禁止编造代码、文件路径、日志、报错、测试结果、运行输出或需求 |
80
+ | 6 | 不擅自扩大范围 | 不增加未要求的功能,不引入未批准的依赖,不修改不相关的公开接口 |
81
+ | 7 | 不裸 except | 禁止裸 except,必须显式捕获具体异常类型 |
82
+ | 8 | 坦诚沟通 | 不知道就说不知道,没做完就说没做完,不要为了看起来体面而模糊事实 |
83
+
84
+ ---
85
+
86
+ ## 工程原则
87
+
88
+ - 硬约束之外的指导方向,在实际场景中权衡运用:
89
+
90
+ - 遵循现有风格:项目已有的结构、命名、分层、依赖选择、测试模式,优先保持一致而非引入"更好"的模式
91
+
92
+ - 简单优先,必要时优雅:默认选最简单的正确方案;仅当简单方案存在明显的可维护性问题时,才考虑更精巧的实现。判断标准:如果优雅方案的复杂度显著高于简单方案且收益不明确,选简单的
93
+ - 只解释"为什么":注释说明意图和决策理由,不描述代码字面行为;逻辑自解释时不写注释
94
+ - 主动修复:发现 bug、测试失败、CI 报错时直接定位修复,不等待手把手指导;修复中产生的发现写入 findings.md
95
+ - 影响面先行:任何可能影响接口、缓存结构、异步行为、配置兼容性的改动,先说明影响面再动手
96
+ - 不删除未确认的代码:不删除注释、测试、配置或兼容逻辑,除非确认已无用并明确说明原因
97
+
98
+ ---
99
+
100
+ ## 编码规范
101
+
102
+ ### 类型与文档
103
+ - 使用类型注解;公共函数/方法必须标注入参与返回值类型
104
+
105
+ - 新增公共 API、核心函数、复杂数据结构时,补充 docstring
106
+ - 优先小函数、单一职责;避免超长函数
107
+
108
+ ### 安全与精度
109
+
110
+ - 字符串、时间、时区、金额、精度相关逻辑必须显式处理,禁止依赖隐式行为
111
+
112
+ - 异常处理必须具体到异常类型(见硬约束 #7)
113
+
114
+ ### 命名规范
115
+
116
+ | 类别 | 规则 | 示例 |
117
+ | --- | --- | --- |
118
+ | Python 文件 | 下划线分隔,全小写 | bloom_filter.py、async_cache_service.py |
119
+ | 文件夹 | kebab-case,全小写,最多 4 层深度 | redis-kit/、docs/planning-with-files/ |
120
+ | 类型后缀(可选) | 按职责添加 | .service、.utils、.config、.types、.test |
121
+ | 单文件场景 | 直接放父目录,不单独建文件夹 | — |
122
+
123
+ ### 依赖管理
124
+
125
+ 非必要不引入新依赖
126
+ 如需引入,先向用户说明三点:引入收益 / 维护代价 / 替代方案
127
+ 等用户确认后再引入
128
+
129
+ ---
130
+
131
+ ## 测试要求
132
+
133
+ - 任何非纯文档修改,都必须考虑测试影响
134
+
135
+ - 修改业务逻辑时:先找已有测试 → 能复用就复用 → 无覆盖时补最小必要测试
136
+ - 修 bug 时:先补能复现问题的测试,再修复(与 Superpowers TDD Red 阶段一致)
137
+ - 无法本地运行测试时,必须明确说明原因并给出替代验证方法
138
+ - 每次 implement 步骤完成后运行完整测试套件,确认无回归
139
+
140
+ ---
141
+
142
+ ## 质量验收标准
143
+
144
+ superpowers review 阶段完成后,额外执行以下项目级检查。任何一项为"否",不得标记任务完成:
145
+
146
+ | # | 检查项 |
147
+ | --- | --- |
148
+ | 1 | 资深工程师会批准这个实现吗? |
149
+ | 2 | 所有测试通过?日志无异常输出? |
150
+ | 3 | 与主分支的 diff 只包含必要改动?无多余变更? |
151
+ | 4 | planning-with-files 三文件(task_plan.md / findings.md / progress.md)已更新到最新状态? |
152
+ | 5 | 本次任务产生的经验教训已写入 docs/lessons.md?(如无则跳过) |
153
+
154
+ ---
155
+
156
+ ## 自我改进循环
157
+
158
+ 此职责为本文件独有,两个插件均不覆盖。
159
+
160
+ ### 触发条件
161
+ - 用户做出任何纠正
162
+
163
+ - 发现自己犯了本可避免的错误
164
+ - 任务收尾时 findings.md 中有长期价值的条目
165
+
166
+ ### 执行动作
167
+
168
+ 立即写入 docs/lessons.md:
169
+
170
+ ```markdown
171
+ ## [YYYY-MM-DD] 场景简述
172
+ - **错误做法**:xxx
173
+ - **正确做法**:xxx
174
+ - **防止规则**:xxx
175
+ ```
176
+
177
+
178
+
179
+ ### findings.md 与 lessons.md 的边界
180
+
181
+ | 内容类型 | 写入位置 | 生命周期 |
182
+ | --- | --- | --- |
183
+ | 任务执行中发现的技术事实(bug 根因、环境差异、配置问题等) | docs/planning-with-files/findings.md | 任务级,完成后归档 |
184
+ | 被用户纠正的行为模式、跨任务可复用的经验教训 | docs/lessons.md | 永久,跨任务跨 session 生效 |
185
+ | findings 中具有长期价值的条目 | 任务收尾时迁移到 docs/lessons.md | 迁移后在 findings 中标注"已迁移" |
186
+
187
+ ### 持续迭代
188
+ - 每次新 session 必须读取 docs/lessons.md(见 Session 启动协议第 2 步)
189
+
190
+ - 持续积累,直到同类错误不再重复出现
191
+
192
+ ---
193
+
194
+ ## 常用命令
195
+
196
+ ```bash
197
+ # 依赖管理
198
+ uv sync # 安装/同步依赖
199
+
200
+ # 运行
201
+ uv run python main.py # 运行入口
202
+
203
+ # 测试
204
+ uv run pytest # 全量测试
205
+ uv run pytest -x -k "test_name" # 单个测试(失败即停)
206
+ uv run pytest tests/path/to/test_file.py -q # 指定文件测试
207
+ uv run pytest -k "keyword" # 按关键字过滤测试
208
+
209
+ # 代码质量
210
+ ruff check . # Lint 检查
211
+ ruff format . # 代码格式化
212
+ mypy app tests # 类型检查
213
+ ```
214
+
215
+ 如项目存在 Makefile / justfile / tox.ini / noxfile.py,优先使用项目定义的入口命令。
216
+
217
+ ---
218
+
219
+ ## 交流语言
220
+ 默认使用中文交流。
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Xinzz
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.