safepropel 1.4.1 → 1.4.3
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/engine/workflow-executor.js +19 -27
- package/package.json +1 -1
|
@@ -209,12 +209,15 @@ class WorkflowExecutor {
|
|
|
209
209
|
const workflow = this.runtime.get(promptPath);
|
|
210
210
|
|
|
211
211
|
// Extract template reference ONLY from Output section to avoid loading multiple templates
|
|
212
|
-
// Look for
|
|
212
|
+
// Look for various patterns:
|
|
213
|
+
// - "Generate the output using the `.propel/templates/xxx-template.md` template"
|
|
214
|
+
// - "generate ... using `.propel/templates/xxx-template.md` template"
|
|
215
|
+
// - "using `.propel/templates/requirements-template.md` template"
|
|
213
216
|
const outputSectionMatch = workflow.content.match(/## Output[\s\S]*?(?=##|$)/);
|
|
214
217
|
const outputSection = outputSectionMatch ? outputSectionMatch[0] : workflow.content;
|
|
215
218
|
|
|
216
|
-
// Extract template reference from output section
|
|
217
|
-
const templateMatch = outputSection.match(/
|
|
219
|
+
// Extract template reference from output section - flexible pattern
|
|
220
|
+
const templateMatch = outputSection.match(/using\s+`(\.propel\/templates\/[a-z-]+\.md)`\s+template/i);
|
|
218
221
|
const templates = [];
|
|
219
222
|
|
|
220
223
|
if (templateMatch) {
|
|
@@ -228,15 +231,10 @@ class WorkflowExecutor {
|
|
|
228
231
|
path: templatePath,
|
|
229
232
|
content: templateContent
|
|
230
233
|
});
|
|
231
|
-
console.log(`✅ Loaded template from filesystem: ${templatePath} (${templateContent.length} chars)`);
|
|
232
|
-
} else {
|
|
233
|
-
console.warn(`⚠️ Template not found in filesystem: ${templateFullPath}`);
|
|
234
234
|
}
|
|
235
235
|
} catch (error) {
|
|
236
|
-
|
|
236
|
+
// Template loading failed - continue without template
|
|
237
237
|
}
|
|
238
|
-
} else {
|
|
239
|
-
console.warn(`⚠️ No template reference found in Output section for workflow: ${workflowName}`);
|
|
240
238
|
}
|
|
241
239
|
|
|
242
240
|
// Extract rule references from workflow Guardrails section
|
|
@@ -254,18 +252,11 @@ class WorkflowExecutor {
|
|
|
254
252
|
path: `.windsurf/rules/${ruleFile}`,
|
|
255
253
|
content: ruleContent
|
|
256
254
|
});
|
|
257
|
-
} else {
|
|
258
|
-
console.warn(`⚠️ Referenced rule not found: ${ruleFile}`);
|
|
259
255
|
}
|
|
260
256
|
} catch (error) {
|
|
261
|
-
|
|
257
|
+
// Rule loading failed - continue without this rule
|
|
262
258
|
}
|
|
263
259
|
}
|
|
264
|
-
|
|
265
|
-
console.log(`✅ Loaded ${rules.length}/${referencedRules.length} referenced rules from workflow Guardrails`);
|
|
266
|
-
console.log(` Rules: ${rules.map(r => path.basename(r.path)).join(', ')}`);
|
|
267
|
-
} else if (referencedRules.length === 0) {
|
|
268
|
-
console.log(`ℹ️ No rules referenced in workflow Guardrails section`);
|
|
269
260
|
}
|
|
270
261
|
|
|
271
262
|
// Construct prompt with workflow + rules + templates + input
|
|
@@ -348,8 +339,13 @@ class WorkflowExecutor {
|
|
|
348
339
|
|
|
349
340
|
prompt += `\n⚠️ CRITICAL TEMPLATE ENFORCEMENT for ${template.path}:\n`;
|
|
350
341
|
prompt += `\n1. DOCUMENT TITLE:\n`;
|
|
351
|
-
prompt += ` ✅ MUST be
|
|
352
|
-
prompt += `
|
|
342
|
+
prompt += ` ✅ MUST be EXACTLY: "${title}"\n`;
|
|
343
|
+
prompt += ` ✅ Use NO project name, NO prefixes, NO suffixes, NO modifications\n`;
|
|
344
|
+
prompt += ` ❌ WRONG: "# Project Name - ${title}"\n`;
|
|
345
|
+
prompt += ` ❌ WRONG: "# ${title} - Project Name"\n`;
|
|
346
|
+
prompt += ` ❌ WRONG: "# ${title} for Project"\n`;
|
|
347
|
+
prompt += ` ✅ CORRECT: "# ${title}"\n`;
|
|
348
|
+
prompt += ` ⚠️ CRITICAL: The title "${title}" is the COMPLETE title - add NOTHING to it\n`;
|
|
353
349
|
|
|
354
350
|
prompt += `\n2. REQUIRED SECTIONS (EXACT order and names):\n`;
|
|
355
351
|
sectionList.forEach((section, idx) => {
|
|
@@ -386,14 +382,15 @@ class WorkflowExecutor {
|
|
|
386
382
|
|
|
387
383
|
prompt += `\n6. MANDATORY ACTIONS:\n`;
|
|
388
384
|
prompt += ` ✅ Use section names VERBATIM from list in step 2\n`;
|
|
385
|
+
prompt += ` ✅ Use document title VERBATIM from step 1 (no modifications)\n`;
|
|
389
386
|
prompt += ` ✅ Fill bracketed placeholders [like this] with actual content\n`;
|
|
390
387
|
prompt += ` ✅ Maintain exact heading levels (# ## ### ####)\n`;
|
|
391
388
|
prompt += ` ✅ Include ONLY sections from template\n`;
|
|
392
389
|
prompt += ` ✅ Skip [CONDITIONAL] sections if not applicable\n`;
|
|
393
390
|
prompt += ` ✅ Follow requirement format patterns exactly\n`;
|
|
394
|
-
prompt += ` ⚠️ CRITICAL:
|
|
395
|
-
prompt += ` ⚠️ CRITICAL:
|
|
396
|
-
prompt += ` ⚠️ CRITICAL:
|
|
391
|
+
prompt += ` ⚠️ CRITICAL: Template structure is MANDATORY - no additions, no changes\n`;
|
|
392
|
+
prompt += ` ⚠️ CRITICAL: Section names and order are FIXED - use them exactly\n`;
|
|
393
|
+
prompt += ` ⚠️ CRITICAL: Document title is COMPLETE - do not prepend project name\n`;
|
|
397
394
|
|
|
398
395
|
prompt += `\n7. TEMPLATE TYPE VALIDATION:\n`;
|
|
399
396
|
prompt += ` 🔍 This is a "${title}" - NOT a requirements document\n`;
|
|
@@ -436,11 +433,6 @@ class WorkflowExecutor {
|
|
|
436
433
|
prompt += `⚠️ The required filename is: ${outputFilePath}\n`;
|
|
437
434
|
}
|
|
438
435
|
|
|
439
|
-
console.log(`\n📊 Prompt constructed: ${prompt.length} chars total`);
|
|
440
|
-
console.log(` - Workflow: ${workflow.content.length} chars (encrypted)`);
|
|
441
|
-
console.log(` - Rules: ${rules.length} loaded dynamically from Guardrails`);
|
|
442
|
-
console.log(` - Templates: ${templates.length} loaded dynamically from Output section`);
|
|
443
|
-
|
|
444
436
|
// Store prompt internally for Cascade execution (not exposed to user)
|
|
445
437
|
this._lastPrompt = prompt;
|
|
446
438
|
|
package/package.json
CHANGED