pdd-skills 3.0.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/README.md +1478 -0
- package/bin/pdd.js +354 -0
- package/config/bpmn-rules.yaml +166 -0
- package/config/checkstyle.xml +105 -0
- package/config/eslint.config.js +48 -0
- package/config/pmd.xml +91 -0
- package/config/prd-rules.yaml +113 -0
- package/config/ruff.toml +45 -0
- package/config/sqlfluff.cfg +82 -0
- package/hooks/hook-executor.js +332 -0
- package/index.js +43 -0
- package/lib/api-routes.js +750 -0
- package/lib/api-server.js +408 -0
- package/lib/cache/cache-config.js +209 -0
- package/lib/cache/system-cache.js +852 -0
- package/lib/config-manager.js +373 -0
- package/lib/generate.js +528 -0
- package/lib/grpc/grpc-routes.js +1134 -0
- package/lib/grpc/grpc-server.js +912 -0
- package/lib/grpc/proto-definitions.js +1033 -0
- package/lib/init.js +172 -0
- package/lib/iteration/auto-fixer.js +1025 -0
- package/lib/iteration/auto-reviewer.js +923 -0
- package/lib/iteration/controller.js +577 -0
- package/lib/list.js +130 -0
- package/lib/mcp-server.js +548 -0
- package/lib/openclaw/api-integration.js +535 -0
- package/lib/openclaw/cli-integration.js +567 -0
- package/lib/openclaw/data-sync.js +845 -0
- package/lib/openclaw/openclaw-adapter.js +783 -0
- package/lib/plugin/example-plugins/code-stats/index.js +332 -0
- package/lib/plugin/example-plugins/code-stats/plugin.json +1 -0
- package/lib/plugin/example-plugins/custom-linter/index.js +472 -0
- package/lib/plugin/example-plugins/custom-linter/plugin.json +1 -0
- package/lib/plugin/example-plugins/hello-world/index.js +86 -0
- package/lib/plugin/example-plugins/hello-world/plugin.json +1 -0
- package/lib/plugin/plugin-manager.js +655 -0
- package/lib/plugin/plugin-sdk.js +565 -0
- package/lib/plugin/sandbox.js +627 -0
- package/lib/quality/rules/maintainability.js +418 -0
- package/lib/quality/rules/performance.js +498 -0
- package/lib/quality/rules/readability.js +441 -0
- package/lib/quality/rules/robustness.js +504 -0
- package/lib/quality/rules/security.js +444 -0
- package/lib/quality/scorer.js +576 -0
- package/lib/report.js +669 -0
- package/lib/sdk-base.js +301 -0
- package/lib/sdk-js.js +446 -0
- package/lib/sdk-python/README.md +546 -0
- package/lib/sdk-python/examples/basic_usage.py +450 -0
- package/lib/sdk-python/pdd_sdk/__init__.py +180 -0
- package/lib/sdk-python/pdd_sdk/client.py +1170 -0
- package/lib/sdk-python/pdd_sdk/events.py +423 -0
- package/lib/sdk-python/pdd_sdk/exceptions.py +158 -0
- package/lib/sdk-python/pdd_sdk/models.py +518 -0
- package/lib/sdk-python/pdd_sdk/utils.py +759 -0
- package/lib/token/budget-alert.js +367 -0
- package/lib/token/budget-manager.js +485 -0
- package/lib/update.js +54 -0
- package/lib/utils/logger.js +88 -0
- package/lib/verify.js +741 -0
- package/lib/version.js +52 -0
- package/lib/vm/README.md +102 -0
- package/lib/vm/dashboard/api-routes.js +669 -0
- package/lib/vm/dashboard/server.js +391 -0
- package/lib/vm/dashboard/sse.js +358 -0
- package/lib/vm/dashboard/static/css/dashboard.css +1378 -0
- package/lib/vm/dashboard/static/index.html +118 -0
- package/lib/vm/dashboard/static/js/app.js +949 -0
- package/lib/vm/dashboard/static/js/charts.js +913 -0
- package/lib/vm/dashboard/static/js/kanban-view.js +1053 -0
- package/lib/vm/dashboard/static/js/pipeline-view.js +463 -0
- package/lib/vm/dashboard/static/js/quality-view.js +598 -0
- package/lib/vm/dashboard/static/js/system-view.js +1021 -0
- package/lib/vm/data-provider.js +1191 -0
- package/lib/vm/event-bus.js +402 -0
- package/lib/vm/hooks/extract-hook.js +307 -0
- package/lib/vm/hooks/generate-hook.js +374 -0
- package/lib/vm/hooks/hook-interface.js +458 -0
- package/lib/vm/hooks/report-hook.js +331 -0
- package/lib/vm/hooks/verify-hook.js +454 -0
- package/lib/vm/models.js +1003 -0
- package/lib/vm/reconciler.js +855 -0
- package/lib/vm/scanner.js +988 -0
- package/lib/vm/state-schema.js +955 -0
- package/lib/vm/state-store.js +733 -0
- package/lib/vm/tui/components/card.js +339 -0
- package/lib/vm/tui/components/progress-bar.js +368 -0
- package/lib/vm/tui/components/sparkline.js +327 -0
- package/lib/vm/tui/components/status-light.js +294 -0
- package/lib/vm/tui/components/table.js +370 -0
- package/lib/vm/tui/input.js +335 -0
- package/lib/vm/tui/renderer.js +548 -0
- package/lib/vm/tui/screens/kanban-screen.js +397 -0
- package/lib/vm/tui/screens/overview-screen.js +357 -0
- package/lib/vm/tui/screens/quality-screen.js +336 -0
- package/lib/vm/tui/screens/system-screen.js +379 -0
- package/lib/vm/tui/tui.js +805 -0
- package/package.json +1 -0
- package/scripts/cso-analyzer.js +198 -0
- package/scripts/eval-runner.js +359 -0
- package/scripts/i18n-checker.js +109 -0
- package/scripts/linter/activiti-linter.js +272 -0
- package/scripts/linter/prd-linter.js +162 -0
- package/scripts/linter/report-generator.js +207 -0
- package/scripts/linter/run-linters.js +285 -0
- package/scripts/linter/sql-linter.js +166 -0
- package/scripts/token-analyzer.js +162 -0
- package/scripts/vm-test.js +180 -0
- package/skills/core/official-doc-writer/LICENSE +21 -0
- package/skills/core/official-doc-writer/README.md +232 -0
- package/skills/core/official-doc-writer/SKILL.md +475 -0
- package/skills/core/official-doc-writer/_meta.json +1 -0
- package/skills/core/official-doc-writer/document_generator.py +580 -0
- package/skills/core/official-doc-writer/evals/default-evals.json +1 -0
- package/skills/core/official-doc-writer/examples.md +150 -0
- package/skills/core/official-doc-writer/fonts/FONTS_LIST.md +45 -0
- package/skills/core/official-doc-writer/fonts/README.md +141 -0
- package/skills/core/official-doc-writer/fonts/SIMFANG.TTF +0 -0
- package/skills/core/official-doc-writer/fonts/SIMHEI.TTF +0 -0
- package/skills/core/official-doc-writer/fonts/SIMKAI.TTF +0 -0
- package/skills/core/official-doc-writer/fonts/SIMSUN.TTC +0 -0
- package/skills/core/official-doc-writer/fonts//346/226/271/346/255/243/345/260/217/346/240/207/345/256/213GBK.TTF +0 -0
- package/skills/core/official-doc-writer/references/GBT_9704-2012_/345/205/232/346/224/277/346/234/272/345/205/263/345/205/254/346/226/207/346/240/274/345/274/217.md +422 -0
- package/skills/core/official-doc-writer/scripts/__pycache__/generate_official_doc.cpython-313.pyc +0 -0
- package/skills/core/official-doc-writer/scripts/dialog_manager.py +564 -0
- package/skills/core/official-doc-writer/scripts/generate_official_doc.py +252 -0
- package/skills/core/official-doc-writer/scripts/install_fonts.py +390 -0
- package/skills/core/official-doc-writer/scripts/smart_prompts.py +363 -0
- package/skills/core/pdd-ba/SKILL.md +305 -0
- package/skills/core/pdd-ba/_meta.json +1 -0
- package/skills/core/pdd-ba/evals/default-evals.json +1 -0
- package/skills/core/pdd-code-reviewer/SKILL.md +378 -0
- package/skills/core/pdd-code-reviewer/_meta.json +1 -0
- package/skills/core/pdd-code-reviewer/evals/default-evals.json +1 -0
- package/skills/core/pdd-doc-change/SKILL.md +350 -0
- package/skills/core/pdd-doc-change/_meta.json +1 -0
- package/skills/core/pdd-doc-change/evals/default-evals.json +1 -0
- package/skills/core/pdd-doc-gardener/SKILL.md +248 -0
- package/skills/core/pdd-doc-gardener/_meta.json +1 -0
- package/skills/core/pdd-doc-gardener/evals/default-evals.json +1 -0
- package/skills/core/pdd-entropy-reduction/SKILL.md +360 -0
- package/skills/core/pdd-entropy-reduction/_meta.json +1 -0
- package/skills/core/pdd-entropy-reduction/evals/default-evals.json +1 -0
- package/skills/core/pdd-entropy-reduction/references/entropy-report-template.md +287 -0
- package/skills/core/pdd-entropy-reduction/references/golden-principles.md +573 -0
- package/skills/core/pdd-entropy-reduction/scripts/entropy_scan.py +712 -0
- package/skills/core/pdd-extract-features/SKILL.md +320 -0
- package/skills/core/pdd-extract-features/_meta.json +1 -0
- package/skills/core/pdd-extract-features/evals/default-evals.json +1 -0
- package/skills/core/pdd-generate-spec/SKILL.md +418 -0
- package/skills/core/pdd-generate-spec/_meta.json +1 -0
- package/skills/core/pdd-generate-spec/evals/default-evals.json +1 -0
- package/skills/core/pdd-implement-feature/SKILL.md +332 -0
- package/skills/core/pdd-implement-feature/_meta.json +1 -0
- package/skills/core/pdd-implement-feature/evals/default-evals.json +1 -0
- package/skills/core/pdd-main/SKILL.md +540 -0
- package/skills/core/pdd-main/_meta.json +1 -0
- package/skills/core/pdd-main/evals/default-evals.json +1 -0
- package/skills/core/pdd-main/evals/evals.json +215 -0
- package/skills/core/pdd-verify-feature/SKILL.md +474 -0
- package/skills/core/pdd-verify-feature/_meta.json +1 -0
- package/skills/core/pdd-verify-feature/evals/default-evals.json +1 -0
- package/skills/core/pdd-vm/evals/default-evals.json +1 -0
- package/skills/core/traffic-accident-assessor/LICENSE +29 -0
- package/skills/core/traffic-accident-assessor/SKILL.md +439 -0
- package/skills/core/traffic-accident-assessor/evals/evals.json +1 -0
- package/skills/core/traffic-accident-assessor/references/accident-types.md +369 -0
- package/skills/core/traffic-accident-assessor/references/liability-rules.md +287 -0
- package/skills/core/traffic-accident-assessor/references/traffic-laws.md +226 -0
- package/skills/core/traffic-accident-assessor/references//351/253/230/345/260/224/345/244/253/350/257/264/346/230/216/344/271/246.pdf +32576 -106
- package/skills/core/traffic-accident-assessor/scripts/generate_official_statement.py +588 -0
- package/skills/core/traffic-accident-assessor/scripts/generate_report.py +495 -0
- package/skills/core/traffic-accident-assessor/scripts/generate_statement.py +528 -0
- package/skills/core/traffic-accident-assessor.zip +0 -0
- package/skills/entropy/expert-arch-enforcer/SKILL.md +292 -0
- package/skills/entropy/expert-arch-enforcer/_meta.json +1 -0
- package/skills/entropy/expert-arch-enforcer/evals/default-evals.json +1 -0
- package/skills/entropy/expert-auto-refactor/SKILL.md +327 -0
- package/skills/entropy/expert-auto-refactor/_meta.json +1 -0
- package/skills/entropy/expert-auto-refactor/evals/default-evals.json +1 -0
- package/skills/entropy/expert-code-quality/SKILL.md +468 -0
- package/skills/entropy/expert-code-quality/_meta.json +1 -0
- package/skills/entropy/expert-code-quality/evals/default-evals.json +1 -0
- package/skills/entropy/expert-code-quality/evals/evals.json +109 -0
- package/skills/entropy/expert-code-quality/references/code-smells.md +605 -0
- package/skills/entropy/expert-code-quality/references/design-patterns.md +1111 -0
- package/skills/entropy/expert-code-quality/references/refactoring-catalog.md +1281 -0
- package/skills/entropy/expert-code-quality/references/solid-principles.md +524 -0
- package/skills/entropy/expert-entropy-auditor/SKILL.md +276 -0
- package/skills/entropy/expert-entropy-auditor/_meta.json +1 -0
- package/skills/entropy/expert-entropy-auditor/evals/default-evals.json +1 -0
- package/skills/expert/expert-activiti/SKILL.md +497 -0
- package/skills/expert/expert-activiti/_meta.json +1 -0
- package/skills/expert/expert-mysql/SKILL.md +832 -0
- package/skills/expert/expert-mysql/_meta.json +1 -0
- package/skills/expert/expert-performance/SKILL.md +379 -0
- package/skills/expert/expert-performance/_meta.json +1 -0
- package/skills/expert/expert-performance/evals/default-evals.json +1 -0
- package/skills/expert/expert-ruoyi/SKILL.md +472 -0
- package/skills/expert/expert-ruoyi/_meta.json +1 -0
- package/skills/expert/expert-security/SKILL.md +1341 -0
- package/skills/expert/expert-security/_meta.json +1 -0
- package/skills/expert/expert-security/evals/default-evals.json +1 -0
- package/skills/expert/software-architect/SKILL.md +350 -0
- package/skills/expert/software-architect/_meta.json +1 -0
- package/skills/expert/software-engineer/SKILL.md +437 -0
- package/skills/expert/software-engineer/_meta.json +1 -0
- package/skills/expert/software-engineer/architecture.md +130 -0
- package/skills/expert/software-engineer/patterns.md +151 -0
- package/skills/expert/software-engineer/testing.md +135 -0
- package/skills/expert/system-architect/SKILL.md +628 -0
- package/skills/expert/system-architect/_meta.json +1 -0
- package/skills/expert/system-architect/assets/templates/ARCHITECTURE.md +25 -0
- package/skills/expert/system-architect/assets/templates/README.md +44 -0
- package/skills/expert/system-architect/references/js-ts-standards.md +18 -0
- package/skills/expert/system-architect/references/python-standards.md +19 -0
- package/skills/expert/system-architect/references/scaffolding.md +61 -0
- package/skills/expert/system-architect/references/security-checklist.md +21 -0
- package/skills/openspec/openspec-apply-change/SKILL.md +156 -0
- package/skills/openspec/openspec-apply-change/_meta.json +1 -0
- package/skills/openspec/openspec-archive-change/SKILL.md +114 -0
- package/skills/openspec/openspec-archive-change/_meta.json +1 -0
- package/skills/openspec/openspec-bulk-archive-change/SKILL.md +246 -0
- package/skills/openspec/openspec-bulk-archive-change/_meta.json +1 -0
- package/skills/openspec/openspec-continue-change/SKILL.md +118 -0
- package/skills/openspec/openspec-continue-change/_meta.json +1 -0
- package/skills/openspec/openspec-explore/SKILL.md +288 -0
- package/skills/openspec/openspec-explore/_meta.json +1 -0
- package/skills/openspec/openspec-ff-change/SKILL.md +101 -0
- package/skills/openspec/openspec-ff-change/_meta.json +1 -0
- package/skills/openspec/openspec-new-change/SKILL.md +74 -0
- package/skills/openspec/openspec-new-change/_meta.json +1 -0
- package/skills/openspec/openspec-onboard/SKILL.md +554 -0
- package/skills/openspec/openspec-onboard/_meta.json +1 -0
- package/skills/openspec/openspec-sync-specs/SKILL.md +138 -0
- package/skills/openspec/openspec-sync-specs/_meta.json +1 -0
- package/skills/openspec/openspec-verify-change/SKILL.md +168 -0
- package/skills/openspec/openspec-verify-change/_meta.json +1 -0
- package/skills/pr/pdd-multi-review/SKILL.md +534 -0
- package/skills/pr/pdd-multi-review/_meta.json +1 -0
- package/skills/pr/pdd-pr-batch/SKILL.md +303 -0
- package/skills/pr/pdd-pr-batch/_meta.json +1 -0
- package/skills/pr/pdd-pr-create/SKILL.md +344 -0
- package/skills/pr/pdd-pr-create/_meta.json +1 -0
- package/skills/pr/pdd-pr-merge/SKILL.md +286 -0
- package/skills/pr/pdd-pr-merge/_meta.json +1 -0
- package/skills/pr/pdd-pr-review/SKILL.md +217 -0
- package/skills/pr/pdd-pr-review/_meta.json +1 -0
- package/skills/pr/pdd-task-manager/SKILL.md +636 -0
- package/skills/pr/pdd-task-manager/_meta.json +1 -0
- package/skills/pr/pdd-template-engine/SKILL.md +306 -0
- package/skills/pr/pdd-template-engine/_meta.json +1 -0
- package/templates/behavior-shaping/iron-law-template.md +87 -0
- package/templates/behavior-shaping/rationalization-template.md +62 -0
- package/templates/behavior-shaping/red-flags-template.md +70 -0
- package/templates/bilingual-template.md +139 -0
- package/templates/config/default.yaml +47 -0
- package/templates/project/default/README.md +31 -0
- package/templates/project/frontend/README.md +46 -0
- package/templates/project/java/README.md +48 -0
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pdd-entropy-reduction
|
|
3
|
+
description: PDD Entropy Reduction Agent monitoring technical debt and preventing system decay. Invoke for code cleanup, documentation updates, debt management, or garbage collection. 支持中文触发:熵减、技术债务、代码清理。
|
|
4
|
+
license: MIT
|
|
5
|
+
metadata:
|
|
6
|
+
author: neuqik@hotmail.com
|
|
7
|
+
version: "2.0"
|
|
8
|
+
parent: pdd-main
|
|
9
|
+
triggers:
|
|
10
|
+
- "熵减" | "清理技术债务" | "代码清理"
|
|
11
|
+
- "文档更新" | "技术债务管理" | "架构对齐"
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# PDD Entropy Reduction Agent - 熵减智能体 / Entropy Reduction Agent for Continuous System Hygiene
|
|
15
|
+
|
|
16
|
+
## 核心理念 / Core Philosophy
|
|
17
|
+
|
|
18
|
+
### 🇨🇳 核心理念
|
|
19
|
+
|
|
20
|
+
> "Technical debt is like a high-interest loan: it's better to continuously repay the debt in small amounts than to let it accumulate and then painfully resolve it all at once." —— OpenAI Harness Engineering
|
|
21
|
+
|
|
22
|
+
**目标**: 通过定期运行智能体来发现文档不一致或违反架构约束的情况,**对抗系统的熵增与衰减**。
|
|
23
|
+
|
|
24
|
+
### 熵增自然趋势 vs 熵减干预
|
|
25
|
+
|
|
26
|
+
| 熵增表现(自然趋势) | 熵减对策(需要能量输入) |
|
|
27
|
+
|------------------|---------------------|
|
|
28
|
+
| 代码腐化(重复代码/过长函数/命名不一致) | 重构(消除重复/简化复杂度) |
|
|
29
|
+
| 文档过时(代码与文档不同步/注释过时) | 文档更新(同步文档与代码) |
|
|
30
|
+
| 技术债务累积(未处理的TODO/临时方案) | 债务偿还(处理TODO/优化临时方案) |
|
|
31
|
+
| 架构漂移(违反依赖方向/边界模糊) | 架构对齐(修复违规/加强边界) |
|
|
32
|
+
| 测试不足(覆盖率下降/测试过时) | 测试补充(增加覆盖率/更新测试) |
|
|
33
|
+
|
|
34
|
+
### 🇺🇸 Core Philosophy
|
|
35
|
+
|
|
36
|
+
> "Technical debt is like a high-interest loan: it's better to continuously repay the debt in small amounts than to let it accumulate and then painfully resolve it all at once." —— OpenAI Harness Engineering
|
|
37
|
+
|
|
38
|
+
**Goal**: Proactively detect documentation inconsistencies and architecture violations through scheduled agent runs, **combating system entropy and decay**.
|
|
39
|
+
|
|
40
|
+
#### Natural Entropy Growth vs. Entropy Reduction Intervention
|
|
41
|
+
|
|
42
|
+
| Entropy Manifestation (Natural Trend) | Countermeasure (Requires Energy Input) |
|
|
43
|
+
|--------------------------------------|---------------------------------------|
|
|
44
|
+
| Code rot (duplicate code / long functions / naming inconsistencies) | Refactoring (eliminate duplication / simplify complexity) |
|
|
45
|
+
| Stale documentation (code-doc drift / outdated comments) | Documentation updates (sync docs with code) |
|
|
46
|
+
| Technical debt accumulation (unhandled TODOs / workarounds) | Debt repayment (address TODOs / optimize workarounds) |
|
|
47
|
+
| Architecture drift (dependency direction violations / blurred boundaries) | Architecture alignment (fix violations / strengthen boundaries) |
|
|
48
|
+
| Insufficient testing (declining coverage / stale tests) | Test supplementation (increase coverage / update tests) |
|
|
49
|
+
|
|
50
|
+
## 四大专业子技能 / Four Professional Sub-Skills
|
|
51
|
+
|
|
52
|
+
### 🇨🇳 四大专业子技能
|
|
53
|
+
|
|
54
|
+
协调器(pdd-entropy-reduction)负责调度和聚合结果,不直接执行具体操作:
|
|
55
|
+
|
|
56
|
+
| 子技能 | 职责 | 检测项 | 行动 |
|
|
57
|
+
|--------|------|--------|------|
|
|
58
|
+
| **pdd-doc-gardener** | 文档园丁 | 代码与文档不一致/注释过时/API文档不匹配 | 自动创建修复PR |
|
|
59
|
+
| **expert-arch-enforcer** | 架构约束强制 | 模块依赖方向违规/边界数据缺失/文件过大/命名违规 | 运行自定义Linter检测偏差 |
|
|
60
|
+
| **expert-entropy-auditor** | 熵增审计 | PRD与代码不一致/规格与代码不一致/AI残渣/分散工具类 | 归集到共享工具包 |
|
|
61
|
+
| **expert-auto-refactor** | 自动化重构 | 重复代码/复杂逻辑/命名优化 | 定期发起针对性重构PR |
|
|
62
|
+
|
|
63
|
+
### 🇺🇸 Four Professional Sub-Skills
|
|
64
|
+
|
|
65
|
+
The coordinator (pdd-entropy-reduction) is responsible for scheduling and aggregating results; it does not directly execute specific operations:
|
|
66
|
+
|
|
67
|
+
| Sub-Skill | Responsibility | Detection Items | Action |
|
|
68
|
+
|-----------|---------------|-----------------|--------|
|
|
69
|
+
| **pdd-doc-gardener** | Documentation Gardener | Code-doc inconsistencies / stale comments / API doc mismatches | Auto-create fix PRs |
|
|
70
|
+
| **expert-arch-enforcer** | Architecture Constraint Enforcer | Module dependency direction violations / missing boundary data / oversized files / naming violations | Run custom Linter to detect deviations |
|
|
71
|
+
| **expert-entropy-auditor** | Entropy Auditor | PRD-code inconsistencies / spec-code discrepancies / AI residue / scattered utility classes | Consolidate into shared utility packages |
|
|
72
|
+
| **expert-auto-refactor** | Automated Refactorer | Duplicate code / complex logic / naming optimization | Periodically initiate targeted refactoring PRs |
|
|
73
|
+
|
|
74
|
+
## 工作流程 / Workflow
|
|
75
|
+
|
|
76
|
+
### 🇨🇳 工作流程
|
|
77
|
+
|
|
78
|
+
触发(手动/定时/事件) → 扫描(文档/代码/架构) → 分析(熵评分/分类/优先级) → 执行(自动修复/创建PR/更新文档)
|
|
79
|
+
|
|
80
|
+
### 熵评分系统 (0-100分,100=最有秩序)
|
|
81
|
+
|
|
82
|
+
| 分数范围 | 状态 | 建议行动 |
|
|
83
|
+
|--------|------|---------|
|
|
84
|
+
| 90-100 | 优秀 | 维持现状 |
|
|
85
|
+
| 70-89 | 良好 | 小幅改进 |
|
|
86
|
+
| 50-69 | 一般 | 计划清理 |
|
|
87
|
+
| 30-49 | 警告 | 优先处理 |
|
|
88
|
+
| 0-29 | 危急 | 紧急重构 |
|
|
89
|
+
|
|
90
|
+
### 🇺🇸 Workflow
|
|
91
|
+
|
|
92
|
+
Trigger (manual / scheduled / event) → Scan (docs / code / architecture) → Analyze (entropy score / categorization / priority) → Execute (auto-fix / create PR / update docs)
|
|
93
|
+
|
|
94
|
+
#### Entropy Scoring System (0-100 points, 100 = most orderly)
|
|
95
|
+
|
|
96
|
+
| Score Range | Status | Recommended Action |
|
|
97
|
+
|-------------|--------|-------------------|
|
|
98
|
+
| 90-100 | Excellent | Maintain status quo |
|
|
99
|
+
| 70-89 | Good | Minor improvements |
|
|
100
|
+
| 50-69 | Fair | Plan cleanup |
|
|
101
|
+
| 30-49 | Warning | Prioritize handling |
|
|
102
|
+
| 0-29 | Critical | Emergency refactoring |
|
|
103
|
+
|
|
104
|
+
## 执行指南 / Execution Guide
|
|
105
|
+
|
|
106
|
+
### 🇨🇳 执行指南
|
|
107
|
+
|
|
108
|
+
### Step 1: 熵增检测
|
|
109
|
+
选择范围: 全量检测 | 仅文档 | 仅架构 | 仅代码
|
|
110
|
+
|
|
111
|
+
### Step 2: 生成熵减报告
|
|
112
|
+
使用 `references/entropy-report-template.md`,包含: 熵评分 | 问题列表(按优先级排序) | 修复建议 | 预估工作量
|
|
113
|
+
|
|
114
|
+
### Step 3: 熵减执行
|
|
115
|
+
|
|
116
|
+
| 问题类型 | 执行方式 | 人工确认 |
|
|
117
|
+
|--------|---------|---------|
|
|
118
|
+
| 简单修复(命名/格式) | 自动修复提交 | 否 |
|
|
119
|
+
| 中等修复(文档更新) | 创建PR | 是 |
|
|
120
|
+
| 复杂修复(重构) | 创建Issue+PR | 是 |
|
|
121
|
+
|
|
122
|
+
### 🇺🇸 Execution Guide
|
|
123
|
+
|
|
124
|
+
#### Step 1: Entropy Detection
|
|
125
|
+
Select scope: Full scan | Docs only | Architecture only | Code only
|
|
126
|
+
|
|
127
|
+
#### Step 2: Generate Entropy Reduction Report
|
|
128
|
+
Use `references/entropy-report-template.md`, containing: Entropy score | Issue list (sorted by priority) | Fix recommendations | Estimated effort
|
|
129
|
+
|
|
130
|
+
#### Step 3: Execute Entropy Reduction
|
|
131
|
+
|
|
132
|
+
| Issue Type | Execution Method | Human Confirmation |
|
|
133
|
+
|------------|------------------|-------------------|
|
|
134
|
+
| Simple fix (naming / formatting) | Auto-fix commit | No |
|
|
135
|
+
| Medium fix (documentation update) | Create PR | Yes |
|
|
136
|
+
| Complex fix (refactoring) | Create Issue + PR | Yes |
|
|
137
|
+
|
|
138
|
+
## 黄金原则 / Golden Rules
|
|
139
|
+
|
|
140
|
+
### 🇨🇳 黄金原则
|
|
141
|
+
|
|
142
|
+
1. **使用共享工具包,避免手写辅助函数** - 集中管理不变量,减少重复代码
|
|
143
|
+
2. **验证边界数据,不猜测数据结构** - 所有API入口必须有Schema验证
|
|
144
|
+
3. **保持代码简洁,优先可读性** - 单文件≤300行,单函数≤50行
|
|
145
|
+
4. **文档即代码,保持同步** - 代码变更必须同步文档,过时文档=技术债务
|
|
146
|
+
5. **小额还贷,持续改进** - 每次commit都是改进机会,不让债务累积
|
|
147
|
+
|
|
148
|
+
### 🇺🇸 Golden Rules
|
|
149
|
+
|
|
150
|
+
1. **Use shared utility packages; avoid writing ad-hoc helper functions** — Centralize invariants to reduce code duplication.
|
|
151
|
+
2. **Validate boundary data; never guess data structures** — All API entry points must have schema validation.
|
|
152
|
+
3. **Keep code concise; prioritize readability** — Single file ≤300 lines, single function ≤50 lines.
|
|
153
|
+
4. **Documentation is code; keep them in sync** — Code changes must be reflected in documentation; stale docs = technical debt.
|
|
154
|
+
5. **Small repayments; continuous improvement** — Every commit is an improvement opportunity; never let debt accumulate.
|
|
155
|
+
|
|
156
|
+
## 配置文件 (`entropy-config.yaml`) / Configuration File
|
|
157
|
+
|
|
158
|
+
### 🇨🇳 配置文件
|
|
159
|
+
|
|
160
|
+
```yaml
|
|
161
|
+
entropy_reduction:
|
|
162
|
+
triggers:
|
|
163
|
+
schedule: "0 2 * * *" # 每天凌晨2点
|
|
164
|
+
on_commit: false
|
|
165
|
+
on_pr_merge: true
|
|
166
|
+
detection:
|
|
167
|
+
docs:
|
|
168
|
+
enabled: true
|
|
169
|
+
paths: ["docs/", "*.md"]
|
|
170
|
+
max_age_days: 30
|
|
171
|
+
architecture:
|
|
172
|
+
enabled: true
|
|
173
|
+
layers: ["types", "config", "repo", "service", "runtime", "ui"]
|
|
174
|
+
code:
|
|
175
|
+
enabled: true
|
|
176
|
+
max_file_lines: 300
|
|
177
|
+
max_function_lines: 50
|
|
178
|
+
execution:
|
|
179
|
+
auto_fix: true
|
|
180
|
+
create_pr: true
|
|
181
|
+
max_pr_per_run: 5
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### 🇺🇸 Configuration File (`entropy-config.yaml`)
|
|
185
|
+
|
|
186
|
+
```yaml
|
|
187
|
+
entropy_reduction:
|
|
188
|
+
triggers:
|
|
189
|
+
schedule: "0 2 * * *" # Daily at 2:00 AM
|
|
190
|
+
on_commit: false
|
|
191
|
+
on_pr_merge: true
|
|
192
|
+
detection:
|
|
193
|
+
docs:
|
|
194
|
+
enabled: true
|
|
195
|
+
paths: ["docs/", "*.md"]
|
|
196
|
+
max_age_days: 30
|
|
197
|
+
architecture:
|
|
198
|
+
enabled: true
|
|
199
|
+
layers: ["types", "config", "repo", "service", "runtime", "ui"]
|
|
200
|
+
code:
|
|
201
|
+
enabled: true
|
|
202
|
+
max_file_lines: 300
|
|
203
|
+
max_function_lines: 50
|
|
204
|
+
execution:
|
|
205
|
+
auto_fix: true
|
|
206
|
+
create_pr: true
|
|
207
|
+
max_pr_per_run: 5
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
## 输出格式 / Output Format
|
|
211
|
+
|
|
212
|
+
### 🇨🇳 输出格式
|
|
213
|
+
|
|
214
|
+
每次熵减执行后生成报告保存到 `docs/entropy-reports/`:
|
|
215
|
+
|
|
216
|
+
```markdown
|
|
217
|
+
# Entropy Reduction Report - YYYY-MM-DD
|
|
218
|
+
## Entropy Score: XX/100
|
|
219
|
+
## Issue List: Critical(N) / Warning(N) / Info(N)
|
|
220
|
+
## Fix Recommendations & Execution Results
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
### 🇺🇸 Output Format
|
|
224
|
+
|
|
225
|
+
After each entropy reduction run, generate a report saved to `docs/entropy-reports/`:
|
|
226
|
+
|
|
227
|
+
```markdown
|
|
228
|
+
# Entropy Reduction Report - YYYY-MM-DD
|
|
229
|
+
## Entropy Score: XX/100
|
|
230
|
+
## Issue List: Critical(N) / Warning(N) / Info(N)
|
|
231
|
+
## Fix Recommendations & Execution Results
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
## 与PDD流程集成 / PDD Process Integration
|
|
235
|
+
|
|
236
|
+
### 🇨🇳 与PDD流程集成
|
|
237
|
+
|
|
238
|
+
PDD正向流程(PRD→功能提取→规格设计→代码实现→验收测试) ←→ PDD熵减流程(熵增检测→熵减报告→熵减执行→自动修复→PR创建)
|
|
239
|
+
|
|
240
|
+
### 🇺🇸 PDD Process Integration
|
|
241
|
+
|
|
242
|
+
PDD Forward Flow (PRD → Feature Extraction → Spec Design → Code Implementation → Acceptance Testing) ←↔ PDD Entropy Reduction Flow (Entropy Detection → Entropy Report → Entropy Execution → Auto-Fix → PR Creation)
|
|
243
|
+
|
|
244
|
+
---
|
|
245
|
+
|
|
246
|
+
## Iron Law / 铁律
|
|
247
|
+
|
|
248
|
+
### 🇨🇳 Iron Law (中文)
|
|
249
|
+
|
|
250
|
+
1. **子技能协调不替代**: pdd-entropy-reduction是协调器,负责调度和聚合结果,不得直接执行子技能的具体检测或修复操作。
|
|
251
|
+
|
|
252
|
+
2. **熵评分客观化**: 熵评分必须基于可量化指标(代码重复率/文档过时率/架构违规数等),不得凭主观感觉给分。
|
|
253
|
+
|
|
254
|
+
3. **修复策略分级**: 必须根据问题类型和严重程度选择合适策略(自动修复/创建PR/人工介入),不得一刀切。
|
|
255
|
+
|
|
256
|
+
4. **变更影响可控**: 每次熵减操作的变更范围必须可控(如限制单次PR修改文件数量),避免大规模重构引入新风险。
|
|
257
|
+
|
|
258
|
+
5. **执行结果可度量**: 每次执行前后都必须有明确度量对比(熵分变化/修复问题数/引入新问题数),无法度量的改进等于没做。
|
|
259
|
+
|
|
260
|
+
**违规示例**: ❌ 直接编写代码修复逻辑而非调用auto-refactor | ❌ 给出"感觉代码质量不太好"式的模糊评分 | ❌ 对所有问题都尝试自动修复 | ❌ 一次提交50+文件 | ❌ 只说"清理完成"而无量化结果
|
|
261
|
+
|
|
262
|
+
**合规示例**: ✅ 调用doc-gardener扫描文档,arch-enforcer检查架构 | ✅ 评分报告:文档过时率15%,架构违规2处,代码重复率8% → 总分72/100 | ✅ Critical自动修复,Warning创建PR,Suggestion待观察 | ✅ 单次PR≤5文件 | ✅ 报告含:执行前68分→后82分,修复Critical 3个
|
|
263
|
+
|
|
264
|
+
### 🇺🇸 Iron Law (English)
|
|
265
|
+
|
|
266
|
+
1. **Sub-skill coordination, not substitution**: pdd-entropy-reduction is a coordinator responsible for scheduling and aggregating results. It must NOT directly execute specific detection or repair operations of sub-skills.
|
|
267
|
+
|
|
268
|
+
2. **Objective entropy scoring**: Entropy scores must be based on quantifiable metrics (code duplication rate / documentation staleness rate / architecture violation count, etc.). Subjective feelings are not acceptable.
|
|
269
|
+
|
|
270
|
+
3. **Tiered fix strategies**: Must select appropriate strategy based on issue type and severity (auto-fix / create PR / human intervention). One-size-fits-all approaches are prohibited.
|
|
271
|
+
|
|
272
|
+
4. **Controlled change impact**: The scope of each entropy reduction operation must be controllable (e.g., limit the number of files modified per PR). Avoid introducing new risks through large-scale refactoring.
|
|
273
|
+
|
|
274
|
+
5. **Measurable execution results**: Every run must have clear before/after metric comparisons (entropy score change / issues fixed / new issues introduced). Unmeasurable improvements are equivalent to doing nothing.
|
|
275
|
+
|
|
276
|
+
**Violation Examples**: ❌ Writing code fix logic directly instead of calling auto-refactor | ❌ Giving vague scores like "code quality doesn't feel great" | ❌ Attempting auto-fix for all issues | ❌ Committing 50+ files at once | ❌ Saying "cleanup complete" without quantitative results
|
|
277
|
+
|
|
278
|
+
**Compliance Examples**: ✅ Call doc-gardener to scan docs, arch-enforcer to check architecture | ✅ Scoring report: doc staleness 15%, 2 arch violations, 8% code duplication → Total 72/100 | ✅ Auto-fix Critical, create PR for Warning, monitor Suggestions | ✅ Single PR ≤5 files | ✅ Report includes: Before 68 → After 82, fixed 3 Critical issues
|
|
279
|
+
|
|
280
|
+
---
|
|
281
|
+
|
|
282
|
+
## Rationalization Table / 理性化对照表
|
|
283
|
+
|
|
284
|
+
### 🇨🇳 理性化对照表
|
|
285
|
+
|
|
286
|
+
| 你可能的想法 | 请问自己 | 应该怎么做 |
|
|
287
|
+
|-------------|---------|-----------|
|
|
288
|
+
| "子技能太慢了,我直接做吧" | 协调器价值在于专业化分工,越职会导致质量下降 | 坚持调度模式,委托给对应专家技能 |
|
|
289
|
+
| "熵评分差不多给个整数就行" | 模糊评分无法指导优先级决策 | 建立量化评分模型,每个维度都有计算公式 |
|
|
290
|
+
| "反正都是修复,一起提交吧" | 大批量变更会增加review难度和回滚风险 | 设定单次变更上限,超阈值必须拆分 |
|
|
291
|
+
| "这次先清理明显的,深层的以后再说" | 熵增是持续过程,推迟深层问题会导致债务累积 | 每次执行覆盖全部维度,但按优先级分配精力 |
|
|
292
|
+
| "应该没什么风险,不用验证了吧" | 熵减本身也可能引入新问题 | 执行后必须验证:编译通过/测试通过/功能正常 |
|
|
293
|
+
|
|
294
|
+
### 🇺🇸 Rationalization Table
|
|
295
|
+
|
|
296
|
+
| # | Trap / 陷阱 | Question | Action |
|
|
297
|
+
|---|-------------|----------|--------|
|
|
298
|
+
| 1 | "子技能太慢了,我直接做吧" / "Sub-skills are too slow, I'll do it myself" | The coordinator's value lies in specialized division of labor; overstepping leads to quality degradation | Stick to the dispatch pattern; delegate to the corresponding expert skill |
|
|
299
|
+
| 2 | "熵评分差不多给个整数就行" / "Just give entropy score a round number" | Vague scores cannot guide prioritization decisions | Establish a quantitative scoring model with formulas for each dimension |
|
|
300
|
+
| 3 | "反正都是修复,一起提交吧" / "It's all fixes anyway, commit them together" | Large batch changes increase review difficulty and rollback risk | Set per-change limits; exceeding threshold requires splitting |
|
|
301
|
+
| 4 | "这次先清理明显的,深层的以后再说" / "Clean obvious ones first, deep issues later" | Entropy growth is continuous; postponing deep issues causes debt accumulation | Cover all dimensions each run but allocate effort by priority |
|
|
302
|
+
| 5 | "应该没什么风险,不用验证了吧" / "Probably no risk, skip verification" | Entropy reduction itself may introduce new problems | Must verify after execution: compile passes / tests pass / functionality normal |
|
|
303
|
+
|
|
304
|
+
**常见陷阱 / Common Traps**:
|
|
305
|
+
|
|
306
|
+
1. **"全能选手"陷阱 / "Jack-of-all-trades" Trap**: 协调器试图自己完成所有工作 → 明确职责:协调器只负责调度、聚合、报告 / Coordinator tries to do everything → Clarify role: coordinator only handles dispatch, aggregation, reporting
|
|
307
|
+
2. **"模糊评分"陷阱 / "Vague Scoring" Trap**: 评分缺乏量化依据 → 建立评分模型:指标+权重+计算方法 / Scoring lacks quantifiable basis → Build scoring model: metrics + weights + calculation methods
|
|
308
|
+
3. **"暴力清洗"陷阱 / "Violent Cleanup" Trap**: 一次性大规模修改导致高风险 → 安全阈值:单次修改≤5文件,删除≤100行 / One-time large-scale changes cause high risk → Safety threshold: ≤5 files per change, ≤100 lines deleted
|
|
309
|
+
4. **"无闭环"陷阱 / "No Closed Loop" Trap**: 执行了熵减但没有验证效果 → 强制要求执行报告含前后对比+回归验证 / Executed entropy reduction without verifying results → Mandate execution reports include before/after comparison + regression verification
|
|
310
|
+
|
|
311
|
+
---
|
|
312
|
+
|
|
313
|
+
## Red Flags / 红旗警告
|
|
314
|
+
|
|
315
|
+
### 🇨🇳 Red Flags (中文)
|
|
316
|
+
|
|
317
|
+
### Layer 1: 输入检查
|
|
318
|
+
- **INPUT-ER-001**: 项目目录不存在或无法访问 → 🔴 CRITICAL → 终止并提示检查路径
|
|
319
|
+
- **INPUT-ER-002**: entropy-config.yaml缺失 → 🔵 INFO → 使用默认配置
|
|
320
|
+
- **INPUT-ER-003**: 未指定检测范围 → 🔵 INFO → 默认全量检测
|
|
321
|
+
|
|
322
|
+
### Layer 2: 执行检查
|
|
323
|
+
- **EXEC-ER-001**: 协调器直接执行子技能的具体操作 → 🟡 WARN → 改为调用对应子技能
|
|
324
|
+
- **EXEC-ER-002**: 熵评分缺少量化计算过程 → 🔴 CRITICAL → 补充评分模型说明
|
|
325
|
+
- **EXEC-ER-003**: 单次修复超过配置上限 → 🔴 CRITICAL → 拆分为多批次
|
|
326
|
+
- **EXEC-ER-004**: 自动修复未生成备份 → 🟡 WARN → 执行前创建备份
|
|
327
|
+
|
|
328
|
+
### Layer 3: 输出检查
|
|
329
|
+
- **OUTPUT-ER-001**: 熵减报告缺少执行前后对比 → 🔴 CRITICAL → 补充对比数据
|
|
330
|
+
- **OUTPUT-ER-002**: 报告缺少后续行动计划 → 🟡 WARN → 补充下一步建议
|
|
331
|
+
- **OUTPUT-ER-003**: 报告声明"已修复"但缺验证证据 → 🔴 CRITICAL → 补充验证结果
|
|
332
|
+
|
|
333
|
+
### 触发Red Flag时的处理流程
|
|
334
|
+
🔴 CRITICAL → 立即停止,报告问题详情,等待指示 | 🟡 WARN → 记录警告,尝试自动修复,在报告中标注 | 🔵 INFO → 记录信息,正常继续
|
|
335
|
+
|
|
336
|
+
### 🇺🇸 Red Flags (English)
|
|
337
|
+
|
|
338
|
+
#### Layer 1: Input Validation Guards / 输入检查防护
|
|
339
|
+
- **INPUT-ER-001**: Project directory does not exist or is inaccessible → 🔴 CRITICAL → Terminate and prompt to check path / 终止并提示检查路径
|
|
340
|
+
- **INPUT-ER-002**: entropy-config.yaml missing → 🔵 INFO → Use default configuration / 使用默认配置
|
|
341
|
+
- **INPUT-ER-003**: Detection scope not specified → 🔵 INFO → Default to full scan / 默认全量检测
|
|
342
|
+
|
|
343
|
+
#### Layer 2: Execution Guards / 执行检查防护
|
|
344
|
+
- **EXEC-ER-001**: Coordinator directly executes sub-skill operations → 🟡 WARN → Change to call the corresponding sub-skill / 改为调用对应子技能
|
|
345
|
+
- **EXEC-ER-002**: Entropy score lacks quantitative calculation process → 🔴 CRITICAL → Add scoring model documentation / 补充评分模型说明
|
|
346
|
+
- **EXEC-ER-003**: Single fix exceeds configured limit → 🔴 CRITICAL → Split into multiple batches / 拆分为多批次
|
|
347
|
+
- **EXEC-ER-004**: Auto-fix did not create backup → 🟡 WARN → Create backup before execution / 执行前创建备份
|
|
348
|
+
|
|
349
|
+
#### Layer 3: Output Validation Guards / 输出检查防护
|
|
350
|
+
- **OUTPUT-ER-001**: Entropy reduction report lacks before/after comparison → 🔴 CRITICAL → Add comparison data / 补充对比数据
|
|
351
|
+
- **OUTPUT-ER-002**: Report lacks follow-up action plan → 🟡 WARN → Add next-step recommendations / 补充下一步建议
|
|
352
|
+
- **OUTPUT-ER-003**: Report claims "fixed" but lacks verification evidence → 🔴 CRITICAL → Add verification results / 补充验证结果
|
|
353
|
+
|
|
354
|
+
#### Red Flag Trigger Handling / 触发红旗时的处理流程
|
|
355
|
+
|
|
356
|
+
| Severity | Chinese Description | English Description | Action |
|
|
357
|
+
|----------|-------------------|---------------------|--------|
|
|
358
|
+
| 🔴 CRITICAL | 立即停止,报告问题详情,等待指示 | Stop immediately, report problem details, await instructions | Halt execution and escalate |
|
|
359
|
+
| 🟡 WARN | 记录警告,尝试自动修复,在报告中标注 | Log warning, attempt auto-fix, annotate in report | Continue with mitigation |
|
|
360
|
+
| 🔵 INFO | 记录信息,正常继续 | Log information, continue normally | Proceed without interruption |
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"name": "pdd-entropy-reduction", "version": "1.0.0", "category": "core", "description": "Continuously monitor and reduce technical debt to prevent system decay through code cleanup, doc updates, and architecture alignment. Trigger this Skill when detecting AI residue, architecture drift, needing refactoring, or debt audit tasks. 支持中文触发:熵减、技术债务、代码清理、垃圾回收、架构对齐、重构建议。", "triggers": ["熵减", "技术债务", "代码清理", "垃圾回收", "架构对齐", "entropy reduction", "tech debt", "code cleanup", "refactoring", "architecture alignment"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[{"name": "SKILL.md-exists", "description": "技能文件存在且格式正确", "type": "structure", "expect": {"exists": true, "hasDescription": true}, "checks": {"file_exists": "SKILL.md"}}, {"name": "_meta.json-valid", "description": "元数据文件格式正确", "type": "structure", "expect": {"exists": true, "hasName": true, "hasVersion": true, "hasTriggers": true}, "checks": {"file_exists": "_meta.json"}}, {"name": "has-behavior-shaping", "description": "包含完整的行为塑造章节", "type": "quality", "expect": {"complete": true}, "contains": ["Iron Law", "Rationalization", "Red Flags"]}, {"name": "debt-types-defined", "description": "定义了技术债务分类(代码/文档/架构)", "type": "content", "contains": ["技术债务", "熵增", "代码", "文档", "架构"]}, {"name": "reduction-actions-defined", "description": "定义了熵减行动(清理/重构/对齐)", "type": "content", "contains": ["熵减", "清理", "重构", "对齐", "偿还"]}]
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
# 熵减报告模板
|
|
2
|
+
|
|
3
|
+
> 本模板用于标准化 PDD 熵减机制的审计报告输出
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 报告元信息
|
|
8
|
+
|
|
9
|
+
```yaml
|
|
10
|
+
report_id: ER-YYYYMMDD-HHMMSS
|
|
11
|
+
generated_at: YYYY-MM-DD HH:MM:SS
|
|
12
|
+
project: 项目名称
|
|
13
|
+
branch: 当前分支
|
|
14
|
+
commit: 当前提交哈希
|
|
15
|
+
auditor: pdd-entropy-reduction
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## 一、熵值评分总览
|
|
21
|
+
|
|
22
|
+
### 1.1 综合熵值
|
|
23
|
+
|
|
24
|
+
| 维度 | 熵值 (0-100) | 状态 | 趋势 |
|
|
25
|
+
|------|-------------|------|------|
|
|
26
|
+
| 文档一致性 | XX | 🟢/🟡/🔴 | ↑/↓/→ |
|
|
27
|
+
| 架构合规性 | XX | 🟢/🟡/🔴 | ↑/↓/→ |
|
|
28
|
+
| 代码质量 | XX | 🟢/🟡/🔴 | ↑/↓/→ |
|
|
29
|
+
| 技术债务 | XX | 🟢/🟡/🔴 | ↑/↓/→ |
|
|
30
|
+
| **综合评分** | **XX** | | |
|
|
31
|
+
|
|
32
|
+
### 1.2 熵值状态说明
|
|
33
|
+
|
|
34
|
+
- 🟢 **健康 (0-30)**: 系统状态良好,熵值可控
|
|
35
|
+
- 🟡 **警告 (31-60)**: 存在潜在问题,需要关注
|
|
36
|
+
- 🔴 **危险 (61-100)**: 系统腐化严重,需要立即干预
|
|
37
|
+
|
|
38
|
+
### 1.3 熵值计算公式
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
综合熵值 = (文档熵值 × 0.25) + (架构熵值 × 0.30) + (代码熵值 × 0.25) + (债务熵值 × 0.20)
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## 二、文档一致性审计 (pdd-doc-gardener)
|
|
47
|
+
|
|
48
|
+
### 2.1 文档-代码不一致项
|
|
49
|
+
|
|
50
|
+
| 文档路径 | 代码路径 | 不一致类型 | 严重程度 | 建议操作 |
|
|
51
|
+
|---------|---------|-----------|---------|---------|
|
|
52
|
+
| docs/xxx.md | src/xxx.ts | API签名变更 | High | 更新文档 |
|
|
53
|
+
| ... | ... | ... | ... | ... |
|
|
54
|
+
|
|
55
|
+
### 2.2 过期TODO项
|
|
56
|
+
|
|
57
|
+
```markdown
|
|
58
|
+
- [ ] TODO: xxx (docs/api.md:45) - 创建于 2025-01-15,已过期 60 天
|
|
59
|
+
- [ ] FIXME: xxx (src/service.ts:120) - 创建于 2025-02-01,已过期 45 天
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### 2.3 孤立文档
|
|
63
|
+
|
|
64
|
+
| 文档路径 | 原因 | 建议操作 |
|
|
65
|
+
|---------|------|---------|
|
|
66
|
+
| docs/deprecated/xxx.md | 对应代码已删除 | 归档或删除 |
|
|
67
|
+
| ... | ... | ... |
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## 三、架构合规性审计 (expert-arch-enforcer)
|
|
72
|
+
|
|
73
|
+
### 3.1 依赖方向违规
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
违规: Service 层直接引用 UI 层
|
|
77
|
+
- src/service/UserService.ts → src/ui/components/UserForm.tsx
|
|
78
|
+
- 违反六层模型: Types → Config → Repo → Service → Runtime → UI
|
|
79
|
+
- 建议: 通过事件或接口解耦
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### 3.2 边界穿透
|
|
83
|
+
|
|
84
|
+
| 违规类型 | 位置 | 描述 | 修复建议 |
|
|
85
|
+
|---------|------|------|---------|
|
|
86
|
+
| 跨层调用 | UserService.ts:45 | Service直接访问UI组件 | 使用事件机制 |
|
|
87
|
+
| 循环依赖 | A.ts ↔ B.ts | 模块间循环引用 | 引入接口层 |
|
|
88
|
+
|
|
89
|
+
### 3.3 架构约束检查结果
|
|
90
|
+
|
|
91
|
+
```yaml
|
|
92
|
+
constraints_checked:
|
|
93
|
+
- name: 六层依赖模型
|
|
94
|
+
status: PASS/FAIL
|
|
95
|
+
violations: X
|
|
96
|
+
|
|
97
|
+
- name: 单向数据流
|
|
98
|
+
status: PASS/FAIL
|
|
99
|
+
violations: X
|
|
100
|
+
|
|
101
|
+
- name: 接口隔离
|
|
102
|
+
status: PASS/FAIL
|
|
103
|
+
violations: X
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## 四、熵增审计 (expert-entropy-auditor)
|
|
109
|
+
|
|
110
|
+
### 4.1 PRD-代码一致性
|
|
111
|
+
|
|
112
|
+
| PRD需求 | 实现状态 | 偏差描述 | 优先级 |
|
|
113
|
+
|--------|---------|---------|--------|
|
|
114
|
+
| 用户登录功能 | ✅ 已实现 | - | - |
|
|
115
|
+
| 数据导出功能 | ⚠️ 部分实现 | 缺少PDF导出 | Medium |
|
|
116
|
+
| 权限管理 | ❌ 未实现 | 需要补充 | High |
|
|
117
|
+
|
|
118
|
+
### 4.2 AI残渣检测
|
|
119
|
+
|
|
120
|
+
| 类型 | 位置 | 描述 | 清理建议 |
|
|
121
|
+
|------|------|------|---------|
|
|
122
|
+
| 猜测的数据结构 | types/guess.d.ts | 未使用的类型定义 | 删除 |
|
|
123
|
+
| 重复的辅助函数 | utils/helper.ts | 与 common/utils.ts 重复 | 合并 |
|
|
124
|
+
| 硬编码配置 | config.ts:23 | 应提取到配置文件 | 重构 |
|
|
125
|
+
|
|
126
|
+
### 4.3 重复代码检测
|
|
127
|
+
|
|
128
|
+
```
|
|
129
|
+
重复代码块 #1 (相似度: 95%)
|
|
130
|
+
- src/service/UserService.ts:100-150
|
|
131
|
+
- src/service/AdminService.ts:80-130
|
|
132
|
+
- 建议: 提取公共方法 handleEntityList()
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## 五、技术债务统计 (expert-auto-refactor)
|
|
138
|
+
|
|
139
|
+
### 5.1 债务清单
|
|
140
|
+
|
|
141
|
+
| ID | 类型 | 位置 | 预估工时 | 利息率 | 状态 |
|
|
142
|
+
|----|------|------|---------|--------|------|
|
|
143
|
+
| TD-001 | 代码重复 | UserService.ts | 2h | High | 待处理 |
|
|
144
|
+
| TD-002 | 复杂度过高 | DataProcessor.ts | 4h | Medium | 待处理 |
|
|
145
|
+
| TD-003 | 命名不规范 | legacy/*.ts | 1h | Low | 待处理 |
|
|
146
|
+
|
|
147
|
+
### 5.2 债务趋势
|
|
148
|
+
|
|
149
|
+
```
|
|
150
|
+
技术债务趋势 (近30天)
|
|
151
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
152
|
+
Week 1: ████████░░░░░░░░░░░░ 40 (新增 5, 偿还 2)
|
|
153
|
+
Week 2: ██████████░░░░░░░░░░ 50 (新增 8, 偿还 3)
|
|
154
|
+
Week 3: ████████░░░░░░░░░░░░ 42 (新增 2, 偿还 10)
|
|
155
|
+
Week 4: ██████░░░░░░░░░░░░░░ 35 (新增 1, 偿还 8)
|
|
156
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
157
|
+
趋势: 📉 下降 (良好)
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### 5.3 建议的"小额还贷"任务
|
|
161
|
+
|
|
162
|
+
```markdown
|
|
163
|
+
### 本周建议偿还任务 (预计 4 小时)
|
|
164
|
+
|
|
165
|
+
1. **TD-001**: 提取 UserService 和 AdminService 的公共方法
|
|
166
|
+
- 预计时间: 2h
|
|
167
|
+
- 影响: 减少 50 行重复代码
|
|
168
|
+
- 风险: 低
|
|
169
|
+
|
|
170
|
+
2. **TD-003**: 重命名 legacy 目录中的不规范变量
|
|
171
|
+
- 预计时间: 1h
|
|
172
|
+
- 影响: 提高代码可读性
|
|
173
|
+
- 风险: 低 (仅重命名)
|
|
174
|
+
|
|
175
|
+
3. **新增**: 将硬编码配置提取到配置文件
|
|
176
|
+
- 预计时间: 1h
|
|
177
|
+
- 影响: 提高可维护性
|
|
178
|
+
- 风险: 低
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
## 六、改进建议
|
|
184
|
+
|
|
185
|
+
### 6.1 立即处理 (Critical)
|
|
186
|
+
|
|
187
|
+
```markdown
|
|
188
|
+
1. [架构] 修复 Service → UI 的直接依赖
|
|
189
|
+
- 违规位置: UserService.ts:45
|
|
190
|
+
- 修复方案: 引入事件总线
|
|
191
|
+
- 预计时间: 2h
|
|
192
|
+
|
|
193
|
+
2. [文档] 更新 API 文档中的签名变更
|
|
194
|
+
- 影响范围: 3 个接口
|
|
195
|
+
- 预计时间: 1h
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### 6.2 本周处理 (High)
|
|
199
|
+
|
|
200
|
+
```markdown
|
|
201
|
+
1. [债务] 提取重复代码
|
|
202
|
+
- 影响: UserService, AdminService
|
|
203
|
+
- 预计时间: 2h
|
|
204
|
+
|
|
205
|
+
2. [AI残渣] 清理未使用的类型定义
|
|
206
|
+
- 文件: types/guess.d.ts
|
|
207
|
+
- 预计时间: 0.5h
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### 6.3 持续改进 (Medium)
|
|
211
|
+
|
|
212
|
+
```markdown
|
|
213
|
+
1. 建立定期熵减审计机制 (每周一次)
|
|
214
|
+
2. 将熵值指标纳入代码评审流程
|
|
215
|
+
3. 为新功能开发添加熵值预检
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
## 七、附录
|
|
221
|
+
|
|
222
|
+
### 7.1 审计范围
|
|
223
|
+
|
|
224
|
+
```
|
|
225
|
+
扫描目录:
|
|
226
|
+
- docs/ (文档目录)
|
|
227
|
+
- src/ (源代码目录)
|
|
228
|
+
- tests/ (测试目录)
|
|
229
|
+
- .trae/ (配置目录)
|
|
230
|
+
|
|
231
|
+
排除目录:
|
|
232
|
+
- node_modules/
|
|
233
|
+
- dist/
|
|
234
|
+
- .git/
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
### 7.2 审计配置
|
|
238
|
+
|
|
239
|
+
```yaml
|
|
240
|
+
entropy_threshold:
|
|
241
|
+
healthy: 30
|
|
242
|
+
warning: 60
|
|
243
|
+
critical: 80
|
|
244
|
+
|
|
245
|
+
scan_frequency: weekly
|
|
246
|
+
|
|
247
|
+
auto_fix_enabled: false
|
|
248
|
+
|
|
249
|
+
notification:
|
|
250
|
+
channels:
|
|
251
|
+
- email
|
|
252
|
+
- slack
|
|
253
|
+
recipients:
|
|
254
|
+
- tech-lead@company.com
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
### 7.3 历史对比
|
|
258
|
+
|
|
259
|
+
| 报告日期 | 综合熵值 | 变化 | 主要改进 |
|
|
260
|
+
|---------|---------|------|---------|
|
|
261
|
+
| 2025-03-01 | 45 | - | 基线报告 |
|
|
262
|
+
| 2025-03-08 | 42 | ↓3 | 清理AI残渣 |
|
|
263
|
+
| 2025-03-15 | 38 | ↓4 | 重构重复代码 |
|
|
264
|
+
| 2025-03-22 | XX | ? | 本次报告 |
|
|
265
|
+
|
|
266
|
+
---
|
|
267
|
+
|
|
268
|
+
## 八、报告生成信息
|
|
269
|
+
|
|
270
|
+
```yaml
|
|
271
|
+
generator: pdd-entropy-reduction v1.0
|
|
272
|
+
sub_skills_used:
|
|
273
|
+
- pdd-doc-gardener
|
|
274
|
+
- expert-arch-enforcer
|
|
275
|
+
- expert-entropy-auditor
|
|
276
|
+
- expert-auto-refactor
|
|
277
|
+
|
|
278
|
+
execution_time: XX seconds
|
|
279
|
+
files_scanned: XXX
|
|
280
|
+
issues_found: XX
|
|
281
|
+
|
|
282
|
+
next_audit: YYYY-MM-DD
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
---
|
|
286
|
+
|
|
287
|
+
> 📌 **备注**: 本报告由 PDD 熵减机制自动生成,建议在团队周会上讨论关键问题并分配改进任务。
|