dsh-project-flow 0.8.3 → 0.9.1
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/CHANGELOG.md +0 -0
- package/README.md +166 -358
- package/bench/corpus/qa-fail-3-issues.md +33 -0
- package/bench/corpus/qa-fail-assertion.md +20 -0
- package/bench/corpus/qa-fail-missing-detect.md +21 -0
- package/bench/corpus/qa-pass.md +9 -0
- package/bench/corpus/qa-reverify-partial.md +30 -0
- package/bench/corpus/qa-unverified-only.md +15 -0
- package/bench/corpus/requirement-no-check.md +8 -0
- package/bench/corpus/requirement-with-check.md +16 -0
- package/bench/corpus/reverify-table-not-defects.md +18 -0
- package/bench/run.mjs +142 -0
- package/client.js +195 -9
- package/cordis.patch.yml +29 -9
- package/docs/CHECKS.md +100 -0
- package/docs/DETAIL.md +6 -6
- package/docs/FEATURES.md +12 -5
- package/docs/ISSUES.md +75 -0
- package/docs/LAUNCH.md +3 -3
- package/docs/LEDGER.md +46 -0
- package/docs/MOMENTS.md +4 -4
- package/docs/USAGE.md +2 -2
- package/docs/adr/0001-four-stage-isolation.md +25 -0
- package/docs/adr/0002-file-handoff-not-context.md +27 -0
- package/docs/adr/0003-diff-over-self-report.md +27 -0
- package/docs/adr/0004-issue-level-rework.md +30 -0
- package/docs/adr/0005-assertion-over-prose.md +30 -0
- package/docs/anchors/assertion-exec.md +39 -0
- package/docs/anchors/cost-accounting.md +44 -0
- package/docs/anchors/diff-reconciliation.md +35 -0
- package/docs/anchors/file-whitelist.md +29 -0
- package/docs/anchors/intent-gate.md +41 -0
- package/docs/anchors/issue-loop.md +40 -0
- package/docs/anchors/patch-ledger.md +38 -0
- package/docs/anchors/watchdog.md +30 -0
- package/domains.mjs +1 -1
- package/evidence.mjs +19 -3
- package/flow.schema.mjs +600 -0
- package/gate.mjs +49 -23
- package/index.js +2800 -134
- package/locale/en.json +15 -4
- package/locale/zh.json +17 -6
- package/package.json +11 -2
- package/tests/_heartbeat-regression.test.mjs +124 -0
- package/tests/_wd_sandbox/.project-flow/demo/run.log +1 -0
- package/tests/_wd_sandbox/a.txt +1 -0
- package/tests/aesthetic.test.mjs +534 -0
- package/tests/assertions-e2e.mjs +234 -0
- package/tests/bench-check.mjs +32 -0
- package/tests/client-bundle.test.mjs +707 -0
- package/tests/contract.test.mjs +137 -0
- package/tests/desktop.test.mjs +130 -0
- package/tests/domains.test.mjs +220 -0
- package/tests/e2e.mjs +300 -0
- package/tests/evidence.test.mjs +408 -0
- package/tests/extra-phase.test.mjs +133 -0
- package/tests/feedback.test.mjs +187 -0
- package/tests/flow-create.test.mjs +168 -0
- package/tests/flow-gate.test.mjs +232 -0
- package/tests/flow-schema.test.mjs +213 -0
- package/tests/gate.test.mjs +246 -0
- package/tests/issue-loop.test.mjs +254 -0
- package/tests/issues-e2e.mjs +246 -0
- package/tests/panel-independence.test.mjs +78 -0
- package/tests/panel-report.test.mjs +129 -0
- package/tests/patch-ledger.test.mjs +280 -0
- package/tests/paths.mjs +94 -0
- package/tests/preview-path.test.mjs +69 -0
- package/tests/qa-assertions.test.mjs +352 -0
- package/tests/run-all.mjs +90 -0
- package/tests/stage-model.test.mjs +120 -0
- package/tests/stop-resume.test.mjs +260 -0
- package/tests/watch-root.test.mjs +167 -0
- package/tests/watchdog-tokens.test.mjs +49 -0
- package/tests/watchdog.test.mjs +301 -0
package/gate.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
2
|
* 意图澄清门控(readiness gate)核心逻辑,纯函数、无 I/O。
|
|
3
3
|
*
|
|
4
4
|
* v2 改造要点——把「总分」和「扣分清单」并成一张表:
|
|
@@ -97,7 +97,7 @@ export function extractReadiness(text) {
|
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
/** 归一化一条结论:去空白、压空格、限长。空串返回 ''。 */
|
|
100
|
-
function normalizeLine(value, cap = 200) {
|
|
100
|
+
export function normalizeLine(value, cap = 200) {
|
|
101
101
|
if (typeof value !== 'string') return ''
|
|
102
102
|
const line = value.trim().replace(/\s+/gu, ' ')
|
|
103
103
|
if (line === '') return ''
|
|
@@ -107,13 +107,46 @@ function normalizeLine(value, cap = 200) {
|
|
|
107
107
|
/**
|
|
108
108
|
* 这条结论算不算「真的写了」。
|
|
109
109
|
* 空串不算;去掉空白和标点后不够 MIN_CONCLUSION_LENGTH 个字也不算——
|
|
110
|
-
*
|
|
110
|
+
* 「已确认。」这类凑数的话在这一步就被拦下,而不是等质检才发现。
|
|
111
111
|
*/
|
|
112
|
-
function isFilled(line) {
|
|
112
|
+
export function isFilled(line) {
|
|
113
113
|
if (line === '') return false
|
|
114
114
|
return line.replace(/[\s\p{P}]/gu, '').length >= MIN_CONCLUSION_LENGTH
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
+
/**
|
|
118
|
+
* 五维盲区判定的唯一实现。
|
|
119
|
+
*
|
|
120
|
+
* 这里是「一份逻辑两处用」的那个「一份」:`evaluateReadiness` 拿它算裁决,
|
|
121
|
+
* `project_run` 拿它决定要不要拒跑。以前 index.js 里另抄了一份逐字相同的
|
|
122
|
+
* 循环,改一边另一边不知道,两套测试于是测着两个不同的东西。
|
|
123
|
+
*
|
|
124
|
+
* @param blindspots 模型交上来的原始对象,可能是 null / 数组 / 字符串
|
|
125
|
+
* @returns {{ lines:Record<string,string>, empty:string[], vague:string[], gaps:number }}
|
|
126
|
+
* lines 归一化后的结论(键永远是五个维度);empty 是没写的;vague 是写了但太笼统的。
|
|
127
|
+
*/
|
|
128
|
+
export function blindspotGaps(blindspots) {
|
|
129
|
+
const record = blindspots !== null && typeof blindspots === 'object' && !Array.isArray(blindspots)
|
|
130
|
+
? blindspots
|
|
131
|
+
: {}
|
|
132
|
+
const lines = {}
|
|
133
|
+
const empty = []
|
|
134
|
+
const vague = []
|
|
135
|
+
for (const dim of DIMENSIONS) {
|
|
136
|
+
const line = normalizeLine(record[dim.key])
|
|
137
|
+
lines[dim.key] = line
|
|
138
|
+
if (line === '') empty.push(dim.key)
|
|
139
|
+
else if (!isFilled(line)) vague.push(dim.key)
|
|
140
|
+
}
|
|
141
|
+
return { lines, empty, vague, gaps: empty.length + vague.length }
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/** 维度 key → 中文名。写报错文案时用。 */
|
|
145
|
+
export function dimensionLabel(key) {
|
|
146
|
+
const hit = DIMENSIONS.find(d => d.key === key)
|
|
147
|
+
return hit === undefined ? String(key) : hit.label
|
|
148
|
+
}
|
|
149
|
+
|
|
117
150
|
/** 归一化假设列表:去空白、去空串、去重、限条数。 */
|
|
118
151
|
function normalizeList(value, cap = 12) {
|
|
119
152
|
if (!Array.isArray(value)) return []
|
|
@@ -206,29 +239,22 @@ export function evaluateReadiness(raw) {
|
|
|
206
239
|
}
|
|
207
240
|
|
|
208
241
|
// ---- 逐维度归一化,记下空着的和写得太笼统的 ----
|
|
209
|
-
const
|
|
210
|
-
const
|
|
211
|
-
const
|
|
212
|
-
const
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
blindspots[
|
|
216
|
-
|
|
217
|
-
emptyBlindspots.push(dim.key)
|
|
218
|
-
emptyLabels.push(dim.label)
|
|
219
|
-
} else if (!isFilled(line)) {
|
|
220
|
-
vagueBlindspots.push(dim.key)
|
|
221
|
-
emptyLabels.push(`${dim.label}(「${line}」太笼统)`)
|
|
222
|
-
}
|
|
223
|
-
}
|
|
242
|
+
const gap = blindspotGaps(raw.blindspots)
|
|
243
|
+
const blindspots = gap.lines
|
|
244
|
+
const emptyBlindspots = gap.empty
|
|
245
|
+
const vagueBlindspots = gap.vague
|
|
246
|
+
const emptyLabels = [
|
|
247
|
+
...emptyBlindspots.map(dimensionLabel),
|
|
248
|
+
...vagueBlindspots.map(key => `${dimensionLabel(key)}(「${blindspots[key]}」太笼统)`),
|
|
249
|
+
]
|
|
224
250
|
|
|
225
251
|
// ---- 两个条件独立判,都满足才放行 ----
|
|
226
252
|
const scoreShort = score === null || score < SCORE_FLOOR
|
|
227
253
|
const gapsPresent = emptyBlindspots.length > 0 || vagueBlindspots.length > 0
|
|
228
254
|
|
|
229
255
|
if (scoreShort) unmet.push(`score 只有 ${score ?? '(缺失)'},没到 ${SCORE_FLOOR}`)
|
|
230
|
-
if (emptyBlindspots.length > 0) unmet.push(`这 ${emptyBlindspots.length} 个维度还没有结论:${emptyBlindspots.map(
|
|
231
|
-
if (vagueBlindspots.length > 0) unmet.push(`这 ${vagueBlindspots.length} 个维度写得太笼统,要说具体结论:${vagueBlindspots.map(
|
|
256
|
+
if (emptyBlindspots.length > 0) unmet.push(`这 ${emptyBlindspots.length} 个维度还没有结论:${emptyBlindspots.map(dimensionLabel).join('、')}`)
|
|
257
|
+
if (vagueBlindspots.length > 0) unmet.push(`这 ${vagueBlindspots.length} 个维度写得太笼统,要说具体结论:${vagueBlindspots.map(dimensionLabel).join('、')}`)
|
|
232
258
|
|
|
233
259
|
if (scoreShort || gapsPresent) {
|
|
234
260
|
return {
|
|
@@ -385,5 +411,5 @@ export function buttonState(readiness) {
|
|
|
385
411
|
assumptions: verdict.assumptions,
|
|
386
412
|
}
|
|
387
413
|
}
|
|
388
|
-
|
|
389
|
-
|
|
414
|
+
|
|
415
|
+
|