Skip to contents

Reads an .R, .Rmd, .qmd or .ipynb document and lists its gptr blocks with their status: fresh (the owning call's prompt matches), stale (the prompt changed, or no call owns the block), user-edited (the body no longer matches its sha) or undone (made inert by a rewind). Interpolated values are only known when the call runs, so they are not checked here. It reads the document; the only write is that blocks an Rscript run queued before it was killed are applied first (never over your edits).

Usage

gptr_blocks(file)

Arguments

file

Path of the document.

Value

A gptr_blocks data frame with columns id, lines, prompt, status, model, date, tokens, cost, session.

Examples

f = tempfile(fileext = ".R")
writeLines(c('peter("add one")',
             "# >>> gptr:7f3a21 model=fake/fake-1 date=2026-09-29 prompt=3b1c9a0e77d2",
             "x = 1 + 1", "# <<< gptr:7f3a21"), f)
gptr_blocks(f)
#>   id      status  lines  prompt   model        date        tokens  cost  session
#> 1 7f3a21  stale   2-4    add one  fake/fake-1  2026-09-29  NA      NA    NA
#> 
#> # 1 row