From 99eb434f606851d0fd1798b160a01ea8c06b5eb5 Mon Sep 17 00:00:00 2001 From: Ed_ Date: Wed, 10 Jun 2026 23:45:37 -0400 Subject: [PATCH] docs(curation): correct FuzzyAnchor docstring (add get_context helper, replace 'anchor_lines' with actual field names) --- docs/guide_context_curation.md | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/docs/guide_context_curation.md b/docs/guide_context_curation.md index cbe36152..0f648f17 100644 --- a/docs/guide_context_curation.md +++ b/docs/guide_context_curation.md @@ -83,13 +83,24 @@ Text slices defined by line numbers become invalid when files are modified (line ```python # src/fuzzy_anchor.py class FuzzyAnchor: + @staticmethod + def get_context(lines: list[str], index: int, count: int, direction: int) -> list[str]: + """Helper: extract up to `count` non-empty lines starting at `index` and walking + in `direction` (1 = forward, -1 = backward). Used to build the start/end anchors + for fuzzy re-resolution.""" + @classmethod def create_slice(cls, text: str, start_line: int, end_line: int) -> dict: - """Returns slice_data with content_hash, anchor_lines, and positions.""" + """Returns slice_data with start_line, end_line, content_hash, start_context, + and end_context fields. start_line/end_line are 1-based; the hash is MD5 + of the region's text.""" @classmethod def resolve_slice(cls, text: str, slice_data: dict) -> Optional[Tuple[int, int]]: - """Resolves slice position in modified text, returns (start, end) or None.""" + """Resolves slice position in modified text. Returns (start, end) on success + or None if the slice can no longer be located. Strategy: (1) try exact + match by content hash at the original line range; (2) fall back to fuzzy + match by walking the start_context and end_context anchors.""" ``` ### Slice Data Structure