@kangyishuai/dsh-casefile 0.1.0 → 0.1.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.
@@ -37,7 +37,7 @@ export const OPTIONAL_REA_TOOLS = /** @type {const} */ ([
37
37
  "build_reconstruction_obligation_ledger",
38
38
  "evaluate_reconstruction_coverage",
39
39
  "verify_reconstruction",
40
- "screen_judge",
40
+ "check_build_task",
41
41
  "inspect_playwright_trace",
42
42
  ]);
43
43
 
package/lib/tools.js CHANGED
@@ -171,6 +171,26 @@ export function buildToolDefinitions(handlers, projectOf) {
171
171
  const project = await handlers.updateProject(projectId(args, exec), args.patch ?? {});
172
172
  return { project, summary: `已更新项目 ${project.id}` };
173
173
  }
174
+ case "close": {
175
+ const id = projectId(args, exec);
176
+ // 先给只读预览再关:被闸门拒绝时把卡点原样带回去,别只说"失败"
177
+ const preview = await handlers.closePreview(id, { minCoverage: args.minCoverage });
178
+ if (preview.ok !== true) {
179
+ throw Object.assign(new Error(`项目还不能关闭:${preview.blockers.join("、")}`), {
180
+ code: "coverage-not-met",
181
+ blockers: preview.blockers,
182
+ });
183
+ }
184
+ const closed = await handlers.closeProject(id, { minCoverage: args.minCoverage });
185
+ return {
186
+ closed: closed.project,
187
+ coverage: preview.coverage,
188
+ summary: `项目已关闭(覆盖率 ${(preview.coverage.ratio * 100).toFixed(0)}%)`,
189
+ };
190
+ }
191
+ case "report": {
192
+ return handlers.exportReport(projectId(args, exec));
193
+ }
174
194
  default:
175
195
  throw Object.assign(new Error(`未知 action:${String(args.action)}`), {
176
196
  code: "invalid-input",
@@ -494,16 +514,18 @@ export function buildToolDefinitions(handlers, projectOf) {
494
514
  const action = assertAction(args.action, ["start", "status", "agent", "loop", "cycle"]);
495
515
  const id = projectId(args, exec);
496
516
  if (action === "cycle") {
517
+ // 只有显式要求 builder(prompt 或 featureIds)才起会话;
518
+ // cwd 是构建目录,单独给 cwd 不应该顺手启动一个 builder 子会话。
519
+ const wantsBuilder = args.prompt !== undefined || args.featureIds !== undefined;
497
520
  const result = await handlers.runCycle(id, {
498
- builder:
499
- args.prompt === undefined && args.featureIds === undefined && args.cwd === undefined
500
- ? undefined
501
- : {
502
- cwd: args.cwd,
503
- prompt: args.prompt,
504
- featureIds: args.featureIds,
505
- timeoutMs: args.timeoutMs,
506
- },
521
+ builder: wantsBuilder
522
+ ? {
523
+ cwd: args.cwd,
524
+ prompt: args.prompt,
525
+ featureIds: args.featureIds,
526
+ timeoutMs: args.timeoutMs,
527
+ }
528
+ : undefined,
507
529
  command: args.command,
508
530
  cwd: args.cwd,
509
531
  maxRounds: args.maxRounds,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kangyishuai/dsh-casefile",
3
- "version": "0.1.0",
4
- "description": "循证逆向工作台:把 REA 的观察变成可引用的证据与可复算的验收",
3
+ "version": "0.1.2",
4
+ "description": "Evidence-first reverse-engineering workbench on top of REA: observations become citable evidence, a handoff spec pack, and recomputable acceptance checks. No bridge, no engine.",
5
5
  "keywords": [
6
6
  "dsh",
7
7
  "dsh-plugin",