Add strip_fences option and fix exec() scoping for nested functions

- Add strip_fences field to PromptStep for removing markdown code fences
- Fix exec() to use same dict for globals and locals, allowing nested
  functions to access module-level imports
- Add GUI checkbox for strip_fences option
- Update CLAUDE.md with improved documentation

Co-Authored-By: Claude Opus 4.5 <[email protected]>
This commit is contained in:
rob
2026-02-17 16:14:45 -04:00
co-authored by Claude Opus 4.5
parent 33b807d545
commit f980fe05f1
5 changed files with 121 additions and 18 deletions
+9 -2
View File
@@ -5,7 +5,8 @@ import ast
from PySide6.QtWidgets import (
QDialog, QVBoxLayout, QFormLayout, QLineEdit,
QComboBox, QPushButton, QHBoxLayout, QLabel,
QPlainTextEdit, QSplitter, QGroupBox, QTextEdit, QMessageBox
QPlainTextEdit, QSplitter, QGroupBox, QTextEdit, QMessageBox,
QCheckBox
)
from PySide6.QtCore import Qt, QThread, Signal
@@ -68,6 +69,10 @@ class PromptStepDialog(QDialog):
self.output_input.setText("response")
form.addRow("Output variable:", self.output_input)
# Strip fences checkbox
self.strip_fences_check = QCheckBox("Strip markdown code fences from output")
form.addRow("", self.strip_fences_check)
layout.addLayout(form)
# Prompt text
@@ -118,6 +123,7 @@ class PromptStepDialog(QDialog):
self.output_input.setText(step.output_var)
self.prompt_input.setPlainText(step.prompt)
self.strip_fences_check.setChecked(step.strip_fences)
def _validate_and_accept(self):
"""Validate and accept."""
@@ -146,7 +152,8 @@ class PromptStepDialog(QDialog):
provider=self.provider_combo.currentText(),
output_var=self.output_input.text().strip(),
profile=profile,
name=name
name=name,
strip_fences=self.strip_fences_check.isChecked()
)