sdd-flow-kit 1.2.1 → 1.2.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/dist/adapters/index.js +80 -2
- package/dist/core/gitDiffGuard.js +0 -2
- package/dist/steps/runFlow.js +1 -0
- package/package.json +1 -1
package/dist/adapters/index.js
CHANGED
|
@@ -19,7 +19,7 @@ function createManualAdapter(name, displayName, bins) {
|
|
|
19
19
|
async checkAvailable() {
|
|
20
20
|
return bins.some((bin) => hasCommand(bin));
|
|
21
21
|
},
|
|
22
|
-
async runFlow() {
|
|
22
|
+
async runFlow(_args) {
|
|
23
23
|
return false;
|
|
24
24
|
},
|
|
25
25
|
};
|
|
@@ -71,10 +71,88 @@ async function runClaudeFlow(args) {
|
|
|
71
71
|
return false;
|
|
72
72
|
return /SDD flow completed/i.test(commandResult.stdout || "");
|
|
73
73
|
}
|
|
74
|
+
async function runCursorFlow(args) {
|
|
75
|
+
var _a;
|
|
76
|
+
/**
|
|
77
|
+
* Cursor Agent 自动执行开关:
|
|
78
|
+
* - 默认开启(符合“除澄清外全自动”的产品预期)
|
|
79
|
+
* - 如需关闭:SDD_FLOW_KIT_ENABLE_CURSOR_AUTORUN=0
|
|
80
|
+
*/
|
|
81
|
+
if (process_1.default.env.SDD_FLOW_KIT_ENABLE_CURSOR_AUTORUN === "0") {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
if (!hasCommand("cursor"))
|
|
85
|
+
return false;
|
|
86
|
+
const sddPrompt = await (0, fs_1.readFileIfExists)(path_1.default.join(args.outputRoot, "02-需求分析提示词.md"));
|
|
87
|
+
if (!sddPrompt)
|
|
88
|
+
return false;
|
|
89
|
+
const prompt = [
|
|
90
|
+
`你在项目目录内执行 SDD 流程(runId=${args.runId})。目标:除“需求澄清”外全自动推进。`,
|
|
91
|
+
"",
|
|
92
|
+
"强约束:",
|
|
93
|
+
"1) 在 docs 阶段(docModeOnly=true)只允许改 openspec/PRD/**,禁止改 src/。",
|
|
94
|
+
"2) 若矛盾点池未闭合:仅更新 03-待确认问题清单.md 并停止,等待用户确认点。",
|
|
95
|
+
"3) 若矛盾点池已闭合:同一回合生成 01/02/04,并自动衔接 openspec+superpowers(autoChainOpsx=true 时)。",
|
|
96
|
+
"",
|
|
97
|
+
"执行顺序:",
|
|
98
|
+
"A) 先按 01-获取需求文档指引.md 执行 confluence-doc.py,把 PRD 回填到 source/PRD.md。",
|
|
99
|
+
"B) 再执行 02-需求分析提示词.md(如下)生成/更新 03(必要时)或生成 01/02/04。",
|
|
100
|
+
"C) 若满足自动串联条件(autoChainOpsx!==false 且用户未说只提案):继续按 06-opsx-自动串联指引.md 走 propose→apply→delivery-pipeline。",
|
|
101
|
+
"",
|
|
102
|
+
"完成判定:",
|
|
103
|
+
"- 若停在澄清:输出一句 `SDD_STATUS=AWAIT_CONFIRMATION`。",
|
|
104
|
+
"- 若全链路完成:输出一句 `SDD_STATUS=COMPLETE`。",
|
|
105
|
+
"",
|
|
106
|
+
"以下是第 B 步提示词:",
|
|
107
|
+
sddPrompt,
|
|
108
|
+
].join("\n");
|
|
109
|
+
const commandResult = (0, child_process_1.spawnSync)("cursor", [
|
|
110
|
+
"agent",
|
|
111
|
+
"--print",
|
|
112
|
+
"--trust",
|
|
113
|
+
"--workspace",
|
|
114
|
+
args.projectRoot,
|
|
115
|
+
prompt,
|
|
116
|
+
], {
|
|
117
|
+
cwd: args.outputRoot,
|
|
118
|
+
encoding: "utf8",
|
|
119
|
+
env: process_1.default.env,
|
|
120
|
+
});
|
|
121
|
+
await (0, fs_1.writeTextFileEnsuredDir)(path_1.default.join(args.outputRoot, "AUTO-RUN-LOG.md"), [
|
|
122
|
+
"# AUTO-RUN-LOG",
|
|
123
|
+
"",
|
|
124
|
+
"agent: cursor-agent",
|
|
125
|
+
`status: ${(_a = commandResult.status) !== null && _a !== void 0 ? _a : "unknown"}`,
|
|
126
|
+
"",
|
|
127
|
+
"## stdout",
|
|
128
|
+
commandResult.stdout || "",
|
|
129
|
+
"",
|
|
130
|
+
"## stderr",
|
|
131
|
+
commandResult.stderr || "",
|
|
132
|
+
].join("\n"));
|
|
133
|
+
if (commandResult.status !== 0)
|
|
134
|
+
return false;
|
|
135
|
+
return /SDD_STATUS=COMPLETE/i.test(commandResult.stdout || "");
|
|
136
|
+
}
|
|
74
137
|
function getAdapter(name) {
|
|
75
138
|
switch (name) {
|
|
76
139
|
case "cursor":
|
|
77
|
-
return
|
|
140
|
+
return {
|
|
141
|
+
name: "cursor",
|
|
142
|
+
displayName: "Cursor",
|
|
143
|
+
async checkAvailable() {
|
|
144
|
+
return hasCommand("cursor");
|
|
145
|
+
},
|
|
146
|
+
async runFlow(args) {
|
|
147
|
+
return runCursorFlow({
|
|
148
|
+
projectRoot: args.projectRoot,
|
|
149
|
+
outputRoot: args.outputRoot,
|
|
150
|
+
runId: args.runId,
|
|
151
|
+
product: args.product,
|
|
152
|
+
version: args.version,
|
|
153
|
+
});
|
|
154
|
+
},
|
|
155
|
+
};
|
|
78
156
|
case "claude-code":
|
|
79
157
|
return {
|
|
80
158
|
name: "claude-code",
|
package/dist/steps/runFlow.js
CHANGED