flappa-doormal 2.14.1 → 2.14.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/AGENTS.md CHANGED
@@ -604,6 +604,8 @@ bunx biome lint .
604
604
 
605
605
  48. **The "adding content changes behavior" smell**: If adding unrelated content (like a second page) dramatically changes how the first page is processed, suspect incorrect span/window calculations. The fix pattern: ensure window calculations are scoped to the CURRENT context (current page) not the ORIGINAL context (all remaining content).
606
606
 
607
+ 49. **Use `trimStart()` not `trim()` for user-provided patterns with semantic whitespace**: When processing user-provided patterns like the `words` field, only strip leading whitespace (likely accidental). Trailing whitespace may be intentional for whole-word matching (e.g., `'بل '` should match only the standalone word, not words starting with `بل` like `بلغ`). **Bug symptom**: `words: ['بل ']` matched `بلغ` because `.trim()` stripped the trailing space to just `بل`. **Fix**: Use `.trimStart()` to preserve trailing whitespace.
608
+
607
609
  ### Process Template (Multi-agent design review, TDD-first)
608
610
 
609
611
  If you want to repeat the “write a plan → get multiple AI critiques → synthesize → update plan → implement TDD-first” workflow, use:
package/dist/index.mjs CHANGED
@@ -1690,7 +1690,7 @@ const createSegment = (content, fromPageId, toPageId, meta) => {
1690
1690
  * Words are escaped, processed, sorted by length, and joined with alternation.
1691
1691
  */
1692
1692
  const buildWordsRegex = (words, processPattern$1) => {
1693
- const processed = words.map((w) => w.trim()).filter((w) => w.length > 0).map((w) => processPattern$1(escapeWordsOutsideTokens(w)));
1693
+ const processed = words.map((w) => w.trimStart()).filter((w) => w.length > 0).map((w) => processPattern$1(escapeWordsOutsideTokens(w)));
1694
1694
  const unique = [...new Set(processed)];
1695
1695
  if (unique.length === 0) return null;
1696
1696
  unique.sort((a, b) => b.length - a.length);