Skip to content

Line slicing for curated context #405

Description

@jamesrochabrun

Parent: #398

Depends on: Context Builder MVP.

Goal

Allow curated context to include specific line ranges from large files instead of always including full file contents.

Implementation Notes

Add line-range support to the context model and assembler before adding rich editor interactions.

Suggested types/behavior:

  • LineRange(start, end, description?), 1-based inclusive
  • clamp ranges against current file content at assembly time
  • merge overlapping or adjacent ranges
  • assembled output labels file path and selected line ranges
  • token estimates use sliced text, not full file contents

Editor integration can start small: if direct drag-selection in SourceCodeEditorView is too large for this issue, expose line slicing in the Context Builder preview first.

Acceptance Criteria

  • A selected slice emits only that line range in the assembled context.
  • Overlapping/adjacent slices merge deterministically.
  • Stale ranges clamp safely when the file has changed.
  • Full-file selection remains supported alongside sliced files.

Tests

Add pure tests for range normalization, merging, clamping, and assembled sliced output.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions