@devflow-tools/cli 0.16.10 → 0.16.12

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 (59) hide show
  1. package/dist/commands/doctor.d.ts +5 -0
  2. package/dist/commands/doctor.d.ts.map +1 -1
  3. package/dist/commands/doctor.js +408 -16
  4. package/dist/commands/doctor.js.map +1 -1
  5. package/dist/commands/embeddings.d.ts +8 -0
  6. package/dist/commands/embeddings.d.ts.map +1 -0
  7. package/dist/commands/embeddings.js +26 -0
  8. package/dist/commands/embeddings.js.map +1 -0
  9. package/dist/commands/setup.d.ts +25 -2
  10. package/dist/commands/setup.d.ts.map +1 -1
  11. package/dist/commands/setup.js +71 -63
  12. package/dist/commands/setup.js.map +1 -1
  13. package/dist/index.js +52 -2
  14. package/dist/index.js.map +1 -1
  15. package/dist/plugin-files/.claude-plugin/plugin.json +1 -1
  16. package/dist/plugin-files/dist/command-registry.json +39 -13
  17. package/dist/plugin-files/dist/hooks/hook-client.js +5 -5
  18. package/dist/plugin-files/dist/hooks/hook-daemon.js +32 -14
  19. package/dist/plugin-files/dist/hooks/memory-snapshot-cache.js +11 -0
  20. package/dist/plugin-files/dist/hooks/post-tool-use-failure.js +2 -2
  21. package/dist/plugin-files/dist/hooks/post-tool-use.js +6 -3
  22. package/dist/plugin-files/dist/hooks/pre-compact.js +2 -2
  23. package/dist/plugin-files/dist/hooks/pre-tool-use.js +2 -2
  24. package/dist/plugin-files/dist/hooks/session-end.js +2 -2
  25. package/dist/plugin-files/dist/hooks/stop.js +15 -2
  26. package/dist/plugin-files/dist/hooks/user-prompt-submit.js +14 -5
  27. package/dist/plugin-files/dist/skills/devflow:animation/SKILL.md +3 -1
  28. package/dist/plugin-files/dist/skills/devflow:css/SKILL.md +3 -1
  29. package/dist/plugin-files/dist/skills/devflow:docker/SKILL.md +3 -1
  30. package/dist/plugin-files/dist/skills/devflow:electron/SKILL.md +3 -1
  31. package/dist/plugin-files/dist/skills/devflow:git/SKILL.md +3 -1
  32. package/dist/plugin-files/dist/skills/devflow:graphql/SKILL.md +3 -1
  33. package/dist/plugin-files/dist/skills/devflow:nest/SKILL.md +3 -1
  34. package/dist/plugin-files/dist/skills/devflow:nextjs/SKILL.md +3 -1
  35. package/dist/plugin-files/dist/skills/devflow:performance/SKILL.md +3 -1
  36. package/dist/plugin-files/dist/skills/devflow:react/SKILL.md +14 -4
  37. package/dist/plugin-files/dist/skills/devflow:tailwind/SKILL.md +3 -1
  38. package/dist/plugin-files/dist/skills/devflow:taro/SKILL.md +3 -1
  39. package/dist/plugin-files/dist/skills/devflow:ui-layout/SKILL.md +3 -1
  40. package/dist/plugin-files/dist/skills/devflow:vue/SKILL.md +3 -1
  41. package/dist/plugin-files/hooks/hooks.json +3 -2
  42. package/dist/plugin-files/hooks/session-start +66 -82
  43. package/dist/plugin-files/package.json +7 -7
  44. package/dist/plugin-files/skills/animation/SKILL.md +3 -1
  45. package/dist/plugin-files/skills/css/SKILL.md +3 -1
  46. package/dist/plugin-files/skills/docker/SKILL.md +3 -1
  47. package/dist/plugin-files/skills/doctor/SKILL.md +1 -1
  48. package/dist/plugin-files/skills/electron/SKILL.md +3 -1
  49. package/dist/plugin-files/skills/git/SKILL.md +3 -1
  50. package/dist/plugin-files/skills/graphql/SKILL.md +3 -1
  51. package/dist/plugin-files/skills/nest/SKILL.md +3 -1
  52. package/dist/plugin-files/skills/nextjs/SKILL.md +3 -1
  53. package/dist/plugin-files/skills/performance/SKILL.md +3 -1
  54. package/dist/plugin-files/skills/react/SKILL.md +14 -4
  55. package/dist/plugin-files/skills/tailwind/SKILL.md +3 -1
  56. package/dist/plugin-files/skills/taro/SKILL.md +3 -1
  57. package/dist/plugin-files/skills/ui-layout/SKILL.md +3 -1
  58. package/dist/plugin-files/skills/vue/SKILL.md +3 -1
  59. package/package.json +27 -27
@@ -4,58 +4,10 @@ set -euo pipefail
4
4
  PROJECT_ROOT="${CLAUDE_PROJECT_DIR:-$(pwd)}"
5
5
  SESSION_START_INPUT="$(cat)"
6
6
 
7
- # Try to get project summary from devflow doctor
8
- SUMMARY=""
9
- DOCTOR_OUTPUT=""
10
-
11
- # Try global devflow first, then npx fallback
12
- if command -v devflow &>/dev/null; then
13
- DOCTOR_OUTPUT=$(devflow doctor --json 2>/dev/null || echo "")
14
- elif command -v npx &>/dev/null; then
15
- DOCTOR_OUTPUT=$(npx --yes @devflow-tools/cli doctor --json 2>/dev/null || echo "")
16
- fi
17
-
18
- if [ -n "$DOCTOR_OUTPUT" ] && echo "$DOCTOR_OUTPUT" | python3 -c "import sys,json; json.load(sys.stdin)" 2>/dev/null; then
19
- SUMMARY=$(
20
- DEVFLOW_DOCTOR_OUTPUT="$DOCTOR_OUTPUT" python3 - 2>/dev/null <<'PY'
21
- import json, os
22
- from pathlib import Path
23
-
24
- d = json.loads(os.environ.get('DEVFLOW_DOCTOR_OUTPUT', '{}'))
25
- metrics = {}
26
- red_sections = []
27
- for section in d.get('sections', []):
28
- if section.get('status') == 'red':
29
- red_sections.append(str(section.get('name', '')).strip())
30
- for metric in section.get('metrics', []):
31
- key = metric.get('key')
32
- if key:
33
- metrics[key] = metric.get('value')
34
-
35
- # One-release compatibility with the previous top-level doctor schema.
36
- legacy_project = d.get('project', {}) if isinstance(d.get('project'), dict) else {}
37
- project_root = metrics.get('canonical_project') or legacy_project.get('rootPath') or ''
38
- project_name = legacy_project.get('name') or d.get('projectName') or (Path(project_root).name if project_root else '')
39
- parts = ['DevFlow 已就绪']
40
- if project_name:
41
- parts.append(f'项目 {project_name}')
42
- nodes = metrics.get('codegraph_nodes')
43
- if isinstance(nodes, (int, float)):
44
- parts.append(f'代码图 {int(nodes)} 个节点')
45
- plugin_source = metrics.get('active_skill_source')
46
- if isinstance(plugin_source, str) and plugin_source:
47
- parts.append(f'技能来源 {plugin_source}')
48
- if red_sections:
49
- parts.append('需处理 ' + ', '.join(x for x in red_sections if x))
50
- print('。'.join(parts) + '。使用 /devflow:context 查代码,/devflow:react 获取 React 专家能力。')
51
- PY
52
- ) || SUMMARY=""
53
- if [ -z "$SUMMARY" ]; then
54
- SUMMARY="DevFlow 插件已加载。Doctor 状态暂不可用,运行 devflow doctor 查看详情。"
55
- fi
56
- else
57
- SUMMARY="DevFlow 插件已加载。如尚未初始化项目,请运行 devflow init。使用 /devflow 查看可用命令。"
58
- fi
7
+ # SessionStart must not synchronously run Doctor. Full diagnostics can touch
8
+ # several databases and exceed the lifecycle acknowledgement budget.
9
+ PROJECT_NAME="$(basename "$PROJECT_ROOT")"
10
+ SUMMARY="DevFlow 已就绪。项目 ${PROJECT_NAME}。使用 /devflow 查看全部已安装能力,并按项目技术栈选择对应的 /devflow:* 领域 Skill;运行 devflow doctor 查看完整健康状态。"
59
11
 
60
12
  # Generate session token for MCP Gateway authentication
61
13
  # Clean up stale receipt from previous session
@@ -130,7 +82,7 @@ MCP_PROTOCOL="
130
82
  不要跳过这一步。不要用 Explore、Agent、Grep 或 Bash 代替。
131
83
 
132
84
  ### Step 2: 按需调用领域工具
133
- 根据技能类型调用对应的 MCP 工具:
85
+ 根据已加载 Skill 和 command registry 调用对应的 MCP 工具。以下仅为高频示例,完整能力以 /devflow 列表和 command registry 为准:
134
86
  - React 性能问题 → mcp__devflow__react_audit_performance(参数:{\"projectRoot\": \"\${CLAUDE_PROJECT_DIR}\"})
135
87
  - React Bug → mcp__devflow__react_diagnose_bug
136
88
  - React Hooks 审查 → mcp__devflow__react_review_hooks
@@ -148,6 +100,9 @@ MCP_PROTOCOL="
148
100
  - 如果 MCP 工具返回错误,重试一次;再失败则回退到直接读文件"
149
101
 
150
102
  DEVFLOW_DAEMON_REACHABLE=0
103
+ DEVFLOW_DAEMON_LAUNCHING=0
104
+ DEVFLOW_SESSION_DURABLE=0
105
+ DEVFLOW_SESSION_RECEIPT=""
151
106
  DAEMON_SESSION_RESPONSE=""
152
107
  run_lifecycle() {
153
108
  local PROJECT_HASH=""
@@ -179,36 +134,53 @@ run_lifecycle() {
179
134
  [ -n "$SESSION_START_INPUT" ] || return 0
180
135
  [ -f "$CLIENT_JS" ] || return 1
181
136
  if response=$(DEVFLOW_HOOK_CLIENT_TIMEOUT_MS=250 \
182
- DEVFLOW_HOOK_CLIENT_RETRY_DELAY_MS=50 \
137
+ DEVFLOW_HOOK_CLIENT_RETRY_DELAY_MS=0 \
183
138
  DEVFLOW_HOOK_CLIENT_SUPPRESS_FALLBACK_LOG="$suppress_fallback" \
184
139
  node "$CLIENT_JS" session-start "$SESSION_START_INPUT" 2>> "$DAEMON_LOG"); then
185
140
  DEVFLOW_DAEMON_REACHABLE=1
141
+ DEVFLOW_SESSION_DURABLE=1
186
142
  DAEMON_SESSION_RESPONSE="$response"
187
143
  return 0
188
144
  fi
189
145
  return 1
190
146
  }
191
147
 
148
+ queue_session_start() {
149
+ [ -n "$SESSION_START_INPUT" ] || return 1
150
+ [ -n "$PROJECT_HASH" ] || return 1
151
+ local queue_dir="${HOME}/.devflow/state/${PROJECT_HASH}/session-start-pending"
152
+ local receipt_id="session-start-spool-${PROJECT_HASH}-$(date +%s)-$$"
153
+ local temp_file="${queue_dir}/.${receipt_id}.tmp"
154
+ local target_file="${queue_dir}/${receipt_id}.json"
155
+ mkdir -p "$queue_dir" 2>/dev/null || return 1
156
+ if (umask 077 && printf '%s' "$SESSION_START_INPUT" > "$temp_file") 2>/dev/null \
157
+ && mv "$temp_file" "$target_file" 2>/dev/null; then
158
+ DEVFLOW_SESSION_DURABLE=1
159
+ DEVFLOW_SESSION_RECEIPT="$receipt_id"
160
+ return 0
161
+ fi
162
+ rm -f "$temp_file" 2>/dev/null || true
163
+ return 1
164
+ }
165
+
192
166
  if [ -n "$SESSION_START_INPUT" ] && register_session 1; then
193
167
  :
194
168
  elif [ -f "$DAEMON_JS" ] && command -v nohup >/dev/null 2>&1 && command -v node >/dev/null 2>&1; then
195
- if [ -n "$SESSION_START_INPUT" ]; then
169
+ if [ -n "$SESSION_START_INPUT" ] && queue_session_start; then
170
+ nohup node "$DAEMON_JS" "$PROJECT_ROOT" </dev/null >> "$DAEMON_LOG" 2>&1 &
171
+ elif [ -n "$SESSION_START_INPUT" ]; then
196
172
  nohup node "$DAEMON_JS" "$PROJECT_ROOT" "$SESSION_START_INPUT" </dev/null >> "$DAEMON_LOG" 2>&1 &
197
173
  else
198
174
  nohup node "$DAEMON_JS" "$PROJECT_ROOT" </dev/null >> "$DAEMON_LOG" 2>&1 &
199
175
  fi
200
176
  DAEMON_PID=$!
177
+ DEVFLOW_DAEMON_LAUNCHING=1
201
178
  echo "[devflow] Hook daemon started for ${PROJECT_ROOT} (PID ${DAEMON_PID})" >&2 || true
202
-
203
- if [ -n "$SESSION_START_INPUT" ]; then
204
- for _ in 1 2 3 4 5 6 7 8; do
205
- register_session 1 && break
206
- sleep 0.05
207
- done
208
- fi
209
179
  fi
210
180
 
211
- if [ -n "$SESSION_START_INPUT" ] && [ "$DEVFLOW_DAEMON_REACHABLE" != "1" ]; then
181
+ if [ -n "$SESSION_START_INPUT" ] \
182
+ && [ "$DEVFLOW_DAEMON_REACHABLE" != "1" ] \
183
+ && [ "$DEVFLOW_DAEMON_LAUNCHING" != "1" ]; then
212
184
  register_session 0 || true
213
185
  fi
214
186
 
@@ -221,30 +193,38 @@ run_lifecycle() {
221
193
  run_lifecycle || true
222
194
 
223
195
  DEGRADED_CONTEXT=""
224
- if [ "$DEVFLOW_DAEMON_REACHABLE" != "1" ]; then
196
+ if [ "$DEVFLOW_DAEMON_LAUNCHING" = "1" ]; then
197
+ if [ "$DEVFLOW_SESSION_DURABLE" = "1" ]; then
198
+ DEGRADED_CONTEXT="
199
+
200
+ DevFlow SessionStart status=accepted; durable=true; receiptId=${DEVFLOW_SESSION_RECEIPT:-daemon-receipt}; daemon registration is pending while the runtime warms."
201
+ else
202
+ DEGRADED_CONTEXT="
203
+
204
+ WARNING: DevFlow daemon launch was requested, but SessionStart persistence was not confirmed. Continue in degraded mode and do not treat lifecycle registration as completed."
205
+ fi
206
+ elif [ "$DEVFLOW_DAEMON_REACHABLE" != "1" ]; then
225
207
  DEGRADED_CONTEXT="
226
208
 
227
209
  WARNING: DevFlow is in degraded mode (daemon unreachable): 4-Gate enforcement is unavailable, memory prefetch cache is unavailable, and daemon-shared Hook state is unavailable. Run devflow doctor for details."
228
210
  fi
229
211
 
230
- MEMORY_SNAPSHOT=$'## Project memory\n本项目暂无记忆'
212
+ MEMORY_SNAPSHOT=$'## Project memory\nDevFlow memory snapshot=pending; source=none; reason=runtime_warming. Memory availability is not yet known; do not conclude that the project has no memories.'
231
213
  CONFIG_FILE="${PROJECT_ROOT}/.devflow/config.json"
232
214
  MEMORY_RESPONSE=""
233
- if [ -f "${CLIENT_JS:-}" ] && command -v node >/dev/null 2>&1; then
234
- MEMORY_RESPONSE=$(DEVFLOW_HOOK_CLIENT_TIMEOUT_MS=1000 node "$CLIENT_JS" memory-snapshot </dev/null 2>/dev/null || echo "")
215
+ if { [ "$DEVFLOW_DAEMON_REACHABLE" = "1" ] || [ -z "$SESSION_START_INPUT" ]; } \
216
+ && [ -f "${CLIENT_JS:-}" ] \
217
+ && command -v node >/dev/null 2>&1; then
218
+ MEMORY_RESPONSE=$(DEVFLOW_HOOK_CLIENT_TIMEOUT_MS=75 \
219
+ DEVFLOW_HOOK_CLIENT_RETRY_DELAY_MS=0 \
220
+ node "$CLIENT_JS" memory-snapshot </dev/null 2>/dev/null || echo "")
235
221
  fi
236
- if command -v python3 >/dev/null 2>&1; then
237
- MEMORY_SNAPSHOT=$(DEVFLOW_MEMORY_RESPONSE="$MEMORY_RESPONSE" python3 - "$CONFIG_FILE" 2>/dev/null <<'PY'
238
- import json,os,sys
239
- try: cfg=json.load(open(sys.argv[1])).get('sessionStart',{}).get('injectMemories',True)
240
- except Exception: cfg=True
241
- if cfg is False: print(''); raise SystemExit
242
- try: response=json.loads(os.environ.get('DEVFLOW_MEMORY_RESPONSE',''))
243
- except Exception: response={}
244
- markdown = response.get('markdown')
245
- print(markdown or '## Project memory\n本项目暂无记忆')
246
- PY
247
- ) || MEMORY_SNAPSHOT=$'## Project memory\n本项目暂无记忆'
222
+ MEMORY_CACHE_JS="${PLUGIN_ROOT}/dist/hooks/memory-snapshot-cache.js"
223
+ if [ -f "$MEMORY_CACHE_JS" ] && command -v node >/dev/null 2>&1; then
224
+ MEMORY_SNAPSHOT=$(DEVFLOW_MEMORY_SNAPSHOT_CLI=1 \
225
+ DEVFLOW_MEMORY_RESPONSE="$MEMORY_RESPONSE" \
226
+ node "$MEMORY_CACHE_JS" session-start "$PROJECT_ROOT" "$CONFIG_FILE" 2>/dev/null) \
227
+ || MEMORY_SNAPSHOT=$'## Project memory\nDevFlow memory snapshot=degraded; source=none; reason=cache_reader_failed. Memory availability is not yet known; do not conclude that the project has no memories.'
248
228
  fi
249
229
 
250
230
  ONBOARDING_SNAPSHOT=""
@@ -267,16 +247,20 @@ fi
267
247
 
268
248
  DAEMON_CONTEXT=""
269
249
  if [ -n "$DAEMON_SESSION_RESPONSE" ] && command -v python3 >/dev/null 2>&1; then
270
- DAEMON_CONTEXT=$(DEVFLOW_DAEMON_RESPONSE="$DAEMON_SESSION_RESPONSE" python3 -c "import json,os; print(json.loads(os.environ.get('DEVFLOW_DAEMON_RESPONSE','{}')).get('additionalContext',''))" 2>/dev/null || echo "")
250
+ DAEMON_CONTEXT=$(DEVFLOW_DAEMON_RESPONSE="$DAEMON_SESSION_RESPONSE" python3 -c "import json,os; d=json.loads(os.environ.get('DEVFLOW_DAEMON_RESPONSE','{}')); status=d.get('status'); receipt=d.get('receiptId'); work=d.get('workState'); parts=[]; parts.append(f'DevFlow SessionStart status={status}; durable=true; receiptId={receipt}; workState={work}.' if status in ('accepted','completed') and receipt else ''); parts.append(str(d.get('additionalContext',''))); print('\\n'.join(x for x in parts if x))" 2>/dev/null || echo "")
251
+ [ -z "$DAEMON_CONTEXT" ] || DAEMON_CONTEXT=$'\n\n'"${DAEMON_CONTEXT}"
271
252
  fi
272
253
 
273
254
  SUMMARY="${SUMMARY}${DEGRADED_CONTEXT}${DAEMON_CONTEXT}"$'\n\n'"${ONBOARDING_SNAPSHOT}"$'\n\n'"${MEMORY_SNAPSHOT}${MCP_PROTOCOL}"$'\n\n'"${GLOBAL_CONSTRAINT}${GATEWAY_STATUS}"
274
255
 
275
- if command -v python3 >/dev/null 2>&1 \
256
+ if command -v node >/dev/null 2>&1 \
257
+ && ESCAPED=$(printf '%s\n' "$SUMMARY" | node -e "let s=''; process.stdin.setEncoding('utf8'); process.stdin.on('data',c=>s+=c); process.stdin.on('end',()=>process.stdout.write(JSON.stringify(s)))" 2>/dev/null); then
258
+ :
259
+ elif command -v python3 >/dev/null 2>&1 \
276
260
  && ESCAPED=$(printf '%s\n' "$SUMMARY" | python3 -c "import sys,json; print(json.dumps(sys.stdin.read()))" 2>/dev/null); then
277
261
  :
278
262
  else
279
- ESCAPED='"DevFlow SessionStart 已完成。"'
263
+ ESCAPED='"DevFlow SessionStart status=degraded; memory snapshot=pending; runtime helpers unavailable. Memory availability is not yet known."'
280
264
  fi
281
265
 
282
266
  printf '{\n "hookSpecificOutput": {\n "hookEventName": "SessionStart",\n "additionalContext": %s\n }\n}\n' "$ESCAPED"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devflow-tools/claude-code-plugin",
3
- "version": "0.16.10",
3
+ "version": "0.16.11",
4
4
  "description": "DevFlow — Developer Intelligence Platform for Claude Code",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -8,18 +8,18 @@
8
8
  "deploy": "npx tsx scripts/inject-gates.ts --deploy"
9
9
  },
10
10
  "dependencies": {
11
- "@devflow-tools/database": "0.16.10",
12
- "@devflow-tools/memory-engine": "0.16.10",
13
- "@devflow-tools/sdk": "0.16.10",
14
- "@devflow-tools/telemetry": "0.16.10",
15
- "@devflow-tools/workflow-engine": "0.16.10"
11
+ "@devflow-tools/database": "0.16.11",
12
+ "@devflow-tools/memory-engine": "0.16.11",
13
+ "@devflow-tools/sdk": "0.16.11",
14
+ "@devflow-tools/telemetry": "0.16.11",
15
+ "@devflow-tools/workflow-engine": "0.16.11"
16
16
  },
17
17
  "allowScripts": {
18
18
  "better-sqlite3@12.11.1": true,
19
19
  "sharp@0.32.6": true
20
20
  },
21
21
  "devDependencies": {
22
- "@devflow-tools/mcp-server": "0.16.10"
22
+ "@devflow-tools/mcp-server": "0.16.11"
23
23
  },
24
24
  "keywords": [
25
25
  "pi-package",
@@ -25,7 +25,9 @@ description: Animation 动画专家 — CSS 动画、Framer Motion、GSAP、Lott
25
25
  - 使用 AnimatePresence 处理 React 组件退出动画
26
26
  - Lottie 动画控制文件大小 < 50KB
27
27
 
28
- ## 当前版本
28
+ ## 知识来源
29
+
30
+ 以下版本描述知识源,不代表目标项目版本;目标项目的 package.json 与 lockfile 证据始终优先。
29
31
 
30
32
  - animation-docs: 2024 — https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_animations
31
33
 
@@ -25,7 +25,9 @@ description: CSS 专家 — 布局调试、响应式审查、BEM 规范、性能
25
25
  - 使用 rem/em 做相对单位
26
26
  - 不确定属性行为时先查 MDN 文档确认
27
27
 
28
- ## 当前版本
28
+ ## 知识来源
29
+
30
+ 以下版本描述知识源,不代表目标项目版本;目标项目的 package.json 与 lockfile 证据始终优先。
29
31
 
30
32
  - mdn-css: 2024 — https://developer.mozilla.org/en-US/docs/Web/CSS
31
33
 
@@ -28,7 +28,9 @@ description: Docker 专家 — 镜像优化、Compose 编排、安全扫描、
28
28
  - 不在镜像层中写入敏感信息
29
29
  - 修复安全问题时先查 Docker 官方文档确认方案
30
30
 
31
- ## 当前版本
31
+ ## 知识来源
32
+
33
+ 以下版本描述知识源,不代表目标项目版本;目标项目的 package.json 与 lockfile 证据始终优先。
32
34
 
33
35
  - docker-docs: 26.0.0 — https://docs.docker.com/reference/
34
36
 
@@ -14,4 +14,4 @@ required_mcp_tools: []
14
14
  - Context/Graph/Memory/Knowledge/Workflow 引擎是否就绪
15
15
  - 已安装哪些领域插件
16
16
  - 是否有已知配置问题
17
- **MCP Gateway 策略**: 调用前会校验 Session Token 和调用合法性。无有效收据的情况下直接使用原生工具(grep/Glob/WebSearch)将被 PreToolUse Hook 拦截。收据有效期 30 秒,过期后需重新通过 MCP 工具获取。
17
+ **MCP Gateway 策略**: 调用前会校验 Session Token 和调用合法性。在支持 PreToolUse Hook 的 Claude Code 等宿主中,无有效收据的原生工具调用会被拦截;不提供生命周期 Hook 的宿主不会声称已执行原生拦截,而是依赖 canonical MCP receipts 和显式 capability degradation。收据有效期 30 秒,过期后需重新通过 MCP 工具获取。
@@ -28,7 +28,9 @@ description: Electron 专家 — IPC 通信、窗口管理、原生模块、自
28
28
  - 避免使用 remote 模块(已废弃)
29
29
  - 构建使用 electron-builder 并配置代码签名
30
30
 
31
- ## 当前版本
31
+ ## 知识来源
32
+
33
+ 以下版本描述知识源,不代表目标项目版本;目标项目的 package.json 与 lockfile 证据始终优先。
32
34
 
33
35
  - electron-docs: 30.0.0 — https://www.electronjs.org/docs/latest/
34
36
 
@@ -27,7 +27,9 @@ description: Git 专家 — 提交规范、分支审查、Changelog 生成、冲
27
27
  - PR 必须关联 Issue
28
28
  - 解决冲突前先理解两边变更的意图
29
29
 
30
- ## 当前版本
30
+ ## 知识来源
31
+
32
+ 以下版本描述知识源,不代表目标项目版本;目标项目的 package.json 与 lockfile 证据始终优先。
31
33
 
32
34
  - conventional-commits: 1.0.0 — https://www.conventionalcommits.org/en/v1.0.0/
33
35
  - git-scm-docs: 2.45.0 — https://git-scm.com/docs
@@ -27,7 +27,9 @@ description: GraphQL 专家 — Schema 设计、N+1 检测、Resolver 优化、
27
27
  - 限制查询深度和复杂度防止滥用
28
28
  - 遇到不确定的 Schema 设计时先查 GraphQL 官方规范
29
29
 
30
- ## 当前版本
30
+ ## 知识来源
31
+
32
+ 以下版本描述知识源,不代表目标项目版本;目标项目的 package.json 与 lockfile 证据始终优先。
31
33
 
32
34
  - graphql-docs: 2024 — https://graphql.org/learn/
33
35
 
@@ -27,7 +27,9 @@ description: NestJS 专家 — 模块架构、守卫调试、微服务配置、S
27
27
  - 修复 Bug 前先追踪 DI 链和 Module 注册
28
28
  - 使用 Prisma 作为 ORM,事务使用 $transaction
29
29
 
30
- ## 当前版本
30
+ ## 知识来源
31
+
32
+ 以下版本描述知识源,不代表目标项目版本;目标项目的 package.json 与 lockfile 证据始终优先。
31
33
 
32
34
  - nestjs-docs: 10.3.0 — https://docs.nestjs.com/
33
35
 
@@ -25,7 +25,9 @@ description: Next.js 专家 — App Router、SSR/SSG/ISR、Server Components、M
25
25
  - 中间件在 Edge Runtime 执行,不能直接访问数据库
26
26
  - 使用 generateStaticParams + ISR 优化静态页面
27
27
 
28
- ## 当前版本
28
+ ## 知识来源
29
+
30
+ 以下版本描述知识源,不代表目标项目版本;目标项目的 package.json 与 lockfile 证据始终优先。
29
31
 
30
32
  - nextjs-docs: 14.2.0 — https://nextjs.org/docs
31
33
 
@@ -28,7 +28,9 @@ description: Web 性能专家 — Core Web Vitals、Bundle 优化、加载策略
28
28
  - 所有优化建议必须有 Lighthouse/Performance 数据支持
29
29
  - 不使用 setTimeout 做动画,使用 requestAnimationFrame
30
30
 
31
- ## 当前版本
31
+ ## 知识来源
32
+
33
+ 以下版本描述知识源,不代表目标项目版本;目标项目的 package.json 与 lockfile 证据始终优先。
32
34
 
33
35
  - web-vitals-docs: 2024 — https://web.dev/vitals/
34
36
 
@@ -1,11 +1,11 @@
1
1
  ---
2
2
  name: devflow:react
3
- description: React 18 专家能力 — Bug 诊断、组件重构、性能优化、Hooks 审查
3
+ description: React 专家能力 — Bug 诊断、组件重构、性能优化、Hooks 审查
4
4
  ---
5
5
 
6
6
  # ⚛️ REACT
7
7
 
8
- 你是一个 React 18 专家。使用函数组件、Hooks 和 TypeScript。遇到问题先查文档再给方案,不凭空猜测 API 行为。
8
+ 你是一个 React 专家。项目 package.json 与 lockfile 检测到的版本是唯一权威。使用函数组件、Hooks 和 TypeScript;遇到问题先查对应版本文档再给方案。
9
9
 
10
10
  ## 适用场景
11
11
 
@@ -37,9 +37,19 @@ description: React 18 专家能力 — Bug 诊断、组件重构、性能优化
37
37
  - 生成代码后必须通过 TypeScript 类型检查
38
38
  - 不能凭记忆猜测 API 行为,必须基于当前项目版本
39
39
 
40
- ## 当前版本
40
+ ## 性能证据契约
41
41
 
42
- - react-docs: 18.3.1 — https://react.dev/reference/react
42
+ - `react_audit_performance` 返回的 `evidenceContract` 是机器强制约束,不是可选提示。
43
+ - 最终性能回答必须包含“工具发现”“模型假设”“需要运行时验证”三个标题;优先直接使用工具返回的 `canonicalReport`。
44
+ - `runtimeProfilingOccurred=false` 时,不得把静态候选升级为 P0、高风险、确认瓶颈、已观察卡顿/掉帧/CPU 热点,也不得给出未经测量的性能数字或收益比例。
45
+ - 没有明确采样周期、丢弃规则和前后基准时,不得把 requestAnimationFrame/RAF 推荐为通用节流方案。
46
+ - Stop 首次发现违规会要求纠正一次;重复违规会 fail-open 并记录 `evidence_contract_unresolved`,不得通过改写措辞规避证据边界。
47
+
48
+ ## 知识来源
49
+
50
+ 以下版本描述知识源,不代表目标项目版本;目标项目的 package.json 与 lockfile 证据始终优先。
51
+
52
+ - react-docs: current — https://react.dev/reference/react
43
53
 
44
54
  ## 工作流
45
55
 
@@ -25,7 +25,9 @@ description: Tailwind 专家 — 响应式设计、主题定制、Purge 检查
25
25
  - 避免内联 style 和自定义 CSS
26
26
  - 不确定 class 名称时先查 Tailwind 官方文档
27
27
 
28
- ## 当前版本
28
+ ## 知识来源
29
+
30
+ 以下版本描述知识源,不代表目标项目版本;目标项目的 package.json 与 lockfile 证据始终优先。
29
31
 
30
32
  - tailwind-docs: 3.4.0 — https://tailwindcss.com/docs
31
33
 
@@ -27,7 +27,9 @@ description: Taro 跨端专家 — 多端适配、小程序调试、性能优化
27
27
  - 合理使用分包加载减少首屏体积
28
28
  - 不确定跨端兼容性时先查 Taro 文档确认
29
29
 
30
- ## 当前版本
30
+ ## 知识来源
31
+
32
+ 以下版本描述知识源,不代表目标项目版本;目标项目的 package.json 与 lockfile 证据始终优先。
31
33
 
32
34
  - taro-docs: 3.6.0 — https://docs.taro.zone/docs/
33
35
 
@@ -25,7 +25,9 @@ description: UI Layout 专家 — 布局模式、组件组合、响应式架构
25
25
  - 使用 CSS 变量管理 Design Token
26
26
  - 确保触控目标 ≥ 44×44px,对比度 ≥ 4.5:1
27
27
 
28
- ## 当前版本
28
+ ## 知识来源
29
+
30
+ 以下版本描述知识源,不代表目标项目版本;目标项目的 package.json 与 lockfile 证据始终优先。
29
31
 
30
32
  - web-dev-layout: 2024 — https://web.dev/learn/design/
31
33
 
@@ -30,7 +30,9 @@ description: Vue 3 专家 — Bug 诊断、Composition API、响应式调试、
30
30
  - 生成代码后必须通过 vue-tsc 类型检查
31
31
  - 不能凭记忆猜测 API 行为,必须基于当前项目版本
32
32
 
33
- ## 当前版本
33
+ ## 知识来源
34
+
35
+ 以下版本描述知识源,不代表目标项目版本;目标项目的 package.json 与 lockfile 证据始终优先。
34
36
 
35
37
  - vue-docs: 3.4.0 — https://vuejs.org/guide/introduction.html
36
38
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devflow-tools/cli",
3
- "version": "0.16.10",
3
+ "version": "0.16.12",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "scripts": {
@@ -12,31 +12,31 @@
12
12
  },
13
13
  "dependencies": {
14
14
  "@colbymchenry/codegraph": "^1.1.1",
15
- "@devflow-tools/adapters": "0.16.10",
16
- "@devflow-tools/benchmark": "0.16.10",
17
- "@devflow-tools/context-engine": "0.16.10",
18
- "@devflow-tools/database": "0.16.10",
19
- "@devflow-tools/knowledge-engine": "0.16.10",
20
- "@devflow-tools/mcp-server": "0.16.10",
21
- "@devflow-tools/memory-engine": "0.16.10",
22
- "@devflow-tools/plugin-animation": "0.16.10",
23
- "@devflow-tools/plugin-css": "0.16.10",
24
- "@devflow-tools/plugin-docker": "0.16.10",
25
- "@devflow-tools/plugin-electron": "0.16.10",
26
- "@devflow-tools/plugin-git": "0.16.10",
27
- "@devflow-tools/plugin-graphql": "0.16.10",
28
- "@devflow-tools/plugin-nest": "0.16.10",
29
- "@devflow-tools/plugin-nextjs": "0.16.10",
30
- "@devflow-tools/plugin-performance": "0.16.10",
31
- "@devflow-tools/plugin-react": "0.16.10",
32
- "@devflow-tools/plugin-tailwind": "0.16.10",
33
- "@devflow-tools/plugin-taro": "0.16.10",
34
- "@devflow-tools/plugin-ui-layout": "0.16.10",
35
- "@devflow-tools/plugin-vue": "0.16.10",
36
- "@devflow-tools/sdk": "0.16.10",
37
- "@devflow-tools/server": "0.16.10",
38
- "@devflow-tools/telemetry": "0.16.10",
39
- "@devflow-tools/workflow-engine": "0.16.10",
15
+ "@devflow-tools/adapters": "0.16.12",
16
+ "@devflow-tools/benchmark": "0.16.12",
17
+ "@devflow-tools/context-engine": "0.16.12",
18
+ "@devflow-tools/database": "0.16.12",
19
+ "@devflow-tools/knowledge-engine": "0.16.12",
20
+ "@devflow-tools/mcp-server": "0.16.12",
21
+ "@devflow-tools/memory-engine": "0.16.12",
22
+ "@devflow-tools/plugin-animation": "0.16.12",
23
+ "@devflow-tools/plugin-css": "0.16.12",
24
+ "@devflow-tools/plugin-docker": "0.16.12",
25
+ "@devflow-tools/plugin-electron": "0.16.12",
26
+ "@devflow-tools/plugin-git": "0.16.12",
27
+ "@devflow-tools/plugin-graphql": "0.16.12",
28
+ "@devflow-tools/plugin-nest": "0.16.12",
29
+ "@devflow-tools/plugin-nextjs": "0.16.12",
30
+ "@devflow-tools/plugin-performance": "0.16.12",
31
+ "@devflow-tools/plugin-react": "0.16.12",
32
+ "@devflow-tools/plugin-tailwind": "0.16.12",
33
+ "@devflow-tools/plugin-taro": "0.16.12",
34
+ "@devflow-tools/plugin-ui-layout": "0.16.12",
35
+ "@devflow-tools/plugin-vue": "0.16.12",
36
+ "@devflow-tools/sdk": "0.16.12",
37
+ "@devflow-tools/server": "0.16.12",
38
+ "@devflow-tools/telemetry": "0.16.12",
39
+ "@devflow-tools/workflow-engine": "0.16.12",
40
40
  "@inquirer/prompts": "^7.10.1",
41
41
  "chalk": "^5.3.0",
42
42
  "commander": "^12.0.0"
@@ -49,5 +49,5 @@
49
49
  "dist",
50
50
  "bin"
51
51
  ],
52
- "gitHead": "964af33767bf232606e63d973b3a29d7d53c8119"
52
+ "gitHead": "d4a018f3031a3570c794c253f8edeff405956133"
53
53
  }