@ghyper9023/pi-dev-workflow 0.5.1 → 0.6.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/.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 +97 -59
- package/agents/workflow/reviewer-agent.md +100 -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 +149 -271
- package/package.json +1 -1
- package/tests/test-workflow-engine-bugs.mjs +252 -10
|
@@ -399,7 +399,7 @@ const FEAT_WORKFLOW_STEPS: WorkflowStepDef[] = [
|
|
|
399
399
|
label: "📝 更新文档",
|
|
400
400
|
type: "confirm",
|
|
401
401
|
agentName: "docWriter",
|
|
402
|
-
timeoutMs:
|
|
402
|
+
timeoutMs: 600_000,
|
|
403
403
|
},
|
|
404
404
|
];
|
|
405
405
|
|
|
@@ -426,7 +426,7 @@ const FIX_WORKFLOW_STEPS: WorkflowStepDef[] = [
|
|
|
426
426
|
label: "📝 更新文档",
|
|
427
427
|
type: "confirm",
|
|
428
428
|
agentName: "docWriter",
|
|
429
|
-
timeoutMs:
|
|
429
|
+
timeoutMs: 600_000,
|
|
430
430
|
},
|
|
431
431
|
];
|
|
432
432
|
|
|
@@ -513,7 +513,7 @@ const DOC_WORKFLOW_STEPS: WorkflowStepDef[] = [
|
|
|
513
513
|
label: "📝 撰写文档",
|
|
514
514
|
type: "auto",
|
|
515
515
|
agentName: "docWriter",
|
|
516
|
-
timeoutMs:
|
|
516
|
+
timeoutMs: 600_000,
|
|
517
517
|
},
|
|
518
518
|
];
|
|
519
519
|
|
|
@@ -536,7 +536,7 @@ const SECURITY_WORKFLOW_STEPS: WorkflowStepDef[] = [
|
|
|
536
536
|
label: "🔒 安全审查",
|
|
537
537
|
type: "auto",
|
|
538
538
|
agentName: "reviewer",
|
|
539
|
-
timeoutMs:
|
|
539
|
+
timeoutMs: 900_000,
|
|
540
540
|
},
|
|
541
541
|
];
|
|
542
542
|
|
|
@@ -857,7 +857,7 @@ const COMPARE_QUESTIONS = [
|
|
|
857
857
|
export default function (pi: ExtensionAPI) {
|
|
858
858
|
// ── /dev-feat ──────────────────────────────────────────────
|
|
859
859
|
pi.registerCommand("dev-feat", {
|
|
860
|
-
description: "(prompt wizard) 新功能/创意生成 —
|
|
860
|
+
description: "(prompt wizard) 新功能/创意生成 — 支持设计方案追问完善 (Grill) + 自动化工作流",
|
|
861
861
|
handler: async (_args, ctx) => {
|
|
862
862
|
const answers: Record<string, string> = {};
|
|
863
863
|
let featIdx = 0;
|
|
@@ -911,17 +911,17 @@ export default function (pi: ExtensionAPI) {
|
|
|
911
911
|
|
|
912
912
|
// ── /dev-fix ───────────────────────────────────────────────
|
|
913
913
|
pi.registerCommand("dev-fix", {
|
|
914
|
-
description: "(prompt wizard) 问题排查/错误修正 —
|
|
914
|
+
description: "(prompt wizard) 问题排查/错误修正 — 支持 Bug 根因追问 (Grill)",
|
|
915
915
|
handler: async (_args, ctx) => {
|
|
916
916
|
await runWizardWithGrill(
|
|
917
917
|
ctx, pi, "fix", "问题排查/错误修正",
|
|
918
918
|
FIX_QUESTIONS, assembleFixPrompt,
|
|
919
919
|
{
|
|
920
920
|
agentDef: _fixGrillAgent,
|
|
921
|
-
title: "🐛 Bug
|
|
922
|
-
description: "AI
|
|
921
|
+
title: "🐛 Bug 根因追问",
|
|
922
|
+
description: "AI 会通过一步步追问帮你精准定位根因:从复现条件到根本原因推理,再到修复方案验证和回归风险评估。",
|
|
923
923
|
questionTitle: "Bug 根因分析",
|
|
924
|
-
loaderLabel: "🧠 AI
|
|
924
|
+
loaderLabel: "🧠 AI 正在分析代码并生成根因追问问题...",
|
|
925
925
|
},
|
|
926
926
|
{ steps: FIX_WORKFLOW_STEPS },
|
|
927
927
|
);
|
|
@@ -930,17 +930,17 @@ export default function (pi: ExtensionAPI) {
|
|
|
930
930
|
|
|
931
931
|
// ── /dev-doc ───────────────────────────────────────────────
|
|
932
932
|
pi.registerCommand("dev-doc", {
|
|
933
|
-
description: "(prompt wizard) 文档生成/总结 —
|
|
933
|
+
description: "(prompt wizard) 文档生成/总结 — 支持文档大纲追问完善 (Grill)",
|
|
934
934
|
handler: async (_args, ctx) => {
|
|
935
935
|
await runWizardWithGrill(
|
|
936
936
|
ctx, pi, "doc", "文档生成/总结",
|
|
937
937
|
DOC_QUESTIONS, assembleDocPrompt,
|
|
938
938
|
{
|
|
939
939
|
agentDef: _docGrillAgent,
|
|
940
|
-
title: "📄
|
|
941
|
-
description: "AI
|
|
942
|
-
questionTitle: "
|
|
943
|
-
loaderLabel: "🧠 AI
|
|
940
|
+
title: "📄 文档大纲追问完善",
|
|
941
|
+
description: "AI 会通过追问帮你完善文档大纲:从受众定位到结构安排,确认术语一致性和示例覆盖范围。",
|
|
942
|
+
questionTitle: "文档大纲追问完善",
|
|
943
|
+
loaderLabel: "🧠 AI 正在分析并生成文档大纲追问问题...",
|
|
944
944
|
},
|
|
945
945
|
{ steps: DOC_WORKFLOW_STEPS },
|
|
946
946
|
);
|
|
@@ -949,17 +949,17 @@ export default function (pi: ExtensionAPI) {
|
|
|
949
949
|
|
|
950
950
|
// ── /dev-refactor ──────────────────────────────────────────
|
|
951
951
|
pi.registerCommand("dev-refactor", {
|
|
952
|
-
description: "(prompt wizard) 重构/优化现有结构 —
|
|
952
|
+
description: "(prompt wizard) 重构/优化现有结构 — 支持重构方案追问 (Grill)",
|
|
953
953
|
handler: async (_args, ctx) => {
|
|
954
954
|
await runWizardWithGrill(
|
|
955
955
|
ctx, pi, "refactor", "重构/优化",
|
|
956
956
|
REFACTOR_QUESTIONS, assembleRefactorPrompt,
|
|
957
957
|
{
|
|
958
958
|
agentDef: _refactorGrillAgent,
|
|
959
|
-
title: "🔧
|
|
960
|
-
description: "AI
|
|
961
|
-
questionTitle: "
|
|
962
|
-
loaderLabel: "🧠 AI
|
|
959
|
+
title: "🔧 重构方案追问",
|
|
960
|
+
description: "AI 会通过追问帮你识别隐藏耦合风险:从模块边界到 API 兼容性,验证行为保持和迁移路径安全性。",
|
|
961
|
+
questionTitle: "重构方案追问",
|
|
962
|
+
loaderLabel: "🧠 AI 正在分析代码并生成重构追问问题...",
|
|
963
963
|
},
|
|
964
964
|
{ steps: REFACTOR_WORKFLOW_STEPS },
|
|
965
965
|
);
|
|
@@ -968,17 +968,17 @@ export default function (pi: ExtensionAPI) {
|
|
|
968
968
|
|
|
969
969
|
// ── /dev-test ──────────────────────────────────────────────
|
|
970
970
|
pi.registerCommand("dev-test", {
|
|
971
|
-
description: "(prompt wizard) 测试用例生成 —
|
|
971
|
+
description: "(prompt wizard) 测试用例生成 — 支持测试策略追问 (Grill)",
|
|
972
972
|
handler: async (_args, ctx) => {
|
|
973
973
|
await runWizardWithGrill(
|
|
974
974
|
ctx, pi, "test", "测试用例/评估",
|
|
975
975
|
TEST_QUESTIONS, assembleTestPrompt,
|
|
976
976
|
{
|
|
977
977
|
agentDef: _testGrillAgent,
|
|
978
|
-
title: "🧪
|
|
979
|
-
description: "AI
|
|
980
|
-
questionTitle: "
|
|
981
|
-
loaderLabel: "🧠 AI
|
|
978
|
+
title: "🧪 测试策略追问",
|
|
979
|
+
description: "AI 会通过追问帮你发现测试缺口:从覆盖维度到边界条件,验证模拟策略和测试隔离是否到位。",
|
|
980
|
+
questionTitle: "测试策略追问",
|
|
981
|
+
loaderLabel: "🧠 AI 正在分析并生成测试追问问题...",
|
|
982
982
|
},
|
|
983
983
|
{ steps: TEST_WORKFLOW_STEPS },
|
|
984
984
|
);
|
|
@@ -995,17 +995,17 @@ export default function (pi: ExtensionAPI) {
|
|
|
995
995
|
|
|
996
996
|
// ── /dev-perf ──────────────────────────────────────────────
|
|
997
997
|
pi.registerCommand("dev-perf", {
|
|
998
|
-
description: "(prompt wizard) 性能优化 —
|
|
998
|
+
description: "(prompt wizard) 性能优化 — 支持性能优化方案追问 (Grill)",
|
|
999
999
|
handler: async (_args, ctx) => {
|
|
1000
1000
|
await runWizardWithGrill(
|
|
1001
1001
|
ctx, pi, "perf", "性能优化",
|
|
1002
1002
|
PERF_QUESTIONS, assemblePerfPrompt,
|
|
1003
1003
|
{
|
|
1004
1004
|
agentDef: _perfGrillAgent,
|
|
1005
|
-
title: "⚡
|
|
1006
|
-
description: "AI
|
|
1007
|
-
questionTitle: "
|
|
1008
|
-
loaderLabel: "🧠 AI
|
|
1005
|
+
title: "⚡ 性能优化方案追问",
|
|
1006
|
+
description: "AI 会通过追问帮你验证瓶颈判断和优化方向:从基准测试方法到潜在回归风险,确保方案合理性。",
|
|
1007
|
+
questionTitle: "性能优化方案追问",
|
|
1008
|
+
loaderLabel: "🧠 AI 正在分析并生成性能优化追问问题...",
|
|
1009
1009
|
},
|
|
1010
1010
|
{ steps: PERF_WORKFLOW_STEPS },
|
|
1011
1011
|
);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* grill-me-agent.ts —
|
|
2
|
+
* grill-me-agent.ts — 设计 (Grill) 和 PRD 生成的独立管理器
|
|
3
3
|
*
|
|
4
4
|
* 职责:
|
|
5
5
|
* 1. runGrillPhase() — 启动 sub-agent 生成评审问题,TUI 逐题呈现(选项 + 自定义输入)
|
|
@@ -372,10 +372,10 @@ export async function runGrillPhase(
|
|
|
372
372
|
};
|
|
373
373
|
|
|
374
374
|
const agentDef = options?.agentDef ?? _defaultGrillAgent;
|
|
375
|
-
const confirmTitle = options?.title ?? "🔍
|
|
376
|
-
const confirmDesc = options?.description ?? "AI
|
|
377
|
-
const qTitlePrefix = options?.questionTitle ?? "
|
|
378
|
-
const loaderLabel = options?.loaderLabel ?? "🧠 AI
|
|
375
|
+
const confirmTitle = options?.title ?? "🔍 设计方案追问完善";
|
|
376
|
+
const confirmDesc = options?.description ?? "AI 会通过系统性追问帮你打磨方案:从术语精确化到边界条件验证,确保架构决策的每个分支都经过推敲。";
|
|
377
|
+
const qTitlePrefix = options?.questionTitle ?? "设计方案追问完善";
|
|
378
|
+
const loaderLabel = options?.loaderLabel ?? "🧠 AI 子代理正在分析代码并生成追问问题...";
|
|
379
379
|
|
|
380
380
|
// ── Step 1: Confirm entering grill mode ──────────────────
|
|
381
381
|
const enterGrill = await uiConfirm(ctx, confirmTitle, confirmDesc);
|
|
@@ -438,16 +438,16 @@ export async function runGrillPhase(
|
|
|
438
438
|
|
|
439
439
|
const choice = await uiSelect(
|
|
440
440
|
ctx,
|
|
441
|
-
"⚠️ AI
|
|
441
|
+
"⚠️ AI 未能成功生成追问问题",
|
|
442
442
|
[
|
|
443
|
-
"🔄
|
|
443
|
+
"🔄 重新尝试生成追问问题",
|
|
444
444
|
"⏭️ 跳过 Grill,直接发送 Prompt",
|
|
445
445
|
"❌ 取消 (Esc)",
|
|
446
446
|
],
|
|
447
447
|
);
|
|
448
448
|
|
|
449
449
|
switch (choice) {
|
|
450
|
-
case "🔄
|
|
450
|
+
case "🔄 重新尝试生成追问问题": {
|
|
451
451
|
const retryPath = grillOutputPath(ctx.cwd);
|
|
452
452
|
const errorFeedback = parseErrorMsg
|
|
453
453
|
? [
|
|
@@ -513,13 +513,13 @@ export async function runGrillPhase(
|
|
|
513
513
|
rIdx++;
|
|
514
514
|
}
|
|
515
515
|
const qaBlock = pairs
|
|
516
|
-
.map((p, i) => `[
|
|
516
|
+
.map((p, i) => `[追问问题 ${i + 1}]\n问题: ${p.question}\n回答: ${p.answer}`)
|
|
517
517
|
.join("\n\n");
|
|
518
518
|
const finalEnhancedPrompt = [
|
|
519
519
|
assembledPrompt,
|
|
520
520
|
"",
|
|
521
521
|
"---",
|
|
522
|
-
"##
|
|
522
|
+
"## 设计追问记录",
|
|
523
523
|
"",
|
|
524
524
|
"以下是在开发前进行的设计评审问答,所有决策已确认:",
|
|
525
525
|
"",
|
|
@@ -572,16 +572,16 @@ export async function runGrillPhase(
|
|
|
572
572
|
|
|
573
573
|
// ── Step 6: Assemble enhanced prompt ─────────────────────
|
|
574
574
|
const qaBlock = pairs
|
|
575
|
-
.map((p, i) => `[
|
|
575
|
+
.map((p, i) => `[追问问题 ${i + 1}]\n问题: ${p.question}\n回答: ${p.answer}`)
|
|
576
576
|
.join("\n\n");
|
|
577
577
|
|
|
578
578
|
const finalEnhancedPrompt = [
|
|
579
579
|
assembledPrompt,
|
|
580
580
|
"",
|
|
581
581
|
"---",
|
|
582
|
-
"##
|
|
582
|
+
"## 方案追问记录",
|
|
583
583
|
"",
|
|
584
|
-
"
|
|
584
|
+
"以下是在开发前进行的追问式方案打磨记录,所有决策已确认:",
|
|
585
585
|
"",
|
|
586
586
|
qaBlock,
|
|
587
587
|
].join("\n");
|
|
@@ -615,7 +615,7 @@ async function showQuestionTUI(
|
|
|
615
615
|
q: GrillQuestion,
|
|
616
616
|
currentIndex: number,
|
|
617
617
|
totalCount: number,
|
|
618
|
-
titlePrefix = "
|
|
618
|
+
titlePrefix = "设计方案追问完善",
|
|
619
619
|
backable = false,
|
|
620
620
|
previousAnswer?: string,
|
|
621
621
|
): Promise<string | null> {
|
|
@@ -707,8 +707,8 @@ async function showQuestionTUI(
|
|
|
707
707
|
|
|
708
708
|
container.addChild(new Spacer(1));
|
|
709
709
|
const hint = backable && currentIndex > 1
|
|
710
|
-
? " ↑↓ 导航 • Enter 选择 • Ctrl+Shift+← 返回上一题 • Esc
|
|
711
|
-
: " ↑↓ 导航 • Enter 选择 • Esc
|
|
710
|
+
? " ↑↓ 导航 • Enter 选择 • Ctrl+Shift+← 返回上一题 • Esc 取消全部追问"
|
|
711
|
+
: " ↑↓ 导航 • Enter 选择 • Esc 取消全部追问";
|
|
712
712
|
container.addChild(
|
|
713
713
|
new Text(theme.fg("dim", hint), 0, 0),
|
|
714
714
|
);
|