dev-playbooks-cn 1.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/LICENSE +21 -0
- package/README.md +466 -0
- package/bin/devbooks.js +987 -0
- package/package.json +43 -0
- package/skills/Skills/344/275/277/347/224/250/350/257/264/346/230/216.md +446 -0
- package/skills/Skill/345/274/200/345/217/221/346/214/207/345/215/227.md +248 -0
- package/skills/_shared/context-detection-template.md +315 -0
- package/skills/_shared/mcp-enhancement-template.md +144 -0
- package/skills/_shared/references//351/200/232/347/224/250/345/256/210/351/227/250/345/215/217/350/256/256.md +114 -0
- package/skills/_template/config-discovery-template.md +126 -0
- package/skills/devbooks-brownfield-bootstrap/SKILL.md +167 -0
- package/skills/devbooks-brownfield-bootstrap/references//344/273/243/347/240/201/345/257/274/350/210/252/347/255/226/347/225/245.md +203 -0
- package/skills/devbooks-brownfield-bootstrap/references//345/255/230/351/207/217/351/241/271/347/233/256/345/210/235/345/247/213/345/214/226.md +96 -0
- package/skills/devbooks-brownfield-bootstrap/references//345/255/230/351/207/217/351/241/271/347/233/256/345/210/235/345/247/213/345/214/226/346/217/220/347/244/272/350/257/215.md +115 -0
- package/skills/devbooks-brownfield-bootstrap/references//346/234/257/350/257/255/350/241/250/346/250/241/346/235/277.md +42 -0
- package/skills/devbooks-brownfield-bootstrap/scripts/cod-update.sh +357 -0
- package/skills/devbooks-brownfield-bootstrap/templates/project-profile-template.md +172 -0
- package/skills/devbooks-c4-map/SKILL.md +151 -0
- package/skills/devbooks-c4-map/references/C4/346/236/266/346/236/204/345/234/260/345/233/276/346/217/220/347/244/272/350/257/215.md +33 -0
- package/skills/devbooks-c4-map/references//345/210/206/345/261/202/347/272/246/346/235/237/346/243/200/346/237/245/346/270/205/345/215/225.md +185 -0
- package/skills/devbooks-code-review/SKILL.md +175 -0
- package/skills/devbooks-code-review/references/PR/346/250/241/346/235/277/344/270/216/346/214/207/345/215/227.md +321 -0
- package/skills/devbooks-code-review/references//344/273/243/347/240/201/350/257/204/345/256/241/346/217/220/347/244/272/350/257/215.md +100 -0
- package/skills/devbooks-code-review/references//345/235/217/345/221/263/351/201/223/351/200/237/346/237/245/350/241/250.md +495 -0
- package/skills/devbooks-code-review/references//350/265/204/346/272/220/347/256/241/347/220/206/345/256/241/346/237/245/346/270/205/345/215/225.md +311 -0
- package/skills/devbooks-coder/SKILL.md +219 -0
- package/skills/devbooks-coder/references//344/273/243/347/240/201/345/256/236/347/216/260/346/217/220/347/244/272/350/257/215.md +70 -0
- package/skills/devbooks-coder/references//344/275/216/351/243/216/351/231/251/346/224/271/345/212/250/346/212/200/346/234/257.md +275 -0
- package/skills/devbooks-coder/references//346/227/245/345/277/227/350/247/204/350/214/203.md +329 -0
- package/skills/devbooks-coder/references//347/274/226/347/240/201/351/243/216/346/240/274/347/273/206/345/210/231.md +351 -0
- package/skills/devbooks-coder/references//351/224/231/350/257/257/347/240/201/350/247/204/350/214/203.md +463 -0
- package/skills/devbooks-delivery-workflow/SKILL.md +217 -0
- package/skills/devbooks-delivery-workflow/references//344/272/244/344/273/230/351/252/214/346/224/266/345/267/245/344/275/234/346/265/201.md +256 -0
- package/skills/devbooks-delivery-workflow/references//345/216/237/345/236/213-/347/224/237/344/272/247/345/217/214/350/275/250/346/250/241/345/274/217.md +168 -0
- package/skills/devbooks-delivery-workflow/references//345/217/230/346/233/264/351/252/214/350/257/201/344/270/216/350/277/275/346/272/257/346/250/241/346/235/277.md +133 -0
- package/skills/devbooks-delivery-workflow/scripts/ac-trace-check.sh +330 -0
- package/skills/devbooks-delivery-workflow/scripts/audit-scope.sh +262 -0
- package/skills/devbooks-delivery-workflow/scripts/change-check.sh +1040 -0
- package/skills/devbooks-delivery-workflow/scripts/change-codemod-scaffold.sh +135 -0
- package/skills/devbooks-delivery-workflow/scripts/change-evidence.sh +152 -0
- package/skills/devbooks-delivery-workflow/scripts/change-scaffold.sh +442 -0
- package/skills/devbooks-delivery-workflow/scripts/change-spec-delta-scaffold.sh +136 -0
- package/skills/devbooks-delivery-workflow/scripts/constitution-check.sh +237 -0
- package/skills/devbooks-delivery-workflow/scripts/env-match-check.sh +128 -0
- package/skills/devbooks-delivery-workflow/scripts/fitness-check.sh +387 -0
- package/skills/devbooks-delivery-workflow/scripts/guardrail-check.sh +519 -0
- package/skills/devbooks-delivery-workflow/scripts/handoff-check.sh +141 -0
- package/skills/devbooks-delivery-workflow/scripts/hygiene-check.sh +340 -0
- package/skills/devbooks-delivery-workflow/scripts/migrate-from-openspec.sh +385 -0
- package/skills/devbooks-delivery-workflow/scripts/migrate-to-v2-gates.sh +202 -0
- package/skills/devbooks-delivery-workflow/scripts/progress-dashboard.sh +319 -0
- package/skills/devbooks-delivery-workflow/scripts/prototype-promote.sh +341 -0
- package/skills/devbooks-delivery-workflow/scripts/spec-preview.sh +203 -0
- package/skills/devbooks-delivery-workflow/scripts/spec-promote.sh +118 -0
- package/skills/devbooks-delivery-workflow/scripts/spec-rollback.sh +124 -0
- package/skills/devbooks-delivery-workflow/scripts/spec-stage.sh +117 -0
- package/skills/devbooks-delivery-workflow/scripts/verify-all.sh +78 -0
- package/skills/devbooks-delivery-workflow/scripts/verify-npm-package.sh +123 -0
- package/skills/devbooks-delivery-workflow/scripts/verify-openspec-free.sh +81 -0
- package/skills/devbooks-delivery-workflow/scripts/verify-slash-commands.sh +146 -0
- package/skills/devbooks-delivery-workflow/templates/handoff.md +50 -0
- package/skills/devbooks-design-backport/SKILL.md +73 -0
- package/skills/devbooks-design-backport/references//345/233/236/345/206/231/350/256/276/350/256/241/346/226/207/346/241/243/346/217/220/347/244/272/350/257/215.md +196 -0
- package/skills/devbooks-design-doc/SKILL.md +121 -0
- package/skills/devbooks-design-doc/references//345/276/256/346/234/215/345/212/241/350/256/276/350/256/241/346/270/205/345/215/225.md +149 -0
- package/skills/devbooks-design-doc/references//350/256/276/350/256/241/346/226/207/346/241/243/346/217/220/347/244/272/350/257/215.md +189 -0
- package/skills/devbooks-design-doc/references//351/232/220/347/247/201/345/220/210/350/247/204/346/243/200/346/237/245/346/270/205/345/215/225.md +240 -0
- package/skills/devbooks-entropy-monitor/SKILL.md +188 -0
- package/skills/devbooks-entropy-monitor/references//347/206/265/345/272/246/351/207/217/346/226/271/346/263/225/350/256/272.md +223 -0
- package/skills/devbooks-entropy-monitor/scripts/entropy-measure.sh +449 -0
- package/skills/devbooks-entropy-monitor/scripts/entropy-report.sh +303 -0
- package/skills/devbooks-entropy-monitor/templates/thresholds.json +99 -0
- package/skills/devbooks-federation/SKILL.md +264 -0
- package/skills/devbooks-federation/scripts/federation-check.sh +144 -0
- package/skills/devbooks-federation/templates/federation.yaml +89 -0
- package/skills/devbooks-impact-analysis/SKILL.md +135 -0
- package/skills/devbooks-impact-analysis/references//345/275/261/345/223/215/345/210/206/346/236/220/346/217/220/347/244/272/350/257/215.md +82 -0
- package/skills/devbooks-impact-analysis/scripts/graph-cache.sh +214 -0
- package/skills/devbooks-implementation-plan/SKILL.md +83 -0
- package/skills/devbooks-implementation-plan/references//347/274/226/347/240/201/350/256/241/345/210/222/346/217/220/347/244/272/350/257/215.md +99 -0
- package/skills/devbooks-index-bootstrap/SKILL.md +240 -0
- package/skills/devbooks-proposal-author/SKILL.md +83 -0
- package/skills/devbooks-proposal-author/references//346/217/220/346/241/210/346/222/260/345/206/231/346/217/220/347/244/272/350/257/215.md +66 -0
- package/skills/devbooks-proposal-challenger/SKILL.md +86 -0
- package/skills/devbooks-proposal-challenger/references//344/274/246/347/220/206/344/270/216/345/220/210/350/247/204/346/243/200/346/237/245/346/270/205/345/215/225.md +176 -0
- package/skills/devbooks-proposal-challenger/references//346/217/220/346/241/210/350/264/250/347/226/221/346/217/220/347/244/272/350/257/215.md +57 -0
- package/skills/devbooks-proposal-debate-workflow/SKILL.md +78 -0
- package/skills/devbooks-proposal-debate-workflow/references//346/217/220/346/241/210/345/257/271/350/276/251/345/267/245/344/275/234/346/265/201.md +24 -0
- package/skills/devbooks-proposal-debate-workflow/references//346/217/220/346/241/210/345/257/271/350/276/251/346/250/241/346/235/277.md +35 -0
- package/skills/devbooks-proposal-debate-workflow/scripts/proposal-debate-check.sh +102 -0
- package/skills/devbooks-proposal-judge/SKILL.md +78 -0
- package/skills/devbooks-proposal-judge/references//346/217/220/346/241/210/350/243/201/345/206/263/346/217/220/347/244/272/350/257/215.md +37 -0
- package/skills/devbooks-router/SKILL.md +346 -0
- package/skills/devbooks-spec-contract/SKILL.md +191 -0
- package/skills/devbooks-spec-contract/references/API/350/256/276/350/256/241/346/214/207/345/215/227.md +349 -0
- package/skills/devbooks-spec-contract/references//345/245/221/347/272/246/344/270/216/346/225/260/346/215/256/345/256/232/344/271/211/346/217/220/347/244/272/350/257/215.md +85 -0
- package/skills/devbooks-spec-contract/references//350/247/204/346/240/274/345/217/230/346/233/264/346/217/220/347/244/272/350/257/215.md +63 -0
- package/skills/devbooks-spec-contract/references//351/232/220/345/274/217/345/217/230/346/233/264/346/243/200/346/265/213/346/217/220/347/244/272/350/257/215.md +183 -0
- package/skills/devbooks-spec-contract/scripts/implicit-change-detect.sh +378 -0
- package/skills/devbooks-spec-gardener/SKILL.md +72 -0
- package/skills/devbooks-spec-gardener/references//350/247/204/346/240/274/345/233/255/344/270/201/346/217/220/347/244/272/350/257/215.md +41 -0
- package/skills/devbooks-test-owner/SKILL.md +172 -0
- package/skills/devbooks-test-owner/references//345/217/230/346/233/264/351/252/214/350/257/201/344/270/216/350/277/275/346/272/257/346/250/241/346/235/277.md +228 -0
- package/skills/devbooks-test-owner/references//345/274/202/346/255/245/347/263/273/347/273/237/346/265/213/350/257/225/347/255/226/347/225/245.md +316 -0
- package/skills/devbooks-test-owner/references//346/265/213/350/257/225/344/273/243/347/240/201/346/217/220/347/244/272/350/257/215.md +208 -0
- package/skills/devbooks-test-owner/references//346/265/213/350/257/225/345/210/206/345/261/202/347/255/226/347/225/245.md +281 -0
- package/skills/devbooks-test-owner/references//346/265/213/350/257/225/351/251/261/345/212/250.md +394 -0
- package/skills/devbooks-test-owner/references//350/247/243/344/276/235/350/265/226/346/212/200/346/234/257/351/200/237/346/237/245/350/241/250.md +432 -0
- package/skills/devbooks-test-reviewer/SKILL.md +189 -0
- package/templates/.devbooks/config.yaml +88 -0
- package/templates/claude-commands/devbooks/apply.md +38 -0
- package/templates/claude-commands/devbooks/archive.md +33 -0
- package/templates/claude-commands/devbooks/backport.md +19 -0
- package/templates/claude-commands/devbooks/bootstrap.md +19 -0
- package/templates/claude-commands/devbooks/c4.md +19 -0
- package/templates/claude-commands/devbooks/challenger.md +19 -0
- package/templates/claude-commands/devbooks/code.md +19 -0
- package/templates/claude-commands/devbooks/debate.md +19 -0
- package/templates/claude-commands/devbooks/delivery.md +19 -0
- package/templates/claude-commands/devbooks/design.md +19 -0
- package/templates/claude-commands/devbooks/entropy.md +19 -0
- package/templates/claude-commands/devbooks/federation.md +19 -0
- package/templates/claude-commands/devbooks/gardener.md +19 -0
- package/templates/claude-commands/devbooks/impact.md +19 -0
- package/templates/claude-commands/devbooks/index.md +19 -0
- package/templates/claude-commands/devbooks/judge.md +19 -0
- package/templates/claude-commands/devbooks/plan.md +19 -0
- package/templates/claude-commands/devbooks/proposal.md +19 -0
- package/templates/claude-commands/devbooks/quick.md +42 -0
- package/templates/claude-commands/devbooks/review.md +19 -0
- package/templates/claude-commands/devbooks/router.md +19 -0
- package/templates/claude-commands/devbooks/spec.md +19 -0
- package/templates/claude-commands/devbooks/test-review.md +19 -0
- package/templates/claude-commands/devbooks/test.md +19 -0
- package/templates/dev-playbooks/README.md +458 -0
- package/templates/dev-playbooks/changes/.gitkeep +1 -0
- package/templates/dev-playbooks/constitution.md +116 -0
- package/templates/dev-playbooks/project.md +96 -0
- package/templates/dev-playbooks/scripts/.gitkeep +1 -0
- package/templates/dev-playbooks/specs/_meta/anti-patterns/.gitkeep +2 -0
- package/templates/dev-playbooks/specs/_meta/glossary.md +47 -0
- package/templates/dev-playbooks/specs/_meta/project-profile.md +79 -0
- package/templates/dev-playbooks/specs/architecture/fitness-rules.md +95 -0
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
# ============================================================================
|
|
5
|
+
# entropy-report.sh
|
|
6
|
+
# ============================================================================
|
|
7
|
+
# Generates a human-readable markdown report from entropy metrics.
|
|
8
|
+
#
|
|
9
|
+
# Reference: "The Mythical Man-Month" Chapter 16 "No Silver Bullet" - Controlling complexity is key to software development
|
|
10
|
+
# ============================================================================
|
|
11
|
+
|
|
12
|
+
usage() {
|
|
13
|
+
cat <<'EOF' >&2
|
|
14
|
+
usage: entropy-report.sh [--input <file>] [--output <file>] [--project-root <dir>] [--truth-root <dir>]
|
|
15
|
+
|
|
16
|
+
Generates a markdown report from entropy metrics JSON.
|
|
17
|
+
|
|
18
|
+
Options:
|
|
19
|
+
--input Input metrics JSON file (default: latest in <truth-root>/_meta/entropy/)
|
|
20
|
+
--output Output markdown file (default: <truth-root>/_meta/entropy/entropy-report-YYYY-MM-DD.md)
|
|
21
|
+
--project-root Project root directory (default: pwd)
|
|
22
|
+
--truth-root Truth root directory (default: specs)
|
|
23
|
+
|
|
24
|
+
Examples:
|
|
25
|
+
entropy-report.sh
|
|
26
|
+
entropy-report.sh --input metrics-2024-01-15.json --output report.md
|
|
27
|
+
EOF
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if [[ "${1:-}" == "-h" || "${1:-}" == "--help" ]]; then
|
|
31
|
+
usage
|
|
32
|
+
exit 0
|
|
33
|
+
fi
|
|
34
|
+
|
|
35
|
+
project_root="${DEVBOOKS_PROJECT_ROOT:-$(pwd)}"
|
|
36
|
+
truth_root="${DEVBOOKS_TRUTH_ROOT:-specs}"
|
|
37
|
+
input_file=""
|
|
38
|
+
output_file=""
|
|
39
|
+
|
|
40
|
+
while [[ $# -gt 0 ]]; do
|
|
41
|
+
case "$1" in
|
|
42
|
+
-h|--help)
|
|
43
|
+
usage
|
|
44
|
+
exit 0
|
|
45
|
+
;;
|
|
46
|
+
--input)
|
|
47
|
+
input_file="${2:-}"
|
|
48
|
+
shift 2
|
|
49
|
+
;;
|
|
50
|
+
--output)
|
|
51
|
+
output_file="${2:-}"
|
|
52
|
+
shift 2
|
|
53
|
+
;;
|
|
54
|
+
--project-root)
|
|
55
|
+
project_root="${2:-}"
|
|
56
|
+
shift 2
|
|
57
|
+
;;
|
|
58
|
+
--truth-root)
|
|
59
|
+
truth_root="${2:-}"
|
|
60
|
+
shift 2
|
|
61
|
+
;;
|
|
62
|
+
*)
|
|
63
|
+
usage
|
|
64
|
+
exit 2
|
|
65
|
+
;;
|
|
66
|
+
esac
|
|
67
|
+
done
|
|
68
|
+
|
|
69
|
+
# Normalize paths
|
|
70
|
+
project_root="${project_root%/}"
|
|
71
|
+
truth_root="${truth_root%/}"
|
|
72
|
+
|
|
73
|
+
if [[ "$truth_root" = /* ]]; then
|
|
74
|
+
truth_dir="$truth_root"
|
|
75
|
+
else
|
|
76
|
+
truth_dir="${project_root}/${truth_root}"
|
|
77
|
+
fi
|
|
78
|
+
|
|
79
|
+
entropy_dir="${truth_dir}/_meta/entropy"
|
|
80
|
+
|
|
81
|
+
# Find latest metrics file if not specified
|
|
82
|
+
if [[ -z "$input_file" ]]; then
|
|
83
|
+
input_file=$(find "$entropy_dir" -name "metrics-*.json" -type f 2>/dev/null | sort -r | head -1)
|
|
84
|
+
if [[ -z "$input_file" ]]; then
|
|
85
|
+
echo "error: no metrics file found in ${entropy_dir}" >&2
|
|
86
|
+
echo "hint: run entropy-measure.sh first" >&2
|
|
87
|
+
exit 1
|
|
88
|
+
fi
|
|
89
|
+
fi
|
|
90
|
+
|
|
91
|
+
if [[ ! -f "$input_file" ]]; then
|
|
92
|
+
echo "error: input file not found: ${input_file}" >&2
|
|
93
|
+
exit 1
|
|
94
|
+
fi
|
|
95
|
+
|
|
96
|
+
# Set default output file
|
|
97
|
+
if [[ -z "$output_file" ]]; then
|
|
98
|
+
output_file="${entropy_dir}/entropy-report-$(date +%Y-%m-%d).md"
|
|
99
|
+
fi
|
|
100
|
+
|
|
101
|
+
# Ensure output directory exists
|
|
102
|
+
mkdir -p "$(dirname "$output_file")"
|
|
103
|
+
|
|
104
|
+
echo "generating report from: ${input_file}"
|
|
105
|
+
|
|
106
|
+
# ============================================================================
|
|
107
|
+
# Extract metrics
|
|
108
|
+
# ============================================================================
|
|
109
|
+
|
|
110
|
+
timestamp=$(jq -r '.timestamp' "$input_file")
|
|
111
|
+
project=$(jq -r '.project_root' "$input_file")
|
|
112
|
+
days=$(jq -r '.analysis_period_days' "$input_file")
|
|
113
|
+
|
|
114
|
+
# Structural metrics
|
|
115
|
+
file_p95=$(jq -r '.metrics.structural.file_lines_p95 // "N/A"' "$input_file")
|
|
116
|
+
file_mean=$(jq -r '.metrics.structural.file_lines_mean // "N/A"' "$input_file")
|
|
117
|
+
complexity_mean=$(jq -r '.metrics.structural.complexity_mean // "N/A"' "$input_file")
|
|
118
|
+
complexity_p95=$(jq -r '.metrics.structural.complexity_p95 // "N/A"' "$input_file")
|
|
119
|
+
|
|
120
|
+
# Change metrics
|
|
121
|
+
hotspot_count=$(jq -r '.metrics.change.hotspot_count // "N/A"' "$input_file")
|
|
122
|
+
total_files=$(jq -r '.metrics.change.total_files // "N/A"' "$input_file")
|
|
123
|
+
hotspot_ratio=$(jq -r '.metrics.change.hotspot_ratio // "N/A"' "$input_file")
|
|
124
|
+
|
|
125
|
+
# Test metrics
|
|
126
|
+
test_lines=$(jq -r '.metrics.test.test_lines // "N/A"' "$input_file")
|
|
127
|
+
code_lines=$(jq -r '.metrics.test.code_lines // "N/A"' "$input_file")
|
|
128
|
+
test_code_ratio=$(jq -r '.metrics.test.test_code_ratio // "N/A"' "$input_file")
|
|
129
|
+
flaky_ratio=$(jq -r '.metrics.test.flaky_ratio // "N/A"' "$input_file")
|
|
130
|
+
coverage=$(jq -r '.metrics.test.coverage // "N/A"' "$input_file")
|
|
131
|
+
|
|
132
|
+
# Dependency metrics
|
|
133
|
+
outdated=$(jq -r '.metrics.dependency.outdated // "N/A"' "$input_file")
|
|
134
|
+
total_deps=$(jq -r '.metrics.dependency.total // "N/A"' "$input_file")
|
|
135
|
+
outdated_ratio=$(jq -r '.metrics.dependency.outdated_ratio // "N/A"' "$input_file")
|
|
136
|
+
vulnerabilities=$(jq -r '.metrics.dependency.vulnerabilities // "N/A"' "$input_file")
|
|
137
|
+
|
|
138
|
+
# Thresholds
|
|
139
|
+
t_file_p95=$(jq -r '.thresholds.structural.file_lines_p95 // 500' "$input_file")
|
|
140
|
+
t_hotspot=$(jq -r '.thresholds.change.hotspot_ratio // 0.1' "$input_file")
|
|
141
|
+
t_test_ratio=$(jq -r '.thresholds.test.test_code_ratio_min // 0.5' "$input_file")
|
|
142
|
+
t_outdated=$(jq -r '.thresholds.dependency.outdated_ratio // 0.2' "$input_file")
|
|
143
|
+
|
|
144
|
+
# Alerts
|
|
145
|
+
alert_count=$(jq -r '.summary.total_alerts' "$input_file")
|
|
146
|
+
healthy_count=$(jq -r '.summary.dimensions_healthy' "$input_file")
|
|
147
|
+
|
|
148
|
+
# Health status helper
|
|
149
|
+
health_status() {
|
|
150
|
+
local value="$1"
|
|
151
|
+
local threshold="$2"
|
|
152
|
+
local compare="${3:-lt}" # lt = less than is healthy, gt = greater than is healthy
|
|
153
|
+
|
|
154
|
+
if [[ "$value" == "N/A" || "$value" == "null" ]]; then
|
|
155
|
+
echo "⚪"
|
|
156
|
+
return
|
|
157
|
+
fi
|
|
158
|
+
|
|
159
|
+
local result
|
|
160
|
+
if [[ "$compare" == "lt" ]]; then
|
|
161
|
+
result=$(echo "$value <= $threshold" | bc -l 2>/dev/null || echo 0)
|
|
162
|
+
else
|
|
163
|
+
result=$(echo "$value >= $threshold" | bc -l 2>/dev/null || echo 0)
|
|
164
|
+
fi
|
|
165
|
+
|
|
166
|
+
if [[ "$result" -eq 1 ]]; then
|
|
167
|
+
echo "🟢"
|
|
168
|
+
else
|
|
169
|
+
echo "🔴"
|
|
170
|
+
fi
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
# ============================================================================
|
|
174
|
+
# Generate report
|
|
175
|
+
# ============================================================================
|
|
176
|
+
|
|
177
|
+
cat > "$output_file" << EOF
|
|
178
|
+
# System Entropy Report
|
|
179
|
+
|
|
180
|
+
> Generated: ${timestamp}
|
|
181
|
+
> Project path: ${project}
|
|
182
|
+
> Analysis period: ${days} days
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## Overview
|
|
187
|
+
|
|
188
|
+
| Dimension | Health Status | Key Metric |
|
|
189
|
+
|-----------|---------------|------------|
|
|
190
|
+
| Structural Entropy | $(health_status "$file_p95" "$t_file_p95" "lt") | File lines P95: ${file_p95} |
|
|
191
|
+
| Change Entropy | $(health_status "$hotspot_ratio" "$t_hotspot" "lt") | Hotspot file ratio: ${hotspot_ratio} |
|
|
192
|
+
| Test Entropy | $(health_status "$test_code_ratio" "$t_test_ratio" "gt") | Test/code ratio: ${test_code_ratio} |
|
|
193
|
+
| Dependency Entropy | $(health_status "$outdated_ratio" "$t_outdated" "lt") | Outdated dependency ratio: ${outdated_ratio} |
|
|
194
|
+
|
|
195
|
+
**Healthy dimensions**: ${healthy_count}/4 | **Alerts**: ${alert_count}
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
## A) Structural Entropy
|
|
200
|
+
|
|
201
|
+
> Source: Static code analysis
|
|
202
|
+
|
|
203
|
+
| Metric | Current Value | Threshold | Status |
|
|
204
|
+
|--------|---------------|-----------|--------|
|
|
205
|
+
| File lines P95 | ${file_p95} | < ${t_file_p95} | $(health_status "$file_p95" "$t_file_p95" "lt") |
|
|
206
|
+
| File lines mean | ${file_mean} | - | ⚪ |
|
|
207
|
+
| Cyclomatic complexity mean | ${complexity_mean} | < 10 | ⚪ |
|
|
208
|
+
| Cyclomatic complexity P95 | ${complexity_p95} | < 20 | ⚪ |
|
|
209
|
+
|
|
210
|
+
**Recommendation**: Focus on files above P95, consider splitting.
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
214
|
+
## B) Change Entropy
|
|
215
|
+
|
|
216
|
+
> Source: Git history analysis (past ${days} days)
|
|
217
|
+
|
|
218
|
+
| Metric | Current Value | Threshold | Status |
|
|
219
|
+
|--------|---------------|-----------|--------|
|
|
220
|
+
| Hotspot file count | ${hotspot_count} / ${total_files} | - | ⚪ |
|
|
221
|
+
| Hotspot file ratio | ${hotspot_ratio} | < ${t_hotspot} | $(health_status "$hotspot_ratio" "$t_hotspot" "lt") |
|
|
222
|
+
|
|
223
|
+
**Hotspot definition**: Files modified more than 5 times during the analysis period
|
|
224
|
+
|
|
225
|
+
**Recommendation**: Frequently modified files may need refactoring or splitting.
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
## C) Test Entropy
|
|
230
|
+
|
|
231
|
+
> Source: Test file statistics
|
|
232
|
+
|
|
233
|
+
| Metric | Current Value | Threshold | Status |
|
|
234
|
+
|--------|---------------|-----------|--------|
|
|
235
|
+
| Test code lines | ${test_lines} | - | ⚪ |
|
|
236
|
+
| Production code lines | ${code_lines} | - | ⚪ |
|
|
237
|
+
| Test/code ratio | ${test_code_ratio} | > ${t_test_ratio} | $(health_status "$test_code_ratio" "$t_test_ratio" "gt") |
|
|
238
|
+
| Flaky test ratio | ${flaky_ratio} | < 0.01 | ⚪ |
|
|
239
|
+
| Code coverage | ${coverage} | > 0.7 | ⚪ |
|
|
240
|
+
|
|
241
|
+
**Recommendation**: When test/code ratio is below 0.5, prioritize adding tests.
|
|
242
|
+
|
|
243
|
+
---
|
|
244
|
+
|
|
245
|
+
## D) Dependency Entropy
|
|
246
|
+
|
|
247
|
+
> Source: Dependency analysis
|
|
248
|
+
|
|
249
|
+
| Metric | Current Value | Threshold | Status |
|
|
250
|
+
|--------|---------------|-----------|--------|
|
|
251
|
+
| Outdated dependency count | ${outdated} / ${total_deps} | - | ⚪ |
|
|
252
|
+
| Outdated dependency ratio | ${outdated_ratio} | < ${t_outdated} | $(health_status "$outdated_ratio" "$t_outdated" "lt") |
|
|
253
|
+
| Security vulnerability count | ${vulnerabilities} | = 0 | $(health_status "$vulnerabilities" "0" "lt") |
|
|
254
|
+
|
|
255
|
+
**Recommendation**: Regularly update dependencies, prioritize fixing security vulnerabilities.
|
|
256
|
+
|
|
257
|
+
---
|
|
258
|
+
|
|
259
|
+
## Alert Details
|
|
260
|
+
|
|
261
|
+
EOF
|
|
262
|
+
|
|
263
|
+
# Add alerts
|
|
264
|
+
if [[ "$alert_count" -gt 0 ]]; then
|
|
265
|
+
jq -r '.alerts[] | "- **[\(.level | ascii_upcase)]** \(.dimension): \(.message)"' "$input_file" >> "$output_file"
|
|
266
|
+
else
|
|
267
|
+
echo "No alerts" >> "$output_file"
|
|
268
|
+
fi
|
|
269
|
+
|
|
270
|
+
cat >> "$output_file" << EOF
|
|
271
|
+
|
|
272
|
+
---
|
|
273
|
+
|
|
274
|
+
## Trend Analysis
|
|
275
|
+
|
|
276
|
+
> Trend charts can be generated after multiple data collections
|
|
277
|
+
|
|
278
|
+
View historical data: \`${entropy_dir}/history.json\`
|
|
279
|
+
|
|
280
|
+
---
|
|
281
|
+
|
|
282
|
+
## Recommended Actions
|
|
283
|
+
|
|
284
|
+
EOF
|
|
285
|
+
|
|
286
|
+
# Generate recommendations based on alerts
|
|
287
|
+
if [[ "$alert_count" -gt 0 ]]; then
|
|
288
|
+
echo "1. Address high-priority issues from the alerts above" >> "$output_file"
|
|
289
|
+
echo "2. Run \`change-check.sh\` to ensure change package completeness" >> "$output_file"
|
|
290
|
+
echo "3. Consider using \`devbooks-proposal-author\` to initiate refactoring proposal" >> "$output_file"
|
|
291
|
+
else
|
|
292
|
+
echo "No urgent action needed currently, recommend regular monitoring of entropy metrics." >> "$output_file"
|
|
293
|
+
fi
|
|
294
|
+
|
|
295
|
+
cat >> "$output_file" << EOF
|
|
296
|
+
|
|
297
|
+
---
|
|
298
|
+
|
|
299
|
+
*Report automatically generated by entropy-report.sh*
|
|
300
|
+
*Reference: "The Mythical Man-Month" Chapter 16 "No Silver Bullet"*
|
|
301
|
+
EOF
|
|
302
|
+
|
|
303
|
+
echo "ok: report generated: ${output_file}"
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "1.0.0",
|
|
3
|
+
"description": "Entropy thresholds configuration for DevBooks entropy-monitor",
|
|
4
|
+
"last_updated": "YYYY-MM-DD",
|
|
5
|
+
"updated_by": "YOUR_NAME",
|
|
6
|
+
|
|
7
|
+
"structural": {
|
|
8
|
+
"_comment": "Static code complexity metrics",
|
|
9
|
+
"complexity_mean": {
|
|
10
|
+
"value": 10,
|
|
11
|
+
"description": "Average cyclomatic complexity per function",
|
|
12
|
+
"action": "Refactor complex functions into smaller units"
|
|
13
|
+
},
|
|
14
|
+
"complexity_p95": {
|
|
15
|
+
"value": 20,
|
|
16
|
+
"description": "95th percentile cyclomatic complexity",
|
|
17
|
+
"action": "Review and simplify extremely complex functions"
|
|
18
|
+
},
|
|
19
|
+
"file_lines_p95": {
|
|
20
|
+
"value": 500,
|
|
21
|
+
"description": "95th percentile file line count",
|
|
22
|
+
"action": "Split large files into focused modules"
|
|
23
|
+
},
|
|
24
|
+
"function_lines_p95": {
|
|
25
|
+
"value": 50,
|
|
26
|
+
"description": "95th percentile function line count",
|
|
27
|
+
"action": "Extract helper functions from long methods"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
"change": {
|
|
32
|
+
"_comment": "Git history analysis metrics",
|
|
33
|
+
"hotspot_ratio": {
|
|
34
|
+
"value": 0.1,
|
|
35
|
+
"description": "Ratio of frequently-changed files (>5 changes in period)",
|
|
36
|
+
"action": "Investigate and refactor hotspot files"
|
|
37
|
+
},
|
|
38
|
+
"coupling_ratio": {
|
|
39
|
+
"value": 0.3,
|
|
40
|
+
"description": "Ratio of files that change together",
|
|
41
|
+
"action": "Review architectural boundaries"
|
|
42
|
+
},
|
|
43
|
+
"churn_ratio": {
|
|
44
|
+
"value": 0.5,
|
|
45
|
+
"description": "Ratio of code added then removed within period",
|
|
46
|
+
"action": "Improve upfront design and planning"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
"test": {
|
|
51
|
+
"_comment": "Test quality metrics",
|
|
52
|
+
"flaky_ratio": {
|
|
53
|
+
"value": 0.01,
|
|
54
|
+
"description": "Ratio of tests with inconsistent results",
|
|
55
|
+
"action": "Fix or quarantine flaky tests immediately"
|
|
56
|
+
},
|
|
57
|
+
"coverage_min": {
|
|
58
|
+
"value": 0.7,
|
|
59
|
+
"description": "Minimum code coverage ratio",
|
|
60
|
+
"action": "Add tests for uncovered critical paths"
|
|
61
|
+
},
|
|
62
|
+
"test_code_ratio_min": {
|
|
63
|
+
"value": 0.5,
|
|
64
|
+
"description": "Minimum test lines / production lines ratio",
|
|
65
|
+
"action": "Increase test investment"
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
"dependency": {
|
|
70
|
+
"_comment": "External dependency health metrics",
|
|
71
|
+
"outdated_ratio": {
|
|
72
|
+
"value": 0.2,
|
|
73
|
+
"description": "Ratio of dependencies >2 major versions behind",
|
|
74
|
+
"action": "Schedule dependency update sprint"
|
|
75
|
+
},
|
|
76
|
+
"vulnerabilities": {
|
|
77
|
+
"value": 0,
|
|
78
|
+
"description": "Number of high/critical security vulnerabilities",
|
|
79
|
+
"action": "Fix security issues immediately"
|
|
80
|
+
},
|
|
81
|
+
"depth_p95": {
|
|
82
|
+
"value": 10,
|
|
83
|
+
"description": "95th percentile of transitive dependency depth",
|
|
84
|
+
"action": "Evaluate alternative lighter dependencies"
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
|
|
88
|
+
"alert_levels": {
|
|
89
|
+
"_comment": "When to escalate alerts",
|
|
90
|
+
"warning": {
|
|
91
|
+
"description": "Single threshold exceeded",
|
|
92
|
+
"action": "Document in next sprint planning"
|
|
93
|
+
},
|
|
94
|
+
"critical": {
|
|
95
|
+
"description": "Multiple thresholds exceeded or 2x single threshold",
|
|
96
|
+
"action": "Create immediate remediation proposal"
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: devbooks-federation
|
|
3
|
+
description: devbooks-federation:跨仓库联邦分析与契约同步。当变更涉及对外 API/契约、或需要分析跨仓库影响时使用。用户说"跨仓库影响/联邦分析/契约同步/上下游依赖/多仓库"等时使用。
|
|
4
|
+
tools:
|
|
5
|
+
- Glob
|
|
6
|
+
- Read
|
|
7
|
+
- Bash
|
|
8
|
+
- mcp__ckb__analyzeImpact
|
|
9
|
+
- mcp__ckb__findReferences
|
|
10
|
+
- mcp__github__search_code
|
|
11
|
+
- mcp__github__create_issue
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# DevBooks:跨仓库联邦分析(Federation Analysis)
|
|
15
|
+
|
|
16
|
+
## 触发条件
|
|
17
|
+
|
|
18
|
+
以下任一条件满足时自动执行:
|
|
19
|
+
1. 用户说"跨仓库影响/联邦分析/契约同步/上下游依赖/多仓库"
|
|
20
|
+
2. `devbooks-impact-analysis` 检测到变更涉及 `federation.yaml` 中定义的契约文件
|
|
21
|
+
3. 用户在 `proposal.md` 中标记了 `Impact: Cross-Repo`
|
|
22
|
+
|
|
23
|
+
## 前置条件
|
|
24
|
+
|
|
25
|
+
- 项目根目录存在 `.devbooks/federation.yaml` 或 `dev-playbooks/federation.yaml`
|
|
26
|
+
- 如需跨仓库搜索,需要 GitHub MCP 已配置
|
|
27
|
+
|
|
28
|
+
## 执行流程
|
|
29
|
+
|
|
30
|
+
### Step 1: 加载联邦配置
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
# 检测联邦配置文件
|
|
34
|
+
if [ -f ".devbooks/federation.yaml" ]; then
|
|
35
|
+
FEDERATION_CONFIG=".devbooks/federation.yaml"
|
|
36
|
+
elif [ -f "dev-playbooks/federation.yaml" ]; then
|
|
37
|
+
FEDERATION_CONFIG="dev-playbooks/federation.yaml"
|
|
38
|
+
else
|
|
39
|
+
echo "未找到联邦配置,请先创建 federation.yaml"
|
|
40
|
+
exit 1
|
|
41
|
+
fi
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
读取配置后提取:
|
|
45
|
+
- 上游依赖列表(我依赖谁)
|
|
46
|
+
- 下游消费者列表(谁依赖我)
|
|
47
|
+
- 契约文件列表
|
|
48
|
+
|
|
49
|
+
### Step 2: 识别契约变更
|
|
50
|
+
|
|
51
|
+
检查本次变更是否涉及契约文件:
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
变更文件 ∩ 契约文件 = 契约变更集
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
契约变更分类:
|
|
58
|
+
- **Breaking**:删除/重命名导出、修改必填参数、改变返回类型
|
|
59
|
+
- **Deprecation**:新增 `@deprecated` 注解
|
|
60
|
+
- **Enhancement**:新增可选参数、新增导出
|
|
61
|
+
- **Patch**:内部实现变更,不影响签名
|
|
62
|
+
|
|
63
|
+
### Step 3: 跨仓库影响分析
|
|
64
|
+
|
|
65
|
+
对于涉及契约变更的情况:
|
|
66
|
+
|
|
67
|
+
1. **本地分析**(使用 CKB)
|
|
68
|
+
```
|
|
69
|
+
mcp__ckb__findReferences(symbolId=<契约符号>)
|
|
70
|
+
mcp__ckb__analyzeImpact(symbolId=<契约符号>)
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
2. **远程搜索**(使用 GitHub MCP)
|
|
74
|
+
```
|
|
75
|
+
mcp__github__search_code(query="<契约名> org:<org>")
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
3. **整合结果**
|
|
79
|
+
- 本仓库内引用
|
|
80
|
+
- 下游仓库引用(来自 GitHub 搜索)
|
|
81
|
+
- 潜在影响范围估算
|
|
82
|
+
|
|
83
|
+
### Step 4: 生成联邦影响报告
|
|
84
|
+
|
|
85
|
+
输出格式:
|
|
86
|
+
|
|
87
|
+
```markdown
|
|
88
|
+
# 跨仓库影响分析报告
|
|
89
|
+
|
|
90
|
+
## 变更概要
|
|
91
|
+
|
|
92
|
+
| 契约文件 | 变更类型 | 影响级别 |
|
|
93
|
+
|---------|---------|---------|
|
|
94
|
+
| `src/api/v1/user.ts` | Breaking | 🔴 Critical |
|
|
95
|
+
| `src/types/order.ts` | Enhancement | 🟢 Safe |
|
|
96
|
+
|
|
97
|
+
## 本仓库影响
|
|
98
|
+
|
|
99
|
+
- 内部引用数:15
|
|
100
|
+
- 受影响模块:`services/`, `handlers/`
|
|
101
|
+
|
|
102
|
+
## 跨仓库影响
|
|
103
|
+
|
|
104
|
+
### 下游消费者
|
|
105
|
+
|
|
106
|
+
| 仓库 | 引用数 | 状态 |
|
|
107
|
+
|-----|-------|------|
|
|
108
|
+
| org/web-app | 8 | ⚠️ 需要同步 |
|
|
109
|
+
| org/mobile-app | 3 | ⚠️ 需要同步 |
|
|
110
|
+
|
|
111
|
+
### 建议动作
|
|
112
|
+
|
|
113
|
+
1. [ ] 在 org/web-app 创建适配 Issue
|
|
114
|
+
2. [ ] 在 org/mobile-app 创建适配 Issue
|
|
115
|
+
3. [ ] 更新 CHANGELOG
|
|
116
|
+
4. [ ] 发送 Slack 通知
|
|
117
|
+
|
|
118
|
+
## 兼容性策略
|
|
119
|
+
|
|
120
|
+
- [ ] 保持旧 API 可用(双写期)
|
|
121
|
+
- [ ] 添加 `@deprecated` 注解
|
|
122
|
+
- [ ] 设置移除日期:YYYY-MM-DD
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Step 5: 自动通知(可选)
|
|
126
|
+
|
|
127
|
+
如果配置了 `notify_on_change: true`:
|
|
128
|
+
|
|
129
|
+
1. 在下游仓库创建 Issue(使用 GitHub MCP)
|
|
130
|
+
2. 发送 Slack 通知(需配置 webhook)
|
|
131
|
+
|
|
132
|
+
Issue 模板:
|
|
133
|
+
```markdown
|
|
134
|
+
## 上游契约变更通知
|
|
135
|
+
|
|
136
|
+
**来源仓库**:org/my-service
|
|
137
|
+
**变更类型**:Breaking Change
|
|
138
|
+
**预计移除日期**:YYYY-MM-DD
|
|
139
|
+
|
|
140
|
+
### 受影响的契约
|
|
141
|
+
|
|
142
|
+
- `UserService.getUser()` - 参数签名变更
|
|
143
|
+
|
|
144
|
+
### 建议动作
|
|
145
|
+
|
|
146
|
+
请在 [deadline] 前完成以下适配:
|
|
147
|
+
1. 更新调用处以适配新签名
|
|
148
|
+
2. 运行测试确保兼容
|
|
149
|
+
|
|
150
|
+
### 相关链接
|
|
151
|
+
|
|
152
|
+
- 变更 PR:org/my-service#123
|
|
153
|
+
- 迁移指南:[链接]
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## 脚本支持
|
|
157
|
+
|
|
158
|
+
### 联邦检查脚本
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
# 检查联邦约束
|
|
162
|
+
bash skills/devbooks-federation/scripts/federation-check.sh \
|
|
163
|
+
--project-root "$(pwd)" \
|
|
164
|
+
--change-files "src/api/v1/user.ts,src/types/order.ts"
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### 契约同步脚本
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
# 生成下游通知
|
|
171
|
+
bash skills/devbooks-federation/scripts/federation-notify.sh \
|
|
172
|
+
--project-root "$(pwd)" \
|
|
173
|
+
--change-type breaking \
|
|
174
|
+
--dry-run
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
## 与其他 Skills 的协作
|
|
178
|
+
|
|
179
|
+
- `devbooks-impact-analysis`:检测到跨仓库影响时自动调用本 Skill
|
|
180
|
+
- `devbooks-spec-contract`:契约定义变更时同步触发(合并了原 spec-delta + contract-data)
|
|
181
|
+
- `devbooks-proposal-author`:在 proposal.md 中自动标记 Cross-Repo Impact
|
|
182
|
+
|
|
183
|
+
## 注意事项
|
|
184
|
+
|
|
185
|
+
1. 跨仓库搜索依赖 GitHub MCP,需要适当的访问权限
|
|
186
|
+
2. 大型组织的搜索可能耗时较长,建议缩小搜索范围
|
|
187
|
+
3. 联邦配置应与团队同步,确保上下游信息准确
|
|
188
|
+
4. Breaking 变更建议使用语义版本控制(SemVer)
|
|
189
|
+
|
|
190
|
+
## 参考
|
|
191
|
+
|
|
192
|
+
- [API Versioning Best Practices](https://swagger.io/resources/articles/best-practices-in-api-versioning/)
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## 上下文感知
|
|
197
|
+
|
|
198
|
+
本 Skill 在执行前自动检测上下文,选择合适的分析范围。
|
|
199
|
+
|
|
200
|
+
检测规则参考:`skills/_shared/context-detection-template.md`
|
|
201
|
+
|
|
202
|
+
### 检测流程
|
|
203
|
+
|
|
204
|
+
1. 检测 `federation.yaml` 是否存在
|
|
205
|
+
2. 检测本次变更是否涉及契约文件
|
|
206
|
+
3. 检测是否有跨仓库影响标记
|
|
207
|
+
|
|
208
|
+
### 本 Skill 支持的模式
|
|
209
|
+
|
|
210
|
+
| 模式 | 触发条件 | 行为 |
|
|
211
|
+
|------|----------|------|
|
|
212
|
+
| **本地分析** | 契约变更但无跨仓库配置 | 只分析本仓库内引用 |
|
|
213
|
+
| **联邦分析** | federation.yaml 存在 | 分析上下游仓库影响 |
|
|
214
|
+
| **通知模式** | 配置 notify_on_change=true | 自动创建下游 Issue |
|
|
215
|
+
|
|
216
|
+
### 检测输出示例
|
|
217
|
+
|
|
218
|
+
```
|
|
219
|
+
检测结果:
|
|
220
|
+
- federation.yaml:存在
|
|
221
|
+
- 契约变更:2 个文件
|
|
222
|
+
- 跨仓库标记:是
|
|
223
|
+
- 运行模式:联邦分析
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
---
|
|
227
|
+
|
|
228
|
+
## MCP 增强
|
|
229
|
+
|
|
230
|
+
本 Skill 支持 MCP 运行时增强,自动检测并启用高级功能。
|
|
231
|
+
|
|
232
|
+
MCP 增强规则参考:`skills/_shared/mcp-enhancement-template.md`
|
|
233
|
+
|
|
234
|
+
### 依赖的 MCP 服务
|
|
235
|
+
|
|
236
|
+
| 服务 | 用途 | 超时 |
|
|
237
|
+
|------|------|------|
|
|
238
|
+
| `mcp__ckb__analyzeImpact` | 符号级影响分析 | 2s |
|
|
239
|
+
| `mcp__ckb__findReferences` | 本仓库引用查找 | 2s |
|
|
240
|
+
| `mcp__github__search_code` | 跨仓库代码搜索 | 5s |
|
|
241
|
+
| `mcp__github__create_issue` | 创建下游通知 Issue | 5s |
|
|
242
|
+
|
|
243
|
+
### 检测流程
|
|
244
|
+
|
|
245
|
+
1. 调用 `mcp__ckb__findReferences` 检测本仓库引用(2s 超时)
|
|
246
|
+
2. 若需跨仓库分析 → 调用 `mcp__github__search_code`(5s 超时)
|
|
247
|
+
3. 若 GitHub MCP 不可用 → 跳过跨仓库搜索,只输出本仓库分析
|
|
248
|
+
|
|
249
|
+
### 增强模式 vs 基础模式
|
|
250
|
+
|
|
251
|
+
| 功能 | 增强模式 | 基础模式 |
|
|
252
|
+
|------|----------|----------|
|
|
253
|
+
| 本仓库引用 | CKB 精确分析 | Grep 文本搜索 |
|
|
254
|
+
| 跨仓库搜索 | GitHub API 搜索 | 不可用 |
|
|
255
|
+
| 自动通知 | 创建下游 Issue | 手动通知 |
|
|
256
|
+
|
|
257
|
+
### 降级提示
|
|
258
|
+
|
|
259
|
+
当 MCP 不可用时,输出以下提示:
|
|
260
|
+
|
|
261
|
+
```
|
|
262
|
+
⚠️ GitHub MCP 不可用,无法进行跨仓库搜索。
|
|
263
|
+
只能分析本仓库内的引用情况,跨仓库影响需手动确认。
|
|
264
|
+
```
|