@probelabs/probe 0.6.0-rc263 → 0.6.0-rc265

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.
@@ -448,6 +448,13 @@ Parameters:
448
448
  return `Error editing file: Multiple occurrences found - the old_string appears ${occurrences} times in ${file_path}. To fix: (1) Set replace_all=true to replace all occurrences, or (2) Include more surrounding lines in old_string to make the match unique (add the full line or adjacent lines for context).`;
449
449
  }
450
450
 
451
+ // Guard against over-scoped text edits (replacing large blocks with tiny replacements)
452
+ const oldLines = matchTarget.split('\n').length;
453
+ const newLines = new_string.split('\n').length;
454
+ if (oldLines >= 20 && newLines < oldLines * 0.5) {
455
+ return `Error editing file: Edit scope too large — replacing ${oldLines} lines with ${newLines} lines risks accidental content deletion. To fix: (1) Use line-targeted editing (start_line/end_line) instead to constrain scope, or (2) Split into smaller, focused edits that each target only the lines you intend to change.`;
456
+ }
457
+
451
458
  // Perform the replacement
452
459
  let newContent;
453
460
  if (replace_all) {