@ghyper9023/pi-dev-workflow 0.5.1 → 0.6.0
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/.version/RELEASE-v0.6.0.md +106 -0
- package/README.md +32 -30
- package/agents/git-agent.md +24 -16
- package/agents/grill/dev-doc-grill-agent.md +5 -4
- package/agents/grill/dev-fix-grill-agent.md +5 -3
- package/agents/grill/dev-grill-agent.md +6 -6
- package/agents/grill/dev-perf-grill-agent.md +5 -3
- package/agents/grill/dev-prd-agent.md +1 -1
- package/agents/grill/dev-refactor-grill-agent.md +5 -2
- package/agents/grill/dev-test-grill-agent.md +5 -2
- package/agents/review-agent.md +30 -22
- package/agents/workflow/docWriter-agent.md +35 -22
- package/agents/workflow/planner-agent.md +95 -57
- package/agents/workflow/reviewer-agent.md +91 -33
- package/agents/workflow/trimmer-agent.md +59 -26
- package/agents/workflow/worker-agent.md +51 -25
- package/extensions/dev-prompts.ts +29 -29
- package/extensions/grill-me-agent.ts +16 -16
- package/extensions/workflow-engine.ts +65 -239
- package/package.json +1 -1
- package/tests/test-workflow-engine-bugs.mjs +123 -9
|
@@ -495,17 +495,19 @@ assert(singleStepFuncStart !== -1, "找到 executeSingleStep 函数");
|
|
|
495
495
|
const singleStepEndSearch = source.indexOf("async function executeLoopGroup", singleStepFuncStart);
|
|
496
496
|
const fullSingleStep = source.slice(singleStepFuncStart, singleStepEndSearch);
|
|
497
497
|
|
|
498
|
-
|
|
499
|
-
|
|
498
|
+
// Verify 工作总结 entries still exist (preserved - from extractFinalOutput)
|
|
499
|
+
const hasWorkSummaryKey = fullSingleStep.includes('工作总结');
|
|
500
|
+
assertTrue(hasWorkSummaryKey, "executeSingleStep 中保留 '工作总结' 条目");
|
|
500
501
|
|
|
501
|
-
const
|
|
502
|
-
assertTrue(
|
|
502
|
+
const hasWorkSummaryUpdate = fullSingleStep.includes('updateChainContext');
|
|
503
|
+
assertTrue(hasWorkSummaryUpdate, "executeSingleStep 中仍有 updateChainContext 调用(工作总结)");
|
|
503
504
|
|
|
504
|
-
|
|
505
|
-
|
|
505
|
+
// Verify the removed summary keys are no longer present
|
|
506
|
+
const hasPlannerKeyRemoved = !fullSingleStep.includes('"计划制定摘要"');
|
|
507
|
+
assertTrue(hasPlannerKeyRemoved, "executeSingleStep 中已移除 '计划制定摘要' key");
|
|
506
508
|
|
|
507
|
-
const
|
|
508
|
-
assertTrue(
|
|
509
|
+
const hasDocWriterKeyRemoved = !fullSingleStep.includes('"文档更新摘要"');
|
|
510
|
+
assertTrue(hasDocWriterKeyRemoved, "executeSingleStep 中已移除 '文档更新摘要' key");
|
|
509
511
|
|
|
510
512
|
|
|
511
513
|
console.log("\n═══ Bug H 测试 — Agent 前置元数据解析 ═══\n");
|
|
@@ -648,11 +650,123 @@ const reviewHasWorkflowId = reviewTaskParams.includes("workflowId");
|
|
|
648
650
|
assertTrue(reviewHasWorkflowId, "buildReviewTask 接收 workflowId 参数");
|
|
649
651
|
|
|
650
652
|
|
|
653
|
+
console.log("\n");
|
|
654
|
+
|
|
655
|
+
console.log("═══ Bug J 测试 — _workflowFileChanges 仅来自 git diff ═══\n");
|
|
656
|
+
|
|
657
|
+
// ── Test J1: _workflowFileChanges.push 仅出现在 updateToolsFromGit ──
|
|
658
|
+
console.log("📋 测试 J1: _workflowFileChanges.push 仅出现在 updateToolsFromGit\n");
|
|
659
|
+
|
|
660
|
+
// Count all _workflowFileChanges.push occurrences
|
|
661
|
+
const pushMatches = [...source.matchAll(/_workflowFileChanges\.push\(/g)];
|
|
662
|
+
assertEq(pushMatches.length, 1, "_workflowFileChanges.push 仅出现 1 次");
|
|
663
|
+
|
|
664
|
+
// Verify the single push is inside updateToolsFromGit by checking
|
|
665
|
+
// the function body of updateToolsFromGit contains the push.
|
|
666
|
+
const updateToolsStart = source.indexOf("function updateToolsFromGit");
|
|
667
|
+
const nextFuncStart = source.indexOf("function saveCheckpoint", updateToolsStart);
|
|
668
|
+
const updateToolsBody = source.slice(updateToolsStart, nextFuncStart);
|
|
669
|
+
const pushInUpdateTools = updateToolsBody.includes("_workflowFileChanges.push");
|
|
670
|
+
assertTrue(pushInUpdateTools, "updateToolsFromGit 函数体内包含 _workflowFileChanges.push");
|
|
671
|
+
|
|
672
|
+
// ── Test J2: addWidgetSubStepTool 不再污染 _workflowFileChanges ──
|
|
673
|
+
console.log("\n📋 测试 J2: addWidgetSubStepTool 不再污染 _workflowFileChanges\n");
|
|
674
|
+
|
|
675
|
+
const addWidgetFunc = source.slice(
|
|
676
|
+
source.indexOf("function addWidgetSubStepTool"),
|
|
677
|
+
source.indexOf("function addWidgetSubStepOutput")
|
|
678
|
+
);
|
|
679
|
+
const hasNoFileChangesRef = !addWidgetFunc.includes("_workflowFileChanges");
|
|
680
|
+
assertTrue(hasNoFileChangesRef, "addWidgetSubStepTool 中不再引用 _workflowFileChanges");
|
|
681
|
+
|
|
682
|
+
// ── Test J3: executeSingleStep 中不再有基于 _workflowFileChanges 的统计 ──
|
|
683
|
+
console.log("\n📋 测试 J3: executeSingleStep 中不再有 '执行摘要' 类 chain context\n");
|
|
684
|
+
|
|
685
|
+
const hasNoExecutorSummary = !fullSingleStep.includes('执行摘要');
|
|
686
|
+
assertTrue(hasNoExecutorSummary, "executeSingleStep 中不再有 '执行摘要' chain context");
|
|
687
|
+
|
|
688
|
+
// ── Test J4: executeLoopGroup 中不再有 "代码实施/精简摘要" chain context ──
|
|
689
|
+
console.log("\n📋 测试 J4: executeLoopGroup 中不再有 '代码实施/精简摘要' chain context\n");
|
|
690
|
+
|
|
691
|
+
const loopGroupStart = source.indexOf("async function executeLoopGroup");
|
|
692
|
+
assert(loopGroupStart !== -1, "找到 executeLoopGroup 函数");
|
|
693
|
+
const loopGroupBody = source.slice(loopGroupStart);
|
|
694
|
+
const hasNoCodeImplSummary = !loopGroupBody.includes('"代码实施摘要"') && !loopGroupBody.includes('"代码精简摘要"');
|
|
695
|
+
assertTrue(hasNoCodeImplSummary, "executeLoopGroup 中不再有 '代码实施摘要' 或 '代码精简摘要' chain context");
|
|
696
|
+
|
|
697
|
+
const hasNoReviewFeedbackKey = !loopGroupBody.includes('"代码审查反馈"') && !loopGroupBody.includes('"精简审查反馈"');
|
|
698
|
+
assertTrue(hasNoReviewFeedbackKey, "executeLoopGroup 中不再有 '代码审查反馈' 或 '精简审查反馈' chain context");
|
|
699
|
+
|
|
700
|
+
// ── Test J5: 工作总结条目在所有 agent 函数中仍保留 ──
|
|
701
|
+
console.log("\n📋 测试 J5: '工作总结' 条目在所有 agent 函数中仍保留\n");
|
|
702
|
+
|
|
703
|
+
const hasWorkSummaryInSingleStep = fullSingleStep.includes('工作总结');
|
|
704
|
+
assertTrue(hasWorkSummaryInSingleStep, "executeSingleStep 保留 '工作总结' 条目");
|
|
705
|
+
|
|
706
|
+
const hasWorkSummaryInLoop = loopGroupBody.includes('工作总结');
|
|
707
|
+
assertTrue(hasWorkSummaryInLoop, "executeLoopGroup 保留 '工作总结' 条目");
|
|
708
|
+
|
|
709
|
+
|
|
651
710
|
console.log("\n=== 增强功能测试汇总 ===\n");
|
|
652
711
|
console.log("📋 附加测试覆盖:");
|
|
653
|
-
console.log(" - G: 链上下文传递 (executeSingleStep)");
|
|
712
|
+
console.log(" - G: 链上下文传递 (executeSingleStep) — 已更新验证工作总结");
|
|
654
713
|
console.log(" - H: Agent 前置元数据解析 + MCP/SKILL 移除");
|
|
655
714
|
console.log(" - I: 工作流 UUID 溯源机制");
|
|
715
|
+
console.log(" - J: _workflowFileChanges 仅来自 git diff");
|
|
716
|
+
console.log("\n═══ Bug K 测试 — git diff 精准识别 + .pi-dev-output 过滤 ═══\n");
|
|
717
|
+
|
|
718
|
+
// ── Test K1: filePatterns 已移除 — 不再用 regex 猜文件路径 ──
|
|
719
|
+
console.log("📋 测试 K1: filePatterns 已移除\n");
|
|
720
|
+
|
|
721
|
+
const hasFilePatterns = source.includes("const filePatterns = [");
|
|
722
|
+
assertFalse(hasFilePatterns, "filePatterns 数组已移除(不再用 regex 嗅探文件路径)");
|
|
723
|
+
|
|
724
|
+
// ── Test K2: seenTools 文本解析 fallback 已移除 ──
|
|
725
|
+
console.log("\n📋 测试 K2: seenTools JSON fallback 已移除\n");
|
|
726
|
+
|
|
727
|
+
const hasJsonFallback = source.includes("if (seenTools.size === 0)");
|
|
728
|
+
assertFalse(hasJsonFallback, "seenTools JSON tool_use fallback 已移除");
|
|
729
|
+
|
|
730
|
+
// ── Test K3: outputPathPatterns 统一 inline 模式已移除 ──
|
|
731
|
+
console.log("\n📋 测试 K3: outputPathPatterns 已简化\n");
|
|
732
|
+
|
|
733
|
+
const hasOutputPathPatterns = source.includes("const outputPathPatterns = [");
|
|
734
|
+
assertFalse(hasOutputPathPatterns, "outputPathPatterns 数组已移除(替换为 inline workflowId 过滤)");
|
|
735
|
+
|
|
736
|
+
// ── Test K4: updateToolsFromGit 有 .pi-dev-output/ 过滤 ──
|
|
737
|
+
console.log("\n📋 测试 K4: updateToolsFromGit 过滤 .pi-dev-output/\n");
|
|
738
|
+
|
|
739
|
+
const hasDotPiDevFilter = source.includes('change.path.startsWith(".pi-dev-output/")');
|
|
740
|
+
assertTrue(hasDotPiDevFilter, "updateToolsFromGit 跳过 .pi-dev-output/ 路径");
|
|
741
|
+
|
|
742
|
+
// ── Test K5: output 路径匹配使用 escapedId + workflowId ──
|
|
743
|
+
console.log("\n📋 测试 K5: output 路径使用 workflowId 过滤\n");
|
|
744
|
+
|
|
745
|
+
const hasEscapedId = source.includes("const escapedId = _workflowId.replace(");
|
|
746
|
+
assertTrue(hasEscapedId, "output 路径匹配使用 escapedId");
|
|
747
|
+
|
|
748
|
+
// ── Test K6: progress handler output match 使用 _workflowId ──
|
|
749
|
+
console.log("\n📋 测试 K6: progress handler 使用 workflowId\n");
|
|
750
|
+
|
|
751
|
+
const hasIncludesWorkflowId = source.includes("pathCandidate.includes(_workflowId)");
|
|
752
|
+
assertTrue(hasIncludesWorkflowId, "progress handler 使用 pathCandidate.includes(_workflowId)");
|
|
753
|
+
|
|
754
|
+
// ── Test K7: addWidgetSubStepTool 只来自 git diff + progress handler ──
|
|
755
|
+
console.log("\n📋 测试 K7: addWidgetSubStepTool 只来自必要来源\n");
|
|
756
|
+
|
|
757
|
+
// Verify the two known call sites exist:
|
|
758
|
+
// 1. updateToolsFromGit: calls addWidgetSubStepTool with git status + path
|
|
759
|
+
// 2. runAgentWithProgress progress handler: calls addWidgetSubStepTool with parsed toolMatch
|
|
760
|
+
// Both are runtime call sites (not the function definition itself).
|
|
761
|
+
assertTrue(source.includes("addWidgetSubStepTool(stepIndex, agentName, `${change.status} ${change.path}`)"), "updateToolsFromGit 调用 addWidgetSubStepTool");
|
|
762
|
+
assertTrue(source.includes("addWidgetSubStepTool(stepIndex, agentName, `${gitStatus} ${target}`)"), "progress handler 调用 addWidgetSubStepTool");
|
|
763
|
+
|
|
764
|
+
// ── Test K8: addWidgetSubStepOutput 仍存在 (output 路径展示有用) ──
|
|
765
|
+
console.log("\n📋 测试 K8: addWidgetSubStepOutput 仍保留\n");
|
|
766
|
+
|
|
767
|
+
const hasAddWidgetOutput = source.includes("function addWidgetSubStepOutput");
|
|
768
|
+
assertTrue(hasAddWidgetOutput, "addWidgetSubStepOutput 函数声明仍保留");
|
|
769
|
+
|
|
656
770
|
|
|
657
771
|
|
|
658
772
|
console.log("\n═══════════════════════════════════════════════════════\n");
|