dsh-project-flow 0.10.1 → 0.10.2
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 +28 -0
- package/index.js +1 -1
- package/package.json +1 -1
- package/runner/tools/resume.mjs +7 -1
- package/runner/tools/run.mjs +12 -3
- package/tests/feedback.test.mjs +4 -0
- package/tests/stop-resume.test.mjs +3 -0
- package/tests/watch-root.test.mjs +31 -1
- package/workspace/panel.mjs +13 -2
package/CHANGELOG.md
CHANGED
|
@@ -14,6 +14,34 @@ dsh-project-flow 的版本变更。版本号遵循语义化版本。
|
|
|
14
14
|
|
|
15
15
|
---
|
|
16
16
|
|
|
17
|
+
## [0.10.2] - 2026-12-05
|
|
18
|
+
|
|
19
|
+
修「工作模式开起来了,状态栏却什么都没变」。三条独立的原因,叠在一起。
|
|
20
|
+
|
|
21
|
+
### 面板数据写到了错的地方
|
|
22
|
+
|
|
23
|
+
`writePanelFile` 落盘用的是 `join(cwd, '.project-flow', 'panel.json')`——会话在哪个目录,面板数据就写哪儿。而状态栏读的是 `watchRootOf(cwd)` 算出来的目录。两个函数各算一套,于是同一个工作流长出好几份 `panel.json`:外层壳目录一份、项目子目录一份、真正的根目录一份,状态栏读其中一份,看着就是「项目在跑、状态栏没动」。
|
|
24
|
+
|
|
25
|
+
现在写的时候调的就是 `watchRootOf`——**读哪儿写哪儿,用同一个解析函数**。这一点不能换成 `flowRootTargetOf`:没配绝对 `flowRoot` 时它会算出 `cwd/工作流` 这个根本不存在的路径,而 `watchRootOf` 会正确回到 `cwd` 或找到祖先里那层「工作流」。
|
|
26
|
+
|
|
27
|
+
真机上清出来的现场:`D:\` 底下一共六个 `.project-flow`,`D:\新建文件夹 (4)` 外层和它下面的 `工作流` 各一份,另外四个散在 `D:\dsh-project-flow`、`D:\工作流`、`D:\C盘去重回收区` 和插件源码目录里。
|
|
28
|
+
|
|
29
|
+
### 工具路径根本不写面板
|
|
30
|
+
|
|
31
|
+
`writePanelFile` 只被 `/flow` 和 `/flow-set` 两条斜杠命令调用过。`project_run` / `project_resume` 走的是另一条完全独立的代码路径,一次都不写。于是「用斜杠命令开」状态栏会动,「让模型直接调工具开」就不会动——同一个能力的两个入口,表现差这么多。
|
|
32
|
+
|
|
33
|
+
现在两个工具收尾时都刷一次,不管结果成没成。
|
|
34
|
+
|
|
35
|
+
### 两套测试在读用户的真实配置
|
|
36
|
+
|
|
37
|
+
`feedback.test.mjs` 和 `stop-resume.test.mjs` 直接 `import` 插件,没隔离 `DSH_HOME`。用户一把 `flowGate` 调成 `strict`(只在自己的工作流目录里开工),测试目录立刻不在允许范围内,16 条断言挂 14 条——看着像代码坏了,其实是配置在起作用。
|
|
38
|
+
|
|
39
|
+
现在两套都先把 `DSH_HOME` 指到临时目录。同类问题之前 `apply-wiring` 也踩过一次。
|
|
40
|
+
|
|
41
|
+
### 测试
|
|
42
|
+
|
|
43
|
+
`tests/watch-root.test.mjs` 从 9 条加到 11 条,锁两件事:在用项目子目录里干活时,面板写进工作流根而不是子目录;在别的栏(默认工作区)调用时,一个字节都不写。
|
|
44
|
+
|
|
17
45
|
## [0.10.1] - 2026-12-05
|
|
18
46
|
|
|
19
47
|
修 0.10.0 留下的几处真故障。都是「看起来在工作、实际没生效」那一类,所以每条都补了能单独跑的测试,不再只靠 30 套里的端到端用例兜。
|
package/index.js
CHANGED
|
@@ -208,7 +208,7 @@ export {
|
|
|
208
208
|
listSnapshots,
|
|
209
209
|
gitAvailable,
|
|
210
210
|
} from './snapshot/repo.mjs'
|
|
211
|
-
export { previewImageParts, collectPreviewParts, panelSnapshot } from './workspace/panel.mjs'
|
|
211
|
+
export { previewImageParts, collectPreviewParts, panelSnapshot, writePanelFile } from './workspace/panel.mjs'
|
|
212
212
|
export { steerInstruction } from './commands/steer.mjs'
|
|
213
213
|
|
|
214
214
|
// config 里的 settingsOf 对外仍叫这个名字,语义没变。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-project-flow",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Four-stage project workflow: requirement, plan, build, QA, with an intent gate, a rework loop, self-healing recovery, a watchdog that stops runaway runs, snapshot rollback with a retention cap, a single status light, and a machine-readable Completion_Evidence.json.",
|
|
6
6
|
"type": "module",
|
package/runner/tools/resume.mjs
CHANGED
|
@@ -10,7 +10,7 @@ import { isAbsolute } from 'node:path'
|
|
|
10
10
|
import { pfState } from '../../state/registry.mjs'
|
|
11
11
|
import { settingsOf } from '../../config/settings.mjs'
|
|
12
12
|
import { stateDir } from '../../shared/util.mjs'
|
|
13
|
-
import { statusLine } from '../../workspace/panel.mjs'
|
|
13
|
+
import { statusLine, writePanelFile } from '../../workspace/panel.mjs'
|
|
14
14
|
|
|
15
15
|
export function create(ctx, rt) {
|
|
16
16
|
const executeRun = createExecuteRun(ctx, rt)
|
|
@@ -127,7 +127,13 @@ const resumeTool = defineTool({
|
|
|
127
127
|
return give(`没有可用的施工任务书(${ARTIFACT.plan} 缺失或格式不对),从实施段接不上。跑 project_doctor 检查产物,或重新 project_run。`)
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
+
// 续跑收尾也刷一次面板:project_resume 和 /flow-resume 是同一件事的
|
|
131
|
+
// 两个入口,状态栏不该只认其中一个。
|
|
130
132
|
return executeRun({ ...plan.options, parent, signal: exec.signal })
|
|
133
|
+
.then(result => {
|
|
134
|
+
void writePanelFile(cwd, settings).catch(() => undefined)
|
|
135
|
+
return result
|
|
136
|
+
})
|
|
131
137
|
},
|
|
132
138
|
})
|
|
133
139
|
|
package/runner/tools/run.mjs
CHANGED
|
@@ -12,7 +12,7 @@ import { pfState } from '../../state/registry.mjs'
|
|
|
12
12
|
import { readState, writeRememberedContext } from '../../persistence/state.mjs'
|
|
13
13
|
import { settingsOf } from '../../config/settings.mjs'
|
|
14
14
|
import { stateDir } from '../../shared/util.mjs'
|
|
15
|
-
import { statusLine } from '../../workspace/panel.mjs'
|
|
15
|
+
import { statusLine, writePanelFile } from '../../workspace/panel.mjs'
|
|
16
16
|
|
|
17
17
|
export function create(ctx, rt) {
|
|
18
18
|
const executeRun = createExecuteRun(ctx, rt)
|
|
@@ -219,6 +219,15 @@ const runTool = defineTool({
|
|
|
219
219
|
blindspots: confirmation.blindspots,
|
|
220
220
|
assumptions: confirmation.assumptions,
|
|
221
221
|
})
|
|
222
|
+
// 跑完(不管成没成)都刷一次面板数据。
|
|
223
|
+
//
|
|
224
|
+
// 以前只有 /flow 和 /flow-set 这两条斜杠命令会写 panel.json,走工具这条路
|
|
225
|
+
// 一次都不写——于是「已经开了工作模式,状态栏却什么都没变」。斜杠命令和工具
|
|
226
|
+
// 是同一个能力的两个入口,表现不该差这么多。
|
|
227
|
+
const finish = result => {
|
|
228
|
+
void writePanelFile(cwd, settings).catch(() => undefined)
|
|
229
|
+
return result
|
|
230
|
+
}
|
|
222
231
|
// 幂等入口:同一个项目再调一次 project_run,不该把已经跑过的段推倒重来。
|
|
223
232
|
// 有未完成的 state 就自动接上去,要真正重开才传 restart: true。
|
|
224
233
|
if (args.restart !== true) {
|
|
@@ -234,7 +243,7 @@ const runTool = defineTool({
|
|
|
234
243
|
parent,
|
|
235
244
|
signal: exec.signal,
|
|
236
245
|
mode: `${plan.options.mode}(project_run 自动续跑)`,
|
|
237
|
-
}).then(result => decorateCost(result, settings, args.requirements, cwd))
|
|
246
|
+
}).then(result => decorateCost(result, settings, args.requirements, cwd)).then(finish)
|
|
238
247
|
}
|
|
239
248
|
}
|
|
240
249
|
}
|
|
@@ -253,7 +262,7 @@ const runTool = defineTool({
|
|
|
253
262
|
signal: exec.signal,
|
|
254
263
|
seed: undefined,
|
|
255
264
|
mode: 'run',
|
|
256
|
-
}).then(result => decorateCost(result, settings, args.requirements, cwd))
|
|
265
|
+
}).then(result => decorateCost(result, settings, args.requirements, cwd)).then(finish)
|
|
257
266
|
},
|
|
258
267
|
})
|
|
259
268
|
|
package/tests/feedback.test.mjs
CHANGED
|
@@ -16,6 +16,10 @@ import { LIVE_DIR } from './paths.mjs'
|
|
|
16
16
|
|
|
17
17
|
const here = dirname(fileURLToPath(import.meta.url))
|
|
18
18
|
const LIVE = join(LIVE_DIR, 'index.js')
|
|
19
|
+
// 不读用户自己的运行时配置。以前这里直接 import,于是用户一旦把
|
|
20
|
+
// flowGate 调成 strict(只在自己的工作流目录里开工),测试目录立刻不在
|
|
21
|
+
// 允许范围内,16 条断言能挂 14 条——看着像代码坏了,其实是配置在起作用。
|
|
22
|
+
process.env.DSH_HOME = await mkdtemp(join(tmpdir(), 'pf-feedback-home-'))
|
|
19
23
|
const mod = await import(pathToFileURL(LIVE).href + `?t=${Date.now()}`)
|
|
20
24
|
|
|
21
25
|
const results = []
|
|
@@ -20,6 +20,9 @@ void fileURLToPath
|
|
|
20
20
|
// 悄悄验到「已经装好的旧副本」——看起来全过,其实验的不是手上这份代码。
|
|
21
21
|
// 走 paths.mjs 就跟着 PF_LIVE_DIR / 包根走。
|
|
22
22
|
const LIVE = join(LIVE_DIR, 'index.js')
|
|
23
|
+
// 同上:测试不该受用户 flowGate 影响。strict 时这个目录不在他的工作流根下,
|
|
24
|
+
// project_run 会被门控拒掉,然后卡在「等不到:规划开始」。
|
|
25
|
+
process.env.DSH_HOME = await mkdtemp(join(tmpdir(), 'pf-stop-home-'))
|
|
23
26
|
const mod = await import(pathToFileURL(LIVE).href + `?t=${Date.now()}`)
|
|
24
27
|
|
|
25
28
|
const results = []
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import { test, before, after } from 'node:test'
|
|
12
12
|
import assert from 'node:assert/strict'
|
|
13
|
-
import { mkdir, writeFile, rm, mkdtemp } from 'node:fs/promises'
|
|
13
|
+
import { mkdir, writeFile, rm, mkdtemp, readFile } from 'node:fs/promises'
|
|
14
14
|
import { join, dirname } from 'node:path'
|
|
15
15
|
import { tmpdir } from 'node:os'
|
|
16
16
|
import { fileURLToPath, pathToFileURL } from 'node:url'
|
|
@@ -165,4 +165,34 @@ test('门控没被放松:inside 仍然只看当前目录', async () => {
|
|
|
165
165
|
assert.equal(strict.inside, false)
|
|
166
166
|
const off = await mod.panelSnapshot(otherDir, { ...SETTINGS, flowGate: 'off' })
|
|
167
167
|
assert.equal(off.inside, true)
|
|
168
|
+
})
|
|
169
|
+
|
|
170
|
+
test('★ 面板写到状态栏正在看的那个目录,不写会话当前目录', async () => {
|
|
171
|
+
// 原来的 bug:在用项目子目录里干活时,writePanelFile 把 panel.json 写进了
|
|
172
|
+
// 那个子目录,而状态栏读的是工作流根——项目在跑、状态栏一动不动。
|
|
173
|
+
const proj = join(flowDir, 'newproj')
|
|
174
|
+
await mkdir(proj, { recursive: true })
|
|
175
|
+
const written = await mod.writePanelFile(proj, SETTINGS)
|
|
176
|
+
assert.ok(written !== undefined, '在工作流范围内就该写')
|
|
177
|
+
|
|
178
|
+
const atRoot = await readFile(join(flowDir, '.project-flow', 'panel.json'), 'utf8')
|
|
179
|
+
assert.equal(JSON.parse(atRoot).routes.plan, '继承主对话')
|
|
180
|
+
// 子目录里不许有自己的那份
|
|
181
|
+
await assert.rejects(
|
|
182
|
+
() => readFile(join(proj, '.project-flow', 'panel.json'), 'utf8'),
|
|
183
|
+
'会话目录下不该再冒出一份 panel.json',
|
|
184
|
+
)
|
|
185
|
+
})
|
|
186
|
+
|
|
187
|
+
test('★ 不在工作流范围内:一个字节都不写', async () => {
|
|
188
|
+
// 默认工作区里改模型不该在那边点亮状态栏
|
|
189
|
+
const before = await readFile(join(flowDir, '.project-flow', 'panel.json'), 'utf8')
|
|
190
|
+
const out = await mod.writePanelFile(otherDir, SETTINGS)
|
|
191
|
+
assert.equal(out, undefined)
|
|
192
|
+
const after = await readFile(join(flowDir, '.project-flow', 'panel.json'), 'utf8')
|
|
193
|
+
assert.equal(after, before, '别处调用不该改动工作流那份')
|
|
194
|
+
await assert.rejects(
|
|
195
|
+
() => readFile(join(otherDir, '.project-flow', 'panel.json'), 'utf8'),
|
|
196
|
+
'别处也不该新建一份',
|
|
197
|
+
)
|
|
168
198
|
})
|
package/workspace/panel.mjs
CHANGED
|
@@ -141,6 +141,17 @@ export async function writePanelFile(cwd, settings) {
|
|
|
141
141
|
// 只在工作流目录里落这份:否则在普通目录改一下模型,状态栏就会在那边点亮,
|
|
142
142
|
// 而那个目录其实不接受工作模式。
|
|
143
143
|
if (!insideFlow(cwd, settings)) return undefined
|
|
144
|
+
// 写到「状态栏正在看的那个目录」,不是会话当前目录。
|
|
145
|
+
//
|
|
146
|
+
// 以前是 join(cwd, '.project-flow', 'panel.json'),于是同一个工作流会长出两份
|
|
147
|
+
// 面板数据:在外层壳目录开一次工落在壳里,项目却在它下面的「工作流」子目录里。
|
|
148
|
+
// 状态栏读一份、项目在另一份,界面上就是「项目在跑但状态栏没动」。
|
|
149
|
+
//
|
|
150
|
+
// 这里必须用 watchRootOf 而不是 flowRootTargetOf:读和写要用同一个解析函数,
|
|
151
|
+
// 否则「读哪儿」和「写哪儿」各算一套,错位比原来更难查。两者在配了绝对
|
|
152
|
+
// flowRoot 时结果相同,在没配时 flowRootTargetOf 会算出 cwd/工作流 这个
|
|
153
|
+
// 根本不存在的路径,而 watchRootOf 会正确回到 cwd 或找到祖先里那层「工作流」。
|
|
154
|
+
const root = await watchRootOf(cwd, settings)
|
|
144
155
|
const route = (llmProvider, model) => (model === '' ? '继承主对话' : `${llmProvider}/${model}`)
|
|
145
156
|
const payload = {
|
|
146
157
|
routes: {
|
|
@@ -154,8 +165,8 @@ export async function writePanelFile(cwd, settings) {
|
|
|
154
165
|
updatedAt: nowIso(),
|
|
155
166
|
}
|
|
156
167
|
try {
|
|
157
|
-
await mkdir(join(
|
|
158
|
-
await writeFileAtomic(join(
|
|
168
|
+
await mkdir(join(root, '.project-flow'), { recursive: true })
|
|
169
|
+
await writeFileAtomic(join(root, '.project-flow', 'panel.json'), `${JSON.stringify(payload, null, 2)}\n`)
|
|
159
170
|
} catch {
|
|
160
171
|
// 写不进去只影响状态栏显示,不该拖累正在跑的东西
|
|
161
172
|
}
|