add-coder 0.3.13 → 0.3.15

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "add-coder",
3
- "version": "0.3.13",
3
+ "version": "0.3.15",
4
4
  "private": false,
5
5
  "description": "[codein2027](https://github.com/xiaomingming92/codein2027) - A complete scaffolding for building the ADD programming paradigm, the implementation layer for AI code governance. Core principle: Audit as Infrastructure. Breaks the black-box programming process and cross-session amnesia, evolving programming paradigms into an auditable, traceable, and convergent new era. npx-ready.\n\n[codein2027](https://github.com/xiaomingming92/codein2027) 快速构建 ADD 编程范式的完整脚手架——AI 代码治理的落地方案。以「审计即基础设施」为核心,彻底打破编程过程黑盒与跨轮失忆,让编程范式进化为可审计、可追溯、可收敛的新时代。npx 即用,人人可体验。",
6
6
  "repository": {
@@ -40,8 +40,8 @@
40
40
  "email": "wujixmm@gmail.com",
41
41
  "license": "AGPL-3.0-only",
42
42
  "dependencies": {
43
+ "@huggingface/transformers": "^3.8.1",
43
44
  "@modelcontextprotocol/server": "2.0.0",
44
- "@xenova/transformers": "^2.17.2",
45
45
  "commander": "^13.1.0",
46
46
  "smol-toml": "^1.7.0",
47
47
  "vector-cosine-similarity": "^1.8.0",
@@ -54,7 +54,7 @@
54
54
  "prisma": "^7.0.0",
55
55
  "tsx": ">=4",
56
56
  "vector-cosine-similarity": "^1.8.0",
57
- "@xenova/transformers": "^2.17.2"
57
+ "@huggingface/transformers": "^3.8.1"
58
58
  },
59
59
  "peerDependenciesMeta": {
60
60
  "@prisma/client": {
@@ -72,7 +72,7 @@
72
72
  "@prisma/adapter-pg": {
73
73
  "optional": false
74
74
  },
75
- "@xenova/transformers": {
75
+ "@huggingface/transformers": {
76
76
  "optional": false
77
77
  }
78
78
  },
@@ -1,5 +1,5 @@
1
1
  {
2
- "_version": "0.3.13",
2
+ "_version": "0.3.15",
3
3
  "adapters/claude/hooks/doc-format-guard.sh": "ec59ad3f",
4
4
  "adapters/claude/hooks/lib/common.sh": "4f3e64ad",
5
5
  "adapters/claude/hooks/lib/context-inject.sh": "cfc8c65e",
@@ -15,7 +15,7 @@
15
15
  "adapters/claude/hooks/post-tool-failure.sh": "669b1b65",
16
16
  "adapters/claude/hooks/post-tool-use.sh": "f54dd009",
17
17
  "adapters/claude/hooks/pre-compact.sh": "4248f84f",
18
- "adapters/claude/hooks/pre-tool-use.sh": "ecbdc628",
18
+ "adapters/claude/hooks/pre-tool-use.sh": "e186abc8",
19
19
  "adapters/claude/hooks/prompt-submit.sh": "2fe9e42c",
20
20
  "adapters/claude/hooks/review-checklist.sh": "b383a983",
21
21
  "adapters/claude/hooks/session-end.sh": "777ae808",
@@ -40,7 +40,7 @@
40
40
  "adapters/codex/hooks/post-tool-failure.sh": "669b1b65",
41
41
  "adapters/codex/hooks/post-tool-use.sh": "27123aee",
42
42
  "adapters/codex/hooks/pre-compact.sh": "6164c007",
43
- "adapters/codex/hooks/pre-tool-use.sh": "ffa7936b",
43
+ "adapters/codex/hooks/pre-tool-use.sh": "8f6b77a0",
44
44
  "adapters/codex/hooks/prompt-submit.sh": "a41371ea",
45
45
  "adapters/codex/hooks/review-checklist.sh": "b383a983",
46
46
  "adapters/codex/hooks/session-end.sh": "3cc8c346",
@@ -64,7 +64,7 @@
64
64
  "adapters/qoder/hooks/post-tool-failure.sh": "8bc7a0e4",
65
65
  "adapters/qoder/hooks/post-tool-use.sh": "051cb6ed",
66
66
  "adapters/qoder/hooks/pre-compact.sh": "092fa6cf",
67
- "adapters/qoder/hooks/pre-tool-use.sh": "5ba6d9ae",
67
+ "adapters/qoder/hooks/pre-tool-use.sh": "ade1adf0",
68
68
  "adapters/qoder/hooks/prompt-submit.sh": "336f262e",
69
69
  "adapters/qoder/hooks/review-checklist.sh": "666831c8",
70
70
  "adapters/qoder/hooks/session-end.sh": "c50339df",
@@ -89,7 +89,7 @@
89
89
  "adapters/trae/hooks/post-tool-failure.sh": "669b1b65",
90
90
  "adapters/trae/hooks/post-tool-use.sh": "27123aee",
91
91
  "adapters/trae/hooks/pre-compact.sh": "6164c007",
92
- "adapters/trae/hooks/pre-tool-use.sh": "8e57d1fa",
92
+ "adapters/trae/hooks/pre-tool-use.sh": "63151fb0",
93
93
  "adapters/trae/hooks/prompt-submit.sh": "a41371ea",
94
94
  "adapters/trae/hooks/review-checklist.sh": "b383a983",
95
95
  "adapters/trae/hooks/session-end.sh": "3cc8c346",
@@ -124,7 +124,7 @@
124
124
  "adapters/vscode/hooks/post-tool-failure.sh": "355cfab1",
125
125
  "adapters/vscode/hooks/post-tool-use.sh": "5f188718",
126
126
  "adapters/vscode/hooks/pre-compact.sh": "a0908f0e",
127
- "adapters/vscode/hooks/pre-tool-use.sh": "6232624b",
127
+ "adapters/vscode/hooks/pre-tool-use.sh": "705953bf",
128
128
  "adapters/vscode/hooks/prompt-submit.sh": "3e56d1a9",
129
129
  "adapters/vscode/hooks/review-checklist.sh": "b383a983",
130
130
  "adapters/vscode/hooks/session-end.sh": "7b407b9f",
@@ -155,7 +155,7 @@
155
155
  "core/hooks/post-tool-failure.sh": "669b1b65",
156
156
  "core/hooks/post-tool-use.sh": "27123aee",
157
157
  "core/hooks/pre-compact.sh": "6164c007",
158
- "core/hooks/pre-tool-use.sh": "fa73df98",
158
+ "core/hooks/pre-tool-use.sh": "60bcf63a",
159
159
  "core/hooks/prompt-submit.sh": "a41371ea",
160
160
  "core/hooks/review-checklist.sh": "b383a983",
161
161
  "core/hooks/session-end.sh": "3cc8c346",
@@ -166,7 +166,7 @@
166
166
  "core/plans/2026-07/08/add-coder-npm-package-add-route-v1.md": "b05fce99",
167
167
  "core/plans/2026-07/08/add-coder-npm-package-handoff-v1.md": "1bd40a4a",
168
168
  "core/plans/2026-07/08/add-coder-npm-package-plan-v1.md": "a678d98e",
169
- "core/prisma/add.prisma": "3733af9f",
169
+ "core/prisma/add.prisma": "fa818acf",
170
170
  "core/reports/REPORT-WORKFLOW.md": "03d39b21",
171
171
  "core/reports/boundary-runtime-report.md": "6fd8053f",
172
172
  "core/reports/code-review-combined-report.md": "195d52aa",
@@ -211,7 +211,7 @@
211
211
  "core/scripts/mcp-server/tools/gateway/check_dps.ts": "cea4cb8b",
212
212
  "core/scripts/mcp-server/tools/gateway/check_rahs.ts": "c37f6810",
213
213
  "core/scripts/mcp-server/tools/gateway/check_spec_sync.ts": "a683697f",
214
- "core/scripts/mcp-server/tools/gateway/helpers.ts": "5ed11a3b",
214
+ "core/scripts/mcp-server/tools/gateway/helpers.ts": "690d7891",
215
215
  "core/scripts/mcp-server/tools/gateway/index.ts": "5a9fd5ed",
216
216
  "core/scripts/mcp-server/tools/gateway.backup": "65eae393",
217
217
  "core/scripts/mcp-server/tools/hitl.ts": "80093743",
@@ -67,9 +67,9 @@ if [ "$tool_name" = "Write" ] || [ "$tool_name" = "Edit" ] || [ "$tool_name" = "
67
67
  if type detect_active_add >/dev/null 2>&1; then
68
68
  state=$(detect_active_add 2>/dev/null || true)
69
69
  if [ -z "$state" ]; then
70
- echo " 正在写入 Plan/Spec/Review 文档但无活跃 ADD Plan——请先执行 add-paradigm" >&2
71
- echo "{\"hookSpecificOutput\":{\"hookEventName\":\"PreToolUse\",\"permissionDecision\":\"deny\",\"permissionDecisionReason\":\"Plan/Spec/Review 写入需要活跃 ADD Plan,请先执行 add-paradigm\"}}"
72
- write_hook_event "pre-tool-use" "deny" "$file_path" "Plan/Spec/Review 写入需活跃 ADD Plan" "$PLAN_KEYWORD" "$PLAN_STATUS" 2>/dev/null || true
70
+ echo "[ADD 提示] 正在写入 Plan/Spec/Review 文档但无活跃 ADD Plan——首次创建场景放行,建议先执行 add-paradigm 生成 Plan+add-route" >&2
71
+ echo "{\"hookSpecificOutput\":{\"hookEventName\":\"PreToolUse\",\"permissionDecision\":\"allow\",\"permissionDecisionReason\":\"无活跃 ADD Plan 但为 Plan/Spec/Review 写入(首次创建场景),提示而非拦截\"}}"
72
+ write_hook_event "pre-tool-use" "info" "$file_path" "无活跃 ADD Plan 下写入 Plan/Spec/Review(首次创建放行)" "$PLAN_KEYWORD" "$PLAN_STATUS" 2>/dev/null || true
73
73
  exit $EXIT_BLOCK
74
74
  fi
75
75
  fi
@@ -140,10 +140,10 @@ if [ "$tool_name" = "Write" ] || [ "$tool_name" = "Edit" ] || [ "$tool_name" = "
140
140
  if type detect_active_add >/dev/null 2>&1; then
141
141
  state=$(detect_active_add 2>/dev/null || true)
142
142
  if [ -z "$state" ]; then
143
- echo " 正在写入 Plan/Spec/Review 文档但无活跃 ADD Plan——请先执行 add-paradigm" >&2
144
- echo "{\"hookSpecificOutput\":{\"hookEventName\":\"PreToolUse\",\"permissionDecision\":\"deny\",\"permissionDecisionReason\":\"Plan/Spec/Review 写入需要活跃 ADD Plan,请先执行 add-paradigm\"}}"
145
- write_hook_event "pre-tool-use" "deny" "$tool_name $file_path" "Plan/Spec/Review 写入需活跃 ADD Plan" "$PLAN_KEYWORD" "$PLAN_STATUS" 2>/dev/null || true
146
- exit 2
143
+ echo "[ADD 提示] 正在写入 Plan/Spec/Review 文档但无活跃 ADD Plan——首次创建场景放行,建议先执行 add-paradigm 生成 Plan+add-route" >&2
144
+ echo "{\"hookSpecificOutput\":{\"hookEventName\":\"PreToolUse\",\"permissionDecision\":\"allow\",\"permissionDecisionReason\":\"无活跃 ADD Plan 但为 Plan/Spec/Review 写入(首次创建场景),提示而非拦截\"}}"
145
+ write_hook_event "pre-tool-use" "info" "$tool_name $file_path" "无活跃 ADD Plan 下写入 Plan/Spec/Review(首次创建放行)" "$PLAN_KEYWORD" "$PLAN_STATUS" 2>/dev/null || true
146
+ exit 0
147
147
  fi
148
148
  fi
149
149
  fi
@@ -68,10 +68,10 @@ if [ "$tool_name" = "Write" ] || [ "$tool_name" = "Edit" ] || [ "$tool_name" = "
68
68
  if type detect_active_add >/dev/null 2>&1; then
69
69
  state=$(detect_active_add 2>/dev/null || true)
70
70
  if [ -z "$state" ]; then
71
- echo " 正在写入 Plan/Spec/Review 文档但无活跃 ADD Plan——请先执行 add-paradigm" >&2
72
- echo "{\"hookSpecificOutput\":{\"hookEventName\":\"PreToolUse\",\"permissionDecision\":\"deny\",\"permissionDecisionReason\":\"Plan/Spec/Review 写入需要活跃 ADD Plan,请先执行 add-paradigm\"}}"
73
- write_hook_event "pre-tool-use" "deny" "$file_path" "Plan/Spec/Review 写入需活跃 ADD Plan" "$PLAN_KEYWORD" "$PLAN_STATUS" 2>/dev/null || true
74
- exit 2
71
+ echo "[ADD 提示] 正在写入 Plan/Spec/Review 文档但无活跃 ADD Plan——首次创建场景放行,建议先执行 add-paradigm 生成 Plan+add-route" >&2
72
+ echo "{\"hookSpecificOutput\":{\"hookEventName\":\"PreToolUse\",\"permissionDecision\":\"allow\",\"permissionDecisionReason\":\"无活跃 ADD Plan 但为 Plan/Spec/Review 写入(首次创建场景),提示而非拦截\"}}"
73
+ write_hook_event "pre-tool-use" "info" "$file_path" "无活跃 ADD Plan 下写入 Plan/Spec/Review(首次创建放行)" "$PLAN_KEYWORD" "$PLAN_STATUS" 2>/dev/null || true
74
+ exit 0
75
75
  fi
76
76
  fi
77
77
  fi
@@ -140,10 +140,10 @@ if [ "$tool_name" = "Write" ] || [ "$tool_name" = "Edit" ] || [ "$tool_name" = "
140
140
  if type detect_active_add >/dev/null 2>&1; then
141
141
  state=$(detect_active_add 2>/dev/null || true)
142
142
  if [ -z "$state" ]; then
143
- echo " 正在写入 Plan/Spec/Review 文档但无活跃 ADD Plan——请先执行 add-paradigm" >&2
144
- echo "{\"hookSpecificOutput\":{\"hookEventName\":\"PreToolUse\",\"permissionDecision\":\"deny\",\"permissionDecisionReason\":\"Plan/Spec/Review 写入需要活跃 ADD Plan,请先执行 add-paradigm\"}}"
145
- write_hook_event "pre-tool-use" "deny" "$tool_name $file_path" "Plan/Spec/Review 写入需活跃 ADD Plan" "$PLAN_KEYWORD" "$PLAN_STATUS" 2>/dev/null || true
146
- exit 2
143
+ echo "[ADD 提示] 正在写入 Plan/Spec/Review 文档但无活跃 ADD Plan——首次创建场景放行,建议先执行 add-paradigm 生成 Plan+add-route" >&2
144
+ echo "{\"hookSpecificOutput\":{\"hookEventName\":\"PreToolUse\",\"permissionDecision\":\"allow\",\"permissionDecisionReason\":\"无活跃 ADD Plan 但为 Plan/Spec/Review 写入(首次创建场景),提示而非拦截\"}}"
145
+ write_hook_event "pre-tool-use" "info" "$tool_name $file_path" "无活跃 ADD Plan 下写入 Plan/Spec/Review(首次创建放行)" "$PLAN_KEYWORD" "$PLAN_STATUS" 2>/dev/null || true
146
+ exit 0
147
147
  fi
148
148
  fi
149
149
  fi
@@ -67,9 +67,9 @@ if [ "$tool_name" = "Write" ] || [ "$tool_name" = "Edit" ] || [ "$tool_name" = "
67
67
  if type detect_active_add >/dev/null 2>&1; then
68
68
  state=$(detect_active_add 2>/dev/null || true)
69
69
  if [ -z "$state" ]; then
70
- echo " 正在写入 Plan/Spec/Review 文档但无活跃 ADD Plan——请先执行 add-paradigm" >&2
71
- echo "{\"hookSpecificOutput\":{\"hookEventName\":\"PreToolUse\",\"permissionDecision\":\"deny\",\"permissionDecisionReason\":\"Plan/Spec/Review 写入需要活跃 ADD Plan,请先执行 add-paradigm\"}}"
72
- write_hook_event "pre-tool-use" "deny" "$file_path" "Plan/Spec/Review 写入需活跃 ADD Plan" "$PLAN_KEYWORD" "$PLAN_STATUS" 2>/dev/null || true
70
+ echo "[ADD 提示] 正在写入 Plan/Spec/Review 文档但无活跃 ADD Plan——首次创建场景放行,建议先执行 add-paradigm 生成 Plan+add-route" >&2
71
+ echo "{\"hookSpecificOutput\":{\"hookEventName\":\"PreToolUse\",\"permissionDecision\":\"allow\",\"permissionDecisionReason\":\"无活跃 ADD Plan 但为 Plan/Spec/Review 写入(首次创建场景),提示而非拦截\"}}"
72
+ write_hook_event "pre-tool-use" "info" "$file_path" "无活跃 ADD Plan 下写入 Plan/Spec/Review(首次创建放行)" "$PLAN_KEYWORD" "$PLAN_STATUS" 2>/dev/null || true
73
73
  exit $EXIT_BLOCK
74
74
  fi
75
75
  fi
@@ -140,10 +140,10 @@ if [ "$tool_name" = "Write" ] || [ "$tool_name" = "Edit" ] || [ "$tool_name" = "
140
140
  if type detect_active_add >/dev/null 2>&1; then
141
141
  state=$(detect_active_add 2>/dev/null || true)
142
142
  if [ -z "$state" ]; then
143
- echo " 正在写入 Plan/Spec/Review 文档但无活跃 ADD Plan——请先执行 add-paradigm" >&2
144
- echo "{\"hookSpecificOutput\":{\"hookEventName\":\"PreToolUse\",\"permissionDecision\":\"deny\",\"permissionDecisionReason\":\"Plan/Spec/Review 写入需要活跃 ADD Plan,请先执行 add-paradigm\"}}"
145
- write_hook_event "pre-tool-use" "deny" "$tool_name $file_path" "Plan/Spec/Review 写入需活跃 ADD Plan" "$PLAN_KEYWORD" "$PLAN_STATUS" 2>/dev/null || true
146
- exit 2
143
+ echo "[ADD 提示] 正在写入 Plan/Spec/Review 文档但无活跃 ADD Plan——首次创建场景放行,建议先执行 add-paradigm 生成 Plan+add-route" >&2
144
+ echo "{\"hookSpecificOutput\":{\"hookEventName\":\"PreToolUse\",\"permissionDecision\":\"allow\",\"permissionDecisionReason\":\"无活跃 ADD Plan 但为 Plan/Spec/Review 写入(首次创建场景),提示而非拦截\"}}"
145
+ write_hook_event "pre-tool-use" "info" "$tool_name $file_path" "无活跃 ADD Plan 下写入 Plan/Spec/Review(首次创建放行)" "$PLAN_KEYWORD" "$PLAN_STATUS" 2>/dev/null || true
146
+ exit 0
147
147
  fi
148
148
  fi
149
149
  fi
@@ -94,6 +94,12 @@ model PlanRecord {
94
94
  checklistTDone Int @default(0)
95
95
  checklistR Int @default(0)
96
96
  planKeyword String?
97
+ // DPS 四维评分历史(check_dps 调用后回写,供 FFT 自适应权重消费)
98
+ dpsSemScore Int? // 语义相关性 0-100
99
+ dpsEntropyScore Int? // 信息熵匹配 0-100
100
+ dpsCpmScore Int? // CPM 关键路径 0-100
101
+ dpsStructScore Int? // 结构完整度 0-100
102
+ dpsComposite Int? // 加权 DPS 总分 0-100
97
103
  hitls HitlRecord[]
98
104
  reviews ReviewRecord[]
99
105
  createdAt DateTime @default(now())
@@ -105,7 +105,7 @@ let _embedPipeline: { embed: (texts: string[]) => Promise<number[][]> } | null =
105
105
 
106
106
  export async function getEmbeddings(texts: string[]): Promise<number[][]> {
107
107
  if (!_embedPipeline) {
108
- const { pipeline, env } = await import("@xenova/transformers");
108
+ const { pipeline, env } = await import("@huggingface/transformers");
109
109
  env.remoteHost = "https://hf-mirror.com";
110
110
  env.remotePathTemplate = "{model}/resolve/{revision}/";
111
111
  const extractor = await pipeline("feature-extraction", CFG.EMBEDDING_MODEL);